@box/metadata-template-editor 1.20.9 → 1.20.11
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/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.js
CHANGED
|
@@ -1,90 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
taxonomy: {
|
|
70
|
-
availableTaxonomies: [],
|
|
71
|
-
// Default to an empty array
|
|
72
|
-
allowMultipleSelections: l.optionsRules?.multiSelect || !1,
|
|
73
|
-
selection: l.optionsRules?.selectableLevels?.length === 1 ? s.RequireSpecific : s.AllowAny,
|
|
74
|
-
selectedLevels: l.optionsRules.selectableLevels,
|
|
75
|
-
// Default to null unless specified
|
|
76
|
-
taxonomySearchValue: "",
|
|
77
|
-
// Default to an empty string
|
|
78
|
-
taxonomyKey: l.taxonomyKey || "",
|
|
79
|
-
// Default to an empty string
|
|
80
|
-
namespace: l.namespace || ""
|
|
81
|
-
// Default to an empty string
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
default:
|
|
85
|
-
throw new Error(`Unsupported field type: ${a}`);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
export {
|
|
89
|
-
S as convertApiMetadataTemplateFieldToLocalConfiguratorField
|
|
1
|
+
import { a as e, c as t, n } from "../../../../chunks/types.js";
|
|
2
|
+
import r from "lodash/uniqueId";
|
|
3
|
+
var i = (i, a = !1) => {
|
|
4
|
+
let { key: o, displayName: s, description: c, type: l, isHidden: u } = i, d = {
|
|
5
|
+
key: o,
|
|
6
|
+
name: s,
|
|
7
|
+
id: r(),
|
|
8
|
+
description: c || "",
|
|
9
|
+
hidden: u,
|
|
10
|
+
dropdown: {
|
|
11
|
+
allowMultipleSelections: !1,
|
|
12
|
+
options: [],
|
|
13
|
+
isAllowMultipleSelectionsEnabled: !1
|
|
14
|
+
},
|
|
15
|
+
taxonomy: {
|
|
16
|
+
availableTaxonomies: [],
|
|
17
|
+
allowMultipleSelections: !1,
|
|
18
|
+
selection: t.RequireSpecific,
|
|
19
|
+
selectedLevels: [],
|
|
20
|
+
taxonomySearchValue: "",
|
|
21
|
+
taxonomyKey: "",
|
|
22
|
+
namespace: ""
|
|
23
|
+
},
|
|
24
|
+
isFieldNew: !1,
|
|
25
|
+
isFieldReadOnly: a
|
|
26
|
+
};
|
|
27
|
+
switch (l) {
|
|
28
|
+
case n.String: return {
|
|
29
|
+
...d,
|
|
30
|
+
type: e.Text
|
|
31
|
+
};
|
|
32
|
+
case n.Float: return {
|
|
33
|
+
...d,
|
|
34
|
+
type: e.Number
|
|
35
|
+
};
|
|
36
|
+
case n.Date: return {
|
|
37
|
+
...d,
|
|
38
|
+
type: e.Date
|
|
39
|
+
};
|
|
40
|
+
case n.Enum:
|
|
41
|
+
case n.MultiSelect: return {
|
|
42
|
+
...d,
|
|
43
|
+
type: e.Dropdown,
|
|
44
|
+
dropdown: {
|
|
45
|
+
options: i.options?.map((e) => ({
|
|
46
|
+
id: r(),
|
|
47
|
+
key: e.key,
|
|
48
|
+
isNew: !1
|
|
49
|
+
})) || [],
|
|
50
|
+
allowMultipleSelections: l === n.MultiSelect,
|
|
51
|
+
isAllowMultipleSelectionsEnabled: l === n.MultiSelect
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
case n.Taxonomy: return {
|
|
55
|
+
...d,
|
|
56
|
+
type: e.Taxonomy,
|
|
57
|
+
taxonomy: {
|
|
58
|
+
availableTaxonomies: [],
|
|
59
|
+
allowMultipleSelections: i.optionsRules?.multiSelect || !1,
|
|
60
|
+
selection: i.optionsRules?.selectableLevels?.length === 1 ? t.RequireSpecific : t.AllowAny,
|
|
61
|
+
selectedLevels: i.optionsRules.selectableLevels,
|
|
62
|
+
taxonomySearchValue: "",
|
|
63
|
+
taxonomyKey: i.taxonomyKey || "",
|
|
64
|
+
namespace: i.namespace || ""
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
default: throw Error(`Unsupported field type: ${l}`);
|
|
68
|
+
}
|
|
90
69
|
};
|
|
70
|
+
export { i as convertApiMetadataTemplateFieldToLocalConfiguratorField };
|
|
@@ -1,179 +1,160 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { generateKey as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { a as e, l as t, n, t as r } from "../../../../chunks/types.js";
|
|
2
|
+
import "../constants.js";
|
|
3
|
+
import { generateKey as i } from "../key-generation.js";
|
|
4
|
+
import { resolveSelectableLevels as a } from "./convertLocalConfiguratorToTemplateField.js";
|
|
5
|
+
import o from "lodash/isEqual";
|
|
6
|
+
var s = {
|
|
7
|
+
[e.Text]: n.String,
|
|
8
|
+
[e.Date]: n.Date,
|
|
9
|
+
[e.Number]: n.Float
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
function c(e, t) {
|
|
12
|
+
let n = [], i = {};
|
|
13
|
+
return e.displayName !== t.displayName && (i.displayName = t.displayName), e.hidden !== t.hidden && (i.hidden = t.hidden), Object.keys(i).length > 0 && n.push({
|
|
14
|
+
op: r.EditTemplate,
|
|
15
|
+
data: i
|
|
16
|
+
}), n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
function l(e, t, n) {
|
|
19
|
+
if (e.description !== t.description || e.name !== t.name || e.hidden !== t.hidden) {
|
|
20
|
+
let i = {};
|
|
21
|
+
e.name !== t.name && (i.displayName = e.name), e.description !== t.description && (i.description = e.description), e.hidden !== t.hidden && (i.hidden = e.hidden), n.push({
|
|
22
|
+
op: r.EditField,
|
|
23
|
+
fieldKey: e.key,
|
|
24
|
+
data: i
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
...t ? {
|
|
79
|
-
op: s.ReorderMultiSelectOptions,
|
|
80
|
-
multiSelectOptionKeys: d
|
|
81
|
-
} : {
|
|
82
|
-
op: s.ReorderEnumOptions,
|
|
83
|
-
enumOptionKeys: d
|
|
84
|
-
}
|
|
85
|
-
});
|
|
28
|
+
function u(t, n, i) {
|
|
29
|
+
if (t.type !== e.Dropdown || n?.type !== e.Dropdown) return;
|
|
30
|
+
let a = t.dropdown.allowMultipleSelections, s = n.dropdown.options, c = t.dropdown.options, l = new Map(s.map((e) => [e.id, e])), u = new Map(c.map((e) => [e.id, e]));
|
|
31
|
+
s.forEach((e) => {
|
|
32
|
+
if (!u.has(e.id) && t.key) {
|
|
33
|
+
if (!e.key) throw Error("optionKey is required");
|
|
34
|
+
i.push({
|
|
35
|
+
fieldKey: t.key,
|
|
36
|
+
...a ? {
|
|
37
|
+
op: r.RemoveMultiSelectOption,
|
|
38
|
+
multiSelectOptionKey: e.key
|
|
39
|
+
} : {
|
|
40
|
+
op: r.RemoveEnumOption,
|
|
41
|
+
enumOptionKey: e.key
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}), c.forEach((e) => {
|
|
46
|
+
let n = l.get(e.id);
|
|
47
|
+
if (!n) i.push({
|
|
48
|
+
op: a ? r.AddMultiSelectOption : r.AddEnumOption,
|
|
49
|
+
fieldKey: t.key,
|
|
50
|
+
data: { key: e.key }
|
|
51
|
+
});
|
|
52
|
+
else if (n.key !== e.key) {
|
|
53
|
+
if (!e.key) throw Error("optionKey is required");
|
|
54
|
+
i.push({
|
|
55
|
+
fieldKey: t.key,
|
|
56
|
+
...a ? {
|
|
57
|
+
op: r.EditMultiSelectOption,
|
|
58
|
+
multiSelectOptionKey: n.key
|
|
59
|
+
} : {
|
|
60
|
+
op: r.EditEnumOption,
|
|
61
|
+
enumOptionKey: n.key
|
|
62
|
+
},
|
|
63
|
+
data: { key: e.key }
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
let d = s.map((e) => e.key), f = c.map((e) => e.key);
|
|
68
|
+
o(d, f) || i.push({
|
|
69
|
+
fieldKey: t.key,
|
|
70
|
+
...a ? {
|
|
71
|
+
op: r.ReorderMultiSelectOptions,
|
|
72
|
+
multiSelectOptionKeys: f
|
|
73
|
+
} : {
|
|
74
|
+
op: r.ReorderEnumOptions,
|
|
75
|
+
enumOptionKeys: f
|
|
76
|
+
}
|
|
77
|
+
});
|
|
86
78
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
type: f[e.type]
|
|
112
|
-
};
|
|
79
|
+
function d(t, r) {
|
|
80
|
+
let i = {
|
|
81
|
+
displayName: t.name,
|
|
82
|
+
isHidden: t.hidden,
|
|
83
|
+
key: r,
|
|
84
|
+
description: t.description
|
|
85
|
+
};
|
|
86
|
+
return t.type === e.Taxonomy ? {
|
|
87
|
+
...i,
|
|
88
|
+
type: n.Taxonomy,
|
|
89
|
+
taxonomyKey: t.taxonomy.taxonomyKey,
|
|
90
|
+
optionsRules: {
|
|
91
|
+
selectableLevels: a(t),
|
|
92
|
+
multiSelect: t.taxonomy.allowMultipleSelections
|
|
93
|
+
},
|
|
94
|
+
namespace: t.taxonomy.namespace
|
|
95
|
+
} : t.type === e.Dropdown ? {
|
|
96
|
+
...i,
|
|
97
|
+
type: t.dropdown.allowMultipleSelections ? n.MultiSelect : n.Enum,
|
|
98
|
+
options: t.dropdown.options.map((e) => ({ key: e.key }))
|
|
99
|
+
} : {
|
|
100
|
+
...i,
|
|
101
|
+
type: s[t.type]
|
|
102
|
+
};
|
|
113
103
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
104
|
+
function f(e, t, n) {
|
|
105
|
+
let a = i({
|
|
106
|
+
displayName: e.name,
|
|
107
|
+
existingKeys: Array.from(t),
|
|
108
|
+
defaultKey: "field",
|
|
109
|
+
maxKeyLength: 256
|
|
110
|
+
});
|
|
111
|
+
return t.add(a), n.push({
|
|
112
|
+
op: r.AddField,
|
|
113
|
+
fieldKey: a,
|
|
114
|
+
data: d(e, a)
|
|
115
|
+
}), {
|
|
116
|
+
...e,
|
|
117
|
+
key: a
|
|
118
|
+
};
|
|
129
119
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
120
|
+
function p(e, t) {
|
|
121
|
+
let n = new Map(e.map((e) => [e.key, e])), i = new Set(t.filter((e) => e.key).map((e) => e.key)), a = [], o = new Set(t.filter((e) => e.key).map((e) => e.key));
|
|
122
|
+
e.forEach((e) => {
|
|
123
|
+
o.has(e.key) || a.push({
|
|
124
|
+
op: r.RemoveField,
|
|
125
|
+
fieldKey: e.key
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
let s = [], c = [];
|
|
129
|
+
return t.forEach((e) => {
|
|
130
|
+
let t = n.get(e.key);
|
|
131
|
+
if (!t) {
|
|
132
|
+
c.push(f(e, i, s));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
c.push(e), l(e, t, s), u(e, t, s);
|
|
136
|
+
}), {
|
|
137
|
+
patchItems: [...a, ...s],
|
|
138
|
+
resolvedFields: c
|
|
139
|
+
};
|
|
150
140
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
141
|
+
function m(e, t) {
|
|
142
|
+
let n = e.map((e) => e.key).filter(Boolean), i = t.map((e) => e.key).filter(Boolean);
|
|
143
|
+
return n.length !== i.length || n.some((e, t) => e !== i[t]) ? [{
|
|
144
|
+
op: r.ReorderFields,
|
|
145
|
+
fieldKeys: i
|
|
146
|
+
}] : [];
|
|
157
147
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
resolvedFields: p
|
|
164
|
-
} = F(e.fields || [], n.fields || []);
|
|
165
|
-
return o.push(...t), o.push(...A(e.fields || [], p)), o;
|
|
148
|
+
function h(e, t) {
|
|
149
|
+
let n = [];
|
|
150
|
+
n.push(...c(e, t));
|
|
151
|
+
let { patchItems: r, resolvedFields: i } = p(e.fields || [], t.fields || []);
|
|
152
|
+
return n.push(...r), n.push(...m(e.fields || [], i)), n;
|
|
166
153
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
}];
|
|
154
|
+
function g(e) {
|
|
155
|
+
return [{
|
|
156
|
+
op: t.EditTemplate,
|
|
157
|
+
data: { displayName: e }
|
|
158
|
+
}];
|
|
174
159
|
}
|
|
175
|
-
export {
|
|
176
|
-
f as configuratorFieldTypeToMetadataFieldTypeMap,
|
|
177
|
-
L as generateJSONPatchTemplateOperationToUpdateTemplateName,
|
|
178
|
-
b as generateJSONPatchTemplateOperations
|
|
179
|
-
};
|
|
160
|
+
export { s as configuratorFieldTypeToMetadataFieldTypeMap, g as generateJSONPatchTemplateOperationToUpdateTemplateName, h as generateJSONPatchTemplateOperations };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { convertLocalConfiguratorToTemplateField as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} = d(r, e);
|
|
9
|
-
return e = n, o;
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
a as mapFieldsWithUniqueKeys
|
|
1
|
+
import { convertLocalConfiguratorToTemplateField as e } from "./convertLocalConfiguratorToTemplateField.js";
|
|
2
|
+
var t = (t) => {
|
|
3
|
+
let n = [];
|
|
4
|
+
return t.map((t) => {
|
|
5
|
+
let { field: r, updatedKeys: i } = e(t, n);
|
|
6
|
+
return n = i, r;
|
|
7
|
+
});
|
|
14
8
|
};
|
|
9
|
+
export { t as mapFieldsWithUniqueKeys };
|
package/dist/styles/chip.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._chip_x2zx9_1{
|
|
1
|
+
._chip_x2zx9_1{padding:var(--space-1) var(--space-3);color:var(--text-text-on-light);font-weight:var(--body-default-font-weight);font-size:var(--body-default-font-size);line-height:var(--title-small-line-height);background-color:var(--surface-inputchip-surface);border-radius:var(--radius-half);-webkit-user-select:none;user-select:none;display:inline-block}._chip_x2zx9_1._selected_x2zx9_12{color:var(--text-text-on-dark);background-color:var(--surface-surface-brand)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._dropdownFieldConfiguration_rjv8w_1{
|
|
1
|
+
._dropdownFieldConfiguration_rjv8w_1{gap:var(--space-4);flex-direction:column;display:flex}._addOptionButton_rjv8w_7{align-self:flex-start}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._contextMenuTrigger_102vn_1 svg{pointer-events:none}._menuItem_102vn_5{
|
|
1
|
+
._contextMenuTrigger_102vn_1 svg{pointer-events:none}._menuItem_102vn_5{gap:var(--space-4);align-items:center;display:flex}._contextMenu_102vn_1{min-width:270px}._contextMenu_102vn_1 ._divider_102vn_14{margin:var(--space-2) 0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._levelsChain_1wuki_1{
|
|
1
|
+
._levelsChain_1wuki_1{white-space:nowrap;align-items:center;gap:11px;width:100%;margin:0;padding:0;display:flex;overflow:hidden}._levelsChain_1wuki_1 ._hiddenLevelsButton_1wuki_11{all:unset}._levelsChain_1wuki_1 li{align-items:center;gap:8px;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._fieldset_1bz4h_1{
|
|
1
|
+
._fieldset_1bz4h_1{border:0;margin:0;padding:0}._toolbarActions_1bz4h_7{align-items:center;gap:var(--space-2);display:flex}._extensionTabsContainer_1bz4h_13{height:auto;padding-right:var(--space-2);margin-right:var(--space-1);border-right:1px solid var(--border-border-on-light);overflow:visible}._extensionContent_1bz4h_21{padding:var(--space-4) 0}._fieldAccordionItem_1bz4h_25{max-width:650px}._expandedToolbarActions_1bz4h_29{align-items:center;gap:var(--space-1);display:flex}._fieldAccordionItem_1bz4h_25[data-state=closed]{border:2px solid #0000}._fieldAccordionItem_1bz4h_25[data-state=closed] ._expandedToolbarActions_1bz4h_29{display:none}._fieldAccordionItem_1bz4h_25[data-state=closed] ._dragHandle_1bz4h_41{cursor:grab;padding:var(--space-2);visibility:hidden;justify-content:center;align-items:center;display:flex}._fieldAccordionItem_1bz4h_25[data-state=closed] ._dragHandle_1bz4h_41:active{cursor:grabbing}._fieldAccordionItem_1bz4h_25[data-state=closed]:hover ._dragHandle_1bz4h_41{visibility:visible}._fieldAccordionItem_1bz4h_25[data-state=open]{background-color:var(--box-blue-02);border:2px solid var(--box-blue-100)}._fieldAccordionItem_1bz4h_25[data-state=open]:first-child{border-top-left-radius:1.4rem!important;border-top-right-radius:1.4rem!important}._errorIcon_1bz4h_65{color:var(--color-red-100);align-items:center;display:flex}._validationErrors_1bz4h_71{margin-block-start:var(--space-2)}._expandedContent_1bz4h_75{gap:var(--space-4);flex-direction:column;display:flex}._basic_1bz4h_81{gap:var(--space-4);grid-template-columns:3fr 2fr;display:grid}._basic_1bz4h_81 ._fieldTypeSelect_1bz4h_86{min-width:145px}._typeSpecific_1bz4h_90{margin-top:var(--space-2);gap:var(--space-4);flex-direction:column;display:flex}._description_1bz4h_97{gap:var(--space-4);flex-direction:column;display:flex}._description_1bz4h_97 ._labelWithTooltip_1bz4h_102{color:var(--text-text-on-light);font-weight:var(--label-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--label-bold-font-family);line-height:var(--label-bold-line-height);letter-spacing:var(--label-bold-letter-spacing);margin-block-end:var(--space-2);display:inline-block}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._fieldList_18x5c_1{margin:0;padding:0;list-style:none;display:flex
|
|
1
|
+
._fieldList_18x5c_1{gap:var(--space-2);flex-direction:column;max-width:650px;margin:0;padding:0;list-style:none;display:flex}._fieldItem_18x5c_11._dragging_18x5c_11{opacity:0}._accordionRootContainer_18x5c_15>*{padding:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._form_8cb30_1{
|
|
1
|
+
._form_8cb30_1{gap:var(--space-4);flex-direction:column;max-width:620px;display:flex}._loading_8cb30_8{padding:var(--space-8) 0;justify-content:center;align-items:center;display:flex}._fields_8cb30_15{gap:var(--space-4);flex-direction:column;display:flex}._actions_8cb30_21{justify-content:flex-end;gap:var(--space-3);padding-top:var(--space-2);display:flex}._fieldsHeader_8cb30_28{align-items:center;gap:var(--space-2);justify-content:space-between;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._modal_q1b7q_1{min-width:620px;min-height:620px;max-height:620px}._centeredBody_q1b7q_7{
|
|
1
|
+
._modal_q1b7q_1{min-width:620px;min-height:620px;max-height:620px}._centeredBody_q1b7q_7{flex-direction:column;justify-content:center;align-items:center;height:100%;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._form_1o2vk_1{
|
|
1
|
+
._form_1o2vk_1{gap:var(--space-4);flex-direction:column;max-width:620px;display:flex}._loading_1o2vk_8{padding:var(--space-8) 0;justify-content:center;align-items:center;display:flex}._error_1o2vk_15{align-items:center;gap:var(--space-4);padding:var(--space-8) 0;text-align:center;flex-direction:column;display:flex}._fields_1o2vk_24{gap:var(--space-4);flex-direction:column;display:flex}._addField_1o2vk_30{align-self:flex-start}._actions_1o2vk_34{justify-content:flex-end;gap:var(--space-2);padding-top:var(--space-2);display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._sortableOptionList_1cieq_1{margin:0;padding:0;
|
|
1
|
+
._sortableOptionList_1cieq_1{max-height:190px;margin:0;padding:0;list-style:none;overflow:auto}._option_1cieq_9._editable_1cieq_9{gap:var(--space-05);grid-template-rows:auto auto;grid-template-columns:auto 1fr auto;align-items:start;display:grid}._option_1cieq_9 svg{pointer-events:none}._option_1cieq_9:not(:last-child){margin-bottom:var(--space-2)}._option_1cieq_9._dragging_1cieq_22{opacity:0}._dragHandle_1cieq_26{width:20px;padding:var(--space-3) 0;cursor:grab;touch-action:none;grid-area:1/1;justify-content:center;align-items:center;display:flex}._dragHandle_1cieq_26:active{cursor:grabbing}._inputContainer_1cieq_41{grid-area:1/2}._input_1cieq_41+span{margin-top:var(--space-1);grid-area:2/2}._deleteButtonContainer_1cieq_52{padding:var(--space-2) 0;grid-area:1/3}._optionDragOverlay_1cieq_58{background-color:var(--surface-surface-on-light);border-radius:var(--border-radius-small)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._taxonomyFieldConfiguration_ylhrs_1{
|
|
1
|
+
._taxonomyFieldConfiguration_ylhrs_1{gap:var(--space-4);grid-template-rows:auto;grid-template-columns:1fr;display:grid}._responsePlaceholder_ylhrs_8{padding:var(--space-4);justify-content:center;align-items:center;display:flex}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._taxonomyFieldConfiguratorInitialState_il5v7_1{
|
|
1
|
+
._taxonomyFieldConfiguratorInitialState_il5v7_1{gap:var(--space-4);width:350px;padding:var(--space-3) 0;flex-direction:column;align-items:center;margin:0 auto;display:flex}._taxonomyFieldConfiguratorInitialState_il5v7_1 ._subheader_il5v7_10{text-align:center}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._taxonomySelectorLabel_b3aww_1{
|
|
1
|
+
._taxonomySelectorLabel_b3aww_1{padding:var(--space-2) var(--space-3);display:block}._taxonomySelectorSeparator_b3aww_6{background:var(--border-card-border);border:none;height:1px;margin:0;padding:0}._listWrapper_b3aww_14{max-height:200px;overflow-y:auto}._listWrapperWithPadding_b3aww_19{padding:var(--space-2);min-width:150px}._taxonomyItem_b3aww_24{text-align:left;justify-content:flex-start;width:100%}._statusContainer_b3aww_30{justify-content:center;align-items:center;gap:var(--space-2);flex-direction:column;min-width:190px;min-height:80px;display:flex}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-template-editor",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.11",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^14.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.112.
|
|
6
|
+
"@box/blueprint-web": "^14.7.0",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.112.3",
|
|
8
8
|
"@dnd-kit/core": "^6.1.0",
|
|
9
9
|
"@dnd-kit/sortable": "^8.0.0",
|
|
10
10
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"yup": "^1.6.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@box/blueprint-web": "^14.
|
|
21
|
-
"@box/blueprint-web-assets": "^4.112.
|
|
20
|
+
"@box/blueprint-web": "^14.7.0",
|
|
21
|
+
"@box/blueprint-web-assets": "^4.112.3",
|
|
22
22
|
"@box/eslint-plugin-blueprint": "1.1.12",
|
|
23
|
-
"@box/storybook-utils": "0.17.
|
|
23
|
+
"@box/storybook-utils": "0.17.30",
|
|
24
24
|
"@dnd-kit/core": "^6.1.0",
|
|
25
25
|
"@dnd-kit/sortable": "^8.0.0",
|
|
26
26
|
"@dnd-kit/utilities": "^3.2.2",
|