@acvl/frontend-components 0.0.34 → 0.0.35
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 +66 -37
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/v1/forms/utils.d.ts +1 -1
- package/dist/cjs/types/src/components/v1/theme/compStyleOverride.d.ts +15 -12
- package/dist/esm/index.js +66 -37
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/v1/forms/utils.d.ts +1 -1
- package/dist/esm/types/src/components/v1/theme/compStyleOverride.d.ts +15 -12
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -25777,7 +25777,7 @@ const typeSwitch = ({ base_object, base_key, response, submitData, useLabel, dat
|
|
|
25777
25777
|
break;
|
|
25778
25778
|
}
|
|
25779
25779
|
};
|
|
25780
|
-
const formParser = ({ type, submitData, data, useLabel, props
|
|
25780
|
+
const formParser = ({ type, submitData, data, useLabel, props }) => {
|
|
25781
25781
|
const t = type || "json";
|
|
25782
25782
|
const response = t === "json" ? {} : new FormData();
|
|
25783
25783
|
Object.entries(submitData).forEach(([key, value]) => {
|
|
@@ -25798,9 +25798,27 @@ const formParser = ({ type, submitData, data, useLabel, props, }) => {
|
|
|
25798
25798
|
};
|
|
25799
25799
|
// ==============================|| ERRORS ||============================== //
|
|
25800
25800
|
const setErrors = (form, error) => {
|
|
25801
|
+
const iterateDeep = (obj) => {
|
|
25802
|
+
if (Array.isArray(obj.reason)) {
|
|
25803
|
+
if (obj.reason.every((item) => typeof item === "object" && item !== null && !Array.isArray(item))) {
|
|
25804
|
+
obj.reason.forEach((obj2, index) => {
|
|
25805
|
+
Object.entries(obj2).forEach(([key3, val3]) => {
|
|
25806
|
+
form.setError(`${obj.name}.${index}.${key3}`, { message: val3.join(", ") });
|
|
25807
|
+
});
|
|
25808
|
+
});
|
|
25809
|
+
}
|
|
25810
|
+
else {
|
|
25811
|
+
form.setError(obj.name, { message: obj.reason.join(", ") });
|
|
25812
|
+
}
|
|
25813
|
+
}
|
|
25814
|
+
else {
|
|
25815
|
+
form.setError(obj.name, { message: obj.reason });
|
|
25816
|
+
}
|
|
25817
|
+
};
|
|
25801
25818
|
if ("invalid_params" in error.data) {
|
|
25802
25819
|
Object.values(error.data.invalid_params).forEach((entry) => {
|
|
25803
|
-
|
|
25820
|
+
iterateDeep(entry);
|
|
25821
|
+
// form.setError(entry.name, { message: entry.reason.join(", ") });
|
|
25804
25822
|
});
|
|
25805
25823
|
}
|
|
25806
25824
|
};
|
|
@@ -28109,12 +28127,11 @@ const EditToolbar = (props) => {
|
|
|
28109
28127
|
const FieldArrayField = (props) => {
|
|
28110
28128
|
const detail = React.useMemo(() => props.pageType === "detail", [props.pageType]);
|
|
28111
28129
|
const { fields, append, remove, update } = reactHookForm.useFieldArray({
|
|
28112
|
-
control: props.form
|
|
28130
|
+
control: props.form?.control,
|
|
28113
28131
|
name: props.name,
|
|
28114
28132
|
keyName: "_id",
|
|
28115
28133
|
});
|
|
28116
|
-
|
|
28117
|
-
// console.log(fields);
|
|
28134
|
+
const errors = props.form.formState.errors;
|
|
28118
28135
|
const getIndex = React.useCallback((id) => lodash.findIndex(fields, function (field) {
|
|
28119
28136
|
return field._id == id;
|
|
28120
28137
|
}), [fields]);
|
|
@@ -28170,9 +28187,18 @@ const FieldArrayField = (props) => {
|
|
|
28170
28187
|
},
|
|
28171
28188
|
},
|
|
28172
28189
|
getRowId: (row) => row._id,
|
|
28173
|
-
getRowClassName: (params) =>
|
|
28190
|
+
getRowClassName: (params) => {
|
|
28191
|
+
const hasError = !!(errors &&
|
|
28192
|
+
props.name in errors &&
|
|
28193
|
+
errors[props.name][getIndex(params.row._id)]);
|
|
28194
|
+
return hasError
|
|
28195
|
+
? "row-error"
|
|
28196
|
+
: params.indexRelativeToCurrentPage % 2 === 0
|
|
28197
|
+
? "even"
|
|
28198
|
+
: "odd";
|
|
28199
|
+
},
|
|
28174
28200
|
density: "compact",
|
|
28175
|
-
onRowClick: props.pageType
|
|
28201
|
+
onRowClick: props.pageType != "detail" ? handleRowClick : undefined,
|
|
28176
28202
|
}, props.dataGridProps);
|
|
28177
28203
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MainDrawer, { open: drawer.open, drawerToggle: handleCancel, title: "Trailer", slots: {
|
|
28178
28204
|
button: (jsxRuntime.jsx(SaveCancelButton, { slotProps: {
|
|
@@ -28730,67 +28756,70 @@ function themeTypography() {
|
|
|
28730
28756
|
// ==============================|| PERSONALIZADO DE COMPONENTES DE MUI ||============================== //
|
|
28731
28757
|
/**
|
|
28732
28758
|
* Cambia el diseño default de ciertos componentes de Material UI
|
|
28733
|
-
**/
|
|
28759
|
+
**/
|
|
28734
28760
|
function componentStyleOverrides(theme) {
|
|
28735
28761
|
return {
|
|
28736
28762
|
MuiAlert: {
|
|
28737
28763
|
defaultProps: {
|
|
28738
|
-
variant:
|
|
28764
|
+
variant: "filled",
|
|
28739
28765
|
},
|
|
28740
28766
|
},
|
|
28741
28767
|
MuiListItemButton: {
|
|
28742
28768
|
styleOverrides: {
|
|
28743
28769
|
root: {
|
|
28744
|
-
|
|
28770
|
+
"&:hover": {
|
|
28745
28771
|
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
28746
|
-
|
|
28747
|
-
color:
|
|
28772
|
+
"& .MuiTypography-root": {
|
|
28773
|
+
color: "white !important",
|
|
28748
28774
|
},
|
|
28749
|
-
|
|
28750
|
-
color:
|
|
28751
|
-
}
|
|
28752
|
-
}
|
|
28753
|
-
}
|
|
28754
|
-
}
|
|
28775
|
+
"& .MuiSvgIcon-root": {
|
|
28776
|
+
color: "white !important",
|
|
28777
|
+
},
|
|
28778
|
+
},
|
|
28779
|
+
},
|
|
28780
|
+
},
|
|
28755
28781
|
},
|
|
28756
28782
|
MuiDataGrid: {
|
|
28757
28783
|
styleOverrides: {
|
|
28758
28784
|
columnHeader: {
|
|
28759
|
-
|
|
28760
|
-
fontWeight:
|
|
28785
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
28786
|
+
fontWeight: "bold",
|
|
28761
28787
|
},
|
|
28762
|
-
|
|
28763
|
-
outline:
|
|
28788
|
+
"&:focus": {
|
|
28789
|
+
outline: "none",
|
|
28764
28790
|
},
|
|
28765
28791
|
},
|
|
28766
28792
|
row: {
|
|
28793
|
+
[`&.row-error`]: {
|
|
28794
|
+
backgroundColor: colors.red[100],
|
|
28795
|
+
},
|
|
28767
28796
|
[`&.even`]: {
|
|
28768
28797
|
backgroundColor: colors.grey[50],
|
|
28769
28798
|
},
|
|
28770
|
-
|
|
28799
|
+
"&:hover": {
|
|
28771
28800
|
backgroundColor: material.alpha(theme.palette.primary.main, 0.2),
|
|
28772
|
-
|
|
28773
|
-
backgroundColor:
|
|
28801
|
+
"@media (hover: none)": {
|
|
28802
|
+
backgroundColor: "transparent",
|
|
28774
28803
|
},
|
|
28775
|
-
}
|
|
28804
|
+
},
|
|
28776
28805
|
},
|
|
28777
28806
|
cell: {
|
|
28778
|
-
|
|
28779
|
-
border:
|
|
28807
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
28808
|
+
border: "none",
|
|
28780
28809
|
},
|
|
28781
|
-
|
|
28782
|
-
backgroundColor:
|
|
28783
|
-
|
|
28784
|
-
height:
|
|
28810
|
+
"&.MuiDataGrid-cell--editing": {
|
|
28811
|
+
backgroundColor: "rgb(217 243 190)",
|
|
28812
|
+
"& .MuiInputBase-root": {
|
|
28813
|
+
height: "100%",
|
|
28785
28814
|
},
|
|
28786
28815
|
},
|
|
28787
|
-
|
|
28788
|
-
backgroundColor:
|
|
28789
|
-
color:
|
|
28790
|
-
fontWeight:
|
|
28816
|
+
"& .Mui-error": {
|
|
28817
|
+
backgroundColor: "rgba(234,27,43,0.2)",
|
|
28818
|
+
color: "#ef1a2b",
|
|
28819
|
+
fontWeight: "bold",
|
|
28791
28820
|
},
|
|
28792
28821
|
},
|
|
28793
|
-
}
|
|
28822
|
+
},
|
|
28794
28823
|
},
|
|
28795
28824
|
};
|
|
28796
28825
|
}
|