@ng-matero/extensions 14.5.0 → 14.6.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/core/datetime/datetime-adapter.d.ts +1 -1
- package/datetimepicker/_datetimepicker-theme.scss +40 -12
- package/datetimepicker/calendar.d.ts +28 -17
- package/datetimepicker/calendar.scss +73 -91
- package/datetimepicker/clock.d.ts +27 -14
- package/datetimepicker/clock.scss +2 -1
- package/datetimepicker/datetimepicker-content.scss +21 -6
- package/datetimepicker/datetimepicker-intl.d.ts +51 -0
- package/datetimepicker/datetimepicker-module.d.ts +13 -12
- package/datetimepicker/datetimepicker-toggle.d.ts +6 -4
- package/datetimepicker/datetimepicker-types.d.ts +4 -0
- package/datetimepicker/datetimepicker.d.ts +13 -3
- package/datetimepicker/public-api.d.ts +1 -0
- package/datetimepicker/time.d.ts +130 -0
- package/datetimepicker/time.scss +81 -0
- package/esm2020/core/datetime/datetime-adapter.mjs +1 -1
- package/esm2020/datetimepicker/calendar-body.mjs +3 -3
- package/esm2020/datetimepicker/calendar.mjs +81 -33
- package/esm2020/datetimepicker/clock.mjs +96 -45
- package/esm2020/datetimepicker/datetimepicker-intl.mjs +63 -0
- package/esm2020/datetimepicker/datetimepicker-module.mjs +8 -1
- package/esm2020/datetimepicker/datetimepicker-toggle.mjs +9 -6
- package/esm2020/datetimepicker/datetimepicker-types.mjs +1 -1
- package/esm2020/datetimepicker/datetimepicker.mjs +22 -6
- package/esm2020/datetimepicker/public-api.mjs +2 -1
- package/esm2020/datetimepicker/time.mjs +453 -0
- package/esm2020/grid/grid.interface.mjs +1 -1
- package/fesm2015/mtxCore.mjs.map +1 -1
- package/fesm2015/mtxDatetimepicker.mjs +720 -91
- package/fesm2015/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2020/mtxCore.mjs.map +1 -1
- package/fesm2020/mtxDatetimepicker.mjs +715 -91
- package/fesm2020/mtxDatetimepicker.mjs.map +1 -1
- package/grid/grid.interface.d.ts +0 -1
- package/package.json +1 -1
|
@@ -6,19 +6,18 @@ import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
|
6
6
|
import * as i2 from '@angular/common';
|
|
7
7
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject,
|
|
9
|
+
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, Injectable, Directive, ElementRef, ViewChild, InjectionToken, inject, forwardRef, ContentChild, NgModule } from '@angular/core';
|
|
10
10
|
import * as i4 from '@angular/material/button';
|
|
11
11
|
import { MatButtonModule } from '@angular/material/button';
|
|
12
|
-
import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME,
|
|
13
|
-
import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
12
|
+
import { UP_ARROW, DOWN_ARROW, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
13
|
+
import { coerceNumberProperty, coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
14
14
|
import { first, take, filter } from 'rxjs/operators';
|
|
15
15
|
import * as i1 from '@ng-matero/extensions/core';
|
|
16
16
|
import { MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
|
|
17
17
|
import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
|
|
18
|
-
import * as i1$1 from '@angular/material/datepicker';
|
|
19
|
-
import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
20
|
-
import { mixinColor } from '@angular/material/core';
|
|
21
18
|
import { Subject, Subscription, merge, of } from 'rxjs';
|
|
19
|
+
import { normalizePassiveListenerOptions, _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
20
|
+
import { mixinColor } from '@angular/material/core';
|
|
22
21
|
import * as i6 from '@angular/cdk/bidi';
|
|
23
22
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
|
24
23
|
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
@@ -130,12 +129,12 @@ class MtxCalendarBody {
|
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
/** @nocollapse */ MtxCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
133
|
-
/** @nocollapse */ MtxCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: { label: "label", rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", allowDisabledSelection: "allowDisabledSelection", activeCell: "activeCell" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { classAttribute: "mtx-calendar-body" }, exportAs: ["mtxCalendarBody"], 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<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td
|
|
132
|
+
/** @nocollapse */ MtxCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: { label: "label", rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", allowDisabledSelection: "allowDisabledSelection", activeCell: "activeCell" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { classAttribute: "mtx-calendar-body" }, exportAs: ["mtxCalendarBody"], 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<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td class=\"mtx-calendar-body-label\" [attr.colspan]=\"numCols\">{{ label }}</td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" 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 <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n class=\"mtx-calendar-body-label\" [attr.colspan]=\"_firstRowOffset\" aria-hidden=\"true\">\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\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</tr>\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%}[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-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
134
133
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxCalendarBody, decorators: [{
|
|
135
134
|
type: Component,
|
|
136
135
|
args: [{ selector: '[mtx-calendar-body]', host: {
|
|
137
136
|
class: 'mtx-calendar-body',
|
|
138
|
-
}, 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<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td
|
|
137
|
+
}, 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<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td class=\"mtx-calendar-body-label\" [attr.colspan]=\"numCols\">{{ label }}</td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" 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 <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n class=\"mtx-calendar-body-label\" [attr.colspan]=\"_firstRowOffset\" aria-hidden=\"true\">\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\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</tr>\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%}[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-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"] }]
|
|
139
138
|
}], propDecorators: { label: [{
|
|
140
139
|
type: Input
|
|
141
140
|
}], rows: [{
|
|
@@ -362,6 +361,67 @@ function euclideanModulo(a, b) {
|
|
|
362
361
|
return ((a % b) + b) % b;
|
|
363
362
|
}
|
|
364
363
|
|
|
364
|
+
class MtxDatetimepickerIntl {
|
|
365
|
+
constructor() {
|
|
366
|
+
/**
|
|
367
|
+
* Stream to emit from when labels are changed. Use this to notify components when the labels have
|
|
368
|
+
* changed after initialization.
|
|
369
|
+
*/
|
|
370
|
+
this.changes = new Subject();
|
|
371
|
+
/** A label for the calendar popup (used by screen readers). */
|
|
372
|
+
this.calendarLabel = 'Calendar';
|
|
373
|
+
/** A label for the button used to open the calendar popup (used by screen readers). */
|
|
374
|
+
this.openCalendarLabel = 'Open calendar';
|
|
375
|
+
/** Label for the button used to close the calendar popup. */
|
|
376
|
+
this.closeCalendarLabel = 'Close calendar';
|
|
377
|
+
/** A label for the previous month button (used by screen readers). */
|
|
378
|
+
this.prevMonthLabel = 'Previous month';
|
|
379
|
+
/** A label for the next month button (used by screen readers). */
|
|
380
|
+
this.nextMonthLabel = 'Next month';
|
|
381
|
+
/** A label for the previous year button (used by screen readers). */
|
|
382
|
+
this.prevYearLabel = 'Previous year';
|
|
383
|
+
/** A label for the next year button (used by screen readers). */
|
|
384
|
+
this.nextYearLabel = 'Next year';
|
|
385
|
+
/** A label for the previous multi-year button (used by screen readers). */
|
|
386
|
+
this.prevMultiYearLabel = 'Previous 24 years';
|
|
387
|
+
/** A label for the next multi-year button (used by screen readers). */
|
|
388
|
+
this.nextMultiYearLabel = 'Next 24 years';
|
|
389
|
+
/** A label for the 'switch to month view' button (used by screen readers). */
|
|
390
|
+
this.switchToMonthViewLabel = 'Choose date';
|
|
391
|
+
/** A label for the 'switch to year view' button (used by screen readers). */
|
|
392
|
+
this.switchToYearViewLabel = 'Choose month';
|
|
393
|
+
/** A label for the 'switch to multi-year view' button (used by screen readers). */
|
|
394
|
+
this.switchToMultiYearViewLabel = 'Choose month and year';
|
|
395
|
+
/** A label for the first date of a range of dates (used by screen readers). */
|
|
396
|
+
this.startDateLabel = 'Start date';
|
|
397
|
+
/** A label for the last date of a range of dates (used by screen readers). */
|
|
398
|
+
this.endDateLabel = 'End date';
|
|
399
|
+
/** A label for the 'switch to clock hour view' button (used by screen readers). */
|
|
400
|
+
this.switchToClockHourViewLabel = 'Choose hour';
|
|
401
|
+
/** A label for the 'switch to clock minute view' button (used by screen readers). */
|
|
402
|
+
this.switchToClockMinuteViewLabel = 'Choose minute';
|
|
403
|
+
/** Label used for ok button within the manual time input. */
|
|
404
|
+
this.okLabel = 'OK';
|
|
405
|
+
/** Label used for cancel button within the manual time input. */
|
|
406
|
+
this.cancelLabel = 'Cancel';
|
|
407
|
+
}
|
|
408
|
+
/** Formats a range of years (used for visuals). */
|
|
409
|
+
formatYearRange(start, end) {
|
|
410
|
+
return `${start} \u2013 ${end}`;
|
|
411
|
+
}
|
|
412
|
+
/** Formats a label for a range of years (used by screen readers). */
|
|
413
|
+
formatYearRangeLabel(start, end) {
|
|
414
|
+
return `${start} to ${end}`;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/** @nocollapse */ MtxDatetimepickerIntl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
418
|
+
/** @nocollapse */ MtxDatetimepickerIntl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerIntl, providedIn: 'root' });
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerIntl, decorators: [{
|
|
420
|
+
type: Injectable,
|
|
421
|
+
args: [{ providedIn: 'root' }]
|
|
422
|
+
}] });
|
|
423
|
+
|
|
424
|
+
const activeEventOptions = normalizePassiveListenerOptions({ passive: false });
|
|
365
425
|
const CLOCK_RADIUS = 50;
|
|
366
426
|
const CLOCK_INNER_RADIUS = 27.5;
|
|
367
427
|
const CLOCK_OUTER_RADIUS = 41.25;
|
|
@@ -371,9 +431,11 @@ const CLOCK_TICK_RADIUS = 7.0833;
|
|
|
371
431
|
* @docs-private
|
|
372
432
|
*/
|
|
373
433
|
class MtxClock {
|
|
374
|
-
constructor(
|
|
375
|
-
this.
|
|
434
|
+
constructor(_elementRef, _adapter, _changeDetectorRef, _document) {
|
|
435
|
+
this._elementRef = _elementRef;
|
|
376
436
|
this._adapter = _adapter;
|
|
437
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
438
|
+
this._document = _document;
|
|
377
439
|
/** Step over minutes. */
|
|
378
440
|
this.interval = 1;
|
|
379
441
|
/** Whether the clock uses 12 hour format. */
|
|
@@ -384,17 +446,39 @@ class MtxClock {
|
|
|
384
446
|
this.activeDateChange = new EventEmitter();
|
|
385
447
|
/** Emits when any date is selected. */
|
|
386
448
|
this._userSelection = new EventEmitter();
|
|
387
|
-
/** Hours and Minutes representing the clock view. */
|
|
388
|
-
this._hours = [];
|
|
389
|
-
this._minutes = [];
|
|
390
449
|
/** Whether the clock is in hour view. */
|
|
391
450
|
this._hourView = true;
|
|
451
|
+
this._hours = [];
|
|
452
|
+
this._minutes = [];
|
|
392
453
|
this._timeChanged = false;
|
|
393
|
-
|
|
394
|
-
|
|
454
|
+
/** Called when the user has put their pointer down on the clock. */
|
|
455
|
+
this._pointerDown = (event) => {
|
|
456
|
+
this._timeChanged = false;
|
|
457
|
+
this.setTime(event);
|
|
458
|
+
this._bindGlobalEvents(event);
|
|
395
459
|
};
|
|
396
|
-
|
|
397
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Called when the user has moved their pointer after
|
|
462
|
+
* starting to drag. Bound on the document level.
|
|
463
|
+
*/
|
|
464
|
+
this._pointerMove = (event) => {
|
|
465
|
+
if (event.cancelable) {
|
|
466
|
+
event.preventDefault();
|
|
467
|
+
}
|
|
468
|
+
this.setTime(event);
|
|
469
|
+
};
|
|
470
|
+
/** Called when the user has lifted their pointer. Bound on the document level. */
|
|
471
|
+
this._pointerUp = (event) => {
|
|
472
|
+
if (event.cancelable) {
|
|
473
|
+
event.preventDefault();
|
|
474
|
+
}
|
|
475
|
+
this._removeGlobalEvents();
|
|
476
|
+
if (this._timeChanged) {
|
|
477
|
+
this.selectedChange.emit(this.activeDate);
|
|
478
|
+
if (!this._hourView) {
|
|
479
|
+
this._userSelection.emit();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
398
482
|
};
|
|
399
483
|
}
|
|
400
484
|
/**
|
|
@@ -464,39 +548,40 @@ class MtxClock {
|
|
|
464
548
|
deg = Math.round(this._selectedMinute * (360 / 60));
|
|
465
549
|
}
|
|
466
550
|
return {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
551
|
+
height: `${radius}%`,
|
|
552
|
+
marginTop: `${50 - radius}%`,
|
|
553
|
+
transform: `rotate(${deg}deg)`,
|
|
470
554
|
};
|
|
471
555
|
}
|
|
472
556
|
ngAfterContentInit() {
|
|
473
557
|
this.activeDate = this._activeDate || this._adapter.today();
|
|
474
558
|
this._init();
|
|
475
559
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
document
|
|
482
|
-
|
|
483
|
-
document
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this.
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
560
|
+
ngOnDestroy() {
|
|
561
|
+
this._removeGlobalEvents();
|
|
562
|
+
}
|
|
563
|
+
/** Binds our global move and end events. */
|
|
564
|
+
_bindGlobalEvents(triggerEvent) {
|
|
565
|
+
// Note that we bind the events to the `document`, because it allows us to capture
|
|
566
|
+
// drag cancel events where the user's pointer is outside the browser window.
|
|
567
|
+
const document = this._document;
|
|
568
|
+
const isTouch = isTouchEvent(triggerEvent);
|
|
569
|
+
const moveEventName = isTouch ? 'touchmove' : 'mousemove';
|
|
570
|
+
const endEventName = isTouch ? 'touchend' : 'mouseup';
|
|
571
|
+
document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
|
|
572
|
+
document.addEventListener(endEventName, this._pointerUp, activeEventOptions);
|
|
573
|
+
if (isTouch) {
|
|
574
|
+
document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
/** Removes any global event listeners that we may have added. */
|
|
578
|
+
_removeGlobalEvents() {
|
|
579
|
+
const document = this._document;
|
|
580
|
+
document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
|
|
581
|
+
document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
|
|
582
|
+
document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
|
|
583
|
+
document.removeEventListener('touchend', this._pointerUp, activeEventOptions);
|
|
584
|
+
document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
|
|
500
585
|
}
|
|
501
586
|
/** Initializes this clock view. */
|
|
502
587
|
_init() {
|
|
@@ -559,12 +644,11 @@ class MtxClock {
|
|
|
559
644
|
* @param event
|
|
560
645
|
*/
|
|
561
646
|
setTime(event) {
|
|
562
|
-
const trigger = this.
|
|
647
|
+
const trigger = this._elementRef.nativeElement;
|
|
563
648
|
const triggerRect = trigger.getBoundingClientRect();
|
|
564
649
|
const width = trigger.offsetWidth;
|
|
565
650
|
const height = trigger.offsetHeight;
|
|
566
|
-
const
|
|
567
|
-
const pageY = event.pageY !== undefined ? event.pageY : event.touches[0].pageY;
|
|
651
|
+
const { pageX, pageY } = getPointerPositionOnPage(event);
|
|
568
652
|
const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
|
|
569
653
|
const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
|
|
570
654
|
let radian = Math.atan2(-x, y);
|
|
@@ -600,19 +684,24 @@ class MtxClock {
|
|
|
600
684
|
}
|
|
601
685
|
this._timeChanged = true;
|
|
602
686
|
this.activeDate = date;
|
|
687
|
+
this._changeDetectorRef.markForCheck();
|
|
603
688
|
this.activeDateChange.emit(this.activeDate);
|
|
604
689
|
}
|
|
605
690
|
}
|
|
606
|
-
/** @nocollapse */ MtxClock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxClock, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
607
|
-
/** @nocollapse */ MtxClock.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxClock, selector: "mtx-clock", inputs: { dateFilter: "dateFilter", interval: "interval", twelvehour: "twelvehour", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", startView: "startView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection" }, host: { attributes: { "role": "clock" }, listeners: { "mousedown": "
|
|
691
|
+
/** @nocollapse */ MtxClock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxClock, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
692
|
+
/** @nocollapse */ MtxClock.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxClock, selector: "mtx-clock", inputs: { dateFilter: "dateFilter", interval: "interval", twelvehour: "twelvehour", 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"], ngImport: i0, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div class=\"mtx-clock-hand\" [ngStyle]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n <div *ngFor=\"let item of _hours\"\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 </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n <div *ngFor=\"let item of _minutes\"\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 </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}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.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}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
608
693
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxClock, decorators: [{
|
|
609
694
|
type: Component,
|
|
610
695
|
args: [{ selector: 'mtx-clock', host: {
|
|
611
|
-
'[class.mtx-clock]': 'true',
|
|
612
696
|
'role': 'clock',
|
|
613
|
-
'
|
|
614
|
-
|
|
615
|
-
|
|
697
|
+
'class': 'mtx-clock',
|
|
698
|
+
'(mousedown)': '_pointerDown($event)',
|
|
699
|
+
'(touchstart)': '_pointerDown($event)',
|
|
700
|
+
}, 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\" [ngStyle]=\"_hand\"></div>\n <div class=\"mtx-clock-hours\" [class.active]=\"_hourView\">\n <div *ngFor=\"let item of _hours\"\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 </div>\n <div class=\"mtx-clock-minutes\" [class.active]=\"!_hourView\">\n <div *ngFor=\"let item of _minutes\"\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 </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}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.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}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"] }]
|
|
701
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
702
|
+
type: Inject,
|
|
703
|
+
args: [DOCUMENT]
|
|
704
|
+
}] }]; }, propDecorators: { dateFilter: [{
|
|
616
705
|
type: Input
|
|
617
706
|
}], interval: [{
|
|
618
707
|
type: Input
|
|
@@ -635,6 +724,469 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
635
724
|
}], startView: [{
|
|
636
725
|
type: Input
|
|
637
726
|
}] } });
|
|
727
|
+
/** Returns whether an event is a touch event. */
|
|
728
|
+
function isTouchEvent(event) {
|
|
729
|
+
// This function is called for every pixel that the user has dragged so we need it to be
|
|
730
|
+
// as fast as possible. Since we only bind mouse events and touch events, we can assume
|
|
731
|
+
// that if the event's name starts with `t`, it's a touch event.
|
|
732
|
+
return event.type[0] === 't';
|
|
733
|
+
}
|
|
734
|
+
/** Gets the coordinates of a touch or mouse event relative to the document. */
|
|
735
|
+
function getPointerPositionOnPage(event) {
|
|
736
|
+
let point;
|
|
737
|
+
if (isTouchEvent(event)) {
|
|
738
|
+
// `touches` will be empty for start/end events so we have to fall back to `changedTouches`.
|
|
739
|
+
point = event.touches[0] || event.changedTouches[0];
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
point = event;
|
|
743
|
+
}
|
|
744
|
+
return point;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function pad(num, size) {
|
|
748
|
+
num = String(num);
|
|
749
|
+
while (num.length < size)
|
|
750
|
+
num = '0' + num;
|
|
751
|
+
return num;
|
|
752
|
+
}
|
|
753
|
+
class MtxTimeInput {
|
|
754
|
+
constructor(element, cdr) {
|
|
755
|
+
this.element = element;
|
|
756
|
+
this.cdr = cdr;
|
|
757
|
+
this._interval = 1;
|
|
758
|
+
this._min = 0;
|
|
759
|
+
this._max = Infinity;
|
|
760
|
+
this.timeValueChanged = new EventEmitter();
|
|
761
|
+
this.keyDownListener = this.keyDownHandler.bind(this);
|
|
762
|
+
this.keyPressListener = this.keyPressHandler.bind(this);
|
|
763
|
+
this.inputEventListener = this.inputChangedHandler.bind(this);
|
|
764
|
+
this.inputElement.addEventListener('keydown', this.keyDownListener, {
|
|
765
|
+
passive: true,
|
|
766
|
+
});
|
|
767
|
+
// Do not passive since we want to be able to preventDefault()
|
|
768
|
+
this.inputElement.addEventListener('keypress', this.keyPressListener);
|
|
769
|
+
this.inputElement.addEventListener('input', this.inputEventListener, {
|
|
770
|
+
passive: true,
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
set timeInterval(value) {
|
|
774
|
+
this._interval = coerceNumberProperty(value);
|
|
775
|
+
}
|
|
776
|
+
set timeMin(value) {
|
|
777
|
+
this._min = coerceNumberProperty(value);
|
|
778
|
+
}
|
|
779
|
+
set timeMax(value) {
|
|
780
|
+
this._max = coerceNumberProperty(value);
|
|
781
|
+
}
|
|
782
|
+
set timeValue(value) {
|
|
783
|
+
this._value = coerceNumberProperty(value);
|
|
784
|
+
if (!this.hasFocus) {
|
|
785
|
+
this.writeValue(this._value);
|
|
786
|
+
}
|
|
787
|
+
this.writePlaceholder(this._value);
|
|
788
|
+
}
|
|
789
|
+
get hasFocus() {
|
|
790
|
+
return this.element.nativeElement && this.element?.nativeElement === document?.activeElement;
|
|
791
|
+
}
|
|
792
|
+
get inputElement() {
|
|
793
|
+
return this.element.nativeElement;
|
|
794
|
+
}
|
|
795
|
+
// We look here at the placeholder value, because we write '' into the value on focus
|
|
796
|
+
// placeholder should always be up to date with "currentValue"
|
|
797
|
+
get valid() {
|
|
798
|
+
// At the start _value is undefined therefore this would result in not valid and
|
|
799
|
+
// make a ugly warning border afterwards we can safely check
|
|
800
|
+
if (this._value) {
|
|
801
|
+
const currentValue = String(this.inputElement.value);
|
|
802
|
+
// It can be that currentValue is empty due to we removing the value on focus,
|
|
803
|
+
// if that is the case we should check previous value which should be in the placeholder
|
|
804
|
+
if (currentValue.length) {
|
|
805
|
+
return this._value == this.inputElement.value;
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
return this._value == this.inputElement.placeholder;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
get invalid() {
|
|
814
|
+
return !this.valid;
|
|
815
|
+
}
|
|
816
|
+
blur() {
|
|
817
|
+
this.writeValue(this._value);
|
|
818
|
+
this.writePlaceholder(this._value);
|
|
819
|
+
this.timeValueChanged.emit(this._value);
|
|
820
|
+
}
|
|
821
|
+
focus() {
|
|
822
|
+
this.writeValue('');
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Write value to inputElement
|
|
826
|
+
* @param value NumberInput
|
|
827
|
+
*/
|
|
828
|
+
writeValue(value) {
|
|
829
|
+
if (value !== '') {
|
|
830
|
+
this.inputElement.value = pad(value, 2);
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
this.inputElement.value = '';
|
|
834
|
+
}
|
|
835
|
+
this.cdr.markForCheck();
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Writes value to placeholder
|
|
839
|
+
* @param value NumberInput
|
|
840
|
+
*/
|
|
841
|
+
writePlaceholder(value) {
|
|
842
|
+
this.inputElement.placeholder = pad(value, 2);
|
|
843
|
+
this.cdr.markForCheck();
|
|
844
|
+
}
|
|
845
|
+
keyDownHandler(event) {
|
|
846
|
+
if (String(this.inputElement.value).length > 0) {
|
|
847
|
+
let value = null;
|
|
848
|
+
if (event.keyCode === UP_ARROW) {
|
|
849
|
+
value = coerceNumberProperty(this._value);
|
|
850
|
+
value += this._interval;
|
|
851
|
+
event.stopPropagation();
|
|
852
|
+
}
|
|
853
|
+
else if (event.keyCode === DOWN_ARROW) {
|
|
854
|
+
value = coerceNumberProperty(this._value);
|
|
855
|
+
value -= this._interval;
|
|
856
|
+
event.stopPropagation();
|
|
857
|
+
}
|
|
858
|
+
// if value has changed
|
|
859
|
+
if (typeof value === 'number') {
|
|
860
|
+
this.writeValue(value);
|
|
861
|
+
this.writePlaceholder(value);
|
|
862
|
+
this.clampInputValue();
|
|
863
|
+
this.timeValueChanged.emit(this._value);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Prevent non number inputs in the inputElement with the exception of Enter/BackSpace
|
|
869
|
+
* @param event KeyboardEvent
|
|
870
|
+
*/
|
|
871
|
+
keyPressHandler(event) {
|
|
872
|
+
const key = event?.key ?? null;
|
|
873
|
+
if (isNaN(Number(key)) && key !== 'Enter') {
|
|
874
|
+
event.preventDefault();
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
inputChangedHandler() {
|
|
878
|
+
this.clampInputValue();
|
|
879
|
+
this.timeValueChanged.emit(this._value);
|
|
880
|
+
}
|
|
881
|
+
clampInputValue() {
|
|
882
|
+
if (this.inputElement?.value === '') {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
const value = coerceNumberProperty(this.inputElement?.value ?? null);
|
|
886
|
+
if (value) {
|
|
887
|
+
const clampedValue = Math.min(Math.max(value, this._min), this._max);
|
|
888
|
+
if (clampedValue !== value) {
|
|
889
|
+
this.writeValue(clampedValue);
|
|
890
|
+
this.writePlaceholder(clampedValue);
|
|
891
|
+
}
|
|
892
|
+
this._value = clampedValue;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Remove event listeners on destruction
|
|
897
|
+
*/
|
|
898
|
+
ngOnDestroy() {
|
|
899
|
+
this.inputElement.removeEventListener('keydown', this.keyDownListener);
|
|
900
|
+
this.inputElement.removeEventListener('keypress', this.keyPressListener);
|
|
901
|
+
this.inputElement.removeEventListener('input', this.inputEventListener);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
/** @nocollapse */ MtxTimeInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxTimeInput, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
905
|
+
/** @nocollapse */ MtxTimeInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: MtxTimeInput, 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 });
|
|
906
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxTimeInput, decorators: [{
|
|
907
|
+
type: Directive,
|
|
908
|
+
args: [{
|
|
909
|
+
selector: 'input.mtx-time-input',
|
|
910
|
+
host: {
|
|
911
|
+
'(blur)': 'blur($event)',
|
|
912
|
+
'(focus)': 'focus($event)',
|
|
913
|
+
},
|
|
914
|
+
exportAs: 'mtxTimeInput',
|
|
915
|
+
}]
|
|
916
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { timeInterval: [{
|
|
917
|
+
type: Input,
|
|
918
|
+
args: ['timeInterval']
|
|
919
|
+
}], timeMin: [{
|
|
920
|
+
type: Input,
|
|
921
|
+
args: ['timeMin']
|
|
922
|
+
}], timeMax: [{
|
|
923
|
+
type: Input,
|
|
924
|
+
args: ['timeMax']
|
|
925
|
+
}], timeValue: [{
|
|
926
|
+
type: Input,
|
|
927
|
+
args: ['timeValue']
|
|
928
|
+
}], timeValueChanged: [{
|
|
929
|
+
type: Output
|
|
930
|
+
}] } });
|
|
931
|
+
class MtxTime {
|
|
932
|
+
constructor(_adapter, _changeDetectorRef, _datetimepickerIntl) {
|
|
933
|
+
this._adapter = _adapter;
|
|
934
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
935
|
+
this._datetimepickerIntl = _datetimepickerIntl;
|
|
936
|
+
/** Emits when the currently selected date changes. */
|
|
937
|
+
this.selectedChange = new EventEmitter();
|
|
938
|
+
/** Emits when any date changes. */
|
|
939
|
+
this.activeDateChange = new EventEmitter();
|
|
940
|
+
/** Emits when any date is selected. */
|
|
941
|
+
this._userSelection = new EventEmitter();
|
|
942
|
+
/** Emits when AM/PM button are clicked. */
|
|
943
|
+
this.ampmChange = new EventEmitter();
|
|
944
|
+
/** Emits when AM/PM button are clicked. */
|
|
945
|
+
this.clockViewChange = new EventEmitter();
|
|
946
|
+
/** Step over minutes. */
|
|
947
|
+
this.interval = 1;
|
|
948
|
+
this._twelvehour = false;
|
|
949
|
+
/** Whether the time is now in AM or PM. */
|
|
950
|
+
this.AMPM = 'AM';
|
|
951
|
+
/** Whether the clock is in hour view. */
|
|
952
|
+
this._clockView = 'hour';
|
|
953
|
+
this.datetimepickerIntlChangesSubscription = this._datetimepickerIntl.changes.subscribe(() => {
|
|
954
|
+
this._changeDetectorRef.detectChanges();
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
/** Whether the clock uses 12 hour format. */
|
|
958
|
+
get twelvehour() {
|
|
959
|
+
return this._twelvehour;
|
|
960
|
+
}
|
|
961
|
+
set twelvehour(value) {
|
|
962
|
+
this._twelvehour = coerceBooleanProperty(value);
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* The date to display in this clock view.
|
|
966
|
+
*/
|
|
967
|
+
get activeDate() {
|
|
968
|
+
return this._activeDate;
|
|
969
|
+
}
|
|
970
|
+
set activeDate(value) {
|
|
971
|
+
this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
972
|
+
}
|
|
973
|
+
/** The currently selected date. */
|
|
974
|
+
get selected() {
|
|
975
|
+
return this._selected;
|
|
976
|
+
}
|
|
977
|
+
set selected(value) {
|
|
978
|
+
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
979
|
+
if (this._selected) {
|
|
980
|
+
this.activeDate = this._selected;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
/** The minimum selectable date. */
|
|
984
|
+
get minDate() {
|
|
985
|
+
return this._minDate;
|
|
986
|
+
}
|
|
987
|
+
set minDate(value) {
|
|
988
|
+
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
989
|
+
}
|
|
990
|
+
/** The maximum selectable date. */
|
|
991
|
+
get maxDate() {
|
|
992
|
+
return this._maxDate;
|
|
993
|
+
}
|
|
994
|
+
set maxDate(value) {
|
|
995
|
+
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
996
|
+
}
|
|
997
|
+
/** Whether the clock should be started in hour or minute view. */
|
|
998
|
+
get clockView() {
|
|
999
|
+
return this._clockView;
|
|
1000
|
+
}
|
|
1001
|
+
set clockView(value) {
|
|
1002
|
+
this._clockView = value;
|
|
1003
|
+
}
|
|
1004
|
+
get isHourView() {
|
|
1005
|
+
return this._clockView === 'hour';
|
|
1006
|
+
}
|
|
1007
|
+
get isMinuteView() {
|
|
1008
|
+
return this._clockView === 'hour';
|
|
1009
|
+
}
|
|
1010
|
+
get hour() {
|
|
1011
|
+
if (!this.activeDate) {
|
|
1012
|
+
if (this.twelvehour) {
|
|
1013
|
+
return '12';
|
|
1014
|
+
}
|
|
1015
|
+
else {
|
|
1016
|
+
return '00';
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
const hour = Number(this._adapter.getHour(this.activeDate));
|
|
1020
|
+
if (!this.twelvehour) {
|
|
1021
|
+
return this.prefixWithZero(hour);
|
|
1022
|
+
}
|
|
1023
|
+
if (hour === 0) {
|
|
1024
|
+
return '12';
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
return this.prefixWithZero(hour > 12 ? hour - 12 : hour);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
get minute() {
|
|
1031
|
+
if (this.activeDate) {
|
|
1032
|
+
return this.prefixWithZero(this._adapter.getMinute(this.activeDate));
|
|
1033
|
+
}
|
|
1034
|
+
return '00';
|
|
1035
|
+
}
|
|
1036
|
+
prefixWithZero(value) {
|
|
1037
|
+
if (value < 10) {
|
|
1038
|
+
return '0' + String(value);
|
|
1039
|
+
}
|
|
1040
|
+
return String(value);
|
|
1041
|
+
}
|
|
1042
|
+
ngOnChanges(changes) {
|
|
1043
|
+
// when clockView changes by input we should focus the correct input
|
|
1044
|
+
if (changes.clockView) {
|
|
1045
|
+
if (changes.clockView.currentValue !== changes.clockView.previousValue) {
|
|
1046
|
+
this.focusInputElement();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
ngAfterViewInit() {
|
|
1051
|
+
this.focusInputElement();
|
|
1052
|
+
}
|
|
1053
|
+
focusInputElement() {
|
|
1054
|
+
if (this.clockView === 'hour') {
|
|
1055
|
+
if (this.hourInputElement) {
|
|
1056
|
+
this.hourInputElement.nativeElement.focus();
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
if (this.minuteInputElement) {
|
|
1061
|
+
this.minuteInputElement.nativeElement.focus();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
handleHourInputChange(value) {
|
|
1066
|
+
const hour = coerceNumberProperty(value);
|
|
1067
|
+
if (hour || hour === 0) {
|
|
1068
|
+
const newValue = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this.updateHourForAmPm(hour), this._adapter.getMinute(this.activeDate));
|
|
1069
|
+
this._activeDate = this._adapter.clampDate(newValue, this.minDate, this.maxDate);
|
|
1070
|
+
this.activeDateChange.emit(this.activeDate);
|
|
1071
|
+
// If previously we did set [mtxValue]="13" and the input changed to 6, and the clamping will make it "13" again
|
|
1072
|
+
// then the hourInputDirective will not have been updated since "13" === "13" same reference so no change detected
|
|
1073
|
+
// by directly setting it within this handler, we handle this usecase
|
|
1074
|
+
if (this.hourInputDirective) {
|
|
1075
|
+
this.hourInputDirective.timeValue = this.hour;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
updateHourForAmPm(value) {
|
|
1080
|
+
if (!this.twelvehour) {
|
|
1081
|
+
return value;
|
|
1082
|
+
}
|
|
1083
|
+
// value should be between 1-12
|
|
1084
|
+
if (this.AMPM === 'AM') {
|
|
1085
|
+
if (value === 0 || value === 12) {
|
|
1086
|
+
return 0;
|
|
1087
|
+
}
|
|
1088
|
+
return value;
|
|
1089
|
+
}
|
|
1090
|
+
// PM
|
|
1091
|
+
else {
|
|
1092
|
+
if (value === 0 || value === 12) {
|
|
1093
|
+
return 12;
|
|
1094
|
+
}
|
|
1095
|
+
// other cases, we should add 12 to the value aka 3:00 PM = 3 + 12 = 15:00
|
|
1096
|
+
return value + 12;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
handleMinuteInputChange(value) {
|
|
1100
|
+
const minute = coerceNumberProperty(value);
|
|
1101
|
+
if (minute || minute === 0) {
|
|
1102
|
+
const newValue = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this._activeDate), minute);
|
|
1103
|
+
this._activeDate = this._adapter.clampDate(newValue, this.minDate, this.maxDate);
|
|
1104
|
+
this.activeDateChange.emit(this.activeDate);
|
|
1105
|
+
// If previously we did set [mtxValue]="40" and the input changed to 30, and the clamping will make it "40" again
|
|
1106
|
+
// then the minuteInputDirective will not have been updated since "40" === "40" same reference so no change detected
|
|
1107
|
+
// by directly setting it within this handler, we handle this usecase
|
|
1108
|
+
if (this.minuteInputDirective) {
|
|
1109
|
+
this.minuteInputDirective.timeValue = this.minute;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
handleFocus(clockView) {
|
|
1114
|
+
this.clockView = clockView;
|
|
1115
|
+
this.clockViewChange.emit(clockView);
|
|
1116
|
+
}
|
|
1117
|
+
_timeSelected(date) {
|
|
1118
|
+
if (this.clockView === 'hour') {
|
|
1119
|
+
this.clockView = 'minute';
|
|
1120
|
+
}
|
|
1121
|
+
this._activeDate = this.selected = date;
|
|
1122
|
+
}
|
|
1123
|
+
_onActiveDateChange(date) {
|
|
1124
|
+
this._activeDate = date;
|
|
1125
|
+
this.activeDateChange.emit(date);
|
|
1126
|
+
}
|
|
1127
|
+
handleOk() {
|
|
1128
|
+
if (this._selected) {
|
|
1129
|
+
this.selectedChange.emit(this._selected);
|
|
1130
|
+
}
|
|
1131
|
+
this._userSelection.emit();
|
|
1132
|
+
}
|
|
1133
|
+
handleCancel() {
|
|
1134
|
+
this._userSelection.emit();
|
|
1135
|
+
}
|
|
1136
|
+
ngOnDestroy() {
|
|
1137
|
+
if (this.datetimepickerIntlChangesSubscription) {
|
|
1138
|
+
this.datetimepickerIntlChangesSubscription.unsubscribe();
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
/** @nocollapse */ MtxTime.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxTime, deps: [{ token: i1.DatetimeAdapter }, { token: i0.ChangeDetectorRef }, { token: MtxDatetimepickerIntl }], target: i0.ɵɵFactoryTarget.Component });
|
|
1143
|
+
/** @nocollapse */ MtxTime.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxTime, selector: "mtx-time", inputs: { dateFilter: "dateFilter", interval: "interval", twelvehour: "twelvehour", AMPM: "AMPM", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", clockView: "clockView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection", ampmChange: "ampmChange", clockViewChange: "clockViewChange" }, host: { classAttribute: "mtx-time" }, 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: "<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 <div *ngIf=\"twelvehour\" 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 </div>\n</div>\n\n<mtx-clock (selectedChange)=\"_timeSelected($event)\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"interval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [startView]=\"clockView\"\n [twelvehour]=\"twelvehour\">\n</mtx-clock>\n\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", styles: [".mtx-time{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-radius:8px;border:2px solid transparent;-webkit-appearance:none;appearance:none;outline:none}.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{flex:1;width:40px;min-width:auto;padding:0;line-height:normal;border-width:1px;border-style:solid}.mtx-time-ampm .mtx-time-am{border-radius:8px 8px 0 0}.mtx-time-ampm .mtx-time-pm{border-radius:0 0 8px 8px;border-top:none}.mtx-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "twelvehour", "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 });
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxTime, decorators: [{
|
|
1145
|
+
type: Component,
|
|
1146
|
+
args: [{ selector: 'mtx-time', exportAs: 'mtxTime', host: {
|
|
1147
|
+
class: 'mtx-time',
|
|
1148
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<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 <div *ngIf=\"twelvehour\" 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 </div>\n</div>\n\n<mtx-clock (selectedChange)=\"_timeSelected($event)\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n [dateFilter]=\"dateFilter\"\n [interval]=\"interval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected\"\n [startView]=\"clockView\"\n [twelvehour]=\"twelvehour\">\n</mtx-clock>\n\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", styles: [".mtx-time{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-radius:8px;border:2px solid transparent;-webkit-appearance:none;appearance:none;outline:none}.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{flex:1;width:40px;min-width:auto;padding:0;line-height:normal;border-width:1px;border-style:solid}.mtx-time-ampm .mtx-time-am{border-radius:8px 8px 0 0}.mtx-time-ampm .mtx-time-pm{border-radius:0 0 8px 8px;border-top:none}.mtx-time-button-wrapper{display:flex;justify-content:flex-end;padding-top:8px}\n"] }]
|
|
1149
|
+
}], ctorParameters: function () { return [{ type: i1.DatetimeAdapter }, { type: i0.ChangeDetectorRef }, { type: MtxDatetimepickerIntl }]; }, propDecorators: { selectedChange: [{
|
|
1150
|
+
type: Output
|
|
1151
|
+
}], activeDateChange: [{
|
|
1152
|
+
type: Output
|
|
1153
|
+
}], _userSelection: [{
|
|
1154
|
+
type: Output
|
|
1155
|
+
}], ampmChange: [{
|
|
1156
|
+
type: Output
|
|
1157
|
+
}], clockViewChange: [{
|
|
1158
|
+
type: Output
|
|
1159
|
+
}], dateFilter: [{
|
|
1160
|
+
type: Input
|
|
1161
|
+
}], interval: [{
|
|
1162
|
+
type: Input
|
|
1163
|
+
}], hourInputElement: [{
|
|
1164
|
+
type: ViewChild,
|
|
1165
|
+
args: ['hourInput', { read: (ElementRef) }]
|
|
1166
|
+
}], hourInputDirective: [{
|
|
1167
|
+
type: ViewChild,
|
|
1168
|
+
args: ['hourInput', { read: MtxTimeInput }]
|
|
1169
|
+
}], minuteInputElement: [{
|
|
1170
|
+
type: ViewChild,
|
|
1171
|
+
args: ['minuteInput', { read: (ElementRef) }]
|
|
1172
|
+
}], minuteInputDirective: [{
|
|
1173
|
+
type: ViewChild,
|
|
1174
|
+
args: ['minuteInput', { read: MtxTimeInput }]
|
|
1175
|
+
}], twelvehour: [{
|
|
1176
|
+
type: Input
|
|
1177
|
+
}], AMPM: [{
|
|
1178
|
+
type: Input
|
|
1179
|
+
}], activeDate: [{
|
|
1180
|
+
type: Input
|
|
1181
|
+
}], selected: [{
|
|
1182
|
+
type: Input
|
|
1183
|
+
}], minDate: [{
|
|
1184
|
+
type: Input
|
|
1185
|
+
}], maxDate: [{
|
|
1186
|
+
type: Input
|
|
1187
|
+
}], clockView: [{
|
|
1188
|
+
type: Input
|
|
1189
|
+
}] } });
|
|
638
1190
|
|
|
639
1191
|
const DAYS_PER_WEEK = 7;
|
|
640
1192
|
/**
|
|
@@ -910,7 +1462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
910
1462
|
* @docs-private
|
|
911
1463
|
*/
|
|
912
1464
|
class MtxCalendar {
|
|
913
|
-
constructor(_elementRef, _intl, _ngZone, _adapter, _dateFormats,
|
|
1465
|
+
constructor(_elementRef, _intl, _ngZone, _adapter, _dateFormats, _changeDetectorRef) {
|
|
914
1466
|
this._elementRef = _elementRef;
|
|
915
1467
|
this._intl = _intl;
|
|
916
1468
|
this._ngZone = _ngZone;
|
|
@@ -931,6 +1483,7 @@ class MtxCalendar {
|
|
|
931
1483
|
this._userSelection = new EventEmitter();
|
|
932
1484
|
this._clockView = 'hour';
|
|
933
1485
|
this._type = 'date';
|
|
1486
|
+
this._timeInput = false;
|
|
934
1487
|
/** Date filter for the month and year views. */
|
|
935
1488
|
this._dateFilterForViews = (date) => {
|
|
936
1489
|
return (!!date &&
|
|
@@ -944,7 +1497,7 @@ class MtxCalendar {
|
|
|
944
1497
|
if (!this._dateFormats) {
|
|
945
1498
|
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
946
1499
|
}
|
|
947
|
-
this._intlChanges = _intl.changes.subscribe(() =>
|
|
1500
|
+
this._intlChanges = _intl.changes.subscribe(() => _changeDetectorRef.markForCheck());
|
|
948
1501
|
}
|
|
949
1502
|
/** Whether to show multi-year view. */
|
|
950
1503
|
get multiYearSelector() {
|
|
@@ -977,6 +1530,17 @@ class MtxCalendar {
|
|
|
977
1530
|
set startAt(value) {
|
|
978
1531
|
this._startAt = this._adapter.getValidDateOrNull(value);
|
|
979
1532
|
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Whether the calendar is in time mode. In time mode the calendar clock gets time input elements rather then just clock
|
|
1535
|
+
*
|
|
1536
|
+
* When touchUi is enabled this will be disabled
|
|
1537
|
+
*/
|
|
1538
|
+
get timeInput() {
|
|
1539
|
+
return this._timeInput;
|
|
1540
|
+
}
|
|
1541
|
+
set timeInput(value) {
|
|
1542
|
+
this._timeInput = coerceBooleanProperty(value);
|
|
1543
|
+
}
|
|
980
1544
|
/** The currently selected date. */
|
|
981
1545
|
get selected() {
|
|
982
1546
|
return this._selected;
|
|
@@ -1028,11 +1592,7 @@ class MtxCalendar {
|
|
|
1028
1592
|
this._currentView = view;
|
|
1029
1593
|
this.viewChanged.emit(view);
|
|
1030
1594
|
}
|
|
1031
|
-
|
|
1032
|
-
get _yearLabel() {
|
|
1033
|
-
return this._adapter.getYearName(this._activeDate);
|
|
1034
|
-
}
|
|
1035
|
-
get _monthYearLabel() {
|
|
1595
|
+
get _yearPeriodText() {
|
|
1036
1596
|
if (this.currentView === 'multi-year') {
|
|
1037
1597
|
// The offset from the active year to the "slot" for the starting year is the
|
|
1038
1598
|
// *actual* first rendered year in the multi-year view, and the last year is
|
|
@@ -1048,7 +1608,15 @@ class MtxCalendar {
|
|
|
1048
1608
|
? this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)]
|
|
1049
1609
|
: this._adapter.getYearName(this._activeDate);
|
|
1050
1610
|
}
|
|
1051
|
-
get
|
|
1611
|
+
get _yearButtonText() {
|
|
1612
|
+
return this._adapter.getYearName(this._activeDate);
|
|
1613
|
+
}
|
|
1614
|
+
get _yearButtonLabel() {
|
|
1615
|
+
return this.multiYearSelector
|
|
1616
|
+
? this._intl.switchToMultiYearViewLabel
|
|
1617
|
+
: this._intl.switchToYearViewLabel;
|
|
1618
|
+
}
|
|
1619
|
+
get _dateButtonText() {
|
|
1052
1620
|
switch (this.type) {
|
|
1053
1621
|
case 'month':
|
|
1054
1622
|
return this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)];
|
|
@@ -1056,7 +1624,10 @@ class MtxCalendar {
|
|
|
1056
1624
|
return this._adapter.format(this._activeDate, this._dateFormats.display.popupHeaderDateLabel);
|
|
1057
1625
|
}
|
|
1058
1626
|
}
|
|
1059
|
-
get
|
|
1627
|
+
get _dateButtonLabel() {
|
|
1628
|
+
return this._intl.switchToMonthViewLabel;
|
|
1629
|
+
}
|
|
1630
|
+
get _hoursButtonText() {
|
|
1060
1631
|
let hour = this._adapter.getHour(this._activeDate);
|
|
1061
1632
|
if (this.twelvehour) {
|
|
1062
1633
|
if (hour === 0) {
|
|
@@ -1066,29 +1637,35 @@ class MtxCalendar {
|
|
|
1066
1637
|
}
|
|
1067
1638
|
return this._2digit(hour);
|
|
1068
1639
|
}
|
|
1069
|
-
get
|
|
1640
|
+
get _hourButtonLabel() {
|
|
1641
|
+
return this._intl.switchToClockHourViewLabel;
|
|
1642
|
+
}
|
|
1643
|
+
get _minutesButtonText() {
|
|
1070
1644
|
return this._2digit(this._adapter.getMinute(this._activeDate));
|
|
1071
1645
|
}
|
|
1072
|
-
get
|
|
1646
|
+
get _minuteButtonLabel() {
|
|
1647
|
+
return this._intl.switchToClockMinuteViewLabel;
|
|
1648
|
+
}
|
|
1649
|
+
get _prevButtonLabel() {
|
|
1073
1650
|
switch (this._currentView) {
|
|
1074
1651
|
case 'month':
|
|
1075
|
-
return this._intl.
|
|
1652
|
+
return this._intl.prevMonthLabel;
|
|
1076
1653
|
case 'year':
|
|
1077
|
-
return this._intl.
|
|
1654
|
+
return this._intl.prevYearLabel;
|
|
1078
1655
|
case 'multi-year':
|
|
1079
|
-
return this._intl.
|
|
1656
|
+
return this._intl.prevMultiYearLabel;
|
|
1080
1657
|
default:
|
|
1081
1658
|
return '';
|
|
1082
1659
|
}
|
|
1083
1660
|
}
|
|
1084
|
-
get
|
|
1661
|
+
get _nextButtonLabel() {
|
|
1085
1662
|
switch (this._currentView) {
|
|
1086
1663
|
case 'month':
|
|
1087
|
-
return this._intl.
|
|
1664
|
+
return this._intl.nextMonthLabel;
|
|
1088
1665
|
case 'year':
|
|
1089
|
-
return this._intl.
|
|
1666
|
+
return this._intl.nextYearLabel;
|
|
1090
1667
|
case 'multi-year':
|
|
1091
|
-
return this._intl.
|
|
1668
|
+
return this._intl.nextMultiYearLabel;
|
|
1092
1669
|
default:
|
|
1093
1670
|
return '';
|
|
1094
1671
|
}
|
|
@@ -1155,6 +1732,12 @@ class MtxCalendar {
|
|
|
1155
1732
|
}
|
|
1156
1733
|
}
|
|
1157
1734
|
_timeSelected(date) {
|
|
1735
|
+
this._activeDate = this._updateDate(date);
|
|
1736
|
+
if (!this._adapter.sameDatetime(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1737
|
+
this.selectedChange.emit(date);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
_dialTimeSelected(date) {
|
|
1158
1741
|
if (this._clockView !== 'minute') {
|
|
1159
1742
|
this._activeDate = this._updateDate(date);
|
|
1160
1743
|
this._clockView = 'minute';
|
|
@@ -1183,7 +1766,8 @@ class MtxCalendar {
|
|
|
1183
1766
|
return date;
|
|
1184
1767
|
}
|
|
1185
1768
|
_selectAMPM(date) {
|
|
1186
|
-
|
|
1769
|
+
const hour = this._adapter.getHour(date);
|
|
1770
|
+
if (hour > 11) {
|
|
1187
1771
|
this._AMPM = 'PM';
|
|
1188
1772
|
}
|
|
1189
1773
|
else {
|
|
@@ -1191,16 +1775,22 @@ class MtxCalendar {
|
|
|
1191
1775
|
}
|
|
1192
1776
|
}
|
|
1193
1777
|
_ampmClicked(source) {
|
|
1778
|
+
this._currentView = 'clock';
|
|
1194
1779
|
if (source === this._AMPM) {
|
|
1195
1780
|
return;
|
|
1196
1781
|
}
|
|
1197
1782
|
this._AMPM = source;
|
|
1783
|
+
// if AMPM changed from PM to AM substract 12 hours
|
|
1784
|
+
const currentHour = this._adapter.getHour(this._activeDate);
|
|
1785
|
+
let newHourValue;
|
|
1198
1786
|
if (this._AMPM === 'AM') {
|
|
1199
|
-
|
|
1787
|
+
newHourValue = currentHour >= 12 ? this._adapter.getHour(this._activeDate) - 12 : 12;
|
|
1200
1788
|
}
|
|
1789
|
+
// otherwise add 12 hours
|
|
1201
1790
|
else {
|
|
1202
|
-
|
|
1791
|
+
newHourValue = (currentHour + 12) % 24;
|
|
1203
1792
|
}
|
|
1793
|
+
this._activeDate = this._adapter.createDatetime(this._adapter.getYear(this._activeDate), this._adapter.getMonth(this._activeDate), this._adapter.getDate(this._activeDate), newHourValue, this._adapter.getMinute(this._activeDate));
|
|
1204
1794
|
}
|
|
1205
1795
|
_yearClicked() {
|
|
1206
1796
|
if (this.type === 'year' || this.multiYearSelector) {
|
|
@@ -1417,16 +2007,22 @@ class MtxCalendar {
|
|
|
1417
2007
|
this._activeDate =
|
|
1418
2008
|
this._clockView === 'hour'
|
|
1419
2009
|
? this._adapter.addCalendarHours(this._activeDate, 1)
|
|
1420
|
-
: this._adapter.addCalendarMinutes(this._activeDate,
|
|
2010
|
+
: this._adapter.addCalendarMinutes(this._activeDate, this.timeInterval);
|
|
2011
|
+
// if the hours changed the am/pm we should update the AM/PM
|
|
2012
|
+
this._selectAMPM(this._activeDate);
|
|
1421
2013
|
break;
|
|
1422
2014
|
case DOWN_ARROW:
|
|
1423
2015
|
this._activeDate =
|
|
1424
2016
|
this._clockView === 'hour'
|
|
1425
2017
|
? this._adapter.addCalendarHours(this._activeDate, -1)
|
|
1426
|
-
: this._adapter.addCalendarMinutes(this._activeDate, -
|
|
2018
|
+
: this._adapter.addCalendarMinutes(this._activeDate, -this.timeInterval);
|
|
2019
|
+
// if the hours changed the am/pm we should update the AM/PM
|
|
2020
|
+
this._selectAMPM(this._activeDate);
|
|
1427
2021
|
break;
|
|
1428
2022
|
case ENTER:
|
|
1429
|
-
|
|
2023
|
+
if (!this.timeInput) {
|
|
2024
|
+
this._dialTimeSelected(this._activeDate);
|
|
2025
|
+
}
|
|
1430
2026
|
return;
|
|
1431
2027
|
default:
|
|
1432
2028
|
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
@@ -1462,16 +2058,17 @@ class MtxCalendar {
|
|
|
1462
2058
|
return ('00' + n).slice(-2);
|
|
1463
2059
|
}
|
|
1464
2060
|
}
|
|
1465
|
-
/** @nocollapse */ MtxCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxCalendar, deps: [{ token: i0.ElementRef }, { token:
|
|
1466
|
-
/** @nocollapse */ MtxCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxCalendar, selector: "mtx-calendar", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: "preventSameDateTimeSelection", type: "type", startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", viewChanged: "viewChanged", _userSelection: "_userSelection" }, host: { attributes: { "tabindex": "0" }, listeners: { "keydown": "_handleCalendarBodyKeydown($event)" }, classAttribute: "mtx-calendar" }, exportAs: ["mtxCalendar"], ngImport: i0, template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\" *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\" role=\"button\">\n <span>{{ _yearLabel }}</span>\n <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView === 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView === 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n </span>\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\" role=\"button\">AM</span>\n <span (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\" role=\"button\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\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\"></path>\n </svg>\n </button>\n <div [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\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\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\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</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-year+.mtx-calendar-header-date-time{margin-top:4px}.mtx-calendar-header-date-time{line-height:36px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.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){cursor:pointer;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{cursor:pointer;opacity:1}[mode=landscape] .mtx-calendar-header-time{display:flex;flex-direction:column}.mtx-calendar-header-hour-minute-container{padding:0 8px}[mode=landscape] .mtx-calendar-header-hour-minute-container{padding:0}.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}[mode=landscape] .mtx-calendar-header-ampm-container{flex-direction:row}[mode=landscape] .mtx-calendar-header-ampm{padding:4px}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;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}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.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}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:flex;flex-direction:column}.mtx-calendar[mode=auto] .mtx-calendar-header-hour-minute-container{padding:0}.mtx-calendar[mode=auto] .mtx-calendar-header-ampm-container{flex-direction:row}.mtx-calendar[mode=auto] .mtx-calendar-header-ampm{padding:4px}}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "twelvehour", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["selectedChange", "activeDateChange", "_userSelection"], exportAs: ["mtxClock"] }, { 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"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2061
|
+
/** @nocollapse */ MtxCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxCalendar, deps: [{ token: i0.ElementRef }, { token: MtxDatetimepickerIntl }, { token: i0.NgZone }, { token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2062
|
+
/** @nocollapse */ MtxCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxCalendar, selector: "mtx-calendar", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: "preventSameDateTimeSelection", type: "type", startAt: "startAt", timeInput: "timeInput", 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 <button *ngIf=\"type !== 'time'\"\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 <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </button>\n <div *ngIf=\"type !== 'year'\" class=\"mtx-calendar-header-date-time\">\n <button *ngIf=\"type !== 'time'\"\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 <span *ngIf=\"type.endsWith('time')\" class=\"mtx-calendar-header-time\"\n [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 <span *ngIf=\"twelvehour\" 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 </span>\n </div>\n</div>\n\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n 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\"></path>\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\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view *ngSwitchCase=\"'month'\"\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view *ngSwitchCase=\"'year'\"\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view *ngSwitchCase=\"'multi-year'\"\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 <ng-container *ngSwitchDefault>\n <mtx-time *ngIf=\"timeInput; else clock\"\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 </mtx-time>\n\n <ng-template #clock>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_dialTimeSelected($event)\"\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 </ng-template>\n </ng-container>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-radius:4px 4px 0 0}.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{min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;font-size:inherit;font-weight:inherit;white-space:normal;word-break:break-word}.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:150px;min-width:150px;padding:16px 8px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-radius:0 4px 4px 0}[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}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:150px;min-width:150px;padding:16px 8px;border-radius:4px 0 0 4px}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-radius:0 4px 4px 0}[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}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;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}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.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}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "twelvehour", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["selectedChange", "activeDateChange", "_userSelection"], exportAs: ["mtxClock"] }, { kind: "component", type: MtxTime, selector: "mtx-time", inputs: ["dateFilter", "interval", "twelvehour", "AMPM", "activeDate", "selected", "minDate", "maxDate", "clockView"], outputs: ["selectedChange", "activeDateChange", "_userSelection", "ampmChange", "clockViewChange"], exportAs: ["mtxTime"] }, { 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"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1467
2063
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxCalendar, decorators: [{
|
|
1468
2064
|
type: Component,
|
|
1469
2065
|
args: [{ selector: 'mtx-calendar', host: {
|
|
1470
2066
|
'class': 'mtx-calendar',
|
|
2067
|
+
'[class.mtx-calendar-with-time-input]': 'timeInput',
|
|
1471
2068
|
'tabindex': '0',
|
|
1472
2069
|
'(keydown)': '_handleCalendarBodyKeydown($event)',
|
|
1473
|
-
}, exportAs: 'mtxCalendar', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\" *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\" role=\"button\">\n <span>{{ _yearLabel }}</span>\n <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span class=\"mtx-calendar-header-hour-minute-container\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView === 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>\n <span class=\"mtx-calendar-header-hour-minute-separator\">:</span>\n <span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView === 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n </span>\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\" role=\"button\">AM</span>\n <span (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\" role=\"button\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\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\"></path>\n </svg>\n </button>\n <div [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\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\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\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</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{line-height:24px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-year+.mtx-calendar-header-date-time{margin-top:4px}.mtx-calendar-header-date-time{line-height:36px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.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){cursor:pointer;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{cursor:pointer;opacity:1}[mode=landscape] .mtx-calendar-header-time{display:flex;flex-direction:column}.mtx-calendar-header-hour-minute-container{padding:0 8px}[mode=landscape] .mtx-calendar-header-hour-minute-container{padding:0}.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}[mode=landscape] .mtx-calendar-header-ampm-container{flex-direction:row}[mode=landscape] .mtx-calendar-header-ampm{padding:4px}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;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}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.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}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:flex;flex-direction:column}.mtx-calendar[mode=auto] .mtx-calendar-header-hour-minute-container{padding:0}.mtx-calendar[mode=auto] .mtx-calendar-header-ampm-container{flex-direction:row}.mtx-calendar[mode=auto] .mtx-calendar-header-ampm{padding:4px}}\n"] }]
|
|
1474
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type:
|
|
2070
|
+
}, exportAs: 'mtxCalendar', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mtx-calendar-header\">\n <button *ngIf=\"type !== 'time'\"\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 <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </button>\n <div *ngIf=\"type !== 'year'\" class=\"mtx-calendar-header-date-time\">\n <button *ngIf=\"type !== 'time'\"\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 <span *ngIf=\"type.endsWith('time')\" class=\"mtx-calendar-header-time\"\n [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 <span *ngIf=\"twelvehour\" 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 </span>\n </div>\n</div>\n\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n 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\"></path>\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\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view *ngSwitchCase=\"'month'\"\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view *ngSwitchCase=\"'year'\"\n (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view *ngSwitchCase=\"'multi-year'\"\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 <ng-container *ngSwitchDefault>\n <mtx-time *ngIf=\"timeInput; else clock\"\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 </mtx-time>\n\n <ng-template #clock>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_dialTimeSelected($event)\"\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 </ng-template>\n </ng-container>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar-header{box-sizing:border-box;padding:8px;border-radius:4px 4px 0 0}.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{min-width:auto;padding:0 4px;text-align:inherit;line-height:inherit;font-size:inherit;font-weight:inherit;white-space:normal;word-break:break-word}.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:150px;min-width:150px;padding:16px 8px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar .mtx-calendar-header{border-radius:0 4px 4px 0}[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}@media all and (orientation: landscape){[mode=auto] .mtx-calendar{display:flex}[mode=auto] .mtx-calendar .mtx-calendar-header{width:150px;min-width:150px;padding:16px 8px;border-radius:4px 0 0 4px}[dir=rtl] [mode=auto] .mtx-calendar .mtx-calendar-header{border-radius:0 4px 4px 0}[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}}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;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}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.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}\n"] }]
|
|
2071
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MtxDatetimepickerIntl }, { type: i0.NgZone }, { type: i1.DatetimeAdapter, decorators: [{
|
|
1475
2072
|
type: Optional
|
|
1476
2073
|
}] }, { type: undefined, decorators: [{
|
|
1477
2074
|
type: Optional
|
|
@@ -1500,6 +2097,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
1500
2097
|
type: Input
|
|
1501
2098
|
}], startAt: [{
|
|
1502
2099
|
type: Input
|
|
2100
|
+
}], timeInput: [{
|
|
2101
|
+
type: Input
|
|
1503
2102
|
}], selected: [{
|
|
1504
2103
|
type: Input
|
|
1505
2104
|
}], minDate: [{
|
|
@@ -1540,6 +2139,8 @@ class MtxDatetimepickerContent extends _MtxDatetimepickerContentBase {
|
|
|
1540
2139
|
this._changeDetectorRef = _changeDetectorRef;
|
|
1541
2140
|
/** Emits when an animation has finished. */
|
|
1542
2141
|
this._animationDone = new Subject();
|
|
2142
|
+
/** Id of the label for the `role="dialog"` element. */
|
|
2143
|
+
this._dialogLabelId = null;
|
|
1543
2144
|
}
|
|
1544
2145
|
ngOnInit() {
|
|
1545
2146
|
this._animationState = this.datetimepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
|
|
@@ -1556,7 +2157,7 @@ class MtxDatetimepickerContent extends _MtxDatetimepickerContentBase {
|
|
|
1556
2157
|
}
|
|
1557
2158
|
}
|
|
1558
2159
|
/** @nocollapse */ MtxDatetimepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1559
|
-
/** @nocollapse */ MtxDatetimepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepickerContent, selector: "mtx-datetimepicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "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 }], usesInheritance: true, ngImport: i0, template: "<div cdkTrapFocus\n
|
|
2160
|
+
/** @nocollapse */ MtxDatetimepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepickerContent, selector: "mtx-datetimepicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "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 }], usesInheritance: 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 <mtx-calendar [id]=\"datetimepicker.id\"\n [ngClass]=\"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 [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [timeInput]=\"datetimepicker.timeInput\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (_userSelection)=\"datetimepicker.close()\"\n [@fadeInCalendar]=\"'enter'\">\n </mtx-calendar>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:4px}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:424px}.mtx-datetimepicker-content .mtx-calendar.mtx-calendar-with-time-input{height:490px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar{width:446px;height:328px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar.mtx-calendar-with-time-input{height:412px}@media all and (orientation: landscape){.mtx-datetimepicker-content[mode=auto] .mtx-calendar{width:446px;height:328px}.mtx-datetimepicker-content[mode=auto] .mtx-calendar.mtx-calendar-with-time-input{height:412px}}.mtx-datetimepicker-content-touch{display:block;max-height:80vh;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}@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=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.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=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container-with-actions{height:135vw}}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: MtxCalendar, selector: "mtx-calendar", inputs: ["multiYearSelector", "twelvehour", "startView", "timeInterval", "dateFilter", "preventSameDateTimeSelection", "type", "startAt", "timeInput", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "viewChanged", "_userSelection"], exportAs: ["mtxCalendar"] }], animations: [
|
|
1560
2161
|
mtxDatetimepickerAnimations.transformPanel,
|
|
1561
2162
|
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
1562
2163
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
@@ -1571,7 +2172,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
1571
2172
|
}, animations: [
|
|
1572
2173
|
mtxDatetimepickerAnimations.transformPanel,
|
|
1573
2174
|
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
1574
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], template: "<div cdkTrapFocus\n
|
|
2175
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], 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 <mtx-calendar [id]=\"datetimepicker.id\"\n [ngClass]=\"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 [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [timeInput]=\"datetimepicker.timeInput\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (_userSelection)=\"datetimepicker.close()\"\n [@fadeInCalendar]=\"'enter'\">\n </mtx-calendar>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:4px}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:424px}.mtx-datetimepicker-content .mtx-calendar.mtx-calendar-with-time-input{height:490px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar{width:446px;height:328px}.mtx-datetimepicker-content[mode=landscape] .mtx-calendar.mtx-calendar-with-time-input{height:412px}@media all and (orientation: landscape){.mtx-datetimepicker-content[mode=auto] .mtx-calendar{width:446px;height:328px}.mtx-datetimepicker-content[mode=auto] .mtx-calendar.mtx-calendar-with-time-input{height:412px}}.mtx-datetimepicker-content-touch{display:block;max-height:80vh;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}@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=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.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=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container-with-actions{height:135vw}}\n"] }]
|
|
1575
2176
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { _calendar: [{
|
|
1576
2177
|
type: ViewChild,
|
|
1577
2178
|
args: [MtxCalendar, { static: true }]
|
|
@@ -1617,8 +2218,9 @@ class MtxDatetimepicker {
|
|
|
1617
2218
|
/** Unique class that will be added to the backdrop so that the test harnesses can look it up. */
|
|
1618
2219
|
this._backdropHarnessClass = `${this.id}-backdrop`;
|
|
1619
2220
|
this._inputStateChanges = Subscription.EMPTY;
|
|
1620
|
-
this._type = '
|
|
2221
|
+
this._type = 'datetime';
|
|
1621
2222
|
this._touchUi = false;
|
|
2223
|
+
this._timeInput = false;
|
|
1622
2224
|
/** Preferred position of the datetimepicker in the X axis. */
|
|
1623
2225
|
this.xPosition = 'start';
|
|
1624
2226
|
/** Preferred position of the datetimepicker in the Y axis. */
|
|
@@ -1681,7 +2283,7 @@ class MtxDatetimepicker {
|
|
|
1681
2283
|
return this._type;
|
|
1682
2284
|
}
|
|
1683
2285
|
set type(value) {
|
|
1684
|
-
this._type = value || '
|
|
2286
|
+
this._type = value || 'datetime';
|
|
1685
2287
|
}
|
|
1686
2288
|
/**
|
|
1687
2289
|
* Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
|
|
@@ -1693,6 +2295,16 @@ class MtxDatetimepicker {
|
|
|
1693
2295
|
set touchUi(value) {
|
|
1694
2296
|
this._touchUi = coerceBooleanProperty(value);
|
|
1695
2297
|
}
|
|
2298
|
+
/**
|
|
2299
|
+
* Whether the calendar is in time mode. In time mode the calendar clock gets time input
|
|
2300
|
+
* elements rather then just clock. When `touchUi` is enabled this will be disabled.
|
|
2301
|
+
*/
|
|
2302
|
+
get timeInput() {
|
|
2303
|
+
return this._timeInput && !this.touchUi;
|
|
2304
|
+
}
|
|
2305
|
+
set timeInput(value) {
|
|
2306
|
+
this._timeInput = coerceBooleanProperty(value);
|
|
2307
|
+
}
|
|
1696
2308
|
/** Whether the datetimepicker pop-up should be disabled. */
|
|
1697
2309
|
get disabled() {
|
|
1698
2310
|
return this._disabled === undefined && this.datetimepickerInput
|
|
@@ -1828,6 +2440,7 @@ class MtxDatetimepicker {
|
|
|
1828
2440
|
_forwardContentValues(instance) {
|
|
1829
2441
|
instance.datetimepicker = this;
|
|
1830
2442
|
instance.color = this.color;
|
|
2443
|
+
instance._dialogLabelId = this.datetimepickerInput.getOverlayLabelId();
|
|
1831
2444
|
}
|
|
1832
2445
|
/** Opens the overlay with the calendar. */
|
|
1833
2446
|
_openOverlay() {
|
|
@@ -1936,7 +2549,7 @@ class MtxDatetimepicker {
|
|
|
1936
2549
|
}
|
|
1937
2550
|
}
|
|
1938
2551
|
/** @nocollapse */ MtxDatetimepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepicker, deps: [{ token: i4$1.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MTX_DATETIMEPICKER_SCROLL_STRATEGY }, { token: i1.DatetimeAdapter, optional: true }, { token: i6.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1939
|
-
/** @nocollapse */ MtxDatetimepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepicker, selector: "mtx-datetimepicker", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", mode: "mode", timeInterval: "timeInterval", preventSameDateTimeSelection: "preventSameDateTimeSelection", panelClass: "panelClass", opened: "opened", color: "color", startAt: "startAt", type: "type", touchUi: "touchUi", disabled: "disabled", xPosition: "xPosition", yPosition: "yPosition", restoreFocus: "restoreFocus" }, outputs: { selectedChanged: "selectedChanged", openedStream: "opened", closedStream: "closed", viewChanged: "viewChanged" }, exportAs: ["mtxDatetimepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2552
|
+
/** @nocollapse */ MtxDatetimepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepicker, selector: "mtx-datetimepicker", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", mode: "mode", timeInterval: "timeInterval", preventSameDateTimeSelection: "preventSameDateTimeSelection", panelClass: "panelClass", opened: "opened", color: "color", startAt: "startAt", type: "type", touchUi: "touchUi", timeInput: "timeInput", disabled: "disabled", xPosition: "xPosition", yPosition: "yPosition", restoreFocus: "restoreFocus" }, outputs: { selectedChanged: "selectedChanged", openedStream: "opened", closedStream: "closed", viewChanged: "viewChanged" }, exportAs: ["mtxDatetimepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1940
2553
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepicker, decorators: [{
|
|
1941
2554
|
type: Component,
|
|
1942
2555
|
args: [{
|
|
@@ -1988,6 +2601,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
1988
2601
|
type: Input
|
|
1989
2602
|
}], touchUi: [{
|
|
1990
2603
|
type: Input
|
|
2604
|
+
}], timeInput: [{
|
|
2605
|
+
type: Input
|
|
1991
2606
|
}], disabled: [{
|
|
1992
2607
|
type: Input
|
|
1993
2608
|
}], xPosition: [{
|
|
@@ -2391,8 +3006,8 @@ class MtxDatetimepickerToggle {
|
|
|
2391
3006
|
]).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
2392
3007
|
}
|
|
2393
3008
|
}
|
|
2394
|
-
/** @nocollapse */ MtxDatetimepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerToggle, deps: [{ token:
|
|
2395
|
-
/** @nocollapse */ MtxDatetimepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepickerToggle, selector: "mtx-datetimepicker-toggle", inputs: { datetimepicker: ["for", "datetimepicker"], tabIndex: "tabIndex", disabled: "disabled", disableRipple: "disableRipple" }, host: { listeners: { "focus": "_button.focus()" }, properties: { "attr.tabindex": "disabled ? null : -1", "class.mtx-datetimepicker-toggle-active": "datetimepicker && datetimepicker.opened", "class.mat-accent": "datetimepicker && datetimepicker.color === \"accent\"", "class.mat-warn": "datetimepicker && datetimepicker.color === \"warn\"" }, 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]=\"_intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\"\n (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\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\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\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\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\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\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3009
|
+
/** @nocollapse */ MtxDatetimepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerToggle, deps: [{ token: MtxDatetimepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3010
|
+
/** @nocollapse */ MtxDatetimepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: MtxDatetimepickerToggle, selector: "mtx-datetimepicker-toggle", inputs: { datetimepicker: ["for", "datetimepicker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: "disabled", disableRipple: "disableRipple" }, host: { listeners: { "focus": "_button.focus()" }, properties: { "attr.tabindex": "disabled ? null : -1", "class.mtx-datetimepicker-toggle-active": "datetimepicker && datetimepicker.opened", "class.mat-accent": "datetimepicker && datetimepicker.color === \"accent\"", "class.mat-warn": "datetimepicker && datetimepicker.color === \"warn\"" }, 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 (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\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\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\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\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\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\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2396
3011
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerToggle, decorators: [{
|
|
2397
3012
|
type: Component,
|
|
2398
3013
|
args: [{ selector: 'mtx-datetimepicker-toggle', host: {
|
|
@@ -2404,12 +3019,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
2404
3019
|
'[class.mat-accent]': 'datetimepicker && datetimepicker.color === "accent"',
|
|
2405
3020
|
'[class.mat-warn]': 'datetimepicker && datetimepicker.color === "warn"',
|
|
2406
3021
|
'(focus)': '_button.focus()',
|
|
2407
|
-
}, exportAs: 'mtxDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datetimepicker ? 'dialog' : null\"\n [attr.aria-label]=\"_intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\"\n (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\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\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\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\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\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\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"] }]
|
|
2408
|
-
}], ctorParameters: function () { return [{ type:
|
|
3022
|
+
}, exportAs: 'mtxDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, 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 (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\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\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\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\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\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\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"] }]
|
|
3023
|
+
}], ctorParameters: function () { return [{ type: MtxDatetimepickerIntl }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { datetimepicker: [{
|
|
2409
3024
|
type: Input,
|
|
2410
3025
|
args: ['for']
|
|
2411
3026
|
}], tabIndex: [{
|
|
2412
3027
|
type: Input
|
|
3028
|
+
}], ariaLabel: [{
|
|
3029
|
+
type: Input,
|
|
3030
|
+
args: ['aria-label']
|
|
2413
3031
|
}], disabled: [{
|
|
2414
3032
|
type: Input
|
|
2415
3033
|
}], disableRipple: [{
|
|
@@ -2428,6 +3046,8 @@ class MtxDatetimepickerModule {
|
|
|
2428
3046
|
/** @nocollapse */ MtxDatetimepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: MtxDatetimepickerModule, declarations: [MtxCalendar,
|
|
2429
3047
|
MtxCalendarBody,
|
|
2430
3048
|
MtxClock,
|
|
3049
|
+
MtxTime,
|
|
3050
|
+
MtxTimeInput,
|
|
2431
3051
|
MtxDatetimepicker,
|
|
2432
3052
|
MtxDatetimepickerToggle,
|
|
2433
3053
|
MtxDatetimepickerToggleIcon,
|
|
@@ -2438,6 +3058,7 @@ class MtxDatetimepickerModule {
|
|
|
2438
3058
|
MtxMultiYearView], imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule], exports: [MtxCalendar,
|
|
2439
3059
|
MtxCalendarBody,
|
|
2440
3060
|
MtxClock,
|
|
3061
|
+
MtxTime,
|
|
2441
3062
|
MtxDatetimepicker,
|
|
2442
3063
|
MtxDatetimepickerToggle,
|
|
2443
3064
|
MtxDatetimepickerToggleIcon,
|
|
@@ -2455,6 +3076,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
2455
3076
|
MtxCalendar,
|
|
2456
3077
|
MtxCalendarBody,
|
|
2457
3078
|
MtxClock,
|
|
3079
|
+
MtxTime,
|
|
3080
|
+
MtxTimeInput,
|
|
2458
3081
|
MtxDatetimepicker,
|
|
2459
3082
|
MtxDatetimepickerToggle,
|
|
2460
3083
|
MtxDatetimepickerToggleIcon,
|
|
@@ -2468,6 +3091,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
2468
3091
|
MtxCalendar,
|
|
2469
3092
|
MtxCalendarBody,
|
|
2470
3093
|
MtxClock,
|
|
3094
|
+
MtxTime,
|
|
2471
3095
|
MtxDatetimepicker,
|
|
2472
3096
|
MtxDatetimepickerToggle,
|
|
2473
3097
|
MtxDatetimepickerToggleIcon,
|
|
@@ -2485,5 +3109,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
2485
3109
|
* Generated bundle index. Do not edit.
|
|
2486
3110
|
*/
|
|
2487
3111
|
|
|
2488
|
-
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, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView, MtxYearView, getActiveOffset, isSameMultiYearView, mtxDatetimepickerAnimations, yearsPerPage, yearsPerRow };
|
|
3112
|
+
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, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView, MtxTime, MtxTimeInput, MtxYearView, getActiveOffset, isSameMultiYearView, mtxDatetimepickerAnimations, yearsPerPage, yearsPerRow };
|
|
2489
3113
|
//# sourceMappingURL=mtxDatetimepicker.mjs.map
|