@super-calendar/solid 2.17.0 → 2.18.0
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/README.md +42 -5
- package/dist/client/index.d.ts +56 -14
- package/dist/client/index.js +570 -296
- package/dist/server/index.d.ts +56 -14
- package/dist/server/index.js +1173 -831
- package/package.json +2 -2
- package/src/Agenda.tsx +17 -1
- package/src/Calendar.tsx +106 -29
- package/src/MonthView.tsx +160 -18
- package/src/TimeGrid.tsx +350 -155
- package/src/YearView.tsx +17 -1
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthGrid as buildMonthGrid$1, buildMonthWeeks, buildMultiWeekGrid, buildMultiWeekGrid as buildMultiWeekGrid$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getViewDays, getViewDays as getViewDays$1, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, lightColors, loadEventSource, loadEventSource as loadEventSource$1, monthCreateRange, monthDropBounds, movedClockSpan, nextDateRange, nextDateRange as nextDateRange$1, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, titleNumberOfLines, toICalendar, toZonedTime, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core/vanilla";
|
|
1
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthGrid as buildMonthGrid$1, buildMonthWeeks, buildMultiWeekGrid, buildMultiWeekGrid as buildMultiWeekGrid$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getViewDays as getViewDays$1, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, lightColors, loadEventSource, loadEventSource as loadEventSource$1, monthCreateRange, monthDropBounds, movedClockSpan, nextDateRange, nextDateRange as nextDateRange$1, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, titleNumberOfLines, toICalendar, toZonedTime, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1, zonedDragBounds, zonedEventSource } from "@super-calendar/core/vanilla";
|
|
2
2
|
import { For, Show, createEffect, createMemo, createSignal, createUniqueId, merge, onCleanup, onSettled, untrack } from "solid-js";
|
|
3
3
|
import { Dynamic, className, createComponent, delegateEvents, effect, getNextElement, getNextMarker, insert, memo, mergeProps, readShallow, ref, runHydrationEvents, scope, setAttribute, setStyleProperty, spread, style, template } from "@solidjs/web";
|
|
4
4
|
import { addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getISOWeek, isSameDay, isSameMonth, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
@@ -377,8 +377,12 @@ function Agenda(incoming) {
|
|
|
377
377
|
});
|
|
378
378
|
return out;
|
|
379
379
|
});
|
|
380
|
+
const todayKey = createMemo(() => {
|
|
381
|
+
props.events;
|
|
382
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
383
|
+
});
|
|
380
384
|
const Header = (row) => {
|
|
381
|
-
const highlighted = createMemo(() => props.activeDate ? isSameDay(row.date, props.activeDate) : getIsToday(row.date));
|
|
385
|
+
const highlighted = createMemo(() => props.activeDate ? isSameDay(row.date, props.activeDate) : getIsToday(row.date, new Date(todayKey())));
|
|
382
386
|
const label = createMemo(() => format(row.date, "EEEE, d LLLL", { locale: props.locale }));
|
|
383
387
|
const headerProps = createMemo(() => slot("dayHeader", {
|
|
384
388
|
base: props.onPressDay ? {
|
|
@@ -636,12 +640,12 @@ var _tmpl$$7 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div>`);
|
|
|
636
640
|
var _tmpl$2$6 = /*#__PURE__*/ template(`<div>`);
|
|
637
641
|
var _tmpl$3$5 = /*#__PURE__*/ template(`<span>`);
|
|
638
642
|
var _tmpl$4$4 = /*#__PURE__*/ template(`<div role=gridcell aria-hidden=true>`);
|
|
639
|
-
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span
|
|
643
|
+
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span><!$><!/><!$><!/><div><!$><!/><!$><!/><!$><!/>`);
|
|
640
644
|
var _tmpl$6$4 = /*#__PURE__*/ template(`<button>`);
|
|
641
645
|
var _tmpl$7$2 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
642
646
|
var _tmpl$8$2 = /*#__PURE__*/ template(`<div><div></div><!$><!/>`);
|
|
643
647
|
var _tmpl$9$1 = /*#__PURE__*/ template(`<button type=button>`);
|
|
644
|
-
var _tmpl$0 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
648
|
+
var _tmpl$0$1 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
645
649
|
/**
|
|
646
650
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
647
651
|
* the `classNames` / `styles` props to restyle just that part.
|
|
@@ -654,6 +658,8 @@ const CHIP_HEIGHT = 18;
|
|
|
654
658
|
const CHIP_GAP = 2;
|
|
655
659
|
const CELL_PAD = 4;
|
|
656
660
|
const DRAGGED_CHIP_OPACITY = .4;
|
|
661
|
+
const DRAG_SLOP_PX = 4;
|
|
662
|
+
const TOUCH_DRAG_SLOP_PX = 8;
|
|
657
663
|
/** Props passed to a custom month event chip renderer. */
|
|
658
664
|
/** A component that renders a single month-grid event chip. */
|
|
659
665
|
const isOutsidePeriod = (day) => day.isCurrentMonth === false;
|
|
@@ -911,7 +917,8 @@ function DateRows(incoming) {
|
|
|
911
917
|
const showAdjacentMonths = createMemo(() => props.source.kind === "month" ? props.source.showAdjacentMonths : true);
|
|
912
918
|
const numberOfWeeks = createMemo(() => props.source.kind === "multiweek" ? props.source.numberOfWeeks : void 0);
|
|
913
919
|
const viewMode = createMemo(() => multiWeek() ? "multiweek" : "month");
|
|
914
|
-
const
|
|
920
|
+
const createContentEnabled = createMemo(() => props.onCreateEvent != null && props.renderCreateGhost != null);
|
|
921
|
+
const eventsMode = createMemo(() => props.events !== void 0 || multiWeek() || createContentEnabled());
|
|
915
922
|
const dayRoving = createMemo(() => !eventsMode() || props.keyboardDayNavigation);
|
|
916
923
|
const eventsByDay = createMemo(() => {
|
|
917
924
|
if (props.eventsByDay) return props.eventsByDay;
|
|
@@ -960,7 +967,8 @@ function DateRows(incoming) {
|
|
|
960
967
|
minDate: props.minDate,
|
|
961
968
|
maxDate: props.maxDate,
|
|
962
969
|
isDateDisabled: props.isDateDisabled,
|
|
963
|
-
locale: props.locale
|
|
970
|
+
locale: props.locale,
|
|
971
|
+
today: nowInTimeZone(props.now, props.timeZone)
|
|
964
972
|
};
|
|
965
973
|
const weeks = numberOfWeeks();
|
|
966
974
|
if (weeks === void 0) return {
|
|
@@ -1042,6 +1050,10 @@ function DateRows(incoming) {
|
|
|
1042
1050
|
(key ? gridRef.current?.querySelector(`[data-day="${key}"]`) : gridRef.current)?.focus();
|
|
1043
1051
|
});
|
|
1044
1052
|
const [drag, setDrag] = createSignal(null);
|
|
1053
|
+
const createRange = createMemo(() => {
|
|
1054
|
+
const current = drag();
|
|
1055
|
+
return createContentEnabled() && current?.kind === "create" ? monthCreateRange(new Date(current.anchor), new Date(current.hover)) : null;
|
|
1056
|
+
}, { equals: (a, b) => a === b || !!a && !!b && +a.start === +b.start && +a.end === +b.end });
|
|
1045
1057
|
const dragRef = { current: null };
|
|
1046
1058
|
const applyDrag = (value) => {
|
|
1047
1059
|
dragRef.current = value;
|
|
@@ -1049,19 +1061,29 @@ function DateRows(incoming) {
|
|
|
1049
1061
|
};
|
|
1050
1062
|
const movedRef = { current: false };
|
|
1051
1063
|
const suppressClickRef = { current: false };
|
|
1052
|
-
const consumeSuppressedClick = () => {
|
|
1053
|
-
if (!suppressClickRef.current) return false;
|
|
1064
|
+
const consumeSuppressedClick = (detail) => {
|
|
1065
|
+
if (detail === 0 || !suppressClickRef.current) return false;
|
|
1054
1066
|
suppressClickRef.current = false;
|
|
1055
1067
|
return true;
|
|
1056
1068
|
};
|
|
1057
1069
|
const canMove = (event) => props.onDragEvent != null && !event.disabled && event.draggable !== false && (event.startEditable ?? props.eventStartEditable);
|
|
1070
|
+
let pressOrigin = {
|
|
1071
|
+
x: 0,
|
|
1072
|
+
y: 0,
|
|
1073
|
+
slop: DRAG_SLOP_PX
|
|
1074
|
+
};
|
|
1058
1075
|
const beginPress = (e) => {
|
|
1059
1076
|
if (dragRef.current || e.isPrimary === false) return false;
|
|
1060
1077
|
suppressClickRef.current = false;
|
|
1061
1078
|
movedRef.current = false;
|
|
1079
|
+
pressOrigin = {
|
|
1080
|
+
x: e.clientX,
|
|
1081
|
+
y: e.clientY,
|
|
1082
|
+
slop: e.pointerType === "touch" ? TOUCH_DRAG_SLOP_PX : DRAG_SLOP_PX
|
|
1083
|
+
};
|
|
1062
1084
|
return true;
|
|
1063
1085
|
};
|
|
1064
|
-
const beginCreate = (day, pointerId) => {
|
|
1086
|
+
const beginCreate = (day, pointerId, armed) => {
|
|
1065
1087
|
if (!props.onCreateEvent && !props.onSelectDrag) return;
|
|
1066
1088
|
const t = startOfDay(day).getTime();
|
|
1067
1089
|
applyDrag({
|
|
@@ -1069,10 +1091,11 @@ function DateRows(incoming) {
|
|
|
1069
1091
|
pointerId,
|
|
1070
1092
|
anchor: t,
|
|
1071
1093
|
hover: t,
|
|
1072
|
-
windowKey: windowKey()
|
|
1094
|
+
windowKey: windowKey(),
|
|
1095
|
+
armed
|
|
1073
1096
|
});
|
|
1074
1097
|
};
|
|
1075
|
-
const beginMove = (event, day, pointerId) => {
|
|
1098
|
+
const beginMove = (event, day, pointerId, armed) => {
|
|
1076
1099
|
if (!canMove(event)) return;
|
|
1077
1100
|
const t = startOfDay(day).getTime();
|
|
1078
1101
|
applyDrag({
|
|
@@ -1081,7 +1104,8 @@ function DateRows(incoming) {
|
|
|
1081
1104
|
event,
|
|
1082
1105
|
from: t,
|
|
1083
1106
|
to: t,
|
|
1084
|
-
windowKey: windowKey()
|
|
1107
|
+
windowKey: windowKey(),
|
|
1108
|
+
armed
|
|
1085
1109
|
});
|
|
1086
1110
|
props.onDragStart?.(event);
|
|
1087
1111
|
};
|
|
@@ -1093,10 +1117,12 @@ function DateRows(incoming) {
|
|
|
1093
1117
|
movedRef.current = true;
|
|
1094
1118
|
applyDrag(current.kind === "create" ? {
|
|
1095
1119
|
...current,
|
|
1096
|
-
hover: t
|
|
1120
|
+
hover: t,
|
|
1121
|
+
armed: true
|
|
1097
1122
|
} : {
|
|
1098
1123
|
...current,
|
|
1099
|
-
to: t
|
|
1124
|
+
to: t,
|
|
1125
|
+
armed: true
|
|
1100
1126
|
});
|
|
1101
1127
|
if (current.kind === "create") {
|
|
1102
1128
|
const [lo, hi] = current.anchor <= t ? [current.anchor, t] : [t, current.anchor];
|
|
@@ -1108,12 +1134,12 @@ function DateRows(incoming) {
|
|
|
1108
1134
|
const dayLookup = createMemo(() => new Map(_grid().weeks.flatMap((week) => week.days).map((day) => [day.id, day])));
|
|
1109
1135
|
const pressRow = (event, day, moving) => {
|
|
1110
1136
|
if (event.button !== 0 || heldTouch || !beginPress(event)) return;
|
|
1111
|
-
const start = () => {
|
|
1112
|
-
if (moving) beginMove(moving, day, event.pointerId);
|
|
1113
|
-
else beginCreate(day, event.pointerId);
|
|
1137
|
+
const start = (armed) => {
|
|
1138
|
+
if (moving) beginMove(moving, day, event.pointerId, armed);
|
|
1139
|
+
else beginCreate(day, event.pointerId, armed);
|
|
1114
1140
|
};
|
|
1115
1141
|
if (!multiWeek() || !event.pointerType || event.pointerType === "mouse") {
|
|
1116
|
-
start();
|
|
1142
|
+
start(false);
|
|
1117
1143
|
return;
|
|
1118
1144
|
}
|
|
1119
1145
|
heldOrigin = {
|
|
@@ -1126,7 +1152,7 @@ function DateRows(incoming) {
|
|
|
1126
1152
|
pointerType: event.pointerType,
|
|
1127
1153
|
clientX: event.clientX,
|
|
1128
1154
|
clientY: event.clientY
|
|
1129
|
-
}, start, (x, y) => {
|
|
1155
|
+
}, () => start(true), (x, y) => {
|
|
1130
1156
|
const element = gridRef.current?.ownerDocument.elementFromPoint(x, y)?.closest("[data-day]");
|
|
1131
1157
|
if (!element || !gridRef.current?.contains(element)) return;
|
|
1132
1158
|
const day = dayLookup().get(element.dataset.day ?? "");
|
|
@@ -1160,6 +1186,7 @@ function DateRows(incoming) {
|
|
|
1160
1186
|
if (!enabled(origin.day) || !enabled(destination) || (origin.event ? !state.canMove || !state.events?.includes(origin.event) || origin.event.disabled || origin.event.draggable === false || !(origin.event.startEditable ?? state.eventStartEditable) : !state.canCreate)) heldTouch?.();
|
|
1161
1187
|
});
|
|
1162
1188
|
const isDragging = createMemo(() => drag() !== null);
|
|
1189
|
+
const dragArmed = createMemo(() => drag()?.armed === true);
|
|
1163
1190
|
const dragWired = createMemo(() => props.onCreateEvent != null || props.onSelectDrag != null || props.onDragEvent != null);
|
|
1164
1191
|
createEffect(() => [
|
|
1165
1192
|
isDragging(),
|
|
@@ -1173,7 +1200,10 @@ function DateRows(incoming) {
|
|
|
1173
1200
|
const current = dragRef.current;
|
|
1174
1201
|
if (!current || current.pointerId !== e.pointerId) return;
|
|
1175
1202
|
applyDrag(null);
|
|
1176
|
-
if (!movedRef.current)
|
|
1203
|
+
if (!movedRef.current) {
|
|
1204
|
+
if (current.kind === "move" && current.armed) suppressClickRef.current = true;
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1177
1207
|
suppressClickRef.current = true;
|
|
1178
1208
|
if (multiWeek() && current.windowKey !== windowKey()) return;
|
|
1179
1209
|
if (current.kind === "create") {
|
|
@@ -1186,17 +1216,38 @@ function DateRows(incoming) {
|
|
|
1186
1216
|
if (props.eventOverlap === false && overlapsOtherEvents(props.events ?? [], current.event, next.start, next.end)) return;
|
|
1187
1217
|
props.onDragEvent?.(current.event, next.start, next.end);
|
|
1188
1218
|
};
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1219
|
+
const clear = () => {
|
|
1220
|
+
heldTouch?.();
|
|
1191
1221
|
applyDrag(null);
|
|
1192
1222
|
movedRef.current = false;
|
|
1193
1223
|
suppressClickRef.current = true;
|
|
1194
1224
|
};
|
|
1225
|
+
const cancel = (event) => {
|
|
1226
|
+
if (dragRef.current?.pointerId === event.pointerId) clear();
|
|
1227
|
+
};
|
|
1228
|
+
const arm = (event) => {
|
|
1229
|
+
const current = dragRef.current;
|
|
1230
|
+
if (!current || current.armed || current.pointerId !== event.pointerId) return;
|
|
1231
|
+
if (Math.hypot(event.clientX - pressOrigin.x, event.clientY - pressOrigin.y) <= pressOrigin.slop) return;
|
|
1232
|
+
applyDrag({
|
|
1233
|
+
...current,
|
|
1234
|
+
armed: true
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1237
|
+
const keyDown = (event) => {
|
|
1238
|
+
if (event.key !== "Escape") return;
|
|
1239
|
+
event.preventDefault();
|
|
1240
|
+
clear();
|
|
1241
|
+
};
|
|
1242
|
+
window.addEventListener("pointermove", arm);
|
|
1195
1243
|
window.addEventListener("pointerup", finish);
|
|
1196
1244
|
window.addEventListener("pointercancel", cancel);
|
|
1245
|
+
window.addEventListener("keydown", keyDown);
|
|
1197
1246
|
return () => {
|
|
1247
|
+
window.removeEventListener("pointermove", arm);
|
|
1198
1248
|
window.removeEventListener("pointerup", finish);
|
|
1199
1249
|
window.removeEventListener("pointercancel", cancel);
|
|
1250
|
+
window.removeEventListener("keydown", keyDown);
|
|
1200
1251
|
};
|
|
1201
1252
|
}));
|
|
1202
1253
|
let transientWindow = untrack(windowKey);
|
|
@@ -1350,6 +1401,12 @@ function DateRows(incoming) {
|
|
|
1350
1401
|
last
|
|
1351
1402
|
};
|
|
1352
1403
|
});
|
|
1404
|
+
const draftColumns = createMemo(() => {
|
|
1405
|
+
const range = createRange();
|
|
1406
|
+
return range ? week().days.flatMap((day, index) => !showAdjacentMonths() && isOutsidePeriod(day) || day.date < range.start || day.date >= range.end ? [] : [index]) : [];
|
|
1407
|
+
});
|
|
1408
|
+
const draftTop = createMemo(() => 28 + props.chipGap + Math.min(visibleLanes(), Math.max(0, props.maxVisibleEventCount - 1)) * (props.chipHeight + props.chipGap));
|
|
1409
|
+
const draftHeight = createMemo(() => Math.min(props.chipHeight, Math.max(0, eventRowHeight() - draftTop())));
|
|
1353
1410
|
return memo(() => {
|
|
1354
1411
|
const barSegs = createMemo(() => rowLayout().segments.filter((s) => s.lane < visibleLanes()).map((s) => {
|
|
1355
1412
|
const startCol = Math.max(s.startCol, columns().first);
|
|
@@ -1416,7 +1473,7 @@ function DateRows(incoming) {
|
|
|
1416
1473
|
const hiddenEvents = createMemo(() => rowLayout().segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes()).map((s) => s.event));
|
|
1417
1474
|
const dayLabel = createMemo(() => format(day().date, "d MMMM", props.locale ? { locale: props.locale } : void 0));
|
|
1418
1475
|
const dayCellProps = createMemo(() => slot("day", eventCellDefault(day(), theme(), cellHeight(), props.highlightWeekends, inCreate() || isDropTarget(), props.chipGap)));
|
|
1419
|
-
var _el$10 = getNextElement(_tmpl$5$4), _el$
|
|
1476
|
+
var _el$10 = getNextElement(_tmpl$5$4), _el$20 = _el$10.firstChild, [_el$21, _co$6] = getNextMarker(_el$20.nextSibling), _el$11 = _el$21.nextSibling, _el$22 = _el$11.nextSibling, [_el$23, _co$7] = getNextMarker(_el$22.nextSibling), _el$24 = _el$23.nextSibling, [_el$25, _co$8] = getNextMarker(_el$24.nextSibling), _el$13 = _el$25.nextSibling, _el$14 = _el$13.firstChild, [_el$15, _co$3] = getNextMarker(_el$14.nextSibling), _el$16 = _el$15.nextSibling, [_el$17, _co$4] = getNextMarker(_el$16.nextSibling), _el$18 = _el$17.nextSibling, [_el$19, _co$5] = getNextMarker(_el$18.nextSibling);
|
|
1420
1477
|
spread(_el$10, [
|
|
1421
1478
|
{
|
|
1422
1479
|
"role": "gridcell",
|
|
@@ -1475,8 +1532,8 @@ function DateRows(incoming) {
|
|
|
1475
1532
|
return dragWired() && !day().isDisabled ? (e) => extendDrag(day().date, e.pointerId) : void 0;
|
|
1476
1533
|
},
|
|
1477
1534
|
get onClick() {
|
|
1478
|
-
return day().isDisabled ? void 0 : () => {
|
|
1479
|
-
if (consumeSuppressedClick()) return;
|
|
1535
|
+
return day().isDisabled ? void 0 : (e) => {
|
|
1536
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1480
1537
|
props.onPressDay?.(day().date);
|
|
1481
1538
|
props.onPressCell?.(startOfDay(day().date));
|
|
1482
1539
|
};
|
|
@@ -1498,17 +1555,61 @@ function DateRows(incoming) {
|
|
|
1498
1555
|
return band();
|
|
1499
1556
|
},
|
|
1500
1557
|
children: (band) => (() => {
|
|
1501
|
-
var _el$
|
|
1502
|
-
spread(_el$
|
|
1558
|
+
var _el$26 = getNextElement(_tmpl$3$5);
|
|
1559
|
+
spread(_el$26, [{
|
|
1503
1560
|
"data-band": true,
|
|
1504
1561
|
"aria-hidden": "true"
|
|
1505
1562
|
}, () => slot("rangeBand", band())], false);
|
|
1506
1563
|
runHydrationEvents();
|
|
1507
|
-
return _el$
|
|
1564
|
+
return _el$26;
|
|
1508
1565
|
})()
|
|
1509
|
-
})), _el$
|
|
1566
|
+
})), _el$21, _co$6);
|
|
1510
1567
|
spread(_el$11, [dayData, () => slot("dayBadge", compactBadgeDefault(day(), theme()))], true);
|
|
1511
1568
|
insert(_el$11, scope(() => day().label));
|
|
1569
|
+
insert(_el$10, createComponent(Show, {
|
|
1570
|
+
get when() {
|
|
1571
|
+
return memo(() => !!(props.renderCreateGhost && createRange() && draftColumns()[0] === dayCol))() ? draftHeight() > 0 : props.renderCreateGhost && createRange() && draftColumns()[0] === dayCol;
|
|
1572
|
+
},
|
|
1573
|
+
get children() {
|
|
1574
|
+
var _el$12 = getNextElement(_tmpl$2$6);
|
|
1575
|
+
spread(_el$12, [() => slot("createGhost", {
|
|
1576
|
+
base: {
|
|
1577
|
+
position: "absolute",
|
|
1578
|
+
left: 2,
|
|
1579
|
+
width: `calc(${(draftColumns().at(-1) - dayCol + 1) * 100}% - 4px)`,
|
|
1580
|
+
top: draftTop(),
|
|
1581
|
+
height: draftHeight(),
|
|
1582
|
+
boxSizing: "border-box",
|
|
1583
|
+
pointerEvents: "none",
|
|
1584
|
+
overflow: "hidden",
|
|
1585
|
+
zIndex: 3
|
|
1586
|
+
},
|
|
1587
|
+
themed: {
|
|
1588
|
+
background: theme().rangeBackground,
|
|
1589
|
+
border: `1px solid ${theme().selectedBackground}`,
|
|
1590
|
+
borderRadius: 4,
|
|
1591
|
+
fontSize: 12,
|
|
1592
|
+
color: theme().text
|
|
1593
|
+
}
|
|
1594
|
+
}), {
|
|
1595
|
+
"inert": true,
|
|
1596
|
+
"aria-hidden": "true"
|
|
1597
|
+
}], true);
|
|
1598
|
+
insert(_el$12, createComponent(Dynamic, {
|
|
1599
|
+
get component() {
|
|
1600
|
+
return props.renderCreateGhost;
|
|
1601
|
+
},
|
|
1602
|
+
get start() {
|
|
1603
|
+
return createRange().start;
|
|
1604
|
+
},
|
|
1605
|
+
get end() {
|
|
1606
|
+
return createRange().end;
|
|
1607
|
+
}
|
|
1608
|
+
}));
|
|
1609
|
+
runHydrationEvents();
|
|
1610
|
+
return _el$12;
|
|
1611
|
+
}
|
|
1612
|
+
}), _el$23, _co$7);
|
|
1512
1613
|
insert(_el$10, scope(() => createComponent(For, {
|
|
1513
1614
|
get each() {
|
|
1514
1615
|
return barSegs().filter((b) => b.startCol === dayCol);
|
|
@@ -1518,10 +1619,10 @@ function DateRows(incoming) {
|
|
|
1518
1619
|
const span = createMemo(() => b().endCol - b().startCol + 1);
|
|
1519
1620
|
const isDragged = createMemo(() => {
|
|
1520
1621
|
const currentDrag = drag();
|
|
1521
|
-
return currentDrag?.kind === "move" && currentDrag.event === b().seg.event;
|
|
1622
|
+
return currentDrag?.armed === true && currentDrag.kind === "move" && currentDrag.event === b().seg.event;
|
|
1522
1623
|
});
|
|
1523
|
-
var _el$
|
|
1524
|
-
spread(_el$
|
|
1624
|
+
var _el$27 = getNextElement(_tmpl$6$4);
|
|
1625
|
+
spread(_el$27, [
|
|
1525
1626
|
{
|
|
1526
1627
|
"type": "button",
|
|
1527
1628
|
get onPointerDown() {
|
|
@@ -1534,7 +1635,7 @@ function DateRows(incoming) {
|
|
|
1534
1635
|
},
|
|
1535
1636
|
"onClick": (e) => {
|
|
1536
1637
|
e.stopPropagation();
|
|
1537
|
-
if (consumeSuppressedClick()) return;
|
|
1638
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1538
1639
|
props.onPressEvent?.(b().seg.event);
|
|
1539
1640
|
}
|
|
1540
1641
|
},
|
|
@@ -1558,7 +1659,7 @@ function DateRows(incoming) {
|
|
|
1558
1659
|
width: `calc(${span() * 100}% - 4px)`,
|
|
1559
1660
|
top: 28 + props.chipGap + b().seg.lane * (props.chipHeight + props.chipGap),
|
|
1560
1661
|
height: props.chipHeight,
|
|
1561
|
-
pointerEvents:
|
|
1662
|
+
pointerEvents: dragArmed() ? "none" : "auto",
|
|
1562
1663
|
opacity: isDragged() ? DRAGGED_CHIP_OPACITY : void 0,
|
|
1563
1664
|
cursor: canMove(b().seg.event) ? "grab" : void 0,
|
|
1564
1665
|
touchAction: dragWired() ? multiWeek() ? "pan-y" : "none" : void 0,
|
|
@@ -1567,7 +1668,7 @@ function DateRows(incoming) {
|
|
|
1567
1668
|
}
|
|
1568
1669
|
}
|
|
1569
1670
|
], true);
|
|
1570
|
-
insert(_el$
|
|
1671
|
+
insert(_el$27, scope((() => {
|
|
1571
1672
|
var _c$5 = memo(() => !!Chip());
|
|
1572
1673
|
return () => _c$5() ? createComponent(Dynamic, {
|
|
1573
1674
|
get component() {
|
|
@@ -1581,8 +1682,8 @@ function DateRows(incoming) {
|
|
|
1581
1682
|
},
|
|
1582
1683
|
onPress: () => props.onPressEvent?.(b().seg.event)
|
|
1583
1684
|
}) : (() => {
|
|
1584
|
-
var _el$
|
|
1585
|
-
spread(_el$
|
|
1685
|
+
var _el$28 = getNextElement(_tmpl$3$5);
|
|
1686
|
+
spread(_el$28, [barChip, { get style() {
|
|
1586
1687
|
return css({
|
|
1587
1688
|
...barChip().style,
|
|
1588
1689
|
...b().continuesBefore ? {
|
|
@@ -1595,32 +1696,32 @@ function DateRows(incoming) {
|
|
|
1595
1696
|
} : null
|
|
1596
1697
|
});
|
|
1597
1698
|
} }], true);
|
|
1598
|
-
insert(_el$
|
|
1699
|
+
insert(_el$28, scope(() => b().seg.event.title));
|
|
1599
1700
|
runHydrationEvents();
|
|
1600
|
-
return _el$
|
|
1701
|
+
return _el$28;
|
|
1601
1702
|
})();
|
|
1602
1703
|
})()));
|
|
1603
1704
|
runHydrationEvents();
|
|
1604
|
-
return _el$
|
|
1705
|
+
return _el$27;
|
|
1605
1706
|
}
|
|
1606
|
-
})), _el$
|
|
1607
|
-
spread(_el$
|
|
1707
|
+
})), _el$25, _co$8);
|
|
1708
|
+
spread(_el$13, () => slot("events", { base: {
|
|
1608
1709
|
display: "flex",
|
|
1609
1710
|
flexDirection: "column",
|
|
1610
1711
|
gap: props.chipGap
|
|
1611
1712
|
} }), true);
|
|
1612
|
-
insert(_el$
|
|
1613
|
-
var _el$
|
|
1713
|
+
insert(_el$13, scope(() => Array.from({ length: visibleLanes() }, () => (() => {
|
|
1714
|
+
var _el$29 = getNextElement(_tmpl$7$2);
|
|
1614
1715
|
effect(() => readShallow(css({ height: props.chipHeight })), (_v$, _$p) => {
|
|
1615
|
-
style(_el$
|
|
1716
|
+
style(_el$29, _v$, _$p);
|
|
1616
1717
|
});
|
|
1617
|
-
return _el$
|
|
1618
|
-
})())), _el$
|
|
1619
|
-
insert(_el$
|
|
1718
|
+
return _el$29;
|
|
1719
|
+
})())), _el$15, _co$3);
|
|
1720
|
+
insert(_el$13, scope((() => {
|
|
1620
1721
|
var _c$3 = memo(() => hiddenEvents().length > 0);
|
|
1621
1722
|
return () => _c$3() ? (() => {
|
|
1622
|
-
var _el$
|
|
1623
|
-
spread(_el$
|
|
1723
|
+
var _el$30 = getNextElement(_tmpl$6$4);
|
|
1724
|
+
spread(_el$30, [
|
|
1624
1725
|
{
|
|
1625
1726
|
"type": "button",
|
|
1626
1727
|
get onPointerDown() {
|
|
@@ -1645,16 +1746,16 @@ function DateRows(incoming) {
|
|
|
1645
1746
|
}
|
|
1646
1747
|
}
|
|
1647
1748
|
], true);
|
|
1648
|
-
insert(_el$
|
|
1749
|
+
insert(_el$30, scope(() => props.moreLabel.replace("{moreCount}", String(hiddenEvents().length))));
|
|
1649
1750
|
runHydrationEvents();
|
|
1650
|
-
return _el$
|
|
1751
|
+
return _el$30;
|
|
1651
1752
|
})() : null;
|
|
1652
|
-
})()), _el$
|
|
1653
|
-
insert(_el$
|
|
1753
|
+
})()), _el$17, _co$4);
|
|
1754
|
+
insert(_el$13, scope((() => {
|
|
1654
1755
|
var _c$4 = memo(() => moreOpenFor() === day().id);
|
|
1655
1756
|
return () => _c$4() ? (() => {
|
|
1656
|
-
var _el$
|
|
1657
|
-
spread(_el$
|
|
1757
|
+
var _el$31 = getNextElement(_tmpl$8$2), _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling, [_el$34, _co$9] = getNextMarker(_el$33.nextSibling);
|
|
1758
|
+
spread(_el$31, [{
|
|
1658
1759
|
"role": "dialog",
|
|
1659
1760
|
get "aria-label"() {
|
|
1660
1761
|
return dayLabel();
|
|
@@ -1695,20 +1796,20 @@ function DateRows(incoming) {
|
|
|
1695
1796
|
boxShadow: "0 4px 16px rgba(0,0,0,0.12)"
|
|
1696
1797
|
}
|
|
1697
1798
|
})], true);
|
|
1698
|
-
ref(() => (el) => morePopoverRef.current = el, _el$
|
|
1699
|
-
insert(_el$
|
|
1700
|
-
insert(_el$
|
|
1799
|
+
ref(() => (el) => morePopoverRef.current = el, _el$31);
|
|
1800
|
+
insert(_el$32, scope(() => dayLabel()));
|
|
1801
|
+
insert(_el$31, scope(() => createComponent(For, {
|
|
1701
1802
|
get each() {
|
|
1702
1803
|
return dayEvents();
|
|
1703
1804
|
},
|
|
1704
1805
|
keyed: false,
|
|
1705
1806
|
children: (event) => {
|
|
1706
|
-
var _el$
|
|
1707
|
-
_el$
|
|
1807
|
+
var _el$35 = getNextElement(_tmpl$9$1);
|
|
1808
|
+
_el$35._$$click = () => {
|
|
1708
1809
|
setMoreOpenFor(null);
|
|
1709
1810
|
props.onPressEvent?.(event());
|
|
1710
1811
|
};
|
|
1711
|
-
insert(_el$
|
|
1812
|
+
insert(_el$35, scope((() => {
|
|
1712
1813
|
var _c$6 = memo(() => !!Chip());
|
|
1713
1814
|
return () => _c$6() ? createComponent(Dynamic, {
|
|
1714
1815
|
get component() {
|
|
@@ -1722,11 +1823,11 @@ function DateRows(incoming) {
|
|
|
1722
1823
|
},
|
|
1723
1824
|
onPress: () => props.onPressEvent?.(event())
|
|
1724
1825
|
}) : (() => {
|
|
1725
|
-
var _el$
|
|
1726
|
-
spread(_el$
|
|
1727
|
-
insert(_el$
|
|
1826
|
+
var _el$36 = getNextElement(_tmpl$3$5);
|
|
1827
|
+
spread(_el$36, () => slot("chip", chipDefault(theme(), props.chipHeight)), true);
|
|
1828
|
+
insert(_el$36, scope(() => event().title));
|
|
1728
1829
|
runHydrationEvents();
|
|
1729
|
-
return _el$
|
|
1830
|
+
return _el$36;
|
|
1730
1831
|
})();
|
|
1731
1832
|
})()));
|
|
1732
1833
|
effect(() => readShallow(css({
|
|
@@ -1739,28 +1840,28 @@ function DateRows(incoming) {
|
|
|
1739
1840
|
textAlign: "left",
|
|
1740
1841
|
cursor: "pointer"
|
|
1741
1842
|
})), (_v$, _$p) => {
|
|
1742
|
-
style(_el$
|
|
1843
|
+
style(_el$35, _v$, _$p);
|
|
1743
1844
|
});
|
|
1744
1845
|
runHydrationEvents();
|
|
1745
|
-
return _el$
|
|
1846
|
+
return _el$35;
|
|
1746
1847
|
}
|
|
1747
|
-
})), _el$
|
|
1848
|
+
})), _el$34, _co$9);
|
|
1748
1849
|
effect(() => readShallow(css({
|
|
1749
1850
|
fontSize: 11,
|
|
1750
1851
|
fontWeight: 600,
|
|
1751
1852
|
color: theme().textMuted
|
|
1752
1853
|
})), (_v$, _$p) => {
|
|
1753
|
-
style(_el$
|
|
1854
|
+
style(_el$32, _v$, _$p);
|
|
1754
1855
|
});
|
|
1755
1856
|
runHydrationEvents();
|
|
1756
|
-
return _el$
|
|
1857
|
+
return _el$31;
|
|
1757
1858
|
})() : null;
|
|
1758
|
-
})()), _el$
|
|
1859
|
+
})()), _el$19, _co$5);
|
|
1759
1860
|
runHydrationEvents();
|
|
1760
1861
|
return _el$10;
|
|
1761
1862
|
}
|
|
1762
|
-
var _el$
|
|
1763
|
-
spread(_el$
|
|
1863
|
+
var _el$37 = getNextElement(_tmpl$0$1), _el$39 = _el$37.firstChild, [_el$40, _co$0] = getNextMarker(_el$39.nextSibling), _el$38 = _el$40.nextSibling;
|
|
1864
|
+
spread(_el$37, [
|
|
1764
1865
|
{
|
|
1765
1866
|
"type": "button",
|
|
1766
1867
|
"role": "gridcell",
|
|
@@ -1803,24 +1904,24 @@ function DateRows(incoming) {
|
|
|
1803
1904
|
"onMouseLeave": () => setHoveredKey((k) => k === day().id ? null : k)
|
|
1804
1905
|
}
|
|
1805
1906
|
], true);
|
|
1806
|
-
insert(_el$
|
|
1907
|
+
insert(_el$37, scope(() => createComponent(Show, {
|
|
1807
1908
|
get when() {
|
|
1808
1909
|
return band();
|
|
1809
1910
|
},
|
|
1810
1911
|
children: (band) => (() => {
|
|
1811
|
-
var _el$
|
|
1812
|
-
spread(_el$
|
|
1912
|
+
var _el$41 = getNextElement(_tmpl$3$5);
|
|
1913
|
+
spread(_el$41, [{
|
|
1813
1914
|
"data-band": true,
|
|
1814
1915
|
"aria-hidden": "true"
|
|
1815
1916
|
}, () => slot("rangeBand", band())], false);
|
|
1816
1917
|
runHydrationEvents();
|
|
1817
|
-
return _el$
|
|
1918
|
+
return _el$41;
|
|
1818
1919
|
})()
|
|
1819
|
-
})), _el$
|
|
1820
|
-
spread(_el$
|
|
1821
|
-
insert(_el$
|
|
1920
|
+
})), _el$40, _co$0);
|
|
1921
|
+
spread(_el$38, [dayData, () => slot("dayBadge", badgeDefault(day(), theme(), hoveredKey() === day().id))], true);
|
|
1922
|
+
insert(_el$38, scope(() => day().label));
|
|
1822
1923
|
runHydrationEvents();
|
|
1823
|
-
return _el$
|
|
1924
|
+
return _el$37;
|
|
1824
1925
|
});
|
|
1825
1926
|
}
|
|
1826
1927
|
})));
|
|
@@ -2332,10 +2433,11 @@ var _tmpl$2$4 = /*#__PURE__*/ template(`<div>`);
|
|
|
2332
2433
|
var _tmpl$3$3 = /*#__PURE__*/ template(`<div tabindex=-1><!$><!/><div><div></div><!$><!/></div><!$><!/><div><div><!$><!/><!$><!/></div></div><!$><!/><!$><!/>`);
|
|
2333
2434
|
var _tmpl$4$2 = /*#__PURE__*/ template(`<span>`);
|
|
2334
2435
|
var _tmpl$5$2 = /*#__PURE__*/ template(`<button>`);
|
|
2335
|
-
var _tmpl$6$2 = /*#__PURE__*/ template(`<div
|
|
2336
|
-
var _tmpl$7$1 = /*#__PURE__*/ template(`<div
|
|
2337
|
-
var _tmpl$8$1 = /*#__PURE__*/ template(`<div
|
|
2338
|
-
var _tmpl$9 = /*#__PURE__*/ template(`<div
|
|
2436
|
+
var _tmpl$6$2 = /*#__PURE__*/ template(`<div><div></div><div>`);
|
|
2437
|
+
var _tmpl$7$1 = /*#__PURE__*/ template(`<div><button>`);
|
|
2438
|
+
var _tmpl$8$1 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div></div><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`);
|
|
2439
|
+
var _tmpl$9 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><!$><!/>`);
|
|
2440
|
+
var _tmpl$0 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
2339
2441
|
/**
|
|
2340
2442
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
2341
2443
|
* the `classNames` / `styles` props.
|
|
@@ -2360,6 +2462,11 @@ function createPreviewPlacement(topPx, heightPx, gridHeight) {
|
|
|
2360
2462
|
height
|
|
2361
2463
|
};
|
|
2362
2464
|
}
|
|
2465
|
+
function createRangePlacement(range, day, hourHeight, minHour, gridHeight, minEventHeight) {
|
|
2466
|
+
const at = (time) => (differenceInCalendarDays(time, day) * 24 + time.getHours() + time.getMinutes() / 60 - minHour) * hourHeight;
|
|
2467
|
+
const top = at(range.start);
|
|
2468
|
+
return createPreviewPlacement(top, Math.max(minEventHeight, at(range.end) - top), gridHeight);
|
|
2469
|
+
}
|
|
2363
2470
|
const EDGE_ZONE = 32;
|
|
2364
2471
|
const EDGE_DWELL_MS = 600;
|
|
2365
2472
|
const EDGE_REPEAT_MS = 600;
|
|
@@ -2386,6 +2493,20 @@ function movedSegmentStart(origin, base, startHours) {
|
|
|
2386
2493
|
const dayMinutes = differenceInCalendarDays(base, origin.base) * HOURS_PER_DAY * 60;
|
|
2387
2494
|
return shiftMinutes(origin.segmentStart, dayMinutes + Math.round((startHours - origin.startHours) * 60));
|
|
2388
2495
|
}
|
|
2496
|
+
function draggedEventBounds(d, origin, event, base, snapMinutes) {
|
|
2497
|
+
if (d.kind === "resize") {
|
|
2498
|
+
const endDelta = Math.round((d.startHours + d.durationHours - origin.startHours - origin.durationHours) * 60);
|
|
2499
|
+
return resolveDraggedBounds(event.start, event.end, 0, endDelta, snapMinutes);
|
|
2500
|
+
}
|
|
2501
|
+
const startShift = movedSegmentStart(origin, base, d.kind === "move" ? d.requestedStartHours : d.startHours).getTime() - origin.segmentStart.getTime();
|
|
2502
|
+
const endShift = d.kind === "move" ? startShift : 0;
|
|
2503
|
+
const start = new Date(event.start.getTime() + startShift);
|
|
2504
|
+
const end = new Date(event.end.getTime() + endShift);
|
|
2505
|
+
return end > start || d.kind === "move" && end.getTime() === start.getTime() ? {
|
|
2506
|
+
start,
|
|
2507
|
+
end
|
|
2508
|
+
} : null;
|
|
2509
|
+
}
|
|
2389
2510
|
function DefaultDomEvent(incoming) {
|
|
2390
2511
|
const props = withDefaults({ ampm: false }, incoming);
|
|
2391
2512
|
const timeLabel = createMemo(() => eventTimeLabel({
|
|
@@ -2562,9 +2683,15 @@ function TimeGrid(incoming) {
|
|
|
2562
2683
|
window.addEventListener("scroll", onScroll, true);
|
|
2563
2684
|
return () => window.removeEventListener("scroll", onScroll, true);
|
|
2564
2685
|
});
|
|
2686
|
+
const detachCreateListeners = { current: null };
|
|
2565
2687
|
const cellTouchRef = { current: null };
|
|
2566
2688
|
const cellEnabled = createMemo(() => !!props.onPressCell || !!props.onCreateEvent);
|
|
2567
2689
|
const days = createMemo(() => getViewDays$1(props.mode, props.date, props.weekStartsOn, props.numberOfDays, false, void 0, props.hiddenDays));
|
|
2690
|
+
const todayKey = createMemo(() => {
|
|
2691
|
+
if (props.showNowIndicator) return startOfDay(now()).getTime();
|
|
2692
|
+
days();
|
|
2693
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
2694
|
+
});
|
|
2568
2695
|
const edgeAdvanceEnabled = createMemo(() => !!props.onChangeDate && !!props.onDragEvent);
|
|
2569
2696
|
const columnsRef = { current: null };
|
|
2570
2697
|
const edgeTimer = { current: null };
|
|
@@ -2615,6 +2742,11 @@ function TimeGrid(incoming) {
|
|
|
2615
2742
|
canResize: editable && (event.durationEditable ?? props.eventDurationEditable)
|
|
2616
2743
|
};
|
|
2617
2744
|
};
|
|
2745
|
+
const hasEditActions = (event) => {
|
|
2746
|
+
if (isAllDayEvent$1(event) || isBackgroundEvent$1(event)) return false;
|
|
2747
|
+
const { canMove, canResize } = editability(event);
|
|
2748
|
+
return canMove || canResize;
|
|
2749
|
+
};
|
|
2618
2750
|
const eventLabel = (event) => props.eventAccessibilityLabel ? props.eventAccessibilityLabel(event, {
|
|
2619
2751
|
mode: props.mode,
|
|
2620
2752
|
isAllDay: false,
|
|
@@ -2628,7 +2760,7 @@ function TimeGrid(incoming) {
|
|
|
2628
2760
|
labels: labels()
|
|
2629
2761
|
});
|
|
2630
2762
|
const eventDescription = (event) => `${describeEventDates(event)}, ${eventLabel(event)}`;
|
|
2631
|
-
const pageDays = () => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays);
|
|
2763
|
+
const pageDays = createMemo(() => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays));
|
|
2632
2764
|
const actionDelta = (id) => {
|
|
2633
2765
|
const step = snapMinutes();
|
|
2634
2766
|
const page = pageDays() * HOURS_PER_DAY * 60;
|
|
@@ -2643,7 +2775,7 @@ function TimeGrid(incoming) {
|
|
|
2643
2775
|
}
|
|
2644
2776
|
};
|
|
2645
2777
|
const editActions = (event) => {
|
|
2646
|
-
if (
|
|
2778
|
+
if (!hasEditActions(event)) return [];
|
|
2647
2779
|
const { canMove, canResize } = editability(event);
|
|
2648
2780
|
const step = snapMinutes();
|
|
2649
2781
|
const words = labels();
|
|
@@ -2667,12 +2799,27 @@ function TimeGrid(incoming) {
|
|
|
2667
2799
|
if (!next || onDragEventRef.current?.(event, next.start, next.end) === false) return null;
|
|
2668
2800
|
return (candidate) => candidate !== event && candidate.start.getTime() === next.start.getTime() && candidate.end.getTime() === next.end.getTime() && candidate.title === event.title;
|
|
2669
2801
|
}, () => props.getEventId);
|
|
2670
|
-
const
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2802
|
+
const allDayLayout = createMemo(() => layoutMonthWeek$1(days(), props.events.filter((event) => isAllDayEvent$1(event) && !isBackgroundEvent$1(event) && days().some((day) => event.start < addDays(startOfDay(day), 1) && event.end > startOfDay(day)))));
|
|
2803
|
+
const hasAllDay = createMemo(() => allDayLayout().segments.length > 0);
|
|
2804
|
+
const allDaySpans = createMemo(() => {
|
|
2805
|
+
const keys = /* @__PURE__ */ new Map();
|
|
2806
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2807
|
+
for (const { event } of allDayLayout().segments) {
|
|
2808
|
+
const id = props.getEventId?.(event);
|
|
2809
|
+
if (typeof id !== "string" && typeof id !== "number") continue;
|
|
2810
|
+
const key = `${typeof id}:${id}`;
|
|
2811
|
+
const previous = seen.get(key);
|
|
2812
|
+
if (previous) keys.delete(previous);
|
|
2813
|
+
else {
|
|
2814
|
+
seen.set(key, event);
|
|
2815
|
+
keys.set(event, key);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
return allDayLayout().segments.map((segment) => ({
|
|
2819
|
+
...segment,
|
|
2820
|
+
key: keys.get(segment.event) ?? segment.event
|
|
2821
|
+
}));
|
|
2822
|
+
});
|
|
2676
2823
|
createEffect(() => [props.scrollOffsetMinutes, windowStart()], () => untrack(() => {
|
|
2677
2824
|
if (scrollRef.current) scrollRef.current.scrollTop = Math.max(0, (props.scrollOffsetMinutes / 60 - windowStart()) * hourHeightRef.current);
|
|
2678
2825
|
}));
|
|
@@ -2778,6 +2925,8 @@ function TimeGrid(incoming) {
|
|
|
2778
2925
|
document.removeEventListener("pointermove", h.move);
|
|
2779
2926
|
document.removeEventListener("pointerup", h.up);
|
|
2780
2927
|
document.removeEventListener("pointercancel", h.cancel);
|
|
2928
|
+
document.removeEventListener("selectstart", h.preventNative, true);
|
|
2929
|
+
document.removeEventListener("dragstart", h.preventNative, true);
|
|
2781
2930
|
docHandlersRef.current = null;
|
|
2782
2931
|
};
|
|
2783
2932
|
const finishDrag = () => {
|
|
@@ -2885,18 +3034,14 @@ function TimeGrid(incoming) {
|
|
|
2885
3034
|
base = day ? startOfDay(day) : null;
|
|
2886
3035
|
} else base = startOfDay(daysRef.current[originIndex + d.dayDelta] ?? daysRef.current[originIndex]);
|
|
2887
3036
|
} else base = startOfDay(daysRef.current[originIndex] ?? daysRef.current[0]);
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
const start = new Date(held.event.start.getTime() + startShift);
|
|
2896
|
-
const end = new Date(held.event.end.getTime() + endShift);
|
|
2897
|
-
if (end > start) onDragEventRef.current?.(held.event, start, end);
|
|
3037
|
+
try {
|
|
3038
|
+
if (base && held && origin) {
|
|
3039
|
+
const next = draggedEventBounds(d, origin, held.event, base, snapMinutes());
|
|
3040
|
+
if (next) onDragEventRef.current?.(held.event, next.start, next.end);
|
|
3041
|
+
}
|
|
3042
|
+
} finally {
|
|
3043
|
+
finishDrag();
|
|
2898
3044
|
}
|
|
2899
|
-
finishDrag();
|
|
2900
3045
|
};
|
|
2901
3046
|
const cancelDrag = () => {
|
|
2902
3047
|
finishDrag();
|
|
@@ -2910,7 +3055,8 @@ function TimeGrid(incoming) {
|
|
|
2910
3055
|
activeGrabRef.current = e;
|
|
2911
3056
|
const boxEl = e.box;
|
|
2912
3057
|
const column = kind === "move" ? boxEl.parentElement : null;
|
|
2913
|
-
const
|
|
3058
|
+
const columnRect = column ? column.getBoundingClientRect() : null;
|
|
3059
|
+
const dayWidth = columnRect ? columnRect.width : 0;
|
|
2914
3060
|
const boxRect = kind === "move" ? boxEl.getBoundingClientRect() : null;
|
|
2915
3061
|
const originBase = startOfDay(days()[dayIndex] ?? days()[0]);
|
|
2916
3062
|
const originNextDay = addDays(originBase, 1);
|
|
@@ -2930,9 +3076,9 @@ function TimeGrid(incoming) {
|
|
|
2930
3076
|
draggedRef.current = {
|
|
2931
3077
|
event,
|
|
2932
3078
|
onPress: onPress ?? (() => {}),
|
|
2933
|
-
grabX:
|
|
3079
|
+
grabX: column && columnRect ? e.clientX - columnRect.left - column.clientLeft - props.eventGap : 0,
|
|
2934
3080
|
grabY: boxRect ? e.clientY - boxRect.top : 0,
|
|
2935
|
-
w:
|
|
3081
|
+
w: column ? Math.max(column.clientWidth - props.eventGap * 2, 0) : 0,
|
|
2936
3082
|
h: boxRect ? boxRect.height : 0
|
|
2937
3083
|
};
|
|
2938
3084
|
ptr.current = {
|
|
@@ -2968,12 +3114,15 @@ function TimeGrid(incoming) {
|
|
|
2968
3114
|
},
|
|
2969
3115
|
cancel: (event) => {
|
|
2970
3116
|
if (event.pointerId === e.pointerId) cancelDrag();
|
|
2971
|
-
}
|
|
3117
|
+
},
|
|
3118
|
+
preventNative: (event) => event.preventDefault()
|
|
2972
3119
|
};
|
|
2973
3120
|
docHandlersRef.current = handlers;
|
|
2974
3121
|
document.addEventListener("pointermove", handlers.move);
|
|
2975
3122
|
document.addEventListener("pointerup", handlers.up);
|
|
2976
3123
|
document.addEventListener("pointercancel", handlers.cancel);
|
|
3124
|
+
document.addEventListener("selectstart", handlers.preventNative, true);
|
|
3125
|
+
document.addEventListener("dragstart", handlers.preventNative, true);
|
|
2977
3126
|
};
|
|
2978
3127
|
const pressEvent = (e, pe, key, kind, dayIndex, onPress) => {
|
|
2979
3128
|
if (!props.onDragEvent || e.button > 0 || createOrigin.current) return;
|
|
@@ -3007,6 +3156,10 @@ function TimeGrid(incoming) {
|
|
|
3007
3156
|
cancelHoldRef.current?.();
|
|
3008
3157
|
detachDocListeners();
|
|
3009
3158
|
clearEdgeTimer();
|
|
3159
|
+
if (createOrigin.current?.captureLoss !== void 0) clearTimeout(createOrigin.current.captureLoss);
|
|
3160
|
+
createOrigin.current = null;
|
|
3161
|
+
detachCreateListeners.current?.();
|
|
3162
|
+
detachCreateListeners.current = null;
|
|
3010
3163
|
}));
|
|
3011
3164
|
createEffect(() => [
|
|
3012
3165
|
props.date,
|
|
@@ -3045,6 +3198,26 @@ function TimeGrid(incoming) {
|
|
|
3045
3198
|
startPx,
|
|
3046
3199
|
curPx: startPx
|
|
3047
3200
|
});
|
|
3201
|
+
const document = el.ownerDocument;
|
|
3202
|
+
const cancel = (event) => {
|
|
3203
|
+
if (createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3204
|
+
};
|
|
3205
|
+
const restart = (event) => {
|
|
3206
|
+
if (event.isPrimary && event.pointerType !== "touch" || createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3207
|
+
};
|
|
3208
|
+
const preventSelection = (event) => event.preventDefault();
|
|
3209
|
+
document.addEventListener("pointerup", endCreate, true);
|
|
3210
|
+
document.addEventListener("pointercancel", cancel, true);
|
|
3211
|
+
document.addEventListener("pointerdown", restart, true);
|
|
3212
|
+
document.addEventListener("selectstart", preventSelection, true);
|
|
3213
|
+
document.addEventListener("dragstart", preventSelection, true);
|
|
3214
|
+
detachCreateListeners.current = () => {
|
|
3215
|
+
document.removeEventListener("pointerup", endCreate, true);
|
|
3216
|
+
document.removeEventListener("pointercancel", cancel, true);
|
|
3217
|
+
document.removeEventListener("pointerdown", restart, true);
|
|
3218
|
+
document.removeEventListener("selectstart", preventSelection, true);
|
|
3219
|
+
document.removeEventListener("dragstart", preventSelection, true);
|
|
3220
|
+
};
|
|
3048
3221
|
};
|
|
3049
3222
|
const moveCreate = (e) => {
|
|
3050
3223
|
const touch = cellTouchRef.current;
|
|
@@ -3062,9 +3235,8 @@ function TimeGrid(incoming) {
|
|
|
3062
3235
|
const endCreate = (e) => {
|
|
3063
3236
|
const o = createOrigin.current;
|
|
3064
3237
|
if (!o || o.pointerId !== e.pointerId) return;
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
} catch {}
|
|
3238
|
+
clearCreate();
|
|
3239
|
+
if (!o.el.isConnected || !cellEnabled() || o.creating && !props.onCreateEvent || days()[o.dayIndex]?.getTime() !== o.dayTime) return;
|
|
3068
3240
|
const endPx = pxFromTop(o.el, e.clientY);
|
|
3069
3241
|
const day = days()[o.dayIndex];
|
|
3070
3242
|
const moved = Math.abs(endPx - o.startPx) > 4;
|
|
@@ -3076,8 +3248,6 @@ function TimeGrid(incoming) {
|
|
|
3076
3248
|
const at = cellRangeFromDrag(day, o.startPx, o.startPx, h, windowStart(), snapMinutes());
|
|
3077
3249
|
if (at) props.onPressCell(at.start);
|
|
3078
3250
|
}
|
|
3079
|
-
createOrigin.current = null;
|
|
3080
|
-
setCreateBox(null);
|
|
3081
3251
|
};
|
|
3082
3252
|
const tapCell = (e, dayIndex) => {
|
|
3083
3253
|
const touch = cellTouchRef.current;
|
|
@@ -3091,6 +3261,9 @@ function TimeGrid(incoming) {
|
|
|
3091
3261
|
const clearCreate = () => {
|
|
3092
3262
|
const previous = createOrigin.current;
|
|
3093
3263
|
createOrigin.current = null;
|
|
3264
|
+
if (previous?.captureLoss !== void 0) clearTimeout(previous.captureLoss);
|
|
3265
|
+
detachCreateListeners.current?.();
|
|
3266
|
+
detachCreateListeners.current = null;
|
|
3094
3267
|
setCreateBox(null);
|
|
3095
3268
|
try {
|
|
3096
3269
|
previous?.el.releasePointerCapture?.(previous.pointerId);
|
|
@@ -3110,8 +3283,12 @@ function TimeGrid(incoming) {
|
|
|
3110
3283
|
clearCreate();
|
|
3111
3284
|
};
|
|
3112
3285
|
const loseCreateCapture = (e) => {
|
|
3113
|
-
|
|
3114
|
-
|
|
3286
|
+
const origin = createOrigin.current;
|
|
3287
|
+
if (!origin || origin.pointerId !== e.pointerId) return;
|
|
3288
|
+
if (origin.captureLoss !== void 0) clearTimeout(origin.captureLoss);
|
|
3289
|
+
origin.captureLoss = setTimeout(() => {
|
|
3290
|
+
if (createOrigin.current === origin) clearCreate();
|
|
3291
|
+
}, 0);
|
|
3115
3292
|
};
|
|
3116
3293
|
createEffect(() => [], () => {
|
|
3117
3294
|
const onKeyDown = (event) => {
|
|
@@ -3133,11 +3310,15 @@ function TimeGrid(incoming) {
|
|
|
3133
3310
|
return event.start.getTime() === currentHeldEvent.start.getTime() && event.end.getTime() === currentHeldEvent.end.getTime() && event.title === currentHeldEvent.title;
|
|
3134
3311
|
}) ?? currentHeldEvent);
|
|
3135
3312
|
});
|
|
3313
|
+
const multiDayHeld = createMemo(() => {
|
|
3314
|
+
const currentDrag = drag();
|
|
3315
|
+
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && !!movingEvent();
|
|
3316
|
+
});
|
|
3136
3317
|
const multiDayMove = createMemo(() => {
|
|
3137
3318
|
const currentDrag = drag();
|
|
3138
3319
|
const currentMoveOrigin = moveOrigin();
|
|
3139
3320
|
const currentMovingEvent = movingEvent();
|
|
3140
|
-
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
3321
|
+
return !paged() && currentDrag?.kind === "move" && currentDrag.moved && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
3141
3322
|
const target = days()[currentMoveOrigin.dayIndex + currentDrag.dayDelta];
|
|
3142
3323
|
const shift = movedSegmentStart(currentMoveOrigin, startOfDay(target), currentDrag.requestedStartHours).getTime() - currentMoveOrigin.segmentStart.getTime();
|
|
3143
3324
|
return {
|
|
@@ -3148,13 +3329,31 @@ function TimeGrid(incoming) {
|
|
|
3148
3329
|
};
|
|
3149
3330
|
})() : null;
|
|
3150
3331
|
});
|
|
3332
|
+
const liveBounds = createMemo(() => {
|
|
3333
|
+
const currentDrag = drag();
|
|
3334
|
+
const origin = moveOrigin();
|
|
3335
|
+
const held = draggedRef.current;
|
|
3336
|
+
if (paged() || !currentDrag?.moved || multiDayMove() || !origin || !held) return null;
|
|
3337
|
+
const visibleDays = days();
|
|
3338
|
+
const target = origin.dayIndex + (currentDrag.kind === "move" ? currentDrag.dayDelta : 0);
|
|
3339
|
+
const base = startOfDay(visibleDays[target] ?? visibleDays[origin.dayIndex]);
|
|
3340
|
+
return draggedEventBounds(currentDrag, origin, held.event, base, snapMinutes());
|
|
3341
|
+
});
|
|
3342
|
+
const withLiveBounds = (event) => {
|
|
3343
|
+
const bounds = liveBounds();
|
|
3344
|
+
return bounds ? {
|
|
3345
|
+
...event,
|
|
3346
|
+
start: bounds.start,
|
|
3347
|
+
end: bounds.end
|
|
3348
|
+
} : event;
|
|
3349
|
+
};
|
|
3151
3350
|
const spillPreviewFor = (dayIndex) => {
|
|
3152
3351
|
const currentDrag = drag();
|
|
3153
3352
|
if (paged() || !currentDrag || currentDrag.kind !== "move" || currentDrag.spillDayIndex !== dayIndex) return null;
|
|
3154
3353
|
const dragged = draggedRef.current?.event;
|
|
3155
3354
|
if (!dragged) return null;
|
|
3156
3355
|
return {
|
|
3157
|
-
event: dragged,
|
|
3356
|
+
event: withLiveBounds(dragged),
|
|
3158
3357
|
mode: props.mode,
|
|
3159
3358
|
isAllDay: false,
|
|
3160
3359
|
boxHeight: Math.max(currentDrag.spillHours * hourHeight(), props.minEventHeight),
|
|
@@ -3247,7 +3446,7 @@ function TimeGrid(incoming) {
|
|
|
3247
3446
|
ref(() => (el) => eventActions.rootRef.current = el, _el$6);
|
|
3248
3447
|
insert(_el$6, createComponent(EventActionsMenu, {
|
|
3249
3448
|
get events() {
|
|
3250
|
-
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(
|
|
3449
|
+
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(hasEditActions);
|
|
3251
3450
|
},
|
|
3252
3451
|
get label() {
|
|
3253
3452
|
return labels().editEvents;
|
|
@@ -3293,7 +3492,7 @@ function TimeGrid(incoming) {
|
|
|
3293
3492
|
},
|
|
3294
3493
|
keyed: false,
|
|
3295
3494
|
children: (day) => {
|
|
3296
|
-
const today = createMemo(() => getIsToday(day()));
|
|
3495
|
+
const today = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
3297
3496
|
const dateLabel = createMemo(() => format(day(), "EEEE, d MMMM yyyy", dfns()));
|
|
3298
3497
|
const headerProps = createMemo(() => slot("columnHeader", {
|
|
3299
3498
|
base: {
|
|
@@ -3386,7 +3585,7 @@ function TimeGrid(incoming) {
|
|
|
3386
3585
|
insert(_el$6, scope((() => {
|
|
3387
3586
|
var _c$3 = memo(() => !!(props.showAllDayEventCell && hasAllDay()));
|
|
3388
3587
|
return () => _c$3() ? (() => {
|
|
3389
|
-
var _el$28 = getNextElement(_tmpl
|
|
3588
|
+
var _el$28 = getNextElement(_tmpl$6$2), _el$29 = _el$28.firstChild, _el$30 = _el$29.nextSibling;
|
|
3390
3589
|
spread(_el$28, () => slot("allDayLane", {
|
|
3391
3590
|
base: { display: "flex" },
|
|
3392
3591
|
themed: { borderBottom: `1px solid ${theme().gridLine}` }
|
|
@@ -3395,6 +3594,7 @@ function TimeGrid(incoming) {
|
|
|
3395
3594
|
base: {
|
|
3396
3595
|
width: gutterWidth(),
|
|
3397
3596
|
flex: "none",
|
|
3597
|
+
boxSizing: "border-box",
|
|
3398
3598
|
minWidth: 0,
|
|
3399
3599
|
overflow: "hidden",
|
|
3400
3600
|
textAlign: "right"
|
|
@@ -3402,93 +3602,90 @@ function TimeGrid(incoming) {
|
|
|
3402
3602
|
themed: {
|
|
3403
3603
|
fontSize: 10,
|
|
3404
3604
|
color: theme().textMuted,
|
|
3405
|
-
padding: "4px 6px 0 0"
|
|
3605
|
+
padding: props.hideHours ? 0 : "4px 6px 0 0"
|
|
3406
3606
|
}
|
|
3407
3607
|
}), true);
|
|
3408
3608
|
insert(_el$29, scope((() => {
|
|
3409
3609
|
var _c$7 = memo(() => !!props.showAllDayLabel);
|
|
3410
3610
|
return () => _c$7() ? labels().allDay : null;
|
|
3411
3611
|
})()));
|
|
3412
|
-
insert(_el$
|
|
3612
|
+
insert(_el$30, createComponent(For, {
|
|
3413
3613
|
get each() {
|
|
3414
|
-
return
|
|
3614
|
+
return allDaySpans();
|
|
3415
3615
|
},
|
|
3416
|
-
keyed:
|
|
3417
|
-
children: (
|
|
3418
|
-
const
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3616
|
+
keyed: (segment) => segment.key,
|
|
3617
|
+
children: (segment) => {
|
|
3618
|
+
const args = createMemo(() => ({
|
|
3619
|
+
event: segment().event,
|
|
3620
|
+
mode: props.mode,
|
|
3621
|
+
isAllDay: true,
|
|
3622
|
+
continuesBefore: segment().continuesBefore,
|
|
3623
|
+
continuesAfter: segment().continuesAfter,
|
|
3624
|
+
ampm: props.ampm,
|
|
3625
|
+
onPress: () => props.onPressEvent?.(segment().event)
|
|
3626
|
+
}));
|
|
3627
|
+
var _el$31 = getNextElement(_tmpl$7$1), _el$32 = _el$31.firstChild;
|
|
3628
|
+
spread(_el$31, () => slot("allDayColumn", { base: {
|
|
3629
|
+
gridColumn: `${segment().startCol + 1} / span ${segment().endCol - segment().startCol + 1}`,
|
|
3630
|
+
gridRow: segment().lane + 1,
|
|
3423
3631
|
minWidth: 0,
|
|
3424
3632
|
borderLeft: "1px solid transparent",
|
|
3425
|
-
padding: "
|
|
3633
|
+
padding: "0 1px",
|
|
3426
3634
|
display: "flex",
|
|
3427
|
-
flexDirection: "column"
|
|
3428
|
-
gap: 2
|
|
3635
|
+
flexDirection: "column"
|
|
3429
3636
|
} }), true);
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
children: (event) => {
|
|
3436
|
-
const args = createMemo(() => ({
|
|
3437
|
-
event: event(),
|
|
3637
|
+
spread(_el$32, [{
|
|
3638
|
+
"type": "button",
|
|
3639
|
+
"onClick": () => props.onPressEvent?.(segment().event),
|
|
3640
|
+
get "aria-label"() {
|
|
3641
|
+
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(segment().event, {
|
|
3438
3642
|
mode: props.mode,
|
|
3439
3643
|
isAllDay: true,
|
|
3440
|
-
|
|
3441
|
-
|
|
3644
|
+
ampm: props.ampm
|
|
3645
|
+
}) : eventAccessibilityLabel({
|
|
3646
|
+
title: segment().event.title,
|
|
3647
|
+
isAllDay: true,
|
|
3648
|
+
start: segment().event.start,
|
|
3649
|
+
end: segment().event.end,
|
|
3442
3650
|
ampm: props.ampm,
|
|
3443
|
-
|
|
3444
|
-
})
|
|
3445
|
-
var _el$33 = getNextElement(_tmpl$5$2);
|
|
3446
|
-
spread(_el$33, [{
|
|
3447
|
-
"type": "button",
|
|
3448
|
-
"onClick": () => props.onPressEvent?.(event()),
|
|
3449
|
-
get "aria-label"() {
|
|
3450
|
-
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(event(), {
|
|
3451
|
-
mode: props.mode,
|
|
3452
|
-
isAllDay: true,
|
|
3453
|
-
ampm: props.ampm
|
|
3454
|
-
}) : eventAccessibilityLabel({
|
|
3455
|
-
title: event().title,
|
|
3456
|
-
isAllDay: true,
|
|
3457
|
-
start: event().start,
|
|
3458
|
-
end: event().end,
|
|
3459
|
-
ampm: props.ampm,
|
|
3460
|
-
labels: labels()
|
|
3461
|
-
});
|
|
3462
|
-
}
|
|
3463
|
-
}, () => slot("allDayEvent", { base: {
|
|
3464
|
-
border: "none",
|
|
3465
|
-
padding: 0,
|
|
3466
|
-
background: "transparent",
|
|
3467
|
-
cursor: "pointer",
|
|
3468
|
-
textAlign: "left",
|
|
3469
|
-
height: 22
|
|
3470
|
-
} })], true);
|
|
3471
|
-
insert(_el$33, scope((() => {
|
|
3472
|
-
var _c$8 = memo(() => !!Renderer());
|
|
3473
|
-
return () => _c$8() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3474
|
-
return Renderer();
|
|
3475
|
-
} }, args)) : createComponent(DefaultDomEvent, mergeProps(args, {
|
|
3476
|
-
get theme() {
|
|
3477
|
-
return theme();
|
|
3478
|
-
},
|
|
3479
|
-
get boxProps() {
|
|
3480
|
-
return slot("eventBox");
|
|
3481
|
-
}
|
|
3482
|
-
}));
|
|
3483
|
-
})()));
|
|
3484
|
-
runHydrationEvents();
|
|
3485
|
-
return _el$33;
|
|
3651
|
+
labels: labels()
|
|
3652
|
+
});
|
|
3486
3653
|
}
|
|
3487
|
-
})
|
|
3654
|
+
}, () => slot("allDayEvent", { base: {
|
|
3655
|
+
border: "none",
|
|
3656
|
+
padding: 0,
|
|
3657
|
+
background: "transparent",
|
|
3658
|
+
cursor: "pointer",
|
|
3659
|
+
textAlign: "left",
|
|
3660
|
+
height: 22
|
|
3661
|
+
} })], true);
|
|
3662
|
+
insert(_el$32, scope((() => {
|
|
3663
|
+
var _c$8 = memo(() => !!Renderer());
|
|
3664
|
+
return () => _c$8() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3665
|
+
return Renderer();
|
|
3666
|
+
} }, args)) : createComponent(DefaultDomEvent, mergeProps(args, {
|
|
3667
|
+
get theme() {
|
|
3668
|
+
return theme();
|
|
3669
|
+
},
|
|
3670
|
+
get boxProps() {
|
|
3671
|
+
return slot("eventBox");
|
|
3672
|
+
}
|
|
3673
|
+
}));
|
|
3674
|
+
})()));
|
|
3488
3675
|
runHydrationEvents();
|
|
3489
|
-
return _el$
|
|
3676
|
+
return _el$31;
|
|
3490
3677
|
}
|
|
3491
|
-
}))
|
|
3678
|
+
}));
|
|
3679
|
+
effect(() => readShallow(css({
|
|
3680
|
+
flex: 1,
|
|
3681
|
+
minWidth: 0,
|
|
3682
|
+
display: "grid",
|
|
3683
|
+
gridTemplateColumns: `repeat(${days().length}, minmax(0, 1fr))`,
|
|
3684
|
+
gap: "2px 0",
|
|
3685
|
+
padding: "2px 0"
|
|
3686
|
+
})), (_v$, _$p) => {
|
|
3687
|
+
style(_el$30, _v$, _$p);
|
|
3688
|
+
});
|
|
3492
3689
|
runHydrationEvents();
|
|
3493
3690
|
return _el$28;
|
|
3494
3691
|
})() : null;
|
|
@@ -3502,20 +3699,20 @@ function TimeGrid(incoming) {
|
|
|
3502
3699
|
insert(_el$10, scope((() => {
|
|
3503
3700
|
var _c$4 = memo(() => !!props.hideHours);
|
|
3504
3701
|
return () => _c$4() ? null : (() => {
|
|
3505
|
-
var _el$
|
|
3506
|
-
spread(_el$
|
|
3702
|
+
var _el$33 = getNextElement(_tmpl$2$4);
|
|
3703
|
+
spread(_el$33, () => slot("hourGutter", { base: {
|
|
3507
3704
|
width: gutterWidth(),
|
|
3508
3705
|
flex: "none",
|
|
3509
3706
|
position: "relative"
|
|
3510
3707
|
} }), true);
|
|
3511
|
-
insert(_el$
|
|
3708
|
+
insert(_el$33, scope(() => createComponent(For, {
|
|
3512
3709
|
get each() {
|
|
3513
3710
|
return visibleHours();
|
|
3514
3711
|
},
|
|
3515
3712
|
keyed: false,
|
|
3516
3713
|
children: (h) => (() => {
|
|
3517
|
-
var _el$
|
|
3518
|
-
spread(_el$
|
|
3714
|
+
var _el$34 = getNextElement(_tmpl$2$4);
|
|
3715
|
+
spread(_el$34, () => slot("hourLabel", {
|
|
3519
3716
|
base: {
|
|
3520
3717
|
position: "absolute",
|
|
3521
3718
|
top: Math.max(0, (h() - windowStart()) * hourHeight() - 6),
|
|
@@ -3526,16 +3723,16 @@ function TimeGrid(incoming) {
|
|
|
3526
3723
|
color: theme().textMuted
|
|
3527
3724
|
}
|
|
3528
3725
|
}), true);
|
|
3529
|
-
insert(_el$
|
|
3726
|
+
insert(_el$34, scope((() => {
|
|
3530
3727
|
var _c$9 = memo(() => !!props.hourComponent);
|
|
3531
3728
|
return () => _c$9() ? props.hourComponent(h(), props.ampm) : memo(() => h() === 0)() ? "" : formatHour(h(), { ampm: props.ampm });
|
|
3532
3729
|
})()));
|
|
3533
3730
|
runHydrationEvents();
|
|
3534
|
-
return _el$
|
|
3731
|
+
return _el$34;
|
|
3535
3732
|
})()
|
|
3536
3733
|
})));
|
|
3537
3734
|
runHydrationEvents();
|
|
3538
|
-
return _el$
|
|
3735
|
+
return _el$33;
|
|
3539
3736
|
})();
|
|
3540
3737
|
})()), _el$12, _co$3);
|
|
3541
3738
|
insert(_el$10, scope(() => createComponent(For, {
|
|
@@ -3553,17 +3750,24 @@ function TimeGrid(incoming) {
|
|
|
3553
3750
|
const currentCreateBox = createBox();
|
|
3554
3751
|
return currentCreateBox?.dayIndex === dayIndex && currentCreateBox.dayTime === day().getTime() ? currentCreateBox : null;
|
|
3555
3752
|
});
|
|
3556
|
-
const
|
|
3753
|
+
const createRange = createMemo(() => {
|
|
3557
3754
|
const currentGhost = ghost();
|
|
3558
|
-
return currentGhost && props.
|
|
3755
|
+
return currentGhost && props.onCreateEvent ? cellRangeFromDrag(day(), currentGhost.startPx, currentGhost.curPx, hourHeight(), windowStart(), snapMinutes()) : null;
|
|
3559
3756
|
}, { equals: sameRange$1 });
|
|
3757
|
+
const ghostRange = createMemo(() => props.renderCreateGhost ? createRange() : null);
|
|
3758
|
+
const previewPlacement = createMemo(() => {
|
|
3759
|
+
const range = createRange();
|
|
3760
|
+
if (range) return createRangePlacement(range, day(), hourHeight(), windowStart(), totalHeight(), props.minEventHeight ?? DEFAULT_MIN_EVENT_HEIGHT);
|
|
3761
|
+
const current = ghost();
|
|
3762
|
+
return current ? createPreviewPlacement(Math.min(current.startPx, current.curPx), Math.abs(current.curPx - current.startPx), totalHeight()) : {};
|
|
3763
|
+
});
|
|
3560
3764
|
const spill = createMemo(() => multiDayMove() ? null : spillPreviewFor(dayIndex));
|
|
3561
3765
|
const moveSegment = createMemo(() => {
|
|
3562
3766
|
const currentMultiDayMove = multiDayMove();
|
|
3563
3767
|
return currentMultiDayMove ? layoutDayEvents$1([currentMultiDayMove], day())[0] : void 0;
|
|
3564
3768
|
});
|
|
3565
|
-
var _el$
|
|
3566
|
-
spread(_el$
|
|
3769
|
+
var _el$35 = getNextElement(_tmpl$8$1), _el$37 = _el$35.firstChild, [_el$38, _co$9] = getNextMarker(_el$37.nextSibling), _el$39 = _el$38.nextSibling, [_el$40, _co$0] = getNextMarker(_el$39.nextSibling), _el$36 = _el$40.nextSibling, _el$41 = _el$36.nextSibling, [_el$42, _co$1] = getNextMarker(_el$41.nextSibling), _el$43 = _el$42.nextSibling, [_el$44, _co$10] = getNextMarker(_el$43.nextSibling), _el$45 = _el$44.nextSibling, [_el$46, _co$11] = getNextMarker(_el$45.nextSibling), _el$47 = _el$46.nextSibling, [_el$48, _co$12] = getNextMarker(_el$47.nextSibling), _el$49 = _el$48.nextSibling, [_el$50, _co$13] = getNextMarker(_el$49.nextSibling);
|
|
3770
|
+
spread(_el$35, [
|
|
3567
3771
|
{
|
|
3568
3772
|
get "data-date"() {
|
|
3569
3773
|
return day().toISOString();
|
|
@@ -3588,7 +3792,7 @@ function TimeGrid(incoming) {
|
|
|
3588
3792
|
}
|
|
3589
3793
|
},
|
|
3590
3794
|
() => dataState({
|
|
3591
|
-
"data-today": getIsToday(day()),
|
|
3795
|
+
"data-today": getIsToday(day(), new Date(todayKey())),
|
|
3592
3796
|
"data-weekend": isWeekend(day())
|
|
3593
3797
|
}),
|
|
3594
3798
|
() => slot("dayColumn", {
|
|
@@ -3602,14 +3806,14 @@ function TimeGrid(incoming) {
|
|
|
3602
3806
|
}
|
|
3603
3807
|
})
|
|
3604
3808
|
], true);
|
|
3605
|
-
insert(_el$
|
|
3809
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3606
3810
|
get each() {
|
|
3607
3811
|
return bands();
|
|
3608
3812
|
},
|
|
3609
3813
|
keyed: false,
|
|
3610
3814
|
children: (b) => (() => {
|
|
3611
|
-
var _el$
|
|
3612
|
-
spread(_el$
|
|
3815
|
+
var _el$51 = getNextElement(_tmpl$2$4);
|
|
3816
|
+
spread(_el$51, [{ "aria-hidden": "true" }, () => slot("businessHours", {
|
|
3613
3817
|
base: {
|
|
3614
3818
|
position: "absolute",
|
|
3615
3819
|
left: 0,
|
|
@@ -3621,16 +3825,16 @@ function TimeGrid(incoming) {
|
|
|
3621
3825
|
},
|
|
3622
3826
|
themed: props.renderBusinessHours ? void 0 : { background: theme().outsideHoursBackground }
|
|
3623
3827
|
})], true);
|
|
3624
|
-
insert(_el$
|
|
3828
|
+
insert(_el$51, scope(() => props.renderBusinessHours?.({
|
|
3625
3829
|
date: day(),
|
|
3626
3830
|
start: b().start,
|
|
3627
3831
|
end: b().end
|
|
3628
3832
|
})));
|
|
3629
3833
|
runHydrationEvents();
|
|
3630
|
-
return _el$
|
|
3834
|
+
return _el$51;
|
|
3631
3835
|
})()
|
|
3632
|
-
})), _el$
|
|
3633
|
-
insert(_el$
|
|
3836
|
+
})), _el$38, _co$9);
|
|
3837
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3634
3838
|
get each() {
|
|
3635
3839
|
return backgroundByDay()[dayIndex];
|
|
3636
3840
|
},
|
|
@@ -3647,8 +3851,8 @@ function TimeGrid(incoming) {
|
|
|
3647
3851
|
}));
|
|
3648
3852
|
return memo(() => {
|
|
3649
3853
|
if (!RenderBackground()) {
|
|
3650
|
-
var _el$
|
|
3651
|
-
spread(_el$
|
|
3854
|
+
var _el$52 = getNextElement(_tmpl$2$4);
|
|
3855
|
+
spread(_el$52, [{
|
|
3652
3856
|
"aria-hidden": "true",
|
|
3653
3857
|
get title() {
|
|
3654
3858
|
return b().event.title;
|
|
@@ -3661,15 +3865,15 @@ function TimeGrid(incoming) {
|
|
|
3661
3865
|
themed: { background: theme().backgroundEvent }
|
|
3662
3866
|
})], false);
|
|
3663
3867
|
runHydrationEvents();
|
|
3664
|
-
return _el$
|
|
3868
|
+
return _el$52;
|
|
3665
3869
|
}
|
|
3666
3870
|
const dayStart = createMemo(() => startOfDay(days()[dayIndex]));
|
|
3667
|
-
var _el$
|
|
3668
|
-
spread(_el$
|
|
3871
|
+
var _el$53 = getNextElement(_tmpl$2$4);
|
|
3872
|
+
spread(_el$53, () => slot("backgroundEvent", { base: {
|
|
3669
3873
|
...geometry(),
|
|
3670
3874
|
pointerEvents: "auto"
|
|
3671
3875
|
} }), true);
|
|
3672
|
-
insert(_el$
|
|
3876
|
+
insert(_el$53, createComponent(Dynamic, {
|
|
3673
3877
|
get component() {
|
|
3674
3878
|
return RenderBackground();
|
|
3675
3879
|
},
|
|
@@ -3695,11 +3899,11 @@ function TimeGrid(incoming) {
|
|
|
3695
3899
|
onPress: () => props.onPressEvent?.(b().event)
|
|
3696
3900
|
}));
|
|
3697
3901
|
runHydrationEvents();
|
|
3698
|
-
return _el$
|
|
3902
|
+
return _el$53;
|
|
3699
3903
|
});
|
|
3700
3904
|
}
|
|
3701
|
-
})), _el$
|
|
3702
|
-
spread(_el$
|
|
3905
|
+
})), _el$40, _co$0);
|
|
3906
|
+
spread(_el$36, [{ "aria-hidden": "true" }, () => slot("gridLines", {
|
|
3703
3907
|
base: {
|
|
3704
3908
|
position: "absolute",
|
|
3705
3909
|
inset: 0,
|
|
@@ -3708,7 +3912,7 @@ function TimeGrid(incoming) {
|
|
|
3708
3912
|
},
|
|
3709
3913
|
themed: { backgroundImage: gridLines() }
|
|
3710
3914
|
})], false);
|
|
3711
|
-
insert(_el$
|
|
3915
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3712
3916
|
get each() {
|
|
3713
3917
|
return positioned();
|
|
3714
3918
|
},
|
|
@@ -3717,7 +3921,11 @@ function TimeGrid(incoming) {
|
|
|
3717
3921
|
const key = createMemo(() => `${dayIndex}:${idx}`);
|
|
3718
3922
|
const active = createMemo(() => {
|
|
3719
3923
|
const currentDrag = drag();
|
|
3720
|
-
return !paged() && currentDrag?.key === key() && (!
|
|
3924
|
+
return !paged() && currentDrag?.key === key() && (!multiDayHeld() || pe().event === movingEvent()) ? currentDrag : null;
|
|
3925
|
+
});
|
|
3926
|
+
const floating = createMemo(() => {
|
|
3927
|
+
const currentActive = active();
|
|
3928
|
+
return currentActive?.kind === "move" && currentActive.moved;
|
|
3721
3929
|
});
|
|
3722
3930
|
const hiddenForMove = createMemo(() => !!multiDayMove() && pe().event === movingEvent());
|
|
3723
3931
|
const startHours = createMemo(() => {
|
|
@@ -3736,7 +3944,7 @@ function TimeGrid(incoming) {
|
|
|
3736
3944
|
const widthPct = createMemo(() => 100 / pe().columns);
|
|
3737
3945
|
const onPress = () => props.onPressEvent?.(pe().event);
|
|
3738
3946
|
const args = createMemo(() => ({
|
|
3739
|
-
event: pe().event,
|
|
3947
|
+
event: active() ? withLiveBounds(pe().event) : pe().event,
|
|
3740
3948
|
mode: props.mode,
|
|
3741
3949
|
isAllDay: false,
|
|
3742
3950
|
boxHeight: boxHeight(),
|
|
@@ -3748,8 +3956,8 @@ function TimeGrid(incoming) {
|
|
|
3748
3956
|
const editable = createMemo(() => !!props.onDragEvent && pe().event.draggable !== false);
|
|
3749
3957
|
const canMove = createMemo(() => editable() && (pe().event.startEditable ?? props.eventStartEditable));
|
|
3750
3958
|
const canResize = createMemo(() => editable() && (pe().event.durationEditable ?? props.eventDurationEditable));
|
|
3751
|
-
var _el$
|
|
3752
|
-
spread(_el$
|
|
3959
|
+
var _el$54 = getNextElement(_tmpl$9), _el$55 = _el$54.firstChild, [_el$56, _co$14] = getNextMarker(_el$55.nextSibling), _el$57 = _el$56.nextSibling, [_el$58, _co$15] = getNextMarker(_el$57.nextSibling), _el$59 = _el$58.nextSibling, [_el$60, _co$16] = getNextMarker(_el$59.nextSibling);
|
|
3960
|
+
spread(_el$54, [
|
|
3753
3961
|
{
|
|
3754
3962
|
"role": "button",
|
|
3755
3963
|
"tabindex": 0,
|
|
@@ -3784,8 +3992,8 @@ function TimeGrid(incoming) {
|
|
|
3784
3992
|
position: "absolute",
|
|
3785
3993
|
top: top(),
|
|
3786
3994
|
height: boxHeight(),
|
|
3787
|
-
left: `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
3788
|
-
width: `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
3995
|
+
left: floating() ? props.eventGap : `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
3996
|
+
width: floating() ? `calc(100% - ${props.eventGap * 2}px)` : `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
3789
3997
|
cursor: canMove() ? "grab" : "pointer",
|
|
3790
3998
|
touchAction: canMove() ? "pan-y" : "auto",
|
|
3791
3999
|
userSelect: canMove() ? "none" : void 0,
|
|
@@ -3796,7 +4004,7 @@ function TimeGrid(incoming) {
|
|
|
3796
4004
|
...active() && active()?.dayOffsetPx !== 0 ? { transform: `translateX(${active()?.dayOffsetPx}px)` } : null
|
|
3797
4005
|
} })
|
|
3798
4006
|
], true);
|
|
3799
|
-
insert(_el$
|
|
4007
|
+
insert(_el$54, scope((() => {
|
|
3800
4008
|
var _c$1 = memo(() => !!Renderer());
|
|
3801
4009
|
return () => _c$1() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3802
4010
|
return Renderer();
|
|
@@ -3808,12 +4016,12 @@ function TimeGrid(incoming) {
|
|
|
3808
4016
|
return slot("eventBox");
|
|
3809
4017
|
}
|
|
3810
4018
|
}));
|
|
3811
|
-
})()), _el$
|
|
3812
|
-
insert(_el$
|
|
4019
|
+
})()), _el$56, _co$14);
|
|
4020
|
+
insert(_el$54, scope((() => {
|
|
3813
4021
|
var _c$10 = memo(() => !!(canResize() && !pe().continuesBefore));
|
|
3814
4022
|
return () => _c$10() ? (() => {
|
|
3815
|
-
var _el$
|
|
3816
|
-
_el$
|
|
4023
|
+
var _el$61 = getNextElement(_tmpl$2$4);
|
|
4024
|
+
_el$61._$$pointerdown = (e) => {
|
|
3817
4025
|
pressEvent(e, pe(), key(), "resize-start", dayIndex, canMove() ? onPress : void 0);
|
|
3818
4026
|
};
|
|
3819
4027
|
effect(() => readShallow(css({
|
|
@@ -3825,17 +4033,17 @@ function TimeGrid(incoming) {
|
|
|
3825
4033
|
cursor: "ns-resize",
|
|
3826
4034
|
touchAction: "pan-y"
|
|
3827
4035
|
})), (_v$, _$p) => {
|
|
3828
|
-
style(_el$
|
|
4036
|
+
style(_el$61, _v$, _$p);
|
|
3829
4037
|
});
|
|
3830
4038
|
runHydrationEvents();
|
|
3831
|
-
return _el$
|
|
4039
|
+
return _el$61;
|
|
3832
4040
|
})() : null;
|
|
3833
|
-
})()), _el$
|
|
3834
|
-
insert(_el$
|
|
4041
|
+
})()), _el$58, _co$15);
|
|
4042
|
+
insert(_el$54, scope((() => {
|
|
3835
4043
|
var _c$11 = memo(() => !!(canResize() && !pe().continuesAfter));
|
|
3836
4044
|
return () => _c$11() ? (() => {
|
|
3837
|
-
var _el$
|
|
3838
|
-
_el$
|
|
4045
|
+
var _el$62 = getNextElement(_tmpl$2$4);
|
|
4046
|
+
_el$62._$$pointerdown = (e) => {
|
|
3839
4047
|
pressEvent(e, pe(), key(), "resize", dayIndex, canMove() ? onPress : void 0);
|
|
3840
4048
|
};
|
|
3841
4049
|
effect(() => readShallow(css({
|
|
@@ -3847,24 +4055,24 @@ function TimeGrid(incoming) {
|
|
|
3847
4055
|
cursor: "ns-resize",
|
|
3848
4056
|
touchAction: "pan-y"
|
|
3849
4057
|
})), (_v$, _$p) => {
|
|
3850
|
-
style(_el$
|
|
4058
|
+
style(_el$62, _v$, _$p);
|
|
3851
4059
|
});
|
|
3852
4060
|
runHydrationEvents();
|
|
3853
|
-
return _el$
|
|
4061
|
+
return _el$62;
|
|
3854
4062
|
})() : null;
|
|
3855
|
-
})()), _el$
|
|
4063
|
+
})()), _el$60, _co$16);
|
|
3856
4064
|
runHydrationEvents();
|
|
3857
|
-
return _el$
|
|
4065
|
+
return _el$54;
|
|
3858
4066
|
});
|
|
3859
4067
|
}
|
|
3860
|
-
})), _el$
|
|
3861
|
-
insert(_el$
|
|
4068
|
+
})), _el$42, _co$1);
|
|
4069
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3862
4070
|
get when() {
|
|
3863
4071
|
return moveSegment();
|
|
3864
4072
|
},
|
|
3865
4073
|
children: (moveSegment) => (() => {
|
|
3866
|
-
var _el$
|
|
3867
|
-
spread(_el$
|
|
4074
|
+
var _el$63 = getNextElement(_tmpl$2$4);
|
|
4075
|
+
spread(_el$63, [
|
|
3868
4076
|
{ "aria-hidden": "true" },
|
|
3869
4077
|
() => dataState({ "data-dragging": true }),
|
|
3870
4078
|
() => slot("event", { base: {
|
|
@@ -3878,7 +4086,7 @@ function TimeGrid(incoming) {
|
|
|
3878
4086
|
opacity: .85
|
|
3879
4087
|
} })
|
|
3880
4088
|
], true);
|
|
3881
|
-
insert(_el$
|
|
4089
|
+
insert(_el$63, scope(() => {
|
|
3882
4090
|
const args = {
|
|
3883
4091
|
event: moveSegment().event,
|
|
3884
4092
|
mode: props.mode,
|
|
@@ -3901,16 +4109,16 @@ function TimeGrid(incoming) {
|
|
|
3901
4109
|
})));
|
|
3902
4110
|
}));
|
|
3903
4111
|
runHydrationEvents();
|
|
3904
|
-
return _el$
|
|
4112
|
+
return _el$63;
|
|
3905
4113
|
})()
|
|
3906
|
-
})), _el$
|
|
3907
|
-
insert(_el$
|
|
4114
|
+
})), _el$44, _co$10);
|
|
4115
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3908
4116
|
get when() {
|
|
3909
4117
|
return spill();
|
|
3910
4118
|
},
|
|
3911
4119
|
children: (spill) => (() => {
|
|
3912
|
-
var _el$
|
|
3913
|
-
spread(_el$
|
|
4120
|
+
var _el$64 = getNextElement(_tmpl$2$4);
|
|
4121
|
+
spread(_el$64, [
|
|
3914
4122
|
{ "aria-hidden": "true" },
|
|
3915
4123
|
() => dataState({ "data-dragging": true }),
|
|
3916
4124
|
() => slot("event", { base: {
|
|
@@ -3924,7 +4132,7 @@ function TimeGrid(incoming) {
|
|
|
3924
4132
|
opacity: .85
|
|
3925
4133
|
} })
|
|
3926
4134
|
], true);
|
|
3927
|
-
insert(_el$
|
|
4135
|
+
insert(_el$64, scope((() => {
|
|
3928
4136
|
var _c$12 = memo(() => !!Renderer());
|
|
3929
4137
|
return () => _c$12() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3930
4138
|
return Renderer();
|
|
@@ -3938,14 +4146,14 @@ function TimeGrid(incoming) {
|
|
|
3938
4146
|
}));
|
|
3939
4147
|
})()));
|
|
3940
4148
|
runHydrationEvents();
|
|
3941
|
-
return _el$
|
|
4149
|
+
return _el$64;
|
|
3942
4150
|
})()
|
|
3943
|
-
})), _el$
|
|
3944
|
-
insert(_el$
|
|
4151
|
+
})), _el$46, _co$11);
|
|
4152
|
+
insert(_el$35, scope((() => {
|
|
3945
4153
|
var _c$0 = memo(() => !!showNow());
|
|
3946
4154
|
return () => _c$0() ? (() => {
|
|
3947
|
-
var _el$
|
|
3948
|
-
spread(_el$
|
|
4155
|
+
var _el$65 = getNextElement(_tmpl$6$2), _el$66 = _el$65.firstChild, _el$67 = _el$66.nextSibling;
|
|
4156
|
+
spread(_el$65, () => slot("nowIndicator", { base: {
|
|
3949
4157
|
position: "absolute",
|
|
3950
4158
|
top: nowTop(),
|
|
3951
4159
|
left: 0,
|
|
@@ -3969,20 +4177,20 @@ function TimeGrid(incoming) {
|
|
|
3969
4177
|
background: theme().nowIndicator
|
|
3970
4178
|
}))
|
|
3971
4179
|
}), ({ e, t }, _p$) => {
|
|
3972
|
-
style(_el$
|
|
3973
|
-
style(_el$
|
|
4180
|
+
style(_el$66, e, _p$?.e);
|
|
4181
|
+
style(_el$67, t, _p$?.t);
|
|
3974
4182
|
});
|
|
3975
4183
|
runHydrationEvents();
|
|
3976
|
-
return _el$
|
|
4184
|
+
return _el$65;
|
|
3977
4185
|
})() : null;
|
|
3978
|
-
})()), _el$
|
|
3979
|
-
insert(_el$
|
|
4186
|
+
})()), _el$48, _co$12);
|
|
4187
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3980
4188
|
get when() {
|
|
3981
4189
|
return ghost();
|
|
3982
4190
|
},
|
|
3983
|
-
children: (
|
|
3984
|
-
var _el$
|
|
3985
|
-
spread(_el$
|
|
4191
|
+
children: (_ghost) => (() => {
|
|
4192
|
+
var _el$68 = getNextElement(_tmpl$2$4);
|
|
4193
|
+
spread(_el$68, [{
|
|
3986
4194
|
"aria-hidden": "true",
|
|
3987
4195
|
get inert() {
|
|
3988
4196
|
return ghostRange() ? true : void 0;
|
|
@@ -3992,7 +4200,7 @@ function TimeGrid(incoming) {
|
|
|
3992
4200
|
position: "absolute",
|
|
3993
4201
|
left: props.eventGap,
|
|
3994
4202
|
right: props.eventGap,
|
|
3995
|
-
...
|
|
4203
|
+
...previewPlacement(),
|
|
3996
4204
|
boxSizing: "border-box",
|
|
3997
4205
|
...ghostRange() ? { overflow: "hidden" } : null,
|
|
3998
4206
|
opacity: .7,
|
|
@@ -4005,7 +4213,7 @@ function TimeGrid(incoming) {
|
|
|
4005
4213
|
borderRadius: 6
|
|
4006
4214
|
}
|
|
4007
4215
|
})], true);
|
|
4008
|
-
insert(_el$
|
|
4216
|
+
insert(_el$68, createComponent(Show, {
|
|
4009
4217
|
get when() {
|
|
4010
4218
|
return ghostRange();
|
|
4011
4219
|
},
|
|
@@ -4022,19 +4230,19 @@ function TimeGrid(incoming) {
|
|
|
4022
4230
|
})
|
|
4023
4231
|
}));
|
|
4024
4232
|
runHydrationEvents();
|
|
4025
|
-
return _el$
|
|
4233
|
+
return _el$68;
|
|
4026
4234
|
})()
|
|
4027
|
-
})), _el$
|
|
4235
|
+
})), _el$50, _co$13);
|
|
4028
4236
|
runHydrationEvents();
|
|
4029
|
-
return _el$
|
|
4237
|
+
return _el$35;
|
|
4030
4238
|
}
|
|
4031
4239
|
})), _el$14, _co$4);
|
|
4032
4240
|
insert(_el$6, scope((() => {
|
|
4033
4241
|
var _c$5 = memo(() => !!(paged() && draggedRef.current));
|
|
4034
4242
|
return () => _c$5() ? (() => {
|
|
4035
|
-
var _el$
|
|
4036
|
-
ref(() => (el) => ghostRef.current = el, _el$
|
|
4037
|
-
insert(_el$
|
|
4243
|
+
var _el$69 = getNextElement(_tmpl$0);
|
|
4244
|
+
ref(() => (el) => ghostRef.current = el, _el$69);
|
|
4245
|
+
insert(_el$69, scope((() => {
|
|
4038
4246
|
var _c$13 = memo(() => !!Renderer());
|
|
4039
4247
|
return () => _c$13() ? createComponent(Dynamic, {
|
|
4040
4248
|
get component() {
|
|
@@ -4088,9 +4296,9 @@ function TimeGrid(incoming) {
|
|
|
4088
4296
|
zIndex: 1e3,
|
|
4089
4297
|
opacity: .85
|
|
4090
4298
|
})), (_v$, _$p) => {
|
|
4091
|
-
style(_el$
|
|
4299
|
+
style(_el$69, _v$, _$p);
|
|
4092
4300
|
});
|
|
4093
|
-
return _el$
|
|
4301
|
+
return _el$69;
|
|
4094
4302
|
})() : null;
|
|
4095
4303
|
})()), _el$20, _co$7);
|
|
4096
4304
|
insert(_el$6, createComponent(Show, {
|
|
@@ -4189,6 +4397,10 @@ function YearView(incoming) {
|
|
|
4189
4397
|
}, incoming);
|
|
4190
4398
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
4191
4399
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
4400
|
+
const todayKey = createMemo(() => {
|
|
4401
|
+
props.date;
|
|
4402
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
4403
|
+
});
|
|
4192
4404
|
const slot = createSlots(props);
|
|
4193
4405
|
const sweepEnabled = createMemo(() => props.onSelectDrag != null || props.onCreateEvent != null);
|
|
4194
4406
|
const [creating, setCreating] = createSignal(null);
|
|
@@ -4369,7 +4581,7 @@ function YearView(incoming) {
|
|
|
4369
4581
|
});
|
|
4370
4582
|
return _el$10;
|
|
4371
4583
|
}
|
|
4372
|
-
const isToday = createMemo(() => getIsToday(day()));
|
|
4584
|
+
const isToday = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
4373
4585
|
const isHighlighted = createMemo(() => props.activeDate ? isSameCalendarDay(day(), props.activeDate) : isToday());
|
|
4374
4586
|
const hasEvents = createMemo(() => eventDays().has(startOfDay(day()).toISOString()));
|
|
4375
4587
|
const state = createMemo(() => daySelectionState$1(day(), {
|
|
@@ -4642,16 +4854,48 @@ function Calendar(incoming) {
|
|
|
4642
4854
|
const displayEvents = createMemo(() => {
|
|
4643
4855
|
let out = props.events ?? EMPTY_EVENTS;
|
|
4644
4856
|
if (out.some((e) => e.recurrence)) {
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
end = addDays(end, 1);
|
|
4649
|
-
}
|
|
4650
|
-
out = expandRecurringEvents$1(out, start, end);
|
|
4857
|
+
const [start, end] = expansionRange(props.mode, props.date, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks);
|
|
4858
|
+
const timeZone = props.timeZone;
|
|
4859
|
+
out = timeZone ? expandRecurringEvents$1(out, fromZonedTime(start, timeZone), fromZonedTime(end, timeZone), { timeZone }) : expandRecurringEvents$1(out, start, end);
|
|
4651
4860
|
}
|
|
4652
4861
|
if (props.timeZone) out = eventsInTimeZone(out, props.timeZone);
|
|
4653
4862
|
return out;
|
|
4654
4863
|
});
|
|
4864
|
+
const zoned = {
|
|
4865
|
+
onPressEvent: createMemo(() => {
|
|
4866
|
+
const handler = props.onPressEvent;
|
|
4867
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4868
|
+
}),
|
|
4869
|
+
onDragStart: createMemo(() => {
|
|
4870
|
+
const handler = props.onDragStart;
|
|
4871
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4872
|
+
}),
|
|
4873
|
+
onDragEvent: createMemo(() => {
|
|
4874
|
+
const handler = props.onDragEvent;
|
|
4875
|
+
return handler && props.timeZone ? (event, start, end) => {
|
|
4876
|
+
const bounds = zonedDragBounds(event, start, end, { keepDuration: props.mode !== "month" && props.mode !== "multiweek" });
|
|
4877
|
+
if (!bounds) return false;
|
|
4878
|
+
return handler(zonedEventSource(event), bounds.start, bounds.end);
|
|
4879
|
+
} : handler;
|
|
4880
|
+
}),
|
|
4881
|
+
onPressMore: createMemo(() => {
|
|
4882
|
+
const handler = props.onPressMore;
|
|
4883
|
+
return handler && props.timeZone ? (dayEvents, day) => handler(dayEvents.map(zonedEventSource), day) : handler;
|
|
4884
|
+
}),
|
|
4885
|
+
onPressTime: createMemo(() => {
|
|
4886
|
+
const handler = props.onPressCell;
|
|
4887
|
+
const timeZone = props.timeZone;
|
|
4888
|
+
return handler && timeZone ? (time) => handler(fromZonedTime(time, timeZone)) : handler;
|
|
4889
|
+
}),
|
|
4890
|
+
onCreateTimed: createMemo(() => {
|
|
4891
|
+
const handler = props.onCreateEvent;
|
|
4892
|
+
const timeZone = props.timeZone;
|
|
4893
|
+
return handler && timeZone ? (start, end) => {
|
|
4894
|
+
const range = fromZonedRange(start, end, timeZone);
|
|
4895
|
+
if (range) handler(range.start, range.end);
|
|
4896
|
+
} : handler;
|
|
4897
|
+
})
|
|
4898
|
+
};
|
|
4655
4899
|
const handlePageKeys = (e) => {
|
|
4656
4900
|
if (!props.onChangeDate) return;
|
|
4657
4901
|
if (e.key === "PageDown") props.onChangeDate(pageStep(props.mode, props.date, 1, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks));
|
|
@@ -4678,6 +4922,12 @@ function Calendar(incoming) {
|
|
|
4678
4922
|
get locale() {
|
|
4679
4923
|
return props.locale;
|
|
4680
4924
|
},
|
|
4925
|
+
get now() {
|
|
4926
|
+
return props.now;
|
|
4927
|
+
},
|
|
4928
|
+
get timeZone() {
|
|
4929
|
+
return props.timeZone;
|
|
4930
|
+
},
|
|
4681
4931
|
get labels() {
|
|
4682
4932
|
return props.labels;
|
|
4683
4933
|
},
|
|
@@ -4734,6 +4984,12 @@ function Calendar(incoming) {
|
|
|
4734
4984
|
get locale() {
|
|
4735
4985
|
return props.locale;
|
|
4736
4986
|
},
|
|
4987
|
+
get now() {
|
|
4988
|
+
return props.now;
|
|
4989
|
+
},
|
|
4990
|
+
get timeZone() {
|
|
4991
|
+
return props.timeZone;
|
|
4992
|
+
},
|
|
4737
4993
|
get ampm() {
|
|
4738
4994
|
return props.ampm;
|
|
4739
4995
|
},
|
|
@@ -4765,7 +5021,7 @@ function Calendar(incoming) {
|
|
|
4765
5021
|
return props.eventAccessibilityLabel;
|
|
4766
5022
|
},
|
|
4767
5023
|
get onPressEvent() {
|
|
4768
|
-
return
|
|
5024
|
+
return zoned.onPressEvent();
|
|
4769
5025
|
},
|
|
4770
5026
|
get onPressDay() {
|
|
4771
5027
|
return props.onPressDay;
|
|
@@ -4793,6 +5049,12 @@ function Calendar(incoming) {
|
|
|
4793
5049
|
get locale() {
|
|
4794
5050
|
return props.locale;
|
|
4795
5051
|
},
|
|
5052
|
+
get now() {
|
|
5053
|
+
return props.now;
|
|
5054
|
+
},
|
|
5055
|
+
get timeZone() {
|
|
5056
|
+
return props.timeZone;
|
|
5057
|
+
},
|
|
4796
5058
|
get labels() {
|
|
4797
5059
|
return props.labels;
|
|
4798
5060
|
},
|
|
@@ -4859,14 +5121,17 @@ function Calendar(incoming) {
|
|
|
4859
5121
|
get onCreateEvent() {
|
|
4860
5122
|
return props.onCreateEvent;
|
|
4861
5123
|
},
|
|
5124
|
+
get renderCreateGhost() {
|
|
5125
|
+
return props.renderCreateGhost;
|
|
5126
|
+
},
|
|
4862
5127
|
get onSelectDrag() {
|
|
4863
5128
|
return props.onSelectDrag;
|
|
4864
5129
|
},
|
|
4865
5130
|
get onDragEvent() {
|
|
4866
|
-
return
|
|
5131
|
+
return zoned.onDragEvent();
|
|
4867
5132
|
},
|
|
4868
5133
|
get onDragStart() {
|
|
4869
|
-
return
|
|
5134
|
+
return zoned.onDragStart();
|
|
4870
5135
|
},
|
|
4871
5136
|
get eventStartEditable() {
|
|
4872
5137
|
return props.eventStartEditable;
|
|
@@ -4875,10 +5140,10 @@ function Calendar(incoming) {
|
|
|
4875
5140
|
return props.eventOverlap;
|
|
4876
5141
|
},
|
|
4877
5142
|
get onPressEvent() {
|
|
4878
|
-
return
|
|
5143
|
+
return zoned.onPressEvent();
|
|
4879
5144
|
},
|
|
4880
5145
|
get onPressMore() {
|
|
4881
|
-
return
|
|
5146
|
+
return zoned.onPressMore();
|
|
4882
5147
|
},
|
|
4883
5148
|
get renderEvent() {
|
|
4884
5149
|
return props.renderMonthEvent;
|
|
@@ -4912,6 +5177,12 @@ function Calendar(incoming) {
|
|
|
4912
5177
|
get locale() {
|
|
4913
5178
|
return props.locale;
|
|
4914
5179
|
},
|
|
5180
|
+
get now() {
|
|
5181
|
+
return props.now;
|
|
5182
|
+
},
|
|
5183
|
+
get timeZone() {
|
|
5184
|
+
return props.timeZone;
|
|
5185
|
+
},
|
|
4915
5186
|
get labels() {
|
|
4916
5187
|
return props.labels;
|
|
4917
5188
|
},
|
|
@@ -4978,14 +5249,17 @@ function Calendar(incoming) {
|
|
|
4978
5249
|
get onCreateEvent() {
|
|
4979
5250
|
return props.onCreateEvent;
|
|
4980
5251
|
},
|
|
5252
|
+
get renderCreateGhost() {
|
|
5253
|
+
return props.renderCreateGhost;
|
|
5254
|
+
},
|
|
4981
5255
|
get onSelectDrag() {
|
|
4982
5256
|
return props.onSelectDrag;
|
|
4983
5257
|
},
|
|
4984
5258
|
get onDragEvent() {
|
|
4985
|
-
return
|
|
5259
|
+
return zoned.onDragEvent();
|
|
4986
5260
|
},
|
|
4987
5261
|
get onDragStart() {
|
|
4988
|
-
return
|
|
5262
|
+
return zoned.onDragStart();
|
|
4989
5263
|
},
|
|
4990
5264
|
get eventStartEditable() {
|
|
4991
5265
|
return props.eventStartEditable;
|
|
@@ -4994,10 +5268,10 @@ function Calendar(incoming) {
|
|
|
4994
5268
|
return props.eventOverlap;
|
|
4995
5269
|
},
|
|
4996
5270
|
get onPressEvent() {
|
|
4997
|
-
return
|
|
5271
|
+
return zoned.onPressEvent();
|
|
4998
5272
|
},
|
|
4999
5273
|
get onPressMore() {
|
|
5000
|
-
return
|
|
5274
|
+
return zoned.onPressMore();
|
|
5001
5275
|
},
|
|
5002
5276
|
get renderEvent() {
|
|
5003
5277
|
return props.renderMonthEvent;
|
|
@@ -5130,22 +5404,22 @@ function Calendar(incoming) {
|
|
|
5130
5404
|
return props.touchDragThreshold;
|
|
5131
5405
|
},
|
|
5132
5406
|
get onPressEvent() {
|
|
5133
|
-
return
|
|
5407
|
+
return zoned.onPressEvent();
|
|
5134
5408
|
},
|
|
5135
5409
|
get onPressCell() {
|
|
5136
|
-
return
|
|
5410
|
+
return zoned.onPressTime();
|
|
5137
5411
|
},
|
|
5138
5412
|
get onCreateEvent() {
|
|
5139
|
-
return
|
|
5413
|
+
return zoned.onCreateTimed();
|
|
5140
5414
|
},
|
|
5141
5415
|
get renderCreateGhost() {
|
|
5142
5416
|
return props.renderCreateGhost;
|
|
5143
5417
|
},
|
|
5144
5418
|
get onDragStart() {
|
|
5145
|
-
return
|
|
5419
|
+
return zoned.onDragStart();
|
|
5146
5420
|
},
|
|
5147
5421
|
get onDragEvent() {
|
|
5148
|
-
return
|
|
5422
|
+
return zoned.onDragEvent();
|
|
5149
5423
|
},
|
|
5150
5424
|
get getEventId() {
|
|
5151
5425
|
return props.getEventId;
|