Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: third_party/pkg/angular/lib/directive/ng_switch.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/directive/ng_switch.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_switch.dart b/third_party/pkg/angular/lib/directive/ng_switch.dart
index a66d5c4043f85642e1038454278f81fd476d84f0..c9aec1275916838fc8001384d960f67995da7232 100644
--- a/third_party/pkg/angular/lib/directive/ng_switch.dart
+++ b/third_party/pkg/angular/lib/directive/ng_switch.dart
@@ -49,32 +49,32 @@ part of angular.directive;
* </div>
* </div>
*/
-@NgDirective(
+@Decorator(
selector: '[ng-switch]',
map: const {
'ng-switch': '=>value',
'change': '&onChange'
},
- visibility: NgDirective.DIRECT_CHILDREN_VISIBILITY)
-class NgSwitchDirective {
+ visibility: Directive.DIRECT_CHILDREN_VISIBILITY)
+class NgSwitch {
Map<String, List<_Case>> cases = new Map<String, List<_Case>>();
- List<_BlockScopePair> currentBlocks = <_BlockScopePair>[];
+ List<_ViewScopePair> currentViews = <_ViewScopePair>[];
Function onChange;
final Scope scope;
- NgSwitchDirective(this.scope) {
+ NgSwitch(this.scope) {
cases['?'] = <_Case>[];
}
- addCase(String value, BlockHole anchor, BoundBlockFactory blockFactory) {
+ addCase(String value, ViewPort anchor, BoundViewFactory viewFactory) {
cases.putIfAbsent(value, () => <_Case>[]);
- cases[value].add(new _Case(anchor, blockFactory));
+ cases[value].add(new _Case(anchor, viewFactory));
}
set value(val) {
- currentBlocks
- ..forEach((_BlockScopePair pair) {
- pair.block.remove();
+ currentViews
+ ..forEach((_ViewScopePair pair) {
+ pair.port.remove(pair.view);
pair.scope.destroy();
})
..clear();
@@ -83,8 +83,10 @@ class NgSwitchDirective {
(cases.containsKey(val) ? cases[val] : cases['?'])
.forEach((_Case caze) {
Scope childScope = scope.createChild(new PrototypeMap(scope.context));
- var block = caze.blockFactory(childScope)..insertAfter(caze.anchor);
- currentBlocks.add(new _BlockScopePair(block, childScope));
+ var view = caze.viewFactory(childScope);
+ caze.anchor.insert(view);
+ currentViews.add(new _ViewScopePair(view, caze.anchor,
+ childScope));
});
if (onChange != null) {
onChange();
@@ -92,43 +94,43 @@ class NgSwitchDirective {
}
}
-class _BlockScopePair {
- final Block block;
+class _ViewScopePair {
+ final View view;
+ final ViewPort port;
final Scope scope;
- _BlockScopePair(this.block, this.scope);
+ _ViewScopePair(this.view, this.port, this.scope);
}
class _Case {
- final BlockHole anchor;
- final BoundBlockFactory blockFactory;
+ final ViewPort anchor;
+ final BoundViewFactory viewFactory;
- _Case(this.anchor, this.blockFactory);
+ _Case(this.anchor, this.viewFactory);
}
-@NgDirective(
+@Decorator(
selector: '[ng-switch-when]',
- children: NgAnnotation.TRANSCLUDE_CHILDREN,
+ children: Directive.TRANSCLUDE_CHILDREN,
map: const {'.': '@value'})
-class NgSwitchWhenDirective {
- final NgSwitchDirective ngSwitch;
- final BlockHole hole;
- final BoundBlockFactory blockFactory;
+class NgSwitchWhen {
+ final NgSwitch ngSwitch;
+ final ViewPort port;
+ final BoundViewFactory viewFactory;
final Scope scope;
- NgSwitchWhenDirective(this.ngSwitch, this.hole, this.blockFactory, this.scope);
+ NgSwitchWhen(this.ngSwitch, this.port, this.viewFactory, this.scope);
- set value(String value) => ngSwitch.addCase('!$value', hole, blockFactory);
+ set value(String value) => ngSwitch.addCase('!$value', port, viewFactory);
}
-
-@NgDirective(
- children: NgAnnotation.TRANSCLUDE_CHILDREN,
+@Decorator(
+ children: Directive.TRANSCLUDE_CHILDREN,
selector: '[ng-switch-default]')
-class NgSwitchDefaultDirective {
+class NgSwitchDefault {
- NgSwitchDefaultDirective(NgSwitchDirective ngSwitch, BlockHole hole,
- BoundBlockFactory blockFactory, Scope scope) {
- ngSwitch.addCase('?', hole, blockFactory);
+ NgSwitchDefault(NgSwitch ngSwitch, ViewPort port,
+ BoundViewFactory viewFactory, Scope scope) {
+ ngSwitch.addCase('?', port, viewFactory);
}
}
« no previous file with comments | « third_party/pkg/angular/lib/directive/ng_style.dart ('k') | third_party/pkg/angular/lib/directive/ng_template.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698