@ng-matero/extensions 18.4.1 → 19.0.1
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/_index.scss +3 -1
- package/alert/_alert-theme.scss +19 -8
- package/alert/alert.d.ts +1 -2
- package/button/button-loading.d.ts +1 -2
- package/checkbox-group/checkbox-group.d.ts +12 -4
- package/colorpicker/_colorpicker-theme.scss +19 -8
- package/colorpicker/colorpicker-input.d.ts +1 -3
- package/colorpicker/colorpicker-toggle.d.ts +3 -3
- package/colorpicker/colorpicker.d.ts +4 -7
- package/column-resize/column-resize-directives/column-resize-flex.d.ts +2 -1
- package/column-resize/column-resize-directives/column-resize.d.ts +2 -1
- package/column-resize/column-resize-notifier.d.ts +0 -1
- package/column-resize/column-resize.d.ts +1 -1
- package/column-resize/event-dispatcher.d.ts +0 -9
- package/column-resize/overlay-handle.d.ts +1 -1
- package/column-resize/resizable.d.ts +1 -1
- package/column-resize/resize-strategy.d.ts +4 -4
- package/core/datetime/datetime-adapter.d.ts +1 -2
- package/core/datetime/native-datetime-adapter.d.ts +3 -3
- package/core/style/_button-common.scss +18 -0
- package/core/theming/_config-validation.scss +4 -4
- package/core/theming/_definition.scss +12 -2
- package/core/theming/prebuilt/azure-blue.scss +10 -22
- package/core/theming/prebuilt/cyan-orange.scss +10 -22
- package/core/theming/prebuilt/magenta-violet.scss +10 -22
- package/core/theming/prebuilt/rose-red.scss +10 -22
- package/core/tokens/_m3-system.scss +273 -0
- package/core/tokens/_m3-tokens.scss +8 -151
- package/core/tokens/_token-utils.scss +102 -43
- package/core/tokens/m2/_index.scss +2 -0
- package/core/tokens/m3/definitions/_index.scss +1 -0
- package/core/tokens/m3/definitions/_md-comp-plain-tooltip.scss +51 -0
- package/core/tokens/m3/index.scss +2 -0
- package/core/tokens/m3/mdc/_plain-tooltip.scss +15 -0
- package/core/tokens/m3/mtx/_alert.scss +14 -14
- package/core/tokens/m3/mtx/_colorpicker.scss +2 -2
- package/core/tokens/m3/mtx/_datetimepicker.scss +2 -2
- package/core/tokens/m3/mtx/_drawer.scss +2 -2
- package/core/tokens/m3/mtx/_grid.scss +2 -2
- package/core/tokens/m3/mtx/_loader.scss +2 -2
- package/core/tokens/m3/mtx/_popover.scss +2 -2
- package/core/tokens/m3/mtx/_progress.scss +2 -2
- package/core/tokens/m3/mtx/_select.scss +2 -2
- package/core/tokens/m3/mtx/_split.scss +2 -2
- package/datetimepicker/_datetimepicker-theme.scss +23 -10
- package/datetimepicker/calendar-body.d.ts +26 -4
- package/datetimepicker/calendar-body.scss +58 -9
- package/datetimepicker/calendar.d.ts +31 -31
- package/datetimepicker/clock.d.ts +11 -5
- package/datetimepicker/datetimepicker-actions.d.ts +9 -5
- package/datetimepicker/datetimepicker-content.scss +15 -0
- package/datetimepicker/datetimepicker-input.d.ts +4 -5
- package/datetimepicker/datetimepicker-module.d.ts +2 -2
- package/datetimepicker/datetimepicker-toggle.d.ts +4 -3
- package/datetimepicker/datetimepicker.d.ts +12 -8
- package/datetimepicker/month-view.d.ts +22 -7
- package/datetimepicker/multi-year-view.d.ts +20 -20
- package/datetimepicker/public-api.d.ts +2 -2
- package/datetimepicker/{time.d.ts → time-view.d.ts} +21 -9
- package/datetimepicker/{time.scss → time-view.scss} +1 -1
- package/datetimepicker/year-view.d.ts +21 -11
- package/dialog/dialog-container.d.ts +1 -2
- package/dialog/dialog.d.ts +0 -1
- package/drawer/_drawer-theme.scss +19 -8
- package/drawer/drawer-container.d.ts +2 -5
- package/drawer/drawer.d.ts +3 -5
- package/fesm2022/mtxAlert.mjs +15 -15
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxButton.mjs +13 -14
- package/fesm2022/mtxButton.mjs.map +1 -1
- package/fesm2022/mtxCheckboxGroup.mjs +51 -31
- package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +91 -109
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +79 -96
- package/fesm2022/mtxColumnResize.mjs.map +1 -1
- package/fesm2022/mtxCore.mjs +31 -36
- package/fesm2022/mtxCore.mjs.map +1 -1
- package/fesm2022/mtxDatetimepicker.mjs +1181 -1093
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +30 -41
- package/fesm2022/mtxDialog.mjs.map +1 -1
- package/fesm2022/mtxDrawer.mjs +36 -52
- package/fesm2022/mtxDrawer.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +168 -204
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +12 -12
- package/fesm2022/mtxLoader.mjs.map +1 -1
- package/fesm2022/mtxPhotoviewer.mjs +11 -12
- package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
- package/fesm2022/mtxPopover.mjs +106 -119
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +8 -8
- package/fesm2022/mtxProgress.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +157 -169
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +39 -40
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +105 -91
- package/fesm2022/mtxTooltip.mjs.map +1 -1
- package/grid/_grid-theme.scss +23 -10
- package/grid/cell.d.ts +1 -4
- package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +0 -1
- package/grid/column-resize/column-resize-directives/column-resize.d.ts +0 -1
- package/grid/column-resize/overlay-handle.d.ts +1 -2
- package/grid/column-resize/resizable-directives/resizable.d.ts +2 -3
- package/grid/column-resize/resize-strategy.d.ts +2 -4
- package/grid/grid-pipes.d.ts +0 -2
- package/grid/grid.d.ts +5 -5
- package/grid/grid.scss +5 -6
- package/loader/_loader-theme.scss +19 -8
- package/loader/loader.d.ts +0 -2
- package/package.json +11 -47
- package/photoviewer/photoviewer.d.ts +1 -2
- package/popover/_popover-theme.scss +19 -8
- package/popover/popover-content.d.ts +1 -1
- package/popover/popover-target.d.ts +1 -2
- package/popover/popover-trigger.d.ts +5 -6
- package/popover/popover.d.ts +1 -2
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress/_progress-theme.scss +23 -10
- package/select/_select-theme.scss +23 -10
- package/select/option.d.ts +0 -1
- package/select/select-intl.d.ts +2 -4
- package/select/select.d.ts +8 -7
- package/select/select.scss +3 -3
- package/select/templates.d.ts +0 -12
- package/split/_split-theme.scss +19 -8
- package/split/split-pane.d.ts +3 -4
- package/split/split.d.ts +4 -4
- package/split/split.scss +1 -1
- package/tooltip/_tooltip-theme.scss +11 -4
- package/tooltip/tooltip.d.ts +17 -9
- package/tooltip/tooltip.scss +8 -3
- package/esm2022/alert/alert-module.mjs +0 -17
- package/esm2022/alert/alert.mjs +0 -46
- package/esm2022/alert/mtxAlert.mjs +0 -5
- package/esm2022/alert/public-api.mjs +0 -3
- package/esm2022/button/button-loading.mjs +0 -66
- package/esm2022/button/button-module.mjs +0 -19
- package/esm2022/button/mtxButton.mjs +0 -5
- package/esm2022/button/public-api.mjs +0 -3
- package/esm2022/checkbox-group/checkbox-group-module.mjs +0 -20
- package/esm2022/checkbox-group/checkbox-group.mjs +0 -222
- package/esm2022/checkbox-group/interfaces.mjs +0 -2
- package/esm2022/checkbox-group/mtxCheckboxGroup.mjs +0 -5
- package/esm2022/checkbox-group/public-api.mjs +0 -4
- package/esm2022/colorpicker/colorpicker-animations.mjs +0 -16
- package/esm2022/colorpicker/colorpicker-input.mjs +0 -228
- package/esm2022/colorpicker/colorpicker-module.mjs +0 -64
- package/esm2022/colorpicker/colorpicker-toggle.mjs +0 -102
- package/esm2022/colorpicker/colorpicker.mjs +0 -363
- package/esm2022/colorpicker/mtxColorpicker.mjs +0 -5
- package/esm2022/colorpicker/public-api.mjs +0 -6
- package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +0 -40
- package/esm2022/column-resize/column-resize-directives/column-resize.mjs +0 -40
- package/esm2022/column-resize/column-resize-directives/constants.mjs +0 -21
- package/esm2022/column-resize/column-resize-module.mjs +0 -28
- package/esm2022/column-resize/column-resize-notifier.mjs +0 -52
- package/esm2022/column-resize/column-resize.mjs +0 -82
- package/esm2022/column-resize/column-size-store.mjs +0 -20
- package/esm2022/column-resize/event-dispatcher.mjs +0 -70
- package/esm2022/column-resize/mtxColumnResize.mjs +0 -5
- package/esm2022/column-resize/overlay-handle.mjs +0 -146
- package/esm2022/column-resize/polyfill.mjs +0 -19
- package/esm2022/column-resize/public-api.mjs +0 -13
- package/esm2022/column-resize/resizable.mjs +0 -199
- package/esm2022/column-resize/resize-ref.mjs +0 -17
- package/esm2022/column-resize/resize-strategy.mjs +0 -238
- package/esm2022/column-resize/selectors.mjs +0 -13
- package/esm2022/core/datetime/datetime-adapter.mjs +0 -132
- package/esm2022/core/datetime/datetime-formats.mjs +0 -3
- package/esm2022/core/datetime/datetime.module.mjs +0 -38
- package/esm2022/core/datetime/index.mjs +0 -6
- package/esm2022/core/datetime/native-datetime-adapter.mjs +0 -138
- package/esm2022/core/datetime/native-datetime-formats.mjs +0 -20
- package/esm2022/core/mtxCore.mjs +0 -5
- package/esm2022/core/pipes/index.mjs +0 -4
- package/esm2022/core/pipes/is-template-ref.pipe.mjs +0 -14
- package/esm2022/core/pipes/pipes.module.mjs +0 -18
- package/esm2022/core/pipes/to-observable.pipe.mjs +0 -15
- package/esm2022/core/public-api.mjs +0 -3
- package/esm2022/datetimepicker/calendar-body.mjs +0 -77
- package/esm2022/datetimepicker/calendar.mjs +0 -661
- package/esm2022/datetimepicker/clock.mjs +0 -362
- package/esm2022/datetimepicker/datetimepicker-actions.mjs +0 -88
- package/esm2022/datetimepicker/datetimepicker-animations.mjs +0 -44
- package/esm2022/datetimepicker/datetimepicker-errors.mjs +0 -8
- package/esm2022/datetimepicker/datetimepicker-filtertype.mjs +0 -7
- package/esm2022/datetimepicker/datetimepicker-input.mjs +0 -349
- package/esm2022/datetimepicker/datetimepicker-intl.mjs +0 -63
- package/esm2022/datetimepicker/datetimepicker-module.mjs +0 -116
- package/esm2022/datetimepicker/datetimepicker-toggle.mjs +0 -105
- package/esm2022/datetimepicker/datetimepicker-types.mjs +0 -2
- package/esm2022/datetimepicker/datetimepicker.mjs +0 -580
- package/esm2022/datetimepicker/month-view.mjs +0 -148
- package/esm2022/datetimepicker/mtxDatetimepicker.mjs +0 -5
- package/esm2022/datetimepicker/multi-year-view.mjs +0 -215
- package/esm2022/datetimepicker/public-api.mjs +0 -17
- package/esm2022/datetimepicker/time.mjs +0 -470
- package/esm2022/datetimepicker/year-view.mjs +0 -139
- package/esm2022/dialog/dialog-config.mjs +0 -2
- package/esm2022/dialog/dialog-container.mjs +0 -43
- package/esm2022/dialog/dialog-module.mjs +0 -40
- package/esm2022/dialog/dialog.mjs +0 -75
- package/esm2022/dialog/mtxDialog.mjs +0 -5
- package/esm2022/dialog/public-api.mjs +0 -5
- package/esm2022/drawer/drawer-animations.mjs +0 -18
- package/esm2022/drawer/drawer-config.mjs +0 -35
- package/esm2022/drawer/drawer-container.mjs +0 -88
- package/esm2022/drawer/drawer-module.mjs +0 -21
- package/esm2022/drawer/drawer-ref.mjs +0 -99
- package/esm2022/drawer/drawer.mjs +0 -144
- package/esm2022/drawer/mtxDrawer.mjs +0 -5
- package/esm2022/drawer/public-api.mjs +0 -7
- package/esm2022/grid/cell.mjs +0 -132
- package/esm2022/grid/column-menu.mjs +0 -133
- package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +0 -38
- package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +0 -38
- package/esm2022/grid/column-resize/column-resize-directives/common.mjs +0 -27
- package/esm2022/grid/column-resize/column-resize-module.mjs +0 -42
- package/esm2022/grid/column-resize/index.mjs +0 -8
- package/esm2022/grid/column-resize/overlay-handle.mjs +0 -66
- package/esm2022/grid/column-resize/resizable-directives/common.mjs +0 -29
- package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +0 -64
- package/esm2022/grid/column-resize/resize-strategy.mjs +0 -47
- package/esm2022/grid/expansion-toggle.mjs +0 -65
- package/esm2022/grid/grid-module.mjs +0 -151
- package/esm2022/grid/grid-pipes.mjs +0 -129
- package/esm2022/grid/grid-utils.mjs +0 -56
- package/esm2022/grid/grid.mjs +0 -644
- package/esm2022/grid/interfaces.mjs +0 -2
- package/esm2022/grid/mtxGrid.mjs +0 -5
- package/esm2022/grid/public-api.mjs +0 -18
- package/esm2022/grid/selectable-cell.mjs +0 -53
- package/esm2022/loader/loader-module.mjs +0 -19
- package/esm2022/loader/loader.mjs +0 -57
- package/esm2022/loader/mtxLoader.mjs +0 -5
- package/esm2022/loader/public-api.mjs +0 -3
- package/esm2022/ng-matero-extensions.mjs +0 -5
- package/esm2022/photoviewer/mtxPhotoviewer.mjs +0 -5
- package/esm2022/photoviewer/photoviewer-module.mjs +0 -16
- package/esm2022/photoviewer/photoviewer.mjs +0 -64
- package/esm2022/photoviewer/public-api.mjs +0 -3
- package/esm2022/popover/mtxPopover.mjs +0 -5
- package/esm2022/popover/popover-animations.mjs +0 -25
- package/esm2022/popover/popover-content.mjs +0 -91
- package/esm2022/popover/popover-errors.mjs +0 -27
- package/esm2022/popover/popover-interfaces.mjs +0 -2
- package/esm2022/popover/popover-module.mjs +0 -39
- package/esm2022/popover/popover-target.mjs +0 -18
- package/esm2022/popover/popover-trigger.mjs +0 -480
- package/esm2022/popover/popover-types.mjs +0 -2
- package/esm2022/popover/popover.mjs +0 -325
- package/esm2022/popover/public-api.mjs +0 -9
- package/esm2022/progress/mtxProgress.mjs +0 -5
- package/esm2022/progress/progress-module.mjs +0 -17
- package/esm2022/progress/progress.mjs +0 -43
- package/esm2022/progress/public-api.mjs +0 -3
- package/esm2022/public-api.mjs +0 -5
- package/esm2022/select/mtxSelect.mjs +0 -5
- package/esm2022/select/option.mjs +0 -52
- package/esm2022/select/public-api.mjs +0 -6
- package/esm2022/select/select-intl.mjs +0 -32
- package/esm2022/select/select-module.mjs +0 -89
- package/esm2022/select/select.mjs +0 -611
- package/esm2022/select/templates.mjs +0 -135
- package/esm2022/split/interfaces.mjs +0 -2
- package/esm2022/split/mtxSplit.mjs +0 -5
- package/esm2022/split/public-api.mjs +0 -6
- package/esm2022/split/split-module.mjs +0 -18
- package/esm2022/split/split-pane.mjs +0 -161
- package/esm2022/split/split.mjs +0 -634
- package/esm2022/split/utils.mjs +0 -219
- package/esm2022/tooltip/mtxTooltip.mjs +0 -5
- package/esm2022/tooltip/public-api.mjs +0 -4
- package/esm2022/tooltip/tooltip-animations.mjs +0 -17
- package/esm2022/tooltip/tooltip-module.mjs +0 -41
- package/esm2022/tooltip/tooltip.mjs +0 -915
|
@@ -1,386 +1,21 @@
|
|
|
1
|
-
import { A11yModule } from '@angular/cdk/a11y';
|
|
2
|
-
import * as i1$1 from '@angular/cdk/overlay';
|
|
1
|
+
import { CdkMonitorFocus, CdkTrapFocus, A11yModule } from '@angular/cdk/a11y';
|
|
3
2
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
4
3
|
import { ComponentPortal, CdkPortalOutlet, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
5
4
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
6
5
|
import * as i0 from '@angular/core';
|
|
7
|
-
import {
|
|
6
|
+
import { Injectable, inject, ElementRef, NgZone, Injector, EventEmitter, afterNextRender, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ViewChild, ChangeDetectorRef, booleanAttribute, Directive, InjectionToken, ViewContainerRef, forwardRef, HostAttributeToken, ContentChild, TemplateRef, NgModule } from '@angular/core';
|
|
8
7
|
import { MatButton, MatIconButton, MatButtonModule } from '@angular/material/button';
|
|
9
|
-
import {
|
|
10
|
-
import * as i1 from '@ng-matero/extensions/core';
|
|
11
|
-
import { MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
|
|
12
|
-
import { normalizePassiveListenerOptions, _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
8
|
+
import { DatetimeAdapter, MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
|
|
13
9
|
import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
|
|
14
|
-
import { coerceNumberProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
15
10
|
import { Subject, Subscription, merge, of } from 'rxjs';
|
|
11
|
+
import { SPACE, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
12
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
13
|
+
import { coerceNumberProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
14
|
+
import { normalizePassiveListenerOptions, _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
16
15
|
import { take, filter } from 'rxjs/operators';
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
20
|
-
import * as i2 from '@angular/material/form-field';
|
|
21
|
-
|
|
22
|
-
var MtxDatetimepickerFilterType;
|
|
23
|
-
(function (MtxDatetimepickerFilterType) {
|
|
24
|
-
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["DATE"] = 0] = "DATE";
|
|
25
|
-
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["HOUR"] = 1] = "HOUR";
|
|
26
|
-
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["MINUTE"] = 2] = "MINUTE";
|
|
27
|
-
})(MtxDatetimepickerFilterType || (MtxDatetimepickerFilterType = {}));
|
|
28
|
-
|
|
29
|
-
const activeEventOptions = normalizePassiveListenerOptions({ passive: false });
|
|
30
|
-
const CLOCK_RADIUS = 50;
|
|
31
|
-
const CLOCK_INNER_RADIUS = 27.5;
|
|
32
|
-
const CLOCK_OUTER_RADIUS = 41.25;
|
|
33
|
-
const CLOCK_TICK_RADIUS = 7.0833;
|
|
34
|
-
/**
|
|
35
|
-
* A clock that is used as part of the datetimepicker.
|
|
36
|
-
* @docs-private
|
|
37
|
-
*/
|
|
38
|
-
class MtxClock {
|
|
39
|
-
constructor(_elementRef, _adapter, _changeDetectorRef, _document) {
|
|
40
|
-
this._elementRef = _elementRef;
|
|
41
|
-
this._adapter = _adapter;
|
|
42
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
43
|
-
this._document = _document;
|
|
44
|
-
/** Step over minutes. */
|
|
45
|
-
this.interval = 1;
|
|
46
|
-
this.actionButtons = false;
|
|
47
|
-
/** Whether the clock uses 12 hour format. */
|
|
48
|
-
this.twelvehour = false;
|
|
49
|
-
/** Whether the time is now in AM or PM. */
|
|
50
|
-
this.AMPM = 'AM';
|
|
51
|
-
/** Emits when the currently selected date changes. */
|
|
52
|
-
this.selectedChange = new EventEmitter();
|
|
53
|
-
/** Emits when any date is activated. */
|
|
54
|
-
this.activeDateChange = new EventEmitter();
|
|
55
|
-
/** Emits when any date is selected. */
|
|
56
|
-
this._userSelection = new EventEmitter();
|
|
57
|
-
/** Whether the clock is in hour view. */
|
|
58
|
-
this._hourView = true;
|
|
59
|
-
this._hours = [];
|
|
60
|
-
this._minutes = [];
|
|
61
|
-
this._timeChanged = false;
|
|
62
|
-
/** Called when the user has put their pointer down on the clock. */
|
|
63
|
-
this._pointerDown = (event) => {
|
|
64
|
-
this._timeChanged = false;
|
|
65
|
-
this.setTime(event);
|
|
66
|
-
this._bindGlobalEvents(event);
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Called when the user has moved their pointer after
|
|
70
|
-
* starting to drag. Bound on the document level.
|
|
71
|
-
*/
|
|
72
|
-
this._pointerMove = (event) => {
|
|
73
|
-
if (event.cancelable) {
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
}
|
|
76
|
-
this.setTime(event);
|
|
77
|
-
};
|
|
78
|
-
/** Called when the user has lifted their pointer. Bound on the document level. */
|
|
79
|
-
this._pointerUp = (event) => {
|
|
80
|
-
if (event.cancelable) {
|
|
81
|
-
event.preventDefault();
|
|
82
|
-
}
|
|
83
|
-
this._removeGlobalEvents();
|
|
84
|
-
if (this._timeChanged) {
|
|
85
|
-
this.selectedChange.emit(this.activeDate);
|
|
86
|
-
if (this.actionButtons || !this._hourView) {
|
|
87
|
-
this._userSelection.emit();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The date to display in this clock view.
|
|
94
|
-
*/
|
|
95
|
-
get activeDate() {
|
|
96
|
-
return this._activeDate;
|
|
97
|
-
}
|
|
98
|
-
set activeDate(value) {
|
|
99
|
-
const oldActiveDate = this._activeDate;
|
|
100
|
-
this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
101
|
-
if (!this._adapter.sameMinute(oldActiveDate, this._activeDate)) {
|
|
102
|
-
this._init();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/** The currently selected date. */
|
|
106
|
-
get selected() {
|
|
107
|
-
return this._selected;
|
|
108
|
-
}
|
|
109
|
-
set selected(value) {
|
|
110
|
-
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
111
|
-
if (this._selected) {
|
|
112
|
-
this.activeDate = this._selected;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/** The minimum selectable date. */
|
|
116
|
-
get minDate() {
|
|
117
|
-
return this._minDate;
|
|
118
|
-
}
|
|
119
|
-
set minDate(value) {
|
|
120
|
-
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
121
|
-
}
|
|
122
|
-
/** The maximum selectable date. */
|
|
123
|
-
get maxDate() {
|
|
124
|
-
return this._maxDate;
|
|
125
|
-
}
|
|
126
|
-
set maxDate(value) {
|
|
127
|
-
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
128
|
-
}
|
|
129
|
-
/** Whether the clock should be started in hour or minute view. */
|
|
130
|
-
set startView(value) {
|
|
131
|
-
this._hourView = value !== 'minute';
|
|
132
|
-
}
|
|
133
|
-
get _hand() {
|
|
134
|
-
const hour = this._adapter.getHour(this.activeDate);
|
|
135
|
-
this._selectedHour = hour;
|
|
136
|
-
this._selectedMinute = this._adapter.getMinute(this.activeDate);
|
|
137
|
-
let deg = 0;
|
|
138
|
-
let radius = CLOCK_OUTER_RADIUS;
|
|
139
|
-
if (this._hourView) {
|
|
140
|
-
const outer = this._selectedHour > 0 && this._selectedHour < 13;
|
|
141
|
-
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
142
|
-
if (this.twelvehour) {
|
|
143
|
-
radius = CLOCK_OUTER_RADIUS;
|
|
144
|
-
}
|
|
145
|
-
deg = Math.round(this._selectedHour * (360 / (24 / 2)));
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
deg = Math.round(this._selectedMinute * (360 / 60));
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
height: `${radius}%`,
|
|
152
|
-
marginTop: `${50 - radius}%`,
|
|
153
|
-
transform: `rotate(${deg}deg)`,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
ngAfterContentInit() {
|
|
157
|
-
this.activeDate = this._activeDate || this._adapter.today();
|
|
158
|
-
this._init();
|
|
159
|
-
}
|
|
160
|
-
ngOnDestroy() {
|
|
161
|
-
this._removeGlobalEvents();
|
|
162
|
-
}
|
|
163
|
-
ngOnChanges() {
|
|
164
|
-
this._init();
|
|
165
|
-
}
|
|
166
|
-
/** Binds our global move and end events. */
|
|
167
|
-
_bindGlobalEvents(triggerEvent) {
|
|
168
|
-
// Note that we bind the events to the `document`, because it allows us to capture
|
|
169
|
-
// drag cancel events where the user's pointer is outside the browser window.
|
|
170
|
-
const document = this._document;
|
|
171
|
-
const isTouch = isTouchEvent(triggerEvent);
|
|
172
|
-
const moveEventName = isTouch ? 'touchmove' : 'mousemove';
|
|
173
|
-
const endEventName = isTouch ? 'touchend' : 'mouseup';
|
|
174
|
-
document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
|
|
175
|
-
document.addEventListener(endEventName, this._pointerUp, activeEventOptions);
|
|
176
|
-
if (isTouch) {
|
|
177
|
-
document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/** Removes any global event listeners that we may have added. */
|
|
181
|
-
_removeGlobalEvents() {
|
|
182
|
-
const document = this._document;
|
|
183
|
-
document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
|
|
184
|
-
document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
|
|
185
|
-
document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
|
|
186
|
-
document.removeEventListener('touchend', this._pointerUp, activeEventOptions);
|
|
187
|
-
document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
188
|
-
}
|
|
189
|
-
/** Initializes this clock view. */
|
|
190
|
-
_init() {
|
|
191
|
-
this._hours.length = 0;
|
|
192
|
-
this._minutes.length = 0;
|
|
193
|
-
const hourNames = this._adapter.getHourNames();
|
|
194
|
-
const minuteNames = this._adapter.getMinuteNames();
|
|
195
|
-
if (this.twelvehour) {
|
|
196
|
-
const hours = [];
|
|
197
|
-
for (let i = 0; i < hourNames.length; i++) {
|
|
198
|
-
const radian = (i / 6) * Math.PI;
|
|
199
|
-
const radius = CLOCK_OUTER_RADIUS;
|
|
200
|
-
const hour = i;
|
|
201
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), hour, 0);
|
|
202
|
-
// Check if the date is enabled, no need to respect the minute setting here
|
|
203
|
-
const enabled = (!this.minDate ||
|
|
204
|
-
this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
|
|
205
|
-
(!this.maxDate ||
|
|
206
|
-
this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
|
|
207
|
-
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
|
|
208
|
-
// display value for twelvehour clock should be from 1-12 not including 0 and not above 12
|
|
209
|
-
hours.push({
|
|
210
|
-
value: i,
|
|
211
|
-
displayValue: i % 12 === 0 ? '12' : hourNames[i % 12],
|
|
212
|
-
enabled,
|
|
213
|
-
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
214
|
-
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
// filter out AM or PM hours based on AMPM
|
|
218
|
-
if (this.AMPM === 'AM') {
|
|
219
|
-
this._hours = hours.filter(x => x.value < 12);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
this._hours = hours.filter(x => x.value >= 12);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
for (let i = 0; i < hourNames.length; i++) {
|
|
227
|
-
const radian = (i / 6) * Math.PI;
|
|
228
|
-
const outer = i > 0 && i < 13;
|
|
229
|
-
const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
230
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i, 0);
|
|
231
|
-
// Check if the date is enabled, no need to respect the minute setting here
|
|
232
|
-
const enabled = (!this.minDate ||
|
|
233
|
-
this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
|
|
234
|
-
(!this.maxDate ||
|
|
235
|
-
this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
|
|
236
|
-
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
|
|
237
|
-
this._hours.push({
|
|
238
|
-
value: i,
|
|
239
|
-
displayValue: i === 0 ? '00' : hourNames[i],
|
|
240
|
-
enabled,
|
|
241
|
-
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
242
|
-
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
243
|
-
fontSize: i > 0 && i < 13 ? '' : '80%',
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
for (let i = 0; i < minuteNames.length; i += 5) {
|
|
248
|
-
const radian = (i / 30) * Math.PI;
|
|
249
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), i);
|
|
250
|
-
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
251
|
-
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0) &&
|
|
252
|
-
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.MINUTE));
|
|
253
|
-
this._minutes.push({
|
|
254
|
-
value: i,
|
|
255
|
-
displayValue: i === 0 ? '00' : minuteNames[i],
|
|
256
|
-
enabled,
|
|
257
|
-
top: CLOCK_RADIUS - Math.cos(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
258
|
-
left: CLOCK_RADIUS + Math.sin(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Set Time
|
|
264
|
-
* @param event
|
|
265
|
-
*/
|
|
266
|
-
setTime(event) {
|
|
267
|
-
const trigger = this._elementRef.nativeElement;
|
|
268
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
269
|
-
const width = trigger.offsetWidth;
|
|
270
|
-
const height = trigger.offsetHeight;
|
|
271
|
-
const { pageX, pageY } = getPointerPositionOnPage(event);
|
|
272
|
-
const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
|
|
273
|
-
const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
|
|
274
|
-
let radian = Math.atan2(-x, y);
|
|
275
|
-
const unit = Math.PI / (this._hourView ? 6 : this.interval ? 30 / this.interval : 30);
|
|
276
|
-
const z = Math.sqrt(x * x + y * y);
|
|
277
|
-
const outer = this._hourView &&
|
|
278
|
-
z > (width * (CLOCK_OUTER_RADIUS / 100) + width * (CLOCK_INNER_RADIUS / 100)) / 2;
|
|
279
|
-
if (radian < 0) {
|
|
280
|
-
radian = Math.PI * 2 + radian;
|
|
281
|
-
}
|
|
282
|
-
let value = Math.round(radian / unit);
|
|
283
|
-
let date;
|
|
284
|
-
if (this._hourView) {
|
|
285
|
-
if (this.twelvehour) {
|
|
286
|
-
if (this.AMPM === 'AM') {
|
|
287
|
-
value = value === 0 ? 12 : value;
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
// if we chosen 12 in PM, the value should be 0 for 0:00,
|
|
291
|
-
// else we can safely add 12 to the final value
|
|
292
|
-
value = value === 12 ? 0 : value + 12;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
if (value === 12) {
|
|
297
|
-
value = 0;
|
|
298
|
-
}
|
|
299
|
-
value = outer ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
|
|
300
|
-
}
|
|
301
|
-
date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), value, this._adapter.getMinute(this.activeDate));
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
if (this.interval) {
|
|
305
|
-
value *= this.interval;
|
|
306
|
-
}
|
|
307
|
-
if (value === 60) {
|
|
308
|
-
value = 0;
|
|
309
|
-
}
|
|
310
|
-
date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), value);
|
|
311
|
-
}
|
|
312
|
-
// if there is a dateFilter, check if the date is allowed if it is not then do not set/emit new date
|
|
313
|
-
// https://github.com/ng-matero/extensions/issues/244
|
|
314
|
-
if (this.dateFilter &&
|
|
315
|
-
!this.dateFilter(date, this._hourView ? MtxDatetimepickerFilterType.HOUR : MtxDatetimepickerFilterType.MINUTE)) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
this._timeChanged = true;
|
|
319
|
-
this.activeDate = date;
|
|
320
|
-
this._changeDetectorRef.markForCheck();
|
|
321
|
-
this.activeDateChange.emit(this.activeDate);
|
|
322
|
-
}
|
|
323
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: MtxClock, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
324
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: MtxClock, isStandalone: true, selector: "mtx-clock", inputs: { dateFilter: "dateFilter", interval: "interval", actionButtons: "actionButtons", twelvehour: ["twelvehour", "twelvehour", booleanAttribute], AMPM: "AMPM", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", startView: "startView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection" }, host: { attributes: { "role": "clock" }, listeners: { "mousedown": "_pointerDown($event)", "touchstart": "_pointerDown($event)" }, classAttribute: "mtx-clock" }, exportAs: ["mtxClock"], usesOnChanges: true, ngImport: i0, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div class=\"mtx-clock-hand\" [style]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n @for (item of _hours; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n @for (item of _minutes; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;font-size:var(--mtx-datetimepicker-clock-text-size, var(--mat-app-title-small-size))}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-dial-background-color, var(--mat-app-surface-container-highest))}.mtx-clock-center{position:absolute;top:50%;left:50%;width:3%;height:3%;margin:-1.5%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-3px;width:8px;height:8px;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-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;color:var(--mtx-datetimepicker-clock-cell-text-color, var(--mat-app-on-surface))}.mtx-clock-cell.mtx-clock-cell-selected{color:#fff;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-cell:not(.mtx-clock-cell-selected,.mtx-clock-cell-disabled):hover{background-color:var(--mtx-datetimepicker-clock-cell-hover-state-background-color)}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none;color:var(--mtx-datetimepicker-clock-cell-disabled-state-text-color)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
325
|
-
}
|
|
326
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: MtxClock, decorators: [{
|
|
327
|
-
type: Component,
|
|
328
|
-
args: [{ selector: 'mtx-clock', host: {
|
|
329
|
-
'role': 'clock',
|
|
330
|
-
'class': 'mtx-clock',
|
|
331
|
-
'(mousedown)': '_pointerDown($event)',
|
|
332
|
-
'(touchstart)': '_pointerDown($event)',
|
|
333
|
-
}, exportAs: 'mtxClock', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div class=\"mtx-clock-hand\" [style]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n @for (item of _hours; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n @for (item of _minutes; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;font-size:var(--mtx-datetimepicker-clock-text-size, var(--mat-app-title-small-size))}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-dial-background-color, var(--mat-app-surface-container-highest))}.mtx-clock-center{position:absolute;top:50%;left:50%;width:3%;height:3%;margin:-1.5%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-3px;width:8px;height:8px;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-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;color:var(--mtx-datetimepicker-clock-cell-text-color, var(--mat-app-on-surface))}.mtx-clock-cell.mtx-clock-cell-selected{color:#fff;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-app-primary))}.mtx-clock-cell:not(.mtx-clock-cell-selected,.mtx-clock-cell-disabled):hover{background-color:var(--mtx-datetimepicker-clock-cell-hover-state-background-color)}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none;color:var(--mtx-datetimepicker-clock-cell-disabled-state-text-color)}\n"] }]
|
|
334
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
335
|
-
type: Inject,
|
|
336
|
-
args: [DOCUMENT]
|
|
337
|
-
}] }], propDecorators: { dateFilter: [{
|
|
338
|
-
type: Input
|
|
339
|
-
}], interval: [{
|
|
340
|
-
type: Input
|
|
341
|
-
}], actionButtons: [{
|
|
342
|
-
type: Input
|
|
343
|
-
}], twelvehour: [{
|
|
344
|
-
type: Input,
|
|
345
|
-
args: [{ transform: booleanAttribute }]
|
|
346
|
-
}], AMPM: [{
|
|
347
|
-
type: Input
|
|
348
|
-
}], selectedChange: [{
|
|
349
|
-
type: Output
|
|
350
|
-
}], activeDateChange: [{
|
|
351
|
-
type: Output
|
|
352
|
-
}], _userSelection: [{
|
|
353
|
-
type: Output
|
|
354
|
-
}], activeDate: [{
|
|
355
|
-
type: Input
|
|
356
|
-
}], selected: [{
|
|
357
|
-
type: Input
|
|
358
|
-
}], minDate: [{
|
|
359
|
-
type: Input
|
|
360
|
-
}], maxDate: [{
|
|
361
|
-
type: Input
|
|
362
|
-
}], startView: [{
|
|
363
|
-
type: Input
|
|
364
|
-
}] } });
|
|
365
|
-
/** Returns whether an event is a touch event. */
|
|
366
|
-
function isTouchEvent(event) {
|
|
367
|
-
// This function is called for every pixel that the user has dragged so we need it to be
|
|
368
|
-
// as fast as possible. Since we only bind mouse events and touch events, we can assume
|
|
369
|
-
// that if the event's name starts with `t`, it's a touch event.
|
|
370
|
-
return event.type[0] === 't';
|
|
371
|
-
}
|
|
372
|
-
/** Gets the coordinates of a touch or mouse event relative to the document. */
|
|
373
|
-
function getPointerPositionOnPage(event) {
|
|
374
|
-
let point;
|
|
375
|
-
if (isTouchEvent(event)) {
|
|
376
|
-
// `touches` will be empty for start/end events so we have to fall back to `changedTouches`.
|
|
377
|
-
point = event.touches[0] || event.changedTouches[0];
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
point = event;
|
|
381
|
-
}
|
|
382
|
-
return point;
|
|
383
|
-
}
|
|
16
|
+
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
|
17
|
+
import { MatFormField } from '@angular/material/form-field';
|
|
18
|
+
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
384
19
|
|
|
385
20
|
/**
|
|
386
21
|
* Animations used by the Material datetimepicker.
|
|
@@ -433,6 +68,74 @@ function createMissingDateImplError(provider) {
|
|
|
433
68
|
`custom implementation.`);
|
|
434
69
|
}
|
|
435
70
|
|
|
71
|
+
var MtxDatetimepickerFilterType;
|
|
72
|
+
(function (MtxDatetimepickerFilterType) {
|
|
73
|
+
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["DATE"] = 0] = "DATE";
|
|
74
|
+
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["HOUR"] = 1] = "HOUR";
|
|
75
|
+
MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["MINUTE"] = 2] = "MINUTE";
|
|
76
|
+
})(MtxDatetimepickerFilterType || (MtxDatetimepickerFilterType = {}));
|
|
77
|
+
|
|
78
|
+
class MtxDatetimepickerIntl {
|
|
79
|
+
constructor() {
|
|
80
|
+
/**
|
|
81
|
+
* Stream to emit from when labels are changed. Use this to notify components when the labels have
|
|
82
|
+
* changed after initialization.
|
|
83
|
+
*/
|
|
84
|
+
this.changes = new Subject();
|
|
85
|
+
/** A label for the calendar popup (used by screen readers). */
|
|
86
|
+
this.calendarLabel = 'Calendar';
|
|
87
|
+
/** A label for the button used to open the calendar popup (used by screen readers). */
|
|
88
|
+
this.openCalendarLabel = 'Open calendar';
|
|
89
|
+
/** Label for the button used to close the calendar popup. */
|
|
90
|
+
this.closeCalendarLabel = 'Close calendar';
|
|
91
|
+
/** A label for the previous month button (used by screen readers). */
|
|
92
|
+
this.prevMonthLabel = 'Previous month';
|
|
93
|
+
/** A label for the next month button (used by screen readers). */
|
|
94
|
+
this.nextMonthLabel = 'Next month';
|
|
95
|
+
/** A label for the previous year button (used by screen readers). */
|
|
96
|
+
this.prevYearLabel = 'Previous year';
|
|
97
|
+
/** A label for the next year button (used by screen readers). */
|
|
98
|
+
this.nextYearLabel = 'Next year';
|
|
99
|
+
/** A label for the previous multi-year button (used by screen readers). */
|
|
100
|
+
this.prevMultiYearLabel = 'Previous 24 years';
|
|
101
|
+
/** A label for the next multi-year button (used by screen readers). */
|
|
102
|
+
this.nextMultiYearLabel = 'Next 24 years';
|
|
103
|
+
/** A label for the 'switch to month view' button (used by screen readers). */
|
|
104
|
+
this.switchToMonthViewLabel = 'Choose date';
|
|
105
|
+
/** A label for the 'switch to year view' button (used by screen readers). */
|
|
106
|
+
this.switchToYearViewLabel = 'Choose month';
|
|
107
|
+
/** A label for the 'switch to multi-year view' button (used by screen readers). */
|
|
108
|
+
this.switchToMultiYearViewLabel = 'Choose month and year';
|
|
109
|
+
/** A label for the first date of a range of dates (used by screen readers). */
|
|
110
|
+
this.startDateLabel = 'Start date';
|
|
111
|
+
/** A label for the last date of a range of dates (used by screen readers). */
|
|
112
|
+
this.endDateLabel = 'End date';
|
|
113
|
+
/** A label for the 'switch to clock hour view' button (used by screen readers). */
|
|
114
|
+
this.switchToClockHourViewLabel = 'Choose hour';
|
|
115
|
+
/** A label for the 'switch to clock minute view' button (used by screen readers). */
|
|
116
|
+
this.switchToClockMinuteViewLabel = 'Choose minute';
|
|
117
|
+
/** Label used for ok button within the manual time input. */
|
|
118
|
+
this.okLabel = 'OK';
|
|
119
|
+
/** Label used for cancel button within the manual time input. */
|
|
120
|
+
this.cancelLabel = 'Cancel';
|
|
121
|
+
}
|
|
122
|
+
/** Formats a range of years (used for visuals). */
|
|
123
|
+
formatYearRange(start, end) {
|
|
124
|
+
return `${start} \u2013 ${end}`;
|
|
125
|
+
}
|
|
126
|
+
/** Formats a label for a range of years (used by screen readers). */
|
|
127
|
+
formatYearRangeLabel(start, end) {
|
|
128
|
+
return `${start} to ${end}`;
|
|
129
|
+
}
|
|
130
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
131
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerIntl, providedIn: 'root' }); }
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerIntl, decorators: [{
|
|
134
|
+
type: Injectable,
|
|
135
|
+
args: [{ providedIn: 'root' }]
|
|
136
|
+
}] });
|
|
137
|
+
|
|
138
|
+
let uniqueIdCounter$1 = 0;
|
|
436
139
|
/**
|
|
437
140
|
* An internal class that represents the data corresponding to a single calendar cell.
|
|
438
141
|
* @docs-private
|
|
@@ -443,6 +146,7 @@ class MtxCalendarCell {
|
|
|
443
146
|
this.displayValue = displayValue;
|
|
444
147
|
this.ariaLabel = ariaLabel;
|
|
445
148
|
this.enabled = enabled;
|
|
149
|
+
this.id = uniqueIdCounter$1++;
|
|
446
150
|
}
|
|
447
151
|
}
|
|
448
152
|
/**
|
|
@@ -451,6 +155,14 @@ class MtxCalendarCell {
|
|
|
451
155
|
*/
|
|
452
156
|
class MtxCalendarBody {
|
|
453
157
|
constructor() {
|
|
158
|
+
this._elementRef = inject(ElementRef);
|
|
159
|
+
this._ngZone = inject(NgZone);
|
|
160
|
+
this._injector = inject(Injector);
|
|
161
|
+
/**
|
|
162
|
+
* The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
|
|
163
|
+
* maintained even as the table resizes.
|
|
164
|
+
*/
|
|
165
|
+
this.cellAspectRatio = 1;
|
|
454
166
|
/** The number of columns in the table. */
|
|
455
167
|
this.numCols = 7;
|
|
456
168
|
/** Whether to allow selection of disabled cells. */
|
|
@@ -459,88 +171,330 @@ class MtxCalendarBody {
|
|
|
459
171
|
this.activeCell = 0;
|
|
460
172
|
/** Emits when a new value is selected. */
|
|
461
173
|
this.selectedValueChange = new EventEmitter();
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Tracking function for rows based on their identity. Ideally we would use some sort of
|
|
176
|
+
* key on the row, but that would require a breaking change for the `rows` input. We don't
|
|
177
|
+
* use the built-in identity tracking, because it logs warnings.
|
|
178
|
+
*/
|
|
179
|
+
this._trackRow = (row) => row;
|
|
468
180
|
}
|
|
469
181
|
_cellClicked(cell) {
|
|
470
182
|
if (!this.allowDisabledSelection && !cell.enabled) {
|
|
471
183
|
return;
|
|
472
184
|
}
|
|
473
|
-
this.selectedValueChange.emit(cell.value);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
185
|
+
this.selectedValueChange.emit(cell.value);
|
|
186
|
+
}
|
|
187
|
+
_emitActiveDateChange(cell, event) {
|
|
188
|
+
if (cell.enabled) {
|
|
189
|
+
// this.activeDateChange.emit({ value: cell.value, event });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
_isActiveCell(rowIndex, colIndex) {
|
|
193
|
+
let cellNumber = rowIndex * this.numCols + colIndex;
|
|
194
|
+
// Account for the fact that the first row may not have as many cells.
|
|
195
|
+
if (rowIndex) {
|
|
196
|
+
cellNumber -= this._firstRowOffset;
|
|
197
|
+
}
|
|
198
|
+
return cellNumber === this.activeCell;
|
|
199
|
+
}
|
|
200
|
+
ngOnChanges(changes) {
|
|
201
|
+
const columnChanges = changes['numCols'];
|
|
202
|
+
const { rows, numCols } = this;
|
|
203
|
+
if (changes['rows'] || columnChanges) {
|
|
204
|
+
this._firstRowOffset = rows && rows.length && rows[0].length ? numCols - rows[0].length : 0;
|
|
205
|
+
}
|
|
206
|
+
if (changes['cellAspectRatio'] || columnChanges || !this._cellPadding) {
|
|
207
|
+
this._cellPadding = `${(50 * this.cellAspectRatio) / numCols}%`;
|
|
208
|
+
}
|
|
209
|
+
if (columnChanges || !this._cellWidth) {
|
|
210
|
+
this._cellWidth = `${100 / numCols}%`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
_focusActiveCell(movePreview = true) {
|
|
214
|
+
afterNextRender(() => {
|
|
215
|
+
setTimeout(() => {
|
|
216
|
+
const activeCell = this._elementRef.nativeElement.querySelector('.mtx-calendar-body-active');
|
|
217
|
+
if (activeCell) {
|
|
218
|
+
activeCell.focus();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}, { injector: this._injector });
|
|
222
|
+
}
|
|
223
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
224
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxCalendarBody, isStandalone: true, selector: "[mtx-calendar-body]", inputs: { label: "label", rows: "rows", cellAspectRatio: "cellAspectRatio", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", allowDisabledSelection: "allowDisabledSelection", activeCell: "activeCell" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { attributes: { "role": "grid", "aria-readonly": "true" }, classAttribute: "mtx-calendar-body" }, exportAs: ["mtxCalendarBody"], usesOnChanges: true, ngImport: i0, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n@if (_firstRowOffset < labelMinRequiredCells) {\n <tr aria-hidden=\"true\">\n <td\n class=\"mtx-calendar-body-label\"\n [attr.colspan]=\"numCols\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n >\n {{ label }}\n </td>\n </tr>\n}\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n@for (row of rows; track _trackRow(row); let rowIndex = $index) {\n <tr role=\"row\">\n <!--\n This cell is purely decorative, but we can't put `aria-hidden` or `role=\"presentation\"` on it,\n because it throws off the week days for the rest of the row on NVDA. The aspect ratio of the\n table cells is maintained by setting the top and bottom padding as a percentage of the width\n (a variant of the trick described here: https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n @if (rowIndex === 0 && _firstRowOffset) {\n <td\n class=\"mtx-calendar-body-label\"\n [attr.colspan]=\"_firstRowOffset\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n >\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n }\n <!--\n Each gridcell in the calendar contains a button, which signals to assistive technology that the\n cell is interactable, as well as the selection state via `aria-pressed`. See #23476 for\n background.\n -->\n @for (item of row; track item.id; let colIndex = $index) {\n <td\n role=\"gridcell\"\n class=\"mtx-calendar-body-cell-container\"\n [style.width]=\"_cellWidth\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n >\n <button\n type=\"button\"\n class=\"mtx-calendar-body-cell\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mtx-calendar-body-disabled]=\"!item.enabled\"\n [class.mtx-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n (click)=\"_cellClicked(item)\"\n >\n <span\n class=\"mtx-calendar-body-cell-content mat-focus-indicator\"\n [class.mtx-calendar-body-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-today]=\"todayValue === item.value\"\n >\n {{ item.displayValue }}\n </span>\n </button>\n </td>\n }\n </tr>\n}\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-today-outline-color, var(--mat-sys-primary))}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding-left:4.7142857143%;padding-right:4.7142857143%;font-size:var(--mtx-datetimepicker-calendar-body-label-text-size, var(--mat-sys-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-body-label-text-weight, var(--mat-sys-title-small-weight));color:var(--mtx-datetimepicker-calendar-body-label-text-color, var(--mat-sys-on-surface))}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell-container{position:relative;height:0;line-height:0}.mtx-calendar-body-cell{position:absolute;top:0;left:0;width:100%;height:100%;background:none;text-align:center;font-family:inherit;margin:0;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-sys-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-sys-body-large-size));-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent}.mtx-calendar-body-cell::-moz-focus-inner{border:0}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-disabled>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-body-disabled>.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}@media (forced-colors: active){.mtx-calendar-body-disabled{opacity:.5}}.mtx-calendar-body-cell-content{top:5%;left:5%;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border:1px;border-style:solid;border-radius:999px;color:var(--mtx-datetimepicker-calendar-date-text-color, var(--mat-sys-on-surface));border-color:var(--mtx-datetimepicker-calendar-date-outline-color, transparent)}.mtx-calendar-body-cell-content.mat-focus-indicator{position:absolute}@media (forced-colors: active){.mtx-calendar-body-cell-content{border:none}}.cdk-keyboard-focused .mtx-calendar-body-active>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected),.cdk-program-focused .mtx-calendar-body-active>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-focus-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media (hover: hover){.mtx-calendar-body-cell:not(.mtx-calendar-body-disabled):hover>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}}.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-state-background-color, var(--mat-sys-primary));color:var(--mtx-datetimepicker-calendar-date-selected-state-text-color, var(--mat-sys-on-primary))}.mtx-calendar-body-disabled>.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-body-selected.mtx-calendar-body-today{box-shadow:inset 0 0 0 1px var(--mtx-datetimepicker-calendar-date-today-selected-state-outline-color, var(--mat-sys-primary))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
225
|
+
}
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxCalendarBody, decorators: [{
|
|
227
|
+
type: Component,
|
|
228
|
+
args: [{ selector: '[mtx-calendar-body]', host: {
|
|
229
|
+
'class': 'mtx-calendar-body',
|
|
230
|
+
'role': 'grid',
|
|
231
|
+
'aria-readonly': 'true',
|
|
232
|
+
}, exportAs: 'mtxCalendarBody', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n@if (_firstRowOffset < labelMinRequiredCells) {\n <tr aria-hidden=\"true\">\n <td\n class=\"mtx-calendar-body-label\"\n [attr.colspan]=\"numCols\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n >\n {{ label }}\n </td>\n </tr>\n}\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n@for (row of rows; track _trackRow(row); let rowIndex = $index) {\n <tr role=\"row\">\n <!--\n This cell is purely decorative, but we can't put `aria-hidden` or `role=\"presentation\"` on it,\n because it throws off the week days for the rest of the row on NVDA. The aspect ratio of the\n table cells is maintained by setting the top and bottom padding as a percentage of the width\n (a variant of the trick described here: https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n @if (rowIndex === 0 && _firstRowOffset) {\n <td\n class=\"mtx-calendar-body-label\"\n [attr.colspan]=\"_firstRowOffset\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n >\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n }\n <!--\n Each gridcell in the calendar contains a button, which signals to assistive technology that the\n cell is interactable, as well as the selection state via `aria-pressed`. See #23476 for\n background.\n -->\n @for (item of row; track item.id; let colIndex = $index) {\n <td\n role=\"gridcell\"\n class=\"mtx-calendar-body-cell-container\"\n [style.width]=\"_cellWidth\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n >\n <button\n type=\"button\"\n class=\"mtx-calendar-body-cell\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mtx-calendar-body-disabled]=\"!item.enabled\"\n [class.mtx-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n (click)=\"_cellClicked(item)\"\n >\n <span\n class=\"mtx-calendar-body-cell-content mat-focus-indicator\"\n [class.mtx-calendar-body-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-today]=\"todayValue === item.value\"\n >\n {{ item.displayValue }}\n </span>\n </button>\n </td>\n }\n </tr>\n}\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-today-outline-color, var(--mat-sys-primary))}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding-left:4.7142857143%;padding-right:4.7142857143%;font-size:var(--mtx-datetimepicker-calendar-body-label-text-size, var(--mat-sys-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-body-label-text-weight, var(--mat-sys-title-small-weight));color:var(--mtx-datetimepicker-calendar-body-label-text-color, var(--mat-sys-on-surface))}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell-container{position:relative;height:0;line-height:0}.mtx-calendar-body-cell{position:absolute;top:0;left:0;width:100%;height:100%;background:none;text-align:center;font-family:inherit;margin:0;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-sys-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-sys-body-large-size));-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent}.mtx-calendar-body-cell::-moz-focus-inner{border:0}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-disabled>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-body-disabled>.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}@media (forced-colors: active){.mtx-calendar-body-disabled{opacity:.5}}.mtx-calendar-body-cell-content{top:5%;left:5%;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border:1px;border-style:solid;border-radius:999px;color:var(--mtx-datetimepicker-calendar-date-text-color, var(--mat-sys-on-surface));border-color:var(--mtx-datetimepicker-calendar-date-outline-color, transparent)}.mtx-calendar-body-cell-content.mat-focus-indicator{position:absolute}@media (forced-colors: active){.mtx-calendar-body-cell-content{border:none}}.cdk-keyboard-focused .mtx-calendar-body-active>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected),.cdk-program-focused .mtx-calendar-body-active>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-focus-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media (hover: hover){.mtx-calendar-body-cell:not(.mtx-calendar-body-disabled):hover>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}}.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-state-background-color, var(--mat-sys-primary));color:var(--mtx-datetimepicker-calendar-date-selected-state-text-color, var(--mat-sys-on-primary))}.mtx-calendar-body-disabled>.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-body-selected.mtx-calendar-body-today{box-shadow:inset 0 0 0 1px var(--mtx-datetimepicker-calendar-date-today-selected-state-outline-color, var(--mat-sys-primary))}\n"] }]
|
|
233
|
+
}], propDecorators: { label: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}], rows: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], cellAspectRatio: [{
|
|
238
|
+
type: Input
|
|
239
|
+
}], todayValue: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}], selectedValue: [{
|
|
242
|
+
type: Input
|
|
243
|
+
}], labelMinRequiredCells: [{
|
|
244
|
+
type: Input
|
|
245
|
+
}], numCols: [{
|
|
246
|
+
type: Input
|
|
247
|
+
}], allowDisabledSelection: [{
|
|
248
|
+
type: Input
|
|
249
|
+
}], activeCell: [{
|
|
250
|
+
type: Input
|
|
251
|
+
}], selectedValueChange: [{
|
|
252
|
+
type: Output
|
|
253
|
+
}] } });
|
|
254
|
+
|
|
255
|
+
const DAYS_PER_WEEK = 7;
|
|
256
|
+
let uniqueIdCounter = 0;
|
|
257
|
+
/**
|
|
258
|
+
* An internal component used to display a single month in the datetimepicker.
|
|
259
|
+
* @docs-private
|
|
260
|
+
*/
|
|
261
|
+
class MtxMonthView {
|
|
262
|
+
constructor() {
|
|
263
|
+
this._adapter = inject(DatetimeAdapter, { optional: true });
|
|
264
|
+
this._dir = inject(Directionality, { optional: true });
|
|
265
|
+
this._dateFormats = inject(MTX_DATETIME_FORMATS, { optional: true });
|
|
266
|
+
this.type = 'date';
|
|
267
|
+
/** Emits when a new date is selected. */
|
|
268
|
+
this.selectedChange = new EventEmitter();
|
|
269
|
+
/** Emits when any date is selected. */
|
|
270
|
+
this._userSelection = new EventEmitter();
|
|
271
|
+
/** Emits when any date is activated. */
|
|
272
|
+
this.activeDateChange = new EventEmitter();
|
|
273
|
+
/** The names of the weekdays. */
|
|
274
|
+
this._weekdays = [];
|
|
275
|
+
this._selected = null;
|
|
276
|
+
if (!this._adapter) {
|
|
277
|
+
throw createMissingDateImplError('DatetimeAdapter');
|
|
278
|
+
}
|
|
279
|
+
if (!this._dateFormats) {
|
|
280
|
+
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
281
|
+
}
|
|
282
|
+
this._activeDate = this._adapter.today();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The date to display in this month view (everything other than the month and year is ignored).
|
|
286
|
+
*/
|
|
287
|
+
get activeDate() {
|
|
288
|
+
return this._activeDate;
|
|
289
|
+
}
|
|
290
|
+
set activeDate(value) {
|
|
291
|
+
const oldActiveDate = this._activeDate;
|
|
292
|
+
this._activeDate = value || this._adapter.today();
|
|
293
|
+
if (oldActiveDate &&
|
|
294
|
+
this._activeDate &&
|
|
295
|
+
!this._adapter.sameMonthAndYear(oldActiveDate, this._activeDate)) {
|
|
296
|
+
this._init();
|
|
297
|
+
if (this._adapter.isInNextMonth(oldActiveDate, this._activeDate)) {
|
|
298
|
+
this.calendarState('right');
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.calendarState('left');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/** The currently selected date. */
|
|
306
|
+
get selected() {
|
|
307
|
+
return this._selected;
|
|
308
|
+
}
|
|
309
|
+
set selected(value) {
|
|
310
|
+
this._selected = value;
|
|
311
|
+
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
312
|
+
}
|
|
313
|
+
ngAfterContentInit() {
|
|
314
|
+
this._init();
|
|
315
|
+
}
|
|
316
|
+
/** Handles when a new date is selected. */
|
|
317
|
+
_dateSelected(date) {
|
|
318
|
+
const dateObject = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), date, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
319
|
+
this.selectedChange.emit(dateObject);
|
|
320
|
+
this._activeDate = dateObject;
|
|
321
|
+
if (this.type === 'date') {
|
|
322
|
+
this._userSelection.emit();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
_calendarStateDone() {
|
|
326
|
+
this._calendarState = '';
|
|
327
|
+
}
|
|
328
|
+
/** Initializes this month view. */
|
|
329
|
+
_init() {
|
|
330
|
+
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
331
|
+
this._todayDate = this._getDateInCurrentMonth(this._adapter.today());
|
|
332
|
+
const firstOfMonth = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
333
|
+
this._firstWeekOffset =
|
|
334
|
+
(DAYS_PER_WEEK +
|
|
335
|
+
this._adapter.getDayOfWeek(firstOfMonth) -
|
|
336
|
+
this._adapter.getFirstDayOfWeek()) %
|
|
337
|
+
DAYS_PER_WEEK;
|
|
338
|
+
this._initWeekdays();
|
|
339
|
+
this._createWeekCells();
|
|
340
|
+
}
|
|
341
|
+
/** Initializes the weekdays. */
|
|
342
|
+
_initWeekdays() {
|
|
343
|
+
const firstDayOfWeek = this._adapter.getFirstDayOfWeek();
|
|
344
|
+
const narrowWeekdays = this._adapter.getDayOfWeekNames('narrow');
|
|
345
|
+
const longWeekdays = this._adapter.getDayOfWeekNames('long');
|
|
346
|
+
// Rotate the labels for days of the week based on the configured first day of the week.
|
|
347
|
+
const weekdays = longWeekdays.map((long, i) => {
|
|
348
|
+
return { long, narrow: narrowWeekdays[i], id: uniqueIdCounter++ };
|
|
349
|
+
});
|
|
350
|
+
this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
|
|
351
|
+
}
|
|
352
|
+
/** Creates MdCalendarCells for the dates in this month. */
|
|
353
|
+
_createWeekCells() {
|
|
354
|
+
const daysInMonth = this._adapter.getNumDaysInMonth(this.activeDate);
|
|
355
|
+
const dateNames = this._adapter.getDateNames();
|
|
356
|
+
this._weeks = [[]];
|
|
357
|
+
for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
|
|
358
|
+
if (cell === DAYS_PER_WEEK) {
|
|
359
|
+
this._weeks.push([]);
|
|
360
|
+
cell = 0;
|
|
361
|
+
}
|
|
362
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), i + 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
363
|
+
const enabled = !this.dateFilter || this.dateFilter(date);
|
|
364
|
+
const ariaLabel = this._adapter.format(date, this._dateFormats.display.dateA11yLabel);
|
|
365
|
+
this._weeks[this._weeks.length - 1].push(new MtxCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Gets the date in this month that the given Date falls on.
|
|
370
|
+
* Returns null if the given Date is in another month.
|
|
371
|
+
*/
|
|
372
|
+
_getDateInCurrentMonth(date) {
|
|
373
|
+
return date && this._adapter.sameMonthAndYear(date, this.activeDate)
|
|
374
|
+
? this._adapter.getDate(date)
|
|
375
|
+
: null;
|
|
376
|
+
}
|
|
377
|
+
calendarState(direction) {
|
|
378
|
+
this._calendarState = direction;
|
|
379
|
+
}
|
|
380
|
+
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
381
|
+
_handleCalendarBodyKeydown(event) {
|
|
382
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
|
383
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
|
384
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
|
385
|
+
const oldActiveDate = this._activeDate;
|
|
386
|
+
const isRtl = this._isRtl();
|
|
387
|
+
switch (event.keyCode) {
|
|
388
|
+
case LEFT_ARROW:
|
|
389
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
|
|
390
|
+
break;
|
|
391
|
+
case RIGHT_ARROW:
|
|
392
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
|
|
393
|
+
break;
|
|
394
|
+
case UP_ARROW:
|
|
395
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, -7);
|
|
396
|
+
break;
|
|
397
|
+
case DOWN_ARROW:
|
|
398
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, 7);
|
|
399
|
+
break;
|
|
400
|
+
case HOME:
|
|
401
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, 1 - this._adapter.getDate(this._activeDate));
|
|
402
|
+
break;
|
|
403
|
+
case END:
|
|
404
|
+
this.activeDate = this._adapter.addCalendarDays(this._activeDate, this._adapter.getNumDaysInMonth(this._activeDate) -
|
|
405
|
+
this._adapter.getDate(this._activeDate));
|
|
406
|
+
break;
|
|
407
|
+
case PAGE_UP:
|
|
408
|
+
this.activeDate = event.altKey
|
|
409
|
+
? this._adapter.addCalendarYears(this._activeDate, -1)
|
|
410
|
+
: this._adapter.addCalendarMonths(this._activeDate, -1);
|
|
411
|
+
break;
|
|
412
|
+
case PAGE_DOWN:
|
|
413
|
+
this.activeDate = event.altKey
|
|
414
|
+
? this._adapter.addCalendarYears(this._activeDate, 1)
|
|
415
|
+
: this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
416
|
+
break;
|
|
417
|
+
case ENTER:
|
|
418
|
+
case SPACE:
|
|
419
|
+
if (!this.dateFilter || this.dateFilter(this._activeDate)) {
|
|
420
|
+
this._dateSelected(this._adapter.getDate(this._activeDate));
|
|
421
|
+
// this._userSelection.emit();
|
|
422
|
+
// Prevent unexpected default actions such as form submission.
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
}
|
|
425
|
+
return;
|
|
426
|
+
default:
|
|
427
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (this._adapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
431
|
+
this.activeDateChange.emit(this.activeDate);
|
|
480
432
|
}
|
|
481
|
-
|
|
433
|
+
this._focusActiveCell();
|
|
434
|
+
// Prevent unexpected default actions such as form submission.
|
|
435
|
+
event.preventDefault();
|
|
482
436
|
}
|
|
483
|
-
/**
|
|
484
|
-
|
|
437
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
|
438
|
+
_focusActiveCell(movePreview) {
|
|
439
|
+
this._mtxCalendarBody._focusActiveCell(movePreview);
|
|
440
|
+
}
|
|
441
|
+
/** Determines whether the user has the RTL layout direction. */
|
|
442
|
+
_isRtl() {
|
|
443
|
+
return this._dir && this._dir.value === 'rtl';
|
|
444
|
+
}
|
|
445
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxMonthView, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
446
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxMonthView, isStandalone: true, selector: "mtx-month-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_mtxCalendarBody", first: true, predicate: MtxCalendarBody, descendants: true }], exportAs: ["mtxMonthView"], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track day.id) {\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n }\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n", dependencies: [{ kind: "component", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "cellAspectRatio", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
485
447
|
}
|
|
486
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxMonthView, decorators: [{
|
|
487
449
|
type: Component,
|
|
488
|
-
args: [{ selector: '[mtx-calendar-body]
|
|
489
|
-
|
|
490
|
-
}, exportAs: 'mtxCalendarBody', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n@if (_firstRowOffset < labelMinRequiredCells) {\n <tr aria-hidden=\"true\">\n <td class=\"mtx-calendar-body-label\" [attr.colspan]=\"numCols\">{{ label }}</td>\n </tr>\n}\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n@for (row of rows; track row; let rowIndex = $index) {\n <tr role=\"row\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n -->\n @if (rowIndex === 0 && _firstRowOffset) {\n <td\n class=\"mtx-calendar-body-label\" [attr.colspan]=\"_firstRowOffset\" aria-hidden=\"true\">\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n }\n @for (item of row; track item; let colIndex = $index) {\n <td\n role=\"gridcell\"\n class=\"mtx-calendar-body-cell\"\n [class.mtx-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mtx-calendar-body-disabled]=\"!item.enabled\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n (click)=\"_cellClicked(item)\">\n <div class=\"mtx-calendar-body-cell-content\"\n [class.mtx-calendar-body-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-today]=\"todayValue === item.value\"\n [attr.aria-selected]=\"selectedValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n }\n </tr>\n}\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-today-outline-color, var(--mat-app-primary))}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%;font-size:var(--mtx-datetimepicker-calendar-body-label-text-size, var(--mat-app-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-body-label-text-weight, var(--mat-app-title-small-weight));color:var(--mtx-datetimepicker-calendar-body-label-text-color, var(--mat-app-on-surface))}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:7.1428571429% 0;text-align:center;outline:none;cursor:pointer}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-disabled>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color)}.mtx-calendar-body-disabled>.mtx-calendar-body-today:not(.mtx-calendar-body-selected){border-color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color)}.mtx-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;color:var(--mtx-datetimepicker-calendar-date-text-color, var(--mat-app-on-surface));border-color:var(--mtx-datetimepicker-calendar-date-outline-color)}.mtx-calendar-body-active>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-focus-state-background-color)}@media (hover: hover){.mtx-calendar-body-cell:not(.mtx-calendar-body-disabled):hover>.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected){background-color:var(--mtx-datetimepicker-calendar-date-hover-state-background-color)}}.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-state-background-color, var(--mat-app-primary));color:var(--mtx-datetimepicker-calendar-date-selected-state-text-color, var(--mat-app-on-primary))}.mtx-calendar-body-disabled>.mtx-calendar-body-selected{background-color:var(--mtx-datetimepicker-calendar-date-selected-disabled-state-background-color)}.mtx-calendar-body-selected.mtx-calendar-body-today{box-shadow:inset 0 0 0 1px var(--mtx-datetimepicker-calendar-date-today-selected-state-outline-color, var(--mat-app-primary))}\n"] }]
|
|
491
|
-
}], propDecorators: { label: [{
|
|
492
|
-
type: Input
|
|
493
|
-
}], rows: [{
|
|
494
|
-
type: Input
|
|
495
|
-
}], todayValue: [{
|
|
450
|
+
args: [{ selector: 'mtx-month-view', exportAs: 'mtxMonthView', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MtxCalendarBody], template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track day.id) {\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n }\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n" }]
|
|
451
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
496
452
|
type: Input
|
|
497
|
-
}],
|
|
498
|
-
type: Input
|
|
499
|
-
}], labelMinRequiredCells: [{
|
|
500
|
-
type: Input
|
|
501
|
-
}], numCols: [{
|
|
453
|
+
}], dateFilter: [{
|
|
502
454
|
type: Input
|
|
503
|
-
}],
|
|
455
|
+
}], selectedChange: [{
|
|
456
|
+
type: Output
|
|
457
|
+
}], _userSelection: [{
|
|
458
|
+
type: Output
|
|
459
|
+
}], activeDateChange: [{
|
|
460
|
+
type: Output
|
|
461
|
+
}], _mtxCalendarBody: [{
|
|
462
|
+
type: ViewChild,
|
|
463
|
+
args: [MtxCalendarBody]
|
|
464
|
+
}], activeDate: [{
|
|
504
465
|
type: Input
|
|
505
|
-
}],
|
|
466
|
+
}], selected: [{
|
|
506
467
|
type: Input
|
|
507
|
-
}], selectedValueChange: [{
|
|
508
|
-
type: Output
|
|
509
468
|
}] } });
|
|
510
469
|
|
|
511
|
-
const
|
|
470
|
+
const yearsPerPage = 24;
|
|
471
|
+
const yearsPerRow = 4;
|
|
512
472
|
/**
|
|
513
|
-
* An internal component used to display
|
|
473
|
+
* An internal component used to display multiple years in the datetimepicker.
|
|
514
474
|
* @docs-private
|
|
515
475
|
*/
|
|
516
|
-
class
|
|
517
|
-
constructor(
|
|
518
|
-
this._adapter =
|
|
519
|
-
this.
|
|
476
|
+
class MtxMultiYearView {
|
|
477
|
+
constructor() {
|
|
478
|
+
this._adapter = inject(DatetimeAdapter, { optional: true });
|
|
479
|
+
this._dir = inject(Directionality, { optional: true });
|
|
480
|
+
this._dateFormats = inject(MTX_DATETIME_FORMATS, { optional: true });
|
|
520
481
|
this.type = 'date';
|
|
521
|
-
/** Emits when a new
|
|
482
|
+
/** Emits when a new month is selected. */
|
|
522
483
|
this.selectedChange = new EventEmitter();
|
|
523
484
|
/** Emits when any date is selected. */
|
|
524
485
|
this._userSelection = new EventEmitter();
|
|
486
|
+
/** Emits when any date is activated. */
|
|
487
|
+
this.activeDateChange = new EventEmitter();
|
|
488
|
+
this._selected = null;
|
|
525
489
|
if (!this._adapter) {
|
|
526
490
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
527
491
|
}
|
|
528
492
|
if (!this._dateFormats) {
|
|
529
493
|
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
530
494
|
}
|
|
531
|
-
const firstDayOfWeek = this._adapter.getFirstDayOfWeek();
|
|
532
|
-
const narrowWeekdays = this._adapter.getDayOfWeekNames('narrow');
|
|
533
|
-
const longWeekdays = this._adapter.getDayOfWeekNames('long');
|
|
534
|
-
// Rotate the labels for days of the week based on the configured first day of the week.
|
|
535
|
-
const weekdays = longWeekdays.map((long, i) => {
|
|
536
|
-
return { long, narrow: narrowWeekdays[i] };
|
|
537
|
-
});
|
|
538
|
-
this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
|
|
539
495
|
this._activeDate = this._adapter.today();
|
|
540
496
|
}
|
|
541
|
-
/**
|
|
542
|
-
* The date to display in this month view (everything other than the month and year is ignored).
|
|
543
|
-
*/
|
|
497
|
+
/** The date to display in this multi year view */
|
|
544
498
|
get activeDate() {
|
|
545
499
|
return this._activeDate;
|
|
546
500
|
}
|
|
@@ -549,14 +503,8 @@ class MtxMonthView {
|
|
|
549
503
|
this._activeDate = value || this._adapter.today();
|
|
550
504
|
if (oldActiveDate &&
|
|
551
505
|
this._activeDate &&
|
|
552
|
-
!this._adapter
|
|
506
|
+
!isSameMultiYearView(this._adapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
|
|
553
507
|
this._init();
|
|
554
|
-
if (this._adapter.isInNextMonth(oldActiveDate, this._activeDate)) {
|
|
555
|
-
this.calendarState('right');
|
|
556
|
-
}
|
|
557
|
-
else {
|
|
558
|
-
this.calendarState('left');
|
|
559
|
-
}
|
|
560
508
|
}
|
|
561
509
|
}
|
|
562
510
|
/** The currently selected date. */
|
|
@@ -565,123 +513,279 @@ class MtxMonthView {
|
|
|
565
513
|
}
|
|
566
514
|
set selected(value) {
|
|
567
515
|
this._selected = value;
|
|
568
|
-
this.
|
|
516
|
+
this._selectedYear = this._selected && this._adapter.getYear(this._selected);
|
|
517
|
+
}
|
|
518
|
+
/** The minimum selectable date. */
|
|
519
|
+
get minDate() {
|
|
520
|
+
return this._minDate;
|
|
521
|
+
}
|
|
522
|
+
set minDate(value) {
|
|
523
|
+
this._minDate = this._getValidDateOrNull(this._adapter.deserialize(value));
|
|
524
|
+
}
|
|
525
|
+
/** The maximum selectable date. */
|
|
526
|
+
get maxDate() {
|
|
527
|
+
return this._maxDate;
|
|
528
|
+
}
|
|
529
|
+
set maxDate(value) {
|
|
530
|
+
this._maxDate = this._getValidDateOrNull(this._adapter.deserialize(value));
|
|
569
531
|
}
|
|
570
532
|
ngAfterContentInit() {
|
|
571
533
|
this._init();
|
|
572
534
|
}
|
|
573
|
-
/** Handles when a new
|
|
574
|
-
|
|
575
|
-
const
|
|
535
|
+
/** Handles when a new year is selected. */
|
|
536
|
+
_yearSelected(year) {
|
|
537
|
+
const month = this._adapter.getMonth(this.activeDate);
|
|
538
|
+
const normalizedDate = this._adapter.createDatetime(year, month, 1, 0, 0);
|
|
539
|
+
const dateObject = this._adapter.createDatetime(year, month, Math.min(this._adapter.getDate(this.activeDate), this._adapter.getNumDaysInMonth(normalizedDate)), this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
576
540
|
this.selectedChange.emit(dateObject);
|
|
577
541
|
this._activeDate = dateObject;
|
|
578
|
-
if (this.type === '
|
|
542
|
+
if (this.type === 'year') {
|
|
579
543
|
this._userSelection.emit();
|
|
580
544
|
}
|
|
581
545
|
}
|
|
582
|
-
|
|
583
|
-
this.
|
|
546
|
+
_getActiveCell() {
|
|
547
|
+
return getActiveOffset(this._adapter, this.activeDate, this.minDate, this.maxDate);
|
|
584
548
|
}
|
|
585
|
-
/** Initializes this
|
|
549
|
+
/** Initializes this year view. */
|
|
586
550
|
_init() {
|
|
587
|
-
this.
|
|
588
|
-
this.
|
|
589
|
-
const
|
|
590
|
-
this.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
551
|
+
this._todayYear = this._adapter.getYear(this._adapter.today());
|
|
552
|
+
this._yearLabel = this._adapter.getYearName(this.activeDate);
|
|
553
|
+
const activeYear = this._adapter.getYear(this.activeDate);
|
|
554
|
+
const minYearOfPage = activeYear - getActiveOffset(this._adapter, this.activeDate, this.minDate, this.maxDate);
|
|
555
|
+
this._years = [];
|
|
556
|
+
for (let i = 0, row = []; i < yearsPerPage; i++) {
|
|
557
|
+
row.push(minYearOfPage + i);
|
|
558
|
+
if (row.length === yearsPerRow) {
|
|
559
|
+
this._years.push(row.map(year => this._createCellForYear(year)));
|
|
560
|
+
row = [];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
596
563
|
}
|
|
597
|
-
/** Creates
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
564
|
+
/** Creates an MtxCalendarCell for the given year. */
|
|
565
|
+
_createCellForYear(year) {
|
|
566
|
+
const yearName = this._adapter.getYearName(this._adapter.createDate(year, 0, 1));
|
|
567
|
+
return new MtxCalendarCell(year, yearName, yearName, this._shouldEnableYear(year));
|
|
568
|
+
}
|
|
569
|
+
/** Whether the given year is enabled. */
|
|
570
|
+
_shouldEnableYear(year) {
|
|
571
|
+
// disable if the year is greater than maxDate lower than minDate
|
|
572
|
+
if (year === undefined ||
|
|
573
|
+
year === null ||
|
|
574
|
+
(this.maxDate && year > this._adapter.getYear(this.maxDate)) ||
|
|
575
|
+
(this.minDate && year < this._adapter.getYear(this.minDate))) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
// enable if it reaches here and there's no filter defined
|
|
579
|
+
if (!this.dateFilter) {
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
const firstOfYear = this._adapter.createDate(year, 0, 1);
|
|
583
|
+
// If any date in the year is enabled count the year as enabled.
|
|
584
|
+
for (let date = firstOfYear; this._adapter.getYear(date) === year; date = this._adapter.addCalendarDays(date, 1)) {
|
|
585
|
+
if (this.dateFilter(date)) {
|
|
586
|
+
return true;
|
|
606
587
|
}
|
|
607
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), i + 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
608
|
-
const enabled = !this.dateFilter || this.dateFilter(date);
|
|
609
|
-
const ariaLabel = this._adapter.format(date, this._dateFormats.display.dateA11yLabel);
|
|
610
|
-
this._weeks[this._weeks.length - 1].push(new MtxCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));
|
|
611
588
|
}
|
|
589
|
+
return false;
|
|
612
590
|
}
|
|
613
591
|
/**
|
|
614
|
-
*
|
|
615
|
-
*
|
|
592
|
+
* @param obj The object to check.
|
|
593
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
|
616
594
|
*/
|
|
617
|
-
|
|
618
|
-
return this._adapter.
|
|
619
|
-
|
|
620
|
-
|
|
595
|
+
_getValidDateOrNull(obj) {
|
|
596
|
+
return this._adapter.isDateInstance(obj) && this._adapter.isValid(obj) ? obj : null;
|
|
597
|
+
}
|
|
598
|
+
/** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
|
599
|
+
_handleCalendarBodyKeydown(event) {
|
|
600
|
+
const oldActiveDate = this._activeDate;
|
|
601
|
+
const isRtl = this._isRtl();
|
|
602
|
+
switch (event.keyCode) {
|
|
603
|
+
case LEFT_ARROW:
|
|
604
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
|
|
605
|
+
break;
|
|
606
|
+
case RIGHT_ARROW:
|
|
607
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
|
|
608
|
+
break;
|
|
609
|
+
case UP_ARROW:
|
|
610
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, -yearsPerRow);
|
|
611
|
+
break;
|
|
612
|
+
case DOWN_ARROW:
|
|
613
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerRow);
|
|
614
|
+
break;
|
|
615
|
+
case HOME:
|
|
616
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, -getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate));
|
|
617
|
+
break;
|
|
618
|
+
case END:
|
|
619
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerPage -
|
|
620
|
+
getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate) -
|
|
621
|
+
1);
|
|
622
|
+
break;
|
|
623
|
+
case PAGE_UP:
|
|
624
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
625
|
+
break;
|
|
626
|
+
case PAGE_DOWN:
|
|
627
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
628
|
+
break;
|
|
629
|
+
case ENTER:
|
|
630
|
+
case SPACE:
|
|
631
|
+
this._yearSelected(this._adapter.getYear(this._activeDate));
|
|
632
|
+
break;
|
|
633
|
+
default:
|
|
634
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
if (this._adapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
638
|
+
this.activeDateChange.emit(this.activeDate);
|
|
639
|
+
}
|
|
640
|
+
this._focusActiveCell();
|
|
641
|
+
// Prevent unexpected default actions such as form submission.
|
|
642
|
+
event.preventDefault();
|
|
643
|
+
}
|
|
644
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
|
645
|
+
_focusActiveCell() {
|
|
646
|
+
this._mtxCalendarBody._focusActiveCell();
|
|
647
|
+
}
|
|
648
|
+
/** Determines whether the user has the RTL layout direction. */
|
|
649
|
+
_isRtl() {
|
|
650
|
+
return this._dir && this._dir.value === 'rtl';
|
|
651
|
+
}
|
|
652
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxMultiYearView, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
653
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: MtxMultiYearView, isStandalone: true, selector: "mtx-multi-year-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_mtxCalendarBody", first: true, predicate: MtxCalendarBody, descendants: true }], exportAs: ["mtxMultiYearView"], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n [allowDisabledSelection]=\"true\"\n [selectedValue]=\"_selectedYear!\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n", dependencies: [{ kind: "component", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "cellAspectRatio", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
654
|
+
}
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxMultiYearView, decorators: [{
|
|
656
|
+
type: Component,
|
|
657
|
+
args: [{ selector: 'mtx-multi-year-view', exportAs: 'mtxMultiYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MtxCalendarBody], template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n [allowDisabledSelection]=\"true\"\n [selectedValue]=\"_selectedYear!\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n" }]
|
|
658
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
659
|
+
type: Input
|
|
660
|
+
}], dateFilter: [{
|
|
661
|
+
type: Input
|
|
662
|
+
}], selectedChange: [{
|
|
663
|
+
type: Output
|
|
664
|
+
}], _userSelection: [{
|
|
665
|
+
type: Output
|
|
666
|
+
}], activeDateChange: [{
|
|
667
|
+
type: Output
|
|
668
|
+
}], _mtxCalendarBody: [{
|
|
669
|
+
type: ViewChild,
|
|
670
|
+
args: [MtxCalendarBody]
|
|
671
|
+
}], activeDate: [{
|
|
672
|
+
type: Input
|
|
673
|
+
}], selected: [{
|
|
674
|
+
type: Input
|
|
675
|
+
}], minDate: [{
|
|
676
|
+
type: Input
|
|
677
|
+
}], maxDate: [{
|
|
678
|
+
type: Input
|
|
679
|
+
}] } });
|
|
680
|
+
function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
|
|
681
|
+
const year1 = dateAdapter.getYear(date1);
|
|
682
|
+
const year2 = dateAdapter.getYear(date2);
|
|
683
|
+
const startingYear = getStartingYear(dateAdapter, minDate, maxDate);
|
|
684
|
+
return (Math.floor((year1 - startingYear) / yearsPerPage) ===
|
|
685
|
+
Math.floor((year2 - startingYear) / yearsPerPage));
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* When the multi-year view is first opened, the active year will be in view.
|
|
689
|
+
* So we compute how many years are between the active year and the *slot* where our
|
|
690
|
+
* "startingYear" will render when paged into view.
|
|
691
|
+
*/
|
|
692
|
+
function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
|
|
693
|
+
const activeYear = dateAdapter.getYear(activeDate);
|
|
694
|
+
return euclideanModulo(activeYear - getStartingYear(dateAdapter, minDate, maxDate), yearsPerPage);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* We pick a "starting" year such that either the maximum year would be at the end
|
|
698
|
+
* or the minimum year would be at the beginning of a page.
|
|
699
|
+
*/
|
|
700
|
+
function getStartingYear(dateAdapter, minDate, maxDate) {
|
|
701
|
+
let startingYear = 0;
|
|
702
|
+
if (maxDate) {
|
|
703
|
+
const maxYear = dateAdapter.getYear(maxDate);
|
|
704
|
+
startingYear = maxYear - yearsPerPage + 1;
|
|
621
705
|
}
|
|
622
|
-
|
|
623
|
-
|
|
706
|
+
else if (minDate) {
|
|
707
|
+
startingYear = dateAdapter.getYear(minDate);
|
|
624
708
|
}
|
|
625
|
-
|
|
626
|
-
|
|
709
|
+
return startingYear;
|
|
710
|
+
}
|
|
711
|
+
/** Gets remainder that is non-negative, even if first number is negative */
|
|
712
|
+
function euclideanModulo(a, b) {
|
|
713
|
+
return ((a % b) + b) % b;
|
|
627
714
|
}
|
|
628
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: MtxMonthView, decorators: [{
|
|
629
|
-
type: Component,
|
|
630
|
-
args: [{ selector: 'mtx-month-view', exportAs: 'mtxMonthView', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MtxCalendarBody], template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track day) {\n <th [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n }\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"></tbody>\n</table>\n" }]
|
|
631
|
-
}], ctorParameters: () => [{ type: i1.DatetimeAdapter, decorators: [{
|
|
632
|
-
type: Optional
|
|
633
|
-
}] }, { type: undefined, decorators: [{
|
|
634
|
-
type: Optional
|
|
635
|
-
}, {
|
|
636
|
-
type: Inject,
|
|
637
|
-
args: [MTX_DATETIME_FORMATS]
|
|
638
|
-
}] }], propDecorators: { type: [{
|
|
639
|
-
type: Input
|
|
640
|
-
}], dateFilter: [{
|
|
641
|
-
type: Input
|
|
642
|
-
}], selectedChange: [{
|
|
643
|
-
type: Output
|
|
644
|
-
}], _userSelection: [{
|
|
645
|
-
type: Output
|
|
646
|
-
}], activeDate: [{
|
|
647
|
-
type: Input
|
|
648
|
-
}], selected: [{
|
|
649
|
-
type: Input
|
|
650
|
-
}] } });
|
|
651
715
|
|
|
652
|
-
const
|
|
653
|
-
const
|
|
716
|
+
const activeEventOptions = normalizePassiveListenerOptions({ passive: false });
|
|
717
|
+
const CLOCK_RADIUS = 50;
|
|
718
|
+
const CLOCK_INNER_RADIUS = 27.5;
|
|
719
|
+
const CLOCK_OUTER_RADIUS = 41.25;
|
|
720
|
+
const CLOCK_TICK_RADIUS = 7.0833;
|
|
654
721
|
/**
|
|
655
|
-
*
|
|
722
|
+
* A clock that is used as part of the datetimepicker.
|
|
656
723
|
* @docs-private
|
|
657
724
|
*/
|
|
658
|
-
class
|
|
659
|
-
constructor(
|
|
660
|
-
this.
|
|
661
|
-
this.
|
|
662
|
-
this.
|
|
663
|
-
|
|
725
|
+
class MtxClock {
|
|
726
|
+
constructor() {
|
|
727
|
+
this._elementRef = inject(ElementRef);
|
|
728
|
+
this._adapter = inject(DatetimeAdapter);
|
|
729
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
730
|
+
this._document = inject(DOCUMENT);
|
|
731
|
+
/** Step over minutes. */
|
|
732
|
+
this.interval = 1;
|
|
733
|
+
this.actionButtons = false;
|
|
734
|
+
/** Whether the clock uses 12 hour format. */
|
|
735
|
+
this.twelvehour = false;
|
|
736
|
+
/** Whether the time is now in AM or PM. */
|
|
737
|
+
this.AMPM = 'AM';
|
|
738
|
+
/** Emits when the currently selected date changes. */
|
|
664
739
|
this.selectedChange = new EventEmitter();
|
|
740
|
+
/** Emits when any date is activated. */
|
|
741
|
+
this.activeDateChange = new EventEmitter();
|
|
665
742
|
/** Emits when any date is selected. */
|
|
666
743
|
this._userSelection = new EventEmitter();
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
this.
|
|
744
|
+
/** Whether the clock is in hour view. */
|
|
745
|
+
this._hourView = true;
|
|
746
|
+
this._hours = [];
|
|
747
|
+
this._minutes = [];
|
|
748
|
+
this._timeChanged = false;
|
|
749
|
+
/** Called when the user has put their pointer down on the clock. */
|
|
750
|
+
this._pointerDown = (event) => {
|
|
751
|
+
this._timeChanged = false;
|
|
752
|
+
this.setTime(event);
|
|
753
|
+
this._bindGlobalEvents(event);
|
|
754
|
+
};
|
|
755
|
+
/**
|
|
756
|
+
* Called when the user has moved their pointer after
|
|
757
|
+
* starting to drag. Bound on the document level.
|
|
758
|
+
*/
|
|
759
|
+
this._pointerMove = (event) => {
|
|
760
|
+
if (event.cancelable) {
|
|
761
|
+
event.preventDefault();
|
|
762
|
+
}
|
|
763
|
+
this.setTime(event);
|
|
764
|
+
};
|
|
765
|
+
/** Called when the user has lifted their pointer. Bound on the document level. */
|
|
766
|
+
this._pointerUp = (event) => {
|
|
767
|
+
if (event.cancelable) {
|
|
768
|
+
event.preventDefault();
|
|
769
|
+
}
|
|
770
|
+
this._removeGlobalEvents();
|
|
771
|
+
if (this._timeChanged) {
|
|
772
|
+
this.selectedChange.emit(this.activeDate);
|
|
773
|
+
if (this.actionButtons || !this._hourView) {
|
|
774
|
+
this._userSelection.emit();
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
};
|
|
674
778
|
}
|
|
675
|
-
/**
|
|
779
|
+
/**
|
|
780
|
+
* The date to display in this clock view.
|
|
781
|
+
*/
|
|
676
782
|
get activeDate() {
|
|
677
783
|
return this._activeDate;
|
|
678
784
|
}
|
|
679
785
|
set activeDate(value) {
|
|
680
786
|
const oldActiveDate = this._activeDate;
|
|
681
|
-
this._activeDate = value
|
|
682
|
-
if (oldActiveDate
|
|
683
|
-
this._activeDate &&
|
|
684
|
-
!isSameMultiYearView(this._adapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
|
|
787
|
+
this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
788
|
+
if (!this._adapter.sameMinute(oldActiveDate, this._activeDate)) {
|
|
685
789
|
this._init();
|
|
686
790
|
}
|
|
687
791
|
}
|
|
@@ -690,126 +794,245 @@ class MtxMultiYearView {
|
|
|
690
794
|
return this._selected;
|
|
691
795
|
}
|
|
692
796
|
set selected(value) {
|
|
693
|
-
this._selected = value;
|
|
694
|
-
|
|
797
|
+
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
798
|
+
if (this._selected) {
|
|
799
|
+
this.activeDate = this._selected;
|
|
800
|
+
}
|
|
695
801
|
}
|
|
696
802
|
/** The minimum selectable date. */
|
|
697
803
|
get minDate() {
|
|
698
804
|
return this._minDate;
|
|
699
805
|
}
|
|
700
806
|
set minDate(value) {
|
|
701
|
-
this._minDate = this.
|
|
807
|
+
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
702
808
|
}
|
|
703
809
|
/** The maximum selectable date. */
|
|
704
810
|
get maxDate() {
|
|
705
811
|
return this._maxDate;
|
|
706
812
|
}
|
|
707
813
|
set maxDate(value) {
|
|
708
|
-
this._maxDate = this.
|
|
814
|
+
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
815
|
+
}
|
|
816
|
+
/** Whether the clock should be started in hour or minute view. */
|
|
817
|
+
set startView(value) {
|
|
818
|
+
this._hourView = value !== 'minute';
|
|
819
|
+
}
|
|
820
|
+
get _hand() {
|
|
821
|
+
const hour = this._adapter.getHour(this.activeDate);
|
|
822
|
+
this._selectedHour = hour;
|
|
823
|
+
this._selectedMinute = this._adapter.getMinute(this.activeDate);
|
|
824
|
+
let deg = 0;
|
|
825
|
+
let radius = CLOCK_OUTER_RADIUS;
|
|
826
|
+
if (this._hourView) {
|
|
827
|
+
const outer = this._selectedHour > 0 && this._selectedHour < 13;
|
|
828
|
+
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
829
|
+
if (this.twelvehour) {
|
|
830
|
+
radius = CLOCK_OUTER_RADIUS;
|
|
831
|
+
}
|
|
832
|
+
deg = Math.round(this._selectedHour * (360 / (24 / 2)));
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
deg = Math.round(this._selectedMinute * (360 / 60));
|
|
836
|
+
}
|
|
837
|
+
return {
|
|
838
|
+
height: `${radius}%`,
|
|
839
|
+
marginTop: `${50 - radius}%`,
|
|
840
|
+
transform: `rotate(${deg}deg)`,
|
|
841
|
+
};
|
|
709
842
|
}
|
|
710
843
|
ngAfterContentInit() {
|
|
844
|
+
this.activeDate = this._activeDate || this._adapter.today();
|
|
711
845
|
this._init();
|
|
712
846
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
const month = this._adapter.getMonth(this.activeDate);
|
|
716
|
-
const normalizedDate = this._adapter.createDatetime(year, month, 1, 0, 0);
|
|
717
|
-
const dateObject = this._adapter.createDatetime(year, month, Math.min(this._adapter.getDate(this.activeDate), this._adapter.getNumDaysInMonth(normalizedDate)), this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
718
|
-
this.selectedChange.emit(dateObject);
|
|
719
|
-
this._activeDate = dateObject;
|
|
720
|
-
if (this.type === 'year') {
|
|
721
|
-
this._userSelection.emit();
|
|
722
|
-
}
|
|
847
|
+
ngOnDestroy() {
|
|
848
|
+
this._removeGlobalEvents();
|
|
723
849
|
}
|
|
724
|
-
|
|
725
|
-
|
|
850
|
+
ngOnChanges() {
|
|
851
|
+
this._init();
|
|
726
852
|
}
|
|
727
|
-
|
|
728
|
-
|
|
853
|
+
/** Binds our global move and end events. */
|
|
854
|
+
_bindGlobalEvents(triggerEvent) {
|
|
855
|
+
// Note that we bind the events to the `document`, because it allows us to capture
|
|
856
|
+
// drag cancel events where the user's pointer is outside the browser window.
|
|
857
|
+
const document = this._document;
|
|
858
|
+
const isTouch = isTouchEvent(triggerEvent);
|
|
859
|
+
const moveEventName = isTouch ? 'touchmove' : 'mousemove';
|
|
860
|
+
const endEventName = isTouch ? 'touchend' : 'mouseup';
|
|
861
|
+
document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
|
|
862
|
+
document.addEventListener(endEventName, this._pointerUp, activeEventOptions);
|
|
863
|
+
if (isTouch) {
|
|
864
|
+
document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
865
|
+
}
|
|
729
866
|
}
|
|
730
|
-
/**
|
|
867
|
+
/** Removes any global event listeners that we may have added. */
|
|
868
|
+
_removeGlobalEvents() {
|
|
869
|
+
const document = this._document;
|
|
870
|
+
document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
|
|
871
|
+
document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
|
|
872
|
+
document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
|
|
873
|
+
document.removeEventListener('touchend', this._pointerUp, activeEventOptions);
|
|
874
|
+
document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
875
|
+
}
|
|
876
|
+
/** Initializes this clock view. */
|
|
731
877
|
_init() {
|
|
732
|
-
this.
|
|
733
|
-
this.
|
|
734
|
-
const
|
|
735
|
-
const
|
|
736
|
-
this.
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
878
|
+
this._hours.length = 0;
|
|
879
|
+
this._minutes.length = 0;
|
|
880
|
+
const hourNames = this._adapter.getHourNames();
|
|
881
|
+
const minuteNames = this._adapter.getMinuteNames();
|
|
882
|
+
if (this.twelvehour) {
|
|
883
|
+
const hours = [];
|
|
884
|
+
for (let i = 0; i < hourNames.length; i++) {
|
|
885
|
+
const radian = (i / 6) * Math.PI;
|
|
886
|
+
const radius = CLOCK_OUTER_RADIUS;
|
|
887
|
+
const hour = i;
|
|
888
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), hour, 0);
|
|
889
|
+
// Check if the date is enabled, no need to respect the minute setting here
|
|
890
|
+
const enabled = (!this.minDate ||
|
|
891
|
+
this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
|
|
892
|
+
(!this.maxDate ||
|
|
893
|
+
this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
|
|
894
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
|
|
895
|
+
// display value for twelvehour clock should be from 1-12 not including 0 and not above 12
|
|
896
|
+
hours.push({
|
|
897
|
+
value: i,
|
|
898
|
+
displayValue: i % 12 === 0 ? '12' : hourNames[i % 12],
|
|
899
|
+
enabled,
|
|
900
|
+
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
901
|
+
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
// filter out AM or PM hours based on AMPM
|
|
905
|
+
if (this.AMPM === 'AM') {
|
|
906
|
+
this._hours = hours.filter(x => x.value < 12);
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
this._hours = hours.filter(x => x.value >= 12);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
for (let i = 0; i < hourNames.length; i++) {
|
|
914
|
+
const radian = (i / 6) * Math.PI;
|
|
915
|
+
const outer = i > 0 && i < 13;
|
|
916
|
+
const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
917
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i, 0);
|
|
918
|
+
// Check if the date is enabled, no need to respect the minute setting here
|
|
919
|
+
const enabled = (!this.minDate ||
|
|
920
|
+
this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
|
|
921
|
+
(!this.maxDate ||
|
|
922
|
+
this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
|
|
923
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
|
|
924
|
+
this._hours.push({
|
|
925
|
+
value: i,
|
|
926
|
+
displayValue: i === 0 ? '00' : hourNames[i],
|
|
927
|
+
enabled,
|
|
928
|
+
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
929
|
+
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
930
|
+
fontSize: i > 0 && i < 13 ? '' : '80%',
|
|
931
|
+
});
|
|
742
932
|
}
|
|
743
933
|
}
|
|
934
|
+
for (let i = 0; i < minuteNames.length; i += 5) {
|
|
935
|
+
const radian = (i / 30) * Math.PI;
|
|
936
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), i);
|
|
937
|
+
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
938
|
+
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0) &&
|
|
939
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.MINUTE));
|
|
940
|
+
this._minutes.push({
|
|
941
|
+
value: i,
|
|
942
|
+
displayValue: i === 0 ? '00' : minuteNames[i],
|
|
943
|
+
enabled,
|
|
944
|
+
top: CLOCK_RADIUS - Math.cos(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
945
|
+
left: CLOCK_RADIUS + Math.sin(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
946
|
+
});
|
|
947
|
+
}
|
|
744
948
|
}
|
|
745
|
-
/**
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
949
|
+
/**
|
|
950
|
+
* Set Time
|
|
951
|
+
* @param event
|
|
952
|
+
*/
|
|
953
|
+
setTime(event) {
|
|
954
|
+
const trigger = this._elementRef.nativeElement;
|
|
955
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
956
|
+
const width = trigger.offsetWidth;
|
|
957
|
+
const height = trigger.offsetHeight;
|
|
958
|
+
const { pageX, pageY } = getPointerPositionOnPage(event);
|
|
959
|
+
const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
|
|
960
|
+
const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
|
|
961
|
+
let radian = Math.atan2(-x, y);
|
|
962
|
+
const unit = Math.PI / (this._hourView ? 6 : this.interval ? 30 / this.interval : 30);
|
|
963
|
+
const z = Math.sqrt(x * x + y * y);
|
|
964
|
+
const outer = this._hourView &&
|
|
965
|
+
z > (width * (CLOCK_OUTER_RADIUS / 100) + width * (CLOCK_INNER_RADIUS / 100)) / 2;
|
|
966
|
+
if (radian < 0) {
|
|
967
|
+
radian = Math.PI * 2 + radian;
|
|
758
968
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
969
|
+
let value = Math.round(radian / unit);
|
|
970
|
+
let date;
|
|
971
|
+
if (this._hourView) {
|
|
972
|
+
if (this.twelvehour) {
|
|
973
|
+
if (this.AMPM === 'AM') {
|
|
974
|
+
value = value === 0 ? 12 : value;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
// if we chosen 12 in PM, the value should be 0 for 0:00,
|
|
978
|
+
// else we can safely add 12 to the final value
|
|
979
|
+
value = value === 12 ? 0 : value + 12;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
if (value === 12) {
|
|
984
|
+
value = 0;
|
|
985
|
+
}
|
|
986
|
+
value = outer ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
|
|
987
|
+
}
|
|
988
|
+
date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), value, this._adapter.getMinute(this.activeDate));
|
|
762
989
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
if (this.dateFilter(date)) {
|
|
767
|
-
return true;
|
|
990
|
+
else {
|
|
991
|
+
if (this.interval) {
|
|
992
|
+
value *= this.interval;
|
|
768
993
|
}
|
|
994
|
+
if (value === 60) {
|
|
995
|
+
value = 0;
|
|
996
|
+
}
|
|
997
|
+
date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), value);
|
|
769
998
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Validate if the current year is in the current range
|
|
782
|
-
* Returns true if is in range else returns false
|
|
783
|
-
*/
|
|
784
|
-
_isInRange(year) {
|
|
785
|
-
return true;
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* @param obj The object to check.
|
|
789
|
-
* @returns The given object if it is both a date instance and valid, otherwise null.
|
|
790
|
-
*/
|
|
791
|
-
_getValidDateOrNull(obj) {
|
|
792
|
-
return this._adapter.isDateInstance(obj) && this._adapter.isValid(obj) ? obj : null;
|
|
999
|
+
// if there is a dateFilter, check if the date is allowed if it is not then do not set/emit new date
|
|
1000
|
+
// https://github.com/ng-matero/extensions/issues/244
|
|
1001
|
+
if (this.dateFilter &&
|
|
1002
|
+
!this.dateFilter(date, this._hourView ? MtxDatetimepickerFilterType.HOUR : MtxDatetimepickerFilterType.MINUTE)) {
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
this._timeChanged = true;
|
|
1006
|
+
this.activeDate = date;
|
|
1007
|
+
this._changeDetectorRef.markForCheck();
|
|
1008
|
+
this.activeDateChange.emit(this.activeDate);
|
|
793
1009
|
}
|
|
794
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
795
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1010
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxClock, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1011
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxClock, isStandalone: true, selector: "mtx-clock", inputs: { dateFilter: "dateFilter", interval: "interval", actionButtons: "actionButtons", twelvehour: ["twelvehour", "twelvehour", booleanAttribute], AMPM: "AMPM", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", startView: "startView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection" }, host: { attributes: { "role": "clock" }, listeners: { "mousedown": "_pointerDown($event)", "touchstart": "_pointerDown($event)" }, classAttribute: "mtx-clock" }, exportAs: ["mtxClock"], usesOnChanges: true, ngImport: i0, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div class=\"mtx-clock-hand\" [style]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n @for (item of _hours; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n @for (item of _minutes; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;font-size:var(--mtx-datetimepicker-clock-text-size, var(--mat-sys-title-small-size))}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-dial-background-color, var(--mat-sys-surface-container-highest))}.mtx-clock-center{position:absolute;top:50%;left:50%;width:3%;height:3%;margin:-1.5%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-3px;width:8px;height:8px;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-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;color:var(--mtx-datetimepicker-clock-cell-text-color, var(--mat-sys-on-surface))}.mtx-clock-cell.mtx-clock-cell-selected{color:#fff;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-cell:not(.mtx-clock-cell-selected,.mtx-clock-cell-disabled):hover{background-color:var(--mtx-datetimepicker-clock-cell-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none;color:var(--mtx-datetimepicker-clock-cell-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
796
1012
|
}
|
|
797
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1013
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxClock, decorators: [{
|
|
798
1014
|
type: Component,
|
|
799
|
-
args: [{ selector: 'mtx-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
args: [MTX_DATETIME_FORMATS]
|
|
807
|
-
}] }], propDecorators: { type: [{
|
|
1015
|
+
args: [{ selector: 'mtx-clock', host: {
|
|
1016
|
+
'role': 'clock',
|
|
1017
|
+
'class': 'mtx-clock',
|
|
1018
|
+
'(mousedown)': '_pointerDown($event)',
|
|
1019
|
+
'(touchstart)': '_pointerDown($event)',
|
|
1020
|
+
}, exportAs: 'mtxClock', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div class=\"mtx-clock-hand\" [style]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n @for (item of _hours; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n @for (item of _minutes; track item.value) {\n <div\n class=\"mtx-clock-cell\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\">{{ item.displayValue }}</div>\n }\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;font-size:var(--mtx-datetimepicker-clock-text-size, var(--mat-sys-title-small-size))}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-dial-background-color, var(--mat-sys-surface-container-highest))}.mtx-clock-center{position:absolute;top:50%;left:50%;width:3%;height:3%;margin:-1.5%;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hand{position:absolute;inset:0;width:2px;margin:0 auto;transform-origin:bottom;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-3px;width:8px;height:8px;border-radius:50%;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-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;color:var(--mtx-datetimepicker-clock-cell-text-color, var(--mat-sys-on-surface))}.mtx-clock-cell.mtx-clock-cell-selected{color:#fff;background-color:var(--mtx-datetimepicker-clock-hand-background-color, var(--mat-sys-primary))}.mtx-clock-cell:not(.mtx-clock-cell-selected,.mtx-clock-cell-disabled):hover{background-color:var(--mtx-datetimepicker-clock-cell-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none;color:var(--mtx-datetimepicker-clock-cell-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}\n"] }]
|
|
1021
|
+
}], propDecorators: { dateFilter: [{
|
|
808
1022
|
type: Input
|
|
809
|
-
}],
|
|
1023
|
+
}], interval: [{
|
|
1024
|
+
type: Input
|
|
1025
|
+
}], actionButtons: [{
|
|
1026
|
+
type: Input
|
|
1027
|
+
}], twelvehour: [{
|
|
1028
|
+
type: Input,
|
|
1029
|
+
args: [{ transform: booleanAttribute }]
|
|
1030
|
+
}], AMPM: [{
|
|
810
1031
|
type: Input
|
|
811
1032
|
}], selectedChange: [{
|
|
812
1033
|
type: Output
|
|
1034
|
+
}], activeDateChange: [{
|
|
1035
|
+
type: Output
|
|
813
1036
|
}], _userSelection: [{
|
|
814
1037
|
type: Output
|
|
815
1038
|
}], activeDate: [{
|
|
@@ -820,102 +1043,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
820
1043
|
type: Input
|
|
821
1044
|
}], maxDate: [{
|
|
822
1045
|
type: Input
|
|
1046
|
+
}], startView: [{
|
|
1047
|
+
type: Input
|
|
823
1048
|
}] } });
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* When the multi-year view is first opened, the active year will be in view.
|
|
833
|
-
* So we compute how many years are between the active year and the *slot* where our
|
|
834
|
-
* "startingYear" will render when paged into view.
|
|
835
|
-
*/
|
|
836
|
-
function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
|
|
837
|
-
const activeYear = dateAdapter.getYear(activeDate);
|
|
838
|
-
return euclideanModulo(activeYear - getStartingYear(dateAdapter, minDate, maxDate), yearsPerPage);
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* We pick a "starting" year such that either the maximum year would be at the end
|
|
842
|
-
* or the minimum year would be at the beginning of a page.
|
|
843
|
-
*/
|
|
844
|
-
function getStartingYear(dateAdapter, minDate, maxDate) {
|
|
845
|
-
let startingYear = 0;
|
|
846
|
-
if (maxDate) {
|
|
847
|
-
const maxYear = dateAdapter.getYear(maxDate);
|
|
848
|
-
startingYear = maxYear - yearsPerPage + 1;
|
|
849
|
-
}
|
|
850
|
-
else if (minDate) {
|
|
851
|
-
startingYear = dateAdapter.getYear(minDate);
|
|
852
|
-
}
|
|
853
|
-
return startingYear;
|
|
854
|
-
}
|
|
855
|
-
/** Gets remainder that is non-negative, even if first number is negative */
|
|
856
|
-
function euclideanModulo(a, b) {
|
|
857
|
-
return ((a % b) + b) % b;
|
|
1049
|
+
/** Returns whether an event is a touch event. */
|
|
1050
|
+
function isTouchEvent(event) {
|
|
1051
|
+
// This function is called for every pixel that the user has dragged so we need it to be
|
|
1052
|
+
// as fast as possible. Since we only bind mouse events and touch events, we can assume
|
|
1053
|
+
// that if the event's name starts with `t`, it's a touch event.
|
|
1054
|
+
return event.type[0] === 't';
|
|
858
1055
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
*/
|
|
866
|
-
this.changes = new Subject();
|
|
867
|
-
/** A label for the calendar popup (used by screen readers). */
|
|
868
|
-
this.calendarLabel = 'Calendar';
|
|
869
|
-
/** A label for the button used to open the calendar popup (used by screen readers). */
|
|
870
|
-
this.openCalendarLabel = 'Open calendar';
|
|
871
|
-
/** Label for the button used to close the calendar popup. */
|
|
872
|
-
this.closeCalendarLabel = 'Close calendar';
|
|
873
|
-
/** A label for the previous month button (used by screen readers). */
|
|
874
|
-
this.prevMonthLabel = 'Previous month';
|
|
875
|
-
/** A label for the next month button (used by screen readers). */
|
|
876
|
-
this.nextMonthLabel = 'Next month';
|
|
877
|
-
/** A label for the previous year button (used by screen readers). */
|
|
878
|
-
this.prevYearLabel = 'Previous year';
|
|
879
|
-
/** A label for the next year button (used by screen readers). */
|
|
880
|
-
this.nextYearLabel = 'Next year';
|
|
881
|
-
/** A label for the previous multi-year button (used by screen readers). */
|
|
882
|
-
this.prevMultiYearLabel = 'Previous 24 years';
|
|
883
|
-
/** A label for the next multi-year button (used by screen readers). */
|
|
884
|
-
this.nextMultiYearLabel = 'Next 24 years';
|
|
885
|
-
/** A label for the 'switch to month view' button (used by screen readers). */
|
|
886
|
-
this.switchToMonthViewLabel = 'Choose date';
|
|
887
|
-
/** A label for the 'switch to year view' button (used by screen readers). */
|
|
888
|
-
this.switchToYearViewLabel = 'Choose month';
|
|
889
|
-
/** A label for the 'switch to multi-year view' button (used by screen readers). */
|
|
890
|
-
this.switchToMultiYearViewLabel = 'Choose month and year';
|
|
891
|
-
/** A label for the first date of a range of dates (used by screen readers). */
|
|
892
|
-
this.startDateLabel = 'Start date';
|
|
893
|
-
/** A label for the last date of a range of dates (used by screen readers). */
|
|
894
|
-
this.endDateLabel = 'End date';
|
|
895
|
-
/** A label for the 'switch to clock hour view' button (used by screen readers). */
|
|
896
|
-
this.switchToClockHourViewLabel = 'Choose hour';
|
|
897
|
-
/** A label for the 'switch to clock minute view' button (used by screen readers). */
|
|
898
|
-
this.switchToClockMinuteViewLabel = 'Choose minute';
|
|
899
|
-
/** Label used for ok button within the manual time input. */
|
|
900
|
-
this.okLabel = 'OK';
|
|
901
|
-
/** Label used for cancel button within the manual time input. */
|
|
902
|
-
this.cancelLabel = 'Cancel';
|
|
903
|
-
}
|
|
904
|
-
/** Formats a range of years (used for visuals). */
|
|
905
|
-
formatYearRange(start, end) {
|
|
906
|
-
return `${start} \u2013 ${end}`;
|
|
1056
|
+
/** Gets the coordinates of a touch or mouse event relative to the document. */
|
|
1057
|
+
function getPointerPositionOnPage(event) {
|
|
1058
|
+
let point;
|
|
1059
|
+
if (isTouchEvent(event)) {
|
|
1060
|
+
// `touches` will be empty for start/end events so we have to fall back to `changedTouches`.
|
|
1061
|
+
point = event.touches[0] || event.changedTouches[0];
|
|
907
1062
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
return `${start} to ${end}`;
|
|
1063
|
+
else {
|
|
1064
|
+
point = event;
|
|
911
1065
|
}
|
|
912
|
-
|
|
913
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: MtxDatetimepickerIntl, providedIn: 'root' }); }
|
|
1066
|
+
return point;
|
|
914
1067
|
}
|
|
915
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: MtxDatetimepickerIntl, decorators: [{
|
|
916
|
-
type: Injectable,
|
|
917
|
-
args: [{ providedIn: 'root' }]
|
|
918
|
-
}] });
|
|
919
1068
|
|
|
920
1069
|
function pad(num, size) {
|
|
921
1070
|
num = String(num);
|
|
@@ -940,9 +1089,9 @@ class MtxTimeInput {
|
|
|
940
1089
|
}
|
|
941
1090
|
this.writePlaceholder(this._value);
|
|
942
1091
|
}
|
|
943
|
-
constructor(
|
|
944
|
-
this.element =
|
|
945
|
-
this.cdr =
|
|
1092
|
+
constructor() {
|
|
1093
|
+
this.element = inject(ElementRef);
|
|
1094
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
946
1095
|
this._interval = 1;
|
|
947
1096
|
this._min = 0;
|
|
948
1097
|
this._max = Infinity;
|
|
@@ -1073,10 +1222,10 @@ class MtxTimeInput {
|
|
|
1073
1222
|
this.inputElement.removeEventListener('keypress', this.keyPressListener);
|
|
1074
1223
|
this.inputElement.removeEventListener('input', this.inputEventListener);
|
|
1075
1224
|
}
|
|
1076
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1077
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1225
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxTimeInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1226
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: MtxTimeInput, isStandalone: true, selector: "input.mtx-time-input", inputs: { timeInterval: "timeInterval", timeMin: "timeMin", timeMax: "timeMax", timeValue: "timeValue" }, outputs: { timeValueChanged: "timeValueChanged" }, host: { listeners: { "blur": "blur($event)", "focus": "focus($event)" } }, exportAs: ["mtxTimeInput"], ngImport: i0 }); }
|
|
1078
1227
|
}
|
|
1079
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxTimeInput, decorators: [{
|
|
1080
1229
|
type: Directive,
|
|
1081
1230
|
args: [{
|
|
1082
1231
|
selector: 'input.mtx-time-input',
|
|
@@ -1085,9 +1234,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1085
1234
|
'(focus)': 'focus($event)',
|
|
1086
1235
|
},
|
|
1087
1236
|
exportAs: 'mtxTimeInput',
|
|
1088
|
-
standalone: true,
|
|
1089
1237
|
}]
|
|
1090
|
-
}], ctorParameters: () => [
|
|
1238
|
+
}], ctorParameters: () => [], propDecorators: { timeInterval: [{
|
|
1091
1239
|
type: Input,
|
|
1092
1240
|
args: ['timeInterval']
|
|
1093
1241
|
}], timeMin: [{
|
|
@@ -1102,7 +1250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1102
1250
|
}], timeValueChanged: [{
|
|
1103
1251
|
type: Output
|
|
1104
1252
|
}] } });
|
|
1105
|
-
class
|
|
1253
|
+
class MtxTimeView {
|
|
1106
1254
|
/** The date to display in this clock view. */
|
|
1107
1255
|
get activeDate() {
|
|
1108
1256
|
return this._activeDate;
|
|
@@ -1179,10 +1327,11 @@ class MtxTime {
|
|
|
1179
1327
|
}
|
|
1180
1328
|
return String(value);
|
|
1181
1329
|
}
|
|
1182
|
-
constructor(
|
|
1183
|
-
this._adapter =
|
|
1184
|
-
this._changeDetectorRef =
|
|
1185
|
-
this.
|
|
1330
|
+
constructor() {
|
|
1331
|
+
this._adapter = inject(DatetimeAdapter);
|
|
1332
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
1333
|
+
this._elementRef = inject(ElementRef);
|
|
1334
|
+
this._datetimepickerIntl = inject(MtxDatetimepickerIntl);
|
|
1186
1335
|
/** Emits when the currently selected date changes. */
|
|
1187
1336
|
this.selectedChange = new EventEmitter();
|
|
1188
1337
|
/** Emits when any date changes. */
|
|
@@ -1193,10 +1342,14 @@ class MtxTime {
|
|
|
1193
1342
|
this.ampmChange = new EventEmitter();
|
|
1194
1343
|
/** Emits when AM/PM button are clicked. */
|
|
1195
1344
|
this.clockViewChange = new EventEmitter();
|
|
1345
|
+
/** Input for action buttons. */
|
|
1346
|
+
this.timeInput = false;
|
|
1196
1347
|
/** Step over minutes. */
|
|
1197
1348
|
this.interval = 1;
|
|
1198
1349
|
/** Input for action buttons. */
|
|
1199
1350
|
this.actionsPortal = null;
|
|
1351
|
+
/** Prevent user to select same date time */
|
|
1352
|
+
this.preventSameDateTimeSelection = false;
|
|
1200
1353
|
/** Whether the time input should be auto-focused after view init. */
|
|
1201
1354
|
this.autoFocus = true;
|
|
1202
1355
|
/** Whether the clock uses 12 hour format. */
|
|
@@ -1213,30 +1366,58 @@ class MtxTime {
|
|
|
1213
1366
|
// when clockView changes by input we should focus the correct input
|
|
1214
1367
|
if (changes.clockView) {
|
|
1215
1368
|
if (changes.clockView.currentValue !== changes.clockView.previousValue && this.autoFocus) {
|
|
1216
|
-
this.
|
|
1369
|
+
this._focusInputElement();
|
|
1217
1370
|
}
|
|
1218
1371
|
}
|
|
1219
1372
|
}
|
|
1220
|
-
ngAfterViewInit() {
|
|
1221
|
-
if (this.autoFocus) {
|
|
1222
|
-
this.focusInputElement();
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
1373
|
ngOnDestroy() {
|
|
1226
1374
|
if (this.datetimepickerIntlChangesSubscription) {
|
|
1227
1375
|
this.datetimepickerIntlChangesSubscription.unsubscribe();
|
|
1228
1376
|
}
|
|
1229
1377
|
}
|
|
1230
|
-
|
|
1378
|
+
/** Handles keydown events on the calendar body when calendar is in clock view. */
|
|
1379
|
+
_handleCalendarBodyKeydown(event) {
|
|
1380
|
+
const oldActiveDate = this._activeDate;
|
|
1381
|
+
switch (event.keyCode) {
|
|
1382
|
+
case UP_ARROW:
|
|
1383
|
+
this.selected =
|
|
1384
|
+
this._clockView === 'hour'
|
|
1385
|
+
? this._adapter.addCalendarHours(this._activeDate, 1)
|
|
1386
|
+
: this._adapter.addCalendarMinutes(this._activeDate, this.interval);
|
|
1387
|
+
break;
|
|
1388
|
+
case DOWN_ARROW:
|
|
1389
|
+
this.selected =
|
|
1390
|
+
this._clockView === 'hour'
|
|
1391
|
+
? this._adapter.addCalendarHours(this._activeDate, -1)
|
|
1392
|
+
: this._adapter.addCalendarMinutes(this._activeDate, -this.interval);
|
|
1393
|
+
break;
|
|
1394
|
+
case ENTER:
|
|
1395
|
+
case SPACE:
|
|
1396
|
+
if (this.timeInput && event.keyCode == SPACE) {
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
if (this.clockView == 'hour') {
|
|
1400
|
+
this._timeSelected(this._activeDate);
|
|
1401
|
+
this._focusInputElement();
|
|
1402
|
+
}
|
|
1403
|
+
else {
|
|
1404
|
+
this._userSelection.emit();
|
|
1405
|
+
}
|
|
1406
|
+
return;
|
|
1407
|
+
default:
|
|
1408
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
this.selectedChange.emit(this.selected);
|
|
1412
|
+
// Prevent unexpected default actions such as form submission.
|
|
1413
|
+
event.preventDefault();
|
|
1414
|
+
}
|
|
1415
|
+
_focusInputElement() {
|
|
1231
1416
|
if (this.clockView === 'hour') {
|
|
1232
|
-
|
|
1233
|
-
this.hourInputElement.nativeElement.focus();
|
|
1234
|
-
}
|
|
1417
|
+
this.hourInputElement?.nativeElement.focus();
|
|
1235
1418
|
}
|
|
1236
1419
|
else {
|
|
1237
|
-
|
|
1238
|
-
this.minuteInputElement.nativeElement.focus();
|
|
1239
|
-
}
|
|
1420
|
+
this.minuteInputElement?.nativeElement.focus();
|
|
1240
1421
|
}
|
|
1241
1422
|
}
|
|
1242
1423
|
_handleHourInputChange(value) {
|
|
@@ -1299,19 +1480,39 @@ class MtxTime {
|
|
|
1299
1480
|
this.clockView = clockView;
|
|
1300
1481
|
this.clockViewChange.emit(clockView);
|
|
1301
1482
|
}
|
|
1302
|
-
|
|
1483
|
+
_dialTimeSelected(date) {
|
|
1303
1484
|
if (this.clockView === 'hour') {
|
|
1304
1485
|
this.clockView = 'minute';
|
|
1486
|
+
this._activeDate = date;
|
|
1487
|
+
}
|
|
1488
|
+
if (!this._adapter.sameDatetime(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1489
|
+
this.selectedChange.emit(date);
|
|
1305
1490
|
}
|
|
1306
|
-
|
|
1491
|
+
}
|
|
1492
|
+
_timeSelected(date) {
|
|
1493
|
+
if (this.timeInput) {
|
|
1494
|
+
if (this.clockView === 'hour') {
|
|
1495
|
+
this.clockView = 'minute';
|
|
1496
|
+
}
|
|
1497
|
+
this._activeDate = this.selected = date;
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
this._dialTimeSelected(date);
|
|
1501
|
+
}
|
|
1502
|
+
this.clockViewChange.emit(this.clockView);
|
|
1307
1503
|
}
|
|
1308
1504
|
_onActiveDateChange(date) {
|
|
1309
1505
|
this._activeDate = date;
|
|
1310
1506
|
this.activeDateChange.emit(date);
|
|
1311
1507
|
}
|
|
1312
1508
|
_handleSelection() {
|
|
1313
|
-
if (this.
|
|
1314
|
-
this.
|
|
1509
|
+
if (this.timeInput) {
|
|
1510
|
+
if (this.actionsPortal && this._selected) {
|
|
1511
|
+
this.selectedChange.emit(this._selected);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
else {
|
|
1515
|
+
this._userSelection.emit();
|
|
1315
1516
|
}
|
|
1316
1517
|
}
|
|
1317
1518
|
_handleOk() {
|
|
@@ -1323,15 +1524,28 @@ class MtxTime {
|
|
|
1323
1524
|
_handleCancel() {
|
|
1324
1525
|
this._userSelection.emit();
|
|
1325
1526
|
}
|
|
1326
|
-
/**
|
|
1327
|
-
|
|
1527
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
|
1528
|
+
_focusActiveCell() {
|
|
1529
|
+
if (this.timeInput) {
|
|
1530
|
+
if (this.autoFocus) {
|
|
1531
|
+
this._focusInputElement();
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
else {
|
|
1535
|
+
this._elementRef.nativeElement.focus();
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxTimeView, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1539
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxTimeView, isStandalone: true, selector: "mtx-time-view", inputs: { dateFilter: "dateFilter", timeInput: ["timeInput", "timeInput", booleanAttribute], interval: "interval", actionsPortal: "actionsPortal", preventSameDateTimeSelection: ["preventSameDateTimeSelection", "preventSameDateTimeSelection", booleanAttribute], autoFocus: ["autoFocus", "autoFocus", booleanAttribute], twelvehour: ["twelvehour", "twelvehour", booleanAttribute], AMPM: "AMPM", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", clockView: "clockView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection", ampmChange: "ampmChange", clockViewChange: "clockViewChange" }, host: { attributes: { "tabindex": "0" }, listeners: { "keydown": "_handleCalendarBodyKeydown($event)" }, classAttribute: "mtx-time-view" }, viewQueries: [{ propertyName: "hourInputElement", first: true, predicate: ["hourInput"], descendants: true, read: (ElementRef) }, { propertyName: "hourInputDirective", first: true, predicate: ["hourInput"], descendants: true, read: MtxTimeInput }, { propertyName: "minuteInputElement", first: true, predicate: ["minuteInput"], descendants: true, read: (ElementRef) }, { propertyName: "minuteInputDirective", first: true, predicate: ["minuteInput"], descendants: true, read: MtxTimeInput }], exportAs: ["mtxTime"], usesOnChanges: true, ngImport: i0, template: "@if (timeInput) {\n <div class=\"mtx-time-input-wrapper\">\n <div class=\"mtx-time-input-inner\">\n <input class=\"mtx-time-input\"\n [class.mtx-time-input-active]=\"clockView === 'hour'\"\n [class.mtx-time-input-warning]=\"!hourInput.valid\"\n #hourInput=\"mtxTimeInput\"\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=\"2\"\n [timeMin]=\"twelvehour ? 1 : 0\"\n [timeMax]=\"twelvehour ? 12 : 23\"\n [timeValue]=\"hour\"\n (timeValueChanged)=\"_handleHourInputChange($event)\"\n (focus)=\"_handleFocus('hour')\" />\n\n <div class=\"mtx-time-seperator\">:</div>\n\n <input class=\"mtx-time-input\"\n [class.mtx-time-input-active]=\"clockView === 'minute'\"\n [class.mtx-time-input-warning]=\"!minuteInput.valid\"\n #minuteInput=\"mtxTimeInput\"\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=\"2\"\n [timeMin]=\"0\"\n [timeMax]=\"59\"\n [timeValue]=\"minute\"\n (timeValueChanged)=\"_handleMinuteInputChange($event)\"\n [timeInterval]=\"interval\"\n (focus)=\"_handleFocus('minute')\" />\n\n @if (twelvehour) {\n <div class=\"mtx-time-ampm\">\n <button mat-button type=\"button\" class=\"mtx-time-am\"\n [class.mtx-time-ampm-active]=\"AMPM === 'AM'\" aria-label=\"AM\"\n (keydown)=\"$event.stopPropagation()\"\n (click)=\"ampmChange.emit('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-time-pm\"\n [class.mtx-time-ampm-active]=\"AMPM === 'PM'\" aria-label=\"PM\"\n (keydown)=\"$event.stopPropagation()\"\n (click)=\"ampmChange.emit('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n}\n\n<mtx-clock\n (selectedChange)=\"_timeSelected($event)\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (_userSelection)=\"_handleSelection()\"\n [AMPM]=\"AMPM\"\n [dateFilter]=\"dateFilter\"\n [actionButtons]=\"!!actionsPortal\"\n [interval]=\"interval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [startView]=\"clockView\"\n [twelvehour]=\"twelvehour\">\n</mtx-clock>\n\n@if (timeInput && !actionsPortal) {\n <div class=\"mtx-time-button-wrapper\">\n <button class=\"mtx-time-cancel-button\" mat-button type=\"button\" (click)=\"_handleCancel()\">\n {{ _datetimepickerIntl.cancelLabel }}\n </button>\n <button class=\"mtx-time-ok-button\" mat-button type=\"button\" (click)=\"_handleOk()\"\n [disabled]=\"minuteInputDirective?.invalid || hourInputDirective?.invalid\">\n {{ _datetimepickerIntl.okLabel }}\n </button>\n </div>\n}\n", styles: [".mtx-time-view{display:block;outline:none;-webkit-user-select:none;user-select:none}.mtx-time-input-wrapper{padding:8px 0;text-align:center}.mtx-time-input-inner{display:inline-flex;height:56px}.mtx-time-input{box-sizing:border-box;width:72px;height:100%;padding:0;font-size:36px;text-align:center;border:2px solid transparent;appearance:none;outline:none;border-radius:var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small));background-color:var(--mtx-datetimepicker-time-input-background-color, var(--mat-sys-surface-container-highest));color:var(--mtx-datetimepicker-time-input-text-color, var(--mat-sys-on-surface))}.mtx-time-input.mtx-time-input-active{background-color:var(--mtx-datetimepicker-time-input-active-state-background-color, var(--mat-sys-primary-container));color:var(--mtx-datetimepicker-time-input-active-state-text-color, var(--mat-sys-on-primary-container))}.mtx-time-input.mtx-time-input-active:focus{border-color:var(--mtx-datetimepicker-time-input-focus-state-outline-color, var(--mat-sys-primary));background-color:var(--mtx-datetimepicker-time-input-focus-state-background-color, var(--mat-sys-primary-container))}.mtx-time-input.mtx-time-input-active:focus::placeholder{color:var(--mtx-datetimepicker-time-input-focus-state-placeholder-text-color, var(--mat-sys-on-primary-container))}.mtx-time-input.mtx-time-input-warning{border-color:var(--mtx-datetimepicker-time-input-warn-state-outline-color, var(--mat-sys-error))}.mtx-time-seperator{display:inline-flex;justify-content:center;align-items:center;width:24px;font-size:36px}.mtx-time-ampm{display:inline-flex;flex-direction:column;margin-left:12px}[dir=rtl] .mtx-time-ampm{margin-left:auto;margin-right:12px}.mtx-time-ampm .mtx-time-am,.mtx-time-ampm .mtx-time-pm{--mdc-text-button-label-text-weight: 400;flex:1;width:40px;min-width:auto;border-width:1px;border-style:solid;--mdc-text-button-label-text-color: var(--mtx-datetimepicker-time-ampm-text-color, var(--mat-sys-on-surface));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small));border-color:var(--mtx-datetimepicker-time-ampm-outline-color, var(--mat-sys-outline))}.mtx-time-ampm .mtx-time-am.mtx-time-ampm-active,.mtx-time-ampm .mtx-time-pm.mtx-time-ampm-active{--mdc-text-button-label-text-weight: 500;--mdc-text-button-label-text-color: var(--mtx-datetimepicker-time-ampm-selected-state-text-color, var(--mat-sys-on-tertiary-container));background-color:var(--mtx-datetimepicker-time-ampm-selected-state-background-color, var(--mat-sys-tertiary-container))}.mtx-time-ampm .mtx-time-am .mat-mdc-button-touch-target,.mtx-time-ampm .mtx-time-pm .mat-mdc-button-touch-target{height:100%}.mtx-time-ampm .mtx-time-am{border-bottom-left-radius:0;border-bottom-right-radius:0}.mtx-time-ampm .mtx-time-pm{border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.mtx-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}.mtx-time-button-wrapper .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mtx-time-button-wrapper .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "actionButtons", "twelvehour", "AMPM", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["selectedChange", "activeDateChange", "_userSelection"], exportAs: ["mtxClock"] }, { kind: "directive", type: MtxTimeInput, selector: "input.mtx-time-input", inputs: ["timeInterval", "timeMin", "timeMax", "timeValue"], outputs: ["timeValueChanged"], exportAs: ["mtxTimeInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1328
1540
|
}
|
|
1329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxTimeView, decorators: [{
|
|
1330
1542
|
type: Component,
|
|
1331
|
-
args: [{ selector: 'mtx-time', exportAs: 'mtxTime', host: {
|
|
1332
|
-
class: 'mtx-time',
|
|
1333
|
-
|
|
1334
|
-
|
|
1543
|
+
args: [{ selector: 'mtx-time-view', exportAs: 'mtxTime', host: {
|
|
1544
|
+
'class': 'mtx-time-view',
|
|
1545
|
+
'tabindex': '0',
|
|
1546
|
+
'(keydown)': '_handleCalendarBodyKeydown($event)',
|
|
1547
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButton, MtxClock, MtxTimeInput], template: "@if (timeInput) {\n <div class=\"mtx-time-input-wrapper\">\n <div class=\"mtx-time-input-inner\">\n <input class=\"mtx-time-input\"\n [class.mtx-time-input-active]=\"clockView === 'hour'\"\n [class.mtx-time-input-warning]=\"!hourInput.valid\"\n #hourInput=\"mtxTimeInput\"\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=\"2\"\n [timeMin]=\"twelvehour ? 1 : 0\"\n [timeMax]=\"twelvehour ? 12 : 23\"\n [timeValue]=\"hour\"\n (timeValueChanged)=\"_handleHourInputChange($event)\"\n (focus)=\"_handleFocus('hour')\" />\n\n <div class=\"mtx-time-seperator\">:</div>\n\n <input class=\"mtx-time-input\"\n [class.mtx-time-input-active]=\"clockView === 'minute'\"\n [class.mtx-time-input-warning]=\"!minuteInput.valid\"\n #minuteInput=\"mtxTimeInput\"\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=\"2\"\n [timeMin]=\"0\"\n [timeMax]=\"59\"\n [timeValue]=\"minute\"\n (timeValueChanged)=\"_handleMinuteInputChange($event)\"\n [timeInterval]=\"interval\"\n (focus)=\"_handleFocus('minute')\" />\n\n @if (twelvehour) {\n <div class=\"mtx-time-ampm\">\n <button mat-button type=\"button\" class=\"mtx-time-am\"\n [class.mtx-time-ampm-active]=\"AMPM === 'AM'\" aria-label=\"AM\"\n (keydown)=\"$event.stopPropagation()\"\n (click)=\"ampmChange.emit('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-time-pm\"\n [class.mtx-time-ampm-active]=\"AMPM === 'PM'\" aria-label=\"PM\"\n (keydown)=\"$event.stopPropagation()\"\n (click)=\"ampmChange.emit('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n}\n\n<mtx-clock\n (selectedChange)=\"_timeSelected($event)\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (_userSelection)=\"_handleSelection()\"\n [AMPM]=\"AMPM\"\n [dateFilter]=\"dateFilter\"\n [actionButtons]=\"!!actionsPortal\"\n [interval]=\"interval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [startView]=\"clockView\"\n [twelvehour]=\"twelvehour\">\n</mtx-clock>\n\n@if (timeInput && !actionsPortal) {\n <div class=\"mtx-time-button-wrapper\">\n <button class=\"mtx-time-cancel-button\" mat-button type=\"button\" (click)=\"_handleCancel()\">\n {{ _datetimepickerIntl.cancelLabel }}\n </button>\n <button class=\"mtx-time-ok-button\" mat-button type=\"button\" (click)=\"_handleOk()\"\n [disabled]=\"minuteInputDirective?.invalid || hourInputDirective?.invalid\">\n {{ _datetimepickerIntl.okLabel }}\n </button>\n </div>\n}\n", styles: [".mtx-time-view{display:block;outline:none;-webkit-user-select:none;user-select:none}.mtx-time-input-wrapper{padding:8px 0;text-align:center}.mtx-time-input-inner{display:inline-flex;height:56px}.mtx-time-input{box-sizing:border-box;width:72px;height:100%;padding:0;font-size:36px;text-align:center;border:2px solid transparent;appearance:none;outline:none;border-radius:var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small));background-color:var(--mtx-datetimepicker-time-input-background-color, var(--mat-sys-surface-container-highest));color:var(--mtx-datetimepicker-time-input-text-color, var(--mat-sys-on-surface))}.mtx-time-input.mtx-time-input-active{background-color:var(--mtx-datetimepicker-time-input-active-state-background-color, var(--mat-sys-primary-container));color:var(--mtx-datetimepicker-time-input-active-state-text-color, var(--mat-sys-on-primary-container))}.mtx-time-input.mtx-time-input-active:focus{border-color:var(--mtx-datetimepicker-time-input-focus-state-outline-color, var(--mat-sys-primary));background-color:var(--mtx-datetimepicker-time-input-focus-state-background-color, var(--mat-sys-primary-container))}.mtx-time-input.mtx-time-input-active:focus::placeholder{color:var(--mtx-datetimepicker-time-input-focus-state-placeholder-text-color, var(--mat-sys-on-primary-container))}.mtx-time-input.mtx-time-input-warning{border-color:var(--mtx-datetimepicker-time-input-warn-state-outline-color, var(--mat-sys-error))}.mtx-time-seperator{display:inline-flex;justify-content:center;align-items:center;width:24px;font-size:36px}.mtx-time-ampm{display:inline-flex;flex-direction:column;margin-left:12px}[dir=rtl] .mtx-time-ampm{margin-left:auto;margin-right:12px}.mtx-time-ampm .mtx-time-am,.mtx-time-ampm .mtx-time-pm{--mdc-text-button-label-text-weight: 400;flex:1;width:40px;min-width:auto;border-width:1px;border-style:solid;--mdc-text-button-label-text-color: var(--mtx-datetimepicker-time-ampm-text-color, var(--mat-sys-on-surface));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small));border-color:var(--mtx-datetimepicker-time-ampm-outline-color, var(--mat-sys-outline))}.mtx-time-ampm .mtx-time-am.mtx-time-ampm-active,.mtx-time-ampm .mtx-time-pm.mtx-time-ampm-active{--mdc-text-button-label-text-weight: 500;--mdc-text-button-label-text-color: var(--mtx-datetimepicker-time-ampm-selected-state-text-color, var(--mat-sys-on-tertiary-container));background-color:var(--mtx-datetimepicker-time-ampm-selected-state-background-color, var(--mat-sys-tertiary-container))}.mtx-time-ampm .mtx-time-am .mat-mdc-button-touch-target,.mtx-time-ampm .mtx-time-pm .mat-mdc-button-touch-target{height:100%}.mtx-time-ampm .mtx-time-am{border-bottom-left-radius:0;border-bottom-right-radius:0}.mtx-time-ampm .mtx-time-pm{border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.mtx-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}.mtx-time-button-wrapper .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mtx-time-button-wrapper .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"] }]
|
|
1548
|
+
}], ctorParameters: () => [], propDecorators: { selectedChange: [{
|
|
1335
1549
|
type: Output
|
|
1336
1550
|
}], activeDateChange: [{
|
|
1337
1551
|
type: Output
|
|
@@ -1343,10 +1557,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1343
1557
|
type: Output
|
|
1344
1558
|
}], dateFilter: [{
|
|
1345
1559
|
type: Input
|
|
1560
|
+
}], timeInput: [{
|
|
1561
|
+
type: Input,
|
|
1562
|
+
args: [{ transform: booleanAttribute }]
|
|
1346
1563
|
}], interval: [{
|
|
1347
1564
|
type: Input
|
|
1348
1565
|
}], actionsPortal: [{
|
|
1349
1566
|
type: Input
|
|
1567
|
+
}], preventSameDateTimeSelection: [{
|
|
1568
|
+
type: Input,
|
|
1569
|
+
args: [{ transform: booleanAttribute }]
|
|
1350
1570
|
}], autoFocus: [{
|
|
1351
1571
|
type: Input,
|
|
1352
1572
|
args: [{ transform: booleanAttribute }]
|
|
@@ -1384,14 +1604,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1384
1604
|
* @docs-private
|
|
1385
1605
|
*/
|
|
1386
1606
|
class MtxYearView {
|
|
1387
|
-
constructor(
|
|
1388
|
-
this._adapter =
|
|
1389
|
-
this.
|
|
1607
|
+
constructor() {
|
|
1608
|
+
this._adapter = inject(DatetimeAdapter, { optional: true });
|
|
1609
|
+
this._dir = inject(Directionality, { optional: true });
|
|
1610
|
+
this._dateFormats = inject(MTX_DATETIME_FORMATS, { optional: true });
|
|
1390
1611
|
this.type = 'date';
|
|
1391
1612
|
/** Emits when a new month is selected. */
|
|
1392
1613
|
this.selectedChange = new EventEmitter();
|
|
1393
1614
|
/** Emits when any date is selected. */
|
|
1394
1615
|
this._userSelection = new EventEmitter();
|
|
1616
|
+
/** Emits when any date is activated. */
|
|
1617
|
+
this.activeDateChange = new EventEmitter();
|
|
1618
|
+
this._selected = null;
|
|
1395
1619
|
if (!this._adapter) {
|
|
1396
1620
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
1397
1621
|
}
|
|
@@ -1411,11 +1635,6 @@ class MtxYearView {
|
|
|
1411
1635
|
this._activeDate &&
|
|
1412
1636
|
!this._adapter.sameYear(oldActiveDate, this._activeDate)) {
|
|
1413
1637
|
this._init();
|
|
1414
|
-
// if (oldActiveDate < this._activeDate) {
|
|
1415
|
-
// this.calendarState('right');
|
|
1416
|
-
// } else {
|
|
1417
|
-
// this.calendarState('left');
|
|
1418
|
-
// }
|
|
1419
1638
|
}
|
|
1420
1639
|
}
|
|
1421
1640
|
/** The currently selected date. */
|
|
@@ -1439,9 +1658,6 @@ class MtxYearView {
|
|
|
1439
1658
|
this._userSelection.emit();
|
|
1440
1659
|
}
|
|
1441
1660
|
}
|
|
1442
|
-
_calendarStateDone() {
|
|
1443
|
-
this._calendarState = '';
|
|
1444
|
-
}
|
|
1445
1661
|
/** Initializes this month view. */
|
|
1446
1662
|
_init() {
|
|
1447
1663
|
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
@@ -1460,16 +1676,15 @@ class MtxYearView {
|
|
|
1460
1676
|
* Returns null if the given Date is in another year.
|
|
1461
1677
|
*/
|
|
1462
1678
|
_getMonthInCurrentYear(date) {
|
|
1463
|
-
return this._adapter.sameYear(date, this.activeDate)
|
|
1679
|
+
return date && this._adapter.sameYear(date, this.activeDate)
|
|
1680
|
+
? this._adapter.getMonth(date)
|
|
1681
|
+
: null;
|
|
1464
1682
|
}
|
|
1465
1683
|
/** Creates an MdCalendarCell for the given month. */
|
|
1466
1684
|
_createCellForMonth(month, monthName) {
|
|
1467
1685
|
const ariaLabel = this._adapter.format(this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate)), this._dateFormats.display.monthYearA11yLabel);
|
|
1468
1686
|
return new MtxCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));
|
|
1469
1687
|
}
|
|
1470
|
-
// private calendarState(direction: string): void {
|
|
1471
|
-
// this._calendarState = direction;
|
|
1472
|
-
// }
|
|
1473
1688
|
/** Whether the given month is enabled. */
|
|
1474
1689
|
_isMonthEnabled(month) {
|
|
1475
1690
|
if (!this.dateFilter) {
|
|
@@ -1484,20 +1699,68 @@ class MtxYearView {
|
|
|
1484
1699
|
}
|
|
1485
1700
|
return false;
|
|
1486
1701
|
}
|
|
1487
|
-
/**
|
|
1488
|
-
|
|
1702
|
+
/** Handles keydown events on the calendar body when calendar is in year view. */
|
|
1703
|
+
_handleCalendarBodyKeydown(event) {
|
|
1704
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
|
1705
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
|
1706
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
|
1707
|
+
const oldActiveDate = this._activeDate;
|
|
1708
|
+
const isRtl = this._isRtl();
|
|
1709
|
+
switch (event.keyCode) {
|
|
1710
|
+
case LEFT_ARROW:
|
|
1711
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
|
|
1712
|
+
break;
|
|
1713
|
+
case RIGHT_ARROW:
|
|
1714
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
|
|
1715
|
+
break;
|
|
1716
|
+
case UP_ARROW:
|
|
1717
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, -4);
|
|
1718
|
+
break;
|
|
1719
|
+
case DOWN_ARROW:
|
|
1720
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, 4);
|
|
1721
|
+
break;
|
|
1722
|
+
case HOME:
|
|
1723
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, -this._adapter.getMonth(this._activeDate));
|
|
1724
|
+
break;
|
|
1725
|
+
case END:
|
|
1726
|
+
this.activeDate = this._adapter.addCalendarMonths(this._activeDate, 11 - this._adapter.getMonth(this._activeDate));
|
|
1727
|
+
break;
|
|
1728
|
+
case PAGE_UP:
|
|
1729
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
|
1730
|
+
break;
|
|
1731
|
+
case PAGE_DOWN:
|
|
1732
|
+
this.activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
|
1733
|
+
break;
|
|
1734
|
+
case ENTER:
|
|
1735
|
+
case SPACE:
|
|
1736
|
+
this._monthSelected(this._adapter.getMonth(this._activeDate));
|
|
1737
|
+
break;
|
|
1738
|
+
default:
|
|
1739
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
if (this._adapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1743
|
+
this.activeDateChange.emit(this.activeDate);
|
|
1744
|
+
}
|
|
1745
|
+
this._focusActiveCell();
|
|
1746
|
+
// Prevent unexpected default actions such as form submission.
|
|
1747
|
+
event.preventDefault();
|
|
1748
|
+
}
|
|
1749
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
|
1750
|
+
_focusActiveCell() {
|
|
1751
|
+
this._mtxCalendarBody._focusActiveCell();
|
|
1752
|
+
}
|
|
1753
|
+
/** Determines whether the user has the RTL layout direction. */
|
|
1754
|
+
_isRtl() {
|
|
1755
|
+
return this._dir && this._dir.value === 'rtl';
|
|
1756
|
+
}
|
|
1757
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxYearView, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1758
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: MtxYearView, isStandalone: true, selector: "mtx-year-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_mtxCalendarBody", first: true, predicate: MtxCalendarBody, descendants: true }], exportAs: ["mtxYearView"], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_adapter.getMonth(activeDate)\"\n [selectedValue]=\"_selectedMonth!\"\n (selectedValueChange)=\"_monthSelected($event)\"\n [allowDisabledSelection]=\"true\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n", dependencies: [{ kind: "component", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "cellAspectRatio", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1489
1759
|
}
|
|
1490
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1760
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxYearView, decorators: [{
|
|
1491
1761
|
type: Component,
|
|
1492
|
-
args: [{ selector: 'mtx-year-view', exportAs: 'mtxYearView',
|
|
1493
|
-
}], ctorParameters: () => [
|
|
1494
|
-
type: Optional
|
|
1495
|
-
}] }, { type: undefined, decorators: [{
|
|
1496
|
-
type: Optional
|
|
1497
|
-
}, {
|
|
1498
|
-
type: Inject,
|
|
1499
|
-
args: [MTX_DATETIME_FORMATS]
|
|
1500
|
-
}] }], propDecorators: { type: [{
|
|
1762
|
+
args: [{ selector: 'mtx-year-view', exportAs: 'mtxYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MtxCalendarBody], template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_adapter.getMonth(activeDate)\"\n [selectedValue]=\"_selectedMonth!\"\n (selectedValueChange)=\"_monthSelected($event)\"\n [allowDisabledSelection]=\"true\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n" }]
|
|
1763
|
+
}], ctorParameters: () => [], propDecorators: { type: [{
|
|
1501
1764
|
type: Input
|
|
1502
1765
|
}], dateFilter: [{
|
|
1503
1766
|
type: Input
|
|
@@ -1505,6 +1768,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1505
1768
|
type: Output
|
|
1506
1769
|
}], _userSelection: [{
|
|
1507
1770
|
type: Output
|
|
1771
|
+
}], activeDateChange: [{
|
|
1772
|
+
type: Output
|
|
1773
|
+
}], _mtxCalendarBody: [{
|
|
1774
|
+
type: ViewChild,
|
|
1775
|
+
args: [MtxCalendarBody]
|
|
1508
1776
|
}], activeDate: [{
|
|
1509
1777
|
type: Input
|
|
1510
1778
|
}], selected: [{
|
|
@@ -1516,12 +1784,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
1516
1784
|
* @docs-private
|
|
1517
1785
|
*/
|
|
1518
1786
|
class MtxCalendar {
|
|
1519
|
-
constructor(
|
|
1520
|
-
this.
|
|
1521
|
-
this.
|
|
1522
|
-
this._ngZone =
|
|
1523
|
-
this._adapter =
|
|
1524
|
-
this._dateFormats =
|
|
1787
|
+
constructor() {
|
|
1788
|
+
this._intl = inject(MtxDatetimepickerIntl);
|
|
1789
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
1790
|
+
this._ngZone = inject(NgZone);
|
|
1791
|
+
this._adapter = inject(DatetimeAdapter, { optional: true });
|
|
1792
|
+
this._dateFormats = inject(MTX_DATETIME_FORMATS, { optional: true });
|
|
1525
1793
|
/** Whether to show multi-year view. */
|
|
1526
1794
|
this.multiYearSelector = false;
|
|
1527
1795
|
/** Whether the clock uses 12 hour format. */
|
|
@@ -1540,7 +1808,12 @@ class MtxCalendar {
|
|
|
1540
1808
|
this.viewChanged = new EventEmitter();
|
|
1541
1809
|
this._userSelection = new EventEmitter();
|
|
1542
1810
|
this._clockView = 'hour';
|
|
1543
|
-
|
|
1811
|
+
/**
|
|
1812
|
+
* Used for scheduling that focus should be moved to the active cell on the next tick.
|
|
1813
|
+
* We need to schedule it, rather than do it immediately, because we have to wait
|
|
1814
|
+
* for Angular to re-evaluate the view children.
|
|
1815
|
+
*/
|
|
1816
|
+
this._moveFocusOnNextTick = false;
|
|
1544
1817
|
this._type = 'date';
|
|
1545
1818
|
/**
|
|
1546
1819
|
* Whether the calendar is in time mode. In time mode the calendar clock gets time input
|
|
@@ -1556,13 +1829,16 @@ class MtxCalendar {
|
|
|
1556
1829
|
(!this.minDate || this._adapter.compareDate(date, this.minDate) >= 0) &&
|
|
1557
1830
|
(!this.maxDate || this._adapter.compareDate(date, this.maxDate) <= 0));
|
|
1558
1831
|
};
|
|
1832
|
+
const _intl = this._intl;
|
|
1559
1833
|
if (!this._adapter) {
|
|
1560
1834
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
1561
1835
|
}
|
|
1562
1836
|
if (!this._dateFormats) {
|
|
1563
1837
|
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
1564
1838
|
}
|
|
1565
|
-
this._intlChanges = _intl.changes.subscribe(() =>
|
|
1839
|
+
this._intlChanges = _intl.changes.subscribe(() => {
|
|
1840
|
+
this._changeDetectorRef.markForCheck();
|
|
1841
|
+
});
|
|
1566
1842
|
}
|
|
1567
1843
|
/** The display type of datetimepicker. */
|
|
1568
1844
|
get type() {
|
|
@@ -1625,14 +1901,20 @@ class MtxCalendar {
|
|
|
1625
1901
|
this.calendarState('left');
|
|
1626
1902
|
}
|
|
1627
1903
|
}
|
|
1904
|
+
this._changeDetectorRef.markForCheck();
|
|
1628
1905
|
}
|
|
1629
1906
|
/** Whether the calendar is in month view. */
|
|
1630
1907
|
get currentView() {
|
|
1631
1908
|
return this._currentView;
|
|
1632
1909
|
}
|
|
1633
|
-
set currentView(
|
|
1634
|
-
this._currentView
|
|
1635
|
-
this.
|
|
1910
|
+
set currentView(value) {
|
|
1911
|
+
const viewChangedResult = this._currentView !== value ? value : null;
|
|
1912
|
+
this._currentView = value;
|
|
1913
|
+
this._moveFocusOnNextTick = true;
|
|
1914
|
+
this._changeDetectorRef.markForCheck();
|
|
1915
|
+
if (viewChangedResult) {
|
|
1916
|
+
this.viewChanged.emit(viewChangedResult);
|
|
1917
|
+
}
|
|
1636
1918
|
}
|
|
1637
1919
|
get _yearPeriodText() {
|
|
1638
1920
|
if (this.currentView === 'multi-year') {
|
|
@@ -1721,17 +2003,24 @@ class MtxCalendar {
|
|
|
1721
2003
|
}
|
|
1722
2004
|
this._activeDate = this.startAt || this._adapter.today();
|
|
1723
2005
|
this._selectAMPM(this._activeDate);
|
|
2006
|
+
// Assign to the private property since we don't want to move focus on init.
|
|
1724
2007
|
if (this.type === 'year') {
|
|
1725
|
-
this.
|
|
2008
|
+
this._currentView = 'multi-year';
|
|
1726
2009
|
}
|
|
1727
2010
|
else if (this.type === 'month') {
|
|
1728
|
-
this.
|
|
2011
|
+
this._currentView = 'year';
|
|
1729
2012
|
}
|
|
1730
2013
|
else if (this.type === 'time') {
|
|
1731
|
-
this.
|
|
2014
|
+
this._currentView = 'clock';
|
|
1732
2015
|
}
|
|
1733
2016
|
else {
|
|
1734
|
-
this.
|
|
2017
|
+
this._currentView = this.startView;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
ngAfterViewChecked() {
|
|
2021
|
+
if (this._moveFocusOnNextTick) {
|
|
2022
|
+
this._moveFocusOnNextTick = false;
|
|
2023
|
+
this.focusActiveCell();
|
|
1735
2024
|
}
|
|
1736
2025
|
}
|
|
1737
2026
|
ngOnDestroy() {
|
|
@@ -1784,15 +2073,6 @@ class MtxCalendar {
|
|
|
1784
2073
|
this.selectedChange.emit(date);
|
|
1785
2074
|
}
|
|
1786
2075
|
}
|
|
1787
|
-
_dialTimeSelected(date) {
|
|
1788
|
-
if (this._clockView !== 'minute') {
|
|
1789
|
-
this._activeDate = date;
|
|
1790
|
-
this._clockView = 'minute';
|
|
1791
|
-
}
|
|
1792
|
-
if (!this._adapter.sameDatetime(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1793
|
-
this.selectedChange.emit(date);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
2076
|
_onActiveDateChange(date) {
|
|
1797
2077
|
this._activeDate = date;
|
|
1798
2078
|
}
|
|
@@ -1804,7 +2084,10 @@ class MtxCalendar {
|
|
|
1804
2084
|
else {
|
|
1805
2085
|
this._AMPM = 'AM';
|
|
1806
2086
|
}
|
|
1807
|
-
if (this.actionsPortal &&
|
|
2087
|
+
if (this.actionsPortal &&
|
|
2088
|
+
this.currentView === 'clock' &&
|
|
2089
|
+
this._selected &&
|
|
2090
|
+
!this._adapter.sameHour(date, this._selected)) {
|
|
1808
2091
|
this.selectedChange.emit(date);
|
|
1809
2092
|
}
|
|
1810
2093
|
}
|
|
@@ -1876,29 +2159,6 @@ class MtxCalendar {
|
|
|
1876
2159
|
_nextEnabled() {
|
|
1877
2160
|
return !this.maxDate || !this._isSameView(this._activeDate, this.maxDate);
|
|
1878
2161
|
}
|
|
1879
|
-
/** Handles keydown events on the calendar body. */
|
|
1880
|
-
_handleCalendarBodyKeydown(event) {
|
|
1881
|
-
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
|
1882
|
-
// disabled ones from being selected. This may not be ideal, we should look into whether
|
|
1883
|
-
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
|
1884
|
-
if (this.currentView === 'month') {
|
|
1885
|
-
this._handleCalendarBodyKeydownInMonthView(event);
|
|
1886
|
-
}
|
|
1887
|
-
else if (this.currentView === 'year') {
|
|
1888
|
-
this._handleCalendarBodyKeydownInYearView(event);
|
|
1889
|
-
}
|
|
1890
|
-
else if (this.currentView === 'multi-year') {
|
|
1891
|
-
this._handleCalendarBodyKeydownInMultiYearView(event);
|
|
1892
|
-
}
|
|
1893
|
-
else {
|
|
1894
|
-
this._handleCalendarBodyKeydownInClockView(event);
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
_focusActiveCell() {
|
|
1898
|
-
afterNextRender(() => {
|
|
1899
|
-
this._elementRef.nativeElement.focus();
|
|
1900
|
-
}, { injector: this._injector });
|
|
1901
|
-
}
|
|
1902
2162
|
_calendarStateDone() {
|
|
1903
2163
|
this._calendarState = '';
|
|
1904
2164
|
}
|
|
@@ -1914,207 +2174,39 @@ class MtxCalendar {
|
|
|
1914
2174
|
// Otherwise we are in 'multi-year' view.
|
|
1915
2175
|
return isSameMultiYearView(this._adapter, date1, date2, this.minDate, this.maxDate);
|
|
1916
2176
|
}
|
|
1917
|
-
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
1918
|
-
_handleCalendarBodyKeydownInMonthView(event) {
|
|
1919
|
-
switch (event.keyCode) {
|
|
1920
|
-
case LEFT_ARROW:
|
|
1921
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, -1);
|
|
1922
|
-
break;
|
|
1923
|
-
case RIGHT_ARROW:
|
|
1924
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1);
|
|
1925
|
-
break;
|
|
1926
|
-
case UP_ARROW:
|
|
1927
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, -7);
|
|
1928
|
-
break;
|
|
1929
|
-
case DOWN_ARROW:
|
|
1930
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 7);
|
|
1931
|
-
break;
|
|
1932
|
-
case HOME:
|
|
1933
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1 - this._adapter.getDate(this._activeDate));
|
|
1934
|
-
break;
|
|
1935
|
-
case END:
|
|
1936
|
-
this._activeDate = this._adapter.addCalendarDays(this._activeDate, this._adapter.getNumDaysInMonth(this._activeDate) -
|
|
1937
|
-
this._adapter.getDate(this._activeDate));
|
|
1938
|
-
break;
|
|
1939
|
-
case PAGE_UP:
|
|
1940
|
-
this._activeDate = event.altKey
|
|
1941
|
-
? this._adapter.addCalendarYears(this._activeDate, -1)
|
|
1942
|
-
: this._adapter.addCalendarMonths(this._activeDate, -1);
|
|
1943
|
-
break;
|
|
1944
|
-
case PAGE_DOWN:
|
|
1945
|
-
this._activeDate = event.altKey
|
|
1946
|
-
? this._adapter.addCalendarYears(this._activeDate, 1)
|
|
1947
|
-
: this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
1948
|
-
break;
|
|
1949
|
-
case ENTER:
|
|
1950
|
-
if (this._dateFilterForViews(this._activeDate)) {
|
|
1951
|
-
this._dateSelected(this._activeDate);
|
|
1952
|
-
// Prevent unexpected default actions such as form submission.
|
|
1953
|
-
event.preventDefault();
|
|
1954
|
-
}
|
|
1955
|
-
return;
|
|
1956
|
-
default:
|
|
1957
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1958
|
-
return;
|
|
1959
|
-
}
|
|
1960
|
-
// Prevent unexpected default actions such as form submission.
|
|
1961
|
-
event.preventDefault();
|
|
1962
|
-
}
|
|
1963
|
-
/** Handles keydown events on the calendar body when calendar is in year view. */
|
|
1964
|
-
_handleCalendarBodyKeydownInYearView(event) {
|
|
1965
|
-
switch (event.keyCode) {
|
|
1966
|
-
case LEFT_ARROW:
|
|
1967
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -1);
|
|
1968
|
-
break;
|
|
1969
|
-
case RIGHT_ARROW:
|
|
1970
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
1971
|
-
break;
|
|
1972
|
-
case UP_ARROW:
|
|
1973
|
-
this._activeDate = this._prevMonthInSameCol(this._activeDate);
|
|
1974
|
-
break;
|
|
1975
|
-
case DOWN_ARROW:
|
|
1976
|
-
this._activeDate = this._nextMonthInSameCol(this._activeDate);
|
|
1977
|
-
break;
|
|
1978
|
-
case HOME:
|
|
1979
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -this._adapter.getMonth(this._activeDate));
|
|
1980
|
-
break;
|
|
1981
|
-
case END:
|
|
1982
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 11 - this._adapter.getMonth(this._activeDate));
|
|
1983
|
-
break;
|
|
1984
|
-
case PAGE_UP:
|
|
1985
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
|
1986
|
-
break;
|
|
1987
|
-
case PAGE_DOWN:
|
|
1988
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
|
1989
|
-
break;
|
|
1990
|
-
case ENTER:
|
|
1991
|
-
this._monthSelected(this._activeDate);
|
|
1992
|
-
break;
|
|
1993
|
-
default:
|
|
1994
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
// Prevent unexpected default actions such as form submission.
|
|
1998
|
-
event.preventDefault();
|
|
1999
|
-
}
|
|
2000
|
-
/** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
|
2001
|
-
_handleCalendarBodyKeydownInMultiYearView(event) {
|
|
2002
|
-
switch (event.keyCode) {
|
|
2003
|
-
case LEFT_ARROW:
|
|
2004
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -1);
|
|
2005
|
-
break;
|
|
2006
|
-
case RIGHT_ARROW:
|
|
2007
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, 1);
|
|
2008
|
-
break;
|
|
2009
|
-
case UP_ARROW:
|
|
2010
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -yearsPerRow);
|
|
2011
|
-
break;
|
|
2012
|
-
case DOWN_ARROW:
|
|
2013
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerRow);
|
|
2014
|
-
break;
|
|
2015
|
-
case HOME:
|
|
2016
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate));
|
|
2017
|
-
break;
|
|
2018
|
-
case END:
|
|
2019
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerPage -
|
|
2020
|
-
getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate) -
|
|
2021
|
-
1);
|
|
2022
|
-
break;
|
|
2023
|
-
case PAGE_UP:
|
|
2024
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
2025
|
-
break;
|
|
2026
|
-
case PAGE_DOWN:
|
|
2027
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
2028
|
-
break;
|
|
2029
|
-
case ENTER:
|
|
2030
|
-
this._yearSelected(this._activeDate);
|
|
2031
|
-
break;
|
|
2032
|
-
default:
|
|
2033
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
2038
|
-
_handleCalendarBodyKeydownInClockView(event) {
|
|
2039
|
-
switch (event.keyCode) {
|
|
2040
|
-
case UP_ARROW:
|
|
2041
|
-
this._activeDate =
|
|
2042
|
-
this._clockView === 'hour'
|
|
2043
|
-
? this._adapter.addCalendarHours(this._activeDate, 1)
|
|
2044
|
-
: this._adapter.addCalendarMinutes(this._activeDate, this.timeInterval);
|
|
2045
|
-
break;
|
|
2046
|
-
case DOWN_ARROW:
|
|
2047
|
-
this._activeDate =
|
|
2048
|
-
this._clockView === 'hour'
|
|
2049
|
-
? this._adapter.addCalendarHours(this._activeDate, -1)
|
|
2050
|
-
: this._adapter.addCalendarMinutes(this._activeDate, -this.timeInterval);
|
|
2051
|
-
break;
|
|
2052
|
-
case ENTER:
|
|
2053
|
-
if (!this.timeInput) {
|
|
2054
|
-
this._dialTimeSelected(this._activeDate);
|
|
2055
|
-
}
|
|
2056
|
-
return;
|
|
2057
|
-
default:
|
|
2058
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
// Prevent unexpected default actions such as form submission.
|
|
2062
|
-
event.preventDefault();
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Determine the date for the month that comes before the given month in the same column in the
|
|
2066
|
-
* calendar table.
|
|
2067
|
-
*/
|
|
2068
|
-
_prevMonthInSameCol(date) {
|
|
2069
|
-
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
2070
|
-
// of each year.
|
|
2071
|
-
const increment = this._adapter.getMonth(date) <= 4 ? -5 : this._adapter.getMonth(date) >= 7 ? -7 : -12;
|
|
2072
|
-
return this._adapter.addCalendarMonths(date, increment);
|
|
2073
|
-
}
|
|
2074
|
-
/**
|
|
2075
|
-
* Determine the date for the month that comes after the given month in the same column in the
|
|
2076
|
-
* calendar table.
|
|
2077
|
-
*/
|
|
2078
|
-
_nextMonthInSameCol(date) {
|
|
2079
|
-
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
2080
|
-
// of each year.
|
|
2081
|
-
const increment = this._adapter.getMonth(date) <= 4 ? 7 : this._adapter.getMonth(date) >= 7 ? 5 : 12;
|
|
2082
|
-
return this._adapter.addCalendarMonths(date, increment);
|
|
2083
|
-
}
|
|
2084
2177
|
calendarState(direction) {
|
|
2085
2178
|
this._calendarState = direction;
|
|
2086
2179
|
}
|
|
2087
2180
|
_2digit(n) {
|
|
2088
2181
|
return ('00' + n).slice(-2);
|
|
2089
2182
|
}
|
|
2090
|
-
/**
|
|
2091
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: MtxCalendar, isStandalone: true, selector: "mtx-calendar", inputs: { multiYearSelector: ["multiYearSelector", "multiYearSelector", booleanAttribute], twelvehour: ["twelvehour", "twelvehour", booleanAttribute], startView: "startView", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: "preventSameDateTimeSelection", headerComponent: "headerComponent", actionsPortal: "actionsPortal", type: "type", startAt: "startAt", timeInput: ["timeInput", "timeInput", booleanAttribute], timeInputAutoFocus: ["timeInputAutoFocus", "timeInputAutoFocus", booleanAttribute], selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", viewChanged: "viewChanged", _userSelection: "_userSelection" }, host: { attributes: { "tabindex": "0" }, listeners: { "keydown": "_handleCalendarBodyKeydown($event)" }, properties: { "class.mtx-calendar-with-time-input": "timeInput" }, classAttribute: "mtx-calendar" }, exportAs: ["mtxCalendar"], ngImport: i0, template: "<div class=\"mtx-calendar-header\">\n @if (_calendarHeaderPortal) {\n <ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\"></ng-template>\n } @else {\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-year\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n [attr.aria-label]=\"_yearButtonLabel\"\n (click)=\"_yearClicked()\">\n <span>{{ _yearButtonText }}</span>\n @if (multiYearSelector || type === 'year') {\n <svg\n class=\"mtx-calendar-header-year-dropdown\" matButtonIcon iconPositionEnd\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\" />\n </svg>\n }\n </button>\n }\n @if (type !== 'year') {\n <div class=\"mtx-calendar-header-date-time\">\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-date\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n [attr.aria-label]=\"_dateButtonLabel\"\n (click)=\"_dateClicked()\">{{ _dateButtonText }}</button>\n }\n @if (type.endsWith('time')) {\n <span class=\"mtx-calendar-header-time\" [class.active]=\"currentView === 'clock'\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-hours\"\n [class.active]=\"_clockView === 'hour'\"\n [attr.aria-label]=\"_hourButtonLabel\"\n (click)=\"_hoursClicked()\">{{ _hoursButtonText }}</button>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-minutes\"\n [class.active]=\"_clockView === 'minute'\"\n [attr.aria-label]=\"_minuteButtonLabel\"\n (click)=\"_minutesClicked()\">{{ _minutesButtonText }}</button>\n </span>\n @if (twelvehour) {\n <span class=\"mtx-calendar-header-ampm-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'AM'\" aria-label=\"AM\"\n (click)=\"_ampmClicked('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'PM'\" aria-label=\"PM\"\n (click)=\"_ampmClicked('PM')\">PM</button>\n </span>\n }\n </span>\n }\n </div>\n }\n }\n</div>\n\n<div class=\"mtx-calendar-content\">\n @if (currentView === 'month' || currentView === 'year' || currentView === 'multi-year') {\n <div class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-previous-button\"\n [class.disabled]=\"!_previousEnabled()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_prevButtonLabel\"\n (click)=\"_previousClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\" />\n </svg>\n </button>\n <div class=\"mtx-calendar-period-button\"\n [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\">\n <strong>{{ _yearPeriodText }}</strong>\n </div>\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-next-button\"\n [class.disabled]=\"!_nextEnabled()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_nextButtonLabel\"\n (click)=\"_nextClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </svg>\n </button>\n </div>\n </div>\n }\n\n @switch (currentView) {\n @case ('month') {\n <mtx-month-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n }\n @case ('year') {\n <mtx-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n }\n @case ('multi-year') {\n <mtx-multi-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n }\n @default {\n @if (timeInput) {\n <mtx-time\n (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n [AMPM]=\"_AMPM\"\n (ampmChange)=\"_ampmClicked($event)\"\n [clockView]=\"_clockView\"\n (clockViewChange)=\"_clockView = $event\"\n [twelvehour]=\"twelvehour\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [actionsPortal]=\"actionsPortal\"\n [autoFocus]=\"timeInputAutoFocus\">\n </mtx-time>\n } @else {\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_dialTimeSelected($event)\"\n [AMPM]=\"_AMPM\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n }\n }\n }\n</div>\n", styles: [".mtx-calendar{display:block;outline:none;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-app-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-app-body-large-size))}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-bottom:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));background-color:var(--mtx-datetimepicker-calendar-header-background-color);color:var(--mtx-datetimepicker-calendar-header-text-color, var(--mat-app-on-surface-variant));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-app-corner-small))}.mtx-calendar-header .mtx-calendar-header-year,.mtx-calendar-header .mtx-calendar-header-date,.mtx-calendar-header .mtx-calendar-header-hours,.mtx-calendar-header .mtx-calendar-header-minutes,.mtx-calendar-header .mtx-calendar-header-ampm{height:auto;min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:normal;white-space:normal;word-break:break-word}.mtx-calendar-header .mtx-calendar-header-year .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-date .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-hours .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-minutes .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-ampm .mat-mdc-button-touch-target{height:100%}.mtx-calendar-header .mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-date-time{font-size:24px;line-height:36px}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-flex}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{opacity:1}.mtx-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.mtx-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}[mode=landscape] .mtx-calendar{display:flex}[mode=landscape] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[mode=landscape] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=landscape] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=landscape] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=landscape] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=landscape] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[mode=auto] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=auto] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=auto] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=auto] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=auto] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;align-items:center;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box;font-size:var(--mtx-datetimepicker-calendar-period-button-text-size, var(--mat-app-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-period-button-text-weight, var(--mat-app-title-small-weight))}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none;color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color)}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0;color:var(--mtx-datetimepicker-calendar-table-header-text-color, var(--mat-app-on-surface));font-size:var(--mtx-datetimepicker-calendar-table-header-text-size);font-weight:var(--mtx-datetimepicker-calendar-table-header-text-weight)}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MtxMonthView, selector: "mtx-month-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxMonthView"] }, { kind: "component", type: MtxYearView, selector: "mtx-year-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxYearView"] }, { kind: "component", type: MtxMultiYearView, selector: "mtx-multi-year-view", inputs: ["type", "dateFilter", "activeDate", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxMultiYearView"] }, { kind: "component", type: MtxTime, selector: "mtx-time", inputs: ["dateFilter", "interval", "actionsPortal", "autoFocus", "twelvehour", "AMPM", "activeDate", "selected", "minDate", "maxDate", "clockView"], outputs: ["selectedChange", "activeDateChange", "_userSelection", "ampmChange", "clockViewChange"], exportAs: ["mtxTime"] }, { kind: "component", type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "actionButtons", "twelvehour", "AMPM", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["selectedChange", "activeDateChange", "_userSelection"], exportAs: ["mtxClock"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2183
|
+
/** Returns the component instance that corresponds to the current calendar view. */
|
|
2184
|
+
_getCurrentViewComponent() {
|
|
2185
|
+
return this.monthView || this.yearView || this.multiYearView || this.timeView;
|
|
2186
|
+
}
|
|
2187
|
+
/** Focuses the active date. */
|
|
2188
|
+
focusActiveCell() {
|
|
2189
|
+
this._getCurrentViewComponent()._focusActiveCell(false);
|
|
2190
|
+
}
|
|
2191
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2192
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxCalendar, isStandalone: true, selector: "mtx-calendar", inputs: { multiYearSelector: ["multiYearSelector", "multiYearSelector", booleanAttribute], twelvehour: ["twelvehour", "twelvehour", booleanAttribute], startView: "startView", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: ["preventSameDateTimeSelection", "preventSameDateTimeSelection", booleanAttribute], headerComponent: "headerComponent", actionsPortal: "actionsPortal", type: "type", startAt: "startAt", timeInput: ["timeInput", "timeInput", booleanAttribute], timeInputAutoFocus: ["timeInputAutoFocus", "timeInputAutoFocus", booleanAttribute], selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", viewChanged: "viewChanged", _userSelection: "_userSelection" }, host: { properties: { "class.mtx-calendar-with-time-input": "timeInput" }, classAttribute: "mtx-calendar" }, viewQueries: [{ propertyName: "monthView", first: true, predicate: MtxMonthView, descendants: true }, { propertyName: "yearView", first: true, predicate: MtxYearView, descendants: true }, { propertyName: "multiYearView", first: true, predicate: MtxMultiYearView, descendants: true }, { propertyName: "timeView", first: true, predicate: MtxTimeView, descendants: true }], exportAs: ["mtxCalendar"], ngImport: i0, template: "<div class=\"mtx-calendar-header\">\n @if (_calendarHeaderPortal) {\n <ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\"></ng-template>\n } @else {\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-year\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n [attr.aria-label]=\"_yearButtonLabel\"\n (click)=\"_yearClicked()\">\n <span>{{ _yearButtonText }}</span>\n @if (multiYearSelector || type === 'year') {\n <svg\n class=\"mtx-calendar-header-year-dropdown\" matButtonIcon iconPositionEnd\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\" />\n </svg>\n }\n </button>\n }\n @if (type !== 'year') {\n <div class=\"mtx-calendar-header-date-time\">\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-date\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n [attr.aria-label]=\"_dateButtonLabel\"\n (click)=\"_dateClicked()\">{{ _dateButtonText }}</button>\n }\n @if (type.endsWith('time')) {\n <span class=\"mtx-calendar-header-time\" [class.active]=\"currentView === 'clock'\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-hours\"\n [class.active]=\"_clockView === 'hour'\"\n [attr.aria-label]=\"_hourButtonLabel\"\n (click)=\"_hoursClicked()\">{{ _hoursButtonText }}</button>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-minutes\"\n [class.active]=\"_clockView === 'minute'\"\n [attr.aria-label]=\"_minuteButtonLabel\"\n (click)=\"_minutesClicked()\">{{ _minutesButtonText }}</button>\n </span>\n @if (twelvehour) {\n <span class=\"mtx-calendar-header-ampm-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'AM'\" aria-label=\"AM\"\n (click)=\"_ampmClicked('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'PM'\" aria-label=\"PM\"\n (click)=\"_ampmClicked('PM')\">PM</button>\n </span>\n }\n </span>\n }\n </div>\n }\n }\n</div>\n\n<div class=\"mtx-calendar-content\">\n @if (currentView === 'month' || currentView === 'year' || currentView === 'multi-year') {\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-previous-button\"\n [class.disabled]=\"!_previousEnabled()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_prevButtonLabel\"\n (click)=\"_previousClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\" />\n </svg>\n </button>\n <div class=\"mtx-calendar-period-button\"\n [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\">\n <strong>{{ _yearPeriodText }}</strong>\n </div>\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-next-button\"\n [class.disabled]=\"!_nextEnabled()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_nextButtonLabel\"\n (click)=\"_nextClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </svg>\n </button>\n </div>\n }\n\n <div class=\"mtx-calendar-view\" cdkMonitorSubtreeFocus tabindex=\"-1\">\n @switch (currentView) {\n @case ('month') {\n <mtx-month-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-month-view>\n }\n @case ('year') {\n <mtx-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-year-view>\n }\n @case ('multi-year') {\n <mtx-multi-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-multi-year-view>\n }\n @default {\n <mtx-time-view\n (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n [AMPM]=\"_AMPM\"\n (ampmChange)=\"_ampmClicked($event)\"\n [clockView]=\"_clockView\"\n (clockViewChange)=\"_clockView = $event\"\n [twelvehour]=\"twelvehour\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [(selected)]=\"_activeDate\"\n [actionsPortal]=\"actionsPortal\"\n [autoFocus]=\"timeInputAutoFocus\"\n [timeInput]=\"timeInput\"\n [preventSameDateTimeSelection]=\"preventSameDateTimeSelection\">\n </mtx-time-view>\n }\n }\n </div>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-sys-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-sys-body-large-size))}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-bottom:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);color:var(--mtx-datetimepicker-calendar-header-text-color, var(--mat-sys-on-surface-variant));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small))}.mtx-calendar-header .mtx-calendar-header-year,.mtx-calendar-header .mtx-calendar-header-date,.mtx-calendar-header .mtx-calendar-header-hours,.mtx-calendar-header .mtx-calendar-header-minutes,.mtx-calendar-header .mtx-calendar-header-ampm{height:auto;min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:normal;white-space:normal;word-break:break-word}.mtx-calendar-header .mtx-calendar-header-year .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-date .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-hours .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-minutes .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-ampm .mat-mdc-button-touch-target{height:100%}.mtx-calendar-header .mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-date-time{font-size:24px;line-height:36px}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-flex}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{opacity:1}.mtx-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.mtx-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}[mode=landscape] .mtx-calendar{display:flex}[mode=landscape] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[mode=landscape] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=landscape] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=landscape] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=landscape] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=landscape] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[mode=auto] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=auto] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=auto] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=auto] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=auto] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;align-items:center;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box;font-size:var(--mtx-datetimepicker-calendar-period-button-text-size, var(--mat-sys-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-period-button-text-weight, var(--mat-sys-title-small-weight))}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none;color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0;color:var(--mtx-datetimepicker-calendar-table-header-text-color, var(--mat-sys-on-surface));font-size:var(--mtx-datetimepicker-calendar-table-header-text-size);font-weight:var(--mtx-datetimepicker-calendar-table-header-text-weight)}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MtxMonthView, selector: "mtx-month-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection", "activeDateChange"], exportAs: ["mtxMonthView"] }, { kind: "component", type: MtxYearView, selector: "mtx-year-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection", "activeDateChange"], exportAs: ["mtxYearView"] }, { kind: "component", type: MtxMultiYearView, selector: "mtx-multi-year-view", inputs: ["type", "dateFilter", "activeDate", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "_userSelection", "activeDateChange"], exportAs: ["mtxMultiYearView"] }, { kind: "component", type: MtxTimeView, selector: "mtx-time-view", inputs: ["dateFilter", "timeInput", "interval", "actionsPortal", "preventSameDateTimeSelection", "autoFocus", "twelvehour", "AMPM", "activeDate", "selected", "minDate", "maxDate", "clockView"], outputs: ["selectedChange", "activeDateChange", "_userSelection", "ampmChange", "clockViewChange"], exportAs: ["mtxTime"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2092
2193
|
}
|
|
2093
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxCalendar, decorators: [{
|
|
2094
2195
|
type: Component,
|
|
2095
2196
|
args: [{ selector: 'mtx-calendar', host: {
|
|
2096
2197
|
'class': 'mtx-calendar',
|
|
2097
2198
|
'[class.mtx-calendar-with-time-input]': 'timeInput',
|
|
2098
|
-
|
|
2099
|
-
'(keydown)': '_handleCalendarBodyKeydown($event)',
|
|
2100
|
-
}, exportAs: 'mtxCalendar', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
2199
|
+
}, exportAs: 'mtxCalendar', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2101
2200
|
CdkPortalOutlet,
|
|
2201
|
+
CdkMonitorFocus,
|
|
2102
2202
|
MatButton,
|
|
2103
2203
|
MatIconButton,
|
|
2104
2204
|
MtxMonthView,
|
|
2105
2205
|
MtxYearView,
|
|
2106
2206
|
MtxMultiYearView,
|
|
2107
|
-
|
|
2108
|
-
MtxClock,
|
|
2109
|
-
], template: "<div class=\"mtx-calendar-header\">\n @if (_calendarHeaderPortal) {\n <ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\"></ng-template>\n } @else {\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-year\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n [attr.aria-label]=\"_yearButtonLabel\"\n (click)=\"_yearClicked()\">\n <span>{{ _yearButtonText }}</span>\n @if (multiYearSelector || type === 'year') {\n <svg\n class=\"mtx-calendar-header-year-dropdown\" matButtonIcon iconPositionEnd\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\" />\n </svg>\n }\n </button>\n }\n @if (type !== 'year') {\n <div class=\"mtx-calendar-header-date-time\">\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-date\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n [attr.aria-label]=\"_dateButtonLabel\"\n (click)=\"_dateClicked()\">{{ _dateButtonText }}</button>\n }\n @if (type.endsWith('time')) {\n <span class=\"mtx-calendar-header-time\" [class.active]=\"currentView === 'clock'\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-hours\"\n [class.active]=\"_clockView === 'hour'\"\n [attr.aria-label]=\"_hourButtonLabel\"\n (click)=\"_hoursClicked()\">{{ _hoursButtonText }}</button>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-minutes\"\n [class.active]=\"_clockView === 'minute'\"\n [attr.aria-label]=\"_minuteButtonLabel\"\n (click)=\"_minutesClicked()\">{{ _minutesButtonText }}</button>\n </span>\n @if (twelvehour) {\n <span class=\"mtx-calendar-header-ampm-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'AM'\" aria-label=\"AM\"\n (click)=\"_ampmClicked('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'PM'\" aria-label=\"PM\"\n (click)=\"_ampmClicked('PM')\">PM</button>\n </span>\n }\n </span>\n }\n </div>\n }\n }\n</div>\n\n<div class=\"mtx-calendar-content\">\n @if (currentView === 'month' || currentView === 'year' || currentView === 'multi-year') {\n <div class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-previous-button\"\n [class.disabled]=\"!_previousEnabled()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_prevButtonLabel\"\n (click)=\"_previousClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\" />\n </svg>\n </button>\n <div class=\"mtx-calendar-period-button\"\n [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\">\n <strong>{{ _yearPeriodText }}</strong>\n </div>\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-next-button\"\n [class.disabled]=\"!_nextEnabled()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_nextButtonLabel\"\n (click)=\"_nextClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </svg>\n </button>\n </div>\n </div>\n }\n\n @switch (currentView) {\n @case ('month') {\n <mtx-month-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n }\n @case ('year') {\n <mtx-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n }\n @case ('multi-year') {\n <mtx-multi-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n }\n @default {\n @if (timeInput) {\n <mtx-time\n (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n [AMPM]=\"_AMPM\"\n (ampmChange)=\"_ampmClicked($event)\"\n [clockView]=\"_clockView\"\n (clockViewChange)=\"_clockView = $event\"\n [twelvehour]=\"twelvehour\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [actionsPortal]=\"actionsPortal\"\n [autoFocus]=\"timeInputAutoFocus\">\n </mtx-time>\n } @else {\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_dialTimeSelected($event)\"\n [AMPM]=\"_AMPM\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n }\n }\n }\n</div>\n", styles: [".mtx-calendar{display:block;outline:none;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-app-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-app-body-large-size))}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-bottom:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));background-color:var(--mtx-datetimepicker-calendar-header-background-color);color:var(--mtx-datetimepicker-calendar-header-text-color, var(--mat-app-on-surface-variant));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-app-corner-small))}.mtx-calendar-header .mtx-calendar-header-year,.mtx-calendar-header .mtx-calendar-header-date,.mtx-calendar-header .mtx-calendar-header-hours,.mtx-calendar-header .mtx-calendar-header-minutes,.mtx-calendar-header .mtx-calendar-header-ampm{height:auto;min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:normal;white-space:normal;word-break:break-word}.mtx-calendar-header .mtx-calendar-header-year .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-date .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-hours .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-minutes .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-ampm .mat-mdc-button-touch-target{height:100%}.mtx-calendar-header .mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-date-time{font-size:24px;line-height:36px}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-flex}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{opacity:1}.mtx-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.mtx-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}[mode=landscape] .mtx-calendar{display:flex}[mode=landscape] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[mode=landscape] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=landscape] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=landscape] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=landscape] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=landscape] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[mode=auto] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=auto] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=auto] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=auto] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}[dir=rtl] [mode=auto] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-app-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-app-corner-large))}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;align-items:center;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box;font-size:var(--mtx-datetimepicker-calendar-period-button-text-size, var(--mat-app-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-period-button-text-weight, var(--mat-app-title-small-weight))}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none;color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color)}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0;color:var(--mtx-datetimepicker-calendar-table-header-text-color, var(--mat-app-on-surface));font-size:var(--mtx-datetimepicker-calendar-table-header-text-size);font-weight:var(--mtx-datetimepicker-calendar-table-header-text-weight)}\n"] }]
|
|
2110
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: MtxDatetimepickerIntl }, { type: i0.NgZone }, { type: i1.DatetimeAdapter, decorators: [{
|
|
2111
|
-
type: Optional
|
|
2112
|
-
}] }, { type: undefined, decorators: [{
|
|
2113
|
-
type: Optional
|
|
2114
|
-
}, {
|
|
2115
|
-
type: Inject,
|
|
2116
|
-
args: [MTX_DATETIME_FORMATS]
|
|
2117
|
-
}] }, { type: i0.ChangeDetectorRef }], propDecorators: { multiYearSelector: [{
|
|
2207
|
+
MtxTimeView,
|
|
2208
|
+
], template: "<div class=\"mtx-calendar-header\">\n @if (_calendarHeaderPortal) {\n <ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\"></ng-template>\n } @else {\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-year\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n [attr.aria-label]=\"_yearButtonLabel\"\n (click)=\"_yearClicked()\">\n <span>{{ _yearButtonText }}</span>\n @if (multiYearSelector || type === 'year') {\n <svg\n class=\"mtx-calendar-header-year-dropdown\" matButtonIcon iconPositionEnd\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\" />\n </svg>\n }\n </button>\n }\n @if (type !== 'year') {\n <div class=\"mtx-calendar-header-date-time\">\n @if (type !== 'time') {\n <button\n mat-button type=\"button\" class=\"mtx-calendar-header-date\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n [attr.aria-label]=\"_dateButtonLabel\"\n (click)=\"_dateClicked()\">{{ _dateButtonText }}</button>\n }\n @if (type.endsWith('time')) {\n <span class=\"mtx-calendar-header-time\" [class.active]=\"currentView === 'clock'\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-hours\"\n [class.active]=\"_clockView === 'hour'\"\n [attr.aria-label]=\"_hourButtonLabel\"\n (click)=\"_hoursClicked()\">{{ _hoursButtonText }}</button>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-minutes\"\n [class.active]=\"_clockView === 'minute'\"\n [attr.aria-label]=\"_minuteButtonLabel\"\n (click)=\"_minutesClicked()\">{{ _minutesButtonText }}</button>\n </span>\n @if (twelvehour) {\n <span class=\"mtx-calendar-header-ampm-container\">\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'AM'\" aria-label=\"AM\"\n (click)=\"_ampmClicked('AM')\">AM</button>\n <button mat-button type=\"button\" class=\"mtx-calendar-header-ampm\"\n [class.active]=\"_AMPM === 'PM'\" aria-label=\"PM\"\n (click)=\"_ampmClicked('PM')\">PM</button>\n </span>\n }\n </span>\n }\n </div>\n }\n }\n</div>\n\n<div class=\"mtx-calendar-content\">\n @if (currentView === 'month' || currentView === 'year' || currentView === 'multi-year') {\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-previous-button\"\n [class.disabled]=\"!_previousEnabled()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_prevButtonLabel\"\n (click)=\"_previousClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\" />\n </svg>\n </button>\n <div class=\"mtx-calendar-period-button\"\n [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\">\n <strong>{{ _yearPeriodText }}</strong>\n </div>\n <button mat-icon-button type=\"button\"\n class=\"mtx-calendar-next-button\"\n [class.disabled]=\"!_nextEnabled()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_nextButtonLabel\"\n (click)=\"_nextClicked()\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </svg>\n </button>\n </div>\n }\n\n <div class=\"mtx-calendar-view\" cdkMonitorSubtreeFocus tabindex=\"-1\">\n @switch (currentView) {\n @case ('month') {\n <mtx-month-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-month-view>\n }\n @case ('year') {\n <mtx-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-year-view>\n }\n @case ('multi-year') {\n <mtx-multi-year-view\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n [(activeDate)]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [type]=\"type\">\n </mtx-multi-year-view>\n }\n @default {\n <mtx-time-view\n (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n [AMPM]=\"_AMPM\"\n (ampmChange)=\"_ampmClicked($event)\"\n [clockView]=\"_clockView\"\n (clockViewChange)=\"_clockView = $event\"\n [twelvehour]=\"twelvehour\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [(selected)]=\"_activeDate\"\n [actionsPortal]=\"actionsPortal\"\n [autoFocus]=\"timeInputAutoFocus\"\n [timeInput]=\"timeInput\"\n [preventSameDateTimeSelection]=\"preventSameDateTimeSelection\">\n </mtx-time-view>\n }\n }\n </div>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none;font-family:var(--mtx-datetimepicker-calendar-text-font, var(--mat-sys-body-large-font));font-size:var(--mtx-datetimepicker-calendar-text-size, var(--mat-sys-body-large-size))}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-bottom:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);color:var(--mtx-datetimepicker-calendar-header-text-color, var(--mat-sys-on-surface-variant));--mdc-text-button-container-shape: var(--mtx-datetimepicker-selector-container-shape, var(--mat-sys-corner-small))}.mtx-calendar-header .mtx-calendar-header-year,.mtx-calendar-header .mtx-calendar-header-date,.mtx-calendar-header .mtx-calendar-header-hours,.mtx-calendar-header .mtx-calendar-header-minutes,.mtx-calendar-header .mtx-calendar-header-ampm{height:auto;min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:normal;white-space:normal;word-break:break-word}.mtx-calendar-header .mtx-calendar-header-year .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-date .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-hours .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-minutes .mat-mdc-button-touch-target,.mtx-calendar-header .mtx-calendar-header-ampm .mat-mdc-button-touch-target{height:100%}.mtx-calendar-header .mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-date-time{font-size:24px;line-height:36px}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-flex}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{opacity:1}.mtx-calendar-header-hour-minute-separator{display:inline-block;width:8px;text-align:center}.mtx-calendar-header-ampm-container{display:inline-flex;flex-direction:column;line-height:18px;font-size:12px}[mode=landscape] .mtx-calendar{display:flex}[mode=landscape] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[mode=landscape] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=landscape] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=landscape] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=landscape] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=landscape] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=landscape] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=landscape] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:144px;min-width:144px;padding:16px 8px;border-bottom-width:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-top-left-radius:0;border-bottom-left-radius:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-top-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[mode=auto] .mtx-calendar .mtx-calendar-header-year+.mtx-calendar-header-date-time,[mode=auto] .mtx-calendar .mtx-calendar-header-date+.mtx-calendar-header-time{margin-top:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-date-time{font-size:28px}[mode=auto] .mtx-calendar .mtx-calendar-header-time{display:flex;flex-direction:column}[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-hours,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-minutes,[mode=auto] .mtx-calendar .mtx-calendar-header-time .mtx-calendar-header-ampm{width:40px;text-align:center}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm-container{flex-direction:row;font-size:20px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm{padding:4px}[mode=auto] .mtx-calendar .mtx-calendar-header-ampm+.mtx-calendar-header-ampm{margin:0 8px}[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar .mtx-calendar-header{border-bottom-left-radius:0;border-bottom-right-radius:0}[mode=auto] .mtx-datetimepicker-actions:before{position:absolute;top:0;left:0;box-sizing:border-box;width:144px;height:100%;content:\"\";border-right:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));background-color:var(--mtx-datetimepicker-calendar-header-background-color, transparent);border-bottom-left-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}[dir=rtl] [mode=auto] .mtx-datetimepicker-actions:before{left:auto;right:0;border-right-width:0;border-left:1px solid var(--mtx-datetimepicker-calendar-header-divider-color, var(--mat-sys-outline-variant));border-bottom-left-radius:0;border-bottom-right-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large))}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;align-items:center;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box;font-size:var(--mtx-datetimepicker-calendar-period-button-text-size, var(--mat-sys-title-small-size));font-weight:var(--mtx-datetimepicker-calendar-period-button-text-weight, var(--mat-sys-title-small-weight))}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none;color:var(--mtx-datetimepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0;color:var(--mtx-datetimepicker-calendar-table-header-text-color, var(--mat-sys-on-surface));font-size:var(--mtx-datetimepicker-calendar-table-header-text-size);font-weight:var(--mtx-datetimepicker-calendar-table-header-text-weight)}\n"] }]
|
|
2209
|
+
}], ctorParameters: () => [], propDecorators: { multiYearSelector: [{
|
|
2118
2210
|
type: Input,
|
|
2119
2211
|
args: [{ transform: booleanAttribute }]
|
|
2120
2212
|
}], twelvehour: [{
|
|
@@ -2127,7 +2219,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
2127
2219
|
}], dateFilter: [{
|
|
2128
2220
|
type: Input
|
|
2129
2221
|
}], preventSameDateTimeSelection: [{
|
|
2130
|
-
type: Input
|
|
2222
|
+
type: Input,
|
|
2223
|
+
args: [{ transform: booleanAttribute }]
|
|
2131
2224
|
}], headerComponent: [{
|
|
2132
2225
|
type: Input
|
|
2133
2226
|
}], actionsPortal: [{
|
|
@@ -2138,6 +2231,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
2138
2231
|
type: Output
|
|
2139
2232
|
}], _userSelection: [{
|
|
2140
2233
|
type: Output
|
|
2234
|
+
}], monthView: [{
|
|
2235
|
+
type: ViewChild,
|
|
2236
|
+
args: [MtxMonthView]
|
|
2237
|
+
}], yearView: [{
|
|
2238
|
+
type: ViewChild,
|
|
2239
|
+
args: [MtxYearView]
|
|
2240
|
+
}], multiYearView: [{
|
|
2241
|
+
type: ViewChild,
|
|
2242
|
+
args: [MtxMultiYearView]
|
|
2243
|
+
}], timeView: [{
|
|
2244
|
+
type: ViewChild,
|
|
2245
|
+
args: [MtxTimeView]
|
|
2141
2246
|
}], type: [{
|
|
2142
2247
|
type: Input
|
|
2143
2248
|
}], startAt: [{
|
|
@@ -2182,8 +2287,8 @@ const MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
|
2182
2287
|
* @docs-private
|
|
2183
2288
|
*/
|
|
2184
2289
|
class MtxDatetimepickerContent {
|
|
2185
|
-
constructor(
|
|
2186
|
-
this._changeDetectorRef =
|
|
2290
|
+
constructor() {
|
|
2291
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
2187
2292
|
/** Emits when an animation has finished. */
|
|
2188
2293
|
this._animationDone = new Subject();
|
|
2189
2294
|
/** Id of the label for the `role="dialog"` element. */
|
|
@@ -2194,6 +2299,12 @@ class MtxDatetimepickerContent {
|
|
|
2194
2299
|
this.type = 'datetime';
|
|
2195
2300
|
/** The view of the calendar. */
|
|
2196
2301
|
this.view = 'month';
|
|
2302
|
+
/** Text for the close button. */
|
|
2303
|
+
this._closeButtonText = '';
|
|
2304
|
+
/** Whether the close button currently has focus. */
|
|
2305
|
+
this._closeButtonFocused = false;
|
|
2306
|
+
const intl = inject(MtxDatetimepickerIntl);
|
|
2307
|
+
this._closeButtonText = intl.closeCalendarLabel;
|
|
2197
2308
|
}
|
|
2198
2309
|
_viewChanged(view) {
|
|
2199
2310
|
this.view = view;
|
|
@@ -2201,8 +2312,8 @@ class MtxDatetimepickerContent {
|
|
|
2201
2312
|
ngOnInit() {
|
|
2202
2313
|
this._animationState = this.datetimepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
|
|
2203
2314
|
}
|
|
2204
|
-
|
|
2205
|
-
this._calendar.
|
|
2315
|
+
ngAfterViewInit() {
|
|
2316
|
+
this._calendar.focusActiveCell();
|
|
2206
2317
|
}
|
|
2207
2318
|
ngOnDestroy() {
|
|
2208
2319
|
this._animationDone.complete();
|
|
@@ -2228,13 +2339,13 @@ class MtxDatetimepickerContent {
|
|
|
2228
2339
|
this._changeDetectorRef.detectChanges();
|
|
2229
2340
|
}
|
|
2230
2341
|
}
|
|
2231
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2232
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2342
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2343
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerContent, isStandalone: true, selector: "mtx-datetimepicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "class": "color ? \"mat-\" + color : \"\"", "class.mtx-datetimepicker-content-touch": "datetimepicker?.touchUi", "attr.mode": "datetimepicker.mode", "@transformPanel": "_animationState" }, classAttribute: "mtx-datetimepicker-content" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: MtxCalendar, descendants: true, static: true }], ngImport: i0, template: "<div cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n [attr.mode]=\"datetimepicker.mode\"\n class=\"mtx-datetimepicker-content-container\"\n [class.mtx-datetimepicker-content-container-with-custom-header]=\"datetimepicker.calendarHeaderComponent\"\n [class.mtx-datetimepicker-content-container-with-actions]=\"_actionsPortal\"\n [class.mtx-datetimepicker-content-container-with-time-input]=\"datetimepicker.timeInput\">\n <mtx-calendar [id]=\"datetimepicker.id\"\n [class]=\"datetimepicker.panelClass\"\n [attr.mode]=\"datetimepicker.mode\"\n [type]=\"datetimepicker.type\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [headerComponent]=\"datetimepicker.calendarHeaderComponent\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [timeInput]=\"datetimepicker.timeInput\"\n [actionsPortal]=\"_actionsPortal\"\n [timeInputAutoFocus]=\"datetimepicker.timeInputAutoFocus\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (viewChanged)=\"_viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection()\"\n [@fadeInCalendar]=\"'enter'\">\n </mtx-calendar>\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mtx-datetimepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datetimepicker.close()\">{{ _closeButtonText }}</button>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));background-color:var(--mtx-datetimepicker-container-background-color, var(--mat-sys-surface-container-high));box-shadow:var(--mtx-datetimepicker-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12));color:var(--mtx-datetimepicker-container-text-color, var(--mat-sys-on-surface))}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:424px}.mtx-datetimepicker-content .mtx-calendar.mtx-calendar-with-time-input{height:490px}.mtx-datetimepicker-content .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:442px}.mtx-datetimepicker-content .mtx-datetimepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mtx-datetimepicker-content .mtx-datetimepicker-close-button{display:none}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar{width:432px;height:328px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar.mtx-calendar-with-time-input{height:404px}.mtx-datetimepicker-content[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:356px}@media all and (orientation: landscape){.mtx-datetimepicker-content[mode=auto] .mtx-calendar{width:432px;height:328px}.mtx-datetimepicker-content[mode=auto] .mtx-calendar.mtx-calendar-with-time-input{height:404px}.mtx-datetimepicker-content[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:356px}}.mtx-datetimepicker-content-touch{display:block;max-height:84vh;box-shadow:var(--mtx-datetimepicker-container-touch-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12));border-radius:var(--mtx-datetimepicker-container-touch-shape, var(--mat-sys-corner-extra-large));position:relative;overflow:visible}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.mtx-datetimepicker-content-touch .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-clock{width:50vh;max-width:80%;margin:12px auto}@media all and (orientation: landscape){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:120vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape].mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}}@media all and (orientation: portrait){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-actions,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-time-input,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait].mtx-datetimepicker-content-container-with-actions,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait].mtx-datetimepicker-content-container-with-time-input{height:124vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: MtxCalendar, selector: "mtx-calendar", inputs: ["multiYearSelector", "twelvehour", "startView", "timeInterval", "dateFilter", "preventSameDateTimeSelection", "headerComponent", "actionsPortal", "type", "startAt", "timeInput", "timeInputAutoFocus", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "viewChanged", "_userSelection"], exportAs: ["mtxCalendar"] }, { kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }], animations: [
|
|
2233
2344
|
mtxDatetimepickerAnimations.transformPanel,
|
|
2234
2345
|
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
2235
2346
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2236
2347
|
}
|
|
2237
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerContent, decorators: [{
|
|
2238
2349
|
type: Component,
|
|
2239
2350
|
args: [{ selector: 'mtx-datetimepicker-content', host: {
|
|
2240
2351
|
'class': 'mtx-datetimepicker-content',
|
|
@@ -2246,8 +2357,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
2246
2357
|
}, animations: [
|
|
2247
2358
|
mtxDatetimepickerAnimations.transformPanel,
|
|
2248
2359
|
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
2249
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2250
|
-
}], ctorParameters: () => [
|
|
2360
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CdkTrapFocus, MtxCalendar, CdkPortalOutlet, MatButton], template: "<div cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n [attr.mode]=\"datetimepicker.mode\"\n class=\"mtx-datetimepicker-content-container\"\n [class.mtx-datetimepicker-content-container-with-custom-header]=\"datetimepicker.calendarHeaderComponent\"\n [class.mtx-datetimepicker-content-container-with-actions]=\"_actionsPortal\"\n [class.mtx-datetimepicker-content-container-with-time-input]=\"datetimepicker.timeInput\">\n <mtx-calendar [id]=\"datetimepicker.id\"\n [class]=\"datetimepicker.panelClass\"\n [attr.mode]=\"datetimepicker.mode\"\n [type]=\"datetimepicker.type\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [headerComponent]=\"datetimepicker.calendarHeaderComponent\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [timeInput]=\"datetimepicker.timeInput\"\n [actionsPortal]=\"_actionsPortal\"\n [timeInputAutoFocus]=\"datetimepicker.timeInputAutoFocus\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (viewChanged)=\"_viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection()\"\n [@fadeInCalendar]=\"'enter'\">\n </mtx-calendar>\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mtx-datetimepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datetimepicker.close()\">{{ _closeButtonText }}</button>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:var(--mtx-datetimepicker-container-shape, var(--mat-sys-corner-large));background-color:var(--mtx-datetimepicker-container-background-color, var(--mat-sys-surface-container-high));box-shadow:var(--mtx-datetimepicker-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12));color:var(--mtx-datetimepicker-container-text-color, var(--mat-sys-on-surface))}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:424px}.mtx-datetimepicker-content .mtx-calendar.mtx-calendar-with-time-input{height:490px}.mtx-datetimepicker-content .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:442px}.mtx-datetimepicker-content .mtx-datetimepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mtx-datetimepicker-content .mtx-datetimepicker-close-button{display:none}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar{width:432px;height:328px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar.mtx-calendar-with-time-input{height:404px}.mtx-datetimepicker-content[mode=landscape] .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:356px}@media all and (orientation: landscape){.mtx-datetimepicker-content[mode=auto] .mtx-calendar{width:432px;height:328px}.mtx-datetimepicker-content[mode=auto] .mtx-calendar.mtx-calendar-with-time-input{height:404px}.mtx-datetimepicker-content[mode=auto] .mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{height:356px}}.mtx-datetimepicker-content-touch{display:block;max-height:84vh;box-shadow:var(--mtx-datetimepicker-container-touch-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12));border-radius:var(--mtx-datetimepicker-container-touch-shape, var(--mat-sys-corner-extra-large));position:relative;overflow:visible}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.mtx-datetimepicker-content-touch .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-clock{width:50vh;max-width:80%;margin:12px auto}@media all and (orientation: landscape){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:120vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape].mtx-datetimepicker-content-container-with-actions .mtx-calendar.mtx-calendar-with-time-input{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}}@media all and (orientation: portrait){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-actions,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto].mtx-datetimepicker-content-container-with-time-input,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait].mtx-datetimepicker-content-container-with-actions,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait].mtx-datetimepicker-content-container-with-time-input{height:124vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}}\n"] }]
|
|
2361
|
+
}], ctorParameters: () => [], propDecorators: { _calendar: [{
|
|
2251
2362
|
type: ViewChild,
|
|
2252
2363
|
args: [MtxCalendar, { static: true }]
|
|
2253
2364
|
}], color: [{
|
|
@@ -2276,12 +2387,12 @@ class MtxDatetimepicker {
|
|
|
2276
2387
|
set color(value) {
|
|
2277
2388
|
this._color = value;
|
|
2278
2389
|
}
|
|
2279
|
-
constructor(
|
|
2280
|
-
this._overlay =
|
|
2281
|
-
this._viewContainerRef =
|
|
2282
|
-
this._scrollStrategy =
|
|
2283
|
-
this._dateAdapter =
|
|
2284
|
-
this._dir =
|
|
2390
|
+
constructor() {
|
|
2391
|
+
this._overlay = inject(Overlay);
|
|
2392
|
+
this._viewContainerRef = inject(ViewContainerRef);
|
|
2393
|
+
this._scrollStrategy = inject(MTX_DATETIMEPICKER_SCROLL_STRATEGY);
|
|
2394
|
+
this._dateAdapter = inject(DatetimeAdapter, { optional: true });
|
|
2395
|
+
this._dir = inject(Directionality, { optional: true });
|
|
2285
2396
|
this._document = inject(DOCUMENT);
|
|
2286
2397
|
this._injector = inject(Injector);
|
|
2287
2398
|
/** Whether to show multi-year view. */
|
|
@@ -2524,7 +2635,7 @@ class MtxDatetimepicker {
|
|
|
2524
2635
|
isDialog ? 'cdk-overlay-dark-backdrop' : 'mat-overlay-transparent-backdrop',
|
|
2525
2636
|
this._backdropHarnessClass,
|
|
2526
2637
|
],
|
|
2527
|
-
direction: this._dir,
|
|
2638
|
+
direction: this._dir || undefined,
|
|
2528
2639
|
scrollStrategy: isDialog ? this._overlay.scrollStrategies.block() : this._scrollStrategy(),
|
|
2529
2640
|
panelClass: `mtx-datetimepicker-${isDialog ? 'dialog' : 'popup'}`,
|
|
2530
2641
|
})));
|
|
@@ -2640,10 +2751,10 @@ class MtxDatetimepicker {
|
|
|
2640
2751
|
this._componentRef?.instance._assignActions(null, true);
|
|
2641
2752
|
}
|
|
2642
2753
|
}
|
|
2643
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2644
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "
|
|
2754
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2755
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.0.4", type: MtxDatetimepicker, isStandalone: true, selector: "mtx-datetimepicker", inputs: { multiYearSelector: ["multiYearSelector", "multiYearSelector", booleanAttribute], twelvehour: ["twelvehour", "twelvehour", booleanAttribute], startView: "startView", mode: "mode", timeInterval: "timeInterval", preventSameDateTimeSelection: ["preventSameDateTimeSelection", "preventSameDateTimeSelection", booleanAttribute], calendarHeaderComponent: "calendarHeaderComponent", panelClass: "panelClass", opened: ["opened", "opened", booleanAttribute], color: "color", startAt: "startAt", type: "type", touchUi: ["touchUi", "touchUi", booleanAttribute], timeInput: ["timeInput", "timeInput", booleanAttribute], timeInputAutoFocus: ["timeInputAutoFocus", "timeInputAutoFocus", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], xPosition: "xPosition", yPosition: "yPosition", restoreFocus: ["restoreFocus", "restoreFocus", booleanAttribute] }, outputs: { selectedChanged: "selectedChanged", openedStream: "opened", closedStream: "closed", viewChanged: "viewChanged" }, exportAs: ["mtxDatetimepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2645
2756
|
}
|
|
2646
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepicker, decorators: [{
|
|
2647
2758
|
type: Component,
|
|
2648
2759
|
args: [{
|
|
2649
2760
|
selector: 'mtx-datetimepicker',
|
|
@@ -2652,16 +2763,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
2652
2763
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2653
2764
|
encapsulation: ViewEncapsulation.None,
|
|
2654
2765
|
preserveWhitespaces: false,
|
|
2655
|
-
standalone: true,
|
|
2656
2766
|
}]
|
|
2657
|
-
}], ctorParameters: () => [
|
|
2658
|
-
type: Inject,
|
|
2659
|
-
args: [MTX_DATETIMEPICKER_SCROLL_STRATEGY]
|
|
2660
|
-
}] }, { type: i1.DatetimeAdapter, decorators: [{
|
|
2661
|
-
type: Optional
|
|
2662
|
-
}] }, { type: i3.Directionality, decorators: [{
|
|
2663
|
-
type: Optional
|
|
2664
|
-
}] }], propDecorators: { multiYearSelector: [{
|
|
2767
|
+
}], ctorParameters: () => [], propDecorators: { multiYearSelector: [{
|
|
2665
2768
|
type: Input,
|
|
2666
2769
|
args: [{ transform: booleanAttribute }]
|
|
2667
2770
|
}], twelvehour: [{
|
|
@@ -2744,11 +2847,11 @@ class MtxDatetimepickerInputEvent {
|
|
|
2744
2847
|
}
|
|
2745
2848
|
/** Directive used to connect an input to a MtxDatetimepicker. */
|
|
2746
2849
|
class MtxDatetimepickerInput {
|
|
2747
|
-
constructor(
|
|
2748
|
-
this._elementRef =
|
|
2749
|
-
this._dateAdapter =
|
|
2750
|
-
this._dateFormats =
|
|
2751
|
-
this._formField =
|
|
2850
|
+
constructor() {
|
|
2851
|
+
this._elementRef = inject(ElementRef);
|
|
2852
|
+
this._dateAdapter = inject(DatetimeAdapter, { optional: true });
|
|
2853
|
+
this._dateFormats = inject(MTX_DATETIME_FORMATS, { optional: true });
|
|
2854
|
+
this._formField = inject(MatFormField, { optional: true });
|
|
2752
2855
|
/** Emits when a `change` event is fired on this `<input>`. */
|
|
2753
2856
|
this.dateChange = new EventEmitter();
|
|
2754
2857
|
/** Emits when an `input` event is fired on this `<input>`. */
|
|
@@ -2804,6 +2907,7 @@ class MtxDatetimepickerInput {
|
|
|
2804
2907
|
this._maxValidator,
|
|
2805
2908
|
this._filterValidator,
|
|
2806
2909
|
]);
|
|
2910
|
+
const _dateAdapter = this._dateAdapter;
|
|
2807
2911
|
if (!this._dateAdapter) {
|
|
2808
2912
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
2809
2913
|
}
|
|
@@ -3000,14 +3104,14 @@ class MtxDatetimepickerInput {
|
|
|
3000
3104
|
getThemePalette() {
|
|
3001
3105
|
return this._formField ? this._formField.color : undefined;
|
|
3002
3106
|
}
|
|
3003
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3004
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "
|
|
3107
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3108
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.4", type: MtxDatetimepickerInput, isStandalone: true, selector: "input[mtxDatetimepicker]", inputs: { mtxDatetimepicker: "mtxDatetimepicker", mtxDatetimepickerFilter: "mtxDatetimepickerFilter", value: "value", min: "min", max: "max", disabled: ["disabled", "disabled", booleanAttribute] }, 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 ? _dateAdapter.toIso8601(min) : null", "attr.max": "max ? _dateAdapter.toIso8601(max) : null", "disabled": "disabled" } }, providers: [
|
|
3005
3109
|
MAT_DATETIMEPICKER_VALUE_ACCESSOR,
|
|
3006
3110
|
MAT_DATETIMEPICKER_VALIDATORS,
|
|
3007
3111
|
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxDatetimepickerInput },
|
|
3008
3112
|
], exportAs: ["mtxDatetimepickerInput"], ngImport: i0 }); }
|
|
3009
3113
|
}
|
|
3010
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerInput, decorators: [{
|
|
3011
3115
|
type: Directive,
|
|
3012
3116
|
args: [{
|
|
3013
3117
|
selector: 'input[mtxDatetimepicker]',
|
|
@@ -3028,18 +3132,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3028
3132
|
'(keydown)': '_onKeydown($event)',
|
|
3029
3133
|
},
|
|
3030
3134
|
exportAs: 'mtxDatetimepickerInput',
|
|
3031
|
-
standalone: true,
|
|
3032
3135
|
}]
|
|
3033
|
-
}], ctorParameters: () => [
|
|
3034
|
-
type: Optional
|
|
3035
|
-
}] }, { type: undefined, decorators: [{
|
|
3036
|
-
type: Optional
|
|
3037
|
-
}, {
|
|
3038
|
-
type: Inject,
|
|
3039
|
-
args: [MTX_DATETIME_FORMATS]
|
|
3040
|
-
}] }, { type: i2.MatFormField, decorators: [{
|
|
3041
|
-
type: Optional
|
|
3042
|
-
}] }], propDecorators: { dateChange: [{
|
|
3136
|
+
}], ctorParameters: () => [], propDecorators: { dateChange: [{
|
|
3043
3137
|
type: Output
|
|
3044
3138
|
}], dateInput: [{
|
|
3045
3139
|
type: Output
|
|
@@ -3060,14 +3154,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3060
3154
|
|
|
3061
3155
|
/** Can be used to override the icon of a `mtxDatetimepickerToggle`. */
|
|
3062
3156
|
class MtxDatetimepickerToggleIcon {
|
|
3063
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3064
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3157
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3158
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerToggleIcon, isStandalone: true, selector: "[mtxDatetimepickerToggleIcon]", ngImport: i0 }); }
|
|
3065
3159
|
}
|
|
3066
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerToggleIcon, decorators: [{
|
|
3067
3161
|
type: Directive,
|
|
3068
3162
|
args: [{
|
|
3069
3163
|
selector: '[mtxDatetimepickerToggleIcon]',
|
|
3070
|
-
standalone: true,
|
|
3071
3164
|
}]
|
|
3072
3165
|
}] });
|
|
3073
3166
|
class MtxDatetimepickerToggle {
|
|
@@ -3078,10 +3171,11 @@ class MtxDatetimepickerToggle {
|
|
|
3078
3171
|
set disabled(value) {
|
|
3079
3172
|
this._disabled = value;
|
|
3080
3173
|
}
|
|
3081
|
-
constructor(
|
|
3082
|
-
this._intl =
|
|
3083
|
-
this._changeDetectorRef =
|
|
3174
|
+
constructor() {
|
|
3175
|
+
this._intl = inject(MtxDatetimepickerIntl);
|
|
3176
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
3084
3177
|
this._stateChanges = Subscription.EMPTY;
|
|
3178
|
+
const defaultTabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
|
|
3085
3179
|
const parsedTabIndex = Number(defaultTabIndex);
|
|
3086
3180
|
this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
|
|
3087
3181
|
}
|
|
@@ -3115,10 +3209,10 @@ class MtxDatetimepickerToggle {
|
|
|
3115
3209
|
this._stateChanges.unsubscribe();
|
|
3116
3210
|
this._stateChanges = merge(this._intl.changes, datetimepickerDisabled, inputDisabled, datetimepickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
3117
3211
|
}
|
|
3118
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3119
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
3212
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerToggle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3213
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: MtxDatetimepickerToggle, isStandalone: true, selector: "mtx-datetimepicker-toggle", inputs: { datetimepicker: ["for", "datetimepicker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mtx-datetimepicker-toggle-active": "datetimepicker && datetimepicker.opened", "class.mat-accent": "datetimepicker && datetimepicker.color === \"accent\"", "class.mat-warn": "datetimepicker && datetimepicker.color === \"warn\"", "attr.data-mtx-calendar": "datetimepicker ? datetimepicker.id : null" }, classAttribute: "mtx-datetimepicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxDatetimepickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxDatetimepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datetimepicker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel || _intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n @switch (datetimepicker.type) {\n @case ('time') {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path 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\" />\n </svg>\n }\n @case ('datetime') {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path 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\" />\n </svg>\n }\n @default {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path 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\" />\n </svg>\n }\n }\n }\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-datetimepicker-toggle{pointer-events:auto;color:var(--mtx-datetimepicker-toggle-icon-color, var(--mat-sys-on-surface-variant))}.mtx-datetimepicker-toggle-active{color:var(--mtx-datetimepicker-toggle-active-state-icon-color, var(--mat-sys-on-surface-variant))}@media (forced-colors: active){.mtx-datetimepicker-toggle-default-icon{color:CanvasText}}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
3120
3214
|
}
|
|
3121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerToggle, decorators: [{
|
|
3122
3216
|
type: Component,
|
|
3123
3217
|
args: [{ selector: 'mtx-datetimepicker-toggle', host: {
|
|
3124
3218
|
'class': 'mtx-datetimepicker-toggle',
|
|
@@ -3132,11 +3226,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3132
3226
|
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
3133
3227
|
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
3134
3228
|
'(click)': '_open($event)',
|
|
3135
|
-
}, exportAs: 'mtxDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3136
|
-
}], ctorParameters: () => [
|
|
3137
|
-
type: Attribute,
|
|
3138
|
-
args: ['tabindex']
|
|
3139
|
-
}] }], propDecorators: { datetimepicker: [{
|
|
3229
|
+
}, exportAs: 'mtxDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIconButton], template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datetimepicker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel || _intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n @switch (datetimepicker.type) {\n @case ('time') {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path 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\" />\n </svg>\n }\n @case ('datetime') {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path 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\" />\n </svg>\n }\n @default {\n <svg\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path 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\" />\n </svg>\n }\n }\n }\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-datetimepicker-toggle{pointer-events:auto;color:var(--mtx-datetimepicker-toggle-icon-color, var(--mat-sys-on-surface-variant))}.mtx-datetimepicker-toggle-active{color:var(--mtx-datetimepicker-toggle-active-state-icon-color, var(--mat-sys-on-surface-variant))}@media (forced-colors: active){.mtx-datetimepicker-toggle-default-icon{color:CanvasText}}\n"] }]
|
|
3230
|
+
}], ctorParameters: () => [], propDecorators: { datetimepicker: [{
|
|
3140
3231
|
type: Input,
|
|
3141
3232
|
args: ['for']
|
|
3142
3233
|
}], tabIndex: [{
|
|
@@ -3159,54 +3250,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3159
3250
|
}] } });
|
|
3160
3251
|
|
|
3161
3252
|
class MtxDatetimepickerApply {
|
|
3162
|
-
constructor(
|
|
3163
|
-
this._datetimepicker =
|
|
3253
|
+
constructor() {
|
|
3254
|
+
this._datetimepicker = inject(MtxDatetimepicker);
|
|
3164
3255
|
}
|
|
3165
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3166
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3256
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerApply, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3257
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerApply, isStandalone: true, selector: "[mtxDatetimepickerApply]", host: { listeners: { "click": "_datetimepicker._selectManually()" } }, ngImport: i0 }); }
|
|
3167
3258
|
}
|
|
3168
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerApply, decorators: [{
|
|
3169
3260
|
type: Directive,
|
|
3170
3261
|
args: [{
|
|
3171
3262
|
selector: '[mtxDatetimepickerApply]',
|
|
3172
3263
|
host: { '(click)': '_datetimepicker._selectManually()' },
|
|
3173
|
-
standalone: true,
|
|
3174
3264
|
}]
|
|
3175
|
-
}], ctorParameters: () => [
|
|
3265
|
+
}], ctorParameters: () => [] });
|
|
3176
3266
|
class MtxDatetimepickerCancel {
|
|
3177
|
-
constructor(
|
|
3178
|
-
this._datetimepicker =
|
|
3267
|
+
constructor() {
|
|
3268
|
+
this._datetimepicker = inject(MtxDatetimepicker);
|
|
3179
3269
|
}
|
|
3180
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3181
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3270
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerCancel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3271
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerCancel, isStandalone: true, selector: "[mtxDatetimepickerCancel]", host: { listeners: { "click": "_datetimepicker.close()" } }, ngImport: i0 }); }
|
|
3182
3272
|
}
|
|
3183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerCancel, decorators: [{
|
|
3184
3274
|
type: Directive,
|
|
3185
3275
|
args: [{
|
|
3186
3276
|
selector: '[mtxDatetimepickerCancel]',
|
|
3187
3277
|
host: { '(click)': '_datetimepicker.close()' },
|
|
3188
|
-
standalone: true,
|
|
3189
3278
|
}]
|
|
3190
|
-
}], ctorParameters: () => [
|
|
3279
|
+
}], ctorParameters: () => [] });
|
|
3191
3280
|
class MtxDatetimepickerClear {
|
|
3192
|
-
constructor(
|
|
3193
|
-
this._datetimepicker =
|
|
3281
|
+
constructor() {
|
|
3282
|
+
this._datetimepicker = inject(MtxDatetimepicker);
|
|
3194
3283
|
}
|
|
3195
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3196
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
3284
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerClear, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3285
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerClear, isStandalone: true, selector: "[mtxDatetimepickerClear]", host: { listeners: { "click": "_datetimepicker._clearSelected()" } }, ngImport: i0 }); }
|
|
3197
3286
|
}
|
|
3198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerClear, decorators: [{
|
|
3199
3288
|
type: Directive,
|
|
3200
3289
|
args: [{
|
|
3201
3290
|
selector: '[mtxDatetimepickerClear]',
|
|
3202
3291
|
host: { '(click)': '_datetimepicker._clearSelected()' },
|
|
3203
|
-
standalone: true,
|
|
3204
3292
|
}]
|
|
3205
|
-
}], ctorParameters: () => [
|
|
3293
|
+
}], ctorParameters: () => [] });
|
|
3206
3294
|
class MtxDatetimepickerActions {
|
|
3207
|
-
constructor(
|
|
3208
|
-
this._datetimepicker =
|
|
3209
|
-
this._viewContainerRef =
|
|
3295
|
+
constructor() {
|
|
3296
|
+
this._datetimepicker = inject(MtxDatetimepicker);
|
|
3297
|
+
this._viewContainerRef = inject(ViewContainerRef);
|
|
3210
3298
|
}
|
|
3211
3299
|
ngAfterViewInit() {
|
|
3212
3300
|
this._portal = new TemplatePortal(this._template, this._viewContainerRef);
|
|
@@ -3219,8 +3307,8 @@ class MtxDatetimepickerActions {
|
|
|
3219
3307
|
this._portal?.detach();
|
|
3220
3308
|
}
|
|
3221
3309
|
}
|
|
3222
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3223
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
3310
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerActions, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3311
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: MtxDatetimepickerActions, isStandalone: true, selector: "mtx-datetimepicker-actions", viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0, template: `
|
|
3224
3312
|
<ng-template>
|
|
3225
3313
|
<div class="mtx-datetimepicker-actions">
|
|
3226
3314
|
<ng-content></ng-content>
|
|
@@ -3228,7 +3316,7 @@ class MtxDatetimepickerActions {
|
|
|
3228
3316
|
</ng-template>
|
|
3229
3317
|
`, isInline: true, styles: [".mtx-datetimepicker-actions{position:relative;display:flex;justify-content:flex-end;align-items:center;padding:0 8px 8px}.mtx-datetimepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mtx-datetimepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
3230
3318
|
}
|
|
3231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerActions, decorators: [{
|
|
3232
3320
|
type: Component,
|
|
3233
3321
|
args: [{ selector: 'mtx-datetimepicker-actions', template: `
|
|
3234
3322
|
<ng-template>
|
|
@@ -3236,15 +3324,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3236
3324
|
<ng-content></ng-content>
|
|
3237
3325
|
</div>
|
|
3238
3326
|
</ng-template>
|
|
3239
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None,
|
|
3240
|
-
}], ctorParameters: () => [
|
|
3327
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: [".mtx-datetimepicker-actions{position:relative;display:flex;justify-content:flex-end;align-items:center;padding:0 8px 8px}.mtx-datetimepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mtx-datetimepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"] }]
|
|
3328
|
+
}], ctorParameters: () => [], propDecorators: { _template: [{
|
|
3241
3329
|
type: ViewChild,
|
|
3242
3330
|
args: [TemplateRef]
|
|
3243
3331
|
}] } });
|
|
3244
3332
|
|
|
3245
3333
|
class MtxDatetimepickerModule {
|
|
3246
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3247
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
3334
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3335
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerModule, imports: [CommonModule,
|
|
3248
3336
|
OverlayModule,
|
|
3249
3337
|
A11yModule,
|
|
3250
3338
|
PortalModule,
|
|
@@ -3252,7 +3340,7 @@ class MtxDatetimepickerModule {
|
|
|
3252
3340
|
MtxCalendar,
|
|
3253
3341
|
MtxCalendarBody,
|
|
3254
3342
|
MtxClock,
|
|
3255
|
-
|
|
3343
|
+
MtxTimeView,
|
|
3256
3344
|
MtxTimeInput,
|
|
3257
3345
|
MtxDatetimepicker,
|
|
3258
3346
|
MtxDatetimepickerToggle,
|
|
@@ -3268,7 +3356,7 @@ class MtxDatetimepickerModule {
|
|
|
3268
3356
|
MtxDatetimepickerActions], exports: [MtxCalendar,
|
|
3269
3357
|
MtxCalendarBody,
|
|
3270
3358
|
MtxClock,
|
|
3271
|
-
|
|
3359
|
+
MtxTimeView,
|
|
3272
3360
|
MtxDatetimepicker,
|
|
3273
3361
|
MtxDatetimepickerToggle,
|
|
3274
3362
|
MtxDatetimepickerToggleIcon,
|
|
@@ -3281,17 +3369,17 @@ class MtxDatetimepickerModule {
|
|
|
3281
3369
|
MtxDatetimepickerCancel,
|
|
3282
3370
|
MtxDatetimepickerClear,
|
|
3283
3371
|
MtxDatetimepickerActions] }); }
|
|
3284
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
3372
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerModule, providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [CommonModule,
|
|
3285
3373
|
OverlayModule,
|
|
3286
3374
|
A11yModule,
|
|
3287
3375
|
PortalModule,
|
|
3288
3376
|
MatButtonModule,
|
|
3289
3377
|
MtxCalendar,
|
|
3290
|
-
|
|
3378
|
+
MtxTimeView,
|
|
3291
3379
|
MtxDatetimepickerToggle,
|
|
3292
3380
|
MtxDatetimepickerContent] }); }
|
|
3293
3381
|
}
|
|
3294
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: MtxDatetimepickerModule, decorators: [{
|
|
3295
3383
|
type: NgModule,
|
|
3296
3384
|
args: [{
|
|
3297
3385
|
imports: [
|
|
@@ -3303,7 +3391,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3303
3391
|
MtxCalendar,
|
|
3304
3392
|
MtxCalendarBody,
|
|
3305
3393
|
MtxClock,
|
|
3306
|
-
|
|
3394
|
+
MtxTimeView,
|
|
3307
3395
|
MtxTimeInput,
|
|
3308
3396
|
MtxDatetimepicker,
|
|
3309
3397
|
MtxDatetimepickerToggle,
|
|
@@ -3322,7 +3410,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3322
3410
|
MtxCalendar,
|
|
3323
3411
|
MtxCalendarBody,
|
|
3324
3412
|
MtxClock,
|
|
3325
|
-
|
|
3413
|
+
MtxTimeView,
|
|
3326
3414
|
MtxDatetimepicker,
|
|
3327
3415
|
MtxDatetimepickerToggle,
|
|
3328
3416
|
MtxDatetimepickerToggleIcon,
|
|
@@ -3344,5 +3432,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
|
|
|
3344
3432
|
* Generated bundle index. Do not edit.
|
|
3345
3433
|
*/
|
|
3346
3434
|
|
|
3347
|
-
export { CLOCK_INNER_RADIUS, CLOCK_OUTER_RADIUS, CLOCK_RADIUS, CLOCK_TICK_RADIUS, MAT_DATETIMEPICKER_VALIDATORS, MAT_DATETIMEPICKER_VALUE_ACCESSOR, MTX_DATETIMEPICKER_SCROLL_STRATEGY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MtxCalendar, MtxCalendarBody, MtxCalendarCell, MtxClock, MtxDatetimepicker, MtxDatetimepickerActions, MtxDatetimepickerApply, MtxDatetimepickerCancel, MtxDatetimepickerClear, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerIntl, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView,
|
|
3435
|
+
export { CLOCK_INNER_RADIUS, CLOCK_OUTER_RADIUS, CLOCK_RADIUS, CLOCK_TICK_RADIUS, MAT_DATETIMEPICKER_VALIDATORS, MAT_DATETIMEPICKER_VALUE_ACCESSOR, MTX_DATETIMEPICKER_SCROLL_STRATEGY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MtxCalendar, MtxCalendarBody, MtxCalendarCell, MtxClock, MtxDatetimepicker, MtxDatetimepickerActions, MtxDatetimepickerApply, MtxDatetimepickerCancel, MtxDatetimepickerClear, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerIntl, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView, MtxTimeInput, MtxTimeView, MtxYearView, getActiveOffset, isSameMultiYearView, mtxDatetimepickerAnimations, yearsPerPage, yearsPerRow };
|
|
3348
3436
|
//# sourceMappingURL=mtxDatetimepicker.mjs.map
|