1- import { List , ListWrapper , Map , MapWrapper } from 'angular2/src/facade/collection' ;
1+ import { List , ListWrapper , Map } from 'angular2/src/facade/collection' ;
22import { Company , Opportunity , Offering , Account , CustomDate , STATUS_LIST } from './common' ;
33import { NgFor } from 'angular2/directives' ;
44
55import { Component , Directive , View } from 'angular2/angular2' ;
66
77export class HasStyle {
8- style : Map < any , any > ;
8+ cellWidth : int ;
99
10- constructor ( ) { this . style = new Map ( ) ; }
10+ constructor ( ) { }
1111
12- set width ( w ) { this . style . set ( 'width' , w ) ; }
12+ set width ( w : int ) { this . cellWidth = w ; }
1313}
1414
1515@Component ( { selector : 'company-name' , properties : [ 'width: cell-width' , 'company' ] } )
16- @View ( { directives : [ ] , template : `<div [style]="style ">{{company.name}}</div>` } )
16+ @View ( { directives : [ ] , template : `<div [style.width.px ]="cellWidth ">{{company.name}}</div>` } )
1717export class CompanyNameComponent extends HasStyle {
1818 company : Company ;
1919}
2020
2121@Component ( { selector : 'opportunity-name' , properties : [ 'width: cell-width' , 'opportunity' ] } )
22- @View ( { directives : [ ] , template : `<div [style]="style ">{{opportunity.name}}</div>` } )
22+ @View ( { directives : [ ] , template : `<div [style.width.px ]="cellWidth ">{{opportunity.name}}</div>` } )
2323export class OpportunityNameComponent extends HasStyle {
2424 opportunity : Opportunity ;
2525}
2626
2727@Component ( { selector : 'offering-name' , properties : [ 'width: cell-width' , 'offering' ] } )
28- @View ( { directives : [ ] , template : `<div [style]="style ">{{offering.name}}</div>` } )
28+ @View ( { directives : [ ] , template : `<div [style.width.px ]="cellWidth ">{{offering.name}}</div>` } )
2929export class OfferingNameComponent extends HasStyle {
3030 offering : Offering ;
3131}
3232
3333export class Stage {
3434 name : string ;
3535 isDisabled : boolean ;
36- style : Map < string , string > ;
36+ backgroundColor : string ;
3737 apply : Function ;
3838}
3939
4040@Component ( { selector : 'stage-buttons' , properties : [ 'width: cell-width' , 'offering' ] } )
4141@View ( {
4242 directives : [ NgFor ] ,
4343 template : `
44- <div [style]="style ">
44+ <div [style.width.px ]="cellWidth ">
4545 <button template="ng-for #stage of stages"
4646 [disabled]="stage.isDisabled"
47- [style]="stage.style "
47+ [style.background-color ]="stage.backgroundColor "
4848 on-click="setStage(stage)">
4949 {{stage.name}}
5050 </button>
@@ -73,9 +73,7 @@ export class StageButtonsComponent extends HasStyle {
7373 var stage = new Stage ( ) ;
7474 stage . name = status ;
7575 stage . isDisabled = disabled ;
76- var stageStyle = new Map < string , string > ( ) ;
77- stageStyle . set ( 'background-color' , disabled ? '#DDD' : isCurrent ? '#DDF' : '#FDD' ) ;
78- stage . style = stageStyle ;
76+ stage . backgroundColor = disabled ? '#DDD' : isCurrent ? '#DDF' : '#FDD' ;
7977 if ( isCurrent ) {
8078 disabled = false ;
8179 }
@@ -88,7 +86,7 @@ export class StageButtonsComponent extends HasStyle {
8886@View ( {
8987 directives : [ ] ,
9088 template : `
91- <div [style]="style ">
89+ <div [style.width.px ]="cellWidth ">
9290 <a href="/account/{{account.accountId}}">
9391 {{account.accountId}}
9492 </a>
@@ -99,7 +97,7 @@ export class AccountCellComponent extends HasStyle {
9997}
10098
10199@Component ( { selector : 'formatted-cell' , properties : [ 'width: cell-width' , 'value' ] } )
102- @View ( { directives : [ ] , template : `<div [style]="style ">{{formattedValue}}</div>` } )
100+ @View ( { directives : [ ] , template : `<div [style.width.px ]="cellWidth ">{{formattedValue}}</div>` } )
103101export class FormattedCellComponent extends HasStyle {
104102 formattedValue : string ;
105103
0 commit comments