New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(animations): support function types in transitions #13538
Conversation
3d5d135
to
5137ebc
Compare
5137ebc
to
3e7e34a
Compare
3e7e34a
to
2a43709
Compare
2a43709
to
719f825
Compare
719f825
to
d01cc6b
Compare
d01cc6b
to
21a8a20
Compare
21a8a20
to
2c86eaf
Compare
2c86eaf
to
29f6e05
Compare
29f6e05
to
add63c1
Compare
@@ -16,7 +20,7 @@ import {AUTO_STYLE, Component, animate, state, style, transition, trigger} from | |||
state('*', style({height: AUTO_STYLE, color: 'black', borderColor: 'black'})), | |||
state('closed, void', style({height: '0px', color: 'maroon', borderColor: 'maroon'})), | |||
state('open', style({height: AUTO_STYLE, borderColor: 'green', color: 'green'})), | |||
transition('* => *', animate(500)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep the old transition and add another one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e. just make another transition
?
@@ -8,6 +8,10 @@ | |||
|
|||
import {AUTO_STYLE, Component, animate, state, style, transition, trigger} from '@angular/core'; | |||
|
|||
export function anyToAny(stateA: string, stateB: string): boolean { | |||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a simple condition in here?
@@ -49,6 +49,10 @@ export class AnimationStateTransitionExpression { | |||
constructor(public fromState: string, public toState: string) {} | |||
} | |||
|
|||
export class AnimationStateTransitionFnExpression extends AnimationStateTransitionExpression { | |||
constructor(public fn: Function) { super(null, null); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct type is Function | StaticSymbol
const stateChangeExpr = transitionStateMetadata.stateChangeExpr; | ||
const transitionStates: Array<Function|string> = typeof stateChangeExpr == 'string' ? | ||
(<string>stateChangeExpr).split(/\s*,\s*/) : | ||
[<Function>stateChangeExpr]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type cast: <Function|StaticSymbol>
@@ -39,7 +39,11 @@ export class CompileAnimationStateDeclarationMetadata extends CompileAnimationSt | |||
} | |||
|
|||
export class CompileAnimationStateTransitionMetadata extends CompileAnimationStateMetadata { | |||
constructor(public stateChangeExpr: string, public steps: CompileAnimationMetadata) { super(); } | |||
constructor( | |||
public stateChangeExpr: string|((stateA: string, stateB: string) => boolean), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing |StaticSymbol
add63c1
to
88d75c7
Compare
88d75c7
to
e618d4e
Compare
e618d4e
to
6200404
Compare
6200404
to
be94928
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #13537