/usr/share/javascript/smart-table/smart-table.min.js is in libjs-angularjs-smart-table 1.4.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 | (function(b,c){b.module("smart-table",[]).run(["$templateCache",function(d){d.put("template/smart-table/pagination.html",'<div class="pagination" ng-if="pages.length >= 2"><ul class="pagination"><li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a ng-click="selectPage(page)">{{page}}</a></li></ul></div>')}]);b.module("smart-table").controller("stTableController",["$scope","$parse","$filter","$attrs",function a(x,e,t,f){var q=f.stTable;var o=e(q);var l=o.assign;var A;var p=t("orderBy");var n=t("filter");var B=r(o(x));var i={sort:{},search:{},pagination:{start:0}};var z=true;var j=this;var g;function r(D){return[].concat(D)}function m(){B=r(A(x));if(z===true){j.pipe()}}if(f.stSafeSrc){A=e(f.stSafeSrc);x.$watch(function(){var D=A(x);return D?D.length:0},function(E,D){if(E!==B.length){m()}});x.$watch(function(){return A(x)},function(E,D){if(E!==D){m()}})}this.sortBy=function w(D,E){i.sort.predicate=D;i.sort.reverse=E===true;i.pagination.start=0;return this.pipe()};this.search=function k(E,D){var G=i.search.predicateObject||{};var F=D?D:"$";G[F]=E;if(!E){delete G[F]}i.search.predicateObject=G;i.pagination.start=0;return this.pipe()};this.pipe=function y(){var D=i.pagination;var E=i.search.predicateObject?n(B,i.search.predicateObject):B;if(i.sort.predicate){E=p(E,i.sort.predicate,i.sort.reverse)}if(D.number!==c){D.numberOfPages=E.length>0?Math.ceil(E.length/D.number):1;D.start=D.start>=E.length?(D.numberOfPages-1)*D.number:D.start;E=E.slice(D.start,D.start+D.number)}l(x,E)};this.select=function s(G,F){var E=B;var D=E.indexOf(G);if(D!==-1){if(F==="single"){G.isSelected=G.isSelected!==true;if(g){g.isSelected=false}g=G.isSelected===true?G:c}else{E[D].isSelected=!E[D].isSelected}}};this.slice=function C(E,D){i.pagination.start=E;i.pagination.number=D;return this.pipe()};this.tableState=function v(){return i};this.setFilterFunction=function d(D){n=t(D)};this.setSortFunction=function h(D){p=t(D)};this.preventPipeOnWatch=function u(){z=false}}]).directive("stTable",function(){return{restrict:"A",controller:"stTableController",link:function(f,e,d,g){if(d.stSetFilter){g.setFilterFunction(d.stSetFilter)}if(d.stSetSort){g.setSortFunction(d.stSetSort)}}}});b.module("smart-table").directive("stSearch",["$timeout",function(d){return{require:"^stTable",scope:{predicate:"=?stSearch"},link:function(g,f,e,j){var h=j;var k=null;var i=e.stDelay||400;g.$watch("predicate",function(m,l){if(m!==l){j.tableState().search={};h.search(f[0].value||"",m)}});g.$watch(function(){return j.tableState().search},function(n,m){var l=g.predicate||"$";if(n.predicateObject&&n.predicateObject[l]!==f[0].value){f[0].value=n.predicateObject[l]||""}},true);f.bind("input",function(l){l=l.originalEvent||l;if(k!==null){d.cancel(k)}k=d(function(){h.search(l.target.value,g.predicate||"");k=null},i)})}}}]);b.module("smart-table").directive("stSelectRow",function(){return{restrict:"A",require:"^stTable",scope:{row:"=stSelectRow"},link:function(f,e,d,g){var h=d.stSelectMode||"single";e.bind("click",function(){f.$apply(function(){g.select(f.row,h)})});f.$watch("row.isSelected",function(j,i){if(j===true){e.addClass("st-selected")}else{e.removeClass("st-selected")}})}}});b.module("smart-table").directive("stSort",["$parse",function(d){return{restrict:"A",require:"^stTable",link:function(p,h,j,e){var m=j.stSort;var k=d(m);var i=0;var n=j.stClassAscent||"st-sort-ascent";var o=j.stClassDescent||"st-sort-descent";var f=[n,o];function g(){i++;if(i%3===0&&j.stSkipNatural===c){i=0;e.tableState().sort={};e.tableState().pagination.start=0;e.pipe()}else{e.sortBy(m,i%2===0)}}if(b.isFunction(k(p))){m=k(p)}h.bind("click",function l(){if(m){p.$apply(g)}});if(j.stSortDefault!==c){i=j.stSortDefault==="reverse"?1:0;g()}p.$watch(function(){return e.tableState().sort},function(q){if(q.predicate!==m){i=0;h.removeClass(n).removeClass(o)}else{i=q.reverse===true?2:1;h.removeClass(f[i%2]).addClass(f[i-1])}},true)}}}]);b.module("smart-table").directive("stPagination",function(){return{restrict:"EA",require:"^stTable",scope:{stItemsByPage:"=?",stDisplayedPages:"=?"},templateUrl:function(e,d){if(d.stTemplate){return d.stTemplate}return"template/smart-table/pagination.html"},link:function(f,e,d,g){f.stItemsByPage=f.stItemsByPage?+(f.stItemsByPage):10;f.stDisplayedPages=f.stDisplayedPages?+(f.stDisplayedPages):5;f.currentPage=1;f.pages=[];function h(){var k=g.tableState().pagination;var m=1;var j;var l;f.currentPage=Math.floor(k.start/k.number)+1;m=Math.max(m,f.currentPage-Math.abs(Math.floor(f.stDisplayedPages/2)));j=m+f.stDisplayedPages;if(j>k.numberOfPages){j=k.numberOfPages+1;m=Math.max(1,j-f.stDisplayedPages)}f.pages=[];f.numPages=k.numberOfPages;for(l=m;l<j;l++){f.pages.push(l)}}f.$watch(function(){return g.tableState().pagination},h,true);f.$watch("stItemsByPage",function(){f.selectPage(1)});f.$watch("stDisplayedPages",h);f.selectPage=function(i){if(i>0&&i<=f.numPages){g.slice((i-1)*f.stItemsByPage,f.stItemsByPage)}};g.slice(0,f.stItemsByPage)}}});b.module("smart-table").directive("stPipe",function(){return{require:"stTable",scope:{stPipe:"="},link:{pre:function(f,e,d,g){if(b.isFunction(f.stPipe)){g.preventPipeOnWatch();g.pipe=function(){return f.stPipe(g.tableState(),g)}}}}}})})(angular);
|