@object-ui/plugin-form 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +21 -1
- package/dist/index.js +109 -66
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-form/src/DrawerForm.d.ts +2 -0
- package/dist/packages/plugin-form/src/autoLayout.d.ts +11 -4
- package/package.json +42 -10
- package/.turbo/turbo-build.log +0 -32
- package/src/DrawerForm.tsx +0 -410
- package/src/EmbeddableForm.tsx +0 -240
- package/src/FormAnalytics.tsx +0 -209
- package/src/FormSection.tsx +0 -152
- package/src/FormVariants.test.tsx +0 -219
- package/src/ModalForm.tsx +0 -485
- package/src/ObjectForm.msw.test.tsx +0 -156
- package/src/ObjectForm.stories.tsx +0 -85
- package/src/ObjectForm.test.tsx +0 -61
- package/src/ObjectForm.tsx +0 -609
- package/src/SplitForm.tsx +0 -300
- package/src/TabbedForm.tsx +0 -395
- package/src/WizardForm.tsx +0 -502
- package/src/__tests__/EmbeddableFormPrefill.test.tsx +0 -186
- package/src/__tests__/MobileUX.test.tsx +0 -433
- package/src/__tests__/NewVariants.test.tsx +0 -684
- package/src/__tests__/autoLayout.test.ts +0 -339
- package/src/__tests__/form-validation-submit.test.tsx +0 -286
- package/src/autoLayout.ts +0 -166
- package/src/index.tsx +0 -134
- package/tsconfig.json +0 -9
- package/vite.config.ts +0 -58
- package/vitest.config.ts +0 -12
- package/vitest.setup.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @object-ui/plugin-form
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @object-ui/types@3.3.2
|
|
8
|
+
- @object-ui/core@3.3.2
|
|
9
|
+
- @object-ui/react@3.3.2
|
|
10
|
+
- @object-ui/components@3.3.2
|
|
11
|
+
- @object-ui/fields@3.3.2
|
|
12
|
+
|
|
13
|
+
## 3.3.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b429568]
|
|
18
|
+
- @object-ui/components@3.3.1
|
|
19
|
+
- @object-ui/fields@3.3.1
|
|
20
|
+
- @object-ui/types@3.3.1
|
|
21
|
+
- @object-ui/core@3.3.1
|
|
22
|
+
- @object-ui/react@3.3.1
|
|
23
|
+
|
|
3
24
|
## 3.3.0
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -251,6 +251,26 @@ The plugin includes these field components:
|
|
|
251
251
|
- Date picker
|
|
252
252
|
- File upload
|
|
253
253
|
|
|
254
|
+
<!-- release-metadata:v3.3.0 -->
|
|
255
|
+
|
|
256
|
+
## Compatibility
|
|
257
|
+
|
|
258
|
+
- **React:** 18.x or 19.x
|
|
259
|
+
- **Node.js:** ≥ 18
|
|
260
|
+
- **TypeScript:** ≥ 5.0 (strict mode)
|
|
261
|
+
- **`@objectstack/spec`:** ^3.3.0
|
|
262
|
+
- **`@objectstack/client`:** ^3.3.0
|
|
263
|
+
- **Tailwind CSS:** ≥ 3.4 (for packages with UI)
|
|
264
|
+
|
|
265
|
+
## Links
|
|
266
|
+
|
|
267
|
+
- 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-form)
|
|
268
|
+
- 📦 [npm package](https://www.npmjs.com/package/@object-ui/plugin-form)
|
|
269
|
+
- 📝 [Changelog](./CHANGELOG.md)
|
|
270
|
+
- 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
|
|
271
|
+
- 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
|
|
272
|
+
- 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
|
|
273
|
+
|
|
254
274
|
## License
|
|
255
275
|
|
|
256
|
-
MIT
|
|
276
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { buildValidationRules as l, evaluateCondition as u, formatFileSize as d,
|
|
|
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 } from "@object-ui/components";
|
|
6
6
|
import { Check as R, ChevronDown as z, ChevronLeft as B, ChevronRight as V, Loader2 as ee } from "lucide-react";
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
|
-
var H = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), U = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
8
|
+
var H = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), U = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
9
9
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
10
10
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
11
11
|
}), W = /* @__PURE__ */ H(((e) => {
|
|
@@ -719,6 +719,12 @@ var H = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), U
|
|
|
719
719
|
})
|
|
720
720
|
});
|
|
721
721
|
}, ne = new Set([
|
|
722
|
+
"field:formula",
|
|
723
|
+
"field:summary",
|
|
724
|
+
"field:auto_number",
|
|
725
|
+
"field:autonumber",
|
|
726
|
+
"field:master_detail"
|
|
727
|
+
]), re = new Set([
|
|
722
728
|
"field:textarea",
|
|
723
729
|
"field:markdown",
|
|
724
730
|
"field:html",
|
|
@@ -729,43 +735,64 @@ var H = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), U
|
|
|
729
735
|
"html",
|
|
730
736
|
"grid",
|
|
731
737
|
"rich-text"
|
|
732
|
-
]),
|
|
738
|
+
]), ie = new Set([
|
|
733
739
|
"formula",
|
|
734
740
|
"summary",
|
|
735
741
|
"auto_number",
|
|
736
|
-
"autonumber"
|
|
742
|
+
"autonumber",
|
|
743
|
+
"master_detail",
|
|
744
|
+
"masterDetail"
|
|
737
745
|
]);
|
|
738
|
-
function ie(e) {
|
|
739
|
-
return ne.has(e);
|
|
740
|
-
}
|
|
741
746
|
function ae(e) {
|
|
742
747
|
return re.has(e);
|
|
743
748
|
}
|
|
744
749
|
function oe(e) {
|
|
750
|
+
return ie.has(e);
|
|
751
|
+
}
|
|
752
|
+
function se(e) {
|
|
745
753
|
return e <= 3 ? 1 : 2;
|
|
746
754
|
}
|
|
747
755
|
function X(e, t) {
|
|
748
|
-
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type &&
|
|
756
|
+
return t <= 1 ? e : e.map((e) => e.colSpan === void 0 && e.type && ae(e.type) ? {
|
|
749
757
|
...e,
|
|
750
758
|
colSpan: t
|
|
751
759
|
} : e);
|
|
752
760
|
}
|
|
753
|
-
|
|
754
|
-
|
|
761
|
+
var ce = new Set([
|
|
762
|
+
"id",
|
|
763
|
+
"created_at",
|
|
764
|
+
"createdAt",
|
|
765
|
+
"updated_at",
|
|
766
|
+
"updatedAt",
|
|
767
|
+
"deleted_at",
|
|
768
|
+
"deletedAt",
|
|
769
|
+
"created_by",
|
|
770
|
+
"createdBy",
|
|
771
|
+
"updated_by",
|
|
772
|
+
"updatedBy",
|
|
773
|
+
"owner",
|
|
774
|
+
"owner_id",
|
|
775
|
+
"_version",
|
|
776
|
+
"_rev"
|
|
777
|
+
]);
|
|
778
|
+
function le(e, t) {
|
|
779
|
+
return e.filter((e) => {
|
|
780
|
+
if (ce.has(e.name) || e.type && ne.has(e.type)) return !1;
|
|
781
|
+
if (!t?.fields) return !0;
|
|
755
782
|
let n = t.fields[e.name];
|
|
756
|
-
return n ? !
|
|
757
|
-
})
|
|
783
|
+
return n ? n.readonly === !0 ? !1 : !oe(n.type) : !0;
|
|
784
|
+
});
|
|
758
785
|
}
|
|
759
786
|
function Z(e) {
|
|
760
787
|
return e <= 1 ? "default" : e === 2 ? "xl" : "full";
|
|
761
788
|
}
|
|
762
789
|
function Q(e, t, n, r) {
|
|
763
790
|
let i = [...e];
|
|
764
|
-
if (r === "create" && (i =
|
|
791
|
+
if (r === "create" && (i = le(i, t)), n !== void 0) return i = X(i, n), {
|
|
765
792
|
fields: i,
|
|
766
793
|
columns: n
|
|
767
794
|
};
|
|
768
|
-
let a =
|
|
795
|
+
let a = se(i.length);
|
|
769
796
|
return i = X(i, a), {
|
|
770
797
|
fields: i,
|
|
771
798
|
columns: a
|
|
@@ -773,13 +800,19 @@ function Q(e, t, n, r) {
|
|
|
773
800
|
}
|
|
774
801
|
//#endregion
|
|
775
802
|
//#region src/DrawerForm.tsx
|
|
776
|
-
var
|
|
803
|
+
var ue = {
|
|
777
804
|
1: void 0,
|
|
778
805
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
779
806
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
780
807
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
781
|
-
},
|
|
782
|
-
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"
|
|
808
|
+
}, de = ({ schema: e, dataSource: r, className: o }) => {
|
|
809
|
+
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(() => {
|
|
810
|
+
let t = {};
|
|
811
|
+
return e.sections?.forEach((e, n) => {
|
|
812
|
+
let r = e.name || String(n);
|
|
813
|
+
e.collapsed && (t[r] = !0);
|
|
814
|
+
}), t;
|
|
815
|
+
});
|
|
783
816
|
n(() => {
|
|
784
817
|
(async () => {
|
|
785
818
|
if (!r) {
|
|
@@ -819,7 +852,7 @@ var ce = {
|
|
|
819
852
|
r,
|
|
820
853
|
e.objectName
|
|
821
854
|
]);
|
|
822
|
-
let
|
|
855
|
+
let E = t((t) => {
|
|
823
856
|
let n = [];
|
|
824
857
|
for (let r of t.fields) {
|
|
825
858
|
let t = typeof r == "string" ? r : r.name;
|
|
@@ -891,7 +924,7 @@ var ce = {
|
|
|
891
924
|
e.mode,
|
|
892
925
|
r
|
|
893
926
|
]);
|
|
894
|
-
let
|
|
927
|
+
let M = t(async (t) => {
|
|
895
928
|
if (!r) return e.onSuccess && await e.onSuccess(t), e.onOpenChange?.(!1), t;
|
|
896
929
|
try {
|
|
897
930
|
let n;
|
|
@@ -899,9 +932,9 @@ var ce = {
|
|
|
899
932
|
} catch (t) {
|
|
900
933
|
throw e.onError && e.onError(t), t;
|
|
901
934
|
}
|
|
902
|
-
}, [e, r]),
|
|
935
|
+
}, [e, r]), N = t(() => {
|
|
903
936
|
e.onCancel && e.onCancel(), e.onOpenChange?.(!1);
|
|
904
|
-
}, [e]),
|
|
937
|
+
}, [e]), P = i(() => {
|
|
905
938
|
if (e.drawerWidth) return C === "left" || C === "right" ? {
|
|
906
939
|
width: e.drawerWidth,
|
|
907
940
|
maxWidth: e.drawerWidth
|
|
@@ -909,7 +942,7 @@ var ce = {
|
|
|
909
942
|
height: e.drawerWidth,
|
|
910
943
|
maxHeight: e.drawerWidth
|
|
911
944
|
};
|
|
912
|
-
}, [e.drawerWidth, C]),
|
|
945
|
+
}, [e.drawerWidth, C]), F = {
|
|
913
946
|
type: "form",
|
|
914
947
|
layout: e.layout === "vertical" || e.layout === "horizontal" ? e.layout : "vertical",
|
|
915
948
|
defaultValues: g,
|
|
@@ -917,8 +950,8 @@ var ce = {
|
|
|
917
950
|
cancelLabel: e.cancelText,
|
|
918
951
|
showSubmit: e.showSubmit !== !1 && e.mode !== "view",
|
|
919
952
|
showCancel: e.showCancel !== !1,
|
|
920
|
-
onSubmit:
|
|
921
|
-
onCancel:
|
|
953
|
+
onSubmit: M,
|
|
954
|
+
onCancel: N
|
|
922
955
|
};
|
|
923
956
|
return /* @__PURE__ */ (0, K.jsx)(D, {
|
|
924
957
|
open: S,
|
|
@@ -926,7 +959,7 @@ var ce = {
|
|
|
926
959
|
children: /* @__PURE__ */ (0, K.jsxs)(O, {
|
|
927
960
|
side: C,
|
|
928
961
|
className: L("overflow-y-auto", o, e.className),
|
|
929
|
-
style:
|
|
962
|
+
style: P,
|
|
930
963
|
children: [(e.title || e.description) && /* @__PURE__ */ (0, K.jsxs)(A, { children: [e.title && /* @__PURE__ */ (0, K.jsx)(j, { children: e.title }), e.description && /* @__PURE__ */ (0, K.jsx)(k, { children: e.description })] }), /* @__PURE__ */ (0, K.jsx)("div", {
|
|
931
964
|
className: "@container py-4",
|
|
932
965
|
children: (() => {
|
|
@@ -947,27 +980,35 @@ var ce = {
|
|
|
947
980
|
children: "Loading form..."
|
|
948
981
|
})]
|
|
949
982
|
});
|
|
950
|
-
if (e.sections?.length)
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
let r =
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
983
|
+
if (e.sections?.length) {
|
|
984
|
+
let t = [];
|
|
985
|
+
return e.sections.forEach((e, n) => {
|
|
986
|
+
let r = e.name || String(n), i = w[r] ?? e.collapsed ?? !1;
|
|
987
|
+
t.push({
|
|
988
|
+
name: `__section_${r}`,
|
|
989
|
+
label: e.label || "",
|
|
990
|
+
type: "section-divider",
|
|
991
|
+
colSpan: 4,
|
|
992
|
+
collapsible: e.collapsible,
|
|
993
|
+
collapsed: i,
|
|
994
|
+
onToggle: e.collapsible ? () => T((e) => ({
|
|
995
|
+
...e,
|
|
996
|
+
[r]: !i
|
|
997
|
+
})) : void 0
|
|
998
|
+
});
|
|
999
|
+
let a = E(e);
|
|
1000
|
+
i ? t.push(...a.map((e) => ({
|
|
1001
|
+
...e,
|
|
1002
|
+
hidden: !0
|
|
1003
|
+
}))) : t.push(...a);
|
|
1004
|
+
}), /* @__PURE__ */ (0, K.jsx)(s, { schema: {
|
|
1005
|
+
...F,
|
|
1006
|
+
fields: t
|
|
1007
|
+
} });
|
|
1008
|
+
}
|
|
1009
|
+
let t = Q(m, d, e.columns, e.mode), n = ue[t.columns || 1];
|
|
969
1010
|
return /* @__PURE__ */ (0, K.jsx)(s, { schema: {
|
|
970
|
-
...
|
|
1011
|
+
...F,
|
|
971
1012
|
fields: t.fields,
|
|
972
1013
|
columns: t.columns,
|
|
973
1014
|
...n ? { fieldContainerClass: n } : {}
|
|
@@ -976,18 +1017,18 @@ var ce = {
|
|
|
976
1017
|
})]
|
|
977
1018
|
})
|
|
978
1019
|
});
|
|
979
|
-
},
|
|
1020
|
+
}, fe = {
|
|
980
1021
|
sm: "sm:max-w-sm",
|
|
981
1022
|
default: "sm:max-w-lg",
|
|
982
1023
|
lg: "sm:max-w-2xl",
|
|
983
1024
|
xl: "sm:max-w-5xl",
|
|
984
1025
|
full: "sm:max-w-[95vw] sm:w-full"
|
|
985
|
-
},
|
|
1026
|
+
}, pe = {
|
|
986
1027
|
1: void 0,
|
|
987
1028
|
2: "grid gap-4 grid-cols-1 @md:grid-cols-2",
|
|
988
1029
|
3: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3",
|
|
989
1030
|
4: "grid gap-4 grid-cols-1 @md:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4"
|
|
990
|
-
},
|
|
1031
|
+
}, me = ({ schema: e, dataSource: o, className: u }) => {
|
|
991
1032
|
let { fieldLabel: d } = c(), [m, h] = a(null), [g, _] = a([]), [v, w] = a({}), [T, E] = a(!0), [D, O] = a(null), [k, A] = a(!1), j = e.open !== !1, N = r(), P = i(() => e.sections?.length || e.customFields?.length ? null : Q(g, m, e.columns, e.mode), [
|
|
992
1033
|
g,
|
|
993
1034
|
m,
|
|
@@ -995,7 +1036,7 @@ var ce = {
|
|
|
995
1036
|
e.mode,
|
|
996
1037
|
e.sections,
|
|
997
1038
|
e.customFields
|
|
998
|
-
]), F =
|
|
1039
|
+
]), F = fe[i(() => {
|
|
999
1040
|
if (e.modalSize) return e.modalSize;
|
|
1000
1041
|
if (P?.columns && P.columns > 1) return Z(P.columns);
|
|
1001
1042
|
if (e.sections?.length) {
|
|
@@ -1007,7 +1048,7 @@ var ce = {
|
|
|
1007
1048
|
e.modalSize,
|
|
1008
1049
|
P,
|
|
1009
1050
|
e.sections
|
|
1010
|
-
])] ||
|
|
1051
|
+
])] || fe.default;
|
|
1011
1052
|
n(() => {
|
|
1012
1053
|
(async () => {
|
|
1013
1054
|
if (!o) {
|
|
@@ -1175,7 +1216,7 @@ var ce = {
|
|
|
1175
1216
|
label: e.label,
|
|
1176
1217
|
description: e.description,
|
|
1177
1218
|
columns: n,
|
|
1178
|
-
gridClassName:
|
|
1219
|
+
gridClassName: pe[n],
|
|
1179
1220
|
children: /* @__PURE__ */ (0, K.jsx)(s, { schema: {
|
|
1180
1221
|
...G,
|
|
1181
1222
|
fields: I(e)
|
|
@@ -1183,7 +1224,7 @@ var ce = {
|
|
|
1183
1224
|
}, e.name || e.label || t);
|
|
1184
1225
|
})
|
|
1185
1226
|
});
|
|
1186
|
-
let t = P ?? Q(g, m, e.columns, e.mode), n =
|
|
1227
|
+
let t = P ?? Q(g, m, e.columns, e.mode), n = pe[t.columns || 1];
|
|
1187
1228
|
return /* @__PURE__ */ (0, K.jsx)(s, { schema: {
|
|
1188
1229
|
...G,
|
|
1189
1230
|
fields: t.fields,
|
|
@@ -1287,7 +1328,7 @@ var ce = {
|
|
|
1287
1328
|
});
|
|
1288
1329
|
if (e.formType === "drawer") {
|
|
1289
1330
|
let { layout: n, ...r } = e, i = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1290
|
-
return /* @__PURE__ */ (0, K.jsx)(
|
|
1331
|
+
return /* @__PURE__ */ (0, K.jsx)(de, {
|
|
1291
1332
|
schema: {
|
|
1292
1333
|
...r,
|
|
1293
1334
|
layout: i,
|
|
@@ -1297,7 +1338,9 @@ var ce = {
|
|
|
1297
1338
|
label: e.label,
|
|
1298
1339
|
description: e.description,
|
|
1299
1340
|
columns: e.columns,
|
|
1300
|
-
fields: e.fields
|
|
1341
|
+
fields: e.fields,
|
|
1342
|
+
collapsible: e.collapsible,
|
|
1343
|
+
collapsed: e.collapsed
|
|
1301
1344
|
})),
|
|
1302
1345
|
open: e.open,
|
|
1303
1346
|
onOpenChange: e.onOpenChange,
|
|
@@ -1310,7 +1353,7 @@ var ce = {
|
|
|
1310
1353
|
}
|
|
1311
1354
|
if (e.formType === "modal") {
|
|
1312
1355
|
let { layout: n, ...r } = e, i = e.layout === "vertical" || e.layout === "horizontal" ? e.layout : void 0;
|
|
1313
|
-
return /* @__PURE__ */ (0, K.jsx)(
|
|
1356
|
+
return /* @__PURE__ */ (0, K.jsx)(me, {
|
|
1314
1357
|
schema: {
|
|
1315
1358
|
...r,
|
|
1316
1359
|
layout: i,
|
|
@@ -1331,11 +1374,11 @@ var ce = {
|
|
|
1331
1374
|
className: e.className
|
|
1332
1375
|
});
|
|
1333
1376
|
}
|
|
1334
|
-
return /* @__PURE__ */ (0, K.jsx)(
|
|
1377
|
+
return /* @__PURE__ */ (0, K.jsx)(he, {
|
|
1335
1378
|
schema: e,
|
|
1336
1379
|
dataSource: t
|
|
1337
1380
|
});
|
|
1338
|
-
},
|
|
1381
|
+
}, he = ({ schema: r, dataSource: i }) => {
|
|
1339
1382
|
let { fieldLabel: o } = c(), [p, m] = a(null), [h, g] = a([]), [_, v] = a(null), [y, b] = a(!0), [x, S] = a(null), C = r.customFields && r.customFields.length > 0;
|
|
1340
1383
|
n(() => {
|
|
1341
1384
|
C && (v(r.initialData || r.initialValues || {}), b(!1));
|
|
@@ -1530,7 +1573,7 @@ var ce = {
|
|
|
1530
1573
|
className: r.className
|
|
1531
1574
|
} })
|
|
1532
1575
|
});
|
|
1533
|
-
},
|
|
1576
|
+
}, ge = ({ config: e, dataSource: n, prefillParams: r, className: o }) => {
|
|
1534
1577
|
let [s, c] = a(!1), [l, u] = a(!1), [d, f] = a(null), p = i(() => {
|
|
1535
1578
|
let e = {};
|
|
1536
1579
|
if (r) for (let [t, n] of Object.entries(r)) e[t] = n;
|
|
@@ -1651,10 +1694,10 @@ var ce = {
|
|
|
1651
1694
|
};
|
|
1652
1695
|
//#endregion
|
|
1653
1696
|
//#region src/FormAnalytics.tsx
|
|
1654
|
-
function
|
|
1697
|
+
function _e(e) {
|
|
1655
1698
|
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`;
|
|
1656
1699
|
}
|
|
1657
|
-
var
|
|
1700
|
+
var ve = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
1658
1701
|
let a = i(() => {
|
|
1659
1702
|
if (!n.abandonedSubmissions) return 100;
|
|
1660
1703
|
let e = n.totalSubmissions + n.abandonedSubmissions;
|
|
@@ -1697,7 +1740,7 @@ var ge = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1697
1740
|
className: "pb-2",
|
|
1698
1741
|
children: [/* @__PURE__ */ (0, K.jsx)(g, { children: "Avg. Completion Time" }), /* @__PURE__ */ (0, K.jsx)(v, {
|
|
1699
1742
|
className: "text-2xl",
|
|
1700
|
-
children: n.avgCompletionTime ?
|
|
1743
|
+
children: n.avgCompletionTime ? _e(n.avgCompletionTime) : "—"
|
|
1701
1744
|
})]
|
|
1702
1745
|
}) })
|
|
1703
1746
|
]
|
|
@@ -1749,8 +1792,8 @@ var ge = ({ formId: e, formTitle: t, metrics: n, className: r }) => {
|
|
|
1749
1792
|
}) })] })
|
|
1750
1793
|
]
|
|
1751
1794
|
});
|
|
1752
|
-
},
|
|
1753
|
-
o.register("object-form",
|
|
1795
|
+
}, ye = ({ schema: e }) => /* @__PURE__ */ (0, K.jsx)($, { schema: e });
|
|
1796
|
+
o.register("object-form", ye, {
|
|
1754
1797
|
namespace: "plugin-form",
|
|
1755
1798
|
label: "Object Form",
|
|
1756
1799
|
category: "plugin",
|
|
@@ -1891,7 +1934,7 @@ o.register("object-form", _e, {
|
|
|
1891
1934
|
]
|
|
1892
1935
|
}
|
|
1893
1936
|
]
|
|
1894
|
-
}), o.register("form",
|
|
1937
|
+
}), o.register("form", ye, {
|
|
1895
1938
|
namespace: "view",
|
|
1896
1939
|
skipFallback: !0,
|
|
1897
1940
|
label: "Data Form View",
|
|
@@ -1919,7 +1962,7 @@ o.register("object-form", _e, {
|
|
|
1919
1962
|
]
|
|
1920
1963
|
}
|
|
1921
1964
|
]
|
|
1922
|
-
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ (0, K.jsx)(
|
|
1965
|
+
}), o.register("embeddable-form", ({ schema: e }) => /* @__PURE__ */ (0, K.jsx)(ge, { config: e }), {
|
|
1923
1966
|
namespace: "plugin-form",
|
|
1924
1967
|
label: "Embeddable Form",
|
|
1925
1968
|
category: "plugin",
|
|
@@ -1957,7 +2000,7 @@ o.register("object-form", _e, {
|
|
|
1957
2000
|
label: "Allow Multiple Submissions"
|
|
1958
2001
|
}
|
|
1959
2002
|
]
|
|
1960
|
-
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ (0, K.jsx)(
|
|
2003
|
+
}), o.register("form-analytics", ({ schema: e }) => /* @__PURE__ */ (0, K.jsx)(ve, {
|
|
1961
2004
|
formId: e.formId,
|
|
1962
2005
|
formTitle: e.formTitle,
|
|
1963
2006
|
metrics: e.metrics || { totalSubmissions: 0 }
|
|
@@ -1985,4 +2028,4 @@ o.register("object-form", _e, {
|
|
|
1985
2028
|
]
|
|
1986
2029
|
});
|
|
1987
2030
|
//#endregion
|
|
1988
|
-
export {
|
|
2031
|
+
export { de as DrawerForm, ge as EmbeddableForm, ve as FormAnalytics, q as FormSection, me as ModalForm, $ as ObjectForm, te as SplitForm, J as TabbedForm, Y as WizardForm, X as applyAutoColSpan, Q as applyAutoLayout, le as filterCreateModeFields, se as inferColumns, Z as inferModalSize, oe as isAutoGeneratedFieldType, ae as isWideFieldType };
|