import ngModule from '../../module'; import Component from '../../lib/component'; class Controller extends Component { constructor($element, $scope) { super($element, $scope); this.$scope = $scope; } toggle(event, item) { if (event.defaultPrevented || !item.sons) return; event.preventDefault(); this.treeview.onToggle(item); } select(item, value) { this.treeview.onSelection(item, value); } onIconClick(icon, item, parent, index) { let parentController = this.parentScope.$ctrl; icon.callback.call(parentController, item, parent, index); } onCreate(parent) { this.treeview.onCreate(parent); } onDrop(item, dragged, dropped) { this.treeview.onDrop(item, dragged, dropped); } get isInsertable() { return Array.isArray(this.parent) || this.parent.childs; } } ngModule.component('vnTreeviewChild', { template: require('./child.html'), controller: Controller, bindings: { items: '<', parent: '<', icons: '