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.cjs CHANGED
@@ -1792,14 +1792,15 @@ var import_icons_material8 = require("@mui/icons-material");
1792
1792
  var Muicon4 = __toESM(require("@mui/icons-material"), 1);
1793
1793
  var StopEvent = ({ children }) => {
1794
1794
  return /* @__PURE__ */ import_react15.default.createElement(
1795
- "span",
1795
+ import_material9.Box,
1796
1796
  {
1797
1797
  onMouseDown: (e) => {
1798
1798
  e.preventDefault();
1799
1799
  e.stopPropagation();
1800
1800
  },
1801
1801
  onClick: (e) => e.stopPropagation(),
1802
- style: { display: "inline-flex", alignItems: "center" }
1802
+ display: "inline-flex",
1803
+ alignItems: "center"
1803
1804
  },
1804
1805
  children
1805
1806
  );
@@ -1855,15 +1856,16 @@ function SCAutocomplete({
1855
1856
  setIsUserTyping(false);
1856
1857
  }
1857
1858
  }, [inputValue]);
1858
- data.map(function(option) {
1859
- if (option == null ? void 0 : option.icon) {
1860
- if ((option == null ? void 0 : option.icon.type) == void 0) {
1861
- option.icon = Muicon4[option == null ? void 0 : option.icon];
1862
- } else {
1863
- option;
1859
+ const normalizedData = (0, import_react15.useMemo)(() => {
1860
+ return data.map((option) => {
1861
+ if ((option == null ? void 0 : option.icon) && option.icon.type === void 0) {
1862
+ return __spreadProps(__spreadValues({}, option), {
1863
+ icon: Muicon4[option.icon]
1864
+ });
1864
1865
  }
1865
- }
1866
- });
1866
+ return option;
1867
+ });
1868
+ }, [data]);
1867
1869
  const cleanOptions = (event2) => {
1868
1870
  setState({ hiddenValue: "-1", textValue: "" });
1869
1871
  setSelectedOptions([]);
@@ -1909,15 +1911,17 @@ function SCAutocomplete({
1909
1911
  (item) => getItemValue(item).value === state.hiddenValue
1910
1912
  ) || null;
1911
1913
  const [open, setOpen] = import_react15.default.useState(false);
1912
- const hayOnComponentClickGlobal = import_react15.default.useMemo(() => {
1913
- return data.some((opt) => Boolean(getItemValue(opt).onComponentClick));
1914
+ const hayOnComponentClickGlobal = (0, import_react15.useMemo)(() => {
1915
+ return data.some((opt) => {
1916
+ const item = getItemValue(opt);
1917
+ return Boolean(item.onComponentClick);
1918
+ });
1914
1919
  }, [data]);
1915
1920
  return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, data && /* @__PURE__ */ import_react15.default.createElement(
1916
1921
  import_material9.Autocomplete,
1917
- __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
1922
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
1918
1923
  onClose: (event2, reason) => {
1919
- debugger;
1920
- if (reason === "blur") return;
1924
+ if (["blur", "selectOption"].includes(reason)) return;
1921
1925
  setOpen(false);
1922
1926
  }
1923
1927
  } : {}), {
@@ -1925,7 +1929,7 @@ function SCAutocomplete({
1925
1929
  clearOnEscape: true,
1926
1930
  noOptionsText: "No se encuentra",
1927
1931
  disabled,
1928
- options: data,
1932
+ options: normalizedData,
1929
1933
  isOptionEqualToValue: (option, value) => getItemValue(option).value === getItemValue(value).value,
1930
1934
  onInputChange: (event2, value) => {
1931
1935
  setInputValue(value);
@@ -2005,6 +2009,8 @@ function SCAutocomplete({
2005
2009
  {
2006
2010
  onClick: (e) => {
2007
2011
  var _a2;
2012
+ e.preventDefault();
2013
+ e.stopPropagation();
2008
2014
  (_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, e, option);
2009
2015
  }
2010
2016
  },
@@ -3127,7 +3133,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3127
3133
  const [selectionModel, setSelectionModel] = (0, import_react27.useState)([]);
3128
3134
  (0, import_react27.useEffect)(() => {
3129
3135
  var _a;
3130
- debugger;
3131
3136
  if (setSelectedRow) {
3132
3137
  setSelectedRow(arrayRows[selectedIndex]);
3133
3138
  setSelectionModel(((_a = arrayRows[selectedIndex]) == null ? void 0 : _a.id) ? [arrayRows[selectedIndex].id] : []);
@@ -3154,7 +3159,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3154
3159
  dataConvert = [...dataConvert, newKeys];
3155
3160
  });
3156
3161
  }
3157
- debugger;
3158
3162
  setArrayRows(dataConvert);
3159
3163
  if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
3160
3164
  setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
@@ -3162,7 +3166,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3162
3166
  }
3163
3167
  };
3164
3168
  const handleSelectionChange = (newSelection) => {
3165
- debugger;
3166
3169
  if (groupDataLenght > 0 && validationTreeData == true) {
3167
3170
  let numberGrouped = 0;
3168
3171
  let idsRowSelectBefore = [];
@@ -3183,7 +3186,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3183
3186
  }
3184
3187
  }
3185
3188
  });
3186
- debugger;
3187
3189
  if (idRowSelect !== null) {
3188
3190
  const soloEnArr1 = idsRowSelectBefore.filter((elemento) => !idRowSelect.includes(elemento));
3189
3191
  const hasCommonElements = idsRowSelectBefore.some((element) => idRowSelect.includes(element));
@@ -3194,7 +3196,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
3194
3196
  }
3195
3197
  }
3196
3198
  } else {
3197
- debugger;
3198
3199
  setSelectionModel([...newSelection]);
3199
3200
  const selectedId = newSelection[0];
3200
3201
  const index = arrayRows.findIndex((row) => row.id === selectedId);