mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(card): disable all animations when using NoopAnimationsModule (#11538)
* fix(card): disable all animations when using NoopAnimationsModule Fixes the card `box-shadow` transition not being disabled when it's inside something with the `NoopAnimationsModule`. Relates to #10590. * fix lint * fix api test
This commit is contained in:
committed by
mmalerba
parent
2e047b4873
commit
11a4ff0a6d
@@ -1,5 +1,6 @@
|
||||
@import '../core/style/variables';
|
||||
@import '../core/style/elevation';
|
||||
@import '../core/style/noop-animation';
|
||||
@import '../../cdk/a11y/a11y';
|
||||
|
||||
|
||||
@@ -9,6 +10,7 @@ $mat-card-header-size: 40px !default;
|
||||
|
||||
.mat-card {
|
||||
@include mat-elevation-transition;
|
||||
@include _noop-animation();
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: $mat-card-padding;
|
||||
|
||||
@@ -12,7 +12,10 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
Directive,
|
||||
Input,
|
||||
Optional,
|
||||
Inject,
|
||||
} from '@angular/core';
|
||||
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
|
||||
|
||||
|
||||
/**
|
||||
@@ -156,9 +159,15 @@ export class MatCardAvatar {}
|
||||
styleUrls: ['card.css'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: {'class': 'mat-card'}
|
||||
host: {
|
||||
'class': 'mat-card',
|
||||
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
|
||||
}
|
||||
})
|
||||
export class MatCard {}
|
||||
export class MatCard {
|
||||
// @breaking-change 9.0.0 `_animationMode` parameter to be made required.
|
||||
constructor(@Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string) {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
export declare class MatCard {
|
||||
_animationMode?: string | undefined;
|
||||
constructor(_animationMode?: string | undefined);
|
||||
}
|
||||
|
||||
export declare class MatCardActions {
|
||||
|
||||
Reference in New Issue
Block a user