@box/metadata-editor 0.98.8 → 0.98.9
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/dist/esm/index.js +48 -48
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +1 -1
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +8 -8
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +29 -26
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +10 -9
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import {
|
20
|
-
import {
|
21
|
-
import {
|
1
|
+
import { FilterDropdownMenu as e } from "./lib/components/filter-dropdown-menu/index.js";
|
2
|
+
import { MULTI_VALUE_DEFAULT_OPTION as r, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as p, MULTI_VALUE_DEFAULT_VALUE as n } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
|
3
|
+
import { MetadataEmptyState as f } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
4
|
+
import { defaultInitialValues as x, defaultMetadataValueMap as i } from "./lib/defaults.js";
|
5
|
+
import { MetadataEditor as M } from "./lib/metadata-editor.js";
|
6
|
+
import { U as A } from "../chunks/types.js";
|
7
|
+
import { withApiWrapper as U } from "./lib/utils/api-wrapper.js";
|
8
|
+
import { AutofillContext as T, AutofillContextProvider as _, TIMEOUT_10_SECONDS as E, useAutofill as L } from "./lib/utils/autofill-context.js";
|
9
|
+
import { AddMetadataTemplateDropdown as c } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
|
10
|
+
import { ComboboxWithApiPagination as D } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
|
11
|
+
import { FilterInstancesDropdown as N } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
|
12
|
+
import { CustomInstanceNewField as w } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
|
13
|
+
import { DeleteConfirmationModal as h } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
|
14
|
+
import { MetadataInstanceFormAutofillButton as b } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
|
15
|
+
import { MetadataInstanceFormHeader as v } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
|
16
|
+
import { MetadataInstanceForm as J } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
|
17
|
+
import { J as y } from "../chunks/utils.js";
|
18
|
+
import { MetadataInstanceList as X } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
|
19
|
+
import { MetadataInstanceHeader as j } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
|
20
|
+
import { MetadataInstance as q } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js";
|
21
|
+
import { UnsavedChangesModal as G } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
22
22
|
export {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
23
|
+
c as AddMetadataTemplateDropdown,
|
24
|
+
T as AutofillContext,
|
25
|
+
_ as AutofillContextProvider,
|
26
|
+
D as ComboboxWithApiPagination,
|
27
|
+
w as CustomInstanceNewField,
|
28
|
+
h as DeleteConfirmationModal,
|
29
|
+
e as FilterDropdownMenu,
|
30
|
+
N as FilterInstancesDropdown,
|
31
|
+
y as JSONPatchOp,
|
32
|
+
r as MULTI_VALUE_DEFAULT_OPTION,
|
33
|
+
p as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
|
34
|
+
n as MULTI_VALUE_DEFAULT_VALUE,
|
35
|
+
M as MetadataEditor,
|
36
|
+
f as MetadataEmptyState,
|
37
|
+
q as MetadataInstance,
|
38
|
+
J as MetadataInstanceForm,
|
39
|
+
b as MetadataInstanceFormAutofillButton,
|
40
|
+
v as MetadataInstanceFormHeader,
|
41
|
+
j as MetadataInstanceHeader,
|
42
|
+
X as MetadataInstanceList,
|
43
|
+
E as TIMEOUT_10_SECONDS,
|
44
|
+
G as UnsavedChangesModal,
|
45
|
+
A as UpdateMode,
|
46
|
+
x as defaultInitialValues,
|
47
|
+
i as defaultMetadataValueMap,
|
48
|
+
L as useAutofill,
|
49
|
+
U as withApiWrapper
|
50
50
|
};
|
@@ -3,9 +3,9 @@ import { useFormikContext as W, getIn as $, Field as j } from "formik";
|
|
3
3
|
import { forwardRef as D, useCallback as R } from "react";
|
4
4
|
import { useIntl as q } from "react-intl";
|
5
5
|
import z from "../../../../messages.js";
|
6
|
-
import { ComboboxWithApiPagination as A } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
|
7
6
|
import { g as b } from "../../../../../../chunks/utils2.js";
|
8
7
|
import { jsx as e } from "react/jsx-runtime";
|
8
|
+
import { ComboboxWithApiPagination as A } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
|
9
9
|
const X = /* @__PURE__ */ D(({
|
10
10
|
description: i,
|
11
11
|
disableForm: l,
|
@@ -2,11 +2,11 @@ import w from "clsx";
|
|
2
2
|
import { useFormikContext as C } from "formik";
|
3
3
|
import T from "lodash/isUndefined";
|
4
4
|
import { forwardRef as U, useState as $, useCallback as j, useEffect as x, useMemo as D } from "react";
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import { editorFieldTypes as b } from "./editor-field-types.js";
|
5
|
+
import { UpdateModeFieldWrapper as L } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
6
|
+
import { editorFieldTypes as R } from "./editor-field-types.js";
|
8
7
|
import { s as p } from "../../../../chunks/utils2.js";
|
9
|
-
import { jsx as r, jsxs as
|
8
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
9
|
+
import { AiSuggestionField as B } from "./components/ai-suggestion-field/ai-suggestion-field.js";
|
10
10
|
var t = /* @__PURE__ */ function(o) {
|
11
11
|
return o.Pending = "PENDING", o.Applied = "APPLIED", o.Initial = "INITIAL", o;
|
12
12
|
}(t || {});
|
@@ -21,7 +21,7 @@ const Z = /* @__PURE__ */ U(({
|
|
21
21
|
var v;
|
22
22
|
const {
|
23
23
|
setFieldValue: l
|
24
|
-
} = C(), [d, u] = $(t.Initial), n = d === t.Pending, N = d === t.Applied, P = d === t.Initial, g =
|
24
|
+
} = C(), [d, u] = $(t.Initial), n = d === t.Pending, N = d === t.Applied, P = d === t.Initial, g = R[e.type], {
|
25
25
|
aiSuggestion: i,
|
26
26
|
type: h,
|
27
27
|
value: c
|
@@ -40,7 +40,7 @@ const Z = /* @__PURE__ */ U(({
|
|
40
40
|
P && i && u(t.Pending);
|
41
41
|
}, [P, i]);
|
42
42
|
const k = D(() => i && c === i, [n]);
|
43
|
-
return M ? E ? /* @__PURE__ */ r(
|
43
|
+
return M ? E ? /* @__PURE__ */ r(L, {
|
44
44
|
fieldNamePrefix: s,
|
45
45
|
fieldType: e.type,
|
46
46
|
isTaxonomyMultiSelect: V,
|
@@ -57,7 +57,7 @@ const Z = /* @__PURE__ */ U(({
|
|
57
57
|
portalElement: S,
|
58
58
|
taxonomyOptionsFetcher: f
|
59
59
|
})
|
60
|
-
}, e.key) : /* @__PURE__ */
|
60
|
+
}, e.key) : /* @__PURE__ */ b("div", {
|
61
61
|
className: p.fieldWrapper,
|
62
62
|
children: [/* @__PURE__ */ r(g, {
|
63
63
|
ref: I,
|
@@ -71,7 +71,7 @@ const Z = /* @__PURE__ */ U(({
|
|
71
71
|
onValueEdited: m,
|
72
72
|
portalElement: S,
|
73
73
|
taxonomyOptionsFetcher: f
|
74
|
-
}), n && /* @__PURE__ */ r(
|
74
|
+
}), n && /* @__PURE__ */ r(B, {
|
75
75
|
aiSuggestion: i,
|
76
76
|
isSameValue: k,
|
77
77
|
onAiSuggestionAppend: () => {
|
@@ -1,18 +1,21 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
1
|
+
import "../custom-instance-new-field/custom-instance-new-field.js";
|
2
|
+
import { DeleteConfirmationModal as $ } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
3
|
+
import "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
|
4
|
+
import "../metadata-instance-form-header/metadata-instance-form-header.js";
|
5
|
+
import J from "clsx";
|
6
|
+
import { Formik as q, Form as z } from "formik";
|
7
|
+
import { useState as M, useEffect as E, useRef as G, useMemo as H } from "react";
|
8
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as Q } from "../../../../constants.js";
|
9
|
+
import { useAutofill as X } from "../../../../utils/autofill-context.js";
|
10
|
+
import { TemplateInstance as Y } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
11
|
+
import { MetadataEmptyState as Z } from "../../../metadata-empty-state/metadata-empty-state.js";
|
9
12
|
import { AutofillOverlay as I } from "../autofill-overlay/autofill-overlay.js";
|
10
13
|
import { CustomInstance as T } from "../custom-instance/custom-instance.js";
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import { s as m, M as to } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
14
|
+
import { c as oo } from "../../../../../../chunks/utils.js";
|
15
|
+
import { s as m, M as ro } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
14
16
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
15
|
-
|
17
|
+
import { UnsavedChangesModal as to } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
18
|
+
const yo = (y) => {
|
16
19
|
const {
|
17
20
|
areAiSuggestionsAvailable: S,
|
18
21
|
customRef: a,
|
@@ -31,18 +34,18 @@ const Mo = (y) => {
|
|
31
34
|
onSubmit: P,
|
32
35
|
setIsUnsavedChangesModalOpen: f,
|
33
36
|
taxonomyOptionsFetcher: u
|
34
|
-
} = y, R = A ??
|
37
|
+
} = y, R = A ?? ro, [U, d] = M(!1), {
|
35
38
|
isFetchingSuggestions: i,
|
36
39
|
isLongLoading: g,
|
37
40
|
getAiSuggestions: B,
|
38
41
|
clearState: p,
|
39
42
|
suggestions: w
|
40
|
-
} =
|
43
|
+
} = X();
|
41
44
|
E(() => () => {
|
42
45
|
p();
|
43
46
|
}, [p, o == null ? void 0 : o.id]);
|
44
|
-
const h = (o == null ? void 0 : o.templateKey) ===
|
45
|
-
await P(r,
|
47
|
+
const h = (o == null ? void 0 : o.templateKey) === Q, K = async (r) => {
|
48
|
+
await P(r, oo(r, o));
|
46
49
|
}, W = (r) => {
|
47
50
|
r ? f(!0) : x();
|
48
51
|
}, j = () => {
|
@@ -51,29 +54,29 @@ const Mo = (y) => {
|
|
51
54
|
metadata: {
|
52
55
|
...o
|
53
56
|
}
|
54
|
-
}, C =
|
57
|
+
}, C = G(null), [F, V] = M(null);
|
55
58
|
E(() => {
|
56
59
|
V(a ?? C.current);
|
57
60
|
}, [a, o == null ? void 0 : o.templateKey, o == null ? void 0 : o.scope]);
|
58
|
-
const _ =
|
61
|
+
const _ = H(() => {
|
59
62
|
const r = (o == null ? void 0 : o.fields.length) === 0;
|
60
63
|
if (h)
|
61
64
|
return /* @__PURE__ */ t(T, {
|
62
65
|
isLoading: i
|
63
66
|
});
|
64
67
|
if (r)
|
65
|
-
return /* @__PURE__ */ t(
|
68
|
+
return /* @__PURE__ */ t(Z, {
|
66
69
|
isBoxAiSuggestionsFeatureEnabled: s,
|
67
70
|
level: "instance"
|
68
71
|
});
|
69
72
|
const e = !!(i || n);
|
70
73
|
return /* @__PURE__ */ c("div", {
|
71
|
-
className:
|
74
|
+
className: J(m.metadataInstanceFormContent, e && m.showOverlay),
|
72
75
|
children: [/* @__PURE__ */ t(I, {
|
73
76
|
errorCode: n,
|
74
77
|
isFetchingSuggestions: i,
|
75
78
|
isLongLoading: g
|
76
|
-
}), /* @__PURE__ */ t(
|
79
|
+
}), /* @__PURE__ */ t(Y, {
|
77
80
|
disableForm: i,
|
78
81
|
isMultilevelTaxonomyFieldEnabled: l,
|
79
82
|
portalElement: a ?? F,
|
@@ -81,13 +84,13 @@ const Mo = (y) => {
|
|
81
84
|
})]
|
82
85
|
});
|
83
86
|
}, [o == null ? void 0 : o.fields.length, h, i, g, a, F, u, s, l, n]);
|
84
|
-
return /* @__PURE__ */ t(
|
87
|
+
return /* @__PURE__ */ t(q, {
|
85
88
|
initialValues: k,
|
86
89
|
onSubmit: K,
|
87
90
|
children: ({
|
88
91
|
values: r,
|
89
92
|
dirty: e
|
90
|
-
}) => /* @__PURE__ */ c(
|
93
|
+
}) => /* @__PURE__ */ c(z, {
|
91
94
|
children: [/* @__PURE__ */ t(R, {
|
92
95
|
areAiSuggestionsAvailable: S,
|
93
96
|
className: m.metadataInstanceForm,
|
@@ -105,11 +108,11 @@ const Mo = (y) => {
|
|
105
108
|
selectedTemplateInstance: o,
|
106
109
|
suggestions: w,
|
107
110
|
children: o && _
|
108
|
-
}), /* @__PURE__ */ t(
|
111
|
+
}), /* @__PURE__ */ t(to, {
|
109
112
|
onBackToEdit: () => f(!1),
|
110
113
|
onDiscardChanges: N,
|
111
114
|
open: v
|
112
|
-
}), /* @__PURE__ */ t(
|
115
|
+
}), /* @__PURE__ */ t($, {
|
113
116
|
onConfirm: () => L(o),
|
114
117
|
onDismiss: () => d(!1),
|
115
118
|
open: U,
|
@@ -119,5 +122,5 @@ const Mo = (y) => {
|
|
119
122
|
}, `${o == null ? void 0 : o.scope}.${o == null ? void 0 : o.templateKey}`);
|
120
123
|
};
|
121
124
|
export {
|
122
|
-
|
125
|
+
yo as MetadataInstanceForm
|
123
126
|
};
|
@@ -1,26 +1,27 @@
|
|
1
|
-
import { MetadataInstance as
|
2
|
-
import { getVisibleTemplates as
|
1
|
+
import { MetadataInstance as r } from "./subcomponents/metadata-instance/metadata-instance.js";
|
2
|
+
import { getVisibleTemplates as c } from "../../utils/utils.js";
|
3
3
|
import { jsx as a } from "react/jsx-runtime";
|
4
|
-
import
|
5
|
-
|
6
|
-
|
4
|
+
import "./subcomponents/metadata-instance-header/metadata-instance-header.js";
|
5
|
+
import '../../../../styles/metadata-instance-list.css';const d = "_metadataInstanceList_bd83w_1", p = {
|
6
|
+
metadataInstanceList: d
|
7
|
+
}, _ = ({
|
7
8
|
areAiSuggestionsAvailable: s,
|
8
9
|
isAiSuggestionsFeatureEnabled: e,
|
9
10
|
isBetaLanguageEnabled: n,
|
10
11
|
onEdit: i,
|
11
12
|
templateInstances: m,
|
12
|
-
taxonomyNodeFetcher:
|
13
|
+
taxonomyNodeFetcher: o
|
13
14
|
}) => /* @__PURE__ */ a("div", {
|
14
15
|
className: p.metadataInstanceList,
|
15
|
-
children:
|
16
|
+
children: c(m).map((t) => /* @__PURE__ */ a(r, {
|
16
17
|
areAiSuggestionsAvailable: s,
|
17
18
|
isAiSuggestionsFeatureEnabled: e,
|
18
19
|
isBetaLanguageEnabled: n,
|
19
20
|
onEdit: i,
|
20
|
-
taxonomyNodeFetcher:
|
21
|
+
taxonomyNodeFetcher: o,
|
21
22
|
templateInstance: t
|
22
23
|
}, t.id))
|
23
24
|
});
|
24
25
|
export {
|
25
|
-
|
26
|
+
_ as MetadataInstanceList
|
26
27
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.98.
|
3
|
+
"version": "0.98.9",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.15",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"devDependencies": {
|
16
16
|
"@ariakit/react": "0.4.15",
|
17
17
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
18
|
-
"@box/blueprint-web": "^10.
|
18
|
+
"@box/blueprint-web": "^10.5.0",
|
19
19
|
"@box/blueprint-web-assets": "^4.39.0",
|
20
20
|
"@box/storybook-utils": "^0.9.0",
|
21
21
|
"@testing-library/react": "^15.0.6",
|