@nanahoshi/mona-ui 0.18.6 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -13
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +17 -9
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +16 -7
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +196 -101
- package/fesm2022/nanahoshi-mona-ui-card.mjs +22 -14
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +78 -18
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +1 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +23 -5
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +49 -28
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +42 -26
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +39 -21
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +88 -55
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +57 -25
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +13 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +17 -6
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +178 -59
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +137 -54
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-WEDbZ5vy.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-BuybF7tX.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-ibH5osCg.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-Dj-SaNzk.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-CYAm4l84.mjs +145 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-hc-LeIb0.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-B_Gm--X6.mjs} +46 -31
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DYajpOb9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-X0X487Rm.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Pm8Fbp6M.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CyzJFQIy.mjs} +99 -42
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4874 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +12 -4
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -21
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +33 -18
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +10 -10
- package/fesm2022/nanahoshi-mona-ui-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +4973 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +29 -16
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +12 -3
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +23 -18
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +211 -106
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +66 -29
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +57 -46
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +35 -15
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +38 -17
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +25 -7
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +431 -101
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +26 -8
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +222 -28
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +91 -36
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +34 -15
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +39 -23
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +50 -25
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +41 -14
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +9 -9
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +74 -56
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +16 -8
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +47 -24
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +66 -27
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +23 -15
- package/fesm2022/nanahoshi-mona-ui-window.mjs +71 -40
- package/i18n/package.json +4 -0
- package/locales/package.json +4 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +9 -3
- package/types/nanahoshi-mona-ui-button-group.d.ts +9 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +29 -15
- package/types/nanahoshi-mona-ui-card.d.ts +8 -2
- package/types/nanahoshi-mona-ui-chart.d.ts +10 -1
- package/types/nanahoshi-mona-ui-chip.d.ts +7 -1
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +6 -1
- package/types/nanahoshi-mona-ui-color-palette.d.ts +21 -10
- package/types/nanahoshi-mona-ui-color-picker.d.ts +30 -20
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -1
- package/types/nanahoshi-mona-ui-date-picker.d.ts +14 -6
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +40 -12
- package/types/nanahoshi-mona-ui-dialog.d.ts +16 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -1
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +4 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +6 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +16 -10
- package/types/nanahoshi-mona-ui-grid.d.ts +50 -2
- package/types/nanahoshi-mona-ui-i18n.d.ts +680 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +7 -2
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +7 -3
- package/types/nanahoshi-mona-ui-list-box.d.ts +9 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +6 -6
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales.d.ts +4889 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +59 -58
- package/types/nanahoshi-mona-ui-multi-select.d.ts +6 -1
- package/types/nanahoshi-mona-ui-notification.d.ts +11 -5
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +24 -15
- package/types/nanahoshi-mona-ui-otp-input.d.ts +9 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +20 -6
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +9 -7
- package/types/nanahoshi-mona-ui-rating.d.ts +19 -12
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +34 -28
- package/types/nanahoshi-mona-ui-sheet.d.ts +8 -2
- package/types/nanahoshi-mona-ui-sidebar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +44 -26
- package/types/nanahoshi-mona-ui-spinner.d.ts +13 -4
- package/types/nanahoshi-mona-ui-split-button.d.ts +62 -56
- package/types/nanahoshi-mona-ui-splitter.d.ts +9 -6
- package/types/nanahoshi-mona-ui-stepper.d.ts +10 -3
- package/types/nanahoshi-mona-ui-switch.d.ts +1 -1
- package/types/nanahoshi-mona-ui-tabs.d.ts +96 -35
- package/types/nanahoshi-mona-ui-text-box.d.ts +11 -5
- package/types/nanahoshi-mona-ui-time-picker.d.ts +11 -4
- package/types/nanahoshi-mona-ui-time-selector.d.ts +16 -5
- package/types/nanahoshi-mona-ui-tree-view.d.ts +15 -10
- package/types/nanahoshi-mona-ui-window.d.ts +26 -20
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ZM3CneJ0.mjs +0 -145
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NgTemplateOutlet
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, TemplateRef, Directive, computed, input, output, DestroyRef, ElementRef, signal, contentChild, linkedSignal, model, afterNextRender, effect, untracked, Component } from '@angular/core';
|
|
4
4
|
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -11,8 +11,27 @@ import { themeRaisedBackdropClasses, createElementControlId, rxTimeout } from '@
|
|
|
11
11
|
import { DateTime } from 'luxon';
|
|
12
12
|
import { skip, fromEvent } from 'rxjs';
|
|
13
13
|
import { twMerge } from 'tailwind-merge';
|
|
14
|
+
import { MonaI18nService, injectComponentDirection, gregorianDateTime, formatGregorianDateToLocaleString, getLocaleFirstDayOfWeek, gregorianDateTimeFromObject, formatNumber } from '@nanahoshi/mona-ui/i18n';
|
|
14
15
|
import { cva } from 'class-variance-authority';
|
|
15
16
|
|
|
17
|
+
const CALENDAR_DEFAULT_MESSAGES = {
|
|
18
|
+
calendarLabel: (formattedMonthAndYear) => `Calendar, ${formattedMonthAndYear}`,
|
|
19
|
+
yearViewLabel: (year) => `Year view, ${year}`,
|
|
20
|
+
decadeViewLabel: (start, end) => `Decade view, ${start} - ${end}`,
|
|
21
|
+
nextMonth: "Next month",
|
|
22
|
+
nextYear: "Next year",
|
|
23
|
+
nextDecade: "Next decade",
|
|
24
|
+
previousMonth: "Previous month",
|
|
25
|
+
previousYear: "Previous year",
|
|
26
|
+
previousDecade: "Previous decade",
|
|
27
|
+
today: "Today",
|
|
28
|
+
goToToday: (formattedDate) => `Go to today, ${formattedDate}`,
|
|
29
|
+
switchToYearView: (currentMonthAndYear) => `Switch to year view, currently ${currentMonthAndYear}`,
|
|
30
|
+
switchToDecadeView: (currentYear) => `Switch to decade view, currently ${currentYear}`,
|
|
31
|
+
decadeRange: (start, end) => `${start} to ${end}`,
|
|
32
|
+
yearCellLabel: (year) => `Year ${year}`
|
|
33
|
+
};
|
|
34
|
+
|
|
16
35
|
class CalendarDecadeCellTemplateDirective {
|
|
17
36
|
constructor() {
|
|
18
37
|
this.templateRef = inject(TemplateRef);
|
|
@@ -191,7 +210,9 @@ const calendarDecadeViewCellThemeVariants = cva(`
|
|
|
191
210
|
|
|
192
211
|
class DecadeYearDirective {
|
|
193
212
|
constructor() {
|
|
194
|
-
this
|
|
213
|
+
this.#i18n = inject(MonaI18nService);
|
|
214
|
+
this.messages = this.#i18n.componentMessages("calendar", CALENDAR_DEFAULT_MESSAGES);
|
|
215
|
+
this.ariaLabel = computed(() => this.messages().yearCellLabel(this.year()), /* @ts-ignore */
|
|
195
216
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
196
217
|
this.baseClass = computed(() => {
|
|
197
218
|
const focused = this.focused();
|
|
@@ -225,6 +246,7 @@ class DecadeYearDirective {
|
|
|
225
246
|
this.year = input.required(/* @ts-ignore */
|
|
226
247
|
...(ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []));
|
|
227
248
|
}
|
|
249
|
+
#i18n;
|
|
228
250
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DecadeYearDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
229
251
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DecadeYearDirective, isStandalone: true, selector: "[monaDecadeYear]", inputs: { 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() ? 0 : -1", "attr.aria-current": "isCurrent() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-selected": "selected() ? 'true' : null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
230
252
|
}
|
|
@@ -474,48 +496,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
474
496
|
}]
|
|
475
497
|
}], propDecorators: { month: [{ type: i0.Input, args: [{ isSignal: true, alias: "month", required: true }] }], monthName: [{ type: i0.Input, args: [{ isSignal: true, alias: "monthName", required: true }] }], 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 }] }] } });
|
|
476
498
|
|
|
499
|
+
const FIRST_DAY_OF_WEEK_TO_ISO = {
|
|
500
|
+
monday: 1,
|
|
501
|
+
tuesday: 2,
|
|
502
|
+
wednesday: 3,
|
|
503
|
+
thursday: 4,
|
|
504
|
+
friday: 5,
|
|
505
|
+
saturday: 6,
|
|
506
|
+
sunday: 7
|
|
507
|
+
};
|
|
477
508
|
class CalendarComponent {
|
|
478
509
|
#calendarService;
|
|
479
510
|
#destroyRef;
|
|
511
|
+
#direction;
|
|
480
512
|
#hostElementRef;
|
|
513
|
+
#i18n;
|
|
481
514
|
#monthDict;
|
|
482
515
|
#outputValue;
|
|
483
516
|
constructor() {
|
|
484
517
|
this.#calendarService = inject(CalendarService, { optional: true });
|
|
485
518
|
this.#destroyRef = inject(DestroyRef);
|
|
519
|
+
this.#direction = injectComponentDirection();
|
|
486
520
|
this.#hostElementRef = inject(ElementRef);
|
|
521
|
+
this.#i18n = inject(MonaI18nService);
|
|
487
522
|
this.#monthDict = computed(() => {
|
|
488
523
|
const day = this.navigatedDate();
|
|
489
|
-
const firstDayOfMonth =
|
|
490
|
-
const lastDayOfMonth =
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
499
|
-
firstDayOfCalendar = firstDayOfMonth.startOf("week");
|
|
500
|
-
}
|
|
501
|
-
let lastDayOfCalendar;
|
|
502
|
-
const monthEndWeekday = lastDayOfMonth.weekday;
|
|
503
|
-
if (firstDayOfWeek === 0) {
|
|
504
|
-
const daysToAdd = monthEndWeekday === 7 ? 6 : 6 - monthEndWeekday;
|
|
505
|
-
lastDayOfCalendar = lastDayOfMonth.plus({ days: daysToAdd });
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
lastDayOfCalendar = lastDayOfMonth.endOf("week");
|
|
509
|
-
}
|
|
524
|
+
const firstDayOfMonth = gregorianDateTime(day, this.#i18n.localeId()).startOf("month");
|
|
525
|
+
const lastDayOfMonth = gregorianDateTime(day, this.#i18n.localeId()).endOf("month");
|
|
526
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
527
|
+
const daysToSubtract = (firstDayOfMonth.weekday - firstDayIso + 7) % 7;
|
|
528
|
+
const firstDayOfCalendar = firstDayOfMonth.minus({ days: daysToSubtract });
|
|
529
|
+
const lastDayOfWeekIso = ((firstDayIso + 5) % 7) + 1;
|
|
530
|
+
const daysToAdd = (lastDayOfWeekIso - lastDayOfMonth.weekday + 7) % 7;
|
|
531
|
+
const lastDayOfCalendar = lastDayOfMonth.plus({ days: daysToAdd });
|
|
510
532
|
const dictionary = new Dictionary();
|
|
511
533
|
for (let i = firstDayOfCalendar; i <= lastDayOfCalendar; i = i.plus({ days: 1 })) {
|
|
512
534
|
dictionary.add(i.toJSDate(), i.day);
|
|
513
535
|
}
|
|
514
|
-
if (monthEndWeekday === 7) {
|
|
515
|
-
for (let i = 0; i < 7; i++) {
|
|
516
|
-
dictionary.add(lastDayOfMonth.plus({ days: i + 1 }).toJSDate(), lastDayOfMonth.plus({ days: i + 1 }).day);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
536
|
return dictionary.toImmutableDictionary(e => e.key, e => e.value);
|
|
520
537
|
}, /* @ts-ignore */
|
|
521
538
|
...(ngDevMode ? [{ debugName: "#monthDict" }] : /* istanbul ignore next */ []));
|
|
@@ -543,14 +560,15 @@ class CalendarComponent {
|
|
|
543
560
|
this.ariaLabel = computed(() => {
|
|
544
561
|
const view = this.calendarView();
|
|
545
562
|
const navigatedDate = this.navigatedDate();
|
|
546
|
-
const
|
|
563
|
+
const locale = this.#i18n.localeId();
|
|
564
|
+
const messages = this.messages();
|
|
547
565
|
switch (view) {
|
|
548
566
|
case "month":
|
|
549
|
-
return
|
|
567
|
+
return messages.calendarLabel(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric", month: "long" }));
|
|
550
568
|
case "year":
|
|
551
|
-
return
|
|
569
|
+
return messages.yearViewLabel(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric" }));
|
|
552
570
|
case "decade":
|
|
553
|
-
return
|
|
571
|
+
return messages.decadeViewLabel(this.decadeStart(), this.decadeEnd());
|
|
554
572
|
}
|
|
555
573
|
}, /* @ts-ignore */
|
|
556
574
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -577,7 +595,7 @@ class CalendarComponent {
|
|
|
577
595
|
...(ngDevMode ? [{ debugName: "decadeGridClass" }] : /* istanbul ignore next */ []));
|
|
578
596
|
this.decadeStart = computed(() => {
|
|
579
597
|
const navigatedDate = this.navigatedDate();
|
|
580
|
-
const date =
|
|
598
|
+
const date = gregorianDateTime(navigatedDate, this.#i18n.localeId());
|
|
581
599
|
const year = date.year;
|
|
582
600
|
return year - (year % 10);
|
|
583
601
|
}, /* @ts-ignore */
|
|
@@ -590,17 +608,37 @@ class CalendarComponent {
|
|
|
590
608
|
.toArray();
|
|
591
609
|
}, /* @ts-ignore */
|
|
592
610
|
...(ngDevMode ? [{ debugName: "decadeYears" }] : /* istanbul ignore next */ []));
|
|
611
|
+
this.effectiveFirstDay = computed(() => {
|
|
612
|
+
return this.firstDay() ?? getLocaleFirstDayOfWeek(this.#i18n.localeId());
|
|
613
|
+
}, /* @ts-ignore */
|
|
614
|
+
...(ngDevMode ? [{ debugName: "effectiveFirstDay" }] : /* istanbul ignore next */ []));
|
|
593
615
|
this.gridId = createElementControlId();
|
|
594
616
|
this.headerClass = computed(() => {
|
|
595
617
|
return calendarHeaderThemeVariants({});
|
|
596
618
|
}, /* @ts-ignore */
|
|
597
619
|
...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
|
|
620
|
+
this.headerMonthYear = computed(() => {
|
|
621
|
+
const locale = this.#i18n.localeId();
|
|
622
|
+
return formatGregorianDateToLocaleString(this.navigatedDate(), locale, {
|
|
623
|
+
year: "numeric",
|
|
624
|
+
month: "long"
|
|
625
|
+
});
|
|
626
|
+
}, /* @ts-ignore */
|
|
627
|
+
...(ngDevMode ? [{ debugName: "headerMonthYear" }] : /* istanbul ignore next */ []));
|
|
628
|
+
this.headerYear = computed(() => {
|
|
629
|
+
const locale = this.#i18n.localeId();
|
|
630
|
+
return formatGregorianDateToLocaleString(this.navigatedDate(), locale, {
|
|
631
|
+
year: "numeric"
|
|
632
|
+
});
|
|
633
|
+
}, /* @ts-ignore */
|
|
634
|
+
...(ngDevMode ? [{ debugName: "headerYear" }] : /* istanbul ignore next */ []));
|
|
598
635
|
this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && this.isEmptyValue())), /* @ts-ignore */
|
|
599
636
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
637
|
+
this.messages = this.#i18n.componentMessages("calendar", CALENDAR_DEFAULT_MESSAGES);
|
|
600
638
|
this.monthBounds = computed(() => {
|
|
601
639
|
const navigatedDate = this.navigatedDate();
|
|
602
|
-
const firstDayOfMonth =
|
|
603
|
-
const lastDayOfMonth =
|
|
640
|
+
const firstDayOfMonth = gregorianDateTime(navigatedDate, this.#i18n.localeId()).startOf("month");
|
|
641
|
+
const lastDayOfMonth = gregorianDateTime(navigatedDate, this.#i18n.localeId()).endOf("month");
|
|
604
642
|
return { start: firstDayOfMonth.toJSDate(), end: lastDayOfMonth.toJSDate() };
|
|
605
643
|
}, /* @ts-ignore */
|
|
606
644
|
...(ngDevMode ? [{ debugName: "monthBounds" }] : /* istanbul ignore next */ []));
|
|
@@ -623,7 +661,10 @@ class CalendarComponent {
|
|
|
623
661
|
}, /* @ts-ignore */
|
|
624
662
|
...(ngDevMode ? [{ debugName: "monthGridHeaderClass" }] : /* istanbul ignore next */ []));
|
|
625
663
|
this.months = computed(() => {
|
|
626
|
-
const
|
|
664
|
+
const locale = this.#i18n.localeId();
|
|
665
|
+
const names = range(1, 12)
|
|
666
|
+
.select(m => gregorianDateTimeFromObject({ year: 2024, month: m, day: 1 }, locale).toFormat("LLL"))
|
|
667
|
+
.toArray();
|
|
627
668
|
return index(names)
|
|
628
669
|
.chunk(3)
|
|
629
670
|
.select(e => e.select(m => [m[0] + 1, m[1]]).toImmutableSet())
|
|
@@ -634,30 +675,32 @@ class CalendarComponent {
|
|
|
634
675
|
...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
|
|
635
676
|
this.nextButtonLabel = computed(() => {
|
|
636
677
|
const view = this.calendarView();
|
|
678
|
+
const messages = this.messages();
|
|
637
679
|
switch (view) {
|
|
638
680
|
case "month":
|
|
639
|
-
return
|
|
681
|
+
return messages.nextMonth;
|
|
640
682
|
case "year":
|
|
641
|
-
return
|
|
683
|
+
return messages.nextYear;
|
|
642
684
|
case "decade":
|
|
643
|
-
return
|
|
685
|
+
return messages.nextDecade;
|
|
644
686
|
}
|
|
645
687
|
}, /* @ts-ignore */
|
|
646
688
|
...(ngDevMode ? [{ debugName: "nextButtonLabel" }] : /* istanbul ignore next */ []));
|
|
689
|
+
this.pendingRangeStart = signal(null, /* @ts-ignore */
|
|
690
|
+
...(ngDevMode ? [{ debugName: "pendingRangeStart" }] : /* istanbul ignore next */ []));
|
|
647
691
|
this.prevButtonLabel = computed(() => {
|
|
648
692
|
const view = this.calendarView();
|
|
693
|
+
const messages = this.messages();
|
|
649
694
|
switch (view) {
|
|
650
695
|
case "month":
|
|
651
|
-
return
|
|
696
|
+
return messages.previousMonth;
|
|
652
697
|
case "year":
|
|
653
|
-
return
|
|
698
|
+
return messages.previousYear;
|
|
654
699
|
case "decade":
|
|
655
|
-
return
|
|
700
|
+
return messages.previousDecade;
|
|
656
701
|
}
|
|
657
702
|
}, /* @ts-ignore */
|
|
658
703
|
...(ngDevMode ? [{ debugName: "prevButtonLabel" }] : /* istanbul ignore next */ []));
|
|
659
|
-
this.pendingRangeStart = signal(null, /* @ts-ignore */
|
|
660
|
-
...(ngDevMode ? [{ debugName: "pendingRangeStart" }] : /* istanbul ignore next */ []));
|
|
661
704
|
this.rangePreviewDate = signal(null, /* @ts-ignore */
|
|
662
705
|
...(ngDevMode ? [{ debugName: "rangePreviewDate" }] : /* istanbul ignore next */ []));
|
|
663
706
|
this.rangePreviewDates = computed(() => {
|
|
@@ -692,35 +735,51 @@ class CalendarComponent {
|
|
|
692
735
|
...(ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []));
|
|
693
736
|
this.timezone = DateTime.local().zoneName ?? undefined;
|
|
694
737
|
this.todayButtonLabel = computed(() => {
|
|
695
|
-
const
|
|
696
|
-
|
|
738
|
+
const locale = this.#i18n.localeId();
|
|
739
|
+
const todayStr = formatGregorianDateToLocaleString(new Date(), locale, {
|
|
740
|
+
year: "numeric",
|
|
741
|
+
month: "long",
|
|
742
|
+
day: "numeric"
|
|
743
|
+
});
|
|
744
|
+
return this.messages().goToToday(todayStr);
|
|
697
745
|
}, /* @ts-ignore */
|
|
698
746
|
...(ngDevMode ? [{ debugName: "todayButtonLabel" }] : /* istanbul ignore next */ []));
|
|
699
747
|
this.viewSwitchButtonLabel = computed(() => {
|
|
700
748
|
const view = this.calendarView();
|
|
701
|
-
const
|
|
749
|
+
const locale = this.#i18n.localeId();
|
|
750
|
+
const navigatedDate = this.navigatedDate();
|
|
751
|
+
const messages = this.messages();
|
|
702
752
|
switch (view) {
|
|
703
753
|
case "month":
|
|
704
|
-
return
|
|
754
|
+
return messages.switchToYearView(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric", month: "long" }));
|
|
705
755
|
case "year":
|
|
706
|
-
return
|
|
756
|
+
return messages.switchToDecadeView(formatGregorianDateToLocaleString(navigatedDate, locale, { year: "numeric" }));
|
|
707
757
|
case "decade":
|
|
708
|
-
return
|
|
758
|
+
return messages.decadeRange(this.decadeStart(), this.decadeEnd());
|
|
709
759
|
}
|
|
710
760
|
}, /* @ts-ignore */
|
|
711
761
|
...(ngDevMode ? [{ debugName: "viewSwitchButtonLabel" }] : /* istanbul ignore next */ []));
|
|
712
762
|
this.weekdays = computed(() => {
|
|
713
|
-
const
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
{
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
763
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
764
|
+
const locale = this.#i18n.localeId();
|
|
765
|
+
// 2024-01-01 was a Monday (ISO 1)
|
|
766
|
+
const days = range(0, 7)
|
|
767
|
+
.select(i => {
|
|
768
|
+
const dt = gregorianDateTimeFromObject({ year: 2024, month: 1, day: 1 + i }, locale);
|
|
769
|
+
const short = dt.toFormat("ccc");
|
|
770
|
+
const full = dt.toFormat("cccc");
|
|
771
|
+
const narrow = dt.toFormat("ccccc");
|
|
772
|
+
const display = short.length > 4 || (short === full && short.length > 3) ? narrow : short;
|
|
773
|
+
return {
|
|
774
|
+
display,
|
|
775
|
+
short,
|
|
776
|
+
narrow,
|
|
777
|
+
full
|
|
778
|
+
};
|
|
779
|
+
})
|
|
780
|
+
.toArray();
|
|
781
|
+
const startIndex = firstDayIso - 1;
|
|
782
|
+
return [...days.slice(startIndex), ...days.slice(0, startIndex)];
|
|
724
783
|
}, /* @ts-ignore */
|
|
725
784
|
...(ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []));
|
|
726
785
|
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
|
|
@@ -741,10 +800,10 @@ class CalendarComponent {
|
|
|
741
800
|
this.disabledDates = input(/* @ts-ignore */
|
|
742
801
|
...(ngDevMode ? [undefined, { debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
743
802
|
/**
|
|
744
|
-
* @description Sets the first day of the week.
|
|
745
|
-
* @default
|
|
803
|
+
* @description Sets the first day of the week. If not specified, derives from the active locale.
|
|
804
|
+
* @default null
|
|
746
805
|
*/
|
|
747
|
-
this.firstDay = input(
|
|
806
|
+
this.firstDay = input(null, /* @ts-ignore */
|
|
748
807
|
...(ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []));
|
|
749
808
|
/**
|
|
750
809
|
* @description Marks the calendar as invalid. When bound to a signal form field via `[formField]`,
|
|
@@ -769,6 +828,13 @@ class CalendarComponent {
|
|
|
769
828
|
*/
|
|
770
829
|
this.readonly = input(false, /* @ts-ignore */
|
|
771
830
|
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
831
|
+
/**
|
|
832
|
+
* @description Sets whether the calendar is required. When bound to a signal form field via `[formField]`,
|
|
833
|
+
* this is written by the `FormField` directive.
|
|
834
|
+
* @default false
|
|
835
|
+
*/
|
|
836
|
+
this.required = input(false, /* @ts-ignore */
|
|
837
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
772
838
|
/**
|
|
773
839
|
* @description Sets the border radius of the calendar.
|
|
774
840
|
* @default "medium"
|
|
@@ -786,13 +852,6 @@ class CalendarComponent {
|
|
|
786
852
|
* The `FormField` directive listens to this to mark the field as touched.
|
|
787
853
|
*/
|
|
788
854
|
this.touch = output();
|
|
789
|
-
/**
|
|
790
|
-
* @description Sets whether the calendar is required. When bound to a signal form field via `[formField]`,
|
|
791
|
-
* this is written by the `FormField` directive.
|
|
792
|
-
* @default false
|
|
793
|
-
*/
|
|
794
|
-
this.required = input(false, /* @ts-ignore */
|
|
795
|
-
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
796
855
|
/**
|
|
797
856
|
* @description Sets the touched state of the calendar. When bound to a signal form field via `[formField]`,
|
|
798
857
|
* this is written by the `FormField` directive.
|
|
@@ -849,6 +908,21 @@ class CalendarComponent {
|
|
|
849
908
|
.pipe(skip(1))
|
|
850
909
|
.subscribe(() => this.focusActiveCell());
|
|
851
910
|
}
|
|
911
|
+
formatInteger(value) {
|
|
912
|
+
if (value == null) {
|
|
913
|
+
return "";
|
|
914
|
+
}
|
|
915
|
+
return formatNumber(value, this.#i18n.localeId(), {
|
|
916
|
+
maximumFractionDigits: 0,
|
|
917
|
+
useGrouping: false
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
getWeekNumber(date) {
|
|
921
|
+
const dt = gregorianDateTime(date, this.#i18n.localeId());
|
|
922
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
923
|
+
const daysToThursday = (4 - firstDayIso + 7) % 7;
|
|
924
|
+
return dt.plus({ days: daysToThursday }).weekNumber;
|
|
925
|
+
}
|
|
852
926
|
onDayClick(date, event) {
|
|
853
927
|
event.preventDefault();
|
|
854
928
|
if (this.disabled() || this.readonly()) {
|
|
@@ -926,6 +1000,14 @@ class CalendarComponent {
|
|
|
926
1000
|
this.navigatedDate.set(DateTime.fromJSDate(this.navigatedDate()).set({ year }).toJSDate());
|
|
927
1001
|
this.calendarView.set("year");
|
|
928
1002
|
}
|
|
1003
|
+
clearPendingRange() {
|
|
1004
|
+
this.pendingRangeStart.set(null);
|
|
1005
|
+
this.rangePreviewDate.set(null);
|
|
1006
|
+
}
|
|
1007
|
+
commitUserSelection() {
|
|
1008
|
+
this.value.set(this.#outputValue());
|
|
1009
|
+
this.touch.emit();
|
|
1010
|
+
}
|
|
929
1011
|
extendSelection(offset) {
|
|
930
1012
|
const currentDate = this.navigatedDate();
|
|
931
1013
|
const newDate = DateTime.fromJSDate(currentDate).plus({ days: offset }).toJSDate();
|
|
@@ -940,14 +1022,6 @@ class CalendarComponent {
|
|
|
940
1022
|
}
|
|
941
1023
|
this.navigatedDate.set(newDate);
|
|
942
1024
|
}
|
|
943
|
-
clearPendingRange() {
|
|
944
|
-
this.pendingRangeStart.set(null);
|
|
945
|
-
this.rangePreviewDate.set(null);
|
|
946
|
-
}
|
|
947
|
-
commitUserSelection() {
|
|
948
|
-
this.value.set(this.#outputValue());
|
|
949
|
-
this.touch.emit();
|
|
950
|
-
}
|
|
951
1025
|
focusActiveCell() {
|
|
952
1026
|
rxTimeout(this.#destroyRef, () => {
|
|
953
1027
|
const calendarView = this.calendarView();
|
|
@@ -1030,20 +1104,20 @@ class CalendarComponent {
|
|
|
1030
1104
|
case "ArrowLeft":
|
|
1031
1105
|
event.preventDefault();
|
|
1032
1106
|
if (isCtrlOrCmd) {
|
|
1033
|
-
this.navigatePeriodKeyboard("
|
|
1107
|
+
this.navigatePeriodKeyboard(this.horizontalPeriodDirection("ArrowLeft"));
|
|
1034
1108
|
}
|
|
1035
1109
|
else {
|
|
1036
|
-
this.navigateByDaysOrCells(
|
|
1110
|
+
this.navigateByDaysOrCells(this.horizontalCellDelta("ArrowLeft"), view);
|
|
1037
1111
|
}
|
|
1038
1112
|
shouldFocusCell = true;
|
|
1039
1113
|
break;
|
|
1040
1114
|
case "ArrowRight":
|
|
1041
1115
|
event.preventDefault();
|
|
1042
1116
|
if (isCtrlOrCmd) {
|
|
1043
|
-
this.navigatePeriodKeyboard("
|
|
1117
|
+
this.navigatePeriodKeyboard(this.horizontalPeriodDirection("ArrowRight"));
|
|
1044
1118
|
}
|
|
1045
1119
|
else {
|
|
1046
|
-
this.navigateByDaysOrCells(
|
|
1120
|
+
this.navigateByDaysOrCells(this.horizontalCellDelta("ArrowRight"), view);
|
|
1047
1121
|
}
|
|
1048
1122
|
shouldFocusCell = true;
|
|
1049
1123
|
break;
|
|
@@ -1148,11 +1222,11 @@ class CalendarComponent {
|
|
|
1148
1222
|
switch (event.key) {
|
|
1149
1223
|
case "ArrowLeft":
|
|
1150
1224
|
event.preventDefault();
|
|
1151
|
-
this.extendSelection(
|
|
1225
|
+
this.extendSelection(this.horizontalCellDelta("ArrowLeft"));
|
|
1152
1226
|
return true;
|
|
1153
1227
|
case "ArrowRight":
|
|
1154
1228
|
event.preventDefault();
|
|
1155
|
-
this.extendSelection(
|
|
1229
|
+
this.extendSelection(this.horizontalCellDelta("ArrowRight"));
|
|
1156
1230
|
return true;
|
|
1157
1231
|
case "ArrowUp":
|
|
1158
1232
|
event.preventDefault();
|
|
@@ -1195,6 +1269,20 @@ class CalendarComponent {
|
|
|
1195
1269
|
this.setCurrentDate(date);
|
|
1196
1270
|
}
|
|
1197
1271
|
}
|
|
1272
|
+
horizontalCellDelta(key) {
|
|
1273
|
+
const isRtl = this.#direction() === "rtl";
|
|
1274
|
+
if (key === "ArrowLeft") {
|
|
1275
|
+
return isRtl ? 1 : -1;
|
|
1276
|
+
}
|
|
1277
|
+
return isRtl ? -1 : 1;
|
|
1278
|
+
}
|
|
1279
|
+
horizontalPeriodDirection(key) {
|
|
1280
|
+
const isRtl = this.#direction() === "rtl";
|
|
1281
|
+
if (key === "ArrowLeft") {
|
|
1282
|
+
return isRtl ? "next" : "prev";
|
|
1283
|
+
}
|
|
1284
|
+
return isRtl ? "prev" : "next";
|
|
1285
|
+
}
|
|
1198
1286
|
isDateDisabled(date) {
|
|
1199
1287
|
const disabledDates = this.disabledDates();
|
|
1200
1288
|
const max = this.maxDate();
|
|
@@ -1294,11 +1382,14 @@ class CalendarComponent {
|
|
|
1294
1382
|
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1295
1383
|
let newDate;
|
|
1296
1384
|
switch (view) {
|
|
1297
|
-
case "month":
|
|
1298
|
-
|
|
1385
|
+
case "month": {
|
|
1386
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
1387
|
+
const lastDayOfWeekIso = ((firstDayIso + 5) % 7) + 1;
|
|
1388
|
+
const daysToAdd = (lastDayOfWeekIso - dateTime.weekday + 7) % 7;
|
|
1389
|
+
newDate = dateTime.plus({ days: daysToAdd }).toJSDate();
|
|
1299
1390
|
if (this.isDateDisabled(newDate)) {
|
|
1300
|
-
for (let i =
|
|
1301
|
-
const testDate =
|
|
1391
|
+
for (let i = 1; i <= 6; i++) {
|
|
1392
|
+
const testDate = DateTime.fromJSDate(newDate).minus({ days: i }).toJSDate();
|
|
1302
1393
|
if (!this.isDateDisabled(testDate)) {
|
|
1303
1394
|
newDate = testDate;
|
|
1304
1395
|
break;
|
|
@@ -1306,13 +1397,15 @@ class CalendarComponent {
|
|
|
1306
1397
|
}
|
|
1307
1398
|
}
|
|
1308
1399
|
break;
|
|
1400
|
+
}
|
|
1309
1401
|
case "year":
|
|
1310
1402
|
newDate = dateTime.set({ month: 12 }).toJSDate();
|
|
1311
1403
|
break;
|
|
1312
|
-
case "decade":
|
|
1404
|
+
case "decade": {
|
|
1313
1405
|
const yearEnd = this.decadeEnd();
|
|
1314
1406
|
newDate = dateTime.set({ year: yearEnd }).toJSDate();
|
|
1315
1407
|
break;
|
|
1408
|
+
}
|
|
1316
1409
|
}
|
|
1317
1410
|
this.rangePreviewDate.set(null);
|
|
1318
1411
|
this.navigatedDate.set(newDate);
|
|
@@ -1322,12 +1415,13 @@ class CalendarComponent {
|
|
|
1322
1415
|
const dateTime = DateTime.fromJSDate(currentDate);
|
|
1323
1416
|
let newDate;
|
|
1324
1417
|
switch (view) {
|
|
1325
|
-
case "month":
|
|
1326
|
-
|
|
1418
|
+
case "month": {
|
|
1419
|
+
const firstDayIso = FIRST_DAY_OF_WEEK_TO_ISO[this.effectiveFirstDay()];
|
|
1420
|
+
const daysToSubtract = (dateTime.weekday - firstDayIso + 7) % 7;
|
|
1421
|
+
newDate = dateTime.minus({ days: daysToSubtract }).toJSDate();
|
|
1327
1422
|
if (this.isDateDisabled(newDate)) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
const testDate = dateTime.set({ day: i }).toJSDate();
|
|
1423
|
+
for (let i = 1; i <= 6; i++) {
|
|
1424
|
+
const testDate = DateTime.fromJSDate(newDate).plus({ days: i }).toJSDate();
|
|
1331
1425
|
if (!this.isDateDisabled(testDate)) {
|
|
1332
1426
|
newDate = testDate;
|
|
1333
1427
|
break;
|
|
@@ -1335,13 +1429,15 @@ class CalendarComponent {
|
|
|
1335
1429
|
}
|
|
1336
1430
|
}
|
|
1337
1431
|
break;
|
|
1432
|
+
}
|
|
1338
1433
|
case "year":
|
|
1339
1434
|
newDate = dateTime.set({ month: 1 }).toJSDate();
|
|
1340
1435
|
break;
|
|
1341
|
-
case "decade":
|
|
1436
|
+
case "decade": {
|
|
1342
1437
|
const yearStart = this.decadeStart();
|
|
1343
1438
|
newDate = dateTime.set({ year: yearStart }).toJSDate();
|
|
1344
1439
|
break;
|
|
1440
|
+
}
|
|
1345
1441
|
}
|
|
1346
1442
|
this.rangePreviewDate.set(null);
|
|
1347
1443
|
this.navigatedDate.set(newDate);
|
|
@@ -1436,13 +1532,12 @@ class CalendarComponent {
|
|
|
1436
1532
|
}
|
|
1437
1533
|
}
|
|
1438
1534
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1439
|
-
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 }, 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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: { disabled: "disabledChange", touch: "touch", value: "valueChange" }, host: { attributes: { "role": "application" }, properties: { "attr.aria-label": "ariaLabel()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-invalid": "invalidState() || null", "attr.data-required": "required() || null", "attr.tabindex": "disabled() ? -1 : 0", "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 (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>Today</span>\n </button>\n @switch (calendarView()) {\n @case (\"month\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n (click)=\"onViewChangeClick('year')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n navigatedDate() | date: \"MMMM yyyy\" : timezone\n }}</span>\n </button>\n }\n @case (\"year\") {\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n (click)=\"onViewChangeClick('decade')\"\n [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\">{{\n navigatedDate() | date: \"yyyy\" : timezone\n }}</span>\n </button>\n }\n @case (\"decade\") {\n <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\"\n >{{ decadeStart() }} - {{ decadeEnd() }}</span\n >\n </button>\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n (click)=\"onNavigationClick('prev')\"\n [attr.aria-label]=\"prevButtonLabel()\">\n <svg lucideChevronLeft></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n (click)=\"onNavigationClick('next')\"\n [attr.aria-label]=\"nextButtonLabel()\">\n <svg lucideChevronRight></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 [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <div></div>\n }\n @for (day of weekdays(); track day.short) {\n <div>{{ day.short }}</div>\n }\n </div>\n <div\n [class]=\"monthGridClass()\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n (pointerleave)=\"onMonthGridPointerLeave()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @for (row of monthDictChunked(); track $index) {\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = firstEntry.key | date: \"w\";\n <div>{{ week }}</div>\n }\n }\n @for (entry of row; track entry.key) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"disabled()\"\n [disabledDates]=\"disabledDates()\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreview]=\"rangePreviewDates()\"\n [rounded]=\"rounded()\"\n [value]=\"selectedDates()\"\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>{{ entry.value }}</span>\n }\n </div>\n }\n }\n </div>\n} @else if (calendarView() === \"year\") {\n <div [class]=\"yearGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"onMonthClick(monthItem[0])\"\n monaYearMonth\n [month]=\"monthItem[0]\"\n [monthName]=\"monthItem[1]\"\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 }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div [class]=\"decadeGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n @for (year of row; track year) {\n <div\n (click)=\"onYearClick(year)\"\n monaDecadeYear\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>{{ year }}</span>\n }\n </div>\n }\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: MonthDayDirective, selector: "[monaMonthDay]", inputs: ["disabled", "disabledDates", "entry", "max", "min", "monthBounds", "navigatedDate", "rangePreview", "rounded", "value"], outputs: ["dayPointerEnter", "daySelect"] }, { kind: "directive", type: DecadeYearDirective, selector: "[monaDecadeYear]", inputs: ["navigatedDate", "rounded", "selectedDate", "year"] }, { kind: "directive", type: YearMonthDirective, selector: "[monaYearMonth]", inputs: ["month", "monthName", "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: DatePipe, name: "date" }, { kind: "pipe", type: TakeFirstPipe, name: "monaTakeFirst" }] }); }
|
|
1535
|
+
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 }, 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: { disabled: "disabledChange", touch: "touch", value: "valueChange" }, host: { attributes: { "role": "application" }, properties: { "attr.aria-label": "ariaLabel()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-invalid": "invalidState() || null", "attr.data-required": "required() || null", "attr.tabindex": "disabled() ? -1 : 0", "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 (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 (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 (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 <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\"\n >{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n >\n </button>\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\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 (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 [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <div></div>\n }\n @for (day of weekdays(); track day.full) {\n <div>\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n <div\n [class]=\"monthGridClass()\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n (pointerleave)=\"onMonthGridPointerLeave()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @for (row of monthDictChunked(); track $index) {\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = getWeekNumber(firstEntry.key);\n <div>{{ formatInteger(week) }}</div>\n }\n }\n @for (entry of row; track entry.key) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"disabled()\"\n [disabledDates]=\"disabledDates()\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreview]=\"rangePreviewDates()\"\n [rounded]=\"rounded()\"\n [value]=\"selectedDates()\"\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 }\n </div>\n} @else if (calendarView() === \"year\") {\n <div [class]=\"yearGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"onMonthClick(monthItem[0])\"\n monaYearMonth\n [month]=\"monthItem[0]\"\n [monthName]=\"monthItem[1]\"\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 }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div [class]=\"decadeGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n @for (year of row; track year) {\n <div\n (click)=\"onYearClick(year)\"\n monaDecadeYear\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 }\n </div>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: MonthDayDirective, selector: "[monaMonthDay]", inputs: ["disabled", "disabledDates", "entry", "max", "min", "monthBounds", "navigatedDate", "rangePreview", "rounded", "value"], outputs: ["dayPointerEnter", "daySelect"] }, { kind: "directive", type: DecadeYearDirective, selector: "[monaDecadeYear]", inputs: ["navigatedDate", "rounded", "selectedDate", "year"] }, { kind: "directive", type: YearMonthDirective, selector: "[monaYearMonth]", inputs: ["month", "monthName", "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" }] }); }
|
|
1440
1536
|
}
|
|
1441
1537
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CalendarComponent, decorators: [{
|
|
1442
1538
|
type: Component,
|
|
1443
1539
|
args: [{ selector: "mona-calendar", imports: [
|
|
1444
1540
|
ButtonDirective,
|
|
1445
|
-
DatePipe,
|
|
1446
1541
|
MonthDayDirective,
|
|
1447
1542
|
DecadeYearDirective,
|
|
1448
1543
|
YearMonthDirective,
|
|
@@ -1458,8 +1553,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1458
1553
|
"[attr.data-required]": "required() || null",
|
|
1459
1554
|
"[attr.tabindex]": "disabled() ? -1 : 0",
|
|
1460
1555
|
"[class]": "baseClass()"
|
|
1461
|
-
}, template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n (click)=\"onTodayButtonClick()\"\n [attr.aria-label]=\"todayButtonLabel()\">\n <span>
|
|
1462
|
-
}], ctorParameters: () => [], propDecorators: { decadeCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }] }], monthCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }] }], yearCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDay", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }],
|
|
1556
|
+
}, template: "<div [class]=\"headerClass()\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\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 (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 (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 <button monaButton look=\"ghost\" [rounded]=\"rounded()\" [attr.aria-label]=\"viewSwitchButtonLabel()\">\n <span class=\"text-primary font-semibold\" [id]=\"gridId + '-heading'\"\n >{{ formatInteger(decadeStart()) }} - {{ formatInteger(decadeEnd()) }}</span\n >\n </button>\n }\n }\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\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 (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 [class]=\"monthGridHeaderClass()\" [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @if (weekNumber()) {\n <div></div>\n }\n @for (day of weekdays(); track day.full) {\n <div>\n <span aria-hidden=\"true\">{{ day.display }}</span>\n <span class=\"sr-only\">{{ day.full }}</span>\n </div>\n }\n </div>\n <div\n [class]=\"monthGridClass()\"\n [attr.aria-labelledby]=\"gridId + '-heading'\"\n (pointerleave)=\"onMonthGridPointerLeave()\"\n [style.grid-template-columns]=\"`repeat(${columnCount}, 32px)`\">\n @for (row of monthDictChunked(); track $index) {\n @if (weekNumber()) {\n @let firstEntry = row | monaTakeFirst;\n @if (firstEntry) {\n @let week = getWeekNumber(firstEntry.key);\n <div>{{ formatInteger(week) }}</div>\n }\n }\n @for (entry of row; track entry.key) {\n <div\n (dayPointerEnter)=\"onDayPointerEnter($event)\"\n (daySelect)=\"onDayClick($event.date, $event.event)\"\n monaMonthDay\n [disabled]=\"disabled()\"\n [disabledDates]=\"disabledDates()\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"\n [monthBounds]=\"[monthBounds().start, monthBounds().end]\"\n [navigatedDate]=\"navigatedDate()\"\n [rangePreview]=\"rangePreviewDates()\"\n [rounded]=\"rounded()\"\n [value]=\"selectedDates()\"\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 }\n </div>\n} @else if (calendarView() === \"year\") {\n <div [class]=\"yearGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of months(); track $index) {\n @for (monthItem of row; track monthItem) {\n <div\n (click)=\"onMonthClick(monthItem[0])\"\n monaYearMonth\n [month]=\"monthItem[0]\"\n [monthName]=\"monthItem[1]\"\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 }\n </div>\n} @else if (calendarView() === \"decade\") {\n <div [class]=\"decadeGridClass()\" [attr.aria-labelledby]=\"gridId + '-heading'\">\n @for (row of decadeYears(); track $index) {\n @for (year of row; track year) {\n <div\n (click)=\"onYearClick(year)\"\n monaDecadeYear\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 }\n </div>\n}\n" }]
|
|
1557
|
+
}], ctorParameters: () => [], propDecorators: { decadeCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }] }], monthCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }] }], yearCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDay", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], weekNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekNumber", required: false }] }] } });
|
|
1463
1558
|
|
|
1464
1559
|
/*
|
|
1465
1560
|
* Public API Surface of @nanahoshi/mona-ui/calendar
|
|
@@ -1469,5 +1564,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1469
1564
|
* Generated bundle index. Do not edit.
|
|
1470
1565
|
*/
|
|
1471
1566
|
|
|
1472
|
-
export { CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective };
|
|
1567
|
+
export { CALENDAR_DEFAULT_MESSAGES, CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective };
|
|
1473
1568
|
//# sourceMappingURL=nanahoshi-mona-ui-calendar.mjs.map
|