fix(ivy): reflect animations field directly into the output definition (#26322)
The 'animations' field of @Component metadata should be copied directly into the ngComponentDef for that component and should not pass through static resolution. Previously the animations array was statically resolved and then the values were translated back when generating ngComponentDef. PR Close #26322
This commit is contained in:

committed by
Jason Aden

parent
9623e7c639
commit
456f23f76a
@ -179,7 +179,7 @@ export interface R3ComponentMetadata extends R3DirectiveMetadata {
|
||||
/**
|
||||
* A collection of animation triggers that will be used in the component template.
|
||||
*/
|
||||
animations: {[key: string]: any}[]|null;
|
||||
animations: o.Expression|null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,9 +244,8 @@ export function compileComponentFromMetadata(
|
||||
}
|
||||
|
||||
// e.g. `animations: [trigger('123', [])]`
|
||||
if (meta.animations) {
|
||||
const animationValues = meta.animations.map(entry => mapToExpression(entry));
|
||||
definitionMap.set('animations', o.literalArr(animationValues));
|
||||
if (meta.animations !== null) {
|
||||
definitionMap.set('animations', meta.animations);
|
||||
}
|
||||
|
||||
// On the type side, remove newlines from the selector as it will need to fit into a TypeScript
|
||||
@ -301,7 +300,6 @@ export function compileComponentFromRender2(
|
||||
const definitionField = outputCtx.constantPool.propertyNameOf(DefinitionKind.Component);
|
||||
|
||||
const summary = component.toSummary();
|
||||
const animations = summary.template && summary.template.animations || null;
|
||||
|
||||
// Compute the R3ComponentMetadata from the CompileDirectiveMetadata
|
||||
const meta: R3ComponentMetadata = {
|
||||
@ -320,7 +318,7 @@ export function compileComponentFromRender2(
|
||||
styles: (summary.template && summary.template.styles) || EMPTY_ARRAY,
|
||||
encapsulation:
|
||||
(summary.template && summary.template.encapsulation) || core.ViewEncapsulation.Emulated,
|
||||
animations
|
||||
animations: null,
|
||||
};
|
||||
const res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);
|
||||
|
||||
|
Reference in New Issue
Block a user