@ahmadmubarak98/namozaj 1.4.6 → 1.5.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/main.d.ts +37 -18
- package/dist/namozaj.js +24081 -21558
- package/package.json +3 -2
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { PickersTimezone } from '@mui/x-date-pickers';
|
|
4
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
2
5
|
|
|
3
6
|
export declare type AutoPlacement = "auto" | "auto-start" | "auto-end";
|
|
4
7
|
|
|
@@ -22,6 +25,7 @@ export declare type BaseFieldConfig = {
|
|
|
22
25
|
visibilityRules?: VisibilityRule[];
|
|
23
26
|
dependencies?: FieldDependency[];
|
|
24
27
|
onValueChange?: (value: FieldValueType, formMethods: any) => void;
|
|
28
|
+
compute?: (data: any, formMethods: UseFormReturn<FieldValues, any, FieldValues>) => FieldValueType;
|
|
25
29
|
};
|
|
26
30
|
};
|
|
27
31
|
|
|
@@ -56,9 +60,7 @@ export declare type CheckBoxGroupFieldConfig = BaseFieldConfig & {
|
|
|
56
60
|
min?: number;
|
|
57
61
|
max?: number;
|
|
58
62
|
horizontal?: boolean;
|
|
59
|
-
options
|
|
60
|
-
optionsFetch?: FieldOptionFetch;
|
|
61
|
-
optionsFetchFnc?: FieldOptionFetchFunction;
|
|
63
|
+
options: FieldOption[] | FieldOptionFetchFunction;
|
|
62
64
|
};
|
|
63
65
|
};
|
|
64
66
|
|
|
@@ -73,13 +75,22 @@ export declare type DateFieldConfig = BaseFieldConfig & {
|
|
|
73
75
|
type: "date" | "time" | "datetime";
|
|
74
76
|
meta: BaseFieldConfig["meta"] & {
|
|
75
77
|
format?: string;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
timezone?: PickersTimezone;
|
|
79
|
+
minDate?: DateMinMaxValue;
|
|
80
|
+
maxDate?: DateMinMaxValue;
|
|
81
|
+
minTime?: DateMinMaxValue;
|
|
82
|
+
maxTime?: DateMinMaxValue;
|
|
80
83
|
};
|
|
81
84
|
};
|
|
82
85
|
|
|
86
|
+
export declare type DateMinMaxValue = {
|
|
87
|
+
date: Date | null;
|
|
88
|
+
errorMessage?: string;
|
|
89
|
+
} | ((data: any, formMethods: UseFormReturn<FieldValues, any, FieldValues>) => {
|
|
90
|
+
date: Date | null;
|
|
91
|
+
errorMessage?: string;
|
|
92
|
+
} | null);
|
|
93
|
+
|
|
83
94
|
export declare interface DefaultSubmitButtonProps {
|
|
84
95
|
label?: string;
|
|
85
96
|
size?: "default" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
@@ -89,7 +100,7 @@ export declare interface DefaultSubmitButtonProps {
|
|
|
89
100
|
hidden?: boolean;
|
|
90
101
|
}
|
|
91
102
|
|
|
92
|
-
export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | SelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
103
|
+
export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | SelectFieldConfig | MultiSelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
93
104
|
|
|
94
105
|
export declare interface DynamicFormProps {
|
|
95
106
|
fields: DynamicFormField[];
|
|
@@ -167,11 +178,11 @@ export declare type FieldOptionFetch = {
|
|
|
167
178
|
transform?: (data: any) => FieldOption[];
|
|
168
179
|
};
|
|
169
180
|
|
|
170
|
-
export declare type FieldOptionFetchFunction = () => Promise<FieldOption[]
|
|
181
|
+
export declare type FieldOptionFetchFunction = (() => Promise<FieldOption[]>) | (() => FieldOption[]);
|
|
171
182
|
|
|
172
183
|
export declare type FieldSize = 'small' | 'medium';
|
|
173
184
|
|
|
174
|
-
export declare type FieldType = "text" | "phone" | "number" | "slider" | "select" | "checkbox-group" | "radio-group" | "checkbox" | "switch" | "date" | "time" | "datetime" | "file" | "repeater" | "field-array";
|
|
185
|
+
export declare type FieldType = "text" | "phone" | "number" | "slider" | "select" | "multi-select" | "checkbox-group" | "radio-group" | "checkbox" | "switch" | "date" | "time" | "datetime" | "file" | "repeater" | "field-array";
|
|
175
186
|
|
|
176
187
|
export declare type FieldValueType = string | number | boolean | Date | File | (string | undefined)[] | ({
|
|
177
188
|
[x: string]: any;
|
|
@@ -191,8 +202,9 @@ export declare type FileFieldConfig = BaseFieldConfig & {
|
|
|
191
202
|
maxFiles?: number;
|
|
192
203
|
fileSizeErrorMessage?: string;
|
|
193
204
|
fileTypeErrorMessage?: string;
|
|
194
|
-
uploadErrorMessage?: string;
|
|
205
|
+
uploadErrorMessage?: string | ((error: any) => string);
|
|
195
206
|
uploadBtnText?: string;
|
|
207
|
+
loadingText?: string;
|
|
196
208
|
dragText?: string;
|
|
197
209
|
dropText?: string;
|
|
198
210
|
enablePreview?: boolean;
|
|
@@ -231,6 +243,18 @@ export declare type InputRestriction = "alpha" | "alphanumeric" | "numeric" | "a
|
|
|
231
243
|
|
|
232
244
|
export declare type ModalSize = "small" | "medium" | "large" | "full";
|
|
233
245
|
|
|
246
|
+
export declare type MultiSelectFieldConfig = BaseFieldConfig & {
|
|
247
|
+
type: "multi-select";
|
|
248
|
+
meta: BaseFieldConfig["meta"] & {
|
|
249
|
+
min?: number;
|
|
250
|
+
max?: number;
|
|
251
|
+
options: FieldOption[] | FieldOptionFetchFunction;
|
|
252
|
+
searchable?: boolean;
|
|
253
|
+
creatable?: boolean;
|
|
254
|
+
clearable?: boolean;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
|
|
234
258
|
export declare const Namozaj: default_2.ForwardRefExoticComponent<DynamicFormProps & default_2.RefAttributes<any>>;
|
|
235
259
|
|
|
236
260
|
export declare interface NamozajLocalizationOptions {
|
|
@@ -281,9 +305,7 @@ export declare type RadioGroupFieldConfig = BaseFieldConfig & {
|
|
|
281
305
|
type: "radio-group";
|
|
282
306
|
meta: BaseFieldConfig["meta"] & {
|
|
283
307
|
horizontal?: boolean;
|
|
284
|
-
options
|
|
285
|
-
optionsFetch?: FieldOptionFetch;
|
|
286
|
-
optionsFetchFnc?: FieldOptionFetchFunction;
|
|
308
|
+
options: FieldOption[] | FieldOptionFetchFunction;
|
|
287
309
|
};
|
|
288
310
|
};
|
|
289
311
|
|
|
@@ -329,10 +351,7 @@ export declare type SelectFieldConfig = BaseFieldConfig & {
|
|
|
329
351
|
meta: BaseFieldConfig["meta"] & {
|
|
330
352
|
min?: number;
|
|
331
353
|
max?: number;
|
|
332
|
-
options
|
|
333
|
-
optionsFetch?: FieldOptionFetch;
|
|
334
|
-
optionsFetchFnc?: FieldOptionFetchFunction;
|
|
335
|
-
multiple?: boolean;
|
|
354
|
+
options: FieldOption[] | FieldOptionFetchFunction;
|
|
336
355
|
searchable?: boolean;
|
|
337
356
|
creatable?: boolean;
|
|
338
357
|
clearable?: boolean;
|