@super-calendar/solid 2.17.0 → 2.19.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 +46 -9
- package/dist/client/index.d.ts +56 -14
- package/dist/client/index.js +683 -406
- package/dist/server/index.d.ts +56 -14
- package/dist/server/index.js +1418 -1238
- package/package.json +7 -7
- package/src/Agenda.tsx +19 -2
- package/src/Calendar.tsx +108 -30
- package/src/MonthList.tsx +1 -1
- package/src/MonthView.tsx +220 -29
- 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, keepMonthDraftVisible, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, lightColors, loadEventSource, loadEventSource as loadEventSource$1, monthCreateRange, monthDropBounds, monthExtraLaneColumns, monthVisibleBars, movedClockSpan, nextDateRange, nextDateRange as nextDateRange$1, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, titleNumberOfLines, toICalendar, toZonedTime, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1, withDraftEventDays, 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";
|
|
@@ -292,8 +292,8 @@ function VirtualList(props) {
|
|
|
292
292
|
var _tmpl$$8 = /*#__PURE__*/ template(`<div><div></div><!$><!/>`);
|
|
293
293
|
var _tmpl$2$7 = /*#__PURE__*/ template(`<div>`);
|
|
294
294
|
var _tmpl$3$6 = /*#__PURE__*/ template(`<button>`);
|
|
295
|
-
var _tmpl$4$5 = /*#__PURE__*/ template(`<div
|
|
296
|
-
var _tmpl$5$5 = /*#__PURE__*/ template(`<div
|
|
295
|
+
var _tmpl$4$5 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/>`);
|
|
296
|
+
var _tmpl$5$5 = /*#__PURE__*/ template(`<div>No events`);
|
|
297
297
|
/**
|
|
298
298
|
* Styleable parts of {@link Agenda}. Pass a class or inline style per slot via the
|
|
299
299
|
* `classNames` / `styles` props.
|
|
@@ -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 ? {
|
|
@@ -400,28 +404,22 @@ function Agenda(incoming) {
|
|
|
400
404
|
color: highlighted() ? theme().todayBackground : theme().textMuted
|
|
401
405
|
}
|
|
402
406
|
}));
|
|
403
|
-
return
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}, headerProps], true);
|
|
420
|
-
insert(_el$6, scope(() => label()));
|
|
421
|
-
runHydrationEvents();
|
|
422
|
-
return _el$6;
|
|
423
|
-
}
|
|
424
|
-
});
|
|
407
|
+
return memo(() => memo(() => !!props.onPressDay)() ? (() => {
|
|
408
|
+
var _el$6 = getNextElement(_tmpl$3$6);
|
|
409
|
+
spread(_el$6, [{
|
|
410
|
+
"type": "button",
|
|
411
|
+
"onClick": () => props.onPressDay?.(row.date)
|
|
412
|
+
}, headerProps], true);
|
|
413
|
+
insert(_el$6, scope(() => label()));
|
|
414
|
+
runHydrationEvents();
|
|
415
|
+
return _el$6;
|
|
416
|
+
})() : (() => {
|
|
417
|
+
var _el$7 = getNextElement(_tmpl$2$7);
|
|
418
|
+
spread(_el$7, headerProps, true);
|
|
419
|
+
insert(_el$7, scope(() => label()));
|
|
420
|
+
runHydrationEvents();
|
|
421
|
+
return _el$7;
|
|
422
|
+
})());
|
|
425
423
|
};
|
|
426
424
|
const EventRow = (row) => {
|
|
427
425
|
const args = createMemo(() => ({
|
|
@@ -454,30 +452,23 @@ function Agenda(incoming) {
|
|
|
454
452
|
},
|
|
455
453
|
themed: { padding: "2px 12px" }
|
|
456
454
|
})], true);
|
|
457
|
-
insert(_el$8,
|
|
458
|
-
|
|
455
|
+
insert(_el$8, scope((() => {
|
|
456
|
+
var _c$2 = memo(() => !!Renderer());
|
|
457
|
+
return () => _c$2() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
459
458
|
return Renderer();
|
|
460
|
-
},
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
} }));
|
|
470
|
-
},
|
|
471
|
-
get children() {
|
|
472
|
-
return createComponent(Dynamic, mergeProps({ get component() {
|
|
473
|
-
return Renderer();
|
|
474
|
-
} }, args));
|
|
475
|
-
}
|
|
476
|
-
}));
|
|
459
|
+
} }, args)) : createComponent(DefaultAgendaRow, mergeProps(args, { get cardProps() {
|
|
460
|
+
return slot("event", { themed: {
|
|
461
|
+
padding: "6px 10px",
|
|
462
|
+
borderRadius: 8,
|
|
463
|
+
background: theme().eventBackground,
|
|
464
|
+
color: theme().eventText
|
|
465
|
+
} });
|
|
466
|
+
} }));
|
|
467
|
+
})()));
|
|
477
468
|
runHydrationEvents();
|
|
478
469
|
return _el$8;
|
|
479
470
|
};
|
|
480
|
-
var _el$9 = getNextElement(_tmpl$
|
|
471
|
+
var _el$9 = getNextElement(_tmpl$4$5), _el$0 = _el$9.firstChild, [_el$1, _co$2] = getNextMarker(_el$0.nextSibling), _el$10 = _el$1.nextSibling, [_el$11, _co$3] = getNextMarker(_el$10.nextSibling);
|
|
481
472
|
insert(_el$9, createComponent(VirtualList, {
|
|
482
473
|
get data() {
|
|
483
474
|
return rows();
|
|
@@ -493,38 +484,26 @@ function Agenda(incoming) {
|
|
|
493
484
|
renderItem: (row) => {
|
|
494
485
|
const header = createMemo(() => row.item.kind === "header" ? row.item : void 0);
|
|
495
486
|
const event = createMemo(() => row.item.kind === "event" ? row.item.event : void 0);
|
|
496
|
-
return [createComponent(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
return value().date;
|
|
502
|
-
} })
|
|
503
|
-
}), createComponent(Show, {
|
|
504
|
-
get when() {
|
|
505
|
-
return event();
|
|
506
|
-
},
|
|
507
|
-
children: (value) => createComponent(EventRow, { get event() {
|
|
508
|
-
return value();
|
|
509
|
-
} })
|
|
510
|
-
})];
|
|
487
|
+
return [memo(() => memo(() => !!header())() ? createComponent(Header, { get date() {
|
|
488
|
+
return header().date;
|
|
489
|
+
} }) : void 0), memo(() => memo(() => !!event())() ? createComponent(EventRow, { get event() {
|
|
490
|
+
return event();
|
|
491
|
+
} }) : void 0)];
|
|
511
492
|
}
|
|
512
|
-
}), _el$
|
|
513
|
-
insert(_el$9,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
var _el$0 = getNextElement(_tmpl$4$5);
|
|
519
|
-
spread(_el$0, () => slot("empty", { themed: {
|
|
493
|
+
}), _el$1, _co$2);
|
|
494
|
+
insert(_el$9, scope((() => {
|
|
495
|
+
var _c$3 = memo(() => rows().length === 0);
|
|
496
|
+
return () => _c$3() ? (() => {
|
|
497
|
+
var _el$12 = getNextElement(_tmpl$5$5);
|
|
498
|
+
spread(_el$12, () => slot("empty", { themed: {
|
|
520
499
|
padding: "16px 12px",
|
|
521
500
|
color: theme().textMuted,
|
|
522
501
|
fontSize: 14
|
|
523
502
|
} }), true);
|
|
524
503
|
runHydrationEvents();
|
|
525
|
-
return _el$
|
|
526
|
-
}
|
|
527
|
-
}), _el$
|
|
504
|
+
return _el$12;
|
|
505
|
+
})() : void 0;
|
|
506
|
+
})()), _el$11, _co$3);
|
|
528
507
|
effect(() => ({
|
|
529
508
|
e: readShallow(props.className),
|
|
530
509
|
t: readShallow(css({
|
|
@@ -636,16 +615,17 @@ var _tmpl$$7 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div>`);
|
|
|
636
615
|
var _tmpl$2$6 = /*#__PURE__*/ template(`<div>`);
|
|
637
616
|
var _tmpl$3$5 = /*#__PURE__*/ template(`<span>`);
|
|
638
617
|
var _tmpl$4$4 = /*#__PURE__*/ template(`<div role=gridcell aria-hidden=true>`);
|
|
639
|
-
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span
|
|
618
|
+
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span><!$><!/><!$><!/><div><!$><!/><!$><!/><!$><!/>`);
|
|
640
619
|
var _tmpl$6$4 = /*#__PURE__*/ template(`<button>`);
|
|
641
620
|
var _tmpl$7$2 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
642
621
|
var _tmpl$8$2 = /*#__PURE__*/ template(`<div><div></div><!$><!/>`);
|
|
643
622
|
var _tmpl$9$1 = /*#__PURE__*/ template(`<button type=button>`);
|
|
644
|
-
var _tmpl$0 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
623
|
+
var _tmpl$0$1 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
645
624
|
/**
|
|
646
625
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
647
626
|
* the `classNames` / `styles` props to restyle just that part.
|
|
648
627
|
*/
|
|
628
|
+
const pressedEvent = (event) => event.target instanceof Element && event.target.closest("[data-slot=\"chipButton\"]") !== null;
|
|
649
629
|
const EMPTY_LAYOUT = {
|
|
650
630
|
segments: [],
|
|
651
631
|
laneCount: 0
|
|
@@ -654,6 +634,8 @@ const CHIP_HEIGHT = 18;
|
|
|
654
634
|
const CHIP_GAP = 2;
|
|
655
635
|
const CELL_PAD = 4;
|
|
656
636
|
const DRAGGED_CHIP_OPACITY = .4;
|
|
637
|
+
const DRAG_SLOP_PX = 4;
|
|
638
|
+
const TOUCH_DRAG_SLOP_PX = 8;
|
|
657
639
|
/** Props passed to a custom month event chip renderer. */
|
|
658
640
|
/** A component that renders a single month-grid event chip. */
|
|
659
641
|
const isOutsidePeriod = (day) => day.isCurrentMonth === false;
|
|
@@ -911,7 +893,8 @@ function DateRows(incoming) {
|
|
|
911
893
|
const showAdjacentMonths = createMemo(() => props.source.kind === "month" ? props.source.showAdjacentMonths : true);
|
|
912
894
|
const numberOfWeeks = createMemo(() => props.source.kind === "multiweek" ? props.source.numberOfWeeks : void 0);
|
|
913
895
|
const viewMode = createMemo(() => multiWeek() ? "multiweek" : "month");
|
|
914
|
-
const
|
|
896
|
+
const createContentEnabled = createMemo(() => props.onCreateEvent != null && props.renderCreateGhost != null);
|
|
897
|
+
const eventsMode = createMemo(() => props.events !== void 0 || multiWeek() || createContentEnabled());
|
|
915
898
|
const dayRoving = createMemo(() => !eventsMode() || props.keyboardDayNavigation);
|
|
916
899
|
const eventsByDay = createMemo(() => {
|
|
917
900
|
if (props.eventsByDay) return props.eventsByDay;
|
|
@@ -960,7 +943,8 @@ function DateRows(incoming) {
|
|
|
960
943
|
minDate: props.minDate,
|
|
961
944
|
maxDate: props.maxDate,
|
|
962
945
|
isDateDisabled: props.isDateDisabled,
|
|
963
|
-
locale: props.locale
|
|
946
|
+
locale: props.locale,
|
|
947
|
+
today: nowInTimeZone(props.now, props.timeZone)
|
|
964
948
|
};
|
|
965
949
|
const weeks = numberOfWeeks();
|
|
966
950
|
if (weeks === void 0) return {
|
|
@@ -1042,6 +1026,35 @@ function DateRows(incoming) {
|
|
|
1042
1026
|
(key ? gridRef.current?.querySelector(`[data-day="${key}"]`) : gridRef.current)?.focus();
|
|
1043
1027
|
});
|
|
1044
1028
|
const [drag, setDrag] = createSignal(null);
|
|
1029
|
+
const createRange = createMemo(() => {
|
|
1030
|
+
const current = drag();
|
|
1031
|
+
return createContentEnabled() && current?.kind === "create" ? monthCreateRange(new Date(current.anchor), new Date(current.hover)) : null;
|
|
1032
|
+
}, { equals: (a, b) => a === b || !!a && !!b && +a.start === +b.start && +a.end === +b.end });
|
|
1033
|
+
const visibleLanesFor = (laneCount) => laneCount > props.maxVisibleEventCount ? Math.max(props.maxVisibleEventCount - 1, 1) : laneCount;
|
|
1034
|
+
const draftEvent = createMemo(() => {
|
|
1035
|
+
const range = createRange();
|
|
1036
|
+
return range ? {
|
|
1037
|
+
title: "",
|
|
1038
|
+
start: range.start,
|
|
1039
|
+
end: range.end,
|
|
1040
|
+
allDay: true
|
|
1041
|
+
} : null;
|
|
1042
|
+
});
|
|
1043
|
+
const rowLayouts = createMemo(() => {
|
|
1044
|
+
const draft = draftEvent();
|
|
1045
|
+
const base = weekLayouts();
|
|
1046
|
+
if (!draft) return base;
|
|
1047
|
+
const days = withDraftEventDays(eventsByDay(), draft);
|
|
1048
|
+
return _grid().weeks.map((week, index) => {
|
|
1049
|
+
const row = base[index] ?? EMPTY_LAYOUT;
|
|
1050
|
+
if (!week.days.some((d) => d.date >= draft.start && d.date < draft.end)) return row;
|
|
1051
|
+
const placed = layoutMonthWeek$1(week.days.map((d) => d.date), collectRowEvents(week, days));
|
|
1052
|
+
return keepMonthDraftVisible(placed, row, draft, {
|
|
1053
|
+
visibleLanes: visibleLanesFor,
|
|
1054
|
+
extraLaneFits: (visibleLanes) => visibleLanes < props.maxVisibleEventCount
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
1057
|
+
});
|
|
1045
1058
|
const dragRef = { current: null };
|
|
1046
1059
|
const applyDrag = (value) => {
|
|
1047
1060
|
dragRef.current = value;
|
|
@@ -1049,19 +1062,29 @@ function DateRows(incoming) {
|
|
|
1049
1062
|
};
|
|
1050
1063
|
const movedRef = { current: false };
|
|
1051
1064
|
const suppressClickRef = { current: false };
|
|
1052
|
-
const consumeSuppressedClick = () => {
|
|
1053
|
-
if (!suppressClickRef.current) return false;
|
|
1065
|
+
const consumeSuppressedClick = (detail) => {
|
|
1066
|
+
if (detail === 0 || !suppressClickRef.current) return false;
|
|
1054
1067
|
suppressClickRef.current = false;
|
|
1055
1068
|
return true;
|
|
1056
1069
|
};
|
|
1057
1070
|
const canMove = (event) => props.onDragEvent != null && !event.disabled && event.draggable !== false && (event.startEditable ?? props.eventStartEditable);
|
|
1071
|
+
let pressOrigin = {
|
|
1072
|
+
x: 0,
|
|
1073
|
+
y: 0,
|
|
1074
|
+
slop: DRAG_SLOP_PX
|
|
1075
|
+
};
|
|
1058
1076
|
const beginPress = (e) => {
|
|
1059
1077
|
if (dragRef.current || e.isPrimary === false) return false;
|
|
1060
1078
|
suppressClickRef.current = false;
|
|
1061
1079
|
movedRef.current = false;
|
|
1080
|
+
pressOrigin = {
|
|
1081
|
+
x: e.clientX,
|
|
1082
|
+
y: e.clientY,
|
|
1083
|
+
slop: e.pointerType === "touch" ? TOUCH_DRAG_SLOP_PX : DRAG_SLOP_PX
|
|
1084
|
+
};
|
|
1062
1085
|
return true;
|
|
1063
1086
|
};
|
|
1064
|
-
const beginCreate = (day, pointerId) => {
|
|
1087
|
+
const beginCreate = (day, pointerId, armed) => {
|
|
1065
1088
|
if (!props.onCreateEvent && !props.onSelectDrag) return;
|
|
1066
1089
|
const t = startOfDay(day).getTime();
|
|
1067
1090
|
applyDrag({
|
|
@@ -1069,10 +1092,11 @@ function DateRows(incoming) {
|
|
|
1069
1092
|
pointerId,
|
|
1070
1093
|
anchor: t,
|
|
1071
1094
|
hover: t,
|
|
1072
|
-
windowKey: windowKey()
|
|
1095
|
+
windowKey: windowKey(),
|
|
1096
|
+
armed
|
|
1073
1097
|
});
|
|
1074
1098
|
};
|
|
1075
|
-
const beginMove = (event, day, pointerId) => {
|
|
1099
|
+
const beginMove = (event, day, pointerId, armed) => {
|
|
1076
1100
|
if (!canMove(event)) return;
|
|
1077
1101
|
const t = startOfDay(day).getTime();
|
|
1078
1102
|
applyDrag({
|
|
@@ -1081,7 +1105,8 @@ function DateRows(incoming) {
|
|
|
1081
1105
|
event,
|
|
1082
1106
|
from: t,
|
|
1083
1107
|
to: t,
|
|
1084
|
-
windowKey: windowKey()
|
|
1108
|
+
windowKey: windowKey(),
|
|
1109
|
+
armed
|
|
1085
1110
|
});
|
|
1086
1111
|
props.onDragStart?.(event);
|
|
1087
1112
|
};
|
|
@@ -1093,10 +1118,12 @@ function DateRows(incoming) {
|
|
|
1093
1118
|
movedRef.current = true;
|
|
1094
1119
|
applyDrag(current.kind === "create" ? {
|
|
1095
1120
|
...current,
|
|
1096
|
-
hover: t
|
|
1121
|
+
hover: t,
|
|
1122
|
+
armed: true
|
|
1097
1123
|
} : {
|
|
1098
1124
|
...current,
|
|
1099
|
-
to: t
|
|
1125
|
+
to: t,
|
|
1126
|
+
armed: true
|
|
1100
1127
|
});
|
|
1101
1128
|
if (current.kind === "create") {
|
|
1102
1129
|
const [lo, hi] = current.anchor <= t ? [current.anchor, t] : [t, current.anchor];
|
|
@@ -1108,12 +1135,13 @@ function DateRows(incoming) {
|
|
|
1108
1135
|
const dayLookup = createMemo(() => new Map(_grid().weeks.flatMap((week) => week.days).map((day) => [day.id, day])));
|
|
1109
1136
|
const pressRow = (event, day, moving) => {
|
|
1110
1137
|
if (event.button !== 0 || heldTouch || !beginPress(event)) return;
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1138
|
+
if (!moving && pressedEvent(event)) return;
|
|
1139
|
+
const start = (armed) => {
|
|
1140
|
+
if (moving) beginMove(moving, day, event.pointerId, armed);
|
|
1141
|
+
else beginCreate(day, event.pointerId, armed);
|
|
1114
1142
|
};
|
|
1115
1143
|
if (!multiWeek() || !event.pointerType || event.pointerType === "mouse") {
|
|
1116
|
-
start();
|
|
1144
|
+
start(false);
|
|
1117
1145
|
return;
|
|
1118
1146
|
}
|
|
1119
1147
|
heldOrigin = {
|
|
@@ -1126,7 +1154,7 @@ function DateRows(incoming) {
|
|
|
1126
1154
|
pointerType: event.pointerType,
|
|
1127
1155
|
clientX: event.clientX,
|
|
1128
1156
|
clientY: event.clientY
|
|
1129
|
-
}, start, (x, y) => {
|
|
1157
|
+
}, () => start(true), (x, y) => {
|
|
1130
1158
|
const element = gridRef.current?.ownerDocument.elementFromPoint(x, y)?.closest("[data-day]");
|
|
1131
1159
|
if (!element || !gridRef.current?.contains(element)) return;
|
|
1132
1160
|
const day = dayLookup().get(element.dataset.day ?? "");
|
|
@@ -1160,6 +1188,7 @@ function DateRows(incoming) {
|
|
|
1160
1188
|
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
1189
|
});
|
|
1162
1190
|
const isDragging = createMemo(() => drag() !== null);
|
|
1191
|
+
const dragArmed = createMemo(() => drag()?.armed === true);
|
|
1163
1192
|
const dragWired = createMemo(() => props.onCreateEvent != null || props.onSelectDrag != null || props.onDragEvent != null);
|
|
1164
1193
|
createEffect(() => [
|
|
1165
1194
|
isDragging(),
|
|
@@ -1173,7 +1202,10 @@ function DateRows(incoming) {
|
|
|
1173
1202
|
const current = dragRef.current;
|
|
1174
1203
|
if (!current || current.pointerId !== e.pointerId) return;
|
|
1175
1204
|
applyDrag(null);
|
|
1176
|
-
if (!movedRef.current)
|
|
1205
|
+
if (!movedRef.current) {
|
|
1206
|
+
if (current.kind === "move" && current.armed) suppressClickRef.current = true;
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1177
1209
|
suppressClickRef.current = true;
|
|
1178
1210
|
if (multiWeek() && current.windowKey !== windowKey()) return;
|
|
1179
1211
|
if (current.kind === "create") {
|
|
@@ -1186,17 +1218,38 @@ function DateRows(incoming) {
|
|
|
1186
1218
|
if (props.eventOverlap === false && overlapsOtherEvents(props.events ?? [], current.event, next.start, next.end)) return;
|
|
1187
1219
|
props.onDragEvent?.(current.event, next.start, next.end);
|
|
1188
1220
|
};
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1221
|
+
const clear = () => {
|
|
1222
|
+
heldTouch?.();
|
|
1191
1223
|
applyDrag(null);
|
|
1192
1224
|
movedRef.current = false;
|
|
1193
1225
|
suppressClickRef.current = true;
|
|
1194
1226
|
};
|
|
1227
|
+
const cancel = (event) => {
|
|
1228
|
+
if (dragRef.current?.pointerId === event.pointerId) clear();
|
|
1229
|
+
};
|
|
1230
|
+
const arm = (event) => {
|
|
1231
|
+
const current = dragRef.current;
|
|
1232
|
+
if (!current || current.armed || current.pointerId !== event.pointerId) return;
|
|
1233
|
+
if (Math.hypot(event.clientX - pressOrigin.x, event.clientY - pressOrigin.y) <= pressOrigin.slop) return;
|
|
1234
|
+
applyDrag({
|
|
1235
|
+
...current,
|
|
1236
|
+
armed: true
|
|
1237
|
+
});
|
|
1238
|
+
};
|
|
1239
|
+
const keyDown = (event) => {
|
|
1240
|
+
if (event.key !== "Escape") return;
|
|
1241
|
+
event.preventDefault();
|
|
1242
|
+
clear();
|
|
1243
|
+
};
|
|
1244
|
+
window.addEventListener("pointermove", arm);
|
|
1195
1245
|
window.addEventListener("pointerup", finish);
|
|
1196
1246
|
window.addEventListener("pointercancel", cancel);
|
|
1247
|
+
window.addEventListener("keydown", keyDown);
|
|
1197
1248
|
return () => {
|
|
1249
|
+
window.removeEventListener("pointermove", arm);
|
|
1198
1250
|
window.removeEventListener("pointerup", finish);
|
|
1199
1251
|
window.removeEventListener("pointercancel", cancel);
|
|
1252
|
+
window.removeEventListener("keydown", keyDown);
|
|
1200
1253
|
};
|
|
1201
1254
|
}));
|
|
1202
1255
|
let transientWindow = untrack(windowKey);
|
|
@@ -1330,10 +1383,10 @@ function DateRows(incoming) {
|
|
|
1330
1383
|
},
|
|
1331
1384
|
keyed: false,
|
|
1332
1385
|
children: (week, weekIndex) => {
|
|
1333
|
-
const rowLayout = createMemo(() =>
|
|
1334
|
-
const
|
|
1335
|
-
const visibleLanes = createMemo(() => overflowing() ? Math.max(props.maxVisibleEventCount - 1, 1) : rowLayout().laneCount);
|
|
1386
|
+
const rowLayout = createMemo(() => rowLayouts()[weekIndex] ?? EMPTY_LAYOUT);
|
|
1387
|
+
const visibleLanes = createMemo(() => visibleLanesFor(rowLayout().laneCount));
|
|
1336
1388
|
const cols = createMemo(() => week().days.length);
|
|
1389
|
+
const extraLane = createMemo(() => visibleLanes() < props.maxVisibleEventCount ? monthExtraLaneColumns(rowLayout(), visibleLanes(), cols()) : week().days.map(() => false));
|
|
1337
1390
|
const columns = createMemo(() => {
|
|
1338
1391
|
let first = 0;
|
|
1339
1392
|
let last = cols() - 1;
|
|
@@ -1350,8 +1403,22 @@ function DateRows(incoming) {
|
|
|
1350
1403
|
last
|
|
1351
1404
|
};
|
|
1352
1405
|
});
|
|
1406
|
+
const draftSpan = createMemo(() => {
|
|
1407
|
+
const draft = draftEvent();
|
|
1408
|
+
const segment = draft ? rowLayout().segments.find((s) => s.event === draft) : void 0;
|
|
1409
|
+
if (!segment) return null;
|
|
1410
|
+
const start = Math.max(segment.startCol, columns().first);
|
|
1411
|
+
const end = Math.min(segment.endCol, columns().last);
|
|
1412
|
+
return start <= end ? {
|
|
1413
|
+
start,
|
|
1414
|
+
end,
|
|
1415
|
+
lane: segment.lane
|
|
1416
|
+
} : null;
|
|
1417
|
+
});
|
|
1418
|
+
const draftTop = createMemo(() => 28 + props.chipGap + (draftSpan()?.lane ?? 0) * (props.chipHeight + props.chipGap));
|
|
1419
|
+
const draftHeight = createMemo(() => Math.min(props.chipHeight, Math.max(0, eventRowHeight() - draftTop())));
|
|
1353
1420
|
return memo(() => {
|
|
1354
|
-
const barSegs = createMemo(() => rowLayout().
|
|
1421
|
+
const barSegs = createMemo(() => monthVisibleBars(rowLayout(), visibleLanes(), extraLane()).filter((s) => s.event !== draftEvent()).map((s) => {
|
|
1355
1422
|
const startCol = Math.max(s.startCol, columns().first);
|
|
1356
1423
|
const endCol = Math.min(s.endCol, columns().last);
|
|
1357
1424
|
return {
|
|
@@ -1375,6 +1442,7 @@ function DateRows(incoming) {
|
|
|
1375
1442
|
},
|
|
1376
1443
|
keyed: false,
|
|
1377
1444
|
children: (day, dayCol) => {
|
|
1445
|
+
const dayLanes = createMemo(() => visibleLanes() + (extraLane()[dayCol] ? 1 : 0));
|
|
1378
1446
|
const hidden = createMemo(() => !showAdjacentMonths() && isOutsidePeriod(day()));
|
|
1379
1447
|
const cellHeight = createMemo(() => eventsMode() ? eventRowHeight() : theme().cellHeight);
|
|
1380
1448
|
return memo(() => {
|
|
@@ -1413,10 +1481,10 @@ function DateRows(incoming) {
|
|
|
1413
1481
|
}));
|
|
1414
1482
|
if (eventsMode()) {
|
|
1415
1483
|
const dayEvents = createMemo(() => eventsByDay().get(startOfDay(day().date).toISOString()) ?? []);
|
|
1416
|
-
const hiddenEvents = createMemo(() => rowLayout().segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >=
|
|
1484
|
+
const hiddenEvents = createMemo(() => rowLayout().segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= dayLanes() && s.event !== draftEvent()).map((s) => s.event));
|
|
1417
1485
|
const dayLabel = createMemo(() => format(day().date, "d MMMM", props.locale ? { locale: props.locale } : void 0));
|
|
1418
1486
|
const dayCellProps = createMemo(() => slot("day", eventCellDefault(day(), theme(), cellHeight(), props.highlightWeekends, inCreate() || isDropTarget(), props.chipGap)));
|
|
1419
|
-
var _el$10 = getNextElement(_tmpl$5$4), _el$19 = _el$10.firstChild, [_el$20, _co$6] = getNextMarker(_el$19.nextSibling), _el$11 = _el$20.nextSibling, _el$21 = _el$11.nextSibling, [_el$22, _co$7] = getNextMarker(_el$21.nextSibling), _el$
|
|
1487
|
+
var _el$10 = getNextElement(_tmpl$5$4), _el$19 = _el$10.firstChild, [_el$20, _co$6] = getNextMarker(_el$19.nextSibling), _el$11 = _el$20.nextSibling, _el$21 = _el$11.nextSibling, [_el$22, _co$7] = getNextMarker(_el$21.nextSibling), _el$23 = _el$22.nextSibling, [_el$24, _co$8] = getNextMarker(_el$23.nextSibling), _el$12 = _el$24.nextSibling, _el$13 = _el$12.firstChild, [_el$14, _co$3] = getNextMarker(_el$13.nextSibling), _el$15 = _el$14.nextSibling, [_el$16, _co$4] = getNextMarker(_el$15.nextSibling), _el$17 = _el$16.nextSibling, [_el$18, _co$5] = getNextMarker(_el$17.nextSibling);
|
|
1420
1488
|
spread(_el$10, [
|
|
1421
1489
|
{
|
|
1422
1490
|
"role": "gridcell",
|
|
@@ -1475,8 +1543,8 @@ function DateRows(incoming) {
|
|
|
1475
1543
|
return dragWired() && !day().isDisabled ? (e) => extendDrag(day().date, e.pointerId) : void 0;
|
|
1476
1544
|
},
|
|
1477
1545
|
get onClick() {
|
|
1478
|
-
return day().isDisabled ? void 0 : () => {
|
|
1479
|
-
if (consumeSuppressedClick()) return;
|
|
1546
|
+
return day().isDisabled ? void 0 : (e) => {
|
|
1547
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1480
1548
|
props.onPressDay?.(day().date);
|
|
1481
1549
|
props.onPressCell?.(startOfDay(day().date));
|
|
1482
1550
|
};
|
|
@@ -1498,17 +1566,59 @@ function DateRows(incoming) {
|
|
|
1498
1566
|
return band();
|
|
1499
1567
|
},
|
|
1500
1568
|
children: (band) => (() => {
|
|
1501
|
-
var _el$
|
|
1502
|
-
spread(_el$
|
|
1569
|
+
var _el$25 = getNextElement(_tmpl$3$5);
|
|
1570
|
+
spread(_el$25, [{
|
|
1503
1571
|
"data-band": true,
|
|
1504
1572
|
"aria-hidden": "true"
|
|
1505
1573
|
}, () => slot("rangeBand", band())], false);
|
|
1506
1574
|
runHydrationEvents();
|
|
1507
|
-
return _el$
|
|
1575
|
+
return _el$25;
|
|
1508
1576
|
})()
|
|
1509
1577
|
})), _el$20, _co$6);
|
|
1510
1578
|
spread(_el$11, [dayData, () => slot("dayBadge", compactBadgeDefault(day(), theme()))], true);
|
|
1511
1579
|
insert(_el$11, scope(() => day().label));
|
|
1580
|
+
insert(_el$10, scope((() => {
|
|
1581
|
+
var _c$3 = memo(() => !!(props.renderCreateGhost && createRange() && draftSpan()?.start === dayCol && draftHeight() > 0));
|
|
1582
|
+
return () => _c$3() ? (() => {
|
|
1583
|
+
var _el$26 = getNextElement(_tmpl$2$6);
|
|
1584
|
+
spread(_el$26, [() => slot("createGhost", {
|
|
1585
|
+
base: {
|
|
1586
|
+
position: "absolute",
|
|
1587
|
+
left: 2,
|
|
1588
|
+
width: `calc(${(draftSpan().end - dayCol + 1) * 100}% - 4px)`,
|
|
1589
|
+
top: draftTop(),
|
|
1590
|
+
height: draftHeight(),
|
|
1591
|
+
boxSizing: "border-box",
|
|
1592
|
+
pointerEvents: "none",
|
|
1593
|
+
overflow: "hidden",
|
|
1594
|
+
zIndex: 3
|
|
1595
|
+
},
|
|
1596
|
+
themed: {
|
|
1597
|
+
background: theme().rangeBackground,
|
|
1598
|
+
border: `1px solid ${theme().selectedBackground}`,
|
|
1599
|
+
borderRadius: 4,
|
|
1600
|
+
fontSize: 12,
|
|
1601
|
+
color: theme().text
|
|
1602
|
+
}
|
|
1603
|
+
}), {
|
|
1604
|
+
"inert": true,
|
|
1605
|
+
"aria-hidden": "true"
|
|
1606
|
+
}], true);
|
|
1607
|
+
insert(_el$26, createComponent(Dynamic, {
|
|
1608
|
+
get component() {
|
|
1609
|
+
return props.renderCreateGhost;
|
|
1610
|
+
},
|
|
1611
|
+
get start() {
|
|
1612
|
+
return createRange().start;
|
|
1613
|
+
},
|
|
1614
|
+
get end() {
|
|
1615
|
+
return createRange().end;
|
|
1616
|
+
}
|
|
1617
|
+
}));
|
|
1618
|
+
runHydrationEvents();
|
|
1619
|
+
return _el$26;
|
|
1620
|
+
})() : void 0;
|
|
1621
|
+
})()), _el$22, _co$7);
|
|
1512
1622
|
insert(_el$10, scope(() => createComponent(For, {
|
|
1513
1623
|
get each() {
|
|
1514
1624
|
return barSegs().filter((b) => b.startCol === dayCol);
|
|
@@ -1518,10 +1628,10 @@ function DateRows(incoming) {
|
|
|
1518
1628
|
const span = createMemo(() => b().endCol - b().startCol + 1);
|
|
1519
1629
|
const isDragged = createMemo(() => {
|
|
1520
1630
|
const currentDrag = drag();
|
|
1521
|
-
return currentDrag?.kind === "move" && currentDrag.event === b().seg.event;
|
|
1631
|
+
return currentDrag?.armed === true && currentDrag.kind === "move" && currentDrag.event === b().seg.event;
|
|
1522
1632
|
});
|
|
1523
|
-
var _el$
|
|
1524
|
-
spread(_el$
|
|
1633
|
+
var _el$27 = getNextElement(_tmpl$6$4);
|
|
1634
|
+
spread(_el$27, [
|
|
1525
1635
|
{
|
|
1526
1636
|
"type": "button",
|
|
1527
1637
|
get onPointerDown() {
|
|
@@ -1534,7 +1644,7 @@ function DateRows(incoming) {
|
|
|
1534
1644
|
},
|
|
1535
1645
|
"onClick": (e) => {
|
|
1536
1646
|
e.stopPropagation();
|
|
1537
|
-
if (consumeSuppressedClick()) return;
|
|
1647
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1538
1648
|
props.onPressEvent?.(b().seg.event);
|
|
1539
1649
|
}
|
|
1540
1650
|
},
|
|
@@ -1558,7 +1668,7 @@ function DateRows(incoming) {
|
|
|
1558
1668
|
width: `calc(${span() * 100}% - 4px)`,
|
|
1559
1669
|
top: 28 + props.chipGap + b().seg.lane * (props.chipHeight + props.chipGap),
|
|
1560
1670
|
height: props.chipHeight,
|
|
1561
|
-
pointerEvents:
|
|
1671
|
+
pointerEvents: dragArmed() ? "none" : "auto",
|
|
1562
1672
|
opacity: isDragged() ? DRAGGED_CHIP_OPACITY : void 0,
|
|
1563
1673
|
cursor: canMove(b().seg.event) ? "grab" : void 0,
|
|
1564
1674
|
touchAction: dragWired() ? multiWeek() ? "pan-y" : "none" : void 0,
|
|
@@ -1567,9 +1677,9 @@ function DateRows(incoming) {
|
|
|
1567
1677
|
}
|
|
1568
1678
|
}
|
|
1569
1679
|
], true);
|
|
1570
|
-
insert(_el$
|
|
1571
|
-
var _c$
|
|
1572
|
-
return () => _c$
|
|
1680
|
+
insert(_el$27, scope((() => {
|
|
1681
|
+
var _c$6 = memo(() => !!Chip());
|
|
1682
|
+
return () => _c$6() ? createComponent(Dynamic, {
|
|
1573
1683
|
get component() {
|
|
1574
1684
|
return Chip();
|
|
1575
1685
|
},
|
|
@@ -1581,8 +1691,8 @@ function DateRows(incoming) {
|
|
|
1581
1691
|
},
|
|
1582
1692
|
onPress: () => props.onPressEvent?.(b().seg.event)
|
|
1583
1693
|
}) : (() => {
|
|
1584
|
-
var _el$
|
|
1585
|
-
spread(_el$
|
|
1694
|
+
var _el$28 = getNextElement(_tmpl$3$5);
|
|
1695
|
+
spread(_el$28, [barChip, { get style() {
|
|
1586
1696
|
return css({
|
|
1587
1697
|
...barChip().style,
|
|
1588
1698
|
...b().continuesBefore ? {
|
|
@@ -1595,32 +1705,32 @@ function DateRows(incoming) {
|
|
|
1595
1705
|
} : null
|
|
1596
1706
|
});
|
|
1597
1707
|
} }], true);
|
|
1598
|
-
insert(_el$
|
|
1708
|
+
insert(_el$28, scope(() => b().seg.event.title));
|
|
1599
1709
|
runHydrationEvents();
|
|
1600
|
-
return _el$
|
|
1710
|
+
return _el$28;
|
|
1601
1711
|
})();
|
|
1602
1712
|
})()));
|
|
1603
1713
|
runHydrationEvents();
|
|
1604
|
-
return _el$
|
|
1714
|
+
return _el$27;
|
|
1605
1715
|
}
|
|
1606
|
-
})), _el$
|
|
1716
|
+
})), _el$24, _co$8);
|
|
1607
1717
|
spread(_el$12, () => slot("events", { base: {
|
|
1608
1718
|
display: "flex",
|
|
1609
1719
|
flexDirection: "column",
|
|
1610
1720
|
gap: props.chipGap
|
|
1611
1721
|
} }), true);
|
|
1612
|
-
insert(_el$12, scope(() => Array.from({ length:
|
|
1613
|
-
var _el$
|
|
1722
|
+
insert(_el$12, scope(() => Array.from({ length: dayLanes() }, () => (() => {
|
|
1723
|
+
var _el$29 = getNextElement(_tmpl$7$2);
|
|
1614
1724
|
effect(() => readShallow(css({ height: props.chipHeight })), (_v$, _$p) => {
|
|
1615
|
-
style(_el$
|
|
1725
|
+
style(_el$29, _v$, _$p);
|
|
1616
1726
|
});
|
|
1617
|
-
return _el$
|
|
1727
|
+
return _el$29;
|
|
1618
1728
|
})())), _el$14, _co$3);
|
|
1619
1729
|
insert(_el$12, scope((() => {
|
|
1620
|
-
var _c$
|
|
1621
|
-
return () => _c$
|
|
1622
|
-
var _el$
|
|
1623
|
-
spread(_el$
|
|
1730
|
+
var _c$4 = memo(() => hiddenEvents().length > 0);
|
|
1731
|
+
return () => _c$4() ? (() => {
|
|
1732
|
+
var _el$30 = getNextElement(_tmpl$6$4);
|
|
1733
|
+
spread(_el$30, [
|
|
1624
1734
|
{
|
|
1625
1735
|
"type": "button",
|
|
1626
1736
|
get onPointerDown() {
|
|
@@ -1645,16 +1755,16 @@ function DateRows(incoming) {
|
|
|
1645
1755
|
}
|
|
1646
1756
|
}
|
|
1647
1757
|
], true);
|
|
1648
|
-
insert(_el$
|
|
1758
|
+
insert(_el$30, scope(() => props.moreLabel.replace("{moreCount}", String(hiddenEvents().length))));
|
|
1649
1759
|
runHydrationEvents();
|
|
1650
|
-
return _el$
|
|
1760
|
+
return _el$30;
|
|
1651
1761
|
})() : null;
|
|
1652
1762
|
})()), _el$16, _co$4);
|
|
1653
1763
|
insert(_el$12, scope((() => {
|
|
1654
|
-
var _c$
|
|
1655
|
-
return () => _c$
|
|
1656
|
-
var _el$
|
|
1657
|
-
spread(_el$
|
|
1764
|
+
var _c$5 = memo(() => moreOpenFor() === day().id);
|
|
1765
|
+
return () => _c$5() ? (() => {
|
|
1766
|
+
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);
|
|
1767
|
+
spread(_el$31, [{
|
|
1658
1768
|
"role": "dialog",
|
|
1659
1769
|
get "aria-label"() {
|
|
1660
1770
|
return dayLabel();
|
|
@@ -1695,22 +1805,22 @@ function DateRows(incoming) {
|
|
|
1695
1805
|
boxShadow: "0 4px 16px rgba(0,0,0,0.12)"
|
|
1696
1806
|
}
|
|
1697
1807
|
})], true);
|
|
1698
|
-
ref(() => (el) => morePopoverRef.current = el, _el$
|
|
1699
|
-
insert(_el$
|
|
1700
|
-
insert(_el$
|
|
1808
|
+
ref(() => (el) => morePopoverRef.current = el, _el$31);
|
|
1809
|
+
insert(_el$32, scope(() => dayLabel()));
|
|
1810
|
+
insert(_el$31, scope(() => createComponent(For, {
|
|
1701
1811
|
get each() {
|
|
1702
1812
|
return dayEvents();
|
|
1703
1813
|
},
|
|
1704
1814
|
keyed: false,
|
|
1705
1815
|
children: (event) => {
|
|
1706
|
-
var _el$
|
|
1707
|
-
_el$
|
|
1816
|
+
var _el$35 = getNextElement(_tmpl$9$1);
|
|
1817
|
+
_el$35._$$click = () => {
|
|
1708
1818
|
setMoreOpenFor(null);
|
|
1709
1819
|
props.onPressEvent?.(event());
|
|
1710
1820
|
};
|
|
1711
|
-
insert(_el$
|
|
1712
|
-
var _c$
|
|
1713
|
-
return () => _c$
|
|
1821
|
+
insert(_el$35, scope((() => {
|
|
1822
|
+
var _c$7 = memo(() => !!Chip());
|
|
1823
|
+
return () => _c$7() ? createComponent(Dynamic, {
|
|
1714
1824
|
get component() {
|
|
1715
1825
|
return Chip();
|
|
1716
1826
|
},
|
|
@@ -1722,11 +1832,11 @@ function DateRows(incoming) {
|
|
|
1722
1832
|
},
|
|
1723
1833
|
onPress: () => props.onPressEvent?.(event())
|
|
1724
1834
|
}) : (() => {
|
|
1725
|
-
var _el$
|
|
1726
|
-
spread(_el$
|
|
1727
|
-
insert(_el$
|
|
1835
|
+
var _el$36 = getNextElement(_tmpl$3$5);
|
|
1836
|
+
spread(_el$36, () => slot("chip", chipDefault(theme(), props.chipHeight)), true);
|
|
1837
|
+
insert(_el$36, scope(() => event().title));
|
|
1728
1838
|
runHydrationEvents();
|
|
1729
|
-
return _el$
|
|
1839
|
+
return _el$36;
|
|
1730
1840
|
})();
|
|
1731
1841
|
})()));
|
|
1732
1842
|
effect(() => readShallow(css({
|
|
@@ -1739,28 +1849,28 @@ function DateRows(incoming) {
|
|
|
1739
1849
|
textAlign: "left",
|
|
1740
1850
|
cursor: "pointer"
|
|
1741
1851
|
})), (_v$, _$p) => {
|
|
1742
|
-
style(_el$
|
|
1852
|
+
style(_el$35, _v$, _$p);
|
|
1743
1853
|
});
|
|
1744
1854
|
runHydrationEvents();
|
|
1745
|
-
return _el$
|
|
1855
|
+
return _el$35;
|
|
1746
1856
|
}
|
|
1747
|
-
})), _el$
|
|
1857
|
+
})), _el$34, _co$9);
|
|
1748
1858
|
effect(() => readShallow(css({
|
|
1749
1859
|
fontSize: 11,
|
|
1750
1860
|
fontWeight: 600,
|
|
1751
1861
|
color: theme().textMuted
|
|
1752
1862
|
})), (_v$, _$p) => {
|
|
1753
|
-
style(_el$
|
|
1863
|
+
style(_el$32, _v$, _$p);
|
|
1754
1864
|
});
|
|
1755
1865
|
runHydrationEvents();
|
|
1756
|
-
return _el$
|
|
1866
|
+
return _el$31;
|
|
1757
1867
|
})() : null;
|
|
1758
1868
|
})()), _el$18, _co$5);
|
|
1759
1869
|
runHydrationEvents();
|
|
1760
1870
|
return _el$10;
|
|
1761
1871
|
}
|
|
1762
|
-
var _el$
|
|
1763
|
-
spread(_el$
|
|
1872
|
+
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;
|
|
1873
|
+
spread(_el$37, [
|
|
1764
1874
|
{
|
|
1765
1875
|
"type": "button",
|
|
1766
1876
|
"role": "gridcell",
|
|
@@ -1803,24 +1913,24 @@ function DateRows(incoming) {
|
|
|
1803
1913
|
"onMouseLeave": () => setHoveredKey((k) => k === day().id ? null : k)
|
|
1804
1914
|
}
|
|
1805
1915
|
], true);
|
|
1806
|
-
insert(_el$
|
|
1916
|
+
insert(_el$37, scope(() => createComponent(Show, {
|
|
1807
1917
|
get when() {
|
|
1808
1918
|
return band();
|
|
1809
1919
|
},
|
|
1810
1920
|
children: (band) => (() => {
|
|
1811
|
-
var _el$
|
|
1812
|
-
spread(_el$
|
|
1921
|
+
var _el$41 = getNextElement(_tmpl$3$5);
|
|
1922
|
+
spread(_el$41, [{
|
|
1813
1923
|
"data-band": true,
|
|
1814
1924
|
"aria-hidden": "true"
|
|
1815
1925
|
}, () => slot("rangeBand", band())], false);
|
|
1816
1926
|
runHydrationEvents();
|
|
1817
|
-
return _el$
|
|
1927
|
+
return _el$41;
|
|
1818
1928
|
})()
|
|
1819
|
-
})), _el$
|
|
1820
|
-
spread(_el$
|
|
1821
|
-
insert(_el$
|
|
1929
|
+
})), _el$40, _co$0);
|
|
1930
|
+
spread(_el$38, [dayData, () => slot("dayBadge", badgeDefault(day(), theme(), hoveredKey() === day().id))], true);
|
|
1931
|
+
insert(_el$38, scope(() => day().label));
|
|
1822
1932
|
runHydrationEvents();
|
|
1823
|
-
return _el$
|
|
1933
|
+
return _el$37;
|
|
1824
1934
|
});
|
|
1825
1935
|
}
|
|
1826
1936
|
})));
|
|
@@ -2332,10 +2442,11 @@ var _tmpl$2$4 = /*#__PURE__*/ template(`<div>`);
|
|
|
2332
2442
|
var _tmpl$3$3 = /*#__PURE__*/ template(`<div tabindex=-1><!$><!/><div><div></div><!$><!/></div><!$><!/><div><div><!$><!/><!$><!/></div></div><!$><!/><!$><!/>`);
|
|
2333
2443
|
var _tmpl$4$2 = /*#__PURE__*/ template(`<span>`);
|
|
2334
2444
|
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
|
|
2445
|
+
var _tmpl$6$2 = /*#__PURE__*/ template(`<div><div></div><div>`);
|
|
2446
|
+
var _tmpl$7$1 = /*#__PURE__*/ template(`<div><button>`);
|
|
2447
|
+
var _tmpl$8$1 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div></div><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`);
|
|
2448
|
+
var _tmpl$9 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><!$><!/>`);
|
|
2449
|
+
var _tmpl$0 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
2339
2450
|
/**
|
|
2340
2451
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
2341
2452
|
* the `classNames` / `styles` props.
|
|
@@ -2360,6 +2471,11 @@ function createPreviewPlacement(topPx, heightPx, gridHeight) {
|
|
|
2360
2471
|
height
|
|
2361
2472
|
};
|
|
2362
2473
|
}
|
|
2474
|
+
function createRangePlacement(range, day, hourHeight, minHour, gridHeight, minEventHeight) {
|
|
2475
|
+
const at = (time) => (differenceInCalendarDays(time, day) * 24 + time.getHours() + time.getMinutes() / 60 - minHour) * hourHeight;
|
|
2476
|
+
const top = at(range.start);
|
|
2477
|
+
return createPreviewPlacement(top, Math.max(minEventHeight, at(range.end) - top), gridHeight);
|
|
2478
|
+
}
|
|
2363
2479
|
const EDGE_ZONE = 32;
|
|
2364
2480
|
const EDGE_DWELL_MS = 600;
|
|
2365
2481
|
const EDGE_REPEAT_MS = 600;
|
|
@@ -2386,6 +2502,20 @@ function movedSegmentStart(origin, base, startHours) {
|
|
|
2386
2502
|
const dayMinutes = differenceInCalendarDays(base, origin.base) * HOURS_PER_DAY * 60;
|
|
2387
2503
|
return shiftMinutes(origin.segmentStart, dayMinutes + Math.round((startHours - origin.startHours) * 60));
|
|
2388
2504
|
}
|
|
2505
|
+
function draggedEventBounds(d, origin, event, base, snapMinutes) {
|
|
2506
|
+
if (d.kind === "resize") {
|
|
2507
|
+
const endDelta = Math.round((d.startHours + d.durationHours - origin.startHours - origin.durationHours) * 60);
|
|
2508
|
+
return resolveDraggedBounds(event.start, event.end, 0, endDelta, snapMinutes);
|
|
2509
|
+
}
|
|
2510
|
+
const startShift = movedSegmentStart(origin, base, d.kind === "move" ? d.requestedStartHours : d.startHours).getTime() - origin.segmentStart.getTime();
|
|
2511
|
+
const endShift = d.kind === "move" ? startShift : 0;
|
|
2512
|
+
const start = new Date(event.start.getTime() + startShift);
|
|
2513
|
+
const end = new Date(event.end.getTime() + endShift);
|
|
2514
|
+
return end > start || d.kind === "move" && end.getTime() === start.getTime() ? {
|
|
2515
|
+
start,
|
|
2516
|
+
end
|
|
2517
|
+
} : null;
|
|
2518
|
+
}
|
|
2389
2519
|
function DefaultDomEvent(incoming) {
|
|
2390
2520
|
const props = withDefaults({ ampm: false }, incoming);
|
|
2391
2521
|
const timeLabel = createMemo(() => eventTimeLabel({
|
|
@@ -2562,9 +2692,15 @@ function TimeGrid(incoming) {
|
|
|
2562
2692
|
window.addEventListener("scroll", onScroll, true);
|
|
2563
2693
|
return () => window.removeEventListener("scroll", onScroll, true);
|
|
2564
2694
|
});
|
|
2695
|
+
const detachCreateListeners = { current: null };
|
|
2565
2696
|
const cellTouchRef = { current: null };
|
|
2566
2697
|
const cellEnabled = createMemo(() => !!props.onPressCell || !!props.onCreateEvent);
|
|
2567
2698
|
const days = createMemo(() => getViewDays$1(props.mode, props.date, props.weekStartsOn, props.numberOfDays, false, void 0, props.hiddenDays));
|
|
2699
|
+
const todayKey = createMemo(() => {
|
|
2700
|
+
if (props.showNowIndicator) return startOfDay(now()).getTime();
|
|
2701
|
+
days();
|
|
2702
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
2703
|
+
});
|
|
2568
2704
|
const edgeAdvanceEnabled = createMemo(() => !!props.onChangeDate && !!props.onDragEvent);
|
|
2569
2705
|
const columnsRef = { current: null };
|
|
2570
2706
|
const edgeTimer = { current: null };
|
|
@@ -2615,6 +2751,11 @@ function TimeGrid(incoming) {
|
|
|
2615
2751
|
canResize: editable && (event.durationEditable ?? props.eventDurationEditable)
|
|
2616
2752
|
};
|
|
2617
2753
|
};
|
|
2754
|
+
const hasEditActions = (event) => {
|
|
2755
|
+
if (isAllDayEvent$1(event) || isBackgroundEvent$1(event)) return false;
|
|
2756
|
+
const { canMove, canResize } = editability(event);
|
|
2757
|
+
return canMove || canResize;
|
|
2758
|
+
};
|
|
2618
2759
|
const eventLabel = (event) => props.eventAccessibilityLabel ? props.eventAccessibilityLabel(event, {
|
|
2619
2760
|
mode: props.mode,
|
|
2620
2761
|
isAllDay: false,
|
|
@@ -2628,7 +2769,7 @@ function TimeGrid(incoming) {
|
|
|
2628
2769
|
labels: labels()
|
|
2629
2770
|
});
|
|
2630
2771
|
const eventDescription = (event) => `${describeEventDates(event)}, ${eventLabel(event)}`;
|
|
2631
|
-
const pageDays = () => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays);
|
|
2772
|
+
const pageDays = createMemo(() => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays));
|
|
2632
2773
|
const actionDelta = (id) => {
|
|
2633
2774
|
const step = snapMinutes();
|
|
2634
2775
|
const page = pageDays() * HOURS_PER_DAY * 60;
|
|
@@ -2643,7 +2784,7 @@ function TimeGrid(incoming) {
|
|
|
2643
2784
|
}
|
|
2644
2785
|
};
|
|
2645
2786
|
const editActions = (event) => {
|
|
2646
|
-
if (
|
|
2787
|
+
if (!hasEditActions(event)) return [];
|
|
2647
2788
|
const { canMove, canResize } = editability(event);
|
|
2648
2789
|
const step = snapMinutes();
|
|
2649
2790
|
const words = labels();
|
|
@@ -2667,12 +2808,27 @@ function TimeGrid(incoming) {
|
|
|
2667
2808
|
if (!next || onDragEventRef.current?.(event, next.start, next.end) === false) return null;
|
|
2668
2809
|
return (candidate) => candidate !== event && candidate.start.getTime() === next.start.getTime() && candidate.end.getTime() === next.end.getTime() && candidate.title === event.title;
|
|
2669
2810
|
}, () => props.getEventId);
|
|
2670
|
-
const
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2811
|
+
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)))));
|
|
2812
|
+
const hasAllDay = createMemo(() => allDayLayout().segments.length > 0);
|
|
2813
|
+
const allDaySpans = createMemo(() => {
|
|
2814
|
+
const keys = /* @__PURE__ */ new Map();
|
|
2815
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2816
|
+
for (const { event } of allDayLayout().segments) {
|
|
2817
|
+
const id = props.getEventId?.(event);
|
|
2818
|
+
if (typeof id !== "string" && typeof id !== "number") continue;
|
|
2819
|
+
const key = `${typeof id}:${id}`;
|
|
2820
|
+
const previous = seen.get(key);
|
|
2821
|
+
if (previous) keys.delete(previous);
|
|
2822
|
+
else {
|
|
2823
|
+
seen.set(key, event);
|
|
2824
|
+
keys.set(event, key);
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
return allDayLayout().segments.map((segment) => ({
|
|
2828
|
+
...segment,
|
|
2829
|
+
key: keys.get(segment.event) ?? segment.event
|
|
2830
|
+
}));
|
|
2831
|
+
});
|
|
2676
2832
|
createEffect(() => [props.scrollOffsetMinutes, windowStart()], () => untrack(() => {
|
|
2677
2833
|
if (scrollRef.current) scrollRef.current.scrollTop = Math.max(0, (props.scrollOffsetMinutes / 60 - windowStart()) * hourHeightRef.current);
|
|
2678
2834
|
}));
|
|
@@ -2778,6 +2934,8 @@ function TimeGrid(incoming) {
|
|
|
2778
2934
|
document.removeEventListener("pointermove", h.move);
|
|
2779
2935
|
document.removeEventListener("pointerup", h.up);
|
|
2780
2936
|
document.removeEventListener("pointercancel", h.cancel);
|
|
2937
|
+
document.removeEventListener("selectstart", h.preventNative, true);
|
|
2938
|
+
document.removeEventListener("dragstart", h.preventNative, true);
|
|
2781
2939
|
docHandlersRef.current = null;
|
|
2782
2940
|
};
|
|
2783
2941
|
const finishDrag = () => {
|
|
@@ -2885,18 +3043,14 @@ function TimeGrid(incoming) {
|
|
|
2885
3043
|
base = day ? startOfDay(day) : null;
|
|
2886
3044
|
} else base = startOfDay(daysRef.current[originIndex + d.dayDelta] ?? daysRef.current[originIndex]);
|
|
2887
3045
|
} 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);
|
|
3046
|
+
try {
|
|
3047
|
+
if (base && held && origin) {
|
|
3048
|
+
const next = draggedEventBounds(d, origin, held.event, base, snapMinutes());
|
|
3049
|
+
if (next) onDragEventRef.current?.(held.event, next.start, next.end);
|
|
3050
|
+
}
|
|
3051
|
+
} finally {
|
|
3052
|
+
finishDrag();
|
|
2898
3053
|
}
|
|
2899
|
-
finishDrag();
|
|
2900
3054
|
};
|
|
2901
3055
|
const cancelDrag = () => {
|
|
2902
3056
|
finishDrag();
|
|
@@ -2910,7 +3064,8 @@ function TimeGrid(incoming) {
|
|
|
2910
3064
|
activeGrabRef.current = e;
|
|
2911
3065
|
const boxEl = e.box;
|
|
2912
3066
|
const column = kind === "move" ? boxEl.parentElement : null;
|
|
2913
|
-
const
|
|
3067
|
+
const columnRect = column ? column.getBoundingClientRect() : null;
|
|
3068
|
+
const dayWidth = columnRect ? columnRect.width : 0;
|
|
2914
3069
|
const boxRect = kind === "move" ? boxEl.getBoundingClientRect() : null;
|
|
2915
3070
|
const originBase = startOfDay(days()[dayIndex] ?? days()[0]);
|
|
2916
3071
|
const originNextDay = addDays(originBase, 1);
|
|
@@ -2930,9 +3085,9 @@ function TimeGrid(incoming) {
|
|
|
2930
3085
|
draggedRef.current = {
|
|
2931
3086
|
event,
|
|
2932
3087
|
onPress: onPress ?? (() => {}),
|
|
2933
|
-
grabX:
|
|
3088
|
+
grabX: column && columnRect ? e.clientX - columnRect.left - column.clientLeft - props.eventGap : 0,
|
|
2934
3089
|
grabY: boxRect ? e.clientY - boxRect.top : 0,
|
|
2935
|
-
w:
|
|
3090
|
+
w: column ? Math.max(column.clientWidth - props.eventGap * 2, 0) : 0,
|
|
2936
3091
|
h: boxRect ? boxRect.height : 0
|
|
2937
3092
|
};
|
|
2938
3093
|
ptr.current = {
|
|
@@ -2968,12 +3123,15 @@ function TimeGrid(incoming) {
|
|
|
2968
3123
|
},
|
|
2969
3124
|
cancel: (event) => {
|
|
2970
3125
|
if (event.pointerId === e.pointerId) cancelDrag();
|
|
2971
|
-
}
|
|
3126
|
+
},
|
|
3127
|
+
preventNative: (event) => event.preventDefault()
|
|
2972
3128
|
};
|
|
2973
3129
|
docHandlersRef.current = handlers;
|
|
2974
3130
|
document.addEventListener("pointermove", handlers.move);
|
|
2975
3131
|
document.addEventListener("pointerup", handlers.up);
|
|
2976
3132
|
document.addEventListener("pointercancel", handlers.cancel);
|
|
3133
|
+
document.addEventListener("selectstart", handlers.preventNative, true);
|
|
3134
|
+
document.addEventListener("dragstart", handlers.preventNative, true);
|
|
2977
3135
|
};
|
|
2978
3136
|
const pressEvent = (e, pe, key, kind, dayIndex, onPress) => {
|
|
2979
3137
|
if (!props.onDragEvent || e.button > 0 || createOrigin.current) return;
|
|
@@ -3007,6 +3165,10 @@ function TimeGrid(incoming) {
|
|
|
3007
3165
|
cancelHoldRef.current?.();
|
|
3008
3166
|
detachDocListeners();
|
|
3009
3167
|
clearEdgeTimer();
|
|
3168
|
+
if (createOrigin.current?.captureLoss !== void 0) clearTimeout(createOrigin.current.captureLoss);
|
|
3169
|
+
createOrigin.current = null;
|
|
3170
|
+
detachCreateListeners.current?.();
|
|
3171
|
+
detachCreateListeners.current = null;
|
|
3010
3172
|
}));
|
|
3011
3173
|
createEffect(() => [
|
|
3012
3174
|
props.date,
|
|
@@ -3045,6 +3207,26 @@ function TimeGrid(incoming) {
|
|
|
3045
3207
|
startPx,
|
|
3046
3208
|
curPx: startPx
|
|
3047
3209
|
});
|
|
3210
|
+
const document = el.ownerDocument;
|
|
3211
|
+
const cancel = (event) => {
|
|
3212
|
+
if (createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3213
|
+
};
|
|
3214
|
+
const restart = (event) => {
|
|
3215
|
+
if (event.isPrimary && event.pointerType !== "touch" || createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3216
|
+
};
|
|
3217
|
+
const preventSelection = (event) => event.preventDefault();
|
|
3218
|
+
document.addEventListener("pointerup", endCreate, true);
|
|
3219
|
+
document.addEventListener("pointercancel", cancel, true);
|
|
3220
|
+
document.addEventListener("pointerdown", restart, true);
|
|
3221
|
+
document.addEventListener("selectstart", preventSelection, true);
|
|
3222
|
+
document.addEventListener("dragstart", preventSelection, true);
|
|
3223
|
+
detachCreateListeners.current = () => {
|
|
3224
|
+
document.removeEventListener("pointerup", endCreate, true);
|
|
3225
|
+
document.removeEventListener("pointercancel", cancel, true);
|
|
3226
|
+
document.removeEventListener("pointerdown", restart, true);
|
|
3227
|
+
document.removeEventListener("selectstart", preventSelection, true);
|
|
3228
|
+
document.removeEventListener("dragstart", preventSelection, true);
|
|
3229
|
+
};
|
|
3048
3230
|
};
|
|
3049
3231
|
const moveCreate = (e) => {
|
|
3050
3232
|
const touch = cellTouchRef.current;
|
|
@@ -3062,9 +3244,8 @@ function TimeGrid(incoming) {
|
|
|
3062
3244
|
const endCreate = (e) => {
|
|
3063
3245
|
const o = createOrigin.current;
|
|
3064
3246
|
if (!o || o.pointerId !== e.pointerId) return;
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
} catch {}
|
|
3247
|
+
clearCreate();
|
|
3248
|
+
if (!o.el.isConnected || !cellEnabled() || o.creating && !props.onCreateEvent || days()[o.dayIndex]?.getTime() !== o.dayTime) return;
|
|
3068
3249
|
const endPx = pxFromTop(o.el, e.clientY);
|
|
3069
3250
|
const day = days()[o.dayIndex];
|
|
3070
3251
|
const moved = Math.abs(endPx - o.startPx) > 4;
|
|
@@ -3076,8 +3257,6 @@ function TimeGrid(incoming) {
|
|
|
3076
3257
|
const at = cellRangeFromDrag(day, o.startPx, o.startPx, h, windowStart(), snapMinutes());
|
|
3077
3258
|
if (at) props.onPressCell(at.start);
|
|
3078
3259
|
}
|
|
3079
|
-
createOrigin.current = null;
|
|
3080
|
-
setCreateBox(null);
|
|
3081
3260
|
};
|
|
3082
3261
|
const tapCell = (e, dayIndex) => {
|
|
3083
3262
|
const touch = cellTouchRef.current;
|
|
@@ -3091,6 +3270,9 @@ function TimeGrid(incoming) {
|
|
|
3091
3270
|
const clearCreate = () => {
|
|
3092
3271
|
const previous = createOrigin.current;
|
|
3093
3272
|
createOrigin.current = null;
|
|
3273
|
+
if (previous?.captureLoss !== void 0) clearTimeout(previous.captureLoss);
|
|
3274
|
+
detachCreateListeners.current?.();
|
|
3275
|
+
detachCreateListeners.current = null;
|
|
3094
3276
|
setCreateBox(null);
|
|
3095
3277
|
try {
|
|
3096
3278
|
previous?.el.releasePointerCapture?.(previous.pointerId);
|
|
@@ -3110,8 +3292,12 @@ function TimeGrid(incoming) {
|
|
|
3110
3292
|
clearCreate();
|
|
3111
3293
|
};
|
|
3112
3294
|
const loseCreateCapture = (e) => {
|
|
3113
|
-
|
|
3114
|
-
|
|
3295
|
+
const origin = createOrigin.current;
|
|
3296
|
+
if (!origin || origin.pointerId !== e.pointerId) return;
|
|
3297
|
+
if (origin.captureLoss !== void 0) clearTimeout(origin.captureLoss);
|
|
3298
|
+
origin.captureLoss = setTimeout(() => {
|
|
3299
|
+
if (createOrigin.current === origin) clearCreate();
|
|
3300
|
+
}, 0);
|
|
3115
3301
|
};
|
|
3116
3302
|
createEffect(() => [], () => {
|
|
3117
3303
|
const onKeyDown = (event) => {
|
|
@@ -3133,11 +3319,15 @@ function TimeGrid(incoming) {
|
|
|
3133
3319
|
return event.start.getTime() === currentHeldEvent.start.getTime() && event.end.getTime() === currentHeldEvent.end.getTime() && event.title === currentHeldEvent.title;
|
|
3134
3320
|
}) ?? currentHeldEvent);
|
|
3135
3321
|
});
|
|
3322
|
+
const multiDayHeld = createMemo(() => {
|
|
3323
|
+
const currentDrag = drag();
|
|
3324
|
+
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && !!movingEvent();
|
|
3325
|
+
});
|
|
3136
3326
|
const multiDayMove = createMemo(() => {
|
|
3137
3327
|
const currentDrag = drag();
|
|
3138
3328
|
const currentMoveOrigin = moveOrigin();
|
|
3139
3329
|
const currentMovingEvent = movingEvent();
|
|
3140
|
-
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
3330
|
+
return !paged() && currentDrag?.kind === "move" && currentDrag.moved && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
3141
3331
|
const target = days()[currentMoveOrigin.dayIndex + currentDrag.dayDelta];
|
|
3142
3332
|
const shift = movedSegmentStart(currentMoveOrigin, startOfDay(target), currentDrag.requestedStartHours).getTime() - currentMoveOrigin.segmentStart.getTime();
|
|
3143
3333
|
return {
|
|
@@ -3148,13 +3338,31 @@ function TimeGrid(incoming) {
|
|
|
3148
3338
|
};
|
|
3149
3339
|
})() : null;
|
|
3150
3340
|
});
|
|
3341
|
+
const liveBounds = createMemo(() => {
|
|
3342
|
+
const currentDrag = drag();
|
|
3343
|
+
const origin = moveOrigin();
|
|
3344
|
+
const held = draggedRef.current;
|
|
3345
|
+
if (paged() || !currentDrag?.moved || multiDayMove() || !origin || !held) return null;
|
|
3346
|
+
const visibleDays = days();
|
|
3347
|
+
const target = origin.dayIndex + (currentDrag.kind === "move" ? currentDrag.dayDelta : 0);
|
|
3348
|
+
const base = startOfDay(visibleDays[target] ?? visibleDays[origin.dayIndex]);
|
|
3349
|
+
return draggedEventBounds(currentDrag, origin, held.event, base, snapMinutes());
|
|
3350
|
+
});
|
|
3351
|
+
const withLiveBounds = (event) => {
|
|
3352
|
+
const bounds = liveBounds();
|
|
3353
|
+
return bounds ? {
|
|
3354
|
+
...event,
|
|
3355
|
+
start: bounds.start,
|
|
3356
|
+
end: bounds.end
|
|
3357
|
+
} : event;
|
|
3358
|
+
};
|
|
3151
3359
|
const spillPreviewFor = (dayIndex) => {
|
|
3152
3360
|
const currentDrag = drag();
|
|
3153
3361
|
if (paged() || !currentDrag || currentDrag.kind !== "move" || currentDrag.spillDayIndex !== dayIndex) return null;
|
|
3154
3362
|
const dragged = draggedRef.current?.event;
|
|
3155
3363
|
if (!dragged) return null;
|
|
3156
3364
|
return {
|
|
3157
|
-
event: dragged,
|
|
3365
|
+
event: withLiveBounds(dragged),
|
|
3158
3366
|
mode: props.mode,
|
|
3159
3367
|
isAllDay: false,
|
|
3160
3368
|
boxHeight: Math.max(currentDrag.spillHours * hourHeight(), props.minEventHeight),
|
|
@@ -3247,7 +3455,7 @@ function TimeGrid(incoming) {
|
|
|
3247
3455
|
ref(() => (el) => eventActions.rootRef.current = el, _el$6);
|
|
3248
3456
|
insert(_el$6, createComponent(EventActionsMenu, {
|
|
3249
3457
|
get events() {
|
|
3250
|
-
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(
|
|
3458
|
+
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(hasEditActions);
|
|
3251
3459
|
},
|
|
3252
3460
|
get label() {
|
|
3253
3461
|
return labels().editEvents;
|
|
@@ -3293,7 +3501,7 @@ function TimeGrid(incoming) {
|
|
|
3293
3501
|
},
|
|
3294
3502
|
keyed: false,
|
|
3295
3503
|
children: (day) => {
|
|
3296
|
-
const today = createMemo(() => getIsToday(day()));
|
|
3504
|
+
const today = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
3297
3505
|
const dateLabel = createMemo(() => format(day(), "EEEE, d MMMM yyyy", dfns()));
|
|
3298
3506
|
const headerProps = createMemo(() => slot("columnHeader", {
|
|
3299
3507
|
base: {
|
|
@@ -3386,7 +3594,7 @@ function TimeGrid(incoming) {
|
|
|
3386
3594
|
insert(_el$6, scope((() => {
|
|
3387
3595
|
var _c$3 = memo(() => !!(props.showAllDayEventCell && hasAllDay()));
|
|
3388
3596
|
return () => _c$3() ? (() => {
|
|
3389
|
-
var _el$28 = getNextElement(_tmpl
|
|
3597
|
+
var _el$28 = getNextElement(_tmpl$6$2), _el$29 = _el$28.firstChild, _el$30 = _el$29.nextSibling;
|
|
3390
3598
|
spread(_el$28, () => slot("allDayLane", {
|
|
3391
3599
|
base: { display: "flex" },
|
|
3392
3600
|
themed: { borderBottom: `1px solid ${theme().gridLine}` }
|
|
@@ -3395,6 +3603,7 @@ function TimeGrid(incoming) {
|
|
|
3395
3603
|
base: {
|
|
3396
3604
|
width: gutterWidth(),
|
|
3397
3605
|
flex: "none",
|
|
3606
|
+
boxSizing: "border-box",
|
|
3398
3607
|
minWidth: 0,
|
|
3399
3608
|
overflow: "hidden",
|
|
3400
3609
|
textAlign: "right"
|
|
@@ -3402,93 +3611,90 @@ function TimeGrid(incoming) {
|
|
|
3402
3611
|
themed: {
|
|
3403
3612
|
fontSize: 10,
|
|
3404
3613
|
color: theme().textMuted,
|
|
3405
|
-
padding: "4px 6px 0 0"
|
|
3614
|
+
padding: props.hideHours ? 0 : "4px 6px 0 0"
|
|
3406
3615
|
}
|
|
3407
3616
|
}), true);
|
|
3408
3617
|
insert(_el$29, scope((() => {
|
|
3409
3618
|
var _c$7 = memo(() => !!props.showAllDayLabel);
|
|
3410
3619
|
return () => _c$7() ? labels().allDay : null;
|
|
3411
3620
|
})()));
|
|
3412
|
-
insert(_el$
|
|
3621
|
+
insert(_el$30, createComponent(For, {
|
|
3413
3622
|
get each() {
|
|
3414
|
-
return
|
|
3623
|
+
return allDaySpans();
|
|
3415
3624
|
},
|
|
3416
|
-
keyed:
|
|
3417
|
-
children: (
|
|
3418
|
-
const
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3625
|
+
keyed: (segment) => segment.key,
|
|
3626
|
+
children: (segment) => {
|
|
3627
|
+
const args = createMemo(() => ({
|
|
3628
|
+
event: segment().event,
|
|
3629
|
+
mode: props.mode,
|
|
3630
|
+
isAllDay: true,
|
|
3631
|
+
continuesBefore: segment().continuesBefore,
|
|
3632
|
+
continuesAfter: segment().continuesAfter,
|
|
3633
|
+
ampm: props.ampm,
|
|
3634
|
+
onPress: () => props.onPressEvent?.(segment().event)
|
|
3635
|
+
}));
|
|
3636
|
+
var _el$31 = getNextElement(_tmpl$7$1), _el$32 = _el$31.firstChild;
|
|
3637
|
+
spread(_el$31, () => slot("allDayColumn", { base: {
|
|
3638
|
+
gridColumn: `${segment().startCol + 1} / span ${segment().endCol - segment().startCol + 1}`,
|
|
3639
|
+
gridRow: segment().lane + 1,
|
|
3423
3640
|
minWidth: 0,
|
|
3424
3641
|
borderLeft: "1px solid transparent",
|
|
3425
|
-
padding: "
|
|
3642
|
+
padding: "0 1px",
|
|
3426
3643
|
display: "flex",
|
|
3427
|
-
flexDirection: "column"
|
|
3428
|
-
gap: 2
|
|
3644
|
+
flexDirection: "column"
|
|
3429
3645
|
} }), true);
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
children: (event) => {
|
|
3436
|
-
const args = createMemo(() => ({
|
|
3437
|
-
event: event(),
|
|
3646
|
+
spread(_el$32, [{
|
|
3647
|
+
"type": "button",
|
|
3648
|
+
"onClick": () => props.onPressEvent?.(segment().event),
|
|
3649
|
+
get "aria-label"() {
|
|
3650
|
+
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(segment().event, {
|
|
3438
3651
|
mode: props.mode,
|
|
3439
3652
|
isAllDay: true,
|
|
3440
|
-
|
|
3441
|
-
|
|
3653
|
+
ampm: props.ampm
|
|
3654
|
+
}) : eventAccessibilityLabel({
|
|
3655
|
+
title: segment().event.title,
|
|
3656
|
+
isAllDay: true,
|
|
3657
|
+
start: segment().event.start,
|
|
3658
|
+
end: segment().event.end,
|
|
3442
3659
|
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;
|
|
3660
|
+
labels: labels()
|
|
3661
|
+
});
|
|
3486
3662
|
}
|
|
3487
|
-
})
|
|
3663
|
+
}, () => slot("allDayEvent", { base: {
|
|
3664
|
+
border: "none",
|
|
3665
|
+
padding: 0,
|
|
3666
|
+
background: "transparent",
|
|
3667
|
+
cursor: "pointer",
|
|
3668
|
+
textAlign: "left",
|
|
3669
|
+
height: 22
|
|
3670
|
+
} })], true);
|
|
3671
|
+
insert(_el$32, scope((() => {
|
|
3672
|
+
var _c$8 = memo(() => !!Renderer());
|
|
3673
|
+
return () => _c$8() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3674
|
+
return Renderer();
|
|
3675
|
+
} }, args)) : createComponent(DefaultDomEvent, mergeProps(args, {
|
|
3676
|
+
get theme() {
|
|
3677
|
+
return theme();
|
|
3678
|
+
},
|
|
3679
|
+
get boxProps() {
|
|
3680
|
+
return slot("eventBox");
|
|
3681
|
+
}
|
|
3682
|
+
}));
|
|
3683
|
+
})()));
|
|
3488
3684
|
runHydrationEvents();
|
|
3489
|
-
return _el$
|
|
3685
|
+
return _el$31;
|
|
3490
3686
|
}
|
|
3491
|
-
}))
|
|
3687
|
+
}));
|
|
3688
|
+
effect(() => readShallow(css({
|
|
3689
|
+
flex: 1,
|
|
3690
|
+
minWidth: 0,
|
|
3691
|
+
display: "grid",
|
|
3692
|
+
gridTemplateColumns: `repeat(${days().length}, minmax(0, 1fr))`,
|
|
3693
|
+
gap: "2px 0",
|
|
3694
|
+
padding: "2px 0"
|
|
3695
|
+
})), (_v$, _$p) => {
|
|
3696
|
+
style(_el$30, _v$, _$p);
|
|
3697
|
+
});
|
|
3492
3698
|
runHydrationEvents();
|
|
3493
3699
|
return _el$28;
|
|
3494
3700
|
})() : null;
|
|
@@ -3502,20 +3708,20 @@ function TimeGrid(incoming) {
|
|
|
3502
3708
|
insert(_el$10, scope((() => {
|
|
3503
3709
|
var _c$4 = memo(() => !!props.hideHours);
|
|
3504
3710
|
return () => _c$4() ? null : (() => {
|
|
3505
|
-
var _el$
|
|
3506
|
-
spread(_el$
|
|
3711
|
+
var _el$33 = getNextElement(_tmpl$2$4);
|
|
3712
|
+
spread(_el$33, () => slot("hourGutter", { base: {
|
|
3507
3713
|
width: gutterWidth(),
|
|
3508
3714
|
flex: "none",
|
|
3509
3715
|
position: "relative"
|
|
3510
3716
|
} }), true);
|
|
3511
|
-
insert(_el$
|
|
3717
|
+
insert(_el$33, scope(() => createComponent(For, {
|
|
3512
3718
|
get each() {
|
|
3513
3719
|
return visibleHours();
|
|
3514
3720
|
},
|
|
3515
3721
|
keyed: false,
|
|
3516
3722
|
children: (h) => (() => {
|
|
3517
|
-
var _el$
|
|
3518
|
-
spread(_el$
|
|
3723
|
+
var _el$34 = getNextElement(_tmpl$2$4);
|
|
3724
|
+
spread(_el$34, () => slot("hourLabel", {
|
|
3519
3725
|
base: {
|
|
3520
3726
|
position: "absolute",
|
|
3521
3727
|
top: Math.max(0, (h() - windowStart()) * hourHeight() - 6),
|
|
@@ -3526,16 +3732,16 @@ function TimeGrid(incoming) {
|
|
|
3526
3732
|
color: theme().textMuted
|
|
3527
3733
|
}
|
|
3528
3734
|
}), true);
|
|
3529
|
-
insert(_el$
|
|
3735
|
+
insert(_el$34, scope((() => {
|
|
3530
3736
|
var _c$9 = memo(() => !!props.hourComponent);
|
|
3531
3737
|
return () => _c$9() ? props.hourComponent(h(), props.ampm) : memo(() => h() === 0)() ? "" : formatHour(h(), { ampm: props.ampm });
|
|
3532
3738
|
})()));
|
|
3533
3739
|
runHydrationEvents();
|
|
3534
|
-
return _el$
|
|
3740
|
+
return _el$34;
|
|
3535
3741
|
})()
|
|
3536
3742
|
})));
|
|
3537
3743
|
runHydrationEvents();
|
|
3538
|
-
return _el$
|
|
3744
|
+
return _el$33;
|
|
3539
3745
|
})();
|
|
3540
3746
|
})()), _el$12, _co$3);
|
|
3541
3747
|
insert(_el$10, scope(() => createComponent(For, {
|
|
@@ -3553,17 +3759,24 @@ function TimeGrid(incoming) {
|
|
|
3553
3759
|
const currentCreateBox = createBox();
|
|
3554
3760
|
return currentCreateBox?.dayIndex === dayIndex && currentCreateBox.dayTime === day().getTime() ? currentCreateBox : null;
|
|
3555
3761
|
});
|
|
3556
|
-
const
|
|
3762
|
+
const createRange = createMemo(() => {
|
|
3557
3763
|
const currentGhost = ghost();
|
|
3558
|
-
return currentGhost && props.
|
|
3764
|
+
return currentGhost && props.onCreateEvent ? cellRangeFromDrag(day(), currentGhost.startPx, currentGhost.curPx, hourHeight(), windowStart(), snapMinutes()) : null;
|
|
3559
3765
|
}, { equals: sameRange$1 });
|
|
3766
|
+
const ghostRange = createMemo(() => props.renderCreateGhost ? createRange() : null);
|
|
3767
|
+
const previewPlacement = createMemo(() => {
|
|
3768
|
+
const range = createRange();
|
|
3769
|
+
if (range) return createRangePlacement(range, day(), hourHeight(), windowStart(), totalHeight(), props.minEventHeight ?? DEFAULT_MIN_EVENT_HEIGHT);
|
|
3770
|
+
const current = ghost();
|
|
3771
|
+
return current ? createPreviewPlacement(Math.min(current.startPx, current.curPx), Math.abs(current.curPx - current.startPx), totalHeight()) : {};
|
|
3772
|
+
});
|
|
3560
3773
|
const spill = createMemo(() => multiDayMove() ? null : spillPreviewFor(dayIndex));
|
|
3561
3774
|
const moveSegment = createMemo(() => {
|
|
3562
3775
|
const currentMultiDayMove = multiDayMove();
|
|
3563
3776
|
return currentMultiDayMove ? layoutDayEvents$1([currentMultiDayMove], day())[0] : void 0;
|
|
3564
3777
|
});
|
|
3565
|
-
var _el$
|
|
3566
|
-
spread(_el$
|
|
3778
|
+
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);
|
|
3779
|
+
spread(_el$35, [
|
|
3567
3780
|
{
|
|
3568
3781
|
get "data-date"() {
|
|
3569
3782
|
return day().toISOString();
|
|
@@ -3588,7 +3801,7 @@ function TimeGrid(incoming) {
|
|
|
3588
3801
|
}
|
|
3589
3802
|
},
|
|
3590
3803
|
() => dataState({
|
|
3591
|
-
"data-today": getIsToday(day()),
|
|
3804
|
+
"data-today": getIsToday(day(), new Date(todayKey())),
|
|
3592
3805
|
"data-weekend": isWeekend(day())
|
|
3593
3806
|
}),
|
|
3594
3807
|
() => slot("dayColumn", {
|
|
@@ -3602,14 +3815,14 @@ function TimeGrid(incoming) {
|
|
|
3602
3815
|
}
|
|
3603
3816
|
})
|
|
3604
3817
|
], true);
|
|
3605
|
-
insert(_el$
|
|
3818
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3606
3819
|
get each() {
|
|
3607
3820
|
return bands();
|
|
3608
3821
|
},
|
|
3609
3822
|
keyed: false,
|
|
3610
3823
|
children: (b) => (() => {
|
|
3611
|
-
var _el$
|
|
3612
|
-
spread(_el$
|
|
3824
|
+
var _el$51 = getNextElement(_tmpl$2$4);
|
|
3825
|
+
spread(_el$51, [{ "aria-hidden": "true" }, () => slot("businessHours", {
|
|
3613
3826
|
base: {
|
|
3614
3827
|
position: "absolute",
|
|
3615
3828
|
left: 0,
|
|
@@ -3621,16 +3834,16 @@ function TimeGrid(incoming) {
|
|
|
3621
3834
|
},
|
|
3622
3835
|
themed: props.renderBusinessHours ? void 0 : { background: theme().outsideHoursBackground }
|
|
3623
3836
|
})], true);
|
|
3624
|
-
insert(_el$
|
|
3837
|
+
insert(_el$51, scope(() => props.renderBusinessHours?.({
|
|
3625
3838
|
date: day(),
|
|
3626
3839
|
start: b().start,
|
|
3627
3840
|
end: b().end
|
|
3628
3841
|
})));
|
|
3629
3842
|
runHydrationEvents();
|
|
3630
|
-
return _el$
|
|
3843
|
+
return _el$51;
|
|
3631
3844
|
})()
|
|
3632
|
-
})), _el$
|
|
3633
|
-
insert(_el$
|
|
3845
|
+
})), _el$38, _co$9);
|
|
3846
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3634
3847
|
get each() {
|
|
3635
3848
|
return backgroundByDay()[dayIndex];
|
|
3636
3849
|
},
|
|
@@ -3647,8 +3860,8 @@ function TimeGrid(incoming) {
|
|
|
3647
3860
|
}));
|
|
3648
3861
|
return memo(() => {
|
|
3649
3862
|
if (!RenderBackground()) {
|
|
3650
|
-
var _el$
|
|
3651
|
-
spread(_el$
|
|
3863
|
+
var _el$52 = getNextElement(_tmpl$2$4);
|
|
3864
|
+
spread(_el$52, [{
|
|
3652
3865
|
"aria-hidden": "true",
|
|
3653
3866
|
get title() {
|
|
3654
3867
|
return b().event.title;
|
|
@@ -3661,15 +3874,15 @@ function TimeGrid(incoming) {
|
|
|
3661
3874
|
themed: { background: theme().backgroundEvent }
|
|
3662
3875
|
})], false);
|
|
3663
3876
|
runHydrationEvents();
|
|
3664
|
-
return _el$
|
|
3877
|
+
return _el$52;
|
|
3665
3878
|
}
|
|
3666
3879
|
const dayStart = createMemo(() => startOfDay(days()[dayIndex]));
|
|
3667
|
-
var _el$
|
|
3668
|
-
spread(_el$
|
|
3880
|
+
var _el$53 = getNextElement(_tmpl$2$4);
|
|
3881
|
+
spread(_el$53, () => slot("backgroundEvent", { base: {
|
|
3669
3882
|
...geometry(),
|
|
3670
3883
|
pointerEvents: "auto"
|
|
3671
3884
|
} }), true);
|
|
3672
|
-
insert(_el$
|
|
3885
|
+
insert(_el$53, createComponent(Dynamic, {
|
|
3673
3886
|
get component() {
|
|
3674
3887
|
return RenderBackground();
|
|
3675
3888
|
},
|
|
@@ -3695,11 +3908,11 @@ function TimeGrid(incoming) {
|
|
|
3695
3908
|
onPress: () => props.onPressEvent?.(b().event)
|
|
3696
3909
|
}));
|
|
3697
3910
|
runHydrationEvents();
|
|
3698
|
-
return _el$
|
|
3911
|
+
return _el$53;
|
|
3699
3912
|
});
|
|
3700
3913
|
}
|
|
3701
|
-
})), _el$
|
|
3702
|
-
spread(_el$
|
|
3914
|
+
})), _el$40, _co$0);
|
|
3915
|
+
spread(_el$36, [{ "aria-hidden": "true" }, () => slot("gridLines", {
|
|
3703
3916
|
base: {
|
|
3704
3917
|
position: "absolute",
|
|
3705
3918
|
inset: 0,
|
|
@@ -3708,7 +3921,7 @@ function TimeGrid(incoming) {
|
|
|
3708
3921
|
},
|
|
3709
3922
|
themed: { backgroundImage: gridLines() }
|
|
3710
3923
|
})], false);
|
|
3711
|
-
insert(_el$
|
|
3924
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3712
3925
|
get each() {
|
|
3713
3926
|
return positioned();
|
|
3714
3927
|
},
|
|
@@ -3717,7 +3930,11 @@ function TimeGrid(incoming) {
|
|
|
3717
3930
|
const key = createMemo(() => `${dayIndex}:${idx}`);
|
|
3718
3931
|
const active = createMemo(() => {
|
|
3719
3932
|
const currentDrag = drag();
|
|
3720
|
-
return !paged() && currentDrag?.key === key() && (!
|
|
3933
|
+
return !paged() && currentDrag?.key === key() && (!multiDayHeld() || pe().event === movingEvent()) ? currentDrag : null;
|
|
3934
|
+
});
|
|
3935
|
+
const floating = createMemo(() => {
|
|
3936
|
+
const currentActive = active();
|
|
3937
|
+
return currentActive?.kind === "move" && currentActive.moved;
|
|
3721
3938
|
});
|
|
3722
3939
|
const hiddenForMove = createMemo(() => !!multiDayMove() && pe().event === movingEvent());
|
|
3723
3940
|
const startHours = createMemo(() => {
|
|
@@ -3736,7 +3953,7 @@ function TimeGrid(incoming) {
|
|
|
3736
3953
|
const widthPct = createMemo(() => 100 / pe().columns);
|
|
3737
3954
|
const onPress = () => props.onPressEvent?.(pe().event);
|
|
3738
3955
|
const args = createMemo(() => ({
|
|
3739
|
-
event: pe().event,
|
|
3956
|
+
event: active() ? withLiveBounds(pe().event) : pe().event,
|
|
3740
3957
|
mode: props.mode,
|
|
3741
3958
|
isAllDay: false,
|
|
3742
3959
|
boxHeight: boxHeight(),
|
|
@@ -3748,8 +3965,8 @@ function TimeGrid(incoming) {
|
|
|
3748
3965
|
const editable = createMemo(() => !!props.onDragEvent && pe().event.draggable !== false);
|
|
3749
3966
|
const canMove = createMemo(() => editable() && (pe().event.startEditable ?? props.eventStartEditable));
|
|
3750
3967
|
const canResize = createMemo(() => editable() && (pe().event.durationEditable ?? props.eventDurationEditable));
|
|
3751
|
-
var _el$
|
|
3752
|
-
spread(_el$
|
|
3968
|
+
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);
|
|
3969
|
+
spread(_el$54, [
|
|
3753
3970
|
{
|
|
3754
3971
|
"role": "button",
|
|
3755
3972
|
"tabindex": 0,
|
|
@@ -3784,8 +4001,8 @@ function TimeGrid(incoming) {
|
|
|
3784
4001
|
position: "absolute",
|
|
3785
4002
|
top: top(),
|
|
3786
4003
|
height: boxHeight(),
|
|
3787
|
-
left: `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
3788
|
-
width: `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
4004
|
+
left: floating() ? props.eventGap : `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
4005
|
+
width: floating() ? `calc(100% - ${props.eventGap * 2}px)` : `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
3789
4006
|
cursor: canMove() ? "grab" : "pointer",
|
|
3790
4007
|
touchAction: canMove() ? "pan-y" : "auto",
|
|
3791
4008
|
userSelect: canMove() ? "none" : void 0,
|
|
@@ -3796,7 +4013,7 @@ function TimeGrid(incoming) {
|
|
|
3796
4013
|
...active() && active()?.dayOffsetPx !== 0 ? { transform: `translateX(${active()?.dayOffsetPx}px)` } : null
|
|
3797
4014
|
} })
|
|
3798
4015
|
], true);
|
|
3799
|
-
insert(_el$
|
|
4016
|
+
insert(_el$54, scope((() => {
|
|
3800
4017
|
var _c$1 = memo(() => !!Renderer());
|
|
3801
4018
|
return () => _c$1() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3802
4019
|
return Renderer();
|
|
@@ -3808,12 +4025,12 @@ function TimeGrid(incoming) {
|
|
|
3808
4025
|
return slot("eventBox");
|
|
3809
4026
|
}
|
|
3810
4027
|
}));
|
|
3811
|
-
})()), _el$
|
|
3812
|
-
insert(_el$
|
|
4028
|
+
})()), _el$56, _co$14);
|
|
4029
|
+
insert(_el$54, scope((() => {
|
|
3813
4030
|
var _c$10 = memo(() => !!(canResize() && !pe().continuesBefore));
|
|
3814
4031
|
return () => _c$10() ? (() => {
|
|
3815
|
-
var _el$
|
|
3816
|
-
_el$
|
|
4032
|
+
var _el$61 = getNextElement(_tmpl$2$4);
|
|
4033
|
+
_el$61._$$pointerdown = (e) => {
|
|
3817
4034
|
pressEvent(e, pe(), key(), "resize-start", dayIndex, canMove() ? onPress : void 0);
|
|
3818
4035
|
};
|
|
3819
4036
|
effect(() => readShallow(css({
|
|
@@ -3825,17 +4042,17 @@ function TimeGrid(incoming) {
|
|
|
3825
4042
|
cursor: "ns-resize",
|
|
3826
4043
|
touchAction: "pan-y"
|
|
3827
4044
|
})), (_v$, _$p) => {
|
|
3828
|
-
style(_el$
|
|
4045
|
+
style(_el$61, _v$, _$p);
|
|
3829
4046
|
});
|
|
3830
4047
|
runHydrationEvents();
|
|
3831
|
-
return _el$
|
|
4048
|
+
return _el$61;
|
|
3832
4049
|
})() : null;
|
|
3833
|
-
})()), _el$
|
|
3834
|
-
insert(_el$
|
|
4050
|
+
})()), _el$58, _co$15);
|
|
4051
|
+
insert(_el$54, scope((() => {
|
|
3835
4052
|
var _c$11 = memo(() => !!(canResize() && !pe().continuesAfter));
|
|
3836
4053
|
return () => _c$11() ? (() => {
|
|
3837
|
-
var _el$
|
|
3838
|
-
_el$
|
|
4054
|
+
var _el$62 = getNextElement(_tmpl$2$4);
|
|
4055
|
+
_el$62._$$pointerdown = (e) => {
|
|
3839
4056
|
pressEvent(e, pe(), key(), "resize", dayIndex, canMove() ? onPress : void 0);
|
|
3840
4057
|
};
|
|
3841
4058
|
effect(() => readShallow(css({
|
|
@@ -3847,24 +4064,24 @@ function TimeGrid(incoming) {
|
|
|
3847
4064
|
cursor: "ns-resize",
|
|
3848
4065
|
touchAction: "pan-y"
|
|
3849
4066
|
})), (_v$, _$p) => {
|
|
3850
|
-
style(_el$
|
|
4067
|
+
style(_el$62, _v$, _$p);
|
|
3851
4068
|
});
|
|
3852
4069
|
runHydrationEvents();
|
|
3853
|
-
return _el$
|
|
4070
|
+
return _el$62;
|
|
3854
4071
|
})() : null;
|
|
3855
|
-
})()), _el$
|
|
4072
|
+
})()), _el$60, _co$16);
|
|
3856
4073
|
runHydrationEvents();
|
|
3857
|
-
return _el$
|
|
4074
|
+
return _el$54;
|
|
3858
4075
|
});
|
|
3859
4076
|
}
|
|
3860
|
-
})), _el$
|
|
3861
|
-
insert(_el$
|
|
4077
|
+
})), _el$42, _co$1);
|
|
4078
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3862
4079
|
get when() {
|
|
3863
4080
|
return moveSegment();
|
|
3864
4081
|
},
|
|
3865
4082
|
children: (moveSegment) => (() => {
|
|
3866
|
-
var _el$
|
|
3867
|
-
spread(_el$
|
|
4083
|
+
var _el$63 = getNextElement(_tmpl$2$4);
|
|
4084
|
+
spread(_el$63, [
|
|
3868
4085
|
{ "aria-hidden": "true" },
|
|
3869
4086
|
() => dataState({ "data-dragging": true }),
|
|
3870
4087
|
() => slot("event", { base: {
|
|
@@ -3878,7 +4095,7 @@ function TimeGrid(incoming) {
|
|
|
3878
4095
|
opacity: .85
|
|
3879
4096
|
} })
|
|
3880
4097
|
], true);
|
|
3881
|
-
insert(_el$
|
|
4098
|
+
insert(_el$63, scope(() => {
|
|
3882
4099
|
const args = {
|
|
3883
4100
|
event: moveSegment().event,
|
|
3884
4101
|
mode: props.mode,
|
|
@@ -3901,16 +4118,16 @@ function TimeGrid(incoming) {
|
|
|
3901
4118
|
})));
|
|
3902
4119
|
}));
|
|
3903
4120
|
runHydrationEvents();
|
|
3904
|
-
return _el$
|
|
4121
|
+
return _el$63;
|
|
3905
4122
|
})()
|
|
3906
|
-
})), _el$
|
|
3907
|
-
insert(_el$
|
|
4123
|
+
})), _el$44, _co$10);
|
|
4124
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3908
4125
|
get when() {
|
|
3909
4126
|
return spill();
|
|
3910
4127
|
},
|
|
3911
4128
|
children: (spill) => (() => {
|
|
3912
|
-
var _el$
|
|
3913
|
-
spread(_el$
|
|
4129
|
+
var _el$64 = getNextElement(_tmpl$2$4);
|
|
4130
|
+
spread(_el$64, [
|
|
3914
4131
|
{ "aria-hidden": "true" },
|
|
3915
4132
|
() => dataState({ "data-dragging": true }),
|
|
3916
4133
|
() => slot("event", { base: {
|
|
@@ -3924,7 +4141,7 @@ function TimeGrid(incoming) {
|
|
|
3924
4141
|
opacity: .85
|
|
3925
4142
|
} })
|
|
3926
4143
|
], true);
|
|
3927
|
-
insert(_el$
|
|
4144
|
+
insert(_el$64, scope((() => {
|
|
3928
4145
|
var _c$12 = memo(() => !!Renderer());
|
|
3929
4146
|
return () => _c$12() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3930
4147
|
return Renderer();
|
|
@@ -3938,14 +4155,14 @@ function TimeGrid(incoming) {
|
|
|
3938
4155
|
}));
|
|
3939
4156
|
})()));
|
|
3940
4157
|
runHydrationEvents();
|
|
3941
|
-
return _el$
|
|
4158
|
+
return _el$64;
|
|
3942
4159
|
})()
|
|
3943
|
-
})), _el$
|
|
3944
|
-
insert(_el$
|
|
4160
|
+
})), _el$46, _co$11);
|
|
4161
|
+
insert(_el$35, scope((() => {
|
|
3945
4162
|
var _c$0 = memo(() => !!showNow());
|
|
3946
4163
|
return () => _c$0() ? (() => {
|
|
3947
|
-
var _el$
|
|
3948
|
-
spread(_el$
|
|
4164
|
+
var _el$65 = getNextElement(_tmpl$6$2), _el$66 = _el$65.firstChild, _el$67 = _el$66.nextSibling;
|
|
4165
|
+
spread(_el$65, () => slot("nowIndicator", { base: {
|
|
3949
4166
|
position: "absolute",
|
|
3950
4167
|
top: nowTop(),
|
|
3951
4168
|
left: 0,
|
|
@@ -3969,20 +4186,20 @@ function TimeGrid(incoming) {
|
|
|
3969
4186
|
background: theme().nowIndicator
|
|
3970
4187
|
}))
|
|
3971
4188
|
}), ({ e, t }, _p$) => {
|
|
3972
|
-
style(_el$
|
|
3973
|
-
style(_el$
|
|
4189
|
+
style(_el$66, e, _p$?.e);
|
|
4190
|
+
style(_el$67, t, _p$?.t);
|
|
3974
4191
|
});
|
|
3975
4192
|
runHydrationEvents();
|
|
3976
|
-
return _el$
|
|
4193
|
+
return _el$65;
|
|
3977
4194
|
})() : null;
|
|
3978
|
-
})()), _el$
|
|
3979
|
-
insert(_el$
|
|
4195
|
+
})()), _el$48, _co$12);
|
|
4196
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3980
4197
|
get when() {
|
|
3981
4198
|
return ghost();
|
|
3982
4199
|
},
|
|
3983
|
-
children: (
|
|
3984
|
-
var _el$
|
|
3985
|
-
spread(_el$
|
|
4200
|
+
children: (_ghost) => (() => {
|
|
4201
|
+
var _el$68 = getNextElement(_tmpl$2$4);
|
|
4202
|
+
spread(_el$68, [{
|
|
3986
4203
|
"aria-hidden": "true",
|
|
3987
4204
|
get inert() {
|
|
3988
4205
|
return ghostRange() ? true : void 0;
|
|
@@ -3992,7 +4209,7 @@ function TimeGrid(incoming) {
|
|
|
3992
4209
|
position: "absolute",
|
|
3993
4210
|
left: props.eventGap,
|
|
3994
4211
|
right: props.eventGap,
|
|
3995
|
-
...
|
|
4212
|
+
...previewPlacement(),
|
|
3996
4213
|
boxSizing: "border-box",
|
|
3997
4214
|
...ghostRange() ? { overflow: "hidden" } : null,
|
|
3998
4215
|
opacity: .7,
|
|
@@ -4005,38 +4222,36 @@ function TimeGrid(incoming) {
|
|
|
4005
4222
|
borderRadius: 6
|
|
4006
4223
|
}
|
|
4007
4224
|
})], true);
|
|
4008
|
-
insert(_el$
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
},
|
|
4012
|
-
children: (range) => createComponent(Dynamic, {
|
|
4225
|
+
insert(_el$68, scope((() => {
|
|
4226
|
+
var _c$13 = memo(() => !!ghostRange());
|
|
4227
|
+
return () => _c$13() ? createComponent(Dynamic, {
|
|
4013
4228
|
get component() {
|
|
4014
4229
|
return props.renderCreateGhost;
|
|
4015
4230
|
},
|
|
4016
4231
|
get start() {
|
|
4017
|
-
return
|
|
4232
|
+
return ghostRange().start;
|
|
4018
4233
|
},
|
|
4019
4234
|
get end() {
|
|
4020
|
-
return
|
|
4235
|
+
return ghostRange().end;
|
|
4021
4236
|
}
|
|
4022
|
-
})
|
|
4023
|
-
}));
|
|
4237
|
+
}) : void 0;
|
|
4238
|
+
})()));
|
|
4024
4239
|
runHydrationEvents();
|
|
4025
|
-
return _el$
|
|
4240
|
+
return _el$68;
|
|
4026
4241
|
})()
|
|
4027
|
-
})), _el$
|
|
4242
|
+
})), _el$50, _co$13);
|
|
4028
4243
|
runHydrationEvents();
|
|
4029
|
-
return _el$
|
|
4244
|
+
return _el$35;
|
|
4030
4245
|
}
|
|
4031
4246
|
})), _el$14, _co$4);
|
|
4032
4247
|
insert(_el$6, scope((() => {
|
|
4033
4248
|
var _c$5 = memo(() => !!(paged() && draggedRef.current));
|
|
4034
4249
|
return () => _c$5() ? (() => {
|
|
4035
|
-
var _el$
|
|
4036
|
-
ref(() => (el) => ghostRef.current = el, _el$
|
|
4037
|
-
insert(_el$
|
|
4038
|
-
var _c$
|
|
4039
|
-
return () => _c$
|
|
4250
|
+
var _el$69 = getNextElement(_tmpl$0);
|
|
4251
|
+
ref(() => (el) => ghostRef.current = el, _el$69);
|
|
4252
|
+
insert(_el$69, scope((() => {
|
|
4253
|
+
var _c$14 = memo(() => !!Renderer());
|
|
4254
|
+
return () => _c$14() ? createComponent(Dynamic, {
|
|
4040
4255
|
get component() {
|
|
4041
4256
|
return Renderer();
|
|
4042
4257
|
},
|
|
@@ -4088,9 +4303,9 @@ function TimeGrid(incoming) {
|
|
|
4088
4303
|
zIndex: 1e3,
|
|
4089
4304
|
opacity: .85
|
|
4090
4305
|
})), (_v$, _$p) => {
|
|
4091
|
-
style(_el$
|
|
4306
|
+
style(_el$69, _v$, _$p);
|
|
4092
4307
|
});
|
|
4093
|
-
return _el$
|
|
4308
|
+
return _el$69;
|
|
4094
4309
|
})() : null;
|
|
4095
4310
|
})()), _el$20, _co$7);
|
|
4096
4311
|
insert(_el$6, createComponent(Show, {
|
|
@@ -4189,6 +4404,10 @@ function YearView(incoming) {
|
|
|
4189
4404
|
}, incoming);
|
|
4190
4405
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
4191
4406
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
4407
|
+
const todayKey = createMemo(() => {
|
|
4408
|
+
props.date;
|
|
4409
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
4410
|
+
});
|
|
4192
4411
|
const slot = createSlots(props);
|
|
4193
4412
|
const sweepEnabled = createMemo(() => props.onSelectDrag != null || props.onCreateEvent != null);
|
|
4194
4413
|
const [creating, setCreating] = createSignal(null);
|
|
@@ -4369,7 +4588,7 @@ function YearView(incoming) {
|
|
|
4369
4588
|
});
|
|
4370
4589
|
return _el$10;
|
|
4371
4590
|
}
|
|
4372
|
-
const isToday = createMemo(() => getIsToday(day()));
|
|
4591
|
+
const isToday = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
4373
4592
|
const isHighlighted = createMemo(() => props.activeDate ? isSameCalendarDay(day(), props.activeDate) : isToday());
|
|
4374
4593
|
const hasEvents = createMemo(() => eventDays().has(startOfDay(day()).toISOString()));
|
|
4375
4594
|
const state = createMemo(() => daySelectionState$1(day(), {
|
|
@@ -4642,16 +4861,48 @@ function Calendar(incoming) {
|
|
|
4642
4861
|
const displayEvents = createMemo(() => {
|
|
4643
4862
|
let out = props.events ?? EMPTY_EVENTS;
|
|
4644
4863
|
if (out.some((e) => e.recurrence)) {
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
end = addDays(end, 1);
|
|
4649
|
-
}
|
|
4650
|
-
out = expandRecurringEvents$1(out, start, end);
|
|
4864
|
+
const [start, end] = expansionRange(props.mode, props.date, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks);
|
|
4865
|
+
const timeZone = props.timeZone;
|
|
4866
|
+
out = timeZone ? expandRecurringEvents$1(out, fromZonedTime(start, timeZone), fromZonedTime(end, timeZone), { timeZone }) : expandRecurringEvents$1(out, start, end);
|
|
4651
4867
|
}
|
|
4652
4868
|
if (props.timeZone) out = eventsInTimeZone(out, props.timeZone);
|
|
4653
4869
|
return out;
|
|
4654
4870
|
});
|
|
4871
|
+
const zoned = {
|
|
4872
|
+
onPressEvent: createMemo(() => {
|
|
4873
|
+
const handler = props.onPressEvent;
|
|
4874
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4875
|
+
}),
|
|
4876
|
+
onDragStart: createMemo(() => {
|
|
4877
|
+
const handler = props.onDragStart;
|
|
4878
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4879
|
+
}),
|
|
4880
|
+
onDragEvent: createMemo(() => {
|
|
4881
|
+
const handler = props.onDragEvent;
|
|
4882
|
+
return handler && props.timeZone ? (event, start, end) => {
|
|
4883
|
+
const bounds = zonedDragBounds(event, start, end, { keepDuration: props.mode !== "month" && props.mode !== "multiweek" });
|
|
4884
|
+
if (!bounds) return false;
|
|
4885
|
+
return handler(zonedEventSource(event), bounds.start, bounds.end);
|
|
4886
|
+
} : handler;
|
|
4887
|
+
}),
|
|
4888
|
+
onPressMore: createMemo(() => {
|
|
4889
|
+
const handler = props.onPressMore;
|
|
4890
|
+
return handler && props.timeZone ? (dayEvents, day) => handler(dayEvents.map(zonedEventSource), day) : handler;
|
|
4891
|
+
}),
|
|
4892
|
+
onPressTime: createMemo(() => {
|
|
4893
|
+
const handler = props.onPressCell;
|
|
4894
|
+
const timeZone = props.timeZone;
|
|
4895
|
+
return handler && timeZone ? (time) => handler(fromZonedTime(time, timeZone)) : handler;
|
|
4896
|
+
}),
|
|
4897
|
+
onCreateTimed: createMemo(() => {
|
|
4898
|
+
const handler = props.onCreateEvent;
|
|
4899
|
+
const timeZone = props.timeZone;
|
|
4900
|
+
return handler && timeZone ? (start, end) => {
|
|
4901
|
+
const range = fromZonedRange(start, end, timeZone);
|
|
4902
|
+
if (range) handler(range.start, range.end);
|
|
4903
|
+
} : handler;
|
|
4904
|
+
})
|
|
4905
|
+
};
|
|
4655
4906
|
const handlePageKeys = (e) => {
|
|
4656
4907
|
if (!props.onChangeDate) return;
|
|
4657
4908
|
if (e.key === "PageDown") props.onChangeDate(pageStep(props.mode, props.date, 1, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks));
|
|
@@ -4678,6 +4929,12 @@ function Calendar(incoming) {
|
|
|
4678
4929
|
get locale() {
|
|
4679
4930
|
return props.locale;
|
|
4680
4931
|
},
|
|
4932
|
+
get now() {
|
|
4933
|
+
return props.now;
|
|
4934
|
+
},
|
|
4935
|
+
get timeZone() {
|
|
4936
|
+
return props.timeZone;
|
|
4937
|
+
},
|
|
4681
4938
|
get labels() {
|
|
4682
4939
|
return props.labels;
|
|
4683
4940
|
},
|
|
@@ -4734,6 +4991,12 @@ function Calendar(incoming) {
|
|
|
4734
4991
|
get locale() {
|
|
4735
4992
|
return props.locale;
|
|
4736
4993
|
},
|
|
4994
|
+
get now() {
|
|
4995
|
+
return props.now;
|
|
4996
|
+
},
|
|
4997
|
+
get timeZone() {
|
|
4998
|
+
return props.timeZone;
|
|
4999
|
+
},
|
|
4737
5000
|
get ampm() {
|
|
4738
5001
|
return props.ampm;
|
|
4739
5002
|
},
|
|
@@ -4765,7 +5028,7 @@ function Calendar(incoming) {
|
|
|
4765
5028
|
return props.eventAccessibilityLabel;
|
|
4766
5029
|
},
|
|
4767
5030
|
get onPressEvent() {
|
|
4768
|
-
return
|
|
5031
|
+
return zoned.onPressEvent();
|
|
4769
5032
|
},
|
|
4770
5033
|
get onPressDay() {
|
|
4771
5034
|
return props.onPressDay;
|
|
@@ -4793,6 +5056,12 @@ function Calendar(incoming) {
|
|
|
4793
5056
|
get locale() {
|
|
4794
5057
|
return props.locale;
|
|
4795
5058
|
},
|
|
5059
|
+
get now() {
|
|
5060
|
+
return props.now;
|
|
5061
|
+
},
|
|
5062
|
+
get timeZone() {
|
|
5063
|
+
return props.timeZone;
|
|
5064
|
+
},
|
|
4796
5065
|
get labels() {
|
|
4797
5066
|
return props.labels;
|
|
4798
5067
|
},
|
|
@@ -4859,14 +5128,17 @@ function Calendar(incoming) {
|
|
|
4859
5128
|
get onCreateEvent() {
|
|
4860
5129
|
return props.onCreateEvent;
|
|
4861
5130
|
},
|
|
5131
|
+
get renderCreateGhost() {
|
|
5132
|
+
return props.renderCreateGhost;
|
|
5133
|
+
},
|
|
4862
5134
|
get onSelectDrag() {
|
|
4863
5135
|
return props.onSelectDrag;
|
|
4864
5136
|
},
|
|
4865
5137
|
get onDragEvent() {
|
|
4866
|
-
return
|
|
5138
|
+
return zoned.onDragEvent();
|
|
4867
5139
|
},
|
|
4868
5140
|
get onDragStart() {
|
|
4869
|
-
return
|
|
5141
|
+
return zoned.onDragStart();
|
|
4870
5142
|
},
|
|
4871
5143
|
get eventStartEditable() {
|
|
4872
5144
|
return props.eventStartEditable;
|
|
@@ -4875,10 +5147,10 @@ function Calendar(incoming) {
|
|
|
4875
5147
|
return props.eventOverlap;
|
|
4876
5148
|
},
|
|
4877
5149
|
get onPressEvent() {
|
|
4878
|
-
return
|
|
5150
|
+
return zoned.onPressEvent();
|
|
4879
5151
|
},
|
|
4880
5152
|
get onPressMore() {
|
|
4881
|
-
return
|
|
5153
|
+
return zoned.onPressMore();
|
|
4882
5154
|
},
|
|
4883
5155
|
get renderEvent() {
|
|
4884
5156
|
return props.renderMonthEvent;
|
|
@@ -4912,6 +5184,12 @@ function Calendar(incoming) {
|
|
|
4912
5184
|
get locale() {
|
|
4913
5185
|
return props.locale;
|
|
4914
5186
|
},
|
|
5187
|
+
get now() {
|
|
5188
|
+
return props.now;
|
|
5189
|
+
},
|
|
5190
|
+
get timeZone() {
|
|
5191
|
+
return props.timeZone;
|
|
5192
|
+
},
|
|
4915
5193
|
get labels() {
|
|
4916
5194
|
return props.labels;
|
|
4917
5195
|
},
|
|
@@ -4978,14 +5256,17 @@ function Calendar(incoming) {
|
|
|
4978
5256
|
get onCreateEvent() {
|
|
4979
5257
|
return props.onCreateEvent;
|
|
4980
5258
|
},
|
|
5259
|
+
get renderCreateGhost() {
|
|
5260
|
+
return props.renderCreateGhost;
|
|
5261
|
+
},
|
|
4981
5262
|
get onSelectDrag() {
|
|
4982
5263
|
return props.onSelectDrag;
|
|
4983
5264
|
},
|
|
4984
5265
|
get onDragEvent() {
|
|
4985
|
-
return
|
|
5266
|
+
return zoned.onDragEvent();
|
|
4986
5267
|
},
|
|
4987
5268
|
get onDragStart() {
|
|
4988
|
-
return
|
|
5269
|
+
return zoned.onDragStart();
|
|
4989
5270
|
},
|
|
4990
5271
|
get eventStartEditable() {
|
|
4991
5272
|
return props.eventStartEditable;
|
|
@@ -4994,10 +5275,10 @@ function Calendar(incoming) {
|
|
|
4994
5275
|
return props.eventOverlap;
|
|
4995
5276
|
},
|
|
4996
5277
|
get onPressEvent() {
|
|
4997
|
-
return
|
|
5278
|
+
return zoned.onPressEvent();
|
|
4998
5279
|
},
|
|
4999
5280
|
get onPressMore() {
|
|
5000
|
-
return
|
|
5281
|
+
return zoned.onPressMore();
|
|
5001
5282
|
},
|
|
5002
5283
|
get renderEvent() {
|
|
5003
5284
|
return props.renderMonthEvent;
|
|
@@ -5130,22 +5411,22 @@ function Calendar(incoming) {
|
|
|
5130
5411
|
return props.touchDragThreshold;
|
|
5131
5412
|
},
|
|
5132
5413
|
get onPressEvent() {
|
|
5133
|
-
return
|
|
5414
|
+
return zoned.onPressEvent();
|
|
5134
5415
|
},
|
|
5135
5416
|
get onPressCell() {
|
|
5136
|
-
return
|
|
5417
|
+
return zoned.onPressTime();
|
|
5137
5418
|
},
|
|
5138
5419
|
get onCreateEvent() {
|
|
5139
|
-
return
|
|
5420
|
+
return zoned.onCreateTimed();
|
|
5140
5421
|
},
|
|
5141
5422
|
get renderCreateGhost() {
|
|
5142
5423
|
return props.renderCreateGhost;
|
|
5143
5424
|
},
|
|
5144
5425
|
get onDragStart() {
|
|
5145
|
-
return
|
|
5426
|
+
return zoned.onDragStart();
|
|
5146
5427
|
},
|
|
5147
5428
|
get onDragEvent() {
|
|
5148
|
-
return
|
|
5429
|
+
return zoned.onDragEvent();
|
|
5149
5430
|
},
|
|
5150
5431
|
get getEventId() {
|
|
5151
5432
|
return props.getEventId;
|
|
@@ -6598,25 +6879,23 @@ function ResourceTimeline(incoming) {
|
|
|
6598
6879
|
borderRadius: 6
|
|
6599
6880
|
}
|
|
6600
6881
|
})], true);
|
|
6601
|
-
insert(_el$39,
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
},
|
|
6605
|
-
children: (range) => createComponent(Dynamic, {
|
|
6882
|
+
insert(_el$39, scope((() => {
|
|
6883
|
+
var _c$5 = memo(() => !!createRange());
|
|
6884
|
+
return () => _c$5() ? createComponent(Dynamic, {
|
|
6606
6885
|
get component() {
|
|
6607
6886
|
return props.renderCreateGhost;
|
|
6608
6887
|
},
|
|
6609
6888
|
get start() {
|
|
6610
|
-
return
|
|
6889
|
+
return createRange().start;
|
|
6611
6890
|
},
|
|
6612
6891
|
get end() {
|
|
6613
|
-
return
|
|
6892
|
+
return createRange().end;
|
|
6614
6893
|
},
|
|
6615
6894
|
get resource() {
|
|
6616
6895
|
return resource();
|
|
6617
6896
|
}
|
|
6618
|
-
})
|
|
6619
|
-
}));
|
|
6897
|
+
}) : void 0;
|
|
6898
|
+
})()));
|
|
6620
6899
|
runHydrationEvents();
|
|
6621
6900
|
return _el$39;
|
|
6622
6901
|
})()
|
|
@@ -6744,8 +7023,8 @@ function ResourceTimeline(incoming) {
|
|
|
6744
7023
|
}
|
|
6745
7024
|
}), true);
|
|
6746
7025
|
insert(_el$51, scope((() => {
|
|
6747
|
-
var _c$
|
|
6748
|
-
return () => _c$
|
|
7026
|
+
var _c$6 = memo(() => !!props.renderResourceHeader);
|
|
7027
|
+
return () => _c$6() ? props.renderResourceHeader(resource(), index()) : resource().title ?? resource().id;
|
|
6749
7028
|
})()));
|
|
6750
7029
|
spread(_el$52, [
|
|
6751
7030
|
{ get "data-resource-id"() {
|
|
@@ -6898,8 +7177,8 @@ function ResourceTimeline(incoming) {
|
|
|
6898
7177
|
} })
|
|
6899
7178
|
], true);
|
|
6900
7179
|
insert(_el$66, scope((() => {
|
|
6901
|
-
var _c$
|
|
6902
|
-
return () => _c$
|
|
7180
|
+
var _c$7 = memo(() => !!Renderer());
|
|
7181
|
+
return () => _c$7() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
6903
7182
|
return Renderer();
|
|
6904
7183
|
} }, args)) : createComponent(DefaultBar, mergeProps(args, {
|
|
6905
7184
|
get theme() {
|
|
@@ -6911,8 +7190,8 @@ function ResourceTimeline(incoming) {
|
|
|
6911
7190
|
}));
|
|
6912
7191
|
})()), _el$68, _co$17);
|
|
6913
7192
|
insert(_el$66, scope((() => {
|
|
6914
|
-
var _c$
|
|
6915
|
-
return () => _c$
|
|
7193
|
+
var _c$8 = memo(() => !!draggable());
|
|
7194
|
+
return () => _c$8() ? (() => {
|
|
6916
7195
|
var _el$71 = getNextElement(_tmpl$6);
|
|
6917
7196
|
_el$71._$$pointerdown = (e) => {
|
|
6918
7197
|
e.stopPropagation();
|
|
@@ -6967,25 +7246,23 @@ function ResourceTimeline(incoming) {
|
|
|
6967
7246
|
borderRadius: 6
|
|
6968
7247
|
}
|
|
6969
7248
|
})], true);
|
|
6970
|
-
insert(_el$72,
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
},
|
|
6974
|
-
children: (range) => createComponent(Dynamic, {
|
|
7249
|
+
insert(_el$72, scope((() => {
|
|
7250
|
+
var _c$9 = memo(() => !!createRange());
|
|
7251
|
+
return () => _c$9() ? createComponent(Dynamic, {
|
|
6975
7252
|
get component() {
|
|
6976
7253
|
return props.renderCreateGhost;
|
|
6977
7254
|
},
|
|
6978
7255
|
get start() {
|
|
6979
|
-
return
|
|
7256
|
+
return createRange().start;
|
|
6980
7257
|
},
|
|
6981
7258
|
get end() {
|
|
6982
|
-
return
|
|
7259
|
+
return createRange().end;
|
|
6983
7260
|
},
|
|
6984
7261
|
get resource() {
|
|
6985
7262
|
return resource();
|
|
6986
7263
|
}
|
|
6987
|
-
})
|
|
6988
|
-
}));
|
|
7264
|
+
}) : void 0;
|
|
7265
|
+
})()));
|
|
6989
7266
|
runHydrationEvents();
|
|
6990
7267
|
return _el$72;
|
|
6991
7268
|
})()
|