@ahmadmubarak98/namozaj 1.6.51 → 1.6.53
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 +62 -60
- package/dist/namozaj.js +1266 -1264
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare type BaseFieldConfig = {
|
|
|
30
30
|
visibilityRules?: VisibilityRule[];
|
|
31
31
|
dependencies?: FieldDependency[];
|
|
32
32
|
onValueChange?: (value: FieldValueType, formMethods: any) => void;
|
|
33
|
-
compute?: (data: any, formMethods:
|
|
33
|
+
compute?: (data: any, formMethods: NamozajFormMethods) => FieldValueType;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -40,7 +40,7 @@ export declare type BaseFormFieldProps = {
|
|
|
40
40
|
value: any;
|
|
41
41
|
onChange: ((value: any) => void);
|
|
42
42
|
error?: boolean;
|
|
43
|
-
config:
|
|
43
|
+
config: NamozajField;
|
|
44
44
|
locale?: string | undefined;
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -92,63 +92,15 @@ export declare type DateFieldConfig = BaseFieldConfig & {
|
|
|
92
92
|
export declare type DateMinMaxValue = {
|
|
93
93
|
date: Date | null;
|
|
94
94
|
errorMessage?: string;
|
|
95
|
-
} | ((data: any, formMethods:
|
|
95
|
+
} | ((data: any, formMethods: NamozajFormMethods) => {
|
|
96
96
|
date: Date | null;
|
|
97
97
|
errorMessage?: string;
|
|
98
98
|
} | null);
|
|
99
99
|
|
|
100
|
-
export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | GroupFieldConfig | SelectFieldConfig | MultiSelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
101
|
-
|
|
102
|
-
export declare interface DynamicFormProps {
|
|
103
|
-
fields: DynamicFormField[];
|
|
104
|
-
dirtyLock?: boolean;
|
|
105
|
-
localization?: NamozajLocalizationOptions;
|
|
106
|
-
emptyFormMessage?: string;
|
|
107
|
-
defaultValues?: Record<string, FieldValueType>;
|
|
108
|
-
submitButtonProps?: SubmitButtonProps;
|
|
109
|
-
scrollableWithFixedFooter?: boolean;
|
|
110
|
-
loading?: boolean;
|
|
111
|
-
isNested?: boolean;
|
|
112
|
-
validationMode?: ValidationMode;
|
|
113
|
-
enableRtl?: boolean;
|
|
114
|
-
error?: any;
|
|
115
|
-
slots?: {
|
|
116
|
-
formBody?: {
|
|
117
|
-
className?: string;
|
|
118
|
-
style?: React.CSSProperties;
|
|
119
|
-
};
|
|
120
|
-
formFooter?: {
|
|
121
|
-
className?: string;
|
|
122
|
-
style?: React.CSSProperties;
|
|
123
|
-
renderActions?: ((submitBtnNode: React.ReactNode, resetBtnNode: React.ReactNode, formMethods: UseFormReturn<FieldValues, any, FieldValues>) => React.ReactNode);
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
onSubmit?: (data: any) => void;
|
|
127
|
-
onChange?: (data: any) => void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export declare interface DynamicFormRef {
|
|
131
|
-
setFieldValue: (name: string, value: FieldValueType) => void;
|
|
132
|
-
getFieldValue: (name: string) => any;
|
|
133
|
-
validateField: (name: string) => Promise<boolean>;
|
|
134
|
-
validateForm: () => Promise<boolean>;
|
|
135
|
-
resetForm: () => void;
|
|
136
|
-
setMultipleFieldValues: (values: Record<string, FieldValueType>) => void;
|
|
137
|
-
clearFieldError: (name: string) => void;
|
|
138
|
-
setFieldError: (name: string, error: string) => void;
|
|
139
|
-
focusField: (name: string) => void;
|
|
140
|
-
isDirty: () => boolean;
|
|
141
|
-
isFieldDirty: (name: string) => boolean;
|
|
142
|
-
submitForm: () => Promise<void>;
|
|
143
|
-
getFieldError: (name: string) => string | undefined;
|
|
144
|
-
setFieldVisibility: (name: string, visible: boolean) => void;
|
|
145
|
-
getFetchedFieldsOptions: () => Promise<any>;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
100
|
export declare type FieldArrayFieldConfig = BaseFieldConfig & {
|
|
149
101
|
type: "field-array";
|
|
150
102
|
meta: BaseFieldConfig["meta"] & {
|
|
151
|
-
fields:
|
|
103
|
+
fields: NamozajField[];
|
|
152
104
|
minEntries?: number;
|
|
153
105
|
maxEntries?: number;
|
|
154
106
|
hideEntryNumber?: boolean;
|
|
@@ -210,14 +162,14 @@ export declare type FileFieldConfig = BaseFieldConfig & {
|
|
|
210
162
|
minSize?: number | {
|
|
211
163
|
value: number | null;
|
|
212
164
|
errorMessage?: string;
|
|
213
|
-
} | ((data: any, formMethods:
|
|
165
|
+
} | ((data: any, formMethods: NamozajFormMethods) => {
|
|
214
166
|
value: number | null;
|
|
215
167
|
errorMessage?: string;
|
|
216
168
|
} | null);
|
|
217
169
|
maxSize?: number | {
|
|
218
170
|
value: number | null;
|
|
219
171
|
errorMessage?: string;
|
|
220
|
-
} | ((data: any, formMethods:
|
|
172
|
+
} | ((data: any, formMethods: NamozajFormMethods) => {
|
|
221
173
|
value: number | null;
|
|
222
174
|
errorMessage?: string;
|
|
223
175
|
} | null);
|
|
@@ -280,7 +232,7 @@ export declare type GroupFieldConfig = BaseFieldConfig & {
|
|
|
280
232
|
style?: React.CSSProperties;
|
|
281
233
|
disabled?: boolean;
|
|
282
234
|
grid?: GridColumnConfig;
|
|
283
|
-
fields:
|
|
235
|
+
fields: NamozajField[];
|
|
284
236
|
visibilityRules?: VisibilityRule[];
|
|
285
237
|
};
|
|
286
238
|
};
|
|
@@ -306,7 +258,11 @@ export declare type MultiSelectFieldConfig = BaseFieldConfig & {
|
|
|
306
258
|
};
|
|
307
259
|
};
|
|
308
260
|
|
|
309
|
-
export declare const Namozaj: default_2.ForwardRefExoticComponent<
|
|
261
|
+
export declare const Namozaj: default_2.ForwardRefExoticComponent<NamozajProps & default_2.RefAttributes<any>>;
|
|
262
|
+
|
|
263
|
+
export declare type NamozajField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | GroupFieldConfig | SelectFieldConfig | MultiSelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
264
|
+
|
|
265
|
+
export declare type NamozajFormMethods = UseFormReturn<FieldValues, any, FieldValues>;
|
|
310
266
|
|
|
311
267
|
export declare interface NamozajLocalizationOptions {
|
|
312
268
|
locales: string[];
|
|
@@ -314,7 +270,7 @@ export declare interface NamozajLocalizationOptions {
|
|
|
314
270
|
includeInDataSubmission?: boolean;
|
|
315
271
|
translatedLabel?: (label: string, locale: string) => string;
|
|
316
272
|
translatedFieldNameSuffix?: (locale: string) => string;
|
|
317
|
-
translatedFieldGrid?: (field:
|
|
273
|
+
translatedFieldGrid?: (field: NamozajField, locale: string, selectedLocales: string[]) => GridColumnConfig;
|
|
318
274
|
localePicker?: {
|
|
319
275
|
label?: string;
|
|
320
276
|
getLocaleLabel: (locale: string) => string;
|
|
@@ -325,6 +281,52 @@ export declare interface NamozajLocalizationOptions {
|
|
|
325
281
|
|
|
326
282
|
export declare type NamozajPhoneFieldCountry = CountryIso2;
|
|
327
283
|
|
|
284
|
+
export declare interface NamozajProps {
|
|
285
|
+
fields: NamozajField[];
|
|
286
|
+
dirtyLock?: boolean;
|
|
287
|
+
localization?: NamozajLocalizationOptions;
|
|
288
|
+
emptyFormMessage?: string;
|
|
289
|
+
defaultValues?: Record<string, FieldValueType>;
|
|
290
|
+
submitButtonProps?: SubmitButtonProps;
|
|
291
|
+
scrollableWithFixedFooter?: boolean;
|
|
292
|
+
loading?: boolean;
|
|
293
|
+
isNested?: boolean;
|
|
294
|
+
validationMode?: ValidationMode;
|
|
295
|
+
enableRtl?: boolean;
|
|
296
|
+
error?: any;
|
|
297
|
+
slots?: {
|
|
298
|
+
formBody?: {
|
|
299
|
+
className?: string;
|
|
300
|
+
style?: React.CSSProperties;
|
|
301
|
+
};
|
|
302
|
+
formFooter?: {
|
|
303
|
+
className?: string;
|
|
304
|
+
style?: React.CSSProperties;
|
|
305
|
+
renderActions?: ((submitBtnNode: React.ReactNode, resetBtnNode: React.ReactNode, formMethods: NamozajFormMethods, isDirtyLocked: boolean) => React.ReactNode);
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
onSubmit?: (data: any) => void;
|
|
309
|
+
onChange?: (data: any) => void;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export declare interface NamozajRef {
|
|
313
|
+
setFieldValue: (name: string, value: FieldValueType) => void;
|
|
314
|
+
getFieldValue: (name: string) => any;
|
|
315
|
+
validateField: (name: string) => Promise<boolean>;
|
|
316
|
+
validateForm: () => Promise<boolean>;
|
|
317
|
+
resetForm: () => void;
|
|
318
|
+
setMultipleFieldValues: (values: Record<string, FieldValueType>) => void;
|
|
319
|
+
clearFieldError: (name: string) => void;
|
|
320
|
+
setFieldError: (name: string, error: string) => void;
|
|
321
|
+
focusField: (name: string) => void;
|
|
322
|
+
isDirty: () => boolean;
|
|
323
|
+
isFieldDirty: (name: string) => boolean;
|
|
324
|
+
submitForm: () => Promise<void>;
|
|
325
|
+
getFieldError: (name: string) => string | undefined;
|
|
326
|
+
setFieldVisibility: (name: string, visible: boolean) => void;
|
|
327
|
+
getFetchedFieldsOptions: () => Promise<any>;
|
|
328
|
+
}
|
|
329
|
+
|
|
328
330
|
export declare type NumberFieldConfig = BaseFieldConfig & {
|
|
329
331
|
type: "number";
|
|
330
332
|
meta: BaseFieldConfig["meta"] & {
|
|
@@ -341,7 +343,7 @@ export declare type NumberFieldConfig = BaseFieldConfig & {
|
|
|
341
343
|
export declare type NumberMinMaxValue = number | {
|
|
342
344
|
value: number | null;
|
|
343
345
|
errorMessage?: string;
|
|
344
|
-
} | ((data: any, formMethods:
|
|
346
|
+
} | ((data: any, formMethods: NamozajFormMethods) => {
|
|
345
347
|
value: number | null;
|
|
346
348
|
errorMessage?: string;
|
|
347
349
|
} | null);
|
|
@@ -386,7 +388,7 @@ export declare type RadioGroupFieldConfig = BaseFieldConfig & {
|
|
|
386
388
|
export declare type RepeaterFieldConfig = BaseFieldConfig & {
|
|
387
389
|
type: "repeater";
|
|
388
390
|
meta: BaseFieldConfig["meta"] & {
|
|
389
|
-
fields:
|
|
391
|
+
fields: NamozajField[];
|
|
390
392
|
minEntries?: number;
|
|
391
393
|
maxEntries?: number;
|
|
392
394
|
inline?: boolean;
|
|
@@ -414,7 +416,7 @@ export declare type RepeaterFieldConfig = BaseFieldConfig & {
|
|
|
414
416
|
export declare type SectionFieldConfig = BaseFieldConfig & {
|
|
415
417
|
type: "section";
|
|
416
418
|
meta: BaseFieldConfig["meta"] & {
|
|
417
|
-
fields:
|
|
419
|
+
fields: NamozajField[];
|
|
418
420
|
collapsible?: boolean;
|
|
419
421
|
collapsed?: boolean;
|
|
420
422
|
};
|