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
@ -182,12 +182,9 @@ export class ComponentDecoratorHandler implements
|
||||
component.get('encapsulation') !, this.reflector, this.checker) as string);
|
||||
}
|
||||
|
||||
let animations: any[]|null = null;
|
||||
let animations: Expression|null = null;
|
||||
if (component.has('animations')) {
|
||||
animations =
|
||||
(staticallyResolve(component.get('animations') !, this.reflector, this.checker) as any |
|
||||
null[]);
|
||||
animations = animations ? animations.map(entry => convertMapToStringMap(entry)) : null;
|
||||
animations = new WrappedNodeExpr(component.get('animations') !);
|
||||
}
|
||||
|
||||
return {
|
||||
@ -203,7 +200,8 @@ export class ComponentDecoratorHandler implements
|
||||
// analyzed and the full compilation scope for the component can be realized.
|
||||
pipes: EMPTY_MAP,
|
||||
directives: EMPTY_MAP,
|
||||
wrapDirectivesInClosure: false, animations,
|
||||
wrapDirectivesInClosure: false, //
|
||||
animations,
|
||||
},
|
||||
parsedTemplate: template.nodes,
|
||||
},
|
||||
@ -267,9 +265,3 @@ export class ComponentDecoratorHandler implements
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
||||
function convertMapToStringMap<T>(map: Map<string, T>): {[key: string]: T} {
|
||||
const stringMap: {[key: string]: T} = {};
|
||||
map.forEach((value: T, key: string) => { stringMap[key] = value; });
|
||||
return stringMap;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 0,
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
},
|
||||
animations: [{name: "foo123"}, {name: "trigger123"}]
|
||||
animations: [{name: 'foo123'}, {name: 'trigger123'}]
|
||||
});
|
||||
`;
|
||||
|
||||
|
Reference in New Issue
Block a user