@nanahoshi/mona-ui 0.1.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 +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, DestroyRef, ElementRef, computed, linkedSignal, contentChild, viewChild, TemplateRef, output, input, model, effect, untracked, afterNextRender, forwardRef, Component } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
7
|
+
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
|
+
import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective, CalendarComponent } from '@nanahoshi/mona-ui/calendar';
|
|
9
|
+
import { CalendarService, datePopupThemeVariants, DateInputPrefixTemplateDirective } from '@nanahoshi/mona-ui/date-input';
|
|
10
|
+
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
11
|
+
import { DropdownService, DropdownPopupInputToken, DropdownPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
12
|
+
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
13
|
+
import { TextBoxComponent, TextBoxSuffixTemplateDirective, TextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
|
|
14
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
15
|
+
import { any } from '@mirei/ts-collections';
|
|
16
|
+
import { DateTime } from 'luxon';
|
|
17
|
+
import { fromEvent } from 'rxjs';
|
|
18
|
+
import { twMerge } from 'tailwind-merge';
|
|
19
|
+
import { cva } from 'class-variance-authority';
|
|
20
|
+
|
|
21
|
+
const datePickerBaseVariants = cva(`
|
|
22
|
+
flex items-center w-auto
|
|
23
|
+
border border-border
|
|
24
|
+
focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary
|
|
25
|
+
data-[invalid='true']:border-error
|
|
26
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
|
|
27
|
+
[&_mona-text-box]:h-full
|
|
28
|
+
[&_mona-text-box]:border-none
|
|
29
|
+
`, {
|
|
30
|
+
variants: {
|
|
31
|
+
focused: {
|
|
32
|
+
true: `ring-2 ring-primary/40 border-primary`,
|
|
33
|
+
false: ""
|
|
34
|
+
},
|
|
35
|
+
rounded: {
|
|
36
|
+
full: "rounded-full",
|
|
37
|
+
large: "rounded-lg",
|
|
38
|
+
medium: "rounded-md",
|
|
39
|
+
none: "rounded-none",
|
|
40
|
+
small: "rounded-sm"
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
large: "h-10 text-md",
|
|
44
|
+
medium: "h-9 text-sm",
|
|
45
|
+
small: "h-8 text-xs"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const datePickerBaseThemeVariants = (theme) => {
|
|
51
|
+
switch (theme) {
|
|
52
|
+
case "mona":
|
|
53
|
+
return datePickerBaseVariants;
|
|
54
|
+
default:
|
|
55
|
+
return datePickerBaseVariants;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
class DatePickerComponent {
|
|
60
|
+
#calendarService;
|
|
61
|
+
#destroyRef;
|
|
62
|
+
#dropdownService;
|
|
63
|
+
#hostElementRef;
|
|
64
|
+
#id;
|
|
65
|
+
#themeService;
|
|
66
|
+
constructor() {
|
|
67
|
+
this.#calendarService = inject(CalendarService);
|
|
68
|
+
this.#destroyRef = inject(DestroyRef);
|
|
69
|
+
this.#dropdownService = inject(DropdownService);
|
|
70
|
+
this.#hostElementRef = inject(ElementRef);
|
|
71
|
+
this.#id = createElementControlId();
|
|
72
|
+
this.#themeService = inject(ThemeService);
|
|
73
|
+
this.baseClass = computed(() => {
|
|
74
|
+
const theme = this.#themeService.theme();
|
|
75
|
+
const focused = this.#dropdownService.popupRef() != null;
|
|
76
|
+
const rounded = this.rounded();
|
|
77
|
+
const size = this.size();
|
|
78
|
+
const variantClass = datePickerBaseThemeVariants(theme)({ focused, rounded, size });
|
|
79
|
+
const userClass = this.userClass();
|
|
80
|
+
return twMerge(variantClass, userClass);
|
|
81
|
+
}, /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
83
|
+
this.currentDateString = linkedSignal(() => {
|
|
84
|
+
const value = this.value();
|
|
85
|
+
const format = this.format();
|
|
86
|
+
if (!value) {
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
return DateTime.fromJSDate(value).toFormat(format);
|
|
90
|
+
}, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "currentDateString" }] : /* istanbul ignore next */ []));
|
|
92
|
+
this.decadeCellTemplate = contentChild(CalendarDecadeCellTemplateDirective, /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "decadeCellTemplate" }] : /* istanbul ignore next */ []));
|
|
94
|
+
this.expanded = computed(() => this.#dropdownService.popupRef() !== null, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.inputAttributes = computed(() => {
|
|
97
|
+
const controls = this.popupId;
|
|
98
|
+
const expanded = this.#dropdownService.popupRef() != null;
|
|
99
|
+
const hasPopup = "grid";
|
|
100
|
+
const invalid = this.invalid();
|
|
101
|
+
return {
|
|
102
|
+
"aria-autocomplete": "none",
|
|
103
|
+
"aria-controls": controls,
|
|
104
|
+
"aria-expanded": expanded,
|
|
105
|
+
"aria-haspopup": hasPopup,
|
|
106
|
+
"aria-invalid": invalid,
|
|
107
|
+
id: this.#id,
|
|
108
|
+
role: "combobox"
|
|
109
|
+
};
|
|
110
|
+
}, /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
|
|
112
|
+
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.value()), /* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
114
|
+
this.monthCellTemplate = contentChild(CalendarMonthCellTemplateDirective, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "monthCellTemplate" }] : /* istanbul ignore next */ []));
|
|
116
|
+
this.navigatedDate = linkedSignal(() => this.value() ?? new Date(), /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
|
|
118
|
+
this.pickerPopupClass = computed(() => {
|
|
119
|
+
const theme = this.#themeService.theme();
|
|
120
|
+
const rounded = this.rounded();
|
|
121
|
+
const size = this.size();
|
|
122
|
+
const userClass = this.popupClass();
|
|
123
|
+
const variantClass = datePopupThemeVariants(theme)({ rounded, size });
|
|
124
|
+
return twMerge(variantClass, userClass);
|
|
125
|
+
}, /* @ts-ignore */
|
|
126
|
+
...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
|
|
127
|
+
this.popupId = createElementControlId();
|
|
128
|
+
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
129
|
+
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
130
|
+
this.prefixTemplate = contentChild(DateInputPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
131
|
+
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []));
|
|
133
|
+
/**
|
|
134
|
+
* @description Emits when the popup is about to close. This event is preventable.
|
|
135
|
+
*/
|
|
136
|
+
this.close = output();
|
|
137
|
+
/**
|
|
138
|
+
* @description Emits after the popup is closed.
|
|
139
|
+
*/
|
|
140
|
+
this.closed = output();
|
|
141
|
+
/**
|
|
142
|
+
* @description Sets the disabled state of the date picker.
|
|
143
|
+
*/
|
|
144
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
146
|
+
/**
|
|
147
|
+
* @description Sets the disabled dates of the date picker.
|
|
148
|
+
* Accepts either an iterable of Date objects or a predicate function.
|
|
149
|
+
*/
|
|
150
|
+
this.disabledDates = input(/* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [undefined, { debugName: "disabledDates" }] : /* istanbul ignore next */ []));
|
|
152
|
+
/**
|
|
153
|
+
* @description Sets the first day of the week.
|
|
154
|
+
*/
|
|
155
|
+
this.firstDay = input("monday", /* @ts-ignore */
|
|
156
|
+
...(ngDevMode ? [{ debugName: "firstDay" }] : /* istanbul ignore next */ []));
|
|
157
|
+
/**
|
|
158
|
+
* @description Sets the date format of the date picker.
|
|
159
|
+
*/
|
|
160
|
+
this.format = input("dd/MM/yyyy", /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
162
|
+
/**
|
|
163
|
+
* @description Marks the date picker as invalid. When bound to a signal form field via `[formField]`,
|
|
164
|
+
* this is written by the `FormField` directive.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
168
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
169
|
+
/**
|
|
170
|
+
* @description Sets the maximum date of the date picker.
|
|
171
|
+
*/
|
|
172
|
+
this.max = input(undefined, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
|
|
173
|
+
/**
|
|
174
|
+
* @description Sets the minimum date of the date picker.
|
|
175
|
+
*/
|
|
176
|
+
this.min = input(undefined, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: value => (value instanceof Date ? value : undefined) });
|
|
177
|
+
/**
|
|
178
|
+
* @description Emits when the popup is about to open. This event is preventable.
|
|
179
|
+
*/
|
|
180
|
+
this.open = output();
|
|
181
|
+
/**
|
|
182
|
+
* @description Emits after the popup is opened.
|
|
183
|
+
*/
|
|
184
|
+
this.opened = output();
|
|
185
|
+
/**
|
|
186
|
+
* @description Sets the placeholder of the date picker.
|
|
187
|
+
*/
|
|
188
|
+
this.placeholder = input("", /* @ts-ignore */
|
|
189
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
190
|
+
/**
|
|
191
|
+
* @description Sets the class of the popup element.
|
|
192
|
+
* @default ""
|
|
193
|
+
*/
|
|
194
|
+
this.popupClass = input("", /* @ts-ignore */
|
|
195
|
+
...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
|
|
196
|
+
/**
|
|
197
|
+
* @description Sets the height of the popup element.
|
|
198
|
+
* @default 200
|
|
199
|
+
*/
|
|
200
|
+
this.popupHeight = input("", /* @ts-ignore */
|
|
201
|
+
...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
|
|
202
|
+
/**
|
|
203
|
+
* @description Sets the width of the popup element.
|
|
204
|
+
* @default null
|
|
205
|
+
*/
|
|
206
|
+
this.popupWidth = input("", /* @ts-ignore */
|
|
207
|
+
...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
|
|
208
|
+
/**
|
|
209
|
+
* @description Sets the readonly state of the date picker.
|
|
210
|
+
*/
|
|
211
|
+
this.readonly = input(false, /* @ts-ignore */
|
|
212
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
213
|
+
/**
|
|
214
|
+
* @description When true, the input is readonly but the calendar button remains enabled.
|
|
215
|
+
* @default false
|
|
216
|
+
*/
|
|
217
|
+
this.readonlyInput = input(false, /* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [{ debugName: "readonlyInput" }] : /* istanbul ignore next */ []));
|
|
219
|
+
/**
|
|
220
|
+
* @description Sets the required state of the date picker.
|
|
221
|
+
* When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
|
|
222
|
+
* @default false
|
|
223
|
+
*/
|
|
224
|
+
this.required = input(false, /* @ts-ignore */
|
|
225
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
226
|
+
/**
|
|
227
|
+
* @description Sets the border radius of the date picker.
|
|
228
|
+
*/
|
|
229
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
231
|
+
/**
|
|
232
|
+
* @description Sets the visibility of the clear button.
|
|
233
|
+
*/
|
|
234
|
+
this.showClearButton = input(false, /* @ts-ignore */
|
|
235
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
236
|
+
/**
|
|
237
|
+
* @description Sets the size of the date picker.
|
|
238
|
+
*/
|
|
239
|
+
this.size = input("medium", /* @ts-ignore */
|
|
240
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
241
|
+
/**
|
|
242
|
+
* @description Emitted when the date picker is interacted with via blur, selection, or clear.
|
|
243
|
+
* The `FormField` directive listens to this to mark the field as touched.
|
|
244
|
+
*/
|
|
245
|
+
this.touch = output();
|
|
246
|
+
/**
|
|
247
|
+
* @description Sets the touched state of the date picker. When bound to a signal form field via `[formField]`,
|
|
248
|
+
* this is written by the `FormField` directive.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
this.touched = input(false, /* @ts-ignore */
|
|
252
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
253
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
254
|
+
/**
|
|
255
|
+
* @description Two-way bindable current date value.
|
|
256
|
+
* @default null
|
|
257
|
+
*/
|
|
258
|
+
this.value = model(null, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
260
|
+
/**
|
|
261
|
+
* @description Enables the display of week numbers in the calendar.
|
|
262
|
+
* @default false
|
|
263
|
+
*/
|
|
264
|
+
this.weekNumber = input(false, /* @ts-ignore */
|
|
265
|
+
...(ngDevMode ? [{ debugName: "weekNumber" }] : /* istanbul ignore next */ []));
|
|
266
|
+
effect(() => {
|
|
267
|
+
const popupTemplate = this.popupTemplate();
|
|
268
|
+
untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
|
|
269
|
+
});
|
|
270
|
+
afterNextRender({
|
|
271
|
+
read: () => {
|
|
272
|
+
this.setSubscriptions();
|
|
273
|
+
this.setPopupCloseSubscriptions();
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
onCalendarValueChange(date) {
|
|
278
|
+
const singleDate = Array.isArray(date) ? null : date;
|
|
279
|
+
this.setCurrentDate(singleDate);
|
|
280
|
+
this.#dropdownService.popupRef()?.close();
|
|
281
|
+
}
|
|
282
|
+
onDateInputBlur() {
|
|
283
|
+
if (this.#dropdownService.popupRef()) {
|
|
284
|
+
this.touch.emit();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (!this.currentDateString() && this.value()) {
|
|
288
|
+
this.setCurrentDate(null);
|
|
289
|
+
this.touch.emit();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const dateTime = DateTime.fromFormat(this.currentDateString(), this.format());
|
|
293
|
+
if (this.dateStringEquals(this.value(), dateTime.toJSDate())) {
|
|
294
|
+
this.touch.emit();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (dateTime.isValid) {
|
|
298
|
+
const value = this.value();
|
|
299
|
+
if (value && DateTime.fromJSDate(value).equals(dateTime)) {
|
|
300
|
+
this.touch.emit();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
this.setCurrentDate(dateTime.toJSDate());
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.setCurrentDate(null);
|
|
307
|
+
this.currentDateString.set("");
|
|
308
|
+
}
|
|
309
|
+
this.touch.emit();
|
|
310
|
+
}
|
|
311
|
+
onDateInputButtonClick() {
|
|
312
|
+
const popupRef = this.#dropdownService.popupRef();
|
|
313
|
+
if (!this.popupTemplate() || this.disabled() || this.readonly()) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (popupRef) {
|
|
317
|
+
popupRef.close();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
this.openPopup();
|
|
321
|
+
}
|
|
322
|
+
onDateStringEdit(dateString) {
|
|
323
|
+
this.currentDateString.set(dateString);
|
|
324
|
+
}
|
|
325
|
+
closePopup() {
|
|
326
|
+
this.#dropdownService.popupRef()?.close();
|
|
327
|
+
}
|
|
328
|
+
compareDatesEqual(date1, date2) {
|
|
329
|
+
return (date1.getFullYear() === date2.getFullYear() &&
|
|
330
|
+
date1.getMonth() === date2.getMonth() &&
|
|
331
|
+
date1.getDate() === date2.getDate());
|
|
332
|
+
}
|
|
333
|
+
dateStringEquals(date1, date2) {
|
|
334
|
+
if (date1 && date2) {
|
|
335
|
+
return (DateTime.fromJSDate(date1).toFormat(this.format()) ===
|
|
336
|
+
DateTime.fromJSDate(date2).toFormat(this.format()));
|
|
337
|
+
}
|
|
338
|
+
return date1 === date2;
|
|
339
|
+
}
|
|
340
|
+
focus() {
|
|
341
|
+
const input = this.#hostElementRef.nativeElement.querySelector("input");
|
|
342
|
+
if (input && !this.readonly()) {
|
|
343
|
+
input.focus();
|
|
344
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
handleKeydown(event) {
|
|
348
|
+
if (this.disabled() || this.readonly()) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (event.altKey && event.key === "ArrowDown") {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
this.openPopup();
|
|
354
|
+
}
|
|
355
|
+
else if ((event.altKey && event.key === "ArrowUp") || event.key === "Escape") {
|
|
356
|
+
event.preventDefault();
|
|
357
|
+
this.closePopup();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
isDateDisabledByInput(date, disabledDates) {
|
|
361
|
+
if (typeof disabledDates === "function") {
|
|
362
|
+
return disabledDates(date);
|
|
363
|
+
}
|
|
364
|
+
else if (disabledDates) {
|
|
365
|
+
return any(disabledDates, d => this.compareDatesEqual(date, d));
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
openPopup() {
|
|
370
|
+
if (!this.#dropdownService.popupRef()) {
|
|
371
|
+
this.#dropdownService.triggerPopupOpen$.next({
|
|
372
|
+
height: this.popupHeight() || "auto",
|
|
373
|
+
maxHeight: "auto",
|
|
374
|
+
width: this.popupWidth() || "auto",
|
|
375
|
+
closeOnScroll: false,
|
|
376
|
+
withScrollTracking: true
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
setCurrentDate(date) {
|
|
381
|
+
const newDate = date ? new Date(date) : null;
|
|
382
|
+
this.value.set(newDate);
|
|
383
|
+
this.touch.emit();
|
|
384
|
+
}
|
|
385
|
+
setKeyboardSubscriptions() {
|
|
386
|
+
fromEvent(this.#hostElementRef.nativeElement, "keydown")
|
|
387
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
388
|
+
.subscribe(event => this.handleKeydown(event));
|
|
389
|
+
this.#calendarService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
390
|
+
const keyboardEvent = event.originalEvent;
|
|
391
|
+
if (keyboardEvent &&
|
|
392
|
+
(keyboardEvent.key === "Escape" || (keyboardEvent.altKey && keyboardEvent.key === "ArrowUp"))) {
|
|
393
|
+
keyboardEvent.preventDefault();
|
|
394
|
+
this.closePopup();
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
setPopupCloseSubscriptions() {
|
|
399
|
+
this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
400
|
+
this.focus();
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
setSubscriptions() {
|
|
404
|
+
fromEvent(this.#hostElementRef.nativeElement, "focusin")
|
|
405
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
406
|
+
.subscribe(() => this.focus());
|
|
407
|
+
this.setKeyboardSubscriptions();
|
|
408
|
+
}
|
|
409
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
410
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DatePickerComponent, isStandalone: true, selector: "mona-date-picker", 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 }, format: { classPropertyName: "format", publicName: "format", 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: { properties: { "attr.tabindex": "disabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "class": "baseClass()" } }, providers: [
|
|
411
|
+
DropdownService,
|
|
412
|
+
CalendarService,
|
|
413
|
+
{
|
|
414
|
+
provide: DropdownPopupInputToken,
|
|
415
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
416
|
+
multi: false
|
|
417
|
+
}
|
|
418
|
+
], 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\r\n (inputBlur)=\"onDateInputBlur()\"\r\n (valueChange)=\"onDateStringEdit($event)\"\r\n [disabled]=\"disabled()\"\r\n [value]=\"currentDateString()\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly() || readonlyInput()\"\r\n [inputAttributes]=\"inputAttributes()\"\r\n [invalid]=\"invalid()\"\r\n [required]=\"required()\"\r\n [clearButton]=\"showClearButton()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [touched]=\"touched()\">\r\n @if (prefixTemplate()) {\r\n <ng-template monaTextBoxPrefixTemplate>\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n <ng-template monaTextBoxSuffixTemplate>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"'none'\"\r\n [size]=\"size()\"\r\n class=\"h-full w-auto aspect-square\"\r\n [attr.aria-label]=\"'Open calendar'\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"popupId\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [tabindex]=\"-1\"\r\n (click)=\"onDateInputButtonClick()\">\r\n <i class=\"ri-calendar-line\"></i>\r\n </button>\r\n </ng-template>\r\n</mona-text-box>\r\n\r\n<ng-template #popupTemplate>\r\n <div\r\n [class]=\"pickerPopupClass()\"\r\n [id]=\"popupId\"\r\n aria-modal=\"true\"\r\n role=\"dialog\"\r\n aria-label=\"Date picker\"\r\n cdkTrapFocus>\r\n <mona-calendar\r\n [disabledDates]=\"disabledDates()\"\r\n [minDate]=\"min()\"\r\n [maxDate]=\"max()\"\r\n [readonly]=\"readonly()\"\r\n [rounded]=\"rounded()\"\r\n [weekNumber]=\"weekNumber()\"\r\n [firstDay]=\"firstDay()\"\r\n [value]=\"value()\"\r\n (valueChange)=\"onCalendarValueChange($event)\">\r\n @if (decadeCellTemplate()) {\r\n <ng-template monaCalendarDecadeCellTemplate let-year>\r\n <ng-container\r\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (monthCellTemplate()) {\r\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (yearCellTemplate()) {\r\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-calendar>\r\n </div>\r\n</ng-template>\r\n", dependencies: [{ kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: CalendarComponent, selector: "mona-calendar", inputs: ["disabled", "disabledDates", "firstDay", "invalid", "maxDate", "minDate", "readonly", "rounded", "selection", "required", "touched", "class", "value", "weekNumber"], outputs: ["disabledChange", "touch", "valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "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", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] }); }
|
|
419
|
+
}
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
421
|
+
type: Component,
|
|
422
|
+
args: [{ selector: "mona-date-picker", providers: [
|
|
423
|
+
DropdownService,
|
|
424
|
+
CalendarService,
|
|
425
|
+
{
|
|
426
|
+
provide: DropdownPopupInputToken,
|
|
427
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
428
|
+
multi: false
|
|
429
|
+
}
|
|
430
|
+
], imports: [
|
|
431
|
+
FontAwesomeModule,
|
|
432
|
+
CalendarComponent,
|
|
433
|
+
TextBoxComponent,
|
|
434
|
+
TextBoxSuffixTemplateDirective,
|
|
435
|
+
CalendarDecadeCellTemplateDirective,
|
|
436
|
+
NgTemplateOutlet,
|
|
437
|
+
CalendarMonthCellTemplateDirective,
|
|
438
|
+
CalendarYearCellTemplateDirective,
|
|
439
|
+
TextBoxPrefixTemplateDirective,
|
|
440
|
+
ButtonDirective,
|
|
441
|
+
CdkTrapFocus
|
|
442
|
+
], hostDirectives: [DropdownPopupHandlerDirective], host: {
|
|
443
|
+
"[attr.tabindex]": "disabled() ? null : -1",
|
|
444
|
+
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
445
|
+
"[attr.data-expanded]": "expanded()",
|
|
446
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
447
|
+
"[class]": "baseClass()"
|
|
448
|
+
}, template: "<mona-text-box\r\n (inputBlur)=\"onDateInputBlur()\"\r\n (valueChange)=\"onDateStringEdit($event)\"\r\n [disabled]=\"disabled()\"\r\n [value]=\"currentDateString()\"\r\n [placeholder]=\"placeholder()\"\r\n [readonly]=\"readonly() || readonlyInput()\"\r\n [inputAttributes]=\"inputAttributes()\"\r\n [invalid]=\"invalid()\"\r\n [required]=\"required()\"\r\n [clearButton]=\"showClearButton()\"\r\n [rounded]=\"rounded()\"\r\n [size]=\"size()\"\r\n [touched]=\"touched()\">\r\n @if (prefixTemplate()) {\r\n <ng-template monaTextBoxPrefixTemplate>\r\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\r\n </ng-template>\r\n }\r\n <ng-template monaTextBoxSuffixTemplate>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n [iconOnly]=\"true\"\r\n [rounded]=\"'none'\"\r\n [size]=\"size()\"\r\n class=\"h-full w-auto aspect-square\"\r\n [attr.aria-label]=\"'Open calendar'\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"popupId\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [tabindex]=\"-1\"\r\n (click)=\"onDateInputButtonClick()\">\r\n <i class=\"ri-calendar-line\"></i>\r\n </button>\r\n </ng-template>\r\n</mona-text-box>\r\n\r\n<ng-template #popupTemplate>\r\n <div\r\n [class]=\"pickerPopupClass()\"\r\n [id]=\"popupId\"\r\n aria-modal=\"true\"\r\n role=\"dialog\"\r\n aria-label=\"Date picker\"\r\n cdkTrapFocus>\r\n <mona-calendar\r\n [disabledDates]=\"disabledDates()\"\r\n [minDate]=\"min()\"\r\n [maxDate]=\"max()\"\r\n [readonly]=\"readonly()\"\r\n [rounded]=\"rounded()\"\r\n [weekNumber]=\"weekNumber()\"\r\n [firstDay]=\"firstDay()\"\r\n [value]=\"value()\"\r\n (valueChange)=\"onCalendarValueChange($event)\">\r\n @if (decadeCellTemplate()) {\r\n <ng-template monaCalendarDecadeCellTemplate let-year>\r\n <ng-container\r\n [ngTemplateOutlet]=\"decadeCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (monthCellTemplate()) {\r\n <ng-template monaCalendarMonthCellTemplate let-day let-date=\"date\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"monthCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: day, date }\"></ng-container>\r\n </ng-template>\r\n }\r\n @if (yearCellTemplate()) {\r\n <ng-template monaCalendarYearCellTemplate let-year let-text=\"text\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"yearCellTemplate()?.templateRef\"\r\n [ngTemplateOutletContext]=\"{ $implicit: year, text }\"></ng-container>\r\n </ng-template>\r\n }\r\n </mona-calendar>\r\n </div>\r\n</ng-template>\r\n" }]
|
|
449
|
+
}], 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 }] }], 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 }] }], 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 }] }] } });
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* Public API Surface of @nanahoshi/mona-ui/date-picker
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Generated bundle index. Do not edit.
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
export { DatePickerComponent };
|
|
460
|
+
//# sourceMappingURL=nanahoshi-mona-ui-date-picker.mjs.map
|