handsontable 14.0.0-next-4fd76bc-20231114 → 14.0.0-next-bdc44e7-20231115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
require("core-js/modules/es.error.cause.js");
|
3
4
|
exports.__esModule = true;
|
4
5
|
require("core-js/modules/es.array.push.js");
|
5
|
-
require("core-js/modules/es.error.cause.js");
|
6
6
|
var _base = require("../base");
|
7
7
|
var _element = require("../../helpers/dom/element");
|
8
8
|
var _array = require("../../helpers/array");
|
@@ -12,15 +12,12 @@ var _src = require("../../3rdparty/walkontable/src");
|
|
12
12
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
13
13
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
14
14
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
15
|
-
function
|
16
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
17
|
-
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); }
|
18
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
19
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
15
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
20
16
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
21
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
22
17
|
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; } }
|
23
|
-
function
|
18
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
19
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
20
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
24
21
|
// Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
|
25
22
|
|
26
23
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'manualRowResize';
|
@@ -41,6 +38,21 @@ const PERSISTENT_STATE_KEY = 'manualRowHeights';
|
|
41
38
|
* - handle - the draggable element that sets the desired height of the row.
|
42
39
|
* - guide - the helper guide that shows the desired height as a horizontal guide.
|
43
40
|
*/
|
41
|
+
var _currentTH = /*#__PURE__*/new WeakMap();
|
42
|
+
var _currentRow = /*#__PURE__*/new WeakMap();
|
43
|
+
var _selectedRows = /*#__PURE__*/new WeakMap();
|
44
|
+
var _currentHeight = /*#__PURE__*/new WeakMap();
|
45
|
+
var _newSize = /*#__PURE__*/new WeakMap();
|
46
|
+
var _startY = /*#__PURE__*/new WeakMap();
|
47
|
+
var _startHeight = /*#__PURE__*/new WeakMap();
|
48
|
+
var _startOffset = /*#__PURE__*/new WeakMap();
|
49
|
+
var _handle = /*#__PURE__*/new WeakMap();
|
50
|
+
var _guide = /*#__PURE__*/new WeakMap();
|
51
|
+
var _pressed = /*#__PURE__*/new WeakMap();
|
52
|
+
var _isTriggeredByRMB = /*#__PURE__*/new WeakMap();
|
53
|
+
var _dblclick = /*#__PURE__*/new WeakMap();
|
54
|
+
var _autoresizeTimeout = /*#__PURE__*/new WeakMap();
|
55
|
+
var _rowHeightsMap = /*#__PURE__*/new WeakMap();
|
44
56
|
var _config = /*#__PURE__*/new WeakMap();
|
45
57
|
var _onMouseOver = /*#__PURE__*/new WeakSet();
|
46
58
|
var _onMouseDown = /*#__PURE__*/new WeakSet();
|
@@ -104,66 +116,110 @@ class ManualRowResize extends _base.BasePlugin {
|
|
104
116
|
* @param {MouseEvent} event The mouse event.
|
105
117
|
*/
|
106
118
|
_classPrivateMethodInitSpec(this, _onMouseOver);
|
107
|
-
|
119
|
+
_classPrivateFieldInitSpec(this, _currentTH, {
|
120
|
+
writable: true,
|
121
|
+
value: null
|
122
|
+
});
|
108
123
|
/**
|
109
124
|
* @type {number}
|
110
125
|
*/
|
111
|
-
|
126
|
+
_classPrivateFieldInitSpec(this, _currentRow, {
|
127
|
+
writable: true,
|
128
|
+
value: null
|
129
|
+
});
|
112
130
|
/**
|
113
131
|
* @type {number[]}
|
114
132
|
*/
|
115
|
-
|
133
|
+
_classPrivateFieldInitSpec(this, _selectedRows, {
|
134
|
+
writable: true,
|
135
|
+
value: []
|
136
|
+
});
|
116
137
|
/**
|
117
138
|
* @type {number}
|
118
139
|
*/
|
119
|
-
|
140
|
+
_classPrivateFieldInitSpec(this, _currentHeight, {
|
141
|
+
writable: true,
|
142
|
+
value: null
|
143
|
+
});
|
120
144
|
/**
|
121
145
|
* @type {number}
|
122
146
|
*/
|
123
|
-
|
147
|
+
_classPrivateFieldInitSpec(this, _newSize, {
|
148
|
+
writable: true,
|
149
|
+
value: null
|
150
|
+
});
|
124
151
|
/**
|
125
152
|
* @type {number}
|
126
153
|
*/
|
127
|
-
|
154
|
+
_classPrivateFieldInitSpec(this, _startY, {
|
155
|
+
writable: true,
|
156
|
+
value: null
|
157
|
+
});
|
128
158
|
/**
|
129
159
|
* @type {number}
|
130
160
|
*/
|
131
|
-
|
161
|
+
_classPrivateFieldInitSpec(this, _startHeight, {
|
162
|
+
writable: true,
|
163
|
+
value: null
|
164
|
+
});
|
132
165
|
/**
|
133
166
|
* @type {number}
|
134
167
|
*/
|
135
|
-
|
168
|
+
_classPrivateFieldInitSpec(this, _startOffset, {
|
169
|
+
writable: true,
|
170
|
+
value: null
|
171
|
+
});
|
136
172
|
/**
|
137
173
|
* @type {HTMLElement}
|
138
174
|
*/
|
139
|
-
|
175
|
+
_classPrivateFieldInitSpec(this, _handle, {
|
176
|
+
writable: true,
|
177
|
+
value: this.hot.rootDocument.createElement('DIV')
|
178
|
+
});
|
140
179
|
/**
|
141
180
|
* @type {HTMLElement}
|
142
181
|
*/
|
143
|
-
|
182
|
+
_classPrivateFieldInitSpec(this, _guide, {
|
183
|
+
writable: true,
|
184
|
+
value: this.hot.rootDocument.createElement('DIV')
|
185
|
+
});
|
144
186
|
/**
|
145
187
|
* @type {boolean}
|
146
188
|
*/
|
147
|
-
|
189
|
+
_classPrivateFieldInitSpec(this, _pressed, {
|
190
|
+
writable: true,
|
191
|
+
value: false
|
192
|
+
});
|
148
193
|
/**
|
149
194
|
* @type {boolean}
|
150
195
|
*/
|
151
|
-
|
196
|
+
_classPrivateFieldInitSpec(this, _isTriggeredByRMB, {
|
197
|
+
writable: true,
|
198
|
+
value: false
|
199
|
+
});
|
152
200
|
/**
|
153
201
|
* @type {number}
|
154
202
|
*/
|
155
|
-
|
203
|
+
_classPrivateFieldInitSpec(this, _dblclick, {
|
204
|
+
writable: true,
|
205
|
+
value: 0
|
206
|
+
});
|
156
207
|
/**
|
157
208
|
* @type {number}
|
158
209
|
*/
|
159
|
-
|
210
|
+
_classPrivateFieldInitSpec(this, _autoresizeTimeout, {
|
211
|
+
writable: true,
|
212
|
+
value: null
|
213
|
+
});
|
160
214
|
/**
|
161
215
|
* PhysicalIndexToValueMap to keep and track widths for physical row indexes.
|
162
216
|
*
|
163
|
-
* @private
|
164
217
|
* @type {PhysicalIndexToValueMap}
|
165
218
|
*/
|
166
|
-
|
219
|
+
_classPrivateFieldInitSpec(this, _rowHeightsMap, {
|
220
|
+
writable: true,
|
221
|
+
value: void 0
|
222
|
+
});
|
167
223
|
/**
|
168
224
|
* Private pool to save configuration from updateSettings.
|
169
225
|
*
|
@@ -173,8 +229,8 @@ class ManualRowResize extends _base.BasePlugin {
|
|
173
229
|
writable: true,
|
174
230
|
value: void 0
|
175
231
|
});
|
176
|
-
(0, _element.addClass)(this
|
177
|
-
(0, _element.addClass)(this
|
232
|
+
(0, _element.addClass)(_classPrivateFieldGet(this, _handle), 'manualRowResizer');
|
233
|
+
(0, _element.addClass)(_classPrivateFieldGet(this, _guide), 'manualRowResizerGuide');
|
178
234
|
}
|
179
235
|
|
180
236
|
/**
|
@@ -202,9 +258,9 @@ class ManualRowResize extends _base.BasePlugin {
|
|
202
258
|
if (this.enabled) {
|
203
259
|
return;
|
204
260
|
}
|
205
|
-
this
|
206
|
-
this.
|
207
|
-
this.hot.rowIndexMapper.registerMap(this.pluginName, this
|
261
|
+
_classPrivateFieldSet(this, _rowHeightsMap, new _translations.PhysicalIndexToValueMap());
|
262
|
+
_classPrivateFieldGet(this, _rowHeightsMap).addLocalHook('init', () => _classPrivateMethodGet(this, _onMapInit, _onMapInit2).call(this));
|
263
|
+
this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(this, _rowHeightsMap));
|
208
264
|
this.addHook('modifyRowHeight', (height, row) => _classPrivateMethodGet(this, _onModifyRowHeight, _onModifyRowHeight2).call(this, height, row));
|
209
265
|
this.bindEvents();
|
210
266
|
super.enablePlugin();
|
@@ -226,7 +282,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
226
282
|
* Disables the plugin functionality for this Handsontable instance.
|
227
283
|
*/
|
228
284
|
disablePlugin() {
|
229
|
-
_classPrivateFieldSet(this, _config, this.
|
285
|
+
_classPrivateFieldSet(this, _config, _classPrivateFieldGet(this, _rowHeightsMap).getValues());
|
230
286
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
231
287
|
super.disablePlugin();
|
232
288
|
}
|
@@ -238,7 +294,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
238
294
|
* @fires Hooks#persistentStateSave
|
239
295
|
*/
|
240
296
|
saveManualRowHeights() {
|
241
|
-
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, this.
|
297
|
+
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, _classPrivateFieldGet(this, _rowHeightsMap).getValues());
|
242
298
|
}
|
243
299
|
|
244
300
|
/**
|
@@ -264,7 +320,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
264
320
|
setManualSize(row, height) {
|
265
321
|
const physicalRow = this.hot.toPhysicalRow(row);
|
266
322
|
const newHeight = Math.max(height, _src.ViewportRowsCalculator.DEFAULT_HEIGHT);
|
267
|
-
this.
|
323
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(physicalRow, newHeight);
|
268
324
|
return newHeight;
|
269
325
|
}
|
270
326
|
|
@@ -275,40 +331,40 @@ class ManualRowResize extends _base.BasePlugin {
|
|
275
331
|
* @param {HTMLCellElement} TH TH HTML element.
|
276
332
|
*/
|
277
333
|
setupHandlePosition(TH) {
|
278
|
-
this
|
334
|
+
_classPrivateFieldSet(this, _currentTH, TH);
|
279
335
|
const {
|
280
336
|
view
|
281
337
|
} = this.hot;
|
282
338
|
const {
|
283
339
|
_wt: wt
|
284
340
|
} = view;
|
285
|
-
const cellCoords = wt.wtTable.getCoords(this
|
341
|
+
const cellCoords = wt.wtTable.getCoords(_classPrivateFieldGet(this, _currentTH));
|
286
342
|
const row = cellCoords.row;
|
287
343
|
|
288
344
|
// Ignore row headers.
|
289
345
|
if (row < 0) {
|
290
346
|
return;
|
291
347
|
}
|
292
|
-
const headerWidth = (0, _element.outerWidth)(this
|
293
|
-
const box = this.
|
348
|
+
const headerWidth = (0, _element.outerWidth)(_classPrivateFieldGet(this, _currentTH));
|
349
|
+
const box = _classPrivateFieldGet(this, _currentTH).getBoundingClientRect();
|
294
350
|
// Read "fixedRowsTop" and "fixedRowsBottom" through the Walkontable as in that context, the fixed
|
295
351
|
// rows are modified (reduced by the number of hidden rows) by TableView module.
|
296
352
|
const fixedRowTop = row < wt.getSetting('fixedRowsTop');
|
297
353
|
const fixedRowBottom = row >= view.countNotHiddenRowIndexes(0, 1) - wt.getSetting('fixedRowsBottom');
|
298
354
|
let relativeHeaderPosition;
|
299
355
|
if (fixedRowTop) {
|
300
|
-
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(this
|
356
|
+
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
301
357
|
} else if (fixedRowBottom) {
|
302
|
-
relativeHeaderPosition = wt.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(this
|
358
|
+
relativeHeaderPosition = wt.wtOverlays.bottomInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
303
359
|
}
|
304
360
|
|
305
361
|
// If the TH is not a child of the top-left/bottom-left overlay, recalculate using
|
306
362
|
// the left overlay - as this overlay contains the rest of the headers.
|
307
363
|
if (!relativeHeaderPosition) {
|
308
|
-
relativeHeaderPosition = wt.wtOverlays.inlineStartOverlay.getRelativeCellPosition(this
|
364
|
+
relativeHeaderPosition = wt.wtOverlays.inlineStartOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
309
365
|
}
|
310
|
-
this
|
311
|
-
this
|
366
|
+
_classPrivateFieldSet(this, _currentRow, this.hot.rowIndexMapper.getVisualFromRenderableIndex(row));
|
367
|
+
_classPrivateFieldSet(this, _selectedRows, []);
|
312
368
|
const isFullRowSelected = this.hot.selection.isSelectedByCorner() || this.hot.selection.isSelectedByRowHeader();
|
313
369
|
if (this.hot.selection.isSelected() && isFullRowSelected) {
|
314
370
|
const selectionRanges = this.hot.getSelectedRange();
|
@@ -318,23 +374,23 @@ class ManualRowResize extends _base.BasePlugin {
|
|
318
374
|
|
319
375
|
// Add every selected row for resize action.
|
320
376
|
(0, _number.rangeEach)(fromRow, toRow, rowIndex => {
|
321
|
-
if (!this.
|
322
|
-
this.
|
377
|
+
if (!_classPrivateFieldGet(this, _selectedRows).includes(rowIndex)) {
|
378
|
+
_classPrivateFieldGet(this, _selectedRows).push(rowIndex);
|
323
379
|
}
|
324
380
|
});
|
325
381
|
});
|
326
382
|
}
|
327
383
|
|
328
384
|
// Resizing element beyond the current selection (also when there is no selection).
|
329
|
-
if (!this.
|
330
|
-
this
|
385
|
+
if (!_classPrivateFieldGet(this, _selectedRows).includes(_classPrivateFieldGet(this, _currentRow))) {
|
386
|
+
_classPrivateFieldSet(this, _selectedRows, [_classPrivateFieldGet(this, _currentRow)]);
|
331
387
|
}
|
332
|
-
this
|
333
|
-
this
|
334
|
-
this.
|
335
|
-
this.
|
336
|
-
this.
|
337
|
-
this.hot.rootElement.appendChild(this
|
388
|
+
_classPrivateFieldSet(this, _startOffset, relativeHeaderPosition.top - 6);
|
389
|
+
_classPrivateFieldSet(this, _startHeight, parseInt(box.height, 10));
|
390
|
+
_classPrivateFieldGet(this, _handle).style.top = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _startHeight)}px`;
|
391
|
+
_classPrivateFieldGet(this, _handle).style[this.inlineDir] = `${relativeHeaderPosition.start}px`;
|
392
|
+
_classPrivateFieldGet(this, _handle).style.width = `${headerWidth}px`;
|
393
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _handle));
|
338
394
|
}
|
339
395
|
|
340
396
|
/**
|
@@ -343,7 +399,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
343
399
|
* @private
|
344
400
|
*/
|
345
401
|
refreshHandlePosition() {
|
346
|
-
this.
|
402
|
+
_classPrivateFieldGet(this, _handle).style.top = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _currentHeight)}px`;
|
347
403
|
}
|
348
404
|
|
349
405
|
/**
|
@@ -352,15 +408,15 @@ class ManualRowResize extends _base.BasePlugin {
|
|
352
408
|
* @private
|
353
409
|
*/
|
354
410
|
setupGuidePosition() {
|
355
|
-
const handleWidth = parseInt((0, _element.outerWidth)(this
|
356
|
-
const handleEndPosition = parseInt(this.
|
411
|
+
const handleWidth = parseInt((0, _element.outerWidth)(_classPrivateFieldGet(this, _handle)), 10);
|
412
|
+
const handleEndPosition = parseInt(_classPrivateFieldGet(this, _handle).style[this.inlineDir], 10) + handleWidth;
|
357
413
|
const maximumVisibleElementWidth = parseInt(this.hot.view.maximumVisibleElementWidth(0), 10);
|
358
|
-
(0, _element.addClass)(this
|
359
|
-
(0, _element.addClass)(this
|
360
|
-
this.
|
361
|
-
this.
|
362
|
-
this.
|
363
|
-
this.hot.rootElement.appendChild(this
|
414
|
+
(0, _element.addClass)(_classPrivateFieldGet(this, _handle), 'active');
|
415
|
+
(0, _element.addClass)(_classPrivateFieldGet(this, _guide), 'active');
|
416
|
+
_classPrivateFieldGet(this, _guide).style.top = _classPrivateFieldGet(this, _handle).style.top;
|
417
|
+
_classPrivateFieldGet(this, _guide).style[this.inlineDir] = `${handleEndPosition}px`;
|
418
|
+
_classPrivateFieldGet(this, _guide).style.width = `${maximumVisibleElementWidth - handleWidth}px`;
|
419
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _guide));
|
364
420
|
}
|
365
421
|
|
366
422
|
/**
|
@@ -369,7 +425,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
369
425
|
* @private
|
370
426
|
*/
|
371
427
|
refreshGuidePosition() {
|
372
|
-
this.
|
428
|
+
_classPrivateFieldGet(this, _guide).style.top = _classPrivateFieldGet(this, _handle).style.top;
|
373
429
|
}
|
374
430
|
|
375
431
|
/**
|
@@ -378,8 +434,8 @@ class ManualRowResize extends _base.BasePlugin {
|
|
378
434
|
* @private
|
379
435
|
*/
|
380
436
|
hideHandleAndGuide() {
|
381
|
-
(0, _element.removeClass)(this
|
382
|
-
(0, _element.removeClass)(this
|
437
|
+
(0, _element.removeClass)(_classPrivateFieldGet(this, _handle), 'active');
|
438
|
+
(0, _element.removeClass)(_classPrivateFieldGet(this, _guide), 'active');
|
383
439
|
}
|
384
440
|
|
385
441
|
/**
|
@@ -422,10 +478,10 @@ class ManualRowResize extends _base.BasePlugin {
|
|
422
478
|
getActualRowHeight(row) {
|
423
479
|
// TODO: this should utilize `this.hot.getRowHeight` after it's fixed and working properly.
|
424
480
|
const walkontableHeight = this.hot.view._wt.wtTable.getRowHeight(row);
|
425
|
-
if (walkontableHeight !== undefined && this
|
481
|
+
if (walkontableHeight !== undefined && _classPrivateFieldGet(this, _newSize) < walkontableHeight) {
|
426
482
|
return walkontableHeight;
|
427
483
|
}
|
428
|
-
return this
|
484
|
+
return _classPrivateFieldGet(this, _newSize);
|
429
485
|
}
|
430
486
|
/**
|
431
487
|
* Auto-size row after doubleclick - callback.
|
@@ -443,30 +499,30 @@ class ManualRowResize extends _base.BasePlugin {
|
|
443
499
|
const resize = (row, forceRender) => {
|
444
500
|
const hookNewSize = this.hot.runHooks('beforeRowResize', this.getActualRowHeight(row), row, true);
|
445
501
|
if (hookNewSize !== undefined) {
|
446
|
-
this
|
502
|
+
_classPrivateFieldSet(this, _newSize, hookNewSize);
|
447
503
|
}
|
448
|
-
this.setManualSize(row, this
|
504
|
+
this.setManualSize(row, _classPrivateFieldGet(this, _newSize)); // double click sets auto row size
|
449
505
|
|
450
506
|
this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, true);
|
451
507
|
if (forceRender) {
|
452
508
|
render();
|
453
509
|
}
|
454
510
|
};
|
455
|
-
if (this
|
456
|
-
const selectedRowsLength = this.
|
511
|
+
if (_classPrivateFieldGet(this, _dblclick) >= 2) {
|
512
|
+
const selectedRowsLength = _classPrivateFieldGet(this, _selectedRows).length;
|
457
513
|
if (selectedRowsLength > 1) {
|
458
|
-
(0, _array.arrayEach)(this
|
514
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
459
515
|
resize(selectedRow);
|
460
516
|
});
|
461
517
|
render();
|
462
518
|
} else {
|
463
|
-
(0, _array.arrayEach)(this
|
519
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
464
520
|
resize(selectedRow, true);
|
465
521
|
});
|
466
522
|
}
|
467
523
|
}
|
468
|
-
this
|
469
|
-
this
|
524
|
+
_classPrivateFieldSet(this, _dblclick, 0);
|
525
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, null);
|
470
526
|
}
|
471
527
|
/**
|
472
528
|
* Binds the mouse events.
|
@@ -482,7 +538,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
482
538
|
this.eventManager.addEventListener(rootElement, 'mousedown', e => _classPrivateMethodGet(this, _onMouseDown, _onMouseDown2).call(this, e));
|
483
539
|
this.eventManager.addEventListener(rootWindow, 'mousemove', e => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, e));
|
484
540
|
this.eventManager.addEventListener(rootWindow, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
485
|
-
this.eventManager.addEventListener(this
|
541
|
+
this.eventManager.addEventListener(_classPrivateFieldGet(this, _handle), 'contextmenu', () => _classPrivateMethodGet(this, _onContextMenu, _onContextMenu2).call(this));
|
486
542
|
}
|
487
543
|
/**
|
488
544
|
* Destroys the plugin instance.
|
@@ -500,13 +556,13 @@ function _onMouseOver2(event) {
|
|
500
556
|
}
|
501
557
|
|
502
558
|
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
503
|
-
if (this
|
559
|
+
if (_classPrivateFieldGet(this, _isTriggeredByRMB) === true) {
|
504
560
|
return;
|
505
561
|
}
|
506
562
|
if (this.checkIfRowHeader(event.target)) {
|
507
563
|
const th = this.getClosestTHParent(event.target);
|
508
564
|
if (th) {
|
509
|
-
if (!this
|
565
|
+
if (!_classPrivateFieldGet(this, _pressed)) {
|
510
566
|
this.setupHandlePosition(th);
|
511
567
|
}
|
512
568
|
}
|
@@ -514,23 +570,23 @@ function _onMouseOver2(event) {
|
|
514
570
|
}
|
515
571
|
function _onMouseDown2(event) {
|
516
572
|
if ((0, _element.hasClass)(event.target, 'manualRowResizer')) {
|
517
|
-
this.setupHandlePosition(this
|
573
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
518
574
|
this.setupGuidePosition();
|
519
|
-
this
|
520
|
-
if (this
|
521
|
-
this
|
522
|
-
this.hot._registerTimeout(this
|
575
|
+
_classPrivateFieldSet(this, _pressed, true);
|
576
|
+
if (_classPrivateFieldGet(this, _autoresizeTimeout) === null) {
|
577
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, setTimeout(() => this.afterMouseDownTimeout(), 500));
|
578
|
+
this.hot._registerTimeout(_classPrivateFieldGet(this, _autoresizeTimeout));
|
523
579
|
}
|
524
|
-
this
|
525
|
-
this
|
526
|
-
this
|
580
|
+
_classPrivateFieldSet(this, _dblclick, _classPrivateFieldGet(this, _dblclick) + 1);
|
581
|
+
_classPrivateFieldSet(this, _startY, event.pageY);
|
582
|
+
_classPrivateFieldSet(this, _newSize, _classPrivateFieldGet(this, _startHeight));
|
527
583
|
}
|
528
584
|
}
|
529
585
|
function _onMouseMove2(event) {
|
530
|
-
if (this
|
531
|
-
this
|
532
|
-
(0, _array.arrayEach)(this
|
533
|
-
this
|
586
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
587
|
+
_classPrivateFieldSet(this, _currentHeight, _classPrivateFieldGet(this, _startHeight) + (event.pageY - _classPrivateFieldGet(this, _startY)));
|
588
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
589
|
+
_classPrivateFieldSet(this, _newSize, this.setManualSize(selectedRow, _classPrivateFieldGet(this, _currentHeight)));
|
534
590
|
});
|
535
591
|
this.refreshHandlePosition();
|
536
592
|
this.refreshGuidePosition();
|
@@ -550,43 +606,43 @@ function _onMouseUp2() {
|
|
550
606
|
this.saveManualRowHeights();
|
551
607
|
this.hot.runHooks('afterRowResize', this.getActualRowHeight(row), row, false);
|
552
608
|
};
|
553
|
-
if (this
|
609
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
554
610
|
this.hideHandleAndGuide();
|
555
|
-
this
|
556
|
-
if (this
|
557
|
-
const selectedRowsLength = this.
|
611
|
+
_classPrivateFieldSet(this, _pressed, false);
|
612
|
+
if (_classPrivateFieldGet(this, _newSize) !== _classPrivateFieldGet(this, _startHeight)) {
|
613
|
+
const selectedRowsLength = _classPrivateFieldGet(this, _selectedRows).length;
|
558
614
|
if (selectedRowsLength > 1) {
|
559
|
-
(0, _array.arrayEach)(this
|
615
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
560
616
|
runHooks(selectedRow);
|
561
617
|
});
|
562
618
|
render();
|
563
619
|
} else {
|
564
|
-
(0, _array.arrayEach)(this
|
620
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _selectedRows), selectedRow => {
|
565
621
|
runHooks(selectedRow, true);
|
566
622
|
});
|
567
623
|
}
|
568
624
|
}
|
569
|
-
this.setupHandlePosition(this
|
625
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
570
626
|
}
|
571
627
|
}
|
572
628
|
function _onContextMenu2() {
|
573
629
|
this.hideHandleAndGuide();
|
574
|
-
this.hot.rootElement.removeChild(this
|
575
|
-
this.hot.rootElement.removeChild(this
|
576
|
-
this
|
577
|
-
this
|
630
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _handle));
|
631
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _guide));
|
632
|
+
_classPrivateFieldSet(this, _pressed, false);
|
633
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, true);
|
578
634
|
|
579
635
|
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
580
636
|
// shouldn't be drawn just after removing it.
|
581
637
|
this.hot._registerImmediate(() => {
|
582
|
-
this
|
638
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, false);
|
583
639
|
});
|
584
640
|
}
|
585
641
|
function _onModifyRowHeight2(height, row) {
|
586
642
|
let newHeight = height;
|
587
643
|
if (this.enabled) {
|
588
644
|
const physicalRow = this.hot.toPhysicalRow(row);
|
589
|
-
const rowHeight = this.
|
645
|
+
const rowHeight = _classPrivateFieldGet(this, _rowHeightsMap).getValueAtIndex(physicalRow);
|
590
646
|
if (this.hot.getSettings()[PLUGIN_KEY] && rowHeight) {
|
591
647
|
newHeight = rowHeight;
|
592
648
|
}
|
@@ -599,16 +655,16 @@ function _onMapInit2() {
|
|
599
655
|
this.hot.batchExecution(() => {
|
600
656
|
if (typeof loadedManualRowHeights !== 'undefined') {
|
601
657
|
loadedManualRowHeights.forEach((height, index) => {
|
602
|
-
this.
|
658
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
603
659
|
});
|
604
660
|
} else if (Array.isArray(initialSetting)) {
|
605
661
|
initialSetting.forEach((height, index) => {
|
606
|
-
this.
|
662
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
607
663
|
});
|
608
664
|
_classPrivateFieldSet(this, _config, initialSetting);
|
609
665
|
} else if (initialSetting === true && Array.isArray(_classPrivateFieldGet(this, _config))) {
|
610
666
|
_classPrivateFieldGet(this, _config).forEach((height, index) => {
|
611
|
-
this.
|
667
|
+
_classPrivateFieldGet(this, _rowHeightsMap).setValueAtIndex(index, height);
|
612
668
|
});
|
613
669
|
}
|
614
670
|
}, true);
|