componentes-sinco 1.1.20 → 1.1.22
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 +90 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1798,7 +1798,10 @@ var StopEvent = ({ children }) => {
|
|
|
1798
1798
|
e.preventDefault();
|
|
1799
1799
|
e.stopPropagation();
|
|
1800
1800
|
},
|
|
1801
|
-
onClick: (e) =>
|
|
1801
|
+
onClick: (e) => {
|
|
1802
|
+
e.preventDefault();
|
|
1803
|
+
e.stopPropagation();
|
|
1804
|
+
},
|
|
1802
1805
|
display: "inline-flex",
|
|
1803
1806
|
alignItems: "center"
|
|
1804
1807
|
},
|
|
@@ -1911,17 +1914,19 @@ function SCAutocomplete({
|
|
|
1911
1914
|
(item) => getItemValue(item).value === state.hiddenValue
|
|
1912
1915
|
) || null;
|
|
1913
1916
|
const [open, setOpen] = import_react15.default.useState(false);
|
|
1917
|
+
const componentClickActiveRef = import_react15.default.useRef(false);
|
|
1914
1918
|
const hayOnComponentClickGlobal = (0, import_react15.useMemo)(() => {
|
|
1915
1919
|
return data.some((opt) => {
|
|
1916
1920
|
const item = getItemValue(opt);
|
|
1917
1921
|
return Boolean(item.onComponentClick);
|
|
1918
1922
|
});
|
|
1919
|
-
}, [data]);
|
|
1923
|
+
}, [data, getItemValue]);
|
|
1920
1924
|
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, data && /* @__PURE__ */ import_react15.default.createElement(
|
|
1921
1925
|
import_material9.Autocomplete,
|
|
1922
1926
|
__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, hayOnComponentClickGlobal ? { disableCloseOnSelect: true } : {}), hayOnComponentClickGlobal ? { blurOnSelect: false } : {}), hayOnComponentClickGlobal ? { open } : {}), hayOnComponentClickGlobal ? { onOpen: () => setOpen(true) } : {}), hayOnComponentClickGlobal ? {
|
|
1923
1927
|
onClose: (event2, reason) => {
|
|
1924
|
-
if (
|
|
1928
|
+
if (componentClickActiveRef.current) return;
|
|
1929
|
+
if (reason === "selectOption") return;
|
|
1925
1930
|
setOpen(false);
|
|
1926
1931
|
}
|
|
1927
1932
|
} : {}), {
|
|
@@ -2007,9 +2012,22 @@ function SCAutocomplete({
|
|
|
2007
2012
|
item.component != null ? /* @__PURE__ */ import_react15.default.createElement(StopEvent, null, /* @__PURE__ */ import_react15.default.createElement(
|
|
2008
2013
|
"span",
|
|
2009
2014
|
{
|
|
2010
|
-
|
|
2015
|
+
onMouseDown: (event2) => {
|
|
2016
|
+
componentClickActiveRef.current = true;
|
|
2017
|
+
event2.preventDefault();
|
|
2018
|
+
event2.stopPropagation();
|
|
2019
|
+
event2.defaultMuiPrevented = true;
|
|
2020
|
+
},
|
|
2021
|
+
onClick: (event2) => {
|
|
2011
2022
|
var _a2;
|
|
2012
|
-
|
|
2023
|
+
event2.preventDefault();
|
|
2024
|
+
event2.stopPropagation();
|
|
2025
|
+
event2.defaultMuiPrevented = true;
|
|
2026
|
+
(_a2 = item.onComponentClick) == null ? void 0 : _a2.call(item, event2, option);
|
|
2027
|
+
setOpen(true);
|
|
2028
|
+
setTimeout(() => {
|
|
2029
|
+
componentClickActiveRef.current = false;
|
|
2030
|
+
}, 200);
|
|
2013
2031
|
}
|
|
2014
2032
|
},
|
|
2015
2033
|
item.component
|
|
@@ -5007,6 +5025,11 @@ var import_KeyboardDoubleArrowDown2 = __toESM(require("@mui/icons-material/Keybo
|
|
|
5007
5025
|
var import_KeyboardDoubleArrowUp2 = __toESM(require("@mui/icons-material/KeyboardDoubleArrowUp"), 1);
|
|
5008
5026
|
var import_ArrowForward = __toESM(require("@mui/icons-material/ArrowForward"), 1);
|
|
5009
5027
|
var import_LightModeOutlined = __toESM(require("@mui/icons-material/LightModeOutlined"), 1);
|
|
5028
|
+
var import_FilterList = __toESM(require("@mui/icons-material/FilterList"), 1);
|
|
5029
|
+
var import_CalendarMonthOutlined = __toESM(require("@mui/icons-material/CalendarMonthOutlined"), 1);
|
|
5030
|
+
var import_CheckCircleOutlineOutlined = __toESM(require("@mui/icons-material/CheckCircleOutlineOutlined"), 1);
|
|
5031
|
+
var import_EventBusyOutlined = __toESM(require("@mui/icons-material/EventBusyOutlined"), 1);
|
|
5032
|
+
var import_PendingOutlined = __toESM(require("@mui/icons-material/PendingOutlined"), 1);
|
|
5010
5033
|
var SCActivityCalendar = ({
|
|
5011
5034
|
//informativas
|
|
5012
5035
|
//apariencia
|
|
@@ -5023,6 +5046,11 @@ var SCActivityCalendar = ({
|
|
|
5023
5046
|
const [fechaSeleccionada, setFechaSeleccionada] = (0, import_react50.useState)();
|
|
5024
5047
|
const [stateVal, setstateVal] = import_react50.default.useState(/* @__PURE__ */ new Date());
|
|
5025
5048
|
const [openCalendar, setOpenCalendar] = import_react50.default.useState(false);
|
|
5049
|
+
const [anchorPopoverFiltro, setAnchorPopoverFiltro] = (0, import_react50.useState)(null);
|
|
5050
|
+
const [datosEventos, setDatosEventos] = import_react50.default.useState(events);
|
|
5051
|
+
console.log("eventos", events);
|
|
5052
|
+
console.log("datosEventos", datosEventos);
|
|
5053
|
+
const openPopoverFiltro = Boolean(anchorPopoverFiltro);
|
|
5026
5054
|
const hoy = /* @__PURE__ */ new Date();
|
|
5027
5055
|
const inicioSemana = (0, import_date_fns2.startOfWeek)(fecha, { weekStartsOn: 0 });
|
|
5028
5056
|
const diasSemana = Array.from({ length: 7 }, (_, i) => (0, import_date_fns2.addDays)(inicioSemana, i));
|
|
@@ -5031,6 +5059,11 @@ var SCActivityCalendar = ({
|
|
|
5031
5059
|
handleConvertFecha(fecha);
|
|
5032
5060
|
}
|
|
5033
5061
|
}, [fecha]);
|
|
5062
|
+
import_react50.default.useEffect(() => {
|
|
5063
|
+
if (events != null) {
|
|
5064
|
+
setDatosEventos(events);
|
|
5065
|
+
}
|
|
5066
|
+
}, [events]);
|
|
5034
5067
|
const handleConvertFecha = (fecha2) => {
|
|
5035
5068
|
if (fecha2) {
|
|
5036
5069
|
let day = (fecha2.getDate() < 10 ? "0" : "") + fecha2.getDate();
|
|
@@ -5050,6 +5083,22 @@ var SCActivityCalendar = ({
|
|
|
5050
5083
|
// 0 = domingo, 1 = lunes
|
|
5051
5084
|
})
|
|
5052
5085
|
});
|
|
5086
|
+
const handleClickPopoverFiltro = (event2) => {
|
|
5087
|
+
setAnchorPopoverFiltro(event2.currentTarget);
|
|
5088
|
+
};
|
|
5089
|
+
const handleClosePopoverFiltro = () => {
|
|
5090
|
+
setAnchorPopoverFiltro(null);
|
|
5091
|
+
};
|
|
5092
|
+
const filtrarActividad = (event2, filtro) => {
|
|
5093
|
+
if (filtro === "Todo") {
|
|
5094
|
+
setDatosEventos(events);
|
|
5095
|
+
} else {
|
|
5096
|
+
const resultado = events.filter(
|
|
5097
|
+
(item) => item.state === filtro
|
|
5098
|
+
);
|
|
5099
|
+
setDatosEventos(resultado);
|
|
5100
|
+
}
|
|
5101
|
+
};
|
|
5053
5102
|
return /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_LocalizationProvider4.LocalizationProvider, { dateAdapter: import_AdapterDateFns2.AdapterDateFns, adapterLocale: locale }, openCalendar == false ? /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { "data-testid": "calendar-mobile", sx: { width: "100%", background: background ? background : "white", display: "flex", flexDirection: "column", alignItems: "center" } }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { width: "100%", padding: "0px", background: "transparent" } }, /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, gap: 0.5, sx: { justifyContent: "space-between", padding: "12px 16px", background: "transparent" } }, diasSemana.map((dia) => /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { sx: { width: "36px" }, key: dia.toString() }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { width: "36px", height: "40px", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { sx: { fontSize: "12px !important", color: "#10184099" } }, (0, import_date_fns2.format)(dia, "EEEE", { locale: import_locale2.es }).charAt(0).toUpperCase())), /* @__PURE__ */ import_react50.default.createElement(
|
|
5054
5103
|
import_material34.Box,
|
|
5055
5104
|
{
|
|
@@ -5073,7 +5122,7 @@ var SCActivityCalendar = ({
|
|
|
5073
5122
|
slotProps: { toolbar: { hidden: true }, actionBar: { actions: [] } },
|
|
5074
5123
|
sx: {
|
|
5075
5124
|
"& .MuiDateCalendar-root": {
|
|
5076
|
-
width: "
|
|
5125
|
+
width: "91.5%",
|
|
5077
5126
|
maxWidth: "unset",
|
|
5078
5127
|
margin: 0,
|
|
5079
5128
|
padding: "0px 16px"
|
|
@@ -5089,7 +5138,36 @@ var SCActivityCalendar = ({
|
|
|
5089
5138
|
},
|
|
5090
5139
|
onChange: (newValue) => setFecha(newValue)
|
|
5091
5140
|
}
|
|
5092
|
-
), /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react50.default.createElement(import_KeyboardDoubleArrowUp2.default, { color: "action" }))))), /* @__PURE__ */ import_react50.default.createElement(import_material34.
|
|
5141
|
+
), /* @__PURE__ */ import_react50.default.createElement(import_Grid9.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react50.default.createElement(import_KeyboardDoubleArrowUp2.default, { color: "action" }))))), /* @__PURE__ */ import_react50.default.createElement(import_material34.IconButton, { onClick: handleClickPopoverFiltro, sx: { position: "fixed", right: "calc(100% - 96%)", top: openCalendar == false ? "220px" : "380px" } }, /* @__PURE__ */ import_react50.default.createElement(import_FilterList.default, { color: "action" })), /* @__PURE__ */ import_react50.default.createElement(
|
|
5142
|
+
import_material34.Popover,
|
|
5143
|
+
{
|
|
5144
|
+
open: openPopoverFiltro,
|
|
5145
|
+
anchorEl: anchorPopoverFiltro,
|
|
5146
|
+
onClose: handleClosePopoverFiltro,
|
|
5147
|
+
anchorOrigin: {
|
|
5148
|
+
vertical: "bottom",
|
|
5149
|
+
horizontal: "right"
|
|
5150
|
+
}
|
|
5151
|
+
},
|
|
5152
|
+
/* @__PURE__ */ import_react50.default.createElement(
|
|
5153
|
+
import_material34.Menu,
|
|
5154
|
+
{
|
|
5155
|
+
id: "basic-menu",
|
|
5156
|
+
anchorEl: anchorPopoverFiltro,
|
|
5157
|
+
open: openPopoverFiltro,
|
|
5158
|
+
onClose: handleClosePopoverFiltro,
|
|
5159
|
+
slotProps: {
|
|
5160
|
+
list: {
|
|
5161
|
+
"aria-labelledby": "basic-button"
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
},
|
|
5165
|
+
/* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Todo") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_CalendarMonthOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver todo")),
|
|
5166
|
+
/* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Finalizada") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_CheckCircleOutlineOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver finalizadas")),
|
|
5167
|
+
/* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "Aplazada") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_EventBusyOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver aplazadas")),
|
|
5168
|
+
/* @__PURE__ */ import_react50.default.createElement(import_material34.MenuItem, { onClick: (event2) => filtrarActividad(event2, "En progreso") }, /* @__PURE__ */ import_react50.default.createElement(import_material34.ListItemIcon, null, /* @__PURE__ */ import_react50.default.createElement(import_PendingOutlined.default, { fontSize: "small" })), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, { variant: "inherit" }, "Ver en progreso"))
|
|
5169
|
+
)
|
|
5170
|
+
), /* @__PURE__ */ import_react50.default.createElement(import_material34.Box, { sx: { boxSizing: "border-box", padding: "0px 16px", width: "100%", height: openCalendar ? "calc(91% - 260px)" : "calc(91% - 100px)", background: "white", display: "flex", flexDirection: "column", overflowY: "auto", gap: "8px", scrollSnapType: "x mandatory", paddingBottom: "10px" } }, diasSemana.map((day, dayIndex) => /* @__PURE__ */ import_react50.default.createElement(
|
|
5093
5171
|
import_material34.Box,
|
|
5094
5172
|
{
|
|
5095
5173
|
key: dayIndex
|
|
@@ -5106,9 +5184,12 @@ var SCActivityCalendar = ({
|
|
|
5106
5184
|
flexDirection: "column"
|
|
5107
5185
|
} }, (() => {
|
|
5108
5186
|
const esDomingo = day.getDay() === 0;
|
|
5109
|
-
|
|
5187
|
+
console.log("D\xEDa:", day);
|
|
5188
|
+
console.log("Filtrando eventos para el d\xEDa:", datosEventos);
|
|
5189
|
+
const eventosDelDia = datosEventos.filter(
|
|
5110
5190
|
(event2) => new Date(event2.date).toDateString() === day.toDateString()
|
|
5111
5191
|
);
|
|
5192
|
+
console.log("Cantidad eventos para el d\xEDa:", eventosDelDia);
|
|
5112
5193
|
if (eventosDelDia.length > 0) {
|
|
5113
5194
|
return eventosDelDia.map((event2, idx) => /* @__PURE__ */ import_react50.default.createElement(
|
|
5114
5195
|
SCListContent,
|
|
@@ -5119,7 +5200,7 @@ var SCActivityCalendar = ({
|
|
|
5119
5200
|
subtitle: /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, configRangeHour && new Date(event2.date.replace("00:00:00", event2.startTime)).getHours() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[0])).getHours() && new Date(event2.date.replace("00:00:00", event2.finalTime)).getHours() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[1])).getHours() && new Date(event2.date.replace("00:00:00", event2.startTime)).getMinutes() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[0])).getMinutes() && new Date(event2.date.replace("00:00:00", event2.finalTime)).getMinutes() === new Date(event2.date.replace("00:00:00", configRangeHour.split("-")[1])).getMinutes() ? /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, "Todo el dia"), /* @__PURE__ */ import_react50.default.createElement(import_LightModeOutlined.default, { fontSize: "small" })) : /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, new Date(event2.date.replace("00:00:00", event2.startTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })), /* @__PURE__ */ import_react50.default.createElement(import_ArrowForward.default, { fontSize: "small" }), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, new Date(event2.date.replace("00:00:00", event2.finalTime)).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: true })))),
|
|
5120
5201
|
iconLeftColor: event2.state === "Finalizada" ? "#C7E49D" : "action",
|
|
5121
5202
|
iconLeft: event2.state === "Finalizada" ? "CheckCircle" : event2.state === "Aplazada" ? "EventBusyOutlined" : event2.state === "En progreso" ? "PendingOutlined" : "RadioButtonUnchecked",
|
|
5122
|
-
description: /* @__PURE__ */ import_react50.default.createElement(
|
|
5203
|
+
description: /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, event2.state === "Aplazada" || event2.state === "En progreso" || event2.state === "Auto asignada" ? /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_material34.Badge, { variant: "dot", badgeContent: "", sx: { display: "flex", alignItems: "center", "& .MuiBadge-badge": { top: "50%", transform: "translateY(-50%)" }, color: "action" } }), /* @__PURE__ */ import_react50.default.createElement(import_material34.Typography, null, event2.state == "Auto asignada" ? "Adicional" : event2.state)) : null),
|
|
5123
5204
|
divider: eventosDelDia.length === idx + 1 ? false : true,
|
|
5124
5205
|
colorDisabled: event2.state === "Finalizada" || event2.state === "Aplazada" || event2.state === "En progreso" ? true : false,
|
|
5125
5206
|
fn: fn ? () => fn(event2) : void 0
|