text: /*
   ng-jedi-table v0.0.1
   https://github.com/jediproject/ng-jedi-table
  */
  
  !function(a){return"function"!=typeof define?("undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="jedi.table"),a()):void define(["angular"],a)}(function(){var a,b,c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};angular.module("jedi.table",[]).constant("jedi.table.TableConfig",{i18nDirective:"",defaultPageSize:10,emptyTableTemplate:"",emptyTableDefaultTemplateUrl:"assets/libs/ng-jedi-table/emptyTableDefaultTemplate.html",paginationTemplateScrollUrl:"assets/libs/ng-jedi-table/paginationTemplateScroll.html",paginationTemplateUrl:"assets/libs/ng-jedi-table/paginationTemplate.html"}).run(["$templateCache",function(a){a.put("assets/libs/ng-jedi-table/emptyTableDefaultTemplate.html",'<tr ng-show="isEmpty()">    <td colspan="100%">        <strong class="text-warning"><i18n>No item found.</i18n></strong>    </td></tr>'),a.put("assets/libs/ng-jedi-table/paginationTemplateScroll.html",'<div ng-show="isInitialized() && !isEmpty() && getNumberOfPages() > 1" style="margin: 0px;margin-top:10px;">    <ul class="pagination">        <li ng-class="{disabled: getCurrentPage() <= 0}"><a href="" ng-click="firstPage()">&lsaquo;</a></li>        <li ng-if="pageSequence.data[0] > 0"><a href="" ng-click="stepPage(-jdConfig.numberOfPages)">1</a></li>        <li ng-if="pageSequence.data[0] > 0"><a href="" ng-click="stepPage(-(pageSequence.data.indexOf(getCurrentPage()) + jdConfig.numberOfPagesToShow))">&hellip;</a></li>        <li ng-class="{active: getCurrentPage() == page}" ng-repeat="page in pageSequence.data"><a href="" ng-click="goToPage(page)">{{page + 1}}</a></li>        <li ng-if="pageSequence.data[pageSequence.data.length -1] < getNumberOfPages() - 1"><a href="" ng-click="stepPage(jdConfig.numberOfPagesToShow - pageSequence.data.indexOf(getCurrentPage()))">&hellip;</a></li>        <li ng-if="pageSequence.data[pageSequence.data.length -1] < getNumberOfPages() - 1"><a href="" ng-click="stepPage(getNumberOfPages())">{{getNumberOfPages()}}</a></li>        <li ng-class="{disabled: getCurrentPage() >= getNumberOfPages() - 1}"><a href="" ng-click="stepPage(1)">&rsaquo;</a></li>    </ul></div>'),a.put("assets/libs/ng-jedi-table/paginationTemplate.html",'<tr ng-show="isInitialized() && !isEmpty() && getNumberOfPages() > 1" class="jd-pagination">    <td colspan="100%">'+a.get("assets/libs/ng-jedi-table/paginationTemplateScroll.html")+"</td></tr>")}]),a=function(){function a(a,b,c){this.attribute=a.attribute,this.title=a.title,this.sortable=a.sortable,this.width=a.width,this.initialSorting=a.initialSorting,b&&(this.customContent=b.customContent,this.attributes=b.attributes),this.TableConfig=c}return a.prototype.createElement=function(){var a;return a=angular.element(document.createElement("th")),this.TableConfig.i18nDirective?a.attr(this.TableConfig.i18nDirective,""):a},a.prototype.renderTitle=function(a){return a.html(this.customContent||this.title)},a.prototype.renderAttributes=function(a){var b,c,d,e,f;if(this.attributes){for(e=this.attributes,f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(a.attr(b.name,b.value));return f}},a.prototype.renderSorting=function(a){var b;return this.sortable?(a.attr("ng-click","sort('"+this.attribute+"')"),b=angular.element("<i style='margin-left: 10px;'></i>"),b.attr("ng-class","getSortIcon('"+this.attribute+"')"),a.append(b)):void 0},a.prototype.renderWidth=function(a){return a.attr("width",this.width)},a.prototype.renderHtml=function(){var a;return a=this.createElement(),this.renderTitle(a),this.renderAttributes(a),this.renderSorting(a),this.renderWidth(a),a},a}(),d=function(){function a(a,b,c,d,e,f,g,h){angular.isDefined(c)&&(c=""===c.trim()?h.defaultPageSize:parseInt(c));var i=this;this.scope=a,this.$q=e,this.$filter=g,this.checkedItemsList=[];var j=a.$parent.$eval(b);a.isMemory=!1,"function"==typeof j?j={changeEvent:j}:_.isArray(j)||"undefined"==typeof j?(a.isMemory=!0,j={}):j.checkedKey&&j.checkedFilter&&(a.hasCheck=!0,j=angular.extend(j,{getCheckedItems:function(){return i.saveCheckedItems(),i.checkedItemsList},clearAllCheckedItems:function(){i.checkedItemsList=[]}})),a.jdConfig=this.jdConfig=angular.extend(j,{itemsPerPage:c,currentPage:0,sortContext:"global",orderBy:"orderBy",listName:a.isMemory?b:"listData",sortList:[],predicates:[],numberOfPages:1,numberOfPagesToShow:d?d:5,getLastPage:function(){return a.sortedAndPaginatedList.totalCount%c===0?this.numberOfPages+1:this.numberOfPages},setSortAndPredicates:function(a,b){this.sortList=a?a:[],this.predicates=b?b:[]},refresh:function(){i.checkedItemsList=[],i.callChangeEvent(0,i.jdConfig.itemsPerPage,void 0,function(a){i.setCurrentPage(0),i.jdConfig.setSortAndPredicates(),i.setList(a),i.keepItemSelected()})},refreshAndGoToLastPage:function(){i.callChangeEvent(i.jdConfig.numberOfPages-1,i.jdConfig.itemsPerPage,void 0,function(a){i.setCurrentPage(i.jdConfig.numberOfPages-1),i.jdConfig.setSortAndPredicates(),i.setList(a),i.keepItemSelected()})},refreshAndKeepCurrentPage:function(){var a=i.jdConfig.predicates,b=i.jdConfig.sortList;i.callChangeEvent(i.jdConfig.currentPage,i.jdConfig.itemsPerPage,i.jdConfig.predicates,function(c){i.setCurrentPage(i.jdConfig.currentPage),i.jdConfig.setSortAndPredicates(b,a),i.setList(c),i.keepItemSelected()})},hasData:function(){return i.getList()?i.getList().length>0:!1},clearData:function(){var b=[];b.totalCount=0,a.$eval(i.jdConfig.listName+"=value",{value:b})},clearTable:function(){a.$eval(i.jdConfig.listName+"=value",{value:null})},getList:function(){return i.getList()?i.getList().slice(0):void 0},checkAllItems:function(a){var b=i.getList();angular.forEach(b,function(b){i.jdConfig.checkItem(b,a)})},prepareData:j.prepareData?j.prepareData:function(a){var b=a;return!_.isArray(a)&&a.pageItems&&a.pageNo&&a.totalCount>=0&&(b=[],b=a.pageItems,b.totalCount=a.totalCount,b.pageNo=a.pageNo),b}}),a.isMemory||a.$parent.$eval(b+"=value",{value:this.jdConfig})}return a.prototype.getList=function(){return this.scope.$eval(this.jdConfig.listName)},a.prototype.getTotalCount=function(){var a=this.getList();return a?this.jdConfig.changeEvent?a.totalCount:a.length:void 0},a.prototype.setList=function(a){this.scope.$eval(this.jdConfig.listName+"=list",{list:a})},a.prototype.getSortList=function(){return this.jdConfig.sortList},a.prototype.setSortList=function(a){return this.jdConfig.sortList=a},a.prototype.setPredicates=function(a){return this.jdConfig.predicates=a},a.prototype.getPredicates=function(){return this.jdConfig.predicates},a.prototype.callChangeEvent=function(a,b,c,d){var e=this,f=this.$q.defer();f.promise.then(function(b){var c=e.jdConfig.prepareData(b);c&&!c.pageNo&&(c.pageNo=a+1),d(c)}),this.jdConfig.changeEvent({pageNo:a+1,pageSize:b,sort:c},f)},a.prototype.getItemsPerPage=function(){return this.jdConfig.itemsPerPage},a.prototype.getCurrentPage=function(){return this.jdConfig.currentPage},a.prototype.getSortContext=function(){return this.jdConfig.sortContext},a.prototype.setCurrentPage=function(a){return this.jdConfig.currentPage=a},a.prototype.getOrderBy=function(){return this.jdConfig.orderBy},a.prototype.getOrderBy=function(){return this.jdConfig.orderBy},a.prototype.getNumberOfPages=function(){return this.jdConfig.numberOfPages},a.prototype.setNumberOfPages=function(a){return this.jdConfig.numberOfPages=a},a.prototype.getNumberOfPagesToShow=function(){return this.jdConfig.numberOfPagesToShow},a.prototype.keepItemSelected=function(){var a=this.jdConfig?this.jdConfig.selectedItem:void 0;a&&(angular.forEach(this.getList(),function(b){b.id&&a.id&&b.id==a.id&&(a=b)}),this.jdConfig.selectedItem=a)},a.prototype.saveCheckedItems=function(){var a=this,b=this.getList(),c=this.jdConfig.checkedFilter(),d=this.jdConfig.checkedKey();angular.forEach(b,function(b){var c=_.findIndex(a.checkedItemsList,function(a){return a[d]===b[d]});-1!==c&&a.checkedItemsList.splice(c,1)});var e=this.$filter("filter")(b,c);a.checkedItemsList=_.union(a.checkedItemsList,e)},a.prototype.applyCheckedItems=function(){var a=this,b=this.getList(),c=this.jdConfig.checkedKey();angular.forEach(b,function(b){var d=_.find(a.checkedItemsList,function(a){return a[c]===b[c]});if(void 0!==d){delete d.$$hashKey;var e=Object.getOwnPropertyNames(d),f=Object.getOwnPropertyNames(b),g=_.difference(e,f);angular.forEach(g,function(a){b[a]=d[a]})}})},a}(),g=function(){function b(a,b,c){this.tableElement=a,this.attributes=b,this.id=this.attributes.id,this.paginated=null!=this.attributes.jdPaginated,this.list=this.attributes.jdTable,this.atChange=this.attributes.atChange,this.TableConfig=c,this.createColumnConfigurations()}return b.prototype.capitaliseFirstLetter=function(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""},b.prototype.extractWidth=function(a){var b;return b=/([0-9]+px)/i.exec(a),b?b[0]:""},b.prototype.isSortable=function(a){var b;return b=/(sortable)/i.exec(a),b?!0:!1},b.prototype.getInitialSorting=function(a){var b;if(b=a.attr("jd-initial-sorting")){if("asc"===b||"desc"===b)return b;throw"Invalid value for initial-sorting: "+b+". Allowed values are 'asc' or 'desc'."}return void 0},b.prototype.collectHeaderMarkup=function(a){var b,c,d,e,f,g,h;for(b={},d=a.find("tr"),e=a.find("thead"),h=d.find("th"),f=0,g=h.length;g>f;f++)c=h[f],c=angular.element(c),b[c.attr("jd-attribute")]={customContent:c.html(),attributes:c[0].attributes},e.is("[jd-ignore-header]")||c.remove();return b},b.prototype.collectBodyMarkup=function(a){var b,c,d,e,f,g,h,i,j,k;for(c=[],k=a.find("td"),i=0,j=k.length;j>i;i++)f=k[i],f=angular.element(f),"false"!==a.attr("jd-ellipsis")&&f.addClass("text-ellipsis"),b=f.attr("jd-attribute"),g=f.attr("jd-title")||this.capitaliseFirstLetter(f.attr("jd-attribute")),e=void 0!==f.attr("jd-sortable")||this.isSortable(f.attr("class")),h=this.extractWidth(f.attr("width")?f.attr("width"):f.attr("class")),d=this.getInitialSorting(f),c.push({attribute:b,title:g,sortable:e,width:h,initialSorting:d});return c},b.prototype.createColumnConfigurations=function(){var b,c,d,e,f;for(c=this.collectHeaderMarkup(this.tableElement),b=this.collectBodyMarkup(this.tableElement),this.columnConfigurations=[],e=0,f=b.length;f>e;e++)d=b[e],this.columnConfigurations.push(new a(d,c[d.attribute],this.TableConfig))},b}(),e=function(){function a(){}return a.prototype.setupTr=function(a,b){var c,d;return c=a.find("tbody"),d=c.find("tr"),d.attr("ng-repeat",b),c},a}(),c=function(a){function c(){}return i(c,a),c.prototype.compile=function(a){var b=a.attr("track-by")||"";b&&""!==b.trim()?(b.trim().indexOf("$")<0&&b.trim().indexOf("item.")<0&&(b="item."+b),this.setupTr(a,"item in sortedAndPaginatedList track by "+b)):this.setupTr(a,"item in sortedAndPaginatedList")},c.prototype.link=function(a,c,e,f,g,h,i){var j,k,l,m,n,o=!1;l=new d(a,e.jdTable,e.jdPaginated,e.jdPagesToShow,g,h,f,i),j=function(a,b,c,d,e,f,g){var h,i;return a?(i=a,c&&(h=c*b-a.length),"global"===e?(f.length>0&&(i=g(d)(i,f)),c&&(i=g("limitTo")(i,h),i=g("limitTo")(i,c))):(c&&(i=g("limitTo")(i,h),i=g("limitTo")(i,c)),f.length>0&&(i=g(d)(i,f))),i):[]},m=function(a,b,c){return a=Math.max(b,a),Math.min(c,a)},k=function(){if(l.getList()?a.jdConfig.changeEvent?a.sortedAndPaginatedList=l.getList():a.sortedAndPaginatedList=j(l.getList(),l.getCurrentPage(),l.getItemsPerPage(),l.getOrderBy(),l.getSortContext(),l.getPredicates(),f):a.sortedAndPaginatedList=null,l.getItemsPerPage()){var b,c,d;d=l.getTotalCount();var e;return d>0?(b=Math.ceil(d/l.getItemsPerPage()),c=b>=l.getNumberOfPagesToShow()?l.getNumberOfPagesToShow():b,l.setNumberOfPages(b),a.pageSequence.resetParameters(0,b,c),l.setCurrentPage(m(l.getCurrentPage(),0,l.getNumberOfPages()-1)),e=l.getCurrentPage()):(l.setNumberOfPages(1),a.pageSequence.resetParameters(0,1,1),l.setCurrentPage(0),e=0),n(),h.$broadcast("Jedi-Table.TableUpdated",l.jdConfig),a.pageSequence.realignGreedy(e)}n(),h.$broadcast("Jedi-Table.TableUpdated",l.jdConfig)},n=function(){if(a.hasCheck&&"function"==typeof l.jdConfig.onAllChecked){var b=l.getList();if(b&&0!==b.length){var c=f("filter")(b,l.jdConfig.checkedFilter()),d=c.length===b.length&&0!==c.length;d!==o&&(l.jdConfig.onAllChecked(d),o=d)}else o&&(l.jdConfig.onAllChecked(!1),o=!1)}},a.isInitialized=function(){return!angular.isUndefined(l.getList())&&!angular.isUndefined(l.getTotalCount())},a.isEmpty=function(){return a.isInitialized()&&l.getTotalCount()<1},a.getNumberOfPages=function(){return l.getNumberOfPages()},a.getCurrentPage=function(){return l.getCurrentPage()},a.sort=function(b){if(l.getSortList()){var c=[];c=c.concat(l.getSortList());var d=_.find(c,function(a){return a.predicate===b});if(d)if(d.descending)d.descending=!1;else{var e=c.indexOf(d);c.splice(e,1)}else c.push({predicate:b,descending:!0});var f=[];angular.forEach(c,function(a){a.descending?f.push("-"+a.predicate):f.push(a.predicate)}),a.jdConfig.changeEvent?(0!==l.getCurrentPage()&&l.setCurrentPage(0),a.hasCheck&&l.saveCheckedItems(),l.callChangeEvent(l.getCurrentPage(),l.getItemsPerPage(),f,function(b){l.setSortList(c),l.setPredicates(f),l.setList(b),l.keepItemSelected(),a.hasCheck&&l.applyCheckedItems()})):(l.setSortList(c),l.setPredicates(f),0!==l.getCurrentPage()?l.setCurrentPage(0):k())}},a.stepPage=function(b){b=parseInt(b),b=m(l.getCurrentPage()+b,0,l.getNumberOfPages()-1),a.jdConfig.changeEvent?(a.hasCheck&&l.saveCheckedItems(),l.callChangeEvent(b,l.getItemsPerPage(),l.getPredicates(),function(c){a.pageSequence.realignGreedy(b),l.setCurrentPage(b),l.setList(c),l.keepItemSelected(),a.hasCheck&&l.applyCheckedItems()})):(a.pageSequence.realignGreedy(b),l.setCurrentPage(b))},a.firstPage=function(){return a.stepPage(-1)},a.goToPage=function(b){return a.jdConfig.changeEvent?(a.hasCheck&&l.saveCheckedItems(),void l.callChangeEvent(b,l.getItemsPerPage(),l.getPredicates(),function(c){l.setCurrentPage(b),l.setList(c),l.keepItemSelected(),a.hasCheck&&l.applyCheckedItems()})):l.setCurrentPage(b)},a.pageSequence=new b,a.jdConfig.changeEvent||a.$watch("jdConfig.currentPage",function(a,b){return a!==b?k():void 0}),a.$watch("jdConfig.itemsPerPage",function(b,c){if(b!==c){if(!a.jdConfig.changeEvent)return k();l.callChangeEvent(l.getCurrentPage(),b,l.getPredicates(),function(a){l.setItemsPerPage(b),l.setList(a),l.keepItemSelected()})}}),a.jdConfig.changeEvent||a.$watch("jdConfig.sortContext",function(a,b){return a!==b?k():void 0}),a.isMemory&&(a.$watchCollection(e.jdTable,function(a,b){a!==b&&k()}),a.$watch(e.jdTable,function(a,b){a!==b&&h.$broadcast("Jedi-Table.ListChanged",l.jdConfig)},!0)),a.isMemory||(a.$watch("listData",function(a,b){a!==b&&k()},!0),(a.jdConfig.loadOnStartup||angular.isDefined(e.jdLoadOnStartup))&&setTimeout(function(){l.callChangeEvent(0,l.getItemsPerPage(),void 0,function(a){l.setList(a),l.keepItemSelected()})},1)),k()},c}(e),f=function(){function a(a,b,c,d){this.element=a,this.tableConfiguration=b,this.TableConfig=c,this.$templateCache=d}return a.prototype.constructHeader=function(){var a,b,c,d,e;for(b=this.element.find("thead > tr"),0===b.length&&(b=angular.element(document.createElement("tr"))),e=this.tableConfiguration.columnConfigurations,c=0,d=e.length;d>c;c++)a=e[c],b.append(a.renderHtml());return b},a.prototype.setupHeader=function(){var a,b;return b=this.element.find("thead"),0===b.length&&(b=$("<thead></thead>"),this.element.prepend(b)),b.is("[jd-ignore-header]")||(a=this.constructHeader()),this.element.hasClass("table")||this.element.addClass("table table-bordered table-striped table-responsive table-hover"),b.append(a)},a.prototype.setupFooter=function(){var a=this.element.find("tfoot");0===a.length&&(a=$("<tfoot></tfoot>"),this.element.append(a));var b;if(b=this.TableConfig.emptyTableTemplate?this.TableConfig.emptyTableTemplate:this.$templateCache.get(this.TableConfig.emptyTableDefaultTemplateUrl),this.TableConfig.i18nDirective&&(b=b.replace(/i18n/g,this.TableConfig.i18nDirective)),a.append(b),this.tableConfiguration.paginated)if("false"===this.element.attr("jd-scroll"))a.append(this.$templateCache.get(this.TableConfig.paginationTemplateUrl));else{var c=angular.element(this.$templateCache.get(this.TableConfig.paginationTemplateScrollUrl));c.addClass("scrolled-pagination"),a.append(c)}},a.prototype.getSetup=function(){return new c},a.prototype.compile=function(){return this.setupHeader(),this.setupFooter(),this.setup=this.getSetup(),this.setup.compile(this.element)},a.prototype.setupInitialSorting=function(a){var b,c,d,e,f;for(e=this.tableConfiguration.columnConfigurations,f=[],c=0,d=e.length;d>c;c++)if(b=e[c],b.initialSorting){if(!b.attribute)throw"initial-sorting specified without attribute.";f.push(a.descending="desc"===b.initialSorting),a.sort(b.attribute)}else f.push(void 0);return f},a.prototype.post=function(a,b,c,d,e,f,g){a.getSortIcon||(a.getSortIcon=function(b){var c;return a.jdConfig.sortList&&a.jdConfig.sortList.length>0&&(c=_.find(a.jdConfig.sortList,function(a){return a.predicate===b})),c?c.descending?"glyphicon glyphicon-chevron-down":"glyphicon glyphicon-chevron-up":"glyphicon glyphicon-minus"});var h=this.setup.link(a,b,c,d,e,f,g);return this.setupInitialSorting(a),h},a}(),b=function(){function a(a,b,c,d){if(this.lowerBound=null!=a?a:0,this.upperBound=null!=b?b:1,null==c&&(c=0),this.length=null!=d?d:1,this.length>this.upperBound-this.lowerBound)throw"sequence is too long";this.data=this.generate(c)}return a.prototype.generate=function(a){var b,c,d,e;for(a>this.upperBound-this.length?a=this.upperBound-this.length:a<this.lowerBound&&(a=this.lowerBound),e=[],b=c=a,d=parseInt(a)+parseInt(this.length)-1;d>=a?d>=c:c>=d;b=d>=a?++c:--c)e.push(b);return e},a.prototype.resetParameters=function(a,b,c){if(this.lowerBound=a,this.upperBound=b,this.length=c,this.length>this.upperBound-this.lowerBound)throw"sequence is too long";return this.data=this.generate(this.data[0])},a.prototype.relocate=function(a){var b;return b=this.data[0]+a,this.data=this.generate(b,b+this.length)},a.prototype.realignGreedy=function(a){var b;return-1===this.data.indexOf(a)?(b=a,this.data=this.generate(b)):void 0},a.prototype.realignGenerous=function(a){},a}(),angular.module("jedi.table").directive("jdTable",["$filter","$q","$rootScope","$compile","$templateCache","jedi.table.TableConfig",function(a,b,c,d,e,h){return{restrict:"AC",scope:!0,compile:function(d,i){var j,k,l=angular.element(d.find("tbody").find("tr"));return"ng-click"in l[0].attributes?l[0].attributes["ng-click"].value=l[0].attributes["ng-click"].value.concat("; markSelected(item)"):l.attr("ng-click","markSelected(item)"),l.attr("ng-class","{'table-selected-row' : item == jdConfig.selectedItem}"),k=new g(d,i,h),j=new f(d,k,h,e),j.compile(),{post:function(d,e,f){if(j.post(d,e,f,a,b,c,h),d.markSelected=function(a){return this.jdConfig.selectedItem!==a?void(this.jdConfig.selectedItem=a):void(this.jdConfig.selectedItem=void 0)},"false"!==f.jdScroll){var g=angular.element('<div class="table-scroll"></div>');e.before(g),g.append(e);var i=e.find(".scrolled-pagination");i.insertAfter(g).addClass("text-center");var k=function(){var a=g,b=i;g=null,i=null,a&&a.remove(),b&&b.remove()};d.$on("$destroy",function(){k()}),e.on("$destroy",function(){k()})}}}}}}]),angular.module("jedi.table").directive("jdAttribute",[function(){return{restrict:"A",compile:function(a,b){var c;if(c=a.attr("jd-attribute"),!c)throw"jd-attribute specified without value: "+a.html();return 0===a.children().length?b.jdFilter?a.append("{{item."+c+" | "+b.jdFilter+"}}"):a.append("{{item."+c+"}}"):void 0}}}])});
  //# sourceMappingURL=table.min.map