@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
|
@@ -4,34 +4,34 @@ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
|
4
4
|
class _MatTooltipHarnessBase extends ComponentHarness {
|
|
5
5
|
/** Shows the tooltip. */
|
|
6
6
|
show() {
|
|
7
|
-
var _a;
|
|
8
7
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9
8
|
const host = yield this.host();
|
|
10
9
|
// We need to dispatch both `touchstart` and a hover event, because the tooltip binds
|
|
11
10
|
// different events depending on the device. The `changedTouches` is there in case the
|
|
12
11
|
// element has ripples.
|
|
13
|
-
|
|
14
|
-
yield ((_a = host.dispatchEvent) === null || _a === void 0 ? void 0 : _a.call(host, 'touchstart', { changedTouches: [] }));
|
|
12
|
+
yield host.dispatchEvent('touchstart', { changedTouches: [] });
|
|
15
13
|
yield host.hover();
|
|
14
|
+
const panel = yield this._optionalPanel();
|
|
15
|
+
yield (panel === null || panel === void 0 ? void 0 : panel.dispatchEvent('animationend', { animationName: this._showAnimationName }));
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
/** Hides the tooltip. */
|
|
19
19
|
hide() {
|
|
20
|
-
var _a;
|
|
21
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
21
|
const host = yield this.host();
|
|
23
22
|
// We need to dispatch both `touchstart` and a hover event, because
|
|
24
23
|
// the tooltip binds different events depending on the device.
|
|
25
|
-
|
|
26
|
-
yield ((_a = host.dispatchEvent) === null || _a === void 0 ? void 0 : _a.call(host, 'touchend'));
|
|
24
|
+
yield host.dispatchEvent('touchend');
|
|
27
25
|
yield host.mouseAway();
|
|
28
|
-
yield this.
|
|
26
|
+
const panel = yield this._optionalPanel();
|
|
27
|
+
yield (panel === null || panel === void 0 ? void 0 : panel.dispatchEvent('animationend', { animationName: this._hideAnimationName }));
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
/** Gets whether the tooltip is open. */
|
|
32
31
|
isOpen() {
|
|
33
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
33
|
+
const panel = yield this._optionalPanel();
|
|
34
|
+
return !!panel && !(yield panel.hasClass(this._hiddenClass));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
/** Gets a promise for the tooltip panel's text. */
|
|
@@ -47,6 +47,9 @@ class MatTooltipHarness extends _MatTooltipHarnessBase {
|
|
|
47
47
|
constructor() {
|
|
48
48
|
super(...arguments);
|
|
49
49
|
this._optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');
|
|
50
|
+
this._hiddenClass = 'mat-tooltip-hide';
|
|
51
|
+
this._showAnimationName = 'mat-tooltip-show';
|
|
52
|
+
this._hideAnimationName = 'mat-tooltip-hide';
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
55
|
* 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/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/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\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":";;;MAgBsB,+BAA+B,gBAAgB;;IAO7D,IAAI;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;YAK/B,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,EAAC,cAAc,EAAE,EAAE,EAAC,CAAC,CAAC;YAC7D,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAM,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC,cAAc,EAAE,EAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAC,CAAC,CAAA,CAAC;SACtF;KAAA;;IAGK,IAAI;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;YAI/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACrC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAM,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC,cAAc,EAAE,EAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAC,CAAC,CAAA,CAAC;SACtF;KAAA;;IAGK,MAAM;;YACV,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;SAC9D;KAAA;;IAGK,cAAc;;YAClB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;SAClC;KAAA;CACF;AAED;MACa,0BAA0B,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;;;;;;;;;;"}
|
package/fesm2015/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';
|
|
@@ -16,35 +16,11 @@ import { Breakpoints } from '@angular/cdk/layout';
|
|
|
16
16
|
import * as i3 from '@angular/cdk/platform';
|
|
17
17
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
18
18
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
19
|
+
import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
|
|
19
20
|
import { Subject } from 'rxjs';
|
|
20
21
|
import { takeUntil, take } from 'rxjs/operators';
|
|
21
|
-
import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
|
|
22
22
|
import * as i5 from '@angular/cdk/bidi';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright Google LLC All Rights Reserved.
|
|
27
|
-
*
|
|
28
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
29
|
-
* found in the LICENSE file at https://angular.io/license
|
|
30
|
-
*/
|
|
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
|
-
};
|
|
23
|
+
import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
|
|
48
24
|
|
|
49
25
|
/** Time in ms to throttle repositioning after scroll events. */
|
|
50
26
|
const SCROLL_THROTTLE_MS = 20;
|
|
@@ -192,6 +168,9 @@ class _MatTooltipBase {
|
|
|
192
168
|
}
|
|
193
169
|
set hideDelay(value) {
|
|
194
170
|
this._hideDelay = coerceNumberProperty(value);
|
|
171
|
+
if (this._tooltipInstance) {
|
|
172
|
+
this._tooltipInstance._mouseLeaveHideDelay = this._hideDelay;
|
|
173
|
+
}
|
|
195
174
|
}
|
|
196
175
|
/** The message to be displayed in the tooltip */
|
|
197
176
|
get message() {
|
|
@@ -280,14 +259,16 @@ class _MatTooltipBase {
|
|
|
280
259
|
this._detach();
|
|
281
260
|
this._portal =
|
|
282
261
|
this._portal || new ComponentPortal(this._tooltipComponent, this._viewContainerRef);
|
|
283
|
-
this._tooltipInstance = overlayRef.attach(this._portal).instance;
|
|
284
|
-
this.
|
|
262
|
+
const instance = (this._tooltipInstance = overlayRef.attach(this._portal).instance);
|
|
263
|
+
instance._triggerElement = this._elementRef.nativeElement;
|
|
264
|
+
instance._mouseLeaveHideDelay = this._hideDelay;
|
|
265
|
+
instance
|
|
285
266
|
.afterHidden()
|
|
286
267
|
.pipe(takeUntil(this._destroyed))
|
|
287
268
|
.subscribe(() => this._detach());
|
|
288
269
|
this._setTooltipClass(this._tooltipClass);
|
|
289
270
|
this._updateTooltipMessage();
|
|
290
|
-
|
|
271
|
+
instance.show(delay);
|
|
291
272
|
}
|
|
292
273
|
/** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */
|
|
293
274
|
hide(delay = this.hideDelay) {
|
|
@@ -305,6 +286,7 @@ class _MatTooltipBase {
|
|
|
305
286
|
}
|
|
306
287
|
/** Create the overlay config and position strategy */
|
|
307
288
|
_createOverlay() {
|
|
289
|
+
var _a;
|
|
308
290
|
if (this._overlayRef) {
|
|
309
291
|
return this._overlayRef;
|
|
310
292
|
}
|
|
@@ -352,6 +334,9 @@ class _MatTooltipBase {
|
|
|
352
334
|
this._ngZone.run(() => this.hide(0));
|
|
353
335
|
}
|
|
354
336
|
});
|
|
337
|
+
if ((_a = this._defaultOptions) === null || _a === void 0 ? void 0 : _a.disableTooltipInteractivity) {
|
|
338
|
+
this._overlayRef.addPanelClass(`${this._cssClassPrefix}-tooltip-panel-non-interactive`);
|
|
339
|
+
}
|
|
355
340
|
return this._overlayRef;
|
|
356
341
|
}
|
|
357
342
|
/** Detaches the currently-attached tooltip. */
|
|
@@ -548,7 +533,16 @@ class _MatTooltipBase {
|
|
|
548
533
|
this._pointerExitEventsInitialized = true;
|
|
549
534
|
const exitListeners = [];
|
|
550
535
|
if (this._platformSupportsMouseEvents()) {
|
|
551
|
-
exitListeners.push([
|
|
536
|
+
exitListeners.push([
|
|
537
|
+
'mouseleave',
|
|
538
|
+
event => {
|
|
539
|
+
var _a;
|
|
540
|
+
const newTarget = event.relatedTarget;
|
|
541
|
+
if (!newTarget || !((_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.overlayElement.contains(newTarget))) {
|
|
542
|
+
this.hide();
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
], ['wheel', event => this._wheelListener(event)]);
|
|
552
546
|
}
|
|
553
547
|
else if (this.touchGestures !== 'off') {
|
|
554
548
|
this._disableNativeGesturesIfNecessary();
|
|
@@ -679,14 +673,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
|
|
|
679
673
|
}] }];
|
|
680
674
|
} });
|
|
681
675
|
class _TooltipComponentBase {
|
|
682
|
-
constructor(_changeDetectorRef) {
|
|
676
|
+
constructor(_changeDetectorRef, animationMode) {
|
|
683
677
|
this._changeDetectorRef = _changeDetectorRef;
|
|
684
678
|
/** Property watched by the animation framework to show or hide the tooltip */
|
|
685
679
|
this._visibility = 'initial';
|
|
686
680
|
/** Whether interactions on the page should close the tooltip */
|
|
687
681
|
this._closeOnInteraction = false;
|
|
682
|
+
/** Whether the tooltip is currently visible. */
|
|
683
|
+
this._isVisible = false;
|
|
688
684
|
/** Subject for notifying that the tooltip has been hidden from the view */
|
|
689
685
|
this._onHide = new Subject();
|
|
686
|
+
this._animationsDisabled = animationMode === 'NoopAnimations';
|
|
690
687
|
}
|
|
691
688
|
/**
|
|
692
689
|
* Shows the tooltip with an animation originating from the provided origin
|
|
@@ -695,15 +692,9 @@ class _TooltipComponentBase {
|
|
|
695
692
|
show(delay) {
|
|
696
693
|
// Cancel the delayed hide if it is scheduled
|
|
697
694
|
clearTimeout(this._hideTimeoutId);
|
|
698
|
-
// Body interactions should cancel the tooltip if there is a delay in showing.
|
|
699
|
-
this._closeOnInteraction = true;
|
|
700
695
|
this._showTimeoutId = setTimeout(() => {
|
|
701
|
-
this.
|
|
696
|
+
this._toggleVisibility(true);
|
|
702
697
|
this._showTimeoutId = undefined;
|
|
703
|
-
this._onShow();
|
|
704
|
-
// Mark for check so if any parent component has set the
|
|
705
|
-
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
706
|
-
this._markForCheck();
|
|
707
698
|
}, delay);
|
|
708
699
|
}
|
|
709
700
|
/**
|
|
@@ -714,11 +705,8 @@ class _TooltipComponentBase {
|
|
|
714
705
|
// Cancel the delayed show if it is scheduled
|
|
715
706
|
clearTimeout(this._showTimeoutId);
|
|
716
707
|
this._hideTimeoutId = setTimeout(() => {
|
|
717
|
-
this.
|
|
708
|
+
this._toggleVisibility(false);
|
|
718
709
|
this._hideTimeoutId = undefined;
|
|
719
|
-
// Mark for check so if any parent component has set the
|
|
720
|
-
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
721
|
-
this._markForCheck();
|
|
722
710
|
}, delay);
|
|
723
711
|
}
|
|
724
712
|
/** Returns an observable that notifies when the tooltip has been hidden from view. */
|
|
@@ -727,24 +715,13 @@ class _TooltipComponentBase {
|
|
|
727
715
|
}
|
|
728
716
|
/** Whether the tooltip is being displayed. */
|
|
729
717
|
isVisible() {
|
|
730
|
-
return this.
|
|
718
|
+
return this._isVisible;
|
|
731
719
|
}
|
|
732
720
|
ngOnDestroy() {
|
|
733
721
|
clearTimeout(this._showTimeoutId);
|
|
734
722
|
clearTimeout(this._hideTimeoutId);
|
|
735
723
|
this._onHide.complete();
|
|
736
|
-
|
|
737
|
-
_animationStart() {
|
|
738
|
-
this._closeOnInteraction = false;
|
|
739
|
-
}
|
|
740
|
-
_animationDone(event) {
|
|
741
|
-
const toState = event.toState;
|
|
742
|
-
if (toState === 'hidden' && !this.isVisible()) {
|
|
743
|
-
this._onHide.next();
|
|
744
|
-
}
|
|
745
|
-
if (toState === 'visible' || toState === 'hidden') {
|
|
746
|
-
this._closeOnInteraction = true;
|
|
747
|
-
}
|
|
724
|
+
this._triggerElement = null;
|
|
748
725
|
}
|
|
749
726
|
/**
|
|
750
727
|
* Interactions on the HTML body should close the tooltip immediately as defined in the
|
|
@@ -764,41 +741,114 @@ class _TooltipComponentBase {
|
|
|
764
741
|
_markForCheck() {
|
|
765
742
|
this._changeDetectorRef.markForCheck();
|
|
766
743
|
}
|
|
744
|
+
_handleMouseLeave({ relatedTarget }) {
|
|
745
|
+
if (!relatedTarget || !this._triggerElement.contains(relatedTarget)) {
|
|
746
|
+
this.hide(this._mouseLeaveHideDelay);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
767
749
|
/**
|
|
768
750
|
* Callback for when the timeout in this.show() gets completed.
|
|
769
751
|
* This method is only needed by the mdc-tooltip, and so it is only implemented
|
|
770
752
|
* in the mdc-tooltip, not here.
|
|
771
753
|
*/
|
|
772
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
|
+
}
|
|
773
799
|
}
|
|
774
|
-
_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 });
|
|
775
801
|
_TooltipComponentBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: _TooltipComponentBase, ngImport: i0 });
|
|
776
802
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, decorators: [{
|
|
777
803
|
type: Directive
|
|
778
|
-
}], ctorParameters: function () {
|
|
804
|
+
}], ctorParameters: function () {
|
|
805
|
+
return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
806
|
+
type: Optional
|
|
807
|
+
}, {
|
|
808
|
+
type: Inject,
|
|
809
|
+
args: [ANIMATION_MODULE_TYPE]
|
|
810
|
+
}] }];
|
|
811
|
+
} });
|
|
779
812
|
/**
|
|
780
813
|
* Internal component that wraps the tooltip's content.
|
|
781
814
|
* @docs-private
|
|
782
815
|
*/
|
|
783
816
|
class TooltipComponent extends _TooltipComponentBase {
|
|
784
|
-
constructor(changeDetectorRef, _breakpointObserver) {
|
|
785
|
-
super(changeDetectorRef);
|
|
817
|
+
constructor(changeDetectorRef, _breakpointObserver, animationMode) {
|
|
818
|
+
super(changeDetectorRef, animationMode);
|
|
786
819
|
this._breakpointObserver = _breakpointObserver;
|
|
787
820
|
/** Stream that emits whether the user has a handset-sized display. */
|
|
788
821
|
this._isHandset = this._breakpointObserver.observe(Breakpoints.Handset);
|
|
822
|
+
this._showAnimation = 'mat-tooltip-show';
|
|
823
|
+
this._hideAnimation = 'mat-tooltip-hide';
|
|
789
824
|
}
|
|
790
825
|
}
|
|
791
|
-
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 });
|
|
792
|
-
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": "
|
|
826
|
+
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 });
|
|
827
|
+
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 });
|
|
793
828
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
794
829
|
type: Component,
|
|
795
|
-
args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
830
|
+
args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
796
831
|
// Forces the element to have a layout in IE and Edge. This fixes issues where the element
|
|
797
832
|
// won't be rendered if the animations are disabled or there is no web animations polyfill.
|
|
798
|
-
'[style.zoom]': '
|
|
833
|
+
'[style.zoom]': 'isVisible() ? 1 : null',
|
|
834
|
+
'(mouseleave)': '_handleMouseLeave($event)',
|
|
799
835
|
'aria-hidden': 'true',
|
|
800
|
-
}, template: "<div class=\"mat-tooltip\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\"
|
|
801
|
-
}], ctorParameters: function () {
|
|
836
|
+
}, 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"] }]
|
|
837
|
+
}], ctorParameters: function () {
|
|
838
|
+
return [{ type: i0.ChangeDetectorRef }, { type: i6.BreakpointObserver }, { type: undefined, decorators: [{
|
|
839
|
+
type: Optional
|
|
840
|
+
}, {
|
|
841
|
+
type: Inject,
|
|
842
|
+
args: [ANIMATION_MODULE_TYPE]
|
|
843
|
+
}] }];
|
|
844
|
+
}, propDecorators: { _tooltip: [{
|
|
845
|
+
type: ViewChild,
|
|
846
|
+
args: ['tooltip', {
|
|
847
|
+
// Use a static query here since we interact directly with
|
|
848
|
+
// the DOM which can happen before `ngAfterViewInit`.
|
|
849
|
+
static: true,
|
|
850
|
+
}]
|
|
851
|
+
}] } });
|
|
802
852
|
|
|
803
853
|
/**
|
|
804
854
|
* @license
|
|
@@ -822,6 +872,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
|
|
|
822
872
|
}]
|
|
823
873
|
}] });
|
|
824
874
|
|
|
875
|
+
/**
|
|
876
|
+
* @license
|
|
877
|
+
* Copyright Google LLC All Rights Reserved.
|
|
878
|
+
*
|
|
879
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
880
|
+
* found in the LICENSE file at https://angular.io/license
|
|
881
|
+
*/
|
|
882
|
+
/**
|
|
883
|
+
* Animations used by MatTooltip.
|
|
884
|
+
* @docs-private
|
|
885
|
+
*/
|
|
886
|
+
const matTooltipAnimations = {
|
|
887
|
+
/** Animation that transitions a tooltip in and out. */
|
|
888
|
+
tooltipState: trigger('state', [
|
|
889
|
+
state('initial, void, hidden', style({ opacity: 0, transform: 'scale(0)' })),
|
|
890
|
+
state('visible', style({ transform: 'scale(1)' })),
|
|
891
|
+
transition('* => visible', animate('200ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
|
|
892
|
+
style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
|
|
893
|
+
style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
|
|
894
|
+
style({ opacity: 1, transform: 'scale(1)', offset: 1 }),
|
|
895
|
+
]))),
|
|
896
|
+
transition('* => hidden', animate('100ms cubic-bezier(0, 0, 0.2, 1)', style({ opacity: 0 }))),
|
|
897
|
+
]),
|
|
898
|
+
};
|
|
899
|
+
|
|
825
900
|
/**
|
|
826
901
|
* @license
|
|
827
902
|
* Copyright Google LLC All Rights Reserved.
|