New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-scrollable-table

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-scrollable-table - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

angular-scrollable-table.min.js

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

(function(e){"use strict";function t(e){return parseInt(e.replace(/px|%/,""),10)}e.module("scrollable-table",[]).directive("scrollableTable",["$timeout","$q","$parse",function(n,r,i){return{transclude:true,restrict:"E",scope:{rows:"=watch",sortFn:"="},template:'<div class="scrollableContainer">'+'<div class="headerSpacer"></div>'+'<div class="scrollArea" ng-transclude></div>'+"</div>",controller:["$scope","$element","$attrs",function(s,o,u){function a(e,t){var n=s.sortExpr.match(/(.+)\s+as\s+(.+)/);var r={};r[n[1]]=e;var o=i(n[2])(r);r[n[1]]=t;var u=i(n[2])(r);if(o===u)return 0;return o>u?1:-1}function f(e){var t=o.find(".headerSpacer").height();var n=o.find(".scrollArea").scrollTop();o.find(".scrollArea").scrollTop(n+e.position().top-t)}function l(){function t(){if(o.find("table:visible").length===0){n(t,100)}else{e.resolve()}}var e=r.defer();n(t);return e.promise}function h(){if(!o.find("thead th .th-inner").length){o.find("thead th").wrapInner('<div class="th-inner"></div>')}if(o.find("thead th .th-inner:not(:has(.box))").length){o.find("thead th .th-inner:not(:has(.box))").wrapInner('<div class="box"></div>')}o.find("table th .th-inner:visible").each(function(n,r){r=e.element(r);var i=r.parent().width(),s=o.find("table th:visible:last"),u=i;if(s.css("text-align")!=="center"){var a=o.find(".scrollArea").height()<o.find("table").height();if(s[0]==r.parent()[0]&&a){u+=o.find(".scrollArea").width()-o.find("tbody tr").width();u=Math.max(u,i)}}var f=t(r.parent().css("min-width")),l=r.parent().attr("title");u=Math.max(f,u);r.css("width",u);if(!l){l=r.find(".title .ng-scope").html()||r.find(".box").html()}r.attr("title",l.trim())});c.resolve()}function p(){var e=l().then(h),t=s.headerResizeHanlers||[];for(var n=0;n<t.length;n++){e=e.then(t[n])}return e}this.getSortExpr=function(){return s.sortExpr};this.isAsc=function(){return s.asc};this.setSortExpr=function(e){s.asc=true;s.sortExpr=e};this.toggleSort=function(){s.asc=!s.asc};this.doSort=function(e){if(e){s.rows.sort(function(t,n){var r=e(t,n);return s.asc?r:r*-1})}else{s.rows.sort(function(e,t){var n=a(e,t);return s.asc?n:n*-1})}};this.renderTalble=function(){return l().then(h)};this.getTableElement=function(){return o};this.appendTableResizingHandler=function(e){var t=s.headerResizeHanlers||[];for(var n=0;n<t.length;n++){if(t[n].name===e.name){return}}t.push(e);s.headerResizeHanlers=t};s.$on("rowSelected",function(e,t){var n=o.find(".scrollArea table tr[row-id='"+t+"']");if(n.length===1){r.all([l(),c.promise]).then(function(){f(n)})}});var c=r.defer();s.$watch("rows",function(e,t){if(e){p(o.find(".scrollArea").width());s.sortExpr=null;o.find(".scrollArea").scrollTop(0)}});s.asc=!u.hasOwnProperty("desc");s.sortAttr=u.sortAttr;o.find(".scrollArea").scroll(function(e){o.find("thead th .th-inner").css("margin-left",0-e.target.scrollLeft)});s.$on("renderScrollableTable",function(){p(o.find(".scrollArea").width())});e.element(window).on("resize",function(){s.$apply()});s.$watch(function(){return o.find(".scrollArea").width()},function(e,t){if(e*t<=0){return}p()})}]}}]).directive("sortableHeader",[function(){return{transclude:true,scope:true,require:"^scrollableTable",template:'<div class="box">'+'<div ng-mouseenter="enter()" ng-mouseleave="leave()">'+'<div class="title" ng-transclude></div>'+'<span class="orderWrapper">'+'<span class="order" ng-show="focused || isActive()" '+'ng-click="toggleSort($event)" ng-class="{active:isActive()}">'+'<i ng-show="isAscending()" class="glyphicon glyphicon-chevron-up"></i>'+'<i ng-show="!isAscending()" class="glyphicon glyphicon-chevron-down"></i>'+"</span>"+"</span>"+"</div>"+"</div>",link:function(t,n,r,i){var s=r.on||"a as a."+r.col;t.element=e.element(n);t.isActive=function(){return i.getSortExpr()===s};t.toggleSort=function(e){if(t.isActive()){i.toggleSort()}else{i.setSortExpr(s)}i.doSort(t[r.comparatorFn]);e.preventDefault()};t.isAscending=function(){if(t.focused&&!t.isActive()){return true}else{return i.isAsc()}};t.enter=function(){t.focused=true};t.leave=function(){t.focused=false};t.isLastCol=function(){return n.parent().find("th:last-child").get(0)===n.get(0)}}}}]).directive("resizable",["$compile",function(n){return{restrict:"A",priority:0,require:"^scrollableTable",link:function(i,s,o,u){function a(){var t=s.find("table th .th-inner");if(t.find(".resize-rod").length==0){u.getTableElement().find(".scrollArea table").css("table-layout","auto");var r=e.element('<div class="resize-rod" ng-mousedown="resizing($event)"></div>');t.append(n(r)(i))}}function f(){var n=u.getTableElement();var r=1;n.find("table th .th-inner:visible").each(function(n,i){i=e.element(i);var s=i.parent().width(),o=t(i.parent().css("min-width"));s=Math.max(o,s);i.css("left",r);r+=s})}function l(){var n=1,r=u.getTableElement();u.getTableElement().find("table th .th-inner:visible").each(function(i,s){s=e.element(s);var o=s.parent().width(),u=r.find("table th:visible:last"),a=t(s.parent().css("min-width"));o=Math.max(a,o);if(u[0]!=s.parent()[0]){s.parent().css("width",o)}s.css("left",n);n+=o})}function c(n){var r=u.getTableElement(),i=r.find("table th:visible").length,s=r.find("table th:visible:last");r.find("table th:visible").each(function(r,o){o=e.element(o);if(s.get(0)==o.get(0)){o.css("width","auto");return}var u=o.data("width");if(/\d+%$/.test(u)){u=Math.ceil(n*t(u)/100)}else{u=n/i}o.css("width",u+"px")});u.renderTalble().then(l())}u.appendTableResizingHandler(function(){a()});u.appendTableResizingHandler(function(){var t=u.getTableElement().find(".scrollArea table");if(t.css("table-layout")==="auto"){f()}else{c(t.parent().width())}});i.resizing=function(n){var r=u.getTableElement().find(".scrollArea").scrollLeft(),i=e.element(n.target).parent(),s=i.parent(),o=t(i.css("left"))+i.width()-r,a=n.pageX,f=e.element(document),c=e.element("body"),h=e.element(".scrollableContainer .resizing-cover"),p=e.element('<div class="scaler">');c.addClass("scrollable-resizing");h.addClass("active");e.element(".scrollableContainer").append(p);p.css("left",o);f.bind("mousemove",function(e){var n=e.pageX-a,r=t(p.css("left"))-o,i=s.width(),u=t(s.css("min-width")),f=s.next().width(),l=t(s.next().css("min-width"));a=e.pageX;e.preventDefault();if(n>0&&f-r<=l||n<0&&i+r<=u){return}p.css("left",t(p.css("left"))+n)});f.bind("mouseup",function(n){n.preventDefault();p.remove();c.removeClass("scrollable-resizing");h.removeClass("active");f.unbind("mousemove");f.unbind("mouseup");var r=t(p.css("left"))-o,i=s.width(),a=t(s.css("min-width")),d=s.next().width(),v=t(s.next().css("min-width")),m=u.getTableElement().find(".scrollArea table");if(m.css("table-layout")==="auto"){m.find("th .th-inner").each(function(t,n){n=e.element(n);var r=n.parent().width();n.parent().css("width",r)})}m.css("table-layout","fixed");if(r>0&&d-r<=v){r=d-v}s.next().removeAttr("style");i+=r;s.css("width",Math.max(a,i));s.next().css("width",d-r);u.renderTalble().then(l())})}}}}])})(angular)
!function(e){"use strict";function t(e){return parseInt(e.replace(/px|%/,""),10)}var n=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;e.module("scrollable-table",[]).directive("scrollableTable",["$timeout","$q","$parse",function(i,r,s){return{transclude:!0,restrict:"E",scope:{rows:"=watch",sortFn:"="},template:'<div class="scrollableContainer"><div class="headerSpacer"></div><div class="scrollArea" ng-transclude></div></div>',controller:["$scope","$element","$attrs",function(a,l,o){function c(e,t){var n=a.sortExpr.match(/(.+)\s+as\s+(.+)/),i={};i[n[1]]=e;var r=s(n[2])(i);i[n[1]]=t;var l=s(n[2])(i);return r===l?0:r>l?1:-1}function d(e){var t=l.find(".headerSpacer").height(),n=l.find(".scrollArea").scrollTop();l.find(".scrollArea").scrollTop(n+e.position().top-t)}function h(){function e(){0===l.find("table:visible").length?i(e,100):t.resolve()}var t=r.defer();return i(e),t.promise}function f(){l.find("thead th .th-inner").length||l.find("thead th").wrapInner('<div class="th-inner"></div>'),l.find("thead th .th-inner:not(:has(.box))").length&&l.find("thead th .th-inner:not(:has(.box))").wrapInner('<div class="box"></div>'),l.find("table th .th-inner:visible").each(function(n,i){i=e.element(i);var r=i.parent().width(),s=l.find("table th:visible:last"),a=r;if("center"!==s.css("text-align")){var o=l.find(".scrollArea").height()<l.find("table").height();s[0]==i.parent()[0]&&o&&(a+=l.find(".scrollArea").width()-l.find("tbody tr").width(),a=Math.max(a,r))}var c=t(i.parent().css("min-width")),d=i.parent().attr("title");a=Math.max(c,a),i.css("width",a),d||(d=i.find(".title .ng-scope").text()||i.find(".box").text()),i.attr("title",d.trim())}),v.resolve()}function u(){for(var e=h().then(f),t=a.headerResizeHanlers||[],n=0;n<t.length;n++)e=e.then(t[n]);return e}this.getSortExpr=function(){return a.sortExpr},this.isAsc=function(){return a.asc},this.setSortExpr=function(e){a.asc=!0,a.sortExpr=e},this.toggleSort=function(){a.asc=!a.asc},this.doSort=function(e){e?a.rows.sort(function(t,n){var i=e(t,n);return a.asc?i:i*-1}):a.rows.sort(function(e,t){var n=c(e,t);return a.asc?n:n*-1})},this.renderTalble=function(){return h().then(f)},this.getTableElement=function(){return l},this.appendTableResizingHandler=function(e){for(var t=a.headerResizeHanlers||[],n=0;n<t.length;n++)if(t[n].name===e.name)return;t.push(e),a.headerResizeHanlers=t},a.$on("rowSelected",function(e,t){var n=l.find(".scrollArea table tr[row-id='"+t+"']");1===n.length&&r.all([h(),v.promise]).then(function(){d(n)})});var v=r.defer();a.$watch("rows",function(e,t){e&&(u(l.find(".scrollArea").width()),a.sortExpr=null,l.find(".scrollArea").scrollTop(0))}),a.asc=!o.hasOwnProperty("desc"),a.sortAttr=o.sortAttr;var p=n?"thead":"thead th .th-inner";l.find(".scrollArea").scroll(function(e){l.find(p).css("margin-left",0-e.target.scrollLeft)}),a.$on("renderScrollableTable",function(){u(l.find(".scrollArea").width())}),e.element(window).on("resize",function(){i(function(){a.$apply()})}),a.$watch(function(){return l.find(".scrollArea").width()},function(e,t){e*t<=0||u()})}]}}]).directive("sortableHeader",[function(){return{transclude:!0,scope:!0,require:"^scrollableTable",template:'<div class="box"><div ng-mouseenter="enter()" ng-mouseleave="leave()"><div class="title" ng-transclude></div><span class="orderWrapper"><span class="order" ng-show="focused || isActive()" ng-click="toggleSort($event)" ng-class="{active:isActive()}"><i ng-show="isAscending()" class="glyphicon glyphicon-chevron-up"></i><i ng-show="!isAscending()" class="glyphicon glyphicon-chevron-down"></i></span></span></div></div>',link:function(t,n,i,r){var s=i.on||"a as a."+i.col;t.element=e.element(n),t.isActive=function(){return r.getSortExpr()===s},t.toggleSort=function(e){t.isActive()?r.toggleSort():r.setSortExpr(s),r.doSort(t[i.comparatorFn]),e.preventDefault()},t.isAscending=function(){return!(!t.focused||t.isActive())||r.isAsc()},t.enter=function(){t.focused=!0},t.leave=function(){t.focused=!1},t.isLastCol=function(){return n.parent().find("th:last-child").get(0)===n.get(0)}}}}]).directive("resizable",["$compile",function(n){return{restrict:"A",priority:0,scope:!1,require:"scrollableTable",link:function(i,r,s,a){function l(){var t=r.find("table th:not(:last-child) .th-inner");if(0==t.find(".resize-rod").length){a.getTableElement().find(".scrollArea table").css("table-layout","auto");var s=e.element('<div class="resize-rod" ng-mousedown="resizing($event)"></div>');t.append(n(s)(i))}}function o(){var n=a.getTableElement(),i=1;n.find("table th .th-inner:visible").each(function(n,r){r=e.element(r);var s=r.parent().width(),a=t(r.parent().css("min-width"));s=Math.max(a,s),r.css("left",i),i+=s})}function c(){var n=1,i=a.getTableElement();a.getTableElement().find("table th .th-inner:visible").each(function(r,s){s=e.element(s);var a=s.parent().width(),l=i.find("table th:visible:last"),o=t(s.parent().css("min-width"));a=Math.max(o,a),l[0]!=s.parent()[0]&&s.parent().css("width",a),s.css("left",n),n+=a})}function d(n){var i=a.getTableElement(),r=i.find("table th:visible").length,s=i.find("table th:visible:last");i.find("table th:visible").each(function(i,a){if(a=e.element(a),s.get(0)==a.get(0))return void a.css("width","auto");var l=a.data("width");l=/\d+%$/.test(l)?Math.ceil(n*t(l)/100):n/r,a.css("width",l+"px")}),a.renderTalble().then(c())}a.appendTableResizingHandler(function(){l()}),a.appendTableResizingHandler(function(){var e=a.getTableElement().find(".scrollArea table");"auto"===e.css("table-layout")?o():d(e.parent().width())}),i.resizing=function(n){var i=a.getTableElement().find(".scrollArea").scrollLeft(),r=e.element(n.target).parent(),s=r.parent(),l=t(r.css("left"))+r.width()-i,o=n.pageX,d=e.element(document),h=e.element("body"),f=e.element(".scrollableContainer .resizing-cover"),u=e.element('<div class="scaler">');h.addClass("scrollable-resizing"),f.addClass("active"),e.element(".scrollableContainer").append(u),u.css("left",l),d.bind("mousemove",function(e){var n=e.pageX-o,i=t(u.css("left"))-l,r=s.width(),a=s.nextAll("th:visible").first(),c=t(s.css("min-width")),d=a.width(),h=t(a.css("min-width"));o=e.pageX,e.preventDefault(),n>0&&d-i<=h||n<0&&r+i<=c||u.css("left",t(u.css("left"))+n)}),d.bind("mouseup",function(n){n.preventDefault(),u.remove(),h.removeClass("scrollable-resizing"),f.removeClass("active"),d.unbind("mousemove"),d.unbind("mouseup");var i=t(u.css("left"))-l,r=s.width(),o=t(s.css("min-width")),v=s.nextAll("th:visible").first(),p=v.width(),b=t(v.css("min-width")),g=a.getTableElement().find(".scrollArea table");"auto"===g.css("table-layout")&&g.find("th .th-inner").each(function(t,n){n=e.element(n);var i=n.parent().width();n.parent().css("width",i)}),g.css("table-layout","fixed"),i>0&&p-i<=b&&(i=p-b),v.removeAttr("style"),r+=i,s.css("width",Math.max(o,r)),v.css("width",p-i),a.renderTalble().then(c())})}}}}])}(angular);
{
"name": "angular-scrollable-table",
"version": "1.0.0",
"description": "angular-scrollable-table ========================",
"main": "angular-scrollable-table.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"angular",
"table",
"scrollable",
"fixed-header"
],
"author": "Alec LaLonde",
"description": "A fixed-header scrollable table which auto-truncates overly-long headers, has resizable columns and sortable headers",
"version": "1.0.1",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://taurenk@github.com/taurenk/angular-scrollable-table.git"
"url": "https://github.com/alalonde/angular-scrollable-table"
},
"author": "Tauren K <Tauren.Kristich@gmail.com>",
"license": "ISC",
"bugs": {
"url": "https://github.com/taurenk/angular-scrollable-table/issues"
"scripts": {
"compress": "uglifyjs --compress --mangle -o angular-scrollable-table.min.js -- angular-scrollable-table.js"
},
"homepage": "https://github.com/taurenk/angular-scrollable-table#readme"
"dependencies": {},
"devDependencies": {
"uglify-js": "^2.7.5"
}
}

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