/* filename: angular.integralui.treeview.min.js version : 3.3.445 Copyright � 2014-2018 Lidor Systems. All rights reserved. This file is part of the "IntegralUI" Library. The contents of this file are subject to the IntegralUI Studio for Web License, and may not be used except in compliance with the License. A copy of the License should have been installed in the product's root installation directory or it can be found at http://www.lidorsystems.com/products/web/studio/license-agreement.aspx. This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws. */ angular .module("integralui") .factory("IntegralUITreeViewService", [ "$rootScope", function(c) { var q = null; return { addItem: function(e, l, n) { c.$broadcast(e + "-add-item", l, n); }, clearItems: function(e, l) { c.$broadcast(e + "-clear-items", l); }, insertItemAt: function(e, l, n, f) { c.$broadcast(e + "-insert-item-at", l, n, f); }, insertItemBefore: function(e, l, n) { c.$broadcast(e + "-insert-item-before", l, n); }, insertItemAfter: function(e, l, n) { c.$broadcast(e + "-insert-item-after", l, n); }, removeItem: function(e, l) { c.$broadcast(e + "-remove-item", l); }, removeItemAt: function(e, l, n) { c.$broadcast(e + "-remove-item-at", l, n); }, exportToJSON: function(e, l, n, f) { c.$broadcast(e + "-export-json", l, n, f); e = this.getTempData(); this.clearTempData(); return e ? e : ""; }, loadData: function(e, l, n, f, k) { c.$broadcast(e + "-load-data", l, n, f, k); l = this.getTempData(); this.clearTempData(); return l ? l : null; }, openEditor: function(e, l) { c.$broadcast(e + "-open-editor", l); }, closeEditor: function(e, l) { c.$broadcast(e + "-close-editor", l); }, collapse: function(e, l) { c.$broadcast(e + "-collapse", l); }, expand: function(e, l) { c.$broadcast(e + "-expand", l); }, toggle: function(e, l) { c.$broadcast(e + "-toggle", l); }, findItemById: function(e, l) { c.$broadcast(e + "-find-item-by-id", l); var n = this.getTempData(); this.clearTempData(); return n ? n : null; }, findItemByText: function(e, l) { c.$broadcast(e + "-find-item-by-text", l); var n = this.getTempData(); this.clearTempData(); return n ? n : null; }, getItemParent: function(e, l) { c.$broadcast(e + "-get-item-parent", l); var n = this.getTempData(); this.clearTempData(); return n ? n : null; }, getItemAt: function(e, l) { c.$broadcast(e + "-get-item-at", l); var n = this.getTempData(); this.clearTempData(); return n ? n : null; }, filter: function(e, l) { c.$broadcast(e + "-filter", l); }, focus: function(e, l) { c.$broadcast(e + "-focus", l); }, clearTempData: function() { q = null; }, ensureVisible: function(e, l, n) { c.$broadcast(e + "-ensure-visible", l, n); }, getCheckList: function(e, l) { c.$broadcast(e + "-get-check-list", l); var n = this.getTempData(); this.clearTempData(); return n ? n : []; }, getItemLevel: function(e, l) { c.$broadcast(e + "-get-item-level", l); var n = this.getTempData(); this.clearTempData(); return n ? n : 0; }, getFlatList: function(e, l) { c.$broadcast(e + "-get-flat-list", l); var n = this.getTempData(); this.clearTempData(); return n ? n : []; }, getFullPath: function(e, l) { c.$broadcast(e + "-get-full-path", l); var n = this.getTempData(); this.clearTempData(); return n ? n : ""; }, getList: function(e, l, n) { c.$broadcast(e + "-get-list", l, n); e = this.getTempData(); this.clearTempData(); return e ? e : []; }, getTempData: function() { return q; }, setTempData: function(c) { q = c; }, beginLoad: function(e, l, n) { c.$broadcast(e + "-begin-load", l, n); }, endLoad: function(e, l) { c.$broadcast(e + "-end-load", l); }, moveItem: function(e, l, n, f, k) { c.$broadcast(e + "-move-item", l, n, f, k); }, clearSelection: function(e) { c.$broadcast(e + "-clear-selection"); }, selectedItem: function(e, l) { if (l) c.$broadcast(e + "-set-selected-item", l); else { c.$broadcast(e + "-get-selected-item"); var n = this.getTempData(); this.clearTempData(); return n ? n : null; } }, selectedItems: function(e, l) { if (l) c.$broadcast(e + "-set-selected-items", l); else { c.$broadcast(e + "-get-selected-items"); var n = this.getTempData(); this.clearTempData(); return n ? n : null; } }, getScrollPos: function(e) { c.$broadcast(e + "-get-scroll-pos"); e = this.getTempData(); this.clearTempData(); return e ? e : { x: 0, y: 0 }; }, setScrollPos: function(e, l) { c.$broadcast(e + "-set-scroll-pos", l); }, scrollTo: function(e, l, n) { c.$broadcast(e + "-scroll-to", l, n); }, sort: function(e, l, n) { c.$broadcast(e + "-sort", l, n); }, updateCheckValues: function(e, l) { c.$broadcast(e + "-update-check", l); }, refresh: function(e, l, n) { c.$broadcast(e + "-refresh", l, n); }, resumeLayout: function(e) { c.$broadcast(e + "-resume-layout"); }, suspendLayout: function(e) { c.$broadcast(e + "-suspend-layout"); }, updateLayout: function(e) { c.$broadcast(e + "-update-layout"); }, updateView: function(e) { c.$broadcast(e + "-update-view"); } }; } ]) .controller("IntegralUITreeViewController", [ "$scope", "$element", "$timeout", "$window", "$q", "IntegralUIInternalService", "IntegralUIDataService", "IntegralUITreeViewService", "IntegralUIDragDrop", "IntegralUIFilter", function(c, q, e, l, n, f, k, m, U, a) { var b = this; b.hoverItem = null; this.suppressProcess = !1; b.defaultCheckBoxStyle = { general: "iui-checkbox", box: { general: "iui-checkbox-box", disabled: "iui-checkbox-box-disabled", checked: "iui-checkbox-checked", indeterminate: "iui-checkbox-indeterminate", unchecked: "iui-checkbox-unchecked" } }; b.defaultStyle = { general: "iui-treeview", item: { general: { disabled: "iui-treeview-item-disabled", focused: "iui-treeview-item-focused", normal: "iui-treeview-item", hovered: "iui-treeview-item-hovered", selected: "iui-treeview-item-selected" }, checkBox: { general: "iui-checkbox", box: { general: "iui-checkbox-box", disabled: "iui-checkbox-box-disabled", checked: "iui-checkbox-checked", indeterminate: "iui-checkbox-indeterminate", unchecked: "iui-checkbox-unchecked" } }, expandBox: { general: "iui-treeview-expand-box", animated: "iui-treeview-expand-box-load", expanded: "iui-treeview-expand-box-open", collapsed: "iui-treeview-expand-box-close" }, content: { disabled: "iui-treeview-item-content-disabled", focused: "iui-treeview-item-content-focused", normal: "iui-treeview-item-content", hovered: "iui-treeview-item-content-hovered", selected: "iui-treeview-item-content-selected" }, fixed: { disabled: "iui-treeview-item-fixed-disabled", normal: "iui-treeview-item-fixed", hovered: "iui-treeview-item-fixed-hovered" } } }; b.defaultCheckBoxSettings = { autoCheck: !1, style: b.defaultCheckBoxStyle, threeState: !1 }; this.updateOptions = function(d) { d ? ((b.options = { allowAnimation: f.isFieldAvailable(d.allowAnimation, !0), allowDrag: f.isFieldAvailable(d.allowDrag, !1), allowDrop: f.isFieldAvailable(d.allowDrop, !0), allowFocus: f.isFieldAvailable(d.allowFocus, !0), animationSpeed: 200, autoCheck: f.isFieldAvailable(d.autoCheck, !1), autoExpand: f.isFieldAvailable(d.autoExpand, !0), autoSize: f.isFieldAvailable(d.autoSize, !1), autoUpdate: f.isFieldAvailable(d.autoUpdate, !0), checkBoxSettings: b.defaultCheckBoxSettings, controlStyle: b.defaultStyle, editorSettings: { activate: "click" }, enabled: f.isFieldAvailable(d.enabled, !0), hoverSelection: f.isFieldAvailable(d.hoverSelection, !1), indent: f.isFieldAvailable(d.indent, 15), itemIcon: f.isFieldAvailable(d.itemIcon, ""), itemSpacing: f.isFieldAvailable(d.itemSpacing, 1), labelEdit: f.isFieldAvailable(d.labelEdit, !1), loadItems: [], maxItems: f.isFieldAvailable(d.maxItems, 0), mouseWheelSpeed: f.isFieldAvailable(d.mouseWheelSpeed, "normal"), pathSeparator: f.isFieldAvailable(d.pathSeparator, "\\"), rtl: f.isFieldAvailable(d.rtl, !1), selectedIndex: -1, selectedItem: f.isFieldAvailable( d.selectedItem, b.options.selectedItem ? b.options.selectedItem : null ), selectedItems: [], selectionMode: f.isFieldAvailable(d.selectionMode, "one"), showCheckBoxes: f.isFieldAvailable(d.showCheckBoxes, !1), showExpandBoxes: f.isFieldAvailable(d.showExpandBoxes, !0), showIcons: f.isFieldAvailable(d.showIcons, !0), showLines: f.isFieldAvailable(d.showLines, !1), showStatusIcons: f.isFieldAvailable(d.showStatusIcons, !1), sorting: f.isFieldAvailable(d.sorting, "none") }), b.updateDataFields(d.dataFields), b.updateControlStyle(d.controlStyle), b.updateCheckBoxSettings(d.checkBoxSettings), b.updateTemplateSettings(d.templateSettings)) : ((b.options = { allowAnimation: !0, allowDrag: !1, allowDrop: !0, allowFocus: !0, animationSpeed: 200, autoCheck: !1, autoExpand: !0, autoSize: !1, autoUpdate: !0, checkBoxSettings: b.defaultCheckBoxSettings, controlStyle: b.defaultStyle, editorSettings: { activate: "click" }, enabled: !0, hoverSelection: !1, indent: 15, itemIcon: "", itemSpacing: 1, labelEdit: !1, loadItems: [], maxItems: 0, mouseWheelSpeed: "normal", pathSeparator: "\\", rtl: !1, selectedIndex: -1, selectedItem: null, selectedItems: [], selectionMode: "one", showCheckBoxes: !1, showExpandBoxes: !0, showIcons: !0, showLines: !1, showStatusIcons: !1, sorting: "none", templateSettings: { url: null } }), b.updateDataFields()); }; b.options = {}; this.updateDataFields = function(d) { b.options.dataFields = d ? { allowDrag: d.allowDrag ? d.allowDrag : "allowDrag", allowDrop: d.allowDrop ? d.allowDrop : "allowDrop", allowEdit: d.allowEdit ? d.allowEdit : "allowEdit", allowFocus: d.allowFocus ? d.allowFocus : "allowFocus", autoCheck: d.autoCheck ? d.autoCheck : "autoCheck", checkBoxSettings: d.checkBoxSettings ? d.checkBoxSettings : "checkBoxSettings", checked: d.checked ? d.checked : "checked", checkState: d.checkState ? d.checkState : "checkState", content: d.content ? d.content : "content", contextMenu: d.contextMenu ? d.contextMenu : "contextMenu", enabled: d.enabled ? d.enabled : "enabled", expanded: d.expanded ? d.expanded : "expanded", fixed: d.fixed ? d.fixed : "fixed", fixChildren: d.fixChildren ? d.fixChildren : "fixChildren", hasChildren: d.hasChildren ? d.hasChildren : "hasChildren", icon: d.icon ? d.icon : "icon", id: d.id ? d.id : "id", items: d.items ? d.items : "items", pid: d.pid ? d.pid : "pid", selected: d.selected ? d.selected : "selected", showCheckBox: d.showCheckBox ? d.showCheckBox : "showCheckBox", statusIcon: d.statusIcon ? d.statusIcon : "statusIcon", style: d.style ? d.style : "style", templateObj: d.templateObj ? d.templateObj : "templateObj", text: d.text ? d.text : "text", tooltip: d.tooltip ? d.tooltip : "tooltip", value: d.value ? d.value : "value", visible: d.visible ? d.visible : "visible" } : { allowDrag: "allowDrag", allowDrop: "allowDrop", allowEdit: "allowEdit", allowFocus: "allowFocus", autoCheck: "autoCheck", checkBoxSettings: "checkBoxSettings", checked: "checked", checkState: "checkState", content: "content", contextMenu: "contextMenu", enabled: "enabled", expanded: "expanded", fixed: "fixed", fixChildren: "fixChildren", hasChildren: "hasChildren", icon: "icon", id: "id", items: "items", pid: "pid", selected: "selected", showCheckBox: "showCheckBox", statusIcon: "statusIcon", style: "style", templateObj: "templateObj", text: "text", tooltip: "tooltip", value: "value", visible: "visible" }; b.dataObj && b.dataObj.updateDataFields(b.getDataFields(b.options.dataFields)); }; this.updateTemplateSettings = function(d) { b.options.templateSettings = d ? { display: f.isFieldAvailable(d.display, "block"), url: f.isFieldAvailable(d.url, null) } : { display: "block", url: null }; }; b.updateOptions(); c.$on(c.name + "-add-item", function(d, a, c) { b.dataObj.insertAt(a, -1, c, b.itemIsAdded); }); c.$on(c.name + "-clear-items", function(d, a) { b.dataObj.clear(a, b.listIsCleared); }); c.$on(c.name + "-insert-item-at", function(d, a, c, r) { b.dataObj.insertAt(a, c, r, b.itemIsAdded); }); c.$on(c.name + "-insert-item-after", function(d, a, c) { b.dataObj.insertByRef(a, c, !0, b.itemIsAdded); }); c.$on(c.name + "-insert-item-before", function(d, a, c) { b.dataObj.insertByRef(a, c, !1, b.itemIsAdded); }); c.$on(c.name + "-remove-item", function(d, a) { b.dataObj.removeAt(a, -1, null, b.itemIsRemoved); }); c.$on(c.name + "-remove-item-at", function(d, a, c) { b.dataObj.removeAt(null, a, c, b.itemIsRemoved); }); this.listIsCleared = function(d) { d || (b.clearPrevSelection(), (b.options.selectedItem = null), b.setScrollPos({ x: 0, y: 0 })); b.updateCurrentLayout(); }; this.itemIsAdded = function() { b.updateCurrentLayout(); }; this.itemIsRemoved = function(d) { d && ((d[b.options.dataFields.selected] = !1), d == b.options.selectedItem && (b.options.selectedItem = null)); b.updateCurrentLayout(); }; this.objIsRemoved = function() { b.updateCurrentLayout(); }; this.getCheckValue = function(d) { return "checked" == d[b.options.dataFields.checkState] ? "checked" : 1 == b.options.checkBoxSettings.threeState && "indeterminate" == d[b.options.dataFields.checkState] ? "indeterminate" : "unchecked"; }; this.changeCheckValue = function(d) { if ( 1 == b.options.autoCheck || 1 == b.options.checkBoxSettings.autoCheck ) { var a = b.getCheckValue(d); if ( !1 !== (1 == b.options.checkBoxSettings.threeState ? b.callCheckValueChanging(d, a) : b.callCheckValueChanging(d, "checked" == a ? !0 : !1)) ) { if (1 == b.options.checkBoxSettings.threeState) switch (a) { case "checked": a = "unchecked"; break; case "indeterminate": a = "checked"; break; case "unchecked": a = "indeterminate"; } else a = "unchecked" == a || "indeterminate" == a ? "checked" : "unchecked"; d[b.options.dataFields.checkState] = a; d[b.options.dataFields.checked] = "checked" == a ? !0 : !1; c.$apply(); } } }; this.callCheckValueChanging = function(d, a) { var h = !0; b.allowEvents && (h = 1 == b.options.checkBoxSettings.threeState ? angular.isDefined(c.events) && c.events.itemCheckstateChanging ? c.events.itemCheckstateChanging({ item: d, value: a }) : c.itemCheckstateChanging({ e: { item: d, value: a } }) : angular.isDefined(c.events) && c.events.itemCheckedChanging ? c.events.itemCheckedChanging({ item: d, value: a }) : c.itemCheckedChanging({ e: { item: d, value: a } })); return h; }; this.callCheckValueChanged = function(d, a) { b.allowEvents && (retValue = 1 == b.options.checkBoxSettings.threeState ? angular.isDefined(c.events) && c.events.itemCheckstateChanged ? c.events.itemCheckstateChanged({ item: d, value: a }) : c.itemCheckstateChanged({ e: { item: d, value: a } }) : angular.isDefined(c.events) && c.events.itemCheckedChanged ? c.events.itemCheckedChanged({ item: d, value: a }) : c.itemCheckedChanged({ e: { item: d, value: a } })); }; var w = [], H = !1; this.fillCheckList = function(d) { if ( b.allowEvents && d && 1 == b.options.checkBoxSettings.threeState && !H ) { H = !0; w.length = 0; w.push({ item: d, value: d[b.options.dataFields.checkState] }); b.updateListChildItemCheckValue(d); b.updateListParentItemCheckValue(d); var a = 0; for (a = 0; a < w.length; a++) w[a].item[b.options.dataFields.checkState] = w[a].value; var c = e(function() { a == w.length && (H = !1); e.cancel(c); }, 1); } }; this.getItemCheckValue = function(d) { for (var a = "unchecked", c = !1, r = 0; r < w.length; r++) if (w[r].item == d) { c = !0; a = w[r].value; break; } c || (a = d[b.options.dataFields.checkState]); return a; }; this.updateListParentItemCheckValue = function(d) { for (d = b.getParent(d); d; ) { var a = d[b.options.dataFields.items]; if (a) { for (var c = 0, r = 0, e = 0; e < a.length; e++) { var f = b.getItemCheckValue(a[e]); "checked" == f ? c++ : "indeterminate" == f && r++; } e = { item: d }; e.value = c == a.length ? "checked" : 0 < c || 0 < r ? "indeterminate" : "unchecked"; w.push(e); } d = b.getParent(d); } }; this.updateListChildItemCheckValue = function(d) { if (d) { var a = d[b.options.dataFields.items]; if (a) for (var c = 0; c < a.length; c++) { var r = { item: a[c] }; "checked" == b.getItemCheckValue(d) ? (r.value = "checked") : (r.value = "unchecked"); w.push(r); b.updateListChildItemCheckValue(a[c]); } } }; this.updateParentItemCheckValue = function(d) { for (d = b.getParent(d); d; ) { var a = d[b.options.dataFields.items]; if (a) { for (var c = 0, r = 0, e = 0; e < a.length; e++) "checked" == a[e][b.options.dataFields.checkState] ? c++ : "indeterminate" == a[e][b.options.dataFields.checkState] && r++; d[b.options.dataFields.checkState] = c == a.length ? "checked" : 0 < c || 0 < r ? "indeterminate" : "unchecked"; } d = b.getParent(d); } }; this.updateItemCheckValue = function(d, a) { if ("checked" == a || "unchecked" == a) d[b.options.dataFields.checkState] = a; var h = d[b.options.dataFields.items]; if (h && 0 < h.length) for (var c = 0; c < h.length; c++) b.updateItemCheckValue(h[c], d[b.options.dataFields.checkState]); void 0 != d[b.options.dataFields.checkState] && (h = b.getParent(d)) && h[b.options.dataFields.checkState] != d[b.options.dataFields.checkState] && b.updateParentItemCheckValue(d); }; this.updateCheckValues = function(d) { if (1 == b.options.checkBoxSettings.threeState) { d = b.dataObj.getList(d); for (var a = 0; a < d.length; a++) b.updateItemCheckValue(d[a]); } }; c.$on(c.name + "-update-check", function(d, a) { b.updateCheckValues(a); }); c.$on(c.name + "-get-check-list", function(d, h) { b.updateCheckValues(); void 0 == h && (h = 1 == b.options.checkBoxSettings.threeState ? "checked" : !0); var c = 1 == b.options.checkBoxSettings.threeState ? b.options.dataFields.checkState : b.options.dataFields.checked, r = { operation: "=", value: h }; c = a.filter(b.getFullList(), c, r); m.setTempData(c); }); this.updateCheckBoxSettings = function(d) { b.options.checkBoxSettings = d ? { autoCheck: f.isFieldAvailable(d.autoCheck, !1), style: Ka(d.style), threeState: f.isFieldAvailable(d.threeState, !1) } : { autoCheck: !1, style: b.defaultCheckBoxStyle, threeState: !1 }; }; var C = function(d) { return d ? a.createTree(d.conditions, d.formula) : null; }, I = function(d) { if (0 == d[b.options.dataFields.visible]) return !1; var h = !0; if (d && b.filterParams) if ( ((h = (h = d[b.options.dataFields.value]) ? h : d[b.options.dataFields.text]), b.filterParams.callback) ) h = b.filterParams.callback(h, d); else if ( ((h = a.match( h, b.filterParams.conditions, b.filterParams.formula, C(b.filterParams), b.filterParams.caseSensitive )), !h && b.filterParams.allowParent && ((h = !1), (d = d[b.options.dataFields.items]))) ) for (var c = 0; c < d.length && !(h = I(d[c])); c++); return h; }, y = 0; b.currentList = []; b.indentList = []; b.parentList = []; b.longestItem = null; b.isThereChildItems = !1; b.currentTopList = []; b.currentBottomList = []; this.updateLongestItem = function() { b.longestItem = null; for (var d = (y = 0); d < b.currentList.length; d++) { var a = b.currentList[d]; if (a[b.options.dataFields.text]) { var c = a[b.options.dataFields.text].length; 0 < b.options.indent && (c += b.indentList[d] / b.options.indent); y < c && ((y = c), (b.longestItem = a)); } } }; var A = function(d, a, c, r, e) { d.type = "item"; d[b.options.dataFields.id] || (d[b.options.dataFields.id] = f.getUniqueId()); c && (d[b.options.dataFields.pid] = c); if ((c = I(d))) if (r) b.fullList.push(d); else { r = a; 0 != b.options.showStatusIcons && (r += 15); switch (d[b.options.dataFields.fixed]) { case "top": b.currentTopList.push(d); break; case "bottom": b.currentBottomList.push(d); break; default: b.currentList.push(d), b.indentList.push(r), b.parentList.push({ parent: e }); } d[b.options.dataFields.text] && ((e = d[b.options.dataFields.text].length), 0 < b.options.indent && (e += a / b.options.indent), 0 != b.options.showStatusIcons && (e += 15), y < e && ((y = e), (b.longestItem = d))); } return c; }; this.isThereVisibleChildren = function(d) { var a = !1; if (d && (d = d[b.options.dataFields.items])) for (var c = 0; c < d.length; c++) if (I(d[c]) && !b.isItemFixed(d[c])) { a = !0; break; } return a; }; this.isItemFixed = function(d) { return "top" == d[b.options.dataFields.fixed] || "bottom" == d[b.options.dataFields.fixed] ? !0 : !1; }; this.isThereChildItems = !1; var O = function(d, a, c, r, e) { if (!d[b.options.dataFields.items]) return (c = A(d, a, c, r, e)); if ((c = A(d, a, c, r, e)) && !b.isItemFixed(d)) { e = 0; var h; if ( r || b.isItemExpanded(d) || (b.isItemFixed(d) && d[b.options.dataFields.fixChildren]) ) { var u = d[b.options.dataFields.items]; if (u) { b.applySorting(u); for (var f = 0; f < u.length; f++) (h = O( u[f], a + b.options.indent, d[b.options.dataFields.id], r, d )) && e++; } } r || b.isThereChildItems || !( 0 < e || (!b.isItemExpanded(d) && d[b.options.dataFields.items] && 0 < d[b.options.dataFields.items].length && b.isThereVisibleChildren(d)) ) || (b.isThereChildItems = !0); } return c; }; b.fullList = []; this.getFullList = function(d) { b.fullList.length = 0; d = b.dataObj.getList(d); for (var a = 0; a < d.length; a++) O(d[a], 0, null, !0, null); return b.fullList; }; this.getCurrentList = function() { return b.currentList; }; this.updateCurrentList = function() { b.currentList.length = 0; b.indentList.length = 0; b.parentList.length = 0; b.longestItem = null; b.currentTopList.length = 0; b.currentBottomList.length = 0; b.isThereChildItems = !1; y = 0; var d = b.dataObj.getList(); if (d) { b.applySorting(d); for (var a = 0; a < d.length; a++) O(d[a], 0, null, !1); } }; this.dataEvents = { clear: function(d) { return angular.isDefined(c.events) && c.events.clear ? c.events.clear({ parent: d.e.parent }) : c.clear(d); }, objAdded: function(d) { return angular.isDefined(c.events) && c.events.itemAdded ? c.events.itemAdded({ item: d.e.item }) : c.itemAdded(d); }, objAdding: function(d) { return angular.isDefined(c.events) && c.events.itemAdding ? c.events.itemAdding({ item: d.e.item }) : c.itemAdding(d); }, objRemoved: function(d) { return angular.isDefined(c.events) && c.events.itemRemoved ? c.events.itemRemoved({ item: d.e.item }) : c.itemRemoved(d); }, objRemoving: function(d) { return angular.isDefined(c.events) && c.events.itemRemoving ? c.events.itemRemoving({ item: d.e.item }) : c.itemRemoving(d); } }; this.getDataFields = function(d) { return { content: d.content ? d.content : "content", icon: d.icon ? d.icon : "icon", id: d.id ? d.id : "id", pid: d.pid ? d.pid : "pid", objects: d.items ? d.items : "items", statusIcon: d.statusIcon ? d.statusIcon : "statusIcon", text: d.text ? d.text : "text" }; }; b.dataObj = new k({ objects: c.items, events: b.dataEvents, fields: b.getDataFields(b.options.dataFields) }); c.$on(c.name + "-load-data", function(d, a, c, r, e) { m.setTempData(b.loadData(a, c, r, e)); }); c.$on(c.name + "-export-json", function(d, a, c, r) { m.setTempData(b.exportToJSON(a, c, r)); }); this.exportToJSON = function(d, a, c) { c = c ? c : null; var h = !1 !== a ? b.getFullList() : b.dataObj.getList(); d = d ? d : [ b.options.dataFields.allowDrag, b.options.dataFields.allowDrop, b.options.dataFields.allowEdit, b.options.dataFields.allowFocus, b.options.dataFields.autoCheck, b.options.dataFields.checkBoxSettings, b.options.dataFields.checked, b.options.dataFields.checkState, b.options.dataFields.content, b.options.dataFields.contextMenu, b.options.dataFields.enabled, b.options.dataFields.expanded, b.options.dataFields.fixed, b.options.dataFields.fixChildren, b.options.dataFields.hasChildren, b.options.dataFields.icon, b.options.dataFields.id, b.options.dataFields.pid, b.options.dataFields.selected, b.options.dataFields.showCheckBox, b.options.dataFields.statusIcon, b.options.dataFields.style, b.options.dataFields.templateObj, b.options.dataFields.text, b.options.dataFields.tooltip, b.options.dataFields.value, b.options.dataFields.visible ]; !1 === a && d.push(b.options.dataFields.items); return JSON.stringify(h, d, c); }; this.loadData = function(d, a, u, r) { var h = n.defer(); b.suspendLayout(); b.allowEvents = !1; b.updateDataFields(u); var f = [], l = b.options.dataFields; b.dataObj.clear(a, b.listIsCleared); if (d) if (r) { var m = []; d.forEach(function(d, a) { d[l.items] = []; var b = d[l.pid]; m[b] ? (m[b][l.items] || (m[b][l.items] = []), (m[d[l.id]] = d), m[b][l.items].push(d)) : ((m[d[l.id]] = d), f.push(d)); }); m.length = 0; } else f = d; if (a) for ( a[b.options.dataFields.items] = f, d = 0; d < a[b.options.dataFields.items].length; d++ ) a[b.options.dataFields.items][d][b.options.dataFields.pid] = a[b.options.dataFields.id]; else if (angular.isDefined(c.items)) for (d = c.items.length = 0; d < f.length; d++) c.items.push(f[d]); b.dataObj = new k({ objects: c.items, events: b.dataEvents, fields: b.getDataFields(b.options.dataFields) }); var q = e(function() { b.getTemplateUrl(); b.resumeLayout(); b.allowEvents = !0; var d = e(function() { h.resolve(); e.cancel(d); }, 125); e.cancel(q); }, 100); return h.promise; }; this.updateData = function() { b.options.dataFields.dataSource && (b.loadData(b.options.dataFields.dataSource), (b.dataObj = new k({ objects: c.items, events: b.dataEvents, fields: b.getDataFields(b.options.dataFields) }))); }; var Y = !1; this.dragDropStatus = function(d) { if (void 0 != d) Y = d; else return Y; }; this.getDnDSource = function(d) { return { text: d.dataTransfer ? d.dataTransfer.getData("text") : d.originalEvent.dataTransfer ? d.originalEvent.dataTransfer.getData("text") : "" }; }; this.getTouchData = function(d) { return d.changedTouches ? d.changedTouches : d.originalEvent ? d.originalEvent.changedTouches : null; }; var ea = angular.element( '
' ); this.getDropMarkLine = function() { return dropMarkLine; }; b.getMousePos = function(d) { return { x: d.pageX ? d.pageX : d.originalEvent ? d.originalEvent.pageX : 0, y: d.pageY ? d.pageY : d.originalEvent ? d.originalEvent.pageY : 0 }; }; this.getCtrlName = function() { return angular.isDefined(c.name) ? c.name : ""; }; q.bind("dragenter", function(d) { d.preventDefault(); if (b.options.enabled) { var a = U.getData(); a.source || (a.source = b.getDnDSource(d)); d = { event: d, sourceTree: a.sourceCtrl ? a.sourceCtrl.getCtrlName() : "", dragItem: a.source, targetTree: b.getCtrlName(), targetItem: a.target, mousePos: b.getMousePos(d) }; b.callDragEnter(d); } }); this.isItemDragOverHandled = !1; q.bind("dragover", function(d) { if (!b.options.autoSize || !b.isItemDragOverHandled) { d.preventDefault(); var a = !0; d.dataTransfer ? (a = "none" === d.dataTransfer.effectAllowed ? !1 : !0) : d.originalEvent && d.originalEvent.dataTransfer && (a = "none" === d.originalEvent.dataTransfer.effectAllowed ? !1 : !0); if (b.options.enabled && a) if ( (d.dataTransfer ? (d.dataTransfer.dropEffect = b.options.allowDrop ? "move" : "none") : d.originalEvent && d.originalEvent.dataTransfer && (d.originalEvent.dataTransfer.dropEffect = b.options.allowDrop ? "move" : "none"), (a = U.getData()), a.source || (a.source = b.getDnDSource(d)), U.setData({ source: a.source, sourceCtrl: a.sourceCtrl, target: null, dropPos: -1 }), (a = { event: d, sourceTree: a.sourceCtrl ? a.sourceCtrl.getCtrlName() : "", dragItem: a.source, targetTree: b.getCtrlName(), targetItem: null, isDropAllowed: b.options.allowDrop, dropPos: -1, mousePos: b.getMousePos(d) }), 0 == b.callDragOver(a)) ) d.dataTransfer ? (d.dataTransfer.dropEffect = "none") : d.originalEvent && d.originalEvent.dataTransfer && (d.originalEvent.dataTransfer.dropEffect = "none"), b.dropMark(); else { a = b.getMousePos(d); d = a.y + 16; a = a.x + 20; var u = b.getDropMarkWindow(); u.empty(); u.append( "" + (c.name ? c.name : "TreeView") + "" ); b.updateDropMarkElem(b.getDropMarkWindow(), { top: d, left: a }); b.dropMark(!0); } } }); q.bind("drop", function(d) { d.preventDefault(); b.dropMark(); var a = !0; d.dataTransfer ? (a = "none" === d.dataTransfer.effectAllowed ? !1 : !0) : d.originalEvent && d.originalEvent.dataTransfer && (a = "none" === d.originalEvent.dataTransfer.effectAllowed ? !1 : !0); if ( b.options.enabled && a && ((a = U.getData()), a.source || (a.source = b.getDnDSource(d)), a.source) ) { var u = { event: d, sourceTree: a.sourceCtrl ? a.sourceCtrl.getCtrlName() : "", dragItem: a.source, targetTree: b.getCtrlName(), targetItem: null, isDropAllowed: b.options.allowDrop, dropPos: -1, mousePos: b.getMousePos(d) }; !1 !== b.callDragDrop(u) && (b.drop(a), c.$$phase || c.$apply()); } U.clearData(); d.stopPropagation(); }); q.bind("dragleave", function(d) { d.preventDefault(); if (b.options.enabled) { b.dropMark(); var a = U.getData(); a.source || (a.source = b.getDnDSource(d)); d = { event: d, sourceTree: a.sourceCtrl ? a.sourceCtrl.getCtrlName() : "", dragItem: a.source, targetTree: b.getCtrlName(), targetItem: a.target, mousePos: b.getMousePos(d) }; b.callDragLeave(d); b.cancelScrollTimer(); } }); q.bind("dragend", function(d) { d.preventDefault(); b.options.enabled && (b.dropMark(), U.getData().source || U.clearData(), b.dragDropStatus(!1)); }); q.bind("mouseleave", function(d) { d.preventDefault(); b.dropMark(); b.hoverItem = null; }); this.containsMousePos = function(d, a) { return U.hitTest(d, a, { left: 0, top: 0, right: q[0].clientWidth, bottom: q[0].clientHeight }); }; this.isPopupActive = function() { return !1; }; var fa = function(d, a) { var c = b.options.dataFields; d[c.items] || (d[c.items] = []); d[c.items].length = 0; if (d[a.rows] && 0 < d[a.rows].length) for (var h = 0; h < d[a.rows].length; h++) d[c.items].push(fa(d[a.rows][h], a)); return d; }, B = function(d, a) { var c = !1; a.sourceCtrl && (c = a.sourceCollection.removeAt( d, -1, null, a.sourceCtrl.objIsRemoved )); c && ("row" == d.type && (d = fa(d, a.sourceCtrl.options.rowFields)), 0 === a.dropPos ? b.dataObj.insertAt(d, -1, a.target, b.itemIsAdded) : 1 === a.dropPos || 2 === a.dropPos ? 1 === a.dropPos ? b.dataObj.insertByRef(d, a.target, !1, b.itemIsAdded) : b.dataObj.insertByRef(d, a.target, !0, b.itemIsAdded) : b.dataObj.insertAt(d, -1, null, b.itemIsAdded)); }; this.setDropSelection = function(a, c) { var d = a; !d && 0 <= c && c < b.currentList.length && (d = b.currentList[c]); b.clearPrevSelection(d); b.itemSelection(null, d); }; this.drop = function(a) { if (a && a.sourceCtrl) { a.sourceCtrl.suppressProcess = !0; a.sourceCtrl.suspendLayout(); b.suspendLayout(); var d = a.source; if (Array.isArray(a.source)) { for (var u = [], r = 0; r < a.source.length; r++) { for ( var f = !1, k = a.sourceCollection.getParent(a.source[r]); k; ) { if (a.sourceCtrl.isObjInSelList(k)) { f = !0; break; } k = a.sourceCollection.getParent(k); } f || u.push(a.source[r]); } if (0 < u.length) if ( ((d = u[u.length - 1]), (r = a.sourceCtrl.getObjCurrentIndex(u[0])), (f = a.sourceCtrl.getObjCurrentIndex(d)), r <= f) ) for (r = 0; r < u.length; r++) B(u[r], a); else for (r = u.length - 1; 0 <= r; r--) B(u[r], a); } else B(a.source, a); a.sourceCtrl !== b ? ((b.allowUpdate = !0), (a.sourceCtrl.allowUpdate = !0), b.updateCurrentLayout(), a.sourceCtrl.updateCurrentLayout()) : ((b.allowUpdate = !0), b.updateCurrentLayout()); b.updateAutoLayout(); a.sourceCtrl.multiSelection(!1); var l = e(function() { if (d) { a.sourceCtrl.clearPrevSelection(d); b.itemSelection(null, d); var h = b.getElemFromItem(d); h && (h = b.getElement(h)) && h[0].focus(); c.$apply(); e.cancel(l); } }, 1); a.sourceCtrl.suppressProcess = !1; } }; this.isDragAllowed = function(a) { return b.options.allowDrag ? a && (a[b.options.dataFields.allowDrag] || void 0 === a[b.options.dataFields.allowDrag]) ? !0 : !1 : !1; }; this.isChildOf = function(a, c) { var d = !1; if (a && c) { var h = c[b.options.dataFields.items]; if (h && 0 < h.length) for (var e = 0; e < h.length; e++) { if ( f.isEqual( a[b.options.dataFields.id], h[e][b.options.dataFields.id] ) ) { d = !0; break; } else d = b.isChildOf(a, h[e]); if (d) break; } } return d; }; this.isParentOf = function(a, c) { var d = b.dataObj.getParent(c); return a && c && d && f.isEqual(a[b.options.dataFields.id], d[b.options.dataFields.id]) ? !0 : !1; }; this.isDropAllowed = function(a, c, u) { var d = b.options.allowDrop; if ( d && a && c && (d = b.isItemFixed(c) || (!c[b.options.dataFields.allowDrop] && void 0 !== c[b.options.dataFields.allowDrop]) ? !1 : !0) ) if (Array.isArray(a)) for (var h = 0; h < a.length; h++) { if ( f.isEqual( a[h][b.options.dataFields.id], c[b.options.dataFields.id] ) || (0 === u && b.isParentOf(c, a[h])) || b.isChildOf(c, a[h]) ) { d = !1; break; } if (!d) break; } else if ( f.isEqual(a[b.options.dataFields.id], c[b.options.dataFields.id]) || (0 === u && b.isParentOf(c, a)) || b.isChildOf(c, a) ) d = !1; return d; }; this.getDropMarkWindow = function() { for ( var a = ea, b = angular.element(document.body).children(), c = 0; c < b.length; c++ ) { var e = angular.element(b[c]); if ( e[0].attributes && e[0].attributes["data-element"] && "dropmark" === e[0].attributes["data-element"].value ) { a = e; break; } } return a; }; this.dropMark = function(a, c) { c || (c = b.getDropMarkWindow()); if (c) { var d = "none"; this.options.allowDrop && (d = a ? "block" : "none"); angular.element(c).css("display", d); } }; this.updateDropMarkElem = function(a, b) { a && b && (a.css("top", b.top + "px"), a.css("left", b.left + "px"), a.css("width", b.width + "px")); }; var $a = !1, Z = angular.element(''); this.labelEditStatus = function(a) { if (void 0 != a) $a = a; else return $a; }; this.getEditBox = function() { return Z; }; this.updateEditBox = function(a) { Z && a && (Z.css("top", a.top + "px"), Z.css("left", a.left + "px"), Z.css("width", a.width + "px"), Z.css("height", a.height + "px")); }; c.$on(c.name + "-open-editor", function(a, c) { b.openEditor(c); }); c.$on(c.name + "-close-editor", function(a, c) { b.closeEditor(c); }); this.updateEditorSettings = function(a) { b.options.editorSettings = a ? { activate: f.isFieldAvailable(a.activate, "click") } : { activate: "click" }; }; this.allowEvents = !0; this.callAfterCollapse = function(a) { angular.isDefined(c.events) && c.events.afterCollapse && c.events.afterCollapse({ item: a }); c.afterCollapse({ e: { item: a } }); }; this.callAfterExpand = function(a) { angular.isDefined(c.events) && c.events.afterExpand && c.events.afterExpand({ item: a }); c.afterExpand({ e: { item: a } }); }; this.callAfterEdit = function(a) { angular.isDefined(c.events) && c.events.afterEdit && c.events.afterEdit({ item: a }); c.afterEdit({ e: { item: a } }); }; this.callAfterLabelEdit = function(a) { angular.isDefined(c.events) && c.events.afterLabelEdit && c.events.afterLabelEdit({ item: a }); c.afterLabelEdit({ e: { item: a } }); }; this.callAfterSelect = function(a) { angular.isDefined(c.events) && c.events.afterSelect ? c.events.afterSelect({ item: a }) : c.afterSelect({ e: { item: a } }); angular.isDefined(c.events) && c.events.selectionChanged ? c.events.selectionChanged({ item: a }) : c.selectionChanged({ e: { item: a } }); }; this.callBeforeCollapse = function(a) { return angular.isDefined(c.events) && c.events.beforeCollapse ? c.events.beforeCollapse({ item: a }) : c.beforeCollapse({ e: { item: a } }); }; this.callBeforeExpand = function(a) { return angular.isDefined(c.events) && c.events.beforeExpand ? c.events.beforeExpand({ item: a }) : c.beforeExpand({ e: { item: a } }); }; this.callBeforeEdit = function(a) { return angular.isDefined(c.events) && c.events.beforeEdit ? c.events.beforeEdit({ item: a }) : c.beforeEdit({ e: { item: a } }); }; this.callBeforeLabelEdit = function(a) { return angular.isDefined(c.events) && c.events.beforeLabelEdit ? c.events.beforeLabelEdit({ item: a }) : c.beforeLabelEdit({ e: { item: a } }); }; this.callChange = function() { angular.isDefined(c.events) && c.events.change ? c.events.change() : c.change(); }; this.callDragEnter = function(a) { angular.isDefined(c.events) && c.events.dragEnter ? c.events.dragEnter({ event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, mousePos: a.mousePos }) : c.dragEnter({ e: { event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, mousePos: a.mousePos } }); }; this.callDragOver = function(a) { return angular.isDefined(c.events) && c.events.dragOver ? c.events.dragOver({ event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, isDropAllowed: a.isDropAllowed, dropPos: a.dropPos, mousePos: a.mousePos }) : c.dragOver({ e: { event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, isDropAllowed: a.isDropAllowed, dropPos: a.dropPos, mousePos: a.mousePos } }); }; this.callDragDrop = function(a) { return angular.isDefined(c.events) && c.events.dragDrop ? c.events.dragDrop({ event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, isDropAllowed: a.isDropAllowed, dropPos: a.dropPos, mousePos: a.mousePos }) : c.dragDrop({ e: { event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, isDropAllowed: a.isDropAllowed, dropPos: a.dropPos, mousePos: a.mousePos } }); }; this.callDragLeave = function(a) { angular.isDefined(c.events) && c.events.dragLeave ? c.events.dragLeave({ event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, mousePos: a.mousePos }) : c.dragLeave({ e: { event: a.event, sourceTree: a.sourceTree, dragItem: a.dragItem, targetTree: a.targetTree, targetItem: a.targetItem, mousePos: a.mousePos } }); }; this.callEnabledChanged = function(a) { angular.isDefined(c.events) && c.events.enabledChanged ? c.events.enabledChanged({ enabled: a }) : c.enabledChanged({ e: { enabled: a } }); }; this.callItemClick = function(a, b, u) { angular.isDefined(c.events) && c.events.itemClick && c.events.itemClick({ event: a, item: b, mousePos: u }); c.itemClick({ e: { event: a, item: b, mousePos: u } }); }; this.callItemDblClick = function(a, b) { return angular.isDefined(c.events) && c.events.itemDblClick ? c.events.itemDblClick({ item: a, mousePos: b }) : c.itemDblclick({ e: { item: a, mousePos: b } }); }; this.callItemHover = function(a) { angular.isDefined(c.events) && c.events.itemHover ? c.events.itemHover({ item: a }) : c.itemHover({ e: { item: a } }); }; this.callItemRightClick = function(a, b) { angular.isDefined(c.events) && c.events.itemRightClick && c.events.itemRightClick({ item: a, mousePos: b }); c.itemRightclick({ e: { item: a, mousePos: b } }); }; this.callKeyDown = function(a, b) { return angular.isDefined(c.events) && c.events.keyDown ? c.events.keyDown({ event: a, item: b }) : c.keyDown({ e: { event: a, item: b } }); }; this.callKeyPress = function(a, b) { angular.isDefined(c.events) && c.events.keyPress ? c.events.keyPress({ event: a, item: b }) : c.keyPress({ e: { event: a, item: b } }); }; this.callKeyUp = function(a, b) { angular.isDefined(c.events) && c.events.keyUp ? c.events.keyUp({ event: a, item: b }) : c.keyUp({ e: { event: a, item: b } }); }; this.callScrollPosChanged = function() { angular.isDefined(c.events) && c.events.scrollPosChanged ? c.events.scrollPosChanged({ scrollPos: b.scrollPos }) : c.scrollposChanged({ e: { scrollPos: b.scrollPos } }); }; q.bind("click", function(a) { b.options.enabled && 1 === a.which && b.callItemClick(a, null, b.getMousePos(a)); }); q.bind("dblclick", function(a) { a.preventDefault(); b.options.enabled && 1 === a.which && b.callItemDblClick(null, b.getMousePos(a)); a.stopPropagation(); }); q.bind("mousedown", function(a) { b.options.enabled && 3 === a.which && b.callItemRightClick(null, b.getMousePos(a)); a.stopPropagation(); }); this.expandList = []; this.expandIndentList = []; this.expandParentList = []; var za = function(a, c, u, e) { a.type = "item"; a[b.options.dataFields.id] || (a[b.options.dataFields.id] = f.getUniqueId()); u && (a[b.options.dataFields.pid] = u); u = I(a); b.isItemExpanded(a) && a[b.options.dataFields.items] && 0 < a[b.options.dataFields.items].length && (u = u && b.isThereVisibleChildren(a)); u && (0 != b.options.showStatusIcons && (c += 15), b.expandList.push(a), b.expandIndentList.push(c), b.expandParentList.push({ parent: e })); return u; }, La = function(a, c, u, e) { if (!a[b.options.dataFields.items]) return (u = za(a, c + b.options.indent, u, e)); if ((u = za(a, c + b.options.indent, u, e))) { e = 0; var d; if (b.isItemExpanded(a)) { var h = a[b.options.dataFields.items]; if (h) { b.applySorting(h); for (var r = 0; r < h.length; r++) (d = La( h[r], c + b.options.indent, a[b.options.dataFields.id], a )) && e++; } } !b.isThereChildItems && (0 < e || (!b.isItemExpanded(a) && a[b.options.dataFields.items] && 0 < a[b.options.dataFields.items].length && b.isThereVisibleChildren(a))) && (b.isThereChildItems = !0); } return u; }; this.expand = function(a) { var d = b.getItemFromChildElem(document.activeElement); b.expandList.length = []; b.expandIndentList.length = []; b.expandParentList.length = []; if (!b.isItemExpanded(a)) { var c = b.getItemCurrentIndex(a), r = b.getList(a); if (r) { b.applySorting(r); for (var f = 0; f < r.length; f++) b.isItemFixed(r[f]) || La(r[f], b.indentList[c], null, a); } if (0 < b.expandList.length) { b.allowEvents = !1; c++; Array.prototype.splice.apply( b.currentList, [c, 0].concat(b.expandList) ); Array.prototype.splice.apply( b.indentList, [c, 0].concat(b.expandIndentList) ); Array.prototype.splice.apply( b.parentList, [c, 0].concat(b.expandParentList) ); b.options.autoSize ? b.updateAutoLayout() : b.getItemScope() ? b.updateView() : b.updateLayout(); var k = e(function() { b.updateViewSize(); b.updateViewSize(); b.updateScrollView(); d && b.updateFocus(d); b.allowEvents = !0; e.cancel(k); }, 1); } } }; this.collapse = function(a) { var d = b.getItemFromChildElem(document.activeElement); b.expandList.length = []; b.expandIndentList.length = []; if (b.isItemExpanded(a)) { var c = null, r = !1, f = a, k = -1, l = b.getItemCurrentIndex(a); for (a = b.getParent(a); a && !r; ) { c = b.getList(a); for (k = c.indexOf(f) + 1; !r && k < c.length; ) (f = c[k]), 0 < b.getItemCurrentIndex(f) && (r = !0), k++; r || (f = a); a = b.getParent(a); } if (!r && f) for (c = b.getList(), k = c.indexOf(f) + 1; k < c.length; ) if (((f = c[k]), 0 < b.getItemCurrentIndex(f))) { r = !0; break; } else k++; l++; c = b.currentList.length - l; r && (c = b.getItemCurrentIndex(f) - l); if (0 < c) { b.currentList.splice(l, c); b.indentList.splice(l, c); b.parentList.splice(l, c); b.options.autoSize ? b.updateAutoLayout() : b.getItemScope() ? b.updateView() : b.updateLayout(); var m = e(function() { b.updateViewSize(); b.updateViewSize(); b.updateScrollView(); d && b.updateFocus(d); b.allowEvents = !0; e.cancel(m); }, 1); } } }; this.toggle = function(a, c) { if (a) { if ( (a[b.options.dataFields.hasChildren] || (a[b.options.dataFields.items] && 0 !== a[b.options.dataFields.items].length)) && !( (c && !1 !== a[b.options.dataFields.expanded]) || (!1 === c && !1 === a[b.options.dataFields.expanded]) ) ) { var d = void 0 !== c ? c : !1 !== a[b.options.dataFields.expanded] ? !0 : !1; !1 !== (void 0 !== c ? c ? b.callBeforeExpand(a) : b.callBeforeCollapse(a) : d ? b.callBeforeCollapse(a) : b.callBeforeExpand(a)) && ((d = void 0 != c ? c : !d), d != a[b.options.dataFields.expanded] && (0 != d ? b.expand(a) : b.collapse(a), (a[b.options.dataFields.expanded] = d)), b.isItemExpanded(a) ? b.callAfterExpand(a) : b.callAfterCollapse(a)); } } else { d = b.getFullList(); for (var h = 0; h < d.length; h++) d[h][b.options.dataFields.expanded] = c; b.updateCurrentLayout(); } }; c.$on(c.name + "-collapse", function(a, c) { b.toggle(c, !1); }); c.$on(c.name + "-expand", function(a, c) { b.toggle(c, !0); }); c.$on(c.name + "-toggle", function(a, c) { b.toggle(c); }); this.filterParams = null; c.$on(c.name + "-filter", function(a, c) { b.filter(c); }); this.filter = function(a) { b.filterParams = a; b.updateCurrentLayout(); b.callChange(); }; this.callGotFocus = function(a, b, e, f) { angular.isDefined(c.events) && c.events.gotFocus ? c.events.gotFocus({ event: a, item: b, edit: void 0 != e ? !0 : !1, editValue: f }) : c.gotFocus({ e: { event: a, item: b, edit: void 0 != e ? !0 : !1, editValue: f } }); }; this.callLostFocus = function(a, b, e, f) { angular.isDefined(c.events) && c.events.lostFocus ? c.events.lostFocus({ event: a, item: b, edit: void 0 != e ? !0 : !1, editValue: f }) : c.lostFocus({ e: { event: a, item: b, edit: void 0 != e ? !0 : !1, editValue: f } }); }; this.getTabIndex = function() { return q[0].attributes && q[0].attributes.tabindex ? q[0].attributes.tabindex.value : ""; }; this.updateFocus = function(a) { if (1 == b.options.allowFocus) var d = e(function() { if (a && !b.isItemFixed(a)) { var c = b.getElemFromItem(a); c && (c = b.getElement(c)) && c[0].focus(); } else q[0].focus(); e.cancel(d); }, 5); }; c.$on(c.name + "-focus", function(a, c) { b.updateFocus(c); }); var qa = !1; this.isItemExpanded = function(a) { return a ? a[b.options.dataFields.expanded] || void 0 === a[b.options.dataFields.expanded] ? !0 : !1 : !0; }; this.getElement = function(a, b) { var d = null; b || (b = "content"); if (a) for (var c = a.children(), h = 0; h < c.length; h++) { var e = angular.element(c.eq(h)); if ( e[0].attributes && e[0].attributes["data-element"] && e[0].attributes["data-element"].value === b ) { d = e; break; } } return d; }; this.getIndent = function(a) { var d = 0; if (a && 0 < b.options.indent) for (parent = b.dataObj.getParent(a); parent; ) (d += b.options.indent), (parent = b.dataObj.getParent(parent)); return d; }; this.getItemCurrentIndex = function(a) { if (a) { switch (a[b.options.dataFields.fixed]) { case "top": return b.currentTopList ? b.currentTopList.indexOf(a) : -1; case "bottom": return b.currentBottomList ? b.currentBottomList.indexOf(a) : -1; } return b.currentList ? b.currentList.indexOf(a) : -1; } return -1; }; this.getObjCurrentIndex = function(a) { return b.getItemCurrentIndex(a); }; this.getObjState = function(a) { if (a) switch (a.type) { case "item": if ( 0 == b.options.enabled || 0 == a[b.options.dataFields.enabled] ) return "disabled"; if (1 == a[b.options.dataFields.selected] && b.isObjInSelList(a)) return "selected"; if (a == b.hoverItem) return "hovered"; } return "normal"; }; this.getItemFromChildElem = function(a) { return a ? (a = angular.element(a)) ? b.getItemFromElem(a[0].parentElement) : null : null; }; this.getItemFromElem = function(a) { if (a && (a = angular.element(a)) && a[0].attributes["data-index"]) { var d = a[0].attributes["data-index"].value, c = "none"; a[0].attributes["data-fixed"] && (c = a[0].attributes["data-fixed"].value); switch (c) { case "top": if (0 <= d && d < b.currentTopList.length) return b.currentTopList[d]; break; case "bottom": if (0 <= d && d < b.currentBottomList.length) return b.currentBottomList[d]; break; default: if (b.isIndexInRange(d)) return b.currentList[d]; } } }; this.isIndexInRange = function(a) { return 0 <= a && a < b.currentList.length; }; this.isItemEnabled = function(a) { return ( a && 1 == b.options.enabled && f.isEnabled(a[b.options.dataFields.enabled]) ); }; this.mouseButtonStatus = function(a) { qa = a; }; c.$on(c.name + "-ensure-visible", function(a, c, e) { b.ensureVisible(c, e); }); c.$on(c.name + "-find-item-by-id", function(a, c) { m.setTempData(b.findItemById(c)); }); c.$on(c.name + "-find-item-by-text", function(a, c) { m.setTempData(b.findItemByText(c)); }); c.$on(c.name + "-get-full-path", function(a, c) { m.setTempData(b.getFullPath(c)); }); c.$on(c.name + "-get-item-level", function(a, c) { m.setTempData(b.getLevel(c)); }); c.$on(c.name + "-get-item-parent", function(a, c) { m.setTempData(b.getParent(c)); }); c.$on(c.name + "-get-item-at", function(a, c) { c ? m.setTempData(b.getItemAt(c.x, c.y)) : m.setTempData(null); }); c.$on(c.name + "-get-flat-list", function(a, c) { c ? m.setTempData(b.getFullList()) : m.setTempData(b.currentList); }); c.$on(c.name + "-get-list", function(a, c, e) { 1 == e ? m.setTempData(b.getFullList(c)) : m.setTempData(b.getList(c)); }); this.ensureVisible = function(a, c) { if (a) { for (var d = [], h = b.getParent(a); h; ) d.push(h), (h = b.getParent(h)); for (h = d.length - 1; 0 <= h; h--) d[h][b.options.dataFields.expanded] = !0; b.updateCurrentLayout(); var f = e(function() { c = void 0 != c ? c : "center"; b.scrollTo(a, c); e.cancel(f); }, 100); } }; this.findItemById = function(a) { return b.dataObj.findObjectById(a); }; this.findItemByText = function(a) { return b.dataObj.findObjectByText(a); }; this.getFullPath = function(a) { var d = ""; if (a) for (d = a[b.options.dataFields.text], a = b.getParent(a); a; ) (d = [ a[b.options.dataFields.text], b.options.pathSeparator, d ].join("")), (a = b.getParent(a)); return d; }; this.getLevel = function(a) { var b = 0; for (a = this.getParent(a); a; ) b++, (a = this.getParent(a)); return b; }; this.getParent = function(a) { return b.dataObj.getParent(a); }; this.getList = function(a) { return b.dataObj.getList(a); }; this.getFirstItem = function() { for (var a = null, c = 0; c < b.currentList.length; c++) if (b.isItemEnabled(b.currentList[c])) { a = b.currentList[c]; break; } return a; }; this.getPrevItem = function(a) { var d = null; if (0 <= a && a < b.currentList.length) for (--a; 0 <= a; a--) if (b.isItemEnabled(b.currentList[a])) { d = b.currentList[a]; break; } return d; }; this.getNextItem = function(a) { var d = null; for (a += 1; a < b.currentList.length; a++) if (b.isItemEnabled(b.currentList[a])) { d = b.currentList[a]; break; } return d; }; this.getLastItem = function() { for (var a = null, c = b.currentList.length - 1; 0 <= c; c--) if (b.isItemEnabled(b.currentList[c])) { a = b.currentList[c]; break; } return a; }; this.updateSelectionStatus = function(a) { switch (a) { case "shift": switch (b.options.selectionMode) { case "multi-simple": b.multiSelection(!0); b.shiftKeyStatus(!1); break; case "multi-extended": b.multiSelection(!0); b.shiftKeyStatus(!0); break; default: b.multiSelection(!1), b.shiftKeyStatus(!1); } break; case "ctrl": switch (b.options.selectionMode) { case "multi-simple": b.multiSelection(!0); break; case "multi-extended": b.multiSelection(!0); break; default: b.multiSelection(!1); } } }; q.bind("keydown", function(a) { if (b.options.enabled) switch (a.keyCode) { case 16: b.updateSelectionStatus("shift"); break; case 17: b.updateSelectionStatus("ctrl"); break; default: (a.ctrlKey || a.metaKey) && b.updateSelectionStatus("ctrl"), a.shiftKey && b.updateSelectionStatus("shift"); } }); b.allowUpdate = !0; this.suspendLayout = function() { b.allowUpdate = !1; }; this.resumeLayout = function() { b.allowUpdate = !0; b.updateLayout(); }; c.$on(c.name + "-refresh", function(a, c, e) { b.refresh(c, e); }); c.$on(c.name + "-resume-layout", function(a) { b.resumeLayout(); }); c.$on(c.name + "-suspend-layout", function(a) { b.suspendLayout(); }); c.$on(c.name + "-update-layout", function(a) { b.updateLayout(); }); c.$on(c.name + "-update-view", function(a) { b.updateView(); }); c.$on(c.name + "-begin-load", function(a, c, e) { c ? (0 > b.options.loadItems.indexOf(c) && b.options.loadItems.push(c), b.updateView()) : b.beginLoad(e); }); c.$on(c.name + "-end-load", function(a, c) { b.endLoad(c); }); this.callLoadComplete = function() { angular.isDefined(c.events) && c.events.loadComplete ? c.events.loadComplete() : c.loadComplete(); }; this.callUpdateComplete = function() { angular.isDefined(c.events) && c.events.updateComplete ? c.events.updateComplete() : c.updateComplete(); }; c.$on(c.name + "-get-scroll-pos", function(a) { m.setTempData(b.getScrollPos()); }); c.$on(c.name + "-set-scroll-pos", function(a, c) { b.setScrollPos(c); }); c.$on(c.name + "-scroll-to", function(a, c, e) { b.scrollTo(c, e); }); var D = !1, V = !1; this.shiftKeyStatus = function(a) { if (void 0 != a) D = a; else return D; }; this.multiSelection = function(a) { if (void 0 != a) V = a; else return V; }; this.isItemSelected = function(a) { return f.isSelected(a); }; this.clearPrevSelection = function(a) { for (var d = 0; d < b.options.selectedItems.length; d++) a && !f.isEqual( b.options.selectedItems[d][b.options.dataFields.id], a[b.options.dataFields.id] ) ? (b.options.selectedItems[d][b.options.dataFields.selected] = !1) : a || (b.options.selectedItems[d][b.options.dataFields.selected] = !1); b.options.selectedItems.length = 0; a && b.isItemEnabled(a) && b.options.selectedItems.push(a); b.refresh(); }; this.selectionCancelled = !1; this.shiftFirstSelectedItem = null; this.itemSelection = function(a, h, e) { if (h) { if ("none" !== b.options.selectionMode) if (b.isItemEnabled(h)) { var d = b.itemSelection(), u = !0; d && (u = !f.isEqual( d[b.options.dataFields.id], h[b.options.dataFields.id] ) || (a && (a.ctrlKey || a.metaKey))); var k = !0; k = angular.isDefined(c.events) && c.events.beforeSelect ? c.events.beforeSelect({ item: h }) : c.beforeSelect({ e: { item: h } }); b.selectionCancelled = 0 == k; if (0 != k) if (u) { var l = a && (a.shiftKey || a.ctrlKey || a.metaKey) ? !0 : !1; u = !0; "multi-extended" === b.options.selectionMode && (u = !b.isObjInSelList(h) || !l || D || (a && a.shiftKey)); u && ("one" == b.options.selectionMode ? b.clearPrevSelection() : qa && (D || (a && a.shiftKey)) ? b.clearPrevSelection() : V || l || "multi-simple" === b.options.selectionMode || l || (1 != b.options.selectedItems.length && b.isObjInSelList(h)) || b.clearPrevSelection()); b.options.selectedItem = h; if ( qa && (D || (a && a.shiftKey)) && "one" != b.options.selectionMode ) { if ( (b.shiftFirstSelectedItem || (b.shiftFirstSelectedItem = d), (a = b.getItemCurrentIndex(b.shiftFirstSelectedItem)), (e = b.getItemCurrentIndex(h)), a > e && ((d = a), (a = e), (e = d)), b.isIndexInRange(a) && b.isIndexInRange(e)) ) for (; a <= e; a++) (b.currentList[a][b.options.dataFields.selected] = !0), b.options.selectedItems.push(b.currentList[a]); } else qa && (V || l || "multi-simple" === b.options.selectionMode) ? ((a = null === h[b.options.dataFields.selected] || "undefined" === h[b.options.dataFields.selected] ? !1 : h[b.options.dataFields.selected]), (h[b.options.dataFields.selected] = !a), h[b.options.dataFields.selected] ? b.isObjInSelList(h) || b.options.selectedItems.push(h) : (b.options.selectedItems = b.options.selectedItems.filter( function(a) { return a != h; } ))) : ((h[b.options.dataFields.selected] = !0), b.isObjInSelList(h) || b.options.selectedItems.push(h)), (b.shiftFirstSelectedItem = null); angular.isDefined(c.selectedItem) && (c.selectedItem = h); b.callAfterSelect(h); b.refresh(null, null, !0); } else V || l || "multi-simple" === b.options.selectionMode ? ((a = null === h[b.options.dataFields.selected] || "undefined" === h[b.options.dataFields.selected] ? !1 : h[b.options.dataFields.selected]), e && "undefined" !== e && (a = e), (h[b.options.dataFields.selected] = !a), h[b.options.dataFields.selected] ? b.isObjInSelList(h) || b.options.selectedItems.push(h) : (b.options.selectedItems = b.options.selectedItems.filter( function(a) { return a != h; } )), (b.shiftFirstSelectedItem = null), b.callAfterSelect(h), b.refresh(null, null, !0)) : V || l || "multi-simple" === b.options.selectionMode || (l || (1 != b.options.selectedItems.length && b.isObjInSelList(h)) || b.clearPrevSelection(h), (b.shiftFirstSelectedItem = null)); } else b.clearPrevSelection(); } else return b.options.selectedItem; }; this.updateSelection = function(a, c) { var d = a && (a.shiftKey || a.ctrlKey || a.metaKey) ? !0 : !1; !( "multi-extended" == b.options.selectionMode && 0 < b.options.selectedItems.length ) || D || a.shiftKey || V || d || b.selectionCancelled || ((b.isObjInSelList(c) && a && 3 == a.which) || b.clearPrevSelection(), (c[b.options.dataFields.selected] = !0), b.options.selectedItems.push(c), b.callAfterSelect(c), b.refresh(null, null, !0)); b.selectionCancelled = !1; }; this.selectFirstItem = function() { for (var a = null, c = 0; c < b.currentList.length; c++) if (b.isItemEnabled(b.currentList[c])) { a = b.currentList[c]; break; } this.itemSelection(null, a); return b.options.selectedItem; }; this.isObjInSelList = function(a) { var d = !1, c = b.options.selectedItems; if (a && c) for (var e = 0; e < c.length; e++) if ( f.isEqual( c[e][b.options.dataFields.id], a[b.options.dataFields.id] ) ) { d = !0; break; } return d; }; this.getItemAt = function(a, c) { var d = null, h = q.find("li"); if (h && 0 < h.length) for (var e = 0; e < h.length; e++) { var k = angular.element(h[e]); var l = f.getPageRect(k); if (f.checkHit(a, c, l)) { d = b.getItemFromElem(k); break; } } return d; }; this.resetSelection = function() { switch (b.options.selectionMode) { case "none": b.clearPrevSelection(); break; default: b.clearPrevSelection(b.itemSelection()); } }; c.$on(c.name + "-clear-selection", function(a) { b.clearPrevSelection(); b.options.selectedItem = null; }); c.$on(c.name + "-get-selected-item", function(a) { m.setTempData(b.itemSelection()); }); c.$on(c.name + "-set-selected-item", function(a, c) { var d = e(function() { b.itemSelection(null, c); e.cancel(d); }, 1); }); c.$on(c.name + "-get-selected-items", function(a) { m.setTempData(b.options.selectedItems); }); c.$on(c.name + "-set-selected-items", function(a, c) { if (c && Array.isArray(c)) var d = e(function() { for ( var a = (b.options.selectedItems.length = 0); a < c.length; a++ ) (c[a][b.options.dataFields.selected] = !0), b.options.selectedItems.push(c[a]); 0 < c.length ? ((b.options.selectedItem = c[c.length - 1]), b.callAfterSelect(b.options.selectedItem)) : (b.options.selectedItem = null); b.refresh(null, null, !0); e.cancel(d); }, 1); }); c.$on(c.name + "-move-item", function(a, c, e, f, k) { b.moveItem(c, e, f, k); }); c.$watch( "options", function(a, c) { a !== c && (b.updateOptions(a), b.updateLayout()); }, !0 ); c.$watch("allowDrag", function(a, c) { a !== c && ((b.options.allowDrag = a), b.updateView()); }); c.$watch("allowDrop", function(a, c) { a !== c && ((b.options.allowDrop = a), b.updateView()); }); c.$watch("allowFocus", function(a, c) { a !== c && (b.options.allowFocus = a); }); c.$watch("autoCheck", function(a, c) { a !== c && ((b.options.autoCheck = a), b.updateView()); }); c.$watch("autoExpand", function(a, c) { a !== c && (b.options.autoExpand = a); }); c.$watch("autoSize", function(a, c) { a !== c && ((b.options.autoSize = a), b.updateLayout()); }); c.$watch("autoUpdate", function(a, c) { a !== c && ((b.options.autoUpdate = a), b.updateLayout()); }); c.$watch("checkBoxSettings", function(a, c) { a !== c && b.updateCheckBoxSettings(a); }); c.$watch("controlStyle", function(a, c) { a !== c && b.updateControlStyle(a); }); c.$watch("editorSettings", function(a, c) { a !== c && b.updateEditorSettings(a); }); c.$watch("enabled", function(a, c) { a !== c && ((b.options.enabled = a), b.updateView(), b.callEnabledChanged(a)); }); c.$watch("fields", function(a, c) { a !== c && ((b.options.dataFields = a), b.UpdateData()); }); c.$watch("hoverSelection", function(a, c) { a !== c && (b.options.hoverSelection = a); }); c.$watch("indent", function(a, c) { a !== c && ((b.options.indent = a), b.updateLayout()); }); c.$watch("itemIcon", function(a, c) { a !== c && ((b.options.itemIcon = a), b.updateLayout()); }); c.$watch("labelEdit", function(a, c) { a !== c && (b.options.labelEdit = a); }); c.$watch("maxItems", function(a, c) { a !== c && (b.options.maxItems = a); }); c.$watch("mouseWheelSpeed", function(a, c) { a !== c && (b.options.mouseWheelSpeed = a); }); c.$watch("pathSeparator", function(a, c) { a !== c && (b.options.pathSeparator = a); }); c.$watch("rtl", function(a, c) { a !== c && ((b.options.rtl = a), b.updateLayout()); }); c.$watch("selectionMode", function(a, c) { a !== c && ((b.options.selectionMode = a), b.resetSelection()); }); c.$watch("showCheckBoxes", function(a, c) { a !== c && ((b.options.showCheckBoxes = a), b.updateLayout()); }); c.$watch("showExpandBoxes", function(a, c) { a !== c && ((b.options.showExpandBoxes = a), b.updateLayout()); }); c.$watch("showIcons", function(a, c) { a !== c && ((b.options.showIcons = a), b.updateLayout()); }); c.$watch("showLines", function(a, c) { a !== c && ((b.options.showLines = a), b.updateLayout()); }); c.$watch("showStatusIcons", function(a, c) { a !== c && ((b.options.showStatusIcons = a), b.updateLayout()); }); c.$watch("selectedItem", function(a, c) { a !== c && (c && (c[b.options.dataFields.selected] = !1), (b.options.selectedItem = a), b.callAfterSelect(a)); }); c.$watch("templateSettings", function(a, c) { a !== c && (b.updateTemplateSettings(a), b.updateLayout()); }); this.sortComparer = null; c.$watch("sorting", function(a, c) { a !== c && (b.options.sorting = a); }); c.$on(c.name + "-sort", function(a, c, e) { b.sort(c, e); }); this.sort = function(a, c) { b.sortComparer = c; if ("ascending" == a || "descending" == a || "none" == a) b.options.sorting = a; b.updateCurrentLayout(); b.callChange(); }; this.isSortingAllowed = function() { return ( "ascending" == b.options.sorting || "descending" == b.options.sorting ); }; this.applySorting = function(a) { a && (b.sortComparer ? a.sort(b.sortComparer) : b.isSortingAllowed() && a.sort(function(a, c) { var d, e; (d = a[b.options.dataFields.value]) || (d = a[b.options.dataFields.text]); f.isObject(d) && (d = d.value ? d.value : d.text); (e = c[b.options.dataFields.value]) || (e = c[b.options.dataFields.text]); f.isObject(e) && (e = e.value ? e.value : e.text); d = void 0 != d ? d : null; e = void 0 != e ? e : null; switch (b.options.sorting) { case "ascending": if (d < e) return -1; if (d > e) return 1; break; case "descending": if (d > e) return -1; if (d < e) return 1; break; default: return 0; } })); }; var Ka = function(a) { if (a) { var c = f.isFieldAvailable(a.general, "iui-checkbox"); a = (a = a.box) ? { general: f.isFieldAvailable(a.general, "iui-checkbox-box"), disabled: f.isFieldAvailable( a.disabled, "iui-checkbox-disabled" ), checked: f.isFieldAvailable(a.checked, "iui-checkbox-checked"), indeterminate: f.isFieldAvailable( a.indeterminate, "iui-checkbox-indeterminate" ), unchecked: f.isFieldAvailable( a.unchecked, "iui-checkbox-unchecked" ) } : b.options.controlStyle.item.checkBox.box; return { general: c, box: a }; } return b.options.controlStyle.item.checkBox; }; this.getExpandBoxStyle = function(a) { return a ? { general: f.isFieldAvailable(a.general, "iui-treeview-expand-box"), animated: f.isFieldAvailable( a.animated, "iui-treeview-expand-box-load" ), expanded: f.isFieldAvailable( a.expanded, "iui-treeview-expand-box-open" ), collapsed: f.isFieldAvailable( a.collapsed, "iui-treeview-expand-box-close" ) } : b.options.controlStyle.item.expandBox; }; var Aa = function(a) { if (a) { var c = a.general; c = f.isString(c) ? c : c ? { disabled: f.isFieldAvailable( c.disabled, "iui-treeview-item-disabled" ), focused: f.isFieldAvailable( c.focused, "iui-treeview-item-focused" ), normal: f.isFieldAvailable(c.normal, "iui-treeview-item"), hovered: f.isFieldAvailable( c.hovered, "iui-treeview-item-hovered" ), selected: f.isFieldAvailable( c.selected, "iui-treeview-item-selected" ) } : b.options.controlStyle.item.general; var d = Ka(a.checkBox), e = b.getExpandBoxStyle(a.expandBox); var k = a.content; k = f.isString(k) ? k : k ? { disabled: f.isFieldAvailable( k.disabled, "iui-treeview-item-content-disabled" ), focused: f.isFieldAvailable( k.focused, "iui-treeview-item-content-focused" ), normal: f.isFieldAvailable( k.normal, "iui-treeview-item-content" ), hovered: f.isFieldAvailable( k.hovered, "iui-treeview-item-content-hovered" ), selected: f.isFieldAvailable( k.selected, "iui-treeview-item-content-selected" ) } : b.options.controlStyle.item.content; a = a.fixed; a = f.isString(a) ? a : a ? { disabled: f.isFieldAvailable( a.disabled, "iui-treeview-item-fixed-disabled" ), normal: f.isFieldAvailable(a.normal, "iui-treeview-item-fixed"), hovered: f.isFieldAvailable( a.hovered, "iui-treeview-item-fixed-hovered" ) } : b.options.controlStyle.item.fixed; return { general: c, checkBox: d, expandBox: e, content: k, fixed: a }; } return b.options.controlStyle.item; }; this.updateControlStyle = function(a) { b.options.controlStyle = a ? { general: f.isFieldAvailable(a.general, "iui-treeview"), item: Aa(a.item) } : { general: f.isFieldAvailable( b.defaultStyle.general, "iui-treeview" ), item: Aa(b.defaultStyle.item) }; }; this.getCurrentItemStyle = function(a, c) { var d = b.options.controlStyle.item; if (a) switch (a.style) { case "initial": break; case "parent": return b.getCurrentItemStyle(b.getParent(a), c); default: null != a.style && (d = a.style); } if (c) { if (f.isString(d.general)) return d.general; if (b.isItemFixed(a)) switch (c) { case "disabled": return d.fixed && d.fixed.disabled ? d.fixed.disabled : b.options.controlStyle.item.fixed.disabled; case "hovered": return d.fixed && d.fixed.hovered ? d.fixed.hovered : b.options.controlStyle.item.fixed.hovered; default: return d.fixed && d.fixed.normal ? d.fixed.normal : b.options.controlStyle.item.fixed.normal; } else switch (c) { case "disabled": return d.general && d.general.disabled ? d.general.disabled : b.options.controlStyle.item.general.disabled; case "focused": return d.general && d.general.focused ? d.general.focused : b.options.controlStyle.item.general.focused; case "hovered": return d.general && d.general.hovered ? d.general.hovered : b.options.controlStyle.item.general.hovered; case "selected": return d.general && d.general.selected ? d.general.selected : b.options.controlStyle.item.general.selected; default: return d.general && d.general.normal ? d.general.normal : b.options.controlStyle.item.general.normal; } } else return d ? d : b.options.controlStyle.item; }; this.getCurrentItemContentStyle = function(a, c) { var d = b.options.controlStyle.item.content; if (a) switch (a.style) { case "initial": break; case "parent": return b.getCurrentItemContentStyle(b.getParent(a), c); default: null != a.style && a.style.content && (d = a.style.content); } if (c) { if (f.isString(d)) return d; switch (c) { case "disabled": return d && d.disabled ? d.disabled : b.options.controlStyle.item.content.disabled; case "focused": return d && d.focused ? d.focused : b.options.controlStyle.item.content.focused; case "hovered": return d && d.hovered ? d.hovered : b.options.controlStyle.item.content.hovered; case "selected": return d && d.selected ? d.selected : b.options.controlStyle.item.content.selected; default: return d && d.normal ? d.normal : b.options.controlStyle.item.content.normal; } } else return d ? d : b.options.controlStyle.item.content; }; } ]) .directive("iuiTreeview", [ "$compile", "$timeout", "$interval", "IntegralUIInternalService", "IntegralUIDragDrop", "$window", function(c, q, e, l, n, f) { return { restrict: "EA", controller: "IntegralUITreeViewController", transclude: !0, replace: !0, template: '