handsontable 14.0.0-next-4fd76bc-20231114 → 14.0.0-next-bdc44e7-20231115
Sign up to get free protection for your applications and to get access to all the features.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/index.js +3 -3
- package/core/focusCatcher/index.mjs +3 -3
- package/dataMap/metaManager/metaSchema.js +7 -7
- package/dataMap/metaManager/metaSchema.mjs +7 -7
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +393 -267
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +147 -147
- package/dist/handsontable.js +393 -267
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +22 -22
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +31 -28
- package/plugins/manualColumnMove/manualColumnMove.mjs +29 -26
- package/plugins/manualColumnResize/manualColumnResize.js +161 -105
- package/plugins/manualColumnResize/manualColumnResize.mjs +160 -104
- package/plugins/manualRowMove/manualRowMove.js +31 -28
- package/plugins/manualRowMove/manualRowMove.mjs +29 -26
- package/plugins/manualRowResize/manualRowResize.js +160 -104
- package/plugins/manualRowResize/manualRowResize.mjs +159 -103
- package/settings.d.ts +1 -1
@@ -3,15 +3,12 @@ import "core-js/modules/es.error.cause.js";
|
|
3
3
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
4
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
5
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
6
|
-
function
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
8
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
9
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
6
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
11
7
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
12
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
8
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
14
|
-
function
|
9
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
11
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
15
12
|
import { BasePlugin } from "../base/index.mjs";
|
16
13
|
import { addClass, closest, hasClass, removeClass, outerWidth, isDetached } from "../../helpers/dom/element.mjs";
|
17
14
|
import { arrayEach } from "../../helpers/array.mjs";
|
@@ -36,6 +33,21 @@ const PERSISTENT_STATE_KEY = 'manualRowHeights';
|
|
36
33
|
* - handle - the draggable element that sets the desired height of the row.
|
37
34
|
* - guide - the helper guide that shows the desired height as a horizontal guide.
|
38
35
|
*/
|
36
|
+
var _currentTH = /*#__PURE__*/new WeakMap();
|
37
|
+
var _currentRow = /*#__PURE__*/new WeakMap();
|
38
|
+
var _selectedRows = /*#__PURE__*/new WeakMap();
|
39
|
+
var _currentHeight = /*#__PURE__*/new WeakMap();
|
40
|
+
var _newSize = /*#__PURE__*/new WeakMap();
|
41
|
+
var _startY = /*#__PURE__*/new WeakMap();
|
42
|
+
var _startHeight = /*#__PURE__*/new WeakMap();
|
43
|
+
var _startOffset = /*#__PURE__*/new WeakMap();
|
44
|
+
var _handle = /*#__PURE__*/new WeakMap();
|
45
|
+
var _guide = /*#__PURE__*/new WeakMap();
|
46
|
+
var _pressed = /*#__PURE__*/new WeakMap();
|
47
|
+
var _isTriggeredByRMB = /*#__PURE__*/new WeakMap();
|
48
|
+
var _dblclick = /*#__PURE__*/new WeakMap();
|
49
|
+
var _autoresizeTimeout = /*#__PURE__*/new WeakMap();
|
50
|
+
var _rowHeightsMap = /*#__PURE__*/new WeakMap();
|
39
51
|
var _config = /*#__PURE__*/new WeakMap();
|
40
52
|
var _onMouseOver = /*#__PURE__*/new WeakSet();
|
41
53
|
var _onMouseDown = /*#__PURE__*/new WeakSet();
|
@@ -99,66 +111,110 @@ export class ManualRowResize extends BasePlugin {
|
|
99
111
|
* @param {MouseEvent} event The mouse event.
|
100
112
|
*/
|
101
113
|
_classPrivateMethodInitSpec(this, _onMouseOver);
|
102
|
-
|
114
|
+
_classPrivateFieldInitSpec(this, _currentTH, {
|
115
|
+
writable: true,
|
116
|
+
value: null
|
117
|
+
});
|
103
118
|
/**
|
104
119
|
* @type {number}
|
105
120
|
*/
|
106
|
-
|
121
|
+
_classPrivateFieldInitSpec(this, _currentRow, {
|
122
|
+
writable: true,
|
123
|
+
value: null
|
124
|
+
});
|
107
125
|
/**
|
108
126
|
* @type {number[]}
|
109
127
|
*/
|
110
|
-
|
128
|
+
_classPrivateFieldInitSpec(this, _selectedRows, {
|
129
|
+
writable: true,
|
130
|
+
value: []
|
131
|
+
});
|
111
132
|
/**
|
112
133
|
* @type {number}
|
113
134
|
*/
|
114
|
-
|
135
|
+
_classPrivateFieldInitSpec(this, _currentHeight, {
|
136
|
+
writable: true,
|
137
|
+
value: null
|
138
|
+
});
|
115
139
|
/**
|
116
140
|
* @type {number}
|
117
141
|
*/
|
118
|
-
|
142
|
+
_classPrivateFieldInitSpec(this, _newSize, {
|
143
|
+
writable: true,
|
144
|
+
value: null
|
145
|
+
});
|
119
146
|
/**
|
120
147
|
* @type {number}
|
121
148
|
*/
|
122
|
-
|
149
|
+
_classPrivateFieldInitSpec(this, _startY, {
|
150
|
+
writable: true,
|
151
|
+
value: null
|
152
|
+
});
|
123
153
|
/**
|
124
154
|
* @type {number}
|
125
155
|
*/
|
126
|
-
|
156
|
+
_classPrivateFieldInitSpec(this, _startHeight, {
|
157
|
+
writable: true,
|
158
|
+
value: null
|
159
|
+
});
|
127
160
|
/**
|
128
161
|
* @type {number}
|
129
162
|
*/
|
130
|
-
|
163
|
+
_classPrivateFieldInitSpec(this, _startOffset, {
|
164
|
+
writable: true,
|
165
|
+
value: null
|
166
|
+
});
|
131
167
|
/**
|
132
168
|
* @type {HTMLElement}
|
133
169
|
*/
|
134
|
-
|
170
|
+
_classPrivateFieldInitSpec(this, _handle, {
|
171
|
+
writable: true,
|
172
|
+
value: this.hot.rootDocument.createElement('DIV')
|
173
|
+
});
|
135
174
|
/**
|
136
175
|
* @type {HTMLElement}
|
137
176
|
*/
|
138
|
-
|
177
|
+
_classPrivateFieldInitSpec(this, _guide, {
|
178
|
+
writable: true,
|
179
|
+
value: this.hot.rootDocument.createElement('DIV')
|
180
|
+
});
|
139
181
|
/**
|
140
182
|
* @type {boolean}
|
141
183
|
*/
|
142
|
-
|
184
|
+
_classPrivateFieldInitSpec(this, _pressed, {
|
185
|
+
writable: true,
|
186
|
+
value: false
|
187
|
+
});
|
143
188
|
/**
|
144
189
|
* @type {boolean}
|
145
190
|
*/
|
146
|
-
|
191
|
+
_classPrivateFieldInitSpec(this, _isTriggeredByRMB, {
|
192
|
+
writable: true,
|
193
|
+
value: false
|
194
|
+
});
|
147
195
|
/**
|
148
196
|
* @type {number}
|
149
197
|
*/
|
150
|
-
|
198
|
+
_classPrivateFieldInitSpec(this, _dblclick, {
|
199
|
+
writable: true,
|
200
|
+
value: 0
|
201
|
+
});
|
151
202
|
/**
|
152
203
|
* @type {number}
|
153
204
|
*/
|
154
|
-
|
205
|
+
_classPrivateFieldInitSpec(this, _autoresizeTimeout, {
|
206
|
+
writable: true,
|
207
|
+
value: null
|
208
|
+
});
|
155
209
|
/**
|
156
210
|
* PhysicalIndexToValueMap to keep and track widths for physical row indexes.
|
157
211
|
*
|
158
|
-
* @private
|
159
212
|
* @type {PhysicalIndexToValueMap}
|
160
213
|
*/
|
161
|
-
|
214
|
+
_classPrivateFieldInitSpec(this, _rowHeightsMap, {
|
215
|
+
writable: true,
|
216
|
+
value: void 0
|
217
|
+
});
|
162
218
|
/**
|
163
219
|
* Private pool to save configuration from updateSettings.
|
164
220
|
*
|
@@ -168,8 +224,8 @@ export class ManualRowResize extends BasePlugin {
|
|
168
224
|
writable: true,
|
169
225
|
value: void 0
|
170
226
|
});
|
171
|
-
addClass(this
|
172
|
-
addClass(this
|
227
|
+
addClass(_classPrivateFieldGet(this, _handle), 'manualRowResizer');
|
228
|
+
addClass(_classPrivateFieldGet(this, _guide), 'manualRowResizerGuide');
|
173
229
|
}
|
174
230
|
|
175
231
|
/**
|
@@ -197,9 +253,9 @@ export class ManualRowResize extends BasePlugin {
|
|
197
253
|
if (this.enabled) {
|
198
254
|
return;
|
199
255
|
}
|
200
|
-
this
|
201
|
-
this.
|
202
|
-
this.hot.rowIndexMapper.registerMap(this.pluginName, this
|
256
|
+
_classPrivateFieldSet(this, _rowHeightsMap, new IndexToValueMap());
|
257
|
+
_classPrivateFieldGet(this, _rowHeightsMap).addLocalHook('init', () => _classPrivateMethodGet(this, _onMapInit, _onMapInit2).call(this));
|
258
|
+
this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(this, _rowHeightsMap));
|
203
259
|
this.addHook('modifyRowHeight', (height, row) => _classPrivateMethodGet(this, _onModifyRowHeight, _onModifyRowHeight2).call(this, height, row));
|
204
260
|
this.bindEvents();
|
205
261
|
super.enablePlugin();
|
@@ -221,7 +277,7 @@ export class ManualRowResize extends BasePlugin {
|
|
221
277
|
* Disables the plugin functionality for this Handsontable instance.
|
222
278
|
*/
|
223
279
|
disablePlugin() {
|
224
|
-
_classPrivateFieldSet(this, _config, this.
|
280
|
+
_classPrivateFieldSet(this, _config, _classPrivateFieldGet(this, _rowHeightsMap).getValues());
|
225
281
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
226
282
|
super.disablePlugin();
|
227
283
|
}
|
@@ -233,7 +289,7 @@ export class ManualRowResize extends BasePlugin {
|
|
233
289
|
* @fires Hooks#persistentStateSave
|
234
290
|
*/
|
235
291
|
saveManualRowHeights() {
|
236
|
-
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, this.
|
292
|
+
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, _classPrivateFieldGet(this, _rowHeightsMap).getValues());
|
237
293
|
}
|
238
294
|
|
239
295
|
/**
|
@@ -259,7 +315,7 @@ export class ManualRowResize extends BasePlugin {
|
|
259
315
|
setManualSize(row, height) {
|
260
316
|
const physicalRow = this.hot.toPhysicalRow(row);
|
261
317
|
const newHeight = Math.max(height, ViewportRowsCalculator.DEFAULT_HEIGHT);
|
262
|
-
this.
|
318
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(physicalRow, newHeight);
|
263
319
|
return newHeight;
|
264
320
|
}
|
265
321
|
|
@@ -270,40 +326,40 @@ export class ManualRowResize extends BasePlugin {
|
|
270
326
|
* @param {HTMLCellElement} TH TH HTML element.
|
271
327
|
*/
|
272
328
|
setupHandlePosition(TH) {
|
273
|
-
this
|
329
|
+
_classPrivateFieldSet(this, _currentTH, TH);
|
274
330
|
const {
|
275
331
|
view
|
276
332
|
} = this.hot;
|
277
333
|
const {
|
278
334
|
_wt: wt
|
279
335
|
} = view;
|
280
|
-
const cellCoords = wt.wtTable.getCoords(this
|
336
|
+
const cellCoords = wt.wtTable.getCoords(_classPrivateFieldGet(this, _currentTH));
|
281
337
|
const row = cellCoords.row;
|
282
338
|
|
283
339
|
// Ignore row headers.
|
284
340
|
if (row < 0) {
|
285
341
|
return;
|
286
342
|
}
|
287
|
-
const headerWidth = outerWidth(this
|
288
|
-
const box = this.
|
343
|
+
const headerWidth = outerWidth(_classPrivateFieldGet(this, _currentTH));
|
344
|
+
const box = _classPrivateFieldGet(this, _currentTH).getBoundingClientRect();
|
289
345
|
// Read "fixedRowsTop" and "fixedRowsBottom" through the Walkontable as in that context, the fixed
|
290
346
|
// rows are modified (reduced by the number of hidden rows) by TableView module.
|
291
347
|
const fixedRowTop = row < wt.getSetting('fixedRowsTop');
|
292
348
|
const fixedRowBottom = row >= view.countNotHiddenRowIndexes(0, 1) - wt.getSetting('fixedRowsBottom');
|
293
349
|
let relativeHeaderPosition;
|
294
350
|
if (fixedRowTop) {
|
295
|
-
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(this
|
351
|
+
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
296
352
|
} else if (fixedRowBottom) {
|
297
|
-
relativeHeaderPosition = wt.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(this
|
353
|
+
relativeHeaderPosition = wt.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
298
354
|
}
|
299
355
|
|
300
356
|
// If the TH is not a child of the top-left/bottom-left overlay, recalculate using
|
301
357
|
// the left overlay - as this overlay contains the rest of the headers.
|
302
358
|
if (!relativeHeaderPosition) {
|
303
|
-
relativeHeaderPosition = wt.wtOverlays.inlineStartOverlay.getRelativeCellPosition(this
|
359
|
+
relativeHeaderPosition = wt.wtOverlays.inlineStartOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
304
360
|
}
|
305
|
-
this
|
306
|
-
this
|
361
|
+
_classPrivateFieldSet(this, _currentRow, this.hot.rowIndexMapper.getVisualFromRenderableIndex(row));
|
362
|
+
_classPrivateFieldSet(this, _selectedRows, []);
|
307
363
|
const isFullRowSelected = this.hot.selection.isSelectedByCorner() || this.hot.selection.isSelectedByRowHeader();
|
308
364
|
if (this.hot.selection.isSelected() && isFullRowSelected) {
|
309
365
|
const selectionRanges = this.hot.getSelectedRange();
|
@@ -313,23 +369,23 @@ export class ManualRowResize extends BasePlugin {
|
|
313
369
|
|
314
370
|
// Add every selected row for resize action.
|
315
371
|
rangeEach(fromRow, toRow, rowIndex => {
|
316
|
-
if (!this.
|
317
|
-
this.
|
372
|
+
if (!_classPrivateFieldGet(this, _selectedRows).includes(rowIndex)) {
|
373
|
+
_classPrivateFieldGet(this, _selectedRows).push(rowIndex);
|
318
374
|
}
|
319
375
|
});
|
320
376
|
});
|
321
377
|
}
|
322
378
|
|
323
379
|
// Resizing element beyond the current selection (also when there is no selection).
|
324
|
-
if (!this.
|
325
|
-
this
|
380
|
+
if (!_classPrivateFieldGet(this, _selectedRows).includes(_classPrivateFieldGet(this, _currentRow))) {
|
381
|
+
_classPrivateFieldSet(this, _selectedRows, [_classPrivateFieldGet(this, _currentRow)]);
|
326
382
|
}
|
327
|
-
this
|
328
|
-
this
|
329
|
-
this.
|
330
|
-
this.
|
331
|
-
this.
|
332
|
-
this.hot.rootElement.appendChild(this
|
383
|
+
_classPrivateFieldSet(this, _startOffset, relativeHeaderPosition.top - 6);
|
384
|
+
_classPrivateFieldSet(this, _startHeight, parseInt(box.height, 10));
|
385
|
+
_classPrivateFieldGet(this, _handle).style.top = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _startHeight)}px`;
|
386
|
+
_classPrivateFieldGet(this, _handle).style[this.inlineDir] = `${relativeHeaderPosition.start}px`;
|
387
|
+
_classPrivateFieldGet(this, _handle).style.width = `${headerWidth}px`;
|
388
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _handle));
|
333
389
|
}
|
334
390
|
|
335
391
|
/**
|
@@ -338,7 +394,7 @@ export class ManualRowResize extends BasePlugin {
|
|
338
394
|
* @private
|
339
395
|
*/
|
340
396
|
refreshHandlePosition() {
|
341
|
-
this.
|
397
|
+
_classPrivateFieldGet(this, _handle).style.top = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _currentHeight)}px`;
|
342
398
|
}
|
343
399
|
|
344
400
|
/**
|
@@ -347,15 +403,15 @@ export class ManualRowResize extends BasePlugin {
|
|
347
403
|
* @private
|
348
404
|
*/
|
349
405
|
setupGuidePosition() {
|
350
|
-
const handleWidth = parseInt(outerWidth(this
|
351
|
-
const handleEndPosition = parseInt(this.
|
406
|
+
const handleWidth = parseInt(outerWidth(_classPrivateFieldGet(this, _handle)), 10);
|
407
|
+
const handleEndPosition = parseInt(_classPrivateFieldGet(this, _handle).style[this.inlineDir], 10) + handleWidth;
|
352
408
|
const maximumVisibleElementWidth = parseInt(this.hot.view.maximumVisibleElementWidth(0), 10);
|
353
|
-
addClass(this
|
354
|
-
addClass(this
|
355
|
-
this.
|
356
|
-
this.
|
357
|
-
this.
|
358
|
-
this.hot.rootElement.appendChild(this
|
409
|
+
addClass(_classPrivateFieldGet(this, _handle), 'active');
|
410
|
+
addClass(_classPrivateFieldGet(this, _guide), 'active');
|
411
|
+
_classPrivateFieldGet(this, _guide).style.top = _classPrivateFieldGet(this, _handle).style.top;
|
412
|
+
_classPrivateFieldGet(this, _guide).style[this.inlineDir] = `${handleEndPosition}px`;
|
413
|
+
_classPrivateFieldGet(this, _guide).style.width = `${maximumVisibleElementWidth - handleWidth}px`;
|
414
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _guide));
|
359
415
|
}
|
360
416
|
|
361
417
|
/**
|
@@ -364,7 +420,7 @@ export class ManualRowResize extends BasePlugin {
|
|
364
420
|
* @private
|
365
421
|
*/
|
366
422
|
refreshGuidePosition() {
|
367
|
-
this.
|
423
|
+
_classPrivateFieldGet(this, _guide).style.top = _classPrivateFieldGet(this, _handle).style.top;
|
368
424
|
}
|
369
425
|
|
370
426
|
/**
|
@@ -373,8 +429,8 @@ export class ManualRowResize extends BasePlugin {
|
|
373
429
|
* @private
|
374
430
|
*/
|
375
431
|
hideHandleAndGuide() {
|
376
|
-
removeClass(this
|
377
|
-
removeClass(this
|
432
|
+
removeClass(_classPrivateFieldGet(this, _handle), 'active');
|
433
|
+
removeClass(_classPrivateFieldGet(this, _guide), 'active');
|
378
434
|
}
|
379
435
|
|
380
436
|
/**
|
@@ -417,10 +473,10 @@ export class ManualRowResize extends BasePlugin {
|
|
417
473
|
getActualRowHeight(row) {
|
418
474
|
// TODO: this should utilize `this.hot.getRowHeight` after it's fixed and working properly.
|
419
475
|
const walkontableHeight = this.hot.view._wt.wtTable.getRowHeight(row);
|
420
|
-
if (walkontableHeight !== undefined && this
|
476
|
+
if (walkontableHeight !== undefined && _classPrivateFieldGet(this, _newSize) < walkontableHeight) {
|
421
477
|
return walkontableHeight;
|
422
478
|
}
|
423
|
-
return this
|
479
|
+
return _classPrivateFieldGet(this, _newSize);
|
424
480
|
}
|
425
481
|
/**
|
426
482
|
* Auto-size row after doubleclick - callback.
|
@@ -438,30 +494,30 @@ export class ManualRowResize extends BasePlugin {
|
|
438
494
|
const resize = (row, forceRender) => {
|
439
495
|
const hookNewSize = this.hot.runHooks('beforeRowResize', this.getActualRowHeight(row), row, true);
|
440
496
|
if (hookNewSize !== undefined) {
|
441
|
-
this
|
497
|
+
_classPrivateFieldSet(this, _newSize, hookNewSize);
|
442
498
|
}
|
443
|
-
this.setManualSize(row, this
|
499
|
+
this.setManualSize(row, _classPrivateFieldGet(this, _newSize)); // double click sets auto row size
|
444
500
|
|
445
501
|
this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, true);
|
446
502
|
if (forceRender) {
|
447
503
|
render();
|
448
504
|
}
|
449
505
|
};
|
450
|
-
if (this
|
451
|
-
const selectedRowsLength = this.
|
506
|
+
if (_classPrivateFieldGet(this, _dblclick) >= 2) {
|
507
|
+
const selectedRowsLength = _classPrivateFieldGet(this, _selectedRows).length;
|
452
508
|
if (selectedRowsLength > 1) {
|
453
|
-
arrayEach(this
|
509
|
+
arrayEach(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
454
510
|
resize(selectedRow);
|
455
511
|
});
|
456
512
|
render();
|
457
513
|
} else {
|
458
|
-
arrayEach(this
|
514
|
+
arrayEach(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
459
515
|
resize(selectedRow, true);
|
460
516
|
});
|
461
517
|
}
|
462
518
|
}
|
463
|
-
this
|
464
|
-
this
|
519
|
+
_classPrivateFieldSet(this, _dblclick, 0);
|
520
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, null);
|
465
521
|
}
|
466
522
|
/**
|
467
523
|
* Binds the mouse events.
|
@@ -477,7 +533,7 @@ export class ManualRowResize extends BasePlugin {
|
|
477
533
|
this.eventManager.addEventListener(rootElement, 'mousedown', e => _classPrivateMethodGet(this, _onMouseDown, _onMouseDown2).call(this, e));
|
478
534
|
this.eventManager.addEventListener(rootWindow, 'mousemove', e => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, e));
|
479
535
|
this.eventManager.addEventListener(rootWindow, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
480
|
-
this.eventManager.addEventListener(this
|
536
|
+
this.eventManager.addEventListener(_classPrivateFieldGet(this, _handle), 'contextmenu', () => _classPrivateMethodGet(this, _onContextMenu, _onContextMenu2).call(this));
|
481
537
|
}
|
482
538
|
/**
|
483
539
|
* Destroys the plugin instance.
|
@@ -494,13 +550,13 @@ function _onMouseOver2(event) {
|
|
494
550
|
}
|
495
551
|
|
496
552
|
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
497
|
-
if (this
|
553
|
+
if (_classPrivateFieldGet(this, _isTriggeredByRMB) === true) {
|
498
554
|
return;
|
499
555
|
}
|
500
556
|
if (this.checkIfRowHeader(event.target)) {
|
501
557
|
const th = this.getClosestTHParent(event.target);
|
502
558
|
if (th) {
|
503
|
-
if (!this
|
559
|
+
if (!_classPrivateFieldGet(this, _pressed)) {
|
504
560
|
this.setupHandlePosition(th);
|
505
561
|
}
|
506
562
|
}
|
@@ -508,23 +564,23 @@ function _onMouseOver2(event) {
|
|
508
564
|
}
|
509
565
|
function _onMouseDown2(event) {
|
510
566
|
if (hasClass(event.target, 'manualRowResizer')) {
|
511
|
-
this.setupHandlePosition(this
|
567
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
512
568
|
this.setupGuidePosition();
|
513
|
-
this
|
514
|
-
if (this
|
515
|
-
this
|
516
|
-
this.hot._registerTimeout(this
|
569
|
+
_classPrivateFieldSet(this, _pressed, true);
|
570
|
+
if (_classPrivateFieldGet(this, _autoresizeTimeout) === null) {
|
571
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, setTimeout(() => this.afterMouseDownTimeout(), 500));
|
572
|
+
this.hot._registerTimeout(_classPrivateFieldGet(this, _autoresizeTimeout));
|
517
573
|
}
|
518
|
-
this
|
519
|
-
this
|
520
|
-
this
|
574
|
+
_classPrivateFieldSet(this, _dblclick, _classPrivateFieldGet(this, _dblclick) + 1);
|
575
|
+
_classPrivateFieldSet(this, _startY, event.pageY);
|
576
|
+
_classPrivateFieldSet(this, _newSize, _classPrivateFieldGet(this, _startHeight));
|
521
577
|
}
|
522
578
|
}
|
523
579
|
function _onMouseMove2(event) {
|
524
|
-
if (this
|
525
|
-
this
|
526
|
-
arrayEach(this
|
527
|
-
this
|
580
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
581
|
+
_classPrivateFieldSet(this, _currentHeight, _classPrivateFieldGet(this, _startHeight) + (event.pageY - _classPrivateFieldGet(this, _startY)));
|
582
|
+
arrayEach(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
583
|
+
_classPrivateFieldSet(this, _newSize, this.setManualSize(selectedRow, _classPrivateFieldGet(this, _currentHeight)));
|
528
584
|
});
|
529
585
|
this.refreshHandlePosition();
|
530
586
|
this.refreshGuidePosition();
|
@@ -544,43 +600,43 @@ function _onMouseUp2() {
|
|
544
600
|
this.saveManualRowHeights();
|
545
601
|
this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, false);
|
546
602
|
};
|
547
|
-
if (this
|
603
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
548
604
|
this.hideHandleAndGuide();
|
549
|
-
this
|
550
|
-
if (this
|
551
|
-
const selectedRowsLength = this.
|
605
|
+
_classPrivateFieldSet(this, _pressed, false);
|
606
|
+
if (_classPrivateFieldGet(this, _newSize) !== _classPrivateFieldGet(this, _startHeight)) {
|
607
|
+
const selectedRowsLength = _classPrivateFieldGet(this, _selectedRows).length;
|
552
608
|
if (selectedRowsLength > 1) {
|
553
|
-
arrayEach(this
|
609
|
+
arrayEach(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
554
610
|
runHooks(selectedRow);
|
555
611
|
});
|
556
612
|
render();
|
557
613
|
} else {
|
558
|
-
arrayEach(this
|
614
|
+
arrayEach(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
559
615
|
runHooks(selectedRow, true);
|
560
616
|
});
|
561
617
|
}
|
562
618
|
}
|
563
|
-
this.setupHandlePosition(this
|
619
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
564
620
|
}
|
565
621
|
}
|
566
622
|
function _onContextMenu2() {
|
567
623
|
this.hideHandleAndGuide();
|
568
|
-
this.hot.rootElement.removeChild(this
|
569
|
-
this.hot.rootElement.removeChild(this
|
570
|
-
this
|
571
|
-
this
|
624
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _handle));
|
625
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _guide));
|
626
|
+
_classPrivateFieldSet(this, _pressed, false);
|
627
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, true);
|
572
628
|
|
573
629
|
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
574
630
|
// shouldn't be drawn just after removing it.
|
575
631
|
this.hot._registerImmediate(() => {
|
576
|
-
this
|
632
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, false);
|
577
633
|
});
|
578
634
|
}
|
579
635
|
function _onModifyRowHeight2(height, row) {
|
580
636
|
let newHeight = height;
|
581
637
|
if (this.enabled) {
|
582
638
|
const physicalRow = this.hot.toPhysicalRow(row);
|
583
|
-
const rowHeight = this.
|
639
|
+
const rowHeight = _classPrivateFieldGet(this, _rowHeightsMap).getValueAtIndex(physicalRow);
|
584
640
|
if (this.hot.getSettings()[PLUGIN_KEY] && rowHeight) {
|
585
641
|
newHeight = rowHeight;
|
586
642
|
}
|
@@ -593,16 +649,16 @@ function _onMapInit2() {
|
|
593
649
|
this.hot.batchExecution(() => {
|
594
650
|
if (typeof loadedManualRowHeights !== 'undefined') {
|
595
651
|
loadedManualRowHeights.forEach((height, index) => {
|
596
|
-
this.
|
652
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
597
653
|
});
|
598
654
|
} else if (Array.isArray(initialSetting)) {
|
599
655
|
initialSetting.forEach((height, index) => {
|
600
|
-
this.
|
656
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
601
657
|
});
|
602
658
|
_classPrivateFieldSet(this, _config, initialSetting);
|
603
659
|
} else if (initialSetting === true && Array.isArray(_classPrivateFieldGet(this, _config))) {
|
604
660
|
_classPrivateFieldGet(this, _config).forEach((height, index) => {
|
605
|
-
this.
|
661
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
606
662
|
});
|
607
663
|
}
|
608
664
|
}, true);
|
package/settings.d.ts
CHANGED
@@ -125,7 +125,7 @@ export interface GridSettings extends Events {
|
|
125
125
|
dateFormat?: string;
|
126
126
|
datePickerConfig?: PikadayOptions;
|
127
127
|
defaultDate?: string;
|
128
|
-
|
128
|
+
tabNavigation?: boolean;
|
129
129
|
disableVisualSelection?: boolean | 'current' | 'area' | 'header' | Array<'current' | 'area' | 'header'>;
|
130
130
|
dragToScroll?: boolean;
|
131
131
|
dropdownMenu?: DropdownMenuSettings;
|