@nice2dev/ui-forms 1.2.1 → 1.3.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/index.cjs +3 -3
- package/dist/index.mjs +337 -333
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
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
6
|
function Jt(t) {
|
|
7
7
|
var l, o;
|
|
8
8
|
const r = {
|
|
@@ -106,45 +106,47 @@ function Ht(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];
|
|
@@ -337,31 +339,31 @@ const pt = /* @__PURE__ */ 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
|
-
}), K = n.properties ?? {}, A = q(() => (
|
|
353
|
+
}), K = n.properties ?? {}, A = q(() => (f ?? Object.keys(K)).map((I) => {
|
|
352
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
|
-
),
|
|
359
|
+
), N = q(() => F.map((D, I) => ({ ...D, [ue]: String(I) })), [F]), $ = (D) => {
|
|
358
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,8 +371,8 @@ const pt = /* @__PURE__ */ 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
|
+
onRowAdd: h ? void 0 : (D) => O([...F, $(D)]),
|
|
375
|
+
onRowEdit: h ? void 0 : (D, I) => {
|
|
374
376
|
const v = Number(D);
|
|
375
377
|
O(
|
|
376
378
|
F.map(
|
|
@@ -378,7 +380,7 @@ const pt = /* @__PURE__ */ ee(
|
|
|
378
380
|
)
|
|
379
381
|
);
|
|
380
382
|
},
|
|
381
|
-
onRowDelete:
|
|
383
|
+
onRowDelete: h ? void 0 : (D) => {
|
|
382
384
|
const I = Number(D);
|
|
383
385
|
O(F.filter((v, k) => k !== I));
|
|
384
386
|
}
|
|
@@ -442,59 +444,59 @@ const de = /* @__PURE__ */ 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
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
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] = M(!1), [U, L] = M(""), [S, H] = M(null),
|
|
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
|
+
}) : o ? Ie(o, { uiSchema: i }) : [], [l, o, i, F]), P = q(() => {
|
|
480
|
+
const w = l ? Ae(I, l) : o ? yt(o, I) : [];
|
|
479
481
|
if (K != null && K.length) {
|
|
480
482
|
const g = Ee(K, I).filter((x) => x.severity === "error").map((x) => ({ field: x.field, message: x.message }));
|
|
481
|
-
return [...
|
|
483
|
+
return [...w, ...g];
|
|
482
484
|
}
|
|
483
|
-
return
|
|
485
|
+
return w;
|
|
484
486
|
}, [l, o, I, K]);
|
|
485
487
|
oe(() => {
|
|
486
|
-
|
|
487
|
-
}, [P,
|
|
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(
|
|
@@ -532,8 +534,8 @@ const de = /* @__PURE__ */ 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);
|
|
@@ -548,17 +550,17 @@ const de = /* @__PURE__ */ 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 && P.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-schema-form__errors", role: "alert", children: P.map((
|
|
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 = [
|
|
@@ -642,11 +644,11 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
642
644
|
enableGenerate: i = !0,
|
|
643
645
|
enableSuggestions: n = !0,
|
|
644
646
|
onGenerate: c,
|
|
645
|
-
showAIToolbar:
|
|
646
|
-
templates:
|
|
647
|
+
showAIToolbar: h = !0,
|
|
648
|
+
templates: f = gt,
|
|
647
649
|
fields: y,
|
|
648
650
|
onChange: s
|
|
649
|
-
} = r, [
|
|
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(
|
|
650
652
|
async (g) => {
|
|
651
653
|
if (!S || !i || !g.trim())
|
|
652
654
|
return [];
|
|
@@ -658,24 +660,25 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
658
660
|
}
|
|
659
661
|
},
|
|
660
662
|
[S, i, U, c]
|
|
661
|
-
),
|
|
663
|
+
), E = Q(
|
|
662
664
|
(g) => {
|
|
663
665
|
const x = vt(g);
|
|
664
|
-
$((R) => [...R, ...x]), s == null || s([...
|
|
666
|
+
$((R) => [...R, ...x]), s == null || s([...N, ...x]), F(!1), C([]), K("");
|
|
665
667
|
},
|
|
666
|
-
|
|
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(() => {
|
|
668
671
|
$([]), s == null || s([]);
|
|
669
672
|
}, [s]), _ = (g) => {
|
|
670
673
|
K(g.description), D(!1), H(g.description);
|
|
671
674
|
};
|
|
672
|
-
|
|
675
|
+
ot(a, () => ({
|
|
673
676
|
generateForm: H,
|
|
674
677
|
getFields: P,
|
|
675
|
-
applyFields:
|
|
676
|
-
clearFields:
|
|
678
|
+
applyFields: E,
|
|
679
|
+
clearFields: p
|
|
677
680
|
}));
|
|
678
|
-
const
|
|
681
|
+
const w = (g) => ({
|
|
679
682
|
text: "edit",
|
|
680
683
|
textarea: "file",
|
|
681
684
|
number: "hash",
|
|
@@ -691,9 +694,9 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
691
694
|
rating: "star"
|
|
692
695
|
})[g] || "edit";
|
|
693
696
|
return /* @__PURE__ */ u("div", { className: "nice-form-builder-ai", "data-testid": r["data-testid"], children: [
|
|
694
|
-
|
|
697
|
+
h && S && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar", children: [
|
|
695
698
|
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-left", children: [
|
|
696
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: "AI" }),
|
|
699
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: k("formBuilderAI.ai", "AI") }),
|
|
697
700
|
L && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__loading", children: k("formBuilderAI.generating", "Generating...") })
|
|
698
701
|
] }),
|
|
699
702
|
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-right", children: [
|
|
@@ -727,7 +730,7 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
727
730
|
]
|
|
728
731
|
}
|
|
729
732
|
),
|
|
730
|
-
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children:
|
|
733
|
+
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: f.map((g, x) => /* @__PURE__ */ u(
|
|
731
734
|
"button",
|
|
732
735
|
{
|
|
733
736
|
type: "button",
|
|
@@ -746,16 +749,17 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
746
749
|
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__builder-wrapper", children: /* @__PURE__ */ e(
|
|
747
750
|
de,
|
|
748
751
|
{
|
|
749
|
-
fields:
|
|
752
|
+
fields: N,
|
|
750
753
|
value: I,
|
|
751
754
|
onChange: v,
|
|
752
755
|
columns: 1
|
|
753
756
|
}
|
|
754
757
|
) }),
|
|
755
|
-
|
|
758
|
+
m && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel", children: [
|
|
756
759
|
/* @__PURE__ */ e(
|
|
757
760
|
"div",
|
|
758
761
|
{
|
|
762
|
+
role: "presentation",
|
|
759
763
|
className: "nice-form-builder-ai__panel-overlay",
|
|
760
764
|
onClick: () => F(!1)
|
|
761
765
|
}
|
|
@@ -813,7 +817,7 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
813
817
|
String(A.length)
|
|
814
818
|
) }),
|
|
815
819
|
/* @__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: [
|
|
816
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name:
|
|
820
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: w(g.type), size: "sm" }) }),
|
|
817
821
|
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
|
|
818
822
|
/* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
|
|
819
823
|
g.label,
|
|
@@ -821,10 +825,10 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
821
825
|
] }),
|
|
822
826
|
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
|
|
823
827
|
] }),
|
|
824
|
-
g.options && /* @__PURE__ */
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
+
g.options && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-options", children: k("formBuilderAI.options", "{options} options").replace(
|
|
829
|
+
"{options}",
|
|
830
|
+
String(g.options.length)
|
|
831
|
+
) })
|
|
828
832
|
] }, x)) })
|
|
829
833
|
] })
|
|
830
834
|
] }),
|
|
@@ -834,7 +838,7 @@ const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
834
838
|
{
|
|
835
839
|
type: "button",
|
|
836
840
|
className: "nice-form-builder-ai__apply-btn",
|
|
837
|
-
onClick: () =>
|
|
841
|
+
onClick: () => E(A),
|
|
838
842
|
disabled: A.length === 0 || L,
|
|
839
843
|
children: [
|
|
840
844
|
/* @__PURE__ */ e(z, { name: "check", size: "sm" }),
|
|
@@ -931,8 +935,8 @@ function Wt(t) {
|
|
|
931
935
|
l(c.children);
|
|
932
936
|
continue;
|
|
933
937
|
}
|
|
934
|
-
const
|
|
935
|
-
|
|
938
|
+
const h = Et(c);
|
|
939
|
+
h && (r[c.name] = h, (c.required || (n = c.validations) != null && n.some((f) => f.type === "required")) && a.push(c.name));
|
|
936
940
|
}
|
|
937
941
|
};
|
|
938
942
|
for (const i of t.sections)
|
|
@@ -985,17 +989,17 @@ const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
985
989
|
sections: i = kt,
|
|
986
990
|
onChange: n,
|
|
987
991
|
jsonView: c = !0,
|
|
988
|
-
scriptRunner:
|
|
989
|
-
triggers:
|
|
992
|
+
scriptRunner: h,
|
|
993
|
+
triggers: f,
|
|
990
994
|
bindings: y = [],
|
|
991
995
|
handlers: s,
|
|
992
|
-
onBindingsChange:
|
|
996
|
+
onBindingsChange: m,
|
|
993
997
|
revisions: F,
|
|
994
998
|
onRollback: O,
|
|
995
999
|
loadContent: K,
|
|
996
1000
|
logs: A,
|
|
997
1001
|
onClearLogs: C,
|
|
998
|
-
extraTabs:
|
|
1002
|
+
extraTabs: N,
|
|
999
1003
|
validate: $,
|
|
1000
1004
|
theme: J = "light",
|
|
1001
1005
|
height: D = 560,
|
|
@@ -1010,7 +1014,7 @@ const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
1010
1014
|
fallbackValue: {},
|
|
1011
1015
|
onChange: n,
|
|
1012
1016
|
componentName: "NiceManifestEditor"
|
|
1013
|
-
}),
|
|
1017
|
+
}), E = q(() => {
|
|
1014
1018
|
const R = i.map((G) => ({
|
|
1015
1019
|
key: `section:${G.id}`,
|
|
1016
1020
|
label: G.title,
|
|
@@ -1027,20 +1031,20 @@ const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
1027
1031
|
}
|
|
1028
1032
|
) })
|
|
1029
1033
|
}));
|
|
1030
|
-
return
|
|
1034
|
+
return h && R.push({
|
|
1031
1035
|
key: "scripts",
|
|
1032
1036
|
label: L("manifestEditor.tab.scripts", "Scripts"),
|
|
1033
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...
|
|
1034
|
-
}),
|
|
1037
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...h }) })
|
|
1038
|
+
}), f && f.length > 0 && R.push({
|
|
1035
1039
|
key: "lifecycle",
|
|
1036
1040
|
label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
|
|
1037
1041
|
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1038
1042
|
ke,
|
|
1039
1043
|
{
|
|
1040
|
-
triggers:
|
|
1044
|
+
triggers: f,
|
|
1041
1045
|
bindings: y,
|
|
1042
1046
|
handlers: s,
|
|
1043
|
-
onChange: (G) =>
|
|
1047
|
+
onChange: (G) => m == null ? void 0 : m(G),
|
|
1044
1048
|
groupByTrigger: !0,
|
|
1045
1049
|
allowCondition: !0
|
|
1046
1050
|
}
|
|
@@ -1057,27 +1061,27 @@ const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
1057
1061
|
language: "json"
|
|
1058
1062
|
}
|
|
1059
1063
|
) })
|
|
1060
|
-
}),
|
|
1064
|
+
}), N && R.push(...N), R;
|
|
1061
1065
|
}, [
|
|
1062
1066
|
i,
|
|
1063
1067
|
S,
|
|
1064
1068
|
H,
|
|
1065
1069
|
c,
|
|
1070
|
+
h,
|
|
1066
1071
|
f,
|
|
1067
|
-
p,
|
|
1068
1072
|
y,
|
|
1069
1073
|
s,
|
|
1070
|
-
|
|
1074
|
+
m,
|
|
1071
1075
|
F,
|
|
1072
1076
|
O,
|
|
1073
1077
|
K,
|
|
1074
|
-
|
|
1078
|
+
N,
|
|
1075
1079
|
L
|
|
1076
|
-
]), [P,
|
|
1080
|
+
]), [P, p] = M(((x = E[0]) == null ? void 0 : x.key) ?? "");
|
|
1077
1081
|
oe(() => {
|
|
1078
|
-
|
|
1079
|
-
}, [
|
|
1080
|
-
const _ = q(() => $ ? $(S) : [], [$, S]),
|
|
1082
|
+
E.length > 0 && !E.some((R) => R.key === P) && p(E[0].key);
|
|
1083
|
+
}, [E, P]);
|
|
1084
|
+
const _ = q(() => $ ? $(S) : [], [$, S]), w = q(() => {
|
|
1081
1085
|
const R = [
|
|
1082
1086
|
{
|
|
1083
1087
|
key: "sections",
|
|
@@ -1103,10 +1107,10 @@ const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
|
1103
1107
|
style: { height: D, ...k },
|
|
1104
1108
|
"data-testid": U,
|
|
1105
1109
|
theme: J,
|
|
1106
|
-
tabs:
|
|
1110
|
+
tabs: E,
|
|
1107
1111
|
activeTabKey: P,
|
|
1108
|
-
onTabChange:
|
|
1109
|
-
statusItems:
|
|
1112
|
+
onTabChange: p,
|
|
1113
|
+
statusItems: w,
|
|
1110
1114
|
toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
|
|
1111
1115
|
bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
|
|
1112
1116
|
Fe,
|
|
@@ -1273,16 +1277,16 @@ function xt({
|
|
|
1273
1277
|
}) {
|
|
1274
1278
|
const o = t.properties ?? {};
|
|
1275
1279
|
return /* @__PURE__ */ e("div", { className: "nice-entity-editor__field-form", children: Object.entries(o).map(([i, n]) => {
|
|
1276
|
-
const c = r[i],
|
|
1280
|
+
const c = r[i], h = n.description, f = n.title ?? i;
|
|
1277
1281
|
if (n.type === "boolean")
|
|
1278
1282
|
return /* @__PURE__ */ e(
|
|
1279
1283
|
"div",
|
|
1280
1284
|
{
|
|
1281
1285
|
className: "nice-entity-editor__field-row nice-entity-editor__field-row--check",
|
|
1282
1286
|
children: /* @__PURE__ */ e(
|
|
1283
|
-
|
|
1287
|
+
Qe,
|
|
1284
1288
|
{
|
|
1285
|
-
label: /* @__PURE__ */ e(he, { title:
|
|
1289
|
+
label: /* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1286
1290
|
checked: !!c,
|
|
1287
1291
|
onChange: (s) => a(i, s),
|
|
1288
1292
|
disabled: l
|
|
@@ -1293,9 +1297,9 @@ function xt({
|
|
|
1293
1297
|
);
|
|
1294
1298
|
if (Array.isArray(n.enum) && n.enum.length > 0)
|
|
1295
1299
|
return /* @__PURE__ */ u("div", { className: "nice-entity-editor__field-row", children: [
|
|
1296
|
-
/* @__PURE__ */ e(he, { title:
|
|
1300
|
+
/* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1297
1301
|
/* @__PURE__ */ e(
|
|
1298
|
-
|
|
1302
|
+
Xe,
|
|
1299
1303
|
{
|
|
1300
1304
|
options: n.enum.map((s) => ({ label: String(s), value: String(s) })),
|
|
1301
1305
|
value: c == null ? "" : String(c),
|
|
@@ -1307,9 +1311,9 @@ function xt({
|
|
|
1307
1311
|
] }, i);
|
|
1308
1312
|
const y = n.type === "integer" || n.type === "number";
|
|
1309
1313
|
return /* @__PURE__ */ u("div", { className: "nice-entity-editor__field-row", children: [
|
|
1310
|
-
/* @__PURE__ */ e(he, { title:
|
|
1314
|
+
/* @__PURE__ */ e(he, { title: f, help: h }),
|
|
1311
1315
|
/* @__PURE__ */ e(
|
|
1312
|
-
|
|
1316
|
+
Ze,
|
|
1313
1317
|
{
|
|
1314
1318
|
value: c == null ? "" : String(c),
|
|
1315
1319
|
onChange: (s) => a(i, y ? s === "" ? void 0 : Number(s) : s),
|
|
@@ -1325,7 +1329,7 @@ function Ct({
|
|
|
1325
1329
|
fieldSchema: a,
|
|
1326
1330
|
readOnly: l
|
|
1327
1331
|
}) {
|
|
1328
|
-
const { t: o } = Z(), [i, n] = M(null), c = q(() => t.map((s,
|
|
1332
|
+
const { t: o } = Z(), [i, n] = M(null), c = q(() => t.map((s, m) => ({ ...s, [pe]: String(m) })), [t]), h = q(
|
|
1329
1333
|
() => [
|
|
1330
1334
|
{
|
|
1331
1335
|
field: "name",
|
|
@@ -1346,19 +1350,19 @@ function Ct({
|
|
|
1346
1350
|
"entityEditor.field.flags.help",
|
|
1347
1351
|
"Key / required / unique / indexed constraints on this field"
|
|
1348
1352
|
),
|
|
1349
|
-
render: (s,
|
|
1353
|
+
render: (s, m) => {
|
|
1350
1354
|
const F = [
|
|
1351
|
-
[!!(
|
|
1352
|
-
[!!(
|
|
1355
|
+
[!!(m != null && m.isPrimaryKey), "PK", o("entityEditor.flag.pk", "Primary key"), "info"],
|
|
1356
|
+
[!!(m != null && m.isForeignKey), "FK", o("entityEditor.flag.fk", "Foreign key"), "info"],
|
|
1353
1357
|
[
|
|
1354
|
-
!!(
|
|
1358
|
+
!!(m != null && m.isRequired),
|
|
1355
1359
|
"Req",
|
|
1356
1360
|
o("entityEditor.flag.required", "Required (NOT NULL)"),
|
|
1357
1361
|
"warning"
|
|
1358
1362
|
],
|
|
1359
|
-
[!!(
|
|
1363
|
+
[!!(m != null && m.isUnique), "Uniq", o("entityEditor.flag.unique", "Unique"), "secondary"],
|
|
1360
1364
|
[
|
|
1361
|
-
!!(
|
|
1365
|
+
!!(m != null && m.isIndexed),
|
|
1362
1366
|
"Idx",
|
|
1363
1367
|
o("entityEditor.flag.indexed", "Indexed"),
|
|
1364
1368
|
"secondary"
|
|
@@ -1370,8 +1374,8 @@ function Ct({
|
|
|
1370
1374
|
],
|
|
1371
1375
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1372
1376
|
[]
|
|
1373
|
-
),
|
|
1374
|
-
r(t.map((O, K) => K === s ? { ...O, [
|
|
1377
|
+
), f = (s, m, F) => {
|
|
1378
|
+
r(t.map((O, K) => K === s ? { ...O, [m]: F } : O));
|
|
1375
1379
|
}, y = () => {
|
|
1376
1380
|
const s = [...t, { name: `field${t.length + 1}`, dataType: "string" }];
|
|
1377
1381
|
r(s), n(s.length - 1);
|
|
@@ -1398,7 +1402,7 @@ function Ct({
|
|
|
1398
1402
|
{
|
|
1399
1403
|
schema: a,
|
|
1400
1404
|
value: s,
|
|
1401
|
-
onChange: (
|
|
1405
|
+
onChange: (m, F) => f(i, m, F),
|
|
1402
1406
|
readOnly: l
|
|
1403
1407
|
}
|
|
1404
1408
|
),
|
|
@@ -1410,12 +1414,12 @@ function Ct({
|
|
|
1410
1414
|
{
|
|
1411
1415
|
data: c,
|
|
1412
1416
|
keyField: pe,
|
|
1413
|
-
columns:
|
|
1417
|
+
columns: h,
|
|
1414
1418
|
searchable: !0,
|
|
1415
1419
|
searchPlaceholder: o("entityEditor.field.search", "Search fields…"),
|
|
1416
1420
|
emptyText: o("entityEditor.field.empty", "No fields yet. Add one to define this entity."),
|
|
1417
1421
|
onRowClick: (s) => n(Number(s[pe])),
|
|
1418
|
-
onRowDelete: l ? void 0 : (s) => r(t.filter((
|
|
1422
|
+
onRowDelete: l ? void 0 : (s) => r(t.filter((m, F) => F !== Number(s))),
|
|
1419
1423
|
toolbar: l ? void 0 : /* @__PURE__ */ e(
|
|
1420
1424
|
te,
|
|
1421
1425
|
{
|
|
@@ -1439,31 +1443,31 @@ const It = /* @__PURE__ */ ee(
|
|
|
1439
1443
|
onChange: i,
|
|
1440
1444
|
entityMetaSchema: n = Tt,
|
|
1441
1445
|
fieldSchema: c = Ft,
|
|
1442
|
-
fieldsKey:
|
|
1443
|
-
validationsKey:
|
|
1446
|
+
fieldsKey: h = "fields",
|
|
1447
|
+
validationsKey: f = "validations",
|
|
1444
1448
|
nameKey: y = "name",
|
|
1445
1449
|
renderErPreview: s,
|
|
1446
|
-
readOnly:
|
|
1450
|
+
readOnly: m = !1,
|
|
1447
1451
|
tutorial: F,
|
|
1448
1452
|
className: O,
|
|
1449
1453
|
style: K,
|
|
1450
1454
|
id: A,
|
|
1451
1455
|
"data-testid": C
|
|
1452
|
-
} = r, { t:
|
|
1456
|
+
} = r, { t: N } = Z(), [$, J] = le({
|
|
1453
1457
|
value: l,
|
|
1454
1458
|
defaultValue: o,
|
|
1455
1459
|
fallbackValue: [],
|
|
1456
1460
|
onChange: i,
|
|
1457
1461
|
componentName: "NiceEntityEditor"
|
|
1458
|
-
}), [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,
|
|
1459
|
-
const T = S == null ? void 0 : S[
|
|
1462
|
+
}), [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(() => {
|
|
1463
|
+
const T = S == null ? void 0 : S[h];
|
|
1460
1464
|
return Array.isArray(T) ? T : [];
|
|
1461
|
-
}, [S,
|
|
1465
|
+
}, [S, h]), P = q(() => {
|
|
1462
1466
|
const T = (B) => {
|
|
1463
1467
|
const Y = B.toLowerCase();
|
|
1464
1468
|
return /(int|long|decimal|double|float|number|money)/.test(Y) ? "number" : /bool/.test(Y) ? "boolean" : /date|time/.test(Y) ? "date" : "string";
|
|
1465
1469
|
}, V = [];
|
|
1466
|
-
for (const B of
|
|
1470
|
+
for (const B of E) {
|
|
1467
1471
|
const Y = String(B.name ?? "");
|
|
1468
1472
|
Y && V.push({
|
|
1469
1473
|
field: Y,
|
|
@@ -1472,17 +1476,17 @@ const It = /* @__PURE__ */ ee(
|
|
|
1472
1476
|
});
|
|
1473
1477
|
}
|
|
1474
1478
|
return V;
|
|
1475
|
-
}, [
|
|
1476
|
-
const T = S == null ? void 0 : S[
|
|
1479
|
+
}, [E]), p = q(() => {
|
|
1480
|
+
const T = S == null ? void 0 : S[f];
|
|
1477
1481
|
return Array.isArray(T) ? T : [];
|
|
1478
|
-
}, [S,
|
|
1482
|
+
}, [S, f]), _ = q(() => $.map((T, V) => ({ ...T, [me]: String(V) })), [$]), w = (T) => {
|
|
1479
1483
|
J($.map((V, B) => B === L ? { ...V, ...T } : V));
|
|
1480
1484
|
}, g = (T) => {
|
|
1481
|
-
|
|
1485
|
+
w({ [h]: T });
|
|
1482
1486
|
}, x = (T) => {
|
|
1483
1487
|
k(T), U("general"), I("edit");
|
|
1484
1488
|
}, R = () => {
|
|
1485
|
-
const T = [...$, { [y]: `Entity${$.length + 1}`, [
|
|
1489
|
+
const T = [...$, { [y]: `Entity${$.length + 1}`, [h]: [] }];
|
|
1486
1490
|
J(T), k(T.length - 1), U("general"), I("edit");
|
|
1487
1491
|
}, G = (T) => {
|
|
1488
1492
|
J($.filter((V, B) => B !== T)), k((V) => V >= T ? Math.max(0, V - 1) : V);
|
|
@@ -1490,27 +1494,27 @@ const It = /* @__PURE__ */ ee(
|
|
|
1490
1494
|
() => [
|
|
1491
1495
|
{
|
|
1492
1496
|
field: y,
|
|
1493
|
-
header:
|
|
1497
|
+
header: N("entityEditor.col.name", "Name"),
|
|
1494
1498
|
sortable: !0,
|
|
1495
1499
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__name", children: String(T ?? "") })
|
|
1496
1500
|
},
|
|
1497
1501
|
{
|
|
1498
1502
|
field: "displayName",
|
|
1499
|
-
header:
|
|
1503
|
+
header: N("entityEditor.col.displayName", "Display name"),
|
|
1500
1504
|
sortable: !0,
|
|
1501
1505
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__muted", children: String(T ?? "—") })
|
|
1502
1506
|
},
|
|
1503
1507
|
{
|
|
1504
1508
|
field: "tableName",
|
|
1505
|
-
header:
|
|
1509
|
+
header: N("entityEditor.col.table", "Table"),
|
|
1506
1510
|
sortable: !0,
|
|
1507
1511
|
render: (T) => /* @__PURE__ */ e("span", { className: "nice-entity-editor__muted", children: String(T ?? "—") })
|
|
1508
1512
|
},
|
|
1509
1513
|
{
|
|
1510
|
-
field:
|
|
1511
|
-
header:
|
|
1514
|
+
field: h,
|
|
1515
|
+
header: N("entityEditor.col.fields", "Fields"),
|
|
1512
1516
|
align: "center",
|
|
1513
|
-
headerTooltip:
|
|
1517
|
+
headerTooltip: N(
|
|
1514
1518
|
"entityEditor.col.fields.help",
|
|
1515
1519
|
"Number of fields defined on this entity"
|
|
1516
1520
|
),
|
|
@@ -1518,91 +1522,91 @@ const It = /* @__PURE__ */ ee(
|
|
|
1518
1522
|
},
|
|
1519
1523
|
{
|
|
1520
1524
|
field: "__flags",
|
|
1521
|
-
header:
|
|
1525
|
+
header: N("entityEditor.col.flags", "Flags"),
|
|
1522
1526
|
render: (T, V) => /* @__PURE__ */ u("span", { className: "nice-entity-editor__flags", children: [
|
|
1523
1527
|
V != null && V.isAudited ? /* @__PURE__ */ e(
|
|
1524
1528
|
X,
|
|
1525
1529
|
{
|
|
1526
|
-
content:
|
|
1530
|
+
content: N(
|
|
1527
1531
|
"entityEditor.flag.audited",
|
|
1528
1532
|
"Audited — tracks who changed each record and when"
|
|
1529
1533
|
),
|
|
1530
|
-
children: /* @__PURE__ */ e(ae, { variant: "info", size: "sm", outline: !0, children:
|
|
1534
|
+
children: /* @__PURE__ */ e(ae, { variant: "info", size: "sm", outline: !0, children: N("entityEditor.flag.audited.abbr", "Audit") })
|
|
1531
1535
|
}
|
|
1532
1536
|
) : null,
|
|
1533
1537
|
V != null && V.isSoftDeleteEnabled ? /* @__PURE__ */ e(
|
|
1534
1538
|
X,
|
|
1535
1539
|
{
|
|
1536
|
-
content:
|
|
1540
|
+
content: N(
|
|
1537
1541
|
"entityEditor.flag.softDelete",
|
|
1538
1542
|
"Soft delete — rows are flagged deleted, never physically removed"
|
|
1539
1543
|
),
|
|
1540
|
-
children: /* @__PURE__ */ e(ae, { variant: "secondary", size: "sm", outline: !0, children:
|
|
1544
|
+
children: /* @__PURE__ */ e(ae, { variant: "secondary", size: "sm", outline: !0, children: N("entityEditor.flag.softDelete.abbr", "Soft-del") })
|
|
1541
1545
|
}
|
|
1542
1546
|
) : null
|
|
1543
1547
|
] })
|
|
1544
1548
|
}
|
|
1545
1549
|
],
|
|
1546
1550
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1547
|
-
[y,
|
|
1551
|
+
[y, h]
|
|
1548
1552
|
), W = q(() => {
|
|
1549
1553
|
const T = [
|
|
1550
1554
|
{
|
|
1551
1555
|
id: "general",
|
|
1552
|
-
label:
|
|
1556
|
+
label: N("entityEditor.tab.general", "General"),
|
|
1553
1557
|
content: S ? /* @__PURE__ */ e(
|
|
1554
1558
|
de,
|
|
1555
1559
|
{
|
|
1556
1560
|
schema: n,
|
|
1557
1561
|
value: S,
|
|
1558
|
-
onChange: (V) =>
|
|
1562
|
+
onChange: (V) => w(V),
|
|
1559
1563
|
columns: 2,
|
|
1560
|
-
readOnly:
|
|
1564
|
+
readOnly: m,
|
|
1561
1565
|
liveValidation: !0
|
|
1562
1566
|
}
|
|
1563
1567
|
) : null
|
|
1564
1568
|
},
|
|
1565
1569
|
{
|
|
1566
1570
|
id: "fields",
|
|
1567
|
-
label:
|
|
1568
|
-
badge:
|
|
1571
|
+
label: N("entityEditor.tab.fields", "Fields"),
|
|
1572
|
+
badge: E.length || void 0,
|
|
1569
1573
|
content: /* @__PURE__ */ e(
|
|
1570
1574
|
Ct,
|
|
1571
1575
|
{
|
|
1572
|
-
fields:
|
|
1576
|
+
fields: E,
|
|
1573
1577
|
onChange: g,
|
|
1574
1578
|
fieldSchema: c,
|
|
1575
|
-
readOnly:
|
|
1579
|
+
readOnly: m
|
|
1576
1580
|
}
|
|
1577
1581
|
)
|
|
1578
1582
|
},
|
|
1579
1583
|
{
|
|
1580
1584
|
id: "validation",
|
|
1581
|
-
label:
|
|
1582
|
-
badge:
|
|
1585
|
+
label: N("entityEditor.tab.validation", "Validation"),
|
|
1586
|
+
badge: p.length || void 0,
|
|
1583
1587
|
content: /* @__PURE__ */ e(
|
|
1584
|
-
|
|
1588
|
+
We,
|
|
1585
1589
|
{
|
|
1586
1590
|
fields: P,
|
|
1587
|
-
value:
|
|
1588
|
-
onChange: (V) =>
|
|
1591
|
+
value: p,
|
|
1592
|
+
onChange: (V) => w({ [f]: V })
|
|
1589
1593
|
}
|
|
1590
1594
|
)
|
|
1591
1595
|
}
|
|
1592
1596
|
];
|
|
1593
1597
|
return s && T.push({
|
|
1594
1598
|
id: "er",
|
|
1595
|
-
label:
|
|
1599
|
+
label: N("entityEditor.tab.er", "ER diagram"),
|
|
1596
1600
|
content: /* @__PURE__ */ e("div", { className: "nice-entity-editor__er", children: s($) })
|
|
1597
1601
|
}), T;
|
|
1598
1602
|
}, [
|
|
1599
1603
|
S,
|
|
1600
|
-
|
|
1601
|
-
|
|
1604
|
+
E,
|
|
1605
|
+
p,
|
|
1602
1606
|
P,
|
|
1603
1607
|
n,
|
|
1604
1608
|
c,
|
|
1605
|
-
|
|
1609
|
+
m,
|
|
1606
1610
|
s,
|
|
1607
1611
|
$
|
|
1608
1612
|
]), ie = "nice-entity-editor" + (O ? ` ${O}` : "");
|
|
@@ -1610,19 +1614,19 @@ const It = /* @__PURE__ */ ee(
|
|
|
1610
1614
|
F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F, St) }) }),
|
|
1611
1615
|
H ? /* @__PURE__ */ u("div", { className: "nice-entity-editor__edit", children: [
|
|
1612
1616
|
/* @__PURE__ */ u("header", { className: "nice-entity-editor__edit-header", children: [
|
|
1613
|
-
/* @__PURE__ */ e(X, { content:
|
|
1617
|
+
/* @__PURE__ */ e(X, { content: N("entityEditor.backHint", "Back to the entity list"), children: /* @__PURE__ */ e(
|
|
1614
1618
|
te,
|
|
1615
1619
|
{
|
|
1616
1620
|
variant: "ghost",
|
|
1617
1621
|
size: "sm",
|
|
1618
1622
|
leftIcon: /* @__PURE__ */ e(z, { name: "arrow-left", size: 14 }),
|
|
1619
1623
|
onClick: () => I("list"),
|
|
1620
|
-
children:
|
|
1624
|
+
children: N("entityEditor.back", "Entities")
|
|
1621
1625
|
}
|
|
1622
1626
|
) }),
|
|
1623
1627
|
/* @__PURE__ */ e("span", { className: "nice-entity-editor__breadcrumb-sep", children: "/" }),
|
|
1624
|
-
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String((S == null ? void 0 : S[y]) ??
|
|
1625
|
-
!
|
|
1628
|
+
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String((S == null ? void 0 : S[y]) ?? N("entityEditor.untitled", "Untitled entity")) }),
|
|
1629
|
+
!m && /* @__PURE__ */ e(X, { content: N("entityEditor.deleteHint", "Delete this entity"), children: /* @__PURE__ */ e(
|
|
1626
1630
|
te,
|
|
1627
1631
|
{
|
|
1628
1632
|
variant: "ghost",
|
|
@@ -1631,12 +1635,12 @@ const It = /* @__PURE__ */ ee(
|
|
|
1631
1635
|
onClick: () => {
|
|
1632
1636
|
G(L), I("list");
|
|
1633
1637
|
},
|
|
1634
|
-
children:
|
|
1638
|
+
children: N("entityEditor.delete", "Delete")
|
|
1635
1639
|
}
|
|
1636
1640
|
) })
|
|
1637
1641
|
] }),
|
|
1638
1642
|
/* @__PURE__ */ e(
|
|
1639
|
-
|
|
1643
|
+
Ye,
|
|
1640
1644
|
{
|
|
1641
1645
|
tabs: W,
|
|
1642
1646
|
activeTab: j,
|
|
@@ -1651,18 +1655,18 @@ const It = /* @__PURE__ */ ee(
|
|
|
1651
1655
|
keyField: me,
|
|
1652
1656
|
columns: re,
|
|
1653
1657
|
searchable: !0,
|
|
1654
|
-
searchPlaceholder:
|
|
1655
|
-
emptyText:
|
|
1658
|
+
searchPlaceholder: N("entityEditor.search", "Search entities…"),
|
|
1659
|
+
emptyText: N("entityEditor.empty", "No entities yet. Create one to get started."),
|
|
1656
1660
|
onRowClick: (T) => x(Number(T[me])),
|
|
1657
|
-
onRowDelete:
|
|
1658
|
-
toolbar:
|
|
1661
|
+
onRowDelete: m ? void 0 : (T) => G(Number(T)),
|
|
1662
|
+
toolbar: m ? void 0 : /* @__PURE__ */ e(
|
|
1659
1663
|
te,
|
|
1660
1664
|
{
|
|
1661
1665
|
variant: "primary",
|
|
1662
1666
|
size: "sm",
|
|
1663
1667
|
leftIcon: /* @__PURE__ */ e(z, { name: "plus", size: 14 }),
|
|
1664
1668
|
onClick: R,
|
|
1665
|
-
children:
|
|
1669
|
+
children: N("entityEditor.new", "New entity")
|
|
1666
1670
|
}
|
|
1667
1671
|
),
|
|
1668
1672
|
compact: !0,
|
|
@@ -1704,137 +1708,137 @@ const It = /* @__PURE__ */ ee(
|
|
|
1704
1708
|
onChange: i,
|
|
1705
1709
|
locales: n,
|
|
1706
1710
|
allowEditLocales: c = !0,
|
|
1707
|
-
allowEditKeys:
|
|
1708
|
-
highlightMissing:
|
|
1711
|
+
allowEditKeys: h = !0,
|
|
1712
|
+
highlightMissing: f = !0,
|
|
1709
1713
|
readOnly: y = !1,
|
|
1710
1714
|
tutorial: s,
|
|
1711
|
-
className:
|
|
1715
|
+
className: m,
|
|
1712
1716
|
style: F,
|
|
1713
1717
|
id: O,
|
|
1714
1718
|
"data-testid": K
|
|
1715
|
-
} = r, { t: A } =
|
|
1719
|
+
} = r, { t: A } = xe(), [C, N] = rt({
|
|
1716
1720
|
value: l,
|
|
1717
1721
|
defaultValue: o,
|
|
1718
1722
|
fallbackValue: {},
|
|
1719
1723
|
onChange: i,
|
|
1720
1724
|
componentName: "NiceI18nEditor"
|
|
1721
1725
|
}), [$, J] = M(""), [D, I] = M(""), v = q(() => n ?? Object.keys(C), [n, C]), k = q(() => {
|
|
1722
|
-
const
|
|
1726
|
+
const p = /* @__PURE__ */ new Set();
|
|
1723
1727
|
for (const _ of Object.keys(C))
|
|
1724
|
-
for (const
|
|
1725
|
-
|
|
1726
|
-
return [...
|
|
1727
|
-
}, [C]), j = (
|
|
1728
|
-
|
|
1729
|
-
}, U = (
|
|
1730
|
-
if (!_ || _ ===
|
|
1728
|
+
for (const w of Object.keys(C[_] ?? {}))
|
|
1729
|
+
p.add(w);
|
|
1730
|
+
return [...p].sort();
|
|
1731
|
+
}, [C]), j = (p, _, w) => {
|
|
1732
|
+
N({ ...C, [p]: { ...C[p] ?? {}, [_]: w } });
|
|
1733
|
+
}, U = (p, _) => {
|
|
1734
|
+
if (!_ || _ === p)
|
|
1731
1735
|
return;
|
|
1732
|
-
const
|
|
1736
|
+
const w = {};
|
|
1733
1737
|
for (const g of Object.keys(C)) {
|
|
1734
1738
|
const x = { ...C[g] ?? {} };
|
|
1735
|
-
|
|
1739
|
+
p in x && (x[_] = x[p], delete x[p]), w[g] = x;
|
|
1736
1740
|
}
|
|
1737
|
-
w
|
|
1738
|
-
}, L = (
|
|
1741
|
+
N(w);
|
|
1742
|
+
}, L = (p) => {
|
|
1739
1743
|
const _ = {};
|
|
1740
|
-
for (const
|
|
1741
|
-
const g = { ...C[
|
|
1742
|
-
delete g[
|
|
1744
|
+
for (const w of Object.keys(C)) {
|
|
1745
|
+
const g = { ...C[w] ?? {} };
|
|
1746
|
+
delete g[p], _[w] = g;
|
|
1743
1747
|
}
|
|
1744
|
-
|
|
1748
|
+
N(_);
|
|
1745
1749
|
}, S = () => {
|
|
1746
|
-
const
|
|
1747
|
-
if (!
|
|
1750
|
+
const p = $.trim();
|
|
1751
|
+
if (!p || k.includes(p))
|
|
1748
1752
|
return;
|
|
1749
1753
|
const _ = {};
|
|
1750
|
-
for (const
|
|
1751
|
-
_[
|
|
1752
|
-
for (const
|
|
1753
|
-
_[
|
|
1754
|
-
|
|
1754
|
+
for (const w of v)
|
|
1755
|
+
_[w] = { ...C[w] ?? {}, [p]: "" };
|
|
1756
|
+
for (const w of Object.keys(C))
|
|
1757
|
+
_[w] || (_[w] = C[w]);
|
|
1758
|
+
N(_), J("");
|
|
1755
1759
|
}, H = () => {
|
|
1756
|
-
const
|
|
1757
|
-
if (!
|
|
1760
|
+
const p = D.trim();
|
|
1761
|
+
if (!p || C[p])
|
|
1758
1762
|
return;
|
|
1759
1763
|
const _ = {};
|
|
1760
|
-
for (const
|
|
1761
|
-
_[
|
|
1762
|
-
|
|
1763
|
-
},
|
|
1764
|
+
for (const w of k)
|
|
1765
|
+
_[w] = "";
|
|
1766
|
+
N({ ...C, [p]: _ }), I("");
|
|
1767
|
+
}, E = (p) => {
|
|
1764
1768
|
const _ = { ...C };
|
|
1765
|
-
delete _[
|
|
1766
|
-
}, P = "nice-i18n-editor" + (
|
|
1769
|
+
delete _[p], N(_);
|
|
1770
|
+
}, P = "nice-i18n-editor" + (m ? ` ${m}` : "");
|
|
1767
1771
|
return /* @__PURE__ */ u("div", { ref: a, id: O, className: P, style: F, "data-testid": K, children: [
|
|
1768
1772
|
s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s, At) }) }),
|
|
1769
1773
|
/* @__PURE__ */ e("div", { className: "nice-i18n-editor__scroll", "data-tour": "i18n-grid", children: /* @__PURE__ */ u("table", { className: "nice-i18n-editor__table", children: [
|
|
1770
1774
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ u("tr", { children: [
|
|
1771
1775
|
/* @__PURE__ */ e("th", { className: "nice-i18n-editor__key-head", children: A("i18nEditor.keyHead", "Key") }),
|
|
1772
|
-
v.map((
|
|
1773
|
-
/* @__PURE__ */ e("span", { children:
|
|
1776
|
+
v.map((p) => /* @__PURE__ */ u("th", { className: "nice-i18n-editor__locale-head", children: [
|
|
1777
|
+
/* @__PURE__ */ e("span", { children: p }),
|
|
1774
1778
|
c && !y && /* @__PURE__ */ e(
|
|
1775
1779
|
"button",
|
|
1776
1780
|
{
|
|
1777
1781
|
type: "button",
|
|
1778
1782
|
className: "nice-i18n-editor__locale-remove",
|
|
1779
|
-
"aria-label": `${A("i18nEditor.removeLocale", "Remove locale")} ${
|
|
1780
|
-
onClick: () =>
|
|
1783
|
+
"aria-label": `${A("i18nEditor.removeLocale", "Remove locale")} ${p}`,
|
|
1784
|
+
onClick: () => E(p),
|
|
1781
1785
|
children: /* @__PURE__ */ e(be, { name: "close", size: 12 })
|
|
1782
1786
|
}
|
|
1783
1787
|
)
|
|
1784
|
-
] },
|
|
1788
|
+
] }, p))
|
|
1785
1789
|
] }) }),
|
|
1786
1790
|
/* @__PURE__ */ u("tbody", { children: [
|
|
1787
|
-
k.map((
|
|
1791
|
+
k.map((p) => /* @__PURE__ */ u("tr", { children: [
|
|
1788
1792
|
/* @__PURE__ */ u("td", { className: "nice-i18n-editor__key-cell", children: [
|
|
1789
|
-
|
|
1793
|
+
h && !y ? /* @__PURE__ */ e(
|
|
1790
1794
|
"input",
|
|
1791
1795
|
{
|
|
1792
1796
|
className: "nice-i18n-editor__key-input",
|
|
1793
|
-
defaultValue:
|
|
1794
|
-
onBlur: (_) => U(
|
|
1797
|
+
defaultValue: p,
|
|
1798
|
+
onBlur: (_) => U(p, _.target.value.trim()),
|
|
1795
1799
|
"aria-label": A("i18nEditor.keyAria", "Translation key")
|
|
1796
1800
|
}
|
|
1797
|
-
) : /* @__PURE__ */ e("span", { className: "nice-i18n-editor__key-text", children:
|
|
1798
|
-
|
|
1801
|
+
) : /* @__PURE__ */ e("span", { className: "nice-i18n-editor__key-text", children: p }),
|
|
1802
|
+
h && !y && /* @__PURE__ */ e(
|
|
1799
1803
|
"button",
|
|
1800
1804
|
{
|
|
1801
1805
|
type: "button",
|
|
1802
1806
|
className: "nice-i18n-editor__key-remove",
|
|
1803
|
-
"aria-label": `${A("i18nEditor.removeKey", "Remove key")} ${
|
|
1804
|
-
onClick: () => L(
|
|
1807
|
+
"aria-label": `${A("i18nEditor.removeKey", "Remove key")} ${p}`,
|
|
1808
|
+
onClick: () => L(p),
|
|
1805
1809
|
children: /* @__PURE__ */ e(be, { name: "close", size: 12 })
|
|
1806
1810
|
}
|
|
1807
1811
|
)
|
|
1808
1812
|
] }),
|
|
1809
1813
|
v.map((_) => {
|
|
1810
1814
|
var x;
|
|
1811
|
-
const
|
|
1815
|
+
const w = ((x = C[_]) == null ? void 0 : x[p]) ?? "";
|
|
1812
1816
|
return /* @__PURE__ */ e("td", { className: "nice-i18n-editor__cell", children: /* @__PURE__ */ e(
|
|
1813
1817
|
"input",
|
|
1814
1818
|
{
|
|
1815
|
-
className: "nice-i18n-editor__cell-input" + (
|
|
1816
|
-
value:
|
|
1819
|
+
className: "nice-i18n-editor__cell-input" + (f && w === "" ? " nice-i18n-editor__cell-input--missing" : ""),
|
|
1820
|
+
value: w,
|
|
1817
1821
|
readOnly: y,
|
|
1818
|
-
onChange: (R) => j(_,
|
|
1819
|
-
"aria-label": `${
|
|
1822
|
+
onChange: (R) => j(_, p, R.target.value),
|
|
1823
|
+
"aria-label": `${p} (${_})`
|
|
1820
1824
|
}
|
|
1821
1825
|
) }, _);
|
|
1822
1826
|
})
|
|
1823
|
-
] },
|
|
1827
|
+
] }, p)),
|
|
1824
1828
|
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.") }) })
|
|
1825
1829
|
] })
|
|
1826
1830
|
] }) }),
|
|
1827
|
-
!y && (
|
|
1828
|
-
|
|
1831
|
+
!y && (h || c) && /* @__PURE__ */ u("div", { className: "nice-i18n-editor__toolbar", "data-tour": "i18n-add", children: [
|
|
1832
|
+
h && /* @__PURE__ */ u("div", { className: "nice-i18n-editor__add", children: [
|
|
1829
1833
|
/* @__PURE__ */ e(
|
|
1830
1834
|
"input",
|
|
1831
1835
|
{
|
|
1832
1836
|
className: "nice-i18n-editor__add-input",
|
|
1833
1837
|
placeholder: A("i18nEditor.newKeyPlaceholder", "new.key"),
|
|
1834
1838
|
value: $,
|
|
1835
|
-
onChange: (
|
|
1836
|
-
onKeyDown: (
|
|
1837
|
-
|
|
1839
|
+
onChange: (p) => J(p.target.value),
|
|
1840
|
+
onKeyDown: (p) => {
|
|
1841
|
+
p.key === "Enter" && S();
|
|
1838
1842
|
},
|
|
1839
1843
|
"aria-label": A("i18nEditor.newKeyAria", "New key")
|
|
1840
1844
|
}
|
|
@@ -1851,9 +1855,9 @@ const It = /* @__PURE__ */ ee(
|
|
|
1851
1855
|
className: "nice-i18n-editor__add-input",
|
|
1852
1856
|
placeholder: A("i18nEditor.newLocalePlaceholder", "locale (e.g. de)"),
|
|
1853
1857
|
value: D,
|
|
1854
|
-
onChange: (
|
|
1855
|
-
onKeyDown: (
|
|
1856
|
-
|
|
1858
|
+
onChange: (p) => I(p.target.value),
|
|
1859
|
+
onKeyDown: (p) => {
|
|
1860
|
+
p.key === "Enter" && H();
|
|
1857
1861
|
},
|
|
1858
1862
|
"aria-label": A("i18nEditor.newLocaleAria", "New locale")
|
|
1859
1863
|
}
|
|
@@ -1924,23 +1928,23 @@ const It = /* @__PURE__ */ ee(
|
|
|
1924
1928
|
entityConfig: i,
|
|
1925
1929
|
locales: n,
|
|
1926
1930
|
validate: c,
|
|
1927
|
-
scriptRunner:
|
|
1928
|
-
triggers:
|
|
1931
|
+
scriptRunner: h,
|
|
1932
|
+
triggers: f,
|
|
1929
1933
|
bindings: y = [],
|
|
1930
1934
|
handlers: s,
|
|
1931
|
-
onBindingsChange:
|
|
1935
|
+
onBindingsChange: m,
|
|
1932
1936
|
revisions: F,
|
|
1933
1937
|
onRollback: O,
|
|
1934
1938
|
loadContent: K,
|
|
1935
1939
|
theme: A = "light",
|
|
1936
1940
|
height: C = 640,
|
|
1937
|
-
tutorial:
|
|
1941
|
+
tutorial: N,
|
|
1938
1942
|
className: $,
|
|
1939
1943
|
style: J,
|
|
1940
1944
|
id: D,
|
|
1941
1945
|
"data-testid": I
|
|
1942
|
-
} = r, { t: v } = Z(), [k, j] = M([]), [U, L] = M(""), [S, H] = M(null), [
|
|
1943
|
-
R((
|
|
1946
|
+
} = 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) => {
|
|
1947
|
+
R((ze) => [...ze, { level: d, message: b, data: Be, timestamp: Date.now() }].slice(-200));
|
|
1944
1948
|
}, []), ie = Q(async () => {
|
|
1945
1949
|
g(!0);
|
|
1946
1950
|
try {
|
|
@@ -1968,24 +1972,24 @@ const It = /* @__PURE__ */ ee(
|
|
|
1968
1972
|
},
|
|
1969
1973
|
[l, W]
|
|
1970
1974
|
), V = Q(async () => {
|
|
1971
|
-
if (!(!S || !
|
|
1975
|
+
if (!(!S || !E)) {
|
|
1972
1976
|
g(!0);
|
|
1973
1977
|
try {
|
|
1974
|
-
await l.saveModule(S,
|
|
1978
|
+
await l.saveModule(S, E), _(!1), W("info", `Saved module ${S}`);
|
|
1975
1979
|
} catch (d) {
|
|
1976
1980
|
W("error", `Save failed: ${d instanceof Error ? d.message : String(d)}`);
|
|
1977
1981
|
} finally {
|
|
1978
1982
|
g(!1);
|
|
1979
1983
|
}
|
|
1980
1984
|
}
|
|
1981
|
-
}, [S,
|
|
1982
|
-
if (!
|
|
1985
|
+
}, [S, E, l, W]), B = q(() => {
|
|
1986
|
+
if (!E)
|
|
1983
1987
|
return [];
|
|
1984
1988
|
const d = [];
|
|
1985
1989
|
for (const b of o)
|
|
1986
|
-
b.schema && d.push(...
|
|
1987
|
-
return c && d.push(...c(
|
|
1988
|
-
}, [
|
|
1990
|
+
b.schema && d.push(...Ae(E.manifest ?? {}, b.schema));
|
|
1991
|
+
return c && d.push(...c(E)), d;
|
|
1992
|
+
}, [E, o, c]), Y = Q(() => {
|
|
1989
1993
|
if (B.length === 0)
|
|
1990
1994
|
W("info", "Validation passed");
|
|
1991
1995
|
else {
|
|
@@ -1993,22 +1997,22 @@ const It = /* @__PURE__ */ ee(
|
|
|
1993
1997
|
for (const d of B)
|
|
1994
1998
|
W("error", `${d.field}: ${d.message}`);
|
|
1995
1999
|
}
|
|
1996
|
-
}, [B, W]),
|
|
2000
|
+
}, [B, W]), $e = (d) => {
|
|
1997
2001
|
P((b) => b && { ...b, manifest: d }), _(!0);
|
|
1998
|
-
}, $e = (d) => {
|
|
1999
|
-
P((b) => b && { ...b, entities: d }), _(!0);
|
|
2000
2002
|
}, Me = (d) => {
|
|
2001
|
-
P((b) => b && { ...b,
|
|
2003
|
+
P((b) => b && { ...b, entities: d }), _(!0);
|
|
2002
2004
|
}, Oe = (d) => {
|
|
2003
|
-
P((b) => b && { ...b,
|
|
2005
|
+
P((b) => b && { ...b, i18n: d }), _(!0);
|
|
2004
2006
|
}, Ke = (d) => {
|
|
2005
|
-
P((b) => b && { ...b,
|
|
2007
|
+
P((b) => b && { ...b, views: d }), _(!0);
|
|
2006
2008
|
}, De = (d) => {
|
|
2007
|
-
P((b) => b && { ...b,
|
|
2009
|
+
P((b) => b && { ...b, workflows: d }), _(!0);
|
|
2008
2010
|
}, Le = (d) => {
|
|
2011
|
+
P((b) => b && { ...b, dataSources: d }), _(!0);
|
|
2012
|
+
}, Ve = (d) => {
|
|
2009
2013
|
P((b) => b && { ...b, rbac: d }), _(!0);
|
|
2010
2014
|
}, ne = q(() => {
|
|
2011
|
-
if (!
|
|
2015
|
+
if (!E)
|
|
2012
2016
|
return [];
|
|
2013
2017
|
const d = o.map((b) => ({
|
|
2014
2018
|
key: `section:${b.id}`,
|
|
@@ -2020,8 +2024,8 @@ const It = /* @__PURE__ */ ee(
|
|
|
2020
2024
|
schema: b.schema,
|
|
2021
2025
|
fields: b.fields,
|
|
2022
2026
|
uiSchema: b.uiSchema,
|
|
2023
|
-
value:
|
|
2024
|
-
onChange:
|
|
2027
|
+
value: E.manifest ?? {},
|
|
2028
|
+
onChange: $e,
|
|
2025
2029
|
showJsonView: !0
|
|
2026
2030
|
}
|
|
2027
2031
|
) })
|
|
@@ -2032,8 +2036,8 @@ const It = /* @__PURE__ */ ee(
|
|
|
2032
2036
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2033
2037
|
It,
|
|
2034
2038
|
{
|
|
2035
|
-
value:
|
|
2036
|
-
onChange:
|
|
2039
|
+
value: E.entities ?? [],
|
|
2040
|
+
onChange: Me,
|
|
2037
2041
|
entityMetaSchema: i == null ? void 0 : i.entityMetaSchema,
|
|
2038
2042
|
fieldSchema: i == null ? void 0 : i.fieldSchema,
|
|
2039
2043
|
fieldsKey: i == null ? void 0 : i.fieldsKey,
|
|
@@ -2044,57 +2048,57 @@ const It = /* @__PURE__ */ ee(
|
|
|
2044
2048
|
}), d.push({
|
|
2045
2049
|
key: "i18n",
|
|
2046
2050
|
label: v("moduleEditor.tab.i18n", "i18n"),
|
|
2047
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e($t, { value:
|
|
2051
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e($t, { value: E.i18n ?? {}, onChange: Oe, locales: n }) })
|
|
2048
2052
|
}), d.push({
|
|
2049
2053
|
key: "views",
|
|
2050
2054
|
label: v("moduleEditor.tab.views", "Views"),
|
|
2051
2055
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2052
2056
|
Kt,
|
|
2053
2057
|
{
|
|
2054
|
-
views:
|
|
2055
|
-
entities:
|
|
2056
|
-
onChange:
|
|
2058
|
+
views: E.views ?? [],
|
|
2059
|
+
entities: E.entities ?? [],
|
|
2060
|
+
onChange: Ke
|
|
2057
2061
|
}
|
|
2058
2062
|
) })
|
|
2059
2063
|
}), d.push({
|
|
2060
2064
|
key: "workflows",
|
|
2061
2065
|
label: v("moduleEditor.tab.workflows", "Workflows"),
|
|
2062
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Dt, { workflows:
|
|
2066
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Dt, { workflows: E.workflows ?? [], onChange: De }) })
|
|
2063
2067
|
}), d.push({
|
|
2064
2068
|
key: "data",
|
|
2065
2069
|
label: v("moduleEditor.tab.data", "Data"),
|
|
2066
2070
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2067
2071
|
Pt,
|
|
2068
2072
|
{
|
|
2069
|
-
dataSources:
|
|
2070
|
-
schemas: Lt(
|
|
2071
|
-
onChange:
|
|
2073
|
+
dataSources: E.dataSources ?? [],
|
|
2074
|
+
schemas: Lt(E.entities ?? []),
|
|
2075
|
+
onChange: Le
|
|
2072
2076
|
}
|
|
2073
2077
|
) })
|
|
2074
2078
|
}), d.push({
|
|
2075
2079
|
key: "permissions",
|
|
2076
2080
|
label: v("moduleEditor.tab.permissions", "Permissions"),
|
|
2077
2081
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2078
|
-
|
|
2082
|
+
et,
|
|
2079
2083
|
{
|
|
2080
|
-
value:
|
|
2081
|
-
onChange:
|
|
2084
|
+
value: E.rbac ?? Vt(E),
|
|
2085
|
+
onChange: Ve
|
|
2082
2086
|
}
|
|
2083
2087
|
) })
|
|
2084
|
-
}),
|
|
2088
|
+
}), h && d.push({
|
|
2085
2089
|
key: "scripts",
|
|
2086
2090
|
label: v("moduleEditor.tab.scripts", "Scripts"),
|
|
2087
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(we, { ...
|
|
2088
|
-
}),
|
|
2091
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(we, { ...h }) })
|
|
2092
|
+
}), f && f.length > 0 && d.push({
|
|
2089
2093
|
key: "lifecycle",
|
|
2090
2094
|
label: v("moduleEditor.tab.lifecycle", "Lifecycle"),
|
|
2091
2095
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2092
2096
|
ke,
|
|
2093
2097
|
{
|
|
2094
|
-
triggers:
|
|
2098
|
+
triggers: f,
|
|
2095
2099
|
bindings: y,
|
|
2096
2100
|
handlers: s,
|
|
2097
|
-
onChange: (b) =>
|
|
2101
|
+
onChange: (b) => m == null ? void 0 : m(b),
|
|
2098
2102
|
groupByTrigger: !0,
|
|
2099
2103
|
allowCondition: !0
|
|
2100
2104
|
}
|
|
@@ -2114,15 +2118,15 @@ const It = /* @__PURE__ */ ee(
|
|
|
2114
2118
|
}), d.push({
|
|
2115
2119
|
key: "source",
|
|
2116
2120
|
label: v("moduleEditor.tab.source", "Source"),
|
|
2117
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e("pre", { className: "nice-module-editor__source", children: JSON.stringify(
|
|
2121
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e("pre", { className: "nice-module-editor__source", children: JSON.stringify(E, null, 2) }) })
|
|
2118
2122
|
}), d;
|
|
2119
2123
|
}, [
|
|
2120
|
-
|
|
2124
|
+
E,
|
|
2121
2125
|
o,
|
|
2122
2126
|
i,
|
|
2123
2127
|
n,
|
|
2128
|
+
h,
|
|
2124
2129
|
f,
|
|
2125
|
-
p,
|
|
2126
2130
|
y,
|
|
2127
2131
|
s,
|
|
2128
2132
|
F,
|
|
@@ -2136,9 +2140,9 @@ const It = /* @__PURE__ */ ee(
|
|
|
2136
2140
|
return d ? k.filter(
|
|
2137
2141
|
(b) => b.id.toLowerCase().includes(d) || (b.name ?? "").toLowerCase().includes(d) || (b.category ?? "").toLowerCase().includes(d)
|
|
2138
2142
|
) : k;
|
|
2139
|
-
}, [k, U]),
|
|
2143
|
+
}, [k, U]), Pe = q(() => {
|
|
2140
2144
|
const d = [];
|
|
2141
|
-
return S && d.push({ key: "mod", label: S + (
|
|
2145
|
+
return S && d.push({ key: "mod", label: S + (p ? " •" : ""), position: "left" }), d.push({
|
|
2142
2146
|
key: "val",
|
|
2143
2147
|
label: /* @__PURE__ */ u("span", { className: "nice-module-editor__status", children: [
|
|
2144
2148
|
/* @__PURE__ */ e(z, { name: B.length === 0 ? "check" : "warning", size: 12 }),
|
|
@@ -2146,7 +2150,7 @@ const It = /* @__PURE__ */ ee(
|
|
|
2146
2150
|
] }),
|
|
2147
2151
|
position: "left"
|
|
2148
2152
|
}), d;
|
|
2149
|
-
}, [S,
|
|
2153
|
+
}, [S, p, B.length, v]), qe = /* @__PURE__ */ u("div", { className: "nice-module-editor__browser", "data-tour": "nme-browser", children: [
|
|
2150
2154
|
/* @__PURE__ */ e(
|
|
2151
2155
|
"input",
|
|
2152
2156
|
{
|
|
@@ -2172,18 +2176,18 @@ const It = /* @__PURE__ */ ee(
|
|
|
2172
2176
|
},
|
|
2173
2177
|
d.id
|
|
2174
2178
|
)),
|
|
2175
|
-
ye.length === 0 && /* @__PURE__ */ e("div", { className: "nice-module-editor__browser-empty", children:
|
|
2179
|
+
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.") })
|
|
2176
2180
|
] })
|
|
2177
|
-
] }),
|
|
2178
|
-
/* @__PURE__ */ e("strong", { className: "nice-module-editor__title", "data-tour": "nme-tabs", children: S ? ((ge =
|
|
2179
|
-
|
|
2181
|
+
] }), Re = /* @__PURE__ */ u("div", { className: "nice-module-editor__toolbar", children: [
|
|
2182
|
+
/* @__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") }),
|
|
2183
|
+
N && /* @__PURE__ */ e(se, { steps: ce(N, Mt) }),
|
|
2180
2184
|
/* @__PURE__ */ e("span", { className: "nice-module-editor__spacer" }),
|
|
2181
|
-
/* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled:
|
|
2185
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled: w, children: [
|
|
2182
2186
|
/* @__PURE__ */ e(z, { name: "refresh", size: 14 }),
|
|
2183
2187
|
" ",
|
|
2184
2188
|
v("moduleEditor.refresh", "Refresh")
|
|
2185
2189
|
] }),
|
|
2186
|
-
/* @__PURE__ */ u("button", { type: "button", "data-tour": "nme-validate", onClick: Y, disabled: !
|
|
2190
|
+
/* @__PURE__ */ u("button", { type: "button", "data-tour": "nme-validate", onClick: Y, disabled: !E, children: [
|
|
2187
2191
|
/* @__PURE__ */ e(z, { name: "check", size: 14 }),
|
|
2188
2192
|
" ",
|
|
2189
2193
|
v("moduleEditor.validate", "Validate")
|
|
@@ -2195,27 +2199,27 @@ const It = /* @__PURE__ */ ee(
|
|
|
2195
2199
|
"data-tour": "nme-save",
|
|
2196
2200
|
className: "nice-module-editor__save",
|
|
2197
2201
|
onClick: () => void V(),
|
|
2198
|
-
disabled: !
|
|
2199
|
-
children:
|
|
2202
|
+
disabled: !E || !p || w,
|
|
2203
|
+
children: w ? v("moduleEditor.saving", "Saving…") : v("moduleEditor.save", "Save")
|
|
2200
2204
|
}
|
|
2201
2205
|
)
|
|
2202
|
-
] }),
|
|
2206
|
+
] }), je = "nice-module-editor" + ($ ? ` ${$}` : "");
|
|
2203
2207
|
return /* @__PURE__ */ e(
|
|
2204
2208
|
Te,
|
|
2205
2209
|
{
|
|
2206
2210
|
ref: a,
|
|
2207
2211
|
id: D,
|
|
2208
|
-
className:
|
|
2212
|
+
className: je,
|
|
2209
2213
|
style: { height: C, ...J },
|
|
2210
2214
|
"data-testid": I,
|
|
2211
2215
|
theme: A,
|
|
2212
2216
|
tabs: ne,
|
|
2213
2217
|
activeTabKey: G,
|
|
2214
2218
|
onTabChange: re,
|
|
2215
|
-
toolbar:
|
|
2216
|
-
sidePanel:
|
|
2219
|
+
toolbar: Re,
|
|
2220
|
+
sidePanel: qe,
|
|
2217
2221
|
sidePanelWidth: 260,
|
|
2218
|
-
statusItems:
|
|
2222
|
+
statusItems: Pe,
|
|
2219
2223
|
bottomPanel: /* @__PURE__ */ e("div", { "data-tour": "nme-output", style: { height: "100%" }, children: /* @__PURE__ */ e(
|
|
2220
2224
|
Fe,
|
|
2221
2225
|
{
|
|
@@ -2225,7 +2229,7 @@ const It = /* @__PURE__ */ ee(
|
|
|
2225
2229
|
maxHeight: "100%"
|
|
2226
2230
|
}
|
|
2227
2231
|
) }),
|
|
2228
|
-
children: !
|
|
2232
|
+
children: !E && /* @__PURE__ */ e("div", { className: "nice-module-editor__placeholder", children: v("moduleEditor.placeholder", "Select a module from the left to start editing.") })
|
|
2229
2233
|
}
|
|
2230
2234
|
);
|
|
2231
2235
|
}
|
|
@@ -2237,8 +2241,8 @@ function Kt({
|
|
|
2237
2241
|
}) {
|
|
2238
2242
|
var y;
|
|
2239
2243
|
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) => {
|
|
2240
|
-
a(t.map((
|
|
2241
|
-
},
|
|
2244
|
+
a(t.map((m) => m.id === o ? s : m)), s.id !== o && i(s.id);
|
|
2245
|
+
}, h = () => {
|
|
2242
2246
|
const s = {
|
|
2243
2247
|
id: `view-${Date.now().toString(36)}`,
|
|
2244
2248
|
name: "New View",
|
|
@@ -2248,8 +2252,8 @@ function Kt({
|
|
|
2248
2252
|
dataSources: []
|
|
2249
2253
|
};
|
|
2250
2254
|
a([...t, s]), i(s.id);
|
|
2251
|
-
},
|
|
2252
|
-
a(t.filter((
|
|
2255
|
+
}, f = (s) => {
|
|
2256
|
+
a(t.filter((m) => m.id !== s)), o === s && i(null);
|
|
2253
2257
|
};
|
|
2254
2258
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
2255
2259
|
/* @__PURE__ */ u("div", { className: "nice-module-views__bar", children: [
|
|
@@ -2266,13 +2270,13 @@ function Kt({
|
|
|
2266
2270
|
]
|
|
2267
2271
|
}
|
|
2268
2272
|
),
|
|
2269
|
-
/* @__PURE__ */ u("button", { type: "button", onClick:
|
|
2273
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: h, children: [
|
|
2270
2274
|
"+ ",
|
|
2271
2275
|
l("moduleEditor.views.new", "New view")
|
|
2272
2276
|
] }),
|
|
2273
|
-
n && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2277
|
+
n && /* @__PURE__ */ e("button", { type: "button", onClick: () => f(n.id), children: l("moduleEditor.delete", "Delete") })
|
|
2274
2278
|
] }),
|
|
2275
|
-
n ? /* @__PURE__ */ e(
|
|
2279
|
+
n ? /* @__PURE__ */ e(tt, { value: n, onChange: c, entities: r, height: 520 }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: l(
|
|
2276
2280
|
"moduleEditor.views.empty",
|
|
2277
2281
|
"No view selected. Create one, then use “New from entity” inside the editor."
|
|
2278
2282
|
) })
|
|
@@ -2282,8 +2286,8 @@ function Dt({
|
|
|
2282
2286
|
workflows: t,
|
|
2283
2287
|
onChange: r
|
|
2284
2288
|
}) {
|
|
2285
|
-
var
|
|
2286
|
-
const { t: a } = Z(), [l, o] = M(((
|
|
2289
|
+
var f;
|
|
2290
|
+
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) => {
|
|
2287
2291
|
r(t.map((s) => s.id === l ? y : s)), y.id !== l && o(y.id);
|
|
2288
2292
|
}, c = () => {
|
|
2289
2293
|
const y = {
|
|
@@ -2295,7 +2299,7 @@ function Dt({
|
|
|
2295
2299
|
transitions: []
|
|
2296
2300
|
};
|
|
2297
2301
|
r([...t, y]), o(y.id);
|
|
2298
|
-
},
|
|
2302
|
+
}, h = (y) => {
|
|
2299
2303
|
r(t.filter((s) => s.id !== y)), l === y && o(null);
|
|
2300
2304
|
};
|
|
2301
2305
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
@@ -2317,9 +2321,9 @@ function Dt({
|
|
|
2317
2321
|
"+ ",
|
|
2318
2322
|
a("moduleEditor.workflows.new", "New workflow")
|
|
2319
2323
|
] }),
|
|
2320
|
-
i && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2324
|
+
i && /* @__PURE__ */ e("button", { type: "button", onClick: () => h(i.id), children: a("moduleEditor.delete", "Delete") })
|
|
2321
2325
|
] }),
|
|
2322
|
-
i ? /* @__PURE__ */ e(
|
|
2326
|
+
i ? /* @__PURE__ */ e(it, { workflow: i, onChange: n }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: a(
|
|
2323
2327
|
"moduleEditor.workflows.empty",
|
|
2324
2328
|
"No workflow selected. Create one to start designing states and transitions."
|
|
2325
2329
|
) })
|
|
@@ -2380,8 +2384,8 @@ function Pt({
|
|
|
2380
2384
|
}) {
|
|
2381
2385
|
var y;
|
|
2382
2386
|
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) => {
|
|
2383
|
-
a(t.map((
|
|
2384
|
-
},
|
|
2387
|
+
a(t.map((m) => m.key === o ? s : m)), s.key !== o && i(s.key);
|
|
2388
|
+
}, h = () => {
|
|
2385
2389
|
const s = {
|
|
2386
2390
|
key: `ds-${Date.now().toString(36)}`,
|
|
2387
2391
|
kind: "query",
|
|
@@ -2389,8 +2393,8 @@ function Pt({
|
|
|
2389
2393
|
sql: ""
|
|
2390
2394
|
};
|
|
2391
2395
|
a([...t, s]), i(s.key);
|
|
2392
|
-
},
|
|
2393
|
-
a(t.filter((
|
|
2396
|
+
}, f = (s) => {
|
|
2397
|
+
a(t.filter((m) => m.key !== s)), o === s && i(null);
|
|
2394
2398
|
};
|
|
2395
2399
|
return /* @__PURE__ */ u("div", { className: "nice-module-views", children: [
|
|
2396
2400
|
/* @__PURE__ */ u("div", { className: "nice-module-views__bar", children: [
|
|
@@ -2407,13 +2411,13 @@ function Pt({
|
|
|
2407
2411
|
]
|
|
2408
2412
|
}
|
|
2409
2413
|
),
|
|
2410
|
-
/* @__PURE__ */ u("button", { type: "button", onClick:
|
|
2414
|
+
/* @__PURE__ */ u("button", { type: "button", onClick: h, children: [
|
|
2411
2415
|
"+ ",
|
|
2412
2416
|
l("moduleEditor.data.new", "New data source")
|
|
2413
2417
|
] }),
|
|
2414
|
-
n && /* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
2418
|
+
n && /* @__PURE__ */ e("button", { type: "button", onClick: () => f(n.key), children: l("moduleEditor.delete", "Delete") })
|
|
2415
2419
|
] }),
|
|
2416
|
-
n ? /* @__PURE__ */ e(
|
|
2420
|
+
n ? /* @__PURE__ */ e(nt, { value: n, onChange: c, schemas: r }) : /* @__PURE__ */ e("div", { className: "nice-module-views__empty", children: l(
|
|
2417
2421
|
"moduleEditor.data.empty",
|
|
2418
2422
|
"No data source selected. Create one to build a query from your module’s schema."
|
|
2419
2423
|
) })
|
|
@@ -2429,10 +2433,10 @@ export {
|
|
|
2429
2433
|
de as NiceSchemaForm,
|
|
2430
2434
|
Yt as defineManifestSection,
|
|
2431
2435
|
Jt as formBuilderSchemaToNiceFormItems,
|
|
2432
|
-
|
|
2436
|
+
Ie as formFieldsToFormItems,
|
|
2433
2437
|
Wt as formSchemaToJsonSchema,
|
|
2434
|
-
|
|
2438
|
+
Ce as jsonSchemaToFormItems,
|
|
2435
2439
|
Ut as schemaToFormItems,
|
|
2436
|
-
|
|
2440
|
+
Ae as validateAgainstJsonSchema,
|
|
2437
2441
|
Ht as validateFormSchema
|
|
2438
2442
|
};
|