cmat 0.0.87 → 0.0.88
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/fesm2022/cmat-components-adapter.mjs +9 -9
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +98 -80
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +26 -34
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +467 -556
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +270 -259
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +200 -116
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +85 -38
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-color-picker.mjs +841 -0
- package/fesm2022/cmat-components-color-picker.mjs.map +1 -0
- package/fesm2022/cmat-components-custom-formly.mjs +1395 -838
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +996 -0
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -0
- package/fesm2022/cmat-components-date-range.mjs +310 -264
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +16 -20
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +120 -137
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +17 -24
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +18 -24
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +30 -39
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +12 -12
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +10 -10
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +48 -41
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +104 -107
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +12 -15
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +118 -75
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +196 -178
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +26 -41
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +81 -80
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +1212 -1287
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +467 -450
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +143 -132
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +68 -83
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +18 -24
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +220 -136
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +262 -215
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +227 -195
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +15 -34
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +95 -88
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +70 -67
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +23 -26
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +190 -159
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +276 -213
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +178 -128
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +44 -28
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +107 -163
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +29 -36
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +14 -18
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +111 -118
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +65 -66
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +130 -160
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +32 -39
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +186 -176
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +25 -28
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +85 -92
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
- package/fesm2022/cmat-directives-data-exporter.mjs +49 -50
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +16 -19
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +60 -69
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +31 -30
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -6
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
- package/fesm2022/cmat-pipes-secure.mjs +7 -13
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
- package/fesm2022/cmat-services-alert.mjs +26 -27
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +14 -23
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +8 -8
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +6 -10
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +3 -3
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +30 -47
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
- package/fesm2022/cmat-services-media-watcher.mjs +43 -34
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -3
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +3 -3
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +3 -3
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +11 -11
- package/fesm2022/cmat-services-translation.mjs.map +1 -1
- package/fesm2022/cmat-services-utils.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat.mjs +9228 -7507
- package/fesm2022/cmat.mjs.map +1 -1
- package/icons/material-icons/heroicons-outline.svg +3 -0
- package/icons/material-icons/heroicons-solid.svg +3 -0
- package/package.json +10 -1
- package/styles/components/bundle.scss +21 -0
- package/styles/overrides/angular-material.scss +22 -1
- package/tailwind/plugins/theming.js +183 -183
- package/types/cmat-components-breadcrumb.d.ts +40 -37
- package/types/cmat-components-card.d.ts +11 -13
- package/types/cmat-components-carousel.d.ts +87 -113
- package/types/cmat-components-cascade.d.ts +84 -65
- package/types/cmat-components-chip-input.d.ts +29 -24
- package/types/cmat-components-code-editor.d.ts +28 -12
- package/types/cmat-components-color-picker.d.ts +236 -0
- package/types/cmat-components-custom-formly.d.ts +316 -184
- package/types/cmat-components-data-picker.d.ts +372 -0
- package/types/cmat-components-date-range.d.ts +31 -36
- package/types/cmat-components-date-time-display.d.ts +8 -8
- package/types/cmat-components-drawer.d.ts +30 -32
- package/types/cmat-components-empty-state.d.ts +9 -10
- package/types/cmat-components-file-preview.d.ts +9 -9
- package/types/cmat-components-filter-toolbar.d.ts +15 -15
- package/types/cmat-components-form-actions.d.ts +5 -5
- package/types/cmat-components-fullscreen.d.ts +5 -5
- package/types/cmat-components-highlight.d.ts +13 -14
- package/types/cmat-components-image-viewer.d.ts +29 -33
- package/types/cmat-components-inline-loading.d.ts +6 -6
- package/types/cmat-components-json-editor.d.ts +15 -17
- package/types/cmat-components-knob-input.d.ts +58 -55
- package/types/cmat-components-masonry.d.ts +9 -12
- package/types/cmat-components-material-color-picker.d.ts +16 -21
- package/types/cmat-components-material-datetimepicker.d.ts +174 -216
- package/types/cmat-components-navigation.d.ts +34 -39
- package/types/cmat-components-opt-input.d.ts +35 -33
- package/types/cmat-components-org-chart.d.ts +8 -9
- package/types/cmat-components-page-header.d.ts +9 -9
- package/types/cmat-components-pagination.d.ts +36 -40
- package/types/cmat-components-password-strength.d.ts +58 -64
- package/types/cmat-components-popover.d.ts +22 -32
- package/types/cmat-components-progress-bar.d.ts +7 -10
- package/types/cmat-components-qrcode.d.ts +22 -22
- package/types/cmat-components-rating.d.ts +17 -19
- package/types/cmat-components-rich-text-editor.d.ts +11 -12
- package/types/cmat-components-select-search.d.ts +48 -36
- package/types/cmat-components-select-table.d.ts +38 -34
- package/types/cmat-components-select-tree.d.ts +17 -15
- package/types/cmat-components-skeleton.d.ts +27 -10
- package/types/cmat-components-speed-dial.d.ts +24 -33
- package/types/cmat-components-status-tag.d.ts +19 -9
- package/types/cmat-components-table-toolbar.d.ts +7 -7
- package/types/cmat-components-timeline.d.ts +33 -34
- package/types/cmat-components-toast.d.ts +26 -30
- package/types/cmat-components-transfer-picker.d.ts +51 -56
- package/types/cmat-components-treetable.d.ts +12 -13
- package/types/cmat-components-upload.d.ts +33 -38
- package/types/cmat-components-x6-angular-shape.d.ts +1 -1
- package/types/cmat-directives-animate-on-scroll.d.ts +7 -7
- package/types/cmat-directives-arrow-cursor.d.ts +18 -20
- package/types/cmat-directives-data-exporter.d.ts +10 -10
- package/types/cmat-directives-debounce.d.ts +5 -5
- package/types/cmat-directives-digit-only.d.ts +13 -13
- package/types/cmat-directives-seamless-auto-scroll.d.ts +7 -7
- package/types/cmat-pipes-secure.d.ts +1 -3
- package/types/cmat-services-alert.d.ts +11 -12
- package/types/cmat-services-config.d.ts +2 -7
- package/types/cmat-services-confirmation.d.ts +2 -2
- package/types/cmat-services-data.d.ts +0 -1
- package/types/cmat-services-loading.d.ts +14 -22
- package/types/cmat-services-media-watcher.d.ts +5 -5
- package/types/cmat-services-translation.d.ts +4 -5
- package/types/cmat.d.ts +2167 -1746
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgStyle, NgClass } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { output, input, signal, computed, inject, ElementRef, Renderer2, effect, ChangeDetectionStrategy, ViewEncapsulation, Component, Injectable, untracked, Directive, viewChild, DestroyRef, model, InjectionToken, EventEmitter, Injector, ViewContainerRef, DOCUMENT, afterNextRender, forwardRef, contentChild } from '@angular/core';
|
|
4
4
|
import { DatetimeAdapter, CMAT_DATETIME_FORMATS } from 'cmat/components/adapter';
|
|
5
5
|
import { coerceNumberProperty, coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -33,96 +33,107 @@ const CLOCK_OUTER_RADIUS = 41.25;
|
|
|
33
33
|
const CLOCK_TICK_RADIUS = 7.0833;
|
|
34
34
|
class CmatDatetimepickerClockComponent {
|
|
35
35
|
constructor() {
|
|
36
|
-
this.userSelection =
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
this.
|
|
36
|
+
this.userSelection = output();
|
|
37
|
+
this.selectedChange = output();
|
|
38
|
+
this.activeDateChange = output();
|
|
39
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this.interval = input(1, /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "interval" }] : /* istanbul ignore next */ []));
|
|
43
|
+
this.twelvehour = input(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "twelvehour" }] : /* istanbul ignore next */ []));
|
|
45
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
47
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
49
|
+
this.selected = input(null, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
51
|
+
this.startView = input('hour', /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []));
|
|
53
|
+
this.activeDate = input.required(/* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
55
|
+
this.hours = signal([], /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "hours" }] : /* istanbul ignore next */ []));
|
|
57
|
+
this.minutes = signal([], /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "minutes" }] : /* istanbul ignore next */ []));
|
|
59
|
+
this.hourView = signal(true, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "hourView" }] : /* istanbul ignore next */ []));
|
|
61
|
+
this.selectedHour = computed(() => {
|
|
62
|
+
let hour = this._adapter.getHour(this._clampedActiveDate());
|
|
63
|
+
if (this.twelvehour()) {
|
|
64
|
+
if (hour === 0) {
|
|
65
|
+
hour = 24;
|
|
66
|
+
}
|
|
67
|
+
return hour > 12 ? hour - 12 : hour;
|
|
68
|
+
}
|
|
69
|
+
return hour;
|
|
70
|
+
}, /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "selectedHour" }] : /* istanbul ignore next */ []));
|
|
72
|
+
this.selectedMinute = computed(() => {
|
|
73
|
+
return this._adapter.getMinute(this._clampedActiveDate());
|
|
74
|
+
}, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "selectedMinute" }] : /* istanbul ignore next */ []));
|
|
76
|
+
this._clampedActiveDate = computed(() => {
|
|
77
|
+
const date = this._internalDate();
|
|
78
|
+
if (!date) {
|
|
79
|
+
return this._adapter.today();
|
|
80
|
+
}
|
|
81
|
+
return this._adapter.clampDate(date, this.minDate(), this.maxDate());
|
|
82
|
+
}, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "_clampedActiveDate" }] : /* istanbul ignore next */ []));
|
|
84
|
+
this.hand = computed(() => {
|
|
85
|
+
const twelvehour = this.twelvehour();
|
|
86
|
+
let deg;
|
|
87
|
+
let radius = CLOCK_OUTER_RADIUS;
|
|
88
|
+
if (this.hourView()) {
|
|
89
|
+
const outer = this.selectedHour() > 0 && this.selectedHour() < 13;
|
|
90
|
+
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
91
|
+
if (twelvehour) {
|
|
92
|
+
radius = CLOCK_OUTER_RADIUS;
|
|
93
|
+
}
|
|
94
|
+
deg = Math.round(this.selectedHour() * (360 / (24 / 2)));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
deg = Math.round(this.selectedMinute() * (360 / 60));
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
'transform': `rotate(${deg}deg)`,
|
|
101
|
+
'height': `${radius}%`,
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
103
|
+
'margin-top': `${50 - radius}%`,
|
|
104
|
+
};
|
|
105
|
+
}, /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "hand" }] : /* istanbul ignore next */ []));
|
|
46
107
|
this._element = inject(ElementRef);
|
|
47
108
|
this._adapter = inject(DatetimeAdapter);
|
|
109
|
+
this._renderer = inject(Renderer2);
|
|
48
110
|
this._timeChanged = false;
|
|
111
|
+
this._internalDate = signal(null, /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "_internalDate" }] : /* istanbul ignore next */ []));
|
|
49
113
|
this._mouseMoveListener = (event) => {
|
|
50
114
|
this.handleMousemove(event);
|
|
51
115
|
};
|
|
52
116
|
this._mouseUpListener = () => {
|
|
53
117
|
this.handleMouseup();
|
|
54
118
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
67
|
-
get selected() {
|
|
68
|
-
return this._selected;
|
|
69
|
-
}
|
|
70
|
-
set selected(value) {
|
|
71
|
-
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
72
|
-
if (this._selected) {
|
|
73
|
-
this.activeDate = this._selected;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
77
|
-
get minDate() {
|
|
78
|
-
return this._minDate;
|
|
79
|
-
}
|
|
80
|
-
set minDate(value) {
|
|
81
|
-
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
82
|
-
}
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
84
|
-
get maxDate() {
|
|
85
|
-
return this._maxDate;
|
|
86
|
-
}
|
|
87
|
-
set maxDate(value) {
|
|
88
|
-
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
89
|
-
}
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
91
|
-
set startView(value) {
|
|
92
|
-
this.hourView = value !== 'minute';
|
|
93
|
-
}
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
95
|
-
get hand() {
|
|
96
|
-
let hour = this._adapter.getHour(this.activeDate);
|
|
97
|
-
if (this.twelvehour) {
|
|
98
|
-
if (hour === 0) {
|
|
99
|
-
hour = 24;
|
|
100
|
-
}
|
|
101
|
-
this.selectedHour = hour > 12 ? (hour - 12) : hour;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
this.selectedHour = hour;
|
|
105
|
-
}
|
|
106
|
-
this.selectedMinute = this._adapter.getMinute(this.activeDate);
|
|
107
|
-
let deg;
|
|
108
|
-
let radius = CLOCK_OUTER_RADIUS;
|
|
109
|
-
if (this.hourView) {
|
|
110
|
-
const outer = this.selectedHour > 0 && this.selectedHour < 13;
|
|
111
|
-
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
112
|
-
if (this.twelvehour) {
|
|
113
|
-
radius = CLOCK_OUTER_RADIUS;
|
|
119
|
+
// Watch for startView changes
|
|
120
|
+
effect(() => {
|
|
121
|
+
this.hourView.set(this.startView() !== 'minute');
|
|
122
|
+
});
|
|
123
|
+
// Watch for selected changes
|
|
124
|
+
effect(() => {
|
|
125
|
+
const selectedValue = this.selected();
|
|
126
|
+
if (selectedValue) {
|
|
127
|
+
this._internalDate.set(selectedValue);
|
|
114
128
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
124
|
-
'margin-top': `${50 - radius}%`
|
|
125
|
-
};
|
|
129
|
+
});
|
|
130
|
+
// Watch for activeDate input changes
|
|
131
|
+
effect(() => {
|
|
132
|
+
this._internalDate.set(this.activeDate());
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
get activeDateValue() {
|
|
136
|
+
return this.activeDate();
|
|
126
137
|
}
|
|
127
138
|
handleMousedown(event) {
|
|
128
139
|
this._timeChanged = false;
|
|
@@ -133,11 +144,14 @@ class CmatDatetimepickerClockComponent {
|
|
|
133
144
|
document.addEventListener('touchend', this._mouseUpListener);
|
|
134
145
|
}
|
|
135
146
|
ngAfterContentInit() {
|
|
136
|
-
this.activeDate = this._activeDate || this._adapter.today();
|
|
137
147
|
this._init();
|
|
148
|
+
this._mousedownListener = this._renderer.listen(this._element.nativeElement, 'mousedown', (event) => this.handleMousedown(event));
|
|
138
149
|
}
|
|
139
150
|
ngOnDestroy() {
|
|
140
151
|
this._removeDocumentListeners();
|
|
152
|
+
if (this._mousedownListener) {
|
|
153
|
+
this._mousedownListener();
|
|
154
|
+
}
|
|
141
155
|
}
|
|
142
156
|
handleMousemove(event) {
|
|
143
157
|
event.preventDefault();
|
|
@@ -146,8 +160,8 @@ class CmatDatetimepickerClockComponent {
|
|
|
146
160
|
handleMouseup() {
|
|
147
161
|
this._removeDocumentListeners();
|
|
148
162
|
if (this._timeChanged) {
|
|
149
|
-
this.selectedChange.emit(this.
|
|
150
|
-
if (!this.hourView) {
|
|
163
|
+
this.selectedChange.emit(this._clampedActiveDate());
|
|
164
|
+
if (!this.hourView()) {
|
|
151
165
|
this.userSelection.emit();
|
|
152
166
|
}
|
|
153
167
|
}
|
|
@@ -159,59 +173,75 @@ class CmatDatetimepickerClockComponent {
|
|
|
159
173
|
document.removeEventListener('touchend', this._mouseUpListener);
|
|
160
174
|
}
|
|
161
175
|
_init() {
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
const hoursList = [];
|
|
177
|
+
const minutesList = [];
|
|
164
178
|
const hourNames = this._adapter.getHourNames();
|
|
165
179
|
const minuteNames = this._adapter.getMinuteNames();
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
180
|
+
const currentDate = this._clampedActiveDate();
|
|
181
|
+
if (this.twelvehour()) {
|
|
182
|
+
for (let i = 1; i < hourNames.length / 2 + 1; i++) {
|
|
183
|
+
const radian = (i / 6) * Math.PI;
|
|
169
184
|
const radius = CLOCK_OUTER_RADIUS;
|
|
170
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(
|
|
171
|
-
const enabled = (!this.minDate
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), i + 1, 0);
|
|
186
|
+
const enabled = (!this.minDate() ||
|
|
187
|
+
this._adapter.compareDatetime(date, this.minDate()) >=
|
|
188
|
+
0) &&
|
|
189
|
+
(!this.maxDate() ||
|
|
190
|
+
this._adapter.compareDatetime(date, this.maxDate()) <= 0);
|
|
191
|
+
hoursList.push({
|
|
174
192
|
value: i,
|
|
175
193
|
displayValue: i === 0 ? '00' : hourNames[i],
|
|
176
194
|
enabled: enabled,
|
|
177
195
|
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
178
|
-
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS
|
|
196
|
+
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
179
197
|
});
|
|
180
198
|
}
|
|
181
199
|
}
|
|
182
200
|
else {
|
|
183
201
|
for (let i = 0; i < hourNames.length; i++) {
|
|
184
|
-
const radian = i / 6 * Math.PI;
|
|
202
|
+
const radian = (i / 6) * Math.PI;
|
|
185
203
|
const outer = i > 0 && i < 13;
|
|
186
204
|
const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
187
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
205
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), i, 0);
|
|
206
|
+
const dateFilter = this.dateFilter();
|
|
207
|
+
const enabled = (!this.minDate() ||
|
|
208
|
+
this._adapter.compareDatetime(date, this.minDate(), false) >= 0) &&
|
|
209
|
+
(!this.maxDate() ||
|
|
210
|
+
this._adapter.compareDatetime(date, this.maxDate(), false) <= 0) &&
|
|
211
|
+
(!dateFilter || dateFilter(date, CmatDatetimepickerFilterType.HOUR));
|
|
212
|
+
hoursList.push({
|
|
192
213
|
value: i,
|
|
193
214
|
displayValue: i === 0 ? '00' : hourNames[i],
|
|
194
215
|
enabled: enabled,
|
|
195
216
|
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
196
217
|
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
197
|
-
fontSize: i > 0 && i < 13 ? '' : '80%'
|
|
218
|
+
fontSize: i > 0 && i < 13 ? '' : '80%',
|
|
198
219
|
});
|
|
199
220
|
}
|
|
200
221
|
}
|
|
201
222
|
for (let i = 0; i < minuteNames.length; i += 5) {
|
|
202
|
-
const radian = i / 30 * Math.PI;
|
|
203
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
223
|
+
const radian = (i / 30) * Math.PI;
|
|
224
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), this._adapter.getHour(currentDate), i);
|
|
225
|
+
const dateFilter = this.dateFilter();
|
|
226
|
+
const enabled = (!this.minDate() ||
|
|
227
|
+
this._adapter.compareDatetime(date, this.minDate()) >= 0) &&
|
|
228
|
+
(!this.maxDate() ||
|
|
229
|
+
this._adapter.compareDatetime(date, this.maxDate()) <= 0) &&
|
|
230
|
+
(!dateFilter || dateFilter(date, CmatDatetimepickerFilterType.MINUTE));
|
|
231
|
+
minutesList.push({
|
|
208
232
|
value: i,
|
|
209
233
|
displayValue: i === 0 ? '00' : minuteNames[i],
|
|
210
234
|
enabled: enabled,
|
|
211
|
-
top: CLOCK_RADIUS -
|
|
212
|
-
|
|
235
|
+
top: CLOCK_RADIUS -
|
|
236
|
+
Math.cos(radian) * CLOCK_OUTER_RADIUS -
|
|
237
|
+
CLOCK_TICK_RADIUS,
|
|
238
|
+
left: CLOCK_RADIUS +
|
|
239
|
+
Math.sin(radian) * CLOCK_OUTER_RADIUS -
|
|
240
|
+
CLOCK_TICK_RADIUS,
|
|
213
241
|
});
|
|
214
242
|
}
|
|
243
|
+
this.hours.set(hoursList);
|
|
244
|
+
this.minutes.set(minutesList);
|
|
215
245
|
}
|
|
216
246
|
_setTime(event) {
|
|
217
247
|
const trigger = this._element.nativeElement;
|
|
@@ -220,81 +250,65 @@ class CmatDatetimepickerClockComponent {
|
|
|
220
250
|
const height = trigger.offsetHeight;
|
|
221
251
|
const pageX = event instanceof MouseEvent ? event.pageX : event.touches[0].pageX;
|
|
222
252
|
const pageY = event instanceof MouseEvent ? event.pageY : event.touches[0].pageY;
|
|
223
|
-
const x =
|
|
224
|
-
const y =
|
|
253
|
+
const x = width / 2 - (pageX - triggerRect.left - window.scrollX);
|
|
254
|
+
const y = height / 2 - (pageY - triggerRect.top - window.scrollY);
|
|
225
255
|
let radian = Math.atan2(-x, y);
|
|
226
|
-
const
|
|
256
|
+
const interval = this.interval();
|
|
257
|
+
const unit = Math.PI / (this.hourView() ? 6 : interval ? 30 / interval : 30);
|
|
227
258
|
const z = Math.sqrt(x * x + y * y);
|
|
228
|
-
const outer = this.hourView
|
|
229
|
-
|
|
259
|
+
const outer = this.hourView() &&
|
|
260
|
+
z >
|
|
261
|
+
(width * (CLOCK_OUTER_RADIUS / 100) +
|
|
262
|
+
width * (CLOCK_INNER_RADIUS / 100)) /
|
|
263
|
+
2;
|
|
230
264
|
if (radian < 0) {
|
|
231
265
|
radian = Math.PI * 2 + radian;
|
|
232
266
|
}
|
|
233
267
|
let value = Math.round(radian / unit);
|
|
234
268
|
let date;
|
|
235
|
-
|
|
236
|
-
|
|
269
|
+
const currentDate = this._clampedActiveDate();
|
|
270
|
+
if (this.hourView()) {
|
|
271
|
+
if (this.twelvehour()) {
|
|
237
272
|
value = value === 0 ? 12 : value;
|
|
238
273
|
}
|
|
239
274
|
else {
|
|
240
275
|
if (value === 12) {
|
|
241
276
|
value = 0;
|
|
242
277
|
}
|
|
243
|
-
value = outer
|
|
278
|
+
value = outer
|
|
279
|
+
? value === 0
|
|
280
|
+
? 12
|
|
281
|
+
: value
|
|
282
|
+
: value === 0
|
|
283
|
+
? 0
|
|
284
|
+
: value + 12;
|
|
244
285
|
}
|
|
245
|
-
date = this._adapter.createDatetime(this._adapter.getYear(
|
|
286
|
+
date = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), value, this._adapter.getMinute(currentDate));
|
|
246
287
|
}
|
|
247
288
|
else {
|
|
248
|
-
|
|
249
|
-
|
|
289
|
+
const intervalValue = this.interval();
|
|
290
|
+
if (intervalValue) {
|
|
291
|
+
value *= intervalValue;
|
|
250
292
|
}
|
|
251
293
|
if (value === 60) {
|
|
252
294
|
value = 0;
|
|
253
295
|
}
|
|
254
|
-
date = this._adapter.createDatetime(this._adapter.getYear(
|
|
296
|
+
date = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), this._adapter.getHour(currentDate), value);
|
|
255
297
|
}
|
|
256
298
|
this._timeChanged = true;
|
|
257
|
-
this.
|
|
258
|
-
this.activeDateChange.emit(this.
|
|
299
|
+
this._internalDate.set(date);
|
|
300
|
+
this.activeDateChange.emit(this._clampedActiveDate());
|
|
259
301
|
}
|
|
260
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
261
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
302
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerClockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
303
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerClockComponent, isStandalone: true, selector: "cmat-datetimepicker-clock", inputs: { dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, twelvehour: { classPropertyName: "twelvehour", publicName: "twelvehour", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange", activeDateChange: "activeDateChange" }, host: { attributes: { "role": "clock" }, classAttribute: "cmat-datetimepicker-clock" }, exportAs: ["cmatDatetimepickerClock"], ngImport: i0, template: "<div class=\"cmat-datetimepicker-clock-wrapper\">\r\n <div class=\"cmat-datetimepicker-clock-center\"></div>\r\n <div class=\"cmat-datetimepicker-clock-hand\" [ngStyle]=\"hand()\"></div>\r\n <div class=\"cmat-datetimepicker-clock-hours\" [class.active]=\"hourView()\">\r\n @for (item of hours(); track $index) {\r\n <div class=\"cmat-datetimepicker-clock-cell\"\r\n [class.cmat-datetimepicker-clock-cell-disabled]=\"!item.enabled\"\r\n [class.cmat-datetimepicker-clock-cell-selected]=\"selectedHour() === item.value\"\r\n [ngStyle]=\"{'fontSize':item.fontSize,'left':item.left+'%',top:item.top+'%'}\">\r\n {{ item.displayValue }}</div>\r\n }\r\n </div>\r\n <div class=\"cmat-datetimepicker-clock-minutes\" [class.active]=\"!hourView()\">\r\n @for (item of minutes(); track $index) {\r\n <div class=\"cmat-datetimepicker-clock-cell\"\r\n [class.cmat-datetimepicker-clock-cell-disabled]=\"!item.enabled\"\r\n [class.cmat-datetimepicker-clock-cell-selected]=\"selectedMinute() === item.value\" [ngStyle]=\"{'left':item.left+'%','top':item.top+'%'}\">{{ item.displayValue\r\n }}</div>\r\n }\r\n </div>\r\n</div>", styles: [".cmat-datetimepicker-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.cmat-datetimepicker-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.cmat-datetimepicker-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.cmat-datetimepicker-clock-hand{position:absolute;inset:0;width:1px;margin:0 auto;transform-origin:bottom}.cmat-datetimepicker-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.cmat-datetimepicker-clock-hours,.cmat-datetimepicker-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.cmat-datetimepicker-clock-hours.active,.cmat-datetimepicker-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.cmat-datetimepicker-clock-minutes{transform:scale(.8)}.cmat-datetimepicker-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-disabled{pointer-events:none}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
262
304
|
}
|
|
263
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
305
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerClockComponent, decorators: [{
|
|
264
306
|
type: Component,
|
|
265
|
-
args: [{ selector: 'cmat-datetimepicker-clock',
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}], interval: [{
|
|
271
|
-
type: Input
|
|
272
|
-
}], twelvehour: [{
|
|
273
|
-
type: Input
|
|
274
|
-
}], selectedChange: [{
|
|
275
|
-
type: Output
|
|
276
|
-
}], activeDateChange: [{
|
|
277
|
-
type: Output
|
|
278
|
-
}], role: [{
|
|
279
|
-
type: HostBinding,
|
|
280
|
-
args: ['role']
|
|
281
|
-
}], class: [{
|
|
282
|
-
type: HostBinding,
|
|
283
|
-
args: ['class']
|
|
284
|
-
}], activeDate: [{
|
|
285
|
-
type: Input
|
|
286
|
-
}], selected: [{
|
|
287
|
-
type: Input
|
|
288
|
-
}], minDate: [{
|
|
289
|
-
type: Input
|
|
290
|
-
}], maxDate: [{
|
|
291
|
-
type: Input
|
|
292
|
-
}], startView: [{
|
|
293
|
-
type: Input
|
|
294
|
-
}], handleMousedown: [{
|
|
295
|
-
type: HostListener,
|
|
296
|
-
args: ['mousedown', ['$event']]
|
|
297
|
-
}] } });
|
|
307
|
+
args: [{ selector: 'cmat-datetimepicker-clock', host: {
|
|
308
|
+
'role': 'clock',
|
|
309
|
+
'class': 'cmat-datetimepicker-clock',
|
|
310
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerClock', imports: [NgStyle], template: "<div class=\"cmat-datetimepicker-clock-wrapper\">\r\n <div class=\"cmat-datetimepicker-clock-center\"></div>\r\n <div class=\"cmat-datetimepicker-clock-hand\" [ngStyle]=\"hand()\"></div>\r\n <div class=\"cmat-datetimepicker-clock-hours\" [class.active]=\"hourView()\">\r\n @for (item of hours(); track $index) {\r\n <div class=\"cmat-datetimepicker-clock-cell\"\r\n [class.cmat-datetimepicker-clock-cell-disabled]=\"!item.enabled\"\r\n [class.cmat-datetimepicker-clock-cell-selected]=\"selectedHour() === item.value\"\r\n [ngStyle]=\"{'fontSize':item.fontSize,'left':item.left+'%',top:item.top+'%'}\">\r\n {{ item.displayValue }}</div>\r\n }\r\n </div>\r\n <div class=\"cmat-datetimepicker-clock-minutes\" [class.active]=\"!hourView()\">\r\n @for (item of minutes(); track $index) {\r\n <div class=\"cmat-datetimepicker-clock-cell\"\r\n [class.cmat-datetimepicker-clock-cell-disabled]=\"!item.enabled\"\r\n [class.cmat-datetimepicker-clock-cell-selected]=\"selectedMinute() === item.value\" [ngStyle]=\"{'left':item.left+'%','top':item.top+'%'}\">{{ item.displayValue\r\n }}</div>\r\n }\r\n </div>\r\n</div>", styles: [".cmat-datetimepicker-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.cmat-datetimepicker-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.cmat-datetimepicker-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.cmat-datetimepicker-clock-hand{position:absolute;inset:0;width:1px;margin:0 auto;transform-origin:bottom}.cmat-datetimepicker-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.cmat-datetimepicker-clock-hours,.cmat-datetimepicker-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.cmat-datetimepicker-clock-hours.active,.cmat-datetimepicker-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.cmat-datetimepicker-clock-minutes{transform:scale(.8)}.cmat-datetimepicker-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-disabled{pointer-events:none}\n"] }]
|
|
311
|
+
}], ctorParameters: () => [], propDecorators: { userSelection: [{ type: i0.Output, args: ["userSelection"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], activeDateChange: [{ type: i0.Output, args: ["activeDateChange"] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], twelvehour: [{ type: i0.Input, args: [{ isSignal: true, alias: "twelvehour", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }] } });
|
|
298
312
|
|
|
299
313
|
function createMissingDateImplError(provider) {
|
|
300
314
|
return Error(`CmatDatetimepickerComponent: No provider found for ${provider}. You must import one of the following ` +
|
|
@@ -330,10 +344,10 @@ class CmatDatetimepickerIntl {
|
|
|
330
344
|
formatYearRangeLabel(start, end) {
|
|
331
345
|
return `${start} to ${end}`;
|
|
332
346
|
}
|
|
333
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
334
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
347
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
348
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerIntl, providedIn: 'root' }); }
|
|
335
349
|
}
|
|
336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerIntl, decorators: [{
|
|
337
351
|
type: Injectable,
|
|
338
352
|
args: [{ providedIn: 'root' }]
|
|
339
353
|
}] });
|
|
@@ -348,67 +362,87 @@ class CmatDatetimepickerCalendarCellComponent {
|
|
|
348
362
|
}
|
|
349
363
|
class CmatDatetimepickerCalendarBodyComponent {
|
|
350
364
|
constructor() {
|
|
351
|
-
this.
|
|
352
|
-
this.
|
|
353
|
-
|
|
354
|
-
this.
|
|
355
|
-
|
|
365
|
+
this.selectedValueChange = output();
|
|
366
|
+
this.label = input(/* @ts-ignore */
|
|
367
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
368
|
+
this.rows = input(/* @ts-ignore */
|
|
369
|
+
...(ngDevMode ? [undefined, { debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
370
|
+
this.todayValue = input(/* @ts-ignore */
|
|
371
|
+
...(ngDevMode ? [undefined, { debugName: "todayValue" }] : /* istanbul ignore next */ []));
|
|
372
|
+
this.selectedValue = input(/* @ts-ignore */
|
|
373
|
+
...(ngDevMode ? [undefined, { debugName: "selectedValue" }] : /* istanbul ignore next */ []));
|
|
374
|
+
this.labelMinRequiredCells = input(0, /* @ts-ignore */
|
|
375
|
+
...(ngDevMode ? [{ debugName: "labelMinRequiredCells" }] : /* istanbul ignore next */ []));
|
|
376
|
+
this.numCols = input(7, /* @ts-ignore */
|
|
377
|
+
...(ngDevMode ? [{ debugName: "numCols" }] : /* istanbul ignore next */ []));
|
|
378
|
+
this.allowDisabledSelection = input(false, /* @ts-ignore */
|
|
379
|
+
...(ngDevMode ? [{ debugName: "allowDisabledSelection" }] : /* istanbul ignore next */ []));
|
|
380
|
+
this.activeCell = input(0, /* @ts-ignore */
|
|
381
|
+
...(ngDevMode ? [{ debugName: "activeCell" }] : /* istanbul ignore next */ []));
|
|
356
382
|
}
|
|
357
383
|
get _firstRowOffset() {
|
|
358
|
-
|
|
359
|
-
|
|
384
|
+
const rows = this.rows();
|
|
385
|
+
return rows?.length && rows[0].length ? this.numCols() - rows[0].length : 0;
|
|
360
386
|
}
|
|
361
387
|
cellClicked(cell) {
|
|
362
|
-
if (!this.allowDisabledSelection && !cell.enabled) {
|
|
388
|
+
if (!this.allowDisabledSelection() && !cell.enabled) {
|
|
363
389
|
return;
|
|
364
390
|
}
|
|
365
391
|
this.selectedValueChange.emit(cell.value);
|
|
366
392
|
}
|
|
367
393
|
isActiveCell(rowIndex, colIndex) {
|
|
368
|
-
let cellNumber = rowIndex * this.numCols + colIndex;
|
|
394
|
+
let cellNumber = rowIndex * this.numCols() + colIndex;
|
|
369
395
|
if (rowIndex) {
|
|
370
396
|
cellNumber -= this._firstRowOffset;
|
|
371
397
|
}
|
|
372
|
-
return cellNumber === this.activeCell;
|
|
398
|
+
return cellNumber === this.activeCell();
|
|
373
399
|
}
|
|
374
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
375
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
400
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerCalendarBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
401
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerCalendarBodyComponent, isStandalone: true, selector: "[cmat-datetimepicker-calendar-body]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, todayValue: { classPropertyName: "todayValue", publicName: "todayValue", isSignal: true, isRequired: false, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, labelMinRequiredCells: { classPropertyName: "labelMinRequiredCells", publicName: "labelMinRequiredCells", isSignal: true, isRequired: false, transformFunction: null }, numCols: { classPropertyName: "numCols", publicName: "numCols", isSignal: true, isRequired: false, transformFunction: null }, allowDisabledSelection: { classPropertyName: "allowDisabledSelection", publicName: "allowDisabledSelection", isSignal: true, isRequired: false, transformFunction: null }, activeCell: { classPropertyName: "activeCell", publicName: "activeCell", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedValueChange: "selectedValueChange" }, host: { classAttribute: "cmat-datetimepicker-calendar-body" }, exportAs: ["cmatDatetimepickerCalendarBody"], ngImport: i0, template: "@if (_firstRowOffset < labelMinRequiredCells()) {\r\n<tr aria-hidden=\"true\">\r\n <td\r\n class=\"cmat-datetimepicker-calendar-body-label\"\r\n [attr.colspan]=\"numCols()\"\r\n >\r\n {{ label() }}\r\n </td>\r\n</tr>\r\n} @for (row of rows(); track $index; let rowIndex = $index) {\r\n<tr role=\"row\">\r\n @if (rowIndex === 0 && _firstRowOffset) {\r\n <td\r\n aria-hidden=\"true\"\r\n class=\"cmat-datetimepicker-calendar-body-label\"\r\n [attr.colspan]=\"_firstRowOffset\"\r\n >\r\n {{ _firstRowOffset >= labelMinRequiredCells() ? label() : '' }}\r\n </td>\r\n } @for (item of row; track $index; let colIndex = $index) {\r\n <td\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-body-cell\"\r\n [attr.aria-disabled]=\"!item.enabled || null\"\r\n [attr.aria-label]=\"item.ariaLabel\"\r\n [class.cmat-datetimepicker-calendar-body-active]=\"isActiveCell(rowIndex, colIndex)\"\r\n [class.cmat-datetimepicker-calendar-body-disabled]=\"!item.enabled\"\r\n (click)=\"cellClicked(item)\"\r\n >\r\n <div\r\n class=\"cmat-datetimepicker-calendar-body-cell-content\"\r\n [attr.aria-selected]=\"selectedValue() === item.value\"\r\n [class.cmat-datetimepicker-calendar-body-selected]=\"selectedValue() === item.value\"\r\n [class.cmat-datetimepicker-calendar-body-today]=\"todayValue() === item.value\"\r\n >\r\n {{ item.displayValue }}\r\n </div>\r\n </td>\r\n }\r\n</tr>\r\n}\r\n", styles: [".cmat-datetimepicker-calendar-body{min-width:224px}.cmat-datetimepicker-calendar-body-label{height:0;line-height:0;text-align:left;padding:calc(14.2857142857% / 2) 4.7142857143%}[dir=rtl] .cmat-datetimepicker-calendar-body-label{text-align:right}.cmat-datetimepicker-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:calc(14.2857142857% / 2) 0;text-align:center;outline:none;cursor:pointer}.cmat-datetimepicker-calendar-body-disabled{cursor:default;pointer-events:none}.cmat-datetimepicker-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
376
402
|
}
|
|
377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerCalendarBodyComponent, decorators: [{
|
|
378
404
|
type: Component,
|
|
379
|
-
args: [{ selector: '[cmat-datetimepicker-calendar-body]', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerCalendarBody', imports: [], template: "
|
|
380
|
-
}], propDecorators: { label: [{
|
|
381
|
-
type: Input
|
|
382
|
-
}], rows: [{
|
|
383
|
-
type: Input
|
|
384
|
-
}], todayValue: [{
|
|
385
|
-
type: Input
|
|
386
|
-
}], selectedValue: [{
|
|
387
|
-
type: Input
|
|
388
|
-
}], labelMinRequiredCells: [{
|
|
389
|
-
type: Input
|
|
390
|
-
}], numCols: [{
|
|
391
|
-
type: Input
|
|
392
|
-
}], allowDisabledSelection: [{
|
|
393
|
-
type: Input
|
|
394
|
-
}], activeCell: [{
|
|
395
|
-
type: Input
|
|
396
|
-
}], selectedValueChange: [{
|
|
397
|
-
type: Output
|
|
398
|
-
}], class: [{
|
|
399
|
-
type: HostBinding,
|
|
400
|
-
args: ['class']
|
|
401
|
-
}] } });
|
|
405
|
+
args: [{ selector: '[cmat-datetimepicker-calendar-body]', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerCalendarBody', imports: [], host: { 'class': 'cmat-datetimepicker-calendar-body' }, template: "@if (_firstRowOffset < labelMinRequiredCells()) {\r\n<tr aria-hidden=\"true\">\r\n <td\r\n class=\"cmat-datetimepicker-calendar-body-label\"\r\n [attr.colspan]=\"numCols()\"\r\n >\r\n {{ label() }}\r\n </td>\r\n</tr>\r\n} @for (row of rows(); track $index; let rowIndex = $index) {\r\n<tr role=\"row\">\r\n @if (rowIndex === 0 && _firstRowOffset) {\r\n <td\r\n aria-hidden=\"true\"\r\n class=\"cmat-datetimepicker-calendar-body-label\"\r\n [attr.colspan]=\"_firstRowOffset\"\r\n >\r\n {{ _firstRowOffset >= labelMinRequiredCells() ? label() : '' }}\r\n </td>\r\n } @for (item of row; track $index; let colIndex = $index) {\r\n <td\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-body-cell\"\r\n [attr.aria-disabled]=\"!item.enabled || null\"\r\n [attr.aria-label]=\"item.ariaLabel\"\r\n [class.cmat-datetimepicker-calendar-body-active]=\"isActiveCell(rowIndex, colIndex)\"\r\n [class.cmat-datetimepicker-calendar-body-disabled]=\"!item.enabled\"\r\n (click)=\"cellClicked(item)\"\r\n >\r\n <div\r\n class=\"cmat-datetimepicker-calendar-body-cell-content\"\r\n [attr.aria-selected]=\"selectedValue() === item.value\"\r\n [class.cmat-datetimepicker-calendar-body-selected]=\"selectedValue() === item.value\"\r\n [class.cmat-datetimepicker-calendar-body-today]=\"todayValue() === item.value\"\r\n >\r\n {{ item.displayValue }}\r\n </div>\r\n </td>\r\n }\r\n</tr>\r\n}\r\n", styles: [".cmat-datetimepicker-calendar-body{min-width:224px}.cmat-datetimepicker-calendar-body-label{height:0;line-height:0;text-align:left;padding:calc(14.2857142857% / 2) 4.7142857143%}[dir=rtl] .cmat-datetimepicker-calendar-body-label{text-align:right}.cmat-datetimepicker-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:calc(14.2857142857% / 2) 0;text-align:center;outline:none;cursor:pointer}.cmat-datetimepicker-calendar-body-disabled{cursor:default;pointer-events:none}.cmat-datetimepicker-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"] }]
|
|
406
|
+
}], propDecorators: { selectedValueChange: [{ type: i0.Output, args: ["selectedValueChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], todayValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "todayValue", required: false }] }], selectedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValue", required: false }] }], labelMinRequiredCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelMinRequiredCells", required: false }] }], numCols: [{ type: i0.Input, args: [{ isSignal: true, alias: "numCols", required: false }] }], allowDisabledSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDisabledSelection", required: false }] }], activeCell: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeCell", required: false }] }] } });
|
|
402
407
|
|
|
403
408
|
const DAYS_PER_WEEK = 7;
|
|
404
409
|
class CmatDatetimepickerMonthViewComponent {
|
|
405
410
|
constructor() {
|
|
406
|
-
this.
|
|
407
|
-
this.
|
|
408
|
-
this.
|
|
409
|
-
|
|
411
|
+
this.userSelection = output();
|
|
412
|
+
this.selectedChange = output();
|
|
413
|
+
this.type = input('date', /* @ts-ignore */
|
|
414
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
415
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
416
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
417
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
418
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
419
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
420
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
421
|
+
this.selected = input(null, /* @ts-ignore */
|
|
422
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
423
|
+
this.weeks = signal([], /* @ts-ignore */
|
|
424
|
+
...(ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []));
|
|
425
|
+
this.firstWeekOffset = signal(0, /* @ts-ignore */
|
|
426
|
+
...(ngDevMode ? [{ debugName: "firstWeekOffset" }] : /* istanbul ignore next */ []));
|
|
427
|
+
this.selectedDate = signal(null, /* @ts-ignore */
|
|
428
|
+
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
429
|
+
this.todayDate = signal(null, /* @ts-ignore */
|
|
430
|
+
...(ngDevMode ? [{ debugName: "todayDate" }] : /* istanbul ignore next */ []));
|
|
431
|
+
this.calendarState = signal('', /* @ts-ignore */
|
|
432
|
+
...(ngDevMode ? [{ debugName: "calendarState" }] : /* istanbul ignore next */ []));
|
|
433
|
+
this.activeDate = input.required(/* @ts-ignore */
|
|
434
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
435
|
+
this.resolvedActiveDate = computed(() => {
|
|
436
|
+
const date = this._activeDate();
|
|
437
|
+
return date ?? this.adapter.today();
|
|
438
|
+
}, /* @ts-ignore */
|
|
439
|
+
...(ngDevMode ? [{ debugName: "resolvedActiveDate" }] : /* istanbul ignore next */ []));
|
|
410
440
|
this.adapter = inject(DatetimeAdapter, { optional: true });
|
|
411
|
-
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
441
|
+
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
442
|
+
optional: true,
|
|
443
|
+
});
|
|
444
|
+
this._activeDate = signal(null, /* @ts-ignore */
|
|
445
|
+
...(ngDevMode ? [{ debugName: "_activeDate" }] : /* istanbul ignore next */ []));
|
|
412
446
|
this._elementRef = inject(ElementRef);
|
|
413
447
|
this._calendarAnimationListener = this.calendarStateDone.bind(this);
|
|
414
448
|
if (!this.adapter) {
|
|
@@ -420,35 +454,33 @@ class CmatDatetimepickerMonthViewComponent {
|
|
|
420
454
|
const firstDayOfWeek = this.adapter.getFirstDayOfWeek();
|
|
421
455
|
const narrowWeekdays = this.adapter.getDayOfWeekNames('narrow');
|
|
422
456
|
const longWeekdays = this.adapter.getDayOfWeekNames('long');
|
|
423
|
-
const weekdays = longWeekdays.map((long, i) => ({
|
|
424
|
-
|
|
425
|
-
|
|
457
|
+
const weekdays = longWeekdays.map((long, i) => ({
|
|
458
|
+
long,
|
|
459
|
+
narrow: narrowWeekdays[i],
|
|
460
|
+
}));
|
|
461
|
+
this.weekdays = weekdays
|
|
462
|
+
.slice(firstDayOfWeek)
|
|
463
|
+
.concat(weekdays.slice(0, firstDayOfWeek));
|
|
426
464
|
this._elementRef.nativeElement.addEventListener('animationend', this._calendarAnimationListener);
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
get selected() {
|
|
447
|
-
return this._selected;
|
|
448
|
-
}
|
|
449
|
-
set selected(value) {
|
|
450
|
-
this._selected = value;
|
|
451
|
-
this.selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
465
|
+
effect(() => {
|
|
466
|
+
const value = this.activeDate();
|
|
467
|
+
const oldActiveDate = this._activeDate();
|
|
468
|
+
this._activeDate.set(value ?? this.adapter.today());
|
|
469
|
+
const newActiveDate = this.resolvedActiveDate();
|
|
470
|
+
untracked(() => {
|
|
471
|
+
if (oldActiveDate &&
|
|
472
|
+
newActiveDate &&
|
|
473
|
+
!this.adapter.sameMonthAndYear(oldActiveDate, newActiveDate)) {
|
|
474
|
+
this._init();
|
|
475
|
+
if (this.adapter.isInNextMonth(oldActiveDate, newActiveDate)) {
|
|
476
|
+
this._changeCalendarState('right');
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this._changeCalendarState('left');
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
});
|
|
452
484
|
}
|
|
453
485
|
ngAfterContentInit() {
|
|
454
486
|
this._init();
|
|
@@ -457,79 +489,106 @@ class CmatDatetimepickerMonthViewComponent {
|
|
|
457
489
|
this._elementRef.nativeElement.removeEventListener('animationend', this._calendarAnimationListener);
|
|
458
490
|
}
|
|
459
491
|
dateSelected(date) {
|
|
460
|
-
|
|
461
|
-
|
|
492
|
+
const currentDate = this.resolvedActiveDate();
|
|
493
|
+
this.selectedChange.emit(this.adapter.createDatetime(this.adapter.getYear(currentDate), this.adapter.getMonth(currentDate), date, this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate)));
|
|
494
|
+
if (this.type() === 'date') {
|
|
462
495
|
this.userSelection.emit();
|
|
463
496
|
}
|
|
464
497
|
}
|
|
465
498
|
calendarStateDone(event) {
|
|
466
|
-
if (event.animationName === 'slideCalendarLeft' ||
|
|
499
|
+
if (event.animationName === 'slideCalendarLeft' ||
|
|
500
|
+
event.animationName === 'slideCalendarRight') {
|
|
467
501
|
this.calendarState.set('');
|
|
468
502
|
}
|
|
469
503
|
}
|
|
470
504
|
_init() {
|
|
471
|
-
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
this.
|
|
475
|
-
|
|
476
|
-
|
|
505
|
+
const selectedValue = this.selected();
|
|
506
|
+
this.selectedDate.set(this._getDateInCurrentMonth(selectedValue));
|
|
507
|
+
this.todayDate.set(this._getDateInCurrentMonth(this.adapter.today()));
|
|
508
|
+
const currentDate = this.resolvedActiveDate();
|
|
509
|
+
const firstOfMonth = this.adapter.createDatetime(this.adapter.getYear(currentDate), this.adapter.getMonth(currentDate), 1, this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate));
|
|
510
|
+
this.firstWeekOffset.set((DAYS_PER_WEEK +
|
|
511
|
+
this.adapter.getDayOfWeek(firstOfMonth) -
|
|
512
|
+
this.adapter.getFirstDayOfWeek()) %
|
|
513
|
+
DAYS_PER_WEEK);
|
|
477
514
|
this._createWeekCells();
|
|
478
515
|
}
|
|
479
516
|
_createWeekCells() {
|
|
480
|
-
const
|
|
517
|
+
const currentDate = this.resolvedActiveDate();
|
|
518
|
+
const daysInMonth = this.adapter.getNumDaysInMonth(currentDate);
|
|
481
519
|
const dateNames = this.adapter.getDateNames();
|
|
482
|
-
|
|
483
|
-
for (let i = 0, cell = this.firstWeekOffset; i < daysInMonth; i++, cell++) {
|
|
520
|
+
const weeksList = [[]];
|
|
521
|
+
for (let i = 0, cell = this.firstWeekOffset(); i < daysInMonth; i++, cell++) {
|
|
484
522
|
if (cell === DAYS_PER_WEEK) {
|
|
485
|
-
|
|
523
|
+
weeksList.push([]);
|
|
486
524
|
cell = 0;
|
|
487
525
|
}
|
|
488
|
-
const date = this.adapter.createDatetime(this.adapter.getYear(
|
|
489
|
-
const
|
|
490
|
-
|
|
526
|
+
const date = this.adapter.createDatetime(this.adapter.getYear(currentDate), this.adapter.getMonth(currentDate), i + 1, this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate));
|
|
527
|
+
const dateFilter = this.dateFilter();
|
|
528
|
+
const enabled = !dateFilter || dateFilter(date);
|
|
491
529
|
const ariaLabel = this.adapter.format(date, this._dateFormats.display.dateA11yLabel);
|
|
492
|
-
|
|
493
|
-
.push(new CmatDatetimepickerCalendarCellComponent(i + 1, dateNames[i], ariaLabel, enabled));
|
|
530
|
+
weeksList[weeksList.length - 1].push(new CmatDatetimepickerCalendarCellComponent(i + 1, dateNames[i], ariaLabel, enabled));
|
|
494
531
|
}
|
|
532
|
+
this.weeks.set(weeksList);
|
|
495
533
|
}
|
|
496
534
|
_getDateInCurrentMonth(date) {
|
|
497
|
-
|
|
498
|
-
|
|
535
|
+
if (!date) {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
return this.adapter.sameMonthAndYear(date, this.resolvedActiveDate())
|
|
539
|
+
? this.adapter.getDate(date)
|
|
540
|
+
: null;
|
|
499
541
|
}
|
|
500
542
|
_changeCalendarState(direction) {
|
|
501
543
|
this.calendarState.set(direction);
|
|
502
544
|
}
|
|
503
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
504
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
545
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerMonthViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
546
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerMonthViewComponent, isStandalone: true, selector: "cmat-datetimepicker-month-view", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange" }, exportAs: ["cmatDatetimepickerMonthView"], ngImport: i0, template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\">\r\n <tr>\r\n @for (day of weekdays; track $index) {\r\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\r\n }\r\n </tr>\r\n <tr>\r\n <th colspan=\"7\" class=\"cmat-calendar-table-header-divider\"></th>\r\n </tr>\r\n </thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getDate(activeDate()) - 1\" [rows]=\"weeks()\"\r\n [selectedValue]=\"selectedDate()\" [todayValue]=\"todayDate()\" (selectedValueChange)=\"dateSelected($event)\">\r\n </tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"], dependencies: [{ kind: "component", type: CmatDatetimepickerCalendarBodyComponent, selector: "[cmat-datetimepicker-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["cmatDatetimepickerCalendarBody"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
505
547
|
}
|
|
506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerMonthViewComponent, decorators: [{
|
|
507
549
|
type: Component,
|
|
508
|
-
args: [{ selector: 'cmat-datetimepicker-month-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerMonthView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\">\r\n <tr>\r\n @for (day of weekdays; track $index) {\r\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\r\n }\r\n </tr>\r\n <tr>\r\n <th colspan=\"7\" class=\"cmat-calendar-table-header-divider\"></th>\r\n </tr>\r\n </thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getDate(activeDate) - 1\" [rows]=\"weeks\"\r\n [selectedValue]=\"selectedDate\" [todayValue]=\"todayDate\" (selectedValueChange)=\"dateSelected($event)\">\r\n </tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
509
|
-
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
510
|
-
type: Input
|
|
511
|
-
}], userSelection: [{
|
|
512
|
-
type: Output
|
|
513
|
-
}], dateFilter: [{
|
|
514
|
-
type: Input
|
|
515
|
-
}], selectedChange: [{
|
|
516
|
-
type: Output
|
|
517
|
-
}], activeDate: [{
|
|
518
|
-
type: Input
|
|
519
|
-
}], selected: [{
|
|
520
|
-
type: Input
|
|
521
|
-
}] } });
|
|
550
|
+
args: [{ selector: 'cmat-datetimepicker-month-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerMonthView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\">\r\n <tr>\r\n @for (day of weekdays; track $index) {\r\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\r\n }\r\n </tr>\r\n <tr>\r\n <th colspan=\"7\" class=\"cmat-calendar-table-header-divider\"></th>\r\n </tr>\r\n </thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getDate(activeDate()) - 1\" [rows]=\"weeks()\"\r\n [selectedValue]=\"selectedDate()\" [todayValue]=\"todayDate()\" (selectedValueChange)=\"dateSelected($event)\">\r\n </tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
551
|
+
}], ctorParameters: () => [], propDecorators: { userSelection: [{ type: i0.Output, args: ["userSelection"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }] } });
|
|
522
552
|
|
|
523
553
|
const yearsPerPage = 24;
|
|
524
554
|
const yearsPerRow = 4;
|
|
525
555
|
class CmatDatetimepickerMultiYearViewComponent {
|
|
526
556
|
constructor() {
|
|
527
|
-
this.userSelection =
|
|
528
|
-
this.
|
|
529
|
-
this.
|
|
530
|
-
|
|
557
|
+
this.userSelection = output();
|
|
558
|
+
this.selectedChange = output();
|
|
559
|
+
this.type = input('date', /* @ts-ignore */
|
|
560
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
561
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
562
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
563
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
564
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
565
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
566
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
567
|
+
this.selected = input(null, /* @ts-ignore */
|
|
568
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
569
|
+
this.years = signal([], /* @ts-ignore */
|
|
570
|
+
...(ngDevMode ? [{ debugName: "years" }] : /* istanbul ignore next */ []));
|
|
571
|
+
this.yearLabel = signal('', /* @ts-ignore */
|
|
572
|
+
...(ngDevMode ? [{ debugName: "yearLabel" }] : /* istanbul ignore next */ []));
|
|
573
|
+
this.todayYear = signal(0, /* @ts-ignore */
|
|
574
|
+
...(ngDevMode ? [{ debugName: "todayYear" }] : /* istanbul ignore next */ []));
|
|
575
|
+
this.selectedYear = signal(null, /* @ts-ignore */
|
|
576
|
+
...(ngDevMode ? [{ debugName: "selectedYear" }] : /* istanbul ignore next */ []));
|
|
577
|
+
this.calendarState = signal('', /* @ts-ignore */
|
|
578
|
+
...(ngDevMode ? [{ debugName: "calendarState" }] : /* istanbul ignore next */ []));
|
|
579
|
+
this.activeDate = input.required(/* @ts-ignore */
|
|
580
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
581
|
+
this.resolvedActiveDate = computed(() => {
|
|
582
|
+
const date = this._activeDate();
|
|
583
|
+
return date ?? this.adapter.today();
|
|
584
|
+
}, /* @ts-ignore */
|
|
585
|
+
...(ngDevMode ? [{ debugName: "resolvedActiveDate" }] : /* istanbul ignore next */ []));
|
|
531
586
|
this.adapter = inject(DatetimeAdapter, { optional: true });
|
|
532
|
-
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
587
|
+
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
588
|
+
optional: true,
|
|
589
|
+
});
|
|
590
|
+
this._activeDate = signal(null, /* @ts-ignore */
|
|
591
|
+
...(ngDevMode ? [{ debugName: "_activeDate" }] : /* istanbul ignore next */ []));
|
|
533
592
|
this._elementRef = inject(ElementRef);
|
|
534
593
|
this._calendarAnimationListener = this.calendarStateDone.bind(this);
|
|
535
594
|
if (!this.adapter) {
|
|
@@ -538,47 +597,27 @@ class CmatDatetimepickerMultiYearViewComponent {
|
|
|
538
597
|
if (!this._dateFormats) {
|
|
539
598
|
throw createMissingDateImplError('CMAT_DATETIME_FORMATS');
|
|
540
599
|
}
|
|
541
|
-
this._activeDate = this.adapter.today();
|
|
542
600
|
this._elementRef.nativeElement.addEventListener('animationend', this._calendarAnimationListener);
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return this._selected;
|
|
564
|
-
}
|
|
565
|
-
set selected(value) {
|
|
566
|
-
this._selected = value;
|
|
567
|
-
this.selectedYear = this._selected && this.adapter.getYear(this._selected);
|
|
568
|
-
}
|
|
569
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
570
|
-
get minDate() {
|
|
571
|
-
return this._minDate;
|
|
572
|
-
}
|
|
573
|
-
set minDate(value) {
|
|
574
|
-
this._minDate = this._getValidDateOrNull(this.adapter.deserialize(value));
|
|
575
|
-
}
|
|
576
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
577
|
-
get maxDate() {
|
|
578
|
-
return this._maxDate;
|
|
579
|
-
}
|
|
580
|
-
set maxDate(value) {
|
|
581
|
-
this._maxDate = this._getValidDateOrNull(this.adapter.deserialize(value));
|
|
601
|
+
effect(() => {
|
|
602
|
+
const inputValue = this.activeDate();
|
|
603
|
+
const newActiveDate = inputValue ?? this.adapter.today();
|
|
604
|
+
const oldActiveDate = this._previousActiveDate;
|
|
605
|
+
this._activeDate.set(newActiveDate);
|
|
606
|
+
this._previousActiveDate = newActiveDate;
|
|
607
|
+
untracked(() => {
|
|
608
|
+
if (oldActiveDate &&
|
|
609
|
+
newActiveDate &&
|
|
610
|
+
!isSameMultiYearView(this.adapter, oldActiveDate, newActiveDate, this.minDate(), this.maxDate())) {
|
|
611
|
+
this._init();
|
|
612
|
+
if (this.adapter.isInNextMonth(oldActiveDate, newActiveDate)) {
|
|
613
|
+
this._changeCalendarState('right');
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
this._changeCalendarState('left');
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
});
|
|
582
621
|
}
|
|
583
622
|
ngAfterContentInit() {
|
|
584
623
|
this._init();
|
|
@@ -587,95 +626,82 @@ class CmatDatetimepickerMultiYearViewComponent {
|
|
|
587
626
|
this._elementRef.nativeElement.removeEventListener('animationend', this._calendarAnimationListener);
|
|
588
627
|
}
|
|
589
628
|
yearSelected(year) {
|
|
590
|
-
const
|
|
629
|
+
const currentDate = this.resolvedActiveDate();
|
|
630
|
+
const month = this.adapter.getMonth(currentDate);
|
|
591
631
|
const normalizedDate = this.adapter.createDatetime(year, month, 1, 0, 0);
|
|
592
|
-
this.selectedChange.emit(this.adapter.createDatetime(year, month, Math.min(this.adapter.getDate(
|
|
593
|
-
if (this.type === 'year') {
|
|
632
|
+
this.selectedChange.emit(this.adapter.createDatetime(year, month, Math.min(this.adapter.getDate(currentDate), this.adapter.getNumDaysInMonth(normalizedDate)), this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate)));
|
|
633
|
+
if (this.type() === 'year') {
|
|
594
634
|
this.userSelection.emit();
|
|
595
635
|
}
|
|
596
636
|
}
|
|
597
637
|
getActiveCell() {
|
|
598
|
-
return getActiveOffset(this.adapter, this.
|
|
638
|
+
return getActiveOffset(this.adapter, this.resolvedActiveDate(), this.minDate(), this.maxDate());
|
|
599
639
|
}
|
|
600
640
|
calendarStateDone(event) {
|
|
601
|
-
if (event.animationName === 'slideCalendarLeft' ||
|
|
641
|
+
if (event.animationName === 'slideCalendarLeft' ||
|
|
642
|
+
event.animationName === 'slideCalendarRight') {
|
|
602
643
|
this.calendarState.set('');
|
|
603
644
|
}
|
|
604
645
|
}
|
|
605
646
|
_init() {
|
|
606
|
-
this.todayYear
|
|
607
|
-
this.yearLabel
|
|
608
|
-
const activeYear = this.adapter.getYear(this.
|
|
609
|
-
const minYearOfPage = activeYear -
|
|
610
|
-
|
|
647
|
+
this.todayYear.set(this.adapter.getYear(this.adapter.today()));
|
|
648
|
+
this.yearLabel.set(this.adapter.getYearName(this.resolvedActiveDate()));
|
|
649
|
+
const activeYear = this.adapter.getYear(this.resolvedActiveDate());
|
|
650
|
+
const minYearOfPage = activeYear -
|
|
651
|
+
getActiveOffset(this.adapter, this.resolvedActiveDate(), this.minDate(), this.maxDate());
|
|
652
|
+
const yearsList = [];
|
|
611
653
|
for (let i = 0, row = []; i < yearsPerPage; i++) {
|
|
612
654
|
row.push(minYearOfPage + i);
|
|
613
655
|
if (row.length === yearsPerRow) {
|
|
614
|
-
|
|
656
|
+
yearsList.push(row.map(year => this._createCellForYear(year)));
|
|
615
657
|
row = [];
|
|
616
658
|
}
|
|
617
659
|
}
|
|
660
|
+
this.years.set(yearsList);
|
|
618
661
|
}
|
|
619
662
|
_createCellForYear(year) {
|
|
620
663
|
const yearName = this.adapter.getYearName(this.adapter.createDate(year, 0, 1));
|
|
621
664
|
return new CmatDatetimepickerCalendarCellComponent(year, yearName, yearName, this._shouldEnableYear(year));
|
|
622
665
|
}
|
|
623
666
|
_shouldEnableYear(year) {
|
|
624
|
-
if (year === undefined ||
|
|
625
|
-
|
|
626
|
-
(this.
|
|
667
|
+
if (year === undefined ||
|
|
668
|
+
year === null ||
|
|
669
|
+
(this.maxDate() && year > this.adapter.getYear(this.maxDate())) ||
|
|
670
|
+
(this.minDate() && year < this.adapter.getYear(this.minDate()))) {
|
|
627
671
|
return false;
|
|
628
672
|
}
|
|
629
|
-
|
|
673
|
+
const dateFilter = this.dateFilter();
|
|
674
|
+
if (!dateFilter) {
|
|
630
675
|
return true;
|
|
631
676
|
}
|
|
632
677
|
const firstOfYear = this.adapter.createDate(year, 0, 1);
|
|
633
678
|
for (let date = firstOfYear; this.adapter.getYear(date) === year; date = this.adapter.addCalendarDays(date, 1)) {
|
|
634
|
-
if (
|
|
679
|
+
if (dateFilter(date)) {
|
|
635
680
|
return true;
|
|
636
681
|
}
|
|
637
682
|
}
|
|
638
683
|
return false;
|
|
639
684
|
}
|
|
640
|
-
_getValidDateOrNull(obj) {
|
|
641
|
-
return (this.adapter.isDateInstance(obj) && this.adapter.isValid(obj)) ? obj : null;
|
|
642
|
-
}
|
|
643
685
|
_changeCalendarState(direction) {
|
|
644
686
|
this.calendarState.set(direction);
|
|
645
687
|
}
|
|
646
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
647
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
688
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerMultiYearViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
689
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatDatetimepickerMultiYearViewComponent, isStandalone: true, selector: "cmat-datetimepicker-multi-year-view", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange" }, exportAs: ["cmatDatetimepickerMultiYearView"], ngImport: i0, template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"getActiveCell()\" [numCols]=\"4\" [rows]=\"years()\"\r\n [selectedValue]=\"selectedYear()\" [todayValue]=\"todayYear()\" [allowDisabledSelection]=\"true\"\r\n (selectedValueChange)=\"yearSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"], dependencies: [{ kind: "component", type: CmatDatetimepickerCalendarBodyComponent, selector: "[cmat-datetimepicker-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["cmatDatetimepickerCalendarBody"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
648
690
|
}
|
|
649
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
691
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerMultiYearViewComponent, decorators: [{
|
|
650
692
|
type: Component,
|
|
651
|
-
args: [{ selector: 'cmat-datetimepicker-multi-year-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerMultiYearView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"getActiveCell()\" [numCols]=\"4\" [rows]=\"years\"\r\n [selectedValue]=\"selectedYear\" [todayValue]=\"todayYear\" [allowDisabledSelection]=\"true\"\r\n (selectedValueChange)=\"yearSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
652
|
-
}], ctorParameters: () => [], propDecorators: { userSelection: [{
|
|
653
|
-
type: Output
|
|
654
|
-
}], type: [{
|
|
655
|
-
type: Input
|
|
656
|
-
}], dateFilter: [{
|
|
657
|
-
type: Input
|
|
658
|
-
}], selectedChange: [{
|
|
659
|
-
type: Output
|
|
660
|
-
}], activeDate: [{
|
|
661
|
-
type: Input
|
|
662
|
-
}], selected: [{
|
|
663
|
-
type: Input
|
|
664
|
-
}], minDate: [{
|
|
665
|
-
type: Input
|
|
666
|
-
}], maxDate: [{
|
|
667
|
-
type: Input
|
|
668
|
-
}] } });
|
|
693
|
+
args: [{ selector: 'cmat-datetimepicker-multi-year-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerMultiYearView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"getActiveCell()\" [numCols]=\"4\" [rows]=\"years()\"\r\n [selectedValue]=\"selectedYear()\" [todayValue]=\"todayYear()\" [allowDisabledSelection]=\"true\"\r\n (selectedValueChange)=\"yearSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
694
|
+
}], ctorParameters: () => [], propDecorators: { userSelection: [{ type: i0.Output, args: ["userSelection"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }] } });
|
|
669
695
|
function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
|
|
670
696
|
const year1 = dateAdapter.getYear(date1);
|
|
671
697
|
const year2 = dateAdapter.getYear(date2);
|
|
672
698
|
const startingYear = getStartingYear(dateAdapter, minDate, maxDate);
|
|
673
|
-
return Math.floor((year1 - startingYear) / yearsPerPage) ===
|
|
674
|
-
Math.floor((year2 - startingYear) / yearsPerPage);
|
|
699
|
+
return (Math.floor((year1 - startingYear) / yearsPerPage) ===
|
|
700
|
+
Math.floor((year2 - startingYear) / yearsPerPage));
|
|
675
701
|
}
|
|
676
702
|
function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
|
|
677
703
|
const activeYear = dateAdapter.getYear(activeDate);
|
|
678
|
-
return euclideanModulo(
|
|
704
|
+
return euclideanModulo(activeYear - getStartingYear(dateAdapter, minDate, maxDate), yearsPerPage);
|
|
679
705
|
}
|
|
680
706
|
function getStartingYear(dateAdapter, minDate, maxDate) {
|
|
681
707
|
let startingYear = 0;
|
|
@@ -689,7 +715,7 @@ function getStartingYear(dateAdapter, minDate, maxDate) {
|
|
|
689
715
|
return startingYear;
|
|
690
716
|
}
|
|
691
717
|
function euclideanModulo(a, b) {
|
|
692
|
-
return (a % b + b) % b;
|
|
718
|
+
return ((a % b) + b) % b;
|
|
693
719
|
}
|
|
694
720
|
|
|
695
721
|
function pad(num, size) {
|
|
@@ -701,36 +727,58 @@ function pad(num, size) {
|
|
|
701
727
|
}
|
|
702
728
|
class CmatDatetimepickerTimeInputDirective {
|
|
703
729
|
constructor() {
|
|
704
|
-
this.
|
|
705
|
-
this.
|
|
706
|
-
|
|
707
|
-
this.
|
|
730
|
+
this.timeValueChanged = output();
|
|
731
|
+
this.timeInterval = input(1, /* @ts-ignore */
|
|
732
|
+
...(ngDevMode ? [{ debugName: "timeInterval" }] : /* istanbul ignore next */ []));
|
|
733
|
+
this.timeMin = input(0, /* @ts-ignore */
|
|
734
|
+
...(ngDevMode ? [{ debugName: "timeMin" }] : /* istanbul ignore next */ []));
|
|
735
|
+
this.timeMax = input(Infinity, /* @ts-ignore */
|
|
736
|
+
...(ngDevMode ? [{ debugName: "timeMax" }] : /* istanbul ignore next */ []));
|
|
737
|
+
this.timeValue = input(0, /* @ts-ignore */
|
|
738
|
+
...(ngDevMode ? [{ debugName: "timeValue" }] : /* istanbul ignore next */ []));
|
|
708
739
|
this._element = inject(ElementRef);
|
|
740
|
+
this._internalValue = signal(0, /* @ts-ignore */
|
|
741
|
+
...(ngDevMode ? [{ debugName: "_internalValue" }] : /* istanbul ignore next */ []));
|
|
709
742
|
this._keyDownListener = this.keyDownHandler.bind(this);
|
|
710
743
|
this._keyPressListener = this.keyPressHandler.bind(this);
|
|
711
744
|
this._inputEventListener = this.inputChangedHandler.bind(this);
|
|
712
|
-
this.
|
|
745
|
+
this._blurListener = this.blur.bind(this);
|
|
746
|
+
this._focusListener = this.focus.bind(this);
|
|
747
|
+
const element = this._element.nativeElement;
|
|
748
|
+
element.addEventListener('keydown', this._keyDownListener, {
|
|
713
749
|
passive: true,
|
|
714
750
|
});
|
|
715
|
-
|
|
716
|
-
|
|
751
|
+
element.addEventListener('keypress', this._keyPressListener);
|
|
752
|
+
element.addEventListener('input', this._inputEventListener, {
|
|
717
753
|
passive: true,
|
|
718
754
|
});
|
|
755
|
+
element.addEventListener('blur', this._blurListener);
|
|
756
|
+
element.addEventListener('focus', this._focusListener);
|
|
757
|
+
effect(() => {
|
|
758
|
+
const value = this.timeValue();
|
|
759
|
+
this._internalValue.set(coerceNumberProperty(value));
|
|
760
|
+
if (!this.hasFocus) {
|
|
761
|
+
this.writeValue(this._internalValue());
|
|
762
|
+
}
|
|
763
|
+
this.writePlaceholder(this._internalValue());
|
|
764
|
+
});
|
|
719
765
|
}
|
|
720
766
|
get hasFocus() {
|
|
721
|
-
return !!this._element.nativeElement &&
|
|
767
|
+
return (!!this._element.nativeElement &&
|
|
768
|
+
this._element?.nativeElement === document?.activeElement);
|
|
722
769
|
}
|
|
723
770
|
get inputElement() {
|
|
724
771
|
return this._element.nativeElement;
|
|
725
772
|
}
|
|
726
773
|
get valid() {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
774
|
+
const currentValue = this._internalValue();
|
|
775
|
+
if (currentValue) {
|
|
776
|
+
const currentInputElementValue = String(this.inputElement.value);
|
|
777
|
+
if (currentInputElementValue.length) {
|
|
778
|
+
return pad(currentValue, 2) === this.inputElement.value;
|
|
731
779
|
}
|
|
732
780
|
else {
|
|
733
|
-
return pad(
|
|
781
|
+
return pad(currentValue, 2) === this.inputElement.placeholder;
|
|
734
782
|
}
|
|
735
783
|
}
|
|
736
784
|
return true;
|
|
@@ -738,17 +786,16 @@ class CmatDatetimepickerTimeInputDirective {
|
|
|
738
786
|
get invalid() {
|
|
739
787
|
return !this.valid;
|
|
740
788
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
this.writePlaceholder(this._value);
|
|
789
|
+
setValue(value) {
|
|
790
|
+
const numericValue = coerceNumberProperty(value);
|
|
791
|
+
this._internalValue.set(numericValue);
|
|
792
|
+
this.writeValue(numericValue);
|
|
793
|
+
this.writePlaceholder(numericValue);
|
|
747
794
|
}
|
|
748
795
|
blur() {
|
|
749
|
-
this.writeValue(this.
|
|
750
|
-
this.writePlaceholder(this.
|
|
751
|
-
this.timeValueChanged.emit(this.
|
|
796
|
+
this.writeValue(this._internalValue());
|
|
797
|
+
this.writePlaceholder(this._internalValue());
|
|
798
|
+
this.timeValueChanged.emit(this._internalValue());
|
|
752
799
|
}
|
|
753
800
|
focus() {
|
|
754
801
|
this.writeValue('');
|
|
@@ -768,20 +815,20 @@ class CmatDatetimepickerTimeInputDirective {
|
|
|
768
815
|
if (String(this.inputElement.value).length > 0) {
|
|
769
816
|
let value = null;
|
|
770
817
|
if (event.code === 'ArrowUp') {
|
|
771
|
-
value = coerceNumberProperty(this.
|
|
772
|
-
value += this.timeInterval;
|
|
818
|
+
value = coerceNumberProperty(this._internalValue());
|
|
819
|
+
value += this.timeInterval();
|
|
773
820
|
event.stopPropagation();
|
|
774
821
|
}
|
|
775
822
|
else if (event.code === 'ArrowDown') {
|
|
776
|
-
value = coerceNumberProperty(this.
|
|
777
|
-
value -= this.timeInterval;
|
|
823
|
+
value = coerceNumberProperty(this._internalValue());
|
|
824
|
+
value -= this.timeInterval();
|
|
778
825
|
event.stopPropagation();
|
|
779
826
|
}
|
|
780
827
|
if (typeof value === 'number') {
|
|
781
828
|
this.writeValue(value);
|
|
782
829
|
this.writePlaceholder(value);
|
|
783
830
|
this.clampInputValue();
|
|
784
|
-
this.timeValueChanged.emit(this.
|
|
831
|
+
this.timeValueChanged.emit(this._internalValue());
|
|
785
832
|
}
|
|
786
833
|
}
|
|
787
834
|
}
|
|
@@ -793,7 +840,7 @@ class CmatDatetimepickerTimeInputDirective {
|
|
|
793
840
|
}
|
|
794
841
|
inputChangedHandler() {
|
|
795
842
|
this.clampInputValue();
|
|
796
|
-
this.timeValueChanged.emit(this.
|
|
843
|
+
this.timeValueChanged.emit(this._internalValue());
|
|
797
844
|
}
|
|
798
845
|
clampInputValue() {
|
|
799
846
|
if (this.inputElement?.value === '') {
|
|
@@ -801,12 +848,12 @@ class CmatDatetimepickerTimeInputDirective {
|
|
|
801
848
|
}
|
|
802
849
|
const value = coerceNumberProperty(this.inputElement?.value ?? null);
|
|
803
850
|
if (value) {
|
|
804
|
-
const clampedValue = Math.min(Math.max(value, this.timeMin), this.timeMax);
|
|
851
|
+
const clampedValue = Math.min(Math.max(value, this.timeMin()), this.timeMax());
|
|
805
852
|
if (clampedValue !== value) {
|
|
806
853
|
this.writeValue(clampedValue);
|
|
807
854
|
this.writePlaceholder(clampedValue);
|
|
808
855
|
}
|
|
809
|
-
this.
|
|
856
|
+
this._internalValue.set(clampedValue);
|
|
810
857
|
}
|
|
811
858
|
}
|
|
812
859
|
ngOnDestroy() {
|
|
@@ -814,132 +861,118 @@ class CmatDatetimepickerTimeInputDirective {
|
|
|
814
861
|
this.inputElement.removeEventListener('keypress', this._keyPressListener);
|
|
815
862
|
this.inputElement.removeEventListener('input', this._inputEventListener);
|
|
816
863
|
}
|
|
817
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
818
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
864
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerTimeInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
865
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: CmatDatetimepickerTimeInputDirective, isStandalone: true, selector: "input.cmat-datetimepicker-time-input", inputs: { timeInterval: { classPropertyName: "timeInterval", publicName: "timeInterval", isSignal: true, isRequired: false, transformFunction: null }, timeMin: { classPropertyName: "timeMin", publicName: "timeMin", isSignal: true, isRequired: false, transformFunction: null }, timeMax: { classPropertyName: "timeMax", publicName: "timeMax", isSignal: true, isRequired: false, transformFunction: null }, timeValue: { classPropertyName: "timeValue", publicName: "timeValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { timeValueChanged: "timeValueChanged" }, exportAs: ["cmatDatetimepickerTimeInput"], ngImport: i0 }); }
|
|
819
866
|
}
|
|
820
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerTimeInputDirective, decorators: [{
|
|
821
868
|
type: Directive,
|
|
822
869
|
args: [{
|
|
823
870
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
824
871
|
selector: 'input.cmat-datetimepicker-time-input',
|
|
825
|
-
exportAs: 'cmatDatetimepickerTimeInput'
|
|
872
|
+
exportAs: 'cmatDatetimepickerTimeInput',
|
|
826
873
|
}]
|
|
827
|
-
}], ctorParameters: () => [], propDecorators: { timeInterval: [{
|
|
828
|
-
type: Input
|
|
829
|
-
}], timeMin: [{
|
|
830
|
-
type: Input
|
|
831
|
-
}], timeMax: [{
|
|
832
|
-
type: Input
|
|
833
|
-
}], timeValueChanged: [{
|
|
834
|
-
type: Output
|
|
835
|
-
}], timeValue: [{
|
|
836
|
-
type: Input
|
|
837
|
-
}], blur: [{
|
|
838
|
-
type: HostListener,
|
|
839
|
-
args: ['blur', ['$event']]
|
|
840
|
-
}], focus: [{
|
|
841
|
-
type: HostListener,
|
|
842
|
-
args: ['focus', ['$event']]
|
|
843
|
-
}] } });
|
|
874
|
+
}], ctorParameters: () => [], propDecorators: { timeValueChanged: [{ type: i0.Output, args: ["timeValueChanged"] }], timeInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInterval", required: false }] }], timeMin: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeMin", required: false }] }], timeMax: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeMax", required: false }] }], timeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeValue", required: false }] }] } });
|
|
844
875
|
class CmatDatetimepickerTimeComponent {
|
|
845
876
|
constructor() {
|
|
846
|
-
this.selectedChange =
|
|
847
|
-
this.activeDateChange =
|
|
848
|
-
this.userSelection =
|
|
849
|
-
this.ampmChange =
|
|
850
|
-
this.clockViewChange =
|
|
851
|
-
this.
|
|
877
|
+
this.selectedChange = output();
|
|
878
|
+
this.activeDateChange = output();
|
|
879
|
+
this.userSelection = output();
|
|
880
|
+
this.ampmChange = output();
|
|
881
|
+
this.clockViewChange = output();
|
|
882
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
883
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
884
|
+
this.interval = input(1, /* @ts-ignore */
|
|
885
|
+
...(ngDevMode ? [{ debugName: "interval" }] : /* istanbul ignore next */ []));
|
|
852
886
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
853
|
-
this.AMPM = 'AM'
|
|
854
|
-
|
|
855
|
-
this.
|
|
887
|
+
this.AMPM = input('AM', /* @ts-ignore */
|
|
888
|
+
...(ngDevMode ? [{ debugName: "AMPM" }] : /* istanbul ignore next */ []));
|
|
889
|
+
this.twelvehour = input(false, { ...(ngDevMode ? { debugName: "twelvehour" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
890
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
891
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
892
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
893
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
894
|
+
this.selected = input(null, /* @ts-ignore */
|
|
895
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
896
|
+
this.clockView = input('hour', /* @ts-ignore */
|
|
897
|
+
...(ngDevMode ? [{ debugName: "clockView" }] : /* istanbul ignore next */ []));
|
|
898
|
+
this.intlVersion = signal(0, /* @ts-ignore */
|
|
899
|
+
...(ngDevMode ? [{ debugName: "intlVersion" }] : /* istanbul ignore next */ []));
|
|
900
|
+
this.activeDate = computed(() => {
|
|
901
|
+
const date = this._activeDate();
|
|
902
|
+
if (!date) {
|
|
903
|
+
return this._adapter.today();
|
|
904
|
+
}
|
|
905
|
+
return this._adapter.clampDate(date, this.minDate(), this.maxDate());
|
|
906
|
+
}, /* @ts-ignore */
|
|
907
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
908
|
+
this.isHourView = computed(() => this._clockView() === 'hour', /* @ts-ignore */
|
|
909
|
+
...(ngDevMode ? [{ debugName: "isHourView" }] : /* istanbul ignore next */ []));
|
|
910
|
+
this.isMinuteView = computed(() => this._clockView() === 'minute', /* @ts-ignore */
|
|
911
|
+
...(ngDevMode ? [{ debugName: "isMinuteView" }] : /* istanbul ignore next */ []));
|
|
912
|
+
this.hour = computed(() => {
|
|
913
|
+
const currentDate = this.activeDate();
|
|
914
|
+
if (!currentDate) {
|
|
915
|
+
if (this.twelvehour()) {
|
|
916
|
+
return '12';
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
return '00';
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
const hour = Number(this._adapter.getHour(currentDate));
|
|
923
|
+
if (!this.twelvehour()) {
|
|
924
|
+
return this.prefixWithZero(hour);
|
|
925
|
+
}
|
|
926
|
+
if (hour === 0) {
|
|
927
|
+
return '12';
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
return this.prefixWithZero(hour > 12 ? hour - 12 : hour);
|
|
931
|
+
}
|
|
932
|
+
}, /* @ts-ignore */
|
|
933
|
+
...(ngDevMode ? [{ debugName: "hour" }] : /* istanbul ignore next */ []));
|
|
934
|
+
this.minute = computed(() => {
|
|
935
|
+
const currentDate = this.activeDate();
|
|
936
|
+
if (currentDate) {
|
|
937
|
+
return this.prefixWithZero(this._adapter.getMinute(currentDate));
|
|
938
|
+
}
|
|
939
|
+
return '00';
|
|
940
|
+
}, /* @ts-ignore */
|
|
941
|
+
...(ngDevMode ? [{ debugName: "minute" }] : /* istanbul ignore next */ []));
|
|
942
|
+
this.currentClockView = computed(() => this._clockView(), /* @ts-ignore */
|
|
943
|
+
...(ngDevMode ? [{ debugName: "currentClockView" }] : /* istanbul ignore next */ []));
|
|
944
|
+
this.hourInputElement = viewChild('hourInput', /* @ts-ignore */
|
|
945
|
+
...(ngDevMode ? [{ debugName: "hourInputElement" }] : /* istanbul ignore next */ []));
|
|
946
|
+
this.hourInputDirective = viewChild('hourInput', /* @ts-ignore */
|
|
947
|
+
...(ngDevMode ? [{ debugName: "hourInputDirective" }] : /* istanbul ignore next */ []));
|
|
948
|
+
this.minuteInputElement = viewChild('minuteInput', /* @ts-ignore */
|
|
949
|
+
...(ngDevMode ? [{ debugName: "minuteInputElement" }] : /* istanbul ignore next */ []));
|
|
950
|
+
this.minuteInputDirective = viewChild('minuteInput', /* @ts-ignore */
|
|
951
|
+
...(ngDevMode ? [{ debugName: "minuteInputDirective" }] : /* istanbul ignore next */ []));
|
|
856
952
|
this.datetimepickerIntl = inject(CmatDatetimepickerIntl);
|
|
953
|
+
this._clockView = signal('hour', /* @ts-ignore */
|
|
954
|
+
...(ngDevMode ? [{ debugName: "_clockView" }] : /* istanbul ignore next */ []));
|
|
857
955
|
this._adapter = inject(DatetimeAdapter);
|
|
858
956
|
this._destroyRef = inject(DestroyRef);
|
|
859
|
-
this.
|
|
860
|
-
|
|
957
|
+
this._activeDate = signal(null, /* @ts-ignore */
|
|
958
|
+
...(ngDevMode ? [{ debugName: "_activeDate" }] : /* istanbul ignore next */ []));
|
|
861
959
|
this.datetimepickerIntl.changes
|
|
862
960
|
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
863
961
|
.subscribe(() => {
|
|
864
962
|
this.intlVersion.update(value => value + 1);
|
|
865
963
|
});
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
return this._clockView === 'minute';
|
|
872
|
-
}
|
|
873
|
-
get hour() {
|
|
874
|
-
if (!this.activeDate) {
|
|
875
|
-
if (this.twelvehour) {
|
|
876
|
-
return '12';
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
879
|
-
return '00';
|
|
964
|
+
// Watch for selected changes
|
|
965
|
+
effect(() => {
|
|
966
|
+
const selectedValue = this.selected();
|
|
967
|
+
if (selectedValue) {
|
|
968
|
+
this._activeDate.set(selectedValue);
|
|
880
969
|
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
return '12';
|
|
888
|
-
}
|
|
889
|
-
else {
|
|
890
|
-
return this.prefixWithZero(hour > 12 ? hour - 12 : hour);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
get minute() {
|
|
894
|
-
if (this.activeDate) {
|
|
895
|
-
return this.prefixWithZero(this._adapter.getMinute(this.activeDate));
|
|
896
|
-
}
|
|
897
|
-
return '00';
|
|
898
|
-
}
|
|
899
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
900
|
-
get twelvehour() {
|
|
901
|
-
return this._twelvehour;
|
|
902
|
-
}
|
|
903
|
-
set twelvehour(value) {
|
|
904
|
-
this._twelvehour = coerceBooleanProperty(value);
|
|
905
|
-
}
|
|
906
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
907
|
-
get activeDate() {
|
|
908
|
-
return this._activeDate;
|
|
909
|
-
}
|
|
910
|
-
set activeDate(value) {
|
|
911
|
-
this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
912
|
-
}
|
|
913
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
914
|
-
get selected() {
|
|
915
|
-
return this._selected;
|
|
916
|
-
}
|
|
917
|
-
set selected(value) {
|
|
918
|
-
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
919
|
-
if (this._selected) {
|
|
920
|
-
this.activeDate = this._selected;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
924
|
-
get minDate() {
|
|
925
|
-
return this._minDate;
|
|
926
|
-
}
|
|
927
|
-
set minDate(value) {
|
|
928
|
-
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
929
|
-
}
|
|
930
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
931
|
-
get maxDate() {
|
|
932
|
-
return this._maxDate;
|
|
933
|
-
}
|
|
934
|
-
set maxDate(value) {
|
|
935
|
-
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
936
|
-
}
|
|
937
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
938
|
-
get clockView() {
|
|
939
|
-
return this._clockView;
|
|
940
|
-
}
|
|
941
|
-
set clockView(value) {
|
|
942
|
-
this._clockView = value;
|
|
970
|
+
});
|
|
971
|
+
effect(() => {
|
|
972
|
+
const clockView = this.clockView();
|
|
973
|
+
this._clockView.set(clockView);
|
|
974
|
+
this.focusInputElement();
|
|
975
|
+
});
|
|
943
976
|
}
|
|
944
977
|
prefixWithZero(value) {
|
|
945
978
|
if (value < 10) {
|
|
@@ -947,44 +980,41 @@ class CmatDatetimepickerTimeComponent {
|
|
|
947
980
|
}
|
|
948
981
|
return String(value);
|
|
949
982
|
}
|
|
950
|
-
ngOnChanges(changes) {
|
|
951
|
-
if (changes['clockView']) {
|
|
952
|
-
if (changes['clockView'].currentValue !== changes['clockView'].previousValue) {
|
|
953
|
-
this.focusInputElement();
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
983
|
ngAfterViewInit() {
|
|
958
984
|
this.focusInputElement();
|
|
959
985
|
}
|
|
960
986
|
focusInputElement() {
|
|
961
|
-
if (this.
|
|
962
|
-
|
|
963
|
-
|
|
987
|
+
if (this.currentClockView() === 'hour') {
|
|
988
|
+
const hourInput = this.hourInputElement();
|
|
989
|
+
if (hourInput) {
|
|
990
|
+
hourInput.nativeElement?.focus();
|
|
964
991
|
}
|
|
965
992
|
}
|
|
966
993
|
else {
|
|
967
|
-
|
|
968
|
-
|
|
994
|
+
const minuteInput = this.minuteInputElement();
|
|
995
|
+
if (minuteInput) {
|
|
996
|
+
minuteInput.nativeElement?.focus();
|
|
969
997
|
}
|
|
970
998
|
}
|
|
971
999
|
}
|
|
972
1000
|
handleHourInputChange(value) {
|
|
973
1001
|
const hour = coerceNumberProperty(value);
|
|
974
1002
|
if (hour || hour === 0) {
|
|
975
|
-
const
|
|
976
|
-
this.
|
|
977
|
-
this.
|
|
978
|
-
|
|
979
|
-
|
|
1003
|
+
const currentDate = this.activeDate();
|
|
1004
|
+
const newValue = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), this.updateHourForAmPm(hour), this._adapter.getMinute(currentDate));
|
|
1005
|
+
this._activeDate.set(this._adapter.clampDate(newValue, this.minDate(), this.maxDate()));
|
|
1006
|
+
this.activeDateChange.emit(this.activeDate());
|
|
1007
|
+
const hourDirective = this.hourInputDirective();
|
|
1008
|
+
if (hourDirective) {
|
|
1009
|
+
hourDirective.setValue(this.hour());
|
|
980
1010
|
}
|
|
981
1011
|
}
|
|
982
1012
|
}
|
|
983
1013
|
updateHourForAmPm(value) {
|
|
984
|
-
if (!this.twelvehour) {
|
|
1014
|
+
if (!this.twelvehour()) {
|
|
985
1015
|
return value;
|
|
986
1016
|
}
|
|
987
|
-
if (this.AMPM === 'AM') {
|
|
1017
|
+
if (this.AMPM() === 'AM') {
|
|
988
1018
|
if (value === 0 || value === 12) {
|
|
989
1019
|
return 0;
|
|
990
1020
|
}
|
|
@@ -1000,131 +1030,128 @@ class CmatDatetimepickerTimeComponent {
|
|
|
1000
1030
|
handleMinuteInputChange(value) {
|
|
1001
1031
|
const minute = coerceNumberProperty(value);
|
|
1002
1032
|
if (minute || minute === 0) {
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
this.
|
|
1006
|
-
|
|
1007
|
-
|
|
1033
|
+
const currentDate = this.activeDate();
|
|
1034
|
+
const newValue = this._adapter.createDatetime(this._adapter.getYear(currentDate), this._adapter.getMonth(currentDate), this._adapter.getDate(currentDate), this._adapter.getHour(currentDate), minute);
|
|
1035
|
+
this._activeDate.set(this._adapter.clampDate(newValue, this.minDate(), this.maxDate()));
|
|
1036
|
+
this.activeDateChange.emit(this.activeDate());
|
|
1037
|
+
const minuteDirective = this.minuteInputDirective();
|
|
1038
|
+
if (minuteDirective) {
|
|
1039
|
+
minuteDirective.setValue(this.minute());
|
|
1008
1040
|
}
|
|
1009
1041
|
}
|
|
1010
1042
|
}
|
|
1011
1043
|
handleFocus(clockView) {
|
|
1012
|
-
this.clockView
|
|
1044
|
+
this._clockView.set(clockView);
|
|
1013
1045
|
this.clockViewChange.emit(clockView);
|
|
1014
1046
|
}
|
|
1015
1047
|
timeSelected(date) {
|
|
1016
|
-
if (this.
|
|
1017
|
-
this.
|
|
1048
|
+
if (this.currentClockView() === 'hour') {
|
|
1049
|
+
this._clockView.set('minute');
|
|
1018
1050
|
}
|
|
1019
|
-
this._activeDate
|
|
1051
|
+
this._activeDate.set(date);
|
|
1020
1052
|
}
|
|
1021
1053
|
onActiveDateChange(date) {
|
|
1022
|
-
this._activeDate
|
|
1054
|
+
this._activeDate.set(date);
|
|
1023
1055
|
this.activeDateChange.emit(date);
|
|
1024
1056
|
}
|
|
1025
1057
|
handleOk() {
|
|
1026
|
-
|
|
1027
|
-
|
|
1058
|
+
const currentDate = this.activeDate();
|
|
1059
|
+
if (currentDate) {
|
|
1060
|
+
this.selectedChange.emit(currentDate);
|
|
1028
1061
|
}
|
|
1029
1062
|
this.userSelection.emit();
|
|
1030
1063
|
}
|
|
1031
1064
|
handleCancel() {
|
|
1032
1065
|
this.userSelection.emit();
|
|
1033
1066
|
}
|
|
1034
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1035
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1067
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerTimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1068
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerTimeComponent, isStandalone: true, selector: "cmat-datetimepicker-time", inputs: { dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, AMPM: { classPropertyName: "AMPM", publicName: "AMPM", isSignal: true, isRequired: false, transformFunction: null }, twelvehour: { classPropertyName: "twelvehour", publicName: "twelvehour", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, clockView: { classPropertyName: "clockView", publicName: "clockView", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", userSelection: "userSelection", ampmChange: "ampmChange", clockViewChange: "clockViewChange" }, host: { classAttribute: "cmat-datetimepicker-time" }, viewQueries: [{ propertyName: "hourInputElement", first: true, predicate: ["hourInput"], descendants: true, isSignal: true }, { propertyName: "hourInputDirective", first: true, predicate: ["hourInput"], descendants: true, isSignal: true }, { propertyName: "minuteInputElement", first: true, predicate: ["minuteInput"], descendants: true, isSignal: true }, { propertyName: "minuteInputDirective", first: true, predicate: ["minuteInput"], descendants: true, isSignal: true }], exportAs: ["cmatDatetimepickerTime"], ngImport: i0, template: "<div\r\n class=\"cmat-datetimepicker-time-input-wrapper\"\r\n [attr.data-refresh]=\"intlVersion()\"\r\n>\r\n <div class=\"cmat-datetimepicker-time-input-inner\">\r\n <input\r\n #hourInput=\"cmatDatetimepickerTimeInput\"\r\n class=\"cmat-datetimepicker-time-input\"\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n maxlength=\"2\"\r\n [class.cmat-datetimepicker-time-input-active]=\"currentClockView() === 'hour'\"\r\n [class.cmat-datetimepicker-time-input-warning]=\"!hourInput.valid\"\r\n [timeMin]=\"twelvehour() ? 1 : 0\"\r\n [timeMax]=\"twelvehour() ? 12 : 23\"\r\n [timeValue]=\"hour()\"\r\n (timeValueChanged)=\"handleHourInputChange($event)\"\r\n (focus)=\"handleFocus('hour')\"\r\n />\r\n\r\n <div class=\"cmat-datetimepicker-time-seperator\">:</div>\r\n\r\n <input\r\n #minuteInput=\"cmatDatetimepickerTimeInput\"\r\n class=\"cmat-datetimepicker-time-input\"\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n maxlength=\"2\"\r\n [class.cmat-datetimepicker-time-input-active]=\"currentClockView() === 'minute'\"\r\n [class.cmat-datetimepicker-time-input-warning]=\"!minuteInput.valid\"\r\n [timeMin]=\"0\"\r\n [timeMax]=\"59\"\r\n [timeValue]=\"minute()\"\r\n [timeInterval]=\"interval()\"\r\n (timeValueChanged)=\"handleMinuteInputChange($event)\"\r\n (focus)=\"handleFocus('minute')\"\r\n />\r\n\r\n @if (twelvehour()) {\r\n <div class=\"cmat-datetimepicker-time-ampm\">\r\n <button\r\n matButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-time-am\"\r\n aria-label=\"AM\"\r\n [class.cmat-datetimepicker-time-ampm-active]=\"AMPM() === 'AM'\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (click)=\"ampmChange.emit('AM')\"\r\n >\r\n AM\r\n </button>\r\n <button\r\n matButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-time-pm\"\r\n aria-label=\"PM\"\r\n [class.cmat-datetimepicker-time-ampm-active]=\"AMPM() === 'PM'\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (click)=\"ampmChange.emit('PM')\"\r\n >\r\n PM\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n\r\n<cmat-datetimepicker-clock\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"interval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"selected()\"\r\n [startView]=\"currentClockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n (selectedChange)=\"timeSelected($event)\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n>\r\n</cmat-datetimepicker-clock>\r\n\r\n<div class=\"cmat-datetimepicker-time-button-wrapper flex flex-row gap-4\">\r\n <button\r\n class=\"cmat-datetimepicker-time-cancel-button\"\r\n matButton=\"outlined\"\r\n type=\"button\"\r\n (click)=\"handleCancel()\"\r\n >\r\n {{ datetimepickerIntl.cancelLabel }}\r\n </button>\r\n <button\r\n class=\"cmat-datetimepicker-time-ok-button\"\r\n matButton=\"filled\"\r\n type=\"button\"\r\n color=\"primary\"\r\n [disabled]=\"minuteInputDirective()?.invalid || hourInputDirective()?.invalid\"\r\n (click)=\"handleOk()\"\r\n >\r\n {{ datetimepickerIntl.okLabel }}\r\n </button>\r\n</div>\r\n", styles: [".cmat-datetimepicker-time{display:block;outline:none;-webkit-user-select:none;user-select:none}.cmat-datetimepicker-time-input-wrapper{padding:8px 0;text-align:center}.cmat-datetimepicker-time-input-inner{display:inline-flex;height:56px;align-items:center}.cmat-datetimepicker-time-input{width:72px;font-size:36px;text-align:center;border-radius:8px;border:2px solid transparent;appearance:none;outline:none;height:100%}.cmat-datetimepicker-time-seperator{display:inline-flex;justify-content:center;width:24px;font-size:36px;height:100%}.cmat-datetimepicker-time-ampm{display:inline-flex;flex-direction:column;margin-left:12px;height:100%}[dir=rtl] .cmat-datetimepicker-time-ampm{margin-left:auto;margin-right:12px}.cmat-datetimepicker-time-am.mat-mdc-button,.cmat-datetimepicker-time-pm.mat-mdc-button{flex:1;width:40px;min-width:auto;padding:0;line-height:normal;border-width:1px;border-style:solid;min-height:0}.cmat-datetimepicker-time-am.mat-mdc-button{border-radius:8px 8px 0 0!important}.cmat-datetimepicker-time-pm.mat-mdc-button{border-radius:0 0 8px 8px!important;border-top:none}.cmat-datetimepicker-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}\n"], dependencies: [{ kind: "directive", type: CmatDatetimepickerTimeInputDirective, selector: "input.cmat-datetimepicker-time-input", inputs: ["timeInterval", "timeMin", "timeMax", "timeValue"], outputs: ["timeValueChanged"], exportAs: ["cmatDatetimepickerTimeInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: CmatDatetimepickerClockComponent, selector: "cmat-datetimepicker-clock", inputs: ["dateFilter", "interval", "twelvehour", "minDate", "maxDate", "selected", "startView", "activeDate"], outputs: ["userSelection", "selectedChange", "activeDateChange"], exportAs: ["cmatDatetimepickerClock"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1036
1069
|
}
|
|
1037
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerTimeComponent, decorators: [{
|
|
1038
1071
|
type: Component,
|
|
1039
|
-
args: [{ selector: 'cmat-datetimepicker-time',
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
type: Output
|
|
1048
|
-
}], clockViewChange: [{
|
|
1049
|
-
type: Output
|
|
1050
|
-
}], dateFilter: [{
|
|
1051
|
-
type: Input
|
|
1052
|
-
}], interval: [{
|
|
1053
|
-
type: Input
|
|
1054
|
-
}], AMPM: [{
|
|
1055
|
-
type: Input
|
|
1056
|
-
}], class: [{
|
|
1057
|
-
type: HostBinding,
|
|
1058
|
-
args: ['class']
|
|
1059
|
-
}], hourInputElement: [{
|
|
1060
|
-
type: ViewChild,
|
|
1061
|
-
args: ['hourInput', { read: (ElementRef) }]
|
|
1062
|
-
}], hourInputDirective: [{
|
|
1063
|
-
type: ViewChild,
|
|
1064
|
-
args: ['hourInput', { read: CmatDatetimepickerTimeInputDirective }]
|
|
1065
|
-
}], minuteInputElement: [{
|
|
1066
|
-
type: ViewChild,
|
|
1067
|
-
args: ['minuteInput', { read: (ElementRef) }]
|
|
1068
|
-
}], minuteInputDirective: [{
|
|
1069
|
-
type: ViewChild,
|
|
1070
|
-
args: ['minuteInput', { read: CmatDatetimepickerTimeInputDirective }]
|
|
1071
|
-
}], twelvehour: [{
|
|
1072
|
-
type: Input
|
|
1073
|
-
}], activeDate: [{
|
|
1074
|
-
type: Input
|
|
1075
|
-
}], selected: [{
|
|
1076
|
-
type: Input
|
|
1077
|
-
}], minDate: [{
|
|
1078
|
-
type: Input
|
|
1079
|
-
}], maxDate: [{
|
|
1080
|
-
type: Input
|
|
1081
|
-
}], clockView: [{
|
|
1082
|
-
type: Input
|
|
1083
|
-
}] } });
|
|
1072
|
+
args: [{ selector: 'cmat-datetimepicker-time', host: {
|
|
1073
|
+
'class': 'cmat-datetimepicker-time',
|
|
1074
|
+
}, exportAs: 'cmatDatetimepickerTime', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1075
|
+
CmatDatetimepickerTimeInputDirective,
|
|
1076
|
+
MatButtonModule,
|
|
1077
|
+
CmatDatetimepickerClockComponent,
|
|
1078
|
+
], template: "<div\r\n class=\"cmat-datetimepicker-time-input-wrapper\"\r\n [attr.data-refresh]=\"intlVersion()\"\r\n>\r\n <div class=\"cmat-datetimepicker-time-input-inner\">\r\n <input\r\n #hourInput=\"cmatDatetimepickerTimeInput\"\r\n class=\"cmat-datetimepicker-time-input\"\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n maxlength=\"2\"\r\n [class.cmat-datetimepicker-time-input-active]=\"currentClockView() === 'hour'\"\r\n [class.cmat-datetimepicker-time-input-warning]=\"!hourInput.valid\"\r\n [timeMin]=\"twelvehour() ? 1 : 0\"\r\n [timeMax]=\"twelvehour() ? 12 : 23\"\r\n [timeValue]=\"hour()\"\r\n (timeValueChanged)=\"handleHourInputChange($event)\"\r\n (focus)=\"handleFocus('hour')\"\r\n />\r\n\r\n <div class=\"cmat-datetimepicker-time-seperator\">:</div>\r\n\r\n <input\r\n #minuteInput=\"cmatDatetimepickerTimeInput\"\r\n class=\"cmat-datetimepicker-time-input\"\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n maxlength=\"2\"\r\n [class.cmat-datetimepicker-time-input-active]=\"currentClockView() === 'minute'\"\r\n [class.cmat-datetimepicker-time-input-warning]=\"!minuteInput.valid\"\r\n [timeMin]=\"0\"\r\n [timeMax]=\"59\"\r\n [timeValue]=\"minute()\"\r\n [timeInterval]=\"interval()\"\r\n (timeValueChanged)=\"handleMinuteInputChange($event)\"\r\n (focus)=\"handleFocus('minute')\"\r\n />\r\n\r\n @if (twelvehour()) {\r\n <div class=\"cmat-datetimepicker-time-ampm\">\r\n <button\r\n matButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-time-am\"\r\n aria-label=\"AM\"\r\n [class.cmat-datetimepicker-time-ampm-active]=\"AMPM() === 'AM'\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (click)=\"ampmChange.emit('AM')\"\r\n >\r\n AM\r\n </button>\r\n <button\r\n matButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-time-pm\"\r\n aria-label=\"PM\"\r\n [class.cmat-datetimepicker-time-ampm-active]=\"AMPM() === 'PM'\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (click)=\"ampmChange.emit('PM')\"\r\n >\r\n PM\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n</div>\r\n\r\n<cmat-datetimepicker-clock\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"interval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"selected()\"\r\n [startView]=\"currentClockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n (selectedChange)=\"timeSelected($event)\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n>\r\n</cmat-datetimepicker-clock>\r\n\r\n<div class=\"cmat-datetimepicker-time-button-wrapper flex flex-row gap-4\">\r\n <button\r\n class=\"cmat-datetimepicker-time-cancel-button\"\r\n matButton=\"outlined\"\r\n type=\"button\"\r\n (click)=\"handleCancel()\"\r\n >\r\n {{ datetimepickerIntl.cancelLabel }}\r\n </button>\r\n <button\r\n class=\"cmat-datetimepicker-time-ok-button\"\r\n matButton=\"filled\"\r\n type=\"button\"\r\n color=\"primary\"\r\n [disabled]=\"minuteInputDirective()?.invalid || hourInputDirective()?.invalid\"\r\n (click)=\"handleOk()\"\r\n >\r\n {{ datetimepickerIntl.okLabel }}\r\n </button>\r\n</div>\r\n", styles: [".cmat-datetimepicker-time{display:block;outline:none;-webkit-user-select:none;user-select:none}.cmat-datetimepicker-time-input-wrapper{padding:8px 0;text-align:center}.cmat-datetimepicker-time-input-inner{display:inline-flex;height:56px;align-items:center}.cmat-datetimepicker-time-input{width:72px;font-size:36px;text-align:center;border-radius:8px;border:2px solid transparent;appearance:none;outline:none;height:100%}.cmat-datetimepicker-time-seperator{display:inline-flex;justify-content:center;width:24px;font-size:36px;height:100%}.cmat-datetimepicker-time-ampm{display:inline-flex;flex-direction:column;margin-left:12px;height:100%}[dir=rtl] .cmat-datetimepicker-time-ampm{margin-left:auto;margin-right:12px}.cmat-datetimepicker-time-am.mat-mdc-button,.cmat-datetimepicker-time-pm.mat-mdc-button{flex:1;width:40px;min-width:auto;padding:0;line-height:normal;border-width:1px;border-style:solid;min-height:0}.cmat-datetimepicker-time-am.mat-mdc-button{border-radius:8px 8px 0 0!important}.cmat-datetimepicker-time-pm.mat-mdc-button{border-radius:0 0 8px 8px!important;border-top:none}.cmat-datetimepicker-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}\n"] }]
|
|
1079
|
+
}], ctorParameters: () => [], propDecorators: { selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], activeDateChange: [{ type: i0.Output, args: ["activeDateChange"] }], userSelection: [{ type: i0.Output, args: ["userSelection"] }], ampmChange: [{ type: i0.Output, args: ["ampmChange"] }], clockViewChange: [{ type: i0.Output, args: ["clockViewChange"] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], interval: [{ type: i0.Input, args: [{ isSignal: true, alias: "interval", required: false }] }], AMPM: [{ type: i0.Input, args: [{ isSignal: true, alias: "AMPM", required: false }] }], twelvehour: [{ type: i0.Input, args: [{ isSignal: true, alias: "twelvehour", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], clockView: [{ type: i0.Input, args: [{ isSignal: true, alias: "clockView", required: false }] }], hourInputElement: [{ type: i0.ViewChild, args: ['hourInput', { isSignal: true }] }], hourInputDirective: [{ type: i0.ViewChild, args: ['hourInput', { isSignal: true }] }], minuteInputElement: [{ type: i0.ViewChild, args: ['minuteInput', { isSignal: true }] }], minuteInputDirective: [{ type: i0.ViewChild, args: ['minuteInput', { isSignal: true }] }] } });
|
|
1084
1080
|
|
|
1085
1081
|
class CmatDatetimepickerYearViewComponent {
|
|
1086
1082
|
constructor() {
|
|
1087
|
-
this.userSelection =
|
|
1088
|
-
this.
|
|
1089
|
-
this.
|
|
1090
|
-
|
|
1083
|
+
this.userSelection = output();
|
|
1084
|
+
this.selectedChange = output();
|
|
1085
|
+
this.type = input('date', /* @ts-ignore */
|
|
1086
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1087
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
1088
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
1089
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
1090
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
1091
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
1092
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
1093
|
+
this.selected = input(null, /* @ts-ignore */
|
|
1094
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
1095
|
+
this.activeDate = input.required(/* @ts-ignore */
|
|
1096
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
1097
|
+
this.months = signal([], /* @ts-ignore */
|
|
1098
|
+
...(ngDevMode ? [{ debugName: "months" }] : /* istanbul ignore next */ []));
|
|
1099
|
+
this.yearLabel = signal('', /* @ts-ignore */
|
|
1100
|
+
...(ngDevMode ? [{ debugName: "yearLabel" }] : /* istanbul ignore next */ []));
|
|
1101
|
+
this.todayMonth = signal(null, /* @ts-ignore */
|
|
1102
|
+
...(ngDevMode ? [{ debugName: "todayMonth" }] : /* istanbul ignore next */ []));
|
|
1103
|
+
this.selectedMonth = signal(null, /* @ts-ignore */
|
|
1104
|
+
...(ngDevMode ? [{ debugName: "selectedMonth" }] : /* istanbul ignore next */ []));
|
|
1105
|
+
this.calendarState = signal('', /* @ts-ignore */
|
|
1106
|
+
...(ngDevMode ? [{ debugName: "calendarState" }] : /* istanbul ignore next */ []));
|
|
1107
|
+
this.resolvedActiveDate = computed(() => {
|
|
1108
|
+
const inputDate = this.activeDate();
|
|
1109
|
+
return inputDate ?? this._internalActiveDate() ?? this.adapter.today();
|
|
1110
|
+
}, /* @ts-ignore */
|
|
1111
|
+
...(ngDevMode ? [{ debugName: "resolvedActiveDate" }] : /* istanbul ignore next */ []));
|
|
1091
1112
|
this.adapter = inject(DatetimeAdapter, { optional: true });
|
|
1092
|
-
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
1113
|
+
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
1114
|
+
optional: true,
|
|
1115
|
+
});
|
|
1093
1116
|
this._elementRef = inject(ElementRef);
|
|
1094
1117
|
this._calendarAnimationListener = this.calendarStateDone.bind(this);
|
|
1118
|
+
this._internalActiveDate = signal(null, /* @ts-ignore */
|
|
1119
|
+
...(ngDevMode ? [{ debugName: "_internalActiveDate" }] : /* istanbul ignore next */ []));
|
|
1095
1120
|
if (!this.adapter) {
|
|
1096
1121
|
throw createMissingDateImplError('CDatetimeAdapter');
|
|
1097
1122
|
}
|
|
1098
1123
|
if (!this._dateFormats) {
|
|
1099
1124
|
throw createMissingDateImplError('CMAT_DATETIME_FORMATS');
|
|
1100
1125
|
}
|
|
1101
|
-
this._activeDate = this.adapter.today();
|
|
1102
1126
|
this._elementRef.nativeElement.addEventListener('animationend', this._calendarAnimationListener);
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1127
|
+
effect(() => {
|
|
1128
|
+
const newActiveDate = this.activeDate();
|
|
1129
|
+
if (newActiveDate) {
|
|
1130
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1131
|
+
const oldActiveDate = this._internalActiveDate();
|
|
1132
|
+
// Update internal tracker
|
|
1133
|
+
const prev = this._internalActiveDate();
|
|
1134
|
+
this._internalActiveDate.set(newActiveDate);
|
|
1135
|
+
untracked(() => {
|
|
1136
|
+
if (prev &&
|
|
1137
|
+
newActiveDate &&
|
|
1138
|
+
!this.adapter.sameYear(prev, newActiveDate)) {
|
|
1139
|
+
this._init();
|
|
1140
|
+
if (this.adapter.isInNextMonth(prev, newActiveDate)) {
|
|
1141
|
+
this._changeCalendarState('right');
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
this._changeCalendarState('left');
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
else if (!prev) {
|
|
1148
|
+
// Initial load case handled by ngAfterContentInit usually,
|
|
1149
|
+
// but if input is provided immediately, we might need init.
|
|
1150
|
+
// ngAfterContentInit calls _init() anyway.
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1118
1153
|
}
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1122
|
-
get selected() {
|
|
1123
|
-
return this._selected;
|
|
1124
|
-
}
|
|
1125
|
-
set selected(value) {
|
|
1126
|
-
this._selected = value;
|
|
1127
|
-
this.selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
1154
|
+
});
|
|
1128
1155
|
}
|
|
1129
1156
|
ngAfterContentInit() {
|
|
1130
1157
|
this._init();
|
|
@@ -1133,39 +1160,53 @@ class CmatDatetimepickerYearViewComponent {
|
|
|
1133
1160
|
this._elementRef.nativeElement.removeEventListener('animationend', this._calendarAnimationListener);
|
|
1134
1161
|
}
|
|
1135
1162
|
monthSelected(month) {
|
|
1136
|
-
const
|
|
1137
|
-
this.
|
|
1138
|
-
|
|
1163
|
+
const currentDate = this.resolvedActiveDate();
|
|
1164
|
+
const normalizedDate = this.adapter.createDatetime(this.adapter.getYear(currentDate), month, 1, 0, 0);
|
|
1165
|
+
this.selectedChange.emit(this.adapter.createDatetime(this.adapter.getYear(currentDate), month, Math.min(this.adapter.getDate(currentDate), this.adapter.getNumDaysInMonth(normalizedDate)), this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate)));
|
|
1166
|
+
if (this.type() === 'month') {
|
|
1139
1167
|
this.userSelection.emit();
|
|
1140
1168
|
}
|
|
1141
1169
|
}
|
|
1142
1170
|
calendarStateDone(event) {
|
|
1143
|
-
if (event.animationName === 'slideCalendarLeft' ||
|
|
1171
|
+
if (event.animationName === 'slideCalendarLeft' ||
|
|
1172
|
+
event.animationName === 'slideCalendarRight') {
|
|
1144
1173
|
this.calendarState.set('');
|
|
1145
1174
|
}
|
|
1146
1175
|
}
|
|
1147
1176
|
_init() {
|
|
1148
|
-
|
|
1149
|
-
this.
|
|
1150
|
-
this.
|
|
1177
|
+
const selectedValue = this.selected();
|
|
1178
|
+
this.selectedMonth.set(this._getMonthInCurrentYear(selectedValue));
|
|
1179
|
+
this.todayMonth.set(this._getMonthInCurrentYear(this.adapter.today()));
|
|
1180
|
+
this.yearLabel.set(this.adapter.getYearName(this.resolvedActiveDate()));
|
|
1151
1181
|
const monthNames = this.adapter.getMonthNames('short');
|
|
1152
|
-
|
|
1182
|
+
const monthsList = [
|
|
1183
|
+
[0, 1, 2, 3, 4],
|
|
1184
|
+
[5, 6, 7, 8, 9, 10, 11],
|
|
1185
|
+
].map(row => row.map(month => this._createCellForMonth(month, monthNames[month])));
|
|
1186
|
+
this.months.set(monthsList);
|
|
1153
1187
|
}
|
|
1154
1188
|
_getMonthInCurrentYear(date) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1189
|
+
if (!date) {
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
return this.adapter.sameYear(date, this.resolvedActiveDate())
|
|
1193
|
+
? this.adapter.getMonth(date)
|
|
1194
|
+
: null;
|
|
1157
1195
|
}
|
|
1158
1196
|
_createCellForMonth(month, monthName) {
|
|
1159
|
-
const
|
|
1197
|
+
const currentDate = this.resolvedActiveDate();
|
|
1198
|
+
const ariaLabel = this.adapter.format(this.adapter.createDatetime(this.adapter.getYear(currentDate), month, 1, this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate)), this._dateFormats.display.monthYearA11yLabel);
|
|
1160
1199
|
return new CmatDatetimepickerCalendarCellComponent(month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));
|
|
1161
1200
|
}
|
|
1162
1201
|
_isMonthEnabled(month) {
|
|
1163
|
-
|
|
1202
|
+
const dateFilter = this.dateFilter();
|
|
1203
|
+
if (!dateFilter) {
|
|
1164
1204
|
return true;
|
|
1165
1205
|
}
|
|
1166
|
-
const
|
|
1206
|
+
const currentDate = this.resolvedActiveDate();
|
|
1207
|
+
const firstOfMonth = this.adapter.createDatetime(this.adapter.getYear(currentDate), month, 1, this.adapter.getHour(currentDate), this.adapter.getMinute(currentDate));
|
|
1167
1208
|
for (let date = firstOfMonth; this.adapter.getMonth(date) === month; date = this.adapter.addCalendarDays(date, 1)) {
|
|
1168
|
-
if (
|
|
1209
|
+
if (dateFilter(date)) {
|
|
1169
1210
|
return true;
|
|
1170
1211
|
}
|
|
1171
1212
|
}
|
|
@@ -1174,55 +1215,93 @@ class CmatDatetimepickerYearViewComponent {
|
|
|
1174
1215
|
_changeCalendarState(direction) {
|
|
1175
1216
|
this.calendarState.set(direction);
|
|
1176
1217
|
}
|
|
1177
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1178
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1218
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerYearViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1219
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatDatetimepickerYearViewComponent, isStandalone: true, selector: "cmat-datetimepicker-year-view", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange" }, exportAs: ["cmatDatetimepickerYearView"], ngImport: i0, template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getMonth(activeDate())\" [labelMinRequiredCells]=\"2\"\r\n [label]=\"yearLabel()\" [rows]=\"months()\" [selectedValue]=\"selectedMonth()\" [todayValue]=\"todayMonth()\"\r\n [allowDisabledSelection]=\"true\" (selectedValueChange)=\"monthSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"], dependencies: [{ kind: "component", type: CmatDatetimepickerCalendarBodyComponent, selector: "[cmat-datetimepicker-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["cmatDatetimepickerCalendarBody"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1179
1220
|
}
|
|
1180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerYearViewComponent, decorators: [{
|
|
1181
1222
|
type: Component,
|
|
1182
|
-
args: [{ selector: 'cmat-datetimepicker-year-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerYearView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getMonth(activeDate)\" [labelMinRequiredCells]=\"2\"\r\n [label]=\"yearLabel\" [rows]=\"months\" [selectedValue]=\"selectedMonth\" [todayValue]=\"todayMonth\"\r\n [allowDisabledSelection]=\"true\" (selectedValueChange)=\"monthSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
1183
|
-
}], ctorParameters: () => [], propDecorators: { userSelection: [{
|
|
1184
|
-
type: Output
|
|
1185
|
-
}], type: [{
|
|
1186
|
-
type: Input
|
|
1187
|
-
}], dateFilter: [{
|
|
1188
|
-
type: Input
|
|
1189
|
-
}], selectedChange: [{
|
|
1190
|
-
type: Output
|
|
1191
|
-
}], activeDate: [{
|
|
1192
|
-
type: Input
|
|
1193
|
-
}], selected: [{
|
|
1194
|
-
type: Input
|
|
1195
|
-
}] } });
|
|
1223
|
+
args: [{ selector: 'cmat-datetimepicker-year-view', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerYearView', imports: [CmatDatetimepickerCalendarBodyComponent, NgClass], template: "<table class=\"cmat-datetimepicker-calendar-table\">\r\n <thead class=\"cmat-datetimepicker-calendar-table-header\"></thead>\r\n <tbody class=\"cmat-calendar-slide-animation\" cmat-datetimepicker-calendar-body role=\"grid\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\" [activeCell]=\"adapter.getMonth(activeDate())\" [labelMinRequiredCells]=\"2\"\r\n [label]=\"yearLabel()\" [rows]=\"months()\" [selectedValue]=\"selectedMonth()\" [todayValue]=\"todayMonth()\"\r\n [allowDisabledSelection]=\"true\" (selectedValueChange)=\"monthSelected($event)\"></tbody>\r\n</table>\r\n", styles: [".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
1224
|
+
}], ctorParameters: () => [], propDecorators: { userSelection: [{ type: i0.Output, args: ["userSelection"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], activeDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeDate", required: true }] }] } });
|
|
1196
1225
|
|
|
1226
|
+
/* eslint-disable @typescript-eslint/member-ordering */
|
|
1197
1227
|
class CmatDatetimepickerCalendarComponent {
|
|
1228
|
+
setCurrentView(view) {
|
|
1229
|
+
this._currentView.set(view);
|
|
1230
|
+
this.viewChanged.emit(view);
|
|
1231
|
+
}
|
|
1232
|
+
getCurrentView() {
|
|
1233
|
+
return this._currentView();
|
|
1234
|
+
}
|
|
1198
1235
|
constructor() {
|
|
1199
|
-
this.userSelection =
|
|
1200
|
-
this.
|
|
1201
|
-
this.
|
|
1202
|
-
this.
|
|
1203
|
-
|
|
1204
|
-
this.
|
|
1205
|
-
|
|
1206
|
-
this.
|
|
1207
|
-
|
|
1208
|
-
this.
|
|
1209
|
-
|
|
1210
|
-
this.
|
|
1211
|
-
|
|
1212
|
-
this.
|
|
1213
|
-
this.
|
|
1236
|
+
this.userSelection = output();
|
|
1237
|
+
this.selectedChange = output();
|
|
1238
|
+
this.viewChanged = output();
|
|
1239
|
+
this.startView = input('month', /* @ts-ignore */
|
|
1240
|
+
...(ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []));
|
|
1241
|
+
this.twelvehour = input(false, /* @ts-ignore */
|
|
1242
|
+
...(ngDevMode ? [{ debugName: "twelvehour" }] : /* istanbul ignore next */ []));
|
|
1243
|
+
this.timeInterval = input(1, /* @ts-ignore */
|
|
1244
|
+
...(ngDevMode ? [{ debugName: "timeInterval" }] : /* istanbul ignore next */ []));
|
|
1245
|
+
this.type = input('date', /* @ts-ignore */
|
|
1246
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1247
|
+
this.multiYearSelector = model(false, /* @ts-ignore */
|
|
1248
|
+
...(ngDevMode ? [{ debugName: "multiYearSelector" }] : /* istanbul ignore next */ []));
|
|
1249
|
+
this.timeInput = input(false, { ...(ngDevMode ? { debugName: "timeInput" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1250
|
+
this.dateFilter = input(/* @ts-ignore */
|
|
1251
|
+
...(ngDevMode ? [undefined, { debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
1252
|
+
this.preventSameDateTimeSelection = input(false, /* @ts-ignore */
|
|
1253
|
+
...(ngDevMode ? [{ debugName: "preventSameDateTimeSelection" }] : /* istanbul ignore next */ []));
|
|
1254
|
+
this.minDate = input(null, /* @ts-ignore */
|
|
1255
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
1256
|
+
this.maxDate = input(null, /* @ts-ignore */
|
|
1257
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
1258
|
+
this.selected = input(null, /* @ts-ignore */
|
|
1259
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
1260
|
+
this.startAt = input(null, /* @ts-ignore */
|
|
1261
|
+
...(ngDevMode ? [{ debugName: "startAt" }] : /* istanbul ignore next */ []));
|
|
1262
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1263
|
+
this.AMPM = signal('AM', /* @ts-ignore */
|
|
1264
|
+
...(ngDevMode ? [{ debugName: "AMPM" }] : /* istanbul ignore next */ []));
|
|
1265
|
+
this.clockView = signal('hour', /* @ts-ignore */
|
|
1266
|
+
...(ngDevMode ? [{ debugName: "clockView" }] : /* istanbul ignore next */ []));
|
|
1267
|
+
this.calendarState = signal('', /* @ts-ignore */
|
|
1268
|
+
...(ngDevMode ? [{ debugName: "calendarState" }] : /* istanbul ignore next */ []));
|
|
1269
|
+
this.intlVersion = signal(0, /* @ts-ignore */
|
|
1270
|
+
...(ngDevMode ? [{ debugName: "intlVersion" }] : /* istanbul ignore next */ []));
|
|
1214
1271
|
this._elementRef = inject(ElementRef);
|
|
1215
1272
|
this._intl = inject(CmatDatetimepickerIntl);
|
|
1216
|
-
this._adapter = inject(DatetimeAdapter, {
|
|
1217
|
-
|
|
1273
|
+
this._adapter = inject(DatetimeAdapter, {
|
|
1274
|
+
optional: true,
|
|
1275
|
+
});
|
|
1276
|
+
this._dateFormats = inject(CMAT_DATETIME_FORMATS, {
|
|
1277
|
+
optional: true,
|
|
1278
|
+
});
|
|
1218
1279
|
this._destroyRef = inject(DestroyRef);
|
|
1219
|
-
this.
|
|
1220
|
-
|
|
1280
|
+
this._currentView = signal('month', /* @ts-ignore */
|
|
1281
|
+
...(ngDevMode ? [{ debugName: "_currentView" }] : /* istanbul ignore next */ []));
|
|
1282
|
+
this._clampedActiveDate = signal(null, /* @ts-ignore */
|
|
1283
|
+
...(ngDevMode ? [{ debugName: "_clampedActiveDate" }] : /* istanbul ignore next */ []));
|
|
1284
|
+
// Computed signals
|
|
1285
|
+
this.currentView = computed(() => this._currentView(), /* @ts-ignore */
|
|
1286
|
+
...(ngDevMode ? [{ debugName: "currentView" }] : /* istanbul ignore next */ []));
|
|
1287
|
+
this.activeDate = computed(() => {
|
|
1288
|
+
const activeDate = this._clampedActiveDate();
|
|
1289
|
+
if (!activeDate) {
|
|
1290
|
+
return this._adapter.today();
|
|
1291
|
+
}
|
|
1292
|
+
return this._adapter.clampDate(activeDate, this.minDate(), this.maxDate());
|
|
1293
|
+
}, /* @ts-ignore */
|
|
1294
|
+
...(ngDevMode ? [{ debugName: "activeDate" }] : /* istanbul ignore next */ []));
|
|
1295
|
+
this.dateFilterForViews = (date) => {
|
|
1296
|
+
const dateFilter = this.dateFilter();
|
|
1297
|
+
const minDateVal = this.minDate();
|
|
1298
|
+
const maxDateVal = this.maxDate();
|
|
1299
|
+
return (!!date &&
|
|
1300
|
+
(!dateFilter || dateFilter(date, CmatDatetimepickerFilterType.DATE)) &&
|
|
1301
|
+
(!minDateVal || this._adapter.compareDate(date, minDateVal) >= 0) &&
|
|
1302
|
+
(!maxDateVal || this._adapter.compareDate(date, maxDateVal) <= 0));
|
|
1303
|
+
};
|
|
1221
1304
|
this._calendarAnimationListener = this.calendarStateDone.bind(this);
|
|
1222
|
-
this.dateFilterForViews = (date) => !!date &&
|
|
1223
|
-
(!this.dateFilter || this.dateFilter(date, CmatDatetimepickerFilterType.DATE)) &&
|
|
1224
|
-
(!this.minDate || this._adapter.compareDate(date, this.minDate) >= 0) &&
|
|
1225
|
-
(!this.maxDate || this._adapter.compareDate(date, this.maxDate) <= 0);
|
|
1226
1305
|
if (!this._adapter) {
|
|
1227
1306
|
throw createMissingDateImplError('CDatetimeAdapter');
|
|
1228
1307
|
}
|
|
@@ -1233,151 +1312,82 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1233
1312
|
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
1234
1313
|
.subscribe(() => this.intlVersion.update(value => value + 1));
|
|
1235
1314
|
this._elementRef.nativeElement.addEventListener('animationend', this._calendarAnimationListener);
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
this.multiYearSelector = true;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1247
|
-
get startAt() {
|
|
1248
|
-
return this._startAt;
|
|
1249
|
-
}
|
|
1250
|
-
set startAt(value) {
|
|
1251
|
-
this._startAt = this._adapter.getValidDateOrNull(value);
|
|
1252
|
-
}
|
|
1253
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1254
|
-
get timeInput() {
|
|
1255
|
-
return this._timeInput;
|
|
1256
|
-
}
|
|
1257
|
-
set timeInput(value) {
|
|
1258
|
-
this._timeInput = coerceBooleanProperty(value);
|
|
1259
|
-
}
|
|
1260
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1261
|
-
get selected() {
|
|
1262
|
-
return this._selected;
|
|
1263
|
-
}
|
|
1264
|
-
set selected(value) {
|
|
1265
|
-
this._selected = this._adapter.getValidDateOrNull(value);
|
|
1266
|
-
}
|
|
1267
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1268
|
-
get minDate() {
|
|
1269
|
-
return this._minDate;
|
|
1270
|
-
}
|
|
1271
|
-
set minDate(value) {
|
|
1272
|
-
this._minDate = this._adapter.getValidDateOrNull(value);
|
|
1273
|
-
}
|
|
1274
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1275
|
-
get maxDate() {
|
|
1276
|
-
return this._maxDate;
|
|
1277
|
-
}
|
|
1278
|
-
set maxDate(value) {
|
|
1279
|
-
this._maxDate = this._adapter.getValidDateOrNull(value);
|
|
1280
|
-
}
|
|
1281
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1282
|
-
get activeDate() {
|
|
1283
|
-
return this._clampedActiveDate;
|
|
1284
|
-
}
|
|
1285
|
-
set activeDate(value) {
|
|
1286
|
-
const oldActiveDate = this._clampedActiveDate;
|
|
1287
|
-
this._clampedActiveDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
1288
|
-
if (oldActiveDate && this._clampedActiveDate &&
|
|
1289
|
-
!this._adapter.sameMonthAndYear(oldActiveDate, this._clampedActiveDate)) {
|
|
1290
|
-
if (this._adapter.isInNextMonth(oldActiveDate, this._clampedActiveDate)) {
|
|
1291
|
-
this._changeCalendarState('right');
|
|
1315
|
+
this._keydownListener = this.handleCalendarBodyKeydown.bind(this);
|
|
1316
|
+
this._elementRef.nativeElement.addEventListener('keydown', this._keydownListener);
|
|
1317
|
+
// Watch for type changes
|
|
1318
|
+
effect(() => {
|
|
1319
|
+
const typeValue = this.type();
|
|
1320
|
+
if (typeValue === 'year') {
|
|
1321
|
+
this.multiYearSelector.set(true);
|
|
1292
1322
|
}
|
|
1293
|
-
|
|
1294
|
-
this._changeCalendarState('left');
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1299
|
-
get currentView() {
|
|
1300
|
-
return this._currentView;
|
|
1301
|
-
}
|
|
1302
|
-
set currentView(view) {
|
|
1303
|
-
this._currentView = view;
|
|
1304
|
-
this.viewChanged.emit(view);
|
|
1323
|
+
});
|
|
1305
1324
|
}
|
|
1306
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1307
1325
|
get yearButtonText() {
|
|
1308
|
-
return this._adapter.getYearName(this.activeDate);
|
|
1326
|
+
return this._adapter.getYearName(this.activeDate());
|
|
1309
1327
|
}
|
|
1310
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1311
1328
|
get yearPeriodText() {
|
|
1312
|
-
if (this.
|
|
1313
|
-
const activeYear = this._adapter.getYear(this.activeDate);
|
|
1314
|
-
const minYearOfPage = activeYear -
|
|
1329
|
+
if (this.getCurrentView() === 'multi-year') {
|
|
1330
|
+
const activeYear = this._adapter.getYear(this.activeDate());
|
|
1331
|
+
const minYearOfPage = activeYear -
|
|
1332
|
+
getActiveOffset(this._adapter, this.activeDate(), this.minDate(), this.maxDate());
|
|
1315
1333
|
const maxYearOfPage = minYearOfPage + yearsPerPage - 1;
|
|
1316
1334
|
const minYearName = this._adapter.getYearName(this._adapter.createDate(minYearOfPage, 0, 1));
|
|
1317
1335
|
const maxYearName = this._adapter.getYearName(this._adapter.createDate(maxYearOfPage, 0, 1));
|
|
1318
1336
|
return this._intl.formatYearRange(minYearName, maxYearName);
|
|
1319
1337
|
}
|
|
1320
|
-
return this.
|
|
1321
|
-
this._adapter.
|
|
1338
|
+
return this.getCurrentView() === 'month'
|
|
1339
|
+
? this._adapter.getMonthNames('long')[this._adapter.getMonth(this.activeDate())]
|
|
1340
|
+
: this._adapter.getYearName(this.activeDate());
|
|
1322
1341
|
}
|
|
1323
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1324
1342
|
get yearButtonLabel() {
|
|
1325
|
-
return this.multiYearSelector
|
|
1343
|
+
return this.multiYearSelector()
|
|
1326
1344
|
? this._intl.switchToMultiYearViewLabel
|
|
1327
1345
|
: this._intl.switchToYearViewLabel;
|
|
1328
1346
|
}
|
|
1329
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1330
1347
|
get dateButtonText() {
|
|
1331
|
-
switch (this.type) {
|
|
1348
|
+
switch (this.type()) {
|
|
1332
1349
|
case 'month':
|
|
1333
|
-
return this._adapter.getMonthNames('long')[this._adapter.getMonth(this.activeDate)];
|
|
1350
|
+
return this._adapter.getMonthNames('long')[this._adapter.getMonth(this.activeDate())];
|
|
1334
1351
|
default:
|
|
1335
|
-
return this._adapter.format(this.activeDate, this._dateFormats.display.popupHeaderDateLabel);
|
|
1352
|
+
return this._adapter.format(this.activeDate(), this._dateFormats.display.popupHeaderDateLabel);
|
|
1336
1353
|
}
|
|
1337
1354
|
}
|
|
1338
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1339
1355
|
get dateButtonLabel() {
|
|
1340
1356
|
return this._intl.switchToMonthViewLabel;
|
|
1341
1357
|
}
|
|
1342
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1343
1358
|
get hoursButtonText() {
|
|
1344
|
-
let hour = this._adapter.getHour(this.activeDate);
|
|
1345
|
-
if (this.twelvehour) {
|
|
1359
|
+
let hour = this._adapter.getHour(this.activeDate());
|
|
1360
|
+
if (this.twelvehour()) {
|
|
1346
1361
|
if (hour === 0) {
|
|
1347
1362
|
hour = 24;
|
|
1348
1363
|
}
|
|
1349
|
-
hour = hour > 12 ?
|
|
1364
|
+
hour = hour > 12 ? hour - 12 : hour;
|
|
1350
1365
|
}
|
|
1351
1366
|
return this._2digit(hour);
|
|
1352
1367
|
}
|
|
1353
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1354
1368
|
get hourButtonLabel() {
|
|
1355
1369
|
return this._intl.switchToClockHourViewLabel;
|
|
1356
1370
|
}
|
|
1357
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1358
1371
|
get minutesButtonText() {
|
|
1359
|
-
return this._2digit(this._adapter.getMinute(this.activeDate));
|
|
1372
|
+
return this._2digit(this._adapter.getMinute(this.activeDate()));
|
|
1360
1373
|
}
|
|
1361
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1362
1374
|
get minuteButtonLabel() {
|
|
1363
1375
|
return this._intl.switchToClockMinuteViewLabel;
|
|
1364
1376
|
}
|
|
1365
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1366
1377
|
get prevButtonLabel() {
|
|
1367
|
-
switch (this._currentView) {
|
|
1378
|
+
switch (this._currentView()) {
|
|
1368
1379
|
case 'month':
|
|
1369
1380
|
return this._intl.prevMonthLabel;
|
|
1370
1381
|
case 'year':
|
|
1371
|
-
return this._intl.
|
|
1382
|
+
return this._intl.nextYearLabel;
|
|
1372
1383
|
case 'multi-year':
|
|
1373
1384
|
return this._intl.prevMultiYearLabel;
|
|
1374
1385
|
default:
|
|
1375
1386
|
return '';
|
|
1376
1387
|
}
|
|
1377
1388
|
}
|
|
1378
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1379
1389
|
get nextButtonLabel() {
|
|
1380
|
-
switch (this._currentView) {
|
|
1390
|
+
switch (this._currentView()) {
|
|
1381
1391
|
case 'month':
|
|
1382
1392
|
return this._intl.nextMonthLabel;
|
|
1383
1393
|
case 'year':
|
|
@@ -1389,13 +1399,13 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1389
1399
|
}
|
|
1390
1400
|
}
|
|
1391
1401
|
handleCalendarBodyKeydown(event) {
|
|
1392
|
-
if (this.
|
|
1402
|
+
if (this.getCurrentView() === 'month') {
|
|
1393
1403
|
this._handleCalendarBodyKeydownInMonthView(event);
|
|
1394
1404
|
}
|
|
1395
|
-
else if (this.
|
|
1405
|
+
else if (this.getCurrentView() === 'year') {
|
|
1396
1406
|
this._handleCalendarBodyKeydownInYearView(event);
|
|
1397
1407
|
}
|
|
1398
|
-
else if (this.
|
|
1408
|
+
else if (this.getCurrentView() === 'multi-year') {
|
|
1399
1409
|
this._handleCalendarBodyKeydownInMultiYearView(event);
|
|
1400
1410
|
}
|
|
1401
1411
|
else {
|
|
@@ -1406,89 +1416,101 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1406
1416
|
this.userSelection.emit();
|
|
1407
1417
|
}
|
|
1408
1418
|
ngAfterContentInit() {
|
|
1409
|
-
|
|
1410
|
-
this.
|
|
1419
|
+
const initialDate = this.startAt() ?? this._adapter.today();
|
|
1420
|
+
this._clampedActiveDate.set(initialDate);
|
|
1421
|
+
this.selectAMPM(this.activeDate());
|
|
1411
1422
|
this.focusActiveCell();
|
|
1412
|
-
if (this.type === 'year') {
|
|
1413
|
-
this.
|
|
1423
|
+
if (this.type() === 'year') {
|
|
1424
|
+
this.setCurrentView('multi-year');
|
|
1414
1425
|
}
|
|
1415
|
-
else if (this.type === 'month') {
|
|
1416
|
-
this.
|
|
1426
|
+
else if (this.type() === 'month') {
|
|
1427
|
+
this.setCurrentView('year');
|
|
1417
1428
|
}
|
|
1418
|
-
else if (this.type === 'time') {
|
|
1419
|
-
this.
|
|
1429
|
+
else if (this.type() === 'time') {
|
|
1430
|
+
this.setCurrentView('clock');
|
|
1420
1431
|
}
|
|
1421
1432
|
else {
|
|
1422
|
-
this.
|
|
1433
|
+
this.setCurrentView(this.startView() || 'month');
|
|
1423
1434
|
}
|
|
1424
1435
|
}
|
|
1425
1436
|
ngOnDestroy() {
|
|
1426
1437
|
this._elementRef.nativeElement.removeEventListener('animationend', this._calendarAnimationListener);
|
|
1438
|
+
this._elementRef.nativeElement.removeEventListener('keydown', this._keydownListener);
|
|
1427
1439
|
}
|
|
1428
1440
|
dateSelected(date) {
|
|
1429
|
-
if (this.type === 'date') {
|
|
1430
|
-
|
|
1441
|
+
if (this.type() === 'date') {
|
|
1442
|
+
const selectedValue = this.selected();
|
|
1443
|
+
if (!this._adapter.sameDate(date, selectedValue) ||
|
|
1444
|
+
!this.preventSameDateTimeSelection()) {
|
|
1431
1445
|
this.selectedChange.emit(date);
|
|
1432
1446
|
}
|
|
1433
1447
|
}
|
|
1434
1448
|
else {
|
|
1435
|
-
this.
|
|
1436
|
-
this.
|
|
1449
|
+
this._clampedActiveDate.set(date);
|
|
1450
|
+
this.setCurrentView('clock');
|
|
1437
1451
|
}
|
|
1438
1452
|
}
|
|
1439
1453
|
monthSelected(month) {
|
|
1440
|
-
if (this.type === 'month') {
|
|
1441
|
-
|
|
1454
|
+
if (this.type() === 'month') {
|
|
1455
|
+
const selectedValue = this.selected();
|
|
1456
|
+
if (!this._adapter.sameMonthAndYear(month, selectedValue) ||
|
|
1457
|
+
!this.preventSameDateTimeSelection()) {
|
|
1442
1458
|
this.selectedChange.emit(this._adapter.getFirstDateOfMonth(month));
|
|
1443
1459
|
}
|
|
1444
1460
|
}
|
|
1445
1461
|
else {
|
|
1446
|
-
this.
|
|
1447
|
-
this.
|
|
1448
|
-
this.clockView
|
|
1462
|
+
this._clampedActiveDate.set(month);
|
|
1463
|
+
this.setCurrentView('month');
|
|
1464
|
+
this.clockView.set('hour');
|
|
1449
1465
|
}
|
|
1450
1466
|
}
|
|
1451
1467
|
yearSelected(year) {
|
|
1452
|
-
if (this.type === 'year') {
|
|
1453
|
-
|
|
1468
|
+
if (this.type() === 'year') {
|
|
1469
|
+
const selectedValue = this.selected();
|
|
1470
|
+
if ((selectedValue && !this._adapter.sameYear(year, selectedValue)) ||
|
|
1471
|
+
!this.preventSameDateTimeSelection()) {
|
|
1454
1472
|
const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(year), 0, 1, 0, 0);
|
|
1455
1473
|
this.selectedChange.emit(normalizedDate);
|
|
1456
1474
|
}
|
|
1457
1475
|
}
|
|
1458
1476
|
else {
|
|
1459
|
-
this.
|
|
1460
|
-
this.
|
|
1477
|
+
this._clampedActiveDate.set(year);
|
|
1478
|
+
this.setCurrentView('year');
|
|
1461
1479
|
}
|
|
1462
1480
|
}
|
|
1463
1481
|
timeSelected(date) {
|
|
1464
|
-
this.
|
|
1465
|
-
|
|
1482
|
+
this._clampedActiveDate.set(this.updateDate(date));
|
|
1483
|
+
const selectedValue = this.selected();
|
|
1484
|
+
if (!this._adapter.sameDatetime(date, selectedValue) ||
|
|
1485
|
+
!this.preventSameDateTimeSelection()) {
|
|
1466
1486
|
this.selectedChange.emit(date);
|
|
1467
1487
|
}
|
|
1468
1488
|
}
|
|
1469
1489
|
dialTimeSelected(date) {
|
|
1470
|
-
if (this.clockView !== 'minute') {
|
|
1471
|
-
this.
|
|
1472
|
-
this.clockView
|
|
1490
|
+
if (this.clockView() !== 'minute') {
|
|
1491
|
+
this._clampedActiveDate.set(this.updateDate(date));
|
|
1492
|
+
this.clockView.set('minute');
|
|
1473
1493
|
}
|
|
1474
1494
|
else {
|
|
1475
|
-
|
|
1495
|
+
const selectedValue = this.selected();
|
|
1496
|
+
if (!this._adapter.sameDatetime(date, selectedValue) ||
|
|
1497
|
+
!this.preventSameDateTimeSelection()) {
|
|
1476
1498
|
this.selectedChange.emit(date);
|
|
1477
1499
|
}
|
|
1478
1500
|
}
|
|
1479
1501
|
}
|
|
1480
1502
|
onActiveDateChange(date) {
|
|
1481
|
-
this.
|
|
1503
|
+
this._clampedActiveDate.set(date);
|
|
1482
1504
|
}
|
|
1483
1505
|
updateDate(date) {
|
|
1484
|
-
if (this.twelvehour) {
|
|
1506
|
+
if (this.twelvehour()) {
|
|
1485
1507
|
const HOUR = this._adapter.getHour(date);
|
|
1486
1508
|
if (HOUR === 12) {
|
|
1487
|
-
if (this.AMPM === 'AM') {
|
|
1509
|
+
if (this.AMPM() === 'AM') {
|
|
1488
1510
|
return this._adapter.addCalendarHours(date, -12);
|
|
1489
1511
|
}
|
|
1490
1512
|
}
|
|
1491
|
-
else if (this.AMPM === 'PM') {
|
|
1513
|
+
else if (this.AMPM() === 'PM') {
|
|
1492
1514
|
return this._adapter.addCalendarHours(date, 12);
|
|
1493
1515
|
}
|
|
1494
1516
|
}
|
|
@@ -1496,119 +1518,123 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1496
1518
|
}
|
|
1497
1519
|
selectAMPM(date) {
|
|
1498
1520
|
if (this._adapter.getHour(date) > 11) {
|
|
1499
|
-
this.AMPM
|
|
1521
|
+
this.AMPM.set('PM');
|
|
1500
1522
|
}
|
|
1501
1523
|
else {
|
|
1502
|
-
this.AMPM
|
|
1524
|
+
this.AMPM.set('AM');
|
|
1503
1525
|
}
|
|
1504
1526
|
}
|
|
1505
1527
|
ampmClicked(source) {
|
|
1506
|
-
this._currentView
|
|
1507
|
-
if (source === this.AMPM) {
|
|
1528
|
+
this._currentView.set('clock');
|
|
1529
|
+
if (source === this.AMPM()) {
|
|
1508
1530
|
return;
|
|
1509
1531
|
}
|
|
1510
|
-
this.AMPM
|
|
1511
|
-
const currentHour = this._adapter.getHour(this.activeDate);
|
|
1532
|
+
this.AMPM.set(source);
|
|
1533
|
+
const currentHour = this._adapter.getHour(this.activeDate());
|
|
1512
1534
|
let newHourValue;
|
|
1513
|
-
if (this.AMPM === 'AM') {
|
|
1514
|
-
newHourValue =
|
|
1535
|
+
if (this.AMPM() === 'AM') {
|
|
1536
|
+
newHourValue =
|
|
1537
|
+
currentHour >= 12 ? this._adapter.getHour(this.activeDate()) - 12 : 12;
|
|
1515
1538
|
}
|
|
1516
1539
|
else {
|
|
1517
1540
|
newHourValue = (currentHour + 12) % 24;
|
|
1518
1541
|
}
|
|
1519
|
-
this.
|
|
1542
|
+
this._clampedActiveDate.set(this._adapter.createDatetime(this._adapter.getYear(this.activeDate()), this._adapter.getMonth(this.activeDate()), this._adapter.getDate(this.activeDate()), newHourValue, this._adapter.getMinute(this.activeDate())));
|
|
1520
1543
|
}
|
|
1521
1544
|
yearClicked() {
|
|
1522
|
-
if (this.type === 'year' || this.multiYearSelector) {
|
|
1523
|
-
this.
|
|
1545
|
+
if (this.type() === 'year' || this.multiYearSelector()) {
|
|
1546
|
+
this.setCurrentView('multi-year');
|
|
1524
1547
|
return;
|
|
1525
1548
|
}
|
|
1526
|
-
this.
|
|
1549
|
+
this.setCurrentView('year');
|
|
1527
1550
|
}
|
|
1528
1551
|
dateClicked() {
|
|
1529
|
-
if (this.type !== 'month') {
|
|
1530
|
-
this.
|
|
1552
|
+
if (this.type() !== 'month') {
|
|
1553
|
+
this.setCurrentView('month');
|
|
1531
1554
|
}
|
|
1532
1555
|
}
|
|
1533
1556
|
hoursClicked() {
|
|
1534
|
-
this.
|
|
1535
|
-
this.clockView
|
|
1557
|
+
this.setCurrentView('clock');
|
|
1558
|
+
this.clockView.set('hour');
|
|
1536
1559
|
}
|
|
1537
1560
|
minutesClicked() {
|
|
1538
|
-
this.
|
|
1539
|
-
this.clockView
|
|
1561
|
+
this.setCurrentView('clock');
|
|
1562
|
+
this.clockView.set('minute');
|
|
1540
1563
|
}
|
|
1541
1564
|
previousClicked() {
|
|
1542
|
-
this.
|
|
1543
|
-
this._adapter.addCalendarMonths(this.activeDate, -1)
|
|
1544
|
-
this._adapter.addCalendarYears(this.activeDate, this.
|
|
1565
|
+
this._clampedActiveDate.set(this.getCurrentView() === 'month'
|
|
1566
|
+
? this._adapter.addCalendarMonths(this.activeDate(), -1)
|
|
1567
|
+
: this._adapter.addCalendarYears(this.activeDate(), this.getCurrentView() === 'year' ? -1 : -yearsPerPage));
|
|
1545
1568
|
}
|
|
1546
1569
|
nextClicked() {
|
|
1547
|
-
this.
|
|
1548
|
-
this._adapter.addCalendarMonths(this.activeDate, 1)
|
|
1549
|
-
this._adapter.addCalendarYears(this.activeDate, this.
|
|
1570
|
+
this._clampedActiveDate.set(this.getCurrentView() === 'month'
|
|
1571
|
+
? this._adapter.addCalendarMonths(this.activeDate(), 1)
|
|
1572
|
+
: this._adapter.addCalendarYears(this.activeDate(), this.getCurrentView() === 'year' ? 1 : yearsPerPage));
|
|
1550
1573
|
}
|
|
1551
1574
|
previousEnabled() {
|
|
1552
|
-
|
|
1575
|
+
const minDateVal = this.minDate();
|
|
1576
|
+
if (!minDateVal) {
|
|
1553
1577
|
return true;
|
|
1554
1578
|
}
|
|
1555
|
-
return !
|
|
1579
|
+
return !minDateVal || !this._isSameView(this.activeDate(), minDateVal);
|
|
1556
1580
|
}
|
|
1557
1581
|
nextEnabled() {
|
|
1558
|
-
|
|
1582
|
+
const maxDateVal = this.maxDate();
|
|
1583
|
+
return !maxDateVal || !this._isSameView(this.activeDate(), maxDateVal);
|
|
1559
1584
|
}
|
|
1560
1585
|
focusActiveCell() {
|
|
1561
1586
|
this._elementRef.nativeElement.focus();
|
|
1562
1587
|
}
|
|
1563
1588
|
calendarStateDone(event) {
|
|
1564
|
-
if (event.animationName === 'slideCalendarLeft' ||
|
|
1589
|
+
if (event.animationName === 'slideCalendarLeft' ||
|
|
1590
|
+
event.animationName === 'slideCalendarRight') {
|
|
1565
1591
|
this.calendarState.set('');
|
|
1566
1592
|
}
|
|
1567
1593
|
}
|
|
1568
1594
|
_isSameView(date1, date2) {
|
|
1569
|
-
if (this.
|
|
1570
|
-
return this._adapter.getYear(date1) === this._adapter.getYear(date2) &&
|
|
1571
|
-
this._adapter.getMonth(date1) === this._adapter.getMonth(date2);
|
|
1595
|
+
if (this.getCurrentView() === 'month') {
|
|
1596
|
+
return (this._adapter.getYear(date1) === this._adapter.getYear(date2) &&
|
|
1597
|
+
this._adapter.getMonth(date1) === this._adapter.getMonth(date2));
|
|
1572
1598
|
}
|
|
1573
|
-
if (this.
|
|
1599
|
+
if (this.getCurrentView() === 'year') {
|
|
1574
1600
|
return this._adapter.getYear(date1) === this._adapter.getYear(date2);
|
|
1575
1601
|
}
|
|
1576
|
-
return isSameMultiYearView(this._adapter, date1, date2, this.minDate, this.maxDate);
|
|
1602
|
+
return isSameMultiYearView(this._adapter, date1, date2, this.minDate(), this.maxDate());
|
|
1577
1603
|
}
|
|
1578
1604
|
_handleCalendarBodyKeydownInMonthView(event) {
|
|
1579
1605
|
switch (event.code) {
|
|
1580
1606
|
case 'ArrowLeft':
|
|
1581
|
-
this.
|
|
1607
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), -1));
|
|
1582
1608
|
break;
|
|
1583
1609
|
case 'ArrowRight':
|
|
1584
|
-
this.
|
|
1610
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), 1));
|
|
1585
1611
|
break;
|
|
1586
1612
|
case 'ArrowUp':
|
|
1587
|
-
this.
|
|
1613
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), -7));
|
|
1588
1614
|
break;
|
|
1589
1615
|
case 'ArrowDown':
|
|
1590
|
-
this.
|
|
1616
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), 7));
|
|
1591
1617
|
break;
|
|
1592
1618
|
case 'Home':
|
|
1593
|
-
this.
|
|
1619
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), 1 - this._adapter.getDate(this.activeDate())));
|
|
1594
1620
|
break;
|
|
1595
1621
|
case 'End':
|
|
1596
|
-
this.
|
|
1597
|
-
this._adapter.getDate(this.activeDate)));
|
|
1622
|
+
this._clampedActiveDate.set(this._adapter.addCalendarDays(this.activeDate(), this._adapter.getNumDaysInMonth(this.activeDate()) -
|
|
1623
|
+
this._adapter.getDate(this.activeDate())));
|
|
1598
1624
|
break;
|
|
1599
1625
|
case 'PageUp':
|
|
1600
|
-
this.
|
|
1601
|
-
this._adapter.addCalendarYears(this.activeDate, -1)
|
|
1602
|
-
this._adapter.addCalendarMonths(this.activeDate, -1);
|
|
1626
|
+
this._clampedActiveDate.set(event.altKey
|
|
1627
|
+
? this._adapter.addCalendarYears(this.activeDate(), -1)
|
|
1628
|
+
: this._adapter.addCalendarMonths(this.activeDate(), -1));
|
|
1603
1629
|
break;
|
|
1604
1630
|
case 'PageDown':
|
|
1605
|
-
this.
|
|
1606
|
-
this._adapter.addCalendarYears(this.activeDate, 1)
|
|
1607
|
-
this._adapter.addCalendarMonths(this.activeDate, 1);
|
|
1631
|
+
this._clampedActiveDate.set(event.altKey
|
|
1632
|
+
? this._adapter.addCalendarYears(this.activeDate(), 1)
|
|
1633
|
+
: this._adapter.addCalendarMonths(this.activeDate(), 1));
|
|
1608
1634
|
break;
|
|
1609
1635
|
case 'Enter':
|
|
1610
|
-
if (this.dateFilterForViews(this.activeDate)) {
|
|
1611
|
-
this.dateSelected(this.activeDate);
|
|
1636
|
+
if (this.dateFilterForViews(this.activeDate())) {
|
|
1637
|
+
this.dateSelected(this.activeDate());
|
|
1612
1638
|
event.preventDefault();
|
|
1613
1639
|
}
|
|
1614
1640
|
return;
|
|
@@ -1620,33 +1646,31 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1620
1646
|
_handleCalendarBodyKeydownInYearView(event) {
|
|
1621
1647
|
switch (event.code) {
|
|
1622
1648
|
case 'ArrowLeft':
|
|
1623
|
-
this.
|
|
1649
|
+
this._clampedActiveDate.set(this._adapter.addCalendarMonths(this.activeDate(), -1));
|
|
1624
1650
|
break;
|
|
1625
1651
|
case 'ArrowRight':
|
|
1626
|
-
this.
|
|
1652
|
+
this._clampedActiveDate.set(this._adapter.addCalendarMonths(this.activeDate(), 1));
|
|
1627
1653
|
break;
|
|
1628
1654
|
case 'ArrowUp':
|
|
1629
|
-
this.
|
|
1655
|
+
this._clampedActiveDate.set(this._prevMonthInSameCol(this.activeDate()));
|
|
1630
1656
|
break;
|
|
1631
1657
|
case 'ArrowDown':
|
|
1632
|
-
this.
|
|
1658
|
+
this._clampedActiveDate.set(this._nextMonthInSameCol(this.activeDate()));
|
|
1633
1659
|
break;
|
|
1634
1660
|
case 'Home':
|
|
1635
|
-
this.
|
|
1661
|
+
this._clampedActiveDate.set(this._adapter.addCalendarMonths(this.activeDate(), -this._adapter.getMonth(this.activeDate())));
|
|
1636
1662
|
break;
|
|
1637
1663
|
case 'End':
|
|
1638
|
-
this.
|
|
1664
|
+
this._clampedActiveDate.set(this._adapter.addCalendarMonths(this.activeDate(), 11 - this._adapter.getMonth(this.activeDate())));
|
|
1639
1665
|
break;
|
|
1640
1666
|
case 'PageUp':
|
|
1641
|
-
this.activeDate
|
|
1642
|
-
this._adapter.addCalendarYears(this.activeDate, event.altKey ? -10 : -1);
|
|
1667
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), event.altKey ? -10 : -1));
|
|
1643
1668
|
break;
|
|
1644
1669
|
case 'PageDown':
|
|
1645
|
-
this.activeDate
|
|
1646
|
-
this._adapter.addCalendarYears(this.activeDate, event.altKey ? 10 : 1);
|
|
1670
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), event.altKey ? 10 : 1));
|
|
1647
1671
|
break;
|
|
1648
1672
|
case 'Enter':
|
|
1649
|
-
this.monthSelected(this.activeDate);
|
|
1673
|
+
this.monthSelected(this.activeDate());
|
|
1650
1674
|
break;
|
|
1651
1675
|
default:
|
|
1652
1676
|
return;
|
|
@@ -1656,33 +1680,33 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1656
1680
|
_handleCalendarBodyKeydownInMultiYearView(event) {
|
|
1657
1681
|
switch (event.code) {
|
|
1658
1682
|
case 'ArrowLeft':
|
|
1659
|
-
this.
|
|
1683
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), -1));
|
|
1660
1684
|
break;
|
|
1661
1685
|
case 'ArrowRight':
|
|
1662
|
-
this.
|
|
1686
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), 1));
|
|
1663
1687
|
break;
|
|
1664
1688
|
case 'ArrowUp':
|
|
1665
|
-
this.
|
|
1689
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), -yearsPerRow));
|
|
1666
1690
|
break;
|
|
1667
1691
|
case 'ArrowDown':
|
|
1668
|
-
this.
|
|
1692
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), yearsPerRow));
|
|
1669
1693
|
break;
|
|
1670
1694
|
case 'Home':
|
|
1671
|
-
this.
|
|
1695
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), -getActiveOffset(this._adapter, this.activeDate(), this.minDate(), this.maxDate())));
|
|
1672
1696
|
break;
|
|
1673
1697
|
case 'End':
|
|
1674
|
-
this.
|
|
1698
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), yearsPerPage -
|
|
1699
|
+
getActiveOffset(this._adapter, this.activeDate(), this.minDate(), this.maxDate()) -
|
|
1700
|
+
1));
|
|
1675
1701
|
break;
|
|
1676
1702
|
case 'PageUp':
|
|
1677
|
-
this.activeDate
|
|
1678
|
-
this._adapter.addCalendarYears(this.activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
1703
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), event.altKey ? -yearsPerPage * 10 : -yearsPerPage));
|
|
1679
1704
|
break;
|
|
1680
1705
|
case 'PageDown':
|
|
1681
|
-
this.activeDate
|
|
1682
|
-
this._adapter.addCalendarYears(this.activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
1706
|
+
this._clampedActiveDate.set(this._adapter.addCalendarYears(this.activeDate(), event.altKey ? yearsPerPage * 10 : yearsPerPage));
|
|
1683
1707
|
break;
|
|
1684
1708
|
case 'Enter':
|
|
1685
|
-
this.yearSelected(this.activeDate);
|
|
1709
|
+
this.yearSelected(this.activeDate());
|
|
1686
1710
|
break;
|
|
1687
1711
|
default:
|
|
1688
1712
|
return;
|
|
@@ -1691,20 +1715,20 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1691
1715
|
_handleCalendarBodyKeydownInClockView(event) {
|
|
1692
1716
|
switch (event.code) {
|
|
1693
1717
|
case 'ArrowUp':
|
|
1694
|
-
this.
|
|
1695
|
-
this._adapter.addCalendarHours(this.activeDate, 1)
|
|
1696
|
-
this._adapter.addCalendarMinutes(this.activeDate, this.timeInterval);
|
|
1697
|
-
this.selectAMPM(this.activeDate);
|
|
1718
|
+
this._clampedActiveDate.set(this.clockView() === 'hour'
|
|
1719
|
+
? this._adapter.addCalendarHours(this.activeDate(), 1)
|
|
1720
|
+
: this._adapter.addCalendarMinutes(this.activeDate(), this.timeInterval()));
|
|
1721
|
+
this.selectAMPM(this.activeDate());
|
|
1698
1722
|
break;
|
|
1699
1723
|
case 'ArrowDown':
|
|
1700
|
-
this.
|
|
1701
|
-
this._adapter.addCalendarHours(this.activeDate, -1)
|
|
1702
|
-
this._adapter.addCalendarMinutes(this.activeDate, -this.timeInterval);
|
|
1703
|
-
this.selectAMPM(this.activeDate);
|
|
1724
|
+
this._clampedActiveDate.set(this.clockView() === 'hour'
|
|
1725
|
+
? this._adapter.addCalendarHours(this.activeDate(), -1)
|
|
1726
|
+
: this._adapter.addCalendarMinutes(this.activeDate(), -this.timeInterval()));
|
|
1727
|
+
this.selectAMPM(this.activeDate());
|
|
1704
1728
|
break;
|
|
1705
1729
|
case 'Enter':
|
|
1706
|
-
if (!this.timeInput) {
|
|
1707
|
-
this.dialTimeSelected(this.activeDate);
|
|
1730
|
+
if (!this.timeInput()) {
|
|
1731
|
+
this.dialTimeSelected(this.activeDate());
|
|
1708
1732
|
}
|
|
1709
1733
|
return;
|
|
1710
1734
|
default:
|
|
@@ -1713,13 +1737,19 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1713
1737
|
event.preventDefault();
|
|
1714
1738
|
}
|
|
1715
1739
|
_prevMonthInSameCol(date) {
|
|
1716
|
-
const increment = this._adapter.getMonth(date) <= 4
|
|
1717
|
-
|
|
1740
|
+
const increment = this._adapter.getMonth(date) <= 4
|
|
1741
|
+
? -5
|
|
1742
|
+
: this._adapter.getMonth(date) >= 7
|
|
1743
|
+
? -7
|
|
1744
|
+
: -12;
|
|
1718
1745
|
return this._adapter.addCalendarMonths(date, increment);
|
|
1719
1746
|
}
|
|
1720
1747
|
_nextMonthInSameCol(date) {
|
|
1721
|
-
const increment = this._adapter.getMonth(date) <= 4
|
|
1722
|
-
|
|
1748
|
+
const increment = this._adapter.getMonth(date) <= 4
|
|
1749
|
+
? 7
|
|
1750
|
+
: this._adapter.getMonth(date) >= 7
|
|
1751
|
+
? 5
|
|
1752
|
+
: 12;
|
|
1723
1753
|
return this._adapter.addCalendarMonths(date, increment);
|
|
1724
1754
|
}
|
|
1725
1755
|
_changeCalendarState(direction) {
|
|
@@ -1728,62 +1758,29 @@ class CmatDatetimepickerCalendarComponent {
|
|
|
1728
1758
|
_2digit(n) {
|
|
1729
1759
|
return ('00' + n).slice(-2);
|
|
1730
1760
|
}
|
|
1731
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1732
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: CmatDatetimepickerCalendarComponent, isStandalone: true, selector: "cmat-datetimepicker-calendar", inputs: { multiYearSelector: "multiYearSelector", startView: "startView", twelvehour: "twelvehour", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: "preventSameDateTimeSelection", type: "type", startAt: "startAt", timeInput: "timeInput", selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange", viewChanged: "viewChanged" }, host: { listeners: { "keydown": "handleCalendarBodyKeydown($event)" }, properties: { "class.cmat-datetimepicker-calendar-with-time-input": "timeInput", "class": "this.class", "attr.aria-label": "this.label", "role": "this.role", "tabindex": "this.tabindex" } }, exportAs: ["cmatDatetimepickerCalendar"], ngImport: i0, template: "<div class=\"cmat-datetimepicker-calendar-header\" [attr.data-refresh]=\"intlVersion()\">\r\n @if (type !== 'time') {\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-year header-button\"\r\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\" [attr.aria-label]=\"yearButtonLabel\"\r\n (click)=\"yearClicked()\">\r\n <span class=\"font-medium\">{{ yearButtonText }}</span>\r\n @if (multiYearSelector || type === 'year') {\r\n <svg class=\"cmat-datetimepicker-calendar-header-year-dropdown\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\">\r\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\r\n </svg>\r\n }\r\n </div>\r\n }\r\n @if (type !== 'year') {\r\n <div class=\"cmat-datetimepicker-calendar-header-date-time\">\r\n @if (type !== 'time') {\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-date header-button\"\r\n [class.active]=\"currentView === 'month'\" [class.not-clickable]=\"type === 'month'\"\r\n [attr.aria-label]=\"dateButtonLabel\" (click)=\"dateClicked()\">{{ dateButtonText }}</div>\r\n }\r\n @if (type.endsWith('time')) {\r\n <span class=\"cmat-datetimepicker-calendar-header-time\" [class.active]=\"currentView === 'clock'\">\r\n <span class=\"cmat-datetimepicker-calendar-header-hour-minute-container flex place-items-center\">\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-hours header-button\"\r\n [class.active]=\"clockView === 'hour'\" [attr.aria-label]=\"hourButtonLabel\" (click)=\"hoursClicked()\">\r\n {{ hoursButtonText }}</div>\r\n <span class=\"cmat-datetimepicker-calendar-header-hour-minute-separator\">:</span>\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-minutes header-button\"\r\n [class.active]=\"clockView === 'minute'\" [attr.aria-label]=\"minuteButtonLabel\" (click)=\"minutesClicked()\">{{\r\n minutesButtonText }}</div>\r\n </span>\r\n @if (twelvehour) {\r\n <span class=\"cmat-datetimepicker-calendar-header-ampm-container flex place-items-center\">\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-ampm header-button\" aria-label=\"AM\"\r\n [class.active]=\"AMPM === 'AM'\" (click)=\"ampmClicked('AM')\">AM</div>\r\n <div role=\"presentation\" class=\"cmat-datetimepicker-calendar-header-ampm header-button\" aria-label=\"PM\"\r\n [class.active]=\"AMPM === 'PM'\" (click)=\"ampmClicked('PM')\">PM</div>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<div class=\"cmat-datetimepicker-calendar-content\" [ngClass]=\"{'flex flex-col justify-center': currentView==='clock'}\">\r\n @if (currentView === 'month' || currentView === 'year' || currentView === 'multi-year') {\r\n <div class=\"cmat-datetimepickermonth-content\">\r\n <div class=\"cmat-datetimepicker-calendar-controls\">\r\n <button matIconButton type=\"button\" class=\"cmat-datetimepicker-calendar-previous-button\"\r\n [class.disabled]=\"!previousEnabled()\" [attr.aria-disabled]=\"!previousEnabled()\"\r\n [attr.aria-label]=\"prevButtonLabel\" (click)=\"previousClicked()\">\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\r\n </svg>\r\n </button>\r\n <div class=\"cmat-datetimepicker-calendar-period-button text-default font-medium cmat-calendar-slide-animation\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\">\r\n <strong>{{ yearPeriodText }}</strong>\r\n </div>\r\n <button type=\"button\" matIconButton class=\"cmat-datetimepicker-calendar-next-button\"\r\n [class.disabled]=\"!nextEnabled()\" [attr.aria-disabled]=\"!nextEnabled()\" [attr.aria-label]=\"nextButtonLabel\"\r\n (click)=\"nextClicked()\">\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n\r\n @switch (currentView) {\r\n @case ('month') {\r\n <cmat-datetimepicker-month-view [activeDate]=\"activeDate\" [dateFilter]=\"dateFilterForViews\" [selected]=\"selected!\"\r\n [type]=\"type\" (userSelection)=\"userSelected()\" (selectedChange)=\"dateSelected($event)\">\r\n </cmat-datetimepicker-month-view>\r\n }\r\n @case ('year') {\r\n <cmat-datetimepicker-year-view [activeDate]=\"activeDate\" [dateFilter]=\"dateFilterForViews\" [selected]=\"selected!\"\r\n [type]=\"type\" (userSelection)=\"userSelected()\" (selectedChange)=\"monthSelected($event)\">\r\n </cmat-datetimepicker-year-view>\r\n }\r\n @case ('multi-year') {\r\n <cmat-datetimepicker-multi-year-view [activeDate]=\"activeDate\" [dateFilter]=\"dateFilterForViews\" [maxDate]=\"maxDate\"\r\n [minDate]=\"minDate\" [selected]=\"selected!\" [type]=\"type\" (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"yearSelected($event)\">\r\n </cmat-datetimepicker-multi-year-view>\r\n }\r\n @default {\r\n @if (timeInput) {\r\n <cmat-datetimepicker-time [AMPM]=\"AMPM\" [clockView]=\"clockView\" [twelvehour]=\"twelvehour\" [dateFilter]=\"dateFilter\"\r\n [interval]=\"timeInterval\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [selected]=\"activeDate\"\r\n (userSelection)=\"userSelected()\" (activeDateChange)=\"onActiveDateChange($event)\"\r\n (selectedChange)=\"timeSelected($event)\" (ampmChange)=\"ampmClicked($event)\" (clockViewChange)=\"clockView = $event\">\r\n </cmat-datetimepicker-time>\r\n } @else {\r\n <cmat-datetimepicker-clock [dateFilter]=\"dateFilter\" [interval]=\"timeInterval\" [maxDate]=\"maxDate\" [minDate]=\"minDate\"\r\n [selected]=\"activeDate\" [startView]=\"clockView\" [twelvehour]=\"twelvehour\" (userSelection)=\"userSelected()\"\r\n (activeDateChange)=\"onActiveDateChange($event)\" (selectedChange)=\"dialTimeSelected($event)\">\r\n </cmat-datetimepicker-clock>\r\n }\r\n }\r\n }\r\n</div>\r\n", styles: [".cmat-datetimepicker-calendar{display:block;outline:none}.cmat-datetimepicker-calendar-header{box-sizing:border-box;padding:8px;border-radius:4px 4px 0 0;min-width:264px}.cmat-datetimepicker-calendar-header .header-button{color:#fff!important;padding:0 4px;font-size:inherit;white-space:normal;word-break:break-word;font-weight:500;cursor:pointer}.cmat-datetimepicker-calendar-header-year.header-button{font-size:26px;line-height:24px;display:flex}.cmat-datetimepicker-calendar-header-date-time{font-size:24px;line-height:36px;display:flex;flex-direction:row}.cmat-datetimepicker-calendar-header-year:not(.active),.cmat-datetimepicker-calendar-header-date:not(.active),.cmat-datetimepicker-calendar-header-hours:not(.active),.cmat-datetimepicker-calendar-header-minutes:not(.active),.cmat-datetimepicker-calendar-header-ampm:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-year.not-clickable,.cmat-datetimepicker-calendar-header-date.not-clickable,.cmat-datetimepicker-calendar-header-hours.not-clickable,.cmat-datetimepicker-calendar-header-minutes.not-clickable,.cmat-datetimepicker-calendar-header-ampm.not-clickable{cursor:initial}.cmat-datetimepicker-calendar-header-time{display:inline-flex}.cmat-datetimepicker-calendar-header-time:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-hours,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-minutes,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-ampm{opacity:1}.cmat-datetimepicker-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.cmat-datetimepicker-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}.cmat-datetimepicker-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.cmat-datetimepicker-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.cmat-datetimepicker-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.cmat-datetimepicker-calendar-previous-button.disabled,.cmat-datetimepicker-calendar-next-button.disabled{pointer-events:none}.cmat-datetimepicker-calendar-previous-button svg,.cmat-datetimepicker-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .cmat-datetimepicker-calendar-previous-button svg,[dir=rtl] .cmat-datetimepicker-calendar-next-button svg{transform:rotate(180deg)}.cmat-datetimepicker-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.cmat-datetimepicker-calendar-table-header th{text-align:center;padding:8px 0}\n", ".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: CmatDatetimepickerMonthViewComponent, selector: "cmat-datetimepicker-month-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerMonthView"] }, { kind: "component", type: CmatDatetimepickerYearViewComponent, selector: "cmat-datetimepicker-year-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerYearView"] }, { kind: "component", type: CmatDatetimepickerMultiYearViewComponent, selector: "cmat-datetimepicker-multi-year-view", inputs: ["type", "dateFilter", "activeDate", "selected", "minDate", "maxDate"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerMultiYearView"] }, { kind: "component", type: CmatDatetimepickerTimeComponent, selector: "cmat-datetimepicker-time", inputs: ["dateFilter", "interval", "AMPM", "twelvehour", "activeDate", "selected", "minDate", "maxDate", "clockView"], outputs: ["selectedChange", "activeDateChange", "userSelection", "ampmChange", "clockViewChange"], exportAs: ["cmatDatetimepickerTime"] }, { kind: "component", type: CmatDatetimepickerClockComponent, selector: "cmat-datetimepicker-clock", inputs: ["dateFilter", "interval", "twelvehour", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["userSelection", "selectedChange", "activeDateChange"], exportAs: ["cmatDatetimepickerClock"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1761
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1762
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerCalendarComponent, isStandalone: true, selector: "cmat-datetimepicker-calendar", inputs: { startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, twelvehour: { classPropertyName: "twelvehour", publicName: "twelvehour", isSignal: true, isRequired: false, transformFunction: null }, timeInterval: { classPropertyName: "timeInterval", publicName: "timeInterval", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, multiYearSelector: { classPropertyName: "multiYearSelector", publicName: "multiYearSelector", isSignal: true, isRequired: false, transformFunction: null }, timeInput: { classPropertyName: "timeInput", publicName: "timeInput", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, preventSameDateTimeSelection: { classPropertyName: "preventSameDateTimeSelection", publicName: "preventSameDateTimeSelection", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { userSelection: "userSelection", selectedChange: "selectedChange", viewChanged: "viewChanged", multiYearSelector: "multiYearSelectorChange" }, host: { attributes: { "role": "dialog", "tabindex": "0" }, properties: { "attr.aria-label": "\"ariaLabel\"", "class.cmat-datetimepicker-calendar-with-time-input": "timeInput()" }, classAttribute: "cmat-datetimepicker-calendar" }, exportAs: ["cmatDatetimepickerCalendar"], ngImport: i0, template: "<div\r\n class=\"cmat-datetimepicker-calendar-header\"\r\n [attr.data-refresh]=\"intlVersion()\"\r\n>\r\n @if (type() !== 'time') {\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-year header-button\"\r\n [class.active]=\"currentView() === 'year' || currentView() === 'multi-year'\"\r\n [attr.aria-label]=\"yearButtonLabel\"\r\n (click)=\"yearClicked()\"\r\n >\r\n <span class=\"font-medium\">{{ yearButtonText }}</span>\r\n @if (multiYearSelector() || type() === 'year') {\r\n <svg\r\n class=\"cmat-datetimepicker-calendar-header-year-dropdown\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\r\n </svg>\r\n }\r\n </div>\r\n } @if (type() !== 'year') {\r\n <div class=\"cmat-datetimepicker-calendar-header-date-time\">\r\n @if (type() !== 'time') {\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-date header-button\"\r\n [class.active]=\"currentView() === 'month'\"\r\n [class.not-clickable]=\"type() === 'month'\"\r\n [attr.aria-label]=\"dateButtonLabel\"\r\n (click)=\"dateClicked()\"\r\n >\r\n {{ dateButtonText }}\r\n </div>\r\n } @if (type().endsWith('time')) {\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-time\"\r\n [class.active]=\"currentView() === 'clock'\"\r\n >\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-hour-minute-container flex place-items-center\"\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-hours header-button\"\r\n [class.active]=\"clockView() === 'hour'\"\r\n [attr.aria-label]=\"hourButtonLabel\"\r\n (click)=\"hoursClicked()\"\r\n >\r\n {{ hoursButtonText }}\r\n </div>\r\n <span class=\"cmat-datetimepicker-calendar-header-hour-minute-separator\"\r\n >:</span\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-minutes header-button\"\r\n [class.active]=\"clockView() === 'minute'\"\r\n [attr.aria-label]=\"minuteButtonLabel\"\r\n (click)=\"minutesClicked()\"\r\n >\r\n {{ minutesButtonText }}\r\n </div>\r\n </span>\r\n @if (twelvehour()) {\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-ampm-container flex place-items-center\"\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-ampm header-button\"\r\n aria-label=\"AM\"\r\n [class.active]=\"AMPM() === 'AM'\"\r\n (click)=\"ampmClicked('AM')\"\r\n >\r\n AM\r\n </div>\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-ampm header-button\"\r\n aria-label=\"PM\"\r\n [class.active]=\"AMPM() === 'PM'\"\r\n (click)=\"ampmClicked('PM')\"\r\n >\r\n PM\r\n </div>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<div\r\n class=\"cmat-datetimepicker-calendar-content\"\r\n [ngClass]=\"{'flex flex-col justify-center': currentView() === 'clock'}\"\r\n>\r\n @if (currentView() === 'month' || currentView() === 'year' || currentView() ===\r\n 'multi-year') {\r\n <div class=\"cmat-datetimepickermonth-content\">\r\n <div class=\"cmat-datetimepicker-calendar-controls\">\r\n <button\r\n matIconButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-calendar-previous-button\"\r\n [class.disabled]=\"!previousEnabled()\"\r\n [attr.aria-disabled]=\"!previousEnabled()\"\r\n [attr.aria-label]=\"prevButtonLabel\"\r\n (click)=\"previousClicked()\"\r\n >\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\r\n </svg>\r\n </button>\r\n <div\r\n class=\"cmat-datetimepicker-calendar-period-button text-default font-medium cmat-calendar-slide-animation\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\"\r\n >\r\n <strong>{{ yearPeriodText }}</strong>\r\n </div>\r\n <button\r\n type=\"button\"\r\n matIconButton\r\n class=\"cmat-datetimepicker-calendar-next-button\"\r\n [class.disabled]=\"!nextEnabled()\"\r\n [attr.aria-disabled]=\"!nextEnabled()\"\r\n [attr.aria-label]=\"nextButtonLabel\"\r\n (click)=\"nextClicked()\"\r\n >\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n } @switch (currentView()) { @case ('month') {\r\n <cmat-datetimepicker-month-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"dateSelected($event)\"\r\n >\r\n </cmat-datetimepicker-month-view>\r\n } @case ('year') {\r\n <cmat-datetimepicker-year-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"monthSelected($event)\"\r\n >\r\n </cmat-datetimepicker-year-view>\r\n } @case ('multi-year') {\r\n <cmat-datetimepicker-multi-year-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"yearSelected($event)\"\r\n >\r\n </cmat-datetimepicker-multi-year-view>\r\n } @default { @if (timeInput()) {\r\n <cmat-datetimepicker-time\r\n [AMPM]=\"AMPM()\"\r\n [clockView]=\"clockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"timeInterval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"activeDate()\"\r\n (userSelection)=\"userSelected()\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n (selectedChange)=\"timeSelected($event)\"\r\n (ampmChange)=\"ampmClicked($event)\"\r\n (clockViewChange)=\"clockView.set($event)\"\r\n >\r\n </cmat-datetimepicker-time>\r\n } @else {\r\n <cmat-datetimepicker-clock\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"timeInterval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"activeDate()\"\r\n [startView]=\"clockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n (userSelection)=\"userSelected()\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n (selectedChange)=\"dialTimeSelected($event)\"\r\n >\r\n </cmat-datetimepicker-clock>\r\n } } }\r\n</div>\r\n", styles: [".cmat-datetimepicker-calendar{display:block;outline:none}.cmat-datetimepicker-calendar-header{box-sizing:border-box;padding:8px;border-radius:4px 4px 0 0;min-width:264px}.cmat-datetimepicker-calendar-header .header-button{color:#fff!important;padding:0 4px;font-size:inherit;white-space:normal;word-break:break-word;font-weight:500;cursor:pointer}.cmat-datetimepicker-calendar-header-year.header-button{font-size:26px;line-height:24px;display:flex}.cmat-datetimepicker-calendar-header-date-time{font-size:24px;line-height:36px;display:flex;flex-direction:row}.cmat-datetimepicker-calendar-header-year:not(.active),.cmat-datetimepicker-calendar-header-date:not(.active),.cmat-datetimepicker-calendar-header-hours:not(.active),.cmat-datetimepicker-calendar-header-minutes:not(.active),.cmat-datetimepicker-calendar-header-ampm:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-year.not-clickable,.cmat-datetimepicker-calendar-header-date.not-clickable,.cmat-datetimepicker-calendar-header-hours.not-clickable,.cmat-datetimepicker-calendar-header-minutes.not-clickable,.cmat-datetimepicker-calendar-header-ampm.not-clickable{cursor:initial}.cmat-datetimepicker-calendar-header-time{display:inline-flex}.cmat-datetimepicker-calendar-header-time:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-hours,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-minutes,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-ampm{opacity:1}.cmat-datetimepicker-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.cmat-datetimepicker-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}.cmat-datetimepicker-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.cmat-datetimepicker-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.cmat-datetimepicker-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.cmat-datetimepicker-calendar-previous-button.disabled,.cmat-datetimepicker-calendar-next-button.disabled{pointer-events:none}.cmat-datetimepicker-calendar-previous-button svg,.cmat-datetimepicker-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .cmat-datetimepicker-calendar-previous-button svg,[dir=rtl] .cmat-datetimepicker-calendar-next-button svg{transform:rotate(180deg)}.cmat-datetimepicker-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.cmat-datetimepicker-calendar-table-header th{text-align:center;padding:8px 0}\n", ".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: CmatDatetimepickerMonthViewComponent, selector: "cmat-datetimepicker-month-view", inputs: ["type", "dateFilter", "minDate", "maxDate", "selected", "activeDate"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerMonthView"] }, { kind: "component", type: CmatDatetimepickerYearViewComponent, selector: "cmat-datetimepicker-year-view", inputs: ["type", "dateFilter", "minDate", "maxDate", "selected", "activeDate"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerYearView"] }, { kind: "component", type: CmatDatetimepickerMultiYearViewComponent, selector: "cmat-datetimepicker-multi-year-view", inputs: ["type", "dateFilter", "minDate", "maxDate", "selected", "activeDate"], outputs: ["userSelection", "selectedChange"], exportAs: ["cmatDatetimepickerMultiYearView"] }, { kind: "component", type: CmatDatetimepickerTimeComponent, selector: "cmat-datetimepicker-time", inputs: ["dateFilter", "interval", "AMPM", "twelvehour", "minDate", "maxDate", "selected", "clockView"], outputs: ["selectedChange", "activeDateChange", "userSelection", "ampmChange", "clockViewChange"], exportAs: ["cmatDatetimepickerTime"] }, { kind: "component", type: CmatDatetimepickerClockComponent, selector: "cmat-datetimepicker-clock", inputs: ["dateFilter", "interval", "twelvehour", "minDate", "maxDate", "selected", "startView", "activeDate"], outputs: ["userSelection", "selectedChange", "activeDateChange"], exportAs: ["cmatDatetimepickerClock"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1733
1763
|
}
|
|
1734
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerCalendarComponent, decorators: [{
|
|
1735
1765
|
type: Component,
|
|
1736
1766
|
args: [{ selector: 'cmat-datetimepicker-calendar', host: {
|
|
1767
|
+
'class': 'cmat-datetimepicker-calendar',
|
|
1737
1768
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1738
|
-
'[
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
}], dateFilter: [{
|
|
1752
|
-
|
|
1753
|
-
}], preventSameDateTimeSelection: [{
|
|
1754
|
-
type: Input
|
|
1755
|
-
}], selectedChange: [{
|
|
1756
|
-
type: Output
|
|
1757
|
-
}], viewChanged: [{
|
|
1758
|
-
type: Output
|
|
1759
|
-
}], class: [{
|
|
1760
|
-
type: HostBinding,
|
|
1761
|
-
args: ['class']
|
|
1762
|
-
}], label: [{
|
|
1763
|
-
type: HostBinding,
|
|
1764
|
-
args: ['attr.aria-label']
|
|
1765
|
-
}], role: [{
|
|
1766
|
-
type: HostBinding,
|
|
1767
|
-
args: ['role']
|
|
1768
|
-
}], tabindex: [{
|
|
1769
|
-
type: HostBinding,
|
|
1770
|
-
args: ['tabindex']
|
|
1771
|
-
}], type: [{
|
|
1772
|
-
type: Input
|
|
1773
|
-
}], startAt: [{
|
|
1774
|
-
type: Input
|
|
1775
|
-
}], timeInput: [{
|
|
1776
|
-
type: Input
|
|
1777
|
-
}], selected: [{
|
|
1778
|
-
type: Input
|
|
1779
|
-
}], minDate: [{
|
|
1780
|
-
type: Input
|
|
1781
|
-
}], maxDate: [{
|
|
1782
|
-
type: Input
|
|
1783
|
-
}], handleCalendarBodyKeydown: [{
|
|
1784
|
-
type: HostListener,
|
|
1785
|
-
args: ['keydown', ['$event']]
|
|
1786
|
-
}] } });
|
|
1769
|
+
'[attr.aria-label]': '"ariaLabel"',
|
|
1770
|
+
'role': 'dialog',
|
|
1771
|
+
'tabindex': '0',
|
|
1772
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1773
|
+
'[class.cmat-datetimepicker-calendar-with-time-input]': 'timeInput()',
|
|
1774
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerCalendar', imports: [
|
|
1775
|
+
MatButtonModule,
|
|
1776
|
+
CmatDatetimepickerMonthViewComponent,
|
|
1777
|
+
CmatDatetimepickerYearViewComponent,
|
|
1778
|
+
CmatDatetimepickerMultiYearViewComponent,
|
|
1779
|
+
CmatDatetimepickerTimeComponent,
|
|
1780
|
+
CmatDatetimepickerClockComponent,
|
|
1781
|
+
NgClass,
|
|
1782
|
+
], template: "<div\r\n class=\"cmat-datetimepicker-calendar-header\"\r\n [attr.data-refresh]=\"intlVersion()\"\r\n>\r\n @if (type() !== 'time') {\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-year header-button\"\r\n [class.active]=\"currentView() === 'year' || currentView() === 'multi-year'\"\r\n [attr.aria-label]=\"yearButtonLabel\"\r\n (click)=\"yearClicked()\"\r\n >\r\n <span class=\"font-medium\">{{ yearButtonText }}</span>\r\n @if (multiYearSelector() || type() === 'year') {\r\n <svg\r\n class=\"cmat-datetimepicker-calendar-header-year-dropdown\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"currentColor\"\r\n >\r\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\r\n </svg>\r\n }\r\n </div>\r\n } @if (type() !== 'year') {\r\n <div class=\"cmat-datetimepicker-calendar-header-date-time\">\r\n @if (type() !== 'time') {\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-date header-button\"\r\n [class.active]=\"currentView() === 'month'\"\r\n [class.not-clickable]=\"type() === 'month'\"\r\n [attr.aria-label]=\"dateButtonLabel\"\r\n (click)=\"dateClicked()\"\r\n >\r\n {{ dateButtonText }}\r\n </div>\r\n } @if (type().endsWith('time')) {\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-time\"\r\n [class.active]=\"currentView() === 'clock'\"\r\n >\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-hour-minute-container flex place-items-center\"\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-hours header-button\"\r\n [class.active]=\"clockView() === 'hour'\"\r\n [attr.aria-label]=\"hourButtonLabel\"\r\n (click)=\"hoursClicked()\"\r\n >\r\n {{ hoursButtonText }}\r\n </div>\r\n <span class=\"cmat-datetimepicker-calendar-header-hour-minute-separator\"\r\n >:</span\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-minutes header-button\"\r\n [class.active]=\"clockView() === 'minute'\"\r\n [attr.aria-label]=\"minuteButtonLabel\"\r\n (click)=\"minutesClicked()\"\r\n >\r\n {{ minutesButtonText }}\r\n </div>\r\n </span>\r\n @if (twelvehour()) {\r\n <span\r\n class=\"cmat-datetimepicker-calendar-header-ampm-container flex place-items-center\"\r\n >\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-ampm header-button\"\r\n aria-label=\"AM\"\r\n [class.active]=\"AMPM() === 'AM'\"\r\n (click)=\"ampmClicked('AM')\"\r\n >\r\n AM\r\n </div>\r\n <div\r\n role=\"presentation\"\r\n class=\"cmat-datetimepicker-calendar-header-ampm header-button\"\r\n aria-label=\"PM\"\r\n [class.active]=\"AMPM() === 'PM'\"\r\n (click)=\"ampmClicked('PM')\"\r\n >\r\n PM\r\n </div>\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<div\r\n class=\"cmat-datetimepicker-calendar-content\"\r\n [ngClass]=\"{'flex flex-col justify-center': currentView() === 'clock'}\"\r\n>\r\n @if (currentView() === 'month' || currentView() === 'year' || currentView() ===\r\n 'multi-year') {\r\n <div class=\"cmat-datetimepickermonth-content\">\r\n <div class=\"cmat-datetimepicker-calendar-controls\">\r\n <button\r\n matIconButton\r\n type=\"button\"\r\n class=\"cmat-datetimepicker-calendar-previous-button\"\r\n [class.disabled]=\"!previousEnabled()\"\r\n [attr.aria-disabled]=\"!previousEnabled()\"\r\n [attr.aria-label]=\"prevButtonLabel\"\r\n (click)=\"previousClicked()\"\r\n >\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\r\n </svg>\r\n </button>\r\n <div\r\n class=\"cmat-datetimepicker-calendar-period-button text-default font-medium cmat-calendar-slide-animation\"\r\n [ngClass]=\"{\r\n 'left': calendarState()==='left',\r\n 'right': calendarState()==='right'\r\n }\"\r\n >\r\n <strong>{{ yearPeriodText }}</strong>\r\n </div>\r\n <button\r\n type=\"button\"\r\n matIconButton\r\n class=\"cmat-datetimepicker-calendar-next-button\"\r\n [class.disabled]=\"!nextEnabled()\"\r\n [attr.aria-disabled]=\"!nextEnabled()\"\r\n [attr.aria-label]=\"nextButtonLabel\"\r\n (click)=\"nextClicked()\"\r\n >\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n } @switch (currentView()) { @case ('month') {\r\n <cmat-datetimepicker-month-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"dateSelected($event)\"\r\n >\r\n </cmat-datetimepicker-month-view>\r\n } @case ('year') {\r\n <cmat-datetimepicker-year-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"monthSelected($event)\"\r\n >\r\n </cmat-datetimepicker-year-view>\r\n } @case ('multi-year') {\r\n <cmat-datetimepicker-multi-year-view\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilterForViews\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"selected()\"\r\n [type]=\"type()\"\r\n (userSelection)=\"userSelected()\"\r\n (selectedChange)=\"yearSelected($event)\"\r\n >\r\n </cmat-datetimepicker-multi-year-view>\r\n } @default { @if (timeInput()) {\r\n <cmat-datetimepicker-time\r\n [AMPM]=\"AMPM()\"\r\n [clockView]=\"clockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"timeInterval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"activeDate()\"\r\n (userSelection)=\"userSelected()\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n (selectedChange)=\"timeSelected($event)\"\r\n (ampmChange)=\"ampmClicked($event)\"\r\n (clockViewChange)=\"clockView.set($event)\"\r\n >\r\n </cmat-datetimepicker-time>\r\n } @else {\r\n <cmat-datetimepicker-clock\r\n [activeDate]=\"activeDate()\"\r\n [dateFilter]=\"dateFilter()\"\r\n [interval]=\"timeInterval()\"\r\n [maxDate]=\"maxDate()\"\r\n [minDate]=\"minDate()\"\r\n [selected]=\"activeDate()\"\r\n [startView]=\"clockView()\"\r\n [twelvehour]=\"twelvehour()\"\r\n (userSelection)=\"userSelected()\"\r\n (activeDateChange)=\"onActiveDateChange($event)\"\r\n (selectedChange)=\"dialTimeSelected($event)\"\r\n >\r\n </cmat-datetimepicker-clock>\r\n } } }\r\n</div>\r\n", styles: [".cmat-datetimepicker-calendar{display:block;outline:none}.cmat-datetimepicker-calendar-header{box-sizing:border-box;padding:8px;border-radius:4px 4px 0 0;min-width:264px}.cmat-datetimepicker-calendar-header .header-button{color:#fff!important;padding:0 4px;font-size:inherit;white-space:normal;word-break:break-word;font-weight:500;cursor:pointer}.cmat-datetimepicker-calendar-header-year.header-button{font-size:26px;line-height:24px;display:flex}.cmat-datetimepicker-calendar-header-date-time{font-size:24px;line-height:36px;display:flex;flex-direction:row}.cmat-datetimepicker-calendar-header-year:not(.active),.cmat-datetimepicker-calendar-header-date:not(.active),.cmat-datetimepicker-calendar-header-hours:not(.active),.cmat-datetimepicker-calendar-header-minutes:not(.active),.cmat-datetimepicker-calendar-header-ampm:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-year.not-clickable,.cmat-datetimepicker-calendar-header-date.not-clickable,.cmat-datetimepicker-calendar-header-hours.not-clickable,.cmat-datetimepicker-calendar-header-minutes.not-clickable,.cmat-datetimepicker-calendar-header-ampm.not-clickable{cursor:initial}.cmat-datetimepicker-calendar-header-time{display:inline-flex}.cmat-datetimepicker-calendar-header-time:not(.active){opacity:.6}.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-hours,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-minutes,.cmat-datetimepicker-calendar-header-time:not(.active) .cmat-datetimepicker-calendar-header-ampm{opacity:1}.cmat-datetimepicker-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.cmat-datetimepicker-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}.cmat-datetimepicker-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.cmat-datetimepicker-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.cmat-datetimepicker-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.cmat-datetimepicker-calendar-previous-button.disabled,.cmat-datetimepicker-calendar-next-button.disabled{pointer-events:none}.cmat-datetimepicker-calendar-previous-button svg,.cmat-datetimepicker-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .cmat-datetimepicker-calendar-previous-button svg,[dir=rtl] .cmat-datetimepicker-calendar-next-button svg{transform:rotate(180deg)}.cmat-datetimepicker-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.cmat-datetimepicker-calendar-table-header th{text-align:center;padding:8px 0}\n", ".cmat-calendar-slide-animation.left{animation:slideCalendarLeft .18s}.cmat-calendar-slide-animation.right{animation:slideCalendarRight .18s}@keyframes slideCalendarLeft{0%,50%{transform:translate(100%)}51%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideCalendarRight{0%,50%{transform:translate(-100%)}51%{transform:translate(100%)}to{transform:translate(0)}}\n"] }]
|
|
1783
|
+
}], ctorParameters: () => [], propDecorators: { userSelection: [{ type: i0.Output, args: ["userSelection"] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], viewChanged: [{ type: i0.Output, args: ["viewChanged"] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], twelvehour: [{ type: i0.Input, args: [{ isSignal: true, alias: "twelvehour", required: false }] }], timeInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInterval", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], multiYearSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiYearSelector", required: false }] }, { type: i0.Output, args: ["multiYearSelectorChange"] }], timeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInput", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], preventSameDateTimeSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "preventSameDateTimeSelection", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }] } });
|
|
1787
1784
|
|
|
1788
1785
|
let datetimepickerUid = 0;
|
|
1789
1786
|
const CMAT_DATETIMEPICKER_SCROLL_STRATEGY = new InjectionToken('cmat-datetimepicker-scroll-strategy');
|
|
@@ -1794,27 +1791,33 @@ function CMAT_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
|
|
|
1794
1791
|
const CMAT_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
1795
1792
|
provide: CMAT_DATETIMEPICKER_SCROLL_STRATEGY,
|
|
1796
1793
|
deps: [Overlay],
|
|
1797
|
-
useFactory: CMAT_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY
|
|
1794
|
+
useFactory: CMAT_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY,
|
|
1798
1795
|
};
|
|
1799
1796
|
class CmatDatetimepickerContentComponent {
|
|
1800
1797
|
constructor() {
|
|
1801
|
-
this.
|
|
1798
|
+
this._calendar = viewChild.required(CmatDatetimepickerCalendarComponent);
|
|
1799
|
+
this.color = input(/* @ts-ignore */
|
|
1800
|
+
...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1801
|
+
this.animationState = signal('enter-dropdown', /* @ts-ignore */
|
|
1802
|
+
...(ngDevMode ? [{ debugName: "animationState" }] : /* istanbul ignore next */ []));
|
|
1802
1803
|
this.animationDone = new Subject();
|
|
1803
1804
|
this.dialogLabelId = null;
|
|
1804
1805
|
this._elementRef = inject(ElementRef);
|
|
1805
1806
|
this._animationEndListener = null;
|
|
1806
1807
|
}
|
|
1807
1808
|
ngOnInit() {
|
|
1808
|
-
this.animationState.set(this.datetimepicker.touchUi ? 'enter-dialog' : 'enter-dropdown');
|
|
1809
|
+
this.animationState.set(this.datetimepicker.touchUi() ? 'enter-dialog' : 'enter-dropdown');
|
|
1809
1810
|
this._animationEndListener = (event) => {
|
|
1810
|
-
if (event.animationName === 'panel-dropdown-enter' ||
|
|
1811
|
+
if (event.animationName === 'panel-dropdown-enter' ||
|
|
1812
|
+
event.animationName === 'panel-dialog-enter' ||
|
|
1813
|
+
event.animationName === 'panel-leave') {
|
|
1811
1814
|
this.animationDone.next();
|
|
1812
1815
|
}
|
|
1813
1816
|
};
|
|
1814
1817
|
this._elementRef.nativeElement.addEventListener('animationend', this._animationEndListener);
|
|
1815
1818
|
}
|
|
1816
1819
|
ngAfterContentInit() {
|
|
1817
|
-
this._calendar.focusActiveCell();
|
|
1820
|
+
this._calendar().focusActiveCell();
|
|
1818
1821
|
}
|
|
1819
1822
|
startExitAnimation() {
|
|
1820
1823
|
this.animationState.set('leave');
|
|
@@ -1823,15 +1826,15 @@ class CmatDatetimepickerContentComponent {
|
|
|
1823
1826
|
this.animationDone.complete();
|
|
1824
1827
|
this._elementRef.nativeElement.removeEventListener('animationend', this._animationEndListener);
|
|
1825
1828
|
}
|
|
1826
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1827
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1829
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1830
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: CmatDatetimepickerContentComponent, isStandalone: true, selector: "cmat-datetimepicker-content", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "color() ? \"mat-\" + color() : \"\"", "class.enter-dropdown": "animationState() === \"enter-dropdown\"", "class.enter-dialog": "animationState() === \"enter-dialog\"", "class.leave": "animationState() === \"leave\"", "class.cmat-datetimepicker-content-touch": "datetimepicker?.touchUi()", "attr.mode": "datetimepicker.mode()" }, classAttribute: "cmat-datetimepicker-content cmat-datetimepicker-transform-panel" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: CmatDatetimepickerCalendarComponent, descendants: true, isSignal: true }], exportAs: ["cmatDatetimepickerContent"], ngImport: i0, template: "<div\r\n cdkTrapFocus\r\n role=\"dialog\"\r\n class=\"cmat-datetimepicker-content-container\"\r\n [attr.aria-modal]=\"true\"\r\n [attr.aria-labelledby]=\"dialogLabelId ?? undefined\"\r\n [attr.mode]=\"datetimepicker.mode()\"\r\n>\r\n <cmat-datetimepicker-calendar\r\n [id]=\"datetimepicker.id\"\r\n [ngClass]=\"datetimepicker.panelClass()\"\r\n [attr.mode]=\"datetimepicker.mode()\"\r\n [type]=\"datetimepicker.type()\"\r\n [startAt]=\"$any(datetimepicker.startAt())\"\r\n [startView]=\"datetimepicker.startView()\"\r\n [maxDate]=\"$any(datetimepicker.maxDate())\"\r\n [minDate]=\"$any(datetimepicker.minDate())\"\r\n [dateFilter]=\"$any(datetimepicker.dateFilter())\"\r\n [multiYearSelector]=\"datetimepicker.multiYearSelector()\"\r\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection()\"\r\n [timeInterval]=\"datetimepicker.timeInterval()\"\r\n [twelvehour]=\"datetimepicker.twelvehour()\"\r\n [selected]=\"$any(datetimepicker.selected())\"\r\n [timeInput]=\"datetimepicker.timeInput()\"\r\n (selectedChange)=\"datetimepicker.select($any($event))\"\r\n (viewChanged)=\"datetimepicker.viewChange($event)\"\r\n (userSelection)=\"datetimepicker.close()\"\r\n >\r\n </cmat-datetimepicker-calendar>\r\n</div>", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: CmatDatetimepickerCalendarComponent, selector: "cmat-datetimepicker-calendar", inputs: ["startView", "twelvehour", "timeInterval", "type", "multiYearSelector", "timeInput", "dateFilter", "preventSameDateTimeSelection", "minDate", "maxDate", "selected", "startAt"], outputs: ["userSelection", "selectedChange", "viewChanged", "multiYearSelectorChange"], exportAs: ["cmatDatetimepickerCalendar"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1828
1831
|
}
|
|
1829
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1832
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerContentComponent, decorators: [{
|
|
1830
1833
|
type: Component,
|
|
1831
1834
|
args: [{ selector: 'cmat-datetimepicker-content', host: {
|
|
1832
1835
|
'class': 'cmat-datetimepicker-content cmat-datetimepicker-transform-panel',
|
|
1833
1836
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1834
|
-
'[class]': 'color ? "mat-" + color : ""',
|
|
1837
|
+
'[class]': 'color() ? "mat-" + color() : ""',
|
|
1835
1838
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1836
1839
|
'[class.enter-dropdown]': 'animationState() === "enter-dropdown"',
|
|
1837
1840
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -1839,153 +1842,117 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
1839
1842
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1840
1843
|
'[class.leave]': 'animationState() === "leave"',
|
|
1841
1844
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1842
|
-
'[class.cmat-datetimepicker-content-touch]': 'datetimepicker?.touchUi',
|
|
1845
|
+
'[class.cmat-datetimepicker-content-touch]': 'datetimepicker?.touchUi()',
|
|
1843
1846
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1844
|
-
'[attr.mode]': 'datetimepicker.mode'
|
|
1845
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerContent', imports: [A11yModule, CmatDatetimepickerCalendarComponent, NgClass], template: "<div
|
|
1846
|
-
}], propDecorators: { _calendar: [{
|
|
1847
|
-
type: ViewChild,
|
|
1848
|
-
args: [CmatDatetimepickerCalendarComponent, { static: true }]
|
|
1849
|
-
}], color: [{
|
|
1850
|
-
type: Input
|
|
1851
|
-
}] } });
|
|
1847
|
+
'[attr.mode]': 'datetimepicker.mode()',
|
|
1848
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDatetimepickerContent', imports: [A11yModule, CmatDatetimepickerCalendarComponent, NgClass], template: "<div\r\n cdkTrapFocus\r\n role=\"dialog\"\r\n class=\"cmat-datetimepicker-content-container\"\r\n [attr.aria-modal]=\"true\"\r\n [attr.aria-labelledby]=\"dialogLabelId ?? undefined\"\r\n [attr.mode]=\"datetimepicker.mode()\"\r\n>\r\n <cmat-datetimepicker-calendar\r\n [id]=\"datetimepicker.id\"\r\n [ngClass]=\"datetimepicker.panelClass()\"\r\n [attr.mode]=\"datetimepicker.mode()\"\r\n [type]=\"datetimepicker.type()\"\r\n [startAt]=\"$any(datetimepicker.startAt())\"\r\n [startView]=\"datetimepicker.startView()\"\r\n [maxDate]=\"$any(datetimepicker.maxDate())\"\r\n [minDate]=\"$any(datetimepicker.minDate())\"\r\n [dateFilter]=\"$any(datetimepicker.dateFilter())\"\r\n [multiYearSelector]=\"datetimepicker.multiYearSelector()\"\r\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection()\"\r\n [timeInterval]=\"datetimepicker.timeInterval()\"\r\n [twelvehour]=\"datetimepicker.twelvehour()\"\r\n [selected]=\"$any(datetimepicker.selected())\"\r\n [timeInput]=\"datetimepicker.timeInput()\"\r\n (selectedChange)=\"datetimepicker.select($any($event))\"\r\n (viewChanged)=\"datetimepicker.viewChange($event)\"\r\n (userSelection)=\"datetimepicker.close()\"\r\n >\r\n </cmat-datetimepicker-calendar>\r\n</div>" }]
|
|
1849
|
+
}], propDecorators: { _calendar: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CmatDatetimepickerCalendarComponent), { isSignal: true }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
1852
1850
|
class CmatDatetimepickerComponent {
|
|
1853
1851
|
constructor() {
|
|
1854
|
-
this.startView = 'month';
|
|
1855
|
-
this.mode = 'auto';
|
|
1856
|
-
this.timeInterval = 1;
|
|
1857
|
-
this.preventSameDateTimeSelection = false;
|
|
1858
|
-
this.xPosition = 'start';
|
|
1859
|
-
this.yPosition = 'below';
|
|
1860
1852
|
this.selectedChanged = new EventEmitter();
|
|
1861
|
-
this.openedStream =
|
|
1862
|
-
this.closedStream =
|
|
1863
|
-
this.viewChanged =
|
|
1853
|
+
this.openedStream = output();
|
|
1854
|
+
this.closedStream = output();
|
|
1855
|
+
this.viewChanged = output();
|
|
1864
1856
|
this.id = `cmat-datetimepicker-${datetimepickerUid++}`;
|
|
1865
1857
|
this.disabledChange = new Subject();
|
|
1858
|
+
this.startView = input('month', /* @ts-ignore */
|
|
1859
|
+
...(ngDevMode ? [{ debugName: "startView" }] : /* istanbul ignore next */ []));
|
|
1860
|
+
this.mode = input('auto', /* @ts-ignore */
|
|
1861
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1862
|
+
this.timeInterval = input(1, /* @ts-ignore */
|
|
1863
|
+
...(ngDevMode ? [{ debugName: "timeInterval" }] : /* istanbul ignore next */ []));
|
|
1864
|
+
this.preventSameDateTimeSelection = input(false, /* @ts-ignore */
|
|
1865
|
+
...(ngDevMode ? [{ debugName: "preventSameDateTimeSelection" }] : /* istanbul ignore next */ []));
|
|
1866
|
+
this.xPosition = input('start', /* @ts-ignore */
|
|
1867
|
+
...(ngDevMode ? [{ debugName: "xPosition" }] : /* istanbul ignore next */ []));
|
|
1868
|
+
this.yPosition = input('below', /* @ts-ignore */
|
|
1869
|
+
...(ngDevMode ? [{ debugName: "yPosition" }] : /* istanbul ignore next */ []));
|
|
1870
|
+
this.multiYearSelector = input(false, { ...(ngDevMode ? { debugName: "multiYearSelector" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1871
|
+
this.twelvehour = input(false, { ...(ngDevMode ? { debugName: "twelvehour" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1872
|
+
this.panelClass = input('', { ...(ngDevMode ? { debugName: "panelClass" } : /* istanbul ignore next */ {}), transform: coerceStringArray });
|
|
1873
|
+
this.timeInput = input(true, { ...(ngDevMode ? { debugName: "timeInput" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1874
|
+
this.touchUi = input(false, { ...(ngDevMode ? { debugName: "touchUi" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1875
|
+
this.restoreFocus = input(true, { ...(ngDevMode ? { debugName: "restoreFocus" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1876
|
+
this.color = input(undefined, /* @ts-ignore */
|
|
1877
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1878
|
+
this.type = input('datetime', /* @ts-ignore */
|
|
1879
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1880
|
+
this.opened = input(false, { ...(ngDevMode ? { debugName: "opened" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1881
|
+
this.disabled = input(undefined, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
1882
|
+
this.startAt = input(null, /* @ts-ignore */
|
|
1883
|
+
...(ngDevMode ? [{ debugName: "startAt" }] : /* istanbul ignore next */ []));
|
|
1884
|
+
this.openedState = computed(() => this._opened(), /* @ts-ignore */
|
|
1885
|
+
...(ngDevMode ? [{ debugName: "openedState" }] : /* istanbul ignore next */ []));
|
|
1886
|
+
this.disabledState = computed(() => {
|
|
1887
|
+
const disabledValue = this.disabled();
|
|
1888
|
+
return disabledValue === undefined && this.datetimepickerInput
|
|
1889
|
+
? this.datetimepickerInput.disabled()
|
|
1890
|
+
: !!disabledValue;
|
|
1891
|
+
}, /* @ts-ignore */
|
|
1892
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
1893
|
+
this.selected = computed(() => this._validSelected(), /* @ts-ignore */
|
|
1894
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
1895
|
+
this.minDate = computed(() => this.datetimepickerInput?.min(), /* @ts-ignore */
|
|
1896
|
+
...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
1897
|
+
this.maxDate = computed(() => this.datetimepickerInput?.max(), /* @ts-ignore */
|
|
1898
|
+
...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
1899
|
+
this.dateFilter = computed(() => this.datetimepickerInput?.dateFilter(), /* @ts-ignore */
|
|
1900
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
1901
|
+
this.effectiveColor = computed(() => this.color() ??
|
|
1902
|
+
(this.datetimepickerInput
|
|
1903
|
+
? this.datetimepickerInput.getThemePalette()
|
|
1904
|
+
: undefined), /* @ts-ignore */
|
|
1905
|
+
...(ngDevMode ? [{ debugName: "effectiveColor" }] : /* istanbul ignore next */ []));
|
|
1906
|
+
this.effectiveTimeInput = computed(() => this.timeInput() && !this.touchUi(), /* @ts-ignore */
|
|
1907
|
+
...(ngDevMode ? [{ debugName: "effectiveTimeInput" }] : /* istanbul ignore next */ []));
|
|
1866
1908
|
this._overlay = inject(Overlay);
|
|
1867
1909
|
this._injector = inject(Injector);
|
|
1868
1910
|
this._viewContainerRef = inject(ViewContainerRef);
|
|
1869
1911
|
this._scrollStrategy = inject(CMAT_DATETIMEPICKER_SCROLL_STRATEGY);
|
|
1870
|
-
this._dateAdapter = inject(DatetimeAdapter, {
|
|
1912
|
+
this._dateAdapter = inject(DatetimeAdapter, {
|
|
1913
|
+
optional: true,
|
|
1914
|
+
});
|
|
1871
1915
|
this._dir = inject(Directionality, { optional: true });
|
|
1872
1916
|
this._document = inject(DOCUMENT, { optional: true });
|
|
1873
|
-
this._validSelected = null
|
|
1917
|
+
this._validSelected = signal(null, /* @ts-ignore */
|
|
1918
|
+
...(ngDevMode ? [{ debugName: "_validSelected" }] : /* istanbul ignore next */ []));
|
|
1874
1919
|
this._focusedElementBeforeOpen = null;
|
|
1875
1920
|
this._backdropHarnessClass = `${this.id}-backdrop`;
|
|
1876
1921
|
this._inputStateChanges = Subscription.EMPTY;
|
|
1877
1922
|
this._closeAnimationTimeoutId = null;
|
|
1878
|
-
this.
|
|
1879
|
-
|
|
1880
|
-
this.
|
|
1881
|
-
|
|
1882
|
-
this.
|
|
1883
|
-
|
|
1884
|
-
this._restoreFocus = true;
|
|
1923
|
+
this._opened = signal(false, /* @ts-ignore */
|
|
1924
|
+
...(ngDevMode ? [{ debugName: "_opened" }] : /* istanbul ignore next */ []));
|
|
1925
|
+
this._startAt = signal(null, /* @ts-ignore */
|
|
1926
|
+
...(ngDevMode ? [{ debugName: "_startAt" }] : /* istanbul ignore next */ []));
|
|
1927
|
+
this._disabled = signal(undefined, /* @ts-ignore */
|
|
1928
|
+
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
1885
1929
|
if (!this._dateAdapter) {
|
|
1886
1930
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
1887
1931
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
}
|
|
1913
|
-
set opened(value) {
|
|
1914
|
-
coerceBooleanProperty(value) ? this.open() : this.close();
|
|
1915
|
-
}
|
|
1916
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1917
|
-
get color() {
|
|
1918
|
-
return (this._color ??
|
|
1919
|
-
(this.datetimepickerInput ? this.datetimepickerInput.getThemePalette() : undefined));
|
|
1920
|
-
}
|
|
1921
|
-
set color(value) {
|
|
1922
|
-
this._color = value;
|
|
1923
|
-
}
|
|
1924
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1925
|
-
get startAt() {
|
|
1926
|
-
return this._startAt ?? (this.datetimepickerInput ? this.datetimepickerInput.value : null);
|
|
1927
|
-
}
|
|
1928
|
-
set startAt(date) {
|
|
1929
|
-
this._startAt = this._dateAdapter.getValidDateOrNull(date);
|
|
1930
|
-
}
|
|
1931
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1932
|
-
get type() {
|
|
1933
|
-
return this._type;
|
|
1934
|
-
}
|
|
1935
|
-
set type(value) {
|
|
1936
|
-
this._type = value || 'datetime';
|
|
1937
|
-
}
|
|
1938
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1939
|
-
get timeInput() {
|
|
1940
|
-
return this._timeInput && !this.touchUi;
|
|
1941
|
-
}
|
|
1942
|
-
set timeInput(value) {
|
|
1943
|
-
this._timeInput = coerceBooleanProperty(value);
|
|
1944
|
-
}
|
|
1945
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1946
|
-
get touchUi() {
|
|
1947
|
-
return this._touchUi;
|
|
1948
|
-
}
|
|
1949
|
-
set touchUi(value) {
|
|
1950
|
-
this._touchUi = coerceBooleanProperty(value);
|
|
1951
|
-
}
|
|
1952
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1953
|
-
get disabled() {
|
|
1954
|
-
return this._disabled === undefined && this.datetimepickerInput ?
|
|
1955
|
-
this.datetimepickerInput.disabled : !!this._disabled;
|
|
1956
|
-
}
|
|
1957
|
-
set disabled(value) {
|
|
1958
|
-
const newValue = coerceBooleanProperty(value);
|
|
1959
|
-
if (newValue !== this._disabled) {
|
|
1960
|
-
this._disabled = newValue;
|
|
1961
|
-
this.disabledChange.next(newValue);
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1965
|
-
get restoreFocus() {
|
|
1966
|
-
return this._restoreFocus;
|
|
1967
|
-
}
|
|
1968
|
-
set restoreFocus(value) {
|
|
1969
|
-
this._restoreFocus = coerceBooleanProperty(value);
|
|
1970
|
-
}
|
|
1971
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1972
|
-
get selected() {
|
|
1973
|
-
return this._validSelected;
|
|
1974
|
-
}
|
|
1975
|
-
set selected(value) {
|
|
1976
|
-
this._validSelected = value;
|
|
1977
|
-
}
|
|
1978
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1979
|
-
get minDate() {
|
|
1980
|
-
return this.datetimepickerInput?.min;
|
|
1981
|
-
}
|
|
1982
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1983
|
-
get maxDate() {
|
|
1984
|
-
return this.datetimepickerInput?.max;
|
|
1985
|
-
}
|
|
1986
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1987
|
-
get dateFilter() {
|
|
1988
|
-
return this.datetimepickerInput?.dateFilter;
|
|
1932
|
+
// Watch for opened input changes
|
|
1933
|
+
effect(() => {
|
|
1934
|
+
const openedValue = this.opened();
|
|
1935
|
+
if (openedValue) {
|
|
1936
|
+
untracked(() => this.open());
|
|
1937
|
+
}
|
|
1938
|
+
else {
|
|
1939
|
+
untracked(() => this.close());
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
// Watch for disabled input changes and sync to internal signal
|
|
1943
|
+
effect(() => {
|
|
1944
|
+
const disabledValue = this.disabled();
|
|
1945
|
+
untracked(() => {
|
|
1946
|
+
if (disabledValue !== undefined && disabledValue !== this._disabled()) {
|
|
1947
|
+
this._disabled.set(disabledValue);
|
|
1948
|
+
this.disabledChange.next(!!disabledValue);
|
|
1949
|
+
}
|
|
1950
|
+
});
|
|
1951
|
+
});
|
|
1952
|
+
effect(() => {
|
|
1953
|
+
const startAtValue = this.startAt();
|
|
1954
|
+
this._startAt.set(this._dateAdapter.getValidDateOrNull(startAtValue));
|
|
1955
|
+
});
|
|
1989
1956
|
}
|
|
1990
1957
|
ngOnDestroy() {
|
|
1991
1958
|
this._destroyOverlay();
|
|
@@ -1998,11 +1965,10 @@ class CmatDatetimepickerComponent {
|
|
|
1998
1965
|
throw Error('A MatDatepicker can only be associated with a single input.');
|
|
1999
1966
|
}
|
|
2000
1967
|
this.datetimepickerInput = input;
|
|
2001
|
-
this._inputStateChanges =
|
|
2002
|
-
this.datetimepickerInput.valueChange.subscribe((value) => this.selected = value);
|
|
1968
|
+
this._inputStateChanges = this.datetimepickerInput.valueChange.subscribe((value) => this._validSelected.set(value));
|
|
2003
1969
|
}
|
|
2004
1970
|
open() {
|
|
2005
|
-
if (this.
|
|
1971
|
+
if (this._opened() || this.disabledState()) {
|
|
2006
1972
|
return;
|
|
2007
1973
|
}
|
|
2008
1974
|
if (!this.datetimepickerInput) {
|
|
@@ -2010,19 +1976,19 @@ class CmatDatetimepickerComponent {
|
|
|
2010
1976
|
}
|
|
2011
1977
|
this._focusedElementBeforeOpen = _getFocusedElementPierceShadowDom();
|
|
2012
1978
|
this._openOverlay();
|
|
2013
|
-
this._opened
|
|
1979
|
+
this._opened.set(true);
|
|
2014
1980
|
this.openedStream.emit();
|
|
2015
1981
|
}
|
|
2016
1982
|
close() {
|
|
2017
|
-
if (!this._opened) {
|
|
1983
|
+
if (!this._opened()) {
|
|
2018
1984
|
return;
|
|
2019
1985
|
}
|
|
2020
|
-
const canRestoreFocus = this.
|
|
1986
|
+
const canRestoreFocus = this.restoreFocus() &&
|
|
2021
1987
|
this._focusedElementBeforeOpen &&
|
|
2022
1988
|
typeof this._focusedElementBeforeOpen.focus === 'function';
|
|
2023
1989
|
const completeClose = () => {
|
|
2024
|
-
if (this._opened) {
|
|
2025
|
-
this._opened
|
|
1990
|
+
if (this._opened()) {
|
|
1991
|
+
this._opened.set(false);
|
|
2026
1992
|
this.closedStream.emit();
|
|
2027
1993
|
}
|
|
2028
1994
|
};
|
|
@@ -2059,9 +2025,9 @@ class CmatDatetimepickerComponent {
|
|
|
2059
2025
|
}
|
|
2060
2026
|
}
|
|
2061
2027
|
select(date) {
|
|
2062
|
-
const oldValue = this.selected;
|
|
2063
|
-
this.
|
|
2064
|
-
if (!this._dateAdapter.sameDatetime(oldValue, this.selected)) {
|
|
2028
|
+
const oldValue = this.selected();
|
|
2029
|
+
this._validSelected.set(date);
|
|
2030
|
+
if (!this._dateAdapter.sameDatetime(oldValue, this.selected())) {
|
|
2065
2031
|
this.selectedChanged.emit(date);
|
|
2066
2032
|
}
|
|
2067
2033
|
}
|
|
@@ -2070,23 +2036,28 @@ class CmatDatetimepickerComponent {
|
|
|
2070
2036
|
}
|
|
2071
2037
|
_forwardContentValues(instance) {
|
|
2072
2038
|
instance.datetimepicker = this;
|
|
2073
|
-
instance.color = this.color;
|
|
2074
2039
|
instance.dialogLabelId = this.datetimepickerInput.getOverlayLabelId();
|
|
2075
2040
|
}
|
|
2076
2041
|
_openOverlay() {
|
|
2077
2042
|
this._destroyOverlay();
|
|
2078
|
-
const isDialog = this.touchUi;
|
|
2043
|
+
const isDialog = this.touchUi();
|
|
2079
2044
|
const labelId = this.datetimepickerInput.getOverlayLabelId();
|
|
2080
2045
|
const portal = new ComponentPortal(CmatDatetimepickerContentComponent, this._viewContainerRef);
|
|
2081
2046
|
const overlayRef = (this._overlayRef = this._overlay.create(new OverlayConfig({
|
|
2082
|
-
positionStrategy: isDialog
|
|
2047
|
+
positionStrategy: isDialog
|
|
2048
|
+
? this._getDialogStrategy()
|
|
2049
|
+
: this._getDropdownStrategy(),
|
|
2083
2050
|
hasBackdrop: true,
|
|
2084
2051
|
backdropClass: [
|
|
2085
|
-
isDialog
|
|
2052
|
+
isDialog
|
|
2053
|
+
? 'cdk-overlay-dark-backdrop'
|
|
2054
|
+
: 'mat-overlay-transparent-backdrop',
|
|
2086
2055
|
this._backdropHarnessClass,
|
|
2087
2056
|
],
|
|
2088
2057
|
direction: this._dir,
|
|
2089
|
-
scrollStrategy: isDialog
|
|
2058
|
+
scrollStrategy: isDialog
|
|
2059
|
+
? this._overlay.scrollStrategies.block()
|
|
2060
|
+
: this._scrollStrategy(),
|
|
2090
2061
|
panelClass: `cmat-datetimepicker-${isDialog ? 'dialog' : 'popup'}`,
|
|
2091
2062
|
})));
|
|
2092
2063
|
const overlayElement = overlayRef.overlayElement;
|
|
@@ -2113,7 +2084,11 @@ class CmatDatetimepickerComponent {
|
|
|
2113
2084
|
}
|
|
2114
2085
|
}
|
|
2115
2086
|
_getDialogStrategy() {
|
|
2116
|
-
return this._overlay
|
|
2087
|
+
return this._overlay
|
|
2088
|
+
.position()
|
|
2089
|
+
.global()
|
|
2090
|
+
.centerHorizontally()
|
|
2091
|
+
.centerVertically();
|
|
2117
2092
|
}
|
|
2118
2093
|
_getDropdownStrategy() {
|
|
2119
2094
|
const strategy = this._overlay
|
|
@@ -2126,9 +2101,9 @@ class CmatDatetimepickerComponent {
|
|
|
2126
2101
|
return this._setConnectedPositions(strategy);
|
|
2127
2102
|
}
|
|
2128
2103
|
_setConnectedPositions(strategy) {
|
|
2129
|
-
const primaryX = this.xPosition === 'end' ? 'end' : 'start';
|
|
2104
|
+
const primaryX = this.xPosition() === 'end' ? 'end' : 'start';
|
|
2130
2105
|
const secondaryX = primaryX === 'start' ? 'end' : 'start';
|
|
2131
|
-
const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
|
|
2106
|
+
const primaryY = this.yPosition() === 'above' ? 'bottom' : 'top';
|
|
2132
2107
|
const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
|
|
2133
2108
|
return strategy.withPositions([
|
|
2134
2109
|
{
|
|
@@ -2168,10 +2143,13 @@ class CmatDatetimepickerComponent {
|
|
|
2168
2143
|
subscriber.next();
|
|
2169
2144
|
subscriber.complete();
|
|
2170
2145
|
}));
|
|
2171
|
-
subscriptions.add(overlayRef
|
|
2146
|
+
subscriptions.add(overlayRef
|
|
2147
|
+
.keydownEvents()
|
|
2148
|
+
.pipe(filter(event => (event.code === 'Escape' && !hasModifierKey(event)) ||
|
|
2172
2149
|
(this.datetimepickerInput &&
|
|
2173
2150
|
hasModifierKey(event, 'altKey') &&
|
|
2174
|
-
event.code === 'ArrowUp')))
|
|
2151
|
+
event.code === 'ArrowUp')))
|
|
2152
|
+
.subscribe(() => {
|
|
2175
2153
|
subscriber.next();
|
|
2176
2154
|
subscriber.complete();
|
|
2177
2155
|
}));
|
|
@@ -2180,55 +2158,13 @@ class CmatDatetimepickerComponent {
|
|
|
2180
2158
|
};
|
|
2181
2159
|
});
|
|
2182
2160
|
}
|
|
2183
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2184
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2161
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2162
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatDatetimepickerComponent, isStandalone: true, selector: "cmat-datetimepicker", inputs: { startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, timeInterval: { classPropertyName: "timeInterval", publicName: "timeInterval", isSignal: true, isRequired: false, transformFunction: null }, preventSameDateTimeSelection: { classPropertyName: "preventSameDateTimeSelection", publicName: "preventSameDateTimeSelection", isSignal: true, isRequired: false, transformFunction: null }, xPosition: { classPropertyName: "xPosition", publicName: "xPosition", isSignal: true, isRequired: false, transformFunction: null }, yPosition: { classPropertyName: "yPosition", publicName: "yPosition", isSignal: true, isRequired: false, transformFunction: null }, multiYearSelector: { classPropertyName: "multiYearSelector", publicName: "multiYearSelector", isSignal: true, isRequired: false, transformFunction: null }, twelvehour: { classPropertyName: "twelvehour", publicName: "twelvehour", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, timeInput: { classPropertyName: "timeInput", publicName: "timeInput", isSignal: true, isRequired: false, transformFunction: null }, touchUi: { classPropertyName: "touchUi", publicName: "touchUi", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openedStream: "openedStream", closedStream: "closedStream", viewChanged: "viewChanged" }, exportAs: ["cmatDatetimepicker"], ngImport: i0, template: '', isInline: true, styles: [".cmat-datetimepicker-calendar-header,.cmat-datetimepicker-calendar-body-cell-content.cmat-datetimepicker-calendar-body-selected{color:#fff!important}.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected).cmat-datetimepicker-calendar-body-today{border-color:var(--cmat-text-hint)}.cmat-datetimepicker-calendar-body-cell:not(.cmat-datetimepicker-calendar-body-disabled):hover>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected),.cmat-datetimepicker-calendar-body-active>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected){background-color:rgba(var(--cmat-primary-rgb),.3)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected){color:var(--cmat-text-disabled)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-today:not(.cmat-datetimepicker-calendar-body-selected){border-color:rgba(var(--cmat-text-disabled),.8)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-selected{background-color:rgba(var(--cmat-primary-rgb),.4)}.cmat-datetimepicker-calendar-previous-button.disabled,.cmat-datetimepicker-calendar-next-button.disabled{color:var(--cmat-text-disabled)}.cmat-datetimepicker-clock-wrapper{background-color:var(--cmat-divider)}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-selected{color:#fff!important}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-disabled{color:var(--cmat-text-disabled)}.cmat-datetimepicker-time-input{background-color:var(--cmat-text-disabled)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active{background-color:rgba(var(--cmat-primary-rgb),.2)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active:focus{border-color:var(--cmat-primary);background-color:var(--cmat-divider)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active:focus::placeholder{color:rgba(var(--cmat-primary-rgb),.6)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-warning{border-color:var(--cmat-warn)}.cmat-datetimepicker-time-am.mat-mdc-button,.cmat-datetimepicker-time-pm.mat-mdc-button{color:var(--cmat-text-hint);border-color:var(--cmat-text-hint)}.cmat-datetimepicker-time-am.mat-mdc-button.cmat-datetimepicker-time-ampm-active,.cmat-datetimepicker-time-pm.mat-mdc-button.cmat-datetimepicker-time-ampm-active{background-color:rgba(var(--cmat-accent-rgb),.2)}.cmat-datetimepicker-content{display:block;border-radius:4px;overflow:hidden}.cmat-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.cmat-datetimepicker-content .cmat-calendar{width:296px;height:424px}.cmat-datetimepicker-content .cmat-calendar.cmat-datetimepicker-calendar-with-time-input{height:490px}.cmat-datetimepicker-content-touch{display:block;position:relative;overflow:visible}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.cmat-datetimepicker-content-touch .cmat-datetimepicker-calendar{width:100%;height:auto}@media all and (orientation:landscape){.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto],.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape]{width:120vh;height:100%;min-height:80vh}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto] .cmat-datetimepicker-calendar,.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape] .cmat-datetimepicker-calendar{width:auto;height:100%}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait] .cmat-datetimepicker-calendar{width:100%;height:auto}}@media all and (orientation:portrait){.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto],.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto] .cmat-datetimepicker-calendar,.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait] .cmat-datetimepicker-calendar{width:100%;height:auto}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape] .cmat-datetimepicker-calendar{width:auto;height:100%}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container-with-actions{height:135vw}}.cmat-datetimepicker-transform-panel.enter-dropdown{animation:panel-dropdown-enter .12s cubic-bezier(0,0,.2,1)}.cmat-datetimepicker-transform-panel.enter-dialog{animation:panel-dialog-enter .15s cubic-bezier(0,0,.2,1)}.cmat-datetimepicker-transform-panel.leave{animation:panel-leave .1s linear}@keyframes panel-dropdown-enter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scale(1)}}@keyframes panel-dialog-enter{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:none}}@keyframes panel-leave{0%{opacity:1}to{opacity:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2185
2163
|
}
|
|
2186
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerComponent, decorators: [{
|
|
2187
2165
|
type: Component,
|
|
2188
2166
|
args: [{ selector: 'cmat-datetimepicker', exportAs: 'cmatDatetimepicker', template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, styles: [".cmat-datetimepicker-calendar-header,.cmat-datetimepicker-calendar-body-cell-content.cmat-datetimepicker-calendar-body-selected{color:#fff!important}.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected).cmat-datetimepicker-calendar-body-today{border-color:var(--cmat-text-hint)}.cmat-datetimepicker-calendar-body-cell:not(.cmat-datetimepicker-calendar-body-disabled):hover>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected),.cmat-datetimepicker-calendar-body-active>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected){background-color:rgba(var(--cmat-primary-rgb),.3)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-cell-content:not(.cmat-datetimepicker-calendar-body-selected){color:var(--cmat-text-disabled)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-today:not(.cmat-datetimepicker-calendar-body-selected){border-color:rgba(var(--cmat-text-disabled),.8)}.cmat-datetimepicker-calendar-body-disabled>.cmat-datetimepicker-calendar-body-selected{background-color:rgba(var(--cmat-primary-rgb),.4)}.cmat-datetimepicker-calendar-previous-button.disabled,.cmat-datetimepicker-calendar-next-button.disabled{color:var(--cmat-text-disabled)}.cmat-datetimepicker-clock-wrapper{background-color:var(--cmat-divider)}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-selected{color:#fff!important}.cmat-datetimepicker-clock-cell.cmat-datetimepicker-clock-cell-disabled{color:var(--cmat-text-disabled)}.cmat-datetimepicker-time-input{background-color:var(--cmat-text-disabled)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active{background-color:rgba(var(--cmat-primary-rgb),.2)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active:focus{border-color:var(--cmat-primary);background-color:var(--cmat-divider)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-active:focus::placeholder{color:rgba(var(--cmat-primary-rgb),.6)}.cmat-datetimepicker-time-input.cmat-datetimepicker-time-input-warning{border-color:var(--cmat-warn)}.cmat-datetimepicker-time-am.mat-mdc-button,.cmat-datetimepicker-time-pm.mat-mdc-button{color:var(--cmat-text-hint);border-color:var(--cmat-text-hint)}.cmat-datetimepicker-time-am.mat-mdc-button.cmat-datetimepicker-time-ampm-active,.cmat-datetimepicker-time-pm.mat-mdc-button.cmat-datetimepicker-time-ampm-active{background-color:rgba(var(--cmat-accent-rgb),.2)}.cmat-datetimepicker-content{display:block;border-radius:4px;overflow:hidden}.cmat-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.cmat-datetimepicker-content .cmat-calendar{width:296px;height:424px}.cmat-datetimepicker-content .cmat-calendar.cmat-datetimepicker-calendar-with-time-input{height:490px}.cmat-datetimepicker-content-touch{display:block;position:relative;overflow:visible}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.cmat-datetimepicker-content-touch .cmat-datetimepicker-calendar{width:100%;height:auto}@media all and (orientation:landscape){.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto],.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape]{width:120vh;height:100%;min-height:80vh}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto] .cmat-datetimepicker-calendar,.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape] .cmat-datetimepicker-calendar{width:auto;height:100%}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait] .cmat-datetimepicker-calendar{width:100%;height:auto}}@media all and (orientation:portrait){.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto],.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=auto] .cmat-datetimepicker-calendar,.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=portrait] .cmat-datetimepicker-calendar{width:100%;height:auto}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container[mode=landscape] .cmat-datetimepicker-calendar{width:auto;height:100%}.cmat-datetimepicker-content-touch .cmat-datetimepicker-content-container-with-actions{height:135vw}}.cmat-datetimepicker-transform-panel.enter-dropdown{animation:panel-dropdown-enter .12s cubic-bezier(0,0,.2,1)}.cmat-datetimepicker-transform-panel.enter-dialog{animation:panel-dialog-enter .15s cubic-bezier(0,0,.2,1)}.cmat-datetimepicker-transform-panel.leave{animation:panel-leave .1s linear}@keyframes panel-dropdown-enter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scale(1)}}@keyframes panel-dialog-enter{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:none}}@keyframes panel-leave{0%{opacity:1}to{opacity:0}}\n"] }]
|
|
2189
|
-
}], ctorParameters: () => [], propDecorators: { startView: [{
|
|
2190
|
-
type: Input
|
|
2191
|
-
}], mode: [{
|
|
2192
|
-
type: Input
|
|
2193
|
-
}], timeInterval: [{
|
|
2194
|
-
type: Input
|
|
2195
|
-
}], preventSameDateTimeSelection: [{
|
|
2196
|
-
type: Input
|
|
2197
|
-
}], xPosition: [{
|
|
2198
|
-
type: Input
|
|
2199
|
-
}], yPosition: [{
|
|
2200
|
-
type: Input
|
|
2201
|
-
}], selectedChanged: [{
|
|
2202
|
-
type: Output
|
|
2203
|
-
}], openedStream: [{
|
|
2204
|
-
type: Output
|
|
2205
|
-
}], closedStream: [{
|
|
2206
|
-
type: Output
|
|
2207
|
-
}], viewChanged: [{
|
|
2208
|
-
type: Output
|
|
2209
|
-
}], multiYearSelector: [{
|
|
2210
|
-
type: Input
|
|
2211
|
-
}], twelvehour: [{
|
|
2212
|
-
type: Input
|
|
2213
|
-
}], panelClass: [{
|
|
2214
|
-
type: Input
|
|
2215
|
-
}], opened: [{
|
|
2216
|
-
type: Input
|
|
2217
|
-
}], color: [{
|
|
2218
|
-
type: Input
|
|
2219
|
-
}], startAt: [{
|
|
2220
|
-
type: Input
|
|
2221
|
-
}], type: [{
|
|
2222
|
-
type: Input
|
|
2223
|
-
}], timeInput: [{
|
|
2224
|
-
type: Input
|
|
2225
|
-
}], touchUi: [{
|
|
2226
|
-
type: Input
|
|
2227
|
-
}], disabled: [{
|
|
2228
|
-
type: Input
|
|
2229
|
-
}], restoreFocus: [{
|
|
2230
|
-
type: Input
|
|
2231
|
-
}] } });
|
|
2167
|
+
}], ctorParameters: () => [], propDecorators: { openedStream: [{ type: i0.Output, args: ["openedStream"] }], closedStream: [{ type: i0.Output, args: ["closedStream"] }], viewChanged: [{ type: i0.Output, args: ["viewChanged"] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], timeInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInterval", required: false }] }], preventSameDateTimeSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "preventSameDateTimeSelection", required: false }] }], xPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "xPosition", required: false }] }], yPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "yPosition", required: false }] }], multiYearSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiYearSelector", required: false }] }], twelvehour: [{ type: i0.Input, args: [{ isSignal: true, alias: "twelvehour", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], timeInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInput", required: false }] }], touchUi: [{ type: i0.Input, args: [{ isSignal: true, alias: "touchUi", required: false }] }], restoreFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "restoreFocus", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], opened: [{ type: i0.Input, args: [{ isSignal: true, alias: "opened", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }] } });
|
|
2232
2168
|
|
|
2233
2169
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2234
2170
|
const CMAT_DATETIMEPICKER_VALUE_ACCESSOR = {
|
|
@@ -2245,15 +2181,30 @@ class CmatDatetimepickerInputEvent {
|
|
|
2245
2181
|
constructor(target, targetElement) {
|
|
2246
2182
|
this.target = target;
|
|
2247
2183
|
this.targetElement = targetElement;
|
|
2248
|
-
this.value = this.target.value;
|
|
2184
|
+
this.value = this.target.value();
|
|
2249
2185
|
}
|
|
2250
2186
|
}
|
|
2251
2187
|
class CmatDatetimepickerInputDirective {
|
|
2252
2188
|
constructor() {
|
|
2253
|
-
this.dateChange =
|
|
2254
|
-
this.dateInput =
|
|
2189
|
+
this.dateChange = output();
|
|
2190
|
+
this.dateInput = output();
|
|
2255
2191
|
this.valueChange = new EventEmitter();
|
|
2256
2192
|
this.disabledChange = new EventEmitter();
|
|
2193
|
+
this.cmatDatetimepicker = input(/* @ts-ignore */
|
|
2194
|
+
...(ngDevMode ? [undefined, { debugName: "cmatDatetimepicker" }] : /* istanbul ignore next */ []));
|
|
2195
|
+
this.cmatDatepickerFilter = input(/* @ts-ignore */
|
|
2196
|
+
...(ngDevMode ? [undefined, { debugName: "cmatDatepickerFilter" }] : /* istanbul ignore next */ []));
|
|
2197
|
+
this.min = input(null, /* @ts-ignore */
|
|
2198
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
2199
|
+
this.max = input(null, /* @ts-ignore */
|
|
2200
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
2201
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
2202
|
+
this.value = input(null, /* @ts-ignore */
|
|
2203
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2204
|
+
this.dateFilter = computed(() => this.cmatDatepickerFilter(), /* @ts-ignore */
|
|
2205
|
+
...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
|
|
2206
|
+
this.datetimepicker = computed(() => this.cmatDatetimepicker(), /* @ts-ignore */
|
|
2207
|
+
...(ngDevMode ? [{ debugName: "datetimepicker" }] : /* istanbul ignore next */ []));
|
|
2257
2208
|
this._elementRef = inject(ElementRef);
|
|
2258
2209
|
this._dateAdapter = inject(DatetimeAdapter, { optional: true });
|
|
2259
2210
|
this._dateFormats = inject(CMAT_DATETIME_FORMATS, { optional: true });
|
|
@@ -2261,30 +2212,36 @@ class CmatDatetimepickerInputDirective {
|
|
|
2261
2212
|
this._datepickerSubscription = Subscription.EMPTY;
|
|
2262
2213
|
this._localeSubscription = Subscription.EMPTY;
|
|
2263
2214
|
this._valueChangeTimeoutId = null;
|
|
2264
|
-
this._lastValueValid =
|
|
2215
|
+
this._lastValueValid = signal(true, /* @ts-ignore */
|
|
2216
|
+
...(ngDevMode ? [{ debugName: "_lastValueValid" }] : /* istanbul ignore next */ []));
|
|
2217
|
+
this._internalValue = signal(null, /* @ts-ignore */
|
|
2218
|
+
...(ngDevMode ? [{ debugName: "_internalValue" }] : /* istanbul ignore next */ []));
|
|
2265
2219
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2266
2220
|
this._onTouched = () => { };
|
|
2267
2221
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2268
2222
|
this._cvaOnChange = () => { };
|
|
2269
2223
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2270
2224
|
this._validatorOnChange = () => { };
|
|
2271
|
-
this._parseValidator = () => this._lastValueValid ?
|
|
2225
|
+
this._parseValidator = () => this._lastValueValid() ?
|
|
2272
2226
|
null : { 'matDatepickerParse': { 'text': this._elementRef.nativeElement.value } };
|
|
2273
2227
|
this._minValidator = (control) => {
|
|
2274
2228
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2229
|
+
const minVal = this.min();
|
|
2230
|
+
return (!minVal || !controlValue ||
|
|
2231
|
+
this._dateAdapter.compareDatetime(minVal, controlValue) <= 0) ?
|
|
2232
|
+
null : { 'matDatepickerMin': { 'min': minVal, 'actual': controlValue } };
|
|
2278
2233
|
};
|
|
2279
2234
|
this._maxValidator = (control) => {
|
|
2280
2235
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2236
|
+
const maxVal = this.max();
|
|
2237
|
+
return (!maxVal || !controlValue ||
|
|
2238
|
+
this._dateAdapter.compareDatetime(maxVal, controlValue) >= 0) ?
|
|
2239
|
+
null : { 'matDatepickerMax': { 'max': maxVal, 'actual': controlValue } };
|
|
2284
2240
|
};
|
|
2285
2241
|
this._filterValidator = (control) => {
|
|
2286
2242
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2287
|
-
|
|
2243
|
+
const filter = this.dateFilter();
|
|
2244
|
+
return !filter || !controlValue || filter(controlValue, CmatDatetimepickerFilterType.DATE) ?
|
|
2288
2245
|
null : { 'matDatepickerFilter': true };
|
|
2289
2246
|
};
|
|
2290
2247
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -2296,67 +2253,38 @@ class CmatDatetimepickerInputDirective {
|
|
|
2296
2253
|
if (!this._dateFormats) {
|
|
2297
2254
|
throw createMissingDateImplError('CMAT_DATETIME_FORMATS');
|
|
2298
2255
|
}
|
|
2299
|
-
this._localeSubscription = _dateAdapter.localeChanges.subscribe()
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
this._registerDatetimepicker(value);
|
|
2303
|
-
}
|
|
2304
|
-
set cmatDatepickerFilter(filter) {
|
|
2305
|
-
this.dateFilter = filter;
|
|
2306
|
-
this._validatorOnChange();
|
|
2307
|
-
}
|
|
2308
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2309
|
-
get value() {
|
|
2310
|
-
return this._value;
|
|
2311
|
-
}
|
|
2312
|
-
set value(value) {
|
|
2313
|
-
value = this._dateAdapter.deserialize(value);
|
|
2314
|
-
this._lastValueValid = !value || this._dateAdapter.isValid(value);
|
|
2315
|
-
value = this._dateAdapter.getValidDateOrNull(value);
|
|
2316
|
-
const oldDate = this.value;
|
|
2317
|
-
this._value = value;
|
|
2318
|
-
this._formatValue(value);
|
|
2319
|
-
if (this._valueChangeTimeoutId !== null) {
|
|
2320
|
-
clearTimeout(this._valueChangeTimeoutId);
|
|
2321
|
-
}
|
|
2322
|
-
this._valueChangeTimeoutId = window.setTimeout(() => {
|
|
2323
|
-
this._valueChangeTimeoutId = null;
|
|
2324
|
-
if (!this._dateAdapter.sameDatetime(oldDate, value)) {
|
|
2325
|
-
this.valueChange.emit(value);
|
|
2256
|
+
this._localeSubscription = _dateAdapter.localeChanges.subscribe(() => {
|
|
2257
|
+
if (this._internalValue()) {
|
|
2258
|
+
this._formatValue(this._internalValue());
|
|
2326
2259
|
}
|
|
2327
2260
|
});
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
}
|
|
2349
|
-
set disabled(value) {
|
|
2350
|
-
const newValue = coerceBooleanProperty(value);
|
|
2351
|
-
if (this._disabled !== newValue) {
|
|
2352
|
-
this._disabled = newValue;
|
|
2353
|
-
this.disabledChange.emit(newValue);
|
|
2354
|
-
}
|
|
2261
|
+
effect(() => {
|
|
2262
|
+
const inputValue = this.value();
|
|
2263
|
+
untracked(() => this._setValue(inputValue));
|
|
2264
|
+
});
|
|
2265
|
+
effect(() => {
|
|
2266
|
+
this.min();
|
|
2267
|
+
this._validatorOnChange();
|
|
2268
|
+
});
|
|
2269
|
+
effect(() => {
|
|
2270
|
+
this.max();
|
|
2271
|
+
this._validatorOnChange();
|
|
2272
|
+
});
|
|
2273
|
+
effect(() => {
|
|
2274
|
+
this.dateFilter();
|
|
2275
|
+
this._validatorOnChange();
|
|
2276
|
+
});
|
|
2277
|
+
effect(() => {
|
|
2278
|
+
const disabledValue = this.disabled();
|
|
2279
|
+
this.disabledChange.emit(disabledValue);
|
|
2280
|
+
});
|
|
2355
2281
|
}
|
|
2356
2282
|
ngAfterContentInit() {
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2283
|
+
const picker = this.datetimepicker();
|
|
2284
|
+
if (picker) {
|
|
2285
|
+
picker.registerInput(this);
|
|
2286
|
+
this._datepickerSubscription = picker.selectedChanged.subscribe((selected) => {
|
|
2287
|
+
this._setValue(selected);
|
|
2360
2288
|
this._cvaOnChange(selected);
|
|
2361
2289
|
this._onTouched();
|
|
2362
2290
|
this.dateInput.emit(new CmatDatetimepickerInputEvent(this, this._elementRef.nativeElement));
|
|
@@ -2390,7 +2318,7 @@ class CmatDatetimepickerInputDirective {
|
|
|
2390
2318
|
return this._elementRef.nativeElement.getAttribute('aria-labelledby');
|
|
2391
2319
|
}
|
|
2392
2320
|
writeValue(value) {
|
|
2393
|
-
this.value
|
|
2321
|
+
this._setValue(value);
|
|
2394
2322
|
}
|
|
2395
2323
|
registerOnChange(fn) {
|
|
2396
2324
|
this._cvaOnChange = fn;
|
|
@@ -2398,20 +2326,21 @@ class CmatDatetimepickerInputDirective {
|
|
|
2398
2326
|
registerOnTouched(fn) {
|
|
2399
2327
|
this._onTouched = fn;
|
|
2400
2328
|
}
|
|
2329
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2401
2330
|
setDisabledState(disabled) {
|
|
2402
|
-
|
|
2331
|
+
// Disabled state is managed through the disabled input signal
|
|
2403
2332
|
}
|
|
2404
2333
|
onKeydown(event) {
|
|
2405
2334
|
if (event.altKey && event.code === 'ArrowDown') {
|
|
2406
|
-
this.datetimepicker
|
|
2335
|
+
this.datetimepicker()?.open();
|
|
2407
2336
|
event.preventDefault();
|
|
2408
2337
|
}
|
|
2409
2338
|
}
|
|
2410
2339
|
onInput(value) {
|
|
2411
2340
|
let date = this._dateAdapter.parse(value, this._getParseFormat());
|
|
2412
|
-
this._lastValueValid
|
|
2341
|
+
this._lastValueValid.set(!date || this._dateAdapter.isValid(date));
|
|
2413
2342
|
date = this._dateAdapter.getValidDateOrNull(date);
|
|
2414
|
-
this.
|
|
2343
|
+
this._internalValue.set(date);
|
|
2415
2344
|
this._cvaOnChange(date);
|
|
2416
2345
|
this.valueChange.emit(date);
|
|
2417
2346
|
this.dateInput.emit(new CmatDatetimepickerInputEvent(this, this._elementRef.nativeElement));
|
|
@@ -2420,22 +2349,37 @@ class CmatDatetimepickerInputDirective {
|
|
|
2420
2349
|
this.dateChange.emit(new CmatDatetimepickerInputEvent(this, this._elementRef.nativeElement));
|
|
2421
2350
|
}
|
|
2422
2351
|
onBlur() {
|
|
2423
|
-
if (this.
|
|
2424
|
-
this._formatValue(this.
|
|
2352
|
+
if (this._internalValue()) {
|
|
2353
|
+
this._formatValue(this._internalValue());
|
|
2425
2354
|
}
|
|
2426
2355
|
this._onTouched();
|
|
2427
2356
|
}
|
|
2428
2357
|
getThemePalette() {
|
|
2429
2358
|
return this._formField ? this._formField.color : undefined;
|
|
2430
2359
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2360
|
+
_setValue(value) {
|
|
2361
|
+
value = this._dateAdapter.deserialize(value);
|
|
2362
|
+
this._lastValueValid.set(!value || this._dateAdapter.isValid(value));
|
|
2363
|
+
value = this._dateAdapter.getValidDateOrNull(value);
|
|
2364
|
+
const oldDate = this._internalValue();
|
|
2365
|
+
this._internalValue.set(value);
|
|
2366
|
+
this._formatValue(value);
|
|
2367
|
+
if (this._valueChangeTimeoutId !== null) {
|
|
2368
|
+
clearTimeout(this._valueChangeTimeoutId);
|
|
2435
2369
|
}
|
|
2370
|
+
this._valueChangeTimeoutId = window.setTimeout(() => {
|
|
2371
|
+
this._valueChangeTimeoutId = null;
|
|
2372
|
+
if (!this._dateAdapter.sameDatetime(oldDate, value)) {
|
|
2373
|
+
this.valueChange.emit(value);
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2436
2376
|
}
|
|
2437
2377
|
_getDisplayFormat() {
|
|
2438
|
-
|
|
2378
|
+
const picker = this.datetimepicker();
|
|
2379
|
+
if (!picker) {
|
|
2380
|
+
return this._dateFormats.display.dateInput;
|
|
2381
|
+
}
|
|
2382
|
+
switch (picker.type()) {
|
|
2439
2383
|
case 'date':
|
|
2440
2384
|
return this._dateFormats.display.dateInput;
|
|
2441
2385
|
case 'datetime':
|
|
@@ -2446,11 +2390,17 @@ class CmatDatetimepickerInputDirective {
|
|
|
2446
2390
|
return this._dateFormats.display.monthInput;
|
|
2447
2391
|
case 'year':
|
|
2448
2392
|
return this._dateFormats.display.yearInput;
|
|
2393
|
+
default:
|
|
2394
|
+
return this._dateFormats.display.dateInput;
|
|
2449
2395
|
}
|
|
2450
2396
|
}
|
|
2451
2397
|
_getParseFormat() {
|
|
2398
|
+
const picker = this.datetimepicker();
|
|
2399
|
+
if (!picker) {
|
|
2400
|
+
return this._dateFormats.parse.dateInput;
|
|
2401
|
+
}
|
|
2452
2402
|
let parseFormat = this._dateFormats.parse.dateInput;
|
|
2453
|
-
switch (
|
|
2403
|
+
switch (picker.type()) {
|
|
2454
2404
|
case 'date':
|
|
2455
2405
|
parseFormat = this._dateFormats.parse.dateInput;
|
|
2456
2406
|
break;
|
|
@@ -2473,14 +2423,14 @@ class CmatDatetimepickerInputDirective {
|
|
|
2473
2423
|
this._elementRef.nativeElement.value =
|
|
2474
2424
|
value ? this._dateAdapter.format(value, this._getDisplayFormat()) : '';
|
|
2475
2425
|
}
|
|
2476
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2477
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2426
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2427
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: CmatDatetimepickerInputDirective, isStandalone: true, selector: "input[cmatDatetimepicker]", inputs: { cmatDatetimepicker: { classPropertyName: "cmatDatetimepicker", publicName: "cmatDatetimepicker", isSignal: true, isRequired: false, transformFunction: null }, cmatDatepickerFilter: { classPropertyName: "cmatDatepickerFilter", publicName: "cmatDatepickerFilter", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "input": "onInput($event.target.value)", "change": "onChange()", "blur": "onBlur()", "keydown": "onKeydown($event)" }, properties: { "attr.aria-haspopup": "true", "attr.aria-owns": "(datetimepicker()?.opened() && datetimepicker()?.id) || null", "attr.min": "min() ? datetimepicker()?.toIso8601(min()) : null", "attr.max": "max() ? datetimepicker()?.toIso8601(max()) : null", "disabled": "disabled()" } }, providers: [
|
|
2478
2428
|
CMAT_DATETIMEPICKER_VALUE_ACCESSOR,
|
|
2479
2429
|
CMAT_DATETIMEPICKER_VALIDATORS,
|
|
2480
2430
|
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: CmatDatetimepickerInputDirective },
|
|
2481
2431
|
], exportAs: ["cmatDatepickerInput"], ngImport: i0 }); }
|
|
2482
2432
|
}
|
|
2483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerInputDirective, decorators: [{
|
|
2484
2434
|
type: Directive,
|
|
2485
2435
|
args: [{
|
|
2486
2436
|
selector: 'input[cmatDatetimepicker]',
|
|
@@ -2491,10 +2441,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
2491
2441
|
],
|
|
2492
2442
|
host: {
|
|
2493
2443
|
'[attr.aria-haspopup]': 'true',
|
|
2494
|
-
'[attr.aria-owns]': '(datetimepicker?.opened && datetimepicker
|
|
2495
|
-
'[attr.min]': 'min ? datetimepicker
|
|
2496
|
-
'[attr.max]': 'max ? datetimepicker
|
|
2497
|
-
'[disabled]': 'disabled',
|
|
2444
|
+
'[attr.aria-owns]': '(datetimepicker()?.opened() && datetimepicker()?.id) || null',
|
|
2445
|
+
'[attr.min]': 'min() ? datetimepicker()?.toIso8601(min()) : null',
|
|
2446
|
+
'[attr.max]': 'max() ? datetimepicker()?.toIso8601(max()) : null',
|
|
2447
|
+
'[disabled]': 'disabled()',
|
|
2498
2448
|
'(input)': 'onInput($event.target.value)',
|
|
2499
2449
|
'(change)': 'onChange()',
|
|
2500
2450
|
'(blur)': 'onBlur()',
|
|
@@ -2502,98 +2452,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
2502
2452
|
},
|
|
2503
2453
|
exportAs: 'cmatDatepickerInput'
|
|
2504
2454
|
}]
|
|
2505
|
-
}], ctorParameters: () => [], propDecorators: { dateChange: [{
|
|
2506
|
-
type: Output
|
|
2507
|
-
}], dateInput: [{
|
|
2508
|
-
type: Output
|
|
2509
|
-
}], cmatDatetimepicker: [{
|
|
2510
|
-
type: Input
|
|
2511
|
-
}], cmatDatepickerFilter: [{
|
|
2512
|
-
type: Input
|
|
2513
|
-
}], value: [{
|
|
2514
|
-
type: Input
|
|
2515
|
-
}], min: [{
|
|
2516
|
-
type: Input
|
|
2517
|
-
}], max: [{
|
|
2518
|
-
type: Input
|
|
2519
|
-
}], disabled: [{
|
|
2520
|
-
type: Input
|
|
2521
|
-
}] } });
|
|
2455
|
+
}], ctorParameters: () => [], propDecorators: { dateChange: [{ type: i0.Output, args: ["dateChange"] }], dateInput: [{ type: i0.Output, args: ["dateInput"] }], cmatDatetimepicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "cmatDatetimepicker", required: false }] }], cmatDatepickerFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "cmatDatepickerFilter", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
2522
2456
|
|
|
2523
2457
|
class CmatDatetimepickerToggleIconDirective {
|
|
2524
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2525
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2458
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerToggleIconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2459
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: CmatDatetimepickerToggleIconDirective, isStandalone: true, selector: "[cmatDatetimepickerToggleIcon]", ngImport: i0 }); }
|
|
2526
2460
|
}
|
|
2527
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerToggleIconDirective, decorators: [{
|
|
2528
2462
|
type: Directive,
|
|
2529
2463
|
args: [{
|
|
2530
|
-
selector: '[cmatDatetimepickerToggleIcon]'
|
|
2464
|
+
selector: '[cmatDatetimepickerToggleIcon]',
|
|
2531
2465
|
}]
|
|
2532
2466
|
}] });
|
|
2533
2467
|
class CmatDatetimepickerToggleComponent {
|
|
2534
2468
|
constructor() {
|
|
2535
|
-
this.
|
|
2536
|
-
|
|
2469
|
+
this.customIcon = contentChild(CmatDatetimepickerToggleIconDirective, /* @ts-ignore */
|
|
2470
|
+
...(ngDevMode ? [{ debugName: "customIcon" }] : /* istanbul ignore next */ []));
|
|
2471
|
+
this.button = viewChild('button', /* @ts-ignore */
|
|
2472
|
+
...(ngDevMode ? [{ debugName: "button" }] : /* istanbul ignore next */ []));
|
|
2473
|
+
this.datetimepicker = input.required({ ...(ngDevMode ? { debugName: "datetimepicker" } : /* istanbul ignore next */ {}), alias: 'for' });
|
|
2474
|
+
this.tabIndex = input(0, /* @ts-ignore */
|
|
2475
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
2476
|
+
this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
2477
|
+
this.disableRipple = input(false, /* @ts-ignore */
|
|
2478
|
+
...(ngDevMode ? [{ debugName: "disableRipple" }] : /* istanbul ignore next */ []));
|
|
2479
|
+
this.disabled = input(undefined, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
2480
|
+
this.isDisabled = computed(() => {
|
|
2481
|
+
const disabledValue = this.disabled();
|
|
2482
|
+
const picker = this.datetimepicker();
|
|
2483
|
+
return disabledValue === undefined
|
|
2484
|
+
? picker?.disabled()
|
|
2485
|
+
: !!disabledValue;
|
|
2486
|
+
}, /* @ts-ignore */
|
|
2487
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
2488
|
+
this.refreshVersion = signal(0, /* @ts-ignore */
|
|
2489
|
+
...(ngDevMode ? [{ debugName: "refreshVersion" }] : /* istanbul ignore next */ []));
|
|
2537
2490
|
this.intl = inject(CmatDatetimepickerIntl);
|
|
2538
2491
|
this._destroyRef = inject(DestroyRef);
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
}
|
|
2546
|
-
ngOnChanges(changes) {
|
|
2547
|
-
if (changes['datepicker']) {
|
|
2548
|
-
this._watchStateChanges();
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
ngAfterContentInit() {
|
|
2552
|
-
this._watchStateChanges();
|
|
2492
|
+
effect(() => {
|
|
2493
|
+
const picker = this.datetimepicker();
|
|
2494
|
+
if (picker) {
|
|
2495
|
+
this._watchStateChanges();
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2553
2498
|
}
|
|
2554
2499
|
open(event) {
|
|
2555
|
-
|
|
2556
|
-
|
|
2500
|
+
const datetimepicker = this.datetimepicker();
|
|
2501
|
+
if (datetimepicker && !this.isDisabled()) {
|
|
2502
|
+
datetimepicker.open();
|
|
2557
2503
|
event.stopPropagation();
|
|
2558
2504
|
}
|
|
2559
2505
|
}
|
|
2560
2506
|
_watchStateChanges() {
|
|
2561
|
-
const
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2564
|
-
|
|
2507
|
+
const datetimepicker = this.datetimepicker();
|
|
2508
|
+
const datepickerDisabled = datetimepicker?.disabledChange ?? of(false);
|
|
2509
|
+
const inputDisabled = datetimepicker?.datetimepickerInput
|
|
2510
|
+
?.disabledChange ?? of(false);
|
|
2565
2511
|
merge(this.intl.changes, datepickerDisabled, inputDisabled)
|
|
2566
2512
|
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
2567
2513
|
.subscribe(() => this.refreshVersion.update(value => value + 1));
|
|
2568
2514
|
}
|
|
2569
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2570
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2515
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2516
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatDatetimepickerToggleComponent, isStandalone: true, selector: "cmat-datetimepicker-toggle", inputs: { datetimepicker: { classPropertyName: "datetimepicker", publicName: "for", isSignal: true, isRequired: true, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cmat-datetimepicker-toggle" }, queries: [{ propertyName: "customIcon", first: true, predicate: CmatDatetimepickerToggleIconDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true, isSignal: true }], exportAs: ["cmatDatetimepickerToggle"], ngImport: i0, template: "<button\r\n type=\"button\"\r\n matIconButton\r\n class=\"mx-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [attr.aria-haspopup]=\"datetimepicker() ? 'dialog' : null\"\r\n [attr.aria-label]=\"ariaLabel() || intl.openCalendarLabel\"\r\n [attr.tabindex]=\"disabled() ? -1 : tabIndex()\"\r\n [disabled]=\"disabled()\"\r\n [disableRipple]=\"disableRipple()\"\r\n (click)=\"open($event)\"\r\n>\r\n @if (!customIcon()) { @switch (datetimepicker().type()) { @case ('time') {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path\r\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\"\r\n ></path>\r\n </svg>\r\n } @case ('datetime') {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path\r\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\"\r\n ></path>\r\n </svg>\r\n } @default {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path\r\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\"\r\n />\r\n </svg>\r\n } } }\r\n\r\n <ng-content select=\"[cmatDatetimepickerToggleIcon]\"></ng-content>\r\n</button>\r\n", dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2571
2517
|
}
|
|
2572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDatetimepickerToggleComponent, decorators: [{
|
|
2573
2519
|
type: Component,
|
|
2574
|
-
args: [{ selector: 'cmat-datetimepicker-toggle', exportAs: 'cmatDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule], template: "<button
|
|
2575
|
-
}], propDecorators: { datetimepicker: [{
|
|
2576
|
-
type: Input,
|
|
2577
|
-
args: ['for']
|
|
2578
|
-
}], tabIndex: [{
|
|
2579
|
-
type: Input
|
|
2580
|
-
}], ariaLabel: [{
|
|
2581
|
-
type: Input,
|
|
2582
|
-
args: ['aria-label']
|
|
2583
|
-
}], disableRipple: [{
|
|
2584
|
-
type: Input
|
|
2585
|
-
}], customIcon: [{
|
|
2586
|
-
type: ContentChild,
|
|
2587
|
-
args: [CmatDatetimepickerToggleIconDirective]
|
|
2588
|
-
}], button: [{
|
|
2589
|
-
type: ViewChild,
|
|
2590
|
-
args: ['button']
|
|
2591
|
-
}], class: [{
|
|
2592
|
-
type: HostBinding,
|
|
2593
|
-
args: ['class']
|
|
2594
|
-
}], disabled: [{
|
|
2595
|
-
type: Input
|
|
2596
|
-
}] } });
|
|
2520
|
+
args: [{ selector: 'cmat-datetimepicker-toggle', exportAs: 'cmatDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule], host: { 'class': 'cmat-datetimepicker-toggle' }, template: "<button\r\n type=\"button\"\r\n matIconButton\r\n class=\"mx-1\"\r\n [attr.data-refresh]=\"refreshVersion()\"\r\n [attr.aria-haspopup]=\"datetimepicker() ? 'dialog' : null\"\r\n [attr.aria-label]=\"ariaLabel() || intl.openCalendarLabel\"\r\n [attr.tabindex]=\"disabled() ? -1 : tabIndex()\"\r\n [disabled]=\"disabled()\"\r\n [disableRipple]=\"disableRipple()\"\r\n (click)=\"open($event)\"\r\n>\r\n @if (!customIcon()) { @switch (datetimepicker().type()) { @case ('time') {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path\r\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\"\r\n ></path>\r\n </svg>\r\n } @case ('datetime') {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path\r\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\"\r\n ></path>\r\n </svg>\r\n } @default {\r\n <svg\r\n class=\"mat-icon cmat-datetimepicker-toggle-default-icon\"\r\n viewBox=\"0 0 24 24\"\r\n width=\"24px\"\r\n height=\"24px\"\r\n fill=\"currentColor\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path\r\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\"\r\n />\r\n </svg>\r\n } } }\r\n\r\n <ng-content select=\"[cmatDatetimepickerToggleIcon]\"></ng-content>\r\n</button>\r\n" }]
|
|
2521
|
+
}], ctorParameters: () => [], propDecorators: { customIcon: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CmatDatetimepickerToggleIconDirective), { isSignal: true }] }], button: [{ type: i0.ViewChild, args: ['button', { isSignal: true }] }], datetimepicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: true }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], disableRipple: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableRipple", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
2597
2522
|
|
|
2598
2523
|
/**
|
|
2599
2524
|
* Generated bundle index. Do not edit.
|