componentes-sinco 1.3.3 → 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 +222 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +188 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -445,6 +445,7 @@ interface SCTextFieldProps {
|
|
|
445
445
|
};
|
|
446
446
|
size?: "small" | "medium";
|
|
447
447
|
variant?: "outlined" | "filled" | "standard";
|
|
448
|
+
alignText?: "left" | "right" | "center";
|
|
448
449
|
maxLength?: number;
|
|
449
450
|
disabled?: boolean;
|
|
450
451
|
required?: boolean;
|
|
@@ -455,7 +456,7 @@ interface SCTextFieldProps {
|
|
|
455
456
|
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
declare const SCTextField: ({ title, iconTitle, infoTitle, label, placeholder, infoElement, iconInputStart, iconInputEnd, maxLength, variant, format, disabled, required, size, width, color, background, setState, state, onChange, onBlur, onKeyDown, }: SCTextFieldProps) => React__default.JSX.Element;
|
|
459
|
+
declare const SCTextField: ({ title, iconTitle, infoTitle, label, placeholder, infoElement, iconInputStart, iconInputEnd, maxLength, variant, format, disabled, required, size, width, alignText, color, background, setState, state, onChange, onBlur, onKeyDown, }: SCTextFieldProps) => React__default.JSX.Element;
|
|
459
460
|
|
|
460
461
|
interface SCAccordionProps {
|
|
461
462
|
title?: string | React__default.ReactNode;
|
|
@@ -585,8 +586,20 @@ interface SCDataGridInitialProps<T> {
|
|
|
585
586
|
selectedIndex?: number;
|
|
586
587
|
setSelectedRow?: (any: any) => void;
|
|
587
588
|
selectedRow?: any;
|
|
588
|
-
|
|
589
|
-
|
|
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;
|
|
590
603
|
declare const SCDataGrid: React__default.MemoExoticComponent<typeof SCDataGridInitial>;
|
|
591
604
|
|
|
592
605
|
interface SCDatePickerProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -445,6 +445,7 @@ interface SCTextFieldProps {
|
|
|
445
445
|
};
|
|
446
446
|
size?: "small" | "medium";
|
|
447
447
|
variant?: "outlined" | "filled" | "standard";
|
|
448
|
+
alignText?: "left" | "right" | "center";
|
|
448
449
|
maxLength?: number;
|
|
449
450
|
disabled?: boolean;
|
|
450
451
|
required?: boolean;
|
|
@@ -455,7 +456,7 @@ interface SCTextFieldProps {
|
|
|
455
456
|
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
declare const SCTextField: ({ title, iconTitle, infoTitle, label, placeholder, infoElement, iconInputStart, iconInputEnd, maxLength, variant, format, disabled, required, size, width, color, background, setState, state, onChange, onBlur, onKeyDown, }: SCTextFieldProps) => React__default.JSX.Element;
|
|
459
|
+
declare const SCTextField: ({ title, iconTitle, infoTitle, label, placeholder, infoElement, iconInputStart, iconInputEnd, maxLength, variant, format, disabled, required, size, width, alignText, color, background, setState, state, onChange, onBlur, onKeyDown, }: SCTextFieldProps) => React__default.JSX.Element;
|
|
459
460
|
|
|
460
461
|
interface SCAccordionProps {
|
|
461
462
|
title?: string | React__default.ReactNode;
|
|
@@ -585,8 +586,20 @@ interface SCDataGridInitialProps<T> {
|
|
|
585
586
|
selectedIndex?: number;
|
|
586
587
|
setSelectedRow?: (any: any) => void;
|
|
587
588
|
selectedRow?: any;
|
|
588
|
-
|
|
589
|
-
|
|
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;
|
|
590
603
|
declare const SCDataGrid: React__default.MemoExoticComponent<typeof SCDataGridInitial>;
|
|
591
604
|
|
|
592
605
|
interface SCDatePickerProps {
|
package/dist/index.js
CHANGED
|
@@ -1360,6 +1360,7 @@ var SCTextField = ({
|
|
|
1360
1360
|
required,
|
|
1361
1361
|
size,
|
|
1362
1362
|
width = "100%",
|
|
1363
|
+
alignText = "left",
|
|
1363
1364
|
color,
|
|
1364
1365
|
background,
|
|
1365
1366
|
//Funcionales
|
|
@@ -1517,7 +1518,14 @@ var SCTextField = ({
|
|
|
1517
1518
|
onKeyDown: handleKeyDown,
|
|
1518
1519
|
onChange: handleInputChange,
|
|
1519
1520
|
onBlur: handleBlur,
|
|
1520
|
-
|
|
1521
|
+
sx: iconInputStart || iconInputEnd ? {
|
|
1522
|
+
height: "32px",
|
|
1523
|
+
"& .MuiInputAdornment-root": {
|
|
1524
|
+
height: "32px",
|
|
1525
|
+
maxHeight: "32px"
|
|
1526
|
+
}
|
|
1527
|
+
} : void 0,
|
|
1528
|
+
inputProps: { maxLength: maxLength ? maxLength : 50, style: { textAlign: alignText } },
|
|
1521
1529
|
type: !showPassword && format3 === "password" ? "password" : (format3 || "text").toUpperCase() === "INT" || (format3 || "text").toUpperCase() === "DECIMAL" ? "number" : "text",
|
|
1522
1530
|
className: format3 === "password" && !showPassword ? "" : "",
|
|
1523
1531
|
placeholder,
|
|
@@ -1767,6 +1775,7 @@ function SCSelect({
|
|
|
1767
1775
|
const [prevData, setPrevData] = React12.useState(data);
|
|
1768
1776
|
const [error, setError] = React12.useState(false);
|
|
1769
1777
|
const [placement, setPlacement] = React12.useState("bottom");
|
|
1778
|
+
const [menuWidth, setMenuWidth] = React12.useState();
|
|
1770
1779
|
const containerRef = React12.useRef(null);
|
|
1771
1780
|
useEffect9(() => {
|
|
1772
1781
|
if (error) {
|
|
@@ -1802,6 +1811,7 @@ function SCSelect({
|
|
|
1802
1811
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1803
1812
|
const estimatedMenuHeight = Math.min(300, data.length * 36 + 16);
|
|
1804
1813
|
setPlacement(spaceBelow < estimatedMenuHeight ? "top" : "bottom");
|
|
1814
|
+
setMenuWidth(rect.width);
|
|
1805
1815
|
}
|
|
1806
1816
|
};
|
|
1807
1817
|
const handleChange = (event2) => {
|
|
@@ -1844,6 +1854,20 @@ function SCSelect({
|
|
|
1844
1854
|
disabled: disabled || false,
|
|
1845
1855
|
error,
|
|
1846
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
|
+
},
|
|
1847
1871
|
MenuProps: {
|
|
1848
1872
|
sx: {
|
|
1849
1873
|
zIndex: 1400
|
|
@@ -1851,7 +1875,8 @@ function SCSelect({
|
|
|
1851
1875
|
PaperProps: {
|
|
1852
1876
|
sx: {
|
|
1853
1877
|
maxHeight: "300px",
|
|
1854
|
-
|
|
1878
|
+
width: menuWidth ? `${menuWidth}px` : "100%",
|
|
1879
|
+
maxWidth: menuWidth ? `${menuWidth}px` : "100%"
|
|
1855
1880
|
}
|
|
1856
1881
|
},
|
|
1857
1882
|
anchorOrigin: {
|
|
@@ -1867,7 +1892,15 @@ function SCSelect({
|
|
|
1867
1892
|
}
|
|
1868
1893
|
},
|
|
1869
1894
|
data.map((option, index) => {
|
|
1870
|
-
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
|
+
));
|
|
1871
1904
|
})
|
|
1872
1905
|
)
|
|
1873
1906
|
)));
|
|
@@ -5130,22 +5163,25 @@ var SCCard = ({ width, title, image, iconTitle, actionsTitle, subtitle, dividerH
|
|
|
5130
5163
|
import React44, { useEffect as useEffect19, useState as useState25 } from "react";
|
|
5131
5164
|
import { DataGridPro, useGridApiRef } from "@mui/x-data-grid-pro";
|
|
5132
5165
|
import { LicenseInfo as LicenseInfo2 } from "@mui/x-license";
|
|
5166
|
+
import { Button as Button19, TextField as TextField7 } from "@mui/material";
|
|
5133
5167
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
5134
5168
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
5135
5169
|
import { useTheme } from "@mui/material/styles";
|
|
5136
|
-
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;
|
|
5137
5172
|
LicenseInfo2.setLicenseKey(
|
|
5138
5173
|
"aa892a011e4c240f3cdaf811ecfff54fTz0xMjkyODQsRT0xODEwNDI1NTk5MDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LEtWPTI="
|
|
5139
5174
|
);
|
|
5140
5175
|
const theme = useTheme();
|
|
5141
5176
|
const apiRef = useGridApiRef();
|
|
5142
5177
|
const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
|
|
5178
|
+
const showInsertRow = insertRowFields != void 0 && insertRowFields.length > 0;
|
|
5143
5179
|
function generateRandomId() {
|
|
5144
5180
|
return Math.floor(Math.random() * 1e6);
|
|
5145
5181
|
}
|
|
5146
5182
|
const getTreeDataPaths = (row) => {
|
|
5147
|
-
var
|
|
5148
|
-
const group1Value = groupColumns && ((
|
|
5183
|
+
var _a2, _b, _c;
|
|
5184
|
+
const group1Value = groupColumns && ((_a2 = groupColumns(row)) == null ? void 0 : _a2.valueGroup1);
|
|
5149
5185
|
const group2Value = groupColumns && ((_b = groupColumns(row)) == null ? void 0 : _b.valueGroup2);
|
|
5150
5186
|
const fieldValue = groupColumns && ((_c = groupColumns(row)) == null ? void 0 : _c.fieldFirstColumn);
|
|
5151
5187
|
return [
|
|
@@ -5159,7 +5195,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5159
5195
|
headerName: groupColumns ? groupColumns(data[0]).headerNameFirstColumn : "Agrupador",
|
|
5160
5196
|
flex: 1,
|
|
5161
5197
|
renderCell: (params) => {
|
|
5162
|
-
var
|
|
5198
|
+
var _a2, _b;
|
|
5163
5199
|
let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
|
|
5164
5200
|
let maxDepth = 0;
|
|
5165
5201
|
if (groupColumns && data.length > 0) {
|
|
@@ -5174,8 +5210,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5174
5210
|
if (groupColumns) {
|
|
5175
5211
|
const originalItem = data.find(
|
|
5176
5212
|
(item) => {
|
|
5177
|
-
var
|
|
5178
|
-
return String((
|
|
5213
|
+
var _a3;
|
|
5214
|
+
return String((_a3 = groupColumns(item)) == null ? void 0 : _a3.valueGroup1) === label;
|
|
5179
5215
|
}
|
|
5180
5216
|
);
|
|
5181
5217
|
if (originalItem) {
|
|
@@ -5184,22 +5220,22 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5184
5220
|
}
|
|
5185
5221
|
}
|
|
5186
5222
|
let subgroup1 = arrayRows.filter((r) => {
|
|
5187
|
-
var
|
|
5188
|
-
return groupColumns && String((
|
|
5223
|
+
var _a3;
|
|
5224
|
+
return groupColumns && String((_a3 = groupColumns(r)) == null ? void 0 : _a3.valueGroup1) === label;
|
|
5189
5225
|
}).map((r) => {
|
|
5190
|
-
var
|
|
5191
|
-
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));
|
|
5192
5228
|
});
|
|
5193
5229
|
const groupedDataLength1 = subgroup1.filter((valor, indiceActual, arreglo) => arreglo.indexOf(valor) === indiceActual);
|
|
5194
5230
|
label = `${customLabel} (${groupedDataLength1.length})`;
|
|
5195
|
-
} else if (((
|
|
5231
|
+
} else if (((_a2 = groupColumns(data[0])) == null ? void 0 : _a2.valueGroup2) && params.rowNode.depth === 1) {
|
|
5196
5232
|
const labelGrouping1 = (_b = params.api.getRowNode(params.rowNode.parent)) == null ? void 0 : _b.groupingKey.toString();
|
|
5197
5233
|
let customLabel = label;
|
|
5198
5234
|
if (groupColumns) {
|
|
5199
5235
|
const originalItem = data.find(
|
|
5200
5236
|
(item) => {
|
|
5201
|
-
var
|
|
5202
|
-
return String((
|
|
5237
|
+
var _a3;
|
|
5238
|
+
return String((_a3 = groupColumns(item)) == null ? void 0 : _a3.valueGroup2) === label;
|
|
5203
5239
|
}
|
|
5204
5240
|
);
|
|
5205
5241
|
if (originalItem) {
|
|
@@ -5209,8 +5245,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5209
5245
|
}
|
|
5210
5246
|
const groupedDataLength2 = arrayRows.filter(
|
|
5211
5247
|
(r) => {
|
|
5212
|
-
var
|
|
5213
|
-
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;
|
|
5214
5250
|
}
|
|
5215
5251
|
).length;
|
|
5216
5252
|
label = `${customLabel} (${groupedDataLength2})`;
|
|
@@ -5255,25 +5291,25 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5255
5291
|
);
|
|
5256
5292
|
},
|
|
5257
5293
|
colSpan: (params) => {
|
|
5258
|
-
var
|
|
5294
|
+
var _a2, _b;
|
|
5259
5295
|
const value = String(params);
|
|
5260
|
-
const fieldGrouping1 = groupColumns ? (
|
|
5296
|
+
const fieldGrouping1 = groupColumns ? (_a2 = groupColumns(data[0])) == null ? void 0 : _a2.valueGroup1 : void 0;
|
|
5261
5297
|
const fieldGrouping2 = groupColumns ? (_b = groupColumns(data[0])) == null ? void 0 : _b.valueGroup2 : void 0;
|
|
5262
5298
|
let agrupado1 = false;
|
|
5263
5299
|
let agrupado2 = false;
|
|
5264
5300
|
if (fieldGrouping1 != void 0) {
|
|
5265
5301
|
agrupado1 = arrayRows.some(
|
|
5266
5302
|
(row) => {
|
|
5267
|
-
var
|
|
5268
|
-
return groupColumns && String((
|
|
5303
|
+
var _a3;
|
|
5304
|
+
return groupColumns && String((_a3 = groupColumns(row)) == null ? void 0 : _a3.valueGroup1) === value;
|
|
5269
5305
|
}
|
|
5270
5306
|
);
|
|
5271
5307
|
}
|
|
5272
5308
|
if (fieldGrouping2 != void 0) {
|
|
5273
5309
|
agrupado2 = arrayRows.some(
|
|
5274
5310
|
(row) => {
|
|
5275
|
-
var
|
|
5276
|
-
return groupColumns && String((
|
|
5311
|
+
var _a3;
|
|
5312
|
+
return groupColumns && String((_a3 = groupColumns(row)) == null ? void 0 : _a3.valueGroup2) === value;
|
|
5277
5313
|
}
|
|
5278
5314
|
);
|
|
5279
5315
|
}
|
|
@@ -5295,11 +5331,31 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5295
5331
|
const [pageSize, setPageSize] = useState25(rows);
|
|
5296
5332
|
const [arrayRows, setArrayRows] = useState25([]);
|
|
5297
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
|
+
};
|
|
5298
5354
|
useEffect19(() => {
|
|
5299
|
-
var
|
|
5355
|
+
var _a2;
|
|
5300
5356
|
if (setSelectedRow) {
|
|
5301
5357
|
setSelectedRow(arrayRows[selectedIndex]);
|
|
5302
|
-
setSelectionModel(((
|
|
5358
|
+
setSelectionModel(((_a2 = arrayRows[selectedIndex]) == null ? void 0 : _a2.id) ? [arrayRows[selectedIndex].id] : []);
|
|
5303
5359
|
}
|
|
5304
5360
|
}, [selectedIndex]);
|
|
5305
5361
|
useEffect19(() => {
|
|
@@ -5308,7 +5364,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5308
5364
|
}
|
|
5309
5365
|
}, [data]);
|
|
5310
5366
|
const dataConvertRows = (data2, columnId) => {
|
|
5311
|
-
var
|
|
5367
|
+
var _a2;
|
|
5312
5368
|
let dataConvert = [];
|
|
5313
5369
|
if ((data2 == null ? void 0 : data2.length) > 0) {
|
|
5314
5370
|
const dataKeys = Object.keys(data2[0]);
|
|
@@ -5326,7 +5382,7 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5326
5382
|
setArrayRows(dataConvert);
|
|
5327
5383
|
if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
|
|
5328
5384
|
setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
|
|
5329
|
-
setSelectionModel([(
|
|
5385
|
+
setSelectionModel([(_a2 = dataConvert[0]) == null ? void 0 : _a2.id]);
|
|
5330
5386
|
}
|
|
5331
5387
|
};
|
|
5332
5388
|
const handleSelectionChange = (newSelection) => {
|
|
@@ -5368,15 +5424,56 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5368
5424
|
}
|
|
5369
5425
|
}
|
|
5370
5426
|
};
|
|
5371
|
-
const processedColumns = columns.map((col) => {
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
}
|
|
5378
|
-
|
|
5379
|
-
|
|
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
|
+
}
|
|
5380
5477
|
});
|
|
5381
5478
|
});
|
|
5382
5479
|
const columnVisibilityModel = {};
|
|
@@ -5399,7 +5496,8 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5399
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(
|
|
5400
5497
|
DataGridPro,
|
|
5401
5498
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
5402
|
-
getRowId,
|
|
5499
|
+
getRowId: showInsertRow ? resolvedGetRowId : getRowId,
|
|
5500
|
+
pinnedRows,
|
|
5403
5501
|
apiRef,
|
|
5404
5502
|
rowHeight: styleRowHeight,
|
|
5405
5503
|
rows: arrayRows,
|
|
@@ -5436,6 +5534,12 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5436
5534
|
},
|
|
5437
5535
|
sx: {
|
|
5438
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
|
+
},
|
|
5439
5543
|
"& .MuiDataGrid-columnHeaders": {
|
|
5440
5544
|
display: disableHeader == true ? "none" : "block"
|
|
5441
5545
|
},
|
|
@@ -5632,7 +5736,7 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
|
|
|
5632
5736
|
|
|
5633
5737
|
// src/Components/SCDialog.tsx
|
|
5634
5738
|
import React46, { useEffect as useEffect20, useState as useState27 } from "react";
|
|
5635
|
-
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";
|
|
5636
5740
|
import Grid11 from "@mui/material/Grid";
|
|
5637
5741
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
5638
5742
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
@@ -5697,7 +5801,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5697
5801
|
};
|
|
5698
5802
|
const dialogActions = actions == false ? false : actions != void 0 ? actions : [{ text: "Cerrar", fn: handleClose }];
|
|
5699
5803
|
content = content != null ? content : { component: /* @__PURE__ */ React46.createElement(Box27, null, " Aqui va el contenido ") };
|
|
5700
|
-
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(
|
|
5701
5805
|
Dialog4,
|
|
5702
5806
|
{
|
|
5703
5807
|
fullScreen: typeView === "mobile" ? true : false,
|
|
@@ -5753,7 +5857,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5753
5857
|
) : content.component
|
|
5754
5858
|
),
|
|
5755
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(
|
|
5756
|
-
|
|
5860
|
+
Button20,
|
|
5757
5861
|
{
|
|
5758
5862
|
variant: "text",
|
|
5759
5863
|
color: dialogActions[0].color || "primary",
|
|
@@ -5765,7 +5869,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5765
5869
|
dialogActions[0].text
|
|
5766
5870
|
), /* @__PURE__ */ React46.createElement(Box27, { sx: { display: "flex", gap: 1 } }, dialogActions.slice(1).map((boton, index) => {
|
|
5767
5871
|
return /* @__PURE__ */ React46.createElement(
|
|
5768
|
-
|
|
5872
|
+
Button20,
|
|
5769
5873
|
{
|
|
5770
5874
|
key: index + 1,
|
|
5771
5875
|
variant: index === dialogActions.length - 2 ? "contained" : "text",
|
|
@@ -5779,7 +5883,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5779
5883
|
);
|
|
5780
5884
|
}))) : dialogActions.map((boton, index) => {
|
|
5781
5885
|
return /* @__PURE__ */ React46.createElement(
|
|
5782
|
-
|
|
5886
|
+
Button20,
|
|
5783
5887
|
{
|
|
5784
5888
|
key: index,
|
|
5785
5889
|
variant: index === dialogActions.length - 1 ? "contained" : "text",
|
|
@@ -5800,7 +5904,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5800
5904
|
|
|
5801
5905
|
// src/Components/SCDownloadExcelTable.tsx
|
|
5802
5906
|
import React47 from "react";
|
|
5803
|
-
import { Button as
|
|
5907
|
+
import { Button as Button21 } from "@mui/material";
|
|
5804
5908
|
import FileDownloadOutlinedIcon2 from "@mui/icons-material/FileDownloadOutlined";
|
|
5805
5909
|
import * as XLSX from "xlsx";
|
|
5806
5910
|
var SCDownloadExcelTable = ({
|
|
@@ -5834,7 +5938,7 @@ var SCDownloadExcelTable = ({
|
|
|
5834
5938
|
XLSX.writeFile(workbook, `${fileName}.xlsx`);
|
|
5835
5939
|
};
|
|
5836
5940
|
return /* @__PURE__ */ React47.createElement(
|
|
5837
|
-
|
|
5941
|
+
Button21,
|
|
5838
5942
|
{
|
|
5839
5943
|
onClick: descargaExcel,
|
|
5840
5944
|
startIcon: /* @__PURE__ */ React47.createElement(FileDownloadOutlinedIcon2, null),
|
|
@@ -6104,6 +6208,10 @@ var SCTime = ({
|
|
|
6104
6208
|
setIsOpenPopover(false);
|
|
6105
6209
|
setAnchorEl(null);
|
|
6106
6210
|
};
|
|
6211
|
+
const handleTimeFieldChange = (newValue) => {
|
|
6212
|
+
const dayjsValue = newValue ? dayjs11(newValue) : null;
|
|
6213
|
+
setState(dayjsValue);
|
|
6214
|
+
};
|
|
6107
6215
|
const handleClose = () => {
|
|
6108
6216
|
setIsOpenPopover(false);
|
|
6109
6217
|
setAnchorEl(null);
|
|
@@ -6117,6 +6225,7 @@ var SCTime = ({
|
|
|
6117
6225
|
required,
|
|
6118
6226
|
error: hasError,
|
|
6119
6227
|
onClick: handleTimeFieldClick,
|
|
6228
|
+
onChange: handleTimeFieldChange,
|
|
6120
6229
|
slotProps: {
|
|
6121
6230
|
textField: {
|
|
6122
6231
|
InputProps: {
|
|
@@ -6719,7 +6828,6 @@ var components = {
|
|
|
6719
6828
|
color: theme.palette.primary.main
|
|
6720
6829
|
}),
|
|
6721
6830
|
colorDefault: ({ theme }) => ({
|
|
6722
|
-
backgroundColor: theme.palette.default.main,
|
|
6723
6831
|
color: theme.palette.default.contrastText
|
|
6724
6832
|
}),
|
|
6725
6833
|
deleteIcon: ({ theme }) => ({
|
|
@@ -6829,47 +6937,6 @@ var components = {
|
|
|
6829
6937
|
height: "inherit",
|
|
6830
6938
|
borderRadius: 4,
|
|
6831
6939
|
variants: [
|
|
6832
|
-
{
|
|
6833
|
-
props: { variant: "outlined", color: "default" },
|
|
6834
|
-
style: {
|
|
6835
|
-
border: `1px solid ${theme.palette.grey[400]}`,
|
|
6836
|
-
backgroundColor: "transparent ",
|
|
6837
|
-
color: theme.palette.default.contrastText,
|
|
6838
|
-
":hover": {
|
|
6839
|
-
backgroundColor: theme.palette.default.main
|
|
6840
|
-
}
|
|
6841
|
-
}
|
|
6842
|
-
},
|
|
6843
|
-
{
|
|
6844
|
-
props: { variant: "standard", color: "default" },
|
|
6845
|
-
style: {
|
|
6846
|
-
backgroundColor: theme.palette.default.main,
|
|
6847
|
-
color: theme.palette.default.contrastText,
|
|
6848
|
-
":hover": {
|
|
6849
|
-
backgroundColor: theme.palette.default.dark
|
|
6850
|
-
}
|
|
6851
|
-
}
|
|
6852
|
-
},
|
|
6853
|
-
{
|
|
6854
|
-
props: { variant: "filled", color: "default" },
|
|
6855
|
-
style: {
|
|
6856
|
-
backgroundColor: theme.palette.grey[50],
|
|
6857
|
-
color: theme.palette.default.contrastText,
|
|
6858
|
-
":hover": {
|
|
6859
|
-
backgroundColor: theme.palette.grey[100]
|
|
6860
|
-
}
|
|
6861
|
-
}
|
|
6862
|
-
},
|
|
6863
|
-
{
|
|
6864
|
-
props: { variant: "filled", color: "default" },
|
|
6865
|
-
style: {
|
|
6866
|
-
backgroundColor: theme.palette.grey[50],
|
|
6867
|
-
color: theme.palette.default.contrastText,
|
|
6868
|
-
":hover": {
|
|
6869
|
-
backgroundColor: theme.palette.grey[100]
|
|
6870
|
-
}
|
|
6871
|
-
}
|
|
6872
|
-
},
|
|
6873
6940
|
{
|
|
6874
6941
|
props: { variant: "standard", avatar: true },
|
|
6875
6942
|
style: {
|
|
@@ -6940,7 +7007,40 @@ var components = {
|
|
|
6940
7007
|
}
|
|
6941
7008
|
]
|
|
6942
7009
|
})
|
|
6943
|
-
}
|
|
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
|
+
]
|
|
6944
7044
|
},
|
|
6945
7045
|
MuiAvatar: {
|
|
6946
7046
|
styleOverrides: {
|