@angular/material 14.2.1 → 14.2.3
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/bottom-sheet/index.d.ts +2 -0
- package/datepicker/index.d.ts +1 -0
- package/dialog/index.d.ts +2 -0
- package/esm2020/bottom-sheet/bottom-sheet-config.mjs +3 -1
- package/esm2020/bottom-sheet/bottom-sheet-container.mjs +3 -3
- package/esm2020/core/version.mjs +1 -1
- package/esm2020/datepicker/datepicker-base.mjs +25 -12
- package/esm2020/dialog/dialog-config.mjs +3 -1
- package/esm2020/stepper/stepper.mjs +3 -3
- package/esm2020/tooltip/tooltip.mjs +16 -10
- package/fesm2015/bottom-sheet.mjs +4 -2
- package/fesm2015/bottom-sheet.mjs.map +1 -1
- package/fesm2015/core.mjs +1 -1
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/datepicker.mjs +24 -12
- package/fesm2015/datepicker.mjs.map +1 -1
- package/fesm2015/dialog.mjs +2 -0
- package/fesm2015/dialog.mjs.map +1 -1
- package/fesm2015/stepper.mjs +2 -2
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/tooltip.mjs +16 -9
- package/fesm2015/tooltip.mjs.map +1 -1
- package/fesm2020/bottom-sheet.mjs +4 -2
- package/fesm2020/bottom-sheet.mjs.map +1 -1
- package/fesm2020/core.mjs +1 -1
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/datepicker.mjs +24 -12
- package/fesm2020/datepicker.mjs.map +1 -1
- package/fesm2020/dialog.mjs +2 -0
- package/fesm2020/dialog.mjs.map +1 -1
- package/fesm2020/stepper.mjs +2 -2
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/tooltip.mjs +15 -9
- package/fesm2020/tooltip.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/tooltip/index.d.ts +4 -4
package/fesm2015/datepicker.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { Overlay, FlexibleConnectedPositionStrategy, OverlayConfig, OverlayModul
|
|
|
5
5
|
import * as i6 from '@angular/cdk/portal';
|
|
6
6
|
import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
8
|
-
import { CommonModule } from '@angular/common';
|
|
8
|
+
import { DOCUMENT, 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,
|
|
10
|
+
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Injectable, Optional, SkipSelf, InjectionToken, Inject, ViewChild, forwardRef, inject, Directive, Attribute, ContentChild, 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';
|
|
@@ -2241,6 +2241,7 @@ class MatDatepickerBase {
|
|
|
2241
2241
|
this._dir = _dir;
|
|
2242
2242
|
this._model = _model;
|
|
2243
2243
|
this._inputStateChanges = Subscription.EMPTY;
|
|
2244
|
+
this._document = inject(DOCUMENT);
|
|
2244
2245
|
/** The view that the calendar should start in. */
|
|
2245
2246
|
this.startView = 'month';
|
|
2246
2247
|
this._touchUi = false;
|
|
@@ -2449,29 +2450,40 @@ class MatDatepickerBase {
|
|
|
2449
2450
|
if (!this._opened) {
|
|
2450
2451
|
return;
|
|
2451
2452
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
instance._animationDone.pipe(take(1)).subscribe(() => this._destroyOverlay());
|
|
2456
|
-
}
|
|
2453
|
+
const canRestoreFocus = this._restoreFocus &&
|
|
2454
|
+
this._focusedElementBeforeOpen &&
|
|
2455
|
+
typeof this._focusedElementBeforeOpen.focus === 'function';
|
|
2457
2456
|
const completeClose = () => {
|
|
2458
2457
|
// The `_opened` could've been reset already if
|
|
2459
2458
|
// we got two events in quick succession.
|
|
2460
2459
|
if (this._opened) {
|
|
2461
2460
|
this._opened = false;
|
|
2462
2461
|
this.closedStream.emit();
|
|
2463
|
-
this._focusedElementBeforeOpen = null;
|
|
2464
2462
|
}
|
|
2465
2463
|
};
|
|
2466
|
-
if (this.
|
|
2467
|
-
this.
|
|
2468
|
-
|
|
2464
|
+
if (this._componentRef) {
|
|
2465
|
+
const { instance, location } = this._componentRef;
|
|
2466
|
+
instance._startExitAnimation();
|
|
2467
|
+
instance._animationDone.pipe(take(1)).subscribe(() => {
|
|
2468
|
+
const activeElement = this._document.activeElement;
|
|
2469
|
+
// Since we restore focus after the exit animation, we have to check that
|
|
2470
|
+
// the user didn't move focus themselves inside the `close` handler.
|
|
2471
|
+
if (canRestoreFocus &&
|
|
2472
|
+
(!activeElement ||
|
|
2473
|
+
activeElement === this._document.activeElement ||
|
|
2474
|
+
location.nativeElement.contains(activeElement))) {
|
|
2475
|
+
this._focusedElementBeforeOpen.focus();
|
|
2476
|
+
}
|
|
2477
|
+
this._focusedElementBeforeOpen = null;
|
|
2478
|
+
this._destroyOverlay();
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
if (canRestoreFocus) {
|
|
2469
2482
|
// Because IE moves focus asynchronously, we can't count on it being restored before we've
|
|
2470
2483
|
// marked the datepicker as closed. If the event fires out of sequence and the element that
|
|
2471
2484
|
// we're refocusing opens the datepicker on focus, the user could be stuck with not being
|
|
2472
2485
|
// able to close the calendar at all. We work around it by making the logic, that marks
|
|
2473
2486
|
// the datepicker as closed, async as well.
|
|
2474
|
-
this._focusedElementBeforeOpen.focus();
|
|
2475
2487
|
setTimeout(completeClose);
|
|
2476
2488
|
}
|
|
2477
2489
|
else {
|