@cfinnestad/react-form-builder 1.0.15 → 1.0.16
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 +10 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Errors/Errors.d.ts +1 -2
- package/dist/cjs/types/components/Items/GetValue.d.ts +1 -1
- package/dist/cjs/types/components/Items/Items.d.ts +23 -4
- package/dist/cjs/types/components/Items/Subtypes/Text/index.d.ts +1 -1
- package/dist/esm/index.js +12 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Errors/Errors.d.ts +1 -2
- package/dist/esm/types/components/Items/GetValue.d.ts +1 -1
- package/dist/esm/types/components/Items/Items.d.ts +23 -4
- package/dist/esm/types/components/Items/Subtypes/Text/index.d.ts +1 -1
- package/dist/index.d.ts +24 -5
- package/package.json +2 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AnyItem } from "../Items";
|
|
2
1
|
export type ErrorType = {
|
|
3
2
|
[key: string]: string;
|
|
4
3
|
};
|
|
5
4
|
declare const Errors: () => ErrorType;
|
|
6
|
-
export declare const GetError: (error: string, item:
|
|
5
|
+
export declare const GetError: (error: string, item: object, errors: ErrorType) => string | undefined;
|
|
7
6
|
export default Errors;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldItem, HiddenItem } from "./Items";
|
|
2
|
-
declare const GetValue: (item: FieldItem | HiddenItem) => string | number | boolean | string[] | undefined;
|
|
2
|
+
declare const GetValue: (item: FieldItem | HiddenItem) => string | number | boolean | string[] | File[] | undefined;
|
|
3
3
|
export default GetValue;
|
|
@@ -21,7 +21,7 @@ export type Options = {
|
|
|
21
21
|
setItems: Dispatch<SetStateAction<AnyItem[]>>;
|
|
22
22
|
setModal?: Dispatch<SetStateAction<boolean>>;
|
|
23
23
|
Mode?: string;
|
|
24
|
-
getError: (error: string, item:
|
|
24
|
+
getError: (error: string, item: any) => string | undefined;
|
|
25
25
|
searchableOptions?: {
|
|
26
26
|
[key: string]: (input?: string) => Promise<Option[]> | Option[];
|
|
27
27
|
};
|
|
@@ -142,7 +142,7 @@ export type FieldItem = NamedItem & {
|
|
|
142
142
|
custom?: {
|
|
143
143
|
[key: string]: any;
|
|
144
144
|
};
|
|
145
|
-
value?: string | number | string[] | boolean;
|
|
145
|
+
value?: string | number | string[] | boolean | File[];
|
|
146
146
|
errorText?: string;
|
|
147
147
|
};
|
|
148
148
|
export type OptionSubtype = FieldItem & {
|
|
@@ -184,6 +184,15 @@ export type TextSubtype = FieldItem & {
|
|
|
184
184
|
minLength?: number;
|
|
185
185
|
maxLength?: number;
|
|
186
186
|
};
|
|
187
|
+
export type FileSubtype = FieldItem & {
|
|
188
|
+
label?: string;
|
|
189
|
+
subtype: 'File';
|
|
190
|
+
value?: File[];
|
|
191
|
+
maxFiles: number;
|
|
192
|
+
maxSizeBytes: number;
|
|
193
|
+
fileTypes?: string[];
|
|
194
|
+
content: string;
|
|
195
|
+
};
|
|
187
196
|
export type EmailSubtype = FieldItem & {
|
|
188
197
|
label?: string;
|
|
189
198
|
subtype: 'Email';
|
|
@@ -225,7 +234,7 @@ export type BooleanSubtype = FieldItem & {
|
|
|
225
234
|
description: string;
|
|
226
235
|
value?: boolean;
|
|
227
236
|
};
|
|
228
|
-
export type AnyItem = BaseItem | FieldItem | GroupItem | HTMLItem | HiddenItem | SelectSubtype | RadioSubtype | CheckboxSubtype | TextSubtype | EmailSubtype | NumberSubtype | DateSubtype | BooleanSubtype | PhoneSubtype | AutocompleteSubtype;
|
|
237
|
+
export type AnyItem = BaseItem | FieldItem | GroupItem | HTMLItem | HiddenItem | SelectSubtype | RadioSubtype | CheckboxSubtype | TextSubtype | FileSubtype | EmailSubtype | NumberSubtype | DateSubtype | BooleanSubtype | PhoneSubtype | AutocompleteSubtype;
|
|
229
238
|
export type ItemType = {
|
|
230
239
|
Item: AnyItem;
|
|
231
240
|
ItemFC: (props: ItemProps | HiddenProps | FieldProps | SubmitProps | HTMLProps | GroupProps) => JSX.Element;
|
|
@@ -282,6 +291,12 @@ export type TextType = FieldType & {
|
|
|
282
291
|
EditFC: (props: TextProps) => JSX.Element;
|
|
283
292
|
ValidateFC?: (item: TextSubtype, options: Options) => boolean;
|
|
284
293
|
};
|
|
294
|
+
export type FileType = FieldType & {
|
|
295
|
+
Subtype: FileSubtype;
|
|
296
|
+
SubtypeFC: (props: FileProps) => JSX.Element;
|
|
297
|
+
EditFC: (props: FileProps) => JSX.Element;
|
|
298
|
+
ValidateFC?: (item: FileSubtype, options: Options) => boolean;
|
|
299
|
+
};
|
|
285
300
|
export type EmailType = FieldType & {
|
|
286
301
|
Subtype: EmailSubtype;
|
|
287
302
|
SubtypeFC: (props: EmailProps) => JSX.Element;
|
|
@@ -318,7 +333,7 @@ export type PhoneType = FieldType & {
|
|
|
318
333
|
EditFC: (props: PhoneProps) => JSX.Element;
|
|
319
334
|
ValidateFC?: (item: PhoneSubtype, options: Options) => boolean;
|
|
320
335
|
};
|
|
321
|
-
export type AnyFieldType = SelectType | RadioType | CheckboxType | TextType | EmailType | NumberType | DateType | BooleanType | AutocompleteType | PhoneType;
|
|
336
|
+
export type AnyFieldType = SelectType | RadioType | CheckboxType | TextType | FileType | EmailType | NumberType | DateType | BooleanType | AutocompleteType | PhoneType;
|
|
322
337
|
export type BaseItemProps = {
|
|
323
338
|
item: AnyItem;
|
|
324
339
|
items: AnyItem[];
|
|
@@ -355,6 +370,9 @@ export type CheckboxProps = FieldProps & {
|
|
|
355
370
|
export type TextProps = FieldProps & {
|
|
356
371
|
item: TextSubtype;
|
|
357
372
|
};
|
|
373
|
+
export type FileProps = FieldProps & {
|
|
374
|
+
item: FileSubtype;
|
|
375
|
+
};
|
|
358
376
|
export type EmailProps = FieldProps & {
|
|
359
377
|
item: EmailSubtype;
|
|
360
378
|
};
|
|
@@ -383,6 +401,7 @@ export declare function isSelect(item: AnyItem): item is SelectSubtype;
|
|
|
383
401
|
export declare function isRadio(item: AnyItem): item is RadioSubtype;
|
|
384
402
|
export declare function isCheckbox(item: AnyItem): item is CheckboxSubtype;
|
|
385
403
|
export declare function isText(item: AnyItem): item is TextSubtype;
|
|
404
|
+
export declare function isFile(item: AnyItem): item is FileSubtype;
|
|
386
405
|
export declare function isEmail(item: AnyItem): item is EmailSubtype;
|
|
387
406
|
export declare function isNumber(item: AnyItem): item is NumberSubtype;
|
|
388
407
|
export declare function isDate(item: AnyItem): item is DateSubtype;
|