@box/metadata-template-editor 2.1.12 → 2.2.0
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/dropdown-field-configuration.js +1 -1
- package/dist/chunks/metadata-field-list.js +158 -132
- package/dist/chunks/metadata-template-editor-form.js +98 -74
- package/dist/chunks/metadata-template-editor-modal.js +71 -58
- package/dist/chunks/metadata-template-editor.js +41 -40
- package/dist/chunks/types.js +1 -1
- package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +9 -9
- package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +33 -35
- package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +61 -53
- package/dist/esm/lib/messages.js +12 -0
- package/dist/styles/metadata-template-editor-form.css +1 -1
- package/dist/styles/metadata-template-editor-modal.css +1 -1
- package/dist/types/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.d.ts +6 -1
- package/dist/types/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.d.ts +7 -1
- package/dist/types/lib/components/metadata-field-configurator/metadata-field-configurator.d.ts +7 -1
- package/dist/types/lib/components/metadata-field-list/metadata-field-list.d.ts +6 -0
- package/dist/types/lib/components/metadata-template-editor-form/metadata-template-editor-form.d.ts +11 -2
- package/dist/types/lib/messages.d.ts +15 -0
- package/dist/types/lib/metadata-template-editor.d.ts +18 -1
- package/dist/types/lib/types.d.ts +3 -2
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ import '../styles/dropdown-field-configuration.css';var p = {
|
|
|
40
40
|
shouldFocusLastOption: y,
|
|
41
41
|
onFocusConsumed: D
|
|
42
42
|
}),
|
|
43
|
-
/* @__PURE__ */ s(a, {
|
|
43
|
+
!h.isFieldReadOnly && /* @__PURE__ */ s(a, {
|
|
44
44
|
className: p.addOptionButton,
|
|
45
45
|
onClick: E,
|
|
46
46
|
children: m(t.addOption)
|
|
@@ -16,18 +16,18 @@ import x from "clsx";
|
|
|
16
16
|
import te from "lodash/cloneDeep";
|
|
17
17
|
import S from "lodash/uniqueId";
|
|
18
18
|
import { DndContext as ne, DragOverlay as re, KeyboardSensor as C, PointerSensor as ie, TouchSensor as ae, closestCenter as oe, useSensor as w, useSensors as se } from "@dnd-kit/core";
|
|
19
|
-
import { SortableContext as ce, arrayMove as T, sortableKeyboardCoordinates as le, useSortable as E, verticalListSortingStrategy as
|
|
20
|
-
import { CSS as
|
|
21
|
-
import '../styles/metadata-field-list.css';var
|
|
19
|
+
import { SortableContext as ce, arrayMove as T, sortableKeyboardCoordinates as le, useSortable as E, verticalListSortingStrategy as ue } from "@dnd-kit/sortable";
|
|
20
|
+
import { CSS as D } from "@dnd-kit/utilities";
|
|
21
|
+
import '../styles/metadata-field-list.css';var O = {
|
|
22
22
|
fieldList: "_fieldList_18x5c_1",
|
|
23
23
|
fieldItem: "_fieldItem_18x5c_11",
|
|
24
24
|
dragging: "_dragging_18x5c_11",
|
|
25
25
|
accordionRootContainer: "_accordionRootContainer_18x5c_15"
|
|
26
|
-
},
|
|
27
|
-
function
|
|
26
|
+
}, de = 150;
|
|
27
|
+
function k(e) {
|
|
28
28
|
return e.id;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var A = 150, fe = class extends C {
|
|
31
31
|
static activators = [{
|
|
32
32
|
eventName: "onKeyDown",
|
|
33
33
|
handler: (e, t, n) => {
|
|
@@ -42,16 +42,16 @@ var j = 150, de = class extends C {
|
|
|
42
42
|
}
|
|
43
43
|
}];
|
|
44
44
|
};
|
|
45
|
-
function
|
|
46
|
-
let d =
|
|
45
|
+
function pe({ field: e, index: t, maxIndex: n, isExpanded: r, onChangeField: i, onDeleteAtIndex: a, onDuplicateAtIndex: o, onReorderFields: s, onRequestExpand: c, submitAttemptCount: u }) {
|
|
46
|
+
let d = k(e), { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } = E({ id: d });
|
|
47
47
|
return /* @__PURE__ */ f("li", {
|
|
48
48
|
ref: h,
|
|
49
49
|
style: {
|
|
50
|
-
transform:
|
|
50
|
+
transform: D.Translate.toString(g),
|
|
51
51
|
transition: _
|
|
52
52
|
},
|
|
53
53
|
"data-field-id": d,
|
|
54
|
-
className: x(
|
|
54
|
+
className: x(O.fieldItem, { [O.dragging]: v }),
|
|
55
55
|
children: /* @__PURE__ */ f(l, {
|
|
56
56
|
values: e,
|
|
57
57
|
onValuesChange: i,
|
|
@@ -72,183 +72,209 @@ function fe({ field: e, index: t, maxIndex: n, isExpanded: r, onChangeField: i,
|
|
|
72
72
|
})
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
var
|
|
76
|
-
let { formatMessage:
|
|
75
|
+
var j = /*#__PURE__*/ m(function({ fields: m, onChangeFields: x, onDeleteFieldAtIndex: C, onDuplicateField: E, taxonomyOptions: D, fetchTaxonomies: j, disabledFieldTypes: M, taxonomyInitialStateLabels: N, firstInvalidFieldIndex: P, submitAttemptCount: F, fieldExtensions: I, onValidationChange: L, readOnly: R = !1 }, me) {
|
|
76
|
+
let { formatMessage: he } = d(), z = r(), ge = c(j, D), B = y(null), V = y(null), H = y(new Set(m.map((e) => k(e)))), U = a(), W = y(null);
|
|
77
77
|
g(() => {
|
|
78
|
-
|
|
78
|
+
W.current = null;
|
|
79
79
|
}, [L]), g(() => {
|
|
80
80
|
if (!L) return;
|
|
81
81
|
let e = !1, t = setTimeout(() => {
|
|
82
|
-
ee.array().of(
|
|
83
|
-
e ||
|
|
82
|
+
ee.array().of(U).validate(m, { abortEarly: !0 }).then(() => {
|
|
83
|
+
e || W.current === !0 || (W.current = !0, L(!0));
|
|
84
84
|
}).catch(() => {
|
|
85
|
-
e ||
|
|
85
|
+
e || W.current === !1 || (W.current = !1, L(!1));
|
|
86
86
|
});
|
|
87
|
-
},
|
|
87
|
+
}, de);
|
|
88
88
|
return () => {
|
|
89
89
|
e = !0, clearTimeout(t);
|
|
90
90
|
};
|
|
91
91
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
m,
|
|
93
|
+
U,
|
|
94
94
|
L
|
|
95
95
|
]);
|
|
96
|
-
let [
|
|
97
|
-
let e =
|
|
98
|
-
return e ?
|
|
96
|
+
let [G, K] = b(() => {
|
|
97
|
+
let e = m.find((e) => e.isFieldNew);
|
|
98
|
+
return e ? k(e) : null;
|
|
99
99
|
});
|
|
100
|
-
_(
|
|
101
|
-
|
|
102
|
-
(
|
|
100
|
+
_(me, () => ({ scrollToAndExpand(e) {
|
|
101
|
+
V.current = e, G === e ? (V.current = null, setTimeout(() => {
|
|
102
|
+
(B.current?.querySelector(`[data-field-id="${e}"]`))?.scrollIntoView({
|
|
103
103
|
behavior: "smooth",
|
|
104
104
|
block: "nearest"
|
|
105
105
|
});
|
|
106
|
-
}, 0)) :
|
|
107
|
-
} }), [
|
|
108
|
-
|
|
109
|
-
let t =
|
|
110
|
-
|
|
106
|
+
}, 0)) : K(e);
|
|
107
|
+
} }), [G]), g(() => {
|
|
108
|
+
m.forEach((e) => {
|
|
109
|
+
let t = k(e);
|
|
110
|
+
H.current.has(t) || (H.current.add(t), V.current = t, K(t));
|
|
111
111
|
});
|
|
112
|
-
}, [
|
|
112
|
+
}, [m]), g(() => {
|
|
113
113
|
if (P == null || !F) return;
|
|
114
|
-
let e =
|
|
114
|
+
let e = m[P];
|
|
115
115
|
if (!e) return;
|
|
116
|
-
let t =
|
|
117
|
-
|
|
118
|
-
(
|
|
116
|
+
let t = k(e);
|
|
117
|
+
K(t), requestAnimationFrame(() => {
|
|
118
|
+
(B.current?.querySelector(`[data-field-id="${t}"]`))?.scrollIntoView({
|
|
119
119
|
behavior: "smooth",
|
|
120
120
|
block: "nearest"
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
}, [F]), g(() => {
|
|
124
|
-
let e =
|
|
125
|
-
if (!e || e !==
|
|
126
|
-
|
|
124
|
+
let e = V.current;
|
|
125
|
+
if (!e || e !== G) return;
|
|
126
|
+
V.current = null;
|
|
127
127
|
let t = setTimeout(() => {
|
|
128
|
-
(
|
|
128
|
+
(B.current?.querySelector(`[data-field-id="${e}"]`))?.scrollIntoView({
|
|
129
129
|
behavior: "smooth",
|
|
130
130
|
block: "nearest"
|
|
131
131
|
});
|
|
132
|
-
},
|
|
132
|
+
}, A);
|
|
133
133
|
return () => clearTimeout(t);
|
|
134
|
-
}, [
|
|
135
|
-
let [
|
|
134
|
+
}, [G]);
|
|
135
|
+
let [q, J] = b(null), _e = se(w(ie, { activationConstraint: { distance: 8 } }), w(ae, { activationConstraint: {
|
|
136
136
|
delay: 250,
|
|
137
137
|
tolerance: 5
|
|
138
|
-
} }), w(
|
|
139
|
-
|
|
140
|
-
}, []),
|
|
141
|
-
|
|
138
|
+
} }), w(fe, { coordinateGetter: le })), ve = h((e) => {
|
|
139
|
+
J(String(e.active.id));
|
|
140
|
+
}, []), ye = h((e) => {
|
|
141
|
+
J(null);
|
|
142
142
|
let { active: t, over: n } = e;
|
|
143
143
|
if (n && t.id !== n.id) {
|
|
144
|
-
let e =
|
|
145
|
-
e !== -1 && r !== -1 &&
|
|
144
|
+
let e = m.findIndex((e) => k(e) === t.id), r = m.findIndex((e) => k(e) === n.id);
|
|
145
|
+
e !== -1 && r !== -1 && x?.(T(m, e, r));
|
|
146
146
|
}
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
}, []),
|
|
150
|
-
|
|
151
|
-
}, [
|
|
152
|
-
let t =
|
|
153
|
-
|
|
147
|
+
}, [m, x]), be = h(() => {
|
|
148
|
+
J(null);
|
|
149
|
+
}, []), xe = h((e, t) => {
|
|
150
|
+
x?.(m.map((n, r) => r === e ? t : n));
|
|
151
|
+
}, [m, x]), Se = h((e) => {
|
|
152
|
+
let t = m[e], n = k(t);
|
|
153
|
+
K((e) => e === n ? null : e), x?.(m.filter((t, n) => n !== e)), C?.(e, t);
|
|
154
154
|
}, [
|
|
155
|
-
l,
|
|
156
155
|
m,
|
|
157
|
-
x
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
x,
|
|
157
|
+
C
|
|
158
|
+
]), Ce = h((t) => {
|
|
159
|
+
let n = m[t], r = te(n);
|
|
160
160
|
r.id = S("field-"), r.key = "", r.isFieldNew = !0, r.type === e.Dropdown && (r.dropdown.options = r.dropdown.options.map((e) => ({
|
|
161
161
|
...e,
|
|
162
162
|
id: S()
|
|
163
163
|
})));
|
|
164
|
-
let i = [...
|
|
165
|
-
i.splice(t + 1, 0, r),
|
|
164
|
+
let i = [...m];
|
|
165
|
+
i.splice(t + 1, 0, r), x?.(i), E?.(r);
|
|
166
166
|
}, [
|
|
167
|
-
l,
|
|
168
167
|
m,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
x,
|
|
169
|
+
E
|
|
170
|
+
]), we = h((e, t) => {
|
|
171
|
+
t < 0 || t >= m.length || x?.(T(m, e, t));
|
|
172
|
+
}, [m, x]), Y = h((e) => {
|
|
173
173
|
let t = e || null;
|
|
174
|
-
|
|
175
|
-
(
|
|
174
|
+
K(t), t && setTimeout(() => {
|
|
175
|
+
(B.current?.querySelector(`[data-field-id="${t}"]`))?.scrollIntoView({
|
|
176
176
|
behavior: "smooth",
|
|
177
177
|
block: "nearest"
|
|
178
178
|
});
|
|
179
|
-
},
|
|
180
|
-
}, []),
|
|
181
|
-
let n = t.name ||
|
|
179
|
+
}, A);
|
|
180
|
+
}, []), Te = m.map((e) => k(e)), X = q ? m.find((e) => k(e) === q) : null, Z = X ? t(X.type) : null, Ee = X ? ((t) => {
|
|
181
|
+
let n = t.name || he(i.fieldNameInputPlaceholder);
|
|
182
182
|
return t.type === e.Dropdown ? `${n} (${t.dropdown?.options?.length ?? 0})` : n;
|
|
183
|
-
})(
|
|
184
|
-
disabledFieldTypes: M ??
|
|
185
|
-
taxonomyInitialStateLabels: N ??
|
|
183
|
+
})(X) : "", De = v(() => ({
|
|
184
|
+
disabledFieldTypes: M ?? z.disabledFieldTypes,
|
|
185
|
+
taxonomyInitialStateLabels: N ?? z.taxonomyInitialStateLabels
|
|
186
186
|
}), [
|
|
187
187
|
M,
|
|
188
188
|
N,
|
|
189
|
-
|
|
190
|
-
]),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
value: "ghost",
|
|
237
|
-
title: Ce,
|
|
238
|
-
startElement: /* @__PURE__ */ f(Q, {
|
|
239
|
-
fontSize: "20px",
|
|
240
|
-
role: "presentation"
|
|
241
|
-
}),
|
|
242
|
-
children: null
|
|
243
|
-
})
|
|
244
|
-
}) : null
|
|
245
|
-
})]
|
|
189
|
+
z
|
|
190
|
+
]), Oe = R ? /* @__PURE__ */ f("ul", {
|
|
191
|
+
ref: B,
|
|
192
|
+
className: O.fieldList,
|
|
193
|
+
children: m.map((e, t) => {
|
|
194
|
+
let n = k(e);
|
|
195
|
+
return /* @__PURE__ */ f("li", {
|
|
196
|
+
"data-field-id": n,
|
|
197
|
+
className: O.fieldItem,
|
|
198
|
+
children: /* @__PURE__ */ f(l, {
|
|
199
|
+
values: e,
|
|
200
|
+
onValuesChange: () => void 0,
|
|
201
|
+
index: t,
|
|
202
|
+
maxIndex: m.length - 1,
|
|
203
|
+
onDuplicate: () => void 0,
|
|
204
|
+
onReorderFields: () => void 0,
|
|
205
|
+
onDragStart: () => void 0,
|
|
206
|
+
onDragEnd: () => void 0,
|
|
207
|
+
onTouchStart: () => void 0,
|
|
208
|
+
isExpanded: G === n,
|
|
209
|
+
onExpandedChange: (e) => {
|
|
210
|
+
e && K(n);
|
|
211
|
+
},
|
|
212
|
+
readOnly: !0
|
|
213
|
+
})
|
|
214
|
+
}, n);
|
|
215
|
+
})
|
|
216
|
+
}) : /* @__PURE__ */ f(ce, {
|
|
217
|
+
items: Te,
|
|
218
|
+
strategy: ue,
|
|
219
|
+
children: /* @__PURE__ */ f("ul", {
|
|
220
|
+
ref: B,
|
|
221
|
+
className: O.fieldList,
|
|
222
|
+
children: m.map((e, t) => {
|
|
223
|
+
let n = k(e);
|
|
224
|
+
return /* @__PURE__ */ f(pe, {
|
|
225
|
+
field: e,
|
|
226
|
+
index: t,
|
|
227
|
+
maxIndex: m.length - 1,
|
|
228
|
+
isExpanded: G === n,
|
|
229
|
+
onChangeField: (e) => xe(t, e),
|
|
230
|
+
onDeleteAtIndex: Se,
|
|
231
|
+
onDuplicateAtIndex: Ce,
|
|
232
|
+
onReorderFields: we,
|
|
233
|
+
onRequestExpand: () => K(n),
|
|
234
|
+
submitAttemptCount: F
|
|
235
|
+
}, n);
|
|
246
236
|
})
|
|
247
237
|
})
|
|
238
|
+
}), Q = /* @__PURE__ */ f("div", {
|
|
239
|
+
className: O.accordionRootContainer,
|
|
240
|
+
children: /* @__PURE__ */ f(u, {
|
|
241
|
+
type: "single",
|
|
242
|
+
collapsible: !0,
|
|
243
|
+
value: G ?? "",
|
|
244
|
+
onValueChange: Y,
|
|
245
|
+
children: Oe
|
|
246
|
+
})
|
|
247
|
+
}), ke = R ? Q : /* @__PURE__ */ p(ne, {
|
|
248
|
+
sensors: _e,
|
|
249
|
+
collisionDetection: oe,
|
|
250
|
+
onDragStart: ve,
|
|
251
|
+
onDragEnd: ye,
|
|
252
|
+
onDragCancel: be,
|
|
253
|
+
children: [Q, /* @__PURE__ */ f(re, {
|
|
254
|
+
dropAnimation: null,
|
|
255
|
+
children: X && Z ? /* @__PURE__ */ f(u, {
|
|
256
|
+
type: "single",
|
|
257
|
+
children: /* @__PURE__ */ f(u.Item, {
|
|
258
|
+
value: "ghost",
|
|
259
|
+
title: Ee,
|
|
260
|
+
startElement: /* @__PURE__ */ f(Z, {
|
|
261
|
+
fontSize: "20px",
|
|
262
|
+
role: "presentation"
|
|
263
|
+
}),
|
|
264
|
+
children: null
|
|
265
|
+
})
|
|
266
|
+
}) : null
|
|
267
|
+
})]
|
|
268
|
+
}), $ = /* @__PURE__ */ f(n.Provider, {
|
|
269
|
+
value: De,
|
|
270
|
+
children: /* @__PURE__ */ f(o.Provider, {
|
|
271
|
+
value: ge,
|
|
272
|
+
children: ke
|
|
273
|
+
})
|
|
248
274
|
});
|
|
249
275
|
return I === void 0 ? $ : /* @__PURE__ */ f(s.Provider, {
|
|
250
276
|
value: I,
|
|
251
277
|
children: $
|
|
252
278
|
});
|
|
253
279
|
});
|
|
254
|
-
export {
|
|
280
|
+
export { j as t };
|
|
@@ -1,107 +1,131 @@
|
|
|
1
1
|
import { t as e } from "./field-selector.js";
|
|
2
2
|
import { t } from "./field-type-dropdown.js";
|
|
3
|
-
import { FieldTypeTiles as
|
|
4
|
-
import { createDefaultFieldValues as
|
|
5
|
-
import { FieldExtensionsContext as
|
|
6
|
-
import { t as
|
|
7
|
-
import
|
|
8
|
-
import { Button as s, Link as c, Text as l, TextInput as u } from "@box/blueprint-web";
|
|
3
|
+
import { FieldTypeTiles as ee } from "../esm/lib/components/field-type-tiles/field-type-tiles.js";
|
|
4
|
+
import { createDefaultFieldValues as n } from "../esm/lib/components/metadata-field-configurator/utils.js";
|
|
5
|
+
import { FieldExtensionsContext as r } from "../esm/lib/components/metadata-field-configurator/context/field-extensions-context.js";
|
|
6
|
+
import { t as i } from "./metadata-field-list.js";
|
|
7
|
+
import a from "../esm/lib/messages.js";
|
|
8
|
+
import { Button as o, EmptyState as s, Link as c, Text as l, TextInput as u } from "@box/blueprint-web";
|
|
9
9
|
import { FormattedMessage as d, useIntl as f } from "react-intl";
|
|
10
10
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
11
|
import { useEffect as g, useMemo as _, useRef as v } from "react";
|
|
12
|
+
import te from "clsx";
|
|
12
13
|
import { Form as y, useFormikContext as b } from "formik";
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
import { NoTemplates as x } from "@box/blueprint-web-assets/illustrations/Medium";
|
|
15
|
+
import '../styles/metadata-template-editor-form.css';var S = {
|
|
16
|
+
form: "_form_1f0e7_1",
|
|
17
|
+
loading: "_loading_1f0e7_10",
|
|
18
|
+
fields: "_fields_1f0e7_17",
|
|
19
|
+
emptyFields: "_emptyFields_1f0e7_23",
|
|
20
|
+
actions: "_actions_1f0e7_28",
|
|
21
|
+
fieldsHeader: "_fieldsHeader_1f0e7_35"
|
|
22
|
+
}, C = "bodyDefaultBold", w = "h2", T = "https://developer.box.com/guides/metadata/fields/", E = ({ formId: E, onCancel: D, taxonomyOptions: O, fetchTaxonomies: k, hideActions: A, isEditMode: j, readOnly: M = !1, onDirtyStateChange: N, onValidationChange: P, fieldExtensions: F }) => {
|
|
23
|
+
let I = f(), { errors: L, values: R, setFieldValue: z, isSubmitting: B, isValid: V, touched: H, handleChange: U, handleBlur: W, submitCount: G, dirty: K } = b(), q = v(null), J = _(() => {
|
|
24
|
+
if (!Array.isArray(L.fields)) return null;
|
|
25
|
+
let e = L.fields.findIndex(Boolean);
|
|
23
26
|
return e >= 0 ? e : null;
|
|
24
|
-
}, [
|
|
25
|
-
let t =
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, [L.fields]), Y = (e) => {
|
|
28
|
+
let t = n(e.type);
|
|
29
|
+
z("fields", [...R.fields, t]);
|
|
30
|
+
}, X = (e) => {
|
|
31
|
+
z("fields", e);
|
|
29
32
|
};
|
|
30
33
|
g(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
let
|
|
34
|
+
N?.(K);
|
|
35
|
+
}, [K, N]), g(() => {
|
|
36
|
+
P?.(V);
|
|
37
|
+
}, [V, P]);
|
|
38
|
+
let Z = B || j && !K, Q;
|
|
39
|
+
Q = M && R.fields.length === 0 ? /* @__PURE__ */ m(s, {
|
|
40
|
+
size: "large",
|
|
41
|
+
illustration: x,
|
|
42
|
+
body: /* @__PURE__ */ m(l, {
|
|
43
|
+
as: "p",
|
|
44
|
+
children: I.formatMessage(a.noFields)
|
|
45
|
+
})
|
|
46
|
+
}) : M ? /* @__PURE__ */ m(i, {
|
|
47
|
+
ref: q,
|
|
48
|
+
fields: R.fields,
|
|
49
|
+
taxonomyOptions: O,
|
|
50
|
+
fetchTaxonomies: k,
|
|
51
|
+
readOnly: !0
|
|
52
|
+
}) : R.fields.length === 0 ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(ee, { onFieldAdd: Y }), /* @__PURE__ */ m(c, {
|
|
53
|
+
isExternal: !0,
|
|
54
|
+
className: S.fieldsLearnMoreLink,
|
|
55
|
+
href: T,
|
|
56
|
+
target: "_blank",
|
|
57
|
+
children: /* @__PURE__ */ m(d, { ...a.fieldsLearnMore })
|
|
58
|
+
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(i, {
|
|
59
|
+
ref: q,
|
|
60
|
+
fields: R.fields,
|
|
61
|
+
taxonomyOptions: O,
|
|
62
|
+
fetchTaxonomies: k,
|
|
63
|
+
onChangeFields: X,
|
|
64
|
+
firstInvalidFieldIndex: J,
|
|
65
|
+
submitAttemptCount: G
|
|
66
|
+
}), /* @__PURE__ */ m(t, { onFieldAdd: Y })] });
|
|
67
|
+
let $ = /* @__PURE__ */ h(y, {
|
|
36
68
|
noValidate: !0,
|
|
37
|
-
id:
|
|
38
|
-
className:
|
|
69
|
+
id: E,
|
|
70
|
+
className: S.form,
|
|
39
71
|
children: [
|
|
40
72
|
/* @__PURE__ */ m("div", {
|
|
41
|
-
className:
|
|
73
|
+
className: S.templateInfo,
|
|
42
74
|
children: /* @__PURE__ */ m(u, {
|
|
43
75
|
name: "displayName",
|
|
44
|
-
label:
|
|
45
|
-
placeholder:
|
|
46
|
-
value:
|
|
47
|
-
error:
|
|
76
|
+
label: I.formatMessage(a.templateName),
|
|
77
|
+
placeholder: I.formatMessage(a.templateNameDescription),
|
|
78
|
+
value: R.displayName,
|
|
79
|
+
error: !M && H.displayName && L.displayName ? L.displayName : void 0,
|
|
48
80
|
onChange: (e) => {
|
|
49
|
-
|
|
81
|
+
U(e);
|
|
50
82
|
},
|
|
51
|
-
onBlur:
|
|
83
|
+
onBlur: W,
|
|
84
|
+
readOnly: M
|
|
52
85
|
})
|
|
53
86
|
}),
|
|
54
87
|
/* @__PURE__ */ h("div", {
|
|
55
|
-
className:
|
|
88
|
+
className: S.fieldsHeader,
|
|
56
89
|
children: [/* @__PURE__ */ m(l, {
|
|
57
|
-
as:
|
|
58
|
-
variant:
|
|
59
|
-
children: /* @__PURE__ */ m(d, {
|
|
60
|
-
}),
|
|
61
|
-
fields:
|
|
62
|
-
onSelect: (e) =>
|
|
90
|
+
as: w,
|
|
91
|
+
variant: C,
|
|
92
|
+
children: /* @__PURE__ */ m(d, { ...!M && R.fields.length === 0 ? a.fieldsAddFirst : a.fields })
|
|
93
|
+
}), R.fields.length > 0 && /* @__PURE__ */ m(e, {
|
|
94
|
+
fields: R.fields,
|
|
95
|
+
onSelect: (e) => q.current?.scrollToAndExpand(e)
|
|
63
96
|
})]
|
|
64
97
|
}),
|
|
65
98
|
/* @__PURE__ */ m("div", {
|
|
66
|
-
className:
|
|
67
|
-
children:
|
|
68
|
-
isExternal: !0,
|
|
69
|
-
className: x.fieldsLearnMoreLink,
|
|
70
|
-
href: w,
|
|
71
|
-
target: "_blank",
|
|
72
|
-
children: /* @__PURE__ */ m(d, { ...o.fieldsLearnMore })
|
|
73
|
-
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
|
|
74
|
-
ref: G,
|
|
75
|
-
fields: I.fields,
|
|
76
|
-
taxonomyOptions: D,
|
|
77
|
-
fetchTaxonomies: O,
|
|
78
|
-
onChangeFields: J,
|
|
79
|
-
firstInvalidFieldIndex: K,
|
|
80
|
-
submitAttemptCount: U
|
|
81
|
-
}), /* @__PURE__ */ m(t, { onFieldAdd: q })] })
|
|
99
|
+
className: te(S.fields, { [S.emptyFields]: R.fields.length === 0 && M }),
|
|
100
|
+
children: Q
|
|
82
101
|
}),
|
|
83
|
-
!
|
|
84
|
-
className:
|
|
85
|
-
children:
|
|
102
|
+
!A && /* @__PURE__ */ m("div", {
|
|
103
|
+
className: S.actions,
|
|
104
|
+
children: M ? D && /* @__PURE__ */ m(o, {
|
|
105
|
+
variant: "primary",
|
|
106
|
+
type: "button",
|
|
107
|
+
onClick: D,
|
|
108
|
+
children: I.formatMessage(a.close)
|
|
109
|
+
}) : /* @__PURE__ */ h(p, { children: [D && /* @__PURE__ */ m(o, {
|
|
86
110
|
variant: "secondary",
|
|
87
111
|
type: "button",
|
|
88
|
-
onClick:
|
|
89
|
-
loading:
|
|
90
|
-
disabled:
|
|
91
|
-
loadingAriaLabel:
|
|
92
|
-
children:
|
|
93
|
-
}), /* @__PURE__ */ m(
|
|
112
|
+
onClick: D,
|
|
113
|
+
loading: B,
|
|
114
|
+
disabled: B,
|
|
115
|
+
loadingAriaLabel: I.formatMessage(a.submitting),
|
|
116
|
+
children: I.formatMessage(a.cancel)
|
|
117
|
+
}), /* @__PURE__ */ m(o, {
|
|
94
118
|
variant: "primary",
|
|
95
119
|
type: "submit",
|
|
96
|
-
disabled:
|
|
97
|
-
children:
|
|
98
|
-
})]
|
|
120
|
+
disabled: Z,
|
|
121
|
+
children: I.formatMessage(a.save)
|
|
122
|
+
})] })
|
|
99
123
|
})
|
|
100
124
|
]
|
|
101
125
|
});
|
|
102
|
-
return
|
|
103
|
-
value:
|
|
104
|
-
children:
|
|
126
|
+
return F === void 0 ? $ : /* @__PURE__ */ m(r.Provider, {
|
|
127
|
+
value: F,
|
|
128
|
+
children: $
|
|
105
129
|
});
|
|
106
130
|
};
|
|
107
|
-
export {
|
|
131
|
+
export { E as t };
|