@mlw-packages/react-components 1.7.19 → 1.7.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.css +0 -6
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +312 -556
- package/dist/index.mjs +239 -490
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12172,11 +12172,11 @@ function AgendaView({
|
|
|
12172
12172
|
}
|
|
12173
12173
|
};
|
|
12174
12174
|
const datedEvents = useMemo9(
|
|
12175
|
-
() => events.filter((e) => isValidDate6(e.start)
|
|
12175
|
+
() => events.filter((e) => isValidDate6(e.start) || isValidDate6(e.end)),
|
|
12176
12176
|
[events]
|
|
12177
12177
|
);
|
|
12178
12178
|
const undatedEvents = useMemo9(
|
|
12179
|
-
() => events.filter((e) => !(isValidDate6(e.start)
|
|
12179
|
+
() => events.filter((e) => !(isValidDate6(e.start) || isValidDate6(e.end))),
|
|
12180
12180
|
[events]
|
|
12181
12181
|
);
|
|
12182
12182
|
const days = useMemo9(() => {
|
|
@@ -15432,15 +15432,11 @@ function Agenda({
|
|
|
15432
15432
|
}
|
|
15433
15433
|
};
|
|
15434
15434
|
const datedEvents = useMemo19(
|
|
15435
|
-
() => events.filter(
|
|
15436
|
-
(e) => isValidDate6(e.start) && isValidDate6(e.end) || isValidDate6(e.attend_date)
|
|
15437
|
-
),
|
|
15435
|
+
() => events.filter((e) => isValidDate6(e.start) || isValidDate6(e.end)),
|
|
15438
15436
|
[events]
|
|
15439
15437
|
);
|
|
15440
15438
|
const undatedEvents = useMemo19(
|
|
15441
|
-
() => events.filter(
|
|
15442
|
-
(e) => !(isValidDate6(e.start) && isValidDate6(e.end)) && !isValidDate6(e.attend_date)
|
|
15443
|
-
),
|
|
15439
|
+
() => events.filter((e) => !(isValidDate6(e.start) || isValidDate6(e.end))),
|
|
15444
15440
|
[events]
|
|
15445
15441
|
);
|
|
15446
15442
|
const days = useMemo19(() => {
|
|
@@ -15469,12 +15465,18 @@ function Agenda({
|
|
|
15469
15465
|
return /* @__PURE__ */ jsxs66(
|
|
15470
15466
|
"div",
|
|
15471
15467
|
{
|
|
15472
|
-
className: twMerge2(
|
|
15468
|
+
className: twMerge2(
|
|
15469
|
+
"relative my-12 border-border/70 border-t",
|
|
15470
|
+
isToday4(day) ? "border-blue-200" : ""
|
|
15471
|
+
),
|
|
15473
15472
|
children: [
|
|
15474
15473
|
/* @__PURE__ */ jsx86(
|
|
15475
15474
|
"span",
|
|
15476
15475
|
{
|
|
15477
|
-
className: twMerge2(
|
|
15476
|
+
className: twMerge2(
|
|
15477
|
+
"-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase data-today:font-extrabold sm:pe-4 text-lg font-bold",
|
|
15478
|
+
isToday4(day) ? "text-blue-500" : ""
|
|
15479
|
+
),
|
|
15478
15480
|
"data-today": isToday4(day) || void 0,
|
|
15479
15481
|
children: (() => {
|
|
15480
15482
|
const s = format11(day, "d MMM, EEEE", { locale: ptBR10 });
|
|
@@ -15769,7 +15771,7 @@ var DefaultEndHourAgenda = 10;
|
|
|
15769
15771
|
|
|
15770
15772
|
// src/components/event-calendar-view/DayView.tsx
|
|
15771
15773
|
import {
|
|
15772
|
-
addHours as
|
|
15774
|
+
addHours as addHours4,
|
|
15773
15775
|
areIntervalsOverlapping as areIntervalsOverlapping3,
|
|
15774
15776
|
differenceInMinutes as differenceInMinutes7,
|
|
15775
15777
|
eachHourOfInterval as eachHourOfInterval3,
|
|
@@ -15777,14 +15779,12 @@ import {
|
|
|
15777
15779
|
getHours as getHours3,
|
|
15778
15780
|
getMinutes as getMinutes3,
|
|
15779
15781
|
isSameDay as isSameDay9,
|
|
15780
|
-
startOfDay as startOfDay3
|
|
15781
|
-
endOfDay
|
|
15782
|
+
startOfDay as startOfDay3
|
|
15782
15783
|
} from "date-fns";
|
|
15783
15784
|
import { useMemo as useMemo21 } from "react";
|
|
15784
15785
|
|
|
15785
15786
|
// src/components/event-calendar-view/utils.ts
|
|
15786
15787
|
import { isSameDay as isSameDay7 } from "date-fns";
|
|
15787
|
-
import { addHours as addHours4 } from "date-fns";
|
|
15788
15788
|
function getEventColorClassesAgenda(color) {
|
|
15789
15789
|
const eventColor = color || "sky";
|
|
15790
15790
|
switch (eventColor) {
|
|
@@ -15824,7 +15824,7 @@ function isMultiDayEventAgenda(event) {
|
|
|
15824
15824
|
}
|
|
15825
15825
|
function getEventsForDayAgenda(events, day) {
|
|
15826
15826
|
return events.filter((event) => {
|
|
15827
|
-
const eventStart = isValidDate3(event.start) ? new Date(event.start) :
|
|
15827
|
+
const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
|
|
15828
15828
|
return eventStart ? isSameDay7(day, eventStart) : false;
|
|
15829
15829
|
}).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
|
|
15830
15830
|
}
|
|
@@ -15856,11 +15856,8 @@ function getAllEventsForDayAgenda(events, day) {
|
|
|
15856
15856
|
}
|
|
15857
15857
|
function getAgendaEventsForDayAgenda(events, day) {
|
|
15858
15858
|
return events.filter((event) => {
|
|
15859
|
-
const eventStart = isValidDate3(event.start) ? new Date(event.start) :
|
|
15860
|
-
const eventEnd = isValidDate3(event.end) ? new Date(event.end) :
|
|
15861
|
-
const dt = normalizeAttendDate(event.attend_date);
|
|
15862
|
-
return dt ? addHours4(dt, 1) : void 0;
|
|
15863
|
-
})() : void 0;
|
|
15859
|
+
const eventStart = isValidDate3(event.start) ? new Date(event.start) : void 0;
|
|
15860
|
+
const eventEnd = isValidDate3(event.end) ? new Date(event.end) : void 0;
|
|
15864
15861
|
if (!eventStart) return false;
|
|
15865
15862
|
return isSameDay7(day, eventStart) || (eventEnd ? isSameDay7(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
15866
15863
|
}).sort((a, b) => getEventStartTimestamp2(a) - getEventStartTimestamp2(b));
|
|
@@ -15875,8 +15872,6 @@ function isValidDate3(d) {
|
|
|
15875
15872
|
}
|
|
15876
15873
|
function getEventStartTimestamp2(e) {
|
|
15877
15874
|
if (isValidDate3(e.start)) return new Date(e.start).getTime();
|
|
15878
|
-
if (isValidDate3(e.attend_date))
|
|
15879
|
-
return normalizeAttendDate(e.attend_date).getTime();
|
|
15880
15875
|
return Number.MAX_SAFE_INTEGER;
|
|
15881
15876
|
}
|
|
15882
15877
|
function normalizeAttendDate(d) {
|
|
@@ -15966,16 +15961,18 @@ function EventWrapper2({
|
|
|
15966
15961
|
onTouchStart,
|
|
15967
15962
|
ariaLabel
|
|
15968
15963
|
}) {
|
|
15969
|
-
const hasValidTimeForWrapper = isValidDate4(event.start)
|
|
15964
|
+
const hasValidTimeForWrapper = isValidDate4(event.start) || isValidDate4(event.end);
|
|
15970
15965
|
const displayEnd = (() => {
|
|
15971
15966
|
if (isValidDate4(event.start) && isValidDate4(event.end)) {
|
|
15972
15967
|
return currentTime ? new Date(
|
|
15973
15968
|
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
15974
15969
|
) : new Date(event.end);
|
|
15975
15970
|
}
|
|
15976
|
-
if (isValidDate4(event.
|
|
15977
|
-
|
|
15978
|
-
|
|
15971
|
+
if (isValidDate4(event.start) && !isValidDate4(event.end)) {
|
|
15972
|
+
return currentTime ? new Date(currentTime) : new Date(event.start);
|
|
15973
|
+
}
|
|
15974
|
+
if (!isValidDate4(event.start) && isValidDate4(event.end)) {
|
|
15975
|
+
return currentTime ? new Date(currentTime) : new Date(event.end);
|
|
15979
15976
|
}
|
|
15980
15977
|
return void 0;
|
|
15981
15978
|
})();
|
|
@@ -15985,7 +15982,7 @@ function EventWrapper2({
|
|
|
15985
15982
|
"button",
|
|
15986
15983
|
{
|
|
15987
15984
|
className: cn(
|
|
15988
|
-
"flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md ",
|
|
15985
|
+
"flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md border",
|
|
15989
15986
|
colorClasses,
|
|
15990
15987
|
getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
|
|
15991
15988
|
className
|
|
@@ -16020,29 +16017,28 @@ function EventItemAgenda({
|
|
|
16020
16017
|
agendaOnly = false
|
|
16021
16018
|
}) {
|
|
16022
16019
|
const eventColor = event.color;
|
|
16023
|
-
const hasValidTime = isValidDate4(event.start)
|
|
16020
|
+
const hasValidTime = isValidDate4(event.start) || isValidDate4(event.end);
|
|
16024
16021
|
const colorClasses = hasValidTime ? getEventColorClassesAgenda(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
|
|
16025
16022
|
const displayStart = useMemo20(() => {
|
|
16026
16023
|
if (!hasValidTime) return void 0;
|
|
16027
16024
|
if (isValidDate4(event.start))
|
|
16028
16025
|
return currentTime || new Date(event.start);
|
|
16029
|
-
if (isValidDate4(event.
|
|
16030
|
-
return currentTime ||
|
|
16026
|
+
if (isValidDate4(event.end))
|
|
16027
|
+
return currentTime || new Date(event.end);
|
|
16031
16028
|
return void 0;
|
|
16032
|
-
}, [currentTime, event.start, event.
|
|
16029
|
+
}, [currentTime, event.start, event.end, hasValidTime]);
|
|
16033
16030
|
const displayEnd = useMemo20(() => {
|
|
16034
16031
|
if (!hasValidTime) return void 0;
|
|
16035
16032
|
if (isValidDate4(event.end)) {
|
|
16036
16033
|
return currentTime ? new Date(
|
|
16037
|
-
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
16034
|
+
new Date(currentTime).getTime() + (isValidDate4(event.start) ? new Date(event.end).getTime() - new Date(event.start).getTime() : 0)
|
|
16038
16035
|
) : new Date(event.end);
|
|
16039
16036
|
}
|
|
16040
|
-
if (isValidDate4(event.
|
|
16041
|
-
|
|
16042
|
-
return start ? addHoursToDateAgenda(start, 1) : void 0;
|
|
16037
|
+
if (isValidDate4(event.start)) {
|
|
16038
|
+
return currentTime ? new Date(currentTime) : new Date(event.start);
|
|
16043
16039
|
}
|
|
16044
16040
|
return void 0;
|
|
16045
|
-
}, [currentTime, event.start, event.end,
|
|
16041
|
+
}, [currentTime, event.start, event.end, hasValidTime]);
|
|
16046
16042
|
const durationMinutes = useMemo20(() => {
|
|
16047
16043
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
16048
16044
|
return differenceInMinutes6(displayEnd, displayStart);
|
|
@@ -16076,7 +16072,7 @@ function EventItemAgenda({
|
|
|
16076
16072
|
EventWrapper2,
|
|
16077
16073
|
{
|
|
16078
16074
|
className: cn(
|
|
16079
|
-
"mt-[var(--event-gap)] h-[var(--event-height)] items-center
|
|
16075
|
+
"mt-[var(--event-gap)] h-[var(--event-height)] items-center sm:text-xs",
|
|
16080
16076
|
className
|
|
16081
16077
|
),
|
|
16082
16078
|
currentTime,
|
|
@@ -16088,7 +16084,7 @@ function EventItemAgenda({
|
|
|
16088
16084
|
isLastDay,
|
|
16089
16085
|
onClick,
|
|
16090
16086
|
children: children || /* @__PURE__ */ jsxs68("span", { className: "flex items-center gap-2 truncate", children: [
|
|
16091
|
-
!event.allDay && hasValidTime && displayStart && /* @__PURE__ */ jsx88("span", { className: "truncate
|
|
16087
|
+
!event.allDay && hasValidTime && displayStart && /* @__PURE__ */ jsx88("span", { className: "truncate text-2xl opacity-80 bg-white/10 px-2 rounded-full", children: formatTimeWithOptionalMinutes2(displayStart) }),
|
|
16092
16088
|
/* @__PURE__ */ jsx88(
|
|
16093
16089
|
"span",
|
|
16094
16090
|
{
|
|
@@ -16122,10 +16118,13 @@ function EventItemAgenda({
|
|
|
16122
16118
|
isLastDay,
|
|
16123
16119
|
children: durationMinutes < 45 ? /* @__PURE__ */ jsxs68("div", { className: "flex items-center justify-between w-full", children: [
|
|
16124
16120
|
/* @__PURE__ */ jsx88("div", { className: cn("truncate text-lg"), children: event.title }),
|
|
16125
|
-
showTime && hasValidTime && displayStart && /* @__PURE__ */
|
|
16121
|
+
showTime && hasValidTime && displayStart && /* @__PURE__ */ jsxs68("span", { className: "ml-2 flex items-center gap-3 bg-white/10 py-0.5 rounded-full opacity-90 text-lg ", children: [
|
|
16122
|
+
formatTimeWithOptionalMinutes2(displayStart),
|
|
16123
|
+
/* @__PURE__ */ jsx88(ClockUserIcon2, {})
|
|
16124
|
+
] })
|
|
16126
16125
|
] }) : /* @__PURE__ */ jsxs68(Fragment15, { children: [
|
|
16127
16126
|
/* @__PURE__ */ jsx88("div", { className: cn("truncate font-medium text-lg"), children: event.title }),
|
|
16128
|
-
showTime && hasValidTime && /* @__PURE__ */ jsx88("div", { className: "truncate font-normal opacity-70
|
|
16127
|
+
showTime && hasValidTime && /* @__PURE__ */ jsx88("div", { className: "truncate font-normal opacity-70", children: /* @__PURE__ */ jsx88("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
|
|
16129
16128
|
] })
|
|
16130
16129
|
}
|
|
16131
16130
|
);
|
|
@@ -16200,10 +16199,8 @@ function EventItemAgenda({
|
|
|
16200
16199
|
children: [
|
|
16201
16200
|
/* @__PURE__ */ jsxs68("div", { className: "flex w-full justify-between ", children: [
|
|
16202
16201
|
/* @__PURE__ */ jsx88("div", { className: cn("font-bold text-lg"), children: event.title }),
|
|
16203
|
-
/* @__PURE__ */ jsx88("div", { className: cn("opacity-90 flex items-center gap-2 text-lg"), children: event.allDay ? /* @__PURE__ */ jsx88("span", { children: "Dia todo" }) : /* @__PURE__ */ jsxs68("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
|
|
16202
|
+
/* @__PURE__ */ jsx88("div", { className: cn("opacity-90 flex items-center gap-2 text-lg"), children: event.allDay ? /* @__PURE__ */ jsx88("span", { children: "Dia todo" }) : /* @__PURE__ */ jsxs68("span", { className: "uppercase font-semibold flex items-center gap-2 ", children: [
|
|
16204
16203
|
formatTimeWithOptionalMinutes2(displayStart),
|
|
16205
|
-
/* @__PURE__ */ jsx88("span", { className: "opacity-70", children: "-" }),
|
|
16206
|
-
formatTimeWithOptionalMinutes2(displayEnd),
|
|
16207
16204
|
/* @__PURE__ */ jsx88(ClockUserIcon2, {})
|
|
16208
16205
|
] }) })
|
|
16209
16206
|
] }),
|
|
@@ -16272,38 +16269,18 @@ function DayViewAgenda({
|
|
|
16272
16269
|
const hours = useMemo21(() => {
|
|
16273
16270
|
const dayStart = startOfDay3(currentDate);
|
|
16274
16271
|
return eachHourOfInterval3({
|
|
16275
|
-
end:
|
|
16276
|
-
start:
|
|
16272
|
+
end: addHours4(dayStart, EndHourAgenda - 1),
|
|
16273
|
+
start: addHours4(dayStart, StartHourAgenda)
|
|
16277
16274
|
});
|
|
16278
16275
|
}, [currentDate]);
|
|
16279
16276
|
const dayEvents = useMemo21(() => {
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
const ad = new Date(event.attend_date);
|
|
16288
|
-
const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
|
|
16289
|
-
if (hasTime) {
|
|
16290
|
-
if (!eventStart) eventStart = ad;
|
|
16291
|
-
if (!eventEnd) eventEnd = addHours5(ad, 1);
|
|
16292
|
-
}
|
|
16293
|
-
} catch {
|
|
16294
|
-
}
|
|
16295
|
-
}
|
|
16296
|
-
return { event, eventStart, eventEnd };
|
|
16297
|
-
}).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(
|
|
16298
|
-
({ eventStart, eventEnd }) => areIntervalsOverlapping3(
|
|
16299
|
-
{ start: eventStart, end: eventEnd },
|
|
16300
|
-
{ start: dayStart, end: dayEnd }
|
|
16301
|
-
)
|
|
16302
|
-
).map(({ event }) => event).sort((a, b) => {
|
|
16303
|
-
const aStart = a.start ? new Date(a.start).getTime() : a.attend_date ? new Date(a.attend_date).getTime() : 0;
|
|
16304
|
-
const bStart = b.start ? new Date(b.start).getTime() : b.attend_date ? new Date(b.attend_date).getTime() : 0;
|
|
16305
|
-
return aStart - bStart;
|
|
16306
|
-
});
|
|
16277
|
+
return events.filter((event) => {
|
|
16278
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
16279
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
16280
|
+
return isSameDay9(currentDate, eventStart) || isSameDay9(currentDate, eventEnd) || currentDate > eventStart && currentDate < eventEnd;
|
|
16281
|
+
}).sort(
|
|
16282
|
+
(a, b) => new Date(a.start ?? a.end ?? Date.now()).getTime() - new Date(b.start ?? b.end ?? Date.now()).getTime()
|
|
16283
|
+
);
|
|
16307
16284
|
}, [currentDate, events]);
|
|
16308
16285
|
const allDayEvents = useMemo21(() => {
|
|
16309
16286
|
return dayEvents.filter((event) => {
|
|
@@ -16319,10 +16296,10 @@ function DayViewAgenda({
|
|
|
16319
16296
|
const result = [];
|
|
16320
16297
|
const dayStart = startOfDay3(currentDate);
|
|
16321
16298
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
16322
|
-
const aStart = new Date(a.start);
|
|
16323
|
-
const bStart = new Date(b.start);
|
|
16324
|
-
const aEnd = new Date(a.end);
|
|
16325
|
-
const bEnd = new Date(b.end);
|
|
16299
|
+
const aStart = new Date(a.start ?? a.end ?? Date.now());
|
|
16300
|
+
const bStart = new Date(b.start ?? b.end ?? Date.now());
|
|
16301
|
+
const aEnd = new Date(a.end ?? a.start ?? Date.now());
|
|
16302
|
+
const bEnd = new Date(b.end ?? b.start ?? Date.now());
|
|
16326
16303
|
if (aStart < bStart) return -1;
|
|
16327
16304
|
if (aStart > bStart) return 1;
|
|
16328
16305
|
const aDuration = differenceInMinutes7(aEnd, aStart);
|
|
@@ -16331,22 +16308,10 @@ function DayViewAgenda({
|
|
|
16331
16308
|
});
|
|
16332
16309
|
const columns = [];
|
|
16333
16310
|
for (const event of sortedEvents) {
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
if ((!eventStart || !eventEnd) && event.attend_date) {
|
|
16337
|
-
try {
|
|
16338
|
-
const ad = new Date(event.attend_date);
|
|
16339
|
-
const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
|
|
16340
|
-
if (hasTime) {
|
|
16341
|
-
if (!eventStart) eventStart = ad;
|
|
16342
|
-
if (!eventEnd) eventEnd = addHours5(ad, 1);
|
|
16343
|
-
}
|
|
16344
|
-
} catch {
|
|
16345
|
-
}
|
|
16346
|
-
}
|
|
16347
|
-
if (!eventStart || !eventEnd) continue;
|
|
16311
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
16312
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
16348
16313
|
const adjustedStart = isSameDay9(currentDate, eventStart) ? eventStart : dayStart;
|
|
16349
|
-
const adjustedEnd = isSameDay9(currentDate, eventEnd) ? eventEnd :
|
|
16314
|
+
const adjustedEnd = isSameDay9(currentDate, eventEnd) ? eventEnd : addHours4(dayStart, 24);
|
|
16350
16315
|
const startHour = getHours3(adjustedStart) + getMinutes3(adjustedStart) / 60;
|
|
16351
16316
|
const endHour = getHours3(adjustedEnd) + getMinutes3(adjustedEnd) / 60;
|
|
16352
16317
|
const top = (startHour - StartHourAgenda) * WeekCellsHeightAgenda;
|
|
@@ -16362,7 +16327,10 @@ function DayViewAgenda({
|
|
|
16362
16327
|
const overlaps = col.some(
|
|
16363
16328
|
(c) => areIntervalsOverlapping3(
|
|
16364
16329
|
{ end: adjustedEnd, start: adjustedStart },
|
|
16365
|
-
{
|
|
16330
|
+
{
|
|
16331
|
+
end: new Date(c.event.end ?? c.event.start ?? Date.now()),
|
|
16332
|
+
start: new Date(c.event.start ?? c.event.end ?? Date.now())
|
|
16333
|
+
}
|
|
16366
16334
|
)
|
|
16367
16335
|
);
|
|
16368
16336
|
if (!overlaps) {
|
|
@@ -16374,7 +16342,11 @@ function DayViewAgenda({
|
|
|
16374
16342
|
}
|
|
16375
16343
|
const currentColumn = columns[columnIndex] || [];
|
|
16376
16344
|
columns[columnIndex] = currentColumn;
|
|
16377
|
-
currentColumn.push({
|
|
16345
|
+
currentColumn.push({
|
|
16346
|
+
end: adjustedEnd,
|
|
16347
|
+
event,
|
|
16348
|
+
start: adjustedStart
|
|
16349
|
+
});
|
|
16378
16350
|
const width = columnIndex === 0 ? 1 : 0.9;
|
|
16379
16351
|
const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
|
|
16380
16352
|
result.push({
|
|
@@ -16393,19 +16365,16 @@ function DayViewAgenda({
|
|
|
16393
16365
|
onEventSelect(event);
|
|
16394
16366
|
};
|
|
16395
16367
|
const showAllDaySection = allDayEvents.length > 0;
|
|
16396
|
-
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
|
|
16397
|
-
currentDate,
|
|
16398
|
-
"day"
|
|
16399
|
-
);
|
|
16368
|
+
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "day");
|
|
16400
16369
|
return /* @__PURE__ */ jsxs69("div", { className: "contents", "data-slot": "day-view", children: [
|
|
16401
16370
|
showAllDaySection && /* @__PURE__ */ jsx90("div", { className: "border-border/70 border-t bg-muted/50", children: /* @__PURE__ */ jsxs69("div", { className: "grid grid-cols-[3rem_1fr] sm:grid-cols-[4rem_1fr]", children: [
|
|
16402
16371
|
/* @__PURE__ */ jsx90("div", { className: "relative", children: /* @__PURE__ */ jsx90("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "All day" }) }),
|
|
16403
16372
|
/* @__PURE__ */ jsx90("div", { className: "relative border-border/70 border-r p-1 last:border-r-0", children: allDayEvents.map((event) => {
|
|
16404
16373
|
const eventStart = new Date(
|
|
16405
|
-
event.start ?? event.
|
|
16374
|
+
event.start ?? event.end ?? Date.now()
|
|
16406
16375
|
);
|
|
16407
16376
|
const eventEnd = new Date(
|
|
16408
|
-
event.end ?? event.
|
|
16377
|
+
event.end ?? event.start ?? Date.now()
|
|
16409
16378
|
);
|
|
16410
16379
|
const isFirstDay = isSameDay9(currentDate, eventStart);
|
|
16411
16380
|
const isLastDay = isSameDay9(currentDate, eventEnd);
|
|
@@ -16435,12 +16404,8 @@ function DayViewAgenda({
|
|
|
16435
16404
|
/* @__PURE__ */ jsxs69("div", { className: "relative", children: [
|
|
16436
16405
|
positionedEvents.map((positionedEvent) => {
|
|
16437
16406
|
const evt = positionedEvent.event;
|
|
16438
|
-
const eventStart = new Date(
|
|
16439
|
-
|
|
16440
|
-
);
|
|
16441
|
-
const eventEnd = new Date(
|
|
16442
|
-
evt.end ?? evt.attend_date ?? evt.start ?? Date.now()
|
|
16443
|
-
);
|
|
16407
|
+
const eventStart = new Date(evt.start ?? evt.end ?? Date.now());
|
|
16408
|
+
const eventEnd = new Date(evt.end ?? evt.start ?? Date.now());
|
|
16444
16409
|
const isFirstDay = isSameDay9(currentDate, eventStart);
|
|
16445
16410
|
const isLastDay = isSameDay9(currentDate, eventEnd);
|
|
16446
16411
|
return /* @__PURE__ */ jsx90(
|
|
@@ -16540,124 +16505,37 @@ import {
|
|
|
16540
16505
|
subWeeks as subWeeks2
|
|
16541
16506
|
} from "date-fns";
|
|
16542
16507
|
import { ptBR as ptBR12 } from "date-fns/locale";
|
|
16543
|
-
import {
|
|
16508
|
+
import { useMemo as useMemo22, useState as useState33 } from "react";
|
|
16544
16509
|
import { toast as toast4 } from "sonner";
|
|
16545
|
-
import {
|
|
16546
|
-
|
|
16547
|
-
CaretDownIcon as CaretDownIcon6,
|
|
16548
|
-
CaretLeftIcon as CaretLeftIcon4,
|
|
16549
|
-
CaretRightIcon as CaretRightIcon7,
|
|
16550
|
-
Check as Check2
|
|
16551
|
-
} from "@phosphor-icons/react";
|
|
16552
|
-
import { Fragment as Fragment16, jsx as jsx91, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
16510
|
+
import { CaretLeftIcon as CaretLeftIcon4, CaretRightIcon as CaretRightIcon7 } from "@phosphor-icons/react";
|
|
16511
|
+
import { jsx as jsx91, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
16553
16512
|
function EventAgenda({
|
|
16554
16513
|
events = [],
|
|
16555
16514
|
onEventUpdate,
|
|
16556
16515
|
className,
|
|
16557
16516
|
initialView = "month",
|
|
16558
|
-
mode,
|
|
16559
16517
|
initialDate
|
|
16560
16518
|
}) {
|
|
16561
16519
|
const [currentDate, setCurrentDate] = useState33(
|
|
16562
16520
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
16563
16521
|
);
|
|
16564
16522
|
const [view, setView] = useState33(initialView);
|
|
16565
|
-
const
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
(
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
setIsFading(true);
|
|
16572
|
-
window.setTimeout(() => {
|
|
16573
|
-
setView(next);
|
|
16574
|
-
requestAnimationFrame(() => setIsFading(false));
|
|
16575
|
-
}, FADE_DURATION);
|
|
16576
|
-
},
|
|
16577
|
-
[view, mode]
|
|
16578
|
-
);
|
|
16579
|
-
const [isPaging, setIsPaging] = useState33(false);
|
|
16580
|
-
const [pageDirection, setPageDirection] = useState33(
|
|
16581
|
-
null
|
|
16582
|
-
);
|
|
16583
|
-
const PAGE_DURATION = 200;
|
|
16584
|
-
const pageTransition = useCallback16(
|
|
16585
|
-
(applyDateChange, direction) => {
|
|
16586
|
-
setIsPaging(true);
|
|
16587
|
-
setPageDirection(direction);
|
|
16588
|
-
window.setTimeout(() => {
|
|
16589
|
-
applyDateChange();
|
|
16590
|
-
requestAnimationFrame(() => {
|
|
16591
|
-
setIsPaging(false);
|
|
16592
|
-
setPageDirection(null);
|
|
16593
|
-
});
|
|
16594
|
-
}, PAGE_DURATION);
|
|
16595
|
-
},
|
|
16596
|
-
[]
|
|
16597
|
-
);
|
|
16598
|
-
const [isEventDialogOpen, setIsEventDialogOpen] = useState33(false);
|
|
16599
|
-
useEffect27(() => {
|
|
16600
|
-
const handleKeyDown = (e) => {
|
|
16601
|
-
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
16602
|
-
return;
|
|
16603
|
-
}
|
|
16604
|
-
if (mode === "agenda-only") return;
|
|
16605
|
-
switch (e.key.toLowerCase()) {
|
|
16606
|
-
case "m":
|
|
16607
|
-
changeView("month");
|
|
16608
|
-
break;
|
|
16609
|
-
case "w":
|
|
16610
|
-
case "s":
|
|
16611
|
-
changeView("week");
|
|
16612
|
-
break;
|
|
16613
|
-
case "d":
|
|
16614
|
-
changeView("day");
|
|
16615
|
-
break;
|
|
16616
|
-
case "a":
|
|
16617
|
-
changeView("agenda");
|
|
16618
|
-
break;
|
|
16619
|
-
}
|
|
16620
|
-
};
|
|
16621
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
16622
|
-
return () => {
|
|
16623
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
16624
|
-
};
|
|
16625
|
-
}, [isEventDialogOpen, changeView, mode]);
|
|
16626
|
-
useEffect27(() => {
|
|
16627
|
-
if (mode === "agenda-only") setView("agenda");
|
|
16628
|
-
}, [mode]);
|
|
16629
|
-
const handlePrevious = () => {
|
|
16630
|
-
pageTransition(() => {
|
|
16631
|
-
if (view === "month") {
|
|
16632
|
-
setCurrentDate(subMonths2(currentDate, 1));
|
|
16633
|
-
} else if (view === "week") {
|
|
16634
|
-
setCurrentDate(subWeeks2(currentDate, 1));
|
|
16635
|
-
} else if (view === "day") {
|
|
16636
|
-
setCurrentDate(addDays5(currentDate, -1));
|
|
16637
|
-
} else if (view === "agenda") {
|
|
16638
|
-
setCurrentDate(addDays5(currentDate, -AgendaDaysToShowAgenda));
|
|
16639
|
-
}
|
|
16640
|
-
}, "right");
|
|
16523
|
+
const goPrevious = () => {
|
|
16524
|
+
if (view === "month") setCurrentDate((d) => subMonths2(d, 1));
|
|
16525
|
+
else if (view === "week") setCurrentDate((d) => subWeeks2(d, 1));
|
|
16526
|
+
else if (view === "day") setCurrentDate((d) => addDays5(d, -1));
|
|
16527
|
+
else if (view === "agenda")
|
|
16528
|
+
setCurrentDate((d) => addDays5(d, -AgendaDaysToShowAgenda));
|
|
16641
16529
|
};
|
|
16642
|
-
const
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
16648
|
-
} else if (view === "day") {
|
|
16649
|
-
setCurrentDate(addDays5(currentDate, 1));
|
|
16650
|
-
} else if (view === "agenda") {
|
|
16651
|
-
setCurrentDate(addDays5(currentDate, AgendaDaysToShowAgenda));
|
|
16652
|
-
}
|
|
16653
|
-
}, "left");
|
|
16654
|
-
};
|
|
16655
|
-
const handleToday = () => {
|
|
16656
|
-
setCurrentDate(/* @__PURE__ */ new Date());
|
|
16530
|
+
const goNext = () => {
|
|
16531
|
+
if (view === "month") setCurrentDate((d) => addMonths2(d, 1));
|
|
16532
|
+
else if (view === "week") setCurrentDate((d) => addWeeks2(d, 1));
|
|
16533
|
+
else if (view === "day") setCurrentDate((d) => addDays5(d, 1));
|
|
16534
|
+
else if (view === "agenda")
|
|
16535
|
+
setCurrentDate((d) => addDays5(d, AgendaDaysToShowAgenda));
|
|
16657
16536
|
};
|
|
16658
16537
|
const handleEventSelect = (event) => {
|
|
16659
16538
|
console.log("Event selected:", event);
|
|
16660
|
-
setIsEventDialogOpen(true);
|
|
16661
16539
|
};
|
|
16662
16540
|
const handleEventUpdate = (updatedEvent) => {
|
|
16663
16541
|
onEventUpdate?.(updatedEvent);
|
|
@@ -16667,258 +16545,139 @@ function EventAgenda({
|
|
|
16667
16545
|
position: "bottom-left"
|
|
16668
16546
|
});
|
|
16669
16547
|
};
|
|
16548
|
+
const viewLabel = (v, condensed = false) => {
|
|
16549
|
+
const labels = {
|
|
16550
|
+
month: { full: "M\xEAs", short: "M" },
|
|
16551
|
+
week: { full: "Semana", short: "S" },
|
|
16552
|
+
day: { full: "Dia", short: "D" },
|
|
16553
|
+
agenda: { full: "Agenda", short: "A" }
|
|
16554
|
+
};
|
|
16555
|
+
const entry = labels[v] || { full: v, short: v };
|
|
16556
|
+
return condensed ? entry.short : entry.full;
|
|
16557
|
+
};
|
|
16670
16558
|
const viewTitle = useMemo22(() => {
|
|
16671
|
-
const capitalize = (s) => s
|
|
16672
|
-
if (view === "month")
|
|
16559
|
+
const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
16560
|
+
if (view === "month")
|
|
16673
16561
|
return capitalize(format14(currentDate, "MMMM yyyy", { locale: ptBR12 }));
|
|
16674
|
-
}
|
|
16675
16562
|
if (view === "week") {
|
|
16676
16563
|
const start = startOfWeek6(currentDate, { weekStartsOn: 1 });
|
|
16677
16564
|
const end = endOfWeek6(currentDate, { weekStartsOn: 1 });
|
|
16678
|
-
if (isSameMonth3(start, end))
|
|
16565
|
+
if (isSameMonth3(start, end))
|
|
16679
16566
|
return capitalize(format14(start, "MMMM yyyy", { locale: ptBR12 }));
|
|
16680
|
-
}
|
|
16681
16567
|
const s1 = capitalize(format14(start, "MMM", { locale: ptBR12 }));
|
|
16682
16568
|
const s2 = capitalize(format14(end, "MMM yyyy", { locale: ptBR12 }));
|
|
16683
16569
|
return `${s1} - ${s2}`;
|
|
16684
16570
|
}
|
|
16685
|
-
if (view === "day")
|
|
16686
|
-
|
|
16687
|
-
const month = capitalize(format14(currentDate, "MMMM", { locale: ptBR12 }));
|
|
16688
|
-
const year = format14(currentDate, "yyyy", { locale: ptBR12 });
|
|
16689
|
-
const short = `${dayNum} de ${month} de ${year}`;
|
|
16690
|
-
return /* @__PURE__ */ jsxs70(Fragment16, { children: [
|
|
16691
|
-
/* @__PURE__ */ jsx91("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
16692
|
-
/* @__PURE__ */ jsx91("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short })
|
|
16693
|
-
] });
|
|
16694
|
-
}
|
|
16571
|
+
if (view === "day")
|
|
16572
|
+
return format14(currentDate, "d 'de' MMMM 'de' yyyy", { locale: ptBR12 });
|
|
16695
16573
|
if (view === "agenda") {
|
|
16696
16574
|
const start = currentDate;
|
|
16697
16575
|
const end = addDays5(currentDate, AgendaDaysToShowAgenda - 1);
|
|
16698
|
-
if (isSameMonth3(start, end))
|
|
16576
|
+
if (isSameMonth3(start, end))
|
|
16699
16577
|
return capitalize(format14(start, "MMMM yyyy", { locale: ptBR12 }));
|
|
16700
|
-
}
|
|
16701
16578
|
const s1 = capitalize(format14(start, "MMMM", { locale: ptBR12 }));
|
|
16702
16579
|
const s2 = capitalize(format14(end, "MMMM yyyy", { locale: ptBR12 }));
|
|
16703
16580
|
return `${s1} - ${s2}`;
|
|
16704
16581
|
}
|
|
16705
16582
|
return capitalize(format14(currentDate, "MMMM yyyy", { locale: ptBR12 }));
|
|
16706
16583
|
}, [currentDate, view]);
|
|
16707
|
-
|
|
16708
|
-
|
|
16709
|
-
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
|
|
16715
|
-
|
|
16584
|
+
return /* @__PURE__ */ jsx91(
|
|
16585
|
+
"div",
|
|
16586
|
+
{
|
|
16587
|
+
className: cn(
|
|
16588
|
+
"flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
|
|
16589
|
+
className
|
|
16590
|
+
),
|
|
16591
|
+
style: {
|
|
16592
|
+
"--event-gap": `${EventGapAgenda}px`,
|
|
16593
|
+
"--event-height": `${EventHeightAgenda}px`,
|
|
16594
|
+
"--week-cells-height": `${WeekCellsHeightAgenda}px`
|
|
16595
|
+
},
|
|
16596
|
+
children: /* @__PURE__ */ jsxs70(CalendarDndProviderAgenda, { onEventUpdate: handleEventUpdate, children: [
|
|
16597
|
+
/* @__PURE__ */ jsxs70("div", { className: "flex items-center justify-between p-2 sm:p-4", children: [
|
|
16716
16598
|
/* @__PURE__ */ jsxs70("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
16717
|
-
/* @__PURE__ */ jsxs70(
|
|
16718
|
-
ButtonBase,
|
|
16719
|
-
{
|
|
16720
|
-
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
16721
|
-
onClick: handleToday,
|
|
16722
|
-
variant: "outline",
|
|
16723
|
-
children: [
|
|
16724
|
-
/* @__PURE__ */ jsx91(
|
|
16725
|
-
CalendarIcon6,
|
|
16726
|
-
{
|
|
16727
|
-
"aria-hidden": "true",
|
|
16728
|
-
className: "min-[480px]:hidden",
|
|
16729
|
-
size: 16
|
|
16730
|
-
}
|
|
16731
|
-
),
|
|
16732
|
-
/* @__PURE__ */ jsx91("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
16733
|
-
]
|
|
16734
|
-
}
|
|
16735
|
-
),
|
|
16736
16599
|
/* @__PURE__ */ jsxs70("div", { className: "flex items-center sm:gap-2", children: [
|
|
16737
16600
|
/* @__PURE__ */ jsx91(
|
|
16738
16601
|
ButtonBase,
|
|
16739
16602
|
{
|
|
16740
16603
|
"aria-label": "Anterior",
|
|
16741
|
-
onClick:
|
|
16604
|
+
onClick: goPrevious,
|
|
16742
16605
|
size: "icon",
|
|
16743
16606
|
variant: "ghost",
|
|
16744
|
-
children: /* @__PURE__ */ jsx91(CaretLeftIcon4, { "aria-hidden":
|
|
16607
|
+
children: /* @__PURE__ */ jsx91(CaretLeftIcon4, { "aria-hidden": true, size: 16 })
|
|
16745
16608
|
}
|
|
16746
16609
|
),
|
|
16747
16610
|
/* @__PURE__ */ jsx91(
|
|
16748
16611
|
ButtonBase,
|
|
16749
16612
|
{
|
|
16750
16613
|
"aria-label": "Pr\xF3ximo",
|
|
16751
|
-
onClick:
|
|
16614
|
+
onClick: goNext,
|
|
16752
16615
|
size: "icon",
|
|
16753
16616
|
variant: "ghost",
|
|
16754
|
-
children: /* @__PURE__ */ jsx91(CaretRightIcon7, { "aria-hidden":
|
|
16617
|
+
children: /* @__PURE__ */ jsx91(CaretRightIcon7, { "aria-hidden": true, size: 16 })
|
|
16755
16618
|
}
|
|
16756
16619
|
)
|
|
16757
16620
|
] }),
|
|
16758
|
-
/* @__PURE__ */ jsx91("h2", { className: "font-semibold text-xl", children: viewTitle })
|
|
16621
|
+
/* @__PURE__ */ jsx91("h2", { className: "font-semibold text-md sm:text-xl", children: viewTitle })
|
|
16759
16622
|
] }),
|
|
16760
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx91(
|
|
16761
|
-
|
|
16762
|
-
ButtonBase,
|
|
16763
|
-
{
|
|
16764
|
-
className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
|
|
16765
|
-
variant: "outline",
|
|
16766
|
-
children: [
|
|
16767
|
-
/* @__PURE__ */ jsxs70("span", { className: "flex items-center gap-2", children: [
|
|
16768
|
-
/* @__PURE__ */ jsx91("span", { className: "hidden min-[480px]:inline-block", children: (() => {
|
|
16769
|
-
const labels = {
|
|
16770
|
-
month: "M\xEAs",
|
|
16771
|
-
week: "Semana",
|
|
16772
|
-
day: "Dia",
|
|
16773
|
-
agenda: "Agenda"
|
|
16774
|
-
};
|
|
16775
|
-
return labels[view] || view;
|
|
16776
|
-
})() }),
|
|
16777
|
-
/* @__PURE__ */ jsx91("span", { className: "min-[480px]:hidden", children: (() => {
|
|
16778
|
-
const labels = {
|
|
16779
|
-
month: "M",
|
|
16780
|
-
week: "S",
|
|
16781
|
-
day: "D",
|
|
16782
|
-
agenda: "A"
|
|
16783
|
-
};
|
|
16784
|
-
return labels[view] || view;
|
|
16785
|
-
})() })
|
|
16786
|
-
] }),
|
|
16787
|
-
/* @__PURE__ */ jsx91(
|
|
16788
|
-
CaretDownIcon6,
|
|
16789
|
-
{
|
|
16790
|
-
"aria-hidden": "true",
|
|
16791
|
-
className: "-me-1 opacity-60",
|
|
16792
|
-
size: 16
|
|
16793
|
-
}
|
|
16794
|
-
)
|
|
16795
|
-
]
|
|
16796
|
-
}
|
|
16797
|
-
) }),
|
|
16798
|
-
mode === "agenda-only" ? null : /* @__PURE__ */ jsxs70(
|
|
16799
|
-
DropDownMenuContentBase,
|
|
16800
|
-
{
|
|
16801
|
-
align: "end",
|
|
16802
|
-
className: "min-w-32 rounded-md p-1",
|
|
16803
|
-
children: [
|
|
16804
|
-
/* @__PURE__ */ jsxs70(
|
|
16805
|
-
DropDownMenuItemBase,
|
|
16806
|
-
{
|
|
16807
|
-
onClick: () => changeView("month"),
|
|
16808
|
-
className: cn(
|
|
16809
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16810
|
-
view === "month"
|
|
16811
|
-
),
|
|
16812
|
-
children: [
|
|
16813
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx91("span", { children: " M\xEAs " }) }),
|
|
16814
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: view === "month" ? /* @__PURE__ */ jsx91(Check2, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ jsx91(DropDownMenuShortcutBase, { children: "M" }) })
|
|
16815
|
-
]
|
|
16816
|
-
}
|
|
16817
|
-
),
|
|
16818
|
-
/* @__PURE__ */ jsxs70(
|
|
16819
|
-
DropDownMenuItemBase,
|
|
16820
|
-
{
|
|
16821
|
-
onClick: () => changeView("week"),
|
|
16822
|
-
className: cn(
|
|
16823
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16824
|
-
view === "week"
|
|
16825
|
-
),
|
|
16826
|
-
children: [
|
|
16827
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: "Semana" }),
|
|
16828
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: view === "week" ? /* @__PURE__ */ jsx91(Check2, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ jsx91(DropDownMenuShortcutBase, { children: "S" }) })
|
|
16829
|
-
]
|
|
16830
|
-
}
|
|
16831
|
-
),
|
|
16832
|
-
/* @__PURE__ */ jsxs70(
|
|
16833
|
-
DropDownMenuItemBase,
|
|
16834
|
-
{
|
|
16835
|
-
onClick: () => changeView("day"),
|
|
16836
|
-
className: cn(
|
|
16837
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16838
|
-
view === "day"
|
|
16839
|
-
),
|
|
16840
|
-
children: [
|
|
16841
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: "Dia" }),
|
|
16842
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: view === "day" ? /* @__PURE__ */ jsx91(Check2, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ jsx91(DropDownMenuShortcutBase, { children: "D" }) })
|
|
16843
|
-
]
|
|
16844
|
-
}
|
|
16845
|
-
),
|
|
16846
|
-
/* @__PURE__ */ jsxs70(
|
|
16847
|
-
DropDownMenuItemBase,
|
|
16848
|
-
{
|
|
16849
|
-
onClick: () => changeView("agenda"),
|
|
16850
|
-
className: cn(
|
|
16851
|
-
"flex items-center justify-between gap-2 px-3 py-2 rounded",
|
|
16852
|
-
view === "agenda"
|
|
16853
|
-
),
|
|
16854
|
-
children: [
|
|
16855
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: "Agenda" }),
|
|
16856
|
-
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: view === "agenda" ? /* @__PURE__ */ jsx91(Check2, { "aria-hidden": true, className: "opacity-80", size: 14 }) : /* @__PURE__ */ jsx91(DropDownMenuShortcutBase, { children: "A" }) })
|
|
16857
|
-
]
|
|
16858
|
-
}
|
|
16859
|
-
)
|
|
16860
|
-
]
|
|
16861
|
-
}
|
|
16862
|
-
)
|
|
16863
|
-
] }) }) })
|
|
16864
|
-
]
|
|
16865
|
-
}
|
|
16866
|
-
),
|
|
16867
|
-
/* @__PURE__ */ jsxs70(
|
|
16868
|
-
"div",
|
|
16869
|
-
{
|
|
16870
|
-
className: cn(
|
|
16871
|
-
"flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
16872
|
-
isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
|
|
16873
|
-
),
|
|
16874
|
-
"aria-live": "polite",
|
|
16875
|
-
children: [
|
|
16876
|
-
view === "month" && /* @__PURE__ */ jsx91(
|
|
16877
|
-
MonthViewAgenda,
|
|
16623
|
+
/* @__PURE__ */ jsx91("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx91(
|
|
16624
|
+
Select,
|
|
16878
16625
|
{
|
|
16879
|
-
|
|
16880
|
-
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
onEventSelect: handleEventSelect
|
|
16890
|
-
}
|
|
16891
|
-
),
|
|
16892
|
-
view === "day" && /* @__PURE__ */ jsx91(
|
|
16893
|
-
DayViewAgenda,
|
|
16894
|
-
{
|
|
16895
|
-
currentDate,
|
|
16896
|
-
events,
|
|
16897
|
-
onEventSelect: handleEventSelect
|
|
16898
|
-
}
|
|
16899
|
-
),
|
|
16900
|
-
view === "agenda" && /* @__PURE__ */ jsx91(
|
|
16901
|
-
Agenda,
|
|
16902
|
-
{
|
|
16903
|
-
currentDate,
|
|
16904
|
-
events,
|
|
16905
|
-
onEventSelect: handleEventSelect
|
|
16626
|
+
selected: view,
|
|
16627
|
+
onChange: (v) => {
|
|
16628
|
+
setView(v);
|
|
16629
|
+
},
|
|
16630
|
+
items: ["month", "week", "day", "agenda"].map((v) => ({
|
|
16631
|
+
label: viewLabel(v),
|
|
16632
|
+
value: v
|
|
16633
|
+
})),
|
|
16634
|
+
className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
|
|
16635
|
+
placeholder: viewLabel(view)
|
|
16906
16636
|
}
|
|
16907
|
-
)
|
|
16908
|
-
]
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16637
|
+
) })
|
|
16638
|
+
] }),
|
|
16639
|
+
/* @__PURE__ */ jsxs70(
|
|
16640
|
+
"div",
|
|
16641
|
+
{
|
|
16642
|
+
className: "flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
16643
|
+
"aria-live": "polite",
|
|
16644
|
+
children: [
|
|
16645
|
+
view === "month" && /* @__PURE__ */ jsx91(
|
|
16646
|
+
MonthViewAgenda,
|
|
16647
|
+
{
|
|
16648
|
+
currentDate,
|
|
16649
|
+
events,
|
|
16650
|
+
onEventSelect: handleEventSelect
|
|
16651
|
+
}
|
|
16652
|
+
),
|
|
16653
|
+
view === "week" && /* @__PURE__ */ jsx91(
|
|
16654
|
+
WeekViewAgenda,
|
|
16655
|
+
{
|
|
16656
|
+
currentDate,
|
|
16657
|
+
events,
|
|
16658
|
+
onEventSelect: handleEventSelect
|
|
16659
|
+
}
|
|
16660
|
+
),
|
|
16661
|
+
view === "day" && /* @__PURE__ */ jsx91(
|
|
16662
|
+
DayViewAgenda,
|
|
16663
|
+
{
|
|
16664
|
+
currentDate,
|
|
16665
|
+
events,
|
|
16666
|
+
onEventSelect: handleEventSelect
|
|
16667
|
+
}
|
|
16668
|
+
),
|
|
16669
|
+
view === "agenda" && /* @__PURE__ */ jsx91(
|
|
16670
|
+
Agenda,
|
|
16671
|
+
{
|
|
16672
|
+
currentDate,
|
|
16673
|
+
events,
|
|
16674
|
+
onEventSelect: handleEventSelect
|
|
16675
|
+
}
|
|
16676
|
+
)
|
|
16677
|
+
]
|
|
16678
|
+
}
|
|
16679
|
+
)
|
|
16680
|
+
] })
|
|
16922
16681
|
}
|
|
16923
16682
|
);
|
|
16924
16683
|
}
|
|
@@ -16942,14 +16701,12 @@ function UndatedEvents({
|
|
|
16942
16701
|
show = true
|
|
16943
16702
|
}) {
|
|
16944
16703
|
const undatedEvents = useMemo23(
|
|
16945
|
-
() => events.filter(
|
|
16946
|
-
(e) => !(isValidDate5(e.start) && isValidDate5(e.end)) && !isValidDate5(e.attend_date)
|
|
16947
|
-
),
|
|
16704
|
+
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
16948
16705
|
[events]
|
|
16949
16706
|
);
|
|
16950
16707
|
if (!show || undatedEvents.length === 0) return null;
|
|
16951
16708
|
return /* @__PURE__ */ jsx92("div", { className, children: /* @__PURE__ */ jsxs71("div", { className: "relative border-border/70 border-t", children: [
|
|
16952
|
-
/* @__PURE__ */ jsx92("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase sm:pe-4 text-lg", children: title }),
|
|
16709
|
+
/* @__PURE__ */ jsx92("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase sm:pe-4 text-md sm:text-lg", children: title }),
|
|
16953
16710
|
/* @__PURE__ */ jsx92("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ jsx92(
|
|
16954
16711
|
EventItemAgenda,
|
|
16955
16712
|
{
|
|
@@ -17024,7 +16781,7 @@ import {
|
|
|
17024
16781
|
startOfWeek as startOfWeek7
|
|
17025
16782
|
} from "date-fns";
|
|
17026
16783
|
import { ptBR as ptBR13 } from "date-fns/locale";
|
|
17027
|
-
import { useEffect as
|
|
16784
|
+
import { useEffect as useEffect27, useMemo as useMemo25, useState as useState35 } from "react";
|
|
17028
16785
|
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
17029
16786
|
import { jsx as jsx93, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
17030
16787
|
function MonthViewAgenda({
|
|
@@ -17068,7 +16825,7 @@ function MonthViewAgenda({
|
|
|
17068
16825
|
eventGap: EventGapAgenda,
|
|
17069
16826
|
eventHeight: EventHeightAgenda
|
|
17070
16827
|
});
|
|
17071
|
-
|
|
16828
|
+
useEffect27(() => {
|
|
17072
16829
|
setIsMounted(true);
|
|
17073
16830
|
}, []);
|
|
17074
16831
|
return /* @__PURE__ */ jsxs72("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -17130,10 +16887,10 @@ function MonthViewAgenda({
|
|
|
17130
16887
|
children: [
|
|
17131
16888
|
sortEventsAgenda(allDayEvents).map((event, index) => {
|
|
17132
16889
|
const eventStart = new Date(
|
|
17133
|
-
event.start ?? event.
|
|
16890
|
+
event.start ?? event.end ?? Date.now()
|
|
17134
16891
|
);
|
|
17135
16892
|
const eventEnd = new Date(
|
|
17136
|
-
event.end ?? event.
|
|
16893
|
+
event.end ?? event.start ?? Date.now()
|
|
17137
16894
|
);
|
|
17138
16895
|
const isFirstDay = isSameDay10(day, eventStart);
|
|
17139
16896
|
const isLastDay = isSameDay10(day, eventEnd);
|
|
@@ -17273,7 +17030,7 @@ function MonthViewAgenda({
|
|
|
17273
17030
|
|
|
17274
17031
|
// src/components/event-calendar-view/WeekView.tsx
|
|
17275
17032
|
import {
|
|
17276
|
-
addHours as
|
|
17033
|
+
addHours as addHours5,
|
|
17277
17034
|
areIntervalsOverlapping as areIntervalsOverlapping4,
|
|
17278
17035
|
differenceInMinutes as differenceInMinutes8,
|
|
17279
17036
|
eachDayOfInterval as eachDayOfInterval4,
|
|
@@ -17288,7 +17045,6 @@ import {
|
|
|
17288
17045
|
startOfDay as startOfDay4,
|
|
17289
17046
|
startOfWeek as startOfWeek8
|
|
17290
17047
|
} from "date-fns";
|
|
17291
|
-
import { endOfDay as endOfDay2 } from "date-fns";
|
|
17292
17048
|
import { ptBR as ptBR14 } from "date-fns/locale";
|
|
17293
17049
|
import { useMemo as useMemo26 } from "react";
|
|
17294
17050
|
|
|
@@ -17308,7 +17064,8 @@ function DraggableEvent2({
|
|
|
17308
17064
|
multiDayWidth,
|
|
17309
17065
|
isFirstDay = true,
|
|
17310
17066
|
isLastDay = true,
|
|
17311
|
-
"aria-hidden": ariaHidden
|
|
17067
|
+
"aria-hidden": ariaHidden,
|
|
17068
|
+
draggable = true
|
|
17312
17069
|
}) {
|
|
17313
17070
|
const { activeId } = useCalendarDndAgenda();
|
|
17314
17071
|
const elementRef = useRef17(null);
|
|
@@ -17327,6 +17084,8 @@ function DraggableEvent2({
|
|
|
17327
17084
|
multiDayWidth,
|
|
17328
17085
|
view
|
|
17329
17086
|
},
|
|
17087
|
+
// allow callers to disable dragging
|
|
17088
|
+
disabled: !draggable,
|
|
17330
17089
|
id: `${event.id}-${view}`
|
|
17331
17090
|
});
|
|
17332
17091
|
const handleMouseDown = (e) => {
|
|
@@ -17404,7 +17163,8 @@ function WeekViewAgenda({
|
|
|
17404
17163
|
currentDate,
|
|
17405
17164
|
events,
|
|
17406
17165
|
onEventSelect,
|
|
17407
|
-
onEventCreate
|
|
17166
|
+
onEventCreate,
|
|
17167
|
+
showUndatedEvents
|
|
17408
17168
|
}) {
|
|
17409
17169
|
const days = useMemo26(() => {
|
|
17410
17170
|
const weekStart2 = startOfWeek8(currentDate, { weekStartsOn: 0 });
|
|
@@ -17418,73 +17178,52 @@ function WeekViewAgenda({
|
|
|
17418
17178
|
const hours = useMemo26(() => {
|
|
17419
17179
|
const dayStart = startOfDay4(currentDate);
|
|
17420
17180
|
return eachHourOfInterval4({
|
|
17421
|
-
end:
|
|
17422
|
-
start:
|
|
17181
|
+
end: addHours5(dayStart, EndHour - 1),
|
|
17182
|
+
start: addHours5(dayStart, StartHour)
|
|
17423
17183
|
});
|
|
17424
17184
|
}, [currentDate]);
|
|
17425
17185
|
const allDayEvents = useMemo26(() => {
|
|
17426
17186
|
return events.filter((event) => {
|
|
17427
17187
|
return event.allDay || isMultiDayEventAgenda(event);
|
|
17428
17188
|
}).filter((event) => {
|
|
17429
|
-
const eventStart = event.start ? new Date(event.start) : void 0;
|
|
17430
|
-
const eventEnd = event.end ? new Date(event.end) : void 0;
|
|
17189
|
+
const eventStart = event.start ? new Date(event.start) : event.end ? new Date(event.end) : void 0;
|
|
17190
|
+
const eventEnd = event.end ? new Date(event.end) : event.start ? new Date(event.start) : void 0;
|
|
17431
17191
|
return days.some((day) => {
|
|
17432
17192
|
if (eventStart && isSameDay11(day, eventStart)) return true;
|
|
17433
17193
|
if (eventEnd && isSameDay11(day, eventEnd)) return true;
|
|
17434
|
-
if (eventStart && eventEnd && day > eventStart && day < eventEnd)
|
|
17194
|
+
if (eventStart && eventEnd && day > eventStart && day < eventEnd)
|
|
17195
|
+
return true;
|
|
17435
17196
|
return false;
|
|
17436
17197
|
});
|
|
17437
17198
|
});
|
|
17438
17199
|
}, [events, days]);
|
|
17439
17200
|
const processedDayEvents = useMemo26(() => {
|
|
17440
17201
|
const result = days.map((day) => {
|
|
17441
|
-
const
|
|
17442
|
-
|
|
17443
|
-
|
|
17444
|
-
|
|
17445
|
-
|
|
17446
|
-
const ad = new Date(event.attend_date);
|
|
17447
|
-
const hasTime = ad.getHours() !== 0 || ad.getMinutes() !== 0 || ad.getSeconds() !== 0 || ad.getMilliseconds() !== 0;
|
|
17448
|
-
if (hasTime) {
|
|
17449
|
-
if (!eventStart) eventStart = ad;
|
|
17450
|
-
if (!eventEnd) eventEnd = addHours6(ad, 1);
|
|
17451
|
-
}
|
|
17452
|
-
} catch {
|
|
17453
|
-
}
|
|
17454
|
-
}
|
|
17455
|
-
return { event, eventStart, eventEnd };
|
|
17456
|
-
}).filter(({ eventStart, eventEnd }) => !!eventStart && !!eventEnd).filter(({ eventStart, eventEnd }) => {
|
|
17457
|
-
const dayStart2 = startOfDay4(day);
|
|
17458
|
-
const dayEnd = endOfDay2(day);
|
|
17459
|
-
return areIntervalsOverlapping4(
|
|
17460
|
-
{ start: eventStart, end: eventEnd },
|
|
17461
|
-
{ start: dayStart2, end: dayEnd }
|
|
17462
|
-
);
|
|
17202
|
+
const dayEvents = events.filter((event) => {
|
|
17203
|
+
if (event.allDay || isMultiDayEventAgenda(event)) return false;
|
|
17204
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
17205
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
17206
|
+
return isSameDay11(day, eventStart) || isSameDay11(day, eventEnd) || eventStart < day && eventEnd > day;
|
|
17463
17207
|
});
|
|
17464
|
-
const sortedEvents = [...
|
|
17465
|
-
const aStart = a.
|
|
17466
|
-
const bStart = b.
|
|
17208
|
+
const sortedEvents = [...dayEvents].sort((a, b) => {
|
|
17209
|
+
const aStart = new Date(a.start ?? a.end ?? Date.now());
|
|
17210
|
+
const bStart = new Date(b.start ?? b.end ?? Date.now());
|
|
17211
|
+
const aEnd = new Date(a.end ?? a.start ?? Date.now());
|
|
17212
|
+
const bEnd = new Date(b.end ?? b.start ?? Date.now());
|
|
17467
17213
|
if (aStart < bStart) return -1;
|
|
17468
17214
|
if (aStart > bStart) return 1;
|
|
17469
|
-
const aDuration = differenceInMinutes8(
|
|
17470
|
-
|
|
17471
|
-
a.eventStart
|
|
17472
|
-
);
|
|
17473
|
-
const bDuration = differenceInMinutes8(
|
|
17474
|
-
b.eventEnd,
|
|
17475
|
-
b.eventStart
|
|
17476
|
-
);
|
|
17215
|
+
const aDuration = differenceInMinutes8(aEnd, aStart);
|
|
17216
|
+
const bDuration = differenceInMinutes8(bEnd, bStart);
|
|
17477
17217
|
return bDuration - aDuration;
|
|
17478
17218
|
});
|
|
17479
17219
|
const positionedEvents = [];
|
|
17480
17220
|
const dayStart = startOfDay4(day);
|
|
17481
17221
|
const columns = [];
|
|
17482
|
-
for (const
|
|
17483
|
-
const
|
|
17484
|
-
const
|
|
17485
|
-
const eventEnd = item.eventEnd;
|
|
17222
|
+
for (const event of sortedEvents) {
|
|
17223
|
+
const eventStart = new Date(event.start ?? event.end ?? Date.now());
|
|
17224
|
+
const eventEnd = new Date(event.end ?? event.start ?? Date.now());
|
|
17486
17225
|
const adjustedStart = isSameDay11(day, eventStart) ? eventStart : dayStart;
|
|
17487
|
-
const adjustedEnd = isSameDay11(day, eventEnd) ? eventEnd :
|
|
17226
|
+
const adjustedEnd = isSameDay11(day, eventEnd) ? eventEnd : addHours5(dayStart, 24);
|
|
17488
17227
|
const startHour = getHours4(adjustedStart) + getMinutes4(adjustedStart) / 60;
|
|
17489
17228
|
const endHour = getHours4(adjustedEnd) + getMinutes4(adjustedEnd) / 60;
|
|
17490
17229
|
const top = (startHour - StartHour) * WeekCellsHeightAgenda;
|
|
@@ -17500,7 +17239,10 @@ function WeekViewAgenda({
|
|
|
17500
17239
|
const overlaps = col.some(
|
|
17501
17240
|
(c) => areIntervalsOverlapping4(
|
|
17502
17241
|
{ end: adjustedEnd, start: adjustedStart },
|
|
17503
|
-
{
|
|
17242
|
+
{
|
|
17243
|
+
end: new Date(c.event.end ?? c.event.start ?? Date.now()),
|
|
17244
|
+
start: new Date(c.event.start ?? c.event.end ?? Date.now())
|
|
17245
|
+
}
|
|
17504
17246
|
)
|
|
17505
17247
|
);
|
|
17506
17248
|
if (!overlaps) {
|
|
@@ -17512,9 +17254,9 @@ function WeekViewAgenda({
|
|
|
17512
17254
|
}
|
|
17513
17255
|
const currentColumn = columns[columnIndex] || [];
|
|
17514
17256
|
columns[columnIndex] = currentColumn;
|
|
17515
|
-
currentColumn.push({
|
|
17516
|
-
const width = columnIndex === 0 ? 1 : 0.
|
|
17517
|
-
const left = columnIndex === 0 ? 0 : columnIndex * 0.
|
|
17257
|
+
currentColumn.push({ end: adjustedEnd, event });
|
|
17258
|
+
const width = columnIndex === 0 ? 1 : 0.9;
|
|
17259
|
+
const left = columnIndex === 0 ? 0 : columnIndex * 0.1;
|
|
17518
17260
|
positionedEvents.push({
|
|
17519
17261
|
event,
|
|
17520
17262
|
height,
|
|
@@ -17522,6 +17264,7 @@ function WeekViewAgenda({
|
|
|
17522
17264
|
top,
|
|
17523
17265
|
width,
|
|
17524
17266
|
zIndex: 10 + columnIndex
|
|
17267
|
+
// Higher columns get higher z-index
|
|
17525
17268
|
});
|
|
17526
17269
|
}
|
|
17527
17270
|
return positionedEvents;
|
|
@@ -17533,10 +17276,7 @@ function WeekViewAgenda({
|
|
|
17533
17276
|
onEventSelect(event);
|
|
17534
17277
|
};
|
|
17535
17278
|
const showAllDaySection = allDayEvents.length > 0;
|
|
17536
|
-
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(
|
|
17537
|
-
currentDate,
|
|
17538
|
-
"week"
|
|
17539
|
-
);
|
|
17279
|
+
const { currentTimePosition, currentTimeVisible } = useCurrentTimeIndicatorAgenda(currentDate, "week");
|
|
17540
17280
|
return /* @__PURE__ */ jsxs73("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
|
|
17541
17281
|
/* @__PURE__ */ jsxs73("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background", children: [
|
|
17542
17282
|
/* @__PURE__ */ jsx95("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ jsx95("span", { className: "max-[479px]:sr-only", children: format16(/* @__PURE__ */ new Date(), "O") }) }),
|
|
@@ -17558,7 +17298,7 @@ function WeekViewAgenda({
|
|
|
17558
17298
|
))
|
|
17559
17299
|
] }),
|
|
17560
17300
|
showAllDaySection && /* @__PURE__ */ jsx95("div", { className: "border-border/70 border-b bg-muted/50", children: /* @__PURE__ */ jsxs73("div", { className: "grid grid-cols-8", children: [
|
|
17561
|
-
/* @__PURE__ */ jsx95("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ jsx95("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "
|
|
17301
|
+
/* @__PURE__ */ jsx95("div", { className: "relative border-border/70 border-r", children: /* @__PURE__ */ jsx95("span", { className: "absolute bottom-0 left-0 h-6 w-16 max-w-full pe-2 text-right text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: "Todo Dia" }) }),
|
|
17562
17302
|
days.map((day, dayIndex) => {
|
|
17563
17303
|
const dayAllDayEvents = allDayEvents.filter((event) => {
|
|
17564
17304
|
const eventStart = event.start ? new Date(event.start) : void 0;
|
|
@@ -17639,6 +17379,7 @@ function WeekViewAgenda({
|
|
|
17639
17379
|
event: positionedEvent.event,
|
|
17640
17380
|
height: positionedEvent.height,
|
|
17641
17381
|
onClick: (e) => handleEventClick(positionedEvent.event, e),
|
|
17382
|
+
draggable: false,
|
|
17642
17383
|
showTime: true,
|
|
17643
17384
|
view: "week"
|
|
17644
17385
|
}
|
|
@@ -17696,7 +17437,15 @@ function WeekViewAgenda({
|
|
|
17696
17437
|
},
|
|
17697
17438
|
day.toString()
|
|
17698
17439
|
))
|
|
17699
|
-
] })
|
|
17440
|
+
] }),
|
|
17441
|
+
/* @__PURE__ */ jsx95(
|
|
17442
|
+
UndatedEvents,
|
|
17443
|
+
{
|
|
17444
|
+
events,
|
|
17445
|
+
onEventSelect,
|
|
17446
|
+
show: showUndatedEvents
|
|
17447
|
+
}
|
|
17448
|
+
)
|
|
17700
17449
|
] });
|
|
17701
17450
|
}
|
|
17702
17451
|
|
|
@@ -17706,13 +17455,13 @@ import React45, { useState as useState37 } from "react";
|
|
|
17706
17455
|
import { jsx as jsx96, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
17707
17456
|
|
|
17708
17457
|
// src/hooks/use-drag.tsx
|
|
17709
|
-
import { useState as useState38, useCallback as
|
|
17458
|
+
import { useState as useState38, useCallback as useCallback16, useRef as useRef18, useEffect as useEffect28 } from "react";
|
|
17710
17459
|
var useDrag = (options = {}) => {
|
|
17711
17460
|
const [isDragging, setIsDragging] = useState38(null);
|
|
17712
17461
|
const [positions, setPositions] = useState38({});
|
|
17713
17462
|
const dragStartPos = useRef18(null);
|
|
17714
17463
|
const dragId = useRef18(null);
|
|
17715
|
-
const handleMouseDown =
|
|
17464
|
+
const handleMouseDown = useCallback16((id, e) => {
|
|
17716
17465
|
e.preventDefault();
|
|
17717
17466
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
17718
17467
|
dragStartPos.current = {
|
|
@@ -17725,7 +17474,7 @@ var useDrag = (options = {}) => {
|
|
|
17725
17474
|
setIsDragging(id);
|
|
17726
17475
|
options.onDragStart?.(id);
|
|
17727
17476
|
}, [positions, options]);
|
|
17728
|
-
const handleMouseMove =
|
|
17477
|
+
const handleMouseMove = useCallback16((e) => {
|
|
17729
17478
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
17730
17479
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
17731
17480
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -17741,7 +17490,7 @@ var useDrag = (options = {}) => {
|
|
|
17741
17490
|
}));
|
|
17742
17491
|
options.onDrag?.(dragId.current, newPosition);
|
|
17743
17492
|
}, [isDragging, options]);
|
|
17744
|
-
const handleMouseUp =
|
|
17493
|
+
const handleMouseUp = useCallback16(() => {
|
|
17745
17494
|
if (dragId.current) {
|
|
17746
17495
|
options.onDragEnd?.(dragId.current);
|
|
17747
17496
|
}
|
|
@@ -17749,7 +17498,7 @@ var useDrag = (options = {}) => {
|
|
|
17749
17498
|
dragStartPos.current = null;
|
|
17750
17499
|
dragId.current = null;
|
|
17751
17500
|
}, [options]);
|
|
17752
|
-
|
|
17501
|
+
useEffect28(() => {
|
|
17753
17502
|
if (isDragging) {
|
|
17754
17503
|
document.addEventListener("mousemove", handleMouseMove);
|
|
17755
17504
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -17761,16 +17510,16 @@ var useDrag = (options = {}) => {
|
|
|
17761
17510
|
};
|
|
17762
17511
|
}
|
|
17763
17512
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
17764
|
-
const setPosition =
|
|
17513
|
+
const setPosition = useCallback16((id, position) => {
|
|
17765
17514
|
setPositions((prev) => ({
|
|
17766
17515
|
...prev,
|
|
17767
17516
|
[id]: position
|
|
17768
17517
|
}));
|
|
17769
17518
|
}, []);
|
|
17770
|
-
const getPosition =
|
|
17519
|
+
const getPosition = useCallback16((id) => {
|
|
17771
17520
|
return positions[id] || { top: 0, left: 0 };
|
|
17772
17521
|
}, [positions]);
|
|
17773
|
-
const isElementDragging =
|
|
17522
|
+
const isElementDragging = useCallback16((id) => {
|
|
17774
17523
|
return isDragging === id;
|
|
17775
17524
|
}, [isDragging]);
|
|
17776
17525
|
return {
|