@box/metadata-template-editor 1.20.9 → 1.20.10
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/dist/chunks/chip.js +21 -0
- package/dist/chunks/dropdown-field-configuration.js +62 -0
- package/dist/chunks/field-context-menu.js +90 -0
- package/dist/chunks/field-selector.js +23 -0
- package/dist/chunks/field-type-dropdown.js +31 -0
- package/dist/chunks/levels-chain.js +125 -0
- package/dist/chunks/metadata-field-configurator.module.js +17 -16
- package/dist/chunks/metadata-field-list.js +229 -0
- package/dist/chunks/metadata-template-editor-form.js +107 -0
- package/dist/chunks/metadata-template-editor-modal.js +77 -0
- package/dist/chunks/metadata-template-editor.js +157 -0
- package/dist/chunks/sortable-option-list.js +231 -0
- package/dist/chunks/taxonomy-field-configuration.js +126 -0
- package/dist/chunks/taxonomy-field-configurator-initial-state.js +48 -0
- package/dist/chunks/taxonomy-selector.js +90 -0
- package/dist/chunks/types.js +22 -33
- package/dist/esm/index.js +13 -34
- package/dist/esm/lib/components/field-selector/field-selector.js +2 -39
- package/dist/esm/lib/components/field-selector/index.js +2 -4
- package/dist/esm/lib/components/field-selector/messages.js +10 -12
- package/dist/esm/lib/components/field-type-dropdown/field-type-dropdown.js +2 -47
- package/dist/esm/lib/components/field-type-dropdown/index.js +2 -4
- package/dist/esm/lib/components/field-type-dropdown/messages.js +10 -12
- package/dist/esm/lib/components/field-type-tiles/field-type-tiles.js +32 -39
- package/dist/esm/lib/components/field-type-tiles/index.js +2 -4
- package/dist/esm/lib/components/field-type-tiles/messages.js +10 -12
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.js +32 -45
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/messages.js +14 -16
- package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +62 -79
- package/dist/esm/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.js +2 -115
- package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +83 -100
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/chip.js +2 -33
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/index.js +2 -4
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.js +2 -118
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/utils.js +16 -33
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.js +34 -32
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.js +10 -14
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.js +2 -66
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.js +2 -294
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/index.js +3 -6
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.js +11 -15
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.js +2 -149
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.js +2 -54
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.js +2 -103
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.js +15 -19
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.js +2 -4
- package/dist/esm/lib/components/metadata-field-configurator/context/field-configurator-context.js +60 -66
- package/dist/esm/lib/components/metadata-field-configurator/context/field-extensions-context.js +5 -8
- package/dist/esm/lib/components/metadata-field-configurator/context/taxonomy-options-context.js +14 -20
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.js +99 -118
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldValidation.js +52 -66
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.js +23 -26
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.js +34 -43
- package/dist/esm/lib/components/metadata-field-configurator/index.js +5 -11
- package/dist/esm/lib/components/metadata-field-configurator/messages/configurator-messages.js +131 -134
- package/dist/esm/lib/components/metadata-field-configurator/messages/dropdown-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/messages/levels-chain-messages.js +14 -16
- package/dist/esm/lib/components/metadata-field-configurator/messages/taxonomy-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +94 -153
- package/dist/esm/lib/components/metadata-field-configurator/utils.js +42 -49
- package/dist/esm/lib/components/metadata-field-list/index.js +2 -5
- package/dist/esm/lib/components/metadata-field-list/metadata-field-list.js +2 -279
- package/dist/esm/lib/components/metadata-template-editor-form/metadata-template-editor-form.js +2 -137
- package/dist/esm/lib/components/metadata-template-editor-modal/index.js +2 -4
- package/dist/esm/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.js +2 -103
- package/dist/esm/lib/hooks/useMetadataTemplateFormSchema.js +13 -15
- package/dist/esm/lib/hooks/useTemplateNameSchema.js +8 -10
- package/dist/esm/lib/index.js +7 -14
- package/dist/esm/lib/messages.js +114 -116
- package/dist/esm/lib/metadata-template-editor.js +2 -182
- package/dist/esm/lib/utils/constants.js +2 -8
- package/dist/esm/lib/utils/field-options/field-type-icon.js +14 -33
- package/dist/esm/lib/utils/field-options/index.js +4 -9
- package/dist/esm/lib/utils/field-options/messages.js +43 -46
- package/dist/esm/lib/utils/field-options/useFieldOptions.js +14 -18
- package/dist/esm/lib/utils/key-generation.js +16 -27
- package/dist/esm/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.js +63 -77
- package/dist/esm/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.js +69 -89
- package/dist/esm/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.js +150 -169
- package/dist/esm/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.js +8 -13
- package/dist/styles/chip.css +1 -1
- package/dist/styles/dropdown-field-configuration.css +1 -1
- package/dist/styles/field-context-menu.css +1 -1
- package/dist/styles/levels-chain.css +1 -1
- package/dist/styles/metadata-field-configurator.css +1 -1
- package/dist/styles/metadata-field-list.css +1 -1
- package/dist/styles/metadata-template-editor-form.css +1 -1
- package/dist/styles/metadata-template-editor-modal.css +1 -1
- package/dist/styles/metadata-template-editor.css +1 -1
- package/dist/styles/sortable-option-list.css +1 -1
- package/dist/styles/taxonomy-field-configuration.css +1 -1
- package/dist/styles/taxonomy-field-configurator-initial-state.css +1 -1
- package/dist/styles/taxonomy-selector.css +1 -1
- package/package.json +6 -6
package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/utils.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const u = t.slice(0, t.length - n), c = o.slice(e), f = u.length + c.length + 1;
|
|
17
|
-
if (u.reduce((i, g) => i + g, 0) + r + c.reduce((i, g) => i + g, 0) + (f - 1) * a <= s)
|
|
18
|
-
break;
|
|
19
|
-
if (l === 0 && n < t.length)
|
|
20
|
-
n += 1, l = 1;
|
|
21
|
-
else if (l === 1 && e < o.length)
|
|
22
|
-
e += 1, l = 0;
|
|
23
|
-
else if (n < t.length)
|
|
24
|
-
n += 1;
|
|
25
|
-
else if (e < o.length)
|
|
26
|
-
e += 1;
|
|
27
|
-
else
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
return [n, e];
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
C as getHideCounts
|
|
1
|
+
var e = ({ isMeasured: e, leftLevelWidths: t, rightLevelWidths: n, containerWidthPx: r, buttonWidthPx: i, gapBetweenItems: a }) => {
|
|
2
|
+
if (!e) return [0, 0];
|
|
3
|
+
let o = t.length + n.length;
|
|
4
|
+
if ([...t, ...n].reduce((e, t) => e + t, 0) + (o - 1) * a <= r) return [0, 0];
|
|
5
|
+
let s = 0, c = 0, l = 0;
|
|
6
|
+
for (; s < t.length || c < n.length;) {
|
|
7
|
+
let e = t.slice(0, t.length - s), o = n.slice(c), u = e.length + o.length + 1;
|
|
8
|
+
if (e.reduce((e, t) => e + t, 0) + i + o.reduce((e, t) => e + t, 0) + (u - 1) * a <= r) break;
|
|
9
|
+
if (l === 0 && s < t.length) s += 1, l = 1;
|
|
10
|
+
else if (l === 1 && c < n.length) c += 1, l = 0;
|
|
11
|
+
else if (s < t.length) s += 1;
|
|
12
|
+
else if (c < n.length) c += 1;
|
|
13
|
+
else break;
|
|
14
|
+
}
|
|
15
|
+
return [s, c];
|
|
34
16
|
};
|
|
17
|
+
export { e as getHideCounts };
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { taxonomyDefaultValues as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { a as e } from "../../../../../../../../chunks/types.js";
|
|
2
|
+
import { taxonomyDefaultValues as t } from "../../taxonomy/taxonomy-default-values.js";
|
|
3
|
+
var n = [
|
|
4
|
+
{
|
|
5
|
+
id: "option1",
|
|
6
|
+
key: "Option 1",
|
|
7
|
+
isNew: !0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "option2",
|
|
11
|
+
key: "Option 2",
|
|
12
|
+
isNew: !0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "option3",
|
|
16
|
+
key: "Option 3",
|
|
17
|
+
isNew: !0
|
|
18
|
+
}
|
|
19
|
+
], r = () => ({
|
|
20
|
+
id: "mock-dropdown-field",
|
|
21
|
+
key: "test",
|
|
22
|
+
type: e.Dropdown,
|
|
23
|
+
name: "Test",
|
|
24
|
+
description: "",
|
|
25
|
+
hidden: !1,
|
|
26
|
+
isFieldNew: !0,
|
|
27
|
+
isFieldReadOnly: !1,
|
|
28
|
+
dropdown: {
|
|
29
|
+
options: n,
|
|
30
|
+
allowMultipleSelections: !1,
|
|
31
|
+
isAllowMultipleSelectionsEnabled: !0
|
|
32
|
+
},
|
|
33
|
+
taxonomy: t.taxonomy
|
|
30
34
|
});
|
|
31
|
-
export {
|
|
32
|
-
l as getInitialValues
|
|
33
|
-
};
|
|
35
|
+
export { r as getInitialValues };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import e from "lodash/uniqueId";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
export {
|
|
14
|
-
l as getDropdownDefaultValues
|
|
15
|
-
};
|
|
2
|
+
var t = () => ({ dropdown: {
|
|
3
|
+
options: [{
|
|
4
|
+
id: e(),
|
|
5
|
+
key: "Option 1",
|
|
6
|
+
isNew: !0
|
|
7
|
+
}],
|
|
8
|
+
allowMultipleSelections: !1,
|
|
9
|
+
isAllowMultipleSelectionsEnabled: !0
|
|
10
|
+
} });
|
|
11
|
+
export { t as getDropdownDefaultValues };
|
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useState as L, useCallback as l, useEffect as _ } from "react";
|
|
4
|
-
import { useIntl as b } from "react-intl";
|
|
5
|
-
import { useFieldConfigurator as y } from "../../../context/field-configurator-context.js";
|
|
6
|
-
import d from "../../../messages/dropdown-messages.js";
|
|
7
|
-
import { SortableOptionList as B } from "./sortable-option-list.js";
|
|
8
|
-
import { jsxs as E, jsx as i } from "react/jsx-runtime";
|
|
9
|
-
import '../../../../../../../styles/dropdown-field-configuration.css';const I = "_dropdownFieldConfiguration_rjv8w_1", N = "_addOptionButton_rjv8w_7", p = {
|
|
10
|
-
dropdownFieldConfiguration: I,
|
|
11
|
-
addOptionButton: N
|
|
12
|
-
}, R = () => {
|
|
13
|
-
const {
|
|
14
|
-
formatMessage: t
|
|
15
|
-
} = b(), {
|
|
16
|
-
values: o,
|
|
17
|
-
errors: u,
|
|
18
|
-
touched: c,
|
|
19
|
-
setFieldValue: r
|
|
20
|
-
} = y(), [w, a] = L(!1), s = o.dropdown.options.length > 0, m = u.dropdown, f = c.dropdown, h = m?.options?.some((n, C) => n?.key && f?.options?.[C]), e = l((n = !1) => {
|
|
21
|
-
r("dropdown", {
|
|
22
|
-
...o.dropdown,
|
|
23
|
-
options: [...o.dropdown.options, {
|
|
24
|
-
id: k(),
|
|
25
|
-
key: "",
|
|
26
|
-
isNew: !0
|
|
27
|
-
}]
|
|
28
|
-
}), a(n);
|
|
29
|
-
}, [o.dropdown, r]), F = l(() => {
|
|
30
|
-
e(!0);
|
|
31
|
-
}, [e]);
|
|
32
|
-
_(() => {
|
|
33
|
-
s || e(!1);
|
|
34
|
-
}, [s, e]);
|
|
35
|
-
const O = l(() => {
|
|
36
|
-
a(!1);
|
|
37
|
-
}, []);
|
|
38
|
-
return /* @__PURE__ */ E("div", {
|
|
39
|
-
className: p.dropdownFieldConfiguration,
|
|
40
|
-
children: [h && /* @__PURE__ */ i(g, {
|
|
41
|
-
variant: "error",
|
|
42
|
-
variantIconAriaLabel: t(d.optionListValidationError),
|
|
43
|
-
children: t(d.optionListValidationError)
|
|
44
|
-
}), s && /* @__PURE__ */ i(B, {
|
|
45
|
-
shouldFocusLastOption: w,
|
|
46
|
-
onFocusConsumed: O
|
|
47
|
-
}), /* @__PURE__ */ i(v, {
|
|
48
|
-
className: p.addOptionButton,
|
|
49
|
-
onClick: F,
|
|
50
|
-
children: t(d.addOption)
|
|
51
|
-
}), /* @__PURE__ */ i(S.Item, {
|
|
52
|
-
name: "dropdown.allowMultipleSelections",
|
|
53
|
-
checked: o.dropdown.allowMultipleSelections,
|
|
54
|
-
disabled: !o.isFieldNew || o.isFieldReadOnly,
|
|
55
|
-
label: t(d.allowMultipleSelection),
|
|
56
|
-
onCheckedChange: (n) => r("dropdown", {
|
|
57
|
-
...o.dropdown,
|
|
58
|
-
allowMultipleSelections: n
|
|
59
|
-
}),
|
|
60
|
-
value: "true"
|
|
61
|
-
})]
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
R as DropdownFieldConfiguration
|
|
66
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../../chunks/dropdown-field-configuration.js";
|
|
2
|
+
export { e as DropdownFieldConfiguration };
|
|
@@ -1,294 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Trash as V } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
-
import { useSensors as te, useSensor as B, PointerSensor as ne, TouchSensor as oe, KeyboardSensor as re, DndContext as ie, closestCenter as ae, DragOverlay as le } from "@dnd-kit/core";
|
|
5
|
-
import { sortableKeyboardCoordinates as de, SortableContext as se, verticalListSortingStrategy as ce, arrayMove as R, useSortable as ue } from "@dnd-kit/sortable";
|
|
6
|
-
import { CSS as pe } from "@dnd-kit/utilities";
|
|
7
|
-
import J from "clsx";
|
|
8
|
-
import me from "lodash/uniqueId";
|
|
9
|
-
import { useState as S, useRef as fe, useEffect as E, useCallback as G } from "react";
|
|
10
|
-
import { useIntl as ge } from "react-intl";
|
|
11
|
-
import { useFieldConfigurator as he } from "../../../context/field-configurator-context.js";
|
|
12
|
-
import v from "../../../messages/dropdown-messages.js";
|
|
13
|
-
import be from "../../confirmation-modal/confirmation-modal.js";
|
|
14
|
-
import { jsxs as L, Fragment as ye, jsx as o } from "react/jsx-runtime";
|
|
15
|
-
import '../../../../../../../styles/sortable-option-list.css';const Ce = "_sortableOptionList_1cieq_1", ve = "_option_1cieq_9", De = "_editable_1cieq_9", _e = "_dragging_1cieq_22", Oe = "_dragHandle_1cieq_26", we = "_input_1cieq_41", Ie = "_deleteButtonContainer_1cieq_52", Se = "_optionDragOverlay_1cieq_58", r = {
|
|
16
|
-
sortableOptionList: Ce,
|
|
17
|
-
option: ve,
|
|
18
|
-
editable: De,
|
|
19
|
-
dragging: _e,
|
|
20
|
-
dragHandle: Oe,
|
|
21
|
-
input: we,
|
|
22
|
-
deleteButtonContainer: Ie,
|
|
23
|
-
optionDragOverlay: Se
|
|
24
|
-
};
|
|
25
|
-
function Ne(a, u, t, s, D, l) {
|
|
26
|
-
const p = (
|
|
27
|
-
// Guard 1: was this option's field interacted with?
|
|
28
|
-
u?.dropdown?.options?.[t] && // Guard 2: errors is a non-null object (required for property access below)
|
|
29
|
-
typeof a == "object" && a !== null && // Guard 3: errors.dropdown is an object (i.e. there are dropdown-level errors)
|
|
30
|
-
typeof a.dropdown == "object" && // Finally: read the `key` validation error for this specific option, if present
|
|
31
|
-
a.dropdown?.options?.[t]?.key
|
|
32
|
-
);
|
|
33
|
-
if (typeof p != "string")
|
|
34
|
-
return "";
|
|
35
|
-
if (l !== null && s.id !== l) {
|
|
36
|
-
const h = D.find((b) => b.id === l)?.key;
|
|
37
|
-
if (
|
|
38
|
-
// Guard 1: lastChangedKey is non-null (i.e. the user has edited an option)
|
|
39
|
-
!!h && // Guard 2: the current option's key matches the last-edited option's key
|
|
40
|
-
s.key === h && // Guard 3: there is at least one other option in the group with the same key
|
|
41
|
-
D.some((b, _) => _ !== t && b.key === h)
|
|
42
|
-
)
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
return p;
|
|
46
|
-
}
|
|
47
|
-
function Te({
|
|
48
|
-
option: a,
|
|
49
|
-
index: u,
|
|
50
|
-
isFieldReadOnly: t,
|
|
51
|
-
onInputChange: s,
|
|
52
|
-
onDelete: D,
|
|
53
|
-
onInputRef: l,
|
|
54
|
-
error: p,
|
|
55
|
-
handleBlur: h,
|
|
56
|
-
canDelete: w,
|
|
57
|
-
dragAriaLabel: b,
|
|
58
|
-
inputPlaceholder: _,
|
|
59
|
-
deleteAriaLabel: I
|
|
60
|
-
}) {
|
|
61
|
-
const {
|
|
62
|
-
attributes: y,
|
|
63
|
-
listeners: n,
|
|
64
|
-
setNodeRef: O,
|
|
65
|
-
transform: N,
|
|
66
|
-
transition: T,
|
|
67
|
-
isDragging: m
|
|
68
|
-
} = ue({
|
|
69
|
-
id: a.id
|
|
70
|
-
}), k = {
|
|
71
|
-
transform: pe.Translate.toString(N),
|
|
72
|
-
transition: T
|
|
73
|
-
};
|
|
74
|
-
return /* @__PURE__ */ L("li", {
|
|
75
|
-
ref: O,
|
|
76
|
-
style: k,
|
|
77
|
-
className: J(r.option, {
|
|
78
|
-
[r.dragging]: m,
|
|
79
|
-
[r.editable]: !t
|
|
80
|
-
}),
|
|
81
|
-
children: [!t && /* @__PURE__ */ o("div", {
|
|
82
|
-
className: r.dragHandle,
|
|
83
|
-
...n,
|
|
84
|
-
...y,
|
|
85
|
-
"aria-label": b,
|
|
86
|
-
tabIndex: -1,
|
|
87
|
-
children: /* @__PURE__ */ o(F, {
|
|
88
|
-
fontSize: 20,
|
|
89
|
-
"aria-hidden": "true"
|
|
90
|
-
})
|
|
91
|
-
}), /* @__PURE__ */ o(K, {
|
|
92
|
-
disabled: t,
|
|
93
|
-
placeholder: _,
|
|
94
|
-
label: _,
|
|
95
|
-
hideLabel: !0,
|
|
96
|
-
onBlur: h,
|
|
97
|
-
id: `dropdown.options.${u}.key`,
|
|
98
|
-
name: `dropdown.options.${u}.key`,
|
|
99
|
-
value: a.key,
|
|
100
|
-
className: r.input,
|
|
101
|
-
onChange: (C) => s(C, a.id),
|
|
102
|
-
ref: (C) => l(C, u),
|
|
103
|
-
error: p
|
|
104
|
-
}), !t && /* @__PURE__ */ o("div", {
|
|
105
|
-
className: r.deleteButtonContainer,
|
|
106
|
-
children: /* @__PURE__ */ o($, {
|
|
107
|
-
onClick: () => D(a),
|
|
108
|
-
"aria-label": I,
|
|
109
|
-
icon: V,
|
|
110
|
-
size: "x-small",
|
|
111
|
-
variant: "default",
|
|
112
|
-
tabIndex: -1,
|
|
113
|
-
focusable: !0,
|
|
114
|
-
disabled: !w,
|
|
115
|
-
className: r.deleteButton
|
|
116
|
-
})
|
|
117
|
-
})]
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function Ke({
|
|
121
|
-
shouldFocusLastOption: a = !1,
|
|
122
|
-
onFocusConsumed: u
|
|
123
|
-
}) {
|
|
124
|
-
const {
|
|
125
|
-
formatMessage: t
|
|
126
|
-
} = ge(), {
|
|
127
|
-
values: s,
|
|
128
|
-
errors: D,
|
|
129
|
-
touched: l,
|
|
130
|
-
setFieldValue: p,
|
|
131
|
-
setFieldTouched: h,
|
|
132
|
-
setTouched: w,
|
|
133
|
-
handleBlur: b
|
|
134
|
-
} = he(), _ = te(B(ne, {
|
|
135
|
-
activationConstraint: {
|
|
136
|
-
distance: 8
|
|
137
|
-
}
|
|
138
|
-
}), B(oe, {
|
|
139
|
-
activationConstraint: {
|
|
140
|
-
delay: 250,
|
|
141
|
-
tolerance: 5
|
|
142
|
-
}
|
|
143
|
-
}), B(re, {
|
|
144
|
-
coordinateGetter: de
|
|
145
|
-
})), {
|
|
146
|
-
options: I
|
|
147
|
-
} = s.dropdown, {
|
|
148
|
-
isFieldReadOnly: y
|
|
149
|
-
} = s, [n, O] = S(I), [N, T] = S(null), m = fe(null), [k, C] = S(null), [Q, q] = S(!1), [M, H] = S(null);
|
|
150
|
-
E(() => {
|
|
151
|
-
O(I);
|
|
152
|
-
}, [I]), E(() => () => {
|
|
153
|
-
m.current && clearTimeout(m.current);
|
|
154
|
-
}, []);
|
|
155
|
-
const x = G((e) => {
|
|
156
|
-
p("dropdown", {
|
|
157
|
-
...s.dropdown,
|
|
158
|
-
options: e
|
|
159
|
-
});
|
|
160
|
-
}, [s.dropdown, p]), U = (e, i) => {
|
|
161
|
-
T(i);
|
|
162
|
-
const c = n.map((d, f) => d.id === i ? (h(`dropdown.options.${f}.key`, !0), {
|
|
163
|
-
...d,
|
|
164
|
-
key: e.target.value
|
|
165
|
-
}) : d);
|
|
166
|
-
O(c), x(c);
|
|
167
|
-
}, j = () => {
|
|
168
|
-
H(null), q(!1);
|
|
169
|
-
}, z = (e) => {
|
|
170
|
-
if (!e)
|
|
171
|
-
return;
|
|
172
|
-
const i = n.filter((f) => f.id !== e);
|
|
173
|
-
O(i), x(i), e === N && T(null);
|
|
174
|
-
const c = {
|
|
175
|
-
...l
|
|
176
|
-
}, d = c.dropdown;
|
|
177
|
-
d?.options && (d.options = d.options.filter((f, g) => n[g]?.id !== e)), w(c), i.length === 0 && p("dropdown", {
|
|
178
|
-
...s.dropdown,
|
|
179
|
-
options: [{
|
|
180
|
-
id: me(),
|
|
181
|
-
key: "",
|
|
182
|
-
isNew: !0
|
|
183
|
-
}]
|
|
184
|
-
}), j();
|
|
185
|
-
}, W = (e) => {
|
|
186
|
-
e.isNew ? z(e.id) : (H(e), q(!0));
|
|
187
|
-
}, X = ({
|
|
188
|
-
active: e
|
|
189
|
-
}) => {
|
|
190
|
-
C(String(e.id));
|
|
191
|
-
}, Y = () => {
|
|
192
|
-
C(null);
|
|
193
|
-
}, Z = (e) => {
|
|
194
|
-
C(null);
|
|
195
|
-
const {
|
|
196
|
-
active: i,
|
|
197
|
-
over: c
|
|
198
|
-
} = e;
|
|
199
|
-
if (c && i.id !== c.id) {
|
|
200
|
-
const d = n.findIndex((g) => g.id === i.id), f = n.findIndex((g) => g.id === c.id);
|
|
201
|
-
if (d !== -1 && f !== -1) {
|
|
202
|
-
const g = R(n, d, f);
|
|
203
|
-
O(g), x(g);
|
|
204
|
-
const A = l?.dropdown?.options;
|
|
205
|
-
A && A.length > 0 && w({
|
|
206
|
-
...l,
|
|
207
|
-
dropdown: {
|
|
208
|
-
...l.dropdown ?? {},
|
|
209
|
-
options: R(A, d, f)
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}, ee = G((e, i) => {
|
|
215
|
-
e && a && i === n.length - 1 && (m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
216
|
-
e.focus(), u(), m.current = null;
|
|
217
|
-
}, 0));
|
|
218
|
-
}, [a, u, n.length]), P = k ? n.find((e) => e.id === k) : null;
|
|
219
|
-
return /* @__PURE__ */ L(ye, {
|
|
220
|
-
children: [/* @__PURE__ */ L(ie, {
|
|
221
|
-
sensors: _,
|
|
222
|
-
collisionDetection: ae,
|
|
223
|
-
onDragStart: X,
|
|
224
|
-
onDragEnd: Z,
|
|
225
|
-
onDragCancel: Y,
|
|
226
|
-
children: [/* @__PURE__ */ o(se, {
|
|
227
|
-
items: n.map((e) => e.id),
|
|
228
|
-
strategy: ce,
|
|
229
|
-
children: /* @__PURE__ */ o("ul", {
|
|
230
|
-
className: r.sortableOptionList,
|
|
231
|
-
children: n.map((e, i) => /* @__PURE__ */ o(Te, {
|
|
232
|
-
option: e,
|
|
233
|
-
index: i,
|
|
234
|
-
isFieldReadOnly: !!y,
|
|
235
|
-
onInputChange: U,
|
|
236
|
-
onDelete: W,
|
|
237
|
-
onInputRef: ee,
|
|
238
|
-
error: Ne(D, l, i, e, n, N),
|
|
239
|
-
handleBlur: b,
|
|
240
|
-
canDelete: n.length >= 2,
|
|
241
|
-
dragAriaLabel: t(v.dragAndDropOptionAriaLabel),
|
|
242
|
-
inputPlaceholder: t(v.addAnOptionOptionPlaceholder),
|
|
243
|
-
deleteAriaLabel: t(v.deleteDropdownOptionAriaLabel)
|
|
244
|
-
}, e.id))
|
|
245
|
-
})
|
|
246
|
-
}), /* @__PURE__ */ o(le, {
|
|
247
|
-
dropAnimation: null,
|
|
248
|
-
children: P ? /* @__PURE__ */ L("li", {
|
|
249
|
-
className: J(r.option, r.optionDragOverlay, {
|
|
250
|
-
[r.editable]: !y
|
|
251
|
-
}),
|
|
252
|
-
children: [!y && /* @__PURE__ */ o("div", {
|
|
253
|
-
className: r.dragHandle,
|
|
254
|
-
children: /* @__PURE__ */ o(F, {
|
|
255
|
-
fontSize: 20,
|
|
256
|
-
"aria-hidden": "true"
|
|
257
|
-
})
|
|
258
|
-
}), /* @__PURE__ */ o(K, {
|
|
259
|
-
disabled: y,
|
|
260
|
-
placeholder: t(v.addAnOptionOptionPlaceholder),
|
|
261
|
-
label: t(v.addAnOptionOptionPlaceholder),
|
|
262
|
-
hideLabel: !0,
|
|
263
|
-
id: "drag-overlay-option",
|
|
264
|
-
name: "drag-overlay-option",
|
|
265
|
-
value: P.key,
|
|
266
|
-
className: r.input
|
|
267
|
-
}), !y && /* @__PURE__ */ o("div", {
|
|
268
|
-
className: r.deleteButtonContainer,
|
|
269
|
-
children: /* @__PURE__ */ o($, {
|
|
270
|
-
icon: V,
|
|
271
|
-
size: "x-small",
|
|
272
|
-
variant: "default",
|
|
273
|
-
tabIndex: -1,
|
|
274
|
-
focusable: !0,
|
|
275
|
-
disabled: n.length < 2,
|
|
276
|
-
className: r.deleteButton,
|
|
277
|
-
"aria-label": ""
|
|
278
|
-
})
|
|
279
|
-
})]
|
|
280
|
-
}) : null
|
|
281
|
-
})]
|
|
282
|
-
}), Q && /* @__PURE__ */ o(be, {
|
|
283
|
-
onClose: j,
|
|
284
|
-
onConfirm: () => z(M?.id ?? null),
|
|
285
|
-
title: t(v.deleteOptionTitle, {
|
|
286
|
-
optionName: M?.key ?? ""
|
|
287
|
-
}),
|
|
288
|
-
body: t(v.deleteOptionDescription)
|
|
289
|
-
})]
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
export {
|
|
293
|
-
Ke as SortableOptionList
|
|
294
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../../chunks/sortable-option-list.js";
|
|
2
|
+
export { e as SortableOptionList };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
i as DropdownFieldConfiguration,
|
|
5
|
-
e as TaxonomyFieldConfiguration
|
|
6
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../chunks/dropdown-field-configuration.js";
|
|
2
|
+
import { t } from "../../../../../../chunks/taxonomy-field-configuration.js";
|
|
3
|
+
export { e as DropdownFieldConfiguration, t as TaxonomyFieldConfiguration };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
a as taxonomyDefaultValues
|
|
15
|
-
};
|
|
1
|
+
import { c as e } from "../../../../../../../chunks/types.js";
|
|
2
|
+
var t = { taxonomy: {
|
|
3
|
+
availableTaxonomies: [],
|
|
4
|
+
allowMultipleSelections: !1,
|
|
5
|
+
selection: e.RequireSpecific,
|
|
6
|
+
selectedLevels: [],
|
|
7
|
+
taxonomySearchValue: "",
|
|
8
|
+
taxonomyKey: "",
|
|
9
|
+
namespace: ""
|
|
10
|
+
} };
|
|
11
|
+
export { t as taxonomyDefaultValues };
|