componentes-sinco 1.0.2-rc.8 → 1.0.3

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.
Files changed (107) hide show
  1. package/dist/componentes-sinco.css +1 -0
  2. package/dist/index.cjs +95 -56
  3. package/dist/index.d.cts +6 -2
  4. package/dist/index.d.ts +6 -2
  5. package/dist/index.js +87 -48
  6. package/dist/my-react-lib.es.js +105856 -0
  7. package/dist/my-react-lib.umd.js +454 -0
  8. package/dist/src/App.d.ts +4 -0
  9. package/dist/src/Components/Adjuntar/Adjuntar.d.ts +4 -0
  10. package/dist/src/Components/Adjuntar/Model.d.ts +17 -0
  11. package/dist/src/Components/Adjuntar/index.d.ts +1 -0
  12. package/dist/src/Components/Calendario/Calendario.d.ts +3 -0
  13. package/dist/src/Components/Drawer/Helpers/Model.d.ts +55 -0
  14. package/dist/src/Components/Drawer/Helpers/Utils.d.ts +4 -0
  15. package/dist/src/Components/Drawer/Helpers/index.d.ts +3 -0
  16. package/dist/src/Components/Drawer/Helpers/validateInput.d.ts +3 -0
  17. package/dist/src/Components/Drawer/SCDrawer.d.ts +5 -0
  18. package/dist/src/Components/Drawer/SCDrawer.test.d.ts +1 -0
  19. package/dist/src/Components/Drawer/index.d.ts +1 -0
  20. package/dist/src/Components/FooterAction/FooterAction.d.ts +4 -0
  21. package/dist/src/Components/FooterAction/Model.d.ts +6 -0
  22. package/dist/src/Components/FooterAction/index.d.ts +2 -0
  23. package/dist/src/Components/Hooks/useWindowDimensions.d.ts +4 -0
  24. package/dist/src/Components/Modal/Helpers/Data.d.ts +19 -0
  25. package/dist/src/Components/Modal/Helpers/Model.d.ts +26 -0
  26. package/dist/src/Components/Modal/Helpers/Utils.d.ts +3 -0
  27. package/dist/src/Components/Modal/Helpers/index.d.ts +3 -0
  28. package/dist/src/Components/Modal/SCModal.d.ts +4 -0
  29. package/dist/src/Components/Modal/SCModal.test.d.ts +1 -0
  30. package/dist/src/Components/Modal/index.d.ts +2 -0
  31. package/dist/src/Components/MultiSelect/MultiSelect.test.d.ts +1 -0
  32. package/dist/src/Components/MultiSelect/SCMultiSelect.d.ts +4 -0
  33. package/dist/src/Components/MultiSelect/example.d.ts +3 -0
  34. package/dist/src/Components/MultiSelect/helpers/Model.d.ts +24 -0
  35. package/dist/src/Components/MultiSelect/helpers/Utils.d.ts +3 -0
  36. package/dist/src/Components/MultiSelect/helpers/index.d.ts +4 -0
  37. package/dist/src/Components/MultiSelect/helpers/useFilteredItems.d.ts +4 -0
  38. package/dist/src/Components/MultiSelect/helpers/useHandlers.d.ts +12 -0
  39. package/dist/src/Components/MultiSelect/index.d.ts +2 -0
  40. package/dist/src/Components/PageHeader/Model.d.ts +8 -0
  41. package/dist/src/Components/PageHeader/PageHeader.d.ts +4 -0
  42. package/dist/src/Components/PageHeader/PageHeader.test.d.ts +1 -0
  43. package/dist/src/Components/PageHeader/index.d.ts +2 -0
  44. package/dist/src/Components/SCAutocomplete.d.ts +26 -0
  45. package/dist/src/Components/SCCalendarSwipeable.d.ts +9 -0
  46. package/dist/src/Components/SCDataGrid.d.ts +19 -0
  47. package/dist/src/Components/SCDialog.d.ts +32 -0
  48. package/dist/src/Components/SCMenu.d.ts +20 -0
  49. package/dist/src/Components/SCTabs.d.ts +22 -0
  50. package/dist/src/Components/TextArea/Helpers/Model.d.ts +23 -0
  51. package/dist/src/Components/TextArea/Helpers/index.d.ts +2 -0
  52. package/dist/src/Components/TextArea/Helpers/validateIcon.d.ts +3 -0
  53. package/dist/src/Components/TextArea/SCTextArea.d.ts +4 -0
  54. package/dist/src/Components/TextArea/index.d.ts +2 -0
  55. package/dist/src/Components/Textfield/Helpers/index.d.ts +3 -0
  56. package/dist/src/Components/Textfield/Helpers/validateIcon.d.ts +4 -0
  57. package/dist/src/Components/Textfield/Helpers/validateKeyDown.d.ts +1 -0
  58. package/dist/src/Components/Textfield/Helpers/validateOnBlur.d.ts +10 -0
  59. package/dist/src/Components/Textfield/Model.d.ts +32 -0
  60. package/dist/src/Components/Textfield/SCTextField.d.ts +4 -0
  61. package/dist/src/Components/Textfield/Textfield.test.d.ts +1 -0
  62. package/dist/src/Components/Textfield/index.d.ts +2 -0
  63. package/dist/src/Components/ToastNotification/Model.d.ts +14 -0
  64. package/dist/src/Components/ToastNotification/SCToastNotification.d.ts +4 -0
  65. package/dist/src/Components/ToastNotification/index.d.ts +3 -0
  66. package/dist/src/Components/ToastNotification/useProgress.d.ts +6 -0
  67. package/dist/src/Components/index.d.ts +14 -0
  68. package/dist/src/Pages/PruebasDavid/Test.d.ts +3 -0
  69. package/dist/src/Pages/PruebasNataly/PruebaPag1.d.ts +4 -0
  70. package/dist/src/Pages/PruebasNataly/PruebaPag2.d.ts +3 -0
  71. package/dist/src/Pages/PruebasNataly/TestNataly.d.ts +3 -0
  72. package/dist/src/Theme/breakpoints.d.ts +3 -0
  73. package/dist/src/Theme/components.d.ts +3 -0
  74. package/dist/src/Theme/index.d.ts +3 -0
  75. package/dist/src/Theme/mixins.d.ts +3 -0
  76. package/dist/src/Theme/module.d.ts +69 -0
  77. package/dist/src/Theme/palette.d.ts +6 -0
  78. package/dist/src/Theme/shadows.d.ts +3 -0
  79. package/dist/src/Theme/theme.d.ts +5 -0
  80. package/dist/src/Theme/typography.d.ts +3 -0
  81. package/dist/src/generales/capitalize.d.ts +1 -0
  82. package/dist/src/generales/index.d.ts +2 -0
  83. package/dist/src/generales/types.d.ts +4 -0
  84. package/dist/src/index.d.ts +5 -0
  85. package/dist/src/main.d.ts +1 -0
  86. package/dist/src/stories/Autocomplete/Autocomplete.stories.d.ts +7 -0
  87. package/dist/src/stories/CalendarSwipeable/CalendarSwipeable.stories.d.ts +7 -0
  88. package/dist/src/stories/DataGrid/DataGrid.stories.d.ts +7 -0
  89. package/dist/src/stories/Dialog/Dialog.stories.d.ts +7 -0
  90. package/dist/src/stories/Drawer/Drawer.stories.d.ts +7 -0
  91. package/dist/src/stories/FooterAction/Footer.stories.d.ts +7 -0
  92. package/dist/src/stories/Generales/Typography.d.ts +1 -0
  93. package/dist/src/stories/Generales/index.d.ts +2 -0
  94. package/dist/src/stories/Generales/types.d.ts +3 -0
  95. package/dist/src/stories/Menu/Menu.stories.d.ts +7 -0
  96. package/dist/src/stories/Modal/Modal.stories.d.ts +7 -0
  97. package/dist/src/stories/MultiSelect/MultiSelect.stories.d.ts +7 -0
  98. package/dist/src/stories/PageHeader/Header.stories.d.ts +7 -0
  99. package/dist/src/stories/Tabs/Tabs.stories.d.ts +7 -0
  100. package/dist/src/stories/TextArea/TextArea.stories.d.ts +7 -0
  101. package/dist/src/stories/Textfield/textfield.stories.d.ts +7 -0
  102. package/dist/src/stories/ToastNotification/toastNotification.stories.d.ts +27 -0
  103. package/dist/vite.svg +1 -0
  104. package/dist/vitest.setup.d.ts +1 -0
  105. package/package.json +18 -22
  106. package/dist/index.d.mts +0 -392
  107. package/dist/index.mjs +0 -3833
@@ -0,0 +1 @@
1
+ .red-asterisk{color:#d14343}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}body{margin:0;padding:0;-ms-overflow-style:none}body::-ms-scrollbar-track{background:#f1f1f1}body::-ms-scrollbar-thumb{background:#888}::-webkit-scrollbar{width:14px!important;height:14px!important;background:#eaebec}::-webkit-scrollbar-thumb{background-color:#2063a0;border:3.5px solid #EAEBEC;border-radius:17px}.APP5PassWord{-webkit-text-security:disc}input[type=password]::-ms-reveal{display:none!important}input[type=password]::-ms-clear{display:none!important}
package/dist/index.cjs CHANGED
@@ -57,8 +57,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
57
57
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
58
 
59
59
  // src/index.ts
60
- var index_exports = {};
61
- __export(index_exports, {
60
+ var src_exports = {};
61
+ __export(src_exports, {
62
62
  ADCSincoTheme: () => ADCSincoTheme,
63
63
  AdproSincoTheme: () => AdproSincoTheme,
64
64
  FooterAction: () => FooterAction,
@@ -88,7 +88,7 @@ __export(index_exports, {
88
88
  useMultiSelectHandlers: () => useMultiSelectHandlers,
89
89
  useProgress: () => useProgress
90
90
  });
91
- module.exports = __toCommonJS(index_exports);
91
+ module.exports = __toCommonJS(src_exports);
92
92
 
93
93
  // src/Components/Drawer/SCDrawer.tsx
94
94
  var import_react5 = __toESM(require("react"), 1);
@@ -1670,42 +1670,94 @@ var SCCalendarSwipeable = ({
1670
1670
  var import_react18 = __toESM(require("react"), 1);
1671
1671
  var import_x_data_grid_pro = require("@mui/x-data-grid-pro");
1672
1672
  var import_x_license_pro = require("@mui/x-license-pro");
1673
- var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeight, density, groupingColDef, getTreeDataPath }) => {
1673
+ var import_styles = require("@mui/styles");
1674
+ var useStyles = (0, import_styles.makeStyles)({
1675
+ root: {
1676
+ "& .MuiDataGrid-filler": {
1677
+ display: "none !important"
1678
+ },
1679
+ "& .MuiDataGrid-footerContainer": {
1680
+ minHeight: "26px !important",
1681
+ height: "26px !important"
1682
+ },
1683
+ "& .MuiTablePagination-toolbar": {
1684
+ minHeight: "25px !important",
1685
+ height: "25px !important"
1686
+ },
1687
+ "& .MuiTablePagination-actions .MuiIconButton-root": {
1688
+ padding: "0px !important"
1689
+ },
1690
+ "&.MuiDataGrid-root": {
1691
+ "--DataGrid-topContainerHeight": "0px !important"
1692
+ /* Cambia este valor según tus necesidades */
1693
+ },
1694
+ "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
1695
+ "--height": "0px !important",
1696
+ "minHeight": "0px !important",
1697
+ "maxHeight": "0px !important"
1698
+ },
1699
+ "& .MuiDataGrid-cell": {
1700
+ padding: "0 !important"
1701
+ }
1702
+ }
1703
+ });
1704
+ var SCDataGrid = (_a) => {
1705
+ var _b = _a, { data, columns, rowsTable, checkboxSelection, width, height, maxHeight, density, agrupacion, groupingColDef, getTreeDataPath } = _b, props = __objRest(_b, ["data", "columns", "rowsTable", "checkboxSelection", "width", "height", "maxHeight", "density", "agrupacion", "groupingColDef", "getTreeDataPath"]);
1674
1706
  const apiRef = (0, import_x_data_grid_pro.useGridApiRef)();
1707
+ const classes = useStyles();
1675
1708
  import_x_license_pro.LicenseInfo.setLicenseKey(
1676
1709
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
1677
1710
  );
1678
1711
  let validationTreeData = getTreeDataPath ? true : false;
1679
- let validationCheckboxSelection = checkboxSelection || false;
1680
- let styleDensity = density || "compact";
1681
- let styleTopContainerHeight = styleDensity === "compact" ? "26px" : styleDensity === "standard" ? "38px" : styleDensity === "comfortable" ? "60px" : "27px";
1682
- let styleRowHeight = density == "compact" ? 32 : density == "standard" ? 28 : density == "comfortable" ? 36 : 32;
1683
- let rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length) : data.length < 10 ? parseInt(data.length) : 10;
1684
- let validationGroupingColDef = groupingColDef || {};
1712
+ let paginalion = 10;
1713
+ let valor = 80;
1714
+ let alto = 345;
1715
+ let estilot = "compact";
1716
+ let tamanoEncabezado = density == "compact" ? 24 : density == "standard" ? 36 : density == "comfortable" ? 52 : 24;
1717
+ let tamanoCelda = density == "compact" ? 22 : density == "standard" ? 28 : density == "comfortable" ? 48 : 22;
1718
+ let dataConvert = [];
1685
1719
  const [groupDataLenght, setGroupDataLengh] = (0, import_react18.useState)(0);
1720
+ checkboxSelection = checkboxSelection || false;
1721
+ const rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length) : data.length < 10 ? parseInt(data.length) : 10;
1722
+ width = width || "100%";
1723
+ density = density || "compact";
1724
+ agrupacion = agrupacion || false;
1725
+ groupingColDef = groupingColDef || {};
1726
+ getTreeDataPath = getTreeDataPath || void 0;
1686
1727
  const [pageSize, setPageSize] = (0, import_react18.useState)(rows);
1687
1728
  const [arrayRows, setArrayRows] = (0, import_react18.useState)([]);
1729
+ const [heightTable, setHeightTable] = (0, import_react18.useState)(height || 0);
1688
1730
  (0, import_react18.useEffect)(() => {
1689
1731
  if ((data == null ? void 0 : data.length) > 0) {
1690
1732
  dataConvertRows(data, void 0);
1733
+ if (validationTreeData) {
1734
+ countGroupedElements(data, getTreeDataPath);
1735
+ }
1691
1736
  }
1692
1737
  }, [data]);
1738
+ (0, import_react18.useEffect)(() => {
1739
+ if (groupDataLenght > 0 && validationTreeData == true) {
1740
+ setHeightTable(heightTable ? heightTable : groupDataLenght * tamanoCelda + tamanoEncabezado + 27);
1741
+ } else if (groupDataLenght <= 0 && validationTreeData == false) {
1742
+ setHeightTable(heightTable ? heightTable : rows * tamanoCelda + tamanoEncabezado + 27);
1743
+ }
1744
+ }, [groupDataLenght]);
1693
1745
  const dataConvertRows = (data2, columnId) => {
1694
- let dataConvert = [];
1746
+ let dataConvert2 = [];
1695
1747
  if ((data2 == null ? void 0 : data2.length) > 0) {
1696
1748
  const dataKeys = Object.keys(data2[0]);
1697
1749
  data2.map((item) => {
1698
1750
  const newKeys = {};
1699
1751
  let i = 0;
1700
- let id = dataConvert.length + 1;
1752
+ let id = dataConvert2.length + 1;
1701
1753
  for (i = 0; i < dataKeys.length; i++) {
1702
1754
  newKeys[dataKeys[i]] = item[dataKeys[i]];
1703
1755
  }
1704
1756
  newKeys.id = columnId ? item[columnId] : id;
1705
- dataConvert = [...dataConvert, newKeys];
1757
+ dataConvert2 = [...dataConvert2, newKeys];
1706
1758
  });
1707
1759
  }
1708
- setArrayRows(dataConvert);
1760
+ setArrayRows(dataConvert2);
1709
1761
  };
1710
1762
  const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
1711
1763
  const [selectionModel, setSelectionModel] = (0, import_react18.useState)([]);
@@ -1745,27 +1797,41 @@ var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeigh
1745
1797
  setSelectionModel([...newSelection]);
1746
1798
  }
1747
1799
  };
1748
- return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, data && /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { style: { width: width || "100%", maxHeight } }, /* @__PURE__ */ import_react18.default.createElement(
1800
+ const countGroupedElements = (row, getTreeDataPath2) => {
1801
+ const groupedCounts = {};
1802
+ data.forEach((row2) => {
1803
+ const path = getTreeDataPath2(row2) || [];
1804
+ const key = path[0];
1805
+ if (!groupedCounts[key]) {
1806
+ groupedCounts[key] = 0;
1807
+ }
1808
+ groupedCounts[key]++;
1809
+ });
1810
+ setGroupDataLengh(Object.keys(groupedCounts).length);
1811
+ return groupedCounts;
1812
+ };
1813
+ const virtualScrollerHeight = validationTreeData ? groupDataLenght * tamanoCelda + 10 : rows * tamanoCelda;
1814
+ return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, heightTable > 0 ? /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { style: { display: "flex", flexDirection: "column", width, maxHeight } }, /* @__PURE__ */ import_react18.default.createElement(
1749
1815
  import_x_data_grid_pro.DataGridPro,
1750
- {
1751
- apiRef,
1752
- rowHeight: styleRowHeight,
1816
+ __spreadProps(__spreadValues({
1817
+ apiRef
1818
+ }, props), {
1753
1819
  rows: arrayRows,
1754
1820
  columns,
1755
- density: styleDensity,
1821
+ density,
1756
1822
  treeData: validationTreeData,
1757
1823
  getTreeDataPath,
1758
- groupingColDef: validationTreeData == true ? validationGroupingColDef : false,
1824
+ groupingColDef: validationTreeData == true ? groupingColDef : false,
1759
1825
  pagination: true,
1760
1826
  initialState: {
1761
1827
  pagination: { paginationModel: { pageSize: rows } }
1762
1828
  },
1763
- checkboxSelection: validationCheckboxSelection,
1829
+ checkboxSelection,
1764
1830
  rowSelectionModel: selectionModel,
1765
1831
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
1766
1832
  isRowSelectable,
1767
1833
  disableRowSelectionOnClick: true,
1768
- hideFooter: validationTreeData == true ? true : false,
1834
+ className: classes.root,
1769
1835
  localeText: {
1770
1836
  noRowsLabel: "No hay filas",
1771
1837
  columnMenuLabel: "Men\xFA de columna",
@@ -1776,36 +1842,9 @@ var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeigh
1776
1842
  labelRowsPerPage: "Filas por p\xE1gina:",
1777
1843
  labelDisplayedRows: ({ from, to, count }) => `${from}\u2013${to} de ${count !== -1 ? count : `m\xE1s de ${to}`}`
1778
1844
  }
1779
- },
1780
- sx: {
1781
- "& .MuiDataGrid-filler": {
1782
- display: "none !important"
1783
- },
1784
- "& .MuiDataGrid-footerContainer": {
1785
- minHeight: "26px !important",
1786
- height: "26px !important"
1787
- },
1788
- "& .MuiTablePagination-toolbar": {
1789
- minHeight: "25px !important",
1790
- height: "25px !important"
1791
- },
1792
- "& .MuiTablePagination-actions .MuiIconButton-root": {
1793
- padding: "0px !important"
1794
- },
1795
- "&.MuiDataGrid-root": {
1796
- [`--DataGrid-topContainerHeight`]: `${styleTopContainerHeight} !important`
1797
- },
1798
- "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
1799
- "--height": "0px !important",
1800
- "minHeight": "0px !important",
1801
- "maxHeight": "0px !important"
1802
- },
1803
- "& .MuiDataGrid-cell": {
1804
- padding: "0 !important"
1805
- }
1806
1845
  }
1807
- }
1808
- ))));
1846
+ })
1847
+ ))) : "");
1809
1848
  };
1810
1849
 
1811
1850
  // src/Components/SCAutocomplete.tsx
@@ -2026,7 +2065,7 @@ function SCAutocomplete({
2026
2065
  }
2027
2066
 
2028
2067
  // src/Theme/index.ts
2029
- var import_styles2 = require("@mui/material/styles");
2068
+ var import_styles3 = require("@mui/material/styles");
2030
2069
 
2031
2070
  // src/Theme/components.ts
2032
2071
  var import_react20 = __toESM(require("react"), 1);
@@ -3671,7 +3710,7 @@ var import_Typography = require("@mui/material/Typography");
3671
3710
  var import_Radio = require("@mui/material/Radio");
3672
3711
  var import_Chip = require("@mui/material/Chip");
3673
3712
  var import_Checkbox = require("@mui/material/Checkbox");
3674
- var import_styles = require("@mui/material/styles");
3713
+ var import_styles2 = require("@mui/material/styles");
3675
3714
 
3676
3715
  // src/Theme/typography.ts
3677
3716
  var typography = {
@@ -3842,9 +3881,9 @@ var ADCTheme = __spreadValues({
3842
3881
  }, BasicTheme);
3843
3882
 
3844
3883
  // src/Theme/index.ts
3845
- var SincoTheme = (0, import_styles2.createTheme)(__spreadValues({}, ERPTheme));
3846
- var AdproSincoTheme = (0, import_styles2.createTheme)(__spreadValues({}, ADPROTheme));
3847
- var ADCSincoTheme = (0, import_styles2.createTheme)(__spreadValues({}, ADCTheme));
3884
+ var SincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ERPTheme));
3885
+ var AdproSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADPROTheme));
3886
+ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme));
3848
3887
  // Annotate the CommonJS export names for ESM import in node:
3849
3888
  0 && (module.exports = {
3850
3889
  ADCSincoTheme,
package/dist/index.d.cts CHANGED
@@ -354,12 +354,16 @@ interface SCDataGridProps {
354
354
  rowsTable?: number;
355
355
  checkboxSelection?: boolean;
356
356
  width?: string | number;
357
- maxHeight: number;
357
+ height?: number;
358
+ maxHeight?: number;
358
359
  density?: "compact" | "standard" | "comfortable";
360
+ agrupacion?: boolean;
361
+ columnsGrouping?: number;
359
362
  groupingColDef?: any;
360
363
  getTreeDataPath?: (row: any) => string[] | [];
364
+ otherProps?: any;
361
365
  }
362
- declare const SCDataGrid: ({ data, columns, rowsTable, checkboxSelection, width, maxHeight, density, groupingColDef, getTreeDataPath, }: SCDataGridProps) => React__default.JSX.Element;
366
+ declare const SCDataGrid: ({ data, columns, rowsTable, checkboxSelection, width, height, maxHeight, density, agrupacion, groupingColDef, getTreeDataPath, ...props }: SCDataGridProps) => React__default.JSX.Element;
363
367
 
364
368
  interface SCAutocompleteProps<T> {
365
369
  label?: string;
package/dist/index.d.ts CHANGED
@@ -354,12 +354,16 @@ interface SCDataGridProps {
354
354
  rowsTable?: number;
355
355
  checkboxSelection?: boolean;
356
356
  width?: string | number;
357
- maxHeight: number;
357
+ height?: number;
358
+ maxHeight?: number;
358
359
  density?: "compact" | "standard" | "comfortable";
360
+ agrupacion?: boolean;
361
+ columnsGrouping?: number;
359
362
  groupingColDef?: any;
360
363
  getTreeDataPath?: (row: any) => string[] | [];
364
+ otherProps?: any;
361
365
  }
362
- declare const SCDataGrid: ({ data, columns, rowsTable, checkboxSelection, width, maxHeight, density, groupingColDef, getTreeDataPath, }: SCDataGridProps) => React__default.JSX.Element;
366
+ declare const SCDataGrid: ({ data, columns, rowsTable, checkboxSelection, width, height, maxHeight, density, agrupacion, groupingColDef, getTreeDataPath, ...props }: SCDataGridProps) => React__default.JSX.Element;
363
367
 
364
368
  interface SCAutocompleteProps<T> {
365
369
  label?: string;
package/dist/index.js CHANGED
@@ -1610,42 +1610,94 @@ var SCCalendarSwipeable = ({
1610
1610
  import React14, { useEffect as useEffect11, useState as useState10 } from "react";
1611
1611
  import { DataGridPro, useGridApiRef } from "@mui/x-data-grid-pro";
1612
1612
  import { LicenseInfo } from "@mui/x-license-pro";
1613
- var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeight, density, groupingColDef, getTreeDataPath }) => {
1613
+ import { makeStyles } from "@mui/styles";
1614
+ var useStyles = makeStyles({
1615
+ root: {
1616
+ "& .MuiDataGrid-filler": {
1617
+ display: "none !important"
1618
+ },
1619
+ "& .MuiDataGrid-footerContainer": {
1620
+ minHeight: "26px !important",
1621
+ height: "26px !important"
1622
+ },
1623
+ "& .MuiTablePagination-toolbar": {
1624
+ minHeight: "25px !important",
1625
+ height: "25px !important"
1626
+ },
1627
+ "& .MuiTablePagination-actions .MuiIconButton-root": {
1628
+ padding: "0px !important"
1629
+ },
1630
+ "&.MuiDataGrid-root": {
1631
+ "--DataGrid-topContainerHeight": "0px !important"
1632
+ /* Cambia este valor según tus necesidades */
1633
+ },
1634
+ "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
1635
+ "--height": "0px !important",
1636
+ "minHeight": "0px !important",
1637
+ "maxHeight": "0px !important"
1638
+ },
1639
+ "& .MuiDataGrid-cell": {
1640
+ padding: "0 !important"
1641
+ }
1642
+ }
1643
+ });
1644
+ var SCDataGrid = (_a) => {
1645
+ var _b = _a, { data, columns, rowsTable, checkboxSelection, width, height, maxHeight, density, agrupacion, groupingColDef, getTreeDataPath } = _b, props = __objRest(_b, ["data", "columns", "rowsTable", "checkboxSelection", "width", "height", "maxHeight", "density", "agrupacion", "groupingColDef", "getTreeDataPath"]);
1614
1646
  const apiRef = useGridApiRef();
1647
+ const classes = useStyles();
1615
1648
  LicenseInfo.setLicenseKey(
1616
1649
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
1617
1650
  );
1618
1651
  let validationTreeData = getTreeDataPath ? true : false;
1619
- let validationCheckboxSelection = checkboxSelection || false;
1620
- let styleDensity = density || "compact";
1621
- let styleTopContainerHeight = styleDensity === "compact" ? "26px" : styleDensity === "standard" ? "38px" : styleDensity === "comfortable" ? "60px" : "27px";
1622
- let styleRowHeight = density == "compact" ? 32 : density == "standard" ? 28 : density == "comfortable" ? 36 : 32;
1623
- let rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length) : data.length < 10 ? parseInt(data.length) : 10;
1624
- let validationGroupingColDef = groupingColDef || {};
1652
+ let paginalion = 10;
1653
+ let valor = 80;
1654
+ let alto = 345;
1655
+ let estilot = "compact";
1656
+ let tamanoEncabezado = density == "compact" ? 24 : density == "standard" ? 36 : density == "comfortable" ? 52 : 24;
1657
+ let tamanoCelda = density == "compact" ? 22 : density == "standard" ? 28 : density == "comfortable" ? 48 : 22;
1658
+ let dataConvert = [];
1625
1659
  const [groupDataLenght, setGroupDataLengh] = useState10(0);
1660
+ checkboxSelection = checkboxSelection || false;
1661
+ const rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length) : data.length < 10 ? parseInt(data.length) : 10;
1662
+ width = width || "100%";
1663
+ density = density || "compact";
1664
+ agrupacion = agrupacion || false;
1665
+ groupingColDef = groupingColDef || {};
1666
+ getTreeDataPath = getTreeDataPath || void 0;
1626
1667
  const [pageSize, setPageSize] = useState10(rows);
1627
1668
  const [arrayRows, setArrayRows] = useState10([]);
1669
+ const [heightTable, setHeightTable] = useState10(height || 0);
1628
1670
  useEffect11(() => {
1629
1671
  if ((data == null ? void 0 : data.length) > 0) {
1630
1672
  dataConvertRows(data, void 0);
1673
+ if (validationTreeData) {
1674
+ countGroupedElements(data, getTreeDataPath);
1675
+ }
1631
1676
  }
1632
1677
  }, [data]);
1678
+ useEffect11(() => {
1679
+ if (groupDataLenght > 0 && validationTreeData == true) {
1680
+ setHeightTable(heightTable ? heightTable : groupDataLenght * tamanoCelda + tamanoEncabezado + 27);
1681
+ } else if (groupDataLenght <= 0 && validationTreeData == false) {
1682
+ setHeightTable(heightTable ? heightTable : rows * tamanoCelda + tamanoEncabezado + 27);
1683
+ }
1684
+ }, [groupDataLenght]);
1633
1685
  const dataConvertRows = (data2, columnId) => {
1634
- let dataConvert = [];
1686
+ let dataConvert2 = [];
1635
1687
  if ((data2 == null ? void 0 : data2.length) > 0) {
1636
1688
  const dataKeys = Object.keys(data2[0]);
1637
1689
  data2.map((item) => {
1638
1690
  const newKeys = {};
1639
1691
  let i = 0;
1640
- let id = dataConvert.length + 1;
1692
+ let id = dataConvert2.length + 1;
1641
1693
  for (i = 0; i < dataKeys.length; i++) {
1642
1694
  newKeys[dataKeys[i]] = item[dataKeys[i]];
1643
1695
  }
1644
1696
  newKeys.id = columnId ? item[columnId] : id;
1645
- dataConvert = [...dataConvert, newKeys];
1697
+ dataConvert2 = [...dataConvert2, newKeys];
1646
1698
  });
1647
1699
  }
1648
- setArrayRows(dataConvert);
1700
+ setArrayRows(dataConvert2);
1649
1701
  };
1650
1702
  const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
1651
1703
  const [selectionModel, setSelectionModel] = useState10([]);
@@ -1685,27 +1737,41 @@ var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeigh
1685
1737
  setSelectionModel([...newSelection]);
1686
1738
  }
1687
1739
  };
1688
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, data && /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement("div", { style: { width: width || "100%", maxHeight } }, /* @__PURE__ */ React14.createElement(
1740
+ const countGroupedElements = (row, getTreeDataPath2) => {
1741
+ const groupedCounts = {};
1742
+ data.forEach((row2) => {
1743
+ const path = getTreeDataPath2(row2) || [];
1744
+ const key = path[0];
1745
+ if (!groupedCounts[key]) {
1746
+ groupedCounts[key] = 0;
1747
+ }
1748
+ groupedCounts[key]++;
1749
+ });
1750
+ setGroupDataLengh(Object.keys(groupedCounts).length);
1751
+ return groupedCounts;
1752
+ };
1753
+ const virtualScrollerHeight = validationTreeData ? groupDataLenght * tamanoCelda + 10 : rows * tamanoCelda;
1754
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, heightTable > 0 ? /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", flexDirection: "column", width, maxHeight } }, /* @__PURE__ */ React14.createElement(
1689
1755
  DataGridPro,
1690
- {
1691
- apiRef,
1692
- rowHeight: styleRowHeight,
1756
+ __spreadProps(__spreadValues({
1757
+ apiRef
1758
+ }, props), {
1693
1759
  rows: arrayRows,
1694
1760
  columns,
1695
- density: styleDensity,
1761
+ density,
1696
1762
  treeData: validationTreeData,
1697
1763
  getTreeDataPath,
1698
- groupingColDef: validationTreeData == true ? validationGroupingColDef : false,
1764
+ groupingColDef: validationTreeData == true ? groupingColDef : false,
1699
1765
  pagination: true,
1700
1766
  initialState: {
1701
1767
  pagination: { paginationModel: { pageSize: rows } }
1702
1768
  },
1703
- checkboxSelection: validationCheckboxSelection,
1769
+ checkboxSelection,
1704
1770
  rowSelectionModel: selectionModel,
1705
1771
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
1706
1772
  isRowSelectable,
1707
1773
  disableRowSelectionOnClick: true,
1708
- hideFooter: validationTreeData == true ? true : false,
1774
+ className: classes.root,
1709
1775
  localeText: {
1710
1776
  noRowsLabel: "No hay filas",
1711
1777
  columnMenuLabel: "Men\xFA de columna",
@@ -1716,36 +1782,9 @@ var SCDataGrid = ({ data, columns, rowsTable, checkboxSelection, width, maxHeigh
1716
1782
  labelRowsPerPage: "Filas por p\xE1gina:",
1717
1783
  labelDisplayedRows: ({ from, to, count }) => `${from}\u2013${to} de ${count !== -1 ? count : `m\xE1s de ${to}`}`
1718
1784
  }
1719
- },
1720
- sx: {
1721
- "& .MuiDataGrid-filler": {
1722
- display: "none !important"
1723
- },
1724
- "& .MuiDataGrid-footerContainer": {
1725
- minHeight: "26px !important",
1726
- height: "26px !important"
1727
- },
1728
- "& .MuiTablePagination-toolbar": {
1729
- minHeight: "25px !important",
1730
- height: "25px !important"
1731
- },
1732
- "& .MuiTablePagination-actions .MuiIconButton-root": {
1733
- padding: "0px !important"
1734
- },
1735
- "&.MuiDataGrid-root": {
1736
- [`--DataGrid-topContainerHeight`]: `${styleTopContainerHeight} !important`
1737
- },
1738
- "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
1739
- "--height": "0px !important",
1740
- "minHeight": "0px !important",
1741
- "maxHeight": "0px !important"
1742
- },
1743
- "& .MuiDataGrid-cell": {
1744
- padding: "0 !important"
1745
- }
1746
1785
  }
1747
- }
1748
- ))));
1786
+ })
1787
+ ))) : "");
1749
1788
  };
1750
1789
 
1751
1790
  // src/Components/SCAutocomplete.tsx