From 828ca4ef487f83133d90bfda1a6b847afa06974a Mon Sep 17 00:00:00 2001 From: Luke Payne Date: Thu, 15 Jun 2017 14:50:22 +1000 Subject: [PATCH] Version bump --- bower.json | 2 +- package.json | 2 +- ...l-selector.0.6.0.css => ng-hierarchical-selector.0.6.1.css} | 0 ...cal-selector.0.6.0.js => ng-hierarchical-selector.0.6.1.js} | 3 ++- ...or.0.6.0.min.css => ng-hierarchical-selector.0.6.1.min.css} | 0 ...ctor.0.6.0.min.js => ng-hierarchical-selector.0.6.1.min.js} | 2 +- 6 files changed, 5 insertions(+), 4 deletions(-) rename release/{ng-hierarchical-selector.0.6.0.css => ng-hierarchical-selector.0.6.1.css} (100%) rename release/{ng-hierarchical-selector.0.6.0.js => ng-hierarchical-selector.0.6.1.js} (99%) rename release/{ng-hierarchical-selector.0.6.0.min.css => ng-hierarchical-selector.0.6.1.min.css} (100%) rename release/{ng-hierarchical-selector.0.6.0.min.js => ng-hierarchical-selector.0.6.1.min.js} (69%) diff --git a/bower.json b/bower.json index 0ace7bc..fc7370d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "NgHierarchicalSelector", - "version": "0.6.0", + "version": "0.6.1", "homepage": "http://lukemurray.github.io/NgHierarchicalSelector/", "authors": [ "Luke Murray" diff --git a/package.json b/package.json index 6d0adca..dd53646 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng-hierarchical-selector", - "version": "0.6.0", + "version": "0.6.1", "description": "A hierarchical (or tree) selection control for AngularJS", "main": "index.js", "publishConfig": { diff --git a/release/ng-hierarchical-selector.0.6.0.css b/release/ng-hierarchical-selector.0.6.1.css similarity index 100% rename from release/ng-hierarchical-selector.0.6.0.css rename to release/ng-hierarchical-selector.0.6.1.css diff --git a/release/ng-hierarchical-selector.0.6.0.js b/release/ng-hierarchical-selector.0.6.1.js similarity index 99% rename from release/ng-hierarchical-selector.0.6.0.js rename to release/ng-hierarchical-selector.0.6.1.js index b67bd70..9ca7fcc 100644 --- a/release/ng-hierarchical-selector.0.6.0.js +++ b/release/ng-hierarchical-selector.0.6.1.js @@ -577,7 +577,8 @@ angular.module('hierarchical-selector.tree-item', [ return; } if (scope.asyncChildCache[scope.item.$$hashKey]) { - return scope.asyncChildCache[scope.item.$$hashKey]; + scope.theChildren = scope.asyncChildCache[scope.item.$$hashKey]; + return; } scope.theChildren = [{placeholder: true}]; diff --git a/release/ng-hierarchical-selector.0.6.0.min.css b/release/ng-hierarchical-selector.0.6.1.min.css similarity index 100% rename from release/ng-hierarchical-selector.0.6.0.min.css rename to release/ng-hierarchical-selector.0.6.1.min.css diff --git a/release/ng-hierarchical-selector.0.6.0.min.js b/release/ng-hierarchical-selector.0.6.1.min.js similarity index 69% rename from release/ng-hierarchical-selector.0.6.0.min.js rename to release/ng-hierarchical-selector.0.6.1.min.js index b16ba34..a0dbfea 100644 --- a/release/ng-hierarchical-selector.0.6.0.min.js +++ b/release/ng-hierarchical-selector.0.6.1.min.js @@ -1 +1 @@ -angular.module("hierarchical-selector",["hierarchical-selector.tree-item","hierarchical-selector.selectorUtils"]).directive("hierarchicalSelector",["$compile","$timeout","$q","selectorUtils",function(e,t,n,a){return{restrict:"E",replace:!0,templateUrl:"hierarchical-selector.tpl.html",scope:{syncData:"=data",multiSelect:"=?",onSelectionChanged:"&",selectOnlyLeafs:"=?",canSelectItem:"&",loadChildItems:"&",itemHasChildren:"&",selection:"=",tagName:"&",placeholder:"@"},link:function(e,t,a){a.canSelectItem&&(e.useCanSelectItemCallback=!0),a.loadChildItems&&(e.isAsync=!0),void 0===a.noButton&&(e.showButton=!0),a.tagName&&(e.useTagName=!0),!e.syncData&&e.isAsync&&(e.dataLoadPromise=n.when(e.loadChildItems({parent:null})).then(function(t){e.data=t})),e.syncData&&(e.data=e.syncData,e.$watch("syncData",function(){e.data=e.syncData}))},controller:["$scope","$document","$window","$interpolate",function(e,n,i,c){function l(t){s(),e.$apply()}function s(){if(e.showTree=!1,p){var t=a.getMetaData(p);t.isActive=!1,p=void 0}e.asyncChildCache={},n.off("click",l),n.off("keydown",u)}function r(t,n){n||(n=e.data);for(var i=0;i-1)return{currentArray:n,parentArray:i,parentIndex:c,itemIndex:l};for(var s,r=0;r0){var s=c.currentArray[c.itemIndex-1];return a.getMetaData(s).isExpanded?o(s):s}if(0===c.itemIndex&&c.parentArray)return c.parentArray[c.parentIndex]}return n}function m(t){p?e.onActiveItem(h(t,p,e.data)):(idx=t?0:e.data.length-1,e.onActiveItem(e.data[idx])),e.$apply()}function u(t){switch(t.keyCode){case 27:t.preventDefault(),t.stopPropagation(),s(),e.$apply();break;case 32:case 13:t.preventDefault(),t.stopPropagation(),p&&(e.itemSelected(p),e.$apply());break;case 40:t.preventDefault(),t.stopPropagation(),m(!0);break;case 38:t.preventDefault(),t.stopPropagation(),m(!1);break;case 37:t.preventDefault(),t.stopPropagation(),p&&(a.getMetaData(p).isExpanded=!1,e.$apply());break;case 39:t.preventDefault(),t.stopPropagation(),p&&(a.getMetaData(p).isExpanded=!0,e.$apply())}}var p;e.showTree=!1,e.selectedItems=[],e.multiSelect=e.multiSelect||!1,e.asyncChildCache={},e.onActiveItem=function(e){if(p!=e){if(p){var t=a.getMetaData(p);t.isActive=!1}p=e;var n=a.getMetaData(p);n.isActive=!0}},e.expandParents=function(){if(e.isAsync)for(var t=0;t-1?(c.selected=!1,e.selectedItems.splice(l,1)):e.selectedItems.push(n)}else{i||s();for(var r=0;r0&&e.clearSelection()}),e.getTagName=function(t){return e.useTagName?e.tagName({item:t}):t.name}}]}}]),angular.module("hierarchical-selector.selectorUtils",[]).factory("selectorUtils",["$q",function(e){return{getMetaPath:function(){return"_hsmeta"},getMetaData:function(e){return e._hsmeta||(e._hsmeta={}),e._hsmeta},hasChildren:function(e,t){return t?e.hasChildren:e.children&&e.children.length>0},getChildren:function(e,t,n){var a=t?n[e.$$hashKey]:e.children;return t&&!a&&e.hasChildren?[]:a}}}]),angular.module("hierarchical-selector.tree-item",["hierarchical-selector.selectorUtils"]).directive("treeItem",["$compile","$q","selectorUtils",function(e,t,n){return{restrict:"E",replace:!0,templateUrl:"tree-item.tpl.html",scope:{item:"=",itemSelected:"&",onActiveItem:"&",multiSelect:"=?",isActive:"=",selectOnlyLeafs:"=?",useCanSelectItem:"=",canSelectItem:"=",loadChildItems:"=",itemHasChildren:"&",onExpanded:"&",async:"=",asyncChildCache:"="},controller:["$scope",function(e){e.metaData=n.getMetaData(e.item),e.metaData.isExpanded=!1,e.theChildren=e.item.children,e.showExpando=function(t){return n.hasChildren(t,e.async)},e.onExpandoClicked=function(e,t){t.stopPropagation();var a=n.getMetaData(e);a.isExpanded=!a.isExpanded},e.clickSelectItem=function(t,n){n.stopPropagation(),e.itemSelected&&e.itemSelected({item:t})},e.subItemSelected=function(t,n){e.itemSelected&&e.itemSelected({item:t})},e.activeSubItem=function(t,n){e.onActiveItem&&e.onActiveItem({item:t})},e.handleOnExpanded=function(t,n){e.onExpanded&&e.onExpanded()},e.onMouseOver=function(t){t.stopPropagation(),angular.isFunction(e.onActiveItem)&&e.onActiveItem({item:e.item})},e.showCheckbox=function(){return!!e.multiSelect&&(e.useCanSelectItem?e.canSelectItem({item:e.item}):!e.selectOnlyLeafs||e.selectOnlyLeafs&&!n.hasChildren(e.item,e.async))}}],compile:function(t,a,i){angular.isFunction(i)&&(i={post:i});var c,l=t.contents().remove();return{pre:i&&i.pre?i.pre:null,post:function(t,a,s){c||(c=e(l)),c(t,function(e){a.append(e)}),i&&i.post&&i.post.apply(null,arguments),t.async&&t.$watch("item."+n.getMetaPath()+".isExpanded",function(e){if(e){if(t.asyncChildCache[t.item.$$hashKey])return t.asyncChildCache[t.item.$$hashKey];if(t.theChildren=[{placeholder:!0}],angular.isFunction(t.loadChildItems)&&t.item){var n=t.loadChildItems({parent:t.item});angular.isArray(n)&&(t.theChildren=n,t.onExpanded&&t.onExpanded()),n.then(function(e){t.theChildren=e,t.asyncChildCache[t.item.$$hashKey]=e,t.onExpanded&&t.onExpanded()})}}})}}}}}]),angular.module("hierarchical-selector").run(["$templateCache",function(e){e.put("hierarchical-selector.tpl.html",'
\r\n
\r\n \r\n
\r\n {{placeholder}}\r\n \r\n {{getTagName(i)}} \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
    \r\n \r\n
\r\n
\r\n
\r\n
\r\n'),e.put("tree-item.tpl.html",'
  • \r\n
    \r\n
    {{item.name}}
    \r\n
    \r\n
      \r\n
      Loading...
      \r\n \r\n
    \r\n
  • \r\n')}]); \ No newline at end of file +angular.module("hierarchical-selector",["hierarchical-selector.tree-item","hierarchical-selector.selectorUtils"]).directive("hierarchicalSelector",["$compile","$timeout","$q","selectorUtils",function(e,t,n,a){return{restrict:"E",replace:!0,templateUrl:"hierarchical-selector.tpl.html",scope:{syncData:"=data",multiSelect:"=?",onSelectionChanged:"&",selectOnlyLeafs:"=?",canSelectItem:"&",loadChildItems:"&",itemHasChildren:"&",selection:"=",tagName:"&",placeholder:"@"},link:function(e,t,a){a.canSelectItem&&(e.useCanSelectItemCallback=!0),a.loadChildItems&&(e.isAsync=!0),void 0===a.noButton&&(e.showButton=!0),a.tagName&&(e.useTagName=!0),!e.syncData&&e.isAsync&&(e.dataLoadPromise=n.when(e.loadChildItems({parent:null})).then(function(t){e.data=t})),e.syncData&&(e.data=e.syncData,e.$watch("syncData",function(){e.data=e.syncData}))},controller:["$scope","$document","$window","$interpolate",function(e,n,i,c){function l(t){s(),e.$apply()}function s(){if(e.showTree=!1,p){var t=a.getMetaData(p);t.isActive=!1,p=void 0}e.asyncChildCache={},n.off("click",l),n.off("keydown",u)}function r(t,n){n||(n=e.data);for(var i=0;i-1)return{currentArray:n,parentArray:i,parentIndex:c,itemIndex:l};for(var s,r=0;r0){var s=c.currentArray[c.itemIndex-1];return a.getMetaData(s).isExpanded?o(s):s}if(0===c.itemIndex&&c.parentArray)return c.parentArray[c.parentIndex]}return n}function m(t){p?e.onActiveItem(h(t,p,e.data)):(idx=t?0:e.data.length-1,e.onActiveItem(e.data[idx])),e.$apply()}function u(t){switch(t.keyCode){case 27:t.preventDefault(),t.stopPropagation(),s(),e.$apply();break;case 32:case 13:t.preventDefault(),t.stopPropagation(),p&&(e.itemSelected(p),e.$apply());break;case 40:t.preventDefault(),t.stopPropagation(),m(!0);break;case 38:t.preventDefault(),t.stopPropagation(),m(!1);break;case 37:t.preventDefault(),t.stopPropagation(),p&&(a.getMetaData(p).isExpanded=!1,e.$apply());break;case 39:t.preventDefault(),t.stopPropagation(),p&&(a.getMetaData(p).isExpanded=!0,e.$apply())}}var p;e.showTree=!1,e.selectedItems=[],e.multiSelect=e.multiSelect||!1,e.asyncChildCache={},e.onActiveItem=function(e){if(p!=e){if(p){var t=a.getMetaData(p);t.isActive=!1}p=e;var n=a.getMetaData(p);n.isActive=!0}},e.expandParents=function(){if(e.isAsync)for(var t=0;t-1?(c.selected=!1,e.selectedItems.splice(l,1)):e.selectedItems.push(n)}else{i||s();for(var r=0;r0&&e.clearSelection()}),e.getTagName=function(t){return e.useTagName?e.tagName({item:t}):t.name}}]}}]),angular.module("hierarchical-selector.selectorUtils",[]).factory("selectorUtils",["$q",function(e){return{getMetaPath:function(){return"_hsmeta"},getMetaData:function(e){return e._hsmeta||(e._hsmeta={}),e._hsmeta},hasChildren:function(e,t){return t?e.hasChildren:e.children&&e.children.length>0},getChildren:function(e,t,n){var a=t?n[e.$$hashKey]:e.children;return t&&!a&&e.hasChildren?[]:a}}}]),angular.module("hierarchical-selector.tree-item",["hierarchical-selector.selectorUtils"]).directive("treeItem",["$compile","$q","selectorUtils",function(e,t,n){return{restrict:"E",replace:!0,templateUrl:"tree-item.tpl.html",scope:{item:"=",itemSelected:"&",onActiveItem:"&",multiSelect:"=?",isActive:"=",selectOnlyLeafs:"=?",useCanSelectItem:"=",canSelectItem:"=",loadChildItems:"=",itemHasChildren:"&",onExpanded:"&",async:"=",asyncChildCache:"="},controller:["$scope",function(e){e.metaData=n.getMetaData(e.item),e.metaData.isExpanded=!1,e.theChildren=e.item.children,e.showExpando=function(t){return n.hasChildren(t,e.async)},e.onExpandoClicked=function(e,t){t.stopPropagation();var a=n.getMetaData(e);a.isExpanded=!a.isExpanded},e.clickSelectItem=function(t,n){n.stopPropagation(),e.itemSelected&&e.itemSelected({item:t})},e.subItemSelected=function(t,n){e.itemSelected&&e.itemSelected({item:t})},e.activeSubItem=function(t,n){e.onActiveItem&&e.onActiveItem({item:t})},e.handleOnExpanded=function(t,n){e.onExpanded&&e.onExpanded()},e.onMouseOver=function(t){t.stopPropagation(),angular.isFunction(e.onActiveItem)&&e.onActiveItem({item:e.item})},e.showCheckbox=function(){return!!e.multiSelect&&(e.useCanSelectItem?e.canSelectItem({item:e.item}):!e.selectOnlyLeafs||e.selectOnlyLeafs&&!n.hasChildren(e.item,e.async))}}],compile:function(t,a,i){angular.isFunction(i)&&(i={post:i});var c,l=t.contents().remove();return{pre:i&&i.pre?i.pre:null,post:function(t,a,s){c||(c=e(l)),c(t,function(e){a.append(e)}),i&&i.post&&i.post.apply(null,arguments),t.async&&t.$watch("item."+n.getMetaPath()+".isExpanded",function(e){if(e){if(t.asyncChildCache[t.item.$$hashKey])return void(t.theChildren=t.asyncChildCache[t.item.$$hashKey]);if(t.theChildren=[{placeholder:!0}],angular.isFunction(t.loadChildItems)&&t.item){var n=t.loadChildItems({parent:t.item});angular.isArray(n)&&(t.theChildren=n,t.onExpanded&&t.onExpanded()),n.then(function(e){t.theChildren=e,t.asyncChildCache[t.item.$$hashKey]=e,t.onExpanded&&t.onExpanded()})}}})}}}}}]),angular.module("hierarchical-selector").run(["$templateCache",function(e){e.put("hierarchical-selector.tpl.html",'
    \r\n
    \r\n \r\n
    \r\n {{placeholder}}\r\n \r\n {{getTagName(i)}} \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
      \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n'),e.put("tree-item.tpl.html",'
  • \r\n
    \r\n
    {{item.name}}
    \r\n
    \r\n
      \r\n
      Loading...
      \r\n \r\n
    \r\n
  • \r\n')}]); \ No newline at end of file