import ngModule from '../../module'; import Component from '../../lib/component'; class Controller extends Component { constructor($element, $scope, $transclude) { super($element, $scope); this.$transclude = $transclude; } 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; } } Controller.$inject = ['$element', '$scope', '$transclude']; ngModule.component('vnTreeviewChilds', { template: require('./childs.html'), controller: Controller, bindings: { items: '<', parent: '