feat(dart/transform): Use the Dart transformer for benchmarks
Remove explicit generation of reflection information in benchmark code and generate it with the transformer.
This commit is contained in:
@ -10,6 +10,21 @@ import {If, For} from 'angular2/directives';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {document} from 'angular2/src/facade/browser';
|
||||
|
||||
|
||||
@Component({selector: 'scroll-app'})
|
||||
@View({
|
||||
directives: [ScrollAreaComponent, If, For],
|
||||
template: `
|
||||
<div>
|
||||
<div style="display: flex">
|
||||
<scroll-area id="testArea"></scroll-area>
|
||||
</div>
|
||||
<div template="if scrollAreas.length > 0">
|
||||
<p>Following tables are only here to add weight to the UI:</p>
|
||||
<scroll-area template="for #scrollArea of scrollAreas"></scroll-area>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
export class App {
|
||||
scrollAreas:List<int>;
|
||||
iterationCount:int;
|
||||
@ -77,25 +92,3 @@ export class App {
|
||||
return DOM.query('body /deep/ #testArea /deep/ #scrollDiv');
|
||||
}
|
||||
}
|
||||
|
||||
export function setupReflectorForApp() {
|
||||
reflector.registerType(App, {
|
||||
'factory': () => { return new App(); },
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({selector: 'scroll-app'}),
|
||||
new View({
|
||||
directives: [ScrollAreaComponent, If, For],
|
||||
template: `
|
||||
<div>
|
||||
<div style="display: flex">
|
||||
<scroll-area id="testArea"></scroll-area>
|
||||
</div>
|
||||
<div template="if scrollAreas.length > 0">
|
||||
<p>Following tables are only here to add weight to the UI:</p>
|
||||
<scroll-area template="for #scrollArea of scrollAreas"></scroll-area>
|
||||
</div>
|
||||
</div>`
|
||||
})]
|
||||
});
|
||||
}
|
||||
|
@ -21,14 +21,47 @@ export class HasStyle {
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'company-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'company': 'company'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{company.name}}</div>`
|
||||
})
|
||||
export class CompanyNameComponent extends HasStyle {
|
||||
company:Company;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'opportunity-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'opportunity': 'opportunity'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{opportunity.name}}</div>`
|
||||
})
|
||||
export class OpportunityNameComponent extends HasStyle {
|
||||
opportunity:Opportunity;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'offering-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'offering': 'offering'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{offering.name}}</div>`
|
||||
})
|
||||
export class OfferingNameComponent extends HasStyle {
|
||||
offering:Offering;
|
||||
}
|
||||
@ -40,6 +73,25 @@ export class Stage {
|
||||
apply:Function;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'stage-buttons',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'offering': 'offering'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [For],
|
||||
template: `
|
||||
<div [style]="style">
|
||||
<button template="for #stage of stages"
|
||||
[disabled]="stage.isDisabled"
|
||||
[style]="stage.style"
|
||||
on-click="setStage(stage)">
|
||||
{{stage.name}}
|
||||
</button>
|
||||
</div>`
|
||||
})
|
||||
export class StageButtonsComponent extends HasStyle {
|
||||
_offering:Offering;
|
||||
stages:List<Stage>;
|
||||
@ -80,10 +132,37 @@ export class StageButtonsComponent extends HasStyle {
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'account-cell',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'account': 'account'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [],
|
||||
template: `
|
||||
<div [style]="style">
|
||||
<a href="/account/{{account.accountId}}">
|
||||
{{account.accountId}}
|
||||
</a>
|
||||
</div>`
|
||||
})
|
||||
export class AccountCellComponent extends HasStyle {
|
||||
account:Account;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'formatted-cell',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'value': 'value'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{formattedValue}}</div>`
|
||||
})
|
||||
export class FormattedCellComponent extends HasStyle {
|
||||
formattedValue:string;
|
||||
|
||||
@ -95,126 +174,3 @@ export class FormattedCellComponent extends HasStyle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function setupReflectorForCells() {
|
||||
reflector.registerType(CompanyNameComponent, {
|
||||
'factory': () => new CompanyNameComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'company-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'company': 'company'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{company.name}}</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
reflector.registerType(OpportunityNameComponent, {
|
||||
'factory': () => new OpportunityNameComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'opportunity-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'opportunity': 'opportunity'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{opportunity.name}}</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
reflector.registerType(OfferingNameComponent, {
|
||||
'factory': () => new OfferingNameComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'offering-name',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'offering': 'offering'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{offering.name}}</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
reflector.registerType(StageButtonsComponent, {
|
||||
'factory': () => new StageButtonsComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'stage-buttons',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'offering': 'offering'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [For],
|
||||
template: `
|
||||
<div [style]="style">
|
||||
<button template="for #stage of stages"
|
||||
[disabled]="stage.isDisabled"
|
||||
[style]="stage.style"
|
||||
on-click="setStage(stage)">
|
||||
{{stage.name}}
|
||||
</button>
|
||||
</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
reflector.registerType(AccountCellComponent, {
|
||||
'factory': () => new AccountCellComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'account-cell',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'account': 'account'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [],
|
||||
template: `
|
||||
<div [style]="style">
|
||||
<a href="/account/{{account.accountId}}">
|
||||
{{account.accountId}}
|
||||
</a>
|
||||
</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
reflector.registerType(FormattedCellComponent, {
|
||||
'factory': () => new FormattedCellComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'formatted-cell',
|
||||
properties: {
|
||||
'width': 'cell-width',
|
||||
'value': 'value'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [],
|
||||
template: `<div [style]="style">{{formattedValue}}</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
bootstrap, Component, Viewport, View, ViewContainer, Compiler, onChange, NgElement, Decorator
|
||||
} from 'angular2/angular2';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
||||
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
|
||||
@ -27,12 +28,11 @@ import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_compone
|
||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||
|
||||
import {If, For} from 'angular2/directives';
|
||||
import {App, setupReflectorForApp} from './app';
|
||||
import {ScrollAreaComponent, setupReflectorForScrollArea} from './scroll_area';
|
||||
import {ScrollItemComponent, setupReflectorForScrollItem} from './scroll_item';
|
||||
import {App} from './app';
|
||||
import {ScrollAreaComponent} from './scroll_area';
|
||||
import {ScrollItemComponent} from './scroll_item';
|
||||
import {CompanyNameComponent, OpportunityNameComponent, OfferingNameComponent,
|
||||
AccountCellComponent, StageButtonsComponent, FormattedCellComponent,
|
||||
setupReflectorForCells}
|
||||
AccountCellComponent, StageButtonsComponent, FormattedCellComponent}
|
||||
from './cells';
|
||||
|
||||
import {EventManager} from 'angular2/src/render/dom/events/event_manager';
|
||||
@ -42,114 +42,22 @@ import {Renderer} from 'angular2/src/render/api';
|
||||
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
||||
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
||||
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
||||
import {Inject} from 'angular2/di';
|
||||
import {Inject, bind} from 'angular2/di';
|
||||
|
||||
export function main() {
|
||||
setupReflector();
|
||||
bootstrap(App);
|
||||
bootstrap(App, createBindings());
|
||||
}
|
||||
|
||||
function createBindings():List {
|
||||
return [bind(VIEW_POOL_CAPACITY).toValue(100000)];
|
||||
}
|
||||
|
||||
export function setupReflector() {
|
||||
setupReflectorForAngular();
|
||||
setupReflectorForApp();
|
||||
setupReflectorForScrollArea();
|
||||
setupReflectorForScrollItem();
|
||||
setupReflectorForCells();
|
||||
|
||||
reflector.registerGetters({
|
||||
'scrollAreas': (o) => o.scrollAreas,
|
||||
'length': (o) => o.length,
|
||||
'iterableChanges': (o) => o.iterableChanges,
|
||||
'scrollArea': (o) => o.scrollArea,
|
||||
'item': (o) => o.item,
|
||||
'visibleItems': (o) => o.visibleItems,
|
||||
'condition': (o) => o.condition,
|
||||
'width': (o) => o.width,
|
||||
'value': (o) => o.value,
|
||||
'href': (o) => o.href,
|
||||
'company': (o) => o.company,
|
||||
'formattedValue': (o) => o.formattedValue,
|
||||
'name': (o) => o.name,
|
||||
'style': (o) => o.style,
|
||||
'offering': (o) => o.offering,
|
||||
'account': (o) => o.account,
|
||||
'accountId': (o) => o.accountId,
|
||||
'companyNameWidth': (o) => o.companyNameWidth,
|
||||
'opportunityNameWidth': (o) => o.opportunityNameWidth,
|
||||
'offeringNameWidth': (o) => o.offeringNameWidth,
|
||||
'accountCellWidth': (o) => o.accountCellWidth,
|
||||
'basePointsWidth': (o) => o.basePointsWidth,
|
||||
'scrollDivStyle': (o) => o.scrollDivStyle,
|
||||
'paddingStyle': (o) => o.paddingStyle,
|
||||
'innerStyle': (o) => o.innerStyle,
|
||||
'opportunity': (o) => o.opportunity,
|
||||
'itemStyle': (o) => o.itemStyle,
|
||||
'dueDateWidth': (o) => o.dueDateWidth,
|
||||
'basePoints': (o) => o.basePoints,
|
||||
'kickerPoints': (o) => o.kickerPoints,
|
||||
'kickerPointsWidth': (o) => o.kickerPointsWidth,
|
||||
'bundles': (o) => o.bundles,
|
||||
'stageButtonsWidth': (o) => o.stageButtonsWidth,
|
||||
'bundlesWidth': (o) => o.bundlesWidth,
|
||||
'disabled': (o) => o.disabled,
|
||||
'isDisabled': (o) => o.isDisabled,
|
||||
'dueDate': (o) => o.dueDate,
|
||||
'endDate': (o) => o.endDate,
|
||||
'aatStatus': (o) => o.aatStatus,
|
||||
'stage': (o) => o.stage,
|
||||
'stages': (o) => o.stages,
|
||||
'aatStatusWidth': (o) => o.aatStatusWidth,
|
||||
'endDateWidth': (o) => o.endDateWidth,
|
||||
'$event': (o) => null
|
||||
});
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
|
||||
// TODO(kegluneq): Generate this.
|
||||
reflector.registerSetters({
|
||||
'scrollAreas': (o, v) => o.scrollAreas = v,
|
||||
'length': (o, v) => o.length = v,
|
||||
'condition': (o, v) => o.condition = v,
|
||||
'scrollArea': (o, v) => o.scrollArea = v,
|
||||
'item': (o, v) => o.item = v,
|
||||
'visibleItems': (o, v) => o.visibleItems = v,
|
||||
'iterableChanges': (o, v) => o.iterableChanges = v,
|
||||
'width': (o, v) => o.width = v,
|
||||
'value': (o, v) => o.value = v,
|
||||
'company': (o, v) => o.company = v,
|
||||
'name': (o, v) => o.name = v,
|
||||
'offering': (o, v) => o.offering = v,
|
||||
'account': (o, v) => o.account = v,
|
||||
'accountId': (o, v) => o.accountId = v,
|
||||
'formattedValue': (o, v) => o.formattedValue = v,
|
||||
'stage': (o, v) => o.stage = v,
|
||||
'stages': (o, v) => o.stages = v,
|
||||
'disabled': (o, v) => o.disabled = v,
|
||||
'isDisabled': (o, v) => o.isDisabled = v,
|
||||
'href': (o, v) => o.href = v,
|
||||
'companyNameWidth': (o, v) => o.companyNameWidth = v,
|
||||
'opportunityNameWidth': (o, v) => o.opportunityNameWidth = v,
|
||||
'offeringNameWidth': (o, v) => o.offeringNameWidth = v,
|
||||
'accountCellWidth': (o, v) => o.accountCellWidth = v,
|
||||
'basePointsWidth': (o, v) => o.basePointsWidth = v,
|
||||
'scrollDivStyle': (o, v) => o.scrollDivStyle = v,
|
||||
'paddingStyle': (o, v) => o.paddingStyle = v,
|
||||
'innerStyle': (o, v) => o.innerStyle = v,
|
||||
'opportunity': (o, v) => o.opportunity = v,
|
||||
'itemStyle': (o, v) => o.itemStyle = v,
|
||||
'basePoints': (o, v) => o.basePoints = v,
|
||||
'kickerPoints': (o, v) => o.kickerPoints = v,
|
||||
'kickerPointsWidth': (o, v) => o.kickerPointsWidth = v,
|
||||
'stageButtonsWidth': (o, v) => o.stageButtonsWidth = v,
|
||||
'dueDate': (o, v) => o.dueDate = v,
|
||||
'dueDateWidth': (o, v) => o.dueDateWidth = v,
|
||||
'endDate': (o, v) => o.endDate = v,
|
||||
'endDateWidth': (o, v) => o.endDate = v,
|
||||
'aatStatus': (o, v) => o.aatStatus = v,
|
||||
'aatStatusWidth': (o, v) => o.aatStatusWidth = v,
|
||||
'bundles': (o, v) => o.bundles = v,
|
||||
'bundlesWidth': (o, v) => o.bundlesWidth = v,
|
||||
'if': (o, v) => {},
|
||||
'of': (o, v) => {},
|
||||
'cellWidth': (o, v) => o.cellWidth = v,
|
||||
'$event': (o, v) => null,
|
||||
'style': (o, m) => {
|
||||
//if (isBlank(m)) return;
|
||||
// HACK
|
||||
@ -167,207 +75,3 @@ export function setupReflector() {
|
||||
'setStage': (o, args) => o.setStage(args[0])
|
||||
});
|
||||
}
|
||||
|
||||
export function setupReflectorForAngular() {
|
||||
reflector.registerType(If, {
|
||||
'factory': (vp) => new If(vp),
|
||||
'parameters': [[ViewContainer]],
|
||||
'annotations' : [new Viewport({
|
||||
selector: '[if]',
|
||||
properties: {
|
||||
'condition': 'if'
|
||||
}
|
||||
})]
|
||||
});
|
||||
|
||||
reflector.registerType(For, {
|
||||
'factory': (vp) => new For(vp),
|
||||
'parameters': [[ViewContainer]],
|
||||
'annotations' : [new Viewport({
|
||||
selector: '[for]',
|
||||
properties: {
|
||||
'iterableChanges': 'of | iterableDiff'
|
||||
}
|
||||
})]
|
||||
});
|
||||
|
||||
reflector.registerType(Compiler, {
|
||||
"factory": (reader, compilerCache, tplResolver, cmpUrlMapper, urlResolver, renderer,
|
||||
protoViewFactory) =>
|
||||
new Compiler(reader, compilerCache, tplResolver, cmpUrlMapper, urlResolver, renderer,
|
||||
protoViewFactory),
|
||||
"parameters": [[DirectiveMetadataReader], [CompilerCache], [TemplateResolver], [ComponentUrlMapper],
|
||||
[UrlResolver], [Renderer], [ProtoViewFactory]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(CompilerCache, {
|
||||
'factory': () => new CompilerCache(),
|
||||
'parameters': [],
|
||||
'annotations': []
|
||||
});
|
||||
|
||||
reflector.registerType(Parser, {
|
||||
'factory': (lexer) => new Parser(lexer),
|
||||
'parameters': [[Lexer]],
|
||||
'annotations': []
|
||||
});
|
||||
|
||||
reflector.registerType(TemplateLoader, {
|
||||
"factory": (xhr, urlResolver) => new TemplateLoader(xhr, urlResolver),
|
||||
"parameters": [[XHR], [UrlResolver]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(TemplateResolver, {
|
||||
"factory": () => new TemplateResolver(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(XHR, {
|
||||
"factory": () => new XHRImpl(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(DirectiveMetadataReader, {
|
||||
'factory': () => new DirectiveMetadataReader(),
|
||||
'parameters': [],
|
||||
'annotations': []
|
||||
});
|
||||
|
||||
reflector.registerType(Lexer, {
|
||||
'factory': () => new Lexer(),
|
||||
'parameters': [],
|
||||
'annotations': []
|
||||
});
|
||||
|
||||
reflector.registerType(ExceptionHandler, {
|
||||
"factory": () => new ExceptionHandler(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(LifeCycle, {
|
||||
"factory": (exHandler, cd) => new LifeCycle(exHandler, cd),
|
||||
"parameters": [[ExceptionHandler], [ChangeDetector]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(ShadowDomStrategy, {
|
||||
"factory": (strategy) => strategy,
|
||||
"parameters": [[NativeShadowDomStrategy]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(NativeShadowDomStrategy, {
|
||||
"factory": (styleUrlResolver) => new NativeShadowDomStrategy(styleUrlResolver),
|
||||
"parameters": [[StyleUrlResolver]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(EmulatedUnscopedShadowDomStrategy, {
|
||||
"factory": (styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, null),
|
||||
"parameters": [[StyleUrlResolver]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(StyleUrlResolver, {
|
||||
"factory": (urlResolver) => new StyleUrlResolver(urlResolver),
|
||||
"parameters": [[UrlResolver]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(UrlResolver, {
|
||||
"factory": () => new UrlResolver(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(ComponentUrlMapper, {
|
||||
"factory": () => new ComponentUrlMapper(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(TestabilityRegistry, {
|
||||
"factory": () => new TestabilityRegistry(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(Testability, {
|
||||
"factory": () => new Testability(),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(StyleInliner, {
|
||||
"factory": (xhr, styleUrlResolver, urlResolver) =>
|
||||
new StyleInliner(xhr, styleUrlResolver, urlResolver),
|
||||
"parameters": [[XHR], [StyleUrlResolver], [UrlResolver]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(EventManager, {
|
||||
"factory": () => new EventManager([], null),
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
|
||||
reflector.registerType(DynamicComponentLoader, {
|
||||
"factory": (compiler, reader, renderer, viewFactory) =>
|
||||
new DynamicComponentLoader(compiler, reader, renderer, viewFactory),
|
||||
"parameters": [[Compiler], [DirectiveMetadataReader], [Renderer], [ViewFactory]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(DirectDomRenderer, {
|
||||
"factory": (renderCompiler, renderViewFactory, shadowDomStrategy) =>
|
||||
new DirectDomRenderer(renderCompiler, renderViewFactory, shadowDomStrategy),
|
||||
"parameters": [[rc.Compiler], [rvf.ViewFactory], [ShadowDomStrategy]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(rc.DefaultCompiler, {
|
||||
"factory": (parser, shadowDomStrategy, templateLoader) =>
|
||||
new rc.DefaultCompiler(parser, shadowDomStrategy, templateLoader),
|
||||
"parameters": [[Parser], [ShadowDomStrategy], [TemplateLoader]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(rvf.ViewFactory, {
|
||||
"factory": (capacity, eventManager, shadowDomStrategy) =>
|
||||
new rvf.ViewFactory(capacity, eventManager, shadowDomStrategy),
|
||||
"parameters": [[new Inject(rvf.VIEW_POOL_CAPACITY)], [EventManager], [ShadowDomStrategy]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(rvf.VIEW_POOL_CAPACITY, {
|
||||
"factory": () => 100000,
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(ProtoViewFactory, {
|
||||
"factory": (changeDetection, renderer) =>
|
||||
new ProtoViewFactory(changeDetection, renderer),
|
||||
"parameters": [[ChangeDetection], [Renderer]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(ViewFactory, {
|
||||
"factory": (capacity) =>
|
||||
new ViewFactory(capacity),
|
||||
"parameters": [[new Inject(VIEW_POOL_CAPACITY)]],
|
||||
"annotations": []
|
||||
});
|
||||
|
||||
reflector.registerType(VIEW_POOL_CAPACITY, {
|
||||
"factory": () => 100000,
|
||||
"parameters": [],
|
||||
"annotations": []
|
||||
});
|
||||
}
|
||||
|
@ -14,6 +14,26 @@ import {generateOfferings} from './random_data';
|
||||
import {ScrollItemComponent} from './scroll_item';
|
||||
import {For} from 'angular2/directives';
|
||||
|
||||
@Component({
|
||||
selector: 'scroll-area',
|
||||
})
|
||||
@View({
|
||||
directives: [ScrollItemComponent, For],
|
||||
template: `
|
||||
<div>
|
||||
<div id="scrollDiv"
|
||||
[style]="scrollDivStyle"
|
||||
on-scroll="onScroll($event)">
|
||||
<div id="padding"></div>
|
||||
<div id="inner">
|
||||
<scroll-item
|
||||
template="for #item of visibleItems"
|
||||
[offering]="item">
|
||||
</scroll-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
export class ScrollAreaComponent {
|
||||
_fullList:List<Offering>;
|
||||
visibleItems:List<Offering>;
|
||||
@ -59,32 +79,3 @@ export class ScrollAreaComponent {
|
||||
this.visibleItems = ListWrapper.slice(this._fullList, iStart, iEnd);
|
||||
}
|
||||
}
|
||||
|
||||
export function setupReflectorForScrollArea() {
|
||||
reflector.registerType(ScrollAreaComponent, {
|
||||
'factory': () => new ScrollAreaComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'scroll-area',
|
||||
}),
|
||||
new View({
|
||||
directives: [ScrollItemComponent, For],
|
||||
template: `
|
||||
<div>
|
||||
<div id="scrollDiv"
|
||||
[style]="scrollDivStyle"
|
||||
on-scroll="onScroll($event)">
|
||||
<div id="padding"></div>
|
||||
<div id="inner">
|
||||
<scroll-item
|
||||
template="for #item of visibleItems"
|
||||
[offering]="item">
|
||||
</scroll-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -16,6 +16,58 @@ import {Offering, ITEM_HEIGHT, COMPANY_NAME_WIDTH, OPPORTUNITY_NAME_WIDTH,
|
||||
END_DATE_WIDTH, AAT_STATUS_WIDTH} from './common';
|
||||
import {generateOfferings} from './random_data';
|
||||
|
||||
@Component({
|
||||
selector: 'scroll-item',
|
||||
properties: {
|
||||
'offering': 'offering'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
directives: [
|
||||
CompanyNameComponent,
|
||||
OpportunityNameComponent,
|
||||
OfferingNameComponent,
|
||||
StageButtonsComponent,
|
||||
AccountCellComponent,
|
||||
FormattedCellComponent
|
||||
],
|
||||
template: `
|
||||
<div class="row" [style]="itemStyle">
|
||||
<company-name [company]="offering.company"
|
||||
[cell-width]="companyNameWidth">
|
||||
</company-name>
|
||||
<opportunity-name [opportunity]="offering.opportunity"
|
||||
[cell-width]="opportunityNameWidth">
|
||||
</opportunity-name>
|
||||
<offering-name [offering]="offering"
|
||||
[cell-width]="offeringNameWidth">
|
||||
</offering-name>
|
||||
<account-cell [account]="offering.account"
|
||||
[cell-width]="accountCellWidth">
|
||||
</account-cell>
|
||||
<formatted-cell [value]="offering.basePoints"
|
||||
[cell-width]="basePointsWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.kickerPoints"
|
||||
[cell-width]="kickerPointsWidth">
|
||||
</formatted-cell>
|
||||
<stage-buttons [offering]="offering"
|
||||
[cell-width]="stageButtonsWidth">
|
||||
</stage-buttons>
|
||||
<formatted-cell [value]="offering.bundles"
|
||||
[cell-width]="bundlesWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.dueDate"
|
||||
[cell-width]="dueDateWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.endDate"
|
||||
[cell-width]="endDateWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.aatStatus"
|
||||
[cell-width]="aatStatusWidth">
|
||||
</formatted-cell>
|
||||
</div>`
|
||||
})
|
||||
export class ScrollItemComponent {
|
||||
|
||||
offering:Offering;
|
||||
@ -43,64 +95,3 @@ export class ScrollItemComponent {
|
||||
get endDateWidth() { return `${END_DATE_WIDTH}px`; }
|
||||
get aatStatusWidth() { return `${AAT_STATUS_WIDTH}px`; }
|
||||
}
|
||||
|
||||
export function setupReflectorForScrollItem() {
|
||||
reflector.registerType(ScrollItemComponent, {
|
||||
'factory': () => new ScrollItemComponent(),
|
||||
'parameters': [],
|
||||
'annotations': [
|
||||
new Component({
|
||||
selector: 'scroll-item',
|
||||
properties: {
|
||||
'offering': 'offering'
|
||||
}
|
||||
}),
|
||||
new View({
|
||||
directives: [
|
||||
CompanyNameComponent,
|
||||
OpportunityNameComponent,
|
||||
OfferingNameComponent,
|
||||
StageButtonsComponent,
|
||||
AccountCellComponent,
|
||||
FormattedCellComponent
|
||||
],
|
||||
template: `
|
||||
<div class="row" [style]="itemStyle">
|
||||
<company-name [company]="offering.company"
|
||||
[cell-width]="companyNameWidth">
|
||||
</company-name>
|
||||
<opportunity-name [opportunity]="offering.opportunity"
|
||||
[cell-width]="opportunityNameWidth">
|
||||
</opportunity-name>
|
||||
<offering-name [offering]="offering"
|
||||
[cell-width]="offeringNameWidth">
|
||||
</offering-name>
|
||||
<account-cell [account]="offering.account"
|
||||
[cell-width]="accountCellWidth">
|
||||
</account-cell>
|
||||
<formatted-cell [value]="offering.basePoints"
|
||||
[cell-width]="basePointsWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.kickerPoints"
|
||||
[cell-width]="kickerPointsWidth">
|
||||
</formatted-cell>
|
||||
<stage-buttons [offering]="offering"
|
||||
[cell-width]="stageButtonsWidth">
|
||||
</stage-buttons>
|
||||
<formatted-cell [value]="offering.bundles"
|
||||
[cell-width]="bundlesWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.dueDate"
|
||||
[cell-width]="dueDateWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.endDate"
|
||||
[cell-width]="endDateWidth">
|
||||
</formatted-cell>
|
||||
<formatted-cell [value]="offering.aatStatus"
|
||||
[cell-width]="aatStatusWidth">
|
||||
</formatted-cell>
|
||||
</div>`
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user