handsontable 0.0.0-next-ba17d71-20240207 → 0.0.0-next-a2cc849-20240208
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 +1 -0
- package/3rdparty/walkontable/src/cell/range.js +12 -0
- package/3rdparty/walkontable/src/cell/range.mjs +12 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +4 -1
- package/core/viewportScroll/index.mjs +4 -1
- package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
- package/core.js +14 -0
- package/core.mjs +14 -0
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1304 -1022
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +151 -151
- package/dist/handsontable.js +1306 -1024
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +32 -32
- package/editorManager.js +12 -8
- package/editorManager.mjs +12 -8
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -0
- package/pluginHooks.js +43 -1
- package/pluginHooks.mjs +43 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +7 -1
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +7 -1
- package/plugins/columnSorting/columnSorting.js +6 -0
- package/plugins/columnSorting/columnSorting.mjs +6 -0
- package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
- package/plugins/mergeCells/mergeCells.js +3 -1
- package/plugins/mergeCells/mergeCells.mjs +3 -1
- package/plugins/multiColumnSorting/multiColumnSorting.js +6 -0
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +6 -0
- package/plugins/nestedHeaders/nestedHeaders.js +1 -0
- package/plugins/nestedHeaders/nestedHeaders.mjs +1 -0
- package/plugins/nestedRows/nestedRows.js +7 -1
- package/plugins/nestedRows/nestedRows.mjs +7 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- package/selection/selection.js +156 -30
- package/selection/selection.mjs +155 -29
- package/selection/transformation.js +18 -27
- package/selection/transformation.mjs +18 -27
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +18 -3
- package/shortcutContexts/commands/editor/open.mjs +18 -3
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
- package/shortcutContexts/grid.js +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +2 -1
- package/shortcuts/context.mjs +2 -1
package/selection/selection.mjs
CHANGED
@@ -24,6 +24,9 @@ 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();
|
27
30
|
var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
|
28
31
|
var _selectionSource = /*#__PURE__*/new WeakMap();
|
29
32
|
var _expectedLayersCount = /*#__PURE__*/new WeakMap();
|
@@ -63,11 +66,23 @@ class Selection {
|
|
63
66
|
*/
|
64
67
|
_defineProperty(this, "highlight", void 0);
|
65
68
|
/**
|
66
|
-
* The module for modifying coordinates.
|
69
|
+
* The module for modifying coordinates of the start and end selection.
|
67
70
|
*
|
68
71
|
* @type {Transformation}
|
69
72
|
*/
|
70
|
-
|
73
|
+
_classPrivateFieldInitSpec(this, _transformation, {
|
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
|
+
});
|
71
86
|
/**
|
72
87
|
* The collection of the selection layer levels where the whole row was selected using the row header or
|
73
88
|
* the corner header.
|
@@ -82,6 +97,15 @@ class Selection {
|
|
82
97
|
* @type {Set<number>}
|
83
98
|
*/
|
84
99
|
_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
|
+
});
|
85
109
|
/**
|
86
110
|
* When sets disable highlighting the headers even when the logical coordinates points on them.
|
87
111
|
*
|
@@ -132,71 +156,100 @@ class Selection {
|
|
132
156
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
133
157
|
createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
|
134
158
|
});
|
135
|
-
this
|
159
|
+
_classPrivateFieldSet(this, _transformation, new Transformation(this.selectedRange, {
|
136
160
|
rowIndexMapper: this.tableProps.rowIndexMapper,
|
137
161
|
columnIndexMapper: this.tableProps.columnIndexMapper,
|
138
162
|
countRenderableRows: () => this.tableProps.countRenderableRows(),
|
139
163
|
countRenderableColumns: () => this.tableProps.countRenderableColumns(),
|
140
|
-
countRowHeaders: () => this.tableProps.countRowHeaders(),
|
141
|
-
countColHeaders: () => this.tableProps.countColHeaders(),
|
142
164
|
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
143
165
|
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
144
166
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
145
|
-
navigableHeaders: () => settings.navigableHeaders,
|
146
167
|
fixedRowsBottom: () => settings.fixedRowsBottom,
|
147
168
|
minSpareRows: () => settings.minSpareRows,
|
148
169
|
minSpareCols: () => settings.minSpareCols,
|
149
170
|
autoWrapRow: () => settings.autoWrapRow,
|
150
171
|
autoWrapCol: () => settings.autoWrapCol
|
151
|
-
});
|
152
|
-
this
|
172
|
+
}));
|
173
|
+
_classPrivateFieldSet(this, _focusTransformation, new Transformation(this.selectedRange, {
|
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 () {
|
153
194
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
154
195
|
args[_key] = arguments[_key];
|
155
196
|
}
|
156
197
|
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
157
198
|
});
|
158
|
-
this.
|
199
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformStart', function () {
|
159
200
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
160
201
|
args[_key2] = arguments[_key2];
|
161
202
|
}
|
162
203
|
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
163
204
|
});
|
164
|
-
this.
|
205
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformEnd', function () {
|
165
206
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
166
207
|
args[_key3] = arguments[_key3];
|
167
208
|
}
|
168
209
|
return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
|
169
210
|
});
|
170
|
-
this.
|
211
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('afterTransformEnd', function () {
|
171
212
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
172
213
|
args[_key4] = arguments[_key4];
|
173
214
|
}
|
174
215
|
return _this.runLocalHooks('afterModifyTransformEnd', ...args);
|
175
216
|
});
|
176
|
-
this.
|
217
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('insertRowRequire', function () {
|
177
218
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
178
219
|
args[_key5] = arguments[_key5];
|
179
220
|
}
|
180
221
|
return _this.runLocalHooks('insertRowRequire', ...args);
|
181
222
|
});
|
182
|
-
this.
|
223
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('insertColRequire', function () {
|
183
224
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
184
225
|
args[_key6] = arguments[_key6];
|
185
226
|
}
|
186
227
|
return _this.runLocalHooks('insertColRequire', ...args);
|
187
228
|
});
|
188
|
-
this.
|
229
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('beforeRowWrap', function () {
|
189
230
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
190
231
|
args[_key7] = arguments[_key7];
|
191
232
|
}
|
192
233
|
return _this.runLocalHooks('beforeRowWrap', ...args);
|
193
234
|
});
|
194
|
-
this.
|
235
|
+
_classPrivateFieldGet(this, _transformation).addLocalHook('beforeColumnWrap', function () {
|
195
236
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
196
237
|
args[_key8] = arguments[_key8];
|
197
238
|
}
|
198
239
|
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
199
240
|
});
|
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
|
+
});
|
200
253
|
}
|
201
254
|
|
202
255
|
/**
|
@@ -287,6 +340,7 @@ class Selection {
|
|
287
340
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
288
341
|
// should be handled by next methods.
|
289
342
|
const coordsClone = coords.clone();
|
343
|
+
_classPrivateFieldSet(this, _isFocusSelectionChanged, false);
|
290
344
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
291
345
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
|
292
346
|
this.selectedRange.clear();
|
@@ -354,11 +408,7 @@ class Selection {
|
|
354
408
|
}
|
355
409
|
}
|
356
410
|
this.runLocalHooks('beforeHighlightSet');
|
357
|
-
|
358
|
-
focusHighlight.clear();
|
359
|
-
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
360
|
-
focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
361
|
-
}
|
411
|
+
this.setRangeFocus(this.selectedRange.current().highlight);
|
362
412
|
const layerLevel = this.getLayerLevel();
|
363
413
|
|
364
414
|
// If the next layer level is lower than previous then clear all area and header highlights. This is the
|
@@ -446,15 +496,24 @@ class Selection {
|
|
446
496
|
}
|
447
497
|
|
448
498
|
/**
|
449
|
-
*
|
450
|
-
* the selection.
|
499
|
+
* Sets the selection focus position at the specified coordinates.
|
451
500
|
*
|
452
|
-
* @
|
501
|
+
* @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
|
453
502
|
*/
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
503
|
+
setRangeFocus(coords) {
|
504
|
+
if (this.selectedRange.isEmpty()) {
|
505
|
+
return;
|
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
|
+
}
|
458
517
|
}
|
459
518
|
|
460
519
|
/**
|
@@ -467,7 +526,13 @@ class Selection {
|
|
467
526
|
*/
|
468
527
|
transformStart(rowDelta, colDelta) {
|
469
528
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
470
|
-
|
529
|
+
if (this.settings.navigableHeaders) {
|
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));
|
471
536
|
}
|
472
537
|
|
473
538
|
/**
|
@@ -477,7 +542,44 @@ class Selection {
|
|
477
542
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
478
543
|
*/
|
479
544
|
transformEnd(rowDelta, colDelta) {
|
480
|
-
|
545
|
+
if (this.settings.navigableHeaders) {
|
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());
|
481
583
|
}
|
482
584
|
|
483
585
|
/**
|
@@ -498,6 +600,30 @@ class Selection {
|
|
498
600
|
return !this.selectedRange.isEmpty();
|
499
601
|
}
|
500
602
|
|
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
|
+
|
501
627
|
/**
|
502
628
|
* Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
|
503
629
|
* 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; }
|
11
12
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
12
13
|
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,7 +32,6 @@ 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();
|
36
35
|
var _clampCoords = /*#__PURE__*/new WeakSet();
|
37
36
|
var _getTableSize = /*#__PURE__*/new WeakSet();
|
38
37
|
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
@@ -67,13 +66,6 @@ class Transformation {
|
|
67
66
|
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
68
67
|
*/
|
69
68
|
_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);
|
77
69
|
/**
|
78
70
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
79
71
|
*
|
@@ -121,10 +113,6 @@ class Transformation {
|
|
121
113
|
*/
|
122
114
|
transformStart(rowDelta, colDelta) {
|
123
115
|
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
|
-
});
|
128
116
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
129
117
|
let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
130
118
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
@@ -204,10 +192,6 @@ class Transformation {
|
|
204
192
|
* @returns {CellCoords} Visual coordinates after transformation.
|
205
193
|
*/
|
206
194
|
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
|
-
});
|
211
195
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
212
196
|
const cellRange = _classPrivateFieldGet(this, _range).current();
|
213
197
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
@@ -240,16 +224,23 @@ class Transformation {
|
|
240
224
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
241
225
|
return visualCoords;
|
242
226
|
}
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
230
|
+
* is enabled.
|
231
|
+
*
|
232
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
233
|
+
*/
|
234
|
+
setOffsetSize(_ref) {
|
235
|
+
let {
|
236
|
+
x,
|
237
|
+
y
|
238
|
+
} = _ref;
|
239
|
+
_classPrivateFieldSet(this, _offset, {
|
240
|
+
x,
|
241
|
+
y
|
242
|
+
});
|
243
|
+
}
|
253
244
|
}
|
254
245
|
function _clampCoords2(zeroBasedCoords) {
|
255
246
|
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; }
|
5
6
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
6
7
|
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,7 +28,6 @@ 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();
|
32
31
|
var _clampCoords = /*#__PURE__*/new WeakSet();
|
33
32
|
var _getTableSize = /*#__PURE__*/new WeakSet();
|
34
33
|
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
@@ -63,13 +62,6 @@ class Transformation {
|
|
63
62
|
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
64
63
|
*/
|
65
64
|
_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);
|
73
65
|
/**
|
74
66
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
75
67
|
*
|
@@ -117,10 +109,6 @@ class Transformation {
|
|
117
109
|
*/
|
118
110
|
transformStart(rowDelta, colDelta) {
|
119
111
|
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
|
-
});
|
124
112
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
125
113
|
let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
126
114
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
@@ -200,10 +188,6 @@ class Transformation {
|
|
200
188
|
* @returns {CellCoords} Visual coordinates after transformation.
|
201
189
|
*/
|
202
190
|
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
|
-
});
|
207
191
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
208
192
|
const cellRange = _classPrivateFieldGet(this, _range).current();
|
209
193
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
@@ -236,16 +220,23 @@ class Transformation {
|
|
236
220
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
237
221
|
return visualCoords;
|
238
222
|
}
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
226
|
+
* is enabled.
|
227
|
+
*
|
228
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
229
|
+
*/
|
230
|
+
setOffsetSize(_ref) {
|
231
|
+
let {
|
232
|
+
x,
|
233
|
+
y
|
234
|
+
} = _ref;
|
235
|
+
_classPrivateFieldSet(this, _offset, {
|
236
|
+
x,
|
237
|
+
y
|
238
|
+
});
|
239
|
+
}
|
249
240
|
}
|
250
241
|
function _clampCoords2(zeroBasedCoords) {
|
251
242
|
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) {
|
7
7
|
const editorManager = hot._getEditorManager();
|
8
8
|
editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
|
9
|
-
editorManager.moveSelectionAfterEnter(
|
9
|
+
editorManager.moveSelectionAfterEnter(event);
|
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) {
|
4
4
|
const editorManager = hot._getEditorManager();
|
5
5
|
editorManager.closeEditorAndSaveChanges(event.ctrlKey || event.metaKey);
|
6
|
-
editorManager.moveSelectionAfterEnter(
|
6
|
+
editorManager.moveSelectionAfterEnter(event);
|
7
7
|
}
|
8
8
|
};
|
@@ -6,20 +6,35 @@ 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();
|
9
10
|
const {
|
10
11
|
highlight
|
11
|
-
} =
|
12
|
+
} = selectedRange;
|
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
|
+
}
|
12
25
|
if (highlight.isHeader()) {
|
13
26
|
return;
|
14
27
|
}
|
28
|
+
|
29
|
+
// supports editor opening with enter key
|
15
30
|
if (hot.getSettings().enterBeginsEditing) {
|
16
31
|
if (editorManager.cellProperties.readOnly) {
|
17
|
-
editorManager.moveSelectionAfterEnter();
|
32
|
+
editorManager.moveSelectionAfterEnter(event);
|
18
33
|
} else {
|
19
34
|
editorManager.openEditor(null, event, true);
|
20
35
|
}
|
21
36
|
} else {
|
22
|
-
editorManager.moveSelectionAfterEnter(
|
37
|
+
editorManager.moveSelectionAfterEnter(event);
|
23
38
|
}
|
24
39
|
(0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
|
25
40
|
}
|
@@ -3,20 +3,35 @@ export const command = {
|
|
3
3
|
name: 'editorOpen',
|
4
4
|
callback(hot, event, keys) {
|
5
5
|
const editorManager = hot._getEditorManager();
|
6
|
+
const selectedRange = hot.getSelectedRangeLast();
|
6
7
|
const {
|
7
8
|
highlight
|
8
|
-
} =
|
9
|
+
} = selectedRange;
|
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
|
+
}
|
9
22
|
if (highlight.isHeader()) {
|
10
23
|
return;
|
11
24
|
}
|
25
|
+
|
26
|
+
// supports editor opening with enter key
|
12
27
|
if (hot.getSettings().enterBeginsEditing) {
|
13
28
|
if (editorManager.cellProperties.readOnly) {
|
14
|
-
editorManager.moveSelectionAfterEnter();
|
29
|
+
editorManager.moveSelectionAfterEnter(event);
|
15
30
|
} else {
|
16
31
|
editorManager.openEditor(null, event, true);
|
17
32
|
}
|
18
33
|
} else {
|
19
|
-
editorManager.moveSelectionAfterEnter(
|
34
|
+
editorManager.moveSelectionAfterEnter(event);
|
20
35
|
}
|
21
36
|
stopImmediatePropagation(event); // required by HandsontableEditor
|
22
37
|
}
|
@@ -5,7 +5,12 @@ const command = exports.command = {
|
|
5
5
|
name: 'moveCellSelectionInlineEnd',
|
6
6
|
callback(hot, event) {
|
7
7
|
const settings = hot.getSettings();
|
8
|
+
const selectedRange = hot.getSelectedRangeLast();
|
8
9
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
9
|
-
hot.selection.
|
10
|
+
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
11
|
+
hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
|
12
|
+
} else {
|
13
|
+
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
14
|
+
}
|
10
15
|
}
|
11
16
|
};
|
@@ -2,7 +2,12 @@ export const command = {
|
|
2
2
|
name: 'moveCellSelectionInlineEnd',
|
3
3
|
callback(hot, event) {
|
4
4
|
const settings = hot.getSettings();
|
5
|
+
const selectedRange = hot.getSelectedRangeLast();
|
5
6
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
6
|
-
hot.selection.
|
7
|
+
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
8
|
+
hot.selection.transformFocus(-tabMoves.row, -tabMoves.col);
|
9
|
+
} else {
|
10
|
+
hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
|
11
|
+
}
|
7
12
|
}
|
8
13
|
};
|
@@ -5,7 +5,12 @@ const command = exports.command = {
|
|
5
5
|
name: 'moveCellSelectionInlineStart',
|
6
6
|
callback(hot, event) {
|
7
7
|
const settings = hot.getSettings();
|
8
|
+
const selectedRange = hot.getSelectedRangeLast();
|
8
9
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
9
|
-
hot.selection.
|
10
|
+
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
11
|
+
hot.selection.transformFocus(tabMoves.row, tabMoves.col);
|
12
|
+
} else {
|
13
|
+
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
14
|
+
}
|
10
15
|
}
|
11
16
|
};
|
@@ -2,7 +2,12 @@ export const command = {
|
|
2
2
|
name: 'moveCellSelectionInlineStart',
|
3
3
|
callback(hot, event) {
|
4
4
|
const settings = hot.getSettings();
|
5
|
+
const selectedRange = hot.getSelectedRangeLast();
|
5
6
|
const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
|
6
|
-
hot.selection.
|
7
|
+
if (hot.selection.isMultiple() && !selectedRange.isHeader() && hot.countRenderedCols() > 0 && hot.countRenderedRows() > 0) {
|
8
|
+
hot.selection.transformFocus(tabMoves.row, tabMoves.col);
|
9
|
+
} else {
|
10
|
+
hot.selection.transformStart(tabMoves.row, tabMoves.col);
|
11
|
+
}
|
7
12
|
}
|
8
13
|
};
|