handsontable 0.0.0-next-a2cc849-20240208 → 0.0.0-next-fd66c90-20240209
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
- package/3rdparty/walkontable/src/cell/range.js +0 -12
- package/3rdparty/walkontable/src/cell/range.mjs +0 -12
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +1 -4
- package/core/viewportScroll/index.mjs +1 -4
- package/core.js +0 -14
- package/core.mjs +0 -14
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1022 -1304
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +151 -151
- package/dist/handsontable.js +1024 -1306
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +32 -32
- package/editorManager.js +8 -12
- package/editorManager.mjs +8 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -1
- package/pluginHooks.js +1 -43
- package/pluginHooks.mjs +1 -43
- package/plugins/collapsibleColumns/collapsibleColumns.js +1 -7
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -7
- package/plugins/columnSorting/columnSorting.js +0 -6
- package/plugins/columnSorting/columnSorting.mjs +0 -6
- package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
- package/plugins/mergeCells/mergeCells.js +1 -3
- package/plugins/mergeCells/mergeCells.mjs +1 -3
- package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
- package/plugins/nestedHeaders/nestedHeaders.js +0 -1
- package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
- package/plugins/nestedRows/nestedRows.js +1 -7
- package/plugins/nestedRows/nestedRows.mjs +1 -7
- package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- package/selection/selection.js +30 -156
- package/selection/selection.mjs +29 -155
- package/selection/transformation.js +27 -18
- package/selection/transformation.mjs +27 -18
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +3 -18
- package/shortcutContexts/commands/editor/open.mjs +3 -18
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
- package/shortcutContexts/grid.js +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
package/selection/selection.mjs
CHANGED
@@ -24,9 +24,6 @@ import { A11Y_SELECTED } from "../helpers/a11y.mjs";
|
|
24
24
|
* @class Selection
|
25
25
|
* @util
|
26
26
|
*/
|
27
|
-
var _transformation = /*#__PURE__*/new WeakMap();
|
28
|
-
var _focusTransformation = /*#__PURE__*/new WeakMap();
|
29
|
-
var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
|
30
27
|
var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
|
31
28
|
var _selectionSource = /*#__PURE__*/new WeakMap();
|
32
29
|
var _expectedLayersCount = /*#__PURE__*/new WeakMap();
|
@@ -66,23 +63,11 @@ class Selection {
|
|
66
63
|
*/
|
67
64
|
_defineProperty(this, "highlight", void 0);
|
68
65
|
/**
|
69
|
-
* The module for modifying coordinates
|
66
|
+
* The module for modifying coordinates.
|
70
67
|
*
|
71
68
|
* @type {Transformation}
|
72
69
|
*/
|
73
|
-
|
74
|
-
writable: true,
|
75
|
-
value: void 0
|
76
|
-
});
|
77
|
-
/**
|
78
|
-
* The module for modifying coordinates of the focus selection.
|
79
|
-
*
|
80
|
-
* @type {Transformation}
|
81
|
-
*/
|
82
|
-
_classPrivateFieldInitSpec(this, _focusTransformation, {
|
83
|
-
writable: true,
|
84
|
-
value: void 0
|
85
|
-
});
|
70
|
+
_defineProperty(this, "transformation", void 0);
|
86
71
|
/**
|
87
72
|
* The collection of the selection layer levels where the whole row was selected using the row header or
|
88
73
|
* the corner header.
|
@@ -97,15 +82,6 @@ class Selection {
|
|
97
82
|
* @type {Set<number>}
|
98
83
|
*/
|
99
84
|
_defineProperty(this, "selectedByColumnHeader", new Set());
|
100
|
-
/**
|
101
|
-
* The flag which determines if the focus selection was changed.
|
102
|
-
*
|
103
|
-
* @type {boolean}
|
104
|
-
*/
|
105
|
-
_classPrivateFieldInitSpec(this, _isFocusSelectionChanged, {
|
106
|
-
writable: true,
|
107
|
-
value: false
|
108
|
-
});
|
109
85
|
/**
|
110
86
|
* When sets disable highlighting the headers even when the logical coordinates points on them.
|
111
87
|
*
|
@@ -156,100 +132,71 @@ class Selection {
|
|
156
132
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
157
133
|
createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
|
158
134
|
});
|
159
|
-
|
135
|
+
this.transformation = new Transformation(this.selectedRange, {
|
160
136
|
rowIndexMapper: this.tableProps.rowIndexMapper,
|
161
137
|
columnIndexMapper: this.tableProps.columnIndexMapper,
|
162
138
|
countRenderableRows: () => this.tableProps.countRenderableRows(),
|
163
139
|
countRenderableColumns: () => this.tableProps.countRenderableColumns(),
|
140
|
+
countRowHeaders: () => this.tableProps.countRowHeaders(),
|
141
|
+
countColHeaders: () => this.tableProps.countColHeaders(),
|
164
142
|
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
165
143
|
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
166
144
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
145
|
+
navigableHeaders: () => settings.navigableHeaders,
|
167
146
|
fixedRowsBottom: () => settings.fixedRowsBottom,
|
168
147
|
minSpareRows: () => settings.minSpareRows,
|
169
148
|
minSpareCols: () => settings.minSpareCols,
|
170
149
|
autoWrapRow: () => settings.autoWrapRow,
|
171
150
|
autoWrapCol: () => settings.autoWrapCol
|
172
|
-
})
|
173
|
-
|
174
|
-
rowIndexMapper: this.tableProps.rowIndexMapper,
|
175
|
-
columnIndexMapper: this.tableProps.columnIndexMapper,
|
176
|
-
countRenderableRows: () => {
|
177
|
-
const range = this.selectedRange.current();
|
178
|
-
return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
|
179
|
-
},
|
180
|
-
countRenderableColumns: () => {
|
181
|
-
const range = this.selectedRange.current();
|
182
|
-
return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
|
183
|
-
},
|
184
|
-
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
185
|
-
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
186
|
-
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
187
|
-
fixedRowsBottom: () => 0,
|
188
|
-
minSpareRows: () => 0,
|
189
|
-
minSpareCols: () => 0,
|
190
|
-
autoWrapRow: () => true,
|
191
|
-
autoWrapCol: () => true
|
192
|
-
}));
|
193
|
-
_classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformStart', function () {
|
151
|
+
});
|
152
|
+
this.transformation.addLocalHook('beforeTransformStart', function () {
|
194
153
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
195
154
|
args[_key] = arguments[_key];
|
196
155
|
}
|
197
156
|
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
198
157
|
});
|
199
|
-
|
158
|
+
this.transformation.addLocalHook('afterTransformStart', function () {
|
200
159
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
201
160
|
args[_key2] = arguments[_key2];
|
202
161
|
}
|
203
162
|
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
204
163
|
});
|
205
|
-
|
164
|
+
this.transformation.addLocalHook('beforeTransformEnd', function () {
|
206
165
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
207
166
|
args[_key3] = arguments[_key3];
|
208
167
|
}
|
209
168
|
return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
|
210
169
|
});
|
211
|
-
|
170
|
+
this.transformation.addLocalHook('afterTransformEnd', function () {
|
212
171
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
213
172
|
args[_key4] = arguments[_key4];
|
214
173
|
}
|
215
174
|
return _this.runLocalHooks('afterModifyTransformEnd', ...args);
|
216
175
|
});
|
217
|
-
|
176
|
+
this.transformation.addLocalHook('insertRowRequire', function () {
|
218
177
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
219
178
|
args[_key5] = arguments[_key5];
|
220
179
|
}
|
221
180
|
return _this.runLocalHooks('insertRowRequire', ...args);
|
222
181
|
});
|
223
|
-
|
182
|
+
this.transformation.addLocalHook('insertColRequire', function () {
|
224
183
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
225
184
|
args[_key6] = arguments[_key6];
|
226
185
|
}
|
227
186
|
return _this.runLocalHooks('insertColRequire', ...args);
|
228
187
|
});
|
229
|
-
|
188
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
230
189
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
231
190
|
args[_key7] = arguments[_key7];
|
232
191
|
}
|
233
192
|
return _this.runLocalHooks('beforeRowWrap', ...args);
|
234
193
|
});
|
235
|
-
|
194
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
236
195
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
237
196
|
args[_key8] = arguments[_key8];
|
238
197
|
}
|
239
198
|
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
240
199
|
});
|
241
|
-
_classPrivateFieldGet(this, _focusTransformation).addLocalHook('beforeTransformStart', function () {
|
242
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
243
|
-
args[_key9] = arguments[_key9];
|
244
|
-
}
|
245
|
-
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
246
|
-
});
|
247
|
-
_classPrivateFieldGet(this, _focusTransformation).addLocalHook('afterTransformStart', function () {
|
248
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
249
|
-
args[_key10] = arguments[_key10];
|
250
|
-
}
|
251
|
-
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
252
|
-
});
|
253
200
|
}
|
254
201
|
|
255
202
|
/**
|
@@ -340,7 +287,6 @@ class Selection {
|
|
340
287
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
341
288
|
// should be handled by next methods.
|
342
289
|
const coordsClone = coords.clone();
|
343
|
-
_classPrivateFieldSet(this, _isFocusSelectionChanged, false);
|
344
290
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
345
291
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
|
346
292
|
this.selectedRange.clear();
|
@@ -408,7 +354,11 @@ class Selection {
|
|
408
354
|
}
|
409
355
|
}
|
410
356
|
this.runLocalHooks('beforeHighlightSet');
|
411
|
-
this.
|
357
|
+
const focusHighlight = this.highlight.getFocus();
|
358
|
+
focusHighlight.clear();
|
359
|
+
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
360
|
+
focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
361
|
+
}
|
412
362
|
const layerLevel = this.getLayerLevel();
|
413
363
|
|
414
364
|
// If the next layer level is lower than previous then clear all area and header highlights. This is the
|
@@ -496,24 +446,15 @@ class Selection {
|
|
496
446
|
}
|
497
447
|
|
498
448
|
/**
|
499
|
-
*
|
449
|
+
* Returns information if we have a multiselection. This method check multiselection only on the latest layer of
|
450
|
+
* the selection.
|
500
451
|
*
|
501
|
-
* @
|
452
|
+
* @returns {boolean}
|
502
453
|
*/
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
const cellRange = this.selectedRange.current();
|
508
|
-
const focusHighlight = this.highlight.getFocus();
|
509
|
-
focusHighlight.clear();
|
510
|
-
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
511
|
-
focusHighlight.add(coords).commit().syncWith(cellRange);
|
512
|
-
}
|
513
|
-
if (!this.inProgress) {
|
514
|
-
_classPrivateFieldSet(this, _isFocusSelectionChanged, true);
|
515
|
-
this.runLocalHooks('afterSetFocus', coords);
|
516
|
-
}
|
454
|
+
isMultiple() {
|
455
|
+
const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
|
456
|
+
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
457
|
+
return isMultipleListener.value;
|
517
458
|
}
|
518
459
|
|
519
460
|
/**
|
@@ -526,13 +467,7 @@ class Selection {
|
|
526
467
|
*/
|
527
468
|
transformStart(rowDelta, colDelta) {
|
528
469
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
529
|
-
|
530
|
-
_classPrivateFieldGet(this, _transformation).setOffsetSize({
|
531
|
-
x: this.tableProps.countRowHeaders(),
|
532
|
-
y: this.tableProps.countColHeaders()
|
533
|
-
});
|
534
|
-
}
|
535
|
-
this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
|
470
|
+
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
|
536
471
|
}
|
537
472
|
|
538
473
|
/**
|
@@ -542,44 +477,7 @@ class Selection {
|
|
542
477
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
543
478
|
*/
|
544
479
|
transformEnd(rowDelta, colDelta) {
|
545
|
-
|
546
|
-
_classPrivateFieldGet(this, _transformation).setOffsetSize({
|
547
|
-
x: this.tableProps.countRowHeaders(),
|
548
|
-
y: this.tableProps.countColHeaders()
|
549
|
-
});
|
550
|
-
}
|
551
|
-
this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
|
552
|
-
}
|
553
|
-
|
554
|
-
/**
|
555
|
-
* Transforms the focus cell selection relative to the current focus position.
|
556
|
-
*
|
557
|
-
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
558
|
-
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
559
|
-
*/
|
560
|
-
transformFocus(rowDelta, colDelta) {
|
561
|
-
const range = this.selectedRange.current();
|
562
|
-
const {
|
563
|
-
row,
|
564
|
-
col
|
565
|
-
} = range.getOuterTopStartCorner();
|
566
|
-
const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
|
567
|
-
const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
|
568
|
-
if (range.highlight.isHeader()) {
|
569
|
-
// for header focus selection calculate the new coords based on the selection including headers
|
570
|
-
_classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
|
571
|
-
x: col < 0 ? Math.abs(col) : -columnsInRange,
|
572
|
-
y: row < 0 ? Math.abs(row) : -rowsInRange
|
573
|
-
});
|
574
|
-
} else {
|
575
|
-
// for focus selection in cells calculate the new coords only based on the selected cells
|
576
|
-
_classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
|
577
|
-
x: col < 0 ? 0 : -columnsInRange,
|
578
|
-
y: row < 0 ? 0 : -rowsInRange
|
579
|
-
});
|
580
|
-
}
|
581
|
-
const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
|
582
|
-
this.setRangeFocus(focusCoords.normalize());
|
480
|
+
this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
|
583
481
|
}
|
584
482
|
|
585
483
|
/**
|
@@ -600,30 +498,6 @@ class Selection {
|
|
600
498
|
return !this.selectedRange.isEmpty();
|
601
499
|
}
|
602
500
|
|
603
|
-
/**
|
604
|
-
* Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
|
605
|
-
* the selection.
|
606
|
-
*
|
607
|
-
* @returns {boolean}
|
608
|
-
*/
|
609
|
-
isMultiple() {
|
610
|
-
if (!this.isSelected()) {
|
611
|
-
return false;
|
612
|
-
}
|
613
|
-
const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
|
614
|
-
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
615
|
-
return isMultipleListener.value;
|
616
|
-
}
|
617
|
-
|
618
|
-
/**
|
619
|
-
* Checks if the last selection involves changing the focus cell position only.
|
620
|
-
*
|
621
|
-
* @returns {boolean}
|
622
|
-
*/
|
623
|
-
isFocusSelectionChanged() {
|
624
|
-
return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
|
625
|
-
}
|
626
|
-
|
627
501
|
/**
|
628
502
|
* Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
|
629
503
|
* argument is passed then only that layer will be checked. Otherwise, it checks if any row header
|
@@ -8,9 +8,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
8
8
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
9
9
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
10
10
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
11
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
12
11
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
13
12
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
13
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
14
14
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
15
15
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
16
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; } }
|
@@ -32,6 +32,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
|
|
32
32
|
var _range = /*#__PURE__*/new WeakMap();
|
33
33
|
var _options = /*#__PURE__*/new WeakMap();
|
34
34
|
var _offset = /*#__PURE__*/new WeakMap();
|
35
|
+
var _setOffsetSize = /*#__PURE__*/new WeakSet();
|
35
36
|
var _clampCoords = /*#__PURE__*/new WeakSet();
|
36
37
|
var _getTableSize = /*#__PURE__*/new WeakSet();
|
37
38
|
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
@@ -66,6 +67,13 @@ class Transformation {
|
|
66
67
|
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
67
68
|
*/
|
68
69
|
_classPrivateMethodInitSpec(this, _clampCoords);
|
70
|
+
/**
|
71
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
72
|
+
* is enabled.
|
73
|
+
*
|
74
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
75
|
+
*/
|
76
|
+
_classPrivateMethodInitSpec(this, _setOffsetSize);
|
69
77
|
/**
|
70
78
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
71
79
|
*
|
@@ -113,6 +121,10 @@ class Transformation {
|
|
113
121
|
*/
|
114
122
|
transformStart(rowDelta, colDelta) {
|
115
123
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
124
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
125
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
126
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
127
|
+
});
|
116
128
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
117
129
|
let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
118
130
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
@@ -192,6 +204,10 @@ class Transformation {
|
|
192
204
|
* @returns {CellCoords} Visual coordinates after transformation.
|
193
205
|
*/
|
194
206
|
transformEnd(rowDelta, colDelta) {
|
207
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
208
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
209
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
210
|
+
});
|
195
211
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
196
212
|
const cellRange = _classPrivateFieldGet(this, _range).current();
|
197
213
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
@@ -224,23 +240,16 @@ class Transformation {
|
|
224
240
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
225
241
|
return visualCoords;
|
226
242
|
}
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
y
|
238
|
-
} = _ref;
|
239
|
-
_classPrivateFieldSet(this, _offset, {
|
240
|
-
x,
|
241
|
-
y
|
242
|
-
});
|
243
|
-
}
|
243
|
+
}
|
244
|
+
function _setOffsetSize2(_ref) {
|
245
|
+
let {
|
246
|
+
x,
|
247
|
+
y
|
248
|
+
} = _ref;
|
249
|
+
_classPrivateFieldSet(this, _offset, {
|
250
|
+
x,
|
251
|
+
y
|
252
|
+
});
|
244
253
|
}
|
245
254
|
function _clampCoords2(zeroBasedCoords) {
|
246
255
|
const {
|
@@ -2,9 +2,9 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
3
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
4
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
6
5
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
7
6
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
7
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
8
8
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
9
9
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
10
10
|
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; } }
|
@@ -28,6 +28,7 @@ import localHooks from "./../mixins/localHooks.mjs";
|
|
28
28
|
var _range = /*#__PURE__*/new WeakMap();
|
29
29
|
var _options = /*#__PURE__*/new WeakMap();
|
30
30
|
var _offset = /*#__PURE__*/new WeakMap();
|
31
|
+
var _setOffsetSize = /*#__PURE__*/new WeakSet();
|
31
32
|
var _clampCoords = /*#__PURE__*/new WeakSet();
|
32
33
|
var _getTableSize = /*#__PURE__*/new WeakSet();
|
33
34
|
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
@@ -62,6 +63,13 @@ class Transformation {
|
|
62
63
|
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
63
64
|
*/
|
64
65
|
_classPrivateMethodInitSpec(this, _clampCoords);
|
66
|
+
/**
|
67
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
68
|
+
* is enabled.
|
69
|
+
*
|
70
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
71
|
+
*/
|
72
|
+
_classPrivateMethodInitSpec(this, _setOffsetSize);
|
65
73
|
/**
|
66
74
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
67
75
|
*
|
@@ -109,6 +117,10 @@ class Transformation {
|
|
109
117
|
*/
|
110
118
|
transformStart(rowDelta, colDelta) {
|
111
119
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
120
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
121
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
122
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
123
|
+
});
|
112
124
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
113
125
|
let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
114
126
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
@@ -188,6 +200,10 @@ class Transformation {
|
|
188
200
|
* @returns {CellCoords} Visual coordinates after transformation.
|
189
201
|
*/
|
190
202
|
transformEnd(rowDelta, colDelta) {
|
203
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
204
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
205
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
206
|
+
});
|
191
207
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
192
208
|
const cellRange = _classPrivateFieldGet(this, _range).current();
|
193
209
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
@@ -220,23 +236,16 @@ class Transformation {
|
|
220
236
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
221
237
|
return visualCoords;
|
222
238
|
}
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
y
|
234
|
-
} = _ref;
|
235
|
-
_classPrivateFieldSet(this, _offset, {
|
236
|
-
x,
|
237
|
-
y
|
238
|
-
});
|
239
|
-
}
|
239
|
+
}
|
240
|
+
function _setOffsetSize2(_ref) {
|
241
|
+
let {
|
242
|
+
x,
|
243
|
+
y
|
244
|
+
} = _ref;
|
245
|
+
_classPrivateFieldSet(this, _offset, {
|
246
|
+
x,
|
247
|
+
y
|
248
|
+
});
|
240
249
|
}
|
241
250
|
function _clampCoords2(zeroBasedCoords) {
|
242
251
|
const {
|
@@ -3,9 +3,9 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
const command = exports.command = {
|
5
5
|
name: 'editorCloseAndSave',
|
6
|
-
callback(hot, event) {
|
6
|
+
callback(hot, event, keys) {
|
7
7
|
const editorManager = hot._getEditorManager();
|
8
8
|
editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
|
9
|
-
editorManager.moveSelectionAfterEnter(
|
9
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
10
10
|
}
|
11
11
|
};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
export const command = {
|
2
2
|
name: 'editorCloseAndSave',
|
3
|
-
callback(hot, event) {
|
3
|
+
callback(hot, event, keys) {
|
4
4
|
const editorManager = hot._getEditorManager();
|
5
5
|
editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
|
6
|
-
editorManager.moveSelectionAfterEnter(
|
6
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
7
7
|
}
|
8
8
|
};
|
@@ -6,35 +6,20 @@ const command = exports.command = {
|
|
6
6
|
name: 'editorOpen',
|
7
7
|
callback(hot, event, keys) {
|
8
8
|
const editorManager = hot._getEditorManager();
|
9
|
-
const selectedRange = hot.getSelectedRangeLast();
|
10
9
|
const {
|
11
10
|
highlight
|
12
|
-
} =
|
13
|
-
|
14
|
-
// supports for navigating with enter key when multiple cells are selected
|
15
|
-
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
16
|
-
const settings = hot.getSettings();
|
17
|
-
const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
|
18
|
-
if (keys.includes('shift')) {
|
19
|
-
hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
|
20
|
-
} else {
|
21
|
-
hot.selection.transformFocus(enterMoves.row, enterMoves.col);
|
22
|
-
}
|
23
|
-
return;
|
24
|
-
}
|
11
|
+
} = hot.getSelectedRangeLast();
|
25
12
|
if (highlight.isHeader()) {
|
26
13
|
return;
|
27
14
|
}
|
28
|
-
|
29
|
-
// supports editor opening with enter key
|
30
15
|
if (hot.getSettings().enterBeginsEditing) {
|
31
16
|
if (editorManager.cellProperties.readOnly) {
|
32
|
-
editorManager.moveSelectionAfterEnter(
|
17
|
+
editorManager.moveSelectionAfterEnter();
|
33
18
|
} else {
|
34
19
|
editorManager.openEditor(null, event, true);
|
35
20
|
}
|
36
21
|
} else {
|
37
|
-
editorManager.moveSelectionAfterEnter(
|
22
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
38
23
|
}
|
39
24
|
(0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
|
40
25
|
}
|
@@ -3,35 +3,20 @@ export const command = {
|
|
3
3
|
name: 'editorOpen',
|
4
4
|
callback(hot, event, keys) {
|
5
5
|
const editorManager = hot._getEditorManager();
|
6
|
-
const selectedRange = hot.getSelectedRangeLast();
|
7
6
|
const {
|
8
7
|
highlight
|
9
|
-
} =
|
10
|
-
|
11
|
-
// supports for navigating with enter key when multiple cells are selected
|
12
|
-
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
13
|
-
const settings = hot.getSettings();
|
14
|
-
const enterMoves = typeof settings.enterMoves === 'function' ? settings.enterMoves(event) : settings.enterMoves;
|
15
|
-
if (keys.includes('shift')) {
|
16
|
-
hot.selection.transformFocus(-enterMoves.row, -enterMoves.col);
|
17
|
-
} else {
|
18
|
-
hot.selection.transformFocus(enterMoves.row, enterMoves.col);
|
19
|
-
}
|
20
|
-
return;
|
21
|
-
}
|
8
|
+
} = hot.getSelectedRangeLast();
|
22
9
|
if (highlight.isHeader()) {
|
23
10
|
return;
|
24
11
|
}
|
25
|
-
|
26
|
-
// supports editor opening with enter key
|
27
12
|
if (hot.getSettings().enterBeginsEditing) {
|
28
13
|
if (editorManager.cellProperties.readOnly) {
|
29
|
-
editorManager.moveSelectionAfterEnter(
|
14
|
+
editorManager.moveSelectionAfterEnter();
|
30
15
|
} else {
|
31
16
|
editorManager.openEditor(null, event, true);
|
32
17
|
}
|
33
18
|
} else {
|
34
|
-
editorManager.moveSelectionAfterEnter(
|
19
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
35
20
|
}
|
36
21
|
stopImmediatePropagation(event); // required by HandsontableEditor
|
37
22
|
}
|
@@ -5,12 +5,7 @@ const command = exports.command = {
|
|
5
5
|
name: 'moveCellSelectionInlineEnd',
|
6
6
|
callback(hot, event) {
|
7
7
|
const settings = hot.getSettings();
|
8
|
-
const selectedRange = hot.getSelectedRangeLast();
|
9
8
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
10
|
-
|
11
|
-
hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
|
12
|
-
} else {
|
13
|
-
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
14
|
-
}
|
9
|
+
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
15
10
|
}
|
16
11
|
};
|
@@ -2,12 +2,7 @@ export const command = {
|
|
2
2
|
name: 'moveCellSelectionInlineEnd',
|
3
3
|
callback(hot, event) {
|
4
4
|
const settings = hot.getSettings();
|
5
|
-
const selectedRange = hot.getSelectedRangeLast();
|
6
5
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
7
|
-
|
8
|
-
hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
|
9
|
-
} else {
|
10
|
-
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
11
|
-
}
|
6
|
+
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
12
7
|
}
|
13
8
|
};
|
@@ -5,12 +5,7 @@ const command = exports.command = {
|
|
5
5
|
name: 'moveCellSelectionInlineStart',
|
6
6
|
callback(hot, event) {
|
7
7
|
const settings = hot.getSettings();
|
8
|
-
const selectedRange = hot.getSelectedRangeLast();
|
9
8
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
10
|
-
|
11
|
-
hot.selection.transformFocus(tabMoves.row, tabMoves.col);
|
12
|
-
} else {
|
13
|
-
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
14
|
-
}
|
9
|
+
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
15
10
|
}
|
16
11
|
};
|
@@ -2,12 +2,7 @@ export const command = {
|
|
2
2
|
name: 'moveCellSelectionInlineStart',
|
3
3
|
callback(hot, event) {
|
4
4
|
const settings = hot.getSettings();
|
5
|
-
const selectedRange = hot.getSelectedRangeLast();
|
6
5
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
7
|
-
|
8
|
-
hot.selection.transformFocus(tabMoves.row, tabMoves.col);
|
9
|
-
} else {
|
10
|
-
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
11
|
-
}
|
6
|
+
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
12
7
|
}
|
13
8
|
};
|