Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-smart-table

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-smart-table - npm Package Compare versions

Comparing version 2.1.10 to 2.1.11

14

dist/smart-table.js
/**
* @version 2.1.9
* @version 2.1.10
* @license MIT

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

delay: 400, // ms
inputEvent: 'input'
inputEvent: 'input',
trimSearch: false
},

@@ -158,3 +159,2 @@ select: {

input = ng.isString(input) ? input.trim() : input;
$parse(prop).assign(predicateObject, input);

@@ -296,2 +296,3 @@ // to avoid to filter out null value

var event = attr.stInputEvent || stConfig.search.inputEvent;
var trimSearch = attr.trimSearch || stConfig.search.trimSearch;

@@ -302,2 +303,3 @@ attr.$observe('stSearch', function (newValue, oldValue) {

ctrl.tableState().search = {};
input = ng.isString(input) && trimSearch ? input.trim() : input;
tableCtrl.search(input, newValue);

@@ -325,3 +327,5 @@ }

promise = $timeout(function () {
tableCtrl.search(evt.target.value, attr.stSearch || '');
var input = evt.target.value;
input = ng.isString(input) && trimSearch ? input.trim() : input;
tableCtrl.search(input, attr.stSearch || '');
promise = null;

@@ -450,3 +454,3 @@ }, throttle);

.addClass(stateClasses[index - 1])
.attr(ariaSort, newValue.reverse ? ariaSortDescending : ariaSortAscending);
.attr(ariaSort, newValue.reverse ? ariaSortAscending : ariaSortDescending);
}

@@ -453,0 +457,0 @@ }, true);

/**
* @version 2.1.9
* @version 2.1.10
* @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="#" ng-click="selectPage(page); $event.preventDefault(); $event.stopPropagation();">{{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(e,a,n,s){function i(t){return t?[].concat(t):[]}function r(){h=i(c(e)),!0===v&&P.pipe()}function l(t,e){if(-1!=e.indexOf(".")){var n=e.split("."),s=n.pop(),i=n.join("."),r=a(i)(t);delete r[s],0==Object.keys(r).length&&l(t,i)}else delete t[e]}var c,o,u,p=s.stTable,g=a(p),d=g.assign,f=n("orderBy"),m=n("filter"),h=i(g(e)),b={sort:{},search:{},pagination:{start:0,totalItemCount:0}},v=!0,P=this;s.stSafeSrc&&(c=a(s.stSafeSrc),e.$watch(function(){var t=c(e);return t&&t.length?t[0]:void 0},function(t,e){t!==e&&r()}),e.$watch(function(){var t=c(e);return t?t.length:0},function(t,e){t!==h.length&&r()}),e.$watch(function(){return c(e)},function(t,e){t!==e&&(b.pagination.start=0,r())})),this.sortBy=function(e,a){return b.sort.predicate=e,b.sort.reverse=!0===a,t.isFunction(e)?b.sort.functionName=e.name:delete b.sort.functionName,b.pagination.start=0,this.pipe()},this.search=function(e,n,s){var i=b.search.predicateObject||{},r=n||"$";return e=t.isString(e)?e.trim():e,a(r).assign(i,e),e||l(i,r),b.search.predicateObject=i,b.pagination.start=0,this.pipe()},this.pipe=function(){var t,a=b.pagination;o=b.search.predicateObject?m(h,b.search.predicateObject):h,b.sort.predicate&&(o=f(o,b.sort.predicate,b.sort.reverse)),a.totalItemCount=o.length,void 0!==a.number&&(a.numberOfPages=o.length>0?Math.ceil(o.length/a.number):1,a.start=a.start>=o.length?(a.numberOfPages-1)*a.number:a.start,t=o.slice(a.start,a.start+parseInt(a.number))),d(e,t||o)},this.select=function(t,a){var n=i(g(e)),s=n.indexOf(t);-1!==s&&("single"===a?(t.isSelected=!0!==t.isSelected,u&&(u.isSelected=!1),u=!0===t.isSelected?t:void 0):n[s].isSelected=!n[s].isSelected)},this.slice=function(t,e){return b.pagination.start=t,b.pagination.number=e,this.pipe()},this.tableState=function(){return b},this.getFilteredCollection=function(){return o||h},this.setFilterFunction=function(t){m=n(t)},this.setSortFunction=function(t){f=n(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,e){var n=i.stSearch||"$";t.predicateObject&&a(n)(t.predicateObject)!==s[0].value&&(s[0].value=a(n)(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){!0===e?a.addClass(t.select.selectedClass):a.removeClass(t.select.selectedClass)})}}}]),t.module("smart-table").directive("stSort",["stConfig","$parse","$timeout",function(e,a,n){return{restrict:"A",require:"^stTable",link:function(s,i,r,l){function c(){b?g=0===g?2:g-1:g++;var e;u=t.isFunction(p(s))||t.isArray(p(s))?p(s):r.stSort,g%3==0&&!0!=!!h?(g=0,l.tableState().sort={},l.tableState().pagination.start=0,e=l.pipe.bind(l)):e=l.sortBy.bind(l,u,g%2==0),null!==v&&n.cancel(v),P<0?e():v=n(function(){e()},P)}var o,u=r.stSort,p=a(u),g=0,d=r.stClassAscent||e.sort.ascentClass,f=r.stClassDescent||e.sort.descentClass,m=[d,f],h=void 0!==r.stSkipNatural?r.stSkipNatural:e.sort.skipNatural,b=void 0!==r.stDescendingFirst?r.stDescendingFirst:e.sort.descendingFirst,v=null,P=r.stDelay||e.sort.delay;r.stSortDefault&&(o=void 0!==s.$eval(r.stSortDefault)?s.$eval(r.stSortDefault):r.stSortDefault),i.bind("click",function(){u&&s.$apply(c)}),o&&(g="reverse"===o?1:0,c()),s.$watch(function(){return l.tableState().sort},function(t){t.predicate!==u?(g=0,i.removeClass(d).removeClass(f)):(g=!0===t.reverse?2:1,i.removeClass(m[g%2]).addClass(m[g-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,(t=(i=Math.max(i,e.currentPage-Math.abs(Math.floor(e.stDisplayedPages/2))))+e.stDisplayedPages)>n.numberOfPages&&(t=n.numberOfPages+1,i=Math.max(1,t-e.stDisplayedPages)),e.pages=[],e.numPages=n.numberOfPages,a=i;a<t;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);
!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="#" ng-click="selectPage(page); $event.preventDefault(); $event.stopPropagation();">{{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",trimSearch:!1},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,r){function i(t){return t?[].concat(t):[]}function c(){b=i(o(a)),!0===S&&P.pipe()}function l(t,e){if(-1!=e.indexOf(".")){var a=e.split("."),s=a.pop(),r=a.join("."),i=n(r)(t);delete i[s],0==Object.keys(i).length&&l(t,r)}else delete t[e]}var o,u,p,g=r.stTable,d=n(g),f=d.assign,m=s("orderBy"),h=s("filter"),b=i(d(a)),v={sort:{},search:{},pagination:{start:0,totalItemCount:0}},S=!0,P=this;r.stSafeSrc&&(o=n(r.stSafeSrc),a.$watch(function(){var t=o(a);return t&&t.length?t[0]:e},function(t,e){t!==e&&c()}),a.$watch(function(){var t=o(a);return t?t.length:0},function(t,e){t!==b.length&&c()}),a.$watch(function(){return o(a)},function(t,e){t!==e&&(v.pagination.start=0,c())})),this.sortBy=function(e,a){return v.sort.predicate=e,v.sort.reverse=!0===a,t.isFunction(e)?v.sort.functionName=e.name:delete v.sort.functionName,v.pagination.start=0,this.pipe()},this.search=function(t,e,a){var s=v.search.predicateObject||{},r=e||"$";return n(r).assign(s,t),t||l(s,r),v.search.predicateObject=s,v.pagination.start=0,this.pipe()},this.pipe=function(){var t,n=v.pagination;u=v.search.predicateObject?h(b,v.search.predicateObject):b,v.sort.predicate&&(u=m(u,v.sort.predicate,v.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=i(d(a)),r=s.indexOf(t);-1!==r&&("single"===n?(t.isSelected=!0!==t.isSelected,p&&(p.isSelected=!1),p=!0===t.isSelected?t:e):s[r].isSelected=!s[r].isSelected)},this.slice=function(t,e){return v.pagination.start=t,v.pagination.number=e,this.pipe()},this.tableState=function(){return v},this.getFilteredCollection=function(){return u||b},this.setFilterFunction=function(t){h=s(t)},this.setSortFunction=function(t){m=s(t)},this.preventPipeOnWatch=function(){S=!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(e,a,n){return{require:"^stTable",link:function(s,r,i,c){var l=c,o=null,u=i.stDelay||e.search.delay,p=i.stInputEvent||e.search.inputEvent,g=i.trimSearch||e.search.trimSearch;i.$observe("stSearch",function(e,a){var n=r[0].value;e!==a&&n&&(c.tableState().search={},n=t.isString(n)&&g?n.trim():n,l.search(n,e))}),s.$watch(function(){return c.tableState().search},function(t,e){var a=i.stSearch||"$";t.predicateObject&&n(a)(t.predicateObject)!==r[0].value&&(r[0].value=n(a)(t.predicateObject)||"")},!0),r.bind(p,function(e){e=e.originalEvent||e,null!==o&&a.cancel(o),o=a(function(){var a=e.target.value;a=t.isString(a)&&g?a.trim():a,l.search(a,i.stSearch||""),o=null},u)})}}}]),t.module("smart-table").directive("stSelectRow",["stConfig",function(t){return{restrict:"A",require:"^stTable",scope:{row:"=stSelectRow"},link:function(e,a,n,s){var r=n.stSelectMode||t.select.mode;a.bind("click",function(){e.$apply(function(){s.select(e.row,r)})}),e.$watch("row.isSelected",function(e){!0===e?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(r,i,c,l){function o(){v?d=0===d?2:d-1:d++;var e;p=t.isFunction(g(r))||t.isArray(g(r))?g(r):c.stSort,d%3==0&&!0!=!!b?(d=0,l.tableState().sort={},l.tableState().pagination.start=0,e=l.pipe.bind(l)):e=l.sortBy.bind(l,p,d%2==0),null!==S&&s.cancel(S),P<0?e():S=s(function(){e()},P)}var u,p=c.stSort,g=n(p),d=0,f=c.stClassAscent||a.sort.ascentClass,m=c.stClassDescent||a.sort.descentClass,h=[f,m],b=c.stSkipNatural!==e?c.stSkipNatural:a.sort.skipNatural,v=c.stDescendingFirst!==e?c.stDescendingFirst:a.sort.descendingFirst,S=null,P=c.stDelay||a.sort.delay,y="aria-sort";i.attr("role","columnheader").attr(y,"none"),c.stSortDefault&&(u=r.$eval(c.stSortDefault)!==e?r.$eval(c.stSortDefault):c.stSortDefault),i.bind("click",function(){p&&r.$apply(o)}),u&&(d="reverse"===u?1:0,o()),r.$watch(function(){return l.tableState().sort},function(t){t.predicate!==p?(d=0,i.removeClass(f).removeClass(m).attr(y,"none")):(d=!0===t.reverse?2:1,i.removeClass(h[d%2]).addClass(h[d-1]).attr(y,t.reverse?"ascending":"descending"))},!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 r(){var t,a,n=s.tableState().pagination,r=1,i=e.currentPage;for(e.totalItemCount=n.totalItemCount,e.currentPage=Math.floor(n.start/n.number)+1,(t=(r=Math.max(r,e.currentPage-Math.abs(Math.floor(e.stDisplayedPages/2))))+e.stDisplayedPages)>n.numberOfPages&&(t=n.numberOfPages+1,r=Math.max(1,t-e.stDisplayedPages)),e.pages=[],e.numPages=n.numberOfPages,a=r;a<t;a++)e.pages.push(a);i!==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},r,!0),e.$watch("stItemsByPage",function(t,a){t!==a&&e.selectPage(1)}),e.$watch("stDisplayedPages",r),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,r,i){var c=null;t.isFunction(n.stPipe)&&(i.preventPipeOnWatch(),i.pipe=function(){return null!==c&&a.cancel(c),c=a(function(){n.stPipe(i.tableState(),i)},e.pipe.delay)})},post:function(t,e,a,n){n.pipe()}}}}])}(angular);
//# sourceMappingURL=smart-table.min.js.map
{
"name": "angular-smart-table",
"version": "2.1.10",
"version": "2.1.11",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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