| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library table_tree_element; |
| 6 |
| 7 import 'dart:html'; |
| 8 import 'observatory_element.dart'; |
| 9 import 'package:observatory/observatory.dart'; |
| 10 import 'package:polymer/polymer.dart'; |
| 11 |
| 12 |
| 13 @CustomTag('table-tree') |
| 14 class TableTreeElement extends ObservatoryElement { |
| 15 TableTreeElement.created() : super.created(); |
| 16 @published TableTree tree; |
| 17 |
| 18 String padding(TableTreeRow row) { |
| 19 return 'padding-left: ${row.depth * 16}px;'; |
| 20 } |
| 21 |
| 22 String coloring(TableTreeRow row) { |
| 23 const colors = const ['active', 'success', 'warning', 'danger', 'info']; |
| 24 var index = row.depth % colors.length; |
| 25 return colors[index]; |
| 26 } |
| 27 |
| 28 void toggleExpanded(Event e, var detail, Element target) { |
| 29 TableElement table = shadowRoot.querySelector('#_table'); |
| 30 var index = table.tBodies[0].children.indexOf(target.parent) - 1; |
| 31 assert(index >= 0); |
| 32 assert(index < tree.rows.length); |
| 33 tree.toggle(index); |
| 34 } |
| 35 } |
| OLD | NEW |