handsontable 0.0.0-next-221e46b-20240307 → 0.0.0-next-2becb78-20240313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +22 -5
- package/3rdparty/walkontable/src/cell/range.mjs +22 -5
- 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.d.ts +4 -3
- package/core.js +81 -21
- package/core.mjs +81 -21
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2721 -1361
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +152 -152
- package/dist/handsontable.js +2721 -1361
- 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/calculations/selection.js +1 -70
- package/plugins/mergeCells/calculations/selection.mjs +1 -70
- package/plugins/mergeCells/cellsCollection.js +116 -0
- package/plugins/mergeCells/cellsCollection.mjs +116 -0
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +11 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
- package/plugins/mergeCells/focusOrder.js +327 -0
- package/plugins/mergeCells/focusOrder.mjs +322 -0
- package/plugins/mergeCells/mergeCells.js +392 -197
- package/plugins/mergeCells/mergeCells.mjs +392 -197
- 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 +8 -5
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
- package/selection/highlight/visualSelection.js +16 -2
- package/selection/highlight/visualSelection.mjs +16 -2
- package/selection/selection.js +228 -44
- package/selection/selection.mjs +227 -43
- package/selection/transformation.js +86 -32
- package/selection/transformation.mjs +86 -32
- 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/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- 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/tableView.js +20 -0
- package/tableView.mjs +20 -0
- package/utils/dataStructures/linkedList.js +6 -1
- package/utils/dataStructures/linkedList.mjs +6 -1
@@ -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,9 +28,10 @@ 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();
|
33
|
+
var _findFirstNonHiddenZeroBasedRow = /*#__PURE__*/new WeakSet();
|
34
|
+
var _findFirstNonHiddenZeroBasedColumn = /*#__PURE__*/new WeakSet();
|
34
35
|
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
35
36
|
var _zeroBasedToVisualCoords = /*#__PURE__*/new WeakSet();
|
36
37
|
class Transformation {
|
@@ -49,6 +50,22 @@ class Transformation {
|
|
49
50
|
* @returns {CellCoords}
|
50
51
|
*/
|
51
52
|
_classPrivateMethodInitSpec(this, _visualToZeroBasedCoords);
|
53
|
+
/**
|
54
|
+
* Finds the first non-hidden zero-based column in the table range.
|
55
|
+
*
|
56
|
+
* @param {number} visualColumnFrom The visual column from which the search should start.
|
57
|
+
* @param {number} visualColumnTo The visual column to which the search should end.
|
58
|
+
* @returns {number | null}
|
59
|
+
*/
|
60
|
+
_classPrivateMethodInitSpec(this, _findFirstNonHiddenZeroBasedColumn);
|
61
|
+
/**
|
62
|
+
* Finds the first non-hidden zero-based row in the table range.
|
63
|
+
*
|
64
|
+
* @param {number} visualRowFrom The visual row from which the search should start.
|
65
|
+
* @param {number} visualRowTo The visual row to which the search should end.
|
66
|
+
* @returns {number | null}
|
67
|
+
*/
|
68
|
+
_classPrivateMethodInitSpec(this, _findFirstNonHiddenZeroBasedRow);
|
52
69
|
/**
|
53
70
|
* Gets the table size in number of rows with headers as "height" and number of columns with
|
54
71
|
* headers as "width".
|
@@ -63,13 +80,6 @@ class Transformation {
|
|
63
80
|
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
64
81
|
*/
|
65
82
|
_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
83
|
/**
|
74
84
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
75
85
|
*
|
@@ -117,10 +127,6 @@ class Transformation {
|
|
117
127
|
*/
|
118
128
|
transformStart(rowDelta, colDelta) {
|
119
129
|
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
130
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
125
131
|
let visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
126
132
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
@@ -200,23 +206,47 @@ class Transformation {
|
|
200
206
|
* @returns {CellCoords} Visual coordinates after transformation.
|
201
207
|
*/
|
202
208
|
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
209
|
const delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
208
210
|
const cellRange = _classPrivateFieldGet(this, _range).current();
|
209
211
|
const highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
212
|
+
const toRow = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedRow, _findFirstNonHiddenZeroBasedRow2).call(this, cellRange.to.row, cellRange.from.row);
|
213
|
+
const toColumn = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedColumn, _findFirstNonHiddenZeroBasedColumn2).call(this, cellRange.to.col, cellRange.from.col);
|
210
214
|
const visualCoords = cellRange.to.clone();
|
211
215
|
let rowTransformDir = 0;
|
212
216
|
let colTransformDir = 0;
|
213
217
|
this.runLocalHooks('beforeTransformEnd', delta);
|
214
|
-
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
|
218
|
+
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null && toRow !== null && toColumn !== null) {
|
215
219
|
const {
|
216
|
-
row,
|
217
|
-
col
|
218
|
-
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.
|
219
|
-
const coords = _classPrivateFieldGet(this, _options).createCellCoords(
|
220
|
+
row: highlightRow,
|
221
|
+
col: highlightColumn
|
222
|
+
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.highlight);
|
223
|
+
const coords = _classPrivateFieldGet(this, _options).createCellCoords(toRow + delta.row, toColumn + delta.col);
|
224
|
+
const restDelta = {
|
225
|
+
row: coords.row - highlightRow,
|
226
|
+
col: coords.col - highlightColumn
|
227
|
+
};
|
228
|
+
this.runLocalHooks('modifyTransformEndRestDelta', restDelta, delta, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, coords));
|
229
|
+
const topStartCorner = cellRange.getTopStartCorner();
|
230
|
+
const topEndCorner = cellRange.getTopEndCorner();
|
231
|
+
const bottomEndCorner = cellRange.getBottomEndCorner();
|
232
|
+
if (delta.col < 0) {
|
233
|
+
if (toColumn >= highlightColumn && coords.col < highlightColumn) {
|
234
|
+
coords.col = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedColumn, _findFirstNonHiddenZeroBasedColumn2).call(this, topStartCorner.col, topEndCorner.col) + restDelta.col;
|
235
|
+
}
|
236
|
+
} else if (delta.col > 0) {
|
237
|
+
if (toColumn <= highlightColumn && coords.col > highlightColumn) {
|
238
|
+
coords.col = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedColumn, _findFirstNonHiddenZeroBasedColumn2).call(this, topEndCorner.col, topStartCorner.col) + restDelta.col;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
if (delta.row < 0) {
|
242
|
+
if (toRow >= highlightRow && coords.row < highlightRow) {
|
243
|
+
coords.row = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedRow, _findFirstNonHiddenZeroBasedRow2).call(this, topStartCorner.row, bottomEndCorner.row) + restDelta.row;
|
244
|
+
}
|
245
|
+
} else if (delta.row > 0) {
|
246
|
+
if (toRow <= highlightRow && coords.row > highlightRow) {
|
247
|
+
coords.row = _classPrivateMethodGet(this, _findFirstNonHiddenZeroBasedRow, _findFirstNonHiddenZeroBasedRow2).call(this, bottomEndCorner.row, topStartCorner.row) + restDelta.row;
|
248
|
+
}
|
249
|
+
}
|
220
250
|
const {
|
221
251
|
rowDir,
|
222
252
|
colDir
|
@@ -236,16 +266,23 @@ class Transformation {
|
|
236
266
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
237
267
|
return visualCoords;
|
238
268
|
}
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
269
|
+
|
270
|
+
/**
|
271
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
272
|
+
* is enabled.
|
273
|
+
*
|
274
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
275
|
+
*/
|
276
|
+
setOffsetSize(_ref) {
|
277
|
+
let {
|
278
|
+
x,
|
279
|
+
y
|
280
|
+
} = _ref;
|
281
|
+
_classPrivateFieldSet(this, _offset, {
|
282
|
+
x,
|
283
|
+
y
|
284
|
+
});
|
285
|
+
}
|
249
286
|
}
|
250
287
|
function _clampCoords2(zeroBasedCoords) {
|
251
288
|
const {
|
@@ -279,11 +316,28 @@ function _getTableSize2() {
|
|
279
316
|
height: _classPrivateFieldGet(this, _offset).y + _classPrivateFieldGet(this, _options).countRenderableRows()
|
280
317
|
};
|
281
318
|
}
|
319
|
+
function _findFirstNonHiddenZeroBasedRow2(visualRowFrom, visualRowTo) {
|
320
|
+
const row = _classPrivateFieldGet(this, _options).findFirstNonHiddenRenderableRow(visualRowFrom, visualRowTo);
|
321
|
+
if (row === null) {
|
322
|
+
return null;
|
323
|
+
}
|
324
|
+
return _classPrivateFieldGet(this, _offset).y + row;
|
325
|
+
}
|
326
|
+
function _findFirstNonHiddenZeroBasedColumn2(visualColumnFrom, visualColumnTo) {
|
327
|
+
const column = _classPrivateFieldGet(this, _options).findFirstNonHiddenRenderableColumn(visualColumnFrom, visualColumnTo);
|
328
|
+
if (column === null) {
|
329
|
+
return null;
|
330
|
+
}
|
331
|
+
return _classPrivateFieldGet(this, _offset).x + column;
|
332
|
+
}
|
282
333
|
function _visualToZeroBasedCoords2(visualCoords) {
|
283
334
|
const {
|
284
335
|
row,
|
285
336
|
col
|
286
337
|
} = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
338
|
+
if (row === null || col === null) {
|
339
|
+
throw new Error('Renderable coords are not visible.');
|
340
|
+
}
|
287
341
|
return _classPrivateFieldGet(this, _options).createCellCoords(_classPrivateFieldGet(this, _offset).y + row, _classPrivateFieldGet(this, _offset).x + col);
|
288
342
|
}
|
289
343
|
function _zeroBasedToVisualCoords2(zeroBasedCoords) {
|
@@ -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
|
}
|
@@ -7,7 +7,7 @@ const command = exports.command = {
|
|
7
7
|
const {
|
8
8
|
highlight
|
9
9
|
} = hot.getSelectedRangeLast();
|
10
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
|
10
|
+
if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
|
11
11
|
hot.selection.transformEnd(1, 0);
|
12
12
|
}
|
13
13
|
}
|
@@ -4,7 +4,7 @@ export const command = {
|
|
4
4
|
const {
|
5
5
|
highlight
|
6
6
|
} = hot.getSelectedRangeLast();
|
7
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
|
7
|
+
if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
|
8
8
|
hot.selection.transformEnd(1, 0);
|
9
9
|
}
|
10
10
|
}
|
@@ -7,7 +7,7 @@ const command = exports.command = {
|
|
7
7
|
const {
|
8
8
|
highlight
|
9
9
|
} = hot.getSelectedRangeLast();
|
10
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
|
10
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
|
11
11
|
hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
|
12
12
|
}
|
13
13
|
}
|
@@ -4,7 +4,7 @@ export const command = {
|
|
4
4
|
const {
|
5
5
|
highlight
|
6
6
|
} = hot.getSelectedRangeLast();
|
7
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
|
7
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
|
8
8
|
hot.selection.transformEnd(0, -1 * hot.getDirectionFactor());
|
9
9
|
}
|
10
10
|
}
|
@@ -7,7 +7,7 @@ const command = exports.command = {
|
|
7
7
|
const {
|
8
8
|
highlight
|
9
9
|
} = hot.getSelectedRangeLast();
|
10
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
|
10
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
|
11
11
|
hot.selection.transformEnd(0, hot.getDirectionFactor());
|
12
12
|
}
|
13
13
|
}
|
@@ -4,7 +4,7 @@ export const command = {
|
|
4
4
|
const {
|
5
5
|
highlight
|
6
6
|
} = hot.getSelectedRangeLast();
|
7
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader()) {
|
7
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByColumnHeader())) {
|
8
8
|
hot.selection.transformEnd(0, hot.getDirectionFactor());
|
9
9
|
}
|
10
10
|
}
|
@@ -16,7 +16,9 @@ const command = exports.command = {
|
|
16
16
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
|
17
17
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
18
18
|
const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1);
|
19
|
-
|
19
|
+
const newFrom = from.clone();
|
20
|
+
newFrom.row = highlight.row;
|
21
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
20
22
|
|
21
23
|
// Restore the row highlight by header flag after setting up a new selection.
|
22
24
|
if (isFocusHighlightedByHeader) {
|
@@ -13,7 +13,9 @@ export const command = {
|
|
13
13
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
|
14
14
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
15
15
|
const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1);
|
16
|
-
|
16
|
+
const newFrom = from.clone();
|
17
|
+
newFrom.row = highlight.row;
|
18
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
17
19
|
|
18
20
|
// Restore the row highlight by header flag after setting up a new selection.
|
19
21
|
if (isFocusHighlightedByHeader) {
|
@@ -9,10 +9,16 @@ const command = exports.command = {
|
|
9
9
|
columnIndexMapper
|
10
10
|
} = hot;
|
11
11
|
const {
|
12
|
-
highlight
|
12
|
+
highlight,
|
13
|
+
from,
|
14
|
+
to
|
13
15
|
} = hot.getSelectedRangeLast();
|
14
|
-
if (highlight.isCell()) {
|
15
|
-
|
16
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
|
17
|
+
const column = columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1);
|
18
|
+
const newFrom = from.clone();
|
19
|
+
newFrom.col = highlight.col;
|
20
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
21
|
+
selection.setRangeEnd(hot._createCellCoords(to.row, column));
|
16
22
|
}
|
17
23
|
}
|
18
24
|
};
|
@@ -6,10 +6,16 @@ export const command = {
|
|
6
6
|
columnIndexMapper
|
7
7
|
} = hot;
|
8
8
|
const {
|
9
|
-
highlight
|
9
|
+
highlight,
|
10
|
+
from,
|
11
|
+
to
|
10
12
|
} = hot.getSelectedRangeLast();
|
11
|
-
if (highlight.isCell()) {
|
12
|
-
|
13
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
|
14
|
+
const column = columnIndexMapper.getNearestNotHiddenIndex(hot.countCols() - 1, -1);
|
15
|
+
const newFrom = from.clone();
|
16
|
+
newFrom.col = highlight.col;
|
17
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
18
|
+
selection.setRangeEnd(hot._createCellCoords(to.row, column));
|
13
19
|
}
|
14
20
|
}
|
15
21
|
};
|
@@ -9,10 +9,17 @@ const command = exports.command = {
|
|
9
9
|
columnIndexMapper
|
10
10
|
} = hot;
|
11
11
|
const {
|
12
|
-
highlight
|
12
|
+
highlight,
|
13
|
+
from,
|
14
|
+
to
|
13
15
|
} = hot.getSelectedRangeLast();
|
14
|
-
if (highlight.isCell()) {
|
15
|
-
|
16
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
|
17
|
+
const fixedColumns = parseInt(hot.getSettings().fixedColumnsStart, 10);
|
18
|
+
const column = columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
19
|
+
const newFrom = from.clone();
|
20
|
+
newFrom.col = highlight.col;
|
21
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
22
|
+
selection.setRangeEnd(hot._createCellCoords(to.row, column));
|
16
23
|
}
|
17
24
|
}
|
18
25
|
};
|
@@ -6,10 +6,17 @@ export const command = {
|
|
6
6
|
columnIndexMapper
|
7
7
|
} = hot;
|
8
8
|
const {
|
9
|
-
highlight
|
9
|
+
highlight,
|
10
|
+
from,
|
11
|
+
to
|
10
12
|
} = hot.getSelectedRangeLast();
|
11
|
-
if (highlight.isCell()) {
|
12
|
-
|
13
|
+
if (!hot.selection.isSelectedByRowHeader() && !hot.selection.isSelectedByCorner() && highlight.isCell()) {
|
14
|
+
const fixedColumns = parseInt(hot.getSettings().fixedColumnsStart, 10);
|
15
|
+
const column = columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
16
|
+
const newFrom = from.clone();
|
17
|
+
newFrom.col = highlight.col;
|
18
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
19
|
+
selection.setRangeEnd(hot._createCellCoords(to.row, column));
|
13
20
|
}
|
14
21
|
}
|
15
22
|
};
|
@@ -16,7 +16,9 @@ const command = exports.command = {
|
|
16
16
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
|
17
17
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
18
18
|
const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [hot.countCols() - 1, -1] : [0, 1]));
|
19
|
-
|
19
|
+
const newFrom = from.clone();
|
20
|
+
newFrom.col = highlight.col;
|
21
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
20
22
|
|
21
23
|
// Restore the column highlight by header flag after setting up a new selection.
|
22
24
|
if (isFocusHighlightedByHeader) {
|
@@ -13,7 +13,9 @@ export const command = {
|
|
13
13
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
|
14
14
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
15
15
|
const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [hot.countCols() - 1, -1] : [0, 1]));
|
16
|
-
|
16
|
+
const newFrom = from.clone();
|
17
|
+
newFrom.col = highlight.col;
|
18
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
17
19
|
|
18
20
|
// Restore the column highlight by header flag after setting up a new selection.
|
19
21
|
if (isFocusHighlightedByHeader) {
|
@@ -16,7 +16,9 @@ const command = exports.command = {
|
|
16
16
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
|
17
17
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
18
18
|
const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [0, 1] : [hot.countCols() - 1, -1]));
|
19
|
-
|
19
|
+
const newFrom = from.clone();
|
20
|
+
newFrom.col = highlight.col;
|
21
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
20
22
|
|
21
23
|
// Restore the column highlight by header flag after setting up a new selection.
|
22
24
|
if (isFocusHighlightedByHeader) {
|
@@ -13,7 +13,9 @@ export const command = {
|
|
13
13
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByColumnHeader();
|
14
14
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
15
15
|
const column = columnIndexMapper.getNearestNotHiddenIndex(...(hot.isRtl() ? [0, 1] : [hot.countCols() - 1, -1]));
|
16
|
-
|
16
|
+
const newFrom = from.clone();
|
17
|
+
newFrom.col = highlight.col;
|
18
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
17
19
|
|
18
20
|
// Restore the column highlight by header flag after setting up a new selection.
|
19
21
|
if (isFocusHighlightedByHeader) {
|
@@ -16,7 +16,9 @@ const command = exports.command = {
|
|
16
16
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
|
17
17
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
18
18
|
const row = rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
19
|
-
|
19
|
+
const newFrom = from.clone();
|
20
|
+
newFrom.row = highlight.row;
|
21
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
20
22
|
|
21
23
|
// Restore the row highlight by header flag after setting up a new selection.
|
22
24
|
if (isFocusHighlightedByHeader) {
|
@@ -13,7 +13,9 @@ export const command = {
|
|
13
13
|
const isFocusHighlightedByHeader = highlight.isHeader() && hot.selection.isSelectedByRowHeader();
|
14
14
|
if (highlight.isCell() || isFocusHighlightedByHeader) {
|
15
15
|
const row = rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
16
|
-
|
16
|
+
const newFrom = from.clone();
|
17
|
+
newFrom.row = highlight.row;
|
18
|
+
selection.setRangeStart(newFrom, undefined, false, highlight.clone());
|
17
19
|
|
18
20
|
// Restore the row highlight by header flag after setting up a new selection.
|
19
21
|
if (isFocusHighlightedByHeader) {
|
@@ -7,7 +7,7 @@ const command = exports.command = {
|
|
7
7
|
const {
|
8
8
|
highlight
|
9
9
|
} = hot.getSelectedRangeLast();
|
10
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
|
10
|
+
if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
|
11
11
|
hot.selection.transformEnd(-1, 0);
|
12
12
|
}
|
13
13
|
}
|
@@ -4,7 +4,7 @@ export const command = {
|
|
4
4
|
const {
|
5
5
|
highlight
|
6
6
|
} = hot.getSelectedRangeLast();
|
7
|
-
if (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader()) {
|
7
|
+
if (!hot.selection.isSelectedByColumnHeader() && !hot.selection.isSelectedByCorner() && (highlight.isCell() || highlight.isHeader() && hot.selection.isSelectedByRowHeader())) {
|
8
8
|
hot.selection.transformEnd(-1, 0);
|
9
9
|
}
|
10
10
|
}
|
@@ -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
|
};
|