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

column-resizer

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

column-resizer - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

.mocharc.js

11

CHANGELOG.md

@@ -1,6 +0,13 @@

<a name="v1.3.0"></a>
# [v1.3.0](https://github.com/MonsantoCo/column-resizer/compare/v1.2.2...v1.3.0) (2019-04-29)
<a name="v1.3.2"></a>
# [v1.3.2](https://github.com/MonsantoCo/column-resizer/compare/v1.3.1...v1.3.2) (2019-06-05)
## Bug fixes
## Enhancement
* Security update [d60d9a9](https://github.com/MonsantoCo/column-resizer/commit/d60d9a9e327e93196809f85d16a272ea7deee2a9) (2019-06-05)
<a name="v1.3.1"></a>
# [v1.3.1](https://github.com/MonsantoCo/column-resizer/compare/v1.2.2...v1.3.1) (2019-04-29)
## Bug fixes
## Enhancement
* Support SRR [0d5fcec](https://github.com/MonsantoCo/column-resizer/pull/14/commits/0d5fcecfd8b8822f1614e2f93d2b5bb2615e37aa) (2019-04-29)

@@ -7,0 +14,0 @@

2

dist/column-resizer.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ColumnResizer=t():e.ColumnResizer=t()}(this,function(){return function(r){var i={};function __webpack_require__(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}return __webpack_require__.m=r,__webpack_require__.c=i,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(__webpack_require__.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)__webpack_require__.d(r,i,function(e){return t[e]}.bind(null,i));return r},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="/",__webpack_require__(__webpack_require__.s=1)}([function(e,t,r){"use strict";e.exports=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return l});var i=r(0),n=r.n(i);function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,s=(o=0,function(){return o++}),l=function ColumnResizer(e){var c=this,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ColumnResizer),_defineProperty(this,"ID","id"),_defineProperty(this,"PX","px"),_defineProperty(this,"RESIZABLE","grip-resizable"),_defineProperty(this,"FLEX","grip-flex"),_defineProperty(this,"legacyIE",0<navigator.userAgent.indexOf("Trident/4.0")),_defineProperty(this,"reset",function(e){return c.init(e)}),_defineProperty(this,"onResize",function(){var e=c.tb;if(e.classList.remove(c.RESIZABLE),e.opt.fixed){e.tableWidth=Number(window.getComputedStyle(e).width.replace(/px/,"")).valueOf();for(var t=0,r=0;r<e.columnCnt;r++)t+=e.columns[r].w;for(var i=0;i<e.columnCnt;i++)e.columns[i].style.width=Math.round(1e3*e.columns[i].w/t)/10+"%",e.columns[i].locked=!0}else c.applyBounds(),"flex"===e.opt.resizeMode&&e.opt.serialize&&c.serializeStore();e.classList.add(c.RESIZABLE),c.syncGrips()}),_defineProperty(this,"onGripMouseDown",function(e){var t=e.target.parentNode.data,r=c.tb,i=r.grips[t.i],o=e.touches;if(i.ox=o?o[0].pageX:e.pageX,i.l=i.offsetLeft,i.x=i.l,c.createStyle(document.querySelector("head"),"*{cursor:"+r.opt.dragCursor+"!important}"),document.addEventListener("touchmove",c.onGripDrag),document.addEventListener("mousemove",c.onGripDrag),document.addEventListener("touchend",c.onGripDragOver),document.addEventListener("mouseup",c.onGripDragOver),i.classList.add(r.opt.draggingClass),c.grip=i,r.columns[t.i].locked)for(var n,l=0;l<r.columnCnt;l++)(n=r.columns[l]).locked=!1,n.w=Number(window.getComputedStyle(n).width.replace(/px/,"")).valueOf();e.preventDefault()}),_defineProperty(this,"onGripDrag",function(e){var t=c.grip;if(t){var r=t.t,i=e.touches,o=(i?i[0].pageX:e.pageX)-t.ox+t.l,n=r.opt.minWidth,l=t.i,a=1.5*r.cellSpace+n+r.borderSpace,s=l===r.columnCnt-1,d=l?r.grips[l-1].offsetLeft+r.cellSpace+n:a,p=r.opt.fixed?l===r.columnCnt-1?r.tableWidth-a:r.grips[l+1].offsetLeft-r.cellSpace-n:1/0;if(o=Math.max(d,Math.min(p,o)),t.x=o,t.style.left=o+c.PX,s&&(t.w=r.columns[l].w+o-t.l),r.opt.liveDrag){s?(r.columns[l].style.width=t.w+c.PX,!r.opt.fixed&&r.opt.overflow?r.style.minWidth=r.tableWidth+o-t.l+c.PX:r.tableWidth=Number(window.getComputedStyle(r).width.replace(/px/,"")).valueOf()):c.syncCols(r,l,!1,r.opt),c.syncGrips();var u=r.opt.onDrag;u&&u(e)}e.preventDefault()}}),_defineProperty(this,"onGripDragOver",function(e){var t=c.grip;document.removeEventListener("touchend",c.onGripDragOver),document.removeEventListener("mouseup",c.onGripDragOver),document.removeEventListener("touchmove",c.onGripDrag),document.removeEventListener("mousemove",c.onGripDrag);var r=document.querySelector("head").lastChild;if(r.parentNode.removeChild(r),t){if(t.classList.remove(t.t.opt.draggingClass),t.x-t.l!=0){var i=t.t,o=i.opt.onResize,n=t.i;if(n===i.columnCnt-1){var l=i.columns[n];l.style.width=t.w+c.PX,l.w=t.w}else c.syncCols(i,n,!0,i.opt);i.opt.fixed||c.applyBounds(),c.syncGrips(),o&&o(e),i.opt.serialize&&c.serializeStore()}c.grip=null}}),_defineProperty(this,"init",function(e){if(e.disable)return c.destroy();var t=c.tb,r=t.getAttribute(c.ID)||c.RESIZABLE+s();if(!t.matches("table")||t.extended&&!e.partialRefresh)return null;var i=document.querySelector("head");if(c.createStyle(i," .grip-resizable{table-layout:fixed;} .grip-resizable > tbody > tr > td, .grip-resizable > tbody > tr > th{overflow:hidden} .grip-padding > tbody > tr > td, .grip-padding > tbody > tr > th{padding-left:0!important; padding-right:0!important;} .grip-container{ height:0px; position:relative;} .grip-handle{margin-left:-5px; position:absolute; z-index:5; } .grip-handle .grip-resizable{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: col-resize;top:0px} .grip-lastgrip{position:absolute; width:1px; } .grip-drag{ border-left:1px dotted black;\t} .grip-flex{width:auto!important;} .grip-handle.grip-disabledgrip .grip-resizable{cursor:default; display:none;}"),e.hoverCursor&&"col-resize"!==e.hoverCursor){var o=".grip-handle .grip-resizable:hover{cursor:"+e.hoverCursor+"!important}";c.createStyle(i,o)}t.setAttribute(c.ID,r);var n=t.opt;t.opt=c.extendOptions(e);var l=c.getTableHeaders(t);if(c.extendTable(l),e.remoteTable&&e.remoteTable.matches("table")){var a=c.getTableHeaders(t.opt.remoteTable);l.length===a.length?c.extendRemoteTable(t.opt.remoteTable,a,t):console.warn("column count for remote table did not match")}return n}),_defineProperty(this,"applyBounds",function(){var e=c.tb,r=e.columns.map(function(e){return window.getComputedStyle(e).width});e.style.width=window.getComputedStyle(e).width,e.tableWidth=Number(e.style.width.replace(/px/,"")).valueOf(),e.classList.remove(c.FLEX),e.columns.forEach(function(e,t){e.style.width=r[t],e.w=Number(r[t].replace(/px/,"")).valueOf()}),e.classList.add(c.FLEX)}),_defineProperty(this,"serializeStore",function(){var e=c.store,t=c.tb;e[t.getAttribute(c.ID)]="";for(var r=0,i=0;i<t.columns.length;i++){var o=window.getComputedStyle(t.columns[i]).width.replace(/px/,"");e[t.getAttribute(c.ID)]+=o+";",r+=Number(o).valueOf()}e[t.getAttribute(c.ID)]+=r.toString(),t.opt.fixed||(e[t.getAttribute(c.ID)]+=";"+window.getComputedStyle(t).width.replace(/px/,""))}),_defineProperty(this,"syncGrips",function(){var e=c.tb;e.gripContainer.style.width=e.tableWidth+c.PX;for(var t=0;t<e.columnCnt;t++){var r=e.columns[t],i=r.getBoundingClientRect(),o=e.getBoundingClientRect();e.grips[t].style.left=i.left-o.left+r.offsetWidth+e.cellSpace/2+c.PX,e.grips[t].style.height=(e.opt.headerOnly?e.columns[0].offsetHeight:e.offsetHeight)+c.PX}}),_defineProperty(this,"destroy",function(){var e=c.tb,t=e.getAttribute(c.ID);return t?(c.store[t]="",e.classList.remove(c.RESIZABLE),e.classList.remove(c.FLEX),e.remote&&(e.remote.classList.remove(c.RESIZABLE),e.remote.classList.remove(c.FLEX)),e.gripContainer&&e.gripContainer.parentNode&&e.gripContainer.parentNode.removeChild(e.gripContainer),delete e.extended,e.opt):null}),_defineProperty(this,"createStyle",function(e,t){var r=n()(t).toString(),i=e.querySelectorAll("style");if(!Array.from(i).filter(function(e){return e.gripid===r}).length){var o=document.createElement("style");o.type="text/css",o.gripid=r,o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t)),e.appendChild(o)}}),_defineProperty(this,"extendOptions",function(e){var t=Object.assign({},ColumnResizer.DEFAULTS,e);switch(t.fixed=!0,t.overflow=!1,t.resizeMode){case"flex":t.fixed=!1;break;case"overflow":t.fixed=!1,t.overflow=!0}return t}),_defineProperty(this,"getTableHeaders",function(e){var t="#"+e.id,r=Array.from(e.querySelectorAll(t+">thead>tr:nth-of-type(1)>th"));return(r=r.concat(Array.from(e.querySelectorAll(t+">thead>tr:nth-of-type(1)>td")))).length||(r=(r=(r=(r=Array.from(e.querySelectorAll(t+">tbody>tr:nth-of-type(1)>th"))).concat(Array.from(e.querySelectorAll(t+">tr:nth-of-type(1)>th")))).concat(Array.from(e.querySelectorAll(t+">tbody>tr:nth-of-type(1)>td")))).concat(Array.from(e.querySelectorAll(t+">tr:nth-of-type(1)>td")))),c.filterInvisible(r,!1)}),_defineProperty(this,"filterInvisible",function(e,i){return e.filter(function(e){var t=i?-1:e.offsetWidth,r=i?-1:e.offsetHeight;return!(0===t&&0===r||e.style&&e.style.display&&"none"===window.getComputedStyle(e).display||!1)})}),_defineProperty(this,"extendTable",function(e){var t=c.tb;t.opt.removePadding&&t.classList.add("grip-padding"),t.classList.add(c.RESIZABLE),t.insertAdjacentHTML("beforebegin",'<div class="grip-container"/>'),t.grips=[],t.columns=[],t.tableWidth=Number(window.getComputedStyle(t).width.replace(/px/,"")).valueOf(),t.gripContainer=t.previousElementSibling,t.opt.marginLeft&&(t.gripContainer.style.marginLeft=t.opt.marginLeft),t.opt.marginRight&&(t.gripContainer.style.marginRight=t.opt.marginRight),t.cellSpace=parseInt(c.legacyIE?t.cellSpacing||t.currentStyle.borderSpacing:window.getComputedStyle(t).borderSpacing.split(" ")[0].replace(/px/,""))||2,t.borderSpace=parseInt(c.legacyIE?t.border||t.currentStyle.borderLeftWidth:window.getComputedStyle(t).borderLeftWidth.replace(/px/,""))||1,t.extended=!0,c.createGrips(e)}),_defineProperty(this,"extendRemoteTable",function(i,o,n){n.opt.removePadding&&i.classList.add("grip-padding"),i.classList.add(c.RESIZABLE),i.getAttribute(c.ID)||i.setAttribute(c.ID,n.getAttribute(c.ID)+"remote"),i.columns=[],o.forEach(function(e,t){var r=o[t];r.w=n.columns[t].w,r.style.width=r.w+c.PX,r.removeAttribute("width"),i.columns.push(r)}),i.tableWidth=n.tableWidth,i.cellSpace=n.cellSpace,i.borderSpace=n.borderSpace;var e=Array.from(i.querySelectorAll("col"));i.columnGrp=c.filterInvisible(e,!0),i.columnGrp.forEach(function(e,t){e.removeAttribute("width"),e.style.width=n.columnGrp[t].style.width}),n.remote=i}),_defineProperty(this,"createGrips",function(n){var l=c.tb;l.columnGrp=c.filterInvisible(Array.from(l.querySelectorAll("col")),!0),l.columnGrp.forEach(function(e){e.removeAttribute("width")}),l.columnCnt=n.length;var a=!1;c.store[l.getAttribute(c.ID)]&&(c.deserializeStore(n),a=!0),l.opt.widths||(l.opt.widths=[]),n.forEach(function(e,t){var r=n[t],i=-1!==l.opt.disabledColumns.indexOf(t);c.createDiv(l.gripContainer,"grip-handle");var o=l.gripContainer.lastChild;!i&&l.opt.gripInnerHtml&&(o.innerHTML=l.opt.gripInnerHtml),c.createDiv(o,c.RESIZABLE),t===l.columnCnt-1&&(o.classList.add("grip-lastgrip"),l.opt.fixed&&(o.innerHTML="")),o.addEventListener("touchstart",c.onGripMouseDown,{capture:!0,passive:!0}),o.addEventListener("mousedown",c.onGripMouseDown,!0),i?o.classList.add("grip-disabledgrip"):(o.classList.remove("grip-disabledgrip"),o.addEventListener("touchstart",c.onGripMouseDown,{capture:!0,passive:!0}),o.addEventListener("mousedown",c.onGripMouseDown,!0)),o.t=l,o.i=t,l.opt.widths[t]?r.w=l.opt.widths[t]:r.w=a?Number(r.style.width.replace(/px/,"")).valueOf():Number(window.getComputedStyle(r).width.replace(/px/,"")).valueOf(),r.style.width=r.w+c.PX,r.removeAttribute("width"),o.data={i:t,t:l.getAttribute(c.ID),last:t===l.columnCnt-1},l.grips.push(o),l.columns.push(r)});var e=Array.from(l.querySelectorAll("td"));e.concat(Array.from(l.querySelectorAll("th"))),(e=(e=e.filter(function(e){for(var t=0;t<n.length;t++)if(n[t]===e)return!1;return!0})).filter(function(e){return!(e.querySelectorAll("table th").length||e.querySelectorAll("table td").length)})).forEach(function(e){e.removeAttribute("width")}),l.opt.fixed||(l.removeAttribute("width"),l.classList.add(c.FLEX)),c.syncGrips()}),_defineProperty(this,"deserializeStore",function(e){var t=c.tb;if(t.columnGrp.forEach(function(e){e.removeAttribute("width")}),t.opt.flush)c.store[t.getAttribute(c.ID)]="";else{var r=c.store[t.getAttribute(c.ID)].split(";"),i=r[t.columnCnt+1];!t.opt.fixed&&i&&(t.style.width=i+c.PX,t.opt.overflow&&(t.style.minWidth=i+c.PX,t.tableWidth=Number(i).valueOf()));for(var o=0;o<t.columnCnt;o++)e[o].style.width=r[o]+c.PX,t.columnGrp[o]&&(t.columnGrp[o].style.width=100*Number(r[o]).valueOf()/Number(r[t.columnCnt]).valueOf()+"%")}}),_defineProperty(this,"createDiv",function(e,t,r){var i=document.createElement("div");i.classList.add(t),r&&(i.innerHTML=r),e.appendChild(i)}),_defineProperty(this,"syncCols",function(e,t,r,i){var o=e.remote,n=c.grip.x-c.grip.l,l=e.columns[t],a=e.columns[t+1];if(l&&a){var s=l.w+n,d=a.w-n,p=s+c.PX;if(l.style.width=p,e.columnGrp[t]&&e.columnGrp[t].style.width&&(e.columnGrp[t].style.width=p),o&&(o.columns[t].style.width=p,o.columnGrp[t]&&o.columnGrp[t].style.width&&(o.columnGrp[t].style.width=p)),i.fixed){var u=d+c.PX;a.style.width=u,e.columnGrp[t+1]&&e.columnGrp[t+1].style.width&&(e.columnGrp[t+1].style.width=u),o&&(o.columns[t+1].style.width=u,o.columnGrp[t+1]&&o.columnGrp[t+1].style.width&&(o.columnGrp[t+1].style.width=u))}else i.overflow&&(e.style.minWidth=e.tableWidth+n+c.PX);r&&(l.w=s,a.w=i.fixed?d:a.w,o&&(o.columns[t].w=s,o.columns[t+1].w=i.fixed?d:a.w))}});try{this.store=sessionStorage}catch(e){this.store={}}this.grip=null,this.tb=e,window.addEventListener("resize",this.onResize),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),this.init(t)};l.DEFAULTS={resizeMode:"fit",draggingClass:"grip-drag",gripInnerHtml:"",liveDrag:!1,minWidth:15,headerOnly:!1,hoverCursor:"col-resize",dragCursor:"col-resize",flush:!1,marginLeft:null,marginRight:null,remoteTable:null,disable:!1,partialRefresh:!1,disabledColumns:[],removePadding:!0,widths:[],serialize:!0,onDrag:null,onResize:null}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ColumnResizer=t():e.ColumnResizer=t()}(this,function(){return i={},__webpack_require__.m=r=[function(e,t,r){"use strict";e.exports=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return l});var i=r(0),n=r.n(i);function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,s=(o=0,function(){return o++}),l=function ColumnResizer(e){var c=this,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ColumnResizer),_defineProperty(this,"ID","id"),_defineProperty(this,"PX","px"),_defineProperty(this,"RESIZABLE","grip-resizable"),_defineProperty(this,"FLEX","grip-flex"),_defineProperty(this,"legacyIE",0<navigator.userAgent.indexOf("Trident/4.0")),_defineProperty(this,"reset",function(e){return c.init(e)}),_defineProperty(this,"onResize",function(){var e=c.tb;if(e.classList.remove(c.RESIZABLE),e.opt.fixed){e.tableWidth=Number(window.getComputedStyle(e).width.replace(/px/,"")).valueOf();for(var t=0,r=0;r<e.columnCnt;r++)t+=e.columns[r].w;for(var i=0;i<e.columnCnt;i++)e.columns[i].style.width=Math.round(1e3*e.columns[i].w/t)/10+"%",e.columns[i].locked=!0}else c.applyBounds(),"flex"===e.opt.resizeMode&&e.opt.serialize&&c.serializeStore();e.classList.add(c.RESIZABLE),c.syncGrips()}),_defineProperty(this,"onGripMouseDown",function(e){var t=e.target.parentNode.data,r=c.tb,i=r.grips[t.i],o=e.touches;if(i.ox=o?o[0].pageX:e.pageX,i.l=i.offsetLeft,i.x=i.l,c.createStyle(document.querySelector("head"),"*{cursor:"+r.opt.dragCursor+"!important}"),document.addEventListener("touchmove",c.onGripDrag),document.addEventListener("mousemove",c.onGripDrag),document.addEventListener("touchend",c.onGripDragOver),document.addEventListener("mouseup",c.onGripDragOver),i.classList.add(r.opt.draggingClass),c.grip=i,r.columns[t.i].locked)for(var n,l=0;l<r.columnCnt;l++)(n=r.columns[l]).locked=!1,n.w=Number(window.getComputedStyle(n).width.replace(/px/,"")).valueOf();e.preventDefault()}),_defineProperty(this,"onGripDrag",function(e){var t=c.grip;if(t){var r=t.t,i=e.touches,o=(i?i[0].pageX:e.pageX)-t.ox+t.l,n=r.opt.minWidth,l=t.i,a=1.5*r.cellSpace+n+r.borderSpace,s=l===r.columnCnt-1,d=l?r.grips[l-1].offsetLeft+r.cellSpace+n:a,p=r.opt.fixed?l===r.columnCnt-1?r.tableWidth-a:r.grips[l+1].offsetLeft-r.cellSpace-n:1/0;if(o=Math.max(d,Math.min(p,o)),t.x=o,t.style.left=o+c.PX,s&&(t.w=r.columns[l].w+o-t.l),r.opt.liveDrag){s?(r.columns[l].style.width=t.w+c.PX,!r.opt.fixed&&r.opt.overflow?r.style.minWidth=r.tableWidth+o-t.l+c.PX:r.tableWidth=Number(window.getComputedStyle(r).width.replace(/px/,"")).valueOf()):c.syncCols(r,l,!1,r.opt),c.syncGrips();var u=r.opt.onDrag;u&&u(e)}e.preventDefault()}}),_defineProperty(this,"onGripDragOver",function(e){var t=c.grip;document.removeEventListener("touchend",c.onGripDragOver),document.removeEventListener("mouseup",c.onGripDragOver),document.removeEventListener("touchmove",c.onGripDrag),document.removeEventListener("mousemove",c.onGripDrag);var r=document.querySelector("head").lastChild;if(r.parentNode.removeChild(r),t){if(t.classList.remove(t.t.opt.draggingClass),t.x-t.l!=0){var i=t.t,o=i.opt.onResize,n=t.i;if(n===i.columnCnt-1){var l=i.columns[n];l.style.width=t.w+c.PX,l.w=t.w}else c.syncCols(i,n,!0,i.opt);i.opt.fixed||c.applyBounds(),c.syncGrips(),o&&o(e),i.opt.serialize&&c.serializeStore()}c.grip=null}}),_defineProperty(this,"init",function(e){if(e.disable)return c.destroy();var t=c.tb,r=t.getAttribute(c.ID)||c.RESIZABLE+s();if(!t.matches("table")||t.extended&&!e.partialRefresh)return null;var i=document.querySelector("head");if(c.createStyle(i," .grip-resizable{table-layout:fixed;} .grip-resizable > tbody > tr > td, .grip-resizable > tbody > tr > th{overflow:hidden} .grip-padding > tbody > tr > td, .grip-padding > tbody > tr > th{padding-left:0!important; padding-right:0!important;} .grip-container{ height:0px; position:relative;} .grip-handle{margin-left:-5px; position:absolute; z-index:5; } .grip-handle .grip-resizable{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: col-resize;top:0px} .grip-lastgrip{position:absolute; width:1px; } .grip-drag{ border-left:1px dotted black;\t} .grip-flex{width:auto!important;} .grip-handle.grip-disabledgrip .grip-resizable{cursor:default; display:none;}"),e.hoverCursor&&"col-resize"!==e.hoverCursor){var o=".grip-handle .grip-resizable:hover{cursor:"+e.hoverCursor+"!important}";c.createStyle(i,o)}t.setAttribute(c.ID,r);var n=t.opt;t.opt=c.extendOptions(e);var l=c.getTableHeaders(t);if(c.extendTable(l),e.remoteTable&&e.remoteTable.matches("table")){var a=c.getTableHeaders(t.opt.remoteTable);l.length===a.length?c.extendRemoteTable(t.opt.remoteTable,a,t):console.warn("column count for remote table did not match")}return n}),_defineProperty(this,"applyBounds",function(){var e=c.tb,r=e.columns.map(function(e){return window.getComputedStyle(e).width});e.style.width=window.getComputedStyle(e).width,e.tableWidth=Number(e.style.width.replace(/px/,"")).valueOf(),e.classList.remove(c.FLEX),e.columns.forEach(function(e,t){e.style.width=r[t],e.w=Number(r[t].replace(/px/,"")).valueOf()}),e.classList.add(c.FLEX)}),_defineProperty(this,"serializeStore",function(){var e=c.store,t=c.tb;e[t.getAttribute(c.ID)]="";for(var r=0,i=0;i<t.columns.length;i++){var o=window.getComputedStyle(t.columns[i]).width.replace(/px/,"");e[t.getAttribute(c.ID)]+=o+";",r+=Number(o).valueOf()}e[t.getAttribute(c.ID)]+=r.toString(),t.opt.fixed||(e[t.getAttribute(c.ID)]+=";"+window.getComputedStyle(t).width.replace(/px/,""))}),_defineProperty(this,"syncGrips",function(){var e=c.tb;e.gripContainer.style.width=e.tableWidth+c.PX;for(var t=0;t<e.columnCnt;t++){var r=e.columns[t],i=r.getBoundingClientRect(),o=e.getBoundingClientRect();e.grips[t].style.left=i.left-o.left+r.offsetWidth+e.cellSpace/2+c.PX,e.grips[t].style.height=(e.opt.headerOnly?e.columns[0].offsetHeight:e.offsetHeight)+c.PX}}),_defineProperty(this,"destroy",function(){var e=c.tb,t=e.getAttribute(c.ID);return t?(c.store[t]="",e.classList.remove(c.RESIZABLE),e.classList.remove(c.FLEX),e.remote&&(e.remote.classList.remove(c.RESIZABLE),e.remote.classList.remove(c.FLEX)),e.gripContainer&&e.gripContainer.parentNode&&e.gripContainer.parentNode.removeChild(e.gripContainer),delete e.extended,e.opt):null}),_defineProperty(this,"createStyle",function(e,t){var r=n()(t).toString(),i=e.querySelectorAll("style");if(!Array.from(i).filter(function(e){return e.gripid===r}).length){var o=document.createElement("style");o.type="text/css",o.gripid=r,o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t)),e.appendChild(o)}}),_defineProperty(this,"extendOptions",function(e){var t=Object.assign({},ColumnResizer.DEFAULTS,e);switch(t.fixed=!0,t.overflow=!1,t.resizeMode){case"flex":t.fixed=!1;break;case"overflow":t.fixed=!1,t.overflow=!0}return t}),_defineProperty(this,"getTableHeaders",function(e){var t="#"+e.id,r=Array.from(e.querySelectorAll(t+">thead>tr:nth-of-type(1)>th"));return(r=r.concat(Array.from(e.querySelectorAll(t+">thead>tr:nth-of-type(1)>td")))).length||(r=(r=(r=(r=Array.from(e.querySelectorAll(t+">tbody>tr:nth-of-type(1)>th"))).concat(Array.from(e.querySelectorAll(t+">tr:nth-of-type(1)>th")))).concat(Array.from(e.querySelectorAll(t+">tbody>tr:nth-of-type(1)>td")))).concat(Array.from(e.querySelectorAll(t+">tr:nth-of-type(1)>td")))),c.filterInvisible(r,!1)}),_defineProperty(this,"filterInvisible",function(e,i){return e.filter(function(e){var t=i?-1:e.offsetWidth,r=i?-1:e.offsetHeight;return!(0===t&&0===r||e.style&&e.style.display&&"none"===window.getComputedStyle(e).display||!1)})}),_defineProperty(this,"extendTable",function(e){var t=c.tb;t.opt.removePadding&&t.classList.add("grip-padding"),t.classList.add(c.RESIZABLE),t.insertAdjacentHTML("beforebegin",'<div class="grip-container"/>'),t.grips=[],t.columns=[],t.tableWidth=Number(window.getComputedStyle(t).width.replace(/px/,"")).valueOf(),t.gripContainer=t.previousElementSibling,t.opt.marginLeft&&(t.gripContainer.style.marginLeft=t.opt.marginLeft),t.opt.marginRight&&(t.gripContainer.style.marginRight=t.opt.marginRight),t.cellSpace=parseInt(c.legacyIE?t.cellSpacing||t.currentStyle.borderSpacing:window.getComputedStyle(t).borderSpacing.split(" ")[0].replace(/px/,""))||2,t.borderSpace=parseInt(c.legacyIE?t.border||t.currentStyle.borderLeftWidth:window.getComputedStyle(t).borderLeftWidth.replace(/px/,""))||1,t.extended=!0,c.createGrips(e)}),_defineProperty(this,"extendRemoteTable",function(i,o,n){n.opt.removePadding&&i.classList.add("grip-padding"),i.classList.add(c.RESIZABLE),i.getAttribute(c.ID)||i.setAttribute(c.ID,n.getAttribute(c.ID)+"remote"),i.columns=[],o.forEach(function(e,t){var r=o[t];r.w=n.columns[t].w,r.style.width=r.w+c.PX,r.removeAttribute("width"),i.columns.push(r)}),i.tableWidth=n.tableWidth,i.cellSpace=n.cellSpace,i.borderSpace=n.borderSpace;var e=Array.from(i.querySelectorAll("col"));i.columnGrp=c.filterInvisible(e,!0),i.columnGrp.forEach(function(e,t){e.removeAttribute("width"),e.style.width=n.columnGrp[t].style.width}),n.remote=i}),_defineProperty(this,"createGrips",function(n){var l=c.tb;l.columnGrp=c.filterInvisible(Array.from(l.querySelectorAll("col")),!0),l.columnGrp.forEach(function(e){e.removeAttribute("width")}),l.columnCnt=n.length;var a=!1;c.store[l.getAttribute(c.ID)]&&(c.deserializeStore(n),a=!0),l.opt.widths||(l.opt.widths=[]),n.forEach(function(e,t){var r=n[t],i=-1!==l.opt.disabledColumns.indexOf(t);c.createDiv(l.gripContainer,"grip-handle");var o=l.gripContainer.lastChild;!i&&l.opt.gripInnerHtml&&(o.innerHTML=l.opt.gripInnerHtml),c.createDiv(o,c.RESIZABLE),t===l.columnCnt-1&&(o.classList.add("grip-lastgrip"),l.opt.fixed&&(o.innerHTML="")),o.addEventListener("touchstart",c.onGripMouseDown,{capture:!0,passive:!0}),o.addEventListener("mousedown",c.onGripMouseDown,!0),i?o.classList.add("grip-disabledgrip"):(o.classList.remove("grip-disabledgrip"),o.addEventListener("touchstart",c.onGripMouseDown,{capture:!0,passive:!0}),o.addEventListener("mousedown",c.onGripMouseDown,!0)),o.t=l,o.i=t,l.opt.widths[t]?r.w=l.opt.widths[t]:r.w=a?Number(r.style.width.replace(/px/,"")).valueOf():Number(window.getComputedStyle(r).width.replace(/px/,"")).valueOf(),r.style.width=r.w+c.PX,r.removeAttribute("width"),o.data={i:t,t:l.getAttribute(c.ID),last:t===l.columnCnt-1},l.grips.push(o),l.columns.push(r)});var e=Array.from(l.querySelectorAll("td"));e.concat(Array.from(l.querySelectorAll("th"))),(e=(e=e.filter(function(e){for(var t=0;t<n.length;t++)if(n[t]===e)return!1;return!0})).filter(function(e){return!(e.querySelectorAll("table th").length||e.querySelectorAll("table td").length)})).forEach(function(e){e.removeAttribute("width")}),l.opt.fixed||(l.removeAttribute("width"),l.classList.add(c.FLEX)),c.syncGrips()}),_defineProperty(this,"deserializeStore",function(e){var t=c.tb;if(t.columnGrp.forEach(function(e){e.removeAttribute("width")}),t.opt.flush)c.store[t.getAttribute(c.ID)]="";else{var r=c.store[t.getAttribute(c.ID)].split(";"),i=r[t.columnCnt+1];!t.opt.fixed&&i&&(t.style.width=i+c.PX,t.opt.overflow&&(t.style.minWidth=i+c.PX,t.tableWidth=Number(i).valueOf()));for(var o=0;o<t.columnCnt;o++)e[o].style.width=r[o]+c.PX,t.columnGrp[o]&&(t.columnGrp[o].style.width=100*Number(r[o]).valueOf()/Number(r[t.columnCnt]).valueOf()+"%")}}),_defineProperty(this,"createDiv",function(e,t,r){var i=document.createElement("div");i.classList.add(t),r&&(i.innerHTML=r),e.appendChild(i)}),_defineProperty(this,"syncCols",function(e,t,r,i){var o=e.remote,n=c.grip.x-c.grip.l,l=e.columns[t],a=e.columns[t+1];if(l&&a){var s=l.w+n,d=a.w-n,p=s+c.PX;if(l.style.width=p,e.columnGrp[t]&&e.columnGrp[t].style.width&&(e.columnGrp[t].style.width=p),o&&(o.columns[t].style.width=p,o.columnGrp[t]&&o.columnGrp[t].style.width&&(o.columnGrp[t].style.width=p)),i.fixed){var u=d+c.PX;a.style.width=u,e.columnGrp[t+1]&&e.columnGrp[t+1].style.width&&(e.columnGrp[t+1].style.width=u),o&&(o.columns[t+1].style.width=u,o.columnGrp[t+1]&&o.columnGrp[t+1].style.width&&(o.columnGrp[t+1].style.width=u))}else i.overflow&&(e.style.minWidth=e.tableWidth+n+c.PX);r&&(l.w=s,a.w=i.fixed?d:a.w,o&&(o.columns[t].w=s,o.columns[t+1].w=i.fixed?d:a.w))}});try{this.store=sessionStorage}catch(e){this.store={}}this.grip=null,this.tb=e,window.addEventListener("resize",this.onResize),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),this.init(t)};l.DEFAULTS={resizeMode:"fit",draggingClass:"grip-drag",gripInnerHtml:"",liveDrag:!1,minWidth:15,headerOnly:!1,hoverCursor:"col-resize",dragCursor:"col-resize",flush:!1,marginLeft:null,marginRight:null,remoteTable:null,disable:!1,partialRefresh:!1,disabledColumns:[],removePadding:!0,widths:[],serialize:!0,onDrag:null,onResize:null}}],__webpack_require__.c=i,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(__webpack_require__.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)__webpack_require__.d(r,i,function(e){return t[e]}.bind(null,i));return r},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="/",__webpack_require__(__webpack_require__.s=1);function __webpack_require__(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}var r,i});
//# sourceMappingURL=column-resizer.js.map
{
"name": "column-resizer",
"version": "1.3.1",
"version": "1.3.2",
"description": "Javascript to resize table columns",

@@ -38,18 +38,19 @@ "title": "ColumnResizer",

"devDependencies": {
"@babel/cli": "~7.2.3",
"@babel/core": "~7.2.2",
"@babel/plugin-proposal-class-properties": "~7.3.0",
"@babel/preset-env": "~7.3.1",
"@babel/runtime": "~7.3.1",
"@babel/cli": "~7.4.4",
"@babel/core": "~7.4.5",
"@babel/plugin-proposal-class-properties": "~7.4.4",
"@babel/preset-env": "~7.4.5",
"@babel/register": "~7.4.4",
"@babel/runtime": "~7.4.5",
"babel-eslint": "~10.0.1",
"babel-loader": "~8.0.5",
"babel-loader": "~8.0.6",
"chai": "~4.2.0",
"cross-env": "~5.2.0",
"eslint": "^5.13.0",
"jsdom": "~13.2.0",
"mocha": "~5.2.0",
"eslint": "~5.16.0",
"jsdom": "~15.1.1",
"mocha": "~6.1.4",
"mocha-chrome": "~2.0.0",
"uglifyjs-webpack-plugin": "~2.1.1",
"webpack": "~4.29.3",
"webpack-cli": "~3.2.3"
"uglifyjs-webpack-plugin": "~2.1.3",
"webpack": "~4.33.0",
"webpack-cli": "~3.3.2"
},

@@ -56,0 +57,0 @@ "dependencies": {

@@ -12,2 +12,3 @@ # ColumnResizer

* Customizable column anchors
* Server side rendering

@@ -14,0 +15,0 @@ ## Usage

@@ -37,7 +37,4 @@ const webpack = require('webpack');

ecma: 6,
compress: {
warnings: false
},
mangle: {
keep_fnames: true
keep_fnames: true
},

@@ -44,0 +41,0 @@ output: {

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