@ahmadmubarak98/namozaj 1.5.5 → 1.6.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 +17 -2
- package/dist/namozaj.js +36 -7
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare interface DefaultSubmitButtonProps {
|
|
|
101
101
|
hidden?: boolean;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | SelectFieldConfig | MultiSelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
104
|
+
export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | SliderFieldConfig | PhoneFieldConfig | GroupFieldConfig | SelectFieldConfig | MultiSelectFieldConfig | CheckBoxGroupFieldConfig | RadioGroupFieldConfig | SwitchFieldConfig | CheckboxFieldConfig | DateFieldConfig | FileFieldConfig | ComputedFieldConfig | SectionFieldConfig | ButtonFieldConfig | RepeaterFieldConfig | FieldArrayFieldConfig;
|
|
105
105
|
|
|
106
106
|
export declare interface DynamicFormProps {
|
|
107
107
|
fields: DynamicFormField[];
|
|
@@ -183,7 +183,7 @@ export declare type FieldOptionFetchFunction = (() => Promise<FieldOption[]>) |
|
|
|
183
183
|
|
|
184
184
|
export declare type FieldSize = 'small' | 'medium';
|
|
185
185
|
|
|
186
|
-
export declare type FieldType = "text" | "phone" | "number" | "slider" | "select" | "multi-select" | "checkbox-group" | "radio-group" | "checkbox" | "switch" | "date" | "time" | "datetime" | "file" | "repeater" | "field-array";
|
|
186
|
+
export declare type FieldType = "text" | "phone" | "number" | "slider" | "select" | "multi-select" | "checkbox-group" | "radio-group" | "checkbox" | "switch" | "date" | "time" | "datetime" | "file" | "repeater" | "field-array" | "group";
|
|
187
187
|
|
|
188
188
|
export declare type FieldValueType = string | number | boolean | Date | File | (string | undefined)[] | ({
|
|
189
189
|
[x: string]: any;
|
|
@@ -243,6 +243,21 @@ export declare type GridColumnConfig = {
|
|
|
243
243
|
|
|
244
244
|
export declare type GridSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
245
245
|
|
|
246
|
+
export declare type GroupFieldConfig = BaseFieldConfig & {
|
|
247
|
+
type: "group";
|
|
248
|
+
meta: {
|
|
249
|
+
label: string;
|
|
250
|
+
tooltip?: TooltipConfig;
|
|
251
|
+
helperText?: HelperTextConfig;
|
|
252
|
+
className?: string;
|
|
253
|
+
style?: React.CSSProperties;
|
|
254
|
+
disabled?: boolean;
|
|
255
|
+
grid?: GridColumnConfig;
|
|
256
|
+
fields: DynamicFormField[];
|
|
257
|
+
visibilityRules?: VisibilityRule[];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
246
261
|
export declare type HelperTextConfig = {
|
|
247
262
|
content?: string | React.ReactNode;
|
|
248
263
|
color?: BaseColors | string;
|
package/dist/namozaj.js
CHANGED
|
@@ -1245,7 +1245,9 @@ function useForm(e = {}) {
|
|
|
1245
1245
|
});
|
|
1246
1246
|
}, [e.shouldUnregister, p]), t.current.formState = getProxyFormState(l, p), t.current;
|
|
1247
1247
|
}
|
|
1248
|
-
const DEFAULT_LOCALE_PICKER_FIELD_NAME = "localePicker_Field", DEFAULT_GRID_SIZE = 12, DEFAULT_FIELD_VARIANT = "outlined", DEFAULT_FIELD_SIZE = "medium", DEFAULT_TEXT_AREA_ROWS = 4,
|
|
1248
|
+
const DEFAULT_LOCALE_PICKER_FIELD_NAME = "localePicker_Field", DEFAULT_GRID_SIZE = 12, DEFAULT_FIELD_VARIANT = "outlined", DEFAULT_FIELD_SIZE = "medium", DEFAULT_TEXT_AREA_ROWS = 4, FIELDS_EXCLUDE_VALIDATION = [
|
|
1249
|
+
"group"
|
|
1250
|
+
], FIELDS_TO_FLATTEN = ["group"], FIELDS_EXCLUDE_LABEL = [
|
|
1249
1251
|
"checkbox",
|
|
1250
1252
|
"switch",
|
|
1251
1253
|
"repeater",
|
|
@@ -4365,8 +4367,10 @@ const CellValue = ({ field: e, rendererParams: t }) => {
|
|
|
4365
4367
|
}
|
|
4366
4368
|
})() });
|
|
4367
4369
|
}, createYupSchema = (e) => {
|
|
4368
|
-
const
|
|
4369
|
-
|
|
4370
|
+
const l = flattenFields(e).filter(
|
|
4371
|
+
(c) => !FIELDS_EXCLUDE_VALIDATION.includes(c.type)
|
|
4372
|
+
).reduce((c, p) => (c[p.name] = createFieldValidator(p), c), {});
|
|
4373
|
+
return create$3().shape(l);
|
|
4370
4374
|
}, createFieldValidator = (e) => {
|
|
4371
4375
|
var a;
|
|
4372
4376
|
let t = create$8().nullable();
|
|
@@ -4632,7 +4636,10 @@ const getDefaultValue = (e) => {
|
|
|
4632
4636
|
} : e.meta.grid || {
|
|
4633
4637
|
xs: 12
|
|
4634
4638
|
};
|
|
4635
|
-
}
|
|
4639
|
+
}, flattenFields = (e) => e.flatMap((t) => {
|
|
4640
|
+
var a;
|
|
4641
|
+
return FIELDS_TO_FLATTEN.includes(t.type) && ((a = t.meta) != null && a.fields) ? flattenFields(t.meta.fields) : t;
|
|
4642
|
+
});
|
|
4636
4643
|
function chainPropTypes(e, t) {
|
|
4637
4644
|
return process.env.NODE_ENV === "production" ? () => null : function(...l) {
|
|
4638
4645
|
return e(...l) || t(...l);
|
|
@@ -80958,7 +80965,7 @@ const ConfirmationDialog = ({
|
|
|
80958
80965
|
]
|
|
80959
80966
|
}
|
|
80960
80967
|
) });
|
|
80961
|
-
},
|
|
80968
|
+
}, FieldArrayField = ({
|
|
80962
80969
|
id: e,
|
|
80963
80970
|
config: t,
|
|
80964
80971
|
name: a,
|
|
@@ -84871,6 +84878,21 @@ const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports), MultiSelectFie
|
|
|
84871
84878
|
] }, w.value)) : /* @__PURE__ */ jsx(MenuItem$1, { disabled: !0, children: /* @__PURE__ */ jsx("em", { children: "No results found" }) })
|
|
84872
84879
|
}
|
|
84873
84880
|
) });
|
|
84881
|
+
}, GroupField = ({ id: e, config: t }) => {
|
|
84882
|
+
var p;
|
|
84883
|
+
const { meta: a } = t, { fields: l } = a, c = useFormContext();
|
|
84884
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Fieldset, { id: e, legend: /* @__PURE__ */ jsx(FieldLabel, { field: t }), children: [
|
|
84885
|
+
/* @__PURE__ */ jsx(Grid, { container: !0, spacing: 2, children: l.length > 0 && l.map((d, u) => /* @__PURE__ */ jsx(
|
|
84886
|
+
FieldRenderer,
|
|
84887
|
+
{
|
|
84888
|
+
...d,
|
|
84889
|
+
locale: d.locale,
|
|
84890
|
+
control: c.control
|
|
84891
|
+
},
|
|
84892
|
+
d.name || u
|
|
84893
|
+
)) }),
|
|
84894
|
+
((p = a.helperText) == null ? void 0 : p.content) && /* @__PURE__ */ jsx(Box, { mt: 0.25, children: /* @__PURE__ */ jsx(HelperText, { ...a.helperText }) })
|
|
84895
|
+
] }) });
|
|
84874
84896
|
}, FieldRenderer = (e) => {
|
|
84875
84897
|
var C, v, w;
|
|
84876
84898
|
const { fieldsOptions: t, setFieldOptions: a } = useLocalDynamicFormProvider(), l = useRef(`${e.name}`), [c, p] = useState(!0), d = e.meta || {}, u = e.locale, b = d.grid || {}, h = useController({
|
|
@@ -84911,7 +84933,9 @@ const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports), MultiSelectFie
|
|
|
84911
84933
|
case "repeater":
|
|
84912
84934
|
return /* @__PURE__ */ jsx(RepeaterField, { ...L });
|
|
84913
84935
|
case "field-array":
|
|
84914
|
-
return /* @__PURE__ */ jsx(
|
|
84936
|
+
return /* @__PURE__ */ jsx(FieldArrayField, { ...L });
|
|
84937
|
+
case "group":
|
|
84938
|
+
return /* @__PURE__ */ jsx(GroupField, { ...L });
|
|
84915
84939
|
default:
|
|
84916
84940
|
return null;
|
|
84917
84941
|
}
|
|
@@ -84960,7 +84984,12 @@ const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports), MultiSelectFie
|
|
|
84960
84984
|
config: {
|
|
84961
84985
|
...e
|
|
84962
84986
|
},
|
|
84963
|
-
...[
|
|
84987
|
+
...[
|
|
84988
|
+
"select",
|
|
84989
|
+
"checkbox-group",
|
|
84990
|
+
"radio-group",
|
|
84991
|
+
"multi-select"
|
|
84992
|
+
].includes(e.type) && {
|
|
84964
84993
|
options: (t == null ? void 0 : t[e.name]) || []
|
|
84965
84994
|
},
|
|
84966
84995
|
onChange: (S) => {
|