@angular/material 13.2.3 → 13.2.6
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/autocomplete/autocomplete-trigger.d.ts +1 -0
- package/button-toggle/_button-toggle-theme.scss +14 -2
- package/checkbox/_checkbox-theme.scss +1 -1
- package/core/theming/_theming.scss +9 -0
- package/dialog/dialog-config.d.ts +2 -0
- package/dialog/dialog-container.d.ts +1 -4
- package/dialog/dialog.d.ts +12 -6
- package/dialog/testing/dialog-opener.d.ts +33 -0
- package/dialog/testing/public-api.d.ts +1 -0
- package/esm2020/autocomplete/autocomplete-trigger.mjs +19 -6
- package/esm2020/bottom-sheet/bottom-sheet-animations.mjs +10 -4
- package/esm2020/button/button.mjs +3 -3
- package/esm2020/button-toggle/button-toggle.mjs +2 -2
- package/esm2020/checkbox/checkbox.mjs +4 -2
- package/esm2020/core/version.mjs +1 -1
- package/esm2020/datepicker/calendar.mjs +9 -9
- package/esm2020/datepicker/datepicker-input-base.mjs +9 -4
- package/esm2020/dialog/dialog-animations.mjs +10 -4
- package/esm2020/dialog/dialog-config.mjs +3 -1
- package/esm2020/dialog/dialog-container.mjs +14 -14
- package/esm2020/dialog/dialog.mjs +15 -31
- package/esm2020/dialog/testing/dialog-opener.mjs +67 -0
- package/esm2020/dialog/testing/public-api.mjs +2 -1
- package/esm2020/expansion/expansion-panel.mjs +3 -3
- package/esm2020/form-field/form-field.mjs +3 -3
- package/esm2020/menu/menu-item.mjs +5 -1
- package/esm2020/menu/menu.mjs +17 -1
- package/esm2020/progress-spinner/progress-spinner-module.mjs +5 -5
- package/esm2020/progress-spinner/progress-spinner.mjs +8 -48
- package/esm2020/progress-spinner/public-api.mjs +10 -2
- package/esm2020/radio/radio.mjs +3 -3
- package/esm2020/select/select.mjs +14 -4
- package/esm2020/sidenav/drawer.mjs +3 -3
- package/esm2020/sidenav/sidenav.mjs +3 -3
- package/esm2020/slide-toggle/slide-toggle.mjs +3 -2
- package/esm2020/sort/sort-header.mjs +4 -4
- package/esm2020/tabs/tab-body.mjs +3 -3
- package/esm2020/tabs/tab-header.mjs +3 -3
- package/esm2020/tooltip/testing/tooltip-harness.mjs +12 -7
- package/esm2020/tooltip/tooltip.mjs +117 -42
- package/fesm2015/autocomplete.mjs +19 -6
- package/fesm2015/autocomplete.mjs.map +1 -1
- package/fesm2015/bottom-sheet.mjs +9 -3
- package/fesm2015/bottom-sheet.mjs.map +1 -1
- package/fesm2015/button-toggle.mjs +2 -2
- package/fesm2015/button.mjs +2 -2
- package/fesm2015/button.mjs.map +1 -1
- package/fesm2015/checkbox.mjs +3 -1
- package/fesm2015/checkbox.mjs.map +1 -1
- package/fesm2015/core.mjs +1 -1
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/datepicker.mjs +15 -10
- package/fesm2015/datepicker.mjs.map +1 -1
- package/fesm2015/dialog/testing.mjs +65 -2
- package/fesm2015/dialog/testing.mjs.map +1 -1
- package/fesm2015/dialog.mjs +38 -46
- package/fesm2015/dialog.mjs.map +1 -1
- package/fesm2015/expansion.mjs +2 -2
- package/fesm2015/expansion.mjs.map +1 -1
- package/fesm2015/form-field.mjs +2 -2
- package/fesm2015/form-field.mjs.map +1 -1
- package/fesm2015/menu.mjs +21 -0
- package/fesm2015/menu.mjs.map +1 -1
- package/fesm2015/progress-spinner.mjs +22 -57
- package/fesm2015/progress-spinner.mjs.map +1 -1
- package/fesm2015/radio.mjs +2 -2
- package/fesm2015/radio.mjs.map +1 -1
- package/fesm2015/select.mjs +13 -3
- package/fesm2015/select.mjs.map +1 -1
- package/fesm2015/sidenav.mjs +4 -4
- package/fesm2015/sidenav.mjs.map +1 -1
- package/fesm2015/slide-toggle.mjs +2 -1
- package/fesm2015/slide-toggle.mjs.map +1 -1
- package/fesm2015/sort.mjs +3 -3
- package/fesm2015/sort.mjs.map +1 -1
- package/fesm2015/tabs.mjs +4 -4
- package/fesm2015/tabs.mjs.map +1 -1
- package/fesm2015/tooltip/testing.mjs +11 -8
- package/fesm2015/tooltip/testing.mjs.map +1 -1
- package/fesm2015/tooltip.mjs +141 -66
- package/fesm2015/tooltip.mjs.map +1 -1
- package/fesm2020/autocomplete.mjs +19 -6
- package/fesm2020/autocomplete.mjs.map +1 -1
- package/fesm2020/bottom-sheet.mjs +9 -3
- package/fesm2020/bottom-sheet.mjs.map +1 -1
- package/fesm2020/button-toggle.mjs +2 -2
- package/fesm2020/button.mjs +2 -2
- package/fesm2020/button.mjs.map +1 -1
- package/fesm2020/checkbox.mjs +3 -1
- package/fesm2020/checkbox.mjs.map +1 -1
- package/fesm2020/core.mjs +1 -1
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/datepicker.mjs +15 -10
- package/fesm2020/datepicker.mjs.map +1 -1
- package/fesm2020/dialog/testing.mjs +65 -1
- package/fesm2020/dialog/testing.mjs.map +1 -1
- package/fesm2020/dialog.mjs +38 -46
- package/fesm2020/dialog.mjs.map +1 -1
- package/fesm2020/expansion.mjs +2 -2
- package/fesm2020/expansion.mjs.map +1 -1
- package/fesm2020/form-field.mjs +2 -2
- package/fesm2020/form-field.mjs.map +1 -1
- package/fesm2020/menu.mjs +20 -0
- package/fesm2020/menu.mjs.map +1 -1
- package/fesm2020/progress-spinner.mjs +22 -55
- package/fesm2020/progress-spinner.mjs.map +1 -1
- package/fesm2020/radio.mjs +2 -2
- package/fesm2020/radio.mjs.map +1 -1
- package/fesm2020/select.mjs +13 -3
- package/fesm2020/select.mjs.map +1 -1
- package/fesm2020/sidenav.mjs +4 -4
- package/fesm2020/sidenav.mjs.map +1 -1
- package/fesm2020/slide-toggle.mjs +2 -1
- package/fesm2020/slide-toggle.mjs.map +1 -1
- package/fesm2020/sort.mjs +3 -3
- package/fesm2020/sort.mjs.map +1 -1
- package/fesm2020/tabs.mjs +4 -4
- package/fesm2020/tabs.mjs.map +1 -1
- package/fesm2020/tooltip/testing.mjs +11 -6
- package/fesm2020/tooltip/testing.mjs.map +1 -1
- package/fesm2020/tooltip.mjs +134 -58
- package/fesm2020/tooltip.mjs.map +1 -1
- package/menu/menu-item.d.ts +3 -2
- package/package.json +2 -2
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress-spinner/progress-spinner-module.d.ts +1 -1
- package/progress-spinner/progress-spinner.d.ts +1 -18
- package/progress-spinner/public-api.d.ts +8 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/select/select.d.ts +5 -0
- package/tooltip/testing/tooltip-harness.d.ts +6 -0
- package/tooltip/tooltip.d.ts +36 -8
|
@@ -14,23 +14,25 @@ class _MatTooltipHarnessBase extends ComponentHarness {
|
|
|
14
14
|
// We need to dispatch both `touchstart` and a hover event, because the tooltip binds
|
|
15
15
|
// different events depending on the device. The `changedTouches` is there in case the
|
|
16
16
|
// element has ripples.
|
|
17
|
-
|
|
18
|
-
await host.dispatchEvent?.('touchstart', { changedTouches: [] });
|
|
17
|
+
await host.dispatchEvent('touchstart', { changedTouches: [] });
|
|
19
18
|
await host.hover();
|
|
19
|
+
const panel = await this._optionalPanel();
|
|
20
|
+
await panel?.dispatchEvent('animationend', { animationName: this._showAnimationName });
|
|
20
21
|
}
|
|
21
22
|
/** Hides the tooltip. */
|
|
22
23
|
async hide() {
|
|
23
24
|
const host = await this.host();
|
|
24
25
|
// We need to dispatch both `touchstart` and a hover event, because
|
|
25
26
|
// the tooltip binds different events depending on the device.
|
|
26
|
-
|
|
27
|
-
await host.dispatchEvent?.('touchend');
|
|
27
|
+
await host.dispatchEvent('touchend');
|
|
28
28
|
await host.mouseAway();
|
|
29
|
-
await this.
|
|
29
|
+
const panel = await this._optionalPanel();
|
|
30
|
+
await panel?.dispatchEvent('animationend', { animationName: this._hideAnimationName });
|
|
30
31
|
}
|
|
31
32
|
/** Gets whether the tooltip is open. */
|
|
32
33
|
async isOpen() {
|
|
33
|
-
|
|
34
|
+
const panel = await this._optionalPanel();
|
|
35
|
+
return !!panel && !(await panel.hasClass(this._hiddenClass));
|
|
34
36
|
}
|
|
35
37
|
/** Gets a promise for the tooltip panel's text. */
|
|
36
38
|
async getTooltipText() {
|
|
@@ -43,6 +45,9 @@ class MatTooltipHarness extends _MatTooltipHarnessBase {
|
|
|
43
45
|
constructor() {
|
|
44
46
|
super(...arguments);
|
|
45
47
|
this._optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');
|
|
48
|
+
this._hiddenClass = 'mat-tooltip-hide';
|
|
49
|
+
this._showAnimationName = 'mat-tooltip-show';
|
|
50
|
+
this._hideAnimationName = 'mat-tooltip-hide';
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
53
|
* Gets a `HarnessPredicate` that can be used to search
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/tooltip/testing/tooltip-harness.ts","../../../../../../../src/material/tooltip/testing/tooltip-harness-filters.ts","../../../../../../../src/material/tooltip/testing/public-api.ts","../../../../../../../src/material/tooltip/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n AsyncFactoryFn,\n ComponentHarness,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {TooltipHarnessFilters} from './tooltip-harness-filters';\n\nexport abstract class _MatTooltipHarnessBase extends ComponentHarness {\n protected abstract _optionalPanel: AsyncFactoryFn<TestElement | null>;\n\n /** Shows the tooltip. */\n async show(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because the tooltip binds\n // different events depending on the device. The `changedTouches` is there in case the\n // element has ripples.\n
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/tooltip/testing/tooltip-harness.ts","../../../../../../../src/material/tooltip/testing/tooltip-harness-filters.ts","../../../../../../../src/material/tooltip/testing/public-api.ts","../../../../../../../src/material/tooltip/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n AsyncFactoryFn,\n ComponentHarness,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {TooltipHarnessFilters} from './tooltip-harness-filters';\n\nexport abstract class _MatTooltipHarnessBase extends ComponentHarness {\n protected abstract _optionalPanel: AsyncFactoryFn<TestElement | null>;\n protected abstract _hiddenClass: string;\n protected abstract _showAnimationName: string;\n protected abstract _hideAnimationName: string;\n\n /** Shows the tooltip. */\n async show(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because the tooltip binds\n // different events depending on the device. The `changedTouches` is there in case the\n // element has ripples.\n await host.dispatchEvent('touchstart', {changedTouches: []});\n await host.hover();\n const panel = await this._optionalPanel();\n await panel?.dispatchEvent('animationend', {animationName: this._showAnimationName});\n }\n\n /** Hides the tooltip. */\n async hide(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because\n // the tooltip binds different events depending on the device.\n await host.dispatchEvent('touchend');\n await host.mouseAway();\n const panel = await this._optionalPanel();\n await panel?.dispatchEvent('animationend', {animationName: this._hideAnimationName});\n }\n\n /** Gets whether the tooltip is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._optionalPanel();\n return !!panel && !(await panel.hasClass(this._hiddenClass));\n }\n\n /** Gets a promise for the tooltip panel's text. */\n async getTooltipText(): Promise<string> {\n const panel = await this._optionalPanel();\n return panel ? panel.text() : '';\n }\n}\n\n/** Harness for interacting with a standard mat-tooltip in tests. */\nexport class MatTooltipHarness extends _MatTooltipHarnessBase {\n protected _optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');\n protected _hiddenClass = 'mat-tooltip-hide';\n protected _showAnimationName = 'mat-tooltip-show';\n protected _hideAnimationName = 'mat-tooltip-hide';\n static hostSelector = '.mat-tooltip-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search\n * for a tooltip trigger with specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TooltipHarnessFilters = {}): HarnessPredicate<MatTooltipHarness> {\n return new HarnessPredicate(MatTooltipHarness, options);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatTooltipHarness` instances. */\nexport interface TooltipHarnessFilters extends BaseHarnessFilters {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './tooltip-harness';\nexport * from './tooltip-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;MAgBsB,sBAAuB,SAAQ,gBAAgB;;IAOnE,MAAM,IAAI;QACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;QAK/B,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,EAAC,cAAc,EAAE,EAAE,EAAC,CAAC,CAAC;QAC7D,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,MAAM,KAAK,EAAE,aAAa,CAAC,cAAc,EAAE,EAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAC,CAAC,CAAC;KACtF;;IAGD,MAAM,IAAI;QACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;QAI/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,MAAM,KAAK,EAAE,aAAa,CAAC,cAAc,EAAE,EAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAC,CAAC,CAAC;KACtF;;IAGD,MAAM,MAAM;QACV,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;KAC9D;;IAGD,MAAM,cAAc;QAClB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;KAClC;CACF;AAED;MACa,iBAAkB,SAAQ,sBAAsB;IAA7D;;QACY,mBAAc,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACtF,iBAAY,GAAG,kBAAkB,CAAC;QAClC,uBAAkB,GAAG,kBAAkB,CAAC;QACxC,uBAAkB,GAAG,kBAAkB,CAAC;KAYnD;;;;;;;IAHC,OAAO,IAAI,CAAC,UAAiC,EAAE;QAC7C,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;KACzD;;AAVM,8BAAY,GAAG,sBAAsB;;AClE9C;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;;;"}
|
package/fesm2020/tooltip.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { A11yModule } from '@angular/cdk/a11y';
|
|
|
5
5
|
import * as i7 from '@angular/common';
|
|
6
6
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { InjectionToken, Directive, Inject, Input, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
8
|
+
import { InjectionToken, Directive, Inject, Input, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
|
|
9
9
|
import { MatCommonModule } from '@angular/material/core';
|
|
10
10
|
import * as i2 from '@angular/cdk/scrolling';
|
|
11
11
|
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
@@ -17,6 +17,7 @@ import { Breakpoints } from '@angular/cdk/layout';
|
|
|
17
17
|
import * as i3 from '@angular/cdk/platform';
|
|
18
18
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
19
19
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
20
|
+
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
|
|
20
21
|
import { Subject } from 'rxjs';
|
|
21
22
|
import { takeUntil, take } from 'rxjs/operators';
|
|
22
23
|
import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
|
|
@@ -28,24 +29,6 @@ import { trigger, state, style, transition, animate, keyframes } from '@angular/
|
|
|
28
29
|
* Use of this source code is governed by an MIT-style license that can be
|
|
29
30
|
* found in the LICENSE file at https://angular.io/license
|
|
30
31
|
*/
|
|
31
|
-
/**
|
|
32
|
-
* Animations used by MatTooltip.
|
|
33
|
-
* @docs-private
|
|
34
|
-
*/
|
|
35
|
-
const matTooltipAnimations = {
|
|
36
|
-
/** Animation that transitions a tooltip in and out. */
|
|
37
|
-
tooltipState: trigger('state', [
|
|
38
|
-
state('initial, void, hidden', style({ opacity: 0, transform: 'scale(0)' })),
|
|
39
|
-
state('visible', style({ transform: 'scale(1)' })),
|
|
40
|
-
transition('* => visible', animate('200ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
|
|
41
|
-
style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
|
|
42
|
-
style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
|
|
43
|
-
style({ opacity: 1, transform: 'scale(1)', offset: 1 }),
|
|
44
|
-
]))),
|
|
45
|
-
transition('* => hidden', animate('100ms cubic-bezier(0, 0, 0.2, 1)', style({ opacity: 0 }))),
|
|
46
|
-
]),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
32
|
/** Time in ms to throttle repositioning after scroll events. */
|
|
50
33
|
const SCROLL_THROTTLE_MS = 20;
|
|
51
34
|
/**
|
|
@@ -191,6 +174,9 @@ class _MatTooltipBase {
|
|
|
191
174
|
}
|
|
192
175
|
set hideDelay(value) {
|
|
193
176
|
this._hideDelay = coerceNumberProperty(value);
|
|
177
|
+
if (this._tooltipInstance) {
|
|
178
|
+
this._tooltipInstance._mouseLeaveHideDelay = this._hideDelay;
|
|
179
|
+
}
|
|
194
180
|
}
|
|
195
181
|
/** The message to be displayed in the tooltip */
|
|
196
182
|
get message() {
|
|
@@ -279,14 +265,16 @@ class _MatTooltipBase {
|
|
|
279
265
|
this._detach();
|
|
280
266
|
this._portal =
|
|
281
267
|
this._portal || new ComponentPortal(this._tooltipComponent, this._viewContainerRef);
|
|
282
|
-
this._tooltipInstance = overlayRef.attach(this._portal).instance;
|
|
283
|
-
this.
|
|
268
|
+
const instance = (this._tooltipInstance = overlayRef.attach(this._portal).instance);
|
|
269
|
+
instance._triggerElement = this._elementRef.nativeElement;
|
|
270
|
+
instance._mouseLeaveHideDelay = this._hideDelay;
|
|
271
|
+
instance
|
|
284
272
|
.afterHidden()
|
|
285
273
|
.pipe(takeUntil(this._destroyed))
|
|
286
274
|
.subscribe(() => this._detach());
|
|
287
275
|
this._setTooltipClass(this._tooltipClass);
|
|
288
276
|
this._updateTooltipMessage();
|
|
289
|
-
|
|
277
|
+
instance.show(delay);
|
|
290
278
|
}
|
|
291
279
|
/** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */
|
|
292
280
|
hide(delay = this.hideDelay) {
|
|
@@ -351,6 +339,9 @@ class _MatTooltipBase {
|
|
|
351
339
|
this._ngZone.run(() => this.hide(0));
|
|
352
340
|
}
|
|
353
341
|
});
|
|
342
|
+
if (this._defaultOptions?.disableTooltipInteractivity) {
|
|
343
|
+
this._overlayRef.addPanelClass(`${this._cssClassPrefix}-tooltip-panel-non-interactive`);
|
|
344
|
+
}
|
|
354
345
|
return this._overlayRef;
|
|
355
346
|
}
|
|
356
347
|
/** Detaches the currently-attached tooltip. */
|
|
@@ -547,7 +538,15 @@ class _MatTooltipBase {
|
|
|
547
538
|
this._pointerExitEventsInitialized = true;
|
|
548
539
|
const exitListeners = [];
|
|
549
540
|
if (this._platformSupportsMouseEvents()) {
|
|
550
|
-
exitListeners.push([
|
|
541
|
+
exitListeners.push([
|
|
542
|
+
'mouseleave',
|
|
543
|
+
event => {
|
|
544
|
+
const newTarget = event.relatedTarget;
|
|
545
|
+
if (!newTarget || !this._overlayRef?.overlayElement.contains(newTarget)) {
|
|
546
|
+
this.hide();
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
], ['wheel', event => this._wheelListener(event)]);
|
|
551
550
|
}
|
|
552
551
|
else if (this.touchGestures !== 'off') {
|
|
553
552
|
this._disableNativeGesturesIfNecessary();
|
|
@@ -674,14 +673,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
|
|
|
674
673
|
args: [DOCUMENT]
|
|
675
674
|
}] }]; } });
|
|
676
675
|
class _TooltipComponentBase {
|
|
677
|
-
constructor(_changeDetectorRef) {
|
|
676
|
+
constructor(_changeDetectorRef, animationMode) {
|
|
678
677
|
this._changeDetectorRef = _changeDetectorRef;
|
|
679
678
|
/** Property watched by the animation framework to show or hide the tooltip */
|
|
680
679
|
this._visibility = 'initial';
|
|
681
680
|
/** Whether interactions on the page should close the tooltip */
|
|
682
681
|
this._closeOnInteraction = false;
|
|
682
|
+
/** Whether the tooltip is currently visible. */
|
|
683
|
+
this._isVisible = false;
|
|
683
684
|
/** Subject for notifying that the tooltip has been hidden from the view */
|
|
684
685
|
this._onHide = new Subject();
|
|
686
|
+
this._animationsDisabled = animationMode === 'NoopAnimations';
|
|
685
687
|
}
|
|
686
688
|
/**
|
|
687
689
|
* Shows the tooltip with an animation originating from the provided origin
|
|
@@ -690,15 +692,9 @@ class _TooltipComponentBase {
|
|
|
690
692
|
show(delay) {
|
|
691
693
|
// Cancel the delayed hide if it is scheduled
|
|
692
694
|
clearTimeout(this._hideTimeoutId);
|
|
693
|
-
// Body interactions should cancel the tooltip if there is a delay in showing.
|
|
694
|
-
this._closeOnInteraction = true;
|
|
695
695
|
this._showTimeoutId = setTimeout(() => {
|
|
696
|
-
this.
|
|
696
|
+
this._toggleVisibility(true);
|
|
697
697
|
this._showTimeoutId = undefined;
|
|
698
|
-
this._onShow();
|
|
699
|
-
// Mark for check so if any parent component has set the
|
|
700
|
-
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
701
|
-
this._markForCheck();
|
|
702
698
|
}, delay);
|
|
703
699
|
}
|
|
704
700
|
/**
|
|
@@ -709,11 +705,8 @@ class _TooltipComponentBase {
|
|
|
709
705
|
// Cancel the delayed show if it is scheduled
|
|
710
706
|
clearTimeout(this._showTimeoutId);
|
|
711
707
|
this._hideTimeoutId = setTimeout(() => {
|
|
712
|
-
this.
|
|
708
|
+
this._toggleVisibility(false);
|
|
713
709
|
this._hideTimeoutId = undefined;
|
|
714
|
-
// Mark for check so if any parent component has set the
|
|
715
|
-
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
716
|
-
this._markForCheck();
|
|
717
710
|
}, delay);
|
|
718
711
|
}
|
|
719
712
|
/** Returns an observable that notifies when the tooltip has been hidden from view. */
|
|
@@ -722,24 +715,13 @@ class _TooltipComponentBase {
|
|
|
722
715
|
}
|
|
723
716
|
/** Whether the tooltip is being displayed. */
|
|
724
717
|
isVisible() {
|
|
725
|
-
return this.
|
|
718
|
+
return this._isVisible;
|
|
726
719
|
}
|
|
727
720
|
ngOnDestroy() {
|
|
728
721
|
clearTimeout(this._showTimeoutId);
|
|
729
722
|
clearTimeout(this._hideTimeoutId);
|
|
730
723
|
this._onHide.complete();
|
|
731
|
-
|
|
732
|
-
_animationStart() {
|
|
733
|
-
this._closeOnInteraction = false;
|
|
734
|
-
}
|
|
735
|
-
_animationDone(event) {
|
|
736
|
-
const toState = event.toState;
|
|
737
|
-
if (toState === 'hidden' && !this.isVisible()) {
|
|
738
|
-
this._onHide.next();
|
|
739
|
-
}
|
|
740
|
-
if (toState === 'visible' || toState === 'hidden') {
|
|
741
|
-
this._closeOnInteraction = true;
|
|
742
|
-
}
|
|
724
|
+
this._triggerElement = null;
|
|
743
725
|
}
|
|
744
726
|
/**
|
|
745
727
|
* Interactions on the HTML body should close the tooltip immediately as defined in the
|
|
@@ -759,41 +741,110 @@ class _TooltipComponentBase {
|
|
|
759
741
|
_markForCheck() {
|
|
760
742
|
this._changeDetectorRef.markForCheck();
|
|
761
743
|
}
|
|
744
|
+
_handleMouseLeave({ relatedTarget }) {
|
|
745
|
+
if (!relatedTarget || !this._triggerElement.contains(relatedTarget)) {
|
|
746
|
+
this.hide(this._mouseLeaveHideDelay);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
762
749
|
/**
|
|
763
750
|
* Callback for when the timeout in this.show() gets completed.
|
|
764
751
|
* This method is only needed by the mdc-tooltip, and so it is only implemented
|
|
765
752
|
* in the mdc-tooltip, not here.
|
|
766
753
|
*/
|
|
767
754
|
_onShow() { }
|
|
755
|
+
/** Event listener dispatched when an animation on the tooltip finishes. */
|
|
756
|
+
_handleAnimationEnd({ animationName }) {
|
|
757
|
+
if (animationName === this._showAnimation || animationName === this._hideAnimation) {
|
|
758
|
+
this._finalizeAnimation(animationName === this._showAnimation);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
/** Handles the cleanup after an animation has finished. */
|
|
762
|
+
_finalizeAnimation(toVisible) {
|
|
763
|
+
if (toVisible) {
|
|
764
|
+
this._closeOnInteraction = true;
|
|
765
|
+
}
|
|
766
|
+
else if (!this.isVisible()) {
|
|
767
|
+
this._onHide.next();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
/** Toggles the visibility of the tooltip element. */
|
|
771
|
+
_toggleVisibility(isVisible) {
|
|
772
|
+
// We set the classes directly here ourselves so that toggling the tooltip state
|
|
773
|
+
// isn't bound by change detection. This allows us to hide it even if the
|
|
774
|
+
// view ref has been detached from the CD tree.
|
|
775
|
+
const tooltip = this._tooltip.nativeElement;
|
|
776
|
+
const showClass = this._showAnimation;
|
|
777
|
+
const hideClass = this._hideAnimation;
|
|
778
|
+
tooltip.classList.remove(isVisible ? hideClass : showClass);
|
|
779
|
+
tooltip.classList.add(isVisible ? showClass : hideClass);
|
|
780
|
+
this._isVisible = isVisible;
|
|
781
|
+
// It's common for internal apps to disable animations using `* { animation: none !important }`
|
|
782
|
+
// which can break the opening sequence. Try to detect such cases and work around them.
|
|
783
|
+
if (isVisible && !this._animationsDisabled && typeof getComputedStyle === 'function') {
|
|
784
|
+
const styles = getComputedStyle(tooltip);
|
|
785
|
+
// Use `getPropertyValue` to avoid issues with property renaming.
|
|
786
|
+
if (styles.getPropertyValue('animation-duration') === '0s' ||
|
|
787
|
+
styles.getPropertyValue('animation-name') === 'none') {
|
|
788
|
+
this._animationsDisabled = true;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
if (isVisible) {
|
|
792
|
+
this._onShow();
|
|
793
|
+
}
|
|
794
|
+
if (this._animationsDisabled) {
|
|
795
|
+
tooltip.classList.add('_mat-animation-noopable');
|
|
796
|
+
this._finalizeAnimation(isVisible);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
768
799
|
}
|
|
769
|
-
_TooltipComponentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
800
|
+
_TooltipComponentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, deps: [{ token: i0.ChangeDetectorRef }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
770
801
|
_TooltipComponentBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: _TooltipComponentBase, ngImport: i0 });
|
|
771
802
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, decorators: [{
|
|
772
803
|
type: Directive
|
|
773
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }
|
|
804
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
805
|
+
type: Optional
|
|
806
|
+
}, {
|
|
807
|
+
type: Inject,
|
|
808
|
+
args: [ANIMATION_MODULE_TYPE]
|
|
809
|
+
}] }]; } });
|
|
774
810
|
/**
|
|
775
811
|
* Internal component that wraps the tooltip's content.
|
|
776
812
|
* @docs-private
|
|
777
813
|
*/
|
|
778
814
|
class TooltipComponent extends _TooltipComponentBase {
|
|
779
|
-
constructor(changeDetectorRef, _breakpointObserver) {
|
|
780
|
-
super(changeDetectorRef);
|
|
815
|
+
constructor(changeDetectorRef, _breakpointObserver, animationMode) {
|
|
816
|
+
super(changeDetectorRef, animationMode);
|
|
781
817
|
this._breakpointObserver = _breakpointObserver;
|
|
782
818
|
/** Stream that emits whether the user has a handset-sized display. */
|
|
783
819
|
this._isHandset = this._breakpointObserver.observe(Breakpoints.Handset);
|
|
820
|
+
this._showAnimation = 'mat-tooltip-show';
|
|
821
|
+
this._hideAnimation = 'mat-tooltip-hide';
|
|
784
822
|
}
|
|
785
823
|
}
|
|
786
|
-
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i6.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component });
|
|
787
|
-
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: TooltipComponent, selector: "mat-tooltip-component", host: { attributes: { "aria-hidden": "true" }, properties: { "style.zoom": "
|
|
824
|
+
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i6.BreakpointObserver }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
825
|
+
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: TooltipComponent, selector: "mat-tooltip-component", host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseleave": "_handleMouseLeave($event)" }, properties: { "style.zoom": "isVisible() ? 1 : null" } }, viewQueries: [{ propertyName: "_tooltip", first: true, predicate: ["tooltip"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div #tooltip\n class=\"mat-tooltip\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis;transform:scale(0)}.mat-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-tooltip-show{0%{opacity:0;transform:scale(0)}50%{opacity:.5;transform:scale(0.99)}100%{opacity:1;transform:scale(1)}}@keyframes mat-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1)}}.mat-tooltip-show{animation:mat-tooltip-show 200ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-tooltip-hide{animation:mat-tooltip-hide 100ms cubic-bezier(0, 0, 0.2, 1) forwards}\n"], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
788
826
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
789
827
|
type: Component,
|
|
790
|
-
args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
828
|
+
args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
791
829
|
// Forces the element to have a layout in IE and Edge. This fixes issues where the element
|
|
792
830
|
// won't be rendered if the animations are disabled or there is no web animations polyfill.
|
|
793
|
-
'[style.zoom]': '
|
|
831
|
+
'[style.zoom]': 'isVisible() ? 1 : null',
|
|
832
|
+
'(mouseleave)': '_handleMouseLeave($event)',
|
|
794
833
|
'aria-hidden': 'true',
|
|
795
|
-
}, template: "<div class=\"mat-tooltip\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\"
|
|
796
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i6.BreakpointObserver }
|
|
834
|
+
}, template: "<div #tooltip\n class=\"mat-tooltip\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis;transform:scale(0)}.mat-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-tooltip-show{0%{opacity:0;transform:scale(0)}50%{opacity:.5;transform:scale(0.99)}100%{opacity:1;transform:scale(1)}}@keyframes mat-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1)}}.mat-tooltip-show{animation:mat-tooltip-show 200ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-tooltip-hide{animation:mat-tooltip-hide 100ms cubic-bezier(0, 0, 0.2, 1) forwards}\n"] }]
|
|
835
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i6.BreakpointObserver }, { type: undefined, decorators: [{
|
|
836
|
+
type: Optional
|
|
837
|
+
}, {
|
|
838
|
+
type: Inject,
|
|
839
|
+
args: [ANIMATION_MODULE_TYPE]
|
|
840
|
+
}] }]; }, propDecorators: { _tooltip: [{
|
|
841
|
+
type: ViewChild,
|
|
842
|
+
args: ['tooltip', {
|
|
843
|
+
// Use a static query here since we interact directly with
|
|
844
|
+
// the DOM which can happen before `ngAfterViewInit`.
|
|
845
|
+
static: true,
|
|
846
|
+
}]
|
|
847
|
+
}] } });
|
|
797
848
|
|
|
798
849
|
/**
|
|
799
850
|
* @license
|
|
@@ -817,6 +868,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
|
|
|
817
868
|
}]
|
|
818
869
|
}] });
|
|
819
870
|
|
|
871
|
+
/**
|
|
872
|
+
* @license
|
|
873
|
+
* Copyright Google LLC All Rights Reserved.
|
|
874
|
+
*
|
|
875
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
876
|
+
* found in the LICENSE file at https://angular.io/license
|
|
877
|
+
*/
|
|
878
|
+
/**
|
|
879
|
+
* Animations used by MatTooltip.
|
|
880
|
+
* @docs-private
|
|
881
|
+
*/
|
|
882
|
+
const matTooltipAnimations = {
|
|
883
|
+
/** Animation that transitions a tooltip in and out. */
|
|
884
|
+
tooltipState: trigger('state', [
|
|
885
|
+
state('initial, void, hidden', style({ opacity: 0, transform: 'scale(0)' })),
|
|
886
|
+
state('visible', style({ transform: 'scale(1)' })),
|
|
887
|
+
transition('* => visible', animate('200ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
|
|
888
|
+
style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
|
|
889
|
+
style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
|
|
890
|
+
style({ opacity: 1, transform: 'scale(1)', offset: 1 }),
|
|
891
|
+
]))),
|
|
892
|
+
transition('* => hidden', animate('100ms cubic-bezier(0, 0, 0.2, 1)', style({ opacity: 0 }))),
|
|
893
|
+
]),
|
|
894
|
+
};
|
|
895
|
+
|
|
820
896
|
/**
|
|
821
897
|
* @license
|
|
822
898
|
* Copyright Google LLC All Rights Reserved.
|