summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE/client/bower_components/angular-smart-table/dist
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/angular-smart-table/dist')
-rw-r--r--ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.js534
-rw-r--r--ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js6
-rw-r--r--ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js.map1
3 files changed, 0 insertions, 541 deletions
diff --git a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.js b/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.js
deleted file mode 100644
index e0246d45..00000000
--- a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.js
+++ /dev/null
@@ -1,534 +0,0 @@
-/**
-* @version 2.1.8
-* @license MIT
-*/
-(function (ng, undefined){
- 'use strict';
-
-ng.module('smart-table', []).run(['$templateCache', function ($templateCache) {
- $templateCache.put('template/smart-table/pagination.html',
- '<nav ng-if="numPages && pages.length >= 2"><ul class="pagination">' +
- '<li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a href="javascript: void(0);" ng-click="selectPage(page)">{{page}}</a></li>' +
- '</ul></nav>');
-}]);
-
-
-ng.module('smart-table')
- .constant('stConfig', {
- pagination: {
- template: 'template/smart-table/pagination.html',
- itemsByPage: 10,
- displayedPages: 5
- },
- search: {
- delay: 400, // ms
- inputEvent: 'input'
- },
- select: {
- mode: 'single',
- selectedClass: 'st-selected'
- },
- sort: {
- ascentClass: 'st-sort-ascent',
- descentClass: 'st-sort-descent',
- descendingFirst: false,
- skipNatural: false,
- delay:300
- },
- pipe: {
- delay: 100 //ms
- }
- });
-ng.module('smart-table')
- .controller('stTableController', ['$scope', '$parse', '$filter', '$attrs', function StTableController ($scope, $parse, $filter, $attrs) {
- var propertyName = $attrs.stTable;
- var displayGetter = $parse(propertyName);
- var displaySetter = displayGetter.assign;
- var safeGetter;
- var orderBy = $filter('orderBy');
- var filter = $filter('filter');
- var safeCopy = copyRefs(displayGetter($scope));
- var tableState = {
- sort: {},
- search: {},
- pagination: {
- start: 0,
- totalItemCount: 0
- }
- };
- var filtered;
- var pipeAfterSafeCopy = true;
- var ctrl = this;
- var lastSelected;
-
- function copyRefs (src) {
- return src ? [].concat(src) : [];
- }
-
- function updateSafeCopy () {
- safeCopy = copyRefs(safeGetter($scope));
- if (pipeAfterSafeCopy === true) {
- ctrl.pipe();
- }
- }
-
- function deepDelete (object, path) {
- if (path.indexOf('.') != -1) {
- var partials = path.split('.');
- var key = partials.pop();
- var parentPath = partials.join('.');
- var parentObject = $parse(parentPath)(object)
- delete parentObject[key];
- if (Object.keys(parentObject).length == 0) {
- deepDelete(object, parentPath);
- }
- } else {
- delete object[path];
- }
- }
-
- if ($attrs.stSafeSrc) {
- safeGetter = $parse($attrs.stSafeSrc);
- $scope.$watch(function () {
- var safeSrc = safeGetter($scope);
- return safeSrc && safeSrc.length ? safeSrc[0] : undefined;
- }, function (newValue, oldValue) {
- if (newValue !== oldValue) {
- updateSafeCopy();
- }
- });
- $scope.$watch(function () {
- var safeSrc = safeGetter($scope);
- return safeSrc ? safeSrc.length : 0;
- }, function (newValue, oldValue) {
- if (newValue !== safeCopy.length) {
- updateSafeCopy();
- }
- });
- $scope.$watch(function () {
- return safeGetter($scope);
- }, function (newValue, oldValue) {
- if (newValue !== oldValue) {
- tableState.pagination.start = 0;
- updateSafeCopy();
- }
- });
- }
-
- /**
- * sort the rows
- * @param {Function | String} predicate - function or string which will be used as predicate for the sorting
- * @param [reverse] - if you want to reverse the order
- */
- this.sortBy = function sortBy (predicate, reverse) {
- tableState.sort.predicate = predicate;
- tableState.sort.reverse = reverse === true;
-
- if (ng.isFunction(predicate)) {
- tableState.sort.functionName = predicate.name;
- } else {
- delete tableState.sort.functionName;
- }
-
- tableState.pagination.start = 0;
- return this.pipe();
- };
-
- /**
- * search matching rows
- * @param {String} input - the input string
- * @param {String} [predicate] - the property name against you want to check the match, otherwise it will search on all properties
- */
- this.search = function search (input, predicate) {
- var predicateObject = tableState.search.predicateObject || {};
- var prop = predicate ? predicate : '$';
-
- input = ng.isString(input) ? input.trim() : input;
- $parse(prop).assign(predicateObject, input);
- // to avoid to filter out null value
- if (!input) {
- deepDelete(predicateObject, prop);
- }
- tableState.search.predicateObject = predicateObject;
- tableState.pagination.start = 0;
- return this.pipe();
- };
-
- /**
- * this will chain the operations of sorting and filtering based on the current table state (sort options, filtering, ect)
- */
- this.pipe = function pipe () {
- var pagination = tableState.pagination;
- var output;
- filtered = tableState.search.predicateObject ? filter(safeCopy, tableState.search.predicateObject) : safeCopy;
- if (tableState.sort.predicate) {
- filtered = orderBy(filtered, tableState.sort.predicate, tableState.sort.reverse);
- }
- pagination.totalItemCount = filtered.length;
- if (pagination.number !== undefined) {
- pagination.numberOfPages = filtered.length > 0 ? Math.ceil(filtered.length / pagination.number) : 1;
- pagination.start = pagination.start >= filtered.length ? (pagination.numberOfPages - 1) * pagination.number : pagination.start;
- output = filtered.slice(pagination.start, pagination.start + parseInt(pagination.number));
- }
- displaySetter($scope, output || filtered);
- };
-
- /**
- * select a dataRow (it will add the attribute isSelected to the row object)
- * @param {Object} row - the row to select
- * @param {String} [mode] - "single" or "multiple" (multiple by default)
- */
- this.select = function select (row, mode) {
- var rows = copyRefs(displayGetter($scope));
- var index = rows.indexOf(row);
- if (index !== -1) {
- if (mode === 'single') {
- row.isSelected = row.isSelected !== true;
- if (lastSelected) {
- lastSelected.isSelected = false;
- }
- lastSelected = row.isSelected === true ? row : undefined;
- } else {
- rows[index].isSelected = !rows[index].isSelected;
- }
- }
- };
-
- /**
- * take a slice of the current sorted/filtered collection (pagination)
- *
- * @param {Number} start - start index of the slice
- * @param {Number} number - the number of item in the slice
- */
- this.slice = function splice (start, number) {
- tableState.pagination.start = start;
- tableState.pagination.number = number;
- return this.pipe();
- };
-
- /**
- * return the current state of the table
- * @returns {{sort: {}, search: {}, pagination: {start: number}}}
- */
- this.tableState = function getTableState () {
- return tableState;
- };
-
- this.getFilteredCollection = function getFilteredCollection () {
- return filtered || safeCopy;
- };
-
- /**
- * Use a different filter function than the angular FilterFilter
- * @param filterName the name under which the custom filter is registered
- */
- this.setFilterFunction = function setFilterFunction (filterName) {
- filter = $filter(filterName);
- };
-
- /**
- * Use a different function than the angular orderBy
- * @param sortFunctionName the name under which the custom order function is registered
- */
- this.setSortFunction = function setSortFunction (sortFunctionName) {
- orderBy = $filter(sortFunctionName);
- };
-
- /**
- * Usually when the safe copy is updated the pipe function is called.
- * Calling this method will prevent it, which is something required when using a custom pipe function
- */
- this.preventPipeOnWatch = function preventPipe () {
- pipeAfterSafeCopy = false;
- };
- }])
- .directive('stTable', function () {
- return {
- restrict: 'A',
- controller: 'stTableController',
- link: function (scope, element, attr, ctrl) {
-
- if (attr.stSetFilter) {
- ctrl.setFilterFunction(attr.stSetFilter);
- }
-
- if (attr.stSetSort) {
- ctrl.setSortFunction(attr.stSetSort);
- }
- }
- };
- });
-
-ng.module('smart-table')
- .directive('stSearch', ['stConfig', '$timeout','$parse', function (stConfig, $timeout, $parse) {
- return {
- require: '^stTable',
- link: function (scope, element, attr, ctrl) {
- var tableCtrl = ctrl;
- var promise = null;
- var throttle = attr.stDelay || stConfig.search.delay;
- var event = attr.stInputEvent || stConfig.search.inputEvent;
-
- attr.$observe('stSearch', function (newValue, oldValue) {
- var input = element[0].value;
- if (newValue !== oldValue && input) {
- ctrl.tableState().search = {};
- tableCtrl.search(input, newValue);
- }
- });
-
- //table state -> view
- scope.$watch(function () {
- return ctrl.tableState().search;
- }, function (newValue, oldValue) {
- var predicateExpression = attr.stSearch || '$';
- if (newValue.predicateObject && $parse(predicateExpression)(newValue.predicateObject) !== element[0].value) {
- element[0].value = $parse(predicateExpression)(newValue.predicateObject) || '';
- }
- }, true);
-
- // view -> table state
- element.bind(event, function (evt) {
- evt = evt.originalEvent || evt;
- if (promise !== null) {
- $timeout.cancel(promise);
- }
-
- promise = $timeout(function () {
- tableCtrl.search(evt.target.value, attr.stSearch || '');
- promise = null;
- }, throttle);
- });
- }
- };
- }]);
-
-ng.module('smart-table')
- .directive('stSelectRow', ['stConfig', function (stConfig) {
- return {
- restrict: 'A',
- require: '^stTable',
- scope: {
- row: '=stSelectRow'
- },
- link: function (scope, element, attr, ctrl) {
- var mode = attr.stSelectMode || stConfig.select.mode;
- element.bind('click', function () {
- scope.$apply(function () {
- ctrl.select(scope.row, mode);
- });
- });
-
- scope.$watch('row.isSelected', function (newValue) {
- if (newValue === true) {
- element.addClass(stConfig.select.selectedClass);
- } else {
- element.removeClass(stConfig.select.selectedClass);
- }
- });
- }
- };
- }]);
-
-ng.module('smart-table')
- .directive('stSort', ['stConfig', '$parse', '$timeout', function (stConfig, $parse, $timeout) {
- return {
- restrict: 'A',
- require: '^stTable',
- link: function (scope, element, attr, ctrl) {
-
- var predicate = attr.stSort;
- var getter = $parse(predicate);
- var index = 0;
- var classAscent = attr.stClassAscent || stConfig.sort.ascentClass;
- var classDescent = attr.stClassDescent || stConfig.sort.descentClass;
- var stateClasses = [classAscent, classDescent];
- var sortDefault;
- var skipNatural = attr.stSkipNatural !== undefined ? attr.stSkipNatural : stConfig.sort.skipNatural;
- var descendingFirst = attr.stDescendingFirst !== undefined ? attr.stDescendingFirst : stConfig.sort.descendingFirst;
- var promise = null;
- var throttle = attr.stDelay || stConfig.sort.delay;
-
- if (attr.stSortDefault) {
- sortDefault = scope.$eval(attr.stSortDefault) !== undefined ? scope.$eval(attr.stSortDefault) : attr.stSortDefault;
- }
-
- //view --> table state
- function sort () {
- if (descendingFirst) {
- index = index === 0 ? 2 : index - 1;
- } else {
- index++;
- }
-
- var func;
- predicate = ng.isFunction(getter(scope)) || ng.isArray(getter(scope)) ? getter(scope) : attr.stSort;
- if (index % 3 === 0 && !!skipNatural !== true) {
- //manual reset
- index = 0;
- ctrl.tableState().sort = {};
- ctrl.tableState().pagination.start = 0;
- func = ctrl.pipe.bind(ctrl);
- } else {
- func = ctrl.sortBy.bind(ctrl, predicate, index % 2 === 0);
- }
- if (promise !== null) {
- $timeout.cancel(promise);
- }
- if (throttle < 0) {
- func();
- } else {
- promise = $timeout(func, throttle);
- }
- }
-
- element.bind('click', function sortClick () {
- if (predicate) {
- scope.$apply(sort);
- }
- });
-
- if (sortDefault) {
- index = sortDefault === 'reverse' ? 1 : 0;
- sort();
- }
-
- //table state --> view
- scope.$watch(function () {
- return ctrl.tableState().sort;
- }, function (newValue) {
- if (newValue.predicate !== predicate) {
- index = 0;
- element
- .removeClass(classAscent)
- .removeClass(classDescent);
- } else {
- index = newValue.reverse === true ? 2 : 1;
- element
- .removeClass(stateClasses[index % 2])
- .addClass(stateClasses[index - 1]);
- }
- }, true);
- }
- };
- }]);
-
-ng.module('smart-table')
- .directive('stPagination', ['stConfig', function (stConfig) {
- return {
- restrict: 'EA',
- require: '^stTable',
- scope: {
- stItemsByPage: '=?',
- stDisplayedPages: '=?',
- stPageChange: '&'
- },
- templateUrl: function (element, attrs) {
- if (attrs.stTemplate) {
- return attrs.stTemplate;
- }
- return stConfig.pagination.template;
- },
- link: function (scope, element, attrs, ctrl) {
-
- scope.stItemsByPage = scope.stItemsByPage ? +(scope.stItemsByPage) : stConfig.pagination.itemsByPage;
- scope.stDisplayedPages = scope.stDisplayedPages ? +(scope.stDisplayedPages) : stConfig.pagination.displayedPages;
-
- scope.currentPage = 1;
- scope.pages = [];
-
- function redraw () {
- var paginationState = ctrl.tableState().pagination;
- var start = 1;
- var end;
- var i;
- var prevPage = scope.currentPage;
- scope.totalItemCount = paginationState.totalItemCount;
- scope.currentPage = Math.floor(paginationState.start / paginationState.number) + 1;
-
- start = Math.max(start, scope.currentPage - Math.abs(Math.floor(scope.stDisplayedPages / 2)));
- end = start + scope.stDisplayedPages;
-
- if (end > paginationState.numberOfPages) {
- end = paginationState.numberOfPages + 1;
- start = Math.max(1, end - scope.stDisplayedPages);
- }
-
- scope.pages = [];
- scope.numPages = paginationState.numberOfPages;
-
- for (i = start; i < end; i++) {
- scope.pages.push(i);
- }
-
- if (prevPage !== scope.currentPage) {
- scope.stPageChange({newPage: scope.currentPage});
- }
- }
-
- //table state --> view
- scope.$watch(function () {
- return ctrl.tableState().pagination;
- }, redraw, true);
-
- //scope --> table state (--> view)
- scope.$watch('stItemsByPage', function (newValue, oldValue) {
- if (newValue !== oldValue) {
- scope.selectPage(1);
- }
- });
-
- scope.$watch('stDisplayedPages', redraw);
-
- //view -> table state
- scope.selectPage = function (page) {
- if (page > 0 && page <= scope.numPages) {
- ctrl.slice((page - 1) * scope.stItemsByPage, scope.stItemsByPage);
- }
- };
-
- if (!ctrl.tableState().pagination.number) {
- ctrl.slice(0, scope.stItemsByPage);
- }
- }
- };
- }]);
-
-ng.module('smart-table')
- .directive('stPipe', ['stConfig', '$timeout', function (config, $timeout) {
- return {
- require: 'stTable',
- scope: {
- stPipe: '='
- },
- link: {
-
- pre: function (scope, element, attrs, ctrl) {
-
- var pipePromise = null;
-
- if (ng.isFunction(scope.stPipe)) {
- ctrl.preventPipeOnWatch();
- ctrl.pipe = function () {
-
- if (pipePromise !== null) {
- $timeout.cancel(pipePromise)
- }
-
- pipePromise = $timeout(function () {
- scope.stPipe(ctrl.tableState(), ctrl);
- }, config.pipe.delay);
-
- return pipePromise;
- }
- }
- },
-
- post: function (scope, element, attrs, ctrl) {
- ctrl.pipe();
- }
- }
- };
- }]);
-
-})(angular); \ No newline at end of file
diff --git a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js b/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js
deleted file mode 100644
index 0a65eaab..00000000
--- a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
-* @version 2.1.8
-* @license MIT
-*/
-!function(t,e){"use strict";t.module("smart-table",[]).run(["$templateCache",function(t){t.put("template/smart-table/pagination.html",'<nav ng-if="numPages && pages.length >= 2"><ul class="pagination"><li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a href="javascript: void(0);" ng-click="selectPage(page)">{{page}}</a></li></ul></nav>')}]),t.module("smart-table").constant("stConfig",{pagination:{template:"template/smart-table/pagination.html",itemsByPage:10,displayedPages:5},search:{delay:400,inputEvent:"input"},select:{mode:"single",selectedClass:"st-selected"},sort:{ascentClass:"st-sort-ascent",descentClass:"st-sort-descent",descendingFirst:!1,skipNatural:!1,delay:300},pipe:{delay:100}}),t.module("smart-table").controller("stTableController",["$scope","$parse","$filter","$attrs",function(a,n,s,i){function r(t){return t?[].concat(t):[]}function l(){b=r(o(a)),v===!0&&S.pipe()}function c(t,e){if(-1!=e.indexOf(".")){var a=e.split("."),s=a.pop(),i=a.join("."),r=n(i)(t);delete r[s],0==Object.keys(r).length&&c(t,i)}else delete t[e]}var o,u,p,g=i.stTable,d=n(g),f=d.assign,m=s("orderBy"),h=s("filter"),b=r(d(a)),P={sort:{},search:{},pagination:{start:0,totalItemCount:0}},v=!0,S=this;i.stSafeSrc&&(o=n(i.stSafeSrc),a.$watch(function(){var t=o(a);return t&&t.length?t[0]:e},function(t,e){t!==e&&l()}),a.$watch(function(){var t=o(a);return t?t.length:0},function(t){t!==b.length&&l()}),a.$watch(function(){return o(a)},function(t,e){t!==e&&(P.pagination.start=0,l())})),this.sortBy=function(e,a){return P.sort.predicate=e,P.sort.reverse=a===!0,t.isFunction(e)?P.sort.functionName=e.name:delete P.sort.functionName,P.pagination.start=0,this.pipe()},this.search=function(e,a){var s=P.search.predicateObject||{},i=a?a:"$";return e=t.isString(e)?e.trim():e,n(i).assign(s,e),e||c(s,i),P.search.predicateObject=s,P.pagination.start=0,this.pipe()},this.pipe=function(){var t,n=P.pagination;u=P.search.predicateObject?h(b,P.search.predicateObject):b,P.sort.predicate&&(u=m(u,P.sort.predicate,P.sort.reverse)),n.totalItemCount=u.length,n.number!==e&&(n.numberOfPages=u.length>0?Math.ceil(u.length/n.number):1,n.start=n.start>=u.length?(n.numberOfPages-1)*n.number:n.start,t=u.slice(n.start,n.start+parseInt(n.number))),f(a,t||u)},this.select=function(t,n){var s=r(d(a)),i=s.indexOf(t);-1!==i&&("single"===n?(t.isSelected=t.isSelected!==!0,p&&(p.isSelected=!1),p=t.isSelected===!0?t:e):s[i].isSelected=!s[i].isSelected)},this.slice=function(t,e){return P.pagination.start=t,P.pagination.number=e,this.pipe()},this.tableState=function(){return P},this.getFilteredCollection=function(){return u||b},this.setFilterFunction=function(t){h=s(t)},this.setSortFunction=function(t){m=s(t)},this.preventPipeOnWatch=function(){v=!1}}]).directive("stTable",function(){return{restrict:"A",controller:"stTableController",link:function(t,e,a,n){a.stSetFilter&&n.setFilterFunction(a.stSetFilter),a.stSetSort&&n.setSortFunction(a.stSetSort)}}}),t.module("smart-table").directive("stSearch",["stConfig","$timeout","$parse",function(t,e,a){return{require:"^stTable",link:function(n,s,i,r){var l=r,c=null,o=i.stDelay||t.search.delay,u=i.stInputEvent||t.search.inputEvent;i.$observe("stSearch",function(t,e){var a=s[0].value;t!==e&&a&&(r.tableState().search={},l.search(a,t))}),n.$watch(function(){return r.tableState().search},function(t){var e=i.stSearch||"$";t.predicateObject&&a(e)(t.predicateObject)!==s[0].value&&(s[0].value=a(e)(t.predicateObject)||"")},!0),s.bind(u,function(t){t=t.originalEvent||t,null!==c&&e.cancel(c),c=e(function(){l.search(t.target.value,i.stSearch||""),c=null},o)})}}}]),t.module("smart-table").directive("stSelectRow",["stConfig",function(t){return{restrict:"A",require:"^stTable",scope:{row:"=stSelectRow"},link:function(e,a,n,s){var i=n.stSelectMode||t.select.mode;a.bind("click",function(){e.$apply(function(){s.select(e.row,i)})}),e.$watch("row.isSelected",function(e){e===!0?a.addClass(t.select.selectedClass):a.removeClass(t.select.selectedClass)})}}}]),t.module("smart-table").directive("stSort",["stConfig","$parse","$timeout",function(a,n,s){return{restrict:"A",require:"^stTable",link:function(i,r,l,c){function o(){P?d=0===d?2:d-1:d++;var e;p=t.isFunction(g(i))||t.isArray(g(i))?g(i):l.stSort,d%3===0&&!!b!=!0?(d=0,c.tableState().sort={},c.tableState().pagination.start=0,e=c.pipe.bind(c)):e=c.sortBy.bind(c,p,d%2===0),null!==v&&s.cancel(v),0>S?e():v=s(e,S)}var u,p=l.stSort,g=n(p),d=0,f=l.stClassAscent||a.sort.ascentClass,m=l.stClassDescent||a.sort.descentClass,h=[f,m],b=l.stSkipNatural!==e?l.stSkipNatural:a.sort.skipNatural,P=l.stDescendingFirst!==e?l.stDescendingFirst:a.sort.descendingFirst,v=null,S=l.stDelay||a.sort.delay;l.stSortDefault&&(u=i.$eval(l.stSortDefault)!==e?i.$eval(l.stSortDefault):l.stSortDefault),r.bind("click",function(){p&&i.$apply(o)}),u&&(d="reverse"===u?1:0,o()),i.$watch(function(){return c.tableState().sort},function(t){t.predicate!==p?(d=0,r.removeClass(f).removeClass(m)):(d=t.reverse===!0?2:1,r.removeClass(h[d%2]).addClass(h[d-1]))},!0)}}}]),t.module("smart-table").directive("stPagination",["stConfig",function(t){return{restrict:"EA",require:"^stTable",scope:{stItemsByPage:"=?",stDisplayedPages:"=?",stPageChange:"&"},templateUrl:function(e,a){return a.stTemplate?a.stTemplate:t.pagination.template},link:function(e,a,n,s){function i(){var t,a,n=s.tableState().pagination,i=1,r=e.currentPage;for(e.totalItemCount=n.totalItemCount,e.currentPage=Math.floor(n.start/n.number)+1,i=Math.max(i,e.currentPage-Math.abs(Math.floor(e.stDisplayedPages/2))),t=i+e.stDisplayedPages,t>n.numberOfPages&&(t=n.numberOfPages+1,i=Math.max(1,t-e.stDisplayedPages)),e.pages=[],e.numPages=n.numberOfPages,a=i;t>a;a++)e.pages.push(a);r!==e.currentPage&&e.stPageChange({newPage:e.currentPage})}e.stItemsByPage=e.stItemsByPage?+e.stItemsByPage:t.pagination.itemsByPage,e.stDisplayedPages=e.stDisplayedPages?+e.stDisplayedPages:t.pagination.displayedPages,e.currentPage=1,e.pages=[],e.$watch(function(){return s.tableState().pagination},i,!0),e.$watch("stItemsByPage",function(t,a){t!==a&&e.selectPage(1)}),e.$watch("stDisplayedPages",i),e.selectPage=function(t){t>0&&t<=e.numPages&&s.slice((t-1)*e.stItemsByPage,e.stItemsByPage)},s.tableState().pagination.number||s.slice(0,e.stItemsByPage)}}}]),t.module("smart-table").directive("stPipe",["stConfig","$timeout",function(e,a){return{require:"stTable",scope:{stPipe:"="},link:{pre:function(n,s,i,r){var l=null;t.isFunction(n.stPipe)&&(r.preventPipeOnWatch(),r.pipe=function(){return null!==l&&a.cancel(l),l=a(function(){n.stPipe(r.tableState(),r)},e.pipe.delay)})},post:function(t,e,a,n){n.pipe()}}}}])}(angular);
-//# sourceMappingURL=smart-table.min.js.map
diff --git a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js.map b/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js.map
deleted file mode 100644
index 186e03c1..00000000
--- a/ecomp-portal-FE/client/bower_components/angular-smart-table/dist/smart-table.min.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["smart-table.min.js"],"names":["ng","undefined","module","run","$templateCache","put","constant","pagination","template","itemsByPage","displayedPages","search","delay","inputEvent","select","mode","selectedClass","sort","ascentClass","descentClass","descendingFirst","skipNatural","pipe","controller","$scope","$parse","$filter","$attrs","copyRefs","src","concat","updateSafeCopy","safeCopy","safeGetter","pipeAfterSafeCopy","ctrl","deepDelete","object","path","indexOf","partials","split","key","pop","parentPath","join","parentObject","Object","keys","length","filtered","lastSelected","propertyName","stTable","displayGetter","displaySetter","assign","orderBy","filter","tableState","start","totalItemCount","this","stSafeSrc","$watch","safeSrc","newValue","oldValue","sortBy","predicate","reverse","isFunction","functionName","name","input","predicateObject","prop","isString","trim","output","number","numberOfPages","Math","ceil","slice","parseInt","row","rows","index","isSelected","getFilteredCollection","setFilterFunction","filterName","setSortFunction","sortFunctionName","preventPipeOnWatch","directive","restrict","link","scope","element","attr","stSetFilter","stSetSort","stConfig","$timeout","require","tableCtrl","promise","throttle","stDelay","event","stInputEvent","$observe","value","predicateExpression","stSearch","bind","evt","originalEvent","cancel","target","stSelectMode","$apply","addClass","removeClass","func","getter","isArray","stSort","sortDefault","classAscent","stClassAscent","classDescent","stClassDescent","stateClasses","stSkipNatural","stDescendingFirst","stSortDefault","$eval","stItemsByPage","stDisplayedPages","stPageChange","templateUrl","attrs","stTemplate","redraw","end","i","paginationState","prevPage","currentPage","floor","max","abs","pages","numPages","push","newPage","selectPage","page","config","stPipe","pre","pipePromise","post","angular"],"mappings":"CAAA,SAAWA,EAAIC,GACX,YAEJD,GAAGE,OAAO,kBAAmBC,KAAK,iBAAkB,SAAUC,GAC1DA,EAAeC,IAAI,uCACf,qOAMRL,EAAGE,OAAO,eACPI,SAAS,YACRC,YACEC,SAAU,uCACVC,YAAa,GACbC,eAAgB,GAElBC,QACEC,MAAO,IACPC,WAAY,SAEdC,QACEC,KAAM,SACNC,cAAe,eAEjBC,MACEC,YAAa,iBACbC,aAAc,kBACdC,iBAAiB,EACjBC,aAAa,EACbT,MAAM,KAERU,MACEV,MAAO,OAGbZ,EAAGE,OAAO,eACPqB,WAAW,qBAAsB,SAAU,SAAU,UAAW,SAAU,SAA4BC,EAAQC,EAAQC,EAASC,GAqB9H,QAASC,GAAUC,GACjB,MAAOA,MAASC,OAAOD,MAGzB,QAASE,KACPC,EAAWJ,EAASK,EAAWT,IAC3BU,KAAsB,GACxBC,EAAKb,OAIT,QAASc,GAAYC,EAAQC,GAC3B,GAAyB,IAArBA,EAAKC,QAAQ,KAAY,CAC3B,GAAIC,GAAWF,EAAKG,MAAM,KACtBC,EAAMF,EAASG,MACfC,EAAaJ,EAASK,KAAK,KAC3BC,EAAerB,EAAOmB,GAAYP,SAC/BS,GAAaJ,GACoB,GAApCK,OAAOC,KAAKF,GAAcG,QAC5Bb,EAAWC,EAAQO,cAGdP,GAAOC,GA1ClB,GAGIL,GAYAiB,EAGAC,EAlBAC,EAAezB,EAAO0B,QACtBC,EAAgB7B,EAAO2B,GACvBG,E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,GAGlBA,EAAc3D,EAAS,WACrBN,EAAM+D,OAAO/H,EAAKwB,aAAcxB,IAC/B8H,EAAO3I,KAAKV,UAOrByJ,KAAM,SAAUlE,EAAOC,EAAS4C,EAAO7G,GACrCA,EAAKb,cAMZgJ","file":"smart-table.min.js","sourcesContent":["(function (ng, undefined){\n 'use strict';\n\nng.module('smart-table', []).run(['$templateCache', function ($templateCache) {\n $templateCache.put('template/smart-table/pagination.html',\n '<nav ng-if=\"numPages && pages.length >= 2\"><ul class=\"pagination\">' +\n '<li ng-repeat=\"page in pages\" ng-class=\"{active: page==currentPage}\"><a href=\"javascript: void(0);\" ng-click=\"selectPage(page)\">{{page}}</a></li>' +\n '</ul></nav>');\n}]);\n\n\nng.module('smart-table')\n .constant('stConfig', {\n pagination: {\n template: 'template/smart-table/pagination.html',\n itemsByPage: 10,\n displayedPages: 5\n },\n search: {\n delay: 400, // ms\n inputEvent: 'input'\n },\n select: {\n mode: 'single',\n selectedClass: 'st-selected'\n },\n sort: {\n ascentClass: 'st-sort-ascent',\n descentClass: 'st-sort-descent',\n descendingFirst: false,\n skipNatural: false,\n delay:300\n },\n pipe: {\n delay: 100 //ms\n }\n });\nng.module('smart-table')\n .controller('stTableController', ['$scope', '$parse', '$filter', '$attrs', function StTableController ($scope, $parse, $filter, $attrs) {\n var propertyName = $attrs.stTable;\n var displayGetter = $parse(propertyName);\n var displaySetter = displayGetter.assign;\n var safeGetter;\n var orderBy = $filter('orderBy');\n var filter = $filter('filter');\n var safeCopy = copyRefs(displayGetter($scope));\n var tableState = {\n sort: {},\n search: {},\n pagination: {\n start: 0,\n totalItemCount: 0\n }\n };\n var filtered;\n var pipeAfterSafeCopy = true;\n var ctrl = this;\n var lastSelected;\n\n function copyRefs (src) {\n return src ? [].concat(src) : [];\n }\n\n function updateSafeCopy () {\n safeCopy = copyRefs(safeGetter($scope));\n if (pipeAfterSafeCopy === true) {\n ctrl.pipe();\n }\n }\n\n function deepDelete (object, path) {\n if (path.indexOf('.') != -1) {\n var partials = path.split('.');\n var key = partials.pop();\n var parentPath = partials.join('.');\n var parentObject = $parse(parentPath)(object)\n delete parentObject[key];\n if (Object.keys(parentObject).length == 0) {\n deepDelete(object, parentPath);\n }\n } else {\n delete object[path];\n }\n }\n\n if ($attrs.stSafeSrc) {\n safeGetter = $parse($attrs.stSafeSrc);\n $scope.$watch(function () {\n var safeSrc = safeGetter($scope);\n return safeSrc && safeSrc.length ? safeSrc[0] : undefined;\n }, function (newValue, oldValue) {\n if (newValue !== oldValue) {\n updateSafeCopy();\n }\n });\n $scope.$watch(function () {\n var safeSrc = safeGetter($scope);\n return safeSrc ? safeSrc.length : 0;\n }, function (newValue, oldValue) {\n if (newValue !== safeCopy.length) {\n updateSafeCopy();\n }\n });\n $scope.$watch(function () {\n return safeGetter($scope);\n }, function (newValue, oldValue) {\n if (newValue !== oldValue) {\n tableState.pagination.start = 0;\n updateSafeCopy();\n }\n });\n }\n\n /**\n * sort the rows\n * @param {Function | String} predicate - function or string which will be used as predicate for the sorting\n * @param [reverse] - if you want to reverse the order\n */\n this.sortBy = function sortBy (predicate, reverse) {\n tableState.sort.predicate = predicate;\n tableState.sort.reverse = reverse === true;\n\n if (ng.isFunction(predicate)) {\n tableState.sort.functionName = predicate.name;\n } else {\n delete tableState.sort.functionName;\n }\n\n tableState.pagination.start = 0;\n return this.pipe();\n };\n\n /**\n * search matching rows\n * @param {String} input - the input string\n * @param {String} [predicate] - the property name against you want to check the match, otherwise it will search on all properties\n */\n this.search = function search (input, predicate) {\n var predicateObject = tableState.search.predicateObject || {};\n var prop = predicate ? predicate : '$';\n\n input = ng.isString(input) ? input.trim() : input;\n $parse(prop).assign(predicateObject, input);\n // to avoid to filter out null value\n if (!input) {\n deepDelete(predicateObject, prop);\n }\n tableState.search.predicateObject = predicateObject;\n tableState.pagination.start = 0;\n return this.pipe();\n };\n\n /**\n * this will chain the operations of sorting and filtering based on the current table state (sort options, filtering, ect)\n */\n this.pipe = function pipe () {\n var pagination = tableState.pagination;\n var output;\n filtered = tableState.search.predicateObject ? filter(safeCopy, tableState.search.predicateObject) : safeCopy;\n if (tableState.sort.predicate) {\n filtered = orderBy(filtered, tableState.sort.predicate, tableState.sort.reverse);\n }\n pagination.totalItemCount = filtered.length;\n if (pagination.number !== undefined) {\n pagination.numberOfPages = filtered.length > 0 ? Math.ceil(filtered.length / pagination.number) : 1;\n pagination.start = pagination.start >= filtered.length ? (pagination.numberOfPages - 1) * pagination.number : pagination.start;\n output = filtered.slice(pagination.start, pagination.start + parseInt(pagination.number));\n }\n displaySetter($scope, output || filtered);\n };\n\n /**\n * select a dataRow (it will add the attribute isSelected to the row object)\n * @param {Object} row - the row to select\n * @param {String} [mode] - \"single\" or \"multiple\" (multiple by default)\n */\n this.select = function select (row, mode) {\n var rows = copyRefs(displayGetter($scope));\n var index = rows.indexOf(row);\n if (index !== -1) {\n if (mode === 'single') {\n row.isSelected = row.isSelected !== true;\n if (lastSelected) {\n lastSelected.isSelected = false;\n }\n lastSelected = row.isSelected === true ? row : undefined;\n } else {\n rows[index].isSelected = !rows[index].isSelected;\n }\n }\n };\n\n /**\n * take a slice of the current sorted/filtered collection (pagination)\n *\n * @param {Number} start - start index of the slice\n * @param {Number} number - the number of item in the slice\n */\n this.slice = function splice (start, number) {\n tableState.pagination.start = start;\n tableState.pagination.number = number;\n return this.pipe();\n };\n\n /**\n * return the current state of the table\n * @returns {{sort: {}, search: {}, pagination: {start: number}}}\n */\n this.tableState = function getTableState () {\n return tableState;\n };\n\n this.getFilteredCollection = function getFilteredCollection () {\n return filtered || safeCopy;\n };\n\n /**\n * Use a different filter function than the angular FilterFilter\n * @param filterName the name under which the custom filter is registered\n */\n this.setFilterFunction = function setFilterFunction (filterName) {\n filter = $filter(filterName);\n };\n\n /**\n * Use a different function than the angular orderBy\n * @param sortFunctionName the name under which the custom order function is registered\n */\n this.setSortFunction = function setSortFunction (sortFunctionName) {\n orderBy = $filter(sortFunctionName);\n };\n\n /**\n * Usually when the safe copy is updated the pipe function is called.\n * Calling this method will prevent it, which is something required when using a custom pipe function\n */\n this.preventPipeOnWatch = function preventPipe () {\n pipeAfterSafeCopy = false;\n };\n }])\n .directive('stTable', function () {\n return {\n restrict: 'A',\n controller: 'stTableController',\n link: function (scope, element, attr, ctrl) {\n\n if (attr.stSetFilter) {\n ctrl.setFilterFunction(attr.stSetFilter);\n }\n\n if (attr.stSetSort) {\n ctrl.setSortFunction(attr.stSetSort);\n }\n }\n };\n });\n\nng.module('smart-table')\n .directive('stSearch', ['stConfig', '$timeout','$parse', function (stConfig, $timeout, $parse) {\n return {\n require: '^stTable',\n link: function (scope, element, attr, ctrl) {\n var tableCtrl = ctrl;\n var promise = null;\n var throttle = attr.stDelay || stConfig.search.delay;\n var event = attr.stInputEvent || stConfig.search.inputEvent;\n\n attr.$observe('stSearch', function (newValue, oldValue) {\n var input = element[0].value;\n if (newValue !== oldValue && input) {\n ctrl.tableState().search = {};\n tableCtrl.search(input, newValue);\n }\n });\n\n //table state -> view\n scope.$watch(function () {\n return ctrl.tableState().search;\n }, function (newValue, oldValue) {\n var predicateExpression = attr.stSearch || '$';\n if (newValue.predicateObject && $parse(predicateExpression)(newValue.predicateObject) !== element[0].value) {\n element[0].value = $parse(predicateExpression)(newValue.predicateObject) || '';\n }\n }, true);\n\n // view -> table state\n element.bind(event, function (evt) {\n evt = evt.originalEvent || evt;\n if (promise !== null) {\n $timeout.cancel(promise);\n }\n\n promise = $timeout(function () {\n tableCtrl.search(evt.target.value, attr.stSearch || '');\n promise = null;\n }, throttle);\n });\n }\n };\n }]);\n\nng.module('smart-table')\n .directive('stSelectRow', ['stConfig', function (stConfig) {\n return {\n restrict: 'A',\n require: '^stTable',\n scope: {\n row: '=stSelectRow'\n },\n link: function (scope, element, attr, ctrl) {\n var mode = attr.stSelectMode || stConfig.select.mode;\n element.bind('click', function () {\n scope.$apply(function () {\n ctrl.select(scope.row, mode);\n });\n });\n\n scope.$watch('row.isSelected', function (newValue) {\n if (newValue === true) {\n element.addClass(stConfig.select.selectedClass);\n } else {\n element.removeClass(stConfig.select.selectedClass);\n }\n });\n }\n };\n }]);\n\nng.module('smart-table')\n .directive('stSort', ['stConfig', '$parse', '$timeout', function (stConfig, $parse, $timeout) {\n return {\n restrict: 'A',\n require: '^stTable',\n link: function (scope, element, attr, ctrl) {\n\n var predicate = attr.stSort;\n var getter = $parse(predicate);\n var index = 0;\n var classAscent = attr.stClassAscent || stConfig.sort.ascentClass;\n var classDescent = attr.stClassDescent || stConfig.sort.descentClass;\n var stateClasses = [classAscent, classDescent];\n var sortDefault;\n var skipNatural = attr.stSkipNatural !== undefined ? attr.stSkipNatural : stConfig.sort.skipNatural;\n var descendingFirst = attr.stDescendingFirst !== undefined ? attr.stDescendingFirst : stConfig.sort.descendingFirst;\n var promise = null;\n var throttle = attr.stDelay || stConfig.sort.delay;\n\n if (attr.stSortDefault) {\n sortDefault = scope.$eval(attr.stSortDefault) !== undefined ? scope.$eval(attr.stSortDefault) : attr.stSortDefault;\n }\n\n //view --> table state\n function sort () {\n if (descendingFirst) {\n index = index === 0 ? 2 : index - 1;\n } else {\n index++;\n }\n\n var func;\n predicate = ng.isFunction(getter(scope)) || ng.isArray(getter(scope)) ? getter(scope) : attr.stSort;\n if (index % 3 === 0 && !!skipNatural !== true) {\n //manual reset\n index = 0;\n ctrl.tableState().sort = {};\n ctrl.tableState().pagination.start = 0;\n func = ctrl.pipe.bind(ctrl);\n } else {\n func = ctrl.sortBy.bind(ctrl, predicate, index % 2 === 0);\n }\n if (promise !== null) {\n $timeout.cancel(promise);\n }\n if (throttle < 0) {\n func();\n } else {\n promise = $timeout(func, throttle);\n }\n }\n\n element.bind('click', function sortClick () {\n if (predicate) {\n scope.$apply(sort);\n }\n });\n\n if (sortDefault) {\n index = sortDefault === 'reverse' ? 1 : 0;\n sort();\n }\n\n //table state --> view\n scope.$watch(function () {\n return ctrl.tableState().sort;\n }, function (newValue) {\n if (newValue.predicate !== predicate) {\n index = 0;\n element\n .removeClass(classAscent)\n .removeClass(classDescent);\n } else {\n index = newValue.reverse === true ? 2 : 1;\n element\n .removeClass(stateClasses[index % 2])\n .addClass(stateClasses[index - 1]);\n }\n }, true);\n }\n };\n }]);\n\nng.module('smart-table')\n .directive('stPagination', ['stConfig', function (stConfig) {\n return {\n restrict: 'EA',\n require: '^stTable',\n scope: {\n stItemsByPage: '=?',\n stDisplayedPages: '=?',\n stPageChange: '&'\n },\n templateUrl: function (element, attrs) {\n if (attrs.stTemplate) {\n return attrs.stTemplate;\n }\n return stConfig.pagination.template;\n },\n link: function (scope, element, attrs, ctrl) {\n\n scope.stItemsByPage = scope.stItemsByPage ? +(scope.stItemsByPage) : stConfig.pagination.itemsByPage;\n scope.stDisplayedPages = scope.stDisplayedPages ? +(scope.stDisplayedPages) : stConfig.pagination.displayedPages;\n\n scope.currentPage = 1;\n scope.pages = [];\n\n function redraw () {\n var paginationState = ctrl.tableState().pagination;\n var start = 1;\n var end;\n var i;\n var prevPage = scope.currentPage;\n scope.totalItemCount = paginationState.totalItemCount;\n scope.currentPage = Math.floor(paginationState.start / paginationState.number) + 1;\n\n start = Math.max(start, scope.currentPage - Math.abs(Math.floor(scope.stDisplayedPages / 2)));\n end = start + scope.stDisplayedPages;\n\n if (end > paginationState.numberOfPages) {\n end = paginationState.numberOfPages + 1;\n start = Math.max(1, end - scope.stDisplayedPages);\n }\n\n scope.pages = [];\n scope.numPages = paginationState.numberOfPages;\n\n for (i = start; i < end; i++) {\n scope.pages.push(i);\n }\n\n if (prevPage !== scope.currentPage) {\n scope.stPageChange({newPage: scope.currentPage});\n }\n }\n\n //table state --> view\n scope.$watch(function () {\n return ctrl.tableState().pagination;\n }, redraw, true);\n\n //scope --> table state (--> view)\n scope.$watch('stItemsByPage', function (newValue, oldValue) {\n if (newValue !== oldValue) {\n scope.selectPage(1);\n }\n });\n\n scope.$watch('stDisplayedPages', redraw);\n\n //view -> table state\n scope.selectPage = function (page) {\n if (page > 0 && page <= scope.numPages) {\n ctrl.slice((page - 1) * scope.stItemsByPage, scope.stItemsByPage);\n }\n };\n\n if (!ctrl.tableState().pagination.number) {\n ctrl.slice(0, scope.stItemsByPage);\n }\n }\n };\n }]);\n\nng.module('smart-table')\n .directive('stPipe', ['stConfig', '$timeout', function (config, $timeout) {\n return {\n require: 'stTable',\n scope: {\n stPipe: '='\n },\n link: {\n\n pre: function (scope, element, attrs, ctrl) {\n\n var pipePromise = null;\n\n if (ng.isFunction(scope.stPipe)) {\n ctrl.preventPipeOnWatch();\n ctrl.pipe = function () {\n\n if (pipePromise !== null) {\n $timeout.cancel(pipePromise)\n }\n\n pipePromise = $timeout(function () {\n scope.stPipe(ctrl.tableState(), ctrl);\n }, config.pipe.delay);\n\n return pipePromise;\n }\n }\n },\n\n post: function (scope, element, attrs, ctrl) {\n ctrl.pipe();\n }\n }\n };\n }]);\n\n})(angular);"],"sourceRoot":"/source/"} \ No newline at end of file