@k2b/ui 0.23.0 → 0.25.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 +2 -2
- package/dist/browser/actions/Dropdown.js +67 -52
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/GestureMenu.js +3 -3
- package/dist/browser/actions/GestureMenu.js.map +1 -1
- package/dist/browser/actions/SpotlightSearch.js +13 -6
- package/dist/browser/actions/SpotlightSearch.js.map +1 -1
- package/dist/browser/actions/Toolbar.js +75 -1
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/content/Calendar.js +1570 -923
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/CalendarDayView.js +2 -2
- package/dist/browser/content/CalendarDayView.js.map +1 -1
- package/dist/browser/content/CalendarWeekView.js +29 -7
- package/dist/browser/content/CalendarWeekView.js.map +1 -1
- package/dist/browser/content/DataTable.js +45 -35
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/Kbd.js +51 -0
- package/dist/browser/content/Kbd.js.map +1 -0
- package/dist/browser/content/LabelChip.js +38 -0
- package/dist/browser/content/LabelChip.js.map +1 -0
- package/dist/browser/content/MarkdownView.js +2 -1
- package/dist/browser/content/MarkdownView.js.map +1 -1
- package/dist/browser/content/Steps.js +34 -0
- package/dist/browser/content/Steps.js.map +1 -0
- package/dist/browser/content/VirtualFeed.js +33 -1
- package/dist/browser/content/VirtualFeed.js.map +1 -1
- package/dist/browser/content/calendar-day-scroll.js +17 -4
- package/dist/browser/content/calendar-day-scroll.js.map +1 -1
- package/dist/browser/content/calendar-dialogs.js +32 -60
- package/dist/browser/content/calendar-dialogs.js.map +1 -1
- package/dist/browser/content/calendar-month-scroll.js +80 -0
- package/dist/browser/content/calendar-month-scroll.js.map +1 -0
- package/dist/browser/content/calendar-time-view.js +9 -4
- package/dist/browser/content/calendar-time-view.js.map +1 -1
- package/dist/browser/content/index.js +4 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/markdown-info-blocks.js +33 -5
- package/dist/browser/content/markdown-info-blocks.js.map +1 -1
- package/dist/browser/feedback/prompts.js +17 -3
- package/dist/browser/feedback/prompts.js.map +1 -1
- package/dist/browser/intl/index.js +1 -0
- package/dist/browser/intl/index.js.map +1 -1
- package/dist/browser/intl/shortcut-messages.js +77 -0
- package/dist/browser/intl/shortcut-messages.js.map +1 -0
- package/dist/browser/intl/shortcut.js +123 -0
- package/dist/browser/intl/shortcut.js.map +1 -0
- package/dist/browser/layout/AppWorkspace.js +345 -325
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/Navigation.js +18 -3
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/PageTitle.js +14 -0
- package/dist/browser/layout/PageTitle.js.map +1 -1
- package/dist/browser/layout/SidebarSwitcher.js +505 -0
- package/dist/browser/layout/SidebarSwitcher.js.map +1 -0
- package/dist/browser/layout/TableOfContents.js +115 -0
- package/dist/browser/layout/TableOfContents.js.map +1 -0
- package/dist/browser/layout/app-workspace-controller.js +15 -48
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/index.js +2 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/navigation-model.js +1 -0
- package/dist/browser/layout/navigation-model.js.map +1 -1
- package/dist/browser/layout/table-of-contents-messages.js +19 -0
- package/dist/browser/layout/table-of-contents-messages.js.map +1 -0
- package/dist/browser/surfaces/LinkCard.js +40 -24
- package/dist/browser/surfaces/LinkCard.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +11 -5
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/GestureMenu.js +3 -3
- package/dist/ssr/actions/GestureMenu.js.map +1 -1
- package/dist/ssr/actions/SpotlightSearch.js +9 -3
- package/dist/ssr/actions/SpotlightSearch.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +67 -1
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/content/Calendar.js +895 -321
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/CalendarDayView.js +2 -2
- package/dist/ssr/content/CalendarDayView.js.map +1 -1
- package/dist/ssr/content/CalendarWeekView.js +28 -7
- package/dist/ssr/content/CalendarWeekView.js.map +1 -1
- package/dist/ssr/content/DataTable.js +21 -17
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/Kbd.js +38 -0
- package/dist/ssr/content/Kbd.js.map +1 -0
- package/dist/ssr/content/LabelChip.js +21 -0
- package/dist/ssr/content/LabelChip.js.map +1 -0
- package/dist/ssr/content/MarkdownView.js +2 -1
- package/dist/ssr/content/MarkdownView.js.map +1 -1
- package/dist/ssr/content/Steps.js +14 -0
- package/dist/ssr/content/Steps.js.map +1 -0
- package/dist/ssr/content/VirtualFeed.js +33 -1
- package/dist/ssr/content/VirtualFeed.js.map +1 -1
- package/dist/ssr/content/calendar-day-scroll.js +17 -4
- package/dist/ssr/content/calendar-day-scroll.js.map +1 -1
- package/dist/ssr/content/calendar-dialogs.js +12 -32
- package/dist/ssr/content/calendar-dialogs.js.map +1 -1
- package/dist/ssr/content/calendar-month-scroll.js +80 -0
- package/dist/ssr/content/calendar-month-scroll.js.map +1 -0
- package/dist/ssr/content/calendar-time-view.js +8 -3
- package/dist/ssr/content/calendar-time-view.js.map +1 -1
- package/dist/ssr/content/index.js +4 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/markdown-info-blocks.js +33 -5
- package/dist/ssr/content/markdown-info-blocks.js.map +1 -1
- package/dist/ssr/feedback/prompts.js +17 -3
- package/dist/ssr/feedback/prompts.js.map +1 -1
- package/dist/ssr/intl/index.js +1 -0
- package/dist/ssr/intl/index.js.map +1 -1
- package/dist/ssr/intl/shortcut-messages.js +77 -0
- package/dist/ssr/intl/shortcut-messages.js.map +1 -0
- package/dist/ssr/intl/shortcut.js +123 -0
- package/dist/ssr/intl/shortcut.js.map +1 -0
- package/dist/ssr/layout/AppWorkspace.js +67 -59
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +12 -2
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/PageTitle.js +14 -0
- package/dist/ssr/layout/PageTitle.js.map +1 -1
- package/dist/ssr/layout/SidebarSwitcher.js +271 -0
- package/dist/ssr/layout/SidebarSwitcher.js.map +1 -0
- package/dist/ssr/layout/TableOfContents.js +79 -0
- package/dist/ssr/layout/TableOfContents.js.map +1 -0
- package/dist/ssr/layout/app-workspace-controller.js +15 -48
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/index.js +2 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/navigation-model.js +1 -0
- package/dist/ssr/layout/navigation-model.js.map +1 -1
- package/dist/ssr/layout/table-of-contents-messages.js +19 -0
- package/dist/ssr/layout/table-of-contents-messages.js.map +1 -0
- package/dist/ssr/surfaces/LinkCard.js +26 -10
- package/dist/ssr/surfaces/LinkCard.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +12 -0
- package/dist/types/actions/SpotlightSearch.d.ts +2 -0
- package/dist/types/content/Calendar.d.ts +20 -7
- package/dist/types/content/CalendarWeekView.d.ts +1 -1
- package/dist/types/content/DataTable.d.ts +9 -0
- package/dist/types/content/Kbd.d.ts +16 -0
- package/dist/types/content/LabelChip.d.ts +12 -0
- package/dist/types/content/MarkdownView.d.ts +2 -1
- package/dist/types/content/Steps.d.ts +12 -0
- package/dist/types/content/VirtualFeed.d.ts +8 -0
- package/dist/types/content/calendar-day-scroll.d.ts +9 -4
- package/dist/types/content/calendar-dialogs.d.ts +0 -2
- package/dist/types/content/calendar-month-scroll.d.ts +25 -0
- package/dist/types/content/index.d.ts +7 -1
- package/dist/types/content/markdown-info-blocks.d.ts +21 -4
- package/dist/types/feedback/prompts.d.ts +8 -2
- package/dist/types/intl/index.d.ts +2 -0
- package/dist/types/intl/shortcut-messages.d.ts +35 -0
- package/dist/types/intl/shortcut.d.ts +29 -0
- package/dist/types/layout/AppWorkspace.d.ts +5 -1
- package/dist/types/layout/SidebarSwitcher.d.ts +65 -0
- package/dist/types/layout/TableOfContents.d.ts +24 -0
- package/dist/types/layout/index.d.ts +3 -0
- package/dist/types/layout/navigation-model.d.ts +4 -0
- package/dist/types/layout/table-of-contents-messages.d.ts +4 -0
- package/dist/types/surfaces/LinkCard.d.ts +3 -0
- package/package.json +4 -4
|
@@ -36,48 +36,50 @@ var _tmpl$ = /*#__PURE__*/_$template(`<a>`),
|
|
|
36
36
|
_tmpl$18 = /*#__PURE__*/_$template(`<span class=k2b-calendar-month__day-number>`),
|
|
37
37
|
_tmpl$19 = /*#__PURE__*/_$template(`<span class=k2b-calendar-month__badge><!$><!/><!$><!/>`),
|
|
38
38
|
_tmpl$20 = /*#__PURE__*/_$template(`<span class=k2b-calendar-dot>`),
|
|
39
|
-
_tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
40
|
-
_tmpl$22 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
41
|
-
_tmpl$23 = /*#__PURE__*/_$template(`<
|
|
42
|
-
_tmpl$24 = /*#__PURE__*/_$template(`<
|
|
43
|
-
_tmpl$25 = /*#__PURE__*/_$template(`<
|
|
44
|
-
_tmpl$26 = /*#__PURE__*/_$template(`<
|
|
45
|
-
_tmpl$27 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
46
|
-
_tmpl$28 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
47
|
-
_tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
48
|
-
_tmpl$30 = /*#__PURE__*/_$template(`<
|
|
49
|
-
_tmpl$31 = /*#__PURE__*/_$template(`<
|
|
50
|
-
_tmpl$32 = /*#__PURE__*/_$template(`<
|
|
51
|
-
_tmpl$33 = /*#__PURE__*/_$template(`<
|
|
52
|
-
_tmpl$34 = /*#__PURE__*/_$template(`<
|
|
53
|
-
_tmpl$35 = /*#__PURE__*/_$template(`<
|
|
54
|
-
_tmpl$36 = /*#__PURE__*/_$template(`<
|
|
55
|
-
_tmpl$37 = /*#__PURE__*/_$template(`<
|
|
56
|
-
_tmpl$38 = /*#__PURE__*/_$template(`<div class=
|
|
57
|
-
_tmpl$39 = /*#__PURE__*/_$template(`<
|
|
58
|
-
_tmpl$40 = /*#__PURE__*/_$template(`<
|
|
59
|
-
_tmpl$41 = /*#__PURE__*/_$template(`<
|
|
60
|
-
_tmpl$42 = /*#__PURE__*/_$template(`<
|
|
61
|
-
_tmpl$43 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-
|
|
62
|
-
_tmpl$44 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-
|
|
63
|
-
_tmpl$45 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-
|
|
64
|
-
_tmpl$46 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
65
|
-
_tmpl$47 = /*#__PURE__*/_$template(`<div class=
|
|
66
|
-
_tmpl$48 = /*#__PURE__*/_$template(`<
|
|
67
|
-
_tmpl$49 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
68
|
-
_tmpl$50 = /*#__PURE__*/_$template(`<button type=button class=k2b-calendar-time-
|
|
69
|
-
_tmpl$51 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-
|
|
70
|
-
_tmpl$52 = /*#__PURE__*/_$template(`<
|
|
71
|
-
_tmpl$53 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
72
|
-
_tmpl$54 = /*#__PURE__*/_$template(`<
|
|
73
|
-
_tmpl$55 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
74
|
-
_tmpl$56 = /*#__PURE__*/_$template(`<
|
|
75
|
-
_tmpl$57 = /*#__PURE__*/_$template(`<div class=k2b-calendar-mobile-
|
|
76
|
-
_tmpl$58 = /*#__PURE__*/_$template(`<div class=k2b-calendar-
|
|
77
|
-
_tmpl$59 = /*#__PURE__*/_$template(`<
|
|
39
|
+
_tmpl$21 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__week-number role=rowheader>`),
|
|
40
|
+
_tmpl$22 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__week role=row><!$><!/><!$><!/>`),
|
|
41
|
+
_tmpl$23 = /*#__PURE__*/_$template(`<button type=button class=k2b-calendar-month__week-link tabindex=-1>`),
|
|
42
|
+
_tmpl$24 = /*#__PURE__*/_$template(`<button type=button class=k2b-calendar-month__more tabindex=-1 aria-haspopup=dialog><span class=k2b-calendar-month__more-long></span><span class=k2b-calendar-month__more-short>+<!$><!/>`),
|
|
43
|
+
_tmpl$25 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__day role=gridcell><div class=k2b-calendar-month__day-header><span class=k2b-calendar-month__day-number></span><!$><!/></div><div class=k2b-calendar-month__lanes><!$><!/><!$><!/><!$><!/>`),
|
|
44
|
+
_tmpl$26 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__segment data-bar=true>`),
|
|
45
|
+
_tmpl$27 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__segment style=--k2b-calendar-span:1>`),
|
|
46
|
+
_tmpl$28 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__weekday role=columnheader>`),
|
|
47
|
+
_tmpl$29 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month__weekdays role=row><!$><!/><!$><!/>`),
|
|
48
|
+
_tmpl$30 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month role=grid aria-multiselectable=true data-lanes=true style=--k2b-calendar-lane:1.25rem;--k2b-calendar-lane-gap:0.125rem><!$><!/><!$><!/>`),
|
|
49
|
+
_tmpl$31 = /*#__PURE__*/_$template(`<div class=k2b-calendar-month-viewport><div class=k2b-calendar-month role=grid aria-multiselectable=true data-lanes=true data-continuous=true style=--k2b-calendar-lane:1.25rem;--k2b-calendar-lane-gap:0.125rem><!$><!/><div class=k2b-calendar-month__track role=rowgroup></div></div><div class=k2b-calendar-month__scroll-label aria-hidden=true>`),
|
|
50
|
+
_tmpl$32 = /*#__PURE__*/_$template(`<ul class=k2b-calendar-day-list__events>`),
|
|
51
|
+
_tmpl$33 = /*#__PURE__*/_$template(`<i class="ti ti-plus"aria-hidden=true>`),
|
|
52
|
+
_tmpl$34 = /*#__PURE__*/_$template(`<div class=k2b-calendar-day-list><div class=k2b-calendar-day-list__title></div><!$><!/><div class=k2b-calendar-day-list__actions><!$><!/><!$><!/>`),
|
|
53
|
+
_tmpl$35 = /*#__PURE__*/_$template(`<p class=k2b-calendar-day-list__empty>`),
|
|
54
|
+
_tmpl$36 = /*#__PURE__*/_$template(`<li>`),
|
|
55
|
+
_tmpl$37 = /*#__PURE__*/_$template(`<i class="ti ti-zoom-in"aria-hidden=true>`),
|
|
56
|
+
_tmpl$38 = /*#__PURE__*/_$template(`<div class=k2b-calendar-popover popover=auto role=dialog>`),
|
|
57
|
+
_tmpl$39 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__all-day><div class=k2b-calendar-time-grid__all-day-label></div><!$><!/>`),
|
|
58
|
+
_tmpl$40 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid><div class=k2b-calendar-time-grid__days><div class=k2b-calendar-time-grid__corner></div><!$><!/></div><!$><!/><div class="k2b-calendar-time-grid__scroll k2b-detail-trail"><div class=k2b-calendar-time-grid__grid><div class=k2b-calendar-time-grid__gutter></div><!$><!/>`),
|
|
59
|
+
_tmpl$41 = /*#__PURE__*/_$template(`<span class=k2b-calendar-time-grid__day-label>`),
|
|
60
|
+
_tmpl$42 = /*#__PURE__*/_$template(`<span class=k2b-calendar-time-grid__badge><!$><!/><!$><!/>`),
|
|
61
|
+
_tmpl$43 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__all-day-cell><div class=k2b-calendar-time-grid__all-day-events><!$><!/><!$><!/>`),
|
|
62
|
+
_tmpl$44 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__hour><!$><!/>:00`),
|
|
63
|
+
_tmpl$45 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__now>`),
|
|
64
|
+
_tmpl$46 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__column><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/>`),
|
|
65
|
+
_tmpl$47 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__slot>`),
|
|
66
|
+
_tmpl$48 = /*#__PURE__*/_$template(`<div class=k2b-calendar-preview__title>`),
|
|
67
|
+
_tmpl$49 = /*#__PURE__*/_$template(`<div class="k2b-calendar-preview k2b-calendar-preview--timed"><div class=k2b-calendar-preview__content><!$><!/><div class=k2b-calendar-preview__label><!$><!/> - <!$><!/>`),
|
|
68
|
+
_tmpl$50 = /*#__PURE__*/_$template(`<button type=button class=k2b-calendar-time-grid__resize><span class=k2b-calendar-time-grid__resize-icon aria-hidden=true>`),
|
|
69
|
+
_tmpl$51 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__event-position><div class=k2b-calendar-time-grid__event-frame><!$><!/><!$><!/>`),
|
|
70
|
+
_tmpl$52 = /*#__PURE__*/_$template(`<button type=button class=k2b-calendar-time-grid__overflow><span class=k2b-calendar-time-grid__overflow-count>+<!$><!/>`),
|
|
71
|
+
_tmpl$53 = /*#__PURE__*/_$template(`<div class=k2b-calendar-time-grid__overflow-menu><div class=k2b-calendar-time-grid__overflow-title><!$><!/> - <!$><!/></div><!$><!/>`),
|
|
72
|
+
_tmpl$54 = /*#__PURE__*/_$template(`<div class=k2b-calendar-year>`),
|
|
73
|
+
_tmpl$55 = /*#__PURE__*/_$template(`<div class=k2b-calendar-year__month><div class=k2b-calendar-year__title></div><div class=k2b-calendar-year__grid>`),
|
|
74
|
+
_tmpl$56 = /*#__PURE__*/_$template(`<span class=k2b-calendar-year__indicator>`),
|
|
75
|
+
_tmpl$57 = /*#__PURE__*/_$template(`<div class=k2b-calendar-mobile-month__events>`),
|
|
76
|
+
_tmpl$58 = /*#__PURE__*/_$template(`<div class=k2b-calendar-mobile-month><!$><!/><div class=k2b-calendar-mobile-month__agenda><div class=k2b-calendar-mobile-month__title></div><!$><!/>`),
|
|
77
|
+
_tmpl$59 = /*#__PURE__*/_$template(`<div class=k2b-calendar-mobile-month__empty>`),
|
|
78
|
+
_tmpl$60 = /*#__PURE__*/_$template(`<div class=k2b-calendar-body>`),
|
|
79
|
+
_tmpl$61 = /*#__PURE__*/_$template(`<section><!$><!/><!$><!/>`);
|
|
78
80
|
import { Link } from "@k2b/ssr/nav";
|
|
79
81
|
import { dates as calendar } from "@k2b/stdlib";
|
|
80
|
-
import { createEffect, createMemo, createSignal, For, mergeProps, on, onCleanup, onMount, Show, untrack } from "solid-js";
|
|
82
|
+
import { createComputed, createEffect, createMemo, createSignal, For, mergeProps, on, onCleanup, onMount, Show, untrack } from "solid-js";
|
|
81
83
|
import { Button } from "../actions/Button";
|
|
82
84
|
import { GestureMenu } from "../actions/GestureMenu";
|
|
83
85
|
import SegmentedControl from "../actions/SegmentedControl";
|
|
@@ -85,13 +87,15 @@ import { useDateConfigLocale } from "../intl/locale";
|
|
|
85
87
|
import { useUiMessages } from "../intl/messages";
|
|
86
88
|
import { CalendarDayView } from "./CalendarDayView";
|
|
87
89
|
import { CalendarWeekView } from "./CalendarWeekView";
|
|
90
|
+
import { addDayKeys } from "./calendar-days";
|
|
88
91
|
import { openCalendarGoTo, openCalendarShortcuts } from "./calendar-dialogs";
|
|
89
92
|
import { layoutCalendarIntervals } from "./calendar-event-layout";
|
|
90
93
|
import { useCalendarMessages } from "./calendar-messages";
|
|
91
94
|
import { fitMonthWeek, layoutMonthWeek, monthLaneCapacity } from "./calendar-month-layout";
|
|
95
|
+
import { MONTH_ROW_BLOCK, MONTH_ROWS_IN_VIEW, monthFocusRow, monthOfWeek, monthRenderWindow, monthRevealTop, monthRowOf, monthTodayDirection, monthVisibleRows, monthWeekKeys } from "./calendar-month-scroll";
|
|
92
96
|
import { calendarDayIndexAtPoint, calendarMinuteAtPoint, startCalendarPointerSession } from "./calendar-pointer";
|
|
93
97
|
import { EventChip, eventHref, followCalendarHref, formatTime, ownerDateConfig, parseDate, placeCalendarPopover, textWidth, validDate } from "./calendar-shared";
|
|
94
|
-
import { compactGermanDate } from "./calendar-time-view";
|
|
98
|
+
import { compactGermanDate, reducedMotion } from "./calendar-time-view";
|
|
95
99
|
|
|
96
100
|
/** The days a host loaded events for, from the first day `from` up to `to`, both `YYYY-MM-DD` or dates. */
|
|
97
101
|
|
|
@@ -446,11 +450,13 @@ const CalendarHeader = props => {
|
|
|
446
450
|
const calendarMessages = useCalendarMessages();
|
|
447
451
|
const dateConfig = () => ownerDateConfig(props.owner);
|
|
448
452
|
const timeView = () => props.nav.timeView();
|
|
453
|
+
const monthView = () => props.nav.monthView();
|
|
454
|
+
const scrollingView = () => timeView() ?? monthView();
|
|
449
455
|
const parseKey = key => calendar.parseCalendarDate(key, dateConfig());
|
|
450
456
|
/** The date the header pages from: the first day a day or week view shows, else the date. */
|
|
451
457
|
const base = () => {
|
|
452
458
|
const shown = timeView()?.visibleKeys().first;
|
|
453
|
-
return shown ? parseKey(shown) : props.date;
|
|
459
|
+
return shown ? parseKey(shown) : monthView()?.stepFrom() ?? props.date;
|
|
454
460
|
};
|
|
455
461
|
const previous = () => adjacentCalendarDate(base(), props.view, -1, dateConfig());
|
|
456
462
|
const next = () => adjacentCalendarDate(base(), props.view, 1, dateConfig());
|
|
@@ -484,7 +490,7 @@ const CalendarHeader = props => {
|
|
|
484
490
|
timeZone: dateConfig().timeZone
|
|
485
491
|
});
|
|
486
492
|
if (props.view === "week") return `${formatDay(calendar.startOfWeek(props.date, dateConfig()), dateConfig())} - ${formatDay(calendar.addDays(calendar.startOfWeek(props.date, dateConfig()), 6, dateConfig()), dateConfig())}`;
|
|
487
|
-
return formatMonth(props.date, dateConfig());
|
|
493
|
+
return formatMonth(monthView()?.focusMonth() ?? props.date, dateConfig());
|
|
488
494
|
};
|
|
489
495
|
/**
|
|
490
496
|
* The titles this view can show around the current date: the months of the year, the weeks of the month and across
|
|
@@ -548,52 +554,63 @@ const CalendarHeader = props => {
|
|
|
548
554
|
const href = props.owner.getViewHref?.(view);
|
|
549
555
|
if (href) window.location.href = href;
|
|
550
556
|
};
|
|
557
|
+
/**
|
|
558
|
+
* A previous or next button. Its element stays while its target changes, such as with each step through the months,
|
|
559
|
+
* so a repeated click or Enter lands on the same button and keeps its focus.
|
|
560
|
+
*/
|
|
551
561
|
const navButton = (date, icon, label, direction) => {
|
|
552
|
-
const href = props.owner.getDateHref?.(date, props.view);
|
|
553
|
-
const step = () =>
|
|
554
|
-
const title = props.nav.commands().length > 0 ? `${label} (${direction > 0 ? "J" : "K"})` : label;
|
|
555
|
-
|
|
562
|
+
const href = () => props.owner.getDateHref?.(date(), props.view);
|
|
563
|
+
const step = () => scrollingView()?.step(direction) ?? false;
|
|
564
|
+
const title = () => props.nav.commands().length > 0 ? `${label} (${direction > 0 ? "J" : "K"})` : label;
|
|
565
|
+
const link = target => _$createComponent(CalendarNavigationLink, {
|
|
556
566
|
get owner() {
|
|
557
567
|
return props.owner;
|
|
558
568
|
},
|
|
559
|
-
href
|
|
569
|
+
get href() {
|
|
570
|
+
return target();
|
|
571
|
+
},
|
|
560
572
|
intercept: step,
|
|
561
|
-
anchorProps
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
573
|
+
get anchorProps() {
|
|
574
|
+
return {
|
|
575
|
+
"aria-label": label,
|
|
576
|
+
title: title(),
|
|
577
|
+
class: "k2b-calendar-header__nav-button"
|
|
578
|
+
};
|
|
565
579
|
},
|
|
566
580
|
get children() {
|
|
567
581
|
var _el$4 = _$getNextElement(_tmpl$3);
|
|
568
582
|
_$className(_el$4, `ti ${icon}`);
|
|
569
583
|
return _el$4;
|
|
570
584
|
}
|
|
571
|
-
})
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (!step()) goDate(date);
|
|
576
|
-
};
|
|
577
|
-
_$setAttribute(_el$5, "aria-label", label);
|
|
578
|
-
_$setAttribute(_el$5, "title", title);
|
|
579
|
-
_$className(_el$6, `ti ${icon}`);
|
|
580
|
-
_$runHydrationEvents();
|
|
581
|
-
return _el$5;
|
|
582
|
-
})() : _$createComponent(CalendarNavigationLink, {
|
|
583
|
-
get owner() {
|
|
584
|
-
return props.owner;
|
|
585
|
+
});
|
|
586
|
+
return _$createComponent(Show, {
|
|
587
|
+
get when() {
|
|
588
|
+
return Boolean((props.owner.onNavigateHref || props.owner.onNavigate) && href());
|
|
585
589
|
},
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
590
|
+
get fallback() {
|
|
591
|
+
return _$createComponent(Show, {
|
|
592
|
+
get when() {
|
|
593
|
+
return props.owner.onDateChange;
|
|
594
|
+
},
|
|
595
|
+
get fallback() {
|
|
596
|
+
return link(() => href() ?? "#");
|
|
597
|
+
},
|
|
598
|
+
get children() {
|
|
599
|
+
var _el$5 = _$getNextElement(_tmpl$4),
|
|
600
|
+
_el$6 = _el$5.firstChild;
|
|
601
|
+
_el$5.$$click = () => {
|
|
602
|
+
if (!step()) goDate(date());
|
|
603
|
+
};
|
|
604
|
+
_$setAttribute(_el$5, "aria-label", label);
|
|
605
|
+
_$className(_el$6, `ti ${icon}`);
|
|
606
|
+
_$effect(() => _$setAttribute(_el$5, "title", title()));
|
|
607
|
+
_$runHydrationEvents();
|
|
608
|
+
return _el$5;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
592
611
|
},
|
|
593
612
|
get children() {
|
|
594
|
-
|
|
595
|
-
_$className(_el$7, `ti ${icon}`);
|
|
596
|
-
return _el$7;
|
|
613
|
+
return link(() => href() ?? "#");
|
|
597
614
|
}
|
|
598
615
|
});
|
|
599
616
|
};
|
|
@@ -601,7 +618,7 @@ const CalendarHeader = props => {
|
|
|
601
618
|
* In the day and week views that scroll through their days, Today points where today lies, or shows a calm dot while
|
|
602
619
|
* it is on screen; the icon keeps its place either way. The other views name their period in the title.
|
|
603
620
|
*/
|
|
604
|
-
const direction = () => timeMode() ? (
|
|
621
|
+
const direction = () => timeMode() || monthView() ? (scrollingView()?.todayDirection() ?? todayDirectionOf(String(props.view), props.date, dateConfig())) || "here" : undefined;
|
|
605
622
|
/** One arrow that the stylesheet turns toward today, or the dot while today shows. */
|
|
606
623
|
const todayIcon = () => _$createComponent(Show, {
|
|
607
624
|
get when() {
|
|
@@ -622,12 +639,12 @@ const CalendarHeader = props => {
|
|
|
622
639
|
const todayButton = () => {
|
|
623
640
|
const today = calendar.today(dateConfig());
|
|
624
641
|
const href = props.owner.getDateHref?.(today, props.view);
|
|
625
|
-
const intercept = () =>
|
|
642
|
+
const intercept = () => scrollingView()?.today() ?? false;
|
|
626
643
|
const title = () => props.nav.commands().length > 0 ? `${props.labels.today} (H)` : undefined;
|
|
627
644
|
const label = [_$memo(todayIcon), (() => {
|
|
628
|
-
var _el$
|
|
629
|
-
_$insert(_el$
|
|
630
|
-
return _el$
|
|
645
|
+
var _el$9 = _$getNextElement(_tmpl$7);
|
|
646
|
+
_$insert(_el$9, () => props.labels.today);
|
|
647
|
+
return _el$9;
|
|
631
648
|
})()];
|
|
632
649
|
return (props.owner.onNavigateHref || props.owner.onNavigate) && href ? _$createComponent(CalendarNavigationLink, {
|
|
633
650
|
get owner() {
|
|
@@ -694,54 +711,54 @@ const CalendarHeader = props => {
|
|
|
694
711
|
label: props.labels.year
|
|
695
712
|
}].filter(option => !props.owner.views || props.owner.views.includes(option.value)), ...(props.owner.customViews ?? [])]);
|
|
696
713
|
return (() => {
|
|
697
|
-
var _el$
|
|
698
|
-
_el$
|
|
699
|
-
_el$
|
|
700
|
-
[_el$
|
|
701
|
-
_el$
|
|
702
|
-
[_el$
|
|
703
|
-
_el$
|
|
704
|
-
_el$
|
|
705
|
-
_el$
|
|
706
|
-
[_el$
|
|
707
|
-
_el$
|
|
708
|
-
[_el$
|
|
709
|
-
_el$
|
|
710
|
-
_el$
|
|
711
|
-
[_el$
|
|
712
|
-
_el$
|
|
713
|
-
[_el$
|
|
714
|
-
_el$
|
|
715
|
-
[_el$
|
|
716
|
-
_el$
|
|
717
|
-
[_el$
|
|
718
|
-
_el$
|
|
719
|
-
[_el$
|
|
720
|
-
_$insert(_el$
|
|
721
|
-
_$insert(_el$
|
|
722
|
-
_$insert(_el$
|
|
723
|
-
_$insert(_el$
|
|
714
|
+
var _el$0 = _$getNextElement(_tmpl$1),
|
|
715
|
+
_el$1 = _el$0.firstChild,
|
|
716
|
+
_el$14 = _el$1.firstChild,
|
|
717
|
+
[_el$15, _co$2] = _$getNextMarker(_el$14.nextSibling),
|
|
718
|
+
_el$16 = _el$15.nextSibling,
|
|
719
|
+
[_el$17, _co$3] = _$getNextMarker(_el$16.nextSibling),
|
|
720
|
+
_el$10 = _el$17.nextSibling,
|
|
721
|
+
_el$11 = _el$10.firstChild,
|
|
722
|
+
_el$12 = _el$11.nextSibling,
|
|
723
|
+
[_el$13, _co$] = _$getNextMarker(_el$12.nextSibling),
|
|
724
|
+
_el$30 = _el$1.nextSibling,
|
|
725
|
+
[_el$31, _co$8] = _$getNextMarker(_el$30.nextSibling),
|
|
726
|
+
_el$19 = _el$31.nextSibling,
|
|
727
|
+
_el$21 = _el$19.firstChild,
|
|
728
|
+
[_el$22, _co$4] = _$getNextMarker(_el$21.nextSibling),
|
|
729
|
+
_el$23 = _el$22.nextSibling,
|
|
730
|
+
[_el$24, _co$5] = _$getNextMarker(_el$23.nextSibling),
|
|
731
|
+
_el$25 = _el$24.nextSibling,
|
|
732
|
+
[_el$26, _co$6] = _$getNextMarker(_el$25.nextSibling),
|
|
733
|
+
_el$27 = _el$26.nextSibling,
|
|
734
|
+
[_el$28, _co$7] = _$getNextMarker(_el$27.nextSibling),
|
|
735
|
+
_el$32 = _el$19.nextSibling,
|
|
736
|
+
[_el$33, _co$9] = _$getNextMarker(_el$32.nextSibling);
|
|
737
|
+
_$insert(_el$1, () => navButton(previous, "ti-chevron-left", props.labels.previous, -1), _el$15, _co$2);
|
|
738
|
+
_$insert(_el$1, () => navButton(next, "ti-chevron-right", props.labels.next, 1), _el$17, _co$3);
|
|
739
|
+
_$insert(_el$11, title);
|
|
740
|
+
_$insert(_el$10, _$createComponent(For, {
|
|
724
741
|
get each() {
|
|
725
742
|
return titleWidths();
|
|
726
743
|
},
|
|
727
744
|
children: candidate => (() => {
|
|
728
|
-
var _el$
|
|
729
|
-
_$insert(_el$
|
|
730
|
-
return _el$
|
|
745
|
+
var _el$34 = _$getNextElement(_tmpl$10);
|
|
746
|
+
_$insert(_el$34, candidate);
|
|
747
|
+
return _el$34;
|
|
731
748
|
})()
|
|
732
|
-
}), _el$
|
|
733
|
-
_$insert(_el$
|
|
749
|
+
}), _el$13, _co$);
|
|
750
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
734
751
|
get when() {
|
|
735
752
|
return props.owner.toolbarContent;
|
|
736
753
|
},
|
|
737
754
|
get children() {
|
|
738
|
-
var _el$
|
|
739
|
-
_$insert(_el$
|
|
740
|
-
return _el$
|
|
755
|
+
var _el$18 = _$getNextElement(_tmpl$8);
|
|
756
|
+
_$insert(_el$18, () => props.owner.toolbarContent);
|
|
757
|
+
return _el$18;
|
|
741
758
|
}
|
|
742
|
-
}), _el$
|
|
743
|
-
_$insert(_el$
|
|
744
|
-
_$insert(_el$
|
|
759
|
+
}), _el$31, _co$8);
|
|
760
|
+
_$insert(_el$19, todayButton, _el$22, _co$4);
|
|
761
|
+
_$insert(_el$19, _$createComponent(Show, {
|
|
745
762
|
get when() {
|
|
746
763
|
return _$memo(() => !!!props.owner.onViewChange)() && props.owner.getViewHref;
|
|
747
764
|
},
|
|
@@ -774,38 +791,38 @@ const CalendarHeader = props => {
|
|
|
774
791
|
}
|
|
775
792
|
});
|
|
776
793
|
}
|
|
777
|
-
}), _el$
|
|
778
|
-
_$insert(_el$
|
|
779
|
-
_$insert(_el$
|
|
794
|
+
}), _el$24, _co$5);
|
|
795
|
+
_$insert(_el$19, () => props.owner.toolbarActions, _el$26, _co$6);
|
|
796
|
+
_$insert(_el$19, _$createComponent(Show, {
|
|
780
797
|
get when() {
|
|
781
798
|
return props.nav.commands().length > 0;
|
|
782
799
|
},
|
|
783
800
|
get children() {
|
|
784
|
-
var _el$
|
|
785
|
-
_el$
|
|
801
|
+
var _el$20 = _$getNextElement(_tmpl$9);
|
|
802
|
+
_el$20.$$click = () => props.nav.openShortcuts();
|
|
786
803
|
_$effect(_p$ => {
|
|
787
804
|
var _v$ = calendarMessages().calendarShortcuts,
|
|
788
805
|
_v$2 = calendarMessages().calendarShortcuts;
|
|
789
|
-
_v$ !== _p$.e && _$setAttribute(_el$
|
|
790
|
-
_v$2 !== _p$.t && _$setAttribute(_el$
|
|
806
|
+
_v$ !== _p$.e && _$setAttribute(_el$20, "aria-label", _p$.e = _v$);
|
|
807
|
+
_v$2 !== _p$.t && _$setAttribute(_el$20, "title", _p$.t = _v$2);
|
|
791
808
|
return _p$;
|
|
792
809
|
}, {
|
|
793
810
|
e: undefined,
|
|
794
811
|
t: undefined
|
|
795
812
|
});
|
|
796
813
|
_$runHydrationEvents();
|
|
797
|
-
return _el$
|
|
814
|
+
return _el$20;
|
|
798
815
|
}
|
|
799
|
-
}), _el$
|
|
800
|
-
_$insert(_el$
|
|
816
|
+
}), _el$28, _co$7);
|
|
817
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
801
818
|
get when() {
|
|
802
819
|
return props.owner.navigationPending;
|
|
803
820
|
},
|
|
804
821
|
get children() {
|
|
805
822
|
return _$getNextElement(_tmpl$0);
|
|
806
823
|
}
|
|
807
|
-
}), _el$
|
|
808
|
-
return _el$
|
|
824
|
+
}), _el$33, _co$9);
|
|
825
|
+
return _el$0;
|
|
809
826
|
})();
|
|
810
827
|
};
|
|
811
828
|
|
|
@@ -865,55 +882,55 @@ const MonthPickerView = props => {
|
|
|
865
882
|
};
|
|
866
883
|
onCleanup(() => cancelInteraction?.());
|
|
867
884
|
return (() => {
|
|
868
|
-
var _el$
|
|
869
|
-
_el$
|
|
870
|
-
_el$
|
|
871
|
-
[_el$
|
|
872
|
-
_el$
|
|
873
|
-
[_el$
|
|
874
|
-
_el$
|
|
875
|
-
[_el$
|
|
876
|
-
_$insert(_el$
|
|
885
|
+
var _el$35 = _$getNextElement(_tmpl$12),
|
|
886
|
+
_el$36 = _el$35.firstChild,
|
|
887
|
+
_el$38 = _el$36.firstChild,
|
|
888
|
+
[_el$39, _co$0] = _$getNextMarker(_el$38.nextSibling),
|
|
889
|
+
_el$40 = _el$39.nextSibling,
|
|
890
|
+
[_el$41, _co$1] = _$getNextMarker(_el$40.nextSibling),
|
|
891
|
+
_el$42 = _el$36.nextSibling,
|
|
892
|
+
[_el$43, _co$10] = _$getNextMarker(_el$42.nextSibling);
|
|
893
|
+
_$insert(_el$36, _$createComponent(Show, {
|
|
877
894
|
get when() {
|
|
878
895
|
return props.owner.withWeekNumbers;
|
|
879
896
|
},
|
|
880
897
|
get children() {
|
|
881
|
-
var _el$
|
|
882
|
-
_$insert(_el$
|
|
883
|
-
return _el$
|
|
898
|
+
var _el$37 = _$getNextElement(_tmpl$11);
|
|
899
|
+
_$insert(_el$37, () => calendarMessages().weekShort);
|
|
900
|
+
return _el$37;
|
|
884
901
|
}
|
|
885
|
-
}), _el$
|
|
886
|
-
_$insert(_el$
|
|
902
|
+
}), _el$39, _co$0);
|
|
903
|
+
_$insert(_el$36, _$createComponent(For, {
|
|
887
904
|
get each() {
|
|
888
905
|
return weekdays();
|
|
889
906
|
},
|
|
890
907
|
children: day => (() => {
|
|
891
|
-
var _el$
|
|
892
|
-
_$insert(_el$
|
|
893
|
-
return _el$
|
|
908
|
+
var _el$44 = _$getNextElement(_tmpl$11);
|
|
909
|
+
_$insert(_el$44, day);
|
|
910
|
+
return _el$44;
|
|
894
911
|
})()
|
|
895
|
-
}), _el$
|
|
896
|
-
_$insert(_el$
|
|
912
|
+
}), _el$41, _co$1);
|
|
913
|
+
_$insert(_el$35, _$createComponent(For, {
|
|
897
914
|
get each() {
|
|
898
915
|
return weeks();
|
|
899
916
|
},
|
|
900
917
|
children: week => (() => {
|
|
901
|
-
var _el$
|
|
902
|
-
_el$
|
|
903
|
-
[_el$
|
|
904
|
-
_el$
|
|
905
|
-
[_el$
|
|
906
|
-
_$insert(_el$
|
|
918
|
+
var _el$45 = _$getNextElement(_tmpl$14),
|
|
919
|
+
_el$47 = _el$45.firstChild,
|
|
920
|
+
[_el$48, _co$11] = _$getNextMarker(_el$47.nextSibling),
|
|
921
|
+
_el$49 = _el$48.nextSibling,
|
|
922
|
+
[_el$50, _co$12] = _$getNextMarker(_el$49.nextSibling);
|
|
923
|
+
_$insert(_el$45, _$createComponent(Show, {
|
|
907
924
|
get when() {
|
|
908
925
|
return props.owner.withWeekNumbers;
|
|
909
926
|
},
|
|
910
927
|
get children() {
|
|
911
|
-
var _el$
|
|
912
|
-
_$insert(_el$
|
|
913
|
-
return _el$
|
|
928
|
+
var _el$46 = _$getNextElement(_tmpl$13);
|
|
929
|
+
_$insert(_el$46, () => zonedWeekNumber(week[0], dateConfig()));
|
|
930
|
+
return _el$46;
|
|
914
931
|
}
|
|
915
|
-
}), _el$
|
|
916
|
-
_$insert(_el$
|
|
932
|
+
}), _el$48, _co$11);
|
|
933
|
+
_$insert(_el$45, _$createComponent(For, {
|
|
917
934
|
each: week,
|
|
918
935
|
children: day => {
|
|
919
936
|
const dayKey = calendar.formatDateKey(day, dateConfig());
|
|
@@ -941,25 +958,25 @@ const MonthPickerView = props => {
|
|
|
941
958
|
};
|
|
942
959
|
});
|
|
943
960
|
return (() => {
|
|
944
|
-
var _el$
|
|
945
|
-
_el$
|
|
946
|
-
[_el$
|
|
947
|
-
_el$
|
|
948
|
-
_el$
|
|
949
|
-
[_el$
|
|
950
|
-
_el$
|
|
951
|
-
[_el$
|
|
952
|
-
_el$
|
|
953
|
-
_el$
|
|
954
|
-
[_el$
|
|
955
|
-
_el$
|
|
956
|
-
[_el$
|
|
957
|
-
_el$
|
|
958
|
-
[_el$
|
|
959
|
-
_el$
|
|
960
|
-
_$setAttribute(_el$
|
|
961
|
-
_$setAttribute(_el$
|
|
962
|
-
_$insert(_el$
|
|
961
|
+
var _el$51 = _$getNextElement(_tmpl$17),
|
|
962
|
+
_el$67 = _el$51.firstChild,
|
|
963
|
+
[_el$68, _co$18] = _$getNextMarker(_el$67.nextSibling),
|
|
964
|
+
_el$53 = _el$68.nextSibling,
|
|
965
|
+
_el$54 = _el$53.firstChild,
|
|
966
|
+
[_el$55, _co$13] = _$getNextMarker(_el$54.nextSibling),
|
|
967
|
+
_el$56 = _el$55.nextSibling,
|
|
968
|
+
[_el$57, _co$14] = _$getNextMarker(_el$56.nextSibling),
|
|
969
|
+
_el$58 = _el$53.nextSibling,
|
|
970
|
+
_el$60 = _el$58.firstChild,
|
|
971
|
+
[_el$61, _co$15] = _$getNextMarker(_el$60.nextSibling),
|
|
972
|
+
_el$62 = _el$61.nextSibling,
|
|
973
|
+
[_el$63, _co$16] = _$getNextMarker(_el$62.nextSibling),
|
|
974
|
+
_el$64 = _el$63.nextSibling,
|
|
975
|
+
[_el$65, _co$17] = _$getNextMarker(_el$64.nextSibling),
|
|
976
|
+
_el$66 = _el$58.nextSibling;
|
|
977
|
+
_$setAttribute(_el$51, "data-calendar-day-key", dayKey);
|
|
978
|
+
_$setAttribute(_el$51, "data-outside", !sameMonth ? "true" : undefined);
|
|
979
|
+
_$insert(_el$51, _$createComponent(Show, {
|
|
963
980
|
get when() {
|
|
964
981
|
return props.owner.onSlotActivate;
|
|
965
982
|
},
|
|
@@ -985,8 +1002,8 @@ const MonthPickerView = props => {
|
|
|
985
1002
|
});
|
|
986
1003
|
},
|
|
987
1004
|
get children() {
|
|
988
|
-
var _el$
|
|
989
|
-
_$spread(_el$
|
|
1005
|
+
var _el$52 = _$getNextElement(_tmpl$15);
|
|
1006
|
+
_$spread(_el$52, _$mergeProps({
|
|
990
1007
|
get ["aria-label"]() {
|
|
991
1008
|
return calendarMessages().createEventOn({
|
|
992
1009
|
label: dayLabel
|
|
@@ -1001,20 +1018,20 @@ const MonthPickerView = props => {
|
|
|
1001
1018
|
};
|
|
1002
1019
|
}, () => performance.now() < suppressSlotClickUntil, true)), false, false);
|
|
1003
1020
|
_$runHydrationEvents();
|
|
1004
|
-
return _el$
|
|
1021
|
+
return _el$52;
|
|
1005
1022
|
}
|
|
1006
|
-
}), _el$
|
|
1007
|
-
_$insert(_el$
|
|
1023
|
+
}), _el$68, _co$18);
|
|
1024
|
+
_$insert(_el$53, _$createComponent(Show, {
|
|
1008
1025
|
get when() {
|
|
1009
1026
|
return props.owner.onSlotActivate && href;
|
|
1010
1027
|
},
|
|
1011
1028
|
get fallback() {
|
|
1012
1029
|
return (() => {
|
|
1013
|
-
var _el$
|
|
1014
|
-
_$setAttribute(_el$
|
|
1015
|
-
_$setAttribute(_el$
|
|
1016
|
-
_$insert(_el$
|
|
1017
|
-
return _el$
|
|
1030
|
+
var _el$69 = _$getNextElement(_tmpl$18);
|
|
1031
|
+
_$setAttribute(_el$69, "data-today", isToday ? "true" : undefined);
|
|
1032
|
+
_$setAttribute(_el$69, "data-outside", !sameMonth ? "true" : undefined);
|
|
1033
|
+
_$insert(_el$69, () => calendar.formatDayNumber(day, dateConfig()));
|
|
1034
|
+
return _el$69;
|
|
1018
1035
|
})();
|
|
1019
1036
|
},
|
|
1020
1037
|
children: dayHref => _$createComponent(CalendarNavigationLink, {
|
|
@@ -1038,40 +1055,40 @@ const MonthPickerView = props => {
|
|
|
1038
1055
|
return calendar.formatDayNumber(day, dateConfig());
|
|
1039
1056
|
}
|
|
1040
1057
|
})
|
|
1041
|
-
}), _el$
|
|
1042
|
-
_$insert(_el$
|
|
1058
|
+
}), _el$55, _co$13);
|
|
1059
|
+
_$insert(_el$53, _$createComponent(Show, {
|
|
1043
1060
|
when: dayBadge,
|
|
1044
1061
|
children: badge => (() => {
|
|
1045
|
-
var _el$
|
|
1046
|
-
_el$
|
|
1047
|
-
[_el$
|
|
1048
|
-
_el$
|
|
1049
|
-
[_el$
|
|
1050
|
-
_$insert(_el$
|
|
1062
|
+
var _el$70 = _$getNextElement(_tmpl$19),
|
|
1063
|
+
_el$71 = _el$70.firstChild,
|
|
1064
|
+
[_el$72, _co$19] = _$getNextMarker(_el$71.nextSibling),
|
|
1065
|
+
_el$73 = _el$72.nextSibling,
|
|
1066
|
+
[_el$74, _co$20] = _$getNextMarker(_el$73.nextSibling);
|
|
1067
|
+
_$insert(_el$70, _$createComponent(Show, {
|
|
1051
1068
|
get when() {
|
|
1052
1069
|
return badge().icon;
|
|
1053
1070
|
},
|
|
1054
1071
|
children: icon => (() => {
|
|
1055
|
-
var _el$
|
|
1056
|
-
_$effect(() => _$className(_el$
|
|
1057
|
-
return _el$
|
|
1072
|
+
var _el$75 = _$getNextElement(_tmpl$3);
|
|
1073
|
+
_$effect(() => _$className(_el$75, `k2b-calendar-month__badge-icon ti ti-${icon()}`));
|
|
1074
|
+
return _el$75;
|
|
1058
1075
|
})()
|
|
1059
|
-
}), _el$
|
|
1060
|
-
_$insert(_el$
|
|
1061
|
-
return _el$
|
|
1076
|
+
}), _el$72, _co$19);
|
|
1077
|
+
_$insert(_el$70, () => badge().label, _el$74, _co$20);
|
|
1078
|
+
return _el$70;
|
|
1062
1079
|
})()
|
|
1063
|
-
}), _el$
|
|
1064
|
-
_$insert(_el$
|
|
1080
|
+
}), _el$57, _co$14);
|
|
1081
|
+
_$insert(_el$58, _$createComponent(Show, {
|
|
1065
1082
|
get when() {
|
|
1066
1083
|
return eventStack().preview;
|
|
1067
1084
|
},
|
|
1068
1085
|
get children() {
|
|
1069
|
-
var _el$
|
|
1070
|
-
_$insert(_el$
|
|
1071
|
-
return _el$
|
|
1086
|
+
var _el$59 = _$getNextElement(_tmpl$16);
|
|
1087
|
+
_$insert(_el$59, () => props.events.find(event => event.id === eventStack().preview.id)?.title ?? calendarMessages().moveEvent);
|
|
1088
|
+
return _el$59;
|
|
1072
1089
|
}
|
|
1073
|
-
}), _el$
|
|
1074
|
-
_$insert(_el$
|
|
1090
|
+
}), _el$61, _co$15);
|
|
1091
|
+
_$insert(_el$58, _$createComponent(For, {
|
|
1075
1092
|
get each() {
|
|
1076
1093
|
return eventStack().visibleEvents;
|
|
1077
1094
|
},
|
|
@@ -1091,8 +1108,8 @@ const MonthPickerView = props => {
|
|
|
1091
1108
|
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startMove(pointerEvent, event, markDragged) : undefined;
|
|
1092
1109
|
}
|
|
1093
1110
|
})
|
|
1094
|
-
}), _el$
|
|
1095
|
-
_$insert(_el$
|
|
1111
|
+
}), _el$63, _co$16);
|
|
1112
|
+
_$insert(_el$58, _$createComponent(Show, {
|
|
1096
1113
|
get when() {
|
|
1097
1114
|
return eventStack().hiddenCount > 0;
|
|
1098
1115
|
},
|
|
@@ -1112,54 +1129,54 @@ const MonthPickerView = props => {
|
|
|
1112
1129
|
}
|
|
1113
1130
|
});
|
|
1114
1131
|
}
|
|
1115
|
-
}), _el$
|
|
1116
|
-
_$insert(_el$
|
|
1132
|
+
}), _el$65, _co$17);
|
|
1133
|
+
_$insert(_el$66, _$createComponent(For, {
|
|
1117
1134
|
get each() {
|
|
1118
1135
|
return events.slice(0, 4);
|
|
1119
1136
|
},
|
|
1120
1137
|
children: event => (() => {
|
|
1121
|
-
var _el$
|
|
1138
|
+
var _el$76 = _$getNextElement(_tmpl$20);
|
|
1122
1139
|
_$effect(_p$ => {
|
|
1123
1140
|
var _v$5 = event.colorHex ? undefined : event.color ?? "blue",
|
|
1124
1141
|
_v$6 = event.colorHex ? {
|
|
1125
1142
|
"background-color": event.colorHex
|
|
1126
1143
|
} : undefined;
|
|
1127
|
-
_v$5 !== _p$.e && _$setAttribute(_el$
|
|
1128
|
-
_p$.t = _$style(_el$
|
|
1144
|
+
_v$5 !== _p$.e && _$setAttribute(_el$76, "data-color", _p$.e = _v$5);
|
|
1145
|
+
_p$.t = _$style(_el$76, _v$6, _p$.t);
|
|
1129
1146
|
return _p$;
|
|
1130
1147
|
}, {
|
|
1131
1148
|
e: undefined,
|
|
1132
1149
|
t: undefined
|
|
1133
1150
|
});
|
|
1134
|
-
return _el$
|
|
1151
|
+
return _el$76;
|
|
1135
1152
|
})()
|
|
1136
1153
|
}));
|
|
1137
|
-
_$effect(() => _$setAttribute(_el$
|
|
1138
|
-
return _el$
|
|
1154
|
+
_$effect(() => _$setAttribute(_el$51, "data-drop-preview", movePreview()?.start && calendar.formatDateKey(movePreview().start, dateConfig()) === dayKey ? "true" : undefined));
|
|
1155
|
+
return _el$51;
|
|
1139
1156
|
})();
|
|
1140
1157
|
}
|
|
1141
|
-
}), _el$
|
|
1142
|
-
_$effect(() => _$setAttribute(_el$
|
|
1143
|
-
return _el$
|
|
1158
|
+
}), _el$50, _co$12);
|
|
1159
|
+
_$effect(() => _$setAttribute(_el$45, "data-week-numbers", props.owner.withWeekNumbers ? "true" : undefined));
|
|
1160
|
+
return _el$45;
|
|
1144
1161
|
})()
|
|
1145
|
-
}), _el$
|
|
1162
|
+
}), _el$43, _co$10);
|
|
1146
1163
|
_$effect(_p$ => {
|
|
1147
1164
|
var _v$3 = `auto repeat(${weeks().length}, ${props.compact ? "minmax(2.75rem, auto)" : "minmax(5rem, 1fr)"})`,
|
|
1148
1165
|
_v$4 = props.owner.withWeekNumbers ? "true" : undefined;
|
|
1149
|
-
_v$3 !== _p$.e && _$setStyleProperty(_el$
|
|
1150
|
-
_v$4 !== _p$.t && _$setAttribute(_el$
|
|
1166
|
+
_v$3 !== _p$.e && _$setStyleProperty(_el$35, "grid-template-rows", _p$.e = _v$3);
|
|
1167
|
+
_v$4 !== _p$.t && _$setAttribute(_el$36, "data-week-numbers", _p$.t = _v$4);
|
|
1151
1168
|
return _p$;
|
|
1152
1169
|
}, {
|
|
1153
1170
|
e: undefined,
|
|
1154
1171
|
t: undefined
|
|
1155
1172
|
});
|
|
1156
|
-
return _el$
|
|
1173
|
+
return _el$35;
|
|
1157
1174
|
})();
|
|
1158
1175
|
};
|
|
1159
1176
|
|
|
1160
1177
|
/** One entry of the month grid: its whole range, and the days it covers as `YYYY-MM-DD` keys. */
|
|
1161
1178
|
|
|
1162
|
-
/** What the calendar's controller
|
|
1179
|
+
/** What the calendar's controller and header ask of the month view; the rest serves the month that scrolls. */
|
|
1163
1180
|
|
|
1164
1181
|
/** Lane height and gap of the month entries, in rem; the stylesheet reads both from the grid's custom properties. */
|
|
1165
1182
|
const MONTH_LANE_REM = 1.25;
|
|
@@ -1219,9 +1236,13 @@ const PRINTABLE_KEY = /^.$/u;
|
|
|
1219
1236
|
const MonthView = props => {
|
|
1220
1237
|
const calendarMessages = useCalendarMessages();
|
|
1221
1238
|
const dateConfig = createMemo(() => ownerDateConfig(props.owner));
|
|
1239
|
+
const continuous = createMemo(() => Boolean(props.owner.range));
|
|
1240
|
+
const [mounted, setMounted] = createSignal(false);
|
|
1241
|
+
const hostMonthKey = () => calendar.formatDateKey(calendar.startOfMonth(props.date, dateConfig()), dateConfig());
|
|
1242
|
+
const [focusMonthKey, setFocusMonthKey] = createSignal(untrack(hostMonthKey));
|
|
1222
1243
|
// The shown month and its grid change only with the month, so a refresh of the same month keeps every cell and its
|
|
1223
1244
|
// focus.
|
|
1224
|
-
const month = createMemo(() => zonedYearMonth(props.date, dateConfig()), undefined, {
|
|
1245
|
+
const month = createMemo(() => zonedYearMonth(continuous() ? calendar.parseCalendarDate(focusMonthKey(), dateConfig()) : props.date, dateConfig()), undefined, {
|
|
1225
1246
|
equals: (previous, next) => previous.year === next.year && previous.month === next.month
|
|
1226
1247
|
});
|
|
1227
1248
|
const weeks = createMemo(() => calendar.getMonthGrid(month().year, month().month, dateConfig()).map(week => week.map(day => ({
|
|
@@ -1233,17 +1254,12 @@ const MonthView = props => {
|
|
|
1233
1254
|
const weekdays = createMemo(() => calendar.weekdays(dateConfig()));
|
|
1234
1255
|
const todayKey = createMemo(() => calendar.formatDateKey(props.now, dateConfig()));
|
|
1235
1256
|
const items = createMemo(() => monthItems(props.events));
|
|
1236
|
-
const weekLayouts = createMemo(() => weeks().map(week => layoutMonthWeek(week.map(entry => entry.key), items().map(item => ({
|
|
1237
|
-
item,
|
|
1238
|
-
firstKey: item.firstKey,
|
|
1239
|
-
lastKey: item.lastKey,
|
|
1240
|
-
bar: item.bar
|
|
1241
|
-
})))));
|
|
1242
1257
|
const [capacities, setCapacities] = createSignal([]);
|
|
1243
1258
|
const [cellWidth, setCellWidth] = createSignal(0);
|
|
1244
1259
|
const [barFont, setBarFont] = createSignal("");
|
|
1245
1260
|
const [anchorKey, setAnchorKey] = createSignal(null);
|
|
1246
1261
|
const [focusKey, setFocusKey] = createSignal(null);
|
|
1262
|
+
const [focusedCellKey, setFocusedCellKey] = createSignal(null);
|
|
1247
1263
|
const [popover, setPopover] = createSignal(null);
|
|
1248
1264
|
/** Whether the quick create holds the focus; until then the grid keeps it. */
|
|
1249
1265
|
const [createActive, setCreateActive] = createSignal(false);
|
|
@@ -1269,13 +1285,479 @@ const MonthView = props => {
|
|
|
1269
1285
|
end: calendar.addDays(parseKey(range.last), 1, dateConfig()),
|
|
1270
1286
|
allDay: true
|
|
1271
1287
|
});
|
|
1272
|
-
const
|
|
1288
|
+
const hostKey = () => calendar.formatDateKey(props.date, dateConfig());
|
|
1289
|
+
const loadedRange = createMemo(() => {
|
|
1290
|
+
const range = props.owner.range;
|
|
1291
|
+
const keyOf = value => calendar.formatDateKey(parseDate(value, dateConfig()), dateConfig());
|
|
1292
|
+
return range ? {
|
|
1293
|
+
first: keyOf(range.from),
|
|
1294
|
+
to: keyOf(range.to)
|
|
1295
|
+
} : {
|
|
1296
|
+
first: hostMonthKey(),
|
|
1297
|
+
to: hostMonthKey()
|
|
1298
|
+
};
|
|
1299
|
+
});
|
|
1300
|
+
const loadedWeeks = createMemo(() => monthWeekKeys(loadedRange().first, loadedRange().to, dateConfig().firstDayOfWeek ?? 1));
|
|
1301
|
+
const loaded = key => key >= loadedRange().first && key < loadedRange().to;
|
|
1302
|
+
// The first paint starts at the month's first week. Mount adds the earlier weeks and positions synchronously.
|
|
1303
|
+
const trackWeeks = createMemo(() => {
|
|
1304
|
+
const all = loadedWeeks();
|
|
1305
|
+
const anchor = monthRowOf(all, hostMonthKey());
|
|
1306
|
+
return mounted() || anchor === undefined ? all : all.slice(anchor);
|
|
1307
|
+
});
|
|
1308
|
+
const [scrollTop, setScrollTop] = createSignal(0);
|
|
1309
|
+
const [rowHeight, setRowHeight] = createSignal(80);
|
|
1310
|
+
const [viewHeight, setViewHeight] = createSignal(400);
|
|
1311
|
+
const [labelShown, setLabelShown] = createSignal(false);
|
|
1312
|
+
const [pulseKey, setPulseKey] = createSignal("");
|
|
1313
|
+
let scroller;
|
|
1314
|
+
let weekdayElement;
|
|
1315
|
+
let ready = false;
|
|
1316
|
+
let positioned = false;
|
|
1317
|
+
let silentTop = null;
|
|
1318
|
+
let frame = 0;
|
|
1319
|
+
let labelTimer = 0;
|
|
1320
|
+
let reportTimer = 0;
|
|
1321
|
+
let queueTimer = 0;
|
|
1322
|
+
let glideTimer = 0;
|
|
1323
|
+
let arrivalTimer = 0;
|
|
1324
|
+
let pulseTimer = 0;
|
|
1325
|
+
/** The month that quick repeated steps head for; the next step and the arrows' links go on from it. */
|
|
1326
|
+
const [queuedMonth, setQueuedMonth] = createSignal(null);
|
|
1327
|
+
let pendingTarget = null;
|
|
1328
|
+
let pendingOrigin = null;
|
|
1329
|
+
let glideTarget = null;
|
|
1330
|
+
let pulseOnArrival = false;
|
|
1331
|
+
let reported = "";
|
|
1332
|
+
let reportedFocus = "";
|
|
1333
|
+
let askedEarlier = "";
|
|
1334
|
+
let askedLater = "";
|
|
1335
|
+
let exhaustedEarlier = "";
|
|
1336
|
+
let exhaustedLater = "";
|
|
1337
|
+
const scrollFocusDay = createMemo(() => {
|
|
1338
|
+
const first = focusMonthKey();
|
|
1339
|
+
const range = selection();
|
|
1340
|
+
const selected = range && range.last >= first ? range.first > first ? range.first : first : null;
|
|
1341
|
+
if (selected?.slice(0, 7) === first.slice(0, 7)) return selected;
|
|
1342
|
+
if (hostKey().slice(0, 7) === first.slice(0, 7)) return hostKey();
|
|
1343
|
+
return todayKey().slice(0, 7) === first.slice(0, 7) ? todayKey() : first;
|
|
1344
|
+
});
|
|
1345
|
+
const visibleRange = createMemo(() => {
|
|
1346
|
+
const weeks = trackWeeks();
|
|
1347
|
+
const rows = monthVisibleRows(scrollTop(), viewHeight(), rowHeight(), weeks.length);
|
|
1348
|
+
const first = weeks[rows.first] ?? focusMonthKey();
|
|
1349
|
+
return {
|
|
1350
|
+
first,
|
|
1351
|
+
last: addDayKeys(weeks[Math.max(rows.first, rows.end - 1)] ?? first, 6)
|
|
1352
|
+
};
|
|
1353
|
+
});
|
|
1354
|
+
const renderWindow = createMemo(() => mounted() ? monthRenderWindow(scrollTop(), viewHeight(), rowHeight(), trackWeeks().length) : {
|
|
1355
|
+
first: 0,
|
|
1356
|
+
end: Math.min(trackWeeks().length, MONTH_ROW_BLOCK * 2)
|
|
1357
|
+
}, undefined, {
|
|
1358
|
+
equals: (left, right) => left.first === right.first && left.end === right.end
|
|
1359
|
+
});
|
|
1360
|
+
/** The window's weeks, and those of the focused day, the selection's moving end, and an open popover's day. */
|
|
1361
|
+
const renderedWeeks = createMemo(() => {
|
|
1362
|
+
const weeks = trackWeeks();
|
|
1363
|
+
const window = renderWindow();
|
|
1364
|
+
const keys = new Set(weeks.slice(window.first, window.end));
|
|
1365
|
+
for (const key of [focusKey(), focusedCellKey(), popover()?.anchor.dataset.calendarDayKey]) {
|
|
1366
|
+
const row = key ? monthRowOf(weeks, key) : undefined;
|
|
1367
|
+
if (row !== undefined) keys.add(weeks[row]);
|
|
1368
|
+
}
|
|
1369
|
+
return [...keys].sort();
|
|
1370
|
+
});
|
|
1371
|
+
// Rows keep their elements, but the list moves a kept row when the window passes it, and a browser drops the focus
|
|
1372
|
+
// from an element that moves. The focused element takes it back once the rows are in place.
|
|
1373
|
+
let refocus = null;
|
|
1374
|
+
createComputed(on(renderedWeeks, () => {
|
|
1375
|
+
const active = typeof document === "undefined" ? null : document.activeElement;
|
|
1376
|
+
refocus = active && scroller?.contains(active) ? active : null;
|
|
1377
|
+
}, {
|
|
1378
|
+
defer: true
|
|
1379
|
+
}));
|
|
1380
|
+
createEffect(on(renderedWeeks, () => {
|
|
1381
|
+
const element = refocus;
|
|
1382
|
+
refocus = null;
|
|
1383
|
+
if (element instanceof HTMLElement && element.isConnected && document.activeElement !== element) element.focus({
|
|
1384
|
+
preventScroll: true
|
|
1385
|
+
});
|
|
1386
|
+
}, {
|
|
1387
|
+
defer: true
|
|
1388
|
+
}));
|
|
1389
|
+
const placeOfToday = () => {
|
|
1390
|
+
const weeks = trackWeeks();
|
|
1391
|
+
const row = monthRowOf(weeks, todayKey());
|
|
1392
|
+
return row === undefined ? todayKey() < (weeks[0] ?? focusMonthKey()) ? "up" : "down" : monthTodayDirection(row, scrollTop(), viewHeight(), rowHeight());
|
|
1393
|
+
};
|
|
1394
|
+
const measureScroll = () => {
|
|
1395
|
+
if (!scroller) return;
|
|
1396
|
+
const row = scroller.querySelector(".k2b-calendar-month__week");
|
|
1397
|
+
const height = row?.getBoundingClientRect().height;
|
|
1398
|
+
if (height && height > 0) setRowHeight(height);
|
|
1399
|
+
setViewHeight(Math.max(0, scroller.clientHeight - (weekdayElement?.getBoundingClientRect().height ?? 0)));
|
|
1400
|
+
};
|
|
1401
|
+
const loadMore = edge => {
|
|
1402
|
+
if (!ready) return;
|
|
1403
|
+
const range = loadedRange();
|
|
1404
|
+
const asked = edge === "earlier" ? range.first : range.to;
|
|
1405
|
+
const loader = edge === "earlier" ? props.owner.onLoadEarlier : props.owner.onLoadLater;
|
|
1406
|
+
if (!loader || (edge === "earlier" ? askedEarlier === asked || exhaustedEarlier === asked : askedLater === asked || exhaustedLater === asked)) return;
|
|
1407
|
+
if (edge === "earlier") askedEarlier = asked;else askedLater = asked;
|
|
1408
|
+
const result = loader();
|
|
1409
|
+
if (result !== null && (typeof result === "object" || typeof result === "function") && "then" in result && typeof result.then === "function") {
|
|
1410
|
+
const settled = () => {
|
|
1411
|
+
if (!ready || (edge === "earlier" ? loadedRange().first : loadedRange().to) !== asked) return;
|
|
1412
|
+
if (edge === "earlier") exhaustedEarlier = asked;else exhaustedLater = asked;
|
|
1413
|
+
const target = pendingOrigin === (edge === "earlier" ? -1 : 1) ? pendingTarget : null;
|
|
1414
|
+
if (target) {
|
|
1415
|
+
pendingTarget = null;
|
|
1416
|
+
pendingOrigin = null;
|
|
1417
|
+
setQueuedMonth(null);
|
|
1418
|
+
window.clearTimeout(queueTimer);
|
|
1419
|
+
}
|
|
1420
|
+
if (edge === "later" && glideTarget?.expires === Number.POSITIVE_INFINITY) {
|
|
1421
|
+
glideTarget = null;
|
|
1422
|
+
pulseOnArrival = false;
|
|
1423
|
+
setQueuedMonth(null);
|
|
1424
|
+
for (const timer of [queueTimer, glideTimer, arrivalTimer]) window.clearTimeout(timer);
|
|
1425
|
+
readScroll();
|
|
1426
|
+
}
|
|
1427
|
+
if (target) props.goToDate?.(parseKey(target));
|
|
1428
|
+
};
|
|
1429
|
+
void Promise.resolve(result).then(settled, settled);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
/** Asks for more weeks near either end; weeks inserted above a running glide would move its way, so it waits. */
|
|
1433
|
+
const loadNearEdges = () => {
|
|
1434
|
+
if (!scroller) return;
|
|
1435
|
+
if (!glideTarget && scroller.scrollTop < MONTH_ROWS_IN_VIEW * rowHeight()) loadMore("earlier");
|
|
1436
|
+
if (scroller.scrollTop + viewHeight() > (trackWeeks().length - MONTH_ROWS_IN_VIEW * 2) * rowHeight()) loadMore("later");
|
|
1437
|
+
};
|
|
1438
|
+
const reportVisible = () => {
|
|
1439
|
+
if (!ready) return;
|
|
1440
|
+
const {
|
|
1441
|
+
first,
|
|
1442
|
+
last
|
|
1443
|
+
} = untrack(visibleRange);
|
|
1444
|
+
const focus = untrack(scrollFocusDay);
|
|
1445
|
+
const value = `${first}/${last}/${focus}`;
|
|
1446
|
+
if (reported === value) return;
|
|
1447
|
+
reported = value;
|
|
1448
|
+
window.clearTimeout(reportTimer);
|
|
1449
|
+
reportTimer = window.setTimeout(() => {
|
|
1450
|
+
reportedFocus = focus;
|
|
1451
|
+
props.owner.onVisibleDateChange?.(parseKey(first), parseKey(last), parseKey(focus));
|
|
1452
|
+
}, 250);
|
|
1453
|
+
};
|
|
1454
|
+
const keepLabel = () => {
|
|
1455
|
+
window.clearTimeout(labelTimer);
|
|
1456
|
+
labelTimer = window.setTimeout(() => setLabelShown(false), 650);
|
|
1457
|
+
};
|
|
1458
|
+
const readScroll = (showLabel = true) => {
|
|
1459
|
+
if (!scroller) return;
|
|
1460
|
+
const top = scroller.scrollTop;
|
|
1461
|
+
setScrollTop(top);
|
|
1462
|
+
const weeks = trackWeeks();
|
|
1463
|
+
const week = weeks[monthFocusRow(top, viewHeight(), rowHeight(), weeks.length)];
|
|
1464
|
+
if (week) {
|
|
1465
|
+
const next = monthOfWeek(week);
|
|
1466
|
+
if (next !== untrack(focusMonthKey)) {
|
|
1467
|
+
setFocusMonthKey(next);
|
|
1468
|
+
if (showLabel && ready) {
|
|
1469
|
+
setLabelShown(true);
|
|
1470
|
+
keepLabel();
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
reportVisible();
|
|
1475
|
+
};
|
|
1476
|
+
const pulseToday = () => {
|
|
1477
|
+
if (reducedMotion()) return;
|
|
1478
|
+
setPulseKey(todayKey());
|
|
1479
|
+
window.clearTimeout(pulseTimer);
|
|
1480
|
+
pulseTimer = window.setTimeout(() => setPulseKey(""), 1000);
|
|
1481
|
+
};
|
|
1482
|
+
const finishGlide = () => {
|
|
1483
|
+
if (!scroller) return;
|
|
1484
|
+
const target = glideTarget;
|
|
1485
|
+
const row = target ? monthRowOf(trackWeeks(), target.week) : undefined;
|
|
1486
|
+
// A clamped glide may still be waiting for more weeks below; scrollend is not arrival then.
|
|
1487
|
+
if (target && row !== undefined && Math.abs(scroller.scrollTop - (row * rowHeight() + target.offset)) > 1) return;
|
|
1488
|
+
glideTarget = null;
|
|
1489
|
+
if (pendingOrigin !== -1 && pendingOrigin !== 1) {
|
|
1490
|
+
setQueuedMonth(null);
|
|
1491
|
+
window.clearTimeout(queueTimer);
|
|
1492
|
+
}
|
|
1493
|
+
window.clearTimeout(glideTimer);
|
|
1494
|
+
window.clearTimeout(arrivalTimer);
|
|
1495
|
+
readScroll();
|
|
1496
|
+
// A glide that lands near an end asks for the next weeks there, as the reader's own scrolling does.
|
|
1497
|
+
if (target) loadNearEdges();
|
|
1498
|
+
if (pulseOnArrival) {
|
|
1499
|
+
pulseOnArrival = false;
|
|
1500
|
+
pulseToday();
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
const cancelGlide = () => {
|
|
1504
|
+
if (!scroller) return;
|
|
1505
|
+
if (pendingOrigin === -1 || pendingOrigin === 1) {
|
|
1506
|
+
pendingTarget = null;
|
|
1507
|
+
pendingOrigin = null;
|
|
1508
|
+
setQueuedMonth(null);
|
|
1509
|
+
window.clearTimeout(queueTimer);
|
|
1510
|
+
}
|
|
1511
|
+
if (!glideTarget) return;
|
|
1512
|
+
// A reader's wheel or touch takes over from navigation, including any target waiting for more weeks.
|
|
1513
|
+
glideTarget = null;
|
|
1514
|
+
pulseOnArrival = false;
|
|
1515
|
+
setQueuedMonth(null);
|
|
1516
|
+
for (const timer of [queueTimer, glideTimer, arrivalTimer]) window.clearTimeout(timer);
|
|
1517
|
+
scroller.scrollTo({
|
|
1518
|
+
top: scroller.scrollTop,
|
|
1519
|
+
behavior: "instant"
|
|
1520
|
+
});
|
|
1521
|
+
};
|
|
1522
|
+
const issueGlide = (top, smooth) => {
|
|
1523
|
+
if (!scroller) return;
|
|
1524
|
+
const maximum = Math.max(0, scroller.scrollHeight - scroller.clientHeight);
|
|
1525
|
+
const target = Math.max(0, Math.min(top, maximum));
|
|
1526
|
+
if (smooth && !reducedMotion() && Math.abs(target - scroller.scrollTop) > viewHeight() * 3) {
|
|
1527
|
+
scroller.scrollTop = target - Math.sign(target - scroller.scrollTop) * viewHeight();
|
|
1528
|
+
readScroll();
|
|
1529
|
+
}
|
|
1530
|
+
scroller.scrollTo({
|
|
1531
|
+
top: target,
|
|
1532
|
+
behavior: smooth && !reducedMotion() ? "smooth" : "instant"
|
|
1533
|
+
});
|
|
1534
|
+
if (top > maximum + 1) loadMore("later");
|
|
1535
|
+
if (!smooth || reducedMotion()) {
|
|
1536
|
+
readScroll();
|
|
1537
|
+
finishGlide();
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
const glide = (top, smooth = true) => {
|
|
1541
|
+
if (!scroller) return;
|
|
1542
|
+
const row = Math.max(0, Math.min(trackWeeks().length - 1, Math.floor(top / rowHeight())));
|
|
1543
|
+
const week = trackWeeks()[row];
|
|
1544
|
+
if (!week) return;
|
|
1545
|
+
// A target past the loaded weeks waits for them however long they take; the reader's own scrolling ends the wait.
|
|
1546
|
+
const waiting = top > scroller.scrollHeight - scroller.clientHeight + 1;
|
|
1547
|
+
glideTarget = {
|
|
1548
|
+
week,
|
|
1549
|
+
offset: top - row * rowHeight(),
|
|
1550
|
+
expires: waiting ? Number.POSITIVE_INFINITY : performance.now() + 1600
|
|
1551
|
+
};
|
|
1552
|
+
window.clearTimeout(glideTimer);
|
|
1553
|
+
window.clearTimeout(arrivalTimer);
|
|
1554
|
+
if (!waiting) glideTimer = window.setTimeout(() => {
|
|
1555
|
+
glideTarget = null;
|
|
1556
|
+
pulseOnArrival = false;
|
|
1557
|
+
}, 1600);
|
|
1558
|
+
arrivalTimer = window.setTimeout(finishGlide, 900);
|
|
1559
|
+
issueGlide(top, smooth);
|
|
1560
|
+
};
|
|
1561
|
+
const positionMonth = (key, smooth = true, reveal = false) => {
|
|
1562
|
+
if (!continuous() || !loaded(key) || !scroller) return false;
|
|
1563
|
+
const weeks = trackWeeks();
|
|
1564
|
+
const first = monthRowOf(weeks, `${key.slice(0, 7)}-01`);
|
|
1565
|
+
const row = monthRowOf(weeks, key);
|
|
1566
|
+
if (first === undefined || row === undefined) return false;
|
|
1567
|
+
const top = first * rowHeight();
|
|
1568
|
+
glide(reveal ? monthRevealTop(row, top, viewHeight(), rowHeight()) ?? top : top, smooth);
|
|
1569
|
+
return true;
|
|
1570
|
+
};
|
|
1571
|
+
const goToMonth = key => positionMonth(key, true, true);
|
|
1572
|
+
const stepMonth = direction => {
|
|
1573
|
+
if (!continuous() || !scroller) return false;
|
|
1574
|
+
const target = calendar.formatDateKey(calendar.addMonths(parseKey(queuedMonth() ?? focusMonthKey()), direction, dateConfig()), dateConfig());
|
|
1575
|
+
if (loaded(target)) {
|
|
1576
|
+
pendingTarget = null;
|
|
1577
|
+
pendingOrigin = null;
|
|
1578
|
+
if (!positionMonth(target)) return false;
|
|
1579
|
+
} else {
|
|
1580
|
+
// A month past the loaded weeks asks for them and waits; an end the host has reached goes through its navigation.
|
|
1581
|
+
const range = loadedRange();
|
|
1582
|
+
const later = direction === 1;
|
|
1583
|
+
const edge = later ? range.to : range.first;
|
|
1584
|
+
if (!(later ? props.owner.onLoadLater : props.owner.onLoadEarlier) || (later ? exhaustedLater : exhaustedEarlier) === edge) return false;
|
|
1585
|
+
pendingTarget = target;
|
|
1586
|
+
pendingOrigin = direction;
|
|
1587
|
+
loadMore(later ? "later" : "earlier");
|
|
1588
|
+
}
|
|
1589
|
+
// Instant positioning may finish during positionMonth; queue afterwards so rapid clicks still accumulate.
|
|
1590
|
+
setQueuedMonth(target);
|
|
1591
|
+
window.clearTimeout(queueTimer);
|
|
1592
|
+
// A glide that waits for more weeks keeps its month queued until it arrives or the reader scrolls.
|
|
1593
|
+
queueTimer = window.setTimeout(() => {
|
|
1594
|
+
if (pendingOrigin !== -1 && pendingOrigin !== 1 && glideTarget?.expires !== Number.POSITIVE_INFINITY) setQueuedMonth(null);
|
|
1595
|
+
}, 1200);
|
|
1596
|
+
return true;
|
|
1597
|
+
};
|
|
1598
|
+
const goToday = () => {
|
|
1599
|
+
if (!continuous() || !loaded(todayKey()) || !scroller) return false;
|
|
1600
|
+
pulseOnArrival = !reducedMotion();
|
|
1601
|
+
if (positionMonth(todayKey(), true, true)) return true;
|
|
1602
|
+
pulseOnArrival = false;
|
|
1603
|
+
return false;
|
|
1604
|
+
};
|
|
1605
|
+
const revealDay = key => {
|
|
1606
|
+
const row = monthRowOf(trackWeeks(), key);
|
|
1607
|
+
if (row === undefined || !scroller) return;
|
|
1608
|
+
const top = monthRevealTop(row, scroller.scrollTop, viewHeight(), rowHeight());
|
|
1609
|
+
if (top !== undefined) glide(top);
|
|
1610
|
+
};
|
|
1611
|
+
const onScroll = () => {
|
|
1612
|
+
if (!ready || !scroller) return;
|
|
1613
|
+
// Initial positioning and range rebasing are not the reader asking for more weeks.
|
|
1614
|
+
if (silentTop !== null && Math.abs(scroller.scrollTop - silentTop) < 1) return;
|
|
1615
|
+
silentTop = null;
|
|
1616
|
+
if (untrack(labelShown)) keepLabel();
|
|
1617
|
+
if (!frame) frame = requestAnimationFrame(() => {
|
|
1618
|
+
frame = 0;
|
|
1619
|
+
readScroll();
|
|
1620
|
+
if (!scroller) return;
|
|
1621
|
+
loadNearEdges();
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
// Capture the old track before render effects change its height, then restore the same week and pixel below.
|
|
1625
|
+
let previousWeeks = [];
|
|
1626
|
+
let savedAnchor = null;
|
|
1627
|
+
createComputed(on(loadedWeeks, weeks => {
|
|
1628
|
+
if (!untrack(mounted) || !scroller) return;
|
|
1629
|
+
const top = scroller.scrollTop;
|
|
1630
|
+
const row = Math.floor(top / untrack(rowHeight));
|
|
1631
|
+
const week = previousWeeks[row];
|
|
1632
|
+
savedAnchor = week ? {
|
|
1633
|
+
week,
|
|
1634
|
+
delta: top - row * untrack(rowHeight)
|
|
1635
|
+
} : null;
|
|
1636
|
+
const next = week ? monthRowOf(weeks, week) : undefined;
|
|
1637
|
+
// Move the render window before DOM updates, so even a larger rebase retains the visible rows' elements.
|
|
1638
|
+
if (next !== undefined && savedAnchor) setScrollTop(next * untrack(rowHeight) + savedAnchor.delta);
|
|
1639
|
+
}, {
|
|
1640
|
+
defer: true
|
|
1641
|
+
}));
|
|
1642
|
+
createEffect(on(loadedWeeks, () => {
|
|
1643
|
+
if (!untrack(mounted) || !scroller) return;
|
|
1644
|
+
measureScroll();
|
|
1645
|
+
previousWeeks = untrack(trackWeeks);
|
|
1646
|
+
const row = savedAnchor ? monthRowOf(previousWeeks, savedAnchor.week) : undefined;
|
|
1647
|
+
const top = row !== undefined && savedAnchor ? row * untrack(rowHeight) + savedAnchor.delta : scroller.scrollTop;
|
|
1648
|
+
// Weeks added below move nothing, and writing the same position would stop a glide on its way.
|
|
1649
|
+
const moved = Math.abs(scroller.scrollTop - top) >= 1;
|
|
1650
|
+
if (moved) scroller.scrollTop = top;
|
|
1651
|
+
if (pendingTarget && loaded(pendingTarget)) {
|
|
1652
|
+
const key = pendingTarget;
|
|
1653
|
+
pendingTarget = null;
|
|
1654
|
+
pendingOrigin = null;
|
|
1655
|
+
positioned = positionMonth(key, positioned) || positioned;
|
|
1656
|
+
if (pendingKey === key) {
|
|
1657
|
+
pendingKey = null;
|
|
1658
|
+
select(key);
|
|
1659
|
+
queueMicrotask(() => focusCell(key));
|
|
1660
|
+
}
|
|
1661
|
+
} else {
|
|
1662
|
+
if (pendingTarget && (pendingOrigin === -1 || pendingOrigin === 1)) loadMore(pendingOrigin === -1 ? "earlier" : "later");
|
|
1663
|
+
// A glide goes on after the weeks above moved it, and one that waited at the end goes on into the new weeks.
|
|
1664
|
+
if (glideTarget && performance.now() < glideTarget.expires && (moved || glideTarget.expires === Number.POSITIVE_INFINITY)) {
|
|
1665
|
+
const target = monthRowOf(previousWeeks, glideTarget.week);
|
|
1666
|
+
if (target !== undefined) issueGlide(target * untrack(rowHeight) + glideTarget.offset, true);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
savedAnchor = null;
|
|
1670
|
+
silentTop = scroller.scrollTop;
|
|
1671
|
+
readScroll(false);
|
|
1672
|
+
}, {
|
|
1673
|
+
defer: true
|
|
1674
|
+
}));
|
|
1675
|
+
createEffect(on(hostKey, key => {
|
|
1676
|
+
if (!continuous() || !untrack(mounted) || !scroller) return;
|
|
1677
|
+
if (key === reportedFocus) {
|
|
1678
|
+
if (pendingOrigin === "host") {
|
|
1679
|
+
pendingTarget = null;
|
|
1680
|
+
pendingOrigin = null;
|
|
1681
|
+
}
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
pendingTarget = loaded(key) ? null : key;
|
|
1685
|
+
pendingOrigin = pendingTarget ? "host" : null;
|
|
1686
|
+
if (pendingTarget) return;
|
|
1687
|
+
const visible = untrack(visibleRange);
|
|
1688
|
+
if (key.slice(0, 7) !== untrack(focusMonthKey).slice(0, 7) || key < visible.first || key > visible.last) positionMonth(key);
|
|
1689
|
+
if (pendingKey === key) {
|
|
1690
|
+
pendingKey = null;
|
|
1691
|
+
select(key);
|
|
1692
|
+
queueMicrotask(() => focusCell(key));
|
|
1693
|
+
}
|
|
1694
|
+
}, {
|
|
1695
|
+
defer: true
|
|
1696
|
+
}));
|
|
1697
|
+
createEffect(on(scrollFocusDay, () => {
|
|
1698
|
+
if (continuous()) reportVisible();
|
|
1699
|
+
}, {
|
|
1700
|
+
defer: true
|
|
1701
|
+
}));
|
|
1702
|
+
// The scrolling starts once the grid is on the page, also when a host passes `range` only later.
|
|
1703
|
+
createEffect(on(continuous, active => {
|
|
1704
|
+
if (!active || !scroller) return;
|
|
1705
|
+
setMounted(true);
|
|
1706
|
+
measureScroll();
|
|
1707
|
+
previousWeeks = trackWeeks();
|
|
1708
|
+
const row = monthRowOf(previousWeeks, hostMonthKey());
|
|
1709
|
+
if (row !== undefined && loaded(hostKey())) scroller.scrollTop = row * rowHeight();
|
|
1710
|
+
// Too few weeks below the month, such as the days of another view while the month's own load, cannot put its
|
|
1711
|
+
// first week on top yet; the month goes there once its weeks arrive.
|
|
1712
|
+
positioned = row !== undefined && Math.abs(scroller.scrollTop - row * rowHeight()) < 1;
|
|
1713
|
+
if (!positioned) {
|
|
1714
|
+
pendingTarget = hostKey();
|
|
1715
|
+
pendingOrigin = "mount";
|
|
1716
|
+
}
|
|
1717
|
+
readScroll(false);
|
|
1718
|
+
silentTop = scroller.scrollTop;
|
|
1719
|
+
ready = true;
|
|
1720
|
+
reportVisible();
|
|
1721
|
+
scroller.addEventListener("scrollend", finishGlide);
|
|
1722
|
+
const resize = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(() => {
|
|
1723
|
+
if (!scroller) return;
|
|
1724
|
+
const height = untrack(rowHeight);
|
|
1725
|
+
const position = scroller.scrollTop / height;
|
|
1726
|
+
measureScroll();
|
|
1727
|
+
if (height !== untrack(rowHeight)) {
|
|
1728
|
+
scroller.scrollTop = position * untrack(rowHeight);
|
|
1729
|
+
if (glideTarget) {
|
|
1730
|
+
const target = monthRowOf(untrack(trackWeeks), glideTarget.week);
|
|
1731
|
+
if (target !== undefined) issueGlide(target * untrack(rowHeight) + glideTarget.offset, true);
|
|
1732
|
+
}
|
|
1733
|
+
silentTop = scroller.scrollTop;
|
|
1734
|
+
}
|
|
1735
|
+
readScroll(false);
|
|
1736
|
+
});
|
|
1737
|
+
resize?.observe(scroller);
|
|
1738
|
+
const element = scroller;
|
|
1739
|
+
onCleanup(() => {
|
|
1740
|
+
resize?.disconnect();
|
|
1741
|
+
element.removeEventListener("scrollend", finishGlide);
|
|
1742
|
+
for (const timer of [labelTimer, reportTimer, queueTimer, glideTimer, arrivalTimer, pulseTimer]) window.clearTimeout(timer);
|
|
1743
|
+
if (frame) cancelAnimationFrame(frame);
|
|
1744
|
+
frame = 0;
|
|
1745
|
+
ready = false;
|
|
1746
|
+
setMounted(false);
|
|
1747
|
+
});
|
|
1748
|
+
}));
|
|
1749
|
+
const visibleKeys = createMemo(() => continuous() ? renderedWeeks().flatMap(key => Array.from({
|
|
1750
|
+
length: 7
|
|
1751
|
+
}, (_, day) => addDayKeys(key, day))) : weeks().flatMap(week => week.map(entry => entry.key)));
|
|
1273
1752
|
const rovingKey = createMemo(() => {
|
|
1274
1753
|
const keys = visibleKeys();
|
|
1275
|
-
const focus = focusKey();
|
|
1754
|
+
const focus = focusKey() ?? (continuous() ? focusedCellKey() : null);
|
|
1276
1755
|
if (focus && keys.includes(focus)) return focus;
|
|
1277
|
-
if (keys.includes(todayKey())) return todayKey();
|
|
1278
|
-
|
|
1756
|
+
if (keys.includes(todayKey()) && (!continuous() || todayKey() >= visibleRange().first && todayKey() <= visibleRange().last)) return todayKey();
|
|
1757
|
+
const first = calendar.formatDateKey(zonedMonthDate(month().year, month().month, dateConfig()), dateConfig());
|
|
1758
|
+
if (!continuous() || keys.includes(first)) return first;
|
|
1759
|
+
const visible = visibleRange();
|
|
1760
|
+
return keys.find(key => key.slice(0, 7) === first.slice(0, 7) && key >= visible.first && key <= visible.last) ?? keys.find(key => key >= visible.first && key <= visible.last) ?? keys[0] ?? first;
|
|
1279
1761
|
});
|
|
1280
1762
|
const dropRange = createMemo(() => {
|
|
1281
1763
|
const preview = movePreview();
|
|
@@ -1300,8 +1782,7 @@ const MonthView = props => {
|
|
|
1300
1782
|
setAnchorKey(anchor);
|
|
1301
1783
|
setFocusKey(focus);
|
|
1302
1784
|
};
|
|
1303
|
-
//
|
|
1304
|
-
// goes with the view, so switching to another view reports that nothing is selected.
|
|
1785
|
+
// Selection survives scrolling; only paging starts a month without it. Switching views clears the host's selection.
|
|
1305
1786
|
createEffect(on(selection, range => props.owner.onSelectionChange?.(range ? rangeOf(range) : null), {
|
|
1306
1787
|
defer: true
|
|
1307
1788
|
}));
|
|
@@ -1310,6 +1791,7 @@ const MonthView = props => {
|
|
|
1310
1791
|
});
|
|
1311
1792
|
createEffect(on(selection, range => props.onFocusDay?.(range ? parseKey(range.first) : null)));
|
|
1312
1793
|
createEffect(on(month, () => {
|
|
1794
|
+
if (continuous()) return;
|
|
1313
1795
|
setPopover(null);
|
|
1314
1796
|
const key = pendingKey;
|
|
1315
1797
|
pendingKey = null;
|
|
@@ -1400,6 +1882,8 @@ const MonthView = props => {
|
|
|
1400
1882
|
const focusCell = key => cells.get(key)?.focus({
|
|
1401
1883
|
preventScroll: true
|
|
1402
1884
|
});
|
|
1885
|
+
/** Whether the focus is in the popover, or fell to the page as it hid: only then does a close return it. */
|
|
1886
|
+
const focusInPopover = () => popoverElement?.contains(document.activeElement) || document.activeElement === document.body;
|
|
1403
1887
|
const closePopover = (restoreFocus = true) => {
|
|
1404
1888
|
if (!popover()) return;
|
|
1405
1889
|
setPopover(null);
|
|
@@ -1431,6 +1915,11 @@ const MonthView = props => {
|
|
|
1431
1915
|
popoverFocusable()?.focus();
|
|
1432
1916
|
return true;
|
|
1433
1917
|
};
|
|
1918
|
+
/**
|
|
1919
|
+
* The day to create on without a selection. The month that scrolls takes the day it stands for, today or the 1st of
|
|
1920
|
+
* the month in focus, never a day the keyboard last visited in another month.
|
|
1921
|
+
*/
|
|
1922
|
+
const unselectedKey = () => continuous() ? scrollFocusDay() : rovingKey();
|
|
1434
1923
|
/** Enter, a double-click, and N create on the selection, with the quick create or the host's own create action. */
|
|
1435
1924
|
const createOnSelection = () => {
|
|
1436
1925
|
const range = selection();
|
|
@@ -1443,8 +1932,8 @@ const MonthView = props => {
|
|
|
1443
1932
|
onMount(() => props.register?.({
|
|
1444
1933
|
quickCreate: create => {
|
|
1445
1934
|
const range = selection() ?? {
|
|
1446
|
-
first:
|
|
1447
|
-
last:
|
|
1935
|
+
first: unselectedKey(),
|
|
1936
|
+
last: unselectedKey()
|
|
1448
1937
|
};
|
|
1449
1938
|
select(range.first, range.last);
|
|
1450
1939
|
if (!openCreate(range, {
|
|
@@ -1453,10 +1942,18 @@ const MonthView = props => {
|
|
|
1453
1942
|
})) props.owner.onSlotActivate?.(rangeOf(range));
|
|
1454
1943
|
},
|
|
1455
1944
|
createTarget: () => rangeOf(selection() ?? {
|
|
1456
|
-
first:
|
|
1457
|
-
last:
|
|
1945
|
+
first: unselectedKey(),
|
|
1946
|
+
last: unselectedKey()
|
|
1458
1947
|
}),
|
|
1459
|
-
typing: () => popover()?.kind === "create" && !createActive()
|
|
1948
|
+
typing: () => popover()?.kind === "create" && !createActive(),
|
|
1949
|
+
continuous,
|
|
1950
|
+
focusMonth: () => parseKey(focusMonthKey()),
|
|
1951
|
+
stepFrom: () => parseKey(queuedMonth() ?? focusMonthKey()),
|
|
1952
|
+
focusDay: () => parseKey(scrollFocusDay()),
|
|
1953
|
+
step: stepMonth,
|
|
1954
|
+
goTo: goToMonth,
|
|
1955
|
+
today: goToday,
|
|
1956
|
+
todayDirection: placeOfToday
|
|
1460
1957
|
}));
|
|
1461
1958
|
onCleanup(() => props.register?.(null));
|
|
1462
1959
|
const openDayList = key => {
|
|
@@ -1491,12 +1988,15 @@ const MonthView = props => {
|
|
|
1491
1988
|
}
|
|
1492
1989
|
};
|
|
1493
1990
|
const moveFocus = (key, extend) => {
|
|
1494
|
-
if (!visibleKeys().includes(key)) {
|
|
1991
|
+
if (continuous() ? !loaded(key) : !visibleKeys().includes(key)) {
|
|
1495
1992
|
pageTo(key);
|
|
1496
1993
|
return;
|
|
1497
1994
|
}
|
|
1498
1995
|
if (extend) select(anchorKey() ?? focusKey() ?? key, key);else select(key);
|
|
1499
|
-
|
|
1996
|
+
if (continuous()) {
|
|
1997
|
+
revealDay(key);
|
|
1998
|
+
queueMicrotask(() => focusCell(key));
|
|
1999
|
+
} else focusCell(key);
|
|
1500
2000
|
followSelection();
|
|
1501
2001
|
};
|
|
1502
2002
|
const onCellKeyDown = (event, key) => {
|
|
@@ -1525,7 +2025,12 @@ const MonthView = props => {
|
|
|
1525
2025
|
}
|
|
1526
2026
|
if (event.key === "PageUp" || event.key === "PageDown") {
|
|
1527
2027
|
event.preventDefault();
|
|
1528
|
-
|
|
2028
|
+
const target = calendar.formatDateKey(addMonthsClamped(day, event.key === "PageUp" ? -1 : 1, dateConfig()), dateConfig());
|
|
2029
|
+
if (continuous() && loaded(target)) {
|
|
2030
|
+
moveFocus(target, event.shiftKey);
|
|
2031
|
+
// The month's first week goes on top, unless the day lies in a sixth week that would then stay out of view.
|
|
2032
|
+
goToMonth(target);
|
|
2033
|
+
} else pageTo(target);
|
|
1529
2034
|
return;
|
|
1530
2035
|
}
|
|
1531
2036
|
if (event.key === "Enter" || (event.key === "n" || event.key === "N") && !event.shiftKey) {
|
|
@@ -1595,6 +2100,9 @@ const MonthView = props => {
|
|
|
1595
2100
|
cancelInteraction?.();
|
|
1596
2101
|
cancelInteraction = startCalendarPointerSession({
|
|
1597
2102
|
event,
|
|
2103
|
+
scrollContainer: continuous() ? scroller : undefined,
|
|
2104
|
+
// A drag along the last row on screen selects its days; the view scrolls once the pointer came from inside.
|
|
2105
|
+
armAutoScroll: true,
|
|
1598
2106
|
resolve: (clientX, clientY) => dayKeyAtPoint(clientX, clientY),
|
|
1599
2107
|
onActivate: () => {
|
|
1600
2108
|
suppressClickUntil = performance.now() + 400;
|
|
@@ -1603,6 +2111,8 @@ const MonthView = props => {
|
|
|
1603
2111
|
},
|
|
1604
2112
|
onPreview: current => select(key, current),
|
|
1605
2113
|
onCommit: current => {
|
|
2114
|
+
// The click that ends a long drag, such as one that scrolled the view, must not select the pressed day again.
|
|
2115
|
+
suppressClickUntil = performance.now() + 400;
|
|
1606
2116
|
select(key, current);
|
|
1607
2117
|
focusCell(current);
|
|
1608
2118
|
const range = orderedSelection(key, current);
|
|
@@ -1622,8 +2132,8 @@ const MonthView = props => {
|
|
|
1622
2132
|
const menuItems = createMemo(() => {
|
|
1623
2133
|
if (!hasMenu()) return [];
|
|
1624
2134
|
const range = selection() ?? {
|
|
1625
|
-
first:
|
|
1626
|
-
last:
|
|
2135
|
+
first: unselectedKey(),
|
|
2136
|
+
last: unselectedKey()
|
|
1627
2137
|
};
|
|
1628
2138
|
const own = props.owner.selectionMenu?.(rangeOf(range), {
|
|
1629
2139
|
quickCreate: create => {
|
|
@@ -1673,6 +2183,8 @@ const MonthView = props => {
|
|
|
1673
2183
|
cancelInteraction?.();
|
|
1674
2184
|
cancelInteraction = startCalendarPointerSession({
|
|
1675
2185
|
event: pointerEvent,
|
|
2186
|
+
scrollContainer: continuous() ? scroller : undefined,
|
|
2187
|
+
armAutoScroll: true,
|
|
1676
2188
|
resolve: (clientX, clientY) => {
|
|
1677
2189
|
const key = dayKeyAtPoint(clientX, clientY);
|
|
1678
2190
|
if (!key) return null;
|
|
@@ -1692,6 +2204,9 @@ const MonthView = props => {
|
|
|
1692
2204
|
},
|
|
1693
2205
|
onPreview: setMovePreview,
|
|
1694
2206
|
onCommit: next => {
|
|
2207
|
+
// The click that ends a long move, such as one that scrolled the view, must not open the entry.
|
|
2208
|
+
markDragged();
|
|
2209
|
+
suppressClickUntil = performance.now() + 400;
|
|
1695
2210
|
clearMove();
|
|
1696
2211
|
if (eventTimeChanged(event, next)) props.owner.onEventDrop?.(event, next);
|
|
1697
2212
|
},
|
|
@@ -1779,388 +2294,497 @@ const MonthView = props => {
|
|
|
1779
2294
|
if (linkedItem() === item.key) setLinkedItem("");
|
|
1780
2295
|
}
|
|
1781
2296
|
});
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
_$insert(_el$87, day);
|
|
1808
|
-
_$effect(() => _$setAttribute(_el$87, "data-weekend", index() > 4 ? "true" : undefined));
|
|
1809
|
-
return _el$87;
|
|
1810
|
-
})()
|
|
1811
|
-
}), _el$84, _co$22);
|
|
1812
|
-
_$insert(_el$78, _$createComponent(For, {
|
|
1813
|
-
get each() {
|
|
1814
|
-
return weeks();
|
|
1815
|
-
},
|
|
1816
|
-
children: (week, weekIndex) => {
|
|
1817
|
-
const fit = createMemo(() => fitMonthWeek(weekLayouts()[weekIndex()] ?? {
|
|
1818
|
-
bars: [],
|
|
1819
|
-
singles: []
|
|
1820
|
-
}, capacities()[weekIndex()] ?? MONTH_DEFAULT_LANES));
|
|
1821
|
-
const weekHref = () => viewHref(week[0].key, "week");
|
|
1822
|
-
const weekNumber = () => zonedWeekNumber(week[0].day, dateConfig());
|
|
1823
|
-
return (() => {
|
|
1824
|
-
var _el$88 = _$getNextElement(_tmpl$24),
|
|
1825
|
-
_el$90 = _el$88.firstChild,
|
|
1826
|
-
[_el$91, _co$24] = _$getNextMarker(_el$90.nextSibling),
|
|
1827
|
-
_el$92 = _el$91.nextSibling,
|
|
1828
|
-
[_el$93, _co$25] = _$getNextMarker(_el$92.nextSibling);
|
|
1829
|
-
_$insert(_el$88, _$createComponent(Show, {
|
|
2297
|
+
const weekRow = (week, weekIndex) => {
|
|
2298
|
+
const layout = createMemo(() => layoutMonthWeek(week().map(entry => entry.key), items().map(item => ({
|
|
2299
|
+
item,
|
|
2300
|
+
firstKey: item.firstKey,
|
|
2301
|
+
lastKey: item.lastKey,
|
|
2302
|
+
bar: item.bar
|
|
2303
|
+
}))));
|
|
2304
|
+
// The continuous rows are all as high as the first, so they share its measured capacity.
|
|
2305
|
+
const capacity = () => capacities()[continuous() ? 0 : weekIndex()] ?? MONTH_DEFAULT_LANES;
|
|
2306
|
+
const fit = createMemo(() => fitMonthWeek(layout(), capacity()));
|
|
2307
|
+
const weekHref = () => viewHref(week()[0].key, "week");
|
|
2308
|
+
const weekNumber = () => zonedWeekNumber(week()[0].day, dateConfig());
|
|
2309
|
+
return (() => {
|
|
2310
|
+
var _el$77 = _$getNextElement(_tmpl$22),
|
|
2311
|
+
_el$79 = _el$77.firstChild,
|
|
2312
|
+
[_el$80, _co$21] = _$getNextMarker(_el$79.nextSibling),
|
|
2313
|
+
_el$81 = _el$80.nextSibling,
|
|
2314
|
+
[_el$82, _co$22] = _$getNextMarker(_el$81.nextSibling);
|
|
2315
|
+
_$insert(_el$77, _$createComponent(Show, {
|
|
2316
|
+
get when() {
|
|
2317
|
+
return props.owner.withWeekNumbers;
|
|
2318
|
+
},
|
|
2319
|
+
get children() {
|
|
2320
|
+
var _el$78 = _$getNextElement(_tmpl$21);
|
|
2321
|
+
_$insert(_el$78, _$createComponent(Show, {
|
|
1830
2322
|
get when() {
|
|
1831
|
-
return
|
|
2323
|
+
return weekHref();
|
|
1832
2324
|
},
|
|
1833
|
-
get
|
|
1834
|
-
|
|
1835
|
-
_$insert(_el$89, _$createComponent(Show, {
|
|
2325
|
+
get fallback() {
|
|
2326
|
+
return _$createComponent(Show, {
|
|
1836
2327
|
get when() {
|
|
1837
|
-
return
|
|
2328
|
+
return canOpenView("week");
|
|
1838
2329
|
},
|
|
1839
2330
|
get fallback() {
|
|
1840
|
-
return
|
|
1841
|
-
|
|
1842
|
-
|
|
2331
|
+
return weekNumber();
|
|
2332
|
+
},
|
|
2333
|
+
get children() {
|
|
2334
|
+
var _el$83 = _$getNextElement(_tmpl$23);
|
|
2335
|
+
_el$83.$$click = () => openView(week()[0].key, "week");
|
|
2336
|
+
_$insert(_el$83, weekNumber);
|
|
2337
|
+
_$effect(_p$ => {
|
|
2338
|
+
var _v$1 = calendarMessages().calendarOpenWeekNumber({
|
|
2339
|
+
week: weekNumber()
|
|
2340
|
+
}),
|
|
2341
|
+
_v$10 = calendarMessages().calendarOpenWeekNumber({
|
|
2342
|
+
week: weekNumber()
|
|
2343
|
+
});
|
|
2344
|
+
_v$1 !== _p$.e && _$setAttribute(_el$83, "title", _p$.e = _v$1);
|
|
2345
|
+
_v$10 !== _p$.t && _$setAttribute(_el$83, "aria-label", _p$.t = _v$10);
|
|
2346
|
+
return _p$;
|
|
2347
|
+
}, {
|
|
2348
|
+
e: undefined,
|
|
2349
|
+
t: undefined
|
|
2350
|
+
});
|
|
2351
|
+
_$runHydrationEvents();
|
|
2352
|
+
return _el$83;
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
},
|
|
2356
|
+
children: href => _$createComponent(CalendarNavigationLink, {
|
|
2357
|
+
get owner() {
|
|
2358
|
+
return props.owner;
|
|
2359
|
+
},
|
|
2360
|
+
get href() {
|
|
2361
|
+
return href();
|
|
2362
|
+
},
|
|
2363
|
+
get anchorProps() {
|
|
2364
|
+
return {
|
|
2365
|
+
class: "k2b-calendar-month__week-link",
|
|
2366
|
+
tabIndex: -1,
|
|
2367
|
+
title: calendarMessages().calendarOpenWeekNumber({
|
|
2368
|
+
week: weekNumber()
|
|
2369
|
+
}),
|
|
2370
|
+
"aria-label": calendarMessages().calendarOpenWeekNumber({
|
|
2371
|
+
week: weekNumber()
|
|
2372
|
+
})
|
|
2373
|
+
};
|
|
2374
|
+
},
|
|
2375
|
+
get children() {
|
|
2376
|
+
return weekNumber();
|
|
2377
|
+
}
|
|
2378
|
+
})
|
|
2379
|
+
}));
|
|
2380
|
+
return _el$78;
|
|
2381
|
+
}
|
|
2382
|
+
}), _el$80, _co$21);
|
|
2383
|
+
_$insert(_el$77, _$createComponent(For, {
|
|
2384
|
+
get each() {
|
|
2385
|
+
return week();
|
|
2386
|
+
},
|
|
2387
|
+
children: ({
|
|
2388
|
+
day,
|
|
2389
|
+
key
|
|
2390
|
+
}, column) => {
|
|
2391
|
+
const dayBadge = props.owner.dayBadges?.[key];
|
|
2392
|
+
const sameMonth = () => calendar.isSameMonth(day, continuous() ? parseKey(focusMonthKey()) : props.date, dateConfig());
|
|
2393
|
+
const label = dayLabel(day);
|
|
2394
|
+
const bars = createMemo(() => fit().bars.filter(bar => bar.startColumn === column()));
|
|
2395
|
+
const cell = () => fit().cells[column()] ?? {
|
|
2396
|
+
top: 0,
|
|
2397
|
+
shown: [],
|
|
2398
|
+
hidden: 0
|
|
2399
|
+
};
|
|
2400
|
+
return (() => {
|
|
2401
|
+
var _el$84 = _$getNextElement(_tmpl$25),
|
|
2402
|
+
_el$85 = _el$84.firstChild,
|
|
2403
|
+
_el$86 = _el$85.firstChild,
|
|
2404
|
+
_el$87 = _el$86.nextSibling,
|
|
2405
|
+
[_el$88, _co$23] = _$getNextMarker(_el$87.nextSibling),
|
|
2406
|
+
_el$89 = _el$85.nextSibling,
|
|
2407
|
+
_el$96 = _el$89.firstChild,
|
|
2408
|
+
[_el$97, _co$25] = _$getNextMarker(_el$96.nextSibling),
|
|
2409
|
+
_el$98 = _el$97.nextSibling,
|
|
2410
|
+
[_el$99, _co$26] = _$getNextMarker(_el$98.nextSibling),
|
|
2411
|
+
_el$100 = _el$99.nextSibling,
|
|
2412
|
+
[_el$101, _co$27] = _$getNextMarker(_el$100.nextSibling);
|
|
2413
|
+
_el$84.$$keydown = event => onCellKeyDown(event, key);
|
|
2414
|
+
_el$84.$$contextmenu = event => {
|
|
2415
|
+
// The pressed day takes the focus, so closing the menu with Escape returns there.
|
|
2416
|
+
menuKey = pressedKey(event, key);
|
|
2417
|
+
if (hasMenu()) focusCell(menuKey);
|
|
2418
|
+
};
|
|
2419
|
+
_el$84.$$pointerdown = event => onCellPointerDown(event, key);
|
|
2420
|
+
_el$84.$$dblclick = event => onCellDoubleClick(event, key);
|
|
2421
|
+
_el$84.$$click = event => onCellClick(event, key);
|
|
2422
|
+
_$use(element => {
|
|
2423
|
+
cells.set(key, element);
|
|
2424
|
+
onCleanup(() => {
|
|
2425
|
+
if (cells.get(key) === element) cells.delete(key);
|
|
2426
|
+
});
|
|
2427
|
+
}, _el$84);
|
|
2428
|
+
_$setAttribute(_el$84, "aria-label", label);
|
|
2429
|
+
_$setAttribute(_el$84, "data-calendar-day-key", key);
|
|
2430
|
+
_$insert(_el$86, (() => {
|
|
2431
|
+
var _c$ = _$memo(() => !!(continuous() && key.endsWith("-01")));
|
|
2432
|
+
return () => _c$() ? shortDayLabel(key).replace(/\.$/, "") : calendar.formatDayNumber(day, dateConfig());
|
|
2433
|
+
})());
|
|
2434
|
+
_$insert(_el$85, _$createComponent(Show, {
|
|
2435
|
+
when: dayBadge,
|
|
2436
|
+
children: badge => (() => {
|
|
2437
|
+
var _el$102 = _$getNextElement(_tmpl$19),
|
|
2438
|
+
_el$103 = _el$102.firstChild,
|
|
2439
|
+
[_el$104, _co$28] = _$getNextMarker(_el$103.nextSibling),
|
|
2440
|
+
_el$105 = _el$104.nextSibling,
|
|
2441
|
+
[_el$106, _co$29] = _$getNextMarker(_el$105.nextSibling);
|
|
2442
|
+
_$insert(_el$102, _$createComponent(Show, {
|
|
2443
|
+
get when() {
|
|
2444
|
+
return badge().icon;
|
|
2445
|
+
},
|
|
2446
|
+
children: icon => (() => {
|
|
2447
|
+
var _el$107 = _$getNextElement(_tmpl$3);
|
|
2448
|
+
_$effect(() => _$className(_el$107, `k2b-calendar-month__badge-icon ti ti-${icon()}`));
|
|
2449
|
+
return _el$107;
|
|
2450
|
+
})()
|
|
2451
|
+
}), _el$104, _co$28);
|
|
2452
|
+
_$insert(_el$102, () => badge().label, _el$106, _co$29);
|
|
2453
|
+
return _el$102;
|
|
2454
|
+
})()
|
|
2455
|
+
}), _el$88, _co$23);
|
|
2456
|
+
_$use(element => {
|
|
2457
|
+
if (column() === 0) observeLanes(element, continuous() ? 0 : weekIndex());
|
|
2458
|
+
}, _el$89);
|
|
2459
|
+
_$insert(_el$89, _$createComponent(For, {
|
|
2460
|
+
get each() {
|
|
2461
|
+
return bars();
|
|
2462
|
+
},
|
|
2463
|
+
children: bar => {
|
|
2464
|
+
const span = bar.endColumn - bar.startColumn + 1;
|
|
2465
|
+
const startHint = () => {
|
|
2466
|
+
if (!bar.continuesBefore) return undefined;
|
|
2467
|
+
const hint = calendarMessages().calendarContinuesFrom(hintDate(bar.item.firstKey));
|
|
2468
|
+
return hintFits(bar.item.event.title, hint, span) ? hint : undefined;
|
|
2469
|
+
};
|
|
2470
|
+
const endHint = () => {
|
|
2471
|
+
if (!bar.continuesAfter) return undefined;
|
|
2472
|
+
const hint = calendarMessages().calendarContinuesUntil(hintDate(bar.item.lastKey));
|
|
2473
|
+
return hintFits(`${bar.item.event.title}${startHint() ?? ""}`, hint, span) ? hint : undefined;
|
|
2474
|
+
};
|
|
2475
|
+
return (() => {
|
|
2476
|
+
var _el$108 = _$getNextElement(_tmpl$26);
|
|
2477
|
+
_$spread(_el$108, _$mergeProps({
|
|
2478
|
+
get style() {
|
|
2479
|
+
return {
|
|
2480
|
+
"--k2b-calendar-span": String(span),
|
|
2481
|
+
"--k2b-calendar-row": String(bar.lane)
|
|
2482
|
+
};
|
|
1843
2483
|
},
|
|
1844
|
-
get
|
|
1845
|
-
return
|
|
2484
|
+
get ["data-linked"]() {
|
|
2485
|
+
return linkedItem() === bar.item.key && bar.item.firstKey !== bar.item.lastKey ? "true" : undefined;
|
|
1846
2486
|
},
|
|
1847
|
-
get
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
var _v$0 = calendarMessages().calendarOpenWeekNumber({
|
|
1853
|
-
week: weekNumber()
|
|
1854
|
-
}),
|
|
1855
|
-
_v$1 = calendarMessages().calendarOpenWeekNumber({
|
|
1856
|
-
week: weekNumber()
|
|
1857
|
-
});
|
|
1858
|
-
_v$0 !== _p$.e && _$setAttribute(_el$94, "title", _p$.e = _v$0);
|
|
1859
|
-
_v$1 !== _p$.t && _$setAttribute(_el$94, "aria-label", _p$.t = _v$1);
|
|
1860
|
-
return _p$;
|
|
1861
|
-
}, {
|
|
1862
|
-
e: undefined,
|
|
1863
|
-
t: undefined
|
|
1864
|
-
});
|
|
1865
|
-
_$runHydrationEvents();
|
|
1866
|
-
return _el$94;
|
|
2487
|
+
get ["data-continues-before"]() {
|
|
2488
|
+
return bar.continuesBefore ? "true" : undefined;
|
|
2489
|
+
},
|
|
2490
|
+
get ["data-continues-after"]() {
|
|
2491
|
+
return bar.continuesAfter ? "true" : undefined;
|
|
1867
2492
|
}
|
|
1868
|
-
});
|
|
1869
|
-
|
|
1870
|
-
|
|
2493
|
+
}, () => linkProps(bar.item)), false, true);
|
|
2494
|
+
_$insert(_el$108, _$createComponent(EventChip, {
|
|
2495
|
+
get event() {
|
|
2496
|
+
return bar.item.event;
|
|
2497
|
+
},
|
|
2498
|
+
get owner() {
|
|
2499
|
+
return props.owner;
|
|
2500
|
+
},
|
|
2501
|
+
get href() {
|
|
2502
|
+
return eventHref(props.owner, bar.item.event);
|
|
2503
|
+
},
|
|
2504
|
+
get label() {
|
|
2505
|
+
return itemLabel(bar.item);
|
|
2506
|
+
},
|
|
2507
|
+
compact: true,
|
|
2508
|
+
bar: true,
|
|
2509
|
+
get continuesBefore() {
|
|
2510
|
+
return bar.continuesBefore;
|
|
2511
|
+
},
|
|
2512
|
+
get continuesAfter() {
|
|
2513
|
+
return bar.continuesAfter;
|
|
2514
|
+
},
|
|
2515
|
+
get hintStart() {
|
|
2516
|
+
return startHint();
|
|
2517
|
+
},
|
|
2518
|
+
get hintEnd() {
|
|
2519
|
+
return endHint();
|
|
2520
|
+
},
|
|
2521
|
+
get moving() {
|
|
2522
|
+
return movingEventId() === bar.item.event.id;
|
|
2523
|
+
},
|
|
2524
|
+
get onMovePointerDown() {
|
|
2525
|
+
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startMove(pointerEvent, bar.item, markDragged) : undefined;
|
|
2526
|
+
}
|
|
2527
|
+
}));
|
|
2528
|
+
_$runHydrationEvents();
|
|
2529
|
+
return _el$108;
|
|
2530
|
+
})();
|
|
2531
|
+
}
|
|
2532
|
+
}), _el$97, _co$25);
|
|
2533
|
+
_$insert(_el$89, _$createComponent(For, {
|
|
2534
|
+
get each() {
|
|
2535
|
+
return cell().shown;
|
|
2536
|
+
},
|
|
2537
|
+
children: (item, index) => (() => {
|
|
2538
|
+
var _el$109 = _$getNextElement(_tmpl$27);
|
|
2539
|
+
_$insert(_el$109, _$createComponent(EventChip, {
|
|
2540
|
+
get event() {
|
|
2541
|
+
return item.event;
|
|
2542
|
+
},
|
|
1871
2543
|
get owner() {
|
|
1872
2544
|
return props.owner;
|
|
1873
2545
|
},
|
|
1874
2546
|
get href() {
|
|
1875
|
-
return
|
|
1876
|
-
},
|
|
1877
|
-
get anchorProps() {
|
|
1878
|
-
return {
|
|
1879
|
-
class: "k2b-calendar-month__week-link",
|
|
1880
|
-
tabIndex: -1,
|
|
1881
|
-
title: calendarMessages().calendarOpenWeekNumber({
|
|
1882
|
-
week: weekNumber()
|
|
1883
|
-
}),
|
|
1884
|
-
"aria-label": calendarMessages().calendarOpenWeekNumber({
|
|
1885
|
-
week: weekNumber()
|
|
1886
|
-
})
|
|
1887
|
-
};
|
|
1888
|
-
},
|
|
1889
|
-
get children() {
|
|
1890
|
-
return weekNumber();
|
|
1891
|
-
}
|
|
1892
|
-
})
|
|
1893
|
-
}));
|
|
1894
|
-
return _el$89;
|
|
1895
|
-
}
|
|
1896
|
-
}), _el$91, _co$24);
|
|
1897
|
-
_$insert(_el$88, _$createComponent(For, {
|
|
1898
|
-
each: week,
|
|
1899
|
-
children: ({
|
|
1900
|
-
day,
|
|
1901
|
-
key
|
|
1902
|
-
}, column) => {
|
|
1903
|
-
const dayBadge = props.owner.dayBadges?.[key];
|
|
1904
|
-
const sameMonth = calendar.isSameMonth(day, props.date, dateConfig());
|
|
1905
|
-
const label = dayLabel(day);
|
|
1906
|
-
const bars = createMemo(() => fit().bars.filter(bar => bar.startColumn === column()));
|
|
1907
|
-
const cell = () => fit().cells[column()] ?? {
|
|
1908
|
-
top: 0,
|
|
1909
|
-
shown: [],
|
|
1910
|
-
hidden: 0
|
|
1911
|
-
};
|
|
1912
|
-
return (() => {
|
|
1913
|
-
var _el$95 = _$getNextElement(_tmpl$27),
|
|
1914
|
-
_el$96 = _el$95.firstChild,
|
|
1915
|
-
_el$97 = _el$96.firstChild,
|
|
1916
|
-
_el$98 = _el$97.nextSibling,
|
|
1917
|
-
[_el$99, _co$26] = _$getNextMarker(_el$98.nextSibling),
|
|
1918
|
-
_el$100 = _el$96.nextSibling,
|
|
1919
|
-
_el$107 = _el$100.firstChild,
|
|
1920
|
-
[_el$108, _co$28] = _$getNextMarker(_el$107.nextSibling),
|
|
1921
|
-
_el$109 = _el$108.nextSibling,
|
|
1922
|
-
[_el$110, _co$29] = _$getNextMarker(_el$109.nextSibling),
|
|
1923
|
-
_el$111 = _el$110.nextSibling,
|
|
1924
|
-
[_el$112, _co$30] = _$getNextMarker(_el$111.nextSibling);
|
|
1925
|
-
_el$95.$$keydown = event => onCellKeyDown(event, key);
|
|
1926
|
-
_el$95.$$contextmenu = event => {
|
|
1927
|
-
// The pressed day takes the focus, so closing the menu with Escape returns there.
|
|
1928
|
-
menuKey = pressedKey(event, key);
|
|
1929
|
-
if (hasMenu()) focusCell(menuKey);
|
|
1930
|
-
};
|
|
1931
|
-
_el$95.$$pointerdown = event => onCellPointerDown(event, key);
|
|
1932
|
-
_el$95.$$dblclick = event => onCellDoubleClick(event, key);
|
|
1933
|
-
_el$95.$$click = event => onCellClick(event, key);
|
|
1934
|
-
_$use(element => cells.set(key, element), _el$95);
|
|
1935
|
-
_$setAttribute(_el$95, "aria-label", label);
|
|
1936
|
-
_$setAttribute(_el$95, "data-calendar-day-key", key);
|
|
1937
|
-
_$setAttribute(_el$95, "data-outside", !sameMonth ? "true" : undefined);
|
|
1938
|
-
_$setAttribute(_el$97, "data-outside", !sameMonth ? "true" : undefined);
|
|
1939
|
-
_$insert(_el$97, () => calendar.formatDayNumber(day, dateConfig()));
|
|
1940
|
-
_$insert(_el$96, _$createComponent(Show, {
|
|
1941
|
-
when: dayBadge,
|
|
1942
|
-
children: badge => (() => {
|
|
1943
|
-
var _el$113 = _$getNextElement(_tmpl$19),
|
|
1944
|
-
_el$114 = _el$113.firstChild,
|
|
1945
|
-
[_el$115, _co$31] = _$getNextMarker(_el$114.nextSibling),
|
|
1946
|
-
_el$116 = _el$115.nextSibling,
|
|
1947
|
-
[_el$117, _co$32] = _$getNextMarker(_el$116.nextSibling);
|
|
1948
|
-
_$insert(_el$113, _$createComponent(Show, {
|
|
1949
|
-
get when() {
|
|
1950
|
-
return badge().icon;
|
|
1951
|
-
},
|
|
1952
|
-
children: icon => (() => {
|
|
1953
|
-
var _el$118 = _$getNextElement(_tmpl$3);
|
|
1954
|
-
_$effect(() => _$className(_el$118, `k2b-calendar-month__badge-icon ti ti-${icon()}`));
|
|
1955
|
-
return _el$118;
|
|
1956
|
-
})()
|
|
1957
|
-
}), _el$115, _co$31);
|
|
1958
|
-
_$insert(_el$113, () => badge().label, _el$117, _co$32);
|
|
1959
|
-
return _el$113;
|
|
1960
|
-
})()
|
|
1961
|
-
}), _el$99, _co$26);
|
|
1962
|
-
_$use(element => {
|
|
1963
|
-
if (column() === 0) observeLanes(element, weekIndex());
|
|
1964
|
-
}, _el$100);
|
|
1965
|
-
_$insert(_el$100, _$createComponent(For, {
|
|
1966
|
-
get each() {
|
|
1967
|
-
return bars();
|
|
2547
|
+
return eventHref(props.owner, item.event);
|
|
1968
2548
|
},
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
if (!bar.continuesBefore) return undefined;
|
|
1973
|
-
const hint = calendarMessages().calendarContinuesFrom(hintDate(bar.item.firstKey));
|
|
1974
|
-
return hintFits(bar.item.event.title, hint, span) ? hint : undefined;
|
|
1975
|
-
};
|
|
1976
|
-
const endHint = () => {
|
|
1977
|
-
if (!bar.continuesAfter) return undefined;
|
|
1978
|
-
const hint = calendarMessages().calendarContinuesUntil(hintDate(bar.item.lastKey));
|
|
1979
|
-
return hintFits(`${bar.item.event.title}${startHint() ?? ""}`, hint, span) ? hint : undefined;
|
|
1980
|
-
};
|
|
1981
|
-
return (() => {
|
|
1982
|
-
var _el$119 = _$getNextElement(_tmpl$28);
|
|
1983
|
-
_$spread(_el$119, _$mergeProps({
|
|
1984
|
-
get style() {
|
|
1985
|
-
return {
|
|
1986
|
-
"--k2b-calendar-span": String(span),
|
|
1987
|
-
"--k2b-calendar-row": String(bar.lane)
|
|
1988
|
-
};
|
|
1989
|
-
},
|
|
1990
|
-
get ["data-linked"]() {
|
|
1991
|
-
return linkedItem() === bar.item.key && bar.item.firstKey !== bar.item.lastKey ? "true" : undefined;
|
|
1992
|
-
},
|
|
1993
|
-
get ["data-continues-before"]() {
|
|
1994
|
-
return bar.continuesBefore ? "true" : undefined;
|
|
1995
|
-
},
|
|
1996
|
-
get ["data-continues-after"]() {
|
|
1997
|
-
return bar.continuesAfter ? "true" : undefined;
|
|
1998
|
-
}
|
|
1999
|
-
}, () => linkProps(bar.item)), false, true);
|
|
2000
|
-
_$insert(_el$119, _$createComponent(EventChip, {
|
|
2001
|
-
get event() {
|
|
2002
|
-
return bar.item.event;
|
|
2003
|
-
},
|
|
2004
|
-
get owner() {
|
|
2005
|
-
return props.owner;
|
|
2006
|
-
},
|
|
2007
|
-
get href() {
|
|
2008
|
-
return eventHref(props.owner, bar.item.event);
|
|
2009
|
-
},
|
|
2010
|
-
get label() {
|
|
2011
|
-
return itemLabel(bar.item);
|
|
2012
|
-
},
|
|
2013
|
-
compact: true,
|
|
2014
|
-
bar: true,
|
|
2015
|
-
get continuesBefore() {
|
|
2016
|
-
return bar.continuesBefore;
|
|
2017
|
-
},
|
|
2018
|
-
get continuesAfter() {
|
|
2019
|
-
return bar.continuesAfter;
|
|
2020
|
-
},
|
|
2021
|
-
get hintStart() {
|
|
2022
|
-
return startHint();
|
|
2023
|
-
},
|
|
2024
|
-
get hintEnd() {
|
|
2025
|
-
return endHint();
|
|
2026
|
-
},
|
|
2027
|
-
get moving() {
|
|
2028
|
-
return movingEventId() === bar.item.event.id;
|
|
2029
|
-
},
|
|
2030
|
-
get onMovePointerDown() {
|
|
2031
|
-
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startMove(pointerEvent, bar.item, markDragged) : undefined;
|
|
2032
|
-
}
|
|
2033
|
-
}));
|
|
2034
|
-
_$runHydrationEvents();
|
|
2035
|
-
return _el$119;
|
|
2036
|
-
})();
|
|
2037
|
-
}
|
|
2038
|
-
}), _el$108, _co$28);
|
|
2039
|
-
_$insert(_el$100, _$createComponent(For, {
|
|
2040
|
-
get each() {
|
|
2041
|
-
return cell().shown;
|
|
2549
|
+
compact: true,
|
|
2550
|
+
get leadingTime() {
|
|
2551
|
+
return leadingTime(item);
|
|
2042
2552
|
},
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
_$insert(_el$120, _$createComponent(EventChip, {
|
|
2046
|
-
get event() {
|
|
2047
|
-
return item.event;
|
|
2048
|
-
},
|
|
2049
|
-
get owner() {
|
|
2050
|
-
return props.owner;
|
|
2051
|
-
},
|
|
2052
|
-
get href() {
|
|
2053
|
-
return eventHref(props.owner, item.event);
|
|
2054
|
-
},
|
|
2055
|
-
compact: true,
|
|
2056
|
-
get leadingTime() {
|
|
2057
|
-
return leadingTime(item);
|
|
2058
|
-
},
|
|
2059
|
-
get moving() {
|
|
2060
|
-
return movingEventId() === item.event.id;
|
|
2061
|
-
},
|
|
2062
|
-
get onMovePointerDown() {
|
|
2063
|
-
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startMove(pointerEvent, item, markDragged) : undefined;
|
|
2064
|
-
}
|
|
2065
|
-
}));
|
|
2066
|
-
_$effect(_$p => _$setStyleProperty(_el$120, "--k2b-calendar-row", String(cell().top + index())));
|
|
2067
|
-
return _el$120;
|
|
2068
|
-
})()
|
|
2069
|
-
}), _el$110, _co$29);
|
|
2070
|
-
_$insert(_el$100, _$createComponent(Show, {
|
|
2071
|
-
get when() {
|
|
2072
|
-
return cell().hidden > 0;
|
|
2553
|
+
get moving() {
|
|
2554
|
+
return movingEventId() === item.event.id;
|
|
2073
2555
|
},
|
|
2074
|
-
get
|
|
2075
|
-
|
|
2076
|
-
_el$102 = _el$101.firstChild,
|
|
2077
|
-
_el$103 = _el$102.nextSibling,
|
|
2078
|
-
_el$104 = _el$103.firstChild,
|
|
2079
|
-
_el$105 = _el$104.nextSibling,
|
|
2080
|
-
[_el$106, _co$27] = _$getNextMarker(_el$105.nextSibling);
|
|
2081
|
-
_el$101.$$click = () => {
|
|
2082
|
-
const current = popover();
|
|
2083
|
-
if (current?.kind === "day" && current.dayKey === key) closePopover(false);else openDayList(key);
|
|
2084
|
-
};
|
|
2085
|
-
_$insert(_el$102, () => calendarMessages().calendarMoreEvents({
|
|
2086
|
-
count: cell().hidden
|
|
2087
|
-
}));
|
|
2088
|
-
_$insert(_el$103, () => cell().hidden, _el$106, _co$27);
|
|
2089
|
-
_$effect(_p$ => {
|
|
2090
|
-
var _v$10 = String(cell().top + cell().shown.length),
|
|
2091
|
-
_v$11 = calendarMessages().calendarMoreEventsOn({
|
|
2092
|
-
count: cell().hidden,
|
|
2093
|
-
label
|
|
2094
|
-
}),
|
|
2095
|
-
_v$12 = (() => {
|
|
2096
|
-
const current = popover();
|
|
2097
|
-
return current?.kind === "day" && current.dayKey === key;
|
|
2098
|
-
})();
|
|
2099
|
-
_v$10 !== _p$.e && _$setStyleProperty(_el$101, "--k2b-calendar-row", _p$.e = _v$10);
|
|
2100
|
-
_v$11 !== _p$.t && _$setAttribute(_el$101, "aria-label", _p$.t = _v$11);
|
|
2101
|
-
_v$12 !== _p$.a && _$setAttribute(_el$101, "aria-expanded", _p$.a = _v$12);
|
|
2102
|
-
return _p$;
|
|
2103
|
-
}, {
|
|
2104
|
-
e: undefined,
|
|
2105
|
-
t: undefined,
|
|
2106
|
-
a: undefined
|
|
2107
|
-
});
|
|
2108
|
-
_$runHydrationEvents();
|
|
2109
|
-
return _el$101;
|
|
2556
|
+
get onMovePointerDown() {
|
|
2557
|
+
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startMove(pointerEvent, item, markDragged) : undefined;
|
|
2110
2558
|
}
|
|
2111
|
-
})
|
|
2559
|
+
}));
|
|
2560
|
+
_$effect(_$p => _$setStyleProperty(_el$109, "--k2b-calendar-row", String(cell().top + index())));
|
|
2561
|
+
return _el$109;
|
|
2562
|
+
})()
|
|
2563
|
+
}), _el$99, _co$26);
|
|
2564
|
+
_$insert(_el$89, _$createComponent(Show, {
|
|
2565
|
+
get when() {
|
|
2566
|
+
return cell().hidden > 0;
|
|
2567
|
+
},
|
|
2568
|
+
get children() {
|
|
2569
|
+
var _el$90 = _$getNextElement(_tmpl$24),
|
|
2570
|
+
_el$91 = _el$90.firstChild,
|
|
2571
|
+
_el$92 = _el$91.nextSibling,
|
|
2572
|
+
_el$93 = _el$92.firstChild,
|
|
2573
|
+
_el$94 = _el$93.nextSibling,
|
|
2574
|
+
[_el$95, _co$24] = _$getNextMarker(_el$94.nextSibling);
|
|
2575
|
+
_el$90.$$click = () => {
|
|
2576
|
+
const current = popover();
|
|
2577
|
+
if (current?.kind === "day" && current.dayKey === key) closePopover(false);else openDayList(key);
|
|
2578
|
+
};
|
|
2579
|
+
_$insert(_el$91, () => calendarMessages().calendarMoreEvents({
|
|
2580
|
+
count: cell().hidden
|
|
2581
|
+
}));
|
|
2582
|
+
_$insert(_el$92, () => cell().hidden, _el$95, _co$24);
|
|
2112
2583
|
_$effect(_p$ => {
|
|
2113
|
-
var _v$
|
|
2114
|
-
_v$
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
_v$
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
_v$
|
|
2123
|
-
_v$
|
|
2124
|
-
_v$
|
|
2125
|
-
_v$17 !== _p$.i && _$setAttribute(_el$95, "data-past", _p$.i = _v$17);
|
|
2126
|
-
_v$18 !== _p$.n && _$setAttribute(_el$95, "data-selected", _p$.n = _v$18);
|
|
2127
|
-
_v$19 !== _p$.s && _$setAttribute(_el$95, "data-drop-preview", _p$.s = _v$19);
|
|
2128
|
-
_v$20 !== _p$.h && _$setAttribute(_el$97, "data-today", _p$.h = _v$20);
|
|
2584
|
+
var _v$11 = String(cell().top + cell().shown.length),
|
|
2585
|
+
_v$12 = calendarMessages().calendarMoreEventsOn({
|
|
2586
|
+
count: cell().hidden,
|
|
2587
|
+
label
|
|
2588
|
+
}),
|
|
2589
|
+
_v$13 = (() => {
|
|
2590
|
+
const current = popover();
|
|
2591
|
+
return current?.kind === "day" && current.dayKey === key;
|
|
2592
|
+
})();
|
|
2593
|
+
_v$11 !== _p$.e && _$setStyleProperty(_el$90, "--k2b-calendar-row", _p$.e = _v$11);
|
|
2594
|
+
_v$12 !== _p$.t && _$setAttribute(_el$90, "aria-label", _p$.t = _v$12);
|
|
2595
|
+
_v$13 !== _p$.a && _$setAttribute(_el$90, "aria-expanded", _p$.a = _v$13);
|
|
2129
2596
|
return _p$;
|
|
2130
2597
|
}, {
|
|
2131
2598
|
e: undefined,
|
|
2132
2599
|
t: undefined,
|
|
2133
|
-
a: undefined
|
|
2134
|
-
o: undefined,
|
|
2135
|
-
i: undefined,
|
|
2136
|
-
n: undefined,
|
|
2137
|
-
s: undefined,
|
|
2138
|
-
h: undefined
|
|
2600
|
+
a: undefined
|
|
2139
2601
|
});
|
|
2140
2602
|
_$runHydrationEvents();
|
|
2141
|
-
return _el$
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2603
|
+
return _el$90;
|
|
2604
|
+
}
|
|
2605
|
+
}), _el$101, _co$27);
|
|
2606
|
+
_$effect(_p$ => {
|
|
2607
|
+
var _v$14 = rovingKey() === key ? 0 : -1,
|
|
2608
|
+
_v$15 = within(selection(), key) ? "true" : "false",
|
|
2609
|
+
_v$16 = key === todayKey() ? "date" : undefined,
|
|
2610
|
+
_v$17 = !sameMonth() ? "true" : undefined,
|
|
2611
|
+
_v$18 = continuous() && key.endsWith("-01") ? "true" : undefined,
|
|
2612
|
+
_v$19 = continuous() && Number(key.slice(8)) <= 7 ? "true" : undefined,
|
|
2613
|
+
_v$20 = column() > 4 ? "true" : undefined,
|
|
2614
|
+
_v$21 = key < todayKey() ? "true" : undefined,
|
|
2615
|
+
_v$22 = selectionPart(key),
|
|
2616
|
+
_v$23 = within(dropRange(), key) ? "true" : undefined,
|
|
2617
|
+
_v$24 = continuous() && pulseKey() === key ? "true" : undefined,
|
|
2618
|
+
_v$25 = key === todayKey() ? "true" : undefined,
|
|
2619
|
+
_v$26 = !sameMonth() ? "true" : undefined;
|
|
2620
|
+
_v$14 !== _p$.e && _$setAttribute(_el$84, "tabindex", _p$.e = _v$14);
|
|
2621
|
+
_v$15 !== _p$.t && _$setAttribute(_el$84, "aria-selected", _p$.t = _v$15);
|
|
2622
|
+
_v$16 !== _p$.a && _$setAttribute(_el$84, "aria-current", _p$.a = _v$16);
|
|
2623
|
+
_v$17 !== _p$.o && _$setAttribute(_el$84, "data-outside", _p$.o = _v$17);
|
|
2624
|
+
_v$18 !== _p$.i && _$setAttribute(_el$84, "data-month-first", _p$.i = _v$18);
|
|
2625
|
+
_v$19 !== _p$.n && _$setAttribute(_el$84, "data-month-top", _p$.n = _v$19);
|
|
2626
|
+
_v$20 !== _p$.s && _$setAttribute(_el$84, "data-weekend", _p$.s = _v$20);
|
|
2627
|
+
_v$21 !== _p$.h && _$setAttribute(_el$84, "data-past", _p$.h = _v$21);
|
|
2628
|
+
_v$22 !== _p$.r && _$setAttribute(_el$84, "data-selected", _p$.r = _v$22);
|
|
2629
|
+
_v$23 !== _p$.d && _$setAttribute(_el$84, "data-drop-preview", _p$.d = _v$23);
|
|
2630
|
+
_v$24 !== _p$.l && _$setAttribute(_el$86, "data-pulse", _p$.l = _v$24);
|
|
2631
|
+
_v$25 !== _p$.u && _$setAttribute(_el$86, "data-today", _p$.u = _v$25);
|
|
2632
|
+
_v$26 !== _p$.c && _$setAttribute(_el$86, "data-outside", _p$.c = _v$26);
|
|
2633
|
+
return _p$;
|
|
2634
|
+
}, {
|
|
2635
|
+
e: undefined,
|
|
2636
|
+
t: undefined,
|
|
2637
|
+
a: undefined,
|
|
2638
|
+
o: undefined,
|
|
2639
|
+
i: undefined,
|
|
2640
|
+
n: undefined,
|
|
2641
|
+
s: undefined,
|
|
2642
|
+
h: undefined,
|
|
2643
|
+
r: undefined,
|
|
2644
|
+
d: undefined,
|
|
2645
|
+
l: undefined,
|
|
2646
|
+
u: undefined,
|
|
2647
|
+
c: undefined
|
|
2648
|
+
});
|
|
2649
|
+
_$runHydrationEvents();
|
|
2650
|
+
return _el$84;
|
|
2651
|
+
})();
|
|
2652
|
+
}
|
|
2653
|
+
}), _el$82, _co$22);
|
|
2654
|
+
_$effect(_p$ => {
|
|
2655
|
+
var _v$7 = continuous() ? week()[0]?.key : undefined,
|
|
2656
|
+
_v$8 = continuous() ? weekIndex() + 2 : undefined,
|
|
2657
|
+
_v$9 = continuous() ? {
|
|
2658
|
+
"--k2b-calendar-week-index": String(weekIndex())
|
|
2659
|
+
} : undefined,
|
|
2660
|
+
_v$0 = props.owner.withWeekNumbers ? "true" : undefined;
|
|
2661
|
+
_v$7 !== _p$.e && _$setAttribute(_el$77, "data-week-key", _p$.e = _v$7);
|
|
2662
|
+
_v$8 !== _p$.t && _$setAttribute(_el$77, "aria-rowindex", _p$.t = _v$8);
|
|
2663
|
+
_p$.a = _$style(_el$77, _v$9, _p$.a);
|
|
2664
|
+
_v$0 !== _p$.o && _$setAttribute(_el$77, "data-week-numbers", _p$.o = _v$0);
|
|
2665
|
+
return _p$;
|
|
2666
|
+
}, {
|
|
2667
|
+
e: undefined,
|
|
2668
|
+
t: undefined,
|
|
2669
|
+
a: undefined,
|
|
2670
|
+
o: undefined
|
|
2671
|
+
});
|
|
2672
|
+
return _el$77;
|
|
2673
|
+
})();
|
|
2674
|
+
};
|
|
2675
|
+
const weekdayRow = () => (() => {
|
|
2676
|
+
var _el$110 = _$getNextElement(_tmpl$29),
|
|
2677
|
+
_el$112 = _el$110.firstChild,
|
|
2678
|
+
[_el$113, _co$30] = _$getNextMarker(_el$112.nextSibling),
|
|
2679
|
+
_el$114 = _el$113.nextSibling,
|
|
2680
|
+
[_el$115, _co$31] = _$getNextMarker(_el$114.nextSibling);
|
|
2681
|
+
var _ref$ = weekdayElement;
|
|
2682
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$110) : weekdayElement = _el$110;
|
|
2683
|
+
_$insert(_el$110, _$createComponent(Show, {
|
|
2684
|
+
get when() {
|
|
2685
|
+
return props.owner.withWeekNumbers;
|
|
2686
|
+
},
|
|
2687
|
+
get children() {
|
|
2688
|
+
var _el$111 = _$getNextElement(_tmpl$28);
|
|
2689
|
+
_$insert(_el$111, () => calendarMessages().weekShort);
|
|
2690
|
+
return _el$111;
|
|
2148
2691
|
}
|
|
2149
|
-
}), _el$
|
|
2692
|
+
}), _el$113, _co$30);
|
|
2693
|
+
_$insert(_el$110, _$createComponent(For, {
|
|
2694
|
+
get each() {
|
|
2695
|
+
return weekdays();
|
|
2696
|
+
},
|
|
2697
|
+
children: (day, index) => (() => {
|
|
2698
|
+
var _el$116 = _$getNextElement(_tmpl$28);
|
|
2699
|
+
_$insert(_el$116, day);
|
|
2700
|
+
_$effect(() => _$setAttribute(_el$116, "data-weekend", index() > 4 ? "true" : undefined));
|
|
2701
|
+
return _el$116;
|
|
2702
|
+
})()
|
|
2703
|
+
}), _el$115, _co$31);
|
|
2704
|
+
_$effect(() => _$setAttribute(_el$110, "data-week-numbers", props.owner.withWeekNumbers ? "true" : undefined));
|
|
2705
|
+
return _el$110;
|
|
2706
|
+
})();
|
|
2707
|
+
const grid = () => (() => {
|
|
2708
|
+
var _el$117 = _$getNextElement(_tmpl$30),
|
|
2709
|
+
_el$118 = _el$117.firstChild,
|
|
2710
|
+
[_el$119, _co$32] = _$getNextMarker(_el$118.nextSibling),
|
|
2711
|
+
_el$120 = _el$119.nextSibling,
|
|
2712
|
+
[_el$121, _co$33] = _$getNextMarker(_el$120.nextSibling);
|
|
2713
|
+
_$insert(_el$117, weekdayRow, _el$119, _co$32);
|
|
2714
|
+
_$insert(_el$117, _$createComponent(For, {
|
|
2715
|
+
get each() {
|
|
2716
|
+
return weeks();
|
|
2717
|
+
},
|
|
2718
|
+
children: (week, index) => weekRow(() => week, index)
|
|
2719
|
+
}), _el$121, _co$33);
|
|
2720
|
+
_$effect(_p$ => {
|
|
2721
|
+
var _v$27 = formatMonth(props.date, dateConfig()),
|
|
2722
|
+
_v$28 = `auto repeat(${weeks().length}, minmax(5rem, 1fr))`;
|
|
2723
|
+
_v$27 !== _p$.e && _$setAttribute(_el$117, "aria-label", _p$.e = _v$27);
|
|
2724
|
+
_v$28 !== _p$.t && _$setStyleProperty(_el$117, "grid-template-rows", _p$.t = _v$28);
|
|
2725
|
+
return _p$;
|
|
2726
|
+
}, {
|
|
2727
|
+
e: undefined,
|
|
2728
|
+
t: undefined
|
|
2729
|
+
});
|
|
2730
|
+
return _el$117;
|
|
2731
|
+
})();
|
|
2732
|
+
const continuousRow = key => {
|
|
2733
|
+
const days = createMemo(() => Array.from({
|
|
2734
|
+
length: 7
|
|
2735
|
+
}, (_, offset) => {
|
|
2736
|
+
const dayKey = addDayKeys(key, offset);
|
|
2737
|
+
return {
|
|
2738
|
+
day: parseKey(dayKey),
|
|
2739
|
+
key: dayKey
|
|
2740
|
+
};
|
|
2741
|
+
}));
|
|
2742
|
+
return weekRow(days, () => monthRowOf(trackWeeks(), key) ?? 0);
|
|
2743
|
+
};
|
|
2744
|
+
const continuousGrid = () => (() => {
|
|
2745
|
+
var _el$122 = _$getNextElement(_tmpl$31),
|
|
2746
|
+
_el$123 = _el$122.firstChild,
|
|
2747
|
+
_el$125 = _el$123.firstChild,
|
|
2748
|
+
[_el$126, _co$34] = _$getNextMarker(_el$125.nextSibling),
|
|
2749
|
+
_el$124 = _el$126.nextSibling,
|
|
2750
|
+
_el$127 = _el$123.nextSibling;
|
|
2751
|
+
_el$123.$$focusin = event => {
|
|
2752
|
+
const target = event.target;
|
|
2753
|
+
if (!(target instanceof Element)) return;
|
|
2754
|
+
const key = target.closest("[data-calendar-day-key]")?.getAttribute("data-calendar-day-key");
|
|
2755
|
+
if (key) setFocusedCellKey(key);
|
|
2756
|
+
};
|
|
2757
|
+
_el$123.$$pointerdown = cancelGlide;
|
|
2758
|
+
_el$123.addEventListener("wheel", cancelGlide);
|
|
2759
|
+
_el$123.addEventListener("scroll", onScroll);
|
|
2760
|
+
var _ref$2 = scroller;
|
|
2761
|
+
typeof _ref$2 === "function" ? _$use(_ref$2, _el$123) : scroller = _el$123;
|
|
2762
|
+
_$insert(_el$123, weekdayRow, _el$126, _co$34);
|
|
2763
|
+
_$insert(_el$124, _$createComponent(For, {
|
|
2764
|
+
get each() {
|
|
2765
|
+
return renderedWeeks();
|
|
2766
|
+
},
|
|
2767
|
+
children: continuousRow
|
|
2768
|
+
}));
|
|
2769
|
+
_$insert(_el$127, () => formatMonth(parseKey(focusMonthKey()), dateConfig()));
|
|
2150
2770
|
_$effect(_p$ => {
|
|
2151
|
-
var _v$
|
|
2152
|
-
_v$
|
|
2153
|
-
_v$
|
|
2154
|
-
|
|
2155
|
-
_v$
|
|
2156
|
-
_v$
|
|
2771
|
+
var _v$29 = formatMonth(parseKey(focusMonthKey()), dateConfig()),
|
|
2772
|
+
_v$30 = trackWeeks().length + 1,
|
|
2773
|
+
_v$31 = String(trackWeeks().length),
|
|
2774
|
+
_v$32 = labelShown() ? "true" : "false";
|
|
2775
|
+
_v$29 !== _p$.e && _$setAttribute(_el$123, "aria-label", _p$.e = _v$29);
|
|
2776
|
+
_v$30 !== _p$.t && _$setAttribute(_el$123, "aria-rowcount", _p$.t = _v$30);
|
|
2777
|
+
_v$31 !== _p$.a && _$setStyleProperty(_el$124, "--k2b-calendar-weeks", _p$.a = _v$31);
|
|
2778
|
+
_v$32 !== _p$.o && _$setAttribute(_el$127, "data-show", _p$.o = _v$32);
|
|
2157
2779
|
return _p$;
|
|
2158
2780
|
}, {
|
|
2159
2781
|
e: undefined,
|
|
2160
2782
|
t: undefined,
|
|
2161
|
-
a: undefined
|
|
2783
|
+
a: undefined,
|
|
2784
|
+
o: undefined
|
|
2162
2785
|
});
|
|
2163
|
-
|
|
2786
|
+
_$runHydrationEvents();
|
|
2787
|
+
return _el$122;
|
|
2164
2788
|
})();
|
|
2165
2789
|
const dayList = dayKey => {
|
|
2166
2790
|
const day = parseKey(dayKey);
|
|
@@ -2168,36 +2792,36 @@ const MonthView = props => {
|
|
|
2168
2792
|
// Read where it renders, so a refresh while the list is open updates it as it does the grid.
|
|
2169
2793
|
const entries = () => dayEntries(dayKey);
|
|
2170
2794
|
return (() => {
|
|
2171
|
-
var _el$
|
|
2172
|
-
_el$
|
|
2173
|
-
_el$
|
|
2174
|
-
[_el$
|
|
2175
|
-
_el$
|
|
2176
|
-
_el$
|
|
2177
|
-
[_el$
|
|
2178
|
-
_el$
|
|
2179
|
-
[_el$
|
|
2180
|
-
_$insert(_el$
|
|
2181
|
-
_$insert(_el$
|
|
2795
|
+
var _el$128 = _$getNextElement(_tmpl$34),
|
|
2796
|
+
_el$129 = _el$128.firstChild,
|
|
2797
|
+
_el$137 = _el$129.nextSibling,
|
|
2798
|
+
[_el$138, _co$37] = _$getNextMarker(_el$137.nextSibling),
|
|
2799
|
+
_el$131 = _el$138.nextSibling,
|
|
2800
|
+
_el$133 = _el$131.firstChild,
|
|
2801
|
+
[_el$134, _co$35] = _$getNextMarker(_el$133.nextSibling),
|
|
2802
|
+
_el$135 = _el$134.nextSibling,
|
|
2803
|
+
[_el$136, _co$36] = _$getNextMarker(_el$135.nextSibling);
|
|
2804
|
+
_$insert(_el$129, () => dayLabel(day));
|
|
2805
|
+
_$insert(_el$128, _$createComponent(Show, {
|
|
2182
2806
|
get when() {
|
|
2183
2807
|
return entries().length > 0;
|
|
2184
2808
|
},
|
|
2185
2809
|
get fallback() {
|
|
2186
2810
|
return (() => {
|
|
2187
|
-
var _el$
|
|
2188
|
-
_$insert(_el$
|
|
2189
|
-
return _el$
|
|
2811
|
+
var _el$139 = _$getNextElement(_tmpl$35);
|
|
2812
|
+
_$insert(_el$139, () => calendarMessages().calendarNothingPlanned);
|
|
2813
|
+
return _el$139;
|
|
2190
2814
|
})();
|
|
2191
2815
|
},
|
|
2192
2816
|
get children() {
|
|
2193
|
-
var _el$
|
|
2194
|
-
_$insert(_el$
|
|
2817
|
+
var _el$130 = _$getNextElement(_tmpl$32);
|
|
2818
|
+
_$insert(_el$130, _$createComponent(For, {
|
|
2195
2819
|
get each() {
|
|
2196
2820
|
return entries();
|
|
2197
2821
|
},
|
|
2198
2822
|
children: item => (() => {
|
|
2199
|
-
var _el$
|
|
2200
|
-
_$insert(_el$
|
|
2823
|
+
var _el$140 = _$getNextElement(_tmpl$36);
|
|
2824
|
+
_$insert(_el$140, _$createComponent(EventChip, {
|
|
2201
2825
|
get event() {
|
|
2202
2826
|
return item.event;
|
|
2203
2827
|
},
|
|
@@ -2218,13 +2842,13 @@ const MonthView = props => {
|
|
|
2218
2842
|
return leadingTime(item);
|
|
2219
2843
|
}
|
|
2220
2844
|
}));
|
|
2221
|
-
return _el$
|
|
2845
|
+
return _el$140;
|
|
2222
2846
|
})()
|
|
2223
2847
|
}));
|
|
2224
|
-
return _el$
|
|
2848
|
+
return _el$130;
|
|
2225
2849
|
}
|
|
2226
|
-
}), _el$
|
|
2227
|
-
_$insert(_el$
|
|
2850
|
+
}), _el$138, _co$37);
|
|
2851
|
+
_$insert(_el$131, _$createComponent(Show, {
|
|
2228
2852
|
when: href,
|
|
2229
2853
|
get fallback() {
|
|
2230
2854
|
return _$createComponent(Show, {
|
|
@@ -2238,7 +2862,7 @@ const MonthView = props => {
|
|
|
2238
2862
|
size: "sm",
|
|
2239
2863
|
onClick: () => openView(dayKey, "day"),
|
|
2240
2864
|
get children() {
|
|
2241
|
-
return [_$getNextElement(_tmpl$
|
|
2865
|
+
return [_$getNextElement(_tmpl$37), _$memo(() => calendarMessages().calendarOpenDay)];
|
|
2242
2866
|
}
|
|
2243
2867
|
});
|
|
2244
2868
|
}
|
|
@@ -2257,11 +2881,11 @@ const MonthView = props => {
|
|
|
2257
2881
|
"data-size": "sm"
|
|
2258
2882
|
},
|
|
2259
2883
|
get children() {
|
|
2260
|
-
return [_$getNextElement(_tmpl$
|
|
2884
|
+
return [_$getNextElement(_tmpl$37), _$memo(() => calendarMessages().calendarOpenDay)];
|
|
2261
2885
|
}
|
|
2262
2886
|
})
|
|
2263
|
-
}), _el$
|
|
2264
|
-
_$insert(_el$
|
|
2887
|
+
}), _el$134, _co$35);
|
|
2888
|
+
_$insert(_el$131, _$createComponent(Show, {
|
|
2265
2889
|
get when() {
|
|
2266
2890
|
return props.owner.renderQuickCreate;
|
|
2267
2891
|
},
|
|
@@ -2280,20 +2904,21 @@ const MonthView = props => {
|
|
|
2280
2904
|
});
|
|
2281
2905
|
},
|
|
2282
2906
|
get children() {
|
|
2283
|
-
return [_$getNextElement(_tmpl$
|
|
2907
|
+
return [_$getNextElement(_tmpl$33), _$memo(() => calendarMessages().calendarNewEvent)];
|
|
2284
2908
|
}
|
|
2285
2909
|
});
|
|
2286
2910
|
}
|
|
2287
|
-
}), _el$
|
|
2288
|
-
return _el$
|
|
2911
|
+
}), _el$136, _co$36);
|
|
2912
|
+
return _el$128;
|
|
2289
2913
|
})();
|
|
2290
2914
|
};
|
|
2915
|
+
const viewGrid = () => continuous() ? continuousGrid() : grid();
|
|
2291
2916
|
return [_$createComponent(Show, {
|
|
2292
2917
|
get when() {
|
|
2293
2918
|
return hasMenu();
|
|
2294
2919
|
},
|
|
2295
2920
|
get fallback() {
|
|
2296
|
-
return
|
|
2921
|
+
return viewGrid();
|
|
2297
2922
|
},
|
|
2298
2923
|
get children() {
|
|
2299
2924
|
return _$createComponent(GestureMenu, {
|
|
@@ -2307,23 +2932,22 @@ const MonthView = props => {
|
|
|
2307
2932
|
onOpen: onMenuOpen,
|
|
2308
2933
|
"class": "k2b-calendar-month-menu",
|
|
2309
2934
|
get children() {
|
|
2310
|
-
return
|
|
2935
|
+
return viewGrid();
|
|
2311
2936
|
}
|
|
2312
2937
|
});
|
|
2313
2938
|
}
|
|
2314
2939
|
}), (() => {
|
|
2315
|
-
var _el$
|
|
2316
|
-
_el$
|
|
2940
|
+
var _el$143 = _$getNextElement(_tmpl$38);
|
|
2941
|
+
_el$143.addEventListener("toggle", event => {
|
|
2317
2942
|
// A late close of the popover that another opening already replaced keeps the new one. Focus returns to the
|
|
2318
2943
|
// grid only from inside the popover, never from what a click outside it chose.
|
|
2319
2944
|
if (event.newState !== "closed" || !popover() || event.currentTarget.matches(":popover-open")) return;
|
|
2320
|
-
|
|
2321
|
-
closePopover(inside);
|
|
2945
|
+
closePopover(focusInPopover());
|
|
2322
2946
|
});
|
|
2323
|
-
_el$
|
|
2324
|
-
var _ref$ = popoverElement;
|
|
2325
|
-
typeof _ref$ === "function" ? _$use(_ref
|
|
2326
|
-
_$insert(_el$
|
|
2947
|
+
_el$143.$$focusin = () => setCreateActive(true);
|
|
2948
|
+
var _ref$3 = popoverElement;
|
|
2949
|
+
typeof _ref$3 === "function" ? _$use(_ref$3, _el$143) : popoverElement = _el$143;
|
|
2950
|
+
_$insert(_el$143, _$createComponent(Show, {
|
|
2327
2951
|
get when() {
|
|
2328
2952
|
return popover();
|
|
2329
2953
|
},
|
|
@@ -2331,21 +2955,21 @@ const MonthView = props => {
|
|
|
2331
2955
|
children: value => value.kind === "create" ? props.owner.renderQuickCreate?.(rangeOf(value.range), {
|
|
2332
2956
|
create: value.create,
|
|
2333
2957
|
close: () => {
|
|
2334
|
-
if (popover() === value) closePopover();
|
|
2958
|
+
if (popover() === value) closePopover(focusInPopover());
|
|
2335
2959
|
}
|
|
2336
2960
|
}) : dayList(value.dayKey)
|
|
2337
2961
|
}));
|
|
2338
2962
|
_$effect(_p$ => {
|
|
2339
|
-
var _v$
|
|
2963
|
+
var _v$33 = (() => {
|
|
2340
2964
|
const current = popover();
|
|
2341
2965
|
if (current?.kind === "day") return dayLabel(parseKey(current.dayKey));
|
|
2342
2966
|
return calendarMessages().calendarQuickCreate;
|
|
2343
2967
|
})(),
|
|
2344
|
-
_v$
|
|
2345
|
-
_v$
|
|
2346
|
-
_v$
|
|
2347
|
-
_v$
|
|
2348
|
-
_v$
|
|
2968
|
+
_v$34 = popover()?.kind,
|
|
2969
|
+
_v$35 = popover()?.kind === "create" && !createActive() ? "true" : undefined;
|
|
2970
|
+
_v$33 !== _p$.e && _$setAttribute(_el$143, "aria-label", _p$.e = _v$33);
|
|
2971
|
+
_v$34 !== _p$.t && _$setAttribute(_el$143, "data-kind", _p$.t = _v$34);
|
|
2972
|
+
_v$35 !== _p$.a && _$setAttribute(_el$143, "data-quiet", _p$.a = _v$35);
|
|
2349
2973
|
return _p$;
|
|
2350
2974
|
}, {
|
|
2351
2975
|
e: undefined,
|
|
@@ -2353,7 +2977,7 @@ const MonthView = props => {
|
|
|
2353
2977
|
a: undefined
|
|
2354
2978
|
});
|
|
2355
2979
|
_$runHydrationEvents();
|
|
2356
|
-
return _el$
|
|
2980
|
+
return _el$143;
|
|
2357
2981
|
})()];
|
|
2358
2982
|
};
|
|
2359
2983
|
const TimeGridView = props => {
|
|
@@ -2372,6 +2996,8 @@ const TimeGridView = props => {
|
|
|
2372
2996
|
let scrollContainer;
|
|
2373
2997
|
let timeGrid;
|
|
2374
2998
|
let timeGutter;
|
|
2999
|
+
let daysRow;
|
|
3000
|
+
let allDayRow;
|
|
2375
3001
|
let defaultHourMarker;
|
|
2376
3002
|
let cancelInteraction;
|
|
2377
3003
|
let suppressSlotClickUntil = 0;
|
|
@@ -2402,7 +3028,10 @@ const TimeGridView = props => {
|
|
|
2402
3028
|
if (!timeGrid || !timeGutter) return null;
|
|
2403
3029
|
const gridRect = timeGrid.getBoundingClientRect();
|
|
2404
3030
|
const gutterRect = timeGutter.getBoundingClientRect();
|
|
2405
|
-
|
|
3031
|
+
// The gutter stays in view while the days scroll sideways under it, so the days start one gutter after the grid.
|
|
3032
|
+
if (clientX < gutterRect.right) return null;
|
|
3033
|
+
const daysLeft = gridRect.left + gutterRect.width;
|
|
3034
|
+
const dayIndex = calendarDayIndexAtPoint(clientX, daysLeft, gridRect.right - daysLeft, props.days.length);
|
|
2406
3035
|
if (dayIndex === null) return null;
|
|
2407
3036
|
const minute = Math.min(gridEndHour() * 60 + 45, calendarMinuteAtPoint(clientY, gridRect.top, gridRect.height, gridStartHour(), gridEndHour()));
|
|
2408
3037
|
return zonedMinuteSlot(props.days[dayIndex], minute, dateConfig());
|
|
@@ -2528,12 +3157,28 @@ const TimeGridView = props => {
|
|
|
2528
3157
|
}
|
|
2529
3158
|
return [...groups.values()];
|
|
2530
3159
|
};
|
|
2531
|
-
// 12 rem per lane. The 40 rem grid is wider
|
|
2532
|
-
// three or more make the day scroll, and one lane fits beside a tablet drawer.
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
3160
|
+
// A week shares 36 rem between its days; a single day takes 12 rem per overlapping lane. The 40 rem grid is wider
|
|
3161
|
+
// than one or two lanes, so only three or more make the day scroll, and one lane fits beside a tablet drawer.
|
|
3162
|
+
const columnTemplate = createMemo(() => {
|
|
3163
|
+
let dayMin = "var(--k2b-calendar-day-min)";
|
|
3164
|
+
if (isDayView()) {
|
|
3165
|
+
const day = props.days[0];
|
|
3166
|
+
const layouts = timedEventLayouts(eventsByDay().get(calendar.formatDateKey(day, dateConfig()))?.timed ?? []);
|
|
3167
|
+
dayMin = `${Math.max(1, ...layouts.map(layout => layout.lanes)) * 12}rem`;
|
|
3168
|
+
}
|
|
3169
|
+
return `4rem repeat(${props.days.length}, minmax(${dayMin}, 1fr))`;
|
|
3170
|
+
});
|
|
3171
|
+
// The hours scroll sideways themselves; the day and all-day rows follow, also when focus scrolls one of them.
|
|
3172
|
+
// A row's scroll event from our own write arrives a frame late; echoing it back would undo a smooth scroll or fling.
|
|
3173
|
+
const followed = new WeakMap();
|
|
3174
|
+
const followColumns = source => {
|
|
3175
|
+
if (followed.get(source) === source.scrollLeft) return;
|
|
3176
|
+
followed.delete(source);
|
|
3177
|
+
for (const row of [scrollContainer, daysRow, allDayRow]) {
|
|
3178
|
+
if (!row || row === source || row.scrollLeft === source.scrollLeft) continue;
|
|
3179
|
+
row.scrollLeft = source.scrollLeft;
|
|
3180
|
+
followed.set(row, row.scrollLeft);
|
|
3181
|
+
}
|
|
2537
3182
|
};
|
|
2538
3183
|
const laneStyle = layoutItem => {
|
|
2539
3184
|
if (isDayView()) {
|
|
@@ -2570,19 +3215,22 @@ const TimeGridView = props => {
|
|
|
2570
3215
|
});
|
|
2571
3216
|
});
|
|
2572
3217
|
return (() => {
|
|
2573
|
-
var _el$
|
|
2574
|
-
_el$
|
|
2575
|
-
_el$
|
|
2576
|
-
_el$
|
|
2577
|
-
[_el$
|
|
2578
|
-
_el$
|
|
2579
|
-
[_el$
|
|
2580
|
-
_el$
|
|
2581
|
-
_el$
|
|
2582
|
-
_el$
|
|
2583
|
-
_el$
|
|
2584
|
-
[_el$
|
|
2585
|
-
|
|
3218
|
+
var _el$144 = _$getNextElement(_tmpl$40),
|
|
3219
|
+
_el$145 = _el$144.firstChild,
|
|
3220
|
+
_el$146 = _el$145.firstChild,
|
|
3221
|
+
_el$147 = _el$146.nextSibling,
|
|
3222
|
+
[_el$148, _co$38] = _$getNextMarker(_el$147.nextSibling),
|
|
3223
|
+
_el$158 = _el$145.nextSibling,
|
|
3224
|
+
[_el$159, _co$41] = _$getNextMarker(_el$158.nextSibling),
|
|
3225
|
+
_el$153 = _el$159.nextSibling,
|
|
3226
|
+
_el$154 = _el$153.firstChild,
|
|
3227
|
+
_el$155 = _el$154.firstChild,
|
|
3228
|
+
_el$156 = _el$155.nextSibling,
|
|
3229
|
+
[_el$157, _co$40] = _$getNextMarker(_el$156.nextSibling);
|
|
3230
|
+
_el$145.addEventListener("scroll", event => followColumns(event.currentTarget));
|
|
3231
|
+
var _ref$4 = daysRow;
|
|
3232
|
+
typeof _ref$4 === "function" ? _$use(_ref$4, _el$145) : daysRow = _el$145;
|
|
3233
|
+
_$insert(_el$145, _$createComponent(For, {
|
|
2586
3234
|
get each() {
|
|
2587
3235
|
return props.days;
|
|
2588
3236
|
},
|
|
@@ -2601,47 +3249,50 @@ const TimeGridView = props => {
|
|
|
2601
3249
|
},
|
|
2602
3250
|
get children() {
|
|
2603
3251
|
return [(() => {
|
|
2604
|
-
var _el$
|
|
2605
|
-
_$insert(_el$
|
|
2606
|
-
_$effect(() => _$setAttribute(_el$
|
|
2607
|
-
return _el$
|
|
3252
|
+
var _el$160 = _$getNextElement(_tmpl$41);
|
|
3253
|
+
_$insert(_el$160, () => formatDay(day, dateConfig()));
|
|
3254
|
+
_$effect(() => _$setAttribute(_el$160, "data-today", today() ? "true" : undefined));
|
|
3255
|
+
return _el$160;
|
|
2608
3256
|
})(), _$createComponent(Show, {
|
|
2609
3257
|
when: dayBadge,
|
|
2610
3258
|
children: badge => (() => {
|
|
2611
|
-
var _el$
|
|
2612
|
-
_el$
|
|
2613
|
-
[_el$
|
|
2614
|
-
_el$
|
|
2615
|
-
[_el$
|
|
2616
|
-
_$insert(_el$
|
|
3259
|
+
var _el$161 = _$getNextElement(_tmpl$42),
|
|
3260
|
+
_el$162 = _el$161.firstChild,
|
|
3261
|
+
[_el$163, _co$42] = _$getNextMarker(_el$162.nextSibling),
|
|
3262
|
+
_el$164 = _el$163.nextSibling,
|
|
3263
|
+
[_el$165, _co$43] = _$getNextMarker(_el$164.nextSibling);
|
|
3264
|
+
_$insert(_el$161, _$createComponent(Show, {
|
|
2617
3265
|
get when() {
|
|
2618
3266
|
return badge().icon;
|
|
2619
3267
|
},
|
|
2620
3268
|
children: icon => (() => {
|
|
2621
|
-
var _el$
|
|
2622
|
-
_$effect(() => _$className(_el$
|
|
2623
|
-
return _el$
|
|
3269
|
+
var _el$166 = _$getNextElement(_tmpl$3);
|
|
3270
|
+
_$effect(() => _$className(_el$166, `k2b-calendar-time-grid__badge-icon ti ti-${icon()}`));
|
|
3271
|
+
return _el$166;
|
|
2624
3272
|
})()
|
|
2625
|
-
}), _el$
|
|
2626
|
-
_$insert(_el$
|
|
2627
|
-
return _el$
|
|
3273
|
+
}), _el$163, _co$42);
|
|
3274
|
+
_$insert(_el$161, () => badge().label, _el$165, _co$43);
|
|
3275
|
+
return _el$161;
|
|
2628
3276
|
})()
|
|
2629
3277
|
})];
|
|
2630
3278
|
}
|
|
2631
3279
|
});
|
|
2632
3280
|
}
|
|
2633
|
-
}), _el$
|
|
2634
|
-
_$insert(_el$
|
|
3281
|
+
}), _el$148, _co$38);
|
|
3282
|
+
_$insert(_el$144, _$createComponent(Show, {
|
|
2635
3283
|
get when() {
|
|
2636
3284
|
return !props.owner.hideAllDay;
|
|
2637
3285
|
},
|
|
2638
3286
|
get children() {
|
|
2639
|
-
var _el$
|
|
2640
|
-
_el$
|
|
2641
|
-
_el$
|
|
2642
|
-
[_el$
|
|
2643
|
-
|
|
2644
|
-
|
|
3287
|
+
var _el$149 = _$getNextElement(_tmpl$39),
|
|
3288
|
+
_el$150 = _el$149.firstChild,
|
|
3289
|
+
_el$151 = _el$150.nextSibling,
|
|
3290
|
+
[_el$152, _co$39] = _$getNextMarker(_el$151.nextSibling);
|
|
3291
|
+
_el$149.addEventListener("scroll", event => followColumns(event.currentTarget));
|
|
3292
|
+
var _ref$5 = allDayRow;
|
|
3293
|
+
typeof _ref$5 === "function" ? _$use(_ref$5, _el$149) : allDayRow = _el$149;
|
|
3294
|
+
_$insert(_el$150, () => props.labels.allDay);
|
|
3295
|
+
_$insert(_el$149, _$createComponent(For, {
|
|
2645
3296
|
get each() {
|
|
2646
3297
|
return props.days;
|
|
2647
3298
|
},
|
|
@@ -2650,14 +3301,14 @@ const TimeGridView = props => {
|
|
|
2650
3301
|
const allDay = () => eventsByDay().get(dayKey)?.allDay ?? [];
|
|
2651
3302
|
const previewAllDay = previewEvents().filter(event => event.dayKey === dayKey && event.allDay);
|
|
2652
3303
|
return (() => {
|
|
2653
|
-
var _el$
|
|
2654
|
-
_el$
|
|
2655
|
-
_el$
|
|
2656
|
-
[_el$
|
|
2657
|
-
_el$
|
|
2658
|
-
[_el$
|
|
2659
|
-
_$setAttribute(_el$
|
|
2660
|
-
_$spread(_el$
|
|
3304
|
+
var _el$167 = _$getNextElement(_tmpl$43),
|
|
3305
|
+
_el$168 = _el$167.firstChild,
|
|
3306
|
+
_el$169 = _el$168.firstChild,
|
|
3307
|
+
[_el$170, _co$44] = _$getNextMarker(_el$169.nextSibling),
|
|
3308
|
+
_el$171 = _el$170.nextSibling,
|
|
3309
|
+
[_el$172, _co$45] = _$getNextMarker(_el$171.nextSibling);
|
|
3310
|
+
_$setAttribute(_el$167, "data-calendar-day-key", dayKey);
|
|
3311
|
+
_$spread(_el$167, _$mergeProps({
|
|
2661
3312
|
get ["data-drop-preview"]() {
|
|
2662
3313
|
return timePreview()?.allDay && calendar.formatDateKey(timePreview().start, dateConfig()) === dayKey ? "true" : undefined;
|
|
2663
3314
|
},
|
|
@@ -2672,15 +3323,15 @@ const TimeGridView = props => {
|
|
|
2672
3323
|
allDay: true
|
|
2673
3324
|
};
|
|
2674
3325
|
}, () => performance.now() < suppressSlotClickUntil)), false, true);
|
|
2675
|
-
_$insert(_el$
|
|
3326
|
+
_$insert(_el$168, _$createComponent(For, {
|
|
2676
3327
|
each: previewAllDay,
|
|
2677
3328
|
children: event => (() => {
|
|
2678
|
-
var _el$
|
|
2679
|
-
_$insert(_el$
|
|
2680
|
-
return _el$
|
|
3329
|
+
var _el$173 = _$getNextElement(_tmpl$16);
|
|
3330
|
+
_$insert(_el$173, () => event.title);
|
|
3331
|
+
return _el$173;
|
|
2681
3332
|
})()
|
|
2682
|
-
}), _el$
|
|
2683
|
-
_$insert(_el$
|
|
3333
|
+
}), _el$170, _co$44);
|
|
3334
|
+
_$insert(_el$168, _$createComponent(For, {
|
|
2684
3335
|
get each() {
|
|
2685
3336
|
return allDay();
|
|
2686
3337
|
},
|
|
@@ -2700,49 +3351,50 @@ const TimeGridView = props => {
|
|
|
2700
3351
|
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startAllDayMove(pointerEvent, event, markDragged) : undefined;
|
|
2701
3352
|
}
|
|
2702
3353
|
})
|
|
2703
|
-
}), _el$
|
|
3354
|
+
}), _el$172, _co$45);
|
|
2704
3355
|
_$runHydrationEvents();
|
|
2705
|
-
return _el$
|
|
3356
|
+
return _el$167;
|
|
2706
3357
|
})();
|
|
2707
3358
|
}
|
|
2708
|
-
}), _el$
|
|
3359
|
+
}), _el$152, _co$39);
|
|
2709
3360
|
_$effect(_p$ => {
|
|
2710
|
-
var _v$
|
|
2711
|
-
_v$
|
|
2712
|
-
_v$
|
|
2713
|
-
_v$
|
|
3361
|
+
var _v$36 = columnTemplate(),
|
|
3362
|
+
_v$37 = `${props.owner.allDayMaxHeightRem ?? 7}rem`;
|
|
3363
|
+
_v$36 !== _p$.e && _$setStyleProperty(_el$149, "grid-template-columns", _p$.e = _v$36);
|
|
3364
|
+
_v$37 !== _p$.t && _$setStyleProperty(_el$149, "max-height", _p$.t = _v$37);
|
|
2714
3365
|
return _p$;
|
|
2715
3366
|
}, {
|
|
2716
3367
|
e: undefined,
|
|
2717
3368
|
t: undefined
|
|
2718
3369
|
});
|
|
2719
|
-
return _el$
|
|
3370
|
+
return _el$149;
|
|
2720
3371
|
}
|
|
2721
|
-
}), _el$
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
_$
|
|
3372
|
+
}), _el$159, _co$41);
|
|
3373
|
+
_el$153.addEventListener("scroll", event => followColumns(event.currentTarget));
|
|
3374
|
+
var _ref$6 = scrollContainer;
|
|
3375
|
+
typeof _ref$6 === "function" ? _$use(_ref$6, _el$153) : scrollContainer = _el$153;
|
|
3376
|
+
var _ref$7 = timeGrid;
|
|
3377
|
+
typeof _ref$7 === "function" ? _$use(_ref$7, _el$154) : timeGrid = _el$154;
|
|
3378
|
+
var _ref$8 = timeGutter;
|
|
3379
|
+
typeof _ref$8 === "function" ? _$use(_ref$8, _el$155) : timeGutter = _el$155;
|
|
3380
|
+
_$insert(_el$155, _$createComponent(For, {
|
|
2729
3381
|
get each() {
|
|
2730
3382
|
return hours();
|
|
2731
3383
|
},
|
|
2732
3384
|
children: hour => (() => {
|
|
2733
|
-
var _el$
|
|
2734
|
-
_el$
|
|
2735
|
-
[_el$
|
|
2736
|
-
_el$
|
|
3385
|
+
var _el$174 = _$getNextElement(_tmpl$44),
|
|
3386
|
+
_el$176 = _el$174.firstChild,
|
|
3387
|
+
[_el$177, _co$46] = _$getNextMarker(_el$176.nextSibling),
|
|
3388
|
+
_el$175 = _el$177.nextSibling;
|
|
2737
3389
|
_$use(element => {
|
|
2738
3390
|
if (hour === businessStartHour()) defaultHourMarker = element;
|
|
2739
|
-
}, _el$
|
|
2740
|
-
_$insert(_el$
|
|
2741
|
-
_$effect(() => _$setAttribute(_el$
|
|
2742
|
-
return _el$
|
|
3391
|
+
}, _el$174);
|
|
3392
|
+
_$insert(_el$174, () => `${hour}`.padStart(2, "0"), _el$177, _co$46);
|
|
3393
|
+
_$effect(() => _$setAttribute(_el$174, "data-outside-business", hour < businessStartHour() || hour > businessEndHour() ? "true" : undefined));
|
|
3394
|
+
return _el$174;
|
|
2743
3395
|
})()
|
|
2744
3396
|
}));
|
|
2745
|
-
_$insert(_el$
|
|
3397
|
+
_$insert(_el$154, _$createComponent(For, {
|
|
2746
3398
|
get each() {
|
|
2747
3399
|
return props.days;
|
|
2748
3400
|
},
|
|
@@ -2750,34 +3402,34 @@ const TimeGridView = props => {
|
|
|
2750
3402
|
const dayKey = calendar.formatDateKey(day, dateConfig());
|
|
2751
3403
|
const layouts = createMemo(() => timedEventLayouts(eventsByDay().get(dayKey)?.timed ?? []));
|
|
2752
3404
|
return (() => {
|
|
2753
|
-
var _el$
|
|
2754
|
-
_el$
|
|
2755
|
-
[_el$
|
|
2756
|
-
_el$
|
|
2757
|
-
[_el$
|
|
2758
|
-
_el$
|
|
2759
|
-
[_el$
|
|
2760
|
-
_el$
|
|
2761
|
-
[_el$
|
|
2762
|
-
_el$
|
|
2763
|
-
[_el$
|
|
2764
|
-
_$insert(_el$
|
|
3405
|
+
var _el$178 = _$getNextElement(_tmpl$46),
|
|
3406
|
+
_el$180 = _el$178.firstChild,
|
|
3407
|
+
[_el$181, _co$47] = _$getNextMarker(_el$180.nextSibling),
|
|
3408
|
+
_el$182 = _el$181.nextSibling,
|
|
3409
|
+
[_el$183, _co$48] = _$getNextMarker(_el$182.nextSibling),
|
|
3410
|
+
_el$184 = _el$183.nextSibling,
|
|
3411
|
+
[_el$185, _co$49] = _$getNextMarker(_el$184.nextSibling),
|
|
3412
|
+
_el$186 = _el$185.nextSibling,
|
|
3413
|
+
[_el$187, _co$50] = _$getNextMarker(_el$186.nextSibling),
|
|
3414
|
+
_el$188 = _el$187.nextSibling,
|
|
3415
|
+
[_el$189, _co$51] = _$getNextMarker(_el$188.nextSibling);
|
|
3416
|
+
_$insert(_el$178, _$createComponent(Show, {
|
|
2765
3417
|
get when() {
|
|
2766
3418
|
return currentTimeLine(day) !== null;
|
|
2767
3419
|
},
|
|
2768
3420
|
get children() {
|
|
2769
|
-
var _el$
|
|
2770
|
-
_$effect(_$p => _$setStyleProperty(_el$
|
|
2771
|
-
return _el$
|
|
3421
|
+
var _el$179 = _$getNextElement(_tmpl$45);
|
|
3422
|
+
_$effect(_$p => _$setStyleProperty(_el$179, "top", `${currentTimeLine(day) ?? 0}%`));
|
|
3423
|
+
return _el$179;
|
|
2772
3424
|
}
|
|
2773
|
-
}), _el$
|
|
2774
|
-
_$insert(_el$
|
|
3425
|
+
}), _el$181, _co$47);
|
|
3426
|
+
_$insert(_el$178, _$createComponent(For, {
|
|
2775
3427
|
get each() {
|
|
2776
3428
|
return hours();
|
|
2777
3429
|
},
|
|
2778
3430
|
children: hour => (() => {
|
|
2779
|
-
var _el$
|
|
2780
|
-
_$spread(_el$
|
|
3431
|
+
var _el$190 = _$getNextElement(_tmpl$47);
|
|
3432
|
+
_$spread(_el$190, _$mergeProps({
|
|
2781
3433
|
get ["data-outside-business"]() {
|
|
2782
3434
|
return hour < businessStartHour() || hour > businessEndHour() ? "true" : undefined;
|
|
2783
3435
|
},
|
|
@@ -2795,10 +3447,10 @@ const TimeGridView = props => {
|
|
|
2795
3447
|
"onPointerDown": startRange
|
|
2796
3448
|
}), false, false);
|
|
2797
3449
|
_$runHydrationEvents();
|
|
2798
|
-
return _el$
|
|
3450
|
+
return _el$190;
|
|
2799
3451
|
})()
|
|
2800
|
-
}), _el$
|
|
2801
|
-
_$insert(_el$
|
|
3452
|
+
}), _el$183, _co$48);
|
|
3453
|
+
_$insert(_el$178, _$createComponent(For, {
|
|
2802
3454
|
get each() {
|
|
2803
3455
|
return previewEvents().filter(event => event.dayKey === dayKey && !event.allDay);
|
|
2804
3456
|
},
|
|
@@ -2806,44 +3458,44 @@ const TimeGridView = props => {
|
|
|
2806
3458
|
const layout = eventLayout(event);
|
|
2807
3459
|
const short = event.endDate.getTime() - event.startDate.getTime() < 60 * 60_000;
|
|
2808
3460
|
return (() => {
|
|
2809
|
-
var _el$
|
|
2810
|
-
_el$
|
|
2811
|
-
_el$
|
|
2812
|
-
[_el$
|
|
2813
|
-
_el$
|
|
2814
|
-
_el$
|
|
2815
|
-
[_el$
|
|
2816
|
-
_el$
|
|
2817
|
-
_el$
|
|
2818
|
-
[_el$
|
|
2819
|
-
_$setAttribute(_el$
|
|
2820
|
-
_$insert(_el$
|
|
3461
|
+
var _el$191 = _$getNextElement(_tmpl$49),
|
|
3462
|
+
_el$192 = _el$191.firstChild,
|
|
3463
|
+
_el$200 = _el$192.firstChild,
|
|
3464
|
+
[_el$201, _co$54] = _$getNextMarker(_el$200.nextSibling),
|
|
3465
|
+
_el$194 = _el$201.nextSibling,
|
|
3466
|
+
_el$196 = _el$194.firstChild,
|
|
3467
|
+
[_el$197, _co$52] = _$getNextMarker(_el$196.nextSibling),
|
|
3468
|
+
_el$195 = _el$197.nextSibling,
|
|
3469
|
+
_el$198 = _el$195.nextSibling,
|
|
3470
|
+
[_el$199, _co$53] = _$getNextMarker(_el$198.nextSibling);
|
|
3471
|
+
_$setAttribute(_el$191, "data-short", short ? "true" : undefined);
|
|
3472
|
+
_$insert(_el$192, _$createComponent(Show, {
|
|
2821
3473
|
get when() {
|
|
2822
3474
|
return event.title;
|
|
2823
3475
|
},
|
|
2824
3476
|
get children() {
|
|
2825
|
-
var _el$
|
|
2826
|
-
_$insert(_el$
|
|
2827
|
-
return _el$
|
|
3477
|
+
var _el$193 = _$getNextElement(_tmpl$48);
|
|
3478
|
+
_$insert(_el$193, () => event.title);
|
|
3479
|
+
return _el$193;
|
|
2828
3480
|
}
|
|
2829
|
-
}), _el$
|
|
2830
|
-
_$insert(_el$
|
|
2831
|
-
_$insert(_el$
|
|
3481
|
+
}), _el$201, _co$54);
|
|
3482
|
+
_$insert(_el$194, () => formatTime(event.startDate, dateConfig()), _el$197, _co$52);
|
|
3483
|
+
_$insert(_el$194, () => formatTime(event.endDate, dateConfig()), _el$199, _co$53);
|
|
2832
3484
|
_$effect(_p$ => {
|
|
2833
|
-
var _v$
|
|
2834
|
-
_v$
|
|
2835
|
-
_v$
|
|
2836
|
-
_v$
|
|
3485
|
+
var _v$42 = `${layout.top}%`,
|
|
3486
|
+
_v$43 = `${layout.height}%`;
|
|
3487
|
+
_v$42 !== _p$.e && _$setStyleProperty(_el$191, "top", _p$.e = _v$42);
|
|
3488
|
+
_v$43 !== _p$.t && _$setStyleProperty(_el$191, "height", _p$.t = _v$43);
|
|
2837
3489
|
return _p$;
|
|
2838
3490
|
}, {
|
|
2839
3491
|
e: undefined,
|
|
2840
3492
|
t: undefined
|
|
2841
3493
|
});
|
|
2842
|
-
return _el$
|
|
3494
|
+
return _el$191;
|
|
2843
3495
|
})();
|
|
2844
3496
|
}
|
|
2845
|
-
}), _el$
|
|
2846
|
-
_$insert(_el$
|
|
3497
|
+
}), _el$185, _co$49);
|
|
3498
|
+
_$insert(_el$178, _$createComponent(For, {
|
|
2847
3499
|
get each() {
|
|
2848
3500
|
return layouts();
|
|
2849
3501
|
},
|
|
@@ -2886,13 +3538,13 @@ const TimeGridView = props => {
|
|
|
2886
3538
|
});
|
|
2887
3539
|
};
|
|
2888
3540
|
return (() => {
|
|
2889
|
-
var _el$
|
|
2890
|
-
_el$
|
|
2891
|
-
_el$
|
|
2892
|
-
[_el$
|
|
2893
|
-
_el$
|
|
2894
|
-
[_el$
|
|
2895
|
-
_$insert(_el$
|
|
3541
|
+
var _el$202 = _$getNextElement(_tmpl$51),
|
|
3542
|
+
_el$203 = _el$202.firstChild,
|
|
3543
|
+
_el$205 = _el$203.firstChild,
|
|
3544
|
+
[_el$206, _co$55] = _$getNextMarker(_el$205.nextSibling),
|
|
3545
|
+
_el$207 = _el$206.nextSibling,
|
|
3546
|
+
[_el$208, _co$56] = _$getNextMarker(_el$207.nextSibling);
|
|
3547
|
+
_$insert(_el$203, _$createComponent(EventChip, {
|
|
2896
3548
|
event: event,
|
|
2897
3549
|
get owner() {
|
|
2898
3550
|
return props.owner;
|
|
@@ -2907,32 +3559,32 @@ const TimeGridView = props => {
|
|
|
2907
3559
|
get onMovePointerDown() {
|
|
2908
3560
|
return props.owner.onEventDrop ? (pointerEvent, markDragged) => startTimedMove(pointerEvent, event, markDragged) : undefined;
|
|
2909
3561
|
}
|
|
2910
|
-
}), _el$
|
|
2911
|
-
_$insert(_el$
|
|
3562
|
+
}), _el$206, _co$55);
|
|
3563
|
+
_$insert(_el$203, _$createComponent(Show, {
|
|
2912
3564
|
get when() {
|
|
2913
3565
|
return props.owner.onEventResize;
|
|
2914
3566
|
},
|
|
2915
3567
|
get children() {
|
|
2916
|
-
var _el$
|
|
2917
|
-
_el$
|
|
2918
|
-
_el$
|
|
2919
|
-
_$setAttribute(_el$
|
|
2920
|
-
_$effect(() => _$setAttribute(_el$
|
|
3568
|
+
var _el$204 = _$getNextElement(_tmpl$50);
|
|
3569
|
+
_el$204.addEventListener("dragstart", event => event.preventDefault());
|
|
3570
|
+
_el$204.$$pointerdown = resizeStart;
|
|
3571
|
+
_$setAttribute(_el$204, "draggable", false);
|
|
3572
|
+
_$effect(() => _$setAttribute(_el$204, "aria-label", calendarMessages().resizeEvent));
|
|
2921
3573
|
_$runHydrationEvents();
|
|
2922
|
-
return _el$
|
|
3574
|
+
return _el$204;
|
|
2923
3575
|
}
|
|
2924
|
-
}), _el$
|
|
3576
|
+
}), _el$208, _co$56);
|
|
2925
3577
|
_$effect(_p$ => {
|
|
2926
|
-
var _v$
|
|
2927
|
-
_v$
|
|
2928
|
-
_v$
|
|
2929
|
-
_v$
|
|
2930
|
-
_v$
|
|
2931
|
-
_v$
|
|
2932
|
-
_v$
|
|
2933
|
-
_v$
|
|
2934
|
-
_v$
|
|
2935
|
-
_v$
|
|
3578
|
+
var _v$44 = `${layout.top}%`,
|
|
3579
|
+
_v$45 = `${layout.height}%`,
|
|
3580
|
+
_v$46 = position.left,
|
|
3581
|
+
_v$47 = position.width,
|
|
3582
|
+
_v$48 = String(20 + layoutItem.lane);
|
|
3583
|
+
_v$44 !== _p$.e && _$setStyleProperty(_el$202, "top", _p$.e = _v$44);
|
|
3584
|
+
_v$45 !== _p$.t && _$setStyleProperty(_el$202, "height", _p$.t = _v$45);
|
|
3585
|
+
_v$46 !== _p$.a && _$setStyleProperty(_el$202, "left", _p$.a = _v$46);
|
|
3586
|
+
_v$47 !== _p$.o && _$setStyleProperty(_el$202, "width", _p$.o = _v$47);
|
|
3587
|
+
_v$48 !== _p$.i && _$setStyleProperty(_el$202, "z-index", _p$.i = _v$48);
|
|
2936
3588
|
return _p$;
|
|
2937
3589
|
}, {
|
|
2938
3590
|
e: undefined,
|
|
@@ -2941,11 +3593,11 @@ const TimeGridView = props => {
|
|
|
2941
3593
|
o: undefined,
|
|
2942
3594
|
i: undefined
|
|
2943
3595
|
});
|
|
2944
|
-
return _el$
|
|
3596
|
+
return _el$202;
|
|
2945
3597
|
})();
|
|
2946
3598
|
}
|
|
2947
|
-
}), _el$
|
|
2948
|
-
_$insert(_el$
|
|
3599
|
+
}), _el$187, _co$50);
|
|
3600
|
+
_$insert(_el$178, _$createComponent(For, {
|
|
2949
3601
|
get each() {
|
|
2950
3602
|
return overflowLayouts(layouts());
|
|
2951
3603
|
},
|
|
@@ -2954,27 +3606,27 @@ const TimeGridView = props => {
|
|
|
2954
3606
|
const key = `${dayKey}-${overflow.groupId}`;
|
|
2955
3607
|
const hiddenTitle = () => overflow.hiddenEvents.map(event => `${formatTime(event.startDate, dateConfig())} ${event.title}`).join("\n");
|
|
2956
3608
|
return [(() => {
|
|
2957
|
-
var _el$
|
|
2958
|
-
_el$
|
|
2959
|
-
_el$
|
|
2960
|
-
_el$
|
|
2961
|
-
[_el$
|
|
2962
|
-
_el$
|
|
3609
|
+
var _el$209 = _$getNextElement(_tmpl$52),
|
|
3610
|
+
_el$210 = _el$209.firstChild,
|
|
3611
|
+
_el$211 = _el$210.firstChild,
|
|
3612
|
+
_el$212 = _el$211.nextSibling,
|
|
3613
|
+
[_el$213, _co$57] = _$getNextMarker(_el$212.nextSibling);
|
|
3614
|
+
_el$209.$$click = event => {
|
|
2963
3615
|
event.stopPropagation();
|
|
2964
3616
|
setExpandedOverflow(expandedOverflow() === key ? "" : key);
|
|
2965
3617
|
};
|
|
2966
|
-
_$insert(_el$
|
|
3618
|
+
_$insert(_el$210, () => overflow.hiddenEvents.length, _el$213, _co$57);
|
|
2967
3619
|
_$effect(_p$ => {
|
|
2968
|
-
var _v$
|
|
2969
|
-
_v$
|
|
2970
|
-
_v$
|
|
2971
|
-
_v$
|
|
3620
|
+
var _v$49 = `${layout.top}%`,
|
|
3621
|
+
_v$50 = `${layout.height}%`,
|
|
3622
|
+
_v$51 = hiddenTitle(),
|
|
3623
|
+
_v$52 = calendarMessages().hiddenOverlappingEvents({
|
|
2972
3624
|
count: overflow.hiddenEvents.length
|
|
2973
3625
|
});
|
|
2974
|
-
_v$
|
|
2975
|
-
_v$
|
|
2976
|
-
_v$
|
|
2977
|
-
_v$
|
|
3626
|
+
_v$49 !== _p$.e && _$setStyleProperty(_el$209, "top", _p$.e = _v$49);
|
|
3627
|
+
_v$50 !== _p$.t && _$setStyleProperty(_el$209, "height", _p$.t = _v$50);
|
|
3628
|
+
_v$51 !== _p$.a && _$setAttribute(_el$209, "title", _p$.a = _v$51);
|
|
3629
|
+
_v$52 !== _p$.o && _$setAttribute(_el$209, "aria-label", _p$.o = _v$52);
|
|
2978
3630
|
return _p$;
|
|
2979
3631
|
}, {
|
|
2980
3632
|
e: undefined,
|
|
@@ -2983,24 +3635,24 @@ const TimeGridView = props => {
|
|
|
2983
3635
|
o: undefined
|
|
2984
3636
|
});
|
|
2985
3637
|
_$runHydrationEvents();
|
|
2986
|
-
return _el$
|
|
3638
|
+
return _el$209;
|
|
2987
3639
|
})(), _$createComponent(Show, {
|
|
2988
3640
|
get when() {
|
|
2989
3641
|
return expandedOverflow() === key;
|
|
2990
3642
|
},
|
|
2991
3643
|
get children() {
|
|
2992
|
-
var _el$
|
|
2993
|
-
_el$
|
|
2994
|
-
_el$
|
|
2995
|
-
[_el$
|
|
2996
|
-
_el$
|
|
2997
|
-
_el$
|
|
2998
|
-
[_el$
|
|
2999
|
-
_el$
|
|
3000
|
-
[_el$
|
|
3001
|
-
_$insert(_el$
|
|
3002
|
-
_$insert(_el$
|
|
3003
|
-
_$insert(_el$
|
|
3644
|
+
var _el$214 = _$getNextElement(_tmpl$53),
|
|
3645
|
+
_el$215 = _el$214.firstChild,
|
|
3646
|
+
_el$217 = _el$215.firstChild,
|
|
3647
|
+
[_el$218, _co$58] = _$getNextMarker(_el$217.nextSibling),
|
|
3648
|
+
_el$216 = _el$218.nextSibling,
|
|
3649
|
+
_el$219 = _el$216.nextSibling,
|
|
3650
|
+
[_el$220, _co$59] = _$getNextMarker(_el$219.nextSibling),
|
|
3651
|
+
_el$221 = _el$215.nextSibling,
|
|
3652
|
+
[_el$222, _co$60] = _$getNextMarker(_el$221.nextSibling);
|
|
3653
|
+
_$insert(_el$215, () => formatTime(overflow.groupStartDate, dateConfig()), _el$218, _co$58);
|
|
3654
|
+
_$insert(_el$215, () => formatTime(overflow.groupEndDate, dateConfig()), _el$220, _co$59);
|
|
3655
|
+
_$insert(_el$214, _$createComponent(For, {
|
|
3004
3656
|
get each() {
|
|
3005
3657
|
return overflow.hiddenEvents;
|
|
3006
3658
|
},
|
|
@@ -3014,36 +3666,27 @@ const TimeGridView = props => {
|
|
|
3014
3666
|
},
|
|
3015
3667
|
compact: true
|
|
3016
3668
|
})
|
|
3017
|
-
}), _el$
|
|
3018
|
-
_$effect(_$p => _$setStyleProperty(_el$
|
|
3019
|
-
return _el$
|
|
3669
|
+
}), _el$222, _co$60);
|
|
3670
|
+
_$effect(_$p => _$setStyleProperty(_el$214, "top", `${layout.top}%`));
|
|
3671
|
+
return _el$214;
|
|
3020
3672
|
}
|
|
3021
3673
|
})];
|
|
3022
3674
|
}
|
|
3023
|
-
}), _el$
|
|
3024
|
-
_$effect(
|
|
3025
|
-
|
|
3026
|
-
_v$31 = `repeat(${hours().length}, minmax(4rem, 1fr))`;
|
|
3027
|
-
_v$30 !== _p$.e && _$setStyleProperty(_el$171, "min-width", _p$.e = _v$30);
|
|
3028
|
-
_v$31 !== _p$.t && _$setStyleProperty(_el$171, "grid-template-rows", _p$.t = _v$31);
|
|
3029
|
-
return _p$;
|
|
3030
|
-
}, {
|
|
3031
|
-
e: undefined,
|
|
3032
|
-
t: undefined
|
|
3033
|
-
});
|
|
3034
|
-
return _el$171;
|
|
3675
|
+
}), _el$189, _co$51);
|
|
3676
|
+
_$effect(_$p => _$setStyleProperty(_el$178, "grid-template-rows", `repeat(${hours().length}, minmax(4rem, 1fr))`));
|
|
3677
|
+
return _el$178;
|
|
3035
3678
|
})();
|
|
3036
3679
|
}
|
|
3037
|
-
}), _el$
|
|
3680
|
+
}), _el$157, _co$40);
|
|
3038
3681
|
_$effect(_p$ => {
|
|
3039
|
-
var _v$
|
|
3040
|
-
_v$
|
|
3041
|
-
_v$
|
|
3042
|
-
_v$
|
|
3043
|
-
_v$
|
|
3044
|
-
_v$
|
|
3045
|
-
_v$
|
|
3046
|
-
_v$
|
|
3682
|
+
var _v$38 = isDayView() ? "day" : "week",
|
|
3683
|
+
_v$39 = columnTemplate(),
|
|
3684
|
+
_v$40 = columnTemplate(),
|
|
3685
|
+
_v$41 = `repeat(${hours().length}, minmax(4rem, 1fr))`;
|
|
3686
|
+
_v$38 !== _p$.e && _$setAttribute(_el$144, "data-view", _p$.e = _v$38);
|
|
3687
|
+
_v$39 !== _p$.t && _$setStyleProperty(_el$145, "grid-template-columns", _p$.t = _v$39);
|
|
3688
|
+
_v$40 !== _p$.a && _$setStyleProperty(_el$154, "grid-template-columns", _p$.a = _v$40);
|
|
3689
|
+
_v$41 !== _p$.o && _$setStyleProperty(_el$155, "grid-template-rows", _p$.o = _v$41);
|
|
3047
3690
|
return _p$;
|
|
3048
3691
|
}, {
|
|
3049
3692
|
e: undefined,
|
|
@@ -3051,7 +3694,7 @@ const TimeGridView = props => {
|
|
|
3051
3694
|
a: undefined,
|
|
3052
3695
|
o: undefined
|
|
3053
3696
|
});
|
|
3054
|
-
return _el$
|
|
3697
|
+
return _el$144;
|
|
3055
3698
|
})();
|
|
3056
3699
|
};
|
|
3057
3700
|
const YearView = props => {
|
|
@@ -3092,17 +3735,17 @@ const YearView = props => {
|
|
|
3092
3735
|
});
|
|
3093
3736
|
});
|
|
3094
3737
|
return (() => {
|
|
3095
|
-
var _el$
|
|
3096
|
-
_$insert(_el$
|
|
3738
|
+
var _el$223 = _$getNextElement(_tmpl$54);
|
|
3739
|
+
_$insert(_el$223, _$createComponent(For, {
|
|
3097
3740
|
get each() {
|
|
3098
3741
|
return months();
|
|
3099
3742
|
},
|
|
3100
3743
|
children: month => (() => {
|
|
3101
|
-
var _el$
|
|
3102
|
-
_el$
|
|
3103
|
-
_el$
|
|
3104
|
-
_$insert(_el$
|
|
3105
|
-
_$insert(_el$
|
|
3744
|
+
var _el$224 = _$getNextElement(_tmpl$55),
|
|
3745
|
+
_el$225 = _el$224.firstChild,
|
|
3746
|
+
_el$226 = _el$225.nextSibling;
|
|
3747
|
+
_$insert(_el$225, () => month.label);
|
|
3748
|
+
_$insert(_el$226, _$createComponent(For, {
|
|
3106
3749
|
get each() {
|
|
3107
3750
|
return month.days;
|
|
3108
3751
|
},
|
|
@@ -3126,32 +3769,32 @@ const YearView = props => {
|
|
|
3126
3769
|
return day.events[0];
|
|
3127
3770
|
},
|
|
3128
3771
|
children: event => (() => {
|
|
3129
|
-
var _el$
|
|
3772
|
+
var _el$227 = _$getNextElement(_tmpl$56);
|
|
3130
3773
|
_$effect(_p$ => {
|
|
3131
|
-
var _v$
|
|
3132
|
-
_v$
|
|
3133
|
-
_v$
|
|
3774
|
+
var _v$53 = event().colorHex ? undefined : event().color ?? "blue",
|
|
3775
|
+
_v$54 = day.isToday ? "true" : undefined,
|
|
3776
|
+
_v$55 = event().colorHex ? {
|
|
3134
3777
|
"background-color": day.isToday ? "white" : event().colorHex
|
|
3135
3778
|
} : undefined;
|
|
3136
|
-
_v$
|
|
3137
|
-
_v$
|
|
3138
|
-
_p$.a = _$style(_el$
|
|
3779
|
+
_v$53 !== _p$.e && _$setAttribute(_el$227, "data-color", _p$.e = _v$53);
|
|
3780
|
+
_v$54 !== _p$.t && _$setAttribute(_el$227, "data-today", _p$.t = _v$54);
|
|
3781
|
+
_p$.a = _$style(_el$227, _v$55, _p$.a);
|
|
3139
3782
|
return _p$;
|
|
3140
3783
|
}, {
|
|
3141
3784
|
e: undefined,
|
|
3142
3785
|
t: undefined,
|
|
3143
3786
|
a: undefined
|
|
3144
3787
|
});
|
|
3145
|
-
return _el$
|
|
3788
|
+
return _el$227;
|
|
3146
3789
|
})()
|
|
3147
3790
|
})];
|
|
3148
3791
|
}
|
|
3149
3792
|
})
|
|
3150
3793
|
}));
|
|
3151
|
-
return _el$
|
|
3794
|
+
return _el$224;
|
|
3152
3795
|
})()
|
|
3153
3796
|
}));
|
|
3154
|
-
return _el$
|
|
3797
|
+
return _el$223;
|
|
3155
3798
|
})();
|
|
3156
3799
|
};
|
|
3157
3800
|
const MobileMonthView = props => {
|
|
@@ -3159,14 +3802,14 @@ const MobileMonthView = props => {
|
|
|
3159
3802
|
const selectedDateKey = createMemo(() => calendar.formatDateKey(props.selectedDate, dateConfig()));
|
|
3160
3803
|
const selectedEvents = createMemo(() => props.events.filter(event => event.dayKey === selectedDateKey()));
|
|
3161
3804
|
return (() => {
|
|
3162
|
-
var _el$
|
|
3163
|
-
_el$
|
|
3164
|
-
[_el$
|
|
3165
|
-
_el$
|
|
3166
|
-
_el$
|
|
3167
|
-
_el$
|
|
3168
|
-
[_el$
|
|
3169
|
-
_$insert(_el$
|
|
3805
|
+
var _el$228 = _$getNextElement(_tmpl$58),
|
|
3806
|
+
_el$234 = _el$228.firstChild,
|
|
3807
|
+
[_el$235, _co$62] = _$getNextMarker(_el$234.nextSibling),
|
|
3808
|
+
_el$229 = _el$235.nextSibling,
|
|
3809
|
+
_el$230 = _el$229.firstChild,
|
|
3810
|
+
_el$232 = _el$230.nextSibling,
|
|
3811
|
+
[_el$233, _co$61] = _$getNextMarker(_el$232.nextSibling);
|
|
3812
|
+
_$insert(_el$228, _$createComponent(MonthPickerView, {
|
|
3170
3813
|
get owner() {
|
|
3171
3814
|
return {
|
|
3172
3815
|
...props.owner,
|
|
@@ -3186,27 +3829,27 @@ const MobileMonthView = props => {
|
|
|
3186
3829
|
return props.labels;
|
|
3187
3830
|
},
|
|
3188
3831
|
compact: true
|
|
3189
|
-
}), _el$
|
|
3190
|
-
_$insert(_el$
|
|
3832
|
+
}), _el$235, _co$62);
|
|
3833
|
+
_$insert(_el$230, () => props.selectedDate.toLocaleDateString(dateConfig().locale ?? "en", {
|
|
3191
3834
|
weekday: "long",
|
|
3192
3835
|
month: "long",
|
|
3193
3836
|
day: "numeric",
|
|
3194
3837
|
timeZone: dateConfig().timeZone
|
|
3195
3838
|
}));
|
|
3196
|
-
_$insert(_el$
|
|
3839
|
+
_$insert(_el$229, _$createComponent(Show, {
|
|
3197
3840
|
get when() {
|
|
3198
3841
|
return selectedEvents().length > 0;
|
|
3199
3842
|
},
|
|
3200
3843
|
get fallback() {
|
|
3201
3844
|
return (() => {
|
|
3202
|
-
var _el$
|
|
3203
|
-
_$insert(_el$
|
|
3204
|
-
return _el$
|
|
3845
|
+
var _el$236 = _$getNextElement(_tmpl$59);
|
|
3846
|
+
_$insert(_el$236, () => props.labels.noEvents);
|
|
3847
|
+
return _el$236;
|
|
3205
3848
|
})();
|
|
3206
3849
|
},
|
|
3207
3850
|
get children() {
|
|
3208
|
-
var _el$
|
|
3209
|
-
_$insert(_el$
|
|
3851
|
+
var _el$231 = _$getNextElement(_tmpl$57);
|
|
3852
|
+
_$insert(_el$231, _$createComponent(For, {
|
|
3210
3853
|
get each() {
|
|
3211
3854
|
return selectedEvents();
|
|
3212
3855
|
},
|
|
@@ -3220,16 +3863,16 @@ const MobileMonthView = props => {
|
|
|
3220
3863
|
}
|
|
3221
3864
|
})
|
|
3222
3865
|
}));
|
|
3223
|
-
return _el$
|
|
3866
|
+
return _el$231;
|
|
3224
3867
|
}
|
|
3225
|
-
}), _el$
|
|
3226
|
-
return _el$
|
|
3868
|
+
}), _el$233, _co$61);
|
|
3869
|
+
return _el$228;
|
|
3227
3870
|
})();
|
|
3228
3871
|
};
|
|
3229
3872
|
const CalendarBody = props => (() => {
|
|
3230
|
-
var _el$
|
|
3231
|
-
_$insert(_el$
|
|
3232
|
-
return _el$
|
|
3873
|
+
var _el$237 = _$getNextElement(_tmpl$60);
|
|
3874
|
+
_$insert(_el$237, () => props.children);
|
|
3875
|
+
return _el$237;
|
|
3233
3876
|
})();
|
|
3234
3877
|
const CalendarRoot = props => {
|
|
3235
3878
|
const messages = useUiMessages();
|
|
@@ -3284,24 +3927,26 @@ const CalendarRoot = props => {
|
|
|
3284
3927
|
// The day and week views with `dayHours` scroll through their days; the header and the commands ask them first.
|
|
3285
3928
|
const [timeView, setTimeView] = createSignal(null);
|
|
3286
3929
|
const [monthCreate, setMonthCreate] = createSignal(null);
|
|
3930
|
+
const monthView = () => monthCreate()?.continuous() ? monthCreate() : null;
|
|
3931
|
+
const scrollingView = () => timeView() ?? monthView();
|
|
3287
3932
|
const timeMode = () => Boolean(props.dayHours) && (view() === "day" || view() === "week");
|
|
3288
3933
|
const parseKey = key => calendar.parseCalendarDate(key, dateConfig());
|
|
3289
3934
|
/** The first shown day of a day or week view, or the selected day of the month view, for the other views. */
|
|
3290
3935
|
const shownDay = () => {
|
|
3291
3936
|
const first = timeView()?.visibleKeys().first;
|
|
3292
3937
|
if (first) return parseKey(first);
|
|
3293
|
-
return view() === "month" ? focusDay() : null;
|
|
3938
|
+
return view() === "month" ? focusDay() ?? monthView()?.focusDay() ?? null : null;
|
|
3294
3939
|
};
|
|
3295
3940
|
const go = (target, nextView) => {
|
|
3296
3941
|
const href = props.getDateHref?.(target, nextView);
|
|
3297
3942
|
if (href) followCalendarHref(owner, href);else openViewAt(props, target, nextView);
|
|
3298
3943
|
};
|
|
3299
3944
|
const step = direction => {
|
|
3300
|
-
if (
|
|
3301
|
-
go(adjacentCalendarDate(shownDay() ?? date(), view(), direction, dateConfig()), view());
|
|
3945
|
+
if (scrollingView()?.step(direction)) return;
|
|
3946
|
+
go(adjacentCalendarDate(monthView()?.stepFrom() ?? shownDay() ?? date(), view(), direction, dateConfig()), view());
|
|
3302
3947
|
};
|
|
3303
3948
|
const goToday = () => {
|
|
3304
|
-
if (
|
|
3949
|
+
if (scrollingView()?.today()) return;
|
|
3305
3950
|
go(calendar.today(dateConfig()), view());
|
|
3306
3951
|
};
|
|
3307
3952
|
const goView = nextView => {
|
|
@@ -3314,7 +3959,7 @@ const CalendarRoot = props => {
|
|
|
3314
3959
|
if (href) followCalendarHref(owner, href);else props.onViewChange?.(nextView);
|
|
3315
3960
|
};
|
|
3316
3961
|
const goToKey = key => {
|
|
3317
|
-
if (
|
|
3962
|
+
if (scrollingView()?.goTo(key)) return;
|
|
3318
3963
|
go(parseKey(key), view());
|
|
3319
3964
|
};
|
|
3320
3965
|
const openGoTo = () => void openCalendarGoTo({
|
|
@@ -3409,6 +4054,7 @@ const CalendarRoot = props => {
|
|
|
3409
4054
|
});
|
|
3410
4055
|
const headerNav = {
|
|
3411
4056
|
timeView,
|
|
4057
|
+
monthView,
|
|
3412
4058
|
commands: () => props.onCommandsChange ? allCommands() : [],
|
|
3413
4059
|
// The arrow keys page like J and K, so the list names them beside those keys.
|
|
3414
4060
|
openShortcuts: () => void openCalendarShortcuts(allCommands(), calendarMessages(), custom() ? {} : {
|
|
@@ -3455,14 +4101,14 @@ const CalendarRoot = props => {
|
|
|
3455
4101
|
register: setTimeView
|
|
3456
4102
|
});
|
|
3457
4103
|
return (() => {
|
|
3458
|
-
var _el$
|
|
3459
|
-
_el$
|
|
3460
|
-
[_el$
|
|
3461
|
-
_el$
|
|
3462
|
-
[_el$
|
|
3463
|
-
var _ref$
|
|
3464
|
-
typeof _ref$
|
|
3465
|
-
_$insert(_el$
|
|
4104
|
+
var _el$238 = _$getNextElement(_tmpl$61),
|
|
4105
|
+
_el$239 = _el$238.firstChild,
|
|
4106
|
+
[_el$240, _co$63] = _$getNextMarker(_el$239.nextSibling),
|
|
4107
|
+
_el$241 = _el$240.nextSibling,
|
|
4108
|
+
[_el$242, _co$64] = _$getNextMarker(_el$241.nextSibling);
|
|
4109
|
+
var _ref$9 = root;
|
|
4110
|
+
typeof _ref$9 === "function" ? _$use(_ref$9, _el$238) : root = _el$238;
|
|
4111
|
+
_$insert(_el$238, _$createComponent(CalendarHeader, {
|
|
3466
4112
|
get date() {
|
|
3467
4113
|
return date();
|
|
3468
4114
|
},
|
|
@@ -3474,11 +4120,11 @@ const CalendarRoot = props => {
|
|
|
3474
4120
|
},
|
|
3475
4121
|
owner: owner,
|
|
3476
4122
|
get focusDay() {
|
|
3477
|
-
return _$memo(() => view() === "month"
|
|
4123
|
+
return _$memo(() => !!(view() === "month" || timeView()))() ? shownDay() : null;
|
|
3478
4124
|
},
|
|
3479
4125
|
nav: headerNav
|
|
3480
|
-
}), _el$
|
|
3481
|
-
_$insert(_el$
|
|
4126
|
+
}), _el$240, _co$63);
|
|
4127
|
+
_$insert(_el$238, _$createComponent(Show, {
|
|
3482
4128
|
get when() {
|
|
3483
4129
|
return !custom();
|
|
3484
4130
|
},
|
|
@@ -3512,6 +4158,7 @@ const CalendarRoot = props => {
|
|
|
3512
4158
|
return mergedLabels();
|
|
3513
4159
|
},
|
|
3514
4160
|
onFocusDay: setFocusDay,
|
|
4161
|
+
goToDate: date => go(date, view()),
|
|
3515
4162
|
register: setMonthCreate
|
|
3516
4163
|
});
|
|
3517
4164
|
}
|
|
@@ -3615,18 +4262,18 @@ const CalendarRoot = props => {
|
|
|
3615
4262
|
}
|
|
3616
4263
|
});
|
|
3617
4264
|
}
|
|
3618
|
-
}), _el$
|
|
4265
|
+
}), _el$242, _co$64);
|
|
3619
4266
|
_$effect(_p$ => {
|
|
3620
|
-
var _v$
|
|
3621
|
-
_v$
|
|
3622
|
-
_v$
|
|
3623
|
-
_v$
|
|
4267
|
+
var _v$56 = `k2b-content-calendar ${props.class ?? ""}`,
|
|
4268
|
+
_v$57 = props.navigationPending ? "true" : undefined;
|
|
4269
|
+
_v$56 !== _p$.e && _$className(_el$238, _p$.e = _v$56);
|
|
4270
|
+
_v$57 !== _p$.t && _$setAttribute(_el$238, "aria-busy", _p$.t = _v$57);
|
|
3624
4271
|
return _p$;
|
|
3625
4272
|
}, {
|
|
3626
4273
|
e: undefined,
|
|
3627
4274
|
t: undefined
|
|
3628
4275
|
});
|
|
3629
|
-
return _el$
|
|
4276
|
+
return _el$238;
|
|
3630
4277
|
})();
|
|
3631
4278
|
};
|
|
3632
4279
|
|