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:
parent
f6e9d1f857
commit
82127571b5
18
gulpfile.js
18
gulpfile.js
|
@ -564,24 +564,6 @@ gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, {
|
||||||
path: CONFIG.dest.dart + '/benchmarks_external'
|
path: CONFIG.dest.dart + '/benchmarks_external'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
gulp.task('serve/examples.dart.static', pubserve(gulp, gulpPlugins, {
|
|
||||||
command: DART_SDK.PUB,
|
|
||||||
mode: 'ngstatic',
|
|
||||||
path: CONFIG.dest.dart + '/examples'
|
|
||||||
}));
|
|
||||||
|
|
||||||
gulp.task('serve/benchmarks.dart.static', pubserve(gulp, gulpPlugins, {
|
|
||||||
command: DART_SDK.PUB,
|
|
||||||
mode: 'ngstatic',
|
|
||||||
path: CONFIG.dest.dart + '/benchmarks'
|
|
||||||
}));
|
|
||||||
|
|
||||||
gulp.task('serve/benchmarks_external.dart.static', pubserve(gulp, gulpPlugins, {
|
|
||||||
command: DART_SDK.PUB,
|
|
||||||
mode: 'ngstatic',
|
|
||||||
path: CONFIG.dest.dart + '/benchmarks_external'
|
|
||||||
}));
|
|
||||||
|
|
||||||
// --------------
|
// --------------
|
||||||
// doc generation
|
// doc generation
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
|
|
|
@ -16,6 +16,6 @@ dependencies:
|
||||||
html: '^0.12.0'
|
html: '^0.12.0'
|
||||||
stack_trace: '^1.1.1'
|
stack_trace: '^1.1.1'
|
||||||
transformers:
|
transformers:
|
||||||
- angular2/src/transform/di_transformer
|
- angular2
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
guinness: "^0.1.17"
|
guinness: "^0.1.17"
|
||||||
|
|
|
@ -16,7 +16,13 @@ dependency_overrides:
|
||||||
path: ../angular2
|
path: ../angular2
|
||||||
transformers:
|
transformers:
|
||||||
- angular2:
|
- angular2:
|
||||||
entry_point: web/src/di/di_benchmark.dart
|
entry_points:
|
||||||
|
- web/src/compiler/compiler_benchmark.dart
|
||||||
|
- web/src/di/di_benchmark.dart
|
||||||
|
- web/src/element_injector/element_injector_benchmark.dart
|
||||||
|
- web/src/largetable/largetable_benchmark.dart
|
||||||
|
- web/src/naive_infinite_scroll/index.dart
|
||||||
|
- web/src/tree/tree_benchmark.dart
|
||||||
- $dart2js:
|
- $dart2js:
|
||||||
minify: false
|
minify: false
|
||||||
commandLineOptions: ['--dump-info', '--trust-type-annotations', '--trust-primitives']
|
commandLineOptions: ['--dump-info', '--trust-type-annotations', '--trust-primitives']
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_res
|
||||||
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
|
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
|
||||||
|
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||||
|
|
||||||
import {ProtoViewFactory} from 'angular2/src/core/compiler/proto_view_factory';
|
import {ProtoViewFactory} from 'angular2/src/core/compiler/proto_view_factory';
|
||||||
|
@ -29,41 +30,7 @@ import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
||||||
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
||||||
|
|
||||||
function setupReflector() {
|
function setupReflector() {
|
||||||
reflector.registerType(BenchmarkComponent, {
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
"factory": () => new BenchmarkComponent(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations" : [new Component()]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Dir0, {
|
|
||||||
"factory": () => new Dir0(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations" : [new Decorator({selector: '[dir0]', properties: {'prop': 'attr0'}})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Dir1, {
|
|
||||||
"factory": (dir0) => new Dir1(dir0),
|
|
||||||
"parameters": [[Dir0]],
|
|
||||||
"annotations" : [new Decorator({selector: '[dir1]', properties: {'prop': 'attr1'}})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Dir2, {
|
|
||||||
"factory": (dir1) => new Dir2(dir1),
|
|
||||||
"parameters": [[Dir1]],
|
|
||||||
"annotations" : [new Decorator({selector: '[dir2]', properties: {'prop': 'attr2'}})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Dir3, {
|
|
||||||
"factory": (dir2) => new Dir3(dir2),
|
|
||||||
"parameters": [[Dir2]],
|
|
||||||
"annotations" : [new Decorator({selector: '[dir3]', properties: {'prop': 'attr3'}})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Dir4, {
|
|
||||||
"factory": (dir3) => new Dir4(dir3),
|
|
||||||
"parameters": [[Dir3]],
|
|
||||||
"annotations" : [new Decorator({selector: '[dir4]', properties: {'prop': 'attr4'}})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerGetters({
|
reflector.registerGetters({
|
||||||
"inter0": (a) => a.inter0, "inter1": (a) => a.inter1,
|
"inter0": (a) => a.inter0, "inter1": (a) => a.inter1,
|
||||||
|
|
|
@ -1,34 +1,17 @@
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
import {Injector} from 'angular2/di';
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
|
import {Injectable, Injector} from 'angular2/di';
|
||||||
import {ProtoElementInjector} from 'angular2/src/core/compiler/element_injector';
|
import {ProtoElementInjector} from 'angular2/src/core/compiler/element_injector';
|
||||||
import {getIntParameter, bindAction, microBenchmark} from 'angular2/src/test_lib/benchmark_util';
|
import {getIntParameter, bindAction, microBenchmark} from 'angular2/src/test_lib/benchmark_util';
|
||||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
function setupReflector() {
|
|
||||||
reflector.registerType(A, {
|
|
||||||
'factory': () => new A(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations' : []
|
|
||||||
});
|
|
||||||
reflector.registerType(B, {
|
|
||||||
'factory': () => new B(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations' : []
|
|
||||||
});
|
|
||||||
reflector.registerType(C, {
|
|
||||||
'factory': (a,b) => new C(a,b),
|
|
||||||
'parameters': [[A],[B]],
|
|
||||||
'annotations' : []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
BrowserDomAdapter.makeCurrent();
|
BrowserDomAdapter.makeCurrent();
|
||||||
var iterations = getIntParameter('iterations');
|
var iterations = getIntParameter('iterations');
|
||||||
|
|
||||||
setupReflector();
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
var appInjector = new Injector([]);
|
var appInjector = new Injector([]);
|
||||||
|
|
||||||
var bindings = [A, B, C];
|
var bindings = [A, B, C];
|
||||||
|
@ -59,18 +42,21 @@ export function main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class A {
|
class A {
|
||||||
constructor() {
|
constructor() {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class B {
|
class B {
|
||||||
constructor() {
|
constructor() {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class C {
|
class C {
|
||||||
constructor(a:A, b:B) {
|
constructor(a:A, b:B) {
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_compone
|
||||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||||
|
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {isPresent, BaseException} from 'angular2/src/facade/lang';
|
import {isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||||
import {window, document, gc} from 'angular2/src/facade/browser';
|
import {window, document, gc} from 'angular2/src/facade/browser';
|
||||||
|
@ -42,349 +43,34 @@ import {Renderer} from 'angular2/src/render/api';
|
||||||
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
||||||
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
||||||
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
||||||
import {Inject} from 'angular2/di';
|
import {Inject, bind} from 'angular2/di';
|
||||||
|
|
||||||
|
export const BENCHMARK_TYPE = 'LargetableComponent.benchmarkType';
|
||||||
|
export const LARGETABLE_ROWS = 'LargetableComponent.rows';
|
||||||
|
export const LARGETABLE_COLS = 'LargetableComponent.cols';
|
||||||
|
function _createBindings() {
|
||||||
|
return [
|
||||||
|
bind(BENCHMARK_TYPE).toValue(getStringParameter('benchmarkType')),
|
||||||
|
bind(LARGETABLE_ROWS).toValue(getIntParameter('rows')),
|
||||||
|
bind(LARGETABLE_COLS).toValue(getIntParameter('columns'))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
var BASELINE_LARGETABLE_TEMPLATE;
|
var BASELINE_LARGETABLE_TEMPLATE;
|
||||||
|
|
||||||
function setupReflector() {
|
function setupReflector() {
|
||||||
// TODO: Put the general calls to reflector.register... in a shared file
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
// as they are needed in all benchmarks...
|
|
||||||
|
|
||||||
reflector.registerType(AppComponent, {
|
|
||||||
'factory': () => new AppComponent(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations': [
|
|
||||||
new Component({
|
|
||||||
selector: 'app'
|
|
||||||
|
|
||||||
}),
|
|
||||||
new View({
|
|
||||||
directives: [LargetableComponent],
|
|
||||||
template: `<largetable [data]='data' [benchmarkType]='benchmarkType'></largetable>`
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(LargetableComponent, {
|
|
||||||
'factory': () => new LargetableComponent(getStringParameter('benchmarkType'),
|
|
||||||
getIntParameter('rows'), getIntParameter('columns')),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations': [
|
|
||||||
new Component({
|
|
||||||
selector: 'largetable',
|
|
||||||
properties: {
|
|
||||||
'data': 'data',
|
|
||||||
'benchmarkType': 'benchmarktype'
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new View({
|
|
||||||
directives: [For, Switch, SwitchWhen, SwitchDefault],
|
|
||||||
template: `
|
|
||||||
<table [switch]="benchmarkType">
|
|
||||||
<tbody template="switch-when 'interpolation'">
|
|
||||||
<tr template="for #row of data">
|
|
||||||
<td template="for #column of row">
|
|
||||||
{{column.i}}:{{column.j}}|
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tbody template="switch-when 'interpolationAttr'">
|
|
||||||
<tr template="for #row of data">
|
|
||||||
<td template="for #column of row" i="{{column.i}}" j="{{column.j}}">
|
|
||||||
i,j attrs
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tbody template="switch-when 'interpolationFn'">
|
|
||||||
<tr template="for #row of data">
|
|
||||||
<td template="for #column of row">
|
|
||||||
{{column.iFn()}}:{{column.jFn()}}|
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tbody template="switch-default">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<em>{{benchmarkType}} not yet implemented</em>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>`
|
|
||||||
})
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
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(Switch, {
|
|
||||||
'factory': () => new Switch(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations' : [new Decorator({
|
|
||||||
selector: '[switch]',
|
|
||||||
properties: {
|
|
||||||
'value': 'switch'
|
|
||||||
}
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(SwitchWhen, {
|
|
||||||
'factory': (vc, ss) => new SwitchWhen(vc, ss),
|
|
||||||
'parameters': [[ViewContainer],[Switch, new Parent()]],
|
|
||||||
'annotations' : [new Viewport({
|
|
||||||
selector: '[switch-when]',
|
|
||||||
properties: {
|
|
||||||
'when': 'switch-when'
|
|
||||||
}
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(SwitchDefault, {
|
|
||||||
'factory': (vc, ss) => new SwitchDefault(vc, ss),
|
|
||||||
'parameters': [[ViewContainer],[Switch, new Parent()]],
|
|
||||||
'annotations' : [new Viewport({
|
|
||||||
selector: '[switch-default]'
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
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(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(TestabilityRegistry, {
|
|
||||||
"factory": () => new TestabilityRegistry(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Testability, {
|
|
||||||
"factory": () => new Testability(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(UrlResolver, {
|
|
||||||
"factory": () => new UrlResolver(),
|
|
||||||
"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(ComponentUrlMapper, {
|
|
||||||
"factory": () => new ComponentUrlMapper(),
|
|
||||||
"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": []
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// TODO(kegluneq): Generate these.
|
||||||
reflector.registerGetters({
|
reflector.registerGetters({
|
||||||
'data': (a) => a.data,
|
'benchmarktype': (o) => o.benchmarktype,
|
||||||
'benchmarkType': (a) => a.benchmarkType,
|
'switch': (o) => null,
|
||||||
'benchmarktype': (a) => a.benchmarktype,
|
'switchWhen': (o) => o.switchWhen
|
||||||
'when': (a) => a.when,
|
|
||||||
'switchWhen': (a) => a.switchWhen,
|
|
||||||
'switchwhen': (a) => a.switchwhen,
|
|
||||||
'value': (a) => a.value,
|
|
||||||
'iterable': (a) => a.iterable,
|
|
||||||
'iterableChanges': (a) => a.iterableChanges,
|
|
||||||
'row': (a) => a.row,
|
|
||||||
'column': (a) => a.column,
|
|
||||||
'i': (a) => a.i,
|
|
||||||
'j': (a) => a.j,
|
|
||||||
'switch': (a) => {throw new BaseException('not implemented, reserved word in dart')},
|
|
||||||
'for': (a) => {throw new BaseException('not implemented, reserved word in dart')},
|
|
||||||
'of': (a) => a.of
|
|
||||||
});
|
});
|
||||||
|
|
||||||
reflector.registerMethods({
|
|
||||||
'iFn': (a, args) => a.iFn(),
|
|
||||||
'jFn': (a, args) => a.jFn(),
|
|
||||||
})
|
|
||||||
|
|
||||||
reflector.registerSetters({
|
reflector.registerSetters({
|
||||||
'data': (a,v) => a.data = v,
|
'benchmarktype': (o, v) => o.benchmarktype = v,
|
||||||
'benchmarkType': (a,v) => a.benchmarkType = v,
|
'switch': (o, v) => null,
|
||||||
'benchmarktype': (a,v) => a.benchmarktype = v,
|
'switchWhen': (o, v) => o.switchWhen = v
|
||||||
'when': (a,v) => a.when = v,
|
|
||||||
'switchWhen': (a,v) => a.switchWhen = v,
|
|
||||||
'switchwhen': (a,v) => a.switchwhen = v,
|
|
||||||
'value': (a,v) => a.value = v,
|
|
||||||
'iterable': (a,v) => a.iterable = v,
|
|
||||||
'iterableChanges': (a,v) => a.iterableChanges = v,
|
|
||||||
'row': (a,v) => a.row = v,
|
|
||||||
'column': (a,v) => a.column = v,
|
|
||||||
'i': (a,v) => a.i = v,
|
|
||||||
'j': (a,v) => a.j = v,
|
|
||||||
'switch': (a,v) => {throw new BaseException('not implemented, reserved word in dart')},
|
|
||||||
'for': (a,v) => {throw new BaseException('not implemented, reserved word in dart')},
|
|
||||||
'of': (a,v) => a.j = v
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +142,7 @@ export function main() {
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
function initNg2() {
|
function initNg2() {
|
||||||
bootstrap(AppComponent).then((injector) => {
|
bootstrap(AppComponent, _createBindings()).then((injector) => {
|
||||||
app = injector.get(AppComponent);
|
app = injector.get(AppComponent);
|
||||||
lifecycle = injector.get(LifeCycle);
|
lifecycle = injector.get(LifeCycle);
|
||||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||||
|
@ -556,17 +242,68 @@ class CellData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app'
|
||||||
|
})
|
||||||
|
@View({
|
||||||
|
directives: [LargetableComponent],
|
||||||
|
template: `<largetable [data]='data' [benchmarkType]='benchmarkType'></largetable>`
|
||||||
|
})
|
||||||
class AppComponent {
|
class AppComponent {
|
||||||
data;
|
data;
|
||||||
benchmarkType:string;
|
benchmarkType:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'largetable',
|
||||||
|
properties: {
|
||||||
|
'data': 'data',
|
||||||
|
'benchmarkType': 'benchmarktype'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@View({
|
||||||
|
directives: [For, Switch, SwitchWhen, SwitchDefault],
|
||||||
|
template: `
|
||||||
|
<table [switch]="benchmarkType">
|
||||||
|
<tbody template="switch-when 'interpolation'">
|
||||||
|
<tr template="for #row of data">
|
||||||
|
<td template="for #column of row">
|
||||||
|
{{column.i}}:{{column.j}}|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody template="switch-when 'interpolationAttr'">
|
||||||
|
<tr template="for #row of data">
|
||||||
|
<td template="for #column of row" i="{{column.i}}" j="{{column.j}}">
|
||||||
|
i,j attrs
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody template="switch-when 'interpolationFn'">
|
||||||
|
<tr template="for #row of data">
|
||||||
|
<td template="for #column of row">
|
||||||
|
{{column.iFn()}}:{{column.jFn()}}|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody template="switch-default">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<em>{{benchmarkType}} not yet implemented</em>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>`
|
||||||
|
})
|
||||||
class LargetableComponent {
|
class LargetableComponent {
|
||||||
data;
|
data;
|
||||||
benchmarkType:string;
|
benchmarkType:string;
|
||||||
rows:number;
|
rows:number;
|
||||||
columns:number;
|
columns:number;
|
||||||
constructor(benchmarkType:string,rows:number,columns:number) {
|
constructor(
|
||||||
|
@Inject(BENCHMARK_TYPE) benchmarkType,
|
||||||
|
@Inject(LARGETABLE_ROWS) rows,
|
||||||
|
@Inject(LARGETABLE_COLS) columns) {
|
||||||
this.benchmarkType = benchmarkType;
|
this.benchmarkType = benchmarkType;
|
||||||
this.rows = rows;
|
this.rows = rows;
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
|
|
|
@ -10,6 +10,21 @@ import {If, For} from 'angular2/directives';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {document} from 'angular2/src/facade/browser';
|
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 {
|
export class App {
|
||||||
scrollAreas:List<int>;
|
scrollAreas:List<int>;
|
||||||
iterationCount:int;
|
iterationCount:int;
|
||||||
|
@ -77,25 +92,3 @@ export class App {
|
||||||
return DOM.query('body /deep/ #testArea /deep/ #scrollDiv');
|
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 {
|
export class CompanyNameComponent extends HasStyle {
|
||||||
company:Company;
|
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 {
|
export class OpportunityNameComponent extends HasStyle {
|
||||||
opportunity:Opportunity;
|
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 {
|
export class OfferingNameComponent extends HasStyle {
|
||||||
offering:Offering;
|
offering:Offering;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +73,25 @@ export class Stage {
|
||||||
apply:Function;
|
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 {
|
export class StageButtonsComponent extends HasStyle {
|
||||||
_offering:Offering;
|
_offering:Offering;
|
||||||
stages:List<Stage>;
|
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 {
|
export class AccountCellComponent extends HasStyle {
|
||||||
account:Account;
|
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 {
|
export class FormattedCellComponent extends HasStyle {
|
||||||
formattedValue:string;
|
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
|
bootstrap, Component, Viewport, View, ViewContainer, Compiler, onChange, NgElement, Decorator
|
||||||
} from 'angular2/angular2';
|
} from 'angular2/angular2';
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
import {CompilerCache} from 'angular2/src/core/compiler/compiler';
|
import {CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
||||||
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
|
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 {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||||
|
|
||||||
import {If, For} from 'angular2/directives';
|
import {If, For} from 'angular2/directives';
|
||||||
import {App, setupReflectorForApp} from './app';
|
import {App} from './app';
|
||||||
import {ScrollAreaComponent, setupReflectorForScrollArea} from './scroll_area';
|
import {ScrollAreaComponent} from './scroll_area';
|
||||||
import {ScrollItemComponent, setupReflectorForScrollItem} from './scroll_item';
|
import {ScrollItemComponent} from './scroll_item';
|
||||||
import {CompanyNameComponent, OpportunityNameComponent, OfferingNameComponent,
|
import {CompanyNameComponent, OpportunityNameComponent, OfferingNameComponent,
|
||||||
AccountCellComponent, StageButtonsComponent, FormattedCellComponent,
|
AccountCellComponent, StageButtonsComponent, FormattedCellComponent}
|
||||||
setupReflectorForCells}
|
|
||||||
from './cells';
|
from './cells';
|
||||||
|
|
||||||
import {EventManager} from 'angular2/src/render/dom/events/event_manager';
|
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 {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
||||||
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
||||||
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
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() {
|
export function main() {
|
||||||
setupReflector();
|
setupReflector();
|
||||||
bootstrap(App);
|
bootstrap(App, createBindings());
|
||||||
|
}
|
||||||
|
|
||||||
|
function createBindings():List {
|
||||||
|
return [bind(VIEW_POOL_CAPACITY).toValue(100000)];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupReflector() {
|
export function setupReflector() {
|
||||||
setupReflectorForAngular();
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
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
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// TODO(kegluneq): Generate this.
|
||||||
reflector.registerSetters({
|
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) => {
|
'style': (o, m) => {
|
||||||
//if (isBlank(m)) return;
|
//if (isBlank(m)) return;
|
||||||
// HACK
|
// HACK
|
||||||
|
@ -167,207 +75,3 @@ export function setupReflector() {
|
||||||
'setStage': (o, args) => o.setStage(args[0])
|
'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 {ScrollItemComponent} from './scroll_item';
|
||||||
import {For} from 'angular2/directives';
|
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 {
|
export class ScrollAreaComponent {
|
||||||
_fullList:List<Offering>;
|
_fullList:List<Offering>;
|
||||||
visibleItems:List<Offering>;
|
visibleItems:List<Offering>;
|
||||||
|
@ -59,32 +79,3 @@ export class ScrollAreaComponent {
|
||||||
this.visibleItems = ListWrapper.slice(this._fullList, iStart, iEnd);
|
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';
|
END_DATE_WIDTH, AAT_STATUS_WIDTH} from './common';
|
||||||
import {generateOfferings} from './random_data';
|
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 {
|
export class ScrollItemComponent {
|
||||||
|
|
||||||
offering:Offering;
|
offering:Offering;
|
||||||
|
@ -43,64 +95,3 @@ export class ScrollItemComponent {
|
||||||
get endDateWidth() { return `${END_DATE_WIDTH}px`; }
|
get endDateWidth() { return `${END_DATE_WIDTH}px`; }
|
||||||
get aatStatusWidth() { return `${AAT_STATUS_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>`
|
|
||||||
})
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_compone
|
||||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||||
|
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {window, document, gc} from 'angular2/src/facade/browser';
|
import {window, document, gc} from 'angular2/src/facade/browser';
|
||||||
|
@ -38,245 +39,14 @@ import {Renderer} from 'angular2/src/render/api';
|
||||||
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
|
||||||
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
import * as rc from 'angular2/src/render/dom/compiler/compiler';
|
||||||
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
import * as rvf from 'angular2/src/render/dom/view/view_factory';
|
||||||
import {Inject} from 'angular2/di';
|
import {Inject, bind} from 'angular2/di';
|
||||||
|
|
||||||
|
function createBindings():List {
|
||||||
|
return [bind(VIEW_POOL_CAPACITY).toValue(100000)];
|
||||||
|
}
|
||||||
|
|
||||||
function setupReflector() {
|
function setupReflector() {
|
||||||
// TODO: Put the general calls to reflector.register... in a shared file
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
// as they are needed in all benchmarks...
|
|
||||||
|
|
||||||
reflector.registerType(AppComponent, {
|
|
||||||
'factory': () => new AppComponent(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations' : [
|
|
||||||
new Component({selector: 'app'}),
|
|
||||||
new View({
|
|
||||||
directives: [TreeComponent],
|
|
||||||
template: `<tree [data]='initData'></tree>`
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(TreeComponent, {
|
|
||||||
'factory': () => new TreeComponent(),
|
|
||||||
'parameters': [],
|
|
||||||
'annotations' : [
|
|
||||||
new Component({
|
|
||||||
selector: 'tree',
|
|
||||||
properties: {'data': 'data'}
|
|
||||||
}),
|
|
||||||
new View({
|
|
||||||
directives: [TreeComponent, If],
|
|
||||||
template: `<span> {{data.value}} <span template='if data.right != null'><tree [data]='data.right'></tree></span><span template='if data.left != null'><tree [data]='data.left'></tree></span></span>`
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(If, {
|
|
||||||
'factory': (vp) => new If(vp),
|
|
||||||
'parameters': [[ViewContainer]],
|
|
||||||
'annotations' : [new Viewport({
|
|
||||||
selector: '[if]',
|
|
||||||
properties: {
|
|
||||||
'condition': 'if'
|
|
||||||
}
|
|
||||||
})]
|
|
||||||
});
|
|
||||||
|
|
||||||
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(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(TestabilityRegistry, {
|
|
||||||
"factory": () => new TestabilityRegistry(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(Testability, {
|
|
||||||
"factory": () => new Testability(),
|
|
||||||
"parameters": [],
|
|
||||||
"annotations": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(StyleUrlResolver, {
|
|
||||||
"factory": (urlResolver) => new StyleUrlResolver(urlResolver),
|
|
||||||
"parameters": [[UrlResolver]],
|
|
||||||
"annotations": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerType(UrlResolver, {
|
|
||||||
"factory": () => new UrlResolver(),
|
|
||||||
"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(ComponentUrlMapper, {
|
|
||||||
"factory": () => new ComponentUrlMapper(),
|
|
||||||
"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": []
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerGetters({
|
|
||||||
'value': (a) => a.value,
|
|
||||||
'left': (a) => a.left,
|
|
||||||
'right': (a) => a.right,
|
|
||||||
'initData': (a) => a.initData,
|
|
||||||
'data': (a) => a.data,
|
|
||||||
'condition': (a) => a.condition,
|
|
||||||
});
|
|
||||||
|
|
||||||
reflector.registerSetters({
|
|
||||||
'value': (a,v) => a.value = v,
|
|
||||||
'left': (a,v) => a.left = v,
|
|
||||||
'right': (a,v) => a.right = v,
|
|
||||||
'initData': (a,v) => a.initData = v,
|
|
||||||
'data': (a,v) => a.data = v,
|
|
||||||
'condition': (a,v) => a.condition = v,
|
|
||||||
'if': (a,v) => a['if'] = v,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var BASELINE_TREE_TEMPLATE;
|
var BASELINE_TREE_TEMPLATE;
|
||||||
|
@ -346,7 +116,7 @@ export function main() {
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
function initNg2() {
|
function initNg2() {
|
||||||
bootstrap(AppComponent).then((injector) => {
|
bootstrap(AppComponent, createBindings()).then((injector) => {
|
||||||
lifeCycle = injector.get(LifeCycle);
|
lifeCycle = injector.get(LifeCycle);
|
||||||
|
|
||||||
app = injector.get(AppComponent);
|
app = injector.get(AppComponent);
|
||||||
|
@ -475,6 +245,11 @@ class BaseLineIf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({selector: 'app'})
|
||||||
|
@View({
|
||||||
|
directives: [TreeComponent],
|
||||||
|
template: `<tree [data]='initData'></tree>`
|
||||||
|
})
|
||||||
class AppComponent {
|
class AppComponent {
|
||||||
initData:TreeNode;
|
initData:TreeNode;
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -484,6 +259,14 @@ class AppComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'tree',
|
||||||
|
properties: {'data': 'data'}
|
||||||
|
})
|
||||||
|
@View({
|
||||||
|
directives: [TreeComponent, If],
|
||||||
|
template: `<span> {{data.value}} <span template='if data.right != null'><tree [data]='data.right'></tree></span><span template='if data.left != null'><tree [data]='data.left'></tree></span></span>`
|
||||||
|
})
|
||||||
class TreeComponent {
|
class TreeComponent {
|
||||||
data:TreeNode;
|
data:TreeNode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue