componentes-sinco 1.3.4 → 1.3.5
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 +215 -121
- 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 +181 -87
- 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
|
)));
|
|
@@ -5131,22 +5163,25 @@ var SCCard = ({ width, title, image, iconTitle, actionsTitle, subtitle, dividerH
|
|
|
5131
5163
|
import React44, { useEffect as useEffect19, useState as useState25 } 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,31 @@ 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: [{ __isInsertRow: true }] } : 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
|
+
};
|
|
5299
5354
|
useEffect19(() => {
|
|
5300
|
-
var
|
|
5355
|
+
var _a2;
|
|
5301
5356
|
if (setSelectedRow) {
|
|
5302
5357
|
setSelectedRow(arrayRows[selectedIndex]);
|
|
5303
|
-
setSelectionModel(((
|
|
5358
|
+
setSelectionModel(((_a2 = arrayRows[selectedIndex]) == null ? void 0 : _a2.id) ? [arrayRows[selectedIndex].id] : []);
|
|
5304
5359
|
}
|
|
5305
5360
|
}, [selectedIndex]);
|
|
5306
5361
|
useEffect19(() => {
|
|
@@ -5309,7 +5364,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5309
5364
|
}
|
|
5310
5365
|
}, [data]);
|
|
5311
5366
|
const dataConvertRows = (data2, columnId) => {
|
|
5312
|
-
var
|
|
5367
|
+
var _a2;
|
|
5313
5368
|
let dataConvert = [];
|
|
5314
5369
|
if ((data2 == null ? void 0 : data2.length) > 0) {
|
|
5315
5370
|
const dataKeys = Object.keys(data2[0]);
|
|
@@ -5327,7 +5382,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5327
5382
|
setArrayRows(dataConvert);
|
|
5328
5383
|
if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
|
|
5329
5384
|
setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
|
|
5330
|
-
setSelectionModel([(
|
|
5385
|
+
setSelectionModel([(_a2 = dataConvert[0]) == null ? void 0 : _a2.id]);
|
|
5331
5386
|
}
|
|
5332
5387
|
};
|
|
5333
5388
|
const handleSelectionChange = (newSelection) => {
|
|
@@ -5369,15 +5424,56 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5369
5424
|
}
|
|
5370
5425
|
}
|
|
5371
5426
|
};
|
|
5372
|
-
const processedColumns = columns.map((col) => {
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
}
|
|
5379
|
-
|
|
5380
|
-
|
|
5427
|
+
const processedColumns = columns.map((col, index) => {
|
|
5428
|
+
const baseCol = col.width !== void 0 || col.flex !== void 0 ? col : __spreadProps(__spreadValues({}, col), { flex: 1 });
|
|
5429
|
+
if (!showInsertRow) return baseCol;
|
|
5430
|
+
const isLastColumn = index === columns.length - 1;
|
|
5431
|
+
const isInputField = !isLastColumn && insertRowTargetFields.includes(baseCol.field);
|
|
5432
|
+
const originalRenderCell = baseCol.renderCell;
|
|
5433
|
+
return __spreadProps(__spreadValues({}, baseCol), {
|
|
5434
|
+
renderCell: (params) => {
|
|
5435
|
+
if (params.id !== INSERT_ROW_ID) {
|
|
5436
|
+
return originalRenderCell ? originalRenderCell(params) : params.formattedValue;
|
|
5437
|
+
}
|
|
5438
|
+
if (isInputField) {
|
|
5439
|
+
const fieldConfig = normalizedInsertRowFields.find((item) => item.field === baseCol.field);
|
|
5440
|
+
const setFieldValue = (newValue) => setInsertRowValues((prev) => __spreadProps(__spreadValues({}, prev), { [baseCol.field]: newValue }));
|
|
5441
|
+
if (fieldConfig == null ? void 0 : fieldConfig.renderCell) {
|
|
5442
|
+
return fieldConfig.renderCell({
|
|
5443
|
+
value: insertRowValues[baseCol.field],
|
|
5444
|
+
onChange: setFieldValue,
|
|
5445
|
+
field: baseCol.field
|
|
5446
|
+
});
|
|
5447
|
+
}
|
|
5448
|
+
return /* @__PURE__ */ React44.createElement(
|
|
5449
|
+
TextField7,
|
|
5450
|
+
{
|
|
5451
|
+
variant: "outlined",
|
|
5452
|
+
size: "small",
|
|
5453
|
+
placeholder: (fieldConfig == null ? void 0 : fieldConfig.placeholder) || baseCol.headerName || `Escribir ${baseCol.field}`,
|
|
5454
|
+
value: insertRowValues[baseCol.field] || "",
|
|
5455
|
+
onChange: (e) => setFieldValue(e.target.value),
|
|
5456
|
+
onKeyDown: (e) => {
|
|
5457
|
+
if (e.key === "Enter") handleAddInsertRow();
|
|
5458
|
+
},
|
|
5459
|
+
sx: { width: "100%", "& .MuiOutlinedInput-root": { height: "32px" } }
|
|
5460
|
+
}
|
|
5461
|
+
);
|
|
5462
|
+
}
|
|
5463
|
+
if (isLastColumn) {
|
|
5464
|
+
return /* @__PURE__ */ React44.createElement(
|
|
5465
|
+
Button19,
|
|
5466
|
+
{
|
|
5467
|
+
variant: "contained",
|
|
5468
|
+
size: "small",
|
|
5469
|
+
disabled: !hasInsertRowValue(),
|
|
5470
|
+
onClick: handleAddInsertRow
|
|
5471
|
+
},
|
|
5472
|
+
"Agregar"
|
|
5473
|
+
);
|
|
5474
|
+
}
|
|
5475
|
+
return null;
|
|
5476
|
+
}
|
|
5381
5477
|
});
|
|
5382
5478
|
});
|
|
5383
5479
|
const columnVisibilityModel = {};
|
|
@@ -5400,7 +5496,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5400
5496
|
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
5497
|
DataGridPro,
|
|
5402
5498
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
5403
|
-
getRowId,
|
|
5499
|
+
getRowId: showInsertRow ? resolvedGetRowId : getRowId,
|
|
5500
|
+
pinnedRows,
|
|
5404
5501
|
apiRef,
|
|
5405
5502
|
rowHeight: styleRowHeight,
|
|
5406
5503
|
rows: arrayRows,
|
|
@@ -5437,6 +5534,12 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5437
5534
|
},
|
|
5438
5535
|
sx: {
|
|
5439
5536
|
maxHeight: maxHeight ? `${maxHeight}px` : "none",
|
|
5537
|
+
"& .MuiDataGrid-pinnedRows": {
|
|
5538
|
+
boxShadow: "0px -2px 3px -2px rgba(0,0,0,0.15)"
|
|
5539
|
+
},
|
|
5540
|
+
"& .MuiDataGrid-pinnedRows .MuiDataGrid-cell": {
|
|
5541
|
+
backgroundColor: "#FBFBFB"
|
|
5542
|
+
},
|
|
5440
5543
|
"& .MuiDataGrid-columnHeaders": {
|
|
5441
5544
|
display: disableHeader == true ? "none" : "block"
|
|
5442
5545
|
},
|
|
@@ -5633,7 +5736,7 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
|
|
|
5633
5736
|
|
|
5634
5737
|
// src/Components/SCDialog.tsx
|
|
5635
5738
|
import React46, { useEffect as useEffect20, useState as useState27 } from "react";
|
|
5636
|
-
import { Button as
|
|
5739
|
+
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
5740
|
import Grid11 from "@mui/material/Grid";
|
|
5638
5741
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
5639
5742
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
@@ -5698,7 +5801,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5698
5801
|
};
|
|
5699
5802
|
const dialogActions = actions == false ? false : actions != void 0 ? actions : [{ text: "Cerrar", fn: handleClose }];
|
|
5700
5803
|
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(
|
|
5804
|
+
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
5805
|
Dialog4,
|
|
5703
5806
|
{
|
|
5704
5807
|
fullScreen: typeView === "mobile" ? true : false,
|
|
@@ -5754,7 +5857,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5754
5857
|
) : content.component
|
|
5755
5858
|
),
|
|
5756
5859
|
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
|
-
|
|
5860
|
+
Button20,
|
|
5758
5861
|
{
|
|
5759
5862
|
variant: "text",
|
|
5760
5863
|
color: dialogActions[0].color || "primary",
|
|
@@ -5766,7 +5869,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5766
5869
|
dialogActions[0].text
|
|
5767
5870
|
), /* @__PURE__ */ React46.createElement(Box27, { sx: { display: "flex", gap: 1 } }, dialogActions.slice(1).map((boton, index) => {
|
|
5768
5871
|
return /* @__PURE__ */ React46.createElement(
|
|
5769
|
-
|
|
5872
|
+
Button20,
|
|
5770
5873
|
{
|
|
5771
5874
|
key: index + 1,
|
|
5772
5875
|
variant: index === dialogActions.length - 2 ? "contained" : "text",
|
|
@@ -5780,7 +5883,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5780
5883
|
);
|
|
5781
5884
|
}))) : dialogActions.map((boton, index) => {
|
|
5782
5885
|
return /* @__PURE__ */ React46.createElement(
|
|
5783
|
-
|
|
5886
|
+
Button20,
|
|
5784
5887
|
{
|
|
5785
5888
|
key: index,
|
|
5786
5889
|
variant: index === dialogActions.length - 1 ? "contained" : "text",
|
|
@@ -5801,7 +5904,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5801
5904
|
|
|
5802
5905
|
// src/Components/SCDownloadExcelTable.tsx
|
|
5803
5906
|
import React47 from "react";
|
|
5804
|
-
import { Button as
|
|
5907
|
+
import { Button as Button21 } from "@mui/material";
|
|
5805
5908
|
import FileDownloadOutlinedIcon2 from "@mui/icons-material/FileDownloadOutlined";
|
|
5806
5909
|
import * as XLSX from "xlsx";
|
|
5807
5910
|
var SCDownloadExcelTable = ({
|
|
@@ -5835,7 +5938,7 @@ var SCDownloadExcelTable = ({
|
|
|
5835
5938
|
XLSX.writeFile(workbook, `${fileName}.xlsx`);
|
|
5836
5939
|
};
|
|
5837
5940
|
return /* @__PURE__ */ React47.createElement(
|
|
5838
|
-
|
|
5941
|
+
Button21,
|
|
5839
5942
|
{
|
|
5840
5943
|
onClick: descargaExcel,
|
|
5841
5944
|
startIcon: /* @__PURE__ */ React47.createElement(FileDownloadOutlinedIcon2, null),
|
|
@@ -6725,7 +6828,6 @@ var components = {
|
|
|
6725
6828
|
color: theme.palette.primary.main
|
|
6726
6829
|
}),
|
|
6727
6830
|
colorDefault: ({ theme }) => ({
|
|
6728
|
-
backgroundColor: theme.palette.default.main,
|
|
6729
6831
|
color: theme.palette.default.contrastText
|
|
6730
6832
|
}),
|
|
6731
6833
|
deleteIcon: ({ theme }) => ({
|
|
@@ -6835,47 +6937,6 @@ var components = {
|
|
|
6835
6937
|
height: "inherit",
|
|
6836
6938
|
borderRadius: 4,
|
|
6837
6939
|
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
6940
|
{
|
|
6880
6941
|
props: { variant: "standard", avatar: true },
|
|
6881
6942
|
style: {
|
|
@@ -6946,7 +7007,40 @@ var components = {
|
|
|
6946
7007
|
}
|
|
6947
7008
|
]
|
|
6948
7009
|
})
|
|
6949
|
-
}
|
|
7010
|
+
},
|
|
7011
|
+
variants: [
|
|
7012
|
+
{
|
|
7013
|
+
props: { variant: "outlined", color: "default" },
|
|
7014
|
+
style: ({ theme }) => ({
|
|
7015
|
+
border: `1px solid ${theme.palette.grey[400]}`,
|
|
7016
|
+
backgroundColor: "transparent",
|
|
7017
|
+
color: theme.palette.default.contrastText,
|
|
7018
|
+
":hover": {
|
|
7019
|
+
backgroundColor: theme.palette.default.main
|
|
7020
|
+
}
|
|
7021
|
+
})
|
|
7022
|
+
},
|
|
7023
|
+
{
|
|
7024
|
+
props: { variant: "standard", color: "default" },
|
|
7025
|
+
style: ({ theme }) => ({
|
|
7026
|
+
backgroundColor: theme.palette.default.main,
|
|
7027
|
+
color: theme.palette.default.contrastText,
|
|
7028
|
+
":hover": {
|
|
7029
|
+
backgroundColor: theme.palette.default.dark
|
|
7030
|
+
}
|
|
7031
|
+
})
|
|
7032
|
+
},
|
|
7033
|
+
{
|
|
7034
|
+
props: { variant: "filled", color: "default" },
|
|
7035
|
+
style: ({ theme }) => ({
|
|
7036
|
+
backgroundColor: theme.palette.grey[50],
|
|
7037
|
+
color: theme.palette.default.contrastText,
|
|
7038
|
+
":hover": {
|
|
7039
|
+
backgroundColor: theme.palette.grey[100]
|
|
7040
|
+
}
|
|
7041
|
+
})
|
|
7042
|
+
}
|
|
7043
|
+
]
|
|
6950
7044
|
},
|
|
6951
7045
|
MuiAvatar: {
|
|
6952
7046
|
styleOverrides: {
|