Skip to content

Commit b98b321

Browse files
committed
fix(material/dialog): provide defaults for dialog animation
Even though we provide defaults when we construct the animation object, some internal cases break because there are no defaults in the animation definition itself. These changes provide the defaults in the animation definition as well.
1 parent 8ef3125 commit b98b321

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/material/dialog/dialog-animations.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ import {
1717
group,
1818
} from '@angular/animations';
1919

20+
/**
21+
* Default parameters for the animation for backwards compatibility.
22+
* @docs-private
23+
*/
24+
export const defaultParams = {
25+
params: {enterAnimationDuration: '150ms', exitAnimationDuration: '75ms'},
26+
};
27+
2028
/**
2129
* Animations used by MatDialog.
2230
* @docs-private
@@ -40,13 +48,15 @@ export const matDialogAnimations: {
4048
),
4149
query('@*', animateChild(), {optional: true}),
4250
]),
51+
defaultParams,
4352
),
4453
transition(
4554
'* => void, * => exit',
4655
group([
4756
animate('{{exitAnimationDuration}} cubic-bezier(0.4, 0.0, 0.2, 1)', style({opacity: 0})),
4857
query('@*', animateChild(), {optional: true}),
4958
]),
59+
defaultParams,
5060
),
5161
]),
5262
};

src/material/dialog/dialog-container.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
ViewChild,
3939
ViewEncapsulation,
4040
} from '@angular/core';
41-
import {matDialogAnimations} from './dialog-animations';
41+
import {matDialogAnimations, defaultParams} from './dialog-animations';
4242
import {MatDialogConfig} from './dialog-config';
4343

4444
/** Event that captures the state of dialog container animations. */
@@ -365,8 +365,10 @@ export class MatDialogContainer extends _MatDialogContainerBase {
365365
return {
366366
value: this._state,
367367
params: {
368-
enterAnimationDuration: this._config.enterAnimationDuration || '150ms',
369-
exitAnimationDuration: this._config.exitAnimationDuration || '75ms',
368+
enterAnimationDuration:
369+
this._config.enterAnimationDuration || defaultParams.params.enterAnimationDuration,
370+
exitAnimationDuration:
371+
this._config.exitAnimationDuration || defaultParams.params.exitAnimationDuration,
370372
},
371373
};
372374
}

src/material/dialog/public-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export * from './dialog-container';
1212
export * from './dialog-content-directives';
1313
export * from './dialog-config';
1414
export * from './dialog-ref';
15-
export * from './dialog-animations';
15+
export {matDialogAnimations} from './dialog-animations';

0 commit comments

Comments
 (0)