componentes-sinco 1.1.18 → 1.1.20
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 +61 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +68 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -113,6 +113,7 @@ __export(index_exports, {
|
|
|
113
113
|
SCTime: () => SCTime,
|
|
114
114
|
SCToastNotification: () => SCToastNotification,
|
|
115
115
|
SincoTheme: () => SincoTheme,
|
|
116
|
+
StopEvent: () => StopEvent,
|
|
116
117
|
ToastProgress: () => ToastProgress,
|
|
117
118
|
capitalize: () => capitalize,
|
|
118
119
|
clampEventToVisibleRange: () => clampEventToVisibleRange,
|
|
@@ -1789,6 +1790,21 @@ var import_react15 = __toESM(require("react"), 1);
|
|
|
1789
1790
|
var import_material9 = require("@mui/material");
|
|
1790
1791
|
var import_icons_material8 = require("@mui/icons-material");
|
|
1791
1792
|
var Muicon4 = __toESM(require("@mui/icons-material"), 1);
|
|
1793
|
+
var StopEvent = ({ children }) => {
|
|
1794
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
1795
|
+
import_material9.Box,
|
|
1796
|
+
{
|
|
1797
|
+
onMouseDown: (e) => {
|
|
1798
|
+
e.preventDefault();
|
|
1799
|
+
e.stopPropagation();
|
|
1800
|
+
},
|
|
1801
|
+
onClick: (e) => e.stopPropagation(),
|
|
1802
|
+
display: "inline-flex",
|
|
1803
|
+
alignItems: "center"
|
|
1804
|
+
},
|
|
1805
|
+
children
|
|
1806
|
+
);
|
|
1807
|
+
};
|
|
1792
1808
|
function SCAutocomplete({
|
|
1793
1809
|
label = "",
|
|
1794
1810
|
data,
|
|
@@ -1840,15 +1856,16 @@ function SCAutocomplete({
|
|
|
1840
1856
|
setIsUserTyping(false);
|
|
1841
1857
|
}
|
|
1842
1858
|
}, [inputValue]);
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
if ((option == null ? void 0 : option.icon.type
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
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
|
+
});
|
|
1849
1865
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1866
|
+
return option;
|
|
1867
|
+
});
|
|
1868
|
+
}, [data]);
|
|
1852
1869
|
const cleanOptions = (event2) => {
|
|
1853
1870
|
setState({ hiddenValue: "-1", textValue: "" });
|
|
1854
1871
|
setSelectedOptions([]);
|
|
@@ -1893,14 +1910,26 @@ function SCAutocomplete({
|
|
|
1893
1910
|
const selectedValue = typeFormat === "multiselect" ? selectedOptions : originalData.find(
|
|
1894
1911
|
(item) => getItemValue(item).value === state.hiddenValue
|
|
1895
1912
|
) || null;
|
|
1913
|
+
const [open, setOpen] = import_react15.default.useState(false);
|
|
1914
|
+
const hayOnComponentClickGlobal = (0, import_react15.useMemo)(() => {
|
|
1915
|
+
return data.some((opt) => {
|
|
1916
|
+
const item = getItemValue(opt);
|
|
1917
|
+
return Boolean(item.onComponentClick);
|
|
1918
|
+
});
|
|
1919
|
+
}, [data]);
|
|
1896
1920
|
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, data && /* @__PURE__ */ import_react15.default.createElement(
|
|
1897
1921
|
import_material9.Autocomplete,
|
|
1898
|
-
{
|
|
1922
|
+
__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
|
|
1923
|
+
onClose: (event2, reason) => {
|
|
1924
|
+
if (reason === "blur") return;
|
|
1925
|
+
setOpen(false);
|
|
1926
|
+
}
|
|
1927
|
+
} : {}), {
|
|
1899
1928
|
multiple: typeFormat === "multiselect",
|
|
1900
1929
|
clearOnEscape: true,
|
|
1901
1930
|
noOptionsText: "No se encuentra",
|
|
1902
1931
|
disabled,
|
|
1903
|
-
options:
|
|
1932
|
+
options: normalizedData,
|
|
1904
1933
|
isOptionEqualToValue: (option, value) => getItemValue(option).value === getItemValue(value).value,
|
|
1905
1934
|
onInputChange: (event2, value) => {
|
|
1906
1935
|
setInputValue(value);
|
|
@@ -1952,9 +1981,11 @@ function SCAutocomplete({
|
|
|
1952
1981
|
isValid = group == option[columnGroup];
|
|
1953
1982
|
group = option[columnGroup];
|
|
1954
1983
|
}
|
|
1984
|
+
const item = getItemValue(option);
|
|
1955
1985
|
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, { key }, columnGroup ? !isValid ? /* @__PURE__ */ import_react15.default.createElement(import_material9.Typography, { color: "text.secondary", sx: { margin: "7px 16px !important", fontSize: "13px !important" } }, option[columnGroup]) : "" : "", /* @__PURE__ */ import_react15.default.createElement(
|
|
1956
1986
|
import_material9.MenuItem,
|
|
1957
1987
|
__spreadProps(__spreadValues({}, optionProps), {
|
|
1988
|
+
component: "li",
|
|
1958
1989
|
disabled: isDisabled,
|
|
1959
1990
|
style: {
|
|
1960
1991
|
//background: typeFormat != "multiselect" ? state.hiddenValue == getItemValue(option).value ? "#be308fff" : 'white' : 'white',
|
|
@@ -1973,7 +2004,16 @@ function SCAutocomplete({
|
|
|
1973
2004
|
}
|
|
1974
2005
|
) : "",
|
|
1975
2006
|
/* @__PURE__ */ import_react15.default.createElement(import_material9.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }),
|
|
1976
|
-
|
|
2007
|
+
item.component != null ? /* @__PURE__ */ import_react15.default.createElement(StopEvent, null, /* @__PURE__ */ import_react15.default.createElement(
|
|
2008
|
+
"span",
|
|
2009
|
+
{
|
|
2010
|
+
onClick: (e) => {
|
|
2011
|
+
var _a2;
|
|
2012
|
+
(_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, e, option);
|
|
2013
|
+
}
|
|
2014
|
+
},
|
|
2015
|
+
item.component
|
|
2016
|
+
)) : null
|
|
1977
2017
|
)));
|
|
1978
2018
|
},
|
|
1979
2019
|
renderInput: (params) => /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(
|
|
@@ -2052,7 +2092,7 @@ function SCAutocomplete({
|
|
|
2052
2092
|
})
|
|
2053
2093
|
}
|
|
2054
2094
|
}
|
|
2055
|
-
}
|
|
2095
|
+
})
|
|
2056
2096
|
));
|
|
2057
2097
|
}
|
|
2058
2098
|
|
|
@@ -2371,7 +2411,7 @@ var DrawerHeader = ({
|
|
|
2371
2411
|
alignContent: "center"
|
|
2372
2412
|
}
|
|
2373
2413
|
},
|
|
2374
|
-
/* @__PURE__ */ import_react19.default.createElement(import_material13.Typography, { variant: "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"),
|
|
2414
|
+
/* @__PURE__ */ import_react19.default.createElement(import_material13.Typography, { variant: filterSideCard ? "body2" : "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"),
|
|
2375
2415
|
filterSideCard ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, filterSideCard) : /* @__PURE__ */ import_react19.default.createElement(import_material13.IconButton, { onClick: onClose }, /* @__PURE__ */ import_react19.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))
|
|
2376
2416
|
);
|
|
2377
2417
|
};
|
|
@@ -3091,7 +3131,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
|
|
|
3091
3131
|
const [selectionModel, setSelectionModel] = (0, import_react27.useState)([]);
|
|
3092
3132
|
(0, import_react27.useEffect)(() => {
|
|
3093
3133
|
var _a;
|
|
3094
|
-
debugger;
|
|
3095
3134
|
if (setSelectedRow) {
|
|
3096
3135
|
setSelectedRow(arrayRows[selectedIndex]);
|
|
3097
3136
|
setSelectionModel(((_a = arrayRows[selectedIndex]) == null ? void 0 : _a.id) ? [arrayRows[selectedIndex].id] : []);
|
|
@@ -3118,7 +3157,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
|
|
|
3118
3157
|
dataConvert = [...dataConvert, newKeys];
|
|
3119
3158
|
});
|
|
3120
3159
|
}
|
|
3121
|
-
debugger;
|
|
3122
3160
|
setArrayRows(dataConvert);
|
|
3123
3161
|
if (arrayRows.length == 0 && (groupDataLenght < 1 && validationTreeData != true)) {
|
|
3124
3162
|
setSelectedRow && setSelectedRow(dataConvert[selectedIndex]);
|
|
@@ -3126,7 +3164,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
|
|
|
3126
3164
|
}
|
|
3127
3165
|
};
|
|
3128
3166
|
const handleSelectionChange = (newSelection) => {
|
|
3129
|
-
debugger;
|
|
3130
3167
|
if (groupDataLenght > 0 && validationTreeData == true) {
|
|
3131
3168
|
let numberGrouped = 0;
|
|
3132
3169
|
let idsRowSelectBefore = [];
|
|
@@ -3147,7 +3184,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
|
|
|
3147
3184
|
}
|
|
3148
3185
|
}
|
|
3149
3186
|
});
|
|
3150
|
-
debugger;
|
|
3151
3187
|
if (idRowSelect !== null) {
|
|
3152
3188
|
const soloEnArr1 = idsRowSelectBefore.filter((elemento) => !idRowSelect.includes(elemento));
|
|
3153
3189
|
const hasCommonElements = idsRowSelectBefore.some((element) => idRowSelect.includes(element));
|
|
@@ -3158,7 +3194,6 @@ function SCDataGridInitial({ data, columns, getRowId, groupColumns, rowsTable, r
|
|
|
3158
3194
|
}
|
|
3159
3195
|
}
|
|
3160
3196
|
} else {
|
|
3161
|
-
debugger;
|
|
3162
3197
|
setSelectionModel([...newSelection]);
|
|
3163
3198
|
const selectedId = newSelection[0];
|
|
3164
3199
|
const index = arrayRows.findIndex((row) => row.id === selectedId);
|
|
@@ -5697,11 +5732,17 @@ var SCDatePicker = ({ label, required, disabled, background, state, setState, wi
|
|
|
5697
5732
|
minDate: (0, import_dayjs11.default)("2015-01-01"),
|
|
5698
5733
|
maxDate: (0, import_dayjs11.default)().add(3, "month"),
|
|
5699
5734
|
sx: {
|
|
5700
|
-
minWidth:
|
|
5735
|
+
minWidth: 120,
|
|
5701
5736
|
width: width || "100%",
|
|
5702
5737
|
background: background || "transparent",
|
|
5703
5738
|
"& .MuiPickersInputBase-sectionsContainer": {
|
|
5704
5739
|
padding: "6px 0px"
|
|
5740
|
+
},
|
|
5741
|
+
"& .MuiPickersOutlinedInput-root": {
|
|
5742
|
+
padding: "0px 10px !important"
|
|
5743
|
+
},
|
|
5744
|
+
"& .MuiIconButton-root": {
|
|
5745
|
+
padding: "0px 8px 0px 0px !important"
|
|
5705
5746
|
}
|
|
5706
5747
|
},
|
|
5707
5748
|
slotProps: {
|
|
@@ -7502,6 +7543,7 @@ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme)
|
|
|
7502
7543
|
SCTime,
|
|
7503
7544
|
SCToastNotification,
|
|
7504
7545
|
SincoTheme,
|
|
7546
|
+
StopEvent,
|
|
7505
7547
|
ToastProgress,
|
|
7506
7548
|
capitalize,
|
|
7507
7549
|
clampEventToVisibleRange,
|