@box/metadata-editor 0.50.0 → 0.50.2
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-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +22 -22
- package/package.json +4 -4
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +4 -4
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.d.ts +2 -2
- package/types/lib/components/metadata-instance-list/types.d.ts +1 -1
@@ -1,10 +1,10 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form.css";
|
2
2
|
import { Card as b } from "@box/blueprint-web";
|
3
3
|
import { Formik as O } from "formik";
|
4
|
-
import { useState as
|
5
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
6
|
-
import { useAutofill as
|
7
|
-
import { TemplateInstance as
|
4
|
+
import { useState as y, useMemo as A } from "react";
|
5
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as N } from "../../../../constants.js";
|
6
|
+
import { useAutofill as T } from "../../../../utils/autofill-context.js";
|
7
|
+
import { TemplateInstance as v } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
8
8
|
import { MetadataEmptyState as L } from "../../../metadata-empty-state/metadata-empty-state.js";
|
9
9
|
import { UnsavedChangesModal as U } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
10
10
|
import { CustomInstance as _ } from "../custom-instance/custom-instance.js";
|
@@ -12,7 +12,7 @@ import { DeleteConfirmationModal as x } from "../delete-confirmation-modal/delet
|
|
12
12
|
import { MetadataInstanceFormFooter as P } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
|
13
13
|
import { MetadataInstanceFormHeader as j } from "../metadata-instance-form-header/metadata-instance-form-header.js";
|
14
14
|
import { createJSONPatch as R } from "./utils.js";
|
15
|
-
import { jsx as
|
15
|
+
import { jsx as a, jsxs as l, Fragment as k } from "react/jsx-runtime";
|
16
16
|
const B = "_metadataInstanceForm_1hu4u_1", H = {
|
17
17
|
metadataInstanceForm: B
|
18
18
|
}, ae = (d) => {
|
@@ -26,53 +26,53 @@ const B = "_metadataInstanceForm_1hu4u_1", H = {
|
|
26
26
|
selectedTemplateInstance: e,
|
27
27
|
setIsUnsavedChangesModalOpen: s,
|
28
28
|
onUnsavedChangesModalCancel: C
|
29
|
-
} = d, [h, m] =
|
29
|
+
} = d, [h, m] = y(!1), {
|
30
30
|
isFetchingSuggestions: F
|
31
|
-
} =
|
32
|
-
g(
|
33
|
-
}, M = (
|
34
|
-
|
31
|
+
} = T(), n = c || F, i = e.templateKey === N, r = (t) => {
|
32
|
+
g(t, R(t, e)), s(!1);
|
33
|
+
}, M = (t) => {
|
34
|
+
t ? s(!0) : f();
|
35
35
|
}, I = () => {
|
36
36
|
m(!0);
|
37
37
|
}, S = {
|
38
38
|
metadata: {
|
39
39
|
...e
|
40
40
|
}
|
41
|
-
}, D =
|
42
|
-
const
|
43
|
-
return i ? /* @__PURE__ */
|
41
|
+
}, D = A(() => {
|
42
|
+
const t = e.fields.length === 0;
|
43
|
+
return i ? /* @__PURE__ */ a(_, {
|
44
44
|
isLoading: n
|
45
|
-
}) :
|
45
|
+
}) : t ? /* @__PURE__ */ a(L, {
|
46
46
|
isBoxAiSuggestionsFeatureEnabled: o,
|
47
47
|
level: "instance"
|
48
|
-
}) : /* @__PURE__ */
|
48
|
+
}) : /* @__PURE__ */ a(v, {
|
49
49
|
disableForm: n
|
50
50
|
});
|
51
51
|
}, [i, e.fields.length, n, o]);
|
52
|
-
return /* @__PURE__ */
|
52
|
+
return /* @__PURE__ */ a(O, {
|
53
53
|
initialValues: S,
|
54
54
|
onSubmit: r,
|
55
55
|
children: ({
|
56
|
-
values:
|
56
|
+
values: t,
|
57
57
|
dirty: E
|
58
58
|
}) => /* @__PURE__ */ l(k, {
|
59
59
|
children: [/* @__PURE__ */ l(b, {
|
60
60
|
className: H.metadataInstanceForm,
|
61
|
-
children: [/* @__PURE__ */
|
61
|
+
children: [/* @__PURE__ */ a(j, {
|
62
62
|
isAiSuggestionsFeatureEnabled: o && !i,
|
63
63
|
isLoading: n,
|
64
64
|
templateName: e.displayName
|
65
|
-
}), D, /* @__PURE__ */
|
65
|
+
}), D, /* @__PURE__ */ a(P, {
|
66
66
|
isLoading: n,
|
67
67
|
onCancel: () => M(E),
|
68
68
|
onDelete: I
|
69
69
|
})]
|
70
|
-
}), /* @__PURE__ */
|
70
|
+
}), /* @__PURE__ */ a(U, {
|
71
71
|
onCancel: C,
|
72
72
|
onDismiss: () => s(!1),
|
73
|
-
onSaveAndContinue: () => r(
|
73
|
+
onSaveAndContinue: () => r(t),
|
74
74
|
open: p
|
75
|
-
}), /* @__PURE__ */
|
75
|
+
}), /* @__PURE__ */ a(x, {
|
76
76
|
onConfirm: () => u(e.id),
|
77
77
|
onDismiss: () => m(!1),
|
78
78
|
open: h,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.50.
|
3
|
+
"version": "0.50.2",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.20.0",
|
@@ -13,8 +13,8 @@
|
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
15
|
"@ariakit/react": "0.4.5",
|
16
|
-
"@box/blueprint-web": "^7.
|
17
|
-
"@box/blueprint-web-assets": "^4.
|
16
|
+
"@box/blueprint-web": "^7.25.0",
|
17
|
+
"@box/blueprint-web-assets": "^4.22.0",
|
18
18
|
"@box/storybook-utils": "^0.6.1",
|
19
19
|
"@testing-library/react": "^15.0.6",
|
20
20
|
"react": "^18.3.0",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"**/*.css"
|
53
53
|
],
|
54
54
|
"license": "SEE LICENSE IN LICENSE",
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "d11ef94c0b6fdc3b2cd69ce5ba09cbf931799c74"
|
56
56
|
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { type
|
1
|
+
import { type MetadataTemplateInstance } from '../../../../types';
|
2
|
+
import { type FormValues } from '../../types';
|
2
3
|
export type MetadataInstanceFormProps = {
|
3
4
|
isAiSuggestionsFeatureEnabled: boolean;
|
4
5
|
isLoading: boolean;
|
5
6
|
isUnsavedChangesModalOpen: boolean;
|
6
|
-
|
7
|
-
selectedTemplateInstance: MetadataTemplateInstance | MetadataTemplate;
|
7
|
+
selectedTemplateInstance: MetadataTemplateInstance;
|
8
8
|
onCancel: () => void;
|
9
9
|
onDelete: (id: string) => void;
|
10
|
-
onSubmit: (
|
10
|
+
onSubmit: (values: FormValues, operations: JSONPatchOperations) => void;
|
11
11
|
setIsUnsavedChangesModalOpen: (isUnsavedChangesModalOpen: boolean) => void;
|
12
12
|
/** Callback invoked when clicking Cancel button on the UnsavedChangesModal - can be used to reset form values */
|
13
13
|
onUnsavedChangesModalCancel?: () => void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type MetadataTemplateInstance } from '../../../../types';
|
2
2
|
import { type FormValues } from '../../types';
|
3
3
|
import { type JSONPatchOperations } from './types';
|
4
4
|
/**
|
@@ -9,4 +9,4 @@ import { type JSONPatchOperations } from './types';
|
|
9
9
|
* @param formValues
|
10
10
|
* @param originalData
|
11
11
|
*/
|
12
|
-
export declare const createJSONPatch: (formValues: FormValues, originalData: MetadataTemplateInstance
|
12
|
+
export declare const createJSONPatch: (formValues: FormValues, originalData: MetadataTemplateInstance) => JSONPatchOperations;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type MetadataTemplateInstance } from '../../types';
|
2
2
|
export type MetadataInstanceListProps = {
|
3
3
|
isAiSuggestionsFeatureEnabled: boolean;
|
4
|
-
onEdit: () => void;
|
4
|
+
onEdit: (templateInstacne: MetadataTemplateInstance) => void;
|
5
5
|
onEditWithAutofill: () => void;
|
6
6
|
templateInstances: MetadataTemplateInstance[];
|
7
7
|
};
|