@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
|
@@ -1,149 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useMemo as R, useEffect as V } from "react";
|
|
4
|
-
import { useIntl as A } from "react-intl";
|
|
5
|
-
import { useFieldConfigurator as q } from "../../../context/field-configurator-context.js";
|
|
6
|
-
import { useTaxonomyOptions as N } from "../../../context/taxonomy-options-context.js";
|
|
7
|
-
import t from "../../../messages/taxonomy-messages.js";
|
|
8
|
-
import { TaxonomyFieldConfiguratorInitialState as k } from "./taxonomy-field-configurator-initial-state.js";
|
|
9
|
-
import { TaxonomySelector as E } from "./taxonomy-selector.js";
|
|
10
|
-
import { T as a } from "../../../../../../../chunks/types.js";
|
|
11
|
-
import { useTaxonomySelect as K } from "./useTaxonomySelect.js";
|
|
12
|
-
import { filterTaxonomiesByValue as B } from "./utils.js";
|
|
13
|
-
import { jsxs as c, Fragment as v, jsx as l } from "react/jsx-runtime";
|
|
14
|
-
import { LevelsChain as O } from "../../levels-chain/levels-chain.js";
|
|
15
|
-
import '../../../../../../../styles/taxonomy-field-configuration.css';const _ = "_taxonomyFieldConfiguration_ylhrs_1", j = {
|
|
16
|
-
taxonomyFieldConfiguration: _
|
|
17
|
-
}, oe = () => {
|
|
18
|
-
const {
|
|
19
|
-
formatMessage: n
|
|
20
|
-
} = A(), {
|
|
21
|
-
values: e,
|
|
22
|
-
errors: S,
|
|
23
|
-
touched: g,
|
|
24
|
-
setFieldValue: r
|
|
25
|
-
} = q(), {
|
|
26
|
-
onTaxonomySelect: T
|
|
27
|
-
} = K({
|
|
28
|
-
values: e,
|
|
29
|
-
setFieldValue: r
|
|
30
|
-
}), {
|
|
31
|
-
options: u
|
|
32
|
-
} = N(), i = e.taxonomy.availableTaxonomies.find((o) => o.selected), {
|
|
33
|
-
selectedLevels: f
|
|
34
|
-
} = e.taxonomy, m = R(() => i ? i.levels : [], [i]), C = e.taxonomy.selection === a.RequireSpecific && f.length > 0 ? m[f[0] - 1]?.name : void 0;
|
|
35
|
-
V(
|
|
36
|
-
() => {
|
|
37
|
-
if (u.length > 0) {
|
|
38
|
-
const o = {
|
|
39
|
-
...e.taxonomy,
|
|
40
|
-
availableTaxonomies: u.map((d) => ({
|
|
41
|
-
...d,
|
|
42
|
-
selected: d.taxonomyKey === e.taxonomy.taxonomyKey
|
|
43
|
-
})),
|
|
44
|
-
selectedLevels: e.taxonomy.selectedLevels,
|
|
45
|
-
selection: e.taxonomy.selectedLevels.length > 1 ? a.AllowAny : a.RequireSpecific
|
|
46
|
-
};
|
|
47
|
-
r("taxonomy", o);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
51
|
-
[u]
|
|
52
|
-
);
|
|
53
|
-
const b = (o) => {
|
|
54
|
-
const d = o === a.AllowAny ? m.map((F) => F.level) : [m[0].level];
|
|
55
|
-
r("taxonomy", {
|
|
56
|
-
...e.taxonomy,
|
|
57
|
-
selection: o,
|
|
58
|
-
selectedLevels: d
|
|
59
|
-
});
|
|
60
|
-
}, L = i?.label ?? n(t.chooseTaxonomyLevel), w = !!S.taxonomy?.taxonomyKey && !!g.taxonomy?.taxonomyKey;
|
|
61
|
-
if (!i && e.isFieldNew)
|
|
62
|
-
return /* @__PURE__ */ c(v, {
|
|
63
|
-
children: [w && /* @__PURE__ */ l(I, {
|
|
64
|
-
variant: "error",
|
|
65
|
-
variantIconAriaLabel: n(t.noTaxonomySelectedError),
|
|
66
|
-
children: n(t.noTaxonomySelectedError)
|
|
67
|
-
}), /* @__PURE__ */ l(k, {})]
|
|
68
|
-
});
|
|
69
|
-
const s = e.isFieldReadOnly || !e.isFieldNew;
|
|
70
|
-
return /* @__PURE__ */ c("div", {
|
|
71
|
-
className: j.taxonomyFieldConfiguration,
|
|
72
|
-
children: [/* @__PURE__ */ l(M.Item, {
|
|
73
|
-
name: "allowMultipleSelections",
|
|
74
|
-
disabled: s,
|
|
75
|
-
checked: e.taxonomy.allowMultipleSelections,
|
|
76
|
-
label: n(t.allowMultipleTaxonomySelections),
|
|
77
|
-
onCheckedChange: (o) => {
|
|
78
|
-
r("taxonomy", {
|
|
79
|
-
...e.taxonomy,
|
|
80
|
-
allowMultipleSelections: o
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
value: e.taxonomy.allowMultipleSelections.toString()
|
|
84
|
-
}), /* @__PURE__ */ l("div", {
|
|
85
|
-
children: /* @__PURE__ */ l(E, {
|
|
86
|
-
triggerButton: /* @__PURE__ */ l(h, {
|
|
87
|
-
disabled: s,
|
|
88
|
-
icon: p,
|
|
89
|
-
children: L
|
|
90
|
-
}),
|
|
91
|
-
data: B(e.taxonomy.availableTaxonomies, e.taxonomy.taxonomySearchValue),
|
|
92
|
-
onClick: T,
|
|
93
|
-
onSearchValue: (o) => {
|
|
94
|
-
r("taxonomy", {
|
|
95
|
-
...e.taxonomy,
|
|
96
|
-
taxonomySearchValue: o
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
}), m.length > 0 && /* @__PURE__ */ l(O, {
|
|
101
|
-
levels: m,
|
|
102
|
-
selectedLevels: f
|
|
103
|
-
}), i && m.length > 1 && /* @__PURE__ */ l(y.Legend, {
|
|
104
|
-
header: n(t.selection),
|
|
105
|
-
children: /* @__PURE__ */ c(y.Group, {
|
|
106
|
-
disabled: s,
|
|
107
|
-
defaultValue: a.RequireSpecific,
|
|
108
|
-
loop: !0,
|
|
109
|
-
name: "selection",
|
|
110
|
-
onValueChange: b,
|
|
111
|
-
orientation: "vertical",
|
|
112
|
-
value: e.taxonomy.selection,
|
|
113
|
-
children: [/* @__PURE__ */ l(y.Item, {
|
|
114
|
-
label: /* @__PURE__ */ c(v, {
|
|
115
|
-
children: [n(t.requiredSelection), /* @__PURE__ */ c(x.Root, {
|
|
116
|
-
modal: !1,
|
|
117
|
-
children: [/* @__PURE__ */ l(x.Trigger, {
|
|
118
|
-
disabled: e.taxonomy.selection !== a.RequireSpecific || s,
|
|
119
|
-
children: /* @__PURE__ */ l(h, {
|
|
120
|
-
icon: p,
|
|
121
|
-
children: C ?? n(t.chooseTaxonomyLevel)
|
|
122
|
-
})
|
|
123
|
-
}), /* @__PURE__ */ l(x.Content, {
|
|
124
|
-
align: "start",
|
|
125
|
-
children: i?.levels?.map((o) => /* @__PURE__ */ l(x.Item, {
|
|
126
|
-
onClick: () => {
|
|
127
|
-
r("taxonomy", {
|
|
128
|
-
...e.taxonomy,
|
|
129
|
-
selectedLevels: [o.level]
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
children: o.name
|
|
133
|
-
}, o.level))
|
|
134
|
-
})]
|
|
135
|
-
})]
|
|
136
|
-
}),
|
|
137
|
-
value: a.RequireSpecific
|
|
138
|
-
}), /* @__PURE__ */ l(y.Item, {
|
|
139
|
-
disabled: s,
|
|
140
|
-
label: n(t.anyLevelSelection),
|
|
141
|
-
value: a.AllowAny
|
|
142
|
-
})]
|
|
143
|
-
})
|
|
144
|
-
})]
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
export {
|
|
148
|
-
oe as TaxonomyFieldConfiguration
|
|
149
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../../chunks/taxonomy-field-configuration.js";
|
|
2
|
+
export { e as TaxonomyFieldConfiguration };
|
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useFieldConfigurator as s } from "../../../context/field-configurator-context.js";
|
|
4
|
-
import i from "../../../messages/taxonomy-messages.js";
|
|
5
|
-
import { useTaxonomySelect as u } from "./useTaxonomySelect.js";
|
|
6
|
-
import { filterTaxonomiesByValue as c } from "./utils.js";
|
|
7
|
-
import { TaxonomySelector as d } from "./taxonomy-selector.js";
|
|
8
|
-
import { jsxs as x, jsx as o } from "react/jsx-runtime";
|
|
9
|
-
import '../../../../../../../styles/taxonomy-field-configurator-initial-state.css';const f = "_taxonomyFieldConfiguratorInitialState_il5v7_1", y = "_subheader_il5v7_10", n = {
|
|
10
|
-
taxonomyFieldConfiguratorInitialState: f,
|
|
11
|
-
subheader: y
|
|
12
|
-
}, C = () => {
|
|
13
|
-
const {
|
|
14
|
-
values: t,
|
|
15
|
-
setFieldValue: e
|
|
16
|
-
} = s(), {
|
|
17
|
-
onTaxonomySelect: l
|
|
18
|
-
} = u({
|
|
19
|
-
values: t,
|
|
20
|
-
setFieldValue: e
|
|
21
|
-
});
|
|
22
|
-
return /* @__PURE__ */ x("div", {
|
|
23
|
-
className: n.taxonomyFieldConfiguratorInitialState,
|
|
24
|
-
children: [/* @__PURE__ */ o(a, {
|
|
25
|
-
as: "h1",
|
|
26
|
-
color: "textOnLightDefault",
|
|
27
|
-
variant: "titleMedium",
|
|
28
|
-
children: /* @__PURE__ */ o(r, {
|
|
29
|
-
...i.callToActionHeader
|
|
30
|
-
})
|
|
31
|
-
}), /* @__PURE__ */ o(a, {
|
|
32
|
-
as: "p",
|
|
33
|
-
className: n.subheader,
|
|
34
|
-
color: "textOnLightDefault",
|
|
35
|
-
variant: "bodyDefault",
|
|
36
|
-
children: /* @__PURE__ */ o(r, {
|
|
37
|
-
...i.callToActionSubheader
|
|
38
|
-
})
|
|
39
|
-
}), /* @__PURE__ */ o(d, {
|
|
40
|
-
data: c(t.taxonomy.availableTaxonomies, t.taxonomy.taxonomySearchValue),
|
|
41
|
-
onClick: l,
|
|
42
|
-
resetValueOnHide: !0,
|
|
43
|
-
onSearchValue: (m) => {
|
|
44
|
-
e("taxonomy", {
|
|
45
|
-
...t.taxonomy,
|
|
46
|
-
taxonomySearchValue: m
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
})]
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
C as TaxonomyFieldConfiguratorInitialState
|
|
54
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../../chunks/taxonomy-field-configurator-initial-state.js";
|
|
2
|
+
export { e as TaxonomyFieldConfiguratorInitialState };
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import { defineMessages as e } from "react-intl";
|
|
2
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
var t = e({
|
|
3
|
+
taxonomySelectorAriaLabel: {
|
|
4
|
+
id: "groupSharedFeatures.metadataTemplateEditor.taxonomySelectorAriaLabel",
|
|
5
|
+
defaultMessage: "Open taxonomy selector"
|
|
6
|
+
},
|
|
7
|
+
taxonomySelector: {
|
|
8
|
+
id: "groupSharedFeatures.metadataTemplateEditor.taxonomySelector",
|
|
9
|
+
defaultMessage: "Choose a Taxonomy"
|
|
10
|
+
},
|
|
11
|
+
recentlyUsedTaxonomies: {
|
|
12
|
+
id: "groupSharedFeatures.metadataTemplateEditor.recentlyUsedTaxonomies",
|
|
13
|
+
defaultMessage: "Recents"
|
|
14
|
+
},
|
|
15
|
+
allTaxonomies: {
|
|
16
|
+
id: "groupSharedFeatures.metadataTemplateEditor.allTaxonomies",
|
|
17
|
+
defaultMessage: "All taxonomies"
|
|
18
|
+
},
|
|
19
|
+
searchTaxonomiesInputPlaceholder: {
|
|
20
|
+
id: "groupSharedFeatures.metadataTemplateEditor.searchTaxonomiesInputPlaceholder",
|
|
21
|
+
defaultMessage: "Search taxonomies"
|
|
22
|
+
},
|
|
23
|
+
loadingTaxonomies: {
|
|
24
|
+
id: "groupSharedFeatures.metadataTemplateEditor.loadingTaxonomies",
|
|
25
|
+
defaultMessage: "Loading taxonomies…"
|
|
26
|
+
},
|
|
27
|
+
loadTaxonomiesError: {
|
|
28
|
+
id: "groupSharedFeatures.metadataTemplateEditor.loadTaxonomiesError",
|
|
29
|
+
defaultMessage: "Failed to load taxonomies."
|
|
30
|
+
},
|
|
31
|
+
retryLoadTaxonomies: {
|
|
32
|
+
id: "groupSharedFeatures.metadataTemplateEditor.retryLoadTaxonomies",
|
|
33
|
+
defaultMessage: "Retry"
|
|
34
|
+
}
|
|
35
35
|
});
|
|
36
|
-
export {
|
|
37
|
-
o as default
|
|
38
|
-
};
|
|
36
|
+
export { t as default };
|
|
@@ -1,103 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useState as x } from "react";
|
|
4
|
-
import { useIntl as O } from "react-intl";
|
|
5
|
-
import { useTaxonomyOptions as N } from "../../../context/taxonomy-options-context.js";
|
|
6
|
-
import o from "./taxonomy-selector-messages.js";
|
|
7
|
-
import { jsx as a, jsxs as l, Fragment as k } from "react/jsx-runtime";
|
|
8
|
-
import '../../../../../../../styles/taxonomy-selector.css';const z = "_taxonomySelectorLabel_b3aww_1", j = "_listWrapper_b3aww_14", M = "_listWrapperWithPadding_b3aww_19", $ = "_taxonomyItem_b3aww_24", q = "_statusContainer_b3aww_30", r = {
|
|
9
|
-
taxonomySelectorLabel: z,
|
|
10
|
-
listWrapper: j,
|
|
11
|
-
listWrapperWithPadding: M,
|
|
12
|
-
taxonomyItem: $,
|
|
13
|
-
statusContainer: q
|
|
14
|
-
}, G = ({
|
|
15
|
-
data: g,
|
|
16
|
-
onClick: u,
|
|
17
|
-
onSearchValue: i,
|
|
18
|
-
triggerButton: y,
|
|
19
|
-
disabled: b,
|
|
20
|
-
resetValueOnHide: f
|
|
21
|
-
}) => {
|
|
22
|
-
const {
|
|
23
|
-
formatMessage: t
|
|
24
|
-
} = O(), {
|
|
25
|
-
status: c,
|
|
26
|
-
onSelectorOpen: d
|
|
27
|
-
} = N(), [C, m] = x(""), [_, p] = x(!1), v = (e) => {
|
|
28
|
-
m(e), i(e);
|
|
29
|
-
}, I = (e) => {
|
|
30
|
-
p(e), e && d(), !e && f && (m(""), i(""));
|
|
31
|
-
}, S = (e) => {
|
|
32
|
-
u(e), p(!1);
|
|
33
|
-
}, W = y ?? /* @__PURE__ */ a(n, {
|
|
34
|
-
variant: "secondary",
|
|
35
|
-
size: "large",
|
|
36
|
-
endIcon: P,
|
|
37
|
-
"aria-label": t(o.taxonomySelectorAriaLabel),
|
|
38
|
-
children: t(o.taxonomySelector)
|
|
39
|
-
}), T = () => c === "loading" ? /* @__PURE__ */ a("div", {
|
|
40
|
-
className: r.statusContainer,
|
|
41
|
-
children: /* @__PURE__ */ a(w, {
|
|
42
|
-
"aria-label": t(o.loadingTaxonomies)
|
|
43
|
-
})
|
|
44
|
-
}) : c === "error" ? /* @__PURE__ */ l("div", {
|
|
45
|
-
className: r.statusContainer,
|
|
46
|
-
children: [/* @__PURE__ */ a(h, {
|
|
47
|
-
as: "p",
|
|
48
|
-
variant: "bodyDefault",
|
|
49
|
-
color: "textOnLightSecondary",
|
|
50
|
-
children: t(o.loadTaxonomiesError)
|
|
51
|
-
}), /* @__PURE__ */ a(n, {
|
|
52
|
-
variant: "secondary",
|
|
53
|
-
size: "small",
|
|
54
|
-
onClick: d,
|
|
55
|
-
children: t(o.retryLoadTaxonomies)
|
|
56
|
-
})]
|
|
57
|
-
}) : /* @__PURE__ */ l(k, {
|
|
58
|
-
children: [/* @__PURE__ */ a("div", {
|
|
59
|
-
className: `${r.listWrapper} ${r.listWrapperWithPadding}`,
|
|
60
|
-
children: /* @__PURE__ */ a(L, {
|
|
61
|
-
label: t(o.searchTaxonomiesInputPlaceholder),
|
|
62
|
-
placeholder: t(o.searchTaxonomiesInputPlaceholder),
|
|
63
|
-
value: C,
|
|
64
|
-
onChange: (e) => v(e.target.value),
|
|
65
|
-
hideLabel: !0,
|
|
66
|
-
"aria-label": t(o.searchTaxonomiesInputPlaceholder)
|
|
67
|
-
})
|
|
68
|
-
}), /* @__PURE__ */ a(h, {
|
|
69
|
-
as: "span",
|
|
70
|
-
variant: "caption",
|
|
71
|
-
color: "textOnLightSecondary",
|
|
72
|
-
className: r.taxonomySelectorLabel,
|
|
73
|
-
children: t(o.allTaxonomies)
|
|
74
|
-
}), /* @__PURE__ */ a("div", {
|
|
75
|
-
className: r.listWrapper,
|
|
76
|
-
children: g.map((e) => /* @__PURE__ */ a(n, {
|
|
77
|
-
type: "button",
|
|
78
|
-
variant: "quaternary",
|
|
79
|
-
size: "large",
|
|
80
|
-
disabled: e?.levels?.length === 0,
|
|
81
|
-
onClick: () => S(e),
|
|
82
|
-
className: r.taxonomyItem,
|
|
83
|
-
children: e.label
|
|
84
|
-
}, e.id))
|
|
85
|
-
})]
|
|
86
|
-
});
|
|
87
|
-
return /* @__PURE__ */ l(s.Root, {
|
|
88
|
-
modal: !1,
|
|
89
|
-
open: _,
|
|
90
|
-
onOpenChange: I,
|
|
91
|
-
children: [/* @__PURE__ */ a(s.Trigger, {
|
|
92
|
-
disabled: b,
|
|
93
|
-
children: W
|
|
94
|
-
}), /* @__PURE__ */ a(s.ContentContainer, {
|
|
95
|
-
align: "start",
|
|
96
|
-
"aria-label": t(o.taxonomySelector),
|
|
97
|
-
children: T()
|
|
98
|
-
})]
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
G as TaxonomySelector
|
|
103
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../../chunks/taxonomy-selector.js";
|
|
2
|
+
export { e as TaxonomySelector };
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { taxonomyDefaultValues as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
m as useTaxonomySelect
|
|
19
|
-
};
|
|
1
|
+
import { taxonomyDefaultValues as e } from "./taxonomy-default-values.js";
|
|
2
|
+
var t = (t) => ({ onTaxonomySelect: (n) => {
|
|
3
|
+
let r = t.values.taxonomy.availableTaxonomies.find((e) => e.id === n.id);
|
|
4
|
+
t.setFieldValue("taxonomy", {
|
|
5
|
+
...e.taxonomy,
|
|
6
|
+
availableTaxonomies: t.values.taxonomy.availableTaxonomies.map((e) => ({
|
|
7
|
+
...e,
|
|
8
|
+
selected: e.id === n.id
|
|
9
|
+
})),
|
|
10
|
+
selectedLevels: r?.levels[0] ? [r.levels[0].level] : [],
|
|
11
|
+
taxonomyKey: r?.taxonomyKey ?? "",
|
|
12
|
+
namespace: r?.namespace ?? ""
|
|
13
|
+
});
|
|
14
|
+
} });
|
|
15
|
+
export { t as useTaxonomySelect };
|
package/dist/esm/lib/components/metadata-field-configurator/context/field-configurator-context.js
CHANGED
|
@@ -1,68 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import i from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return s;
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as t, useCallback as n, useContext as r, useMemo as i, useState as a } from "react";
|
|
3
|
+
import o from "lodash/cloneDeep";
|
|
4
|
+
import s from "lodash/set";
|
|
5
|
+
var c = /* @__PURE__ */ t(null);
|
|
6
|
+
function l() {
|
|
7
|
+
let e = r(c);
|
|
8
|
+
if (!e) throw Error("useFieldConfigurator must be used within a FieldConfiguratorContext provider");
|
|
9
|
+
return e;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
V as FieldConfiguratorContext,
|
|
66
|
-
z as FieldConfiguratorProvider,
|
|
67
|
-
q as useFieldConfigurator
|
|
11
|
+
var u = ({ initialValues: t, initialErrors: r = {}, initialTouched: l = {}, children: u }) => {
|
|
12
|
+
let [d, f] = a(t), [p] = a(r), [m, h] = a(l), g = n((e, t) => {
|
|
13
|
+
f((n) => ({
|
|
14
|
+
...n,
|
|
15
|
+
[e]: t
|
|
16
|
+
}));
|
|
17
|
+
}, []), _ = n((e) => f(e), []), v = n((e, t = !0) => {
|
|
18
|
+
h((n) => {
|
|
19
|
+
let r = o(n);
|
|
20
|
+
return s(r, e, t), r;
|
|
21
|
+
});
|
|
22
|
+
}, []), y = n((e) => h(e), []), b = n((e) => {
|
|
23
|
+
let { name: t, value: n } = e.target;
|
|
24
|
+
f((e) => {
|
|
25
|
+
let r = o(e);
|
|
26
|
+
return s(r, t, n), r;
|
|
27
|
+
});
|
|
28
|
+
}, []), x = n((e) => {
|
|
29
|
+
let t = e.target;
|
|
30
|
+
t.name && h((e) => {
|
|
31
|
+
let n = o(e);
|
|
32
|
+
return s(n, t.name, !0), n;
|
|
33
|
+
});
|
|
34
|
+
}, []), S = i(() => ({
|
|
35
|
+
values: d,
|
|
36
|
+
errors: p,
|
|
37
|
+
touched: m,
|
|
38
|
+
isValid: !0,
|
|
39
|
+
setFieldValue: g,
|
|
40
|
+
setValues: _,
|
|
41
|
+
setFieldTouched: v,
|
|
42
|
+
setTouched: y,
|
|
43
|
+
handleChange: b,
|
|
44
|
+
handleBlur: x,
|
|
45
|
+
validateForm: async () => {}
|
|
46
|
+
}), [
|
|
47
|
+
d,
|
|
48
|
+
p,
|
|
49
|
+
m,
|
|
50
|
+
g,
|
|
51
|
+
_,
|
|
52
|
+
v,
|
|
53
|
+
y,
|
|
54
|
+
b,
|
|
55
|
+
x
|
|
56
|
+
]);
|
|
57
|
+
return /* @__PURE__ */ e(c.Provider, {
|
|
58
|
+
value: S,
|
|
59
|
+
children: u
|
|
60
|
+
});
|
|
68
61
|
};
|
|
62
|
+
export { c as FieldConfiguratorContext, u as FieldConfiguratorProvider, l as useFieldConfigurator };
|
package/dist/esm/lib/components/metadata-field-configurator/context/field-extensions-context.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
var n = /* @__PURE__ */ e([]);
|
|
3
|
+
function r() {
|
|
4
|
+
return t(n);
|
|
5
5
|
}
|
|
6
|
-
export {
|
|
7
|
-
n as FieldExtensionsContext,
|
|
8
|
-
s as useFieldExtensions
|
|
9
|
-
};
|
|
6
|
+
export { n as FieldExtensionsContext, r as useFieldExtensions };
|
package/dist/esm/lib/components/metadata-field-configurator/context/taxonomy-options-context.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}, s = /* @__PURE__ */ o(e);
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
var n = /* @__PURE__ */ e({
|
|
3
|
+
options: [],
|
|
4
|
+
status: "success",
|
|
5
|
+
onSelectorOpen: () => {}
|
|
6
|
+
});
|
|
8
7
|
function r() {
|
|
9
|
-
|
|
8
|
+
return t(n);
|
|
10
9
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
10
|
+
function i(e) {
|
|
11
|
+
return {
|
|
12
|
+
options: e,
|
|
13
|
+
status: "success",
|
|
14
|
+
onSelectorOpen: () => {}
|
|
15
|
+
};
|
|
18
16
|
}
|
|
19
|
-
export {
|
|
20
|
-
s as TaxonomyOptionsContext,
|
|
21
|
-
u as createStaticTaxonomyContext,
|
|
22
|
-
r as useTaxonomyOptions
|
|
23
|
-
};
|
|
17
|
+
export { n as TaxonomyOptionsContext, i as createStaticTaxonomyContext, r as useTaxonomyOptions };
|