@nanahoshi/mona-ui 0.27.2 → 0.29.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/docs/api/chart.md +2 -2
- package/docs/api/locales.md +8 -0
- package/docs/api/popup.md +1 -1
- package/docs/api/theme.md +2 -2
- package/docs/chart.md +14 -0
- package/docs/editor.md +2 -0
- package/docs/installation.md +147 -15
- package/docs/introduction.md +37 -15
- package/docs/theming-built-in-themes.md +67 -0
- package/docs/theming-custom-colors.md +274 -0
- package/docs/theming-custom-themes.md +168 -0
- package/docs/theming.md +164 -248
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
- package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
- package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
- package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
- package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
- package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
- package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
- package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
- package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
- package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
- package/llms.txt +7 -3
- package/locales/pl-pl/package.json +4 -0
- package/locales/pl-pl/pl-pl.messages.json +536 -0
- package/package.json +66 -23
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
- package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
- package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
- package/types/nanahoshi-mona-ui-button.d.ts +227 -166
- package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
- package/types/nanahoshi-mona-ui-card.d.ts +125 -111
- package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
- package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
- package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
- package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
- package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
- package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
- package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
- package/types/nanahoshi-mona-ui-command.d.ts +279 -191
- package/types/nanahoshi-mona-ui-common.d.ts +354 -385
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
- package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
- package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
- package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
- package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
- package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
- package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
- package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
- package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
- package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
- package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
- package/types/nanahoshi-mona-ui-label.d.ts +108 -78
- package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
- package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
- package/types/nanahoshi-mona-ui-list.d.ts +2 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
- package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
- package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
- package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
- package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
- package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
- package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
- package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
- package/types/nanahoshi-mona-ui-query.d.ts +82 -88
- package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
- package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
- package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
- package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
- package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
- package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
- package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
- package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
- package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
- package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
- package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
- package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
- package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
- package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
- package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
- package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
- package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
- package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
- package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
- package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
- package/types/nanahoshi-mona-ui-window.d.ts +494 -399
- package/types/nanahoshi-mona-ui.d.ts +1 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
|
@@ -1,87 +1,143 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { LucideChevronLeft, LucideChevronRight } from
|
|
6
|
-
import { Dictionary, lastOrDefault, range,
|
|
7
|
-
import { ButtonDirective } from
|
|
8
|
-
import { PreventableEvent, TakeFirstPipe } from
|
|
9
|
-
import { CalendarService } from
|
|
10
|
-
import {
|
|
11
|
-
import { DateTime } from
|
|
12
|
-
import {
|
|
13
|
-
import { twMerge } from
|
|
14
|
-
import {
|
|
15
|
-
import { cva } from
|
|
16
|
-
|
|
17
|
-
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
18
|
-
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, inject, input, linkedSignal, model, output, signal, untracked } from "@angular/core";
|
|
4
|
+
import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
|
|
5
|
+
import { LucideChevronLeft, LucideChevronRight } from "@lucide/angular";
|
|
6
|
+
import { Dictionary, index, lastOrDefault, range, select } from "@mirei/ts-collections";
|
|
7
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
8
|
+
import { PreventableEvent, TakeFirstPipe } from "@nanahoshi/mona-ui/common";
|
|
9
|
+
import { CalendarService } from "@nanahoshi/mona-ui/date-input";
|
|
10
|
+
import { createElementControlId, injectEffectiveDisabled, rxTimeout, themeRaisedBackdropClasses } from "@nanahoshi/mona-ui/internal";
|
|
11
|
+
import { DateTime } from "luxon";
|
|
12
|
+
import { fromEvent, skip } from "rxjs";
|
|
13
|
+
import { twMerge } from "tailwind-merge";
|
|
14
|
+
import { MonaI18nService, formatGregorianDateToLocaleString, formatNumber, getLocaleFirstDayOfWeek, gregorianDateTime, gregorianDateTimeFromObject, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
|
|
15
|
+
import { cva } from "class-variance-authority";
|
|
19
16
|
function localizeNumber(value, options) {
|
|
20
|
-
|
|
17
|
+
return formatNumber(value, "en-US", options);
|
|
21
18
|
}
|
|
22
19
|
const CALENDAR_DEFAULT_MESSAGES = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
calendarLabel: (formattedMonthAndYear) => `Calendar, ${formattedMonthAndYear}`,
|
|
21
|
+
decadeRange: (start, end) => `${localizeNumber(start, { useGrouping: false })} to ${localizeNumber(end, { useGrouping: false })}`,
|
|
22
|
+
decadeViewLabel: (start, end) => `Decade view, ${localizeNumber(start, { useGrouping: false })} - ${localizeNumber(end, { useGrouping: false })}`,
|
|
23
|
+
goToToday: (formattedDate) => `Go to today, ${formattedDate}`,
|
|
24
|
+
nextDecade: "Next decade",
|
|
25
|
+
nextMonth: "Next month",
|
|
26
|
+
nextYear: "Next year",
|
|
27
|
+
previousDecade: "Previous decade",
|
|
28
|
+
previousMonth: "Previous month",
|
|
29
|
+
previousYear: "Previous year",
|
|
30
|
+
switchToDecadeView: (currentYear) => `Switch to decade view, currently ${currentYear}`,
|
|
31
|
+
switchToYearView: (currentMonthAndYear) => `Switch to year view, currently ${currentMonthAndYear}`,
|
|
32
|
+
today: "Today",
|
|
33
|
+
yearCellLabel: (year) => `Year ${localizeNumber(year, { useGrouping: false })}`,
|
|
34
|
+
yearViewLabel: (year) => `Year view, ${year}`
|
|
38
35
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
36
|
+
var CalendarDecadeCellTemplateDirective = class CalendarDecadeCellTemplateDirective {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.templateRef = inject(TemplateRef);
|
|
39
|
+
}
|
|
40
|
+
static {
|
|
41
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
42
|
+
minVersion: "12.0.0",
|
|
43
|
+
version: "22.2.6",
|
|
44
|
+
ngImport: i0,
|
|
45
|
+
type: CalendarDecadeCellTemplateDirective,
|
|
46
|
+
deps: [],
|
|
47
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static {
|
|
51
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
52
|
+
minVersion: "14.0.0",
|
|
53
|
+
version: "22.2.6",
|
|
54
|
+
type: CalendarDecadeCellTemplateDirective,
|
|
55
|
+
isStandalone: true,
|
|
56
|
+
selector: "ng-template[monaCalendarDecadeCellTemplate]",
|
|
57
|
+
ngImport: i0
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
62
|
+
minVersion: "12.0.0",
|
|
63
|
+
version: "22.2.6",
|
|
64
|
+
ngImport: i0,
|
|
65
|
+
type: CalendarDecadeCellTemplateDirective,
|
|
66
|
+
decorators: [{
|
|
67
|
+
type: Directive,
|
|
68
|
+
args: [{ selector: "ng-template[monaCalendarDecadeCellTemplate]" }]
|
|
69
|
+
}]
|
|
70
|
+
});
|
|
71
|
+
var CalendarMonthCellTemplateDirective = class CalendarMonthCellTemplateDirective {
|
|
72
|
+
constructor() {
|
|
73
|
+
this.templateRef = inject(TemplateRef);
|
|
74
|
+
}
|
|
75
|
+
static {
|
|
76
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
77
|
+
minVersion: "12.0.0",
|
|
78
|
+
version: "22.2.6",
|
|
79
|
+
ngImport: i0,
|
|
80
|
+
type: CalendarMonthCellTemplateDirective,
|
|
81
|
+
deps: [],
|
|
82
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
static {
|
|
86
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
87
|
+
minVersion: "14.0.0",
|
|
88
|
+
version: "22.2.6",
|
|
89
|
+
type: CalendarMonthCellTemplateDirective,
|
|
90
|
+
isStandalone: true,
|
|
91
|
+
selector: "ng-template[monaCalendarMonthCellTemplate]",
|
|
92
|
+
ngImport: i0
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
97
|
+
minVersion: "12.0.0",
|
|
98
|
+
version: "22.2.6",
|
|
99
|
+
ngImport: i0,
|
|
100
|
+
type: CalendarMonthCellTemplateDirective,
|
|
101
|
+
decorators: [{
|
|
102
|
+
type: Directive,
|
|
103
|
+
args: [{ selector: "ng-template[monaCalendarMonthCellTemplate]" }]
|
|
104
|
+
}]
|
|
105
|
+
});
|
|
106
|
+
var CalendarYearCellTemplateDirective = class CalendarYearCellTemplateDirective {
|
|
107
|
+
constructor() {
|
|
108
|
+
this.templateRef = inject(TemplateRef);
|
|
109
|
+
}
|
|
110
|
+
static {
|
|
111
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
112
|
+
minVersion: "12.0.0",
|
|
113
|
+
version: "22.2.6",
|
|
114
|
+
ngImport: i0,
|
|
115
|
+
type: CalendarYearCellTemplateDirective,
|
|
116
|
+
deps: [],
|
|
117
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
static {
|
|
121
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
122
|
+
minVersion: "14.0.0",
|
|
123
|
+
version: "22.2.6",
|
|
124
|
+
type: CalendarYearCellTemplateDirective,
|
|
125
|
+
isStandalone: true,
|
|
126
|
+
selector: "ng-template[monaCalendarYearCellTemplate]",
|
|
127
|
+
ngImport: i0
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
132
|
+
minVersion: "12.0.0",
|
|
133
|
+
version: "22.2.6",
|
|
134
|
+
ngImport: i0,
|
|
135
|
+
type: CalendarYearCellTemplateDirective,
|
|
136
|
+
decorators: [{
|
|
137
|
+
type: Directive,
|
|
138
|
+
args: [{ selector: "ng-template[monaCalendarYearCellTemplate]" }]
|
|
139
|
+
}]
|
|
140
|
+
});
|
|
85
141
|
const calendarBaseThemeVariants = cva(`
|
|
86
142
|
flex min-w-64 flex-col gap-2 p-2
|
|
87
143
|
select-none
|
|
@@ -89,23 +145,17 @@ const calendarBaseThemeVariants = cva(`
|
|
|
89
145
|
border border-border shadow-(--mona-calendar-shadow)
|
|
90
146
|
data-[invalid='true']:border-error
|
|
91
147
|
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
92
|
-
`, {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
medium: "rounded-md",
|
|
104
|
-
large: "rounded-lg",
|
|
105
|
-
full: "rounded-full"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
148
|
+
`, { variants: {
|
|
149
|
+
disabled: { true: "pointer-events-none cursor-not-allowed opacity-50" },
|
|
150
|
+
readonly: { true: "pointer-events-none" },
|
|
151
|
+
rounded: {
|
|
152
|
+
none: "rounded-none",
|
|
153
|
+
small: "rounded-sm",
|
|
154
|
+
medium: "rounded-md",
|
|
155
|
+
large: "rounded-lg",
|
|
156
|
+
full: "rounded-full"
|
|
157
|
+
}
|
|
158
|
+
} });
|
|
109
159
|
const calendarHeaderThemeVariants = cva(`
|
|
110
160
|
flex items-center justify-center
|
|
111
161
|
[&>button+button]:not-focus:border-s-0
|
|
@@ -119,43 +169,27 @@ const calendarMonthViewDayThemeVariants = cva(`
|
|
|
119
169
|
cursor-pointer
|
|
120
170
|
hover:bg-hover active:bg-active
|
|
121
171
|
`, {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
true: "bg-primary text-primary-foreground hover:bg-primary-hover forced-color-adjust-none forced-colors:bg-[Highlight]! forced-colors:text-[HighlightText]"
|
|
144
|
-
},
|
|
145
|
-
today: {
|
|
146
|
-
true: "font-bold text-foreground"
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
compoundVariants: [
|
|
150
|
-
{
|
|
151
|
-
selected: true,
|
|
152
|
-
today: true,
|
|
153
|
-
class: "text-primary-foreground"
|
|
154
|
-
}
|
|
155
|
-
],
|
|
156
|
-
defaultVariants: {
|
|
157
|
-
rounded: "medium"
|
|
158
|
-
}
|
|
172
|
+
variants: {
|
|
173
|
+
disabled: { true: "pointer-events-none cursor-not-allowed text-disabled-foreground" },
|
|
174
|
+
focused: { true: "bg-hover outline-none focus-visible:outline-hidden ring-2 ring-inset ring-focus-indicator/35" },
|
|
175
|
+
outside: { true: "text-muted-foreground" },
|
|
176
|
+
rangePreview: { true: "bg-active hover:bg-active" },
|
|
177
|
+
rounded: {
|
|
178
|
+
none: "rounded-none",
|
|
179
|
+
small: "rounded-sm",
|
|
180
|
+
medium: "rounded-md",
|
|
181
|
+
large: "rounded-lg",
|
|
182
|
+
full: "rounded-full"
|
|
183
|
+
},
|
|
184
|
+
selected: { true: "bg-primary text-primary-foreground hover:bg-primary-hover forced-color-adjust-none forced-colors:bg-[Highlight]! forced-colors:text-[HighlightText]" },
|
|
185
|
+
today: { true: "font-bold text-foreground" }
|
|
186
|
+
},
|
|
187
|
+
compoundVariants: [{
|
|
188
|
+
selected: true,
|
|
189
|
+
today: true,
|
|
190
|
+
class: "text-primary-foreground"
|
|
191
|
+
}],
|
|
192
|
+
defaultVariants: { rounded: "medium" }
|
|
159
193
|
});
|
|
160
194
|
const calendarMonthViewGridThemeVariants = cva(`
|
|
161
195
|
grid justify-center gap-0.5
|
|
@@ -178,20 +212,16 @@ const calendarYearViewGridThemeVariants = cva(`
|
|
|
178
212
|
const calendarYearViewCellThemeVariants = cva(`
|
|
179
213
|
cursor-pointer py-2
|
|
180
214
|
hover:bg-hover active:bg-active
|
|
181
|
-
`, {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
full: "rounded-full"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
});
|
|
215
|
+
`, { variants: {
|
|
216
|
+
focused: { true: "bg-hover outline-none focus-visible:outline-hidden ring-2 ring-inset ring-focus-indicator/35" },
|
|
217
|
+
rounded: {
|
|
218
|
+
none: "rounded-none",
|
|
219
|
+
small: "rounded-sm",
|
|
220
|
+
medium: "rounded-md",
|
|
221
|
+
large: "rounded-lg",
|
|
222
|
+
full: "rounded-full"
|
|
223
|
+
}
|
|
224
|
+
} });
|
|
195
225
|
const calendarDecadeViewGridThemeVariants = cva(`
|
|
196
226
|
grid grid-cols-4 justify-center gap-0.5
|
|
197
227
|
[&>div]:flex [&>div]:h-12
|
|
@@ -200,1439 +230,1907 @@ const calendarDecadeViewGridThemeVariants = cva(`
|
|
|
200
230
|
const calendarDecadeViewCellThemeVariants = cva(`
|
|
201
231
|
cursor-pointer py-2
|
|
202
232
|
hover:bg-hover active:bg-active
|
|
203
|
-
`, {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
233
|
+
`, { variants: {
|
|
234
|
+
focused: { true: "bg-hover outline-none focus-visible:outline-hidden ring-2 ring-inset ring-focus-indicator/35" },
|
|
235
|
+
rounded: {
|
|
236
|
+
none: "rounded-none",
|
|
237
|
+
small: "rounded-sm",
|
|
238
|
+
medium: "rounded-md",
|
|
239
|
+
large: "rounded-lg",
|
|
240
|
+
full: "rounded-full"
|
|
241
|
+
}
|
|
242
|
+
} });
|
|
243
|
+
var DecadeYearDirective = class DecadeYearDirective {
|
|
244
|
+
constructor() {
|
|
245
|
+
this.#i18n = inject(MonaI18nService);
|
|
246
|
+
this.ariaLabel = computed(() => this.messages().yearCellLabel(this.year()), ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
247
|
+
this.baseClass = computed(() => {
|
|
248
|
+
const focused = this.focused();
|
|
249
|
+
const rounded = this.rounded();
|
|
250
|
+
return calendarDecadeViewCellThemeVariants({
|
|
251
|
+
focused,
|
|
252
|
+
rounded
|
|
253
|
+
});
|
|
254
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
255
|
+
this.focused = computed(() => {
|
|
256
|
+
const navigatedYear = DateTime.fromJSDate(this.navigatedDate()).year;
|
|
257
|
+
return this.year() === navigatedYear;
|
|
258
|
+
}, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
|
|
259
|
+
this.isCurrent = computed(() => {
|
|
260
|
+
return this.year() === DateTime.now().year;
|
|
261
|
+
}, ...ngDevMode ? [{ debugName: "isCurrent" }] : /* istanbul ignore next */ []);
|
|
262
|
+
this.messages = this.#i18n.componentMessages("calendar", CALENDAR_DEFAULT_MESSAGES);
|
|
263
|
+
this.selected = computed(() => {
|
|
264
|
+
const selectedDate = this.selectedDate();
|
|
265
|
+
if (!selectedDate) return false;
|
|
266
|
+
return this.year() === DateTime.fromJSDate(selectedDate).year;
|
|
267
|
+
}, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
268
|
+
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
269
|
+
this.navigatedDate = input.required(...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
|
|
270
|
+
this.rounded = input.required(...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
271
|
+
this.selectedDate = input(null, ...ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []);
|
|
272
|
+
this.year = input.required(...ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []);
|
|
273
|
+
}
|
|
274
|
+
#i18n;
|
|
275
|
+
static {
|
|
276
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
277
|
+
minVersion: "12.0.0",
|
|
278
|
+
version: "22.2.6",
|
|
279
|
+
ngImport: i0,
|
|
280
|
+
type: DecadeYearDirective,
|
|
281
|
+
deps: [],
|
|
282
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
static {
|
|
286
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
287
|
+
minVersion: "17.1.0",
|
|
288
|
+
version: "22.2.6",
|
|
289
|
+
type: DecadeYearDirective,
|
|
290
|
+
isStandalone: true,
|
|
291
|
+
selector: "[monaDecadeYear]",
|
|
292
|
+
inputs: {
|
|
293
|
+
disabled: {
|
|
294
|
+
classPropertyName: "disabled",
|
|
295
|
+
publicName: "disabled",
|
|
296
|
+
isSignal: true,
|
|
297
|
+
isRequired: false,
|
|
298
|
+
transformFunction: null
|
|
299
|
+
},
|
|
300
|
+
navigatedDate: {
|
|
301
|
+
classPropertyName: "navigatedDate",
|
|
302
|
+
publicName: "navigatedDate",
|
|
303
|
+
isSignal: true,
|
|
304
|
+
isRequired: true,
|
|
305
|
+
transformFunction: null
|
|
306
|
+
},
|
|
307
|
+
rounded: {
|
|
308
|
+
classPropertyName: "rounded",
|
|
309
|
+
publicName: "rounded",
|
|
310
|
+
isSignal: true,
|
|
311
|
+
isRequired: true,
|
|
312
|
+
transformFunction: null
|
|
313
|
+
},
|
|
314
|
+
selectedDate: {
|
|
315
|
+
classPropertyName: "selectedDate",
|
|
316
|
+
publicName: "selectedDate",
|
|
317
|
+
isSignal: true,
|
|
318
|
+
isRequired: false,
|
|
319
|
+
transformFunction: null
|
|
320
|
+
},
|
|
321
|
+
year: {
|
|
322
|
+
classPropertyName: "year",
|
|
323
|
+
publicName: "year",
|
|
324
|
+
isSignal: true,
|
|
325
|
+
isRequired: true,
|
|
326
|
+
transformFunction: null
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
host: {
|
|
330
|
+
attributes: { "role": "gridcell" },
|
|
331
|
+
properties: {
|
|
332
|
+
"attr.tabindex": "focused() && !disabled() ? 0 : -1",
|
|
333
|
+
"attr.aria-current": "isCurrent() ? 'true' : null",
|
|
334
|
+
"attr.aria-disabled": "disabled() ? 'true' : null",
|
|
335
|
+
"attr.aria-label": "ariaLabel()",
|
|
336
|
+
"attr.aria-selected": "selected() ? 'true' : null",
|
|
337
|
+
"class": "baseClass()"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
ngImport: i0
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
345
|
+
minVersion: "12.0.0",
|
|
346
|
+
version: "22.2.6",
|
|
347
|
+
ngImport: i0,
|
|
348
|
+
type: DecadeYearDirective,
|
|
349
|
+
decorators: [{
|
|
350
|
+
type: Directive,
|
|
351
|
+
args: [{
|
|
352
|
+
selector: "[monaDecadeYear]",
|
|
353
|
+
host: {
|
|
354
|
+
"[attr.tabindex]": "focused() && !disabled() ? 0 : -1",
|
|
355
|
+
"[attr.aria-current]": "isCurrent() ? 'true' : null",
|
|
356
|
+
"[attr.aria-disabled]": "disabled() ? 'true' : null",
|
|
357
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
358
|
+
"[attr.aria-selected]": "selected() ? 'true' : null",
|
|
359
|
+
"[class]": "baseClass()",
|
|
360
|
+
role: "gridcell"
|
|
361
|
+
}
|
|
362
|
+
}]
|
|
363
|
+
}],
|
|
364
|
+
propDecorators: {
|
|
365
|
+
disabled: [{
|
|
366
|
+
type: i0.Input,
|
|
367
|
+
args: [{
|
|
368
|
+
isSignal: true,
|
|
369
|
+
alias: "disabled",
|
|
370
|
+
required: false
|
|
371
|
+
}]
|
|
372
|
+
}],
|
|
373
|
+
navigatedDate: [{
|
|
374
|
+
type: i0.Input,
|
|
375
|
+
args: [{
|
|
376
|
+
isSignal: true,
|
|
377
|
+
alias: "navigatedDate",
|
|
378
|
+
required: true
|
|
379
|
+
}]
|
|
380
|
+
}],
|
|
381
|
+
rounded: [{
|
|
382
|
+
type: i0.Input,
|
|
383
|
+
args: [{
|
|
384
|
+
isSignal: true,
|
|
385
|
+
alias: "rounded",
|
|
386
|
+
required: true
|
|
387
|
+
}]
|
|
388
|
+
}],
|
|
389
|
+
selectedDate: [{
|
|
390
|
+
type: i0.Input,
|
|
391
|
+
args: [{
|
|
392
|
+
isSignal: true,
|
|
393
|
+
alias: "selectedDate",
|
|
394
|
+
required: false
|
|
395
|
+
}]
|
|
396
|
+
}],
|
|
397
|
+
year: [{
|
|
398
|
+
type: i0.Input,
|
|
399
|
+
args: [{
|
|
400
|
+
isSignal: true,
|
|
401
|
+
alias: "year",
|
|
402
|
+
required: true
|
|
403
|
+
}]
|
|
404
|
+
}]
|
|
405
|
+
}
|
|
216
406
|
});
|
|
217
|
-
|
|
218
|
-
/** One year of the decade view: a grid cell. */
|
|
219
|
-
class DecadeYearDirective {
|
|
220
|
-
constructor() {
|
|
221
|
-
this.#i18n = inject(MonaI18nService);
|
|
222
|
-
this.ariaLabel = computed(() => this.messages().yearCellLabel(this.year()), /* @ts-ignore */
|
|
223
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
224
|
-
this.baseClass = computed(() => {
|
|
225
|
-
const focused = this.focused();
|
|
226
|
-
const rounded = this.rounded();
|
|
227
|
-
return calendarDecadeViewCellThemeVariants({ focused, rounded });
|
|
228
|
-
}, /* @ts-ignore */
|
|
229
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
230
|
-
this.focused = computed(() => {
|
|
231
|
-
const navigatedYear = DateTime.fromJSDate(this.navigatedDate()).year;
|
|
232
|
-
return this.year() === navigatedYear;
|
|
233
|
-
}, /* @ts-ignore */
|
|
234
|
-
...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
|
|
235
|
-
this.isCurrent = computed(() => {
|
|
236
|
-
return this.year() === DateTime.now().year;
|
|
237
|
-
}, /* @ts-ignore */
|
|
238
|
-
...(ngDevMode ? [{ debugName: "isCurrent" }] : /* istanbul ignore next */ []));
|
|
239
|
-
this.messages = this.#i18n.componentMessages("calendar", CALENDAR_DEFAULT_MESSAGES);
|
|
240
|
-
this.selected = computed(() => {
|
|
241
|
-
const selectedDate = this.selectedDate();
|
|
242
|
-
if (!selectedDate) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
return this.year() === DateTime.fromJSDate(selectedDate).year;
|
|
246
|
-
}, /* @ts-ignore */
|
|
247
|
-
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
248
|
-
/** Whether the whole calendar is disabled. */
|
|
249
|
-
this.disabled = input(false, /* @ts-ignore */
|
|
250
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
251
|
-
this.navigatedDate = input.required(/* @ts-ignore */
|
|
252
|
-
...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
|
|
253
|
-
this.rounded = input.required(/* @ts-ignore */
|
|
254
|
-
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
255
|
-
this.selectedDate = input(null, /* @ts-ignore */
|
|
256
|
-
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
257
|
-
this.year = input.required(/* @ts-ignore */
|
|
258
|
-
...(ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []));
|
|
259
|
-
}
|
|
260
|
-
#i18n;
|
|
261
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DecadeYearDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
262
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DecadeYearDirective, isStandalone: true, selector: "[monaDecadeYear]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, navigatedDate: { classPropertyName: "navigatedDate", publicName: "navigatedDate", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, year: { classPropertyName: "year", publicName: "year", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "attr.tabindex": "focused() && !disabled() ? 0 : -1", "attr.aria-current": "isCurrent() ? 'true' : null", "attr.aria-disabled": "disabled() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-selected": "selected() ? 'true' : null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
263
|
-
}
|
|
264
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DecadeYearDirective, decorators: [{
|
|
265
|
-
type: Directive,
|
|
266
|
-
args: [{
|
|
267
|
-
selector: "[monaDecadeYear]",
|
|
268
|
-
host: {
|
|
269
|
-
"[attr.tabindex]": "focused() && !disabled() ? 0 : -1",
|
|
270
|
-
"[attr.aria-current]": "isCurrent() ? 'true' : null",
|
|
271
|
-
"[attr.aria-disabled]": "disabled() ? 'true' : null",
|
|
272
|
-
"[attr.aria-label]": "ariaLabel()",
|
|
273
|
-
"[attr.aria-selected]": "selected() ? 'true' : null",
|
|
274
|
-
"[class]": "baseClass()",
|
|
275
|
-
role: "gridcell"
|
|
276
|
-
}
|
|
277
|
-
}]
|
|
278
|
-
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], navigatedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigatedDate", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }], year: [{ type: i0.Input, args: [{ isSignal: true, alias: "year", required: true }] }] } });
|
|
279
|
-
|
|
280
407
|
const compareDates = (date1, date2, operator) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
default:
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return operator === "==";
|
|
408
|
+
if (!date1 || !date2) return false;
|
|
409
|
+
const valueDateParts = [
|
|
410
|
+
date1.getFullYear(),
|
|
411
|
+
date1.getMonth(),
|
|
412
|
+
date1.getDate()
|
|
413
|
+
];
|
|
414
|
+
const otherDateParts = [
|
|
415
|
+
date2.getFullYear(),
|
|
416
|
+
date2.getMonth(),
|
|
417
|
+
date2.getDate()
|
|
418
|
+
];
|
|
419
|
+
for (let i = 0; i < 3; i++) switch (operator) {
|
|
420
|
+
case "==":
|
|
421
|
+
if (valueDateParts[i] !== otherDateParts[i]) return false;
|
|
422
|
+
break;
|
|
423
|
+
case "!=":
|
|
424
|
+
if (valueDateParts[i] !== otherDateParts[i]) return true;
|
|
425
|
+
break;
|
|
426
|
+
case "<":
|
|
427
|
+
case "<=":
|
|
428
|
+
if (valueDateParts[i] < otherDateParts[i]) return true;
|
|
429
|
+
if (valueDateParts[i] > otherDateParts[i]) return false;
|
|
430
|
+
if (operator === "<=" && i === 2 && valueDateParts[i] === otherDateParts[i]) return true;
|
|
431
|
+
break;
|
|
432
|
+
case ">":
|
|
433
|
+
case ">=":
|
|
434
|
+
if (valueDateParts[i] > otherDateParts[i]) return true;
|
|
435
|
+
if (valueDateParts[i] < otherDateParts[i]) return false;
|
|
436
|
+
if (operator === ">=" && i === 2 && valueDateParts[i] === otherDateParts[i]) return true;
|
|
437
|
+
break;
|
|
438
|
+
default: return false;
|
|
439
|
+
}
|
|
440
|
+
return operator === "==";
|
|
319
441
|
};
|
|
320
|
-
/** A key that is equal for two dates on the same local calendar day, whatever their time. */
|
|
321
442
|
const toDayKey = (date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
443
|
+
var MonthDayDirective = class MonthDayDirective {
|
|
444
|
+
constructor() {
|
|
445
|
+
this.#i18n = inject(MonaI18nService);
|
|
446
|
+
this.#key = computed(() => toDayKey(this.entry().key), ...ngDevMode ? [{ debugName: "#key" }] : /* istanbul ignore next */ []);
|
|
447
|
+
this.ariaLabel = computed(() => formatGregorianDateToLocaleString(this.entry().key, this.#i18n.localeId(), {
|
|
448
|
+
weekday: "long",
|
|
449
|
+
year: "numeric",
|
|
450
|
+
month: "long",
|
|
451
|
+
day: "numeric"
|
|
452
|
+
}), ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
453
|
+
this.baseClass = computed(() => {
|
|
454
|
+
const disabled = this.dayDisabled();
|
|
455
|
+
const focused = this.focused();
|
|
456
|
+
const outside = this.outside();
|
|
457
|
+
const rangePreview = this.rangePreviewed();
|
|
458
|
+
const rounded = this.rounded();
|
|
459
|
+
const selected = this.selected();
|
|
460
|
+
const today = this.isToday();
|
|
461
|
+
return calendarMonthViewDayThemeVariants({
|
|
462
|
+
disabled,
|
|
463
|
+
focused,
|
|
464
|
+
outside,
|
|
465
|
+
rangePreview,
|
|
466
|
+
rounded,
|
|
467
|
+
selected,
|
|
468
|
+
today
|
|
469
|
+
});
|
|
470
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
471
|
+
this.dayDisabled = computed(() => this.disabled() || this.isDayUnavailable()(this.entry().key), ...ngDevMode ? [{ debugName: "dayDisabled" }] : /* istanbul ignore next */ []);
|
|
472
|
+
this.focused = computed(() => compareDates(this.entry().key, this.navigatedDate(), "=="), ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
|
|
473
|
+
this.isToday = computed(() => compareDates(this.entry().key, this.today(), "=="), ...ngDevMode ? [{ debugName: "isToday" }] : /* istanbul ignore next */ []);
|
|
474
|
+
this.outside = computed(() => {
|
|
475
|
+
const entry = this.entry();
|
|
476
|
+
const monthStart = this.monthBounds()[0];
|
|
477
|
+
const monthEnd = this.monthBounds()[1];
|
|
478
|
+
return compareDates(entry.key, monthStart, "<") || compareDates(entry.key, monthEnd, ">");
|
|
479
|
+
}, ...ngDevMode ? [{ debugName: "outside" }] : /* istanbul ignore next */ []);
|
|
480
|
+
this.rangePreviewed = computed(() => !this.selected() && this.rangePreviewKeys().has(this.#key()), ...ngDevMode ? [{ debugName: "rangePreviewed" }] : /* istanbul ignore next */ []);
|
|
481
|
+
this.selected = computed(() => this.selectedKeys().has(this.#key()), ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
482
|
+
this.dayPointerEnter = output();
|
|
483
|
+
this.daySelect = output();
|
|
484
|
+
this.disabled = input.required(...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
485
|
+
this.entry = input.required(...ngDevMode ? [{ debugName: "entry" }] : /* istanbul ignore next */ []);
|
|
486
|
+
this.isDayUnavailable = input.required(...ngDevMode ? [{ debugName: "isDayUnavailable" }] : /* istanbul ignore next */ []);
|
|
487
|
+
this.monthBounds = input.required(...ngDevMode ? [{ debugName: "monthBounds" }] : /* istanbul ignore next */ []);
|
|
488
|
+
this.navigatedDate = input.required(...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
|
|
489
|
+
this.rangePreviewKeys = input.required(...ngDevMode ? [{ debugName: "rangePreviewKeys" }] : /* istanbul ignore next */ []);
|
|
490
|
+
this.rounded = input.required(...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
491
|
+
this.selectedKeys = input.required(...ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []);
|
|
492
|
+
this.today = input.required(...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
493
|
+
}
|
|
494
|
+
#i18n;
|
|
495
|
+
#key;
|
|
496
|
+
onClick(event) {
|
|
497
|
+
if (this.dayDisabled()) return;
|
|
498
|
+
event.preventDefault();
|
|
499
|
+
this.daySelect.emit({
|
|
500
|
+
date: this.entry().key,
|
|
501
|
+
event
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
onPointerEnter() {
|
|
505
|
+
if (this.dayDisabled()) return;
|
|
506
|
+
this.dayPointerEnter.emit(this.entry().key);
|
|
507
|
+
}
|
|
508
|
+
static {
|
|
509
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
510
|
+
minVersion: "12.0.0",
|
|
511
|
+
version: "22.2.6",
|
|
512
|
+
ngImport: i0,
|
|
513
|
+
type: MonthDayDirective,
|
|
514
|
+
deps: [],
|
|
515
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
static {
|
|
519
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
520
|
+
minVersion: "17.1.0",
|
|
521
|
+
version: "22.2.6",
|
|
522
|
+
type: MonthDayDirective,
|
|
523
|
+
isStandalone: true,
|
|
524
|
+
selector: "[monaMonthDay]",
|
|
525
|
+
inputs: {
|
|
526
|
+
disabled: {
|
|
527
|
+
classPropertyName: "disabled",
|
|
528
|
+
publicName: "disabled",
|
|
529
|
+
isSignal: true,
|
|
530
|
+
isRequired: true,
|
|
531
|
+
transformFunction: null
|
|
532
|
+
},
|
|
533
|
+
entry: {
|
|
534
|
+
classPropertyName: "entry",
|
|
535
|
+
publicName: "entry",
|
|
536
|
+
isSignal: true,
|
|
537
|
+
isRequired: true,
|
|
538
|
+
transformFunction: null
|
|
539
|
+
},
|
|
540
|
+
isDayUnavailable: {
|
|
541
|
+
classPropertyName: "isDayUnavailable",
|
|
542
|
+
publicName: "isDayUnavailable",
|
|
543
|
+
isSignal: true,
|
|
544
|
+
isRequired: true,
|
|
545
|
+
transformFunction: null
|
|
546
|
+
},
|
|
547
|
+
monthBounds: {
|
|
548
|
+
classPropertyName: "monthBounds",
|
|
549
|
+
publicName: "monthBounds",
|
|
550
|
+
isSignal: true,
|
|
551
|
+
isRequired: true,
|
|
552
|
+
transformFunction: null
|
|
553
|
+
},
|
|
554
|
+
navigatedDate: {
|
|
555
|
+
classPropertyName: "navigatedDate",
|
|
556
|
+
publicName: "navigatedDate",
|
|
557
|
+
isSignal: true,
|
|
558
|
+
isRequired: true,
|
|
559
|
+
transformFunction: null
|
|
560
|
+
},
|
|
561
|
+
rangePreviewKeys: {
|
|
562
|
+
classPropertyName: "rangePreviewKeys",
|
|
563
|
+
publicName: "rangePreviewKeys",
|
|
564
|
+
isSignal: true,
|
|
565
|
+
isRequired: true,
|
|
566
|
+
transformFunction: null
|
|
567
|
+
},
|
|
568
|
+
rounded: {
|
|
569
|
+
classPropertyName: "rounded",
|
|
570
|
+
publicName: "rounded",
|
|
571
|
+
isSignal: true,
|
|
572
|
+
isRequired: true,
|
|
573
|
+
transformFunction: null
|
|
574
|
+
},
|
|
575
|
+
selectedKeys: {
|
|
576
|
+
classPropertyName: "selectedKeys",
|
|
577
|
+
publicName: "selectedKeys",
|
|
578
|
+
isSignal: true,
|
|
579
|
+
isRequired: true,
|
|
580
|
+
transformFunction: null
|
|
581
|
+
},
|
|
582
|
+
today: {
|
|
583
|
+
classPropertyName: "today",
|
|
584
|
+
publicName: "today",
|
|
585
|
+
isSignal: true,
|
|
586
|
+
isRequired: true,
|
|
587
|
+
transformFunction: null
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
outputs: {
|
|
591
|
+
dayPointerEnter: "dayPointerEnter",
|
|
592
|
+
daySelect: "daySelect"
|
|
593
|
+
},
|
|
594
|
+
host: {
|
|
595
|
+
attributes: { "role": "gridcell" },
|
|
596
|
+
listeners: {
|
|
597
|
+
"click": "onClick($event)",
|
|
598
|
+
"pointerenter": "onPointerEnter()"
|
|
599
|
+
},
|
|
600
|
+
properties: {
|
|
601
|
+
"attr.tabindex": "focused() && !disabled() ? 0 : -1",
|
|
602
|
+
"attr.aria-current": "isToday() ? 'date' : null",
|
|
603
|
+
"attr.aria-disabled": "dayDisabled() ? 'true' : null",
|
|
604
|
+
"attr.aria-label": "ariaLabel()",
|
|
605
|
+
"attr.aria-selected": "selected() ? 'true' : null",
|
|
606
|
+
"attr.data-range-preview": "rangePreviewed() ? 'true' : null",
|
|
607
|
+
"class": "baseClass()"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
ngImport: i0
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
615
|
+
minVersion: "12.0.0",
|
|
616
|
+
version: "22.2.6",
|
|
617
|
+
ngImport: i0,
|
|
618
|
+
type: MonthDayDirective,
|
|
619
|
+
decorators: [{
|
|
620
|
+
type: Directive,
|
|
621
|
+
args: [{
|
|
622
|
+
selector: "[monaMonthDay]",
|
|
623
|
+
host: {
|
|
624
|
+
"[attr.tabindex]": "focused() && !disabled() ? 0 : -1",
|
|
625
|
+
"[attr.aria-current]": "isToday() ? 'date' : null",
|
|
626
|
+
"[attr.aria-disabled]": "dayDisabled() ? 'true' : null",
|
|
627
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
628
|
+
"[attr.aria-selected]": "selected() ? 'true' : null",
|
|
629
|
+
"[attr.data-range-preview]": "rangePreviewed() ? 'true' : null",
|
|
630
|
+
"[class]": "baseClass()",
|
|
631
|
+
"(click)": "onClick($event)",
|
|
632
|
+
"(pointerenter)": "onPointerEnter()",
|
|
633
|
+
role: "gridcell"
|
|
634
|
+
}
|
|
635
|
+
}]
|
|
636
|
+
}],
|
|
637
|
+
propDecorators: {
|
|
638
|
+
dayPointerEnter: [{
|
|
639
|
+
type: i0.Output,
|
|
640
|
+
args: ["dayPointerEnter"]
|
|
641
|
+
}],
|
|
642
|
+
daySelect: [{
|
|
643
|
+
type: i0.Output,
|
|
644
|
+
args: ["daySelect"]
|
|
645
|
+
}],
|
|
646
|
+
disabled: [{
|
|
647
|
+
type: i0.Input,
|
|
648
|
+
args: [{
|
|
649
|
+
isSignal: true,
|
|
650
|
+
alias: "disabled",
|
|
651
|
+
required: true
|
|
652
|
+
}]
|
|
653
|
+
}],
|
|
654
|
+
entry: [{
|
|
655
|
+
type: i0.Input,
|
|
656
|
+
args: [{
|
|
657
|
+
isSignal: true,
|
|
658
|
+
alias: "entry",
|
|
659
|
+
required: true
|
|
660
|
+
}]
|
|
661
|
+
}],
|
|
662
|
+
isDayUnavailable: [{
|
|
663
|
+
type: i0.Input,
|
|
664
|
+
args: [{
|
|
665
|
+
isSignal: true,
|
|
666
|
+
alias: "isDayUnavailable",
|
|
667
|
+
required: true
|
|
668
|
+
}]
|
|
669
|
+
}],
|
|
670
|
+
monthBounds: [{
|
|
671
|
+
type: i0.Input,
|
|
672
|
+
args: [{
|
|
673
|
+
isSignal: true,
|
|
674
|
+
alias: "monthBounds",
|
|
675
|
+
required: true
|
|
676
|
+
}]
|
|
677
|
+
}],
|
|
678
|
+
navigatedDate: [{
|
|
679
|
+
type: i0.Input,
|
|
680
|
+
args: [{
|
|
681
|
+
isSignal: true,
|
|
682
|
+
alias: "navigatedDate",
|
|
683
|
+
required: true
|
|
684
|
+
}]
|
|
685
|
+
}],
|
|
686
|
+
rangePreviewKeys: [{
|
|
687
|
+
type: i0.Input,
|
|
688
|
+
args: [{
|
|
689
|
+
isSignal: true,
|
|
690
|
+
alias: "rangePreviewKeys",
|
|
691
|
+
required: true
|
|
692
|
+
}]
|
|
693
|
+
}],
|
|
694
|
+
rounded: [{
|
|
695
|
+
type: i0.Input,
|
|
696
|
+
args: [{
|
|
697
|
+
isSignal: true,
|
|
698
|
+
alias: "rounded",
|
|
699
|
+
required: true
|
|
700
|
+
}]
|
|
701
|
+
}],
|
|
702
|
+
selectedKeys: [{
|
|
703
|
+
type: i0.Input,
|
|
704
|
+
args: [{
|
|
705
|
+
isSignal: true,
|
|
706
|
+
alias: "selectedKeys",
|
|
707
|
+
required: true
|
|
708
|
+
}]
|
|
709
|
+
}],
|
|
710
|
+
today: [{
|
|
711
|
+
type: i0.Input,
|
|
712
|
+
args: [{
|
|
713
|
+
isSignal: true,
|
|
714
|
+
alias: "today",
|
|
715
|
+
required: true
|
|
716
|
+
}]
|
|
717
|
+
}]
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
var YearMonthDirective = class YearMonthDirective {
|
|
721
|
+
constructor() {
|
|
722
|
+
this.#i18n = inject(MonaI18nService);
|
|
723
|
+
this.ariaLabel = computed(() => {
|
|
724
|
+
const date = new Date(this.navigatedDate().getFullYear(), this.month() - 1, 1);
|
|
725
|
+
return formatGregorianDateToLocaleString(date, this.#i18n.localeId(), {
|
|
726
|
+
year: "numeric",
|
|
727
|
+
month: "long"
|
|
728
|
+
});
|
|
729
|
+
}, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
730
|
+
this.baseClass = computed(() => {
|
|
731
|
+
const focused = this.focused();
|
|
732
|
+
const rounded = this.rounded();
|
|
733
|
+
return calendarYearViewCellThemeVariants({
|
|
734
|
+
focused,
|
|
735
|
+
rounded
|
|
736
|
+
});
|
|
737
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
738
|
+
this.focused = computed(() => {
|
|
739
|
+
const navigatedMonth = DateTime.fromJSDate(this.navigatedDate()).month;
|
|
740
|
+
return this.month() === navigatedMonth;
|
|
741
|
+
}, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
|
|
742
|
+
this.isCurrent = computed(() => {
|
|
743
|
+
const now = DateTime.now();
|
|
744
|
+
const navDate = DateTime.fromJSDate(this.navigatedDate());
|
|
745
|
+
return this.month() === now.month && navDate.year === now.year;
|
|
746
|
+
}, ...ngDevMode ? [{ debugName: "isCurrent" }] : /* istanbul ignore next */ []);
|
|
747
|
+
this.selected = computed(() => {
|
|
748
|
+
const selectedDate = this.selectedDate();
|
|
749
|
+
if (!selectedDate) return false;
|
|
750
|
+
const navDate = DateTime.fromJSDate(this.navigatedDate());
|
|
751
|
+
const selDate = DateTime.fromJSDate(selectedDate);
|
|
752
|
+
return this.month() === selDate.month && navDate.year === selDate.year;
|
|
753
|
+
}, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
754
|
+
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
755
|
+
this.month = input.required(...ngDevMode ? [{ debugName: "month" }] : /* istanbul ignore next */ []);
|
|
756
|
+
this.navigatedDate = input.required(...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
|
|
757
|
+
this.rounded = input.required(...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
758
|
+
this.selectedDate = input(...ngDevMode ? [void 0, { debugName: "selectedDate" }] : /* istanbul ignore next */ []);
|
|
759
|
+
}
|
|
760
|
+
#i18n;
|
|
761
|
+
static {
|
|
762
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
763
|
+
minVersion: "12.0.0",
|
|
764
|
+
version: "22.2.6",
|
|
765
|
+
ngImport: i0,
|
|
766
|
+
type: YearMonthDirective,
|
|
767
|
+
deps: [],
|
|
768
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
static {
|
|
772
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
773
|
+
minVersion: "17.1.0",
|
|
774
|
+
version: "22.2.6",
|
|
775
|
+
type: YearMonthDirective,
|
|
776
|
+
isStandalone: true,
|
|
777
|
+
selector: "[monaYearMonth]",
|
|
778
|
+
inputs: {
|
|
779
|
+
disabled: {
|
|
780
|
+
classPropertyName: "disabled",
|
|
781
|
+
publicName: "disabled",
|
|
782
|
+
isSignal: true,
|
|
783
|
+
isRequired: false,
|
|
784
|
+
transformFunction: null
|
|
785
|
+
},
|
|
786
|
+
month: {
|
|
787
|
+
classPropertyName: "month",
|
|
788
|
+
publicName: "month",
|
|
789
|
+
isSignal: true,
|
|
790
|
+
isRequired: true,
|
|
791
|
+
transformFunction: null
|
|
792
|
+
},
|
|
793
|
+
navigatedDate: {
|
|
794
|
+
classPropertyName: "navigatedDate",
|
|
795
|
+
publicName: "navigatedDate",
|
|
796
|
+
isSignal: true,
|
|
797
|
+
isRequired: true,
|
|
798
|
+
transformFunction: null
|
|
799
|
+
},
|
|
800
|
+
rounded: {
|
|
801
|
+
classPropertyName: "rounded",
|
|
802
|
+
publicName: "rounded",
|
|
803
|
+
isSignal: true,
|
|
804
|
+
isRequired: true,
|
|
805
|
+
transformFunction: null
|
|
806
|
+
},
|
|
807
|
+
selectedDate: {
|
|
808
|
+
classPropertyName: "selectedDate",
|
|
809
|
+
publicName: "selectedDate",
|
|
810
|
+
isSignal: true,
|
|
811
|
+
isRequired: false,
|
|
812
|
+
transformFunction: null
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
host: {
|
|
816
|
+
attributes: { "role": "gridcell" },
|
|
817
|
+
properties: {
|
|
818
|
+
"attr.tabindex": "focused() && !disabled() ? 0 : -1",
|
|
819
|
+
"attr.aria-current": "isCurrent() ? 'date' : null",
|
|
820
|
+
"attr.aria-disabled": "disabled() ? 'true' : null",
|
|
821
|
+
"attr.aria-label": "ariaLabel()",
|
|
822
|
+
"attr.aria-selected": "selected() ? 'true' : null",
|
|
823
|
+
"class": "baseClass()"
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
ngImport: i0
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
831
|
+
minVersion: "12.0.0",
|
|
832
|
+
version: "22.2.6",
|
|
833
|
+
ngImport: i0,
|
|
834
|
+
type: YearMonthDirective,
|
|
835
|
+
decorators: [{
|
|
836
|
+
type: Directive,
|
|
837
|
+
args: [{
|
|
838
|
+
selector: "[monaYearMonth]",
|
|
839
|
+
host: {
|
|
840
|
+
"[attr.tabindex]": "focused() && !disabled() ? 0 : -1",
|
|
841
|
+
"[attr.aria-current]": "isCurrent() ? 'date' : null",
|
|
842
|
+
"[attr.aria-disabled]": "disabled() ? 'true' : null",
|
|
843
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
844
|
+
"[attr.aria-selected]": "selected() ? 'true' : null",
|
|
845
|
+
"[class]": "baseClass()",
|
|
846
|
+
role: "gridcell"
|
|
847
|
+
}
|
|
848
|
+
}]
|
|
849
|
+
}],
|
|
850
|
+
propDecorators: {
|
|
851
|
+
disabled: [{
|
|
852
|
+
type: i0.Input,
|
|
853
|
+
args: [{
|
|
854
|
+
isSignal: true,
|
|
855
|
+
alias: "disabled",
|
|
856
|
+
required: false
|
|
857
|
+
}]
|
|
858
|
+
}],
|
|
859
|
+
month: [{
|
|
860
|
+
type: i0.Input,
|
|
861
|
+
args: [{
|
|
862
|
+
isSignal: true,
|
|
863
|
+
alias: "month",
|
|
864
|
+
required: true
|
|
865
|
+
}]
|
|
866
|
+
}],
|
|
867
|
+
navigatedDate: [{
|
|
868
|
+
type: i0.Input,
|
|
869
|
+
args: [{
|
|
870
|
+
isSignal: true,
|
|
871
|
+
alias: "navigatedDate",
|
|
872
|
+
required: true
|
|
873
|
+
}]
|
|
874
|
+
}],
|
|
875
|
+
rounded: [{
|
|
876
|
+
type: i0.Input,
|
|
877
|
+
args: [{
|
|
878
|
+
isSignal: true,
|
|
879
|
+
alias: "rounded",
|
|
880
|
+
required: true
|
|
881
|
+
}]
|
|
882
|
+
}],
|
|
883
|
+
selectedDate: [{
|
|
884
|
+
type: i0.Input,
|
|
885
|
+
args: [{
|
|
886
|
+
isSignal: true,
|
|
887
|
+
alias: "selectedDate",
|
|
888
|
+
required: false
|
|
889
|
+
}]
|
|
890
|
+
}]
|
|
891
|
+
}
|
|
892
|
+
});
|
|
504
893
|
function startOfDay(date) {
|
|
505
|
-
|
|
894
|
+
return DateTime.fromJSDate(date).startOf("day").toJSDate();
|
|
506
895
|
}
|
|
507
|
-
/** Whole calendar days from `start` to `end`, whatever their times and across DST changes. */
|
|
508
896
|
function calendarDaysBetween(start, end) {
|
|
509
|
-
|
|
897
|
+
return Math.round(end.startOf("day").diff(start.startOf("day"), "days").days);
|
|
510
898
|
}
|
|
511
899
|
const FIRST_DAY_OF_WEEK_TO_ISO = {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
900
|
+
monday: 1,
|
|
901
|
+
tuesday: 2,
|
|
902
|
+
wednesday: 3,
|
|
903
|
+
thursday: 4,
|
|
904
|
+
friday: 5,
|
|
905
|
+
saturday: 6,
|
|
906
|
+
sunday: 7
|
|
519
907
|
};
|
|
520
|
-
class CalendarComponent {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CalendarComponent, isStandalone: true, selector: "mona-calendar", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDay: { classPropertyName: "firstDay", publicName: "firstDay", isSignal: true, isRequired: false, transformFunction: null }, focusOnMount: { classPropertyName: "focusOnMount", publicName: "focusOnMount", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, weekNumber: { classPropertyName: "weekNumber", publicName: "weekNumber", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { listeners: { "focusin": "refreshToday()", "focusout": "onFocusOut($event)" }, properties: { "attr.aria-label": "null", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-invalid": "invalidState() || null", "attr.data-required": "required() || null", "class": "baseClass()" } }, queries: [{ propertyName: "decadeCellTemplate", first: true, predicate: CalendarDecadeCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "monthCellTemplate", first: true, predicate: CalendarMonthCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "yearCellTemplate", first: true, predicate: CalendarYearCellTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerMonthYear()\n }}</span>\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerYear()\n }}</span>\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"text-primary inline-flex h-9 items-center px-4 text-sm font-semibold\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div role=\"row\" [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (row of monthDictChunked(); track $index) {\n <div role=\"row\" [class]=\"monthGridClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = getWeekNumber(firstEntry.key);\n <div aria-hidden=\"true\">{{ formatInteger(week) }}</div>\n }\n }\n <!-- Track by time: the month is rebuilt with new Date objects on every navigation. -->\n @for (entry of row; track entry.key.getTime()) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.value, date: entry.key }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: MonthDayDirective, selector: "[monaMonthDay]", inputs: ["disabled", "entry", "isDayUnavailable", "monthBounds", "navigatedDate", "rangePreviewKeys", "rounded", "selectedKeys", "today"], outputs: ["dayPointerEnter", "daySelect"] }, { kind: "directive", type: DecadeYearDirective, selector: "[monaDecadeYear]", inputs: ["disabled", "navigatedDate", "rounded", "selectedDate", "year"] }, { kind: "directive", type: YearMonthDirective, selector: "[monaYearMonth]", inputs: ["disabled", "month", "navigatedDate", "rounded", "selectedDate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "pipe", type: TakeFirstPipe, name: "monaTakeFirst" }] }); }
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
908
|
+
var CalendarComponent = class CalendarComponent {
|
|
909
|
+
#calendarService;
|
|
910
|
+
#destroyRef;
|
|
911
|
+
#direction;
|
|
912
|
+
#hostElementRef;
|
|
913
|
+
#i18n;
|
|
914
|
+
#monthDict;
|
|
915
|
+
#outputValue;
|
|
916
|
+
constructor() {
|
|
917
|
+
this.#calendarService = inject(CalendarService, { optional: true });
|
|
918
|
+
this.#destroyRef = inject(DestroyRef);
|
|
919
|
+
this.#direction = injectComponentDirection();
|
|
920
|
+
this.#hostElementRef = inject(ElementRef);
|
|
921
|
+
this.#i18n = inject(MonaI18nService);
|
|
922
|
+
this.#monthDict = computed(() => {
|
|
923
|
+
const day = this.navigatedDate();
|
|
924
|
+
const firstDayOfMonth = gregorianDateTime(day, this.#i18n.localeId()).startOf("month");
|
|
925
|
+
const lastDayOfMonth = gregorianDateTime(day, this.#i18n.localeId()).endOf("month");
|
|
926
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
927
|
+
const daysToSubtract = (firstDayOfMonth.weekday - firstDayIso + 7) % 7;
|
|
928
|
+
const firstDayOfCalendar = firstDayOfMonth.minus({ days: daysToSubtract });
|
|
929
|
+
const daysToAdd = ((firstDayIso + 5) % 7 + 1 - lastDayOfMonth.weekday + 7) % 7;
|
|
930
|
+
const lastDayOfCalendar = lastDayOfMonth.plus({ days: daysToAdd });
|
|
931
|
+
const dictionary = new Dictionary();
|
|
932
|
+
for (let i = firstDayOfCalendar; i <= lastDayOfCalendar; i = i.plus({ days: 1 })) dictionary.add(i.toJSDate(), i.day);
|
|
933
|
+
return dictionary.toImmutableDictionary((e) => e.key, (e) => e.value);
|
|
934
|
+
}, ...ngDevMode ? [{ debugName: "#monthDict" }] : /* istanbul ignore next */ []);
|
|
935
|
+
this.#outputValue = computed(() => {
|
|
936
|
+
const selection = this.selection();
|
|
937
|
+
const selectedDates = this.selectedDates();
|
|
938
|
+
if (selection === "single") return lastOrDefault(selectedDates);
|
|
939
|
+
else if (selection === "multiple") return selectedDates;
|
|
940
|
+
else if (selection === "range") {
|
|
941
|
+
if (selectedDates.length === 1) return [selectedDates[0], selectedDates[0]];
|
|
942
|
+
if (selectedDates.length > 1) return [selectedDates[0], selectedDates[selectedDates.length - 1]];
|
|
943
|
+
return [];
|
|
944
|
+
}
|
|
945
|
+
return [];
|
|
946
|
+
}, ...ngDevMode ? [{ debugName: "#outputValue" }] : /* istanbul ignore next */ []);
|
|
947
|
+
this.ariaLabel = computed(() => {
|
|
948
|
+
const view = this.calendarView();
|
|
949
|
+
const navigatedDate = this.navigatedDate();
|
|
950
|
+
const locale = this.#i18n.localeId();
|
|
951
|
+
const messages = this.messages();
|
|
952
|
+
switch (view) {
|
|
953
|
+
case "month": return messages.calendarLabel(formatGregorianDateToLocaleString(navigatedDate, locale, {
|
|
954
|
+
year: "numeric",
|
|
955
|
+
month: "long"
|
|
956
|
+
}));
|
|
957
|
+
case "year": return messages.yearViewLabel(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric" }));
|
|
958
|
+
case "decade": return messages.decadeViewLabel(this.decadeStart(), this.decadeEnd());
|
|
959
|
+
}
|
|
960
|
+
}, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
961
|
+
this.baseClass = computed(() => {
|
|
962
|
+
const disabled = this.effectiveDisabled();
|
|
963
|
+
const readonly = this.readonly();
|
|
964
|
+
const rounded = this.rounded() === "full" ? "large" : this.rounded();
|
|
965
|
+
const variantClass = calendarBaseThemeVariants({
|
|
966
|
+
disabled,
|
|
967
|
+
readonly,
|
|
968
|
+
rounded
|
|
969
|
+
});
|
|
970
|
+
const userClass = this.userClass();
|
|
971
|
+
return twMerge(variantClass, userClass);
|
|
972
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
973
|
+
this.calendarView = signal("month", ...ngDevMode ? [{ debugName: "calendarView" }] : /* istanbul ignore next */ []);
|
|
974
|
+
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
|
|
975
|
+
this.decadeEnd = computed(() => {
|
|
976
|
+
return this.decadeStart() + 9;
|
|
977
|
+
}, ...ngDevMode ? [{ debugName: "decadeEnd" }] : /* istanbul ignore next */ []);
|
|
978
|
+
this.decadeGridClass = computed(() => {
|
|
979
|
+
return calendarDecadeViewGridThemeVariants();
|
|
980
|
+
}, ...ngDevMode ? [{ debugName: "decadeGridClass" }] : /* istanbul ignore next */ []);
|
|
981
|
+
this.decadeStart = computed(() => {
|
|
982
|
+
const navigatedDate = this.navigatedDate();
|
|
983
|
+
const year = gregorianDateTime(navigatedDate, this.#i18n.localeId()).year;
|
|
984
|
+
return year - year % 10;
|
|
985
|
+
}, ...ngDevMode ? [{ debugName: "decadeStart" }] : /* istanbul ignore next */ []);
|
|
986
|
+
this.decadeYears = computed(() => {
|
|
987
|
+
const decadeStart = this.decadeStart();
|
|
988
|
+
return range(decadeStart, 10).chunk(4).select((e) => e.toArray()).toArray();
|
|
989
|
+
}, ...ngDevMode ? [{ debugName: "decadeYears" }] : /* istanbul ignore next */ []);
|
|
990
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
991
|
+
this.effectiveFirstDay = computed(() => {
|
|
992
|
+
return this.firstDay() ?? getLocaleFirstDayOfWeek(this.#i18n.localeId());
|
|
993
|
+
}, ...ngDevMode ? [{ debugName: "effectiveFirstDay" }] : /* istanbul ignore next */ []);
|
|
994
|
+
this.gridId = createElementControlId();
|
|
995
|
+
this.headerClass = computed(() => {
|
|
996
|
+
return calendarHeaderThemeVariants({});
|
|
997
|
+
}, ...ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []);
|
|
998
|
+
this.headerMonthYear = computed(() => {
|
|
999
|
+
const locale = this.#i18n.localeId();
|
|
1000
|
+
return formatGregorianDateToLocaleString(this.navigatedDate(), locale, {
|
|
1001
|
+
year: "numeric",
|
|
1002
|
+
month: "long"
|
|
1003
|
+
});
|
|
1004
|
+
}, ...ngDevMode ? [{ debugName: "headerMonthYear" }] : /* istanbul ignore next */ []);
|
|
1005
|
+
this.headerYear = computed(() => {
|
|
1006
|
+
const locale = this.#i18n.localeId();
|
|
1007
|
+
return formatGregorianDateToLocaleString(this.navigatedDate(), locale, { year: "numeric" });
|
|
1008
|
+
}, ...ngDevMode ? [{ debugName: "headerYear" }] : /* istanbul ignore next */ []);
|
|
1009
|
+
this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && this.isEmptyValue()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
1010
|
+
this.isDayUnavailable = computed(() => {
|
|
1011
|
+
const disabledDates = this.disabledDates();
|
|
1012
|
+
const min = this.minDate();
|
|
1013
|
+
const max = this.maxDate();
|
|
1014
|
+
const isOutOfRange = (date) => compareDates(date, max, ">") || compareDates(date, min, "<");
|
|
1015
|
+
if (typeof disabledDates === "function") return (date) => isOutOfRange(date) || disabledDates(date);
|
|
1016
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1017
|
+
for (const disabledDate of disabledDates ?? []) keys.add(toDayKey(disabledDate));
|
|
1018
|
+
return (date) => isOutOfRange(date) || keys.has(toDayKey(date));
|
|
1019
|
+
}, ...ngDevMode ? [{ debugName: "isDayUnavailable" }] : /* istanbul ignore next */ []);
|
|
1020
|
+
this.messages = this.#i18n.componentMessages("calendar", CALENDAR_DEFAULT_MESSAGES);
|
|
1021
|
+
this.monthBounds = computed(() => {
|
|
1022
|
+
const navigatedDate = this.navigatedDate();
|
|
1023
|
+
const firstDayOfMonth = gregorianDateTime(navigatedDate, this.#i18n.localeId()).startOf("month");
|
|
1024
|
+
const lastDayOfMonth = gregorianDateTime(navigatedDate, this.#i18n.localeId()).endOf("month");
|
|
1025
|
+
return {
|
|
1026
|
+
start: firstDayOfMonth.toJSDate(),
|
|
1027
|
+
end: lastDayOfMonth.toJSDate()
|
|
1028
|
+
};
|
|
1029
|
+
}, ...ngDevMode ? [{ debugName: "monthBounds" }] : /* istanbul ignore next */ []);
|
|
1030
|
+
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
|
|
1031
|
+
this.monthDictChunked = computed(() => {
|
|
1032
|
+
return this.#monthDict().chunk(7).select((e) => e.toImmutableDictionary((e) => e.key, (e) => e.value)).toImmutableSet();
|
|
1033
|
+
}, ...ngDevMode ? [{ debugName: "monthDictChunked" }] : /* istanbul ignore next */ []);
|
|
1034
|
+
this.monthGridClass = computed(() => {
|
|
1035
|
+
return calendarMonthViewGridThemeVariants();
|
|
1036
|
+
}, ...ngDevMode ? [{ debugName: "monthGridClass" }] : /* istanbul ignore next */ []);
|
|
1037
|
+
this.monthGridHeaderClass = computed(() => {
|
|
1038
|
+
return calendarMonthViewGridHeaderThemeVariants();
|
|
1039
|
+
}, ...ngDevMode ? [{ debugName: "monthGridHeaderClass" }] : /* istanbul ignore next */ []);
|
|
1040
|
+
this.months = computed(() => {
|
|
1041
|
+
const locale = this.#i18n.localeId();
|
|
1042
|
+
const names = range(1, 12).select((m) => gregorianDateTimeFromObject({
|
|
1043
|
+
year: 2024,
|
|
1044
|
+
month: m,
|
|
1045
|
+
day: 1
|
|
1046
|
+
}, locale).toFormat("LLL")).toArray();
|
|
1047
|
+
return index(names).chunk(3).select((e) => e.select((m) => [m[0] + 1, m[1]]).toImmutableSet()).toImmutableSet();
|
|
1048
|
+
}, ...ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []);
|
|
1049
|
+
this.navigatedDate = signal(startOfDay(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []);
|
|
1050
|
+
this.nextButtonLabel = computed(() => {
|
|
1051
|
+
const view = this.calendarView();
|
|
1052
|
+
const messages = this.messages();
|
|
1053
|
+
switch (view) {
|
|
1054
|
+
case "month": return messages.nextMonth;
|
|
1055
|
+
case "year": return messages.nextYear;
|
|
1056
|
+
case "decade": return messages.nextDecade;
|
|
1057
|
+
}
|
|
1058
|
+
}, ...ngDevMode ? [{ debugName: "nextButtonLabel" }] : /* istanbul ignore next */ []);
|
|
1059
|
+
this.pendingRangeStart = signal(null, ...ngDevMode ? [{ debugName: "pendingRangeStart" }] : /* istanbul ignore next */ []);
|
|
1060
|
+
this.prevButtonLabel = computed(() => {
|
|
1061
|
+
const view = this.calendarView();
|
|
1062
|
+
const messages = this.messages();
|
|
1063
|
+
switch (view) {
|
|
1064
|
+
case "month": return messages.previousMonth;
|
|
1065
|
+
case "year": return messages.previousYear;
|
|
1066
|
+
case "decade": return messages.previousDecade;
|
|
1067
|
+
}
|
|
1068
|
+
}, ...ngDevMode ? [{ debugName: "prevButtonLabel" }] : /* istanbul ignore next */ []);
|
|
1069
|
+
this.rangePreviewDate = signal(null, ...ngDevMode ? [{ debugName: "rangePreviewDate" }] : /* istanbul ignore next */ []);
|
|
1070
|
+
this.rangePreviewDates = computed(() => {
|
|
1071
|
+
if (this.selection() !== "range") return [];
|
|
1072
|
+
const pendingRangeStart = this.pendingRangeStart();
|
|
1073
|
+
if (!pendingRangeStart) return [];
|
|
1074
|
+
return this.getInclusiveDateRange(pendingRangeStart, this.rangePreviewDate() ?? this.navigatedDate());
|
|
1075
|
+
}, ...ngDevMode ? [{ debugName: "rangePreviewDates" }] : /* istanbul ignore next */ []);
|
|
1076
|
+
this.rangePreviewKeys = computed(() => new Set(this.rangePreviewDates().map(toDayKey)), ...ngDevMode ? [{ debugName: "rangePreviewKeys" }] : /* istanbul ignore next */ []);
|
|
1077
|
+
this.selectedDates = linkedSignal(() => {
|
|
1078
|
+
const v = this.value();
|
|
1079
|
+
const selection = this.selection();
|
|
1080
|
+
if (v == null) return [];
|
|
1081
|
+
if (selection === "range" && Array.isArray(v) && v.length >= 2) {
|
|
1082
|
+
const date1 = DateTime.fromJSDate(v[0]);
|
|
1083
|
+
const date2 = DateTime.fromJSDate(v[v.length - 1]);
|
|
1084
|
+
const startDate = date1 <= date2 ? date1 : date2;
|
|
1085
|
+
const totalDays = calendarDaysBetween(startDate, date1 <= date2 ? date2 : date1) + 1;
|
|
1086
|
+
return range(0, totalDays).select((i) => startDate.plus({ days: i }).toJSDate()).toArray();
|
|
1087
|
+
}
|
|
1088
|
+
return Array.isArray(v) ? v : [v];
|
|
1089
|
+
}, ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
|
|
1090
|
+
this.selectedKeys = computed(() => new Set(this.selectedDates().map(toDayKey)), ...ngDevMode ? [{ debugName: "selectedKeys" }] : /* istanbul ignore next */ []);
|
|
1091
|
+
this.today = signal(startOfDay(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
1092
|
+
this.todayButtonLabel = computed(() => {
|
|
1093
|
+
const locale = this.#i18n.localeId();
|
|
1094
|
+
const todayStr = formatGregorianDateToLocaleString(this.today(), locale, {
|
|
1095
|
+
year: "numeric",
|
|
1096
|
+
month: "long",
|
|
1097
|
+
day: "numeric"
|
|
1098
|
+
});
|
|
1099
|
+
return this.messages().goToToday(todayStr);
|
|
1100
|
+
}, ...ngDevMode ? [{ debugName: "todayButtonLabel" }] : /* istanbul ignore next */ []);
|
|
1101
|
+
this.todayUnavailable = computed(() => this.isDayUnavailable()(this.today()), ...ngDevMode ? [{ debugName: "todayUnavailable" }] : /* istanbul ignore next */ []);
|
|
1102
|
+
this.viewSwitchButtonLabel = computed(() => {
|
|
1103
|
+
const view = this.calendarView();
|
|
1104
|
+
const locale = this.#i18n.localeId();
|
|
1105
|
+
const navigatedDate = this.navigatedDate();
|
|
1106
|
+
const messages = this.messages();
|
|
1107
|
+
switch (view) {
|
|
1108
|
+
case "month": return messages.switchToYearView(formatGregorianDateToLocaleString(navigatedDate, locale, {
|
|
1109
|
+
year: "numeric",
|
|
1110
|
+
month: "long"
|
|
1111
|
+
}));
|
|
1112
|
+
case "year": return messages.switchToDecadeView(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric" }));
|
|
1113
|
+
case "decade": return messages.decadeRange(this.decadeStart(), this.decadeEnd());
|
|
1114
|
+
}
|
|
1115
|
+
}, ...ngDevMode ? [{ debugName: "viewSwitchButtonLabel" }] : /* istanbul ignore next */ []);
|
|
1116
|
+
this.weekdays = computed(() => {
|
|
1117
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
1118
|
+
const locale = this.#i18n.localeId();
|
|
1119
|
+
const names = range(0, 7).select((i) => {
|
|
1120
|
+
const dt = gregorianDateTimeFromObject({
|
|
1121
|
+
year: 2024,
|
|
1122
|
+
month: 1,
|
|
1123
|
+
day: 1 + i
|
|
1124
|
+
}, locale);
|
|
1125
|
+
return {
|
|
1126
|
+
full: dt.toFormat("cccc"),
|
|
1127
|
+
narrow: dt.toFormat("ccccc"),
|
|
1128
|
+
short: dt.toFormat("ccc")
|
|
1129
|
+
};
|
|
1130
|
+
}).toArray();
|
|
1131
|
+
const useNarrow = names.some(({ full, short }) => short.length > 4 || short === full && short.length > 3);
|
|
1132
|
+
const days = names.map((name) => ({
|
|
1133
|
+
...name,
|
|
1134
|
+
display: useNarrow ? name.narrow : name.short
|
|
1135
|
+
}));
|
|
1136
|
+
const startIndex = firstDayIso - 1;
|
|
1137
|
+
return [...days.slice(startIndex), ...days.slice(0, startIndex)];
|
|
1138
|
+
}, ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
|
|
1139
|
+
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, ...ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []);
|
|
1140
|
+
this.yearGridClass = computed(() => {
|
|
1141
|
+
return calendarYearViewGridThemeVariants();
|
|
1142
|
+
}, ...ngDevMode ? [{ debugName: "yearGridClass" }] : /* istanbul ignore next */ []);
|
|
1143
|
+
this.disabled = input(false, {
|
|
1144
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
1145
|
+
transform: booleanAttribute
|
|
1146
|
+
});
|
|
1147
|
+
this.disabledDates = input(...ngDevMode ? [void 0, { debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
1148
|
+
this.firstDay = input(null, ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
|
|
1149
|
+
this.focusOnMount = input(false, {
|
|
1150
|
+
...ngDevMode ? { debugName: "focusOnMount" } : /* istanbul ignore next */ {},
|
|
1151
|
+
transform: booleanAttribute
|
|
1152
|
+
});
|
|
1153
|
+
this.invalid = input(false, {
|
|
1154
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
1155
|
+
transform: booleanAttribute
|
|
1156
|
+
});
|
|
1157
|
+
this.maxDate = input(...ngDevMode ? [void 0, { debugName: "maxDate" }] : /* istanbul ignore next */ []);
|
|
1158
|
+
this.minDate = input(...ngDevMode ? [void 0, { debugName: "minDate" }] : /* istanbul ignore next */ []);
|
|
1159
|
+
this.readonly = input(false, {
|
|
1160
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
1161
|
+
transform: booleanAttribute
|
|
1162
|
+
});
|
|
1163
|
+
this.required = input(false, {
|
|
1164
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
1165
|
+
transform: booleanAttribute
|
|
1166
|
+
});
|
|
1167
|
+
this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
1168
|
+
this.selection = input("single", ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
|
|
1169
|
+
this.touch = output();
|
|
1170
|
+
this.touched = input(false, {
|
|
1171
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
1172
|
+
transform: booleanAttribute
|
|
1173
|
+
});
|
|
1174
|
+
this.userClass = input("", {
|
|
1175
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
1176
|
+
alias: "class"
|
|
1177
|
+
});
|
|
1178
|
+
this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1179
|
+
this.weekNumber = input(false, {
|
|
1180
|
+
...ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {},
|
|
1181
|
+
transform: booleanAttribute
|
|
1182
|
+
});
|
|
1183
|
+
afterNextRender({ read: () => {
|
|
1184
|
+
this.setupKeyboardNavigation();
|
|
1185
|
+
if (this.focusOnMount()) this.focusActiveCell();
|
|
1186
|
+
} });
|
|
1187
|
+
effect(() => {
|
|
1188
|
+
const min = this.minDate();
|
|
1189
|
+
const max = this.maxDate();
|
|
1190
|
+
untracked(() => {
|
|
1191
|
+
const navigationDate = this.navigatedDate();
|
|
1192
|
+
if (compareDates(navigationDate, min, "<") && min) this.navigatedDate.set(min);
|
|
1193
|
+
else if (compareDates(navigationDate, max, ">") && max) this.navigatedDate.set(max);
|
|
1194
|
+
});
|
|
1195
|
+
});
|
|
1196
|
+
effect(() => {
|
|
1197
|
+
const v = this.value();
|
|
1198
|
+
untracked(() => {
|
|
1199
|
+
const lastDate = Array.isArray(v) ? lastOrDefault(v) : v;
|
|
1200
|
+
if (lastDate) this.navigatedDate.set(lastDate);
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
toObservable(this.calendarView).pipe(skip(1)).subscribe(() => this.focusActiveCell());
|
|
1204
|
+
}
|
|
1205
|
+
formatInteger(value) {
|
|
1206
|
+
if (value == null) return "";
|
|
1207
|
+
return formatNumber(value, this.#i18n.localeId(), {
|
|
1208
|
+
maximumFractionDigits: 0,
|
|
1209
|
+
useGrouping: false
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
getWeekNumber(date) {
|
|
1213
|
+
const dt = gregorianDateTime(date, this.#i18n.localeId());
|
|
1214
|
+
const daysToThursday = (4 - FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()] + 7) % 7;
|
|
1215
|
+
return dt.plus({ days: daysToThursday }).weekNumber;
|
|
1216
|
+
}
|
|
1217
|
+
onDayClick(date, event) {
|
|
1218
|
+
event.preventDefault();
|
|
1219
|
+
if (this.effectiveDisabled() || this.readonly()) return;
|
|
1220
|
+
const selection = this.selection();
|
|
1221
|
+
if (selection === "single") this.handleSingleSelection(date);
|
|
1222
|
+
else if (selection === "multiple") {
|
|
1223
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) this.handleMultipleSelection(date, event.shiftKey);
|
|
1224
|
+
else this.handleSingleSelection(date);
|
|
1225
|
+
} else if (selection === "range") {
|
|
1226
|
+
this.handleRangeSelection(date);
|
|
1227
|
+
this.navigatedDate.set(date);
|
|
1228
|
+
}
|
|
1229
|
+
this.focusActiveCell();
|
|
1230
|
+
this.commitUserSelection();
|
|
1231
|
+
}
|
|
1232
|
+
onDayPointerEnter(date) {
|
|
1233
|
+
if (this.effectiveDisabled() || this.readonly() || this.selection() !== "range" || this.pendingRangeStart() == null) return;
|
|
1234
|
+
this.rangePreviewDate.set(date);
|
|
1235
|
+
}
|
|
1236
|
+
onFocusOut(event) {
|
|
1237
|
+
if (this.#destroyRef.destroyed) return;
|
|
1238
|
+
const nextTarget = event.relatedTarget;
|
|
1239
|
+
if (nextTarget instanceof Node && this.#hostElementRef.nativeElement.contains(nextTarget)) return;
|
|
1240
|
+
this.touch.emit();
|
|
1241
|
+
}
|
|
1242
|
+
onMonthClick(month) {
|
|
1243
|
+
this.navigatedDate.set(DateTime.fromJSDate(this.navigatedDate()).set({ month }).toJSDate());
|
|
1244
|
+
this.calendarView.set("month");
|
|
1245
|
+
}
|
|
1246
|
+
onMonthGridPointerLeave() {
|
|
1247
|
+
this.rangePreviewDate.set(null);
|
|
1248
|
+
}
|
|
1249
|
+
onNavigationClick(direction) {
|
|
1250
|
+
this.rangePreviewDate.set(null);
|
|
1251
|
+
const date = DateTime.fromJSDate(this.navigatedDate());
|
|
1252
|
+
let unit;
|
|
1253
|
+
switch (this.calendarView()) {
|
|
1254
|
+
case "month":
|
|
1255
|
+
unit = { months: 1 };
|
|
1256
|
+
break;
|
|
1257
|
+
case "year":
|
|
1258
|
+
unit = { years: 1 };
|
|
1259
|
+
break;
|
|
1260
|
+
case "decade": unit = { years: 10 };
|
|
1261
|
+
}
|
|
1262
|
+
this.navigatedDate.set(direction === "prev" ? date.minus(unit).toJSDate() : date.plus(unit).toJSDate());
|
|
1263
|
+
}
|
|
1264
|
+
onTodayButtonClick() {
|
|
1265
|
+
this.refreshToday();
|
|
1266
|
+
if (this.effectiveDisabled() || this.readonly() || this.todayUnavailable()) return;
|
|
1267
|
+
const today = this.today();
|
|
1268
|
+
if (this.selection() === "range") {
|
|
1269
|
+
this.handleRangeSelection(today);
|
|
1270
|
+
this.navigatedDate.set(today);
|
|
1271
|
+
} else this.handleSingleSelection(today);
|
|
1272
|
+
this.calendarView.set("month");
|
|
1273
|
+
this.commitUserSelection();
|
|
1274
|
+
}
|
|
1275
|
+
onViewChangeClick(view) {
|
|
1276
|
+
this.calendarView.set(view);
|
|
1277
|
+
}
|
|
1278
|
+
onYearClick(year) {
|
|
1279
|
+
this.navigatedDate.set(DateTime.fromJSDate(this.navigatedDate()).set({ year }).toJSDate());
|
|
1280
|
+
this.calendarView.set("year");
|
|
1281
|
+
}
|
|
1282
|
+
refreshToday() {
|
|
1283
|
+
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
1284
|
+
if (!compareDates(today, this.today(), "==")) this.today.set(today);
|
|
1285
|
+
}
|
|
1286
|
+
clearPendingRange() {
|
|
1287
|
+
this.pendingRangeStart.set(null);
|
|
1288
|
+
this.rangePreviewDate.set(null);
|
|
1289
|
+
}
|
|
1290
|
+
commitUserSelection() {
|
|
1291
|
+
if (this.selection() === "range" && this.pendingRangeStart() != null) return;
|
|
1292
|
+
this.value.set(this.#outputValue());
|
|
1293
|
+
}
|
|
1294
|
+
extendSelection(offset) {
|
|
1295
|
+
const currentDate = this.navigatedDate();
|
|
1296
|
+
const newDate = DateTime.fromJSDate(currentDate).plus({ days: offset }).toJSDate();
|
|
1297
|
+
if (this.isDateDisabled(newDate)) return;
|
|
1298
|
+
const currentSelection = this.selectedDates();
|
|
1299
|
+
const dateTime = DateTime.fromJSDate(newDate);
|
|
1300
|
+
if (!currentSelection.some((d) => DateTime.fromJSDate(d).hasSame(dateTime, "day"))) this.setCurrentDate([...currentSelection, newDate]);
|
|
1301
|
+
this.navigatedDate.set(newDate);
|
|
1302
|
+
}
|
|
1303
|
+
focusActiveCell() {
|
|
1304
|
+
rxTimeout(this.#destroyRef, () => {
|
|
1305
|
+
const calendarView = this.calendarView();
|
|
1306
|
+
const selector = calendarView === "year" ? "[monaYearMonth]" : calendarView === "decade" ? "[monaDecadeYear]" : "[monaMonthDay]";
|
|
1307
|
+
this.#hostElementRef.nativeElement.querySelector(`${selector}[tabindex="0"]`)?.focus();
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
getDateArray(date) {
|
|
1311
|
+
if (date == null) return [];
|
|
1312
|
+
return Array.isArray(date) ? date : [date];
|
|
1313
|
+
}
|
|
1314
|
+
getDatesForMultipleSelection(date) {
|
|
1315
|
+
const lastSelectedDate = lastOrDefault(this.selectedDates()) ?? this.navigatedDate();
|
|
1316
|
+
const startDate = lastSelectedDate < date ? lastSelectedDate : date;
|
|
1317
|
+
const endDate = this.navigatedDate() > date ? this.navigatedDate() : date;
|
|
1318
|
+
const totalDays = calendarDaysBetween(DateTime.fromJSDate(startDate), DateTime.fromJSDate(endDate)) + 1;
|
|
1319
|
+
return range(0, totalDays).select((i) => DateTime.fromJSDate(startDate).plus({ days: i }).toJSDate()).toArray();
|
|
1320
|
+
}
|
|
1321
|
+
getInclusiveDateRange(date1, date2) {
|
|
1322
|
+
const dateTime1 = DateTime.fromJSDate(date1);
|
|
1323
|
+
const dateTime2 = DateTime.fromJSDate(date2);
|
|
1324
|
+
const startDate = dateTime1 <= dateTime2 ? dateTime1 : dateTime2;
|
|
1325
|
+
const totalDays = calendarDaysBetween(startDate, dateTime1 <= dateTime2 ? dateTime2 : dateTime1) + 1;
|
|
1326
|
+
return range(0, totalDays).select((i) => startDate.plus({ days: i }).toJSDate()).toArray();
|
|
1327
|
+
}
|
|
1328
|
+
handleKeydown(event) {
|
|
1329
|
+
if (this.effectiveDisabled()) return;
|
|
1330
|
+
const preventableEvent = new PreventableEvent("calendarKeydown", event);
|
|
1331
|
+
this.#calendarService?.keydown$.next(preventableEvent);
|
|
1332
|
+
if (preventableEvent.isDefaultPrevented()) return;
|
|
1333
|
+
if (event.target.closest("button")) return;
|
|
1334
|
+
const view = this.calendarView();
|
|
1335
|
+
const isCtrlOrCmd = event.ctrlKey || event.metaKey;
|
|
1336
|
+
const isShift = event.shiftKey;
|
|
1337
|
+
const selection = this.selection();
|
|
1338
|
+
if (!this.readonly() && selection === "multiple" && (isCtrlOrCmd || isShift)) {
|
|
1339
|
+
if (this.handleMultipleSelectionKeyboard(event, isCtrlOrCmd, isShift)) {
|
|
1340
|
+
this.commitUserSelection();
|
|
1341
|
+
this.focusActiveCell();
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
let shouldFocusCell = false;
|
|
1346
|
+
switch (event.key) {
|
|
1347
|
+
case "ArrowUp":
|
|
1348
|
+
event.preventDefault();
|
|
1349
|
+
if (isCtrlOrCmd) this.switchToUpperView();
|
|
1350
|
+
else this.navigateByWeeksOrRows(-1, view);
|
|
1351
|
+
shouldFocusCell = true;
|
|
1352
|
+
break;
|
|
1353
|
+
case "ArrowDown":
|
|
1354
|
+
event.preventDefault();
|
|
1355
|
+
if (isCtrlOrCmd) this.switchToLowerView();
|
|
1356
|
+
else this.navigateByWeeksOrRows(1, view);
|
|
1357
|
+
shouldFocusCell = true;
|
|
1358
|
+
break;
|
|
1359
|
+
case "ArrowLeft":
|
|
1360
|
+
event.preventDefault();
|
|
1361
|
+
if (isCtrlOrCmd) this.navigatePeriodKeyboard(this.horizontalPeriodDirection("ArrowLeft"));
|
|
1362
|
+
else this.navigateByDaysOrCells(this.horizontalCellDelta("ArrowLeft"), view);
|
|
1363
|
+
shouldFocusCell = true;
|
|
1364
|
+
break;
|
|
1365
|
+
case "ArrowRight":
|
|
1366
|
+
event.preventDefault();
|
|
1367
|
+
if (isCtrlOrCmd) this.navigatePeriodKeyboard(this.horizontalPeriodDirection("ArrowRight"));
|
|
1368
|
+
else this.navigateByDaysOrCells(this.horizontalCellDelta("ArrowRight"), view);
|
|
1369
|
+
shouldFocusCell = true;
|
|
1370
|
+
break;
|
|
1371
|
+
case "Enter":
|
|
1372
|
+
case " ": {
|
|
1373
|
+
event.preventDefault();
|
|
1374
|
+
const previousView = this.calendarView();
|
|
1375
|
+
if (this.readonly() && previousView === "month") {
|
|
1376
|
+
shouldFocusCell = true;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
if (isCtrlOrCmd && selection === "multiple") this.toggleFocusedDateInSelection();
|
|
1380
|
+
else if (isShift && selection === "multiple") this.selectRangeToFocused();
|
|
1381
|
+
else this.selectFocusedItem();
|
|
1382
|
+
if (previousView === "month" && this.calendarView() === "month") this.commitUserSelection();
|
|
1383
|
+
shouldFocusCell = true;
|
|
1384
|
+
break;
|
|
1385
|
+
}
|
|
1386
|
+
case "Home":
|
|
1387
|
+
event.preventDefault();
|
|
1388
|
+
this.navigateToStart(view);
|
|
1389
|
+
shouldFocusCell = true;
|
|
1390
|
+
break;
|
|
1391
|
+
case "End":
|
|
1392
|
+
event.preventDefault();
|
|
1393
|
+
this.navigateToEnd(view);
|
|
1394
|
+
shouldFocusCell = true;
|
|
1395
|
+
break;
|
|
1396
|
+
case "PageUp":
|
|
1397
|
+
event.preventDefault();
|
|
1398
|
+
this.navigateByPeriod(isShift && view === "month" ? -12 : -1, view);
|
|
1399
|
+
shouldFocusCell = true;
|
|
1400
|
+
break;
|
|
1401
|
+
case "PageDown":
|
|
1402
|
+
event.preventDefault();
|
|
1403
|
+
this.navigateByPeriod(isShift && view === "month" ? 12 : 1, view);
|
|
1404
|
+
shouldFocusCell = true;
|
|
1405
|
+
break;
|
|
1406
|
+
case "t":
|
|
1407
|
+
case "T":
|
|
1408
|
+
if (!isCtrlOrCmd && !isShift) {
|
|
1409
|
+
event.preventDefault();
|
|
1410
|
+
this.navigateToToday();
|
|
1411
|
+
shouldFocusCell = true;
|
|
1412
|
+
}
|
|
1413
|
+
break;
|
|
1414
|
+
case "Escape":
|
|
1415
|
+
event.preventDefault();
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
if (shouldFocusCell) this.focusActiveCell();
|
|
1419
|
+
}
|
|
1420
|
+
handleMultipleSelection(date, rangedSelection) {
|
|
1421
|
+
this.clearPendingRange();
|
|
1422
|
+
const value = this.selectedDates();
|
|
1423
|
+
if (value.length === 0) {
|
|
1424
|
+
this.setCurrentDate([date]);
|
|
1425
|
+
this.navigatedDate.set(date);
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
if (!rangedSelection) {
|
|
1429
|
+
const date1 = DateTime.fromJSDate(date);
|
|
1430
|
+
const valueList = this.getDateArray(value);
|
|
1431
|
+
const selectedDates = select(valueList, (e) => DateTime.fromJSDate(e));
|
|
1432
|
+
if (selectedDates.any((e) => e.hasSame(date1, "day"))) {
|
|
1433
|
+
const newDates = selectedDates.where((e) => !e.hasSame(date1, "day")).select((e) => e.toJSDate()).toArray();
|
|
1434
|
+
this.setCurrentDate(newDates);
|
|
1435
|
+
} else this.setCurrentDate([...valueList, date]);
|
|
1436
|
+
this.navigatedDate.set(date);
|
|
1437
|
+
} else {
|
|
1438
|
+
const selectedDates = this.getDatesForMultipleSelection(date);
|
|
1439
|
+
this.setCurrentDate(selectedDates);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
handleMultipleSelectionKeyboard(event, isCtrlOrCmd, isShift) {
|
|
1443
|
+
if (this.calendarView() !== "month") return false;
|
|
1444
|
+
if (isShift && !isCtrlOrCmd) switch (event.key) {
|
|
1445
|
+
case "ArrowLeft":
|
|
1446
|
+
event.preventDefault();
|
|
1447
|
+
this.extendSelection(this.horizontalCellDelta("ArrowLeft"));
|
|
1448
|
+
return true;
|
|
1449
|
+
case "ArrowRight":
|
|
1450
|
+
event.preventDefault();
|
|
1451
|
+
this.extendSelection(this.horizontalCellDelta("ArrowRight"));
|
|
1452
|
+
return true;
|
|
1453
|
+
case "ArrowUp":
|
|
1454
|
+
event.preventDefault();
|
|
1455
|
+
this.extendSelection(-7);
|
|
1456
|
+
return true;
|
|
1457
|
+
case "ArrowDown":
|
|
1458
|
+
event.preventDefault();
|
|
1459
|
+
this.extendSelection(7);
|
|
1460
|
+
return true;
|
|
1461
|
+
}
|
|
1462
|
+
return false;
|
|
1463
|
+
}
|
|
1464
|
+
handleRangeSelection(date) {
|
|
1465
|
+
const pendingRangeStart = this.pendingRangeStart();
|
|
1466
|
+
if (pendingRangeStart == null) {
|
|
1467
|
+
this.pendingRangeStart.set(date);
|
|
1468
|
+
this.rangePreviewDate.set(null);
|
|
1469
|
+
this.setCurrentDate([date]);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
this.setCurrentDate(this.getInclusiveDateRange(pendingRangeStart, date));
|
|
1473
|
+
this.pendingRangeStart.set(null);
|
|
1474
|
+
this.rangePreviewDate.set(null);
|
|
1475
|
+
}
|
|
1476
|
+
handleSingleSelection(date) {
|
|
1477
|
+
this.clearPendingRange();
|
|
1478
|
+
const value = this.selectedDates();
|
|
1479
|
+
if (value.length > 0) {
|
|
1480
|
+
const date1 = DateTime.fromJSDate(date);
|
|
1481
|
+
const valueItem = lastOrDefault(value) ?? DateTime.now().toJSDate();
|
|
1482
|
+
const newDate = DateTime.fromJSDate(valueItem).set({
|
|
1483
|
+
day: date1.day,
|
|
1484
|
+
month: date1.month,
|
|
1485
|
+
year: date1.year
|
|
1486
|
+
}).toJSDate();
|
|
1487
|
+
this.navigatedDate.set(newDate);
|
|
1488
|
+
this.setCurrentDate(newDate);
|
|
1489
|
+
} else {
|
|
1490
|
+
this.navigatedDate.set(date);
|
|
1491
|
+
this.setCurrentDate(date);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
horizontalCellDelta(key) {
|
|
1495
|
+
const isRtl = this.#direction() === "rtl";
|
|
1496
|
+
if (key === "ArrowLeft") return isRtl ? 1 : -1;
|
|
1497
|
+
return isRtl ? -1 : 1;
|
|
1498
|
+
}
|
|
1499
|
+
horizontalPeriodDirection(key) {
|
|
1500
|
+
const isRtl = this.#direction() === "rtl";
|
|
1501
|
+
if (key === "ArrowLeft") return isRtl ? "next" : "prev";
|
|
1502
|
+
return isRtl ? "prev" : "next";
|
|
1503
|
+
}
|
|
1504
|
+
isDateDisabled(date) {
|
|
1505
|
+
return this.isDayUnavailable()(date);
|
|
1506
|
+
}
|
|
1507
|
+
isEmptyValue() {
|
|
1508
|
+
const value = this.value();
|
|
1509
|
+
return value == null || Array.isArray(value) && value.length === 0;
|
|
1510
|
+
}
|
|
1511
|
+
isOutOfRange(date) {
|
|
1512
|
+
return compareDates(date, this.maxDate(), ">") || compareDates(date, this.minDate(), "<");
|
|
1513
|
+
}
|
|
1514
|
+
navigateByDaysOrCells(offset, view) {
|
|
1515
|
+
const currentDate = this.navigatedDate();
|
|
1516
|
+
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1517
|
+
let newDate;
|
|
1518
|
+
switch (view) {
|
|
1519
|
+
case "month":
|
|
1520
|
+
newDate = dateTime.plus({ days: offset }).toJSDate();
|
|
1521
|
+
break;
|
|
1522
|
+
case "year":
|
|
1523
|
+
newDate = dateTime.plus({ months: offset }).toJSDate();
|
|
1524
|
+
break;
|
|
1525
|
+
case "decade": newDate = dateTime.plus({ years: offset }).toJSDate();
|
|
1526
|
+
}
|
|
1527
|
+
if (view === "month" && this.isOutOfRange(newDate)) return;
|
|
1528
|
+
this.rangePreviewDate.set(null);
|
|
1529
|
+
this.navigatedDate.set(newDate);
|
|
1530
|
+
}
|
|
1531
|
+
navigateByPeriod(offset, view) {
|
|
1532
|
+
const currentDate = this.navigatedDate();
|
|
1533
|
+
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1534
|
+
let newDate;
|
|
1535
|
+
switch (view) {
|
|
1536
|
+
case "month":
|
|
1537
|
+
newDate = dateTime.plus({ months: offset }).toJSDate();
|
|
1538
|
+
break;
|
|
1539
|
+
case "year":
|
|
1540
|
+
newDate = dateTime.plus({ years: offset }).toJSDate();
|
|
1541
|
+
break;
|
|
1542
|
+
case "decade": newDate = dateTime.plus({ years: offset * 10 }).toJSDate();
|
|
1543
|
+
}
|
|
1544
|
+
if (view === "month" && this.isDateDisabled(newDate)) {
|
|
1545
|
+
const direction = offset > 0 ? 1 : -1;
|
|
1546
|
+
const maxAttempts = 31;
|
|
1547
|
+
for (let i = 1; i <= maxAttempts; i++) {
|
|
1548
|
+
const adjustedDate = DateTime.fromJSDate(newDate).plus({ days: direction * i }).toJSDate();
|
|
1549
|
+
if (!this.isDateDisabled(adjustedDate)) {
|
|
1550
|
+
newDate = adjustedDate;
|
|
1551
|
+
break;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
this.rangePreviewDate.set(null);
|
|
1556
|
+
this.navigatedDate.set(newDate);
|
|
1557
|
+
}
|
|
1558
|
+
navigateByWeeksOrRows(offset, view) {
|
|
1559
|
+
const currentDate = this.navigatedDate();
|
|
1560
|
+
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1561
|
+
let newDate;
|
|
1562
|
+
switch (view) {
|
|
1563
|
+
case "month":
|
|
1564
|
+
newDate = dateTime.plus({ weeks: offset }).toJSDate();
|
|
1565
|
+
break;
|
|
1566
|
+
case "year":
|
|
1567
|
+
newDate = dateTime.plus({ months: offset * 3 }).toJSDate();
|
|
1568
|
+
break;
|
|
1569
|
+
case "decade": newDate = dateTime.plus({ years: offset * 4 }).toJSDate();
|
|
1570
|
+
}
|
|
1571
|
+
if (view === "month" && this.isOutOfRange(newDate)) return;
|
|
1572
|
+
this.rangePreviewDate.set(null);
|
|
1573
|
+
this.navigatedDate.set(newDate);
|
|
1574
|
+
}
|
|
1575
|
+
navigatePeriodKeyboard(direction) {
|
|
1576
|
+
this.rangePreviewDate.set(null);
|
|
1577
|
+
this.onNavigationClick(direction);
|
|
1578
|
+
}
|
|
1579
|
+
navigateToEnd(view) {
|
|
1580
|
+
const currentDate = this.navigatedDate();
|
|
1581
|
+
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1582
|
+
let newDate;
|
|
1583
|
+
switch (view) {
|
|
1584
|
+
case "month": {
|
|
1585
|
+
const daysToAdd = ((FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()] + 5) % 7 + 1 - dateTime.weekday + 7) % 7;
|
|
1586
|
+
newDate = dateTime.plus({ days: daysToAdd }).toJSDate();
|
|
1587
|
+
if (this.isDateDisabled(newDate)) for (let i = 1; i <= 6; i++) {
|
|
1588
|
+
const testDate = DateTime.fromJSDate(newDate).minus({ days: i }).toJSDate();
|
|
1589
|
+
if (!this.isDateDisabled(testDate)) {
|
|
1590
|
+
newDate = testDate;
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
case "year":
|
|
1597
|
+
newDate = dateTime.set({ month: 12 }).toJSDate();
|
|
1598
|
+
break;
|
|
1599
|
+
case "decade": {
|
|
1600
|
+
const yearEnd = this.decadeEnd();
|
|
1601
|
+
newDate = dateTime.set({ year: yearEnd }).toJSDate();
|
|
1602
|
+
break;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
this.rangePreviewDate.set(null);
|
|
1606
|
+
this.navigatedDate.set(newDate);
|
|
1607
|
+
}
|
|
1608
|
+
navigateToStart(view) {
|
|
1609
|
+
const currentDate = this.navigatedDate();
|
|
1610
|
+
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1611
|
+
let newDate;
|
|
1612
|
+
switch (view) {
|
|
1613
|
+
case "month": {
|
|
1614
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
1615
|
+
const daysToSubtract = (dateTime.weekday - firstDayIso + 7) % 7;
|
|
1616
|
+
newDate = dateTime.minus({ days: daysToSubtract }).toJSDate();
|
|
1617
|
+
if (this.isDateDisabled(newDate)) for (let i = 1; i <= 6; i++) {
|
|
1618
|
+
const testDate = DateTime.fromJSDate(newDate).plus({ days: i }).toJSDate();
|
|
1619
|
+
if (!this.isDateDisabled(testDate)) {
|
|
1620
|
+
newDate = testDate;
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
break;
|
|
1625
|
+
}
|
|
1626
|
+
case "year":
|
|
1627
|
+
newDate = dateTime.set({ month: 1 }).toJSDate();
|
|
1628
|
+
break;
|
|
1629
|
+
case "decade": {
|
|
1630
|
+
const yearStart = this.decadeStart();
|
|
1631
|
+
newDate = dateTime.set({ year: yearStart }).toJSDate();
|
|
1632
|
+
break;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
this.rangePreviewDate.set(null);
|
|
1636
|
+
this.navigatedDate.set(newDate);
|
|
1637
|
+
}
|
|
1638
|
+
navigateToToday() {
|
|
1639
|
+
this.refreshToday();
|
|
1640
|
+
const today = this.today();
|
|
1641
|
+
if (this.isDateDisabled(today)) return;
|
|
1642
|
+
this.rangePreviewDate.set(null);
|
|
1643
|
+
this.navigatedDate.set(today);
|
|
1644
|
+
this.calendarView.set("month");
|
|
1645
|
+
}
|
|
1646
|
+
selectFocusedItem() {
|
|
1647
|
+
const view = this.calendarView();
|
|
1648
|
+
const currentDate = this.navigatedDate();
|
|
1649
|
+
switch (view) {
|
|
1650
|
+
case "month":
|
|
1651
|
+
if (!this.isDateDisabled(currentDate)) {
|
|
1652
|
+
const selection = this.selection();
|
|
1653
|
+
if (selection === "single") this.handleSingleSelection(currentDate);
|
|
1654
|
+
else if (selection === "multiple") this.handleSingleSelection(currentDate);
|
|
1655
|
+
else if (selection === "range") this.handleRangeSelection(currentDate);
|
|
1656
|
+
}
|
|
1657
|
+
break;
|
|
1658
|
+
case "year":
|
|
1659
|
+
this.calendarView.set("month");
|
|
1660
|
+
break;
|
|
1661
|
+
case "decade": this.calendarView.set("year");
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
selectRangeToFocused() {
|
|
1665
|
+
const focusedDate = this.navigatedDate();
|
|
1666
|
+
if (this.isDateDisabled(focusedDate)) return;
|
|
1667
|
+
const selectedDates = this.getDatesForMultipleSelection(focusedDate);
|
|
1668
|
+
this.setCurrentDate(selectedDates);
|
|
1669
|
+
}
|
|
1670
|
+
setCurrentDate(date) {
|
|
1671
|
+
this.selectedDates.set(this.getDateArray(date));
|
|
1672
|
+
}
|
|
1673
|
+
setupKeyboardNavigation() {
|
|
1674
|
+
fromEvent(this.#hostElementRef.nativeElement, "keydown").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => this.handleKeydown(event));
|
|
1675
|
+
}
|
|
1676
|
+
switchToLowerView() {
|
|
1677
|
+
switch (this.calendarView()) {
|
|
1678
|
+
case "decade":
|
|
1679
|
+
this.calendarView.set("year");
|
|
1680
|
+
break;
|
|
1681
|
+
case "year": this.calendarView.set("month");
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
switchToUpperView() {
|
|
1685
|
+
switch (this.calendarView()) {
|
|
1686
|
+
case "month":
|
|
1687
|
+
this.calendarView.set("year");
|
|
1688
|
+
break;
|
|
1689
|
+
case "year": this.calendarView.set("decade");
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
toggleFocusedDateInSelection() {
|
|
1693
|
+
const focusedDate = this.navigatedDate();
|
|
1694
|
+
if (this.isDateDisabled(focusedDate)) return;
|
|
1695
|
+
const currentSelection = this.selectedDates();
|
|
1696
|
+
const dateTime = DateTime.fromJSDate(focusedDate);
|
|
1697
|
+
if (currentSelection.some((d) => DateTime.fromJSDate(d).hasSame(dateTime, "day"))) {
|
|
1698
|
+
const newSelection = currentSelection.filter((d) => !DateTime.fromJSDate(d).hasSame(dateTime, "day"));
|
|
1699
|
+
this.setCurrentDate(newSelection);
|
|
1700
|
+
} else this.setCurrentDate([...currentSelection, focusedDate]);
|
|
1701
|
+
}
|
|
1702
|
+
static {
|
|
1703
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1704
|
+
minVersion: "12.0.0",
|
|
1705
|
+
version: "22.2.6",
|
|
1706
|
+
ngImport: i0,
|
|
1707
|
+
type: CalendarComponent,
|
|
1708
|
+
deps: [],
|
|
1709
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
static {
|
|
1713
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1714
|
+
minVersion: "17.0.0",
|
|
1715
|
+
version: "22.2.6",
|
|
1716
|
+
type: CalendarComponent,
|
|
1717
|
+
isStandalone: true,
|
|
1718
|
+
selector: "mona-calendar",
|
|
1719
|
+
inputs: {
|
|
1720
|
+
disabled: {
|
|
1721
|
+
classPropertyName: "disabled",
|
|
1722
|
+
publicName: "disabled",
|
|
1723
|
+
isSignal: true,
|
|
1724
|
+
isRequired: false,
|
|
1725
|
+
transformFunction: null
|
|
1726
|
+
},
|
|
1727
|
+
disabledDates: {
|
|
1728
|
+
classPropertyName: "disabledDates",
|
|
1729
|
+
publicName: "disabledDates",
|
|
1730
|
+
isSignal: true,
|
|
1731
|
+
isRequired: false,
|
|
1732
|
+
transformFunction: null
|
|
1733
|
+
},
|
|
1734
|
+
firstDay: {
|
|
1735
|
+
classPropertyName: "firstDay",
|
|
1736
|
+
publicName: "firstDay",
|
|
1737
|
+
isSignal: true,
|
|
1738
|
+
isRequired: false,
|
|
1739
|
+
transformFunction: null
|
|
1740
|
+
},
|
|
1741
|
+
focusOnMount: {
|
|
1742
|
+
classPropertyName: "focusOnMount",
|
|
1743
|
+
publicName: "focusOnMount",
|
|
1744
|
+
isSignal: true,
|
|
1745
|
+
isRequired: false,
|
|
1746
|
+
transformFunction: null
|
|
1747
|
+
},
|
|
1748
|
+
invalid: {
|
|
1749
|
+
classPropertyName: "invalid",
|
|
1750
|
+
publicName: "invalid",
|
|
1751
|
+
isSignal: true,
|
|
1752
|
+
isRequired: false,
|
|
1753
|
+
transformFunction: null
|
|
1754
|
+
},
|
|
1755
|
+
maxDate: {
|
|
1756
|
+
classPropertyName: "maxDate",
|
|
1757
|
+
publicName: "maxDate",
|
|
1758
|
+
isSignal: true,
|
|
1759
|
+
isRequired: false,
|
|
1760
|
+
transformFunction: null
|
|
1761
|
+
},
|
|
1762
|
+
minDate: {
|
|
1763
|
+
classPropertyName: "minDate",
|
|
1764
|
+
publicName: "minDate",
|
|
1765
|
+
isSignal: true,
|
|
1766
|
+
isRequired: false,
|
|
1767
|
+
transformFunction: null
|
|
1768
|
+
},
|
|
1769
|
+
readonly: {
|
|
1770
|
+
classPropertyName: "readonly",
|
|
1771
|
+
publicName: "readonly",
|
|
1772
|
+
isSignal: true,
|
|
1773
|
+
isRequired: false,
|
|
1774
|
+
transformFunction: null
|
|
1775
|
+
},
|
|
1776
|
+
required: {
|
|
1777
|
+
classPropertyName: "required",
|
|
1778
|
+
publicName: "required",
|
|
1779
|
+
isSignal: true,
|
|
1780
|
+
isRequired: false,
|
|
1781
|
+
transformFunction: null
|
|
1782
|
+
},
|
|
1783
|
+
rounded: {
|
|
1784
|
+
classPropertyName: "rounded",
|
|
1785
|
+
publicName: "rounded",
|
|
1786
|
+
isSignal: true,
|
|
1787
|
+
isRequired: false,
|
|
1788
|
+
transformFunction: null
|
|
1789
|
+
},
|
|
1790
|
+
selection: {
|
|
1791
|
+
classPropertyName: "selection",
|
|
1792
|
+
publicName: "selection",
|
|
1793
|
+
isSignal: true,
|
|
1794
|
+
isRequired: false,
|
|
1795
|
+
transformFunction: null
|
|
1796
|
+
},
|
|
1797
|
+
touched: {
|
|
1798
|
+
classPropertyName: "touched",
|
|
1799
|
+
publicName: "touched",
|
|
1800
|
+
isSignal: true,
|
|
1801
|
+
isRequired: false,
|
|
1802
|
+
transformFunction: null
|
|
1803
|
+
},
|
|
1804
|
+
userClass: {
|
|
1805
|
+
classPropertyName: "userClass",
|
|
1806
|
+
publicName: "class",
|
|
1807
|
+
isSignal: true,
|
|
1808
|
+
isRequired: false,
|
|
1809
|
+
transformFunction: null
|
|
1810
|
+
},
|
|
1811
|
+
value: {
|
|
1812
|
+
classPropertyName: "value",
|
|
1813
|
+
publicName: "value",
|
|
1814
|
+
isSignal: true,
|
|
1815
|
+
isRequired: false,
|
|
1816
|
+
transformFunction: null
|
|
1817
|
+
},
|
|
1818
|
+
weekNumber: {
|
|
1819
|
+
classPropertyName: "weekNumber",
|
|
1820
|
+
publicName: "weekNumber",
|
|
1821
|
+
isSignal: true,
|
|
1822
|
+
isRequired: false,
|
|
1823
|
+
transformFunction: null
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
outputs: {
|
|
1827
|
+
touch: "touch",
|
|
1828
|
+
value: "valueChange"
|
|
1829
|
+
},
|
|
1830
|
+
host: {
|
|
1831
|
+
listeners: {
|
|
1832
|
+
"focusin": "refreshToday()",
|
|
1833
|
+
"focusout": "onFocusOut($event)"
|
|
1834
|
+
},
|
|
1835
|
+
properties: {
|
|
1836
|
+
"attr.aria-label": "null",
|
|
1837
|
+
"attr.data-disabled": "effectiveDisabled() || null",
|
|
1838
|
+
"attr.data-invalid": "invalidState() || null",
|
|
1839
|
+
"attr.data-required": "required() || null",
|
|
1840
|
+
"class": "baseClass()"
|
|
1841
|
+
}
|
|
1842
|
+
},
|
|
1843
|
+
queries: [
|
|
1844
|
+
{
|
|
1845
|
+
propertyName: "decadeCellTemplate",
|
|
1846
|
+
first: true,
|
|
1847
|
+
predicate: CalendarDecadeCellTemplateDirective,
|
|
1848
|
+
descendants: true,
|
|
1849
|
+
isSignal: true
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
propertyName: "monthCellTemplate",
|
|
1853
|
+
first: true,
|
|
1854
|
+
predicate: CalendarMonthCellTemplateDirective,
|
|
1855
|
+
descendants: true,
|
|
1856
|
+
isSignal: true
|
|
1857
|
+
},
|
|
1858
|
+
{
|
|
1859
|
+
propertyName: "yearCellTemplate",
|
|
1860
|
+
first: true,
|
|
1861
|
+
predicate: CalendarYearCellTemplateDirective,
|
|
1862
|
+
descendants: true,
|
|
1863
|
+
isSignal: true
|
|
1864
|
+
}
|
|
1865
|
+
],
|
|
1866
|
+
ngImport: i0,
|
|
1867
|
+
template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerMonthYear()\n }}</span>\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerYear()\n }}</span>\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"text-primary inline-flex h-9 items-center px-4 text-sm font-semibold\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div role=\"row\" [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (row of monthDictChunked(); track $index) {\n <div role=\"row\" [class]=\"monthGridClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = getWeekNumber(firstEntry.key);\n <div aria-hidden=\"true\">{{ formatInteger(week) }}</div>\n }\n }\n <!-- Track by time: the month is rebuilt with new Date objects on every navigation. -->\n @for (entry of row; track entry.key.getTime()) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.value, date: entry.key }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n",
|
|
1868
|
+
dependencies: [
|
|
1869
|
+
{
|
|
1870
|
+
kind: "directive",
|
|
1871
|
+
type: ButtonDirective,
|
|
1872
|
+
selector: "button[monaButton]",
|
|
1873
|
+
inputs: [
|
|
1874
|
+
"aria-haspopup",
|
|
1875
|
+
"disabled",
|
|
1876
|
+
"iconOnly",
|
|
1877
|
+
"loading",
|
|
1878
|
+
"look",
|
|
1879
|
+
"rounded",
|
|
1880
|
+
"selected",
|
|
1881
|
+
"size",
|
|
1882
|
+
"tabindex",
|
|
1883
|
+
"toggleable",
|
|
1884
|
+
"type",
|
|
1885
|
+
"class",
|
|
1886
|
+
"value"
|
|
1887
|
+
],
|
|
1888
|
+
outputs: ["lookChange", "selectedChange"]
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
kind: "directive",
|
|
1892
|
+
type: MonthDayDirective,
|
|
1893
|
+
selector: "[monaMonthDay]",
|
|
1894
|
+
inputs: [
|
|
1895
|
+
"disabled",
|
|
1896
|
+
"entry",
|
|
1897
|
+
"isDayUnavailable",
|
|
1898
|
+
"monthBounds",
|
|
1899
|
+
"navigatedDate",
|
|
1900
|
+
"rangePreviewKeys",
|
|
1901
|
+
"rounded",
|
|
1902
|
+
"selectedKeys",
|
|
1903
|
+
"today"
|
|
1904
|
+
],
|
|
1905
|
+
outputs: ["dayPointerEnter", "daySelect"]
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
kind: "directive",
|
|
1909
|
+
type: DecadeYearDirective,
|
|
1910
|
+
selector: "[monaDecadeYear]",
|
|
1911
|
+
inputs: [
|
|
1912
|
+
"disabled",
|
|
1913
|
+
"navigatedDate",
|
|
1914
|
+
"rounded",
|
|
1915
|
+
"selectedDate",
|
|
1916
|
+
"year"
|
|
1917
|
+
]
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
kind: "directive",
|
|
1921
|
+
type: YearMonthDirective,
|
|
1922
|
+
selector: "[monaYearMonth]",
|
|
1923
|
+
inputs: [
|
|
1924
|
+
"disabled",
|
|
1925
|
+
"month",
|
|
1926
|
+
"navigatedDate",
|
|
1927
|
+
"rounded",
|
|
1928
|
+
"selectedDate"
|
|
1929
|
+
]
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
kind: "directive",
|
|
1933
|
+
type: NgTemplateOutlet,
|
|
1934
|
+
selector: "[ngTemplateOutlet]",
|
|
1935
|
+
inputs: [
|
|
1936
|
+
"ngTemplateOutletContext",
|
|
1937
|
+
"ngTemplateOutlet",
|
|
1938
|
+
"ngTemplateOutletInjector"
|
|
1939
|
+
]
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
kind: "component",
|
|
1943
|
+
type: LucideChevronLeft,
|
|
1944
|
+
selector: "svg[lucideChevronLeft]"
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
kind: "component",
|
|
1948
|
+
type: LucideChevronRight,
|
|
1949
|
+
selector: "svg[lucideChevronRight]"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
kind: "pipe",
|
|
1953
|
+
type: TakeFirstPipe,
|
|
1954
|
+
name: "monaTakeFirst"
|
|
1955
|
+
}
|
|
1956
|
+
]
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1961
|
+
minVersion: "12.0.0",
|
|
1962
|
+
version: "22.2.6",
|
|
1963
|
+
ngImport: i0,
|
|
1964
|
+
type: CalendarComponent,
|
|
1965
|
+
decorators: [{
|
|
1966
|
+
type: Component,
|
|
1967
|
+
args: [{
|
|
1968
|
+
selector: "mona-calendar",
|
|
1969
|
+
imports: [
|
|
1970
|
+
ButtonDirective,
|
|
1971
|
+
MonthDayDirective,
|
|
1972
|
+
DecadeYearDirective,
|
|
1973
|
+
YearMonthDirective,
|
|
1974
|
+
NgTemplateOutlet,
|
|
1975
|
+
TakeFirstPipe,
|
|
1976
|
+
LucideChevronLeft,
|
|
1977
|
+
LucideChevronRight
|
|
1978
|
+
],
|
|
1979
|
+
host: {
|
|
1980
|
+
"[attr.aria-label]": "null",
|
|
1981
|
+
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
1982
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
1983
|
+
"[attr.data-required]": "required() || null",
|
|
1984
|
+
"[class]": "baseClass()",
|
|
1985
|
+
"(focusin)": "refreshToday()",
|
|
1986
|
+
"(focusout)": "onFocusOut($event)"
|
|
1987
|
+
},
|
|
1988
|
+
template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled() || todayUnavailable()\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>{{ messages().today }}</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerMonthYear()\n }}</span>\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n headerYear()\n }}</span>\n </button>\n }\n @case (\"decade\") {\n <!-- The decade is the top view, so its heading isn't a button. It names the grid with the locale's\n wording of the range, and shows the digits. -->\n <span\n class=\"text-primary inline-flex h-9 items-center px-4 text-sm font-semibold\"\n [id]=\"gridId + '-heading'\"\n ><span aria-hidden=\"true\">{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n ><span class=\"sr-only\">{{ viewSwitchButtonLabel() }}</span></span\n >\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft class=\"rtl:rotate-180\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight class=\"rtl:rotate-180\"></svg>\n </button>\n</div>\n\n<div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">{{ ariaLabel() }}</div>\n\n@if (calendarView() === \"month\") {\n @let columnCount = weekNumber() ? 8 : 7;\n <div\n role=\"grid\"\n class=\"flex flex-col gap-0.5\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n [attr.aria-disabled]=\"effectiveDisabled() || null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() || null\"\n (pointerleave)=\"onMonthGridPointerLeave()\">\n <div role=\"row\" [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <!-- Week numbers are visual only: every day is already named by its full date. -->\n <div aria-hidden=\"true\"></div>\n }\n @for (day of weekdays(); track day.full) {\n <div role=\"columnheader\">\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n @for (row of monthDictChunked(); track $index) {\n <div role=\"row\" [class]=\"monthGridClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = getWeekNumber(firstEntry.key);\n <div aria-hidden=\"true\">{{ formatInteger(week) }}</div>\n }\n }\n <!-- Track by time: the month is rebuilt with new Date objects on every navigation. -->\n @for (entry of row; track entry.key.getTime()) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"effectiveDisabled()\"\n [isDayUnavailable]=\"isDayUnavailable()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreviewKeys]=\"rangePreviewKeys()\"\n [rounded]=\"rounded()\"\n [selectedKeys]=\"selectedKeys()\"\n [today]=\"today()\"\n [entry]=\"entry\">\n @if (monthCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: entry.value, date: entry.key }\"></ng-container>\n } @else {\n <span>{{ formatInteger(entry.value) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n <div role=\"row\" [class]=\"yearGridClass()\">\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"!effectiveDisabled() && onMonthClick(monthItem[0])\"\n monaYearMonth\n [disabled]=\"effectiveDisabled()\"\n [month]=\"monthItem[0]\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (yearCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: monthItem[0], text: monthItem[1] }\">\n </ng-container>\n } @else {\n <span>{{ monthItem[1] }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div role=\"grid\" class=\"flex flex-col gap-0.5\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n <div role=\"row\" [class]=\"decadeGridClass()\">\n @for (year of row; track year) {\n <div\n (click)=\"!effectiveDisabled() && onYearClick(year)\"\n monaDecadeYear\n [disabled]=\"effectiveDisabled()\"\n [navigatedDate]=\"navigatedDate()\"\n [rounded]=\"rounded()\"\n [year]=\"year\"\n [selectedDate]=\"selectedDates()[0]\">\n @if (decadeCellTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\">\n </ng-container>\n } @else {\n <span>{{ formatInteger(year) }}</span>\n }\n </div>\n }\n </div>\n }\n </div>\n}\n"
|
|
1989
|
+
}]
|
|
1990
|
+
}],
|
|
1991
|
+
ctorParameters: () => [],
|
|
1992
|
+
propDecorators: {
|
|
1993
|
+
decadeCellTemplate: [{
|
|
1994
|
+
type: i0.ContentChild,
|
|
1995
|
+
args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }]
|
|
1996
|
+
}],
|
|
1997
|
+
monthCellTemplate: [{
|
|
1998
|
+
type: i0.ContentChild,
|
|
1999
|
+
args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }]
|
|
2000
|
+
}],
|
|
2001
|
+
yearCellTemplate: [{
|
|
2002
|
+
type: i0.ContentChild,
|
|
2003
|
+
args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }]
|
|
2004
|
+
}],
|
|
2005
|
+
disabled: [{
|
|
2006
|
+
type: i0.Input,
|
|
2007
|
+
args: [{
|
|
2008
|
+
isSignal: true,
|
|
2009
|
+
alias: "disabled",
|
|
2010
|
+
required: false
|
|
2011
|
+
}]
|
|
2012
|
+
}],
|
|
2013
|
+
disabledDates: [{
|
|
2014
|
+
type: i0.Input,
|
|
2015
|
+
args: [{
|
|
2016
|
+
isSignal: true,
|
|
2017
|
+
alias: "disabledDates",
|
|
2018
|
+
required: false
|
|
2019
|
+
}]
|
|
2020
|
+
}],
|
|
2021
|
+
firstDay: [{
|
|
2022
|
+
type: i0.Input,
|
|
2023
|
+
args: [{
|
|
2024
|
+
isSignal: true,
|
|
2025
|
+
alias: "firstDay",
|
|
2026
|
+
required: false
|
|
2027
|
+
}]
|
|
2028
|
+
}],
|
|
2029
|
+
focusOnMount: [{
|
|
2030
|
+
type: i0.Input,
|
|
2031
|
+
args: [{
|
|
2032
|
+
isSignal: true,
|
|
2033
|
+
alias: "focusOnMount",
|
|
2034
|
+
required: false
|
|
2035
|
+
}]
|
|
2036
|
+
}],
|
|
2037
|
+
invalid: [{
|
|
2038
|
+
type: i0.Input,
|
|
2039
|
+
args: [{
|
|
2040
|
+
isSignal: true,
|
|
2041
|
+
alias: "invalid",
|
|
2042
|
+
required: false
|
|
2043
|
+
}]
|
|
2044
|
+
}],
|
|
2045
|
+
maxDate: [{
|
|
2046
|
+
type: i0.Input,
|
|
2047
|
+
args: [{
|
|
2048
|
+
isSignal: true,
|
|
2049
|
+
alias: "maxDate",
|
|
2050
|
+
required: false
|
|
2051
|
+
}]
|
|
2052
|
+
}],
|
|
2053
|
+
minDate: [{
|
|
2054
|
+
type: i0.Input,
|
|
2055
|
+
args: [{
|
|
2056
|
+
isSignal: true,
|
|
2057
|
+
alias: "minDate",
|
|
2058
|
+
required: false
|
|
2059
|
+
}]
|
|
2060
|
+
}],
|
|
2061
|
+
readonly: [{
|
|
2062
|
+
type: i0.Input,
|
|
2063
|
+
args: [{
|
|
2064
|
+
isSignal: true,
|
|
2065
|
+
alias: "readonly",
|
|
2066
|
+
required: false
|
|
2067
|
+
}]
|
|
2068
|
+
}],
|
|
2069
|
+
required: [{
|
|
2070
|
+
type: i0.Input,
|
|
2071
|
+
args: [{
|
|
2072
|
+
isSignal: true,
|
|
2073
|
+
alias: "required",
|
|
2074
|
+
required: false
|
|
2075
|
+
}]
|
|
2076
|
+
}],
|
|
2077
|
+
rounded: [{
|
|
2078
|
+
type: i0.Input,
|
|
2079
|
+
args: [{
|
|
2080
|
+
isSignal: true,
|
|
2081
|
+
alias: "rounded",
|
|
2082
|
+
required: false
|
|
2083
|
+
}]
|
|
2084
|
+
}],
|
|
2085
|
+
selection: [{
|
|
2086
|
+
type: i0.Input,
|
|
2087
|
+
args: [{
|
|
2088
|
+
isSignal: true,
|
|
2089
|
+
alias: "selection",
|
|
2090
|
+
required: false
|
|
2091
|
+
}]
|
|
2092
|
+
}],
|
|
2093
|
+
touch: [{
|
|
2094
|
+
type: i0.Output,
|
|
2095
|
+
args: ["touch"]
|
|
2096
|
+
}],
|
|
2097
|
+
touched: [{
|
|
2098
|
+
type: i0.Input,
|
|
2099
|
+
args: [{
|
|
2100
|
+
isSignal: true,
|
|
2101
|
+
alias: "touched",
|
|
2102
|
+
required: false
|
|
2103
|
+
}]
|
|
2104
|
+
}],
|
|
2105
|
+
userClass: [{
|
|
2106
|
+
type: i0.Input,
|
|
2107
|
+
args: [{
|
|
2108
|
+
isSignal: true,
|
|
2109
|
+
alias: "class",
|
|
2110
|
+
required: false
|
|
2111
|
+
}]
|
|
2112
|
+
}],
|
|
2113
|
+
value: [{
|
|
2114
|
+
type: i0.Input,
|
|
2115
|
+
args: [{
|
|
2116
|
+
isSignal: true,
|
|
2117
|
+
alias: "value",
|
|
2118
|
+
required: false
|
|
2119
|
+
}]
|
|
2120
|
+
}, {
|
|
2121
|
+
type: i0.Output,
|
|
2122
|
+
args: ["valueChange"]
|
|
2123
|
+
}],
|
|
2124
|
+
weekNumber: [{
|
|
2125
|
+
type: i0.Input,
|
|
2126
|
+
args: [{
|
|
2127
|
+
isSignal: true,
|
|
2128
|
+
alias: "weekNumber",
|
|
2129
|
+
required: false
|
|
2130
|
+
}]
|
|
2131
|
+
}]
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
1637
2134
|
export { CALENDAR_DEFAULT_MESSAGES, CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective };
|
|
1638
|
-
|
|
2135
|
+
|
|
2136
|
+
//# sourceMappingURL=nanahoshi-mona-ui-calendar.mjs.map
|