frontend-plus-react 0.1.14 → 0.1.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/index.cjs +322 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +572 -313
- package/dist/index.js.map +1 -1
- package/package.json +3 -8
package/dist/index.cjs
CHANGED
|
@@ -757,12 +757,9 @@ var useApiCall = () => {
|
|
|
757
757
|
const { showSnackbar } = useSnackbar();
|
|
758
758
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
759
759
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
760
|
-
const callApi = _react.useCallback.call(void 0, async (procedureName, params
|
|
760
|
+
const callApi = _react.useCallback.call(void 0, async (procedureName, params) => {
|
|
761
761
|
setLoading(true);
|
|
762
762
|
setError(null);
|
|
763
|
-
const defaultOpts = { ...{
|
|
764
|
-
reportOnSnackbar: true
|
|
765
|
-
}, ...opts };
|
|
766
763
|
try {
|
|
767
764
|
const result = await executeBackendProcedure(procedureName, params);
|
|
768
765
|
return result === null ? void 0 : result;
|
|
@@ -774,9 +771,7 @@ var useApiCall = () => {
|
|
|
774
771
|
} else if (err instanceof Error) {
|
|
775
772
|
snackbarMessage = err.message;
|
|
776
773
|
}
|
|
777
|
-
|
|
778
|
-
showSnackbar(snackbarMessage, "error");
|
|
779
|
-
}
|
|
774
|
+
showSnackbar(snackbarMessage, "error");
|
|
780
775
|
throw err;
|
|
781
776
|
} finally {
|
|
782
777
|
setLoading(false);
|
|
@@ -784,6 +779,25 @@ var useApiCall = () => {
|
|
|
784
779
|
}, [showSnackbar]);
|
|
785
780
|
return { callApi, loading, error };
|
|
786
781
|
};
|
|
782
|
+
var useApiCallWithoutSnackbar = () => {
|
|
783
|
+
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
784
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
785
|
+
const callApi = _react.useCallback.call(void 0, async (procedureName, params) => {
|
|
786
|
+
setLoading(true);
|
|
787
|
+
setError(null);
|
|
788
|
+
try {
|
|
789
|
+
const result = await executeBackendProcedure(procedureName, params);
|
|
790
|
+
return result === null ? void 0 : result;
|
|
791
|
+
} catch (err) {
|
|
792
|
+
setError(err);
|
|
793
|
+
console.error(`Error en la llamada API (WithoutSnackbar) para ${procedureName}:`, err);
|
|
794
|
+
throw err;
|
|
795
|
+
} finally {
|
|
796
|
+
setLoading(false);
|
|
797
|
+
}
|
|
798
|
+
}, []);
|
|
799
|
+
return { callApi, loading, error };
|
|
800
|
+
};
|
|
787
801
|
|
|
788
802
|
// src/components/grid/GenericDataGrid.tsx
|
|
789
803
|
var _material = require('@mui/material');
|
|
@@ -1027,6 +1041,120 @@ var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
|
1027
1041
|
);
|
|
1028
1042
|
};
|
|
1029
1043
|
|
|
1044
|
+
// src/components/grid/DataGridOptionsDialog.tsx
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
var DataGridOptionsDialog = ({
|
|
1058
|
+
open,
|
|
1059
|
+
onClose,
|
|
1060
|
+
options,
|
|
1061
|
+
anchorEl
|
|
1062
|
+
}) => {
|
|
1063
|
+
const [isExecuting, setIsExecuting] = _react.useState.call(void 0, false);
|
|
1064
|
+
const handleOptionClick = async (handler) => {
|
|
1065
|
+
try {
|
|
1066
|
+
setIsExecuting(true);
|
|
1067
|
+
await handler();
|
|
1068
|
+
} catch (error) {
|
|
1069
|
+
console.error("Error ejecutando handler:", error);
|
|
1070
|
+
} finally {
|
|
1071
|
+
setIsExecuting(false);
|
|
1072
|
+
onClose();
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1076
|
+
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
+
"div",
|
|
1078
|
+
{
|
|
1079
|
+
style: {
|
|
1080
|
+
position: "fixed",
|
|
1081
|
+
top: 0,
|
|
1082
|
+
left: 0,
|
|
1083
|
+
right: 0,
|
|
1084
|
+
bottom: 0,
|
|
1085
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
1086
|
+
zIndex: 1200,
|
|
1087
|
+
pointerEvents: "none"
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
+
_material.Popover,
|
|
1093
|
+
{
|
|
1094
|
+
open,
|
|
1095
|
+
anchorEl,
|
|
1096
|
+
onClose,
|
|
1097
|
+
anchorOrigin: {
|
|
1098
|
+
vertical: "bottom",
|
|
1099
|
+
horizontal: "left"
|
|
1100
|
+
},
|
|
1101
|
+
transformOrigin: {
|
|
1102
|
+
vertical: "top",
|
|
1103
|
+
horizontal: "left"
|
|
1104
|
+
},
|
|
1105
|
+
slotProps: {
|
|
1106
|
+
paper: {
|
|
1107
|
+
sx: {
|
|
1108
|
+
zIndex: 1300
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Paper, { sx: { minWidth: 150, maxWidth: 350 }, children: [
|
|
1113
|
+
isExecuting && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1114
|
+
_material.Box,
|
|
1115
|
+
{
|
|
1116
|
+
sx: {
|
|
1117
|
+
display: "flex",
|
|
1118
|
+
justifyContent: "center",
|
|
1119
|
+
alignItems: "center",
|
|
1120
|
+
p: 5
|
|
1121
|
+
},
|
|
1122
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 40 })
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
!isExecuting && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.List, { sx: {
|
|
1126
|
+
py: 0,
|
|
1127
|
+
"& .MuiListItemButton-root": {
|
|
1128
|
+
py: 0.5,
|
|
1129
|
+
px: 1.5,
|
|
1130
|
+
minHeight: 36
|
|
1131
|
+
},
|
|
1132
|
+
"& .MuiListItemIcon-root": {
|
|
1133
|
+
minWidth: 32
|
|
1134
|
+
},
|
|
1135
|
+
"& .MuiListItemText-primary": {
|
|
1136
|
+
fontSize: "0.85rem"
|
|
1137
|
+
},
|
|
1138
|
+
"& .MuiSvgIcon-root": {
|
|
1139
|
+
fontSize: 18
|
|
1140
|
+
}
|
|
1141
|
+
}, children: options.filter((option) => option.visible !== false).map((option) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1142
|
+
_material.ListItemButton,
|
|
1143
|
+
{
|
|
1144
|
+
onClick: () => handleOptionClick(option.handler),
|
|
1145
|
+
children: [
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.ListItemIcon, { children: option.icon }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.ListItemText, { primary: option.label })
|
|
1148
|
+
]
|
|
1149
|
+
},
|
|
1150
|
+
option.id
|
|
1151
|
+
)) })
|
|
1152
|
+
] })
|
|
1153
|
+
}
|
|
1154
|
+
)
|
|
1155
|
+
] });
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1030
1158
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1031
1159
|
|
|
1032
1160
|
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
@@ -1064,30 +1192,31 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1064
1192
|
}
|
|
1065
1193
|
);
|
|
1066
1194
|
};
|
|
1067
|
-
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility) =>
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
] });
|
|
1195
|
+
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility, handleDataGridOptions) => {
|
|
1196
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
1197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1198
|
+
_material.IconButton,
|
|
1199
|
+
{
|
|
1200
|
+
color: "inherit",
|
|
1201
|
+
onClick: toggleFilterVisibility,
|
|
1202
|
+
size: "small",
|
|
1203
|
+
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1204
|
+
sx: { p: 0.25 },
|
|
1205
|
+
children: isFilterRowVisible ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SearchOff2.default, { sx: { fontSize: 18 } }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 18 } })
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1209
|
+
_material.IconButton,
|
|
1210
|
+
{
|
|
1211
|
+
onClick: (event) => handleDataGridOptions(event),
|
|
1212
|
+
size: "small",
|
|
1213
|
+
title: "Opciones de esta tabla",
|
|
1214
|
+
sx: { p: 0.25 },
|
|
1215
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _MoreVert2.default, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
] });
|
|
1219
|
+
};
|
|
1091
1220
|
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: detailTable.label, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
1092
1221
|
|
|
1093
1222
|
// src/components/grid/FilterInputRender.tsx
|
|
@@ -1677,6 +1806,109 @@ function EmptyRowsRenderer() {
|
|
|
1677
1806
|
}, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { textAlign: "center" }, children: "No hay filas para mostrar" }) });
|
|
1678
1807
|
}
|
|
1679
1808
|
|
|
1809
|
+
// src/components/grid/menu/options.tsx
|
|
1810
|
+
var _Refresh = require('@mui/icons-material/Refresh'); var _Refresh2 = _interopRequireDefault(_Refresh);
|
|
1811
|
+
var _ViewColumn = require('@mui/icons-material/ViewColumn'); var _ViewColumn2 = _interopRequireDefault(_ViewColumn);
|
|
1812
|
+
var _VisibilityOff = require('@mui/icons-material/VisibilityOff'); var _VisibilityOff2 = _interopRequireDefault(_VisibilityOff);
|
|
1813
|
+
var _FileDownload = require('@mui/icons-material/FileDownload'); var _FileDownload2 = _interopRequireDefault(_FileDownload);
|
|
1814
|
+
var _FileUpload = require('@mui/icons-material/FileUpload'); var _FileUpload2 = _interopRequireDefault(_FileUpload);
|
|
1815
|
+
var _DeleteSweep = require('@mui/icons-material/DeleteSweep'); var _DeleteSweep2 = _interopRequireDefault(_DeleteSweep);
|
|
1816
|
+
var _FilterAlt = require('@mui/icons-material/FilterAlt'); var _FilterAlt2 = _interopRequireDefault(_FilterAlt);
|
|
1817
|
+
|
|
1818
|
+
var buildMenuOptions = (params) => {
|
|
1819
|
+
const {
|
|
1820
|
+
tableDefinition,
|
|
1821
|
+
tableName,
|
|
1822
|
+
fixedFields,
|
|
1823
|
+
setTableData,
|
|
1824
|
+
callApi,
|
|
1825
|
+
showSuccess,
|
|
1826
|
+
showError,
|
|
1827
|
+
showWarning
|
|
1828
|
+
} = params;
|
|
1829
|
+
if (!tableDefinition) return [];
|
|
1830
|
+
const options = [];
|
|
1831
|
+
options.push({
|
|
1832
|
+
id: "refresh",
|
|
1833
|
+
label: "refrescar la grilla desde la base de datos",
|
|
1834
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Refresh2.default, {}),
|
|
1835
|
+
handler: async () => {
|
|
1836
|
+
try {
|
|
1837
|
+
const data = await callApi("table_data", {
|
|
1838
|
+
table: tableName,
|
|
1839
|
+
fixedFields
|
|
1840
|
+
});
|
|
1841
|
+
setTableData(data);
|
|
1842
|
+
showSuccess("Grilla refrescada correctamente");
|
|
1843
|
+
} catch (err) {
|
|
1844
|
+
showError(`Error al refrescar: ${err.message || "Error desconocido"}`);
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
visible: true
|
|
1848
|
+
});
|
|
1849
|
+
options.push({
|
|
1850
|
+
id: "showColumns",
|
|
1851
|
+
label: "mostrar las columnas relacionadas",
|
|
1852
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ViewColumn2.default, {}),
|
|
1853
|
+
handler: async () => {
|
|
1854
|
+
console.log("Mostrar columnas relacionadas");
|
|
1855
|
+
},
|
|
1856
|
+
visible: true
|
|
1857
|
+
});
|
|
1858
|
+
options.push({
|
|
1859
|
+
id: "hideColumns",
|
|
1860
|
+
label: "ocultar o mostrar columnas",
|
|
1861
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}),
|
|
1862
|
+
handler: async () => {
|
|
1863
|
+
console.log("Ocultar/mostrar columnas");
|
|
1864
|
+
},
|
|
1865
|
+
visible: true
|
|
1866
|
+
});
|
|
1867
|
+
if (_optionalChain([tableDefinition, 'access', _31 => _31.allow, 'optionalAccess', _32 => _32.export])) {
|
|
1868
|
+
options.push({
|
|
1869
|
+
id: "export",
|
|
1870
|
+
label: "exportar",
|
|
1871
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FileDownload2.default, {}),
|
|
1872
|
+
handler: async () => {
|
|
1873
|
+
console.log("Exportar datos");
|
|
1874
|
+
},
|
|
1875
|
+
visible: true
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
if (_optionalChain([tableDefinition, 'access', _33 => _33.allow, 'optionalAccess', _34 => _34.import])) {
|
|
1879
|
+
options.push({
|
|
1880
|
+
id: "import",
|
|
1881
|
+
label: "importar",
|
|
1882
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FileUpload2.default, {}),
|
|
1883
|
+
handler: async () => {
|
|
1884
|
+
console.log("Importar datos");
|
|
1885
|
+
},
|
|
1886
|
+
visible: true
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
if (_optionalChain([tableDefinition, 'access', _35 => _35.allow, 'optionalAccess', _36 => _36.delete])) {
|
|
1890
|
+
options.push({
|
|
1891
|
+
id: "deleteAll",
|
|
1892
|
+
label: "borrar todos los registros",
|
|
1893
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _DeleteSweep2.default, {}),
|
|
1894
|
+
handler: async () => {
|
|
1895
|
+
showWarning("Esta operaci\xF3n eliminar\xE1 TODOS los registros de la tabla");
|
|
1896
|
+
},
|
|
1897
|
+
visible: true
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
options.push({
|
|
1901
|
+
id: "completeTable",
|
|
1902
|
+
label: "tabla completa y filtrada",
|
|
1903
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FilterAlt2.default, {}),
|
|
1904
|
+
handler: async () => {
|
|
1905
|
+
console.log("Toggle tabla completa/filtrada");
|
|
1906
|
+
},
|
|
1907
|
+
visible: true
|
|
1908
|
+
});
|
|
1909
|
+
return options;
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1680
1912
|
// src/components/grid/GenericDataGrid.tsx
|
|
1681
1913
|
|
|
1682
1914
|
var NEW_ROW_INDICATOR = "$new";
|
|
@@ -1709,6 +1941,8 @@ var GenericDataGrid = ({
|
|
|
1709
1941
|
const [localCellChanges, setLocalCellChanges] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
|
|
1710
1942
|
const theme = _material.useTheme.call(void 0, );
|
|
1711
1943
|
const [openConfirmDialog, setOpenConfirmDialog] = _react.useState.call(void 0, false);
|
|
1944
|
+
const [openDataGridOptions, setOpenDataGridOptions] = _react.useState.call(void 0, false);
|
|
1945
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = _react.useState.call(void 0, null);
|
|
1712
1946
|
const [rowToDelete, setRowToDelete] = _react.useState.call(void 0, null);
|
|
1713
1947
|
const [exitingRowIds, setExitingRowIds] = _react.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
1714
1948
|
const { showSuccess, showError, showWarning, showInfo } = useSnackbar();
|
|
@@ -1923,14 +2157,14 @@ var GenericDataGrid = ({
|
|
|
1923
2157
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1924
2158
|
const editableColumns = currentColumns.filter((col) => {
|
|
1925
2159
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === col.key);
|
|
1926
|
-
return col.key !== "actionsColumn" && col.customType != "detail" && (_optionalChain([fieldDefinition, 'optionalAccess',
|
|
2160
|
+
return col.key !== "actionsColumn" && col.customType != "detail" && (_optionalChain([fieldDefinition, 'optionalAccess', _37 => _37.editable]) !== false && !_optionalChain([fieldDefinition, 'optionalAccess', _38 => _38.clientSide]));
|
|
1927
2161
|
});
|
|
1928
2162
|
const { key, target } = event;
|
|
1929
2163
|
const input = target;
|
|
1930
2164
|
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1931
2165
|
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
1932
2166
|
let currentEditableColumnIndex = editableColumnKeys.indexOf(columnKey);
|
|
1933
|
-
const hacerFoco = ({ rowIdx, idx }) => setTimeout(() => _optionalChain([dataGridRef, 'access',
|
|
2167
|
+
const hacerFoco = ({ rowIdx, idx }) => setTimeout(() => _optionalChain([dataGridRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.selectCell, 'call', _41 => _41({ rowIdx, idx }, { enableEditor: true, shouldFocusCell: true })]), 10);
|
|
1934
2168
|
const calcularColumnaSiguiente = () => {
|
|
1935
2169
|
let nextEditableColumnIndex = currentEditableColumnIndex + 1;
|
|
1936
2170
|
let nextRowIndex = rowIndex;
|
|
@@ -2027,14 +2261,24 @@ var GenericDataGrid = ({
|
|
|
2027
2261
|
const handleSelectedCellChange = _react.useCallback.call(void 0, (args) => {
|
|
2028
2262
|
setSelectedCell(args);
|
|
2029
2263
|
}, []);
|
|
2264
|
+
const menuOptions = _react.useMemo.call(void 0, () => buildMenuOptions({
|
|
2265
|
+
tableDefinition,
|
|
2266
|
+
tableName,
|
|
2267
|
+
fixedFields,
|
|
2268
|
+
setTableData,
|
|
2269
|
+
callApi,
|
|
2270
|
+
showSuccess,
|
|
2271
|
+
showError,
|
|
2272
|
+
showWarning
|
|
2273
|
+
}), [tableDefinition, tableName, fixedFields, setTableData, callApi, showSuccess, showError, showWarning]);
|
|
2030
2274
|
const columns = _react.useMemo.call(void 0, () => {
|
|
2031
2275
|
if (!tableDefinition) return [];
|
|
2032
2276
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
2033
|
-
const fixedFieldEntry = _optionalChain([fixedFields, 'optionalAccess',
|
|
2277
|
+
const fixedFieldEntry = _optionalChain([fixedFields, 'optionalAccess', _42 => _42.find, 'call', _43 => _43((f) => f.fieldName === field.name)]);
|
|
2034
2278
|
return !(fixedFieldEntry && fixedFieldEntry.until === void 0);
|
|
2035
2279
|
});
|
|
2036
2280
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
2037
|
-
const isFixedField = _optionalChain([fixedFields, 'optionalAccess',
|
|
2281
|
+
const isFixedField = _optionalChain([fixedFields, 'optionalAccess', _44 => _44.some, 'call', _45 => _45((f) => f.fieldName === fieldDef.name)]);
|
|
2038
2282
|
const isFieldEditable = fieldDef.editable !== false && !isFixedField;
|
|
2039
2283
|
return {
|
|
2040
2284
|
key: fieldDef.name,
|
|
@@ -2061,9 +2305,9 @@ var GenericDataGrid = ({
|
|
|
2061
2305
|
};
|
|
2062
2306
|
});
|
|
2063
2307
|
const availableActions = [
|
|
2064
|
-
_optionalChain([tableDefinition, 'access',
|
|
2065
|
-
_optionalChain([tableDefinition, 'access',
|
|
2066
|
-
_optionalChain([tableDefinition, 'access',
|
|
2308
|
+
_optionalChain([tableDefinition, 'access', _46 => _46.allow, 'optionalAccess', _47 => _47.insert]),
|
|
2309
|
+
_optionalChain([tableDefinition, 'access', _48 => _48.allow, 'optionalAccess', _49 => _49.delete]),
|
|
2310
|
+
_optionalChain([tableDefinition, 'access', _50 => _50.allow, 'optionalAccess', _51 => _51["vertical-edit"]])
|
|
2067
2311
|
].filter(Boolean).length;
|
|
2068
2312
|
const actionColumnWidth = availableActions === 0 ? 30 : 12 + availableActions * 25;
|
|
2069
2313
|
const actionsColumn = {
|
|
@@ -2077,7 +2321,10 @@ var GenericDataGrid = ({
|
|
|
2077
2321
|
editable: false,
|
|
2078
2322
|
resizable: false,
|
|
2079
2323
|
sortable: false,
|
|
2080
|
-
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility)
|
|
2324
|
+
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility, (e) => {
|
|
2325
|
+
setDataGridOptionsAnchorEl(e.currentTarget);
|
|
2326
|
+
setOpenDataGridOptions(true);
|
|
2327
|
+
}),
|
|
2081
2328
|
renderSummaryCell: (props) => actionsColumnSummaryCellRenderer(props)
|
|
2082
2329
|
};
|
|
2083
2330
|
const detailColumns = [];
|
|
@@ -2169,11 +2416,11 @@ var GenericDataGrid = ({
|
|
|
2169
2416
|
event.preventGridDefault();
|
|
2170
2417
|
}, []);
|
|
2171
2418
|
const handleCellClick = _react.useCallback.call(void 0, (args, _event) => {
|
|
2172
|
-
const fieldDefinition = _optionalChain([tableDefinition, 'optionalAccess',
|
|
2173
|
-
const isFixedField = _optionalChain([fixedFields, 'optionalAccess',
|
|
2174
|
-
const isEditable = _optionalChain([fieldDefinition, 'optionalAccess',
|
|
2419
|
+
const fieldDefinition = _optionalChain([tableDefinition, 'optionalAccess', _52 => _52.fields, 'access', _53 => _53.find, 'call', _54 => _54((f) => f.name === args.column.key)]);
|
|
2420
|
+
const isFixedField = _optionalChain([fixedFields, 'optionalAccess', _55 => _55.some, 'call', _56 => _56((f) => f.fieldName === args.column.key)]);
|
|
2421
|
+
const isEditable = _optionalChain([fieldDefinition, 'optionalAccess', _57 => _57.editable]) !== false && !isFixedField;
|
|
2175
2422
|
if (isEditable) {
|
|
2176
|
-
deselectAllOtherGrids(_optionalChain([dataGridRef, 'access',
|
|
2423
|
+
deselectAllOtherGrids(_optionalChain([dataGridRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.element]));
|
|
2177
2424
|
args.selectCell(true);
|
|
2178
2425
|
}
|
|
2179
2426
|
console.log("Clicked column index:", args.column.idx);
|
|
@@ -2265,6 +2512,15 @@ var GenericDataGrid = ({
|
|
|
2265
2512
|
title: "Confirmar Eliminaci\xF3n",
|
|
2266
2513
|
message: rowToDelete && rowToDelete[NEW_ROW_INDICATOR] ? `\xBFEst\xE1s seguro de que quieres eliminar esta nueva fila (ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)}) localmente?` : rowToDelete ? `\xBFEst\xE1s seguro de que quieres eliminar la fila con ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)} de la base de datos? Esta acci\xF3n es irreversible.` : "\xBFEst\xE1s seguro de que quieres eliminar este registro? Esta acci\xF3n es irreversible."
|
|
2267
2514
|
}
|
|
2515
|
+
),
|
|
2516
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2517
|
+
DataGridOptionsDialog,
|
|
2518
|
+
{
|
|
2519
|
+
open: openDataGridOptions,
|
|
2520
|
+
onClose: () => setOpenDataGridOptions(false),
|
|
2521
|
+
options: menuOptions,
|
|
2522
|
+
anchorEl: dataGridOptionsAnchorEl
|
|
2523
|
+
}
|
|
2268
2524
|
)
|
|
2269
2525
|
] });
|
|
2270
2526
|
};
|
|
@@ -2794,7 +3050,7 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
2794
3050
|
var HomePage = () => {
|
|
2795
3051
|
const { clientContext } = useApp();
|
|
2796
3052
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 3 }, children: [
|
|
2797
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${_optionalChain([clientContext, 'optionalAccess',
|
|
3053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${_optionalChain([clientContext, 'optionalAccess', _60 => _60.username])}` }),
|
|
2798
3054
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
|
|
2799
3055
|
] });
|
|
2800
3056
|
};
|
|
@@ -2923,7 +3179,7 @@ var LoginPage = () => {
|
|
|
2923
3179
|
fullWidth: true,
|
|
2924
3180
|
margin: "normal",
|
|
2925
3181
|
error: !!errors.username,
|
|
2926
|
-
helperText: _optionalChain([errors, 'access',
|
|
3182
|
+
helperText: _optionalChain([errors, 'access', _61 => _61.username, 'optionalAccess', _62 => _62.message]),
|
|
2927
3183
|
disabled: isSubmitting
|
|
2928
3184
|
}
|
|
2929
3185
|
)
|
|
@@ -2946,7 +3202,7 @@ var LoginPage = () => {
|
|
|
2946
3202
|
fullWidth: true,
|
|
2947
3203
|
margin: "normal",
|
|
2948
3204
|
error: !!errors.password,
|
|
2949
|
-
helperText: _optionalChain([errors, 'access',
|
|
3205
|
+
helperText: _optionalChain([errors, 'access', _63 => _63.password, 'optionalAccess', _64 => _64.message]),
|
|
2950
3206
|
disabled: isSubmitting
|
|
2951
3207
|
}
|
|
2952
3208
|
)
|
|
@@ -3024,7 +3280,7 @@ var ProcedureForm = () => {
|
|
|
3024
3280
|
const [executionLog, setExecutionLog] = _react.useState.call(void 0, []);
|
|
3025
3281
|
const [procedureResultData, setProcedureResultData] = _react.useState.call(void 0, null);
|
|
3026
3282
|
const procedure = _react.useMemo.call(void 0, () => {
|
|
3027
|
-
if (procedureName && _optionalChain([clientContext, 'optionalAccess',
|
|
3283
|
+
if (procedureName && _optionalChain([clientContext, 'optionalAccess', _65 => _65.procedure])) {
|
|
3028
3284
|
return clientContext.procedure[procedureName];
|
|
3029
3285
|
}
|
|
3030
3286
|
return void 0;
|
|
@@ -3315,7 +3571,7 @@ var ProcedureForm = () => {
|
|
|
3315
3571
|
}
|
|
3316
3572
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
3317
3573
|
const ResultDisplayContent = _react.useMemo.call(void 0, () => {
|
|
3318
|
-
if (!procedureResultData || !_optionalChain([procedure, 'optionalAccess',
|
|
3574
|
+
if (!procedureResultData || !_optionalChain([procedure, 'optionalAccess', _66 => _66.resultOk])) return null;
|
|
3319
3575
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
3320
3576
|
if (ComponentToRender) {
|
|
3321
3577
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ComponentToRender, { data: procedureResultData });
|
|
@@ -3591,13 +3847,13 @@ var LocationTracker = () => {
|
|
|
3591
3847
|
}, [location, dispatch]);
|
|
3592
3848
|
return null;
|
|
3593
3849
|
};
|
|
3594
|
-
function FrontendPlusReactRoutes({ myRoutes }) {
|
|
3850
|
+
function FrontendPlusReactRoutes({ myRoutes, layout: Layout = MainLayout_default }) {
|
|
3595
3851
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactrouterdom.Routes, { children: [
|
|
3596
3852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Route, { path: "/login", element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginPage_default, {}) }),
|
|
3597
3853
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Route, { path: "/logout", element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LogoutPage_default, {}) }),
|
|
3598
3854
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactrouterdom.Route, { element: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, PrivateRoute_default, { children: [
|
|
3599
3855
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, InitialRedirectHandler_default, {}),
|
|
3600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3856
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Layout, {})
|
|
3601
3857
|
] }), children: [
|
|
3602
3858
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Route, { path: "/", element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HomePage_default, {}) }),
|
|
3603
3859
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Route, { path: "/home", element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HomePage_default, {}) }),
|
|
@@ -3631,6 +3887,16 @@ function FrontendPlusReactRoutes({ myRoutes }) {
|
|
|
3631
3887
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Route, { path: "*", element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate, { to: "/", replace: true }) })
|
|
3632
3888
|
] });
|
|
3633
3889
|
}
|
|
3890
|
+
var FrontendPlusProviders = ({ children }) => {
|
|
3891
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactredux.Provider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactrouterdom.BrowserRouter, { children: [
|
|
3892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LocationTracker, {}),
|
|
3893
|
+
" ",
|
|
3894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AppProvider, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, SnackbarProvider, { children: [
|
|
3895
|
+
children,
|
|
3896
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SessionExpiredMessage_default, {})
|
|
3897
|
+
] }) })
|
|
3898
|
+
] }) }) });
|
|
3899
|
+
};
|
|
3634
3900
|
var App = ({
|
|
3635
3901
|
myRoutes,
|
|
3636
3902
|
myWScreens,
|
|
@@ -3648,18 +3914,7 @@ var App = ({
|
|
|
3648
3914
|
extendWScreens(myWScreens);
|
|
3649
3915
|
}
|
|
3650
3916
|
}, [myClientSides, myResultsOk, myWScreens]);
|
|
3651
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LocationTracker, {}),
|
|
3653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AppProvider, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, SnackbarProvider, { children: [
|
|
3654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3655
|
-
FrontendPlusReactRoutes,
|
|
3656
|
-
{
|
|
3657
|
-
myRoutes
|
|
3658
|
-
}
|
|
3659
|
-
),
|
|
3660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SessionExpiredMessage_default, {})
|
|
3661
|
-
] }) })
|
|
3662
|
-
] }) }) });
|
|
3917
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FrontendPlusProviders, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FrontendPlusReactRoutes, { myRoutes }) });
|
|
3663
3918
|
};
|
|
3664
3919
|
var App_default = App;
|
|
3665
3920
|
|
|
@@ -3679,5 +3934,9 @@ var App_default = App;
|
|
|
3679
3934
|
|
|
3680
3935
|
|
|
3681
3936
|
|
|
3682
|
-
|
|
3937
|
+
|
|
3938
|
+
|
|
3939
|
+
|
|
3940
|
+
|
|
3941
|
+
exports.App = App_default; exports.AppProvider = AppProvider; exports.ConfirmDialog = ConfirmDialog; exports.FrontendPlusProviders = FrontendPlusProviders; exports.FrontendPlusReactRoutes = FrontendPlusReactRoutes; exports.GenericDataGrid = GenericDataGrid_default; exports.MainLayout = MainLayout_default; exports.SnackbarProvider = SnackbarProvider; exports.cambiarGuionesBajosPorEspacios = cambiarGuionesBajosPorEspacios; exports.clientSides = clientSides; exports.extendClientSides = extendClientSides; exports.extendResultsOk = extendResultsOk; exports.extendWScreens = extendWScreens; exports.resultComponents = resultsOk; exports.useApiCall = useApiCall; exports.useApiCallWithoutSnackbar = useApiCallWithoutSnackbar; exports.useApp = useApp; exports.useLogout = useLogout_default; exports.useSnackbar = useSnackbar; exports.wScreens = wScreens;
|
|
3683
3942
|
//# sourceMappingURL=index.cjs.map
|