@box/metadata-editor 0.70.1 → 0.70.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.
@@ -1,78 +1,79 @@
|
|
1
1
|
import I from "clsx";
|
2
2
|
import { useFormikContext as V } from "formik";
|
3
|
-
import
|
4
|
-
import { forwardRef as
|
5
|
-
import { AiSuggestionField as
|
6
|
-
import { UpdateModeFieldWrapper as
|
7
|
-
import { editorFieldTypes as
|
8
|
-
import { s as
|
9
|
-
import { jsx as
|
10
|
-
const
|
3
|
+
import v from "lodash/isUndefined";
|
4
|
+
import { forwardRef as C, useState as F, useCallback as P, useEffect as R } from "react";
|
5
|
+
import { AiSuggestionField as T } from "./components/ai-suggestion-field/ai-suggestion-field.js";
|
6
|
+
import { UpdateModeFieldWrapper as U } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
7
|
+
import { editorFieldTypes as b } from "./editor-field-types.js";
|
8
|
+
import { s as n } from "../../../../chunks/utils.js";
|
9
|
+
import { jsx as a, jsxs as j } from "react/jsx-runtime";
|
10
|
+
const L = /* @__PURE__ */ C(({
|
11
11
|
disableForm: d,
|
12
|
-
portalElement:
|
12
|
+
portalElement: u,
|
13
13
|
field: e,
|
14
|
-
index:
|
15
|
-
taxonomyOptionsFetcher:
|
16
|
-
},
|
17
|
-
var
|
14
|
+
index: M,
|
15
|
+
taxonomyOptionsFetcher: g
|
16
|
+
}, c) => {
|
17
|
+
var x;
|
18
18
|
const {
|
19
19
|
setFieldValue: m
|
20
|
-
} = V(), [
|
21
|
-
aiSuggestion:
|
22
|
-
type:
|
23
|
-
value:
|
24
|
-
} = e,
|
25
|
-
[
|
26
|
-
[
|
27
|
-
[
|
28
|
-
})
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
} = V(), [N, S] = F(!0), [p, f] = F(!1), r = b[e.type], {
|
21
|
+
aiSuggestion: t,
|
22
|
+
type: A,
|
23
|
+
value: y
|
24
|
+
} = e, W = r && !e.hidden, k = !v(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
|
25
|
+
[n.suggestionApplied]: p,
|
26
|
+
[n.hasSuggestion]: i,
|
27
|
+
[n.dateField]: A === "date"
|
28
|
+
}), o = P((l) => {
|
29
|
+
m(`${s}.value`, l), S(!1), f(!0);
|
30
|
+
}, [s, m]);
|
31
|
+
R(() => {
|
32
|
+
!i || y || o(t);
|
33
|
+
}, [i, t, o]);
|
34
|
+
const h = () => {
|
35
|
+
p && f(!1);
|
33
36
|
};
|
34
|
-
return
|
35
|
-
fieldNamePrefix:
|
37
|
+
return W ? k ? /* @__PURE__ */ a(U, {
|
38
|
+
fieldNamePrefix: s,
|
36
39
|
fieldType: e.type,
|
37
|
-
isTaxonomyMultiSelect:
|
38
|
-
children: /* @__PURE__ */
|
39
|
-
ref:
|
40
|
+
isTaxonomyMultiSelect: w,
|
41
|
+
children: /* @__PURE__ */ a(r, {
|
42
|
+
ref: c,
|
40
43
|
description: e.description,
|
41
44
|
disableForm: d,
|
42
|
-
fieldNamePrefix:
|
45
|
+
fieldNamePrefix: s,
|
43
46
|
isAiSuggestionApplied: !1,
|
44
47
|
label: e.displayName,
|
45
|
-
onValueEdited:
|
46
|
-
portalElement:
|
47
|
-
taxonomyOptionsFetcher:
|
48
|
+
onValueEdited: h,
|
49
|
+
portalElement: u,
|
50
|
+
taxonomyOptionsFetcher: g
|
48
51
|
})
|
49
|
-
}, e.key) : /* @__PURE__ */
|
50
|
-
className:
|
51
|
-
children: [/* @__PURE__ */
|
52
|
-
ref:
|
53
|
-
className:
|
52
|
+
}, e.key) : /* @__PURE__ */ j("div", {
|
53
|
+
className: n.fieldWrapper,
|
54
|
+
children: [/* @__PURE__ */ a(r, {
|
55
|
+
ref: c,
|
56
|
+
className: E,
|
54
57
|
description: e.description,
|
55
58
|
disableForm: d,
|
56
|
-
fieldNamePrefix:
|
57
|
-
isAiSuggestionApplied:
|
59
|
+
fieldNamePrefix: s,
|
60
|
+
isAiSuggestionApplied: p,
|
58
61
|
label: e.displayName,
|
59
|
-
onValueEdited:
|
60
|
-
portalElement:
|
61
|
-
taxonomyOptionsFetcher:
|
62
|
-
}),
|
63
|
-
aiSuggestion:
|
62
|
+
onValueEdited: h,
|
63
|
+
portalElement: u,
|
64
|
+
taxonomyOptionsFetcher: g
|
65
|
+
}), i && /* @__PURE__ */ a(T, {
|
66
|
+
aiSuggestion: t,
|
64
67
|
onAiSuggestionAppend: () => {
|
65
|
-
const
|
66
|
-
|
68
|
+
const l = [...new Set([y, t].flat())];
|
69
|
+
o(l);
|
67
70
|
},
|
68
|
-
onAiSuggestionIgnore: () =>
|
69
|
-
onAiSuggestionReplace: () =>
|
70
|
-
|
71
|
-
},
|
72
|
-
type: c
|
71
|
+
onAiSuggestionIgnore: () => S(!1),
|
72
|
+
onAiSuggestionReplace: () => o(t),
|
73
|
+
type: A
|
73
74
|
})]
|
74
|
-
}, e.key);
|
75
|
+
}, e.key) : null;
|
75
76
|
});
|
76
77
|
export {
|
77
|
-
|
78
|
+
L as MetadataEditorFieldWrapper
|
78
79
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.70.
|
3
|
+
"version": "0.70.2",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "eb5ed5c64409c450071ca60d4c97aec952bfbd79"
|
57
57
|
}
|
@@ -23,6 +23,7 @@ declare const allFieldsTemplateInstance: MetadataTemplateInstance;
|
|
23
23
|
declare const templateInstanceWithoutEmptyValues: MetadataTemplateInstance;
|
24
24
|
declare const emptyTemplateInstance: MetadataTemplateInstance;
|
25
25
|
declare const templateInstanceWithAllFieldsEmpty: MetadataTemplateInstance;
|
26
|
+
declare const templateInstanceWithSomeFieldsEmpty: MetadataTemplateInstance;
|
26
27
|
declare const customTemplateInstance: MetadataTemplateInstance;
|
27
28
|
declare const customTemplateInstanceWithoutEmptyValues: MetadataTemplateInstance;
|
28
29
|
declare const emptyCustomTemplateInstance: MetadataTemplateInstance;
|
@@ -38,4 +39,4 @@ declare const firstTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[
|
|
38
39
|
declare const secondTemplateInstance: MetadataTemplate;
|
39
40
|
declare const secondTemplateSuggestions: AutofillSuggestions;
|
40
41
|
declare const secondTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[];
|
41
|
-
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateOptions, templates, };
|
42
|
+
export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
|