@tsed/react-formio 1.10.8 → 1.10.12
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/.eslintrc +7 -2
- package/dist/components/form/form.component.d.ts +2 -44
- package/dist/components/form/useForm.hook.d.ts +56 -1
- package/dist/components/form-action/formAction.component.d.ts +1 -1
- package/dist/components/form-edit/formEdit.component.d.ts +4 -15
- package/dist/components/form-edit/useFormEdit.hook.d.ts +29 -0
- package/dist/index.js +7368 -7146
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +7292 -7066
- package/dist/index.modern.js.map +1 -1
- package/package.json +12 -12
- package/readme.md +81 -55
- package/src/components/actions-table/actionsTable.component.spec.tsx +15 -17
- package/src/components/actions-table/actionsTable.component.tsx +1 -0
- package/src/components/card/card.component.spec.tsx +2 -2
- package/src/components/card/card.component.tsx +2 -4
- package/src/components/form/form.component.tsx +3 -47
- package/src/components/form/useForm.hook.ts +62 -8
- package/src/components/form-access/formAccess.component.tsx +2 -1
- package/src/components/form-action/formAction.component.tsx +1 -1
- package/src/components/form-builder/formBuilder.component.tsx +2 -0
- package/src/components/form-edit/formEdit.component.tsx +5 -11
- package/src/components/form-edit/{useForm.hook.ts → useFormEdit.hook.ts} +8 -14
- package/src/components/form-settings/formSettings.component.tsx +3 -1
- package/src/components/forms-table/components/formCell.component.tsx +2 -2
- package/src/components/input-text/inputText.component.tsx +1 -1
- package/src/components/loader/loader.component.spec.tsx +2 -2
- package/src/components/loader/loader.component.tsx +1 -1
- package/src/components/modal/modal.component.spec.tsx +3 -3
- package/src/components/modal/modal.component.tsx +6 -1
- package/src/components/modal/modal.stories.tsx +5 -21
- package/src/components/modal/removeModal.component.tsx +1 -1
- package/src/components/react-component/reactComponent.component.tsx +1 -0
- package/src/components/select/select.component.tsx +1 -1
- package/src/components/table/components/defaultOperationButton.component.tsx +2 -2
- package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +2 -2
- package/src/components/table/table.component.tsx +16 -5
- package/src/components/tabs/tabs.component.stories.tsx +1 -1
- package/dist/components/form-edit/useForm.hook.d.ts +0 -16
package/.eslintrc
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"prettier/react",
|
|
8
8
|
"plugin:@typescript-eslint/recommended",
|
|
9
9
|
"prettier/@typescript-eslint",
|
|
10
|
-
"plugin:prettier/recommended"
|
|
10
|
+
"plugin:prettier/recommended",
|
|
11
|
+
"plugin:react/recommended",
|
|
12
|
+
"plugin:jsx-a11y/recommended"
|
|
11
13
|
],
|
|
12
14
|
"env": {
|
|
13
15
|
"node": true,
|
|
@@ -31,12 +33,15 @@
|
|
|
31
33
|
"react/prop-types": 0,
|
|
32
34
|
"react/jsx-handler-names": 0,
|
|
33
35
|
"react/jsx-fragments": 0,
|
|
36
|
+
"react/no-unescaped-entities": 0,
|
|
34
37
|
"react/no-unused-prop-types": 0,
|
|
38
|
+
"react/display-name": 1,
|
|
35
39
|
"no-unused-vars": "off",
|
|
36
40
|
"@typescript-eslint/no-explicit-any": 0,
|
|
37
41
|
"@typescript-eslint/explicit-function-return-type": 0,
|
|
38
42
|
"@typescript-eslint/camelcase": 0,
|
|
39
43
|
"@typescript-eslint/no-empty-function": 0,
|
|
40
|
-
"import/export": 0
|
|
44
|
+
"import/export": 0,
|
|
45
|
+
"jsx-a11y/no-autofocus": 1
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -1,54 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import {
|
|
4
|
-
export interface
|
|
5
|
-
changed: any;
|
|
6
|
-
isValid: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface FormProps {
|
|
3
|
+
import { UseFormHookProps } from "./useForm.hook";
|
|
4
|
+
export interface FormProps<Data = any> extends UseFormHookProps<Data> {
|
|
9
5
|
name?: string;
|
|
10
6
|
/**
|
|
11
7
|
*
|
|
12
8
|
*/
|
|
13
9
|
className?: string;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
src?: string;
|
|
18
|
-
/**
|
|
19
|
-
* url to fetch form
|
|
20
|
-
*/
|
|
21
|
-
url?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Raw form object
|
|
24
|
-
*/
|
|
25
|
-
form: Partial<FormSchema>;
|
|
26
|
-
/**
|
|
27
|
-
* Data submission
|
|
28
|
-
*/
|
|
29
|
-
submission?: Submission;
|
|
30
|
-
/**
|
|
31
|
-
* Configuration option
|
|
32
|
-
*/
|
|
33
|
-
options?: FormOptions;
|
|
34
|
-
onPrevPage?: Function;
|
|
35
|
-
onNextPage?: Function;
|
|
36
|
-
onCancel?: Function;
|
|
37
|
-
onChange?: (submission: ChangedSubmission) => void;
|
|
38
|
-
onCustomEvent?: Function;
|
|
39
|
-
onComponentChange?: Function;
|
|
40
|
-
onSubmit?: Function;
|
|
41
|
-
onSubmitDone?: Function;
|
|
42
|
-
onFormLoad?: Function;
|
|
43
|
-
onError?: Function;
|
|
44
|
-
onRender?: Function;
|
|
45
|
-
onAttach?: Function;
|
|
46
|
-
onBuild?: Function;
|
|
47
|
-
onFocus?: Function;
|
|
48
|
-
onBlur?: Function;
|
|
49
|
-
onInitialized?: Function;
|
|
50
|
-
onFormReady?: (formio: any) => void;
|
|
51
|
-
formioform?: any;
|
|
52
10
|
}
|
|
53
11
|
export declare function Form(props: Partial<FormProps>): JSX.Element;
|
|
54
12
|
export declare namespace Form {
|
|
@@ -1 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ExtendedComponentSchema, Form } from "formiojs";
|
|
3
|
+
import { FormOptions, FormSchema, Submission } from "../../interfaces";
|
|
4
|
+
export interface ChangedSubmission<T = any> extends Submission<T> {
|
|
5
|
+
changed: any;
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface FormPageChangeProps<Data = any> {
|
|
9
|
+
page: number;
|
|
10
|
+
submission: Submission<Data>;
|
|
11
|
+
}
|
|
12
|
+
export interface UseFormHookProps<Data = any> extends Record<string, any> {
|
|
13
|
+
src?: string;
|
|
14
|
+
/**
|
|
15
|
+
* url to fetch form
|
|
16
|
+
*/
|
|
17
|
+
url?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Raw form object
|
|
20
|
+
*/
|
|
21
|
+
form?: Partial<FormSchema>;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration option
|
|
24
|
+
*/
|
|
25
|
+
options?: FormOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Data submission
|
|
28
|
+
*/
|
|
29
|
+
submission?: Submission<Data>;
|
|
30
|
+
onPrevPage?: (obj: FormPageChangeProps<Data>) => void;
|
|
31
|
+
onNextPage?: (obj: FormPageChangeProps<Data>) => void;
|
|
32
|
+
onCancel?: Function;
|
|
33
|
+
onChange?: (submission: ChangedSubmission) => void;
|
|
34
|
+
onCustomEvent?: (obj: {
|
|
35
|
+
type: string;
|
|
36
|
+
event: string;
|
|
37
|
+
component: ExtendedComponentSchema;
|
|
38
|
+
data: any;
|
|
39
|
+
}) => void;
|
|
40
|
+
onComponentChange?: (component: ExtendedComponentSchema) => void;
|
|
41
|
+
onSubmit?: (submission: Submission<Data>) => void;
|
|
42
|
+
onSubmitDone?: (submission: Submission<Data>) => void;
|
|
43
|
+
onFormLoad?: Function;
|
|
44
|
+
onError?: (errors: any) => void;
|
|
45
|
+
onRender?: () => void;
|
|
46
|
+
onAttach?: Function;
|
|
47
|
+
onBuild?: Function;
|
|
48
|
+
onFocus?: Function;
|
|
49
|
+
onBlur?: Function;
|
|
50
|
+
onInitialized?: Function;
|
|
51
|
+
onFormReady?: (formio: Form) => void;
|
|
52
|
+
formioform?: any;
|
|
53
|
+
}
|
|
54
|
+
export declare function useForm<Data = any>(props: UseFormHookProps<Data>): {
|
|
55
|
+
element: import("react").MutableRefObject<any>;
|
|
56
|
+
};
|
|
@@ -3,7 +3,7 @@ import { ActionSchema, FormOptions, Submission } from "../../interfaces";
|
|
|
3
3
|
export interface FormActionProps {
|
|
4
4
|
actionInfo: Partial<ActionSchema>;
|
|
5
5
|
submission?: Partial<Submission>;
|
|
6
|
-
onSubmit?:
|
|
6
|
+
onSubmit?: (submission: Submission<ActionSchema>) => void;
|
|
7
7
|
options: FormOptions;
|
|
8
8
|
}
|
|
9
9
|
export declare function FormAction({ actionInfo, children, onSubmit, options, ...props }: PropsWithChildren<FormActionProps>): ReactElement;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { FormOptions
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
options?: FormOptions;
|
|
7
|
-
typeChoices?: {
|
|
8
|
-
label: string;
|
|
9
|
-
value: any;
|
|
10
|
-
}[];
|
|
11
|
-
displayChoices?: {
|
|
12
|
-
label: string;
|
|
13
|
-
value: any;
|
|
14
|
-
}[];
|
|
15
|
-
enableTags?: boolean;
|
|
16
|
-
onSubmit?: (form: FormSchema) => void;
|
|
17
|
-
onCopy?: (form: FormSchema) => void;
|
|
3
|
+
import { FormOptions } from "../../interfaces/FormOptions";
|
|
4
|
+
import { UseFormEditHookProps } from "./useFormEdit.hook";
|
|
5
|
+
export interface FormEditProps extends UseFormEditHookProps {
|
|
18
6
|
builder?: any;
|
|
7
|
+
options?: FormOptions;
|
|
19
8
|
}
|
|
20
9
|
export declare function FormEdit(props: FormEditProps): JSX.Element;
|
|
21
10
|
export declare namespace FormEdit {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormSchema } from "../../interfaces/FormSchema";
|
|
2
|
+
export interface UseFormEditHookProps extends Record<string, unknown> {
|
|
3
|
+
form?: Partial<FormSchema>;
|
|
4
|
+
typeChoices?: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}[];
|
|
8
|
+
displayChoices?: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: any;
|
|
11
|
+
}[];
|
|
12
|
+
enableTags?: boolean;
|
|
13
|
+
onSubmit?: (form: Partial<FormSchema>) => void;
|
|
14
|
+
onCopy?: (form: Partial<FormSchema>) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useFormEdit(props: UseFormEditHookProps): {
|
|
17
|
+
form: Partial<FormSchema>;
|
|
18
|
+
redo: () => void;
|
|
19
|
+
undo: () => void;
|
|
20
|
+
reset: () => void;
|
|
21
|
+
hasChanged: boolean;
|
|
22
|
+
isValid: any;
|
|
23
|
+
hasUndo: boolean;
|
|
24
|
+
hasRedo: boolean;
|
|
25
|
+
onSubmit: () => void;
|
|
26
|
+
onCopy: () => void;
|
|
27
|
+
formChange: (newForm: Partial<FormSchema>) => void;
|
|
28
|
+
setChange: (path: string, value: any) => void;
|
|
29
|
+
};
|