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.5 to 1.3.6

7

CHANGELOG.md

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

<a name="v1.3.6"></a>
# [v1.3.6](https://github.com/MonsantoCo/column-resizer/compare/v1.3.5...v1.3.6) (2020-12-04)
## Bug fixes
## Enhancement
* Security update [9d8282e](https://github.com/MonsantoCo/column-resizer/commit/9d8282ef9815ace2f415f97bdd1781de83ecd4bd) (2020-12-04)
<a name="v1.3.5"></a>

@@ -2,0 +9,0 @@ # [v1.3.5](https://github.com/MonsantoCo/column-resizer/compare/v1.3.4...v1.3.5) (2020-04-04)

2

dist/column-resizer.js

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

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

@@ -13,3 +13,3 @@ "title": "ColumnResizer",

"test": "npm run build && mocha-chrome test/sample1.html",
"build": "npm run clean && cross-env NODE_ENV=production webpack -p",
"build": "npm run clean && cross-env NODE_ENV=production webpack",
"lint": "eslint src/*.js test/*.js",

@@ -40,20 +40,21 @@ "clean": "rimraf dist/*"

"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "~7.9.0",
"@babel/plugin-proposal-class-properties": "~7.8.3",
"@babel/preset-env": "~7.9.0",
"@babel/register": "~7.9.0",
"@babel/runtime": "~7.9.2",
"@babel/cli": "~7.12.8",
"@babel/core": "~7.12.9",
"@babel/plugin-proposal-class-properties": "~7.12.1",
"@babel/preset-env": "~7.12.7",
"@babel/register": "~7.12.1",
"@babel/runtime": "~7.12.5",
"babel-eslint": "~10.1.0",
"babel-loader": "~8.1.0",
"babel-loader": "~8.2.2",
"canvas": "~2.6.1",
"chai": "~4.2.0",
"cross-env": "~7.0.2",
"eslint": "~6.8.0",
"jsdom": "~16.2.2",
"mocha": "~7.1.1",
"cross-env": "~7.0.3",
"eslint": "~7.14.0",
"jsdom": "~16.4.0",
"mocha": "~8.2.1",
"mocha-chrome": "~2.2.0",
"rimraf": "~3.0.2",
"terser-webpack-plugin": "^2.3.5",
"webpack": "^4.42.1",
"webpack-cli": "~3.3.11"
"terser-webpack-plugin": "^5.0.3",
"webpack": "~5.9.0",
"webpack-cli": "~4.2.0"
},

@@ -60,0 +61,0 @@ "dependencies": {

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

new TerserPlugin({
sourceMap: true,
parallel: true,
terserOptions: {
keep_fnames: true,
ecma: 6,
output: {
format: {
comments: false,

@@ -42,0 +42,0 @@ }

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