@agorapulse/ui-components 22.1.7 → 22.2.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/agorapulse-ui-components-22.2.0.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-action-dropdown.mjs +29 -61
- package/fesm2022/agorapulse-ui-components-action-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-autocomplete.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-autocomplete.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-button.mjs +8 -4
- package/fesm2022/agorapulse-ui-components-button.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-checkbox.mjs +16 -4
- package/fesm2022/agorapulse-ui-components-checkbox.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-datepicker.mjs +655 -219
- package/fesm2022/agorapulse-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-directives.mjs +172 -2
- package/fesm2022/agorapulse-ui-components-directives.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-dropdown-base.mjs +69 -2
- package/fesm2022/agorapulse-ui-components-dropdown-base.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-dropdown-panel.mjs +47 -3
- package/fesm2022/agorapulse-ui-components-dropdown-panel.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +39 -13
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-input-group.mjs +6 -4
- package/fesm2022/agorapulse-ui-components-input-group.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-input-search.mjs +10 -4
- package/fesm2022/agorapulse-ui-components-input-search.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-labels-selector.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-labels-selector.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-legacy-select.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-legacy-select.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs +3 -3
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-neo-datepicker.mjs +2 -2
- package/fesm2022/agorapulse-ui-components-neo-datepicker.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-phone-number-input.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-phone-number-input.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-popover.mjs +7 -0
- package/fesm2022/agorapulse-ui-components-popover.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-select.mjs +18 -44
- package/fesm2022/agorapulse-ui-components-select.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs +160 -16
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components.mjs +2 -4
- package/fesm2022/agorapulse-ui-components.mjs.map +1 -1
- package/package.json +2 -6
- package/types/agorapulse-ui-components-action-dropdown.d.ts +6 -4
- package/types/agorapulse-ui-components-button.d.ts +4 -2
- package/types/agorapulse-ui-components-checkbox.d.ts +7 -1
- package/types/agorapulse-ui-components-datepicker.d.ts +313 -88
- package/types/agorapulse-ui-components-directives.d.ts +85 -2
- package/types/agorapulse-ui-components-dropdown-base.d.ts +40 -1
- package/types/agorapulse-ui-components-dropdown-panel.d.ts +16 -1
- package/types/agorapulse-ui-components-filter-dropdown.d.ts +3 -1
- package/types/agorapulse-ui-components-input-group.d.ts +3 -1
- package/types/agorapulse-ui-components-input-search.d.ts +5 -1
- package/types/agorapulse-ui-components-neo-datepicker.d.ts +2 -2
- package/types/agorapulse-ui-components-popover.d.ts +7 -0
- package/types/agorapulse-ui-components-select.d.ts +7 -5
- package/types/agorapulse-ui-components-selection-dropdown.d.ts +68 -5
- package/types/agorapulse-ui-components.d.ts +2 -5
- package/agorapulse-ui-components-22.1.7.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-date-range-picker.mjs +0 -163
- package/fesm2022/agorapulse-ui-components-date-range-picker.mjs.map +0 -1
- package/types/agorapulse-ui-components-date-range-picker.d.ts +0 -75
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { StopPropagationDirective } from '@agorapulse/ui-components/directives';
|
|
2
|
-
import {
|
|
1
|
+
import { StopPropagationDirective, OverflowCountDirective, OverflowCounterDirective, OverflowItemDirective } from '@agorapulse/ui-components/directives';
|
|
2
|
+
import { DropdownPanelComponent, DropdownContentDirective } from '@agorapulse/ui-components/dropdown-panel';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
4
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input,
|
|
5
|
+
import { input, output, signal, viewChild, linkedSignal, computed, ChangeDetectionStrategy, Component, EventEmitter, Output, Input, ViewChild, inject, APP_ID, model, effect, ViewEncapsulation } from '@angular/core';
|
|
6
|
+
import { ButtonComponent } from '@agorapulse/ui-components/button';
|
|
7
|
+
import { createDropdownOverlay, DropdownTriggerDirective } from '@agorapulse/ui-components/dropdown-base';
|
|
8
|
+
import { IconButtonComponent } from '@agorapulse/ui-components/icon-button';
|
|
5
9
|
import * as i1 from '@agorapulse/ui-symbol';
|
|
6
|
-
import { apArrowLeft, apArrowRight, SymbolComponent,
|
|
10
|
+
import { withSymbols, apArrowLeft, apArrowRight, SymbolComponent, apCalendar, apChevronDown, apChevronUp, apClock, apClose, apInfo } from '@agorapulse/ui-symbol';
|
|
7
11
|
import * as i2 from '@agorapulse/ngx-daterangepicker-material';
|
|
8
|
-
import { NgxDaterangepickerMd } from '@agorapulse/ngx-daterangepicker-material';
|
|
12
|
+
import { NgxDaterangepickerMd, LOCALE_CONFIG, LocaleService } from '@agorapulse/ngx-daterangepicker-material';
|
|
9
13
|
import dayjs from 'dayjs';
|
|
10
14
|
import 'dayjs/locale/de';
|
|
11
15
|
import 'dayjs/locale/en';
|
|
@@ -13,10 +17,176 @@ import 'dayjs/locale/es';
|
|
|
13
17
|
import 'dayjs/locale/fr';
|
|
14
18
|
import 'dayjs/locale/pt';
|
|
15
19
|
import localeData from 'dayjs/plugin/localeData';
|
|
16
|
-
import { FormFieldComponent } from '@agorapulse/ui-components/form-field';
|
|
17
|
-
import { IconButtonComponent } from '@agorapulse/ui-components/icon-button';
|
|
18
|
-
import { InputDirective } from '@agorapulse/ui-components/input';
|
|
19
20
|
import { InputGroupComponent } from '@agorapulse/ui-components/input-group';
|
|
21
|
+
import { TagComponent } from '@agorapulse/ui-components/tag';
|
|
22
|
+
import { TooltipDirective } from '@agorapulse/ui-components/tooltip';
|
|
23
|
+
|
|
24
|
+
const MONTHS_IN_YEAR = 12;
|
|
25
|
+
/** A page of years fills the month grid exactly, so switching view never resizes the panel. */
|
|
26
|
+
const YEARS_PER_PAGE = MONTHS_IN_YEAR;
|
|
27
|
+
const SELECTED_MONTH_CONFIG = { style: 'primary', color: 'blue' };
|
|
28
|
+
const UNSELECTED_MONTH_CONFIG = { style: 'ghost', color: 'grey' };
|
|
29
|
+
/**
|
|
30
|
+
* A year of months in a dropdown, so a calendar can be moved somewhere far without paging through
|
|
31
|
+
* the months in between. Driven by `apDropdownTrigger` on whatever the caller wants as a trigger.
|
|
32
|
+
*
|
|
33
|
+
* The year is browsable inside the panel; only clicking a month commits.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```html
|
|
37
|
+
* <ap-button [apDropdownTrigger]="picker">{{ label }}</ap-button>
|
|
38
|
+
* <ap-datepicker-month-picker
|
|
39
|
+
* #picker
|
|
40
|
+
* [month]="month"
|
|
41
|
+
* [year]="year"
|
|
42
|
+
* (monthSelected)="goTo($event)" />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
class DatepickerMonthPickerComponent {
|
|
46
|
+
/** The month the calendar is showing, zero-based. Highlighted in the grid. */
|
|
47
|
+
month = input.required(/* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "month" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** The year the calendar is showing. The panel opens on it, and returns to it when it moves. */
|
|
50
|
+
year = input.required(/* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []));
|
|
52
|
+
locale = input('en', /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
54
|
+
minDate = input(undefined, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
56
|
+
maxDate = input(undefined, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
58
|
+
monthSelected = output();
|
|
59
|
+
/**
|
|
60
|
+
* Months until the year is clicked, years until one is picked. Reaching a distant year through
|
|
61
|
+
* the arrows alone costs one click per year; through the grid it costs one per page.
|
|
62
|
+
*/
|
|
63
|
+
showingYears = signal(false, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "showingYears" }] : /* istanbul ignore next */ []));
|
|
65
|
+
panelTemplate = viewChild('panelTemplate', /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
67
|
+
overlay = createDropdownOverlay();
|
|
68
|
+
isOpen = this.overlay.isOpen;
|
|
69
|
+
/** Browsable on its own, and re-anchored on the calendar's year whenever that moves. */
|
|
70
|
+
displayedYear = linkedSignal(() => this.year(), /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "displayedYear" }] : /* istanbul ignore next */ []));
|
|
72
|
+
/**
|
|
73
|
+
* First year of the visible page. Pages are fixed blocks rather than a window around the
|
|
74
|
+
* displayed year, so the same year always sits in the same page and browsing back and forth
|
|
75
|
+
* lands on the same grid.
|
|
76
|
+
*/
|
|
77
|
+
yearPageStart = computed(() => {
|
|
78
|
+
const year = this.displayedYear();
|
|
79
|
+
return year - (((year % YEARS_PER_PAGE) + YEARS_PER_PAGE) % YEARS_PER_PAGE);
|
|
80
|
+
}, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "yearPageStart" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/** The page the years grid spans, for the header that replaces the year while it shows. */
|
|
83
|
+
displayedYearRange = computed(() => `${this.yearPageStart()} - ${this.yearPageStart() + YEARS_PER_PAGE - 1}`, /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "displayedYearRange" }] : /* istanbul ignore next */ []));
|
|
85
|
+
canGoPrevious = computed(() => {
|
|
86
|
+
const min = this.minDate();
|
|
87
|
+
if (min === undefined) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return this.showingYears() ? this.yearPageStart() > min.year() : this.displayedYear() > min.year();
|
|
91
|
+
}, /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "canGoPrevious" }] : /* istanbul ignore next */ []));
|
|
93
|
+
canGoNext = computed(() => {
|
|
94
|
+
const max = this.maxDate();
|
|
95
|
+
if (max === undefined) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const lastOfPage = this.yearPageStart() + YEARS_PER_PAGE - 1;
|
|
99
|
+
return this.showingYears() ? lastOfPage < max.year() : this.displayedYear() < max.year();
|
|
100
|
+
}, /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "canGoNext" }] : /* istanbul ignore next */ []));
|
|
102
|
+
months = computed(() => {
|
|
103
|
+
const locale = this.locale();
|
|
104
|
+
const displayedYear = this.displayedYear();
|
|
105
|
+
const showingCalendarYear = displayedYear === this.year();
|
|
106
|
+
const calendarMonth = this.month();
|
|
107
|
+
const min = this.minDate();
|
|
108
|
+
const max = this.maxDate();
|
|
109
|
+
return Array.from({ length: MONTHS_IN_YEAR }, (_, month) => {
|
|
110
|
+
// Anchored on the 1st before the year and the month are set: from a 31st, moving to a
|
|
111
|
+
// shorter month would otherwise spill into the next one.
|
|
112
|
+
const firstOfMonth = dayjs().date(1).year(displayedYear).month(month).locale(locale);
|
|
113
|
+
const selected = showingCalendarYear && month === calendarMonth;
|
|
114
|
+
return {
|
|
115
|
+
month,
|
|
116
|
+
label: firstOfMonth.format('MMM'),
|
|
117
|
+
ariaLabel: firstOfMonth.format('MMMM YYYY'),
|
|
118
|
+
disabled: (min !== undefined && firstOfMonth.endOf('month').isBefore(min, 'day')) ||
|
|
119
|
+
(max !== undefined && firstOfMonth.startOf('month').isAfter(max, 'day')),
|
|
120
|
+
config: selected ? SELECTED_MONTH_CONFIG : UNSELECTED_MONTH_CONFIG,
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}, /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []));
|
|
125
|
+
years = computed(() => {
|
|
126
|
+
const pageStart = this.yearPageStart();
|
|
127
|
+
const displayedYear = this.displayedYear();
|
|
128
|
+
const min = this.minDate();
|
|
129
|
+
const max = this.maxDate();
|
|
130
|
+
return Array.from({ length: YEARS_PER_PAGE }, (_, offset) => {
|
|
131
|
+
const year = pageStart + offset;
|
|
132
|
+
const selected = year === displayedYear;
|
|
133
|
+
return {
|
|
134
|
+
year,
|
|
135
|
+
disabled: (min !== undefined && year < min.year()) || (max !== undefined && year > max.year()),
|
|
136
|
+
config: selected ? SELECTED_MONTH_CONFIG : UNSELECTED_MONTH_CONFIG,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "years" }] : /* istanbul ignore next */ []));
|
|
141
|
+
open(triggerElement) {
|
|
142
|
+
const panelTemplate = this.panelTemplate();
|
|
143
|
+
if (this.isOpen() || !panelTemplate) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.overlay.open(panelTemplate, triggerElement, { onClose: () => this.close() });
|
|
147
|
+
}
|
|
148
|
+
close() {
|
|
149
|
+
// Back to months, so reopening never starts on the year grid the last visit happened to leave on.
|
|
150
|
+
this.showingYears.set(false);
|
|
151
|
+
this.overlay.close();
|
|
152
|
+
}
|
|
153
|
+
toggle(triggerElement) {
|
|
154
|
+
if (this.isOpen()) {
|
|
155
|
+
this.close();
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.open(triggerElement);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
onPrevious() {
|
|
162
|
+
this.displayedYear.update(year => year - this.step());
|
|
163
|
+
}
|
|
164
|
+
onNext() {
|
|
165
|
+
this.displayedYear.update(year => year + this.step());
|
|
166
|
+
}
|
|
167
|
+
/** Toggles the grid between the months of a year and the years of a page. */
|
|
168
|
+
onToggleYears() {
|
|
169
|
+
this.showingYears.update(showing => !showing);
|
|
170
|
+
}
|
|
171
|
+
onSelectYear(year) {
|
|
172
|
+
this.displayedYear.set(year);
|
|
173
|
+
this.showingYears.set(false);
|
|
174
|
+
}
|
|
175
|
+
onSelectMonth(month) {
|
|
176
|
+
this.monthSelected.emit({ month, year: this.displayedYear() });
|
|
177
|
+
this.close();
|
|
178
|
+
}
|
|
179
|
+
/** One year at a time through the months, a whole page at a time through the years. */
|
|
180
|
+
step() {
|
|
181
|
+
return this.showingYears() ? YEARS_PER_PAGE : 1;
|
|
182
|
+
}
|
|
183
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerMonthPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
184
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerMonthPickerComponent, isStandalone: true, selector: "ap-datepicker-month-picker", inputs: { month: { classPropertyName: "month", publicName: "month", isSignal: true, isRequired: true, transformFunction: null }, year: { classPropertyName: "year", publicName: "year", isSignal: true, isRequired: true, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { monthSelected: "monthSelected" }, providers: [withSymbols(apArrowLeft, apArrowRight)], viewQueries: [{ propertyName: "panelTemplate", first: true, predicate: ["panelTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panelTemplate>\n <div\n class=\"ap-datepicker-month-picker\"\n role=\"dialog\"\n tabindex=\"-1\">\n <div class=\"ap-datepicker-month-picker__header\">\n <ap-icon-button\n symbolId=\"arrow-left\"\n [ariaLabel]=\"showingYears() ? 'Previous years' : 'Previous year'\"\n [disabled]=\"!canGoPrevious()\"\n (onClick)=\"onPrevious()\" />\n <!--\n A button, not a label: it is what opens the year grid. Reaching a distant year through\n the arrows alone costs one click per year.\n -->\n <ap-button\n class=\"ap-datepicker-month-picker__year\"\n [ariaLabel]=\"showingYears() ? 'Back to the months' : 'Choose a year'\"\n [config]=\"{ style: 'ghost', color: 'grey' }\"\n (click)=\"onToggleYears()\">\n {{ showingYears() ? displayedYearRange() : displayedYear() }}\n </ap-button>\n <ap-icon-button\n symbolId=\"arrow-right\"\n [ariaLabel]=\"showingYears() ? 'Next years' : 'Next year'\"\n [disabled]=\"!canGoNext()\"\n (onClick)=\"onNext()\" />\n </div>\n\n <!-- One grid for both: a page of years fills it exactly, so switching never resizes the panel. -->\n <div class=\"ap-datepicker-month-picker__grid\">\n @if (showingYears()) {\n @for (option of years(); track option.year) {\n <ap-button\n [config]=\"option.config\"\n [disabled]=\"option.disabled\"\n (click)=\"onSelectYear(option.year)\">\n {{ option.year }}\n </ap-button>\n }\n } @else {\n @for (option of months(); track option.month) {\n <ap-button\n [ariaLabel]=\"option.ariaLabel\"\n [config]=\"option.config\"\n [disabled]=\"option.disabled\"\n (click)=\"onSelectMonth(option.month)\">\n {{ option.label }}\n </ap-button>\n }\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:none}.ap-datepicker-month-picker{padding:var(--ref-spacing-sm);border-radius:var(--comp-action-dropdown-border-radius);background-color:var(--comp-action-dropdown-background-color);box-shadow:var(--comp-action-dropdown-box-shadow);outline:none}.ap-datepicker-month-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--ref-spacing-xs);gap:var(--ref-spacing-xxs)}.ap-datepicker-month-picker__year{color:var(--ref-color-grey-100);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height)}.ap-datepicker-month-picker__grid{display:grid;gap:var(--ref-spacing-xxs);grid-template-columns:repeat(3,minmax(64px,1fr))}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: IconButtonComponent, selector: "ap-icon-button", inputs: ["ariaLabel", "name", "color", "disabled", "menuTrigger", "symbolId", "locked", "loading", "type"], outputs: ["onClick", "onFocus", "onBlur", "menuOpened", "menuClosed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
185
|
+
}
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerMonthPickerComponent, decorators: [{
|
|
187
|
+
type: Component,
|
|
188
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker-month-picker', imports: [ButtonComponent, IconButtonComponent], providers: [withSymbols(apArrowLeft, apArrowRight)], template: "<ng-template #panelTemplate>\n <div\n class=\"ap-datepicker-month-picker\"\n role=\"dialog\"\n tabindex=\"-1\">\n <div class=\"ap-datepicker-month-picker__header\">\n <ap-icon-button\n symbolId=\"arrow-left\"\n [ariaLabel]=\"showingYears() ? 'Previous years' : 'Previous year'\"\n [disabled]=\"!canGoPrevious()\"\n (onClick)=\"onPrevious()\" />\n <!--\n A button, not a label: it is what opens the year grid. Reaching a distant year through\n the arrows alone costs one click per year.\n -->\n <ap-button\n class=\"ap-datepicker-month-picker__year\"\n [ariaLabel]=\"showingYears() ? 'Back to the months' : 'Choose a year'\"\n [config]=\"{ style: 'ghost', color: 'grey' }\"\n (click)=\"onToggleYears()\">\n {{ showingYears() ? displayedYearRange() : displayedYear() }}\n </ap-button>\n <ap-icon-button\n symbolId=\"arrow-right\"\n [ariaLabel]=\"showingYears() ? 'Next years' : 'Next year'\"\n [disabled]=\"!canGoNext()\"\n (onClick)=\"onNext()\" />\n </div>\n\n <!-- One grid for both: a page of years fills it exactly, so switching never resizes the panel. -->\n <div class=\"ap-datepicker-month-picker__grid\">\n @if (showingYears()) {\n @for (option of years(); track option.year) {\n <ap-button\n [config]=\"option.config\"\n [disabled]=\"option.disabled\"\n (click)=\"onSelectYear(option.year)\">\n {{ option.year }}\n </ap-button>\n }\n } @else {\n @for (option of months(); track option.month) {\n <ap-button\n [ariaLabel]=\"option.ariaLabel\"\n [config]=\"option.config\"\n [disabled]=\"option.disabled\"\n (click)=\"onSelectMonth(option.month)\">\n {{ option.label }}\n </ap-button>\n }\n }\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:none}.ap-datepicker-month-picker{padding:var(--ref-spacing-sm);border-radius:var(--comp-action-dropdown-border-radius);background-color:var(--comp-action-dropdown-background-color);box-shadow:var(--comp-action-dropdown-box-shadow);outline:none}.ap-datepicker-month-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--ref-spacing-xs);gap:var(--ref-spacing-xxs)}.ap-datepicker-month-picker__year{color:var(--ref-color-grey-100);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height)}.ap-datepicker-month-picker__grid{display:grid;gap:var(--ref-spacing-xxs);grid-template-columns:repeat(3,minmax(64px,1fr))}\n"] }]
|
|
189
|
+
}], propDecorators: { month: [{ type: i0.Input, args: [{ isSignal: true, alias: "month", required: true }] }], year: [{ type: i0.Input, args: [{ isSignal: true, alias: "year", required: true }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], monthSelected: [{ type: i0.Output, args: ["monthSelected"] }], panelTemplate: [{ type: i0.ViewChild, args: ['panelTemplate', { isSignal: true }] }] } });
|
|
20
190
|
|
|
21
191
|
var DatepickerMode;
|
|
22
192
|
(function (DatepickerMode) {
|
|
@@ -29,35 +199,17 @@ var SideEnum;
|
|
|
29
199
|
SideEnum["left"] = "left";
|
|
30
200
|
SideEnum["right"] = "right";
|
|
31
201
|
})(SideEnum || (SideEnum = {}));
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
lastWeek: [dayjs().subtract(7, 'days'), dayjs().subtract(1, 'days')],
|
|
35
|
-
last30Days: [dayjs().subtract(30, 'days'), dayjs().subtract(1, 'days')],
|
|
36
|
-
lastMonth: [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')],
|
|
37
|
-
thisMonth: [dayjs().startOf('month'), dayjs().endOf('month')],
|
|
38
|
-
lastWeekFromToday: [dayjs().subtract(6, 'days'), dayjs()],
|
|
39
|
-
lastMonthFromToday: [dayjs().subtract(1, 'month').add(1, 'days'), dayjs()],
|
|
40
|
-
last3MonthsFromToday: [dayjs().subtract(3, 'month').add(1, 'days'), dayjs()],
|
|
41
|
-
last6MonthsFromToday: [dayjs().subtract(6, 'month').add(1, 'days'), dayjs()],
|
|
42
|
-
lastYearFromToday: [dayjs().subtract(1, 'year').add(1, 'days'), dayjs()],
|
|
43
|
-
};
|
|
202
|
+
/** A stable "no shortcuts" reference: a fresh object would reset the vendor. */
|
|
203
|
+
const NO_RANGES = {};
|
|
44
204
|
// TODO fix css for range mode (more lateral padding)
|
|
45
205
|
class DatepickerComponent {
|
|
46
206
|
changeDetectorRef;
|
|
47
207
|
symbolRegistry;
|
|
48
208
|
datepickerRef;
|
|
49
209
|
firstDayOfWeek = 'monday';
|
|
50
|
-
i18n = {
|
|
51
|
-
ranges: {
|
|
52
|
-
yesterday: 'Yesterday',
|
|
53
|
-
lastWeek: 'Last Week',
|
|
54
|
-
last30Days: 'Last 30 days',
|
|
55
|
-
lastMonth: 'Previous month',
|
|
56
|
-
thisMonth: 'This month',
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
210
|
locale = 'en';
|
|
60
211
|
set maxDate(maxDate) {
|
|
212
|
+
this.maxDateValue = maxDate;
|
|
61
213
|
if (maxDate) {
|
|
62
214
|
this.maxDateStr = maxDate.toISOString();
|
|
63
215
|
}
|
|
@@ -66,6 +218,7 @@ class DatepickerComponent {
|
|
|
66
218
|
}
|
|
67
219
|
}
|
|
68
220
|
set minDate(minDate) {
|
|
221
|
+
this.minDateValue = minDate;
|
|
69
222
|
if (minDate) {
|
|
70
223
|
this.minDateStr = minDate.toISOString();
|
|
71
224
|
}
|
|
@@ -80,22 +233,38 @@ class DatepickerComponent {
|
|
|
80
233
|
/** Maximum number of days between the start and the end date in Range mode. Undefined means no limit. */
|
|
81
234
|
dateLimit = input(undefined, /* @ts-ignore */
|
|
82
235
|
...(ngDevMode ? [{ debugName: "dateLimit" }] : /* istanbul ignore next */ []));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
...(ngDevMode ? [{ debugName: "
|
|
236
|
+
/** Shortcuts listed beside the calendars. Empty by default, and ignored outside Range mode. */
|
|
237
|
+
presets = input([], /* @ts-ignore */
|
|
238
|
+
...(ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []));
|
|
86
239
|
dateSelected = new EventEmitter();
|
|
87
240
|
periodSelected = new EventEmitter();
|
|
88
241
|
DatepickerMode = DatepickerMode;
|
|
89
|
-
doubleCalendarWidth = 528; // 231px calendar table * 2 = 462 (+ 16px x-padding * 4 = 64)
|
|
90
242
|
localeConfig;
|
|
91
|
-
rangesConfig = input(null, /* @ts-ignore */
|
|
92
|
-
...(ngDevMode ? [{ debugName: "rangesConfig" }] : /* istanbul ignore next */ []));
|
|
93
|
-
ranges = {};
|
|
94
|
-
rangePickerWidth = 150;
|
|
95
|
-
width = 0;
|
|
96
243
|
pageSet = false;
|
|
97
244
|
maxDateStr = '';
|
|
98
245
|
minDateStr = '';
|
|
246
|
+
/** The same bounds as `minDateStr`/`maxDateStr`, kept as dayjs for the month pickers. */
|
|
247
|
+
maxDateValue = undefined;
|
|
248
|
+
minDateValue = undefined;
|
|
249
|
+
/** A field and not an inline literal: the template would rebuild the object on every pass. */
|
|
250
|
+
monthTriggerConfig = { style: 'ghost', color: 'grey' };
|
|
251
|
+
/** A getter and not a `computed`: `mode` is a plain `@Input`, which a computed would not track. */
|
|
252
|
+
get hasPresets() {
|
|
253
|
+
return this.presets().length > 0 && this.mode === DatepickerMode.Range;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Memoised, and a shared constant when empty, so the reference only changes when `presets` does.
|
|
257
|
+
* A fresh `ranges` object reaches the vendor's setter, which resets the calendars and drops the
|
|
258
|
+
* start anchor and the in-range preview of a selection still in progress.
|
|
259
|
+
*/
|
|
260
|
+
presetRanges = computed(() =>
|
|
261
|
+
// Annotated as a tuple: an inline array literal here infers as `(string | [Dayjs, Dayjs])[]`,
|
|
262
|
+
// which resolves `Object.fromEntries` to its untyped `any` overload instead of the typed one.
|
|
263
|
+
Object.fromEntries(this.presets().map(({ label, range }) => [label, range])), /* @ts-ignore */
|
|
264
|
+
...(ngDevMode ? [{ debugName: "presetRanges" }] : /* istanbul ignore next */ []));
|
|
265
|
+
get vendorRanges() {
|
|
266
|
+
return this.hasPresets ? this.presetRanges() : NO_RANGES;
|
|
267
|
+
}
|
|
99
268
|
constructor(changeDetectorRef, symbolRegistry) {
|
|
100
269
|
this.changeDetectorRef = changeDetectorRef;
|
|
101
270
|
this.symbolRegistry = symbolRegistry;
|
|
@@ -103,18 +272,9 @@ class DatepickerComponent {
|
|
|
103
272
|
}
|
|
104
273
|
ngOnInit() {
|
|
105
274
|
dayjs.extend(localeData);
|
|
106
|
-
const rangesConfig = this.rangesConfig();
|
|
107
|
-
if (rangesConfig) {
|
|
108
|
-
this.ranges = rangesConfig;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
// if config not defined - init default ranges
|
|
112
|
-
this.initRanges();
|
|
113
|
-
}
|
|
114
275
|
this.initDatePickerLocale();
|
|
115
276
|
}
|
|
116
277
|
ngOnChanges(changes) {
|
|
117
|
-
this.setWidth();
|
|
118
278
|
if (this.datepickerRef) {
|
|
119
279
|
setTimeout(() => {
|
|
120
280
|
this.datepickerRef.updateCalendars();
|
|
@@ -161,19 +321,14 @@ class DatepickerComponent {
|
|
|
161
321
|
firstDayOfWeekIndex = dayjs.localeData().firstDayOfWeek();
|
|
162
322
|
}
|
|
163
323
|
this.localeConfig = {
|
|
164
|
-
|
|
324
|
+
// The vendor demands this label, but the entry is never shown: it only revealed the
|
|
325
|
+
// calendars, which `alwaysShowCalendars` keeps visible anyway.
|
|
326
|
+
customRangeLabel: 'Custom',
|
|
165
327
|
daysOfWeek: dayjs.weekdaysMin(),
|
|
166
328
|
monthNames: dayjs.months(),
|
|
167
329
|
firstDay: firstDayOfWeekIndex,
|
|
168
330
|
};
|
|
169
331
|
}
|
|
170
|
-
initRanges() {
|
|
171
|
-
this.ranges[this.i18n.ranges.yesterday] = RangesConfigPreset.yesterday;
|
|
172
|
-
this.ranges[this.i18n.ranges.lastWeek] = RangesConfigPreset.lastWeek;
|
|
173
|
-
this.ranges[this.i18n.ranges.last30Days] = RangesConfigPreset.last30Days;
|
|
174
|
-
this.ranges[this.i18n.ranges.lastMonth] = RangesConfigPreset.lastMonth;
|
|
175
|
-
this.ranges[this.i18n.ranges.thisMonth] = RangesConfigPreset.thisMonth;
|
|
176
|
-
}
|
|
177
332
|
isCustomDate = (date) => {
|
|
178
333
|
const classes = [];
|
|
179
334
|
if (this.mode === DatepickerMode.Multiple) {
|
|
@@ -188,6 +343,11 @@ class DatepickerComponent {
|
|
|
188
343
|
if (dayjs().isSame(date, 'day') && !this.selectedPeriod?.startDate && !this.selectedPeriod?.endDate) {
|
|
189
344
|
classes.push('force-inactive');
|
|
190
345
|
}
|
|
346
|
+
// The picker only flags the days *between* start and hover as `in-range`, never the hovered one.
|
|
347
|
+
const hoveredDate = this.datepickerRef?.pickingDate ? this.datepickerRef?.nowHoveredDate : undefined;
|
|
348
|
+
if (hoveredDate && dayjs(date).isSame(dayjs(hoveredDate), 'day')) {
|
|
349
|
+
classes.push('hovered-end');
|
|
350
|
+
}
|
|
191
351
|
}
|
|
192
352
|
return classes;
|
|
193
353
|
};
|
|
@@ -198,25 +358,27 @@ class DatepickerComponent {
|
|
|
198
358
|
const date = event.startDate.toDate();
|
|
199
359
|
const dateLocalTime = new Date(date.getTime());
|
|
200
360
|
const dayJsDate = dayjs(dateLocalTime);
|
|
201
|
-
if (this.mode
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
this.datepickerRef.updateCalendars();
|
|
215
|
-
}
|
|
361
|
+
if (this.mode === DatepickerMode.Range) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
this.selectedDate = dayJsDate;
|
|
365
|
+
this.datepickerRef.setEndDate(dayJsDate);
|
|
366
|
+
if (this.pageSet) {
|
|
367
|
+
this.pageSet = false;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this.dateSelected.emit(dayJsDate.clone());
|
|
371
|
+
}
|
|
372
|
+
if (this.datepickerRef) {
|
|
373
|
+
this.datepickerRef.updateCalendars();
|
|
216
374
|
}
|
|
217
375
|
}
|
|
218
376
|
onDatesUpdated(event) {
|
|
219
|
-
|
|
377
|
+
// `autoApply` makes the vendor emit on the FIRST click of a range, with the end set equal
|
|
378
|
+
// to the start. Emitting that reads as a finished selection: a dropdown closes on it, so
|
|
379
|
+
// the second click never happens and no range wider than a day can be picked. While
|
|
380
|
+
// `pickingDate` is true the user is still choosing the end — say nothing yet.
|
|
381
|
+
if (this.mode === DatepickerMode.Range && !this.datepickerRef?.pickingDate) {
|
|
220
382
|
const startDate = event.startDate?.toDate();
|
|
221
383
|
const startDateLocalTime = startDate ? new Date(startDate.getTime()) : new Date();
|
|
222
384
|
const endDate = event.endDate?.toDate();
|
|
@@ -224,15 +386,44 @@ class DatepickerComponent {
|
|
|
224
386
|
this.periodSelected.emit({
|
|
225
387
|
startDate: dayjs(startDateLocalTime).startOf('day'),
|
|
226
388
|
endDate: dayjs(endDateLocalTime).endOf('day'),
|
|
389
|
+
preset: this.chosenPreset(),
|
|
227
390
|
});
|
|
228
391
|
}
|
|
229
392
|
if (this.datepickerRef) {
|
|
230
393
|
this.datepickerRef.updateCalendars();
|
|
394
|
+
// Nothing is emitted above, so nothing writes `selectedPeriod` back, `ngOnChanges` never
|
|
395
|
+
// runs and this OnPush panel keeps the previous cells. Render here for the start anchor.
|
|
396
|
+
this.changeDetectorRef.detectChanges();
|
|
231
397
|
}
|
|
232
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* The preset the current range came from. The vendor keeps `chosenRange` up to date both ways —
|
|
401
|
+
* `clickRange` writes the clicked label, `clickDate` resets it to `customRangeLabel` — and those
|
|
402
|
+
* labels are the keys of its `ranges` table, so they are unique. Matching on the label rather
|
|
403
|
+
* than on a position survives a translated or reordered shortcut.
|
|
404
|
+
*/
|
|
405
|
+
chosenPreset() {
|
|
406
|
+
const chosen = this.datepickerRef?.chosenRange;
|
|
407
|
+
return chosen ? this.presets().find(preset => preset.label === chosen) : undefined;
|
|
408
|
+
}
|
|
233
409
|
onNextMonth() {
|
|
234
410
|
this.datepickerRef.clickNext(SideEnum.right);
|
|
235
411
|
}
|
|
412
|
+
onLeftMonthPicked(picked) {
|
|
413
|
+
this.moveCalendarTo(picked, SideEnum.left);
|
|
414
|
+
}
|
|
415
|
+
onRightMonthPicked(picked) {
|
|
416
|
+
this.moveCalendarTo(picked, SideEnum.right);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The vendor moves the view only — never the selection — and clamps to its own min/max on the
|
|
420
|
+
* way, so the picker's disabled months are a second line of defence rather than the only one.
|
|
421
|
+
*/
|
|
422
|
+
moveCalendarTo({ month, year }, side) {
|
|
423
|
+
this.datepickerRef.monthOrYearChanged(month, year, side);
|
|
424
|
+
this.datepickerRef.updateCalendars();
|
|
425
|
+
this.changeDetectorRef.detectChanges();
|
|
426
|
+
}
|
|
236
427
|
onPreviousMonth() {
|
|
237
428
|
this.datepickerRef.clickPrev(SideEnum.left);
|
|
238
429
|
}
|
|
@@ -252,25 +443,17 @@ class DatepickerComponent {
|
|
|
252
443
|
}
|
|
253
444
|
this.changeDetectorRef.detectChanges();
|
|
254
445
|
}
|
|
255
|
-
setWidth() {
|
|
256
|
-
this.width =
|
|
257
|
-
this.showRanges && this.mode === DatepickerMode.Range
|
|
258
|
-
? this.doubleCalendarWidth + this.rangePickerWidth
|
|
259
|
-
: this.doubleCalendarWidth;
|
|
260
|
-
}
|
|
261
446
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SymbolRegistry }], target: i0.ɵɵFactoryTarget.Component });
|
|
262
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerComponent, isStandalone: true, selector: "ap-datepicker", inputs: { firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: false, isRequired: false, transformFunction: null }, i18n: { classPropertyName: "i18n", publicName: "i18n", isSignal: false, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: false, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: false, isRequired: false, transformFunction: null }, selectedDates: { classPropertyName: "selectedDates", publicName: "selectedDates", isSignal: false, isRequired: false, transformFunction: null }, selectedPeriod: { classPropertyName: "selectedPeriod", publicName: "selectedPeriod", isSignal: false, isRequired: false, transformFunction: null }, dateLimit: { classPropertyName: "dateLimit", publicName: "dateLimit", isSignal: true, isRequired: false, transformFunction: null }, showRanges: { classPropertyName: "showRanges", publicName: "showRanges", isSignal: false, isRequired: false, transformFunction: null }, showCustomRangeLabel: { classPropertyName: "showCustomRangeLabel", publicName: "showCustomRangeLabel", isSignal: true, isRequired: false, transformFunction: null }, rangesConfig: { classPropertyName: "rangesConfig", publicName: "rangesConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelected: "dateSelected", periodSelected: "periodSelected" }, viewQueries: [{ propertyName: "datepickerRef", first: true, predicate: ["datepickerRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"custom-calendar\"\n [style.width]=\"width + 'px'\">\n <div class=\"custom-header\">\n @if (datepickerRef.leftCalendar.month) {\n <div class=\"month-header\">\n <div\n class=\"month-arrow-button\"\n aria-label=\"Previous month\"\n tabindex=\"0\"\n (click)=\"onPreviousMonth()\">\n <ap-symbol\n symbolId=\"arrow-left\"\n [color]=\"'#858FA1'\"\n [size]=\"14\" />\n </div>\n <div class=\"month-label\">\n {{ datepickerRef.leftCalendar.month.locale(locale).format('MMMM YYYY') }}\n </div>\n </div>\n }\n @if (datepickerRef.rightCalendar.month) {\n <div class=\"month-header\">\n <div class=\"month-label\">\n {{ datepickerRef.rightCalendar.month.locale(locale).format('MMMM YYYY') }}\n </div>\n <div\n class=\"month-arrow-button\"\n aria-label=\"Next month\"\n tabindex=\"-1\"\n (click)=\"onNextMonth()\">\n <ap-symbol\n symbolId=\"arrow-right\"\n [color]=\"'#858FA1'\"\n [size]=\"14\" />\n </div>\n </div>\n }\n @if (showRanges && mode === DatepickerMode.Range) {\n <div class=\"header-filler\"></div>\n }\n </div>\n <ngx-daterangepicker-material\n #datepickerRef\n [class.hide-ranges]=\"!showRanges\"\n [alwaysShowCalendars]=\"true\"\n [autoApply]=\"true\"\n [customRangeDirection]=\"true\"\n [dateLimit]=\"dateLimit() ?? 0\"\n [linkedCalendars]=\"true\"\n [isCustomDate]=\"$any(isCustomDate)\"\n [locale]=\"localeConfig\"\n [maxDate]=\"maxDateStr\"\n [minDate]=\"minDateStr\"\n [ranges]=\"showRanges && mode === DatepickerMode.Range ? ranges : $any(null)\"\n [showCustomRangeLabel]=\"showCustomRangeLabel()\"\n (datesUpdated)=\"onDatesUpdated($event)\"\n (startDateChanged)=\"onStartDateChanged($event)\" />\n</div>\n", styles: ["[color=facebook]{color:#0866ff}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#0866ff}[border=facebook]{border:1px solid #0866ff}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=reddit]{color:#ff4500}[bgcolor=reddit],[hcolor=reddit]:hover{background-color:#ff4500}[border=reddit]{border:1px solid #ff4500}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #a566a5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #c7ab82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #f2713c}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #ffd006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94c5aa}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2a9d8f}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78acd8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525a9e}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6a2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729e}::ng-deep .custom-calendar{background-color:#fff;display:flex;flex-direction:column;justify-content:center;border-radius:4px;height:fit-content}::ng-deep .custom-calendar .custom-header{display:flex;align-items:center;justify-content:center;color:#344563;font-size:12px;font-weight:700;height:55px;text-transform:capitalize}::ng-deep .custom-calendar .custom-header .month-header{height:30px;width:255px;display:flex;align-items:center}::ng-deep .custom-calendar .custom-header .month-header .month-arrow-button{padding:10px;border-radius:2em;cursor:pointer}::ng-deep .custom-calendar .custom-header .month-header .month-arrow-button:hover{background-color:#eaecef}::ng-deep .custom-calendar .custom-header .month-header .month-label{flex:1;text-align:center}::ng-deep .custom-calendar .custom-header .header-filler{width:150px}::ng-deep .custom-calendar .md-drppicker{font-family:Averta;width:unset;height:219px;padding:0;margin:0 0 16px;box-shadow:none!important;z-index:0!important}::ng-deep .custom-calendar .md-drppicker .ranges{border-left:1px solid #eaecef;float:right!important;max-width:150px;height:100%;overflow-y:auto}::ng-deep .custom-calendar .md-drppicker .ranges ul li{margin-left:12px}::ng-deep .custom-calendar .md-drppicker .ranges ul li:hover{background:unset}::ng-deep .custom-calendar .md-drppicker .ranges ul li button{font-family:Averta;font-size:14px;border-radius:4px;color:#5d6a82}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:hover:not(.active):not(:disabled){color:#178dfe;background:#e8f4ff}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active{color:#fff;background:#178dfe}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active:hover{background:#3a9efe}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:disabled{color:#d6dae0;background:none;cursor:default}::ng-deep .custom-calendar .md-drppicker .month{cursor:auto}::ng-deep .custom-calendar .md-drppicker .calendar{margin:0!important;padding:0 16px}::ng-deep .custom-calendar .md-drppicker .calendar.left{border-right:1px solid #eaecef}::ng-deep .custom-calendar .md-drppicker .calendar-table{width:231px;padding:0!important;border:none!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table{border-spacing:0 5px!important;height:184px}::ng-deep .custom-calendar .md-drppicker .calendar-table table td,::ng-deep .custom-calendar .md-drppicker .calendar-table table th{height:unset;border:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead{line-height:10px}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr:first-child{display:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th{color:#aeb5c1;font-weight:700;font-size:12px;text-transform:capitalize;padding-bottom:10px}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.month,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.prev,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.next{color:#344563}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.prev,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.next{font-size:16px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.in-range{border-radius:0 2em 2em 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.in-range{border-radius:2em 0 0 2em}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td{opacity:1!important;border-spacing:0;height:27px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td span{width:27px!important;height:27px!important;border-radius:50%;display:flex;align-items:center;justify-content:center;margin-left:3px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive){background-color:#e8f4ff!important;color:#344563!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){border-radius:2em 0 0 2em;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:0 2em 2em 0;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.force-inactive).start-date.end-date.range-picker-mode:not(.off){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.force-inactive).start-date.end-date.range-picker-mode:not(.off) span{border-radius:2em;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.start-date):not(.end-date):hover span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.today.force-inactive:hover span{background-color:#d1e8ff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.start-date):not(.end-date):hover:not(.in-range),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.today.force-inactive:hover:not(.in-range){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.in-range:not(.start-date):not(.end-date):hover{border-radius:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.off{background-color:unset!important;color:#d6dae0!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.off):not(.range-picker-mode):not(.force-inactive),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:hover:not(.off):not(.range-picker-mode){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.off):not(.range-picker-mode):not(.force-inactive) span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:hover:not(.off):not(.range-picker-mode) span{background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.force-inactive{background-color:unset!important;color:#5d6a82}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off) span{border:1px solid #178dfe;color:#5d6a82;height:25px!important;width:25px!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off).start-date:not(.force-inactive) span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off).end-date:not(.force-inactive) span{color:#fff}.hide-ranges ::ng-deep .ranges{display:none}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "ngmodule", type: NgxDaterangepickerMd }, { kind: "component", type: i2.DaterangepickerComponent, selector: "ngx-daterangepicker-material", inputs: ["startDate", "endDate", "dateLimit", "autoApply", "singleDatePicker", "showDropdowns", "showWeekNumbers", "showISOWeekNumbers", "linkedCalendars", "autoUpdateInput", "alwaysShowCalendars", "maxSpan", "lockStartDate", "timePicker", "timePicker24Hour", "timePickerIncrement", "timePickerSeconds", "showClearButton", "firstMonthDayClass", "lastMonthDayClass", "emptyWeekRowClass", "emptyWeekColumnClass", "firstDayOfNextMonthClass", "lastDayOfPreviousMonthClass", "showCustomRangeLabel", "showCancel", "keepCalendarOpeningWithRange", "showRangeLabelOnInput", "customRangeDirection", "drops", "opens", "closeOnAutoApply", "minDate", "locale", "ranges", "maxDate", "isInvalidDate", "isCustomDate", "isTooltipDate"], outputs: ["choosedDate", "rangeClicked", "datesUpdated", "startDateChanged", "endDateChanged", "cancelClicked", "clearClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
447
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerComponent, isStandalone: true, selector: "ap-datepicker", inputs: { firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: false, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: false, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: false, isRequired: false, transformFunction: null }, selectedDates: { classPropertyName: "selectedDates", publicName: "selectedDates", isSignal: false, isRequired: false, transformFunction: null }, selectedPeriod: { classPropertyName: "selectedPeriod", publicName: "selectedPeriod", isSignal: false, isRequired: false, transformFunction: null }, dateLimit: { classPropertyName: "dateLimit", publicName: "dateLimit", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelected: "dateSelected", periodSelected: "periodSelected" }, viewQueries: [{ propertyName: "datepickerRef", first: true, predicate: ["datepickerRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"custom-calendar\"\n [class.single-month]=\"mode !== DatepickerMode.Range\">\n <div class=\"custom-header\">\n @if (datepickerRef.leftCalendar.month) {\n <div class=\"month-header\">\n <ap-icon-button\n symbolId=\"arrow-left\"\n ariaLabel=\"Previous month\"\n (onClick)=\"onPreviousMonth()\" />\n <ap-button\n class=\"month-label\"\n symbolId=\"chevron-down\"\n [apDropdownTrigger]=\"leftMonthPicker\"\n [config]=\"monthTriggerConfig\">\n <span class=\"month-label-text\">{{ datepickerRef.leftCalendar.month.locale(locale).format('MMMM YYYY') }}</span>\n </ap-button>\n <ap-datepicker-month-picker\n #leftMonthPicker\n [locale]=\"locale\"\n [maxDate]=\"maxDateValue\"\n [minDate]=\"minDateValue\"\n [month]=\"datepickerRef.leftCalendar.month.month()\"\n [year]=\"datepickerRef.leftCalendar.month.year()\"\n (monthSelected)=\"onLeftMonthPicked($event)\" />\n <!-- Outside Range a single month is rendered, so both arrows frame its header. -->\n @if (mode !== DatepickerMode.Range) {\n <ap-icon-button\n symbolId=\"arrow-right\"\n ariaLabel=\"Next month\"\n (onClick)=\"onNextMonth()\" />\n }\n </div>\n }\n @if (mode === DatepickerMode.Range && datepickerRef.rightCalendar.month) {\n <div class=\"month-header\">\n <ap-button\n class=\"month-label\"\n symbolId=\"chevron-down\"\n [apDropdownTrigger]=\"rightMonthPicker\"\n [config]=\"monthTriggerConfig\">\n <span class=\"month-label-text\">{{ datepickerRef.rightCalendar.month.locale(locale).format('MMMM YYYY') }}</span>\n </ap-button>\n <ap-datepicker-month-picker\n #rightMonthPicker\n [locale]=\"locale\"\n [maxDate]=\"maxDateValue\"\n [minDate]=\"minDateValue\"\n [month]=\"datepickerRef.rightCalendar.month.month()\"\n [year]=\"datepickerRef.rightCalendar.month.year()\"\n (monthSelected)=\"onRightMonthPicked($event)\" />\n <ap-icon-button\n symbolId=\"arrow-right\"\n ariaLabel=\"Next month\"\n (onClick)=\"onNextMonth()\" />\n </div>\n }\n </div>\n <!--\n `showDropdowns` is on not for its own selects \u2014 those render into the header row we hide \u2014\n but because the vendor only maintains `calendarVariables[side].dropdowns` while it is, and\n that is what `monthOrYearChanged` reads to move a calendar.\n -->\n <ngx-daterangepicker-material\n #datepickerRef\n [class.hide-ranges]=\"!hasPresets\"\n [alwaysShowCalendars]=\"true\"\n [autoApply]=\"true\"\n [customRangeDirection]=\"true\"\n [dateLimit]=\"dateLimit() ?? 0\"\n [linkedCalendars]=\"true\"\n [isCustomDate]=\"$any(isCustomDate)\"\n [locale]=\"localeConfig\"\n [maxDate]=\"maxDateStr\"\n [minDate]=\"minDateStr\"\n [ranges]=\"vendorRanges\"\n [showCustomRangeLabel]=\"false\"\n [showDropdowns]=\"true\"\n [singleDatePicker]=\"mode !== DatepickerMode.Range\"\n (datesUpdated)=\"onDatesUpdated($event)\"\n (startDateChanged)=\"onStartDateChanged($event)\" />\n</div>\n", styles: ["::ng-deep .custom-calendar{display:flex;flex-direction:column;width:max-content;height:fit-content;border-radius:var(--ref-border-radius-md);background-color:var(--ref-color-white);font-family:var(--sys-text-style-body-font-family)}::ng-deep .custom-calendar.single-month .md-drppicker .calendar.right{padding-left:0}::ng-deep .custom-calendar.single-month .custom-header{width:224px}::ng-deep .custom-calendar.single-month .custom-header .month-header:first-child{padding-right:0}::ng-deep .custom-calendar .custom-header{display:flex;align-items:center;width:calc(14 * 32px + 2 * var(--ref-spacing-sm) + 1px);height:var(--comp-icon-button-height);gap:calc(2 * var(--ref-spacing-sm) + 1px);color:var(--ref-color-grey-100);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height);text-transform:capitalize}::ng-deep .custom-calendar .custom-header .month-header{display:flex;width:224px;align-items:center;height:var(--comp-icon-button-height)}::ng-deep .custom-calendar .custom-header .month-header:first-child{padding-right:var(--comp-icon-button-width)}::ng-deep .custom-calendar .custom-header .month-header:nth-child(2){padding-left:var(--comp-icon-button-width)}::ng-deep .custom-calendar .custom-header .month-header .month-label{display:flex;flex:1;min-width:0;justify-content:center;--comp-button-padding-vertical: var(--ref-spacing-xxs)}::ng-deep .custom-calendar .custom-header .month-header .month-label button{min-width:0}::ng-deep .custom-calendar .custom-header .month-header .month-label-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}::ng-deep .custom-calendar .md-drppicker{display:flex!important;width:unset;height:auto;margin:0;padding:0;overflow:visible;box-shadow:none;z-index:0;font-family:var(--sys-text-style-body-font-family)}::ng-deep .custom-calendar .md-drppicker .month{cursor:auto}::ng-deep .custom-calendar .md-drppicker .calendar{margin:0}::ng-deep .custom-calendar .md-drppicker .calendar.left{order:1;float:none;padding:0 var(--ref-spacing-sm) 0 0;border-right:1px solid var(--ref-color-grey-10)}::ng-deep .custom-calendar .md-drppicker .calendar.right{order:2;float:none;padding:0 0 0 var(--ref-spacing-sm)}::ng-deep .custom-calendar .md-drppicker .ranges{order:3;float:none!important;box-sizing:content-box;width:130px;max-width:none;height:calc(var(--comp-icon-button-height) + 7 * 32px + 8 * var(--ref-spacing-xxxs));margin-top:calc(-1 * var(--comp-icon-button-height));margin-left:var(--ref-spacing-sm);padding:0 0 0 var(--ref-spacing-sm);border-left:1px solid var(--ref-color-grey-10);overflow-y:auto}::ng-deep .custom-calendar .md-drppicker .ranges ul li{margin-left:0}::ng-deep .custom-calendar .md-drppicker .ranges ul li:hover{background:unset}::ng-deep .custom-calendar .md-drppicker .ranges ul li button{display:flex;align-items:center;min-height:var(--sys-button-height);padding:var(--ref-spacing-xxxs) var(--ref-spacing-xs);border-radius:var(--ref-border-radius-sm);background:none;color:var(--ref-color-grey-100);font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height);transition:background-color var(--ref-animation-short) ease,color var(--ref-animation-short) ease}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:hover:not(.active):not(:disabled){background:var(--ref-color-grey-10);color:var(--ref-color-grey-100)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:active:not(.active):not(:disabled){background:var(--ref-color-grey-20)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:focus-visible{outline:none;background:var(--ref-color-grey-10);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active{background:var(--ref-color-electric-blue-20);color:var(--ref-color-electric-blue-150);font-weight:var(--sys-text-style-body-bold-weight)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:disabled{background:none;color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table{width:224px;padding:0!important;border:none!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table{border-spacing:0 var(--ref-spacing-xxxs);height:auto}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead{line-height:normal}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr:first-child{display:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th{height:32px;border:none;color:var(--ref-color-grey-100);font-family:var(--sys-text-style-body-bold-font-family);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height);text-transform:capitalize}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td{height:32px;padding:0;border:none;border-radius:0;opacity:1;color:var(--ref-color-grey-100);transition:background-color var(--ref-animation-short) ease}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td span{display:flex;align-items:center;justify-content:center;width:100%;height:32px;margin:0;border:none;border-radius:0;background-color:transparent;color:inherit;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.off):not(.in-range):not(.hovered-end):hover{border-radius:var(--ref-border-radius-sm);background-color:var(--ref-color-grey-10)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.off):not(.in-range):not(.hovered-end):active{background-color:var(--ref-color-grey-20)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.off{background-color:transparent;color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.disabled{color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.force-inactive:not(.off){background-color:transparent;color:var(--ref-color-grey-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off):not(.in-range):not(.active):not(.hovered-end),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today.force-inactive:not(.off):not(.hovered-end){border-radius:var(--ref-border-radius-sm);box-shadow:inset 0 0 0 1px var(--ref-color-grey-60)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive){background-color:var(--ref-color-electric-blue-20);color:var(--ref-color-electric-blue-150);font-weight:var(--sys-text-style-body-bold-weight)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive):not(.start-date):not(.end-date):hover{background-color:var(--ref-color-electric-blue-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive):not(.start-date):not(.end-date):active{background-color:var(--ref-color-electric-blue-60)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.in-range{border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.in-range{border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.in-range:not(.start-date):not(.end-date):hover{border-radius:0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.available.in-range:not(.start-date):not(.end-date):hover{border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.available.in-range:not(.start-date):not(.end-date):hover{border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.active.start-date:not(.end-date).range-picker-mode:not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off):hover,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off):active,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off){border-radius:var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.hovered-end:not(.off):not(.start-date):not(.end-date){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none;border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.available.hovered-end:not(.off):not(.start-date):not(.end-date){border-radius:var(--ref-border-radius-sm)}.hide-ranges ::ng-deep .ranges{display:none}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: DatepickerMonthPickerComponent, selector: "ap-datepicker-month-picker", inputs: ["month", "year", "locale", "minDate", "maxDate"], outputs: ["monthSelected"] }, { kind: "directive", type: DropdownTriggerDirective, selector: "[apDropdownTrigger]", inputs: ["apDropdownTrigger"] }, { kind: "component", type: IconButtonComponent, selector: "ap-icon-button", inputs: ["ariaLabel", "name", "color", "disabled", "menuTrigger", "symbolId", "locked", "loading", "type"], outputs: ["onClick", "onFocus", "onBlur", "menuOpened", "menuClosed"] }, { kind: "ngmodule", type: NgxDaterangepickerMd }, { kind: "component", type: i2.DaterangepickerComponent, selector: "ngx-daterangepicker-material", inputs: ["startDate", "endDate", "dateLimit", "autoApply", "singleDatePicker", "showDropdowns", "showWeekNumbers", "showISOWeekNumbers", "linkedCalendars", "autoUpdateInput", "alwaysShowCalendars", "maxSpan", "lockStartDate", "timePicker", "timePicker24Hour", "timePickerIncrement", "timePickerSeconds", "showClearButton", "firstMonthDayClass", "lastMonthDayClass", "emptyWeekRowClass", "emptyWeekColumnClass", "firstDayOfNextMonthClass", "lastDayOfPreviousMonthClass", "showCustomRangeLabel", "showCancel", "keepCalendarOpeningWithRange", "showRangeLabelOnInput", "customRangeDirection", "drops", "opens", "closeOnAutoApply", "minDate", "locale", "ranges", "maxDate", "isInvalidDate", "isCustomDate", "isTooltipDate"], outputs: ["choosedDate", "rangeClicked", "datesUpdated", "startDateChanged", "endDateChanged", "cancelClicked", "clearClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
263
448
|
}
|
|
264
449
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
265
450
|
type: Component,
|
|
266
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker', imports: [SymbolComponent, NgxDaterangepickerMd], template: "<div\n class=\"custom-calendar\"\n [style.width]=\"width + 'px'\">\n <div class=\"custom-header\">\n @if (datepickerRef.leftCalendar.month) {\n <div class=\"month-header\">\n <div\n class=\"month-arrow-button\"\n aria-label=\"Previous month\"\n tabindex=\"0\"\n (click)=\"onPreviousMonth()\">\n <ap-symbol\n symbolId=\"arrow-left\"\n [color]=\"'#858FA1'\"\n [size]=\"14\" />\n </div>\n <div class=\"month-label\">\n {{ datepickerRef.leftCalendar.month.locale(locale).format('MMMM YYYY') }}\n </div>\n </div>\n }\n @if (datepickerRef.rightCalendar.month) {\n <div class=\"month-header\">\n <div class=\"month-label\">\n {{ datepickerRef.rightCalendar.month.locale(locale).format('MMMM YYYY') }}\n </div>\n <div\n class=\"month-arrow-button\"\n aria-label=\"Next month\"\n tabindex=\"-1\"\n (click)=\"onNextMonth()\">\n <ap-symbol\n symbolId=\"arrow-right\"\n [color]=\"'#858FA1'\"\n [size]=\"14\" />\n </div>\n </div>\n }\n @if (showRanges && mode === DatepickerMode.Range) {\n <div class=\"header-filler\"></div>\n }\n </div>\n <ngx-daterangepicker-material\n #datepickerRef\n [class.hide-ranges]=\"!showRanges\"\n [alwaysShowCalendars]=\"true\"\n [autoApply]=\"true\"\n [customRangeDirection]=\"true\"\n [dateLimit]=\"dateLimit() ?? 0\"\n [linkedCalendars]=\"true\"\n [isCustomDate]=\"$any(isCustomDate)\"\n [locale]=\"localeConfig\"\n [maxDate]=\"maxDateStr\"\n [minDate]=\"minDateStr\"\n [ranges]=\"showRanges && mode === DatepickerMode.Range ? ranges : $any(null)\"\n [showCustomRangeLabel]=\"showCustomRangeLabel()\"\n (datesUpdated)=\"onDatesUpdated($event)\"\n (startDateChanged)=\"onStartDateChanged($event)\" />\n</div>\n", styles: ["[color=facebook]{color:#0866ff}[bgcolor=facebook],[hcolor=facebook]:hover{background-color:#0866ff}[border=facebook]{border:1px solid #0866ff}[color=google]{color:#4e85e8}[bgcolor=google],[hcolor=google]:hover{background-color:#4e85e8}[border=google]{border:1px solid #4e85e8}[color=instagram]{color:#e1306c}[bgcolor=instagram],[hcolor=instagram]:hover{background-color:#e1306c}[border=instagram]{border:1px solid #e1306c}[color=instagrammagenta]{color:#c13584}[bgcolor=instagrammagenta],[hcolor=instagrammagenta]:hover{background-color:#c13584}[border=instagrammagenta]{border:1px solid #c13584}[color=instagramblue]{color:#5851db}[bgcolor=instagramblue],[hcolor=instagramblue]:hover{background-color:#5851db}[border=instagramblue]{border:1px solid #5851db}[color=instagrampurple]{color:#833ab4}[bgcolor=instagrampurple],[hcolor=instagrampurple]:hover{background-color:#833ab4}[border=instagrampurple]{border:1px solid #833ab4}[color=instagramorange]{color:#f56040}[bgcolor=instagramorange],[hcolor=instagramorange]:hover{background-color:#f56040}[border=instagramorange]{border:1px solid #f56040}[color=instagramyellow]{color:#ffdc80}[bgcolor=instagramyellow],[hcolor=instagramyellow]:hover{background-color:#ffdc80}[border=instagramyellow]{border:1px solid #ffdc80}[color=linkedin]{color:#2c67bc}[bgcolor=linkedin],[hcolor=linkedin]:hover{background-color:#2c67bc}[border=linkedin]{border:1px solid #2c67bc}[color=twitter]{color:#55acee}[bgcolor=twitter],[hcolor=twitter]:hover{background-color:#55acee}[border=twitter]{border:1px solid #55acee}[color=youtube]{color:red}[bgcolor=youtube],[hcolor=youtube]:hover{background-color:red}[border=youtube]{border:1px solid #ff0000}[color=reddit]{color:#ff4500}[bgcolor=reddit],[hcolor=reddit]:hover{background-color:#ff4500}[border=reddit]{border:1px solid #ff4500}[color=blood-orange]{color:#ff4d00}[bgcolor=blood-orange],[hcolor=blood-orange]:hover{background-color:#ff4d00}[border=blood-orange]{border:1px solid #ff4d00}[color=pinkish-orange]{color:#ff7b49}[bgcolor=pinkish-orange],[hcolor=pinkish-orange]:hover{background-color:#ff7b49}[border=pinkish-orange]{border:1px solid #ff7b49}[color=charcoal-grey]{color:#2a2f34}[bgcolor=charcoal-grey],[hcolor=charcoal-grey]:hover{background-color:#2a2f34}[border=charcoal-grey]{border:1px solid #2a2f34}[color=azure]{color:#00aeef}[bgcolor=azure],[hcolor=azure]:hover{background-color:#00aeef}[border=azure]{border:1px solid #00aeef}[color=light-azure]{color:#eaf5fd}[bgcolor=light-azure],[hcolor=light-azure]:hover{background-color:#eaf5fd}[border=light-azure]{border:1px solid #eaf5fd}[color=blue-grey]{color:#8d98a9}[bgcolor=blue-grey],[hcolor=blue-grey]:hover{background-color:#8d98a9}[border=blue-grey]{border:1px solid #8d98a9}[color=silver]{color:#ced0da}[bgcolor=silver],[hcolor=silver]:hover{background-color:#ced0da}[border=silver]{border:1px solid #ced0da}[color=pale-grey]{color:#dfe3e9}[bgcolor=pale-grey],[hcolor=pale-grey]:hover{background-color:#dfe3e9}[border=pale-grey]{border:1px solid #dfe3e9}[color=grey-white]{color:#f5f7f8}[bgcolor=grey-white],[hcolor=grey-white]:hover{background-color:#f5f7f8}[border=grey-white]{border:1px solid #f5f7f8}[color=cool-grey]{color:#b4bbc6}[bgcolor=cool-grey],[hcolor=cool-grey]:hover{background-color:#b4bbc6}[border=cool-grey]{border:1px solid #b4bbc6}[color=black]{color:#344563}[bgcolor=black],[hcolor=black]:hover{background-color:#344563}[border=black]{border:1px solid #344563}[color=grey-blue]{color:#68768c}[bgcolor=grey-blue],[hcolor=grey-blue]:hover{background-color:#68768c}[border=grey-blue]{border:1px solid #68768c}[color=strawberry]{color:#f4282d}[bgcolor=strawberry],[hcolor=strawberry]:hover{background-color:#f4282d}[border=strawberry]{border:1px solid #f4282d}[color=light-strawberry]{color:#f8eded}[bgcolor=light-strawberry],[hcolor=light-strawberry]:hover{background-color:#f8eded}[border=light-strawberry]{border:1px solid #f8eded}[color=white]{color:#fff}[bgcolor=white],[hcolor=white]:hover{background-color:#fff}[border=white]{border:1px solid #ffffff}[color=cool-green]{color:#33c15d}[bgcolor=cool-green],[hcolor=cool-green]:hover{background-color:#33c15d}[border=cool-green]{border:1px solid #33c15d}[color=light-green]{color:#ebfaef}[bgcolor=light-green],[hcolor=light-green]:hover{background-color:#ebfaef}[border=light-green]{border:1px solid #ebfaef}[color=transparent]{color:transparent}[bgcolor=transparent],[hcolor=transparent]:hover{background-color:transparent}[border=transparent]{border:1px solid transparent}[color=c0]{color:#a566a5}[bgcolor=c0],[hcolor=c0]:hover{background-color:#a566a5}[border=c0]{border:1px solid #a566a5}[color=c1]{color:#c7ab82}[bgcolor=c1],[hcolor=c1]:hover{background-color:#c7ab82}[border=c1]{border:1px solid #c7ab82}[color=c2]{color:#f2713c}[bgcolor=c2],[hcolor=c2]:hover{background-color:#f2713c}[border=c2]{border:1px solid #f2713c}[color=c3]{color:#ffd006}[bgcolor=c3],[hcolor=c3]:hover{background-color:#ffd006}[border=c3]{border:1px solid #ffd006}[color=c4]{color:#94c5aa}[bgcolor=c4],[hcolor=c4]:hover{background-color:#94c5aa}[border=c4]{border:1px solid #94c5aa}[color=c5]{color:#2a9d8f}[bgcolor=c5],[hcolor=c5]:hover{background-color:#2a9d8f}[border=c5]{border:1px solid #2a9d8f}[color=c6]{color:#78acd8}[bgcolor=c6],[hcolor=c6]:hover{background-color:#78acd8}[border=c6]{border:1px solid #78acd8}[color=c7]{color:#525a9e}[bgcolor=c7],[hcolor=c7]:hover{background-color:#525a9e}[border=c7]{border:1px solid #525a9e}[color=c8]{color:#6a2459}[bgcolor=c8],[hcolor=c8]:hover{background-color:#6a2459}[border=c8]{border:1px solid #6a2459}[color=c9]{color:#74729e}[bgcolor=c9],[hcolor=c9]:hover{background-color:#74729e}[border=c9]{border:1px solid #74729e}::ng-deep .custom-calendar{background-color:#fff;display:flex;flex-direction:column;justify-content:center;border-radius:4px;height:fit-content}::ng-deep .custom-calendar .custom-header{display:flex;align-items:center;justify-content:center;color:#344563;font-size:12px;font-weight:700;height:55px;text-transform:capitalize}::ng-deep .custom-calendar .custom-header .month-header{height:30px;width:255px;display:flex;align-items:center}::ng-deep .custom-calendar .custom-header .month-header .month-arrow-button{padding:10px;border-radius:2em;cursor:pointer}::ng-deep .custom-calendar .custom-header .month-header .month-arrow-button:hover{background-color:#eaecef}::ng-deep .custom-calendar .custom-header .month-header .month-label{flex:1;text-align:center}::ng-deep .custom-calendar .custom-header .header-filler{width:150px}::ng-deep .custom-calendar .md-drppicker{font-family:Averta;width:unset;height:219px;padding:0;margin:0 0 16px;box-shadow:none!important;z-index:0!important}::ng-deep .custom-calendar .md-drppicker .ranges{border-left:1px solid #eaecef;float:right!important;max-width:150px;height:100%;overflow-y:auto}::ng-deep .custom-calendar .md-drppicker .ranges ul li{margin-left:12px}::ng-deep .custom-calendar .md-drppicker .ranges ul li:hover{background:unset}::ng-deep .custom-calendar .md-drppicker .ranges ul li button{font-family:Averta;font-size:14px;border-radius:4px;color:#5d6a82}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:hover:not(.active):not(:disabled){color:#178dfe;background:#e8f4ff}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active{color:#fff;background:#178dfe}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active:hover{background:#3a9efe}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:disabled{color:#d6dae0;background:none;cursor:default}::ng-deep .custom-calendar .md-drppicker .month{cursor:auto}::ng-deep .custom-calendar .md-drppicker .calendar{margin:0!important;padding:0 16px}::ng-deep .custom-calendar .md-drppicker .calendar.left{border-right:1px solid #eaecef}::ng-deep .custom-calendar .md-drppicker .calendar-table{width:231px;padding:0!important;border:none!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table{border-spacing:0 5px!important;height:184px}::ng-deep .custom-calendar .md-drppicker .calendar-table table td,::ng-deep .custom-calendar .md-drppicker .calendar-table table th{height:unset;border:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead{line-height:10px}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr:first-child{display:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th{color:#aeb5c1;font-weight:700;font-size:12px;text-transform:capitalize;padding-bottom:10px}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.month,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.prev,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.next{color:#344563}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.prev,::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th.next{font-size:16px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.in-range{border-radius:0 2em 2em 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.in-range{border-radius:2em 0 0 2em}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td{opacity:1!important;border-spacing:0;height:27px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td span{width:27px!important;height:27px!important;border-radius:50%;display:flex;align-items:center;justify-content:center;margin-left:3px}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive){background-color:#e8f4ff!important;color:#344563!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){border-radius:2em 0 0 2em;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:0 2em 2em 0;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.force-inactive).start-date.end-date.range-picker-mode:not(.off){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.force-inactive).start-date.end-date.range-picker-mode:not(.off) span{border-radius:2em;background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.start-date):not(.end-date):hover span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.today.force-inactive:hover span{background-color:#d1e8ff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.start-date):not(.end-date):hover:not(.in-range),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.today.force-inactive:hover:not(.in-range){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.in-range:not(.start-date):not(.end-date):hover{border-radius:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.off{background-color:unset!important;color:#d6dae0!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.off):not(.range-picker-mode):not(.force-inactive),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:hover:not(.off):not(.range-picker-mode){background-color:unset!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.off):not(.range-picker-mode):not(.force-inactive) span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:hover:not(.off):not(.range-picker-mode) span{background-color:#178dfe!important;color:#fff!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.force-inactive{background-color:unset!important;color:#5d6a82}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off) span{border:1px solid #178dfe;color:#5d6a82;height:25px!important;width:25px!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off).start-date:not(.force-inactive) span,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off).end-date:not(.force-inactive) span{color:#fff}.hide-ranges ::ng-deep .ranges{display:none}\n"] }]
|
|
451
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker', imports: [ButtonComponent, DatepickerMonthPickerComponent, DropdownTriggerDirective, IconButtonComponent, NgxDaterangepickerMd], template: "<div\n class=\"custom-calendar\"\n [class.single-month]=\"mode !== DatepickerMode.Range\">\n <div class=\"custom-header\">\n @if (datepickerRef.leftCalendar.month) {\n <div class=\"month-header\">\n <ap-icon-button\n symbolId=\"arrow-left\"\n ariaLabel=\"Previous month\"\n (onClick)=\"onPreviousMonth()\" />\n <ap-button\n class=\"month-label\"\n symbolId=\"chevron-down\"\n [apDropdownTrigger]=\"leftMonthPicker\"\n [config]=\"monthTriggerConfig\">\n <span class=\"month-label-text\">{{ datepickerRef.leftCalendar.month.locale(locale).format('MMMM YYYY') }}</span>\n </ap-button>\n <ap-datepicker-month-picker\n #leftMonthPicker\n [locale]=\"locale\"\n [maxDate]=\"maxDateValue\"\n [minDate]=\"minDateValue\"\n [month]=\"datepickerRef.leftCalendar.month.month()\"\n [year]=\"datepickerRef.leftCalendar.month.year()\"\n (monthSelected)=\"onLeftMonthPicked($event)\" />\n <!-- Outside Range a single month is rendered, so both arrows frame its header. -->\n @if (mode !== DatepickerMode.Range) {\n <ap-icon-button\n symbolId=\"arrow-right\"\n ariaLabel=\"Next month\"\n (onClick)=\"onNextMonth()\" />\n }\n </div>\n }\n @if (mode === DatepickerMode.Range && datepickerRef.rightCalendar.month) {\n <div class=\"month-header\">\n <ap-button\n class=\"month-label\"\n symbolId=\"chevron-down\"\n [apDropdownTrigger]=\"rightMonthPicker\"\n [config]=\"monthTriggerConfig\">\n <span class=\"month-label-text\">{{ datepickerRef.rightCalendar.month.locale(locale).format('MMMM YYYY') }}</span>\n </ap-button>\n <ap-datepicker-month-picker\n #rightMonthPicker\n [locale]=\"locale\"\n [maxDate]=\"maxDateValue\"\n [minDate]=\"minDateValue\"\n [month]=\"datepickerRef.rightCalendar.month.month()\"\n [year]=\"datepickerRef.rightCalendar.month.year()\"\n (monthSelected)=\"onRightMonthPicked($event)\" />\n <ap-icon-button\n symbolId=\"arrow-right\"\n ariaLabel=\"Next month\"\n (onClick)=\"onNextMonth()\" />\n </div>\n }\n </div>\n <!--\n `showDropdowns` is on not for its own selects \u2014 those render into the header row we hide \u2014\n but because the vendor only maintains `calendarVariables[side].dropdowns` while it is, and\n that is what `monthOrYearChanged` reads to move a calendar.\n -->\n <ngx-daterangepicker-material\n #datepickerRef\n [class.hide-ranges]=\"!hasPresets\"\n [alwaysShowCalendars]=\"true\"\n [autoApply]=\"true\"\n [customRangeDirection]=\"true\"\n [dateLimit]=\"dateLimit() ?? 0\"\n [linkedCalendars]=\"true\"\n [isCustomDate]=\"$any(isCustomDate)\"\n [locale]=\"localeConfig\"\n [maxDate]=\"maxDateStr\"\n [minDate]=\"minDateStr\"\n [ranges]=\"vendorRanges\"\n [showCustomRangeLabel]=\"false\"\n [showDropdowns]=\"true\"\n [singleDatePicker]=\"mode !== DatepickerMode.Range\"\n (datesUpdated)=\"onDatesUpdated($event)\"\n (startDateChanged)=\"onStartDateChanged($event)\" />\n</div>\n", styles: ["::ng-deep .custom-calendar{display:flex;flex-direction:column;width:max-content;height:fit-content;border-radius:var(--ref-border-radius-md);background-color:var(--ref-color-white);font-family:var(--sys-text-style-body-font-family)}::ng-deep .custom-calendar.single-month .md-drppicker .calendar.right{padding-left:0}::ng-deep .custom-calendar.single-month .custom-header{width:224px}::ng-deep .custom-calendar.single-month .custom-header .month-header:first-child{padding-right:0}::ng-deep .custom-calendar .custom-header{display:flex;align-items:center;width:calc(14 * 32px + 2 * var(--ref-spacing-sm) + 1px);height:var(--comp-icon-button-height);gap:calc(2 * var(--ref-spacing-sm) + 1px);color:var(--ref-color-grey-100);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height);text-transform:capitalize}::ng-deep .custom-calendar .custom-header .month-header{display:flex;width:224px;align-items:center;height:var(--comp-icon-button-height)}::ng-deep .custom-calendar .custom-header .month-header:first-child{padding-right:var(--comp-icon-button-width)}::ng-deep .custom-calendar .custom-header .month-header:nth-child(2){padding-left:var(--comp-icon-button-width)}::ng-deep .custom-calendar .custom-header .month-header .month-label{display:flex;flex:1;min-width:0;justify-content:center;--comp-button-padding-vertical: var(--ref-spacing-xxs)}::ng-deep .custom-calendar .custom-header .month-header .month-label button{min-width:0}::ng-deep .custom-calendar .custom-header .month-header .month-label-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}::ng-deep .custom-calendar .md-drppicker{display:flex!important;width:unset;height:auto;margin:0;padding:0;overflow:visible;box-shadow:none;z-index:0;font-family:var(--sys-text-style-body-font-family)}::ng-deep .custom-calendar .md-drppicker .month{cursor:auto}::ng-deep .custom-calendar .md-drppicker .calendar{margin:0}::ng-deep .custom-calendar .md-drppicker .calendar.left{order:1;float:none;padding:0 var(--ref-spacing-sm) 0 0;border-right:1px solid var(--ref-color-grey-10)}::ng-deep .custom-calendar .md-drppicker .calendar.right{order:2;float:none;padding:0 0 0 var(--ref-spacing-sm)}::ng-deep .custom-calendar .md-drppicker .ranges{order:3;float:none!important;box-sizing:content-box;width:130px;max-width:none;height:calc(var(--comp-icon-button-height) + 7 * 32px + 8 * var(--ref-spacing-xxxs));margin-top:calc(-1 * var(--comp-icon-button-height));margin-left:var(--ref-spacing-sm);padding:0 0 0 var(--ref-spacing-sm);border-left:1px solid var(--ref-color-grey-10);overflow-y:auto}::ng-deep .custom-calendar .md-drppicker .ranges ul li{margin-left:0}::ng-deep .custom-calendar .md-drppicker .ranges ul li:hover{background:unset}::ng-deep .custom-calendar .md-drppicker .ranges ul li button{display:flex;align-items:center;min-height:var(--sys-button-height);padding:var(--ref-spacing-xxxs) var(--ref-spacing-xs);border-radius:var(--ref-border-radius-sm);background:none;color:var(--ref-color-grey-100);font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height);transition:background-color var(--ref-animation-short) ease,color var(--ref-animation-short) ease}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:hover:not(.active):not(:disabled){background:var(--ref-color-grey-10);color:var(--ref-color-grey-100)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:active:not(.active):not(:disabled){background:var(--ref-color-grey-20)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:focus-visible{outline:none;background:var(--ref-color-grey-10);box-shadow:0 0 0 1px var(--ref-color-white),0 0 0 3px var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button.active{background:var(--ref-color-electric-blue-20);color:var(--ref-color-electric-blue-150);font-weight:var(--sys-text-style-body-bold-weight)}::ng-deep .custom-calendar .md-drppicker .ranges ul li button:disabled{background:none;color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table{width:224px;padding:0!important;border:none!important}::ng-deep .custom-calendar .md-drppicker .calendar-table table{border-spacing:0 var(--ref-spacing-xxxs);height:auto}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead{line-height:normal}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr:first-child{display:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table thead tr th{height:32px;border:none;color:var(--ref-color-grey-100);font-family:var(--sys-text-style-body-bold-font-family);font-size:var(--sys-text-style-body-bold-size);font-weight:var(--sys-text-style-body-bold-weight);line-height:var(--sys-text-style-body-bold-line-height);text-transform:capitalize}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td{height:32px;padding:0;border:none;border-radius:0;opacity:1;color:var(--ref-color-grey-100);transition:background-color var(--ref-animation-short) ease}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td span{display:flex;align-items:center;justify-content:center;width:100%;height:32px;margin:0;border:none;border-radius:0;background-color:transparent;color:inherit;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.off):not(.in-range):not(.hovered-end):hover{border-radius:var(--ref-border-radius-sm);background-color:var(--ref-color-grey-10)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available:not(.off):not(.in-range):not(.hovered-end):active{background-color:var(--ref-color-grey-20)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.off{background-color:transparent;color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.disabled{color:var(--ref-color-grey-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.force-inactive:not(.off){background-color:transparent;color:var(--ref-color-grey-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today:not(.off):not(.in-range):not(.active):not(.hovered-end),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.today.force-inactive:not(.off):not(.hovered-end){border-radius:var(--ref-border-radius-sm);box-shadow:inset 0 0 0 1px var(--ref-color-grey-60)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive){background-color:var(--ref-color-electric-blue-20);color:var(--ref-color-electric-blue-150);font-weight:var(--sys-text-style-body-bold-weight)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive):not(.start-date):not(.end-date):hover{background-color:var(--ref-color-electric-blue-40)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.in-range:not(.off):not(.force-inactive):not(.start-date):not(.end-date):active{background-color:var(--ref-color-electric-blue-60)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.in-range{border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.in-range{border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.in-range:not(.start-date):not(.end-date):hover{border-radius:0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.available.in-range:not(.start-date):not(.end-date):hover{border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.available.in-range:not(.start-date):not(.end-date):hover{border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date:not(.end-date).range-picker-mode:not(.off){border-radius:var(--ref-border-radius-sm) 0 0 var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:last-child.active.start-date:not(.end-date).range-picker-mode:not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.active.end-date:not(.start-date).range-picker-mode:not(.off){border-radius:var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off):hover,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off):hover{background-color:var(--ref-color-electric-blue-100)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off):active,::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off):active{background-color:var(--ref-color-electric-blue-80)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active.start-date.end-date.range-picker-mode:not(.force-inactive):not(.off),::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.active:not(.range-picker-mode):not(.force-inactive):not(.off){border-radius:var(--ref-border-radius-sm)}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody td.available.hovered-end:not(.off):not(.start-date):not(.end-date){background-color:var(--ref-color-electric-blue-150);color:var(--ref-color-white);font-weight:var(--sys-text-style-body-bold-weight);box-shadow:none;border-radius:0 var(--ref-border-radius-sm) var(--ref-border-radius-sm) 0}::ng-deep .custom-calendar .md-drppicker .calendar-table table tbody tr td:first-child.available.hovered-end:not(.off):not(.start-date):not(.end-date){border-radius:var(--ref-border-radius-sm)}.hide-ranges ::ng-deep .ranges{display:none}\n"] }]
|
|
267
452
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.SymbolRegistry }], propDecorators: { datepickerRef: [{
|
|
268
453
|
type: ViewChild,
|
|
269
454
|
args: ['datepickerRef']
|
|
270
455
|
}], firstDayOfWeek: [{
|
|
271
456
|
type: Input
|
|
272
|
-
}], i18n: [{
|
|
273
|
-
type: Input
|
|
274
457
|
}], locale: [{
|
|
275
458
|
type: Input
|
|
276
459
|
}], maxDate: [{
|
|
@@ -288,30 +471,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
288
471
|
type: Input
|
|
289
472
|
}], selectedPeriod: [{
|
|
290
473
|
type: Input
|
|
291
|
-
}], dateLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateLimit", required: false }] }],
|
|
292
|
-
type: Input
|
|
293
|
-
}], showCustomRangeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCustomRangeLabel", required: false }] }], dateSelected: [{
|
|
474
|
+
}], dateLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateLimit", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], dateSelected: [{
|
|
294
475
|
type: Output
|
|
295
476
|
}], periodSelected: [{
|
|
296
477
|
type: Output
|
|
297
|
-
}]
|
|
478
|
+
}] } });
|
|
298
479
|
|
|
299
|
-
const DEFAULT_I18N = {
|
|
300
|
-
ranges: {
|
|
301
|
-
yesterday: 'Yesterday',
|
|
302
|
-
lastWeek: 'Last Week',
|
|
303
|
-
last30Days: 'Last 30 days',
|
|
304
|
-
lastMonth: 'Previous month',
|
|
305
|
-
thisMonth: 'This month',
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
480
|
/**
|
|
309
481
|
* A dropdown component that displays a datepicker (single, multiple, or range mode)
|
|
310
482
|
* in an overlay. Exposes open/close/toggle so it can be driven by apDropdownTrigger.
|
|
311
483
|
*/
|
|
312
484
|
class DatepickerDropdownComponent {
|
|
313
|
-
|
|
314
|
-
|
|
485
|
+
/**
|
|
486
|
+
* Stable id for the panel (`role="dialog"`), so a trigger can bind `aria-controls` to it.
|
|
487
|
+
* Combines the app id — several federated Angular apps can share one page — with a per-instance
|
|
488
|
+
* random suffix computed once at construction. No shared mutable counter, and no reliance on
|
|
489
|
+
* `crypto.randomUUID()`, which browsers refuse outside a secure (HTTPS/localhost) context.
|
|
490
|
+
*/
|
|
491
|
+
panelId = `${inject(APP_ID)}-datepicker-panel-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
492
|
+
panel = viewChild(DropdownPanelComponent, /* @ts-ignore */
|
|
493
|
+
...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
|
|
315
494
|
mode = input.required(/* @ts-ignore */
|
|
316
495
|
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
317
496
|
selectedDate = input(undefined, /* @ts-ignore */
|
|
@@ -330,23 +509,25 @@ class DatepickerDropdownComponent {
|
|
|
330
509
|
/** Caption shown at the bottom of the panel, e.g. to explain a selection constraint. */
|
|
331
510
|
hint = input(undefined, /* @ts-ignore */
|
|
332
511
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
512
|
+
/**
|
|
513
|
+
* Rendered under `hint`, for what a caption cannot carry — a banner with its own button. A
|
|
514
|
+
* `TemplateRef` and not an `ng-content`: the footer shows inside the overlay's embedded view.
|
|
515
|
+
*/
|
|
516
|
+
panelFooter = input(undefined, /* @ts-ignore */
|
|
517
|
+
...(ngDevMode ? [{ debugName: "panelFooter" }] : /* istanbul ignore next */ []));
|
|
333
518
|
firstDayOfWeek = input('monday', /* @ts-ignore */
|
|
334
519
|
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
335
520
|
locale = input('en', /* @ts-ignore */
|
|
336
521
|
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
...(ngDevMode ? [{ debugName: "effectiveI18n" }] : /* istanbul ignore next */ []));
|
|
341
|
-
showRanges = input(false, /* @ts-ignore */
|
|
342
|
-
...(ngDevMode ? [{ debugName: "showRanges" }] : /* istanbul ignore next */ []));
|
|
343
|
-
showCustomRangeLabel = input(false, /* @ts-ignore */
|
|
344
|
-
...(ngDevMode ? [{ debugName: "showCustomRangeLabel" }] : /* istanbul ignore next */ []));
|
|
345
|
-
rangesConfig = input(null, /* @ts-ignore */
|
|
346
|
-
...(ngDevMode ? [{ debugName: "rangesConfig" }] : /* istanbul ignore next */ []));
|
|
522
|
+
/** Shortcuts listed beside the calendars. Empty: no column at all. */
|
|
523
|
+
presets = input([], /* @ts-ignore */
|
|
524
|
+
...(ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []));
|
|
347
525
|
showBackdrop = input(true, /* @ts-ignore */
|
|
348
526
|
...(ngDevMode ? [{ debugName: "showBackdrop" }] : /* istanbul ignore next */ []));
|
|
349
|
-
/**
|
|
527
|
+
/**
|
|
528
|
+
* Close the overlay once the selection is complete. When false it stays open until backdrop
|
|
529
|
+
* click or Escape — which lets the host vet a selection before anything closes.
|
|
530
|
+
*/
|
|
350
531
|
closeOnSelect = input(true, /* @ts-ignore */
|
|
351
532
|
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
352
533
|
disabled = input(false, /* @ts-ignore */
|
|
@@ -358,24 +539,18 @@ class DatepickerDropdownComponent {
|
|
|
358
539
|
closed = output();
|
|
359
540
|
dateSelected = output();
|
|
360
541
|
periodSelected = output();
|
|
361
|
-
|
|
362
|
-
isOpen
|
|
542
|
+
isOpen = computed(() => this.panel()?.isOpen() ?? false, /* @ts-ignore */
|
|
543
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
363
544
|
open(triggerElement) {
|
|
364
|
-
const
|
|
365
|
-
if (this.disabled() || this.isOpen() || !
|
|
545
|
+
const panel = this.panel();
|
|
546
|
+
if (this.disabled() || this.isOpen() || !panel)
|
|
366
547
|
return;
|
|
367
|
-
|
|
368
|
-
showBackdrop: this.showBackdrop(),
|
|
369
|
-
placement: this.placement(),
|
|
370
|
-
onClose: () => this.close(),
|
|
371
|
-
});
|
|
548
|
+
panel.open(triggerElement);
|
|
372
549
|
this.opened.emit();
|
|
373
550
|
}
|
|
551
|
+
/** `closed` is relayed from the panel, which fires it for a gesture as well as for this call. */
|
|
374
552
|
close() {
|
|
375
|
-
|
|
376
|
-
return;
|
|
377
|
-
this.overlay.close();
|
|
378
|
-
this.closed.emit();
|
|
553
|
+
this.panel()?.close();
|
|
379
554
|
}
|
|
380
555
|
toggle(triggerElement) {
|
|
381
556
|
if (this.isOpen()) {
|
|
@@ -387,7 +562,7 @@ class DatepickerDropdownComponent {
|
|
|
387
562
|
}
|
|
388
563
|
onDateSelected(date) {
|
|
389
564
|
this.dateSelected.emit(date);
|
|
390
|
-
if (this.mode() !== DatepickerMode.Multiple) {
|
|
565
|
+
if (this.closeOnSelect() && this.mode() !== DatepickerMode.Multiple) {
|
|
391
566
|
this.close();
|
|
392
567
|
}
|
|
393
568
|
}
|
|
@@ -398,144 +573,405 @@ class DatepickerDropdownComponent {
|
|
|
398
573
|
}
|
|
399
574
|
}
|
|
400
575
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerDropdownComponent, isStandalone: true, selector: "ap-datepicker-dropdown", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, selectedDates: { classPropertyName: "selectedDates", publicName: "selectedDates", isSignal: true, isRequired: false, transformFunction: null }, selectedPeriod: { classPropertyName: "selectedPeriod", publicName: "selectedPeriod", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dateLimit: { classPropertyName: "dateLimit", publicName: "dateLimit", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null },
|
|
576
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerDropdownComponent, isStandalone: true, selector: "ap-datepicker-dropdown", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, selectedDates: { classPropertyName: "selectedDates", publicName: "selectedDates", isSignal: true, isRequired: false, transformFunction: null }, selectedPeriod: { classPropertyName: "selectedPeriod", publicName: "selectedPeriod", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dateLimit: { classPropertyName: "dateLimit", publicName: "dateLimit", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, panelFooter: { classPropertyName: "panelFooter", publicName: "panelFooter", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null }, showBackdrop: { classPropertyName: "showBackdrop", publicName: "showBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed", dateSelected: "dateSelected", periodSelected: "periodSelected" }, viewQueries: [{ propertyName: "panel", first: true, predicate: DropdownPanelComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<ap-dropdown-panel\n [placement]=\"placement()\"\n [showBackdrop]=\"showBackdrop()\"\n (closed)=\"closed.emit()\">\n <div\n *apDropdownContent\n class=\"ap-datepicker-dropdown__content\"\n role=\"dialog\"\n aria-label=\"Datepicker\"\n tabindex=\"-1\"\n [id]=\"panelId\">\n <ap-datepicker\n apStopPropagation\n [dateLimit]=\"dateLimit()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [mode]=\"mode()\"\n [presets]=\"presets()\"\n [selectedDate]=\"selectedDate()\"\n [selectedDates]=\"selectedDates()\"\n [selectedPeriod]=\"selectedPeriod()\"\n (dateSelected)=\"onDateSelected($event)\"\n (periodSelected)=\"onPeriodSelected($event)\" />\n @if (hint()) {\n <div class=\"ap-datepicker-dropdown__hint\">{{ hint() }}</div>\n }\n @if (panelFooter(); as footer) {\n <div class=\"ap-datepicker-dropdown__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </div>\n }\n </div>\n</ap-dropdown-panel>\n", styles: [":host{display:none}.ap-datepicker-dropdown__content{padding:var(--ref-spacing-sm);outline:none;z-index:1000;max-height:var(--ap-floating-available-height, none);overflow-y:auto}.ap-datepicker-dropdown__content:focus{outline:2px solid var(--comp-action-dropdown-item-background-color-focused);outline-offset:2px}.ap-datepicker-dropdown__hint{border-top:1px solid var(--ref-color-grey-10);color:var(--sys-text-color-light);font-size:var(--sys-text-style-caption-size);margin-top:var(--ref-spacing-xxs);padding-top:var(--ref-spacing-xxs);text-align:center}.ap-datepicker-dropdown__footer{border-top:1px solid var(--ref-color-grey-10);margin-top:var(--ref-spacing-xxs);padding-top:var(--ref-spacing-xxs)}.ap-datepicker-dropdown__hint+.ap-datepicker-dropdown__footer{border-top:none;padding-top:0}\n"], dependencies: [{ kind: "component", type: DatepickerComponent, selector: "ap-datepicker", inputs: ["firstDayOfWeek", "locale", "maxDate", "minDate", "mode", "selectedDate", "selectedDates", "selectedPeriod", "dateLimit", "presets"], outputs: ["dateSelected", "periodSelected"] }, { kind: "directive", type: DropdownContentDirective, selector: "ng-template[apDropdownContent]" }, { kind: "component", type: DropdownPanelComponent, selector: "ap-dropdown-panel", inputs: ["placement", "showBackdrop", "panelClass", "canDismiss"], outputs: ["opened", "closed"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: StopPropagationDirective, selector: "[apStopPropagation]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
402
577
|
}
|
|
403
578
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerDropdownComponent, decorators: [{
|
|
404
579
|
type: Component,
|
|
405
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker-dropdown', imports: [DatepickerComponent, StopPropagationDirective], template: "<
|
|
406
|
-
}], propDecorators: {
|
|
580
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker-dropdown', imports: [DatepickerComponent, DropdownContentDirective, DropdownPanelComponent, NgTemplateOutlet, StopPropagationDirective], template: "<ap-dropdown-panel\n [placement]=\"placement()\"\n [showBackdrop]=\"showBackdrop()\"\n (closed)=\"closed.emit()\">\n <div\n *apDropdownContent\n class=\"ap-datepicker-dropdown__content\"\n role=\"dialog\"\n aria-label=\"Datepicker\"\n tabindex=\"-1\"\n [id]=\"panelId\">\n <ap-datepicker\n apStopPropagation\n [dateLimit]=\"dateLimit()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [mode]=\"mode()\"\n [presets]=\"presets()\"\n [selectedDate]=\"selectedDate()\"\n [selectedDates]=\"selectedDates()\"\n [selectedPeriod]=\"selectedPeriod()\"\n (dateSelected)=\"onDateSelected($event)\"\n (periodSelected)=\"onPeriodSelected($event)\" />\n @if (hint()) {\n <div class=\"ap-datepicker-dropdown__hint\">{{ hint() }}</div>\n }\n @if (panelFooter(); as footer) {\n <div class=\"ap-datepicker-dropdown__footer\">\n <ng-container [ngTemplateOutlet]=\"footer\" />\n </div>\n }\n </div>\n</ap-dropdown-panel>\n", styles: [":host{display:none}.ap-datepicker-dropdown__content{padding:var(--ref-spacing-sm);outline:none;z-index:1000;max-height:var(--ap-floating-available-height, none);overflow-y:auto}.ap-datepicker-dropdown__content:focus{outline:2px solid var(--comp-action-dropdown-item-background-color-focused);outline-offset:2px}.ap-datepicker-dropdown__hint{border-top:1px solid var(--ref-color-grey-10);color:var(--sys-text-color-light);font-size:var(--sys-text-style-caption-size);margin-top:var(--ref-spacing-xxs);padding-top:var(--ref-spacing-xxs);text-align:center}.ap-datepicker-dropdown__footer{border-top:1px solid var(--ref-color-grey-10);margin-top:var(--ref-spacing-xxs);padding-top:var(--ref-spacing-xxs)}.ap-datepicker-dropdown__hint+.ap-datepicker-dropdown__footer{border-top:none;padding-top:0}\n"] }]
|
|
581
|
+
}], propDecorators: { panel: [{ type: i0.ViewChild, args: [i0.forwardRef(() => DropdownPanelComponent), { isSignal: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }], selectedDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDates", required: false }] }], selectedPeriod: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedPeriod", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], dateLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateLimit", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], panelFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelFooter", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], showBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBackdrop", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], dateSelected: [{ type: i0.Output, args: ["dateSelected"] }], periodSelected: [{ type: i0.Output, args: ["periodSelected"] }] } });
|
|
407
582
|
|
|
408
|
-
const
|
|
409
|
-
|
|
583
|
+
const DEFAULT_LABELS = {
|
|
584
|
+
yesterday: 'Yesterday',
|
|
585
|
+
lastWeek: 'Last Week',
|
|
586
|
+
last30Days: 'Last 30 days',
|
|
587
|
+
lastMonth: 'Previous month',
|
|
588
|
+
thisMonth: 'This month',
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* The five shortcuts a picker offers by default. A function and not a constant, so the ranges are
|
|
592
|
+
* computed when shown: a session left open across midnight would otherwise offer yesterday's.
|
|
593
|
+
*/
|
|
594
|
+
function defaultDatepickerPresets(labels, today = dayjs()) {
|
|
595
|
+
const yesterday = today.subtract(1, 'day');
|
|
596
|
+
const previousMonth = today.subtract(1, 'month');
|
|
597
|
+
const label = (key) => labels?.[key] ?? DEFAULT_LABELS[key];
|
|
598
|
+
return [
|
|
599
|
+
{ key: 'yesterday', label: label('yesterday'), range: [yesterday, yesterday] },
|
|
600
|
+
{ key: 'lastWeek', label: label('lastWeek'), range: [today.subtract(7, 'day'), yesterday] },
|
|
601
|
+
{ key: 'last30Days', label: label('last30Days'), range: [today.subtract(30, 'day'), yesterday] },
|
|
602
|
+
{
|
|
603
|
+
key: 'lastMonth',
|
|
604
|
+
label: label('lastMonth'),
|
|
605
|
+
range: [previousMonth.startOf('month'), previousMonth.endOf('month')],
|
|
606
|
+
},
|
|
607
|
+
{ key: 'thisMonth', label: label('thisMonth'), range: [today.startOf('month'), today.endOf('month')] },
|
|
608
|
+
];
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const EXPECTED = {
|
|
612
|
+
[DatepickerMode.Single]: 'a single date',
|
|
613
|
+
[DatepickerMode.Range]: 'a Period ({ startDate, endDate })',
|
|
614
|
+
[DatepickerMode.Multiple]: 'an array of dates',
|
|
615
|
+
};
|
|
616
|
+
function describe(value) {
|
|
617
|
+
if (Array.isArray(value)) {
|
|
618
|
+
return `an array of ${value.length} date${value.length === 1 ? '' : 's'}`;
|
|
619
|
+
}
|
|
620
|
+
if (dayjs.isDayjs(value)) {
|
|
621
|
+
return 'a single date';
|
|
622
|
+
}
|
|
623
|
+
if (isPeriod(value)) {
|
|
624
|
+
return 'a Period ({ startDate, endDate })';
|
|
625
|
+
}
|
|
626
|
+
return 'an unrecognised value';
|
|
627
|
+
}
|
|
628
|
+
/** Tells a `Period` from the two other shapes, without an `as`. */
|
|
629
|
+
function isPeriod(value) {
|
|
630
|
+
// Must be a non-null object
|
|
631
|
+
if (typeof value !== 'object' || value === null) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
// Must not be an array
|
|
635
|
+
if (Array.isArray(value)) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
// Must not be a dayjs instance
|
|
639
|
+
if (dayjs.isDayjs(value)) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
// Must have startDate and endDate properties
|
|
643
|
+
const obj = value;
|
|
644
|
+
// Check that at least one of startDate/endDate is defined as an own property
|
|
645
|
+
const hasStartDate = 'startDate' in obj;
|
|
646
|
+
const hasEndDate = 'endDate' in obj;
|
|
647
|
+
if (!hasStartDate && !hasEndDate) {
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
const startDate = obj.startDate;
|
|
651
|
+
const endDate = obj.endDate;
|
|
652
|
+
// Each field must be either undefined/null or a dayjs instance
|
|
653
|
+
const isValidDateField = (field) => {
|
|
654
|
+
return field === undefined || field === null || dayjs.isDayjs(field);
|
|
655
|
+
};
|
|
656
|
+
return isValidDateField(startDate) && isValidDateField(endDate);
|
|
657
|
+
}
|
|
658
|
+
function matches(mode, value) {
|
|
659
|
+
if (mode === DatepickerMode.Multiple) {
|
|
660
|
+
return Array.isArray(value);
|
|
661
|
+
}
|
|
662
|
+
if (mode === DatepickerMode.Single) {
|
|
663
|
+
return dayjs.isDayjs(value);
|
|
664
|
+
}
|
|
665
|
+
return isPeriod(value);
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Throws when the value does not match the mode. An empty value (`undefined`, `null`) is accepted
|
|
669
|
+
* everywhere: it means nothing is selected.
|
|
670
|
+
*/
|
|
671
|
+
function assertValueMatchesMode(mode, value) {
|
|
672
|
+
if (value === undefined || value === null) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (!matches(mode, value)) {
|
|
676
|
+
throw new Error(`ap-datepicker-select: mode="${mode}" expects ${EXPECTED[mode]}, received ${describe(value)}.`);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
const EMPTY_PERIOD = { startDate: undefined, endDate: undefined };
|
|
681
|
+
/**
|
|
682
|
+
* The design system's date field: it shows the value, opens the shared panel and binds to a form.
|
|
683
|
+
* It carries no label of its own — wrap it in an `ap-form-field`, as `ap-select` is.
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```html
|
|
687
|
+
* <ap-form-field>
|
|
688
|
+
* <label for="period">Reporting period</label>
|
|
689
|
+
* <ap-datepicker-select [mode]="DatepickerMode.Range" [(value)]="period" [presets]="presets" />
|
|
690
|
+
* </ap-form-field>
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
class DatepickerSelectComponent {
|
|
410
694
|
mode = input.required(/* @ts-ignore */
|
|
411
695
|
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
696
|
+
/**
|
|
697
|
+
* The selection. Its shape follows the mode: a date in Single, a `Period` in Range, an array in
|
|
698
|
+
* Multiple. A shape that does not match the mode throws on the first render.
|
|
699
|
+
*
|
|
700
|
+
* Empty is `undefined`, and `null` is accepted for it: a form holding a nullable date has no
|
|
701
|
+
* other empty to offer, and this is the type a binding is checked against.
|
|
702
|
+
*/
|
|
703
|
+
value = model(undefined, /* @ts-ignore */
|
|
704
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
705
|
+
/** Disables the field. A form writes here too, rather than to a second flag of its own. */
|
|
422
706
|
disabled = input(false, /* @ts-ignore */
|
|
423
707
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
424
708
|
minDate = input(undefined, /* @ts-ignore */
|
|
425
709
|
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
426
710
|
maxDate = input(undefined, /* @ts-ignore */
|
|
427
711
|
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
...(ngDevMode ? [{ debugName: "
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
...(ngDevMode ? [{ debugName: "
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
712
|
+
/**
|
|
713
|
+
* Maximum number of days between the start and the end, in Range mode. It bars the days beyond
|
|
714
|
+
* the limit without saying so: pair it with a `panelHint` when the constraint deserves a word.
|
|
715
|
+
*/
|
|
716
|
+
maxRangeDays = input(undefined, /* @ts-ignore */
|
|
717
|
+
...(ngDevMode ? [{ debugName: "maxRangeDays" }] : /* istanbul ignore next */ []));
|
|
718
|
+
/** Caption shown at the bottom of the panel, to explain a constraint for instance. */
|
|
719
|
+
panelHint = input(undefined, /* @ts-ignore */
|
|
720
|
+
...(ngDevMode ? [{ debugName: "panelHint" }] : /* istanbul ignore next */ []));
|
|
721
|
+
/** Rendered under `panelHint`, for what a sentence cannot carry — a banner with its own button. */
|
|
722
|
+
panelFooter = input(undefined, /* @ts-ignore */
|
|
723
|
+
...(ngDevMode ? [{ debugName: "panelFooter" }] : /* istanbul ignore next */ []));
|
|
724
|
+
/**
|
|
725
|
+
* Consulted before a selection is committed. Returning `false` keeps the current value, keeps the
|
|
726
|
+
* panel open and emits `selectionRejected`.
|
|
727
|
+
*
|
|
728
|
+
* A constraint the panel can apply itself (`minDate`, `maxDate`, `maxRangeDays`) belongs there
|
|
729
|
+
* instead: it bars the days rather than letting them be clicked and then refused.
|
|
730
|
+
*/
|
|
731
|
+
canSelect = input(undefined, /* @ts-ignore */
|
|
732
|
+
...(ngDevMode ? [{ debugName: "canSelect" }] : /* istanbul ignore next */ []));
|
|
733
|
+
/** Shortcuts listed beside the calendars. Empty: no column at all. */
|
|
734
|
+
presets = input([], /* @ts-ignore */
|
|
735
|
+
...(ngDevMode ? [{ debugName: "presets" }] : /* istanbul ignore next */ []));
|
|
736
|
+
placeholder = input('Select date', /* @ts-ignore */
|
|
737
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
738
|
+
/**
|
|
739
|
+
* Accessible name of the field, since `role="combobox"` is not a name-from-content role and the
|
|
740
|
+
* component carries no internal `<label>` — surround it with an `ap-form-field` for the visible
|
|
741
|
+
* label, and mirror its text here.
|
|
742
|
+
*/
|
|
743
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
744
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
745
|
+
/**
|
|
746
|
+
* dayjs format of the displayed text. Defaults to `'MM/DD/YYYY'`, which needs no plugin: the
|
|
747
|
+
* localized tokens (`ll`, `LL`) assume the host application loaded `dayjs/plugin/localizedFormat`.
|
|
748
|
+
*/
|
|
749
|
+
dateFormat = input('MM/DD/YYYY', /* @ts-ignore */
|
|
750
|
+
...(ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []));
|
|
751
|
+
locale = input('en', /* @ts-ignore */
|
|
752
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
753
|
+
firstDayOfWeek = input('monday', /* @ts-ignore */
|
|
754
|
+
...(ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []));
|
|
444
755
|
/** Panel placement. Unset means derived from the anchor mode, i.e. `bottom-start`. */
|
|
445
756
|
placement = input(/* @ts-ignore */
|
|
446
757
|
...(ngDevMode ? [undefined, { debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
447
|
-
/**
|
|
758
|
+
/** Shows a clear cross in the field as soon as something is selected. */
|
|
448
759
|
clearable = input(false, /* @ts-ignore */
|
|
449
760
|
...(ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []));
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
761
|
+
/** IANA time zone name. When set, a chip shows its abbreviation beside the field. */
|
|
762
|
+
timeZone = input(undefined, /* @ts-ignore */
|
|
763
|
+
...(ngDevMode ? [{ debugName: "timeZone" }] : /* istanbul ignore next */ []));
|
|
764
|
+
/** Tooltip carried by the info icon next to the chip. */
|
|
765
|
+
timeZoneTooltip = input(undefined, /* @ts-ignore */
|
|
766
|
+
...(ngDevMode ? [{ debugName: "timeZoneTooltip" }] : /* istanbul ignore next */ []));
|
|
767
|
+
/** Blur of the combobox. A form reads it to mark the field touched. */
|
|
768
|
+
touch = output();
|
|
769
|
+
/** The committed value with the preset that produced it, beside `valueChange` — one event, not two halves to correlate. */
|
|
770
|
+
selectionChange = output();
|
|
771
|
+
/** The selection `canSelect` just refused. The field's value has not moved. */
|
|
772
|
+
selectionRejected = output();
|
|
773
|
+
/** The panel just opened, just closed, so that what a host shows beside it can start over. */
|
|
774
|
+
opened = output();
|
|
775
|
+
closed = output();
|
|
776
|
+
DatepickerMode = DatepickerMode;
|
|
777
|
+
/**
|
|
778
|
+
* The panel only closes itself without a refusal predicate: it emits the selection then closes,
|
|
779
|
+
* so a veto would land too late. With one, the field closes what it accepted.
|
|
780
|
+
*/
|
|
781
|
+
closesOnSelect = computed(() => this.canSelect() === undefined, /* @ts-ignore */
|
|
782
|
+
...(ngDevMode ? [{ debugName: "closesOnSelect" }] : /* istanbul ignore next */ []));
|
|
783
|
+
/** Fed by the dropdown's `opened`/`closed` rather than read back from it: a host class can only bind to our own members. */
|
|
784
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
785
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
786
|
+
/** The dropdown driving the panel — held only to close it when the field becomes disabled. */
|
|
787
|
+
dropdown = viewChild('dropdown', /* @ts-ignore */
|
|
788
|
+
...(ngDevMode ? [{ debugName: "dropdown" }] : /* istanbul ignore next */ []));
|
|
789
|
+
/**
|
|
790
|
+
* Closes an already-open panel the moment the field becomes disabled. The dropdown only guards
|
|
791
|
+
* *new* opens, and its panel is a CDK overlay detached from this component's DOM.
|
|
792
|
+
*/
|
|
793
|
+
closeOnDisable = effect(() => {
|
|
794
|
+
if (this.disabled()) {
|
|
795
|
+
this.dropdown()?.close();
|
|
462
796
|
}
|
|
463
|
-
return '';
|
|
464
797
|
}, /* @ts-ignore */
|
|
465
|
-
...(ngDevMode ? [{ debugName: "
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
798
|
+
...(ngDevMode ? [{ debugName: "closeOnDisable" }] : /* istanbul ignore next */ []));
|
|
799
|
+
/** Checks the value once, and sorts it into the three shapes the panel expects. */
|
|
800
|
+
shaped = computed(() => {
|
|
801
|
+
const mode = this.mode();
|
|
802
|
+
// Both empties collapse here, so nothing below has to know which one it was handed.
|
|
803
|
+
const value = this.value() ?? undefined;
|
|
804
|
+
assertValueMatchesMode(mode, value);
|
|
805
|
+
if (mode === DatepickerMode.Single) {
|
|
806
|
+
return { date: dayjs.isDayjs(value) ? value : undefined, dates: [], period: EMPTY_PERIOD };
|
|
807
|
+
}
|
|
808
|
+
if (mode === DatepickerMode.Multiple) {
|
|
809
|
+
return { date: undefined, dates: Array.isArray(value) ? value : [], period: EMPTY_PERIOD };
|
|
810
|
+
}
|
|
811
|
+
return { date: undefined, dates: [], period: value !== undefined && isPeriod(value) ? value : EMPTY_PERIOD };
|
|
812
|
+
}, /* @ts-ignore */
|
|
813
|
+
...(ngDevMode ? [{ debugName: "shaped" }] : /* istanbul ignore next */ []));
|
|
814
|
+
selectedDate = computed(() => this.shaped().date, /* @ts-ignore */
|
|
815
|
+
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
816
|
+
selectedDates = computed(() => this.shaped().dates, /* @ts-ignore */
|
|
817
|
+
...(ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []));
|
|
818
|
+
/**
|
|
819
|
+
* Bumped to re-impose the value a refusal kept. The panel only reacts to `selectedPeriod`
|
|
820
|
+
* changing identity, so putting it back takes a fresh object.
|
|
821
|
+
*/
|
|
822
|
+
restoreNonce = signal(0, /* @ts-ignore */
|
|
823
|
+
...(ngDevMode ? [{ debugName: "restoreNonce" }] : /* istanbul ignore next */ []));
|
|
824
|
+
selectedPeriod = computed(() => {
|
|
825
|
+
this.restoreNonce();
|
|
826
|
+
return { ...this.shaped().period };
|
|
827
|
+
}, /* @ts-ignore */
|
|
828
|
+
...(ngDevMode ? [{ debugName: "selectedPeriod" }] : /* istanbul ignore next */ []));
|
|
829
|
+
hasValue = computed(() => {
|
|
830
|
+
const mode = this.mode();
|
|
831
|
+
if (mode === DatepickerMode.Single) {
|
|
832
|
+
return this.selectedDate() !== undefined;
|
|
473
833
|
}
|
|
474
|
-
|
|
475
|
-
this.
|
|
834
|
+
if (mode === DatepickerMode.Multiple) {
|
|
835
|
+
return this.selectedDates().length > 0;
|
|
476
836
|
}
|
|
837
|
+
const { startDate, endDate } = this.selectedPeriod();
|
|
838
|
+
return startDate !== undefined || endDate !== undefined;
|
|
477
839
|
}, /* @ts-ignore */
|
|
478
|
-
...(ngDevMode ? [{ debugName: "
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
this.
|
|
485
|
-
|
|
840
|
+
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
841
|
+
/** The field's text. Empty in Multiple, where the field shows chips instead. */
|
|
842
|
+
displayed = computed(() => {
|
|
843
|
+
const format = (date) => date.locale(this.locale()).format(this.dateFormat());
|
|
844
|
+
const mode = this.mode();
|
|
845
|
+
if (mode === DatepickerMode.Single) {
|
|
846
|
+
const date = this.selectedDate();
|
|
847
|
+
return date ? format(date) : '';
|
|
848
|
+
}
|
|
849
|
+
if (mode === DatepickerMode.Range) {
|
|
850
|
+
const { startDate, endDate } = this.selectedPeriod();
|
|
851
|
+
return startDate && endDate ? `${format(startDate)} - ${format(endDate)}` : '';
|
|
486
852
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
853
|
+
return '';
|
|
854
|
+
}, /* @ts-ignore */
|
|
855
|
+
...(ngDevMode ? [{ debugName: "displayed" }] : /* istanbul ignore next */ []));
|
|
856
|
+
/** The chips shown in Multiple mode, one per selected date. */
|
|
857
|
+
chips = computed(() => this.selectedDates().map(date => ({
|
|
858
|
+
label: date.locale(this.locale()).format(this.dateFormat()),
|
|
859
|
+
date,
|
|
860
|
+
})), /* @ts-ignore */
|
|
861
|
+
...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
|
|
862
|
+
/** The zone abbreviation ("EST", "CEST"…), computed without touching dayjs globally. */
|
|
863
|
+
timeZoneOffset = computed(() => {
|
|
864
|
+
const timeZone = this.timeZone();
|
|
865
|
+
if (!timeZone) {
|
|
866
|
+
return '';
|
|
867
|
+
}
|
|
868
|
+
return (new Intl.DateTimeFormat('en-US', { timeZone, timeZoneName: 'short' })
|
|
869
|
+
.formatToParts(new Date())
|
|
870
|
+
.find(({ type }) => type === 'timeZoneName')?.value ?? '');
|
|
871
|
+
}, /* @ts-ignore */
|
|
872
|
+
...(ngDevMode ? [{ debugName: "timeZoneOffset" }] : /* istanbul ignore next */ []));
|
|
873
|
+
onDateSelected(date) {
|
|
874
|
+
const mode = this.mode();
|
|
875
|
+
if (mode === DatepickerMode.Single) {
|
|
876
|
+
this.commit(date);
|
|
877
|
+
return;
|
|
490
878
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
this.onChange(defaultPeriodSelected);
|
|
497
|
-
this.periodChanged.emit(defaultPeriodSelected);
|
|
498
|
-
}
|
|
499
|
-
writeValue(value) {
|
|
500
|
-
if (value && value.startDate && value.endDate) {
|
|
501
|
-
this.periodRange.set({
|
|
502
|
-
startDate: dayjs(value.startDate),
|
|
503
|
-
endDate: dayjs(value.endDate),
|
|
504
|
-
});
|
|
879
|
+
if (mode === DatepickerMode.Multiple) {
|
|
880
|
+
// The panel re-emits the same date on every click: toggling is ours to do.
|
|
881
|
+
const dates = this.selectedDates();
|
|
882
|
+
const without = dates.filter(selected => !selected.isSame(date, 'day'));
|
|
883
|
+
this.commit(without.length === dates.length ? [...dates, date] : without);
|
|
505
884
|
}
|
|
506
|
-
|
|
507
|
-
|
|
885
|
+
}
|
|
886
|
+
/** Drops a date from the selection, from the chip the user closed. */
|
|
887
|
+
removeDate(chip) {
|
|
888
|
+
this.commit(this.selectedDates().filter(date => date !== chip.date));
|
|
889
|
+
}
|
|
890
|
+
onPanelOpened() {
|
|
891
|
+
this.isOpen.set(true);
|
|
892
|
+
this.opened.emit();
|
|
893
|
+
}
|
|
894
|
+
onPanelClosed() {
|
|
895
|
+
this.isOpen.set(false);
|
|
896
|
+
this.closed.emit();
|
|
897
|
+
}
|
|
898
|
+
/** The preset is stripped from the value: it says where the value came from, it is not part of it. */
|
|
899
|
+
onPeriodSelected({ preset, ...period }) {
|
|
900
|
+
if (this.mode() === DatepickerMode.Range) {
|
|
901
|
+
this.commit(period, preset);
|
|
508
902
|
}
|
|
509
903
|
}
|
|
510
|
-
|
|
511
|
-
|
|
904
|
+
/** Clears the selection. Stops propagation so the panel does not reopen. */
|
|
905
|
+
clear(event) {
|
|
906
|
+
event.stopPropagation();
|
|
907
|
+
this.commit(undefined);
|
|
512
908
|
}
|
|
513
|
-
|
|
514
|
-
|
|
909
|
+
/** The single write point: the signal and the form get the same value, and a disabled field none. */
|
|
910
|
+
commit(value, preset) {
|
|
911
|
+
if (this.disabled())
|
|
912
|
+
return;
|
|
913
|
+
// Clearing is not a selection: the predicate has no say in it.
|
|
914
|
+
if (value !== undefined && this.canSelect()?.(value) === false) {
|
|
915
|
+
this.selectionRejected.emit(value);
|
|
916
|
+
this.restoreNonce.update(nonce => nonce + 1);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
this.value.set(value);
|
|
920
|
+
this.selectionChange.emit({ value, preset });
|
|
921
|
+
if (!this.closesOnSelect() && this.isComplete(value)) {
|
|
922
|
+
this.dropdown()?.close();
|
|
923
|
+
}
|
|
515
924
|
}
|
|
516
|
-
|
|
517
|
-
|
|
925
|
+
/** True when nothing is left to pick — the panel's own closing criterion. */
|
|
926
|
+
isComplete(value) {
|
|
927
|
+
const mode = this.mode();
|
|
928
|
+
if (mode === DatepickerMode.Multiple) {
|
|
929
|
+
// A multiple selection is never finished: the panel stays open from one click to the next.
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
if (mode === DatepickerMode.Single) {
|
|
933
|
+
return value !== undefined;
|
|
934
|
+
}
|
|
935
|
+
return value !== undefined && isPeriod(value) && value.startDate !== undefined && value.endDate !== undefined;
|
|
518
936
|
}
|
|
519
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type:
|
|
520
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type:
|
|
937
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
938
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: DatepickerSelectComponent, isStandalone: true, selector: "ap-datepicker-select", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, maxRangeDays: { classPropertyName: "maxRangeDays", publicName: "maxRangeDays", isSignal: true, isRequired: false, transformFunction: null }, panelHint: { classPropertyName: "panelHint", publicName: "panelHint", isSignal: true, isRequired: false, transformFunction: null }, panelFooter: { classPropertyName: "panelFooter", publicName: "panelFooter", isSignal: true, isRequired: false, transformFunction: null }, canSelect: { classPropertyName: "canSelect", publicName: "canSelect", isSignal: true, isRequired: false, transformFunction: null }, presets: { classPropertyName: "presets", publicName: "presets", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, timeZoneTooltip: { classPropertyName: "timeZoneTooltip", publicName: "timeZoneTooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touch: "touch", selectionChange: "selectionChange", selectionRejected: "selectionRejected", opened: "opened", closed: "closed" }, host: { properties: { "class.ap-datepicker-select--open": "isOpen()", "class.ap-datepicker-select--multiple": "mode() === DatepickerMode.Multiple" }, classAttribute: "ap-datepicker-select" }, providers: [
|
|
939
|
+
withSymbols(apCalendar, apChevronDown, apChevronUp, apClock, apClose, apInfo),
|
|
940
|
+
// The vendored DaterangepickerComponent the panel renders injects LocaleService, and the plain
|
|
941
|
+
// NgxDaterangepickerMd module provides none — only its forRoot() does.
|
|
942
|
+
{ provide: LOCALE_CONFIG, useValue: {} },
|
|
943
|
+
LocaleService,
|
|
944
|
+
], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n The trigger is the group itself, not the row inside it: `[apDropdownTrigger]` only listens on its\n own host, and that row is content-height and sits inside the group's padding \u2014 so a click on the\n band above, below or beside it fell on nothing. The group is also what the panel should line up\n with, and `toggle()` anchors the overlay to the trigger.\n\n Nothing here is a bare `ap-input-group` child, so its `ap-symbol` ng-content slot is unused and\n the whole row lands in the default slot, in source order (icon, value, clear, chevron).\n-->\n<ap-input-group\n [apDropdownTrigger]=\"dropdown\"\n [disabled]=\"disabled()\">\n <div class=\"ap-datepicker-select__field\">\n <ap-symbol\n size=\"sm\"\n symbolId=\"calendar\" />\n\n <!--\n The combobox is this box and not the field around it: ng-select does the same, carrying the\n role on its inner input so the clear and the arrow stay its siblings rather than its\n descendants. The field keeps [apDropdownTrigger] \u2014 it is the click surface and the overlay's\n anchor \u2014 and the directive listens on its host, so keys pressed here still reach it by\n bubbling. Being the growing box (flex: 1) also makes it the one that measures the chip row.\n -->\n <div\n #overflow=\"apOverflowCount\"\n class=\"ap-datepicker-select__values\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n apOverflowCount\n [attr.aria-label]=\"ariaLabel()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-controls]=\"dropdown.panelId\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (blur)=\"touch.emit()\">\n @if (mode() === DatepickerMode.Multiple && chips().length > 0) {\n @for (chip of chips(); track chip.date.valueOf()) {\n <ap-tag\n apOverflowItem\n color=\"grey\"\n [mini]=\"true\"\n [clearable]=\"!disabled()\"\n (clear)=\"removeDate(chip)\">\n {{ chip.label }}\n </ap-tag>\n }\n @if (overflow.hiddenCount() > 0) {\n <ap-tag\n apOverflowCounter\n color=\"grey\"\n [mini]=\"true\">\n +{{ overflow.hiddenCount() }}\n </ap-tag>\n }\n } @else if (displayed()) {\n <span class=\"ap-datepicker-select__value\">{{ displayed() }}</span>\n } @else {\n <span class=\"ap-datepicker-select__placeholder\">{{ placeholder() }}</span>\n }\n </div>\n\n <!--\n Before the chevron, as ng-select orders its own container: value, clear, arrow. Sitting\n inside the trigger, a click here would bubble up and open the panel \u2014 hence the\n stopPropagation() in clear().\n -->\n @if (clearable() && hasValue() && !disabled()) {\n <ap-icon-button\n class=\"ap-datepicker-select__clear\"\n type=\"flat\"\n name=\"datepicker-clear\"\n symbolId=\"close\"\n ariaLabel=\"Clear selection\"\n (click)=\"clear($event)\" />\n }\n\n <span class=\"ap-datepicker-select__chevron\">\n <ap-symbol\n size=\"sm\"\n [symbolId]=\"isOpen() ? 'chevron-up' : 'chevron-down'\" />\n </span>\n </div>\n</ap-input-group>\n\n@if (timeZone(); as zone) {\n <div\n class=\"ap-datepicker-select__timezone\"\n apTooltipPosition=\"bottom\"\n [apTooltip]=\"zone\">\n <ap-symbol\n size=\"sm\"\n symbolId=\"clock\"\n color=\"grey\" />\n <span class=\"ap-datepicker-select__timezone-offset\">{{ timeZoneOffset() }}</span>\n </div>\n @if (timeZoneTooltip(); as tooltip) {\n <ap-symbol\n class=\"ap-datepicker-select__timezone-info\"\n size=\"sm\"\n symbolId=\"info\"\n color=\"grey-blue\"\n apTooltipPosition=\"bottom\"\n [apTooltip]=\"tooltip\" />\n }\n}\n\n<ap-datepicker-dropdown\n #dropdown\n [closeOnSelect]=\"closesOnSelect()\"\n [dateLimit]=\"maxRangeDays()\"\n [placement]=\"placement()\"\n [disabled]=\"disabled()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [hint]=\"panelHint()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [mode]=\"mode()\"\n [panelFooter]=\"panelFooter()\"\n [presets]=\"presets()\"\n [selectedDate]=\"selectedDate()\"\n [selectedDates]=\"selectedDates()\"\n [selectedPeriod]=\"selectedPeriod()\"\n (closed)=\"onPanelClosed()\"\n (dateSelected)=\"onDateSelected($event)\"\n (opened)=\"onPanelOpened()\"\n (periodSelected)=\"onPeriodSelected($event)\" />\n", styles: [".ap-datepicker-select{display:flex;width:100%;align-items:center;gap:var(--ref-spacing-sm)}.ap-datepicker-select ap-input-group{flex:1;min-width:0}.ap-datepicker-select .ap-input-group.disabled ap-symbol{color:inherit}.ap-datepicker-select--open .ap-input-group,.ap-datepicker-select--open .ap-input-group:hover:not(.disabled):not(:has(input[disabled])){border-color:var(--ref-color-electric-blue-100)}.ap-datepicker-select--open .ap-datepicker-select__chevron ap-symbol{color:var(--ref-color-electric-blue-100)}.ap-datepicker-select__field{display:flex;align-self:stretch;flex:1;min-width:0;align-items:center;gap:var(--ref-spacing-xxs);cursor:pointer;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size)}.ap-datepicker-select__field:focus-visible{outline:none}.ap-datepicker-select__values{display:flex;overflow:hidden;flex:1;min-width:0;align-items:center;gap:var(--ref-spacing-xxs)}.ap-datepicker-select__values>*{flex-shrink:0}.ap-datepicker-select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ap-datepicker-select__placeholder{color:var(--sys-text-color-light)}.ap-datepicker-select__chevron{display:inline-flex;align-items:center}.ap-datepicker-select__clear{--comp-icon-button-width: var(--sys-icon-css-md);--comp-icon-button-height: var(--sys-icon-css-md);--comp-icon-button-padding: 0}.ap-datepicker-select__clear .icon-button:hover:not(.stroked):not(.locked),.ap-datepicker-select__clear .icon-button:active:not(.stroked):not(.locked){background:transparent}.ap-datepicker-select__clear .icon-button ap-symbol{width:var(--sys-icon-css-xs);min-width:var(--sys-icon-css-xs);height:var(--sys-icon-css-xs);min-height:var(--sys-icon-css-xs)}.ap-datepicker-select__clear:hover .icon-button ap-symbol{color:var(--sys-color-error-text)}.ap-datepicker-select__timezone{display:inline-flex;align-items:center;gap:var(--ref-spacing-xxs)}.ap-datepicker-select__timezone-info{display:inline-flex;align-items:center}.ap-datepicker-select--multiple .ap-datepicker-select__values{gap:var(--ref-spacing-xxxs)}\n"], dependencies: [{ kind: "component", type: DatepickerDropdownComponent, selector: "ap-datepicker-dropdown", inputs: ["mode", "selectedDate", "selectedDates", "selectedPeriod", "minDate", "maxDate", "dateLimit", "hint", "panelFooter", "firstDayOfWeek", "locale", "presets", "showBackdrop", "closeOnSelect", "disabled", "placement"], outputs: ["opened", "closed", "dateSelected", "periodSelected"] }, { kind: "directive", type: DropdownTriggerDirective, selector: "[apDropdownTrigger]", inputs: ["apDropdownTrigger"] }, { kind: "component", type: IconButtonComponent, selector: "ap-icon-button", inputs: ["ariaLabel", "name", "color", "disabled", "menuTrigger", "symbolId", "locked", "loading", "type"], outputs: ["onClick", "onFocus", "onBlur", "menuOpened", "menuClosed"] }, { kind: "component", type: InputGroupComponent, selector: "ap-input-group", inputs: ["symbolPosition", "disabled"] }, { kind: "directive", type: OverflowCountDirective, selector: "[apOverflowCount]", inputs: ["gap", "counterFallbackWidth", "minVisible"], exportAs: ["apOverflowCount"] }, { kind: "directive", type: OverflowCounterDirective, selector: "[apOverflowCounter]" }, { kind: "directive", type: OverflowItemDirective, selector: "[apOverflowItem]" }, { kind: "component", type: TagComponent, selector: "ap-tag", inputs: ["clearable", "add", "color", "mini"], outputs: ["clear", "added"] }, { kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "directive", type: TooltipDirective, selector: "[apTooltip]", inputs: ["apTooltip", "apTooltipPosition", "apTooltipShowDelay", "apTooltipHideDelay", "apTooltipDuration", "apTooltipDisabled", "apTooltipTruncatedTextOnly", "apTooltipTemplateContext", "apTooltipVirtualScrollElement", "apTooltipTrigger", "apTooltipType", "apTooltipPresentationContext", "apTooltipListItems", "apTooltipShowAvatarCaption"], exportAs: ["apTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
521
945
|
}
|
|
522
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type:
|
|
946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: DatepickerSelectComponent, decorators: [{
|
|
523
947
|
type: Component,
|
|
524
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-
|
|
948
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-datepicker-select', imports: [
|
|
525
949
|
DatepickerDropdownComponent,
|
|
526
950
|
DropdownTriggerDirective,
|
|
527
951
|
IconButtonComponent,
|
|
528
|
-
InputDirective,
|
|
529
952
|
InputGroupComponent,
|
|
953
|
+
OverflowCountDirective,
|
|
954
|
+
OverflowCounterDirective,
|
|
955
|
+
OverflowItemDirective,
|
|
956
|
+
TagComponent,
|
|
530
957
|
SymbolComponent,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
958
|
+
TooltipDirective,
|
|
959
|
+
], providers: [
|
|
960
|
+
withSymbols(apCalendar, apChevronDown, apChevronUp, apClock, apClose, apInfo),
|
|
961
|
+
// The vendored DaterangepickerComponent the panel renders injects LocaleService, and the plain
|
|
962
|
+
// NgxDaterangepickerMd module provides none — only its forRoot() does.
|
|
963
|
+
{ provide: LOCALE_CONFIG, useValue: {} },
|
|
964
|
+
LocaleService,
|
|
965
|
+
], host: {
|
|
966
|
+
class: 'ap-datepicker-select',
|
|
967
|
+
'[class.ap-datepicker-select--open]': 'isOpen()',
|
|
968
|
+
'[class.ap-datepicker-select--multiple]': 'mode() === DatepickerMode.Multiple',
|
|
969
|
+
}, encapsulation: ViewEncapsulation.None, template: "<!--\n The trigger is the group itself, not the row inside it: `[apDropdownTrigger]` only listens on its\n own host, and that row is content-height and sits inside the group's padding \u2014 so a click on the\n band above, below or beside it fell on nothing. The group is also what the panel should line up\n with, and `toggle()` anchors the overlay to the trigger.\n\n Nothing here is a bare `ap-input-group` child, so its `ap-symbol` ng-content slot is unused and\n the whole row lands in the default slot, in source order (icon, value, clear, chevron).\n-->\n<ap-input-group\n [apDropdownTrigger]=\"dropdown\"\n [disabled]=\"disabled()\">\n <div class=\"ap-datepicker-select__field\">\n <ap-symbol\n size=\"sm\"\n symbolId=\"calendar\" />\n\n <!--\n The combobox is this box and not the field around it: ng-select does the same, carrying the\n role on its inner input so the clear and the arrow stay its siblings rather than its\n descendants. The field keeps [apDropdownTrigger] \u2014 it is the click surface and the overlay's\n anchor \u2014 and the directive listens on its host, so keys pressed here still reach it by\n bubbling. Being the growing box (flex: 1) also makes it the one that measures the chip row.\n -->\n <div\n #overflow=\"apOverflowCount\"\n class=\"ap-datepicker-select__values\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n apOverflowCount\n [attr.aria-label]=\"ariaLabel()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-controls]=\"dropdown.panelId\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (blur)=\"touch.emit()\">\n @if (mode() === DatepickerMode.Multiple && chips().length > 0) {\n @for (chip of chips(); track chip.date.valueOf()) {\n <ap-tag\n apOverflowItem\n color=\"grey\"\n [mini]=\"true\"\n [clearable]=\"!disabled()\"\n (clear)=\"removeDate(chip)\">\n {{ chip.label }}\n </ap-tag>\n }\n @if (overflow.hiddenCount() > 0) {\n <ap-tag\n apOverflowCounter\n color=\"grey\"\n [mini]=\"true\">\n +{{ overflow.hiddenCount() }}\n </ap-tag>\n }\n } @else if (displayed()) {\n <span class=\"ap-datepicker-select__value\">{{ displayed() }}</span>\n } @else {\n <span class=\"ap-datepicker-select__placeholder\">{{ placeholder() }}</span>\n }\n </div>\n\n <!--\n Before the chevron, as ng-select orders its own container: value, clear, arrow. Sitting\n inside the trigger, a click here would bubble up and open the panel \u2014 hence the\n stopPropagation() in clear().\n -->\n @if (clearable() && hasValue() && !disabled()) {\n <ap-icon-button\n class=\"ap-datepicker-select__clear\"\n type=\"flat\"\n name=\"datepicker-clear\"\n symbolId=\"close\"\n ariaLabel=\"Clear selection\"\n (click)=\"clear($event)\" />\n }\n\n <span class=\"ap-datepicker-select__chevron\">\n <ap-symbol\n size=\"sm\"\n [symbolId]=\"isOpen() ? 'chevron-up' : 'chevron-down'\" />\n </span>\n </div>\n</ap-input-group>\n\n@if (timeZone(); as zone) {\n <div\n class=\"ap-datepicker-select__timezone\"\n apTooltipPosition=\"bottom\"\n [apTooltip]=\"zone\">\n <ap-symbol\n size=\"sm\"\n symbolId=\"clock\"\n color=\"grey\" />\n <span class=\"ap-datepicker-select__timezone-offset\">{{ timeZoneOffset() }}</span>\n </div>\n @if (timeZoneTooltip(); as tooltip) {\n <ap-symbol\n class=\"ap-datepicker-select__timezone-info\"\n size=\"sm\"\n symbolId=\"info\"\n color=\"grey-blue\"\n apTooltipPosition=\"bottom\"\n [apTooltip]=\"tooltip\" />\n }\n}\n\n<ap-datepicker-dropdown\n #dropdown\n [closeOnSelect]=\"closesOnSelect()\"\n [dateLimit]=\"maxRangeDays()\"\n [placement]=\"placement()\"\n [disabled]=\"disabled()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [hint]=\"panelHint()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [mode]=\"mode()\"\n [panelFooter]=\"panelFooter()\"\n [presets]=\"presets()\"\n [selectedDate]=\"selectedDate()\"\n [selectedDates]=\"selectedDates()\"\n [selectedPeriod]=\"selectedPeriod()\"\n (closed)=\"onPanelClosed()\"\n (dateSelected)=\"onDateSelected($event)\"\n (opened)=\"onPanelOpened()\"\n (periodSelected)=\"onPeriodSelected($event)\" />\n", styles: [".ap-datepicker-select{display:flex;width:100%;align-items:center;gap:var(--ref-spacing-sm)}.ap-datepicker-select ap-input-group{flex:1;min-width:0}.ap-datepicker-select .ap-input-group.disabled ap-symbol{color:inherit}.ap-datepicker-select--open .ap-input-group,.ap-datepicker-select--open .ap-input-group:hover:not(.disabled):not(:has(input[disabled])){border-color:var(--ref-color-electric-blue-100)}.ap-datepicker-select--open .ap-datepicker-select__chevron ap-symbol{color:var(--ref-color-electric-blue-100)}.ap-datepicker-select__field{display:flex;align-self:stretch;flex:1;min-width:0;align-items:center;gap:var(--ref-spacing-xxs);cursor:pointer;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size)}.ap-datepicker-select__field:focus-visible{outline:none}.ap-datepicker-select__values{display:flex;overflow:hidden;flex:1;min-width:0;align-items:center;gap:var(--ref-spacing-xxs)}.ap-datepicker-select__values>*{flex-shrink:0}.ap-datepicker-select__value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ap-datepicker-select__placeholder{color:var(--sys-text-color-light)}.ap-datepicker-select__chevron{display:inline-flex;align-items:center}.ap-datepicker-select__clear{--comp-icon-button-width: var(--sys-icon-css-md);--comp-icon-button-height: var(--sys-icon-css-md);--comp-icon-button-padding: 0}.ap-datepicker-select__clear .icon-button:hover:not(.stroked):not(.locked),.ap-datepicker-select__clear .icon-button:active:not(.stroked):not(.locked){background:transparent}.ap-datepicker-select__clear .icon-button ap-symbol{width:var(--sys-icon-css-xs);min-width:var(--sys-icon-css-xs);height:var(--sys-icon-css-xs);min-height:var(--sys-icon-css-xs)}.ap-datepicker-select__clear:hover .icon-button ap-symbol{color:var(--sys-color-error-text)}.ap-datepicker-select__timezone{display:inline-flex;align-items:center;gap:var(--ref-spacing-xxs)}.ap-datepicker-select__timezone-info{display:inline-flex;align-items:center}.ap-datepicker-select--multiple .ap-datepicker-select__values{gap:var(--ref-spacing-xxxs)}\n"] }]
|
|
970
|
+
}], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], maxRangeDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRangeDays", required: false }] }], panelHint: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelHint", required: false }] }], panelFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelFooter", required: false }] }], canSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSelect", required: false }] }], presets: [{ type: i0.Input, args: [{ isSignal: true, alias: "presets", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], timeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZone", required: false }] }], timeZoneTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeZoneTooltip", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], selectionRejected: [{ type: i0.Output, args: ["selectionRejected"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], dropdown: [{ type: i0.ViewChild, args: ['dropdown', { isSignal: true }] }] } });
|
|
535
971
|
|
|
536
972
|
/**
|
|
537
973
|
* Generated bundle index. Do not edit.
|
|
538
974
|
*/
|
|
539
975
|
|
|
540
|
-
export { DatepickerComponent, DatepickerDropdownComponent, DatepickerMode,
|
|
976
|
+
export { DatepickerComponent, DatepickerDropdownComponent, DatepickerMode, DatepickerMonthPickerComponent, DatepickerSelectComponent, assertValueMatchesMode, defaultDatepickerPresets, isPeriod };
|
|
541
977
|
//# sourceMappingURL=agorapulse-ui-components-datepicker.mjs.map
|