1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
9 | import { DOWN_ARROW } from '@angular/cdk/keycodes';
|
---|
10 | import { Directive, ElementRef, EventEmitter, Inject, Input, Optional, Output, } from '@angular/core';
|
---|
11 | import { DateAdapter, MAT_DATE_FORMATS, } from '@angular/material/core';
|
---|
12 | import { Subscription, Subject } from 'rxjs';
|
---|
13 | import { createMissingDateImplError } from './datepicker-errors';
|
---|
14 | /**
|
---|
15 | * An event used for datepicker input and change events. We don't always have access to a native
|
---|
16 | * input or change event because the event may have been triggered by the user clicking on the
|
---|
17 | * calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
|
---|
18 | */
|
---|
19 | export class MatDatepickerInputEvent {
|
---|
20 | constructor(
|
---|
21 | /** Reference to the datepicker input component that emitted the event. */
|
---|
22 | target,
|
---|
23 | /** Reference to the native input element associated with the datepicker input. */
|
---|
24 | targetElement) {
|
---|
25 | this.target = target;
|
---|
26 | this.targetElement = targetElement;
|
---|
27 | this.value = this.target.value;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | /** Base class for datepicker inputs. */
|
---|
31 | export class MatDatepickerInputBase {
|
---|
32 | constructor(_elementRef, _dateAdapter, _dateFormats) {
|
---|
33 | this._elementRef = _elementRef;
|
---|
34 | this._dateAdapter = _dateAdapter;
|
---|
35 | this._dateFormats = _dateFormats;
|
---|
36 | /** Emits when a `change` event is fired on this `<input>`. */
|
---|
37 | this.dateChange = new EventEmitter();
|
---|
38 | /** Emits when an `input` event is fired on this `<input>`. */
|
---|
39 | this.dateInput = new EventEmitter();
|
---|
40 | /** Emits when the internal state has changed */
|
---|
41 | this.stateChanges = new Subject();
|
---|
42 | this._onTouched = () => { };
|
---|
43 | this._validatorOnChange = () => { };
|
---|
44 | this._cvaOnChange = () => { };
|
---|
45 | this._valueChangesSubscription = Subscription.EMPTY;
|
---|
46 | this._localeSubscription = Subscription.EMPTY;
|
---|
47 | /** The form control validator for whether the input parses. */
|
---|
48 | this._parseValidator = () => {
|
---|
49 | return this._lastValueValid ?
|
---|
50 | null : { 'matDatepickerParse': { 'text': this._elementRef.nativeElement.value } };
|
---|
51 | };
|
---|
52 | /** The form control validator for the date filter. */
|
---|
53 | this._filterValidator = (control) => {
|
---|
54 | const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
---|
55 | return !controlValue || this._matchesFilter(controlValue) ?
|
---|
56 | null : { 'matDatepickerFilter': true };
|
---|
57 | };
|
---|
58 | /** The form control validator for the min date. */
|
---|
59 | this._minValidator = (control) => {
|
---|
60 | const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
---|
61 | const min = this._getMinDate();
|
---|
62 | return (!min || !controlValue ||
|
---|
63 | this._dateAdapter.compareDate(min, controlValue) <= 0) ?
|
---|
64 | null : { 'matDatepickerMin': { 'min': min, 'actual': controlValue } };
|
---|
65 | };
|
---|
66 | /** The form control validator for the max date. */
|
---|
67 | this._maxValidator = (control) => {
|
---|
68 | const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
---|
69 | const max = this._getMaxDate();
|
---|
70 | return (!max || !controlValue ||
|
---|
71 | this._dateAdapter.compareDate(max, controlValue) >= 0) ?
|
---|
72 | null : { 'matDatepickerMax': { 'max': max, 'actual': controlValue } };
|
---|
73 | };
|
---|
74 | /** Whether the last value set on the input was valid. */
|
---|
75 | this._lastValueValid = false;
|
---|
76 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
77 | if (!this._dateAdapter) {
|
---|
78 | throw createMissingDateImplError('DateAdapter');
|
---|
79 | }
|
---|
80 | if (!this._dateFormats) {
|
---|
81 | throw createMissingDateImplError('MAT_DATE_FORMATS');
|
---|
82 | }
|
---|
83 | }
|
---|
84 | // Update the displayed date when the locale changes.
|
---|
85 | this._localeSubscription = _dateAdapter.localeChanges.subscribe(() => {
|
---|
86 | this._assignValueProgrammatically(this.value);
|
---|
87 | });
|
---|
88 | }
|
---|
89 | /** The value of the input. */
|
---|
90 | get value() {
|
---|
91 | return this._model ? this._getValueFromModel(this._model.selection) : this._pendingValue;
|
---|
92 | }
|
---|
93 | set value(value) {
|
---|
94 | this._assignValueProgrammatically(value);
|
---|
95 | }
|
---|
96 | /** Whether the datepicker-input is disabled. */
|
---|
97 | get disabled() { return !!this._disabled || this._parentDisabled(); }
|
---|
98 | set disabled(value) {
|
---|
99 | const newValue = coerceBooleanProperty(value);
|
---|
100 | const element = this._elementRef.nativeElement;
|
---|
101 | if (this._disabled !== newValue) {
|
---|
102 | this._disabled = newValue;
|
---|
103 | this.stateChanges.next(undefined);
|
---|
104 | }
|
---|
105 | // We need to null check the `blur` method, because it's undefined during SSR.
|
---|
106 | // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
|
---|
107 | // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
|
---|
108 | // element has been inserted.
|
---|
109 | if (newValue && this._isInitialized && element.blur) {
|
---|
110 | // Normally, native input elements automatically blur if they turn disabled. This behavior
|
---|
111 | // is problematic, because it would mean that it triggers another change detection cycle,
|
---|
112 | // which then causes a changed after checked error if the input element was focused before.
|
---|
113 | element.blur();
|
---|
114 | }
|
---|
115 | }
|
---|
116 | /** Gets the base validator functions. */
|
---|
117 | _getValidators() {
|
---|
118 | return [this._parseValidator, this._minValidator, this._maxValidator, this._filterValidator];
|
---|
119 | }
|
---|
120 | /** Registers a date selection model with the input. */
|
---|
121 | _registerModel(model) {
|
---|
122 | this._model = model;
|
---|
123 | this._valueChangesSubscription.unsubscribe();
|
---|
124 | if (this._pendingValue) {
|
---|
125 | this._assignValue(this._pendingValue);
|
---|
126 | }
|
---|
127 | this._valueChangesSubscription = this._model.selectionChanged.subscribe(event => {
|
---|
128 | if (this._shouldHandleChangeEvent(event)) {
|
---|
129 | const value = this._getValueFromModel(event.selection);
|
---|
130 | this._lastValueValid = this._isValidValue(value);
|
---|
131 | this._cvaOnChange(value);
|
---|
132 | this._onTouched();
|
---|
133 | this._formatValue(value);
|
---|
134 | this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
|
---|
135 | this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
|
---|
136 | }
|
---|
137 | });
|
---|
138 | }
|
---|
139 | ngAfterViewInit() {
|
---|
140 | this._isInitialized = true;
|
---|
141 | }
|
---|
142 | ngOnChanges(changes) {
|
---|
143 | if (dateInputsHaveChanged(changes, this._dateAdapter)) {
|
---|
144 | this.stateChanges.next(undefined);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | ngOnDestroy() {
|
---|
148 | this._valueChangesSubscription.unsubscribe();
|
---|
149 | this._localeSubscription.unsubscribe();
|
---|
150 | this.stateChanges.complete();
|
---|
151 | }
|
---|
152 | /** @docs-private */
|
---|
153 | registerOnValidatorChange(fn) {
|
---|
154 | this._validatorOnChange = fn;
|
---|
155 | }
|
---|
156 | /** @docs-private */
|
---|
157 | validate(c) {
|
---|
158 | return this._validator ? this._validator(c) : null;
|
---|
159 | }
|
---|
160 | // Implemented as part of ControlValueAccessor.
|
---|
161 | writeValue(value) {
|
---|
162 | this._assignValueProgrammatically(value);
|
---|
163 | }
|
---|
164 | // Implemented as part of ControlValueAccessor.
|
---|
165 | registerOnChange(fn) {
|
---|
166 | this._cvaOnChange = fn;
|
---|
167 | }
|
---|
168 | // Implemented as part of ControlValueAccessor.
|
---|
169 | registerOnTouched(fn) {
|
---|
170 | this._onTouched = fn;
|
---|
171 | }
|
---|
172 | // Implemented as part of ControlValueAccessor.
|
---|
173 | setDisabledState(isDisabled) {
|
---|
174 | this.disabled = isDisabled;
|
---|
175 | }
|
---|
176 | _onKeydown(event) {
|
---|
177 | const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
|
---|
178 | if (isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
|
---|
179 | this._openPopup();
|
---|
180 | event.preventDefault();
|
---|
181 | }
|
---|
182 | }
|
---|
183 | _onInput(value) {
|
---|
184 | const lastValueWasValid = this._lastValueValid;
|
---|
185 | let date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput);
|
---|
186 | this._lastValueValid = this._isValidValue(date);
|
---|
187 | date = this._dateAdapter.getValidDateOrNull(date);
|
---|
188 | if (!this._dateAdapter.sameDate(date, this.value)) {
|
---|
189 | this._assignValue(date);
|
---|
190 | this._cvaOnChange(date);
|
---|
191 | this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
|
---|
192 | }
|
---|
193 | else {
|
---|
194 | // Call the CVA change handler for invalid values
|
---|
195 | // since this is what marks the control as dirty.
|
---|
196 | if (value && !this.value) {
|
---|
197 | this._cvaOnChange(date);
|
---|
198 | }
|
---|
199 | if (lastValueWasValid !== this._lastValueValid) {
|
---|
200 | this._validatorOnChange();
|
---|
201 | }
|
---|
202 | }
|
---|
203 | }
|
---|
204 | _onChange() {
|
---|
205 | this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
|
---|
206 | }
|
---|
207 | /** Handles blur events on the input. */
|
---|
208 | _onBlur() {
|
---|
209 | // Reformat the input only if we have a valid value.
|
---|
210 | if (this.value) {
|
---|
211 | this._formatValue(this.value);
|
---|
212 | }
|
---|
213 | this._onTouched();
|
---|
214 | }
|
---|
215 | /** Formats a value and sets it on the input element. */
|
---|
216 | _formatValue(value) {
|
---|
217 | this._elementRef.nativeElement.value =
|
---|
218 | value ? this._dateAdapter.format(value, this._dateFormats.display.dateInput) : '';
|
---|
219 | }
|
---|
220 | /** Assigns a value to the model. */
|
---|
221 | _assignValue(value) {
|
---|
222 | // We may get some incoming values before the model was
|
---|
223 | // assigned. Save the value so that we can assign it later.
|
---|
224 | if (this._model) {
|
---|
225 | this._assignValueToModel(value);
|
---|
226 | this._pendingValue = null;
|
---|
227 | }
|
---|
228 | else {
|
---|
229 | this._pendingValue = value;
|
---|
230 | }
|
---|
231 | }
|
---|
232 | /** Whether a value is considered valid. */
|
---|
233 | _isValidValue(value) {
|
---|
234 | return !value || this._dateAdapter.isValid(value);
|
---|
235 | }
|
---|
236 | /**
|
---|
237 | * Checks whether a parent control is disabled. This is in place so that it can be overridden
|
---|
238 | * by inputs extending this one which can be placed inside of a group that can be disabled.
|
---|
239 | */
|
---|
240 | _parentDisabled() {
|
---|
241 | return false;
|
---|
242 | }
|
---|
243 | /** Programmatically assigns a value to the input. */
|
---|
244 | _assignValueProgrammatically(value) {
|
---|
245 | value = this._dateAdapter.deserialize(value);
|
---|
246 | this._lastValueValid = this._isValidValue(value);
|
---|
247 | value = this._dateAdapter.getValidDateOrNull(value);
|
---|
248 | this._assignValue(value);
|
---|
249 | this._formatValue(value);
|
---|
250 | }
|
---|
251 | /** Gets whether a value matches the current date filter. */
|
---|
252 | _matchesFilter(value) {
|
---|
253 | const filter = this._getDateFilter();
|
---|
254 | return !filter || filter(value);
|
---|
255 | }
|
---|
256 | }
|
---|
257 | MatDatepickerInputBase.decorators = [
|
---|
258 | { type: Directive }
|
---|
259 | ];
|
---|
260 | MatDatepickerInputBase.ctorParameters = () => [
|
---|
261 | { type: ElementRef },
|
---|
262 | { type: DateAdapter, decorators: [{ type: Optional }] },
|
---|
263 | { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DATE_FORMATS,] }] }
|
---|
264 | ];
|
---|
265 | MatDatepickerInputBase.propDecorators = {
|
---|
266 | value: [{ type: Input }],
|
---|
267 | disabled: [{ type: Input }],
|
---|
268 | dateChange: [{ type: Output }],
|
---|
269 | dateInput: [{ type: Output }]
|
---|
270 | };
|
---|
271 | /**
|
---|
272 | * Checks whether the `SimpleChanges` object from an `ngOnChanges`
|
---|
273 | * callback has any changes, accounting for date objects.
|
---|
274 | */
|
---|
275 | export function dateInputsHaveChanged(changes, adapter) {
|
---|
276 | const keys = Object.keys(changes);
|
---|
277 | for (let key of keys) {
|
---|
278 | const { previousValue, currentValue } = changes[key];
|
---|
279 | if (adapter.isDateInstance(previousValue) && adapter.isDateInstance(currentValue)) {
|
---|
280 | if (!adapter.sameDate(previousValue, currentValue)) {
|
---|
281 | return true;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | else {
|
---|
285 | return true;
|
---|
286 | }
|
---|
287 | }
|
---|
288 | return false;
|
---|
289 | }
|
---|
290 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZXBpY2tlci1pbnB1dC1iYXNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2RhdGVwaWNrZXIvZGF0ZXBpY2tlci1pbnB1dC1iYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBZSxxQkFBcUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBQzFFLE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUNqRCxPQUFPLEVBQ0wsU0FBUyxFQUNULFVBQVUsRUFDVixZQUFZLEVBQ1osTUFBTSxFQUNOLEtBQUssRUFFTCxRQUFRLEVBQ1IsTUFBTSxHQUlQLE1BQU0sZUFBZSxDQUFDO0FBUXZCLE9BQU8sRUFDTCxXQUFXLEVBQ1gsZ0JBQWdCLEdBRWpCLE1BQU0sd0JBQXdCLENBQUM7QUFDaEMsT0FBTyxFQUFDLFlBQVksRUFBRSxPQUFPLEVBQUMsTUFBTSxNQUFNLENBQUM7QUFDM0MsT0FBTyxFQUFDLDBCQUEwQixFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFPL0Q7Ozs7R0FJRztBQUNILE1BQU0sT0FBTyx1QkFBdUI7SUFJbEM7SUFDSSwwRUFBMEU7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