@nice2dev/ui-forms 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +457 -461
- package/dist/ui-forms.css +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { useNiceTranslation as ze } from "@nice2dev/i18n";
|
|
3
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 Je, useNiceAI as Ue, useFormGeneration as He, NiceScriptRunner as we, NiceLifecycleHooksEditor as ke, NiceRevisionHistory as Se, NiceConsole as Te, NiceLogConsole as Fe, NiceBadge as ae, NiceValidationBuilder as Ge, NiceButton as te, NiceTabs as We, NiceCheckbox as Ye, NiceSelect as Qe, NiceTextInput as Xe, NiceAccessManager as Ze, NiceViewEditor as et, NiceWorkflowDesigner as tt, NiceDataSourceBuilder as it } from "@nice2dev/ui";
|
|
4
|
-
import nt, { useState as
|
|
4
|
+
import nt, { useState as M, forwardRef as ee, useMemo as q, useEffect as oe, useCallback as Q, useImperativeHandle as at } from "react";
|
|
5
5
|
import { useNiceTranslation as ot, useControllableState as rt, NiceTutorialButton as lt, resolveTutorial as st, NiceIcon as be } from "@nice2dev/ui-core";
|
|
6
|
-
function
|
|
6
|
+
function Jt(t) {
|
|
7
7
|
var l, o;
|
|
8
8
|
const r = {
|
|
9
9
|
text: "text",
|
|
@@ -85,7 +85,7 @@ function ve(t) {
|
|
|
85
85
|
helpText: t.helpText
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Ut(t) {
|
|
89
89
|
const r = [];
|
|
90
90
|
for (const a of t.sections)
|
|
91
91
|
a.title ? r.push({
|
|
@@ -96,7 +96,7 @@ function zt(t) {
|
|
|
96
96
|
}) : r.push(...a.fields.map(ve));
|
|
97
97
|
return r;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Ht(t) {
|
|
100
100
|
const r = [];
|
|
101
101
|
t.version || r.push("Missing schema version"), t.id || r.push("Missing form ID"), (!t.sections || t.sections.length === 0) && r.push("Form must have at least one section");
|
|
102
102
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -106,13 +106,13 @@ function Jt(t) {
|
|
|
106
106
|
return { valid: r.length === 0, errors: r };
|
|
107
107
|
}
|
|
108
108
|
function _e(t) {
|
|
109
|
-
const { value: r, onChange: a, readOnly: l } = t, [o, i] =
|
|
109
|
+
const { value: r, onChange: a, readOnly: l } = t, [o, i] = M(() => {
|
|
110
110
|
try {
|
|
111
111
|
return r === void 0 ? "" : JSON.stringify(r, null, 2);
|
|
112
112
|
} catch {
|
|
113
113
|
return "";
|
|
114
114
|
}
|
|
115
|
-
}), [n, c] =
|
|
115
|
+
}), [n, c] = M(null);
|
|
116
116
|
return nt.useEffect(() => {
|
|
117
117
|
try {
|
|
118
118
|
i(r === void 0 ? "" : JSON.stringify(r, null, 2));
|
|
@@ -329,7 +329,7 @@ const ue = "__nafRid";
|
|
|
329
329
|
function mt(t) {
|
|
330
330
|
return Array.isArray(t) ? `[${t.length}]` : t && typeof t == "object" ? "{…}" : t == null ? "" : String(t);
|
|
331
331
|
}
|
|
332
|
-
const pt = ee(
|
|
332
|
+
const pt = /* @__PURE__ */ ee(
|
|
333
333
|
function(r, a) {
|
|
334
334
|
const {
|
|
335
335
|
value: l,
|
|
@@ -348,14 +348,14 @@ const pt = ee(
|
|
|
348
348
|
fallbackValue: [],
|
|
349
349
|
onChange: i,
|
|
350
350
|
componentName: "NiceArrayField"
|
|
351
|
-
}),
|
|
352
|
-
const v =
|
|
351
|
+
}), K = n.properties ?? {}, A = q(() => (p ?? Object.keys(K)).map((I) => {
|
|
352
|
+
const v = K[I] ?? {}, k = { field: I, header: v.title ?? I };
|
|
353
353
|
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, p]), C =
|
|
354
|
+
}), [n, p]), C = q(
|
|
355
355
|
() => xe(n),
|
|
356
356
|
[n]
|
|
357
|
-
), w =
|
|
358
|
-
const { [ue]: I, ...v } =
|
|
357
|
+
), w = q(() => F.map((D, I) => ({ ...D, [ue]: String(I) })), [F]), $ = (D) => {
|
|
358
|
+
const { [ue]: I, ...v } = D;
|
|
359
359
|
return v;
|
|
360
360
|
}, J = "nice-array-field" + (y ? ` ${y}` : "");
|
|
361
361
|
return /* @__PURE__ */ e("div", { ref: a, className: J, style: s, "data-testid": h, children: /* @__PURE__ */ e(
|
|
@@ -369,17 +369,17 @@ const pt = ee(
|
|
|
369
369
|
editFormTitle: c ? `${c} — item` : "Edit item",
|
|
370
370
|
emptyText: `No items${c ? ` in ${c}` : ""}`,
|
|
371
371
|
compact: !0,
|
|
372
|
-
onRowAdd: f ? void 0 : (
|
|
373
|
-
onRowEdit: f ? void 0 : (
|
|
374
|
-
const v = Number(
|
|
372
|
+
onRowAdd: f ? void 0 : (D) => O([...F, $(D)]),
|
|
373
|
+
onRowEdit: f ? void 0 : (D, I) => {
|
|
374
|
+
const v = Number(D);
|
|
375
375
|
O(
|
|
376
376
|
F.map(
|
|
377
377
|
(k, j) => j === v ? $(I) : k
|
|
378
378
|
)
|
|
379
379
|
);
|
|
380
380
|
},
|
|
381
|
-
onRowDelete: f ? void 0 : (
|
|
382
|
-
const I = Number(
|
|
381
|
+
onRowDelete: f ? void 0 : (D) => {
|
|
382
|
+
const I = Number(D);
|
|
383
383
|
O(F.filter((v, k) => k !== I));
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -434,7 +434,7 @@ function ft(t) {
|
|
|
434
434
|
function yt(t, r) {
|
|
435
435
|
return Ee(ft(t), r).filter((a) => a.severity === "error").map((a) => ({ field: a.field, message: a.message }));
|
|
436
436
|
}
|
|
437
|
-
const de = ee(
|
|
437
|
+
const de = /* @__PURE__ */ ee(
|
|
438
438
|
function(r, a) {
|
|
439
439
|
const {
|
|
440
440
|
schema: l,
|
|
@@ -449,19 +449,19 @@ const de = ee(
|
|
|
449
449
|
labelPosition: h = "top",
|
|
450
450
|
readOnly: F = !1,
|
|
451
451
|
liveValidation: O = !0,
|
|
452
|
-
validationRules:
|
|
452
|
+
validationRules: K,
|
|
453
453
|
tutorial: A,
|
|
454
454
|
className: C,
|
|
455
455
|
style: w,
|
|
456
456
|
id: $,
|
|
457
457
|
"data-testid": J
|
|
458
|
-
} = r, { t:
|
|
458
|
+
} = r, { t: D } = Z(), [I, v] = le({
|
|
459
459
|
value: n,
|
|
460
460
|
defaultValue: c,
|
|
461
461
|
fallbackValue: {},
|
|
462
462
|
onChange: f,
|
|
463
463
|
componentName: "NiceSchemaForm"
|
|
464
|
-
}), [k, j] =
|
|
464
|
+
}), [k, j] = M(!1), [U, L] = M(""), [S, H] = M(null), N = q(() => l ? xe(l, {
|
|
465
465
|
uiSchema: i,
|
|
466
466
|
// Inject the structured array editor (avoids an import cycle in the converter).
|
|
467
467
|
renderArrayField: (E, g, x, R) => /* @__PURE__ */ e(
|
|
@@ -474,17 +474,17 @@ const de = ee(
|
|
|
474
474
|
readOnly: F
|
|
475
475
|
}
|
|
476
476
|
)
|
|
477
|
-
}) : o ? Ce(o, { uiSchema: i }) : [], [l, o, i, F]),
|
|
477
|
+
}) : o ? Ce(o, { uiSchema: i }) : [], [l, o, i, F]), P = q(() => {
|
|
478
478
|
const E = l ? Ie(I, l) : o ? yt(o, I) : [];
|
|
479
|
-
if (
|
|
480
|
-
const g = Ee(
|
|
479
|
+
if (K != null && K.length) {
|
|
480
|
+
const g = Ee(K, I).filter((x) => x.severity === "error").map((x) => ({ field: x.field, message: x.message }));
|
|
481
481
|
return [...E, ...g];
|
|
482
482
|
}
|
|
483
483
|
return E;
|
|
484
|
-
}, [l, o, I,
|
|
484
|
+
}, [l, o, I, K]);
|
|
485
485
|
oe(() => {
|
|
486
|
-
p == null || p(
|
|
487
|
-
}, [
|
|
486
|
+
p == null || p(P);
|
|
487
|
+
}, [P, p]), oe(() => {
|
|
488
488
|
if (k)
|
|
489
489
|
try {
|
|
490
490
|
L(JSON.stringify(I, null, 2)), H(null);
|
|
@@ -503,20 +503,20 @@ const de = ee(
|
|
|
503
503
|
type: "button",
|
|
504
504
|
className: "nice-schema-form__tab" + (k ? "" : " nice-schema-form__tab--active"),
|
|
505
505
|
onClick: () => j(!1),
|
|
506
|
-
children:
|
|
506
|
+
children: D("schemaForm.tab.form", "Form")
|
|
507
507
|
}
|
|
508
508
|
),
|
|
509
509
|
/* @__PURE__ */ e(
|
|
510
510
|
X,
|
|
511
511
|
{
|
|
512
|
-
content:
|
|
512
|
+
content: D("schemaForm.tab.json.help", "Edit the raw JSON value directly"),
|
|
513
513
|
children: /* @__PURE__ */ e(
|
|
514
514
|
"button",
|
|
515
515
|
{
|
|
516
516
|
type: "button",
|
|
517
517
|
className: "nice-schema-form__tab" + (k ? " nice-schema-form__tab--active" : ""),
|
|
518
518
|
onClick: () => j(!0),
|
|
519
|
-
children:
|
|
519
|
+
children: D("schemaForm.tab.json", "JSON")
|
|
520
520
|
}
|
|
521
521
|
)
|
|
522
522
|
}
|
|
@@ -540,7 +540,7 @@ const de = ee(
|
|
|
540
540
|
H(null), v(x);
|
|
541
541
|
} catch (x) {
|
|
542
542
|
H(
|
|
543
|
-
x instanceof Error ? x.message :
|
|
543
|
+
x instanceof Error ? x.message : D("schemaForm.invalidJson", "Invalid JSON")
|
|
544
544
|
);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
@@ -558,7 +558,7 @@ const de = ee(
|
|
|
558
558
|
readOnly: F
|
|
559
559
|
}
|
|
560
560
|
),
|
|
561
|
-
O &&
|
|
561
|
+
O && P.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-schema-form__errors", role: "alert", children: P.map((E, g) => /* @__PURE__ */ e("li", { className: "nice-schema-form__error", children: E.message }, `${E.field}-${g}`)) })
|
|
562
562
|
] });
|
|
563
563
|
}
|
|
564
564
|
), gt = [
|
|
@@ -635,232 +635,230 @@ function vt(t) {
|
|
|
635
635
|
};
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
)
|
|
663
|
-
(g)
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
),
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
/* @__PURE__ */ u(
|
|
701
|
-
|
|
638
|
+
const Gt = /* @__PURE__ */ ee(function(r, a) {
|
|
639
|
+
const {
|
|
640
|
+
enableAI: l = !0,
|
|
641
|
+
aiModel: o,
|
|
642
|
+
enableGenerate: i = !0,
|
|
643
|
+
enableSuggestions: n = !0,
|
|
644
|
+
onGenerate: c,
|
|
645
|
+
showAIToolbar: f = !0,
|
|
646
|
+
templates: p = gt,
|
|
647
|
+
fields: y,
|
|
648
|
+
onChange: s
|
|
649
|
+
} = r, [h, F] = M(!1), [O, K] = M(""), [A, C] = M([]), [w, $] = M(y || []), [J, D] = M(!1), [I, v] = M({}), { t: k } = ze(), j = Ue(), { generateForm: U, isLoading: L } = He(), S = l && j.isConfigured, H = Q(
|
|
650
|
+
async (g) => {
|
|
651
|
+
if (!S || !i || !g.trim())
|
|
652
|
+
return [];
|
|
653
|
+
try {
|
|
654
|
+
const x = await U(g);
|
|
655
|
+
return C(x), c == null || c(g, x), x;
|
|
656
|
+
} catch {
|
|
657
|
+
return [];
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
[S, i, U, c]
|
|
661
|
+
), N = Q(
|
|
662
|
+
(g) => {
|
|
663
|
+
const x = vt(g);
|
|
664
|
+
$((R) => [...R, ...x]), s == null || s([...w, ...x]), F(!1), C([]), K("");
|
|
665
|
+
},
|
|
666
|
+
[s]
|
|
667
|
+
), P = Q(() => w, [w]), m = Q(() => {
|
|
668
|
+
$([]), s == null || s([]);
|
|
669
|
+
}, [s]), _ = (g) => {
|
|
670
|
+
K(g.description), D(!1), H(g.description);
|
|
671
|
+
};
|
|
672
|
+
at(a, () => ({
|
|
673
|
+
generateForm: H,
|
|
674
|
+
getFields: P,
|
|
675
|
+
applyFields: N,
|
|
676
|
+
clearFields: m
|
|
677
|
+
}));
|
|
678
|
+
const E = (g) => ({
|
|
679
|
+
text: "edit",
|
|
680
|
+
textarea: "file",
|
|
681
|
+
number: "hash",
|
|
682
|
+
email: "mail",
|
|
683
|
+
password: "lock",
|
|
684
|
+
phone: "phone",
|
|
685
|
+
date: "calendar",
|
|
686
|
+
select: "list",
|
|
687
|
+
checkbox: "check",
|
|
688
|
+
toggle: "settings",
|
|
689
|
+
radio: "circle",
|
|
690
|
+
file: "paperclip",
|
|
691
|
+
rating: "star"
|
|
692
|
+
})[g] || "edit";
|
|
693
|
+
return /* @__PURE__ */ u("div", { className: "nice-form-builder-ai", "data-testid": r["data-testid"], children: [
|
|
694
|
+
f && S && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar", children: [
|
|
695
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-left", children: [
|
|
696
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: "AI" }),
|
|
697
|
+
L && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__loading", children: k("formBuilderAI.generating", "Generating...") })
|
|
698
|
+
] }),
|
|
699
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-right", children: [
|
|
700
|
+
i && /* @__PURE__ */ u(
|
|
701
|
+
"button",
|
|
702
|
+
{
|
|
703
|
+
type: "button",
|
|
704
|
+
className: "nice-form-builder-ai__btn",
|
|
705
|
+
onClick: () => F(!0),
|
|
706
|
+
disabled: L,
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
709
|
+
" ",
|
|
710
|
+
k("formBuilderAI.generateForm", "Generate Form")
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__templates-dropdown", children: [
|
|
715
|
+
/* @__PURE__ */ u(
|
|
702
716
|
"button",
|
|
703
717
|
{
|
|
704
718
|
type: "button",
|
|
705
|
-
className: "nice-form-builder-ai__btn",
|
|
706
|
-
onClick: () =>
|
|
707
|
-
disabled: L,
|
|
719
|
+
className: "nice-form-builder-ai__btn nice-form-builder-ai__btn--secondary",
|
|
720
|
+
onClick: () => D(!J),
|
|
708
721
|
children: [
|
|
709
|
-
/* @__PURE__ */ e(z, { name: "
|
|
722
|
+
/* @__PURE__ */ e(z, { name: "list", size: "sm" }),
|
|
723
|
+
" ",
|
|
724
|
+
k("formBuilderAI.templates", "Templates"),
|
|
710
725
|
" ",
|
|
711
|
-
|
|
726
|
+
/* @__PURE__ */ e(z, { name: "chevron-down", size: "sm" })
|
|
712
727
|
]
|
|
713
728
|
}
|
|
714
729
|
),
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
children:
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
]
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: p.map((g, x) => /* @__PURE__ */ u(
|
|
732
|
-
"button",
|
|
733
|
-
{
|
|
734
|
-
type: "button",
|
|
735
|
-
className: "nice-form-builder-ai__template-item",
|
|
736
|
-
onClick: () => _(g),
|
|
737
|
-
children: [
|
|
738
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
|
|
739
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
|
|
740
|
-
]
|
|
741
|
-
},
|
|
742
|
-
x
|
|
743
|
-
)) })
|
|
744
|
-
] })
|
|
730
|
+
J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: p.map((g, x) => /* @__PURE__ */ u(
|
|
731
|
+
"button",
|
|
732
|
+
{
|
|
733
|
+
type: "button",
|
|
734
|
+
className: "nice-form-builder-ai__template-item",
|
|
735
|
+
onClick: () => _(g),
|
|
736
|
+
children: [
|
|
737
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
|
|
738
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
x
|
|
742
|
+
)) })
|
|
745
743
|
] })
|
|
746
|
-
] })
|
|
747
|
-
|
|
748
|
-
|
|
744
|
+
] })
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__builder-wrapper", children: /* @__PURE__ */ e(
|
|
747
|
+
de,
|
|
748
|
+
{
|
|
749
|
+
fields: w,
|
|
750
|
+
value: I,
|
|
751
|
+
onChange: v,
|
|
752
|
+
columns: 1
|
|
753
|
+
}
|
|
754
|
+
) }),
|
|
755
|
+
h && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel", children: [
|
|
756
|
+
/* @__PURE__ */ e(
|
|
757
|
+
"div",
|
|
749
758
|
{
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
onChange: v,
|
|
753
|
-
columns: 1
|
|
759
|
+
className: "nice-form-builder-ai__panel-overlay",
|
|
760
|
+
onClick: () => F(!1)
|
|
754
761
|
}
|
|
755
|
-
)
|
|
756
|
-
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
"
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
),
|
|
764
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
|
|
765
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
|
|
766
|
-
/* @__PURE__ */ u("h4", { children: [
|
|
767
|
-
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
768
|
-
" ",
|
|
769
|
-
k("formBuilderAI.generateFormTitle", "Generate Form with AI")
|
|
770
|
-
] }),
|
|
771
|
-
/* @__PURE__ */ e(
|
|
772
|
-
"button",
|
|
773
|
-
{
|
|
774
|
-
type: "button",
|
|
775
|
-
className: "nice-form-builder-ai__panel-close",
|
|
776
|
-
onClick: () => {
|
|
777
|
-
F(!1), C([]), D("");
|
|
778
|
-
},
|
|
779
|
-
"aria-label": "Close",
|
|
780
|
-
children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
|
|
781
|
-
}
|
|
782
|
-
)
|
|
783
|
-
] }),
|
|
784
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
|
|
785
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
|
|
786
|
-
/* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
|
|
787
|
-
/* @__PURE__ */ e(
|
|
788
|
-
"textarea",
|
|
789
|
-
{
|
|
790
|
-
className: "nice-form-builder-ai__textarea",
|
|
791
|
-
placeholder: k(
|
|
792
|
-
"formBuilderAI.promptPlaceholder",
|
|
793
|
-
'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
|
|
794
|
-
),
|
|
795
|
-
value: O,
|
|
796
|
-
onChange: (g) => D(g.target.value),
|
|
797
|
-
rows: 3
|
|
798
|
-
}
|
|
799
|
-
),
|
|
800
|
-
/* @__PURE__ */ e(
|
|
801
|
-
"button",
|
|
802
|
-
{
|
|
803
|
-
type: "button",
|
|
804
|
-
className: "nice-form-builder-ai__generate-btn",
|
|
805
|
-
onClick: () => H(O),
|
|
806
|
-
disabled: L || !O.trim(),
|
|
807
|
-
children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
|
|
808
|
-
}
|
|
809
|
-
)
|
|
810
|
-
] }),
|
|
811
|
-
A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
|
|
812
|
-
/* @__PURE__ */ e("h5", { children: k("formBuilderAI.previewCount", "Preview ({count} fields)").replace(
|
|
813
|
-
"{count}",
|
|
814
|
-
String(A.length)
|
|
815
|
-
) }),
|
|
816
|
-
/* @__PURE__ */ e("div", { className: "nice-form-builder-ai__fields-preview", children: A.map((g, x) => /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-preview", children: [
|
|
817
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: E(g.type), size: "sm" }) }),
|
|
818
|
-
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
|
|
819
|
-
/* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
|
|
820
|
-
g.label,
|
|
821
|
-
g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
|
|
822
|
-
] }),
|
|
823
|
-
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
|
|
824
|
-
] }),
|
|
825
|
-
g.options && /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-options", children: [
|
|
826
|
-
g.options.length,
|
|
827
|
-
" options"
|
|
828
|
-
] })
|
|
829
|
-
] }, x)) })
|
|
830
|
-
] })
|
|
762
|
+
),
|
|
763
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
|
|
764
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
|
|
765
|
+
/* @__PURE__ */ u("h4", { children: [
|
|
766
|
+
/* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
|
|
767
|
+
" ",
|
|
768
|
+
k("formBuilderAI.generateFormTitle", "Generate Form with AI")
|
|
831
769
|
] }),
|
|
832
|
-
/* @__PURE__ */
|
|
833
|
-
|
|
834
|
-
|
|
770
|
+
/* @__PURE__ */ e(
|
|
771
|
+
"button",
|
|
772
|
+
{
|
|
773
|
+
type: "button",
|
|
774
|
+
className: "nice-form-builder-ai__panel-close",
|
|
775
|
+
onClick: () => {
|
|
776
|
+
F(!1), C([]), K("");
|
|
777
|
+
},
|
|
778
|
+
"aria-label": k("formBuilderAI.close", "Close"),
|
|
779
|
+
children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
|
|
780
|
+
}
|
|
781
|
+
)
|
|
782
|
+
] }),
|
|
783
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
|
|
784
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
|
|
785
|
+
/* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
|
|
786
|
+
/* @__PURE__ */ e(
|
|
787
|
+
"textarea",
|
|
835
788
|
{
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
]
|
|
789
|
+
className: "nice-form-builder-ai__textarea",
|
|
790
|
+
placeholder: k(
|
|
791
|
+
"formBuilderAI.promptPlaceholder",
|
|
792
|
+
'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
|
|
793
|
+
),
|
|
794
|
+
value: O,
|
|
795
|
+
onChange: (g) => K(g.target.value),
|
|
796
|
+
rows: 3
|
|
845
797
|
}
|
|
846
798
|
),
|
|
847
799
|
/* @__PURE__ */ e(
|
|
848
800
|
"button",
|
|
849
801
|
{
|
|
850
802
|
type: "button",
|
|
851
|
-
className: "nice-form-builder-
|
|
852
|
-
onClick: () =>
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
children: k("formBuilderAI.cancel", "Cancel")
|
|
803
|
+
className: "nice-form-builder-ai__generate-btn",
|
|
804
|
+
onClick: () => H(O),
|
|
805
|
+
disabled: L || !O.trim(),
|
|
806
|
+
children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
|
|
856
807
|
}
|
|
857
808
|
)
|
|
809
|
+
] }),
|
|
810
|
+
A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
|
|
811
|
+
/* @__PURE__ */ e("h5", { children: k("formBuilderAI.previewCount", "Preview ({count} fields)").replace(
|
|
812
|
+
"{count}",
|
|
813
|
+
String(A.length)
|
|
814
|
+
) }),
|
|
815
|
+
/* @__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: E(g.type), size: "sm" }) }),
|
|
817
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
|
|
818
|
+
/* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
|
|
819
|
+
g.label,
|
|
820
|
+
g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
|
|
821
|
+
] }),
|
|
822
|
+
/* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
|
|
823
|
+
] }),
|
|
824
|
+
g.options && /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-options", children: [
|
|
825
|
+
g.options.length,
|
|
826
|
+
" options"
|
|
827
|
+
] })
|
|
828
|
+
] }, x)) })
|
|
858
829
|
] })
|
|
830
|
+
] }),
|
|
831
|
+
/* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-footer", children: [
|
|
832
|
+
/* @__PURE__ */ u(
|
|
833
|
+
"button",
|
|
834
|
+
{
|
|
835
|
+
type: "button",
|
|
836
|
+
className: "nice-form-builder-ai__apply-btn",
|
|
837
|
+
onClick: () => N(A),
|
|
838
|
+
disabled: A.length === 0 || L,
|
|
839
|
+
children: [
|
|
840
|
+
/* @__PURE__ */ e(z, { name: "check", size: "sm" }),
|
|
841
|
+
" ",
|
|
842
|
+
k("formBuilderAI.addToForm", "Add to Form")
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
),
|
|
846
|
+
/* @__PURE__ */ e(
|
|
847
|
+
"button",
|
|
848
|
+
{
|
|
849
|
+
type: "button",
|
|
850
|
+
className: "nice-form-builder-ai__cancel-btn",
|
|
851
|
+
onClick: () => {
|
|
852
|
+
F(!1), C([]), K("");
|
|
853
|
+
},
|
|
854
|
+
children: k("formBuilderAI.cancel", "Cancel")
|
|
855
|
+
}
|
|
856
|
+
)
|
|
859
857
|
] })
|
|
860
858
|
] })
|
|
861
|
-
] })
|
|
862
|
-
}
|
|
863
|
-
), _t = {
|
|
859
|
+
] })
|
|
860
|
+
] });
|
|
861
|
+
}), _t = {
|
|
864
862
|
text: { type: "string" },
|
|
865
863
|
textarea: { type: "string" },
|
|
866
864
|
password: { type: "string", format: "password" },
|
|
@@ -925,7 +923,7 @@ function Et(t) {
|
|
|
925
923
|
enum: t.options.map((l) => typeof l == "string" ? l : String(l.value))
|
|
926
924
|
}), Nt(a, t.validations), a;
|
|
927
925
|
}
|
|
928
|
-
function
|
|
926
|
+
function Wt(t) {
|
|
929
927
|
const r = {}, a = [], l = (i) => {
|
|
930
928
|
var n;
|
|
931
929
|
for (const c of i) {
|
|
@@ -975,155 +973,153 @@ const wt = [
|
|
|
975
973
|
content: "Each section can be edited as a visual form or as raw JSON — use the toggle inside the section.",
|
|
976
974
|
placement: "auto"
|
|
977
975
|
}
|
|
978
|
-
];
|
|
979
|
-
function
|
|
976
|
+
], kt = [];
|
|
977
|
+
function Yt(t) {
|
|
980
978
|
return t;
|
|
981
979
|
}
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
de,
|
|
1023
|
-
{
|
|
1024
|
-
schema: G.schema,
|
|
1025
|
-
fields: G.fields,
|
|
1026
|
-
uiSchema: G.uiSchema,
|
|
1027
|
-
value: S,
|
|
1028
|
-
onChange: H,
|
|
1029
|
-
showJsonView: c
|
|
1030
|
-
}
|
|
1031
|
-
) })
|
|
1032
|
-
}));
|
|
1033
|
-
return f && R.push({
|
|
1034
|
-
key: "scripts",
|
|
1035
|
-
label: L("manifestEditor.tab.scripts", "Scripts"),
|
|
1036
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...f }) })
|
|
1037
|
-
}), p && p.length > 0 && R.push({
|
|
1038
|
-
key: "lifecycle",
|
|
1039
|
-
label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
|
|
1040
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1041
|
-
ke,
|
|
1042
|
-
{
|
|
1043
|
-
triggers: p,
|
|
1044
|
-
bindings: y,
|
|
1045
|
-
handlers: s,
|
|
1046
|
-
onChange: (G) => h == null ? void 0 : h(G),
|
|
1047
|
-
groupByTrigger: !0,
|
|
1048
|
-
allowCondition: !0
|
|
1049
|
-
}
|
|
1050
|
-
) })
|
|
1051
|
-
}), F && F.length > 0 && R.push({
|
|
1052
|
-
key: "history",
|
|
1053
|
-
label: L("manifestEditor.tab.history", "History"),
|
|
1054
|
-
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1055
|
-
Se,
|
|
1056
|
-
{
|
|
1057
|
-
revisions: F,
|
|
1058
|
-
onRollback: O,
|
|
1059
|
-
loadContent: D,
|
|
1060
|
-
language: "json"
|
|
1061
|
-
}
|
|
1062
|
-
) })
|
|
1063
|
-
}), w && R.push(...w), R;
|
|
1064
|
-
}, [
|
|
1065
|
-
i,
|
|
1066
|
-
S,
|
|
1067
|
-
H,
|
|
1068
|
-
c,
|
|
1069
|
-
f,
|
|
1070
|
-
p,
|
|
1071
|
-
y,
|
|
1072
|
-
s,
|
|
1073
|
-
h,
|
|
1074
|
-
F,
|
|
1075
|
-
O,
|
|
1076
|
-
D,
|
|
1077
|
-
w,
|
|
1078
|
-
L
|
|
1079
|
-
]), [q, m] = K(((x = N[0]) == null ? void 0 : x.key) ?? "");
|
|
1080
|
-
oe(() => {
|
|
1081
|
-
N.length > 0 && !N.some((R) => R.key === q) && m(N[0].key);
|
|
1082
|
-
}, [N, q]);
|
|
1083
|
-
const _ = P(() => $ ? $(S) : [], [$, S]), E = P(() => {
|
|
1084
|
-
const R = [
|
|
980
|
+
const Qt = /* @__PURE__ */ ee(function(r, a) {
|
|
981
|
+
var x;
|
|
982
|
+
const {
|
|
983
|
+
value: l,
|
|
984
|
+
defaultValue: o,
|
|
985
|
+
sections: i = kt,
|
|
986
|
+
onChange: n,
|
|
987
|
+
jsonView: c = !0,
|
|
988
|
+
scriptRunner: f,
|
|
989
|
+
triggers: p,
|
|
990
|
+
bindings: y = [],
|
|
991
|
+
handlers: s,
|
|
992
|
+
onBindingsChange: h,
|
|
993
|
+
revisions: F,
|
|
994
|
+
onRollback: O,
|
|
995
|
+
loadContent: K,
|
|
996
|
+
logs: A,
|
|
997
|
+
onClearLogs: C,
|
|
998
|
+
extraTabs: w,
|
|
999
|
+
validate: $,
|
|
1000
|
+
theme: J = "light",
|
|
1001
|
+
height: D = 560,
|
|
1002
|
+
tutorial: I,
|
|
1003
|
+
className: v,
|
|
1004
|
+
style: k,
|
|
1005
|
+
id: j,
|
|
1006
|
+
"data-testid": U
|
|
1007
|
+
} = r, { t: L } = Z(), [S, H] = le({
|
|
1008
|
+
value: l,
|
|
1009
|
+
defaultValue: o,
|
|
1010
|
+
fallbackValue: {},
|
|
1011
|
+
onChange: n,
|
|
1012
|
+
componentName: "NiceManifestEditor"
|
|
1013
|
+
}), N = q(() => {
|
|
1014
|
+
const R = i.map((G) => ({
|
|
1015
|
+
key: `section:${G.id}`,
|
|
1016
|
+
label: G.title,
|
|
1017
|
+
icon: G.icon,
|
|
1018
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1019
|
+
de,
|
|
1085
1020
|
{
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1021
|
+
schema: G.schema,
|
|
1022
|
+
fields: G.fields,
|
|
1023
|
+
uiSchema: G.uiSchema,
|
|
1024
|
+
value: S,
|
|
1025
|
+
onChange: H,
|
|
1026
|
+
showJsonView: c
|
|
1089
1027
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1028
|
+
) })
|
|
1029
|
+
}));
|
|
1030
|
+
return f && R.push({
|
|
1031
|
+
key: "scripts",
|
|
1032
|
+
label: L("manifestEditor.tab.scripts", "Scripts"),
|
|
1033
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...f }) })
|
|
1034
|
+
}), p && p.length > 0 && R.push({
|
|
1035
|
+
key: "lifecycle",
|
|
1036
|
+
label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
|
|
1037
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1038
|
+
ke,
|
|
1039
|
+
{
|
|
1040
|
+
triggers: p,
|
|
1041
|
+
bindings: y,
|
|
1042
|
+
handlers: s,
|
|
1043
|
+
onChange: (G) => h == null ? void 0 : h(G),
|
|
1044
|
+
groupByTrigger: !0,
|
|
1045
|
+
allowCondition: !0
|
|
1046
|
+
}
|
|
1047
|
+
) })
|
|
1048
|
+
}), F && F.length > 0 && R.push({
|
|
1049
|
+
key: "history",
|
|
1050
|
+
label: L("manifestEditor.tab.history", "History"),
|
|
1051
|
+
content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
|
|
1052
|
+
Se,
|
|
1053
|
+
{
|
|
1054
|
+
revisions: F,
|
|
1055
|
+
onRollback: O,
|
|
1056
|
+
loadContent: K,
|
|
1057
|
+
language: "json"
|
|
1058
|
+
}
|
|
1059
|
+
) })
|
|
1060
|
+
}), w && R.push(...w), R;
|
|
1061
|
+
}, [
|
|
1062
|
+
i,
|
|
1063
|
+
S,
|
|
1064
|
+
H,
|
|
1065
|
+
c,
|
|
1066
|
+
f,
|
|
1067
|
+
p,
|
|
1068
|
+
y,
|
|
1069
|
+
s,
|
|
1070
|
+
h,
|
|
1071
|
+
F,
|
|
1072
|
+
O,
|
|
1073
|
+
K,
|
|
1074
|
+
w,
|
|
1075
|
+
L
|
|
1076
|
+
]), [P, m] = M(((x = N[0]) == null ? void 0 : x.key) ?? "");
|
|
1077
|
+
oe(() => {
|
|
1078
|
+
N.length > 0 && !N.some((R) => R.key === P) && m(N[0].key);
|
|
1079
|
+
}, [N, P]);
|
|
1080
|
+
const _ = q(() => $ ? $(S) : [], [$, S]), E = q(() => {
|
|
1081
|
+
const R = [
|
|
1102
1082
|
{
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
style: { height: M, ...k },
|
|
1107
|
-
"data-testid": U,
|
|
1108
|
-
theme: J,
|
|
1109
|
-
tabs: N,
|
|
1110
|
-
activeTabKey: q,
|
|
1111
|
-
onTabChange: m,
|
|
1112
|
-
statusItems: E,
|
|
1113
|
-
toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
|
|
1114
|
-
bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
|
|
1115
|
-
Fe,
|
|
1116
|
-
{
|
|
1117
|
-
title: L("manifestEditor.output", "Output"),
|
|
1118
|
-
entries: A,
|
|
1119
|
-
onClear: C,
|
|
1120
|
-
maxHeight: "100%"
|
|
1121
|
-
}
|
|
1122
|
-
) : void 0
|
|
1083
|
+
key: "sections",
|
|
1084
|
+
label: `${i.length} ${L("manifestEditor.sections", "sections")}`,
|
|
1085
|
+
position: "left"
|
|
1123
1086
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1087
|
+
];
|
|
1088
|
+
return $ && R.push({
|
|
1089
|
+
key: "validation",
|
|
1090
|
+
label: /* @__PURE__ */ u("span", { className: "nice-manifest-editor__status", children: [
|
|
1091
|
+
/* @__PURE__ */ e(z, { name: _.length === 0 ? "check" : "warning", size: 12 }),
|
|
1092
|
+
_.length === 0 ? L("manifestEditor.status.valid", "Valid") : `${_.length} ${L("manifestEditor.status.issues", "issues")}`
|
|
1093
|
+
] }),
|
|
1094
|
+
position: "left"
|
|
1095
|
+
}), R;
|
|
1096
|
+
}, [i.length, $, _.length, L]), g = "nice-manifest-editor" + (v ? ` ${v}` : "");
|
|
1097
|
+
return /* @__PURE__ */ e(
|
|
1098
|
+
Te,
|
|
1099
|
+
{
|
|
1100
|
+
ref: a,
|
|
1101
|
+
id: j,
|
|
1102
|
+
className: g,
|
|
1103
|
+
style: { height: D, ...k },
|
|
1104
|
+
"data-testid": U,
|
|
1105
|
+
theme: J,
|
|
1106
|
+
tabs: N,
|
|
1107
|
+
activeTabKey: P,
|
|
1108
|
+
onTabChange: m,
|
|
1109
|
+
statusItems: E,
|
|
1110
|
+
toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
|
|
1111
|
+
bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
|
|
1112
|
+
Fe,
|
|
1113
|
+
{
|
|
1114
|
+
title: L("manifestEditor.output", "Output"),
|
|
1115
|
+
entries: A,
|
|
1116
|
+
onClear: C,
|
|
1117
|
+
maxHeight: "100%"
|
|
1118
|
+
}
|
|
1119
|
+
) : void 0
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
}), me = "__eeRid", pe = "__eeFid", St = [
|
|
1127
1123
|
{
|
|
1128
1124
|
target: ".nice-entity-editor",
|
|
1129
1125
|
titleKey: "tutorial.entityEditor.intro.title",
|
|
@@ -1132,7 +1128,7 @@ const Wt = ee(
|
|
|
1132
1128
|
content: "Browse your entities in the list, then click one (or “New entity”) to edit its metadata, fields and validation on a dedicated screen.",
|
|
1133
1129
|
placement: "auto"
|
|
1134
1130
|
}
|
|
1135
|
-
],
|
|
1131
|
+
], Tt = {
|
|
1136
1132
|
type: "object",
|
|
1137
1133
|
properties: {
|
|
1138
1134
|
name: {
|
|
@@ -1173,7 +1169,7 @@ const Wt = ee(
|
|
|
1173
1169
|
}
|
|
1174
1170
|
},
|
|
1175
1171
|
required: ["name"]
|
|
1176
|
-
},
|
|
1172
|
+
}, Ft = {
|
|
1177
1173
|
type: "object",
|
|
1178
1174
|
properties: {
|
|
1179
1175
|
name: {
|
|
@@ -1269,7 +1265,7 @@ function he({ title: t, help: r }) {
|
|
|
1269
1265
|
r ? /* @__PURE__ */ e(X, { content: r, children: /* @__PURE__ */ e("span", { className: "nice-entity-editor__help", role: "img", "aria-label": r, children: /* @__PURE__ */ e(z, { name: "info", size: 14 }) }) }) : null
|
|
1270
1266
|
] });
|
|
1271
1267
|
}
|
|
1272
|
-
function
|
|
1268
|
+
function xt({
|
|
1273
1269
|
schema: t,
|
|
1274
1270
|
value: r,
|
|
1275
1271
|
onChange: a,
|
|
@@ -1323,13 +1319,13 @@ function Ft({
|
|
|
1323
1319
|
] }, i);
|
|
1324
1320
|
}) });
|
|
1325
1321
|
}
|
|
1326
|
-
function
|
|
1322
|
+
function Ct({
|
|
1327
1323
|
fields: t,
|
|
1328
1324
|
onChange: r,
|
|
1329
1325
|
fieldSchema: a,
|
|
1330
1326
|
readOnly: l
|
|
1331
1327
|
}) {
|
|
1332
|
-
const { t: o } = Z(), [i, n] =
|
|
1328
|
+
const { t: o } = Z(), [i, n] = M(null), c = q(() => t.map((s, h) => ({ ...s, [pe]: String(h) })), [t]), f = q(
|
|
1333
1329
|
() => [
|
|
1334
1330
|
{
|
|
1335
1331
|
field: "name",
|
|
@@ -1368,14 +1364,14 @@ function xt({
|
|
|
1368
1364
|
"secondary"
|
|
1369
1365
|
]
|
|
1370
1366
|
];
|
|
1371
|
-
return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O,
|
|
1367
|
+
return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O, K, A]) => /* @__PURE__ */ e(X, { content: K, children: /* @__PURE__ */ e(ae, { variant: A, size: "sm", children: O }) }, O)) });
|
|
1372
1368
|
}
|
|
1373
1369
|
}
|
|
1374
1370
|
],
|
|
1375
1371
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1376
1372
|
[]
|
|
1377
1373
|
), p = (s, h, F) => {
|
|
1378
|
-
r(t.map((O,
|
|
1374
|
+
r(t.map((O, K) => K === s ? { ...O, [h]: F } : O));
|
|
1379
1375
|
}, y = () => {
|
|
1380
1376
|
const s = [...t, { name: `field${t.length + 1}`, dataType: "string" }];
|
|
1381
1377
|
r(s), n(s.length - 1);
|
|
@@ -1398,7 +1394,7 @@ function xt({
|
|
|
1398
1394
|
/* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String(s.name ?? o("entityEditor.field.untitled", "New field")) })
|
|
1399
1395
|
] }),
|
|
1400
1396
|
/* @__PURE__ */ e(
|
|
1401
|
-
|
|
1397
|
+
xt,
|
|
1402
1398
|
{
|
|
1403
1399
|
schema: a,
|
|
1404
1400
|
value: s,
|
|
@@ -1435,14 +1431,14 @@ function xt({
|
|
|
1435
1431
|
}
|
|
1436
1432
|
);
|
|
1437
1433
|
}
|
|
1438
|
-
const
|
|
1434
|
+
const It = /* @__PURE__ */ ee(
|
|
1439
1435
|
function(r, a) {
|
|
1440
1436
|
const {
|
|
1441
1437
|
value: l,
|
|
1442
1438
|
defaultValue: o,
|
|
1443
1439
|
onChange: i,
|
|
1444
|
-
entityMetaSchema: n =
|
|
1445
|
-
fieldSchema: c =
|
|
1440
|
+
entityMetaSchema: n = Tt,
|
|
1441
|
+
fieldSchema: c = Ft,
|
|
1446
1442
|
fieldsKey: f = "fields",
|
|
1447
1443
|
validationsKey: p = "validations",
|
|
1448
1444
|
nameKey: y = "name",
|
|
@@ -1450,7 +1446,7 @@ const Ct = ee(
|
|
|
1450
1446
|
readOnly: h = !1,
|
|
1451
1447
|
tutorial: F,
|
|
1452
1448
|
className: O,
|
|
1453
|
-
style:
|
|
1449
|
+
style: K,
|
|
1454
1450
|
id: A,
|
|
1455
1451
|
"data-testid": C
|
|
1456
1452
|
} = r, { t: w } = Z(), [$, J] = le({
|
|
@@ -1459,10 +1455,10 @@ const Ct = ee(
|
|
|
1459
1455
|
fallbackValue: [],
|
|
1460
1456
|
onChange: i,
|
|
1461
1457
|
componentName: "NiceEntityEditor"
|
|
1462
|
-
}), [
|
|
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, N = q(() => {
|
|
1463
1459
|
const T = S == null ? void 0 : S[f];
|
|
1464
1460
|
return Array.isArray(T) ? T : [];
|
|
1465
|
-
}, [S, f]),
|
|
1461
|
+
}, [S, f]), P = q(() => {
|
|
1466
1462
|
const T = (B) => {
|
|
1467
1463
|
const Y = B.toLowerCase();
|
|
1468
1464
|
return /(int|long|decimal|double|float|number|money)/.test(Y) ? "number" : /bool/.test(Y) ? "boolean" : /date|time/.test(Y) ? "date" : "string";
|
|
@@ -1476,10 +1472,10 @@ const Ct = ee(
|
|
|
1476
1472
|
});
|
|
1477
1473
|
}
|
|
1478
1474
|
return V;
|
|
1479
|
-
}, [N]), m =
|
|
1475
|
+
}, [N]), m = q(() => {
|
|
1480
1476
|
const T = S == null ? void 0 : S[p];
|
|
1481
1477
|
return Array.isArray(T) ? T : [];
|
|
1482
|
-
}, [S, p]), _ =
|
|
1478
|
+
}, [S, p]), _ = q(() => $.map((T, V) => ({ ...T, [me]: String(V) })), [$]), E = (T) => {
|
|
1483
1479
|
J($.map((V, B) => B === L ? { ...V, ...T } : V));
|
|
1484
1480
|
}, g = (T) => {
|
|
1485
1481
|
E({ [f]: T });
|
|
@@ -1490,7 +1486,7 @@ const Ct = ee(
|
|
|
1490
1486
|
J(T), k(T.length - 1), U("general"), I("edit");
|
|
1491
1487
|
}, G = (T) => {
|
|
1492
1488
|
J($.filter((V, B) => B !== T)), k((V) => V >= T ? Math.max(0, V - 1) : V);
|
|
1493
|
-
}, re =
|
|
1489
|
+
}, re = q(
|
|
1494
1490
|
() => [
|
|
1495
1491
|
{
|
|
1496
1492
|
field: y,
|
|
@@ -1549,7 +1545,7 @@ const Ct = ee(
|
|
|
1549
1545
|
],
|
|
1550
1546
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1551
1547
|
[y, f]
|
|
1552
|
-
), W =
|
|
1548
|
+
), W = q(() => {
|
|
1553
1549
|
const T = [
|
|
1554
1550
|
{
|
|
1555
1551
|
id: "general",
|
|
@@ -1571,7 +1567,7 @@ const Ct = ee(
|
|
|
1571
1567
|
label: w("entityEditor.tab.fields", "Fields"),
|
|
1572
1568
|
badge: N.length || void 0,
|
|
1573
1569
|
content: /* @__PURE__ */ e(
|
|
1574
|
-
|
|
1570
|
+
Ct,
|
|
1575
1571
|
{
|
|
1576
1572
|
fields: N,
|
|
1577
1573
|
onChange: g,
|
|
@@ -1587,7 +1583,7 @@ const Ct = ee(
|
|
|
1587
1583
|
content: /* @__PURE__ */ e(
|
|
1588
1584
|
Ge,
|
|
1589
1585
|
{
|
|
1590
|
-
fields:
|
|
1586
|
+
fields: P,
|
|
1591
1587
|
value: m,
|
|
1592
1588
|
onChange: (V) => E({ [p]: V })
|
|
1593
1589
|
}
|
|
@@ -1603,15 +1599,15 @@ const Ct = ee(
|
|
|
1603
1599
|
S,
|
|
1604
1600
|
N,
|
|
1605
1601
|
m,
|
|
1606
|
-
|
|
1602
|
+
P,
|
|
1607
1603
|
n,
|
|
1608
1604
|
c,
|
|
1609
1605
|
h,
|
|
1610
1606
|
s,
|
|
1611
1607
|
$
|
|
1612
1608
|
]), ie = "nice-entity-editor" + (O ? ` ${O}` : "");
|
|
1613
|
-
return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style:
|
|
1614
|
-
F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F,
|
|
1609
|
+
return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style: K, "data-testid": C, children: [
|
|
1610
|
+
F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F, St) }) }),
|
|
1615
1611
|
H ? /* @__PURE__ */ u("div", { className: "nice-entity-editor__edit", children: [
|
|
1616
1612
|
/* @__PURE__ */ u("header", { className: "nice-entity-editor__edit-header", children: [
|
|
1617
1613
|
/* @__PURE__ */ e(X, { content: w("entityEditor.backHint", "Back to the entity list"), children: /* @__PURE__ */ e(
|
|
@@ -1675,7 +1671,7 @@ const Ct = ee(
|
|
|
1675
1671
|
) })
|
|
1676
1672
|
] });
|
|
1677
1673
|
}
|
|
1678
|
-
),
|
|
1674
|
+
), At = [
|
|
1679
1675
|
{
|
|
1680
1676
|
target: ".nice-i18n-editor",
|
|
1681
1677
|
titleKey: "tutorial.i18nEditor.intro.title",
|
|
@@ -1700,7 +1696,7 @@ const Ct = ee(
|
|
|
1700
1696
|
content: "Add a new translation key or a new locale column here; new cells start empty and are flagged as missing.",
|
|
1701
1697
|
placement: "top"
|
|
1702
1698
|
}
|
|
1703
|
-
],
|
|
1699
|
+
], $t = /* @__PURE__ */ ee(
|
|
1704
1700
|
function(r, a) {
|
|
1705
1701
|
const {
|
|
1706
1702
|
value: l,
|
|
@@ -1715,14 +1711,14 @@ const Ct = ee(
|
|
|
1715
1711
|
className: h,
|
|
1716
1712
|
style: F,
|
|
1717
1713
|
id: O,
|
|
1718
|
-
"data-testid":
|
|
1714
|
+
"data-testid": K
|
|
1719
1715
|
} = r, { t: A } = ot(), [C, w] = rt({
|
|
1720
1716
|
value: l,
|
|
1721
1717
|
defaultValue: o,
|
|
1722
1718
|
fallbackValue: {},
|
|
1723
1719
|
onChange: i,
|
|
1724
1720
|
componentName: "NiceI18nEditor"
|
|
1725
|
-
}), [$, J] =
|
|
1721
|
+
}), [$, J] = M(""), [D, I] = M(""), v = q(() => n ?? Object.keys(C), [n, C]), k = q(() => {
|
|
1726
1722
|
const m = /* @__PURE__ */ new Set();
|
|
1727
1723
|
for (const _ of Object.keys(C))
|
|
1728
1724
|
for (const E of Object.keys(C[_] ?? {}))
|
|
@@ -1757,7 +1753,7 @@ const Ct = ee(
|
|
|
1757
1753
|
_[E] || (_[E] = C[E]);
|
|
1758
1754
|
w(_), J("");
|
|
1759
1755
|
}, H = () => {
|
|
1760
|
-
const m =
|
|
1756
|
+
const m = D.trim();
|
|
1761
1757
|
if (!m || C[m])
|
|
1762
1758
|
return;
|
|
1763
1759
|
const _ = {};
|
|
@@ -1767,9 +1763,9 @@ const Ct = ee(
|
|
|
1767
1763
|
}, N = (m) => {
|
|
1768
1764
|
const _ = { ...C };
|
|
1769
1765
|
delete _[m], w(_);
|
|
1770
|
-
},
|
|
1771
|
-
return /* @__PURE__ */ u("div", { ref: a, id: O, className:
|
|
1772
|
-
s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s,
|
|
1766
|
+
}, P = "nice-i18n-editor" + (h ? ` ${h}` : "");
|
|
1767
|
+
return /* @__PURE__ */ u("div", { ref: a, id: O, className: P, style: F, "data-testid": K, children: [
|
|
1768
|
+
s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s, At) }) }),
|
|
1773
1769
|
/* @__PURE__ */ e("div", { className: "nice-i18n-editor__scroll", "data-tour": "i18n-grid", children: /* @__PURE__ */ u("table", { className: "nice-i18n-editor__table", children: [
|
|
1774
1770
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ u("tr", { children: [
|
|
1775
1771
|
/* @__PURE__ */ e("th", { className: "nice-i18n-editor__key-head", children: A("i18nEditor.keyHead", "Key") }),
|
|
@@ -1854,7 +1850,7 @@ const Ct = ee(
|
|
|
1854
1850
|
{
|
|
1855
1851
|
className: "nice-i18n-editor__add-input",
|
|
1856
1852
|
placeholder: A("i18nEditor.newLocalePlaceholder", "locale (e.g. de)"),
|
|
1857
|
-
value:
|
|
1853
|
+
value: D,
|
|
1858
1854
|
onChange: (m) => I(m.target.value),
|
|
1859
1855
|
onKeyDown: (m) => {
|
|
1860
1856
|
m.key === "Enter" && H();
|
|
@@ -1870,7 +1866,7 @@ const Ct = ee(
|
|
|
1870
1866
|
] })
|
|
1871
1867
|
] });
|
|
1872
1868
|
}
|
|
1873
|
-
),
|
|
1869
|
+
), Mt = [
|
|
1874
1870
|
{
|
|
1875
1871
|
target: ".nice-module-editor",
|
|
1876
1872
|
titleKey: "tutorial.moduleEditor.intro.title",
|
|
@@ -1919,12 +1915,12 @@ const Ct = ee(
|
|
|
1919
1915
|
content: "Validation results and load/save activity are logged here.",
|
|
1920
1916
|
placement: "top"
|
|
1921
1917
|
}
|
|
1922
|
-
],
|
|
1918
|
+
], Ot = [], Xt = /* @__PURE__ */ ee(
|
|
1923
1919
|
function(r, a) {
|
|
1924
1920
|
var ge;
|
|
1925
1921
|
const {
|
|
1926
1922
|
dataProvider: l,
|
|
1927
|
-
manifestSections: o,
|
|
1923
|
+
manifestSections: o = Ot,
|
|
1928
1924
|
entityConfig: i,
|
|
1929
1925
|
locales: n,
|
|
1930
1926
|
validate: c,
|
|
@@ -1935,15 +1931,15 @@ const Ct = ee(
|
|
|
1935
1931
|
onBindingsChange: h,
|
|
1936
1932
|
revisions: F,
|
|
1937
1933
|
onRollback: O,
|
|
1938
|
-
loadContent:
|
|
1934
|
+
loadContent: K,
|
|
1939
1935
|
theme: A = "light",
|
|
1940
1936
|
height: C = 640,
|
|
1941
1937
|
tutorial: w,
|
|
1942
1938
|
className: $,
|
|
1943
1939
|
style: J,
|
|
1944
|
-
id:
|
|
1940
|
+
id: D,
|
|
1945
1941
|
"data-testid": I
|
|
1946
|
-
} = r, { t: v } = Z(), [k, j] =
|
|
1942
|
+
} = r, { t: v } = Z(), [k, j] = M([]), [U, L] = M(""), [S, H] = M(null), [N, P] = M(null), [m, _] = M(!1), [E, g] = M(!1), [x, R] = M([]), [G, re] = M(""), W = Q((d, b, je) => {
|
|
1947
1943
|
R((Be) => [...Be, { level: d, message: b, data: je, timestamp: Date.now() }].slice(-200));
|
|
1948
1944
|
}, []), ie = Q(async () => {
|
|
1949
1945
|
g(!0);
|
|
@@ -1963,7 +1959,7 @@ const Ct = ee(
|
|
|
1963
1959
|
g(!0);
|
|
1964
1960
|
try {
|
|
1965
1961
|
const b = await l.loadModule(d);
|
|
1966
|
-
|
|
1962
|
+
P(b), H(d), _(!1), W("info", `Loaded module ${d}`);
|
|
1967
1963
|
} catch (b) {
|
|
1968
1964
|
W("error", `Load failed: ${b instanceof Error ? b.message : String(b)}`);
|
|
1969
1965
|
} finally {
|
|
@@ -1982,7 +1978,7 @@ const Ct = ee(
|
|
|
1982
1978
|
g(!1);
|
|
1983
1979
|
}
|
|
1984
1980
|
}
|
|
1985
|
-
}, [S, N, l, W]), B =
|
|
1981
|
+
}, [S, N, l, W]), B = q(() => {
|
|
1986
1982
|
if (!N)
|
|
1987
1983
|
return [];
|
|
1988
1984
|
const d = [];
|
|
@@ -1998,20 +1994,20 @@ const Ct = ee(
|
|
|
1998
1994
|
W("error", `${d.field}: ${d.message}`);
|
|
1999
1995
|
}
|
|
2000
1996
|
}, [B, W]), Ae = (d) => {
|
|
2001
|
-
|
|
1997
|
+
P((b) => b && { ...b, manifest: d }), _(!0);
|
|
2002
1998
|
}, $e = (d) => {
|
|
2003
|
-
|
|
2004
|
-
},
|
|
2005
|
-
|
|
1999
|
+
P((b) => b && { ...b, entities: d }), _(!0);
|
|
2000
|
+
}, Me = (d) => {
|
|
2001
|
+
P((b) => b && { ...b, i18n: d }), _(!0);
|
|
2006
2002
|
}, Oe = (d) => {
|
|
2007
|
-
|
|
2003
|
+
P((b) => b && { ...b, views: d }), _(!0);
|
|
2004
|
+
}, Ke = (d) => {
|
|
2005
|
+
P((b) => b && { ...b, workflows: d }), _(!0);
|
|
2008
2006
|
}, De = (d) => {
|
|
2009
|
-
|
|
2010
|
-
}, Me = (d) => {
|
|
2011
|
-
q((b) => b && { ...b, dataSources: d }), _(!0);
|
|
2007
|
+
P((b) => b && { ...b, dataSources: d }), _(!0);
|
|
2012
2008
|
}, Le = (d) => {
|
|
2013
|
-
|
|
2014
|
-
}, ne =
|
|
2009
|
+
P((b) => b && { ...b, rbac: d }), _(!0);
|
|
2010
|
+
}, ne = q(() => {
|
|
2015
2011
|
if (!N)
|
|
2016
2012
|
return [];
|
|
2017
2013
|
const d = o.map((b) => ({
|
|
@@ -2034,7 +2030,7 @@ const Ct = ee(
|
|
|
2034
2030
|
key: "entities",
|
|
2035
2031
|
label: v("moduleEditor.tab.entities", "Entities"),
|
|
2036
2032
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2037
|
-
|
|
2033
|
+
It,
|
|
2038
2034
|
{
|
|
2039
2035
|
value: N.entities ?? [],
|
|
2040
2036
|
onChange: $e,
|
|
@@ -2048,7 +2044,7 @@ const Ct = ee(
|
|
|
2048
2044
|
}), d.push({
|
|
2049
2045
|
key: "i18n",
|
|
2050
2046
|
label: v("moduleEditor.tab.i18n", "i18n"),
|
|
2051
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2047
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e($t, { value: N.i18n ?? {}, onChange: Me, locales: n }) })
|
|
2052
2048
|
}), d.push({
|
|
2053
2049
|
key: "views",
|
|
2054
2050
|
label: v("moduleEditor.tab.views", "Views"),
|
|
@@ -2063,16 +2059,16 @@ const Ct = ee(
|
|
|
2063
2059
|
}), d.push({
|
|
2064
2060
|
key: "workflows",
|
|
2065
2061
|
label: v("moduleEditor.tab.workflows", "Workflows"),
|
|
2066
|
-
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2062
|
+
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Dt, { workflows: N.workflows ?? [], onChange: Ke }) })
|
|
2067
2063
|
}), d.push({
|
|
2068
2064
|
key: "data",
|
|
2069
2065
|
label: v("moduleEditor.tab.data", "Data"),
|
|
2070
2066
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2071
|
-
|
|
2067
|
+
Pt,
|
|
2072
2068
|
{
|
|
2073
2069
|
dataSources: N.dataSources ?? [],
|
|
2074
|
-
schemas:
|
|
2075
|
-
onChange:
|
|
2070
|
+
schemas: Lt(N.entities ?? []),
|
|
2071
|
+
onChange: De
|
|
2076
2072
|
}
|
|
2077
2073
|
) })
|
|
2078
2074
|
}), d.push({
|
|
@@ -2081,7 +2077,7 @@ const Ct = ee(
|
|
|
2081
2077
|
content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
|
|
2082
2078
|
Ze,
|
|
2083
2079
|
{
|
|
2084
|
-
value: N.rbac ??
|
|
2080
|
+
value: N.rbac ?? Vt(N),
|
|
2085
2081
|
onChange: Le
|
|
2086
2082
|
}
|
|
2087
2083
|
) })
|
|
@@ -2111,7 +2107,7 @@ const Ct = ee(
|
|
|
2111
2107
|
{
|
|
2112
2108
|
revisions: F,
|
|
2113
2109
|
onRollback: O,
|
|
2114
|
-
loadContent:
|
|
2110
|
+
loadContent: K,
|
|
2115
2111
|
language: "json"
|
|
2116
2112
|
}
|
|
2117
2113
|
) })
|
|
@@ -2135,12 +2131,12 @@ const Ct = ee(
|
|
|
2135
2131
|
oe(() => {
|
|
2136
2132
|
ne.length > 0 && !ne.some((d) => d.key === G) && re(ne[0].key);
|
|
2137
2133
|
}, [ne, G]);
|
|
2138
|
-
const ye =
|
|
2134
|
+
const ye = q(() => {
|
|
2139
2135
|
const d = U.trim().toLowerCase();
|
|
2140
2136
|
return d ? k.filter(
|
|
2141
2137
|
(b) => b.id.toLowerCase().includes(d) || (b.name ?? "").toLowerCase().includes(d) || (b.category ?? "").toLowerCase().includes(d)
|
|
2142
2138
|
) : k;
|
|
2143
|
-
}, [k, U]), Ve =
|
|
2139
|
+
}, [k, U]), Ve = q(() => {
|
|
2144
2140
|
const d = [];
|
|
2145
2141
|
return S && d.push({ key: "mod", label: S + (m ? " •" : ""), position: "left" }), d.push({
|
|
2146
2142
|
key: "val",
|
|
@@ -2150,7 +2146,7 @@ const Ct = ee(
|
|
|
2150
2146
|
] }),
|
|
2151
2147
|
position: "left"
|
|
2152
2148
|
}), d;
|
|
2153
|
-
}, [S, m, B.length, v]),
|
|
2149
|
+
}, [S, m, B.length, v]), Pe = /* @__PURE__ */ u("div", { className: "nice-module-editor__browser", "data-tour": "nme-browser", children: [
|
|
2154
2150
|
/* @__PURE__ */ e(
|
|
2155
2151
|
"input",
|
|
2156
2152
|
{
|
|
@@ -2178,9 +2174,9 @@ const Ct = ee(
|
|
|
2178
2174
|
)),
|
|
2179
2175
|
ye.length === 0 && /* @__PURE__ */ e("div", { className: "nice-module-editor__browser-empty", children: E ? v("moduleEditor.loading", "Loading…") : v("moduleEditor.noModules", "No modules. Open a source first.") })
|
|
2180
2176
|
] })
|
|
2181
|
-
] }),
|
|
2177
|
+
] }), qe = /* @__PURE__ */ u("div", { className: "nice-module-editor__toolbar", children: [
|
|
2182
2178
|
/* @__PURE__ */ e("strong", { className: "nice-module-editor__title", "data-tour": "nme-tabs", children: S ? ((ge = N == null ? void 0 : N.manifest) == null ? void 0 : ge.packageName) ?? S : v("moduleEditor.title", "Module Editor") }),
|
|
2183
|
-
w && /* @__PURE__ */ e(se, { steps: ce(w,
|
|
2179
|
+
w && /* @__PURE__ */ e(se, { steps: ce(w, Mt) }),
|
|
2184
2180
|
/* @__PURE__ */ e("span", { className: "nice-module-editor__spacer" }),
|
|
2185
2181
|
/* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled: E, children: [
|
|
2186
2182
|
/* @__PURE__ */ e(z, { name: "refresh", size: 14 }),
|
|
@@ -2208,7 +2204,7 @@ const Ct = ee(
|
|
|
2208
2204
|
Te,
|
|
2209
2205
|
{
|
|
2210
2206
|
ref: a,
|
|
2211
|
-
id:
|
|
2207
|
+
id: D,
|
|
2212
2208
|
className: Re,
|
|
2213
2209
|
style: { height: C, ...J },
|
|
2214
2210
|
"data-testid": I,
|
|
@@ -2216,8 +2212,8 @@ const Ct = ee(
|
|
|
2216
2212
|
tabs: ne,
|
|
2217
2213
|
activeTabKey: G,
|
|
2218
2214
|
onTabChange: re,
|
|
2219
|
-
toolbar:
|
|
2220
|
-
sidePanel:
|
|
2215
|
+
toolbar: qe,
|
|
2216
|
+
sidePanel: Pe,
|
|
2221
2217
|
sidePanelWidth: 260,
|
|
2222
2218
|
statusItems: Ve,
|
|
2223
2219
|
bottomPanel: /* @__PURE__ */ e("div", { "data-tour": "nme-output", style: { height: "100%" }, children: /* @__PURE__ */ e(
|
|
@@ -2240,7 +2236,7 @@ function Kt({
|
|
|
2240
2236
|
onChange: a
|
|
2241
2237
|
}) {
|
|
2242
2238
|
var y;
|
|
2243
|
-
const { t: l } = Z(), [o, i] =
|
|
2239
|
+
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) => {
|
|
2244
2240
|
a(t.map((h) => h.id === o ? s : h)), s.id !== o && i(s.id);
|
|
2245
2241
|
}, f = () => {
|
|
2246
2242
|
const s = {
|
|
@@ -2282,12 +2278,12 @@ function Kt({
|
|
|
2282
2278
|
) })
|
|
2283
2279
|
] });
|
|
2284
2280
|
}
|
|
2285
|
-
function
|
|
2281
|
+
function Dt({
|
|
2286
2282
|
workflows: t,
|
|
2287
2283
|
onChange: r
|
|
2288
2284
|
}) {
|
|
2289
2285
|
var p;
|
|
2290
|
-
const { t: a } = Z(), [l, o] =
|
|
2286
|
+
const { t: a } = Z(), [l, o] = M(((p = t[0]) == null ? void 0 : p.id) ?? null), i = t.find((y) => y.id === l) ?? null, n = (y) => {
|
|
2291
2287
|
r(t.map((s) => s.id === l ? y : s)), y.id !== l && o(y.id);
|
|
2292
2288
|
}, c = () => {
|
|
2293
2289
|
const y = {
|
|
@@ -2329,7 +2325,7 @@ function Ot({
|
|
|
2329
2325
|
) })
|
|
2330
2326
|
] });
|
|
2331
2327
|
}
|
|
2332
|
-
function
|
|
2328
|
+
function Lt(t) {
|
|
2333
2329
|
return t.map((r) => {
|
|
2334
2330
|
const a = r;
|
|
2335
2331
|
return {
|
|
@@ -2343,7 +2339,7 @@ function Dt(t) {
|
|
|
2343
2339
|
};
|
|
2344
2340
|
});
|
|
2345
2341
|
}
|
|
2346
|
-
function
|
|
2342
|
+
function Vt(t) {
|
|
2347
2343
|
const r = t.manifest ?? {}, a = String(r.displayName || r.packageName || "Module"), l = (t.views ?? []).map((i) => ({
|
|
2348
2344
|
id: `view:${i.id}`,
|
|
2349
2345
|
label: i.name,
|
|
@@ -2377,13 +2373,13 @@ function Mt(t) {
|
|
|
2377
2373
|
grants: {}
|
|
2378
2374
|
};
|
|
2379
2375
|
}
|
|
2380
|
-
function
|
|
2376
|
+
function Pt({
|
|
2381
2377
|
dataSources: t,
|
|
2382
2378
|
schemas: r,
|
|
2383
2379
|
onChange: a
|
|
2384
2380
|
}) {
|
|
2385
2381
|
var y;
|
|
2386
|
-
const { t: l } = Z(), [o, i] =
|
|
2382
|
+
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) => {
|
|
2387
2383
|
a(t.map((h) => h.key === o ? s : h)), s.key !== o && i(s.key);
|
|
2388
2384
|
}, f = () => {
|
|
2389
2385
|
const s = {
|
|
@@ -2425,18 +2421,18 @@ function Lt({
|
|
|
2425
2421
|
}
|
|
2426
2422
|
export {
|
|
2427
2423
|
pt as NiceArrayField,
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2424
|
+
It as NiceEntityEditor,
|
|
2425
|
+
Gt as NiceFormBuilderAI,
|
|
2426
|
+
$t as NiceI18nEditor,
|
|
2427
|
+
Qt as NiceManifestEditor,
|
|
2428
|
+
Xt as NiceModuleEditor,
|
|
2433
2429
|
de as NiceSchemaForm,
|
|
2434
|
-
|
|
2435
|
-
|
|
2430
|
+
Yt as defineManifestSection,
|
|
2431
|
+
Jt as formBuilderSchemaToNiceFormItems,
|
|
2436
2432
|
Ce as formFieldsToFormItems,
|
|
2437
|
-
|
|
2433
|
+
Wt as formSchemaToJsonSchema,
|
|
2438
2434
|
xe as jsonSchemaToFormItems,
|
|
2439
|
-
|
|
2435
|
+
Ut as schemaToFormItems,
|
|
2440
2436
|
Ie as validateAgainstJsonSchema,
|
|
2441
|
-
|
|
2437
|
+
Ht as validateFormSchema
|
|
2442
2438
|
};
|