@box/metadata-editor 0.50.7 → 0.50.8
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.
@@ -1,7 +1,7 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form.css";
|
2
2
|
import { Card as b } from "@box/blueprint-web";
|
3
|
-
import { Formik as
|
4
|
-
import { useState as
|
3
|
+
import { Formik as y } from "formik";
|
4
|
+
import { useState as O, useMemo as A } from "react";
|
5
5
|
import { TEMPLATE_CUSTOM_PROPERTIES as N } from "../../../../constants.js";
|
6
6
|
import { useAutofill as T } from "../../../../utils/autofill-context.js";
|
7
7
|
import { TemplateInstance as v } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
@@ -13,8 +13,8 @@ import { MetadataInstanceFormFooter as P } from "../metadata-instance-form-foote
|
|
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
15
|
import { jsx as a, jsxs as l, Fragment as k } from "react/jsx-runtime";
|
16
|
-
const
|
17
|
-
metadataInstanceForm:
|
16
|
+
const w = "_metadataInstanceForm_1hu4u_1", B = {
|
17
|
+
metadataInstanceForm: w
|
18
18
|
}, ae = (d) => {
|
19
19
|
const {
|
20
20
|
isAiSuggestionsFeatureEnabled: o,
|
@@ -26,10 +26,10 @@ 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] = O(!1), {
|
30
30
|
isFetchingSuggestions: F
|
31
|
-
} = T(), n = c || F, i = e.templateKey === N, r = (t) => {
|
32
|
-
g(t, R(t, e)), s(!1);
|
31
|
+
} = T(), n = c || F, i = e.templateKey === N, r = async (t) => {
|
32
|
+
await g(t, R(t, e)), s(!1);
|
33
33
|
}, M = (t) => {
|
34
34
|
t ? s(!0) : f();
|
35
35
|
}, I = () => {
|
@@ -49,7 +49,7 @@ const B = "_metadataInstanceForm_1hu4u_1", H = {
|
|
49
49
|
disableForm: n
|
50
50
|
});
|
51
51
|
}, [i, e.fields.length, n, o]);
|
52
|
-
return /* @__PURE__ */ a(
|
52
|
+
return /* @__PURE__ */ a(y, {
|
53
53
|
initialValues: S,
|
54
54
|
onSubmit: r,
|
55
55
|
children: ({
|
@@ -57,7 +57,7 @@ const B = "_metadataInstanceForm_1hu4u_1", H = {
|
|
57
57
|
dirty: E
|
58
58
|
}) => /* @__PURE__ */ l(k, {
|
59
59
|
children: [/* @__PURE__ */ l(b, {
|
60
|
-
className:
|
60
|
+
className: B.metadataInstanceForm,
|
61
61
|
children: [/* @__PURE__ */ a(j, {
|
62
62
|
isAiSuggestionsFeatureEnabled: o && !i,
|
63
63
|
isLoading: n,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.50.
|
3
|
+
"version": "0.50.8",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.20.0",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"**/*.css"
|
53
53
|
],
|
54
54
|
"license": "SEE LICENSE IN LICENSE",
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "93743d21d2e1213f9596085f664989972a58dbca"
|
56
56
|
}
|
@@ -4,10 +4,11 @@ export type MetadataInstanceFormProps = {
|
|
4
4
|
isAiSuggestionsFeatureEnabled: boolean;
|
5
5
|
isLoading: boolean;
|
6
6
|
isUnsavedChangesModalOpen: boolean;
|
7
|
+
/** The MetadataTemplate is used when creating a new instance, while MetadataTemplateInstance is applied when editing an existing one. */
|
7
8
|
selectedTemplateInstance: MetadataTemplateInstance;
|
8
9
|
onCancel: () => void;
|
9
10
|
onDelete: (templateInstance: MetadataTemplateInstance) => void;
|
10
|
-
onSubmit: (values: FormValues, operations: JSONPatchOperations) => void
|
11
|
+
onSubmit: (values: FormValues, operations: JSONPatchOperations) => Promise<void>;
|
11
12
|
setIsUnsavedChangesModalOpen: (isUnsavedChangesModalOpen: boolean) => void;
|
12
13
|
/** Callback invoked when clicking Cancel button on the UnsavedChangesModal - can be used to reset form values */
|
13
14
|
onUnsavedChangesModalCancel?: () => void;
|