1.3.4 • Published 7 months ago

@woodytechnologies/metadata v1.3.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Infos

This package is compatible with IN2IT v3.4.5 (> .120)

Usage

Quick start

You need to add the modal div in your html page, the modal will be rendered inside this div

<div id="modal" />

After that you can import the component and use it

import { useSate } from 'react'
import Metadata from '@woodytechnologies/metadata'

const defaultMetadataText = {
  id: 'usermetadata_text_138f76f9-5a95-4940-9abc-47a7d9d7d672',
  name: 'Ingest name',
  type: 'text',
  config: {
    type: {},
    format: {
      name: 'text',
      max_length: '15',
      multi_line: false,
    },
  },
  mandatory: true,
  accessibility: 'mandatory',
  default: 'New name',
  defaultName: 'New name',
  placeholder: 'Enter Ingest name',
  value: 'New name',
}

function App() {
  const [metadataText, setMetadataText] = useState(defaultMetadataText)

  function handleChange(newValue) {
    const newMetadataText = { ...metadataText, value: newValue }
    setMetadataText(newMetadataText)
  }

  return (
    <div className='App'>
      <Metadata data={metadataText} onChange={handleChange} />
    </div>
  )
}
export default App

Result :

Metadata

Props

NameTypeDefaultDescription
dataobject{}The metadata object
onChangefunctionnullThe function called when the metadata is updated
sessionIDstring""The sessionID used to call the woody API
browseUrlstring""The browseUrl used to call the woody API
isSearchablebooleantrueIf the metadata is searchable or not (for metadata list and tags)
indexnumbernullThe index of the metadata in the list
inlinebooleanfalseIf the metadata is displayed inline or not
showNamebooleantrueIf the metadata name is displayed or not
colorstring""The color of the metadata
minifiedbooleanfalseIf the metadata is displayed minified or not
allowDropbooleanfalseIf the metadata is droppable or not
onDropfunctionnullThe function called when a metadata is dropped on the metadata (allowDrop)

The data object

The meta object is the json data you got from the woody API : See API documentation

SessionID / Auth

Two props are available

  • sessionID : The sessionID used to call the woody API
  • browseUrl : The browseUrl used to call the woody API
const sessionID = "session_945aab3d-298a-420a-8304-3ce60fb39149"
const browseUrl = "https://my-dev-server.woody-technologies.com/browser/browse"

function App() {
  return (
    <div className='App'>
      <Metadata {...} sessionID={sessionID} browseUrl={browseUrl} />
    </div>
  )
}

Styling

scss variables are available to customize the component style deeply

:root {
  --main-color: black;
  --woody-secondary: #4b4b4b;
  --woody-mandatory: #e30613;

  --boolean-background-color: #808080;
  --boolean-knob-color: #d3d3d3;

  --text-area-background-color: #2b2c32;
  --text-area-text-color: white;

  --list-background-color: white;
  --list-text-color: black;

  --tag-background-color: #d3d3d3;
  --tag-text-color: black;

  --btn-background-color: #d3d3d3;
  --btn-text-color: black;
}
1.3.4

7 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

1 year ago

1.2.1-5.beta

1 year ago

1.2.15

1 year ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.9

2 years ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.14

1 year ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago