@angular/material 21.1.1 → 21.2.0-next.0
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/button/_m2-button.scss +1 -5
- package/button/_m2-fab.scss +2 -7
- package/button/_m2-icon-button.scss +1 -6
- package/checkbox/_m2-checkbox.scss +1 -6
- package/core/m2/_theming.scss +11 -26
- package/core/m2/_typography-utils.scss +1 -5
- package/core/style/_elevation.scss +1 -5
- package/core/style/_validation.scss +3 -12
- package/core/theming/_color-api-backwards-compatibility.scss +1 -5
- package/core/theming/_inspection.scss +6 -14
- package/core/theming/_m2-inspection.scss +2 -8
- package/core/theming/_theming.scss +1 -4
- package/core/tokens/_m3-tokens.scss +3 -7
- package/core/tokens/_system.scss +4 -8
- package/core/tokens/_token-utils.scss +1 -6
- package/core/typography/_versioning.scss +3 -2
- package/fesm2022/_tooltip-chunk.mjs +45 -32
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/chips.mjs +4 -10
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +1 -1
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +10 -12
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/table.mjs +0 -3
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +1 -0
- package/fesm2022/tooltip.mjs.map +1 -1
- package/form-field/_m2-form-field.scss +15 -29
- package/package.json +6 -6
- package/paginator/_m2-paginator.scss +2 -12
- package/progress-bar/_m2-progress-bar.scss +5 -6
- package/radio/_m2-radio.scss +1 -6
- package/schematics/ng-add/index.js +2 -2
- package/sidenav/_m2-sidenav.scss +8 -13
- package/slide-toggle/_m2-slide-toggle.scss +1 -6
- package/types/_tooltip-chunk.d.ts +6 -6
- package/types/chips.d.ts +1 -4
package/button/_m2-button.scss
CHANGED
|
@@ -16,12 +16,8 @@
|
|
|
16
16
|
-2: 28px,
|
|
17
17
|
-3: 24px,
|
|
18
18
|
), $scale);
|
|
19
|
+
$touch-target-display: if($scale < -1, none, block);
|
|
19
20
|
$touch-target-size: 48px;
|
|
20
|
-
$touch-target-display: block;
|
|
21
|
-
|
|
22
|
-
@if ($scale < -1) {
|
|
23
|
-
$touch-target-display: none;
|
|
24
|
-
}
|
|
25
21
|
|
|
26
22
|
@return (
|
|
27
23
|
base: (
|
package/button/_m2-fab.scss
CHANGED
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
$disabled-container : m3-utils.color-with-opacity(map.get($system, on-surface), 12%);
|
|
18
18
|
$density-scale: theming.clamp-density(map.get($system, density-scale), -3);
|
|
19
19
|
$touch-target-size: 48px;
|
|
20
|
-
$touch-target-display: block;
|
|
21
|
-
|
|
22
|
-
@if ($density-scale < -1) {
|
|
23
|
-
$touch-target-display: none;
|
|
24
|
-
}
|
|
25
20
|
|
|
26
21
|
@return (
|
|
27
22
|
base: (
|
|
@@ -75,8 +70,8 @@
|
|
|
75
70
|
fab-extended-label-text-weight: map.get($system, label-small-weight)
|
|
76
71
|
),
|
|
77
72
|
density: (
|
|
78
|
-
fab-small-touch-target-display: $
|
|
79
|
-
fab-touch-target-display: $
|
|
73
|
+
fab-small-touch-target-display: if($density-scale < -1, none, block),
|
|
74
|
+
fab-touch-target-display: if($density-scale < -1, none, block),
|
|
80
75
|
),
|
|
81
76
|
);
|
|
82
77
|
}
|
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
@function get-tokens($theme) {
|
|
7
7
|
$system: m2-utils.get-system($theme);
|
|
8
8
|
$density-scale: theming.clamp-density(map.get($system, density-scale), -3);
|
|
9
|
-
$touch-target-display: block;
|
|
10
|
-
|
|
11
|
-
@if ($density-scale < -1) {
|
|
12
|
-
$touch-target-display: none;
|
|
13
|
-
}
|
|
14
9
|
|
|
15
10
|
@return (
|
|
16
11
|
base: (
|
|
@@ -32,7 +27,7 @@
|
|
|
32
27
|
),
|
|
33
28
|
typography: (),
|
|
34
29
|
density: (
|
|
35
|
-
icon-button-touch-target-display: $
|
|
30
|
+
icon-button-touch-target-display: if($density-scale < -1, none, block),
|
|
36
31
|
icon-button-state-layer-size: map.get((
|
|
37
32
|
0: 48px,
|
|
38
33
|
-1: 44px,
|
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
@function get-tokens($theme) {
|
|
7
7
|
$system: m2-utils.get-system($theme);
|
|
8
8
|
$density-scale: theming.clamp-density(map.get($system, density-scale), -3);
|
|
9
|
-
$touch-target-display: block;
|
|
10
|
-
|
|
11
|
-
@if ($density-scale < -1) {
|
|
12
|
-
$touch-target-display: none;
|
|
13
|
-
}
|
|
14
9
|
|
|
15
10
|
@return (
|
|
16
11
|
base: (
|
|
@@ -33,7 +28,7 @@
|
|
|
33
28
|
checkbox-label-text-weight: map.get($system, body-medium-weight)
|
|
34
29
|
),
|
|
35
30
|
density: (
|
|
36
|
-
checkbox-touch-target-display: $
|
|
31
|
+
checkbox-touch-target-display: if($density-scale < -1, none, block),
|
|
37
32
|
checkbox-state-layer-size: map.get((
|
|
38
33
|
0: 40px,
|
|
39
34
|
-1: 36px,
|
package/core/m2/_theming.scss
CHANGED
|
@@ -84,13 +84,7 @@
|
|
|
84
84
|
|
|
85
85
|
// We cast the $hue to a string, because some hues starting with a number, like `700-contrast`,
|
|
86
86
|
// might be inferred as numbers by Sass. Casting them to string fixes the map lookup.
|
|
87
|
-
$color:
|
|
88
|
-
|
|
89
|
-
@if (map.has-key($palette, $hue)) {
|
|
90
|
-
$color: map.get($palette, $hue);
|
|
91
|
-
} @else {
|
|
92
|
-
$color: map.get($palette, $hue + '');
|
|
93
|
-
}
|
|
87
|
+
$color: if(map.has-key($palette, $hue), map.get($palette, $hue), map.get($palette, $hue + ''));
|
|
94
88
|
|
|
95
89
|
@if ($opacity == null) {
|
|
96
90
|
@return $color;
|
|
@@ -127,15 +121,12 @@
|
|
|
127
121
|
warn: $warn,
|
|
128
122
|
);
|
|
129
123
|
|
|
124
|
+
$sys-color: if(
|
|
125
|
+
$is-dark,
|
|
126
|
+
m2.md-sys-color-values-dark($palettes),
|
|
127
|
+
m2.md-sys-color-values-light($palettes));
|
|
130
128
|
$sys-state: m2.md-sys-state-values();
|
|
131
129
|
$sys-typography: m2.md-sys-typescale-values($typography);
|
|
132
|
-
$sys-color: null;
|
|
133
|
-
|
|
134
|
-
@if ($is-dark) {
|
|
135
|
-
$sys-color: m2.md-sys-color-values-dark($palettes);
|
|
136
|
-
} @else {
|
|
137
|
-
$sys-color: m2.md-sys-color-values-light($palettes);
|
|
138
|
-
}
|
|
139
130
|
|
|
140
131
|
$system: (density-scale: $density-scale);
|
|
141
132
|
@each $map in ($sys-color, $sys-state, $sys-typography) {
|
|
@@ -148,22 +139,16 @@
|
|
|
148
139
|
// Creates a color configuration from the specified
|
|
149
140
|
// primary, accent and warn palettes.
|
|
150
141
|
@function _mat-create-color-config($primary, $accent, $warn: null, $is-dark) {
|
|
151
|
-
$
|
|
152
|
-
$
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
$foreground: palette.$dark-theme-foreground-palette;
|
|
157
|
-
$background: palette.$dark-theme-background-palette;
|
|
158
|
-
} @else {
|
|
159
|
-
$foreground: palette.$light-theme-foreground-palette;
|
|
160
|
-
$background: palette.$light-theme-background-palette;
|
|
161
|
-
}
|
|
142
|
+
$warn: if($warn != null, $warn, define-palette(palette.$red-palette));
|
|
143
|
+
$foreground:
|
|
144
|
+
if($is-dark, palette.$dark-theme-foreground-palette, palette.$light-theme-foreground-palette);
|
|
145
|
+
$background:
|
|
146
|
+
if($is-dark, palette.$dark-theme-background-palette, palette.$light-theme-background-palette);
|
|
162
147
|
|
|
163
148
|
@return (
|
|
164
149
|
primary: $primary,
|
|
165
150
|
accent: $accent,
|
|
166
|
-
warn: $warn
|
|
151
|
+
warn: $warn,
|
|
167
152
|
is-dark: $is-dark,
|
|
168
153
|
foreground: $foreground,
|
|
169
154
|
background: $background,
|
|
@@ -73,9 +73,5 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// Guard against unquoting non-string values, because it's deprecated.
|
|
76
|
-
@if
|
|
77
|
-
$font-family: string.unquote($font-family);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@return $font-family;
|
|
76
|
+
@return if(meta.type-of($font-family) == string, string.unquote($font-family), $font-family);
|
|
81
77
|
}
|
|
@@ -159,12 +159,8 @@ $prefix: 'mat-elevation-z';
|
|
|
159
159
|
$umbra-z-value: map.get($_umbra-map, $zValue);
|
|
160
160
|
$penumbra-z-value: map.get($_penumbra-map, $zValue);
|
|
161
161
|
$ambient-z-value: map.get($_ambient-map, $zValue);
|
|
162
|
-
$color-opacity: 1;
|
|
163
|
-
|
|
164
|
-
@if ($opacity != null) {
|
|
165
|
-
$color-opacity: $opacity;
|
|
166
|
-
}
|
|
167
162
|
|
|
163
|
+
$color-opacity: if($opacity != null, $opacity, 1);
|
|
168
164
|
$umbra-color: _compute-color-opacity($shadow-color, $_umbra-opacity * $color-opacity);
|
|
169
165
|
$penumbra-color: _compute-color-opacity($shadow-color, $_penumbra-opacity * $color-opacity);
|
|
170
166
|
$ambient-color: _compute-color-opacity($shadow-color, $_ambient-opacity * $color-opacity);
|
|
@@ -11,10 +11,7 @@
|
|
|
11
11
|
@if ($result == list and list.index($types, map) and list.length($obj) == 0) {
|
|
12
12
|
@return null;
|
|
13
13
|
}
|
|
14
|
-
@if
|
|
15
|
-
@return null;
|
|
16
|
-
}
|
|
17
|
-
@return $result;
|
|
14
|
+
@return if(list.index($types, $result), null, $result);
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
/// Validates that a list contains only values from the allowed list of values.
|
|
@@ -28,10 +25,7 @@
|
|
|
28
25
|
$invalid: list.append($invalid, $element);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
@if
|
|
32
|
-
@return $invalid;
|
|
33
|
-
}
|
|
34
|
-
@return null;
|
|
28
|
+
@return if(list.length($invalid) > 0, $invalid, null);
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
/// Validates that a list contains all values from the required list of values.
|
|
@@ -45,8 +39,5 @@
|
|
|
45
39
|
$invalid: list.append($invalid, $element);
|
|
46
40
|
}
|
|
47
41
|
}
|
|
48
|
-
@if
|
|
49
|
-
@return $invalid;
|
|
50
|
-
}
|
|
51
|
-
@return null;
|
|
42
|
+
@return if(list.length($invalid) > 0, $invalid, null);
|
|
52
43
|
}
|
|
@@ -24,11 +24,7 @@
|
|
|
24
24
|
$_overrides-only: true;
|
|
25
25
|
|
|
26
26
|
@mixin _color-variant-styles($theme, $color-variant) {
|
|
27
|
-
$secondary-when-primary: $color-variant;
|
|
28
|
-
|
|
29
|
-
@if ($color-variant == primary) {
|
|
30
|
-
$secondary-when-primary: secondary;
|
|
31
|
-
}
|
|
27
|
+
$secondary-when-primary: if($color-variant == primary, secondary, $color-variant);
|
|
32
28
|
|
|
33
29
|
& {
|
|
34
30
|
@if ($color-variant != primary) {
|
|
@@ -31,10 +31,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
31
31
|
@function _validate-theme-object($theme) {
|
|
32
32
|
$err: validation.validate-type($theme, 'map') or
|
|
33
33
|
map.get($theme, $internals, theme-version) == null;
|
|
34
|
-
@if
|
|
35
|
-
@return true;
|
|
36
|
-
}
|
|
37
|
-
@return null;
|
|
34
|
+
@return if($err, true, null);
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
/// Gets the version number of a theme object. A theme that is not a valid versioned theme object is
|
|
@@ -43,12 +40,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
43
40
|
/// @return {Number} The version number of the theme (0 if unknown).
|
|
44
41
|
@function get-theme-version($theme) {
|
|
45
42
|
$err: _validate-theme-object($theme);
|
|
46
|
-
|
|
47
|
-
@if ($err) {
|
|
48
|
-
@return 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@return map.get($theme, $internals, theme-version) or 0;
|
|
43
|
+
@return if($err, 0, map.get($theme, $internals, theme-version) or 0);
|
|
52
44
|
}
|
|
53
45
|
|
|
54
46
|
/// Gets the type of theme represented by a theme object (light or dark).
|
|
@@ -107,10 +99,10 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
107
99
|
@if $args-count < 2 or $args-count > 3 {
|
|
108
100
|
@error 'Expected either 2 or 3 arguments when working with an M3 theme. Got: #{$args-count}';
|
|
109
101
|
}
|
|
110
|
-
@if
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
@return if($args-count == 2,
|
|
103
|
+
_get-theme-role-color($theme, $args...),
|
|
104
|
+
_get-theme-palette-color($theme, $args...)
|
|
105
|
+
);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
108
|
@error 'Unrecognized theme version: #{$version}';
|
|
@@ -49,10 +49,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
49
49
|
}
|
|
50
50
|
$internal: map.get($theme, $_internals, m2-config);
|
|
51
51
|
$theme: map.remove($theme, $_internals);
|
|
52
|
-
@if
|
|
53
|
-
@return $internal;
|
|
54
|
-
}
|
|
55
|
-
@return $theme;
|
|
52
|
+
@return if(_is-error-theme($theme), $internal, $theme);
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
/// Checks whether the given theme contains error values.
|
|
@@ -102,10 +99,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
102
99
|
@if theme-has($colors, color) {
|
|
103
100
|
$colors: m2-theming.get-color-config($colors);
|
|
104
101
|
}
|
|
105
|
-
@if
|
|
106
|
-
@return dark;
|
|
107
|
-
}
|
|
108
|
-
@return light;
|
|
102
|
+
@return if(map.get($colors, is-dark), dark, light);
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
/// Gets a color from a theme object. This function can take between 2 and 4 arguments. The first
|
|
@@ -45,10 +45,7 @@ $private-internal-name: _mat-theming-internals-do-not-access;
|
|
|
45
45
|
$result: map.set($result, $key, $value);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
@if
|
|
49
|
-
@return null;
|
|
50
|
-
}
|
|
51
|
-
@return $result;
|
|
48
|
+
@return if($result == (), null, $result);
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
// Checks whether the given value resolves to a theme object. Theme objects are always
|
|
@@ -39,13 +39,9 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@function get-sys-color($type, $palettes, $prefix) {
|
|
42
|
-
$sys-color:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$sys-color: m3.md-sys-color-values-dark($palettes);
|
|
46
|
-
} @else {
|
|
47
|
-
$sys-color: m3.md-sys-color-values-light($palettes);
|
|
48
|
-
}
|
|
42
|
+
$sys-color: if($type == dark,
|
|
43
|
+
m3.md-sys-color-values-dark($palettes),
|
|
44
|
+
m3.md-sys-color-values-light($palettes));
|
|
49
45
|
|
|
50
46
|
@if (sass-utils.$use-system-color-variables) {
|
|
51
47
|
$var-values: ();
|
package/core/tokens/_system.scss
CHANGED
|
@@ -347,14 +347,10 @@
|
|
|
347
347
|
|
|
348
348
|
$color: map.get($config, color);
|
|
349
349
|
@if (m2-inspection.theme-has($theme-config, color)) {
|
|
350
|
-
$system-colors:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
} @else {
|
|
355
|
-
$system-colors: m2.md-sys-color-values-light($color);
|
|
356
|
-
}
|
|
357
|
-
|
|
350
|
+
$system-colors: if(map.get($color, is-dark),
|
|
351
|
+
m2.md-sys-color-values-dark($color),
|
|
352
|
+
m2.md-sys-color-values-light($color),
|
|
353
|
+
);
|
|
358
354
|
@include _define-m2-system-vars($system-colors, $overrides);
|
|
359
355
|
|
|
360
356
|
$shadow: map.get($theme-config, _mat-system, shadow);
|
|
@@ -90,13 +90,8 @@
|
|
|
90
90
|
|
|
91
91
|
@each $config in $namespace-configs {
|
|
92
92
|
$namespace: map.get($config, namespace);
|
|
93
|
+
$prefix: if(map.has-key($config, prefix), map.get($config, prefix), '');
|
|
93
94
|
$tokens: map.get(map.get($config, tokens), all);
|
|
94
|
-
$prefix: '';
|
|
95
|
-
|
|
96
|
-
@if (map.has-key($config, prefix)) {
|
|
97
|
-
$prefix: map.get($config, prefix);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
95
|
@each $name, $value in $tokens {
|
|
101
96
|
$prefixed-name: $prefix + $name;
|
|
102
97
|
$all-names: list.append($all-names, $prefixed-name, $separator: comma);
|
|
@@ -82,8 +82,9 @@
|
|
|
82
82
|
body-2: map.get($config, body-1),
|
|
83
83
|
button: map.get($config, button),
|
|
84
84
|
caption: map.get($config, caption),
|
|
85
|
-
overline:
|
|
86
|
-
|
|
85
|
+
overline: if(map.get($config, overline), map.get($config, overline),
|
|
86
|
+
m2-typography.define-typography-level(12px, 32px, 500)
|
|
87
|
+
)
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
90
|
@return $config;
|
|
@@ -2,8 +2,9 @@ import { takeUntil } from 'rxjs/operators';
|
|
|
2
2
|
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
3
3
|
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { InjectionToken, inject, Injector, ElementRef, NgZone, ViewContainerRef,
|
|
6
|
-
import {
|
|
5
|
+
import { InjectionToken, inject, Injector, ElementRef, NgZone, ViewContainerRef, afterNextRender, DOCUMENT, Directive, Input, ChangeDetectorRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild } from '@angular/core';
|
|
6
|
+
import { NgClass } from '@angular/common';
|
|
7
|
+
import { normalizePassiveListenerOptions, Platform } from '@angular/cdk/platform';
|
|
7
8
|
import { AriaDescriber, FocusMonitor } from '@angular/cdk/a11y';
|
|
8
9
|
import { Directionality } from '@angular/cdk/bidi';
|
|
9
10
|
import { createRepositionScrollStrategy, ScrollDispatcher, createFlexibleConnectedPositionStrategy, createOverlayRef } from '@angular/cdk/overlay';
|
|
@@ -35,9 +36,9 @@ const MAT_TOOLTIP_DEFAULT_OPTIONS = new InjectionToken('mat-tooltip-default-opti
|
|
|
35
36
|
});
|
|
36
37
|
const TOOLTIP_PANEL_CLASS = 'mat-mdc-tooltip-panel';
|
|
37
38
|
const PANEL_CLASS = 'tooltip-panel';
|
|
38
|
-
const passiveListenerOptions = {
|
|
39
|
+
const passiveListenerOptions = normalizePassiveListenerOptions({
|
|
39
40
|
passive: true
|
|
40
|
-
};
|
|
41
|
+
});
|
|
41
42
|
const MIN_VIEWPORT_TOOLTIP_THRESHOLD = 8;
|
|
42
43
|
const UNBOUNDED_ANCHOR_GAP = 8;
|
|
43
44
|
const MIN_HEIGHT = 24;
|
|
@@ -52,8 +53,6 @@ class MatTooltip {
|
|
|
52
53
|
_injector = inject(Injector);
|
|
53
54
|
_viewContainerRef = inject(ViewContainerRef);
|
|
54
55
|
_mediaMatcher = inject(MediaMatcher);
|
|
55
|
-
_document = inject(DOCUMENT);
|
|
56
|
-
_renderer = inject(Renderer2);
|
|
57
56
|
_animationsDisabled = _animationsDisabled();
|
|
58
57
|
_defaultOptions = inject(MAT_TOOLTIP_DEFAULT_OPTIONS, {
|
|
59
58
|
optional: true
|
|
@@ -152,7 +151,7 @@ class MatTooltip {
|
|
|
152
151
|
this._setTooltipClass(this._tooltipClass);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
|
-
|
|
154
|
+
_passiveListeners = [];
|
|
156
155
|
_touchstartTimeout = null;
|
|
157
156
|
_destroyed = new Subject();
|
|
158
157
|
_isDestroyed = false;
|
|
@@ -196,8 +195,10 @@ class MatTooltip {
|
|
|
196
195
|
this._overlayRef.dispose();
|
|
197
196
|
this._tooltipInstance = null;
|
|
198
197
|
}
|
|
199
|
-
this.
|
|
200
|
-
|
|
198
|
+
this._passiveListeners.forEach(([event, listener]) => {
|
|
199
|
+
nativeElement.removeEventListener(event, listener, passiveListenerOptions);
|
|
200
|
+
});
|
|
201
|
+
this._passiveListeners.length = 0;
|
|
201
202
|
this._destroyed.next();
|
|
202
203
|
this._destroyed.complete();
|
|
203
204
|
this._isDestroyed = true;
|
|
@@ -406,7 +407,7 @@ class MatTooltip {
|
|
|
406
407
|
}
|
|
407
408
|
_setTooltipClass(tooltipClass) {
|
|
408
409
|
if (this._tooltipInstance) {
|
|
409
|
-
this._tooltipInstance.tooltipClass = tooltipClass
|
|
410
|
+
this._tooltipInstance.tooltipClass = tooltipClass;
|
|
410
411
|
this._tooltipInstance._markForCheck();
|
|
411
412
|
}
|
|
412
413
|
}
|
|
@@ -456,21 +457,21 @@ class MatTooltip {
|
|
|
456
457
|
}
|
|
457
458
|
}
|
|
458
459
|
_setupPointerEnterEventsIfNeeded() {
|
|
459
|
-
if (this._disabled || !this.message || !this._viewInitialized || this.
|
|
460
|
+
if (this._disabled || !this.message || !this._viewInitialized || this._passiveListeners.length) {
|
|
460
461
|
return;
|
|
461
462
|
}
|
|
462
463
|
if (!this._isTouchPlatform()) {
|
|
463
|
-
this.
|
|
464
|
+
this._passiveListeners.push(['mouseenter', event => {
|
|
464
465
|
this._setupPointerExitEventsIfNeeded();
|
|
465
466
|
let point = undefined;
|
|
466
467
|
if (event.x !== undefined && event.y !== undefined) {
|
|
467
468
|
point = event;
|
|
468
469
|
}
|
|
469
470
|
this.show(undefined, point);
|
|
470
|
-
});
|
|
471
|
+
}]);
|
|
471
472
|
} else if (this.touchGestures !== 'off') {
|
|
472
473
|
this._disableNativeGesturesIfNecessary();
|
|
473
|
-
this.
|
|
474
|
+
this._passiveListeners.push(['touchstart', event => {
|
|
474
475
|
const touch = event.targetTouches?.[0];
|
|
475
476
|
const origin = touch ? {
|
|
476
477
|
x: touch.clientX,
|
|
@@ -485,30 +486,23 @@ class MatTooltip {
|
|
|
485
486
|
this._touchstartTimeout = null;
|
|
486
487
|
this.show(undefined, origin);
|
|
487
488
|
}, this._defaultOptions?.touchLongPressShowDelay ?? DEFAULT_LONGPRESS_DELAY);
|
|
488
|
-
});
|
|
489
|
+
}]);
|
|
489
490
|
}
|
|
491
|
+
this._addListeners(this._passiveListeners);
|
|
490
492
|
}
|
|
491
493
|
_setupPointerExitEventsIfNeeded() {
|
|
492
494
|
if (this._pointerExitEventsInitialized) {
|
|
493
495
|
return;
|
|
494
496
|
}
|
|
495
497
|
this._pointerExitEventsInitialized = true;
|
|
498
|
+
const exitListeners = [];
|
|
496
499
|
if (!this._isTouchPlatform()) {
|
|
497
|
-
|
|
500
|
+
exitListeners.push(['mouseleave', event => {
|
|
498
501
|
const newTarget = event.relatedTarget;
|
|
499
502
|
if (!newTarget || !this._overlayRef?.overlayElement.contains(newTarget)) {
|
|
500
503
|
this.hide();
|
|
501
504
|
}
|
|
502
|
-
});
|
|
503
|
-
this._addListener('wheel', event => {
|
|
504
|
-
if (this._isTooltipVisible()) {
|
|
505
|
-
const elementUnderPointer = this._document.elementFromPoint(event.clientX, event.clientY);
|
|
506
|
-
const element = this._elementRef.nativeElement;
|
|
507
|
-
if (elementUnderPointer !== element && !element.contains(elementUnderPointer)) {
|
|
508
|
-
this.hide();
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
});
|
|
505
|
+
}], ['wheel', event => this._wheelListener(event)]);
|
|
512
506
|
} else if (this.touchGestures !== 'off') {
|
|
513
507
|
this._disableNativeGesturesIfNecessary();
|
|
514
508
|
const touchendListener = () => {
|
|
@@ -517,12 +511,15 @@ class MatTooltip {
|
|
|
517
511
|
}
|
|
518
512
|
this.hide(this._defaultOptions?.touchendHideDelay);
|
|
519
513
|
};
|
|
520
|
-
|
|
521
|
-
this._addListener('touchcancel', touchendListener);
|
|
514
|
+
exitListeners.push(['touchend', touchendListener], ['touchcancel', touchendListener]);
|
|
522
515
|
}
|
|
516
|
+
this._addListeners(exitListeners);
|
|
517
|
+
this._passiveListeners.push(...exitListeners);
|
|
523
518
|
}
|
|
524
|
-
|
|
525
|
-
|
|
519
|
+
_addListeners(listeners) {
|
|
520
|
+
listeners.forEach(([event, listener]) => {
|
|
521
|
+
this._elementRef.nativeElement.addEventListener(event, listener, passiveListenerOptions);
|
|
522
|
+
});
|
|
526
523
|
}
|
|
527
524
|
_isTouchPlatform() {
|
|
528
525
|
if (this._platform.IOS || this._platform.ANDROID) {
|
|
@@ -532,6 +529,15 @@ class MatTooltip {
|
|
|
532
529
|
}
|
|
533
530
|
return !!this._defaultOptions?.detectHoverCapability && this._mediaMatcher.matchMedia('(any-hover: none)').matches;
|
|
534
531
|
}
|
|
532
|
+
_wheelListener(event) {
|
|
533
|
+
if (this._isTooltipVisible()) {
|
|
534
|
+
const elementUnderPointer = this._injector.get(DOCUMENT).elementFromPoint(event.clientX, event.clientY);
|
|
535
|
+
const element = this._elementRef.nativeElement;
|
|
536
|
+
if (elementUnderPointer !== element && !element.contains(elementUnderPointer)) {
|
|
537
|
+
this.hide();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
535
541
|
_disableNativeGesturesIfNecessary() {
|
|
536
542
|
const gestures = this.touchGestures;
|
|
537
543
|
if (gestures !== 'off') {
|
|
@@ -803,8 +809,14 @@ class TooltipComponent {
|
|
|
803
809
|
static: true
|
|
804
810
|
}],
|
|
805
811
|
ngImport: i0,
|
|
806
|
-
template: "<div\n #tooltip\n class=\"mdc-tooltip mat-mdc-tooltip\"\n [
|
|
812
|
+
template: "<div\n #tooltip\n class=\"mdc-tooltip mat-mdc-tooltip\"\n [ngClass]=\"tooltipClass\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [class.mdc-tooltip--multiline]=\"_isMultiline\">\n <div class=\"mat-mdc-tooltip-surface mdc-tooltip__surface\">{{message}}</div>\n</div>\n",
|
|
807
813
|
styles: [".mat-mdc-tooltip{position:relative;transform:scale(0);display:inline-flex}.mat-mdc-tooltip::before{content:\"\";top:0;right:0;bottom:0;left:0;z-index:-1;position:absolute}.mat-mdc-tooltip-panel-below .mat-mdc-tooltip::before{top:-8px}.mat-mdc-tooltip-panel-above .mat-mdc-tooltip::before{bottom:-8px}.mat-mdc-tooltip-panel-right .mat-mdc-tooltip::before{left:-8px}.mat-mdc-tooltip-panel-left .mat-mdc-tooltip::before{right:-8px}.mat-mdc-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.mat-mdc-tooltip-surface{word-break:normal;overflow-wrap:anywhere;padding:4px 8px;min-width:40px;max-width:200px;min-height:24px;max-height:40vh;box-sizing:border-box;overflow:hidden;text-align:center;will-change:transform,opacity;background-color:var(--mat-tooltip-container-color, var(--mat-sys-inverse-surface));color:var(--mat-tooltip-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mat-tooltip-container-shape, var(--mat-sys-corner-extra-small));font-family:var(--mat-tooltip-supporting-text-font, var(--mat-sys-body-small-font));font-size:var(--mat-tooltip-supporting-text-size, var(--mat-sys-body-small-size));font-weight:var(--mat-tooltip-supporting-text-weight, var(--mat-sys-body-small-weight));line-height:var(--mat-tooltip-supporting-text-line-height, var(--mat-sys-body-small-line-height));letter-spacing:var(--mat-tooltip-supporting-text-tracking, var(--mat-sys-body-small-tracking))}.mat-mdc-tooltip-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mdc-tooltip--multiline .mat-mdc-tooltip-surface{text-align:left}[dir=rtl] .mdc-tooltip--multiline .mat-mdc-tooltip-surface{text-align:right}.mat-mdc-tooltip-panel{line-height:normal}.mat-mdc-tooltip-panel.mat-mdc-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-mdc-tooltip-show{0%{opacity:0;transform:scale(0.8)}100%{opacity:1;transform:scale(1)}}@keyframes mat-mdc-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(0.8)}}.mat-mdc-tooltip-show{animation:mat-mdc-tooltip-show 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-mdc-tooltip-hide{animation:mat-mdc-tooltip-hide 75ms cubic-bezier(0.4, 0, 1, 1) forwards}\n"],
|
|
814
|
+
dependencies: [{
|
|
815
|
+
kind: "directive",
|
|
816
|
+
type: NgClass,
|
|
817
|
+
selector: "[ngClass]",
|
|
818
|
+
inputs: ["class", "ngClass"]
|
|
819
|
+
}],
|
|
808
820
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
809
821
|
encapsulation: i0.ViewEncapsulation.None
|
|
810
822
|
});
|
|
@@ -824,7 +836,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
824
836
|
'(mouseleave)': '_handleMouseLeave($event)',
|
|
825
837
|
'aria-hidden': 'true'
|
|
826
838
|
},
|
|
827
|
-
|
|
839
|
+
imports: [NgClass],
|
|
840
|
+
template: "<div\n #tooltip\n class=\"mdc-tooltip mat-mdc-tooltip\"\n [ngClass]=\"tooltipClass\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [class.mdc-tooltip--multiline]=\"_isMultiline\">\n <div class=\"mat-mdc-tooltip-surface mdc-tooltip__surface\">{{message}}</div>\n</div>\n",
|
|
828
841
|
styles: [".mat-mdc-tooltip{position:relative;transform:scale(0);display:inline-flex}.mat-mdc-tooltip::before{content:\"\";top:0;right:0;bottom:0;left:0;z-index:-1;position:absolute}.mat-mdc-tooltip-panel-below .mat-mdc-tooltip::before{top:-8px}.mat-mdc-tooltip-panel-above .mat-mdc-tooltip::before{bottom:-8px}.mat-mdc-tooltip-panel-right .mat-mdc-tooltip::before{left:-8px}.mat-mdc-tooltip-panel-left .mat-mdc-tooltip::before{right:-8px}.mat-mdc-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.mat-mdc-tooltip-surface{word-break:normal;overflow-wrap:anywhere;padding:4px 8px;min-width:40px;max-width:200px;min-height:24px;max-height:40vh;box-sizing:border-box;overflow:hidden;text-align:center;will-change:transform,opacity;background-color:var(--mat-tooltip-container-color, var(--mat-sys-inverse-surface));color:var(--mat-tooltip-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mat-tooltip-container-shape, var(--mat-sys-corner-extra-small));font-family:var(--mat-tooltip-supporting-text-font, var(--mat-sys-body-small-font));font-size:var(--mat-tooltip-supporting-text-size, var(--mat-sys-body-small-size));font-weight:var(--mat-tooltip-supporting-text-weight, var(--mat-sys-body-small-weight));line-height:var(--mat-tooltip-supporting-text-line-height, var(--mat-sys-body-small-line-height));letter-spacing:var(--mat-tooltip-supporting-text-tracking, var(--mat-sys-body-small-tracking))}.mat-mdc-tooltip-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:1px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mdc-tooltip--multiline .mat-mdc-tooltip-surface{text-align:left}[dir=rtl] .mdc-tooltip--multiline .mat-mdc-tooltip-surface{text-align:right}.mat-mdc-tooltip-panel{line-height:normal}.mat-mdc-tooltip-panel.mat-mdc-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-mdc-tooltip-show{0%{opacity:0;transform:scale(0.8)}100%{opacity:1;transform:scale(1)}}@keyframes mat-mdc-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(0.8)}}.mat-mdc-tooltip-show{animation:mat-mdc-tooltip-show 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-mdc-tooltip-hide{animation:mat-mdc-tooltip-hide 75ms cubic-bezier(0.4, 0, 1, 1) forwards}\n"]
|
|
829
842
|
}]
|
|
830
843
|
}],
|