Socket
Socket
Sign inDemoInstall

ng-table

Package Overview
Dependencies
Maintainers
6
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-table - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

src/core/data/dataSettings.d.ts

3

bundles/ng-table.min.js

@@ -1,2 +0,3 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("angular")):"function"==typeof define&&define.amd?define(["angular"],e):"object"==typeof exports?exports["ng-table"]=e(require("angular")):t["ng-table"]=e(t.angular)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=33)}(function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(typeof t[e]){case"function":break;case"object":t[e]=function(e){var n=e.slice(1),r=t[e[0]];return function(t,e,a){r.apply(this,[t,e,a].concat(n))}}(t[e]);break;default:t[e]=t[t[e]]}return t}([function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(4),o=n(5),l=n(6),s=n(7),u=n(8),c=n(9),p=n(10),f=n(11),g=n(12),d=n(13),h=n(14),m=n(15),b=n(16),v=n(17);n(25),n(27),n(26),n(28),n(31),n(30),Object.defineProperty(e,"__esModule",{value:!0}),e.default=a.module("ngTable-browser",[]).directive("ngTable",i.ngTable).factory("ngTableColumn",o.ngTableColumn).directive("ngTableColumnsBinding",l.ngTableColumnsBinding).controller("ngTableController",s.ngTableController).directive("ngTableDynamic",u.ngTableDynamic).provider("ngTableFilterConfig",c.ngTableFilterConfigProvider).directive("ngTableFilterRow",p.ngTableFilterRow).controller("ngTableFilterRowController",f.ngTableFilterRowController).directive("ngTableGroupRow",g.ngTableGroupRow).controller("ngTableGroupRowController",d.ngTableGroupRowController).directive("ngTablePagination",h.ngTablePagination).directive("ngTableSelectFilterDs",m.ngTableSelectFilterDs).directive("ngTableSorterRow",b.ngTableSorterRow).controller("ngTableSorterRowController",v.ngTableSorterRowController),r(n(18))},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(19),o=n(20),l=n(22),s=n(21);Object.defineProperty(e,"__esModule",{value:!0}),e.default=a.module("ngTable-core",[]).provider("ngTableDefaultGetData",i.ngTableDefaultGetDataProvider).value("ngTableDefaults",o.ngTableDefaults).factory("NgTableParams",l.ngTableParamsFactory).factory("ngTableEventsChannel",s.ngTableEventsChannel),r(n(23))},,function(t,e,n){"use strict";function r(t,e){return{restrict:"A",priority:1001,scope:!0,controller:"ngTableController",compile:function(t){var n,r,i=[],o=0,l=[];if(a.forEach(t.find("tr"),function(t){l.push(a.element(t))}),n=l.filter(function(t){return!t.hasClass("ng-table-group")})[0],r=l.filter(function(t){return t.hasClass("ng-table-group")})[0],n)return a.forEach(n.find("td"),function(t){var n=a.element(t);if(!n.attr("ignore-cell")||"true"!==n.attr("ignore-cell")){var l=function(t){return n.attr("x-data-"+t)||n.attr("data-"+t)||n.attr(t)},s=function(t,e){n.attr("x-data-"+t)?n.attr("x-data-"+t,e):n.attr("data"+t)?n.attr("data"+t,e):n.attr(t,e)},u=function(t){var n=l(t);if(n){var r,a=function(t){return void 0!==r?r:e(n)(t)};return a.assign=function(t,a){var i=e(n);i.assign?i.assign(t.$parent,a):r=a},a}},c=l("title-alt")||l("title");c&&n.attr("data-title-text","{{"+c+"}}"),i.push({id:o++,title:u("title"),titleAlt:u("title-alt"),headerTitle:u("header-title"),sortable:u("sortable"),class:u("header-class"),filter:u("filter"),groupable:u("groupable"),headerTemplateURL:u("header"),filterData:u("filter-data"),show:n.attr("ng-if")?u("ng-if"):void 0}),(r||n.attr("ng-if"))&&s("ng-if","$columns["+(i.length-1)+"].show(this)")}}),function(t,e,n,r){t.$columns=i=r.buildColumns(i),r.setupBindingsToInternalScope(n.ngTable),r.loadFilterData(i),r.compileDirectiveTemplates()}}}}var a=n(0);r.$inject=["$q","$parse"],e.ngTable=r},function(t,e,n){"use strict";function r(){function t(t,n,i){var o=Object.create(t),l=e();for(var s in l)void 0===o[s]&&(o[s]=l[s]),a.isFunction(o[s])||!function(e){var n=function n(){return 1!==arguments.length||r(arguments[0])?t[e]:void n.assign(null,arguments[0])};n.assign=function(n,r){t[e]=r},o[e]=n}(s),function(e){var l=o[e];o[e]=function(){if(1!==arguments.length||r(arguments[0])){var e=arguments[0]||n,s=Object.create(e);return a.extend(s,{$column:o,$columns:i}),l.call(t,s)}l.assign(null,arguments[0])},l.assign&&(o[e].assign=l.assign)}(s);return o}function e(){return{class:n(""),filter:n(!1),groupable:n(!1),filterData:a.noop,headerTemplateURL:n(!1),headerTitle:n(""),sortable:n(!1),show:n(!0),title:n(""),titleAlt:n("")}}function n(t){var e=t,n=function t(){return 1!==arguments.length||r(arguments[0])?e:void t.assign(null,arguments[0])};return n.assign=function(t,n){e=n},n}function r(t){return null!=t&&a.isFunction(t.$new)}return{buildColumn:t}}var a=n(0);r.$inject=[],e.ngTableColumn=r},function(t,e){"use strict";function n(t){function e(e,n,r){var a=t(r.ngTableColumnsBinding).assign;a&&e.$watch("$columns",function(t){var n=(t||[]).slice(0);a(e,n)})}var n={restrict:"A",require:"ngTable",link:e};return n}n.$inject=["$parse"],e.ngTableColumnsBinding=n},function(t,e,n){"use strict";function r(t,e,n,r,i,o,l,s,u,c){function p(e){if(e&&!t.params.hasErrorState()){var n=t.params,r=n.settings().filterOptions;if(n.hasFilterChanges()){var a=function(){n.page(1),n.reload()};r.filterDelay?v(a,r.filterDelay):a()}else n.reload()}}function f(){o.showFilter?t.$parent.$watch(o.showFilter,function(e){t.show_filter=e}):t.$watch(h,function(e){t.show_filter=e}),o.disableFilter&&t.$parent.$watch(o.disableFilter,function(e){t.$filterRow.disabled=e})}function g(){if(t.$groupRow={show:!1},o.showGroup){var e=r(o.showGroup);t.$parent.$watch(e,function(e){t.$groupRow.show=e}),e.assign&&t.$watch("$groupRow.show",function(n){e.assign(t.$parent,n)})}else t.$watch("params.hasGroup()",function(e){t.$groupRow.show=e})}function d(){return(t.$columns||[]).filter(function(e){return e.show(t)})}function h(){return!!t.$columns&&m(t.$columns,function(e){return e.show(t)&&!!e.filter(t)})}function m(t,e){for(var n=!1,r=0;r<t.length;r++){var a=t[r];if(e(a)){n=!0;break}}return n}function b(){c.onAfterReloadData(function(e,n){var r=d();e.hasGroup()?(t.$groups=n||[],t.$groups.visibleColumnCount=r.length):(t.$data=n||[],t.$data.visibleColumnCount=r.length)},t,function(e){return t.params===e}),c.onPagesChanged(function(e,n){t.pages=n},t,function(e){return t.params===e})}t.$filterRow={disabled:!1},t.$loading=!1,t.hasOwnProperty("params")||(t.params=new e(!0));var v=function(){var t;return function(e,r){n.cancel(t),t=n(e,r)}}();t.$watch("params",function(t,e){t!==e&&t&&t.reload()},!1),t.$watch("params.isDataReloadRequired()",p),this.compileDirectiveTemplates=function(){if(!l.hasClass("ng-table")){t.templates={header:o.templateHeader?o.templateHeader:"ng-table/header.html",pagination:o.templatePagination?o.templatePagination:"ng-table/pager.html"},l.addClass("ng-table");var e=null,n=!1;a.forEach(l.children(),function(t){"THEAD"===t.tagName&&(n=!0)}),n||(e=a.element('<thead ng-include="templates.header"></thead>',s),l.prepend(e));var r=a.element('<div ng-table-pagination="params" template-url="templates.pagination"></div>',s);l.after(r),e&&i(e)(t),i(r)(t)}},this.loadFilterData=function(e){function n(t){return t&&"object"==typeof t&&"function"==typeof t.then}a.forEach(e,function(e){var r=e.filterData(t);return r?n(r)?(delete e.filterData,r.then(function(t){a.isArray(t)||a.isFunction(t)||a.isObject(t)||(t=[]),e.data=t})):e.data=r:void delete e.filterData})},this.buildColumns=function(e){var n=[];return(e||[]).forEach(function(e){n.push(u.buildColumn(e,t,n))}),n},this.parseNgTableDynamicExpr=function(t){if(!t||t.indexOf(" with ")>-1){var e=t.split(/\s+with\s+/);return{tableParams:e[0],columns:e[1]}}throw new Error("Parse error (expected example: ng-table-dynamic='tableParams with cols')")},this.setupBindingsToInternalScope=function(e){t.$watch(e,function(e){void 0!==e&&(t.params=e)},!1),f(),g()},b()}var a=n(0);r.$inject=["$scope","NgTableParams","$timeout","$parse","$compile","$attrs","$element","$document","ngTableColumn","ngTableEventsChannel"],e.ngTableController=r},function(t,e,n){"use strict";function r(){return{restrict:"A",priority:1001,scope:!0,controller:"ngTableController",compile:function(t){var e;if(a.forEach(t.find("tr"),function(t){t=a.element(t),t.hasClass("ng-table-group")||e||(e=t)}),e)return a.forEach(e.find("td"),function(t){var e=a.element(t),n=function(t){return e.attr("x-data-"+t)||e.attr("data-"+t)||e.attr(t)},r=n("title");r||e.attr("data-title-text","{{$columns[$index].titleAlt(this) || $columns[$index].title(this)}}");var i=e.attr("ng-if");i||e.attr("ng-if","$columns[$index].show(this)")}),function(t,e,n,r){var a=r.parseNgTableDynamicExpr(n.ngTableDynamic);r.setupBindingsToInternalScope(a.tableParams),r.compileDirectiveTemplates(),t.$watchCollection(a.columns,function(e){t.$columns=r.buildColumns(e),r.loadFilterData(t.$columns)})}}}}var a=n(0);r.$inject=[],e.ngTableDynamic=r},function(t,e,n){"use strict";function r(){function t(){e()}function e(){i=o}function n(t){var e=a.extend({},i,t);e.aliasUrls=a.extend({},i.aliasUrls,t.aliasUrls),i=e}function r(){function t(t,e){var n;return n="string"!=typeof t?t.id:t,n.indexOf("/")!==-1?n:r.getUrlForAlias(n,e)}function e(t,e){return i.aliasUrls[t]||i.defaultBaseUrl+t+i.defaultExt}var n,r={config:n,getTemplateUrl:t,getUrlForAlias:e};return Object.defineProperty(r,"config",{get:function(){return n=n||a.copy(i)},enumerable:!0}),r}var i,o={defaultBaseUrl:"ng-table/filters/",defaultExt:".html",aliasUrls:{}};this.$get=r,this.resetConfigs=e,this.setConfig=n,t(),r.$inject=[]}var a=n(0);r.$inject=[],e.ngTableFilterConfigProvider=r},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableFilterRowController"};return t}var a=n(24);r.$inject=[],e.ngTableFilterRow=r},function(t,e){"use strict";function n(t,e){t.config=e,t.getFilterCellCss=function(t,e){if("horizontal"!==e)return"s12";var n=Object.keys(t).length,r=parseInt((12/n).toString(),10);return"s"+r},t.getFilterPlaceholderValue=function(t,e){return"string"==typeof t?"":t.placeholder}}n.$inject=["$scope","ngTableFilterConfig"],e.ngTableFilterRowController=n},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableGroupRowController",controllerAs:"dctrl"};return t}var a=n(29);r.$inject=[],e.ngTableGroupRow=r},function(t,e){"use strict";function n(t){function e(){t.getGroupables=i,t.getGroupTitle=a,t.getVisibleColumns=o,t.groupBy=l,t.isSelectedGroup=u,t.toggleDetail=p,t.$watch("params.group()",c,!0)}function n(){var e;e=t.params.hasGroup(t.$selGroup,"asc")?"desc":t.params.hasGroup(t.$selGroup,"desc")?"":"asc",t.params.group(t.$selGroup,e)}function r(e){return t.$columns.filter(function(n){return n.groupable(t)===e})[0]}function a(e){return s(e)?e.title:e.title(t)}function i(){var e=t.$columns.filter(function(e){return!!e.groupable(t)});return f.concat(e)}function o(){return t.$columns.filter(function(e){return e.show(t)})}function l(e){u(e)?n():s(e)?t.params.group(e):t.params.group(e.groupable(t))}function s(t){return"function"==typeof t}function u(e){return s(e)?e===t.$selGroup:e.groupable(t)===t.$selGroup}function c(e){var n=r(t.$selGroup);if(n&&n.show.assign&&n.show.assign(t,!0),s(e))f=[e],t.$selGroup=e,t.$selGroupTitle=e.title;else{var a=Object.keys(e||{})[0],i=r(a);i&&(t.$selGroupTitle=i.title(t),t.$selGroup=a,i.show.assign&&i.show.assign(t,!1))}}function p(){return t.params.settings().groupOptions.isExpanded=!t.params.settings().groupOptions.isExpanded,t.params.reload()}var f=[];e()}n.$inject=["$scope"],e.ngTableGroupRowController=n},function(t,e,n){"use strict";function r(t,e,n){return{restrict:"A",scope:{params:"=ngTablePagination",templateUrl:"="},replace:!1,link:function(r,i){n.onAfterReloadData(function(t){r.pages=t.generatePagesArray()},r,function(t){return t===r.params}),r.$watch("templateUrl",function(n){if(void 0!==n){var o=a.element('<div ng-include="templateUrl"></div>',e);i.append(o),t(o)(r)}})}}}var a=n(0);r.$inject=["$compile","$document","ngTableEventsChannel"],e.ngTablePagination=r},function(t,e){"use strict";function n(){var t={restrict:"A",controller:r};return t}function r(t,e,n,r){function a(){s=e(n.ngTableSelectFilterDs)(t),t.$watch(function(){return s&&s.data},i)}function i(){l(s).then(function(e){e&&!o(e)&&e.unshift({id:"",title:""}),e=e||[],t.$selectData=e})}function o(t){for(var e,n=0;n<t.length;n++){var r=t[n];if(r&&""===r.id){e=!0;break}}return e}function l(t){var e=t.data;return e instanceof Array?r.when(e):r.when(e&&e())}var s;a()}n.$inject=[],e.ngTableSelectFilterDs=n,r.$inject=["$scope","$parse","$attrs","$q"]},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableSorterRowController"};return t}var a=n(32);r.$inject=[],e.ngTableSorterRow=r},function(t,e){"use strict";function n(t){function e(e,n){var r=e.sortable&&e.sortable();if(r&&"string"==typeof r){var a=t.params.settings().defaultSort,i="asc"===a?"desc":"asc",o=t.params.sorting()&&t.params.sorting()[r]&&t.params.sorting()[r]===a,l=n.ctrlKey||n.metaKey?t.params.sorting():{};l[r]=o?i:a,t.params.parameters({sorting:l})}}t.sortBy=e}n.$inject=["$scope"],e.ngTableSorterRowController=n},function(t,e){"use strict"},function(t,e,n){"use strict";var r=n(0),a=function(){function t(){function t(t,n){function a(n){var a=n.settings().filterOptions;return r.isFunction(a.filterFn)?a.filterFn:t(a.filterFilterName||e.filterFilterName)}function i(n){return t(e.sortingFilterName)}function o(t,e){if(!e.hasFilter())return t;var n=e.filter(!0),r=Object.keys(n),i=r.reduce(function(t,e){return t=c(t,n[e],e)},{}),o=a(e);return o.call(e,t,i,e.settings().filterOptions.filterComparator)}function l(t,e){var n=t.slice((e.page()-1)*e.count(),e.page()*e.count());return e.total(t.length),n}function s(t,e){var n=e.orderBy(),r=i(e);return n.length?r(t,n):t}function u(t,e){if(null==t)return[];var a=r.extend({},p,e.settings().dataOptions),i=a.applyFilter?o(t,e):t;n.publishAfterDataFiltered(f,e,i);var u=a.applySort?s(i,e):i;return n.publishAfterDataSorted(f,e,u),a.applyPaging?l(u,e):u}function c(t,e,n){var r=n.split("."),a=t,i=r[r.length-1],o=a,l=r.slice(0,r.length-1);return l.forEach(function(t){o.hasOwnProperty(t)||(o[t]={}),o=o[t]}),o[i]=e,a}var p={applyFilter:!0,applySort:!0,applyPaging:!0},f=this;return u.applyPaging=l,u.getFilterFn=a,u.getOrderByFn=i,u}this.filterFilterName="filter",this.sortingFilterName="orderBy";var e=this;this.$get=t,t.$inject=["$filter","ngTableEventsChannel"]}return t}();e.ngTableDefaultGetDataProvider=a},function(t,e){"use strict";e.ngTableDefaults={params:{},settings:{}}},function(t,e,n){"use strict";function r(t){function e(t,e){var i=t.charAt(0).toUpperCase()+t.substring(1),o=(l={},l["on"+i]=n(t),l["publish"+i]=r(t),l);return a.extend(e,o);var l}function n(e){function n(t){return t?r(t)?t:function(e){return e===t}:function(t){return!0}}function r(t){return"function"==typeof t}function a(t){return t&&"function"==typeof t.$new}return function(r,i,o){var l,s=t;return a(i)?(s=i,l=n(o)):l=n(i),s.$on("ngTable:"+e,function(t,e){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];if(!e.isNullInstance){var i=[e].concat(n);l.apply(this,i)&&r.apply(this,i)}})}}function r(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r-0]=arguments[r];t.$broadcast.apply(t,["ngTable:"+e].concat(n))}}var i={};return i=e("afterCreated",i),i=e("afterReloadData",i),i=e("datasetChanged",i),i=e("pagesChanged",i),i=e("afterDataFiltered",i),i=e("afterDataSorted",i)}var a=n(0);r.$inject=["$rootScope"],e.ngTableEventsChannel=r},function(t,e,n){"use strict";function r(t,e,n,r,i,o){function l(n,l){function s(t){return!isNaN(parseFloat(t))&&isFinite(t)}function u(t){var e=F.groupOptions&&F.groupOptions.defaultSort;if(t){if(f(t))return null==t.sortDirection&&(t.sortDirection=e),t;if("object"==typeof t){for(var n in t)null==t[n]&&(t[n]=e);return t}return r={},r[t]=e,r}return t;var r}function c(t){var e=[];for(var n in t)e.push(("asc"===t[n]?"+":"-")+n);return e}function p(){var t=O.group;return{params:O,groupSortDirection:f(t)?t.sortDirection:void 0}}function f(t){return"function"==typeof t}function g(){var t=O.filter&&O.filter.$,e=b&&b.params.filter&&b.params.filter.$;return!a.equals(t,e)}function d(){F.filterOptions.filterDelay===C.filterDelay&&F.total<=F.filterOptions.filterDelayThreshold&&F.getData===x.getData&&(F.filterOptions.filterDelay=0)}function h(e){var n=F.interceptors||[];return n.reduce(function(e,n){var r=n.response&&n.response.bind(n)||t.when,a=n.responseError&&n.responseError.bind(n)||t.reject;return e.then(function(t){return r(t,$)},function(t){return a(t,$)})},e)}function m(){function e(t){return i(t.settings().dataset,t)}function n(e){var n,o=e.group(),l=void 0;if(f(o))n=o,l=o.sortDirection;else{var s=Object.keys(o)[0];l=o[s],n=function(t){return r(t,s)}}var u=e.settings(),p=u.dataOptions;u.dataOptions={applyPaging:!1};var g=u.getData,d=t.when(g(e));return d.then(function(t){var r={};a.forEach(t,function(t){var e=n(t);r[e]=r[e]||{data:[],$hideRows:!u.groupOptions.isExpanded,value:e},r[e].data.push(t)});var o=[];for(var s in r)o.push(r[s]);if(l){var p=i.getOrderByFn(),f=c({value:l});o=p(o,f)}return i.applyPaging(o,e)}).finally(function(){u.dataOptions=p})}function r(t,e){var n;if(n="string"==typeof e?e.split("."):e,void 0!==t){if(0===n.length)return t;if(null!==t)return r(t[n[0]],n.slice(1))}}return{getData:e,getGroups:n}}"boolean"==typeof n&&(this.isNullInstance=!0);var b,v,$=this,y=!1,w=[],T=function(){for(var t=[],n=0;n<arguments.length;n++)t[n-0]=arguments[n];F.debugMode&&e.debug&&e.debug.apply(e,t)},C={filterComparator:void 0,filterDelay:500,filterDelayThreshold:1e4,filterFilterName:void 0,filterFn:void 0,filterLayout:"stack"},D={defaultSort:"asc",isExpanded:!0},x=m();this.data=[],this.parameters=function(t,e){if(e=e||!1,void 0!==typeof t){for(var n in t){var r=t[n];if(e&&n.indexOf("[")>=0){for(var i=n.split(/\[(.*)\]/).reverse(),o="",l=0,c=i.length;l<c;l++){var p=i[l];if(""!==p){var f=r;r={},r[o=p]=s(f)?parseFloat(f):f}}"sorting"===o&&(O[o]={}),O[o]=a.extend(O[o]||{},r[o])}else"group"===n?O[n]=u(t[n]):O[n]=s(t[n])?parseFloat(t[n]):t[n]}return T("ngTable: set parameters",O),this}return O},this.settings=function(t){if(a.isDefined(t)){t.filterOptions&&(t.filterOptions=a.extend({},F.filterOptions,t.filterOptions)),t.groupOptions&&(t.groupOptions=a.extend({},F.groupOptions,t.groupOptions)),a.isArray(t.dataset)&&(t.total=t.dataset.length);var e=F.dataset;F=a.extend(F,t),a.isArray(t.dataset)&&d();var n=t.hasOwnProperty("dataset")&&t.dataset!=e;if(n){y&&this.page(1),y=!1;var r=function(){o.publishDatasetChanged($,t.dataset,e)};w?w.push(r):r()}return T("ngTable: set settings",F),this}return F},this.page=function(t){return void 0!==t?this.parameters({page:t}):O.page},this.total=function(t){return void 0!==t?this.settings({total:t}):F.total},this.count=function(t){return void 0!==t?this.parameters({count:t,page:1}):O.count},this.filter=function(t){if(null!=t&&"object"==typeof t)return this.parameters({filter:t,page:1});if(t===!0){for(var e=Object.keys(O.filter),n={},r=0;r<e.length;r++){var a=O.filter[e[r]];null!=a&&""!==a&&(n[e[r]]=a)}return n}return O.filter},this.group=function(t,e){if(void 0===t)return O.group;var n={page:1};return f(t)&&void 0!==e?(t.sortDirection=e,n.group=t):"string"==typeof t&&void 0!==e?n.group=(r={},r[t]=e,r):n.group=t,this.parameters(n),this;var r},this.sorting=function(t,e){return"string"==typeof t&&void 0!==e?(this.parameters({sorting:(n={},n[t]=e,n)}),this):void 0!==t?this.parameters({sorting:t}):O.sorting;var n},this.isSortBy=function(t,e){return void 0!==e?void 0!==O.sorting[t]&&O.sorting[t]==e:void 0!==O.sorting[t]},this.orderBy=function(){return c(O.sorting)},this.generatePagesArray=function(t,e,n,r){arguments.length||(t=this.page(),e=this.total(),n=this.count());var a,i,o,l;r=r&&r<6?6:r;var s=[];if(l=Math.ceil(e/n),l>1){s.push({type:"prev",number:Math.max(1,t-1),active:t>1}),s.push({type:"first",number:1,active:t>1,current:1===t}),i=Math.round((F.paginationMaxBlocks-F.paginationMinBlocks)/2),o=Math.max(2,t-i),a=Math.min(l-1,t+2*i-(t-o)),o=Math.max(2,o-(2*i-(a-o)));for(var u=o;u<=a;)u===o&&2!==u||u===a&&u!==l-1?s.push({type:"more",active:!1}):s.push({type:"page",number:u,active:t!==u,current:t===u}),u++;s.push({type:"last",number:l,active:t!==l,current:t===l}),s.push({type:"next",number:Math.min(l,t+1),active:t<l})}return s},this.isDataReloadRequired=function(){return!y||!a.equals(p(),b)||g()},this.hasFilter=function(){return Object.keys(this.filter(!0)).length>0},this.hasGroup=function(t,e){return null==t?f(O.group)||Object.keys(O.group).length>0:f(t)?null==e?O.group===t:O.group===t&&t.sortDirection===e:null==e?Object.keys(O.group).indexOf(t)!==-1:O.group[t]===e},this.hasFilterChanges=function(){var t=b&&b.params.filter;return!a.equals(O.filter,t)||g()},this.url=function(t){function e(t,e){n(i)?i.push(e+"="+encodeURIComponent(t)):i[e]=encodeURIComponent(t)}function n(e){return t}function r(t,e){return"group"===e||void 0!==typeof t&&""!==t}t=t||!1;var i=t?[]:{};for(var o in O)if(O.hasOwnProperty(o)){var l=O[o],s=encodeURIComponent(o);if("object"==typeof l){for(var u in l)if(r(l[u],o)){var c=s+"["+encodeURIComponent(u)+"]";e(l[u],c)}}else!a.isFunction(l)&&r(l,o)&&e(l,s)}return i},this.reload=function(){var e=this,n=null;if(F.$loading=!0,b=a.copy(p()),y=!0,e.hasGroup())n=h(t.when(F.getGroups(e)));else{var r=F.getData;n=h(t.when(r(e)))}T("ngTable: reload data");var i=e.data;return n.then(function(t){return F.$loading=!1,v=null,e.data=t,o.publishAfterReloadData(e,t,i),e.reloadPages(),t}).catch(function(e){return v=b,t.reject(e)})},this.hasErrorState=function(){return!(!v||!a.equals(v,p()))},this.reloadPages=function(){var t;return function(){var e=t,n=$.generatePagesArray($.page(),$.total(),$.count());a.equals(e,n)||(t=n,o.publishPagesChanged(this,n,e))}}();var O={page:1,count:10,filter:{},sorting:{},group:{}};a.extend(O,r.params);var F={$loading:!1,dataset:null,total:0,defaultSort:"desc",filterOptions:a.copy(C),groupOptions:a.copy(D),counts:[10,25,50,100],interceptors:[],paginationMaxBlocks:11,paginationMinBlocks:5,sortingIndicator:"span"};return this.settings(x),this.settings(r.settings),this.settings(l),this.parameters(n,!0),o.publishAfterCreated(this),a.forEach(w,function(t){t()}),w=null,this}return l}var a=n(0);r.$inject=["$q","$log","$filter","ngTableDefaults","ngTableDefaultGetData","ngTableEventsChannel"],e.ngTableParamsFactory=r},18,function(t,e,n){var r="ng-table/filterRow.html",a='<tr ng-show=show_filter class=ng-table-filters> <th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if=$column.show(this) class="filter {{$column.class(this)}}" ng-class="params.settings().filterOptions.filterLayout === \'horizontal\' ? \'filter-horizontal\' : \'\'"> <div ng-repeat="(name, filter) in $column.filter(this)" ng-include=config.getTemplateUrl(filter) class=filter-cell ng-class="[getFilterCellCss($column.filter(this), params.settings().filterOptions.filterLayout), $last ? \'last\' : \'\']"> </div> </th> </tr> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/number.html",a='<input type=number name={{name}} ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/select-multiple.html",a='<select ng-options="data.id as data.title for data in $column.data" ng-disabled=$filterRow.disabled multiple=multiple ng-multiple=true ng-model=params.filter()[name] class="filter filter-select-multiple form-control" name={{name}}> </select> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/select.html",a='<select ng-options="data.id as data.title for data in $selectData" ng-table-select-filter-ds=$column ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="filter filter-select form-control" name={{name}}> <option style=display:none value=""></option> </select> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/text.html",a='<input type=text name={{name}} ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/groupRow.html",a='<tr ng-if=params.hasGroup() ng-show=$groupRow.show class=ng-table-group-header> <th colspan={{getVisibleColumns().length}} class=sortable ng-class="{\n \'sort-asc\': params.hasGroup($selGroup, \'asc\'),\n \'sort-desc\':params.hasGroup($selGroup, \'desc\')\n }"> <a href="" ng-click="isSelectorOpen = !isSelectorOpen" class=ng-table-group-selector> <strong class=sort-indicator>{{$selGroupTitle}}</strong> <button class="btn btn-default btn-xs ng-table-group-close" ng-click="$groupRow.show = false; $event.preventDefault(); $event.stopPropagation();"> <span class="glyphicon glyphicon-remove"></span> </button> <button class="btn btn-default btn-xs ng-table-group-toggle" ng-click="toggleDetail(); $event.preventDefault(); $event.stopPropagation();"> <span class=glyphicon ng-class="{\n \'glyphicon-resize-small\': params.settings().groupOptions.isExpanded,\n \'glyphicon-resize-full\': !params.settings().groupOptions.isExpanded\n }"></span> </button> </a> <div class=list-group ng-if=isSelectorOpen> <a href="" class=list-group-item ng-repeat="group in getGroupables()" ng-click=groupBy(group)> <strong>{{ getGroupTitle(group)}}</strong> <strong ng-class="isSelectedGroup(group) && \'sort-indicator\'"></strong> </a> </div> </th> </tr> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/header.html",a="<ng-table-group-row></ng-table-group-row> <ng-table-sorter-row></ng-table-sorter-row> <ng-table-filter-row></ng-table-filter-row> ",i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/pager.html",a='<div class="ng-cloak ng-table-pager" ng-if=params.data.length> <div ng-if=params.settings().counts.length class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type=button ng-class="{\'active\':params.count() == count}" ng-click=params.count(count) class="btn btn-default"> <span ng-bind=count></span> </button> </div> <ul ng-if=pages.length class="pagination ng-table-pagination"> <li class=page-item ng-class="{\'disabled\': !page.active && !page.current, \'active\': page.current}" ng-repeat="page in pages" ng-switch=page.type> <a class=page-link ng-switch-when=prev ng-click=params.page(page.number) href="">&laquo;</a> <a class=page-link ng-switch-when=first ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=page ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=more ng-click=params.page(page.number) href="">&#8230;</a> <a class=page-link ng-switch-when=last ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=next ng-click=params.page(page.number) href="">&raquo;</a> </li> </ul> </div> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/sorterRow.html",a="<tr class=ng-table-sort-header> <th title={{$column.headerTitle(this)}} ng-repeat=\"$column in $columns\" ng-class=\"{\n 'sortable': $column.sortable(this),\n 'sort-asc': params.sorting()[$column.sortable(this)]=='asc',\n 'sort-desc': params.sorting()[$column.sortable(this)]=='desc'\n }\" ng-click=\"sortBy($column, $event)\" ng-if=$column.show(this) ng-init=\"template = $column.headerTemplateURL(this)\" class=\"header {{$column.class(this)}}\"> <div ng-if=!template class=ng-table-header ng-class=\"{'sort-indicator': params.settings().sortingIndicator == 'div'}\"> <span ng-bind=$column.title(this) ng-class=\"{'sort-indicator': params.settings().sortingIndicator == 'span'}\"></span> </div> <div ng-if=template ng-include=template></div> </th> </tr> ",i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(2),o=n(1),l=a.module("ngTable",[i.default.name,o.default.name]);e.ngTable=l,r(n(2)),r(n(1))}]))});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("angular")):"function"==typeof define&&define.amd?define(["angular"],e):"object"==typeof exports?exports["ng-table"]=e(require("angular")):t["ng-table"]=e(t.angular)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=51)}([function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(3),s=n(37),o=n(7),l=n(10),u=n(9),c=n(8),p=a.module("ngTable-core",[]).provider("ngTableDefaultGetData",i.NgTableDefaultGetDataProvider).factory("ngTableDefaultGetGroups",s.ngTableDefaultGetGroups).value("ngTableDefaults",o.ngTableDefaults).service("ngTableEventsChannel",c.NgTableEventsChannel).service("ngTableSettings",l.NgTableSettings).run(u.NgTableParams.init);e.ngTableCoreModule=p,p.value("NgTableParams",u.NgTableParams);var g=n(7);e.IDefaults=g.IDefaults,r(n(8));var f=n(10);e.ISettings=f.ISettings,r(n(9)),r(n(3)),r(n(36)),r(n(39)),r(n(40)),r(n(41))},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(13),s=n(14),o=n(15),l=n(16);e.NgTableController=l.NgTableController;var u=n(17),c=n(18);e.NgTableFilterConfigProvider=c.NgTableFilterConfigProvider,e.NgTableFilterConfig=c.NgTableFilterConfig;var p=n(19),g=n(20),f=n(21),h=n(22),m=n(23),d=n(24),b=n(25),v=n(26);n(43),n(45),n(44),n(46),n(49),n(48);var $=a.module("ngTable-browser",[]).directive("ngTable",i.ngTable).service("ngTableColumn",s.NgTableColumn).directive("ngTableColumnsBinding",o.ngTableColumnsBinding).controller("ngTableController",l.NgTableController).directive("ngTableDynamic",u.ngTableDynamic).provider("ngTableFilterConfig",c.NgTableFilterConfigProvider).directive("ngTableFilterRow",p.ngTableFilterRow).controller("ngTableFilterRowController",g.NgTableFilterRowController).directive("ngTableGroupRow",f.ngTableGroupRow).controller("ngTableGroupRowController",h.NgTableGroupRowController).directive("ngTablePagination",m.ngTablePagination).directive("ngTableSelectFilterDs",d.ngTableSelectFilterDs).directive("ngTableSorterRow",b.ngTableSorterRow).controller("ngTableSorterRowController",v.NgTableSorterRowController);e.ngTableBrowserModule=$,r(n(27))},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}r(n(28)),r(n(29)),r(n(30)),r(n(31)),r(n(32))},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict";e.ngTableDefaults={params:{},settings:{}}},function(t,e,n){"use strict";var r=n(0),a=function(){function t(t){this.$rootScope=t;var e=this;e=this.addTableParamsEvent("afterCreated",e),e=this.addTableParamsEvent("afterReloadData",e),e=this.addTableParamsEvent("datasetChanged",e),e=this.addTableParamsEvent("pagesChanged",e),e=this.addTableParamsEvent("afterDataFiltered",e),e=this.addTableParamsEvent("afterDataSorted",e)}return t.prototype.addTableParamsEvent=function(t,e){var n=t.charAt(0).toUpperCase()+t.substring(1),a=(i={},i["on"+n]=this.createEventSubscriptionFn(t),i["publish"+n]=this.createPublishEventFn(t),i);return r.extend(e,a);var i},t.prototype.createPublishEventFn=function(t){var e=this;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r-0]=arguments[r];(a=e.$rootScope).$broadcast.apply(a,["ngTable:"+t].concat(n));var a}},t.prototype.createEventSubscriptionFn=function(t){function e(t){return t?n(t)?t:function(e){return e===t}:function(t){return!0}}function n(t){return"function"==typeof t}function r(t){return t&&"function"==typeof t.$new}var a=this;return function(n,i,s){var o,l=a.$rootScope;return r(i)?(l=i,o=e(s)):o=e(i),l.$on("ngTable:"+t,function(t,e){for(var r=[],a=2;a<arguments.length;a++)r[a-2]=arguments[a];if(!e.isNullInstance){var i=[e].concat(r);o.apply(this,i)&&n.apply(this,i)}})}},t.$inject=["$rootScope"],t}();e.NgTableEventsChannel=a},function(t,e,n){"use strict";function r(t){return!isNaN(parseFloat(t))&&isFinite(t)}var a=n(0),i=n(11),s=function(){function t(e,n){var r=this;this.data=[],this.defaultSettings=t.ngTableSettings.createDefaults(),this.isCommittedDataset=!1,this.initialEvents=[],this._params={page:1,count:10,filter:{},sorting:{},group:{}},this._settings=this.defaultSettings,"boolean"==typeof e&&(this.isNullInstance=!0),this.reloadPages=function(){var e;return function(){var n=e,i=r.generatePagesArray(r.page(),r.total(),r.count());a.equals(n,i)||(e=i,t.ngTableEventsChannel.publishPagesChanged(r,i,n))}}(),a.extend(this._params,t.ngTableDefaults.params),this.settings(n),this.parameters(e,!0),t.ngTableEventsChannel.publishAfterCreated(this),a.forEach(this.initialEvents,function(t){t()}),this.initialEvents=null}return t.prototype.count=function(t){return void 0!==t?this.parameters({count:t,page:1}):this._params.count},t.prototype.filter=function(t){if(null!=t&&"object"==typeof t)return this.parameters({filter:t,page:1});if(t===!0){for(var e=Object.keys(this._params.filter),n={},r=0;r<e.length;r++){var a=this._params.filter[e[r]];null!=a&&""!==a&&(n[e[r]]=a)}return n}return this._params.filter},t.prototype.generatePagesArray=function(t,e,n,r){arguments.length||(t=this.page(),e=this.total(),n=this.count());var a,i,s,o;r=r&&r<6?6:r;var l=[];if(o=Math.ceil(e/n),o>1){l.push({type:"prev",number:Math.max(1,t-1),active:t>1}),l.push({type:"first",number:1,active:t>1,current:1===t}),i=Math.round((this._settings.paginationMaxBlocks-this._settings.paginationMinBlocks)/2),s=Math.max(2,t-i),a=Math.min(o-1,t+2*i-(t-s)),s=Math.max(2,s-(2*i-(a-s)));for(var u=s;u<=a;)u===s&&2!==u||u===a&&u!==o-1?l.push({type:"more",active:!1}):l.push({type:"page",number:u,active:t!==u,current:t===u}),u++;l.push({type:"last",number:o,active:t!==o,current:t===o}),l.push({type:"next",number:Math.min(o,t+1),active:t<o})}return l},t.prototype.group=function(t,e){if(void 0===t)return this._params.group;var n={page:1};return i.isGroupingFun(t)&&void 0!==e?(t.sortDirection=e,n.group=t):"string"==typeof t&&void 0!==e?n.group=(r={},r[t]=e,r):n.group=t,this.parameters(n),this;var r},t.prototype.hasErrorState=function(){return!(!this.errParamsMemento||!a.equals(this.errParamsMemento,this.createComparableParams()))},t.prototype.hasFilter=function(){return Object.keys(this.filter(!0)).length>0},t.prototype.hasFilterChanges=function(){var t=this.prevParamsMemento&&this.prevParamsMemento.params.filter;return!a.equals(this._params.filter,t)||this.hasGlobalSearchFieldChanges()},t.prototype.hasGroup=function(t,e){return null==t?i.isGroupingFun(this._params.group)||Object.keys(this._params.group).length>0:i.isGroupingFun(t)?null==e?this._params.group===t:this._params.group===t&&t.sortDirection===e:null==e?Object.keys(this._params.group).indexOf(t)!==-1:this._params.group[t]===e},t.prototype.isDataReloadRequired=function(){return!this.isCommittedDataset||!a.equals(this.createComparableParams(),this.prevParamsMemento)||this.hasGlobalSearchFieldChanges()},t.prototype.isSortBy=function(t,e){return void 0!==e?void 0!==this._params.sorting[t]&&this._params.sorting[t]==e:void 0!==this._params.sorting[t]},t.prototype.orderBy=function(){return i.convertSortToOrderBy(this._params.sorting)},t.prototype.page=function(t){return void 0!==t?this.parameters({page:t}):this._params.page},t.prototype.parameters=function(t,e){if(e=e||!1,void 0!==typeof t){for(var n in t){var i=t[n];if(e&&n.indexOf("[")>=0){for(var s=n.split(/\[(.*)\]/).reverse(),o="",l=0,u=s.length;l<u;l++){var c=s[l];if(""!==c){var p=i;i={},i[o=c]=r(p)?parseFloat(p):p}}"sorting"===o&&(this._params[o]={}),this._params[o]=a.extend(this._params[o]||{},i[o])}else"group"===n?this._params[n]=this.parseGroup(t[n]):this._params[n]=r(t[n])?parseFloat(t[n]):t[n]}return this.log("ngTable: set parameters",this._params),this}return this._params},t.prototype.reload=function(){var e=this,n=null;if(this._settings.$loading=!0,this.prevParamsMemento=a.copy(this.createComparableParams()),this.isCommittedDataset=!0,this.hasGroup())n=this.runInterceptorPipeline(t.$q.when(this._settings.getGroups(this)));else{var r=this._settings.getData;n=this.runInterceptorPipeline(t.$q.when(r(this)))}this.log("ngTable: reload data");var i=this.data;return n.then(function(n){return e._settings.$loading=!1,e.errParamsMemento=null,e.data=n,t.ngTableEventsChannel.publishAfterReloadData(e,n,i),e.reloadPages(),n}).catch(function(n){return e.errParamsMemento=e.prevParamsMemento,t.$q.reject(n)})},t.prototype.settings=function(e){var n=this;if(a.isDefined(e)){var r=t.ngTableSettings.merge(this._settings,e),i=this._settings.dataset;this._settings=r;var s=e.hasOwnProperty("dataset")&&e.dataset!=i;if(s){this.isCommittedDataset&&this.page(1),this.isCommittedDataset=!1;var o=function(){t.ngTableEventsChannel.publishDatasetChanged(n,e.dataset,i)};this.initialEvents?this.initialEvents.push(o):o()}return this.log("ngTable: set settings",this._settings),this}return this._settings},t.prototype.sorting=function(t,e){return"string"==typeof t?(this.parameters({sorting:(n={},n[t]=e,n)}),this):void 0!==t?this.parameters({sorting:t}):this._params.sorting;var n},t.prototype.total=function(t){return void 0!==t?this.settings({total:t}):this._settings.total},t.prototype.url=function(t){function e(t,e){n(i)?i.push(e+"="+encodeURIComponent(t)):i[e]=encodeURIComponent(t)}function n(e){return t}function r(t,e){return"group"===e||void 0!==typeof t&&""!==t}t=t||!1;var i=t?[]:{};for(var s in this._params)if(this._params.hasOwnProperty(s)){var o=this._params[s],l=encodeURIComponent(s);if("object"==typeof o){for(var u in o)if(r(o[u],s)){var c=l+"["+encodeURIComponent(u)+"]";e(o[u],c)}}else!a.isFunction(o)&&r(o,s)&&e(o,l)}return i},t.prototype.createComparableParams=function(){var t=this._params.group;return{params:this._params,groupSortDirection:i.isGroupingFun(t)?t.sortDirection:void 0}},t.prototype.hasGlobalSearchFieldChanges=function(){var t=this._params.filter&&this._params.filter.$,e=this.prevParamsMemento&&this.prevParamsMemento.params.filter&&this.prevParamsMemento.params.filter.$;return!a.equals(t,e)},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];this._settings.debugMode&&t.$log.debug&&(r=t.$log).debug.apply(r,e);var r},t.prototype.parseGroup=function(t){var e=this._settings.groupOptions&&this._settings.groupOptions.defaultSort;if(t){if(i.isGroupingFun(t))return null==t.sortDirection&&(t.sortDirection=e),t;if("object"==typeof t){for(var n in t)null==t[n]&&(t[n]=e);return t}return r={},r[t]=e,r}return t;var r},t.prototype.runInterceptorPipeline=function(e){var n=this,r=this._settings.interceptors||[];return r.reduce(function(e,r){var a=r.response&&r.response.bind(r)||t.$q.when,i=r.responseError&&r.responseError.bind(r)||t.$q.reject;return e.then(function(t){return a(t,n)},function(t){return i(t,n)})},e)},t.init=function(e,n,r,a,i){t.$q=e,t.$log=n,t.ngTableDefaults=r,t.ngTableEventsChannel=a,t.ngTableSettings=i},t}();e.NgTableParams=s,s.init.$inject=["$q","$log","ngTableDefaults","ngTableEventsChannel","ngTableSettings"]},function(t,e,n){"use strict";var r=n(0),a=function(){function t(t,e,n){var r=this;this.ngTableDefaults=t,this.ngTableDefaultGetData=e,this.ngTableDefaultGetGroups=n,this.defaults={$loading:!1,dataset:null,total:0,defaultSort:"desc",counts:[10,25,50,100],filterOptions:{filterComparator:void 0,filterDelay:500,filterDelayThreshold:1e4,filterFilterName:void 0,filterFn:void 0,filterLayout:"stack"},getData:function(t){return r.ngTableDefaultGetData(t.settings().dataset,t)},getGroups:this.ngTableDefaultGetGroups,groupOptions:{defaultSort:"asc",isExpanded:!0},interceptors:[],paginationMaxBlocks:11,paginationMinBlocks:5,sortingIndicator:"span"}}return t.prototype.createDefaults=function(){return this.merge(this.defaults,this.ngTableDefaults.settings)},t.prototype.merge=function(t,e){e=r.extend({},e),e.filterOptions&&(e.filterOptions=r.extend({},t.filterOptions||{},e.filterOptions)),e.groupOptions&&(e.groupOptions=r.extend({},t.groupOptions||{},e.groupOptions)),r.isArray(e.dataset)&&(e.total=e.dataset.length);var n=r.extend({},t,e);return r.isArray(e.dataset)&&this.optimizeFilterDelay(n),r.extend({},t,e)},t.prototype.optimizeFilterDelay=function(t){t.filterOptions.filterDelay===this.defaults.filterOptions.filterDelay&&t.total<=t.filterOptions.filterDelayThreshold&&t.getData===this.defaults.getData&&(t.filterOptions.filterDelay=0)},t.$inject=["ngTableDefaults","ngTableDefaultGetData","ngTableDefaultGetGroups"],t}();e.NgTableSettings=a},function(t,e){"use strict";function n(t){var e=[];for(var n in t)e.push(("asc"===t[n]?"+":"-")+n);return e}function r(t){return"function"==typeof t}e.convertSortToOrderBy=n,e.isGroupingFun=r},,function(t,e,n){"use strict";function r(t,e){return{restrict:"A",priority:1001,scope:!0,controller:"ngTableController",compile:function(t){var n,r,i=[],s=0,o=[];if(a.forEach(t.find("tr"),function(t){o.push(a.element(t))}),n=o.filter(function(t){return!t.hasClass("ng-table-group")})[0],r=o.filter(function(t){return t.hasClass("ng-table-group")})[0],n)return a.forEach(n.find("td"),function(t){var n=a.element(t);if(!n.attr("ignore-cell")||"true"!==n.attr("ignore-cell")){var o=function(t){return n.attr("x-data-"+t)||n.attr("data-"+t)||n.attr(t)},l=function(t,e){n.attr("x-data-"+t)?n.attr("x-data-"+t,e):n.attr("data"+t)?n.attr("data"+t,e):n.attr(t,e)},u=function(t){var n=o(t);if(n){var r,a=function(t){return void 0!==r?r:e(n)(t)};return a.assign=function(t,a){var i=e(n);i.assign?i.assign(t.$parent,a):r=a},a}},c=o("title-alt")||o("title");c&&n.attr("data-title-text","{{"+c+"}}"),i.push({id:s++,title:u("title"),titleAlt:u("title-alt"),headerTitle:u("header-title"),sortable:u("sortable"),class:u("header-class"),filter:u("filter"),groupable:u("groupable"),headerTemplateURL:u("header"),filterData:u("filter-data"),show:n.attr("ng-if")?u("ng-if"):void 0}),(r||n.attr("ng-if"))&&l("ng-if","$columns["+(i.length-1)+"].show(this)")}}),function(t,e,n,r){t.$columns=i=r.buildColumns(i),r.setupBindingsToInternalScope(n.ngTable),r.loadFilterData(i),r.compileDirectiveTemplates()}}}}var a=n(0);r.$inject=["$q","$parse"],e.ngTable=r},function(t,e,n){"use strict";function r(t){return null!=t&&a.isFunction(t.$new)}var a=n(0),i=function(){function t(){}return t.prototype.buildColumn=function(t,e,n){var i=Object.create(t),s=this.createDefaults(),o=function(o){if(void 0===i[o]&&(i[o]=s[o]),!a.isFunction(i[o])){var l=function e(){return 1!==arguments.length||r(arguments[0])?t[o]:void e.assign(null,arguments[0])};l.assign=function(e,n){t[o]=n},i[o]=l}var u=i[o];if(i[o]=function(){if(1!==arguments.length||r(arguments[0])){var s=arguments[0]||e,o=Object.create(s);return a.extend(o,{$column:i,$columns:n}),u.call(t,o)}u.assign(e,arguments[0])},u.assign)i[o].assign=u.assign;else{var c,p=i[o],l=function t(){return 1!==arguments.length||r(arguments[0])?void 0!=c?c:p.apply(i,arguments):void t.assign(null,arguments[0])};l.assign=function(t,e){c=e},i[o]=l}};for(var l in s)o(l);return i},t.prototype.createDefaults=function(){return{class:this.createGetterSetter(""),filter:this.createGetterSetter(!1),groupable:this.createGetterSetter(!1),filterData:a.noop,headerTemplateURL:this.createGetterSetter(!1),headerTitle:this.createGetterSetter(""),sortable:this.createGetterSetter(!1),show:this.createGetterSetter(!0),title:this.createGetterSetter(""),titleAlt:this.createGetterSetter("")}},t.prototype.createGetterSetter=function(t){var e=t,n=function t(){return 1!==arguments.length||r(arguments[0])?e:void t.assign(null,arguments[0])};return n.assign=function(t,n){e=n},n},t.$inject=[],t}();e.NgTableColumn=i},function(t,e){"use strict";function n(t){function e(e,n,r){var a=t(r.ngTableColumnsBinding).assign;a&&e.$watch("$columns",function(t){var n=(t||[]).slice(0);a(e,n)})}var n={restrict:"A",link:e};return n}n.$inject=["$parse"],e.ngTableColumnsBinding=n},function(t,e,n){"use strict";var r=n(0),a=n(1),i=function(){function t(t,e,n,r,i,s,o,l,u){this.$scope=t,this.$parse=n,this.$compile=r,this.$attrs=i,this.$element=s,this.$document=o,this.ngTableColumn=l,this.ngTableEventsChannel=u;t.$filterRow={disabled:!1},t.$loading=!1,t.hasOwnProperty("params")||(t.params=new a.NgTableParams(!0)),this.delayFilter=function(){var t;return function(n,r){e.cancel(t),t=e(n,r)}}(),this.$scope.$watch("params",function(t,e){t!==e&&t&&t.reload()},!1),this.subscribeToTableEvents()}return Object.defineProperty(t.prototype,"hasVisibleFilterColumn",{get:function(){var t=this;return!!this.$scope.$columns&&this.some(this.$scope.$columns,function(e){return e.show(t.$scope)&&!!e.filter(t.$scope)})},enumerable:!0,configurable:!0}),t.prototype.onDataReloadStatusChange=function(t){if(t&&!this.$scope.params.hasErrorState()){var e=this.$scope.params,n=e.settings().filterOptions;if(e.hasFilterChanges()){var r=function(){e.page(1),e.reload()};n.filterDelay?this.delayFilter(r,n.filterDelay):r()}else e.reload()}},t.prototype.compileDirectiveTemplates=function(){if(!this.$element.hasClass("ng-table")){this.$scope.templates={header:this.$attrs.templateHeader?this.$attrs.templateHeader:"ng-table/header.html",pagination:this.$attrs.templatePagination?this.$attrs.templatePagination:"ng-table/pager.html"},this.$element.addClass("ng-table");var t=null,e=!1;r.forEach(this.$element.children(),function(t){"THEAD"===t.tagName&&(e=!0)}),e||(t=r.element('<thead ng-include="templates.header"></thead>',this.$document),this.$element.prepend(t));var n=r.element('<div ng-table-pagination="params" template-url="templates.pagination"></div>',this.$document);this.$element.after(n),t&&this.$compile(t)(this.$scope),this.$compile(n)(this.$scope)}},t.prototype.loadFilterData=function(t){function e(t){return t&&"object"==typeof t&&"function"==typeof t.then}var n=this;r.forEach(t,function(t){var a=t.filterData(n.$scope);return a?e(a)?(delete t.filterData,a.then(function(e){r.isArray(e)||r.isFunction(e)||r.isObject(e)||(e=[]),t.data=e})):t.data=a:void delete t.filterData})},t.prototype.buildColumns=function(t){var e=this,n=[];return(t||[]).forEach(function(t){n.push(e.ngTableColumn.buildColumn(t,e.$scope,n))}),n},t.prototype.parseNgTableDynamicExpr=function(t){if(!t||t.indexOf(" with ")>-1){var e=t.split(/\s+with\s+/);return{tableParams:e[0],columns:e[1]}}throw new Error("Parse error (expected example: ng-table-dynamic='tableParams with cols')")},t.prototype.setupBindingsToInternalScope=function(t){var e=this;this.$scope.$watch(t,function(t){void 0!==t&&(e.$scope.params=t)},!1),this.setupFilterRowBindingsToInternalScope(),this.setupGroupRowBindingsToInternalScope()},t.prototype.setupFilterRowBindingsToInternalScope=function(){var t=this;this.$attrs.showFilter?this.$scope.$parent.$watch(this.$attrs.showFilter,function(e){t.$scope.show_filter=e}):this.$scope.$watch(function(){return t.hasVisibleFilterColumn},function(e){t.$scope.show_filter=e}),this.$attrs.disableFilter&&this.$scope.$parent.$watch(this.$attrs.disableFilter,function(e){t.$scope.$filterRow.disabled=e})},t.prototype.setupGroupRowBindingsToInternalScope=function(){var t=this;if(this.$scope.$groupRow={show:!1},this.$attrs.showGroup){var e=this.$parse(this.$attrs.showGroup);this.$scope.$parent.$watch(e,function(e){t.$scope.$groupRow.show=e}),e.assign&&this.$scope.$watch("$groupRow.show",function(n){e.assign(t.$scope.$parent,n)})}else this.$scope.$watch("params.hasGroup()",function(e){t.$scope.$groupRow.show=e})},t.prototype.getVisibleColumns=function(){var t=this;return(this.$scope.$columns||[]).filter(function(e){return e.show(t.$scope)})},t.prototype.subscribeToTableEvents=function(){var t=this;this.$scope.$watch("params.isDataReloadRequired()",function(e){t.onDataReloadStatusChange(e)}),this.ngTableEventsChannel.onAfterReloadData(function(e,n){var r=t.getVisibleColumns();e.hasGroup()?(t.$scope.$groups=n||[],t.$scope.$groups.visibleColumnCount=r.length):(t.$scope.$data=n||[],t.$scope.$data.visibleColumnCount=r.length)},this.$scope,function(e){return t.$scope.params===e}),this.ngTableEventsChannel.onPagesChanged(function(e,n){t.$scope.pages=n},this.$scope,function(e){return t.$scope.params===e})},t.prototype.some=function(t,e){for(var n=!1,r=0;r<t.length;r++){var a=t[r];if(e(a)){n=!0;break}}return n},t.$inject=["$scope","$timeout","$parse","$compile","$attrs","$element","$document","ngTableColumn","ngTableEventsChannel"],t}();e.NgTableController=i},function(t,e,n){"use strict";function r(){return{restrict:"A",priority:1001,scope:!0,controller:"ngTableController",compile:function(t){var e;if(a.forEach(t.find("tr"),function(t){t=a.element(t),t.hasClass("ng-table-group")||e||(e=t)}),e)return a.forEach(e.find("td"),function(t){var e=a.element(t),n=function(t){return e.attr("x-data-"+t)||e.attr("data-"+t)||e.attr(t)},r=n("title");r||e.attr("data-title-text","{{$columns[$index].titleAlt(this) || $columns[$index].title(this)}}");var i=e.attr("ng-if");i||e.attr("ng-if","$columns[$index].show(this)")}),function(t,e,n,r){var a=r.parseNgTableDynamicExpr(n.ngTableDynamic);r.setupBindingsToInternalScope(a.tableParams),r.compileDirectiveTemplates(),t.$watchCollection(a.columns,function(e){t.$columns=r.buildColumns(e),r.loadFilterData(t.$columns)})}}}}var a=n(0);r.$inject=[],e.ngTableDynamic=r},function(t,e,n){"use strict";var r=n(0),a=function(){function t(t){var e=this;this.defaultConfig={defaultBaseUrl:"ng-table/filters/",defaultExt:".html",aliasUrls:{}},this.$get=function(){return t.instantiate(i,{config:r.copy(e.config)})},this.$get.$inject=[],this.resetConfigs()}return t.prototype.resetConfigs=function(){this.config=this.defaultConfig},t.prototype.setConfig=function(t){var e=r.extend({},this.config,t);e.aliasUrls=r.extend({},this.config.aliasUrls,t.aliasUrls),this.config=e},t}();e.NgTableFilterConfigProvider=a;var i=function(){function t(t){this.config=t}return t.prototype.getUrlForAlias=function(t,e){return this.config.aliasUrls[t]||this.config.defaultBaseUrl+t+this.config.defaultExt},t.prototype.getTemplateUrl=function(t,e){var n;return n="string"!=typeof t?t.id:t,n.indexOf("/")!==-1?n:this.getUrlForAlias(n,e)},t.$inject=["config"],t}();e.NgTableFilterConfig=i},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableFilterRowController",controllerAs:"$ctrl"};return t}var a=n(42);r.$inject=[],e.ngTableFilterRow=r},function(t,e){"use strict";var n=function(){function t(t,e){this.config=e,t.getFilterPlaceholderValue=this.getFilterPlaceholderValue.bind(this)}return t.prototype.getFilterCellCss=function(t,e){if("horizontal"!==e)return"s12";var n=Object.keys(t).length,r=parseInt((12/n).toString(),10);return"s"+r},t.prototype.getFilterPlaceholderValue=function(t,e){return"string"==typeof t?"":t.placeholder},t.$inject=["$scope","ngTableFilterConfig"],t}();e.NgTableFilterRowController=n},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableGroupRowController",controllerAs:"$ctrl"};return t}var a=n(47);r.$inject=[],e.ngTableGroupRow=r},function(t,e){"use strict";var n=function(){function t(t){var e=this;this.$scope=t,this.groupFns=[],t.$watch("params.group()",function(t){e.setGroup(t)},!0)}return t.prototype.getGroupables=function(){var t=this,e=this.$scope.$columns.filter(function(e){return!!e.groupable(t.$scope)});return this.groupFns.concat(e)},t.prototype.getGroupTitle=function(t){return this.isGroupingFunc(t)?t.title:t.title(this.$scope)},t.prototype.getVisibleColumns=function(){var t=this;return this.$scope.$columns.filter(function(e){return e.show(t.$scope)})},t.prototype.groupBy=function(t){this.isSelectedGroup(t)?this.changeSortDirection():this.isGroupingFunc(t)?this.$scope.params.group(t):this.$scope.params.group(t.groupable(this.$scope))},t.prototype.isSelectedGroup=function(t){return this.isGroupingFunc(t)?t===this.$scope.$selGroup:t.groupable(this.$scope)===this.$scope.$selGroup},t.prototype.toggleDetail=function(){return this.$scope.params.settings().groupOptions.isExpanded=!this.$scope.params.settings().groupOptions.isExpanded,this.$scope.params.reload()},t.prototype.changeSortDirection=function(){var t;t=this.$scope.params.hasGroup(this.$scope.$selGroup,"asc")?"desc":this.$scope.params.hasGroup(this.$scope.$selGroup,"desc")?"":"asc",this.$scope.params.group(this.$scope.$selGroup,t)},t.prototype.findGroupColumn=function(t){var e=this;return this.$scope.$columns.filter(function(n){return n.groupable(e.$scope)===t})[0]},t.prototype.isGroupingFunc=function(t){return"function"==typeof t},t.prototype.setGroup=function(t){var e=this.findGroupColumn(this.$scope.$selGroup);if(e&&e.show.assign&&e.show.assign(this.$scope,!0),this.isGroupingFunc(t))this.groupFns=[t],this.$scope.$selGroup=t,this.$scope.$selGroupTitle=t.title;else{var n=Object.keys(t||{})[0],r=this.findGroupColumn(n);r&&(this.$scope.$selGroupTitle=r.title(this.$scope),this.$scope.$selGroup=n,r.show.assign&&r.show.assign(this.$scope,!1))}},t.$inject=["$scope"],t}();e.NgTableGroupRowController=n},function(t,e,n){"use strict";function r(t,e,n){return{restrict:"A",scope:{params:"=ngTablePagination",templateUrl:"="},replace:!1,link:function(r,i){n.onAfterReloadData(function(t){r.pages=t.generatePagesArray()},r,function(t){return t===r.params}),r.$watch("templateUrl",function(n){if(void 0!==n){var s=a.element('<div ng-include="templateUrl"></div>',e);i.append(s),t(s)(r)}})}}}var a=n(0);r.$inject=["$compile","$document","ngTableEventsChannel"],e.ngTablePagination=r},function(t,e){"use strict";function n(){var t={restrict:"A",controller:r};return t}n.$inject=[],e.ngTableSelectFilterDs=n;var r=function(){function t(t,e,n,r){var a=this;this.$scope=t,this.$attrs=n,this.$q=r,this.$column=e(n.ngTableSelectFilterDs)(t),t.$watch(function(){return a.$column&&a.$column.data},function(){a.bindDataSource()})}return t.prototype.bindDataSource=function(){var t=this;this.getSelectListData(this.$column).then(function(e){e&&!t.hasEmptyOption(e)&&e.unshift({id:"",title:""}),e=e||[],t.$scope.$selectData=e})},t.prototype.hasEmptyOption=function(t){for(var e,n=0;n<t.length;n++){var r=t[n];if(r&&""===r.id){e=!0;break}}return e},t.prototype.getSelectListData=function(t){var e=t.data;return e instanceof Array?this.$q.when(e):this.$q.when(e&&e())},t.$inject=["$scope","$parse","$attrs","$q"],t}();e.NgTableSelectFilterDsController=r},function(t,e,n){"use strict";function r(){var t={restrict:"E",replace:!0,templateUrl:a,scope:!0,controller:"ngTableSorterRowController",controllerAs:"$ctrl"};return t}var a=n(50);r.$inject=[],e.ngTableSorterRow=r},function(t,e){"use strict";var n=function(){function t(t){this.$scope=t}return t.prototype.sortBy=function(t,e){var n=t.sortable&&t.sortable();if(n&&"string"==typeof n){var r=this.$scope.params.settings().defaultSort,a="asc"===r?"desc":"asc",i=this.$scope.params.sorting()&&this.$scope.params.sorting()[n]&&this.$scope.params.sorting()[n]===r,s=e.ctrlKey||e.metaKey?this.$scope.params.sorting():{};s[n]=i?a:r,this.$scope.params.parameters({sorting:s})}},t.$inject=["$scope"],t}();e.NgTableSorterRowController=n},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e,n){"use strict";var r=n(0),a=function(){function t(){function t(t,n){function a(n){var a=n.settings().filterOptions;return r.isFunction(a.filterFn)?a.filterFn:t(a.filterFilterName||e.filterFilterName)}function i(n){return t(e.sortingFilterName)}function s(t,e){if(!e.hasFilter())return t;var n=e.filter(!0),r=Object.keys(n),i=r.reduce(function(t,e){return t=c(t,n[e],e)},{}),s=a(e);return s.call(e,t,i,e.settings().filterOptions.filterComparator)}function o(t,e){var n=t.slice((e.page()-1)*e.count(),e.page()*e.count());return e.total(t.length),n}function l(t,e){var n=e.orderBy(),r=i(e);return n.length?r(t,n):t}function u(t,e){if(null==t)return[];var a=r.extend({},p,e.settings().dataOptions),i=a.applyFilter?s(t,e):t;n.publishAfterDataFiltered(e,i);var u=a.applySort?l(i,e):i;return n.publishAfterDataSorted(e,u),a.applyPaging?o(u,e):u}function c(t,e,n){var r=n.split("."),a=t,i=r[r.length-1],s=a,o=r.slice(0,r.length-1);return o.forEach(function(t){s.hasOwnProperty(t)||(s[t]={}),s=s[t]}),s[i]=e,a}var p={applyFilter:!0,applySort:!0,applyPaging:!0};return u.applyPaging=o,u.getFilterFn=a,u.getOrderByFn=i,u}this.filterFilterName="filter",this.sortingFilterName="orderBy";var e=this;this.$get=t,t.$inject=["$filter","ngTableEventsChannel"]}return t}();e.NgTableDefaultGetDataProvider=a},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}r(n(33)),r(n(34)),r(n(35))},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}r(n(4)),r(n(6)),r(n(5)),r(n(38))},function(t,e,n){"use strict";function r(t,e){function n(n){var r,o=n.group(),l=void 0;if(s.isGroupingFun(o))r=o,l=o.sortDirection;else{var u=Object.keys(o)[0];l=o[u],r=function(t){return a(t,u)}}var c=n.settings(),p=c.dataOptions;c.dataOptions={applyPaging:!1};var g=c.getData,f=t.when(g(n));return f.then(function(t){var a={};i.forEach(t,function(t){var e=r(t);a[e]=a[e]||{data:[],$hideRows:!c.groupOptions.isExpanded,value:e},a[e].data.push(t)});var o=[];for(var u in a)o.push(a[u]);if(l){var p=e.getOrderByFn(),g=s.convertSortToOrderBy({value:l});o=p(o,g)}return e.applyPaging(o,n)}).finally(function(){c.dataOptions=p})}return n}function a(t,e){var n;if(n="string"==typeof e?e.split("."):e,void 0!==t){if(0===n.length)return t;if(null!==t)return a(t[n[0]],n.slice(1))}}var i=n(0),s=n(11);r.$inject=["$q","ngTableDefaultGetData"],e.ngTableDefaultGetGroups=r},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}r(n(4)),r(n(6)),r(n(5))},function(t,e){"use strict"},function(t,e){"use strict"},function(t,e,n){var r="ng-table/filterRow.html",a='<tr ng-show=show_filter class=ng-table-filters> <th data-title-text="{{$column.titleAlt(this) || $column.title(this)}}" ng-repeat="$column in $columns" ng-if=$column.show(this) class="filter {{$column.class(this)}}" ng-class="params.settings().filterOptions.filterLayout === \'horizontal\' ? \'filter-horizontal\' : \'\'"> <div ng-repeat="(name, filter) in $column.filter(this)" ng-include=$ctrl.config.getTemplateUrl(filter) class=filter-cell ng-class="[$ctrl.getFilterCellCss($column.filter(this), params.settings().filterOptions.filterLayout), $last ? \'last\' : \'\']"> </div> </th> </tr> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/number.html",a='<input type=number name={{name}} ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/select-multiple.html",a='<select ng-options="data.id as data.title for data in $column.data" ng-disabled=$filterRow.disabled multiple=multiple ng-multiple=true ng-model=params.filter()[name] class="filter filter-select-multiple form-control" name={{name}}> </select> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/select.html",a='<select ng-options="data.id as data.title for data in $selectData" ng-table-select-filter-ds=$column ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="filter filter-select form-control" name={{name}}> <option style=display:none value=""></option> </select> ',i=n(0);i.module("ng").run(["$templateCache",function(t){
t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/filters/text.html",a='<input type=text name={{name}} ng-disabled=$filterRow.disabled ng-model=params.filter()[name] class="input-filter form-control" placeholder="{{getFilterPlaceholderValue(filter, name)}}"/> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/groupRow.html",a='<tr ng-if=params.hasGroup() ng-show=$groupRow.show class=ng-table-group-header> <th colspan={{$ctrl.getVisibleColumns().length}} class=sortable ng-class="{\n \'sort-asc\': params.hasGroup($selGroup, \'asc\'),\n \'sort-desc\':params.hasGroup($selGroup, \'desc\')\n }"> <a href="" ng-click="isSelectorOpen = !isSelectorOpen" class=ng-table-group-selector> <strong class=sort-indicator>{{$selGroupTitle}}</strong> <button class="btn btn-default btn-xs ng-table-group-close" ng-click="$groupRow.show = false; $event.preventDefault(); $event.stopPropagation();"> <span class="glyphicon glyphicon-remove"></span> </button> <button class="btn btn-default btn-xs ng-table-group-toggle" ng-click="$ctrl.toggleDetail(); $event.preventDefault(); $event.stopPropagation();"> <span class=glyphicon ng-class="{\n \'glyphicon-resize-small\': params.settings().groupOptions.isExpanded,\n \'glyphicon-resize-full\': !params.settings().groupOptions.isExpanded\n }"></span> </button> </a> <div class=list-group ng-if=isSelectorOpen> <a href="" class=list-group-item ng-repeat="group in $ctrl.getGroupables()" ng-click=$ctrl.groupBy(group)> <strong>{{ $ctrl.getGroupTitle(group)}}</strong> <strong ng-class="$ctrl.isSelectedGroup(group) && \'sort-indicator\'"></strong> </a> </div> </th> </tr> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/header.html",a="<ng-table-group-row></ng-table-group-row> <ng-table-sorter-row></ng-table-sorter-row> <ng-table-filter-row></ng-table-filter-row> ",i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/pager.html",a='<div class="ng-cloak ng-table-pager" ng-if=params.data.length> <div ng-if=params.settings().counts.length class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type=button ng-class="{\'active\':params.count() == count}" ng-click=params.count(count) class="btn btn-default"> <span ng-bind=count></span> </button> </div> <ul ng-if=pages.length class="pagination ng-table-pagination"> <li class=page-item ng-class="{\'disabled\': !page.active && !page.current, \'active\': page.current}" ng-repeat="page in pages" ng-switch=page.type> <a class=page-link ng-switch-when=prev ng-click=params.page(page.number) href="">&laquo;</a> <a class=page-link ng-switch-when=first ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=page ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=more ng-click=params.page(page.number) href="">&#8230;</a> <a class=page-link ng-switch-when=last ng-click=params.page(page.number) href=""><span ng-bind=page.number></span></a> <a class=page-link ng-switch-when=next ng-click=params.page(page.number) href="">&raquo;</a> </li> </ul> </div> ',i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){var r="ng-table/sorterRow.html",a="<tr class=ng-table-sort-header> <th title={{$column.headerTitle(this)}} ng-repeat=\"$column in $columns\" ng-class=\"{\n 'sortable': $column.sortable(this),\n 'sort-asc': params.sorting()[$column.sortable(this)]=='asc',\n 'sort-desc': params.sorting()[$column.sortable(this)]=='desc'\n }\" ng-click=\"$ctrl.sortBy($column, $event)\" ng-if=$column.show(this) ng-init=\"template = $column.headerTemplateURL(this)\" class=\"header {{$column.class(this)}}\"> <div ng-if=!template class=ng-table-header ng-class=\"{'sort-indicator': params.settings().sortingIndicator == 'div'}\"> <span ng-bind=$column.title(this) ng-class=\"{'sort-indicator': params.settings().sortingIndicator == 'span'}\"></span> </div> <div ng-if=template ng-include=template></div> </th> </tr> ",i=n(0);i.module("ng").run(["$templateCache",function(t){t.put(r,a)}]),t.exports=r},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var a=n(0),i=n(1),s=n(2),o=a.module("ngTable",[i.ngTableCoreModule.name,s.ngTableBrowserModule.name]);e.ngTableModule=o,r(n(1)),r(n(2))}])});
//# sourceMappingURL=ng-table.min.js.map

@@ -6,2 +6,3 @@ CONTRIBUTING

2. In locally cloned repo: `npm install && npm run setup`
* This will the build fro the library and all the demo apps
3. Prove existing code:

@@ -8,0 +9,0 @@ * Run the unit tests: `npm test`

/// <reference types="angular" />
import * as ng1 from 'angular';
declare const ngTable: ng1.IModule;
export { ngTable };
declare const ngTableModule: ng1.IModule;
export { ngTableModule };
export * from './src/core';
export * from './src/browser';
import * as ng1 from 'angular';
import coreModule from './src/core';
import browserModule from './src/browser';
var ngTable = ng1.module('ngTable', [coreModule.name, browserModule.name]);
export { ngTable };
import { ngTableCoreModule } from './src/core';
import { ngTableBrowserModule } from './src/browser';
var ngTableModule = ng1.module('ngTable', [ngTableCoreModule.name, ngTableBrowserModule.name]);
export { ngTableModule };
export * from './src/core';
export * from './src/browser';
//# sourceMappingURL=index.js.map
{
"name": "ng-table",
"version": "2.2.0",
"version": "3.0.0",
"author": "Vitalii Savchuk <esvit666@gmail.com>",

@@ -61,2 +61,3 @@ "license": "BSD",

"karma-jasmine": "1.0.2",
"karma-jasmine-diff-reporter": "^0.6.3",
"karma-phantomjs-launcher": "1.0.1",

@@ -86,3 +87,3 @@ "karma-spec-reporter": "0.0.26",

"validate-commit-msg": "^2.8.2",
"webpack": "^2.1.0-beta.25",
"webpack": "git+https://github.com/webpack/webpack.git#fbb8920f2ec8366659bb04de7c2c044a308a0925",
"webpack-dev-server": "^2.1.0-beta.9",

@@ -93,9 +94,13 @@ "webpack-merge": "^0.14.1",

"scripts": {
"build:all": "npm-run-all --parallel build:full tsc --serial build:demo-apps",
"build:all": "run-s build:full build:demo-apps",
"build:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run build\"",
"build": "webpack --progress --profile --env.debug",
"build:prod": "webpack --progress --profile --env.prod",
"build:full": "webpack --progress --profile --env.prod --env.debug",
"clean:all": "npm run clean && shx ls -d demo-apps/*/ | bulk -c \"npm run clean\"",
"clean": "shx rm -f index.d.ts src/browser/*.js src/browser/*.js.map src/browser/*.d.ts src/core/*.js src/core/*.js.map src/core/*.d.ts test/*.spec.js test/*.spec.js.map test/*.spec.d.ts demo-apps/ts-webpack/src/**/*.js demo-apps/ts-webpack/src/**/*.js.map",
"prebuild": "npm run clean",
"build": "run-p tsc \"webpack -- --progress --profile --env.debug\"",
"prebuild:prod": "npm run clean",
"build:prod": "run-p tsc \"webpack -- --progress --profile --env.prod\"",
"prebuild:full": "npm run clean",
"build:full": "run-p tsc \"webpack -- --progress --profile --env.prod --env.debug\"",
"clean:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run clean\"",
"clean:all": "run-p clean clean:demo-apps",
"clean": "shx rm -rf bundles out demo-site/api-docs *.d.ts *.js.map src/**/*.js src/**/*.js.map src/**/*.d.ts test/**/*.spec.js test/**/*.spec.js.map test/**/*.spec.d.ts",
"cm": "git add -A && git-cz",

@@ -114,3 +119,2 @@ "commitmsg": "validate-commit-msg",

"link:demo-apps": "shx ls -d demo-apps/*/ | bulk -c \"npm run linklocal\"",
"postmerge": "npm i && npm run update-webdriver",
"precommit": "npm run tsc",

@@ -120,5 +124,5 @@ "semantic-release": "semantic-release pre && npm publish && semantic-release post",

"serve:docs-site": "http-server demo-site -o -c-1",
"_setup:common": "npm-run-all --parallel build:full tsc --serial install:demo-apps link:demo-apps",
"_setup:common": "run-s build:full install:demo-apps link:demo-apps",
"setup:ci": "npm run _setup:common",
"setup": "npm-run-all --parallel _setup:common update-webdriver",
"setup": "run-p _setup:common update-webdriver",
"test": "karma start",

@@ -125,0 +129,0 @@ "test:w": "karma start --no-single-run --auto-watch",

@@ -99,3 +99,3 @@ Table + AngularJS

2. Install: `npm install`
3. Build: `npm run tsc && npm run build:full`
3. Build: `npm run build:full`

@@ -102,0 +102,0 @@ * To locally build and serve docs site: `npm run doc && npm run serve:docs-site`

/// <reference types="angular" />
import * as angular from 'angular';
import { NgTableController } from './ngTableController';
import { NgTableFilterConfigProvider, NgTableFilterConfig } from './ngTableFilterConfig';
import './filters/number.html';

@@ -9,4 +11,4 @@ import './filters/select.html';

import './header.html';
declare var _default: angular.IModule;
export default _default;
declare const ngTableBrowserModule: angular.IModule;
export * from './public-interfaces';
export { NgTableController, NgTableFilterConfigProvider, NgTableFilterConfig, ngTableBrowserModule };
import * as angular from 'angular';
import { ngTable } from './ngTable.directive';
import { ngTableColumn } from './ngTableColumn';
import { NgTableColumn } from './ngTableColumn';
import { ngTableColumnsBinding } from './ngTableColumnsBinding.directive';
import { ngTableController } from './ngTableController';
import { NgTableController } from './ngTableController';
import { ngTableDynamic } from './ngTableDynamic.directive';
import { ngTableFilterConfigProvider } from './ngTableFilterConfig';
import { NgTableFilterConfigProvider, NgTableFilterConfig } from './ngTableFilterConfig';
import { ngTableFilterRow } from './ngTableFilterRow.directive';
import { ngTableFilterRowController } from './ngTableFilterRowController';
import { NgTableFilterRowController } from './ngTableFilterRowController';
import { ngTableGroupRow } from './ngTableGroupRow.directive';
import { ngTableGroupRowController } from './ngTableGroupRowController';
import { NgTableGroupRowController } from './ngTableGroupRowController';
import { ngTablePagination } from './ngTablePagination.directive';
import { ngTableSelectFilterDs } from './ngTableSelectFilterDs.directive';
import { ngTableSorterRow } from './ngTableSorterRow.directive';
import { ngTableSorterRowController } from './ngTableSorterRowController';
import { NgTableSorterRowController } from './ngTableSorterRowController';
import './filters/number.html';

@@ -22,18 +22,19 @@ import './filters/select.html';

import './header.html';
export default angular.module('ngTable-browser', [])
var ngTableBrowserModule = angular.module('ngTable-browser', [])
.directive('ngTable', ngTable)
.factory('ngTableColumn', ngTableColumn)
.service('ngTableColumn', NgTableColumn)
.directive('ngTableColumnsBinding', ngTableColumnsBinding)
.controller('ngTableController', ngTableController)
.controller('ngTableController', NgTableController)
.directive('ngTableDynamic', ngTableDynamic)
.provider('ngTableFilterConfig', ngTableFilterConfigProvider)
.provider('ngTableFilterConfig', NgTableFilterConfigProvider)
.directive('ngTableFilterRow', ngTableFilterRow)
.controller('ngTableFilterRowController', ngTableFilterRowController)
.controller('ngTableFilterRowController', NgTableFilterRowController)
.directive('ngTableGroupRow', ngTableGroupRow)
.controller('ngTableGroupRowController', ngTableGroupRowController)
.controller('ngTableGroupRowController', NgTableGroupRowController)
.directive('ngTablePagination', ngTablePagination)
.directive('ngTableSelectFilterDs', ngTableSelectFilterDs)
.directive('ngTableSorterRow', ngTableSorterRow)
.controller('ngTableSorterRowController', ngTableSorterRowController);
.controller('ngTableSorterRowController', NgTableSorterRowController);
export * from './public-interfaces';
export { NgTableController, NgTableFilterConfigProvider, NgTableFilterConfig, ngTableBrowserModule };
//# sourceMappingURL=index.js.map

@@ -11,3 +11,3 @@ /// <reference types="angular" />

/**
* Directive that instantiates {@link ngTableController ngTableController}.
* Directive that instantiates {@link NgTableController NgTableController}.
* @ngdoc directive

@@ -14,0 +14,0 @@ * @name ngTable

import * as ng1 from 'angular';
ngTable.$inject = ['$q', '$parse'];
/**
* Directive that instantiates {@link ngTableController ngTableController}.
* Directive that instantiates {@link NgTableController NgTableController}.
* @ngdoc directive

@@ -29,12 +29,9 @@ * @name ngTable

compile: function (element) {
var columns = [], i = 0, dataRow, groupRow, rows = [];
var columns = [], i = 0, dataRow, groupRow;
var rows = [];
ng1.forEach(element.find('tr'), function (tr) {
rows.push(ng1.element(tr));
});
dataRow = rows.filter(function (tr) {
return !tr.hasClass('ng-table-group');
})[0];
groupRow = rows.filter(function (tr) {
return tr.hasClass('ng-table-group');
})[0];
dataRow = rows.filter(function (tr) { return !tr.hasClass('ng-table-group'); })[0];
groupRow = rows.filter(function (tr) { return tr.hasClass('ng-table-group'); })[0];
if (!dataRow) {

@@ -41,0 +38,0 @@ return undefined;

@@ -13,5 +13,6 @@ /// <reference types="angular" />

* @private
* Definition of the service used to construct a table $column used by {@link ngTable ngTable} directive
* Service to construct a $column definition used by {@link ngTable ngTable} directive
*/
export interface IColumnBuilder {
export declare class NgTableColumn<TCol extends IColumnDef | IDynamicTableColDef> {
static $inject: string[];
/**

@@ -25,8 +26,5 @@ * Creates a $column for use within a header template

*/
buildColumn(column: IColumnDef | IDynamicTableColDef, defaultScope: IScope, columns: Array<IColumnDef | IDynamicTableColDef>): IColumnDef | IDynamicTableColDef;
buildColumn(column: TCol, defaultScope: IScope, columns: IColumnDef[]): IColumnDef;
private createDefaults();
private createGetterSetter(initialValue);
}
/**
* @private
* Service to construct a $column definition used by {@link ngTable ngTable} directive
*/
export declare function ngTableColumn(): IColumnBuilder;

@@ -9,17 +9,28 @@ /**

import * as ng1 from 'angular';
ngTableColumn.$inject = [];
/**
* @private
*/
function isScopeLike(object) {
return object != null && ng1.isFunction(object.$new);
}
/**
* @private
* Service to construct a $column definition used by {@link ngTable ngTable} directive
*/
export function ngTableColumn() {
return {
buildColumn: buildColumn
};
//////////////
function buildColumn(column, defaultScope, columns) {
export var NgTableColumn = (function () {
function NgTableColumn() {
}
/**
* Creates a $column for use within a header template
*
* @param column the initial definition for $column to build
* @param defaultScope the $scope to supply to the $column getter methods when not supplied by caller
* @param columns a reference to the $columns array to make available on the context supplied to the
* $column getter methods
*/
NgTableColumn.prototype.buildColumn = function (column, defaultScope, columns) {
// note: we're not modifying the original column object. This helps to avoid unintended side affects
var extendedCol = Object.create(column);
var defaults = createDefaults();
for (var prop in defaults) {
var defaults = this.createDefaults();
var _loop_1 = function(prop) {
if (extendedCol[prop] === undefined) {

@@ -33,56 +44,71 @@ extendedCol[prop] = defaults[prop];

// as it ensure that any changes to the original object will be returned by the "getter"
(function (prop1) {
var getterSetter = function getterSetter() {
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterSetter.assign(null, arguments[0]);
}
else {
return column[prop1];
}
};
getterSetter.assign = function ($scope, value) {
column[prop1] = value;
};
extendedCol[prop1] = getterSetter;
})(prop);
var getterSetter = function getterSetter() {
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterSetter.assign(null, arguments[0]);
}
else {
return column[prop];
}
};
getterSetter.assign = function ($scope, value) {
column[prop] = value;
};
extendedCol[prop] = getterSetter;
}
(function (prop1) {
// satisfy the arguments expected by the function returned by parsedAttribute in the ngTable directive
var getterFn = extendedCol[prop1];
extendedCol[prop1] = function () {
// satisfy the arguments expected by the function returned by parsedAttribute in the ngTable directive
var getterFn = extendedCol[prop];
extendedCol[prop] = function () {
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterFn.assign(defaultScope, arguments[0]);
}
else {
var scope = arguments[0] || defaultScope;
var context = Object.create(scope);
ng1.extend(context, {
$column: extendedCol,
$columns: columns
});
return getterFn.call(column, context);
}
};
if (getterFn.assign) {
extendedCol[prop].assign = getterFn.assign;
}
else {
var wrappedGetterFn_1 = extendedCol[prop];
var localValue_1;
var getterSetter = function getterSetter() {
if (arguments.length === 1 && !isScopeLike(arguments[0])) {
getterFn.assign(null, arguments[0]);
getterSetter.assign(null, arguments[0]);
}
else {
var scope = arguments[0] || defaultScope;
var context = Object.create(scope);
ng1.extend(context, {
$column: extendedCol,
$columns: columns
});
return getterFn.call(column, context);
return localValue_1 != undefined ? localValue_1 : wrappedGetterFn_1.apply(extendedCol, arguments);
}
};
if (getterFn.assign) {
extendedCol[prop1].assign = getterFn.assign;
}
})(prop);
getterSetter.assign = function ($scope, value) {
localValue_1 = value;
};
extendedCol[prop] = getterSetter;
}
};
for (var prop in defaults) {
_loop_1(prop);
}
return extendedCol;
}
function createDefaults() {
};
NgTableColumn.prototype.createDefaults = function () {
return {
'class': createGetterSetter(''),
filter: createGetterSetter(false),
groupable: createGetterSetter(false),
'class': this.createGetterSetter(''),
filter: this.createGetterSetter(false),
groupable: this.createGetterSetter(false),
filterData: ng1.noop,
headerTemplateURL: createGetterSetter(false),
headerTitle: createGetterSetter(''),
sortable: createGetterSetter(false),
show: createGetterSetter(true),
title: createGetterSetter(''),
titleAlt: createGetterSetter('')
headerTemplateURL: this.createGetterSetter(false),
headerTitle: this.createGetterSetter(''),
sortable: this.createGetterSetter(false),
show: this.createGetterSetter(true),
title: this.createGetterSetter(''),
titleAlt: this.createGetterSetter('')
};
}
function createGetterSetter(initialValue) {
};
NgTableColumn.prototype.createGetterSetter = function (initialValue) {
var value = initialValue;

@@ -101,7 +127,6 @@ var getterSetter = function getterSetter() {

return getterSetter;
}
function isScopeLike(object) {
return object != null && ng1.isFunction(object.$new);
}
}
};
NgTableColumn.$inject = [];
return NgTableColumn;
}());
//# sourceMappingURL=ngTableColumn.js.map

@@ -25,3 +25,2 @@ /**

restrict: 'A',
require: 'ngTable',
link: linkFn

@@ -28,0 +27,0 @@ };

@@ -11,5 +11,5 @@ /// <reference types="angular" />

import { IAttributes, IAugmentedJQuery, ICompileService, IDocumentService, IParseService, IScope, ITimeoutService } from 'angular';
import { DataResults, GroupedDataResults, INgTableParams, IEventsChannel, IPageButton, ITableParamsConstructor } from '../core';
import { IColumnDef, ITableInputAttributes } from './public-interfaces';
import { IColumnBuilder } from './ngTableColumn';
import { DataResults, GroupedDataResults, NgTableParams, NgTableEventsChannel, IPageButton } from '../core';
import { IColumnDef, IDynamicTableColDef, ITableInputAttributes } from './public-interfaces';
import { NgTableColumn } from './ngTableColumn';
/**

@@ -35,3 +35,3 @@ * @private

};
params: INgTableParams<T>;
params: NgTableParams<T>;
}

@@ -41,2 +41,29 @@ /**

*/
export declare function ngTableController<T>($scope: ITableScope<T>, NgTableParams: ITableParamsConstructor<T>, $timeout: ITimeoutService, $parse: IParseService, $compile: ICompileService, $attrs: IAttributes & ITableInputAttributes, $element: IAugmentedJQuery, $document: IDocumentService, ngTableColumn: IColumnBuilder, ngTableEventsChannel: IEventsChannel): void;
export declare class NgTableController<TParams, TCol extends IColumnDef | IDynamicTableColDef> {
private $scope;
private $parse;
private $compile;
private $attrs;
private $element;
private $document;
private ngTableColumn;
private ngTableEventsChannel;
static $inject: string[];
private delayFilter;
private readonly hasVisibleFilterColumn;
constructor($scope: ITableScope<TParams>, $timeout: ITimeoutService, $parse: IParseService, $compile: ICompileService, $attrs: IAttributes & ITableInputAttributes, $element: IAugmentedJQuery, $document: IDocumentService, ngTableColumn: NgTableColumn<TCol>, ngTableEventsChannel: NgTableEventsChannel);
private onDataReloadStatusChange(newStatus);
compileDirectiveTemplates(): void;
loadFilterData($columns: IColumnDef[]): void;
buildColumns(columns: TCol[]): IColumnDef[];
parseNgTableDynamicExpr(attr: string): {
tableParams: string;
columns: string;
};
setupBindingsToInternalScope(tableParamsExpr: string): void;
private setupFilterRowBindingsToInternalScope();
private setupGroupRowBindingsToInternalScope();
private getVisibleColumns();
private subscribeToTableEvents();
private some<T>(array, predicate);
}

@@ -9,30 +9,61 @@ /**

import * as ng1 from 'angular';
ngTableController.$inject = [
'$scope', 'NgTableParams', '$timeout', '$parse', '$compile', '$attrs', '$element', '$document', 'ngTableColumn', 'ngTableEventsChannel'
];
import { NgTableParams } from '../core';
/**
* The controller for the {@link ngTable ngTable} and {@link ngTableDynamic ngTableDynamic} directives
*/
export function ngTableController($scope, NgTableParams, $timeout, $parse, $compile, $attrs, $element, $document, ngTableColumn, ngTableEventsChannel) {
var isFirstTimeLoad = true;
$scope.$filterRow = { disabled: false };
$scope.$loading = false;
// until such times as the directive uses an isolated scope, we need to ensure that the check for
// the params field only consults the "own properties" of the $scope. This is to avoid seeing the params
// field on a $scope higher up in the prototype chain
if (!$scope.hasOwnProperty("params")) {
$scope.params = new NgTableParams(true);
export var NgTableController = (function () {
function NgTableController($scope, $timeout, $parse, $compile, $attrs, $element, $document, ngTableColumn, ngTableEventsChannel) {
this.$scope = $scope;
this.$parse = $parse;
this.$compile = $compile;
this.$attrs = $attrs;
this.$element = $element;
this.$document = $document;
this.ngTableColumn = ngTableColumn;
this.ngTableEventsChannel = ngTableEventsChannel;
var isFirstTimeLoad = true;
$scope.$filterRow = { disabled: false };
$scope.$loading = false;
// until such times as the directive uses an isolated scope, we need to ensure that the check for
// the params field only consults the "own properties" of the $scope. This is to avoid seeing the params
// field on a $scope higher up in the prototype chain
if (!$scope.hasOwnProperty("params")) {
$scope.params = new NgTableParams(true);
}
this.delayFilter = (function () {
var timer;
return function (callback, ms) {
$timeout.cancel(timer);
timer = $timeout(callback, ms);
};
})();
// watch for when a new NgTableParams is bound to the scope
// CRITICAL: the watch must be for reference and NOT value equality; this is because NgTableParams maintains
// the current data page as a field. Checking this for value equality would be terrible for performance
// and potentially cause an error if the items in that array has circular references
this.$scope.$watch('params', function (newParams, oldParams) {
if (newParams === oldParams || !newParams) {
return;
}
newParams.reload();
}, false);
this.subscribeToTableEvents();
}
var delayFilter = (function () {
var timer;
return function (callback, ms) {
$timeout.cancel(timer);
timer = $timeout(callback, ms);
};
})();
function onDataReloadStatusChange(newStatus /*, oldStatus*/) {
if (!newStatus || $scope.params.hasErrorState()) {
Object.defineProperty(NgTableController.prototype, "hasVisibleFilterColumn", {
get: function () {
var _this = this;
if (!this.$scope.$columns)
return false;
return this.some(this.$scope.$columns, function ($column) {
return $column.show(_this.$scope) && !!$column.filter(_this.$scope);
});
},
enumerable: true,
configurable: true
});
NgTableController.prototype.onDataReloadStatusChange = function (newStatus /*, oldStatus*/) {
if (!newStatus || this.$scope.params.hasErrorState()) {
return;
}
var currentParams = $scope.params;
var currentParams = this.$scope.params;
var filterOptions = currentParams.settings().filterOptions;

@@ -45,3 +76,3 @@ if (currentParams.hasFilterChanges()) {

if (filterOptions.filterDelay) {
delayFilter(applyFilter, filterOptions.filterDelay);
this.delayFilter(applyFilter, filterOptions.filterDelay);
}

@@ -55,44 +86,34 @@ else {

}
}
// watch for when a new NgTableParams is bound to the scope
// CRITICAL: the watch must be for reference and NOT value equality; this is because NgTableParams maintains
// the current data page as a field. Checking this for value equality would be terrible for performance
// and potentially cause an error if the items in that array has circular references
$scope.$watch('params', function (newParams, oldParams) {
if (newParams === oldParams || !newParams) {
return;
}
newParams.reload();
}, false);
$scope.$watch('params.isDataReloadRequired()', onDataReloadStatusChange);
this.compileDirectiveTemplates = function () {
if (!$element.hasClass('ng-table')) {
$scope.templates = {
header: ($attrs.templateHeader ? $attrs.templateHeader : 'ng-table/header.html'),
pagination: ($attrs.templatePagination ? $attrs.templatePagination : 'ng-table/pager.html')
};
NgTableController.prototype.compileDirectiveTemplates = function () {
if (!this.$element.hasClass('ng-table')) {
this.$scope.templates = {
header: (this.$attrs.templateHeader ? this.$attrs.templateHeader : 'ng-table/header.html'),
pagination: (this.$attrs.templatePagination ? this.$attrs.templatePagination : 'ng-table/pager.html')
};
$element.addClass('ng-table');
this.$element.addClass('ng-table');
var headerTemplate = null;
// $element.find('> thead').length === 0 doesn't work on jqlite
var theadFound = false;
ng1.forEach($element.children(), function (e) {
var theadFound_1 = false;
ng1.forEach(this.$element.children(), function (e) {
if (e.tagName === 'THEAD') {
theadFound = true;
theadFound_1 = true;
}
});
if (!theadFound) {
headerTemplate = ng1.element('<thead ng-include="templates.header"></thead>', $document);
$element.prepend(headerTemplate);
if (!theadFound_1) {
headerTemplate = ng1.element('<thead ng-include="templates.header"></thead>', this.$document);
this.$element.prepend(headerTemplate);
}
var paginationTemplate = ng1.element('<div ng-table-pagination="params" template-url="templates.pagination"></div>', $document);
$element.after(paginationTemplate);
var paginationTemplate = ng1.element('<div ng-table-pagination="params" template-url="templates.pagination"></div>', this.$document);
this.$element.after(paginationTemplate);
if (headerTemplate) {
$compile(headerTemplate)($scope);
this.$compile(headerTemplate)(this.$scope);
}
$compile(paginationTemplate)($scope);
this.$compile(paginationTemplate)(this.$scope);
}
};
this.loadFilterData = function ($columns) {
NgTableController.prototype.loadFilterData = function ($columns) {
var _this = this;
ng1.forEach($columns, function ($column) {
var result = $column.filterData($scope);
var result = $column.filterData(_this.$scope);
if (!result) {

@@ -121,10 +142,12 @@ delete $column.filterData;

};
this.buildColumns = function (columns) {
NgTableController.prototype.buildColumns = function (columns) {
var _this = this;
// todo: use strictNullChecks and remove guard clause
var result = [];
(columns || []).forEach(function (col) {
result.push(ngTableColumn.buildColumn(col, $scope, result));
result.push(_this.ngTableColumn.buildColumn(col, _this.$scope, result));
});
return result;
};
this.parseNgTableDynamicExpr = function (attr) {
NgTableController.prototype.parseNgTableDynamicExpr = function (attr) {
if (!attr || attr.indexOf(" with ") > -1) {

@@ -141,44 +164,47 @@ var parts = attr.split(/\s+with\s+/);

};
this.setupBindingsToInternalScope = function (tableParamsExpr) {
NgTableController.prototype.setupBindingsToInternalScope = function (tableParamsExpr) {
// note: this we're setting up watches to simulate angular's isolated scope bindings
var _this = this;
// note: is REALLY important to watch for a change to the ngTableParams *reference* rather than
// $watch for value equivalence. This is because ngTableParams references the current page of data as
// a field and it's important not to watch this
$scope.$watch(tableParamsExpr, function (params) {
this.$scope.$watch(tableParamsExpr, function (params) {
if (params === undefined) {
return;
}
$scope.params = params;
_this.$scope.params = params;
}, false);
setupFilterRowBindingsToInternalScope();
setupGroupRowBindingsToInternalScope();
this.setupFilterRowBindingsToInternalScope();
this.setupGroupRowBindingsToInternalScope();
};
function setupFilterRowBindingsToInternalScope() {
if ($attrs.showFilter) {
$scope.$parent.$watch($attrs.showFilter, function (value) {
$scope.show_filter = value;
NgTableController.prototype.setupFilterRowBindingsToInternalScope = function () {
var _this = this;
if (this.$attrs.showFilter) {
this.$scope.$parent.$watch(this.$attrs.showFilter, function (value) {
_this.$scope.show_filter = value;
});
}
else {
$scope.$watch(hasVisibleFilterColumn, function (value) {
$scope.show_filter = value;
this.$scope.$watch(function () { return _this.hasVisibleFilterColumn; }, function (value) {
_this.$scope.show_filter = value;
});
}
if ($attrs.disableFilter) {
$scope.$parent.$watch($attrs.disableFilter, function (value) {
$scope.$filterRow.disabled = value;
if (this.$attrs.disableFilter) {
this.$scope.$parent.$watch(this.$attrs.disableFilter, function (value) {
_this.$scope.$filterRow.disabled = value;
});
}
}
function setupGroupRowBindingsToInternalScope() {
$scope.$groupRow = { show: false };
if ($attrs.showGroup) {
var showGroupGetter = $parse($attrs.showGroup);
$scope.$parent.$watch(showGroupGetter, function (value) {
$scope.$groupRow.show = value;
};
NgTableController.prototype.setupGroupRowBindingsToInternalScope = function () {
var _this = this;
this.$scope.$groupRow = { show: false };
if (this.$attrs.showGroup) {
var showGroupGetter_1 = this.$parse(this.$attrs.showGroup);
this.$scope.$parent.$watch(showGroupGetter_1, function (value) {
_this.$scope.$groupRow.show = value;
});
if (showGroupGetter.assign) {
if (showGroupGetter_1.assign) {
// setup two-way databinding thus allowing ngTableGrowRow to assign to the showGroup expression
$scope.$watch('$groupRow.show', function (value) {
showGroupGetter.assign($scope.$parent, value);
this.$scope.$watch('$groupRow.show', function (value) {
showGroupGetter_1.assign(_this.$scope.$parent, value);
});

@@ -188,20 +214,34 @@ }

else {
$scope.$watch('params.hasGroup()', function (newValue) {
$scope.$groupRow.show = newValue;
this.$scope.$watch('params.hasGroup()', function (newValue) {
_this.$scope.$groupRow.show = newValue;
});
}
}
function getVisibleColumns() {
return ($scope.$columns || []).filter(function (c) {
return c.show($scope);
};
NgTableController.prototype.getVisibleColumns = function () {
var _this = this;
return (this.$scope.$columns || []).filter(function (c) {
return c.show(_this.$scope);
});
}
function hasVisibleFilterColumn() {
if (!$scope.$columns)
return false;
return some($scope.$columns, function ($column) {
return $column.show($scope) && !!$column.filter($scope);
};
NgTableController.prototype.subscribeToTableEvents = function () {
var _this = this;
this.$scope.$watch('params.isDataReloadRequired()', function (newStatus /*, oldStatus*/) {
_this.onDataReloadStatusChange(newStatus);
});
}
function some(array, predicate) {
this.ngTableEventsChannel.onAfterReloadData(function (params, newDatapage) {
var visibleColumns = _this.getVisibleColumns();
if (params.hasGroup()) {
_this.$scope.$groups = (newDatapage || []);
_this.$scope.$groups.visibleColumnCount = visibleColumns.length;
}
else {
_this.$scope.$data = (newDatapage || []);
_this.$scope.$data.visibleColumnCount = visibleColumns.length;
}
}, this.$scope, function (publisher) { return _this.$scope.params === publisher; });
this.ngTableEventsChannel.onPagesChanged(function (params, newPages) {
_this.$scope.pages = newPages;
}, this.$scope, function (publisher) { return _this.$scope.params === publisher; });
};
NgTableController.prototype.some = function (array, predicate) {
var found = false;

@@ -216,21 +256,8 @@ for (var i = 0; i < array.length; i++) {

return found;
}
function commonInit() {
ngTableEventsChannel.onAfterReloadData(function (params, newDatapage) {
var visibleColumns = getVisibleColumns();
if (params.hasGroup()) {
$scope.$groups = (newDatapage || []);
$scope.$groups.visibleColumnCount = visibleColumns.length;
}
else {
$scope.$data = (newDatapage || []);
$scope.$data.visibleColumnCount = visibleColumns.length;
}
}, $scope, function (publisher) { return $scope.params === publisher; });
ngTableEventsChannel.onPagesChanged(function (params, newPages) {
$scope.pages = newPages;
}, $scope, function (publisher) { return $scope.params === publisher; });
}
commonInit();
}
};
NgTableController.$inject = [
'$scope', '$timeout', '$parse', '$compile', '$attrs', '$element', '$document', 'ngTableColumn', 'ngTableEventsChannel'
];
return NgTableController;
}());
//# sourceMappingURL=ngTableController.js.map

@@ -0,6 +1,46 @@

/// <reference types="angular" />
import { IServiceProvider, auto } from 'angular';
import { IFilterConfigValues, IFilterTemplateDef } from './public-interfaces';
/**
* The angular provider used to configure the behaviour of the `ngTableFilterConfig` service.
*
* Implements the {@link IFilterConfigProvider IFilterConfigProvider} interface
* The angular provider used to configure the behaviour of the `NgTableFilterConfig` service.
*/
export declare function ngTableFilterConfigProvider(): void;
export declare class NgTableFilterConfigProvider implements IServiceProvider {
static $inject: ['$injector'];
$get: () => NgTableFilterConfig;
private config;
private defaultConfig;
constructor($injector: auto.IInjectorService);
/**
* Reset back to factory defaults the config values that `NgTableFilterConfig` service will use
*/
resetConfigs(): void;
/**
* Set the config values used by `NgTableFilterConfig` service
*/
setConfig(customConfig: IFilterConfigValues): void;
}
/**
* Exposes configuration values and methods used to return the location of the html
* templates used to render the filter row of an ng-table directive
*/
export declare class NgTableFilterConfig {
/**
* Readonly copy of the final values used to configure the service.
*/
readonly config: IFilterConfigValues;
static $inject: string[];
constructor(
/**
* Readonly copy of the final values used to configure the service.
*/
config: IFilterConfigValues);
/**
* Return the url of the html filter template registered with the alias supplied
*/
getUrlForAlias(aliasName: string, filterKey?: string): string;
/**
* Return the url of the html filter template for the supplied definition and key.
* For more information see the documentation for {@link IFilterTemplateMap}
*/
getTemplateUrl(filterDef: string | IFilterTemplateDef, filterKey?: string): string;
}

@@ -9,66 +9,73 @@ /**

import * as ng1 from 'angular';
ngTableFilterConfigProvider.$inject = [];
/**
* The angular provider used to configure the behaviour of the `ngTableFilterConfig` service.
*
* Implements the {@link IFilterConfigProvider IFilterConfigProvider} interface
* The angular provider used to configure the behaviour of the `NgTableFilterConfig` service.
*/
export function ngTableFilterConfigProvider() {
var config;
var defaultConfig = {
defaultBaseUrl: 'ng-table/filters/',
defaultExt: '.html',
aliasUrls: {}
export var NgTableFilterConfigProvider = (function () {
function NgTableFilterConfigProvider($injector) {
var _this = this;
this.defaultConfig = {
defaultBaseUrl: 'ng-table/filters/',
defaultExt: '.html',
aliasUrls: {}
};
this.$get = function () {
return $injector.instantiate(NgTableFilterConfig, { config: ng1.copy(_this.config) });
};
this.$get.$inject = [];
this.resetConfigs();
}
/**
* Reset back to factory defaults the config values that `NgTableFilterConfig` service will use
*/
NgTableFilterConfigProvider.prototype.resetConfigs = function () {
this.config = this.defaultConfig;
};
this.$get = ngTableFilterConfig;
this.resetConfigs = resetConfigs;
this.setConfig = setConfig;
init();
/////////
function init() {
resetConfigs();
/**
* Set the config values used by `NgTableFilterConfig` service
*/
NgTableFilterConfigProvider.prototype.setConfig = function (customConfig) {
var mergeConfig = ng1.extend({}, this.config, customConfig);
mergeConfig.aliasUrls = ng1.extend({}, this.config.aliasUrls, customConfig.aliasUrls);
this.config = mergeConfig;
};
return NgTableFilterConfigProvider;
}());
/**
* Exposes configuration values and methods used to return the location of the html
* templates used to render the filter row of an ng-table directive
*/
export var NgTableFilterConfig = (function () {
function NgTableFilterConfig(
/**
* Readonly copy of the final values used to configure the service.
*/
config) {
this.config = config;
}
function resetConfigs() {
config = defaultConfig;
}
function setConfig(customConfig) {
var mergeConfig = ng1.extend({}, config, customConfig);
mergeConfig.aliasUrls = ng1.extend({}, config.aliasUrls, customConfig.aliasUrls);
config = mergeConfig;
}
/////////
ngTableFilterConfig.$inject = [];
function ngTableFilterConfig() {
var publicConfig;
var service = {
config: publicConfig,
getTemplateUrl: getTemplateUrl,
getUrlForAlias: getUrlForAlias
};
Object.defineProperty(service, "config", {
get: function () {
return publicConfig = publicConfig || ng1.copy(config);
},
enumerable: true
});
return service;
/////////
function getTemplateUrl(filterDef, filterKey) {
var filterName;
if (typeof filterDef !== 'string') {
filterName = filterDef.id;
}
else {
filterName = filterDef;
}
if (filterName.indexOf('/') !== -1) {
return filterName;
}
return service.getUrlForAlias(filterName, filterKey);
/**
* Return the url of the html filter template registered with the alias supplied
*/
NgTableFilterConfig.prototype.getUrlForAlias = function (aliasName, filterKey) {
return this.config.aliasUrls[aliasName] || this.config.defaultBaseUrl + aliasName + this.config.defaultExt;
};
/**
* Return the url of the html filter template for the supplied definition and key.
* For more information see the documentation for {@link IFilterTemplateMap}
*/
NgTableFilterConfig.prototype.getTemplateUrl = function (filterDef, filterKey) {
var filterName;
if (typeof filterDef !== 'string') {
filterName = filterDef.id;
}
function getUrlForAlias(aliasName, filterKey) {
return config.aliasUrls[aliasName] || config.defaultBaseUrl + aliasName + config.defaultExt;
else {
filterName = filterDef;
}
}
}
if (filterName.indexOf('/') !== -1) {
return filterName;
}
return this.getUrlForAlias(filterName, filterKey);
};
NgTableFilterConfig.$inject = ['config'];
return NgTableFilterConfig;
}());
//# sourceMappingURL=ngTableFilterConfig.js.map

@@ -15,2 +15,3 @@ /**

controller: string;
controllerAs: string;
};

@@ -24,3 +24,4 @@ /**

scope: true,
controller: 'ngTableFilterRowController'
controller: 'ngTableFilterRowController',
controllerAs: '$ctrl'
};

@@ -27,0 +28,0 @@ return directive;

@@ -10,3 +10,4 @@ /// <reference types="angular" />

import { IScope } from 'angular';
import { IFilterConfig, IFilterTemplateDef, IFilterTemplateDefMap } from './public-interfaces';
import { IFilterTemplateDef, IFilterTemplateDefMap } from './public-interfaces';
import { NgTableFilterConfig } from './ngTableFilterConfig';
/**

@@ -16,4 +17,2 @@ * @private

export interface IScopeExtensions {
config: IFilterConfig;
getFilterCellCss(filter: IFilterTemplateDefMap, layout: string): string;
getFilterPlaceholderValue(filterDef: string | IFilterTemplateDef, filterKey?: string): string;

@@ -24,2 +23,8 @@ }

*/
export declare function ngTableFilterRowController($scope: IScope & IScopeExtensions, ngTableFilterConfig: IFilterConfig): void;
export declare class NgTableFilterRowController {
static $inject: string[];
config: NgTableFilterConfig;
constructor($scope: IScope & IScopeExtensions, ngTableFilterConfig: NgTableFilterConfig);
getFilterCellCss(filter: IFilterTemplateDefMap, layout: string): string;
getFilterPlaceholderValue(filterDef: string | IFilterTemplateDef, filterKey?: string): string;
}

@@ -8,9 +8,15 @@ /**

*/
ngTableFilterRowController.$inject = ['$scope', 'ngTableFilterConfig'];
/**
* Controller for the {@link ngTableFilterRow ngTableFilterRow} directive
*/
export function ngTableFilterRowController($scope, ngTableFilterConfig) {
$scope.config = ngTableFilterConfig;
$scope.getFilterCellCss = function (filter, layout) {
export var NgTableFilterRowController = (function () {
function NgTableFilterRowController($scope, ngTableFilterConfig) {
this.config = ngTableFilterConfig;
// todo: stop doing this. Why?
// * scope inheritance makes it hard to know how supplies functions
// * scope is not a concept in angular 2
// make function available to filter templates
$scope.getFilterPlaceholderValue = this.getFilterPlaceholderValue.bind(this);
}
NgTableFilterRowController.prototype.getFilterCellCss = function (filter, layout) {
if (layout !== 'horizontal') {

@@ -23,3 +29,3 @@ return 's12';

};
$scope.getFilterPlaceholderValue = function (filterDef, filterKey) {
NgTableFilterRowController.prototype.getFilterPlaceholderValue = function (filterDef, filterKey) {
if (typeof filterDef === 'string') {

@@ -32,3 +38,5 @@ return '';

};
}
NgTableFilterRowController.$inject = ['$scope', 'ngTableFilterConfig'];
return NgTableFilterRowController;
}());
//# sourceMappingURL=ngTableFilterRowController.js.map

@@ -25,3 +25,3 @@ /**

controller: 'ngTableGroupRowController',
controllerAs: 'dctrl'
controllerAs: '$ctrl'
};

@@ -28,0 +28,0 @@ return directive;

@@ -19,3 +19,12 @@ /// <reference types="angular" />

$selGroupTitle: string;
getGroupables(): Array<IGroupingFunc<any> | IColumnDef>;
}
/**
* Controller for the {@link ngTableGroupRow ngTableGroupRow} directive
*/
export declare class NgTableGroupRowController<T> {
private $scope;
static $inject: string[];
private groupFns;
constructor($scope: ITableScope<T> & IScopeExtensions<T>);
getGroupables(): (IGroupingFunc<any> | IColumnDef)[];
getGroupTitle(group: IGroupingFunc<any> | IColumnDef): string;

@@ -25,7 +34,7 @@ getVisibleColumns(): IColumnDef[];

isSelectedGroup(group: IGroupingFunc<any> | IColumnDef): boolean;
toggleDetail(): IPromise<Array<DataResult<T>>>;
toggleDetail(): IPromise<DataResult[]>;
private changeSortDirection();
private findGroupColumn(groupKey);
private isGroupingFunc(val);
private setGroup(grouping);
}
/**
* Controller for the {@link ngTableGroupRow ngTableGroupRow} directive
*/
export declare function ngTableGroupRowController<T>($scope: ITableScope<T> & IScopeExtensions<T>): void;

@@ -8,57 +8,33 @@ /**

*/
ngTableGroupRowController.$inject = ['$scope'];
/**
* Controller for the {@link ngTableGroupRow ngTableGroupRow} directive
*/
export function ngTableGroupRowController($scope) {
var groupFns = [];
init();
function init() {
$scope.getGroupables = getGroupables;
$scope.getGroupTitle = getGroupTitle;
$scope.getVisibleColumns = getVisibleColumns;
$scope.groupBy = groupBy;
$scope.isSelectedGroup = isSelectedGroup;
$scope.toggleDetail = toggleDetail;
$scope.$watch('params.group()', setGroup, true);
export var NgTableGroupRowController = (function () {
function NgTableGroupRowController($scope) {
var _this = this;
this.$scope = $scope;
this.groupFns = [];
$scope.$watch('params.group()', function (newGrouping) {
_this.setGroup(newGrouping);
}, true);
}
function changeSortDirection() {
var newDirection;
if ($scope.params.hasGroup($scope.$selGroup, 'asc')) {
newDirection = 'desc';
NgTableGroupRowController.prototype.getGroupables = function () {
var _this = this;
var groupableCols = this.$scope.$columns.filter(function ($column) { return !!$column.groupable(_this.$scope); });
return this.groupFns.concat(groupableCols);
};
NgTableGroupRowController.prototype.getGroupTitle = function (group) {
return this.isGroupingFunc(group) ? group.title : group.title(this.$scope);
};
NgTableGroupRowController.prototype.getVisibleColumns = function () {
var _this = this;
return this.$scope.$columns.filter(function ($column) { return $column.show(_this.$scope); });
};
NgTableGroupRowController.prototype.groupBy = function (group) {
if (this.isSelectedGroup(group)) {
this.changeSortDirection();
}
else if ($scope.params.hasGroup($scope.$selGroup, 'desc')) {
newDirection = '';
}
else {
newDirection = 'asc';
}
$scope.params.group($scope.$selGroup, newDirection);
}
function findGroupColumn(groupKey) {
return $scope.$columns.filter(function ($column) {
return $column.groupable($scope) === groupKey;
})[0];
}
function getGroupTitle(group) {
return isGroupingFunc(group) ? group.title : group.title($scope);
}
function getGroupables() {
var groupableCols = $scope.$columns.filter(function ($column) {
return !!$column.groupable($scope);
});
return groupFns.concat(groupableCols);
}
function getVisibleColumns() {
return $scope.$columns.filter(function ($column) {
return $column.show($scope);
});
}
function groupBy(group) {
if (isSelectedGroup(group)) {
changeSortDirection();
}
else {
if (isGroupingFunc(group)) {
$scope.params.group(group);
if (this.isGroupingFunc(group)) {
this.$scope.params.group(group);
}

@@ -69,26 +45,47 @@ else {

// columns that return (truthy) strings
$scope.params.group(group.groupable($scope));
this.$scope.params.group(group.groupable(this.$scope));
}
}
}
function isGroupingFunc(val) {
return typeof val === 'function';
}
function isSelectedGroup(group) {
if (isGroupingFunc(group)) {
return group === $scope.$selGroup;
};
NgTableGroupRowController.prototype.isSelectedGroup = function (group) {
if (this.isGroupingFunc(group)) {
return group === this.$scope.$selGroup;
}
else {
return group.groupable($scope) === $scope.$selGroup;
return group.groupable(this.$scope) === this.$scope.$selGroup;
}
}
function setGroup(grouping) {
var existingGroupCol = findGroupColumn($scope.$selGroup);
};
NgTableGroupRowController.prototype.toggleDetail = function () {
this.$scope.params.settings().groupOptions.isExpanded = !this.$scope.params.settings().groupOptions.isExpanded;
return this.$scope.params.reload();
};
NgTableGroupRowController.prototype.changeSortDirection = function () {
var newDirection;
if (this.$scope.params.hasGroup(this.$scope.$selGroup, 'asc')) {
newDirection = 'desc';
}
else if (this.$scope.params.hasGroup(this.$scope.$selGroup, 'desc')) {
newDirection = '';
}
else {
newDirection = 'asc';
}
this.$scope.params.group(this.$scope.$selGroup, newDirection);
};
NgTableGroupRowController.prototype.findGroupColumn = function (groupKey) {
var _this = this;
return this.$scope.$columns.filter(function ($column) { return $column.groupable(_this.$scope) === groupKey; })[0];
};
NgTableGroupRowController.prototype.isGroupingFunc = function (val) {
return typeof val === 'function';
};
NgTableGroupRowController.prototype.setGroup = function (grouping) {
var existingGroupCol = this.findGroupColumn(this.$scope.$selGroup);
if (existingGroupCol && existingGroupCol.show.assign) {
existingGroupCol.show.assign($scope, true);
existingGroupCol.show.assign(this.$scope, true);
}
if (isGroupingFunc(grouping)) {
groupFns = [grouping];
$scope.$selGroup = grouping;
$scope.$selGroupTitle = grouping.title;
if (this.isGroupingFunc(grouping)) {
this.groupFns = [grouping];
this.$scope.$selGroup = grouping;
this.$scope.$selGroupTitle = grouping.title;
}

@@ -98,17 +95,15 @@ else {

var groupKey = Object.keys(grouping || {})[0];
var groupedColumn = findGroupColumn(groupKey);
var groupedColumn = this.findGroupColumn(groupKey);
if (groupedColumn) {
$scope.$selGroupTitle = groupedColumn.title($scope);
$scope.$selGroup = groupKey;
this.$scope.$selGroupTitle = groupedColumn.title(this.$scope);
this.$scope.$selGroup = groupKey;
if (groupedColumn.show.assign) {
groupedColumn.show.assign($scope, false);
groupedColumn.show.assign(this.$scope, false);
}
}
}
}
function toggleDetail() {
$scope.params.settings().groupOptions.isExpanded = !$scope.params.settings().groupOptions.isExpanded;
return $scope.params.reload();
}
}
};
NgTableGroupRowController.$inject = ['$scope'];
return NgTableGroupRowController;
}());
//# sourceMappingURL=ngTableGroupRowController.js.map

@@ -10,3 +10,3 @@ /// <reference types="angular" />

import * as ng1 from 'angular';
import { IEventsChannel } from '../core';
import { NgTableEventsChannel } from '../core';
/**

@@ -16,2 +16,2 @@ * Directive that renders the table pagination controls

*/
export declare function ngTablePagination<T>($compile: ng1.ICompileService, $document: ng1.IDocumentService, ngTableEventsChannel: IEventsChannel): ng1.IDirective;
export declare function ngTablePagination<T>($compile: ng1.ICompileService, $document: ng1.IDocumentService, ngTableEventsChannel: NgTableEventsChannel): ng1.IDirective;

@@ -10,3 +10,16 @@ /// <reference types="angular" />

import * as ng1 from 'angular';
import { IColumnDef, ISelectOption } from './public-interfaces';
/**
* @private
*/
export interface IInputAttributes extends ng1.IAttributes {
ngTableSelectFilterDs: string;
}
/**
* @private
*/
export interface IScopeExtensions {
$selectData: ISelectOption[];
}
/**
* Takes the array returned by $column.filterData and makes it available as `$selectData` on the `$scope`.

@@ -18,6 +31,18 @@ *

* This directive is is focused on providing a datasource to an `ngOptions` directive
* @ngdoc directive
*/
declare function ngTableSelectFilterDs(): ng1.IDirective;
/**
* @private
*/
declare function ngTableSelectFilterDs(): ng1.IDirective;
export declare class NgTableSelectFilterDsController {
private $scope;
private $attrs;
private $q;
static $inject: string[];
$column: IColumnDef;
constructor($scope: ng1.IScope & IScopeExtensions, $parse: ng1.IParseService, $attrs: IInputAttributes, $q: ng1.IQService);
private bindDataSource();
private hasEmptyOption(data);
private getSelectListData($column);
}
export { ngTableSelectFilterDs };

@@ -16,4 +16,2 @@ /**

* This directive is is focused on providing a datasource to an `ngOptions` directive
* @ngdoc directive
* @private
*/

@@ -25,26 +23,29 @@ function ngTableSelectFilterDs() {

restrict: 'A',
controller: ngTableSelectFilterDsController
controller: NgTableSelectFilterDsController
};
return directive;
}
ngTableSelectFilterDsController.$inject = ['$scope', '$parse', '$attrs', '$q'];
function ngTableSelectFilterDsController($scope, $parse, $attrs, $q) {
var $column;
init();
function init() {
$column = $parse($attrs.ngTableSelectFilterDs)($scope);
$scope.$watch(function () {
return $column && $column.data;
}, bindDataSource);
/**
* @private
*/
export var NgTableSelectFilterDsController = (function () {
function NgTableSelectFilterDsController($scope, $parse, $attrs, $q) {
var _this = this;
this.$scope = $scope;
this.$attrs = $attrs;
this.$q = $q;
this.$column = $parse($attrs.ngTableSelectFilterDs)($scope);
$scope.$watch(function () { return _this.$column && _this.$column.data; }, function () { _this.bindDataSource(); });
}
function bindDataSource() {
getSelectListData($column).then(function (data) {
if (data && !hasEmptyOption(data)) {
NgTableSelectFilterDsController.prototype.bindDataSource = function () {
var _this = this;
this.getSelectListData(this.$column).then(function (data) {
if (data && !_this.hasEmptyOption(data)) {
data.unshift({ id: '', title: '' });
}
data = data || [];
$scope.$selectData = data;
_this.$scope.$selectData = data;
});
}
function hasEmptyOption(data) {
};
NgTableSelectFilterDsController.prototype.hasEmptyOption = function (data) {
var isMatch;

@@ -59,14 +60,16 @@ for (var i = 0; i < data.length; i++) {

return isMatch;
}
function getSelectListData($column) {
};
NgTableSelectFilterDsController.prototype.getSelectListData = function ($column) {
var dataInput = $column.data;
if (dataInput instanceof Array) {
return $q.when(dataInput);
return this.$q.when(dataInput);
}
else {
return $q.when(dataInput && dataInput());
return this.$q.when(dataInput && dataInput());
}
}
}
};
NgTableSelectFilterDsController.$inject = ['$scope', '$parse', '$attrs', '$q'];
return NgTableSelectFilterDsController;
}());
export { ngTableSelectFilterDs };
//# sourceMappingURL=ngTableSelectFilterDs.directive.js.map

@@ -15,2 +15,3 @@ /**

controller: string;
controllerAs: string;
};

@@ -24,3 +24,4 @@ /**

scope: true,
controller: 'ngTableSorterRowController'
controller: 'ngTableSorterRowController',
controllerAs: '$ctrl'
};

@@ -27,0 +28,0 @@ return directive;

@@ -15,8 +15,2 @@ /// <reference types="angular" />

*/
export interface IScopeExtensions {
sortBy($column: IColumnDef, event: IAugmentedMouseEvent): void;
}
/**
* @private
*/
export interface IAugmentedMouseEvent extends IAngularEvent {

@@ -29,2 +23,7 @@ ctrlKey: boolean;

*/
export declare function ngTableSorterRowController<T>($scope: ITableScope<T> & IScopeExtensions): void;
export declare class NgTableSorterRowController<T> {
private $scope;
static $inject: string[];
constructor($scope: ITableScope<T>);
sortBy($column: IColumnDef, event: IAugmentedMouseEvent): void;
}

@@ -1,9 +0,9 @@

ngTableSorterRowController.$inject = ['$scope'];
/**
* Controller for the {@link ngTableSorterRow ngTableSorterRow} directive
*/
export function ngTableSorterRowController($scope) {
$scope.sortBy = sortBy;
///////////
function sortBy($column, event) {
export var NgTableSorterRowController = (function () {
function NgTableSorterRowController($scope) {
this.$scope = $scope;
}
NgTableSorterRowController.prototype.sortBy = function ($column, event) {
var parsedSortable = $column.sortable && $column.sortable();

@@ -14,13 +14,15 @@ if (!parsedSortable || typeof parsedSortable !== 'string') {

else {
var defaultSort = $scope.params.settings().defaultSort;
var defaultSort = this.$scope.params.settings().defaultSort;
var inverseSort = (defaultSort === 'asc' ? 'desc' : 'asc');
var sorting = $scope.params.sorting() && $scope.params.sorting()[parsedSortable] && ($scope.params.sorting()[parsedSortable] === defaultSort);
var sortingParams = (event.ctrlKey || event.metaKey) ? $scope.params.sorting() : {};
var sorting = this.$scope.params.sorting() && this.$scope.params.sorting()[parsedSortable] && (this.$scope.params.sorting()[parsedSortable] === defaultSort);
var sortingParams = (event.ctrlKey || event.metaKey) ? this.$scope.params.sorting() : {};
sortingParams[parsedSortable] = (sorting ? inverseSort : defaultSort);
$scope.params.parameters({
this.$scope.params.parameters({
sorting: sortingParams
});
}
}
}
};
NgTableSorterRowController.$inject = ['$scope'];
return NgTableSorterRowController;
}());
//# sourceMappingURL=ngTableSorterRowController.js.map

@@ -15,2 +15,3 @@ /// <reference types="angular" />

(context?: ColumnFieldContext): T;
(value: T): void;
assign($scope: IScope, value: T): void;

@@ -174,16 +175,2 @@ }

/**
* The angular provider used to configure the behaviour of the `ngTableFilterConfig` service
*/
export interface IFilterConfigProvider {
$get: IFilterConfig;
/**
* Reset back to factory defaults the config values that `ngTableFilterConfig` service will use
*/
resetConfigs(): void;
/**
* Set the config values used by `ngTableFilterConfig` service
*/
setConfig(customConfig: IFilterConfigValues): void;
}
/**
* A key value-pair map where the key is the name of a field in a data row and the value is the definition

@@ -222,21 +209,2 @@ * for the template used to render a filter cell in the header of a html table.

}
/**
* Exposes configuration values and methods used to return the location of the html
* templates used to render the filter row of an ng-table directive
*/
export interface IFilterConfig {
/**
* Readonly copy of the final values used to configure the service.
*/
config: IFilterConfigValues;
/**
* Return the url of the html filter template for the supplied definition and key.
* For more information see the documentation for {@link IFilterTemplateMap}
*/
getTemplateUrl(filterDef: string | IFilterTemplateDef, filterKey?: string): string;
/**
* Return the url of the html filter template registered with the alias supplied
*/
getUrlForAlias(aliasName: string, filterKey?: string): string;
}
export declare type SelectData = ISelectOption[] | ISelectDataFunc;

@@ -268,14 +236,1 @@ /**

}
/**
* The public members of the {@link ngTableController}
*/
export interface ITableController {
buildColumns(columns: Array<IColumnDef | IDynamicTableColDef>): IColumnDef[];
compileDirectiveTemplates(): void;
loadFilterData($columns: IColumnDef[]): IPromise<SelectData> | SelectData;
parseNgTableDynamicExpr(expr: string): {
tableParams: string;
columns: string;
};
setupBindingsToInternalScope(tableParamsExpr?: string): void;
}
/// <reference types="angular" />
import * as angular from 'angular';
declare var _default: angular.IModule;
export default _default;
export * from './public-interfaces';
declare const ngTableCoreModule: angular.IModule;
export { ngTableCoreModule };
export { IDefaults } from './ngTableDefaults';
export * from './ngTableEventsChannel';
export { ISettings } from './ngTableSettings';
export * from './ngTableParams';
export * from './data';
export * from './filtering';
export * from './grouping/publicExports';
export * from './paging';
export * from './sorting';
import * as angular from 'angular';
import { ngTableDefaultGetDataProvider } from './ngTableDefaultGetData';
import { NgTableDefaultGetDataProvider } from './data';
import { ngTableDefaultGetGroups } from './grouping';
import { ngTableDefaults } from './ngTableDefaults';
import { ngTableParamsFactory } from './ngTableParams';
import { ngTableEventsChannel } from './ngTableEventsChannel';
export default angular.module('ngTable-core', [])
.provider('ngTableDefaultGetData', ngTableDefaultGetDataProvider)
import { NgTableSettings } from './ngTableSettings';
import { NgTableParams } from './ngTableParams';
import { NgTableEventsChannel } from './ngTableEventsChannel';
var ngTableCoreModule = angular.module('ngTable-core', [])
.provider('ngTableDefaultGetData', NgTableDefaultGetDataProvider)
.factory('ngTableDefaultGetGroups', ngTableDefaultGetGroups)
.value('ngTableDefaults', ngTableDefaults)
.factory('NgTableParams', ngTableParamsFactory)
.factory('ngTableEventsChannel', ngTableEventsChannel);
export * from './public-interfaces';
.service('ngTableEventsChannel', NgTableEventsChannel)
.service('ngTableSettings', NgTableSettings)
.run(NgTableParams.init);
// note: if you are using ES6 or typescript prefer:
// import { NgTableParams } from 'ng-table';
ngTableCoreModule.value('NgTableParams', NgTableParams);
export { ngTableCoreModule };
export * from './ngTableEventsChannel';
export * from './ngTableParams';
export * from './data';
export * from './filtering';
export * from './grouping/publicExports';
export * from './paging';
export * from './sorting';
//# sourceMappingURL=index.js.map

@@ -8,7 +8,15 @@ /**

*/
import { IDefaults } from './public-interfaces';
import { IParamValues } from './ngTableParams';
import { ISettings } from './ngTableSettings';
/**
* An angular value object that allow for overriding of the initial default values used when constructing
* an instance of `NgTableParams`
*/
export interface IDefaults {
params?: IParamValues<any>;
settings?: ISettings<any>;
}
/**
* Default values for ngTable
* @ngdoc object
*/
export declare var ngTableDefaults: IDefaults;
export declare let ngTableDefaults: IDefaults;

@@ -10,3 +10,2 @@ /**

* Default values for ngTable
* @ngdoc object
*/

@@ -13,0 +12,0 @@ export var ngTableDefaults = {

@@ -10,7 +10,203 @@ /// <reference types="angular" />

import * as ng1 from 'angular';
import { IEventsChannel } from './public-interfaces';
import { IScope } from 'angular';
import { DataResult } from './data';
import { IPageButton } from './paging';
import { NgTableParams } from './ngTableParams';
/**
* Implementation of the {@link IEventsChannel IEventsChannel} interface
* @ngdoc service
* Alias for the types that can be used to filter events
*/
export declare function ngTableEventsChannel($rootScope: ng1.IRootScopeService): IEventsChannel;
export declare type EventSelector<T> = NgTableParams<T> | IEventSelectorFunc;
/**
* Signature of the event hander that is registered to receive the *afterCreated* event
*/
export interface IAfterCreatedListener {
(publisher: NgTableParams<any>): any;
}
/**
* Signature of the event hander that is registered to receive the *afterReloadData* event
*/
export interface IAfterReloadDataListener<T> {
(publisher: NgTableParams<T>, newData: DataResult<T>[], oldData: DataResult<T>[]): any;
}
/**
* Signature of the event hander that is registered to receive the *datasetChanged* event
*/
export interface IDatasetChangedListener<T> {
(publisher: NgTableParams<T>, newDataset: T[], oldDataset: T[]): any;
}
/**
* Signature of the function used to filter the events to only specific instances of
* {@link NgTableParams}
*/
export interface IEventSelectorFunc {
(publisher: NgTableParams<any>): boolean;
}
/**
* Signature of the event hander that is registered to receive the *pagesChanged* event
*/
export interface IPagesChangedListener {
(publisher: NgTableParams<any>, newPages: IPageButton[], oldPages: IPageButton[]): any;
}
/**
* Signature of the event hander that is registered to receive the *afterDataFiltered* event
*/
export interface IAfterDataFilteredListener<T> {
(publisher: NgTableParams<T>, newData: DataResult<T>[]): any;
}
/**
* Signature of the event hander that is registered to receive the *afterDataSorted* event
*/
export interface IAfterDataSortedListener<T> {
(publisher: NgTableParams<T>, newData: DataResult<T>[]): any;
}
/**
* Signature of the function used to explicitly unregister an event handler so that it stops
* receiving notifications
*/
export interface IUnregistrationFunc {
(): void;
}
/**
* Strongly typed pub/sub for {@link NgTableParams}
*
* Supported events:
*
* * afterCreated - raised when a new instance of {@link NgTableParams} has finished being constructed
* * afterReloadData - raised when the {@link NgTableParams} `reload` method has finished loading new data
* * datasetChanged - raised when {@link ISettings} `dataset` receives a new data array
* * pagesChanged - raised when a new pages array has been generated
*/
export interface NgTableEventsChannel {
/**
* Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed.
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a
* `scope` to have angular automatically unregister the listener when the `scope` is destroyed.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterCreated(listener: IAfterCreatedListener, scope: IScope, eventFilter?: IEventSelectorFunc): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed.
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterCreated(listener: IAfterCreatedListener, eventFilter?: IEventSelectorFunc): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a
* `scope` to have angular automatically unregister the listener when the `scope` is destroyed.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterReloadData<T>(listener: IAfterReloadDataListener<T>, scope: IScope, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterReloadData<T>(listener: IAfterReloadDataListener<T>, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance.
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a
* `scope` to have angular automatically unregister the listener when the `scope` is destroyed.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onDatasetChanged<T>(listener: IDatasetChangedListener<T>, scope: IScope, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance.
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onDatasetChanged<T>(listener: IDatasetChangedListener<T>, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a
* `scope` to have angular automatically unregister the listener when the `scope` is destroyed.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onPagesChanged<T>(listener: IPagesChangedListener, scope: IScope, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onPagesChanged<T>(listener: IPagesChangedListener, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a `ngTableDefaultGetData` instance filters data
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter either the specific `IDefaultGetData` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterDataFiltered<T>(listener: IAfterDataFilteredListener<T>, scope: IScope, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a `ngTableDefaultGetData` instance filters data
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter either the specific `IDefaultGetData` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterDataFiltered<T>(listener: IAfterDataFilteredListener<T>, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a `ngTableDefaultGetData` instance orders data
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param scope the angular `$scope` that will limit the lifetime of the event subscription
* @param eventFilter either the specific `IDefaultGetData` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterDataSorted<T>(listener: IAfterDataSortedListener<T>, scope: IScope, eventFilter?: EventSelector<T>): IUnregistrationFunc;
/**
* Subscribe to receive notification whenever a `ngTableDefaultGetData` instance orders data
* Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called.
*
* @param listener the function that will be called when the event fires
* @param eventFilter either the specific `IDefaultGetData` instance you want to receive events for or a predicate function that should return true to receive the event
* @return a unregistration function that when called will unregister the `listener`
*/
onAfterDataSorted<T>(listener: IAfterDataSortedListener<T>, eventFilter?: EventSelector<T>): IUnregistrationFunc;
publishAfterCreated<T>(publisher: NgTableParams<T>): void;
publishAfterReloadData<T>(publisher: NgTableParams<T>, newData: T[], oldData: T[]): void;
publishDatasetChanged<T>(publisher: NgTableParams<T>, newDataset: T[], oldDataset: T[]): void;
publishPagesChanged<T>(publisher: NgTableParams<T>, newPages: IPageButton[], oldPages: IPageButton[]): void;
publishAfterDataFiltered<T>(publisher: NgTableParams<T>, newData: T[]): void;
publishAfterDataSorted<T>(params: NgTableParams<T>, newData: T[]): void;
}
export declare class NgTableEventsChannel {
private $rootScope;
static $inject: string[];
constructor($rootScope: ng1.IRootScopeService);
private addTableParamsEvent(eventName, target);
private createPublishEventFn(eventName);
private createEventSubscriptionFn(eventName);
}

@@ -9,22 +9,18 @@ /**

import * as ng1 from 'angular';
ngTableEventsChannel.$inject = ['$rootScope'];
/**
* Implementation of the {@link IEventsChannel IEventsChannel} interface
* @ngdoc service
*/
export function ngTableEventsChannel($rootScope) {
var events = {};
events = addTableParamsEvent('afterCreated', events);
events = addTableParamsEvent('afterReloadData', events);
events = addTableParamsEvent('datasetChanged', events);
events = addTableParamsEvent('pagesChanged', events);
events = addTableParamsEvent('afterDataFiltered', events);
events = addTableParamsEvent('afterDataSorted', events);
return events;
//////////
function addTableParamsEvent(eventName, target) {
export var NgTableEventsChannel = (function () {
function NgTableEventsChannel($rootScope) {
this.$rootScope = $rootScope;
var events = this;
events = this.addTableParamsEvent('afterCreated', events);
events = this.addTableParamsEvent('afterReloadData', events);
events = this.addTableParamsEvent('datasetChanged', events);
events = this.addTableParamsEvent('pagesChanged', events);
events = this.addTableParamsEvent('afterDataFiltered', events);
events = this.addTableParamsEvent('afterDataSorted', events);
}
NgTableEventsChannel.prototype.addTableParamsEvent = function (eventName, target) {
var fnName = eventName.charAt(0).toUpperCase() + eventName.substring(1);
var event = (_a = {},
_a['on' + fnName] = createEventSubscriptionFn(eventName),
_a['publish' + fnName] = createPublishEventFn(eventName),
_a['on' + fnName] = this.createEventSubscriptionFn(eventName),
_a['publish' + fnName] = this.createPublishEventFn(eventName),
_a

@@ -34,7 +30,19 @@ );

var _a;
}
function createEventSubscriptionFn(eventName) {
return function subscription(handler, eventSelectorOrScope, eventSelector) {
};
NgTableEventsChannel.prototype.createPublishEventFn = function (eventName) {
var _this = this;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
(_a = _this.$rootScope).$broadcast.apply(_a, ['ngTable:' + eventName].concat(args));
var _a;
};
};
NgTableEventsChannel.prototype.createEventSubscriptionFn = function (eventName) {
var _this = this;
return function (handler, eventSelectorOrScope, eventSelector) {
var actualEvtSelector;
var scope = $rootScope;
var scope = _this.$rootScope;
if (isScopeLike(eventSelectorOrScope)) {

@@ -79,13 +87,6 @@ scope = eventSelectorOrScope;

}
}
function createPublishEventFn(eventName) {
return function publish() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
$rootScope.$broadcast.apply($rootScope, ['ngTable:' + eventName].concat(args));
};
}
}
};
NgTableEventsChannel.$inject = ['$rootScope'];
return NgTableEventsChannel;
}());
//# sourceMappingURL=ngTableEventsChannel.js.map

@@ -11,7 +11,237 @@ /// <reference types="angular" />

import * as ng1 from 'angular';
import { IDefaults, IDefaultGetData, IEventsChannel, IParamValues, ISettings, INgTableParams } from './public-interfaces';
import { IPromise } from 'angular';
import { IDefaults } from './ngTableDefaults';
import { NgTableEventsChannel } from './ngTableEventsChannel';
import { NgTableSettings, ISettings } from './ngTableSettings';
import { DataResult } from './data';
import { IFilterValues } from './filtering';
import { Grouping, IGroupingFunc, GroupSort, IGroupValues } from './grouping';
import { ISortingValues } from './sorting';
import { IPageButton } from './paging';
/**
* Implmenentation of the {@link INgTableParams INgTableParams} interface
* @ngdoc service
* @private
*/
export declare function ngTableParamsFactory<T>($q: ng1.IQService, $log: ng1.ILogService, $filter: ng1.IFilterService, ngTableDefaults: IDefaults, ngTableDefaultGetData: IDefaultGetData<any>, ngTableEventsChannel: IEventsChannel): <T>(baseParameters: boolean | IParamValues<T>, baseSettings: ISettings<T>) => INgTableParams<T>;
export interface InternalTableParams<T> extends NgTableParams<T> {
isNullInstance: boolean;
}
/**
* The runtime values for {@link NgTableParams} that determine the set of data rows and
* how they are to be displayed in a table
*/
export interface IParamValues<T> {
/**
* The index of the "slice" of data rows, starting at 1, to be displayed by the table.
*/
page?: number;
/**
* The number of data rows per page
*/
count?: number;
/**
* The filter that should be applied to restrict the set of data rows
*/
filter?: IFilterValues;
/**
* The sort order that should be applied to the data rows.
*/
sorting?: ISortingValues;
/**
* The grouping that should be applied to the data rows
*/
group?: string | Grouping<T>;
}
/**
* Parameters manager for an ngTable directive
*/
export declare class NgTableParams<T> {
/**
* The page of data rows currently being displayed in the table
*/
data: T[];
reloadPages: () => void;
private defaultSettings;
private errParamsMemento;
private isCommittedDataset;
isNullInstance: boolean;
private initialEvents;
private prevParamsMemento;
private _params;
private _settings;
constructor(baseParameters?: IParamValues<T> | boolean, baseSettings?: ISettings<T>);
/**
* Returns the number of data rows per page
*/
count(): number;
/**
* Sets the number of data rows per page.
* Changes to count will cause `isDataReloadRequired` to return true
*/
count(count: number): this;
/**
* Returns the current filter values used to restrict the set of data rows.
* @param trim supply true to return the current filter minus any insignificant values
* (null, undefined and empty string)
*/
filter(trim?: boolean): IFilterValues;
/**
* Sets filter values to the `filter` supplied; any existing filter will be removed
* Changes to filter will cause `isDataReloadRequired` to return true and the current `page` to be set to 1
*/
filter(filter: IFilterValues): this;
/**
* Generate array of pages.
* When no arguments supplied, the current parameter state of this `NgTableParams` instance will be used
* @param currentPage Which page must be active
* @param totalItems Total quantity of items
* @param pageSize Quantity of items on page
* @param maxBlocks Quantity of blocks for pagination
* @returns Array of pages
*/
generatePagesArray(currentPage?: number, totalItems?: number, pageSize?: number, maxBlocks?: number): IPageButton[];
/**
* Returns the current grouping used to group the data rows
*/
group(): Grouping<T>;
/**
* Sets grouping to the `group` supplied; any existing grouping will be removed.
* Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1
*/
group(group: IGroupValues): this;
/**
* Sets grouping to the `field` and `sortDirection` supplied; any existing grouping will be removed
* Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1
*/
group(field: string, sortDirection?: GroupSort): this;
/**
* Sets grouping to the `group` supplied; any existing grouping will be removed.
* If `sortDirection` is supplied, this will be assigned to the sortDirection property of `group`
* Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1
*/
group(group: IGroupingFunc<T> | string, sortDirection?: GroupSort): this;
/**
* Returns true when an attempt to `reload` the current `parameter` values have resulted in a failure.
* This method will continue to return true until the `reload` is successfully called or when the
* `parameter` values have changed
*/
hasErrorState(): boolean;
/**
* Returns true if `filter` has significant filter value(s) (any value except null, undefined, or empty string),
* otherwise false
*/
hasFilter(): boolean;
/**
* Return true when a change to `filters` require the `reload` method
* to be run so as to ensure the data presented to the user reflects these filters
*/
hasFilterChanges(): boolean;
/**
* Returns true when at least one group has been set
*/
hasGroup(): boolean;
/**
* Returns true when the `group` and when supplied, the `sortDirection` matches an existing group
*/
hasGroup(group: string | IGroupingFunc<T>, sortDirection?: string): boolean;
/**
* Return true when a change to this instance should require the `reload` method
* to be run so as to ensure the data rows presented to the user reflects the current state.
*
* Note that this method will return false when the `reload` method has run but fails. In this case
* `hasErrorState` will return true.
*
* The built-in `ngTable` directives will watch for when this function returns true and will then call
* the `reload` method to load its data rows
*/
isDataReloadRequired(): boolean;
/**
* Returns true if sorting by the field supplied. Where direction supplied
* the field must also be sorted by that direction to return true
*/
isSortBy(field: string, direction?: string): boolean;
/**
* Returns sorting values in a format that can be consumed by the angular `$orderBy` filter service
*/
orderBy(): string[];
/**
* Returns the index of the current "slice" of data rows
*/
page(): number;
/**
* Sets the index of the current "slice" of data rows. The index starts at 1.
* Changing the page number will cause `isDataReloadRequired` to return true
*/
page(page: number): this;
parameters(): IParamValues<T>;
/**
* Set new parameters
*/
parameters(newParameters?: IParamValues<T> | {
[name: string]: string;
}, parseParamsFromUrl?: boolean): this;
/**
* Trigger a reload of the data rows
*/
reload<TResult extends DataResult<T>>(): IPromise<TResult[]>;
/**
* Returns the settings for the table.
*/
settings(): ISettings<T>;
/**
* Sets the settings for the table; new setting values will be merged with the existing settings.
* Supplying a new `dataset` will cause `isDataReloadRequired` to return true and the `ngTableEventsChannel`
* to fire its `datasetChanged` event
*/
settings(newSettings: ISettings<T>): this;
/**
* Returns the current sorting used to order the data rows.
* Changes to sorting will cause `isDataReloadRequired` to return true
*/
sorting(): ISortingValues;
/**
* Sets sorting values to the `sorting` supplied; any existing sorting will be removed.
* Changes to sorting will cause `isDataReloadRequired` to return true
*/
sorting(sorting: ISortingValues): this;
/**
* Sets sorting to the `field` and `direction` supplied; any existing sorting will be removed
*/
sorting(field: string, direction: string): this;
/**
* Returns the count of the data rows that match the current `filter`
*/
total(): number;
/**
* Sets `settings().total` to the value supplied.
* Typically you will need to set a `total` in the body of any custom `getData` function
* you supply as a setting value to this instance.
* @example
* ```js
* const tp = new NgTableParams({}, { getData: customGetData })
* function customGetData(params) {
* const queryResult = // code to fetch current data rows and total //
* params.total(queryResult.total);
* return queryResult.dataRowsPage;
* }
* ```
*/
total(total: number): this;
/**
* Returns the current parameter values uri-encoded. Set `asString` to
* true for the parameters to be returned as an array of strings of the form 'paramName=value'
* otherwise parameters returned as a key-value object
*/
url(asString?: boolean): {
[name: string]: string;
};
private createComparableParams();
private hasGlobalSearchFieldChanges();
private log(...args);
private parseGroup(group);
private runInterceptorPipeline(fetchedData);
private static $q;
private static $log;
private static ngTableDefaults;
private static ngTableEventsChannel;
private static ngTableSettings;
static init($q: ng1.IQService, $log: ng1.ILogService, ngTableDefaults: IDefaults, ngTableEventsChannel: NgTableEventsChannel, ngTableSettings: NgTableSettings): void;
}

@@ -9,15 +9,30 @@ /**

import * as ng1 from 'angular';
ngTableParamsFactory.$inject = [
'$q', '$log', '$filter', 'ngTableDefaults', 'ngTableDefaultGetData', 'ngTableEventsChannel'
];
import { convertSortToOrderBy, isGroupingFun } from './util';
/**
* Implmenentation of the {@link INgTableParams INgTableParams} interface
* @ngdoc service
* @private
*/
export function ngTableParamsFactory($q, $log, $filter, ngTableDefaults, ngTableDefaultGetData, ngTableEventsChannel) {
return NgTableParams;
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
/**
* Parameters manager for an ngTable directive
*/
export var NgTableParams = (function () {
function NgTableParams(baseParameters, baseSettings) {
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
var _this = this;
/**
* The page of data rows currently being displayed in the table
*/
this.data = [];
this.defaultSettings = NgTableParams.ngTableSettings.createDefaults();
this.isCommittedDataset = false;
this.initialEvents = [];
this._params = {
page: 1,
count: 10,
filter: {},
sorting: {},
group: {}
};
this._settings = this.defaultSettings;
// the ngTableController "needs" to create a dummy/null instance and it's important to know whether an instance

@@ -28,613 +43,449 @@ // is one of these

}
var self = this, prevParamsMemento, errParamsMemento, isCommittedDataset = false, initialEvents = [], log = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
if (_settings.debugMode && $log.debug) {
$log.debug.apply($log, args);
}
}, defaultFilterOptions = {
filterComparator: undefined,
filterDelay: 500,
filterDelayThreshold: 10000,
filterFilterName: undefined,
filterFn: undefined,
filterLayout: 'stack' // alternative: 'horizontal'
}, defaultGroupOptions = {
defaultSort: 'asc',
isExpanded: true
}, defaultSettingsFns = getDefaultSettingFns();
this.data = [];
this.parameters = function (newParameters, parseParamsFromUrl) {
parseParamsFromUrl = parseParamsFromUrl || false;
if (typeof newParameters !== undefined) {
for (var key in newParameters) {
var value = newParameters[key];
if (parseParamsFromUrl && key.indexOf('[') >= 0) {
var keys = key.split(/\[(.*)\]/).reverse();
var lastKey = '';
for (var i = 0, len = keys.length; i < len; i++) {
var name = keys[i];
if (name !== '') {
var v = value;
value = {};
value[lastKey = name] = (isNumber(v) ? parseFloat(v) : v);
}
}
if (lastKey === 'sorting') {
_params[lastKey] = {};
}
_params[lastKey] = ng1.extend(_params[lastKey] || {}, value[lastKey]);
}
else {
if (key === 'group') {
_params[key] = parseGroup(newParameters[key]);
}
else {
_params[key] = (isNumber(newParameters[key]) ? parseFloat(newParameters[key]) : newParameters[key]);
}
}
this.reloadPages = (function () {
var currentPages;
return function () {
var oldPages = currentPages;
var newPages = _this.generatePagesArray(_this.page(), _this.total(), _this.count());
if (!ng1.equals(oldPages, newPages)) {
currentPages = newPages;
NgTableParams.ngTableEventsChannel.publishPagesChanged(_this, newPages, oldPages);
}
log('ngTable: set parameters', _params);
return this;
}
return _params;
};
function parseGroup(group) {
var defaultSort = _settings.groupOptions && _settings.groupOptions.defaultSort;
if (!group) {
return group;
}
else if (isGroupingFun(group)) {
if (group.sortDirection == null) {
group.sortDirection = defaultSort;
};
})();
ng1.extend(this._params, NgTableParams.ngTableDefaults.params);
this.settings(baseSettings);
this.parameters(baseParameters, true);
NgTableParams.ngTableEventsChannel.publishAfterCreated(this);
// run events during construction after the initial create event. That way a consumer
// can subscribe to all events for a table without "dropping" an event
ng1.forEach(this.initialEvents, function (event) {
event();
});
this.initialEvents = null;
}
NgTableParams.prototype.count = function (count) {
// reset to first page because can be blank page
return count !== undefined ? this.parameters({
'count': count,
'page': 1
}) : this._params.count;
};
NgTableParams.prototype.filter = function (filter) {
if (filter != null && typeof filter === 'object') {
return this.parameters({
'filter': filter,
'page': 1
});
}
else if (filter === true) {
var keys = Object.keys(this._params.filter);
var significantFilter = {};
for (var i = 0; i < keys.length; i++) {
var filterValue = this._params.filter[keys[i]];
if (filterValue != null && filterValue !== '') {
significantFilter[keys[i]] = filterValue;
}
return group;
}
else if (typeof group === 'object') {
for (var key in group) {
if (group[key] == null) {
group[key] = defaultSort;
}
}
return group;
}
else {
return (_a = {},
_a[group] = defaultSort,
_a
);
}
var _a;
return significantFilter;
}
/**
* @ngdoc method
* @name NgTableParams#settings
* @description Set new settings for table
*
* @param {string} newSettings New settings or undefined
* @returns {Object} Current settings or `this`
*/
this.settings = function (newSettings) {
if (ng1.isDefined(newSettings)) {
// todo: don't modify newSettings object: this introduces unexpected side effects;
// instead take a copy of newSettings
if (newSettings.filterOptions) {
newSettings.filterOptions = ng1.extend({}, _settings.filterOptions, newSettings.filterOptions);
else {
return this._params.filter;
}
};
/**
* Generate array of pages.
* When no arguments supplied, the current parameter state of this `NgTableParams` instance will be used
* @param currentPage Which page must be active
* @param totalItems Total quantity of items
* @param pageSize Quantity of items on page
* @param maxBlocks Quantity of blocks for pagination
* @returns Array of pages
*/
NgTableParams.prototype.generatePagesArray = function (currentPage, totalItems, pageSize, maxBlocks) {
if (!arguments.length) {
currentPage = this.page();
totalItems = this.total();
pageSize = this.count();
}
var maxPage, maxPivotPages, minPage, numPages;
maxBlocks = maxBlocks && maxBlocks < 6 ? 6 : maxBlocks;
var pages = [];
numPages = Math.ceil(totalItems / pageSize);
if (numPages > 1) {
pages.push({
type: 'prev',
number: Math.max(1, currentPage - 1),
active: currentPage > 1
});
pages.push({
type: 'first',
number: 1,
active: currentPage > 1,
current: currentPage === 1
});
maxPivotPages = Math.round((this._settings.paginationMaxBlocks - this._settings.paginationMinBlocks) / 2);
minPage = Math.max(2, currentPage - maxPivotPages);
maxPage = Math.min(numPages - 1, currentPage + maxPivotPages * 2 - (currentPage - minPage));
minPage = Math.max(2, minPage - (maxPivotPages * 2 - (maxPage - minPage)));
var i = minPage;
while (i <= maxPage) {
if ((i === minPage && i !== 2) || (i === maxPage && i !== numPages - 1)) {
pages.push({
type: 'more',
active: false
});
}
if (newSettings.groupOptions) {
newSettings.groupOptions = ng1.extend({}, _settings.groupOptions, newSettings.groupOptions);
else {
pages.push({
type: 'page',
number: i,
active: currentPage !== i,
current: currentPage === i
});
}
if (ng1.isArray(newSettings.dataset)) {
//auto-set the total from passed in dataset
newSettings.total = newSettings.dataset.length;
}
var originalDataset = _settings.dataset;
_settings = ng1.extend(_settings, newSettings);
if (ng1.isArray(newSettings.dataset)) {
optimizeFilterDelay();
}
// note: using != as want null and undefined to be treated the same
var hasDatasetChanged = newSettings.hasOwnProperty('dataset') && (newSettings.dataset != originalDataset);
if (hasDatasetChanged) {
if (isCommittedDataset) {
this.page(1); // reset page as a new dataset has been supplied
}
isCommittedDataset = false;
var fireEvent = function () {
ngTableEventsChannel.publishDatasetChanged(self, newSettings.dataset, originalDataset);
};
if (initialEvents) {
initialEvents.push(fireEvent);
}
else {
fireEvent();
}
}
log('ngTable: set settings', _settings);
return this;
i++;
}
return _settings;
pages.push({
type: 'last',
number: numPages,
active: currentPage !== numPages,
current: currentPage === numPages
});
pages.push({
type: 'next',
number: Math.min(numPages, currentPage + 1),
active: currentPage < numPages
});
}
return pages;
};
NgTableParams.prototype.group = function (group, sortDirection) {
if (group === undefined) {
return this._params.group;
}
var newParameters = {
page: 1
};
this.page = function (page) {
return page !== undefined ? this.parameters({
'page': page
}) : _params.page;
};
this.total = function (total) {
return total !== undefined ? this.settings({
'total': total
}) : _settings.total;
};
this.count = function (count) {
// reset to first page because can be blank page
return count !== undefined ? this.parameters({
'count': count,
'page': 1
}) : _params.count;
};
this.filter = function (filter) {
if (filter != null && typeof filter === 'object') {
return this.parameters({
'filter': filter,
'page': 1
});
if (isGroupingFun(group) && sortDirection !== undefined) {
group.sortDirection = sortDirection;
newParameters.group = group;
}
else if (typeof group === 'string' && sortDirection !== undefined) {
newParameters.group = (_a = {}, _a[group] = sortDirection, _a);
}
else {
newParameters.group = group;
}
this.parameters(newParameters);
return this;
var _a;
};
/**
* Returns true when an attempt to `reload` the current `parameter` values have resulted in a failure.
* This method will continue to return true until the `reload` is successfully called or when the
* `parameter` values have changed
*/
NgTableParams.prototype.hasErrorState = function () {
return !!(this.errParamsMemento && ng1.equals(this.errParamsMemento, this.createComparableParams()));
};
/**
* Returns true if `filter` has significant filter value(s) (any value except null, undefined, or empty string),
* otherwise false
*/
NgTableParams.prototype.hasFilter = function () {
return Object.keys(this.filter(true)).length > 0;
};
/**
* Return true when a change to `filters` require the `reload` method
* to be run so as to ensure the data presented to the user reflects these filters
*/
NgTableParams.prototype.hasFilterChanges = function () {
var previousFilter = (this.prevParamsMemento && this.prevParamsMemento.params.filter);
return !ng1.equals((this._params.filter), previousFilter) || this.hasGlobalSearchFieldChanges();
};
NgTableParams.prototype.hasGroup = function (group, sortDirection) {
if (group == null) {
return isGroupingFun(this._params.group) || Object.keys(this._params.group).length > 0;
}
if (isGroupingFun(group)) {
if (sortDirection == null) {
return this._params.group === group;
}
else if (filter === true) {
var keys = Object.keys(_params.filter);
var significantFilter = {};
for (var i = 0; i < keys.length; i++) {
var filterValue = _params.filter[keys[i]];
if (filterValue != null && filterValue !== '') {
significantFilter[keys[i]] = filterValue;
}
}
return significantFilter;
}
else {
return _params.filter;
return this._params.group === group && group.sortDirection === sortDirection;
}
};
this.group = function (group, sortDirection) {
if (group === undefined) {
return _params.group;
}
else {
if (sortDirection == null) {
return Object.keys(this._params.group).indexOf(group) !== -1;
}
var newParameters = {
page: 1
};
if (isGroupingFun(group) && sortDirection !== undefined) {
group.sortDirection = sortDirection;
newParameters.group = group;
}
else if (typeof group === 'string' && sortDirection !== undefined) {
newParameters.group = (_a = {}, _a[group] = sortDirection, _a);
}
else {
newParameters.group = group;
return this._params.group[group] === sortDirection;
}
this.parameters(newParameters);
return this;
var _a;
};
/**
* @ngdoc method
* @name NgTableParams#sorting
* @description If 'sorting' parameter is not set, return current sorting. Otherwise set current sorting.
*
* @param {string} sorting New sorting
* @returns {Object} Current sorting or `this`
*/
this.sorting = function (sorting, direction) {
if (typeof sorting === 'string' && direction !== undefined) {
this.parameters({
'sorting': (_a = {}, _a[sorting] = direction, _a)
});
return this;
}
return sorting !== undefined ? this.parameters({
'sorting': sorting
}) : _params.sorting;
var _a;
};
this.isSortBy = function (field, direction) {
if (direction !== undefined) {
return _params.sorting[field] !== undefined && _params.sorting[field] == direction;
}
else {
return _params.sorting[field] !== undefined;
}
};
/**
* @ngdoc method
* @name NgTableParams#orderBy
* @description Return object of sorting parameters for angular filter
*
* @returns {Array} Array like: [ '-name', '+age' ]
*/
this.orderBy = function () {
return convertSortToOrderBy(_params.sorting);
};
function convertSortToOrderBy(sorting) {
var result = [];
for (var column in sorting) {
result.push((sorting[column] === "asc" ? "+" : "-") + column);
}
return result;
}
/**
* @ngdoc method
* @name NgTableParams#generatePagesArray
* @description Generate array of pages
*
* When no arguments supplied, the current parameter state of this `NgTableParams` instance will be used
*
* @param {boolean} currentPage which page must be active
* @param {boolean} totalItems Total quantity of items
* @param {boolean} pageSize Quantity of items on page
* @param {number} maxBlocks Quantity of blocks for pagination
* @returns {Array} Array of pages
*/
this.generatePagesArray = function (currentPage, totalItems, pageSize, maxBlocks) {
if (!arguments.length) {
currentPage = this.page();
totalItems = this.total();
pageSize = this.count();
}
var maxPage, maxPivotPages, minPage, numPages;
maxBlocks = maxBlocks && maxBlocks < 6 ? 6 : maxBlocks;
var pages = [];
numPages = Math.ceil(totalItems / pageSize);
if (numPages > 1) {
pages.push({
type: 'prev',
number: Math.max(1, currentPage - 1),
active: currentPage > 1
});
pages.push({
type: 'first',
number: 1,
active: currentPage > 1,
current: currentPage === 1
});
maxPivotPages = Math.round((_settings.paginationMaxBlocks - _settings.paginationMinBlocks) / 2);
minPage = Math.max(2, currentPage - maxPivotPages);
maxPage = Math.min(numPages - 1, currentPage + maxPivotPages * 2 - (currentPage - minPage));
minPage = Math.max(2, minPage - (maxPivotPages * 2 - (maxPage - minPage)));
var i = minPage;
while (i <= maxPage) {
if ((i === minPage && i !== 2) || (i === maxPage && i !== numPages - 1)) {
pages.push({
type: 'more',
active: false
});
};
/**
* Return true when a change to this instance should require the `reload` method
* to be run so as to ensure the data rows presented to the user reflects the current state.
*
* Note that this method will return false when the `reload` method has run but fails. In this case
* `hasErrorState` will return true.
*
* The built-in `ngTable` directives will watch for when this function returns true and will then call
* the `reload` method to load its data rows
*/
NgTableParams.prototype.isDataReloadRequired = function () {
// note: using != as want to treat null and undefined the same
return !this.isCommittedDataset || !ng1.equals(this.createComparableParams(), this.prevParamsMemento)
|| this.hasGlobalSearchFieldChanges();
};
/**
* Returns true if sorting by the field supplied. Where direction supplied
* the field must also be sorted by that direction to return true
*/
NgTableParams.prototype.isSortBy = function (field, direction) {
if (direction !== undefined) {
return this._params.sorting[field] !== undefined && this._params.sorting[field] == direction;
}
else {
return this._params.sorting[field] !== undefined;
}
};
/**
* Returns sorting values in a format that can be consumed by the angular `$orderBy` filter service
*/
NgTableParams.prototype.orderBy = function () {
return convertSortToOrderBy(this._params.sorting);
};
NgTableParams.prototype.page = function (page) {
return page !== undefined ? this.parameters({
'page': page
}) : this._params.page;
};
NgTableParams.prototype.parameters = function (newParameters, parseParamsFromUrl) {
parseParamsFromUrl = parseParamsFromUrl || false;
if (typeof newParameters !== undefined) {
for (var key in newParameters) {
var value = newParameters[key];
if (parseParamsFromUrl && key.indexOf('[') >= 0) {
var keys = key.split(/\[(.*)\]/).reverse();
var lastKey = '';
for (var i = 0, len = keys.length; i < len; i++) {
var name_1 = keys[i];
if (name_1 !== '') {
var v = value;
value = {};
value[lastKey = name_1] = (isNumber(v) ? parseFloat(v) : v);
}
}
if (lastKey === 'sorting') {
this._params[lastKey] = {};
}
this._params[lastKey] = ng1.extend(this._params[lastKey] || {}, value[lastKey]);
}
else {
if (key === 'group') {
this._params[key] = this.parseGroup(newParameters[key]);
}
else {
pages.push({
type: 'page',
number: i,
active: currentPage !== i,
current: currentPage === i
});
this._params[key] = (isNumber(newParameters[key]) ? parseFloat(newParameters[key]) : newParameters[key]);
}
i++;
}
pages.push({
type: 'last',
number: numPages,
active: currentPage !== numPages,
current: currentPage === numPages
});
pages.push({
type: 'next',
number: Math.min(numPages, currentPage + 1),
active: currentPage < numPages
});
}
return pages;
};
/**
* @ngdoc method
* @name NgTableParams#isDataReloadRequired
* @description Return true when a change to this `NgTableParams` instance should require the reload method
* to be run so as to ensure the data presented to the user reflects the `NgTableParams`
*
* Note that this method will return false when the reload method has run but fails. In this case
* `hasErrorState` will return true.
*/
this.isDataReloadRequired = function () {
// note: using != as want to treat null and undefined the same
return !isCommittedDataset || !ng1.equals(createComparableParams(), prevParamsMemento)
|| hasGlobalSearchFieldChanges();
};
function createComparableParams() {
var group = _params.group;
return {
params: _params,
groupSortDirection: isGroupingFun(group) ? group.sortDirection : undefined
};
this.log('ngTable: set parameters', this._params);
return this;
}
function isGroupingFun(val) {
return typeof val === 'function';
return this._params;
};
/**
* Trigger a reload of the data rows
*/
NgTableParams.prototype.reload = function () {
var _this = this;
var pData = null;
this._settings.$loading = true;
this.prevParamsMemento = ng1.copy(this.createComparableParams());
this.isCommittedDataset = true;
if (this.hasGroup()) {
pData = this.runInterceptorPipeline(NgTableParams.$q.when(this._settings.getGroups(this)));
}
/**
* @ngdoc method
* @name NgTableParams#hasFilter
* @description Determines if NgTableParams#filter has significant filter value(s)
* (any value except null, undefined, or empty string)
* @returns {Boolean} true when NgTableParams#filter has at least one significant field value
*/
this.hasFilter = function () {
return Object.keys(this.filter(true)).length > 0;
};
this.hasGroup = function (group, sortDirection) {
if (group == null) {
return isGroupingFun(_params.group) || Object.keys(_params.group).length > 0;
}
if (isGroupingFun(group)) {
if (sortDirection == null) {
return _params.group === group;
else {
var fn = this._settings.getData;
pData = this.runInterceptorPipeline(NgTableParams.$q.when(fn(this)));
}
this.log('ngTable: reload data');
var oldData = this.data;
return pData.then(function (data) {
_this._settings.$loading = false;
_this.errParamsMemento = null;
_this.data = data;
// note: I think it makes sense to publish this event even when data === oldData
// subscribers can always set a filter to only receive the event when data !== oldData
NgTableParams.ngTableEventsChannel.publishAfterReloadData(_this, data, oldData);
_this.reloadPages();
return data;
}).catch(function (reason) {
_this.errParamsMemento = _this.prevParamsMemento;
// "rethrow"
return NgTableParams.$q.reject(reason);
});
};
NgTableParams.prototype.settings = function (newSettings) {
var _this = this;
if (ng1.isDefined(newSettings)) {
var settings = NgTableParams.ngTableSettings.merge(this._settings, newSettings);
var originalDataset_1 = this._settings.dataset;
this._settings = settings;
// note: using != as want null and undefined to be treated the same
var hasDatasetChanged = newSettings.hasOwnProperty('dataset') && (newSettings.dataset != originalDataset_1);
if (hasDatasetChanged) {
if (this.isCommittedDataset) {
this.page(1); // reset page as a new dataset has been supplied
}
else {
return _params.group === group && group.sortDirection === sortDirection;
this.isCommittedDataset = false;
var fireEvent = function () {
NgTableParams.ngTableEventsChannel.publishDatasetChanged(_this, newSettings.dataset, originalDataset_1);
};
if (this.initialEvents) {
this.initialEvents.push(fireEvent);
}
}
else {
if (sortDirection == null) {
return Object.keys(_params.group).indexOf(group) !== -1;
}
else {
return _params.group[group] === sortDirection;
fireEvent();
}
}
};
this.hasFilterChanges = function () {
var previousFilter = (prevParamsMemento && prevParamsMemento.params.filter);
return !ng1.equals((_params.filter), previousFilter) || hasGlobalSearchFieldChanges();
};
function hasGlobalSearchFieldChanges() {
var currentVal = (_params.filter && _params.filter['$']);
var previousVal = (prevParamsMemento && prevParamsMemento.params.filter && prevParamsMemento.params.filter['$']);
return !ng1.equals(currentVal, previousVal);
this.log('ngTable: set settings', this._settings);
return this;
}
this.url = function (asString) {
// this function is an example of Typescript gone bad!!
asString = asString || false;
var pairs = (asString ? [] : {});
for (var key in _params) {
if (_params.hasOwnProperty(key)) {
var item = _params[key], name = encodeURIComponent(key);
if (typeof item === "object") {
for (var subkey in item) {
if (isSignificantValue(item[subkey], key)) {
var pname = name + "[" + encodeURIComponent(subkey) + "]";
collectValue(item[subkey], pname);
}
return this._settings;
};
NgTableParams.prototype.sorting = function (sorting, direction) {
if (typeof sorting === 'string') {
this.parameters({
'sorting': (_a = {}, _a[sorting] = direction, _a)
});
return this;
}
return sorting !== undefined ? this.parameters({
'sorting': sorting
}) : this._params.sorting;
var _a;
};
NgTableParams.prototype.total = function (total) {
return total !== undefined ? this.settings({
'total': total
}) : this._settings.total;
};
/**
* Returns the current parameter values uri-encoded. Set `asString` to
* true for the parameters to be returned as an array of strings of the form 'paramName=value'
* otherwise parameters returned as a key-value object
*/
NgTableParams.prototype.url = function (asString) {
// this function is an example of Typescript gone bad!!
asString = asString || false;
var pairs = (asString ? [] : {});
for (var key in this._params) {
if (this._params.hasOwnProperty(key)) {
var item = this._params[key], name_2 = encodeURIComponent(key);
if (typeof item === "object") {
for (var subkey in item) {
if (isSignificantValue(item[subkey], key)) {
var pname = name_2 + "[" + encodeURIComponent(subkey) + "]";
collectValue(item[subkey], pname);
}
}
else if (!ng1.isFunction(item) && isSignificantValue(item, key)) {
collectValue(item, name);
}
}
}
return pairs;
function collectValue(value, key) {
if (isArray(pairs)) {
pairs.push(key + "=" + encodeURIComponent(value));
else if (!ng1.isFunction(item) && isSignificantValue(item, key)) {
collectValue(item, name_2);
}
else {
pairs[key] = encodeURIComponent(value);
}
}
function isArray(pairs) {
return asString;
}
return pairs;
function collectValue(value, key) {
if (isArray(pairs)) {
pairs.push(key + "=" + encodeURIComponent(value));
}
function isSignificantValue(value, key) {
return key === "group" ? true : typeof value !== undefined && value !== "";
}
};
this.reload = function () {
var self = this, pData = null;
_settings.$loading = true;
prevParamsMemento = ng1.copy(createComparableParams());
isCommittedDataset = true;
if (self.hasGroup()) {
pData = runInterceptorPipeline($q.when(_settings.getGroups(self)));
}
else {
var fn = _settings.getData;
pData = runInterceptorPipeline($q.when(fn(self)));
pairs[key] = encodeURIComponent(value);
}
log('ngTable: reload data');
var oldData = self.data;
return pData.then(function (data) {
_settings.$loading = false;
errParamsMemento = null;
self.data = data;
// note: I think it makes sense to publish this event even when data === oldData
// subscribers can always set a filter to only receive the event when data !== oldData
ngTableEventsChannel.publishAfterReloadData(self, data, oldData);
self.reloadPages();
return data;
}).catch(function (reason) {
errParamsMemento = prevParamsMemento;
// "rethrow"
return $q.reject(reason);
});
}
function isArray(pairs) {
return asString;
}
function isSignificantValue(value, key) {
return key === "group" ? true : typeof value !== undefined && value !== "";
}
};
NgTableParams.prototype.createComparableParams = function () {
var group = this._params.group;
return {
params: this._params,
groupSortDirection: isGroupingFun(group) ? group.sortDirection : undefined
};
this.hasErrorState = function () {
return !!(errParamsMemento && ng1.equals(errParamsMemento, createComparableParams()));
};
function optimizeFilterDelay() {
// don't debounce by default filter input when working with small synchronous datasets
if (_settings.filterOptions.filterDelay === defaultFilterOptions.filterDelay &&
_settings.total <= _settings.filterOptions.filterDelayThreshold &&
_settings.getData === defaultSettingsFns.getData) {
_settings.filterOptions.filterDelay = 0;
}
};
NgTableParams.prototype.hasGlobalSearchFieldChanges = function () {
var currentVal = (this._params.filter && this._params.filter['$']);
var previousVal = (this.prevParamsMemento && this.prevParamsMemento.params.filter && this.prevParamsMemento.params.filter['$']);
return !ng1.equals(currentVal, previousVal);
};
NgTableParams.prototype.log = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
this.reloadPages = (function () {
var currentPages;
return function () {
var oldPages = currentPages;
var newPages = self.generatePagesArray(self.page(), self.total(), self.count());
if (!ng1.equals(oldPages, newPages)) {
currentPages = newPages;
ngTableEventsChannel.publishPagesChanged(this, newPages, oldPages);
}
};
})();
function runInterceptorPipeline(fetchedData) {
var interceptors = _settings.interceptors || [];
return interceptors.reduce(function (result, interceptor) {
var thenFn = (interceptor.response && interceptor.response.bind(interceptor)) || $q.when;
var rejectFn = (interceptor.responseError && interceptor.responseError.bind(interceptor)) || $q.reject;
return result.then(function (data) {
return thenFn(data, self);
}, function (reason) {
return rejectFn(reason, self);
});
}, fetchedData);
if (this._settings.debugMode && NgTableParams.$log.debug) {
(_a = NgTableParams.$log).debug.apply(_a, args);
}
function getDefaultSettingFns() {
return {
getData: getData,
getGroups: getGroups
};
/**
* @ngdoc method
* @name settings#getData
* @description Returns the data to display in the table
*
* Called by `NgTableParams` whenever it considers new data is to be loaded
*
* @param {Object} params the `NgTableParams` requesting data
*/
function getData(params) {
return ngTableDefaultGetData(params.settings().dataset, params);
var _a;
};
NgTableParams.prototype.parseGroup = function (group) {
var defaultSort = this._settings.groupOptions && this._settings.groupOptions.defaultSort;
if (!group) {
return group;
}
else if (isGroupingFun(group)) {
if (group.sortDirection == null) {
group.sortDirection = defaultSort;
}
/**
* @ngdoc method
* @name settings#getGroups
* @description Return groups of data to display in the table
*
* Called by `NgTableParams` whenever it considers new data is to be loaded
* and when a `group` value has been assigned
*
* @param {Object} params the `NgTableParams` requesting data
*/
function getGroups(params) {
var group = params.group();
var groupFn;
var sortDirection = undefined;
if (isGroupingFun(group)) {
groupFn = group;
sortDirection = group.sortDirection;
return group;
}
else if (typeof group === 'object') {
for (var key in group) {
if (group[key] == null) {
group[key] = defaultSort;
}
else {
// currently support for only one group implemented
var groupField = Object.keys(group)[0];
sortDirection = group[groupField];
groupFn = function (item) {
return getPath(item, groupField);
};
}
var settings = params.settings();
var originalDataOptions = settings.dataOptions;
settings.dataOptions = { applyPaging: false };
var getData = settings.getData;
var gotData = $q.when(getData(params));
return gotData.then(function (data) {
var groups = {};
ng1.forEach(data, function (item) {
var groupName = groupFn(item);
groups[groupName] = groups[groupName] || {
data: [],
$hideRows: !settings.groupOptions.isExpanded,
value: groupName
};
groups[groupName].data.push(item);
});
var result = [];
for (var i in groups) {
result.push(groups[i]);
}
if (sortDirection) {
var orderByFn = ngTableDefaultGetData.getOrderByFn();
var orderBy = convertSortToOrderBy({
value: sortDirection
});
result = orderByFn(result, orderBy);
}
return ngTableDefaultGetData.applyPaging(result, params);
}).finally(function () {
// restore the real options
settings.dataOptions = originalDataOptions;
});
}
function getPath(obj, ks) {
// origianl source https://github.com/documentcloud/underscore-contrib
var keys;
if (typeof ks === "string") {
keys = ks.split(".");
}
else {
keys = ks;
}
// If we have reached an undefined property
// then stop executing and return undefined
if (obj === undefined)
return void 0;
// If the path array has no more elements, we've reached
// the intended property and return its value
if (keys.length === 0)
return obj;
// If we still have elements in the path array and the current
// value is null, stop executing and return undefined
if (obj === null)
return void 0;
return getPath(obj[keys[0]], keys.slice(1));
}
return group;
}
var _params = {
page: 1,
count: 10,
filter: {},
sorting: {},
group: {}
};
ng1.extend(_params, ngTableDefaults.params);
/**
* @ngdoc object
* @name settings
* @module ngTable
* @description configuration settings for `NgTableParams`
*/
var _settings = {
$loading: false,
dataset: null,
total: 0,
defaultSort: 'desc',
filterOptions: ng1.copy(defaultFilterOptions),
groupOptions: ng1.copy(defaultGroupOptions),
counts: [10, 25, 50, 100],
interceptors: [],
paginationMaxBlocks: 11,
paginationMinBlocks: 5,
sortingIndicator: 'span'
};
this.settings(defaultSettingsFns);
this.settings(ngTableDefaults.settings);
this.settings(baseSettings);
this.parameters(baseParameters, true);
ngTableEventsChannel.publishAfterCreated(this);
// run events during construction after the initial create event. That way a consumer
// can subscribe to all events for a table without "dropping" an event
ng1.forEach(initialEvents, function (event) {
event();
});
initialEvents = null;
return this;
}
}
else {
return (_a = {},
_a[group] = defaultSort,
_a
);
}
var _a;
};
NgTableParams.prototype.runInterceptorPipeline = function (fetchedData) {
var _this = this;
var interceptors = this._settings.interceptors || [];
return interceptors.reduce(function (result, interceptor) {
var thenFn = (interceptor.response && interceptor.response.bind(interceptor)) || NgTableParams.$q.when;
var rejectFn = (interceptor.responseError && interceptor.responseError.bind(interceptor)) || NgTableParams.$q.reject;
return result.then(function (data) {
return thenFn(data, _this);
}, function (reason) {
return rejectFn(reason, _this);
});
}, fetchedData);
};
NgTableParams.init = function ($q, $log, ngTableDefaults, ngTableEventsChannel, ngTableSettings) {
NgTableParams.$q = $q;
NgTableParams.$log = $log;
NgTableParams.ngTableDefaults = ngTableDefaults;
NgTableParams.ngTableEventsChannel = ngTableEventsChannel;
NgTableParams.ngTableSettings = ngTableSettings;
};
return NgTableParams;
}());
NgTableParams.init.$inject = ['$q', '$log', 'ngTableDefaults', 'ngTableEventsChannel', 'ngTableSettings'];
//# sourceMappingURL=ngTableParams.js.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc