UNPKG

graphdb-workbench

Version:
2 lines 8.67 kB
export const __webpack_id__=63853;export const __webpack_ids__=[63853];export const __webpack_modules__={63853:function(){(function(){angular.module("angularBootstrapNavTree",[]).directive("ngTree",["$timeout",function(e){return{restrict:"E",template:'<ul class="nav nav-list nav-pills nav-stacked ng-tree"><li ng-repeat="row in tree_rows | filter:{visible:true} track by row.branch.uid" ng-animate="\'ng-tree-animate\'" data-element-id="{{row.branch.id}}" data-element-label="{{row.branch.label}}" ng-class="\'level-\' + {{ row.level }} + (row.branch.selected ? \' active\':\'\')" class="ng-tree-row"><a ng-click="checkBoxClicked(row)"><div style=\'float:left; padding-top:3px;\'><i ng-if="row.branch.children.length>0" ng-class="row.tree_icon" ng-click="expandClose(row.branch); $event.stopPropagation()" class="indented tree-icon" style="vertical-align: 2px;"></i><i ng-if="row.branch.children.length<1" class="indented tree-icon ng-scope icon-plus glyphicon glyphicon-plus fa fa-plus" style="color:transparent;"></i><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'1\' && row.level > 2 " class=\'indented bootstrap-checkbox\' data-checkbox-id="{{row.branch.id}}" ng-click="checkBoxClicked(row); $event.stopPropagation()"></span><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'2\' && row.level > 2 " class=\'indented bootstrap-checkbox selectedNode\' data-checkbox-id="{{row.branch.id}}" ng-click="checkBoxClicked(row); $event.stopPropagation()"><i class="icon-stop"></i></span><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'3\' && row.level > 2 " class=\'indented bootstrap-checkbox selectedNode\' data-checkbox-id="{{row.branch.id}}" ng-click="checkBoxClicked(row); $event.stopPropagation()"><i class="icon-ok"></i></span><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'1\' && row.level < 3 " class=\'indented bootstrap-checkbox disabledCheckBox\' data-checkbox-id="{{row.branch.id}}"></span><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'2\' && row.level < 3 " class=\'indented bootstrap-checkbox disabledCheckBox selectedNode\' data-checkbox-id="{{row.branch.id}}"><i class="icon-stop"></i></span><span ng-if="row.branch.showCheckboxes==\'true\' && row.branch.checkboxStatus==\'3\' && row.level < 3 " class=\'indented bootstrap-checkbox disabledCheckBox selectedNode\' data-checkbox-id="{{row.branch.id}}"><i class="icon-ok"></i></span></div><div ng-if="row.branch.checkboxStatus ==\'1\'" ng-class="\'div-level-\' + {{ row.level }}" class="indented tree-label">{{ row.branch.id }} - {{ row.label }} </div><div ng-if="row.branch.checkboxStatus !=\'1\'" ng-class="\'div-level-\' + {{ row.level }}" class="indented tree-label selectedNode">{{ row.branch.id }} - {{ row.label }} </div></a></li></ul>',replace:!0,scope:{treeData:"=",onSelect:"&",initialSelection:"@",treeControl:"="},controller:function(e,n,t){e.expandClose=function(n){e.$parent.fetchChildData(n),n.expanded=!n.expanded},e.checkBoxClicked=function(n){"true"==n.branch.showCheckboxes&&n.level>2&&(e.$parent.fetchChildDataAll(n.branch),e.$parent.checkBoxClicked(n.branch))}},link:function(n,t,r){var l,c,a,i,o,u,s,h,d,b;if(null==r.iconExpand&&(r.iconExpand="icon-plus glyphicon glyphicon-plus fa fa-plus"),null==r.iconCollapse&&(r.iconCollapse="icon-minus glyphicon glyphicon-minus fa fa-minus"),null==r.iconLeaf&&(r.iconLeaf="icon-file glyphicon glyphicon-file fa fa-file"),null==r.expandLevel&&(r.expandLevel="3"),c=parseInt(r.expandLevel,1),n.treeData){if(null==n.treeData.length){if(null==treeData.label)return void alert("treeData should be an array of root branches");n.treeData=[treeData]}return i=function(e){var t,r,l,c,a,i;for(t=function(n,r){var l,c,a,i,o;if(e(n,r),null!=n.children){for(o=[],c=0,a=(i=n.children).length;c<a;c++)l=i[c],o.push(t(l,r+1));return o}},i=[],l=0,c=(a=n.treeData).length;l<c;l++)r=a[l],i.push(t(r,1));return i},d=null,h=function(t){if(!t)return null!=d&&(d.selected=!1),void(d=null);if(t!==d){if(null!=d&&(d.selected=!1),t.selected=!0,d=t,l(t),null!=t.onSelect)return e(function(){return t.onSelect(t)});if(null!=n.onSelect)return e(function(){return n.onSelect({branch:t})})}},n.user_clicks_branch=function(e){if(e!==d)return h(e)},o=function(e){var n;return n=void 0,e.parent_uid&&i(function(t){if(t.uid===e.parent_uid)return n=t}),n},a=function(e,n){var t;if(null!=(t=o(e)))return n(t),a(t,n)},l=function(e){return a(e,function(e){return e.expanded=!0})},n.tree_rows=[],s=function(){var e,t,l,c,a,o;for(i(function(e,n){if(!e.uid)return e.uid=""+Math.random()}),console.log("UIDs are set."),i(function(e){var n,t,r,l,c;if(angular.isArray(e.children)){for(c=[],t=0,r=(l=e.children).length;t<r;t++)n=l[t],c.push(n.parent_uid=e.uid);return c}}),n.tree_rows=[],i(function(e){var n,t;return e.children?e.children.length>0?(t=function(e){return"string"==typeof e?{label:e,children:[]}:e},e.children=function(){var r,l,c,a;for(a=[],r=0,l=(c=e.children).length;r<l;r++)n=c[r],a.push(t(n));return a}()):void 0:e.children=[]}),e=function(t,l,c){var a,i,o,u,s,h,d;if(null==l.expanded&&(l.expanded=!1),null!=l.checkboxStatus&&null!=l.checkboxStatus||(l.checkboxStatus=1),null!=l.fetched&&null!=l.fetched||(l.fetched=0),l.showCheckboxes=r.showCheckboxes,o=l.children&&0!==l.children.length?l.expanded?r.iconCollapse:r.iconExpand:r.iconLeaf,n.tree_rows.push({level:t,branch:l,label:l.label,tree_icon:o,visible:c}),null!=l.children){for(d=[],u=0,s=(h=l.children).length;u<s;u++)a=h[u],i=c&&l.expanded,d.push(e(t+1,a,i));return d}},o=[],l=0,c=(a=n.treeData).length;l<c;l++)t=a[l],o.push(e(1,t,!0));return o},n.$watch("treeData",s,!0),null!=r.initialSelection&&i(function(n){if(n.label===r.initialSelection)return e(function(){return h(n)})}),u=n.treeData.length,console.log("num root branches = "+u),i(function(e,n){return e.level=n,e.expanded=e.level<c}),null!=n.treeControl&&angular.isObject(n.treeControl)?((b=n.treeControl).expand_all=function(){return i(function(e,n){return e.expanded=!0})},b.collapse_all=function(){return i(function(e,n){return e.expanded=!1})},b.get_first_branch=function(){if((u=n.treeData.length)>0)return n.treeData[0]},b.select_first_branch=function(){var e;return e=b.get_first_branch(),b.select_branch(e)},b.get_selected_branch=function(){return d},b.get_parent_branch=function(e){return o(e)},b.select_branch=function(e){return h(e),e},b.get_children=function(e){return e.children},b.select_parent_branch=function(e){var n;if(null==e&&(e=b.get_selected_branch()),null!=e&&null!=(n=b.get_parent_branch(e)))return b.select_branch(n),n},b.add_branch=function(e,t){return null!=e?(e.children.push(t),e.expanded=!0):n.treeData.push(t),t},b.add_root_branch=function(e){return b.add_branch(null,e),e},b.expand_branch=function(e){if(null==e&&(e=b.get_selected_branch()),null!=e)return e.expanded=!0,e},b.collapse_branch=function(e){if(null==e&&(e=d),null!=e)return e.expanded=!1,e},b.get_siblings=function(e){var t;if(null==e&&(e=d),null!=e)return(t=b.get_parent_branch(e))?t.children:n.treeData},b.get_next_sibling=function(e){var n,t;if(null==e&&(e=d),null!=e&&(t=b.get_siblings(e),u=t.length,(n=t.indexOf(e))<u))return t[n+1]},b.get_prev_sibling=function(e){var n,t;if(null==e&&(e=d),t=b.get_siblings(e),u=t.length,(n=t.indexOf(e))>0)return t[n-1]},b.select_next_sibling=function(e){var n;if(null==e&&(e=d),null!=e&&null!=(n=b.get_next_sibling(e)))return b.select_branch(n)},b.select_prev_sibling=function(e){var n;if(null==e&&(e=d),null!=e&&null!=(n=b.get_prev_sibling(e)))return b.select_branch(n)},b.get_first_child=function(e){var n;if(null==e&&(e=d),null!=e&&(null!=(n=e.children)?n.length:void 0)>0)return e.children[0]},b.get_closest_ancestor_next_sibling=function(e){var n,t;return null!=(n=b.get_next_sibling(e))?n:(t=b.get_parent_branch(e),b.get_closest_ancestor_next_sibling(t))},b.get_next_branch=function(e){var n;if(null==e&&(e=d),null!=e)return null!=(n=b.get_first_child(e))?n:n=b.get_closest_ancestor_next_sibling(e)},b.select_next_branch=function(e){var n;if(null==e&&(e=d),null!=e&&null!=(n=b.get_next_branch(e)))return b.select_branch(n),n},b.last_descendant=function(e){var n;return 0===(u=e.children.length)?e:(n=e.children[u-1],b.last_descendant(n))},b.get_prev_branch=function(e){var n;if(null==e&&(e=d),null!=e)return null!=(n=b.get_prev_sibling(e))?b.last_descendant(n):b.get_parent_branch(e)},b.select_prev_branch=function(e){var n;if(null==e&&(e=d),null!=e&&null!=(n=b.get_prev_branch(e)))return b.select_branch(n),n}):void 0}alert("no treeData defined for the tree!")}}}])}).call(this)}}; //# sourceMappingURL=63853.91a74ffa23ba893c1e75.bundle.js.map