Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

matsko
Copy link
Contributor

@matsko matsko commented Dec 17, 2016

Closes #13537

matsko added a commit to matsko/angular that referenced this pull request Dec 17, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 17, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 17, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 20, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 21, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 21, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 21, 2016
matsko added a commit to matsko/angular that referenced this pull request Dec 21, 2016
@matsko matsko changed the title fix(animations): support function types in transitions feat(animations): support function types in transitions Dec 21, 2016
matsko added a commit to matsko/angular that referenced this pull request Jan 3, 2017
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker pr_state: LGTM labels Jan 4, 2017
@@ -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))
Copy link
Contributor

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?

Copy link
Contributor

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;
Copy link
Contributor

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); }
Copy link
Contributor

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];
Copy link
Contributor

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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing |StaticSymbol

@tbosch tbosch added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Jan 4, 2017
matsko added a commit to matsko/angular that referenced this pull request Jan 4, 2017
matsko added a commit to matsko/angular that referenced this pull request Jan 4, 2017
matsko added a commit to matsko/angular that referenced this pull request Jan 4, 2017
@tbosch tbosch added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 4, 2017
@matsko matsko closed this in 9211a22 Jan 9, 2017
@matsko matsko deleted the transition_function branch March 1, 2017 18:49
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
idlechara pushed a commit to idlechara/angular that referenced this pull request Apr 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There is no way to disable animations for transitions without dynamic states
4 participants