@angular/material 16.2.12 → 16.2.14
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/core/index.d.ts +6 -2
- package/esm2022/button/button-base.mjs +2 -1
- package/esm2022/chips/chip.mjs +2 -1
- package/esm2022/core/private/ripple-loader.mjs +27 -9
- package/esm2022/core/version.mjs +1 -1
- package/fesm2022/button.mjs +1 -0
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/chips.mjs +1 -0
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +27 -9
- package/fesm2022/core.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
- package/schematics/ng-generate/mdc-migration/schema.json +0 -1
- package/schematics/ng-update/index_bundled.js +25 -25
package/fesm2022/core.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
|
|
|
15
15
|
import { ENTER, SPACE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
16
16
|
|
|
17
17
|
/** Current version of Angular Material. */
|
|
18
|
-
const VERSION = new Version('16.2.
|
|
18
|
+
const VERSION = new Version('16.2.14');
|
|
19
19
|
|
|
20
20
|
/** @docs-private */
|
|
21
21
|
class AnimationCurves {
|
|
@@ -1735,6 +1735,8 @@ const matRippleDisabled = 'mat-ripple-loader-disabled';
|
|
|
1735
1735
|
*
|
|
1736
1736
|
* This service allows us to avoid eagerly creating & attaching MatRipples.
|
|
1737
1737
|
* It works by creating & attaching a ripple only when a component is first interacted with.
|
|
1738
|
+
*
|
|
1739
|
+
* @docs-private
|
|
1738
1740
|
*/
|
|
1739
1741
|
class MatRippleLoader {
|
|
1740
1742
|
constructor() {
|
|
@@ -1743,6 +1745,7 @@ class MatRippleLoader {
|
|
|
1743
1745
|
this._globalRippleOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, { optional: true });
|
|
1744
1746
|
this._platform = inject(Platform);
|
|
1745
1747
|
this._ngZone = inject(NgZone);
|
|
1748
|
+
this._hosts = new Map();
|
|
1746
1749
|
/** Handles creating and attaching component internals when a component it is initially interacted with. */
|
|
1747
1750
|
this._onInteraction = (event) => {
|
|
1748
1751
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -1752,7 +1755,7 @@ class MatRippleLoader {
|
|
|
1752
1755
|
// TODO(wagnermaciel): Consider batching these events to improve runtime performance.
|
|
1753
1756
|
const element = eventTarget.closest(`[${matRippleUninitialized}]`);
|
|
1754
1757
|
if (element) {
|
|
1755
|
-
this.
|
|
1758
|
+
this._createRipple(element);
|
|
1756
1759
|
}
|
|
1757
1760
|
};
|
|
1758
1761
|
this._ngZone.runOutsideAngular(() => {
|
|
@@ -1762,6 +1765,10 @@ class MatRippleLoader {
|
|
|
1762
1765
|
});
|
|
1763
1766
|
}
|
|
1764
1767
|
ngOnDestroy() {
|
|
1768
|
+
const hosts = this._hosts.keys();
|
|
1769
|
+
for (const host of hosts) {
|
|
1770
|
+
this.destroyRipple(host);
|
|
1771
|
+
}
|
|
1765
1772
|
for (const event of rippleInteractionEvents) {
|
|
1766
1773
|
this._document?.removeEventListener(event, this._onInteraction, eventListenerOptions);
|
|
1767
1774
|
}
|
|
@@ -1789,14 +1796,12 @@ class MatRippleLoader {
|
|
|
1789
1796
|
}
|
|
1790
1797
|
/** Returns the ripple instance for the given host element. */
|
|
1791
1798
|
getRipple(host) {
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
}
|
|
1795
|
-
return this.createRipple(host);
|
|
1799
|
+
const ripple = this._hosts.get(host);
|
|
1800
|
+
return ripple || this._createRipple(host);
|
|
1796
1801
|
}
|
|
1797
1802
|
/** Sets the disabled state on the ripple instance corresponding to the given host element. */
|
|
1798
1803
|
setDisabled(host, disabled) {
|
|
1799
|
-
const ripple = host
|
|
1804
|
+
const ripple = this._hosts.get(host);
|
|
1800
1805
|
// If the ripple has already been instantiated, just disable it.
|
|
1801
1806
|
if (ripple) {
|
|
1802
1807
|
ripple.disabled = disabled;
|
|
@@ -1812,10 +1817,14 @@ class MatRippleLoader {
|
|
|
1812
1817
|
}
|
|
1813
1818
|
}
|
|
1814
1819
|
/** Creates a MatRipple and appends it to the given element. */
|
|
1815
|
-
|
|
1820
|
+
_createRipple(host) {
|
|
1816
1821
|
if (!this._document) {
|
|
1817
1822
|
return;
|
|
1818
1823
|
}
|
|
1824
|
+
const existingRipple = this._hosts.get(host);
|
|
1825
|
+
if (existingRipple) {
|
|
1826
|
+
return existingRipple;
|
|
1827
|
+
}
|
|
1819
1828
|
// Create the ripple element.
|
|
1820
1829
|
host.querySelector('.mat-ripple')?.remove();
|
|
1821
1830
|
const rippleEl = this._document.createElement('span');
|
|
@@ -1832,7 +1841,16 @@ class MatRippleLoader {
|
|
|
1832
1841
|
}
|
|
1833
1842
|
attachRipple(host, ripple) {
|
|
1834
1843
|
host.removeAttribute(matRippleUninitialized);
|
|
1835
|
-
host
|
|
1844
|
+
this._hosts.set(host, ripple);
|
|
1845
|
+
}
|
|
1846
|
+
destroyRipple(host) {
|
|
1847
|
+
const ripple = this._hosts.get(host);
|
|
1848
|
+
if (ripple) {
|
|
1849
|
+
// Since this directive is created manually, it needs to be destroyed manually too.
|
|
1850
|
+
// tslint:disable-next-line:no-lifecycle-invocation
|
|
1851
|
+
ripple.ngOnDestroy();
|
|
1852
|
+
this._hosts.delete(host);
|
|
1853
|
+
}
|
|
1836
1854
|
}
|
|
1837
1855
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatRippleLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1838
1856
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatRippleLoader, providedIn: 'root' }); }
|