@tsed/react-formio 3.0.0-rc.2 → 3.0.0-rc.20
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.js +2 -0
- package/dist/all.js.map +1 -1
- package/dist/chunks/_baseGet.js +102 -0
- package/dist/chunks/_baseGet.js.map +1 -0
- package/dist/chunks/_baseSlice.js +12 -65
- package/dist/chunks/_baseSlice.js.map +1 -1
- package/dist/chunks/camelCase.js +1 -1
- package/dist/chunks/get.js +16 -0
- package/dist/chunks/get.js.map +1 -0
- package/dist/chunks/index2.js +19746 -22285
- package/dist/chunks/index2.js.map +1 -1
- package/dist/chunks/moment.js +2535 -0
- package/dist/chunks/moment.js.map +1 -0
- package/dist/chunks/omit.js +173 -268
- package/dist/chunks/omit.js.map +1 -1
- package/dist/chunks/toString.js +56 -0
- package/dist/chunks/toString.js.map +1 -0
- package/dist/interfaces/JSONRecord.d.ts +4 -0
- package/dist/interfaces/JSONRecord.js +2 -0
- package/dist/interfaces/JSONRecord.js.map +1 -0
- package/dist/interfaces/Operation.d.ts +3 -12
- package/dist/interfaces/SubmissionType.d.ts +4 -14
- package/dist/interfaces/index.d.ts +0 -1
- package/dist/molecules/forms/select/Select.interface.d.ts +0 -4
- package/dist/molecules/table/Table.d.ts +4 -12
- package/dist/molecules/table/Table.js +34 -33
- package/dist/molecules/table/Table.js.map +1 -1
- package/dist/molecules/table/all.js +2 -0
- package/dist/molecules/table/all.js.map +1 -1
- package/dist/molecules/table/components/DefaultBooleanCell.d.ts +2 -0
- package/dist/molecules/table/components/DefaultBooleanCell.js +12 -0
- package/dist/molecules/table/components/DefaultBooleanCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultCell.d.ts +2 -5
- package/dist/molecules/table/components/DefaultCell.js +8 -6
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +4 -11
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
- package/dist/molecules/table/components/DefaultDateCell.d.ts +2 -0
- package/dist/molecules/table/components/DefaultDateCell.js +16 -0
- package/dist/molecules/table/components/DefaultDateCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultFilter.d.ts +5 -7
- package/dist/molecules/table/components/DefaultFilter.js +8 -8
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -1
- package/dist/molecules/table/components/DefaultOperationButton.d.ts +4 -11
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
- package/dist/molecules/table/filters/SelectFilter.js +22 -20
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -1
- package/dist/molecules/table/filters/TextFieldFilter.js +16 -16
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -1
- package/dist/molecules/table/hooks/useTable.d.ts +4 -11
- package/dist/molecules/table/hooks/useTable.js +14 -14
- package/dist/molecules/table/hooks/useTable.js.map +1 -1
- package/dist/molecules/table/hooks/useUniqValues.d.ts +8 -5
- package/dist/molecules/table/hooks/useUniqValues.js +23 -7
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -1
- package/dist/molecules/table/interfaces/extends.d.ts +3 -0
- package/dist/molecules/table/utils/mapFormToColumns.d.ts +5 -1
- package/dist/molecules/table/utils/mapFormToColumns.js +53 -26
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/organisms/form/Form.d.ts +3 -11
- package/dist/organisms/form/Form.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +5 -5
- package/dist/organisms/form/types.d.ts +1 -9
- package/dist/organisms/form/useForm.d.ts +4 -11
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/table/forms/components/FormsCell.js +1 -1
- package/dist/organisms/table/submissions/SubmissionsTable.d.ts +4 -11
- package/dist/organisms/table/submissions/SubmissionsTable.js +2 -5
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
- package/dist/organisms/views/FormViews.d.ts +4 -11
- package/dist/organisms/views/FormViews.js.map +1 -1
- package/package.json +3 -3
- package/src/all.ts +2 -0
- package/src/interfaces/JSONRecord.ts +2 -0
- package/src/interfaces/Operation.ts +3 -6
- package/src/interfaces/SubmissionType.ts +4 -8
- package/src/interfaces/index.ts +0 -1
- package/src/molecules/forms/select/Select.interface.ts +0 -4
- package/src/molecules/table/Table.stories.tsx +101 -66
- package/src/molecules/table/Table.tsx +57 -56
- package/src/molecules/table/all.ts +2 -0
- package/src/molecules/table/components/DefaultBooleanCell.spec.tsx +42 -0
- package/src/molecules/table/components/DefaultBooleanCell.tsx +11 -0
- package/src/molecules/table/components/DefaultCell.spec.tsx +32 -0
- package/src/molecules/table/components/DefaultCell.tsx +8 -9
- package/src/molecules/table/components/DefaultCellOperations.tsx +4 -3
- package/src/molecules/table/components/DefaultDateCell.spec.tsx +43 -0
- package/src/molecules/table/components/DefaultDateCell.tsx +23 -0
- package/src/molecules/table/components/DefaultFilter.tsx +10 -7
- package/src/molecules/table/components/DefaultOperationButton.tsx +4 -4
- package/src/molecules/table/filters/Filters.d.ts +3 -1
- package/src/molecules/table/filters/SelectFilter.tsx +5 -3
- package/src/molecules/table/filters/TextFieldFilter.tsx +5 -3
- package/src/molecules/table/hooks/useTable.tsx +8 -13
- package/src/molecules/table/hooks/useUniqValues.spec.tsx +82 -0
- package/src/molecules/table/hooks/useUniqValues.tsx +42 -6
- package/src/molecules/table/interfaces/extends.ts +3 -0
- package/src/molecules/table/utils/mapFormToColumns.spec.tsx +116 -0
- package/src/molecules/table/utils/mapFormToColumns.tsx +66 -26
- package/src/organisms/form/Form.stories.tsx +7 -2
- package/src/organisms/form/Form.tsx +3 -3
- package/src/organisms/form/types.ts +1 -6
- package/src/organisms/form/useForm.ts +6 -5
- package/src/organisms/table/submissions/SubmissionsTable.tsx +5 -10
- package/src/organisms/views/FormViews.tsx +6 -9
- package/dist/interfaces/QueryOptions.d.ts +0 -23
- package/dist/interfaces/QueryOptions.js +0 -2
- package/dist/interfaces/QueryOptions.js.map +0 -1
- package/src/interfaces/QueryOptions.ts +0 -24
|
@@ -2,13 +2,14 @@ import { Form } from "@formio/js";
|
|
|
2
2
|
import { EventEmitter2 } from "eventemitter2";
|
|
3
3
|
import { type MutableRefObject, useEffect, useRef, useState } from "react";
|
|
4
4
|
|
|
5
|
-
import type { ChangedSubmission, ComponentType, FormOptions, FormType,
|
|
5
|
+
import type { ChangedSubmission, ComponentType, FormOptions, FormType, SubmissionType } from "../../interfaces";
|
|
6
|
+
import type { JSON, JSONRecord } from "../../interfaces/JSONRecord.js";
|
|
6
7
|
import { FormCustomEvent } from "./types";
|
|
7
8
|
|
|
8
9
|
type Webform = any;
|
|
9
10
|
type EventError = string | Error | Error[] | { message: string } | { message: string }[];
|
|
10
11
|
|
|
11
|
-
export interface UseFormProps<Data extends
|
|
12
|
+
export interface UseFormProps<Data extends object = JSONRecord> {
|
|
12
13
|
src?: string;
|
|
13
14
|
url?: string;
|
|
14
15
|
form?: FormType;
|
|
@@ -54,7 +55,7 @@ const getDefaultEmitter = () => {
|
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
|
|
57
|
-
function onAnyEvent<Data extends
|
|
58
|
+
function onAnyEvent<Data extends object = JSONRecord>(
|
|
58
59
|
handlers: Omit<UseFormProps<Data>, "src" | "url" | "form" | "submission" | "options" | "formReady" | "formioform" | "Formio">,
|
|
59
60
|
...args: [string, ...any[]]
|
|
60
61
|
) {
|
|
@@ -95,7 +96,7 @@ const createWebformInstance = async (
|
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
// Define effective props (aka I want to rename these props but also maintain backwards compatibility)
|
|
98
|
-
function getEffectiveProps<Data extends
|
|
99
|
+
function getEffectiveProps<Data extends object = JSONRecord>(props: UseFormProps<Data>) {
|
|
99
100
|
const { FormClass = Form, form, src, url, options, submission, onFormReady, onAsyncSubmit, ...handlers } = props;
|
|
100
101
|
|
|
101
102
|
return {
|
|
@@ -126,7 +127,7 @@ function createCustomValidation(customAction: any, ref: MutableRefObject<Webform
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
export function useForm<Data extends
|
|
130
|
+
export function useForm<Data extends object = JSONRecord>(props: UseFormProps<Data>) {
|
|
130
131
|
const webformRef = useRef<Webform | null>(null);
|
|
131
132
|
const renderElement = useRef<HTMLDivElement | null>(null);
|
|
132
133
|
const { formSource, FormClass, options, url, submission, handlers, onFormReady, onAsyncSubmit } = getEffectiveProps(props);
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import type { FormType,
|
|
1
|
+
import type { FormType, SubmissionType } from "../../../interfaces";
|
|
2
|
+
import type { JSONRecord } from "../../../interfaces/JSONRecord";
|
|
2
3
|
import { Table, type TableProps } from "../../../molecules/table/Table";
|
|
3
4
|
import { mapFormToColumns } from "../../../molecules/table/utils/mapFormToColumns.js";
|
|
4
5
|
|
|
5
|
-
export type SubmissionsTableProps<Data extends
|
|
6
|
-
TableProps<SubmissionType<Data>>,
|
|
7
|
-
"columns"
|
|
8
|
-
> & {
|
|
6
|
+
export type SubmissionsTableProps<Data extends object = JSONRecord> = Omit<TableProps<SubmissionType<Data>>, "columns"> & {
|
|
9
7
|
form?: FormType;
|
|
10
8
|
};
|
|
11
9
|
|
|
12
|
-
export function SubmissionsTable<Data extends
|
|
13
|
-
form
|
|
14
|
-
...props
|
|
15
|
-
}: SubmissionsTableProps<Data>) {
|
|
16
|
-
const columns: any[] | undefined = form && mapFormToColumns(form);
|
|
10
|
+
export function SubmissionsTable<Data extends object = JSONRecord>({ form, ...props }: SubmissionsTableProps<Data>) {
|
|
11
|
+
const columns: any[] | undefined = form && mapFormToColumns({ form: form });
|
|
17
12
|
|
|
18
13
|
return <Table {...(props as any)} columns={columns!} />;
|
|
19
14
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useI18n } from "../../hooks/useI18n.js";
|
|
2
|
-
import type { FormOptions, FormType,
|
|
2
|
+
import type { FormOptions, FormType, PermissionsResolver } from "../../interfaces/index.js";
|
|
3
|
+
import type { JSONRecord } from "../../interfaces/JSONRecord.js";
|
|
3
4
|
import type { Tab as DefaultTab } from "../../molecules/tabs/Tab.js";
|
|
4
5
|
import type { TabList as DefaultTabList } from "../../molecules/tabs/TabList.js";
|
|
5
6
|
import type { TabPanel as DefaultTabPanel } from "../../molecules/tabs/TabPanel.js";
|
|
@@ -14,7 +15,7 @@ import { FormSettings } from "../form/settings/FormSettings.js";
|
|
|
14
15
|
import { ActionsTable, type ActionsTableProps } from "../table/actions/ActionsTable.js";
|
|
15
16
|
import { SubmissionsTable, type SubmissionsTableProps } from "../table/submissions/SubmissionsTable.js";
|
|
16
17
|
|
|
17
|
-
export type FormViewsProps<Data extends
|
|
18
|
+
export type FormViewsProps<Data extends object = JSONRecord> = {
|
|
18
19
|
form: FormEditProps["form"];
|
|
19
20
|
submissions: SubmissionsTableProps<Data>["data"];
|
|
20
21
|
availableActions: ActionsTableProps["availableActions"];
|
|
@@ -25,9 +26,7 @@ export type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string
|
|
|
25
26
|
permissionsResolver?: PermissionsResolver<Data>;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
function useSubmissionsOperations<Data extends
|
|
29
|
-
permissionsResolver?: PermissionsResolver<Data>
|
|
30
|
-
) {
|
|
29
|
+
function useSubmissionsOperations<Data extends object = JSONRecord>(permissionsResolver?: PermissionsResolver<Data>) {
|
|
31
30
|
return [
|
|
32
31
|
{
|
|
33
32
|
title: "Edit",
|
|
@@ -45,9 +44,7 @@ function useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key:
|
|
|
45
44
|
] as SubmissionsTableProps<Data>["operations"];
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
function useActionsOperations<Data extends
|
|
49
|
-
permissionsResolver?: PermissionsResolver<Data>
|
|
50
|
-
) {
|
|
47
|
+
function useActionsOperations<Data extends object = JSONRecord>(permissionsResolver?: PermissionsResolver<Data>) {
|
|
51
48
|
return [
|
|
52
49
|
{
|
|
53
50
|
title: "Edit",
|
|
@@ -65,7 +62,7 @@ function useActionsOperations<Data extends { [key: string]: JSON } = { [key: str
|
|
|
65
62
|
] as SubmissionsTableProps<Data>["operations"];
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
export function FormViews<Data extends
|
|
65
|
+
export function FormViews<Data extends object = JSONRecord>({
|
|
69
66
|
form,
|
|
70
67
|
roles,
|
|
71
68
|
availableActions,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ColumnIdentifier } from './ColumnIdentifier';
|
|
2
|
-
export type QueryOptions = {
|
|
3
|
-
/**
|
|
4
|
-
* Current displayed page
|
|
5
|
-
*/
|
|
6
|
-
pageIndex: any;
|
|
7
|
-
/**
|
|
8
|
-
* Pagination size
|
|
9
|
-
*/
|
|
10
|
-
pageSize: any;
|
|
11
|
-
/**
|
|
12
|
-
* SortBy state
|
|
13
|
-
*/
|
|
14
|
-
sortBy: ColumnIdentifier[];
|
|
15
|
-
/**
|
|
16
|
-
* Filters state
|
|
17
|
-
*/
|
|
18
|
-
filters: ColumnIdentifier[];
|
|
19
|
-
/**
|
|
20
|
-
* Focused input filter (let the Table component retrieve focus state when we fill the filter)
|
|
21
|
-
*/
|
|
22
|
-
filterId: string;
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryOptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ColumnIdentifier } from "./ColumnIdentifier";
|
|
2
|
-
|
|
3
|
-
export type QueryOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* Current displayed page
|
|
6
|
-
*/
|
|
7
|
-
pageIndex: any;
|
|
8
|
-
/**
|
|
9
|
-
* Pagination size
|
|
10
|
-
*/
|
|
11
|
-
pageSize: any;
|
|
12
|
-
/**
|
|
13
|
-
* SortBy state
|
|
14
|
-
*/
|
|
15
|
-
sortBy: ColumnIdentifier[];
|
|
16
|
-
/**
|
|
17
|
-
* Filters state
|
|
18
|
-
*/
|
|
19
|
-
filters: ColumnIdentifier[];
|
|
20
|
-
/**
|
|
21
|
-
* Focused input filter (let the Table component retrieve focus state when we fill the filter)
|
|
22
|
-
*/
|
|
23
|
-
filterId: string;
|
|
24
|
-
};
|