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, outerHeight, isDetached } from "../../helpers/dom/element.mjs";
|
17
14
|
import { arrayEach } from "../../helpers/array.mjs";
|
@@ -35,6 +32,21 @@ const PERSISTENT_STATE_KEY = 'manualColumnWidths';
|
|
35
32
|
* - handle - the draggable element that sets the desired width of the column.
|
36
33
|
* - guide - the helper guide that shows the desired width as a vertical guide.
|
37
34
|
*/
|
35
|
+
var _currentTH = /*#__PURE__*/new WeakMap();
|
36
|
+
var _currentCol = /*#__PURE__*/new WeakMap();
|
37
|
+
var _selectedCols = /*#__PURE__*/new WeakMap();
|
38
|
+
var _currentWidth = /*#__PURE__*/new WeakMap();
|
39
|
+
var _newSize = /*#__PURE__*/new WeakMap();
|
40
|
+
var _startY = /*#__PURE__*/new WeakMap();
|
41
|
+
var _startWidth = /*#__PURE__*/new WeakMap();
|
42
|
+
var _startOffset = /*#__PURE__*/new WeakMap();
|
43
|
+
var _handle = /*#__PURE__*/new WeakMap();
|
44
|
+
var _guide = /*#__PURE__*/new WeakMap();
|
45
|
+
var _pressed = /*#__PURE__*/new WeakMap();
|
46
|
+
var _isTriggeredByRMB = /*#__PURE__*/new WeakMap();
|
47
|
+
var _dblclick = /*#__PURE__*/new WeakMap();
|
48
|
+
var _autoresizeTimeout = /*#__PURE__*/new WeakMap();
|
49
|
+
var _columnWidthsMap = /*#__PURE__*/new WeakMap();
|
38
50
|
var _config = /*#__PURE__*/new WeakMap();
|
39
51
|
var _onMapInit = /*#__PURE__*/new WeakSet();
|
40
52
|
var _onMouseOver = /*#__PURE__*/new WeakSet();
|
@@ -114,66 +126,110 @@ export class ManualColumnResize extends BasePlugin {
|
|
114
126
|
* @private
|
115
127
|
*/
|
116
128
|
_classPrivateMethodInitSpec(this, _onMapInit);
|
117
|
-
|
129
|
+
_classPrivateFieldInitSpec(this, _currentTH, {
|
130
|
+
writable: true,
|
131
|
+
value: null
|
132
|
+
});
|
118
133
|
/**
|
119
134
|
* @type {number}
|
120
135
|
*/
|
121
|
-
|
136
|
+
_classPrivateFieldInitSpec(this, _currentCol, {
|
137
|
+
writable: true,
|
138
|
+
value: null
|
139
|
+
});
|
122
140
|
/**
|
123
141
|
* @type {number[]}
|
124
142
|
*/
|
125
|
-
|
143
|
+
_classPrivateFieldInitSpec(this, _selectedCols, {
|
144
|
+
writable: true,
|
145
|
+
value: []
|
146
|
+
});
|
126
147
|
/**
|
127
148
|
* @type {number}
|
128
149
|
*/
|
129
|
-
|
150
|
+
_classPrivateFieldInitSpec(this, _currentWidth, {
|
151
|
+
writable: true,
|
152
|
+
value: null
|
153
|
+
});
|
130
154
|
/**
|
131
155
|
* @type {number}
|
132
156
|
*/
|
133
|
-
|
157
|
+
_classPrivateFieldInitSpec(this, _newSize, {
|
158
|
+
writable: true,
|
159
|
+
value: null
|
160
|
+
});
|
134
161
|
/**
|
135
162
|
* @type {number}
|
136
163
|
*/
|
137
|
-
|
164
|
+
_classPrivateFieldInitSpec(this, _startY, {
|
165
|
+
writable: true,
|
166
|
+
value: null
|
167
|
+
});
|
138
168
|
/**
|
139
169
|
* @type {number}
|
140
170
|
*/
|
141
|
-
|
171
|
+
_classPrivateFieldInitSpec(this, _startWidth, {
|
172
|
+
writable: true,
|
173
|
+
value: null
|
174
|
+
});
|
142
175
|
/**
|
143
176
|
* @type {number}
|
144
177
|
*/
|
145
|
-
|
178
|
+
_classPrivateFieldInitSpec(this, _startOffset, {
|
179
|
+
writable: true,
|
180
|
+
value: null
|
181
|
+
});
|
146
182
|
/**
|
147
183
|
* @type {HTMLElement}
|
148
184
|
*/
|
149
|
-
|
185
|
+
_classPrivateFieldInitSpec(this, _handle, {
|
186
|
+
writable: true,
|
187
|
+
value: this.hot.rootDocument.createElement('DIV')
|
188
|
+
});
|
150
189
|
/**
|
151
190
|
* @type {HTMLElement}
|
152
191
|
*/
|
153
|
-
|
192
|
+
_classPrivateFieldInitSpec(this, _guide, {
|
193
|
+
writable: true,
|
194
|
+
value: this.hot.rootDocument.createElement('DIV')
|
195
|
+
});
|
154
196
|
/**
|
155
197
|
* @type {boolean}
|
156
198
|
*/
|
157
|
-
|
199
|
+
_classPrivateFieldInitSpec(this, _pressed, {
|
200
|
+
writable: true,
|
201
|
+
value: null
|
202
|
+
});
|
158
203
|
/**
|
159
204
|
* @type {boolean}
|
160
205
|
*/
|
161
|
-
|
206
|
+
_classPrivateFieldInitSpec(this, _isTriggeredByRMB, {
|
207
|
+
writable: true,
|
208
|
+
value: false
|
209
|
+
});
|
162
210
|
/**
|
163
211
|
* @type {number}
|
164
212
|
*/
|
165
|
-
|
213
|
+
_classPrivateFieldInitSpec(this, _dblclick, {
|
214
|
+
writable: true,
|
215
|
+
value: 0
|
216
|
+
});
|
166
217
|
/**
|
167
218
|
* @type {number}
|
168
219
|
*/
|
169
|
-
|
220
|
+
_classPrivateFieldInitSpec(this, _autoresizeTimeout, {
|
221
|
+
writable: true,
|
222
|
+
value: null
|
223
|
+
});
|
170
224
|
/**
|
171
225
|
* PhysicalIndexToValueMap to keep and track widths for physical column indexes.
|
172
226
|
*
|
173
|
-
* @private
|
174
227
|
* @type {PhysicalIndexToValueMap}
|
175
228
|
*/
|
176
|
-
|
229
|
+
_classPrivateFieldInitSpec(this, _columnWidthsMap, {
|
230
|
+
writable: true,
|
231
|
+
value: void 0
|
232
|
+
});
|
177
233
|
/**
|
178
234
|
* Private pool to save configuration from updateSettings.
|
179
235
|
*
|
@@ -183,8 +239,8 @@ export class ManualColumnResize extends BasePlugin {
|
|
183
239
|
writable: true,
|
184
240
|
value: void 0
|
185
241
|
});
|
186
|
-
addClass(this
|
187
|
-
addClass(this
|
242
|
+
addClass(_classPrivateFieldGet(this, _handle), 'manualColumnResizer');
|
243
|
+
addClass(_classPrivateFieldGet(this, _guide), 'manualColumnResizerGuide');
|
188
244
|
}
|
189
245
|
|
190
246
|
/**
|
@@ -212,9 +268,9 @@ export class ManualColumnResize extends BasePlugin {
|
|
212
268
|
if (this.enabled) {
|
213
269
|
return;
|
214
270
|
}
|
215
|
-
this
|
216
|
-
this.
|
217
|
-
this.hot.columnIndexMapper.registerMap(this.pluginName, this
|
271
|
+
_classPrivateFieldSet(this, _columnWidthsMap, new IndexToValueMap());
|
272
|
+
_classPrivateFieldGet(this, _columnWidthsMap).addLocalHook('init', () => _classPrivateMethodGet(this, _onMapInit, _onMapInit2).call(this));
|
273
|
+
this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(this, _columnWidthsMap));
|
218
274
|
this.addHook('modifyColWidth', (width, col) => _classPrivateMethodGet(this, _onModifyColWidth, _onModifyColWidth2).call(this, width, col));
|
219
275
|
this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _classPrivateMethodGet(this, _onBeforeStretchingColumnWidth, _onBeforeStretchingColumnWidth2).call(this, stretchedWidth, column));
|
220
276
|
this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _classPrivateMethodGet(this, _onBeforeColumnResize, _onBeforeColumnResize2).call(this, newSize, column, isDoubleClick));
|
@@ -238,7 +294,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
238
294
|
* Disables the plugin functionality for this Handsontable instance.
|
239
295
|
*/
|
240
296
|
disablePlugin() {
|
241
|
-
_classPrivateFieldSet(this, _config, this.
|
297
|
+
_classPrivateFieldSet(this, _config, _classPrivateFieldGet(this, _columnWidthsMap).getValues());
|
242
298
|
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
243
299
|
super.disablePlugin();
|
244
300
|
}
|
@@ -249,7 +305,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
249
305
|
* @fires Hooks#persistentStateSave
|
250
306
|
*/
|
251
307
|
saveManualColumnWidths() {
|
252
|
-
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, this.
|
308
|
+
this.hot.runHooks('persistentStateSave', PERSISTENT_STATE_KEY, _classPrivateFieldGet(this, _columnWidthsMap).getValues());
|
253
309
|
}
|
254
310
|
|
255
311
|
/**
|
@@ -274,7 +330,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
274
330
|
setManualSize(column, width) {
|
275
331
|
const newWidth = Math.max(width, 20);
|
276
332
|
const physicalColumn = this.hot.toPhysicalColumn(column);
|
277
|
-
this.
|
333
|
+
_classPrivateFieldGet(this, _columnWidthsMap).setValueAtIndex(physicalColumn, newWidth);
|
278
334
|
return newWidth;
|
279
335
|
}
|
280
336
|
|
@@ -285,7 +341,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
285
341
|
*/
|
286
342
|
clearManualSize(column) {
|
287
343
|
const physicalColumn = this.hot.toPhysicalColumn(column);
|
288
|
-
this.
|
344
|
+
_classPrivateFieldGet(this, _columnWidthsMap).setValueAtIndex(physicalColumn, null);
|
289
345
|
}
|
290
346
|
/**
|
291
347
|
* Set the resize handle position.
|
@@ -297,34 +353,34 @@ export class ManualColumnResize extends BasePlugin {
|
|
297
353
|
if (!TH.parentNode) {
|
298
354
|
return;
|
299
355
|
}
|
300
|
-
this
|
356
|
+
_classPrivateFieldSet(this, _currentTH, TH);
|
301
357
|
const {
|
302
358
|
_wt: wt
|
303
359
|
} = this.hot.view;
|
304
|
-
const cellCoords = wt.wtTable.getCoords(this
|
360
|
+
const cellCoords = wt.wtTable.getCoords(_classPrivateFieldGet(this, _currentTH));
|
305
361
|
const col = cellCoords.col;
|
306
362
|
|
307
363
|
// Ignore column headers.
|
308
364
|
if (col < 0) {
|
309
365
|
return;
|
310
366
|
}
|
311
|
-
const headerHeight = outerHeight(this
|
312
|
-
const box = this.
|
367
|
+
const headerHeight = outerHeight(_classPrivateFieldGet(this, _currentTH));
|
368
|
+
const box = _classPrivateFieldGet(this, _currentTH).getBoundingClientRect();
|
313
369
|
// Read "fixedColumnsStart" through the Walkontable as in that context, the fixed columns
|
314
370
|
// are modified (reduced by the number of hidden columns) by TableView module.
|
315
371
|
const fixedColumn = col < wt.getSetting('fixedColumnsStart');
|
316
372
|
let relativeHeaderPosition;
|
317
373
|
if (fixedColumn) {
|
318
|
-
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(this
|
374
|
+
relativeHeaderPosition = wt.wtOverlays.topInlineStartCornerOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
319
375
|
}
|
320
376
|
|
321
377
|
// If the TH is not a child of the top-left overlay, recalculate using
|
322
378
|
// the top overlay - as this overlay contains the rest of the headers.
|
323
379
|
if (!relativeHeaderPosition) {
|
324
|
-
relativeHeaderPosition = wt.wtOverlays.topOverlay.getRelativeCellPosition(this
|
380
|
+
relativeHeaderPosition = wt.wtOverlays.topOverlay.getRelativeCellPosition(_classPrivateFieldGet(this, _currentTH), cellCoords.row, cellCoords.col);
|
325
381
|
}
|
326
|
-
this
|
327
|
-
this
|
382
|
+
_classPrivateFieldSet(this, _currentCol, this.hot.columnIndexMapper.getVisualFromRenderableIndex(col));
|
383
|
+
_classPrivateFieldSet(this, _selectedCols, []);
|
328
384
|
const isFullColumnSelected = this.hot.selection.isSelectedByCorner() || this.hot.selection.isSelectedByColumnHeader();
|
329
385
|
if (this.hot.selection.isSelected() && isFullColumnSelected) {
|
330
386
|
const selectionRanges = this.hot.getSelectedRange();
|
@@ -334,23 +390,23 @@ export class ManualColumnResize extends BasePlugin {
|
|
334
390
|
|
335
391
|
// Add every selected column for resize action.
|
336
392
|
rangeEach(fromColumn, toColumn, columnIndex => {
|
337
|
-
if (!this.
|
338
|
-
this.
|
393
|
+
if (!_classPrivateFieldGet(this, _selectedCols).includes(columnIndex)) {
|
394
|
+
_classPrivateFieldGet(this, _selectedCols).push(columnIndex);
|
339
395
|
}
|
340
396
|
});
|
341
397
|
});
|
342
398
|
}
|
343
399
|
|
344
400
|
// Resizing element beyond the current selection (also when there is no selection).
|
345
|
-
if (!this.
|
346
|
-
this
|
401
|
+
if (!_classPrivateFieldGet(this, _selectedCols).includes(_classPrivateFieldGet(this, _currentCol))) {
|
402
|
+
_classPrivateFieldSet(this, _selectedCols, [_classPrivateFieldGet(this, _currentCol)]);
|
347
403
|
}
|
348
|
-
this
|
349
|
-
this
|
350
|
-
this.
|
351
|
-
this.
|
352
|
-
this.
|
353
|
-
this.hot.rootElement.appendChild(this
|
404
|
+
_classPrivateFieldSet(this, _startOffset, relativeHeaderPosition.start - 6);
|
405
|
+
_classPrivateFieldSet(this, _startWidth, parseInt(box.width, 10));
|
406
|
+
_classPrivateFieldGet(this, _handle).style.top = `${relativeHeaderPosition.top}px`;
|
407
|
+
_classPrivateFieldGet(this, _handle).style[this.inlineDir] = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _startWidth)}px`;
|
408
|
+
_classPrivateFieldGet(this, _handle).style.height = `${headerHeight}px`;
|
409
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _handle));
|
354
410
|
}
|
355
411
|
|
356
412
|
/**
|
@@ -359,7 +415,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
359
415
|
* @private
|
360
416
|
*/
|
361
417
|
refreshHandlePosition() {
|
362
|
-
this.
|
418
|
+
_classPrivateFieldGet(this, _handle).style[this.inlineDir] = `${_classPrivateFieldGet(this, _startOffset) + _classPrivateFieldGet(this, _currentWidth)}px`;
|
363
419
|
}
|
364
420
|
|
365
421
|
/**
|
@@ -368,15 +424,15 @@ export class ManualColumnResize extends BasePlugin {
|
|
368
424
|
* @private
|
369
425
|
*/
|
370
426
|
setupGuidePosition() {
|
371
|
-
const handleHeight = parseInt(outerHeight(this
|
372
|
-
const handleBottomPosition = parseInt(this.
|
427
|
+
const handleHeight = parseInt(outerHeight(_classPrivateFieldGet(this, _handle)), 10);
|
428
|
+
const handleBottomPosition = parseInt(_classPrivateFieldGet(this, _handle).style.top, 10) + handleHeight;
|
373
429
|
const maximumVisibleElementHeight = parseInt(this.hot.view.maximumVisibleElementHeight(0), 10);
|
374
|
-
addClass(this
|
375
|
-
addClass(this
|
376
|
-
this.
|
430
|
+
addClass(_classPrivateFieldGet(this, _handle), 'active');
|
431
|
+
addClass(_classPrivateFieldGet(this, _guide), 'active');
|
432
|
+
_classPrivateFieldGet(this, _guide).style.top = `${handleBottomPosition}px`;
|
377
433
|
this.refreshGuidePosition();
|
378
|
-
this.
|
379
|
-
this.hot.rootElement.appendChild(this
|
434
|
+
_classPrivateFieldGet(this, _guide).style.height = `${maximumVisibleElementHeight - handleHeight}px`;
|
435
|
+
this.hot.rootElement.appendChild(_classPrivateFieldGet(this, _guide));
|
380
436
|
}
|
381
437
|
|
382
438
|
/**
|
@@ -385,7 +441,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
385
441
|
* @private
|
386
442
|
*/
|
387
443
|
refreshGuidePosition() {
|
388
|
-
this.
|
444
|
+
_classPrivateFieldGet(this, _guide).style[this.inlineDir] = _classPrivateFieldGet(this, _handle).style[this.inlineDir];
|
389
445
|
}
|
390
446
|
|
391
447
|
/**
|
@@ -394,8 +450,8 @@ export class ManualColumnResize extends BasePlugin {
|
|
394
450
|
* @private
|
395
451
|
*/
|
396
452
|
hideHandleAndGuide() {
|
397
|
-
removeClass(this
|
398
|
-
removeClass(this
|
453
|
+
removeClass(_classPrivateFieldGet(this, _handle), 'active');
|
454
|
+
removeClass(_classPrivateFieldGet(this, _guide), 'active');
|
399
455
|
}
|
400
456
|
|
401
457
|
/**
|
@@ -439,37 +495,37 @@ export class ManualColumnResize extends BasePlugin {
|
|
439
495
|
this.hot.view.adjustElementsSize(true);
|
440
496
|
};
|
441
497
|
const resize = (column, forceRender) => {
|
442
|
-
const hookNewSize = this.hot.runHooks('beforeColumnResize', this
|
498
|
+
const hookNewSize = this.hot.runHooks('beforeColumnResize', _classPrivateFieldGet(this, _newSize), column, true);
|
443
499
|
if (hookNewSize !== undefined) {
|
444
|
-
this
|
500
|
+
_classPrivateFieldSet(this, _newSize, hookNewSize);
|
445
501
|
}
|
446
502
|
if (this.hot.getSettings().stretchH === 'all') {
|
447
503
|
this.clearManualSize(column);
|
448
504
|
} else {
|
449
|
-
this.setManualSize(column, this
|
505
|
+
this.setManualSize(column, _classPrivateFieldGet(this, _newSize)); // double click sets by auto row size plugin
|
450
506
|
}
|
451
507
|
|
452
508
|
this.saveManualColumnWidths();
|
453
|
-
this.hot.runHooks('afterColumnResize', this
|
509
|
+
this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(this, _newSize), column, true);
|
454
510
|
if (forceRender) {
|
455
511
|
render();
|
456
512
|
}
|
457
513
|
};
|
458
|
-
if (this
|
459
|
-
const selectedColsLength = this.
|
514
|
+
if (_classPrivateFieldGet(this, _dblclick) >= 2) {
|
515
|
+
const selectedColsLength = _classPrivateFieldGet(this, _selectedCols).length;
|
460
516
|
if (selectedColsLength > 1) {
|
461
|
-
arrayEach(this
|
517
|
+
arrayEach(_classPrivateFieldGet(this, _selectedCols), selectedCol => {
|
462
518
|
resize(selectedCol);
|
463
519
|
});
|
464
520
|
render();
|
465
521
|
} else {
|
466
|
-
arrayEach(this
|
522
|
+
arrayEach(_classPrivateFieldGet(this, _selectedCols), selectedCol => {
|
467
523
|
resize(selectedCol, true);
|
468
524
|
});
|
469
525
|
}
|
470
526
|
}
|
471
|
-
this
|
472
|
-
this
|
527
|
+
_classPrivateFieldSet(this, _dblclick, 0);
|
528
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, null);
|
473
529
|
}
|
474
530
|
/**
|
475
531
|
* Binds the mouse events.
|
@@ -485,7 +541,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
485
541
|
this.eventManager.addEventListener(rootElement, 'mousedown', e => _classPrivateMethodGet(this, _onMouseDown, _onMouseDown2).call(this, e));
|
486
542
|
this.eventManager.addEventListener(rootWindow, 'mousemove', e => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, e));
|
487
543
|
this.eventManager.addEventListener(rootWindow, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
488
|
-
this.eventManager.addEventListener(this
|
544
|
+
this.eventManager.addEventListener(_classPrivateFieldGet(this, _handle), 'contextmenu', () => _classPrivateMethodGet(this, _onContextMenu, _onContextMenu2).call(this));
|
489
545
|
}
|
490
546
|
/**
|
491
547
|
* Destroys the plugin instance.
|
@@ -500,20 +556,20 @@ function _onMapInit2() {
|
|
500
556
|
if (typeof loadedManualColumnWidths !== 'undefined') {
|
501
557
|
this.hot.batchExecution(() => {
|
502
558
|
loadedManualColumnWidths.forEach((width, physicalIndex) => {
|
503
|
-
this.
|
559
|
+
_classPrivateFieldGet(this, _columnWidthsMap).setValueAtIndex(physicalIndex, width);
|
504
560
|
});
|
505
561
|
}, true);
|
506
562
|
} else if (Array.isArray(initialSetting)) {
|
507
563
|
this.hot.batchExecution(() => {
|
508
564
|
initialSetting.forEach((width, physicalIndex) => {
|
509
|
-
this.
|
565
|
+
_classPrivateFieldGet(this, _columnWidthsMap).setValueAtIndex(physicalIndex, width);
|
510
566
|
});
|
511
567
|
}, true);
|
512
568
|
_classPrivateFieldSet(this, _config, initialSetting);
|
513
569
|
} else if (initialSetting === true && Array.isArray(_classPrivateFieldGet(this, _config))) {
|
514
570
|
this.hot.batchExecution(() => {
|
515
571
|
_classPrivateFieldGet(this, _config).forEach((width, physicalIndex) => {
|
516
|
-
this.
|
572
|
+
_classPrivateFieldGet(this, _columnWidthsMap).setValueAtIndex(physicalIndex, width);
|
517
573
|
});
|
518
574
|
}, true);
|
519
575
|
}
|
@@ -526,7 +582,7 @@ function _onMouseOver2(event) {
|
|
526
582
|
}
|
527
583
|
|
528
584
|
// A "mouseover" action is triggered right after executing "contextmenu" event. It should be ignored.
|
529
|
-
if (this
|
585
|
+
if (_classPrivateFieldGet(this, _isTriggeredByRMB) === true) {
|
530
586
|
return;
|
531
587
|
}
|
532
588
|
if (this.checkIfColumnHeader(event.target)) {
|
@@ -536,7 +592,7 @@ function _onMouseOver2(event) {
|
|
536
592
|
}
|
537
593
|
const colspan = th.getAttribute('colspan');
|
538
594
|
if (th && (colspan === null || colspan === '1')) {
|
539
|
-
if (!this
|
595
|
+
if (!_classPrivateFieldGet(this, _pressed)) {
|
540
596
|
this.setupHandlePosition(th);
|
541
597
|
}
|
542
598
|
}
|
@@ -544,24 +600,24 @@ function _onMouseOver2(event) {
|
|
544
600
|
}
|
545
601
|
function _onMouseDown2(event) {
|
546
602
|
if (hasClass(event.target, 'manualColumnResizer')) {
|
547
|
-
this.setupHandlePosition(this
|
603
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
548
604
|
this.setupGuidePosition();
|
549
|
-
this
|
550
|
-
if (this
|
551
|
-
this
|
552
|
-
this.hot._registerTimeout(this
|
605
|
+
_classPrivateFieldSet(this, _pressed, true);
|
606
|
+
if (_classPrivateFieldGet(this, _autoresizeTimeout) === null) {
|
607
|
+
_classPrivateFieldSet(this, _autoresizeTimeout, setTimeout(() => this.afterMouseDownTimeout(), 500));
|
608
|
+
this.hot._registerTimeout(_classPrivateFieldGet(this, _autoresizeTimeout));
|
553
609
|
}
|
554
|
-
this
|
610
|
+
_classPrivateFieldSet(this, _dblclick, _classPrivateFieldGet(this, _dblclick) + 1);
|
555
611
|
this.startX = event.pageX;
|
556
|
-
this
|
612
|
+
_classPrivateFieldSet(this, _newSize, _classPrivateFieldGet(this, _startWidth));
|
557
613
|
}
|
558
614
|
}
|
559
615
|
function _onMouseMove2(event) {
|
560
|
-
if (this
|
616
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
561
617
|
const change = (event.pageX - this.startX) * this.hot.getDirectionFactor();
|
562
|
-
this
|
563
|
-
arrayEach(this
|
564
|
-
this
|
618
|
+
_classPrivateFieldSet(this, _currentWidth, _classPrivateFieldGet(this, _startWidth) + change);
|
619
|
+
arrayEach(_classPrivateFieldGet(this, _selectedCols), selectedCol => {
|
620
|
+
_classPrivateFieldSet(this, _newSize, this.setManualSize(selectedCol, _classPrivateFieldGet(this, _currentWidth)));
|
565
621
|
});
|
566
622
|
this.refreshHandlePosition();
|
567
623
|
this.refreshGuidePosition();
|
@@ -574,50 +630,50 @@ function _onMouseUp2() {
|
|
574
630
|
this.hot.view.adjustElementsSize(true);
|
575
631
|
};
|
576
632
|
const resize = (column, forceRender) => {
|
577
|
-
this.hot.runHooks('beforeColumnResize', this
|
633
|
+
this.hot.runHooks('beforeColumnResize', _classPrivateFieldGet(this, _newSize), column, false);
|
578
634
|
if (forceRender) {
|
579
635
|
render();
|
580
636
|
}
|
581
637
|
this.saveManualColumnWidths();
|
582
|
-
this.hot.runHooks('afterColumnResize', this
|
638
|
+
this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(this, _newSize), column, false);
|
583
639
|
};
|
584
|
-
if (this
|
640
|
+
if (_classPrivateFieldGet(this, _pressed)) {
|
585
641
|
this.hideHandleAndGuide();
|
586
|
-
this
|
587
|
-
if (this
|
588
|
-
const selectedColsLength = this.
|
642
|
+
_classPrivateFieldSet(this, _pressed, false);
|
643
|
+
if (_classPrivateFieldGet(this, _newSize) !== _classPrivateFieldGet(this, _startWidth)) {
|
644
|
+
const selectedColsLength = _classPrivateFieldGet(this, _selectedCols).length;
|
589
645
|
if (selectedColsLength > 1) {
|
590
|
-
arrayEach(this
|
646
|
+
arrayEach(_classPrivateFieldGet(this, _selectedCols), selectedCol => {
|
591
647
|
resize(selectedCol);
|
592
648
|
});
|
593
649
|
render();
|
594
650
|
} else {
|
595
|
-
arrayEach(this
|
651
|
+
arrayEach(_classPrivateFieldGet(this, _selectedCols), selectedCol => {
|
596
652
|
resize(selectedCol, true);
|
597
653
|
});
|
598
654
|
}
|
599
655
|
}
|
600
|
-
this.setupHandlePosition(this
|
656
|
+
this.setupHandlePosition(_classPrivateFieldGet(this, _currentTH));
|
601
657
|
}
|
602
658
|
}
|
603
659
|
function _onContextMenu2() {
|
604
660
|
this.hideHandleAndGuide();
|
605
|
-
this.hot.rootElement.removeChild(this
|
606
|
-
this.hot.rootElement.removeChild(this
|
607
|
-
this
|
608
|
-
this
|
661
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _handle));
|
662
|
+
this.hot.rootElement.removeChild(_classPrivateFieldGet(this, _guide));
|
663
|
+
_classPrivateFieldSet(this, _pressed, false);
|
664
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, true);
|
609
665
|
|
610
666
|
// There is thrown "mouseover" event right after opening a context menu. This flag inform that handle
|
611
667
|
// shouldn't be drawn just after removing it.
|
612
668
|
this.hot._registerImmediate(() => {
|
613
|
-
this
|
669
|
+
_classPrivateFieldSet(this, _isTriggeredByRMB, false);
|
614
670
|
});
|
615
671
|
}
|
616
672
|
function _onModifyColWidth2(width, column) {
|
617
673
|
let newWidth = width;
|
618
674
|
if (this.enabled) {
|
619
675
|
const physicalColumn = this.hot.toPhysicalColumn(column);
|
620
|
-
const columnWidth = this.
|
676
|
+
const columnWidth = _classPrivateFieldGet(this, _columnWidthsMap).getValueAtIndex(physicalColumn);
|
621
677
|
if (this.hot.getSettings()[PLUGIN_KEY] && columnWidth) {
|
622
678
|
newWidth = columnWidth;
|
623
679
|
}
|
@@ -625,7 +681,7 @@ function _onModifyColWidth2(width, column) {
|
|
625
681
|
return newWidth;
|
626
682
|
}
|
627
683
|
function _onBeforeStretchingColumnWidth2(stretchedWidth, column) {
|
628
|
-
let width = this.
|
684
|
+
let width = _classPrivateFieldGet(this, _columnWidthsMap).getValueAtIndex(column);
|
629
685
|
if (width === null) {
|
630
686
|
width = stretchedWidth;
|
631
687
|
}
|