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