componentes-sinco 1.0.5 → 1.0.7
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 +573 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +571 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,7 @@ var src_exports = {};
|
|
|
61
61
|
__export(src_exports, {
|
|
62
62
|
ADCSincoTheme: () => ADCSincoTheme,
|
|
63
63
|
AdproSincoTheme: () => AdproSincoTheme,
|
|
64
|
+
Calendar: () => Calendar,
|
|
64
65
|
EmptyState: () => EmptyState,
|
|
65
66
|
FooterAction: () => FooterAction,
|
|
66
67
|
MultiSelect: () => MultiSelect,
|
|
@@ -1245,16 +1246,21 @@ function SCDrawer({
|
|
|
1245
1246
|
const inputValidation = () => validateInputs(arrayElements, setToastWithDelay, handleDrawerClose);
|
|
1246
1247
|
const clean = () => {
|
|
1247
1248
|
arrayElements.forEach((element, index) => {
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
element.setState(
|
|
1249
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
1250
|
+
if (element.setState || import_react8.default.isValidElement(element == null ? void 0 : element.component) && ((_a2 = element.component.props) == null ? void 0 : _a2.setState)) {
|
|
1251
|
+
if (element.type === "textField" || import_react8.default.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name === "SCtextField" || (element.type === "textArea" || import_react8.default.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name === "SCtextArea")) {
|
|
1252
|
+
element.setState != void 0 ? element.setState("") : null;
|
|
1253
|
+
import_react8.default.isValidElement(element == null ? void 0 : element.component) && ((_b2 = element.component.props) == null ? void 0 : _b2.setState) && ((_d = (_c = element == null ? void 0 : element.component) == null ? void 0 : _c.props) == null ? void 0 : _d.setState(""));
|
|
1254
|
+
} else if (element.type === "dateRange" || import_react8.default.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name === "SCDateRange") {
|
|
1255
|
+
element.setState != void 0 ? element.setState([null, null]) : null;
|
|
1256
|
+
import_react8.default.isValidElement(element == null ? void 0 : element.component) && typeof ((_e = element.component.props) == null ? void 0 : _e.setState) === "function" && element.component.props.setState([null, null]);
|
|
1253
1257
|
} else {
|
|
1254
|
-
if (element.type == "autocomplete" && element.typeFormat == "multiselect") {
|
|
1255
|
-
element.setState({ hiddenValue: [], textValue: [] });
|
|
1258
|
+
if (element.type == "autocomplete" || import_react8.default.isValidElement(element == null ? void 0 : element.component) && element.component.type && element.component.type.name === "SCAutocomplete" || (element.typeFormat == "multiselect" || import_react8.default.isValidElement(element == null ? void 0 : element.component) && element.component.props && ((_f = element == null ? void 0 : element.component) == null ? void 0 : _f.props).typeFormat == "multiselect")) {
|
|
1259
|
+
element.setState != void 0 ? element.setState({ hiddenValue: [], textValue: [] }) : null;
|
|
1260
|
+
import_react8.default.isValidElement(element == null ? void 0 : element.component) && typeof ((_g = element.component.props) == null ? void 0 : _g.setState) === "function" && element.component.props.setState({ hiddenValue: [], textValue: [] });
|
|
1256
1261
|
} else {
|
|
1257
|
-
element.setState({ hiddenValue: "-1", textValue: "" });
|
|
1262
|
+
element.setState != void 0 ? element.setState({ hiddenValue: "-1", textValue: "" }) : null;
|
|
1263
|
+
import_react8.default.isValidElement(element == null ? void 0 : element.component) && typeof ((_h = element.component.props) == null ? void 0 : _h.setState) === "function" && element.component.props.setState({ hiddenValue: "-1", textValue: "" });
|
|
1258
1264
|
}
|
|
1259
1265
|
}
|
|
1260
1266
|
}
|
|
@@ -2601,12 +2607,563 @@ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colo
|
|
|
2601
2607
|
)))) : /* @__PURE__ */ import_react22.default.createElement(import_material16.Box, { sx: { height: "200px" } }, toast && /* @__PURE__ */ import_react22.default.createElement(SCToastNotification, __spreadValues({ "data-testid": "error-tab-message" }, toast))));
|
|
2602
2608
|
};
|
|
2603
2609
|
|
|
2610
|
+
// src/Components/Calendario/Calendar.tsx
|
|
2611
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
2612
|
+
var import_material22 = require("@mui/material");
|
|
2613
|
+
var import_dayjs7 = __toESM(require("dayjs"), 1);
|
|
2614
|
+
|
|
2615
|
+
// src/Components/Calendario/CalendarToolbar.tsx
|
|
2616
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
2617
|
+
var import_icons_material10 = require("@mui/icons-material");
|
|
2618
|
+
var import_material17 = require("@mui/material");
|
|
2619
|
+
var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
2620
|
+
var import_es2 = require("dayjs/locale/es");
|
|
2621
|
+
import_dayjs2.default.locale("es");
|
|
2622
|
+
var CalendarToolbar = ({
|
|
2623
|
+
labelDate,
|
|
2624
|
+
view,
|
|
2625
|
+
onView,
|
|
2626
|
+
onNavigate,
|
|
2627
|
+
children
|
|
2628
|
+
}) => {
|
|
2629
|
+
const [anchorEl, setAnchorEl] = (0, import_react23.useState)(null);
|
|
2630
|
+
const open = Boolean(anchorEl);
|
|
2631
|
+
const handleMenuOpen = (event2) => {
|
|
2632
|
+
setAnchorEl(event2.currentTarget);
|
|
2633
|
+
};
|
|
2634
|
+
const handleMenuClose = () => {
|
|
2635
|
+
setAnchorEl(null);
|
|
2636
|
+
};
|
|
2637
|
+
const handleViewChange = (newView) => {
|
|
2638
|
+
onView(newView);
|
|
2639
|
+
handleMenuClose();
|
|
2640
|
+
};
|
|
2641
|
+
const getFormattedDate = () => {
|
|
2642
|
+
if (view === "month") {
|
|
2643
|
+
return labelDate.format("MMMM YYYY");
|
|
2644
|
+
}
|
|
2645
|
+
if (view === "week") {
|
|
2646
|
+
return `${labelDate.startOf("week").add(1, "day").format("DD MMM")} - ${labelDate.endOf("week").format("DD MMM YYYY")}`;
|
|
2647
|
+
}
|
|
2648
|
+
return labelDate.format(" DD MMMM YYYY");
|
|
2649
|
+
};
|
|
2650
|
+
return /* @__PURE__ */ import_react23.default.createElement(import_material17.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, px: 1, py: 0.5 }, /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2651
|
+
import_material17.Chip,
|
|
2652
|
+
{
|
|
2653
|
+
label: "Hoy",
|
|
2654
|
+
icon: /* @__PURE__ */ import_react23.default.createElement(import_icons_material10.LightModeOutlined, { fontSize: "small" }),
|
|
2655
|
+
color: "primary",
|
|
2656
|
+
onClick: () => onNavigate("TODAY")
|
|
2657
|
+
}
|
|
2658
|
+
)), /* @__PURE__ */ import_react23.default.createElement(import_material17.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { "aria-label": "Anterior", onClick: () => onNavigate("PREV"), size: "small", color: "primary" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material10.ChevronLeft, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { "aria-label": "Siguiente", onClick: () => onNavigate("NEXT"), size: "small", color: "primary" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material10.ChevronRight, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(import_material17.Typography, { variant: "h6", color: "primary", "data-testid": "currentDate" }, getFormattedDate()), /* @__PURE__ */ import_react23.default.createElement(import_material17.IconButton, { onClick: handleMenuOpen, size: "small", color: "primary", "aria-label": "Cambiar vista" }, /* @__PURE__ */ import_react23.default.createElement(import_icons_material10.KeyboardArrowDown, { fontSize: "small" })), /* @__PURE__ */ import_react23.default.createElement(
|
|
2659
|
+
import_material17.Menu,
|
|
2660
|
+
{
|
|
2661
|
+
anchorEl,
|
|
2662
|
+
open,
|
|
2663
|
+
onClose: handleMenuClose,
|
|
2664
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
2665
|
+
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
2666
|
+
},
|
|
2667
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("month") }, "Mes"),
|
|
2668
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("week") }, "Semana"),
|
|
2669
|
+
/* @__PURE__ */ import_react23.default.createElement(import_material17.MenuItem, { onClick: () => handleViewChange("day") }, "D\xEDa")
|
|
2670
|
+
)), children ? /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, null, children) : /* @__PURE__ */ import_react23.default.createElement(import_material17.Box, { width: "24px" }), " ");
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2673
|
+
// src/Components/Calendario/Views/MonthView.tsx
|
|
2674
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
2675
|
+
var import_material19 = require("@mui/material");
|
|
2676
|
+
var import_Add = __toESM(require("@mui/icons-material/Add"), 1);
|
|
2677
|
+
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
2678
|
+
var import_localeData = __toESM(require("dayjs/plugin/localeData"), 1);
|
|
2679
|
+
var import_isBetween = __toESM(require("dayjs/plugin/isBetween"), 1);
|
|
2680
|
+
|
|
2681
|
+
// src/Components/Calendario/Utils.tsx
|
|
2682
|
+
var import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
2683
|
+
function getMonthDays(date) {
|
|
2684
|
+
const start = date.startOf("month").day(0);
|
|
2685
|
+
const end = date.endOf("month").day(6);
|
|
2686
|
+
const days = [];
|
|
2687
|
+
let current = start;
|
|
2688
|
+
while (current.isBefore(end) || current.isSame(end, "day")) {
|
|
2689
|
+
days.push(current);
|
|
2690
|
+
current = current.add(1, "day");
|
|
2691
|
+
}
|
|
2692
|
+
return days;
|
|
2693
|
+
}
|
|
2694
|
+
var isToday = (date) => {
|
|
2695
|
+
return date.isSame((0, import_dayjs3.default)(), "day");
|
|
2696
|
+
};
|
|
2697
|
+
var stateColors = {
|
|
2698
|
+
Asignada: "warning.main",
|
|
2699
|
+
Finalizado: "primary.main",
|
|
2700
|
+
Vencida: "error.main",
|
|
2701
|
+
EnProgreso: "success.main"
|
|
2702
|
+
};
|
|
2703
|
+
|
|
2704
|
+
// src/Components/Calendario/Event.tsx
|
|
2705
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
2706
|
+
var import_material18 = require("@mui/material");
|
|
2707
|
+
var CalendarEventCard = ({ event: event2, color, sx, onClick }) => {
|
|
2708
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
2709
|
+
import_material18.Stack,
|
|
2710
|
+
{
|
|
2711
|
+
direction: "row",
|
|
2712
|
+
padding: 0.5,
|
|
2713
|
+
borderRadius: 0.5,
|
|
2714
|
+
alignItems: "flex-start",
|
|
2715
|
+
minHeight: "20px",
|
|
2716
|
+
onClick: (e) => {
|
|
2717
|
+
e.stopPropagation();
|
|
2718
|
+
onClick == null ? void 0 : onClick(event2);
|
|
2719
|
+
},
|
|
2720
|
+
sx: (theme) => __spreadValues({
|
|
2721
|
+
backgroundColor: theme.palette.common.white,
|
|
2722
|
+
boxShadow: theme.shadows[2],
|
|
2723
|
+
color: theme.palette.text.secondary,
|
|
2724
|
+
overflow: "hidden",
|
|
2725
|
+
cursor: onClick ? "pointer" : "default"
|
|
2726
|
+
}, sx)
|
|
2727
|
+
},
|
|
2728
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
2729
|
+
import_material18.Divider,
|
|
2730
|
+
{
|
|
2731
|
+
orientation: "vertical",
|
|
2732
|
+
flexItem: true,
|
|
2733
|
+
sx: {
|
|
2734
|
+
width: "2px",
|
|
2735
|
+
backgroundColor: color != null ? color : "primary.main",
|
|
2736
|
+
borderRadius: "2px"
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
),
|
|
2740
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
2741
|
+
import_material18.Box,
|
|
2742
|
+
{
|
|
2743
|
+
px: 1,
|
|
2744
|
+
py: 0.5,
|
|
2745
|
+
flex: "1",
|
|
2746
|
+
minWidth: 0,
|
|
2747
|
+
display: "flex",
|
|
2748
|
+
alignItems: "center"
|
|
2749
|
+
},
|
|
2750
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
2751
|
+
import_material18.Typography,
|
|
2752
|
+
{
|
|
2753
|
+
color: "text.primary",
|
|
2754
|
+
variant: "caption",
|
|
2755
|
+
noWrap: true,
|
|
2756
|
+
sx: {
|
|
2757
|
+
overflow: "hidden",
|
|
2758
|
+
textOverflow: "ellipsis",
|
|
2759
|
+
whiteSpace: "nowrap"
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
capitalize(event2.title)
|
|
2763
|
+
)
|
|
2764
|
+
)
|
|
2765
|
+
);
|
|
2766
|
+
};
|
|
2767
|
+
|
|
2768
|
+
// src/Components/Calendario/Views/MonthView.tsx
|
|
2769
|
+
import_dayjs4.default.extend(import_localeData.default);
|
|
2770
|
+
import_dayjs4.default.extend(import_isBetween.default);
|
|
2771
|
+
var MonthView = ({ events, onDayClick, onMoreClick, currentDate, onEventClick }) => {
|
|
2772
|
+
const days = getMonthDays(currentDate);
|
|
2773
|
+
const weekDays = Array.from({ length: 7 }, (_, i) => (0, import_dayjs4.default)().day(i));
|
|
2774
|
+
const [openDrawer, setOpenDrawer] = import_react25.default.useState(false);
|
|
2775
|
+
const [selectedDay, setSelectedDay] = import_react25.default.useState(null);
|
|
2776
|
+
const [selectedEvents, setSelectedEvents] = import_react25.default.useState([]);
|
|
2777
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { width: "100%", sx: { overflowX: "auto" } }, /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { minWidth: "1050px" }, /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5, mb: 1 }, weekDays.map((day) => /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { key: day.day(), textAlign: "center", py: 0.5 }, /* @__PURE__ */ import_react25.default.createElement(import_material19.Typography, { variant: "caption", color: "text.secondary" }, day.format("dddd"))))), /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { display: "grid", gridTemplateColumns: "repeat(7, minmax(150px, 1fr))", gap: 0.5 }, days.map((day) => {
|
|
2778
|
+
const dayEvents = events.filter(
|
|
2779
|
+
(e) => day.isBetween(e.start.startOf("day"), e.end.endOf("day"), null, "[]")
|
|
2780
|
+
);
|
|
2781
|
+
const isCurrentMonth = day.month() === currentDate.month();
|
|
2782
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
2783
|
+
import_material19.Paper,
|
|
2784
|
+
{
|
|
2785
|
+
key: day.toString(),
|
|
2786
|
+
onClick: () => onDayClick == null ? void 0 : onDayClick(day),
|
|
2787
|
+
sx: {
|
|
2788
|
+
minHeight: 120,
|
|
2789
|
+
display: "flex",
|
|
2790
|
+
flexDirection: "column",
|
|
2791
|
+
justifyContent: "space-between",
|
|
2792
|
+
boxShadow: "none",
|
|
2793
|
+
bgcolor: isCurrentMonth ? "grey.50" : "background.default",
|
|
2794
|
+
cursor: "pointer",
|
|
2795
|
+
"&:hover": { bgcolor: "primary.50" },
|
|
2796
|
+
overflow: "hidden"
|
|
2797
|
+
}
|
|
2798
|
+
},
|
|
2799
|
+
/* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { p: 1, flexShrink: 0 }, /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { display: "flex", alignItems: "center", justifyContent: "flex-start" }, /* @__PURE__ */ import_react25.default.createElement(
|
|
2800
|
+
import_material19.Box,
|
|
2801
|
+
{
|
|
2802
|
+
sx: {
|
|
2803
|
+
width: 24,
|
|
2804
|
+
height: 24,
|
|
2805
|
+
borderRadius: "50%",
|
|
2806
|
+
backgroundColor: isToday(day) ? "primary.main" : void 0,
|
|
2807
|
+
display: "flex",
|
|
2808
|
+
alignItems: "center",
|
|
2809
|
+
justifyContent: "center"
|
|
2810
|
+
}
|
|
2811
|
+
},
|
|
2812
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
2813
|
+
import_material19.Typography,
|
|
2814
|
+
{
|
|
2815
|
+
variant: "body2",
|
|
2816
|
+
sx: { color: isToday(day) ? "white" : "text.secondary" }
|
|
2817
|
+
},
|
|
2818
|
+
day.date()
|
|
2819
|
+
)
|
|
2820
|
+
), dayEvents.length > 2 && /* @__PURE__ */ import_react25.default.createElement(import_material19.Tooltip, { title: "M\xE1s eventos" }, /* @__PURE__ */ import_react25.default.createElement(
|
|
2821
|
+
import_material19.IconButton,
|
|
2822
|
+
{
|
|
2823
|
+
color: "primary",
|
|
2824
|
+
size: "small",
|
|
2825
|
+
onClick: (e) => {
|
|
2826
|
+
e.stopPropagation();
|
|
2827
|
+
onMoreClick == null ? void 0 : onMoreClick(day, dayEvents);
|
|
2828
|
+
setSelectedDay(day);
|
|
2829
|
+
setSelectedEvents(dayEvents);
|
|
2830
|
+
}
|
|
2831
|
+
},
|
|
2832
|
+
/* @__PURE__ */ import_react25.default.createElement(import_Add.default, { fontSize: "small" })
|
|
2833
|
+
)))),
|
|
2834
|
+
/* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { display: "flex", flexDirection: "column", gap: 0.5, p: 1, pt: 0, overflow: "hidden" }, dayEvents.slice(0, 2).map((event2) => /* @__PURE__ */ import_react25.default.createElement(
|
|
2835
|
+
CalendarEventCard,
|
|
2836
|
+
{
|
|
2837
|
+
key: `${event2.id}-${day.toString()}`,
|
|
2838
|
+
event: event2,
|
|
2839
|
+
color: stateColors[event2.state],
|
|
2840
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day)
|
|
2841
|
+
}
|
|
2842
|
+
))),
|
|
2843
|
+
dayEvents.length > 2 && /* @__PURE__ */ import_react25.default.createElement(import_material19.Stack, { justifyContent: "flex-end", px: 1, pb: 0.5, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react25.default.createElement(
|
|
2844
|
+
SCDrawer,
|
|
2845
|
+
{
|
|
2846
|
+
width: "350px",
|
|
2847
|
+
title: day.format("DD [de] MMMM YYYY"),
|
|
2848
|
+
open: openDrawer,
|
|
2849
|
+
buttonDrawer: { text: `+ ${dayEvents.length}` },
|
|
2850
|
+
anchor: "right",
|
|
2851
|
+
actions: false,
|
|
2852
|
+
arrayElements: [{
|
|
2853
|
+
component: (() => {
|
|
2854
|
+
const [first, ...rest] = dayEvents;
|
|
2855
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { display: "flex", width: "100%", flexDirection: "column", height: "100%", pr: 1.5 }, /* @__PURE__ */ import_react25.default.createElement(import_material19.Typography, { width: "100%", color: "text.secondary" }, " Proximo evento "), first && /* @__PURE__ */ import_react25.default.createElement(import_material19.Box, { p: 1, pb: 1, width: "100%" }, /* @__PURE__ */ import_react25.default.createElement(
|
|
2856
|
+
CalendarEventCard,
|
|
2857
|
+
{
|
|
2858
|
+
event: first,
|
|
2859
|
+
color: stateColors[first.state],
|
|
2860
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(first, day),
|
|
2861
|
+
sx: {
|
|
2862
|
+
whiteSpace: "normal",
|
|
2863
|
+
"& .MuiTypography-root": {
|
|
2864
|
+
whiteSpace: "normal",
|
|
2865
|
+
overflow: "visible",
|
|
2866
|
+
textOverflow: "unset"
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
)), /* @__PURE__ */ import_react25.default.createElement(import_material19.Divider, { flexItem: true, sx: { width: "100%" } }), /* @__PURE__ */ import_react25.default.createElement(import_material19.Typography, { width: "100%", py: 1, color: "text.secondary" }, " Eventos restantes "), /* @__PURE__ */ import_react25.default.createElement(
|
|
2871
|
+
import_material19.Box,
|
|
2872
|
+
{
|
|
2873
|
+
width: "100%",
|
|
2874
|
+
height: "100%",
|
|
2875
|
+
flex: 1,
|
|
2876
|
+
overflow: "auto",
|
|
2877
|
+
p: 1,
|
|
2878
|
+
pt: 1,
|
|
2879
|
+
display: "flex",
|
|
2880
|
+
flexDirection: "column",
|
|
2881
|
+
gap: 1.5
|
|
2882
|
+
},
|
|
2883
|
+
rest.map((event2) => /* @__PURE__ */ import_react25.default.createElement(
|
|
2884
|
+
CalendarEventCard,
|
|
2885
|
+
{
|
|
2886
|
+
key: `${event2.id}-${day.toString()}`,
|
|
2887
|
+
event: event2,
|
|
2888
|
+
color: stateColors[event2.state],
|
|
2889
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
|
|
2890
|
+
sx: {
|
|
2891
|
+
whiteSpace: "normal",
|
|
2892
|
+
"& .MuiTypography-root": {
|
|
2893
|
+
whiteSpace: "normal",
|
|
2894
|
+
overflow: "visible",
|
|
2895
|
+
textOverflow: "unset"
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
))
|
|
2900
|
+
));
|
|
2901
|
+
})()
|
|
2902
|
+
}]
|
|
2903
|
+
}
|
|
2904
|
+
))
|
|
2905
|
+
);
|
|
2906
|
+
}))));
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2909
|
+
// src/Components/Calendario/Views/WeekView.tsx
|
|
2910
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
2911
|
+
var import_material20 = require("@mui/material");
|
|
2912
|
+
var import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
2913
|
+
var import_localeData2 = __toESM(require("dayjs/plugin/localeData"), 1);
|
|
2914
|
+
import_dayjs5.default.extend(import_localeData2.default);
|
|
2915
|
+
var WeekView = ({ events, currentDate, onDayClick, onEventClick }) => {
|
|
2916
|
+
const startOfWeek2 = currentDate.startOf("week");
|
|
2917
|
+
const days = Array.from({ length: 7 }, (_, i) => startOfWeek2.add(i, "day"));
|
|
2918
|
+
const hours2 = Array.from({ length: 24 }, (_, i) => i);
|
|
2919
|
+
const getCellBorderType = (cellHour, dayEvents) => {
|
|
2920
|
+
for (const event2 of dayEvents) {
|
|
2921
|
+
const start = event2.start.hour() + event2.start.minute() / 60;
|
|
2922
|
+
const end = event2.end.hour() + event2.end.minute() / 60;
|
|
2923
|
+
const cellStart = cellHour;
|
|
2924
|
+
const cellEnd = cellHour + 1;
|
|
2925
|
+
if (cellEnd > start && cellStart < end) {
|
|
2926
|
+
if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01)
|
|
2927
|
+
return "full";
|
|
2928
|
+
if (Math.abs(cellStart - start) < 0.01) return "start";
|
|
2929
|
+
if (Math.abs(cellEnd - end) < 0.01) return "end";
|
|
2930
|
+
return "middle";
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
return "none";
|
|
2934
|
+
};
|
|
2935
|
+
return /* @__PURE__ */ import_react26.default.createElement(import_material20.Box, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react26.default.createElement(import_material20.Box, { display: "flex", bgcolor: "background.default" }, /* @__PURE__ */ import_react26.default.createElement(import_material20.Box, { width: 45, bgcolor: "background.default" }), days.map((day) => /* @__PURE__ */ import_react26.default.createElement(
|
|
2936
|
+
import_material20.Box,
|
|
2937
|
+
{
|
|
2938
|
+
key: day.toString(),
|
|
2939
|
+
height: 40,
|
|
2940
|
+
flex: 1,
|
|
2941
|
+
pl: 0.5,
|
|
2942
|
+
textAlign: "center",
|
|
2943
|
+
display: "flex",
|
|
2944
|
+
flexDirection: "column",
|
|
2945
|
+
justifyContent: "center",
|
|
2946
|
+
alignItems: "flex-start"
|
|
2947
|
+
},
|
|
2948
|
+
/* @__PURE__ */ import_react26.default.createElement(import_material20.Typography, { variant: "caption", color: "text.secondary" }, day.format("dddd"))
|
|
2949
|
+
))), /* @__PURE__ */ import_react26.default.createElement(import_material20.Box, { display: "flex", flex: 1 }, /* @__PURE__ */ import_react26.default.createElement(import_material20.Box, { width: 45, bgcolor: "background.default" }, hours2.map((h) => /* @__PURE__ */ import_react26.default.createElement(
|
|
2950
|
+
import_material20.Box,
|
|
2951
|
+
{
|
|
2952
|
+
key: h,
|
|
2953
|
+
height: 60,
|
|
2954
|
+
textAlign: "right",
|
|
2955
|
+
pr: 1,
|
|
2956
|
+
borderTop: "1px solid",
|
|
2957
|
+
borderColor: "divider"
|
|
2958
|
+
},
|
|
2959
|
+
/* @__PURE__ */ import_react26.default.createElement(import_material20.Typography, { variant: "caption", color: "text.secondary" }, (0, import_dayjs5.default)().hour(h).format("h A"))
|
|
2960
|
+
))), days.map((day) => {
|
|
2961
|
+
const dayEvents = events.filter(
|
|
2962
|
+
(event2) => day.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
|
|
2963
|
+
);
|
|
2964
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2965
|
+
import_material20.Box,
|
|
2966
|
+
{
|
|
2967
|
+
key: day.toString(),
|
|
2968
|
+
flex: 1,
|
|
2969
|
+
borderLeft: "1px solid",
|
|
2970
|
+
borderColor: "divider",
|
|
2971
|
+
position: "relative",
|
|
2972
|
+
"data-testid": `week-day-column-${day.format("YYYY-MM-DD")}`,
|
|
2973
|
+
onClick: () => onDayClick == null ? void 0 : onDayClick(day)
|
|
2974
|
+
},
|
|
2975
|
+
hours2.map((hourIdx) => {
|
|
2976
|
+
const borderType = getCellBorderType(hourIdx, dayEvents);
|
|
2977
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2978
|
+
import_material20.Box,
|
|
2979
|
+
{
|
|
2980
|
+
key: hourIdx,
|
|
2981
|
+
height: 60,
|
|
2982
|
+
borderTop: "1px solid",
|
|
2983
|
+
borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
|
|
2984
|
+
borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
|
|
2985
|
+
}
|
|
2986
|
+
);
|
|
2987
|
+
}),
|
|
2988
|
+
dayEvents.map((event2) => {
|
|
2989
|
+
const eventStart = day.isSame(event2.start, "day") ? event2.start : day.startOf("day").hour(0).minute(0);
|
|
2990
|
+
const eventEnd = day.isSame(event2.end, "day") ? event2.end : day.endOf("day").hour(23).minute(59);
|
|
2991
|
+
const startMinutes = eventStart.hour() * 60 + eventStart.minute();
|
|
2992
|
+
const durationMinutes = eventEnd.diff(eventStart, "minute");
|
|
2993
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2994
|
+
CalendarEventCard,
|
|
2995
|
+
{
|
|
2996
|
+
key: `${event2.id}-${day.toString()}`,
|
|
2997
|
+
event: event2,
|
|
2998
|
+
color: stateColors[event2.state],
|
|
2999
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2, day),
|
|
3000
|
+
sx: {
|
|
3001
|
+
position: "absolute",
|
|
3002
|
+
top: `${startMinutes + 15}px`,
|
|
3003
|
+
left: 4,
|
|
3004
|
+
right: 4,
|
|
3005
|
+
cursor: "pointer",
|
|
3006
|
+
height: "auto"
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
);
|
|
3010
|
+
})
|
|
3011
|
+
);
|
|
3012
|
+
})));
|
|
3013
|
+
};
|
|
3014
|
+
|
|
3015
|
+
// src/Components/Calendario/Views/DayView.tsx
|
|
3016
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
3017
|
+
var import_material21 = require("@mui/material");
|
|
3018
|
+
var import_dayjs6 = __toESM(require("dayjs"), 1);
|
|
3019
|
+
var hours = Array.from({ length: 24 }, (_, i) => i);
|
|
3020
|
+
var DayView = ({ events, currentDate, onEventClick }) => {
|
|
3021
|
+
const getCellBorderType = (cellHour, dayEvents2) => {
|
|
3022
|
+
for (const event2 of dayEvents2) {
|
|
3023
|
+
const start = event2.start.hour() + event2.start.minute() / 60;
|
|
3024
|
+
const end = event2.end.hour() + event2.end.minute() / 60;
|
|
3025
|
+
const cellStart = cellHour;
|
|
3026
|
+
const cellEnd = cellHour + 1;
|
|
3027
|
+
if (cellEnd > start && cellStart < end) {
|
|
3028
|
+
if (Math.abs(cellStart - start) < 0.01 && Math.abs(cellEnd - end) < 0.01)
|
|
3029
|
+
return "full";
|
|
3030
|
+
if (Math.abs(cellStart - start) < 0.01) return "start";
|
|
3031
|
+
if (Math.abs(cellEnd - end) < 0.01) return "end";
|
|
3032
|
+
return "middle";
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
return "none";
|
|
3036
|
+
};
|
|
3037
|
+
const dayEvents = events.filter(
|
|
3038
|
+
(event2) => currentDate.isBetween(event2.start.startOf("day"), event2.end.endOf("day"), null, "[]")
|
|
3039
|
+
);
|
|
3040
|
+
return /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { display: "flex", flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { display: "flex", borderBottom: "1px solid", borderColor: "primary.main", bgcolor: "background.paper" }, /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { width: 47, bgcolor: "background.default", borderBottom: "1px solid", borderColor: "transparent" }), /* @__PURE__ */ import_react27.default.createElement(
|
|
3041
|
+
import_material21.Box,
|
|
3042
|
+
{
|
|
3043
|
+
flex: 1,
|
|
3044
|
+
display: "flex",
|
|
3045
|
+
flexDirection: "column",
|
|
3046
|
+
textAlign: "start",
|
|
3047
|
+
gap: 0.5,
|
|
3048
|
+
py: 1,
|
|
3049
|
+
bgcolor: "primary.50"
|
|
3050
|
+
},
|
|
3051
|
+
/* @__PURE__ */ import_react27.default.createElement(import_material21.Typography, { variant: "h6", color: "text.secondary" }, currentDate.format("D")),
|
|
3052
|
+
/* @__PURE__ */ import_react27.default.createElement(import_material21.Typography, { variant: "caption", color: "text.secondary" }, currentDate.format("dddd"))
|
|
3053
|
+
)), /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { display: "flex", flex: 1 }, /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { width: 47, bgcolor: "background.default" }, hours.map((h) => /* @__PURE__ */ import_react27.default.createElement(
|
|
3054
|
+
import_material21.Box,
|
|
3055
|
+
{
|
|
3056
|
+
key: h,
|
|
3057
|
+
height: 60,
|
|
3058
|
+
textAlign: "right",
|
|
3059
|
+
pr: 1,
|
|
3060
|
+
borderTop: "1px solid",
|
|
3061
|
+
borderRight: "1px solid",
|
|
3062
|
+
borderColor: "divider"
|
|
3063
|
+
},
|
|
3064
|
+
/* @__PURE__ */ import_react27.default.createElement(import_material21.Typography, { variant: "caption", color: "text.secondary" }, (0, import_dayjs6.default)().hour(h).format("h A"))
|
|
3065
|
+
))), /* @__PURE__ */ import_react27.default.createElement(import_material21.Box, { flex: 1, position: "relative" }, hours.map((hourIdx) => {
|
|
3066
|
+
const borderType = getCellBorderType(hourIdx, dayEvents);
|
|
3067
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
3068
|
+
import_material21.Box,
|
|
3069
|
+
{
|
|
3070
|
+
key: hourIdx,
|
|
3071
|
+
height: 60,
|
|
3072
|
+
borderTop: "1px solid",
|
|
3073
|
+
borderColor: borderType === "start" || borderType === "full" || borderType === "none" ? "divider" : "transparent",
|
|
3074
|
+
borderBottom: borderType === "end" || borderType === "full" ? "1px solid divider" : void 0
|
|
3075
|
+
}
|
|
3076
|
+
);
|
|
3077
|
+
}), dayEvents.map((event2) => {
|
|
3078
|
+
const eventStart = currentDate.isSame(event2.start, "day") ? event2.start : currentDate.startOf("day").hour(0).minute(0);
|
|
3079
|
+
const eventEnd = currentDate.isSame(event2.end, "day") ? event2.end : currentDate.endOf("day").hour(23).minute(59);
|
|
3080
|
+
const startMinutes = eventStart.hour() * 60 + eventStart.minute();
|
|
3081
|
+
const durationMinutes = eventEnd.diff(eventStart, "minute");
|
|
3082
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
3083
|
+
CalendarEventCard,
|
|
3084
|
+
{
|
|
3085
|
+
key: `${event2.id}-${currentDate.toString()}`,
|
|
3086
|
+
event: event2,
|
|
3087
|
+
color: stateColors[event2.state],
|
|
3088
|
+
onClick: () => onEventClick == null ? void 0 : onEventClick(event2),
|
|
3089
|
+
sx: {
|
|
3090
|
+
position: "absolute",
|
|
3091
|
+
top: `${startMinutes + 15}px`,
|
|
3092
|
+
left: 4,
|
|
3093
|
+
right: 4
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
);
|
|
3097
|
+
}))));
|
|
3098
|
+
};
|
|
3099
|
+
|
|
3100
|
+
// src/Components/Calendario/Calendar.tsx
|
|
3101
|
+
var Calendar = ({
|
|
3102
|
+
events,
|
|
3103
|
+
onDayClick,
|
|
3104
|
+
onMoreClick,
|
|
3105
|
+
onEventClick,
|
|
3106
|
+
view: initialView = "month",
|
|
3107
|
+
onViewChange,
|
|
3108
|
+
toolbar
|
|
3109
|
+
}) => {
|
|
3110
|
+
const [view, setView] = (0, import_react28.useState)(initialView);
|
|
3111
|
+
const [currentDate, setCurrentDate] = (0, import_react28.useState)((0, import_dayjs7.default)());
|
|
3112
|
+
const handleViewChange = (newView) => {
|
|
3113
|
+
setView(newView);
|
|
3114
|
+
onViewChange == null ? void 0 : onViewChange(newView);
|
|
3115
|
+
};
|
|
3116
|
+
const handleNavigate = (action) => {
|
|
3117
|
+
let newDate = currentDate;
|
|
3118
|
+
const unit = view === "month" ? "month" : "day";
|
|
3119
|
+
if (action === "PREV") newDate = currentDate.subtract(1, unit);
|
|
3120
|
+
else if (action === "NEXT") newDate = currentDate.add(1, unit);
|
|
3121
|
+
else if (action === "TODAY") newDate = (0, import_dayjs7.default)();
|
|
3122
|
+
setCurrentDate(newDate);
|
|
3123
|
+
};
|
|
3124
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_material22.Box, null, /* @__PURE__ */ import_react28.default.createElement(
|
|
3125
|
+
CalendarToolbar,
|
|
3126
|
+
{
|
|
3127
|
+
labelDate: currentDate,
|
|
3128
|
+
view,
|
|
3129
|
+
onView: handleViewChange,
|
|
3130
|
+
onNavigate: handleNavigate
|
|
3131
|
+
},
|
|
3132
|
+
toolbar
|
|
3133
|
+
), view === "month" && /* @__PURE__ */ import_react28.default.createElement(
|
|
3134
|
+
MonthView,
|
|
3135
|
+
{
|
|
3136
|
+
events,
|
|
3137
|
+
onDayClick,
|
|
3138
|
+
onMoreClick,
|
|
3139
|
+
onEventClick,
|
|
3140
|
+
currentDate
|
|
3141
|
+
}
|
|
3142
|
+
), view === "week" && /* @__PURE__ */ import_react28.default.createElement(
|
|
3143
|
+
WeekView,
|
|
3144
|
+
{
|
|
3145
|
+
events,
|
|
3146
|
+
currentDate,
|
|
3147
|
+
onDayClick,
|
|
3148
|
+
onMoreClick,
|
|
3149
|
+
onEventClick
|
|
3150
|
+
}
|
|
3151
|
+
), view === "day" && /* @__PURE__ */ import_react28.default.createElement(
|
|
3152
|
+
DayView,
|
|
3153
|
+
{
|
|
3154
|
+
events,
|
|
3155
|
+
currentDate,
|
|
3156
|
+
onEventClick
|
|
3157
|
+
}
|
|
3158
|
+
));
|
|
3159
|
+
};
|
|
3160
|
+
|
|
2604
3161
|
// src/Theme/index.ts
|
|
2605
3162
|
var import_styles3 = require("@mui/material/styles");
|
|
2606
3163
|
|
|
2607
3164
|
// src/Theme/components.ts
|
|
2608
|
-
var
|
|
2609
|
-
var
|
|
3165
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
3166
|
+
var import_icons_material11 = require("@mui/icons-material");
|
|
2610
3167
|
var components = {
|
|
2611
3168
|
MuiSelect: {
|
|
2612
3169
|
styleOverrides: {
|
|
@@ -3303,10 +3860,10 @@ var components = {
|
|
|
3303
3860
|
MuiAlert: {
|
|
3304
3861
|
defaultProps: {
|
|
3305
3862
|
iconMapping: {
|
|
3306
|
-
success:
|
|
3307
|
-
error:
|
|
3308
|
-
warning:
|
|
3309
|
-
info:
|
|
3863
|
+
success: import_react29.default.createElement(import_icons_material11.CheckCircleRounded),
|
|
3864
|
+
error: import_react29.default.createElement(import_icons_material11.ErrorRounded),
|
|
3865
|
+
warning: import_react29.default.createElement(import_icons_material11.WarningRounded),
|
|
3866
|
+
info: import_react29.default.createElement(import_icons_material11.InfoRounded)
|
|
3310
3867
|
}
|
|
3311
3868
|
},
|
|
3312
3869
|
variants: [
|
|
@@ -3624,7 +4181,7 @@ var components = {
|
|
|
3624
4181
|
styleOverrides: {
|
|
3625
4182
|
root: {
|
|
3626
4183
|
"&.MuiAutocomplete-root .MuiOutlinedInput-root": {
|
|
3627
|
-
padding: "6px 14px 6px 10px"
|
|
4184
|
+
padding: "6px 14px 6px 10px !important"
|
|
3628
4185
|
},
|
|
3629
4186
|
"& .MuiAutocomplete-endAdornment": {
|
|
3630
4187
|
top: "calc(50% - 12px)",
|
|
@@ -4348,6 +4905,7 @@ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme)
|
|
|
4348
4905
|
0 && (module.exports = {
|
|
4349
4906
|
ADCSincoTheme,
|
|
4350
4907
|
AdproSincoTheme,
|
|
4908
|
+
Calendar,
|
|
4351
4909
|
EmptyState,
|
|
4352
4910
|
FooterAction,
|
|
4353
4911
|
MultiSelect,
|