@nice2dev/ui-forms 1.2.0 → 1.2.2
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/index.cjs +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +708 -709
- package/dist/ui-forms.css +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import { useControllableState as le, NiceIcon as z, NiceDataGrid as fe, useNiceTranslation as Z, evaluateValidation as Ee, NiceTutorialButton as se, resolveTutorial as ce, NiceTooltip as X, NiceForm as
|
|
4
|
-
import
|
|
5
|
-
import { useNiceTranslation as
|
|
6
|
-
function
|
|
2
|
+
import { useNiceTranslation as Je } from "@nice2dev/i18n";
|
|
3
|
+
import { useControllableState as le, NiceIcon as z, NiceDataGrid as fe, useNiceTranslation as Z, evaluateValidation as Ee, NiceTutorialButton as se, resolveTutorial as ce, NiceTooltip as X, NiceForm as Ue, useNiceAI as He, useFormGeneration as Ge, NiceScriptRunner as we, NiceLifecycleHooksEditor as ke, NiceRevisionHistory as Se, NiceConsole as Te, NiceLogConsole as Fe, NiceBadge as ae, NiceValidationBuilder as We, NiceButton as te, NiceTabs as Ye, NiceCheckbox as Qe, NiceSelect as Xe, NiceTextInput as Ze, NiceAccessManager as et, NiceViewEditor as tt, NiceWorkflowDesigner as it, NiceDataSourceBuilder as nt } from "@nice2dev/ui";
|
|
4
|
+
import at, { useState as M, forwardRef as ee, useMemo as q, useEffect as oe, useCallback as Q, useImperativeHandle as ot } from "react";
|
|
5
|
+
import { useNiceTranslation as xe, useControllableState as rt, NiceTutorialButton as lt, resolveTutorial as st, NiceIcon as be } from "@nice2dev/ui-core";
|
|
6
|
+
function Jt(t) {
|
|
7
7
|
var l, o;
|
|
8
8
|
const r = {
|
|
9
9
|
text: "text",
|
|
@@ -85,7 +85,7 @@ function ve(t) {
|
|
|
85
85
|
helpText: t.helpText
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Ut(t) {
|
|
89
89
|
const r = [];
|
|
90
90
|
for (const a of t.sections)
|
|
91
91
|
a.title ? r.push({
|
|
@@ -96,7 +96,7 @@ function zt(t) {
|
|
|
96
96
|
}) : r.push(...a.fields.map(ve));
|
|
97
97
|
return r;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Ht(t) {
|
|
100
100
|
const r = [];
|
|
101
101
|
t.version || r.push("Missing schema version"), t.id || r.push("Missing form ID"), (!t.sections || t.sections.length === 0) && r.push("Form must have at least one section");
|
|
102
102
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -106,45 +106,47 @@ function Jt(t) {
|
|
|
106
106
|
return { valid: r.length === 0, errors: r };
|
|
107
107
|
}
|
|
108
108
|
function _e(t) {
|
|
109
|
-
const {
|
|
109
|
+
const { t: r } = xe(), { value: a, onChange: l, readOnly: o } = t, [i, n] = M(() => {
|
|
110
110
|
try {
|
|
111
|
-
return
|
|
111
|
+
return a === void 0 ? "" : JSON.stringify(a, null, 2);
|
|
112
112
|
} catch {
|
|
113
113
|
return "";
|
|
114
114
|
}
|
|
115
|
-
}), [
|
|
116
|
-
return
|
|
115
|
+
}), [c, h] = M(null);
|
|
116
|
+
return at.useEffect(() => {
|
|
117
117
|
try {
|
|
118
|
-
|
|
118
|
+
n(a === void 0 ? "" : JSON.stringify(a, null, 2));
|
|
119
119
|
} catch {
|
|
120
120
|
}
|
|
121
|
-
}, [JSON.stringify(
|
|
121
|
+
}, [JSON.stringify(a)]), /* @__PURE__ */ u("div", { className: "nice-schema-form__json-field", children: [
|
|
122
122
|
/* @__PURE__ */ e(
|
|
123
123
|
"textarea",
|
|
124
124
|
{
|
|
125
125
|
className: "nice-schema-form__json-textarea",
|
|
126
|
-
value:
|
|
127
|
-
readOnly:
|
|
126
|
+
value: i,
|
|
127
|
+
readOnly: o,
|
|
128
128
|
spellCheck: !1,
|
|
129
|
-
rows: Math.min(12, Math.max(3,
|
|
129
|
+
rows: Math.min(12, Math.max(3, i.split(`
|
|
130
130
|
`).length)),
|
|
131
131
|
onChange: (f) => {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
132
|
+
const y = f.target.value;
|
|
133
|
+
n(y);
|
|
134
|
+
const s = y.trim();
|
|
135
|
+
if (s === "") {
|
|
136
|
+
h(null), l(void 0);
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
140
|
-
|
|
141
|
-
} catch (
|
|
142
|
-
|
|
140
|
+
l(JSON.parse(s)), h(null);
|
|
141
|
+
} catch (m) {
|
|
142
|
+
h(
|
|
143
|
+
m instanceof Error ? m.message : r("jsonSchemaToFormItems.invalidJson", "Invalid JSON")
|
|
144
|
+
);
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
),
|
|
147
|
-
|
|
149
|
+
c && /* @__PURE__ */ e("div", { className: "nice-schema-form__json-error", children: c })
|
|
148
150
|
] });
|
|
149
151
|
}
|
|
150
152
|
function ct(t) {
|
|
@@ -206,9 +208,9 @@ function dt(t, r, a, l = {}) {
|
|
|
206
208
|
const n = l.renderArrayField;
|
|
207
209
|
return {
|
|
208
210
|
...o,
|
|
209
|
-
render: (c,
|
|
211
|
+
render: (c, h) => n(
|
|
210
212
|
c ?? [],
|
|
211
|
-
|
|
213
|
+
h,
|
|
212
214
|
i,
|
|
213
215
|
o.label
|
|
214
216
|
)
|
|
@@ -240,11 +242,11 @@ function dt(t, r, a, l = {}) {
|
|
|
240
242
|
return { ...o, type: "text" };
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
|
-
function
|
|
245
|
+
function Ce(t, r = {}) {
|
|
244
246
|
const { uiSchema: a, renderArrayField: l, renderObjectField: o } = r, i = { renderArrayField: l, renderObjectField: o }, n = t.properties ?? {}, c = new Set(t.required ?? []);
|
|
245
|
-
return Object.keys(n).map((
|
|
246
|
-
const
|
|
247
|
-
return a != null && a[
|
|
247
|
+
return Object.keys(n).map((h) => {
|
|
248
|
+
const f = dt(h, n[h], c.has(h), i);
|
|
249
|
+
return a != null && a[h] ? { ...f, ...a[h] } : f;
|
|
248
250
|
});
|
|
249
251
|
}
|
|
250
252
|
const ut = {
|
|
@@ -267,40 +269,40 @@ const ut = {
|
|
|
267
269
|
rating: "rating",
|
|
268
270
|
color: "color"
|
|
269
271
|
};
|
|
270
|
-
function
|
|
272
|
+
function Ie(t, r = {}) {
|
|
271
273
|
var o, i;
|
|
272
274
|
const { uiSchema: a } = r, l = [];
|
|
273
275
|
for (const n of t) {
|
|
274
276
|
if (n.type === "section" && n.children) {
|
|
275
|
-
for (const
|
|
276
|
-
l.push(n.label ? { ...
|
|
277
|
+
for (const f of Ie(n.children, r))
|
|
278
|
+
l.push(n.label ? { ...f, group: n.label } : f);
|
|
277
279
|
continue;
|
|
278
280
|
}
|
|
279
281
|
const c = ut[n.type];
|
|
280
282
|
if (!c)
|
|
281
283
|
continue;
|
|
282
|
-
const
|
|
284
|
+
const h = {
|
|
283
285
|
field: n.name,
|
|
284
286
|
label: n.label,
|
|
285
287
|
type: c,
|
|
286
|
-
required: n.required || ((o = n.validations) == null ? void 0 : o.some((
|
|
288
|
+
required: n.required || ((o = n.validations) == null ? void 0 : o.some((f) => f.type === "required")),
|
|
287
289
|
placeholder: n.placeholder,
|
|
288
290
|
hint: n.helpText,
|
|
289
291
|
defaultValue: n.defaultValue,
|
|
290
292
|
disabled: n.disabled,
|
|
291
293
|
readOnly: n.readonly,
|
|
292
294
|
options: (i = n.options) == null ? void 0 : i.map(
|
|
293
|
-
(
|
|
295
|
+
(f) => typeof f == "string" ? { label: f, value: f } : { label: f.label, value: f.value }
|
|
294
296
|
)
|
|
295
297
|
};
|
|
296
|
-
l.push(a != null && a[n.name] ? { ...
|
|
298
|
+
l.push(a != null && a[n.name] ? { ...h, ...a[n.name] } : h);
|
|
297
299
|
}
|
|
298
300
|
return l;
|
|
299
301
|
}
|
|
300
302
|
function Ne(t) {
|
|
301
303
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
302
304
|
}
|
|
303
|
-
function
|
|
305
|
+
function Ae(t, r) {
|
|
304
306
|
const a = [], l = r.properties ?? {}, o = new Set(r.required ?? []);
|
|
305
307
|
for (const i of Object.keys(l)) {
|
|
306
308
|
const n = l[i], c = t[i];
|
|
@@ -329,7 +331,7 @@ const ue = "__nafRid";
|
|
|
329
331
|
function mt(t) {
|
|
330
332
|
return Array.isArray(t) ? `[${t.length}]` : t && typeof t == "object" ? "{…}" : t == null ? "" : String(t);
|
|
331
333
|
}
|
|
332
|
-
const pt = ee(
|
|
334
|
+
const pt = /* @__PURE__ */ ee(
|
|
333
335
|
function(r, a) {
|
|
334
336
|
const {
|
|
335
337
|
value: l,
|
|
@@ -337,31 +339,31 @@ const pt = ee(
|
|
|
337
339
|
onChange: i,
|
|
338
340
|
itemSchema: n,
|
|
339
341
|
title: c,
|
|
340
|
-
readOnly:
|
|
341
|
-
columns:
|
|
342
|
+
readOnly: h = !1,
|
|
343
|
+
columns: f,
|
|
342
344
|
className: y,
|
|
343
345
|
style: s,
|
|
344
|
-
"data-testid":
|
|
346
|
+
"data-testid": m
|
|
345
347
|
} = r, [F, O] = le({
|
|
346
348
|
value: l,
|
|
347
349
|
defaultValue: o,
|
|
348
350
|
fallbackValue: [],
|
|
349
351
|
onChange: i,
|
|
350
352
|
componentName: "NiceArrayField"
|
|
351
|
-
}),
|
|
352
|
-
const v =
|
|
353
|
+
}), K = n.properties ?? {}, A = q(() => (f ?? Object.keys(K)).map((I) => {
|
|
354
|
+
const v = K[I] ?? {}, k = { field: I, header: v.title ?? I };
|
|
353
355
|
return v.type === "boolean" ? (k.render = (j) => j ? /* @__PURE__ */ e(z, { name: "check", size: 14, title: "true" }) : "", k.align = "center") : (v.type === "array" || v.type === "object") && (k.render = (j) => mt(j)), k;
|
|
354
|
-
}), [n,
|
|
355
|
-
() =>
|
|
356
|
+
}), [n, f]), C = q(
|
|
357
|
+
() => Ce(n),
|
|
356
358
|
[n]
|
|
357
|
-
),
|
|
358
|
-
const { [ue]: I, ...v } =
|
|
359
|
+
), N = q(() => F.map((D, I) => ({ ...D, [ue]: String(I) })), [F]), $ = (D) => {
|
|
360
|
+
const { [ue]: I, ...v } = D;
|
|
359
361
|
return v;
|
|
360
362
|
}, J = "nice-array-field" + (y ? ` ${y}` : "");
|
|
361
|
-
return /* @__PURE__ */ e("div", { ref: a, className: J, style: s, "data-testid":
|
|
363
|
+
return /* @__PURE__ */ e("div", { ref: a, className: J, style: s, "data-testid": m, children: /* @__PURE__ */ e(
|
|
362
364
|
fe,
|
|
363
365
|
{
|
|
364
|
-
data:
|
|
366
|
+
data: N,
|
|
365
367
|
keyField: ue,
|
|
366
368
|
columns: A,
|
|
367
369
|
editMode: "popup",
|
|
@@ -369,17 +371,17 @@ const pt = ee(
|
|
|
369
371
|
editFormTitle: c ? `${c} — item` : "Edit item",
|
|
370
372
|
emptyText: `No items${c ? ` in ${c}` : ""}`,
|
|
371
373
|
compact: !0,
|
|
372
|
-
onRowAdd:
|
|
373
|
-
onRowEdit:
|
|
374
|
-
const v = Number(
|
|
374
|
+
onRowAdd: h ? void 0 : (D) => O([...F, $(D)]),
|
|
375
|
+
onRowEdit: h ? void 0 : (D, I) => {
|
|
376
|
+
const v = Number(D);
|
|
375
377
|
O(
|
|
376
378
|
F.map(
|
|
377
379
|
(k, j) => j === v ? $(I) : k
|
|
378
380
|
)
|
|
379
381
|
);
|
|
380
382
|
},
|
|
381
|
-
onRowDelete:
|
|
382
|
-
const I = Number(
|
|
383
|
+
onRowDelete: h ? void 0 : (D) => {
|
|
384
|
+
const I = Number(D);
|
|
383
385
|
O(F.filter((v, k) => k !== I));
|
|
384
386
|
}
|
|
385
387
|
}
|
|
@@ -434,7 +436,7 @@ function ft(t) {
|
|
|
434
436
|
function yt(t, r) {
|
|
435
437
|
return Ee(ft(t), r).filter((a) => a.severity === "error").map((a) => ({ field: a.field, message: a.message }));
|
|
436
438
|
}
|
|
437
|
-
const de = ee(
|
|
439
|
+
const de = /* @__PURE__ */ ee(
|
|
438
440
|
function(r, a) {
|
|
439
441
|
const {
|
|
440
442
|
schema: l,
|
|
@@ -442,59 +444,59 @@ const de = ee(
|
|
|
442
444
|
uiSchema: i,
|
|
443
445
|
value: n,
|
|
444
446
|
defaultValue: c,
|
|
445
|
-
onChange:
|
|
446
|
-
onValidate:
|
|
447
|
+
onChange: h,
|
|
448
|
+
onValidate: f,
|
|
447
449
|
showJsonView: y = !1,
|
|
448
450
|
columns: s = 1,
|
|
449
|
-
labelPosition:
|
|
451
|
+
labelPosition: m = "top",
|
|
450
452
|
readOnly: F = !1,
|
|
451
453
|
liveValidation: O = !0,
|
|
452
|
-
validationRules:
|
|
454
|
+
validationRules: K,
|
|
453
455
|
tutorial: A,
|
|
454
456
|
className: C,
|
|
455
|
-
style:
|
|
457
|
+
style: N,
|
|
456
458
|
id: $,
|
|
457
459
|
"data-testid": J
|
|
458
|
-
} = r, { t:
|
|
460
|
+
} = r, { t: D } = Z(), [I, v] = le({
|
|
459
461
|
value: n,
|
|
460
462
|
defaultValue: c,
|
|
461
463
|
fallbackValue: {},
|
|
462
|
-
onChange:
|
|
464
|
+
onChange: h,
|
|
463
465
|
componentName: "NiceSchemaForm"
|
|
464
|
-
}), [k, j] =
|
|
466
|
+
}), [k, j] = M(!1), [U, L] = M(""), [S, H] = M(null), E = q(() => l ? Ce(l, {
|
|
465
467
|
uiSchema: i,
|
|
466
468
|
// Inject the structured array editor (avoids an import cycle in the converter).
|
|
467
|
-
renderArrayField: (
|
|
469
|
+
renderArrayField: (w, g, x, R) => /* @__PURE__ */ e(
|
|
468
470
|
pt,
|
|
469
471
|
{
|
|
470
|
-
value:
|
|
472
|
+
value: w,
|
|
471
473
|
onChange: g,
|
|
472
474
|
itemSchema: x,
|
|
473
475
|
title: R,
|
|
474
476
|
readOnly: F
|
|
475
477
|
}
|
|
476
478
|
)
|
|
477
|
-
}) : o ?
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const g = Ee(
|
|
481
|
-
return [...
|
|
479
|
+
}) : o ? Ie(o, { uiSchema: i }) : [], [l, o, i, F]), P = q(() => {
|
|
480
|
+
const w = l ? Ae(I, l) : o ? yt(o, I) : [];
|
|
481
|
+
if (K != null && K.length) {
|
|
482
|
+
const g = Ee(K, I).filter((x) => x.severity === "error").map((x) => ({ field: x.field, message: x.message }));
|
|
483
|
+
return [...w, ...g];
|
|
482
484
|
}
|
|
483
|
-
return
|
|
484
|
-
}, [l, o, I,
|
|
485
|
+
return w;
|
|
486
|
+
}, [l, o, I, K]);
|
|
485
487
|
oe(() => {
|
|
486
|
-
|
|
487
|
-
}, [
|
|
488
|
+
f == null || f(P);
|
|
489
|
+
}, [P, f]), oe(() => {
|
|
488
490
|
if (k)
|
|
489
491
|
try {
|
|
490
492
|
L(JSON.stringify(I, null, 2)), H(null);
|
|
491
493
|
} catch {
|
|
492
494
|
}
|
|
493
495
|
}, [k, I]);
|
|
494
|
-
const
|
|
495
|
-
v({ ...I, [
|
|
496
|
+
const p = (w, g) => {
|
|
497
|
+
v({ ...I, [w]: g });
|
|
496
498
|
}, _ = "nice-schema-form" + (C ? ` ${C}` : "");
|
|
497
|
-
return /* @__PURE__ */ u("div", { ref: a, id: $, className: _, style:
|
|
499
|
+
return /* @__PURE__ */ u("div", { ref: a, id: $, className: _, style: N, "data-testid": J, children: [
|
|
498
500
|
A && /* @__PURE__ */ e("div", { className: "nice-schema-form__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(A, ht) }) }),
|
|
499
501
|
y && /* @__PURE__ */ u("div", { className: "nice-schema-form__toolbar", "data-tour": "sf-viewtoggle", children: [
|
|
500
502
|
/* @__PURE__ */ e(
|
|
@@ -503,20 +505,20 @@ const de = ee(
|
|
|
503
505
|
type: "button",
|
|
504
506
|
className: "nice-schema-form__tab" + (k ? "" : " nice-schema-form__tab--active"),
|
|
505
507
|
onClick: () => j(!1),
|
|
506
|
-
children:
|
|
508
|
+
children: D("schemaForm.tab.form", "Form")
|
|
507
509
|
}
|
|
508
510
|
),
|
|
509
511
|
/* @__PURE__ */ e(
|
|
510
512
|
X,
|
|
511
513
|
{
|
|
512
|
-
content:
|
|
514
|
+
content: D("schemaForm.tab.json.help", "Edit the raw JSON value directly"),
|
|
513
515
|
children: /* @__PURE__ */ e(
|
|
514
516
|
"button",
|
|
515
517
|
{
|
|
516
518
|
type: "button",
|
|
517
519
|
className: "nice-schema-form__tab" + (k ? " nice-schema-form__tab--active" : ""),
|
|
518
520
|
onClick: () => j(!0),
|
|
519
|
-
children:
|
|
521
|
+
children: D("schemaForm.tab.json", "JSON")
|
|
520
522
|
}
|
|
521
523
|
)
|
|
522
524
|
}
|
|
@@ -532,15 +534,15 @@ const de = ee(
|
|
|
532
534
|
spellCheck: !1,
|
|
533
535
|
rows: Math.min(24, Math.max(6, U.split(`
|
|
534
536
|
`).length)),
|
|
535
|
-
onChange: (
|
|
536
|
-
const g =
|
|
537
|
+
onChange: (w) => {
|
|
538
|
+
const g = w.target.value;
|
|
537
539
|
L(g);
|
|
538
540
|
try {
|
|
539
541
|
const x = JSON.parse(g);
|
|
540
542
|
H(null), v(x);
|
|
541
543
|
} catch (x) {
|
|
542
544
|
H(
|
|
543
|
-
x instanceof Error ? x.message :
|
|
545
|
+
x instanceof Error ? x.message : D("schemaForm.invalidJson", "Invalid JSON")
|
|
544
546
|
);
|
|
545
547
|
}
|
|
546
548
|
}
|
|
@@ -548,17 +550,17 @@ const de = ee(
|
|
|
548
550
|
),
|
|
549
551
|
S && /* @__PURE__ */ e("div", { className: "nice-schema-form__json-error", children: S })
|
|
550
552
|
] }) : /* @__PURE__ */ e(
|
|
551
|
-
|
|
553
|
+
Ue,
|
|
552
554
|
{
|
|
553
|
-
items:
|
|
555
|
+
items: E,
|
|
554
556
|
data: I,
|
|
555
|
-
onFieldChange:
|
|
557
|
+
onFieldChange: p,
|
|
556
558
|
columns: s,
|
|
557
|
-
labelPosition:
|
|
559
|
+
labelPosition: m,
|
|
558
560
|
readOnly: F
|
|
559
561
|
}
|
|
560
562
|
),
|
|
561
|
-
O &&
|
|
563
|
+
O && P.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-schema-form__errors", role: "alert", children: P.map((w, g) => /* @__PURE__ */ e("li", { className: "nice-schema-form__error", children: w.message }, `${w.field}-${g}`)) })
|
|
562
564
|
] });
|
|
563
565
|
}
|
|
564
566
|
), gt = [
|
|
@@ -635,232 +637,231 @@ function vt(t) {
|
|
|
635
637
|
};
|
|
636
638
|
});
|
|
637
639
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
)
|
|
663
|
-
(g)
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
640
|
+
const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
641
|
+
const {
|
|
642
|
+
enableAI: l = !0,
|
|
643
|
+
aiModel: o,
|
|
644
|
+
enableGenerate: i = !0,
|
|
645
|
+
enableSuggestions: n = !0,
|
|
646
|
+
onGenerate: c,
|
|
647
|
+
showAIToolbar: h = !0,
|
|
648
|
+
templates: f = gt,
|
|
649
|
+
fields: y,
|
|
650
|
+
onChange: s
|
|
651
|
+
} = r, [m, F] = M(!1), [O, K] = M(""), [A, C] = M([]), [N, $] = M(y || []), [J, D] = M(!1), [I, v] = M({}), { t: k } = Je(), j = He(), { generateForm: U, isLoading: L } = Ge(), S = l && j.isConfigured, H = Q(
|
|
652
|
+
async (g) => {
|
|
653
|
+
if (!S || !i || !g.trim())
|
|
654
|
+
return [];
|
|
655
|
+
try {
|
|
656
|
+
const x = await U(g);
|
|
657
|
+
return C(x), c == null || c(g, x), x;
|
|
658
|
+
} catch {
|
|
659
|
+
return [];
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
[S, i, U, c]
|
|
663
|
+
), E = Q(
|
|
664
|
+
(g) => {
|
|
665
|
+
const x = vt(g);
|
|
666
|
+
$((R) => [...R, ...x]), s == null || s([...N, ...x]), F(!1), C([]), K("");
|
|
667
|
+
},
|
|
668
|
+
// currentFields: until 1.2.2 onChange got the fields of the render this callback was made in
|
|
669
|
+
[s, N]
|
|
670
|
+
), P = Q(() => N, [N]), p = Q(() => {
|
|
671
|
+
$([]), s == null || s([]);
|
|
672
|
+
}, [s]), _ = (g) => {
|
|
673
|
+
K(g.description), D(!1), H(g.description);
|
|
674
|
+
};
|
|
675
|
+
ot(a, () => ({
|
|
676
|
+
generateForm: H,
|
|
677
|
+
getFields: P,
|
|
678
|
+
applyFields: E,
|
|
679
|
+
clearFields: p
|
|
680
|
+
}));
|
|
681
|
+
const w = (g) => ({
|
|
682
|
+
text: "edit",
|
|
683
|
+
textarea: "file",
|
|
684
|
+
number: "hash",
|
|
685
|
+
email: "mail",
|
|
686
|
+
password: "lock",
|
|
687
|
+
phone: "phone",
|
|
688
|
+
date: "calendar",
|
|
689
|
+
select: "list",
|
|
690
|
+
checkbox: "check",
|
|
691
|
+
toggle: "settings",
|
|
692
|
+
radio: "circle",
|
|
693
|
+
file: "paperclip",
|
|
694
|
+
rating: "star"
|
|
695
|
+
})[g] || "edit";
|
|
696
|
+
return /* @__PURE__ */ u("div", { className: "nice-form-builder-ai", "data-testid": r["data-testid"], children: [
|
|
697
|
+
h && S && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar", children: [
|
|
698
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-left", children: [
|
|
699
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: k("formBuilderAI.ai", "AI") }),
|
|
700
|
+
L && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__loading", children: k("formBuilderAI.generating", "Generating...") })
|
|
701
|
+
] }),
|
|
702
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-right", children: [
|
|
703
|
+
i && /* @__PURE__ */ u(
|
|
704
|
+
"button",
|
|
705
|
+
{
|
|
706
|
+
type: "button",
|
|
707
|
+
className: "nice-form-builder-ai__btn",
|
|
708
|
+
onClick: () => F(!0),
|
|
709
|
+
disabled: L,
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
712
|
+
" ",
|
|
713
|
+
k("formBuilderAI.generateForm", "Generate Form")
|
|
714
|
+
]
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__templates-dropdown", children: [
|
|
718
|
+
/* @__PURE__ */ u(
|
|
702
719
|
"button",
|
|
703
720
|
{
|
|
704
721
|
type: "button",
|
|
705
|
-
className: "nice-form-builder-ai__btn",
|
|
706
|
-
onClick: () =>
|
|
707
|
-
disabled: L,
|
|
722
|
+
className: "nice-form-builder-ai__btn nice-form-builder-ai__btn--secondary",
|
|
723
|
+
onClick: () => D(!J),
|
|
708
724
|
children: [
|
|
709
|
-
/* @__PURE__ */ e(z, { name: "
|
|
725
|
+
/* @__PURE__ */ e(z, { name: "list", size: "sm" }),
|
|
726
|
+
" ",
|
|
727
|
+
k("formBuilderAI.templates", "Templates"),
|
|
710
728
|
" ",
|
|
711
|
-
|
|
729
|
+
/* @__PURE__ */ e(z, { name: "chevron-down", size: "sm" })
|
|
712
730
|
]
|
|
713
731
|
}
|
|
714
732
|
),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
children:
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
]
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: p.map((g, x) => /* @__PURE__ */ u(
|
|
732
|
-
"button",
|
|
733
|
-
{
|
|
734
|
-
type: "button",
|
|
735
|
-
className: "nice-form-builder-ai__template-item",
|
|
736
|
-
onClick: () => _(g),
|
|
737
|
-
children: [
|
|
738
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
|
|
739
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
|
|
740
|
-
]
|
|
741
|
-
},
|
|
742
|
-
x
|
|
743
|
-
)) })
|
|
744
|
-
] })
|
|
733
|
+
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: f.map((g, x) => /* @__PURE__ */ u(
|
|
734
|
+
"button",
|
|
735
|
+
{
|
|
736
|
+
type: "button",
|
|
737
|
+
className: "nice-form-builder-ai__template-item",
|
|
738
|
+
onClick: () => _(g),
|
|
739
|
+
children: [
|
|
740
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
|
|
741
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
|
|
742
|
+
]
|
|
743
|
+
},
|
|
744
|
+
x
|
|
745
|
+
)) })
|
|
745
746
|
] })
|
|
746
|
-
] })
|
|
747
|
-
|
|
748
|
-
|
|
747
|
+
] })
|
|
748
|
+
] }),
|
|
749
|
+
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__builder-wrapper", children: /* @__PURE__ */ e(
|
|
750
|
+
de,
|
|
751
|
+
{
|
|
752
|
+
fields: N,
|
|
753
|
+
value: I,
|
|
754
|
+
onChange: v,
|
|
755
|
+
columns: 1
|
|
756
|
+
}
|
|
757
|
+
) }),
|
|
758
|
+
m && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel", children: [
|
|
759
|
+
/* @__PURE__ */ e(
|
|
760
|
+
"div",
|
|
749
761
|
{
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
onChange: v,
|
|
753
|
-
columns: 1
|
|
762
|
+
className: "nice-form-builder-ai__panel-overlay",
|
|
763
|
+
onClick: () => F(!1)
|
|
754
764
|
}
|
|
755
|
-
)
|
|
756
|
-
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
"
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
),
|
|
764
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
|
|
765
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
|
|
766
|
-
/* @__PURE__ */ u("h4", { children: [
|
|
767
|
-
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
768
|
-
" ",
|
|
769
|
-
k("formBuilderAI.generateFormTitle", "Generate Form with AI")
|
|
770
|
-
] }),
|
|
771
|
-
/* @__PURE__ */ e(
|
|
772
|
-
"button",
|
|
773
|
-
{
|
|
774
|
-
type: "button",
|
|
775
|
-
className: "nice-form-builder-ai__panel-close",
|
|
776
|
-
onClick: () => {
|
|
777
|
-
F(!1), C([]), D("");
|
|
778
|
-
},
|
|
779
|
-
"aria-label": "Close",
|
|
780
|
-
children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
|
|
781
|
-
}
|
|
782
|
-
)
|
|
783
|
-
] }),
|
|
784
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
|
|
785
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
|
|
786
|
-
/* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
|
|
787
|
-
/* @__PURE__ */ e(
|
|
788
|
-
"textarea",
|
|
789
|
-
{
|
|
790
|
-
className: "nice-form-builder-ai__textarea",
|
|
791
|
-
placeholder: k(
|
|
792
|
-
"formBuilderAI.promptPlaceholder",
|
|
793
|
-
'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
|
|
794
|
-
),
|
|
795
|
-
value: O,
|
|
796
|
-
onChange: (g) => D(g.target.value),
|
|
797
|
-
rows: 3
|
|
798
|
-
}
|
|
799
|
-
),
|
|
800
|
-
/* @__PURE__ */ e(
|
|
801
|
-
"button",
|
|
802
|
-
{
|
|
803
|
-
type: "button",
|
|
804
|
-
className: "nice-form-builder-ai__generate-btn",
|
|
805
|
-
onClick: () => H(O),
|
|
806
|
-
disabled: L || !O.trim(),
|
|
807
|
-
children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
|
|
808
|
-
}
|
|
809
|
-
)
|
|
810
|
-
] }),
|
|
811
|
-
A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
|
|
812
|
-
/* @__PURE__ */ e("h5", { children: k("formBuilderAI.previewCount", "Preview ({count} fields)").replace(
|
|
813
|
-
"{count}",
|
|
814
|
-
String(A.length)
|
|
815
|
-
) }),
|
|
816
|
-
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__fields-preview", children: A.map((g, x) => /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-preview", children: [
|
|
817
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: E(g.type), size: "sm" }) }),
|
|
818
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
|
|
819
|
-
/* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
|
|
820
|
-
g.label,
|
|
821
|
-
g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
|
|
822
|
-
] }),
|
|
823
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
|
|
824
|
-
] }),
|
|
825
|
-
g.options && /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-options", children: [
|
|
826
|
-
g.options.length,
|
|
827
|
-
" options"
|
|
828
|
-
] })
|
|
829
|
-
] }, x)) })
|
|
830
|
-
] })
|
|
765
|
+
),
|
|
766
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
|
|
767
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
|
|
768
|
+
/* @__PURE__ */ u("h4", { children: [
|
|
769
|
+
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
770
|
+
" ",
|
|
771
|
+
k("formBuilderAI.generateFormTitle", "Generate Form with AI")
|
|
831
772
|
] }),
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
|
|
834
|
-
|
|
773
|
+
/* @__PURE__ */ e(
|
|
774
|
+
"button",
|
|
775
|
+
{
|
|
776
|
+
type: "button",
|
|
777
|
+
className: "nice-form-builder-ai__panel-close",
|
|
778
|
+
onClick: () => {
|
|
779
|
+
F(!1), C([]), K("");
|
|
780
|
+
},
|
|
781
|
+
"aria-label": k("formBuilderAI.close", "Close"),
|
|
782
|
+
children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
|
|
787
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
|
|
788
|
+
/* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
|
|
789
|
+
/* @__PURE__ */ e(
|
|
790
|
+
"textarea",
|
|
835
791
|
{
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
]
|
|
792
|
+
className: "nice-form-builder-ai__textarea",
|
|
793
|
+
placeholder: k(
|
|
794
|
+
"formBuilderAI.promptPlaceholder",
|
|
795
|
+
'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
|
|
796
|
+
),
|
|
797
|
+
value: O,
|
|
798
|
+
onChange: (g) => K(g.target.value),
|
|
799
|
+
rows: 3
|
|
845
800
|
}
|
|
846
801
|
),
|
|
847
802
|
/* @__PURE__ */ e(
|
|
848
803
|
"button",
|
|
849
804
|
{
|
|
850
805
|
type: "button",
|
|
851
|
-
className: "nice-form-builder-
|
|
852
|
-
onClick: () =>
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
children: k("formBuilderAI.cancel", "Cancel")
|
|
806
|
+
className: "nice-form-builder-ai__generate-btn",
|
|
807
|
+
onClick: () => H(O),
|
|
808
|
+
disabled: L || !O.trim(),
|
|
809
|
+
children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
|
|
856
810
|
}
|
|
857
811
|
)
|
|
812
|
+
] }),
|
|
813
|
+
A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
|
|
814
|
+
/* @__PURE__ */ e("h5", { children: k("formBuilderAI.previewCount", "Preview ({count} fields)").replace(
|
|
815
|
+
"{count}",
|
|
816
|
+
String(A.length)
|
|
817
|
+
) }),
|
|
818
|
+
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__fields-preview", children: A.map((g, x) => /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-preview", children: [
|
|
819
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: w(g.type), size: "sm" }) }),
|
|
820
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
|
|
821
|
+
/* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
|
|
822
|
+
g.label,
|
|
823
|
+
g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
|
|
824
|
+
] }),
|
|
825
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
|
|
826
|
+
] }),
|
|
827
|
+
g.options && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-options", children: k("formBuilderAI.options", "{options} options").replace(
|
|
828
|
+
"{options}",
|
|
829
|
+
String(g.options.length)
|
|
830
|
+
) })
|
|
831
|
+
] }, x)) })
|
|
858
832
|
] })
|
|
833
|
+
] }),
|
|
834
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-footer", children: [
|
|
835
|
+
/* @__PURE__ */ u(
|
|
836
|
+
"button",
|
|
837
|
+
{
|
|
838
|
+
type: "button",
|
|
839
|
+
className: "nice-form-builder-ai__apply-btn",
|
|
840
|
+
onClick: () => E(A),
|
|
841
|
+
disabled: A.length === 0 || L,
|
|
842
|
+
children: [
|
|
843
|
+
/* @__PURE__ */ e(z, { name: "check", size: "sm" }),
|
|
844
|
+
" ",
|
|
845
|
+
k("formBuilderAI.addToForm", "Add to Form")
|
|
846
|
+
]
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
/* @__PURE__ */ e(
|
|
850
|
+
"button",
|
|
851
|
+
{
|
|
852
|
+
type: "button",
|
|
853
|
+
className: "nice-form-builder-ai__cancel-btn",
|
|
854
|
+
onClick: () => {
|
|
855
|
+
F(!1), C([]), K("");
|
|
856
|
+
},
|
|
857
|
+
children: k("formBuilderAI.cancel", "Cancel")
|
|
858
|
+
}
|
|
859
|
+
)
|
|
859
860
|
] })
|
|
860
861
|
] })
|
|
861
|
-
] })
|
|
862
|
-
}
|
|
863
|
-
), _t = {
|
|
862
|
+
] })
|
|
863
|
+
] });
|
|
864
|
+
}), _t = {
|
|
864
865
|
text: { type: "string" },
|
|
865
866
|
textarea: { type: "string" },
|
|
866
867
|
password: { type: "string", format: "password" },
|
|
@@ -925,7 +926,7 @@ function Et(t) {
|
|
|
925
926
|
enum: t.options.map((l) => typeof l == "string" ? l : String(l.value))
|
|
926
927
|
}), Nt(a, t.validations), a;
|
|
927
928
|
}
|
|
928
|
-
function
|
|
929
|
+
function Wt(t) {
|
|
929
930
|
const r = {}, a = [], l = (i) => {
|
|
930
931
|
var n;
|
|
931
932
|
for (const c of i) {
|
|
@@ -933,8 +934,8 @@ function Ht(t) {
|
|
|
933
934
|
l(c.children);
|
|
934
935
|
continue;
|
|
935
936
|
}
|
|
936
|
-
const
|
|
937
|
-
|
|
937
|
+
const h = Et(c);
|
|
938
|
+
h && (r[c.name] = h, (c.required || (n = c.validations) != null && n.some((f) => f.type === "required")) && a.push(c.name));
|
|
938
939
|
}
|
|
939
940
|
};
|
|
940
941
|
for (const i of t.sections)
|
|
@@ -975,155 +976,153 @@ const wt = [
|
|
|
975
976
|
content: "Each section can be edited as a visual form or as raw JSON — use the toggle inside the section.",
|
|
976
977
|
placement: "auto"
|
|
977
978
|
}
|
|
978
|
-
];
|
|
979
|
-
function
|
|
979
|
+
], kt = [];
|
|
980
|
+
function Yt(t) {
|
|
980
981
|
return t;
|
|
981
982
|
}
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
de,
|
|
1023
|
-
{
|
|
1024
|
-
schema: G.schema,
|
|
1025
|
-
fields: G.fields,
|
|
1026
|
-
uiSchema: G.uiSchema,
|
|
1027
|
-
value: S,
|
|
1028
|
-
onChange: H,
|
|
1029
|
-
showJsonView: c
|
|
1030
|
-
}
|
|
1031
|
-
) })
|
|
1032
|
-
}));
|
|
1033
|
-
return f && R.push({
|
|
1034
|
-
key: "scripts",
|
|
1035
|
-
label: L("manifestEditor.tab.scripts", "Scripts"),
|
|
1036
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...f }) })
|
|
1037
|
-
}), p && p.length > 0 && R.push({
|
|
1038
|
-
key: "lifecycle",
|
|
1039
|
-
label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
|
|
1040
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1041
|
-
ke,
|
|
1042
|
-
{
|
|
1043
|
-
triggers: p,
|
|
1044
|
-
bindings: y,
|
|
1045
|
-
handlers: s,
|
|
1046
|
-
onChange: (G) => h == null ? void 0 : h(G),
|
|
1047
|
-
groupByTrigger: !0,
|
|
1048
|
-
allowCondition: !0
|
|
1049
|
-
}
|
|
1050
|
-
) })
|
|
1051
|
-
}), F && F.length > 0 && R.push({
|
|
1052
|
-
key: "history",
|
|
1053
|
-
label: L("manifestEditor.tab.history", "History"),
|
|
1054
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1055
|
-
Se,
|
|
1056
|
-
{
|
|
1057
|
-
revisions: F,
|
|
1058
|
-
onRollback: O,
|
|
1059
|
-
loadContent: D,
|
|
1060
|
-
language: "json"
|
|
1061
|
-
}
|
|
1062
|
-
) })
|
|
1063
|
-
}), w && R.push(...w), R;
|
|
1064
|
-
}, [
|
|
1065
|
-
i,
|
|
1066
|
-
S,
|
|
1067
|
-
H,
|
|
1068
|
-
c,
|
|
1069
|
-
f,
|
|
1070
|
-
p,
|
|
1071
|
-
y,
|
|
1072
|
-
s,
|
|
1073
|
-
h,
|
|
1074
|
-
F,
|
|
1075
|
-
O,
|
|
1076
|
-
D,
|
|
1077
|
-
w,
|
|
1078
|
-
L
|
|
1079
|
-
]), [q, m] = K(((x = N[0]) == null ? void 0 : x.key) ?? "");
|
|
1080
|
-
oe(() => {
|
|
1081
|
-
N.length > 0 && !N.some((R) => R.key === q) && m(N[0].key);
|
|
1082
|
-
}, [N, q]);
|
|
1083
|
-
const _ = P(() => $ ? $(S) : [], [$, S]), E = P(() => {
|
|
1084
|
-
const R = [
|
|
983
|
+
const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
984
|
+
var x;
|
|
985
|
+
const {
|
|
986
|
+
value: l,
|
|
987
|
+
defaultValue: o,
|
|
988
|
+
sections: i = kt,
|
|
989
|
+
onChange: n,
|
|
990
|
+
jsonView: c = !0,
|
|
991
|
+
scriptRunner: h,
|
|
992
|
+
triggers: f,
|
|
993
|
+
bindings: y = [],
|
|
994
|
+
handlers: s,
|
|
995
|
+
onBindingsChange: m,
|
|
996
|
+
revisions: F,
|
|
997
|
+
onRollback: O,
|
|
998
|
+
loadContent: K,
|
|
999
|
+
logs: A,
|
|
1000
|
+
onClearLogs: C,
|
|
1001
|
+
extraTabs: N,
|
|
1002
|
+
validate: $,
|
|
1003
|
+
theme: J = "light",
|
|
1004
|
+
height: D = 560,
|
|
1005
|
+
tutorial: I,
|
|
1006
|
+
className: v,
|
|
1007
|
+
style: k,
|
|
1008
|
+
id: j,
|
|
1009
|
+
"data-testid": U
|
|
1010
|
+
} = r, { t: L } = Z(), [S, H] = le({
|
|
1011
|
+
value: l,
|
|
1012
|
+
defaultValue: o,
|
|
1013
|
+
fallbackValue: {},
|
|
1014
|
+
onChange: n,
|
|
1015
|
+
componentName: "NiceManifestEditor"
|
|
1016
|
+
}), E = q(() => {
|
|
1017
|
+
const R = i.map((G) => ({
|
|
1018
|
+
key: `section:${G.id}`,
|
|
1019
|
+
label: G.title,
|
|
1020
|
+
icon: G.icon,
|
|
1021
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1022
|
+
de,
|
|
1085
1023
|
{
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1024
|
+
schema: G.schema,
|
|
1025
|
+
fields: G.fields,
|
|
1026
|
+
uiSchema: G.uiSchema,
|
|
1027
|
+
value: S,
|
|
1028
|
+
onChange: H,
|
|
1029
|
+
showJsonView: c
|
|
1089
1030
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1031
|
+
) })
|
|
1032
|
+
}));
|
|
1033
|
+
return h && R.push({
|
|
1034
|
+
key: "scripts",
|
|
1035
|
+
label: L("manifestEditor.tab.scripts", "Scripts"),
|
|
1036
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...h }) })
|
|
1037
|
+
}), f && f.length > 0 && R.push({
|
|
1038
|
+
key: "lifecycle",
|
|
1039
|
+
label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
|
|
1040
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1041
|
+
ke,
|
|
1042
|
+
{
|
|
1043
|
+
triggers: f,
|
|
1044
|
+
bindings: y,
|
|
1045
|
+
handlers: s,
|
|
1046
|
+
onChange: (G) => m == null ? void 0 : m(G),
|
|
1047
|
+
groupByTrigger: !0,
|
|
1048
|
+
allowCondition: !0
|
|
1049
|
+
}
|
|
1050
|
+
) })
|
|
1051
|
+
}), F && F.length > 0 && R.push({
|
|
1052
|
+
key: "history",
|
|
1053
|
+
label: L("manifestEditor.tab.history", "History"),
|
|
1054
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1055
|
+
Se,
|
|
1056
|
+
{
|
|
1057
|
+
revisions: F,
|
|
1058
|
+
onRollback: O,
|
|
1059
|
+
loadContent: K,
|
|
1060
|
+
language: "json"
|
|
1061
|
+
}
|
|
1062
|
+
) })
|
|
1063
|
+
}), N && R.push(...N), R;
|
|
1064
|
+
}, [
|
|
1065
|
+
i,
|
|
1066
|
+
S,
|
|
1067
|
+
H,
|
|
1068
|
+
c,
|
|
1069
|
+
h,
|
|
1070
|
+
f,
|
|
1071
|
+
y,
|
|
1072
|
+
s,
|
|
1073
|
+
m,
|
|
1074
|
+
F,
|
|
1075
|
+
O,
|
|
1076
|
+
K,
|
|
1077
|
+
N,
|
|
1078
|
+
L
|
|
1079
|
+
]), [P, p] = M(((x = E[0]) == null ? void 0 : x.key) ?? "");
|
|
1080
|
+
oe(() => {
|
|
1081
|
+
E.length > 0 && !E.some((R) => R.key === P) && p(E[0].key);
|
|
1082
|
+
}, [E, P]);
|
|
1083
|
+
const _ = q(() => $ ? $(S) : [], [$, S]), w = q(() => {
|
|
1084
|
+
const R = [
|
|
1102
1085
|
{
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
style: { height: M, ...k },
|
|
1107
|
-
"data-testid": U,
|
|
1108
|
-
theme: J,
|
|
1109
|
-
tabs: N,
|
|
1110
|
-
activeTabKey: q,
|
|
1111
|
-
onTabChange: m,
|
|
1112
|
-
statusItems: E,
|
|
1113
|
-
toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
|
|
1114
|
-
bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
|
|
1115
|
-
Fe,
|
|
1116
|
-
{
|
|
1117
|
-
title: L("manifestEditor.output", "Output"),
|
|
1118
|
-
entries: A,
|
|
1119
|
-
onClear: C,
|
|
1120
|
-
maxHeight: "100%"
|
|
1121
|
-
}
|
|
1122
|
-
) : void 0
|
|
1086
|
+
key: "sections",
|
|
1087
|
+
label: `${i.length} ${L("manifestEditor.sections", "sections")}`,
|
|
1088
|
+
position: "left"
|
|
1123
1089
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1090
|
+
];
|
|
1091
|
+
return $ && R.push({
|
|
1092
|
+
key: "validation",
|
|
1093
|
+
label: /* @__PURE__ */ u("span", { className: "nice-manifest-editor__status", children: [
|
|
1094
|
+
/* @__PURE__ */ e(z, { name: _.length === 0 ? "check" : "warning", size: 12 }),
|
|
1095
|
+
_.length === 0 ? L("manifestEditor.status.valid", "Valid") : `${_.length} ${L("manifestEditor.status.issues", "issues")}`
|
|
1096
|
+
] }),
|
|
1097
|
+
position: "left"
|
|
1098
|
+
}), R;
|
|
1099
|
+
}, [i.length, $, _.length, L]), g = "nice-manifest-editor" + (v ? ` ${v}` : "");
|
|
1100
|
+
return /* @__PURE__ */ e(
|
|
1101
|
+
Te,
|
|
1102
|
+
{
|
|
1103
|
+
ref: a,
|
|
1104
|
+
id: j,
|
|
1105
|
+
className: g,
|
|
1106
|
+
style: { height: D, ...k },
|
|
1107
|
+
"data-testid": U,
|
|
1108
|
+
theme: J,
|
|
1109
|
+
tabs: E,
|
|
1110
|
+
activeTabKey: P,
|
|
1111
|
+
onTabChange: p,
|
|
1112
|
+
statusItems: w,
|
|
1113
|
+
toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
|
|
1114
|
+
bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
|
|
1115
|
+
Fe,
|
|
1116
|
+
{
|
|
1117
|
+
title: L("manifestEditor.output", "Output"),
|
|
1118
|
+
entries: A,
|
|
1119
|
+
onClear: C,
|
|
1120
|
+
maxHeight: "100%"
|
|
1121
|
+
}
|
|
1122
|
+
) : void 0
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
}), me = "__eeRid", pe = "__eeFid", St = [
|
|
1127
1126
|
{
|
|
1128
1127
|
target: ".nice-entity-editor",
|
|
1129
1128
|
titleKey: "tutorial.entityEditor.intro.title",
|
|
@@ -1132,7 +1131,7 @@ const Wt = ee(
|
|
|
1132
1131
|
content: "Browse your entities in the list, then click one (or “New entity”) to edit its metadata, fields and validation on a dedicated screen.",
|
|
1133
1132
|
placement: "auto"
|
|
1134
1133
|
}
|
|
1135
|
-
],
|
|
1134
|
+
], Tt = {
|
|
1136
1135
|
type: "object",
|
|
1137
1136
|
properties: {
|
|
1138
1137
|
name: {
|
|
@@ -1173,7 +1172,7 @@ const Wt = ee(
|
|
|
1173
1172
|
}
|
|
1174
1173
|
},
|
|
1175
1174
|
required: ["name"]
|
|
1176
|
-
},
|
|
1175
|
+
}, Ft = {
|
|
1177
1176
|
type: "object",
|
|
1178
1177
|
properties: {
|
|
1179
1178
|
name: {
|
|
@@ -1269,7 +1268,7 @@ function he({ title: t, help: r }) {
|
|
|
1269
1268
|
r ? /* @__PURE__ */ e(X, { content: r, children: /* @__PURE__ */ e("span", { className: "nice-entity-editor__help", role: "img", "aria-label": r, children: /* @__PURE__ */ e(z, { name: "info", size: 14 }) }) }) : null
|
|
1270
1269
|
] });
|
|
1271
1270
|
}
|
|
1272
|
-
function
|
|
1271
|
+
function xt({
|
|
1273
1272
|
schema: t,
|
|
1274
1273
|
value: r,
|
|
1275
1274
|
onChange: a,
|
|
@@ -1277,16 +1276,16 @@ function Ft({
|
|
|
1277
1276
|
}) {
|
|
1278
1277
|
const o = t.properties ?? {};
|
|
1279
1278
|
return /* @__PURE__ */ e("div", { className: "nice-entity-editor__field-form", children: Object.entries(o).map(([i, n]) => {
|
|
1280
|
-
const c = r[i],
|
|
1279
|
+
const c = r[i], h = n.description, f = n.title ?? i;
|
|
1281
1280
|
if (n.type === "boolean")
|
|
1282
1281
|
return /* @__PURE__ */ e(
|
|
1283
1282
|
"div",
|
|
1284
1283
|
{
|
|
1285
1284
|
className: "nice-entity-editor__field-row nice-entity-editor__field-row--check",
|
|
1286
1285
|
children: /* @__PURE__ */ e(
|
|
1287
|
-
|
|
1286
|
+
Qe,
|
|
1288
1287
|
{
|
|
1289
|
-
label: /* @__PURE__ */ e(he, { title:
|
|
1288
|
+
label: /* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1290
1289
|
checked: !!c,
|
|
1291
1290
|
onChange: (s) => a(i, s),
|
|
1292
1291
|
disabled: l
|
|
@@ -1297,9 +1296,9 @@ function Ft({
|
|
|
1297
1296
|
);
|
|
1298
1297
|
if (Array.isArray(n.enum) && n.enum.length > 0)
|
|
1299
1298
|
return /* @__PURE__ */ u("div", { className: "nice-entity-editor__field-row", children: [
|
|
1300
|
-
/* @__PURE__ */ e(he, { title:
|
|
1299
|
+
/* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1301
1300
|
/* @__PURE__ */ e(
|
|
1302
|
-
|
|
1301
|
+
Xe,
|
|
1303
1302
|
{
|
|
1304
1303
|
options: n.enum.map((s) => ({ label: String(s), value: String(s) })),
|
|
1305
1304
|
value: c == null ? "" : String(c),
|
|
@@ -1311,9 +1310,9 @@ function Ft({
|
|
|
1311
1310
|
] }, i);
|
|
1312
1311
|
const y = n.type === "integer" || n.type === "number";
|
|
1313
1312
|
return /* @__PURE__ */ u("div", { className: "nice-entity-editor__field-row", children: [
|
|
1314
|
-
/* @__PURE__ */ e(he, { title:
|
|
1313
|
+
/* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1315
1314
|
/* @__PURE__ */ e(
|
|
1316
|
-
|
|
1315
|
+
Ze,
|
|
1317
1316
|
{
|
|
1318
1317
|
value: c == null ? "" : String(c),
|
|
1319
1318
|
onChange: (s) => a(i, y ? s === "" ? void 0 : Number(s) : s),
|
|
@@ -1323,13 +1322,13 @@ function Ft({
|
|
|
1323
1322
|
] }, i);
|
|
1324
1323
|
}) });
|
|
1325
1324
|
}
|
|
1326
|
-
function
|
|
1325
|
+
function Ct({
|
|
1327
1326
|
fields: t,
|
|
1328
1327
|
onChange: r,
|
|
1329
1328
|
fieldSchema: a,
|
|
1330
1329
|
readOnly: l
|
|
1331
1330
|
}) {
|
|
1332
|
-
const { t: o } = Z(), [i, n] =
|
|
1331
|
+
const { t: o } = Z(), [i, n] = M(null), c = q(() => t.map((s, m) => ({ ...s, [pe]: String(m) })), [t]), h = q(
|
|
1333
1332
|
() => [
|
|
1334
1333
|
{
|
|
1335
1334
|
field: "name",
|
|
@@ -1350,32 +1349,32 @@ function xt({
|
|
|
1350
1349
|
"entityEditor.field.flags.help",
|
|
1351
1350
|
"Key / required / unique / indexed constraints on this field"
|
|
1352
1351
|
),
|
|
1353
|
-
render: (s,
|
|
1352
|
+
render: (s, m) => {
|
|
1354
1353
|
const F = [
|
|
1355
|
-
[!!(
|
|
1356
|
-
[!!(
|
|
1354
|
+
[!!(m != null && m.isPrimaryKey), "PK", o("entityEditor.flag.pk", "Primary key"), "info"],
|
|
1355
|
+
[!!(m != null && m.isForeignKey), "FK", o("entityEditor.flag.fk", "Foreign key"), "info"],
|
|
1357
1356
|
[
|
|
1358
|
-
!!(
|
|
1357
|
+
!!(m != null && m.isRequired),
|
|
1359
1358
|
"Req",
|
|
1360
1359
|
o("entityEditor.flag.required", "Required (NOT NULL)"),
|
|
1361
1360
|
"warning"
|
|
1362
1361
|
],
|
|
1363
|
-
[!!(
|
|
1362
|
+
[!!(m != null && m.isUnique), "Uniq", o("entityEditor.flag.unique", "Unique"), "secondary"],
|
|
1364
1363
|
[
|
|
1365
|
-
!!(
|
|
1364
|
+
!!(m != null && m.isIndexed),
|
|
1366
1365
|
"Idx",
|
|
1367
1366
|
o("entityEditor.flag.indexed", "Indexed"),
|
|
1368
1367
|
"secondary"
|
|
1369
1368
|
]
|
|
1370
1369
|
];
|
|
1371
|
-
return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O,
|
|
1370
|
+
return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O, K, A]) => /* @__PURE__ */ e(X, { content: K, children: /* @__PURE__ */ e(ae, { variant: A, size: "sm", children: O }) }, O)) });
|
|
1372
1371
|
}
|
|
1373
1372
|
}
|
|
1374
1373
|
],
|
|
1375
1374
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1376
1375
|
[]
|
|
1377
|
-
),
|
|
1378
|
-
r(t.map((O,
|
|
1376
|
+
), f = (s, m, F) => {
|
|
1377
|
+
r(t.map((O, K) => K === s ? { ...O, [m]: F } : O));
|
|
1379
1378
|
}, y = () => {
|
|
1380
1379
|
const s = [...t, { name: `field${t.length + 1}`, dataType: "string" }];
|
|
1381
1380
|
r(s), n(s.length - 1);
|
|
@@ -1398,11 +1397,11 @@ function xt({
|
|
|
1398
1397
|
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String(s.name ?? o("entityEditor.field.untitled", "New field")) })
|
|
1399
1398
|
] }),
|
|
1400
1399
|
/* @__PURE__ */ e(
|
|
1401
|
-
|
|
1400
|
+
xt,
|
|
1402
1401
|
{
|
|
1403
1402
|
schema: a,
|
|
1404
1403
|
value: s,
|
|
1405
|
-
onChange: (
|
|
1404
|
+
onChange: (m, F) => f(i, m, F),
|
|
1406
1405
|
readOnly: l
|
|
1407
1406
|
}
|
|
1408
1407
|
),
|
|
@@ -1414,12 +1413,12 @@ function xt({
|
|
|
1414
1413
|
{
|
|
1415
1414
|
data: c,
|
|
1416
1415
|
keyField: pe,
|
|
1417
|
-
columns:
|
|
1416
|
+
columns: h,
|
|
1418
1417
|
searchable: !0,
|
|
1419
1418
|
searchPlaceholder: o("entityEditor.field.search", "Search fields…"),
|
|
1420
1419
|
emptyText: o("entityEditor.field.empty", "No fields yet. Add one to define this entity."),
|
|
1421
1420
|
onRowClick: (s) => n(Number(s[pe])),
|
|
1422
|
-
onRowDelete: l ? void 0 : (s) => r(t.filter((
|
|
1421
|
+
onRowDelete: l ? void 0 : (s) => r(t.filter((m, F) => F !== Number(s))),
|
|
1423
1422
|
toolbar: l ? void 0 : /* @__PURE__ */ e(
|
|
1424
1423
|
te,
|
|
1425
1424
|
{
|
|
@@ -1435,39 +1434,39 @@ function xt({
|
|
|
1435
1434
|
}
|
|
1436
1435
|
);
|
|
1437
1436
|
}
|
|
1438
|
-
const
|
|
1437
|
+
const It = /* @__PURE__ */ ee(
|
|
1439
1438
|
function(r, a) {
|
|
1440
1439
|
const {
|
|
1441
1440
|
value: l,
|
|
1442
1441
|
defaultValue: o,
|
|
1443
1442
|
onChange: i,
|
|
1444
|
-
entityMetaSchema: n =
|
|
1445
|
-
fieldSchema: c =
|
|
1446
|
-
fieldsKey:
|
|
1447
|
-
validationsKey:
|
|
1443
|
+
entityMetaSchema: n = Tt,
|
|
1444
|
+
fieldSchema: c = Ft,
|
|
1445
|
+
fieldsKey: h = "fields",
|
|
1446
|
+
validationsKey: f = "validations",
|
|
1448
1447
|
nameKey: y = "name",
|
|
1449
1448
|
renderErPreview: s,
|
|
1450
|
-
readOnly:
|
|
1449
|
+
readOnly: m = !1,
|
|
1451
1450
|
tutorial: F,
|
|
1452
1451
|
className: O,
|
|
1453
|
-
style:
|
|
1452
|
+
style: K,
|
|
1454
1453
|
id: A,
|
|
1455
1454
|
"data-testid": C
|
|
1456
|
-
} = r, { t:
|
|
1455
|
+
} = r, { t: N } = Z(), [$, J] = le({
|
|
1457
1456
|
value: l,
|
|
1458
1457
|
defaultValue: o,
|
|
1459
1458
|
fallbackValue: [],
|
|
1460
1459
|
onChange: i,
|
|
1461
1460
|
componentName: "NiceEntityEditor"
|
|
1462
|
-
}), [
|
|
1463
|
-
const T = S == null ? void 0 : S[
|
|
1461
|
+
}), [D, I] = M("list"), [v, k] = M(0), [j, U] = M("general"), L = Math.min(v, Math.max(0, $.length - 1)), S = $[L], H = D === "edit" && S != null, E = q(() => {
|
|
1462
|
+
const T = S == null ? void 0 : S[h];
|
|
1464
1463
|
return Array.isArray(T) ? T : [];
|
|
1465
|
-
}, [S,
|
|
1464
|
+
}, [S, h]), P = q(() => {
|
|
1466
1465
|
const T = (B) => {
|
|
1467
1466
|
const Y = B.toLowerCase();
|
|
1468
1467
|
return /(int|long|decimal|double|float|number|money)/.test(Y) ? "number" : /bool/.test(Y) ? "boolean" : /date|time/.test(Y) ? "date" : "string";
|
|
1469
1468
|
}, V = [];
|
|
1470
|
-
for (const B of
|
|
1469
|
+
for (const B of E) {
|
|
1471
1470
|
const Y = String(B.name ?? "");
|
|
1472
1471
|
Y && V.push({
|
|
1473
1472
|
field: Y,
|
|
@@ -1476,45 +1475,45 @@ const Ct = ee(
|
|
|
1476
1475
|
});
|
|
1477
1476
|
}
|
|
1478
1477
|
return V;
|
|
1479
|
-
}, [
|
|
1480
|
-
const T = S == null ? void 0 : S[
|
|
1478
|
+
}, [E]), p = q(() => {
|
|
1479
|
+
const T = S == null ? void 0 : S[f];
|
|
1481
1480
|
return Array.isArray(T) ? T : [];
|
|
1482
|
-
}, [S,
|
|
1481
|
+
}, [S, f]), _ = q(() => $.map((T, V) => ({ ...T, [me]: String(V) })), [$]), w = (T) => {
|
|
1483
1482
|
J($.map((V, B) => B === L ? { ...V, ...T } : V));
|
|
1484
1483
|
}, g = (T) => {
|
|
1485
|
-
|
|
1484
|
+
w({ [h]: T });
|
|
1486
1485
|
}, x = (T) => {
|
|
1487
1486
|
k(T), U("general"), I("edit");
|
|
1488
1487
|
}, R = () => {
|
|
1489
|
-
const T = [...$, { [y]: `Entity${$.length + 1}`, [
|
|
1488
|
+
const T = [...$, { [y]: `Entity${$.length + 1}`, [h]: [] }];
|
|
1490
1489
|
J(T), k(T.length - 1), U("general"), I("edit");
|
|
1491
1490
|
}, G = (T) => {
|
|
1492
1491
|
J($.filter((V, B) => B !== T)), k((V) => V >= T ? Math.max(0, V - 1) : V);
|
|
1493
|
-
}, re =
|
|
1492
|
+
}, re = q(
|
|
1494
1493
|
() => [
|
|
1495
1494
|
{
|
|
1496
1495
|
field: y,
|
|
1497
|
-
header:
|
|
1496
|
+
header: N("entityEditor.col.name", "Name"),
|
|
1498
1497
|
sortable: !0,
|
|
1499
1498
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__name", children: String(T ?? "") })
|
|
1500
1499
|
},
|
|
1501
1500
|
{
|
|
1502
1501
|
field: "displayName",
|
|
1503
|
-
header:
|
|
1502
|
+
header: N("entityEditor.col.displayName", "Display name"),
|
|
1504
1503
|
sortable: !0,
|
|
1505
1504
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__muted", children: String(T ?? "—") })
|
|
1506
1505
|
},
|
|
1507
1506
|
{
|
|
1508
1507
|
field: "tableName",
|
|
1509
|
-
header:
|
|
1508
|
+
header: N("entityEditor.col.table", "Table"),
|
|
1510
1509
|
sortable: !0,
|
|
1511
1510
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__muted", children: String(T ?? "—") })
|
|
1512
1511
|
},
|
|
1513
1512
|
{
|
|
1514
|
-
field:
|
|
1515
|
-
header:
|
|
1513
|
+
field: h,
|
|
1514
|
+
header: N("entityEditor.col.fields", "Fields"),
|
|
1516
1515
|
align: "center",
|
|
1517
|
-
headerTooltip:
|
|
1516
|
+
headerTooltip: N(
|
|
1518
1517
|
"entityEditor.col.fields.help",
|
|
1519
1518
|
"Number of fields defined on this entity"
|
|
1520
1519
|
),
|
|
@@ -1522,111 +1521,111 @@ const Ct = ee(
|
|
|
1522
1521
|
},
|
|
1523
1522
|
{
|
|
1524
1523
|
field: "__flags",
|
|
1525
|
-
header:
|
|
1524
|
+
header: N("entityEditor.col.flags", "Flags"),
|
|
1526
1525
|
render: (T, V) => /* @__PURE__ */ u("span", { className: "nice-entity-editor__flags", children: [
|
|
1527
1526
|
V != null && V.isAudited ? /* @__PURE__ */ e(
|
|
1528
1527
|
X,
|
|
1529
1528
|
{
|
|
1530
|
-
content:
|
|
1529
|
+
content: N(
|
|
1531
1530
|
"entityEditor.flag.audited",
|
|
1532
1531
|
"Audited — tracks who changed each record and when"
|
|
1533
1532
|
),
|
|
1534
|
-
children: /* @__PURE__ */ e(ae, { variant: "info", size: "sm", outline: !0, children:
|
|
1533
|
+
children: /* @__PURE__ */ e(ae, { variant: "info", size: "sm", outline: !0, children: N("entityEditor.flag.audited.abbr", "Audit") })
|
|
1535
1534
|
}
|
|
1536
1535
|
) : null,
|
|
1537
1536
|
V != null && V.isSoftDeleteEnabled ? /* @__PURE__ */ e(
|
|
1538
1537
|
X,
|
|
1539
1538
|
{
|
|
1540
|
-
content:
|
|
1539
|
+
content: N(
|
|
1541
1540
|
"entityEditor.flag.softDelete",
|
|
1542
1541
|
"Soft delete — rows are flagged deleted, never physically removed"
|
|
1543
1542
|
),
|
|
1544
|
-
children: /* @__PURE__ */ e(ae, { variant: "secondary", size: "sm", outline: !0, children:
|
|
1543
|
+
children: /* @__PURE__ */ e(ae, { variant: "secondary", size: "sm", outline: !0, children: N("entityEditor.flag.softDelete.abbr", "Soft-del") })
|
|
1545
1544
|
}
|
|
1546
1545
|
) : null
|
|
1547
1546
|
] })
|
|
1548
1547
|
}
|
|
1549
1548
|
],
|
|
1550
1549
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1551
|
-
[y,
|
|
1552
|
-
), W =
|
|
1550
|
+
[y, h]
|
|
1551
|
+
), W = q(() => {
|
|
1553
1552
|
const T = [
|
|
1554
1553
|
{
|
|
1555
1554
|
id: "general",
|
|
1556
|
-
label:
|
|
1555
|
+
label: N("entityEditor.tab.general", "General"),
|
|
1557
1556
|
content: S ? /* @__PURE__ */ e(
|
|
1558
1557
|
de,
|
|
1559
1558
|
{
|
|
1560
1559
|
schema: n,
|
|
1561
1560
|
value: S,
|
|
1562
|
-
onChange: (V) =>
|
|
1561
|
+
onChange: (V) => w(V),
|
|
1563
1562
|
columns: 2,
|
|
1564
|
-
readOnly:
|
|
1563
|
+
readOnly: m,
|
|
1565
1564
|
liveValidation: !0
|
|
1566
1565
|
}
|
|
1567
1566
|
) : null
|
|
1568
1567
|
},
|
|
1569
1568
|
{
|
|
1570
1569
|
id: "fields",
|
|
1571
|
-
label:
|
|
1572
|
-
badge:
|
|
1570
|
+
label: N("entityEditor.tab.fields", "Fields"),
|
|
1571
|
+
badge: E.length || void 0,
|
|
1573
1572
|
content: /* @__PURE__ */ e(
|
|
1574
|
-
|
|
1573
|
+
Ct,
|
|
1575
1574
|
{
|
|
1576
|
-
fields:
|
|
1575
|
+
fields: E,
|
|
1577
1576
|
onChange: g,
|
|
1578
1577
|
fieldSchema: c,
|
|
1579
|
-
readOnly:
|
|
1578
|
+
readOnly: m
|
|
1580
1579
|
}
|
|
1581
1580
|
)
|
|
1582
1581
|
},
|
|
1583
1582
|
{
|
|
1584
1583
|
id: "validation",
|
|
1585
|
-
label:
|
|
1586
|
-
badge:
|
|
1584
|
+
label: N("entityEditor.tab.validation", "Validation"),
|
|
1585
|
+
badge: p.length || void 0,
|
|
1587
1586
|
content: /* @__PURE__ */ e(
|
|
1588
|
-
|
|
1587
|
+
We,
|
|
1589
1588
|
{
|
|
1590
|
-
fields:
|
|
1591
|
-
value:
|
|
1592
|
-
onChange: (V) =>
|
|
1589
|
+
fields: P,
|
|
1590
|
+
value: p,
|
|
1591
|
+
onChange: (V) => w({ [f]: V })
|
|
1593
1592
|
}
|
|
1594
1593
|
)
|
|
1595
1594
|
}
|
|
1596
1595
|
];
|
|
1597
1596
|
return s && T.push({
|
|
1598
1597
|
id: "er",
|
|
1599
|
-
label:
|
|
1598
|
+
label: N("entityEditor.tab.er", "ER diagram"),
|
|
1600
1599
|
content: /* @__PURE__ */ e("div", { className: "nice-entity-editor__er", children: s($) })
|
|
1601
1600
|
}), T;
|
|
1602
1601
|
}, [
|
|
1603
1602
|
S,
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1603
|
+
E,
|
|
1604
|
+
p,
|
|
1605
|
+
P,
|
|
1607
1606
|
n,
|
|
1608
1607
|
c,
|
|
1609
|
-
|
|
1608
|
+
m,
|
|
1610
1609
|
s,
|
|
1611
1610
|
$
|
|
1612
1611
|
]), ie = "nice-entity-editor" + (O ? ` ${O}` : "");
|
|
1613
|
-
return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style:
|
|
1614
|
-
F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F,
|
|
1612
|
+
return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style: K, "data-testid": C, children: [
|
|
1613
|
+
F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F, St) }) }),
|
|
1615
1614
|
H ? /* @__PURE__ */ u("div", { className: "nice-entity-editor__edit", children: [
|
|
1616
1615
|
/* @__PURE__ */ u("header", { className: "nice-entity-editor__edit-header", children: [
|
|
1617
|
-
/* @__PURE__ */ e(X, { content:
|
|
1616
|
+
/* @__PURE__ */ e(X, { content: N("entityEditor.backHint", "Back to the entity list"), children: /* @__PURE__ */ e(
|
|
1618
1617
|
te,
|
|
1619
1618
|
{
|
|
1620
1619
|
variant: "ghost",
|
|
1621
1620
|
size: "sm",
|
|
1622
1621
|
leftIcon: /* @__PURE__ */ e(z, { name: "arrow-left", size: 14 }),
|
|
1623
1622
|
onClick: () => I("list"),
|
|
1624
|
-
children:
|
|
1623
|
+
children: N("entityEditor.back", "Entities")
|
|
1625
1624
|
}
|
|
1626
1625
|
) }),
|
|
1627
1626
|
/* @__PURE__ */ e("span", { className: "nice-entity-editor__breadcrumb-sep", children: "/" }),
|
|
1628
|
-
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String((S == null ? void 0 : S[y]) ??
|
|
1629
|
-
!
|
|
1627
|
+
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String((S == null ? void 0 : S[y]) ?? N("entityEditor.untitled", "Untitled entity")) }),
|
|
1628
|
+
!m && /* @__PURE__ */ e(X, { content: N("entityEditor.deleteHint", "Delete this entity"), children: /* @__PURE__ */ e(
|
|
1630
1629
|
te,
|
|
1631
1630
|
{
|
|
1632
1631
|
variant: "ghost",
|
|
@@ -1635,12 +1634,12 @@ const Ct = ee(
|
|
|
1635
1634
|
onClick: () => {
|
|
1636
1635
|
G(L), I("list");
|
|
1637
1636
|
},
|
|
1638
|
-
children:
|
|
1637
|
+
children: N("entityEditor.delete", "Delete")
|
|
1639
1638
|
}
|
|
1640
1639
|
) })
|
|
1641
1640
|
] }),
|
|
1642
1641
|
/* @__PURE__ */ e(
|
|
1643
|
-
|
|
1642
|
+
Ye,
|
|
1644
1643
|
{
|
|
1645
1644
|
tabs: W,
|
|
1646
1645
|
activeTab: j,
|
|
@@ -1655,18 +1654,18 @@ const Ct = ee(
|
|
|
1655
1654
|
keyField: me,
|
|
1656
1655
|
columns: re,
|
|
1657
1656
|
searchable: !0,
|
|
1658
|
-
searchPlaceholder:
|
|
1659
|
-
emptyText:
|
|
1657
|
+
searchPlaceholder: N("entityEditor.search", "Search entities…"),
|
|
1658
|
+
emptyText: N("entityEditor.empty", "No entities yet. Create one to get started."),
|
|
1660
1659
|
onRowClick: (T) => x(Number(T[me])),
|
|
1661
|
-
onRowDelete:
|
|
1662
|
-
toolbar:
|
|
1660
|
+
onRowDelete: m ? void 0 : (T) => G(Number(T)),
|
|
1661
|
+
toolbar: m ? void 0 : /* @__PURE__ */ e(
|
|
1663
1662
|
te,
|
|
1664
1663
|
{
|
|
1665
1664
|
variant: "primary",
|
|
1666
1665
|
size: "sm",
|
|
1667
1666
|
leftIcon: /* @__PURE__ */ e(z, { name: "plus", size: 14 }),
|
|
1668
1667
|
onClick: R,
|
|
1669
|
-
children:
|
|
1668
|
+
children: N("entityEditor.new", "New entity")
|
|
1670
1669
|
}
|
|
1671
1670
|
),
|
|
1672
1671
|
compact: !0,
|
|
@@ -1675,7 +1674,7 @@ const Ct = ee(
|
|
|
1675
1674
|
) })
|
|
1676
1675
|
] });
|
|
1677
1676
|
}
|
|
1678
|
-
),
|
|
1677
|
+
), At = [
|
|
1679
1678
|
{
|
|
1680
1679
|
target: ".nice-i18n-editor",
|
|
1681
1680
|
titleKey: "tutorial.i18nEditor.intro.title",
|
|
@@ -1700,7 +1699,7 @@ const Ct = ee(
|
|
|
1700
1699
|
content: "Add a new translation key or a new locale column here; new cells start empty and are flagged as missing.",
|
|
1701
1700
|
placement: "top"
|
|
1702
1701
|
}
|
|
1703
|
-
],
|
|
1702
|
+
], $t = /* @__PURE__ */ ee(
|
|
1704
1703
|
function(r, a) {
|
|
1705
1704
|
const {
|
|
1706
1705
|
value: l,
|
|
@@ -1708,137 +1707,137 @@ const Ct = ee(
|
|
|
1708
1707
|
onChange: i,
|
|
1709
1708
|
locales: n,
|
|
1710
1709
|
allowEditLocales: c = !0,
|
|
1711
|
-
allowEditKeys:
|
|
1712
|
-
highlightMissing:
|
|
1710
|
+
allowEditKeys: h = !0,
|
|
1711
|
+
highlightMissing: f = !0,
|
|
1713
1712
|
readOnly: y = !1,
|
|
1714
1713
|
tutorial: s,
|
|
1715
|
-
className:
|
|
1714
|
+
className: m,
|
|
1716
1715
|
style: F,
|
|
1717
1716
|
id: O,
|
|
1718
|
-
"data-testid":
|
|
1719
|
-
} = r, { t: A } =
|
|
1717
|
+
"data-testid": K
|
|
1718
|
+
} = r, { t: A } = xe(), [C, N] = rt({
|
|
1720
1719
|
value: l,
|
|
1721
1720
|
defaultValue: o,
|
|
1722
1721
|
fallbackValue: {},
|
|
1723
1722
|
onChange: i,
|
|
1724
1723
|
componentName: "NiceI18nEditor"
|
|
1725
|
-
}), [$, J] =
|
|
1726
|
-
const
|
|
1724
|
+
}), [$, J] = M(""), [D, I] = M(""), v = q(() => n ?? Object.keys(C), [n, C]), k = q(() => {
|
|
1725
|
+
const p = /* @__PURE__ */ new Set();
|
|
1727
1726
|
for (const _ of Object.keys(C))
|
|
1728
|
-
for (const
|
|
1729
|
-
|
|
1730
|
-
return [...
|
|
1731
|
-
}, [C]), j = (
|
|
1732
|
-
|
|
1733
|
-
}, U = (
|
|
1734
|
-
if (!_ || _ ===
|
|
1727
|
+
for (const w of Object.keys(C[_] ?? {}))
|
|
1728
|
+
p.add(w);
|
|
1729
|
+
return [...p].sort();
|
|
1730
|
+
}, [C]), j = (p, _, w) => {
|
|
1731
|
+
N({ ...C, [p]: { ...C[p] ?? {}, [_]: w } });
|
|
1732
|
+
}, U = (p, _) => {
|
|
1733
|
+
if (!_ || _ === p)
|
|
1735
1734
|
return;
|
|
1736
|
-
const
|
|
1735
|
+
const w = {};
|
|
1737
1736
|
for (const g of Object.keys(C)) {
|
|
1738
1737
|
const x = { ...C[g] ?? {} };
|
|
1739
|
-
|
|
1738
|
+
p in x && (x[_] = x[p], delete x[p]), w[g] = x;
|
|
1740
1739
|
}
|
|
1741
|
-
w
|
|
1742
|
-
}, L = (
|
|
1740
|
+
N(w);
|
|
1741
|
+
}, L = (p) => {
|
|
1743
1742
|
const _ = {};
|
|
1744
|
-
for (const
|
|
1745
|
-
const g = { ...C[
|
|
1746
|
-
delete g[
|
|
1743
|
+
for (const w of Object.keys(C)) {
|
|
1744
|
+
const g = { ...C[w] ?? {} };
|
|
1745
|
+
delete g[p], _[w] = g;
|
|
1747
1746
|
}
|
|
1748
|
-
|
|
1747
|
+
N(_);
|
|
1749
1748
|
}, S = () => {
|
|
1750
|
-
const
|
|
1751
|
-
if (!
|
|
1749
|
+
const p = $.trim();
|
|
1750
|
+
if (!p || k.includes(p))
|
|
1752
1751
|
return;
|
|
1753
1752
|
const _ = {};
|
|
1754
|
-
for (const
|
|
1755
|
-
_[
|
|
1756
|
-
for (const
|
|
1757
|
-
_[
|
|
1758
|
-
|
|
1753
|
+
for (const w of v)
|
|
1754
|
+
_[w] = { ...C[w] ?? {}, [p]: "" };
|
|
1755
|
+
for (const w of Object.keys(C))
|
|
1756
|
+
_[w] || (_[w] = C[w]);
|
|
1757
|
+
N(_), J("");
|
|
1759
1758
|
}, H = () => {
|
|
1760
|
-
const
|
|
1761
|
-
if (!
|
|
1759
|
+
const p = D.trim();
|
|
1760
|
+
if (!p || C[p])
|
|
1762
1761
|
return;
|
|
1763
1762
|
const _ = {};
|
|
1764
|
-
for (const
|
|
1765
|
-
_[
|
|
1766
|
-
|
|
1767
|
-
},
|
|
1763
|
+
for (const w of k)
|
|
1764
|
+
_[w] = "";
|
|
1765
|
+
N({ ...C, [p]: _ }), I("");
|
|
1766
|
+
}, E = (p) => {
|
|
1768
1767
|
const _ = { ...C };
|
|
1769
|
-
delete _[
|
|
1770
|
-
},
|
|
1771
|
-
return /* @__PURE__ */ u("div", { ref: a, id: O, className:
|
|
1772
|
-
s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s,
|
|
1768
|
+
delete _[p], N(_);
|
|
1769
|
+
}, P = "nice-i18n-editor" + (m ? ` ${m}` : "");
|
|
1770
|
+
return /* @__PURE__ */ u("div", { ref: a, id: O, className: P, style: F, "data-testid": K, children: [
|
|
1771
|
+
s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s, At) }) }),
|
|
1773
1772
|
/* @__PURE__ */ e("div", { className: "nice-i18n-editor__scroll", "data-tour": "i18n-grid", children: /* @__PURE__ */ u("table", { className: "nice-i18n-editor__table", children: [
|
|
1774
1773
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ u("tr", { children: [
|
|
1775
1774
|
/* @__PURE__ */ e("th", { className: "nice-i18n-editor__key-head", children: A("i18nEditor.keyHead", "Key") }),
|
|
1776
|
-
v.map((
|
|
1777
|
-
/* @__PURE__ */ e("span", { children:
|
|
1775
|
+
v.map((p) => /* @__PURE__ */ u("th", { className: "nice-i18n-editor__locale-head", children: [
|
|
1776
|
+
/* @__PURE__ */ e("span", { children: p }),
|
|
1778
1777
|
c && !y && /* @__PURE__ */ e(
|
|
1779
1778
|
"button",
|
|
1780
1779
|
{
|
|
1781
1780
|
type: "button",
|
|
1782
1781
|
className: "nice-i18n-editor__locale-remove",
|
|
1783
|
-
"aria-label": `${A("i18nEditor.removeLocale", "Remove locale")} ${
|
|
1784
|
-
onClick: () =>
|
|
1782
|
+
"aria-label": `${A("i18nEditor.removeLocale", "Remove locale")} ${p}`,
|
|
1783
|
+
onClick: () => E(p),
|
|
1785
1784
|
children: /* @__PURE__ */ e(be, { name: "close", size: 12 })
|
|
1786
1785
|
}
|
|
1787
1786
|
)
|
|
1788
|
-
] },
|
|
1787
|
+
] }, p))
|
|
1789
1788
|
] }) }),
|
|
1790
1789
|
/* @__PURE__ */ u("tbody", { children: [
|
|
1791
|
-
k.map((
|
|
1790
|
+
k.map((p) => /* @__PURE__ */ u("tr", { children: [
|
|
1792
1791
|
/* @__PURE__ */ u("td", { className: "nice-i18n-editor__key-cell", children: [
|
|
1793
|
-
|
|
1792
|
+
h && !y ? /* @__PURE__ */ e(
|
|
1794
1793
|
"input",
|
|
1795
1794
|
{
|
|
1796
1795
|
className: "nice-i18n-editor__key-input",
|
|
1797
|
-
defaultValue:
|
|
1798
|
-
onBlur: (_) => U(
|
|
1796
|
+
defaultValue: p,
|
|
1797
|
+
onBlur: (_) => U(p, _.target.value.trim()),
|
|
1799
1798
|
"aria-label": A("i18nEditor.keyAria", "Translation key")
|
|
1800
1799
|
}
|
|
1801
|
-
) : /* @__PURE__ */ e("span", { className: "nice-i18n-editor__key-text", children:
|
|
1802
|
-
|
|
1800
|
+
) : /* @__PURE__ */ e("span", { className: "nice-i18n-editor__key-text", children: p }),
|
|
1801
|
+
h && !y && /* @__PURE__ */ e(
|
|
1803
1802
|
"button",
|
|
1804
1803
|
{
|
|
1805
1804
|
type: "button",
|
|
1806
1805
|
className: "nice-i18n-editor__key-remove",
|
|
1807
|
-
"aria-label": `${A("i18nEditor.removeKey", "Remove key")} ${
|
|
1808
|
-
onClick: () => L(
|
|
1806
|
+
"aria-label": `${A("i18nEditor.removeKey", "Remove key")} ${p}`,
|
|
1807
|
+
onClick: () => L(p),
|
|
1809
1808
|
children: /* @__PURE__ */ e(be, { name: "close", size: 12 })
|
|
1810
1809
|
}
|
|
1811
1810
|
)
|
|
1812
1811
|
] }),
|
|
1813
1812
|
v.map((_) => {
|
|
1814
1813
|
var x;
|
|
1815
|
-
const
|
|
1814
|
+
const w = ((x = C[_]) == null ? void 0 : x[p]) ?? "";
|
|
1816
1815
|
return /* @__PURE__ */ e("td", { className: "nice-i18n-editor__cell", children: /* @__PURE__ */ e(
|
|
1817
1816
|
"input",
|
|
1818
1817
|
{
|
|
1819
|
-
className: "nice-i18n-editor__cell-input" + (
|
|
1820
|
-
value:
|
|
1818
|
+
className: "nice-i18n-editor__cell-input" + (f && w === "" ? " nice-i18n-editor__cell-input--missing" : ""),
|
|
1819
|
+
value: w,
|
|
1821
1820
|
readOnly: y,
|
|
1822
|
-
onChange: (R) => j(_,
|
|
1823
|
-
"aria-label": `${
|
|
1821
|
+
onChange: (R) => j(_, p, R.target.value),
|
|
1822
|
+
"aria-label": `${p} (${_})`
|
|
1824
1823
|
}
|
|
1825
1824
|
) }, _);
|
|
1826
1825
|
})
|
|
1827
|
-
] },
|
|
1826
|
+
] }, p)),
|
|
1828
1827
|
k.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "nice-i18n-editor__empty", colSpan: v.length + 1, children: A("i18nEditor.empty", "No translation keys yet.") }) })
|
|
1829
1828
|
] })
|
|
1830
1829
|
] }) }),
|
|
1831
|
-
!y && (
|
|
1832
|
-
|
|
1830
|
+
!y && (h || c) && /* @__PURE__ */ u("div", { className: "nice-i18n-editor__toolbar", "data-tour": "i18n-add", children: [
|
|
1831
|
+
h && /* @__PURE__ */ u("div", { className: "nice-i18n-editor__add", children: [
|
|
1833
1832
|
/* @__PURE__ */ e(
|
|
1834
1833
|
"input",
|
|
1835
1834
|
{
|
|
1836
1835
|
className: "nice-i18n-editor__add-input",
|
|
1837
1836
|
placeholder: A("i18nEditor.newKeyPlaceholder", "new.key"),
|
|
1838
1837
|
value: $,
|
|
1839
|
-
onChange: (
|
|
1840
|
-
onKeyDown: (
|
|
1841
|
-
|
|
1838
|
+
onChange: (p) => J(p.target.value),
|
|
1839
|
+
onKeyDown: (p) => {
|
|
1840
|
+
p.key === "Enter" && S();
|
|
1842
1841
|
},
|
|
1843
1842
|
"aria-label": A("i18nEditor.newKeyAria", "New key")
|
|
1844
1843
|
}
|
|
@@ -1854,10 +1853,10 @@ const Ct = ee(
|
|
|
1854
1853
|
{
|
|
1855
1854
|
className: "nice-i18n-editor__add-input",
|
|
1856
1855
|
placeholder: A("i18nEditor.newLocalePlaceholder", "locale (e.g. de)"),
|
|
1857
|
-
value:
|
|
1858
|
-
onChange: (
|
|
1859
|
-
onKeyDown: (
|
|
1860
|
-
|
|
1856
|
+
value: D,
|
|
1857
|
+
onChange: (p) => I(p.target.value),
|
|
1858
|
+
onKeyDown: (p) => {
|
|
1859
|
+
p.key === "Enter" && H();
|
|
1861
1860
|
},
|
|
1862
1861
|
"aria-label": A("i18nEditor.newLocaleAria", "New locale")
|
|
1863
1862
|
}
|
|
@@ -1870,7 +1869,7 @@ const Ct = ee(
|
|
|
1870
1869
|
] })
|
|
1871
1870
|
] });
|
|
1872
1871
|
}
|
|
1873
|
-
),
|
|
1872
|
+
), Mt = [
|
|
1874
1873
|
{
|
|
1875
1874
|
target: ".nice-module-editor",
|
|
1876
1875
|
titleKey: "tutorial.moduleEditor.intro.title",
|
|
@@ -1919,32 +1918,32 @@ const Ct = ee(
|
|
|
1919
1918
|
content: "Validation results and load/save activity are logged here.",
|
|
1920
1919
|
placement: "top"
|
|
1921
1920
|
}
|
|
1922
|
-
],
|
|
1921
|
+
], Ot = [], Xt = /* @__PURE__ */ ee(
|
|
1923
1922
|
function(r, a) {
|
|
1924
1923
|
var ge;
|
|
1925
1924
|
const {
|
|
1926
1925
|
dataProvider: l,
|
|
1927
|
-
manifestSections: o,
|
|
1926
|
+
manifestSections: o = Ot,
|
|
1928
1927
|
entityConfig: i,
|
|
1929
1928
|
locales: n,
|
|
1930
1929
|
validate: c,
|
|
1931
|
-
scriptRunner:
|
|
1932
|
-
triggers:
|
|
1930
|
+
scriptRunner: h,
|
|
1931
|
+
triggers: f,
|
|
1933
1932
|
bindings: y = [],
|
|
1934
1933
|
handlers: s,
|
|
1935
|
-
onBindingsChange:
|
|
1934
|
+
onBindingsChange: m,
|
|
1936
1935
|
revisions: F,
|
|
1937
1936
|
onRollback: O,
|
|
1938
|
-
loadContent:
|
|
1937
|
+
loadContent: K,
|
|
1939
1938
|
theme: A = "light",
|
|
1940
1939
|
height: C = 640,
|
|
1941
|
-
tutorial:
|
|
1940
|
+
tutorial: N,
|
|
1942
1941
|
className: $,
|
|
1943
1942
|
style: J,
|
|
1944
|
-
id:
|
|
1943
|
+
id: D,
|
|
1945
1944
|
"data-testid": I
|
|
1946
|
-
} = r, { t: v } = Z(), [k, j] =
|
|
1947
|
-
R((
|
|
1945
|
+
} = r, { t: v } = Z(), [k, j] = M([]), [U, L] = M(""), [S, H] = M(null), [E, P] = M(null), [p, _] = M(!1), [w, g] = M(!1), [x, R] = M([]), [G, re] = M(""), W = Q((d, b, Be) => {
|
|
1946
|
+
R((ze) => [...ze, { level: d, message: b, data: Be, timestamp: Date.now() }].slice(-200));
|
|
1948
1947
|
}, []), ie = Q(async () => {
|
|
1949
1948
|
g(!0);
|
|
1950
1949
|
try {
|
|
@@ -1963,7 +1962,7 @@ const Ct = ee(
|
|
|
1963
1962
|
g(!0);
|
|
1964
1963
|
try {
|
|
1965
1964
|
const b = await l.loadModule(d);
|
|
1966
|
-
|
|
1965
|
+
P(b), H(d), _(!1), W("info", `Loaded module ${d}`);
|
|
1967
1966
|
} catch (b) {
|
|
1968
1967
|
W("error", `Load failed: ${b instanceof Error ? b.message : String(b)}`);
|
|
1969
1968
|
} finally {
|
|
@@ -1972,24 +1971,24 @@ const Ct = ee(
|
|
|
1972
1971
|
},
|
|
1973
1972
|
[l, W]
|
|
1974
1973
|
), V = Q(async () => {
|
|
1975
|
-
if (!(!S || !
|
|
1974
|
+
if (!(!S || !E)) {
|
|
1976
1975
|
g(!0);
|
|
1977
1976
|
try {
|
|
1978
|
-
await l.saveModule(S,
|
|
1977
|
+
await l.saveModule(S, E), _(!1), W("info", `Saved module ${S}`);
|
|
1979
1978
|
} catch (d) {
|
|
1980
1979
|
W("error", `Save failed: ${d instanceof Error ? d.message : String(d)}`);
|
|
1981
1980
|
} finally {
|
|
1982
1981
|
g(!1);
|
|
1983
1982
|
}
|
|
1984
1983
|
}
|
|
1985
|
-
}, [S,
|
|
1986
|
-
if (!
|
|
1984
|
+
}, [S, E, l, W]), B = q(() => {
|
|
1985
|
+
if (!E)
|
|
1987
1986
|
return [];
|
|
1988
1987
|
const d = [];
|
|
1989
1988
|
for (const b of o)
|
|
1990
|
-
b.schema && d.push(...
|
|
1991
|
-
return c && d.push(...c(
|
|
1992
|
-
}, [
|
|
1989
|
+
b.schema && d.push(...Ae(E.manifest ?? {}, b.schema));
|
|
1990
|
+
return c && d.push(...c(E)), d;
|
|
1991
|
+
}, [E, o, c]), Y = Q(() => {
|
|
1993
1992
|
if (B.length === 0)
|
|
1994
1993
|
W("info", "Validation passed");
|
|
1995
1994
|
else {
|
|
@@ -1997,22 +1996,22 @@ const Ct = ee(
|
|
|
1997
1996
|
for (const d of B)
|
|
1998
1997
|
W("error", `${d.field}: ${d.message}`);
|
|
1999
1998
|
}
|
|
2000
|
-
}, [B, W]),
|
|
2001
|
-
|
|
2002
|
-
},
|
|
2003
|
-
|
|
2004
|
-
}, Ke = (d) => {
|
|
2005
|
-
q((b) => b && { ...b, i18n: d }), _(!0);
|
|
1999
|
+
}, [B, W]), $e = (d) => {
|
|
2000
|
+
P((b) => b && { ...b, manifest: d }), _(!0);
|
|
2001
|
+
}, Me = (d) => {
|
|
2002
|
+
P((b) => b && { ...b, entities: d }), _(!0);
|
|
2006
2003
|
}, Oe = (d) => {
|
|
2007
|
-
|
|
2004
|
+
P((b) => b && { ...b, i18n: d }), _(!0);
|
|
2005
|
+
}, Ke = (d) => {
|
|
2006
|
+
P((b) => b && { ...b, views: d }), _(!0);
|
|
2008
2007
|
}, De = (d) => {
|
|
2009
|
-
|
|
2010
|
-
}, Me = (d) => {
|
|
2011
|
-
q((b) => b && { ...b, dataSources: d }), _(!0);
|
|
2008
|
+
P((b) => b && { ...b, workflows: d }), _(!0);
|
|
2012
2009
|
}, Le = (d) => {
|
|
2013
|
-
|
|
2014
|
-
},
|
|
2015
|
-
|
|
2010
|
+
P((b) => b && { ...b, dataSources: d }), _(!0);
|
|
2011
|
+
}, Ve = (d) => {
|
|
2012
|
+
P((b) => b && { ...b, rbac: d }), _(!0);
|
|
2013
|
+
}, ne = q(() => {
|
|
2014
|
+
if (!E)
|
|
2016
2015
|
return [];
|
|
2017
2016
|
const d = o.map((b) => ({
|
|
2018
2017
|
key: `section:${b.id}`,
|
|
@@ -2024,8 +2023,8 @@ const Ct = ee(
|
|
|
2024
2023
|
schema: b.schema,
|
|
2025
2024
|
fields: b.fields,
|
|
2026
2025
|
uiSchema: b.uiSchema,
|
|
2027
|
-
value:
|
|
2028
|
-
onChange:
|
|
2026
|
+
value: E.manifest ?? {},
|
|
2027
|
+
onChange: $e,
|
|
2029
2028
|
showJsonView: !0
|
|
2030
2029
|
}
|
|
2031
2030
|
) })
|
|
@@ -2034,10 +2033,10 @@ const Ct = ee(
|
|
|
2034
2033
|
key: "entities",
|
|
2035
2034
|
label: v("moduleEditor.tab.entities", "Entities"),
|
|
2036
2035
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2037
|
-
|
|
2036
|
+
It,
|
|
2038
2037
|
{
|
|
2039
|
-
value:
|
|
2040
|
-
onChange:
|
|
2038
|
+
value: E.entities ?? [],
|
|
2039
|
+
onChange: Me,
|
|
2041
2040
|
entityMetaSchema: i == null ? void 0 : i.entityMetaSchema,
|
|
2042
2041
|
fieldSchema: i == null ? void 0 : i.fieldSchema,
|
|
2043
2042
|
fieldsKey: i == null ? void 0 : i.fieldsKey,
|
|
@@ -2048,57 +2047,57 @@ const Ct = ee(
|
|
|
2048
2047
|
}), d.push({
|
|
2049
2048
|
key: "i18n",
|
|
2050
2049
|
label: v("moduleEditor.tab.i18n", "i18n"),
|
|
2051
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2050
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e($t, { value: E.i18n ?? {}, onChange: Oe, locales: n }) })
|
|
2052
2051
|
}), d.push({
|
|
2053
2052
|
key: "views",
|
|
2054
2053
|
label: v("moduleEditor.tab.views", "Views"),
|
|
2055
2054
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2056
2055
|
Kt,
|
|
2057
2056
|
{
|
|
2058
|
-
views:
|
|
2059
|
-
entities:
|
|
2060
|
-
onChange:
|
|
2057
|
+
views: E.views ?? [],
|
|
2058
|
+
entities: E.entities ?? [],
|
|
2059
|
+
onChange: Ke
|
|
2061
2060
|
}
|
|
2062
2061
|
) })
|
|
2063
2062
|
}), d.push({
|
|
2064
2063
|
key: "workflows",
|
|
2065
2064
|
label: v("moduleEditor.tab.workflows", "Workflows"),
|
|
2066
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2065
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Dt, { workflows: E.workflows ?? [], onChange: De }) })
|
|
2067
2066
|
}), d.push({
|
|
2068
2067
|
key: "data",
|
|
2069
2068
|
label: v("moduleEditor.tab.data", "Data"),
|
|
2070
2069
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2071
|
-
|
|
2070
|
+
Pt,
|
|
2072
2071
|
{
|
|
2073
|
-
dataSources:
|
|
2074
|
-
schemas:
|
|
2075
|
-
onChange:
|
|
2072
|
+
dataSources: E.dataSources ?? [],
|
|
2073
|
+
schemas: Lt(E.entities ?? []),
|
|
2074
|
+
onChange: Le
|
|
2076
2075
|
}
|
|
2077
2076
|
) })
|
|
2078
2077
|
}), d.push({
|
|
2079
2078
|
key: "permissions",
|
|
2080
2079
|
label: v("moduleEditor.tab.permissions", "Permissions"),
|
|
2081
2080
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2082
|
-
|
|
2081
|
+
et,
|
|
2083
2082
|
{
|
|
2084
|
-
value:
|
|
2085
|
-
onChange:
|
|
2083
|
+
value: E.rbac ?? Vt(E),
|
|
2084
|
+
onChange: Ve
|
|
2086
2085
|
}
|
|
2087
2086
|
) })
|
|
2088
|
-
}),
|
|
2087
|
+
}), h && d.push({
|
|
2089
2088
|
key: "scripts",
|
|
2090
2089
|
label: v("moduleEditor.tab.scripts", "Scripts"),
|
|
2091
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(we, { ...
|
|
2092
|
-
}),
|
|
2090
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(we, { ...h }) })
|
|
2091
|
+
}), f && f.length > 0 && d.push({
|
|
2093
2092
|
key: "lifecycle",
|
|
2094
2093
|
label: v("moduleEditor.tab.lifecycle", "Lifecycle"),
|
|
2095
2094
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2096
2095
|
ke,
|
|
2097
2096
|
{
|
|
2098
|
-
triggers:
|
|
2097
|
+
triggers: f,
|
|
2099
2098
|
bindings: y,
|
|
2100
2099
|
handlers: s,
|
|
2101
|
-
onChange: (b) =>
|
|
2100
|
+
onChange: (b) => m == null ? void 0 : m(b),
|
|
2102
2101
|
groupByTrigger: !0,
|
|
2103
2102
|
allowCondition: !0
|
|
2104
2103
|
}
|
|
@@ -2111,22 +2110,22 @@ const Ct = ee(
|
|
|
2111
2110
|
{
|
|
2112
2111
|
revisions: F,
|
|
2113
2112
|
onRollback: O,
|
|
2114
|
-
loadContent:
|
|
2113
|
+
loadContent: K,
|
|
2115
2114
|
language: "json"
|
|
2116
2115
|
}
|
|
2117
2116
|
) })
|
|
2118
2117
|
}), d.push({
|
|
2119
2118
|
key: "source",
|
|
2120
2119
|
label: v("moduleEditor.tab.source", "Source"),
|
|
2121
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e("pre", { className: "nice-module-editor__source", children: JSON.stringify(
|
|
2120
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e("pre", { className: "nice-module-editor__source", children: JSON.stringify(E, null, 2) }) })
|
|
2122
2121
|
}), d;
|
|
2123
2122
|
}, [
|
|
2124
|
-
|
|
2123
|
+
E,
|
|
2125
2124
|
o,
|
|
2126
2125
|
i,
|
|
2127
2126
|
n,
|
|
2127
|
+
h,
|
|
2128
2128
|
f,
|
|
2129
|
-
p,
|
|
2130
2129
|
y,
|
|
2131
2130
|
s,
|
|
2132
2131
|
F,
|
|
@@ -2135,14 +2134,14 @@ const Ct = ee(
|
|
|
2135
2134
|
oe(() => {
|
|
2136
2135
|
ne.length > 0 && !ne.some((d) => d.key === G) && re(ne[0].key);
|
|
2137
2136
|
}, [ne, G]);
|
|
2138
|
-
const ye =
|
|
2137
|
+
const ye = q(() => {
|
|
2139
2138
|
const d = U.trim().toLowerCase();
|
|
2140
2139
|
return d ? k.filter(
|
|
2141
2140
|
(b) => b.id.toLowerCase().includes(d) || (b.name ?? "").toLowerCase().includes(d) || (b.category ?? "").toLowerCase().includes(d)
|
|
2142
2141
|
) : k;
|
|
2143
|
-
}, [k, U]),
|
|
2142
|
+
}, [k, U]), Pe = q(() => {
|
|
2144
2143
|
const d = [];
|
|
2145
|
-
return S && d.push({ key: "mod", label: S + (
|
|
2144
|
+
return S && d.push({ key: "mod", label: S + (p ? " •" : ""), position: "left" }), d.push({
|
|
2146
2145
|
key: "val",
|
|
2147
2146
|
label: /* @__PURE__ */ u("span", { className: "nice-module-editor__status", children: [
|
|
2148
2147
|
/* @__PURE__ */ e(z, { name: B.length === 0 ? "check" : "warning", size: 12 }),
|
|
@@ -2150,7 +2149,7 @@ const Ct = ee(
|
|
|
2150
2149
|
] }),
|
|
2151
2150
|
position: "left"
|
|
2152
2151
|
}), d;
|
|
2153
|
-
}, [S,
|
|
2152
|
+
}, [S, p, B.length, v]), qe = /* @__PURE__ */ u("div", { className: "nice-module-editor__browser", "data-tour": "nme-browser", children: [
|
|
2154
2153
|
/* @__PURE__ */ e(
|
|
2155
2154
|
"input",
|
|
2156
2155
|
{
|
|
@@ -2176,18 +2175,18 @@ const Ct = ee(
|
|
|
2176
2175
|
},
|
|
2177
2176
|
d.id
|
|
2178
2177
|
)),
|
|
2179
|
-
ye.length === 0 && /* @__PURE__ */ e("div", { className: "nice-module-editor__browser-empty", children:
|
|
2178
|
+
ye.length === 0 && /* @__PURE__ */ e("div", { className: "nice-module-editor__browser-empty", children: w ? v("moduleEditor.loading", "Loading…") : v("moduleEditor.noModules", "No modules. Open a source first.") })
|
|
2180
2179
|
] })
|
|
2181
|
-
] }),
|
|
2182
|
-
/* @__PURE__ */ e("strong", { className: "nice-module-editor__title", "data-tour": "nme-tabs", children: S ? ((ge =
|
|
2183
|
-
|
|
2180
|
+
] }), Re = /* @__PURE__ */ u("div", { className: "nice-module-editor__toolbar", children: [
|
|
2181
|
+
/* @__PURE__ */ e("strong", { className: "nice-module-editor__title", "data-tour": "nme-tabs", children: S ? ((ge = E == null ? void 0 : E.manifest) == null ? void 0 : ge.packageName) ?? S : v("moduleEditor.title", "Module Editor") }),
|
|
2182
|
+
N && /* @__PURE__ */ e(se, { steps: ce(N, Mt) }),
|
|
2184
2183
|
/* @__PURE__ */ e("span", { className: "nice-module-editor__spacer" }),
|
|
2185
|
-
/* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled:
|
|
2184
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled: w, children: [
|
|
2186
2185
|
/* @__PURE__ */ e(z, { name: "refresh", size: 14 }),
|
|
2187
2186
|
" ",
|
|
2188
2187
|
v("moduleEditor.refresh", "Refresh")
|
|
2189
2188
|
] }),
|
|
2190
|
-
/* @__PURE__ */ u("button", { type: "button", "data-tour": "nme-validate", onClick: Y, disabled: !
|
|
2189
|
+
/* @__PURE__ */ u("button", { type: "button", "data-tour": "nme-validate", onClick: Y, disabled: !E, children: [
|
|
2191
2190
|
/* @__PURE__ */ e(z, { name: "check", size: 14 }),
|
|
2192
2191
|
" ",
|
|
2193
2192
|
v("moduleEditor.validate", "Validate")
|
|
@@ -2199,27 +2198,27 @@ const Ct = ee(
|
|
|
2199
2198
|
"data-tour": "nme-save",
|
|
2200
2199
|
className: "nice-module-editor__save",
|
|
2201
2200
|
onClick: () => void V(),
|
|
2202
|
-
disabled: !
|
|
2203
|
-
children:
|
|
2201
|
+
disabled: !E || !p || w,
|
|
2202
|
+
children: w ? v("moduleEditor.saving", "Saving…") : v("moduleEditor.save", "Save")
|
|
2204
2203
|
}
|
|
2205
2204
|
)
|
|
2206
|
-
] }),
|
|
2205
|
+
] }), je = "nice-module-editor" + ($ ? ` ${$}` : "");
|
|
2207
2206
|
return /* @__PURE__ */ e(
|
|
2208
2207
|
Te,
|
|
2209
2208
|
{
|
|
2210
2209
|
ref: a,
|
|
2211
|
-
id:
|
|
2212
|
-
className:
|
|
2210
|
+
id: D,
|
|
2211
|
+
className: je,
|
|
2213
2212
|
style: { height: C, ...J },
|
|
2214
2213
|
"data-testid": I,
|
|
2215
2214
|
theme: A,
|
|
2216
2215
|
tabs: ne,
|
|
2217
2216
|
activeTabKey: G,
|
|
2218
2217
|
onTabChange: re,
|
|
2219
|
-
toolbar:
|
|
2218
|
+
toolbar: Re,
|
|
2220
2219
|
sidePanel: qe,
|
|
2221
2220
|
sidePanelWidth: 260,
|
|
2222
|
-
statusItems:
|
|
2221
|
+
statusItems: Pe,
|
|
2223
2222
|
bottomPanel: /* @__PURE__ */ e("div", { "data-tour": "nme-output", style: { height: "100%" }, children: /* @__PURE__ */ e(
|
|
2224
2223
|
Fe,
|
|
2225
2224
|
{
|
|
@@ -2229,7 +2228,7 @@ const Ct = ee(
|
|
|
2229
2228
|
maxHeight: "100%"
|
|
2230
2229
|
}
|
|
2231
2230
|
) }),
|
|
2232
|
-
children: !
|
|
2231
|
+
children: !E && /* @__PURE__ */ e("div", { className: "nice-module-editor__placeholder", children: v("moduleEditor.placeholder", "Select a module from the left to start editing.") })
|
|
2233
2232
|
}
|
|
2234
2233
|
);
|
|
2235
2234
|
}
|
|
@@ -2240,9 +2239,9 @@ function Kt({
|
|
|
2240
2239
|
onChange: a
|
|
2241
2240
|
}) {
|
|
2242
2241
|
var y;
|
|
2243
|
-
const { t: l } = Z(), [o, i] =
|
|
2244
|
-
a(t.map((
|
|
2245
|
-
},
|
|
2242
|
+
const { t: l } = Z(), [o, i] = M(((y = t[0]) == null ? void 0 : y.id) ?? null), n = t.find((s) => s.id === o) ?? null, c = (s) => {
|
|
2243
|
+
a(t.map((m) => m.id === o ? s : m)), s.id !== o && i(s.id);
|
|
2244
|
+
}, h = () => {
|
|
2246
2245
|
const s = {
|
|
2247
2246
|
id: `view-${Date.now().toString(36)}`,
|
|
2248
2247
|
name: "New View",
|
|
@@ -2252,8 +2251,8 @@ function Kt({
|
|
|
2252
2251
|
dataSources: []
|
|
2253
2252
|
};
|
|
2254
2253
|
a([...t, s]), i(s.id);
|
|
2255
|
-
},
|
|
2256
|
-
a(t.filter((
|
|
2254
|
+
}, f = (s) => {
|
|
2255
|
+
a(t.filter((m) => m.id !== s)), o === s && i(null);
|
|
2257
2256
|
};
|
|
2258
2257
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
2259
2258
|
/* @__PURE__ */ u("div", { className: "nice-module-views__bar", children: [
|
|
@@ -2270,24 +2269,24 @@ function Kt({
|
|
|
2270
2269
|
]
|
|
2271
2270
|
}
|
|
2272
2271
|
),
|
|
2273
|
-
/* @__PURE__ */ u("button", { type: "button", onClick:
|
|
2272
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: h, children: [
|
|
2274
2273
|
"+ ",
|
|
2275
2274
|
l("moduleEditor.views.new", "New view")
|
|
2276
2275
|
] }),
|
|
2277
|
-
n && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2276
|
+
n && /* @__PURE__ */ e("button", { type: "button", onClick: () => f(n.id), children: l("moduleEditor.delete", "Delete") })
|
|
2278
2277
|
] }),
|
|
2279
|
-
n ? /* @__PURE__ */ e(
|
|
2278
|
+
n ? /* @__PURE__ */ e(tt, { value: n, onChange: c, entities: r, height: 520 }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: l(
|
|
2280
2279
|
"moduleEditor.views.empty",
|
|
2281
2280
|
"No view selected. Create one, then use “New from entity” inside the editor."
|
|
2282
2281
|
) })
|
|
2283
2282
|
] });
|
|
2284
2283
|
}
|
|
2285
|
-
function
|
|
2284
|
+
function Dt({
|
|
2286
2285
|
workflows: t,
|
|
2287
2286
|
onChange: r
|
|
2288
2287
|
}) {
|
|
2289
|
-
var
|
|
2290
|
-
const { t: a } = Z(), [l, o] =
|
|
2288
|
+
var f;
|
|
2289
|
+
const { t: a } = Z(), [l, o] = M(((f = t[0]) == null ? void 0 : f.id) ?? null), i = t.find((y) => y.id === l) ?? null, n = (y) => {
|
|
2291
2290
|
r(t.map((s) => s.id === l ? y : s)), y.id !== l && o(y.id);
|
|
2292
2291
|
}, c = () => {
|
|
2293
2292
|
const y = {
|
|
@@ -2299,7 +2298,7 @@ function Ot({
|
|
|
2299
2298
|
transitions: []
|
|
2300
2299
|
};
|
|
2301
2300
|
r([...t, y]), o(y.id);
|
|
2302
|
-
},
|
|
2301
|
+
}, h = (y) => {
|
|
2303
2302
|
r(t.filter((s) => s.id !== y)), l === y && o(null);
|
|
2304
2303
|
};
|
|
2305
2304
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
@@ -2321,15 +2320,15 @@ function Ot({
|
|
|
2321
2320
|
"+ ",
|
|
2322
2321
|
a("moduleEditor.workflows.new", "New workflow")
|
|
2323
2322
|
] }),
|
|
2324
|
-
i && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2323
|
+
i && /* @__PURE__ */ e("button", { type: "button", onClick: () => h(i.id), children: a("moduleEditor.delete", "Delete") })
|
|
2325
2324
|
] }),
|
|
2326
|
-
i ? /* @__PURE__ */ e(
|
|
2325
|
+
i ? /* @__PURE__ */ e(it, { workflow: i, onChange: n }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: a(
|
|
2327
2326
|
"moduleEditor.workflows.empty",
|
|
2328
2327
|
"No workflow selected. Create one to start designing states and transitions."
|
|
2329
2328
|
) })
|
|
2330
2329
|
] });
|
|
2331
2330
|
}
|
|
2332
|
-
function
|
|
2331
|
+
function Lt(t) {
|
|
2333
2332
|
return t.map((r) => {
|
|
2334
2333
|
const a = r;
|
|
2335
2334
|
return {
|
|
@@ -2343,7 +2342,7 @@ function Dt(t) {
|
|
|
2343
2342
|
};
|
|
2344
2343
|
});
|
|
2345
2344
|
}
|
|
2346
|
-
function
|
|
2345
|
+
function Vt(t) {
|
|
2347
2346
|
const r = t.manifest ?? {}, a = String(r.displayName || r.packageName || "Module"), l = (t.views ?? []).map((i) => ({
|
|
2348
2347
|
id: `view:${i.id}`,
|
|
2349
2348
|
label: i.name,
|
|
@@ -2377,15 +2376,15 @@ function Mt(t) {
|
|
|
2377
2376
|
grants: {}
|
|
2378
2377
|
};
|
|
2379
2378
|
}
|
|
2380
|
-
function
|
|
2379
|
+
function Pt({
|
|
2381
2380
|
dataSources: t,
|
|
2382
2381
|
schemas: r,
|
|
2383
2382
|
onChange: a
|
|
2384
2383
|
}) {
|
|
2385
2384
|
var y;
|
|
2386
|
-
const { t: l } = Z(), [o, i] =
|
|
2387
|
-
a(t.map((
|
|
2388
|
-
},
|
|
2385
|
+
const { t: l } = Z(), [o, i] = M(((y = t[0]) == null ? void 0 : y.key) ?? null), n = t.find((s) => s.key === o) ?? null, c = (s) => {
|
|
2386
|
+
a(t.map((m) => m.key === o ? s : m)), s.key !== o && i(s.key);
|
|
2387
|
+
}, h = () => {
|
|
2389
2388
|
const s = {
|
|
2390
2389
|
key: `ds-${Date.now().toString(36)}`,
|
|
2391
2390
|
kind: "query",
|
|
@@ -2393,8 +2392,8 @@ function Lt({
|
|
|
2393
2392
|
sql: ""
|
|
2394
2393
|
};
|
|
2395
2394
|
a([...t, s]), i(s.key);
|
|
2396
|
-
},
|
|
2397
|
-
a(t.filter((
|
|
2395
|
+
}, f = (s) => {
|
|
2396
|
+
a(t.filter((m) => m.key !== s)), o === s && i(null);
|
|
2398
2397
|
};
|
|
2399
2398
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
2400
2399
|
/* @__PURE__ */ u("div", { className: "nice-module-views__bar", children: [
|
|
@@ -2411,13 +2410,13 @@ function Lt({
|
|
|
2411
2410
|
]
|
|
2412
2411
|
}
|
|
2413
2412
|
),
|
|
2414
|
-
/* @__PURE__ */ u("button", { type: "button", onClick:
|
|
2413
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: h, children: [
|
|
2415
2414
|
"+ ",
|
|
2416
2415
|
l("moduleEditor.data.new", "New data source")
|
|
2417
2416
|
] }),
|
|
2418
|
-
n && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2417
|
+
n && /* @__PURE__ */ e("button", { type: "button", onClick: () => f(n.key), children: l("moduleEditor.delete", "Delete") })
|
|
2419
2418
|
] }),
|
|
2420
|
-
n ? /* @__PURE__ */ e(
|
|
2419
|
+
n ? /* @__PURE__ */ e(nt, { value: n, onChange: c, schemas: r }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: l(
|
|
2421
2420
|
"moduleEditor.data.empty",
|
|
2422
2421
|
"No data source selected. Create one to build a query from your module’s schema."
|
|
2423
2422
|
) })
|
|
@@ -2425,18 +2424,18 @@ function Lt({
|
|
|
2425
2424
|
}
|
|
2426
2425
|
export {
|
|
2427
2426
|
pt as NiceArrayField,
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2427
|
+
It as NiceEntityEditor,
|
|
2428
|
+
Gt as NiceFormBuilderAI,
|
|
2429
|
+
$t as NiceI18nEditor,
|
|
2430
|
+
Qt as NiceManifestEditor,
|
|
2431
|
+
Xt as NiceModuleEditor,
|
|
2433
2432
|
de as NiceSchemaForm,
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2433
|
+
Yt as defineManifestSection,
|
|
2434
|
+
Jt as formBuilderSchemaToNiceFormItems,
|
|
2435
|
+
Ie as formFieldsToFormItems,
|
|
2436
|
+
Wt as formSchemaToJsonSchema,
|
|
2437
|
+
Ce as jsonSchemaToFormItems,
|
|
2438
|
+
Ut as schemaToFormItems,
|
|
2439
|
+
Ae as validateAgainstJsonSchema,
|
|
2440
|
+
Ht as validateFormSchema
|
|
2442
2441
|
};
|