diff options
author | 2017-05-04 07:48:42 -0400 | |
---|---|---|
committer | 2017-05-04 12:28:17 -0400 | |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js b/ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js deleted file mode 100644 index bf79c898..00000000 --- a/ecomp-portal-FE/client/bower_components/angular-smart-table/src/stSort.js +++ /dev/null @@ -1,82 +0,0 @@ -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); - } - }; - }]); |