@cfinnestad/react-form-builder 1.0.0 → 1.0.2
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Items/Items.d.ts +21 -22
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Items/Items.d.ts +21 -22
- package/dist/index.d.ts +21 -22
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ export type Options = {
|
|
|
20
20
|
SetItem: Dispatch<SetStateAction<AnyItem>>;
|
|
21
21
|
setItems: Dispatch<SetStateAction<AnyItem[]>>;
|
|
22
22
|
setModal?: Dispatch<SetStateAction<boolean>>;
|
|
23
|
-
Mode?:
|
|
23
|
+
Mode?: string;
|
|
24
24
|
getError: (error: string, item: AnyItem) => string | undefined;
|
|
25
25
|
searchableOptions?: {
|
|
26
26
|
[key: string]: (input?: string) => Promise<Option[]> | Option[];
|
|
@@ -48,32 +48,32 @@ export type FilterType = {
|
|
|
48
48
|
export type FieldFilter = FilterType & {
|
|
49
49
|
comparison: '=' | '>' | '>=' | '<' | '<=' | 'in';
|
|
50
50
|
fieldId: string;
|
|
51
|
-
value
|
|
51
|
+
value: string | number | boolean | undefined | (string | number | boolean | undefined)[];
|
|
52
52
|
};
|
|
53
53
|
export declare const isFieldFilter: (filter: FilterType) => filter is FieldFilter;
|
|
54
54
|
export type EqFilter = FieldFilter & {
|
|
55
55
|
comparison: '=';
|
|
56
|
-
value
|
|
56
|
+
value: string | number | boolean | undefined;
|
|
57
57
|
};
|
|
58
58
|
export declare const isEqFilter: (filter: FilterType) => filter is EqFilter;
|
|
59
59
|
export type GtFilter = FieldFilter & {
|
|
60
60
|
comparison: '>';
|
|
61
|
-
value
|
|
61
|
+
value: string | number | boolean | undefined;
|
|
62
62
|
};
|
|
63
63
|
export declare const isGtFilter: (filter: FilterType) => filter is GtFilter;
|
|
64
64
|
export type GteFilter = FieldFilter & {
|
|
65
65
|
comparison: '>=';
|
|
66
|
-
value
|
|
66
|
+
value: string | number | boolean | undefined;
|
|
67
67
|
};
|
|
68
68
|
export declare const isGteFilter: (filter: FilterType) => filter is GteFilter;
|
|
69
69
|
export type LtFilter = FieldFilter & {
|
|
70
70
|
comparison: '<';
|
|
71
|
-
value
|
|
71
|
+
value: string | number | boolean | undefined;
|
|
72
72
|
};
|
|
73
73
|
export declare const isLtFilter: (filter: FilterType) => filter is LtFilter;
|
|
74
74
|
export type LteFilter = FieldFilter & {
|
|
75
75
|
comparison: '<=';
|
|
76
|
-
value
|
|
76
|
+
value: string | number | boolean | undefined;
|
|
77
77
|
};
|
|
78
78
|
export declare const isLteFilter: (filter: FilterType) => filter is LteFilter;
|
|
79
79
|
export type InFilter = FieldFilter & {
|
|
@@ -145,7 +145,6 @@ export type FieldItem = NamedItem & {
|
|
|
145
145
|
errorText?: string;
|
|
146
146
|
};
|
|
147
147
|
export type OptionSubtype = FieldItem & {
|
|
148
|
-
label: string;
|
|
149
148
|
value?: string | string[];
|
|
150
149
|
searchableOptionsName?: string;
|
|
151
150
|
options: Option[];
|
|
@@ -175,7 +174,7 @@ export type AutocompleteSubtype = OptionSubtype & {
|
|
|
175
174
|
noOptionsFound?: string;
|
|
176
175
|
};
|
|
177
176
|
export type TextSubtype = FieldItem & {
|
|
178
|
-
label
|
|
177
|
+
label?: string;
|
|
179
178
|
subtype: 'Text';
|
|
180
179
|
value?: string;
|
|
181
180
|
multiline?: boolean;
|
|
@@ -185,26 +184,26 @@ export type TextSubtype = FieldItem & {
|
|
|
185
184
|
maxLength?: number;
|
|
186
185
|
};
|
|
187
186
|
export type EmailSubtype = FieldItem & {
|
|
188
|
-
label
|
|
187
|
+
label?: string;
|
|
189
188
|
subtype: 'Email';
|
|
190
189
|
value?: string;
|
|
191
190
|
maxLength?: number;
|
|
192
191
|
};
|
|
193
192
|
export type NumberSubtype = FieldItem & {
|
|
194
|
-
label
|
|
193
|
+
label?: string;
|
|
195
194
|
subtype: 'Number';
|
|
196
195
|
value?: number;
|
|
197
196
|
min?: number;
|
|
198
197
|
max?: number;
|
|
199
198
|
};
|
|
200
199
|
export type PhoneSubtype = FieldItem & {
|
|
201
|
-
label
|
|
200
|
+
label?: string;
|
|
202
201
|
subtype: 'Phone';
|
|
203
202
|
value?: string;
|
|
204
203
|
placeholder?: string;
|
|
205
204
|
};
|
|
206
205
|
export type DateSubtype = FieldItem & {
|
|
207
|
-
label
|
|
206
|
+
label?: string;
|
|
208
207
|
subtype: 'Date';
|
|
209
208
|
value?: string;
|
|
210
209
|
defaultToday?: boolean;
|
|
@@ -258,55 +257,55 @@ export type FieldType = ItemType & {
|
|
|
258
257
|
EditFC: (props: FieldProps) => JSX.Element;
|
|
259
258
|
ValidateFC?: (item: FieldItem, options: Options) => boolean;
|
|
260
259
|
};
|
|
261
|
-
export type SelectType = {
|
|
260
|
+
export type SelectType = FieldType & {
|
|
262
261
|
Subtype: SelectSubtype;
|
|
263
262
|
SubtypeFC: (props: SelectProps) => JSX.Element;
|
|
264
263
|
EditFC: (props: SelectProps) => JSX.Element;
|
|
265
264
|
ValidateFC?: (item: SelectSubtype, options: Options) => boolean;
|
|
266
265
|
};
|
|
267
|
-
export type RadioType = {
|
|
266
|
+
export type RadioType = FieldType & {
|
|
268
267
|
Subtype: RadioSubtype;
|
|
269
268
|
SubtypeFC: (props: RadioProps) => JSX.Element;
|
|
270
269
|
EditFC: (props: RadioProps) => JSX.Element;
|
|
271
270
|
ValidateFC?: (item: RadioSubtype, options: Options) => boolean;
|
|
272
271
|
};
|
|
273
|
-
export type CheckboxType = {
|
|
272
|
+
export type CheckboxType = FieldType & {
|
|
274
273
|
Subtype: CheckboxSubtype;
|
|
275
274
|
SubtypeFC: (props: CheckboxProps) => JSX.Element;
|
|
276
275
|
EditFC: (props: CheckboxProps) => JSX.Element;
|
|
277
276
|
ValidateFC?: (item: CheckboxSubtype, options: Options) => boolean;
|
|
278
277
|
};
|
|
279
|
-
export type TextType = {
|
|
278
|
+
export type TextType = FieldType & {
|
|
280
279
|
Subtype: TextSubtype;
|
|
281
280
|
SubtypeFC: (props: TextProps) => JSX.Element;
|
|
282
281
|
EditFC: (props: TextProps) => JSX.Element;
|
|
283
282
|
ValidateFC?: (item: TextSubtype, options: Options) => boolean;
|
|
284
283
|
};
|
|
285
|
-
export type EmailType = {
|
|
284
|
+
export type EmailType = FieldType & {
|
|
286
285
|
Subtype: EmailSubtype;
|
|
287
286
|
SubtypeFC: (props: EmailProps) => JSX.Element;
|
|
288
287
|
EditFC: (props: EmailProps) => JSX.Element;
|
|
289
288
|
ValidateFC?: (item: EmailSubtype, options: Options) => boolean;
|
|
290
289
|
};
|
|
291
|
-
export type NumberType = {
|
|
290
|
+
export type NumberType = FieldType & {
|
|
292
291
|
Subtype: NumberSubtype;
|
|
293
292
|
SubtypeFC: (props: NumberProps) => JSX.Element;
|
|
294
293
|
EditFC: (props: NumberProps) => JSX.Element;
|
|
295
294
|
ValidateFC?: (item: NumberSubtype, options: Options) => boolean;
|
|
296
295
|
};
|
|
297
|
-
export type DateType = {
|
|
296
|
+
export type DateType = FieldType & {
|
|
298
297
|
Subtype: DateSubtype;
|
|
299
298
|
SubtypeFC: (props: DateProps) => JSX.Element;
|
|
300
299
|
EditFC: (props: DateProps) => JSX.Element;
|
|
301
300
|
ValidateFC?: (item: DateSubtype, options: Options) => boolean;
|
|
302
301
|
};
|
|
303
|
-
export type BooleanType = {
|
|
302
|
+
export type BooleanType = FieldType & {
|
|
304
303
|
Subtype: BooleanSubtype;
|
|
305
304
|
SubtypeFC: (props: BooleanProps) => JSX.Element;
|
|
306
305
|
EditFC: (props: BooleanProps) => JSX.Element;
|
|
307
306
|
ValidateFC?: (item: BooleanSubtype, options: Options) => boolean;
|
|
308
307
|
};
|
|
309
|
-
export type AutocompleteType = {
|
|
308
|
+
export type AutocompleteType = FieldType & {
|
|
310
309
|
Subtype: AutocompleteSubtype;
|
|
311
310
|
SubtypeFC: (props: AutocompleteProps) => JSX.Element;
|
|
312
311
|
EditFC: (props: AutocompleteProps) => JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ type Options = {
|
|
|
33
33
|
SetItem: Dispatch<SetStateAction<AnyItem>>;
|
|
34
34
|
setItems: Dispatch<SetStateAction<AnyItem[]>>;
|
|
35
35
|
setModal?: Dispatch<SetStateAction<boolean>>;
|
|
36
|
-
Mode?:
|
|
36
|
+
Mode?: string;
|
|
37
37
|
getError: (error: string, item: AnyItem) => string | undefined;
|
|
38
38
|
searchableOptions?: {
|
|
39
39
|
[key: string]: (input?: string) => Promise<Option[]> | Option[];
|
|
@@ -61,32 +61,32 @@ type FilterType = {
|
|
|
61
61
|
type FieldFilter = FilterType & {
|
|
62
62
|
comparison: '=' | '>' | '>=' | '<' | '<=' | 'in';
|
|
63
63
|
fieldId: string;
|
|
64
|
-
value
|
|
64
|
+
value: string | number | boolean | undefined | (string | number | boolean | undefined)[];
|
|
65
65
|
};
|
|
66
66
|
declare const isFieldFilter: (filter: FilterType) => filter is FieldFilter;
|
|
67
67
|
type EqFilter = FieldFilter & {
|
|
68
68
|
comparison: '=';
|
|
69
|
-
value
|
|
69
|
+
value: string | number | boolean | undefined;
|
|
70
70
|
};
|
|
71
71
|
declare const isEqFilter: (filter: FilterType) => filter is EqFilter;
|
|
72
72
|
type GtFilter = FieldFilter & {
|
|
73
73
|
comparison: '>';
|
|
74
|
-
value
|
|
74
|
+
value: string | number | boolean | undefined;
|
|
75
75
|
};
|
|
76
76
|
declare const isGtFilter: (filter: FilterType) => filter is GtFilter;
|
|
77
77
|
type GteFilter = FieldFilter & {
|
|
78
78
|
comparison: '>=';
|
|
79
|
-
value
|
|
79
|
+
value: string | number | boolean | undefined;
|
|
80
80
|
};
|
|
81
81
|
declare const isGteFilter: (filter: FilterType) => filter is GteFilter;
|
|
82
82
|
type LtFilter = FieldFilter & {
|
|
83
83
|
comparison: '<';
|
|
84
|
-
value
|
|
84
|
+
value: string | number | boolean | undefined;
|
|
85
85
|
};
|
|
86
86
|
declare const isLtFilter: (filter: FilterType) => filter is LtFilter;
|
|
87
87
|
type LteFilter = FieldFilter & {
|
|
88
88
|
comparison: '<=';
|
|
89
|
-
value
|
|
89
|
+
value: string | number | boolean | undefined;
|
|
90
90
|
};
|
|
91
91
|
declare const isLteFilter: (filter: FilterType) => filter is LteFilter;
|
|
92
92
|
type InFilter = FieldFilter & {
|
|
@@ -158,7 +158,6 @@ type FieldItem = NamedItem & {
|
|
|
158
158
|
errorText?: string;
|
|
159
159
|
};
|
|
160
160
|
type OptionSubtype = FieldItem & {
|
|
161
|
-
label: string;
|
|
162
161
|
value?: string | string[];
|
|
163
162
|
searchableOptionsName?: string;
|
|
164
163
|
options: Option[];
|
|
@@ -188,7 +187,7 @@ type AutocompleteSubtype = OptionSubtype & {
|
|
|
188
187
|
noOptionsFound?: string;
|
|
189
188
|
};
|
|
190
189
|
type TextSubtype = FieldItem & {
|
|
191
|
-
label
|
|
190
|
+
label?: string;
|
|
192
191
|
subtype: 'Text';
|
|
193
192
|
value?: string;
|
|
194
193
|
multiline?: boolean;
|
|
@@ -198,26 +197,26 @@ type TextSubtype = FieldItem & {
|
|
|
198
197
|
maxLength?: number;
|
|
199
198
|
};
|
|
200
199
|
type EmailSubtype = FieldItem & {
|
|
201
|
-
label
|
|
200
|
+
label?: string;
|
|
202
201
|
subtype: 'Email';
|
|
203
202
|
value?: string;
|
|
204
203
|
maxLength?: number;
|
|
205
204
|
};
|
|
206
205
|
type NumberSubtype = FieldItem & {
|
|
207
|
-
label
|
|
206
|
+
label?: string;
|
|
208
207
|
subtype: 'Number';
|
|
209
208
|
value?: number;
|
|
210
209
|
min?: number;
|
|
211
210
|
max?: number;
|
|
212
211
|
};
|
|
213
212
|
type PhoneSubtype = FieldItem & {
|
|
214
|
-
label
|
|
213
|
+
label?: string;
|
|
215
214
|
subtype: 'Phone';
|
|
216
215
|
value?: string;
|
|
217
216
|
placeholder?: string;
|
|
218
217
|
};
|
|
219
218
|
type DateSubtype = FieldItem & {
|
|
220
|
-
label
|
|
219
|
+
label?: string;
|
|
221
220
|
subtype: 'Date';
|
|
222
221
|
value?: string;
|
|
223
222
|
defaultToday?: boolean;
|
|
@@ -271,55 +270,55 @@ type FieldType = ItemType & {
|
|
|
271
270
|
EditFC: (props: FieldProps) => JSX.Element;
|
|
272
271
|
ValidateFC?: (item: FieldItem, options: Options) => boolean;
|
|
273
272
|
};
|
|
274
|
-
type SelectType = {
|
|
273
|
+
type SelectType = FieldType & {
|
|
275
274
|
Subtype: SelectSubtype;
|
|
276
275
|
SubtypeFC: (props: SelectProps) => JSX.Element;
|
|
277
276
|
EditFC: (props: SelectProps) => JSX.Element;
|
|
278
277
|
ValidateFC?: (item: SelectSubtype, options: Options) => boolean;
|
|
279
278
|
};
|
|
280
|
-
type RadioType = {
|
|
279
|
+
type RadioType = FieldType & {
|
|
281
280
|
Subtype: RadioSubtype;
|
|
282
281
|
SubtypeFC: (props: RadioProps) => JSX.Element;
|
|
283
282
|
EditFC: (props: RadioProps) => JSX.Element;
|
|
284
283
|
ValidateFC?: (item: RadioSubtype, options: Options) => boolean;
|
|
285
284
|
};
|
|
286
|
-
type CheckboxType = {
|
|
285
|
+
type CheckboxType = FieldType & {
|
|
287
286
|
Subtype: CheckboxSubtype;
|
|
288
287
|
SubtypeFC: (props: CheckboxProps) => JSX.Element;
|
|
289
288
|
EditFC: (props: CheckboxProps) => JSX.Element;
|
|
290
289
|
ValidateFC?: (item: CheckboxSubtype, options: Options) => boolean;
|
|
291
290
|
};
|
|
292
|
-
type TextType = {
|
|
291
|
+
type TextType = FieldType & {
|
|
293
292
|
Subtype: TextSubtype;
|
|
294
293
|
SubtypeFC: (props: TextProps) => JSX.Element;
|
|
295
294
|
EditFC: (props: TextProps) => JSX.Element;
|
|
296
295
|
ValidateFC?: (item: TextSubtype, options: Options) => boolean;
|
|
297
296
|
};
|
|
298
|
-
type EmailType = {
|
|
297
|
+
type EmailType = FieldType & {
|
|
299
298
|
Subtype: EmailSubtype;
|
|
300
299
|
SubtypeFC: (props: EmailProps) => JSX.Element;
|
|
301
300
|
EditFC: (props: EmailProps) => JSX.Element;
|
|
302
301
|
ValidateFC?: (item: EmailSubtype, options: Options) => boolean;
|
|
303
302
|
};
|
|
304
|
-
type NumberType = {
|
|
303
|
+
type NumberType = FieldType & {
|
|
305
304
|
Subtype: NumberSubtype;
|
|
306
305
|
SubtypeFC: (props: NumberProps) => JSX.Element;
|
|
307
306
|
EditFC: (props: NumberProps) => JSX.Element;
|
|
308
307
|
ValidateFC?: (item: NumberSubtype, options: Options) => boolean;
|
|
309
308
|
};
|
|
310
|
-
type DateType = {
|
|
309
|
+
type DateType = FieldType & {
|
|
311
310
|
Subtype: DateSubtype;
|
|
312
311
|
SubtypeFC: (props: DateProps) => JSX.Element;
|
|
313
312
|
EditFC: (props: DateProps) => JSX.Element;
|
|
314
313
|
ValidateFC?: (item: DateSubtype, options: Options) => boolean;
|
|
315
314
|
};
|
|
316
|
-
type BooleanType = {
|
|
315
|
+
type BooleanType = FieldType & {
|
|
317
316
|
Subtype: BooleanSubtype;
|
|
318
317
|
SubtypeFC: (props: BooleanProps) => JSX.Element;
|
|
319
318
|
EditFC: (props: BooleanProps) => JSX.Element;
|
|
320
319
|
ValidateFC?: (item: BooleanSubtype, options: Options) => boolean;
|
|
321
320
|
};
|
|
322
|
-
type AutocompleteType = {
|
|
321
|
+
type AutocompleteType = FieldType & {
|
|
323
322
|
Subtype: AutocompleteSubtype;
|
|
324
323
|
SubtypeFC: (props: AutocompleteProps) => JSX.Element;
|
|
325
324
|
EditFC: (props: AutocompleteProps) => JSX.Element;
|