@ahmadmubarak98/namozaj 1.6.14 → 1.6.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/main.d.ts +2 -0
- package/dist/namozaj.js +28 -10
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ export declare type DynamicFormField = TextFieldConfig | NumberFieldConfig | Sli
|
|
|
98
98
|
|
|
99
99
|
export declare interface DynamicFormProps {
|
|
100
100
|
fields: DynamicFormField[];
|
|
101
|
+
dirtyLock?: boolean;
|
|
102
|
+
validLock?: boolean;
|
|
101
103
|
localization?: NamozajLocalizationOptions;
|
|
102
104
|
emptyFormMessage?: string;
|
|
103
105
|
defaultValues?: Record<string, FieldValueType>;
|
package/dist/namozaj.js
CHANGED
|
@@ -80823,7 +80823,9 @@ const ConfirmationDialog = ({
|
|
|
80823
80823
|
try {
|
|
80824
80824
|
L(!0), u.onBeforeAdd && typeof u.onBeforeAdd == "function" && await u.onBeforeAdd(Ve, h);
|
|
80825
80825
|
const Ne = [...l, Ve];
|
|
80826
|
-
c(Ne), h.setValue(a, Ne
|
|
80826
|
+
c(Ne), h.setValue(a, Ne, {
|
|
80827
|
+
shouldDirty: !0
|
|
80828
|
+
}), Ke();
|
|
80827
80829
|
} catch {
|
|
80828
80830
|
} finally {
|
|
80829
80831
|
L(!1);
|
|
@@ -80836,7 +80838,9 @@ const ConfirmationDialog = ({
|
|
|
80836
80838
|
try {
|
|
80837
80839
|
L(!0), u.onBeforeEdit && typeof u.onBeforeEdit == "function" && await u.onBeforeEdit(Ve, h);
|
|
80838
80840
|
const je = [...l];
|
|
80839
|
-
je[Ne] = Ve, c(je), h.setValue(a, je
|
|
80841
|
+
je[Ne] = Ve, c(je), h.setValue(a, je, {
|
|
80842
|
+
shouldDirty: !0
|
|
80843
|
+
}), S(null), Ke();
|
|
80840
80844
|
} catch {
|
|
80841
80845
|
} finally {
|
|
80842
80846
|
L(!1);
|
|
@@ -80851,7 +80855,9 @@ const ConfirmationDialog = ({
|
|
|
80851
80855
|
const Ne = l[Ve];
|
|
80852
80856
|
u.onBeforeRemove && typeof u.onBeforeRemove == "function" && await u.onBeforeRemove(Ne, h);
|
|
80853
80857
|
const je = [...l];
|
|
80854
|
-
je.splice(Ve, 1), c(je), h.setValue(a, je
|
|
80858
|
+
je.splice(Ve, 1), c(je), h.setValue(a, je, {
|
|
80859
|
+
shouldDirty: !0
|
|
80860
|
+
}), S(null), Qe();
|
|
80855
80861
|
} catch {
|
|
80856
80862
|
} finally {
|
|
80857
80863
|
L(!1);
|
|
@@ -81018,7 +81024,9 @@ const ConfirmationDialog = ({
|
|
|
81018
81024
|
[l, a, u]
|
|
81019
81025
|
), Z = useCallback(
|
|
81020
81026
|
(be, ve) => {
|
|
81021
|
-
u.setValue(`${a}[${be}]`, ve
|
|
81027
|
+
u.setValue(`${a}[${be}]`, ve, {
|
|
81028
|
+
shouldDirty: !0
|
|
81029
|
+
});
|
|
81022
81030
|
},
|
|
81023
81031
|
[l]
|
|
81024
81032
|
), te = (be) => {
|
|
@@ -81027,9 +81035,16 @@ const ConfirmationDialog = ({
|
|
|
81027
81035
|
m(!1), C(null);
|
|
81028
81036
|
};
|
|
81029
81037
|
return useEffect(() => {
|
|
81030
|
-
l && Array.isArray(l) && l.length > 0
|
|
81031
|
-
|
|
81032
|
-
|
|
81038
|
+
if (l && Array.isArray(l) && l.length > 0)
|
|
81039
|
+
u.resetField(a, {
|
|
81040
|
+
defaultValue: l
|
|
81041
|
+
});
|
|
81042
|
+
else if (I && l.length < I) {
|
|
81043
|
+
const be = Array.from({ length: I }, (ve, Re) => d.fields.reduce((we, ye) => (we[ye.name] = u.watch()[`${a}[${Re}].${ye.name}`] || getDefaultValue(ye), we), {}));
|
|
81044
|
+
u.resetField(a, {
|
|
81045
|
+
defaultValue: be
|
|
81046
|
+
});
|
|
81047
|
+
}
|
|
81033
81048
|
}, []), /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Fieldset, { id: e, legend: /* @__PURE__ */ jsx(FieldLabel, { field: t }), children: [
|
|
81034
81049
|
h.fields.length === 0 && /* @__PURE__ */ jsxs(
|
|
81035
81050
|
Box,
|
|
@@ -85108,7 +85123,9 @@ const Form = React__default.forwardRef(
|
|
|
85108
85123
|
const j = e.defaultValues ?? getDefaultValues(e.fields);
|
|
85109
85124
|
V.forEach((Z) => {
|
|
85110
85125
|
const te = j[Z];
|
|
85111
|
-
c.
|
|
85126
|
+
c.resetField(Z, {
|
|
85127
|
+
defaultValue: te
|
|
85128
|
+
});
|
|
85112
85129
|
}), p.current = H;
|
|
85113
85130
|
} else
|
|
85114
85131
|
d.current = !0;
|
|
@@ -85118,7 +85135,7 @@ const Form = React__default.forwardRef(
|
|
|
85118
85135
|
var G;
|
|
85119
85136
|
({ ...H }, (G = e.onSubmit) == null || G.call(e, H));
|
|
85120
85137
|
}, b = async () => (await c.trigger()).valueOf(), h = () => {
|
|
85121
|
-
var H, G;
|
|
85138
|
+
var H, G, Y;
|
|
85122
85139
|
return /* @__PURE__ */ jsx(Fragment, { children: !((H = e.submitButtonProps) != null && H.hidden) && /* @__PURE__ */ jsx(
|
|
85123
85140
|
Button$1,
|
|
85124
85141
|
{
|
|
@@ -85127,7 +85144,8 @@ const Form = React__default.forwardRef(
|
|
|
85127
85144
|
variant: "contained",
|
|
85128
85145
|
color: "primary",
|
|
85129
85146
|
type: "submit",
|
|
85130
|
-
|
|
85147
|
+
disabled: (G = e.submitButtonProps) != null && G.disabled || e.dirtyLock ? Object.keys(c.formState.dirtyFields).length === 0 : !1,
|
|
85148
|
+
children: ((Y = e.submitButtonProps) == null ? void 0 : Y.label) || "Submit"
|
|
85131
85149
|
}
|
|
85132
85150
|
) });
|
|
85133
85151
|
}, g = () => /* @__PURE__ */ jsx(Fragment, {});
|