@object-ui/plugin-form 11.4.0 → 11.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/MasterDetailForm.d.ts +3 -0
- package/dist/WizardForm.d.ts +12 -2
- package/dist/index.js +186 -124
- package/dist/index.umd.cjs +1 -1
- package/dist/successBehavior.d.ts +3 -0
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import e, { useCallback as t, useContext as n, useEffect as r, useId as i, useMe
|
|
|
2
2
|
import { ComponentRegistry as c } from "@object-ui/core";
|
|
3
3
|
import { SchemaRenderer as l, SchemaRendererContext as u, usePreviewMode as d, useRecordContext as f, useSafeFieldLabel as p, useSchemaContext as m } from "@object-ui/react";
|
|
4
4
|
import { LineItemsField as h, buildValidationRules as g, formatFileSize as _, mapFieldTypeToFormType as v } from "@object-ui/fields";
|
|
5
|
-
import { AlertDialog as y, AlertDialogAction as b, AlertDialogCancel as x, AlertDialogContent as S, AlertDialogDescription as C, AlertDialogFooter as w, AlertDialogHeader as T, AlertDialogTitle as E, Button as D, Card as O, CardContent as k, CardDescription as A, CardHeader as j, CardTitle as M, Dialog as N, DialogDescription as P, DialogHeader as F, DialogTitle as
|
|
5
|
+
import { AlertDialog as y, AlertDialogAction as b, AlertDialogCancel as x, AlertDialogContent as S, AlertDialogDescription as C, AlertDialogFooter as w, AlertDialogHeader as T, AlertDialogTitle as E, Button as D, Card as O, CardContent as k, CardDescription as A, CardHeader as j, CardTitle as M, Dialog as N, DialogDescription as P, DialogHeader as F, DialogTitle as ee, MobileDialogContent as I, ResizableHandle as L, ResizablePanel as R, ResizablePanelGroup as z, Sheet as B, SheetContent as V, SheetDescription as H, SheetHeader as te, SheetTitle as ne, Skeleton as U, Tabs as W, TabsContent as re, TabsList as ie, TabsTrigger as ae, cn as G, toast as K, useIsMobile as oe } from "@object-ui/components";
|
|
6
6
|
import { usePermissions as se } from "@object-ui/permissions";
|
|
7
7
|
import { Check as ce, CheckCircle2 as le, ChevronDown as q, ChevronLeft as ue, ChevronRight as de, Loader2 as fe, Lock as pe, ShieldCheck as me } from "lucide-react";
|
|
8
8
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
@@ -385,7 +385,7 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
385
385
|
})
|
|
386
386
|
});
|
|
387
387
|
}, Ve = ({ schema: n, dataSource: r, className: i }) => {
|
|
388
|
-
let { fieldLabel: o } = p(), [c, u] = s(null), [d, f] = s({}), [m, h] = s(!0), [g, _] = s(null), [v, y] = s(0), [b, x] = s(/* @__PURE__ */ new Set()), [S, C] = s(!1), w = e.useId(), [
|
|
388
|
+
let { fieldLabel: o } = p(), [c, u] = s(null), [d, f] = s({}), [m, h] = s(!0), [g, _] = s(null), [v, y] = s(0), [b, x] = s(/* @__PURE__ */ new Set()), [S, C] = s(!1), [w, T] = s(null), E = e.useId(), [O, k] = s(0), A = e.useRef(!1), j = n.sections.length, M = v === 0, N = v === j - 1;
|
|
389
389
|
e.useEffect(() => {
|
|
390
390
|
(async () => {
|
|
391
391
|
if (!r) {
|
|
@@ -401,7 +401,7 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
401
401
|
}, [n.objectName, r]), e.useEffect(() => {
|
|
402
402
|
(c || !r) && (async () => {
|
|
403
403
|
if (n.mode === "create" || !n.recordId || !r) {
|
|
404
|
-
|
|
404
|
+
A.current ||= (f(n.initialData || n.initialValues || {}), !0), h(!1);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
407
|
try {
|
|
@@ -421,7 +421,7 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
421
421
|
r,
|
|
422
422
|
n.objectName
|
|
423
423
|
]);
|
|
424
|
-
let
|
|
424
|
+
let P = t((e) => xe(e, {
|
|
425
425
|
objectSchema: c,
|
|
426
426
|
objectName: n.objectName,
|
|
427
427
|
readOnly: n.readOnly,
|
|
@@ -433,26 +433,44 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
433
433
|
n.mode,
|
|
434
434
|
n.objectName,
|
|
435
435
|
o
|
|
436
|
-
]),
|
|
436
|
+
]), F = a(() => v >= 0 && v < j ? P(n.sections[v]) : [], [
|
|
437
437
|
v,
|
|
438
|
-
|
|
438
|
+
j,
|
|
439
439
|
n.sections,
|
|
440
|
-
|
|
441
|
-
]),
|
|
440
|
+
P
|
|
441
|
+
]), ee = t(async (e) => {
|
|
442
442
|
let t = {
|
|
443
443
|
...d,
|
|
444
444
|
...e
|
|
445
445
|
};
|
|
446
|
-
if (f(t), x((e) => new Set(e).add(v)),
|
|
446
|
+
if (f(t), x((e) => new Set(e).add(v)), N) {
|
|
447
447
|
C(!0);
|
|
448
448
|
try {
|
|
449
449
|
if (!r) return n.onSuccess && await n.onSuccess(t), t;
|
|
450
450
|
let e;
|
|
451
451
|
if (n.mode === "create" ? e = await r.create(n.objectName, t) : n.mode === "edit" && n.recordId && (e = await r.update(n.objectName, n.recordId, t)), n.onSuccess) await n.onSuccess(e);
|
|
452
|
-
else {
|
|
452
|
+
else if (n.submitBehavior) {
|
|
453
|
+
let e = n.submitBehavior;
|
|
454
|
+
switch (e.kind) {
|
|
455
|
+
case "redirect":
|
|
456
|
+
ge(e.url) && setTimeout(() => window.location.assign(e.url), e.delayMs ?? 0);
|
|
457
|
+
break;
|
|
458
|
+
case "continue":
|
|
459
|
+
f({}), x(/* @__PURE__ */ new Set()), y(0), k((e) => e + 1);
|
|
460
|
+
break;
|
|
461
|
+
default: {
|
|
462
|
+
let t = e.kind === "thank-you" && e.message ? e.message : n.successMessage || (n.mode === "create" ? "Created" : "Saved");
|
|
463
|
+
K.success(t), T({
|
|
464
|
+
title: e.kind === "thank-you" ? e.title : void 0,
|
|
465
|
+
message: t
|
|
466
|
+
});
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
453
471
|
let t = _e(n.navigateOnSuccess, e);
|
|
454
472
|
if (t) return window.location.assign(t), e;
|
|
455
|
-
K.success(n.successMessage || (n.mode === "create" ? "Created" : "Saved")), n.resetOnSuccess && n.mode === "create" && (f({}), x(/* @__PURE__ */ new Set()), y(0),
|
|
473
|
+
K.success(n.successMessage || (n.mode === "create" ? "Created" : "Saved")), n.resetOnSuccess && n.mode === "create" && (f({}), x(/* @__PURE__ */ new Set()), y(0), k((e) => e + 1));
|
|
456
474
|
}
|
|
457
475
|
return e;
|
|
458
476
|
} catch (e) {
|
|
@@ -460,26 +478,26 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
460
478
|
} finally {
|
|
461
479
|
C(!1);
|
|
462
480
|
}
|
|
463
|
-
} else
|
|
481
|
+
} else I(v + 1);
|
|
464
482
|
}, [
|
|
465
483
|
d,
|
|
466
484
|
v,
|
|
467
|
-
|
|
485
|
+
N,
|
|
468
486
|
n,
|
|
469
487
|
r
|
|
470
|
-
]),
|
|
471
|
-
e >= 0 && e <
|
|
472
|
-
}, [
|
|
473
|
-
|
|
474
|
-
}, [v,
|
|
488
|
+
]), I = t((e) => {
|
|
489
|
+
e >= 0 && e < j && (y(e), n.onStepChange && n.onStepChange(e));
|
|
490
|
+
}, [j, n]), L = t(() => {
|
|
491
|
+
I(v - 1);
|
|
492
|
+
}, [v, I]), R = t(() => {
|
|
475
493
|
n.onCancel && n.onCancel();
|
|
476
|
-
}, [n]),
|
|
477
|
-
(n.allowSkip || b.has(e) || e <= v) &&
|
|
494
|
+
}, [n]), z = t((e) => {
|
|
495
|
+
(n.allowSkip || b.has(e) || e <= v) && I(e);
|
|
478
496
|
}, [
|
|
479
497
|
n.allowSkip,
|
|
480
498
|
b,
|
|
481
499
|
v,
|
|
482
|
-
|
|
500
|
+
I
|
|
483
501
|
]);
|
|
484
502
|
if (g) return /* @__PURE__ */ X("div", {
|
|
485
503
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
@@ -498,7 +516,20 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
498
516
|
children: "Loading form..."
|
|
499
517
|
})]
|
|
500
518
|
});
|
|
501
|
-
|
|
519
|
+
if (w) return /* @__PURE__ */ Y("div", {
|
|
520
|
+
className: G("w-full", i, n.className),
|
|
521
|
+
children: /* @__PURE__ */ X("div", {
|
|
522
|
+
className: "rounded-md border bg-card p-8 text-center",
|
|
523
|
+
children: [/* @__PURE__ */ Y("h3", {
|
|
524
|
+
className: "text-lg font-semibold",
|
|
525
|
+
children: w.title ?? "Thanks!"
|
|
526
|
+
}), w.message && /* @__PURE__ */ Y("p", {
|
|
527
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
528
|
+
children: w.message
|
|
529
|
+
})]
|
|
530
|
+
})
|
|
531
|
+
});
|
|
532
|
+
let B = n.sections[v];
|
|
502
533
|
return /* @__PURE__ */ X("div", {
|
|
503
534
|
className: G("w-full", i, n.className),
|
|
504
535
|
children: [
|
|
@@ -510,15 +541,15 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
510
541
|
children: n.sections.map((e, t) => {
|
|
511
542
|
let r = t === v, i = b.has(t), a = n.allowSkip || i || t <= v;
|
|
512
543
|
return /* @__PURE__ */ X("li", {
|
|
513
|
-
className: G("relative flex-1", t !==
|
|
514
|
-
children: [t !==
|
|
544
|
+
className: G("relative flex-1", t !== j - 1 && "pr-8 sm:pr-12"),
|
|
545
|
+
children: [t !== j - 1 && /* @__PURE__ */ Y("div", {
|
|
515
546
|
className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
|
|
516
547
|
"aria-hidden": "true",
|
|
517
548
|
children: /* @__PURE__ */ Y("div", { className: G("h-full", i ? "bg-primary" : "bg-muted") })
|
|
518
549
|
}), /* @__PURE__ */ X("button", {
|
|
519
550
|
type: "button",
|
|
520
551
|
className: G("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
|
|
521
|
-
onClick: () =>
|
|
552
|
+
onClick: () => z(t),
|
|
522
553
|
disabled: !a,
|
|
523
554
|
children: [/* @__PURE__ */ Y("span", {
|
|
524
555
|
className: G("flex h-6 w-6 sm:h-8 sm:w-8 items-center justify-center rounded-full text-xs sm:text-sm font-medium transition-colors", i && "bg-primary text-primary-foreground", r && !i && "border-2 border-primary bg-background text-primary", !r && !i && "border-2 border-muted bg-background text-muted-foreground"),
|
|
@@ -537,21 +568,21 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
537
568
|
}),
|
|
538
569
|
/* @__PURE__ */ Y("div", {
|
|
539
570
|
className: "min-h-[200px]",
|
|
540
|
-
children:
|
|
541
|
-
label:
|
|
542
|
-
description:
|
|
571
|
+
children: B && /* @__PURE__ */ Y(ve, {
|
|
572
|
+
label: B.label,
|
|
573
|
+
description: B.description,
|
|
543
574
|
columns: 1,
|
|
544
|
-
children:
|
|
575
|
+
children: F.length > 0 ? /* @__PURE__ */ Y(l, { schema: {
|
|
545
576
|
type: "form",
|
|
546
577
|
objectName: n.objectName,
|
|
547
|
-
id:
|
|
548
|
-
...Le(
|
|
578
|
+
id: E,
|
|
579
|
+
...Le(F, B.columns || 1),
|
|
549
580
|
layout: "vertical",
|
|
550
581
|
defaultValues: d,
|
|
551
582
|
showSubmit: !1,
|
|
552
583
|
showCancel: !1,
|
|
553
|
-
onSubmit:
|
|
554
|
-
} },
|
|
584
|
+
onSubmit: ee
|
|
585
|
+
} }, O) : /* @__PURE__ */ Y("div", {
|
|
555
586
|
className: "text-center py-8 text-muted-foreground",
|
|
556
587
|
children: "No fields configured for this step"
|
|
557
588
|
})
|
|
@@ -561,7 +592,7 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
561
592
|
className: "flex items-center justify-between mt-6 pt-4 border-t",
|
|
562
593
|
children: [/* @__PURE__ */ Y("div", { children: n.showCancel !== !1 && /* @__PURE__ */ Y(D, {
|
|
563
594
|
variant: "ghost",
|
|
564
|
-
onClick:
|
|
595
|
+
onClick: R,
|
|
565
596
|
children: n.cancelText || "Cancel"
|
|
566
597
|
}) }), /* @__PURE__ */ X("div", {
|
|
567
598
|
className: "flex items-center gap-2",
|
|
@@ -572,17 +603,17 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
572
603
|
"Step ",
|
|
573
604
|
v + 1,
|
|
574
605
|
" of ",
|
|
575
|
-
|
|
606
|
+
j
|
|
576
607
|
]
|
|
577
608
|
}),
|
|
578
|
-
!
|
|
609
|
+
!M && /* @__PURE__ */ X(D, {
|
|
579
610
|
variant: "outline",
|
|
580
|
-
onClick:
|
|
611
|
+
onClick: L,
|
|
581
612
|
children: [/* @__PURE__ */ Y(ue, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
|
|
582
613
|
}),
|
|
583
|
-
|
|
614
|
+
N ? /* @__PURE__ */ X(D, {
|
|
584
615
|
type: "submit",
|
|
585
|
-
form:
|
|
616
|
+
form: E,
|
|
586
617
|
disabled: S || n.mode === "view",
|
|
587
618
|
children: [S && /* @__PURE__ */ Y(fe, {
|
|
588
619
|
className: "mr-2 h-4 w-4 animate-spin",
|
|
@@ -590,7 +621,7 @@ var Be = ({ schema: n, dataSource: r, className: i }) => {
|
|
|
590
621
|
}), S ? "Submitting..." : n.submitText || (n.mode === "create" ? "Create" : "Update")]
|
|
591
622
|
}) : /* @__PURE__ */ X(D, {
|
|
592
623
|
type: "submit",
|
|
593
|
-
form:
|
|
624
|
+
form: E,
|
|
594
625
|
children: [n.nextText || "Next", /* @__PURE__ */ Y(de, { className: "h-4 w-4 ml-1" })]
|
|
595
626
|
})
|
|
596
627
|
]
|
|
@@ -1349,7 +1380,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1349
1380
|
...n,
|
|
1350
1381
|
rows: t
|
|
1351
1382
|
} : n));
|
|
1352
|
-
}, []), E = e.taxRateField || "tax_rate", [A, N] = s(null), P = A ? m[A.detailIdx]?.rows?.[A.rowIdx] : void 0, F = A ? p[A.detailIdx] : void 0,
|
|
1383
|
+
}, []), E = e.taxRateField || "tax_rate", [A, N] = s(null), P = A ? m[A.detailIdx]?.rows?.[A.rowIdx] : void 0, F = A ? p[A.detailIdx] : void 0, ee = t((e, t, n) => {
|
|
1353
1384
|
h((r) => r.map((r, i) => i === e ? {
|
|
1354
1385
|
...r,
|
|
1355
1386
|
rows: r.rows.map((e, r) => r === t ? {
|
|
@@ -1357,7 +1388,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1357
1388
|
...n
|
|
1358
1389
|
} : e)
|
|
1359
1390
|
} : r));
|
|
1360
|
-
}, []),
|
|
1391
|
+
}, []), I = t((e) => {
|
|
1361
1392
|
h((t) => {
|
|
1362
1393
|
let n = t.map((t, n) => n === e ? {
|
|
1363
1394
|
...t,
|
|
@@ -1375,7 +1406,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1375
1406
|
rows: t.rows.filter((t, n) => n !== e.rowIdx)
|
|
1376
1407
|
} : t)), null));
|
|
1377
1408
|
}, []), R = t(async (t) => {
|
|
1378
|
-
w(), K.success(l ? e.title ? `${e.title} saved` : "Saved" : "Created"), l || (h(p.map(() => ({
|
|
1409
|
+
w(), e.onSuccess || K.success(l ? e.title ? `${e.title} saved` : "Saved" : "Created"), l || (h(p.map(() => ({
|
|
1379
1410
|
rows: [],
|
|
1380
1411
|
original: []
|
|
1381
1412
|
}))), y((e) => e + 1)), await e.onSuccess?.(t);
|
|
@@ -1426,7 +1457,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1426
1457
|
B,
|
|
1427
1458
|
e,
|
|
1428
1459
|
R
|
|
1429
|
-
]),
|
|
1460
|
+
]), H = typeof n?.batchTransaction == "function", te = t(async (t) => {
|
|
1430
1461
|
let r = n, i = { ...t };
|
|
1431
1462
|
p.forEach((e, t) => {
|
|
1432
1463
|
e.totalField && (i[e.totalField] = Qe(g.current[t]?.rows ?? [], e.amountField || "amount"));
|
|
@@ -1466,16 +1497,16 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1466
1497
|
title: e.title,
|
|
1467
1498
|
showSubmit: !1,
|
|
1468
1499
|
showCancel: !1,
|
|
1469
|
-
...
|
|
1470
|
-
submitHandler:
|
|
1500
|
+
...H ? {
|
|
1501
|
+
submitHandler: te,
|
|
1471
1502
|
onSuccess: R
|
|
1472
1503
|
} : { onSuccess: V },
|
|
1473
1504
|
onError: z
|
|
1474
1505
|
}), [
|
|
1475
1506
|
e,
|
|
1476
1507
|
V,
|
|
1477
|
-
te,
|
|
1478
1508
|
H,
|
|
1509
|
+
te,
|
|
1479
1510
|
R,
|
|
1480
1511
|
z
|
|
1481
1512
|
]), U = o(null), W = e.submitText ?? (l ? "Save" : "Create"), re = t(() => {
|
|
@@ -1506,7 +1537,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1506
1537
|
detailIdx: e,
|
|
1507
1538
|
rowIdx: t
|
|
1508
1539
|
}),
|
|
1509
|
-
onAddViaForm:
|
|
1540
|
+
onAddViaForm: I
|
|
1510
1541
|
}),
|
|
1511
1542
|
A && F && /* @__PURE__ */ X(O, {
|
|
1512
1543
|
className: "border-primary/40 shadow-none ring-1 ring-primary/10",
|
|
@@ -1538,7 +1569,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1538
1569
|
submitText: "Apply",
|
|
1539
1570
|
submitHandler: async (e) => e,
|
|
1540
1571
|
onSuccess: (e) => {
|
|
1541
|
-
|
|
1572
|
+
ee(A.detailIdx, A.rowIdx, e), N(null);
|
|
1542
1573
|
},
|
|
1543
1574
|
onCancel: L
|
|
1544
1575
|
},
|
|
@@ -1553,7 +1584,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1553
1584
|
onClick: e.onCancel,
|
|
1554
1585
|
disabled: b,
|
|
1555
1586
|
"data-testid": "md-form-cancel",
|
|
1556
|
-
children: "Cancel"
|
|
1587
|
+
children: e.cancelText ?? "Cancel"
|
|
1557
1588
|
}), /* @__PURE__ */ Y(D, {
|
|
1558
1589
|
type: "button",
|
|
1559
1590
|
onClick: re,
|
|
@@ -1575,7 +1606,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1575
1606
|
"form.keepEditing": "Keep editing",
|
|
1576
1607
|
"form.discard": "Discard"
|
|
1577
1608
|
}, "form.discardTitle"), Tt = ({ schema: e, dataSource: n, className: c }) => {
|
|
1578
|
-
let { fieldLabel: u } = p(), { t: f } = wt(), m = d(), [h, _] = s(null), [O, k] = s([]), [A, j] = s({}), [M, N] = s(!0), [P, F] = s(null), [
|
|
1609
|
+
let { fieldLabel: u } = p(), { t: f } = wt(), m = d(), [h, _] = s(null), [O, k] = s([]), [A, j] = s({}), [M, N] = s(!0), [P, F] = s(null), [ee, I] = s(!1), [L, R] = s(!1), [z, U] = s(!1), W = o(!1), re = e.confirmOnDiscard !== !1, ie = e.open !== !1, ae = e.drawerSide || "right", K = i(), [oe, se] = s(() => {
|
|
1579
1610
|
let t = {};
|
|
1580
1611
|
return e.sections?.forEach((e, n) => {
|
|
1581
1612
|
let r = e.name || String(n);
|
|
@@ -1692,10 +1723,10 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1692
1723
|
]), q = t(() => {
|
|
1693
1724
|
R(!1), W.current && (W.current = !1, e.onCancel?.()), e.onOpenChange?.(!1);
|
|
1694
1725
|
}, [e]), ue = t((e) => {
|
|
1695
|
-
W.current = e, re &&
|
|
1726
|
+
W.current = e, re && ee ? R(!0) : q();
|
|
1696
1727
|
}, [
|
|
1697
1728
|
re,
|
|
1698
|
-
|
|
1729
|
+
ee,
|
|
1699
1730
|
q
|
|
1700
1731
|
]), de = t(() => {
|
|
1701
1732
|
W.current = !0, q();
|
|
@@ -1718,7 +1749,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1718
1749
|
showCancel: Z,
|
|
1719
1750
|
onSubmit: le,
|
|
1720
1751
|
onCancel: de,
|
|
1721
|
-
onDirtyChange:
|
|
1752
|
+
onDirtyChange: I,
|
|
1722
1753
|
showActions: !1,
|
|
1723
1754
|
id: K
|
|
1724
1755
|
}, ve = () => {
|
|
@@ -1781,6 +1812,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1781
1812
|
fields: e.fields,
|
|
1782
1813
|
sections: e.sections,
|
|
1783
1814
|
submitText: e.submitText,
|
|
1815
|
+
cancelText: ge,
|
|
1784
1816
|
details: Q,
|
|
1785
1817
|
onSuccess: async (t) => {
|
|
1786
1818
|
await e.onSuccess?.(t), e.onOpenChange?.(!1);
|
|
@@ -1816,7 +1848,7 @@ var xt = ({ details: e, state: t, setRows: n, formHostRef: i, taxRateField: a, f
|
|
|
1816
1848
|
className: G("overflow-y-auto", c, e.className),
|
|
1817
1849
|
style: pe,
|
|
1818
1850
|
children: [
|
|
1819
|
-
(e.title || e.description) && /* @__PURE__ */ X(
|
|
1851
|
+
(e.title || e.description) && /* @__PURE__ */ X(te, { children: [e.title && /* @__PURE__ */ Y(ne, { children: e.title }), e.description ? /* @__PURE__ */ Y(H, { children: e.description }) : /* @__PURE__ */ Y(H, {
|
|
1820
1852
|
className: "sr-only",
|
|
1821
1853
|
children: "Complete the form fields, then submit or cancel."
|
|
1822
1854
|
})] }),
|
|
@@ -1916,7 +1948,7 @@ var Dt = Z({
|
|
|
1916
1948
|
_,
|
|
1917
1949
|
e.objectName,
|
|
1918
1950
|
e.mode
|
|
1919
|
-
]), [k, A] = s(null), [j, M] = s([]), [L, R] = s({}), [z, B] = s(!0), [V,
|
|
1951
|
+
]), [k, A] = s(null), [j, M] = s([]), [L, R] = s({}), [z, B] = s(!0), [V, H] = s(null), [te, ne] = s(!1), [K, oe] = s(!1), [ce, le] = s(!1), q = o(!1), ue = e.confirmOnDiscard !== !1, de = e.open !== !1, pe = i(), me = a(() => {
|
|
1920
1952
|
if (e.sections?.length || e.customFields?.length) return null;
|
|
1921
1953
|
let t = Me(j, k);
|
|
1922
1954
|
e.mode === "create" && (t = Pe(t, k));
|
|
@@ -1963,7 +1995,7 @@ var Dt = Z({
|
|
|
1963
1995
|
try {
|
|
1964
1996
|
A(await n.getObjectSchema(e.objectName));
|
|
1965
1997
|
} catch (e) {
|
|
1966
|
-
|
|
1998
|
+
H(e), B(!1);
|
|
1967
1999
|
}
|
|
1968
2000
|
})();
|
|
1969
2001
|
}, [e.objectName, n]), r(() => {
|
|
@@ -1979,7 +2011,7 @@ var Dt = Z({
|
|
|
1979
2011
|
try {
|
|
1980
2012
|
R(await n.findOne(e.objectName, e.recordId) || {});
|
|
1981
2013
|
} catch (e) {
|
|
1982
|
-
|
|
2014
|
+
H(e);
|
|
1983
2015
|
} finally {
|
|
1984
2016
|
B(!1);
|
|
1985
2017
|
}
|
|
@@ -2194,11 +2226,11 @@ var Dt = Z({
|
|
|
2194
2226
|
if (je?.length && e.mode !== "view") return /* @__PURE__ */ Y(N, {
|
|
2195
2227
|
open: de,
|
|
2196
2228
|
onOpenChange: e.onOpenChange,
|
|
2197
|
-
children: /* @__PURE__ */ X(
|
|
2229
|
+
children: /* @__PURE__ */ X(I, {
|
|
2198
2230
|
className: G(he, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", c, e.className),
|
|
2199
2231
|
children: [(e.title || e.description) && /* @__PURE__ */ X(F, {
|
|
2200
2232
|
className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
|
|
2201
|
-
children: [e.title && /* @__PURE__ */ Y(
|
|
2233
|
+
children: [e.title && /* @__PURE__ */ Y(ee, { children: e.title }), e.description ? /* @__PURE__ */ Y(P, { children: e.description }) : /* @__PURE__ */ Y(P, {
|
|
2202
2234
|
className: "sr-only",
|
|
2203
2235
|
children: "Enter the record and its line items, then save."
|
|
2204
2236
|
})]
|
|
@@ -2212,7 +2244,10 @@ var Dt = Z({
|
|
|
2212
2244
|
recordId: e.recordId,
|
|
2213
2245
|
fields: e.fields,
|
|
2214
2246
|
sections: e.sections,
|
|
2247
|
+
initialValues: e.initialValues,
|
|
2248
|
+
initialData: e.initialData,
|
|
2215
2249
|
submitText: Te,
|
|
2250
|
+
cancelText: Ee,
|
|
2216
2251
|
details: je,
|
|
2217
2252
|
onSuccess: async (t) => {
|
|
2218
2253
|
await e.onSuccess?.(t), e.onOpenChange?.(!1);
|
|
@@ -2235,12 +2270,12 @@ var Dt = Z({
|
|
|
2235
2270
|
}
|
|
2236
2271
|
ye(!1);
|
|
2237
2272
|
},
|
|
2238
|
-
children: /* @__PURE__ */ X(
|
|
2273
|
+
children: /* @__PURE__ */ X(I, {
|
|
2239
2274
|
className: G(he, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", c, e.className),
|
|
2240
2275
|
children: [
|
|
2241
2276
|
(e.title || e.description) && /* @__PURE__ */ X(F, {
|
|
2242
2277
|
className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
|
|
2243
|
-
children: [e.title && /* @__PURE__ */ Y(
|
|
2278
|
+
children: [e.title && /* @__PURE__ */ Y(ee, { children: e.title }), e.description ? /* @__PURE__ */ Y(P, { children: e.description }) : /* @__PURE__ */ Y(P, {
|
|
2244
2279
|
className: "sr-only",
|
|
2245
2280
|
children: "Complete the form fields, then submit or cancel."
|
|
2246
2281
|
})]
|
|
@@ -2258,15 +2293,15 @@ var Dt = Z({
|
|
|
2258
2293
|
type: "button",
|
|
2259
2294
|
variant: "outline",
|
|
2260
2295
|
onClick: be,
|
|
2261
|
-
disabled:
|
|
2296
|
+
disabled: te,
|
|
2262
2297
|
className: "w-full sm:w-auto",
|
|
2263
2298
|
children: Ee
|
|
2264
2299
|
}), Ce && /* @__PURE__ */ X(D, {
|
|
2265
2300
|
type: "submit",
|
|
2266
2301
|
form: pe,
|
|
2267
|
-
disabled:
|
|
2302
|
+
disabled: te,
|
|
2268
2303
|
className: "w-full sm:w-auto",
|
|
2269
|
-
children: [
|
|
2304
|
+
children: [te && /* @__PURE__ */ Y(fe, { className: "mr-2 h-4 w-4 animate-spin" }), Te]
|
|
2270
2305
|
})]
|
|
2271
2306
|
})
|
|
2272
2307
|
}),
|
|
@@ -2316,6 +2351,7 @@ var Dt = Z({
|
|
|
2316
2351
|
fields: r.fields,
|
|
2317
2352
|
title: r.title,
|
|
2318
2353
|
submitText: r.submitText,
|
|
2354
|
+
cancelText: r.cancelText,
|
|
2319
2355
|
showSubmit: r.showSubmit,
|
|
2320
2356
|
details: r.subforms,
|
|
2321
2357
|
onSuccess: r.onSuccess,
|
|
@@ -2447,15 +2483,15 @@ var Dt = Z({
|
|
|
2447
2483
|
u,
|
|
2448
2484
|
n.objectName,
|
|
2449
2485
|
n.mode
|
|
2450
|
-
]), [f, m] = s(null), [h, y] = s([]), [b, x] = s(null), [S, C] = s(!0), [w, T] = s(null), E = n.customFields && n.customFields.length > 0;
|
|
2486
|
+
]), [f, m] = s(null), [h, y] = s([]), [b, x] = s(null), [S, C] = s(!0), [w, T] = s(null), [E, D] = s(null), O = n.customFields && n.customFields.length > 0;
|
|
2451
2487
|
r(() => {
|
|
2452
|
-
|
|
2488
|
+
O && (x(n.initialData || n.initialValues || {}), C(!1));
|
|
2453
2489
|
}, [
|
|
2454
|
-
|
|
2490
|
+
O,
|
|
2455
2491
|
n.initialData,
|
|
2456
2492
|
n.initialValues
|
|
2457
2493
|
]), r(() => {
|
|
2458
|
-
|
|
2494
|
+
O ? m({
|
|
2459
2495
|
name: n.objectName,
|
|
2460
2496
|
fields: {}
|
|
2461
2497
|
}) : n.objectName && i ? (async () => {
|
|
@@ -2467,18 +2503,18 @@ var Dt = Z({
|
|
|
2467
2503
|
} catch (e) {
|
|
2468
2504
|
T(e), C(!1);
|
|
2469
2505
|
}
|
|
2470
|
-
})() :
|
|
2506
|
+
})() : O || C(!1);
|
|
2471
2507
|
}, [
|
|
2472
2508
|
n.objectName,
|
|
2473
2509
|
i,
|
|
2474
|
-
|
|
2510
|
+
O
|
|
2475
2511
|
]), r(() => {
|
|
2476
|
-
f && !
|
|
2512
|
+
f && !O && (async () => {
|
|
2477
2513
|
if (!n.recordId || n.mode === "create") {
|
|
2478
2514
|
x(n.initialData || n.initialValues || {}), C(!1);
|
|
2479
2515
|
return;
|
|
2480
2516
|
}
|
|
2481
|
-
if (!
|
|
2517
|
+
if (!O) {
|
|
2482
2518
|
if (!i) {
|
|
2483
2519
|
T(/* @__PURE__ */ Error("DataSource is required for fetching record data (inline data not provided)")), C(!1);
|
|
2484
2520
|
return;
|
|
@@ -2501,12 +2537,12 @@ var Dt = Z({
|
|
|
2501
2537
|
n.initialData,
|
|
2502
2538
|
i,
|
|
2503
2539
|
f,
|
|
2504
|
-
|
|
2540
|
+
O
|
|
2505
2541
|
]);
|
|
2506
|
-
let
|
|
2542
|
+
let k = t((e) => e, []);
|
|
2507
2543
|
r(() => {
|
|
2508
|
-
if (
|
|
2509
|
-
y(n.customFields.map(
|
|
2544
|
+
if (O && n.customFields) {
|
|
2545
|
+
y(n.customFields.map(k)), C(!1);
|
|
2510
2546
|
return;
|
|
2511
2547
|
}
|
|
2512
2548
|
if (!f) return;
|
|
@@ -2515,11 +2551,11 @@ var Dt = Z({
|
|
|
2515
2551
|
let r = typeof t == "string" ? t : t.name;
|
|
2516
2552
|
if (!r) return;
|
|
2517
2553
|
let i = f.fields?.[r];
|
|
2518
|
-
if (!i && !
|
|
2554
|
+
if (!i && !O) return;
|
|
2519
2555
|
let o = !i?.permissions || i?.permissions.write !== !1;
|
|
2520
2556
|
if (n.mode !== "view" && !o) return;
|
|
2521
2557
|
let s = n.customFields?.find((e) => e.name === r);
|
|
2522
|
-
if (s) e.push(
|
|
2558
|
+
if (s) e.push(k(s));
|
|
2523
2559
|
else if (i) {
|
|
2524
2560
|
let o = {
|
|
2525
2561
|
name: r,
|
|
@@ -2542,21 +2578,21 @@ var Dt = Z({
|
|
|
2542
2578
|
}
|
|
2543
2579
|
i.type === "email" && (o.inputType = "email"), i.type === "phone" && (o.inputType = "tel"), i.type === "url" && (o.inputType = "url"), i.type === "password" && (o.inputType = "password"), i.type === "time" && (o.inputType = "time"), (i.type === "formula" || i.type === "summary" || i.type === "auto_number") && (o.disabled = !0), i.visible_on && (o.visibleOn = i.visible_on), e.push(o);
|
|
2544
2580
|
}
|
|
2545
|
-
}), y(e), !
|
|
2581
|
+
}), y(e), !O && n.recordId && n.mode !== "create" && i || C(!1);
|
|
2546
2582
|
}, [
|
|
2547
2583
|
f,
|
|
2548
2584
|
n.fields,
|
|
2549
2585
|
n.customFields,
|
|
2550
2586
|
n.readOnly,
|
|
2551
2587
|
n.mode,
|
|
2552
|
-
|
|
2588
|
+
O,
|
|
2553
2589
|
n.recordId,
|
|
2554
2590
|
i
|
|
2555
2591
|
]);
|
|
2556
|
-
let
|
|
2557
|
-
if (e && (e.nativeEvent || e._reactName === "onSubmit") && (console.warn("ObjectForm: Received Event instead of data in handleSubmit! This suggests a Form renderer issue."), t === void 0 && (e = {})),
|
|
2592
|
+
let A = t(async (e, t) => {
|
|
2593
|
+
if (e && (e.nativeEvent || e._reactName === "onSubmit") && (console.warn("ObjectForm: Received Event instead of data in handleSubmit! This suggests a Form renderer issue."), t === void 0 && (e = {})), O && !i) return n.onSuccess && await n.onSuccess(e), e;
|
|
2558
2594
|
if (!i) throw Error("DataSource is required for form submission (inline mode not configured)");
|
|
2559
|
-
let r = Ge(e,
|
|
2595
|
+
let r = Ge(e, O ? null : f);
|
|
2560
2596
|
if (u?.isLoaded && r && typeof r == "object") {
|
|
2561
2597
|
let e = {};
|
|
2562
2598
|
for (let t of Object.keys(r)) u.checkField(n.objectName, t, "write") && (e[t] = r[t]);
|
|
@@ -2569,7 +2605,23 @@ var Dt = Z({
|
|
|
2569
2605
|
else if (n.mode === "edit" && n.recordId) e = await i.update(n.objectName, n.recordId, r);
|
|
2570
2606
|
else throw Error("Invalid form mode or missing record ID");
|
|
2571
2607
|
if (n.onSuccess) await n.onSuccess(e);
|
|
2572
|
-
else if (!n.submitHandler) {
|
|
2608
|
+
else if (!n.submitHandler && n.submitBehavior) {
|
|
2609
|
+
let e = n.submitBehavior;
|
|
2610
|
+
switch (e.kind) {
|
|
2611
|
+
case "redirect":
|
|
2612
|
+
ge(e.url) && setTimeout(() => window.location.assign(e.url), e.delayMs ?? 0);
|
|
2613
|
+
break;
|
|
2614
|
+
case "continue": break;
|
|
2615
|
+
default: {
|
|
2616
|
+
let t = e.kind === "thank-you" && e.message ? e.message : n.successMessage || (n.mode === "create" ? "Created" : "Saved");
|
|
2617
|
+
K.success(t), D({
|
|
2618
|
+
title: e.kind === "thank-you" ? e.title : void 0,
|
|
2619
|
+
message: t
|
|
2620
|
+
});
|
|
2621
|
+
break;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
} else if (!n.submitHandler) {
|
|
2573
2625
|
let t = _e(n.navigateOnSuccess, e);
|
|
2574
2626
|
if (t) return window.location.assign(t), e;
|
|
2575
2627
|
K.success(n.successMessage || (n.mode === "create" ? "Created" : "Saved"));
|
|
@@ -2581,12 +2633,12 @@ var Dt = Z({
|
|
|
2581
2633
|
}, [
|
|
2582
2634
|
n,
|
|
2583
2635
|
i,
|
|
2584
|
-
|
|
2636
|
+
O,
|
|
2585
2637
|
u,
|
|
2586
2638
|
f
|
|
2587
|
-
]),
|
|
2639
|
+
]), j = t(() => {
|
|
2588
2640
|
n.onCancel && n.onCancel();
|
|
2589
|
-
}, [n]),
|
|
2641
|
+
}, [n]), M = {
|
|
2590
2642
|
...e.useMemo(() => {
|
|
2591
2643
|
if (!f?.fields) return {};
|
|
2592
2644
|
let e = {};
|
|
@@ -2596,18 +2648,18 @@ var Dt = Z({
|
|
|
2596
2648
|
}), e;
|
|
2597
2649
|
}, [f]),
|
|
2598
2650
|
...b
|
|
2599
|
-
},
|
|
2651
|
+
}, N = e.useMemo(() => {
|
|
2600
2652
|
let e = Me(h, f);
|
|
2601
2653
|
return n.mode === "create" && (e = Pe(e, f)), e;
|
|
2602
2654
|
}, [
|
|
2603
2655
|
h,
|
|
2604
2656
|
f,
|
|
2605
2657
|
n.mode
|
|
2606
|
-
]),
|
|
2658
|
+
]), P = e.useMemo(() => n.sections?.length ? null : Et(N, f?.fieldGroups), [
|
|
2607
2659
|
n.sections,
|
|
2608
|
-
|
|
2660
|
+
N,
|
|
2609
2661
|
f
|
|
2610
|
-
]),
|
|
2662
|
+
]), F = n.sections?.length ? n.sections : P, [ee, I] = s({});
|
|
2611
2663
|
if (w) return /* @__PURE__ */ X("div", {
|
|
2612
2664
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
2613
2665
|
children: [/* @__PURE__ */ Y("h3", {
|
|
@@ -2625,10 +2677,20 @@ var Dt = Z({
|
|
|
2625
2677
|
children: "Loading form..."
|
|
2626
2678
|
})]
|
|
2627
2679
|
});
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2680
|
+
if (E) return /* @__PURE__ */ X("div", {
|
|
2681
|
+
className: "rounded-md border bg-card p-6 sm:p-8 text-center",
|
|
2682
|
+
children: [/* @__PURE__ */ Y("h3", {
|
|
2683
|
+
className: "text-lg font-semibold",
|
|
2684
|
+
children: E.title ?? "Thanks!"
|
|
2685
|
+
}), E.message && /* @__PURE__ */ Y("p", {
|
|
2686
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
2687
|
+
children: E.message
|
|
2688
|
+
})]
|
|
2689
|
+
});
|
|
2690
|
+
let L = n.layout === "vertical" || n.layout === "horizontal" ? n.layout : "vertical";
|
|
2691
|
+
if (F?.length && (!n.formType || n.formType === "simple")) {
|
|
2692
|
+
let e = P ? N : h, t = (e) => typeof e == "number" && e > 0 ? Math.min(Math.floor(e), 4) : void 0, r = F.map((e) => t(e.columns)).filter((e) => e != null), i = F.reduce((e, t) => e + (Array.isArray(t.fields) ? t.fields.length : 0), 0), a = t(n.columns) ?? (r.length ? Math.max(...r) : De(i)), s = [];
|
|
2693
|
+
F.forEach((r, i) => {
|
|
2632
2694
|
let c = new Map(r.fields.map((e) => [typeof e == "string" ? e : e.field ?? e.name, e])), l = Array.from(c.keys()), u = d(e.filter((e) => l.includes(e.name))).map((e) => {
|
|
2633
2695
|
let t = c.get(e.name);
|
|
2634
2696
|
if (!t || typeof t != "object") return e;
|
|
@@ -2636,7 +2698,7 @@ var Dt = Z({
|
|
|
2636
2698
|
return n.visibleOn != null && (r.visibleOn = n.visibleOn), n.colSpan != null && (r.colSpan = n.colSpan), n.span != null && (r.span = n.span), r;
|
|
2637
2699
|
});
|
|
2638
2700
|
if (u.length === 0) return;
|
|
2639
|
-
let f = r.name || r.label || String(i), p = r.name ? o(n.objectName, r.name, r.label || r.name) : r.label, m =
|
|
2701
|
+
let f = r.name || r.label || String(i), p = r.name ? o(n.objectName, r.name, r.label || r.name) : r.label, m = ee[f] ?? r.collapsed ?? !1;
|
|
2640
2702
|
p && s.push({
|
|
2641
2703
|
name: `__section_${f}`,
|
|
2642
2704
|
label: p,
|
|
@@ -2644,7 +2706,7 @@ var Dt = Z({
|
|
|
2644
2706
|
colSpan: 4,
|
|
2645
2707
|
collapsible: r.collapsible,
|
|
2646
2708
|
collapsed: m,
|
|
2647
|
-
onToggle: r.collapsible ? () =>
|
|
2709
|
+
onToggle: r.collapsible ? () => I((e) => ({
|
|
2648
2710
|
...e,
|
|
2649
2711
|
[f]: !m
|
|
2650
2712
|
})) : void 0
|
|
@@ -2662,36 +2724,36 @@ var Dt = Z({
|
|
|
2662
2724
|
type: "form",
|
|
2663
2725
|
objectName: n.objectName,
|
|
2664
2726
|
fields: c,
|
|
2665
|
-
layout:
|
|
2727
|
+
layout: L,
|
|
2666
2728
|
columns: a,
|
|
2667
2729
|
...u ? { fieldContainerClass: u } : {},
|
|
2668
|
-
defaultValues:
|
|
2730
|
+
defaultValues: M,
|
|
2669
2731
|
showSubmit: n.showSubmit !== !1 && n.mode !== "view",
|
|
2670
2732
|
showCancel: n.showCancel !== !1,
|
|
2671
2733
|
submitLabel: n.submitText || (n.mode === "create" ? "Create" : "Update"),
|
|
2672
2734
|
cancelLabel: n.cancelText,
|
|
2673
|
-
onSubmit:
|
|
2674
|
-
onCancel:
|
|
2735
|
+
onSubmit: A,
|
|
2736
|
+
onCancel: j
|
|
2675
2737
|
} })
|
|
2676
2738
|
});
|
|
2677
2739
|
}
|
|
2678
|
-
let
|
|
2679
|
-
fields:
|
|
2740
|
+
let R = n.sections?.length, z = d(h), B = R ? {
|
|
2741
|
+
fields: z,
|
|
2680
2742
|
columns: n.columns
|
|
2681
|
-
} : ze(
|
|
2743
|
+
} : ze(z, f, n.columns, n.mode), V = n.mobile, H = V?.fullscreenLongText ? B.fields.map((e) => {
|
|
2682
2744
|
let t = e.type;
|
|
2683
2745
|
return t === "textarea" || t === "field:textarea" || t === "string-multiline" || t === "field:markdown" || t === "field:html" ? {
|
|
2684
2746
|
...e,
|
|
2685
2747
|
mobile_fullscreen: !0
|
|
2686
2748
|
} : e;
|
|
2687
|
-
}) :
|
|
2688
|
-
if (!n.formType && !
|
|
2689
|
-
let e =
|
|
2690
|
-
for (let n = 0; n < e.length; n +=
|
|
2691
|
-
let r = e.slice(n, n +
|
|
2749
|
+
}) : B.fields, te = V?.stepper, ne = V?.stepperMinFields ?? 8, U = Math.max(1, V?.stepperFieldsPerStep ?? 1);
|
|
2750
|
+
if (!n.formType && !R && H.length >= 2 && (te === !0 || te === "auto" && c && H.length >= ne)) {
|
|
2751
|
+
let e = H, t = [];
|
|
2752
|
+
for (let n = 0; n < e.length; n += U) {
|
|
2753
|
+
let r = e.slice(n, n + U);
|
|
2692
2754
|
t.push({
|
|
2693
|
-
name: `step-${Math.floor(n /
|
|
2694
|
-
label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n /
|
|
2755
|
+
name: `step-${Math.floor(n / U) + 1}`,
|
|
2756
|
+
label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n / U) + 1}`,
|
|
2695
2757
|
fields: r
|
|
2696
2758
|
});
|
|
2697
2759
|
}
|
|
@@ -2706,27 +2768,27 @@ var Dt = Z({
|
|
|
2706
2768
|
className: n.className
|
|
2707
2769
|
});
|
|
2708
2770
|
}
|
|
2709
|
-
let
|
|
2771
|
+
let W = {
|
|
2710
2772
|
type: "form",
|
|
2711
2773
|
objectName: n.objectName,
|
|
2712
|
-
fields:
|
|
2713
|
-
layout:
|
|
2714
|
-
columns:
|
|
2774
|
+
fields: H,
|
|
2775
|
+
layout: L,
|
|
2776
|
+
columns: B.columns,
|
|
2715
2777
|
submitLabel: n.submitText || (n.mode === "create" ? "Create" : "Update"),
|
|
2716
2778
|
cancelLabel: n.cancelText,
|
|
2717
2779
|
showSubmit: n.showSubmit !== !1 && n.mode !== "view",
|
|
2718
2780
|
showCancel: n.showCancel !== !1,
|
|
2719
|
-
resetOnSubmit: n.showReset || n.resetOnSuccess && n.mode === "create",
|
|
2720
|
-
defaultValues:
|
|
2721
|
-
onSubmit:
|
|
2722
|
-
onCancel:
|
|
2781
|
+
resetOnSubmit: n.showReset || n.submitBehavior?.kind === "continue" || !n.submitBehavior && n.resetOnSuccess && n.mode === "create",
|
|
2782
|
+
defaultValues: M,
|
|
2783
|
+
onSubmit: A,
|
|
2784
|
+
onCancel: j,
|
|
2723
2785
|
className: n.className,
|
|
2724
|
-
mobileStickyActions: !!
|
|
2786
|
+
mobileStickyActions: !!V?.stickyActions
|
|
2725
2787
|
};
|
|
2726
2788
|
return /* @__PURE__ */ Y("div", {
|
|
2727
|
-
className:
|
|
2728
|
-
"data-mobile-form":
|
|
2729
|
-
children: /* @__PURE__ */ Y(l, { schema:
|
|
2789
|
+
className: V?.stickyActions ? "w-full pb-20 md:pb-0" : "w-full",
|
|
2790
|
+
"data-mobile-form": V ? "true" : void 0,
|
|
2791
|
+
children: /* @__PURE__ */ Y(l, { schema: W })
|
|
2730
2792
|
});
|
|
2731
2793
|
}, Mt = {
|
|
2732
2794
|
text: 200,
|