/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Directive, ElementRef, forwardRef, Inject, Input, Optional } from '@angular/core'; import { NG_VALIDATORS, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { MAT_FORM_FIELD } from '@angular/material/form-field'; import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input'; import { Subscription } from 'rxjs'; import { MatDatepickerInputBase } from './datepicker-input-base'; import * as i0 from "@angular/core"; import * as i1 from "@angular/material/core"; /** @docs-private */ export const MAT_DATEPICKER_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MatDatepickerInput), multi: true, }; /** @docs-private */ export const MAT_DATEPICKER_VALIDATORS = { provide: NG_VALIDATORS, useExisting: forwardRef(() => MatDatepickerInput), multi: true, }; /** Directive used to connect an input to a MatDatepicker. */ export class MatDatepickerInput extends MatDatepickerInputBase { /** The datepicker that this input is associated with. */ set matDatepicker(datepicker) { if (datepicker) { this._datepicker = datepicker; this._closedSubscription = datepicker.closedStream.subscribe(() => this._onTouched()); this._registerModel(datepicker.registerInput(this)); } } /** The minimum valid date. */ get min() { return this._min; } set min(value) { const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)); if (!this._dateAdapter.sameDate(validValue, this._min)) { this._min = validValue; this._validatorOnChange(); } } /** The maximum valid date. */ get max() { return this._max; } set max(value) { const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)); if (!this._dateAdapter.sameDate(validValue, this._max)) { this._max = validValue; this._validatorOnChange(); } } /** Function that can be used to filter out dates within the datepicker. */ get dateFilter() { return this._dateFilter; } set dateFilter(value) { const wasMatchingValue = this._matchesFilter(this.value); this._dateFilter = value; if (this._matchesFilter(this.value) !== wasMatchingValue) { this._validatorOnChange(); } } constructor(elementRef, dateAdapter, dateFormats, _formField) { super(elementRef, dateAdapter, dateFormats); this._formField = _formField; this._closedSubscription = Subscription.EMPTY; this._validator = Validators.compose(super._getValidators()); } /** * Gets the element that the datepicker popup should be connected to. * @return The element to connect the popup to. */ getConnectedOverlayOrigin() { return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef; } /** Gets the ID of an element that should be used a description for the calendar overlay. */ getOverlayLabelId() { if (this._formField) { return this._formField.getLabelId(); } return this._elementRef.nativeElement.getAttribute('aria-labelledby'); } /** Returns the palette used by the input's form field, if any. */ getThemePalette() { return this._formField ? this._formField.color : undefined; } /** Gets the value at which the calendar should start. */ getStartValue() { return this.value; } ngOnDestroy() { super.ngOnDestroy(); this._closedSubscription.unsubscribe(); } /** Opens the associated datepicker. */ _openPopup() { if (this._datepicker) { this._datepicker.open(); } } _getValueFromModel(modelValue) { return modelValue; } _assignValueToModel(value) { if (this._model) { this._model.updateSelection(value, this); } } /** Gets the input's minimum date. */ _getMinDate() { return this._min; } /** Gets the input's maximum date. */ _getMaxDate() { return this._max; } /** Gets the input's date filtering function. */ _getDateFilter() { return this._dateFilter; } _shouldHandleChangeEvent(event) { return event.source !== this; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatDatepickerInput, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter, optional: true }, { token: MAT_DATE_FORMATS, optional: true }, { token: MAT_FORM_FIELD, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.1", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: { matDatepicker: "matDatepicker", min: "min", max: "max", dateFilter: ["matDatepickerFilter", "dateFilter"] }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_datepicker ? \"dialog\" : null", "attr.aria-owns": "(_datepicker?.opened && _datepicker.id) || null", "attr.min": "min ? _dateAdapter.toIso8601(min) : null", "attr.max": "max ? _dateAdapter.toIso8601(max) : null", "attr.data-mat-calendar": "_datepicker ? _datepicker.id : null", "disabled": "disabled" }, classAttribute: "mat-datepicker-input" }, providers: [ MAT_DATEPICKER_VALUE_ACCESSOR, MAT_DATEPICKER_VALIDATORS, { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatDatepickerInput }, ], exportAs: ["matDatepickerInput"], usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatDatepickerInput, decorators: [{ type: Directive, args: [{ selector: 'input[matDatepicker]', providers: [ MAT_DATEPICKER_VALUE_ACCESSOR, MAT_DATEPICKER_VALIDATORS, { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatDatepickerInput }, ], host: { 'class': 'mat-datepicker-input', '[attr.aria-haspopup]': '_datepicker ? "dialog" : null', '[attr.aria-owns]': '(_datepicker?.opened && _datepicker.id) || null', '[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null', '[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null', // Used by the test harness to tie this input to its calendar. We can't depend on // `aria-owns` for this, because it's only defined while the calendar is open. '[attr.data-mat-calendar]': '_datepicker ? _datepicker.id : null', '[disabled]': 'disabled', '(input)': '_onInput($event.target.value)', '(change)': '_onChange()', '(blur)': '_onBlur()', '(keydown)': '_onKeydown($event)', }, exportAs: 'matDatepickerInput', }] }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DateAdapter, decorators: [{ type: Optional }] }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DATE_FORMATS] }] }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_FORM_FIELD] }] }]; }, propDecorators: { matDatepicker: [{ type: Input }], min: [{ type: Input }], max: [{ type: Input }], dateFilter: [{ type: Input, args: ['matDatepickerFilter'] }] } }); //# sourceMappingURL=data:application/json;base64,e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