@ojiepermana/angular 22.1.14 → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/SUPPORT.md +3 -3
- package/chart/README.md +1 -1
- package/component/README.md +2 -2
- package/component/calendar/README.md +3 -15
- package/component/drawer/README.md +1 -2
- package/fesm2022/ojiepermana-angular-chart-area.mjs +352 -137
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +744 -524
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1140 -1344
- package/fesm2022/ojiepermana-angular-chart-line.mjs +393 -147
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +408 -179
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1262 -920
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +473 -205
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +425 -182
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +386 -210
- package/fesm2022/ojiepermana-angular-chart.mjs +3 -19
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +485 -243
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +963 -325
- package/fesm2022/ojiepermana-angular-component-alert.mjs +266 -103
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +80 -35
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +402 -135
- package/fesm2022/ojiepermana-angular-component-badge.mjs +109 -59
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +410 -142
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +249 -96
- package/fesm2022/ojiepermana-angular-component-button.mjs +153 -75
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +531 -418
- package/fesm2022/ojiepermana-angular-component-card.mjs +457 -171
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +642 -272
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +312 -108
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +299 -115
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +396 -183
- package/fesm2022/ojiepermana-angular-component-command.mjs +807 -347
- package/fesm2022/ojiepermana-angular-component-composer.mjs +807 -330
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +196 -161
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +650 -338
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +710 -316
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +2 -5
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +1212 -646
- package/fesm2022/ojiepermana-angular-component-editor.mjs +987 -502
- package/fesm2022/ojiepermana-angular-component-empty.mjs +350 -137
- package/fesm2022/ojiepermana-angular-component-form.mjs +813 -434
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +486 -277
- package/fesm2022/ojiepermana-angular-component-icon.mjs +241 -140
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +449 -176
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +891 -488
- package/fesm2022/ojiepermana-angular-component-input.mjs +86 -55
- package/fesm2022/ojiepermana-angular-component-item.mjs +713 -261
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +714 -216
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +124 -52
- package/fesm2022/ojiepermana-angular-component-label.mjs +82 -31
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +479 -329
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +167 -65
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +683 -380
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +277 -94
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +1283 -607
- package/fesm2022/ojiepermana-angular-component-popover.mjs +291 -204
- package/fesm2022/ojiepermana-angular-component-progress.mjs +176 -53
- package/fesm2022/ojiepermana-angular-component-radio.mjs +449 -142
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +659 -453
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +117 -39
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +351 -172
- package/fesm2022/ojiepermana-angular-component-select.mjs +475 -345
- package/fesm2022/ojiepermana-angular-component-separator.mjs +102 -35
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +797 -347
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +62 -29
- package/fesm2022/ojiepermana-angular-component-slider.mjs +592 -376
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +135 -38
- package/fesm2022/ojiepermana-angular-component-switch.mjs +315 -103
- package/fesm2022/ojiepermana-angular-component-table.mjs +440 -153
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +590 -317
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +85 -50
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +609 -231
- package/fesm2022/ojiepermana-angular-component-toast.mjs +229 -243
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +573 -288
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +187 -78
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +798 -517
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +159 -292
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +46 -58
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +76 -38
- package/fesm2022/ojiepermana-angular-component-utils.mjs +2 -8
- package/fesm2022/ojiepermana-angular-component.mjs +0 -10
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +13 -23
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +35 -24
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-BKCeWzml.mjs +129 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DFEJK2jD.mjs +811 -0
- package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-COQ-60DS.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-mpK9Ar08.mjs} +387 -183
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BPgH7FJk.mjs +650 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-DMpYcD9t.mjs +662 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-item.component-Basp5SIk.mjs +1228 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-list.component-YUzHI9Pj.mjs +311 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +542 -724
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +27 -56
- package/fesm2022/ojiepermana-angular-navigation.mjs +3052 -4
- package/fesm2022/ojiepermana-angular-sdk.mjs +91 -201
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1115 -737
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +245 -328
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +35 -38
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1719 -552
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +847 -496
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +288 -358
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +362 -224
- package/fesm2022/ojiepermana-angular-theme-page-overview.mjs +88 -0
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +576 -254
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +317 -177
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +256 -112
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -12
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +215 -326
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +68 -129
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +907 -378
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +521 -720
- package/fesm2022/ojiepermana-angular-theme.mjs +0 -10
- package/fesm2022/ojiepermana-angular.mjs +5 -24
- package/navigation/README.md +1 -1
- package/package.json +16 -12
- package/sdk/README.md +1 -1
- package/sdk/src/writer/index.js +2 -2
- package/theme/README.md +1 -1
- package/theme/layout/README.md +2 -4
- package/theme/page/README.md +50 -0
- package/theme/styles/README.md +10 -10
- package/theme/styles/css/base/prefers-dark.css +1 -1
- package/theme/styles/css/base/status.css +1 -1
- package/theme/styles/css/color/amber.css +1 -1
- package/theme/styles/css/color/blue.css +1 -1
- package/theme/styles/css/color/cyan.css +1 -1
- package/theme/styles/css/color/emerald.css +1 -1
- package/theme/styles/css/color/fuchsia.css +1 -1
- package/theme/styles/css/color/green.css +1 -1
- package/theme/styles/css/color/indigo.css +1 -1
- package/theme/styles/css/color/lime.css +1 -1
- package/theme/styles/css/color/orange.css +1 -1
- package/theme/styles/css/color/pink.css +1 -1
- package/theme/styles/css/color/purple.css +1 -1
- package/theme/styles/css/color/red.css +1 -1
- package/theme/styles/css/color/rose.css +1 -1
- package/theme/styles/css/color/sky.css +1 -1
- package/theme/styles/css/color/teal.css +1 -1
- package/theme/styles/css/color/violet.css +1 -1
- package/theme/styles/css/color/yellow.css +1 -1
- package/theme/styles/css/neutral/gray.css +1 -1
- package/theme/styles/css/neutral/mauve.css +1 -1
- package/theme/styles/css/neutral/mist.css +1 -1
- package/theme/styles/css/neutral/neutral.css +1 -1
- package/theme/styles/css/neutral/olive.css +1 -1
- package/theme/styles/css/neutral/slate.css +1 -1
- package/theme/styles/css/neutral/stone.css +1 -1
- package/theme/styles/css/neutral/taupe.css +1 -1
- package/theme/styles/css/neutral/zinc.css +1 -1
- package/types/ojiepermana-angular-chart-area.d.ts +126 -63
- package/types/ojiepermana-angular-chart-bar.d.ts +244 -154
- package/types/ojiepermana-angular-chart-core.d.ts +409 -398
- package/types/ojiepermana-angular-chart-line.d.ts +141 -68
- package/types/ojiepermana-angular-chart-pie.d.ts +192 -121
- package/types/ojiepermana-angular-chart-primitives.d.ts +283 -214
- package/types/ojiepermana-angular-chart-radar.d.ts +189 -108
- package/types/ojiepermana-angular-chart-radial.d.ts +177 -106
- package/types/ojiepermana-angular-chart-scatter.d.ts +166 -110
- package/types/ojiepermana-angular-chart.d.ts +3 -2
- package/types/ojiepermana-angular-component-accordion.d.ts +135 -81
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +271 -123
- package/types/ojiepermana-angular-component-alert.d.ts +69 -39
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +20 -12
- package/types/ojiepermana-angular-component-avatar.d.ts +103 -49
- package/types/ojiepermana-angular-component-badge.d.ts +36 -24
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +79 -40
- package/types/ojiepermana-angular-component-button-group.d.ts +48 -24
- package/types/ojiepermana-angular-component-button.d.ts +44 -27
- package/types/ojiepermana-angular-component-calendar.d.ts +145 -107
- package/types/ojiepermana-angular-component-card.d.ts +112 -63
- package/types/ojiepermana-angular-component-carousel.d.ts +150 -81
- package/types/ojiepermana-angular-component-checkbox.d.ts +96 -38
- package/types/ojiepermana-angular-component-collapsible.d.ts +65 -39
- package/types/ojiepermana-angular-component-combobox.d.ts +100 -55
- package/types/ojiepermana-angular-component-command.d.ts +206 -121
- package/types/ojiepermana-angular-component-composer.d.ts +184 -84
- package/types/ojiepermana-angular-component-context-menu.d.ts +51 -41
- package/types/ojiepermana-angular-component-date-picker.d.ts +199 -109
- package/types/ojiepermana-angular-component-dialog.d.ts +200 -105
- package/types/ojiepermana-angular-component-drawer.d.ts +2 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +324 -202
- package/types/ojiepermana-angular-component-editor.d.ts +215 -117
- package/types/ojiepermana-angular-component-empty.d.ts +80 -45
- package/types/ojiepermana-angular-component-form.d.ts +185 -121
- package/types/ojiepermana-angular-component-hover-card.d.ts +130 -72
- package/types/ojiepermana-angular-component-icon.d.ts +87 -57
- package/types/ojiepermana-angular-component-input-group.d.ts +93 -46
- package/types/ojiepermana-angular-component-input-otp.d.ts +243 -150
- package/types/ojiepermana-angular-component-input.d.ts +27 -17
- package/types/ojiepermana-angular-component-item.d.ts +160 -84
- package/types/ojiepermana-angular-component-kanban.d.ts +157 -62
- package/types/ojiepermana-angular-component-kbd.d.ts +24 -15
- package/types/ojiepermana-angular-component-label.d.ts +19 -11
- package/types/ojiepermana-angular-component-menubar.d.ts +120 -90
- package/types/ojiepermana-angular-component-native-select.d.ts +37 -24
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +157 -98
- package/types/ojiepermana-angular-component-pagination.d.ts +78 -28
- package/types/ojiepermana-angular-component-pillbox.d.ts +361 -204
- package/types/ojiepermana-angular-component-popover.d.ts +94 -64
- package/types/ojiepermana-angular-component-progress.d.ts +45 -17
- package/types/ojiepermana-angular-component-radio.d.ts +129 -53
- package/types/ojiepermana-angular-component-resizable.d.ts +160 -112
- package/types/ojiepermana-angular-component-scroll-area.d.ts +33 -15
- package/types/ojiepermana-angular-component-segmented-control.d.ts +94 -50
- package/types/ojiepermana-angular-component-select.d.ts +94 -77
- package/types/ojiepermana-angular-component-separator.d.ts +26 -14
- package/types/ojiepermana-angular-component-sheet.d.ts +226 -116
- package/types/ojiepermana-angular-component-skeleton.d.ts +13 -10
- package/types/ojiepermana-angular-component-slider.d.ts +140 -75
- package/types/ojiepermana-angular-component-spinner.d.ts +31 -13
- package/types/ojiepermana-angular-component-switch.d.ts +97 -40
- package/types/ojiepermana-angular-component-table.d.ts +102 -50
- package/types/ojiepermana-angular-component-tabs.d.ts +174 -115
- package/types/ojiepermana-angular-component-textarea.d.ts +27 -17
- package/types/ojiepermana-angular-component-timeline.d.ts +141 -59
- package/types/ojiepermana-angular-component-toast.d.ts +51 -55
- package/types/ojiepermana-angular-component-toggle-group.d.ts +159 -88
- package/types/ojiepermana-angular-component-toggle.d.ts +47 -25
- package/types/ojiepermana-angular-component-tooltip.d.ts +222 -132
- package/types/ojiepermana-angular-component-utils-core.d.ts +81 -90
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +7 -11
- package/types/ojiepermana-angular-component-utils-scale.d.ts +20 -12
- package/types/ojiepermana-angular-component-utils.d.ts +2 -2
- package/types/ojiepermana-angular-component.d.ts +1 -2
- package/types/ojiepermana-angular-navigation-core.d.ts +46 -50
- package/types/ojiepermana-angular-navigation-icon.d.ts +9 -12
- package/types/ojiepermana-angular-navigation-service.d.ts +112 -115
- package/types/ojiepermana-angular-navigation-types.d.ts +121 -125
- package/types/ojiepermana-angular-navigation.d.ts +663 -374
- package/types/ojiepermana-angular-sdk.d.ts +69 -71
- package/types/ojiepermana-angular-theme-component-settings.d.ts +115 -83
- package/types/ojiepermana-angular-theme-layout-services.d.ts +119 -124
- package/types/ojiepermana-angular-theme-layout-types.d.ts +27 -31
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +399 -187
- package/types/ojiepermana-angular-theme-layout.d.ts +201 -113
- package/types/ojiepermana-angular-theme-page-core.d.ts +136 -142
- package/types/ojiepermana-angular-theme-page-filter.d.ts +112 -62
- package/types/ojiepermana-angular-theme-page-overview.d.ts +28 -0
- package/types/ojiepermana-angular-theme-page-root.d.ts +172 -88
- package/types/ojiepermana-angular-theme-page-side.d.ts +89 -49
- package/types/ojiepermana-angular-theme-page-slots.d.ts +58 -37
- package/types/ojiepermana-angular-theme-page.d.ts +7 -5
- package/types/ojiepermana-angular-theme-shell-services.d.ts +119 -125
- package/types/ojiepermana-angular-theme-shell-types.d.ts +38 -41
- package/types/ojiepermana-angular-theme-shell.d.ts +139 -61
- package/types/ojiepermana-angular-theme-styles.d.ts +184 -196
- package/types/ojiepermana-angular-theme.d.ts +1 -2
- package/types/ojiepermana-angular.d.ts +5 -5
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-Be3IqzG4.mjs +0 -91
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-Bc7DWK3R.mjs +0 -522
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-DA8VPEn7.mjs +0 -404
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-U2TJTzlW.mjs +0 -466
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-CIUhmytH.mjs +0 -2668
|
@@ -1,432 +1,459 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { NG_VALUE_ACCESSOR } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, Injector, afterNextRender, booleanAttribute, computed, forwardRef, inject, input, linkedSignal, model, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
|
+
import { cn } from "@ojiepermana/angular/component/utils/core";
|
|
6
5
|
function cloneDate(date) {
|
|
7
|
-
|
|
6
|
+
return new Date(date.getTime());
|
|
8
7
|
}
|
|
9
8
|
function sameDay(left, right) {
|
|
10
|
-
|
|
11
|
-
left.getMonth() === right.getMonth() &&
|
|
12
|
-
left.getDate() === right.getDate());
|
|
9
|
+
return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
|
|
13
10
|
}
|
|
14
11
|
function startOfDay(date) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const next = cloneDate(date);
|
|
13
|
+
next.setHours(0, 0, 0, 0);
|
|
14
|
+
return next;
|
|
18
15
|
}
|
|
19
16
|
function startOfMonth(date) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const next = startOfDay(date);
|
|
18
|
+
next.setDate(1);
|
|
19
|
+
return next;
|
|
23
20
|
}
|
|
24
21
|
function endOfMonth(date) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const next = startOfMonth(date);
|
|
23
|
+
next.setMonth(next.getMonth() + 1);
|
|
24
|
+
next.setDate(0);
|
|
25
|
+
return next;
|
|
29
26
|
}
|
|
30
27
|
function startOfWeek(date) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const next = startOfDay(date);
|
|
29
|
+
next.setDate(next.getDate() - next.getDay());
|
|
30
|
+
return next;
|
|
34
31
|
}
|
|
35
32
|
function addDays(date, amount) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
const next = cloneDate(date);
|
|
34
|
+
next.setDate(next.getDate() + amount);
|
|
35
|
+
return next;
|
|
39
36
|
}
|
|
40
37
|
function addMonths(date, amount) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const next = cloneDate(date);
|
|
39
|
+
next.setDate(1);
|
|
40
|
+
next.setMonth(next.getMonth() + amount);
|
|
41
|
+
return next;
|
|
45
42
|
}
|
|
46
43
|
function addYears(date, amount) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
const next = cloneDate(date);
|
|
45
|
+
next.setFullYear(next.getFullYear() + amount);
|
|
46
|
+
return next;
|
|
50
47
|
}
|
|
51
48
|
function isDateSelectable(date, min, max, filter) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (max && time > startOfDay(max).getTime()) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return filter ? filter(date) : true;
|
|
49
|
+
const time = startOfDay(date).getTime();
|
|
50
|
+
if (min && time < startOfDay(min).getTime()) return false;
|
|
51
|
+
if (max && time > startOfDay(max).getTime()) return false;
|
|
52
|
+
return filter ? filter(date) : true;
|
|
60
53
|
}
|
|
61
54
|
function formatIsoDate(date) {
|
|
62
|
-
|
|
63
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
64
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
65
|
-
return `${year}-${month}-${day}`;
|
|
55
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
66
56
|
}
|
|
67
57
|
function parseIsoDate(text) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const date = new Date(year, month, day);
|
|
76
|
-
return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day
|
|
77
|
-
? date
|
|
78
|
-
: null;
|
|
58
|
+
const match = text.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
59
|
+
if (!match) return null;
|
|
60
|
+
const year = Number(match[1]);
|
|
61
|
+
const month = Number(match[2]) - 1;
|
|
62
|
+
const day = Number(match[3]);
|
|
63
|
+
const date = new Date(year, month, day);
|
|
64
|
+
return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day ? date : null;
|
|
79
65
|
}
|
|
80
66
|
function monthLabel(date) {
|
|
81
|
-
|
|
67
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
68
|
+
month: "long",
|
|
69
|
+
year: "numeric"
|
|
70
|
+
}).format(date);
|
|
82
71
|
}
|
|
83
72
|
function yearLabel(date) {
|
|
84
|
-
|
|
73
|
+
return String(date.getFullYear());
|
|
85
74
|
}
|
|
86
75
|
function yearRangeLabel(startYear, count) {
|
|
87
|
-
|
|
76
|
+
return `${startYear} - ${startYear + count - 1}`;
|
|
88
77
|
}
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
78
|
+
var CalendarComponent = class CalendarComponent {
|
|
79
|
+
injector = inject(Injector);
|
|
80
|
+
surface = viewChild.required("surface", ...ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []);
|
|
81
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
82
|
+
min = input(null, {
|
|
83
|
+
...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
|
|
84
|
+
transform: (value) => value ?? null
|
|
85
|
+
});
|
|
86
|
+
max = input(null, {
|
|
87
|
+
...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
|
|
88
|
+
transform: (value) => value ?? null
|
|
89
|
+
});
|
|
90
|
+
startAt = input(null, ...ngDevMode ? [{ debugName: "startAt" }] : /* istanbul ignore next */ []);
|
|
91
|
+
startView = input("month", ...ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []);
|
|
92
|
+
dateFilter = input(null, ...ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []);
|
|
93
|
+
disabled = input(false, {
|
|
94
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
95
|
+
transform: booleanAttribute
|
|
96
|
+
});
|
|
97
|
+
class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
|
|
98
|
+
cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
99
|
+
onChangeFn = () => {};
|
|
100
|
+
onTouchedFn = () => {};
|
|
101
|
+
focusDate = linkedSignal(() => cloneDate(this.value() ?? this.startAt() ?? /* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "focusDate" }] : /* istanbul ignore next */ []);
|
|
102
|
+
activeView = linkedSignal(() => this.startView(), ...ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []);
|
|
103
|
+
classes = computed(() => cn("calendar block w-fit", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
104
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
105
|
+
sameDay = sameDay;
|
|
106
|
+
cloneDate = cloneDate;
|
|
107
|
+
weekdayLabels = computed(() => this.buildWeekdayLabels(), ...ngDevMode ? [{ debugName: "weekdayLabels" }] : /* istanbul ignore next */ []);
|
|
108
|
+
monthCells = computed(() => this.buildMonthCells(), ...ngDevMode ? [{ debugName: "monthCells" }] : /* istanbul ignore next */ []);
|
|
109
|
+
monthTabStopKey = computed(() => {
|
|
110
|
+
const cells = this.monthCells();
|
|
111
|
+
return cells.find((cell) => sameDay(cell.date, this.focusDate()) && !cell.disabled)?.key ?? cells.find((cell) => !cell.disabled)?.key ?? null;
|
|
112
|
+
}, ...ngDevMode ? [{ debugName: "monthTabStopKey" }] : /* istanbul ignore next */ []);
|
|
113
|
+
monthWeeks = computed(() => {
|
|
114
|
+
const cells = this.monthCells();
|
|
115
|
+
return Array.from({ length: cells.length / 7 }, (_, index) => cells.slice(index * 7, index * 7 + 7));
|
|
116
|
+
}, ...ngDevMode ? [{ debugName: "monthWeeks" }] : /* istanbul ignore next */ []);
|
|
117
|
+
yearTabStop = computed(() => {
|
|
118
|
+
const months = this.yearMonths();
|
|
119
|
+
const focusedMonth = this.focusDate().getMonth();
|
|
120
|
+
return months.find((month) => month.monthIndex === focusedMonth && !month.disabled)?.monthIndex ?? months.find((month) => !month.disabled)?.monthIndex ?? -1;
|
|
121
|
+
}, ...ngDevMode ? [{ debugName: "yearTabStop" }] : /* istanbul ignore next */ []);
|
|
122
|
+
multiYearTabStop = computed(() => {
|
|
123
|
+
const years = this.multiYearCells();
|
|
124
|
+
const focusedYear = this.focusDate().getFullYear();
|
|
125
|
+
return years.find((year) => year.year === focusedYear && !year.disabled)?.year ?? years.find((year) => !year.disabled)?.year ?? -1;
|
|
126
|
+
}, ...ngDevMode ? [{ debugName: "multiYearTabStop" }] : /* istanbul ignore next */ []);
|
|
127
|
+
dateLabel = (date) => new Intl.DateTimeFormat(void 0, { dateStyle: "long" }).format(date);
|
|
128
|
+
headerLabel = computed(() => {
|
|
129
|
+
const focus = this.focusDate();
|
|
130
|
+
switch (this.activeView()) {
|
|
131
|
+
case "year": return String(focus.getFullYear());
|
|
132
|
+
case "multi-year": return yearRangeLabel(Math.floor(focus.getFullYear() / 20) * 20, 20);
|
|
133
|
+
default: return monthLabel(focus);
|
|
134
|
+
}
|
|
135
|
+
}, ...ngDevMode ? [{ debugName: "headerLabel" }] : /* istanbul ignore next */ []);
|
|
136
|
+
yearMonths() {
|
|
137
|
+
const focus = this.focusDate();
|
|
138
|
+
const selectedMonth = this.value()?.getMonth() ?? focus.getMonth();
|
|
139
|
+
const selectedYear = this.value()?.getFullYear() ?? focus.getFullYear();
|
|
140
|
+
return Array.from({ length: 12 }, (_, monthIndex) => {
|
|
141
|
+
const candidate = new Date(focus.getFullYear(), monthIndex, 1);
|
|
142
|
+
return {
|
|
143
|
+
key: `${candidate.getFullYear()}-${monthIndex}`,
|
|
144
|
+
label: new Intl.DateTimeFormat(void 0, { month: "short" }).format(candidate),
|
|
145
|
+
monthIndex,
|
|
146
|
+
selected: monthIndex === selectedMonth && focus.getFullYear() === selectedYear,
|
|
147
|
+
disabled: !this.isMonthSelectable(candidate)
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
multiYearCells() {
|
|
152
|
+
const focusYear = this.focusDate().getFullYear();
|
|
153
|
+
const baseYear = Math.floor(focusYear / 20) * 20;
|
|
154
|
+
const selectedYear = this.value()?.getFullYear() ?? focusYear;
|
|
155
|
+
return Array.from({ length: 20 }, (_, index) => {
|
|
156
|
+
const year = baseYear + index;
|
|
157
|
+
const candidate = new Date(year, 0, 1);
|
|
158
|
+
return {
|
|
159
|
+
key: String(year),
|
|
160
|
+
year,
|
|
161
|
+
selected: year === selectedYear,
|
|
162
|
+
disabled: !this.isYearSelectable(candidate)
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
toggleView() {
|
|
167
|
+
switch (this.activeView()) {
|
|
168
|
+
case "month":
|
|
169
|
+
this.activeView.set("year");
|
|
170
|
+
break;
|
|
171
|
+
case "year":
|
|
172
|
+
this.activeView.set("multi-year");
|
|
173
|
+
break;
|
|
174
|
+
default: this.activeView.set("multi-year");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
previous() {
|
|
178
|
+
const focus = this.focusDate();
|
|
179
|
+
switch (this.activeView()) {
|
|
180
|
+
case "year":
|
|
181
|
+
this.focusDate.set(addYears(focus, -1));
|
|
182
|
+
break;
|
|
183
|
+
case "multi-year":
|
|
184
|
+
this.focusDate.set(addYears(focus, -20));
|
|
185
|
+
break;
|
|
186
|
+
default: this.focusDate.set(addMonths(focus, -1));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
next() {
|
|
190
|
+
const focus = this.focusDate();
|
|
191
|
+
switch (this.activeView()) {
|
|
192
|
+
case "year":
|
|
193
|
+
this.focusDate.set(addYears(focus, 1));
|
|
194
|
+
break;
|
|
195
|
+
case "multi-year":
|
|
196
|
+
this.focusDate.set(addYears(focus, 20));
|
|
197
|
+
break;
|
|
198
|
+
default: this.focusDate.set(addMonths(focus, 1));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
chooseMonth(monthIndex) {
|
|
202
|
+
const next = new Date(this.focusDate().getFullYear(), monthIndex, 1);
|
|
203
|
+
this.focusDate.set(next);
|
|
204
|
+
this.activeView.set("month");
|
|
205
|
+
}
|
|
206
|
+
chooseYear(year) {
|
|
207
|
+
this.focusDate.set(new Date(year, 0, 1));
|
|
208
|
+
this.activeView.set("year");
|
|
209
|
+
}
|
|
210
|
+
focusMonth(monthIndex) {
|
|
211
|
+
const current = this.focusDate();
|
|
212
|
+
this.focusDate.set(new Date(current.getFullYear(), monthIndex, 1));
|
|
213
|
+
}
|
|
214
|
+
focusYear(year) {
|
|
215
|
+
const current = this.focusDate();
|
|
216
|
+
this.focusDate.set(new Date(year, current.getMonth(), 1));
|
|
217
|
+
}
|
|
218
|
+
selectDate(date) {
|
|
219
|
+
if (this.isDisabled() || !this.isDateSelectable(date)) return;
|
|
220
|
+
const next = cloneDate(date);
|
|
221
|
+
this.value.set(next);
|
|
222
|
+
this.focusDate.set(next);
|
|
223
|
+
this.onChangeFn(next);
|
|
224
|
+
this.onTouchedFn();
|
|
225
|
+
}
|
|
226
|
+
onMonthKeydown(event) {
|
|
227
|
+
if (this.isDisabled()) return;
|
|
228
|
+
let next = null;
|
|
229
|
+
switch (event.key) {
|
|
230
|
+
case "ArrowLeft":
|
|
231
|
+
next = addDays(this.focusDate(), -1);
|
|
232
|
+
break;
|
|
233
|
+
case "ArrowRight":
|
|
234
|
+
next = addDays(this.focusDate(), 1);
|
|
235
|
+
break;
|
|
236
|
+
case "ArrowUp":
|
|
237
|
+
next = addDays(this.focusDate(), -7);
|
|
238
|
+
break;
|
|
239
|
+
case "ArrowDown":
|
|
240
|
+
next = addDays(this.focusDate(), 7);
|
|
241
|
+
break;
|
|
242
|
+
case "Home":
|
|
243
|
+
next = startOfWeek(this.focusDate());
|
|
244
|
+
break;
|
|
245
|
+
case "End":
|
|
246
|
+
next = addDays(startOfWeek(this.focusDate()), 6);
|
|
247
|
+
break;
|
|
248
|
+
case "PageUp":
|
|
249
|
+
next = event.shiftKey ? addYears(this.focusDate(), -1) : addMonths(this.focusDate(), -1);
|
|
250
|
+
break;
|
|
251
|
+
case "PageDown":
|
|
252
|
+
next = event.shiftKey ? addYears(this.focusDate(), 1) : addMonths(this.focusDate(), 1);
|
|
253
|
+
break;
|
|
254
|
+
case "Enter":
|
|
255
|
+
case " ":
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
this.selectDate(this.focusDate());
|
|
258
|
+
return;
|
|
259
|
+
default: return;
|
|
260
|
+
}
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
if (next) {
|
|
263
|
+
this.focusDate.set(next);
|
|
264
|
+
afterNextRender({ read: () => this.focusDateCell(next) }, { injector: this.injector });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
onPeriodKeydown(event, columns) {
|
|
268
|
+
if (this.isDisabled()) return;
|
|
269
|
+
const cells = Array.from(event.currentTarget.querySelectorAll("button[role=\"gridcell\"]:not(:disabled)"));
|
|
270
|
+
const currentIndex = cells.indexOf(event.target);
|
|
271
|
+
if (currentIndex < 0) return;
|
|
272
|
+
let targetIndex = currentIndex;
|
|
273
|
+
switch (event.key) {
|
|
274
|
+
case "ArrowLeft":
|
|
275
|
+
targetIndex -= 1;
|
|
276
|
+
break;
|
|
277
|
+
case "ArrowRight":
|
|
278
|
+
targetIndex += 1;
|
|
279
|
+
break;
|
|
280
|
+
case "ArrowUp":
|
|
281
|
+
targetIndex -= columns;
|
|
282
|
+
break;
|
|
283
|
+
case "ArrowDown":
|
|
284
|
+
targetIndex += columns;
|
|
285
|
+
break;
|
|
286
|
+
case "Home":
|
|
287
|
+
targetIndex = 0;
|
|
288
|
+
break;
|
|
289
|
+
case "End":
|
|
290
|
+
targetIndex = cells.length - 1;
|
|
291
|
+
break;
|
|
292
|
+
case "Enter":
|
|
293
|
+
case " ":
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
event.target.click();
|
|
296
|
+
return;
|
|
297
|
+
default: return;
|
|
298
|
+
}
|
|
299
|
+
event.preventDefault();
|
|
300
|
+
cells[Math.max(0, Math.min(cells.length - 1, targetIndex))]?.focus();
|
|
301
|
+
}
|
|
302
|
+
focusActiveCell() {
|
|
303
|
+
const selector = this.activeView() === "month" ? "[data-date][tabindex=\"0\"]" : this.activeView() === "year" ? "[data-month][tabindex=\"0\"]" : "[data-year][tabindex=\"0\"]";
|
|
304
|
+
this.surface().nativeElement.querySelector(selector)?.focus();
|
|
305
|
+
}
|
|
306
|
+
onFocusOut(event) {
|
|
307
|
+
const next = event.relatedTarget;
|
|
308
|
+
if (next instanceof Node && this.surface().nativeElement.contains(next)) return;
|
|
309
|
+
this.onTouchedFn();
|
|
310
|
+
}
|
|
311
|
+
writeValue(value) {
|
|
312
|
+
this.value.set(value ? cloneDate(value) : null);
|
|
313
|
+
}
|
|
314
|
+
registerOnChange(fn) {
|
|
315
|
+
this.onChangeFn = fn;
|
|
316
|
+
}
|
|
317
|
+
registerOnTouched(fn) {
|
|
318
|
+
this.onTouchedFn = fn;
|
|
319
|
+
}
|
|
320
|
+
setDisabledState(state) {
|
|
321
|
+
this.cvaDisabled.set(state);
|
|
322
|
+
}
|
|
323
|
+
buildWeekdayLabels() {
|
|
324
|
+
const start = startOfWeek(new Date(2024, 0, 7));
|
|
325
|
+
return Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(void 0, { weekday: "short" }).format(addDays(start, index)));
|
|
326
|
+
}
|
|
327
|
+
buildMonthCells() {
|
|
328
|
+
const focus = this.focusDate();
|
|
329
|
+
const start = startOfWeek(startOfMonth(focus));
|
|
330
|
+
const selected = this.value();
|
|
331
|
+
const now = /* @__PURE__ */ new Date();
|
|
332
|
+
return Array.from({ length: 42 }, (_, index) => {
|
|
333
|
+
const date = addDays(start, index);
|
|
334
|
+
return {
|
|
335
|
+
date,
|
|
336
|
+
key: formatIsoDate(date),
|
|
337
|
+
inMonth: date.getMonth() === focus.getMonth(),
|
|
338
|
+
disabled: !this.isDateSelectable(date),
|
|
339
|
+
selected: !!selected && sameDay(date, selected),
|
|
340
|
+
today: sameDay(date, now)
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
isDateSelectable(date) {
|
|
345
|
+
return isDateSelectable(date, this.min(), this.max(), this.dateFilter());
|
|
346
|
+
}
|
|
347
|
+
isMonthSelectable(date) {
|
|
348
|
+
return this.hasSelectableDay(startOfMonth(date), new Date(date.getFullYear(), date.getMonth() + 1, 0));
|
|
349
|
+
}
|
|
350
|
+
isYearSelectable(date) {
|
|
351
|
+
return this.hasSelectableDay(new Date(date.getFullYear(), 0, 1), new Date(date.getFullYear(), 11, 31));
|
|
352
|
+
}
|
|
353
|
+
hasSelectableDay(start, end) {
|
|
354
|
+
const last = startOfDay(end).getTime();
|
|
355
|
+
for (let day = startOfDay(start); day.getTime() <= last; day = addDays(day, 1)) if (this.isDateSelectable(day)) return true;
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
focusDateCell(date) {
|
|
359
|
+
const key = formatIsoDate(date);
|
|
360
|
+
this.surface().nativeElement.querySelector(`[data-date="${key}"]`)?.focus();
|
|
361
|
+
}
|
|
362
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
363
|
+
minVersion: "12.0.0",
|
|
364
|
+
version: "22.2.0",
|
|
365
|
+
ngImport: i0,
|
|
366
|
+
type: CalendarComponent,
|
|
367
|
+
deps: [],
|
|
368
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
369
|
+
});
|
|
370
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
371
|
+
minVersion: "17.0.0",
|
|
372
|
+
version: "22.2.0",
|
|
373
|
+
type: CalendarComponent,
|
|
374
|
+
isStandalone: true,
|
|
375
|
+
selector: "Calendar",
|
|
376
|
+
inputs: {
|
|
377
|
+
value: {
|
|
378
|
+
classPropertyName: "value",
|
|
379
|
+
publicName: "value",
|
|
380
|
+
isSignal: true,
|
|
381
|
+
isRequired: false,
|
|
382
|
+
transformFunction: null
|
|
383
|
+
},
|
|
384
|
+
min: {
|
|
385
|
+
classPropertyName: "min",
|
|
386
|
+
publicName: "min",
|
|
387
|
+
isSignal: true,
|
|
388
|
+
isRequired: false,
|
|
389
|
+
transformFunction: null
|
|
390
|
+
},
|
|
391
|
+
max: {
|
|
392
|
+
classPropertyName: "max",
|
|
393
|
+
publicName: "max",
|
|
394
|
+
isSignal: true,
|
|
395
|
+
isRequired: false,
|
|
396
|
+
transformFunction: null
|
|
397
|
+
},
|
|
398
|
+
startAt: {
|
|
399
|
+
classPropertyName: "startAt",
|
|
400
|
+
publicName: "startAt",
|
|
401
|
+
isSignal: true,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
transformFunction: null
|
|
404
|
+
},
|
|
405
|
+
startView: {
|
|
406
|
+
classPropertyName: "startView",
|
|
407
|
+
publicName: "startView",
|
|
408
|
+
isSignal: true,
|
|
409
|
+
isRequired: false,
|
|
410
|
+
transformFunction: null
|
|
411
|
+
},
|
|
412
|
+
dateFilter: {
|
|
413
|
+
classPropertyName: "dateFilter",
|
|
414
|
+
publicName: "dateFilter",
|
|
415
|
+
isSignal: true,
|
|
416
|
+
isRequired: false,
|
|
417
|
+
transformFunction: null
|
|
418
|
+
},
|
|
419
|
+
disabled: {
|
|
420
|
+
classPropertyName: "disabled",
|
|
421
|
+
publicName: "disabled",
|
|
422
|
+
isSignal: true,
|
|
423
|
+
isRequired: false,
|
|
424
|
+
transformFunction: null
|
|
425
|
+
},
|
|
426
|
+
class: {
|
|
427
|
+
classPropertyName: "class",
|
|
428
|
+
publicName: "class",
|
|
429
|
+
isSignal: true,
|
|
430
|
+
isRequired: false,
|
|
431
|
+
transformFunction: null
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
outputs: { value: "valueChange" },
|
|
435
|
+
host: {
|
|
436
|
+
listeners: { "focusout": "onFocusOut($event)" },
|
|
437
|
+
properties: {
|
|
438
|
+
"class": "classes()",
|
|
439
|
+
"attr.aria-disabled": "isDisabled() ? \"true\" : null",
|
|
440
|
+
"attr.inert": "isDisabled() ? \"\" : null"
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
providers: [{
|
|
444
|
+
provide: NG_VALUE_ACCESSOR,
|
|
445
|
+
useExisting: forwardRef(() => CalendarComponent),
|
|
446
|
+
multi: true
|
|
447
|
+
}],
|
|
448
|
+
viewQueries: [{
|
|
449
|
+
propertyName: "surface",
|
|
450
|
+
first: true,
|
|
451
|
+
predicate: ["surface"],
|
|
452
|
+
descendants: true,
|
|
453
|
+
isSignal: true
|
|
454
|
+
}],
|
|
455
|
+
ngImport: i0,
|
|
456
|
+
template: `
|
|
430
457
|
<div #surface class="calendar-surface">
|
|
431
458
|
<div class="calendar-header">
|
|
432
459
|
<button
|
|
@@ -564,17 +591,32 @@ class CalendarComponent {
|
|
|
564
591
|
}
|
|
565
592
|
}
|
|
566
593
|
</div>
|
|
567
|
-
`,
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
594
|
+
`,
|
|
595
|
+
isInline: true,
|
|
596
|
+
styles: [":host{display:block;width:fit-content;min-width:calc(var(--spacing-base) * 70);padding:calc(var(--spacing-base) * 3);border:1px solid hsl(var(--border));border-radius:var(--radius);background:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);font-size:var(--text-sm)}.calendar-surface{display:grid;gap:calc(var(--spacing-base) * 2);width:100%}.calendar-header{display:grid;grid-template-columns:2.25rem minmax(0,1fr) 2.25rem;align-items:center;gap:var(--spacing-base)}button{border:0;background:transparent;color:inherit;font:inherit}.calendar-nav,.calendar-title,.calendar-cell{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(var(--radius) - .125rem);cursor:pointer;transition:background-color .15s ease,color .15s ease}.calendar-nav{width:var(--control-height-md);height:var(--control-height-md);color:hsl(var(--muted-foreground));font-size:1.5rem;line-height:1}.calendar-title{min-height:var(--control-height-md);padding:0 calc(var(--spacing-base) * 2);font-weight:600}.calendar-nav:hover:not(:disabled),.calendar-title:hover:not(:disabled),.calendar-cell:hover:not(:disabled){background:hsl(var(--accent));color:hsl(var(--accent-foreground))}.calendar-nav:focus-visible,.calendar-title:focus-visible,.calendar-cell:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:2px}.calendar-nav:disabled,.calendar-title:disabled,.calendar-cell:disabled{cursor:not-allowed;opacity:.45}.calendar-grid-month{display:grid;gap:var(--spacing-base)}.calendar-weekdays,.calendar-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:calc(var(--spacing-base) * .5)}.calendar-days{display:grid;gap:calc(var(--spacing-base) * .5)}.calendar-weekday{display:grid;place-items:center;min-height:calc(var(--spacing-base) * 7.5);color:hsl(var(--muted-foreground));font-size:.75rem;font-weight:500}.calendar-cell{min-width:var(--control-height-md);min-height:var(--control-height-md);padding:var(--spacing-base)}.calendar-cell.is-outside-month{color:hsl(var(--muted-foreground));opacity:1}.calendar-cell.is-today:not(.is-selected){box-shadow:inset 0 0 0 1px hsl(var(--primary));font-weight:600}.calendar-cell.is-selected{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600}.calendar-cell.is-selected:hover:not(:disabled){background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.calendar-grid-year,.calendar-grid-years{display:grid;gap:var(--spacing-base)}.calendar-grid-year{grid-template-columns:repeat(3,minmax(0,1fr))}.calendar-grid-years{grid-template-columns:repeat(4,minmax(0,1fr))}.calendar-month,.calendar-year{min-width:0}\n"]
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
600
|
+
minVersion: "12.0.0",
|
|
601
|
+
version: "22.2.0",
|
|
602
|
+
ngImport: i0,
|
|
603
|
+
type: CalendarComponent,
|
|
604
|
+
decorators: [{
|
|
605
|
+
type: Component,
|
|
606
|
+
args: [{
|
|
607
|
+
selector: "Calendar",
|
|
608
|
+
providers: [{
|
|
609
|
+
provide: NG_VALUE_ACCESSOR,
|
|
610
|
+
useExisting: forwardRef(() => CalendarComponent),
|
|
611
|
+
multi: true
|
|
612
|
+
}],
|
|
613
|
+
host: {
|
|
614
|
+
"[class]": "classes()",
|
|
615
|
+
"[attr.aria-disabled]": "isDisabled() ? \"true\" : null",
|
|
616
|
+
"[attr.inert]": "isDisabled() ? \"\" : null",
|
|
617
|
+
"(focusout)": "onFocusOut($event)"
|
|
618
|
+
},
|
|
619
|
+
template: `
|
|
578
620
|
<div #surface class="calendar-surface">
|
|
579
621
|
<div class="calendar-header">
|
|
580
622
|
<button
|
|
@@ -712,11 +754,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
712
754
|
}
|
|
713
755
|
}
|
|
714
756
|
</div>
|
|
715
|
-
`,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
757
|
+
`,
|
|
758
|
+
styles: [":host{display:block;width:fit-content;min-width:calc(var(--spacing-base) * 70);padding:calc(var(--spacing-base) * 3);border:1px solid hsl(var(--border));border-radius:var(--radius);background:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);font-size:var(--text-sm)}.calendar-surface{display:grid;gap:calc(var(--spacing-base) * 2);width:100%}.calendar-header{display:grid;grid-template-columns:2.25rem minmax(0,1fr) 2.25rem;align-items:center;gap:var(--spacing-base)}button{border:0;background:transparent;color:inherit;font:inherit}.calendar-nav,.calendar-title,.calendar-cell{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(var(--radius) - .125rem);cursor:pointer;transition:background-color .15s ease,color .15s ease}.calendar-nav{width:var(--control-height-md);height:var(--control-height-md);color:hsl(var(--muted-foreground));font-size:1.5rem;line-height:1}.calendar-title{min-height:var(--control-height-md);padding:0 calc(var(--spacing-base) * 2);font-weight:600}.calendar-nav:hover:not(:disabled),.calendar-title:hover:not(:disabled),.calendar-cell:hover:not(:disabled){background:hsl(var(--accent));color:hsl(var(--accent-foreground))}.calendar-nav:focus-visible,.calendar-title:focus-visible,.calendar-cell:focus-visible{outline:2px solid hsl(var(--ring));outline-offset:2px}.calendar-nav:disabled,.calendar-title:disabled,.calendar-cell:disabled{cursor:not-allowed;opacity:.45}.calendar-grid-month{display:grid;gap:var(--spacing-base)}.calendar-weekdays,.calendar-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:calc(var(--spacing-base) * .5)}.calendar-days{display:grid;gap:calc(var(--spacing-base) * .5)}.calendar-weekday{display:grid;place-items:center;min-height:calc(var(--spacing-base) * 7.5);color:hsl(var(--muted-foreground));font-size:.75rem;font-weight:500}.calendar-cell{min-width:var(--control-height-md);min-height:var(--control-height-md);padding:var(--spacing-base)}.calendar-cell.is-outside-month{color:hsl(var(--muted-foreground));opacity:1}.calendar-cell.is-today:not(.is-selected){box-shadow:inset 0 0 0 1px hsl(var(--primary));font-weight:600}.calendar-cell.is-selected{background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600}.calendar-cell.is-selected:hover:not(:disabled){background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.calendar-grid-year,.calendar-grid-years{display:grid;gap:var(--spacing-base)}.calendar-grid-year{grid-template-columns:repeat(3,minmax(0,1fr))}.calendar-grid-years{grid-template-columns:repeat(4,minmax(0,1fr))}.calendar-month,.calendar-year{min-width:0}\n"]
|
|
759
|
+
}]
|
|
760
|
+
}],
|
|
761
|
+
propDecorators: {
|
|
762
|
+
surface: [{
|
|
763
|
+
type: i0.ViewChild,
|
|
764
|
+
args: ["surface", { isSignal: true }]
|
|
765
|
+
}],
|
|
766
|
+
value: [{
|
|
767
|
+
type: i0.Input,
|
|
768
|
+
args: [{
|
|
769
|
+
isSignal: true,
|
|
770
|
+
alias: "value",
|
|
771
|
+
required: false
|
|
772
|
+
}]
|
|
773
|
+
}, {
|
|
774
|
+
type: i0.Output,
|
|
775
|
+
args: ["valueChange"]
|
|
776
|
+
}],
|
|
777
|
+
min: [{
|
|
778
|
+
type: i0.Input,
|
|
779
|
+
args: [{
|
|
780
|
+
isSignal: true,
|
|
781
|
+
alias: "min",
|
|
782
|
+
required: false
|
|
783
|
+
}]
|
|
784
|
+
}],
|
|
785
|
+
max: [{
|
|
786
|
+
type: i0.Input,
|
|
787
|
+
args: [{
|
|
788
|
+
isSignal: true,
|
|
789
|
+
alias: "max",
|
|
790
|
+
required: false
|
|
791
|
+
}]
|
|
792
|
+
}],
|
|
793
|
+
startAt: [{
|
|
794
|
+
type: i0.Input,
|
|
795
|
+
args: [{
|
|
796
|
+
isSignal: true,
|
|
797
|
+
alias: "startAt",
|
|
798
|
+
required: false
|
|
799
|
+
}]
|
|
800
|
+
}],
|
|
801
|
+
startView: [{
|
|
802
|
+
type: i0.Input,
|
|
803
|
+
args: [{
|
|
804
|
+
isSignal: true,
|
|
805
|
+
alias: "startView",
|
|
806
|
+
required: false
|
|
807
|
+
}]
|
|
808
|
+
}],
|
|
809
|
+
dateFilter: [{
|
|
810
|
+
type: i0.Input,
|
|
811
|
+
args: [{
|
|
812
|
+
isSignal: true,
|
|
813
|
+
alias: "dateFilter",
|
|
814
|
+
required: false
|
|
815
|
+
}]
|
|
816
|
+
}],
|
|
817
|
+
disabled: [{
|
|
818
|
+
type: i0.Input,
|
|
819
|
+
args: [{
|
|
820
|
+
isSignal: true,
|
|
821
|
+
alias: "disabled",
|
|
822
|
+
required: false
|
|
823
|
+
}]
|
|
824
|
+
}],
|
|
825
|
+
class: [{
|
|
826
|
+
type: i0.Input,
|
|
827
|
+
args: [{
|
|
828
|
+
isSignal: true,
|
|
829
|
+
alias: "class",
|
|
830
|
+
required: false
|
|
831
|
+
}]
|
|
832
|
+
}]
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
export { CalendarComponent, addDays, addMonths, addYears, cloneDate, endOfMonth, formatIsoDate, isDateSelectable, monthLabel, parseIsoDate, sameDay, startOfDay, startOfMonth, startOfWeek, yearLabel, yearRangeLabel };
|