componentes-sinco 1.1.19 → 1.1.21

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.js CHANGED
@@ -1704,20 +1704,21 @@ function SCSelect({
1704
1704
  }
1705
1705
 
1706
1706
  // src/Components/SCAutocomplete.tsx
1707
- import React11, { useEffect as useEffect10 } from "react";
1707
+ import React11, { useEffect as useEffect10, useMemo as useMemo3 } from "react";
1708
1708
  import { Autocomplete, Checkbox, InputAdornment as InputAdornment3, MenuItem as MenuItem2, TextField as TextField3, Typography as Typography7, SvgIcon as SvgIcon4, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Divider as Divider3, FormControlLabel as FormControlLabel2, IconButton as IconButton7, Chip as Chip3, Box as Box8, Button as Button6, Grid as Grid3 } from "@mui/material";
1709
1709
  import { Search, Clear } from "@mui/icons-material";
1710
1710
  import * as Muicon4 from "@mui/icons-material";
1711
1711
  var StopEvent = ({ children }) => {
1712
1712
  return /* @__PURE__ */ React11.createElement(
1713
- "span",
1713
+ Box8,
1714
1714
  {
1715
1715
  onMouseDown: (e) => {
1716
1716
  e.preventDefault();
1717
1717
  e.stopPropagation();
1718
1718
  },
1719
1719
  onClick: (e) => e.stopPropagation(),
1720
- style: { display: "inline-flex", alignItems: "center" }
1720
+ display: "inline-flex",
1721
+ alignItems: "center"
1721
1722
  },
1722
1723
  children
1723
1724
  );
@@ -1773,15 +1774,16 @@ function SCAutocomplete({
1773
1774
  setIsUserTyping(false);
1774
1775
  }
1775
1776
  }, [inputValue]);
1776
- data.map(function(option) {
1777
- if (option == null ? void 0 : option.icon) {
1778
- if ((option == null ? void 0 : option.icon.type) == void 0) {
1779
- option.icon = Muicon4[option == null ? void 0 : option.icon];
1780
- } else {
1781
- option;
1777
+ const normalizedData = useMemo3(() => {
1778
+ return data.map((option) => {
1779
+ if ((option == null ? void 0 : option.icon) && option.icon.type === void 0) {
1780
+ return __spreadProps(__spreadValues({}, option), {
1781
+ icon: Muicon4[option.icon]
1782
+ });
1782
1783
  }
1783
- }
1784
- });
1784
+ return option;
1785
+ });
1786
+ }, [data]);
1785
1787
  const cleanOptions = (event2) => {
1786
1788
  setState({ hiddenValue: "-1", textValue: "" });
1787
1789
  setSelectedOptions([]);
@@ -1827,15 +1829,17 @@ function SCAutocomplete({
1827
1829
  (item) => getItemValue(item).value === state.hiddenValue
1828
1830
  ) || null;
1829
1831
  const [open, setOpen] = React11.useState(false);
1830
- const hayOnComponentClickGlobal = React11.useMemo(() => {
1831
- return data.some((opt) => Boolean(getItemValue(opt).onComponentClick));
1832
+ const hayOnComponentClickGlobal = useMemo3(() => {
1833
+ return data.some((opt) => {
1834
+ const item = getItemValue(opt);
1835
+ return Boolean(item.onComponentClick);
1836
+ });
1832
1837
  }, [data]);
1833
1838
  return /* @__PURE__ */ React11.createElement(React11.Fragment, null, data && /* @__PURE__ */ React11.createElement(
1834
1839
  Autocomplete,
1835
- __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
1840
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
1836
1841
  onClose: (event2, reason) => {
1837
- debugger;
1838
- if (reason === "blur") return;
1842
+ if (["blur", "selectOption"].includes(reason)) return;
1839
1843
  setOpen(false);
1840
1844
  }
1841
1845
  } : {}), {
@@ -1843,7 +1847,7 @@ function SCAutocomplete({
1843
1847
  clearOnEscape: true,
1844
1848
  noOptionsText: "No se encuentra",
1845
1849
  disabled,
1846
- options: data,
1850
+ options: normalizedData,
1847
1851
  isOptionEqualToValue: (option, value) => getItemValue(option).value === getItemValue(value).value,
1848
1852
  onInputChange: (event2, value) => {
1849
1853
  setInputValue(value);
@@ -1923,6 +1927,8 @@ function SCAutocomplete({
1923
1927
  {
1924
1928
  onClick: (e) => {
1925
1929
  var _a2;
1930
+ e.preventDefault();
1931
+ e.stopPropagation();
1926
1932
  (_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, e, option);
1927
1933
  }
1928
1934
  },
@@ -2566,7 +2572,7 @@ var FooterAction = ({
2566
2572
  };
2567
2573
 
2568
2574
  // src/Components/MultiSelect/MultiSelect.tsx
2569
- import React18, { useEffect as useEffect11, useMemo as useMemo4 } from "react";
2575
+ import React18, { useEffect as useEffect11, useMemo as useMemo5 } from "react";
2570
2576
  import { Button as Button9, Checkbox as Checkbox2, FormControl as FormControl3, InputAdornment as InputAdornment5, ListItemIcon as ListItemIcon3, MenuItem as MenuItem3, Popover as Popover3, Stack as Stack7, TextField as TextField4 } from "@mui/material";
2571
2577
  import { SearchOutlined } from "@mui/icons-material";
2572
2578
 
@@ -2618,15 +2624,15 @@ function getIconMultiSelect(name) {
2618
2624
  }
2619
2625
 
2620
2626
  // src/Components/MultiSelect/helpers/useFilteredItems.tsx
2621
- import { useMemo as useMemo3 } from "react";
2627
+ import { useMemo as useMemo4 } from "react";
2622
2628
  function useFilteredItems(items, filterValue, getItemLabel, selectedItems) {
2623
- const filteredItems = useMemo3(
2629
+ const filteredItems = useMemo4(
2624
2630
  () => items.filter(
2625
2631
  (item) => getItemLabel(item).toLowerCase().includes(filterValue.toLowerCase())
2626
2632
  ),
2627
2633
  [items, filterValue, getItemLabel]
2628
2634
  );
2629
- const sortedItems = useMemo3(() => {
2635
+ const sortedItems = useMemo4(() => {
2630
2636
  return [
2631
2637
  ...filteredItems.filter((item) => selectedItems.includes(item)),
2632
2638
  ...filteredItems.filter((item) => !selectedItems.includes(item))
@@ -2669,7 +2675,7 @@ function MultiSelect({
2669
2675
  setSelectedItems([]);
2670
2676
  }, [items, setSelectedItems]);
2671
2677
  const { filteredItems, sortedItems } = useFilteredItems(items, filterValue, getItemLabel, selectedItems);
2672
- const Icon = useMemo4(() => {
2678
+ const Icon = useMemo5(() => {
2673
2679
  var _a2;
2674
2680
  return getIconMultiSelect((_a2 = button == null ? void 0 : button.icon) != null ? _a2 : "FilterListOutlined");
2675
2681
  }, [button == null ? void 0 : button.icon]);
@@ -3045,7 +3051,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3045
3051
  const [selectionModel, setSelectionModel] = useState13([]);
3046
3052
  useEffect13(() => {
3047
3053
  var _a;
3048
- debugger;
3049
3054
  if (setSelectedRow) {
3050
3055
  setSelectedRow(arrayRows[selectedIndex]);
3051
3056
  setSelectionModel(((_a = arrayRows[selectedIndex]) == null ? void 0 : _a.id) ? [arrayRows[selectedIndex].id] : []);
@@ -3072,7 +3077,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3072
3077
  dataConvert = [...dataConvert, newKeys];
3073
3078
  });
3074
3079
  }
3075
- debugger;
3076
3080
  setArrayRows(dataConvert);
3077
3081
  if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
3078
3082
  setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
@@ -3080,7 +3084,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3080
3084
  }
3081
3085
  };
3082
3086
  const handleSelectionChange = (newSelection) => {
3083
- debugger;
3084
3087
  if (groupDataLenght > 0 && validationTreeData == true) {
3085
3088
  let numberGrouped = 0;
3086
3089
  let idsRowSelectBefore = [];
@@ -3101,7 +3104,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3101
3104
  }
3102
3105
  }
3103
3106
  });
3104
- debugger;
3105
3107
  if (idRowSelect !== null) {
3106
3108
  const soloEnArr1 = idsRowSelectBefore.filter((elemento) => !idRowSelect.includes(elemento));
3107
3109
  const hasCommonElements = idsRowSelectBefore.some((element) => idRowSelect.includes(element));
@@ -3112,7 +3114,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3112
3114
  }
3113
3115
  }
3114
3116
  } else {
3115
- debugger;
3116
3117
  setSelectionModel([...newSelection]);
3117
3118
  const selectedId = newSelection[0];
3118
3119
  const index = arrayRows.findIndex((row) => row.id === selectedId);
@@ -5066,7 +5067,7 @@ import React44, { useEffect as useEffect21, useRef as useRef8, useState as useSt
5066
5067
  import Webcam from "react-webcam";
5067
5068
 
5068
5069
  // src/Components/Adjuntar/mobile/components/button.tsx
5069
- import React43, { useMemo as useMemo5 } from "react";
5070
+ import React43, { useMemo as useMemo6 } from "react";
5070
5071
  import { Button as Button18 } from "@mui/material";
5071
5072
 
5072
5073
  // src/Components/Adjuntar/mobile/components/Utils.tsx
@@ -5092,7 +5093,7 @@ var AttachmentButton = ({ buttonAttachment, open, setOpen }) => {
5092
5093
  setOpen(!open);
5093
5094
  }
5094
5095
  };
5095
- const Icon = useMemo5(
5096
+ const Icon = useMemo6(
5096
5097
  () => getAttachmentIcon(buttonAttachment == null ? void 0 : buttonAttachment.icon),
5097
5098
  [buttonAttachment == null ? void 0 : buttonAttachment.icon]
5098
5099
  );