1 var ResizeRows =
function(table){
3 this.startColumn =
false;
5 this.startHeight =
false;
7 this.prevHandle = null;
10 ResizeRows.prototype.initializeRow =
function(row){
12 rowEl = row.getElement();
14 var handle = document.createElement(
'div');
15 handle.className =
"tabulator-row-resize-handle";
17 var prevHandle = document.createElement(
'div');
18 prevHandle.className =
"tabulator-row-resize-handle prev";
20 handle.addEventListener(
"click",
function(e){
24 var handleDown =
function(e){
26 self._mouseDown(e, row, handle);
29 handle.addEventListener(
"mousedown", handleDown);
30 handle.addEventListener(
"touchstart", handleDown, {passive:
true});
32 prevHandle.addEventListener(
"click",
function(e){
37 var prevHandleDown =
function(e){
38 var prevRow =
self.table.rowManager.prevDisplayRow(row);
41 self.startRow = prevRow;
42 self._mouseDown(e, prevRow, prevHandle);
46 prevHandle.addEventListener(
"mousedown",prevHandleDown);
47 prevHandle.addEventListener(
"touchstart",prevHandleDown, {passive:
true});
49 rowEl.appendChild(handle);
50 rowEl.appendChild(prevHandle);
53 ResizeRows.prototype._mouseDown =
function(e, row, handle){
56 self.table.element.classList.add(
"tabulator-block-select");
58 function mouseMove(e){
59 row.setHeight(
self.startHeight + ((typeof e.screenY ===
"undefined" ? e.touches[0].screenY : e.screenY) -
self.startY));
69 document.body.removeEventListener(
"mouseup", mouseMove);
70 document.body.removeEventListener(
"mousemove", mouseMove);
72 handle.removeEventListener(
"touchmove", mouseMove);
73 handle.removeEventListener(
"touchend", mouseUp);
75 self.table.element.classList.remove(
"tabulator-block-select");
77 self.table.options.rowResized.call(this.table, row.getComponent());
87 self.startY = typeof e.screenY ===
"undefined" ? e.touches[0].screenY : e.screenY;
88 self.startHeight = row.getHeight();
90 document.body.addEventListener(
"mousemove", mouseMove);
91 document.body.addEventListener(
"mouseup", mouseUp);
93 handle.addEventListener(
"touchmove", mouseMove, {passive:
true});
94 handle.addEventListener(
"touchend", mouseUp);
97 Tabulator.prototype.registerModule(
"resizeRows", ResizeRows);