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/index.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./focusCatcher/index.mjs";
|
package/core.d.ts
CHANGED
@@ -45,6 +45,8 @@ export default class Core {
|
|
45
45
|
countSourceRows(): number;
|
46
46
|
countVisibleCols(): number;
|
47
47
|
countVisibleRows(): number;
|
48
|
+
countRowHeaders(): number;
|
49
|
+
countColHeaders(): number;
|
48
50
|
deselectCell(): void;
|
49
51
|
destroy(): void;
|
50
52
|
destroyEditor(revertOriginal?: boolean, prepareEditorIfNeeded?: boolean): void;
|
@@ -129,12 +131,13 @@ export default class Core {
|
|
129
131
|
rowIndexMapper: IndexMapper;
|
130
132
|
runHooks(key: keyof Events, p1?: any, p2?: any, p3?: any, p4?: any, p5?: any, p6?: any): any;
|
131
133
|
scrollViewportTo(row?: number, column?: number, snapToBottom?: boolean, snapToRight?: boolean, considerHiddenIndexes?: boolean): boolean;
|
132
|
-
|
134
|
+
scrollToFocusedCell(callback?: () => void): void;
|
135
|
+
selectAll(includeRowHeaders?: boolean, includeColumnHeaders?: boolean, focusPosition?: { row?: number, col?: number }): void;
|
133
136
|
selectCell(row: number, col: number, endRow?: number, endCol?: number, scrollToCell?: boolean, changeListener?: boolean): boolean;
|
134
137
|
selectCellByProp(row: number, prop: string, endRow?: number, endProp?: string, scrollToCell?: boolean): boolean;
|
135
138
|
selectCells(coords: Array<[number, number | string, number, number | string]> | CellRange[], scrollToCell?: boolean, changeListener?: boolean): boolean;
|
136
|
-
selectColumns(startColumn: number | string, endColumn?: number | string): boolean;
|
137
|
-
selectRows(startRow: number, endRow?: number): boolean;
|
139
|
+
selectColumns(startColumn: number | string, endColumn?: number | string, focusPosition?: number): boolean;
|
140
|
+
selectRows(startRow: number, endRow?: number, focusPosition?: number): boolean;
|
138
141
|
setCellMeta(row: number, col: number, key: string, val: any): void;
|
139
142
|
setCellMeta<K extends keyof CellMeta>(row: number, col: number, key: K, val: CellMeta[K]): void;
|
140
143
|
setCellMetaObject(row: number, col: number, prop: CellMeta): void;
|
package/core.js
CHANGED
@@ -31,12 +31,22 @@ var _registry5 = require("./i18n/registry");
|
|
31
31
|
var _utils = require("./i18n/utils");
|
32
32
|
var _selection = require("./selection");
|
33
33
|
var _dataMap = require("./dataMap");
|
34
|
+
var _index3 = require("./core/index");
|
34
35
|
var _uniqueMap = require("./utils/dataStructures/uniqueMap");
|
35
36
|
var _shortcuts = require("./shortcuts");
|
37
|
+
var _shortcutContexts = require("./shortcutContexts");
|
36
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
|
-
const SHORTCUTS_GROUP = 'gridDefault';
|
38
39
|
let activeGuid = null;
|
39
40
|
|
41
|
+
/**
|
42
|
+
* Keeps the collection of the all Handsontable instances created on the same page. The
|
43
|
+
* list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
|
44
|
+
* called on another instance.
|
45
|
+
*
|
46
|
+
* @type {Map<string, Core>}
|
47
|
+
*/
|
48
|
+
const foreignHotInstances = new Map();
|
49
|
+
|
40
50
|
/**
|
41
51
|
* A set of deprecated feature names.
|
42
52
|
*
|
@@ -96,7 +106,8 @@ const deprecationWarns = new Set();
|
|
96
106
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
97
107
|
*/
|
98
108
|
function Core(rootElement, userSettings) {
|
99
|
-
var _userSettings$layoutD
|
109
|
+
var _userSettings$layoutD,
|
110
|
+
_this = this;
|
100
111
|
let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
101
112
|
let preventScrollingToCell = false;
|
102
113
|
let instance = this;
|
@@ -213,6 +224,8 @@ function Core(rootElement, userSettings) {
|
|
213
224
|
}
|
214
225
|
this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
|
215
226
|
|
227
|
+
foreignHotInstances.set(this.guid, this);
|
228
|
+
|
216
229
|
/**
|
217
230
|
* Instance of index mapper which is responsible for managing the column indexes.
|
218
231
|
*
|
@@ -261,14 +274,16 @@ function Core(rootElement, userSettings) {
|
|
261
274
|
};
|
262
275
|
|
263
276
|
let selection = new _selection.Selection(tableMeta, {
|
264
|
-
rowIndexMapper:
|
265
|
-
columnIndexMapper:
|
277
|
+
rowIndexMapper: instance.rowIndexMapper,
|
278
|
+
columnIndexMapper: instance.columnIndexMapper,
|
266
279
|
countCols: () => instance.countCols(),
|
267
280
|
countRows: () => instance.countRows(),
|
268
281
|
propToCol: prop => datamap.propToCol(prop),
|
269
282
|
isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
|
270
|
-
|
271
|
-
|
283
|
+
countRenderableColumns: () => this.view.countRenderableColumns(),
|
284
|
+
countRenderableRows: () => this.view.countRenderableRows(),
|
285
|
+
countRowHeaders: () => this.countRowHeaders(),
|
286
|
+
countColHeaders: () => this.countColHeaders(),
|
272
287
|
getShortcutManager: () => instance.getShortcutManager(),
|
273
288
|
createCellCoords: (row, column) => instance._createCellCoords(row, column),
|
274
289
|
createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
|
@@ -295,12 +310,6 @@ function Core(rootElement, userSettings) {
|
|
295
310
|
});
|
296
311
|
this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
|
297
312
|
this.runHooks('beforeSetRangeEnd', cellCoords);
|
298
|
-
if (cellCoords.row < 0) {
|
299
|
-
cellCoords.row = this.view._wt.wtTable.getFirstVisibleRow();
|
300
|
-
}
|
301
|
-
if (cellCoords.col < 0) {
|
302
|
-
cellCoords.col = this.view._wt.wtTable.getFirstVisibleColumn();
|
303
|
-
}
|
304
313
|
});
|
305
314
|
this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
|
306
315
|
const preventScrolling = (0, _object.createObjectPropListener)(false);
|
@@ -327,7 +336,14 @@ function Core(rootElement, userSettings) {
|
|
327
336
|
if (scrollToCell !== false) {
|
328
337
|
if (!isSelectedByAnyHeader) {
|
329
338
|
if (currentSelectedRange && !this.selection.isMultiple()) {
|
330
|
-
|
339
|
+
const renderableCoords = visualToRenderableCoords(currentSelectedRange.from);
|
340
|
+
if (renderableCoords.row < 0 && renderableCoords.col >= 0) {
|
341
|
+
this.view.scrollViewportHorizontally(renderableCoords.col);
|
342
|
+
} else if (renderableCoords.col < 0 && renderableCoords.row >= 0) {
|
343
|
+
this.view.scrollViewportVertically(renderableCoords.row);
|
344
|
+
} else {
|
345
|
+
this.view.scrollViewport(renderableCoords);
|
346
|
+
}
|
331
347
|
} else {
|
332
348
|
this.view.scrollViewport(visualToRenderableCoords(cellCoords));
|
333
349
|
}
|
@@ -369,6 +385,30 @@ function Core(rootElement, userSettings) {
|
|
369
385
|
isMultiple.value = changedIsMultiple;
|
370
386
|
}
|
371
387
|
});
|
388
|
+
this.selection.addLocalHook('beforeSelectColumns', function () {
|
389
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
390
|
+
args[_key] = arguments[_key];
|
391
|
+
}
|
392
|
+
return _this.runHooks('beforeSelectColumns', ...args);
|
393
|
+
});
|
394
|
+
this.selection.addLocalHook('afterSelectColumns', function () {
|
395
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
396
|
+
args[_key2] = arguments[_key2];
|
397
|
+
}
|
398
|
+
return _this.runHooks('afterSelectColumns', ...args);
|
399
|
+
});
|
400
|
+
this.selection.addLocalHook('beforeSelectRows', function () {
|
401
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
402
|
+
args[_key3] = arguments[_key3];
|
403
|
+
}
|
404
|
+
return _this.runHooks('beforeSelectRows', ...args);
|
405
|
+
});
|
406
|
+
this.selection.addLocalHook('afterSelectRows', function () {
|
407
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
408
|
+
args[_key4] = arguments[_key4];
|
409
|
+
}
|
410
|
+
return _this.runHooks('afterSelectRows', ...args);
|
411
|
+
});
|
372
412
|
this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
|
373
413
|
this.runHooks('modifyTransformStart', cellCoordsDelta);
|
374
414
|
});
|
@@ -1018,6 +1058,9 @@ function Core(rootElement, userSettings) {
|
|
1018
1058
|
this.updateSettings(tableMeta, true);
|
1019
1059
|
this.view = new _tableView.default(this);
|
1020
1060
|
editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
|
1061
|
+
if ((0, _rootInstance.isRootInstance)(this)) {
|
1062
|
+
(0, _index3.installFocusCatcher)(instance);
|
1063
|
+
}
|
1021
1064
|
instance.runHooks('init');
|
1022
1065
|
this.forceFullRender = true; // used when data was changed
|
1023
1066
|
this.view.render();
|
@@ -1431,6 +1474,11 @@ function Core(rootElement, userSettings) {
|
|
1431
1474
|
*/
|
1432
1475
|
this.listen = function () {
|
1433
1476
|
if (instance && !instance.isListening()) {
|
1477
|
+
foreignHotInstances.forEach(foreignHot => {
|
1478
|
+
if (instance !== foreignHot) {
|
1479
|
+
foreignHot.unlisten();
|
1480
|
+
}
|
1481
|
+
});
|
1434
1482
|
activeGuid = instance.guid;
|
1435
1483
|
instance.runHooks('afterListen');
|
1436
1484
|
}
|
@@ -1515,8 +1563,8 @@ function Core(rootElement, userSettings) {
|
|
1515
1563
|
* @returns {Array} Returns removed portion of columns.
|
1516
1564
|
*/
|
1517
1565
|
this.spliceCol = function (column, index, amount) {
|
1518
|
-
for (var
|
1519
|
-
elements[
|
1566
|
+
for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
1567
|
+
elements[_key5 - 3] = arguments[_key5];
|
1520
1568
|
}
|
1521
1569
|
return datamap.spliceCol(column, index, amount, ...elements);
|
1522
1570
|
};
|
@@ -1533,8 +1581,8 @@ function Core(rootElement, userSettings) {
|
|
1533
1581
|
* @returns {Array} Returns removed portion of rows.
|
1534
1582
|
*/
|
1535
1583
|
this.spliceRow = function (row, index, amount) {
|
1536
|
-
for (var
|
1537
|
-
elements[
|
1584
|
+
for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
1585
|
+
elements[_key6 - 3] = arguments[_key6];
|
1538
1586
|
}
|
1539
1587
|
return datamap.spliceRow(row, index, amount, ...elements);
|
1540
1588
|
};
|
@@ -1631,6 +1679,9 @@ function Core(rootElement, userSettings) {
|
|
1631
1679
|
}
|
1632
1680
|
const changes = [];
|
1633
1681
|
(0, _array.arrayEach)(selection.getSelectedRange(), cellRange => {
|
1682
|
+
if (cellRange.isSingleHeader()) {
|
1683
|
+
return;
|
1684
|
+
}
|
1634
1685
|
const topStart = cellRange.getTopStartCorner();
|
1635
1686
|
const bottomEnd = cellRange.getBottomEndCorner();
|
1636
1687
|
(0, _number.rangeEach)(topStart.row, bottomEnd.row, row => {
|
@@ -2928,8 +2979,8 @@ function Core(rootElement, userSettings) {
|
|
2928
2979
|
*/
|
2929
2980
|
this.spliceCellsMeta = function (visualIndex) {
|
2930
2981
|
let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
2931
|
-
for (var
|
2932
|
-
cellMetaRows[
|
2982
|
+
for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
|
2983
|
+
cellMetaRows[_key7 - 2] = arguments[_key7];
|
2933
2984
|
}
|
2934
2985
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
2935
2986
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
@@ -3620,6 +3671,30 @@ function Core(rootElement, userSettings) {
|
|
3620
3671
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
|
3621
3672
|
};
|
3622
3673
|
|
3674
|
+
/**
|
3675
|
+
* Returns the number of rendered row headers.
|
3676
|
+
*
|
3677
|
+
* @since 14.0.0
|
3678
|
+
* @memberof Core#
|
3679
|
+
* @function countRowHeaders
|
3680
|
+
* @returns {number} Number of row headers.
|
3681
|
+
*/
|
3682
|
+
this.countRowHeaders = function () {
|
3683
|
+
return this.view.getRowHeadersCount();
|
3684
|
+
};
|
3685
|
+
|
3686
|
+
/**
|
3687
|
+
* Returns the number of rendered column headers.
|
3688
|
+
*
|
3689
|
+
* @since 14.0.0
|
3690
|
+
* @memberof Core#
|
3691
|
+
* @function countColHeaders
|
3692
|
+
* @returns {number} Number of column headers.
|
3693
|
+
*/
|
3694
|
+
this.countColHeaders = function () {
|
3695
|
+
return this.view.getColumnHeadersCount();
|
3696
|
+
};
|
3697
|
+
|
3623
3698
|
/**
|
3624
3699
|
* Returns the number of empty rows. If the optional ending parameter is `true`, returns the
|
3625
3700
|
* number of empty rows at the bottom of the table.
|
@@ -3824,6 +3899,10 @@ function Core(rootElement, userSettings) {
|
|
3824
3899
|
* hot.selectColumns('id');
|
3825
3900
|
* // Select range of columns using visual indexes.
|
3826
3901
|
* hot.selectColumns(1, 4);
|
3902
|
+
* // Select range of columns using visual indexes and mark the first header as highlighted.
|
3903
|
+
* hot.selectColumns(1, 2, -1);
|
3904
|
+
* // Select range of columns using visual indexes and mark the second cell as highlighted.
|
3905
|
+
* hot.selectColumns(2, 1, 1);
|
3827
3906
|
* // Select range of columns using column properties.
|
3828
3907
|
* hot.selectColumns('id', 'last_name');
|
3829
3908
|
* ```
|
@@ -3834,11 +3913,15 @@ function Core(rootElement, userSettings) {
|
|
3834
3913
|
* @param {number} startColumn The visual column index from which the selection starts.
|
3835
3914
|
* @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
|
3836
3915
|
* is not defined the column defined by `startColumn` will be selected.
|
3916
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3917
|
+
* The value can take visual row index from -N to N, where negative values
|
3918
|
+
* point to the headers and positive values point to the cell range.
|
3837
3919
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3838
3920
|
*/
|
3839
3921
|
this.selectColumns = function (startColumn) {
|
3840
3922
|
let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
3841
|
-
|
3923
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3924
|
+
return selection.selectColumns(startColumn, endColumn, focusPosition);
|
3842
3925
|
};
|
3843
3926
|
|
3844
3927
|
/**
|
@@ -3848,8 +3931,12 @@ function Core(rootElement, userSettings) {
|
|
3848
3931
|
* ```js
|
3849
3932
|
* // Select row using visual index.
|
3850
3933
|
* hot.selectRows(1);
|
3851
|
-
* //
|
3934
|
+
* // select a range of rows, using visual indexes.
|
3852
3935
|
* hot.selectRows(1, 4);
|
3936
|
+
* // select a range of rows, using visual indexes, and mark the header as highlighted.
|
3937
|
+
* hot.selectRows(1, 2, -1);
|
3938
|
+
* // Select range of rows using visual indexes and mark the second cell as highlighted.
|
3939
|
+
* hot.selectRows(2, 1, 1);
|
3853
3940
|
* ```
|
3854
3941
|
*
|
3855
3942
|
* @memberof Core#
|
@@ -3858,11 +3945,15 @@ function Core(rootElement, userSettings) {
|
|
3858
3945
|
* @param {number} startRow The visual row index from which the selection starts.
|
3859
3946
|
* @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
|
3860
3947
|
* is not defined the row defined by `startRow` will be selected.
|
3948
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3949
|
+
* The value can take visual column index from -N to N, where negative values
|
3950
|
+
* point to the headers and positive values point to the cell range.
|
3861
3951
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3862
3952
|
*/
|
3863
3953
|
this.selectRows = function (startRow) {
|
3864
3954
|
let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
3865
|
-
|
3955
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3956
|
+
return selection.selectRows(startRow, endRow, focusPosition);
|
3866
3957
|
};
|
3867
3958
|
|
3868
3959
|
/**
|
@@ -3881,9 +3972,16 @@ function Core(rootElement, userSettings) {
|
|
3881
3972
|
* The previous selection is overwritten.
|
3882
3973
|
*
|
3883
3974
|
* ```js
|
3884
|
-
* // select all cells in the table, including all headers
|
3975
|
+
* // select all cells in the table, including all headers and the corner cell
|
3885
3976
|
* hot.selectAll();
|
3886
3977
|
*
|
3978
|
+
* // select all cells in the table, including row headers but excluding the corner cell
|
3979
|
+
* hot.selectAll(true, false);
|
3980
|
+
*
|
3981
|
+
* // select all cells in the table, including all headers and the corner cell, but move the focus
|
3982
|
+
* // highlight to position -2, -1
|
3983
|
+
* hot.selectAll(-2, -1);
|
3984
|
+
*
|
3887
3985
|
* // select all cells in the table, without headers
|
3888
3986
|
* hot.selectAll(false);
|
3889
3987
|
* ```
|
@@ -3891,15 +3989,20 @@ function Core(rootElement, userSettings) {
|
|
3891
3989
|
* @since 0.38.2
|
3892
3990
|
* @memberof Core#
|
3893
3991
|
* @function selectAll
|
3894
|
-
* @param {boolean} [
|
3895
|
-
* `false
|
3992
|
+
* @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
|
3993
|
+
* `false` otherwise.
|
3994
|
+
* @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
|
3995
|
+
* headers, `false` otherwise.
|
3996
|
+
* @param {{row: number, col: number}} [focusPosition] The argument allows changing the cell/header
|
3997
|
+
* focus position. The value takes an object with a `row` and `col` properties (visual indexes)
|
3998
|
+
* from -N to N, where negative values point to the headers and positive values point to the cell range.
|
3896
3999
|
*/
|
3897
4000
|
this.selectAll = function () {
|
3898
|
-
let
|
3899
|
-
|
3900
|
-
|
4001
|
+
let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
4002
|
+
let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
|
4003
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3901
4004
|
preventScrollingToCell = true;
|
3902
|
-
selection.selectAll(includeRowHeaders, includeColumnHeaders);
|
4005
|
+
selection.selectAll(includeRowHeaders, includeColumnHeaders, focusPosition);
|
3903
4006
|
preventScrollingToCell = false;
|
3904
4007
|
};
|
3905
4008
|
const getIndexToScroll = (indexMapper, visualIndex) => {
|
@@ -3957,6 +4060,34 @@ function Core(rootElement, userSettings) {
|
|
3957
4060
|
return false;
|
3958
4061
|
};
|
3959
4062
|
|
4063
|
+
/**
|
4064
|
+
* Scrolls the viewport to coordinates specified by the currently focused cell.
|
4065
|
+
*
|
4066
|
+
* @since 14.0.0
|
4067
|
+
* @memberof Core#
|
4068
|
+
* @function scrollToFocusedCell
|
4069
|
+
* @param {Function} callback The callback function to call after the viewport is scrolled.
|
4070
|
+
*/
|
4071
|
+
this.scrollToFocusedCell = function () {
|
4072
|
+
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
4073
|
+
if (!this.selection.isSelected()) {
|
4074
|
+
return;
|
4075
|
+
}
|
4076
|
+
this.addHookOnce('afterScroll', callback);
|
4077
|
+
const {
|
4078
|
+
highlight
|
4079
|
+
} = this.getSelectedRangeLast();
|
4080
|
+
const renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(highlight.row);
|
4081
|
+
const renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(highlight.col);
|
4082
|
+
const isScrolled = this.view.scrollViewport(this._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
4083
|
+
if (isScrolled) {
|
4084
|
+
this.view.render();
|
4085
|
+
} else {
|
4086
|
+
this.removeHook('afterScroll', callback);
|
4087
|
+
this._registerImmediate(() => callback());
|
4088
|
+
}
|
4089
|
+
};
|
4090
|
+
|
3960
4091
|
/**
|
3961
4092
|
* Removes the table from the DOM and destroys the instance of the Handsontable.
|
3962
4093
|
*
|
@@ -3977,6 +4108,7 @@ function Core(rootElement, userSettings) {
|
|
3977
4108
|
dataSource = null;
|
3978
4109
|
this.getShortcutManager().destroy();
|
3979
4110
|
metaManager.clearCache();
|
4111
|
+
foreignHotInstances.delete(this.guid);
|
3980
4112
|
if ((0, _rootInstance.isRootInstance)(instance)) {
|
3981
4113
|
const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
|
3982
4114
|
if (licenseInfo) {
|
@@ -4300,6 +4432,16 @@ function Core(rootElement, userSettings) {
|
|
4300
4432
|
}
|
4301
4433
|
};
|
4302
4434
|
|
4435
|
+
/**
|
4436
|
+
* Gets the instance of the EditorManager.
|
4437
|
+
*
|
4438
|
+
* @private
|
4439
|
+
* @returns {EditorManager}
|
4440
|
+
*/
|
4441
|
+
this._getEditorManager = function () {
|
4442
|
+
return editorManager;
|
4443
|
+
};
|
4444
|
+
|
4303
4445
|
/**
|
4304
4446
|
* Check if currently it is RTL direction.
|
4305
4447
|
*
|
@@ -4372,270 +4514,11 @@ function Core(rootElement, userSettings) {
|
|
4372
4514
|
this.getShortcutManager = function () {
|
4373
4515
|
return shortcutManager;
|
4374
4516
|
};
|
4375
|
-
const gridContext = shortcutManager.addContext('grid');
|
4376
|
-
const gridConfig = {
|
4377
|
-
runOnlyIf: () => {
|
4378
|
-
return (0, _mixed.isDefined)(instance.getSelected()) && instance.countRenderedRows() > 0 && instance.countRenderedCols() > 0;
|
4379
|
-
},
|
4380
|
-
group: SHORTCUTS_GROUP
|
4381
|
-
};
|
4382
|
-
shortcutManager.setActiveContextName('grid');
|
4383
|
-
gridContext.addShortcuts([{
|
4384
|
-
keys: [['Control/Meta', 'A']],
|
4385
|
-
callback: () => {
|
4386
|
-
instance.selectAll();
|
4387
|
-
}
|
4388
|
-
}, {
|
4389
|
-
keys: [['Control/Meta', 'Enter']],
|
4390
|
-
callback: () => {
|
4391
|
-
const selectedRange = instance.getSelectedRange();
|
4392
|
-
const {
|
4393
|
-
row: highlightRow,
|
4394
|
-
col: highlightColumn
|
4395
|
-
} = selectedRange[selectedRange.length - 1].highlight;
|
4396
|
-
const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
|
4397
|
-
const cellValues = new Map();
|
4398
|
-
for (let i = 0; i < selectedRange.length; i++) {
|
4399
|
-
selectedRange[i].forAll((row, column) => {
|
4400
|
-
if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
|
4401
|
-
const {
|
4402
|
-
readOnly
|
4403
|
-
} = instance.getCellMeta(row, column);
|
4404
|
-
if (!readOnly) {
|
4405
|
-
cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
|
4406
|
-
}
|
4407
|
-
}
|
4408
|
-
});
|
4409
|
-
}
|
4410
|
-
instance.setDataAtCell(Array.from(cellValues.values()));
|
4411
|
-
},
|
4412
|
-
runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
|
4413
|
-
}, {
|
4414
|
-
keys: [['ArrowUp']],
|
4415
|
-
callback: () => {
|
4416
|
-
selection.transformStart(-1, 0);
|
4417
|
-
}
|
4418
|
-
}, {
|
4419
|
-
keys: [['ArrowUp', 'Control/Meta']],
|
4420
|
-
captureCtrl: true,
|
4421
|
-
callback: () => {
|
4422
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
|
4423
|
-
}
|
4424
|
-
}, {
|
4425
|
-
keys: [['ArrowUp', 'Shift']],
|
4426
|
-
callback: () => {
|
4427
|
-
selection.transformEnd(-1, 0);
|
4428
|
-
}
|
4429
|
-
}, {
|
4430
|
-
keys: [['ArrowUp', 'Shift', 'Control/Meta']],
|
4431
|
-
captureCtrl: true,
|
4432
|
-
callback: () => {
|
4433
|
-
const {
|
4434
|
-
from,
|
4435
|
-
to
|
4436
|
-
} = instance.getSelectedRangeLast();
|
4437
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
4438
|
-
selection.setRangeStart(from.clone());
|
4439
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4440
|
-
},
|
4441
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4442
|
-
}, {
|
4443
|
-
keys: [['ArrowDown']],
|
4444
|
-
callback: () => {
|
4445
|
-
selection.transformStart(1, 0);
|
4446
|
-
}
|
4447
|
-
}, {
|
4448
|
-
keys: [['ArrowDown', 'Control/Meta']],
|
4449
|
-
captureCtrl: true,
|
4450
|
-
callback: () => {
|
4451
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
|
4452
|
-
}
|
4453
|
-
}, {
|
4454
|
-
keys: [['ArrowDown', 'Shift']],
|
4455
|
-
callback: () => {
|
4456
|
-
selection.transformEnd(1, 0);
|
4457
|
-
}
|
4458
|
-
}, {
|
4459
|
-
keys: [['ArrowDown', 'Shift', 'Control/Meta']],
|
4460
|
-
captureCtrl: true,
|
4461
|
-
callback: () => {
|
4462
|
-
const {
|
4463
|
-
from,
|
4464
|
-
to
|
4465
|
-
} = instance.getSelectedRangeLast();
|
4466
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
|
4467
|
-
selection.setRangeStart(from.clone());
|
4468
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4469
|
-
},
|
4470
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4471
|
-
}, {
|
4472
|
-
keys: [['ArrowLeft']],
|
4473
|
-
callback: () => {
|
4474
|
-
selection.transformStart(0, -1 * instance.getDirectionFactor());
|
4475
|
-
}
|
4476
|
-
}, {
|
4477
|
-
keys: [['ArrowLeft', 'Control/Meta']],
|
4478
|
-
captureCtrl: true,
|
4479
|
-
callback: () => {
|
4480
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4481
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4482
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4483
|
-
}
|
4484
|
-
}, {
|
4485
|
-
keys: [['ArrowLeft', 'Shift']],
|
4486
|
-
callback: () => {
|
4487
|
-
selection.transformEnd(0, -1 * instance.getDirectionFactor());
|
4488
|
-
}
|
4489
|
-
}, {
|
4490
|
-
keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
|
4491
|
-
captureCtrl: true,
|
4492
|
-
callback: () => {
|
4493
|
-
const {
|
4494
|
-
from,
|
4495
|
-
to
|
4496
|
-
} = instance.getSelectedRangeLast();
|
4497
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4498
|
-
selection.setRangeStart(from.clone());
|
4499
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4500
|
-
},
|
4501
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4502
|
-
}, {
|
4503
|
-
keys: [['ArrowRight']],
|
4504
|
-
callback: () => {
|
4505
|
-
selection.transformStart(0, instance.getDirectionFactor());
|
4506
|
-
}
|
4507
|
-
}, {
|
4508
|
-
keys: [['ArrowRight', 'Control/Meta']],
|
4509
|
-
captureCtrl: true,
|
4510
|
-
callback: () => {
|
4511
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4512
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4513
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4514
|
-
}
|
4515
|
-
}, {
|
4516
|
-
keys: [['ArrowRight', 'Shift']],
|
4517
|
-
callback: () => {
|
4518
|
-
selection.transformEnd(0, instance.getDirectionFactor());
|
4519
|
-
}
|
4520
|
-
}, {
|
4521
|
-
keys: [['ArrowRight', 'Shift', 'Control/Meta']],
|
4522
|
-
captureCtrl: true,
|
4523
|
-
callback: () => {
|
4524
|
-
const {
|
4525
|
-
from,
|
4526
|
-
to
|
4527
|
-
} = instance.getSelectedRangeLast();
|
4528
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4529
|
-
selection.setRangeStart(from.clone());
|
4530
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4531
|
-
},
|
4532
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4533
|
-
}, {
|
4534
|
-
keys: [['Home']],
|
4535
|
-
captureCtrl: true,
|
4536
|
-
callback: () => {
|
4537
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4538
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4539
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4540
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4541
|
-
},
|
4542
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4543
|
-
}, {
|
4544
|
-
keys: [['Home', 'Shift']],
|
4545
|
-
callback: () => {
|
4546
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
|
4547
|
-
}
|
4548
|
-
}, {
|
4549
|
-
keys: [['Home', 'Control/Meta']],
|
4550
|
-
captureCtrl: true,
|
4551
|
-
callback: () => {
|
4552
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
|
4553
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4554
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
|
4555
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4556
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4557
|
-
},
|
4558
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4559
|
-
}, {
|
4560
|
-
keys: [['End']],
|
4561
|
-
captureCtrl: true,
|
4562
|
-
callback: () => {
|
4563
|
-
selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4564
|
-
},
|
4565
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4566
|
-
}, {
|
4567
|
-
keys: [['End', 'Shift']],
|
4568
|
-
callback: () => {
|
4569
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4570
|
-
}
|
4571
|
-
}, {
|
4572
|
-
keys: [['End', 'Control/Meta']],
|
4573
|
-
captureCtrl: true,
|
4574
|
-
callback: () => {
|
4575
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
|
4576
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
|
4577
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
|
4578
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4579
|
-
},
|
4580
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4581
|
-
}, {
|
4582
|
-
keys: [['PageUp']],
|
4583
|
-
callback: () => {
|
4584
|
-
selection.transformStart(-instance.countVisibleRows(), 0);
|
4585
|
-
}
|
4586
|
-
}, {
|
4587
|
-
keys: [['PageUp', 'Shift']],
|
4588
|
-
callback: () => {
|
4589
|
-
const {
|
4590
|
-
to
|
4591
|
-
} = instance.getSelectedRangeLast();
|
4592
|
-
const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
|
4593
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
4594
|
-
if (row !== null) {
|
4595
|
-
const coords = instance._createCellCoords(row, to.col);
|
4596
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4597
|
-
const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
4598
|
-
selection.setRangeEnd(coords);
|
4599
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4600
|
-
}
|
4601
|
-
}
|
4602
|
-
}, {
|
4603
|
-
keys: [['PageDown']],
|
4604
|
-
callback: () => {
|
4605
|
-
selection.transformStart(instance.countVisibleRows(), 0);
|
4606
|
-
}
|
4607
|
-
}, {
|
4608
|
-
keys: [['PageDown', 'Shift']],
|
4609
|
-
callback: () => {
|
4610
|
-
const {
|
4611
|
-
to
|
4612
|
-
} = instance.getSelectedRangeLast();
|
4613
|
-
const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
|
4614
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
4615
|
-
if (row !== null) {
|
4616
|
-
const coords = instance._createCellCoords(row, to.col);
|
4617
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4618
|
-
const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
|
4619
|
-
selection.setRangeEnd(coords);
|
4620
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4621
|
-
}
|
4622
|
-
}
|
4623
|
-
}, {
|
4624
|
-
keys: [['Tab']],
|
4625
|
-
callback: event => {
|
4626
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4627
|
-
selection.transformStart(tabMoves.row, tabMoves.col, true);
|
4628
|
-
}
|
4629
|
-
}, {
|
4630
|
-
keys: [['Shift', 'Tab']],
|
4631
|
-
callback: event => {
|
4632
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4633
|
-
selection.transformStart(-tabMoves.row, -tabMoves.col);
|
4634
|
-
}
|
4635
|
-
}], gridConfig);
|
4636
4517
|
(0, _registry.getPluginsNames)().forEach(pluginName => {
|
4637
4518
|
const PluginClass = (0, _registry.getPlugin)(pluginName);
|
4638
4519
|
pluginsRegistry.addItem(pluginName, new PluginClass(this));
|
4639
4520
|
});
|
4521
|
+
(0, _shortcutContexts.registerAllShortcutContexts)(instance);
|
4522
|
+
shortcutManager.setActiveContextName('grid');
|
4640
4523
|
_pluginHooks.default.getSingleton().run(instance, 'construct');
|
4641
4524
|
}
|