@box/metadata-editor 0.93.3 → 0.94.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.
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +57 -41
- package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +39 -35
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +89 -87
- package/package.json +4 -3
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts +3 -2
- package/types/lib/components/metadata-editor-fields/types.d.ts +4 -0
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +2 -0
- package/types/lib/test-utils/sample-data.d.ts +8 -1
- package/types/lib/types.d.ts +2 -0
@@ -1,59 +1,75 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { ComboboxWithApiTreeView as K } from "@box/combobox-with-api";
|
2
|
+
import { useFormikContext as W, getIn as $, Field as j } from "formik";
|
3
|
+
import { forwardRef as D } from "react";
|
3
4
|
import { useIntl as R } from "react-intl";
|
4
|
-
import
|
5
|
-
import { ComboboxWithApiPagination as
|
6
|
-
import { g as
|
5
|
+
import q from "../../../../messages.js";
|
6
|
+
import { ComboboxWithApiPagination as z } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
|
7
|
+
import { g as x } from "../../../../../../chunks/utils2.js";
|
7
8
|
import { jsx as e } from "react/jsx-runtime";
|
8
|
-
const
|
9
|
-
description:
|
10
|
-
disableForm:
|
11
|
-
isAiSuggestionApplied:
|
12
|
-
fieldNamePrefix:
|
13
|
-
label:
|
14
|
-
portalElement:
|
15
|
-
taxonomyOptionsFetcher:
|
16
|
-
updateModePrefix:
|
17
|
-
className:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
const U = /* @__PURE__ */ D(({
|
10
|
+
description: i,
|
11
|
+
disableForm: l,
|
12
|
+
isAiSuggestionApplied: u,
|
13
|
+
fieldNamePrefix: p,
|
14
|
+
label: r,
|
15
|
+
portalElement: s,
|
16
|
+
taxonomyOptionsFetcher: y,
|
17
|
+
updateModePrefix: F,
|
18
|
+
className: c,
|
19
|
+
isMultilevelTaxonomyFieldEnabled: C
|
20
|
+
}, d) => {
|
21
|
+
const b = R(), n = `${F ?? p}.value`, {
|
22
|
+
setFieldValue: h,
|
23
|
+
values: f
|
24
|
+
} = W(), {
|
23
25
|
metadata: {
|
24
|
-
templateKey:
|
25
|
-
scope:
|
26
|
+
templateKey: k,
|
27
|
+
scope: M
|
26
28
|
}
|
27
|
-
} =
|
28
|
-
key:
|
29
|
+
} = f, P = $(f, p), {
|
30
|
+
key: T,
|
29
31
|
optionsRules: {
|
30
|
-
multiSelect:
|
32
|
+
multiSelect: a,
|
31
33
|
selectableLevels: t
|
32
|
-
}
|
33
|
-
|
34
|
+
},
|
35
|
+
levels: w
|
36
|
+
} = P, I = C && (t == null ? void 0 : t.some((o) => o > 1)), g = (o) => y(M, k, T, t == null ? void 0 : t[0], o), v = (o) => a || !(o != null && o.length) ? b.formatMessage(q.taxonomyPlaceholder) : void 0;
|
34
37
|
return /* @__PURE__ */ e("div", {
|
35
|
-
"data-testid": `${
|
38
|
+
"data-testid": `${r}-field`,
|
36
39
|
onKeyDown: (o) => o.stopPropagation(),
|
37
40
|
role: "presentation",
|
38
|
-
children: /* @__PURE__ */ e(
|
39
|
-
name:
|
41
|
+
children: /* @__PURE__ */ e(j, {
|
42
|
+
name: n,
|
40
43
|
children: ({
|
41
44
|
field: o
|
42
|
-
}) => /* @__PURE__ */ e(
|
43
|
-
ref:
|
44
|
-
className:
|
45
|
-
defaultFetcher:
|
46
|
-
disabled:
|
47
|
-
label:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
}) => I ? /* @__PURE__ */ e(K, {
|
46
|
+
ref: d,
|
47
|
+
className: c,
|
48
|
+
defaultFetcher: g,
|
49
|
+
disabled: l,
|
50
|
+
label: x(r, i, u),
|
51
|
+
levels: w,
|
52
|
+
multiselect: a,
|
53
|
+
onValueChange: (m) => h(n, m),
|
54
|
+
placeholder: v(o.value),
|
55
|
+
portalElement: s,
|
56
|
+
selectableLevels: t,
|
57
|
+
value: o.value
|
58
|
+
}) : /* @__PURE__ */ e(z, {
|
59
|
+
ref: d,
|
60
|
+
className: c,
|
61
|
+
defaultFetcher: g,
|
62
|
+
disabled: l,
|
63
|
+
label: x(r, i, u),
|
64
|
+
multiselect: a,
|
65
|
+
onValueChange: (m) => h(n, m),
|
66
|
+
placeholder: v(o.value),
|
67
|
+
portalElement: s,
|
52
68
|
value: o.value
|
53
69
|
})
|
54
70
|
})
|
55
71
|
});
|
56
72
|
});
|
57
73
|
export {
|
58
|
-
|
74
|
+
U as MetadataTaxonomyField
|
59
75
|
};
|
@@ -1,80 +1,84 @@
|
|
1
|
-
import
|
2
|
-
import { useFormikContext as
|
3
|
-
import
|
4
|
-
import { forwardRef as
|
5
|
-
import { AiSuggestionField as
|
6
|
-
import { UpdateModeFieldWrapper as
|
7
|
-
import { editorFieldTypes as
|
1
|
+
import C from "clsx";
|
2
|
+
import { useFormikContext as E } from "formik";
|
3
|
+
import P from "lodash/isUndefined";
|
4
|
+
import { forwardRef as R, useState as V, useCallback as U, useEffect as j, useMemo as T } from "react";
|
5
|
+
import { AiSuggestionField as $ } from "./components/ai-suggestion-field/ai-suggestion-field.js";
|
6
|
+
import { UpdateModeFieldWrapper as b } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
7
|
+
import { editorFieldTypes as B } from "./editor-field-types.js";
|
8
8
|
import { s as n } from "../../../../chunks/utils2.js";
|
9
|
-
import { jsx as a, jsxs as
|
10
|
-
const
|
9
|
+
import { jsx as a, jsxs as q } from "react/jsx-runtime";
|
10
|
+
const Y = /* @__PURE__ */ R(({
|
11
11
|
disableForm: g,
|
12
12
|
portalElement: c,
|
13
13
|
field: e,
|
14
|
-
index:
|
15
|
-
taxonomyOptionsFetcher: m
|
16
|
-
|
17
|
-
|
14
|
+
index: W,
|
15
|
+
taxonomyOptionsFetcher: m,
|
16
|
+
isMultilevelTaxonomyFieldEnabled: f
|
17
|
+
}, S) => {
|
18
|
+
var N;
|
18
19
|
const {
|
19
|
-
setFieldValue:
|
20
|
-
} =
|
20
|
+
setFieldValue: A
|
21
|
+
} = E(), [y, p] = V(!0), [r, h] = V(!1), l = B[e.type], {
|
21
22
|
aiSuggestion: t,
|
22
|
-
type:
|
23
|
+
type: x,
|
23
24
|
value: d
|
24
|
-
} = e,
|
25
|
+
} = e, k = l && !e.hidden, v = !P(e.updateMode), s = `metadata.fields[${W}]`, w = e.type === "taxonomy" && ((N = e.optionsRules) == null ? void 0 : N.multiSelect), i = t && y, I = C({
|
25
26
|
[n.suggestionApplied]: r,
|
26
27
|
[n.hasSuggestion]: i,
|
27
|
-
[n.dateField]:
|
28
|
-
}), o =
|
29
|
-
|
30
|
-
}, [s,
|
31
|
-
|
28
|
+
[n.dateField]: x === "date"
|
29
|
+
}), o = U((u) => {
|
30
|
+
A(`${s}.value`, u), p(!1), h(!0);
|
31
|
+
}, [s, A]);
|
32
|
+
j(() => {
|
32
33
|
!i || d || o(t);
|
33
34
|
}, [i, t, o]);
|
34
|
-
const
|
35
|
-
r &&
|
35
|
+
const F = T(() => t && d === t, [y]), M = () => {
|
36
|
+
r && h(!1), F && p(!1);
|
36
37
|
};
|
37
|
-
return
|
38
|
+
return k ? v ? /* @__PURE__ */ a(b, {
|
38
39
|
fieldNamePrefix: s,
|
39
40
|
fieldType: e.type,
|
40
41
|
isTaxonomyMultiSelect: w,
|
41
42
|
children: /* @__PURE__ */ a(l, {
|
42
|
-
ref:
|
43
|
+
ref: S,
|
43
44
|
description: e.description,
|
44
45
|
disableForm: g,
|
45
46
|
fieldNamePrefix: s,
|
46
47
|
isAiSuggestionApplied: !1,
|
48
|
+
isMultilevelTaxonomyFieldEnabled: f,
|
47
49
|
label: e.displayName,
|
48
|
-
|
50
|
+
levels: e.levels,
|
51
|
+
onValueEdited: M,
|
49
52
|
portalElement: c,
|
50
53
|
taxonomyOptionsFetcher: m
|
51
54
|
})
|
52
|
-
}, e.key) : /* @__PURE__ */
|
55
|
+
}, e.key) : /* @__PURE__ */ q("div", {
|
53
56
|
className: n.fieldWrapper,
|
54
57
|
children: [/* @__PURE__ */ a(l, {
|
55
|
-
ref:
|
56
|
-
className:
|
58
|
+
ref: S,
|
59
|
+
className: I,
|
57
60
|
description: e.description,
|
58
61
|
disableForm: g,
|
59
62
|
fieldNamePrefix: s,
|
60
63
|
isAiSuggestionApplied: r,
|
64
|
+
isMultilevelTaxonomyFieldEnabled: f,
|
61
65
|
label: e.displayName,
|
62
|
-
onValueEdited:
|
66
|
+
onValueEdited: M,
|
63
67
|
portalElement: c,
|
64
68
|
taxonomyOptionsFetcher: m
|
65
|
-
}), i && /* @__PURE__ */ a(
|
69
|
+
}), i && /* @__PURE__ */ a($, {
|
66
70
|
aiSuggestion: t,
|
67
|
-
isSameValue:
|
71
|
+
isSameValue: F,
|
68
72
|
onAiSuggestionAppend: () => {
|
69
73
|
const u = [...new Set([d, t].flat().filter(Boolean))];
|
70
74
|
o(u);
|
71
75
|
},
|
72
76
|
onAiSuggestionIgnore: () => p(!1),
|
73
77
|
onAiSuggestionReplace: () => o(t),
|
74
|
-
type:
|
78
|
+
type: x
|
75
79
|
})]
|
76
80
|
}, e.key) : null;
|
77
81
|
});
|
78
82
|
export {
|
79
|
-
|
83
|
+
Y as MetadataEditorFieldWrapper
|
80
84
|
};
|
@@ -1,121 +1,123 @@
|
|
1
|
-
import
|
2
|
-
import { Formik as
|
3
|
-
import { useState as
|
4
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
5
|
-
import { useAutofill as
|
6
|
-
import { TemplateInstance as
|
7
|
-
import { MetadataEmptyState as
|
8
|
-
import { UnsavedChangesModal as
|
9
|
-
import { AutofillOverlay as
|
10
|
-
import { CustomInstance as
|
11
|
-
import { DeleteConfirmationModal as
|
12
|
-
import { c as
|
13
|
-
import { s as
|
1
|
+
import $ from "clsx";
|
2
|
+
import { Formik as J, Form as q } from "formik";
|
3
|
+
import { useState as M, useEffect as E, useRef as z, useMemo as G } from "react";
|
4
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as H } from "../../../../constants.js";
|
5
|
+
import { useAutofill as Q } from "../../../../utils/autofill-context.js";
|
6
|
+
import { TemplateInstance as X } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
7
|
+
import { MetadataEmptyState as Y } from "../../../metadata-empty-state/metadata-empty-state.js";
|
8
|
+
import { UnsavedChangesModal as Z } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
9
|
+
import { AutofillOverlay as I } from "../autofill-overlay/autofill-overlay.js";
|
10
|
+
import { CustomInstance as T } from "../custom-instance/custom-instance.js";
|
11
|
+
import { DeleteConfirmationModal as oo } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
12
|
+
import { c as ro } from "../../../../../../chunks/utils.js";
|
13
|
+
import { s as m, M as to } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
14
14
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
15
|
-
const
|
15
|
+
const Mo = (y) => {
|
16
16
|
const {
|
17
17
|
areAiSuggestionsAvailable: S,
|
18
|
-
customRef:
|
19
|
-
isLargeFile:
|
20
|
-
errorCode:
|
18
|
+
customRef: a,
|
19
|
+
isLargeFile: D,
|
20
|
+
errorCode: n,
|
21
21
|
isAiSuggestionsFeatureEnabled: s,
|
22
|
-
isBetaLanguageEnabled:
|
23
|
-
isDeleteButtonDisabled:
|
24
|
-
|
25
|
-
|
22
|
+
isBetaLanguageEnabled: O,
|
23
|
+
isDeleteButtonDisabled: b,
|
24
|
+
isMultilevelTaxonomyFieldEnabled: l,
|
25
|
+
isUnsavedChangesModalOpen: v = !1,
|
26
|
+
MetadataInstanceFormCustomWrapper: A,
|
26
27
|
selectedTemplateInstance: o,
|
27
|
-
onCancel:
|
28
|
-
onDelete:
|
29
|
-
onDiscardUnsavedChanges:
|
30
|
-
onSubmit:
|
28
|
+
onCancel: x,
|
29
|
+
onDelete: L,
|
30
|
+
onDiscardUnsavedChanges: N,
|
31
|
+
onSubmit: P,
|
31
32
|
setIsUnsavedChangesModalOpen: f,
|
32
|
-
taxonomyOptionsFetcher:
|
33
|
-
} =
|
34
|
-
isFetchingSuggestions:
|
33
|
+
taxonomyOptionsFetcher: u
|
34
|
+
} = y, R = A ?? to, [U, d] = M(!1), {
|
35
|
+
isFetchingSuggestions: i,
|
35
36
|
isLongLoading: g,
|
36
|
-
getAiSuggestions:
|
37
|
-
clearState:
|
38
|
-
suggestions:
|
39
|
-
} =
|
40
|
-
|
41
|
-
|
42
|
-
}, [
|
43
|
-
const
|
44
|
-
await
|
45
|
-
},
|
46
|
-
r ? f(!0) :
|
47
|
-
},
|
48
|
-
|
49
|
-
},
|
37
|
+
getAiSuggestions: B,
|
38
|
+
clearState: p,
|
39
|
+
suggestions: w
|
40
|
+
} = Q();
|
41
|
+
E(() => () => {
|
42
|
+
p();
|
43
|
+
}, [p, o == null ? void 0 : o.id]);
|
44
|
+
const h = (o == null ? void 0 : o.templateKey) === H, K = async (r) => {
|
45
|
+
await P(r, ro(r, o));
|
46
|
+
}, W = (r) => {
|
47
|
+
r ? f(!0) : x();
|
48
|
+
}, j = () => {
|
49
|
+
d(!0);
|
50
|
+
}, k = {
|
50
51
|
metadata: {
|
51
52
|
...o
|
52
53
|
}
|
53
|
-
},
|
54
|
-
|
55
|
-
|
56
|
-
}, [
|
57
|
-
const
|
54
|
+
}, C = z(null), [F, V] = M(null);
|
55
|
+
E(() => {
|
56
|
+
V(a ?? C.current);
|
57
|
+
}, [a, o == null ? void 0 : o.templateKey, o == null ? void 0 : o.scope]);
|
58
|
+
const _ = G(() => {
|
58
59
|
const r = (o == null ? void 0 : o.fields.length) === 0;
|
59
|
-
if (
|
60
|
-
return /* @__PURE__ */ t(
|
61
|
-
isLoading:
|
60
|
+
if (h)
|
61
|
+
return /* @__PURE__ */ t(T, {
|
62
|
+
isLoading: i
|
62
63
|
});
|
63
64
|
if (r)
|
64
|
-
return /* @__PURE__ */ t(
|
65
|
+
return /* @__PURE__ */ t(Y, {
|
65
66
|
isBoxAiSuggestionsFeatureEnabled: s,
|
66
67
|
level: "instance"
|
67
68
|
});
|
68
|
-
const
|
69
|
+
const e = !!(i || n);
|
69
70
|
return /* @__PURE__ */ c("div", {
|
70
|
-
className:
|
71
|
-
children: [/* @__PURE__ */ t(
|
72
|
-
errorCode:
|
73
|
-
isFetchingSuggestions:
|
71
|
+
className: $(m.metadataInstanceFormContent, e && m.showOverlay),
|
72
|
+
children: [/* @__PURE__ */ t(I, {
|
73
|
+
errorCode: n,
|
74
|
+
isFetchingSuggestions: i,
|
74
75
|
isLongLoading: g
|
75
|
-
}), /* @__PURE__ */ t(
|
76
|
-
disableForm:
|
77
|
-
|
78
|
-
|
76
|
+
}), /* @__PURE__ */ t(X, {
|
77
|
+
disableForm: i,
|
78
|
+
isMultilevelTaxonomyFieldEnabled: l,
|
79
|
+
portalElement: a ?? F,
|
80
|
+
taxonomyOptionsFetcher: u
|
79
81
|
})]
|
80
82
|
});
|
81
|
-
}, [o == null ? void 0 : o.fields.length,
|
82
|
-
return /* @__PURE__ */ t(
|
83
|
-
initialValues:
|
84
|
-
onSubmit:
|
83
|
+
}, [o == null ? void 0 : o.fields.length, h, i, g, a, F, u, s, l, n]);
|
84
|
+
return /* @__PURE__ */ t(J, {
|
85
|
+
initialValues: k,
|
86
|
+
onSubmit: K,
|
85
87
|
children: ({
|
86
88
|
values: r,
|
87
|
-
dirty:
|
88
|
-
}) => /* @__PURE__ */ c(
|
89
|
-
children: [/* @__PURE__ */ t(
|
89
|
+
dirty: e
|
90
|
+
}) => /* @__PURE__ */ c(q, {
|
91
|
+
children: [/* @__PURE__ */ t(R, {
|
90
92
|
areAiSuggestionsAvailable: S,
|
91
|
-
className:
|
92
|
-
formRef:
|
93
|
+
className: m.metadataInstanceForm,
|
94
|
+
formRef: C,
|
93
95
|
formValues: r,
|
94
|
-
getAiSuggestions:
|
95
|
-
handleCancel:
|
96
|
-
handleDelete:
|
96
|
+
getAiSuggestions: B,
|
97
|
+
handleCancel: W,
|
98
|
+
handleDelete: j,
|
97
99
|
isAiSuggestionsFeatureEnabled: s,
|
98
|
-
isBetaLanguageEnabled:
|
99
|
-
isDeleteButtonDisabled:
|
100
|
-
isFetchingSuggestions:
|
101
|
-
isFormDirty:
|
102
|
-
isLargeFile:
|
100
|
+
isBetaLanguageEnabled: O,
|
101
|
+
isDeleteButtonDisabled: b,
|
102
|
+
isFetchingSuggestions: i,
|
103
|
+
isFormDirty: e,
|
104
|
+
isLargeFile: D,
|
103
105
|
selectedTemplateInstance: o,
|
104
|
-
suggestions:
|
105
|
-
children: o &&
|
106
|
-
}), /* @__PURE__ */ t(
|
106
|
+
suggestions: w,
|
107
|
+
children: o && _
|
108
|
+
}), /* @__PURE__ */ t(Z, {
|
107
109
|
onBackToEdit: () => f(!1),
|
108
|
-
onDiscardChanges:
|
109
|
-
open:
|
110
|
-
}), /* @__PURE__ */ t(
|
111
|
-
onConfirm: () =>
|
112
|
-
onDismiss: () =>
|
113
|
-
open:
|
110
|
+
onDiscardChanges: N,
|
111
|
+
open: v
|
112
|
+
}), /* @__PURE__ */ t(oo, {
|
113
|
+
onConfirm: () => L(o),
|
114
|
+
onDismiss: () => d(!1),
|
115
|
+
open: U,
|
114
116
|
templateName: o == null ? void 0 : o.displayName
|
115
117
|
})]
|
116
118
|
})
|
117
119
|
}, `${o == null ? void 0 : o.scope}.${o == null ? void 0 : o.templateKey}`);
|
118
120
|
};
|
119
121
|
export {
|
120
|
-
|
122
|
+
Mo as MetadataInstanceForm
|
121
123
|
};
|
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.94.1",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.15",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
7
7
|
"@box/blueprint-web-assets": "^4.21.0",
|
8
|
+
"@box/combobox-with-api": "^0.26.0",
|
8
9
|
"formik": "^2.0.3",
|
9
10
|
"lodash": "^4.17.15",
|
10
11
|
"react": "^17.0.0 || ^18.0.0",
|
@@ -14,7 +15,7 @@
|
|
14
15
|
"devDependencies": {
|
15
16
|
"@ariakit/react": "0.4.15",
|
16
17
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
17
|
-
"@box/blueprint-web": "^9.18.
|
18
|
+
"@box/blueprint-web": "^9.18.8",
|
18
19
|
"@box/blueprint-web-assets": "^4.35.0",
|
19
20
|
"@box/storybook-utils": "^0.8.3",
|
20
21
|
"@testing-library/react": "^15.0.6",
|
@@ -53,5 +54,5 @@
|
|
53
54
|
"**/*.css"
|
54
55
|
],
|
55
56
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
57
|
+
"gitHead": "6e3fffa688deb1364211bbbc68fbb9098060d97f"
|
57
58
|
}
|
package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { TreeOptionType, TreeQueryInput } from '@box/combobox-with-api';
|
2
|
+
import { FetcherResponse, PaginationQueryInput } from '../../../combobox-with-api-pagination/types';
|
2
3
|
import { MetadataFieldProps } from '../../types';
|
3
4
|
export type MetadataTaxonomyFieldProps = Omit<MetadataFieldProps, 'portalElement'> & {
|
4
5
|
portalElement?: HTMLElement | (() => HTMLElement);
|
5
6
|
};
|
6
|
-
export type TaxonomyOptionsFetcher = (scope: string, templateKey: string, fieldKey: string, level: number, options: PaginationQueryInput) => Promise<FetcherResponse<
|
7
|
+
export type TaxonomyOptionsFetcher = (scope: string, templateKey: string, fieldKey: string, level: number, options: PaginationQueryInput | TreeQueryInput) => Promise<FetcherResponse<TreeOptionType>>;
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import { Level } from '@box/combobox-with-api';
|
1
2
|
import { MetadataTemplateField, MetadataTemplateFieldOption } from '../../types';
|
2
3
|
import { TaxonomyOptionsFetcher } from './components/metadata-taxonomy-field/types';
|
3
4
|
export type TemplateInstanceProps = {
|
4
5
|
disableForm: boolean;
|
5
6
|
portalElement?: HTMLElement;
|
6
7
|
taxonomyOptionsFetcher: TaxonomyOptionsFetcher;
|
8
|
+
isMultilevelTaxonomyFieldEnabled: boolean;
|
7
9
|
};
|
8
10
|
export type MetadataFieldProps = {
|
9
11
|
description?: string | null;
|
@@ -16,7 +18,9 @@ export type MetadataFieldProps = {
|
|
16
18
|
options?: Array<MetadataTemplateFieldOption>;
|
17
19
|
taxonomyOptionsFetcher: TaxonomyOptionsFetcher;
|
18
20
|
className?: string;
|
21
|
+
levels?: Level[];
|
19
22
|
onValueEdited: () => void;
|
23
|
+
isMultilevelTaxonomyFieldEnabled: boolean;
|
20
24
|
};
|
21
25
|
export type MetadataEditorFieldWrapperProps = TemplateInstanceProps & {
|
22
26
|
field: MetadataTemplateField;
|
@@ -10,6 +10,8 @@ export type MetadataInstanceFormProps = {
|
|
10
10
|
isBetaLanguageEnabled: boolean;
|
11
11
|
isDeleteButtonDisabled: boolean;
|
12
12
|
isLargeFile: boolean;
|
13
|
+
/** When true enables the multilevel taxonomy filed component with tree selection */
|
14
|
+
isMultilevelTaxonomyFieldEnabled: boolean;
|
13
15
|
isUnsavedChangesModalOpen: boolean;
|
14
16
|
selectedTemplateInstance: MetadataTemplateInstance | null;
|
15
17
|
onCancel: () => void;
|
@@ -1,4 +1,9 @@
|
|
1
1
|
import { AutofillSuggestions, MetadataTemplate, MetadataTemplateField, MetadataTemplateInstance, MetadataTemplateOption } from '../types';
|
2
|
+
declare const taxonomyLevels: {
|
3
|
+
displayName: string;
|
4
|
+
description: string;
|
5
|
+
level: number;
|
6
|
+
}[];
|
2
7
|
declare const stringField: MetadataTemplateField;
|
3
8
|
declare const dateField: MetadataTemplateField;
|
4
9
|
declare const enumField: MetadataTemplateField;
|
@@ -6,6 +11,8 @@ declare const floatField: MetadataTemplateField;
|
|
6
11
|
declare const multiSelectField: MetadataTemplateField;
|
7
12
|
declare const taxonomySingleSelectSingleLevelField: MetadataTemplateField;
|
8
13
|
declare const taxonomyMultiSelectSingleLevelField: MetadataTemplateField;
|
14
|
+
declare const taxonomySingleSelectMultiLevelField: MetadataTemplateField;
|
15
|
+
declare const taxonomyMultiSelectMultiLevelField: MetadataTemplateField;
|
9
16
|
declare const taxonomySingleSelectSingleLevelFieldWithValue: MetadataTemplateField;
|
10
17
|
declare const taxonomyMultiSelectSingleLevelFieldWithValue: MetadataTemplateField;
|
11
18
|
declare const hiddenField: MetadataTemplateField;
|
@@ -43,4 +50,4 @@ declare const firstTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[
|
|
43
50
|
declare const secondTemplateInstance: MetadataTemplate;
|
44
51
|
declare const secondTemplateSuggestions: AutofillSuggestions;
|
45
52
|
declare const secondTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[];
|
46
|
-
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, dateSuggestionTemplateInstance, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, hiddenTemplate, hiddenTemplateInstance, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, onlyRequiredPropsTemplateInstance, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|
53
|
+
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, dateSuggestionTemplateInstance, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, hiddenTemplate, hiddenTemplateInstance, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, onlyRequiredPropsTemplateInstance, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyLevels, taxonomyMultiSelectMultiLevelField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectMultiLevelField, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|
package/types/lib/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Level } from '@box/combobox-with-api';
|
1
2
|
import { BaseOptionType } from './components/combobox-with-api-pagination/types';
|
2
3
|
export type { FormValues } from './components/metadata-instance-editor/types';
|
3
4
|
export type MetadataEmptyStateProps = {
|
@@ -41,6 +42,7 @@ export type MetadataTemplateField = {
|
|
41
42
|
namespace?: string;
|
42
43
|
taxonomyKey?: string;
|
43
44
|
taxonomyId?: string;
|
45
|
+
levels?: Level[];
|
44
46
|
type: MetadataTemplateFieldType;
|
45
47
|
updateMode?: MetadataUpdateMode;
|
46
48
|
value?: MetadataFormFieldValue;
|