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