@super-calendar/solid 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -7
- package/dist/client/index.d.ts +96 -17
- package/dist/client/index.js +1093 -382
- package/dist/server/index.d.ts +96 -17
- package/dist/server/index.js +1788 -930
- package/package.json +2 -2
- package/src/Agenda.tsx +17 -1
- package/src/Calendar.tsx +175 -27
- package/src/MonthView.tsx +589 -98
- package/src/MultiWeekView.tsx +49 -0
- package/src/TimeGrid.tsx +350 -155
- package/src/YearView.tsx +17 -1
- package/src/index.ts +7 -0
- package/src/touch.ts +70 -0
package/dist/client/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthGrid as buildMonthGrid$1, buildMonthWeeks, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, getIsToday, getViewDays, getViewDays as getViewDays$1, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, lightColors, loadEventSource, loadEventSource as loadEventSource$1, monthCreateRange, monthDropBounds, movedClockSpan, nextDateRange, nextDateRange as nextDateRange$1, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, titleNumberOfLines, toICalendar, toZonedTime, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core/vanilla";
|
|
1
|
+
import { backgroundBandsForDay, backgroundBandsForDay as backgroundBandsForDay$1, bandRounding, buildMonthGrid, buildMonthGrid as buildMonthGrid$1, buildMonthWeeks, buildMultiWeekGrid, buildMultiWeekGrid as buildMultiWeekGrid$1, cellRangeFromDrag, clampMoveStartMinutes, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, daySelectionState as daySelectionState$1, defaultCalendarLabels, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, expandRecurringEvents as expandRecurringEvents$1, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getViewDays as getViewDays$1, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isBackgroundEvent, isBackgroundEvent as isBackgroundEvent$1, isDateSelectable, isDateSelectable as isDateSelectable$1, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, layoutMonthWeek, layoutMonthWeek as layoutMonthWeek$1, lightColors, loadEventSource, loadEventSource as loadEventSource$1, monthCreateRange, monthDropBounds, movedClockSpan, nextDateRange, nextDateRange as nextDateRange$1, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, titleNumberOfLines, toICalendar, toZonedTime, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1, zonedDragBounds, zonedEventSource } from "@super-calendar/core/vanilla";
|
|
2
2
|
import { For, Show, createEffect, createMemo, createSignal, createUniqueId, merge, onCleanup, onSettled, untrack } from "solid-js";
|
|
3
3
|
import { Dynamic, className, createComponent, delegateEvents, effect, getNextElement, getNextMarker, insert, memo, mergeProps, readShallow, ref, runHydrationEvents, scope, setAttribute, setStyleProperty, spread, style, template } from "@solidjs/web";
|
|
4
|
-
import { addDays, addMonths, addYears, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getISOWeek, isSameDay, isSameMonth, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
4
|
+
import { addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, endOfYear, format, getISOWeek, isSameDay, isSameMonth, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
5
5
|
// src/createEventSource.ts
|
|
6
6
|
/** Load a reactive URL or async function, with optional polling and owned cleanup. */
|
|
7
7
|
function createEventSource(source, options = () => ({})) {
|
|
@@ -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 ? {
|
|
@@ -538,17 +542,110 @@ function Agenda(incoming) {
|
|
|
538
542
|
});
|
|
539
543
|
return _el$9;
|
|
540
544
|
}
|
|
545
|
+
// src/touch.ts
|
|
546
|
+
function waitForHold(grab, delay, threshold, onHold, onTap, onCancel) {
|
|
547
|
+
const detach = () => {
|
|
548
|
+
clearTimeout(timer);
|
|
549
|
+
document.removeEventListener("pointermove", move);
|
|
550
|
+
document.removeEventListener("pointerup", up);
|
|
551
|
+
document.removeEventListener("pointercancel", cancelPointer);
|
|
552
|
+
document.removeEventListener("pointerdown", anotherPointer);
|
|
553
|
+
};
|
|
554
|
+
const cancel = () => {
|
|
555
|
+
detach();
|
|
556
|
+
onCancel();
|
|
557
|
+
};
|
|
558
|
+
const move = (event) => {
|
|
559
|
+
if (event.pointerId === grab.pointerId && Math.hypot(event.clientX - grab.clientX, event.clientY - grab.clientY) > threshold) cancel();
|
|
560
|
+
};
|
|
561
|
+
const up = (event) => {
|
|
562
|
+
if (event.pointerId === grab.pointerId) {
|
|
563
|
+
detach();
|
|
564
|
+
onTap();
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
const cancelPointer = (event) => {
|
|
568
|
+
if (event.pointerId === grab.pointerId) cancel();
|
|
569
|
+
};
|
|
570
|
+
const anotherPointer = (event) => {
|
|
571
|
+
if (event.pointerId !== grab.pointerId) cancel();
|
|
572
|
+
};
|
|
573
|
+
const timer = setTimeout(() => {
|
|
574
|
+
detach();
|
|
575
|
+
onHold();
|
|
576
|
+
}, delay);
|
|
577
|
+
document.addEventListener("pointermove", move);
|
|
578
|
+
document.addEventListener("pointerup", up);
|
|
579
|
+
document.addEventListener("pointercancel", cancelPointer);
|
|
580
|
+
document.addEventListener("pointerdown", anotherPointer);
|
|
581
|
+
return cancel;
|
|
582
|
+
}
|
|
583
|
+
/** A quick swipe scrolls; a held pointer owns a date-row drag until release. */
|
|
584
|
+
function holdDateDrag(grab, start, move, cancel, release) {
|
|
585
|
+
const doc = grab.box.ownerDocument;
|
|
586
|
+
let active = false;
|
|
587
|
+
let finished = false;
|
|
588
|
+
let cancelWait;
|
|
589
|
+
const detach = () => {
|
|
590
|
+
doc.removeEventListener("pointermove", onMove);
|
|
591
|
+
doc.removeEventListener("pointerup", onUp);
|
|
592
|
+
doc.removeEventListener("pointercancel", onCancel);
|
|
593
|
+
doc.removeEventListener("pointerdown", onAnotherPointer);
|
|
594
|
+
doc.removeEventListener("touchmove", onTouchMove);
|
|
595
|
+
doc.removeEventListener("contextmenu", onContextMenu);
|
|
596
|
+
};
|
|
597
|
+
const stop = () => {
|
|
598
|
+
if (finished) return;
|
|
599
|
+
finished = true;
|
|
600
|
+
detach();
|
|
601
|
+
cancelWait?.();
|
|
602
|
+
cancel();
|
|
603
|
+
release();
|
|
604
|
+
};
|
|
605
|
+
const onMove = (event) => {
|
|
606
|
+
if (active && event.pointerId === grab.pointerId) move(event.clientX, event.clientY);
|
|
607
|
+
};
|
|
608
|
+
const onUp = (event) => {
|
|
609
|
+
if (event.pointerId !== grab.pointerId) return;
|
|
610
|
+
finished = true;
|
|
611
|
+
detach();
|
|
612
|
+
release();
|
|
613
|
+
};
|
|
614
|
+
const onCancel = (event) => {
|
|
615
|
+
if (event.pointerId === grab.pointerId) stop();
|
|
616
|
+
};
|
|
617
|
+
const onAnotherPointer = (event) => {
|
|
618
|
+
if (event.pointerId !== grab.pointerId) stop();
|
|
619
|
+
};
|
|
620
|
+
const onTouchMove = (event) => {
|
|
621
|
+
if (active && event.cancelable) event.preventDefault();
|
|
622
|
+
};
|
|
623
|
+
const onContextMenu = (event) => {
|
|
624
|
+
event.preventDefault();
|
|
625
|
+
};
|
|
626
|
+
doc.addEventListener("pointermove", onMove);
|
|
627
|
+
doc.addEventListener("pointerup", onUp);
|
|
628
|
+
doc.addEventListener("pointercancel", onCancel);
|
|
629
|
+
doc.addEventListener("pointerdown", onAnotherPointer);
|
|
630
|
+
doc.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
631
|
+
doc.addEventListener("contextmenu", onContextMenu);
|
|
632
|
+
cancelWait = waitForHold(grab, 400, 8, () => {
|
|
633
|
+
active = true;
|
|
634
|
+
start();
|
|
635
|
+
}, release, stop);
|
|
636
|
+
return stop;
|
|
637
|
+
}
|
|
541
638
|
// src/MonthView.tsx
|
|
542
639
|
var _tmpl$$7 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div>`);
|
|
543
640
|
var _tmpl$2$6 = /*#__PURE__*/ template(`<div>`);
|
|
544
641
|
var _tmpl$3$5 = /*#__PURE__*/ template(`<span>`);
|
|
545
642
|
var _tmpl$4$4 = /*#__PURE__*/ template(`<div role=gridcell aria-hidden=true>`);
|
|
546
|
-
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span
|
|
643
|
+
var _tmpl$5$4 = /*#__PURE__*/ template(`<div><!$><!/><span></span><!$><!/><!$><!/><div><!$><!/><!$><!/><!$><!/>`);
|
|
547
644
|
var _tmpl$6$4 = /*#__PURE__*/ template(`<button>`);
|
|
548
645
|
var _tmpl$7$2 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
549
646
|
var _tmpl$8$2 = /*#__PURE__*/ template(`<div><div></div><!$><!/>`);
|
|
550
647
|
var _tmpl$9$1 = /*#__PURE__*/ template(`<button type=button>`);
|
|
551
|
-
var _tmpl$0 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
648
|
+
var _tmpl$0$1 = /*#__PURE__*/ template(`<button><!$><!/><span>`);
|
|
552
649
|
/**
|
|
553
650
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
554
651
|
* the `classNames` / `styles` props to restyle just that part.
|
|
@@ -561,8 +658,11 @@ const CHIP_HEIGHT = 18;
|
|
|
561
658
|
const CHIP_GAP = 2;
|
|
562
659
|
const CELL_PAD = 4;
|
|
563
660
|
const DRAGGED_CHIP_OPACITY = .4;
|
|
661
|
+
const DRAG_SLOP_PX = 4;
|
|
662
|
+
const TOUCH_DRAG_SLOP_PX = 8;
|
|
564
663
|
/** Props passed to a custom month event chip renderer. */
|
|
565
664
|
/** A component that renders a single month-grid event chip. */
|
|
665
|
+
const isOutsidePeriod = (day) => day.isCurrentMonth === false;
|
|
566
666
|
/** Props for {@link MonthView}. */
|
|
567
667
|
function dayCellDefault(day, theme, highlightWeekends) {
|
|
568
668
|
return {
|
|
@@ -723,7 +823,7 @@ function chipDefault(theme, chipHeight) {
|
|
|
723
823
|
}
|
|
724
824
|
};
|
|
725
825
|
}
|
|
726
|
-
function moreButtonDefault(theme, chipHeight) {
|
|
826
|
+
function moreButtonDefault(theme, chipHeight, multiWeek = false) {
|
|
727
827
|
return {
|
|
728
828
|
base: {
|
|
729
829
|
position: "relative",
|
|
@@ -734,7 +834,12 @@ function moreButtonDefault(theme, chipHeight) {
|
|
|
734
834
|
textAlign: "left",
|
|
735
835
|
height: chipHeight,
|
|
736
836
|
lineHeight: `${chipHeight}px`,
|
|
737
|
-
fontFamily: "inherit"
|
|
837
|
+
fontFamily: "inherit",
|
|
838
|
+
...multiWeek ? {
|
|
839
|
+
whiteSpace: "nowrap",
|
|
840
|
+
overflow: "hidden",
|
|
841
|
+
textOverflow: "ellipsis"
|
|
842
|
+
} : {}
|
|
738
843
|
},
|
|
739
844
|
themed: {
|
|
740
845
|
padding: "0 6px",
|
|
@@ -758,6 +863,15 @@ function collectRowEvents(week, eventsByDay) {
|
|
|
758
863
|
return out;
|
|
759
864
|
}
|
|
760
865
|
/**
|
|
866
|
+
* Which rows a {@link DateRows} grid shows. Internal to the package: the public
|
|
867
|
+
* views adapt their own props to it.
|
|
868
|
+
*/
|
|
869
|
+
function rangeTitle(start, endExclusive, locale) {
|
|
870
|
+
const options = locale ? { locale } : void 0;
|
|
871
|
+
return `${format(start, "PP", options)} – ${format(addDays(endExclusive, -1), "PP", options)}`;
|
|
872
|
+
}
|
|
873
|
+
/** Props for the private {@link DateRows} grid shared by the public row views. */
|
|
874
|
+
/**
|
|
761
875
|
* A single static month grid, rendered with plain DOM elements.
|
|
762
876
|
*
|
|
763
877
|
* @example
|
|
@@ -765,7 +879,22 @@ function collectRowEvents(week, eventsByDay) {
|
|
|
765
879
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
766
880
|
* ```
|
|
767
881
|
*/
|
|
768
|
-
function MonthView(
|
|
882
|
+
function MonthView(props) {
|
|
883
|
+
return createComponent(DateRows, mergeProps(props, { source: {
|
|
884
|
+
kind: "month",
|
|
885
|
+
get date() {
|
|
886
|
+
return props.date;
|
|
887
|
+
},
|
|
888
|
+
get showAdjacentMonths() {
|
|
889
|
+
return props.showAdjacentMonths ?? true;
|
|
890
|
+
}
|
|
891
|
+
} }));
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* The day-row grid behind the public row views: week rows of day cells with
|
|
895
|
+
* spanning event bars, overflow, selection, drag, and keyboard handling.
|
|
896
|
+
*/
|
|
897
|
+
function DateRows(incoming) {
|
|
769
898
|
const props = withDefaults({
|
|
770
899
|
weekStartsOn: 0,
|
|
771
900
|
weekdayFormat: "short",
|
|
@@ -773,7 +902,6 @@ function MonthView(incoming) {
|
|
|
773
902
|
chipHeight: CHIP_HEIGHT,
|
|
774
903
|
chipGap: CHIP_GAP,
|
|
775
904
|
moreLabel: "{moreCount} More",
|
|
776
|
-
showAdjacentMonths: true,
|
|
777
905
|
highlightWeekends: true,
|
|
778
906
|
fillCellOnSelection: false,
|
|
779
907
|
showTitle: true,
|
|
@@ -785,7 +913,12 @@ function MonthView(incoming) {
|
|
|
785
913
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
786
914
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
787
915
|
const slot = createSlots(props);
|
|
788
|
-
const
|
|
916
|
+
const multiWeek = createMemo(() => props.source.kind === "multiweek");
|
|
917
|
+
const showAdjacentMonths = createMemo(() => props.source.kind === "month" ? props.source.showAdjacentMonths : true);
|
|
918
|
+
const numberOfWeeks = createMemo(() => props.source.kind === "multiweek" ? props.source.numberOfWeeks : void 0);
|
|
919
|
+
const viewMode = createMemo(() => multiWeek() ? "multiweek" : "month");
|
|
920
|
+
const createContentEnabled = createMemo(() => props.onCreateEvent != null && props.renderCreateGhost != null);
|
|
921
|
+
const eventsMode = createMemo(() => props.events !== void 0 || multiWeek() || createContentEnabled());
|
|
789
922
|
const dayRoving = createMemo(() => !eventsMode() || props.keyboardDayNavigation);
|
|
790
923
|
const eventsByDay = createMemo(() => {
|
|
791
924
|
if (props.eventsByDay) return props.eventsByDay;
|
|
@@ -823,43 +956,104 @@ function MonthView(incoming) {
|
|
|
823
956
|
document.removeEventListener("keydown", onKey);
|
|
824
957
|
};
|
|
825
958
|
}));
|
|
826
|
-
const eventRowHeight = createMemo(() => 32 + props.maxVisibleEventCount * (props.chipHeight + props.chipGap));
|
|
827
|
-
const _grid = createMemo(() =>
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
959
|
+
const eventRowHeight = createMemo(() => 32 + (multiWeek() ? Math.max(1, props.maxVisibleEventCount) : props.maxVisibleEventCount) * (props.chipHeight + props.chipGap));
|
|
960
|
+
const _grid = createMemo(() => {
|
|
961
|
+
const options = {
|
|
962
|
+
weekStartsOn: props.weekStartsOn,
|
|
963
|
+
hiddenDays: props.hiddenDays,
|
|
964
|
+
weekdayFormat: props.weekdayFormat,
|
|
965
|
+
selectedRange: props.selectedRange,
|
|
966
|
+
selectedDates: props.selectedDates,
|
|
967
|
+
minDate: props.minDate,
|
|
968
|
+
maxDate: props.maxDate,
|
|
969
|
+
isDateDisabled: props.isDateDisabled,
|
|
970
|
+
locale: props.locale,
|
|
971
|
+
today: nowInTimeZone(props.now, props.timeZone)
|
|
972
|
+
};
|
|
973
|
+
const weeks = numberOfWeeks();
|
|
974
|
+
if (weeks === void 0) return {
|
|
975
|
+
...buildMonthGrid$1(props.source.date, options),
|
|
976
|
+
title: format(props.source.date, "MMMM yyyy", props.locale ? { locale: props.locale } : void 0),
|
|
977
|
+
period: null
|
|
978
|
+
};
|
|
979
|
+
const grid = buildMultiWeekGrid$1(props.source.date, {
|
|
980
|
+
...options,
|
|
981
|
+
numberOfWeeks: weeks
|
|
982
|
+
});
|
|
983
|
+
return {
|
|
984
|
+
weeks: grid.weeks,
|
|
985
|
+
weekdays: grid.weekdays,
|
|
986
|
+
title: rangeTitle(grid.visibleRange.start, grid.visibleRange.endExclusive, props.locale),
|
|
987
|
+
period: grid.period
|
|
988
|
+
};
|
|
989
|
+
});
|
|
838
990
|
const weekLayouts = createMemo(() => eventsMode() ? _grid().weeks.map((week) => layoutMonthWeek$1(week.days.map((d) => d.date), collectRowEvents(week, eventsByDay()))) : []);
|
|
991
|
+
const focusableDays = createMemo(() => _grid().period ? _grid().weeks.flatMap((week) => week.days).filter((day) => !day.isDisabled).map((day) => startOfDay(day.date)).sort((a, b) => a.getTime() - b.getTime()) : null);
|
|
992
|
+
const focusableKeys = createMemo(() => {
|
|
993
|
+
const days = focusableDays();
|
|
994
|
+
return days ? new Set(days.map((d) => format(d, "yyyy-MM-dd"))) : null;
|
|
995
|
+
});
|
|
839
996
|
const initialFocus = createMemo(() => {
|
|
840
|
-
const
|
|
997
|
+
const days = focusableDays();
|
|
998
|
+
const keys = focusableKeys();
|
|
999
|
+
if (days && keys) {
|
|
1000
|
+
const rendered = (d) => !!d && keys.has(format(d, "yyyy-MM-dd"));
|
|
1001
|
+
const rangeStart = props.selectedRange?.start;
|
|
1002
|
+
if (rendered(rangeStart)) return startOfDay(rangeStart);
|
|
1003
|
+
const picked = props.selectedDates?.find(rendered);
|
|
1004
|
+
if (picked) return startOfDay(picked);
|
|
1005
|
+
const today = /* @__PURE__ */ new Date();
|
|
1006
|
+
if (rendered(today)) return startOfDay(today);
|
|
1007
|
+
return days[0] ?? null;
|
|
1008
|
+
}
|
|
1009
|
+
const inMonth = (d) => !!d && isSameMonth(d, props.source.date);
|
|
841
1010
|
if (inMonth(props.selectedRange?.start)) return startOfDay(props.selectedRange.start);
|
|
842
1011
|
const picked = props.selectedDates?.find(inMonth);
|
|
843
1012
|
if (picked) return startOfDay(picked);
|
|
844
1013
|
const today = /* @__PURE__ */ new Date();
|
|
845
|
-
return isSameMonth(today, props.date) ? startOfDay(today) : startOfMonth(props.date);
|
|
1014
|
+
return isSameMonth(today, props.source.date) ? startOfDay(today) : startOfMonth(props.source.date);
|
|
846
1015
|
});
|
|
847
1016
|
const [focusedDate, setFocusedDate] = createSignal(untrack(() => initialFocus()));
|
|
848
1017
|
const initialFocusRef = { current: untrack(() => initialFocus()) };
|
|
849
1018
|
createEffect(() => initialFocus(), (value) => {
|
|
850
1019
|
initialFocusRef.current = value;
|
|
851
1020
|
});
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1021
|
+
const windowKey = createMemo(() => {
|
|
1022
|
+
const period = _grid().period;
|
|
1023
|
+
return period ? `${format(period.start, "yyyy-MM-dd")}+${numberOfWeeks()}:${_grid().weekdays.map((day) => day.date.getDay()).join(",")}` : format(props.source.date, "yyyy-MM");
|
|
1024
|
+
});
|
|
1025
|
+
let focusedWindow = untrack(windowKey);
|
|
1026
|
+
createEffect(windowKey, (key) => untrack(() => {
|
|
1027
|
+
if (key === focusedWindow) return;
|
|
1028
|
+
focusedWindow = key;
|
|
857
1029
|
setFocusedDate(initialFocusRef.current);
|
|
858
1030
|
}));
|
|
859
1031
|
const [hoveredKey, setHoveredKey] = createSignal(null);
|
|
860
1032
|
const gridRef = { current: null };
|
|
861
|
-
const
|
|
1033
|
+
const lastDayFocus = { current: null };
|
|
1034
|
+
const focusKey = createMemo(() => {
|
|
1035
|
+
const focused = focusedDate();
|
|
1036
|
+
const stored = focused ? format(focused, "yyyy-MM-dd") : null;
|
|
1037
|
+
const keys = focusableKeys();
|
|
1038
|
+
if (!keys || stored !== null && keys.has(stored)) return stored;
|
|
1039
|
+
const initial = initialFocus();
|
|
1040
|
+
return initial && format(initial, "yyyy-MM-dd");
|
|
1041
|
+
});
|
|
1042
|
+
createEffect(() => ({
|
|
1043
|
+
enabled: multiWeek(),
|
|
1044
|
+
key: focusKey()
|
|
1045
|
+
}), ({ enabled, key }) => {
|
|
1046
|
+
if (!enabled) return;
|
|
1047
|
+
const active = gridRef.current?.ownerDocument.activeElement;
|
|
1048
|
+
if (!(active === gridRef.current?.ownerDocument.body && lastDayFocus.current !== null && !lastDayFocus.current.isConnected) && (!active?.hasAttribute("data-day") || !gridRef.current?.contains(active))) return;
|
|
1049
|
+
if (active?.getAttribute("data-day") === key && active?.getAttribute("aria-disabled") !== "true") return;
|
|
1050
|
+
(key ? gridRef.current?.querySelector(`[data-day="${key}"]`) : gridRef.current)?.focus();
|
|
1051
|
+
});
|
|
862
1052
|
const [drag, setDrag] = createSignal(null);
|
|
1053
|
+
const createRange = createMemo(() => {
|
|
1054
|
+
const current = drag();
|
|
1055
|
+
return createContentEnabled() && current?.kind === "create" ? monthCreateRange(new Date(current.anchor), new Date(current.hover)) : null;
|
|
1056
|
+
}, { equals: (a, b) => a === b || !!a && !!b && +a.start === +b.start && +a.end === +b.end });
|
|
863
1057
|
const dragRef = { current: null };
|
|
864
1058
|
const applyDrag = (value) => {
|
|
865
1059
|
dragRef.current = value;
|
|
@@ -867,29 +1061,41 @@ function MonthView(incoming) {
|
|
|
867
1061
|
};
|
|
868
1062
|
const movedRef = { current: false };
|
|
869
1063
|
const suppressClickRef = { current: false };
|
|
870
|
-
const consumeSuppressedClick = () => {
|
|
871
|
-
if (!suppressClickRef.current) return false;
|
|
1064
|
+
const consumeSuppressedClick = (detail) => {
|
|
1065
|
+
if (detail === 0 || !suppressClickRef.current) return false;
|
|
872
1066
|
suppressClickRef.current = false;
|
|
873
1067
|
return true;
|
|
874
1068
|
};
|
|
875
1069
|
const canMove = (event) => props.onDragEvent != null && !event.disabled && event.draggable !== false && (event.startEditable ?? props.eventStartEditable);
|
|
1070
|
+
let pressOrigin = {
|
|
1071
|
+
x: 0,
|
|
1072
|
+
y: 0,
|
|
1073
|
+
slop: DRAG_SLOP_PX
|
|
1074
|
+
};
|
|
876
1075
|
const beginPress = (e) => {
|
|
877
1076
|
if (dragRef.current || e.isPrimary === false) return false;
|
|
878
1077
|
suppressClickRef.current = false;
|
|
879
1078
|
movedRef.current = false;
|
|
1079
|
+
pressOrigin = {
|
|
1080
|
+
x: e.clientX,
|
|
1081
|
+
y: e.clientY,
|
|
1082
|
+
slop: e.pointerType === "touch" ? TOUCH_DRAG_SLOP_PX : DRAG_SLOP_PX
|
|
1083
|
+
};
|
|
880
1084
|
return true;
|
|
881
1085
|
};
|
|
882
|
-
const beginCreate = (day, pointerId) => {
|
|
1086
|
+
const beginCreate = (day, pointerId, armed) => {
|
|
883
1087
|
if (!props.onCreateEvent && !props.onSelectDrag) return;
|
|
884
1088
|
const t = startOfDay(day).getTime();
|
|
885
1089
|
applyDrag({
|
|
886
1090
|
kind: "create",
|
|
887
1091
|
pointerId,
|
|
888
1092
|
anchor: t,
|
|
889
|
-
hover: t
|
|
1093
|
+
hover: t,
|
|
1094
|
+
windowKey: windowKey(),
|
|
1095
|
+
armed
|
|
890
1096
|
});
|
|
891
1097
|
};
|
|
892
|
-
const beginMove = (event, day, pointerId) => {
|
|
1098
|
+
const beginMove = (event, day, pointerId, armed) => {
|
|
893
1099
|
if (!canMove(event)) return;
|
|
894
1100
|
const t = startOfDay(day).getTime();
|
|
895
1101
|
applyDrag({
|
|
@@ -897,7 +1103,9 @@ function MonthView(incoming) {
|
|
|
897
1103
|
pointerId,
|
|
898
1104
|
event,
|
|
899
1105
|
from: t,
|
|
900
|
-
to: t
|
|
1106
|
+
to: t,
|
|
1107
|
+
windowKey: windowKey(),
|
|
1108
|
+
armed
|
|
901
1109
|
});
|
|
902
1110
|
props.onDragStart?.(event);
|
|
903
1111
|
};
|
|
@@ -909,17 +1117,76 @@ function MonthView(incoming) {
|
|
|
909
1117
|
movedRef.current = true;
|
|
910
1118
|
applyDrag(current.kind === "create" ? {
|
|
911
1119
|
...current,
|
|
912
|
-
hover: t
|
|
1120
|
+
hover: t,
|
|
1121
|
+
armed: true
|
|
913
1122
|
} : {
|
|
914
1123
|
...current,
|
|
915
|
-
to: t
|
|
1124
|
+
to: t,
|
|
1125
|
+
armed: true
|
|
916
1126
|
});
|
|
917
1127
|
if (current.kind === "create") {
|
|
918
1128
|
const [lo, hi] = current.anchor <= t ? [current.anchor, t] : [t, current.anchor];
|
|
919
1129
|
props.onSelectDrag?.(new Date(lo), new Date(hi));
|
|
920
1130
|
}
|
|
921
1131
|
};
|
|
1132
|
+
let heldTouch = null;
|
|
1133
|
+
let heldOrigin = null;
|
|
1134
|
+
const dayLookup = createMemo(() => new Map(_grid().weeks.flatMap((week) => week.days).map((day) => [day.id, day])));
|
|
1135
|
+
const pressRow = (event, day, moving) => {
|
|
1136
|
+
if (event.button !== 0 || heldTouch || !beginPress(event)) return;
|
|
1137
|
+
const start = (armed) => {
|
|
1138
|
+
if (moving) beginMove(moving, day, event.pointerId, armed);
|
|
1139
|
+
else beginCreate(day, event.pointerId, armed);
|
|
1140
|
+
};
|
|
1141
|
+
if (!multiWeek() || !event.pointerType || event.pointerType === "mouse") {
|
|
1142
|
+
start(false);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
heldOrigin = {
|
|
1146
|
+
day,
|
|
1147
|
+
event: moving
|
|
1148
|
+
};
|
|
1149
|
+
heldTouch = holdDateDrag({
|
|
1150
|
+
box: event.currentTarget,
|
|
1151
|
+
pointerId: event.pointerId,
|
|
1152
|
+
pointerType: event.pointerType,
|
|
1153
|
+
clientX: event.clientX,
|
|
1154
|
+
clientY: event.clientY
|
|
1155
|
+
}, () => start(true), (x, y) => {
|
|
1156
|
+
const element = gridRef.current?.ownerDocument.elementFromPoint(x, y)?.closest("[data-day]");
|
|
1157
|
+
if (!element || !gridRef.current?.contains(element)) return;
|
|
1158
|
+
const day = dayLookup().get(element.dataset.day ?? "");
|
|
1159
|
+
if (day && !day.isDisabled) extendDrag(day.date, event.pointerId);
|
|
1160
|
+
}, () => {
|
|
1161
|
+
applyDrag(null);
|
|
1162
|
+
movedRef.current = false;
|
|
1163
|
+
}, () => {
|
|
1164
|
+
heldTouch = null;
|
|
1165
|
+
heldOrigin = null;
|
|
1166
|
+
});
|
|
1167
|
+
};
|
|
1168
|
+
createEffect(() => windowKey(), () => () => {
|
|
1169
|
+
heldTouch?.();
|
|
1170
|
+
});
|
|
1171
|
+
createEffect(() => ({
|
|
1172
|
+
days: dayLookup(),
|
|
1173
|
+
events: props.events,
|
|
1174
|
+
canCreate: !!(props.onCreateEvent || props.onSelectDrag),
|
|
1175
|
+
canMove: !!props.onDragEvent,
|
|
1176
|
+
eventStartEditable: props.eventStartEditable
|
|
1177
|
+
}), (state) => {
|
|
1178
|
+
const origin = heldOrigin;
|
|
1179
|
+
if (!origin) return;
|
|
1180
|
+
const current = dragRef.current;
|
|
1181
|
+
const destination = current ? new Date(current.kind === "create" ? current.hover : current.to) : origin.day;
|
|
1182
|
+
const enabled = (day) => {
|
|
1183
|
+
const cell = state.days.get(format(day, "yyyy-MM-dd"));
|
|
1184
|
+
return cell != null && !cell.isDisabled;
|
|
1185
|
+
};
|
|
1186
|
+
if (!enabled(origin.day) || !enabled(destination) || (origin.event ? !state.canMove || !state.events?.includes(origin.event) || origin.event.disabled || origin.event.draggable === false || !(origin.event.startEditable ?? state.eventStartEditable) : !state.canCreate)) heldTouch?.();
|
|
1187
|
+
});
|
|
922
1188
|
const isDragging = createMemo(() => drag() !== null);
|
|
1189
|
+
const dragArmed = createMemo(() => drag()?.armed === true);
|
|
923
1190
|
const dragWired = createMemo(() => props.onCreateEvent != null || props.onSelectDrag != null || props.onDragEvent != null);
|
|
924
1191
|
createEffect(() => [
|
|
925
1192
|
isDragging(),
|
|
@@ -933,8 +1200,12 @@ function MonthView(incoming) {
|
|
|
933
1200
|
const current = dragRef.current;
|
|
934
1201
|
if (!current || current.pointerId !== e.pointerId) return;
|
|
935
1202
|
applyDrag(null);
|
|
936
|
-
if (!movedRef.current)
|
|
1203
|
+
if (!movedRef.current) {
|
|
1204
|
+
if (current.kind === "move" && current.armed) suppressClickRef.current = true;
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
937
1207
|
suppressClickRef.current = true;
|
|
1208
|
+
if (multiWeek() && current.windowKey !== windowKey()) return;
|
|
938
1209
|
if (current.kind === "create") {
|
|
939
1210
|
const range = monthCreateRange(new Date(current.anchor), new Date(current.hover));
|
|
940
1211
|
props.onCreateEvent?.(range.start, range.end);
|
|
@@ -945,30 +1216,93 @@ function MonthView(incoming) {
|
|
|
945
1216
|
if (props.eventOverlap === false && overlapsOtherEvents(props.events ?? [], current.event, next.start, next.end)) return;
|
|
946
1217
|
props.onDragEvent?.(current.event, next.start, next.end);
|
|
947
1218
|
};
|
|
948
|
-
const
|
|
949
|
-
|
|
1219
|
+
const clear = () => {
|
|
1220
|
+
heldTouch?.();
|
|
950
1221
|
applyDrag(null);
|
|
951
1222
|
movedRef.current = false;
|
|
952
1223
|
suppressClickRef.current = true;
|
|
953
1224
|
};
|
|
1225
|
+
const cancel = (event) => {
|
|
1226
|
+
if (dragRef.current?.pointerId === event.pointerId) clear();
|
|
1227
|
+
};
|
|
1228
|
+
const arm = (event) => {
|
|
1229
|
+
const current = dragRef.current;
|
|
1230
|
+
if (!current || current.armed || current.pointerId !== event.pointerId) return;
|
|
1231
|
+
if (Math.hypot(event.clientX - pressOrigin.x, event.clientY - pressOrigin.y) <= pressOrigin.slop) return;
|
|
1232
|
+
applyDrag({
|
|
1233
|
+
...current,
|
|
1234
|
+
armed: true
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1237
|
+
const keyDown = (event) => {
|
|
1238
|
+
if (event.key !== "Escape") return;
|
|
1239
|
+
event.preventDefault();
|
|
1240
|
+
clear();
|
|
1241
|
+
};
|
|
1242
|
+
window.addEventListener("pointermove", arm);
|
|
954
1243
|
window.addEventListener("pointerup", finish);
|
|
955
1244
|
window.addEventListener("pointercancel", cancel);
|
|
1245
|
+
window.addEventListener("keydown", keyDown);
|
|
956
1246
|
return () => {
|
|
1247
|
+
window.removeEventListener("pointermove", arm);
|
|
957
1248
|
window.removeEventListener("pointerup", finish);
|
|
958
1249
|
window.removeEventListener("pointercancel", cancel);
|
|
1250
|
+
window.removeEventListener("keydown", keyDown);
|
|
959
1251
|
};
|
|
960
1252
|
}));
|
|
1253
|
+
let transientWindow = untrack(windowKey);
|
|
1254
|
+
createEffect(windowKey, (key) => untrack(() => {
|
|
1255
|
+
if (key === transientWindow) return;
|
|
1256
|
+
transientWindow = key;
|
|
1257
|
+
if (!multiWeek()) return;
|
|
1258
|
+
applyDrag(null);
|
|
1259
|
+
setMoreOpenFor(null);
|
|
1260
|
+
}));
|
|
1261
|
+
const nextMultiWeekFocus = (key) => {
|
|
1262
|
+
const days = focusableDays();
|
|
1263
|
+
const keys = focusableKeys();
|
|
1264
|
+
const period = _grid().period;
|
|
1265
|
+
if (!days || !keys || !period) return null;
|
|
1266
|
+
const index = days.findIndex((d) => format(d, "yyyy-MM-dd") === focusKey());
|
|
1267
|
+
if (index === -1) return null;
|
|
1268
|
+
if (key === "ArrowLeft") return days[index - 1] ?? null;
|
|
1269
|
+
if (key === "ArrowRight") return days[index + 1] ?? null;
|
|
1270
|
+
if (key === "Home") return days[0];
|
|
1271
|
+
if (key === "End") return days[days.length - 1];
|
|
1272
|
+
const step = key === "ArrowUp" ? -7 : 7;
|
|
1273
|
+
for (let cursor = addDays(days[index], step); cursor >= period.start && cursor < period.endExclusive; cursor = addDays(cursor, step)) if (keys.has(format(cursor, "yyyy-MM-dd"))) return cursor;
|
|
1274
|
+
return null;
|
|
1275
|
+
};
|
|
961
1276
|
const onKeyDown = (e) => {
|
|
1277
|
+
if (multiWeek()) {
|
|
1278
|
+
if (![
|
|
1279
|
+
"ArrowLeft",
|
|
1280
|
+
"ArrowRight",
|
|
1281
|
+
"ArrowUp",
|
|
1282
|
+
"ArrowDown",
|
|
1283
|
+
"Home",
|
|
1284
|
+
"End"
|
|
1285
|
+
].includes(e.key)) return;
|
|
1286
|
+
e.preventDefault();
|
|
1287
|
+
const target = nextMultiWeekFocus(e.key);
|
|
1288
|
+
if (!target) return;
|
|
1289
|
+
setFocusedDate(target);
|
|
1290
|
+
const targetKey = format(target, "yyyy-MM-dd");
|
|
1291
|
+
gridRef.current?.querySelector(`[data-day="${targetKey}"]`)?.focus();
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const focused = focusedDate();
|
|
1295
|
+
if (!focused) return;
|
|
962
1296
|
let next = null;
|
|
963
|
-
if (e.key === "ArrowLeft") next = addDays(
|
|
964
|
-
else if (e.key === "ArrowRight") next = addDays(
|
|
965
|
-
else if (e.key === "ArrowUp") next = addDays(
|
|
966
|
-
else if (e.key === "ArrowDown") next = addDays(
|
|
967
|
-
else if (e.key === "Home") next = startOfMonth(props.date);
|
|
968
|
-
else if (e.key === "End") next = endOfMonth(props.date);
|
|
1297
|
+
if (e.key === "ArrowLeft") next = addDays(focused, -1);
|
|
1298
|
+
else if (e.key === "ArrowRight") next = addDays(focused, 1);
|
|
1299
|
+
else if (e.key === "ArrowUp") next = addDays(focused, -7);
|
|
1300
|
+
else if (e.key === "ArrowDown") next = addDays(focused, 7);
|
|
1301
|
+
else if (e.key === "Home") next = startOfMonth(props.source.date);
|
|
1302
|
+
else if (e.key === "End") next = endOfMonth(props.source.date);
|
|
969
1303
|
else return;
|
|
970
1304
|
e.preventDefault();
|
|
971
|
-
if (!isSameMonth(next, props.date)) return;
|
|
1305
|
+
if (!isSameMonth(next, props.source.date)) return;
|
|
972
1306
|
setFocusedDate(next);
|
|
973
1307
|
const key = format(next, "yyyy-MM-dd");
|
|
974
1308
|
gridRef.current?.querySelector(`[data-day="${key}"]`)?.focus();
|
|
@@ -983,7 +1317,7 @@ function MonthView(incoming) {
|
|
|
983
1317
|
fontWeight: 700,
|
|
984
1318
|
padding: "10px 14px 6px"
|
|
985
1319
|
} }), true);
|
|
986
|
-
insert(_el$7, scope(() =>
|
|
1320
|
+
insert(_el$7, scope(() => _grid().title));
|
|
987
1321
|
runHydrationEvents();
|
|
988
1322
|
return _el$7;
|
|
989
1323
|
})() : null;
|
|
@@ -995,7 +1329,7 @@ function MonthView(incoming) {
|
|
|
995
1329
|
spread(_el$8, () => slot("weekdays", {
|
|
996
1330
|
base: {
|
|
997
1331
|
display: "grid",
|
|
998
|
-
gridTemplateColumns:
|
|
1332
|
+
gridTemplateColumns: `repeat(${_grid().weekdays.length}, minmax(0, 1fr))`
|
|
999
1333
|
},
|
|
1000
1334
|
themed: {
|
|
1001
1335
|
borderBottom: `1px solid ${theme().gridLine}`,
|
|
@@ -1026,13 +1360,20 @@ function MonthView(incoming) {
|
|
|
1026
1360
|
})()), _el$6, _co$2);
|
|
1027
1361
|
spread(_el$2, [{
|
|
1028
1362
|
"role": "grid",
|
|
1363
|
+
get tabindex() {
|
|
1364
|
+
return multiWeek() ? -1 : void 0;
|
|
1365
|
+
},
|
|
1029
1366
|
get "aria-label"() {
|
|
1030
|
-
return
|
|
1367
|
+
return _grid().title;
|
|
1031
1368
|
},
|
|
1032
1369
|
get onKeyDown() {
|
|
1033
1370
|
return dayRoving() ? onKeyDown : void 0;
|
|
1034
1371
|
}
|
|
1035
|
-
}, () => slot("grid"
|
|
1372
|
+
}, () => slot("grid", multiWeek() ? { base: {
|
|
1373
|
+
flex: "1 1 auto",
|
|
1374
|
+
minHeight: 0,
|
|
1375
|
+
overflowY: "auto"
|
|
1376
|
+
} } : void 0)], true);
|
|
1036
1377
|
ref(() => (el) => gridRef.current = el, _el$2);
|
|
1037
1378
|
insert(_el$2, scope(() => createComponent(For, {
|
|
1038
1379
|
get each() {
|
|
@@ -1047,9 +1388,9 @@ function MonthView(incoming) {
|
|
|
1047
1388
|
const columns = createMemo(() => {
|
|
1048
1389
|
let first = 0;
|
|
1049
1390
|
let last = cols() - 1;
|
|
1050
|
-
if (eventsMode() && !
|
|
1051
|
-
const start = week().days.findIndex((d) => d
|
|
1052
|
-
const end = [...week().days].reverse().findIndex((d) => d
|
|
1391
|
+
if (eventsMode() && !showAdjacentMonths()) {
|
|
1392
|
+
const start = week().days.findIndex((d) => !isOutsidePeriod(d));
|
|
1393
|
+
const end = [...week().days].reverse().findIndex((d) => !isOutsidePeriod(d));
|
|
1053
1394
|
if (start !== -1) {
|
|
1054
1395
|
first = start;
|
|
1055
1396
|
last = cols() - 1 - end;
|
|
@@ -1060,6 +1401,12 @@ function MonthView(incoming) {
|
|
|
1060
1401
|
last
|
|
1061
1402
|
};
|
|
1062
1403
|
});
|
|
1404
|
+
const draftColumns = createMemo(() => {
|
|
1405
|
+
const range = createRange();
|
|
1406
|
+
return range ? week().days.flatMap((day, index) => !showAdjacentMonths() && isOutsidePeriod(day) || day.date < range.start || day.date >= range.end ? [] : [index]) : [];
|
|
1407
|
+
});
|
|
1408
|
+
const draftTop = createMemo(() => 28 + props.chipGap + Math.min(visibleLanes(), Math.max(0, props.maxVisibleEventCount - 1)) * (props.chipHeight + props.chipGap));
|
|
1409
|
+
const draftHeight = createMemo(() => Math.min(props.chipHeight, Math.max(0, eventRowHeight() - draftTop())));
|
|
1063
1410
|
return memo(() => {
|
|
1064
1411
|
const barSegs = createMemo(() => rowLayout().segments.filter((s) => s.lane < visibleLanes()).map((s) => {
|
|
1065
1412
|
const startCol = Math.max(s.startCol, columns().first);
|
|
@@ -1077,7 +1424,7 @@ function MonthView(incoming) {
|
|
|
1077
1424
|
var _el$0 = getNextElement(_tmpl$2$6);
|
|
1078
1425
|
spread(_el$0, [{ "role": "row" }, () => slot("week", { base: {
|
|
1079
1426
|
display: "grid",
|
|
1080
|
-
gridTemplateColumns:
|
|
1427
|
+
gridTemplateColumns: `repeat(${cols()}, minmax(0, 1fr))`
|
|
1081
1428
|
} })], true);
|
|
1082
1429
|
insert(_el$0, scope(() => createComponent(For, {
|
|
1083
1430
|
get each() {
|
|
@@ -1085,7 +1432,7 @@ function MonthView(incoming) {
|
|
|
1085
1432
|
},
|
|
1086
1433
|
keyed: false,
|
|
1087
1434
|
children: (day, dayCol) => {
|
|
1088
|
-
const hidden = createMemo(() => !
|
|
1435
|
+
const hidden = createMemo(() => !showAdjacentMonths() && isOutsidePeriod(day()));
|
|
1089
1436
|
const cellHeight = createMemo(() => eventsMode() ? eventRowHeight() : theme().cellHeight);
|
|
1090
1437
|
return memo(() => {
|
|
1091
1438
|
if (hidden()) {
|
|
@@ -1116,7 +1463,7 @@ function MonthView(incoming) {
|
|
|
1116
1463
|
"data-selected": day().isSelected,
|
|
1117
1464
|
"data-range": day().isInRange,
|
|
1118
1465
|
"data-weekend": day().isWeekend,
|
|
1119
|
-
"data-outside":
|
|
1466
|
+
"data-outside": isOutsidePeriod(day()),
|
|
1120
1467
|
"data-disabled": day().isDisabled,
|
|
1121
1468
|
"data-creating": inCreate(),
|
|
1122
1469
|
"data-drop": isDropTarget()
|
|
@@ -1126,7 +1473,7 @@ function MonthView(incoming) {
|
|
|
1126
1473
|
const hiddenEvents = createMemo(() => rowLayout().segments.filter((s) => s.startCol <= dayCol && s.endCol >= dayCol && s.lane >= visibleLanes()).map((s) => s.event));
|
|
1127
1474
|
const dayLabel = createMemo(() => format(day().date, "d MMMM", props.locale ? { locale: props.locale } : void 0));
|
|
1128
1475
|
const dayCellProps = createMemo(() => slot("day", eventCellDefault(day(), theme(), cellHeight(), props.highlightWeekends, inCreate() || isDropTarget(), props.chipGap)));
|
|
1129
|
-
var _el$10 = getNextElement(_tmpl$5$4), _el$
|
|
1476
|
+
var _el$10 = getNextElement(_tmpl$5$4), _el$20 = _el$10.firstChild, [_el$21, _co$6] = getNextMarker(_el$20.nextSibling), _el$11 = _el$21.nextSibling, _el$22 = _el$11.nextSibling, [_el$23, _co$7] = getNextMarker(_el$22.nextSibling), _el$24 = _el$23.nextSibling, [_el$25, _co$8] = getNextMarker(_el$24.nextSibling), _el$13 = _el$25.nextSibling, _el$14 = _el$13.firstChild, [_el$15, _co$3] = getNextMarker(_el$14.nextSibling), _el$16 = _el$15.nextSibling, [_el$17, _co$4] = getNextMarker(_el$16.nextSibling), _el$18 = _el$17.nextSibling, [_el$19, _co$5] = getNextMarker(_el$18.nextSibling);
|
|
1130
1477
|
spread(_el$10, [
|
|
1131
1478
|
{
|
|
1132
1479
|
"role": "gridcell",
|
|
@@ -1134,7 +1481,18 @@ function MonthView(incoming) {
|
|
|
1134
1481
|
return day().id;
|
|
1135
1482
|
},
|
|
1136
1483
|
"onFocusIn": (event) => {
|
|
1137
|
-
if (event.target === event.currentTarget)
|
|
1484
|
+
if (event.target === event.currentTarget) {
|
|
1485
|
+
lastDayFocus.current = event.currentTarget;
|
|
1486
|
+
setFocusedDate(day().date);
|
|
1487
|
+
}
|
|
1488
|
+
},
|
|
1489
|
+
"onFocusOut": (event) => {
|
|
1490
|
+
if (event.target !== event.currentTarget) return;
|
|
1491
|
+
const previous = event.currentTarget;
|
|
1492
|
+
if (event.relatedTarget) lastDayFocus.current = null;
|
|
1493
|
+
else queueMicrotask(() => {
|
|
1494
|
+
if (lastDayFocus.current === previous && previous.isConnected) lastDayFocus.current = null;
|
|
1495
|
+
});
|
|
1138
1496
|
}
|
|
1139
1497
|
},
|
|
1140
1498
|
dayData,
|
|
@@ -1160,22 +1518,22 @@ function MonthView(incoming) {
|
|
|
1160
1518
|
get style() {
|
|
1161
1519
|
return css(dragWired() ? {
|
|
1162
1520
|
...dayCellProps().style,
|
|
1163
|
-
touchAction: "none",
|
|
1521
|
+
touchAction: multiWeek() ? "pan-y" : "none",
|
|
1164
1522
|
userSelect: "none"
|
|
1165
1523
|
} : dayCellProps().style);
|
|
1166
1524
|
},
|
|
1167
1525
|
get onPointerDown() {
|
|
1168
1526
|
return dragWired() && !day().isDisabled ? (e) => {
|
|
1169
|
-
|
|
1170
|
-
|
|
1527
|
+
const date = day().date;
|
|
1528
|
+
pressRow(e, date);
|
|
1171
1529
|
} : void 0;
|
|
1172
1530
|
},
|
|
1173
1531
|
get onPointerEnter() {
|
|
1174
1532
|
return dragWired() && !day().isDisabled ? (e) => extendDrag(day().date, e.pointerId) : void 0;
|
|
1175
1533
|
},
|
|
1176
1534
|
get onClick() {
|
|
1177
|
-
return day().isDisabled ? void 0 : () => {
|
|
1178
|
-
if (consumeSuppressedClick()) return;
|
|
1535
|
+
return day().isDisabled ? void 0 : (e) => {
|
|
1536
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1179
1537
|
props.onPressDay?.(day().date);
|
|
1180
1538
|
props.onPressCell?.(startOfDay(day().date));
|
|
1181
1539
|
};
|
|
@@ -1197,17 +1555,61 @@ function MonthView(incoming) {
|
|
|
1197
1555
|
return band();
|
|
1198
1556
|
},
|
|
1199
1557
|
children: (band) => (() => {
|
|
1200
|
-
var _el$
|
|
1201
|
-
spread(_el$
|
|
1558
|
+
var _el$26 = getNextElement(_tmpl$3$5);
|
|
1559
|
+
spread(_el$26, [{
|
|
1202
1560
|
"data-band": true,
|
|
1203
1561
|
"aria-hidden": "true"
|
|
1204
1562
|
}, () => slot("rangeBand", band())], false);
|
|
1205
1563
|
runHydrationEvents();
|
|
1206
|
-
return _el$
|
|
1564
|
+
return _el$26;
|
|
1207
1565
|
})()
|
|
1208
|
-
})), _el$
|
|
1566
|
+
})), _el$21, _co$6);
|
|
1209
1567
|
spread(_el$11, [dayData, () => slot("dayBadge", compactBadgeDefault(day(), theme()))], true);
|
|
1210
1568
|
insert(_el$11, scope(() => day().label));
|
|
1569
|
+
insert(_el$10, createComponent(Show, {
|
|
1570
|
+
get when() {
|
|
1571
|
+
return memo(() => !!(props.renderCreateGhost && createRange() && draftColumns()[0] === dayCol))() ? draftHeight() > 0 : props.renderCreateGhost && createRange() && draftColumns()[0] === dayCol;
|
|
1572
|
+
},
|
|
1573
|
+
get children() {
|
|
1574
|
+
var _el$12 = getNextElement(_tmpl$2$6);
|
|
1575
|
+
spread(_el$12, [() => slot("createGhost", {
|
|
1576
|
+
base: {
|
|
1577
|
+
position: "absolute",
|
|
1578
|
+
left: 2,
|
|
1579
|
+
width: `calc(${(draftColumns().at(-1) - dayCol + 1) * 100}% - 4px)`,
|
|
1580
|
+
top: draftTop(),
|
|
1581
|
+
height: draftHeight(),
|
|
1582
|
+
boxSizing: "border-box",
|
|
1583
|
+
pointerEvents: "none",
|
|
1584
|
+
overflow: "hidden",
|
|
1585
|
+
zIndex: 3
|
|
1586
|
+
},
|
|
1587
|
+
themed: {
|
|
1588
|
+
background: theme().rangeBackground,
|
|
1589
|
+
border: `1px solid ${theme().selectedBackground}`,
|
|
1590
|
+
borderRadius: 4,
|
|
1591
|
+
fontSize: 12,
|
|
1592
|
+
color: theme().text
|
|
1593
|
+
}
|
|
1594
|
+
}), {
|
|
1595
|
+
"inert": true,
|
|
1596
|
+
"aria-hidden": "true"
|
|
1597
|
+
}], true);
|
|
1598
|
+
insert(_el$12, createComponent(Dynamic, {
|
|
1599
|
+
get component() {
|
|
1600
|
+
return props.renderCreateGhost;
|
|
1601
|
+
},
|
|
1602
|
+
get start() {
|
|
1603
|
+
return createRange().start;
|
|
1604
|
+
},
|
|
1605
|
+
get end() {
|
|
1606
|
+
return createRange().end;
|
|
1607
|
+
}
|
|
1608
|
+
}));
|
|
1609
|
+
runHydrationEvents();
|
|
1610
|
+
return _el$12;
|
|
1611
|
+
}
|
|
1612
|
+
}), _el$23, _co$7);
|
|
1211
1613
|
insert(_el$10, scope(() => createComponent(For, {
|
|
1212
1614
|
get each() {
|
|
1213
1615
|
return barSegs().filter((b) => b.startCol === dayCol);
|
|
@@ -1217,22 +1619,23 @@ function MonthView(incoming) {
|
|
|
1217
1619
|
const span = createMemo(() => b().endCol - b().startCol + 1);
|
|
1218
1620
|
const isDragged = createMemo(() => {
|
|
1219
1621
|
const currentDrag = drag();
|
|
1220
|
-
return currentDrag?.kind === "move" && currentDrag.event === b().seg.event;
|
|
1622
|
+
return currentDrag?.armed === true && currentDrag.kind === "move" && currentDrag.event === b().seg.event;
|
|
1221
1623
|
});
|
|
1222
|
-
var _el$
|
|
1223
|
-
spread(_el$
|
|
1624
|
+
var _el$27 = getNextElement(_tmpl$6$4);
|
|
1625
|
+
spread(_el$27, [
|
|
1224
1626
|
{
|
|
1225
1627
|
"type": "button",
|
|
1226
1628
|
get onPointerDown() {
|
|
1227
1629
|
return canMove(b().seg.event) ? (e) => {
|
|
1228
|
-
if (e.button !== 0 || !beginPress(e)) return;
|
|
1229
1630
|
e.stopPropagation();
|
|
1230
|
-
|
|
1631
|
+
const event = b().seg.event;
|
|
1632
|
+
const date = day().date;
|
|
1633
|
+
pressRow(e, date, event);
|
|
1231
1634
|
} : void 0;
|
|
1232
1635
|
},
|
|
1233
1636
|
"onClick": (e) => {
|
|
1234
1637
|
e.stopPropagation();
|
|
1235
|
-
if (consumeSuppressedClick()) return;
|
|
1638
|
+
if (consumeSuppressedClick(e.detail)) return;
|
|
1236
1639
|
props.onPressEvent?.(b().seg.event);
|
|
1237
1640
|
}
|
|
1238
1641
|
},
|
|
@@ -1243,7 +1646,7 @@ function MonthView(incoming) {
|
|
|
1243
1646
|
},
|
|
1244
1647
|
get "aria-label"() {
|
|
1245
1648
|
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(b().seg.event, {
|
|
1246
|
-
mode:
|
|
1649
|
+
mode: viewMode(),
|
|
1247
1650
|
isAllDay: isAllDayEvent$1(b().seg.event),
|
|
1248
1651
|
ampm: false
|
|
1249
1652
|
}) : `${b().seg.event.title}, ${dayLabel()}`;
|
|
@@ -1256,28 +1659,31 @@ function MonthView(incoming) {
|
|
|
1256
1659
|
width: `calc(${span() * 100}% - 4px)`,
|
|
1257
1660
|
top: 28 + props.chipGap + b().seg.lane * (props.chipHeight + props.chipGap),
|
|
1258
1661
|
height: props.chipHeight,
|
|
1259
|
-
pointerEvents:
|
|
1662
|
+
pointerEvents: dragArmed() ? "none" : "auto",
|
|
1260
1663
|
opacity: isDragged() ? DRAGGED_CHIP_OPACITY : void 0,
|
|
1261
1664
|
cursor: canMove(b().seg.event) ? "grab" : void 0,
|
|
1262
|
-
touchAction: dragWired() ? "none" : void 0,
|
|
1665
|
+
touchAction: dragWired() ? multiWeek() ? "pan-y" : "none" : void 0,
|
|
1263
1666
|
zIndex: 2
|
|
1264
1667
|
});
|
|
1265
1668
|
}
|
|
1266
1669
|
}
|
|
1267
1670
|
], true);
|
|
1268
|
-
insert(_el$
|
|
1671
|
+
insert(_el$27, scope((() => {
|
|
1269
1672
|
var _c$5 = memo(() => !!Chip());
|
|
1270
1673
|
return () => _c$5() ? createComponent(Dynamic, {
|
|
1271
1674
|
get component() {
|
|
1272
1675
|
return Chip();
|
|
1273
1676
|
},
|
|
1677
|
+
get mode() {
|
|
1678
|
+
return viewMode();
|
|
1679
|
+
},
|
|
1274
1680
|
get event() {
|
|
1275
1681
|
return b().seg.event;
|
|
1276
1682
|
},
|
|
1277
1683
|
onPress: () => props.onPressEvent?.(b().seg.event)
|
|
1278
1684
|
}) : (() => {
|
|
1279
|
-
var _el$
|
|
1280
|
-
spread(_el$
|
|
1685
|
+
var _el$28 = getNextElement(_tmpl$3$5);
|
|
1686
|
+
spread(_el$28, [barChip, { get style() {
|
|
1281
1687
|
return css({
|
|
1282
1688
|
...barChip().style,
|
|
1283
1689
|
...b().continuesBefore ? {
|
|
@@ -1290,32 +1696,32 @@ function MonthView(incoming) {
|
|
|
1290
1696
|
} : null
|
|
1291
1697
|
});
|
|
1292
1698
|
} }], true);
|
|
1293
|
-
insert(_el$
|
|
1699
|
+
insert(_el$28, scope(() => b().seg.event.title));
|
|
1294
1700
|
runHydrationEvents();
|
|
1295
|
-
return _el$
|
|
1701
|
+
return _el$28;
|
|
1296
1702
|
})();
|
|
1297
1703
|
})()));
|
|
1298
1704
|
runHydrationEvents();
|
|
1299
|
-
return _el$
|
|
1705
|
+
return _el$27;
|
|
1300
1706
|
}
|
|
1301
|
-
})), _el$
|
|
1302
|
-
spread(_el$
|
|
1707
|
+
})), _el$25, _co$8);
|
|
1708
|
+
spread(_el$13, () => slot("events", { base: {
|
|
1303
1709
|
display: "flex",
|
|
1304
1710
|
flexDirection: "column",
|
|
1305
1711
|
gap: props.chipGap
|
|
1306
1712
|
} }), true);
|
|
1307
|
-
insert(_el$
|
|
1308
|
-
var _el$
|
|
1713
|
+
insert(_el$13, scope(() => Array.from({ length: visibleLanes() }, () => (() => {
|
|
1714
|
+
var _el$29 = getNextElement(_tmpl$7$2);
|
|
1309
1715
|
effect(() => readShallow(css({ height: props.chipHeight })), (_v$, _$p) => {
|
|
1310
|
-
style(_el$
|
|
1716
|
+
style(_el$29, _v$, _$p);
|
|
1311
1717
|
});
|
|
1312
|
-
return _el$
|
|
1313
|
-
})())), _el$
|
|
1314
|
-
insert(_el$
|
|
1718
|
+
return _el$29;
|
|
1719
|
+
})())), _el$15, _co$3);
|
|
1720
|
+
insert(_el$13, scope((() => {
|
|
1315
1721
|
var _c$3 = memo(() => hiddenEvents().length > 0);
|
|
1316
1722
|
return () => _c$3() ? (() => {
|
|
1317
|
-
var _el$
|
|
1318
|
-
spread(_el$
|
|
1723
|
+
var _el$30 = getNextElement(_tmpl$6$4);
|
|
1724
|
+
spread(_el$30, [
|
|
1319
1725
|
{
|
|
1320
1726
|
"type": "button",
|
|
1321
1727
|
get onPointerDown() {
|
|
@@ -1330,7 +1736,7 @@ function MonthView(incoming) {
|
|
|
1330
1736
|
}
|
|
1331
1737
|
}
|
|
1332
1738
|
},
|
|
1333
|
-
() => slot("more", moreButtonDefault(theme(), props.chipHeight)),
|
|
1739
|
+
() => slot("more", moreButtonDefault(theme(), props.chipHeight, multiWeek())),
|
|
1334
1740
|
{
|
|
1335
1741
|
get "aria-label"() {
|
|
1336
1742
|
return `${labels().moreEvents(hiddenEvents().length)}, ${dayLabel()}`;
|
|
@@ -1340,16 +1746,16 @@ function MonthView(incoming) {
|
|
|
1340
1746
|
}
|
|
1341
1747
|
}
|
|
1342
1748
|
], true);
|
|
1343
|
-
insert(_el$
|
|
1749
|
+
insert(_el$30, scope(() => props.moreLabel.replace("{moreCount}", String(hiddenEvents().length))));
|
|
1344
1750
|
runHydrationEvents();
|
|
1345
|
-
return _el$
|
|
1751
|
+
return _el$30;
|
|
1346
1752
|
})() : null;
|
|
1347
|
-
})()), _el$
|
|
1348
|
-
insert(_el$
|
|
1753
|
+
})()), _el$17, _co$4);
|
|
1754
|
+
insert(_el$13, scope((() => {
|
|
1349
1755
|
var _c$4 = memo(() => moreOpenFor() === day().id);
|
|
1350
1756
|
return () => _c$4() ? (() => {
|
|
1351
|
-
var _el$
|
|
1352
|
-
spread(_el$
|
|
1757
|
+
var _el$31 = getNextElement(_tmpl$8$2), _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling, [_el$34, _co$9] = getNextMarker(_el$33.nextSibling);
|
|
1758
|
+
spread(_el$31, [{
|
|
1353
1759
|
"role": "dialog",
|
|
1354
1760
|
get "aria-label"() {
|
|
1355
1761
|
return dayLabel();
|
|
@@ -1390,35 +1796,38 @@ function MonthView(incoming) {
|
|
|
1390
1796
|
boxShadow: "0 4px 16px rgba(0,0,0,0.12)"
|
|
1391
1797
|
}
|
|
1392
1798
|
})], true);
|
|
1393
|
-
ref(() => (el) => morePopoverRef.current = el, _el$
|
|
1394
|
-
insert(_el$
|
|
1395
|
-
insert(_el$
|
|
1799
|
+
ref(() => (el) => morePopoverRef.current = el, _el$31);
|
|
1800
|
+
insert(_el$32, scope(() => dayLabel()));
|
|
1801
|
+
insert(_el$31, scope(() => createComponent(For, {
|
|
1396
1802
|
get each() {
|
|
1397
1803
|
return dayEvents();
|
|
1398
1804
|
},
|
|
1399
1805
|
keyed: false,
|
|
1400
1806
|
children: (event) => {
|
|
1401
|
-
var _el$
|
|
1402
|
-
_el$
|
|
1807
|
+
var _el$35 = getNextElement(_tmpl$9$1);
|
|
1808
|
+
_el$35._$$click = () => {
|
|
1403
1809
|
setMoreOpenFor(null);
|
|
1404
1810
|
props.onPressEvent?.(event());
|
|
1405
1811
|
};
|
|
1406
|
-
insert(_el$
|
|
1812
|
+
insert(_el$35, scope((() => {
|
|
1407
1813
|
var _c$6 = memo(() => !!Chip());
|
|
1408
1814
|
return () => _c$6() ? createComponent(Dynamic, {
|
|
1409
1815
|
get component() {
|
|
1410
1816
|
return Chip();
|
|
1411
1817
|
},
|
|
1818
|
+
get mode() {
|
|
1819
|
+
return viewMode();
|
|
1820
|
+
},
|
|
1412
1821
|
get event() {
|
|
1413
1822
|
return event();
|
|
1414
1823
|
},
|
|
1415
1824
|
onPress: () => props.onPressEvent?.(event())
|
|
1416
1825
|
}) : (() => {
|
|
1417
|
-
var _el$
|
|
1418
|
-
spread(_el$
|
|
1419
|
-
insert(_el$
|
|
1826
|
+
var _el$36 = getNextElement(_tmpl$3$5);
|
|
1827
|
+
spread(_el$36, () => slot("chip", chipDefault(theme(), props.chipHeight)), true);
|
|
1828
|
+
insert(_el$36, scope(() => event().title));
|
|
1420
1829
|
runHydrationEvents();
|
|
1421
|
-
return _el$
|
|
1830
|
+
return _el$36;
|
|
1422
1831
|
})();
|
|
1423
1832
|
})()));
|
|
1424
1833
|
effect(() => readShallow(css({
|
|
@@ -1431,28 +1840,28 @@ function MonthView(incoming) {
|
|
|
1431
1840
|
textAlign: "left",
|
|
1432
1841
|
cursor: "pointer"
|
|
1433
1842
|
})), (_v$, _$p) => {
|
|
1434
|
-
style(_el$
|
|
1843
|
+
style(_el$35, _v$, _$p);
|
|
1435
1844
|
});
|
|
1436
1845
|
runHydrationEvents();
|
|
1437
|
-
return _el$
|
|
1846
|
+
return _el$35;
|
|
1438
1847
|
}
|
|
1439
|
-
})), _el$
|
|
1848
|
+
})), _el$34, _co$9);
|
|
1440
1849
|
effect(() => readShallow(css({
|
|
1441
1850
|
fontSize: 11,
|
|
1442
1851
|
fontWeight: 600,
|
|
1443
1852
|
color: theme().textMuted
|
|
1444
1853
|
})), (_v$, _$p) => {
|
|
1445
|
-
style(_el$
|
|
1854
|
+
style(_el$32, _v$, _$p);
|
|
1446
1855
|
});
|
|
1447
1856
|
runHydrationEvents();
|
|
1448
|
-
return _el$
|
|
1857
|
+
return _el$31;
|
|
1449
1858
|
})() : null;
|
|
1450
|
-
})()), _el$
|
|
1859
|
+
})()), _el$19, _co$5);
|
|
1451
1860
|
runHydrationEvents();
|
|
1452
1861
|
return _el$10;
|
|
1453
1862
|
}
|
|
1454
|
-
var _el$
|
|
1455
|
-
spread(_el$
|
|
1863
|
+
var _el$37 = getNextElement(_tmpl$0$1), _el$39 = _el$37.firstChild, [_el$40, _co$0] = getNextMarker(_el$39.nextSibling), _el$38 = _el$40.nextSibling;
|
|
1864
|
+
spread(_el$37, [
|
|
1456
1865
|
{
|
|
1457
1866
|
"type": "button",
|
|
1458
1867
|
"role": "gridcell",
|
|
@@ -1460,7 +1869,10 @@ function MonthView(incoming) {
|
|
|
1460
1869
|
return day().id;
|
|
1461
1870
|
},
|
|
1462
1871
|
"onFocusIn": (event) => {
|
|
1463
|
-
if (event.target === event.currentTarget)
|
|
1872
|
+
if (event.target === event.currentTarget) {
|
|
1873
|
+
lastDayFocus.current = event.currentTarget;
|
|
1874
|
+
setFocusedDate(day().date);
|
|
1875
|
+
}
|
|
1464
1876
|
}
|
|
1465
1877
|
},
|
|
1466
1878
|
dayData,
|
|
@@ -1492,24 +1904,24 @@ function MonthView(incoming) {
|
|
|
1492
1904
|
"onMouseLeave": () => setHoveredKey((k) => k === day().id ? null : k)
|
|
1493
1905
|
}
|
|
1494
1906
|
], true);
|
|
1495
|
-
insert(_el$
|
|
1907
|
+
insert(_el$37, scope(() => createComponent(Show, {
|
|
1496
1908
|
get when() {
|
|
1497
1909
|
return band();
|
|
1498
1910
|
},
|
|
1499
1911
|
children: (band) => (() => {
|
|
1500
|
-
var _el$
|
|
1501
|
-
spread(_el$
|
|
1912
|
+
var _el$41 = getNextElement(_tmpl$3$5);
|
|
1913
|
+
spread(_el$41, [{
|
|
1502
1914
|
"data-band": true,
|
|
1503
1915
|
"aria-hidden": "true"
|
|
1504
1916
|
}, () => slot("rangeBand", band())], false);
|
|
1505
1917
|
runHydrationEvents();
|
|
1506
|
-
return _el$
|
|
1918
|
+
return _el$41;
|
|
1507
1919
|
})()
|
|
1508
|
-
})), _el$
|
|
1509
|
-
spread(_el$
|
|
1510
|
-
insert(_el$
|
|
1920
|
+
})), _el$40, _co$0);
|
|
1921
|
+
spread(_el$38, [dayData, () => slot("dayBadge", badgeDefault(day(), theme(), hoveredKey() === day().id))], true);
|
|
1922
|
+
insert(_el$38, scope(() => day().label));
|
|
1511
1923
|
runHydrationEvents();
|
|
1512
|
-
return _el$
|
|
1924
|
+
return _el$37;
|
|
1513
1925
|
});
|
|
1514
1926
|
}
|
|
1515
1927
|
})));
|
|
@@ -1523,6 +1935,11 @@ function MonthView(incoming) {
|
|
|
1523
1935
|
t: readShallow(css({
|
|
1524
1936
|
fontFamily: theme().fontFamily,
|
|
1525
1937
|
color: theme().text,
|
|
1938
|
+
...multiWeek() ? {
|
|
1939
|
+
display: "flex",
|
|
1940
|
+
flexDirection: "column",
|
|
1941
|
+
minHeight: 0
|
|
1942
|
+
} : null,
|
|
1526
1943
|
...props.style
|
|
1527
1944
|
}))
|
|
1528
1945
|
}), ({ e, t }, _p$) => {
|
|
@@ -1533,6 +1950,37 @@ function MonthView(incoming) {
|
|
|
1533
1950
|
return _el$;
|
|
1534
1951
|
}
|
|
1535
1952
|
delegateEvents(["click"]);
|
|
1953
|
+
// src/MultiWeekView.tsx
|
|
1954
|
+
/** Props for {@link MultiWeekView}. */
|
|
1955
|
+
/**
|
|
1956
|
+
* Consecutive full weeks as stacked seven-day rows, with event chips and no hour
|
|
1957
|
+
* slots. It has the month grid's event bars, overflow, selection, and drag
|
|
1958
|
+
* interactions, and the month slots, `renderEvent`, and theme style it. Every
|
|
1959
|
+
* row is kept at full height; when the view is given less room, the rows scroll
|
|
1960
|
+
* under the title and weekday header.
|
|
1961
|
+
*
|
|
1962
|
+
* Standalone, it shows `events` as given; expand recurring events first with
|
|
1963
|
+
* `expandRecurringEvents`, or use `Calendar` with `mode="multiweek"`.
|
|
1964
|
+
*
|
|
1965
|
+
* @example
|
|
1966
|
+
* ```tsx
|
|
1967
|
+
* <MultiWeekView date={new Date()} numberOfWeeks={3} events={events} />
|
|
1968
|
+
* ```
|
|
1969
|
+
*/
|
|
1970
|
+
function MultiWeekView(props) {
|
|
1971
|
+
return createComponent(DateRows, mergeProps(props, {
|
|
1972
|
+
get chipHeight() {
|
|
1973
|
+
return props.chipHeight ?? 24;
|
|
1974
|
+
},
|
|
1975
|
+
get source() {
|
|
1976
|
+
return {
|
|
1977
|
+
kind: "multiweek",
|
|
1978
|
+
date: props.date,
|
|
1979
|
+
numberOfWeeks: props.numberOfWeeks ?? 2
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
}));
|
|
1983
|
+
}
|
|
1536
1984
|
// src/EventActions.tsx
|
|
1537
1985
|
var _tmpl$$6 = /*#__PURE__*/ template(`<div><button></button><!$><!/>`);
|
|
1538
1986
|
var _tmpl$2$5 = /*#__PURE__*/ template(`<div>`);
|
|
@@ -1979,54 +2427,17 @@ function createDateRange(options = () => ({})) {
|
|
|
1979
2427
|
function createMonthGrid(month, options = () => ({})) {
|
|
1980
2428
|
return createMemo(() => buildMonthGrid$1(month(), options()));
|
|
1981
2429
|
}
|
|
1982
|
-
// src/touch.ts
|
|
1983
|
-
function waitForHold(grab, delay, threshold, onHold, onTap, onCancel) {
|
|
1984
|
-
const detach = () => {
|
|
1985
|
-
clearTimeout(timer);
|
|
1986
|
-
document.removeEventListener("pointermove", move);
|
|
1987
|
-
document.removeEventListener("pointerup", up);
|
|
1988
|
-
document.removeEventListener("pointercancel", cancelPointer);
|
|
1989
|
-
document.removeEventListener("pointerdown", anotherPointer);
|
|
1990
|
-
};
|
|
1991
|
-
const cancel = () => {
|
|
1992
|
-
detach();
|
|
1993
|
-
onCancel();
|
|
1994
|
-
};
|
|
1995
|
-
const move = (event) => {
|
|
1996
|
-
if (event.pointerId === grab.pointerId && Math.hypot(event.clientX - grab.clientX, event.clientY - grab.clientY) > threshold) cancel();
|
|
1997
|
-
};
|
|
1998
|
-
const up = (event) => {
|
|
1999
|
-
if (event.pointerId === grab.pointerId) {
|
|
2000
|
-
detach();
|
|
2001
|
-
onTap();
|
|
2002
|
-
}
|
|
2003
|
-
};
|
|
2004
|
-
const cancelPointer = (event) => {
|
|
2005
|
-
if (event.pointerId === grab.pointerId) cancel();
|
|
2006
|
-
};
|
|
2007
|
-
const anotherPointer = (event) => {
|
|
2008
|
-
if (event.pointerId !== grab.pointerId) cancel();
|
|
2009
|
-
};
|
|
2010
|
-
const timer = setTimeout(() => {
|
|
2011
|
-
detach();
|
|
2012
|
-
onHold();
|
|
2013
|
-
}, delay);
|
|
2014
|
-
document.addEventListener("pointermove", move);
|
|
2015
|
-
document.addEventListener("pointerup", up);
|
|
2016
|
-
document.addEventListener("pointercancel", cancelPointer);
|
|
2017
|
-
document.addEventListener("pointerdown", anotherPointer);
|
|
2018
|
-
return cancel;
|
|
2019
|
-
}
|
|
2020
2430
|
// src/TimeGrid.tsx
|
|
2021
2431
|
var _tmpl$$5 = /*#__PURE__*/ template(`<div><div></div><!$><!/>`);
|
|
2022
2432
|
var _tmpl$2$4 = /*#__PURE__*/ template(`<div>`);
|
|
2023
2433
|
var _tmpl$3$3 = /*#__PURE__*/ template(`<div tabindex=-1><!$><!/><div><div></div><!$><!/></div><!$><!/><div><div><!$><!/><!$><!/></div></div><!$><!/><!$><!/>`);
|
|
2024
2434
|
var _tmpl$4$2 = /*#__PURE__*/ template(`<span>`);
|
|
2025
2435
|
var _tmpl$5$2 = /*#__PURE__*/ template(`<button>`);
|
|
2026
|
-
var _tmpl$6$2 = /*#__PURE__*/ template(`<div
|
|
2027
|
-
var _tmpl$7$1 = /*#__PURE__*/ template(`<div
|
|
2028
|
-
var _tmpl$8$1 = /*#__PURE__*/ template(`<div
|
|
2029
|
-
var _tmpl$9 = /*#__PURE__*/ template(`<div
|
|
2436
|
+
var _tmpl$6$2 = /*#__PURE__*/ template(`<div><div></div><div>`);
|
|
2437
|
+
var _tmpl$7$1 = /*#__PURE__*/ template(`<div><button>`);
|
|
2438
|
+
var _tmpl$8$1 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><div></div><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`);
|
|
2439
|
+
var _tmpl$9 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><!$><!/>`);
|
|
2440
|
+
var _tmpl$0 = /*#__PURE__*/ template(`<div aria-hidden=true>`);
|
|
2030
2441
|
/**
|
|
2031
2442
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
2032
2443
|
* the `classNames` / `styles` props.
|
|
@@ -2051,6 +2462,11 @@ function createPreviewPlacement(topPx, heightPx, gridHeight) {
|
|
|
2051
2462
|
height
|
|
2052
2463
|
};
|
|
2053
2464
|
}
|
|
2465
|
+
function createRangePlacement(range, day, hourHeight, minHour, gridHeight, minEventHeight) {
|
|
2466
|
+
const at = (time) => (differenceInCalendarDays(time, day) * 24 + time.getHours() + time.getMinutes() / 60 - minHour) * hourHeight;
|
|
2467
|
+
const top = at(range.start);
|
|
2468
|
+
return createPreviewPlacement(top, Math.max(minEventHeight, at(range.end) - top), gridHeight);
|
|
2469
|
+
}
|
|
2054
2470
|
const EDGE_ZONE = 32;
|
|
2055
2471
|
const EDGE_DWELL_MS = 600;
|
|
2056
2472
|
const EDGE_REPEAT_MS = 600;
|
|
@@ -2077,6 +2493,20 @@ function movedSegmentStart(origin, base, startHours) {
|
|
|
2077
2493
|
const dayMinutes = differenceInCalendarDays(base, origin.base) * HOURS_PER_DAY * 60;
|
|
2078
2494
|
return shiftMinutes(origin.segmentStart, dayMinutes + Math.round((startHours - origin.startHours) * 60));
|
|
2079
2495
|
}
|
|
2496
|
+
function draggedEventBounds(d, origin, event, base, snapMinutes) {
|
|
2497
|
+
if (d.kind === "resize") {
|
|
2498
|
+
const endDelta = Math.round((d.startHours + d.durationHours - origin.startHours - origin.durationHours) * 60);
|
|
2499
|
+
return resolveDraggedBounds(event.start, event.end, 0, endDelta, snapMinutes);
|
|
2500
|
+
}
|
|
2501
|
+
const startShift = movedSegmentStart(origin, base, d.kind === "move" ? d.requestedStartHours : d.startHours).getTime() - origin.segmentStart.getTime();
|
|
2502
|
+
const endShift = d.kind === "move" ? startShift : 0;
|
|
2503
|
+
const start = new Date(event.start.getTime() + startShift);
|
|
2504
|
+
const end = new Date(event.end.getTime() + endShift);
|
|
2505
|
+
return end > start || d.kind === "move" && end.getTime() === start.getTime() ? {
|
|
2506
|
+
start,
|
|
2507
|
+
end
|
|
2508
|
+
} : null;
|
|
2509
|
+
}
|
|
2080
2510
|
function DefaultDomEvent(incoming) {
|
|
2081
2511
|
const props = withDefaults({ ampm: false }, incoming);
|
|
2082
2512
|
const timeLabel = createMemo(() => eventTimeLabel({
|
|
@@ -2253,9 +2683,15 @@ function TimeGrid(incoming) {
|
|
|
2253
2683
|
window.addEventListener("scroll", onScroll, true);
|
|
2254
2684
|
return () => window.removeEventListener("scroll", onScroll, true);
|
|
2255
2685
|
});
|
|
2686
|
+
const detachCreateListeners = { current: null };
|
|
2256
2687
|
const cellTouchRef = { current: null };
|
|
2257
2688
|
const cellEnabled = createMemo(() => !!props.onPressCell || !!props.onCreateEvent);
|
|
2258
2689
|
const days = createMemo(() => getViewDays$1(props.mode, props.date, props.weekStartsOn, props.numberOfDays, false, void 0, props.hiddenDays));
|
|
2690
|
+
const todayKey = createMemo(() => {
|
|
2691
|
+
if (props.showNowIndicator) return startOfDay(now()).getTime();
|
|
2692
|
+
days();
|
|
2693
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
2694
|
+
});
|
|
2259
2695
|
const edgeAdvanceEnabled = createMemo(() => !!props.onChangeDate && !!props.onDragEvent);
|
|
2260
2696
|
const columnsRef = { current: null };
|
|
2261
2697
|
const edgeTimer = { current: null };
|
|
@@ -2306,6 +2742,11 @@ function TimeGrid(incoming) {
|
|
|
2306
2742
|
canResize: editable && (event.durationEditable ?? props.eventDurationEditable)
|
|
2307
2743
|
};
|
|
2308
2744
|
};
|
|
2745
|
+
const hasEditActions = (event) => {
|
|
2746
|
+
if (isAllDayEvent$1(event) || isBackgroundEvent$1(event)) return false;
|
|
2747
|
+
const { canMove, canResize } = editability(event);
|
|
2748
|
+
return canMove || canResize;
|
|
2749
|
+
};
|
|
2309
2750
|
const eventLabel = (event) => props.eventAccessibilityLabel ? props.eventAccessibilityLabel(event, {
|
|
2310
2751
|
mode: props.mode,
|
|
2311
2752
|
isAllDay: false,
|
|
@@ -2319,7 +2760,7 @@ function TimeGrid(incoming) {
|
|
|
2319
2760
|
labels: labels()
|
|
2320
2761
|
});
|
|
2321
2762
|
const eventDescription = (event) => `${describeEventDates(event)}, ${eventLabel(event)}`;
|
|
2322
|
-
const pageDays = () => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays);
|
|
2763
|
+
const pageDays = createMemo(() => pageStepDays(props.mode, props.date, props.weekStartsOn, props.numberOfDays));
|
|
2323
2764
|
const actionDelta = (id) => {
|
|
2324
2765
|
const step = snapMinutes();
|
|
2325
2766
|
const page = pageDays() * HOURS_PER_DAY * 60;
|
|
@@ -2334,7 +2775,7 @@ function TimeGrid(incoming) {
|
|
|
2334
2775
|
}
|
|
2335
2776
|
};
|
|
2336
2777
|
const editActions = (event) => {
|
|
2337
|
-
if (
|
|
2778
|
+
if (!hasEditActions(event)) return [];
|
|
2338
2779
|
const { canMove, canResize } = editability(event);
|
|
2339
2780
|
const step = snapMinutes();
|
|
2340
2781
|
const words = labels();
|
|
@@ -2358,12 +2799,27 @@ function TimeGrid(incoming) {
|
|
|
2358
2799
|
if (!next || onDragEventRef.current?.(event, next.start, next.end) === false) return null;
|
|
2359
2800
|
return (candidate) => candidate !== event && candidate.start.getTime() === next.start.getTime() && candidate.end.getTime() === next.end.getTime() && candidate.title === event.title;
|
|
2360
2801
|
}, () => props.getEventId);
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2802
|
+
const allDayLayout = createMemo(() => layoutMonthWeek$1(days(), props.events.filter((event) => isAllDayEvent$1(event) && !isBackgroundEvent$1(event) && days().some((day) => event.start < addDays(startOfDay(day), 1) && event.end > startOfDay(day)))));
|
|
2803
|
+
const hasAllDay = createMemo(() => allDayLayout().segments.length > 0);
|
|
2804
|
+
const allDaySpans = createMemo(() => {
|
|
2805
|
+
const keys = /* @__PURE__ */ new Map();
|
|
2806
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2807
|
+
for (const { event } of allDayLayout().segments) {
|
|
2808
|
+
const id = props.getEventId?.(event);
|
|
2809
|
+
if (typeof id !== "string" && typeof id !== "number") continue;
|
|
2810
|
+
const key = `${typeof id}:${id}`;
|
|
2811
|
+
const previous = seen.get(key);
|
|
2812
|
+
if (previous) keys.delete(previous);
|
|
2813
|
+
else {
|
|
2814
|
+
seen.set(key, event);
|
|
2815
|
+
keys.set(event, key);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
return allDayLayout().segments.map((segment) => ({
|
|
2819
|
+
...segment,
|
|
2820
|
+
key: keys.get(segment.event) ?? segment.event
|
|
2821
|
+
}));
|
|
2822
|
+
});
|
|
2367
2823
|
createEffect(() => [props.scrollOffsetMinutes, windowStart()], () => untrack(() => {
|
|
2368
2824
|
if (scrollRef.current) scrollRef.current.scrollTop = Math.max(0, (props.scrollOffsetMinutes / 60 - windowStart()) * hourHeightRef.current);
|
|
2369
2825
|
}));
|
|
@@ -2469,6 +2925,8 @@ function TimeGrid(incoming) {
|
|
|
2469
2925
|
document.removeEventListener("pointermove", h.move);
|
|
2470
2926
|
document.removeEventListener("pointerup", h.up);
|
|
2471
2927
|
document.removeEventListener("pointercancel", h.cancel);
|
|
2928
|
+
document.removeEventListener("selectstart", h.preventNative, true);
|
|
2929
|
+
document.removeEventListener("dragstart", h.preventNative, true);
|
|
2472
2930
|
docHandlersRef.current = null;
|
|
2473
2931
|
};
|
|
2474
2932
|
const finishDrag = () => {
|
|
@@ -2576,18 +3034,14 @@ function TimeGrid(incoming) {
|
|
|
2576
3034
|
base = day ? startOfDay(day) : null;
|
|
2577
3035
|
} else base = startOfDay(daysRef.current[originIndex + d.dayDelta] ?? daysRef.current[originIndex]);
|
|
2578
3036
|
} else base = startOfDay(daysRef.current[originIndex] ?? daysRef.current[0]);
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
const start = new Date(held.event.start.getTime() + startShift);
|
|
2587
|
-
const end = new Date(held.event.end.getTime() + endShift);
|
|
2588
|
-
if (end > start) onDragEventRef.current?.(held.event, start, end);
|
|
3037
|
+
try {
|
|
3038
|
+
if (base && held && origin) {
|
|
3039
|
+
const next = draggedEventBounds(d, origin, held.event, base, snapMinutes());
|
|
3040
|
+
if (next) onDragEventRef.current?.(held.event, next.start, next.end);
|
|
3041
|
+
}
|
|
3042
|
+
} finally {
|
|
3043
|
+
finishDrag();
|
|
2589
3044
|
}
|
|
2590
|
-
finishDrag();
|
|
2591
3045
|
};
|
|
2592
3046
|
const cancelDrag = () => {
|
|
2593
3047
|
finishDrag();
|
|
@@ -2601,7 +3055,8 @@ function TimeGrid(incoming) {
|
|
|
2601
3055
|
activeGrabRef.current = e;
|
|
2602
3056
|
const boxEl = e.box;
|
|
2603
3057
|
const column = kind === "move" ? boxEl.parentElement : null;
|
|
2604
|
-
const
|
|
3058
|
+
const columnRect = column ? column.getBoundingClientRect() : null;
|
|
3059
|
+
const dayWidth = columnRect ? columnRect.width : 0;
|
|
2605
3060
|
const boxRect = kind === "move" ? boxEl.getBoundingClientRect() : null;
|
|
2606
3061
|
const originBase = startOfDay(days()[dayIndex] ?? days()[0]);
|
|
2607
3062
|
const originNextDay = addDays(originBase, 1);
|
|
@@ -2621,9 +3076,9 @@ function TimeGrid(incoming) {
|
|
|
2621
3076
|
draggedRef.current = {
|
|
2622
3077
|
event,
|
|
2623
3078
|
onPress: onPress ?? (() => {}),
|
|
2624
|
-
grabX:
|
|
3079
|
+
grabX: column && columnRect ? e.clientX - columnRect.left - column.clientLeft - props.eventGap : 0,
|
|
2625
3080
|
grabY: boxRect ? e.clientY - boxRect.top : 0,
|
|
2626
|
-
w:
|
|
3081
|
+
w: column ? Math.max(column.clientWidth - props.eventGap * 2, 0) : 0,
|
|
2627
3082
|
h: boxRect ? boxRect.height : 0
|
|
2628
3083
|
};
|
|
2629
3084
|
ptr.current = {
|
|
@@ -2659,12 +3114,15 @@ function TimeGrid(incoming) {
|
|
|
2659
3114
|
},
|
|
2660
3115
|
cancel: (event) => {
|
|
2661
3116
|
if (event.pointerId === e.pointerId) cancelDrag();
|
|
2662
|
-
}
|
|
3117
|
+
},
|
|
3118
|
+
preventNative: (event) => event.preventDefault()
|
|
2663
3119
|
};
|
|
2664
3120
|
docHandlersRef.current = handlers;
|
|
2665
3121
|
document.addEventListener("pointermove", handlers.move);
|
|
2666
3122
|
document.addEventListener("pointerup", handlers.up);
|
|
2667
3123
|
document.addEventListener("pointercancel", handlers.cancel);
|
|
3124
|
+
document.addEventListener("selectstart", handlers.preventNative, true);
|
|
3125
|
+
document.addEventListener("dragstart", handlers.preventNative, true);
|
|
2668
3126
|
};
|
|
2669
3127
|
const pressEvent = (e, pe, key, kind, dayIndex, onPress) => {
|
|
2670
3128
|
if (!props.onDragEvent || e.button > 0 || createOrigin.current) return;
|
|
@@ -2698,6 +3156,10 @@ function TimeGrid(incoming) {
|
|
|
2698
3156
|
cancelHoldRef.current?.();
|
|
2699
3157
|
detachDocListeners();
|
|
2700
3158
|
clearEdgeTimer();
|
|
3159
|
+
if (createOrigin.current?.captureLoss !== void 0) clearTimeout(createOrigin.current.captureLoss);
|
|
3160
|
+
createOrigin.current = null;
|
|
3161
|
+
detachCreateListeners.current?.();
|
|
3162
|
+
detachCreateListeners.current = null;
|
|
2701
3163
|
}));
|
|
2702
3164
|
createEffect(() => [
|
|
2703
3165
|
props.date,
|
|
@@ -2736,6 +3198,26 @@ function TimeGrid(incoming) {
|
|
|
2736
3198
|
startPx,
|
|
2737
3199
|
curPx: startPx
|
|
2738
3200
|
});
|
|
3201
|
+
const document = el.ownerDocument;
|
|
3202
|
+
const cancel = (event) => {
|
|
3203
|
+
if (createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3204
|
+
};
|
|
3205
|
+
const restart = (event) => {
|
|
3206
|
+
if (event.isPrimary && event.pointerType !== "touch" || createOrigin.current?.pointerId === event.pointerId) clearCreate();
|
|
3207
|
+
};
|
|
3208
|
+
const preventSelection = (event) => event.preventDefault();
|
|
3209
|
+
document.addEventListener("pointerup", endCreate, true);
|
|
3210
|
+
document.addEventListener("pointercancel", cancel, true);
|
|
3211
|
+
document.addEventListener("pointerdown", restart, true);
|
|
3212
|
+
document.addEventListener("selectstart", preventSelection, true);
|
|
3213
|
+
document.addEventListener("dragstart", preventSelection, true);
|
|
3214
|
+
detachCreateListeners.current = () => {
|
|
3215
|
+
document.removeEventListener("pointerup", endCreate, true);
|
|
3216
|
+
document.removeEventListener("pointercancel", cancel, true);
|
|
3217
|
+
document.removeEventListener("pointerdown", restart, true);
|
|
3218
|
+
document.removeEventListener("selectstart", preventSelection, true);
|
|
3219
|
+
document.removeEventListener("dragstart", preventSelection, true);
|
|
3220
|
+
};
|
|
2739
3221
|
};
|
|
2740
3222
|
const moveCreate = (e) => {
|
|
2741
3223
|
const touch = cellTouchRef.current;
|
|
@@ -2753,9 +3235,8 @@ function TimeGrid(incoming) {
|
|
|
2753
3235
|
const endCreate = (e) => {
|
|
2754
3236
|
const o = createOrigin.current;
|
|
2755
3237
|
if (!o || o.pointerId !== e.pointerId) return;
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
} catch {}
|
|
3238
|
+
clearCreate();
|
|
3239
|
+
if (!o.el.isConnected || !cellEnabled() || o.creating && !props.onCreateEvent || days()[o.dayIndex]?.getTime() !== o.dayTime) return;
|
|
2759
3240
|
const endPx = pxFromTop(o.el, e.clientY);
|
|
2760
3241
|
const day = days()[o.dayIndex];
|
|
2761
3242
|
const moved = Math.abs(endPx - o.startPx) > 4;
|
|
@@ -2767,8 +3248,6 @@ function TimeGrid(incoming) {
|
|
|
2767
3248
|
const at = cellRangeFromDrag(day, o.startPx, o.startPx, h, windowStart(), snapMinutes());
|
|
2768
3249
|
if (at) props.onPressCell(at.start);
|
|
2769
3250
|
}
|
|
2770
|
-
createOrigin.current = null;
|
|
2771
|
-
setCreateBox(null);
|
|
2772
3251
|
};
|
|
2773
3252
|
const tapCell = (e, dayIndex) => {
|
|
2774
3253
|
const touch = cellTouchRef.current;
|
|
@@ -2782,6 +3261,9 @@ function TimeGrid(incoming) {
|
|
|
2782
3261
|
const clearCreate = () => {
|
|
2783
3262
|
const previous = createOrigin.current;
|
|
2784
3263
|
createOrigin.current = null;
|
|
3264
|
+
if (previous?.captureLoss !== void 0) clearTimeout(previous.captureLoss);
|
|
3265
|
+
detachCreateListeners.current?.();
|
|
3266
|
+
detachCreateListeners.current = null;
|
|
2785
3267
|
setCreateBox(null);
|
|
2786
3268
|
try {
|
|
2787
3269
|
previous?.el.releasePointerCapture?.(previous.pointerId);
|
|
@@ -2801,8 +3283,12 @@ function TimeGrid(incoming) {
|
|
|
2801
3283
|
clearCreate();
|
|
2802
3284
|
};
|
|
2803
3285
|
const loseCreateCapture = (e) => {
|
|
2804
|
-
|
|
2805
|
-
|
|
3286
|
+
const origin = createOrigin.current;
|
|
3287
|
+
if (!origin || origin.pointerId !== e.pointerId) return;
|
|
3288
|
+
if (origin.captureLoss !== void 0) clearTimeout(origin.captureLoss);
|
|
3289
|
+
origin.captureLoss = setTimeout(() => {
|
|
3290
|
+
if (createOrigin.current === origin) clearCreate();
|
|
3291
|
+
}, 0);
|
|
2806
3292
|
};
|
|
2807
3293
|
createEffect(() => [], () => {
|
|
2808
3294
|
const onKeyDown = (event) => {
|
|
@@ -2824,11 +3310,15 @@ function TimeGrid(incoming) {
|
|
|
2824
3310
|
return event.start.getTime() === currentHeldEvent.start.getTime() && event.end.getTime() === currentHeldEvent.end.getTime() && event.title === currentHeldEvent.title;
|
|
2825
3311
|
}) ?? currentHeldEvent);
|
|
2826
3312
|
});
|
|
3313
|
+
const multiDayHeld = createMemo(() => {
|
|
3314
|
+
const currentDrag = drag();
|
|
3315
|
+
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && !!movingEvent();
|
|
3316
|
+
});
|
|
2827
3317
|
const multiDayMove = createMemo(() => {
|
|
2828
3318
|
const currentDrag = drag();
|
|
2829
3319
|
const currentMoveOrigin = moveOrigin();
|
|
2830
3320
|
const currentMovingEvent = movingEvent();
|
|
2831
|
-
return !paged() && currentDrag?.kind === "move" && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
3321
|
+
return !paged() && currentDrag?.kind === "move" && currentDrag.moved && (currentDrag.continuesBefore || currentDrag.continuesAfter) && currentMoveOrigin && currentMovingEvent ? (() => {
|
|
2832
3322
|
const target = days()[currentMoveOrigin.dayIndex + currentDrag.dayDelta];
|
|
2833
3323
|
const shift = movedSegmentStart(currentMoveOrigin, startOfDay(target), currentDrag.requestedStartHours).getTime() - currentMoveOrigin.segmentStart.getTime();
|
|
2834
3324
|
return {
|
|
@@ -2839,13 +3329,31 @@ function TimeGrid(incoming) {
|
|
|
2839
3329
|
};
|
|
2840
3330
|
})() : null;
|
|
2841
3331
|
});
|
|
3332
|
+
const liveBounds = createMemo(() => {
|
|
3333
|
+
const currentDrag = drag();
|
|
3334
|
+
const origin = moveOrigin();
|
|
3335
|
+
const held = draggedRef.current;
|
|
3336
|
+
if (paged() || !currentDrag?.moved || multiDayMove() || !origin || !held) return null;
|
|
3337
|
+
const visibleDays = days();
|
|
3338
|
+
const target = origin.dayIndex + (currentDrag.kind === "move" ? currentDrag.dayDelta : 0);
|
|
3339
|
+
const base = startOfDay(visibleDays[target] ?? visibleDays[origin.dayIndex]);
|
|
3340
|
+
return draggedEventBounds(currentDrag, origin, held.event, base, snapMinutes());
|
|
3341
|
+
});
|
|
3342
|
+
const withLiveBounds = (event) => {
|
|
3343
|
+
const bounds = liveBounds();
|
|
3344
|
+
return bounds ? {
|
|
3345
|
+
...event,
|
|
3346
|
+
start: bounds.start,
|
|
3347
|
+
end: bounds.end
|
|
3348
|
+
} : event;
|
|
3349
|
+
};
|
|
2842
3350
|
const spillPreviewFor = (dayIndex) => {
|
|
2843
3351
|
const currentDrag = drag();
|
|
2844
3352
|
if (paged() || !currentDrag || currentDrag.kind !== "move" || currentDrag.spillDayIndex !== dayIndex) return null;
|
|
2845
3353
|
const dragged = draggedRef.current?.event;
|
|
2846
3354
|
if (!dragged) return null;
|
|
2847
3355
|
return {
|
|
2848
|
-
event: dragged,
|
|
3356
|
+
event: withLiveBounds(dragged),
|
|
2849
3357
|
mode: props.mode,
|
|
2850
3358
|
isAllDay: false,
|
|
2851
3359
|
boxHeight: Math.max(currentDrag.spillHours * hourHeight(), props.minEventHeight),
|
|
@@ -2938,7 +3446,7 @@ function TimeGrid(incoming) {
|
|
|
2938
3446
|
ref(() => (el) => eventActions.rootRef.current = el, _el$6);
|
|
2939
3447
|
insert(_el$6, createComponent(EventActionsMenu, {
|
|
2940
3448
|
get events() {
|
|
2941
|
-
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(
|
|
3449
|
+
return [...new Set(positionedByDay().flat().filter((pe) => pe.startHours < windowEnd() && pe.startHours + pe.durationHours > windowStart()).map((pe) => pe.event))].filter(hasEditActions);
|
|
2942
3450
|
},
|
|
2943
3451
|
get label() {
|
|
2944
3452
|
return labels().editEvents;
|
|
@@ -2984,7 +3492,7 @@ function TimeGrid(incoming) {
|
|
|
2984
3492
|
},
|
|
2985
3493
|
keyed: false,
|
|
2986
3494
|
children: (day) => {
|
|
2987
|
-
const today = createMemo(() => getIsToday(day()));
|
|
3495
|
+
const today = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
2988
3496
|
const dateLabel = createMemo(() => format(day(), "EEEE, d MMMM yyyy", dfns()));
|
|
2989
3497
|
const headerProps = createMemo(() => slot("columnHeader", {
|
|
2990
3498
|
base: {
|
|
@@ -3077,7 +3585,7 @@ function TimeGrid(incoming) {
|
|
|
3077
3585
|
insert(_el$6, scope((() => {
|
|
3078
3586
|
var _c$3 = memo(() => !!(props.showAllDayEventCell && hasAllDay()));
|
|
3079
3587
|
return () => _c$3() ? (() => {
|
|
3080
|
-
var _el$28 = getNextElement(_tmpl
|
|
3588
|
+
var _el$28 = getNextElement(_tmpl$6$2), _el$29 = _el$28.firstChild, _el$30 = _el$29.nextSibling;
|
|
3081
3589
|
spread(_el$28, () => slot("allDayLane", {
|
|
3082
3590
|
base: { display: "flex" },
|
|
3083
3591
|
themed: { borderBottom: `1px solid ${theme().gridLine}` }
|
|
@@ -3086,6 +3594,7 @@ function TimeGrid(incoming) {
|
|
|
3086
3594
|
base: {
|
|
3087
3595
|
width: gutterWidth(),
|
|
3088
3596
|
flex: "none",
|
|
3597
|
+
boxSizing: "border-box",
|
|
3089
3598
|
minWidth: 0,
|
|
3090
3599
|
overflow: "hidden",
|
|
3091
3600
|
textAlign: "right"
|
|
@@ -3093,93 +3602,90 @@ function TimeGrid(incoming) {
|
|
|
3093
3602
|
themed: {
|
|
3094
3603
|
fontSize: 10,
|
|
3095
3604
|
color: theme().textMuted,
|
|
3096
|
-
padding: "4px 6px 0 0"
|
|
3605
|
+
padding: props.hideHours ? 0 : "4px 6px 0 0"
|
|
3097
3606
|
}
|
|
3098
3607
|
}), true);
|
|
3099
3608
|
insert(_el$29, scope((() => {
|
|
3100
3609
|
var _c$7 = memo(() => !!props.showAllDayLabel);
|
|
3101
3610
|
return () => _c$7() ? labels().allDay : null;
|
|
3102
3611
|
})()));
|
|
3103
|
-
insert(_el$
|
|
3612
|
+
insert(_el$30, createComponent(For, {
|
|
3104
3613
|
get each() {
|
|
3105
|
-
return
|
|
3614
|
+
return allDaySpans();
|
|
3106
3615
|
},
|
|
3107
|
-
keyed:
|
|
3108
|
-
children: (
|
|
3109
|
-
const
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3616
|
+
keyed: (segment) => segment.key,
|
|
3617
|
+
children: (segment) => {
|
|
3618
|
+
const args = createMemo(() => ({
|
|
3619
|
+
event: segment().event,
|
|
3620
|
+
mode: props.mode,
|
|
3621
|
+
isAllDay: true,
|
|
3622
|
+
continuesBefore: segment().continuesBefore,
|
|
3623
|
+
continuesAfter: segment().continuesAfter,
|
|
3624
|
+
ampm: props.ampm,
|
|
3625
|
+
onPress: () => props.onPressEvent?.(segment().event)
|
|
3626
|
+
}));
|
|
3627
|
+
var _el$31 = getNextElement(_tmpl$7$1), _el$32 = _el$31.firstChild;
|
|
3628
|
+
spread(_el$31, () => slot("allDayColumn", { base: {
|
|
3629
|
+
gridColumn: `${segment().startCol + 1} / span ${segment().endCol - segment().startCol + 1}`,
|
|
3630
|
+
gridRow: segment().lane + 1,
|
|
3114
3631
|
minWidth: 0,
|
|
3115
3632
|
borderLeft: "1px solid transparent",
|
|
3116
|
-
padding: "
|
|
3633
|
+
padding: "0 1px",
|
|
3117
3634
|
display: "flex",
|
|
3118
|
-
flexDirection: "column"
|
|
3119
|
-
gap: 2
|
|
3635
|
+
flexDirection: "column"
|
|
3120
3636
|
} }), true);
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
children: (event) => {
|
|
3127
|
-
const args = createMemo(() => ({
|
|
3128
|
-
event: event(),
|
|
3637
|
+
spread(_el$32, [{
|
|
3638
|
+
"type": "button",
|
|
3639
|
+
"onClick": () => props.onPressEvent?.(segment().event),
|
|
3640
|
+
get "aria-label"() {
|
|
3641
|
+
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(segment().event, {
|
|
3129
3642
|
mode: props.mode,
|
|
3130
3643
|
isAllDay: true,
|
|
3131
|
-
|
|
3132
|
-
|
|
3644
|
+
ampm: props.ampm
|
|
3645
|
+
}) : eventAccessibilityLabel({
|
|
3646
|
+
title: segment().event.title,
|
|
3647
|
+
isAllDay: true,
|
|
3648
|
+
start: segment().event.start,
|
|
3649
|
+
end: segment().event.end,
|
|
3133
3650
|
ampm: props.ampm,
|
|
3134
|
-
|
|
3135
|
-
})
|
|
3136
|
-
var _el$33 = getNextElement(_tmpl$5$2);
|
|
3137
|
-
spread(_el$33, [{
|
|
3138
|
-
"type": "button",
|
|
3139
|
-
"onClick": () => props.onPressEvent?.(event()),
|
|
3140
|
-
get "aria-label"() {
|
|
3141
|
-
return props.eventAccessibilityLabel ? props.eventAccessibilityLabel(event(), {
|
|
3142
|
-
mode: props.mode,
|
|
3143
|
-
isAllDay: true,
|
|
3144
|
-
ampm: props.ampm
|
|
3145
|
-
}) : eventAccessibilityLabel({
|
|
3146
|
-
title: event().title,
|
|
3147
|
-
isAllDay: true,
|
|
3148
|
-
start: event().start,
|
|
3149
|
-
end: event().end,
|
|
3150
|
-
ampm: props.ampm,
|
|
3151
|
-
labels: labels()
|
|
3152
|
-
});
|
|
3153
|
-
}
|
|
3154
|
-
}, () => slot("allDayEvent", { base: {
|
|
3155
|
-
border: "none",
|
|
3156
|
-
padding: 0,
|
|
3157
|
-
background: "transparent",
|
|
3158
|
-
cursor: "pointer",
|
|
3159
|
-
textAlign: "left",
|
|
3160
|
-
height: 22
|
|
3161
|
-
} })], true);
|
|
3162
|
-
insert(_el$33, scope((() => {
|
|
3163
|
-
var _c$8 = memo(() => !!Renderer());
|
|
3164
|
-
return () => _c$8() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3165
|
-
return Renderer();
|
|
3166
|
-
} }, args)) : createComponent(DefaultDomEvent, mergeProps(args, {
|
|
3167
|
-
get theme() {
|
|
3168
|
-
return theme();
|
|
3169
|
-
},
|
|
3170
|
-
get boxProps() {
|
|
3171
|
-
return slot("eventBox");
|
|
3172
|
-
}
|
|
3173
|
-
}));
|
|
3174
|
-
})()));
|
|
3175
|
-
runHydrationEvents();
|
|
3176
|
-
return _el$33;
|
|
3651
|
+
labels: labels()
|
|
3652
|
+
});
|
|
3177
3653
|
}
|
|
3178
|
-
})
|
|
3654
|
+
}, () => slot("allDayEvent", { base: {
|
|
3655
|
+
border: "none",
|
|
3656
|
+
padding: 0,
|
|
3657
|
+
background: "transparent",
|
|
3658
|
+
cursor: "pointer",
|
|
3659
|
+
textAlign: "left",
|
|
3660
|
+
height: 22
|
|
3661
|
+
} })], true);
|
|
3662
|
+
insert(_el$32, scope((() => {
|
|
3663
|
+
var _c$8 = memo(() => !!Renderer());
|
|
3664
|
+
return () => _c$8() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3665
|
+
return Renderer();
|
|
3666
|
+
} }, args)) : createComponent(DefaultDomEvent, mergeProps(args, {
|
|
3667
|
+
get theme() {
|
|
3668
|
+
return theme();
|
|
3669
|
+
},
|
|
3670
|
+
get boxProps() {
|
|
3671
|
+
return slot("eventBox");
|
|
3672
|
+
}
|
|
3673
|
+
}));
|
|
3674
|
+
})()));
|
|
3179
3675
|
runHydrationEvents();
|
|
3180
|
-
return _el$
|
|
3676
|
+
return _el$31;
|
|
3181
3677
|
}
|
|
3182
|
-
}))
|
|
3678
|
+
}));
|
|
3679
|
+
effect(() => readShallow(css({
|
|
3680
|
+
flex: 1,
|
|
3681
|
+
minWidth: 0,
|
|
3682
|
+
display: "grid",
|
|
3683
|
+
gridTemplateColumns: `repeat(${days().length}, minmax(0, 1fr))`,
|
|
3684
|
+
gap: "2px 0",
|
|
3685
|
+
padding: "2px 0"
|
|
3686
|
+
})), (_v$, _$p) => {
|
|
3687
|
+
style(_el$30, _v$, _$p);
|
|
3688
|
+
});
|
|
3183
3689
|
runHydrationEvents();
|
|
3184
3690
|
return _el$28;
|
|
3185
3691
|
})() : null;
|
|
@@ -3193,20 +3699,20 @@ function TimeGrid(incoming) {
|
|
|
3193
3699
|
insert(_el$10, scope((() => {
|
|
3194
3700
|
var _c$4 = memo(() => !!props.hideHours);
|
|
3195
3701
|
return () => _c$4() ? null : (() => {
|
|
3196
|
-
var _el$
|
|
3197
|
-
spread(_el$
|
|
3702
|
+
var _el$33 = getNextElement(_tmpl$2$4);
|
|
3703
|
+
spread(_el$33, () => slot("hourGutter", { base: {
|
|
3198
3704
|
width: gutterWidth(),
|
|
3199
3705
|
flex: "none",
|
|
3200
3706
|
position: "relative"
|
|
3201
3707
|
} }), true);
|
|
3202
|
-
insert(_el$
|
|
3708
|
+
insert(_el$33, scope(() => createComponent(For, {
|
|
3203
3709
|
get each() {
|
|
3204
3710
|
return visibleHours();
|
|
3205
3711
|
},
|
|
3206
3712
|
keyed: false,
|
|
3207
3713
|
children: (h) => (() => {
|
|
3208
|
-
var _el$
|
|
3209
|
-
spread(_el$
|
|
3714
|
+
var _el$34 = getNextElement(_tmpl$2$4);
|
|
3715
|
+
spread(_el$34, () => slot("hourLabel", {
|
|
3210
3716
|
base: {
|
|
3211
3717
|
position: "absolute",
|
|
3212
3718
|
top: Math.max(0, (h() - windowStart()) * hourHeight() - 6),
|
|
@@ -3217,16 +3723,16 @@ function TimeGrid(incoming) {
|
|
|
3217
3723
|
color: theme().textMuted
|
|
3218
3724
|
}
|
|
3219
3725
|
}), true);
|
|
3220
|
-
insert(_el$
|
|
3726
|
+
insert(_el$34, scope((() => {
|
|
3221
3727
|
var _c$9 = memo(() => !!props.hourComponent);
|
|
3222
3728
|
return () => _c$9() ? props.hourComponent(h(), props.ampm) : memo(() => h() === 0)() ? "" : formatHour(h(), { ampm: props.ampm });
|
|
3223
3729
|
})()));
|
|
3224
3730
|
runHydrationEvents();
|
|
3225
|
-
return _el$
|
|
3731
|
+
return _el$34;
|
|
3226
3732
|
})()
|
|
3227
3733
|
})));
|
|
3228
3734
|
runHydrationEvents();
|
|
3229
|
-
return _el$
|
|
3735
|
+
return _el$33;
|
|
3230
3736
|
})();
|
|
3231
3737
|
})()), _el$12, _co$3);
|
|
3232
3738
|
insert(_el$10, scope(() => createComponent(For, {
|
|
@@ -3244,17 +3750,24 @@ function TimeGrid(incoming) {
|
|
|
3244
3750
|
const currentCreateBox = createBox();
|
|
3245
3751
|
return currentCreateBox?.dayIndex === dayIndex && currentCreateBox.dayTime === day().getTime() ? currentCreateBox : null;
|
|
3246
3752
|
});
|
|
3247
|
-
const
|
|
3753
|
+
const createRange = createMemo(() => {
|
|
3248
3754
|
const currentGhost = ghost();
|
|
3249
|
-
return currentGhost && props.
|
|
3755
|
+
return currentGhost && props.onCreateEvent ? cellRangeFromDrag(day(), currentGhost.startPx, currentGhost.curPx, hourHeight(), windowStart(), snapMinutes()) : null;
|
|
3250
3756
|
}, { equals: sameRange$1 });
|
|
3757
|
+
const ghostRange = createMemo(() => props.renderCreateGhost ? createRange() : null);
|
|
3758
|
+
const previewPlacement = createMemo(() => {
|
|
3759
|
+
const range = createRange();
|
|
3760
|
+
if (range) return createRangePlacement(range, day(), hourHeight(), windowStart(), totalHeight(), props.minEventHeight ?? DEFAULT_MIN_EVENT_HEIGHT);
|
|
3761
|
+
const current = ghost();
|
|
3762
|
+
return current ? createPreviewPlacement(Math.min(current.startPx, current.curPx), Math.abs(current.curPx - current.startPx), totalHeight()) : {};
|
|
3763
|
+
});
|
|
3251
3764
|
const spill = createMemo(() => multiDayMove() ? null : spillPreviewFor(dayIndex));
|
|
3252
3765
|
const moveSegment = createMemo(() => {
|
|
3253
3766
|
const currentMultiDayMove = multiDayMove();
|
|
3254
3767
|
return currentMultiDayMove ? layoutDayEvents$1([currentMultiDayMove], day())[0] : void 0;
|
|
3255
3768
|
});
|
|
3256
|
-
var _el$
|
|
3257
|
-
spread(_el$
|
|
3769
|
+
var _el$35 = getNextElement(_tmpl$8$1), _el$37 = _el$35.firstChild, [_el$38, _co$9] = getNextMarker(_el$37.nextSibling), _el$39 = _el$38.nextSibling, [_el$40, _co$0] = getNextMarker(_el$39.nextSibling), _el$36 = _el$40.nextSibling, _el$41 = _el$36.nextSibling, [_el$42, _co$1] = getNextMarker(_el$41.nextSibling), _el$43 = _el$42.nextSibling, [_el$44, _co$10] = getNextMarker(_el$43.nextSibling), _el$45 = _el$44.nextSibling, [_el$46, _co$11] = getNextMarker(_el$45.nextSibling), _el$47 = _el$46.nextSibling, [_el$48, _co$12] = getNextMarker(_el$47.nextSibling), _el$49 = _el$48.nextSibling, [_el$50, _co$13] = getNextMarker(_el$49.nextSibling);
|
|
3770
|
+
spread(_el$35, [
|
|
3258
3771
|
{
|
|
3259
3772
|
get "data-date"() {
|
|
3260
3773
|
return day().toISOString();
|
|
@@ -3279,7 +3792,7 @@ function TimeGrid(incoming) {
|
|
|
3279
3792
|
}
|
|
3280
3793
|
},
|
|
3281
3794
|
() => dataState({
|
|
3282
|
-
"data-today": getIsToday(day()),
|
|
3795
|
+
"data-today": getIsToday(day(), new Date(todayKey())),
|
|
3283
3796
|
"data-weekend": isWeekend(day())
|
|
3284
3797
|
}),
|
|
3285
3798
|
() => slot("dayColumn", {
|
|
@@ -3293,14 +3806,14 @@ function TimeGrid(incoming) {
|
|
|
3293
3806
|
}
|
|
3294
3807
|
})
|
|
3295
3808
|
], true);
|
|
3296
|
-
insert(_el$
|
|
3809
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3297
3810
|
get each() {
|
|
3298
3811
|
return bands();
|
|
3299
3812
|
},
|
|
3300
3813
|
keyed: false,
|
|
3301
3814
|
children: (b) => (() => {
|
|
3302
|
-
var _el$
|
|
3303
|
-
spread(_el$
|
|
3815
|
+
var _el$51 = getNextElement(_tmpl$2$4);
|
|
3816
|
+
spread(_el$51, [{ "aria-hidden": "true" }, () => slot("businessHours", {
|
|
3304
3817
|
base: {
|
|
3305
3818
|
position: "absolute",
|
|
3306
3819
|
left: 0,
|
|
@@ -3312,16 +3825,16 @@ function TimeGrid(incoming) {
|
|
|
3312
3825
|
},
|
|
3313
3826
|
themed: props.renderBusinessHours ? void 0 : { background: theme().outsideHoursBackground }
|
|
3314
3827
|
})], true);
|
|
3315
|
-
insert(_el$
|
|
3828
|
+
insert(_el$51, scope(() => props.renderBusinessHours?.({
|
|
3316
3829
|
date: day(),
|
|
3317
3830
|
start: b().start,
|
|
3318
3831
|
end: b().end
|
|
3319
3832
|
})));
|
|
3320
3833
|
runHydrationEvents();
|
|
3321
|
-
return _el$
|
|
3834
|
+
return _el$51;
|
|
3322
3835
|
})()
|
|
3323
|
-
})), _el$
|
|
3324
|
-
insert(_el$
|
|
3836
|
+
})), _el$38, _co$9);
|
|
3837
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3325
3838
|
get each() {
|
|
3326
3839
|
return backgroundByDay()[dayIndex];
|
|
3327
3840
|
},
|
|
@@ -3338,8 +3851,8 @@ function TimeGrid(incoming) {
|
|
|
3338
3851
|
}));
|
|
3339
3852
|
return memo(() => {
|
|
3340
3853
|
if (!RenderBackground()) {
|
|
3341
|
-
var _el$
|
|
3342
|
-
spread(_el$
|
|
3854
|
+
var _el$52 = getNextElement(_tmpl$2$4);
|
|
3855
|
+
spread(_el$52, [{
|
|
3343
3856
|
"aria-hidden": "true",
|
|
3344
3857
|
get title() {
|
|
3345
3858
|
return b().event.title;
|
|
@@ -3352,15 +3865,15 @@ function TimeGrid(incoming) {
|
|
|
3352
3865
|
themed: { background: theme().backgroundEvent }
|
|
3353
3866
|
})], false);
|
|
3354
3867
|
runHydrationEvents();
|
|
3355
|
-
return _el$
|
|
3868
|
+
return _el$52;
|
|
3356
3869
|
}
|
|
3357
3870
|
const dayStart = createMemo(() => startOfDay(days()[dayIndex]));
|
|
3358
|
-
var _el$
|
|
3359
|
-
spread(_el$
|
|
3871
|
+
var _el$53 = getNextElement(_tmpl$2$4);
|
|
3872
|
+
spread(_el$53, () => slot("backgroundEvent", { base: {
|
|
3360
3873
|
...geometry(),
|
|
3361
3874
|
pointerEvents: "auto"
|
|
3362
3875
|
} }), true);
|
|
3363
|
-
insert(_el$
|
|
3876
|
+
insert(_el$53, createComponent(Dynamic, {
|
|
3364
3877
|
get component() {
|
|
3365
3878
|
return RenderBackground();
|
|
3366
3879
|
},
|
|
@@ -3386,11 +3899,11 @@ function TimeGrid(incoming) {
|
|
|
3386
3899
|
onPress: () => props.onPressEvent?.(b().event)
|
|
3387
3900
|
}));
|
|
3388
3901
|
runHydrationEvents();
|
|
3389
|
-
return _el$
|
|
3902
|
+
return _el$53;
|
|
3390
3903
|
});
|
|
3391
3904
|
}
|
|
3392
|
-
})), _el$
|
|
3393
|
-
spread(_el$
|
|
3905
|
+
})), _el$40, _co$0);
|
|
3906
|
+
spread(_el$36, [{ "aria-hidden": "true" }, () => slot("gridLines", {
|
|
3394
3907
|
base: {
|
|
3395
3908
|
position: "absolute",
|
|
3396
3909
|
inset: 0,
|
|
@@ -3399,7 +3912,7 @@ function TimeGrid(incoming) {
|
|
|
3399
3912
|
},
|
|
3400
3913
|
themed: { backgroundImage: gridLines() }
|
|
3401
3914
|
})], false);
|
|
3402
|
-
insert(_el$
|
|
3915
|
+
insert(_el$35, scope(() => createComponent(For, {
|
|
3403
3916
|
get each() {
|
|
3404
3917
|
return positioned();
|
|
3405
3918
|
},
|
|
@@ -3408,7 +3921,11 @@ function TimeGrid(incoming) {
|
|
|
3408
3921
|
const key = createMemo(() => `${dayIndex}:${idx}`);
|
|
3409
3922
|
const active = createMemo(() => {
|
|
3410
3923
|
const currentDrag = drag();
|
|
3411
|
-
return !paged() && currentDrag?.key === key() && (!
|
|
3924
|
+
return !paged() && currentDrag?.key === key() && (!multiDayHeld() || pe().event === movingEvent()) ? currentDrag : null;
|
|
3925
|
+
});
|
|
3926
|
+
const floating = createMemo(() => {
|
|
3927
|
+
const currentActive = active();
|
|
3928
|
+
return currentActive?.kind === "move" && currentActive.moved;
|
|
3412
3929
|
});
|
|
3413
3930
|
const hiddenForMove = createMemo(() => !!multiDayMove() && pe().event === movingEvent());
|
|
3414
3931
|
const startHours = createMemo(() => {
|
|
@@ -3427,7 +3944,7 @@ function TimeGrid(incoming) {
|
|
|
3427
3944
|
const widthPct = createMemo(() => 100 / pe().columns);
|
|
3428
3945
|
const onPress = () => props.onPressEvent?.(pe().event);
|
|
3429
3946
|
const args = createMemo(() => ({
|
|
3430
|
-
event: pe().event,
|
|
3947
|
+
event: active() ? withLiveBounds(pe().event) : pe().event,
|
|
3431
3948
|
mode: props.mode,
|
|
3432
3949
|
isAllDay: false,
|
|
3433
3950
|
boxHeight: boxHeight(),
|
|
@@ -3439,8 +3956,8 @@ function TimeGrid(incoming) {
|
|
|
3439
3956
|
const editable = createMemo(() => !!props.onDragEvent && pe().event.draggable !== false);
|
|
3440
3957
|
const canMove = createMemo(() => editable() && (pe().event.startEditable ?? props.eventStartEditable));
|
|
3441
3958
|
const canResize = createMemo(() => editable() && (pe().event.durationEditable ?? props.eventDurationEditable));
|
|
3442
|
-
var _el$
|
|
3443
|
-
spread(_el$
|
|
3959
|
+
var _el$54 = getNextElement(_tmpl$9), _el$55 = _el$54.firstChild, [_el$56, _co$14] = getNextMarker(_el$55.nextSibling), _el$57 = _el$56.nextSibling, [_el$58, _co$15] = getNextMarker(_el$57.nextSibling), _el$59 = _el$58.nextSibling, [_el$60, _co$16] = getNextMarker(_el$59.nextSibling);
|
|
3960
|
+
spread(_el$54, [
|
|
3444
3961
|
{
|
|
3445
3962
|
"role": "button",
|
|
3446
3963
|
"tabindex": 0,
|
|
@@ -3475,8 +3992,8 @@ function TimeGrid(incoming) {
|
|
|
3475
3992
|
position: "absolute",
|
|
3476
3993
|
top: top(),
|
|
3477
3994
|
height: boxHeight(),
|
|
3478
|
-
left: `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
3479
|
-
width: `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
3995
|
+
left: floating() ? props.eventGap : `calc(${pe().column * widthPct()}% + ${props.eventGap}px)`,
|
|
3996
|
+
width: floating() ? `calc(100% - ${props.eventGap * 2}px)` : `calc(${widthPct()}% - ${props.eventGap * 2}px)`,
|
|
3480
3997
|
cursor: canMove() ? "grab" : "pointer",
|
|
3481
3998
|
touchAction: canMove() ? "pan-y" : "auto",
|
|
3482
3999
|
userSelect: canMove() ? "none" : void 0,
|
|
@@ -3487,7 +4004,7 @@ function TimeGrid(incoming) {
|
|
|
3487
4004
|
...active() && active()?.dayOffsetPx !== 0 ? { transform: `translateX(${active()?.dayOffsetPx}px)` } : null
|
|
3488
4005
|
} })
|
|
3489
4006
|
], true);
|
|
3490
|
-
insert(_el$
|
|
4007
|
+
insert(_el$54, scope((() => {
|
|
3491
4008
|
var _c$1 = memo(() => !!Renderer());
|
|
3492
4009
|
return () => _c$1() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3493
4010
|
return Renderer();
|
|
@@ -3499,12 +4016,12 @@ function TimeGrid(incoming) {
|
|
|
3499
4016
|
return slot("eventBox");
|
|
3500
4017
|
}
|
|
3501
4018
|
}));
|
|
3502
|
-
})()), _el$
|
|
3503
|
-
insert(_el$
|
|
4019
|
+
})()), _el$56, _co$14);
|
|
4020
|
+
insert(_el$54, scope((() => {
|
|
3504
4021
|
var _c$10 = memo(() => !!(canResize() && !pe().continuesBefore));
|
|
3505
4022
|
return () => _c$10() ? (() => {
|
|
3506
|
-
var _el$
|
|
3507
|
-
_el$
|
|
4023
|
+
var _el$61 = getNextElement(_tmpl$2$4);
|
|
4024
|
+
_el$61._$$pointerdown = (e) => {
|
|
3508
4025
|
pressEvent(e, pe(), key(), "resize-start", dayIndex, canMove() ? onPress : void 0);
|
|
3509
4026
|
};
|
|
3510
4027
|
effect(() => readShallow(css({
|
|
@@ -3516,17 +4033,17 @@ function TimeGrid(incoming) {
|
|
|
3516
4033
|
cursor: "ns-resize",
|
|
3517
4034
|
touchAction: "pan-y"
|
|
3518
4035
|
})), (_v$, _$p) => {
|
|
3519
|
-
style(_el$
|
|
4036
|
+
style(_el$61, _v$, _$p);
|
|
3520
4037
|
});
|
|
3521
4038
|
runHydrationEvents();
|
|
3522
|
-
return _el$
|
|
4039
|
+
return _el$61;
|
|
3523
4040
|
})() : null;
|
|
3524
|
-
})()), _el$
|
|
3525
|
-
insert(_el$
|
|
4041
|
+
})()), _el$58, _co$15);
|
|
4042
|
+
insert(_el$54, scope((() => {
|
|
3526
4043
|
var _c$11 = memo(() => !!(canResize() && !pe().continuesAfter));
|
|
3527
4044
|
return () => _c$11() ? (() => {
|
|
3528
|
-
var _el$
|
|
3529
|
-
_el$
|
|
4045
|
+
var _el$62 = getNextElement(_tmpl$2$4);
|
|
4046
|
+
_el$62._$$pointerdown = (e) => {
|
|
3530
4047
|
pressEvent(e, pe(), key(), "resize", dayIndex, canMove() ? onPress : void 0);
|
|
3531
4048
|
};
|
|
3532
4049
|
effect(() => readShallow(css({
|
|
@@ -3538,24 +4055,24 @@ function TimeGrid(incoming) {
|
|
|
3538
4055
|
cursor: "ns-resize",
|
|
3539
4056
|
touchAction: "pan-y"
|
|
3540
4057
|
})), (_v$, _$p) => {
|
|
3541
|
-
style(_el$
|
|
4058
|
+
style(_el$62, _v$, _$p);
|
|
3542
4059
|
});
|
|
3543
4060
|
runHydrationEvents();
|
|
3544
|
-
return _el$
|
|
4061
|
+
return _el$62;
|
|
3545
4062
|
})() : null;
|
|
3546
|
-
})()), _el$
|
|
4063
|
+
})()), _el$60, _co$16);
|
|
3547
4064
|
runHydrationEvents();
|
|
3548
|
-
return _el$
|
|
4065
|
+
return _el$54;
|
|
3549
4066
|
});
|
|
3550
4067
|
}
|
|
3551
|
-
})), _el$
|
|
3552
|
-
insert(_el$
|
|
4068
|
+
})), _el$42, _co$1);
|
|
4069
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3553
4070
|
get when() {
|
|
3554
4071
|
return moveSegment();
|
|
3555
4072
|
},
|
|
3556
4073
|
children: (moveSegment) => (() => {
|
|
3557
|
-
var _el$
|
|
3558
|
-
spread(_el$
|
|
4074
|
+
var _el$63 = getNextElement(_tmpl$2$4);
|
|
4075
|
+
spread(_el$63, [
|
|
3559
4076
|
{ "aria-hidden": "true" },
|
|
3560
4077
|
() => dataState({ "data-dragging": true }),
|
|
3561
4078
|
() => slot("event", { base: {
|
|
@@ -3569,7 +4086,7 @@ function TimeGrid(incoming) {
|
|
|
3569
4086
|
opacity: .85
|
|
3570
4087
|
} })
|
|
3571
4088
|
], true);
|
|
3572
|
-
insert(_el$
|
|
4089
|
+
insert(_el$63, scope(() => {
|
|
3573
4090
|
const args = {
|
|
3574
4091
|
event: moveSegment().event,
|
|
3575
4092
|
mode: props.mode,
|
|
@@ -3592,16 +4109,16 @@ function TimeGrid(incoming) {
|
|
|
3592
4109
|
})));
|
|
3593
4110
|
}));
|
|
3594
4111
|
runHydrationEvents();
|
|
3595
|
-
return _el$
|
|
4112
|
+
return _el$63;
|
|
3596
4113
|
})()
|
|
3597
|
-
})), _el$
|
|
3598
|
-
insert(_el$
|
|
4114
|
+
})), _el$44, _co$10);
|
|
4115
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3599
4116
|
get when() {
|
|
3600
4117
|
return spill();
|
|
3601
4118
|
},
|
|
3602
4119
|
children: (spill) => (() => {
|
|
3603
|
-
var _el$
|
|
3604
|
-
spread(_el$
|
|
4120
|
+
var _el$64 = getNextElement(_tmpl$2$4);
|
|
4121
|
+
spread(_el$64, [
|
|
3605
4122
|
{ "aria-hidden": "true" },
|
|
3606
4123
|
() => dataState({ "data-dragging": true }),
|
|
3607
4124
|
() => slot("event", { base: {
|
|
@@ -3615,7 +4132,7 @@ function TimeGrid(incoming) {
|
|
|
3615
4132
|
opacity: .85
|
|
3616
4133
|
} })
|
|
3617
4134
|
], true);
|
|
3618
|
-
insert(_el$
|
|
4135
|
+
insert(_el$64, scope((() => {
|
|
3619
4136
|
var _c$12 = memo(() => !!Renderer());
|
|
3620
4137
|
return () => _c$12() ? createComponent(Dynamic, mergeProps({ get component() {
|
|
3621
4138
|
return Renderer();
|
|
@@ -3629,14 +4146,14 @@ function TimeGrid(incoming) {
|
|
|
3629
4146
|
}));
|
|
3630
4147
|
})()));
|
|
3631
4148
|
runHydrationEvents();
|
|
3632
|
-
return _el$
|
|
4149
|
+
return _el$64;
|
|
3633
4150
|
})()
|
|
3634
|
-
})), _el$
|
|
3635
|
-
insert(_el$
|
|
4151
|
+
})), _el$46, _co$11);
|
|
4152
|
+
insert(_el$35, scope((() => {
|
|
3636
4153
|
var _c$0 = memo(() => !!showNow());
|
|
3637
4154
|
return () => _c$0() ? (() => {
|
|
3638
|
-
var _el$
|
|
3639
|
-
spread(_el$
|
|
4155
|
+
var _el$65 = getNextElement(_tmpl$6$2), _el$66 = _el$65.firstChild, _el$67 = _el$66.nextSibling;
|
|
4156
|
+
spread(_el$65, () => slot("nowIndicator", { base: {
|
|
3640
4157
|
position: "absolute",
|
|
3641
4158
|
top: nowTop(),
|
|
3642
4159
|
left: 0,
|
|
@@ -3660,20 +4177,20 @@ function TimeGrid(incoming) {
|
|
|
3660
4177
|
background: theme().nowIndicator
|
|
3661
4178
|
}))
|
|
3662
4179
|
}), ({ e, t }, _p$) => {
|
|
3663
|
-
style(_el$
|
|
3664
|
-
style(_el$
|
|
4180
|
+
style(_el$66, e, _p$?.e);
|
|
4181
|
+
style(_el$67, t, _p$?.t);
|
|
3665
4182
|
});
|
|
3666
4183
|
runHydrationEvents();
|
|
3667
|
-
return _el$
|
|
4184
|
+
return _el$65;
|
|
3668
4185
|
})() : null;
|
|
3669
|
-
})()), _el$
|
|
3670
|
-
insert(_el$
|
|
4186
|
+
})()), _el$48, _co$12);
|
|
4187
|
+
insert(_el$35, scope(() => createComponent(Show, {
|
|
3671
4188
|
get when() {
|
|
3672
4189
|
return ghost();
|
|
3673
4190
|
},
|
|
3674
|
-
children: (
|
|
3675
|
-
var _el$
|
|
3676
|
-
spread(_el$
|
|
4191
|
+
children: (_ghost) => (() => {
|
|
4192
|
+
var _el$68 = getNextElement(_tmpl$2$4);
|
|
4193
|
+
spread(_el$68, [{
|
|
3677
4194
|
"aria-hidden": "true",
|
|
3678
4195
|
get inert() {
|
|
3679
4196
|
return ghostRange() ? true : void 0;
|
|
@@ -3683,7 +4200,7 @@ function TimeGrid(incoming) {
|
|
|
3683
4200
|
position: "absolute",
|
|
3684
4201
|
left: props.eventGap,
|
|
3685
4202
|
right: props.eventGap,
|
|
3686
|
-
...
|
|
4203
|
+
...previewPlacement(),
|
|
3687
4204
|
boxSizing: "border-box",
|
|
3688
4205
|
...ghostRange() ? { overflow: "hidden" } : null,
|
|
3689
4206
|
opacity: .7,
|
|
@@ -3696,7 +4213,7 @@ function TimeGrid(incoming) {
|
|
|
3696
4213
|
borderRadius: 6
|
|
3697
4214
|
}
|
|
3698
4215
|
})], true);
|
|
3699
|
-
insert(_el$
|
|
4216
|
+
insert(_el$68, createComponent(Show, {
|
|
3700
4217
|
get when() {
|
|
3701
4218
|
return ghostRange();
|
|
3702
4219
|
},
|
|
@@ -3713,19 +4230,19 @@ function TimeGrid(incoming) {
|
|
|
3713
4230
|
})
|
|
3714
4231
|
}));
|
|
3715
4232
|
runHydrationEvents();
|
|
3716
|
-
return _el$
|
|
4233
|
+
return _el$68;
|
|
3717
4234
|
})()
|
|
3718
|
-
})), _el$
|
|
4235
|
+
})), _el$50, _co$13);
|
|
3719
4236
|
runHydrationEvents();
|
|
3720
|
-
return _el$
|
|
4237
|
+
return _el$35;
|
|
3721
4238
|
}
|
|
3722
4239
|
})), _el$14, _co$4);
|
|
3723
4240
|
insert(_el$6, scope((() => {
|
|
3724
4241
|
var _c$5 = memo(() => !!(paged() && draggedRef.current));
|
|
3725
4242
|
return () => _c$5() ? (() => {
|
|
3726
|
-
var _el$
|
|
3727
|
-
ref(() => (el) => ghostRef.current = el, _el$
|
|
3728
|
-
insert(_el$
|
|
4243
|
+
var _el$69 = getNextElement(_tmpl$0);
|
|
4244
|
+
ref(() => (el) => ghostRef.current = el, _el$69);
|
|
4245
|
+
insert(_el$69, scope((() => {
|
|
3729
4246
|
var _c$13 = memo(() => !!Renderer());
|
|
3730
4247
|
return () => _c$13() ? createComponent(Dynamic, {
|
|
3731
4248
|
get component() {
|
|
@@ -3779,9 +4296,9 @@ function TimeGrid(incoming) {
|
|
|
3779
4296
|
zIndex: 1e3,
|
|
3780
4297
|
opacity: .85
|
|
3781
4298
|
})), (_v$, _$p) => {
|
|
3782
|
-
style(_el$
|
|
4299
|
+
style(_el$69, _v$, _$p);
|
|
3783
4300
|
});
|
|
3784
|
-
return _el$
|
|
4301
|
+
return _el$69;
|
|
3785
4302
|
})() : null;
|
|
3786
4303
|
})()), _el$20, _co$7);
|
|
3787
4304
|
insert(_el$6, createComponent(Show, {
|
|
@@ -3880,6 +4397,10 @@ function YearView(incoming) {
|
|
|
3880
4397
|
}, incoming);
|
|
3881
4398
|
const theme = createMemo(() => mergeSolidTheme(props.theme));
|
|
3882
4399
|
const labels = createMemo(() => resolveCalendarLabels(props.labels));
|
|
4400
|
+
const todayKey = createMemo(() => {
|
|
4401
|
+
props.date;
|
|
4402
|
+
return startOfDay(nowInTimeZone(props.now, props.timeZone)).getTime();
|
|
4403
|
+
});
|
|
3883
4404
|
const slot = createSlots(props);
|
|
3884
4405
|
const sweepEnabled = createMemo(() => props.onSelectDrag != null || props.onCreateEvent != null);
|
|
3885
4406
|
const [creating, setCreating] = createSignal(null);
|
|
@@ -4060,7 +4581,7 @@ function YearView(incoming) {
|
|
|
4060
4581
|
});
|
|
4061
4582
|
return _el$10;
|
|
4062
4583
|
}
|
|
4063
|
-
const isToday = createMemo(() => getIsToday(day()));
|
|
4584
|
+
const isToday = createMemo(() => getIsToday(day(), new Date(todayKey())));
|
|
4064
4585
|
const isHighlighted = createMemo(() => props.activeDate ? isSameCalendarDay(day(), props.activeDate) : isToday());
|
|
4065
4586
|
const hasEvents = createMemo(() => eventDays().has(startOfDay(day()).toISOString()));
|
|
4066
4587
|
const state = createMemo(() => daySelectionState$1(day(), {
|
|
@@ -4288,14 +4809,22 @@ var _tmpl$$3 = /*#__PURE__*/ template(`<div>`);
|
|
|
4288
4809
|
*/
|
|
4289
4810
|
/** Props for {@link Calendar}. */
|
|
4290
4811
|
const EMPTY_EVENTS = [];
|
|
4291
|
-
function expansionRange(mode, date, weekStartsOn, numberOfDays) {
|
|
4812
|
+
function expansionRange(mode, date, weekStartsOn, numberOfDays, numberOfWeeks) {
|
|
4813
|
+
if (mode === "multiweek") {
|
|
4814
|
+
const { period } = buildMultiWeekGrid$1(date, {
|
|
4815
|
+
weekStartsOn,
|
|
4816
|
+
numberOfWeeks
|
|
4817
|
+
});
|
|
4818
|
+
return [period.start, endOfDay(addDays(period.endExclusive, -1))];
|
|
4819
|
+
}
|
|
4292
4820
|
if (mode === "month") return [startOfWeek(startOfMonth(date), { weekStartsOn }), endOfWeek(endOfMonth(date), { weekStartsOn })];
|
|
4293
4821
|
if (mode === "year") return [startOfWeek(startOfYear(date), { weekStartsOn }), endOfWeek(endOfYear(date), { weekStartsOn })];
|
|
4294
4822
|
if (mode === "schedule") return [startOfDay(date), endOfDay(addMonths(date, 3))];
|
|
4295
4823
|
const days = getViewDays$1(mode, date, weekStartsOn, numberOfDays ?? 1);
|
|
4296
4824
|
return [startOfDay(days[0]), endOfDay(days[days.length - 1])];
|
|
4297
4825
|
}
|
|
4298
|
-
function pageStep(mode, date, direction, weekStartsOn, numberOfDays) {
|
|
4826
|
+
function pageStep(mode, date, direction, weekStartsOn, numberOfDays, numberOfWeeks) {
|
|
4827
|
+
if (mode === "multiweek") return addWeeks(date, direction * numberOfWeeks);
|
|
4299
4828
|
if (mode === "year") return addYears(date, direction);
|
|
4300
4829
|
if (mode === "month") return addMonths(date, direction);
|
|
4301
4830
|
if (mode === "schedule") return addDays(date, direction * 7);
|
|
@@ -4315,7 +4844,8 @@ function pageStep(mode, date, direction, weekStartsOn, numberOfDays) {
|
|
|
4315
4844
|
function Calendar(incoming) {
|
|
4316
4845
|
const props = withDefaults({
|
|
4317
4846
|
mode: "week",
|
|
4318
|
-
weekStartsOn: 0
|
|
4847
|
+
weekStartsOn: 0,
|
|
4848
|
+
numberOfWeeks: 2
|
|
4319
4849
|
}, incoming);
|
|
4320
4850
|
const timeGridRef = { current: null };
|
|
4321
4851
|
onSettled(() => {
|
|
@@ -4324,20 +4854,52 @@ function Calendar(incoming) {
|
|
|
4324
4854
|
const displayEvents = createMemo(() => {
|
|
4325
4855
|
let out = props.events ?? EMPTY_EVENTS;
|
|
4326
4856
|
if (out.some((e) => e.recurrence)) {
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
end = addDays(end, 1);
|
|
4331
|
-
}
|
|
4332
|
-
out = expandRecurringEvents$1(out, start, end);
|
|
4857
|
+
const [start, end] = expansionRange(props.mode, props.date, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks);
|
|
4858
|
+
const timeZone = props.timeZone;
|
|
4859
|
+
out = timeZone ? expandRecurringEvents$1(out, fromZonedTime(start, timeZone), fromZonedTime(end, timeZone), { timeZone }) : expandRecurringEvents$1(out, start, end);
|
|
4333
4860
|
}
|
|
4334
4861
|
if (props.timeZone) out = eventsInTimeZone(out, props.timeZone);
|
|
4335
4862
|
return out;
|
|
4336
4863
|
});
|
|
4864
|
+
const zoned = {
|
|
4865
|
+
onPressEvent: createMemo(() => {
|
|
4866
|
+
const handler = props.onPressEvent;
|
|
4867
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4868
|
+
}),
|
|
4869
|
+
onDragStart: createMemo(() => {
|
|
4870
|
+
const handler = props.onDragStart;
|
|
4871
|
+
return handler && props.timeZone ? (event) => handler(zonedEventSource(event)) : handler;
|
|
4872
|
+
}),
|
|
4873
|
+
onDragEvent: createMemo(() => {
|
|
4874
|
+
const handler = props.onDragEvent;
|
|
4875
|
+
return handler && props.timeZone ? (event, start, end) => {
|
|
4876
|
+
const bounds = zonedDragBounds(event, start, end, { keepDuration: props.mode !== "month" && props.mode !== "multiweek" });
|
|
4877
|
+
if (!bounds) return false;
|
|
4878
|
+
return handler(zonedEventSource(event), bounds.start, bounds.end);
|
|
4879
|
+
} : handler;
|
|
4880
|
+
}),
|
|
4881
|
+
onPressMore: createMemo(() => {
|
|
4882
|
+
const handler = props.onPressMore;
|
|
4883
|
+
return handler && props.timeZone ? (dayEvents, day) => handler(dayEvents.map(zonedEventSource), day) : handler;
|
|
4884
|
+
}),
|
|
4885
|
+
onPressTime: createMemo(() => {
|
|
4886
|
+
const handler = props.onPressCell;
|
|
4887
|
+
const timeZone = props.timeZone;
|
|
4888
|
+
return handler && timeZone ? (time) => handler(fromZonedTime(time, timeZone)) : handler;
|
|
4889
|
+
}),
|
|
4890
|
+
onCreateTimed: createMemo(() => {
|
|
4891
|
+
const handler = props.onCreateEvent;
|
|
4892
|
+
const timeZone = props.timeZone;
|
|
4893
|
+
return handler && timeZone ? (start, end) => {
|
|
4894
|
+
const range = fromZonedRange(start, end, timeZone);
|
|
4895
|
+
if (range) handler(range.start, range.end);
|
|
4896
|
+
} : handler;
|
|
4897
|
+
})
|
|
4898
|
+
};
|
|
4337
4899
|
const handlePageKeys = (e) => {
|
|
4338
4900
|
if (!props.onChangeDate) return;
|
|
4339
|
-
if (e.key === "PageDown") props.onChangeDate(pageStep(props.mode, props.date, 1, props.weekStartsOn, props.numberOfDays));
|
|
4340
|
-
else if (e.key === "PageUp") props.onChangeDate(pageStep(props.mode, props.date, -1, props.weekStartsOn, props.numberOfDays));
|
|
4901
|
+
if (e.key === "PageDown") props.onChangeDate(pageStep(props.mode, props.date, 1, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks));
|
|
4902
|
+
else if (e.key === "PageUp") props.onChangeDate(pageStep(props.mode, props.date, -1, props.weekStartsOn, props.numberOfDays, props.numberOfWeeks));
|
|
4341
4903
|
else return;
|
|
4342
4904
|
e.preventDefault();
|
|
4343
4905
|
};
|
|
@@ -4360,6 +4922,12 @@ function Calendar(incoming) {
|
|
|
4360
4922
|
get locale() {
|
|
4361
4923
|
return props.locale;
|
|
4362
4924
|
},
|
|
4925
|
+
get now() {
|
|
4926
|
+
return props.now;
|
|
4927
|
+
},
|
|
4928
|
+
get timeZone() {
|
|
4929
|
+
return props.timeZone;
|
|
4930
|
+
},
|
|
4363
4931
|
get labels() {
|
|
4364
4932
|
return props.labels;
|
|
4365
4933
|
},
|
|
@@ -4416,6 +4984,12 @@ function Calendar(incoming) {
|
|
|
4416
4984
|
get locale() {
|
|
4417
4985
|
return props.locale;
|
|
4418
4986
|
},
|
|
4987
|
+
get now() {
|
|
4988
|
+
return props.now;
|
|
4989
|
+
},
|
|
4990
|
+
get timeZone() {
|
|
4991
|
+
return props.timeZone;
|
|
4992
|
+
},
|
|
4419
4993
|
get ampm() {
|
|
4420
4994
|
return props.ampm;
|
|
4421
4995
|
},
|
|
@@ -4447,7 +5021,7 @@ function Calendar(incoming) {
|
|
|
4447
5021
|
return props.eventAccessibilityLabel;
|
|
4448
5022
|
},
|
|
4449
5023
|
get onPressEvent() {
|
|
4450
|
-
return
|
|
5024
|
+
return zoned.onPressEvent();
|
|
4451
5025
|
},
|
|
4452
5026
|
get onPressDay() {
|
|
4453
5027
|
return props.onPressDay;
|
|
@@ -4475,6 +5049,12 @@ function Calendar(incoming) {
|
|
|
4475
5049
|
get locale() {
|
|
4476
5050
|
return props.locale;
|
|
4477
5051
|
},
|
|
5052
|
+
get now() {
|
|
5053
|
+
return props.now;
|
|
5054
|
+
},
|
|
5055
|
+
get timeZone() {
|
|
5056
|
+
return props.timeZone;
|
|
5057
|
+
},
|
|
4478
5058
|
get labels() {
|
|
4479
5059
|
return props.labels;
|
|
4480
5060
|
},
|
|
@@ -4541,14 +5121,17 @@ function Calendar(incoming) {
|
|
|
4541
5121
|
get onCreateEvent() {
|
|
4542
5122
|
return props.onCreateEvent;
|
|
4543
5123
|
},
|
|
5124
|
+
get renderCreateGhost() {
|
|
5125
|
+
return props.renderCreateGhost;
|
|
5126
|
+
},
|
|
4544
5127
|
get onSelectDrag() {
|
|
4545
5128
|
return props.onSelectDrag;
|
|
4546
5129
|
},
|
|
4547
5130
|
get onDragEvent() {
|
|
4548
|
-
return
|
|
5131
|
+
return zoned.onDragEvent();
|
|
4549
5132
|
},
|
|
4550
5133
|
get onDragStart() {
|
|
4551
|
-
return
|
|
5134
|
+
return zoned.onDragStart();
|
|
4552
5135
|
},
|
|
4553
5136
|
get eventStartEditable() {
|
|
4554
5137
|
return props.eventStartEditable;
|
|
@@ -4557,10 +5140,138 @@ function Calendar(incoming) {
|
|
|
4557
5140
|
return props.eventOverlap;
|
|
4558
5141
|
},
|
|
4559
5142
|
get onPressEvent() {
|
|
4560
|
-
return
|
|
5143
|
+
return zoned.onPressEvent();
|
|
4561
5144
|
},
|
|
4562
5145
|
get onPressMore() {
|
|
4563
|
-
return
|
|
5146
|
+
return zoned.onPressMore();
|
|
5147
|
+
},
|
|
5148
|
+
get renderEvent() {
|
|
5149
|
+
return props.renderMonthEvent;
|
|
5150
|
+
},
|
|
5151
|
+
get eventAccessibilityLabel() {
|
|
5152
|
+
return props.eventAccessibilityLabel;
|
|
5153
|
+
}
|
|
5154
|
+
});
|
|
5155
|
+
else if (mode === "multiweek") return createComponent(MultiWeekView, {
|
|
5156
|
+
get date() {
|
|
5157
|
+
return props.date;
|
|
5158
|
+
},
|
|
5159
|
+
get numberOfWeeks() {
|
|
5160
|
+
return props.numberOfWeeks;
|
|
5161
|
+
},
|
|
5162
|
+
get events() {
|
|
5163
|
+
return displayEvents();
|
|
5164
|
+
},
|
|
5165
|
+
get weekStartsOn() {
|
|
5166
|
+
return props.weekStartsOn;
|
|
5167
|
+
},
|
|
5168
|
+
get hiddenDays() {
|
|
5169
|
+
return props.hiddenDays;
|
|
5170
|
+
},
|
|
5171
|
+
get weekdayFormat() {
|
|
5172
|
+
return props.weekdayFormat;
|
|
5173
|
+
},
|
|
5174
|
+
get highlightWeekends() {
|
|
5175
|
+
return props.highlightWeekends;
|
|
5176
|
+
},
|
|
5177
|
+
get locale() {
|
|
5178
|
+
return props.locale;
|
|
5179
|
+
},
|
|
5180
|
+
get now() {
|
|
5181
|
+
return props.now;
|
|
5182
|
+
},
|
|
5183
|
+
get timeZone() {
|
|
5184
|
+
return props.timeZone;
|
|
5185
|
+
},
|
|
5186
|
+
get labels() {
|
|
5187
|
+
return props.labels;
|
|
5188
|
+
},
|
|
5189
|
+
get theme() {
|
|
5190
|
+
return props.theme;
|
|
5191
|
+
},
|
|
5192
|
+
get className() {
|
|
5193
|
+
return props.className;
|
|
5194
|
+
},
|
|
5195
|
+
get style() {
|
|
5196
|
+
return {
|
|
5197
|
+
height: props.height,
|
|
5198
|
+
...props.style
|
|
5199
|
+
};
|
|
5200
|
+
},
|
|
5201
|
+
get classNames() {
|
|
5202
|
+
return props.classNames;
|
|
5203
|
+
},
|
|
5204
|
+
get styles() {
|
|
5205
|
+
return props.styles;
|
|
5206
|
+
},
|
|
5207
|
+
get maxVisibleEventCount() {
|
|
5208
|
+
return props.maxVisibleEventCount;
|
|
5209
|
+
},
|
|
5210
|
+
get chipHeight() {
|
|
5211
|
+
return props.chipHeight;
|
|
5212
|
+
},
|
|
5213
|
+
get chipGap() {
|
|
5214
|
+
return props.chipGap;
|
|
5215
|
+
},
|
|
5216
|
+
get moreLabel() {
|
|
5217
|
+
return props.moreLabel;
|
|
5218
|
+
},
|
|
5219
|
+
get showTitle() {
|
|
5220
|
+
return props.showTitle;
|
|
5221
|
+
},
|
|
5222
|
+
get fillCellOnSelection() {
|
|
5223
|
+
return props.fillCellOnSelection;
|
|
5224
|
+
},
|
|
5225
|
+
get selectedRange() {
|
|
5226
|
+
return props.selectedRange;
|
|
5227
|
+
},
|
|
5228
|
+
get selectedDates() {
|
|
5229
|
+
return props.selectedDates;
|
|
5230
|
+
},
|
|
5231
|
+
get minDate() {
|
|
5232
|
+
return props.minDate;
|
|
5233
|
+
},
|
|
5234
|
+
get maxDate() {
|
|
5235
|
+
return props.maxDate;
|
|
5236
|
+
},
|
|
5237
|
+
get isDateDisabled() {
|
|
5238
|
+
return props.isDateDisabled;
|
|
5239
|
+
},
|
|
5240
|
+
get keyboardDayNavigation() {
|
|
5241
|
+
return props.keyboardDayNavigation;
|
|
5242
|
+
},
|
|
5243
|
+
get onPressDay() {
|
|
5244
|
+
return props.onPressDay;
|
|
5245
|
+
},
|
|
5246
|
+
get onPressCell() {
|
|
5247
|
+
return props.onPressCell;
|
|
5248
|
+
},
|
|
5249
|
+
get onCreateEvent() {
|
|
5250
|
+
return props.onCreateEvent;
|
|
5251
|
+
},
|
|
5252
|
+
get renderCreateGhost() {
|
|
5253
|
+
return props.renderCreateGhost;
|
|
5254
|
+
},
|
|
5255
|
+
get onSelectDrag() {
|
|
5256
|
+
return props.onSelectDrag;
|
|
5257
|
+
},
|
|
5258
|
+
get onDragEvent() {
|
|
5259
|
+
return zoned.onDragEvent();
|
|
5260
|
+
},
|
|
5261
|
+
get onDragStart() {
|
|
5262
|
+
return zoned.onDragStart();
|
|
5263
|
+
},
|
|
5264
|
+
get eventStartEditable() {
|
|
5265
|
+
return props.eventStartEditable;
|
|
5266
|
+
},
|
|
5267
|
+
get eventOverlap() {
|
|
5268
|
+
return props.eventOverlap;
|
|
5269
|
+
},
|
|
5270
|
+
get onPressEvent() {
|
|
5271
|
+
return zoned.onPressEvent();
|
|
5272
|
+
},
|
|
5273
|
+
get onPressMore() {
|
|
5274
|
+
return zoned.onPressMore();
|
|
4564
5275
|
},
|
|
4565
5276
|
get renderEvent() {
|
|
4566
5277
|
return props.renderMonthEvent;
|
|
@@ -4693,22 +5404,22 @@ function Calendar(incoming) {
|
|
|
4693
5404
|
return props.touchDragThreshold;
|
|
4694
5405
|
},
|
|
4695
5406
|
get onPressEvent() {
|
|
4696
|
-
return
|
|
5407
|
+
return zoned.onPressEvent();
|
|
4697
5408
|
},
|
|
4698
5409
|
get onPressCell() {
|
|
4699
|
-
return
|
|
5410
|
+
return zoned.onPressTime();
|
|
4700
5411
|
},
|
|
4701
5412
|
get onCreateEvent() {
|
|
4702
|
-
return
|
|
5413
|
+
return zoned.onCreateTimed();
|
|
4703
5414
|
},
|
|
4704
5415
|
get renderCreateGhost() {
|
|
4705
5416
|
return props.renderCreateGhost;
|
|
4706
5417
|
},
|
|
4707
5418
|
get onDragStart() {
|
|
4708
|
-
return
|
|
5419
|
+
return zoned.onDragStart();
|
|
4709
5420
|
},
|
|
4710
5421
|
get onDragEvent() {
|
|
4711
|
-
return
|
|
5422
|
+
return zoned.onDragEvent();
|
|
4712
5423
|
},
|
|
4713
5424
|
get getEventId() {
|
|
4714
5425
|
return props.getEventId;
|
|
@@ -6611,4 +7322,4 @@ function ResourceTimeline(incoming) {
|
|
|
6611
7322
|
})];
|
|
6612
7323
|
}
|
|
6613
7324
|
delegateEvents(["pointerdown"]);
|
|
6614
|
-
export { Agenda, Calendar, DatePicker, DateRangePicker, MonthList, MonthView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, createDateRange, createEventSource, createMonthGrid, createNow, darkSolidTheme, daySelectionState, defaultCalendarLabels, defaultSolidTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, loadEventSource, mergeSolidTheme, nextDateRange, parseICalendar, toICalendar, weekdayFormatToken };
|
|
7325
|
+
export { Agenda, Calendar, DatePicker, DateRangePicker, MonthList, MonthView, MultiWeekView, ResourceTimeline, TimeGrid, YearView, backgroundBandsForDay, buildMonthGrid, buildMultiWeekGrid, createDateRange, createEventSource, createMonthGrid, createNow, darkSolidTheme, daySelectionState, defaultCalendarLabels, defaultSolidTheme, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, loadEventSource, mergeSolidTheme, nextDateRange, parseICalendar, toICalendar, weekdayFormatToken };
|