otsdaq_utilities  v2_05_02_indev
resize_columns.min.js
1 /* Tabulator v4.5.3 (c) Oliver Folkerd */
2 var ResizeColumns=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};ResizeColumns.prototype.initializeColumn=function(e,t,n){var o=this,i=!1,s=this.table.options.resizableColumns;if("header"===e&&(i="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:i}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var l=document.createElement("div");l.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var r=function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(o.startColumn=t,o._mouseDown(e,n,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r,{passive:!0}),a.addEventListener("dblclick",function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(e.stopPropagation(),n.reinitializeWidth(!0))}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(o.startColumn=t,o._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d,{passive:!0}),l.addEventListener("dblclick",function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),n.appendChild(a),n.appendChild(l)}},ResizeColumns.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},ResizeColumns.prototype._mouseDown=function(e,t,n){function o(e){t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function i(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),n.removeEventListener("touchend",i),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",i),n.addEventListener("touchmove",o,{passive:!0}),n.addEventListener("touchend",i)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns);