@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/fesm2020/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 { Injectable, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, SkipSelf, InjectionToken, Inject, ViewChild, forwardRef, Directive, Attribute, ContentChild,
|
|
10
|
+
import { Injectable, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, 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';
|
|
@@ -2236,6 +2236,7 @@ class MatDatepickerBase {
|
|
|
2236
2236
|
this._dir = _dir;
|
|
2237
2237
|
this._model = _model;
|
|
2238
2238
|
this._inputStateChanges = Subscription.EMPTY;
|
|
2239
|
+
this._document = inject(DOCUMENT);
|
|
2239
2240
|
/** The view that the calendar should start in. */
|
|
2240
2241
|
this.startView = 'month';
|
|
2241
2242
|
this._touchUi = false;
|
|
@@ -2442,29 +2443,40 @@ class MatDatepickerBase {
|
|
|
2442
2443
|
if (!this._opened) {
|
|
2443
2444
|
return;
|
|
2444
2445
|
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
instance._animationDone.pipe(take(1)).subscribe(() => this._destroyOverlay());
|
|
2449
|
-
}
|
|
2446
|
+
const canRestoreFocus = this._restoreFocus &&
|
|
2447
|
+
this._focusedElementBeforeOpen &&
|
|
2448
|
+
typeof this._focusedElementBeforeOpen.focus === 'function';
|
|
2450
2449
|
const completeClose = () => {
|
|
2451
2450
|
// The `_opened` could've been reset already if
|
|
2452
2451
|
// we got two events in quick succession.
|
|
2453
2452
|
if (this._opened) {
|
|
2454
2453
|
this._opened = false;
|
|
2455
2454
|
this.closedStream.emit();
|
|
2456
|
-
this._focusedElementBeforeOpen = null;
|
|
2457
2455
|
}
|
|
2458
2456
|
};
|
|
2459
|
-
if (this.
|
|
2460
|
-
this.
|
|
2461
|
-
|
|
2457
|
+
if (this._componentRef) {
|
|
2458
|
+
const { instance, location } = this._componentRef;
|
|
2459
|
+
instance._startExitAnimation();
|
|
2460
|
+
instance._animationDone.pipe(take(1)).subscribe(() => {
|
|
2461
|
+
const activeElement = this._document.activeElement;
|
|
2462
|
+
// Since we restore focus after the exit animation, we have to check that
|
|
2463
|
+
// the user didn't move focus themselves inside the `close` handler.
|
|
2464
|
+
if (canRestoreFocus &&
|
|
2465
|
+
(!activeElement ||
|
|
2466
|
+
activeElement === this._document.activeElement ||
|
|
2467
|
+
location.nativeElement.contains(activeElement))) {
|
|
2468
|
+
this._focusedElementBeforeOpen.focus();
|
|
2469
|
+
}
|
|
2470
|
+
this._focusedElementBeforeOpen = null;
|
|
2471
|
+
this._destroyOverlay();
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
if (canRestoreFocus) {
|
|
2462
2475
|
// Because IE moves focus asynchronously, we can't count on it being restored before we've
|
|
2463
2476
|
// marked the datepicker as closed. If the event fires out of sequence and the element that
|
|
2464
2477
|
// we're refocusing opens the datepicker on focus, the user could be stuck with not being
|
|
2465
2478
|
// able to close the calendar at all. We work around it by making the logic, that marks
|
|
2466
2479
|
// the datepicker as closed, async as well.
|
|
2467
|
-
this._focusedElementBeforeOpen.focus();
|
|
2468
2480
|
setTimeout(completeClose);
|
|
2469
2481
|
}
|
|
2470
2482
|
else {
|