forty-cdk 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/calendar/README.md +2 -2
- package/carousel/README.md +11 -6
- package/checkbox/README.md +17 -2
- package/fesm2022/forty-cdk-accordion.mjs +502 -378
- package/fesm2022/forty-cdk-accordion.mjs.map +1 -1
- package/fesm2022/forty-cdk-aspect-ratio.mjs +61 -69
- package/fesm2022/forty-cdk-aspect-ratio.mjs.map +1 -1
- package/fesm2022/forty-cdk-avatar.mjs +314 -350
- package/fesm2022/forty-cdk-avatar.mjs.map +1 -1
- package/fesm2022/forty-cdk-breadcrumbs.mjs +152 -119
- package/fesm2022/forty-cdk-breadcrumbs.mjs.map +1 -1
- package/fesm2022/forty-cdk-breakpoints.mjs +44 -80
- package/fesm2022/forty-cdk-breakpoints.mjs.map +1 -1
- package/fesm2022/forty-cdk-button.mjs +235 -337
- package/fesm2022/forty-cdk-button.mjs.map +1 -1
- package/fesm2022/forty-cdk-calendar.mjs +2087 -1950
- package/fesm2022/forty-cdk-calendar.mjs.map +1 -1
- package/fesm2022/forty-cdk-carousel.mjs +1246 -1031
- package/fesm2022/forty-cdk-carousel.mjs.map +1 -1
- package/fesm2022/forty-cdk-checkbox.mjs +233 -241
- package/fesm2022/forty-cdk-checkbox.mjs.map +1 -1
- package/fesm2022/forty-cdk-combobox.mjs +2862 -3190
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -1
- package/fesm2022/forty-cdk-context-menu.mjs +532 -530
- package/fesm2022/forty-cdk-context-menu.mjs.map +1 -1
- package/fesm2022/forty-cdk-core-overlay.mjs +3307 -5194
- package/fesm2022/forty-cdk-core-overlay.mjs.map +1 -1
- package/fesm2022/forty-cdk-core.mjs +4453 -8427
- package/fesm2022/forty-cdk-core.mjs.map +1 -1
- package/fesm2022/forty-cdk-date-adapter.mjs +129 -175
- package/fesm2022/forty-cdk-date-adapter.mjs.map +1 -1
- package/fesm2022/forty-cdk-date-field.mjs +1114 -1086
- package/fesm2022/forty-cdk-date-field.mjs.map +1 -1
- package/fesm2022/forty-cdk-date-picker.mjs +1390 -1548
- package/fesm2022/forty-cdk-date-picker.mjs.map +1 -1
- package/fesm2022/forty-cdk-defaults.mjs +537 -1359
- package/fesm2022/forty-cdk-defaults.mjs.map +1 -1
- package/fesm2022/forty-cdk-dialog.mjs +901 -694
- package/fesm2022/forty-cdk-dialog.mjs.map +1 -1
- package/fesm2022/forty-cdk-disclosure.mjs +254 -182
- package/fesm2022/forty-cdk-disclosure.mjs.map +1 -1
- package/fesm2022/forty-cdk-drag-drop.mjs +1776 -1768
- package/fesm2022/forty-cdk-drag-drop.mjs.map +1 -1
- package/fesm2022/forty-cdk-drawer.mjs +1835 -2105
- package/fesm2022/forty-cdk-drawer.mjs.map +1 -1
- package/fesm2022/forty-cdk-dropdown-menu.mjs +451 -375
- package/fesm2022/forty-cdk-dropdown-menu.mjs.map +1 -1
- package/fesm2022/forty-cdk-field.mjs +563 -669
- package/fesm2022/forty-cdk-field.mjs.map +1 -1
- package/fesm2022/forty-cdk-fieldset.mjs +162 -203
- package/fesm2022/forty-cdk-fieldset.mjs.map +1 -1
- package/fesm2022/forty-cdk-file-upload.mjs +383 -316
- package/fesm2022/forty-cdk-file-upload.mjs.map +1 -1
- package/fesm2022/forty-cdk-hover-card.mjs +600 -612
- package/fesm2022/forty-cdk-hover-card.mjs.map +1 -1
- package/fesm2022/forty-cdk-input.mjs +230 -277
- package/fesm2022/forty-cdk-input.mjs.map +1 -1
- package/fesm2022/forty-cdk-internationalized-date.mjs +183 -247
- package/fesm2022/forty-cdk-internationalized-date.mjs.map +1 -1
- package/fesm2022/forty-cdk-listbox.mjs +1486 -1586
- package/fesm2022/forty-cdk-listbox.mjs.map +1 -1
- package/fesm2022/forty-cdk-menu.mjs +1924 -1744
- package/fesm2022/forty-cdk-menu.mjs.map +1 -1
- package/fesm2022/forty-cdk-menubar.mjs +789 -910
- package/fesm2022/forty-cdk-menubar.mjs.map +1 -1
- package/fesm2022/forty-cdk-meter.mjs +312 -210
- package/fesm2022/forty-cdk-meter.mjs.map +1 -1
- package/fesm2022/forty-cdk-navigation-menu.mjs +1231 -1325
- package/fesm2022/forty-cdk-navigation-menu.mjs.map +1 -1
- package/fesm2022/forty-cdk-number-input.mjs +694 -843
- package/fesm2022/forty-cdk-number-input.mjs.map +1 -1
- package/fesm2022/forty-cdk-otp-input.mjs +554 -561
- package/fesm2022/forty-cdk-otp-input.mjs.map +1 -1
- package/fesm2022/forty-cdk-pagination.mjs +493 -362
- package/fesm2022/forty-cdk-pagination.mjs.map +1 -1
- package/fesm2022/forty-cdk-pane-resizer.mjs +470 -416
- package/fesm2022/forty-cdk-pane-resizer.mjs.map +1 -1
- package/fesm2022/forty-cdk-popover.mjs +846 -720
- package/fesm2022/forty-cdk-popover.mjs.map +1 -1
- package/fesm2022/forty-cdk-progress.mjs +265 -223
- package/fesm2022/forty-cdk-progress.mjs.map +1 -1
- package/fesm2022/forty-cdk-radio-group.mjs +468 -431
- package/fesm2022/forty-cdk-radio-group.mjs.map +1 -1
- package/fesm2022/forty-cdk-scroll-area.mjs +860 -934
- package/fesm2022/forty-cdk-scroll-area.mjs.map +1 -1
- package/fesm2022/forty-cdk-search.mjs +281 -328
- package/fesm2022/forty-cdk-search.mjs.map +1 -1
- package/fesm2022/forty-cdk-select.mjs +1872 -1874
- package/fesm2022/forty-cdk-select.mjs.map +1 -1
- package/fesm2022/forty-cdk-separator.mjs +92 -67
- package/fesm2022/forty-cdk-separator.mjs.map +1 -1
- package/fesm2022/forty-cdk-shared.mjs +4 -8
- package/fesm2022/forty-cdk-slider.mjs +881 -877
- package/fesm2022/forty-cdk-slider.mjs.map +1 -1
- package/fesm2022/forty-cdk-stepper.mjs +1160 -919
- package/fesm2022/forty-cdk-stepper.mjs.map +1 -1
- package/fesm2022/forty-cdk-switch.mjs +140 -146
- package/fesm2022/forty-cdk-switch.mjs.map +1 -1
- package/fesm2022/forty-cdk-table-virtualization.mjs +258 -375
- package/fesm2022/forty-cdk-table-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk-table.mjs +4718 -4851
- package/fesm2022/forty-cdk-table.mjs.map +1 -1
- package/fesm2022/forty-cdk-tabs.mjs +566 -403
- package/fesm2022/forty-cdk-tabs.mjs.map +1 -1
- package/fesm2022/forty-cdk-testing.mjs +233 -385
- package/fesm2022/forty-cdk-testing.mjs.map +1 -1
- package/fesm2022/forty-cdk-time-field.mjs +1148 -1143
- package/fesm2022/forty-cdk-time-field.mjs.map +1 -1
- package/fesm2022/forty-cdk-time-picker.mjs +1303 -1190
- package/fesm2022/forty-cdk-time-picker.mjs.map +1 -1
- package/fesm2022/forty-cdk-toast.mjs +1473 -1562
- package/fesm2022/forty-cdk-toast.mjs.map +1 -1
- package/fesm2022/forty-cdk-toggle.mjs +555 -536
- package/fesm2022/forty-cdk-toggle.mjs.map +1 -1
- package/fesm2022/forty-cdk-toolbar.mjs +503 -388
- package/fesm2022/forty-cdk-toolbar.mjs.map +1 -1
- package/fesm2022/forty-cdk-tooltip.mjs +602 -600
- package/fesm2022/forty-cdk-tooltip.mjs.map +1 -1
- package/fesm2022/forty-cdk-tree.mjs +2427 -2644
- package/fesm2022/forty-cdk-tree.mjs.map +1 -1
- package/fesm2022/forty-cdk-virtual-reorder.mjs +399 -487
- package/fesm2022/forty-cdk-virtual-reorder.mjs.map +1 -1
- package/fesm2022/forty-cdk-virtualization.mjs +552 -603
- package/fesm2022/forty-cdk-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk-visually-hidden.mjs +1 -6
- package/fesm2022/forty-cdk.mjs +0 -4
- package/input/README.md +1 -1
- package/navigation-menu/README.md +19 -9
- package/number-input/README.md +1 -1
- package/package.json +7 -6
- package/separator/README.md +4 -4
- package/shared/README.md +80 -1
- package/slider/README.md +19 -12
- package/table/README.md +22 -20
- package/table-virtualization/README.md +29 -7
- package/toast/README.md +2 -1
- package/toolbar/README.md +4 -4
- package/tree/README.md +44 -23
- package/types/forty-cdk-accordion.d.ts +210 -167
- package/types/forty-cdk-aspect-ratio.d.ts +23 -20
- package/types/forty-cdk-avatar.d.ts +73 -58
- package/types/forty-cdk-breadcrumbs.d.ts +43 -35
- package/types/forty-cdk-breakpoints.d.ts +42 -47
- package/types/forty-cdk-button.d.ts +47 -42
- package/types/forty-cdk-calendar.d.ts +712 -590
- package/types/forty-cdk-carousel.d.ts +497 -392
- package/types/forty-cdk-checkbox.d.ts +55 -46
- package/types/forty-cdk-combobox.d.ts +1254 -1059
- package/types/forty-cdk-context-menu.d.ts +322 -258
- package/types/forty-cdk-core-overlay.d.ts +2758 -2429
- package/types/forty-cdk-core.d.ts +2974 -2732
- package/types/forty-cdk-date-adapter.d.ts +195 -200
- package/types/forty-cdk-date-field.d.ts +472 -335
- package/types/forty-cdk-date-picker.d.ts +617 -475
- package/types/forty-cdk-defaults.d.ts +1495 -1251
- package/types/forty-cdk-dialog.d.ts +367 -338
- package/types/forty-cdk-disclosure.d.ts +78 -61
- package/types/forty-cdk-drag-drop.d.ts +570 -483
- package/types/forty-cdk-drawer.d.ts +711 -633
- package/types/forty-cdk-dropdown-menu.d.ts +236 -177
- package/types/forty-cdk-field.d.ts +194 -178
- package/types/forty-cdk-fieldset.d.ts +84 -83
- package/types/forty-cdk-file-upload.d.ts +152 -126
- package/types/forty-cdk-hover-card.d.ts +245 -210
- package/types/forty-cdk-input.d.ts +36 -36
- package/types/forty-cdk-internationalized-date.d.ts +81 -85
- package/types/forty-cdk-listbox.d.ts +570 -485
- package/types/forty-cdk-menu.d.ts +673 -543
- package/types/forty-cdk-menubar.d.ts +529 -462
- package/types/forty-cdk-meter.d.ts +130 -88
- package/types/forty-cdk-navigation-menu.d.ts +453 -379
- package/types/forty-cdk-number-input.d.ts +243 -199
- package/types/forty-cdk-otp-input.d.ts +194 -129
- package/types/forty-cdk-pagination.d.ts +239 -168
- package/types/forty-cdk-pane-resizer.d.ts +195 -133
- package/types/forty-cdk-popover.d.ts +381 -327
- package/types/forty-cdk-progress.d.ts +114 -87
- package/types/forty-cdk-radio-group.d.ts +189 -135
- package/types/forty-cdk-scroll-area.d.ts +329 -297
- package/types/forty-cdk-search.d.ts +103 -99
- package/types/forty-cdk-select.d.ts +874 -716
- package/types/forty-cdk-separator.d.ts +30 -22
- package/types/forty-cdk-shared.d.ts +4 -3
- package/types/forty-cdk-slider.d.ts +335 -278
- package/types/forty-cdk-stepper.d.ts +588 -505
- package/types/forty-cdk-switch.d.ts +26 -22
- package/types/forty-cdk-table-virtualization.d.ts +88 -70
- package/types/forty-cdk-table.d.ts +1970 -1356
- package/types/forty-cdk-tabs.d.ts +245 -191
- package/types/forty-cdk-testing.d.ts +38 -46
- package/types/forty-cdk-time-field.d.ts +508 -366
- package/types/forty-cdk-time-picker.d.ts +552 -432
- package/types/forty-cdk-toast.d.ts +643 -479
- package/types/forty-cdk-toggle.d.ts +212 -167
- package/types/forty-cdk-toolbar.d.ts +188 -142
- package/types/forty-cdk-tooltip.d.ts +301 -257
- package/types/forty-cdk-tree.d.ts +797 -650
- package/types/forty-cdk-virtual-reorder.d.ts +36 -27
- package/types/forty-cdk-virtualization.d.ts +295 -218
- package/types/forty-cdk-visually-hidden.d.ts +2 -1
- package/types/forty-cdk.d.ts +1 -2
- package/virtualization/README.md +20 -11
- package/fesm2022/forty-cdk-shared.mjs.map +0 -1
- package/fesm2022/forty-cdk-visually-hidden.mjs.map +0 -1
- package/fesm2022/forty-cdk.mjs.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { InjectionToken, Provider } from
|
|
3
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { InjectionToken, Provider } from "@angular/core";
|
|
4
3
|
/**
|
|
5
4
|
* Pluggable, date-library-agnostic seam for `ForCalendar`. Every internal
|
|
6
5
|
* algorithm (paging, the day matrix, comparison, formatting) goes through a
|
|
@@ -33,157 +32,157 @@ import { InjectionToken, Provider } from '@angular/core';
|
|
|
33
32
|
* @typeParam D The immutable date representation the adapter operates on.
|
|
34
33
|
*/
|
|
35
34
|
interface DateAdapter<D> {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Today's date in the runtime time zone.
|
|
37
|
+
*
|
|
38
|
+
* **SSR / hydration caveat.** The result depends on the runtime time zone, so
|
|
39
|
+
* a server render and a client hydration can disagree by up to a day near
|
|
40
|
+
* midnight — the server may compute a different calendar day than the
|
|
41
|
+
* browser. `ForCalendar` reads this on each render to mark the `data-today` /
|
|
42
|
+
* `aria-current="date"` cell, so a mismatch surfaces there as a hydration
|
|
43
|
+
* error and a flicker on the highlighted "today" cell.
|
|
44
|
+
*
|
|
45
|
+
* **SSR-safe pattern.** Have the consumer supply a fixed "today" (or pin a
|
|
46
|
+
* time zone) for the server render, or defer the today-highlight to
|
|
47
|
+
* `afterNextRender` so `today()` is only computed client-side. See the
|
|
48
|
+
* calendar README's "SSR / hydration" section.
|
|
49
|
+
*/
|
|
50
|
+
today(): D;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a date from its parts.
|
|
53
|
+
*
|
|
54
|
+
* @param year Full year (e.g. `2026`).
|
|
55
|
+
* @param month Month of year, **1-12**.
|
|
56
|
+
* @param day Day of month, **1-31** (constrained to the month's length).
|
|
57
|
+
*/
|
|
58
|
+
createDate(year: number, month: number, day: number): D;
|
|
59
|
+
/** The full year of `date` (e.g. `2026`). */
|
|
60
|
+
getYear(date: D): number;
|
|
61
|
+
/** The month of `date`, **1-12**. */
|
|
62
|
+
getMonth(date: D): number;
|
|
63
|
+
/** The day of month of `date`, **1-31**. */
|
|
64
|
+
getDate(date: D): number;
|
|
65
|
+
/** The day of week of `date`, **0-6** where `0` is Sunday and `6` is Saturday. */
|
|
66
|
+
getDayOfWeek(date: D): number;
|
|
67
|
+
/** The number of days in `date`'s month. */
|
|
68
|
+
getDaysInMonth(date: D): number;
|
|
69
|
+
/**
|
|
70
|
+
* The first day of the week as a **0-6** index (`0` = Sunday). Used as the
|
|
71
|
+
* default when `ForCalendar`'s `firstDayOfWeek` input is `null`. Adapters
|
|
72
|
+
* return a locale-independent default (`0`); consumers localise it through
|
|
73
|
+
* the `firstDayOfWeek` input or `provideForCalendarDefaults`.
|
|
74
|
+
*/
|
|
75
|
+
getFirstDayOfWeek(): number;
|
|
76
|
+
/** Returns a new date `n` days after `date` (negative goes backwards). */
|
|
77
|
+
addDays(date: D, n: number): D;
|
|
78
|
+
/**
|
|
79
|
+
* Returns a new date `n` months after `date` (negative goes backwards). The
|
|
80
|
+
* day of month is constrained to the target month's length (e.g. Jan 31 + 1
|
|
81
|
+
* month is Feb 28/29, never Mar 3).
|
|
82
|
+
*/
|
|
83
|
+
addMonths(date: D, n: number): D;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a new date `n` years after `date` (negative goes backwards). The
|
|
86
|
+
* day of month is constrained (e.g. Feb 29 + 1 year is Feb 28 in a common
|
|
87
|
+
* year).
|
|
88
|
+
*/
|
|
89
|
+
addYears(date: D, n: number): D;
|
|
90
|
+
/**
|
|
91
|
+
* Compares two dates by their natural ordering — **the full instant**,
|
|
92
|
+
* including any time component the adapter's `D` carries. Returns a negative
|
|
93
|
+
* number when `a` is before `b`, `0` when they are equal, and a positive
|
|
94
|
+
* number when `a` is after `b`.
|
|
95
|
+
*
|
|
96
|
+
* This is the canonical comparator and the only one an adapter must
|
|
97
|
+
* implement. Time-capable adapters (`Date`, `@internationalized/date`'s
|
|
98
|
+
* `CalendarDateTime`) order by day *and* time; day-only adapters
|
|
99
|
+
* (`CalendarDate`) order by day alone because that is all their `D` carries.
|
|
100
|
+
*
|
|
101
|
+
* **Bounds granularity.** `minDate` / `maxDate` clamping in the date
|
|
102
|
+
* primitives compares the full instant through `compare`, so a date-time
|
|
103
|
+
* `min`/`max` clamps identically on every time-capable adapter (e.g. native
|
|
104
|
+
* `Date` and `CalendarDateTime` produce the same result for the same input).
|
|
105
|
+
* For the *calendar grid*, where availability is day-granular so the boundary
|
|
106
|
+
* day of a date-time `min`/`max` stays selectable, the primitives compare
|
|
107
|
+
* calendar days instead, through {@link compareDate} when present and
|
|
108
|
+
* otherwise from the y/m/d getters.
|
|
109
|
+
*/
|
|
110
|
+
compare(a: D, b: D): number;
|
|
111
|
+
/**
|
|
112
|
+
* Optionally compares two dates by calendar day only, ignoring any time
|
|
113
|
+
* component. Returns a negative number when `a`'s day is before `b`'s, `0`
|
|
114
|
+
* when they fall on the same calendar day, and a positive number when `a`'s
|
|
115
|
+
* day is after `b`'s.
|
|
116
|
+
*
|
|
117
|
+
* Adapters may **omit** this method: the primitives then derive the
|
|
118
|
+
* day-only comparison from the {@link getYear} / {@link getMonth} /
|
|
119
|
+
* {@link getDate} getters, which is correct for any adapter. Implement it only
|
|
120
|
+
* to override that default (e.g. a bespoke day-granular ordering). This
|
|
121
|
+
* overrides day-only *ordering* only — it does not change the Gregorian month
|
|
122
|
+
* structure the grid assumes (see the *Calendar system* note on the interface).
|
|
123
|
+
* Day-only adapters whose {@link compare} already ignores time need not
|
|
124
|
+
* implement it.
|
|
125
|
+
*/
|
|
126
|
+
compareDate?(a: D, b: D): number;
|
|
127
|
+
/** Whether `a` and `b` fall on the same calendar day. */
|
|
128
|
+
isSameDay(a: D, b: D): boolean;
|
|
129
|
+
/** Whether `date` is a valid date of this adapter's type. */
|
|
130
|
+
isValid(date: D): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* The locale this adapter formats in, or `null` for the runtime default. A
|
|
133
|
+
* segmented date / time field with no `[locale]` of its own takes its segment
|
|
134
|
+
* order, separators, hour cycle and AM/PM names from it, so they match what
|
|
135
|
+
* {@link format} produces. Reading a signal here makes every field and
|
|
136
|
+
* formatted value follow a runtime language switch.
|
|
137
|
+
*/
|
|
138
|
+
locale?(): string | null;
|
|
139
|
+
/**
|
|
140
|
+
* Formats `date` for display. When `locale` is omitted the adapter's own
|
|
141
|
+
* {@link locale} is used, else the runtime's default locale; pass one to
|
|
142
|
+
* force a specific locale for month / weekday / day-period names.
|
|
143
|
+
*
|
|
144
|
+
* **SSR / hydration caveat.** With no `locale` the result resolves against the
|
|
145
|
+
* runtime's default locale, so a server render and a client hydration can
|
|
146
|
+
* produce different strings when the server and browser locales differ —
|
|
147
|
+
* surfacing as a hydration mismatch on every formatted value (heading, weekday
|
|
148
|
+
* headers, cell labels). The runtime time zone applies too for adapters that
|
|
149
|
+
* format through a wall-clock instant.
|
|
150
|
+
*
|
|
151
|
+
* **SSR-safe pattern.** Pin a `locale` (or format client-side) for the server
|
|
152
|
+
* render so both environments resolve the same locale. See the calendar
|
|
153
|
+
* README's "SSR / hydration" section.
|
|
154
|
+
*
|
|
155
|
+
* @param options Standard `Intl.DateTimeFormat` options (e.g.
|
|
156
|
+
* `{ month: 'long', year: 'numeric' }` for a calendar heading,
|
|
157
|
+
* `{ weekday: 'short' }` for a column header).
|
|
158
|
+
* @param locale Optional BCP 47 locale tag governing the formatted names;
|
|
159
|
+
* falls back to {@link locale}, then the runtime's default locale, when
|
|
160
|
+
* omitted.
|
|
161
|
+
*/
|
|
162
|
+
format(date: D, options: Intl.DateTimeFormatOptions, locale?: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* Whether this adapter's `D` can carry a wall-clock time component (hour /
|
|
165
|
+
* minute / second). Day-only adapters omit the optional time accessors below
|
|
166
|
+
* and return `false` (or omit this method); time-capable adapters implement
|
|
167
|
+
* them and return `true`. `ForTimeField` — and the time granularity of the
|
|
168
|
+
* date primitives — require a time-capable adapter.
|
|
169
|
+
*/
|
|
170
|
+
supportsTime?(): boolean;
|
|
171
|
+
/** The hour of `date`, **0-23** (24-hour clock). Time-capable adapters only. */
|
|
172
|
+
getHours?(date: D): number;
|
|
173
|
+
/** The minute of `date`, **0-59**. Time-capable adapters only. */
|
|
174
|
+
getMinutes?(date: D): number;
|
|
175
|
+
/** The second of `date`, **0-59**. Time-capable adapters only. */
|
|
176
|
+
getSeconds?(date: D): number;
|
|
177
|
+
/**
|
|
178
|
+
* Returns a new date with its time set to the given parts, preserving the
|
|
179
|
+
* calendar day. Time-capable adapters only.
|
|
180
|
+
*
|
|
181
|
+
* @param hours Hour of day, **0-23**.
|
|
182
|
+
* @param minutes Minute of hour, **0-59**.
|
|
183
|
+
* @param seconds Second of minute, **0-59**.
|
|
184
|
+
*/
|
|
185
|
+
setTime?(date: D, hours: number, minutes: number, seconds: number): D;
|
|
187
186
|
}
|
|
188
187
|
/**
|
|
189
188
|
* A {@link DateAdapter} narrowed to one that implements the optional time
|
|
@@ -199,8 +198,7 @@ type TimeCapableDateAdapter<D> = DateAdapter<D> & Required<Pick<DateAdapter<D>,
|
|
|
199
198
|
* There is no application-wide default — a calendar with no adapter in scope
|
|
200
199
|
* throws a descriptive error.
|
|
201
200
|
*/
|
|
202
|
-
declare const FOR_DATE_ADAPTER: InjectionToken<DateAdapter<unknown>>;
|
|
203
|
-
|
|
201
|
+
export declare const FOR_DATE_ADAPTER: InjectionToken<DateAdapter<unknown>>;
|
|
204
202
|
/**
|
|
205
203
|
* Creates a memoized `Intl.DateTimeFormat` factory shared by the date adapters.
|
|
206
204
|
*
|
|
@@ -220,8 +218,7 @@ declare const FOR_DATE_ADAPTER: InjectionToken<DateAdapter<unknown>>;
|
|
|
220
218
|
* @returns A function that returns the cached `Intl.DateTimeFormat` for the
|
|
221
219
|
* given `locale` (or the runtime default when omitted) and `options`.
|
|
222
220
|
*/
|
|
223
|
-
declare function createFormatterCache(): (locale: string | undefined, options: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
224
|
-
|
|
221
|
+
export declare function createFormatterCache(): (locale: string | undefined, options: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
|
|
225
222
|
/**
|
|
226
223
|
* Zero-dependency {@link DateAdapter} over the built-in `Date`. `today` and
|
|
227
224
|
* `createDate` produce days at local midnight, and the calendar grid stays
|
|
@@ -239,44 +236,44 @@ declare function createFormatterCache(): (locale: string | undefined, options: I
|
|
|
239
236
|
* `Date` and the `@internationalized/date` adapters operate on the Gregorian
|
|
240
237
|
* calendar; non-Gregorian calendar systems are not supported.
|
|
241
238
|
*/
|
|
242
|
-
declare class NativeDateAdapter implements DateAdapter<Date> {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
239
|
+
export declare class NativeDateAdapter implements DateAdapter<Date> {
|
|
240
|
+
#private;
|
|
241
|
+
/**
|
|
242
|
+
* Today at local midnight in the runtime time zone. Subject to the
|
|
243
|
+
* SSR/hydration caveat on {@link DateAdapter.today}.
|
|
244
|
+
*/
|
|
245
|
+
today(): Date;
|
|
246
|
+
createDate(year: number, month: number, day: number): Date;
|
|
247
|
+
getYear(date: Date): number;
|
|
248
|
+
getMonth(date: Date): number;
|
|
249
|
+
getDate(date: Date): number;
|
|
250
|
+
getDayOfWeek(date: Date): number;
|
|
251
|
+
getDaysInMonth(date: Date): number;
|
|
252
|
+
getFirstDayOfWeek(): number;
|
|
253
|
+
addDays(date: Date, n: number): Date;
|
|
254
|
+
addMonths(date: Date, n: number): Date;
|
|
255
|
+
addYears(date: Date, n: number): Date;
|
|
256
|
+
compare(a: Date, b: Date): number;
|
|
257
|
+
isSameDay(a: Date, b: Date): boolean;
|
|
258
|
+
isValid(date: Date): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The locale {@link format} falls back to, or `null` for the runtime default.
|
|
261
|
+
* Override it in a subclass to format, and lay out every date / time field,
|
|
262
|
+
* in the app's language.
|
|
263
|
+
*/
|
|
264
|
+
locale(): string | null;
|
|
265
|
+
/**
|
|
266
|
+
* Formats through `locale`, else {@link locale}, else the runtime's default
|
|
267
|
+
* locale. Subject to the SSR/hydration caveat on {@link DateAdapter.format}.
|
|
268
|
+
*/
|
|
269
|
+
format(date: Date, options: Intl.DateTimeFormatOptions, locale?: string): string;
|
|
270
|
+
supportsTime(): boolean;
|
|
271
|
+
getHours(date: Date): number;
|
|
272
|
+
getMinutes(date: Date): number;
|
|
273
|
+
getSeconds(date: Date): number;
|
|
274
|
+
setTime(date: Date, hours: number, minutes: number, seconds: number): Date;
|
|
275
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NativeDateAdapter, never>;
|
|
276
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
280
277
|
}
|
|
281
278
|
/**
|
|
282
279
|
* Provides the zero-dependency {@link NativeDateAdapter} as the active
|
|
@@ -290,7 +287,5 @@ declare class NativeDateAdapter implements DateAdapter<Date> {
|
|
|
290
287
|
* });
|
|
291
288
|
* ```
|
|
292
289
|
*/
|
|
293
|
-
declare function provideNativeDateAdapter(): Provider[];
|
|
294
|
-
|
|
295
|
-
export { FOR_DATE_ADAPTER, NativeDateAdapter, createFormatterCache, provideNativeDateAdapter };
|
|
296
|
-
export type { DateAdapter, TimeCapableDateAdapter };
|
|
290
|
+
export declare function provideNativeDateAdapter(): Provider[];
|
|
291
|
+
export type { DateAdapter, TimeCapableDateAdapter };
|