@cdevhub/ngx-tw 0.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/LICENSE +21 -0
- package/README.md +134 -0
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs +108 -0
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-alert.mjs +240 -0
- package/fesm2022/cdevhub-ngx-tw-alert.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs +287 -0
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-badge.mjs +332 -0
- package/fesm2022/cdevhub-ngx-tw-badge.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs +452 -0
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-button.mjs +227 -0
- package/fesm2022/cdevhub-ngx-tw-button.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs +417 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs +232 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs +4482 -0
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-card.mjs +157 -0
- package/fesm2022/cdevhub-ngx-tw-card.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs +1454 -0
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs +593 -0
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs +228 -0
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs +510 -0
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs +1721 -0
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs +721 -0
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-core.mjs +861 -0
- package/fesm2022/cdevhub-ngx-tw-core.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs +1558 -0
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs +1833 -0
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs +693 -0
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs +331 -0
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs +289 -0
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs +572 -0
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs +36 -0
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-icon.mjs +278 -0
- package/fesm2022/cdevhub-ngx-tw-icon.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-input.mjs +355 -0
- package/fesm2022/cdevhub-ngx-tw-input.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-item.mjs +241 -0
- package/fesm2022/cdevhub-ngx-tw-item.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-menu.mjs +433 -0
- package/fesm2022/cdevhub-ngx-tw-menu.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs +691 -0
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-popover.mjs +678 -0
- package/fesm2022/cdevhub-ngx-tw-popover.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs +335 -0
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-radio.mjs +708 -0
- package/fesm2022/cdevhub-ngx-tw-radio.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs +319 -0
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-select.mjs +1722 -0
- package/fesm2022/cdevhub-ngx-tw-select.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-separator.mjs +115 -0
- package/fesm2022/cdevhub-ngx-tw-separator.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs +768 -0
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs +149 -0
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-slider.mjs +1147 -0
- package/fesm2022/cdevhub-ngx-tw-slider.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-sort.mjs +346 -0
- package/fesm2022/cdevhub-ngx-tw-sort.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs +186 -0
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-split.mjs +1082 -0
- package/fesm2022/cdevhub-ngx-tw-split.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-stat.mjs +579 -0
- package/fesm2022/cdevhub-ngx-tw-stat.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs +443 -0
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-switch.mjs +391 -0
- package/fesm2022/cdevhub-ngx-tw-switch.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs +315 -0
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-table.mjs +994 -0
- package/fesm2022/cdevhub-ngx-tw-table.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs +508 -0
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs +147 -0
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-theme.mjs +178 -0
- package/fesm2022/cdevhub-ngx-tw-theme.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs +1344 -0
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs +1136 -0
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-toast.mjs +1311 -0
- package/fesm2022/cdevhub-ngx-tw-toast.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs +533 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw.mjs +61 -0
- package/fesm2022/cdevhub-ngx-tw.mjs.map +1 -0
- package/package.json +265 -0
- package/theme/_base.css +394 -0
- package/theme/_dark.css +510 -0
- package/theme/_high-contrast.css +290 -0
- package/theme/_semantic.css +317 -0
- package/theme/_typography.css +9 -0
- package/theme/index.css +54 -0
- package/types/cdevhub-ngx-tw-accordion.d.ts +48 -0
- package/types/cdevhub-ngx-tw-alert.d.ts +67 -0
- package/types/cdevhub-ngx-tw-avatar.d.ts +79 -0
- package/types/cdevhub-ngx-tw-badge.d.ts +94 -0
- package/types/cdevhub-ngx-tw-breadcrumbs.d.ts +227 -0
- package/types/cdevhub-ngx-tw-button.d.ts +74 -0
- package/types/cdevhub-ngx-tw-calendar-luxon.d.ts +200 -0
- package/types/cdevhub-ngx-tw-calendar-testing.d.ts +113 -0
- package/types/cdevhub-ngx-tw-calendar.d.ts +1704 -0
- package/types/cdevhub-ngx-tw-card.d.ts +48 -0
- package/types/cdevhub-ngx-tw-carousel.d.ts +406 -0
- package/types/cdevhub-ngx-tw-checkbox.d.ts +136 -0
- package/types/cdevhub-ngx-tw-code-block.d.ts +93 -0
- package/types/cdevhub-ngx-tw-collapsible.d.ts +151 -0
- package/types/cdevhub-ngx-tw-combobox.d.ts +389 -0
- package/types/cdevhub-ngx-tw-command-palette.d.ts +215 -0
- package/types/cdevhub-ngx-tw-core.d.ts +719 -0
- package/types/cdevhub-ngx-tw-date-picker.d.ts +317 -0
- package/types/cdevhub-ngx-tw-date-range-picker.d.ts +313 -0
- package/types/cdevhub-ngx-tw-dialog.d.ts +303 -0
- package/types/cdevhub-ngx-tw-empty-state.d.ts +104 -0
- package/types/cdevhub-ngx-tw-flip-card.d.ts +95 -0
- package/types/cdevhub-ngx-tw-form-field.d.ts +210 -0
- package/types/cdevhub-ngx-tw-icon-lucide.d.ts +29 -0
- package/types/cdevhub-ngx-tw-icon.d.ts +134 -0
- package/types/cdevhub-ngx-tw-input.d.ts +110 -0
- package/types/cdevhub-ngx-tw-item.d.ts +70 -0
- package/types/cdevhub-ngx-tw-menu.d.ts +99 -0
- package/types/cdevhub-ngx-tw-paginator.d.ts +305 -0
- package/types/cdevhub-ngx-tw-popover.d.ts +157 -0
- package/types/cdevhub-ngx-tw-progress-bar.d.ts +100 -0
- package/types/cdevhub-ngx-tw-radio.d.ts +174 -0
- package/types/cdevhub-ngx-tw-segmented-control.d.ts +66 -0
- package/types/cdevhub-ngx-tw-select.d.ts +384 -0
- package/types/cdevhub-ngx-tw-separator.d.ts +28 -0
- package/types/cdevhub-ngx-tw-sheet.d.ts +335 -0
- package/types/cdevhub-ngx-tw-skeleton.d.ts +52 -0
- package/types/cdevhub-ngx-tw-slider.d.ts +258 -0
- package/types/cdevhub-ngx-tw-sort.d.ts +136 -0
- package/types/cdevhub-ngx-tw-spinner.d.ts +50 -0
- package/types/cdevhub-ngx-tw-split.d.ts +265 -0
- package/types/cdevhub-ngx-tw-stat.d.ts +140 -0
- package/types/cdevhub-ngx-tw-stepper.d.ts +127 -0
- package/types/cdevhub-ngx-tw-switch.d.ts +88 -0
- package/types/cdevhub-ngx-tw-tab-nav.d.ts +107 -0
- package/types/cdevhub-ngx-tw-table.d.ts +479 -0
- package/types/cdevhub-ngx-tw-tabs.d.ts +121 -0
- package/types/cdevhub-ngx-tw-textarea.d.ts +62 -0
- package/types/cdevhub-ngx-tw-theme.d.ts +106 -0
- package/types/cdevhub-ngx-tw-time-picker.d.ts +303 -0
- package/types/cdevhub-ngx-tw-timeline.d.ts +278 -0
- package/types/cdevhub-ngx-tw-toast.d.ts +388 -0
- package/types/cdevhub-ngx-tw-tooltip.d.ts +95 -0
- package/types/cdevhub-ngx-tw.d.ts +49 -0
|
@@ -0,0 +1,1704 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Provider, InjectionToken, Type, OnInit, ModelSignal, InputSignal, TemplateRef, OutputEmitterRef, Signal, WritableSignal, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
4
|
+
import { RangeBehaviorConfig } from '@cdevhub/ngx-tw/core';
|
|
5
|
+
import { FormValueControl, ValidationError, WithOptionalFieldTree, DisabledReason } from '@angular/forms/signals';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context payload passed to `cellAccessibleName` so consumers can produce a
|
|
9
|
+
* locale-appropriate accessible name for any cell in any view (§15.6, §19.4).
|
|
10
|
+
*/
|
|
11
|
+
interface CalendarCellAccessibleNameContext {
|
|
12
|
+
/** The date the cell represents. */
|
|
13
|
+
readonly date: Date;
|
|
14
|
+
/** Which view the cell lives in. */
|
|
15
|
+
readonly mode: 'day' | 'month' | 'year';
|
|
16
|
+
/** True when the cell is part of the committed selection. */
|
|
17
|
+
readonly selected?: boolean;
|
|
18
|
+
/** True when the cell is today. */
|
|
19
|
+
readonly today?: boolean;
|
|
20
|
+
/** True when the cell is non-interactive (constraint or filter). */
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
/** Optional pre-formatted display string the consumer may incorporate. */
|
|
23
|
+
readonly display?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Localized strings + ARIA announcements consumed by the calendar (§19.4).
|
|
27
|
+
*
|
|
28
|
+
* Override per-field via Angular DI — provide a custom instance, or pass a
|
|
29
|
+
* `Partial<CalendarIntl>` into the calendar component's `intl` input. Unset
|
|
30
|
+
* fields fall through to the English defaults shipped here.
|
|
31
|
+
*
|
|
32
|
+
* All members take primitives so consumers can write straight string
|
|
33
|
+
* literals or template helpers without depending on internal types.
|
|
34
|
+
*/
|
|
35
|
+
declare class CalendarIntl {
|
|
36
|
+
/**
|
|
37
|
+
* Plural rules used for the four plural-marked keys in §19.4: range length,
|
|
38
|
+
* "X dates selected", "Skipped {N} periods", and the year-range button label.
|
|
39
|
+
* Resolved lazily so SSR / non-`Intl` environments don't crash at construction.
|
|
40
|
+
*/
|
|
41
|
+
private _plural;
|
|
42
|
+
private getPlural;
|
|
43
|
+
/** Aria label for the "previous month" navigation button (day view). */
|
|
44
|
+
previousMonthLabel: string;
|
|
45
|
+
/** Aria label for the "next month" navigation button (day view). */
|
|
46
|
+
nextMonthLabel: string;
|
|
47
|
+
/** Aria label for the "previous year" navigation button (month view). */
|
|
48
|
+
previousYearLabel: string;
|
|
49
|
+
/** Aria label for the "next year" navigation button (month view). */
|
|
50
|
+
nextYearLabel: string;
|
|
51
|
+
/** Aria label for the "previous N years" navigation button (year view). */
|
|
52
|
+
previousYearsLabel(yearsPerPage: number): string;
|
|
53
|
+
/** Aria label for the "next N years" navigation button (year view). */
|
|
54
|
+
nextYearsLabel(yearsPerPage: number): string;
|
|
55
|
+
/** Aria label for the "today" shortcut button (footer). */
|
|
56
|
+
todayLabel: string;
|
|
57
|
+
/** Aria label for the "clear" button (footer). */
|
|
58
|
+
clearLabel: string;
|
|
59
|
+
/** Aria label for the "apply" button (footer). */
|
|
60
|
+
applyLabel: string;
|
|
61
|
+
/** Aria label for the trigger/open-calendar button. */
|
|
62
|
+
openCalendarLabel: string;
|
|
63
|
+
/** Aria label for the "choose date" trigger. */
|
|
64
|
+
chooseDateLabel: string;
|
|
65
|
+
/** Aria label applied to the calendar root element. */
|
|
66
|
+
calendarLabel: string;
|
|
67
|
+
/** Aria label appended to the period button while in the day view. */
|
|
68
|
+
monthViewLabel: string;
|
|
69
|
+
/** Aria label appended to the period button while in the month view. */
|
|
70
|
+
yearViewLabel: string;
|
|
71
|
+
/** Aria label for the year (decade) view. */
|
|
72
|
+
decadeViewLabel: string;
|
|
73
|
+
/** Tooltip / aria text for the "switch to month view" affordance. */
|
|
74
|
+
switchToMonthViewLabel(period: string): string;
|
|
75
|
+
/** Tooltip / aria text for the "switch to year view" affordance. */
|
|
76
|
+
switchToYearViewLabel(period: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the accessible name a screen reader announces for any cell.
|
|
79
|
+
* Default implementation appends "today" / "selected" / "disabled" suffixes
|
|
80
|
+
* to the supplied `display` string.
|
|
81
|
+
*/
|
|
82
|
+
cellAccessibleName(ctx: CalendarCellAccessibleNameContext): string;
|
|
83
|
+
/** Live-region message after navigating the displayed period. */
|
|
84
|
+
navigatedTo(direction: 'previous' | 'next', period: string): string;
|
|
85
|
+
/** Live-region message after a single-mode selection commits. */
|
|
86
|
+
selectedAnnouncement(value: string): string;
|
|
87
|
+
/** Live-region message after the start of a range is picked. */
|
|
88
|
+
rangeStartAnnouncement(start: string): string;
|
|
89
|
+
/** Live-region message after a range commits. Plural-marked on `lengthDays`. */
|
|
90
|
+
rangeUpdateAnnouncement(start: string, end: string, lengthDays: number): string;
|
|
91
|
+
/** Live-region message after a `mode: 'multiple'` selection commits. Plural-marked. */
|
|
92
|
+
multipleSelectionAnnouncement(count: number): string;
|
|
93
|
+
/** Live-region message after the active view changes. */
|
|
94
|
+
viewSwitched(view: 'day' | 'month' | 'year', period: string): string;
|
|
95
|
+
/** Live-region template used while a range pick is in progress. */
|
|
96
|
+
inProgressTemplate(state: string): string;
|
|
97
|
+
/** Live-region message announcing how many empty periods auto-skip jumped over. Plural-marked. */
|
|
98
|
+
skippedPeriods(count: number, destination: string): string;
|
|
99
|
+
/** Live-region message announced when a click is rejected and the cell flashes (e.g. `'require-clear'` rejection, disabled-cross range commit). */
|
|
100
|
+
selectionRejectedAnnouncement: string;
|
|
101
|
+
/**
|
|
102
|
+
* When `true`, the calendar suppresses live-region announcements for the
|
|
103
|
+
* affected user actions. Override in tests or low-noise environments.
|
|
104
|
+
*/
|
|
105
|
+
skipAnnouncement: boolean;
|
|
106
|
+
/** Message for the `calendarRequired` validation error. */
|
|
107
|
+
requiredError: string;
|
|
108
|
+
/** Message for the `calendarMinDate` validation error. */
|
|
109
|
+
minDateError(date: string): string;
|
|
110
|
+
/** Message for the `calendarMaxDate` validation error. */
|
|
111
|
+
maxDateError(date: string): string;
|
|
112
|
+
/** Message for the `calendarInvalidValue` validation error. */
|
|
113
|
+
invalidValueError: string;
|
|
114
|
+
/** Message for the `calendarRangeTooShort` validation error. Plural-marked on `min`. */
|
|
115
|
+
rangeTooShortError(min: number): string;
|
|
116
|
+
/** Message for the `calendarRangeTooLong` validation error. Plural-marked on `max`. */
|
|
117
|
+
rangeTooLongError(max: number): string;
|
|
118
|
+
/** Message for the `calendarInvalidRange` validation error. */
|
|
119
|
+
invalidRangeError: string;
|
|
120
|
+
/** Message for the `calendarDisabledDate` validation error. */
|
|
121
|
+
dateFilterError: string;
|
|
122
|
+
/** Message for the `calendarMaxSelections` validation error. */
|
|
123
|
+
maxSelectionsError(limit: number): string;
|
|
124
|
+
/** Label announced when a typed date fails to parse. */
|
|
125
|
+
parseErrorLabel: string;
|
|
126
|
+
/** Multi-line description of the keyboard contract for screen readers / help dialogs. */
|
|
127
|
+
keyboardHelpText: string;
|
|
128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarIntl, never>;
|
|
129
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CalendarIntl>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Provides a custom `CalendarIntl` instance. Place at any injector level —
|
|
133
|
+
* the calendar resolves the closest one and merges any per-instance `intl`
|
|
134
|
+
* input on top of it (§19.4 per-field merge semantics).
|
|
135
|
+
*/
|
|
136
|
+
declare function provideCalendarIntl(custom: Partial<CalendarIntl>): Provider;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Calendar shared types. Aligned with `docs/requirements/calendar-component-requirements.md` v2.6
|
|
140
|
+
* (§7.1, §7.4, §8, §10.2, §22.5, §33).
|
|
141
|
+
*/
|
|
142
|
+
/** Selection mode exposed via the `mode` input. `'week'` is `[WONT] v1` — week-as-unit selection remains available via the DI-only `WeekSelectionStrategy`. */
|
|
143
|
+
type CalendarMode = 'single' | 'multiple' | 'range';
|
|
144
|
+
/** Value shape for `mode: 'single'`. */
|
|
145
|
+
type CalendarSingleValue<D> = D | null;
|
|
146
|
+
/** Value shape for `mode: 'multiple'`. */
|
|
147
|
+
type CalendarMultipleValue<D> = D[];
|
|
148
|
+
/** Value shape for `mode: 'range'`. Endpoints are independent — either can be `null`. */
|
|
149
|
+
interface CalendarRangeValue<D> {
|
|
150
|
+
readonly start: D | null;
|
|
151
|
+
readonly end: D | null;
|
|
152
|
+
}
|
|
153
|
+
/** Mode-parameterized value. `mode: 'single' → D | null`, `'multiple' → D[]`, `'range' → { start; end }`. */
|
|
154
|
+
type CalendarValue<M extends CalendarMode, D> = M extends 'single' ? CalendarSingleValue<D> : M extends 'multiple' ? CalendarMultipleValue<D> : M extends 'range' ? CalendarRangeValue<D> : never;
|
|
155
|
+
/** Mode-agnostic empty value — `null` for single, `[]` for multiple, `{ start: null, end: null }` for range. */
|
|
156
|
+
declare function emptyCalendarValue<M extends CalendarMode, D>(mode: M): CalendarValue<M, D>;
|
|
157
|
+
/** Selection lifecycle. */
|
|
158
|
+
type CalendarSelectionState = 'EMPTY' | 'SELECTING' | 'COMPLETE';
|
|
159
|
+
/** Which grid the user is looking at. `'day'` = 7×6 day grid, `'month'` = 4×3 months in a year, `'year'` = a page of years. */
|
|
160
|
+
type CalendarViewState = 'day' | 'month' | 'year';
|
|
161
|
+
/** Overlay presentation lifecycle (Phase 10 wires the transitions). In inline mode this signal resolves to `null`. */
|
|
162
|
+
type CalendarOverlayState = 'closed' | 'opening' | 'open' | 'closing';
|
|
163
|
+
/** How `mode: 'range'` handles the third click after a complete range. */
|
|
164
|
+
type RangeClickBehavior = 'restart' | 'nearest-edge' | 'require-clear';
|
|
165
|
+
/** Granularity at which `mode: 'range'` commits (day-of-month, month-of-year, year). */
|
|
166
|
+
type RangeGranularity = 'day' | 'month' | 'year';
|
|
167
|
+
/** What happens when the user tries to select past `maxSelections` in `mode: 'multiple'`. */
|
|
168
|
+
type MaxSelectionBehavior = 'emit-limit-reached' | 'replace-oldest' | 'ignore';
|
|
169
|
+
/** How a form reset restores the calendar's internal state. `'full'` also resets view / active-date; `'value-only'` leaves navigation in place. */
|
|
170
|
+
type ResetBehavior = 'full' | 'value-only';
|
|
171
|
+
/** Presentation on small viewports. `'auto'` = native overlay on ≥ 600 px, fullscreen otherwise. */
|
|
172
|
+
type MobileMode = 'overlay' | 'fullscreen' | 'bottom-sheet' | 'auto';
|
|
173
|
+
/** Union of validation error keys emitted by the built-in validator. Stable across versions. */
|
|
174
|
+
type CalendarErrorCode = 'calendarRequired' | 'calendarMinDate' | 'calendarMaxDate' | 'calendarDisabledDate' | 'calendarRangeTooShort' | 'calendarRangeTooLong' | 'calendarMaxSelections' | 'calendarInvalidRange' | 'calendarParseError' | 'calendarInvalidValue';
|
|
175
|
+
/** Shape returned by the built-in validator. Each code carries the context payload described in §10.2. */
|
|
176
|
+
type CalendarValidationErrors = Partial<{
|
|
177
|
+
calendarRequired: true;
|
|
178
|
+
calendarMinDate: {
|
|
179
|
+
min: unknown;
|
|
180
|
+
actual: unknown;
|
|
181
|
+
};
|
|
182
|
+
calendarMaxDate: {
|
|
183
|
+
max: unknown;
|
|
184
|
+
actual: unknown;
|
|
185
|
+
};
|
|
186
|
+
calendarDisabledDate: {
|
|
187
|
+
actual: unknown;
|
|
188
|
+
};
|
|
189
|
+
calendarRangeTooShort: {
|
|
190
|
+
length: number;
|
|
191
|
+
min: number;
|
|
192
|
+
};
|
|
193
|
+
calendarRangeTooLong: {
|
|
194
|
+
length: number;
|
|
195
|
+
max: number;
|
|
196
|
+
};
|
|
197
|
+
calendarMaxSelections: {
|
|
198
|
+
limit: number;
|
|
199
|
+
actual: number;
|
|
200
|
+
};
|
|
201
|
+
calendarInvalidRange: {
|
|
202
|
+
start: unknown;
|
|
203
|
+
end: unknown;
|
|
204
|
+
};
|
|
205
|
+
calendarParseError: {
|
|
206
|
+
raw: string;
|
|
207
|
+
};
|
|
208
|
+
calendarInvalidValue: {
|
|
209
|
+
expected: 'single' | 'multiple' | 'range';
|
|
210
|
+
actual: unknown;
|
|
211
|
+
reason: 'shape' | 'transformer';
|
|
212
|
+
};
|
|
213
|
+
}>;
|
|
214
|
+
/** Payload of `selectionComplete`. `reason` flags the commit path. */
|
|
215
|
+
interface SelectionCompleteEvent<M extends CalendarMode, D> {
|
|
216
|
+
readonly value: CalendarValue<M, D>;
|
|
217
|
+
readonly reason: 'commit' | 'auto-swap' | 'nearest-edge' | 'preset';
|
|
218
|
+
}
|
|
219
|
+
/** Payload of `selectionCleared`. `reason` disambiguates user action from programmatic / mode-change / reset / disabled. */
|
|
220
|
+
interface SelectionClearedEvent {
|
|
221
|
+
readonly reason: 'user' | 'programmatic' | 'mode-change' | 'reset' | 'disabled';
|
|
222
|
+
}
|
|
223
|
+
/** Payload of `rangePreview`. `invalidPreview` is set when the hover crosses a disabled date and `disableRangesCrossingDisabledDates` is true, or the range length violates `min`/`maxRangeLength` (Phase 4 / 6 set this). */
|
|
224
|
+
interface RangePreviewEvent<D> {
|
|
225
|
+
readonly tentativeRange: {
|
|
226
|
+
readonly start: D;
|
|
227
|
+
readonly end: D;
|
|
228
|
+
};
|
|
229
|
+
readonly invalidPreview: boolean;
|
|
230
|
+
}
|
|
231
|
+
/** Payload of `viewChange`. Distinguishes drill-down (day→month→year) from drill-up and from programmatic changes. */
|
|
232
|
+
interface ViewChangeEvent {
|
|
233
|
+
readonly from: CalendarViewState;
|
|
234
|
+
readonly to: CalendarViewState;
|
|
235
|
+
readonly reason: 'user' | 'programmatic' | 'drill-down' | 'drill-up';
|
|
236
|
+
}
|
|
237
|
+
/** Payload of `modeChange`. */
|
|
238
|
+
interface ModeChangeEvent {
|
|
239
|
+
readonly from: CalendarMode;
|
|
240
|
+
readonly to: CalendarMode;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A date range with optional endpoints.
|
|
244
|
+
* Kept as a structural type for backward-compat with the existing view implementation;
|
|
245
|
+
* `CalendarRangeValue<D>` is the spec-canonical alias.
|
|
246
|
+
*/
|
|
247
|
+
interface DateRange<D> {
|
|
248
|
+
readonly start: D | null;
|
|
249
|
+
readonly end: D | null;
|
|
250
|
+
}
|
|
251
|
+
/** Factory for a plain `DateRange<D>`. */
|
|
252
|
+
declare function createDateRange<D>(start: D | null, end: D | null): DateRange<D>;
|
|
253
|
+
/**
|
|
254
|
+
* Visual state of a single cell in any view.
|
|
255
|
+
* Phase 4 replaces this with the `data-state-*` attribute surface (§34.5).
|
|
256
|
+
*/
|
|
257
|
+
type CalendarCellState = 'default' | 'today' | 'selected' | 'range-start' | 'range-middle' | 'range-end' | 'disabled' | 'preview-start' | 'preview-middle' | 'preview-end';
|
|
258
|
+
/**
|
|
259
|
+
* Data describing one renderable cell.
|
|
260
|
+
* Phase 13 replaces this with `DayCellContext<D, T>` (§24.1) — kept in place through
|
|
261
|
+
* Phases 1–12 so the existing month/year/years views compile without a wholesale view rewrite.
|
|
262
|
+
*/
|
|
263
|
+
interface CalendarCell<D> {
|
|
264
|
+
/** The date value this cell represents. */
|
|
265
|
+
value: D;
|
|
266
|
+
/** Display text inside the cell (day number, short month name, year). */
|
|
267
|
+
displayValue: string;
|
|
268
|
+
/** Accessible label announced to screen readers. */
|
|
269
|
+
ariaLabel: string;
|
|
270
|
+
/** Whether the cell is interactive. Disabled cells still render. */
|
|
271
|
+
enabled: boolean;
|
|
272
|
+
/** Consumer-provided CSS classes (via `dateClass`). */
|
|
273
|
+
cssClasses: string;
|
|
274
|
+
/** True when this cell is today's date. */
|
|
275
|
+
isToday: boolean;
|
|
276
|
+
/** True when this cell is the committed selection (or part of a range). */
|
|
277
|
+
isSelected: boolean;
|
|
278
|
+
/** True when this cell starts a committed range. */
|
|
279
|
+
isRangeStart: boolean;
|
|
280
|
+
/** True when this cell is strictly inside a committed range. */
|
|
281
|
+
isRangeMiddle: boolean;
|
|
282
|
+
/** True when this cell ends a committed range. */
|
|
283
|
+
isRangeEnd: boolean;
|
|
284
|
+
/** True when this cell starts the hover-preview range. */
|
|
285
|
+
isPreviewStart: boolean;
|
|
286
|
+
/** True when this cell is inside the hover-preview range. */
|
|
287
|
+
isPreviewMiddle: boolean;
|
|
288
|
+
/** True when this cell ends the hover-preview range. */
|
|
289
|
+
isPreviewEnd: boolean;
|
|
290
|
+
/** True when this cell falls outside the currently displayed month (day view only). */
|
|
291
|
+
isOutOfMonth: boolean;
|
|
292
|
+
/** True when this cell is a weekend day (Sat/Sun by default; locale-aware override planned). */
|
|
293
|
+
isWeekend: boolean;
|
|
294
|
+
/** True when this cell is part of a tentative range that violates a constraint (e.g., crosses a disabled date or exceeds `maxRangeLength`). */
|
|
295
|
+
isInvalidPreview: boolean;
|
|
296
|
+
/** True when the cell briefly flashes to indicate a rejected click (e.g., disabled commit, `rangeClickBehavior: 'require-clear'`). Auto-cleared by the orchestrator. */
|
|
297
|
+
isInvalidFlash: boolean;
|
|
298
|
+
/** Numeric comparison key used for focus tracking. */
|
|
299
|
+
compareValue: number;
|
|
300
|
+
}
|
|
301
|
+
/** Configuration accepted by `createCalendarCell`. */
|
|
302
|
+
interface CalendarCellConfig<D> {
|
|
303
|
+
value: D;
|
|
304
|
+
displayValue: string;
|
|
305
|
+
ariaLabel: string;
|
|
306
|
+
enabled?: boolean;
|
|
307
|
+
cssClasses?: string;
|
|
308
|
+
compareValue: number;
|
|
309
|
+
}
|
|
310
|
+
/** Factory for a `CalendarCell` with boolean state fields zeroed out. */
|
|
311
|
+
declare function createCalendarCell<D>(config: CalendarCellConfig<D>): CalendarCell<D>;
|
|
312
|
+
/** Style for month and weekday names. */
|
|
313
|
+
type NameStyle = 'long' | 'short' | 'narrow';
|
|
314
|
+
/** Days in a week. */
|
|
315
|
+
declare const DAYS_PER_WEEK = 7;
|
|
316
|
+
/** Rows in a month grid. */
|
|
317
|
+
declare const WEEKS_PER_MONTH = 6;
|
|
318
|
+
/** Default years shown per page in the year view. Phase 7 replaces this constant with the `yearsPerPage` input (default 20 per §33.1). */
|
|
319
|
+
declare const YEARS_PER_PAGE = 24;
|
|
320
|
+
/** Years per row in the year view. */
|
|
321
|
+
declare const YEARS_PER_ROW = 4;
|
|
322
|
+
/** Months per row in the month (of year) view. */
|
|
323
|
+
declare const MONTHS_PER_ROW = 4;
|
|
324
|
+
/** Predicate for per-date disabling — return `false` to disable. */
|
|
325
|
+
type DateFilterFn<D> = (date: D) => boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Source for `disabledDates` (§10.1) — accepts either an explicit array of disabled dates
|
|
328
|
+
* (compared via `adapter.sameDate`) or a predicate returning `true` for disabled dates.
|
|
329
|
+
*
|
|
330
|
+
* Note: this is the inverse of `dateFilter` (which returns `true` for ENABLED dates).
|
|
331
|
+
* Both inputs are honored — a date is disabled if either source flags it.
|
|
332
|
+
*/
|
|
333
|
+
type DisabledDates<D> = readonly D[] | ((date: D) => boolean);
|
|
334
|
+
/**
|
|
335
|
+
* Aggregated constraint inputs (§10.1). Doubles as the shorthand object accepted by
|
|
336
|
+
* `CalendarComponent`'s `constraints` input — every field is optional so consumers can
|
|
337
|
+
* supply only what they need (e.g. `{ minDate, maxDate }` or `{ dateFilter }`). The
|
|
338
|
+
* orchestrator's resolver normalizes missing fields to neutral values (`null` /
|
|
339
|
+
* empty array) before evaluating cell state.
|
|
340
|
+
*
|
|
341
|
+
* Resolution rule on the `constraints` input: the individual `minDate` / `maxDate` /
|
|
342
|
+
* `disabledDates` / `disabledDaysOfWeek` / `dateFilter` inputs win when both are set
|
|
343
|
+
* non-null. This lets a consumer pass `[constraints]="defaults"` for a base set and
|
|
344
|
+
* still override one field via the dedicated input.
|
|
345
|
+
*/
|
|
346
|
+
interface CalendarConstraints<D> {
|
|
347
|
+
readonly minDate?: D | null;
|
|
348
|
+
readonly maxDate?: D | null;
|
|
349
|
+
readonly disabledDates?: DisabledDates<D> | null;
|
|
350
|
+
readonly disabledDaysOfWeek?: readonly number[] | null;
|
|
351
|
+
readonly dateFilter?: DateFilterFn<D> | null;
|
|
352
|
+
}
|
|
353
|
+
/** Function producing extra per-cell CSS classes. */
|
|
354
|
+
type DateClassFn<D> = (date: D, view: CalendarViewState) => string;
|
|
355
|
+
|
|
356
|
+
/** Outcome returned by a selection strategy's `select` call. */
|
|
357
|
+
interface SelectionResult<D, S> {
|
|
358
|
+
/** The new selection value after applying the click. */
|
|
359
|
+
readonly selection: S;
|
|
360
|
+
/** Whether the selection is committed. */
|
|
361
|
+
readonly isComplete: boolean;
|
|
362
|
+
/** Optional range used by the preview layer while the selection is in progress. */
|
|
363
|
+
readonly preview?: DateRange<D> | null;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Pluggable selection behaviour. Provide via `CALENDAR_SELECTION_STRATEGY` to
|
|
367
|
+
* customise how clicks mutate the calendar's `selected` value.
|
|
368
|
+
*
|
|
369
|
+
* `D` is the date type understood by the active `DateAdapter`.
|
|
370
|
+
* `S` is the shape of the `selected` value — `D | null` for single,
|
|
371
|
+
* `DateRange<D> | null` for range / week, `readonly D[]` for multi.
|
|
372
|
+
*/
|
|
373
|
+
declare abstract class CalendarSelectionStrategy<D, S = unknown> {
|
|
374
|
+
/** Produces the new selection after a click on `date`. */
|
|
375
|
+
abstract select(date: D, current: S): SelectionResult<D, S>;
|
|
376
|
+
/** Returns the range to highlight while the pointer hovers `active`. */
|
|
377
|
+
abstract createPreview(active: D | null, current: S): DateRange<D> | null;
|
|
378
|
+
/** Whether `date` should render as selected. */
|
|
379
|
+
abstract isSelected(date: D, current: S): boolean;
|
|
380
|
+
/** Whether `date` is the start of a committed range. */
|
|
381
|
+
abstract isRangeStart(date: D, current: S): boolean;
|
|
382
|
+
/** Whether `date` is the end of a committed range. */
|
|
383
|
+
abstract isRangeEnd(date: D, current: S): boolean;
|
|
384
|
+
/** Whether `date` sits strictly between the endpoints of a committed range. */
|
|
385
|
+
abstract isRangeMiddle(date: D, current: S): boolean;
|
|
386
|
+
}
|
|
387
|
+
/** Injection token for the active selection strategy. */
|
|
388
|
+
declare const CALENDAR_SELECTION_STRATEGY: InjectionToken<CalendarSelectionStrategy<unknown, unknown>>;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Single-date selection. Every click commits a new selection immediately.
|
|
392
|
+
* No preview range. `selected` has shape `D | null`.
|
|
393
|
+
*/
|
|
394
|
+
declare class SingleSelectionStrategy<D> extends CalendarSelectionStrategy<D, D | null> {
|
|
395
|
+
private readonly dateAdapter;
|
|
396
|
+
select(date: D, _current: D | null): SelectionResult<D, D | null>;
|
|
397
|
+
createPreview(_active: D | null, _current: D | null): DateRange<D> | null;
|
|
398
|
+
isSelected(date: D, current: D | null): boolean;
|
|
399
|
+
isRangeStart(_date: D, _current: D | null): boolean;
|
|
400
|
+
isRangeEnd(_date: D, _current: D | null): boolean;
|
|
401
|
+
isRangeMiddle(_date: D, _current: D | null): boolean;
|
|
402
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SingleSelectionStrategy<any>, never>;
|
|
403
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SingleSelectionStrategy<any>>;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Date-range selection.
|
|
408
|
+
*
|
|
409
|
+
* - First click sets the start (selection incomplete).
|
|
410
|
+
* - Second click sets the end (selection complete).
|
|
411
|
+
* - If the second date is before the first, endpoints are swapped.
|
|
412
|
+
* - Hovering after the first click produces a preview range.
|
|
413
|
+
*
|
|
414
|
+
* `selected` has shape `DateRange<D> | null`.
|
|
415
|
+
*/
|
|
416
|
+
declare class RangeSelectionStrategy<D> extends CalendarSelectionStrategy<D, DateRange<D> | null> {
|
|
417
|
+
private readonly dateAdapter;
|
|
418
|
+
select(date: D, current: DateRange<D> | null): SelectionResult<D, DateRange<D> | null>;
|
|
419
|
+
createPreview(active: D | null, current: DateRange<D> | null): DateRange<D> | null;
|
|
420
|
+
isSelected(date: D, current: DateRange<D> | null): boolean;
|
|
421
|
+
isRangeStart(date: D, current: DateRange<D> | null): boolean;
|
|
422
|
+
isRangeEnd(date: D, current: DateRange<D> | null): boolean;
|
|
423
|
+
isRangeMiddle(date: D, current: DateRange<D> | null): boolean;
|
|
424
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RangeSelectionStrategy<any>, never>;
|
|
425
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RangeSelectionStrategy<any>>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Multi-date selection.
|
|
430
|
+
*
|
|
431
|
+
* - Each click toggles the date in/out of the selection array.
|
|
432
|
+
* - Each click commits immediately (no intermediate preview).
|
|
433
|
+
* - `selected` has shape `D[]`.
|
|
434
|
+
*/
|
|
435
|
+
declare class MultiSelectionStrategy<D> extends CalendarSelectionStrategy<D, D[]> {
|
|
436
|
+
private readonly dateAdapter;
|
|
437
|
+
select(date: D, current: D[]): SelectionResult<D, D[]>;
|
|
438
|
+
createPreview(_active: D | null, _current: D[]): DateRange<D> | null;
|
|
439
|
+
isSelected(date: D, current: D[]): boolean;
|
|
440
|
+
isRangeStart(_date: D, _current: D[]): boolean;
|
|
441
|
+
isRangeEnd(_date: D, _current: D[]): boolean;
|
|
442
|
+
isRangeMiddle(_date: D, _current: D[]): boolean;
|
|
443
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MultiSelectionStrategy<any>, never>;
|
|
444
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MultiSelectionStrategy<any>>;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Week selection.
|
|
449
|
+
*
|
|
450
|
+
* - Any click selects the entire week containing that day.
|
|
451
|
+
* - Week bounds use `DateAdapter.getFirstDayOfWeek()`.
|
|
452
|
+
* - Each click commits immediately.
|
|
453
|
+
* - Hovering previews the week the cursor is in.
|
|
454
|
+
*
|
|
455
|
+
* `selected` has shape `DateRange<D> | null`.
|
|
456
|
+
*/
|
|
457
|
+
declare class WeekSelectionStrategy<D> extends CalendarSelectionStrategy<D, DateRange<D> | null> {
|
|
458
|
+
private readonly dateAdapter;
|
|
459
|
+
select(date: D, _current: DateRange<D> | null): SelectionResult<D, DateRange<D> | null>;
|
|
460
|
+
createPreview(active: D | null, _current: DateRange<D> | null): DateRange<D> | null;
|
|
461
|
+
isSelected(date: D, current: DateRange<D> | null): boolean;
|
|
462
|
+
isRangeStart(date: D, current: DateRange<D> | null): boolean;
|
|
463
|
+
isRangeEnd(date: D, current: DateRange<D> | null): boolean;
|
|
464
|
+
isRangeMiddle(date: D, current: DateRange<D> | null): boolean;
|
|
465
|
+
private weekRange;
|
|
466
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WeekSelectionStrategy<any>, never>;
|
|
467
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WeekSelectionStrategy<any>>;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** Provides single-date selection (default behaviour). */
|
|
471
|
+
declare function provideSingleSelectionStrategy(): Provider;
|
|
472
|
+
/** Provides two-click date-range selection. */
|
|
473
|
+
declare function provideRangeSelectionStrategy(): Provider;
|
|
474
|
+
/** Provides toggle-based multi-date selection. */
|
|
475
|
+
declare function provideMultiSelectionStrategy(): Provider;
|
|
476
|
+
/** Provides week-at-a-time selection. */
|
|
477
|
+
declare function provideWeekSelectionStrategy(): Provider;
|
|
478
|
+
/** Provides an arbitrary custom selection strategy. */
|
|
479
|
+
declare function provideCalendarSelectionStrategy<D, S>(strategy: Type<CalendarSelectionStrategy<D, S>>): Provider;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Main calendar orchestrator. Composes the header and view components
|
|
483
|
+
* (day, month, year) with view switching, navigation, focus management,
|
|
484
|
+
* and the §8 internal state model. Every date operation is delegated to
|
|
485
|
+
* an injected `DateAdapter` — call `provideNativeDateAdapter()` in your
|
|
486
|
+
* app to bootstrap the default one.
|
|
487
|
+
*
|
|
488
|
+
* Generic parameters (§7.3):
|
|
489
|
+
* - `M` — selection mode. Narrows `value` to the mode-specific shape.
|
|
490
|
+
* - `D` — adapter date type.
|
|
491
|
+
* - `TOut` — post-transformer form value type (Phase 14 wires it; until then
|
|
492
|
+
* it defaults to `CalendarValue<M, D>` so forms see raw adapter values).
|
|
493
|
+
*/
|
|
494
|
+
declare class CalendarComponent<M extends CalendarMode = 'single', D = Date, TOut = CalendarValue<M, D>> implements ControlValueAccessor, Validator, OnInit {
|
|
495
|
+
private readonly dateAdapter;
|
|
496
|
+
private readonly elementRef;
|
|
497
|
+
private readonly injector;
|
|
498
|
+
private readonly destroyRef;
|
|
499
|
+
private readonly liveAnnouncer;
|
|
500
|
+
/**
|
|
501
|
+
* Resolved lazily in `ngOnInit` — eager construction-time injection creates a
|
|
502
|
+
* circular dependency (NG0200): the component registers itself as both
|
|
503
|
+
* `NG_VALUE_ACCESSOR` and `NG_VALIDATORS`, and `FormControlName` resolves
|
|
504
|
+
* those eagerly while constructing on the same element. Looking up
|
|
505
|
+
* `NgControl` after construction breaks the cycle.
|
|
506
|
+
*/
|
|
507
|
+
private ngControl;
|
|
508
|
+
/** Angular's `LOCALE_ID` — used as the fallback when no `locale` input is supplied (§19.1). */
|
|
509
|
+
private readonly platformLocale;
|
|
510
|
+
/**
|
|
511
|
+
* DI-provided default `CalendarIntl`. New'd up locally when the consumer hasn't
|
|
512
|
+
* supplied one — DI defaults are merged with the per-instance `intl` input
|
|
513
|
+
* via `effectiveIntl()` (§19.4 per-field merge).
|
|
514
|
+
*/
|
|
515
|
+
private readonly injectedIntl;
|
|
516
|
+
private readonly injectedStrategy;
|
|
517
|
+
private readonly monthViews;
|
|
518
|
+
/**
|
|
519
|
+
* Built-in strategies instantiated lazily in the host's injection context so
|
|
520
|
+
* `inject(DATE_ADAPTER)` calls inside each strategy resolve. Range state will
|
|
521
|
+
* migrate into the orchestrator in Phase 6; single / multiple stay here as
|
|
522
|
+
* internals (not exported) via the spec's mode union.
|
|
523
|
+
*/
|
|
524
|
+
private readonly localStrategies;
|
|
525
|
+
/** Selection mode (§5). Changing this at runtime clears the value and emits `modeChange`. */
|
|
526
|
+
readonly mode: ModelSignal<CalendarMode>;
|
|
527
|
+
/**
|
|
528
|
+
* Consumer-bound value. Shape narrows by `M`: `D | null` for single,
|
|
529
|
+
* `D[]` for multiple, `{ start; end }` for range.
|
|
530
|
+
*/
|
|
531
|
+
readonly value: ModelSignal<CalendarValue<M, D>>;
|
|
532
|
+
/** Anchor date for the displayed view. Defaults to today on mount. */
|
|
533
|
+
readonly startAt: InputSignal<D | null>;
|
|
534
|
+
/** Minimum selectable date. */
|
|
535
|
+
readonly minDate: InputSignal<D | null>;
|
|
536
|
+
/** Maximum selectable date. */
|
|
537
|
+
readonly maxDate: InputSignal<D | null>;
|
|
538
|
+
/** Per-date predicate — return `false` to disable. */
|
|
539
|
+
readonly dateFilter: InputSignal<DateFilterFn<D> | null>;
|
|
540
|
+
/**
|
|
541
|
+
* Explicitly disabled dates (§10.1). Either an array (each entry compared via
|
|
542
|
+
* `adapter.sameDate`) or a predicate returning `true` for disabled dates.
|
|
543
|
+
* OR-combined with `dateFilter`, `disabledDaysOfWeek`, and `[minDate, maxDate]`.
|
|
544
|
+
*/
|
|
545
|
+
readonly disabledDates: InputSignal<DisabledDates<D> | null>;
|
|
546
|
+
/** Days of the week to disable (0=Sun … 6=Sat). Empty array = no day-of-week disabling. */
|
|
547
|
+
readonly disabledDaysOfWeek: InputSignal<readonly number[]>;
|
|
548
|
+
/**
|
|
549
|
+
* Bundle of date constraints (§10.1). Lets a consumer pass `minDate`, `maxDate`,
|
|
550
|
+
* `disabledDates`, `disabledDaysOfWeek`, and `dateFilter` as a single object —
|
|
551
|
+
* useful for sharing a constraint preset across multiple calendars. Each field is
|
|
552
|
+
* optional. Individual inputs (`minDate`, `maxDate`, `disabledDates`,
|
|
553
|
+
* `disabledDaysOfWeek`, `dateFilter`) take precedence over fields here when both
|
|
554
|
+
* are set non-null.
|
|
555
|
+
*/
|
|
556
|
+
readonly constraints: InputSignal<CalendarConstraints<D> | null>;
|
|
557
|
+
/** Minimum range length in days, inclusive (`mode: 'range'` only). `null` = no minimum. */
|
|
558
|
+
readonly minRangeLength: InputSignal<number | null>;
|
|
559
|
+
/** Maximum range length in days, inclusive (`mode: 'range'` only). `null` = no maximum. */
|
|
560
|
+
readonly maxRangeLength: InputSignal<number | null>;
|
|
561
|
+
/** Maximum number of selections in `mode: 'multiple'`. `null` = unlimited. */
|
|
562
|
+
readonly maxSelections: InputSignal<number | null>;
|
|
563
|
+
/**
|
|
564
|
+
* What happens when the user tries to select past `maxSelections` (§10.1).
|
|
565
|
+
* `'emit-limit-reached'` (default) emits `selectionLimitReached` and ignores
|
|
566
|
+
* the click; `'replace-oldest'` drops the first entry; `'ignore'` is silent.
|
|
567
|
+
*/
|
|
568
|
+
readonly maxSelectionBehavior: InputSignal<MaxSelectionBehavior>;
|
|
569
|
+
/**
|
|
570
|
+
* IDREF list for the form-error live region (§28.3). When set, the calendar
|
|
571
|
+
* root carries `aria-describedby="<value>"` so screen readers read consumer-
|
|
572
|
+
* rendered error messages alongside the focused cell announcement.
|
|
573
|
+
*/
|
|
574
|
+
readonly errorAriaDescribedBy: InputSignal<string | null>;
|
|
575
|
+
/**
|
|
576
|
+
* How `mode: 'range'` reacts to a click after a complete range (§21.2):
|
|
577
|
+
* - `'restart'` (default): start a new range with the clicked cell, emit `selectionRestart`.
|
|
578
|
+
* - `'nearest-edge'`: move the closer endpoint (start vs end) to the clicked date and re-commit (§21.3); emits `selectionComplete({reason: 'nearest-edge'})`.
|
|
579
|
+
* - `'require-clear'`: ignore the click + flash the cell as invalid (`data-state-invalid-flash`); user must call `clear()` first.
|
|
580
|
+
*/
|
|
581
|
+
readonly rangeClickBehavior: InputSignal<RangeClickBehavior>;
|
|
582
|
+
/**
|
|
583
|
+
* Range-mode behavior knobs. Accepts a partial object — unset fields use the
|
|
584
|
+
* defaults documented on each property of `RangeBehaviorConfig`. Defaults:
|
|
585
|
+
* `{ allowSingleDayRange: true, persistPartialRange: true, allowBackwardRange: false, disableRangesCrossingDisabledDates: false }`.
|
|
586
|
+
*/
|
|
587
|
+
readonly rangeBehavior: InputSignal<Partial<RangeBehaviorConfig>>;
|
|
588
|
+
/** Function producing per-cell CSS classes. */
|
|
589
|
+
readonly dateClass: InputSignal<DateClassFn<D> | null>;
|
|
590
|
+
/** When `true`, the calendar renders with a border and a soft shadow. */
|
|
591
|
+
readonly bordered: InputSignal<boolean>;
|
|
592
|
+
/** Which view opens first. Defaults to `'day'`. Phase 8 will derive the default from `rangeGranularity`. */
|
|
593
|
+
readonly startView: InputSignal<CalendarViewState>;
|
|
594
|
+
/** Override first day of week (0=Sun, 1=Mon). Falls back to the adapter's default. */
|
|
595
|
+
readonly firstDayOfWeek: InputSignal<number | null>;
|
|
596
|
+
/**
|
|
597
|
+
* Number of months to display side-by-side (1 or 2). Phase 9 replaces this with a
|
|
598
|
+
* full `numberOfMonths: 1..12+` surface (§23).
|
|
599
|
+
*/
|
|
600
|
+
readonly monthColumns: InputSignal<number>;
|
|
601
|
+
/** Disabled state. Merged with any `setDisabledState` call from a bound form control via `effectiveDisabled`. */
|
|
602
|
+
readonly disabled: InputSignal<boolean>;
|
|
603
|
+
/** Read-only state (§33.1). When `true`, focus and keyboard navigation still work but selections cannot be committed. */
|
|
604
|
+
readonly readonly: InputSignal<boolean>;
|
|
605
|
+
/** How a form reset restores internal state (§6.5). `'full'` (default) also restores view + active-date; `'value-only'` clears the draft but leaves navigation where the user left it. */
|
|
606
|
+
readonly resetBehavior: InputSignal<ResetBehavior>;
|
|
607
|
+
/** Optional cell-content template. */
|
|
608
|
+
readonly cellTemplate: InputSignal<TemplateRef<{
|
|
609
|
+
$implicit: CalendarCell<D>;
|
|
610
|
+
}> | null>;
|
|
611
|
+
/** Per-instance locale override. Falls back to Angular `LOCALE_ID` when `null` (§19.1). */
|
|
612
|
+
readonly locale: InputSignal<string | null>;
|
|
613
|
+
/**
|
|
614
|
+
* Per-instance `CalendarIntl` override (§19.4). Per-field merge — unspecified
|
|
615
|
+
* fields inherit the DI-provided default. Pass a partial bag (e.g. one of the
|
|
616
|
+
* shipped locale packs `de`, `fr`, `es`, `pt`, `ja`) or a full custom instance.
|
|
617
|
+
*/
|
|
618
|
+
readonly intl: InputSignal<Partial<CalendarIntl> | null>;
|
|
619
|
+
/** Fires whenever the committed value changes (cell click, keyboard select, preset, mode change, programmatic clear). Payload is the untransformed mode-shaped `CalendarValue<M, D>` — `D | null` for single, `D[]` for multiple, `{ start, end }` for range (§7.6). */
|
|
620
|
+
readonly valueChange: OutputEmitterRef<CalendarValue<M, D>>;
|
|
621
|
+
/** Fires on the first click of a range selection (transitions selection state to SELECTING). Payload carries the chosen `start` date. */
|
|
622
|
+
readonly selectionStart: OutputEmitterRef<{
|
|
623
|
+
start: D;
|
|
624
|
+
}>;
|
|
625
|
+
/** Fires as the hover / keyboard cursor moves during range SELECTING. Payload carries the `tentativeRange` and an `invalidPreview` flag set when the range crosses a disabled date or violates `min`/`maxRangeLength`. */
|
|
626
|
+
readonly rangePreview: OutputEmitterRef<RangePreviewEvent<D>>;
|
|
627
|
+
/** Fires after `valueChange` once the selection commits. Payload carries the committed `value` and a `reason` flagging the commit path (`'commit' | 'auto-swap' | 'nearest-edge' | 'preset'`). */
|
|
628
|
+
readonly selectionComplete: OutputEmitterRef<SelectionCompleteEvent<M, D>>;
|
|
629
|
+
/** Fires when a range selection restarts after a complete range (e.g. third click with `rangeClickBehavior='restart'`). Payload carries the new draft `start` date. */
|
|
630
|
+
readonly selectionRestart: OutputEmitterRef<{
|
|
631
|
+
start: D;
|
|
632
|
+
}>;
|
|
633
|
+
/** Fires whenever the value clears. Payload carries a `reason` distinguishing user clear, programmatic, mode change, form reset, or a disabled flip. */
|
|
634
|
+
readonly selectionCleared: OutputEmitterRef<SelectionClearedEvent>;
|
|
635
|
+
/** Fires in `mode: 'multiple'` when the user attempts to select past `maxSelections` (only with `maxSelectionBehavior: 'emit-limit-reached'`). Payload carries the configured `limit` and the rejected `attempted` date. */
|
|
636
|
+
readonly selectionLimitReached: OutputEmitterRef<{
|
|
637
|
+
limit: number;
|
|
638
|
+
attempted: D;
|
|
639
|
+
}>;
|
|
640
|
+
/** Fires when the selected preset changes (user click on a preset chip, or programmatic clear). Payload is the new preset id, or `null` when no preset is active. Phase 12 wires it. */
|
|
641
|
+
readonly presetChange: OutputEmitterRef<string | null>;
|
|
642
|
+
/** Fires on every view transition (day ↔ month ↔ year). Payload carries `from`, `to`, and a `reason` distinguishing drill-down, drill-up, user header click, and programmatic changes. */
|
|
643
|
+
readonly viewChange: OutputEmitterRef<ViewChangeEvent>;
|
|
644
|
+
/** Fires when keyboard navigation, mouse hover, or programmatic action moves the focused (active) cell. Payload is the new active date. */
|
|
645
|
+
readonly activeDateChange: OutputEmitterRef<D>;
|
|
646
|
+
/** Fires when the displayed primary month changes (page-nav, drill-up, or programmatic). Payload carries the new `year` and zero-based `month`. */
|
|
647
|
+
readonly monthChange: OutputEmitterRef<{
|
|
648
|
+
year: number;
|
|
649
|
+
month: number;
|
|
650
|
+
}>;
|
|
651
|
+
/** Fires when the displayed year changes (month/year-view nav or year-page scroll). Payload carries the new `year`. */
|
|
652
|
+
readonly yearChange: OutputEmitterRef<{
|
|
653
|
+
year: number;
|
|
654
|
+
}>;
|
|
655
|
+
/** Fires on every pointer click of any cell, including disabled ones — analytics only. Payload carries the clicked `date` and the underlying `PointerEvent`. Does NOT indicate a selection; subscribe to `valueChange` for that. */
|
|
656
|
+
readonly cellClick: OutputEmitterRef<{
|
|
657
|
+
date: D;
|
|
658
|
+
event: PointerEvent;
|
|
659
|
+
}>;
|
|
660
|
+
/** Fires on every pointer hover of any cell — analytics only. Payload carries the hovered `date`. Does NOT indicate a preview; subscribe to `rangePreview` for range-mode hover state. */
|
|
661
|
+
readonly cellHover: OutputEmitterRef<{
|
|
662
|
+
date: D;
|
|
663
|
+
}>;
|
|
664
|
+
/** Fires when `mode` changes at runtime, in canonical order `selectionCleared` → `modeChange` → `valueChange` (§11.2). Payload carries `{ from, to }` modes. */
|
|
665
|
+
readonly modeChange: OutputEmitterRef<ModeChangeEvent>;
|
|
666
|
+
/** In-flight draft during range SELECTING. `null` in other states (§8.1). */
|
|
667
|
+
private readonly internalDraftValue;
|
|
668
|
+
/** Current selection lifecycle state. */
|
|
669
|
+
private readonly _selectionState;
|
|
670
|
+
/** Current view (writable for drill). Tracks `startView` until the user drills. */
|
|
671
|
+
private readonly _viewState;
|
|
672
|
+
/**
|
|
673
|
+
* Active (focused) date. `linkedSignal` so changes to `startAt` at runtime update
|
|
674
|
+
* the anchor, but internal navigation can still write it independently.
|
|
675
|
+
*/
|
|
676
|
+
private readonly _activeDate;
|
|
677
|
+
/** Pointer-hover date (desktop only). */
|
|
678
|
+
private readonly _hoveredDate;
|
|
679
|
+
/** Overlay state. Always `'closed'` in inline mode until Phase 10 wires the lifecycle. */
|
|
680
|
+
private readonly _overlayState;
|
|
681
|
+
/** Preset selection id. Phase 12 writes this. */
|
|
682
|
+
private readonly _selectedPresetId;
|
|
683
|
+
/** Raw `TOut` retained when `fromForm` throws (§7.6, Phase 14). `null` otherwise. */
|
|
684
|
+
private readonly _lastInvalidFormValue;
|
|
685
|
+
/** Overlay lifecycle. `null` until `interaction: 'overlay'` lands in Phase 10; until then the implementation signal is exposed as `'closed'`. */
|
|
686
|
+
readonly overlayState: Signal<CalendarOverlayState | null>;
|
|
687
|
+
/** Selection lifecycle per §8. */
|
|
688
|
+
readonly selectionState: Signal<CalendarSelectionState>;
|
|
689
|
+
/** Active (focused) cell. `null` when the overlay is closed and no inline focus is established; in inline mode this is always the current anchor. */
|
|
690
|
+
readonly activeDate: Signal<D | null>;
|
|
691
|
+
/** Currently selected preset id. */
|
|
692
|
+
readonly selectedPresetId: Signal<string | null>;
|
|
693
|
+
/** Current view state (day / month / year). */
|
|
694
|
+
readonly viewState: Signal<CalendarViewState>;
|
|
695
|
+
/** Months currently rendered. Phase 9 extends this to the full responsive count. */
|
|
696
|
+
readonly displayedMonths: Signal<{
|
|
697
|
+
year: number;
|
|
698
|
+
month: number;
|
|
699
|
+
}[]>;
|
|
700
|
+
/** Raw form value rejected by the transformer's `fromForm` (§7.6, §33.3). */
|
|
701
|
+
readonly lastInvalidFormValue: Signal<unknown>;
|
|
702
|
+
private cvaOnChange;
|
|
703
|
+
private cvaOnTouched;
|
|
704
|
+
private validatorOnChange;
|
|
705
|
+
/**
|
|
706
|
+
* @internal Disabled state set by `ControlValueAccessor.setDisabledState` and
|
|
707
|
+
* by the Signal Forms mode directives. OR-merged with the public `disabled`
|
|
708
|
+
* input into `effectiveDisabled`.
|
|
709
|
+
*/
|
|
710
|
+
readonly cvaDisabled: WritableSignal<boolean>;
|
|
711
|
+
/**
|
|
712
|
+
* @internal Read-only state set by the Signal Forms mode directives. OR-merged
|
|
713
|
+
* with the public `readonly` input into `effectiveReadonly`.
|
|
714
|
+
*/
|
|
715
|
+
readonly cvaReadonly: WritableSignal<boolean>;
|
|
716
|
+
/** Effective disabled state — public `disabled` input OR any form-bound disabled flip. Drives `aria-disabled`. */
|
|
717
|
+
readonly effectiveDisabled: Signal<boolean>;
|
|
718
|
+
/** Effective read-only state — public `readonly` input OR any form-bound readonly flip. Drives `aria-readonly`. */
|
|
719
|
+
readonly effectiveReadonly: Signal<boolean>;
|
|
720
|
+
/**
|
|
721
|
+
* @internal Resolved range-behavior config. Merges the consumer-supplied
|
|
722
|
+
* `Partial<RangeBehaviorConfig>` over the documented defaults so internal
|
|
723
|
+
* call sites read each field directly without re-applying fallbacks.
|
|
724
|
+
*/
|
|
725
|
+
private readonly _resolvedRangeBehavior;
|
|
726
|
+
/** @internal Dev-mode warning guard so each mismatched write warns only once per instance. */
|
|
727
|
+
private _warnedShapeMismatch;
|
|
728
|
+
/** @internal Set by `writeValue`; read by the `FormResetEvent` handler so it can emit `selectionCleared({reason: 'reset'})` only when a non-empty value was on the control before the reset cleared it. */
|
|
729
|
+
private _hadValueBeforeLastWrite;
|
|
730
|
+
constructor();
|
|
731
|
+
ngOnInit(): void;
|
|
732
|
+
/** @internal `ControlValueAccessor` — writes a value from a reactive / template-driven form. Wrong-shape writes preserve the prior value per §7.2. Programmatic writes during SELECTING discard the draft per §11.1. */
|
|
733
|
+
writeValue(incoming: unknown): void;
|
|
734
|
+
/** @internal `ControlValueAccessor` — registers the on-change callback. */
|
|
735
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
736
|
+
/** @internal `ControlValueAccessor` — registers the touched callback. */
|
|
737
|
+
registerOnTouched(fn: () => void): void;
|
|
738
|
+
/** @internal `ControlValueAccessor` — reflects the form control's disabled state through `effectiveDisabled` / `aria-disabled`. */
|
|
739
|
+
setDisabledState(isDisabled: boolean): void;
|
|
740
|
+
/** @internal `Validator` — runs the §10.2 validator. Phase 3 codes (`calendarRequired`, `calendarInvalidValue`) plus Phase 4 constraint codes (`calendarMinDate`, `calendarMaxDate`, `calendarDisabledDate`, `calendarRangeTooShort`, `calendarRangeTooLong`, `calendarMaxSelections`, `calendarInvalidRange`). */
|
|
741
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
742
|
+
/** @internal `Validator` — registers the change callback so the form re-runs validation when internal state changes. */
|
|
743
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
744
|
+
/** @internal Host `(focusout)` handler — fires `onTouched` when focus leaves the component (§13.6 inline path). Overlay-mode wiring is Phase 10. */
|
|
745
|
+
onBlur(event: FocusEvent): void;
|
|
746
|
+
/**
|
|
747
|
+
* Effective `CalendarIntl` resolved per-field over the DI default (§19.4).
|
|
748
|
+
* The injected default is the base; the `intl` input overrides individual
|
|
749
|
+
* fields. Unspecified fields fall through to English defaults.
|
|
750
|
+
*/
|
|
751
|
+
readonly effectiveIntl: Signal<CalendarIntl>;
|
|
752
|
+
/** Effective locale — `locale` input wins, otherwise Angular `LOCALE_ID`. */
|
|
753
|
+
readonly effectiveLocale: Signal<string>;
|
|
754
|
+
/**
|
|
755
|
+
* Active strategy for single/multiple/range. Injected strategies (custom) win.
|
|
756
|
+
* Range state will migrate into this component in Phase 6; for now we reuse
|
|
757
|
+
* the strategy for its `select` / `createPreview` / `isSelected` helpers.
|
|
758
|
+
*/
|
|
759
|
+
readonly selectionStrategy: Signal<CalendarSelectionStrategy<D, unknown>>;
|
|
760
|
+
/** Computed first-day-of-week (input override wins over adapter default). */
|
|
761
|
+
readonly computedFirstDayOfWeek: Signal<number>;
|
|
762
|
+
/** Resolves the configured `monthColumns` value. Range-mode consumers pass `2` explicitly. */
|
|
763
|
+
readonly effectiveMonthColumns: Signal<number>;
|
|
764
|
+
/**
|
|
765
|
+
* @internal Drives `aria-multiselectable` on every view grid. `true` when the
|
|
766
|
+
* current `mode` allows more than one cell to be selected at a time
|
|
767
|
+
* (`'multiple'` or `'range'`); `false` for `'single'`.
|
|
768
|
+
*/
|
|
769
|
+
readonly multiSelectable: Signal<boolean>;
|
|
770
|
+
/** Secondary anchor for the right-hand grid in multi-column mode. */
|
|
771
|
+
readonly secondaryActiveDate: Signal<D | null>;
|
|
772
|
+
/**
|
|
773
|
+
* Phase 6 — preview cursor. Pointer hover wins; falls back to `activeDate`
|
|
774
|
+
* when SELECTING so keyboard arrow-key moves drive the same preview path
|
|
775
|
+
* (§21.1, §16.1). `null` when no SELECTING draft is in-flight and pointer
|
|
776
|
+
* is off-grid.
|
|
777
|
+
*/
|
|
778
|
+
private readonly previewCursor;
|
|
779
|
+
/**
|
|
780
|
+
* Preview range. Driven by the strategy and the `previewCursor` (hover or
|
|
781
|
+
* keyboard active-date during SELECTING).
|
|
782
|
+
*/
|
|
783
|
+
readonly previewRange: Signal<DateRange<D> | null>;
|
|
784
|
+
/**
|
|
785
|
+
* Adapter-compatible view of the current selection.
|
|
786
|
+
* For range: a `{ start, end }` view of either the committed value or the in-flight draft.
|
|
787
|
+
* For single: the raw `D | null`.
|
|
788
|
+
* For multiple: the raw `D[]`.
|
|
789
|
+
*
|
|
790
|
+
* Used internally to feed the legacy strategy surface while Phase 6 migrates range state.
|
|
791
|
+
*/
|
|
792
|
+
private readonly strategySelection;
|
|
793
|
+
/** Adapter-compatible view exposed to the view components. */
|
|
794
|
+
readonly legacySelected: Signal<D | D[] | DateRange<D> | null>;
|
|
795
|
+
private readonly variantResult;
|
|
796
|
+
/** @internal */
|
|
797
|
+
readonly rootClasses: Signal<string>;
|
|
798
|
+
/** @internal */
|
|
799
|
+
readonly monthsClasses: Signal<string>;
|
|
800
|
+
private readonly monthNames;
|
|
801
|
+
/** @internal */
|
|
802
|
+
readonly periodLabel: Signal<string>;
|
|
803
|
+
/** @internal */
|
|
804
|
+
readonly periodAriaLabel: Signal<string>;
|
|
805
|
+
/** @internal */
|
|
806
|
+
readonly prevAriaLabel: Signal<string>;
|
|
807
|
+
/** @internal */
|
|
808
|
+
readonly nextAriaLabel: Signal<string>;
|
|
809
|
+
/** @internal */
|
|
810
|
+
readonly prevDisabled: Signal<boolean>;
|
|
811
|
+
/** @internal */
|
|
812
|
+
readonly nextDisabled: Signal<boolean>;
|
|
813
|
+
/** Focuses `date` and optionally navigates the view to render it. */
|
|
814
|
+
focusDate(date: D, opts?: {
|
|
815
|
+
navigate?: boolean;
|
|
816
|
+
}): void;
|
|
817
|
+
/** Sets the current view state and emits a `viewChange` event. */
|
|
818
|
+
setView(view: CalendarViewState): void;
|
|
819
|
+
/** Navigates to a specific date (anchor). Does not emit a selection event. */
|
|
820
|
+
goToDate(date: D): void;
|
|
821
|
+
/** Navigates to today. */
|
|
822
|
+
goToToday(): void;
|
|
823
|
+
/** Clears the current selection. Alias: `clearSelection`. */
|
|
824
|
+
clear(): void;
|
|
825
|
+
/** Alias of `clear()` exported per §33.4 for discoverability. */
|
|
826
|
+
clearSelection(): void;
|
|
827
|
+
/** Resets to initial state — value + view + active date per `resetBehavior`. Phase 3 extends this with form-reset integration. */
|
|
828
|
+
reset(): void;
|
|
829
|
+
/** Revalidates constraints + cell filters (Phase 4 wires it). */
|
|
830
|
+
revalidate(): void;
|
|
831
|
+
/** Opens the overlay. Phase 10 wires the CDK overlay; inline mode is a no-op. */
|
|
832
|
+
open(): void;
|
|
833
|
+
/** Closes the overlay. */
|
|
834
|
+
close(): void;
|
|
835
|
+
/** Toggles the overlay. */
|
|
836
|
+
toggle(): void;
|
|
837
|
+
/** Imperatively focuses the currently active cell. */
|
|
838
|
+
focusActiveCell(): void;
|
|
839
|
+
/** @internal */
|
|
840
|
+
onPrevClicked(): void;
|
|
841
|
+
/** @internal */
|
|
842
|
+
onNextClicked(): void;
|
|
843
|
+
/** @internal — period-button click: drill up (day → month → year). */
|
|
844
|
+
onPeriodClicked(): void;
|
|
845
|
+
/** @internal — day-grid cell activation. */
|
|
846
|
+
onDateSelected(date: D): void;
|
|
847
|
+
/** @internal — preview sync from pointer hover. */
|
|
848
|
+
onPreviewChange(date: D | null): void;
|
|
849
|
+
/**
|
|
850
|
+
* Phase 4 — `true` when a tentative range hover would commit an invalid value.
|
|
851
|
+
* Reasons: crosses a disabled date, or length violates `min`/`maxRangeLength`.
|
|
852
|
+
* The flag is informational — does NOT block the commit on its own (§4 default
|
|
853
|
+
* is permissive). Subscribe to `rangePreview.invalidPreview` together with the
|
|
854
|
+
* `calendarRangeTooShort` / `calendarRangeTooLong` validator codes to react.
|
|
855
|
+
*/
|
|
856
|
+
private isPreviewInvalid;
|
|
857
|
+
/**
|
|
858
|
+
* Resolved `minDate` — individual `minDate` input wins, then `constraints.minDate`,
|
|
859
|
+
* else `null`. Used by every internal min-date reader so the shorthand input is
|
|
860
|
+
* transparent to the rest of the component.
|
|
861
|
+
*/
|
|
862
|
+
readonly resolvedMinDate: Signal<D | null>;
|
|
863
|
+
/** Resolved `maxDate` — individual input wins, then `constraints.maxDate`, else `null`. */
|
|
864
|
+
readonly resolvedMaxDate: Signal<D | null>;
|
|
865
|
+
/** Resolved `disabledDates` — individual input wins, then `constraints.disabledDates`, else `null`. */
|
|
866
|
+
readonly resolvedDisabledDates: Signal<DisabledDates<D> | null>;
|
|
867
|
+
/** Resolved `disabledDaysOfWeek` — individual input wins (when non-empty), then `constraints.disabledDaysOfWeek`, else `[]`. */
|
|
868
|
+
readonly resolvedDisabledDaysOfWeek: Signal<readonly number[]>;
|
|
869
|
+
/** Resolved `dateFilter` — individual input wins, then `constraints.dateFilter`, else `null`. */
|
|
870
|
+
readonly resolvedDateFilter: Signal<DateFilterFn<D> | null>;
|
|
871
|
+
/** Aggregated, resolved constraint inputs — passed to the resolver and validator. */
|
|
872
|
+
private readonly resolvedConstraints;
|
|
873
|
+
/** @internal — month-view cell activation (drill-down to day). */
|
|
874
|
+
onMonthSelected(date: D): void;
|
|
875
|
+
/** @internal — years-view cell activation (drill-down to month). */
|
|
876
|
+
onYearSelected(date: D): void;
|
|
877
|
+
/** @internal — keyboard / programmatic active-date change from a view. */
|
|
878
|
+
onActiveDateChange(date: D, gridIndex?: number): void;
|
|
879
|
+
/** @internal Last invalidly-clicked date, cleared after ~200ms — drives `data-state-invalid-flash`. */
|
|
880
|
+
private readonly _invalidFlashDate;
|
|
881
|
+
/** Public read of the transient invalid-flash anchor. Views consume this and tag the matching cell. */
|
|
882
|
+
readonly invalidFlashDate: Signal<D | null>;
|
|
883
|
+
private commitRangeClick;
|
|
884
|
+
/** Enters SELECTING with `date` as draft.start. Emits selectionStart or selectionRestart. */
|
|
885
|
+
private enterSelecting;
|
|
886
|
+
/**
|
|
887
|
+
* `'nearest-edge'` move (§21.3) — drag the closer endpoint of the committed
|
|
888
|
+
* range to `date`. Emits `selectionComplete({reason: 'nearest-edge'})`.
|
|
889
|
+
*/
|
|
890
|
+
private commitNearestEdge;
|
|
891
|
+
/** Pending invalid-flash clear timer; tracked so we can cancel on destroy. */
|
|
892
|
+
private _invalidFlashTimer;
|
|
893
|
+
/** Sets the invalid-flash anchor and schedules a clear after 200ms. */
|
|
894
|
+
private flashInvalid;
|
|
895
|
+
/** Commits a value into the form + outputs with spec-ordered event emission. */
|
|
896
|
+
private commitValue;
|
|
897
|
+
/**
|
|
898
|
+
* Handles a form-owned reset. Triggered when the bound `NgControl` flips
|
|
899
|
+
* `pristine` back to `true` (via `FormControl.reset()` / `FormGroup.reset()`).
|
|
900
|
+
* Per §6.5 the form owns the value write, so this path does NOT emit
|
|
901
|
+
* `valueChange` and does NOT call `onTouched`. It emits `selectionCleared`
|
|
902
|
+
* when a value was previously committed and restores UI state per
|
|
903
|
+
* `resetBehavior`.
|
|
904
|
+
*/
|
|
905
|
+
private handleFormReset;
|
|
906
|
+
private onModeChanged;
|
|
907
|
+
private computeCompareValue;
|
|
908
|
+
private emitPeriodChange;
|
|
909
|
+
private announceViewChange;
|
|
910
|
+
private announceNavigation;
|
|
911
|
+
/** Announces a committed selection for AT users. Branches on mode so the message matches the §19.4 intl strings. */
|
|
912
|
+
private announceSelectionComplete;
|
|
913
|
+
/** Announces the start of a range pick for AT users. */
|
|
914
|
+
private announceRangeStart;
|
|
915
|
+
/** Announces that a click was rejected (require-clear, disable-cross commit, single-day disallowed). */
|
|
916
|
+
private announceRejection;
|
|
917
|
+
/** Locale-aware long-form date format used in announcements (e.g. "Wednesday, April 15, 2026"). */
|
|
918
|
+
private formatDate;
|
|
919
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarComponent<any, any, any>, never>;
|
|
920
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarComponent<any, any, any>, "tw-calendar", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "disabledDaysOfWeek": { "alias": "disabledDaysOfWeek"; "required": false; "isSignal": true; }; "constraints": { "alias": "constraints"; "required": false; "isSignal": true; }; "minRangeLength": { "alias": "minRangeLength"; "required": false; "isSignal": true; }; "maxRangeLength": { "alias": "maxRangeLength"; "required": false; "isSignal": true; }; "maxSelections": { "alias": "maxSelections"; "required": false; "isSignal": true; }; "maxSelectionBehavior": { "alias": "maxSelectionBehavior"; "required": false; "isSignal": true; }; "errorAriaDescribedBy": { "alias": "errorAriaDescribedBy"; "required": false; "isSignal": true; }; "rangeClickBehavior": { "alias": "rangeClickBehavior"; "required": false; "isSignal": true; }; "rangeBehavior": { "alias": "rangeBehavior"; "required": false; "isSignal": true; }; "dateClass": { "alias": "dateClass"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "startView": { "alias": "startView"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "monthColumns": { "alias": "monthColumns"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "resetBehavior": { "alias": "resetBehavior"; "required": false; "isSignal": true; }; "cellTemplate": { "alias": "cellTemplate"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "intl": { "alias": "intl"; "required": false; "isSignal": true; }; }, { "mode": "modeChange"; "value": "valueChange"; "valueChange": "valueChange"; "selectionStart": "selectionStart"; "rangePreview": "rangePreview"; "selectionComplete": "selectionComplete"; "selectionRestart": "selectionRestart"; "selectionCleared": "selectionCleared"; "selectionLimitReached": "selectionLimitReached"; "presetChange": "presetChange"; "viewChange": "viewChange"; "activeDateChange": "activeDateChange"; "monthChange": "monthChange"; "yearChange": "yearChange"; "cellClick": "cellClick"; "cellHover": "cellHover"; "modeChange": "modeChange"; }, never, ["[twCalendarPresets]"], true, never>;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Common signal-input surface declared by the three mode-specific directives
|
|
925
|
+
* per spec §6.3 / §7.3. Each directive maps the Signal Forms contract onto
|
|
926
|
+
* the hosting `CalendarComponent`, so `[field]="form.someDate"` drives the
|
|
927
|
+
* calendar without any extra wiring.
|
|
928
|
+
*/
|
|
929
|
+
interface CalendarFormControlCommon {
|
|
930
|
+
/** Disabled flag forwarded from the bound field. OR-merged with `disabled` on the component. */
|
|
931
|
+
readonly disabled: InputSignal<boolean>;
|
|
932
|
+
/** Read-only flag forwarded from the bound field. OR-merged with `readonly` on the component. */
|
|
933
|
+
readonly readonly: InputSignal<boolean>;
|
|
934
|
+
/** Required flag forwarded from the bound field. Surfaces `calendarRequired` when empty (§10.2). */
|
|
935
|
+
readonly required: InputSignal<boolean>;
|
|
936
|
+
/** Mirrors the bound field's `invalid` flag. Reserved for visual treatment (Phase 4 wires styling). */
|
|
937
|
+
readonly invalid: InputSignal<boolean>;
|
|
938
|
+
/** Mirrors the bound field's `hidden` flag. Consumers should guard the component with `@if` when true. */
|
|
939
|
+
readonly hidden: InputSignal<boolean>;
|
|
940
|
+
/** Field errors forwarded from Signal Forms for consumer-side styling. */
|
|
941
|
+
readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
|
|
942
|
+
/** Forwarded disablement reasons; surfaced for consumer-side UX (tooltips, etc.). */
|
|
943
|
+
readonly disabledReasons: InputSignal<readonly WithOptionalFieldTree<DisabledReason>[]>;
|
|
944
|
+
/** Two-way `touched` flag — the directive writes `true` on blur; the `Field` directive reads/writes it. */
|
|
945
|
+
readonly touched: ModelSignal<boolean>;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Signal Forms strict binding for `CalendarComponent` in `single` mode.
|
|
949
|
+
* Implements `FormValueControl<D | null>` so `[field]="form.someDate"`
|
|
950
|
+
* infers `FieldTree<D | null>` with no casts.
|
|
951
|
+
*
|
|
952
|
+
* Applies automatically when `<tw-calendar mode="single">` appears in the
|
|
953
|
+
* template. When the mode attribute is omitted, consumers bind the component
|
|
954
|
+
* directly — the CVA path handles reactive / template-driven forms.
|
|
955
|
+
*/
|
|
956
|
+
declare class CalendarSingleDirective<D = Date, TOut = D | null> implements FormValueControl<TOut>, CalendarFormControlCommon {
|
|
957
|
+
private readonly host;
|
|
958
|
+
/** Two-way value, forwarded to the hosting `CalendarComponent`. Signal Forms `Field` binds against this. */
|
|
959
|
+
readonly value: ModelSignal<TOut>;
|
|
960
|
+
/** Mirrors the bound field's disabled flag. */
|
|
961
|
+
readonly disabled: InputSignal<boolean>;
|
|
962
|
+
/** Mirrors the bound field's readonly flag. */
|
|
963
|
+
readonly readonly: InputSignal<boolean>;
|
|
964
|
+
/** Mirrors the bound field's required flag. */
|
|
965
|
+
readonly required: InputSignal<boolean>;
|
|
966
|
+
/** Mirrors the bound field's invalid flag. */
|
|
967
|
+
readonly invalid: InputSignal<boolean>;
|
|
968
|
+
/** Mirrors the bound field's hidden flag. */
|
|
969
|
+
readonly hidden: InputSignal<boolean>;
|
|
970
|
+
/** Mirrors the bound field's errors. */
|
|
971
|
+
readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
|
|
972
|
+
/** Mirrors the bound field's disablement reasons. */
|
|
973
|
+
readonly disabledReasons: InputSignal<readonly WithOptionalFieldTree<DisabledReason>[]>;
|
|
974
|
+
/** Two-way `touched` flag — drives and reflects the field's touched state. */
|
|
975
|
+
readonly touched: ModelSignal<boolean>;
|
|
976
|
+
constructor();
|
|
977
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarSingleDirective<any, any>, never>;
|
|
978
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CalendarSingleDirective<any, any>, "tw-calendar[mode=\"single\"]", ["twCalendarSingle"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disabledReasons": { "alias": "disabledReasons"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; }, { "touched": "touchedChange"; }, never, never, true, never>;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Signal Forms strict binding for `CalendarComponent` in `multiple` mode.
|
|
982
|
+
* Implements `FormValueControl<D[]>`.
|
|
983
|
+
*/
|
|
984
|
+
declare class CalendarMultipleDirective<D = Date, TOut = D[]> implements FormValueControl<TOut>, CalendarFormControlCommon {
|
|
985
|
+
private readonly host;
|
|
986
|
+
/** Two-way value, forwarded to the hosting `CalendarComponent`. Signal Forms `Field` binds against this. */
|
|
987
|
+
readonly value: ModelSignal<TOut>;
|
|
988
|
+
/** Mirrors the bound field's disabled flag. */
|
|
989
|
+
readonly disabled: InputSignal<boolean>;
|
|
990
|
+
/** Mirrors the bound field's readonly flag. */
|
|
991
|
+
readonly readonly: InputSignal<boolean>;
|
|
992
|
+
/** Mirrors the bound field's required flag. */
|
|
993
|
+
readonly required: InputSignal<boolean>;
|
|
994
|
+
/** Mirrors the bound field's invalid flag. */
|
|
995
|
+
readonly invalid: InputSignal<boolean>;
|
|
996
|
+
/** Mirrors the bound field's hidden flag. */
|
|
997
|
+
readonly hidden: InputSignal<boolean>;
|
|
998
|
+
/** Mirrors the bound field's errors. */
|
|
999
|
+
readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
|
|
1000
|
+
/** Mirrors the bound field's disablement reasons. */
|
|
1001
|
+
readonly disabledReasons: InputSignal<readonly WithOptionalFieldTree<DisabledReason>[]>;
|
|
1002
|
+
/** Two-way `touched` flag — drives and reflects the field's touched state. */
|
|
1003
|
+
readonly touched: ModelSignal<boolean>;
|
|
1004
|
+
constructor();
|
|
1005
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarMultipleDirective<any, any>, never>;
|
|
1006
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CalendarMultipleDirective<any, any>, "tw-calendar[mode=\"multiple\"]", ["twCalendarMultiple"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disabledReasons": { "alias": "disabledReasons"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; }, { "touched": "touchedChange"; }, never, never, true, never>;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Signal Forms strict binding for `CalendarComponent` in `range` mode.
|
|
1010
|
+
* Implements `FormValueControl<{ start: D | null; end: D | null }>`.
|
|
1011
|
+
*/
|
|
1012
|
+
declare class CalendarRangeDirective<D = Date, TOut = CalendarRangeValue<D>> implements FormValueControl<TOut>, CalendarFormControlCommon {
|
|
1013
|
+
private readonly host;
|
|
1014
|
+
/** Two-way value, forwarded to the hosting `CalendarComponent`. Signal Forms `Field` binds against this. */
|
|
1015
|
+
readonly value: ModelSignal<TOut>;
|
|
1016
|
+
/** Mirrors the bound field's disabled flag. */
|
|
1017
|
+
readonly disabled: InputSignal<boolean>;
|
|
1018
|
+
/** Mirrors the bound field's readonly flag. */
|
|
1019
|
+
readonly readonly: InputSignal<boolean>;
|
|
1020
|
+
/** Mirrors the bound field's required flag. */
|
|
1021
|
+
readonly required: InputSignal<boolean>;
|
|
1022
|
+
/** Mirrors the bound field's invalid flag. */
|
|
1023
|
+
readonly invalid: InputSignal<boolean>;
|
|
1024
|
+
/** Mirrors the bound field's hidden flag. */
|
|
1025
|
+
readonly hidden: InputSignal<boolean>;
|
|
1026
|
+
/** Mirrors the bound field's errors. */
|
|
1027
|
+
readonly errors: InputSignal<readonly ValidationError.WithOptionalFieldTree[]>;
|
|
1028
|
+
/** Mirrors the bound field's disablement reasons. */
|
|
1029
|
+
readonly disabledReasons: InputSignal<readonly WithOptionalFieldTree<DisabledReason>[]>;
|
|
1030
|
+
/** Two-way `touched` flag — drives and reflects the field's touched state. */
|
|
1031
|
+
readonly touched: ModelSignal<boolean>;
|
|
1032
|
+
constructor();
|
|
1033
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarRangeDirective<any, any>, never>;
|
|
1034
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CalendarRangeDirective<any, any>, "tw-calendar[mode=\"range\"]", ["twCalendarRange"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "disabledReasons": { "alias": "disabledReasons"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; }, { "touched": "touchedChange"; }, never, never, true, never>;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/** Names of month / day-of-week labels, in three densities. */
|
|
1038
|
+
type TwDateNameStyle = 'long' | 'short' | 'narrow';
|
|
1039
|
+
/**
|
|
1040
|
+
* Injection token for a per-instance timezone override (§7.4, §4.3).
|
|
1041
|
+
* When set, TZ-aware adapters resolve `today()` and date-range math against
|
|
1042
|
+
* the supplied IANA timezone. Floating (naive) adapters ignore the token.
|
|
1043
|
+
*/
|
|
1044
|
+
declare const TZ_OVERRIDE: InjectionToken<string>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Injection token for the default value transformer (§7.4, §7.6). Phase 14 wires
|
|
1047
|
+
* the component-level `valueTransformer` input to override this DI default.
|
|
1048
|
+
* Shipped as a token shell now so later phases can bind against it without a
|
|
1049
|
+
* breaking change.
|
|
1050
|
+
*/
|
|
1051
|
+
declare const DATE_SERIALIZATION: InjectionToken<unknown>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Format definitions consumed by the calendar header, views, and text-input
|
|
1054
|
+
* directive. Each field accepts an adapter-specific format token — the default
|
|
1055
|
+
* {@link NativeDateAdapter} interprets them as `Intl.DateTimeFormatOptions`
|
|
1056
|
+
* bags wrapped in a {@link NativeDateFormat}.
|
|
1057
|
+
*
|
|
1058
|
+
* Phases 2+ only require the `input`, `display`, `monthLabel`, and `yearLabel`
|
|
1059
|
+
* members; the rest ship as slots now so later phases (5 — CalendarIntl, 9 —
|
|
1060
|
+
* multi-month, 11 — text input) can populate them without an API break.
|
|
1061
|
+
*/
|
|
1062
|
+
interface DateFormats {
|
|
1063
|
+
/** Format used when parsing user-typed input. */
|
|
1064
|
+
readonly input?: unknown;
|
|
1065
|
+
/** Format used when rendering a date into a text input's display value. */
|
|
1066
|
+
readonly display?: unknown;
|
|
1067
|
+
/** Format used for the header's month label (e.g., `"January 2026"`). */
|
|
1068
|
+
readonly monthLabel?: unknown;
|
|
1069
|
+
/** Format used for the header's year label in month view (e.g., `"2026"`). */
|
|
1070
|
+
readonly yearLabel?: unknown;
|
|
1071
|
+
/** Format used for the years-view header (e.g., `"2020 – 2039"`). */
|
|
1072
|
+
readonly decadeLabel?: unknown;
|
|
1073
|
+
/** Format used for a day-cell's accessible label. */
|
|
1074
|
+
readonly a11yLabel?: unknown;
|
|
1075
|
+
/** Format used for a month-cell's accessible label. */
|
|
1076
|
+
readonly monthA11yLabel?: unknown;
|
|
1077
|
+
/** Format used for a day-of-week column header's accessible label. */
|
|
1078
|
+
readonly dayA11yLabel?: unknown;
|
|
1079
|
+
/** Format used for a month name inside the year view's accessible label. */
|
|
1080
|
+
readonly yearViewMonthA11yLabel?: unknown;
|
|
1081
|
+
}
|
|
1082
|
+
/** DI token carrying the default `DateFormats`. The calendar's `dateFormats` input overrides. */
|
|
1083
|
+
declare const DATE_FORMATS: InjectionToken<DateFormats>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Abstract date adapter. Ship a subclass to swap the underlying date library
|
|
1086
|
+
* (Luxon, date-fns, Temporal). The calendar consumes only the methods defined
|
|
1087
|
+
* here — nothing else.
|
|
1088
|
+
*
|
|
1089
|
+
* `D` is the native date type understood by the underlying library.
|
|
1090
|
+
*
|
|
1091
|
+
* Method contract aligned with spec §20.1 / §20.2: `addYears`/`addMonths`/
|
|
1092
|
+
* `addDays`, `compare`, 1-based-month `create`, `toIso`/`fromIso`, and
|
|
1093
|
+
* optional TZ virtuals.
|
|
1094
|
+
*/
|
|
1095
|
+
declare abstract class DateAdapter<D> {
|
|
1096
|
+
/** Returns today at midnight, local time (or in the adapter's configured TZ). */
|
|
1097
|
+
abstract today(): D;
|
|
1098
|
+
/**
|
|
1099
|
+
* Constructs a date.
|
|
1100
|
+
*
|
|
1101
|
+
* **`month` is 1-based** — pass `1` for January, `12` for December.
|
|
1102
|
+
* Callers migrating from the pre-v1 `createDate(year, zeroBasedMonth, day)`
|
|
1103
|
+
* must bump the month argument by one.
|
|
1104
|
+
*
|
|
1105
|
+
* `day` is 1-based.
|
|
1106
|
+
*/
|
|
1107
|
+
abstract create(year: number, month: number, day: number): D;
|
|
1108
|
+
/** Returns a defensive copy. */
|
|
1109
|
+
abstract clone(date: D): D;
|
|
1110
|
+
/** Locale for label formatting. Subclasses may honour this or ignore. */
|
|
1111
|
+
abstract setLocale(locale: string): void;
|
|
1112
|
+
abstract getLocale(): string;
|
|
1113
|
+
/** Field getters. `month` is zero-based. */
|
|
1114
|
+
abstract getYear(date: D): number;
|
|
1115
|
+
abstract getMonth(date: D): number;
|
|
1116
|
+
abstract getDate(date: D): number;
|
|
1117
|
+
/** 0 = Sunday, 6 = Saturday. */
|
|
1118
|
+
abstract getDayOfWeek(date: D): number;
|
|
1119
|
+
abstract getNumDaysInMonth(date: D): number;
|
|
1120
|
+
/** Time getters — hours are 0–23, minutes and seconds are 0–59. */
|
|
1121
|
+
abstract getHours(date: D): number;
|
|
1122
|
+
abstract getMinutes(date: D): number;
|
|
1123
|
+
abstract getSeconds(date: D): number;
|
|
1124
|
+
/**
|
|
1125
|
+
* Returns a new date with the same year/month/day as `date` but the supplied
|
|
1126
|
+
* time-of-day. Adapters must not mutate `date`. `hours` is 0–23.
|
|
1127
|
+
*
|
|
1128
|
+
* **Not part of the calendar's v1 spec surface** — the calendar does not
|
|
1129
|
+
* consume time-of-day. Retained for the companion time-picker component.
|
|
1130
|
+
*/
|
|
1131
|
+
abstract withTime(date: D, hours: number, minutes: number, seconds: number): D;
|
|
1132
|
+
/** 0 = Sunday, 1 = Monday, etc. */
|
|
1133
|
+
abstract getFirstDayOfWeek(): number;
|
|
1134
|
+
/** Days per week. Override only for non-Gregorian adapters (WONT v1). */
|
|
1135
|
+
getDaysInWeek(): number;
|
|
1136
|
+
/** Returns month names for the current locale. */
|
|
1137
|
+
abstract getMonthNames(style: TwDateNameStyle): string[];
|
|
1138
|
+
/** Returns day-of-week names for the current locale, starting at Sunday. */
|
|
1139
|
+
abstract getDayOfWeekNames(style: TwDateNameStyle): string[];
|
|
1140
|
+
/** Returns 1-based day-of-month names (`["1", "2", ..., "31"]`) for locales that localize numerals. Default implementation returns Latin digits. */
|
|
1141
|
+
getDateNames(_style?: TwDateNameStyle): string[];
|
|
1142
|
+
/** Returns the localised year label (e.g. `"2026"`). */
|
|
1143
|
+
abstract getYearName(date: D): string;
|
|
1144
|
+
/** Formats a date for display. Subclasses pick their own format tokens. */
|
|
1145
|
+
abstract format(date: D, displayFormat: unknown): string;
|
|
1146
|
+
/** Date arithmetic — preserve original in immutable adapters. */
|
|
1147
|
+
abstract addYears(date: D, years: number): D;
|
|
1148
|
+
abstract addMonths(date: D, months: number): D;
|
|
1149
|
+
abstract addDays(date: D, days: number): D;
|
|
1150
|
+
/** Time arithmetic. Default implementation derives hours/minutes from day arithmetic via `addDays` — adapters with better precision should override. */
|
|
1151
|
+
addHours(date: D, hours: number): D;
|
|
1152
|
+
abstract addMinutes(date: D, minutes: number): D;
|
|
1153
|
+
/** Returns negative when `first` is earlier, 0 when equal, positive when later. */
|
|
1154
|
+
abstract compare(first: D, second: D): number;
|
|
1155
|
+
abstract sameDate(first: D | null | undefined, second: D | null | undefined): boolean;
|
|
1156
|
+
/** Whether a raw value can be turned into a valid date. */
|
|
1157
|
+
abstract isValid(date: D): boolean;
|
|
1158
|
+
/** Returns an invalid sentinel of type `D` (NaN-date for native). */
|
|
1159
|
+
abstract invalid(): D;
|
|
1160
|
+
/** Attempt to parse an ISO or free-form string. Return `null` on failure. */
|
|
1161
|
+
abstract parse(value: unknown, parseFormat?: unknown): D | null;
|
|
1162
|
+
/** Coerce an incoming value from form writes. */
|
|
1163
|
+
abstract deserialize(value: unknown): D | null;
|
|
1164
|
+
/** ISO 8601 (`YYYY-MM-DD`) serialization. Phases using serialized forms call this. */
|
|
1165
|
+
abstract toIso(date: D): string;
|
|
1166
|
+
/** ISO 8601 (`YYYY-MM-DD`) deserialization counterpart to `toIso`. */
|
|
1167
|
+
fromIso(iso: string): D | null;
|
|
1168
|
+
/**
|
|
1169
|
+
* Start-of-day normalization. Default implementation rebuilds the date at
|
|
1170
|
+
* `00:00:00.000` local time; DST-skipped hours (e.g., 02:00 on DST start) are
|
|
1171
|
+
* resolved to the wall-clock midnight the adapter considers valid.
|
|
1172
|
+
*
|
|
1173
|
+
* TZ-aware adapters MUST override to normalize in the adapter's TZ.
|
|
1174
|
+
*/
|
|
1175
|
+
abstract startOfDay(date: D): D;
|
|
1176
|
+
/** First day of the week containing `date`. `firstDayOfWeek` defaults to `getFirstDayOfWeek()`. */
|
|
1177
|
+
startOfWeek(date: D, firstDayOfWeek?: number): D;
|
|
1178
|
+
/** Last day of the week containing `date`. */
|
|
1179
|
+
endOfWeek(date: D, firstDayOfWeek?: number): D;
|
|
1180
|
+
/** Equality on year + month. */
|
|
1181
|
+
sameMonth(first: D, second: D): boolean;
|
|
1182
|
+
/** Equality on year only. */
|
|
1183
|
+
sameYear(first: D, second: D): boolean;
|
|
1184
|
+
/** Clamp a date into the [min, max] window. */
|
|
1185
|
+
clampDate(date: D, min?: D | null, max?: D | null): D;
|
|
1186
|
+
/** Returns the adapter's configured timezone, or `null` for floating adapters. */
|
|
1187
|
+
getTimezone(): string | null;
|
|
1188
|
+
/** Returns a copy of `date` reinterpreted in `tz`. Floating adapters pass through. */
|
|
1189
|
+
withTimezone(date: D, _tz: string): D;
|
|
1190
|
+
/** Returns `true` when `date` sits inside a DST-transition. Floating adapters return `false`. */
|
|
1191
|
+
isDST(_date: D): boolean;
|
|
1192
|
+
/** Resolves an ambiguous wall-clock time (DST fall-back) to one of the two candidates. Floating adapters pass through. */
|
|
1193
|
+
resolveAmbiguous(date: D, _prefer: 'earlier' | 'later'): D;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Injection token for the calendar's `DateAdapter`. Prefer `provideNativeDateAdapter()`
|
|
1197
|
+
* or `provideTwCalendar({ adapter })` over binding this token directly.
|
|
1198
|
+
*/
|
|
1199
|
+
declare const DATE_ADAPTER: InjectionToken<DateAdapter<unknown>>;
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Shape of the read-only context the calendar validator needs from the
|
|
1203
|
+
* hosting component. Kept as a structural type so tests and custom consumers
|
|
1204
|
+
* can synthesize one without subclassing `CalendarComponent`.
|
|
1205
|
+
*/
|
|
1206
|
+
interface CalendarValidatorContext<M extends CalendarMode = CalendarMode, D = unknown> {
|
|
1207
|
+
/** Current mode — used to decide which shape counts as "empty". */
|
|
1208
|
+
readonly mode: M;
|
|
1209
|
+
/** The raw form value whose last write was rejected as wrong-shape (§7.2). `null` when no rejected write is outstanding. */
|
|
1210
|
+
readonly lastInvalidFormValue: unknown;
|
|
1211
|
+
/** Aggregated constraint inputs (§10.1). Optional — when omitted, only `calendarRequired` / `calendarInvalidValue` codes are produced. */
|
|
1212
|
+
readonly constraints?: CalendarConstraints<D>;
|
|
1213
|
+
/** Adapter used to evaluate constraint codes. Required when `constraints` is set. */
|
|
1214
|
+
readonly adapter?: DateAdapter<D>;
|
|
1215
|
+
/** Minimum range length, days. `mode: 'range'` only. */
|
|
1216
|
+
readonly minRangeLength?: number | null;
|
|
1217
|
+
/** Maximum range length, days. `mode: 'range'` only. */
|
|
1218
|
+
readonly maxRangeLength?: number | null;
|
|
1219
|
+
/** Maximum number of selections. `mode: 'multiple'` only. */
|
|
1220
|
+
readonly maxSelections?: number | null;
|
|
1221
|
+
}
|
|
1222
|
+
/** `true` when `value` matches the mode-specific empty state (§7.1, §6.4). */
|
|
1223
|
+
declare function isCalendarValueEmpty<M extends CalendarMode, D>(mode: M, value: CalendarValue<M, D> | null | undefined): boolean;
|
|
1224
|
+
/**
|
|
1225
|
+
* Built-in synchronous validator (§6.1, §10.2). Emits the full v1 error code set:
|
|
1226
|
+
*
|
|
1227
|
+
* Phase 3 codes:
|
|
1228
|
+
* - `calendarRequired` when the hosting control carries `Validators.required`
|
|
1229
|
+
* and the calendar value is mode-specific empty.
|
|
1230
|
+
* - `calendarInvalidValue` when the most recent `writeValue` was rejected as
|
|
1231
|
+
* wrong-shape (§7.2) — the raw value is held on the component's
|
|
1232
|
+
* `lastInvalidFormValue` until a valid write clears it.
|
|
1233
|
+
*
|
|
1234
|
+
* Phase 4 codes (active when `ctx.constraints` + `ctx.adapter` are supplied):
|
|
1235
|
+
* - `calendarMinDate` / `calendarMaxDate` — value (or any range endpoint /
|
|
1236
|
+
* array entry) falls outside `[minDate, maxDate]`.
|
|
1237
|
+
* - `calendarDisabledDate` — value matches `dateFilter` / `disabledDates` /
|
|
1238
|
+
* `disabledDaysOfWeek` (constraint resolver).
|
|
1239
|
+
* - `calendarRangeTooShort` / `calendarRangeTooLong` — `mode: 'range'` length
|
|
1240
|
+
* violates `minRangeLength` / `maxRangeLength`.
|
|
1241
|
+
* - `calendarMaxSelections` — `mode: 'multiple'` array exceeds `maxSelections`.
|
|
1242
|
+
* - `calendarInvalidRange` — committed range has `start > end` (the orchestrator
|
|
1243
|
+
* normalizes via auto-swap; this only triggers on programmatic writeValue).
|
|
1244
|
+
*
|
|
1245
|
+
* Each code's payload mirrors §10.2 — `{ min, actual }`, `{ max, actual }`,
|
|
1246
|
+
* `{ length, min }`, etc.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function calendarValidator<M extends CalendarMode, D>(ctx: CalendarValidatorContext<M, D>): ValidatorFn;
|
|
1249
|
+
/**
|
|
1250
|
+
* Standalone required-validator helper for consumers who want to compose
|
|
1251
|
+
* calendar-required on a control that is **not** bound directly to a
|
|
1252
|
+
* `CalendarComponent`. The rule is identical: mode-specific empty ⇒ error.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function calendarRequiredValidator<M extends CalendarMode, D>(mode: M): ValidatorFn;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Marker directive for a slot positioned above the calendar grid. Used to
|
|
1258
|
+
* style an external preset rail; the calendar renders projected content
|
|
1259
|
+
* with `<ng-content select="[twCalendarPresets]">`.
|
|
1260
|
+
*/
|
|
1261
|
+
declare class CalendarPresetsDirective {
|
|
1262
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarPresetsDirective, never>;
|
|
1263
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CalendarPresetsDirective, "[twCalendarPresets]", never, {}, {}, never, never, true, never>;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Calendar navigation header — previous / period / next button row.
|
|
1268
|
+
* The period label button toggles between views (month → year → multi-year).
|
|
1269
|
+
*/
|
|
1270
|
+
declare class CalendarHeaderComponent {
|
|
1271
|
+
/** Display text for the period button (e.g. "January 2026"). */
|
|
1272
|
+
readonly periodLabel: InputSignal<string>;
|
|
1273
|
+
/** Accessible label for the period button. */
|
|
1274
|
+
readonly periodAriaLabel: InputSignal<string>;
|
|
1275
|
+
/** Accessible label for the previous button. */
|
|
1276
|
+
readonly prevAriaLabel: InputSignal<string>;
|
|
1277
|
+
/** Accessible label for the next button. */
|
|
1278
|
+
readonly nextAriaLabel: InputSignal<string>;
|
|
1279
|
+
/** Disables the previous button. */
|
|
1280
|
+
readonly prevDisabled: InputSignal<boolean>;
|
|
1281
|
+
/** Disables the next button. */
|
|
1282
|
+
readonly nextDisabled: InputSignal<boolean>;
|
|
1283
|
+
/** When false, the period button is disabled (e.g. when already at the top view). */
|
|
1284
|
+
readonly canSwitchView: InputSignal<boolean>;
|
|
1285
|
+
/** Fires on previous button click. */
|
|
1286
|
+
readonly prevClicked: OutputEmitterRef<void>;
|
|
1287
|
+
/** Fires on next button click. */
|
|
1288
|
+
readonly nextClicked: OutputEmitterRef<void>;
|
|
1289
|
+
/** Fires on period button click (switch to the next higher view). */
|
|
1290
|
+
readonly periodClicked: OutputEmitterRef<void>;
|
|
1291
|
+
protected readonly classes: Signal<{
|
|
1292
|
+
root: string;
|
|
1293
|
+
navButton: string;
|
|
1294
|
+
periodButton: string;
|
|
1295
|
+
}>;
|
|
1296
|
+
protected onPeriodClick(): void;
|
|
1297
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarHeaderComponent, never>;
|
|
1298
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarHeaderComponent, "tw-calendar-header", never, { "periodLabel": { "alias": "periodLabel"; "required": true; "isSignal": true; }; "periodAriaLabel": { "alias": "periodAriaLabel"; "required": true; "isSignal": true; }; "prevAriaLabel": { "alias": "prevAriaLabel"; "required": true; "isSignal": true; }; "nextAriaLabel": { "alias": "nextAriaLabel"; "required": true; "isSignal": true; }; "prevDisabled": { "alias": "prevDisabled"; "required": false; "isSignal": true; }; "nextDisabled": { "alias": "nextDisabled"; "required": false; "isSignal": true; }; "canSwitchView": { "alias": "canSwitchView"; "required": false; "isSignal": true; }; }, { "prevClicked": "prevClicked"; "nextClicked": "nextClicked"; "periodClicked": "periodClicked"; }, never, never, true, never>;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* German (de) locale pack for the calendar's user-visible strings.
|
|
1303
|
+
* Pass into the `intl` input or via {@link provideCalendarIntl}. Per-field
|
|
1304
|
+
* merge semantics (§19.4) — unspecified fields fall back to English defaults.
|
|
1305
|
+
*/
|
|
1306
|
+
declare const de: Partial<CalendarIntl>;
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* French (fr) locale pack for the calendar's user-visible strings.
|
|
1310
|
+
* Pass into the `intl` input or via {@link provideCalendarIntl}. Per-field
|
|
1311
|
+
* merge semantics (§19.4) — unspecified fields fall back to English defaults.
|
|
1312
|
+
*/
|
|
1313
|
+
declare const fr: Partial<CalendarIntl>;
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Spanish (es) locale pack for the calendar's user-visible strings.
|
|
1317
|
+
* Pass into the `intl` input or via {@link provideCalendarIntl}. Per-field
|
|
1318
|
+
* merge semantics (§19.4) — unspecified fields fall back to English defaults.
|
|
1319
|
+
*/
|
|
1320
|
+
declare const es: Partial<CalendarIntl>;
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Portuguese (pt) locale pack for the calendar's user-visible strings.
|
|
1324
|
+
* Pass into the `intl` input or via {@link provideCalendarIntl}. Per-field
|
|
1325
|
+
* merge semantics (§19.4) — unspecified fields fall back to English defaults.
|
|
1326
|
+
*/
|
|
1327
|
+
declare const pt: Partial<CalendarIntl>;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Japanese (ja) locale pack for the calendar's user-visible strings.
|
|
1331
|
+
* Pass into the `intl` input or via {@link provideCalendarIntl}. Per-field
|
|
1332
|
+
* merge semantics (§19.4) — unspecified fields fall back to English defaults.
|
|
1333
|
+
*
|
|
1334
|
+
* Note: Japanese has no grammatical plural form, so plural-marked methods
|
|
1335
|
+
* collapse to a single form.
|
|
1336
|
+
*/
|
|
1337
|
+
declare const ja: Partial<CalendarIntl>;
|
|
1338
|
+
|
|
1339
|
+
/** Emitted on keyboard navigation keys (arrows, Home/End, PageUp/PageDown). */
|
|
1340
|
+
interface CalendarCellKeyNavEvent<D> {
|
|
1341
|
+
readonly direction: 'left' | 'right' | 'up' | 'down' | 'home' | 'end' | 'pageUp' | 'pageDown';
|
|
1342
|
+
/** True when the originating KeyboardEvent had Shift held — drives year-jump variants of Page navigation. */
|
|
1343
|
+
readonly shiftKey: boolean;
|
|
1344
|
+
readonly cell: CalendarCell<D>;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Renders a single cell in any calendar view.
|
|
1348
|
+
*
|
|
1349
|
+
* The cell is a stateless presentation component — selection / preview /
|
|
1350
|
+
* today state is all derived from the `CalendarCell<D>` data object. It
|
|
1351
|
+
* emits events for clicks, keyboard navigation, mouse hover, and focus.
|
|
1352
|
+
*/
|
|
1353
|
+
declare class CalendarCellComponent<D> {
|
|
1354
|
+
private readonly buttonRef;
|
|
1355
|
+
/** The cell data object to render. */
|
|
1356
|
+
readonly cell: InputSignal<CalendarCell<D>>;
|
|
1357
|
+
/** The active calendar view — drives cell dimensions and radius. */
|
|
1358
|
+
readonly view: InputSignal<CalendarViewState>;
|
|
1359
|
+
/** `true` when the cell's date is outside the currently displayed month. */
|
|
1360
|
+
readonly outside: InputSignal<boolean>;
|
|
1361
|
+
/** Tab index for roving focus (`0` for the active cell, `-1` otherwise). */
|
|
1362
|
+
readonly tabindex: InputSignal<number>;
|
|
1363
|
+
/** Optional template rendered inside the button — receives `{ $implicit: CalendarCell<D> }`. */
|
|
1364
|
+
readonly cellTemplate: InputSignal<TemplateRef<{
|
|
1365
|
+
$implicit: CalendarCell<D>;
|
|
1366
|
+
}> | null>;
|
|
1367
|
+
/** Emitted when the user activates the cell (click, Enter, or Space). */
|
|
1368
|
+
readonly selected: OutputEmitterRef<CalendarCell<D>>;
|
|
1369
|
+
/** Emitted when the cell gains focus. */
|
|
1370
|
+
readonly focused: OutputEmitterRef<CalendarCell<D>>;
|
|
1371
|
+
/** Emitted on pointer hover — parent uses this to drive range preview. */
|
|
1372
|
+
readonly previewed: OutputEmitterRef<CalendarCell<D>>;
|
|
1373
|
+
/** Emitted on navigation keys (arrows, Home/End, PageUp/PageDown). */
|
|
1374
|
+
readonly keyNav: OutputEmitterRef<CalendarCellKeyNavEvent<D>>;
|
|
1375
|
+
protected readonly cellState: Signal<CalendarCellState>;
|
|
1376
|
+
protected readonly wrapperRange: Signal<'none' | 'start' | 'middle' | 'end' | 'single'>;
|
|
1377
|
+
private readonly variantResult;
|
|
1378
|
+
protected readonly wrapperClasses: Signal<string>;
|
|
1379
|
+
protected readonly buttonClasses: Signal<string>;
|
|
1380
|
+
protected onClick(): void;
|
|
1381
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1382
|
+
protected onMouseEnter(): void;
|
|
1383
|
+
protected onFocus(): void;
|
|
1384
|
+
/** Imperatively focuses this cell's button. */
|
|
1385
|
+
focusButton(): void;
|
|
1386
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarCellComponent<any>, never>;
|
|
1387
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarCellComponent<any>, "tw-calendar-cell", never, { "cell": { "alias": "cell"; "required": true; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "outside": { "alias": "outside"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; "cellTemplate": { "alias": "cellTemplate"; "required": false; "isSignal": true; }; }, { "selected": "selected"; "focused": "focused"; "previewed": "previewed"; "keyNav": "keyNav"; }, never, never, true, never>;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Abstract base for the three calendar views. Holds shared inputs/outputs
|
|
1392
|
+
* (selection, preview, min/max, filters), cell-hit helpers, and roving-focus
|
|
1393
|
+
* machinery. Subclasses implement `cells`, `gridLabel`, `onKeyNav`, and
|
|
1394
|
+
* `getActiveCompareValue`.
|
|
1395
|
+
*/
|
|
1396
|
+
declare abstract class CalendarViewBase<D> {
|
|
1397
|
+
protected readonly dateAdapter: DateAdapter<D>;
|
|
1398
|
+
/** The date that anchors the grid being rendered. */
|
|
1399
|
+
readonly activeDate: InputSignal<D>;
|
|
1400
|
+
/** Current selection — scalar, array (multi), or range. */
|
|
1401
|
+
readonly selected: InputSignal<D | D[] | DateRange<D> | null>;
|
|
1402
|
+
/** Minimum selectable date. */
|
|
1403
|
+
readonly minDate: InputSignal<D | null>;
|
|
1404
|
+
/** Maximum selectable date. */
|
|
1405
|
+
readonly maxDate: InputSignal<D | null>;
|
|
1406
|
+
/** Per-date predicate — return `false` to disable. */
|
|
1407
|
+
readonly dateFilter: InputSignal<DateFilterFn<D> | null>;
|
|
1408
|
+
/** Explicitly disabled dates — array (compared via `adapter.sameDate`) or predicate (returns `true` for disabled). */
|
|
1409
|
+
readonly disabledDates: InputSignal<DisabledDates<D> | null>;
|
|
1410
|
+
/** Days of the week to disable (0=Sun … 6=Sat). Empty array = no day-of-week disabling. */
|
|
1411
|
+
readonly disabledDaysOfWeek: InputSignal<readonly number[]>;
|
|
1412
|
+
/** Per-cell class override. */
|
|
1413
|
+
readonly dateClass: InputSignal<DateClassFn<D> | null>;
|
|
1414
|
+
/** Hover-preview start (set while user is mid-range pick). */
|
|
1415
|
+
readonly previewStart: InputSignal<D | null>;
|
|
1416
|
+
/** Hover-preview end. */
|
|
1417
|
+
readonly previewEnd: InputSignal<D | null>;
|
|
1418
|
+
/** Phase 6 — date that briefly flashes as invalid (rejected commit). Cleared by the orchestrator. */
|
|
1419
|
+
readonly invalidFlashDate: InputSignal<D | null>;
|
|
1420
|
+
/** `true` when the parent calendar allows more than one cell to be selected at once. Drives `aria-multiselectable` on the grid host. */
|
|
1421
|
+
readonly multiSelectable: InputSignal<boolean>;
|
|
1422
|
+
/** `true` when the parent calendar is in read-only mode. Drives `aria-readonly` on the grid host. */
|
|
1423
|
+
readonly readonlyGrid: InputSignal<boolean>;
|
|
1424
|
+
/** Optional cell-content override. */
|
|
1425
|
+
readonly cellTemplate: InputSignal<TemplateRef<{
|
|
1426
|
+
$implicit: CalendarCell<D>;
|
|
1427
|
+
}> | null>;
|
|
1428
|
+
/** Fires when the user activates an enabled cell (click, Enter, or Space). Payload is the activated cell's date. */
|
|
1429
|
+
readonly selectedChange: OutputEmitterRef<D>;
|
|
1430
|
+
/** Fires when keyboard navigation or programmatic focus moves the roving cursor to a new cell. Payload is the new active date. */
|
|
1431
|
+
readonly activeDateChange: OutputEmitterRef<D>;
|
|
1432
|
+
/** Fires on pointer hover with the hovered date, and again with `null` when the pointer leaves the grid. The parent orchestrator drives any range-preview state from this stream. */
|
|
1433
|
+
readonly previewChange: OutputEmitterRef<D | null>;
|
|
1434
|
+
/** Subclass declares which view it represents. */
|
|
1435
|
+
protected abstract readonly view: CalendarViewState;
|
|
1436
|
+
/** Subclass exposes its cell components for focus management. */
|
|
1437
|
+
protected abstract readonly cellComponents: Signal<readonly CalendarCellComponent<D>[]>;
|
|
1438
|
+
/** Cell that should own the roving-tabindex cursor. `null` means "use `activeDate`". */
|
|
1439
|
+
protected readonly focusedCellValue: WritableSignal<number | null>;
|
|
1440
|
+
/** Pending focus target — drained after the next render. */
|
|
1441
|
+
protected readonly focusPending: WritableSignal<number | null>;
|
|
1442
|
+
constructor();
|
|
1443
|
+
/** 2D grid of cells rendered by the subclass. */
|
|
1444
|
+
abstract readonly cells: Signal<CalendarCell<D>[][]>;
|
|
1445
|
+
/** Accessible label for the grid (e.g. "January 2026"). */
|
|
1446
|
+
abstract readonly gridLabel: Signal<string>;
|
|
1447
|
+
/** Today's date — memoized per view instance. */
|
|
1448
|
+
protected readonly today: Signal<D>;
|
|
1449
|
+
/** True when `date` is part of the committed selection. */
|
|
1450
|
+
protected isSelected(date: D): boolean;
|
|
1451
|
+
protected isRangeStart(date: D): boolean;
|
|
1452
|
+
protected isRangeEnd(date: D): boolean;
|
|
1453
|
+
protected isRangeMiddle(date: D): boolean;
|
|
1454
|
+
protected isPreviewStart(date: D): boolean;
|
|
1455
|
+
protected isPreviewEnd(date: D): boolean;
|
|
1456
|
+
protected isPreviewMiddle(date: D): boolean;
|
|
1457
|
+
protected isDateRange(value: D | D[] | DateRange<D>): value is DateRange<D>;
|
|
1458
|
+
/** Routes a cell activation up to the parent. */
|
|
1459
|
+
onCellSelected(cell: CalendarCell<D>): void;
|
|
1460
|
+
/** Routes hover events up to the parent (parent drives preview state). */
|
|
1461
|
+
onCellPreviewed(cell: CalendarCell<D>): void;
|
|
1462
|
+
/** Clears the preview when the pointer leaves the grid. */
|
|
1463
|
+
onGridMouseLeave(): void;
|
|
1464
|
+
/** Subclass implements view-specific keyboard navigation. */
|
|
1465
|
+
abstract onKeyNav(event: {
|
|
1466
|
+
direction: string;
|
|
1467
|
+
cell: CalendarCell<D>;
|
|
1468
|
+
}): void;
|
|
1469
|
+
/** Returns `true` when the cell owns the roving cursor. */
|
|
1470
|
+
isActiveCell(cell: CalendarCell<D>): boolean;
|
|
1471
|
+
/** Compare value of the currently active date (subclass-specific). */
|
|
1472
|
+
protected abstract getActiveCompareValue(): number;
|
|
1473
|
+
/** Imperatively focuses the cell matching `compareValue` after the next render. */
|
|
1474
|
+
focusCell(compareValue: number): void;
|
|
1475
|
+
/** Focuses the cell that currently owns the roving cursor. */
|
|
1476
|
+
focusActiveCell(): void;
|
|
1477
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarViewBase<any>, never>;
|
|
1478
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CalendarViewBase<any>, never, never, { "activeDate": { "alias": "activeDate"; "required": true; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "dateFilter": { "alias": "dateFilter"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "disabledDaysOfWeek": { "alias": "disabledDaysOfWeek"; "required": false; "isSignal": true; }; "dateClass": { "alias": "dateClass"; "required": false; "isSignal": true; }; "previewStart": { "alias": "previewStart"; "required": false; "isSignal": true; }; "previewEnd": { "alias": "previewEnd"; "required": false; "isSignal": true; }; "invalidFlashDate": { "alias": "invalidFlashDate"; "required": false; "isSignal": true; }; "multiSelectable": { "alias": "multiSelectable"; "required": false; "isSignal": true; }; "readonlyGrid": { "alias": "readonlyGrid"; "required": false; "isSignal": true; }; "cellTemplate": { "alias": "cellTemplate"; "required": false; "isSignal": true; }; }, { "selectedChange": "selectedChange"; "activeDateChange": "activeDateChange"; "previewChange": "previewChange"; }, never, never, true, never>;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/** Arranges a flat array of items into a 2D grid with `columns` items per row. */
|
|
1482
|
+
declare function createGrid<T>(items: readonly T[], columns: number): T[][];
|
|
1483
|
+
/** Returns the new flat index after an arrow-key navigation step, or `null` on out of bounds. */
|
|
1484
|
+
declare function navigateGrid(currentIndex: number, direction: 'left' | 'right' | 'up' | 'down', totalItems: number, columns: number): number | null;
|
|
1485
|
+
/** Label pair for a weekday header cell. */
|
|
1486
|
+
interface WeekdayHeader {
|
|
1487
|
+
readonly label: string;
|
|
1488
|
+
readonly narrow: string;
|
|
1489
|
+
}
|
|
1490
|
+
/** Builds seven weekday headers rotated to start at `firstDayOfWeek` (or adapter default). */
|
|
1491
|
+
declare function getWeekdayHeaders<D>(adapter: DateAdapter<D>, style?: NameStyle, firstDayOfWeek?: number): WeekdayHeader[];
|
|
1492
|
+
/**
|
|
1493
|
+
* True when `date` falls outside `[minDate, maxDate]` or fails the filter.
|
|
1494
|
+
*
|
|
1495
|
+
* Phase 4 superset: also OR-checks `disabledDates` (array OR predicate) and
|
|
1496
|
+
* `disabledDaysOfWeek`. Legacy callers passing only the first four arguments
|
|
1497
|
+
* keep working — the new sources default to neutral values.
|
|
1498
|
+
*/
|
|
1499
|
+
declare function isDateDisabled<D>(date: D, minDate: D | null, maxDate: D | null, dateFilter: DateFilterFn<D> | null, adapter: DateAdapter<D>, disabledDates?: DisabledDates<D> | null, disabledDaysOfWeek?: readonly number[]): boolean;
|
|
1500
|
+
/** True when the whole month falls outside `[minDate, maxDate]`. `month` is 0-based (matches `adapter.getMonth`). */
|
|
1501
|
+
declare function isMonthDisabled<D>(year: number, month: number, minDate: D | null, maxDate: D | null, adapter: DateAdapter<D>): boolean;
|
|
1502
|
+
/** True when the whole year falls outside `[minDate, maxDate]`. */
|
|
1503
|
+
declare function isYearDisabled<D>(year: number, minDate: D | null, maxDate: D | null, adapter: DateAdapter<D>): boolean;
|
|
1504
|
+
/** Aligns `activeYear` to the start of its `yearsPerPage`-block. */
|
|
1505
|
+
declare function getMultiYearStartingYear(activeYear: number, yearsPerPage?: number): number;
|
|
1506
|
+
/** True when `date` sits inside `[start, end]` (inclusive). */
|
|
1507
|
+
declare function isDateInRange<D>(date: D, start: D | null, end: D | null, adapter: DateAdapter<D>): boolean;
|
|
1508
|
+
/** Returns the first day of the month for `date`. */
|
|
1509
|
+
declare function getFirstDayOfMonth<D>(date: D, adapter: DateAdapter<D>): D;
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* Month view — renders a 7×6 grid of day cells, with leading/trailing days
|
|
1513
|
+
* from adjacent months marked as "outside".
|
|
1514
|
+
*/
|
|
1515
|
+
declare class MonthViewComponent<D> extends CalendarViewBase<D> {
|
|
1516
|
+
protected readonly view: CalendarViewState;
|
|
1517
|
+
protected readonly cellComponents: Signal<readonly CalendarCellComponent<D>[]>;
|
|
1518
|
+
/** Override first day of week (0=Sun, 1=Mon). */
|
|
1519
|
+
readonly firstDayOfWeek: InputSignal<number>;
|
|
1520
|
+
/** Index within a multi-month row (0=left, 1+=right) — used by the orchestrator to disambiguate focus. */
|
|
1521
|
+
readonly gridIndex: InputSignal<number>;
|
|
1522
|
+
readonly weekdayHeaders: Signal<WeekdayHeader[]>;
|
|
1523
|
+
readonly displayMonth: Signal<number>;
|
|
1524
|
+
readonly displayYear: Signal<number>;
|
|
1525
|
+
readonly cells: Signal<CalendarCell<D>[][]>;
|
|
1526
|
+
readonly gridLabel: Signal<string>;
|
|
1527
|
+
protected getActiveCompareValue(): number;
|
|
1528
|
+
/** True when the cell's date sits in a neighbouring month (leading/trailing). */
|
|
1529
|
+
isOutsideMonth(cell: CalendarCell<D>): boolean;
|
|
1530
|
+
onKeyNav(event: CalendarCellKeyNavEvent<D>): void;
|
|
1531
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MonthViewComponent<any>, never>;
|
|
1532
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MonthViewComponent<any>, "tw-calendar-month-view", never, { "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "gridIndex": { "alias": "gridIndex"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Year view — 4×3 grid of month cells inside the active year.
|
|
1537
|
+
*/
|
|
1538
|
+
declare class YearViewComponent<D> extends CalendarViewBase<D> {
|
|
1539
|
+
protected readonly view: CalendarViewState;
|
|
1540
|
+
protected readonly cellComponents: Signal<readonly CalendarCellComponent<D>[]>;
|
|
1541
|
+
readonly displayYear: Signal<number>;
|
|
1542
|
+
readonly cells: Signal<CalendarCell<D>[][]>;
|
|
1543
|
+
readonly gridLabel: Signal<string>;
|
|
1544
|
+
protected getActiveCompareValue(): number;
|
|
1545
|
+
onKeyNav(event: CalendarCellKeyNavEvent<D>): void;
|
|
1546
|
+
private isMonthSelected;
|
|
1547
|
+
private isMonthRangeStart;
|
|
1548
|
+
private isMonthRangeEnd;
|
|
1549
|
+
private isMonthRangeMiddle;
|
|
1550
|
+
private isMonthPreviewStart;
|
|
1551
|
+
private isMonthPreviewEnd;
|
|
1552
|
+
private isMonthPreviewMiddle;
|
|
1553
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<YearViewComponent<any>, never>;
|
|
1554
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<YearViewComponent<any>, "tw-calendar-year-view", never, {}, {}, never, never, true, never>;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/** Default years per page — kept until Phase 7 introduces the `yearsPerPage` input. */
|
|
1558
|
+
declare const yearsPerPage = 24;
|
|
1559
|
+
/**
|
|
1560
|
+
* Year view — 4×6 grid (24 years by default). A user clicks a year to drill
|
|
1561
|
+
* down to the month-of-year view. In the spec vocabulary this is the
|
|
1562
|
+
* `'year'` view state (§7.4, §22).
|
|
1563
|
+
*/
|
|
1564
|
+
declare class YearsViewComponent<D> extends CalendarViewBase<D> {
|
|
1565
|
+
protected readonly view: CalendarViewState;
|
|
1566
|
+
protected readonly cellComponents: Signal<readonly CalendarCellComponent<D>[]>;
|
|
1567
|
+
readonly startYear: Signal<number>;
|
|
1568
|
+
readonly endYear: Signal<number>;
|
|
1569
|
+
readonly cells: Signal<CalendarCell<D>[][]>;
|
|
1570
|
+
readonly gridLabel: Signal<string>;
|
|
1571
|
+
protected getActiveCompareValue(): number;
|
|
1572
|
+
onKeyNav(event: CalendarCellKeyNavEvent<D>): void;
|
|
1573
|
+
private isYearSelected;
|
|
1574
|
+
private isYearRangeStart;
|
|
1575
|
+
private isYearRangeEnd;
|
|
1576
|
+
private isYearRangeMiddle;
|
|
1577
|
+
private isYearPreviewStart;
|
|
1578
|
+
private isYearPreviewEnd;
|
|
1579
|
+
private isYearPreviewMiddle;
|
|
1580
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<YearsViewComponent<any>, never>;
|
|
1581
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<YearsViewComponent<any>, "tw-calendar-years-view", never, {}, {}, never, never, true, never>;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Serializes a `CalendarValue<M, D>` to a JSON-friendly shape (spec §7.5, §33.4).
|
|
1586
|
+
* The output mirrors the mode: a scalar ISO string for single, an array for
|
|
1587
|
+
* multiple, and an endpoint-preserving object for range. `null` endpoints
|
|
1588
|
+
* round-trip unchanged.
|
|
1589
|
+
*
|
|
1590
|
+
* This is a consumer-facing helper — the component itself does NOT auto-
|
|
1591
|
+
* serialize. Apps emitting ISO strings at the form-submit boundary call
|
|
1592
|
+
* `serializeCalendarValue(control.value, adapter)` and assign the result to
|
|
1593
|
+
* their backend payload.
|
|
1594
|
+
*
|
|
1595
|
+
* Typing: TypeScript cannot narrow the return type by the mode-generic without
|
|
1596
|
+
* the caller passing `M` explicitly; the helper is declared with overloads that
|
|
1597
|
+
* cover all three modes plus a broad union fallback.
|
|
1598
|
+
*/
|
|
1599
|
+
declare function serializeCalendarValue<D>(value: CalendarValue<'single', D>, adapter: DateAdapter<D>): string | null;
|
|
1600
|
+
declare function serializeCalendarValue<D>(value: CalendarValue<'multiple', D>, adapter: DateAdapter<D>): string[];
|
|
1601
|
+
declare function serializeCalendarValue<D>(value: CalendarValue<'range', D>, adapter: DateAdapter<D>): {
|
|
1602
|
+
start: string | null;
|
|
1603
|
+
end: string | null;
|
|
1604
|
+
};
|
|
1605
|
+
declare function serializeCalendarValue<M extends CalendarMode, D>(value: CalendarValue<M, D>, adapter: DateAdapter<D>): string | null | string[] | {
|
|
1606
|
+
start: string | null;
|
|
1607
|
+
end: string | null;
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
/** Display-format descriptor used by `NativeDateAdapter.format()`. */
|
|
1611
|
+
interface TwNativeDateFormat {
|
|
1612
|
+
/** Any option bag accepted by `Intl.DateTimeFormat`. */
|
|
1613
|
+
readonly dateTimeFormat?: Intl.DateTimeFormatOptions;
|
|
1614
|
+
}
|
|
1615
|
+
/** `Intl`-driven `Date` adapter. Zero runtime dependencies. */
|
|
1616
|
+
declare class NativeDateAdapter extends DateAdapter<Date> {
|
|
1617
|
+
/**
|
|
1618
|
+
* Locale is resolved lazily on first read so the constructor stays
|
|
1619
|
+
* SSR-safe (no `navigator` access at class-construction time — §31.1).
|
|
1620
|
+
*/
|
|
1621
|
+
private _locale;
|
|
1622
|
+
private get locale();
|
|
1623
|
+
today(): Date;
|
|
1624
|
+
/**
|
|
1625
|
+
* Constructs a `Date`. **`month` is 1-based** — `create(2026, 1, 1)` yields
|
|
1626
|
+
* January 1, 2026.
|
|
1627
|
+
*/
|
|
1628
|
+
create(year: number, month: number, day: number): Date;
|
|
1629
|
+
clone(date: Date): Date;
|
|
1630
|
+
setLocale(locale: string): void;
|
|
1631
|
+
getLocale(): string;
|
|
1632
|
+
getYear(date: Date): number;
|
|
1633
|
+
getMonth(date: Date): number;
|
|
1634
|
+
getDate(date: Date): number;
|
|
1635
|
+
getDayOfWeek(date: Date): number;
|
|
1636
|
+
getNumDaysInMonth(date: Date): number;
|
|
1637
|
+
getHours(date: Date): number;
|
|
1638
|
+
getMinutes(date: Date): number;
|
|
1639
|
+
getSeconds(date: Date): number;
|
|
1640
|
+
withTime(date: Date, hours: number, minutes: number, seconds: number): Date;
|
|
1641
|
+
getFirstDayOfWeek(): number;
|
|
1642
|
+
getMonthNames(style: TwDateNameStyle): string[];
|
|
1643
|
+
getDayOfWeekNames(style: TwDateNameStyle): string[];
|
|
1644
|
+
getDateNames(style?: TwDateNameStyle): string[];
|
|
1645
|
+
getYearName(date: Date): string;
|
|
1646
|
+
format(date: Date, displayFormat: unknown): string;
|
|
1647
|
+
addYears(date: Date, years: number): Date;
|
|
1648
|
+
addMonths(date: Date, months: number): Date;
|
|
1649
|
+
addDays(date: Date, days: number): Date;
|
|
1650
|
+
addMinutes(date: Date, minutes: number): Date;
|
|
1651
|
+
addHours(date: Date, hours: number): Date;
|
|
1652
|
+
compare(first: Date, second: Date): number;
|
|
1653
|
+
sameDate(first: Date | null | undefined, second: Date | null | undefined): boolean;
|
|
1654
|
+
/**
|
|
1655
|
+
* Start-of-day normalization. Rebuilds the date at `00:00:00.000` local time.
|
|
1656
|
+
* On DST spring-forward days where midnight is valid, this is a no-op beyond
|
|
1657
|
+
* zeroing h/m/s/ms. On DST fall-back days the repeated-01:00 hour does not
|
|
1658
|
+
* affect `00:00`, so this is also safe.
|
|
1659
|
+
*
|
|
1660
|
+
* The edge case of an entire DST-skipped midnight (rare — exists in some
|
|
1661
|
+
* historical zones) is resolved by `new Date(year, month, day)` selecting the
|
|
1662
|
+
* next valid instant forward.
|
|
1663
|
+
*/
|
|
1664
|
+
startOfDay(date: Date): Date;
|
|
1665
|
+
isValid(date: Date): boolean;
|
|
1666
|
+
invalid(): Date;
|
|
1667
|
+
parse(value: unknown): Date | null;
|
|
1668
|
+
deserialize(value: unknown): Date | null;
|
|
1669
|
+
toIso(date: Date): string;
|
|
1670
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NativeDateAdapter, never>;
|
|
1671
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NativeDateAdapter>;
|
|
1672
|
+
}
|
|
1673
|
+
/** Provides the default `Date`-based adapter. */
|
|
1674
|
+
declare function provideNativeDateAdapter(): EnvironmentProviders;
|
|
1675
|
+
/** Provides a custom `DateAdapter` implementation. */
|
|
1676
|
+
declare function provideTwCalendar<D>(config: {
|
|
1677
|
+
adapter: new (...args: never[]) => DateAdapter<D>;
|
|
1678
|
+
extraProviders?: Provider[];
|
|
1679
|
+
}): EnvironmentProviders;
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* Convenience class that satisfies the `DateRange<D>` interface and carries
|
|
1683
|
+
* `complete` / `empty` getters. Interchangeable with a plain
|
|
1684
|
+
* `{ start, end }` object anywhere a `DateRange<D>` is expected.
|
|
1685
|
+
*/
|
|
1686
|
+
declare class TwDateRange<D> implements DateRange<D> {
|
|
1687
|
+
readonly start: D | null;
|
|
1688
|
+
readonly end: D | null;
|
|
1689
|
+
constructor(start: D | null, end: D | null);
|
|
1690
|
+
/** True when both endpoints are set. */
|
|
1691
|
+
get complete(): boolean;
|
|
1692
|
+
/** True when neither endpoint is set. */
|
|
1693
|
+
get empty(): boolean;
|
|
1694
|
+
}
|
|
1695
|
+
/** Shape accepted when writing a range value — either a `TwDateRange` or a plain object. */
|
|
1696
|
+
type TwDateRangeInput<D> = TwDateRange<D> | {
|
|
1697
|
+
readonly start: D | null;
|
|
1698
|
+
readonly end: D | null;
|
|
1699
|
+
} | null;
|
|
1700
|
+
/** @internal Normalises any range-shaped value into a `TwDateRange` instance. */
|
|
1701
|
+
declare function toTwDateRange<D>(value: TwDateRangeInput<D>): TwDateRange<D> | null;
|
|
1702
|
+
|
|
1703
|
+
export { CALENDAR_SELECTION_STRATEGY, CalendarCellComponent, CalendarComponent, CalendarHeaderComponent, CalendarIntl, CalendarMultipleDirective, CalendarPresetsDirective, CalendarRangeDirective, CalendarSelectionStrategy, CalendarSingleDirective, CalendarViewBase, DATE_ADAPTER, DATE_FORMATS, DATE_SERIALIZATION, DAYS_PER_WEEK, DateAdapter, MONTHS_PER_ROW, MonthViewComponent, MultiSelectionStrategy, NativeDateAdapter, RangeSelectionStrategy, SingleSelectionStrategy, TZ_OVERRIDE, TwDateRange, WEEKS_PER_MONTH, WeekSelectionStrategy, YEARS_PER_PAGE, YEARS_PER_ROW, YearViewComponent, YearsViewComponent, calendarRequiredValidator, calendarValidator, createCalendarCell, createDateRange, createGrid, de, emptyCalendarValue, es, fr, getFirstDayOfMonth, getMultiYearStartingYear, getWeekdayHeaders, isCalendarValueEmpty, isDateDisabled, isDateInRange, isMonthDisabled, isYearDisabled, ja, navigateGrid, provideCalendarIntl, provideCalendarSelectionStrategy, provideMultiSelectionStrategy, provideNativeDateAdapter, provideRangeSelectionStrategy, provideSingleSelectionStrategy, provideTwCalendar, provideWeekSelectionStrategy, pt, serializeCalendarValue, toTwDateRange, yearsPerPage };
|
|
1704
|
+
export type { CalendarCell, CalendarCellAccessibleNameContext, CalendarCellConfig, CalendarCellKeyNavEvent, CalendarCellState, CalendarConstraints, CalendarErrorCode, CalendarMode, CalendarMultipleValue, CalendarOverlayState, CalendarRangeValue, CalendarSelectionState, CalendarSingleValue, CalendarValidationErrors, CalendarValidatorContext, CalendarValue, CalendarViewState, DateClassFn, DateFilterFn, DateFormats, DateRange, DisabledDates, MaxSelectionBehavior, MobileMode, ModeChangeEvent, NameStyle, RangeClickBehavior, RangeGranularity, RangePreviewEvent, ResetBehavior, SelectionClearedEvent, SelectionCompleteEvent, SelectionResult, TwDateNameStyle, TwDateRangeInput, TwNativeDateFormat, ViewChangeEvent, WeekdayHeader };
|