3 var ResizeRows =
function ResizeRows(table) {
5 this.startColumn =
false;
7 this.startHeight =
false;
9 this.prevHandle = null;
12 ResizeRows.prototype.initializeRow =
function (row) {
14 rowEl = row.getElement();
16 var handle = document.createElement(
'div');
17 handle.className =
"tabulator-row-resize-handle";
19 var prevHandle = document.createElement(
'div');
20 prevHandle.className =
"tabulator-row-resize-handle prev";
22 handle.addEventListener(
"click",
function (e) {
26 var handleDown =
function handleDown(e) {
28 self._mouseDown(e, row, handle);
31 handle.addEventListener(
"mousedown", handleDown);
32 handle.addEventListener(
"touchstart", handleDown, { passive:
true });
34 prevHandle.addEventListener(
"click",
function (e) {
38 var prevHandleDown =
function prevHandleDown(e) {
39 var prevRow =
self.table.rowManager.prevDisplayRow(row);
42 self.startRow = prevRow;
43 self._mouseDown(e, prevRow, prevHandle);
47 prevHandle.addEventListener(
"mousedown", prevHandleDown);
48 prevHandle.addEventListener(
"touchstart", prevHandleDown, { passive:
true });
50 rowEl.appendChild(handle);
51 rowEl.appendChild(prevHandle);
54 ResizeRows.prototype._mouseDown =
function (e, row, handle) {
57 self.table.element.classList.add(
"tabulator-block-select");
59 function mouseMove(e) {
60 row.setHeight(
self.startHeight + ((typeof e.screenY ===
"undefined" ? e.touches[0].screenY : e.screenY) -
self.startY));
70 document.body.removeEventListener(
"mouseup", mouseMove);
71 document.body.removeEventListener(
"mousemove", mouseMove);
73 handle.removeEventListener(
"touchmove", mouseMove);
74 handle.removeEventListener(
"touchend", mouseUp);
76 self.table.element.classList.remove(
"tabulator-block-select");
78 self.table.options.rowResized.call(this.table, row.getComponent());
88 self.startY = typeof e.screenY ===
"undefined" ? e.touches[0].screenY : e.screenY;
89 self.startHeight = row.getHeight();
91 document.body.addEventListener(
"mousemove", mouseMove);
92 document.body.addEventListener(
"mouseup", mouseUp);
94 handle.addEventListener(
"touchmove", mouseMove, { passive:
true });
95 handle.addEventListener(
"touchend", mouseUp);
98 Tabulator.prototype.registerModule(
"resizeRows", ResizeRows);