@nanahoshi/mona-ui 0.27.2 → 0.28.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/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 +2070 -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-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 +59 -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 +6 -2
- package/package.json +62 -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-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 +17 -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,27 +1,23 @@
|
|
|
1
|
-
import { CdkTrapFocus } from
|
|
2
|
-
import { NgTemplateOutlet } from
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import { takeUntilDestroyed } from
|
|
6
|
-
import { LucideCalendar } from
|
|
7
|
-
import { ButtonDirective } from
|
|
8
|
-
import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective
|
|
9
|
-
import { CalendarService,
|
|
10
|
-
import * as i1 from
|
|
11
|
-
import {
|
|
12
|
-
import { MonaI18nService, getLocaleDateInputFormat } from
|
|
13
|
-
import {
|
|
14
|
-
import { TextBoxComponent,
|
|
15
|
-
import { twMerge } from
|
|
16
|
-
import { cva } from
|
|
17
|
-
|
|
18
|
-
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
19
|
-
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
1
|
+
import { CdkTrapFocus } from "@angular/cdk/a11y";
|
|
2
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, model, output, untracked, viewChild } from "@angular/core";
|
|
5
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
6
|
+
import { LucideCalendar } from "@lucide/angular";
|
|
7
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
8
|
+
import { CalendarComponent, CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective } from "@nanahoshi/mona-ui/calendar";
|
|
9
|
+
import { CalendarService, DateInputPrefixTemplateDirective, createTypedDateInput, datePopupThemeVariants } from "@nanahoshi/mona-ui/date-input";
|
|
10
|
+
import * as i1 from "@nanahoshi/mona-ui/dropdowns";
|
|
11
|
+
import { DROPDOWN_POPUP_INPUT_TOKEN, DropdownPopupHandlerDirective, DropdownService } from "@nanahoshi/mona-ui/dropdowns";
|
|
12
|
+
import { MonaI18nService, getLocaleDateInputFormat } from "@nanahoshi/mona-ui/i18n";
|
|
13
|
+
import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
|
|
14
|
+
import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from "@nanahoshi/mona-ui/text-box";
|
|
15
|
+
import { twMerge } from "tailwind-merge";
|
|
16
|
+
import { cva } from "class-variance-authority";
|
|
20
17
|
const DATE_PICKER_DEFAULT_MESSAGES = {
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
datePicker: "Date picker",
|
|
19
|
+
openCalendar: "Open calendar"
|
|
23
20
|
};
|
|
24
|
-
|
|
25
21
|
const datePickerBaseThemeVariants = cva(`
|
|
26
22
|
flex w-auto items-center
|
|
27
23
|
${themeControlSurfaceClasses} text-foreground
|
|
@@ -50,434 +46,960 @@ const datePickerBaseThemeVariants = cva(`
|
|
|
50
46
|
[&_mona-text-box]:focus-within:ring-0
|
|
51
47
|
[&_mona-text-box[data-invalid='true']]:ring-0
|
|
52
48
|
`, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
49
|
+
variants: {
|
|
50
|
+
focused: {
|
|
51
|
+
true: "border-focus-indicator ring-2 ring-focus-indicator/35",
|
|
52
|
+
false: ""
|
|
53
|
+
},
|
|
54
|
+
rounded: {
|
|
55
|
+
full: "rounded-full",
|
|
56
|
+
large: "rounded-lg",
|
|
57
|
+
medium: "rounded-md",
|
|
58
|
+
none: "rounded-none",
|
|
59
|
+
small: "rounded-sm"
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
large: "h-10 text-base",
|
|
63
|
+
medium: "h-9 text-sm",
|
|
64
|
+
small: "h-8 text-xs"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
compoundVariants: [{
|
|
68
|
+
focused: true,
|
|
69
|
+
class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
|
|
70
|
+
}]
|
|
71
|
+
});
|
|
72
|
+
var DatePickerComponent = class DatePickerComponent {
|
|
73
|
+
#calendarService;
|
|
74
|
+
#destroyRef;
|
|
75
|
+
#dropdownService;
|
|
76
|
+
#hostElementRef;
|
|
77
|
+
#i18n;
|
|
78
|
+
constructor() {
|
|
79
|
+
this.#calendarService = inject(CalendarService);
|
|
80
|
+
this.#destroyRef = inject(DestroyRef);
|
|
81
|
+
this.#dropdownService = inject(DropdownService);
|
|
82
|
+
this.#hostElementRef = inject(ElementRef);
|
|
83
|
+
this.#i18n = inject(MonaI18nService);
|
|
84
|
+
this.baseClass = computed(() => {
|
|
85
|
+
const focused = this.#dropdownService.popupRef() != null;
|
|
86
|
+
const rounded = this.rounded();
|
|
87
|
+
const size = this.size();
|
|
88
|
+
const variantClass = datePickerBaseThemeVariants({
|
|
89
|
+
focused,
|
|
90
|
+
rounded,
|
|
91
|
+
size
|
|
92
|
+
});
|
|
93
|
+
const userClass = this.userClass();
|
|
94
|
+
return twMerge(variantClass, userClass);
|
|
95
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
96
|
+
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, ...ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []);
|
|
97
|
+
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
98
|
+
this.effectiveFormat = computed(() => {
|
|
99
|
+
return this.format() ?? getLocaleDateInputFormat(this.#i18n.localeId());
|
|
100
|
+
}, ...ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []);
|
|
101
|
+
this.expanded = computed(() => this.#dropdownService.popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
102
|
+
this.inputAttributes = computed(() => {
|
|
103
|
+
return {
|
|
104
|
+
"aria-autocomplete": "none",
|
|
105
|
+
"aria-controls": this.popupId,
|
|
106
|
+
"aria-expanded": this.expanded() ? "true" : "false",
|
|
107
|
+
"aria-haspopup": "dialog",
|
|
108
|
+
readonly: this.readonly() || this.readonlyInput(),
|
|
109
|
+
role: "combobox"
|
|
110
|
+
};
|
|
111
|
+
}, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
|
|
112
|
+
this.invalidState = computed(() => this.typedInput.errors().length > 0 || this.touched() && (this.invalid() || this.required() && !this.value()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
|
|
113
|
+
this.messages = this.#i18n.componentMessages("datePicker", DATE_PICKER_DEFAULT_MESSAGES);
|
|
114
|
+
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, ...ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []);
|
|
115
|
+
this.pickerPopupClass = computed(() => {
|
|
116
|
+
const rounded = this.rounded();
|
|
117
|
+
const size = this.size();
|
|
118
|
+
const userClass = this.popupClass();
|
|
119
|
+
const variantClass = datePopupThemeVariants({
|
|
120
|
+
rounded,
|
|
121
|
+
size
|
|
122
|
+
});
|
|
123
|
+
return twMerge(variantClass, userClass);
|
|
124
|
+
}, ...ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []);
|
|
125
|
+
this.popupId = createElementControlId();
|
|
126
|
+
this.popupTemplate = viewChild.required("popupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
|
|
127
|
+
this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, {
|
|
128
|
+
...ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {},
|
|
129
|
+
read: TemplateRef
|
|
130
|
+
});
|
|
131
|
+
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, ...ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []);
|
|
132
|
+
this.ariaDescribedBy = input("", {
|
|
133
|
+
...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
|
|
134
|
+
alias: "aria-describedby"
|
|
135
|
+
});
|
|
136
|
+
this.ariaLabel = input("", {
|
|
137
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
138
|
+
alias: "aria-label"
|
|
139
|
+
});
|
|
140
|
+
this.ariaLabelledBy = input("", {
|
|
141
|
+
...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
|
|
142
|
+
alias: "aria-labelledby"
|
|
143
|
+
});
|
|
144
|
+
this.close = output();
|
|
145
|
+
this.closed = output();
|
|
146
|
+
this.disabled = input(false, {
|
|
147
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
148
|
+
transform: booleanAttribute
|
|
149
|
+
});
|
|
150
|
+
this.disabledDates = input(...ngDevMode ? [void 0, { debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
151
|
+
this.firstDay = input(null, ...ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []);
|
|
152
|
+
this.format = input(null, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
153
|
+
this.inputId = input(createElementControlId(), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
154
|
+
this.invalid = input(false, {
|
|
155
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
156
|
+
transform: booleanAttribute
|
|
157
|
+
});
|
|
158
|
+
this.max = input(void 0, {
|
|
159
|
+
...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
|
|
160
|
+
transform: (value) => value instanceof Date ? value : void 0
|
|
161
|
+
});
|
|
162
|
+
this.min = input(void 0, {
|
|
163
|
+
...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
|
|
164
|
+
transform: (value) => value instanceof Date ? value : void 0
|
|
165
|
+
});
|
|
166
|
+
this.open = output();
|
|
167
|
+
this.opened = output();
|
|
168
|
+
this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
169
|
+
this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
|
|
170
|
+
this.popupHeight = input("", ...ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []);
|
|
171
|
+
this.popupWidth = input("", ...ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []);
|
|
172
|
+
this.readonly = input(false, {
|
|
173
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
174
|
+
transform: booleanAttribute
|
|
175
|
+
});
|
|
176
|
+
this.readonlyInput = input(false, {
|
|
177
|
+
...ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {},
|
|
178
|
+
transform: booleanAttribute
|
|
179
|
+
});
|
|
180
|
+
this.required = input(false, {
|
|
181
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
182
|
+
transform: booleanAttribute
|
|
183
|
+
});
|
|
184
|
+
this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
185
|
+
this.showClearButton = input(false, {
|
|
186
|
+
...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
|
|
187
|
+
transform: booleanAttribute
|
|
188
|
+
});
|
|
189
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
190
|
+
this.touch = output();
|
|
191
|
+
this.touched = input(false, {
|
|
192
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
193
|
+
transform: booleanAttribute
|
|
194
|
+
});
|
|
195
|
+
this.userClass = input("", {
|
|
196
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
197
|
+
alias: "class"
|
|
198
|
+
});
|
|
199
|
+
this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
200
|
+
this.weekNumber = input(false, {
|
|
201
|
+
...ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {},
|
|
202
|
+
transform: booleanAttribute
|
|
203
|
+
});
|
|
204
|
+
this.typedInput = createTypedDateInput({
|
|
205
|
+
constraints: () => ({
|
|
206
|
+
disabledDates: this.disabledDates(),
|
|
207
|
+
max: this.max(),
|
|
208
|
+
min: this.min(),
|
|
209
|
+
unit: "date"
|
|
210
|
+
}),
|
|
211
|
+
format: () => this.effectiveFormat(),
|
|
212
|
+
localeId: () => this.#i18n.localeId(),
|
|
213
|
+
value: this.value
|
|
214
|
+
});
|
|
215
|
+
effect(() => {
|
|
216
|
+
const popupTemplate = this.popupTemplate();
|
|
217
|
+
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
218
|
+
});
|
|
219
|
+
afterNextRender({ read: () => {
|
|
220
|
+
this.setCalendarKeyboardSubscription();
|
|
221
|
+
this.setPopupCloseSubscription();
|
|
222
|
+
} });
|
|
223
|
+
}
|
|
224
|
+
focus(options) {
|
|
225
|
+
const input = this.#hostElementRef.nativeElement.querySelector("input");
|
|
226
|
+
if (input) {
|
|
227
|
+
input.focus(options);
|
|
228
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
onCalendarValueChange(date) {
|
|
232
|
+
const singleDate = Array.isArray(date) ? null : date;
|
|
233
|
+
this.value.set(singleDate ? new Date(singleDate) : null);
|
|
234
|
+
this.closePopup();
|
|
235
|
+
}
|
|
236
|
+
onDateInputButtonClick() {
|
|
237
|
+
const popupRef = this.#dropdownService.popupRef();
|
|
238
|
+
if (!this.popupTemplate() || this.effectiveDisabled() || this.readonly()) return;
|
|
239
|
+
if (popupRef) {
|
|
240
|
+
popupRef.close();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.openPopup();
|
|
244
|
+
}
|
|
245
|
+
onFocusIn(event) {
|
|
246
|
+
if (event.target === this.#hostElementRef.nativeElement) this.focus();
|
|
247
|
+
}
|
|
248
|
+
onFocusOut(event) {
|
|
249
|
+
if (this.#destroyRef.destroyed) return;
|
|
250
|
+
const nextTarget = event.relatedTarget;
|
|
251
|
+
if (nextTarget instanceof Node) {
|
|
252
|
+
const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
|
|
253
|
+
if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) return;
|
|
254
|
+
}
|
|
255
|
+
this.touch.emit();
|
|
256
|
+
}
|
|
257
|
+
onInputBlur() {
|
|
258
|
+
this.typedInput.commit();
|
|
259
|
+
}
|
|
260
|
+
onKeydown(event) {
|
|
261
|
+
if (this.effectiveDisabled() || this.readonly()) return;
|
|
262
|
+
if (event.altKey && event.key === "ArrowDown") {
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
this.openPopup();
|
|
265
|
+
} else if (event.altKey && event.key === "ArrowUp" || event.key === "Escape") {
|
|
266
|
+
if (this.expanded()) {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
this.closePopup();
|
|
269
|
+
}
|
|
270
|
+
} else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
|
|
271
|
+
if (!event.isComposing && event.keyCode !== 229) this.typedInput.commit();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
closePopup() {
|
|
275
|
+
this.#dropdownService.popupRef()?.close();
|
|
276
|
+
}
|
|
277
|
+
openPopup() {
|
|
278
|
+
if (!this.#dropdownService.popupRef()) this.#dropdownService.triggerPopupOpen$.next({
|
|
279
|
+
height: this.popupHeight() || "auto",
|
|
280
|
+
maxHeight: "auto",
|
|
281
|
+
width: this.popupWidth() || "auto",
|
|
282
|
+
closeOnScroll: false,
|
|
283
|
+
withScrollTracking: true
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
setCalendarKeyboardSubscription() {
|
|
287
|
+
this.#calendarService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
|
|
288
|
+
const keyboardEvent = event.originalEvent;
|
|
289
|
+
if (keyboardEvent && (keyboardEvent.key === "Escape" || keyboardEvent.altKey && keyboardEvent.key === "ArrowUp")) {
|
|
290
|
+
keyboardEvent.preventDefault();
|
|
291
|
+
this.closePopup();
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
setPopupCloseSubscription() {
|
|
296
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
297
|
+
if (this.#dropdownService.focusCanReturn()) this.focus();
|
|
298
|
+
else if (!this.#destroyRef.destroyed) this.touch.emit();
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
static {
|
|
302
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
303
|
+
minVersion: "12.0.0",
|
|
304
|
+
version: "22.2.6",
|
|
305
|
+
ngImport: i0,
|
|
306
|
+
type: DatePickerComponent,
|
|
307
|
+
deps: [],
|
|
308
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
static {
|
|
312
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
313
|
+
minVersion: "17.0.0",
|
|
314
|
+
version: "22.2.6",
|
|
315
|
+
type: DatePickerComponent,
|
|
316
|
+
isStandalone: true,
|
|
317
|
+
selector: "mona-date-picker",
|
|
318
|
+
inputs: {
|
|
319
|
+
ariaDescribedBy: {
|
|
320
|
+
classPropertyName: "ariaDescribedBy",
|
|
321
|
+
publicName: "aria-describedby",
|
|
322
|
+
isSignal: true,
|
|
323
|
+
isRequired: false,
|
|
324
|
+
transformFunction: null
|
|
325
|
+
},
|
|
326
|
+
ariaLabel: {
|
|
327
|
+
classPropertyName: "ariaLabel",
|
|
328
|
+
publicName: "aria-label",
|
|
329
|
+
isSignal: true,
|
|
330
|
+
isRequired: false,
|
|
331
|
+
transformFunction: null
|
|
332
|
+
},
|
|
333
|
+
ariaLabelledBy: {
|
|
334
|
+
classPropertyName: "ariaLabelledBy",
|
|
335
|
+
publicName: "aria-labelledby",
|
|
336
|
+
isSignal: true,
|
|
337
|
+
isRequired: false,
|
|
338
|
+
transformFunction: null
|
|
339
|
+
},
|
|
340
|
+
disabled: {
|
|
341
|
+
classPropertyName: "disabled",
|
|
342
|
+
publicName: "disabled",
|
|
343
|
+
isSignal: true,
|
|
344
|
+
isRequired: false,
|
|
345
|
+
transformFunction: null
|
|
346
|
+
},
|
|
347
|
+
disabledDates: {
|
|
348
|
+
classPropertyName: "disabledDates",
|
|
349
|
+
publicName: "disabledDates",
|
|
350
|
+
isSignal: true,
|
|
351
|
+
isRequired: false,
|
|
352
|
+
transformFunction: null
|
|
353
|
+
},
|
|
354
|
+
firstDay: {
|
|
355
|
+
classPropertyName: "firstDay",
|
|
356
|
+
publicName: "firstDay",
|
|
357
|
+
isSignal: true,
|
|
358
|
+
isRequired: false,
|
|
359
|
+
transformFunction: null
|
|
360
|
+
},
|
|
361
|
+
format: {
|
|
362
|
+
classPropertyName: "format",
|
|
363
|
+
publicName: "format",
|
|
364
|
+
isSignal: true,
|
|
365
|
+
isRequired: false,
|
|
366
|
+
transformFunction: null
|
|
367
|
+
},
|
|
368
|
+
inputId: {
|
|
369
|
+
classPropertyName: "inputId",
|
|
370
|
+
publicName: "inputId",
|
|
371
|
+
isSignal: true,
|
|
372
|
+
isRequired: false,
|
|
373
|
+
transformFunction: null
|
|
374
|
+
},
|
|
375
|
+
invalid: {
|
|
376
|
+
classPropertyName: "invalid",
|
|
377
|
+
publicName: "invalid",
|
|
378
|
+
isSignal: true,
|
|
379
|
+
isRequired: false,
|
|
380
|
+
transformFunction: null
|
|
381
|
+
},
|
|
382
|
+
max: {
|
|
383
|
+
classPropertyName: "max",
|
|
384
|
+
publicName: "max",
|
|
385
|
+
isSignal: true,
|
|
386
|
+
isRequired: false,
|
|
387
|
+
transformFunction: null
|
|
388
|
+
},
|
|
389
|
+
min: {
|
|
390
|
+
classPropertyName: "min",
|
|
391
|
+
publicName: "min",
|
|
392
|
+
isSignal: true,
|
|
393
|
+
isRequired: false,
|
|
394
|
+
transformFunction: null
|
|
395
|
+
},
|
|
396
|
+
placeholder: {
|
|
397
|
+
classPropertyName: "placeholder",
|
|
398
|
+
publicName: "placeholder",
|
|
399
|
+
isSignal: true,
|
|
400
|
+
isRequired: false,
|
|
401
|
+
transformFunction: null
|
|
402
|
+
},
|
|
403
|
+
popupClass: {
|
|
404
|
+
classPropertyName: "popupClass",
|
|
405
|
+
publicName: "popupClass",
|
|
406
|
+
isSignal: true,
|
|
407
|
+
isRequired: false,
|
|
408
|
+
transformFunction: null
|
|
409
|
+
},
|
|
410
|
+
popupHeight: {
|
|
411
|
+
classPropertyName: "popupHeight",
|
|
412
|
+
publicName: "popupHeight",
|
|
413
|
+
isSignal: true,
|
|
414
|
+
isRequired: false,
|
|
415
|
+
transformFunction: null
|
|
416
|
+
},
|
|
417
|
+
popupWidth: {
|
|
418
|
+
classPropertyName: "popupWidth",
|
|
419
|
+
publicName: "popupWidth",
|
|
420
|
+
isSignal: true,
|
|
421
|
+
isRequired: false,
|
|
422
|
+
transformFunction: null
|
|
423
|
+
},
|
|
424
|
+
readonly: {
|
|
425
|
+
classPropertyName: "readonly",
|
|
426
|
+
publicName: "readonly",
|
|
427
|
+
isSignal: true,
|
|
428
|
+
isRequired: false,
|
|
429
|
+
transformFunction: null
|
|
430
|
+
},
|
|
431
|
+
readonlyInput: {
|
|
432
|
+
classPropertyName: "readonlyInput",
|
|
433
|
+
publicName: "readonlyInput",
|
|
434
|
+
isSignal: true,
|
|
435
|
+
isRequired: false,
|
|
436
|
+
transformFunction: null
|
|
437
|
+
},
|
|
438
|
+
required: {
|
|
439
|
+
classPropertyName: "required",
|
|
440
|
+
publicName: "required",
|
|
441
|
+
isSignal: true,
|
|
442
|
+
isRequired: false,
|
|
443
|
+
transformFunction: null
|
|
444
|
+
},
|
|
445
|
+
rounded: {
|
|
446
|
+
classPropertyName: "rounded",
|
|
447
|
+
publicName: "rounded",
|
|
448
|
+
isSignal: true,
|
|
449
|
+
isRequired: false,
|
|
450
|
+
transformFunction: null
|
|
451
|
+
},
|
|
452
|
+
showClearButton: {
|
|
453
|
+
classPropertyName: "showClearButton",
|
|
454
|
+
publicName: "showClearButton",
|
|
455
|
+
isSignal: true,
|
|
456
|
+
isRequired: false,
|
|
457
|
+
transformFunction: null
|
|
458
|
+
},
|
|
459
|
+
size: {
|
|
460
|
+
classPropertyName: "size",
|
|
461
|
+
publicName: "size",
|
|
462
|
+
isSignal: true,
|
|
463
|
+
isRequired: false,
|
|
464
|
+
transformFunction: null
|
|
465
|
+
},
|
|
466
|
+
touched: {
|
|
467
|
+
classPropertyName: "touched",
|
|
468
|
+
publicName: "touched",
|
|
469
|
+
isSignal: true,
|
|
470
|
+
isRequired: false,
|
|
471
|
+
transformFunction: null
|
|
472
|
+
},
|
|
473
|
+
userClass: {
|
|
474
|
+
classPropertyName: "userClass",
|
|
475
|
+
publicName: "class",
|
|
476
|
+
isSignal: true,
|
|
477
|
+
isRequired: false,
|
|
478
|
+
transformFunction: null
|
|
479
|
+
},
|
|
480
|
+
value: {
|
|
481
|
+
classPropertyName: "value",
|
|
482
|
+
publicName: "value",
|
|
483
|
+
isSignal: true,
|
|
484
|
+
isRequired: false,
|
|
485
|
+
transformFunction: null
|
|
486
|
+
},
|
|
487
|
+
weekNumber: {
|
|
488
|
+
classPropertyName: "weekNumber",
|
|
489
|
+
publicName: "weekNumber",
|
|
490
|
+
isSignal: true,
|
|
491
|
+
isRequired: false,
|
|
492
|
+
transformFunction: null
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
outputs: {
|
|
496
|
+
close: "close",
|
|
497
|
+
closed: "closed",
|
|
498
|
+
open: "open",
|
|
499
|
+
opened: "opened",
|
|
500
|
+
touch: "touch",
|
|
501
|
+
value: "valueChange"
|
|
502
|
+
},
|
|
503
|
+
host: {
|
|
504
|
+
listeners: {
|
|
505
|
+
"focusin": "onFocusIn($event)",
|
|
506
|
+
"focusout": "onFocusOut($event)",
|
|
507
|
+
"keydown": "onKeydown($event)"
|
|
508
|
+
},
|
|
509
|
+
properties: {
|
|
510
|
+
"attr.aria-describedby": "null",
|
|
511
|
+
"attr.aria-label": "null",
|
|
512
|
+
"attr.aria-labelledby": "null",
|
|
513
|
+
"attr.tabindex": "effectiveDisabled() ? null : -1",
|
|
514
|
+
"attr.aria-invalid": "invalidState() ? 'true' : null",
|
|
515
|
+
"attr.data-disabled": "effectiveDisabled() || null",
|
|
516
|
+
"attr.data-expanded": "expanded()",
|
|
517
|
+
"attr.data-invalid": "invalidState() || null",
|
|
518
|
+
"attr.data-readonly": "readonly() || null",
|
|
519
|
+
"class": "baseClass()"
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
providers: [
|
|
523
|
+
DropdownService,
|
|
524
|
+
CalendarService,
|
|
525
|
+
{
|
|
526
|
+
provide: DROPDOWN_POPUP_INPUT_TOKEN,
|
|
527
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
528
|
+
multi: false
|
|
529
|
+
}
|
|
530
|
+
],
|
|
531
|
+
queries: [
|
|
532
|
+
{
|
|
533
|
+
propertyName: "decadeCellTemplate",
|
|
534
|
+
first: true,
|
|
535
|
+
predicate: CalendarDecadeCellTemplateDirective,
|
|
536
|
+
descendants: true,
|
|
537
|
+
isSignal: true
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
propertyName: "monthCellTemplate",
|
|
541
|
+
first: true,
|
|
542
|
+
predicate: CalendarMonthCellTemplateDirective,
|
|
543
|
+
descendants: true,
|
|
544
|
+
isSignal: true
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
propertyName: "prefixTemplate",
|
|
548
|
+
first: true,
|
|
549
|
+
predicate: DateInputPrefixTemplateDirective,
|
|
550
|
+
descendants: true,
|
|
551
|
+
read: TemplateRef,
|
|
552
|
+
isSignal: true
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
propertyName: "yearCellTemplate",
|
|
556
|
+
first: true,
|
|
557
|
+
predicate: CalendarYearCellTemplateDirective,
|
|
558
|
+
descendants: true,
|
|
559
|
+
isSignal: true
|
|
560
|
+
}
|
|
561
|
+
],
|
|
562
|
+
viewQueries: [{
|
|
563
|
+
propertyName: "popupTemplate",
|
|
564
|
+
first: true,
|
|
565
|
+
predicate: ["popupTemplate"],
|
|
566
|
+
descendants: true,
|
|
567
|
+
isSignal: true
|
|
568
|
+
}],
|
|
569
|
+
hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }],
|
|
570
|
+
ngImport: i0,
|
|
571
|
+
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n",
|
|
572
|
+
dependencies: [
|
|
573
|
+
{
|
|
574
|
+
kind: "component",
|
|
575
|
+
type: LucideCalendar,
|
|
576
|
+
selector: "svg[lucideCalendar]"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
kind: "component",
|
|
580
|
+
type: CalendarComponent,
|
|
581
|
+
selector: "mona-calendar",
|
|
582
|
+
inputs: [
|
|
583
|
+
"disabled",
|
|
584
|
+
"disabledDates",
|
|
585
|
+
"firstDay",
|
|
586
|
+
"focusOnMount",
|
|
587
|
+
"invalid",
|
|
588
|
+
"maxDate",
|
|
589
|
+
"minDate",
|
|
590
|
+
"readonly",
|
|
591
|
+
"required",
|
|
592
|
+
"rounded",
|
|
593
|
+
"selection",
|
|
594
|
+
"touched",
|
|
595
|
+
"class",
|
|
596
|
+
"value",
|
|
597
|
+
"weekNumber"
|
|
598
|
+
],
|
|
599
|
+
outputs: ["touch", "valueChange"]
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
kind: "component",
|
|
603
|
+
type: TextBoxComponent,
|
|
604
|
+
selector: "mona-text-box",
|
|
605
|
+
inputs: [
|
|
606
|
+
"aria-describedby",
|
|
607
|
+
"aria-label",
|
|
608
|
+
"aria-labelledby",
|
|
609
|
+
"clearButton",
|
|
610
|
+
"disabled",
|
|
611
|
+
"inputAttributes",
|
|
612
|
+
"inputClass",
|
|
613
|
+
"inputId",
|
|
614
|
+
"inputStyle",
|
|
615
|
+
"invalid",
|
|
616
|
+
"maxLength",
|
|
617
|
+
"minLength",
|
|
618
|
+
"name",
|
|
619
|
+
"placeholder",
|
|
620
|
+
"readonly",
|
|
621
|
+
"required",
|
|
622
|
+
"rounded",
|
|
623
|
+
"size",
|
|
624
|
+
"touched",
|
|
625
|
+
"type",
|
|
626
|
+
"class",
|
|
627
|
+
"value"
|
|
628
|
+
],
|
|
629
|
+
outputs: [
|
|
630
|
+
"inputBlur",
|
|
631
|
+
"inputFocus",
|
|
632
|
+
"touch",
|
|
633
|
+
"valueChange"
|
|
634
|
+
]
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
kind: "directive",
|
|
638
|
+
type: TextBoxSuffixTemplateDirective,
|
|
639
|
+
selector: "ng-template[monaTextBoxSuffixTemplate]"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
kind: "directive",
|
|
643
|
+
type: CalendarDecadeCellTemplateDirective,
|
|
644
|
+
selector: "ng-template[monaCalendarDecadeCellTemplate]"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
kind: "directive",
|
|
648
|
+
type: NgTemplateOutlet,
|
|
649
|
+
selector: "[ngTemplateOutlet]",
|
|
650
|
+
inputs: [
|
|
651
|
+
"ngTemplateOutletContext",
|
|
652
|
+
"ngTemplateOutlet",
|
|
653
|
+
"ngTemplateOutletInjector"
|
|
654
|
+
]
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
kind: "directive",
|
|
658
|
+
type: CalendarMonthCellTemplateDirective,
|
|
659
|
+
selector: "ng-template[monaCalendarMonthCellTemplate]"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
kind: "directive",
|
|
663
|
+
type: CalendarYearCellTemplateDirective,
|
|
664
|
+
selector: "ng-template[monaCalendarYearCellTemplate]"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
kind: "directive",
|
|
668
|
+
type: TextBoxPrefixTemplateDirective,
|
|
669
|
+
selector: "ng-template[monaTextBoxPrefixTemplate]"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
kind: "directive",
|
|
673
|
+
type: ButtonDirective,
|
|
674
|
+
selector: "button[monaButton]",
|
|
675
|
+
inputs: [
|
|
676
|
+
"aria-haspopup",
|
|
677
|
+
"disabled",
|
|
678
|
+
"iconOnly",
|
|
679
|
+
"loading",
|
|
680
|
+
"look",
|
|
681
|
+
"rounded",
|
|
682
|
+
"selected",
|
|
683
|
+
"size",
|
|
684
|
+
"tabindex",
|
|
685
|
+
"toggleable",
|
|
686
|
+
"type",
|
|
687
|
+
"class",
|
|
688
|
+
"value"
|
|
689
|
+
],
|
|
690
|
+
outputs: ["lookChange", "selectedChange"]
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
kind: "directive",
|
|
694
|
+
type: CdkTrapFocus,
|
|
695
|
+
selector: "[cdkTrapFocus]",
|
|
696
|
+
inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
|
|
697
|
+
exportAs: ["cdkTrapFocus"]
|
|
698
|
+
}
|
|
699
|
+
]
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
704
|
+
minVersion: "12.0.0",
|
|
705
|
+
version: "22.2.6",
|
|
706
|
+
ngImport: i0,
|
|
707
|
+
type: DatePickerComponent,
|
|
708
|
+
decorators: [{
|
|
709
|
+
type: Component,
|
|
710
|
+
args: [{
|
|
711
|
+
selector: "mona-date-picker",
|
|
712
|
+
providers: [
|
|
713
|
+
DropdownService,
|
|
714
|
+
CalendarService,
|
|
715
|
+
{
|
|
716
|
+
provide: DROPDOWN_POPUP_INPUT_TOKEN,
|
|
717
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
718
|
+
multi: false
|
|
719
|
+
}
|
|
720
|
+
],
|
|
721
|
+
imports: [
|
|
722
|
+
LucideCalendar,
|
|
723
|
+
CalendarComponent,
|
|
724
|
+
TextBoxComponent,
|
|
725
|
+
TextBoxSuffixTemplateDirective,
|
|
726
|
+
CalendarDecadeCellTemplateDirective,
|
|
727
|
+
NgTemplateOutlet,
|
|
728
|
+
CalendarMonthCellTemplateDirective,
|
|
729
|
+
CalendarYearCellTemplateDirective,
|
|
730
|
+
TextBoxPrefixTemplateDirective,
|
|
731
|
+
ButtonDirective,
|
|
732
|
+
CdkTrapFocus
|
|
733
|
+
],
|
|
734
|
+
hostDirectives: [DropdownPopupHandlerDirective],
|
|
735
|
+
host: {
|
|
736
|
+
"[attr.aria-describedby]": "null",
|
|
737
|
+
"[attr.aria-label]": "null",
|
|
738
|
+
"[attr.aria-labelledby]": "null",
|
|
739
|
+
"[attr.tabindex]": "effectiveDisabled() ? null : -1",
|
|
740
|
+
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
741
|
+
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
742
|
+
"[attr.data-expanded]": "expanded()",
|
|
743
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
744
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
745
|
+
"[class]": "baseClass()",
|
|
746
|
+
"(focusin)": "onFocusIn($event)",
|
|
747
|
+
"(focusout)": "onFocusOut($event)",
|
|
748
|
+
"(keydown)": "onKeydown($event)"
|
|
749
|
+
},
|
|
750
|
+
template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n"
|
|
751
|
+
}]
|
|
752
|
+
}],
|
|
753
|
+
ctorParameters: () => [],
|
|
754
|
+
propDecorators: {
|
|
755
|
+
decadeCellTemplate: [{
|
|
756
|
+
type: i0.ContentChild,
|
|
757
|
+
args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }]
|
|
758
|
+
}],
|
|
759
|
+
monthCellTemplate: [{
|
|
760
|
+
type: i0.ContentChild,
|
|
761
|
+
args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }]
|
|
762
|
+
}],
|
|
763
|
+
popupTemplate: [{
|
|
764
|
+
type: i0.ViewChild,
|
|
765
|
+
args: ["popupTemplate", { isSignal: true }]
|
|
766
|
+
}],
|
|
767
|
+
prefixTemplate: [{
|
|
768
|
+
type: i0.ContentChild,
|
|
769
|
+
args: [i0.forwardRef(() => DateInputPrefixTemplateDirective), {
|
|
770
|
+
read: TemplateRef,
|
|
771
|
+
isSignal: true
|
|
772
|
+
}]
|
|
773
|
+
}],
|
|
774
|
+
yearCellTemplate: [{
|
|
775
|
+
type: i0.ContentChild,
|
|
776
|
+
args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }]
|
|
777
|
+
}],
|
|
778
|
+
ariaDescribedBy: [{
|
|
779
|
+
type: i0.Input,
|
|
780
|
+
args: [{
|
|
781
|
+
isSignal: true,
|
|
782
|
+
alias: "aria-describedby",
|
|
783
|
+
required: false
|
|
784
|
+
}]
|
|
785
|
+
}],
|
|
786
|
+
ariaLabel: [{
|
|
787
|
+
type: i0.Input,
|
|
788
|
+
args: [{
|
|
789
|
+
isSignal: true,
|
|
790
|
+
alias: "aria-label",
|
|
791
|
+
required: false
|
|
792
|
+
}]
|
|
793
|
+
}],
|
|
794
|
+
ariaLabelledBy: [{
|
|
795
|
+
type: i0.Input,
|
|
796
|
+
args: [{
|
|
797
|
+
isSignal: true,
|
|
798
|
+
alias: "aria-labelledby",
|
|
799
|
+
required: false
|
|
800
|
+
}]
|
|
801
|
+
}],
|
|
802
|
+
close: [{
|
|
803
|
+
type: i0.Output,
|
|
804
|
+
args: ["close"]
|
|
805
|
+
}],
|
|
806
|
+
closed: [{
|
|
807
|
+
type: i0.Output,
|
|
808
|
+
args: ["closed"]
|
|
809
|
+
}],
|
|
810
|
+
disabled: [{
|
|
811
|
+
type: i0.Input,
|
|
812
|
+
args: [{
|
|
813
|
+
isSignal: true,
|
|
814
|
+
alias: "disabled",
|
|
815
|
+
required: false
|
|
816
|
+
}]
|
|
817
|
+
}],
|
|
818
|
+
disabledDates: [{
|
|
819
|
+
type: i0.Input,
|
|
820
|
+
args: [{
|
|
821
|
+
isSignal: true,
|
|
822
|
+
alias: "disabledDates",
|
|
823
|
+
required: false
|
|
824
|
+
}]
|
|
825
|
+
}],
|
|
826
|
+
firstDay: [{
|
|
827
|
+
type: i0.Input,
|
|
828
|
+
args: [{
|
|
829
|
+
isSignal: true,
|
|
830
|
+
alias: "firstDay",
|
|
831
|
+
required: false
|
|
832
|
+
}]
|
|
833
|
+
}],
|
|
834
|
+
format: [{
|
|
835
|
+
type: i0.Input,
|
|
836
|
+
args: [{
|
|
837
|
+
isSignal: true,
|
|
838
|
+
alias: "format",
|
|
839
|
+
required: false
|
|
840
|
+
}]
|
|
841
|
+
}],
|
|
842
|
+
inputId: [{
|
|
843
|
+
type: i0.Input,
|
|
844
|
+
args: [{
|
|
845
|
+
isSignal: true,
|
|
846
|
+
alias: "inputId",
|
|
847
|
+
required: false
|
|
848
|
+
}]
|
|
849
|
+
}],
|
|
850
|
+
invalid: [{
|
|
851
|
+
type: i0.Input,
|
|
852
|
+
args: [{
|
|
853
|
+
isSignal: true,
|
|
854
|
+
alias: "invalid",
|
|
855
|
+
required: false
|
|
856
|
+
}]
|
|
857
|
+
}],
|
|
858
|
+
max: [{
|
|
859
|
+
type: i0.Input,
|
|
860
|
+
args: [{
|
|
861
|
+
isSignal: true,
|
|
862
|
+
alias: "max",
|
|
863
|
+
required: false
|
|
864
|
+
}]
|
|
865
|
+
}],
|
|
866
|
+
min: [{
|
|
867
|
+
type: i0.Input,
|
|
868
|
+
args: [{
|
|
869
|
+
isSignal: true,
|
|
870
|
+
alias: "min",
|
|
871
|
+
required: false
|
|
872
|
+
}]
|
|
873
|
+
}],
|
|
874
|
+
open: [{
|
|
875
|
+
type: i0.Output,
|
|
876
|
+
args: ["open"]
|
|
877
|
+
}],
|
|
878
|
+
opened: [{
|
|
879
|
+
type: i0.Output,
|
|
880
|
+
args: ["opened"]
|
|
881
|
+
}],
|
|
882
|
+
placeholder: [{
|
|
883
|
+
type: i0.Input,
|
|
884
|
+
args: [{
|
|
885
|
+
isSignal: true,
|
|
886
|
+
alias: "placeholder",
|
|
887
|
+
required: false
|
|
888
|
+
}]
|
|
889
|
+
}],
|
|
890
|
+
popupClass: [{
|
|
891
|
+
type: i0.Input,
|
|
892
|
+
args: [{
|
|
893
|
+
isSignal: true,
|
|
894
|
+
alias: "popupClass",
|
|
895
|
+
required: false
|
|
896
|
+
}]
|
|
897
|
+
}],
|
|
898
|
+
popupHeight: [{
|
|
899
|
+
type: i0.Input,
|
|
900
|
+
args: [{
|
|
901
|
+
isSignal: true,
|
|
902
|
+
alias: "popupHeight",
|
|
903
|
+
required: false
|
|
904
|
+
}]
|
|
905
|
+
}],
|
|
906
|
+
popupWidth: [{
|
|
907
|
+
type: i0.Input,
|
|
908
|
+
args: [{
|
|
909
|
+
isSignal: true,
|
|
910
|
+
alias: "popupWidth",
|
|
911
|
+
required: false
|
|
912
|
+
}]
|
|
913
|
+
}],
|
|
914
|
+
readonly: [{
|
|
915
|
+
type: i0.Input,
|
|
916
|
+
args: [{
|
|
917
|
+
isSignal: true,
|
|
918
|
+
alias: "readonly",
|
|
919
|
+
required: false
|
|
920
|
+
}]
|
|
921
|
+
}],
|
|
922
|
+
readonlyInput: [{
|
|
923
|
+
type: i0.Input,
|
|
924
|
+
args: [{
|
|
925
|
+
isSignal: true,
|
|
926
|
+
alias: "readonlyInput",
|
|
927
|
+
required: false
|
|
928
|
+
}]
|
|
929
|
+
}],
|
|
930
|
+
required: [{
|
|
931
|
+
type: i0.Input,
|
|
932
|
+
args: [{
|
|
933
|
+
isSignal: true,
|
|
934
|
+
alias: "required",
|
|
935
|
+
required: false
|
|
936
|
+
}]
|
|
937
|
+
}],
|
|
938
|
+
rounded: [{
|
|
939
|
+
type: i0.Input,
|
|
940
|
+
args: [{
|
|
941
|
+
isSignal: true,
|
|
942
|
+
alias: "rounded",
|
|
943
|
+
required: false
|
|
944
|
+
}]
|
|
945
|
+
}],
|
|
946
|
+
showClearButton: [{
|
|
947
|
+
type: i0.Input,
|
|
948
|
+
args: [{
|
|
949
|
+
isSignal: true,
|
|
950
|
+
alias: "showClearButton",
|
|
951
|
+
required: false
|
|
952
|
+
}]
|
|
953
|
+
}],
|
|
954
|
+
size: [{
|
|
955
|
+
type: i0.Input,
|
|
956
|
+
args: [{
|
|
957
|
+
isSignal: true,
|
|
958
|
+
alias: "size",
|
|
959
|
+
required: false
|
|
960
|
+
}]
|
|
961
|
+
}],
|
|
962
|
+
touch: [{
|
|
963
|
+
type: i0.Output,
|
|
964
|
+
args: ["touch"]
|
|
965
|
+
}],
|
|
966
|
+
touched: [{
|
|
967
|
+
type: i0.Input,
|
|
968
|
+
args: [{
|
|
969
|
+
isSignal: true,
|
|
970
|
+
alias: "touched",
|
|
971
|
+
required: false
|
|
972
|
+
}]
|
|
973
|
+
}],
|
|
974
|
+
userClass: [{
|
|
975
|
+
type: i0.Input,
|
|
976
|
+
args: [{
|
|
977
|
+
isSignal: true,
|
|
978
|
+
alias: "class",
|
|
979
|
+
required: false
|
|
980
|
+
}]
|
|
981
|
+
}],
|
|
982
|
+
value: [{
|
|
983
|
+
type: i0.Input,
|
|
984
|
+
args: [{
|
|
985
|
+
isSignal: true,
|
|
986
|
+
alias: "value",
|
|
987
|
+
required: false
|
|
988
|
+
}]
|
|
989
|
+
}, {
|
|
990
|
+
type: i0.Output,
|
|
991
|
+
args: ["valueChange"]
|
|
992
|
+
}],
|
|
993
|
+
weekNumber: [{
|
|
994
|
+
type: i0.Input,
|
|
995
|
+
args: [{
|
|
996
|
+
isSignal: true,
|
|
997
|
+
alias: "weekNumber",
|
|
998
|
+
required: false
|
|
999
|
+
}]
|
|
1000
|
+
}]
|
|
1001
|
+
}
|
|
77
1002
|
});
|
|
78
|
-
|
|
79
|
-
class DatePickerComponent {
|
|
80
|
-
#calendarService;
|
|
81
|
-
#destroyRef;
|
|
82
|
-
#dropdownService;
|
|
83
|
-
#hostElementRef;
|
|
84
|
-
#i18n;
|
|
85
|
-
constructor() {
|
|
86
|
-
this.#calendarService = inject(CalendarService);
|
|
87
|
-
this.#destroyRef = inject(DestroyRef);
|
|
88
|
-
this.#dropdownService = inject(DropdownService);
|
|
89
|
-
this.#hostElementRef = inject(ElementRef);
|
|
90
|
-
this.#i18n = inject(MonaI18nService);
|
|
91
|
-
this.baseClass = computed(() => {
|
|
92
|
-
const focused = this.#dropdownService.popupRef() != null;
|
|
93
|
-
const rounded = this.rounded();
|
|
94
|
-
const size = this.size();
|
|
95
|
-
const variantClass = datePickerBaseThemeVariants({ focused, rounded, size });
|
|
96
|
-
const userClass = this.userClass();
|
|
97
|
-
return twMerge(variantClass, userClass);
|
|
98
|
-
}, /* @ts-ignore */
|
|
99
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
100
|
-
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, /* @ts-ignore */
|
|
101
|
-
...(ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []));
|
|
102
|
-
this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
|
|
103
|
-
this.effectiveFormat = computed(() => {
|
|
104
|
-
return this.format() ?? getLocaleDateInputFormat(this.#i18n.localeId());
|
|
105
|
-
}, /* @ts-ignore */
|
|
106
|
-
...(ngDevMode ? [{ debugName: "effectiveFormat" }] : /* istanbul ignore next */ []));
|
|
107
|
-
this.expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
|
|
108
|
-
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
109
|
-
this.inputAttributes = computed(() => {
|
|
110
|
-
return {
|
|
111
|
-
"aria-autocomplete": "none",
|
|
112
|
-
"aria-controls": this.popupId,
|
|
113
|
-
// The binder drops `false`, and a combobox must always say whether it's expanded.
|
|
114
|
-
"aria-expanded": this.expanded() ? "true" : "false",
|
|
115
|
-
"aria-haspopup": "dialog",
|
|
116
|
-
// The text box hides its clear button when read-only, so typing is blocked here instead.
|
|
117
|
-
readonly: this.readonly() || this.readonlyInput(),
|
|
118
|
-
role: "combobox"
|
|
119
|
-
};
|
|
120
|
-
}, /* @ts-ignore */
|
|
121
|
-
...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
|
|
122
|
-
this.invalidState = computed(() => this.typedInput.errors().length > 0 ||
|
|
123
|
-
(this.touched() && (this.invalid() || (this.required() && !this.value()))), /* @ts-ignore */
|
|
124
|
-
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
125
|
-
this.messages = this.#i18n.componentMessages("datePicker", DATE_PICKER_DEFAULT_MESSAGES);
|
|
126
|
-
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, /* @ts-ignore */
|
|
127
|
-
...(ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []));
|
|
128
|
-
this.pickerPopupClass = computed(() => {
|
|
129
|
-
const rounded = this.rounded();
|
|
130
|
-
const size = this.size();
|
|
131
|
-
const userClass = this.popupClass();
|
|
132
|
-
const variantClass = datePopupThemeVariants({ rounded, size });
|
|
133
|
-
return twMerge(variantClass, userClass);
|
|
134
|
-
}, /* @ts-ignore */
|
|
135
|
-
...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
|
|
136
|
-
this.popupId = createElementControlId();
|
|
137
|
-
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
138
|
-
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
139
|
-
this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
140
|
-
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
|
|
141
|
-
...(ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []));
|
|
142
|
-
/**
|
|
143
|
-
* @description Id of an element that describes the input, such as a hint or an error message.
|
|
144
|
-
* @default ""
|
|
145
|
-
*/
|
|
146
|
-
this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
|
|
147
|
-
/**
|
|
148
|
-
* @description Accessible name of the input. Prefer a visible label, linked through {@link inputId} or
|
|
149
|
-
* `aria-labelledby`; the placeholder is not a label.
|
|
150
|
-
* @default ""
|
|
151
|
-
*/
|
|
152
|
-
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
153
|
-
/**
|
|
154
|
-
* @description Id of the element that labels the input.
|
|
155
|
-
* @default ""
|
|
156
|
-
*/
|
|
157
|
-
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
158
|
-
/**
|
|
159
|
-
* @description Emits when the popup is about to close. This event is preventable.
|
|
160
|
-
*/
|
|
161
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
162
|
-
this.close = output();
|
|
163
|
-
/**
|
|
164
|
-
* @description Emits after the popup is closed.
|
|
165
|
-
*/
|
|
166
|
-
this.closed = output();
|
|
167
|
-
/**
|
|
168
|
-
* @description Sets the disabled state of the date picker.
|
|
169
|
-
* @default false
|
|
170
|
-
*/
|
|
171
|
-
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
172
|
-
/**
|
|
173
|
-
* @description Sets the disabled dates of the date picker.
|
|
174
|
-
* Accepts either an iterable of Date objects or a predicate function. Typing a disabled date is reported as a
|
|
175
|
-
* `disabledDate` error instead of setting the value.
|
|
176
|
-
*/
|
|
177
|
-
this.disabledDates = input(/* @ts-ignore */
|
|
178
|
-
...(ngDevMode ? [undefined, { debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
179
|
-
/**
|
|
180
|
-
* @description Sets the first day of the week. If not specified, derives from the active locale.
|
|
181
|
-
* @default null
|
|
182
|
-
*/
|
|
183
|
-
this.firstDay = input(null, /* @ts-ignore */
|
|
184
|
-
...(ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []));
|
|
185
|
-
/**
|
|
186
|
-
* @description Sets the date format of the date picker. If not specified, derives from the active locale.
|
|
187
|
-
* Typed text is also accepted with one-digit days and months and a two-digit year.
|
|
188
|
-
* @default null
|
|
189
|
-
*/
|
|
190
|
-
this.format = input(null, /* @ts-ignore */
|
|
191
|
-
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
192
|
-
/**
|
|
193
|
-
* @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
|
|
194
|
-
* date picker. A unique id is generated when it isn't set.
|
|
195
|
-
* @default generated
|
|
196
|
-
*/
|
|
197
|
-
this.inputId = input(createElementControlId(), /* @ts-ignore */
|
|
198
|
-
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
199
|
-
/**
|
|
200
|
-
* @description Marks the date picker as invalid. When bound to a signal form field via `[formField]`,
|
|
201
|
-
* this is written by the `FormField` directive.
|
|
202
|
-
* @default false
|
|
203
|
-
*/
|
|
204
|
-
this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
205
|
-
/**
|
|
206
|
-
* @description Sets the maximum date of the date picker. A later typed date is reported as a `maxDate` error.
|
|
207
|
-
*/
|
|
208
|
-
this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
|
|
209
|
-
/**
|
|
210
|
-
* @description Sets the minimum date of the date picker. An earlier typed date is reported as a `minDate` error.
|
|
211
|
-
*/
|
|
212
|
-
this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
|
|
213
|
-
/**
|
|
214
|
-
* @description Emits when the popup is about to open. This event is preventable.
|
|
215
|
-
*/
|
|
216
|
-
this.open = output();
|
|
217
|
-
/**
|
|
218
|
-
* @description Emits after the popup is opened.
|
|
219
|
-
*/
|
|
220
|
-
this.opened = output();
|
|
221
|
-
/**
|
|
222
|
-
* @description Sets the placeholder of the date picker.
|
|
223
|
-
*/
|
|
224
|
-
this.placeholder = input("", /* @ts-ignore */
|
|
225
|
-
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
226
|
-
/**
|
|
227
|
-
* @description Sets the class of the popup element.
|
|
228
|
-
* @default ""
|
|
229
|
-
*/
|
|
230
|
-
this.popupClass = input("", /* @ts-ignore */
|
|
231
|
-
...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
|
|
232
|
-
/**
|
|
233
|
-
* @description Sets the height of the popup element. When empty, the popup fits the calendar.
|
|
234
|
-
* @default ""
|
|
235
|
-
*/
|
|
236
|
-
this.popupHeight = input("", /* @ts-ignore */
|
|
237
|
-
...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
|
|
238
|
-
/**
|
|
239
|
-
* @description Sets the width of the popup element. When empty, the popup fits the calendar.
|
|
240
|
-
* @default ""
|
|
241
|
-
*/
|
|
242
|
-
this.popupWidth = input("", /* @ts-ignore */
|
|
243
|
-
...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
|
|
244
|
-
/**
|
|
245
|
-
* @description Sets the readonly state of the date picker.
|
|
246
|
-
* @default false
|
|
247
|
-
*/
|
|
248
|
-
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
249
|
-
/**
|
|
250
|
-
* @description When true, the input is readonly but the calendar button remains enabled.
|
|
251
|
-
* @default false
|
|
252
|
-
*/
|
|
253
|
-
this.readonlyInput = input(false, { ...(ngDevMode ? { debugName: "readonlyInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
254
|
-
/**
|
|
255
|
-
* @description Sets the required state of the date picker.
|
|
256
|
-
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
257
|
-
* @default false
|
|
258
|
-
*/
|
|
259
|
-
this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
260
|
-
/**
|
|
261
|
-
* @description Sets the border radius of the date picker.
|
|
262
|
-
*/
|
|
263
|
-
this.rounded = input("medium", /* @ts-ignore */
|
|
264
|
-
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
265
|
-
/**
|
|
266
|
-
* @description Sets the visibility of the clear button. Clearing empties the value at once.
|
|
267
|
-
* @default false
|
|
268
|
-
*/
|
|
269
|
-
this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
270
|
-
/**
|
|
271
|
-
* @description Sets the size of the date picker.
|
|
272
|
-
*/
|
|
273
|
-
this.size = input("medium", /* @ts-ignore */
|
|
274
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
275
|
-
/**
|
|
276
|
-
* @description Emitted when focus leaves the date picker and its popup.
|
|
277
|
-
* The `FormField` directive listens to this to mark the field as touched.
|
|
278
|
-
*/
|
|
279
|
-
this.touch = output();
|
|
280
|
-
/**
|
|
281
|
-
* @description Sets the touched state of the date picker. When bound to a signal form field via `[formField]`,
|
|
282
|
-
* this is written by the `FormField` directive.
|
|
283
|
-
* @default false
|
|
284
|
-
*/
|
|
285
|
-
this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
286
|
-
/** @description Extra classes for the input's container. */
|
|
287
|
-
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
288
|
-
/**
|
|
289
|
-
* @description Two-way bindable current date value. Typed text is written on Enter and when the input loses
|
|
290
|
-
* focus; text that isn't a valid date keeps the previous value and marks the field invalid.
|
|
291
|
-
* @default null
|
|
292
|
-
*/
|
|
293
|
-
this.value = model(null, /* @ts-ignore */
|
|
294
|
-
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
295
|
-
/**
|
|
296
|
-
* @description Enables the display of week numbers in the calendar.
|
|
297
|
-
* @default false
|
|
298
|
-
*/
|
|
299
|
-
this.weekNumber = input(false, { ...(ngDevMode ? { debugName: "weekNumber" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
300
|
-
this.typedInput = createTypedDateInput({
|
|
301
|
-
constraints: () => ({ disabledDates: this.disabledDates(), max: this.max(), min: this.min(), unit: "date" }),
|
|
302
|
-
format: () => this.effectiveFormat(),
|
|
303
|
-
localeId: () => this.#i18n.localeId(),
|
|
304
|
-
value: this.value
|
|
305
|
-
});
|
|
306
|
-
effect(() => {
|
|
307
|
-
const popupTemplate = this.popupTemplate();
|
|
308
|
-
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
309
|
-
});
|
|
310
|
-
afterNextRender({
|
|
311
|
-
read: () => {
|
|
312
|
-
this.setCalendarKeyboardSubscription();
|
|
313
|
-
this.setPopupCloseSubscription();
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Focuses the input and places the caret after the text. Read-only pickers take focus too.
|
|
319
|
-
* @param options Options passed to the native `focus()` call, such as `preventScroll`.
|
|
320
|
-
*/
|
|
321
|
-
focus(options) {
|
|
322
|
-
const input = this.#hostElementRef.nativeElement.querySelector("input");
|
|
323
|
-
if (input) {
|
|
324
|
-
input.focus(options);
|
|
325
|
-
input.setSelectionRange(input.value.length, input.value.length);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
onCalendarValueChange(date) {
|
|
329
|
-
const singleDate = Array.isArray(date) ? null : date;
|
|
330
|
-
this.value.set(singleDate ? new Date(singleDate) : null);
|
|
331
|
-
this.closePopup();
|
|
332
|
-
}
|
|
333
|
-
onDateInputButtonClick() {
|
|
334
|
-
const popupRef = this.#dropdownService.popupRef();
|
|
335
|
-
if (!this.popupTemplate() || this.effectiveDisabled() || this.readonly()) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
if (popupRef) {
|
|
339
|
-
popupRef.close();
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
this.openPopup();
|
|
343
|
-
}
|
|
344
|
-
onFocusIn(event) {
|
|
345
|
-
// The host is focusable only to pass focus on; focus inside it, such as a click in the text, stays put.
|
|
346
|
-
if (event.target === this.#hostElementRef.nativeElement) {
|
|
347
|
-
this.focus();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
onFocusOut(event) {
|
|
351
|
-
// Removing a focused picker from the page fires focusout after it is destroyed.
|
|
352
|
-
if (this.#destroyRef.destroyed) {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
const nextTarget = event.relatedTarget;
|
|
356
|
-
if (nextTarget instanceof Node) {
|
|
357
|
-
const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
|
|
358
|
-
if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
this.touch.emit();
|
|
363
|
-
}
|
|
364
|
-
onInputBlur() {
|
|
365
|
-
this.typedInput.commit();
|
|
366
|
-
}
|
|
367
|
-
onKeydown(event) {
|
|
368
|
-
if (this.effectiveDisabled() || this.readonly()) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
if (event.altKey && event.key === "ArrowDown") {
|
|
372
|
-
event.preventDefault();
|
|
373
|
-
this.openPopup();
|
|
374
|
-
}
|
|
375
|
-
else if ((event.altKey && event.key === "ArrowUp") || event.key === "Escape") {
|
|
376
|
-
if (this.expanded()) {
|
|
377
|
-
event.preventDefault();
|
|
378
|
-
this.closePopup();
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
else if (event.key === "Enter" && event.target instanceof HTMLInputElement) {
|
|
382
|
-
// Committed before a surrounding form submits; an IME uses Enter to confirm its text.
|
|
383
|
-
if (!event.isComposing && event.keyCode !== 229) {
|
|
384
|
-
this.typedInput.commit();
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
closePopup() {
|
|
389
|
-
this.#dropdownService.popupRef()?.close();
|
|
390
|
-
}
|
|
391
|
-
openPopup() {
|
|
392
|
-
if (!this.#dropdownService.popupRef()) {
|
|
393
|
-
this.#dropdownService.triggerPopupOpen$.next({
|
|
394
|
-
height: this.popupHeight() || "auto",
|
|
395
|
-
maxHeight: "auto",
|
|
396
|
-
width: this.popupWidth() || "auto",
|
|
397
|
-
closeOnScroll: false,
|
|
398
|
-
withScrollTracking: true
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
setCalendarKeyboardSubscription() {
|
|
403
|
-
this.#calendarService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
404
|
-
const keyboardEvent = event.originalEvent;
|
|
405
|
-
if (keyboardEvent &&
|
|
406
|
-
(keyboardEvent.key === "Escape" || (keyboardEvent.altKey && keyboardEvent.key === "ArrowUp"))) {
|
|
407
|
-
keyboardEvent.preventDefault();
|
|
408
|
-
this.closePopup();
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
setPopupCloseSubscription() {
|
|
413
|
-
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
414
|
-
if (this.#dropdownService.focusCanReturn()) {
|
|
415
|
-
this.focus();
|
|
416
|
-
}
|
|
417
|
-
else if (!this.#destroyRef.destroyed) {
|
|
418
|
-
// Focus left from inside the popup, which the host's focusout doesn't see.
|
|
419
|
-
this.touch.emit();
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
424
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DatePickerComponent, isStandalone: true, selector: "mona-date-picker", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, 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 }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, readonlyInput: { classPropertyName: "readonlyInput", publicName: "readonlyInput", 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 }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", 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: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)", "keydown": "onKeydown($event)" }, properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.tabindex": "effectiveDisabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "class": "baseClass()" } }, providers: [
|
|
425
|
-
DropdownService,
|
|
426
|
-
CalendarService,
|
|
427
|
-
{
|
|
428
|
-
provide: DROPDOWN_POPUP_INPUT_TOKEN,
|
|
429
|
-
useExisting: forwardRef(() => DatePickerComponent),
|
|
430
|
-
multi: false
|
|
431
|
-
}
|
|
432
|
-
], queries: [{ propertyName: "decadeCellTemplate", first: true, predicate: CalendarDecadeCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "monthCellTemplate", first: true, predicate: CalendarMonthCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DateInputPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "yearCellTemplate", first: true, predicate: CalendarYearCellTemplateDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }], ngImport: i0, template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideCalendar, selector: "svg[lucideCalendar]" }, { kind: "component", type: CalendarComponent, selector: "mona-calendar", inputs: ["disabled", "disabledDates", "firstDay", "focusOnMount", "invalid", "maxDate", "minDate", "readonly", "required", "rounded", "selection", "touched", "class", "value", "weekNumber"], outputs: ["touch", "valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "directive", type: CalendarDecadeCellTemplateDirective, selector: "ng-template[monaCalendarDecadeCellTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CalendarMonthCellTemplateDirective, selector: "ng-template[monaCalendarMonthCellTemplate]" }, { kind: "directive", type: CalendarYearCellTemplateDirective, selector: "ng-template[monaCalendarYearCellTemplate]" }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { 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: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] }); }
|
|
433
|
-
}
|
|
434
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
435
|
-
type: Component,
|
|
436
|
-
args: [{ selector: "mona-date-picker", providers: [
|
|
437
|
-
DropdownService,
|
|
438
|
-
CalendarService,
|
|
439
|
-
{
|
|
440
|
-
provide: DROPDOWN_POPUP_INPUT_TOKEN,
|
|
441
|
-
useExisting: forwardRef(() => DatePickerComponent),
|
|
442
|
-
multi: false
|
|
443
|
-
}
|
|
444
|
-
], imports: [
|
|
445
|
-
LucideCalendar,
|
|
446
|
-
CalendarComponent,
|
|
447
|
-
TextBoxComponent,
|
|
448
|
-
TextBoxSuffixTemplateDirective,
|
|
449
|
-
CalendarDecadeCellTemplateDirective,
|
|
450
|
-
NgTemplateOutlet,
|
|
451
|
-
CalendarMonthCellTemplateDirective,
|
|
452
|
-
CalendarYearCellTemplateDirective,
|
|
453
|
-
TextBoxPrefixTemplateDirective,
|
|
454
|
-
ButtonDirective,
|
|
455
|
-
CdkTrapFocus
|
|
456
|
-
], hostDirectives: [DropdownPopupHandlerDirective], host: {
|
|
457
|
-
// The ARIA inputs below are applied to the inner input, so the host must not keep the static attributes.
|
|
458
|
-
"[attr.aria-describedby]": "null",
|
|
459
|
-
"[attr.aria-label]": "null",
|
|
460
|
-
"[attr.aria-labelledby]": "null",
|
|
461
|
-
"[attr.tabindex]": "effectiveDisabled() ? null : -1",
|
|
462
|
-
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
463
|
-
"[attr.data-disabled]": "effectiveDisabled() || null",
|
|
464
|
-
"[attr.data-expanded]": "expanded()",
|
|
465
|
-
"[attr.data-invalid]": "invalidState() || null",
|
|
466
|
-
"[attr.data-readonly]": "readonly() || null",
|
|
467
|
-
"[class]": "baseClass()",
|
|
468
|
-
"(focusin)": "onFocusIn($event)",
|
|
469
|
-
"(focusout)": "onFocusOut($event)",
|
|
470
|
-
"(keydown)": "onKeydown($event)"
|
|
471
|
-
}, template: "<mona-text-box\n (inputBlur)=\"onInputBlur()\"\n (valueChange)=\"typedInput.edit($event)\"\n [aria-describedby]=\"ariaDescribedBy()\"\n [aria-label]=\"ariaLabel()\"\n [aria-labelledby]=\"ariaLabelledBy()\"\n [disabled]=\"effectiveDisabled()\"\n [inputId]=\"inputId()\"\n [value]=\"typedInput.text()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalidState()\"\n [required]=\"required()\"\n [clearButton]=\"showClearButton()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"invalidState() || touched()\">\n @if (prefixTemplate()) {\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </ng-template>\n }\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [rounded]=\"'none'\"\n [size]=\"size()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"messages().openCalendar\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"effectiveDisabled() || readonly()\"\n [tabindex]=\"-1\"\n (click)=\"onDateInputButtonClick()\">\n <svg lucideCalendar [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #popupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().datePicker\"\n cdkTrapFocus>\n <mona-calendar\n focusOnMount\n [disabledDates]=\"disabledDates()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n [readonly]=\"readonly()\"\n [rounded]=\"rounded()\"\n [weekNumber]=\"weekNumber()\"\n [firstDay]=\"firstDay()\"\n [value]=\"value()\"\n (valueChange)=\"onCalendarValueChange($event)\">\n @if (decadeCellTemplate()) {\n <ng-template monaCalendarDecadeCellTemplate let-year>\n <ng-container\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\n </ng-template>\n }\n @if (monthCellTemplate()) {\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\n <ng-container\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\n </ng-template>\n }\n @if (yearCellTemplate()) {\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\n <ng-container\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\n </ng-template>\n }\n </mona-calendar>\n </div>\n</ng-template>\n" }]
|
|
472
|
-
}], ctorParameters: () => [], propDecorators: { decadeCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarDecadeCellTemplateDirective), { isSignal: true }] }], monthCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarMonthCellTemplateDirective), { isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DateInputPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], yearCellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CalendarYearCellTemplateDirective), { isSignal: true }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: false }] }], firstDay: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDay", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], readonlyInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonlyInput", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", 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 }] }] } });
|
|
473
|
-
|
|
474
|
-
/*
|
|
475
|
-
* Public API Surface of @nanahoshi/mona-ui/date-picker
|
|
476
|
-
*/
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Generated bundle index. Do not edit.
|
|
480
|
-
*/
|
|
481
|
-
|
|
482
1003
|
export { DATE_PICKER_DEFAULT_MESSAGES, DatePickerComponent };
|
|
483
|
-
|
|
1004
|
+
|
|
1005
|
+
//# sourceMappingURL=nanahoshi-mona-ui-date-picker.mjs.map
|