feat(ivy): patch animations into metadata (#25828)

PR Close #25828
This commit is contained in:
Matias Niemelä
2018-09-05 15:23:59 -07:00
committed by Igor Minar
parent d6cd041cbd
commit d2dfd48be0
8 changed files with 176 additions and 6 deletions

View File

@ -164,6 +164,14 @@ export class ComponentDecoratorHandler implements DecoratorHandler<R3ComponentMe
component.get('encapsulation') !, this.reflector, this.checker) as string);
}
let animations: any[]|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;
}
return {
analysis: {
...metadata,
@ -176,7 +184,7 @@ export class ComponentDecoratorHandler implements DecoratorHandler<R3ComponentMe
// analyzed and the full compilation scope for the component can be realized.
pipes: EMPTY_MAP,
directives: EMPTY_MAP,
wrapDirectivesInClosure: false,
wrapDirectivesInClosure: false, animations,
}
};
}
@ -224,3 +232,9 @@ export class ComponentDecoratorHandler implements DecoratorHandler<R3ComponentMe
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;
}