refactor(facade): Remove most of StringMapWrapper facade. (#12022)

This change mostly automated by
12012b07a2
with some manual fixes.
This commit is contained in:
Alex Eagle
2016-10-03 16:46:05 -07:00
committed by Chuck Jazdzewski
parent ed9c2b6281
commit b64b5ece65
36 changed files with 140 additions and 205 deletions

View File

@ -7,8 +7,6 @@
*/
import {AUTO_STYLE} from '@angular/core';
import {StringMapWrapper} from '../facade/collection';
import {StringWrapper, isNumber, isPresent} from '../facade/lang';
import {AnimationKeyframe, AnimationStyles} from '../private_import_core';
@ -65,15 +63,16 @@ function _populateStyles(
defaultStyles: {[key: string]: string | number}): {[key: string]: string | number} {
var data: {[key: string]: string | number} = {};
styles.styles.forEach((entry) => {
StringMapWrapper.forEach(entry, (val: any, prop: string) => {
Object.keys(entry).forEach(prop => {
const val = entry[prop];
var formattedProp = dashCaseToCamelCase(prop);
data[formattedProp] =
val == AUTO_STYLE ? val : val.toString() + _resolveStyleUnit(val, prop, formattedProp);
});
});
StringMapWrapper.forEach(defaultStyles, (value: string, prop: string) => {
Object.keys(defaultStyles).forEach(prop => {
if (!isPresent(data[prop])) {
data[prop] = value;
data[prop] = defaultStyles[prop];
}
});
return data;

View File

@ -7,8 +7,6 @@
*/
import {AUTO_STYLE} from '@angular/core';
import {StringMapWrapper} from '../facade/collection';
import {isPresent} from '../facade/lang';
import {AnimationPlayer} from '../private_import_core';
@ -49,7 +47,8 @@ export class WebAnimationsPlayer implements AnimationPlayer {
var keyframes = this.keyframes.map(styles => {
var formattedKeyframe: {[key: string]: string | number} = {};
StringMapWrapper.forEach(styles, (value: string | number, prop: string) => {
Object.keys(styles).forEach(prop => {
const value = styles[prop];
formattedKeyframe[prop] = value == AUTO_STYLE ? _computeStyle(this.element, prop) : value;
});
return formattedKeyframe;