@angular/material 14.2.0-next.1 → 14.2.0-next.2
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/datepicker/index.d.ts +4 -1
- package/esm2020/chips/chip-list.mjs +4 -5
- package/esm2020/core/version.mjs +1 -1
- package/esm2020/datepicker/date-range-input-parts.mjs +43 -8
- package/esm2020/list/list.mjs +2 -1
- package/fesm2015/chips.mjs +3 -4
- package/fesm2015/chips.mjs.map +1 -1
- package/fesm2015/core.mjs +1 -1
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/datepicker.mjs +43 -6
- package/fesm2015/datepicker.mjs.map +1 -1
- package/fesm2015/list.mjs +1 -0
- package/fesm2015/list.mjs.map +1 -1
- package/fesm2020/chips.mjs +3 -4
- package/fesm2020/chips.mjs.map +1 -1
- package/fesm2020/core.mjs +1 -1
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/datepicker.mjs +41 -6
- package/fesm2020/datepicker.mjs.map +1 -1
- package/fesm2020/list.mjs +1 -0
- package/fesm2020/list.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
package/fesm2015/datepicker.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/port
|
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
|
-
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Injectable, Optional, SkipSelf, InjectionToken, Inject, ViewChild, forwardRef, Directive, Attribute, ContentChild, InjectFlags, Self, TemplateRef, NgModule } from '@angular/core';
|
|
10
|
+
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Injectable, Optional, SkipSelf, InjectionToken, Inject, ViewChild, forwardRef, Directive, Attribute, ContentChild, inject, InjectFlags, Self, TemplateRef, NgModule } from '@angular/core';
|
|
11
11
|
import * as i3 from '@angular/material/button';
|
|
12
12
|
import { MatButtonModule } from '@angular/material/button';
|
|
13
13
|
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
@@ -17,6 +17,7 @@ import { Subject, Subscription, merge, of } from 'rxjs';
|
|
|
17
17
|
import { ESCAPE, hasModifierKey, SPACE, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, BACKSPACE } from '@angular/cdk/keycodes';
|
|
18
18
|
import { take, startWith, filter } from 'rxjs/operators';
|
|
19
19
|
import * as i2 from '@angular/cdk/bidi';
|
|
20
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
20
21
|
import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
21
22
|
import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
22
23
|
import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
|
|
@@ -3286,13 +3287,15 @@ const MAT_DATE_RANGE_INPUT_PARENT = new InjectionToken('MAT_DATE_RANGE_INPUT_PAR
|
|
|
3286
3287
|
* Base class for the individual inputs that can be projected inside a `mat-date-range-input`.
|
|
3287
3288
|
*/
|
|
3288
3289
|
class MatDateRangeInputPartBase extends MatDatepickerInputBase {
|
|
3289
|
-
constructor(_rangeInput,
|
|
3290
|
-
super(
|
|
3290
|
+
constructor(_rangeInput, _elementRef, _defaultErrorStateMatcher, _injector, _parentForm, _parentFormGroup, dateAdapter, dateFormats) {
|
|
3291
|
+
super(_elementRef, dateAdapter, dateFormats);
|
|
3291
3292
|
this._rangeInput = _rangeInput;
|
|
3293
|
+
this._elementRef = _elementRef;
|
|
3292
3294
|
this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
|
|
3293
3295
|
this._injector = _injector;
|
|
3294
3296
|
this._parentForm = _parentForm;
|
|
3295
3297
|
this._parentFormGroup = _parentFormGroup;
|
|
3298
|
+
this._dir = inject(Directionality, InjectFlags.Optional);
|
|
3296
3299
|
}
|
|
3297
3300
|
ngOnInit() {
|
|
3298
3301
|
// We need the date input to provide itself as a `ControlValueAccessor` and a `Validator`, while
|
|
@@ -3430,6 +3433,24 @@ class MatStartDate extends _MatDateRangeInputBase {
|
|
|
3430
3433
|
const value = element.value;
|
|
3431
3434
|
return value.length > 0 ? value : element.placeholder;
|
|
3432
3435
|
}
|
|
3436
|
+
_onKeydown(event) {
|
|
3437
|
+
var _a;
|
|
3438
|
+
const endInput = this._rangeInput._endInput;
|
|
3439
|
+
const element = this._elementRef.nativeElement;
|
|
3440
|
+
const isLtr = ((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) !== 'rtl';
|
|
3441
|
+
// If the user hits RIGHT (LTR) when at the end of the input (and no
|
|
3442
|
+
// selection), move the cursor to the start of the end input.
|
|
3443
|
+
if (((event.keyCode === RIGHT_ARROW && isLtr) || (event.keyCode === LEFT_ARROW && !isLtr)) &&
|
|
3444
|
+
element.selectionStart === element.value.length &&
|
|
3445
|
+
element.selectionEnd === element.value.length) {
|
|
3446
|
+
event.preventDefault();
|
|
3447
|
+
endInput._elementRef.nativeElement.setSelectionRange(0, 0);
|
|
3448
|
+
endInput.focus();
|
|
3449
|
+
}
|
|
3450
|
+
else {
|
|
3451
|
+
super._onKeydown(event);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3433
3454
|
}
|
|
3434
3455
|
MatStartDate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MatStartDate, deps: [{ token: MAT_DATE_RANGE_INPUT_PARENT }, { token: i0.ElementRef }, { token: i1$1.ErrorStateMatcher }, { token: i0.Injector }, { token: i2$2.NgForm, optional: true }, { token: i2$2.FormGroupDirective, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: MAT_DATE_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3435
3456
|
MatStartDate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: MatStartDate, selector: "input[matStartDate]", inputs: { errorStateMatcher: "errorStateMatcher" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { attributes: { "type": "text" }, listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "keydown": "_onKeydown($event)", "blur": "_onBlur()" }, properties: { "disabled": "disabled", "attr.id": "_rangeInput.id", "attr.aria-haspopup": "_rangeInput.rangePicker ? \"dialog\" : null", "attr.aria-owns": "(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null", "attr.min": "_getMinDate() ? _dateAdapter.toIso8601(_getMinDate()) : null", "attr.max": "_getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()) : null" }, classAttribute: "mat-start-date mat-date-range-input-inner" }, providers: [
|
|
@@ -3516,11 +3537,27 @@ class MatEndDate extends _MatDateRangeInputBase {
|
|
|
3516
3537
|
}
|
|
3517
3538
|
}
|
|
3518
3539
|
_onKeydown(event) {
|
|
3540
|
+
var _a;
|
|
3541
|
+
const startInput = this._rangeInput._startInput;
|
|
3542
|
+
const element = this._elementRef.nativeElement;
|
|
3543
|
+
const isLtr = ((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) !== 'rtl';
|
|
3519
3544
|
// If the user is pressing backspace on an empty end input, move focus back to the start.
|
|
3520
|
-
if (event.keyCode === BACKSPACE && !
|
|
3521
|
-
|
|
3545
|
+
if (event.keyCode === BACKSPACE && !element.value) {
|
|
3546
|
+
startInput.focus();
|
|
3547
|
+
}
|
|
3548
|
+
// If the user hits LEFT (LTR) when at the start of the input (and no
|
|
3549
|
+
// selection), move the cursor to the end of the start input.
|
|
3550
|
+
else if (((event.keyCode === LEFT_ARROW && isLtr) || (event.keyCode === RIGHT_ARROW && !isLtr)) &&
|
|
3551
|
+
element.selectionStart === 0 &&
|
|
3552
|
+
element.selectionEnd === 0) {
|
|
3553
|
+
event.preventDefault();
|
|
3554
|
+
const endPosition = startInput._elementRef.nativeElement.value.length;
|
|
3555
|
+
startInput._elementRef.nativeElement.setSelectionRange(endPosition, endPosition);
|
|
3556
|
+
startInput.focus();
|
|
3557
|
+
}
|
|
3558
|
+
else {
|
|
3559
|
+
super._onKeydown(event);
|
|
3522
3560
|
}
|
|
3523
|
-
super._onKeydown(event);
|
|
3524
3561
|
}
|
|
3525
3562
|
}
|
|
3526
3563
|
MatEndDate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MatEndDate, deps: [{ token: MAT_DATE_RANGE_INPUT_PARENT }, { token: i0.ElementRef }, { token: i1$1.ErrorStateMatcher }, { token: i0.Injector }, { token: i2$2.NgForm, optional: true }, { token: i2$2.FormGroupDirective, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: MAT_DATE_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|