@tsed/react-formio 3.0.0-alpha.12 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.d.ts +0 -0
- package/dist/all.js +38 -0
- package/dist/all.js.map +1 -0
- package/dist/chunks/_commonjsHelpers.js +30 -3
- package/dist/chunks/_commonjsHelpers.js.map +1 -1
- package/dist/chunks/index2.js +56953 -0
- package/dist/chunks/index2.js.map +1 -0
- package/dist/contexts/FormioContext.d.ts +20 -0
- package/dist/contexts/FormioContext.js +40 -0
- package/dist/contexts/FormioContext.js.map +1 -0
- package/dist/hooks/useFormioContext.d.ts +10 -0
- package/dist/hooks/useFormioContext.js +12 -0
- package/dist/hooks/useFormioContext.js.map +1 -0
- package/dist/hooks/useI18n.d.ts +4 -0
- package/dist/hooks/useI18n.js +9 -0
- package/dist/hooks/useI18n.js.map +1 -0
- package/dist/index.d.ts +1 -6
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ComponentType.d.ts +6 -2
- package/dist/interfaces/FormBuilderOptions.d.ts +7 -0
- package/dist/interfaces/FormBuilderOptions.js +2 -0
- package/dist/interfaces/FormBuilderOptions.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +6 -13
- package/dist/interfaces/FormType.d.ts +4 -11
- package/dist/interfaces/SubmissionType.d.ts +5 -10
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +19 -19
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +16 -16
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/modal/Modal.js +6 -6
- package/dist/molecules/modal/Modal.js.map +1 -1
- package/dist/molecules/pagination/Pagination.d.ts +2 -1
- package/dist/molecules/pagination/Pagination.js +24 -24
- package/dist/molecules/pagination/Pagination.js.map +1 -1
- package/dist/molecules/table/Table.js +27 -27
- package/dist/molecules/table/Table.js.map +1 -1
- package/dist/molecules/table/hooks/useTable.d.ts +3 -3
- package/dist/molecules/table/hooks/useTable.js +13 -12
- package/dist/molecules/table/hooks/useTable.js.map +1 -1
- package/dist/molecules/table/utils/mapFormToColumns.js +22 -22
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/molecules/tabs/TabsLegacy.d.ts +3 -2
- package/dist/molecules/tabs/TabsLegacy.js +30 -30
- package/dist/molecules/tabs/TabsLegacy.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js +1 -0
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +14 -11
- package/dist/organisms/form/actions/FormAction.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.d.ts +4 -3
- package/dist/organisms/form/builder/FormEdit.js +36 -36
- package/dist/organisms/form/builder/FormEdit.js.map +1 -1
- package/dist/organisms/form/builder/FormEditCtas.d.ts +2 -2
- package/dist/organisms/form/builder/FormEditCtas.js +14 -13
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
- package/dist/organisms/form/builder/useFormBuilder.d.ts +4 -4
- package/dist/organisms/form/builder/useFormBuilder.js +12 -12
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/useFormEdit.d.ts +1 -1
- package/dist/organisms/form/exports/FormExport.d.ts +3 -2
- package/dist/organisms/form/exports/FormExport.js +21 -20
- package/dist/organisms/form/exports/FormExport.js.map +1 -1
- package/dist/organisms/form/preview/FormPreview.d.ts +3 -3
- package/dist/organisms/form/preview/FormPreview.js +5 -4
- package/dist/organisms/form/preview/FormPreview.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.js +21 -21
- package/dist/organisms/form/settings/FormSettings.js.map +1 -1
- package/dist/organisms/form/useForm.d.ts +2 -1
- package/dist/organisms/form/useForm.js +2 -2
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/table/actions/ActionsTable.d.ts +2 -1
- package/dist/organisms/table/actions/ActionsTable.js +10 -9
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
- package/dist/organisms/table/forms/FormsTable.d.ts +1 -1
- package/dist/organisms/table/forms/FormsTable.js +9 -8
- package/dist/organisms/table/forms/FormsTable.js.map +1 -1
- package/dist/organisms/table/forms/components/FormsCell.js +10 -10
- package/dist/organisms/views/FormViews.d.ts +3 -3
- package/dist/organisms/views/FormViews.js +47 -46
- package/dist/organisms/views/FormViews.js.map +1 -1
- package/dist/utils/iconClass.js +4 -5
- package/dist/utils/iconClass.js.map +1 -1
- package/package.json +3 -3
- package/src/all.ts +34 -0
- package/src/contexts/FormioContext.tsx +96 -0
- package/src/hooks/useFormioContext.ts +13 -0
- package/src/hooks/useI18n.ts +9 -0
- package/src/index.ts +17 -13
- package/src/interfaces/ComponentType.ts +2 -2
- package/src/interfaces/FormBuilderOptions.ts +9 -0
- package/src/interfaces/FormOptions.ts +7 -13
- package/src/interfaces/FormType.ts +5 -11
- package/src/interfaces/SubmissionType.ts +9 -8
- package/src/interfaces/index.ts +1 -0
- package/src/molecules/forms/form-control/FormControl.spec.tsx +5 -2
- package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +4 -4
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +2 -2
- package/src/molecules/pagination/Pagination.tsx +10 -9
- package/src/molecules/table/Table.stories.tsx +6 -6
- package/src/molecules/table/Table.tsx +1 -1
- package/src/molecules/table/hooks/useTable.tsx +7 -6
- package/src/molecules/table/utils/mapFormToColumns.tsx +6 -5
- package/src/molecules/tabs/TabsLegacy.stories.tsx +1 -1
- package/src/molecules/tabs/TabsLegacy.tsx +5 -3
- package/src/organisms/form/Form.stories.tsx +4 -0
- package/src/organisms/form/access/FormAccess.schema.ts +1 -0
- package/src/organisms/form/access/FormAccess.stories.tsx +3 -1
- package/src/organisms/form/actions/FormAction.stories.tsx +5 -1
- package/src/organisms/form/actions/FormAction.tsx +2 -2
- package/src/organisms/form/builder/FormEdit.stories.tsx +10 -6
- package/src/organisms/form/builder/FormEdit.tsx +6 -6
- package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
- package/src/organisms/form/builder/useFormBuilder.ts +7 -6
- package/src/organisms/form/exports/FormExport.stories.tsx +8 -11
- package/src/organisms/form/exports/FormExport.tsx +12 -9
- package/src/organisms/form/preview/FormPreview.stories.tsx +6 -9
- package/src/organisms/form/preview/FormPreview.tsx +7 -5
- package/src/organisms/form/settings/FormSettings.component.spec.tsx +3 -1
- package/src/organisms/form/settings/FormSettings.stories.tsx +1 -1
- package/src/organisms/form/settings/FormSettings.tsx +6 -6
- package/src/organisms/form/useForm.ts +2 -3
- package/src/organisms/table/actions/ActionsTable.tsx +7 -5
- package/src/organisms/table/forms/FormsTable.tsx +6 -5
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +10 -13
- package/src/organisms/views/FormViews.stories.tsx +13 -16
- package/src/organisms/views/FormViews.tsx +18 -16
- package/src/utils/iconClass.ts +1 -3
- package/dist/typings.d.js +0 -2
- package/dist/typings.d.js.map +0 -1
- package/src/typings.d.ts +0 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as e, jsx as
|
|
1
|
+
import { jsxs as e, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { c as t } from "../../../../chunks/index.js";
|
|
3
|
-
import
|
|
3
|
+
import m from "moment";
|
|
4
4
|
import { registerComponent as c } from "../../../../registries/components.js";
|
|
5
|
-
import { iconClass as
|
|
5
|
+
import { iconClass as s } from "../../../../utils/iconClass.js";
|
|
6
6
|
import { stopPropagationWrapper as n } from "../../../../utils/stopPropagationWrapper.js";
|
|
7
7
|
function p(i) {
|
|
8
8
|
const {
|
|
@@ -10,8 +10,8 @@ function p(i) {
|
|
|
10
10
|
} = i;
|
|
11
11
|
return /* @__PURE__ */ e("div", { className: "p-1", children: [
|
|
12
12
|
/* @__PURE__ */ e("h4", { className: "text-primary text-lg flex space-x-2 items-center", children: [
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ r("i", { className: t(s(void 0, "server"), "text-secondary") }),
|
|
14
|
+
/* @__PURE__ */ r("span", { children: a.title })
|
|
15
15
|
] }),
|
|
16
16
|
/* @__PURE__ */ e("ul", { className: "reset-list text-gray-500", children: [
|
|
17
17
|
/* @__PURE__ */ e("li", { className: "text-sm", children: [
|
|
@@ -20,21 +20,21 @@ function p(i) {
|
|
|
20
20
|
] }),
|
|
21
21
|
/* @__PURE__ */ e("li", { className: "mt-5 flex space-x-1", children: [
|
|
22
22
|
/* @__PURE__ */ e("span", { className: "badge bg-light flex space-x-1", children: [
|
|
23
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ r("i", { className: s(void 0, "history") }),
|
|
24
24
|
/* @__PURE__ */ e("span", { children: [
|
|
25
25
|
"Updated ",
|
|
26
|
-
|
|
26
|
+
m(a.modified).fromNow()
|
|
27
27
|
] })
|
|
28
28
|
] }),
|
|
29
|
-
(a.tags || []).map((
|
|
29
|
+
(a.tags || []).map((l, o) => /* @__PURE__ */ e(
|
|
30
30
|
"button",
|
|
31
31
|
{
|
|
32
32
|
className: "badge badge-hover bg-secondary flex space-x-1",
|
|
33
33
|
onClick: n(() => {
|
|
34
34
|
}),
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ r("i", { className: s(void 0, "tags") }),
|
|
37
|
+
/* @__PURE__ */ r("span", { children: l })
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
o
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSON, PermissionsResolver } from '../../interfaces/index.js';
|
|
1
|
+
import { FormOptions, JSON, PermissionsResolver } from '../../interfaces/index.js';
|
|
2
2
|
import { FormAccessProps } from '../form/access/FormAccess.js';
|
|
3
3
|
import { FormEditProps } from '../form/builder/FormEdit.js';
|
|
4
4
|
import { ActionsTableProps } from '../table/actions/ActionsTable.js';
|
|
@@ -13,7 +13,7 @@ export type FormViewsProps<Data extends {
|
|
|
13
13
|
availableActions: ActionsTableProps["availableActions"];
|
|
14
14
|
actions: ActionsTableProps["data"];
|
|
15
15
|
roles?: FormAccessProps["roles"];
|
|
16
|
-
i18n?:
|
|
16
|
+
i18n?: FormOptions["i18n"];
|
|
17
17
|
onAction: () => void;
|
|
18
18
|
permissionsResolver?: PermissionsResolver<Data>;
|
|
19
19
|
};
|
|
@@ -21,4 +21,4 @@ export declare function FormViews<Data extends {
|
|
|
21
21
|
[key: string]: JSON;
|
|
22
22
|
} = {
|
|
23
23
|
[key: string]: JSON;
|
|
24
|
-
}>({ form, roles, availableActions, actions, permissionsResolver, submissions,
|
|
24
|
+
}>({ form, roles, availableActions, actions, permissionsResolver, submissions, ...props }: FormViewsProps<Data>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,96 +1,97 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useI18n as f } from "../../hooks/useI18n.js";
|
|
3
|
+
import { getComponent as a } from "../../registries/components.js";
|
|
4
|
+
import { FormAccess as g } from "../form/access/FormAccess.js";
|
|
5
|
+
import { FormEdit as w } from "../form/builder/FormEdit.js";
|
|
6
|
+
import { FormExport as y } from "../form/exports/FormExport.js";
|
|
7
|
+
import { FormPreview as E } from "../form/preview/FormPreview.js";
|
|
8
|
+
import { FormSettings as F } from "../form/settings/FormSettings.js";
|
|
9
|
+
import { ActionsTable as N } from "../table/actions/ActionsTable.js";
|
|
10
|
+
import { SubmissionsTable as x } from "../table/submissions/SubmissionsTable.js";
|
|
11
|
+
function A(e) {
|
|
11
12
|
return [
|
|
12
13
|
{
|
|
13
14
|
title: "Edit",
|
|
14
15
|
action: "submission:edit",
|
|
15
16
|
alias: "row",
|
|
16
17
|
icon: "edit",
|
|
17
|
-
permissionsResolver:
|
|
18
|
+
permissionsResolver: e
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
action: "submission:delete",
|
|
21
22
|
icon: "trash",
|
|
22
23
|
buttonType: "danger",
|
|
23
|
-
permissionsResolver:
|
|
24
|
+
permissionsResolver: e
|
|
24
25
|
}
|
|
25
26
|
];
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function O(e) {
|
|
28
29
|
return [
|
|
29
30
|
{
|
|
30
31
|
title: "Edit",
|
|
31
32
|
action: "action:edit",
|
|
32
33
|
alias: "row",
|
|
33
34
|
icon: "edit",
|
|
34
|
-
permissionsResolver:
|
|
35
|
+
permissionsResolver: e
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
action: "action:delete",
|
|
38
39
|
icon: "trash",
|
|
39
40
|
buttonType: "danger",
|
|
40
|
-
permissionsResolver:
|
|
41
|
+
permissionsResolver: e
|
|
41
42
|
}
|
|
42
43
|
];
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
form:
|
|
45
|
+
function q({
|
|
46
|
+
form: e,
|
|
46
47
|
roles: l,
|
|
47
48
|
availableActions: d,
|
|
48
49
|
actions: b,
|
|
49
50
|
permissionsResolver: s,
|
|
50
|
-
submissions:
|
|
51
|
-
|
|
51
|
+
submissions: m,
|
|
52
|
+
...r
|
|
52
53
|
}) {
|
|
53
|
-
const n =
|
|
54
|
-
return /* @__PURE__ */ c(
|
|
55
|
-
/* @__PURE__ */ c(
|
|
56
|
-
/* @__PURE__ */ o
|
|
57
|
-
/* @__PURE__ */ o
|
|
58
|
-
/* @__PURE__ */ o
|
|
59
|
-
/* @__PURE__ */ o
|
|
60
|
-
/* @__PURE__ */ o
|
|
61
|
-
/* @__PURE__ */ o
|
|
62
|
-
/* @__PURE__ */ o
|
|
54
|
+
const { t: n } = f(r.i18n), u = a("Tabs"), p = a("TabList"), o = a("Tab"), h = a("TabsBody"), t = a("TabPanel"), T = A(s), v = O(s);
|
|
55
|
+
return /* @__PURE__ */ c(u, { children: [
|
|
56
|
+
/* @__PURE__ */ c(p, { children: [
|
|
57
|
+
/* @__PURE__ */ i(o, { value: 0, icon: "edit", children: n("Edit") }),
|
|
58
|
+
/* @__PURE__ */ i(o, { value: 1, icon: "data", children: n("Data") }),
|
|
59
|
+
/* @__PURE__ */ i(o, { value: 2, icon: "test-tube", children: n("Preview") }),
|
|
60
|
+
/* @__PURE__ */ i(o, { value: 3, icon: "paper-plane", children: n("Actions") }),
|
|
61
|
+
/* @__PURE__ */ i(o, { value: 4, icon: "lock", children: n("Access") }),
|
|
62
|
+
/* @__PURE__ */ i(o, { value: 5, icon: "download", children: n("Export") }),
|
|
63
|
+
/* @__PURE__ */ i(o, { value: 6, icon: "cog", children: n("Settings") })
|
|
63
64
|
] }),
|
|
64
|
-
/* @__PURE__ */ c(
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
65
|
+
/* @__PURE__ */ c(h, { children: [
|
|
66
|
+
/* @__PURE__ */ i(t, { value: 0, className: "p-3 border-l-1 border-b-1 border-r-1 border-gray-300", children: /* @__PURE__ */ i(w, { form: e }) }),
|
|
67
|
+
/* @__PURE__ */ i(t, { value: 1, children: /* @__PURE__ */ i(
|
|
68
|
+
x,
|
|
68
69
|
{
|
|
69
70
|
className: "border-top-0",
|
|
70
|
-
form:
|
|
71
|
-
data:
|
|
72
|
-
i18n:
|
|
73
|
-
operations:
|
|
71
|
+
form: e,
|
|
72
|
+
data: m,
|
|
73
|
+
i18n: r.i18n,
|
|
74
|
+
operations: T
|
|
74
75
|
}
|
|
75
76
|
) }),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
77
|
+
/* @__PURE__ */ i(t, { value: 2, children: /* @__PURE__ */ i(E, { form: e, i18n: r.i18n }) }),
|
|
78
|
+
/* @__PURE__ */ i(t, { value: 3, children: /* @__PURE__ */ i(
|
|
79
|
+
N,
|
|
79
80
|
{
|
|
80
81
|
className: "border-top-0",
|
|
81
82
|
availableActions: d,
|
|
82
83
|
data: b,
|
|
83
|
-
operations:
|
|
84
|
-
i18n:
|
|
84
|
+
operations: v,
|
|
85
|
+
i18n: r.i18n
|
|
85
86
|
}
|
|
86
87
|
) }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ i(t, { value: 4, className: "pt-3", children: /* @__PURE__ */ i(g, { form: e, roles: l, options: r }) }),
|
|
89
|
+
/* @__PURE__ */ i(t, { value: 5, className: "pt-3", children: /* @__PURE__ */ i(y, { i18n: r.i18n }) }),
|
|
90
|
+
/* @__PURE__ */ i(t, { value: 6, className: "p-3 border-l-1 border-b-1 border-r-1 border-gray-300", children: /* @__PURE__ */ i(F, { form: e, options: {} }) })
|
|
90
91
|
] })
|
|
91
92
|
] });
|
|
92
93
|
}
|
|
93
94
|
export {
|
|
94
|
-
|
|
95
|
+
q as FormViews
|
|
95
96
|
};
|
|
96
97
|
//# sourceMappingURL=FormViews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormViews.js","sources":["../../../src/organisms/views/FormViews.tsx"],"sourcesContent":["import type { FormType, JSON, PermissionsResolver } from \"../../interfaces/index.js\";\nimport type { Tab as DefaultTab } from \"../../molecules/tabs/Tab.js\";\nimport type { TabList as DefaultTabList } from \"../../molecules/tabs/TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"../../molecules/tabs/TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"../../molecules/tabs/Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"../../molecules/tabs/TabsBody.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport { FormAccess, type FormAccessProps } from \"../form/access/FormAccess.js\";\nimport { FormEdit, type FormEditProps } from \"../form/builder/FormEdit.js\";\nimport { FormExport } from \"../form/exports/FormExport.js\";\nimport { FormPreview } from \"../form/preview/FormPreview.js\";\nimport { FormSettings } from \"../form/settings/FormSettings.js\";\nimport { ActionsTable, type ActionsTableProps } from \"../table/actions/ActionsTable.js\";\nimport { SubmissionsTable, type SubmissionsTableProps } from \"../table/submissions/SubmissionsTable.js\";\n\nexport type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {\n form: FormEditProps[\"form\"];\n submissions: SubmissionsTableProps<Data>[\"data\"];\n availableActions: ActionsTableProps[\"availableActions\"];\n actions: ActionsTableProps[\"data\"];\n roles?: FormAccessProps[\"roles\"];\n i18n?:
|
|
1
|
+
{"version":3,"file":"FormViews.js","sources":["../../../src/organisms/views/FormViews.tsx"],"sourcesContent":["import { useI18n } from \"../../hooks/useI18n.js\";\nimport type { FormOptions, FormType, JSON, PermissionsResolver } from \"../../interfaces/index.js\";\nimport type { Tab as DefaultTab } from \"../../molecules/tabs/Tab.js\";\nimport type { TabList as DefaultTabList } from \"../../molecules/tabs/TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"../../molecules/tabs/TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"../../molecules/tabs/Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"../../molecules/tabs/TabsBody.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport { FormAccess, type FormAccessProps } from \"../form/access/FormAccess.js\";\nimport { FormEdit, type FormEditProps } from \"../form/builder/FormEdit.js\";\nimport { FormExport } from \"../form/exports/FormExport.js\";\nimport { FormPreview } from \"../form/preview/FormPreview.js\";\nimport { FormSettings } from \"../form/settings/FormSettings.js\";\nimport { ActionsTable, type ActionsTableProps } from \"../table/actions/ActionsTable.js\";\nimport { SubmissionsTable, type SubmissionsTableProps } from \"../table/submissions/SubmissionsTable.js\";\n\nexport type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {\n form: FormEditProps[\"form\"];\n submissions: SubmissionsTableProps<Data>[\"data\"];\n availableActions: ActionsTableProps[\"availableActions\"];\n actions: ActionsTableProps[\"data\"];\n roles?: FormAccessProps[\"roles\"];\n i18n?: FormOptions[\"i18n\"];\n onAction: () => void;\n permissionsResolver?: PermissionsResolver<Data>;\n};\n\nfunction useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"submission:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"submission:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nfunction useActionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"action:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"action:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nexport function FormViews<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n roles,\n availableActions,\n actions,\n permissionsResolver,\n submissions,\n ...props\n}: FormViewsProps<Data>) {\n const { t } = useI18n(props.i18n);\n const Tabs = getComponent<typeof DefaultTabs>(\"Tabs\");\n const TabList = getComponent<typeof DefaultTabList>(\"TabList\");\n const Tab = getComponent<typeof DefaultTab>(\"Tab\");\n const TabsBody = getComponent<typeof DefaultTabsBody>(\"TabsBody\");\n const TabPanel = getComponent<typeof DefaultTabPanel>(\"TabPanel\");\n const submissionsOperations = useSubmissionsOperations<Data>(permissionsResolver);\n const actionsOperations = useActionsOperations<any>(permissionsResolver);\n\n return (\n <Tabs>\n <TabList>\n <Tab value={0} icon='edit'>\n {t(\"Edit\")}\n </Tab>\n <Tab value={1} icon='data'>\n {t(\"Data\")}\n </Tab>\n <Tab value={2} icon='test-tube'>\n {t(\"Preview\")}\n </Tab>\n <Tab value={3} icon='paper-plane'>\n {t(\"Actions\")}\n </Tab>\n <Tab value={4} icon='lock'>\n {t(\"Access\")}\n </Tab>\n <Tab value={5} icon='download'>\n {t(\"Export\")}\n </Tab>\n <Tab value={6} icon='cog'>\n {t(\"Settings\")}\n </Tab>\n </TabList>\n <TabsBody>\n <TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormEdit form={form} />\n </TabPanel>\n <TabPanel value={1}>\n <SubmissionsTable<Data>\n className={\"border-top-0\"}\n form={form as FormType}\n data={submissions}\n i18n={props.i18n}\n operations={submissionsOperations}\n />\n </TabPanel>\n <TabPanel value={2}>\n <FormPreview form={form as FormType} i18n={props.i18n} />\n </TabPanel>\n <TabPanel value={3}>\n <ActionsTable\n className={\"border-top-0\"}\n availableActions={availableActions}\n data={actions}\n operations={actionsOperations as any}\n i18n={props.i18n}\n />\n </TabPanel>\n <TabPanel value={4} className='pt-3'>\n <FormAccess form={form as FormType} roles={roles} options={props} />\n </TabPanel>\n <TabPanel value={5} className='pt-3'>\n <FormExport i18n={props.i18n} />\n </TabPanel>\n <TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormSettings form={form as FormType} options={{}} />\n </TabPanel>\n </TabsBody>\n </Tabs>\n );\n}\n"],"names":["useSubmissionsOperations","permissionsResolver","useActionsOperations","FormViews","form","roles","availableActions","actions","submissions","props","t","useI18n","Tabs","getComponent","TabList","Tab","TabsBody","TabPanel","submissionsOperations","actionsOperations","jsxs","jsx","FormEdit","SubmissionsTable","FormPreview","ActionsTable","FormAccess","FormExport","FormSettings"],"mappings":";;;;;;;;;;AA2BA,SAASA,EACPC,GACA;AACA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,SAASC,EACPD,GACA;AACA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEO,SAASE,EAA0E;AAAA,EACxF,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,qBAAAN;AAAA,EACA,aAAAO;AAAA,EACA,GAAGC;AACL,GAAyB;AACvB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAQF,EAAM,IAAI,GAC1BG,IAAOC,EAAiC,MAAM,GAC9CC,IAAUD,EAAoC,SAAS,GACvDE,IAAMF,EAAgC,KAAK,GAC3CG,IAAWH,EAAqC,UAAU,GAC1DI,IAAWJ,EAAqC,UAAU,GAC1DK,IAAwBlB,EAA+BC,CAAmB,GAC1EkB,IAAoBjB,EAA0BD,CAAmB;AAEvE,2BACGW,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAQ,EAACN,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAO,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAE,MAAM,GACX;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAE,MAAM,GACX;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,aACjB,UAAAL,EAAE,SAAS,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,eACjB,UAAAL,EAAE,SAAS,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAE,QAAQ,GACb;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,YACjB,UAAAL,EAAE,QAAQ,GACb;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,OACjB,UAAAL,EAAE,UAAU,EAAA,CACf;AAAA,IAAA,GACF;AAAA,sBACCM,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAK,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,wDAC5B,UAAA,gBAAAI,EAACC,GAAA,EAAS,MAAAlB,GAAY,EAAA,CACxB;AAAA,MACA,gBAAAiB,EAACJ,GAAA,EAAS,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,MAAAnB;AAAA,UACA,MAAMI;AAAA,UACN,MAAMC,EAAM;AAAA,UACZ,YAAYS;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,MACA,gBAAAG,EAACJ,GAAA,EAAS,OAAO,GACf,UAAA,gBAAAI,EAACG,KAAY,MAAApB,GAAwB,MAAMK,EAAM,KAAA,CAAM,EAAA,CACzD;AAAA,MACA,gBAAAY,EAACJ,GAAA,EAAS,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,kBAAAnB;AAAA,UACA,MAAMC;AAAA,UACN,YAAYY;AAAA,UACZ,MAAMV,EAAM;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,MACA,gBAAAY,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACK,GAAA,EAAW,MAAAtB,GAAwB,OAAAC,GAAc,SAASI,EAAA,CAAO,GACpE;AAAA,MACA,gBAAAY,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACM,GAAA,EAAW,MAAMlB,EAAM,KAAA,CAAM,EAAA,CAChC;AAAA,MACA,gBAAAY,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,wDAC5B,UAAA,gBAAAI,EAACO,GAAA,EAAa,MAAAxB,GAAwB,SAAS,CAAA,EAAC,CAAG,EAAA,CACrD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
package/dist/utils/iconClass.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return o.current.iconClass(r || o.current.defaultIconset, t, n);
|
|
1
|
+
import { c as t } from "../chunks/index2.js";
|
|
2
|
+
function n(e, r, s) {
|
|
3
|
+
return t.Templates.current.iconClass(e || t.Templates.current.defaultIconset, r, s);
|
|
5
4
|
}
|
|
6
5
|
export {
|
|
7
|
-
|
|
6
|
+
n as iconClass
|
|
8
7
|
};
|
|
9
8
|
//# sourceMappingURL=iconClass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconClass.js","sources":["../../src/utils/iconClass.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"iconClass.js","sources":["../../src/utils/iconClass.ts"],"sourcesContent":["import { Templates } from \"@formio/js\";\n\nexport function iconClass(iconset: string | undefined, name: string, spinning?: boolean): string {\n return Templates.current.iconClass(iconset || Templates.current.defaultIconset, name, spinning);\n}\n"],"names":["iconClass","iconset","name","spinning","Templates"],"mappings":";AAEO,SAASA,EAAUC,GAA6BC,GAAcC,GAA4B;AAC/F,SAAOC,EAAAA,UAAU,QAAQ,UAAUH,KAAWG,EAAAA,UAAU,QAAQ,gBAAgBF,GAAMC,CAAQ;AAChG;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.13",
|
|
4
4
|
"description": "Provide a react formio wrapper. Written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tanstack/react-table": ">=8.20.6",
|
|
47
|
-
"@tsed/tailwind-formio": "3.0.0-alpha.
|
|
48
|
-
"@tsed/typescript": "3.0.0-alpha.
|
|
47
|
+
"@tsed/tailwind-formio": "3.0.0-alpha.13",
|
|
48
|
+
"@tsed/typescript": "3.0.0-alpha.13",
|
|
49
49
|
"microbundle": "0.13.0",
|
|
50
50
|
"vite": "7.1.5",
|
|
51
51
|
"vitest": "3.2.4"
|
package/src/all.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "./atoms/icon/Icon";
|
|
2
|
+
import "./molecules/tabs/Tab";
|
|
3
|
+
import "./molecules/tabs/TabList";
|
|
4
|
+
import "./molecules/tabs/TabPanel";
|
|
5
|
+
import "./molecules/tabs/Tabs";
|
|
6
|
+
import "./molecules/tabs/TabsBody";
|
|
7
|
+
import "./molecules/button/Button";
|
|
8
|
+
import "./molecules/forms/input-text/InputText";
|
|
9
|
+
import "./molecules/forms/select/Select";
|
|
10
|
+
import "./molecules/forms/select/components/HtmlSelect";
|
|
11
|
+
import "./molecules/forms/select/components/ChoicesSelect";
|
|
12
|
+
import "./molecules/forms/select/components/ReactSelect";
|
|
13
|
+
import "./molecules/forms/input-tags/InputTags";
|
|
14
|
+
import "./molecules/forms/input-tags/components/ReactTags";
|
|
15
|
+
import "./molecules/forms/input-tags/components/ChoicesTags";
|
|
16
|
+
import "./molecules/pagination/Pagination";
|
|
17
|
+
import "./molecules/pagination/PaginationButton";
|
|
18
|
+
import "./organisms/form/builder/FormBuilder";
|
|
19
|
+
import "./organisms/form/builder/FormEdit";
|
|
20
|
+
import "./organisms/form/builder/FormEditCtas";
|
|
21
|
+
import "./organisms/form/builder/FormParameters";
|
|
22
|
+
import "./organisms/form/builder/useFormBuilder";
|
|
23
|
+
import "./organisms/form/builder/useFormEdit";
|
|
24
|
+
import "./molecules/forms/input-tags/InputTags.interface";
|
|
25
|
+
import "./molecules/table/components/DefaultFilter";
|
|
26
|
+
import "./molecules/table/components/DefaultArrowSort";
|
|
27
|
+
import "./molecules/table/components/DefaultCell";
|
|
28
|
+
import "./molecules/table/components/DefaultCellOperations";
|
|
29
|
+
import "./molecules/table/components/DefaultOperationButton";
|
|
30
|
+
import "./molecules/table/components/DefaultCellHeader";
|
|
31
|
+
import "./molecules/table/components/DefaultCellFooter";
|
|
32
|
+
import "./molecules/table/filters/TextFieldFilter";
|
|
33
|
+
import "./molecules/table/filters/SelectFilter";
|
|
34
|
+
import "./molecules/table/filters/RangeFilter";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Formio as ImportedFormio } from "@formio/js";
|
|
2
|
+
import { createContext, useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
type BaseConfigurationArgs = {
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
projectUrl?: string;
|
|
7
|
+
Formio?: typeof ImportedFormio;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const useBaseConfiguration = ({ baseUrl, projectUrl, Formio }: BaseConfigurationArgs) => {
|
|
11
|
+
if (!Formio) {
|
|
12
|
+
if (baseUrl) {
|
|
13
|
+
ImportedFormio.setBaseUrl(baseUrl);
|
|
14
|
+
}
|
|
15
|
+
if (projectUrl) {
|
|
16
|
+
ImportedFormio.setProjectUrl(projectUrl);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
Formio: ImportedFormio,
|
|
20
|
+
baseUrl: ImportedFormio.baseUrl,
|
|
21
|
+
projectUrl: ImportedFormio.projectUrl
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (baseUrl) {
|
|
26
|
+
Formio.setBaseUrl(baseUrl);
|
|
27
|
+
}
|
|
28
|
+
if (projectUrl) {
|
|
29
|
+
Formio.setProjectUrl(projectUrl);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
Formio,
|
|
34
|
+
baseUrl: Formio.baseUrl,
|
|
35
|
+
projectUrl: Formio.projectUrl
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const useAuthentication = ({ Formio }: { Formio: typeof ImportedFormio }) => {
|
|
40
|
+
const [token, setToken] = useState(Formio.getToken() || null);
|
|
41
|
+
const [isAuthenticated, setIsAuthenticated] = useState(!!token);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const handleUserEvent = async (user: unknown) => {
|
|
45
|
+
if (user) {
|
|
46
|
+
setToken(Formio.getToken());
|
|
47
|
+
setIsAuthenticated(true);
|
|
48
|
+
} else if (isAuthenticated) {
|
|
49
|
+
await Formio.logout();
|
|
50
|
+
setToken(null);
|
|
51
|
+
setIsAuthenticated(false);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleStaleToken = async () => {
|
|
56
|
+
if (isAuthenticated) {
|
|
57
|
+
const user = await Formio.currentUser();
|
|
58
|
+
if (!user) {
|
|
59
|
+
setToken(null);
|
|
60
|
+
setIsAuthenticated(false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Formio.events.on("formio.user", handleUserEvent);
|
|
66
|
+
handleStaleToken();
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
Formio.events.off("formio.user", handleUserEvent);
|
|
70
|
+
};
|
|
71
|
+
}, [isAuthenticated, Formio]);
|
|
72
|
+
|
|
73
|
+
const logout = async () => {
|
|
74
|
+
await Formio.logout();
|
|
75
|
+
setToken(null);
|
|
76
|
+
setIsAuthenticated(false);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return { token, setToken, isAuthenticated, logout };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const FormioContext = createContext<(ReturnType<typeof useBaseConfiguration> & ReturnType<typeof useAuthentication>) | null>(null);
|
|
83
|
+
|
|
84
|
+
export function FormioProvider({
|
|
85
|
+
children,
|
|
86
|
+
baseUrl,
|
|
87
|
+
projectUrl,
|
|
88
|
+
Formio
|
|
89
|
+
}: {
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
} & BaseConfigurationArgs) {
|
|
92
|
+
const baseConfig = useBaseConfiguration({ baseUrl, projectUrl, Formio });
|
|
93
|
+
const auth = useAuthentication({ Formio: baseConfig.Formio });
|
|
94
|
+
const formio = { ...baseConfig, ...auth };
|
|
95
|
+
return <FormioContext.Provider value={formio}>{children}</FormioContext.Provider>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
|
|
3
|
+
import { FormioContext } from "../contexts/FormioContext";
|
|
4
|
+
|
|
5
|
+
export function useFormioContext() {
|
|
6
|
+
const context = useContext(FormioContext);
|
|
7
|
+
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("useFormioContext must be used within a FormioProvider component.");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return context;
|
|
13
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import WebformBuilder from "formiojs/WebformBuilder";
|
|
3
|
-
import Wizard from "formiojs/Wizard";
|
|
4
|
-
import WizardBuilder from "formiojs/WizardBuilder";
|
|
5
|
-
|
|
1
|
+
export * from "./interfaces";
|
|
6
2
|
export {
|
|
3
|
+
Builders,
|
|
4
|
+
Components,
|
|
5
|
+
DefaultEvaluator,
|
|
6
|
+
Displays,
|
|
7
|
+
EventEmitter,
|
|
8
|
+
Form,
|
|
9
|
+
FormBuilder,
|
|
10
|
+
Formio,
|
|
11
|
+
Licenses,
|
|
12
|
+
Providers,
|
|
13
|
+
registerModule,
|
|
14
|
+
Templates,
|
|
15
|
+
useModule,
|
|
16
|
+
Utils,
|
|
7
17
|
Webform,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
WizardBuilder
|
|
11
|
-
// editFormUtils,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export * from "./interfaces";
|
|
15
|
-
export { Components, Formio, Templates, Utils } from "formiojs";
|
|
18
|
+
Widgets
|
|
19
|
+
} from "@formio/js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Component } from "@formio/core";
|
|
2
2
|
|
|
3
|
-
export type ComponentType =
|
|
3
|
+
export type ComponentType = Omit<Component, "components"> & { components?: ComponentType[] } & { title?: string } & Record<string, unknown>;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EventEmitter, Form } from "@formio/js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
saveDraft?: boolean;
|
|
10
|
-
events?: EventEmitter2;
|
|
11
|
-
hooks?: {
|
|
12
|
-
customValidation?: Function;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
3
|
+
import type { FormType } from "./FormType.js";
|
|
4
|
+
|
|
5
|
+
export type FormOptions = Form["options"] & {
|
|
6
|
+
events?: EventEmitter;
|
|
7
|
+
currentForm?: FormType;
|
|
8
|
+
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Form } from "@formio/core";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name?: string;
|
|
7
|
-
machineName?: string;
|
|
3
|
+
import type { ComponentType } from "./ComponentType.js";
|
|
4
|
+
|
|
5
|
+
export type FormType = Omit<Form, "components"> & {
|
|
8
6
|
components: ComponentType[];
|
|
9
|
-
|
|
10
|
-
action?: string;
|
|
11
|
-
properties?: Record<string, any>;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
7
|
+
} & Record<string, unknown>;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component, Submission } from "@formio/core";
|
|
2
2
|
|
|
3
3
|
export type JSON = unknown | string | number | boolean | null | undefined | JSON[] | { [key: string]: JSON };
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
_id?: string;
|
|
5
|
+
export type SubmissionType<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = Omit<Partial<Submission>, "data"> & {
|
|
7
6
|
data: Data;
|
|
8
|
-
|
|
9
|
-
state?: string;
|
|
10
|
-
}
|
|
7
|
+
};
|
|
11
8
|
|
|
12
|
-
export interface ChangedSubmission<
|
|
9
|
+
export interface ChangedSubmission<
|
|
10
|
+
Data extends { [key: string]: JSON } = {
|
|
11
|
+
[key: string]: JSON;
|
|
12
|
+
}
|
|
13
|
+
> extends SubmissionType<Data> {
|
|
13
14
|
data: Data;
|
|
14
15
|
changed?: {
|
|
15
|
-
component:
|
|
16
|
+
component: Component;
|
|
16
17
|
instance: any;
|
|
17
18
|
value: unknown;
|
|
18
19
|
} & Record<string, JSON>;
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Formio } from "@formio/js";
|
|
1
2
|
import { render, screen } from "@testing-library/react";
|
|
2
3
|
|
|
3
4
|
import { iconClass } from "../../../utils/iconClass";
|
|
4
5
|
import { FormControl } from "./FormControl";
|
|
5
6
|
import { Sandbox } from "./FormControl.stories";
|
|
6
7
|
|
|
8
|
+
Formio.setProjectUrl("https://api.form.io");
|
|
9
|
+
|
|
7
10
|
describe("form-control", () => {
|
|
8
11
|
it("should display form control component", () => {
|
|
9
12
|
render(<FormControl {...Sandbox.args} name='test' />);
|
|
@@ -34,7 +37,7 @@ describe("form-control", () => {
|
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
it("should display prefix", () => {
|
|
37
|
-
const fontAwsomeCalendarIcon = "
|
|
40
|
+
const fontAwsomeCalendarIcon = "bi bi-calendar";
|
|
38
41
|
const prefix = (<i className={iconClass(undefined, "calendar")} />) as JSX.Element;
|
|
39
42
|
render(<FormControl {...Sandbox.args} name='testPrefix' before={prefix} />);
|
|
40
43
|
|
|
@@ -48,7 +51,7 @@ describe("form-control", () => {
|
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
it("should display suffix", () => {
|
|
51
|
-
const fontAwsomeCalendarIcon = "
|
|
54
|
+
const fontAwsomeCalendarIcon = "bi bi-calendar";
|
|
52
55
|
const suffix = (<i className={iconClass(undefined, "calendar")} />) as JSX.Element;
|
|
53
56
|
render(<FormControl {...Sandbox.args} name='testSuffix' after={suffix} />);
|
|
54
57
|
|