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