1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { animate, state, style, transition, trigger, } from '@angular/animations';
|
---|
9 | /** Time and timing curve for expansion panel animations. */
|
---|
10 | // Note: Keep this in sync with the Sass variable for the panel header animation.
|
---|
11 | export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,1)';
|
---|
12 | /**
|
---|
13 | * Animations used by the Material expansion panel.
|
---|
14 | *
|
---|
15 | * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
|
---|
16 | * causes the animation state of moved components to become `void` upon exit, and not update again
|
---|
17 | * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
|
---|
18 | * of the panel is `expanded` or `collapsed` but the animation state is `void`.
|
---|
19 | *
|
---|
20 | * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
|
---|
21 | * are defined to have the same styles. Since angular animates from the current styles to the
|
---|
22 | * destination state's style definition, in situations where we are moving from `void`'s styles to
|
---|
23 | * `collapsed` this acts a noop since no style values change.
|
---|
24 | *
|
---|
25 | * In the case where angular's animation state is out of sync with the expansion panel's state, the
|
---|
26 | * expansion panel being `expanded` and angular animations being `void`, the animation from the
|
---|
27 | * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
|
---|
28 | * occur as expected.
|
---|
29 | *
|
---|
30 | * Angular Bug: https://github.com/angular/angular/issues/18847
|
---|
31 | *
|
---|
32 | * @docs-private
|
---|
33 | */
|
---|
34 | export const matExpansionAnimations = {
|
---|
35 | /** Animation that rotates the indicator arrow. */
|
---|
36 | indicatorRotate: trigger('indicatorRotate', [
|
---|
37 | state('collapsed, void', style({ transform: 'rotate(0deg)' })),
|
---|
38 | state('expanded', style({ transform: 'rotate(180deg)' })),
|
---|
39 | transition('expanded <=> collapsed, void => collapsed', animate(EXPANSION_PANEL_ANIMATION_TIMING)),
|
---|
40 | ]),
|
---|
41 | /** Animation that expands and collapses the panel content. */
|
---|
42 | bodyExpansion: trigger('bodyExpansion', [
|
---|
43 | state('collapsed, void', style({ height: '0px', visibility: 'hidden' })),
|
---|
44 | state('expanded', style({ height: '*', visibility: 'visible' })),
|
---|
45 | transition('expanded <=> collapsed, void => collapsed', animate(EXPANSION_PANEL_ANIMATION_TIMING)),
|
---|
46 | ])
|
---|
47 | };
|
---|
48 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwYW5zaW9uLWFuaW1hdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvZXhwYW5zaW9uL2V4cGFuc2lvbi1hbmltYXRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUNILE9BQU8sRUFDTCxPQUFPLEVBRVAsS0FBSyxFQUNMLEtBQUssRUFDTCxVQUFVLEVBQ1YsT0FBTyxHQUNSLE1BQU0scUJBQXFCLENBQUM7QUFFN0IsNERBQTREO0FBQzVELGlGQUFpRjtBQUNqRixNQUFNLENBQUMsTUFBTSxnQ0FBZ0MsR0FBRyxtQ0FBbUMsQ0FBQztBQUVwRjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBRy9CO0lBQ0Ysa0RBQWtEO0lBQ2xELGVBQWUsRUFBRSxPQUFPLENBQUMsaUJBQWlCLEVBQUU7UUFDMUMsS0FBSyxDQUFDLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxFQUFDLFNBQVMsRUFBRSxjQUFjLEVBQUMsQ0FBQyxDQUFDO1FBQzVELEtBQUssQ0FBQyxVQUFVLEVBQUUsS0FBSyxDQUFDLEVBQUMsU0FB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