componentes-sinco 1.3.4 → 1.3.6
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 +221 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +188 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -586,8 +586,20 @@ interface SCDataGridInitialProps<T> {
|
|
|
586
586
|
selectedIndex?: number;
|
|
587
587
|
setSelectedRow?: (any: any) => void;
|
|
588
588
|
selectedRow?: any;
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
insertRowFields?: (string | {
|
|
590
|
+
field: string;
|
|
591
|
+
placeholder?: string;
|
|
592
|
+
renderCell?: (params: {
|
|
593
|
+
value: any;
|
|
594
|
+
onChange: (newValue: any) => void;
|
|
595
|
+
field: string;
|
|
596
|
+
}) => React__default.ReactNode;
|
|
597
|
+
})[];
|
|
598
|
+
onAddRow?: (newRow: {
|
|
599
|
+
[field: string]: any;
|
|
600
|
+
}) => void;
|
|
601
|
+
}
|
|
602
|
+
declare function SCDataGridInitial<T>({ data, columns, getRowId, groupColumns, titleRowsPage, rowsTable, rowSelection, checkboxSelection, width, maxHeight, density, disableColumnMenu, disableHeader, disableColumnSorting, setSelectedIndex, selectedIndex, setSelectedRow, selectedRow, insertRowFields, onAddRow }: SCDataGridInitialProps<T>): React__default.JSX.Element;
|
|
591
603
|
declare const SCDataGrid: React__default.MemoExoticComponent<typeof SCDataGridInitial>;
|
|
592
604
|
|
|
593
605
|
interface SCDatePickerProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -586,8 +586,20 @@ interface SCDataGridInitialProps<T> {
|
|
|
586
586
|
selectedIndex?: number;
|
|
587
587
|
setSelectedRow?: (any: any) => void;
|
|
588
588
|
selectedRow?: any;
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
insertRowFields?: (string | {
|
|
590
|
+
field: string;
|
|
591
|
+
placeholder?: string;
|
|
592
|
+
renderCell?: (params: {
|
|
593
|
+
value: any;
|
|
594
|
+
onChange: (newValue: any) => void;
|
|
595
|
+
field: string;
|
|
596
|
+
}) => React__default.ReactNode;
|
|
597
|
+
})[];
|
|
598
|
+
onAddRow?: (newRow: {
|
|
599
|
+
[field: string]: any;
|
|
600
|
+
}) => void;
|
|
601
|
+
}
|
|
602
|
+
declare function SCDataGridInitial<T>({ data, columns, getRowId, groupColumns, titleRowsPage, rowsTable, rowSelection, checkboxSelection, width, maxHeight, density, disableColumnMenu, disableHeader, disableColumnSorting, setSelectedIndex, selectedIndex, setSelectedRow, selectedRow, insertRowFields, onAddRow }: SCDataGridInitialProps<T>): React__default.JSX.Element;
|
|
591
603
|
declare const SCDataGrid: React__default.MemoExoticComponent<typeof SCDataGridInitial>;
|
|
592
604
|
|
|
593
605
|
interface SCDatePickerProps {
|
package/dist/index.js
CHANGED
|
@@ -1518,6 +1518,13 @@ var SCTextField = ({
|
|
|
1518
1518
|
onKeyDown: handleKeyDown,
|
|
1519
1519
|
onChange: handleInputChange,
|
|
1520
1520
|
onBlur: handleBlur,
|
|
1521
|
+
sx: iconInputStart || iconInputEnd ? {
|
|
1522
|
+
height: "32px",
|
|
1523
|
+
"& .MuiInputAdornment-root": {
|
|
1524
|
+
height: "32px",
|
|
1525
|
+
maxHeight: "32px"
|
|
1526
|
+
}
|
|
1527
|
+
} : void 0,
|
|
1521
1528
|
inputProps: { maxLength: maxLength ? maxLength : 50, style: { textAlign: alignText } },
|
|
1522
1529
|
type: !showPassword && format3 === "password" ? "password" : (format3 || "text").toUpperCase() === "INT" || (format3 || "text").toUpperCase() === "DECIMAL" ? "number" : "text",
|
|
1523
1530
|
className: format3 === "password" && !showPassword ? "" : "",
|
|
@@ -1768,6 +1775,7 @@ function SCSelect({
|
|
|
1768
1775
|
const [prevData, setPrevData] = React12.useState(data);
|
|
1769
1776
|
const [error, setError] = React12.useState(false);
|
|
1770
1777
|
const [placement, setPlacement] = React12.useState("bottom");
|
|
1778
|
+
const [menuWidth, setMenuWidth] = React12.useState();
|
|
1771
1779
|
const containerRef = React12.useRef(null);
|
|
1772
1780
|
useEffect9(() => {
|
|
1773
1781
|
if (error) {
|
|
@@ -1803,6 +1811,7 @@ function SCSelect({
|
|
|
1803
1811
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1804
1812
|
const estimatedMenuHeight = Math.min(300, data.length * 36 + 16);
|
|
1805
1813
|
setPlacement(spaceBelow < estimatedMenuHeight ? "top" : "bottom");
|
|
1814
|
+
setMenuWidth(rect.width);
|
|
1806
1815
|
}
|
|
1807
1816
|
};
|
|
1808
1817
|
const handleChange = (event2) => {
|
|
@@ -1845,6 +1854,20 @@ function SCSelect({
|
|
|
1845
1854
|
disabled: disabled || false,
|
|
1846
1855
|
error,
|
|
1847
1856
|
sx: { height: "32px" },
|
|
1857
|
+
renderValue: (selected) => {
|
|
1858
|
+
const selectedOption = data.find((item) => getItemValue(item).value === selected);
|
|
1859
|
+
if (!selectedOption) return "";
|
|
1860
|
+
const { icon, text } = getItemValue(selectedOption);
|
|
1861
|
+
return /* @__PURE__ */ React12.createElement(Box7, { sx: { display: "flex", alignItems: "center", gap: 0.5, overflow: "hidden" } }, icon != void 0 && /* @__PURE__ */ React12.createElement(SvgIcon4, { fontSize: "small", color: "action", component: icon, sx: { flexShrink: 0 } }), /* @__PURE__ */ React12.createElement(
|
|
1862
|
+
Box7,
|
|
1863
|
+
{
|
|
1864
|
+
component: "span",
|
|
1865
|
+
title: text,
|
|
1866
|
+
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
1867
|
+
},
|
|
1868
|
+
text
|
|
1869
|
+
));
|
|
1870
|
+
},
|
|
1848
1871
|
MenuProps: {
|
|
1849
1872
|
sx: {
|
|
1850
1873
|
zIndex: 1400
|
|
@@ -1852,7 +1875,8 @@ function SCSelect({
|
|
|
1852
1875
|
PaperProps: {
|
|
1853
1876
|
sx: {
|
|
1854
1877
|
maxHeight: "300px",
|
|
1855
|
-
|
|
1878
|
+
width: menuWidth ? `${menuWidth}px` : "100%",
|
|
1879
|
+
maxWidth: menuWidth ? `${menuWidth}px` : "100%"
|
|
1856
1880
|
}
|
|
1857
1881
|
},
|
|
1858
1882
|
anchorOrigin: {
|
|
@@ -1868,7 +1892,15 @@ function SCSelect({
|
|
|
1868
1892
|
}
|
|
1869
1893
|
},
|
|
1870
1894
|
data.map((option, index) => {
|
|
1871
|
-
return /* @__PURE__ */ React12.createElement(MenuItem, { key: index, value: getItemValue(option).value }, getItemValue(option).icon != void 0 ? /* @__PURE__ */ React12.createElement(ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ React12.createElement(SvgIcon4, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "", /* @__PURE__ */ React12.createElement(
|
|
1895
|
+
return /* @__PURE__ */ React12.createElement(MenuItem, { key: index, value: getItemValue(option).value, sx: { minWidth: 0 } }, getItemValue(option).icon != void 0 ? /* @__PURE__ */ React12.createElement(ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ React12.createElement(SvgIcon4, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "", /* @__PURE__ */ React12.createElement(
|
|
1896
|
+
ListItemText,
|
|
1897
|
+
{
|
|
1898
|
+
primary: getItemValue(option).text,
|
|
1899
|
+
color: "text.primary",
|
|
1900
|
+
sx: { overflow: "hidden" },
|
|
1901
|
+
slotProps: { primary: { noWrap: true, title: getItemValue(option).text } }
|
|
1902
|
+
}
|
|
1903
|
+
));
|
|
1872
1904
|
})
|
|
1873
1905
|
)
|
|
1874
1906
|
)));
|
|
@@ -5128,25 +5160,28 @@ var SCCard = ({ width, title, image, iconTitle, actionsTitle, subtitle, dividerH
|
|
|
5128
5160
|
};
|
|
5129
5161
|
|
|
5130
5162
|
// src/Components/SCDataGrid.tsx
|
|
5131
|
-
import React44, { useEffect as useEffect19, useState as useState25 } from "react";
|
|
5163
|
+
import React44, { useEffect as useEffect19, useState as useState25, useRef as useRef7 } from "react";
|
|
5132
5164
|
import { DataGridPro, useGridApiRef } from "@mui/x-data-grid-pro";
|
|
5133
5165
|
import { LicenseInfo as LicenseInfo2 } from "@mui/x-license";
|
|
5166
|
+
import { Button as Button19, TextField as TextField7 } from "@mui/material";
|
|
5134
5167
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
5135
5168
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
5136
5169
|
import { useTheme } from "@mui/material/styles";
|
|
5137
|
-
function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPage, rowsTable, rowSelection, checkboxSelection, width, maxHeight, density, disableColumnMenu, disableHeader, disableColumnSorting, setSelectedIndex, selectedIndex = 0, setSelectedRow, selectedRow }) {
|
|
5170
|
+
function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPage, rowsTable, rowSelection, checkboxSelection, width, maxHeight, density, disableColumnMenu, disableHeader, disableColumnSorting, setSelectedIndex, selectedIndex = 0, setSelectedRow, selectedRow, insertRowFields, onAddRow }) {
|
|
5171
|
+
var _a;
|
|
5138
5172
|
LicenseInfo2.setLicenseKey(
|
|
5139
5173
|
"aa892a011e4c240f3cdaf811ecfff54fTz0xMjkyODQsRT0xODEwNDI1NTk5MDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LEtWPTI="
|
|
5140
5174
|
);
|
|
5141
5175
|
const theme = useTheme();
|
|
5142
5176
|
const apiRef = useGridApiRef();
|
|
5143
5177
|
const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
|
|
5178
|
+
const showInsertRow = insertRowFields != void 0 && insertRowFields.length > 0;
|
|
5144
5179
|
function generateRandomId() {
|
|
5145
5180
|
return Math.floor(Math.random() * 1e6);
|
|
5146
5181
|
}
|
|
5147
5182
|
const getTreeDataPaths = (row) => {
|
|
5148
|
-
var
|
|
5149
|
-
const group1Value = groupColumns && ((
|
|
5183
|
+
var _a2, _b, _c;
|
|
5184
|
+
const group1Value = groupColumns && ((_a2 = groupColumns(row)) == null ? void 0 : _a2.valueGroup1);
|
|
5150
5185
|
const group2Value = groupColumns && ((_b = groupColumns(row)) == null ? void 0 : _b.valueGroup2);
|
|
5151
5186
|
const fieldValue = groupColumns && ((_c = groupColumns(row)) == null ? void 0 : _c.fieldFirstColumn);
|
|
5152
5187
|
return [
|
|
@@ -5160,7 +5195,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5160
5195
|
headerName: groupColumns ? groupColumns(data[0]).headerNameFirstColumn : "Agrupador",
|
|
5161
5196
|
flex: 1,
|
|
5162
5197
|
renderCell: (params) => {
|
|
5163
|
-
var
|
|
5198
|
+
var _a2, _b;
|
|
5164
5199
|
let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
|
|
5165
5200
|
let maxDepth = 0;
|
|
5166
5201
|
if (groupColumns && data.length > 0) {
|
|
@@ -5175,8 +5210,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5175
5210
|
if (groupColumns) {
|
|
5176
5211
|
const originalItem = data.find(
|
|
5177
5212
|
(item) => {
|
|
5178
|
-
var
|
|
5179
|
-
return String((
|
|
5213
|
+
var _a3;
|
|
5214
|
+
return String((_a3 = groupColumns(item)) == null ? void 0 : _a3.valueGroup1) === label;
|
|
5180
5215
|
}
|
|
5181
5216
|
);
|
|
5182
5217
|
if (originalItem) {
|
|
@@ -5185,22 +5220,22 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5185
5220
|
}
|
|
5186
5221
|
}
|
|
5187
5222
|
let subgroup1 = arrayRows.filter((r) => {
|
|
5188
|
-
var
|
|
5189
|
-
return groupColumns && String((
|
|
5223
|
+
var _a3;
|
|
5224
|
+
return groupColumns && String((_a3 = groupColumns(r)) == null ? void 0 : _a3.valueGroup1) === label;
|
|
5190
5225
|
}).map((r) => {
|
|
5191
|
-
var
|
|
5192
|
-
return groupColumns && String(((
|
|
5226
|
+
var _a3, _b2;
|
|
5227
|
+
return groupColumns && String(((_a3 = groupColumns(r)) == null ? void 0 : _a3.valueGroup2) || ((_b2 = groupColumns(r)) == null ? void 0 : _b2.fieldFirstColumn));
|
|
5193
5228
|
});
|
|
5194
5229
|
const groupedDataLength1 = subgroup1.filter((valor, indiceActual, arreglo) => arreglo.indexOf(valor) === indiceActual);
|
|
5195
5230
|
label = `${customLabel} (${groupedDataLength1.length})`;
|
|
5196
|
-
} else if (((
|
|
5231
|
+
} else if (((_a2 = groupColumns(data[0])) == null ? void 0 : _a2.valueGroup2) && params.rowNode.depth === 1) {
|
|
5197
5232
|
const labelGrouping1 = (_b = params.api.getRowNode(params.rowNode.parent)) == null ? void 0 : _b.groupingKey.toString();
|
|
5198
5233
|
let customLabel = label;
|
|
5199
5234
|
if (groupColumns) {
|
|
5200
5235
|
const originalItem = data.find(
|
|
5201
5236
|
(item) => {
|
|
5202
|
-
var
|
|
5203
|
-
return String((
|
|
5237
|
+
var _a3;
|
|
5238
|
+
return String((_a3 = groupColumns(item)) == null ? void 0 : _a3.valueGroup2) === label;
|
|
5204
5239
|
}
|
|
5205
5240
|
);
|
|
5206
5241
|
if (originalItem) {
|
|
@@ -5210,8 +5245,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5210
5245
|
}
|
|
5211
5246
|
const groupedDataLength2 = arrayRows.filter(
|
|
5212
5247
|
(r) => {
|
|
5213
|
-
var
|
|
5214
|
-
return groupColumns && String((
|
|
5248
|
+
var _a3, _b2;
|
|
5249
|
+
return groupColumns && String((_a3 = groupColumns(r)) == null ? void 0 : _a3.valueGroup1) === labelGrouping1 && groupColumns && String((_b2 = groupColumns(r)) == null ? void 0 : _b2.valueGroup2) === label;
|
|
5215
5250
|
}
|
|
5216
5251
|
).length;
|
|
5217
5252
|
label = `${customLabel} (${groupedDataLength2})`;
|
|
@@ -5256,25 +5291,25 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5256
5291
|
);
|
|
5257
5292
|
},
|
|
5258
5293
|
colSpan: (params) => {
|
|
5259
|
-
var
|
|
5294
|
+
var _a2, _b;
|
|
5260
5295
|
const value = String(params);
|
|
5261
|
-
const fieldGrouping1 = groupColumns ? (
|
|
5296
|
+
const fieldGrouping1 = groupColumns ? (_a2 = groupColumns(data[0])) == null ? void 0 : _a2.valueGroup1 : void 0;
|
|
5262
5297
|
const fieldGrouping2 = groupColumns ? (_b = groupColumns(data[0])) == null ? void 0 : _b.valueGroup2 : void 0;
|
|
5263
5298
|
let agrupado1 = false;
|
|
5264
5299
|
let agrupado2 = false;
|
|
5265
5300
|
if (fieldGrouping1 != void 0) {
|
|
5266
5301
|
agrupado1 = arrayRows.some(
|
|
5267
5302
|
(row) => {
|
|
5268
|
-
var
|
|
5269
|
-
return groupColumns && String((
|
|
5303
|
+
var _a3;
|
|
5304
|
+
return groupColumns && String((_a3 = groupColumns(row)) == null ? void 0 : _a3.valueGroup1) === value;
|
|
5270
5305
|
}
|
|
5271
5306
|
);
|
|
5272
5307
|
}
|
|
5273
5308
|
if (fieldGrouping2 != void 0) {
|
|
5274
5309
|
agrupado2 = arrayRows.some(
|
|
5275
5310
|
(row) => {
|
|
5276
|
-
var
|
|
5277
|
-
return groupColumns && String((
|
|
5311
|
+
var _a3;
|
|
5312
|
+
return groupColumns && String((_a3 = groupColumns(row)) == null ? void 0 : _a3.valueGroup2) === value;
|
|
5278
5313
|
}
|
|
5279
5314
|
);
|
|
5280
5315
|
}
|
|
@@ -5296,11 +5331,35 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5296
5331
|
const [pageSize, setPageSize] = useState25(rows);
|
|
5297
5332
|
const [arrayRows, setArrayRows] = useState25([]);
|
|
5298
5333
|
const [selectionModel, setSelectionModel] = useState25([]);
|
|
5334
|
+
const [insertRowValues, setInsertRowValues] = useState25({});
|
|
5335
|
+
const INSERT_ROW_ID = "__sc-datagrid-insert-row__";
|
|
5336
|
+
const resolvedGetRowId = (row) => (row == null ? void 0 : row.__isInsertRow) ? INSERT_ROW_ID : getRowId ? getRowId(row) : row.id;
|
|
5337
|
+
const pinnedRows = showInsertRow ? { bottom: [__spreadValues({ __isInsertRow: true }, insertRowValues)] } : void 0;
|
|
5338
|
+
const normalizedInsertRowFields = (insertRowFields && insertRowFields.length > 0 ? insertRowFields : [(_a = columns[0]) == null ? void 0 : _a.field]).map((item) => typeof item === "string" ? { field: item } : item);
|
|
5339
|
+
const insertRowTargetFields = normalizedInsertRowFields.map((item) => item.field);
|
|
5340
|
+
const isInsertRowValueFilled = (value) => value !== void 0 && value !== null && (typeof value !== "string" || value.trim() !== "");
|
|
5341
|
+
const hasInsertRowValue = () => insertRowTargetFields.some((field) => isInsertRowValueFilled(insertRowValues[field]));
|
|
5342
|
+
const handleAddInsertRow = () => {
|
|
5343
|
+
if (!hasInsertRowValue()) return;
|
|
5344
|
+
const nextId = Math.max(0, ...arrayRows.map((row) => typeof row.id === "number" ? row.id : 0)) + 1;
|
|
5345
|
+
const newRow = { id: nextId };
|
|
5346
|
+
insertRowTargetFields.forEach((field) => {
|
|
5347
|
+
const value = insertRowValues[field];
|
|
5348
|
+
if (isInsertRowValueFilled(value)) newRow[field] = typeof value === "string" ? value.trim() : value;
|
|
5349
|
+
});
|
|
5350
|
+
setArrayRows((prev) => [...prev, newRow]);
|
|
5351
|
+
setInsertRowValues({});
|
|
5352
|
+
onAddRow && onAddRow(newRow);
|
|
5353
|
+
};
|
|
5354
|
+
const hasInsertRowValueRef = useRef7(hasInsertRowValue);
|
|
5355
|
+
hasInsertRowValueRef.current = hasInsertRowValue;
|
|
5356
|
+
const handleAddInsertRowRef = useRef7(handleAddInsertRow);
|
|
5357
|
+
handleAddInsertRowRef.current = handleAddInsertRow;
|
|
5299
5358
|
useEffect19(() => {
|
|
5300
|
-
var
|
|
5359
|
+
var _a2;
|
|
5301
5360
|
if (setSelectedRow) {
|
|
5302
5361
|
setSelectedRow(arrayRows[selectedIndex]);
|
|
5303
|
-
setSelectionModel(((
|
|
5362
|
+
setSelectionModel(((_a2 = arrayRows[selectedIndex]) == null ? void 0 : _a2.id) ? [arrayRows[selectedIndex].id] : []);
|
|
5304
5363
|
}
|
|
5305
5364
|
}, [selectedIndex]);
|
|
5306
5365
|
useEffect19(() => {
|
|
@@ -5309,7 +5368,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5309
5368
|
}
|
|
5310
5369
|
}, [data]);
|
|
5311
5370
|
const dataConvertRows = (data2, columnId) => {
|
|
5312
|
-
var
|
|
5371
|
+
var _a2;
|
|
5313
5372
|
let dataConvert = [];
|
|
5314
5373
|
if ((data2 == null ? void 0 : data2.length) > 0) {
|
|
5315
5374
|
const dataKeys = Object.keys(data2[0]);
|
|
@@ -5327,7 +5386,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5327
5386
|
setArrayRows(dataConvert);
|
|
5328
5387
|
if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
|
|
5329
5388
|
setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
|
|
5330
|
-
setSelectionModel([(
|
|
5389
|
+
setSelectionModel([(_a2 = dataConvert[0]) == null ? void 0 : _a2.id]);
|
|
5331
5390
|
}
|
|
5332
5391
|
};
|
|
5333
5392
|
const handleSelectionChange = (newSelection) => {
|
|
@@ -5369,17 +5428,59 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5369
5428
|
}
|
|
5370
5429
|
}
|
|
5371
5430
|
};
|
|
5372
|
-
const processedColumns = columns.map((col) => {
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
return __spreadProps(__spreadValues({},
|
|
5380
|
-
|
|
5431
|
+
const processedColumns = React44.useMemo(() => columns.map((col, index) => {
|
|
5432
|
+
const baseCol = col.width !== void 0 || col.flex !== void 0 ? col : __spreadProps(__spreadValues({}, col), { flex: 1 });
|
|
5433
|
+
if (!showInsertRow) return baseCol;
|
|
5434
|
+
const isLastColumn = index === columns.length - 1;
|
|
5435
|
+
const isInputField = !isLastColumn && insertRowTargetFields.includes(baseCol.field);
|
|
5436
|
+
const fieldConfig = normalizedInsertRowFields.find((item) => item.field === baseCol.field);
|
|
5437
|
+
const originalRenderCell = baseCol.renderCell;
|
|
5438
|
+
return __spreadProps(__spreadValues({}, baseCol), {
|
|
5439
|
+
renderCell: (params) => {
|
|
5440
|
+
if (params.id !== INSERT_ROW_ID) {
|
|
5441
|
+
return originalRenderCell ? originalRenderCell(params) : params.formattedValue;
|
|
5442
|
+
}
|
|
5443
|
+
if (isInputField) {
|
|
5444
|
+
const setFieldValue = (newValue) => setInsertRowValues((prev) => __spreadProps(__spreadValues({}, prev), { [baseCol.field]: newValue }));
|
|
5445
|
+
if (fieldConfig == null ? void 0 : fieldConfig.renderCell) {
|
|
5446
|
+
return fieldConfig.renderCell({
|
|
5447
|
+
value: params.value,
|
|
5448
|
+
onChange: setFieldValue,
|
|
5449
|
+
field: baseCol.field
|
|
5450
|
+
});
|
|
5451
|
+
}
|
|
5452
|
+
return /* @__PURE__ */ React44.createElement(
|
|
5453
|
+
TextField7,
|
|
5454
|
+
{
|
|
5455
|
+
variant: "outlined",
|
|
5456
|
+
size: "small",
|
|
5457
|
+
placeholder: (fieldConfig == null ? void 0 : fieldConfig.placeholder) || baseCol.headerName || `Escribir ${baseCol.field}`,
|
|
5458
|
+
value: params.value || "",
|
|
5459
|
+
onChange: (e) => setFieldValue(e.target.value),
|
|
5460
|
+
onKeyDown: (e) => {
|
|
5461
|
+
e.stopPropagation();
|
|
5462
|
+
if (e.key === "Enter") handleAddInsertRowRef.current();
|
|
5463
|
+
},
|
|
5464
|
+
sx: { width: "100%", "& .MuiOutlinedInput-root": { height: "32px" } }
|
|
5465
|
+
}
|
|
5466
|
+
);
|
|
5467
|
+
}
|
|
5468
|
+
if (isLastColumn) {
|
|
5469
|
+
return /* @__PURE__ */ React44.createElement(
|
|
5470
|
+
Button19,
|
|
5471
|
+
{
|
|
5472
|
+
variant: "contained",
|
|
5473
|
+
size: "small",
|
|
5474
|
+
disabled: !hasInsertRowValueRef.current(),
|
|
5475
|
+
onClick: () => handleAddInsertRowRef.current()
|
|
5476
|
+
},
|
|
5477
|
+
"Agregar"
|
|
5478
|
+
);
|
|
5479
|
+
}
|
|
5480
|
+
return null;
|
|
5481
|
+
}
|
|
5381
5482
|
});
|
|
5382
|
-
});
|
|
5483
|
+
}), [columns, showInsertRow, insertRowFields]);
|
|
5383
5484
|
const columnVisibilityModel = {};
|
|
5384
5485
|
processedColumns.forEach((col) => {
|
|
5385
5486
|
if (col.hide === true) {
|
|
@@ -5400,7 +5501,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5400
5501
|
return /* @__PURE__ */ React44.createElement(React44.Fragment, null, data && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement("div", { style: { width: width || "100%", maxHeight: maxHeight ? `${maxHeight}px` : "none" } }, /* @__PURE__ */ React44.createElement(
|
|
5401
5502
|
DataGridPro,
|
|
5402
5503
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
5403
|
-
getRowId,
|
|
5504
|
+
getRowId: showInsertRow ? resolvedGetRowId : getRowId,
|
|
5505
|
+
pinnedRows,
|
|
5404
5506
|
apiRef,
|
|
5405
5507
|
rowHeight: styleRowHeight,
|
|
5406
5508
|
rows: arrayRows,
|
|
@@ -5437,6 +5539,12 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5437
5539
|
},
|
|
5438
5540
|
sx: {
|
|
5439
5541
|
maxHeight: maxHeight ? `${maxHeight}px` : "none",
|
|
5542
|
+
"& .MuiDataGrid-pinnedRows": {
|
|
5543
|
+
boxShadow: "0px -2px 3px -2px rgba(0,0,0,0.15)"
|
|
5544
|
+
},
|
|
5545
|
+
"& .MuiDataGrid-pinnedRows .MuiDataGrid-cell": {
|
|
5546
|
+
backgroundColor: "#FBFBFB"
|
|
5547
|
+
},
|
|
5440
5548
|
"& .MuiDataGrid-columnHeaders": {
|
|
5441
5549
|
display: disableHeader == true ? "none" : "block"
|
|
5442
5550
|
},
|
|
@@ -5633,7 +5741,7 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
|
|
|
5633
5741
|
|
|
5634
5742
|
// src/Components/SCDialog.tsx
|
|
5635
5743
|
import React46, { useEffect as useEffect20, useState as useState27 } from "react";
|
|
5636
|
-
import { Button as
|
|
5744
|
+
import { Button as Button20, Typography as Typography26, Modal as Modal5, Dialog as Dialog4, DialogActions as DialogActions4, DialogContent as DialogContent4, DialogTitle as DialogTitle4, IconButton as IconButton17, Tooltip as Tooltip8, Box as Box27, SvgIcon as SvgIcon10 } from "@mui/material";
|
|
5637
5745
|
import Grid11 from "@mui/material/Grid";
|
|
5638
5746
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
5639
5747
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
@@ -5698,7 +5806,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5698
5806
|
};
|
|
5699
5807
|
const dialogActions = actions == false ? false : actions != void 0 ? actions : [{ text: "Cerrar", fn: handleClose }];
|
|
5700
5808
|
content = content != null ? content : { component: /* @__PURE__ */ React46.createElement(Box27, null, " Aqui va el contenido ") };
|
|
5701
|
-
return /* @__PURE__ */ React46.createElement("div", null, buttonDialog ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, buttonDialog.text != void 0 ? /* @__PURE__ */ React46.createElement(Tooltip8, { placement: "bottom-start", title: buttonDialog.tooltip != void 0 ? buttonDialog.tooltip : "", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ React46.createElement(
|
|
5809
|
+
return /* @__PURE__ */ React46.createElement("div", null, buttonDialog ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, buttonDialog.text != void 0 ? /* @__PURE__ */ React46.createElement(Tooltip8, { placement: "bottom-start", title: buttonDialog.tooltip != void 0 ? buttonDialog.tooltip : "", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ React46.createElement(Button20, { size: "small", color: buttonDialog.color != void 0 ? buttonDialog.color : "primary", variant: (buttonDialog == null ? void 0 : buttonDialog.variant) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.variant : "text", startIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "left" ? /* @__PURE__ */ React46.createElement(ButtonIcon, null) : "" : "", endIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "right" ? /* @__PURE__ */ React46.createElement(ButtonIcon, null) : "" : "", onClick: handleOpen }, " ", (buttonDialog == null ? void 0 : buttonDialog.text) != void 0 ? buttonDialog.text : "", " ")) : /* @__PURE__ */ React46.createElement(IconButton17, { style: { cursor: "pointer" }, onClick: handleOpen }, /* @__PURE__ */ React46.createElement(SvgIcon10, { fontSize: "small", color: (buttonDialog == null ? void 0 : buttonDialog.color) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.color : "action", component: ButtonIcon }))) : "", /* @__PURE__ */ React46.createElement(Modal5, { open: open || false, onClose: handleClose }, /* @__PURE__ */ React46.createElement(
|
|
5702
5810
|
Dialog4,
|
|
5703
5811
|
{
|
|
5704
5812
|
fullScreen: typeView === "mobile" ? true : false,
|
|
@@ -5754,7 +5862,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5754
5862
|
) : content.component
|
|
5755
5863
|
),
|
|
5756
5864
|
dialogActions != void 0 && dialogActions != false ? Array.isArray(dialogActions) && (dialogActions == null ? void 0 : dialogActions.length) > 0 ? /* @__PURE__ */ React46.createElement(DialogActions4, { sx: { zIndex: 1200, gap: 1, m: 0, padding: "12px 16px 12px 16px", justifyContent: dialogActions.length >= 3 ? "space-between" : "flex-end" } }, typeView !== "mobile" ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, dialogActions.length >= 3 ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
|
|
5757
|
-
|
|
5865
|
+
Button20,
|
|
5758
5866
|
{
|
|
5759
5867
|
variant: "text",
|
|
5760
5868
|
color: dialogActions[0].color || "primary",
|
|
@@ -5766,7 +5874,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5766
5874
|
dialogActions[0].text
|
|
5767
5875
|
), /* @__PURE__ */ React46.createElement(Box27, { sx: { display: "flex", gap: 1 } }, dialogActions.slice(1).map((boton, index) => {
|
|
5768
5876
|
return /* @__PURE__ */ React46.createElement(
|
|
5769
|
-
|
|
5877
|
+
Button20,
|
|
5770
5878
|
{
|
|
5771
5879
|
key: index + 1,
|
|
5772
5880
|
variant: index === dialogActions.length - 2 ? "contained" : "text",
|
|
@@ -5780,7 +5888,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5780
5888
|
);
|
|
5781
5889
|
}))) : dialogActions.map((boton, index) => {
|
|
5782
5890
|
return /* @__PURE__ */ React46.createElement(
|
|
5783
|
-
|
|
5891
|
+
Button20,
|
|
5784
5892
|
{
|
|
5785
5893
|
key: index,
|
|
5786
5894
|
variant: index === dialogActions.length - 1 ? "contained" : "text",
|
|
@@ -5801,7 +5909,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5801
5909
|
|
|
5802
5910
|
// src/Components/SCDownloadExcelTable.tsx
|
|
5803
5911
|
import React47 from "react";
|
|
5804
|
-
import { Button as
|
|
5912
|
+
import { Button as Button21 } from "@mui/material";
|
|
5805
5913
|
import FileDownloadOutlinedIcon2 from "@mui/icons-material/FileDownloadOutlined";
|
|
5806
5914
|
import * as XLSX from "xlsx";
|
|
5807
5915
|
var SCDownloadExcelTable = ({
|
|
@@ -5835,7 +5943,7 @@ var SCDownloadExcelTable = ({
|
|
|
5835
5943
|
XLSX.writeFile(workbook, `${fileName}.xlsx`);
|
|
5836
5944
|
};
|
|
5837
5945
|
return /* @__PURE__ */ React47.createElement(
|
|
5838
|
-
|
|
5946
|
+
Button21,
|
|
5839
5947
|
{
|
|
5840
5948
|
onClick: descargaExcel,
|
|
5841
5949
|
startIcon: /* @__PURE__ */ React47.createElement(FileDownloadOutlinedIcon2, null),
|
|
@@ -6725,7 +6833,6 @@ var components = {
|
|
|
6725
6833
|
color: theme.palette.primary.main
|
|
6726
6834
|
}),
|
|
6727
6835
|
colorDefault: ({ theme }) => ({
|
|
6728
|
-
backgroundColor: theme.palette.default.main,
|
|
6729
6836
|
color: theme.palette.default.contrastText
|
|
6730
6837
|
}),
|
|
6731
6838
|
deleteIcon: ({ theme }) => ({
|
|
@@ -6835,47 +6942,6 @@ var components = {
|
|
|
6835
6942
|
height: "inherit",
|
|
6836
6943
|
borderRadius: 4,
|
|
6837
6944
|
variants: [
|
|
6838
|
-
{
|
|
6839
|
-
props: { variant: "outlined", color: "default" },
|
|
6840
|
-
style: {
|
|
6841
|
-
border: `1px solid ${theme.palette.grey[400]}`,
|
|
6842
|
-
backgroundColor: "transparent ",
|
|
6843
|
-
color: theme.palette.default.contrastText,
|
|
6844
|
-
":hover": {
|
|
6845
|
-
backgroundColor: theme.palette.default.main
|
|
6846
|
-
}
|
|
6847
|
-
}
|
|
6848
|
-
},
|
|
6849
|
-
{
|
|
6850
|
-
props: { variant: "standard", color: "default" },
|
|
6851
|
-
style: {
|
|
6852
|
-
backgroundColor: theme.palette.default.main,
|
|
6853
|
-
color: theme.palette.default.contrastText,
|
|
6854
|
-
":hover": {
|
|
6855
|
-
backgroundColor: theme.palette.default.dark
|
|
6856
|
-
}
|
|
6857
|
-
}
|
|
6858
|
-
},
|
|
6859
|
-
{
|
|
6860
|
-
props: { variant: "filled", color: "default" },
|
|
6861
|
-
style: {
|
|
6862
|
-
backgroundColor: theme.palette.grey[50],
|
|
6863
|
-
color: theme.palette.default.contrastText,
|
|
6864
|
-
":hover": {
|
|
6865
|
-
backgroundColor: theme.palette.grey[100]
|
|
6866
|
-
}
|
|
6867
|
-
}
|
|
6868
|
-
},
|
|
6869
|
-
{
|
|
6870
|
-
props: { variant: "filled", color: "default" },
|
|
6871
|
-
style: {
|
|
6872
|
-
backgroundColor: theme.palette.grey[50],
|
|
6873
|
-
color: theme.palette.default.contrastText,
|
|
6874
|
-
":hover": {
|
|
6875
|
-
backgroundColor: theme.palette.grey[100]
|
|
6876
|
-
}
|
|
6877
|
-
}
|
|
6878
|
-
},
|
|
6879
6945
|
{
|
|
6880
6946
|
props: { variant: "standard", avatar: true },
|
|
6881
6947
|
style: {
|
|
@@ -6946,7 +7012,40 @@ var components = {
|
|
|
6946
7012
|
}
|
|
6947
7013
|
]
|
|
6948
7014
|
})
|
|
6949
|
-
}
|
|
7015
|
+
},
|
|
7016
|
+
variants: [
|
|
7017
|
+
{
|
|
7018
|
+
props: { variant: "outlined", color: "default" },
|
|
7019
|
+
style: ({ theme }) => ({
|
|
7020
|
+
border: `1px solid ${theme.palette.grey[400]}`,
|
|
7021
|
+
backgroundColor: "transparent",
|
|
7022
|
+
color: theme.palette.default.contrastText,
|
|
7023
|
+
":hover": {
|
|
7024
|
+
backgroundColor: theme.palette.default.main
|
|
7025
|
+
}
|
|
7026
|
+
})
|
|
7027
|
+
},
|
|
7028
|
+
{
|
|
7029
|
+
props: { variant: "standard", color: "default" },
|
|
7030
|
+
style: ({ theme }) => ({
|
|
7031
|
+
backgroundColor: theme.palette.default.main,
|
|
7032
|
+
color: theme.palette.default.contrastText,
|
|
7033
|
+
":hover": {
|
|
7034
|
+
backgroundColor: theme.palette.default.dark
|
|
7035
|
+
}
|
|
7036
|
+
})
|
|
7037
|
+
},
|
|
7038
|
+
{
|
|
7039
|
+
props: { variant: "filled", color: "default" },
|
|
7040
|
+
style: ({ theme }) => ({
|
|
7041
|
+
backgroundColor: theme.palette.grey[50],
|
|
7042
|
+
color: theme.palette.default.contrastText,
|
|
7043
|
+
":hover": {
|
|
7044
|
+
backgroundColor: theme.palette.grey[100]
|
|
7045
|
+
}
|
|
7046
|
+
})
|
|
7047
|
+
}
|
|
7048
|
+
]
|
|
6950
7049
|
},
|
|
6951
7050
|
MuiAvatar: {
|
|
6952
7051
|
styleOverrides: {
|