finform-react-builder 1.3.1 → 1.4.0
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/components/FinForm/ButtonGroup.d.ts +13 -0
- package/dist/components/FinForm/index.d.ts +1 -1
- package/dist/components/FinForm/types.d.ts +40 -3
- package/dist/index.es.js +2875 -2671
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonGroup as ButtonGroupType } from './types';
|
|
3
|
+
interface ButtonGroupProps {
|
|
4
|
+
config: ButtonGroupType;
|
|
5
|
+
onSubmit?: (data: any) => void;
|
|
6
|
+
onStepChange?: (currentStep: number, totalSteps: number) => void;
|
|
7
|
+
currentStep?: number;
|
|
8
|
+
totalSteps?: number;
|
|
9
|
+
isMultiStep?: boolean;
|
|
10
|
+
formData?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
13
|
+
export {};
|
|
@@ -4,4 +4,4 @@ export { StepNavigation } from './StepNavigation';
|
|
|
4
4
|
export { ImageComponent } from './ImageComponent';
|
|
5
5
|
export { CustomButtons } from './CustomButtons';
|
|
6
6
|
export { generateSchema } from './generateSchema';
|
|
7
|
-
export type { FieldConfig, BaseField, TextField, NumberField, SelectField, CheckboxField, DateField, ImageField, FinFormProps, FieldRendererProps, ValidationRule, StepNavigationProps, FormButton, FormTitle, FormTheme, } from './types';
|
|
7
|
+
export type { FieldConfig, BaseField, TextField, NumberField, SelectField, CheckboxField, ToggleField, RadioField, SwitchField, AutocompleteField, DateField, ImageField, FinFormProps, FieldRendererProps, ValidationRule, StepNavigationProps, FormButton, ButtonGroup, FormTitle, FormTheme, } from './types';
|
|
@@ -13,12 +13,13 @@ export interface BaseField {
|
|
|
13
13
|
title?: string;
|
|
14
14
|
name: string;
|
|
15
15
|
label: string;
|
|
16
|
-
type: 'text' | 'email' | 'password' | 'number' | 'select' | 'checkbox' | 'date' | 'textarea' | 'image' | 'title' | 'section';
|
|
16
|
+
type: 'text' | 'email' | 'password' | 'number' | 'select' | 'checkbox' | 'toggle' | 'radio' | 'switch' | 'autocomplete' | 'date' | 'textarea' | 'image' | 'title' | 'section';
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
required?: boolean;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
validation?: ValidationRule;
|
|
21
21
|
step?: number;
|
|
22
|
+
value?: any;
|
|
22
23
|
col?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
23
24
|
xs?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
24
25
|
sm?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
@@ -47,6 +48,33 @@ export interface SelectField extends BaseField {
|
|
|
47
48
|
export interface CheckboxField extends BaseField {
|
|
48
49
|
type: 'checkbox';
|
|
49
50
|
}
|
|
51
|
+
export interface ToggleField extends BaseField {
|
|
52
|
+
type: 'toggle';
|
|
53
|
+
options: Array<{
|
|
54
|
+
label: string;
|
|
55
|
+
value: string | number;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export interface RadioField extends BaseField {
|
|
59
|
+
type: 'radio';
|
|
60
|
+
options: Array<{
|
|
61
|
+
label: string;
|
|
62
|
+
value: string | number;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
export interface SwitchField extends BaseField {
|
|
66
|
+
type: 'switch';
|
|
67
|
+
}
|
|
68
|
+
export interface AutocompleteField extends BaseField {
|
|
69
|
+
type: 'autocomplete';
|
|
70
|
+
options: Array<{
|
|
71
|
+
label: string;
|
|
72
|
+
value: string | number;
|
|
73
|
+
}>;
|
|
74
|
+
multiple?: boolean;
|
|
75
|
+
freeSolo?: boolean;
|
|
76
|
+
filterOptions?: boolean;
|
|
77
|
+
}
|
|
50
78
|
export interface DateField extends BaseField {
|
|
51
79
|
type: 'date';
|
|
52
80
|
minDate?: string;
|
|
@@ -77,7 +105,7 @@ export interface SectionField extends BaseField {
|
|
|
77
105
|
align?: 'left' | 'center' | 'right';
|
|
78
106
|
sx?: any;
|
|
79
107
|
}
|
|
80
|
-
export type FieldConfig = TextField | NumberField | SelectField | CheckboxField | DateField | ImageField | TitleField | SectionField;
|
|
108
|
+
export type FieldConfig = TextField | NumberField | SelectField | CheckboxField | ToggleField | RadioField | SwitchField | AutocompleteField | DateField | ImageField | TitleField | SectionField;
|
|
81
109
|
export interface FormButton {
|
|
82
110
|
text: string;
|
|
83
111
|
color?: string;
|
|
@@ -85,7 +113,15 @@ export interface FormButton {
|
|
|
85
113
|
onClick?: () => void;
|
|
86
114
|
disabled?: boolean;
|
|
87
115
|
loading?: boolean;
|
|
88
|
-
position?:
|
|
116
|
+
position?: 'left' | 'center' | 'right' | 'space-between';
|
|
117
|
+
type?: 'submit' | 'button' | 'reset';
|
|
118
|
+
sx?: any;
|
|
119
|
+
}
|
|
120
|
+
export interface ButtonGroup {
|
|
121
|
+
buttons: FormButton[];
|
|
122
|
+
position?: 'left' | 'center' | 'right' | 'space-between';
|
|
123
|
+
layout?: 'horizontal' | 'vertical';
|
|
124
|
+
spacing?: number;
|
|
89
125
|
sx?: any;
|
|
90
126
|
}
|
|
91
127
|
export interface FormTitle {
|
|
@@ -119,6 +155,7 @@ export interface FinFormProps {
|
|
|
119
155
|
defaultValues?: Record<string, any>;
|
|
120
156
|
showSubmitButton?: boolean;
|
|
121
157
|
buttons?: FormButton[];
|
|
158
|
+
buttonGroup?: ButtonGroup;
|
|
122
159
|
isMultiStep?: boolean;
|
|
123
160
|
currentStep?: number;
|
|
124
161
|
onStepChange?: (currentStep: number, totalSteps: number) => void;
|