@vidispine/vdt-mui 23.3.0-pre.6 → 23.4.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/_utils/isDefinedValue.js +1 -1
  2. package/dist/cjs/entity/EntityCard/components/EntityCardHeader.js +1 -1
  3. package/dist/cjs/general/Form/Form.js +1 -1
  4. package/dist/cjs/index.js +1 -1
  5. package/dist/cjs/inputs/DateTimeInput/index.js +1 -1
  6. package/dist/cjs/inputs/NumberInput/NumberInput.js +1 -1
  7. package/dist/cjs/inputs/NumberInput/index.js +1 -1
  8. package/dist/cjs/inputs/SelectInput/index.js +1 -1
  9. package/dist/cjs/metadata/MetadataForm/MetadataForm.js +1 -0
  10. package/dist/cjs/metadata/MetadataForm/hooks/UseMetadataFormInputs.js +1 -0
  11. package/dist/cjs/metadata/MetadataForm/index.js +1 -0
  12. package/dist/es/_types.d.ts +1 -0
  13. package/dist/es/_utils/isDefinedValue.js +1 -1
  14. package/dist/es/_utils/withOverrides.d.ts +1 -2
  15. package/dist/es/entity/EntityCard/components/EntityCardHeader.d.ts +2 -1
  16. package/dist/es/entity/EntityCard/components/EntityCardHeader.js +25 -25
  17. package/dist/es/event/EventList/index.d.ts +2 -1
  18. package/dist/es/event/EventListItem/index.d.ts +2 -1
  19. package/dist/es/general/CalendarPicker/components/PickersDay.d.ts +1 -2
  20. package/dist/es/general/Form/Form.d.ts +4 -6
  21. package/dist/es/general/Form/Form.js +92 -91
  22. package/dist/es/general/MediaIcon/MediaIcon.d.ts +13 -10
  23. package/dist/es/general/Sort/Sort.d.ts +1 -3
  24. package/dist/es/index.d.ts +1 -0
  25. package/dist/es/index.js +42 -38
  26. package/dist/es/inputs/CheckboxGroupInput/components/CheckboxGroup.d.ts +1 -2
  27. package/dist/es/inputs/DateTimeInput/index.js +4 -4
  28. package/dist/es/inputs/MaskedTextInput/components/MaskedInputComponent.d.ts +2 -3
  29. package/dist/es/inputs/NumberInput/NumberInput.js +8 -8
  30. package/dist/es/inputs/NumberInput/index.js +3 -3
  31. package/dist/es/inputs/RadioGroupInput/components/RadioGroup.d.ts +1 -2
  32. package/dist/es/inputs/SelectInput/index.js +3 -3
  33. package/dist/es/inputs/SliderInput/components/Slider.d.ts +1 -2
  34. package/dist/es/metadata/MetadataForm/MetadataForm.d.ts +65 -0
  35. package/dist/es/metadata/MetadataForm/MetadataForm.js +70 -0
  36. package/dist/es/metadata/MetadataForm/hooks/UseMetadataFormInputs.d.ts +98 -0
  37. package/dist/es/metadata/MetadataForm/hooks/UseMetadataFormInputs.js +98 -0
  38. package/dist/es/metadata/MetadataForm/index.d.ts +3 -0
  39. package/dist/es/metadata/MetadataForm/index.js +12 -0
  40. package/dist/es/metadata/MetadataGroupTreeView/index.d.ts +2 -1
  41. package/dist/es/metadata/index.d.ts +1 -0
  42. package/dist/es/search/SearchFilterForm/hooks/UseSearchFilterFormInputs.d.ts +9 -10
  43. package/package.json +19 -19
package/dist/es/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { default as a } from "./collection/CollectionList/index.js";
2
2
  import { default as r } from "./collection/CollectionListItem/index.js";
3
3
  import { default as m } from "./collection/CollectionRepresentativeThumbnail/index.js";
4
- import { default as u } from "./collection/CollectionCard/index.js";
5
- import { default as s } from "./entity/EntityIcon/index.js";
4
+ import { default as l } from "./collection/CollectionCard/index.js";
5
+ import { default as d } from "./entity/EntityIcon/index.js";
6
6
  import { default as x } from "./entity/EntityAvatar/index.js";
7
7
  import { default as i } from "./entity/EntityList/index.js";
8
8
  import { default as c } from "./general/AvatarMenu/index.js";
9
- import { default as T } from "./general/BlurredBackground/index.js";
9
+ import { default as C } from "./general/BlurredBackground/index.js";
10
10
  import { default as b } from "./general/CalendarPicker/index.js";
11
11
  import { default as B } from "./general/CompactBadge/index.js";
12
- import { default as h } from "./general/CompactLabel/index.js";
13
- import { default as E } from "./general/CornerLabelPlacer/index.js";
12
+ import { default as P } from "./general/CompactLabel/index.js";
13
+ import { default as v } from "./general/CornerLabelPlacer/index.js";
14
14
  import { default as S } from "./general/ExpandButton/index.js";
15
- import { default as R } from "./general/ImageCollage/index.js";
16
- import { default as D } from "./general/MediaIcon/index.js";
17
- import { default as w } from "./general/MenuItem/index.js";
18
- import { default as G } from "./general/VirtualizedList/index.js";
15
+ import { default as F } from "./general/ImageCollage/index.js";
16
+ import { default as w } from "./general/MediaIcon/index.js";
17
+ import { default as D } from "./general/MenuItem/index.js";
18
+ import { default as V } from "./general/VirtualizedList/index.js";
19
19
  import { default as z } from "./general/ScrubLine/index.js";
20
20
  import { default as j } from "./general/Sort/index.js";
21
21
  import { default as H } from "./general/TablePagination/index.js";
@@ -27,75 +27,79 @@ import { default as $ } from "./item/ItemThumbnail/index.js";
27
27
  import { default as te } from "./item/ItemCard/index.js";
28
28
  import { default as oe } from "./item/ItemTable/index.js";
29
29
  import { default as fe } from "./item/ItemTableRow/index.js";
30
- import { default as le } from "./item/ItemPoster/index.js";
30
+ import { default as ue } from "./item/ItemPoster/index.js";
31
31
  import { default as pe } from "./item/ItemPosterViewer/index.js";
32
- import { default as de } from "./item/ItemPosterList/index.js";
32
+ import { default as se } from "./item/ItemPosterList/index.js";
33
33
  import { default as ne } from "./inputs/BasicDateTimeInput/index.js";
34
34
  import { default as Ie } from "./inputs/BooleanInput/index.js";
35
- import { default as Ce } from "./inputs/CheckboxGroupInput/index.js";
35
+ import { default as Te } from "./inputs/CheckboxGroupInput/index.js";
36
36
  import { default as Le } from "./inputs/DateRangeInput/index.js";
37
37
  import { default as ge } from "./inputs/DateTimeInput/index.js";
38
- import { default as Pe } from "./inputs/MaskedTextInput/index.js";
39
- import { default as ve } from "./inputs/NumberInput/index.js";
40
- import { default as Me } from "./inputs/RadioGroupInput/index.js";
38
+ import { default as Me } from "./inputs/MaskedTextInput/index.js";
39
+ import { default as he } from "./inputs/NumberInput/index.js";
40
+ import { default as Ee } from "./inputs/RadioGroupInput/index.js";
41
41
  import { default as ke } from "./inputs/SelectInput/index.js";
42
- import { default as ye } from "./inputs/SliderInput/index.js";
43
- import { default as Fe } from "./inputs/TagInput/index.js";
44
- import { default as Ae } from "./inputs/TextInput/index.js";
45
- import { default as Ve } from "./shape/ShapeMediaBadges/index.js";
42
+ import { default as Re } from "./inputs/SliderInput/index.js";
43
+ import { default as ye } from "./inputs/TagInput/index.js";
44
+ import { default as Ge } from "./inputs/TextInput/index.js";
45
+ import { default as Ae } from "./shape/ShapeMediaBadges/index.js";
46
46
  import { default as Ne } from "./search/SearchFilterForm/index.js";
47
47
  import { default as qe } from "./transcode/TranscodePresetMediaBadges/index.js";
48
48
  import { default as Je } from "./event/EventList/index.js";
49
49
  import { default as Oe } from "./event/EventListItem/index.js";
50
+ import { default as Ue } from "./metadata/MetadataGroupTreeView/index.js";
51
+ import { default as Xe } from "./metadata/MetadataForm/index.js";
50
52
  export {
51
53
  c as AvatarMenu,
52
54
  ne as BasicDateTimeInput,
53
- T as BlurredBackground,
55
+ C as BlurredBackground,
54
56
  Ie as BooleanInput,
55
57
  b as CalendarPicker,
56
- Ce as CheckboxGroupInput,
57
- u as CollectionCard,
58
+ Te as CheckboxGroupInput,
59
+ l as CollectionCard,
58
60
  a as CollectionList,
59
61
  r as CollectionListItem,
60
62
  m as CollectionRepresentativeThumbnail,
61
63
  B as CompactBadge,
62
- h as CompactLabel,
63
- E as CornerLabelPlacer,
64
+ P as CompactLabel,
65
+ v as CornerLabelPlacer,
64
66
  Le as DateRangeInput,
65
67
  ge as DateTimeInput,
66
68
  x as EntityAvatar,
67
- s as EntityIcon,
69
+ d as EntityIcon,
68
70
  i as EntityList,
69
71
  Je as EventList,
70
72
  Oe as EventListItem,
71
73
  S as ExpandButton,
72
74
  K as Form,
73
- R as ImageCollage,
75
+ F as ImageCollage,
74
76
  te as ItemCard,
75
77
  X as ItemList,
76
78
  Z as ItemListItem,
77
- le as ItemPoster,
78
- de as ItemPosterList,
79
+ ue as ItemPoster,
80
+ se as ItemPosterList,
79
81
  pe as ItemPosterViewer,
80
82
  oe as ItemTable,
81
83
  fe as ItemTableRow,
82
84
  $ as ItemThumbnail,
83
- Pe as MaskedTextInput,
84
- D as MediaIcon,
85
- w as MenuItem,
86
- ve as NumberInput,
87
- Me as RadioGroupInput,
85
+ Me as MaskedTextInput,
86
+ w as MediaIcon,
87
+ D as MenuItem,
88
+ Xe as MetadataForm,
89
+ Ue as MetadataGroupTreeView,
90
+ he as NumberInput,
91
+ Ee as RadioGroupInput,
88
92
  z as ScrubLine,
89
93
  Ne as SearchFilterForm,
90
94
  ke as SelectInput,
91
- Ve as ShapeMediaBadges,
92
- ye as SliderInput,
95
+ Ae as ShapeMediaBadges,
96
+ Re as SliderInput,
93
97
  j as Sort,
94
98
  H as TablePagination,
95
- Fe as TagInput,
96
- Ae as TextInput,
99
+ ye as TagInput,
100
+ Ge as TextInput,
97
101
  Q as ThemeProvider,
98
102
  qe as TranscodePresetMediaBadges,
99
- G as VirtualizedList,
103
+ V as VirtualizedList,
100
104
  U as useThemeContext
101
105
  };
@@ -1,4 +1,3 @@
1
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
1
  /// <reference types="react" />
3
2
  import type { FormGroupProps as MuiFormGroupProps, FormControlLabelProps as MuiFormControlLabelProps, CheckboxProps as MuiCheckboxProps } from '@mui/material';
4
3
  export interface CheckboxGroupProps extends Omit<MuiFormGroupProps, 'onChange'> {
@@ -38,5 +37,5 @@ export interface CheckboxGroupProps extends Omit<MuiFormGroupProps, 'onChange'>
38
37
  rows: boolean;
39
38
  type: string;
40
39
  }
41
- declare const CheckboxGroup: ForwardRefExoticComponent<Pick<CheckboxGroupProps, keyof CheckboxGroupProps> & RefAttributes<unknown>>;
40
+ declare const CheckboxGroup: import("react").ForwardRefExoticComponent<Pick<CheckboxGroupProps, keyof CheckboxGroupProps> & import("react").RefAttributes<unknown>>;
42
41
  export default CheckboxGroup;
@@ -1,11 +1,11 @@
1
1
  import { styled as m } from "@mui/material/styles";
2
2
  import r from "./DateTimeInput.js";
3
3
  import { withOverrides as s } from "../../_utils/withOverrides.js";
4
- const o = "DateTimeInput", t = `Vdt${o}`, p = s(t)(r), e = m(p, {
5
- name: t,
6
- overridesResolver: (i, n) => n.root
4
+ const t = "DateTimeInput", o = `Vdt${t}`, i = s(o)(r), e = m(i, {
5
+ name: o,
6
+ overridesResolver: (p, n) => n.root
7
7
  })({});
8
- e.displayName = o;
8
+ e.displayName = t;
9
9
  const l = e;
10
10
  export {
11
11
  l as default
@@ -1,4 +1,3 @@
1
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
1
  /// <reference types="react" />
3
2
  import { IMaskInput } from 'react-imask';
4
3
  import { PropsFrom } from '../../../_types';
@@ -9,8 +8,8 @@ export type MaskedInputProps = PropsFrom<typeof IMaskInput> & {
9
8
  definitions?: IMaskDefinitions;
10
9
  lazy?: IMaskLazy;
11
10
  };
12
- declare const MaskedInput: ForwardRefExoticComponent<{
11
+ declare const MaskedInput: import("react").ForwardRefExoticComponent<{
13
12
  definitions?: any;
14
13
  lazy?: any;
15
- } & RefAttributes<unknown>>;
14
+ } & import("react").RefAttributes<unknown>>;
16
15
  export default MaskedInput;
@@ -3,12 +3,12 @@ import w from "@mui/material/TextField";
3
3
  const y = {
4
4
  Root: w
5
5
  }, u = ({
6
- name: e,
6
+ name: n,
7
7
  label: s,
8
- value: n,
8
+ value: t,
9
9
  defaultValue: m,
10
- helperText: r,
11
- error: t,
10
+ helperText: l,
11
+ error: e,
12
12
  required: v,
13
13
  disabled: c,
14
14
  fullWidth: p,
@@ -28,12 +28,12 @@ const y = {
28
28
  g(o, {
29
29
  value: j
30
30
  });
31
- }, R = n !== void 0, l = !!t, V = (t || "").trim();
32
- return /* @__PURE__ */ q(F, { id: e, name: e, label: s, ...R ? {
33
- value: n
31
+ }, R = t !== void 0, r = !!e, V = (e || "").trim();
32
+ return /* @__PURE__ */ q(F, { id: n, name: n, label: s, ...R ? {
33
+ value: t === null ? "" : t
34
34
  } : {
35
35
  defaultValue: m
36
- }, helperText: (V || r) && l ? t : r, error: l, required: v, disabled: c, fullWidth: p, variant: f, size: C, type: "number", autoComplete: "off", onChange: P, onBlur: h, onFocus: x, ...T.root });
36
+ }, helperText: (V || l) && r ? e : l, error: r, required: v, disabled: c, fullWidth: p, variant: f, size: C, type: "number", autoComplete: "off", onChange: P, onBlur: h, onFocus: x, ...T.root });
37
37
  };
38
38
  u.defaultProps = {
39
39
  name: void 0,
@@ -1,9 +1,9 @@
1
- import { styled as r } from "@mui/material/styles";
1
+ import { styled as n } from "@mui/material/styles";
2
2
  import m from "./NumberInput.js";
3
3
  import { withOverrides as s } from "../../_utils/withOverrides.js";
4
- const o = "NumberInput", t = `Vdt${o}`, p = s(t)(m), e = r(p, {
4
+ const o = "NumberInput", t = `Vdt${o}`, p = s(t)(m), e = n(p, {
5
5
  name: t,
6
- overridesResolver: (d, n) => n.root
6
+ overridesResolver: (d, r) => r.root
7
7
  })({});
8
8
  e.displayName = o;
9
9
  const l = e;
@@ -1,4 +1,3 @@
1
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
1
  /// <reference types="react" />
3
2
  import type { RadioGroupProps as MuiRadioGroupProps, FormControlLabelProps as MuiFormControlLabelProps, RadioProps as MuiRadioProps } from '@mui/material';
4
3
  export interface RadioGroupProps extends Omit<MuiRadioGroupProps, 'onChange'> {
@@ -38,5 +37,5 @@ export interface RadioGroupProps extends Omit<MuiRadioGroupProps, 'onChange'> {
38
37
  rows: boolean;
39
38
  type: string;
40
39
  }
41
- declare const RadioGroup: ForwardRefExoticComponent<Pick<RadioGroupProps, keyof RadioGroupProps> & RefAttributes<unknown>>;
40
+ declare const RadioGroup: import("react").ForwardRefExoticComponent<Pick<RadioGroupProps, keyof RadioGroupProps> & import("react").RefAttributes<unknown>>;
42
41
  export default RadioGroup;
@@ -1,11 +1,11 @@
1
1
  import { styled as r } from "@mui/material/styles";
2
2
  import m from "./SelectInput.js";
3
3
  import { withOverrides as s } from "../../_utils/withOverrides.js";
4
- const o = "SelectInput", t = `Vdt${o}`, p = s(t)(m), e = r(p, {
5
- name: t,
4
+ const t = "SelectInput", o = `Vdt${t}`, p = s(o)(m), e = r(p, {
5
+ name: o,
6
6
  overridesResolver: (d, n) => n.root
7
7
  })({});
8
- e.displayName = o;
8
+ e.displayName = t;
9
9
  const a = e;
10
10
  export {
11
11
  a as default
@@ -1,4 +1,3 @@
1
- import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
1
  /// <reference types="react" />
3
2
  import type { SliderProps as MuiSliderProps } from '@mui/material';
4
3
  export interface SliderProps extends Omit<MuiSliderProps, 'onChange'> {
@@ -26,5 +25,5 @@ export interface SliderProps extends Omit<MuiSliderProps, 'onChange'> {
26
25
  rows?: boolean;
27
26
  type?: string;
28
27
  }
29
- declare const Slider: ForwardRefExoticComponent<Pick<SliderProps, keyof SliderProps> & RefAttributes<HTMLSpanElement>>;
28
+ declare const Slider: import("react").ForwardRefExoticComponent<Pick<SliderProps, keyof SliderProps> & import("react").RefAttributes<HTMLSpanElement>>;
30
29
  export default Slider;
@@ -0,0 +1,65 @@
1
+ /// <reference types="react" />
2
+ import { Box as MuiBox } from '@mui/material';
3
+ import type { MetadataFieldType, MetadataType } from '@vidispine/types';
4
+ import VdtForm from '../../general/Form';
5
+ import type { PropsFrom, WithOverrideProps } from '../../_types';
6
+ declare const defaultComponents: {
7
+ Root: typeof MuiBox;
8
+ Form: typeof VdtForm;
9
+ };
10
+ export interface MetadataFormProps extends WithOverrideProps<typeof defaultComponents> {
11
+ /**
12
+ * A VidiCore field definition list to create metadata inputs from
13
+ */
14
+ fieldList?: MetadataFieldType[];
15
+ /**
16
+ * The metadata of a Vidicore entity to extract current values from
17
+ */
18
+ metadata?: MetadataType;
19
+ /**
20
+ * Override input props using field __name__ or __type__ as key
21
+ *
22
+ * Note: `name` props has precedence if prop is applicable from both name and type
23
+ *
24
+ * E.g. `{ 'vdt_stringField': { label: 'String Field', disabled: true, Component: CheckboxGroupInput } }` or `{ 'string-exact': { ...customInputProps } }`
25
+ */
26
+ inputsProps?: {
27
+ [fieldNameOrType: string]: object;
28
+ };
29
+ /**
30
+ * Map a field data key to an input prop (ignores data keys it can't find on fields)
31
+ *
32
+ * E.g. `{ label: 'displayName' }` would add the value from data key 'displayName' as a label prop
33
+ */
34
+ dataToPropsMap?: {
35
+ [propKey: string]: string;
36
+ };
37
+ /**
38
+ * Callback when inputs are resetted to current metadata values
39
+ */
40
+ onReset?: (event: React.SyntheticEvent) => void;
41
+ /**
42
+ * Callback when form is changed
43
+ */
44
+ onChange?: (event: React.SyntheticEvent | null, payload: {
45
+ values: {
46
+ [fieldName: string]: any;
47
+ };
48
+ metadata: MetadataType;
49
+ }) => void;
50
+ /**
51
+ * Callback when form is submitted
52
+ */
53
+ onSubmit?: (event: React.BaseSyntheticEvent, payload: {
54
+ values: {
55
+ [fieldName: string]: any;
56
+ };
57
+ metadata: MetadataType;
58
+ }) => void;
59
+ /**
60
+ * Callback when form is submitted with errors (invalid values according to form rules)
61
+ */
62
+ onError?: PropsFrom<typeof VdtForm>['onError'];
63
+ }
64
+ declare const MetadataForm: React.FC<MetadataFormProps>;
65
+ export default MetadataForm;
@@ -0,0 +1,70 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useRef as P } from "react";
3
+ import S from "@mui/material/Box";
4
+ import { createMetadataType as p } from "@vidispine/vdt-js";
5
+ import T from "../../general/Form/index.js";
6
+ import V from "./hooks/UseMetadataFormInputs.js";
7
+ const B = {
8
+ Root: S,
9
+ Form: T
10
+ }, f = ({
11
+ fieldList: l,
12
+ metadata: u,
13
+ dataToPropsMap: h,
14
+ inputsProps: v,
15
+ onReset: F,
16
+ onChange: r,
17
+ onSubmit: n,
18
+ onError: i,
19
+ components: y,
20
+ componentsProps: d
21
+ }) => {
22
+ const {
23
+ Root: R,
24
+ Form: b
25
+ } = y, a = P(), s = (t) => {
26
+ const o = Object.keys(a.current.formState.dirtyFields);
27
+ return Object.keys(t).reduce((j, e) => {
28
+ const m = {
29
+ ...j
30
+ };
31
+ return o.includes(e) && (m[e] = t[e]), m;
32
+ }, {});
33
+ }, x = V({
34
+ fieldList: l,
35
+ metadata: u,
36
+ dataToPropsMap: h,
37
+ inputsProps: v
38
+ }), M = typeof r != "function" ? void 0 : (t, o) => {
39
+ r(t, {
40
+ values: o,
41
+ metadata: p(s(o))
42
+ });
43
+ }, C = typeof n != "function" ? void 0 : (t, o) => {
44
+ n(t, {
45
+ values: o,
46
+ metadata: p(s(o))
47
+ });
48
+ }, g = typeof i != "function" ? void 0 : i;
49
+ return /* @__PURE__ */ c(R, { ...d.root, children: /* @__PURE__ */ c(b, { inputs: x, onReset: F, onChange: M, onSubmit: C, onError: g, formReturnRef: a, ...d.form }) });
50
+ };
51
+ f.defaultProps = {
52
+ fieldList: void 0,
53
+ metadata: void 0,
54
+ dataToPropsMap: {
55
+ label: "label",
56
+ helperText: "description",
57
+ placeholder: "placeholder"
58
+ },
59
+ inputsProps: void 0,
60
+ onReset: void 0,
61
+ onChange: void 0,
62
+ onSubmit: void 0,
63
+ onError: void 0,
64
+ components: B,
65
+ componentsProps: void 0
66
+ };
67
+ const q = f;
68
+ export {
69
+ q as default
70
+ };
@@ -0,0 +1,98 @@
1
+ import type { MetadataType, MetadataFieldType } from '@vidispine/types';
2
+ declare const useMetadataFormInputs: ({ fieldList, metadata, dataToPropsMap, errorMessages, inputsProps, }: {
3
+ fieldList?: MetadataFieldType[];
4
+ metadata?: MetadataType;
5
+ dataToPropsMap?: {
6
+ [propKey: string]: string;
7
+ };
8
+ errorMessages?: {
9
+ [fieldName: string]: string | ((fieldName: string) => string);
10
+ };
11
+ inputsProps?: object;
12
+ }) => ({
13
+ Component: import("react").FC<{
14
+ name?: string;
15
+ label?: string;
16
+ value?: any;
17
+ defaultValue?: any;
18
+ error?: string;
19
+ helperText?: string;
20
+ required?: boolean;
21
+ disabled?: boolean;
22
+ onChange?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
23
+ [key: string]: any;
24
+ value: any;
25
+ }) => void;
26
+ onBlur?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
27
+ [key: string]: any;
28
+ value: any;
29
+ }) => void;
30
+ onFocus?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
31
+ [key: string]: any;
32
+ value: any;
33
+ }) => void;
34
+ options?: any[];
35
+ placeholder?: string;
36
+ fullWidth?: boolean;
37
+ variant?: string;
38
+ size?: string;
39
+ orientation?: string;
40
+ multiple?: boolean;
41
+ labelPlacement?: string;
42
+ min?: any;
43
+ max?: any;
44
+ type?: string;
45
+ range?: boolean;
46
+ locale?: string;
47
+ justifyContent?: string;
48
+ submitOnChange?: boolean;
49
+ onSubmit?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
50
+ [key: string]: any;
51
+ value: any;
52
+ }) => void;
53
+ }>;
54
+ rules?: UseControllerProps;
55
+ } & {
56
+ name?: string;
57
+ label?: string;
58
+ value?: any;
59
+ defaultValue?: any;
60
+ error?: string;
61
+ helperText?: string;
62
+ required?: boolean;
63
+ disabled?: boolean;
64
+ onChange?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
65
+ [key: string]: any;
66
+ value: any;
67
+ }) => void;
68
+ onBlur?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
69
+ [key: string]: any;
70
+ value: any;
71
+ }) => void;
72
+ onFocus?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
73
+ [key: string]: any;
74
+ value: any;
75
+ }) => void;
76
+ options?: any[];
77
+ placeholder?: string;
78
+ fullWidth?: boolean;
79
+ variant?: string;
80
+ size?: string;
81
+ orientation?: string;
82
+ multiple?: boolean;
83
+ labelPlacement?: string;
84
+ min?: any;
85
+ max?: any;
86
+ type?: string;
87
+ range?: boolean;
88
+ locale?: string;
89
+ justifyContent?: string;
90
+ submitOnChange?: boolean;
91
+ onSubmit?: (event: import("react").SyntheticEvent<Element, Event>, payload: {
92
+ [key: string]: any;
93
+ value: any;
94
+ }) => void;
95
+ } & {
96
+ [key: string]: any;
97
+ })[];
98
+ export default useMetadataFormInputs;
@@ -0,0 +1,98 @@
1
+ import { useMemo as f, useCallback as I } from "react";
2
+ import { parseFieldDefinitionList as U, parseMetadataType as j } from "@vidispine/vdt-js";
3
+ import q from "../../../inputs/DateRangeInput/index.js";
4
+ import M from "../../../inputs/DateTimeInput/index.js";
5
+ import V from "../../../inputs/NumberInput/index.js";
6
+ import k from "../../../inputs/SelectInput/index.js";
7
+ import G from "../../../inputs/SliderInput/index.js";
8
+ import $ from "../../../inputs/TagInput/index.js";
9
+ import w from "../../../inputs/TextInput/index.js";
10
+ const z = "Invalid value", B = {
11
+ TextInput: w,
12
+ TagInput: $,
13
+ SliderInput: G,
14
+ DateRangeInput: q,
15
+ DateTimeInput: M,
16
+ NumberInput: V,
17
+ SelectInput: k
18
+ }, H = ({
19
+ fieldList: d,
20
+ metadata: g,
21
+ dataToPropsMap: p,
22
+ errorMessages: o,
23
+ inputsProps: u
24
+ }) => {
25
+ const {
26
+ TextInput: l,
27
+ TagInput: T,
28
+ DateTimeInput: D,
29
+ NumberInput: R,
30
+ SelectInput: S
31
+ } = B, i = f(() => U(d), [d]), b = f(() => j(g, {
32
+ flat: !0
33
+ }), [g]), v = I((t) => {
34
+ const n = (e) => {
35
+ const m = t == null ? void 0 : t[e], r = o == null ? void 0 : o[e];
36
+ if (m !== void 0)
37
+ return {
38
+ value: m,
39
+ message: (typeof r == "function" ? r(e) : r) || z
40
+ };
41
+ };
42
+ return {
43
+ required: n("required"),
44
+ minLength: n("minLength"),
45
+ maxLength: n("maxLength"),
46
+ min: n("minInclusive"),
47
+ max: n("maxInclusive"),
48
+ pattern: n("pattern")
49
+ };
50
+ }, [o]), N = (t) => ["float", "integer", "long"].includes(t), x = (t) => ["string", "string-exact"].includes(t), F = (t) => t === "date", h = I(({
51
+ type: t,
52
+ options: n,
53
+ currentValue: e
54
+ }) => x(t) ? {
55
+ freeSolo: !n.length,
56
+ multiple: (e == null ? void 0 : e.length) > 1
57
+ } : {}, []), s = I(({
58
+ type: t
59
+ }, n, e) => x(t) ? (n == null ? void 0 : n.length) > 1 ? T : e != null && e.length ? S : l : N(t) ? R : F(t) ? D : l, [D, R, S, T, l]);
60
+ return f(() => i == null ? void 0 : i.map(({
61
+ name: t,
62
+ restrictions: n,
63
+ options: e,
64
+ type: m,
65
+ data: r,
66
+ system: L
67
+ }) => {
68
+ const O = {
69
+ ...(u == null ? void 0 : u[m]) || {},
70
+ ...(u == null ? void 0 : u[t]) || {}
71
+ }, C = v(n), c = b[t] || void 0, _ = {
72
+ label: t,
73
+ defaultValue: c || "",
74
+ options: e,
75
+ rules: C,
76
+ disabled: L,
77
+ ...Object.fromEntries(Object.entries(p).map(([a, E]) => r[E] ? [a, r[E]] : void 0).filter((a) => !!a)),
78
+ ...O
79
+ }, A = {
80
+ ...h({
81
+ type: m,
82
+ options: e,
83
+ currentValue: c
84
+ }),
85
+ ..._
86
+ };
87
+ return {
88
+ name: t,
89
+ Component: s({
90
+ type: m
91
+ }, c, e),
92
+ ...A
93
+ };
94
+ }), [p, s, h, v, u, i, b]);
95
+ }, tt = H;
96
+ export {
97
+ tt as default
98
+ };
@@ -0,0 +1,3 @@
1
+ import Component from './MetadataForm';
2
+ declare const StyledComponent: typeof Component;
3
+ export default StyledComponent;
@@ -0,0 +1,12 @@
1
+ import { styled as r } from "@mui/material/styles";
2
+ import m from "./MetadataForm.js";
3
+ import { withOverrides as s } from "../../_utils/withOverrides.js";
4
+ const o = "MetadataForm", t = `Vdt${o}`, d = s(t)(m), e = r(d, {
5
+ name: t,
6
+ overridesResolver: (p, n) => n.root
7
+ })({});
8
+ e.displayName = o;
9
+ const l = e;
10
+ export {
11
+ l as default
12
+ };
@@ -1,2 +1,3 @@
1
- declare const StyledComponent: any;
1
+ import Component from './MetadataGroupTreeView';
2
+ declare const StyledComponent: typeof Component;
2
3
  export default StyledComponent;
@@ -1 +1,2 @@
1
1
  export { default as MetadataGroupTreeView } from './MetadataGroupTreeView';
2
+ export { default as MetadataForm } from './MetadataForm';