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