componentes-sinco 1.1.31 → 1.1.33
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 +98 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +146 -101
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -514,8 +514,9 @@ interface SCAutocompleteProps<T> {
|
|
|
514
514
|
};
|
|
515
515
|
inputChange?: (value: string) => void;
|
|
516
516
|
maxCheck?: number;
|
|
517
|
+
width?: string;
|
|
517
518
|
}
|
|
518
|
-
declare function SCAutocomplete<T>({ label, data, columnGroup, getItemValue, typeFormat, checkMassive, deleteType, fnAplicar, required, disabled, background, setState, state, inputChange, maxCheck, }: SCAutocompleteProps<T>): React__default.JSX.Element;
|
|
519
|
+
declare function SCAutocomplete<T>({ label, data, columnGroup, getItemValue, typeFormat, checkMassive, deleteType, fnAplicar, required, disabled, background, setState, state, inputChange, maxCheck, width, }: SCAutocompleteProps<T>): React__default.JSX.Element;
|
|
519
520
|
|
|
520
521
|
interface SCCalendarSwipeableProps {
|
|
521
522
|
background?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -514,8 +514,9 @@ interface SCAutocompleteProps<T> {
|
|
|
514
514
|
};
|
|
515
515
|
inputChange?: (value: string) => void;
|
|
516
516
|
maxCheck?: number;
|
|
517
|
+
width?: string;
|
|
517
518
|
}
|
|
518
|
-
declare function SCAutocomplete<T>({ label, data, columnGroup, getItemValue, typeFormat, checkMassive, deleteType, fnAplicar, required, disabled, background, setState, state, inputChange, maxCheck, }: SCAutocompleteProps<T>): React__default.JSX.Element;
|
|
519
|
+
declare function SCAutocomplete<T>({ label, data, columnGroup, getItemValue, typeFormat, checkMassive, deleteType, fnAplicar, required, disabled, background, setState, state, inputChange, maxCheck, width, }: SCAutocompleteProps<T>): React__default.JSX.Element;
|
|
519
520
|
|
|
520
521
|
interface SCCalendarSwipeableProps {
|
|
521
522
|
background?: string;
|
package/dist/index.js
CHANGED
|
@@ -1205,7 +1205,7 @@ var AttachmentMobile = ({
|
|
|
1205
1205
|
};
|
|
1206
1206
|
|
|
1207
1207
|
// src/Components/Calendario/Calendar.tsx
|
|
1208
|
-
import React31, { useEffect as
|
|
1208
|
+
import React31, { useEffect as useEffect11, useState as useState14 } from "react";
|
|
1209
1209
|
import { Box as Box19, CircularProgress as CircularProgress5 } from "@mui/material";
|
|
1210
1210
|
|
|
1211
1211
|
// src/Components/Calendario/CalendarToolbar.tsx
|
|
@@ -1449,58 +1449,75 @@ var validateInputs = (arrayElements, onError, onSuccess, setChipFilters, setText
|
|
|
1449
1449
|
|
|
1450
1450
|
// src/Components/Drawer/Helpers/validateTypeElement.tsx
|
|
1451
1451
|
import React9 from "react";
|
|
1452
|
+
var COMPONENT_NAME_MAP = {
|
|
1453
|
+
SCtextField: "textField",
|
|
1454
|
+
SCtextArea: "textArea",
|
|
1455
|
+
SCDateRange: "dateRange",
|
|
1456
|
+
SCDatePicker: "datePicker",
|
|
1457
|
+
SCTime: "time",
|
|
1458
|
+
SCAutocomplete: "autocomplete",
|
|
1459
|
+
SCSelect: "select"
|
|
1460
|
+
};
|
|
1461
|
+
var getComponentName = (node) => {
|
|
1462
|
+
const type = node.type;
|
|
1463
|
+
return typeof type === "function" ? type.displayName || type.name || "" : "";
|
|
1464
|
+
};
|
|
1465
|
+
var isKnownComponent = (node) => {
|
|
1466
|
+
var _a;
|
|
1467
|
+
const name = getComponentName(node);
|
|
1468
|
+
if (COMPONENT_NAME_MAP[name]) return true;
|
|
1469
|
+
if (((_a = node.props) == null ? void 0 : _a.typeFormat) === "multiselect") return true;
|
|
1470
|
+
return false;
|
|
1471
|
+
};
|
|
1472
|
+
var findInTree = (node) => {
|
|
1473
|
+
var _a;
|
|
1474
|
+
if (!React9.isValidElement(node)) return null;
|
|
1475
|
+
if (isKnownComponent(node)) return node;
|
|
1476
|
+
const children = (_a = node.props) == null ? void 0 : _a.children;
|
|
1477
|
+
if (!children) return null;
|
|
1478
|
+
for (const child of React9.Children.toArray(children)) {
|
|
1479
|
+
if (React9.isValidElement(child)) {
|
|
1480
|
+
const found = findInTree(child);
|
|
1481
|
+
if (found) return found;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
return null;
|
|
1485
|
+
};
|
|
1486
|
+
var resolveValidation = (node) => {
|
|
1487
|
+
var _a;
|
|
1488
|
+
const name = getComponentName(node);
|
|
1489
|
+
if (((_a = node.props) == null ? void 0 : _a.typeFormat) === "multiselect") return "multiselect";
|
|
1490
|
+
return COMPONENT_NAME_MAP[name] || "";
|
|
1491
|
+
};
|
|
1452
1492
|
var validateTypeElements = (element) => {
|
|
1453
1493
|
var _a;
|
|
1454
1494
|
let validation = "";
|
|
1455
1495
|
let typeElement = element;
|
|
1456
|
-
if (element.type
|
|
1457
|
-
validation =
|
|
1458
|
-
typeElement = element;
|
|
1459
|
-
} else if (React9.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCtextField") {
|
|
1460
|
-
validation = "textField";
|
|
1461
|
-
typeElement = element == null ? void 0 : element.component.props;
|
|
1462
|
-
} else if (element.type == "textArea") {
|
|
1463
|
-
validation = "textArea";
|
|
1464
|
-
typeElement = element;
|
|
1465
|
-
} else if (React9.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCtextArea") {
|
|
1466
|
-
validation = "textArea";
|
|
1467
|
-
typeElement = element == null ? void 0 : element.component.props;
|
|
1468
|
-
} else if (element.type == "dateRange") {
|
|
1469
|
-
validation = "dateRange";
|
|
1470
|
-
typeElement = element;
|
|
1471
|
-
} else if (React9.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name == "SCDateRange") {
|
|
1472
|
-
validation = "dateRange";
|
|
1473
|
-
typeElement = element == null ? void 0 : element.component.props;
|
|
1474
|
-
} else if (element.type == "autocomplete") {
|
|
1475
|
-
validation = "autocomplete";
|
|
1496
|
+
if (element.type && COMPONENT_NAME_MAP[(_a = Object.keys(COMPONENT_NAME_MAP).find((k) => COMPONENT_NAME_MAP[k] === element.type)) != null ? _a : ""]) {
|
|
1497
|
+
validation = element.type;
|
|
1476
1498
|
typeElement = element;
|
|
1477
|
-
} else if (
|
|
1478
|
-
validation = "autocomplete";
|
|
1479
|
-
typeElement = element == null ? void 0 : element.component.props;
|
|
1480
|
-
} else if (element.typeFormat == "multiselect") {
|
|
1499
|
+
} else if (element.typeFormat === "multiselect") {
|
|
1481
1500
|
validation = "multiselect";
|
|
1482
1501
|
typeElement = element;
|
|
1483
|
-
} else if (React9.isValidElement(element == null ? void 0 : element.component) &&
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1502
|
+
} else if (React9.isValidElement(element == null ? void 0 : element.component) && isKnownComponent(element.component)) {
|
|
1503
|
+
const node = element.component;
|
|
1504
|
+
validation = resolveValidation(node);
|
|
1505
|
+
typeElement = node.props;
|
|
1506
|
+
} else if (React9.isValidElement(element == null ? void 0 : element.component)) {
|
|
1507
|
+
const found = findInTree(element.component);
|
|
1508
|
+
if (found) {
|
|
1509
|
+
validation = resolveValidation(found);
|
|
1510
|
+
typeElement = found.props;
|
|
1511
|
+
}
|
|
1492
1512
|
}
|
|
1493
|
-
return {
|
|
1494
|
-
validation,
|
|
1495
|
-
element: typeElement
|
|
1496
|
-
};
|
|
1513
|
+
return { validation, element: typeElement };
|
|
1497
1514
|
};
|
|
1498
1515
|
|
|
1499
1516
|
// src/Components/Drawer/hooks/useDrawerState.ts
|
|
1500
|
-
import { useState as useState7, useEffect as
|
|
1517
|
+
import { useState as useState7, useEffect as useEffect5 } from "react";
|
|
1501
1518
|
var useDrawerState = ({ open, setOpen }) => {
|
|
1502
1519
|
const [drawerOpen, setDrawerOpen] = useState7(open || false);
|
|
1503
|
-
|
|
1520
|
+
useEffect5(() => {
|
|
1504
1521
|
if (open !== void 0) {
|
|
1505
1522
|
setDrawerOpen(open);
|
|
1506
1523
|
}
|
|
@@ -1529,11 +1546,11 @@ var useDrawerState = ({ open, setOpen }) => {
|
|
|
1529
1546
|
};
|
|
1530
1547
|
|
|
1531
1548
|
// src/Components/Drawer/hooks/useChipFilters.ts
|
|
1532
|
-
import { useState as useState8, useEffect as
|
|
1549
|
+
import { useState as useState8, useEffect as useEffect6 } from "react";
|
|
1533
1550
|
var useChipFilters = (arrayElements, chipFilters) => {
|
|
1534
1551
|
const [stateChipFilters, setChipFilters] = useState8(false);
|
|
1535
1552
|
const [textFilters, setTextFilters] = useState8([]);
|
|
1536
|
-
|
|
1553
|
+
useEffect6(() => {
|
|
1537
1554
|
if (chipFilters == null ? void 0 : chipFilters.length) {
|
|
1538
1555
|
setTextFilters([]);
|
|
1539
1556
|
processChipFilters();
|
|
@@ -1558,11 +1575,11 @@ var useChipFilters = (arrayElements, chipFilters) => {
|
|
|
1558
1575
|
const processManualFilters = () => {
|
|
1559
1576
|
const newFiltersToAdd = [];
|
|
1560
1577
|
arrayElements.forEach((element) => {
|
|
1561
|
-
var _a, _b, _c, _d;
|
|
1578
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1562
1579
|
const { validation, element: typeElement } = validateTypeElements(element);
|
|
1563
1580
|
const textValue = ((_a = typeElement.state) == null ? void 0 : _a.textValue) !== void 0 ? String((_b = typeElement.state) == null ? void 0 : _b.textValue) : String(typeElement.state);
|
|
1564
1581
|
if (textValue.trim() !== "" && textValue.trim() !== "," && textValue.trim() !== "undefined") {
|
|
1565
|
-
const value = validation === "dateRange" ? `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}` : textValue;
|
|
1582
|
+
const value = validation === "dateRange" ? `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}` : validation === "datePicker" ? (_f = (_e = typeElement.state) == null ? void 0 : _e.format("DD/MM/YYYY")) != null ? _f : "" : validation === "time" ? (_h = (_g = typeElement.state) == null ? void 0 : _g.format("HH:mm")) != null ? _h : "" : textValue;
|
|
1566
1583
|
const existingFilterIndex = newFiltersToAdd.findIndex(
|
|
1567
1584
|
(filter) => filter.arrayElement.label === element.label
|
|
1568
1585
|
);
|
|
@@ -1590,20 +1607,26 @@ var useChipFilters = (arrayElements, chipFilters) => {
|
|
|
1590
1607
|
});
|
|
1591
1608
|
};
|
|
1592
1609
|
const getCurrentValue = (validation, typeElement) => {
|
|
1593
|
-
var _a, _b, _c, _d, _e;
|
|
1610
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1594
1611
|
if (validation === "dateRange") {
|
|
1595
1612
|
if (((_a = typeElement.state) == null ? void 0 : _a[0]) && ((_b = typeElement.state) == null ? void 0 : _b[1])) {
|
|
1596
1613
|
return `${(_c = typeElement.state[0]) == null ? void 0 : _c.format("DD/MM/YYYY")} - ${(_d = typeElement.state[1]) == null ? void 0 : _d.format("DD/MM/YYYY")}`;
|
|
1597
1614
|
}
|
|
1598
1615
|
return "";
|
|
1599
1616
|
}
|
|
1600
|
-
|
|
1617
|
+
if (validation === "datePicker") {
|
|
1618
|
+
return ((_f = (_e = typeElement.state) == null ? void 0 : _e.isValid) == null ? void 0 : _f.call(_e)) ? typeElement.state.format("DD/MM/YYYY") : "";
|
|
1619
|
+
}
|
|
1620
|
+
if (validation === "time") {
|
|
1621
|
+
return ((_h = (_g = typeElement.state) == null ? void 0 : _g.isValid) == null ? void 0 : _h.call(_g)) ? typeElement.state.format("HH:mm") : "";
|
|
1622
|
+
}
|
|
1623
|
+
return ((_i = typeElement.state) == null ? void 0 : _i.textValue) !== void 0 ? String(typeElement.state.textValue).trim() : String(typeElement.state).trim();
|
|
1601
1624
|
};
|
|
1602
1625
|
const updateFilter = (value, typeElement, label) => {
|
|
1603
1626
|
setTextFilters((prevFilters) => {
|
|
1604
1627
|
const newFilter = { value, arrayElement: typeElement };
|
|
1605
1628
|
const existingFilterIndex = prevFilters.findIndex(
|
|
1606
|
-
(filter) => filter.arrayElement.label === label
|
|
1629
|
+
(filter) => label !== void 0 ? filter.arrayElement.label === label : filter.value === value
|
|
1607
1630
|
);
|
|
1608
1631
|
if (existingFilterIndex !== -1) {
|
|
1609
1632
|
const updatedFilters = [...prevFilters];
|
|
@@ -1669,6 +1692,10 @@ var resetElementByType = (originalElement, validation, typeElement) => {
|
|
|
1669
1692
|
case "dateRange":
|
|
1670
1693
|
defaultValue = [null, null];
|
|
1671
1694
|
break;
|
|
1695
|
+
case "datePicker":
|
|
1696
|
+
case "time":
|
|
1697
|
+
defaultValue = null;
|
|
1698
|
+
break;
|
|
1672
1699
|
case "multiselect":
|
|
1673
1700
|
defaultValue = { hiddenValue: [], textValue: [] };
|
|
1674
1701
|
break;
|
|
@@ -1745,7 +1772,7 @@ var DrawerButton = ({
|
|
|
1745
1772
|
};
|
|
1746
1773
|
|
|
1747
1774
|
// src/Components/Drawer/components/ChipFiltersDisplay.tsx
|
|
1748
|
-
import React11, { useRef as
|
|
1775
|
+
import React11, { useRef as useRef3 } from "react";
|
|
1749
1776
|
import { Box as Box7, IconButton as IconButton6, Chip as Chip3 } from "@mui/material";
|
|
1750
1777
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
1751
1778
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -1753,13 +1780,13 @@ var ChipFiltersDisplay = ({
|
|
|
1753
1780
|
textFilters,
|
|
1754
1781
|
onDeleteFilter
|
|
1755
1782
|
}) => {
|
|
1756
|
-
const scrollRef =
|
|
1783
|
+
const scrollRef = useRef3(null);
|
|
1757
1784
|
const scroll = (offset) => {
|
|
1758
1785
|
if (scrollRef.current) {
|
|
1759
1786
|
scrollRef.current.scrollLeft += offset;
|
|
1760
1787
|
}
|
|
1761
1788
|
};
|
|
1762
|
-
return /* @__PURE__ */ React11.createElement(Box7, { display: "flex", alignItems: "center", sx: { maxWidth: "78%" } }, /* @__PURE__ */ React11.createElement(IconButton6, { onClick: () => scroll(-150), size: "small" }, /* @__PURE__ */ React11.createElement(ChevronLeftIcon, { fontSize: "small", color: "action" })), /* @__PURE__ */ React11.createElement(
|
|
1789
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, (textFilters == null ? void 0 : textFilters.length) > 0 && /* @__PURE__ */ React11.createElement(Box7, { display: "flex", alignItems: "center", sx: { maxWidth: "78%" } }, /* @__PURE__ */ React11.createElement(IconButton6, { onClick: () => scroll(-150), size: "small" }, /* @__PURE__ */ React11.createElement(ChevronLeftIcon, { fontSize: "small", color: "action" })), /* @__PURE__ */ React11.createElement(
|
|
1763
1790
|
Box7,
|
|
1764
1791
|
{
|
|
1765
1792
|
ref: scrollRef,
|
|
@@ -1786,7 +1813,7 @@ var ChipFiltersDisplay = ({
|
|
|
1786
1813
|
}
|
|
1787
1814
|
})
|
|
1788
1815
|
))
|
|
1789
|
-
), /* @__PURE__ */ React11.createElement(IconButton6, { onClick: () => scroll(150), size: "small" }, /* @__PURE__ */ React11.createElement(ChevronRightIcon, { fontSize: "small", color: "action" })));
|
|
1816
|
+
), /* @__PURE__ */ React11.createElement(IconButton6, { onClick: () => scroll(150), size: "small" }, /* @__PURE__ */ React11.createElement(ChevronRightIcon, { fontSize: "small", color: "action" }))));
|
|
1790
1817
|
};
|
|
1791
1818
|
|
|
1792
1819
|
// src/Components/Drawer/components/DrawerContent.tsx
|
|
@@ -1794,7 +1821,7 @@ import React17 from "react";
|
|
|
1794
1821
|
import { Box as Box13, Stack as Stack8 } from "@mui/material";
|
|
1795
1822
|
|
|
1796
1823
|
// src/Components/Textfield/SCTextField.tsx
|
|
1797
|
-
import React12, { useEffect as
|
|
1824
|
+
import React12, { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1798
1825
|
import { FormControl, IconButton as IconButton7, InputAdornment, InputLabel, OutlinedInput, FilledInput, Popover as Popover2, Input, Box as Box8, Typography as Typography7, SvgIcon as SvgIcon3, Tooltip as Tooltip4 } from "@mui/material";
|
|
1799
1826
|
import Grid from "@mui/material/Grid";
|
|
1800
1827
|
import { Visibility, VisibilityOff, InfoOutlined } from "@mui/icons-material";
|
|
@@ -1889,7 +1916,7 @@ var SCTextField = ({
|
|
|
1889
1916
|
const openInfoTitle = Boolean(anchorInfoTitle);
|
|
1890
1917
|
const [anchorInfoElement, setAnchorInfoElement] = useState10(null);
|
|
1891
1918
|
const openInfoElement = Boolean(anchorInfoElement);
|
|
1892
|
-
|
|
1919
|
+
useEffect7(() => {
|
|
1893
1920
|
if (error) {
|
|
1894
1921
|
setTimeout(() => {
|
|
1895
1922
|
setError(false);
|
|
@@ -2128,7 +2155,7 @@ function getIcon2(name) {
|
|
|
2128
2155
|
}
|
|
2129
2156
|
|
|
2130
2157
|
// src/Components/TextArea/SCTextArea.tsx
|
|
2131
|
-
import React13, { useEffect as
|
|
2158
|
+
import React13, { useEffect as useEffect8, useState as useState11 } from "react";
|
|
2132
2159
|
import { Typography as Typography8, Stack as Stack7, TextField, Box as Box9, Popover as Popover3, Tooltip as Tooltip5, SvgIcon as SvgIcon4, Grid as Grid2 } from "@mui/material";
|
|
2133
2160
|
import { InfoOutlined as InfoOutlined2 } from "@mui/icons-material";
|
|
2134
2161
|
var SCTextArea = ({
|
|
@@ -2156,7 +2183,7 @@ var SCTextArea = ({
|
|
|
2156
2183
|
const [stateError, setStateError] = useState11(false);
|
|
2157
2184
|
const [anchorInfoTitle, setAnchorInfoTitle] = React13.useState(null);
|
|
2158
2185
|
const openInfoTitle = Boolean(anchorInfoTitle);
|
|
2159
|
-
|
|
2186
|
+
useEffect8(() => {
|
|
2160
2187
|
setHelperCount(state == null ? void 0 : state.length);
|
|
2161
2188
|
}, [state]);
|
|
2162
2189
|
const IconTitle = getIcon2(iconTitle);
|
|
@@ -2249,7 +2276,7 @@ var SCTextArea = ({
|
|
|
2249
2276
|
};
|
|
2250
2277
|
|
|
2251
2278
|
// src/Components/SCSelect.tsx
|
|
2252
|
-
import React14, { useEffect as
|
|
2279
|
+
import React14, { useEffect as useEffect9 } from "react";
|
|
2253
2280
|
import { InputLabel as InputLabel2, FormControl as FormControl2, MenuItem as MenuItem2, SvgIcon as SvgIcon5, ListItemIcon, ListItemText, Box as Box10 } from "@mui/material";
|
|
2254
2281
|
import Select from "@mui/material/Select";
|
|
2255
2282
|
import * as Muicon5 from "@mui/icons-material";
|
|
@@ -2269,14 +2296,14 @@ function SCSelect({
|
|
|
2269
2296
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
2270
2297
|
const [prevData, setPrevData] = React14.useState(data);
|
|
2271
2298
|
const [error, setError] = React14.useState(false);
|
|
2272
|
-
|
|
2299
|
+
useEffect9(() => {
|
|
2273
2300
|
if (error) {
|
|
2274
2301
|
setTimeout(() => {
|
|
2275
2302
|
setError(false);
|
|
2276
2303
|
}, 1e3);
|
|
2277
2304
|
}
|
|
2278
2305
|
}, [error]);
|
|
2279
|
-
|
|
2306
|
+
useEffect9(() => {
|
|
2280
2307
|
let dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
|
|
2281
2308
|
if (dataChangeValidation == false) {
|
|
2282
2309
|
setState({ hiddenValue: "", textValue: "" });
|
|
@@ -2365,7 +2392,7 @@ function SCSelect({
|
|
|
2365
2392
|
}
|
|
2366
2393
|
|
|
2367
2394
|
// src/Components/SCAutocomplete.tsx
|
|
2368
|
-
import React15, { useEffect as
|
|
2395
|
+
import React15, { useEffect as useEffect10, useMemo as useMemo3 } from "react";
|
|
2369
2396
|
import { Autocomplete, Checkbox, InputAdornment as InputAdornment3, MenuItem as MenuItem3, TextField as TextField3, Typography as Typography10, SvgIcon as SvgIcon6, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Divider as Divider4, FormControlLabel as FormControlLabel2, IconButton as IconButton9, Chip as Chip4, Box as Box11, Button as Button7, Grid as Grid3 } from "@mui/material";
|
|
2370
2397
|
import { Search, Clear } from "@mui/icons-material";
|
|
2371
2398
|
import * as Muicon6 from "@mui/icons-material";
|
|
@@ -2402,7 +2429,8 @@ function SCAutocomplete({
|
|
|
2402
2429
|
setState,
|
|
2403
2430
|
state,
|
|
2404
2431
|
inputChange,
|
|
2405
|
-
maxCheck
|
|
2432
|
+
maxCheck,
|
|
2433
|
+
width = "100%"
|
|
2406
2434
|
}) {
|
|
2407
2435
|
const labelContent = `<span style="color: red;">* </span>` + label;
|
|
2408
2436
|
let group = "";
|
|
@@ -2412,7 +2440,7 @@ function SCAutocomplete({
|
|
|
2412
2440
|
const [originalData, setOriginalData] = React15.useState(data);
|
|
2413
2441
|
const [inputValue, setInputValue] = React15.useState("");
|
|
2414
2442
|
const [isUserTyping, setIsUserTyping] = React15.useState(false);
|
|
2415
|
-
|
|
2443
|
+
useEffect10(() => {
|
|
2416
2444
|
const dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
|
|
2417
2445
|
if (!dataChangeValidation && !isUserTyping) {
|
|
2418
2446
|
setState({ hiddenValue: "-1", textValue: "" });
|
|
@@ -2423,7 +2451,7 @@ function SCAutocomplete({
|
|
|
2423
2451
|
}
|
|
2424
2452
|
setPrevData(data);
|
|
2425
2453
|
}, [data, isUserTyping]);
|
|
2426
|
-
|
|
2454
|
+
useEffect10(() => {
|
|
2427
2455
|
if (typeFormat == "multiselect") {
|
|
2428
2456
|
if (state.hiddenValue != "-1" && Array.isArray(state.hiddenValue)) {
|
|
2429
2457
|
const newSelectedOptions = originalData.filter(
|
|
@@ -2433,12 +2461,12 @@ function SCAutocomplete({
|
|
|
2433
2461
|
}
|
|
2434
2462
|
}
|
|
2435
2463
|
}, [state.hiddenValue, originalData, typeFormat]);
|
|
2436
|
-
|
|
2464
|
+
useEffect10(() => {
|
|
2437
2465
|
if (inputValue === "") {
|
|
2438
2466
|
setIsUserTyping(false);
|
|
2439
2467
|
}
|
|
2440
2468
|
}, [inputValue]);
|
|
2441
|
-
const normalizedData =
|
|
2469
|
+
const normalizedData = useMemo3(() => {
|
|
2442
2470
|
return data.map((option) => {
|
|
2443
2471
|
if ((option == null ? void 0 : option.icon) && option.icon.type === void 0) {
|
|
2444
2472
|
return __spreadProps(__spreadValues({}, option), {
|
|
@@ -2494,13 +2522,26 @@ function SCAutocomplete({
|
|
|
2494
2522
|
) || null;
|
|
2495
2523
|
const [open, setOpen] = React15.useState(false);
|
|
2496
2524
|
const componentClickActiveRef = React15.useRef(false);
|
|
2497
|
-
const
|
|
2525
|
+
const containerRef = React15.useRef(null);
|
|
2526
|
+
const [chipLimit, setChipLimit] = React15.useState(2);
|
|
2527
|
+
useEffect10(() => {
|
|
2528
|
+
const el = containerRef.current;
|
|
2529
|
+
if (!el) return;
|
|
2530
|
+
const observer = new ResizeObserver((entries) => {
|
|
2531
|
+
const width2 = entries[0].contentRect.width;
|
|
2532
|
+
const limit = Math.max(1, Math.floor((width2 - 80) / 128));
|
|
2533
|
+
setChipLimit(limit);
|
|
2534
|
+
});
|
|
2535
|
+
observer.observe(el);
|
|
2536
|
+
return () => observer.disconnect();
|
|
2537
|
+
}, []);
|
|
2538
|
+
const hayOnComponentClickGlobal = useMemo3(() => {
|
|
2498
2539
|
return data.some((opt) => {
|
|
2499
2540
|
const item = getItemValue(opt);
|
|
2500
2541
|
return Boolean(item.onComponentClick);
|
|
2501
2542
|
});
|
|
2502
2543
|
}, [data, getItemValue]);
|
|
2503
|
-
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, data && /* @__PURE__ */ React15.createElement(
|
|
2544
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, data && /* @__PURE__ */ React15.createElement(Box11, { ref: containerRef, sx: { width } }, /* @__PURE__ */ React15.createElement(
|
|
2504
2545
|
Autocomplete,
|
|
2505
2546
|
__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
|
|
2506
2547
|
onClose: (event2, reason) => {
|
|
@@ -2530,9 +2571,9 @@ function SCAutocomplete({
|
|
|
2530
2571
|
width: "100%",
|
|
2531
2572
|
maxWidth: "100%"
|
|
2532
2573
|
},
|
|
2533
|
-
limitTags:
|
|
2574
|
+
limitTags: chipLimit,
|
|
2534
2575
|
renderTags: (value, getTagProps) => {
|
|
2535
|
-
const limit =
|
|
2576
|
+
const limit = chipLimit;
|
|
2536
2577
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, value.slice(0, limit).map((option, index) => {
|
|
2537
2578
|
const _a = getTagProps({ index }), { key } = _a, chipProps = __objRest(_a, ["key"]);
|
|
2538
2579
|
return /* @__PURE__ */ React15.createElement(
|
|
@@ -2615,7 +2656,14 @@ function SCAutocomplete({
|
|
|
2615
2656
|
},
|
|
2616
2657
|
renderInput: (params) => /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
2617
2658
|
TextField3,
|
|
2618
|
-
__spreadProps(__spreadValues({
|
|
2659
|
+
__spreadProps(__spreadValues({
|
|
2660
|
+
sx: { "& .MuiOutlinedInput-input": {
|
|
2661
|
+
padding: "2.5px 2px 2.5px 2px !important",
|
|
2662
|
+
// ajusta aquí
|
|
2663
|
+
width: "10px !important",
|
|
2664
|
+
minWidth: "10px !important"
|
|
2665
|
+
} }
|
|
2666
|
+
}, params), {
|
|
2619
2667
|
label: required ? /* @__PURE__ */ React15.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
|
|
2620
2668
|
placeholder: selectedOptions.length == 0 ? "B\xFAsqueda" : "",
|
|
2621
2669
|
InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
|
|
@@ -2690,7 +2738,7 @@ function SCAutocomplete({
|
|
|
2690
2738
|
}
|
|
2691
2739
|
}
|
|
2692
2740
|
})
|
|
2693
|
-
));
|
|
2741
|
+
)));
|
|
2694
2742
|
}
|
|
2695
2743
|
|
|
2696
2744
|
// src/Components/SCDateRange.tsx
|
|
@@ -3853,7 +3901,7 @@ var Calendar = ({
|
|
|
3853
3901
|
}) => {
|
|
3854
3902
|
const [view, setView] = useState14(initialView);
|
|
3855
3903
|
const { currentDate, navigateDate } = useCalendarNavigation(dayjs9(), onDateChange);
|
|
3856
|
-
|
|
3904
|
+
useEffect11(() => {
|
|
3857
3905
|
onDateChange == null ? void 0 : onDateChange(currentDate);
|
|
3858
3906
|
}, [currentDate, onDateChange]);
|
|
3859
3907
|
const handleViewChange = (newView) => {
|
|
@@ -3955,7 +4003,7 @@ var FooterAction = ({
|
|
|
3955
4003
|
};
|
|
3956
4004
|
|
|
3957
4005
|
// src/Components/Menu/Menu.tsx
|
|
3958
|
-
import React33, { useCallback as
|
|
4006
|
+
import React33, { useCallback as useCallback3, useState as useState15 } from "react";
|
|
3959
4007
|
import { Button as Button12, Menu as Menu2 } from "@mui/material";
|
|
3960
4008
|
var BasicMenu = ({
|
|
3961
4009
|
open,
|
|
@@ -3974,7 +4022,7 @@ var BasicMenu = ({
|
|
|
3974
4022
|
} : setInternalOpen;
|
|
3975
4023
|
const menuAnchorEl = anchorEl != null ? anchorEl : internalAnchorEl;
|
|
3976
4024
|
const actualOpen = Boolean(menuAnchorEl) && menuOpen;
|
|
3977
|
-
const handleButtonClick =
|
|
4025
|
+
const handleButtonClick = useCallback3((event2) => {
|
|
3978
4026
|
if (handleClick) {
|
|
3979
4027
|
handleClick(event2);
|
|
3980
4028
|
} else {
|
|
@@ -3984,7 +4032,7 @@ var BasicMenu = ({
|
|
|
3984
4032
|
}
|
|
3985
4033
|
}
|
|
3986
4034
|
}, [handleClick, setMenuOpen, isControlled]);
|
|
3987
|
-
const handleMenuClose =
|
|
4035
|
+
const handleMenuClose = useCallback3(() => {
|
|
3988
4036
|
if (onClose) {
|
|
3989
4037
|
onClose();
|
|
3990
4038
|
} else {
|
|
@@ -4023,32 +4071,32 @@ var BasicMenu = ({
|
|
|
4023
4071
|
};
|
|
4024
4072
|
|
|
4025
4073
|
// src/Components/MultiSelect/MultiSelect.tsx
|
|
4026
|
-
import React34, { useEffect as
|
|
4074
|
+
import React34, { useEffect as useEffect12, useMemo as useMemo5 } from "react";
|
|
4027
4075
|
import { Button as Button13, Checkbox as Checkbox2, FormControl as FormControl3, InputAdornment as InputAdornment5, ListItemIcon as ListItemIcon3, MenuItem as MenuItem5, Popover as Popover4, Stack as Stack12, TextField as TextField4 } from "@mui/material";
|
|
4028
4076
|
import { SearchOutlined } from "@mui/icons-material";
|
|
4029
4077
|
|
|
4030
4078
|
// src/Components/MultiSelect/helpers/useHandlers.tsx
|
|
4031
|
-
import { useCallback as
|
|
4079
|
+
import { useCallback as useCallback4, useState as useState16 } from "react";
|
|
4032
4080
|
function useMultiSelectHandlers() {
|
|
4033
4081
|
const [anchorEl, setAnchorEl] = useState16(null);
|
|
4034
4082
|
const [open, setOpen] = useState16(false);
|
|
4035
4083
|
const [selectedItems, setSelectedItems] = useState16([]);
|
|
4036
4084
|
const [filterValue, setFilterValue] = useState16("");
|
|
4037
|
-
const handleOpen =
|
|
4085
|
+
const handleOpen = useCallback4((e) => {
|
|
4038
4086
|
setAnchorEl(e.currentTarget);
|
|
4039
4087
|
setOpen(true);
|
|
4040
4088
|
}, []);
|
|
4041
|
-
const handleClose =
|
|
4089
|
+
const handleClose = useCallback4(() => {
|
|
4042
4090
|
setAnchorEl(null);
|
|
4043
4091
|
setOpen(false);
|
|
4044
4092
|
}, []);
|
|
4045
|
-
const handleFilterChange =
|
|
4093
|
+
const handleFilterChange = useCallback4(
|
|
4046
4094
|
(e) => {
|
|
4047
4095
|
setFilterValue(e.target.value);
|
|
4048
4096
|
},
|
|
4049
4097
|
[]
|
|
4050
4098
|
);
|
|
4051
|
-
const handleCheckboxToggle =
|
|
4099
|
+
const handleCheckboxToggle = useCallback4((item) => {
|
|
4052
4100
|
setSelectedItems(
|
|
4053
4101
|
(prev) => prev.includes(item) ? prev.filter((i) => i !== item) : [...prev, item]
|
|
4054
4102
|
);
|
|
@@ -4075,15 +4123,15 @@ function getIconMultiSelect(name) {
|
|
|
4075
4123
|
}
|
|
4076
4124
|
|
|
4077
4125
|
// src/Components/MultiSelect/helpers/useFilteredItems.tsx
|
|
4078
|
-
import { useMemo as
|
|
4126
|
+
import { useMemo as useMemo4 } from "react";
|
|
4079
4127
|
function useFilteredItems(items, filterValue, getItemLabel, selectedItems) {
|
|
4080
|
-
const filteredItems =
|
|
4128
|
+
const filteredItems = useMemo4(
|
|
4081
4129
|
() => items.filter(
|
|
4082
4130
|
(item) => getItemLabel(item).toLowerCase().includes(filterValue.toLowerCase())
|
|
4083
4131
|
),
|
|
4084
4132
|
[items, filterValue, getItemLabel]
|
|
4085
4133
|
);
|
|
4086
|
-
const sortedItems =
|
|
4134
|
+
const sortedItems = useMemo4(() => {
|
|
4087
4135
|
return [
|
|
4088
4136
|
...filteredItems.filter((item) => selectedItems.includes(item)),
|
|
4089
4137
|
...filteredItems.filter((item) => !selectedItems.includes(item))
|
|
@@ -4117,16 +4165,16 @@ function MultiSelect({
|
|
|
4117
4165
|
handleCheckboxToggle,
|
|
4118
4166
|
setOpen
|
|
4119
4167
|
} = useMultiSelectHandlers();
|
|
4120
|
-
|
|
4168
|
+
useEffect12(() => {
|
|
4121
4169
|
if (open !== void 0) {
|
|
4122
4170
|
setOpen(open);
|
|
4123
4171
|
}
|
|
4124
4172
|
}, [open, setOpen]);
|
|
4125
|
-
|
|
4173
|
+
useEffect12(() => {
|
|
4126
4174
|
setSelectedItems([]);
|
|
4127
4175
|
}, [items, setSelectedItems]);
|
|
4128
4176
|
const { filteredItems, sortedItems } = useFilteredItems(items, filterValue, getItemLabel, selectedItems);
|
|
4129
|
-
const Icon =
|
|
4177
|
+
const Icon = useMemo5(() => {
|
|
4130
4178
|
var _a2;
|
|
4131
4179
|
return getIconMultiSelect((_a2 = button == null ? void 0 : button.icon) != null ? _a2 : "FilterListOutlined");
|
|
4132
4180
|
}, [button == null ? void 0 : button.icon]);
|
|
@@ -4531,7 +4579,7 @@ var SCAlert = ({
|
|
|
4531
4579
|
};
|
|
4532
4580
|
|
|
4533
4581
|
// src/Components/SCAppBar.tsx
|
|
4534
|
-
import React39, { useState as useState19, useEffect as
|
|
4582
|
+
import React39, { useState as useState19, useEffect as useEffect15 } from "react";
|
|
4535
4583
|
import { Menu as Menu4, Box as Box23, Typography as Typography22, MenuItem as MenuItem8, IconButton as IconButton14, Badge as Badge2 } from "@mui/material";
|
|
4536
4584
|
import Grid9 from "@mui/material/Grid";
|
|
4537
4585
|
import "dayjs/locale/es";
|
|
@@ -4556,13 +4604,11 @@ var SCAppBar = ({
|
|
|
4556
4604
|
const handleMenuClose = () => {
|
|
4557
4605
|
setAnchorEl(null);
|
|
4558
4606
|
};
|
|
4559
|
-
|
|
4607
|
+
useEffect15(() => {
|
|
4560
4608
|
const handleOnline = () => {
|
|
4561
|
-
console.log("tiene internet");
|
|
4562
4609
|
setIsOnline(true);
|
|
4563
4610
|
};
|
|
4564
4611
|
const handleOffline = () => {
|
|
4565
|
-
console.log(" no tiene internet");
|
|
4566
4612
|
setIsOnline(false);
|
|
4567
4613
|
};
|
|
4568
4614
|
window.addEventListener("online", handleOnline);
|
|
@@ -4781,7 +4827,7 @@ var SCCard = ({ width, title, image, iconTitle, actionsTitle, subtitle, content,
|
|
|
4781
4827
|
};
|
|
4782
4828
|
|
|
4783
4829
|
// src/Components/SCDataGrid.tsx
|
|
4784
|
-
import React42, { useEffect as
|
|
4830
|
+
import React42, { useEffect as useEffect18, useState as useState22 } from "react";
|
|
4785
4831
|
import { DataGridPro, useGridApiRef } from "@mui/x-data-grid-pro";
|
|
4786
4832
|
import { LicenseInfo as LicenseInfo2 } from "@mui/x-license";
|
|
4787
4833
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
@@ -4948,14 +4994,14 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
4948
4994
|
const [pageSize, setPageSize] = useState22(rows);
|
|
4949
4995
|
const [arrayRows, setArrayRows] = useState22([]);
|
|
4950
4996
|
const [selectionModel, setSelectionModel] = useState22([]);
|
|
4951
|
-
|
|
4997
|
+
useEffect18(() => {
|
|
4952
4998
|
var _a;
|
|
4953
4999
|
if (setSelectedRow) {
|
|
4954
5000
|
setSelectedRow(arrayRows[selectedIndex]);
|
|
4955
5001
|
setSelectionModel(((_a = arrayRows[selectedIndex]) == null ? void 0 : _a.id) ? [arrayRows[selectedIndex].id] : []);
|
|
4956
5002
|
}
|
|
4957
5003
|
}, [selectedIndex]);
|
|
4958
|
-
|
|
5004
|
+
useEffect18(() => {
|
|
4959
5005
|
if ((data == null ? void 0 : data.length) > 0) {
|
|
4960
5006
|
dataConvertRows(data, void 0);
|
|
4961
5007
|
}
|
|
@@ -5038,14 +5084,13 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, titleRowsPag
|
|
|
5038
5084
|
columnVisibilityModel[col.field] = false;
|
|
5039
5085
|
}
|
|
5040
5086
|
});
|
|
5041
|
-
console.log("columnVisibilityModel:", columnVisibilityModel);
|
|
5042
5087
|
const initialState = {
|
|
5043
5088
|
pagination: { paginationModel: { pageSize: rows } }
|
|
5044
5089
|
};
|
|
5045
5090
|
if (Object.keys(columnVisibilityModel).length > 0) {
|
|
5046
5091
|
initialState.columns = { columnVisibilityModel };
|
|
5047
5092
|
}
|
|
5048
|
-
|
|
5093
|
+
useEffect18(() => {
|
|
5049
5094
|
if (apiRef.current && Object.keys(columnVisibilityModel).length > 0) {
|
|
5050
5095
|
apiRef.current.setColumnVisibilityModel(columnVisibilityModel);
|
|
5051
5096
|
}
|
|
@@ -5282,7 +5327,7 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
|
|
|
5282
5327
|
};
|
|
5283
5328
|
|
|
5284
5329
|
// src/Components/SCDialog.tsx
|
|
5285
|
-
import React44, { useEffect as
|
|
5330
|
+
import React44, { useEffect as useEffect19, useState as useState24 } from "react";
|
|
5286
5331
|
import { Button as Button19, Typography as Typography25, Modal as Modal5, Dialog as Dialog4, DialogActions as DialogActions4, DialogContent as DialogContent4, DialogTitle as DialogTitle4, IconButton as IconButton17, Tooltip as Tooltip8, Box as Box26, SvgIcon as SvgIcon10 } from "@mui/material";
|
|
5287
5332
|
import Grid11 from "@mui/material/Grid";
|
|
5288
5333
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
@@ -5295,7 +5340,7 @@ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, di
|
|
|
5295
5340
|
let IconTitle;
|
|
5296
5341
|
let ButtonIcon;
|
|
5297
5342
|
const [open, setOpen] = useState24(show);
|
|
5298
|
-
|
|
5343
|
+
useEffect19(() => {
|
|
5299
5344
|
if (show) {
|
|
5300
5345
|
handleOpen();
|
|
5301
5346
|
} else {
|
|
@@ -5455,7 +5500,7 @@ import { Box as Box27, Typography as Typography26, Paper as Paper4, Divider as D
|
|
|
5455
5500
|
import Grid12 from "@mui/material/Grid";
|
|
5456
5501
|
|
|
5457
5502
|
// src/Components/Hooks/useWindowDimensions.ts
|
|
5458
|
-
import { useState as useState25, useEffect as
|
|
5503
|
+
import { useState as useState25, useEffect as useEffect20 } from "react";
|
|
5459
5504
|
function getWindowDimensions() {
|
|
5460
5505
|
const { innerWidth: width, innerHeight: height } = window;
|
|
5461
5506
|
return {
|
|
@@ -5465,7 +5510,7 @@ function getWindowDimensions() {
|
|
|
5465
5510
|
}
|
|
5466
5511
|
function useWindowDimensions() {
|
|
5467
5512
|
const [windowDimensions, setWindowDimensions] = useState25(getWindowDimensions());
|
|
5468
|
-
|
|
5513
|
+
useEffect20(() => {
|
|
5469
5514
|
function handleResize() {
|
|
5470
5515
|
setWindowDimensions(getWindowDimensions());
|
|
5471
5516
|
}
|
|
@@ -5574,7 +5619,7 @@ var SCSnackBar = ({
|
|
|
5574
5619
|
};
|
|
5575
5620
|
|
|
5576
5621
|
// src/Components/SCTabs.tsx
|
|
5577
|
-
import React47, { useEffect as
|
|
5622
|
+
import React47, { useEffect as useEffect21 } from "react";
|
|
5578
5623
|
import { Typography as Typography27, Box as Box28, SvgIcon as SvgIcon12, Tab as Tab3, Tabs as Tabs3, Badge as Badge3 } from "@mui/material";
|
|
5579
5624
|
import TabPanel from "@mui/lab/TabPanel";
|
|
5580
5625
|
import TabContext from "@mui/lab/TabContext";
|
|
@@ -5587,7 +5632,7 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
5587
5632
|
let l = 0;
|
|
5588
5633
|
let validateTypeIcon = true;
|
|
5589
5634
|
const [value, setValue] = React47.useState("1");
|
|
5590
|
-
|
|
5635
|
+
useEffect21(() => {
|
|
5591
5636
|
if (defaultOption) {
|
|
5592
5637
|
handleChange(event, void 0);
|
|
5593
5638
|
}
|