handsontable 0.0.0-next-baf2fcf-20230809 → 0.0.0-next-08765b9-20230809
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/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +50 -11
- package/3rdparty/walkontable/src/cell/coords.mjs +50 -11
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +38 -7
- package/3rdparty/walkontable/src/cell/range.mjs +38 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
- package/3rdparty/walkontable/src/overlay/top.js +2 -6
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -6
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
- package/3rdparty/walkontable/src/selection/constants.js +62 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +26 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +259 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +254 -0
- package/3rdparty/walkontable/src/selection/scanner.js +270 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
- package/3rdparty/walkontable/src/selection/selection.js +101 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +6 -78
- package/3rdparty/walkontable/src/table.mjs +7 -79
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/common.d.ts +1 -1
- package/core/focusCatcher/focusDetector.js +58 -0
- package/core/focusCatcher/focusDetector.mjs +54 -0
- package/core/focusCatcher/index.js +142 -0
- package/core/focusCatcher/index.mjs +138 -0
- package/core/index.js +9 -0
- package/core/index.mjs +1 -0
- package/core.d.ts +6 -3
- package/core.js +173 -290
- package/core.mjs +173 -290
- package/dataMap/metaManager/metaSchema.js +41 -0
- package/dataMap/metaManager/metaSchema.mjs +41 -0
- package/dist/handsontable.css +24 -4
- package/dist/handsontable.full.css +24 -4
- package/dist/handsontable.full.js +8676 -5381
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +25 -25
- package/dist/handsontable.js +10984 -7689
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +11 -75
- package/editorManager.mjs +11 -74
- package/editors/baseEditor/baseEditor.d.ts +0 -1
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.d.ts +7 -1
- package/pluginHooks.js +106 -1
- package/pluginHooks.mjs +106 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +58 -4
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +58 -4
- package/plugins/columnSorting/columnSorting.js +38 -0
- package/plugins/columnSorting/columnSorting.mjs +38 -2
- package/plugins/columnSorting/index.js +3 -1
- package/plugins/columnSorting/index.mjs +1 -1
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +251 -189
- package/plugins/comments/comments.mjs +250 -190
- package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
- package/plugins/comments/contextMenuItem/removeComment.js +38 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +72 -30
- package/plugins/contextMenu/contextMenu.mjs +73 -31
- package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
- package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
- package/plugins/contextMenu/utils.js +28 -16
- package/plugins/contextMenu/utils.mjs +27 -15
- package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
- package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
- package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
- package/plugins/copyPaste/copyPaste.js +14 -10
- package/plugins/copyPaste/copyPaste.mjs +14 -10
- package/plugins/customBorders/customBorders.js +23 -20
- package/plugins/customBorders/customBorders.mjs +24 -21
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +89 -32
- package/plugins/dropdownMenu/dropdownMenu.mjs +89 -32
- package/plugins/filters/filters.js +31 -14
- package/plugins/filters/filters.mjs +30 -13
- package/plugins/manualColumnResize/manualColumnResize.js +0 -6
- package/plugins/manualColumnResize/manualColumnResize.mjs +1 -7
- package/plugins/mergeCells/mergeCells.js +5 -17
- package/plugins/mergeCells/mergeCells.mjs +5 -17
- package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
- package/plugins/nestedHeaders/nestedHeaders.js +121 -8
- package/plugins/nestedHeaders/nestedHeaders.mjs +121 -8
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/plugins/nestedRows/nestedRows.js +41 -0
- package/plugins/nestedRows/nestedRows.mjs +41 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +256 -71
- package/selection/highlight/highlight.mjs +250 -71
- package/selection/highlight/types/activeHeader.js +10 -8
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +6 -18
- package/selection/highlight/types/area.mjs +6 -18
- package/selection/highlight/types/areaLayered.js +31 -0
- package/selection/highlight/types/areaLayered.mjs +26 -0
- package/selection/highlight/types/column.js +27 -0
- package/selection/highlight/types/column.mjs +22 -0
- package/selection/highlight/types/customSelection.js +7 -9
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -7
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -7
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +9 -18
- package/selection/highlight/types/header.mjs +9 -18
- package/selection/highlight/types/row.js +27 -0
- package/selection/highlight/types/row.mjs +22 -0
- package/selection/highlight/visualSelection.js +31 -27
- package/selection/highlight/visualSelection.mjs +31 -27
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +290 -154
- package/selection/selection.mjs +287 -153
- package/selection/transformation.js +232 -90
- package/selection/transformation.mjs +232 -90
- package/selection/utils.js +15 -21
- package/selection/utils.mjs +16 -21
- package/settings.d.ts +2 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +27 -0
- package/shortcutContexts/commands/editor/open.mjs +23 -0
- package/shortcutContexts/commands/emptySelectedCells.js +11 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/index.js +35 -0
- package/shortcutContexts/commands/index.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +36 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +32 -0
- package/shortcutContexts/commands/selectAll.js +10 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +13 -0
- package/shortcutContexts/constants.mjs +8 -0
- package/shortcutContexts/editor.js +25 -0
- package/shortcutContexts/editor.mjs +21 -0
- package/shortcutContexts/grid.js +163 -0
- package/shortcutContexts/grid.mjs +159 -0
- package/shortcutContexts/index.js +24 -0
- package/shortcutContexts/index.mjs +11 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -0
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +19 -5
- package/shortcuts/utils.mjs +18 -4
- package/tableView.js +67 -13
- package/tableView.mjs +67 -13
- package/3rdparty/walkontable/src/selection.js +0 -295
- package/3rdparty/walkontable/src/selection.mjs +0 -290
- package/selection/highlight/constants.js +0 -15
- package/selection/highlight/constants.mjs +0 -6
- package/selection/highlight/types/index.js +0 -35
- package/selection/highlight/types/index.mjs +0 -31
package/core.mjs
CHANGED
@@ -27,11 +27,21 @@ import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from
|
|
27
27
|
import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
|
28
28
|
import { Selection } from "./selection/index.mjs";
|
29
29
|
import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
|
30
|
+
import { installFocusCatcher } from "./core/index.mjs";
|
30
31
|
import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
|
31
32
|
import { createShortcutManager } from "./shortcuts/index.mjs";
|
32
|
-
|
33
|
+
import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
|
33
34
|
let activeGuid = null;
|
34
35
|
|
36
|
+
/**
|
37
|
+
* Keeps the collection of the all Handsontable instances created on the same page. The
|
38
|
+
* list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
|
39
|
+
* called on another instance.
|
40
|
+
*
|
41
|
+
* @type {Map<string, Core>}
|
42
|
+
*/
|
43
|
+
const foreignHotInstances = new Map();
|
44
|
+
|
35
45
|
/**
|
36
46
|
* A set of deprecated feature names.
|
37
47
|
*
|
@@ -91,7 +101,8 @@ const deprecationWarns = new Set();
|
|
91
101
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
92
102
|
*/
|
93
103
|
export default function Core(rootElement, userSettings) {
|
94
|
-
var _userSettings$layoutD
|
104
|
+
var _userSettings$layoutD,
|
105
|
+
_this = this;
|
95
106
|
let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
96
107
|
let preventScrollingToCell = false;
|
97
108
|
let instance = this;
|
@@ -208,6 +219,8 @@ export default function Core(rootElement, userSettings) {
|
|
208
219
|
}
|
209
220
|
this.guid = `ht_${randomString()}`; // this is the namespace for global events
|
210
221
|
|
222
|
+
foreignHotInstances.set(this.guid, this);
|
223
|
+
|
211
224
|
/**
|
212
225
|
* Instance of index mapper which is responsible for managing the column indexes.
|
213
226
|
*
|
@@ -256,14 +269,16 @@ export default function Core(rootElement, userSettings) {
|
|
256
269
|
};
|
257
270
|
|
258
271
|
let selection = new Selection(tableMeta, {
|
259
|
-
rowIndexMapper:
|
260
|
-
columnIndexMapper:
|
272
|
+
rowIndexMapper: instance.rowIndexMapper,
|
273
|
+
columnIndexMapper: instance.columnIndexMapper,
|
261
274
|
countCols: () => instance.countCols(),
|
262
275
|
countRows: () => instance.countRows(),
|
263
276
|
propToCol: prop => datamap.propToCol(prop),
|
264
277
|
isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
|
265
|
-
|
266
|
-
|
278
|
+
countRenderableColumns: () => this.view.countRenderableColumns(),
|
279
|
+
countRenderableRows: () => this.view.countRenderableRows(),
|
280
|
+
countRowHeaders: () => this.countRowHeaders(),
|
281
|
+
countColHeaders: () => this.countColHeaders(),
|
267
282
|
getShortcutManager: () => instance.getShortcutManager(),
|
268
283
|
createCellCoords: (row, column) => instance._createCellCoords(row, column),
|
269
284
|
createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
|
@@ -290,12 +305,6 @@ export default function Core(rootElement, userSettings) {
|
|
290
305
|
});
|
291
306
|
this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
|
292
307
|
this.runHooks('beforeSetRangeEnd', cellCoords);
|
293
|
-
if (cellCoords.row < 0) {
|
294
|
-
cellCoords.row = this.view._wt.wtTable.getFirstVisibleRow();
|
295
|
-
}
|
296
|
-
if (cellCoords.col < 0) {
|
297
|
-
cellCoords.col = this.view._wt.wtTable.getFirstVisibleColumn();
|
298
|
-
}
|
299
308
|
});
|
300
309
|
this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
|
301
310
|
const preventScrolling = createObjectPropListener(false);
|
@@ -322,7 +331,14 @@ export default function Core(rootElement, userSettings) {
|
|
322
331
|
if (scrollToCell !== false) {
|
323
332
|
if (!isSelectedByAnyHeader) {
|
324
333
|
if (currentSelectedRange && !this.selection.isMultiple()) {
|
325
|
-
|
334
|
+
const renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
|
335
|
+
if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
|
336
|
+
this.view.scrollViewportHorizontally(renderableCoords.col);
|
337
|
+
} else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
|
338
|
+
this.view.scrollViewportVertically(renderableCoords.row);
|
339
|
+
} else {
|
340
|
+
this.view.scrollViewport(renderableCoords);
|
341
|
+
}
|
326
342
|
} else {
|
327
343
|
this.view.scrollViewport(visualToRenderableCoords(cellCoords));
|
328
344
|
}
|
@@ -364,6 +380,30 @@ export default function Core(rootElement, userSettings) {
|
|
364
380
|
isMultiple.value = changedIsMultiple;
|
365
381
|
}
|
366
382
|
});
|
383
|
+
this.selection.addLocalHook('beforeSelectColumns', function () {
|
384
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
385
|
+
args[_key] = arguments[_key];
|
386
|
+
}
|
387
|
+
return _this.runHooks('beforeSelectColumns', ...args);
|
388
|
+
});
|
389
|
+
this.selection.addLocalHook('afterSelectColumns', function () {
|
390
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
391
|
+
args[_key2] = arguments[_key2];
|
392
|
+
}
|
393
|
+
return _this.runHooks('afterSelectColumns', ...args);
|
394
|
+
});
|
395
|
+
this.selection.addLocalHook('beforeSelectRows', function () {
|
396
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
397
|
+
args[_key3] = arguments[_key3];
|
398
|
+
}
|
399
|
+
return _this.runHooks('beforeSelectRows', ...args);
|
400
|
+
});
|
401
|
+
this.selection.addLocalHook('afterSelectRows', function () {
|
402
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
403
|
+
args[_key4] = arguments[_key4];
|
404
|
+
}
|
405
|
+
return _this.runHooks('afterSelectRows', ...args);
|
406
|
+
});
|
367
407
|
this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
|
368
408
|
this.runHooks('modifyTransformStart', cellCoordsDelta);
|
369
409
|
});
|
@@ -1013,6 +1053,9 @@ export default function Core(rootElement, userSettings) {
|
|
1013
1053
|
this.updateSettings(tableMeta, true);
|
1014
1054
|
this.view = new TableView(this);
|
1015
1055
|
editorManager = EditorManager.getInstance(instance, tableMeta, selection);
|
1056
|
+
if (isRootInstance(this)) {
|
1057
|
+
installFocusCatcher(instance);
|
1058
|
+
}
|
1016
1059
|
instance.runHooks('init');
|
1017
1060
|
this.forceFullRender = true; // used when data was changed
|
1018
1061
|
this.view.render();
|
@@ -1426,6 +1469,11 @@ export default function Core(rootElement, userSettings) {
|
|
1426
1469
|
*/
|
1427
1470
|
this.listen = function () {
|
1428
1471
|
if (instance && !instance.isListening()) {
|
1472
|
+
foreignHotInstances.forEach(foreignHot => {
|
1473
|
+
if (instance !== foreignHot) {
|
1474
|
+
foreignHot.unlisten();
|
1475
|
+
}
|
1476
|
+
});
|
1429
1477
|
activeGuid = instance.guid;
|
1430
1478
|
instance.runHooks('afterListen');
|
1431
1479
|
}
|
@@ -1510,8 +1558,8 @@ export default function Core(rootElement, userSettings) {
|
|
1510
1558
|
* @returns {Array} Returns removed portion of columns.
|
1511
1559
|
*/
|
1512
1560
|
this.spliceCol = function (column, index, amount) {
|
1513
|
-
for (var
|
1514
|
-
elements[
|
1561
|
+
for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
1562
|
+
elements[_key5 - 3] = arguments[_key5];
|
1515
1563
|
}
|
1516
1564
|
return datamap.spliceCol(column, index, amount, ...elements);
|
1517
1565
|
};
|
@@ -1528,8 +1576,8 @@ export default function Core(rootElement, userSettings) {
|
|
1528
1576
|
* @returns {Array} Returns removed portion of rows.
|
1529
1577
|
*/
|
1530
1578
|
this.spliceRow = function (row, index, amount) {
|
1531
|
-
for (var
|
1532
|
-
elements[
|
1579
|
+
for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
1580
|
+
elements[_key6 - 3] = arguments[_key6];
|
1533
1581
|
}
|
1534
1582
|
return datamap.spliceRow(row, index, amount, ...elements);
|
1535
1583
|
};
|
@@ -1626,6 +1674,9 @@ export default function Core(rootElement, userSettings) {
|
|
1626
1674
|
}
|
1627
1675
|
const changes = [];
|
1628
1676
|
arrayEach(selection.getSelectedRange(), cellRange => {
|
1677
|
+
if (cellRange.isSingleHeader()) {
|
1678
|
+
return;
|
1679
|
+
}
|
1629
1680
|
const topStart = cellRange.getTopStartCorner();
|
1630
1681
|
const bottomEnd = cellRange.getBottomEndCorner();
|
1631
1682
|
rangeEach(topStart.row, bottomEnd.row, row => {
|
@@ -2923,8 +2974,8 @@ export default function Core(rootElement, userSettings) {
|
|
2923
2974
|
*/
|
2924
2975
|
this.spliceCellsMeta = function (visualIndex) {
|
2925
2976
|
let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
2926
|
-
for (var
|
2927
|
-
cellMetaRows[
|
2977
|
+
for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
|
2978
|
+
cellMetaRows[_key7 - 2] = arguments[_key7];
|
2928
2979
|
}
|
2929
2980
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
2930
2981
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
@@ -3615,6 +3666,30 @@ export default function Core(rootElement, userSettings) {
|
|
3615
3666
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
|
3616
3667
|
};
|
3617
3668
|
|
3669
|
+
/**
|
3670
|
+
* Returns the number of rendered row headers.
|
3671
|
+
*
|
3672
|
+
* @since 14.0.0
|
3673
|
+
* @memberof Core#
|
3674
|
+
* @function countRowHeaders
|
3675
|
+
* @returns {number} Number of row headers.
|
3676
|
+
*/
|
3677
|
+
this.countRowHeaders = function () {
|
3678
|
+
return this.view.getRowHeadersCount();
|
3679
|
+
};
|
3680
|
+
|
3681
|
+
/**
|
3682
|
+
* Returns the number of rendered column headers.
|
3683
|
+
*
|
3684
|
+
* @since 14.0.0
|
3685
|
+
* @memberof Core#
|
3686
|
+
* @function countColHeaders
|
3687
|
+
* @returns {number} Number of column headers.
|
3688
|
+
*/
|
3689
|
+
this.countColHeaders = function () {
|
3690
|
+
return this.view.getColumnHeadersCount();
|
3691
|
+
};
|
3692
|
+
|
3618
3693
|
/**
|
3619
3694
|
* Returns the number of empty rows. If the optional ending parameter is `true`, returns the
|
3620
3695
|
* number of empty rows at the bottom of the table.
|
@@ -3819,6 +3894,10 @@ export default function Core(rootElement, userSettings) {
|
|
3819
3894
|
* hot.selectColumns('id');
|
3820
3895
|
* // Select range of columns using visual indexes.
|
3821
3896
|
* hot.selectColumns(1, 4);
|
3897
|
+
* // Select range of columns using visual indexes and mark the first header as highlighted.
|
3898
|
+
* hot.selectColumns(1, 2, -1);
|
3899
|
+
* // Select range of columns using visual indexes and mark the second cell as highlighted.
|
3900
|
+
* hot.selectColumns(2, 1, 1);
|
3822
3901
|
* // Select range of columns using column properties.
|
3823
3902
|
* hot.selectColumns('id', 'last_name');
|
3824
3903
|
* ```
|
@@ -3829,11 +3908,15 @@ export default function Core(rootElement, userSettings) {
|
|
3829
3908
|
* @param {number} startColumn The visual column index from which the selection starts.
|
3830
3909
|
* @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
|
3831
3910
|
* is not defined the column defined by `startColumn` will be selected.
|
3911
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3912
|
+
* The value can take visual row index from -N to N, where negative values
|
3913
|
+
* point to the headers and positive values point to the cell range.
|
3832
3914
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3833
3915
|
*/
|
3834
3916
|
this.selectColumns = function (startColumn) {
|
3835
3917
|
let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
3836
|
-
|
3918
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3919
|
+
return selection.selectColumns(startColumn, endColumn, focusPosition);
|
3837
3920
|
};
|
3838
3921
|
|
3839
3922
|
/**
|
@@ -3843,8 +3926,12 @@ export default function Core(rootElement, userSettings) {
|
|
3843
3926
|
* ```js
|
3844
3927
|
* // Select row using visual index.
|
3845
3928
|
* hot.selectRows(1);
|
3846
|
-
* //
|
3929
|
+
* // select a range of rows, using visual indexes.
|
3847
3930
|
* hot.selectRows(1, 4);
|
3931
|
+
* // select a range of rows, using visual indexes, and mark the header as highlighted.
|
3932
|
+
* hot.selectRows(1, 2, -1);
|
3933
|
+
* // Select range of rows using visual indexes and mark the second cell as highlighted.
|
3934
|
+
* hot.selectRows(2, 1, 1);
|
3848
3935
|
* ```
|
3849
3936
|
*
|
3850
3937
|
* @memberof Core#
|
@@ -3853,11 +3940,15 @@ export default function Core(rootElement, userSettings) {
|
|
3853
3940
|
* @param {number} startRow The visual row index from which the selection starts.
|
3854
3941
|
* @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
|
3855
3942
|
* is not defined the row defined by `startRow` will be selected.
|
3943
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3944
|
+
* The value can take visual column index from -N to N, where negative values
|
3945
|
+
* point to the headers and positive values point to the cell range.
|
3856
3946
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3857
3947
|
*/
|
3858
3948
|
this.selectRows = function (startRow) {
|
3859
3949
|
let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
3860
|
-
|
3950
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3951
|
+
return selection.selectRows(startRow, endRow, focusPosition);
|
3861
3952
|
};
|
3862
3953
|
|
3863
3954
|
/**
|
@@ -3876,9 +3967,16 @@ export default function Core(rootElement, userSettings) {
|
|
3876
3967
|
* The previous selection is overwritten.
|
3877
3968
|
*
|
3878
3969
|
* ```js
|
3879
|
-
* // select all cells in the table, including all headers
|
3970
|
+
* // select all cells in the table, including all headers and the corner cell
|
3880
3971
|
* hot.selectAll();
|
3881
3972
|
*
|
3973
|
+
* // select all cells in the table, including row headers but excluding the corner cell
|
3974
|
+
* hot.selectAll(true, false);
|
3975
|
+
*
|
3976
|
+
* // select all cells in the table, including all headers and the corner cell, but move the focus
|
3977
|
+
* // highlight to position -2, -1
|
3978
|
+
* hot.selectAll(-2, -1);
|
3979
|
+
*
|
3882
3980
|
* // select all cells in the table, without headers
|
3883
3981
|
* hot.selectAll(false);
|
3884
3982
|
* ```
|
@@ -3886,15 +3984,20 @@ export default function Core(rootElement, userSettings) {
|
|
3886
3984
|
* @since 0.38.2
|
3887
3985
|
* @memberof Core#
|
3888
3986
|
* @function selectAll
|
3889
|
-
* @param {boolean} [
|
3890
|
-
* `false
|
3987
|
+
* @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
|
3988
|
+
* `false` otherwise.
|
3989
|
+
* @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
|
3990
|
+
* headers, `false` otherwise.
|
3991
|
+
* @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
|
3992
|
+
* focus position. The value takes an object with a `row` and `col` properties (visual indexes)
|
3993
|
+
* from -N to N, where negative values point to the headers and positive values point to the cell range.
|
3891
3994
|
*/
|
3892
3995
|
this.selectAll = function () {
|
3893
|
-
let
|
3894
|
-
|
3895
|
-
|
3996
|
+
let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
3997
|
+
let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
|
3998
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3896
3999
|
preventScrollingToCell = true;
|
3897
|
-
selection.selectAll(includeRowHeaders, includeColumnHeaders);
|
4000
|
+
selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
|
3898
4001
|
preventScrollingToCell = false;
|
3899
4002
|
};
|
3900
4003
|
const getIndexToScroll = (indexMapper, visualIndex) => {
|
@@ -3952,6 +4055,34 @@ export default function Core(rootElement, userSettings) {
|
|
3952
4055
|
return false;
|
3953
4056
|
};
|
3954
4057
|
|
4058
|
+
/**
|
4059
|
+
* Scrolls the viewport to coordinates specified by the currently focused cell.
|
4060
|
+
*
|
4061
|
+
* @since 14.0.0
|
4062
|
+
* @memberof Core#
|
4063
|
+
* @function scrollToFocusedCell
|
4064
|
+
* @param {Function} callback The callback function to call after the viewport is scrolled.
|
4065
|
+
*/
|
4066
|
+
this.scrollToFocusedCell = function () {
|
4067
|
+
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
4068
|
+
if (!this.selection.isSelected()) {
|
4069
|
+
return;
|
4070
|
+
}
|
4071
|
+
this.addHookOnce('afterScroll', callback);
|
4072
|
+
const {
|
4073
|
+
highlight
|
4074
|
+
} = this.getSelectedRangeLast();
|
4075
|
+
const renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
|
4076
|
+
const renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
|
4077
|
+
const isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
4078
|
+
if (isScrolled) {
|
4079
|
+
this.view.render();
|
4080
|
+
} else {
|
4081
|
+
this.removeHook('afterScroll', callback);
|
4082
|
+
this._registerImmediate(() => callback());
|
4083
|
+
}
|
4084
|
+
};
|
4085
|
+
|
3955
4086
|
/**
|
3956
4087
|
* Removes the table from the DOM and destroys the instance of the Handsontable.
|
3957
4088
|
*
|
@@ -3972,6 +4103,7 @@ export default function Core(rootElement, userSettings) {
|
|
3972
4103
|
dataSource = null;
|
3973
4104
|
this.getShortcutManager().destroy();
|
3974
4105
|
metaManager.clearCache();
|
4106
|
+
foreignHotInstances.delete(this.guid);
|
3975
4107
|
if (isRootInstance(instance)) {
|
3976
4108
|
const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
|
3977
4109
|
if (licenseInfo) {
|
@@ -4295,6 +4427,16 @@ export default function Core(rootElement, userSettings) {
|
|
4295
4427
|
}
|
4296
4428
|
};
|
4297
4429
|
|
4430
|
+
/**
|
4431
|
+
* Gets the instance of the EditorManager.
|
4432
|
+
*
|
4433
|
+
* @private
|
4434
|
+
* @returns {EditorManager}
|
4435
|
+
*/
|
4436
|
+
this._getEditorManager = function () {
|
4437
|
+
return editorManager;
|
4438
|
+
};
|
4439
|
+
|
4298
4440
|
/**
|
4299
4441
|
* Check if currently it is RTL direction.
|
4300
4442
|
*
|
@@ -4367,270 +4509,11 @@ export default function Core(rootElement, userSettings) {
|
|
4367
4509
|
this.getShortcutManager = function () {
|
4368
4510
|
return shortcutManager;
|
4369
4511
|
};
|
4370
|
-
const gridContext = shortcutManager.addContext('grid');
|
4371
|
-
const gridConfig = {
|
4372
|
-
runOnlyIf: () => {
|
4373
|
-
return isDefined(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
|
4374
|
-
},
|
4375
|
-
group: SHORTCUTS_GROUP
|
4376
|
-
};
|
4377
|
-
shortcutManager.setActiveContextName('grid');
|
4378
|
-
gridContext.addShortcuts([{
|
4379
|
-
keys: [['Control/Meta', 'A']],
|
4380
|
-
callback: () => {
|
4381
|
-
instance.selectAll();
|
4382
|
-
}
|
4383
|
-
}, {
|
4384
|
-
keys: [['Control/Meta', 'Enter']],
|
4385
|
-
callback: () => {
|
4386
|
-
const selectedRange = instance.getSelectedRange();
|
4387
|
-
const {
|
4388
|
-
row: highlightRow,
|
4389
|
-
col: highlightColumn
|
4390
|
-
} = selectedRange[selectedRange.length - 1].highlight;
|
4391
|
-
const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
|
4392
|
-
const cellValues = new Map();
|
4393
|
-
for (let i = 0; i < selectedRange.length; i++) {
|
4394
|
-
selectedRange[i].forAll((row, column) => {
|
4395
|
-
if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
|
4396
|
-
const {
|
4397
|
-
readOnly
|
4398
|
-
} = instance.getCellMeta(row, column);
|
4399
|
-
if (!readOnly) {
|
4400
|
-
cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
|
4401
|
-
}
|
4402
|
-
}
|
4403
|
-
});
|
4404
|
-
}
|
4405
|
-
instance.setDataAtCell(Array.from(cellValues.values()));
|
4406
|
-
},
|
4407
|
-
runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
|
4408
|
-
}, {
|
4409
|
-
keys: [['ArrowUp']],
|
4410
|
-
callback: () => {
|
4411
|
-
selection.transformStart(-1, 0);
|
4412
|
-
}
|
4413
|
-
}, {
|
4414
|
-
keys: [['ArrowUp', 'Control/Meta']],
|
4415
|
-
captureCtrl: true,
|
4416
|
-
callback: () => {
|
4417
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
|
4418
|
-
}
|
4419
|
-
}, {
|
4420
|
-
keys: [['ArrowUp', 'Shift']],
|
4421
|
-
callback: () => {
|
4422
|
-
selection.transformEnd(-1, 0);
|
4423
|
-
}
|
4424
|
-
}, {
|
4425
|
-
keys: [['ArrowUp', 'Shift', 'Control/Meta']],
|
4426
|
-
captureCtrl: true,
|
4427
|
-
callback: () => {
|
4428
|
-
const {
|
4429
|
-
from,
|
4430
|
-
to
|
4431
|
-
} = instance.getSelectedRangeLast();
|
4432
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
4433
|
-
selection.setRangeStart(from.clone());
|
4434
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4435
|
-
},
|
4436
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4437
|
-
}, {
|
4438
|
-
keys: [['ArrowDown']],
|
4439
|
-
callback: () => {
|
4440
|
-
selection.transformStart(1, 0);
|
4441
|
-
}
|
4442
|
-
}, {
|
4443
|
-
keys: [['ArrowDown', 'Control/Meta']],
|
4444
|
-
captureCtrl: true,
|
4445
|
-
callback: () => {
|
4446
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
|
4447
|
-
}
|
4448
|
-
}, {
|
4449
|
-
keys: [['ArrowDown', 'Shift']],
|
4450
|
-
callback: () => {
|
4451
|
-
selection.transformEnd(1, 0);
|
4452
|
-
}
|
4453
|
-
}, {
|
4454
|
-
keys: [['ArrowDown', 'Shift', 'Control/Meta']],
|
4455
|
-
captureCtrl: true,
|
4456
|
-
callback: () => {
|
4457
|
-
const {
|
4458
|
-
from,
|
4459
|
-
to
|
4460
|
-
} = instance.getSelectedRangeLast();
|
4461
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
|
4462
|
-
selection.setRangeStart(from.clone());
|
4463
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4464
|
-
},
|
4465
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4466
|
-
}, {
|
4467
|
-
keys: [['ArrowLeft']],
|
4468
|
-
callback: () => {
|
4469
|
-
selection.transformStart(0, -1 * instance.getDirectionFactor());
|
4470
|
-
}
|
4471
|
-
}, {
|
4472
|
-
keys: [['ArrowLeft', 'Control/Meta']],
|
4473
|
-
captureCtrl: true,
|
4474
|
-
callback: () => {
|
4475
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4476
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4477
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4478
|
-
}
|
4479
|
-
}, {
|
4480
|
-
keys: [['ArrowLeft', 'Shift']],
|
4481
|
-
callback: () => {
|
4482
|
-
selection.transformEnd(0, -1 * instance.getDirectionFactor());
|
4483
|
-
}
|
4484
|
-
}, {
|
4485
|
-
keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
|
4486
|
-
captureCtrl: true,
|
4487
|
-
callback: () => {
|
4488
|
-
const {
|
4489
|
-
from,
|
4490
|
-
to
|
4491
|
-
} = instance.getSelectedRangeLast();
|
4492
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4493
|
-
selection.setRangeStart(from.clone());
|
4494
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4495
|
-
},
|
4496
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4497
|
-
}, {
|
4498
|
-
keys: [['ArrowRight']],
|
4499
|
-
callback: () => {
|
4500
|
-
selection.transformStart(0, instance.getDirectionFactor());
|
4501
|
-
}
|
4502
|
-
}, {
|
4503
|
-
keys: [['ArrowRight', 'Control/Meta']],
|
4504
|
-
captureCtrl: true,
|
4505
|
-
callback: () => {
|
4506
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4507
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4508
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4509
|
-
}
|
4510
|
-
}, {
|
4511
|
-
keys: [['ArrowRight', 'Shift']],
|
4512
|
-
callback: () => {
|
4513
|
-
selection.transformEnd(0, instance.getDirectionFactor());
|
4514
|
-
}
|
4515
|
-
}, {
|
4516
|
-
keys: [['ArrowRight', 'Shift', 'Control/Meta']],
|
4517
|
-
captureCtrl: true,
|
4518
|
-
callback: () => {
|
4519
|
-
const {
|
4520
|
-
from,
|
4521
|
-
to
|
4522
|
-
} = instance.getSelectedRangeLast();
|
4523
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4524
|
-
selection.setRangeStart(from.clone());
|
4525
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4526
|
-
},
|
4527
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4528
|
-
}, {
|
4529
|
-
keys: [['Home']],
|
4530
|
-
captureCtrl: true,
|
4531
|
-
callback: () => {
|
4532
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4533
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4534
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4535
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4536
|
-
},
|
4537
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4538
|
-
}, {
|
4539
|
-
keys: [['Home', 'Shift']],
|
4540
|
-
callback: () => {
|
4541
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
|
4542
|
-
}
|
4543
|
-
}, {
|
4544
|
-
keys: [['Home', 'Control/Meta']],
|
4545
|
-
captureCtrl: true,
|
4546
|
-
callback: () => {
|
4547
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
|
4548
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4549
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
|
4550
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4551
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4552
|
-
},
|
4553
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4554
|
-
}, {
|
4555
|
-
keys: [['End']],
|
4556
|
-
captureCtrl: true,
|
4557
|
-
callback: () => {
|
4558
|
-
selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4559
|
-
},
|
4560
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4561
|
-
}, {
|
4562
|
-
keys: [['End', 'Shift']],
|
4563
|
-
callback: () => {
|
4564
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4565
|
-
}
|
4566
|
-
}, {
|
4567
|
-
keys: [['End', 'Control/Meta']],
|
4568
|
-
captureCtrl: true,
|
4569
|
-
callback: () => {
|
4570
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
|
4571
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
|
4572
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
|
4573
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4574
|
-
},
|
4575
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4576
|
-
}, {
|
4577
|
-
keys: [['PageUp']],
|
4578
|
-
callback: () => {
|
4579
|
-
selection.transformStart(-instance.countVisibleRows(), 0);
|
4580
|
-
}
|
4581
|
-
}, {
|
4582
|
-
keys: [['PageUp', 'Shift']],
|
4583
|
-
callback: () => {
|
4584
|
-
const {
|
4585
|
-
to
|
4586
|
-
} = instance.getSelectedRangeLast();
|
4587
|
-
const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
|
4588
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
4589
|
-
if (row !== null) {
|
4590
|
-
const coords = instance._createCellCoords(row, to.col);
|
4591
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4592
|
-
const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
4593
|
-
selection.setRangeEnd(coords);
|
4594
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4595
|
-
}
|
4596
|
-
}
|
4597
|
-
}, {
|
4598
|
-
keys: [['PageDown']],
|
4599
|
-
callback: () => {
|
4600
|
-
selection.transformStart(instance.countVisibleRows(), 0);
|
4601
|
-
}
|
4602
|
-
}, {
|
4603
|
-
keys: [['PageDown', 'Shift']],
|
4604
|
-
callback: () => {
|
4605
|
-
const {
|
4606
|
-
to
|
4607
|
-
} = instance.getSelectedRangeLast();
|
4608
|
-
const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
|
4609
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
4610
|
-
if (row !== null) {
|
4611
|
-
const coords = instance._createCellCoords(row, to.col);
|
4612
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4613
|
-
const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
|
4614
|
-
selection.setRangeEnd(coords);
|
4615
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4616
|
-
}
|
4617
|
-
}
|
4618
|
-
}, {
|
4619
|
-
keys: [['Tab']],
|
4620
|
-
callback: event => {
|
4621
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4622
|
-
selection.transformStart(tabMoves.row, tabMoves.col, true);
|
4623
|
-
}
|
4624
|
-
}, {
|
4625
|
-
keys: [['Shift', 'Tab']],
|
4626
|
-
callback: event => {
|
4627
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4628
|
-
selection.transformStart(-tabMoves.row, -tabMoves.col);
|
4629
|
-
}
|
4630
|
-
}], gridConfig);
|
4631
4512
|
getPluginsNames().forEach(pluginName => {
|
4632
4513
|
const PluginClass = getPlugin(pluginName);
|
4633
4514
|
pluginsRegistry.addItem(pluginName, new PluginClass(this));
|
4634
4515
|
});
|
4516
|
+
registerAllShortcutContexts(instance);
|
4517
|
+
shortcutManager.setActiveContextName('grid');
|
4635
4518
|
Hooks.getSingleton().run(instance, 'construct');
|
4636
4519
|
}
|