@box/metadata-editor 0.59.2 → 0.59.3
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.
@@ -2,24 +2,24 @@ import "../../../../../../styles/metadata-instance-form.css";
|
|
2
2
|
import { Card as v } from "@box/blueprint-web";
|
3
3
|
import { Formik as N, Form as P } from "formik";
|
4
4
|
import { useState as c, useRef as U, useEffect as _, useMemo as x } from "react";
|
5
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
6
|
-
import { useAutofill as
|
7
|
-
import { TemplateInstance as
|
8
|
-
import { MetadataEmptyState as
|
9
|
-
import { UnsavedChangesModal as
|
10
|
-
import { CustomInstance as
|
11
|
-
import { DeleteConfirmationModal as
|
12
|
-
import { MetadataInstanceFormFooter as
|
13
|
-
import { MetadataInstanceFormHeader as
|
14
|
-
import { createJSONPatch as
|
5
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as K } from "../../../../constants.js";
|
6
|
+
import { useAutofill as L } from "../../../../utils/autofill-context.js";
|
7
|
+
import { TemplateInstance as R } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
8
|
+
import { MetadataEmptyState as B } from "../../../metadata-empty-state/metadata-empty-state.js";
|
9
|
+
import { UnsavedChangesModal as j } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
10
|
+
import { CustomInstance as k } from "../custom-instance/custom-instance.js";
|
11
|
+
import { DeleteConfirmationModal as $ } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
12
|
+
import { MetadataInstanceFormFooter as w } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
|
13
|
+
import { MetadataInstanceFormHeader as H } from "../metadata-instance-form-header/metadata-instance-form-header.js";
|
14
|
+
import { createJSONPatch as J } from "./utils.js";
|
15
15
|
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
16
|
-
const
|
17
|
-
metadataInstanceForm:
|
18
|
-
},
|
16
|
+
const V = "_metadataInstanceForm_1hu4u_1", q = {
|
17
|
+
metadataInstanceForm: V
|
18
|
+
}, re = (p) => {
|
19
19
|
const {
|
20
|
-
areAiSuggestionsAvailable:
|
20
|
+
areAiSuggestionsAvailable: f,
|
21
21
|
isAiSuggestionsFeatureEnabled: o,
|
22
|
-
isDeleteButtonDisabled:
|
22
|
+
isDeleteButtonDisabled: u,
|
23
23
|
isUnsavedChangesModalOpen: g = !1,
|
24
24
|
onCancel: h,
|
25
25
|
onDelete: C,
|
@@ -27,70 +27,70 @@ const q = "_metadataInstanceForm_1hu4u_1", z = {
|
|
27
27
|
selectedTemplateInstance: e,
|
28
28
|
setIsUnsavedChangesModalOpen: i,
|
29
29
|
onDiscardUnsavedChanges: M
|
30
|
-
} =
|
30
|
+
} = p, [S, m] = c(!1), {
|
31
31
|
isFetchingSuggestions: n,
|
32
32
|
getAiSuggestions: E
|
33
|
-
} =
|
34
|
-
await F(a,
|
33
|
+
} = L(), s = e.templateKey === K, I = async (a) => {
|
34
|
+
await F(a, J(a, e));
|
35
35
|
}, D = (a) => {
|
36
36
|
a ? i(!0) : h();
|
37
|
-
},
|
38
|
-
|
39
|
-
},
|
37
|
+
}, y = () => {
|
38
|
+
m(!0);
|
39
|
+
}, b = {
|
40
40
|
metadata: {
|
41
41
|
...e
|
42
42
|
}
|
43
|
-
},
|
43
|
+
}, r = U(null), [l, A] = c(null);
|
44
44
|
_(() => {
|
45
|
-
|
46
|
-
}, []);
|
45
|
+
A(r.current);
|
46
|
+
}, [e.templateKey, e.scope]);
|
47
47
|
const O = x(() => {
|
48
48
|
const a = e.fields.length === 0;
|
49
|
-
return s ? /* @__PURE__ */ t(
|
49
|
+
return s ? /* @__PURE__ */ t(k, {
|
50
50
|
isLoading: n
|
51
|
-
}) : a ? /* @__PURE__ */ t(
|
51
|
+
}) : a ? /* @__PURE__ */ t(B, {
|
52
52
|
isBoxAiSuggestionsFeatureEnabled: o,
|
53
53
|
level: "instance"
|
54
|
-
}) : /* @__PURE__ */ t(
|
54
|
+
}) : /* @__PURE__ */ t(R, {
|
55
55
|
disableForm: n,
|
56
56
|
portalElement: l
|
57
57
|
});
|
58
|
-
}, [s, e.fields.length, n, o, l]);
|
58
|
+
}, [s, e.fields.length, e.templateKey, e.scope, n, o, l]);
|
59
59
|
return /* @__PURE__ */ t(N, {
|
60
|
-
initialValues:
|
60
|
+
initialValues: b,
|
61
61
|
onSubmit: I,
|
62
62
|
children: ({
|
63
63
|
values: a,
|
64
64
|
dirty: T
|
65
65
|
}) => /* @__PURE__ */ d(P, {
|
66
66
|
children: [/* @__PURE__ */ d(v, {
|
67
|
-
ref:
|
68
|
-
className:
|
69
|
-
children: [/* @__PURE__ */ t(
|
70
|
-
areAiSuggestionsAvailable:
|
67
|
+
ref: r,
|
68
|
+
className: q.metadataInstanceForm,
|
69
|
+
children: [/* @__PURE__ */ t(H, {
|
70
|
+
areAiSuggestionsAvailable: f,
|
71
71
|
isAiSuggestionsFeatureEnabled: o && !s,
|
72
72
|
isLoading: n,
|
73
73
|
onAutofill: E,
|
74
74
|
templateName: e.displayName
|
75
|
-
}), O, /* @__PURE__ */ t(
|
76
|
-
isDeleteButtonDisabled:
|
75
|
+
}), O, /* @__PURE__ */ t(w, {
|
76
|
+
isDeleteButtonDisabled: u,
|
77
77
|
isLoading: n,
|
78
78
|
onCancel: () => D(T),
|
79
|
-
onDelete:
|
79
|
+
onDelete: y
|
80
80
|
})]
|
81
|
-
}), /* @__PURE__ */ t(
|
81
|
+
}), /* @__PURE__ */ t(j, {
|
82
82
|
onBackToEdit: () => i(!1),
|
83
83
|
onDiscardChanges: M,
|
84
84
|
open: g
|
85
|
-
}), /* @__PURE__ */ t(
|
85
|
+
}), /* @__PURE__ */ t($, {
|
86
86
|
onConfirm: () => C(e),
|
87
|
-
onDismiss: () =>
|
87
|
+
onDismiss: () => m(!1),
|
88
88
|
open: S,
|
89
89
|
templateName: e.displayName
|
90
90
|
})]
|
91
91
|
})
|
92
|
-
});
|
92
|
+
}, `${e.scope}.${e.templateKey}`);
|
93
93
|
};
|
94
94
|
export {
|
95
|
-
|
95
|
+
re as MetadataInstanceForm
|
96
96
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.59.
|
3
|
+
"version": "0.59.3",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.20.0",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "3e7439683617c58f47e2b395137406b726138e12"
|
57
57
|
}
|