@object-ui/plugin-form 4.3.0 → 4.4.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 +25 -0
- package/dist/index.js +469 -379
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-form/src/autoLayout.d.ts +14 -0
- package/dist/packages/plugin-form/src/index.d.ts +1 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -3,34 +3,35 @@ import { ComponentRegistry as o } from "@object-ui/core";
|
|
|
3
3
|
import { SchemaRenderer as s, useSafeFieldLabel as c } from "@object-ui/react";
|
|
4
4
|
import { buildValidationRules as l, evaluateCondition as u, formatFileSize as d, mapFieldTypeToFormType as f } from "@object-ui/fields";
|
|
5
5
|
import { Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v, Dialog as y, DialogDescription as b, DialogHeader as x, DialogTitle as S, MobileDialogContent as C, ResizableHandle as w, ResizablePanel as T, ResizablePanelGroup as E, Sheet as D, SheetContent as O, SheetDescription as k, SheetHeader as A, SheetTitle as j, Skeleton as M, Tabs as N, TabsContent as P, TabsList as F, TabsTrigger as I, cn as L, useIsMobile as R } from "@object-ui/components";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { usePermissions as z } from "@object-ui/permissions";
|
|
7
|
+
import { Check as B, ChevronDown as ee, ChevronLeft as V, ChevronRight as H, Loader2 as te } from "lucide-react";
|
|
8
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
8
9
|
//#region src/FormSection.tsx
|
|
9
|
-
var
|
|
10
|
+
var K = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, columns: i = 1, children: o, className: s, gridClassName: c }) => {
|
|
10
11
|
let [l, u] = a(r);
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ G("div", {
|
|
12
13
|
className: L("form-section", s),
|
|
13
|
-
children: [(e || t) && /* @__PURE__ */
|
|
14
|
+
children: [(e || t) && /* @__PURE__ */ G("div", {
|
|
14
15
|
className: L("flex items-start gap-2 mb-4", n && "cursor-pointer select-none"),
|
|
15
16
|
onClick: () => {
|
|
16
17
|
n && u(!l);
|
|
17
18
|
},
|
|
18
19
|
role: n ? "button" : void 0,
|
|
19
20
|
"aria-expanded": n ? !l : void 0,
|
|
20
|
-
children: [n && /* @__PURE__ */
|
|
21
|
+
children: [n && /* @__PURE__ */ W("span", {
|
|
21
22
|
className: "mt-0.5 text-muted-foreground",
|
|
22
|
-
children:
|
|
23
|
-
}), /* @__PURE__ */
|
|
23
|
+
children: W(l ? H : ee, { className: "h-4 w-4" })
|
|
24
|
+
}), /* @__PURE__ */ G("div", {
|
|
24
25
|
className: "flex-1",
|
|
25
|
-
children: [e && /* @__PURE__ */
|
|
26
|
+
children: [e && /* @__PURE__ */ W("h3", {
|
|
26
27
|
className: "text-base font-semibold text-foreground",
|
|
27
28
|
children: e
|
|
28
|
-
}), t && /* @__PURE__ */
|
|
29
|
+
}), t && /* @__PURE__ */ W("p", {
|
|
29
30
|
className: "text-sm text-muted-foreground mt-0.5",
|
|
30
31
|
children: t
|
|
31
32
|
})]
|
|
32
33
|
})]
|
|
33
|
-
}), !l && /* @__PURE__ */
|
|
34
|
+
}), !l && /* @__PURE__ */ W("div", {
|
|
34
35
|
className: L("grid gap-4", c || {
|
|
35
36
|
1: "grid-cols-1",
|
|
36
37
|
2: "grid-cols-1 md:grid-cols-2",
|
|
@@ -40,7 +41,7 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
40
41
|
children: o
|
|
41
42
|
})]
|
|
42
43
|
});
|
|
43
|
-
},
|
|
44
|
+
}, q = ({ schema: n, dataSource: r, className: i }) => {
|
|
44
45
|
let { fieldLabel: o } = c(), [u, d] = a(null), [p, m] = a({}), [h, g] = a(!0), [_, v] = a(null), [y, b] = a(n.defaultTab || n.sections[0]?.name || n.sections[0]?.label || "tab-0");
|
|
45
46
|
e.useEffect(() => {
|
|
46
47
|
(async () => {
|
|
@@ -119,19 +120,19 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
119
120
|
}, [n, r]), C = t(() => {
|
|
120
121
|
n.onCancel && n.onCancel();
|
|
121
122
|
}, [n]), w = (e, t) => e.name || e.label || `tab-${t}`;
|
|
122
|
-
if (_) return /* @__PURE__ */
|
|
123
|
+
if (_) return /* @__PURE__ */ G("div", {
|
|
123
124
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
124
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
125
126
|
className: "text-red-800 font-semibold",
|
|
126
127
|
children: "Error loading form"
|
|
127
|
-
}), /* @__PURE__ */
|
|
128
|
+
}), /* @__PURE__ */ W("p", {
|
|
128
129
|
className: "text-red-600 text-sm mt-1",
|
|
129
130
|
children: _.message
|
|
130
131
|
})]
|
|
131
132
|
});
|
|
132
|
-
if (h) return /* @__PURE__ */
|
|
133
|
+
if (h) return /* @__PURE__ */ G("div", {
|
|
133
134
|
className: "p-8 text-center",
|
|
134
|
-
children: [/* @__PURE__ */
|
|
135
|
+
children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
|
|
135
136
|
className: "mt-2 text-sm text-gray-600",
|
|
136
137
|
children: "Loading form..."
|
|
137
138
|
})]
|
|
@@ -148,29 +149,29 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
148
149
|
onSubmit: S,
|
|
149
150
|
onCancel: C
|
|
150
151
|
}, E = n.tabPosition === "left" || n.tabPosition === "right";
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ W("div", {
|
|
152
153
|
className: L("w-full", i, n.className),
|
|
153
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ G(N, {
|
|
154
155
|
value: y,
|
|
155
156
|
onValueChange: b,
|
|
156
157
|
orientation: E ? "vertical" : "horizontal",
|
|
157
158
|
className: L(E && "flex gap-4"),
|
|
158
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ W(F, {
|
|
159
160
|
className: L(E ? "flex-col h-auto" : "", n.tabPosition === "bottom" && "order-last", n.tabPosition === "right" && "order-last"),
|
|
160
|
-
children: n.sections.map((e, t) => /* @__PURE__ */
|
|
161
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ W(I, {
|
|
161
162
|
value: w(e, t),
|
|
162
163
|
className: E ? "w-full justify-start" : "",
|
|
163
164
|
children: e.label || `Tab ${t + 1}`
|
|
164
165
|
}, w(e, t)))
|
|
165
|
-
}), /* @__PURE__ */
|
|
166
|
+
}), /* @__PURE__ */ W("div", {
|
|
166
167
|
className: "flex-1",
|
|
167
|
-
children: n.sections.map((e, t) => /* @__PURE__ */
|
|
168
|
+
children: n.sections.map((e, t) => /* @__PURE__ */ W(P, {
|
|
168
169
|
value: w(e, t),
|
|
169
170
|
className: "mt-0",
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
+
children: /* @__PURE__ */ W(K, {
|
|
171
172
|
description: e.description,
|
|
172
173
|
columns: e.columns || 1,
|
|
173
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ W(s, { schema: {
|
|
174
175
|
...T,
|
|
175
176
|
fields: x(e),
|
|
176
177
|
showSubmit: n.showSubmit !== !1 && n.mode !== "view",
|
|
@@ -181,7 +182,7 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
181
182
|
})]
|
|
182
183
|
})
|
|
183
184
|
});
|
|
184
|
-
},
|
|
185
|
+
}, J = ({ schema: n, dataSource: r, className: o }) => {
|
|
185
186
|
let { fieldLabel: u } = c(), [d, m] = a(null), [h, g] = a({}), [_, v] = a(!0), [y, b] = a(null), [x, S] = a(0), [C, w] = a(/* @__PURE__ */ new Set()), [T, E] = a(!1), D = n.sections.length, O = x === 0, k = x === D - 1;
|
|
186
187
|
e.useEffect(() => {
|
|
187
188
|
(async () => {
|
|
@@ -291,51 +292,51 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
291
292
|
x,
|
|
292
293
|
N
|
|
293
294
|
]);
|
|
294
|
-
if (y) return /* @__PURE__ */
|
|
295
|
+
if (y) return /* @__PURE__ */ G("div", {
|
|
295
296
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
297
298
|
className: "text-red-800 font-semibold",
|
|
298
299
|
children: "Error loading form"
|
|
299
|
-
}), /* @__PURE__ */
|
|
300
|
+
}), /* @__PURE__ */ W("p", {
|
|
300
301
|
className: "text-red-600 text-sm mt-1",
|
|
301
302
|
children: y.message
|
|
302
303
|
})]
|
|
303
304
|
});
|
|
304
|
-
if (_) return /* @__PURE__ */
|
|
305
|
+
if (_) return /* @__PURE__ */ G("div", {
|
|
305
306
|
className: "p-8 text-center",
|
|
306
|
-
children: [/* @__PURE__ */
|
|
307
|
+
children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
|
|
307
308
|
className: "mt-2 text-sm text-gray-600",
|
|
308
309
|
children: "Loading form..."
|
|
309
310
|
})]
|
|
310
311
|
});
|
|
311
312
|
let R = n.sections[x];
|
|
312
|
-
return /* @__PURE__ */
|
|
313
|
+
return /* @__PURE__ */ G("div", {
|
|
313
314
|
className: L("w-full", o, n.className),
|
|
314
315
|
children: [
|
|
315
|
-
n.showStepIndicator !== !1 && /* @__PURE__ */
|
|
316
|
+
n.showStepIndicator !== !1 && /* @__PURE__ */ W("nav", {
|
|
316
317
|
"aria-label": "Progress",
|
|
317
318
|
className: "mb-8",
|
|
318
|
-
children: /* @__PURE__ */
|
|
319
|
+
children: /* @__PURE__ */ W("ol", {
|
|
319
320
|
className: "flex items-center",
|
|
320
321
|
children: n.sections.map((e, t) => {
|
|
321
322
|
let r = t === x, i = C.has(t), a = n.allowSkip || i || t <= x;
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
+
return /* @__PURE__ */ G("li", {
|
|
323
324
|
className: L("relative flex-1", t !== D - 1 && "pr-8 sm:pr-12"),
|
|
324
|
-
children: [t !== D - 1 && /* @__PURE__ */
|
|
325
|
+
children: [t !== D - 1 && /* @__PURE__ */ W("div", {
|
|
325
326
|
className: "absolute top-3 sm:top-4 left-6 -right-4 sm:left-10 sm:-right-2 h-0.5",
|
|
326
327
|
"aria-hidden": "true",
|
|
327
|
-
children: /* @__PURE__ */
|
|
328
|
-
}), /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ W("div", { className: L("h-full", i ? "bg-primary" : "bg-muted") })
|
|
329
|
+
}), /* @__PURE__ */ G("button", {
|
|
329
330
|
type: "button",
|
|
330
331
|
className: L("group relative flex items-center", a ? "cursor-pointer" : "cursor-not-allowed"),
|
|
331
332
|
onClick: () => I(t),
|
|
332
333
|
disabled: !a,
|
|
333
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ W("span", {
|
|
334
335
|
className: L("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"),
|
|
335
|
-
children: i ? /* @__PURE__ */
|
|
336
|
-
}), /* @__PURE__ */
|
|
336
|
+
children: i ? /* @__PURE__ */ W(B, { className: "h-3 w-3 sm:h-4 sm:w-4" }) : t + 1
|
|
337
|
+
}), /* @__PURE__ */ W("span", {
|
|
337
338
|
className: "ml-2 sm:ml-3 text-xs sm:text-sm font-medium hidden sm:block",
|
|
338
|
-
children: /* @__PURE__ */
|
|
339
|
+
children: /* @__PURE__ */ W("span", {
|
|
339
340
|
className: L(r ? "text-foreground" : "text-muted-foreground"),
|
|
340
341
|
children: e.label || `Step ${t + 1}`
|
|
341
342
|
})
|
|
@@ -345,13 +346,13 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
345
346
|
})
|
|
346
347
|
})
|
|
347
348
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ W("div", {
|
|
349
350
|
className: "min-h-[200px]",
|
|
350
|
-
children: R && /* @__PURE__ */
|
|
351
|
+
children: R && /* @__PURE__ */ W(K, {
|
|
351
352
|
label: R.label,
|
|
352
353
|
description: R.description,
|
|
353
354
|
columns: R.columns || 1,
|
|
354
|
-
children: j.length > 0 ? /* @__PURE__ */
|
|
355
|
+
children: j.length > 0 ? /* @__PURE__ */ W(s, { schema: {
|
|
355
356
|
type: "form",
|
|
356
357
|
fields: j,
|
|
357
358
|
layout: "vertical",
|
|
@@ -359,22 +360,22 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
359
360
|
showSubmit: !1,
|
|
360
361
|
showCancel: !1,
|
|
361
362
|
onSubmit: M
|
|
362
|
-
} }) : /* @__PURE__ */
|
|
363
|
+
} }) : /* @__PURE__ */ W("div", {
|
|
363
364
|
className: "text-center py-8 text-muted-foreground",
|
|
364
365
|
children: "No fields configured for this step"
|
|
365
366
|
})
|
|
366
367
|
})
|
|
367
368
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
+
/* @__PURE__ */ G("div", {
|
|
369
370
|
className: "flex items-center justify-between mt-6 pt-4 border-t",
|
|
370
|
-
children: [/* @__PURE__ */
|
|
371
|
+
children: [/* @__PURE__ */ W("div", { children: n.showCancel !== !1 && /* @__PURE__ */ W(p, {
|
|
371
372
|
variant: "ghost",
|
|
372
373
|
onClick: F,
|
|
373
374
|
children: n.cancelText || "Cancel"
|
|
374
|
-
}) }), /* @__PURE__ */
|
|
375
|
+
}) }), /* @__PURE__ */ G("div", {
|
|
375
376
|
className: "flex items-center gap-2",
|
|
376
377
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ G("span", {
|
|
378
379
|
className: "text-sm text-muted-foreground mr-2",
|
|
379
380
|
children: [
|
|
380
381
|
"Step ",
|
|
@@ -383,25 +384,25 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
383
384
|
D
|
|
384
385
|
]
|
|
385
386
|
}),
|
|
386
|
-
!O && /* @__PURE__ */
|
|
387
|
+
!O && /* @__PURE__ */ G(p, {
|
|
387
388
|
variant: "outline",
|
|
388
389
|
onClick: P,
|
|
389
|
-
children: [/* @__PURE__ */
|
|
390
|
+
children: [/* @__PURE__ */ W(V, { className: "h-4 w-4 mr-1" }), n.prevText || "Back"]
|
|
390
391
|
}),
|
|
391
|
-
k ? /* @__PURE__ */
|
|
392
|
+
k ? /* @__PURE__ */ W(p, {
|
|
392
393
|
onClick: () => M(h),
|
|
393
394
|
disabled: T || n.mode === "view",
|
|
394
395
|
children: T ? "Submitting..." : n.submitText || (n.mode === "create" ? "Create" : "Update")
|
|
395
|
-
}) : /* @__PURE__ */
|
|
396
|
+
}) : /* @__PURE__ */ G(p, {
|
|
396
397
|
onClick: () => M(h),
|
|
397
|
-
children: [n.nextText || "Next", /* @__PURE__ */
|
|
398
|
+
children: [n.nextText || "Next", /* @__PURE__ */ W(H, { className: "h-4 w-4 ml-1" })]
|
|
398
399
|
})
|
|
399
400
|
]
|
|
400
401
|
})]
|
|
401
402
|
})
|
|
402
403
|
]
|
|
403
404
|
});
|
|
404
|
-
},
|
|
405
|
+
}, Y = ({ schema: e, dataSource: r, className: o }) => {
|
|
405
406
|
let { fieldLabel: u } = c(), [d, p] = a(null), [m, h] = a({}), [g, _] = a(!0), [v, y] = a(null);
|
|
406
407
|
n(() => {
|
|
407
408
|
(async () => {
|
|
@@ -486,19 +487,19 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
486
487
|
}, [e]), C = i(() => e.sections.slice(0, 1), [e.sections]), D = i(() => e.sections.slice(1), [e.sections]);
|
|
487
488
|
i(() => e.sections.flatMap((e) => b(e)), [e.sections, b]);
|
|
488
489
|
let O = e.splitDirection || "horizontal", k = e.splitSize || 50;
|
|
489
|
-
if (v) return /* @__PURE__ */
|
|
490
|
+
if (v) return /* @__PURE__ */ G("div", {
|
|
490
491
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
492
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
492
493
|
className: "text-red-800 font-semibold",
|
|
493
494
|
children: "Error loading form"
|
|
494
|
-
}), /* @__PURE__ */
|
|
495
|
+
}), /* @__PURE__ */ W("p", {
|
|
495
496
|
className: "text-red-600 text-sm mt-1",
|
|
496
497
|
children: v.message
|
|
497
498
|
})]
|
|
498
499
|
});
|
|
499
|
-
if (g) return /* @__PURE__ */
|
|
500
|
+
if (g) return /* @__PURE__ */ G("div", {
|
|
500
501
|
className: "p-8 text-center",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
|
|
502
503
|
className: "mt-2 text-sm text-gray-600",
|
|
503
504
|
children: "Loading form..."
|
|
504
505
|
})]
|
|
@@ -509,13 +510,13 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
509
510
|
defaultValues: m,
|
|
510
511
|
onSubmit: x,
|
|
511
512
|
onCancel: S
|
|
512
|
-
}, j = (t, n) => /* @__PURE__ */
|
|
513
|
+
}, j = (t, n) => /* @__PURE__ */ W("div", {
|
|
513
514
|
className: "space-y-4 p-4",
|
|
514
|
-
children: t.map((t, r) => /* @__PURE__ */
|
|
515
|
+
children: t.map((t, r) => /* @__PURE__ */ W(K, {
|
|
515
516
|
label: t.label,
|
|
516
517
|
description: t.description,
|
|
517
518
|
columns: t.columns || 1,
|
|
518
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ W(s, { schema: {
|
|
519
520
|
...A,
|
|
520
521
|
fields: b(t),
|
|
521
522
|
showSubmit: n && e.showSubmit !== !1 && e.mode !== "view",
|
|
@@ -525,28 +526,28 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
525
526
|
} })
|
|
526
527
|
}, t.name || t.label || r))
|
|
527
528
|
});
|
|
528
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ W("div", {
|
|
529
530
|
className: L("w-full", o, e.className),
|
|
530
|
-
children: /* @__PURE__ */
|
|
531
|
+
children: /* @__PURE__ */ G(E, {
|
|
531
532
|
orientation: O,
|
|
532
533
|
className: "min-h-[300px] rounded-lg border",
|
|
533
|
-
children: [/* @__PURE__ */
|
|
534
|
+
children: [/* @__PURE__ */ W(T, {
|
|
534
535
|
defaultSize: k,
|
|
535
536
|
minSize: 20,
|
|
536
537
|
children: j(C, D.length === 0)
|
|
537
|
-
}), D.length > 0 && /* @__PURE__ */
|
|
538
|
+
}), D.length > 0 && /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(w, { withHandle: e.splitResizable !== !1 }), /* @__PURE__ */ W(T, {
|
|
538
539
|
defaultSize: 100 - k,
|
|
539
540
|
minSize: 20,
|
|
540
541
|
children: j(D, !0)
|
|
541
542
|
})] })]
|
|
542
543
|
})
|
|
543
544
|
});
|
|
544
|
-
},
|
|
545
|
+
}, X = new Set([
|
|
545
546
|
"field:formula",
|
|
546
547
|
"field:summary",
|
|
547
548
|
"field:auto_number",
|
|
548
549
|
"field:autonumber"
|
|
549
|
-
]),
|
|
550
|
+
]), ne = new Set([
|
|
550
551
|
"field:textarea",
|
|
551
552
|
"field:markdown",
|
|
552
553
|
"field:html",
|
|
@@ -557,70 +558,90 @@ var G = ({ label: e, description: t, collapsible: n = !1, collapsed: r = !1, col
|
|
|
557
558
|
"html",
|
|
558
559
|
"grid",
|
|
559
560
|
"rich-text"
|
|
560
|
-
]),
|
|
561
|
+
]), re = new Set([
|
|
561
562
|
"formula",
|
|
562
563
|
"summary",
|
|
563
564
|
"auto_number",
|
|
564
565
|
"autonumber"
|
|
565
566
|
]);
|
|
566
|
-
function
|
|
567
|
-
return
|
|
567
|
+
function ie(e) {
|
|
568
|
+
return ne.has(e);
|
|
568
569
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
570
|
+
function Z(e) {
|
|
571
|
+
return re.has(e);
|
|
571
572
|
}
|
|
572
|
-
function
|
|
573
|
+
function ae(e) {
|
|
573
574
|
return e <= 3 ? 1 : 2;
|
|
574
575
|
}
|
|
575
|
-
function
|
|
576
|
-
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type &&
|
|
576
|
+
function Q(e, t) {
|
|
577
|
+
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type && ie(e.type) ? {
|
|
577
578
|
...e,
|
|
578
579
|
colSpan: t
|
|
579
580
|
} : e);
|
|
580
581
|
}
|
|
581
|
-
var
|
|
582
|
+
var oe = new Set([
|
|
582
583
|
"id",
|
|
583
584
|
"created_at",
|
|
584
585
|
"createdAt",
|
|
585
586
|
"updated_at",
|
|
586
587
|
"updatedAt",
|
|
588
|
+
"last_modified_at",
|
|
589
|
+
"lastModifiedAt",
|
|
587
590
|
"deleted_at",
|
|
588
591
|
"deletedAt",
|
|
589
592
|
"created_by",
|
|
590
593
|
"createdBy",
|
|
591
594
|
"updated_by",
|
|
592
595
|
"updatedBy",
|
|
596
|
+
"last_modified_by",
|
|
597
|
+
"lastModifiedBy",
|
|
598
|
+
"organization_id",
|
|
599
|
+
"organizationId",
|
|
600
|
+
"org_id",
|
|
601
|
+
"orgId",
|
|
602
|
+
"tenant_id",
|
|
603
|
+
"tenantId",
|
|
593
604
|
"owner",
|
|
594
605
|
"owner_id",
|
|
595
606
|
"_version",
|
|
596
607
|
"_rev"
|
|
597
608
|
]);
|
|
598
|
-
function
|
|
609
|
+
function se(e, t) {
|
|
610
|
+
return e.filter((e) => !(oe.has(e.name) || t?.fields?.[e.name]?.readonly === !0));
|
|
611
|
+
}
|
|
612
|
+
function ce(e, t) {
|
|
599
613
|
return e.filter((e) => {
|
|
600
|
-
if (
|
|
614
|
+
if (oe.has(e.name) || e.type && X.has(e.type)) return !1;
|
|
601
615
|
if (!t?.fields) return !0;
|
|
602
616
|
let n = t.fields[e.name];
|
|
603
|
-
return n ? n.readonly === !0 ? !1 : !
|
|
617
|
+
return n ? n.readonly === !0 ? !1 : !Z(n.type) : !0;
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
function le(e, t) {
|
|
621
|
+
return e.filter((e) => {
|
|
622
|
+
if (e.type && X.has(e.type)) return !1;
|
|
623
|
+
let n = t?.fields?.[e.name];
|
|
624
|
+
return n ? !Z(n.type) : !0;
|
|
604
625
|
});
|
|
605
626
|
}
|
|
606
|
-
function
|
|
627
|
+
function ue(e) {
|
|
607
628
|
return e <= 1 ? "default" : e === 2 ? "xl" : "full";
|
|
608
629
|
}
|
|
609
|
-
function
|
|
630
|
+
function $(e, t, n, r) {
|
|
610
631
|
let i = [...e];
|
|
611
|
-
if (r === "create" && (i = le(i, t)), n !== void 0) return i =
|
|
632
|
+
if (i = se(i, t), r === "create" && (i = le(i, t)), n !== void 0) return i = Q(i, n), {
|
|
612
633
|
fields: i,
|
|
613
634
|
columns: n
|
|
614
635
|
};
|
|
615
|
-
let a =
|
|
616
|
-
return i =
|
|
636
|
+
let a = ae(i.length);
|
|
637
|
+
return i = Q(i, a), {
|
|
617
638
|
fields: i,
|
|
618
639
|
columns: a
|
|
619
640
|
};
|
|
620
641
|
}
|
|
621
642
|
//#endregion
|
|
622
643
|
//#region src/sanitize.ts
|
|
623
|
-
var
|
|
644
|
+
var de = new Set([
|
|
624
645
|
"id",
|
|
625
646
|
"_id",
|
|
626
647
|
"created_at",
|
|
@@ -629,7 +650,7 @@ var ue = new Set([
|
|
|
629
650
|
"updatedAt",
|
|
630
651
|
"organization_id",
|
|
631
652
|
"organizationId"
|
|
632
|
-
]),
|
|
653
|
+
]), fe = new Set([
|
|
633
654
|
"formula",
|
|
634
655
|
"rollup",
|
|
635
656
|
"lookup_value",
|
|
@@ -637,15 +658,15 @@ var ue = new Set([
|
|
|
637
658
|
"autonumber",
|
|
638
659
|
"computed"
|
|
639
660
|
]);
|
|
640
|
-
function
|
|
661
|
+
function pe(e, t) {
|
|
641
662
|
if (!e || typeof e != "object") return e;
|
|
642
663
|
let n = {}, r = t?.fields;
|
|
643
|
-
for (let [t, i] of Object.entries(e)) if (!
|
|
664
|
+
for (let [t, i] of Object.entries(e)) if (!de.has(t)) {
|
|
644
665
|
if (r) {
|
|
645
666
|
let e = r[t];
|
|
646
667
|
if (!e) continue;
|
|
647
668
|
let n = String(e.type || "").toLowerCase();
|
|
648
|
-
if (
|
|
669
|
+
if (fe.has(n) || e.computed === !0 || e.formula || e.readOnly === !0 || e.readonly === !0) continue;
|
|
649
670
|
}
|
|
650
671
|
n[t] = i;
|
|
651
672
|
}
|
|
@@ -653,12 +674,12 @@ function fe(e, t) {
|
|
|
653
674
|
}
|
|
654
675
|
//#endregion
|
|
655
676
|
//#region src/DrawerForm.tsx
|
|
656
|
-
var
|
|
677
|
+
var me = {
|
|
657
678
|
1: void 0,
|
|
658
679
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
659
680
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
660
681
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
661
|
-
},
|
|
682
|
+
}, he = ({ schema: e, dataSource: r, className: o }) => {
|
|
662
683
|
let { fieldLabel: u } = c(), [d, p] = a(null), [m, h] = a([]), [g, _] = a({}), [v, y] = a(!0), [b, x] = a(null), S = e.open !== !1, C = e.drawerSide || "right", [w, T] = a(() => {
|
|
663
684
|
let t = {};
|
|
664
685
|
return e.sections?.forEach((e, n) => {
|
|
@@ -780,7 +801,7 @@ var pe = {
|
|
|
780
801
|
let M = t(async (t) => {
|
|
781
802
|
if (!r) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
|
|
782
803
|
try {
|
|
783
|
-
let n, i =
|
|
804
|
+
let n, i = pe(t, d);
|
|
784
805
|
return e.mode === "create" ? n = await r.create(e.objectName, i) : e.mode === "edit" && e.recordId && (n = await r.update(e.objectName, e.recordId, i)), e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
|
|
785
806
|
} catch (t) {
|
|
786
807
|
throw e.onError && e.onError(t), t;
|
|
@@ -810,29 +831,29 @@ var pe = {
|
|
|
810
831
|
onSubmit: M,
|
|
811
832
|
onCancel: N
|
|
812
833
|
};
|
|
813
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ W(D, {
|
|
814
835
|
open: S,
|
|
815
836
|
onOpenChange: e.onOpenChange,
|
|
816
|
-
children: /* @__PURE__ */
|
|
837
|
+
children: /* @__PURE__ */ G(O, {
|
|
817
838
|
side: C,
|
|
818
839
|
className: L("overflow-y-auto", o, e.className),
|
|
819
840
|
style: P,
|
|
820
|
-
children: [(e.title || e.description) && /* @__PURE__ */
|
|
841
|
+
children: [(e.title || e.description) && /* @__PURE__ */ G(A, { children: [e.title && /* @__PURE__ */ W(j, { children: e.title }), e.description && /* @__PURE__ */ W(k, { children: e.description })] }), /* @__PURE__ */ W("div", {
|
|
821
842
|
className: "@container py-4",
|
|
822
843
|
children: (() => {
|
|
823
|
-
if (b) return /* @__PURE__ */
|
|
844
|
+
if (b) return /* @__PURE__ */ G("div", {
|
|
824
845
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
825
|
-
children: [/* @__PURE__ */
|
|
846
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
826
847
|
className: "text-red-800 font-semibold",
|
|
827
848
|
children: "Error loading form"
|
|
828
|
-
}), /* @__PURE__ */
|
|
849
|
+
}), /* @__PURE__ */ W("p", {
|
|
829
850
|
className: "text-red-600 text-sm mt-1",
|
|
830
851
|
children: b.message
|
|
831
852
|
})]
|
|
832
853
|
});
|
|
833
|
-
if (v) return /* @__PURE__ */
|
|
854
|
+
if (v) return /* @__PURE__ */ G("div", {
|
|
834
855
|
className: "p-8 text-center",
|
|
835
|
-
children: [/* @__PURE__ */
|
|
856
|
+
children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
|
|
836
857
|
className: "mt-2 text-sm text-gray-600",
|
|
837
858
|
children: "Loading form..."
|
|
838
859
|
})]
|
|
@@ -858,13 +879,13 @@ var pe = {
|
|
|
858
879
|
...e,
|
|
859
880
|
hidden: !0
|
|
860
881
|
}))) : t.push(...a);
|
|
861
|
-
}), /* @__PURE__ */
|
|
882
|
+
}), /* @__PURE__ */ W(s, { schema: {
|
|
862
883
|
...F,
|
|
863
884
|
fields: t
|
|
864
885
|
} });
|
|
865
886
|
}
|
|
866
|
-
let t =
|
|
867
|
-
return /* @__PURE__ */
|
|
887
|
+
let t = $(m, d, e.columns, e.mode), n = me[t.columns || 1];
|
|
888
|
+
return /* @__PURE__ */ W(s, { schema: {
|
|
868
889
|
...F,
|
|
869
890
|
fields: t.fields,
|
|
870
891
|
columns: t.columns,
|
|
@@ -874,70 +895,89 @@ var pe = {
|
|
|
874
895
|
})]
|
|
875
896
|
})
|
|
876
897
|
});
|
|
877
|
-
},
|
|
898
|
+
}, ge = {
|
|
878
899
|
sm: "sm:max-w-sm",
|
|
879
900
|
default: "sm:max-w-lg",
|
|
880
901
|
lg: "sm:max-w-2xl",
|
|
881
902
|
xl: "sm:max-w-5xl",
|
|
882
903
|
full: "sm:max-w-[95vw] sm:w-full"
|
|
883
|
-
},
|
|
904
|
+
}, _e = {
|
|
884
905
|
1: void 0,
|
|
885
906
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
886
907
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
887
908
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
888
|
-
},
|
|
889
|
-
let { fieldLabel: d } = c(),
|
|
890
|
-
|
|
909
|
+
}, ve = ({ schema: e, dataSource: o, className: u }) => {
|
|
910
|
+
let { fieldLabel: d } = c(), m = z(), h = t((t) => {
|
|
911
|
+
if (!m?.isLoaded) return t;
|
|
912
|
+
let n = [];
|
|
913
|
+
for (let r of t) {
|
|
914
|
+
if (!r?.name) {
|
|
915
|
+
n.push(r);
|
|
916
|
+
continue;
|
|
917
|
+
}
|
|
918
|
+
m.checkField(e.objectName, r.name, "read") && (!m.checkField(e.objectName, r.name, "write") && e.mode !== "view" ? n.push({
|
|
919
|
+
...r,
|
|
920
|
+
readOnly: !0,
|
|
921
|
+
disabled: !0
|
|
922
|
+
}) : n.push(r));
|
|
923
|
+
}
|
|
924
|
+
return n;
|
|
925
|
+
}, [
|
|
891
926
|
m,
|
|
927
|
+
e.objectName,
|
|
928
|
+
e.mode
|
|
929
|
+
]), [g, _] = a(null), [v, w] = a([]), [T, E] = a({}), [D, O] = a(!0), [k, A] = a(null), [j, N] = a(!1), P = e.open !== !1, F = r(), I = i(() => e.sections?.length || e.customFields?.length ? null : $(v, g, e.columns, e.mode), [
|
|
930
|
+
v,
|
|
931
|
+
g,
|
|
892
932
|
e.columns,
|
|
893
933
|
e.mode,
|
|
894
934
|
e.sections,
|
|
895
935
|
e.customFields
|
|
896
|
-
]),
|
|
936
|
+
]), R = ge[i(() => {
|
|
897
937
|
if (e.modalSize) return e.modalSize;
|
|
898
|
-
if (
|
|
938
|
+
if (I?.columns && I.columns > 1) return ue(I.columns);
|
|
899
939
|
if (e.sections?.length) {
|
|
900
940
|
let t = Math.max(...e.sections.map((e) => Number(e.columns) || 1));
|
|
901
|
-
if (t > 1) return
|
|
941
|
+
if (t > 1) return ue(t);
|
|
902
942
|
}
|
|
903
943
|
return "default";
|
|
904
944
|
}, [
|
|
905
945
|
e.modalSize,
|
|
906
|
-
|
|
946
|
+
I,
|
|
907
947
|
e.sections
|
|
908
|
-
])] ||
|
|
948
|
+
])] || ge.default;
|
|
909
949
|
n(() => {
|
|
910
950
|
(async () => {
|
|
911
951
|
if (!o) {
|
|
912
|
-
|
|
952
|
+
O(!1);
|
|
913
953
|
return;
|
|
914
954
|
}
|
|
915
955
|
try {
|
|
916
|
-
|
|
956
|
+
_(await o.getObjectSchema(e.objectName));
|
|
917
957
|
} catch (e) {
|
|
918
|
-
|
|
958
|
+
A(e), O(!1);
|
|
919
959
|
}
|
|
920
960
|
})();
|
|
921
961
|
}, [e.objectName, o]), n(() => {
|
|
922
|
-
(
|
|
962
|
+
(g || !o) && (async () => {
|
|
923
963
|
if (e.mode === "create" || !e.recordId) {
|
|
924
|
-
|
|
964
|
+
E(e.initialData || e.initialValues || {}), O(!1);
|
|
925
965
|
return;
|
|
926
966
|
}
|
|
927
967
|
if (!o) {
|
|
928
|
-
|
|
968
|
+
E(e.initialData || e.initialValues || {}), O(!1);
|
|
929
969
|
return;
|
|
930
970
|
}
|
|
931
971
|
try {
|
|
932
|
-
|
|
972
|
+
E(await o.findOne(e.objectName, e.recordId) || {});
|
|
933
973
|
} catch (e) {
|
|
934
|
-
|
|
974
|
+
A(e);
|
|
935
975
|
} finally {
|
|
936
|
-
|
|
976
|
+
O(!1);
|
|
937
977
|
}
|
|
938
978
|
})();
|
|
939
979
|
}, [
|
|
940
|
-
|
|
980
|
+
g,
|
|
941
981
|
e.mode,
|
|
942
982
|
e.recordId,
|
|
943
983
|
e.initialData,
|
|
@@ -945,13 +985,13 @@ var pe = {
|
|
|
945
985
|
o,
|
|
946
986
|
e.objectName
|
|
947
987
|
]);
|
|
948
|
-
let
|
|
988
|
+
let B = t((t) => {
|
|
949
989
|
let n = [];
|
|
950
990
|
for (let r of t.fields) {
|
|
951
991
|
let t = typeof r == "string" ? r : r.name;
|
|
952
992
|
if (typeof r == "object") n.push(r);
|
|
953
|
-
else if (
|
|
954
|
-
let r =
|
|
993
|
+
else if (g?.fields?.[t]) {
|
|
994
|
+
let r = g.fields[t];
|
|
955
995
|
n.push({
|
|
956
996
|
name: t,
|
|
957
997
|
label: d(e.objectName, t, r.label || t),
|
|
@@ -973,26 +1013,26 @@ var pe = {
|
|
|
973
1013
|
}
|
|
974
1014
|
return n;
|
|
975
1015
|
}, [
|
|
976
|
-
|
|
1016
|
+
g,
|
|
977
1017
|
e.readOnly,
|
|
978
1018
|
e.mode
|
|
979
1019
|
]);
|
|
980
1020
|
n(() => {
|
|
981
|
-
if (!
|
|
1021
|
+
if (!g && o) return;
|
|
982
1022
|
if (e.customFields?.length) {
|
|
983
|
-
|
|
1023
|
+
w(e.customFields), O(!1);
|
|
984
1024
|
return;
|
|
985
1025
|
}
|
|
986
1026
|
if (e.sections?.length) {
|
|
987
|
-
|
|
1027
|
+
O(!1);
|
|
988
1028
|
return;
|
|
989
1029
|
}
|
|
990
|
-
if (!
|
|
991
|
-
let t = e.fields || Object.keys(
|
|
1030
|
+
if (!g) return;
|
|
1031
|
+
let t = e.fields || Object.keys(g.fields || {}), n = [];
|
|
992
1032
|
for (let r of t) {
|
|
993
1033
|
let t = typeof r == "string" ? r : r.name;
|
|
994
1034
|
if (!t) continue;
|
|
995
|
-
let i =
|
|
1035
|
+
let i = g.fields?.[t];
|
|
996
1036
|
i && n.push({
|
|
997
1037
|
name: t,
|
|
998
1038
|
label: d(e.objectName, t, i.label || t),
|
|
@@ -1007,9 +1047,9 @@ var pe = {
|
|
|
1007
1047
|
multiple: i.multiple
|
|
1008
1048
|
});
|
|
1009
1049
|
}
|
|
1010
|
-
|
|
1050
|
+
w(n), O(!1);
|
|
1011
1051
|
}, [
|
|
1012
|
-
|
|
1052
|
+
g,
|
|
1013
1053
|
e.fields,
|
|
1014
1054
|
e.customFields,
|
|
1015
1055
|
e.sections,
|
|
@@ -1017,239 +1057,274 @@ var pe = {
|
|
|
1017
1057
|
e.mode,
|
|
1018
1058
|
o
|
|
1019
1059
|
]);
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1060
|
+
let ee = t(async (t) => {
|
|
1061
|
+
N(!0);
|
|
1022
1062
|
try {
|
|
1023
1063
|
if (!o) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
|
|
1024
|
-
let n, r =
|
|
1064
|
+
let n, r = pe(t, g);
|
|
1065
|
+
if (m?.isLoaded) {
|
|
1066
|
+
let t = {};
|
|
1067
|
+
for (let n of Object.keys(r)) m.checkField(e.objectName, n, "write") && (t[n] = r[n]);
|
|
1068
|
+
r = t;
|
|
1069
|
+
}
|
|
1025
1070
|
return e.mode === "create" ? n = await o.create(e.objectName, r) : e.mode === "edit" && e.recordId && (n = await o.update(e.objectName, e.recordId, r)), e.onSuccess && await e.onSuccess(n), e.onOpenChange?.(!1), n;
|
|
1026
1071
|
} catch (t) {
|
|
1027
1072
|
throw e.onError && e.onError(t), t;
|
|
1028
1073
|
} finally {
|
|
1029
|
-
|
|
1074
|
+
N(!1);
|
|
1030
1075
|
}
|
|
1031
1076
|
}, [
|
|
1032
1077
|
e,
|
|
1033
1078
|
o,
|
|
1079
|
+
g,
|
|
1034
1080
|
m
|
|
1035
|
-
]),
|
|
1081
|
+
]), V = t(() => {
|
|
1036
1082
|
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
1037
|
-
}, [e]),
|
|
1083
|
+
}, [e]), H = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical", U = e.showSubmit !== !1 && e.mode !== "view", q = e.showCancel !== !1, J = e.submitText || (e.mode === "create" ? "Create" : "Update"), Y = e.cancelText || "Cancel", X = {
|
|
1038
1084
|
type: "form",
|
|
1039
|
-
layout:
|
|
1040
|
-
defaultValues:
|
|
1041
|
-
submitLabel:
|
|
1042
|
-
cancelLabel:
|
|
1043
|
-
showSubmit:
|
|
1044
|
-
showCancel:
|
|
1045
|
-
onSubmit:
|
|
1046
|
-
onCancel:
|
|
1085
|
+
layout: H,
|
|
1086
|
+
defaultValues: T,
|
|
1087
|
+
submitLabel: J,
|
|
1088
|
+
cancelLabel: Y,
|
|
1089
|
+
showSubmit: U,
|
|
1090
|
+
showCancel: q,
|
|
1091
|
+
onSubmit: ee,
|
|
1092
|
+
onCancel: V,
|
|
1047
1093
|
showActions: !1,
|
|
1048
|
-
id:
|
|
1049
|
-
},
|
|
1050
|
-
if (
|
|
1094
|
+
id: F
|
|
1095
|
+
}, ne = () => {
|
|
1096
|
+
if (k) return /* @__PURE__ */ G("div", {
|
|
1051
1097
|
className: "p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1052
|
-
children: [/* @__PURE__ */
|
|
1098
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
1053
1099
|
className: "text-red-800 font-semibold",
|
|
1054
1100
|
children: "Error loading form"
|
|
1055
|
-
}), /* @__PURE__ */
|
|
1101
|
+
}), /* @__PURE__ */ W("p", {
|
|
1056
1102
|
className: "text-red-600 text-sm mt-1",
|
|
1057
|
-
children:
|
|
1103
|
+
children: k.message
|
|
1058
1104
|
})]
|
|
1059
1105
|
});
|
|
1060
|
-
if (
|
|
1106
|
+
if (D) return /* @__PURE__ */ W("div", {
|
|
1061
1107
|
className: "space-y-4",
|
|
1062
1108
|
"data-testid": "modal-form-skeleton",
|
|
1063
1109
|
children: [
|
|
1064
1110
|
1,
|
|
1065
1111
|
2,
|
|
1066
1112
|
3
|
|
1067
|
-
].map((e) => /* @__PURE__ */
|
|
1113
|
+
].map((e) => /* @__PURE__ */ G("div", {
|
|
1068
1114
|
className: "space-y-2",
|
|
1069
|
-
children: [/* @__PURE__ */
|
|
1115
|
+
children: [/* @__PURE__ */ W(M, { className: "h-4 w-24" }), /* @__PURE__ */ W(M, { className: "h-10 w-full" })]
|
|
1070
1116
|
}, e))
|
|
1071
1117
|
});
|
|
1072
|
-
if (e.sections?.length) return /* @__PURE__ */
|
|
1118
|
+
if (e.sections?.length) return /* @__PURE__ */ W("div", {
|
|
1073
1119
|
className: "space-y-6",
|
|
1074
1120
|
children: e.sections.map((e, t) => {
|
|
1075
1121
|
let n = e.columns || 1;
|
|
1076
|
-
return /* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ W(K, {
|
|
1077
1123
|
label: e.label,
|
|
1078
1124
|
description: e.description,
|
|
1079
1125
|
columns: n,
|
|
1080
|
-
gridClassName:
|
|
1081
|
-
children: /* @__PURE__ */
|
|
1082
|
-
...
|
|
1083
|
-
fields:
|
|
1126
|
+
gridClassName: _e[n],
|
|
1127
|
+
children: /* @__PURE__ */ W(s, { schema: {
|
|
1128
|
+
...X,
|
|
1129
|
+
fields: h(B(e))
|
|
1084
1130
|
} })
|
|
1085
1131
|
}, e.name || e.label || t);
|
|
1086
1132
|
})
|
|
1087
1133
|
});
|
|
1088
|
-
let t =
|
|
1089
|
-
return /* @__PURE__ */
|
|
1090
|
-
...
|
|
1091
|
-
fields: t.fields,
|
|
1134
|
+
let t = I ?? $(v, g, e.columns, e.mode), n = _e[t.columns || 1];
|
|
1135
|
+
return /* @__PURE__ */ W(s, { schema: {
|
|
1136
|
+
...X,
|
|
1137
|
+
fields: h(t.fields),
|
|
1092
1138
|
columns: t.columns,
|
|
1093
1139
|
...n ? { fieldContainerClass: n } : {}
|
|
1094
1140
|
} });
|
|
1095
|
-
},
|
|
1096
|
-
return /* @__PURE__ */
|
|
1097
|
-
open:
|
|
1141
|
+
}, re = !D && !k && (U || q);
|
|
1142
|
+
return /* @__PURE__ */ W(y, {
|
|
1143
|
+
open: P,
|
|
1098
1144
|
onOpenChange: e.onOpenChange,
|
|
1099
|
-
children: /* @__PURE__ */
|
|
1100
|
-
className: L(
|
|
1145
|
+
children: /* @__PURE__ */ G(C, {
|
|
1146
|
+
className: L(R, "flex flex-col h-[100dvh] sm:h-auto sm:max-h-[90vh] overflow-hidden p-0", u, e.className),
|
|
1101
1147
|
children: [
|
|
1102
|
-
(e.title || e.description) && /* @__PURE__ */
|
|
1148
|
+
(e.title || e.description) && /* @__PURE__ */ G(x, {
|
|
1103
1149
|
className: "shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 pb-2 border-b",
|
|
1104
|
-
children: [e.title && /* @__PURE__ */
|
|
1150
|
+
children: [e.title && /* @__PURE__ */ W(S, { children: e.title }), e.description && /* @__PURE__ */ W(b, { children: e.description })]
|
|
1105
1151
|
}),
|
|
1106
|
-
/* @__PURE__ */
|
|
1152
|
+
/* @__PURE__ */ W("div", {
|
|
1107
1153
|
className: "@container flex-1 overflow-y-auto px-4 sm:px-6 py-4",
|
|
1108
|
-
children:
|
|
1154
|
+
children: ne()
|
|
1109
1155
|
}),
|
|
1110
|
-
|
|
1156
|
+
re && /* @__PURE__ */ W("div", {
|
|
1111
1157
|
className: "shrink-0 border-t px-4 sm:px-6 py-3 bg-background",
|
|
1112
1158
|
"data-testid": "modal-form-footer",
|
|
1113
|
-
children: /* @__PURE__ */
|
|
1159
|
+
children: /* @__PURE__ */ G("div", {
|
|
1114
1160
|
className: "flex flex-col sm:flex-row gap-2 sm:justify-end",
|
|
1115
|
-
children: [
|
|
1161
|
+
children: [q && /* @__PURE__ */ W(p, {
|
|
1116
1162
|
type: "button",
|
|
1117
1163
|
variant: "outline",
|
|
1118
|
-
onClick:
|
|
1119
|
-
disabled:
|
|
1164
|
+
onClick: V,
|
|
1165
|
+
disabled: j,
|
|
1120
1166
|
className: "w-full sm:w-auto",
|
|
1121
|
-
children:
|
|
1122
|
-
}),
|
|
1167
|
+
children: Y
|
|
1168
|
+
}), U && /* @__PURE__ */ G(p, {
|
|
1123
1169
|
type: "submit",
|
|
1124
|
-
form:
|
|
1125
|
-
disabled:
|
|
1170
|
+
form: F,
|
|
1171
|
+
disabled: j,
|
|
1126
1172
|
className: "w-full sm:w-auto",
|
|
1127
|
-
children: [
|
|
1173
|
+
children: [j && /* @__PURE__ */ W(te, { className: "mr-2 h-4 w-4 animate-spin" }), J]
|
|
1128
1174
|
})]
|
|
1129
1175
|
})
|
|
1130
1176
|
})
|
|
1131
1177
|
]
|
|
1132
1178
|
})
|
|
1133
1179
|
});
|
|
1134
|
-
},
|
|
1135
|
-
let
|
|
1136
|
-
|
|
1137
|
-
|
|
1180
|
+
}, ye = ({ schema: e, dataSource: t }) => {
|
|
1181
|
+
let n = z(), r = i(() => {
|
|
1182
|
+
if (!n?.isLoaded) return e;
|
|
1183
|
+
let t = (t) => t?.name ? n.checkField(e.objectName, t.name, "read") ? !n.checkField(e.objectName, t.name, "write") && e.mode !== "view" ? {
|
|
1184
|
+
...t,
|
|
1185
|
+
readOnly: !0,
|
|
1186
|
+
disabled: !0
|
|
1187
|
+
} : t : null : t, r = (e) => Array.isArray(e) ? e.map(t).filter(Boolean) : e;
|
|
1188
|
+
return {
|
|
1138
1189
|
...e,
|
|
1190
|
+
fields: r(e.fields),
|
|
1191
|
+
sections: e.sections?.map((e) => ({
|
|
1192
|
+
...e,
|
|
1193
|
+
fields: r(e.fields)
|
|
1194
|
+
}))
|
|
1195
|
+
};
|
|
1196
|
+
}, [e, n]), { sectionLabel: a } = c(), o = (e) => e?.name ? a(r.objectName, e.name, e.label || e.name) : e?.label;
|
|
1197
|
+
if (r.formType === "tabbed" && r.sections?.length) return /* @__PURE__ */ W(q, {
|
|
1198
|
+
schema: {
|
|
1199
|
+
...r,
|
|
1139
1200
|
formType: "tabbed",
|
|
1140
|
-
sections:
|
|
1201
|
+
sections: r.sections.map((e) => ({
|
|
1141
1202
|
name: e.name,
|
|
1142
|
-
label:
|
|
1203
|
+
label: o(e),
|
|
1143
1204
|
description: e.description,
|
|
1144
1205
|
columns: e.columns,
|
|
1145
1206
|
fields: e.fields
|
|
1146
1207
|
})),
|
|
1147
|
-
defaultTab:
|
|
1148
|
-
tabPosition:
|
|
1208
|
+
defaultTab: r.defaultTab,
|
|
1209
|
+
tabPosition: r.tabPosition
|
|
1149
1210
|
},
|
|
1150
1211
|
dataSource: t,
|
|
1151
|
-
className:
|
|
1212
|
+
className: r.className
|
|
1152
1213
|
});
|
|
1153
|
-
if (
|
|
1214
|
+
if (r.formType === "wizard" && r.sections?.length) return /* @__PURE__ */ W(J, {
|
|
1154
1215
|
schema: {
|
|
1155
|
-
...
|
|
1216
|
+
...r,
|
|
1156
1217
|
formType: "wizard",
|
|
1157
|
-
sections:
|
|
1218
|
+
sections: r.sections.map((e) => ({
|
|
1158
1219
|
name: e.name,
|
|
1159
|
-
label:
|
|
1220
|
+
label: o(e),
|
|
1160
1221
|
description: e.description,
|
|
1161
1222
|
columns: e.columns,
|
|
1162
1223
|
fields: e.fields
|
|
1163
1224
|
})),
|
|
1164
|
-
allowSkip:
|
|
1165
|
-
showStepIndicator:
|
|
1166
|
-
nextText:
|
|
1167
|
-
prevText:
|
|
1168
|
-
onStepChange:
|
|
1225
|
+
allowSkip: r.allowSkip,
|
|
1226
|
+
showStepIndicator: r.showStepIndicator,
|
|
1227
|
+
nextText: r.nextText,
|
|
1228
|
+
prevText: r.prevText,
|
|
1229
|
+
onStepChange: r.onStepChange
|
|
1169
1230
|
},
|
|
1170
1231
|
dataSource: t,
|
|
1171
|
-
className:
|
|
1232
|
+
className: r.className
|
|
1172
1233
|
});
|
|
1173
|
-
if (
|
|
1234
|
+
if (r.formType === "split" && r.sections?.length) return /* @__PURE__ */ W(Y, {
|
|
1174
1235
|
schema: {
|
|
1175
|
-
...
|
|
1236
|
+
...r,
|
|
1176
1237
|
formType: "split",
|
|
1177
|
-
sections:
|
|
1238
|
+
sections: r.sections.map((e) => ({
|
|
1178
1239
|
name: e.name,
|
|
1179
|
-
label:
|
|
1240
|
+
label: o(e),
|
|
1180
1241
|
description: e.description,
|
|
1181
1242
|
columns: e.columns,
|
|
1182
1243
|
fields: e.fields
|
|
1183
1244
|
})),
|
|
1184
|
-
splitDirection:
|
|
1185
|
-
splitSize:
|
|
1186
|
-
splitResizable:
|
|
1245
|
+
splitDirection: r.splitDirection,
|
|
1246
|
+
splitSize: r.splitSize,
|
|
1247
|
+
splitResizable: r.splitResizable
|
|
1187
1248
|
},
|
|
1188
1249
|
dataSource: t,
|
|
1189
|
-
className:
|
|
1250
|
+
className: r.className
|
|
1190
1251
|
});
|
|
1191
|
-
if (
|
|
1192
|
-
let { layout:
|
|
1193
|
-
return /* @__PURE__ */
|
|
1252
|
+
if (r.formType === "drawer") {
|
|
1253
|
+
let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
|
|
1254
|
+
return /* @__PURE__ */ W(he, {
|
|
1194
1255
|
schema: {
|
|
1195
|
-
...
|
|
1196
|
-
layout:
|
|
1256
|
+
...n,
|
|
1257
|
+
layout: i,
|
|
1197
1258
|
formType: "drawer",
|
|
1198
|
-
sections:
|
|
1259
|
+
sections: r.sections?.map((e) => ({
|
|
1199
1260
|
name: e.name,
|
|
1200
|
-
label:
|
|
1261
|
+
label: o(e),
|
|
1201
1262
|
description: e.description,
|
|
1202
1263
|
columns: e.columns,
|
|
1203
1264
|
fields: e.fields,
|
|
1204
1265
|
collapsible: e.collapsible,
|
|
1205
1266
|
collapsed: e.collapsed
|
|
1206
1267
|
})),
|
|
1207
|
-
open:
|
|
1208
|
-
onOpenChange:
|
|
1209
|
-
drawerSide:
|
|
1210
|
-
drawerWidth:
|
|
1268
|
+
open: r.open,
|
|
1269
|
+
onOpenChange: r.onOpenChange,
|
|
1270
|
+
drawerSide: r.drawerSide,
|
|
1271
|
+
drawerWidth: r.drawerWidth
|
|
1211
1272
|
},
|
|
1212
1273
|
dataSource: t,
|
|
1213
|
-
className:
|
|
1274
|
+
className: r.className
|
|
1214
1275
|
});
|
|
1215
1276
|
}
|
|
1216
|
-
if (
|
|
1217
|
-
let { layout:
|
|
1218
|
-
return /* @__PURE__ */
|
|
1277
|
+
if (r.formType === "modal") {
|
|
1278
|
+
let { layout: e, ...n } = r, i = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : void 0;
|
|
1279
|
+
return /* @__PURE__ */ W(ve, {
|
|
1219
1280
|
schema: {
|
|
1220
|
-
...
|
|
1221
|
-
layout:
|
|
1281
|
+
...n,
|
|
1282
|
+
layout: i,
|
|
1222
1283
|
formType: "modal",
|
|
1223
|
-
sections:
|
|
1284
|
+
sections: r.sections?.map((e) => ({
|
|
1224
1285
|
name: e.name,
|
|
1225
|
-
label:
|
|
1286
|
+
label: o(e),
|
|
1226
1287
|
description: e.description,
|
|
1227
1288
|
columns: e.columns,
|
|
1228
1289
|
fields: e.fields
|
|
1229
1290
|
})),
|
|
1230
|
-
open:
|
|
1231
|
-
onOpenChange:
|
|
1232
|
-
modalSize:
|
|
1233
|
-
modalCloseButton:
|
|
1291
|
+
open: r.open,
|
|
1292
|
+
onOpenChange: r.onOpenChange,
|
|
1293
|
+
modalSize: r.modalSize,
|
|
1294
|
+
modalCloseButton: r.modalCloseButton
|
|
1234
1295
|
},
|
|
1235
1296
|
dataSource: t,
|
|
1236
|
-
className:
|
|
1297
|
+
className: r.className
|
|
1237
1298
|
});
|
|
1238
1299
|
}
|
|
1239
|
-
return /* @__PURE__ */
|
|
1240
|
-
schema:
|
|
1300
|
+
return /* @__PURE__ */ W(be, {
|
|
1301
|
+
schema: r,
|
|
1241
1302
|
dataSource: t
|
|
1242
1303
|
});
|
|
1243
|
-
},
|
|
1244
|
-
let { fieldLabel: o, sectionLabel: p } = c(), m = R(),
|
|
1304
|
+
}, be = ({ schema: r, dataSource: i }) => {
|
|
1305
|
+
let { fieldLabel: o, sectionLabel: p } = c(), m = R(), h = z(), g = t((e) => {
|
|
1306
|
+
if (!h?.isLoaded) return e;
|
|
1307
|
+
let t = [];
|
|
1308
|
+
for (let n of e) h.checkField(r.objectName, n.name, "read") && (!h.checkField(r.objectName, n.name, "write") && r.mode !== "view" ? t.push({
|
|
1309
|
+
...n,
|
|
1310
|
+
readOnly: !0,
|
|
1311
|
+
disabled: !0,
|
|
1312
|
+
description: n.description ?? "You do not have edit access to this field."
|
|
1313
|
+
}) : t.push(n));
|
|
1314
|
+
return t;
|
|
1315
|
+
}, [
|
|
1316
|
+
h,
|
|
1317
|
+
r.objectName,
|
|
1318
|
+
r.mode
|
|
1319
|
+
]), [_, v] = a(null), [y, b] = a([]), [x, S] = a(null), [C, w] = a(!0), [T, E] = a(null), D = r.customFields && r.customFields.length > 0;
|
|
1245
1320
|
n(() => {
|
|
1246
|
-
|
|
1321
|
+
D && (S(r.initialData || r.initialValues || {}), w(!1));
|
|
1247
1322
|
}, [
|
|
1248
|
-
|
|
1323
|
+
D,
|
|
1249
1324
|
r.initialData,
|
|
1250
1325
|
r.initialValues
|
|
1251
1326
|
]), n(() => {
|
|
1252
|
-
|
|
1327
|
+
D ? v({
|
|
1253
1328
|
name: r.objectName,
|
|
1254
1329
|
fields: {}
|
|
1255
1330
|
}) : r.objectName && i ? (async () => {
|
|
@@ -1257,33 +1332,33 @@ var pe = {
|
|
|
1257
1332
|
if (!i) throw Error("DataSource is required when using ObjectQL schema fetching (inline fields not provided)");
|
|
1258
1333
|
let e = await i.getObjectSchema(r.objectName);
|
|
1259
1334
|
if (!e) throw Error(`No schema found for object "${r.objectName}"`);
|
|
1260
|
-
|
|
1335
|
+
v(e);
|
|
1261
1336
|
} catch (e) {
|
|
1262
|
-
|
|
1337
|
+
E(e), w(!1);
|
|
1263
1338
|
}
|
|
1264
|
-
})() :
|
|
1339
|
+
})() : D || w(!1);
|
|
1265
1340
|
}, [
|
|
1266
1341
|
r.objectName,
|
|
1267
1342
|
i,
|
|
1268
|
-
|
|
1343
|
+
D
|
|
1269
1344
|
]), n(() => {
|
|
1270
|
-
|
|
1345
|
+
_ && !D && (async () => {
|
|
1271
1346
|
if (!r.recordId || r.mode === "create") {
|
|
1272
|
-
|
|
1347
|
+
S(r.initialData || r.initialValues || {}), w(!1);
|
|
1273
1348
|
return;
|
|
1274
1349
|
}
|
|
1275
|
-
if (!
|
|
1350
|
+
if (!D) {
|
|
1276
1351
|
if (!i) {
|
|
1277
|
-
|
|
1352
|
+
E(/* @__PURE__ */ Error("DataSource is required for fetching record data (inline data not provided)")), w(!1);
|
|
1278
1353
|
return;
|
|
1279
1354
|
}
|
|
1280
|
-
|
|
1355
|
+
w(!0);
|
|
1281
1356
|
try {
|
|
1282
|
-
|
|
1357
|
+
S(await i.findOne(r.objectName, r.recordId));
|
|
1283
1358
|
} catch (e) {
|
|
1284
|
-
console.error("Failed to fetch record:", e),
|
|
1359
|
+
console.error("Failed to fetch record:", e), E(e);
|
|
1285
1360
|
} finally {
|
|
1286
|
-
|
|
1361
|
+
w(!1);
|
|
1287
1362
|
}
|
|
1288
1363
|
}
|
|
1289
1364
|
})();
|
|
@@ -1294,31 +1369,40 @@ var pe = {
|
|
|
1294
1369
|
r.initialValues,
|
|
1295
1370
|
r.initialData,
|
|
1296
1371
|
i,
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
])
|
|
1300
|
-
|
|
1301
|
-
|
|
1372
|
+
_,
|
|
1373
|
+
D
|
|
1374
|
+
]);
|
|
1375
|
+
let O = t((e) => {
|
|
1376
|
+
if (!e || typeof e.visible == "function") return e;
|
|
1377
|
+
let t = e.visibleOn;
|
|
1378
|
+
return typeof t == "string" && t.trim() ? {
|
|
1379
|
+
...e,
|
|
1380
|
+
visible: (e) => u(t, e)
|
|
1381
|
+
} : e;
|
|
1382
|
+
}, []);
|
|
1383
|
+
n(() => {
|
|
1384
|
+
if (D && r.customFields) {
|
|
1385
|
+
b(r.customFields.map(O)), w(!1);
|
|
1302
1386
|
return;
|
|
1303
1387
|
}
|
|
1304
|
-
if (!
|
|
1305
|
-
let e = [], t = r.fields || Object.keys(
|
|
1388
|
+
if (!_) return;
|
|
1389
|
+
let e = [], t = r.fields || Object.keys(_.fields || {});
|
|
1306
1390
|
(Array.isArray(t) ? t : Object.keys(t)).forEach((t) => {
|
|
1307
1391
|
let n = typeof t == "string" ? t : t.name;
|
|
1308
1392
|
if (!n) return;
|
|
1309
|
-
let i =
|
|
1310
|
-
if (!i && !
|
|
1393
|
+
let i = _.fields?.[n];
|
|
1394
|
+
if (!i && !D) return;
|
|
1311
1395
|
let a = !i?.permissions || i?.permissions.write !== !1;
|
|
1312
1396
|
if (r.mode !== "view" && !a) return;
|
|
1313
1397
|
let s = r.customFields?.find((e) => e.name === n);
|
|
1314
|
-
if (s) e.push(s);
|
|
1398
|
+
if (s) e.push(O(s));
|
|
1315
1399
|
else if (i) {
|
|
1316
1400
|
let a = {
|
|
1317
1401
|
name: n,
|
|
1318
1402
|
label: o(r.objectName, n, i.label || t),
|
|
1319
1403
|
type: f(i.type),
|
|
1320
1404
|
required: i.required || !1,
|
|
1321
|
-
disabled: r.readOnly || r.mode === "view" || i.readonly ||
|
|
1405
|
+
disabled: r.readOnly || r.mode === "view" || i.readonly || _?.managedBy && _.managedBy !== "platform",
|
|
1322
1406
|
placeholder: i.placeholder,
|
|
1323
1407
|
description: i.help || i.description,
|
|
1324
1408
|
validation: l(i),
|
|
@@ -1330,110 +1414,116 @@ var pe = {
|
|
|
1330
1414
|
}
|
|
1331
1415
|
i.type === "email" && (a.inputType = "email"), i.type === "phone" && (a.inputType = "tel"), i.type === "url" && (a.inputType = "url"), i.type === "password" && (a.inputType = "password"), i.type === "time" && (a.inputType = "time"), (i.type === "formula" || i.type === "summary" || i.type === "auto_number") && (a.disabled = !0), i.visible_on && (a.visible = (e) => u(i.visible_on, e)), e.push(a);
|
|
1332
1416
|
}
|
|
1333
|
-
}),
|
|
1417
|
+
}), b(e), !D && r.recordId && r.mode !== "create" && i || w(!1);
|
|
1334
1418
|
}, [
|
|
1335
|
-
|
|
1419
|
+
_,
|
|
1336
1420
|
r.fields,
|
|
1337
1421
|
r.customFields,
|
|
1338
1422
|
r.readOnly,
|
|
1339
1423
|
r.mode,
|
|
1340
|
-
|
|
1424
|
+
D,
|
|
1341
1425
|
r.recordId,
|
|
1342
1426
|
i
|
|
1343
1427
|
]);
|
|
1344
|
-
let
|
|
1345
|
-
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 && (t = e, e = {})),
|
|
1428
|
+
let k = t(async (e, t) => {
|
|
1429
|
+
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 && (t = e, e = {})), D && !i) return r.onSuccess && await r.onSuccess(e), e;
|
|
1346
1430
|
if (!i) throw Error("DataSource is required for form submission (inline mode not configured)");
|
|
1431
|
+
let n = e;
|
|
1432
|
+
if (h?.isLoaded && e && typeof e == "object") {
|
|
1433
|
+
n = {};
|
|
1434
|
+
for (let t of Object.keys(e)) h.checkField(r.objectName, t, "write") && (n[t] = e[t]);
|
|
1435
|
+
}
|
|
1347
1436
|
try {
|
|
1348
|
-
let
|
|
1349
|
-
if (r.mode === "create")
|
|
1350
|
-
else if (r.mode === "edit" && r.recordId)
|
|
1437
|
+
let e;
|
|
1438
|
+
if (r.mode === "create") e = await i.create(r.objectName, n);
|
|
1439
|
+
else if (r.mode === "edit" && r.recordId) e = await i.update(r.objectName, r.recordId, n);
|
|
1351
1440
|
else throw Error("Invalid form mode or missing record ID");
|
|
1352
|
-
return r.onSuccess && await r.onSuccess(
|
|
1441
|
+
return r.onSuccess && await r.onSuccess(e), e;
|
|
1353
1442
|
} catch (e) {
|
|
1354
1443
|
throw console.error("Failed to submit form:", e), r.onError && r.onError(e), e;
|
|
1355
1444
|
}
|
|
1356
1445
|
}, [
|
|
1357
1446
|
r,
|
|
1358
1447
|
i,
|
|
1359
|
-
|
|
1360
|
-
|
|
1448
|
+
D,
|
|
1449
|
+
h
|
|
1450
|
+
]), A = t(() => {
|
|
1361
1451
|
r.onCancel && r.onCancel();
|
|
1362
|
-
}, [r]),
|
|
1452
|
+
}, [r]), j = {
|
|
1363
1453
|
...e.useMemo(() => {
|
|
1364
|
-
if (!
|
|
1454
|
+
if (!_?.fields) return {};
|
|
1365
1455
|
let e = {};
|
|
1366
|
-
return Object.keys(
|
|
1367
|
-
let n =
|
|
1456
|
+
return Object.keys(_.fields).forEach((t) => {
|
|
1457
|
+
let n = _.fields[t];
|
|
1368
1458
|
n.defaultValue !== void 0 && (e[t] = n.defaultValue);
|
|
1369
1459
|
}), e;
|
|
1370
|
-
}, [
|
|
1371
|
-
...
|
|
1460
|
+
}, [_]),
|
|
1461
|
+
...x
|
|
1372
1462
|
};
|
|
1373
|
-
if (
|
|
1463
|
+
if (T) return /* @__PURE__ */ G("div", {
|
|
1374
1464
|
className: "p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md",
|
|
1375
|
-
children: [/* @__PURE__ */
|
|
1465
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
1376
1466
|
className: "text-red-800 font-semibold",
|
|
1377
1467
|
children: "Error loading form"
|
|
1378
|
-
}), /* @__PURE__ */
|
|
1468
|
+
}), /* @__PURE__ */ W("p", {
|
|
1379
1469
|
className: "text-red-600 text-sm mt-1",
|
|
1380
|
-
children:
|
|
1470
|
+
children: T.message
|
|
1381
1471
|
})]
|
|
1382
1472
|
});
|
|
1383
|
-
if (
|
|
1473
|
+
if (C) return /* @__PURE__ */ G("div", {
|
|
1384
1474
|
className: "p-4 sm:p-8 text-center",
|
|
1385
|
-
children: [/* @__PURE__ */
|
|
1475
|
+
children: [/* @__PURE__ */ W("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900" }), /* @__PURE__ */ W("p", {
|
|
1386
1476
|
className: "mt-2 text-sm text-gray-600",
|
|
1387
1477
|
children: "Loading form..."
|
|
1388
1478
|
})]
|
|
1389
1479
|
});
|
|
1390
|
-
let
|
|
1391
|
-
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */
|
|
1480
|
+
let M = r.layout === "vertical" || r.layout === "horizontal" ? r.layout : "vertical";
|
|
1481
|
+
if (r.sections?.length && (!r.formType || r.formType === "simple")) return /* @__PURE__ */ W("div", {
|
|
1392
1482
|
className: "w-full space-y-6",
|
|
1393
1483
|
children: r.sections.map((e, t) => {
|
|
1394
|
-
let n = e.fields.map((e) => typeof e == "string" ? e : e.name), i =
|
|
1395
|
-
return /* @__PURE__ */
|
|
1484
|
+
let n = e.fields.map((e) => typeof e == "string" ? e : e.name), i = g(y.filter((e) => n.includes(e.name)));
|
|
1485
|
+
return /* @__PURE__ */ W(K, {
|
|
1396
1486
|
label: e.name ? p(r.objectName, e.name, e.label || e.name) : e.label,
|
|
1397
1487
|
description: e.description,
|
|
1398
1488
|
collapsible: e.collapsible,
|
|
1399
1489
|
collapsed: e.collapsed,
|
|
1400
1490
|
columns: e.columns,
|
|
1401
|
-
children: /* @__PURE__ */
|
|
1491
|
+
children: /* @__PURE__ */ W(s, { schema: {
|
|
1402
1492
|
type: "form",
|
|
1403
1493
|
fields: i,
|
|
1404
|
-
layout:
|
|
1405
|
-
defaultValues:
|
|
1494
|
+
layout: M,
|
|
1495
|
+
defaultValues: j,
|
|
1406
1496
|
showSubmit: t === r.sections.length - 1 && r.showSubmit !== !1 && r.mode !== "view",
|
|
1407
1497
|
showCancel: t === r.sections.length - 1 && r.showCancel !== !1,
|
|
1408
1498
|
submitLabel: r.submitText || (r.mode === "create" ? "Create" : "Update"),
|
|
1409
1499
|
cancelLabel: r.cancelText,
|
|
1410
|
-
onSubmit:
|
|
1411
|
-
onCancel:
|
|
1500
|
+
onSubmit: k,
|
|
1501
|
+
onCancel: A
|
|
1412
1502
|
} })
|
|
1413
1503
|
}, e.name || e.label || t);
|
|
1414
1504
|
})
|
|
1415
1505
|
});
|
|
1416
|
-
let
|
|
1417
|
-
fields:
|
|
1506
|
+
let N = r.sections?.length, P = g(y), F = N ? {
|
|
1507
|
+
fields: P,
|
|
1418
1508
|
columns: r.columns
|
|
1419
|
-
} :
|
|
1509
|
+
} : $(P, _, r.columns, r.mode), I = r.mobile, L = I?.fullscreenLongText ? F.fields.map((e) => {
|
|
1420
1510
|
let t = e.type;
|
|
1421
1511
|
return t === "textarea" || t === "field:textarea" || t === "string-multiline" || t === "field:markdown" || t === "field:html" ? {
|
|
1422
1512
|
...e,
|
|
1423
1513
|
mobile_fullscreen: !0
|
|
1424
1514
|
} : e;
|
|
1425
|
-
}) :
|
|
1426
|
-
if (!r.formType && !
|
|
1427
|
-
let e =
|
|
1428
|
-
for (let n = 0; n < e.length; n +=
|
|
1429
|
-
let r = e.slice(n, n +
|
|
1515
|
+
}) : F.fields, B = I?.stepper, ee = I?.stepperMinFields ?? 8, V = Math.max(1, I?.stepperFieldsPerStep ?? 1);
|
|
1516
|
+
if (!r.formType && !N && L.length >= 2 && (B === !0 || B === "auto" && m && L.length >= ee)) {
|
|
1517
|
+
let e = L, t = [];
|
|
1518
|
+
for (let n = 0; n < e.length; n += V) {
|
|
1519
|
+
let r = e.slice(n, n + V);
|
|
1430
1520
|
t.push({
|
|
1431
|
-
name: `step-${Math.floor(n /
|
|
1432
|
-
label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n /
|
|
1521
|
+
name: `step-${Math.floor(n / V) + 1}`,
|
|
1522
|
+
label: r[0]?.label || r[0]?.name || `Step ${Math.floor(n / V) + 1}`,
|
|
1433
1523
|
fields: r
|
|
1434
1524
|
});
|
|
1435
1525
|
}
|
|
1436
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ W(J, {
|
|
1437
1527
|
schema: {
|
|
1438
1528
|
...r,
|
|
1439
1529
|
formType: "wizard",
|
|
@@ -1444,28 +1534,28 @@ var pe = {
|
|
|
1444
1534
|
className: r.className
|
|
1445
1535
|
});
|
|
1446
1536
|
}
|
|
1447
|
-
let
|
|
1537
|
+
let H = {
|
|
1448
1538
|
type: "form",
|
|
1449
|
-
fields:
|
|
1450
|
-
layout:
|
|
1451
|
-
columns:
|
|
1539
|
+
fields: L,
|
|
1540
|
+
layout: M,
|
|
1541
|
+
columns: F.columns,
|
|
1452
1542
|
submitLabel: r.submitText || (r.mode === "create" ? "Create" : "Update"),
|
|
1453
1543
|
cancelLabel: r.cancelText,
|
|
1454
1544
|
showSubmit: r.showSubmit !== !1 && r.mode !== "view",
|
|
1455
1545
|
showCancel: r.showCancel !== !1,
|
|
1456
1546
|
resetOnSubmit: r.showReset,
|
|
1457
|
-
defaultValues:
|
|
1458
|
-
onSubmit:
|
|
1459
|
-
onCancel:
|
|
1547
|
+
defaultValues: j,
|
|
1548
|
+
onSubmit: k,
|
|
1549
|
+
onCancel: A,
|
|
1460
1550
|
className: r.className,
|
|
1461
|
-
mobileStickyActions: !!
|
|
1551
|
+
mobileStickyActions: !!I?.stickyActions
|
|
1462
1552
|
};
|
|
1463
|
-
return /* @__PURE__ */
|
|
1464
|
-
className:
|
|
1465
|
-
"data-mobile-form":
|
|
1466
|
-
children: /* @__PURE__ */
|
|
1553
|
+
return /* @__PURE__ */ W("div", {
|
|
1554
|
+
className: I?.stickyActions ? "w-full pb-20 md:pb-0" : "w-full",
|
|
1555
|
+
"data-mobile-form": I ? "true" : void 0,
|
|
1556
|
+
children: /* @__PURE__ */ W(s, { schema: H })
|
|
1467
1557
|
});
|
|
1468
|
-
},
|
|
1558
|
+
}, xe = ({ config: e, dataSource: n, prefillParams: r, className: o }) => {
|
|
1469
1559
|
let [s, c] = a(!1), [l, u] = a(!1), [d, f] = a(null), p = i(() => {
|
|
1470
1560
|
let e = {};
|
|
1471
1561
|
if (r) for (let [t, n] of Object.entries(r)) e[t] = n;
|
|
@@ -1494,30 +1584,30 @@ var pe = {
|
|
|
1494
1584
|
}, [e.branding]);
|
|
1495
1585
|
if (s) {
|
|
1496
1586
|
let t = e.thankYouPage;
|
|
1497
|
-
return /* @__PURE__ */
|
|
1587
|
+
return /* @__PURE__ */ W("div", {
|
|
1498
1588
|
className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
|
|
1499
1589
|
style: g,
|
|
1500
|
-
children: /* @__PURE__ */
|
|
1590
|
+
children: /* @__PURE__ */ G("div", {
|
|
1501
1591
|
className: "max-w-md w-full bg-card rounded-lg shadow-lg p-8 text-center space-y-4",
|
|
1502
1592
|
children: [
|
|
1503
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ W("div", {
|
|
1504
1594
|
className: "text-4xl",
|
|
1505
1595
|
children: "✓"
|
|
1506
1596
|
}),
|
|
1507
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ W("h2", {
|
|
1508
1598
|
className: "text-xl font-semibold text-foreground",
|
|
1509
1599
|
children: t?.title || "Thank You!"
|
|
1510
1600
|
}),
|
|
1511
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ W("p", {
|
|
1512
1602
|
className: "text-muted-foreground",
|
|
1513
1603
|
children: t?.message || "Your submission has been received successfully."
|
|
1514
1604
|
}),
|
|
1515
|
-
e.allowMultiple && /* @__PURE__ */
|
|
1605
|
+
e.allowMultiple && /* @__PURE__ */ W("button", {
|
|
1516
1606
|
onClick: h,
|
|
1517
1607
|
className: "mt-4 px-4 py-2 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
1518
1608
|
children: "Submit Another Response"
|
|
1519
1609
|
}),
|
|
1520
|
-
t?.redirectUrl && /* @__PURE__ */
|
|
1610
|
+
t?.redirectUrl && /* @__PURE__ */ G("p", {
|
|
1521
1611
|
className: "text-xs text-muted-foreground",
|
|
1522
1612
|
children: [
|
|
1523
1613
|
"Redirecting in ",
|
|
@@ -1529,37 +1619,37 @@ var pe = {
|
|
|
1529
1619
|
})
|
|
1530
1620
|
});
|
|
1531
1621
|
}
|
|
1532
|
-
return /* @__PURE__ */
|
|
1622
|
+
return /* @__PURE__ */ W("div", {
|
|
1533
1623
|
className: `min-h-screen flex items-center justify-center p-4 ${o || ""}`,
|
|
1534
1624
|
style: g,
|
|
1535
|
-
children: /* @__PURE__ */
|
|
1625
|
+
children: /* @__PURE__ */ G("div", {
|
|
1536
1626
|
className: "max-w-2xl w-full bg-card rounded-lg shadow-lg overflow-hidden",
|
|
1537
1627
|
children: [
|
|
1538
|
-
/* @__PURE__ */
|
|
1628
|
+
/* @__PURE__ */ G("div", {
|
|
1539
1629
|
className: "p-6 border-b",
|
|
1540
1630
|
style: e.branding?.primaryColor ? { borderBottomColor: e.branding.primaryColor } : void 0,
|
|
1541
1631
|
children: [
|
|
1542
|
-
e.branding?.logo && /* @__PURE__ */
|
|
1632
|
+
e.branding?.logo && /* @__PURE__ */ W("img", {
|
|
1543
1633
|
src: e.branding.logo,
|
|
1544
1634
|
alt: "Logo",
|
|
1545
1635
|
className: "h-8 mb-4"
|
|
1546
1636
|
}),
|
|
1547
|
-
e.title && /* @__PURE__ */
|
|
1637
|
+
e.title && /* @__PURE__ */ W("h1", {
|
|
1548
1638
|
className: "text-xl font-semibold text-foreground",
|
|
1549
1639
|
children: e.title
|
|
1550
1640
|
}),
|
|
1551
|
-
e.description && /* @__PURE__ */
|
|
1641
|
+
e.description && /* @__PURE__ */ W("p", {
|
|
1552
1642
|
className: "text-sm text-muted-foreground mt-1",
|
|
1553
1643
|
children: e.description
|
|
1554
1644
|
})
|
|
1555
1645
|
]
|
|
1556
1646
|
}),
|
|
1557
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ G("div", {
|
|
1558
1648
|
className: "p-6",
|
|
1559
|
-
children: [d && /* @__PURE__ */
|
|
1649
|
+
children: [d && /* @__PURE__ */ W("div", {
|
|
1560
1650
|
className: "mb-4 p-3 bg-destructive/10 border border-destructive/30 rounded-md text-sm text-destructive",
|
|
1561
1651
|
children: d
|
|
1562
|
-
}), /* @__PURE__ */
|
|
1652
|
+
}), /* @__PURE__ */ W(ye, {
|
|
1563
1653
|
schema: {
|
|
1564
1654
|
type: "object-form",
|
|
1565
1655
|
objectName: e.objectName,
|
|
@@ -1573,9 +1663,9 @@ var pe = {
|
|
|
1573
1663
|
dataSource: n
|
|
1574
1664
|
})]
|
|
1575
1665
|
}),
|
|
1576
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ W("div", {
|
|
1577
1667
|
className: "px-6 py-3 border-t bg-muted/20 text-center",
|
|
1578
|
-
children: /* @__PURE__ */
|
|
1668
|
+
children: /* @__PURE__ */ W("p", {
|
|
1579
1669
|
className: "text-xs text-muted-foreground",
|
|
1580
1670
|
children: "Powered by ObjectStack"
|
|
1581
1671
|
})
|
|
@@ -1586,96 +1676,96 @@ var pe = {
|
|
|
1586
1676
|
};
|
|
1587
1677
|
//#endregion
|
|
1588
1678
|
//#region src/FormAnalytics.tsx
|
|
1589
|
-
function
|
|
1679
|
+
function Se(e) {
|
|
1590
1680
|
return e < 60 ? `${Math.round(e)}s` : e < 3600 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${Math.floor(e / 3600)}h ${Math.floor(e % 3600 / 60)}m`;
|
|
1591
1681
|
}
|
|
1592
|
-
var
|
|
1682
|
+
var Ce = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
1593
1683
|
let a = i(() => {
|
|
1594
1684
|
if (!n.abandonedSubmissions) return 100;
|
|
1595
1685
|
let e = n.totalSubmissions + n.abandonedSubmissions;
|
|
1596
1686
|
return e === 0 ? 0 : Math.round(n.totalSubmissions / e * 100);
|
|
1597
1687
|
}, [n.totalSubmissions, n.abandonedSubmissions]), o = i(() => n.dailySubmissions?.length ? Math.max(...n.dailySubmissions.map((e) => e.count), 1) : 1, [n.dailySubmissions]);
|
|
1598
|
-
return /* @__PURE__ */
|
|
1688
|
+
return /* @__PURE__ */ G("div", {
|
|
1599
1689
|
className: `space-y-4 ${r || ""}`,
|
|
1600
1690
|
children: [
|
|
1601
|
-
/* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h2", {
|
|
1602
1692
|
className: "text-lg font-semibold text-foreground",
|
|
1603
1693
|
children: t || "Form Analytics"
|
|
1604
|
-
}), /* @__PURE__ */
|
|
1694
|
+
}), /* @__PURE__ */ G("p", {
|
|
1605
1695
|
className: "text-sm text-muted-foreground",
|
|
1606
1696
|
children: ["Form ID: ", e]
|
|
1607
1697
|
})] }),
|
|
1608
|
-
/* @__PURE__ */
|
|
1698
|
+
/* @__PURE__ */ G("div", {
|
|
1609
1699
|
className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
1610
1700
|
children: [
|
|
1611
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ W(m, { children: /* @__PURE__ */ G(_, {
|
|
1612
1702
|
className: "pb-2",
|
|
1613
|
-
children: [/* @__PURE__ */
|
|
1703
|
+
children: [/* @__PURE__ */ W(g, { children: "Total Submissions" }), /* @__PURE__ */ W(v, {
|
|
1614
1704
|
className: "text-2xl",
|
|
1615
1705
|
children: n.totalSubmissions.toLocaleString()
|
|
1616
1706
|
})]
|
|
1617
1707
|
}) }),
|
|
1618
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ G(m, { children: [/* @__PURE__ */ G(_, {
|
|
1619
1709
|
className: "pb-2",
|
|
1620
|
-
children: [/* @__PURE__ */
|
|
1710
|
+
children: [/* @__PURE__ */ W(g, { children: "Fill Rate" }), /* @__PURE__ */ G(v, {
|
|
1621
1711
|
className: "text-2xl",
|
|
1622
1712
|
children: [a, "%"]
|
|
1623
1713
|
})]
|
|
1624
|
-
}), /* @__PURE__ */
|
|
1714
|
+
}), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
|
|
1625
1715
|
className: "w-full bg-muted rounded-full h-2",
|
|
1626
|
-
children: /* @__PURE__ */
|
|
1716
|
+
children: /* @__PURE__ */ W("div", {
|
|
1627
1717
|
className: "bg-primary rounded-full h-2 transition-all",
|
|
1628
1718
|
style: { width: `${a}%` }
|
|
1629
1719
|
})
|
|
1630
1720
|
}) })] }),
|
|
1631
|
-
/* @__PURE__ */
|
|
1721
|
+
/* @__PURE__ */ W(m, { children: /* @__PURE__ */ G(_, {
|
|
1632
1722
|
className: "pb-2",
|
|
1633
|
-
children: [/* @__PURE__ */
|
|
1723
|
+
children: [/* @__PURE__ */ W(g, { children: "Avg. Completion Time" }), /* @__PURE__ */ W(v, {
|
|
1634
1724
|
className: "text-2xl",
|
|
1635
|
-
children: n.avgCompletionTime ?
|
|
1725
|
+
children: n.avgCompletionTime ? Se(n.avgCompletionTime) : "—"
|
|
1636
1726
|
})]
|
|
1637
1727
|
}) })
|
|
1638
1728
|
]
|
|
1639
1729
|
}),
|
|
1640
|
-
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */
|
|
1730
|
+
n.dailySubmissions && n.dailySubmissions.length > 0 && /* @__PURE__ */ G(m, { children: [/* @__PURE__ */ W(_, { children: /* @__PURE__ */ W(v, {
|
|
1641
1731
|
className: "text-sm font-medium",
|
|
1642
1732
|
children: "Daily Submissions"
|
|
1643
|
-
}) }), /* @__PURE__ */
|
|
1733
|
+
}) }), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
|
|
1644
1734
|
className: "flex items-end gap-1 h-32",
|
|
1645
|
-
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */
|
|
1735
|
+
children: n.dailySubmissions.map((e, t) => /* @__PURE__ */ G("div", {
|
|
1646
1736
|
className: "flex-1 flex flex-col items-center gap-1",
|
|
1647
|
-
children: [/* @__PURE__ */
|
|
1737
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1648
1738
|
className: "w-full bg-primary/80 rounded-t transition-all hover:bg-primary",
|
|
1649
1739
|
style: {
|
|
1650
1740
|
height: `${e.count / o * 100}%`,
|
|
1651
1741
|
minHeight: e.count > 0 ? "4px" : "0"
|
|
1652
1742
|
},
|
|
1653
1743
|
title: `${e.date}: ${e.count} submissions`
|
|
1654
|
-
}), /* @__PURE__ */
|
|
1744
|
+
}), /* @__PURE__ */ W("span", {
|
|
1655
1745
|
className: "text-[10px] text-muted-foreground truncate w-full text-center",
|
|
1656
1746
|
children: e.date.slice(-5)
|
|
1657
1747
|
})]
|
|
1658
1748
|
}, t))
|
|
1659
1749
|
}) })] }),
|
|
1660
|
-
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */
|
|
1750
|
+
n.fieldDropOff && n.fieldDropOff.length > 0 && /* @__PURE__ */ G(m, { children: [/* @__PURE__ */ G(_, { children: [/* @__PURE__ */ W(v, {
|
|
1661
1751
|
className: "text-sm font-medium",
|
|
1662
1752
|
children: "Field Completion Rates"
|
|
1663
|
-
}), /* @__PURE__ */
|
|
1753
|
+
}), /* @__PURE__ */ W(g, { children: "Percentage of users who completed each field" })] }), /* @__PURE__ */ W(h, { children: /* @__PURE__ */ W("div", {
|
|
1664
1754
|
className: "space-y-3",
|
|
1665
|
-
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */
|
|
1755
|
+
children: n.fieldDropOff.map((e, t) => /* @__PURE__ */ G("div", {
|
|
1666
1756
|
className: "space-y-1",
|
|
1667
|
-
children: [/* @__PURE__ */
|
|
1757
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1668
1758
|
className: "flex justify-between text-sm",
|
|
1669
|
-
children: [/* @__PURE__ */
|
|
1759
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1670
1760
|
className: "text-foreground",
|
|
1671
1761
|
children: e.label
|
|
1672
|
-
}), /* @__PURE__ */
|
|
1762
|
+
}), /* @__PURE__ */ G("span", {
|
|
1673
1763
|
className: "text-muted-foreground",
|
|
1674
1764
|
children: [e.completionRate, "%"]
|
|
1675
1765
|
})]
|
|
1676
|
-
}), /* @__PURE__ */
|
|
1766
|
+
}), /* @__PURE__ */ W("div", {
|
|
1677
1767
|
className: "w-full bg-muted rounded-full h-1.5",
|
|
1678
|
-
children: /* @__PURE__ */
|
|
1768
|
+
children: /* @__PURE__ */ W("div", {
|
|
1679
1769
|
className: `rounded-full h-1.5 transition-all ${e.completionRate >= 80 ? "bg-green-500" : e.completionRate >= 50 ? "bg-yellow-500" : "bg-destructive"}`,
|
|
1680
1770
|
style: { width: `${e.completionRate}%` }
|
|
1681
1771
|
})
|
|
@@ -1684,8 +1774,8 @@ var be = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1684
1774
|
}) })] })
|
|
1685
1775
|
]
|
|
1686
1776
|
});
|
|
1687
|
-
},
|
|
1688
|
-
o.register("object-form",
|
|
1777
|
+
}, we = ({ schema: e }) => /* @__PURE__ */ W(ye, { schema: e });
|
|
1778
|
+
o.register("object-form", we, {
|
|
1689
1779
|
namespace: "plugin-form",
|
|
1690
1780
|
label: "Object Form",
|
|
1691
1781
|
category: "plugin",
|
|
@@ -1826,7 +1916,7 @@ o.register("object-form", xe, {
|
|
|
1826
1916
|
]
|
|
1827
1917
|
}
|
|
1828
1918
|
]
|
|
1829
|
-
}), o.register("form",
|
|
1919
|
+
}), o.register("form", we, {
|
|
1830
1920
|
namespace: "view",
|
|
1831
1921
|
skipFallback: !0,
|
|
1832
1922
|
label: "Data Form View",
|
|
@@ -1854,7 +1944,7 @@ o.register("object-form", xe, {
|
|
|
1854
1944
|
]
|
|
1855
1945
|
}
|
|
1856
1946
|
]
|
|
1857
|
-
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */
|
|
1947
|
+
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ W(xe, { config: e }), {
|
|
1858
1948
|
namespace: "plugin-form",
|
|
1859
1949
|
label: "Embeddable Form",
|
|
1860
1950
|
category: "plugin",
|
|
@@ -1892,7 +1982,7 @@ o.register("object-form", xe, {
|
|
|
1892
1982
|
label: "Allow Multiple Submissions"
|
|
1893
1983
|
}
|
|
1894
1984
|
]
|
|
1895
|
-
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */
|
|
1985
|
+
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ W(Ce, {
|
|
1896
1986
|
formId: e.formId,
|
|
1897
1987
|
formTitle: e.formTitle,
|
|
1898
1988
|
metrics: e.metrics || { totalSubmissions: 0 }
|
|
@@ -1920,4 +2010,4 @@ o.register("object-form", xe, {
|
|
|
1920
2010
|
]
|
|
1921
2011
|
});
|
|
1922
2012
|
//#endregion
|
|
1923
|
-
export {
|
|
2013
|
+
export { he as DrawerForm, xe as EmbeddableForm, Ce as FormAnalytics, K as FormSection, ve as ModalForm, ye as ObjectForm, Y as SplitForm, q as TabbedForm, J as WizardForm, Q as applyAutoColSpan, $ as applyAutoLayout, le as filterAutoGeneratedFields, ce as filterCreateModeFields, se as filterSystemFields, ae as inferColumns, ue as inferModalSize, Z as isAutoGeneratedFieldType, ie as isWideFieldType };
|