@tsed/react-formio 1.10.11 → 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.
@@ -1,54 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import PropTypes from "prop-types";
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 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
- export declare const useForm: (props: any) => any;
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?: Function;
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, FormSchema } from "../../interfaces";
4
- export interface FormEditProps extends Record<string, unknown> {
5
- form?: Partial<FormSchema>;
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
+ };