handsontable 0.0.0-next-010265d-20231005 → 0.0.0-next-9379dd1-20231020
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 +12 -10
- package/3rdparty/walkontable/src/event.mjs +12 -10
- 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 +13 -2
- package/3rdparty/walkontable/src/overlay/_base.mjs +14 -3
- 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/renderer/cells.js +10 -0
- package/3rdparty/walkontable/src/renderer/cells.mjs +11 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +10 -0
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +11 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +5 -0
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/rows.js +13 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +13 -0
- package/3rdparty/walkontable/src/renderer/table.js +9 -0
- package/3rdparty/walkontable/src/renderer/table.mjs +9 -0
- package/3rdparty/walkontable/src/scroll.js +2 -0
- package/3rdparty/walkontable/src/scroll.mjs +2 -0
- 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 +274 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +269 -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/settings.js +13 -4
- package/3rdparty/walkontable/src/settings.mjs +13 -4
- 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 +19 -78
- package/3rdparty/walkontable/src/table.mjs +20 -79
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/dateType/dateType.d.ts +3 -3
- package/cellTypes/dateType/dateType.js +2 -2
- package/cellTypes/dateType/dateType.mjs +2 -2
- package/cellTypes/handsontableType/handsontableType.d.ts +3 -3
- package/cellTypes/handsontableType/handsontableType.js +2 -2
- package/cellTypes/handsontableType/handsontableType.mjs +2 -2
- package/cellTypes/index.d.ts +3 -0
- package/cellTypes/index.js +4 -0
- package/cellTypes/index.mjs +3 -1
- package/cellTypes/selectType/index.d.ts +1 -0
- package/cellTypes/selectType/index.js +6 -0
- package/cellTypes/selectType/index.mjs +1 -0
- package/cellTypes/selectType/selectType.d.ts +14 -0
- package/cellTypes/selectType/selectType.js +13 -0
- package/cellTypes/selectType/selectType.mjs +8 -0
- package/core/focusCatcher/focusDetector.js +63 -0
- package/core/focusCatcher/focusDetector.mjs +59 -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 +9 -4
- package/core.js +285 -327
- package/core.mjs +285 -327
- package/dataMap/metaManager/metaSchema.js +65 -0
- package/dataMap/metaManager/metaSchema.mjs +65 -0
- package/dataMap/metaManager/mods/extendMetaProperties.js +7 -1
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +7 -1
- package/dataMap/replaceData.js +5 -0
- package/dataMap/replaceData.mjs +5 -0
- package/dist/handsontable.css +40 -5
- package/dist/handsontable.full.css +40 -5
- package/dist/handsontable.full.js +11744 -6945
- package/dist/handsontable.full.min.css +4 -4
- package/dist/handsontable.full.min.js +141 -141
- package/dist/handsontable.js +14036 -9237
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +21 -21
- package/dist/languages/all.js +6 -2
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/en-US.js +3 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/pl-PL.js +3 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/editorManager.js +15 -87
- package/editorManager.mjs +16 -87
- package/editors/autocompleteEditor/autocompleteEditor.js +53 -2
- package/editors/autocompleteEditor/autocompleteEditor.mjs +54 -3
- package/editors/dateEditor/dateEditor.js +26 -7
- package/editors/dateEditor/dateEditor.mjs +27 -8
- package/editors/handsontableEditor/handsontableEditor.js +9 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +10 -2
- package/editors/textEditor/textEditor.js +19 -27
- package/editors/textEditor/textEditor.mjs +22 -30
- package/focusManager.d.ts +12 -0
- package/focusManager.js +265 -0
- package/focusManager.mjs +261 -0
- package/helpers/a11y.js +79 -0
- package/helpers/a11y.mjs +38 -0
- package/helpers/dom/element.js +188 -9
- package/helpers/dom/element.mjs +182 -9
- 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/i18n/constants.js +7 -1
- package/i18n/constants.mjs +4 -1
- package/i18n/languages/en-US.js +3 -1
- package/i18n/languages/en-US.mjs +3 -1
- package/i18n/languages/pl-PL.js +3 -1
- package/i18n/languages/pl-PL.mjs +3 -1
- package/languages/all.js +6 -2
- package/languages/en-US.js +3 -1
- package/languages/en-US.mjs +3 -1
- package/languages/index.js +6 -2
- package/languages/pl-PL.js +3 -1
- package/languages/pl-PL.mjs +3 -1
- package/package.json +21 -1
- package/pluginHooks.d.ts +12 -1
- package/pluginHooks.js +152 -1
- package/pluginHooks.mjs +152 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +74 -4
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +75 -5
- package/plugins/columnSorting/columnSorting.js +43 -0
- package/plugins/columnSorting/columnSorting.mjs +44 -3
- 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 +252 -189
- package/plugins/comments/comments.mjs +251 -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/commandExecutor.js +2 -3
- package/plugins/contextMenu/commandExecutor.mjs +2 -3
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +75 -36
- package/plugins/contextMenu/contextMenu.mjs +74 -35
- package/plugins/contextMenu/itemsFactory.js +2 -3
- package/plugins/contextMenu/itemsFactory.mjs +3 -4
- package/plugins/contextMenu/{cursor.mjs → menu/cursor.js} +6 -4
- package/plugins/contextMenu/{cursor.js → menu/cursor.mjs} +4 -10
- package/plugins/contextMenu/menu/index.js +9 -0
- package/plugins/contextMenu/menu/index.mjs +1 -0
- package/plugins/contextMenu/{menu.js → menu/menu.js} +96 -308
- package/plugins/contextMenu/{menu.mjs → menu/menu.mjs} +97 -309
- package/plugins/contextMenu/menu/navigator.js +152 -0
- package/plugins/contextMenu/menu/navigator.mjs +148 -0
- package/plugins/contextMenu/menu/positioner.js +213 -0
- package/plugins/contextMenu/menu/positioner.mjs +209 -0
- package/plugins/contextMenu/menu/utils.js +177 -0
- package/plugins/contextMenu/menu/utils.mjs +163 -0
- 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.js → predefinedItems/index.js} +14 -14
- package/plugins/contextMenu/predefinedItems/index.mjs +68 -0
- 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 +35 -151
- package/plugins/contextMenu/utils.mjs +35 -144
- 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 +127 -78
- package/plugins/copyPaste/copyPaste.mjs +128 -79
- 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 +97 -38
- package/plugins/dropdownMenu/dropdownMenu.mjs +96 -37
- package/plugins/filters/constants.mjs +1 -1
- package/plugins/filters/filters.js +31 -14
- package/plugins/filters/filters.mjs +31 -14
- package/plugins/filters/ui/select.js +3 -3
- package/plugins/filters/ui/select.mjs +2 -2
- package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
- package/plugins/hiddenRows/hiddenRows.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +3 -1
- package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
- package/plugins/mergeCells/mergeCells.js +5 -16
- package/plugins/mergeCells/mergeCells.mjs +5 -16
- package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
- package/plugins/nestedHeaders/nestedHeaders.js +240 -10
- package/plugins/nestedHeaders/nestedHeaders.mjs +241 -11
- package/plugins/nestedHeaders/stateManager/index.js +102 -3
- package/plugins/nestedHeaders/stateManager/index.mjs +102 -3
- package/plugins/nestedRows/nestedRows.js +41 -0
- package/plugins/nestedRows/nestedRows.mjs +41 -0
- package/plugins/nestedRows/ui/headers.js +11 -0
- package/plugins/nestedRows/ui/headers.mjs +12 -1
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +8 -0
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +8 -0
- package/renderers/baseRenderer/baseRenderer.js +17 -0
- package/renderers/baseRenderer/baseRenderer.mjs +18 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +9 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +9 -4
- package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
- package/renderers/dateRenderer/dateRenderer.js +29 -0
- package/renderers/dateRenderer/dateRenderer.mjs +24 -0
- package/renderers/dateRenderer/index.d.ts +1 -0
- package/renderers/dateRenderer/index.js +6 -0
- package/renderers/dateRenderer/index.mjs +1 -0
- package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
- package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
- package/renderers/handsontableRenderer/index.d.ts +1 -0
- package/renderers/handsontableRenderer/index.js +6 -0
- package/renderers/handsontableRenderer/index.mjs +1 -0
- package/renderers/index.d.ts +9 -0
- package/renderers/selectRenderer/index.d.ts +1 -0
- package/renderers/selectRenderer/index.js +6 -0
- package/renderers/selectRenderer/index.mjs +1 -0
- package/renderers/selectRenderer/selectRenderer.d.ts +5 -0
- package/renderers/selectRenderer/selectRenderer.js +27 -0
- package/renderers/selectRenderer/selectRenderer.mjs +22 -0
- 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 +7 -1
- package/selection/mouseEventHandler.mjs +7 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +321 -152
- package/selection/selection.mjs +318 -151
- 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 +4 -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 +25 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +21 -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 +25 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +21 -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 +33 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +29 -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 +33 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +35 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +31 -0
- package/shortcutContexts/commands/selectAll.js +12 -0
- package/shortcutContexts/commands/selectAll.mjs +8 -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/context.js +20 -2
- package/shortcuts/context.mjs +20 -3
- package/shortcuts/manager.js +25 -7
- package/shortcuts/manager.mjs +26 -7
- package/shortcuts/recorder.js +3 -3
- package/shortcuts/recorder.mjs +3 -3
- package/shortcuts/utils.js +19 -5
- package/shortcuts/utils.mjs +18 -4
- package/tableView.js +111 -13
- package/tableView.mjs +112 -14
- package/3rdparty/walkontable/src/selection.js +0 -295
- package/3rdparty/walkontable/src/selection.mjs +0 -290
- package/plugins/contextMenu/predefinedItems.mjs +0 -68
- package/plugins/copyPaste/focusableElement.js +0 -186
- package/plugins/copyPaste/focusableElement.mjs +0 -180
- 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
@@ -8,6 +8,7 @@ import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
|
|
8
8
|
import EditorManager from "./editorManager.mjs";
|
9
9
|
import EventManager from "./eventManager.mjs";
|
10
10
|
import { deepClone, duckSchema, isObjectEqual, isObject, deepObjectSize, hasOwnProperty, createObjectPropListener, objectEach } from "./helpers/object.mjs";
|
11
|
+
import { FocusManager } from "./focusManager.mjs";
|
11
12
|
import { arrayMap, arrayEach, arrayReduce, getDifferenceOfArrays, stringToArray, pivot } from "./helpers/array.mjs";
|
12
13
|
import { instanceToHTML } from "./utils/parseTable.mjs";
|
13
14
|
import { getPlugin, getPluginsNames } from "./plugins/registry.mjs";
|
@@ -27,11 +28,21 @@ import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from
|
|
27
28
|
import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
|
28
29
|
import { Selection } from "./selection/index.mjs";
|
29
30
|
import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
|
31
|
+
import { installFocusCatcher } from "./core/index.mjs";
|
30
32
|
import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
|
31
33
|
import { createShortcutManager } from "./shortcuts/index.mjs";
|
32
|
-
|
34
|
+
import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
|
33
35
|
let activeGuid = null;
|
34
36
|
|
37
|
+
/**
|
38
|
+
* Keeps the collection of the all Handsontable instances created on the same page. The
|
39
|
+
* list is then used to trigger the "afterUnlisten" hook when the "listen()" method was
|
40
|
+
* called on another instance.
|
41
|
+
*
|
42
|
+
* @type {Map<string, Core>}
|
43
|
+
*/
|
44
|
+
const foreignHotInstances = new Map();
|
45
|
+
|
35
46
|
/**
|
36
47
|
* A set of deprecated feature names.
|
37
48
|
*
|
@@ -91,7 +102,8 @@ const deprecationWarns = new Set();
|
|
91
102
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
92
103
|
*/
|
93
104
|
export default function Core(rootElement, userSettings) {
|
94
|
-
var _userSettings$layoutD
|
105
|
+
var _userSettings$layoutD,
|
106
|
+
_this = this;
|
95
107
|
let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
96
108
|
let preventScrollingToCell = false;
|
97
109
|
let instance = this;
|
@@ -100,6 +112,7 @@ export default function Core(rootElement, userSettings) {
|
|
100
112
|
let dataSource;
|
101
113
|
let grid;
|
102
114
|
let editorManager;
|
115
|
+
let focusManager;
|
103
116
|
let firstRun = true;
|
104
117
|
if (hasValidParameter(rootInstanceSymbol)) {
|
105
118
|
registerAsRootInstance(this);
|
@@ -208,6 +221,8 @@ export default function Core(rootElement, userSettings) {
|
|
208
221
|
}
|
209
222
|
this.guid = `ht_${randomString()}`; // this is the namespace for global events
|
210
223
|
|
224
|
+
foreignHotInstances.set(this.guid, this);
|
225
|
+
|
211
226
|
/**
|
212
227
|
* Instance of index mapper which is responsible for managing the column indexes.
|
213
228
|
*
|
@@ -256,14 +271,16 @@ export default function Core(rootElement, userSettings) {
|
|
256
271
|
};
|
257
272
|
|
258
273
|
let selection = new Selection(tableMeta, {
|
259
|
-
rowIndexMapper:
|
260
|
-
columnIndexMapper:
|
274
|
+
rowIndexMapper: instance.rowIndexMapper,
|
275
|
+
columnIndexMapper: instance.columnIndexMapper,
|
261
276
|
countCols: () => instance.countCols(),
|
262
277
|
countRows: () => instance.countRows(),
|
263
278
|
propToCol: prop => datamap.propToCol(prop),
|
264
279
|
isEditorOpened: () => instance.getActiveEditor() ? instance.getActiveEditor().isOpened() : false,
|
265
|
-
|
266
|
-
|
280
|
+
countRenderableColumns: () => this.view.countRenderableColumns(),
|
281
|
+
countRenderableRows: () => this.view.countRenderableRows(),
|
282
|
+
countRowHeaders: () => this.countRowHeaders(),
|
283
|
+
countColHeaders: () => this.countColHeaders(),
|
267
284
|
getShortcutManager: () => instance.getShortcutManager(),
|
268
285
|
createCellCoords: (row, column) => instance._createCellCoords(row, column),
|
269
286
|
createCellRange: (highlight, from, to) => instance._createCellRange(highlight, from, to),
|
@@ -282,6 +299,9 @@ export default function Core(rootElement, userSettings) {
|
|
282
299
|
};
|
283
300
|
this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
|
284
301
|
this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
|
302
|
+
this.selection.addLocalHook('beforeHighlightSet', () => {
|
303
|
+
this.runHooks('beforeSelectionHighlightSet');
|
304
|
+
});
|
285
305
|
this.selection.addLocalHook('beforeSetRangeStart', cellCoords => {
|
286
306
|
this.runHooks('beforeSetRangeStart', cellCoords);
|
287
307
|
});
|
@@ -290,12 +310,6 @@ export default function Core(rootElement, userSettings) {
|
|
290
310
|
});
|
291
311
|
this.selection.addLocalHook('beforeSetRangeEnd', cellCoords => {
|
292
312
|
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
313
|
});
|
300
314
|
this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
|
301
315
|
const preventScrolling = createObjectPropListener(false);
|
@@ -308,8 +322,6 @@ export default function Core(rootElement, userSettings) {
|
|
308
322
|
this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
|
309
323
|
this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
|
310
324
|
|
311
|
-
const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
|
312
|
-
const currentSelectedRange = this.selection.selectedRange.current();
|
313
325
|
let scrollToCell = true;
|
314
326
|
if (preventScrollingToCell) {
|
315
327
|
scrollToCell = false;
|
@@ -317,19 +329,42 @@ export default function Core(rootElement, userSettings) {
|
|
317
329
|
if (preventScrolling.isTouched()) {
|
318
330
|
scrollToCell = !preventScrolling.value;
|
319
331
|
}
|
332
|
+
const currentSelectedRange = this.selection.selectedRange.current();
|
333
|
+
const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
|
320
334
|
const isSelectedByRowHeader = this.selection.isSelectedByRowHeader();
|
321
335
|
const isSelectedByColumnHeader = this.selection.isSelectedByColumnHeader();
|
322
336
|
if (scrollToCell !== false) {
|
323
337
|
if (!isSelectedByAnyHeader) {
|
324
338
|
if (currentSelectedRange && !this.selection.isMultiple()) {
|
325
|
-
|
339
|
+
const {
|
340
|
+
row,
|
341
|
+
col
|
342
|
+
} = currentSelectedRange.from;
|
343
|
+
if (row < 0 && col >= 0) {
|
344
|
+
this.scrollViewportTo({
|
345
|
+
col
|
346
|
+
});
|
347
|
+
} else if (col < 0 && row >= 0) {
|
348
|
+
this.scrollViewportTo({
|
349
|
+
row
|
350
|
+
});
|
351
|
+
} else {
|
352
|
+
this.scrollViewportTo({
|
353
|
+
row,
|
354
|
+
col
|
355
|
+
});
|
356
|
+
}
|
326
357
|
} else {
|
327
|
-
this.
|
358
|
+
this.scrollViewportTo(cellCoords.toObject());
|
328
359
|
}
|
329
360
|
} else if (isSelectedByRowHeader) {
|
330
|
-
this.
|
361
|
+
this.scrollViewportTo({
|
362
|
+
row: cellCoords.row
|
363
|
+
});
|
331
364
|
} else if (isSelectedByColumnHeader) {
|
332
|
-
this.
|
365
|
+
this.scrollViewportTo({
|
366
|
+
col: cellCoords.col
|
367
|
+
});
|
333
368
|
}
|
334
369
|
}
|
335
370
|
|
@@ -364,6 +399,30 @@ export default function Core(rootElement, userSettings) {
|
|
364
399
|
isMultiple.value = changedIsMultiple;
|
365
400
|
}
|
366
401
|
});
|
402
|
+
this.selection.addLocalHook('beforeSelectColumns', function () {
|
403
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
404
|
+
args[_key] = arguments[_key];
|
405
|
+
}
|
406
|
+
return _this.runHooks('beforeSelectColumns', ...args);
|
407
|
+
});
|
408
|
+
this.selection.addLocalHook('afterSelectColumns', function () {
|
409
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
410
|
+
args[_key2] = arguments[_key2];
|
411
|
+
}
|
412
|
+
return _this.runHooks('afterSelectColumns', ...args);
|
413
|
+
});
|
414
|
+
this.selection.addLocalHook('beforeSelectRows', function () {
|
415
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
416
|
+
args[_key3] = arguments[_key3];
|
417
|
+
}
|
418
|
+
return _this.runHooks('beforeSelectRows', ...args);
|
419
|
+
});
|
420
|
+
this.selection.addLocalHook('afterSelectRows', function () {
|
421
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
422
|
+
args[_key4] = arguments[_key4];
|
423
|
+
}
|
424
|
+
return _this.runHooks('afterSelectRows', ...args);
|
425
|
+
});
|
367
426
|
this.selection.addLocalHook('beforeModifyTransformStart', cellCoordsDelta => {
|
368
427
|
this.runHooks('modifyTransformStart', cellCoordsDelta);
|
369
428
|
});
|
@@ -469,7 +528,9 @@ export default function Core(rootElement, userSettings) {
|
|
469
528
|
const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
470
529
|
const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
|
471
530
|
if (selection.isSelectedByCorner()) {
|
472
|
-
|
531
|
+
selection.selectAll(true, true, {
|
532
|
+
disableHeadersHighlight: true
|
533
|
+
});
|
473
534
|
} else if (isDefined(currentFromRow) && currentFromRow >= startVisualRowIndex) {
|
474
535
|
// Moving the selection (if it exists) downward – it should be applied to the "old" row.
|
475
536
|
// TODO: The logic here should be handled by selection module.
|
@@ -523,7 +584,9 @@ export default function Core(rootElement, userSettings) {
|
|
523
584
|
const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
|
524
585
|
const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
|
525
586
|
if (selection.isSelectedByCorner()) {
|
526
|
-
|
587
|
+
selection.selectAll(true, true, {
|
588
|
+
disableHeadersHighlight: true
|
589
|
+
});
|
527
590
|
} else if (isDefined(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
|
528
591
|
// Moving the selection (if it exists) rightward – it should be applied to the "old" column.
|
529
592
|
// TODO: The logic here should be handled by selection module.
|
@@ -1013,6 +1076,10 @@ export default function Core(rootElement, userSettings) {
|
|
1013
1076
|
this.updateSettings(tableMeta, true);
|
1014
1077
|
this.view = new TableView(this);
|
1015
1078
|
editorManager = EditorManager.getInstance(instance, tableMeta, selection);
|
1079
|
+
focusManager = new FocusManager(instance);
|
1080
|
+
if (isRootInstance(this)) {
|
1081
|
+
installFocusCatcher(instance);
|
1082
|
+
}
|
1016
1083
|
instance.runHooks('init');
|
1017
1084
|
this.forceFullRender = true; // used when data was changed
|
1018
1085
|
this.view.render();
|
@@ -1426,6 +1493,11 @@ export default function Core(rootElement, userSettings) {
|
|
1426
1493
|
*/
|
1427
1494
|
this.listen = function () {
|
1428
1495
|
if (instance && !instance.isListening()) {
|
1496
|
+
foreignHotInstances.forEach(foreignHot => {
|
1497
|
+
if (instance !== foreignHot) {
|
1498
|
+
foreignHot.unlisten();
|
1499
|
+
}
|
1500
|
+
});
|
1429
1501
|
activeGuid = instance.guid;
|
1430
1502
|
instance.runHooks('afterListen');
|
1431
1503
|
}
|
@@ -1510,8 +1582,8 @@ export default function Core(rootElement, userSettings) {
|
|
1510
1582
|
* @returns {Array} Returns removed portion of columns.
|
1511
1583
|
*/
|
1512
1584
|
this.spliceCol = function (column, index, amount) {
|
1513
|
-
for (var
|
1514
|
-
elements[
|
1585
|
+
for (var _len5 = arguments.length, elements = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
1586
|
+
elements[_key5 - 3] = arguments[_key5];
|
1515
1587
|
}
|
1516
1588
|
return datamap.spliceCol(column, index, amount, ...elements);
|
1517
1589
|
};
|
@@ -1528,8 +1600,8 @@ export default function Core(rootElement, userSettings) {
|
|
1528
1600
|
* @returns {Array} Returns removed portion of rows.
|
1529
1601
|
*/
|
1530
1602
|
this.spliceRow = function (row, index, amount) {
|
1531
|
-
for (var
|
1532
|
-
elements[
|
1603
|
+
for (var _len6 = arguments.length, elements = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
1604
|
+
elements[_key6 - 3] = arguments[_key6];
|
1533
1605
|
}
|
1534
1606
|
return datamap.spliceRow(row, index, amount, ...elements);
|
1535
1607
|
};
|
@@ -1626,6 +1698,9 @@ export default function Core(rootElement, userSettings) {
|
|
1626
1698
|
}
|
1627
1699
|
const changes = [];
|
1628
1700
|
arrayEach(selection.getSelectedRange(), cellRange => {
|
1701
|
+
if (cellRange.isSingleHeader()) {
|
1702
|
+
return;
|
1703
|
+
}
|
1629
1704
|
const topStart = cellRange.getTopStartCorner();
|
1630
1705
|
const bottomEnd = cellRange.getBottomEndCorner();
|
1631
1706
|
rangeEach(topStart.row, bottomEnd.row, row => {
|
@@ -2923,8 +2998,8 @@ export default function Core(rootElement, userSettings) {
|
|
2923
2998
|
*/
|
2924
2999
|
this.spliceCellsMeta = function (visualIndex) {
|
2925
3000
|
let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
2926
|
-
for (var
|
2927
|
-
cellMetaRows[
|
3001
|
+
for (var _len7 = arguments.length, cellMetaRows = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
|
3002
|
+
cellMetaRows[_key7 - 2] = arguments[_key7];
|
2928
3003
|
}
|
2929
3004
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
2930
3005
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
@@ -3615,6 +3690,30 @@ export default function Core(rootElement, userSettings) {
|
|
3615
3690
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
|
3616
3691
|
};
|
3617
3692
|
|
3693
|
+
/**
|
3694
|
+
* Returns the number of rendered row headers.
|
3695
|
+
*
|
3696
|
+
* @since 14.0.0
|
3697
|
+
* @memberof Core#
|
3698
|
+
* @function countRowHeaders
|
3699
|
+
* @returns {number} Number of row headers.
|
3700
|
+
*/
|
3701
|
+
this.countRowHeaders = function () {
|
3702
|
+
return this.view.getRowHeadersCount();
|
3703
|
+
};
|
3704
|
+
|
3705
|
+
/**
|
3706
|
+
* Returns the number of rendered column headers.
|
3707
|
+
*
|
3708
|
+
* @since 14.0.0
|
3709
|
+
* @memberof Core#
|
3710
|
+
* @function countColHeaders
|
3711
|
+
* @returns {number} Number of column headers.
|
3712
|
+
*/
|
3713
|
+
this.countColHeaders = function () {
|
3714
|
+
return this.view.getColumnHeadersCount();
|
3715
|
+
};
|
3716
|
+
|
3618
3717
|
/**
|
3619
3718
|
* Returns the number of empty rows. If the optional ending parameter is `true`, returns the
|
3620
3719
|
* number of empty rows at the bottom of the table.
|
@@ -3819,6 +3918,10 @@ export default function Core(rootElement, userSettings) {
|
|
3819
3918
|
* hot.selectColumns('id');
|
3820
3919
|
* // Select range of columns using visual indexes.
|
3821
3920
|
* hot.selectColumns(1, 4);
|
3921
|
+
* // Select range of columns using visual indexes and mark the first header as highlighted.
|
3922
|
+
* hot.selectColumns(1, 2, -1);
|
3923
|
+
* // Select range of columns using visual indexes and mark the second cell as highlighted.
|
3924
|
+
* hot.selectColumns(2, 1, 1);
|
3822
3925
|
* // Select range of columns using column properties.
|
3823
3926
|
* hot.selectColumns('id', 'last_name');
|
3824
3927
|
* ```
|
@@ -3829,11 +3932,15 @@ export default function Core(rootElement, userSettings) {
|
|
3829
3932
|
* @param {number} startColumn The visual column index from which the selection starts.
|
3830
3933
|
* @param {number} [endColumn=startColumn] The visual column index to which the selection finishes. If `endColumn`
|
3831
3934
|
* is not defined the column defined by `startColumn` will be selected.
|
3935
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3936
|
+
* The value can take visual row index from -N to N, where negative values
|
3937
|
+
* point to the headers and positive values point to the cell range.
|
3832
3938
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3833
3939
|
*/
|
3834
3940
|
this.selectColumns = function (startColumn) {
|
3835
3941
|
let endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
3836
|
-
|
3942
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3943
|
+
return selection.selectColumns(startColumn, endColumn, focusPosition);
|
3837
3944
|
};
|
3838
3945
|
|
3839
3946
|
/**
|
@@ -3843,8 +3950,12 @@ export default function Core(rootElement, userSettings) {
|
|
3843
3950
|
* ```js
|
3844
3951
|
* // Select row using visual index.
|
3845
3952
|
* hot.selectRows(1);
|
3846
|
-
* //
|
3953
|
+
* // select a range of rows, using visual indexes.
|
3847
3954
|
* hot.selectRows(1, 4);
|
3955
|
+
* // select a range of rows, using visual indexes, and mark the header as highlighted.
|
3956
|
+
* hot.selectRows(1, 2, -1);
|
3957
|
+
* // Select range of rows using visual indexes and mark the second cell as highlighted.
|
3958
|
+
* hot.selectRows(2, 1, 1);
|
3848
3959
|
* ```
|
3849
3960
|
*
|
3850
3961
|
* @memberof Core#
|
@@ -3853,11 +3964,15 @@ export default function Core(rootElement, userSettings) {
|
|
3853
3964
|
* @param {number} startRow The visual row index from which the selection starts.
|
3854
3965
|
* @param {number} [endRow=startRow] The visual row index to which the selection finishes. If `endRow`
|
3855
3966
|
* is not defined the row defined by `startRow` will be selected.
|
3967
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
3968
|
+
* The value can take visual column index from -N to N, where negative values
|
3969
|
+
* point to the headers and positive values point to the cell range.
|
3856
3970
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
3857
3971
|
*/
|
3858
3972
|
this.selectRows = function (startRow) {
|
3859
3973
|
let endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
3860
|
-
|
3974
|
+
let focusPosition = arguments.length > 2 ? arguments[2] : undefined;
|
3975
|
+
return selection.selectRows(startRow, endRow, focusPosition);
|
3861
3976
|
};
|
3862
3977
|
|
3863
3978
|
/**
|
@@ -3876,9 +3991,16 @@ export default function Core(rootElement, userSettings) {
|
|
3876
3991
|
* The previous selection is overwritten.
|
3877
3992
|
*
|
3878
3993
|
* ```js
|
3879
|
-
* // select all cells in the table, including all headers
|
3994
|
+
* // select all cells in the table, including all headers and the corner cell
|
3880
3995
|
* hot.selectAll();
|
3881
3996
|
*
|
3997
|
+
* // select all cells in the table, including row headers but excluding the corner cell
|
3998
|
+
* hot.selectAll(true, false);
|
3999
|
+
*
|
4000
|
+
* // select all cells in the table, including all headers and the corner cell, but move the focus
|
4001
|
+
* // highlight to position -2, -1
|
4002
|
+
* hot.selectAll(-2, -1);
|
4003
|
+
*
|
3882
4004
|
* // select all cells in the table, without headers
|
3883
4005
|
* hot.selectAll(false);
|
3884
4006
|
* ```
|
@@ -3886,15 +4008,25 @@ export default function Core(rootElement, userSettings) {
|
|
3886
4008
|
* @since 0.38.2
|
3887
4009
|
* @memberof Core#
|
3888
4010
|
* @function selectAll
|
3889
|
-
* @param {boolean} [
|
3890
|
-
* `false
|
4011
|
+
* @param {boolean} [includeRowHeaders=false] `true` If the selection should include the row headers,
|
4012
|
+
* `false` otherwise.
|
4013
|
+
* @param {boolean} [includeColumnHeaders=false] `true` If the selection should include the column
|
4014
|
+
* headers, `false` otherwise.
|
4015
|
+
*
|
4016
|
+
* @param {object} [options] Additional object with options.
|
4017
|
+
* @param {{row: number, col: number} | boolean} [options.focusPosition] The argument allows changing the cell/header
|
4018
|
+
* focus position. The value takes an object with a `row` and `col` properties from -N to N, where
|
4019
|
+
* negative values point to the headers and positive values point to the cell range. If `false`, the focus
|
4020
|
+
* position won't be changed.
|
4021
|
+
* @param {boolean} [options.disableHeadersHighlight] If `true`, disables highlighting the headers even when
|
4022
|
+
* the logical coordinates points on them.
|
3891
4023
|
*/
|
3892
4024
|
this.selectAll = function () {
|
3893
|
-
let
|
3894
|
-
|
3895
|
-
|
4025
|
+
let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
4026
|
+
let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
|
4027
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
3896
4028
|
preventScrollingToCell = true;
|
3897
|
-
selection.selectAll(includeRowHeaders, includeColumnHeaders);
|
4029
|
+
selection.selectAll(includeRowHeaders, includeColumnHeaders, options);
|
3898
4030
|
preventScrollingToCell = false;
|
3899
4031
|
};
|
3900
4032
|
const getIndexToScroll = (indexMapper, visualIndex) => {
|
@@ -3903,55 +4035,117 @@ export default function Core(rootElement, userSettings) {
|
|
3903
4035
|
};
|
3904
4036
|
|
3905
4037
|
/**
|
3906
|
-
* Scroll viewport to coordinates specified by the `row` and `
|
4038
|
+
* Scroll viewport to coordinates specified by the `row` and/or `col` object properties.
|
4039
|
+
*
|
4040
|
+
* ```js
|
4041
|
+
* // scroll the viewport to the visual row index (leave the horizontal scroll untouched)
|
4042
|
+
* hot.scrollViewportTo({ row: 50 });
|
4043
|
+
*
|
4044
|
+
* // scroll the viewport to the passed coordinates so that the cell at 50, 50 will be snapped to
|
4045
|
+
* // the bottom-end table's edge.
|
4046
|
+
* hot.scrollViewportTo({
|
4047
|
+
* row: 50,
|
4048
|
+
* col: 50,
|
4049
|
+
* verticalSnap: 'bottom',
|
4050
|
+
* horizontalSnap: 'end',
|
4051
|
+
* });
|
4052
|
+
* ```
|
3907
4053
|
*
|
3908
4054
|
* @memberof Core#
|
3909
4055
|
* @function scrollViewportTo
|
3910
|
-
* @param {
|
3911
|
-
*
|
3912
|
-
* @param {number} [
|
3913
|
-
*
|
3914
|
-
*
|
3915
|
-
*
|
3916
|
-
*
|
3917
|
-
*
|
3918
|
-
*
|
4056
|
+
* @param {object} options A dictionary containing the following parameters:
|
4057
|
+
* @param {number} [options.row] Specifies the number of visual rows along the Y axis to scroll the viewport.
|
4058
|
+
* @param {number} [options.col] Specifies the number of visual columns along the X axis to scroll the viewport.
|
4059
|
+
* @param {'top' | 'bottom'} [options.verticalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
|
4060
|
+
* This option is a string which must take one of the following values:
|
4061
|
+
* - `top`: The viewport will be scrolled to a row in such a way that it will be positioned on the top of the viewport;
|
4062
|
+
* - `bottom`: The viewport will be scrolled to a row in such a way that it will be positioned on the bottom of the viewport;
|
4063
|
+
* - If the property is not defined the vertical auto-snapping is enabled. Depending on where the viewport is scrolled from, a row will
|
4064
|
+
* be positioned at the top or bottom of the viewport.
|
4065
|
+
* @param {'start' | 'end'} [options.horizontalSnap] Determines to which edge of the table the viewport will be scrolled based on the passed coordinates.
|
4066
|
+
* This option is a string which must take one of the following values:
|
4067
|
+
* - `start`: The viewport will be scrolled to a column in such a way that it will be positioned on the start (left edge or right, if the layout direction is set to `rtl`) of the viewport;
|
4068
|
+
* - `end`: The viewport will be scrolled to a column in such a way that it will be positioned on the end (right edge or left, if the layout direction is set to `rtl`) of the viewport;
|
4069
|
+
* - If the property is not defined the horizontal auto-snapping is enabled. Depending on where the viewport is scrolled from, a column will
|
4070
|
+
* be positioned at the start or end of the viewport.
|
4071
|
+
* @param {boolean} [options.considerHiddenIndexes=true] If `true`, we handle visual indexes, otherwise we handle only indexes which
|
3919
4072
|
* may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
|
3920
|
-
* @returns {boolean} `true` if
|
3921
|
-
*/
|
3922
|
-
this.scrollViewportTo = function (
|
3923
|
-
let
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
4073
|
+
* @returns {boolean} `true` if viewport was scrolled, `false` otherwise.
|
4074
|
+
*/
|
4075
|
+
this.scrollViewportTo = function () {
|
4076
|
+
let {
|
4077
|
+
row,
|
4078
|
+
col,
|
4079
|
+
verticalSnap,
|
4080
|
+
horizontalSnap,
|
4081
|
+
considerHiddenIndexes
|
4082
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4083
|
+
let snapToTop;
|
4084
|
+
let snapToBottom;
|
4085
|
+
let snapToInlineStart;
|
4086
|
+
let snapToInlineEnd;
|
4087
|
+
if (verticalSnap !== undefined) {
|
4088
|
+
snapToTop = verticalSnap === 'top';
|
4089
|
+
snapToBottom = !snapToTop;
|
4090
|
+
}
|
4091
|
+
if (horizontalSnap !== undefined) {
|
4092
|
+
snapToInlineStart = horizontalSnap === 'start';
|
4093
|
+
snapToInlineEnd = !snapToInlineStart;
|
4094
|
+
}
|
3928
4095
|
let renderableRow = row;
|
3929
|
-
let renderableColumn =
|
3930
|
-
if (considerHiddenIndexes) {
|
3931
|
-
const
|
3932
|
-
const
|
3933
|
-
const visualRowToScroll =
|
3934
|
-
const visualColumnToScroll =
|
4096
|
+
let renderableColumn = col;
|
4097
|
+
if (considerHiddenIndexes === undefined || considerHiddenIndexes) {
|
4098
|
+
const isValidRowGrid = Number.isInteger(row) && row >= 0;
|
4099
|
+
const isValidColumnGrid = Number.isInteger(col) && col >= 0;
|
4100
|
+
const visualRowToScroll = isValidRowGrid ? getIndexToScroll(this.rowIndexMapper, row) : undefined;
|
4101
|
+
const visualColumnToScroll = isValidColumnGrid ? getIndexToScroll(this.columnIndexMapper, col) : undefined;
|
3935
4102
|
if (visualRowToScroll === null || visualColumnToScroll === null) {
|
3936
4103
|
return false;
|
3937
4104
|
}
|
3938
|
-
renderableRow =
|
3939
|
-
renderableColumn =
|
4105
|
+
renderableRow = isValidRowGrid ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : row;
|
4106
|
+
renderableColumn = isValidColumnGrid ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : col;
|
3940
4107
|
}
|
3941
4108
|
const isRowInteger = Number.isInteger(renderableRow);
|
3942
4109
|
const isColumnInteger = Number.isInteger(renderableColumn);
|
3943
|
-
if (isRowInteger && isColumnInteger) {
|
3944
|
-
return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop,
|
4110
|
+
if (isRowInteger && renderableRow >= 0 && isColumnInteger && renderableColumn >= 0) {
|
4111
|
+
return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToInlineEnd, snapToBottom, snapToInlineStart);
|
3945
4112
|
}
|
3946
|
-
if (isRowInteger && isColumnInteger
|
4113
|
+
if (isRowInteger && renderableRow >= 0 && (isColumnInteger && renderableColumn < 0 || !isColumnInteger)) {
|
3947
4114
|
return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
|
3948
4115
|
}
|
3949
|
-
if (isColumnInteger && isRowInteger
|
3950
|
-
return instance.view.scrollViewportHorizontally(renderableColumn,
|
4116
|
+
if (isColumnInteger && renderableColumn >= 0 && (isRowInteger && renderableRow < 0 || !isRowInteger)) {
|
4117
|
+
return instance.view.scrollViewportHorizontally(renderableColumn, snapToInlineEnd, snapToInlineStart);
|
3951
4118
|
}
|
3952
4119
|
return false;
|
3953
4120
|
};
|
3954
4121
|
|
4122
|
+
/**
|
4123
|
+
* Scrolls the viewport to coordinates specified by the currently focused cell.
|
4124
|
+
*
|
4125
|
+
* @since 14.0.0
|
4126
|
+
* @memberof Core#
|
4127
|
+
* @fires Hooks#afterScroll
|
4128
|
+
* @function scrollToFocusedCell
|
4129
|
+
* @param {Function} callback The callback function to call after the viewport is scrolled.
|
4130
|
+
*/
|
4131
|
+
this.scrollToFocusedCell = function () {
|
4132
|
+
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
4133
|
+
if (!this.selection.isSelected()) {
|
4134
|
+
return;
|
4135
|
+
}
|
4136
|
+
this.addHookOnce('afterScroll', callback);
|
4137
|
+
const {
|
4138
|
+
highlight
|
4139
|
+
} = this.getSelectedRangeLast();
|
4140
|
+
const isScrolled = this.scrollViewportTo(highlight.toObject());
|
4141
|
+
if (isScrolled) {
|
4142
|
+
this.view.render();
|
4143
|
+
} else {
|
4144
|
+
this.removeHook('afterScroll', callback);
|
4145
|
+
this._registerImmediate(() => callback());
|
4146
|
+
}
|
4147
|
+
};
|
4148
|
+
|
3955
4149
|
/**
|
3956
4150
|
* Removes the table from the DOM and destroys the instance of the Handsontable.
|
3957
4151
|
*
|
@@ -3972,6 +4166,7 @@ export default function Core(rootElement, userSettings) {
|
|
3972
4166
|
dataSource = null;
|
3973
4167
|
this.getShortcutManager().destroy();
|
3974
4168
|
metaManager.clearCache();
|
4169
|
+
foreignHotInstances.delete(this.guid);
|
3975
4170
|
if (isRootInstance(instance)) {
|
3976
4171
|
const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
|
3977
4172
|
if (licenseInfo) {
|
@@ -4295,6 +4490,16 @@ export default function Core(rootElement, userSettings) {
|
|
4295
4490
|
}
|
4296
4491
|
};
|
4297
4492
|
|
4493
|
+
/**
|
4494
|
+
* Gets the instance of the EditorManager.
|
4495
|
+
*
|
4496
|
+
* @private
|
4497
|
+
* @returns {EditorManager}
|
4498
|
+
*/
|
4499
|
+
this._getEditorManager = function () {
|
4500
|
+
return editorManager;
|
4501
|
+
};
|
4502
|
+
|
4298
4503
|
/**
|
4299
4504
|
* Check if currently it is RTL direction.
|
4300
4505
|
*
|
@@ -4365,270 +4570,23 @@ export default function Core(rootElement, userSettings) {
|
|
4365
4570
|
this.getShortcutManager = function () {
|
4366
4571
|
return shortcutManager;
|
4367
4572
|
};
|
4368
|
-
|
4369
|
-
|
4370
|
-
|
4371
|
-
|
4372
|
-
|
4373
|
-
|
4573
|
+
|
4574
|
+
/**
|
4575
|
+
* Return the Focus Manager responsible for managing the browser's focus in the table.
|
4576
|
+
*
|
4577
|
+
* @memberof Core#
|
4578
|
+
* @since 14.0.0
|
4579
|
+
* @function getFocusManager
|
4580
|
+
* @returns {FocusManager}
|
4581
|
+
*/
|
4582
|
+
this.getFocusManager = function () {
|
4583
|
+
return focusManager;
|
4374
4584
|
};
|
4375
|
-
shortcutManager.setActiveContextName('grid');
|
4376
|
-
gridContext.addShortcuts([{
|
4377
|
-
keys: [['Control/Meta', 'A']],
|
4378
|
-
callback: () => {
|
4379
|
-
instance.selectAll();
|
4380
|
-
}
|
4381
|
-
}, {
|
4382
|
-
keys: [['Control/Meta', 'Enter']],
|
4383
|
-
callback: () => {
|
4384
|
-
const selectedRange = instance.getSelectedRange();
|
4385
|
-
const {
|
4386
|
-
row: highlightRow,
|
4387
|
-
col: highlightColumn
|
4388
|
-
} = selectedRange[selectedRange.length - 1].highlight;
|
4389
|
-
const valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
|
4390
|
-
const cellValues = new Map();
|
4391
|
-
for (let i = 0; i < selectedRange.length; i++) {
|
4392
|
-
selectedRange[i].forAll((row, column) => {
|
4393
|
-
if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
|
4394
|
-
const {
|
4395
|
-
readOnly
|
4396
|
-
} = instance.getCellMeta(row, column);
|
4397
|
-
if (!readOnly) {
|
4398
|
-
cellValues.set(`${row}x${column}`, [row, column, valueToPopulate]);
|
4399
|
-
}
|
4400
|
-
}
|
4401
|
-
});
|
4402
|
-
}
|
4403
|
-
instance.setDataAtCell(Array.from(cellValues.values()));
|
4404
|
-
},
|
4405
|
-
runOnlyIf: () => instance.getSelectedRangeLast().getCellsCount() > 1
|
4406
|
-
}, {
|
4407
|
-
keys: [['ArrowUp']],
|
4408
|
-
callback: () => {
|
4409
|
-
selection.transformStart(-1, 0);
|
4410
|
-
}
|
4411
|
-
}, {
|
4412
|
-
keys: [['ArrowUp', 'Control/Meta']],
|
4413
|
-
captureCtrl: true,
|
4414
|
-
callback: () => {
|
4415
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1), instance.getSelectedRangeLast().highlight.col));
|
4416
|
-
}
|
4417
|
-
}, {
|
4418
|
-
keys: [['ArrowUp', 'Shift']],
|
4419
|
-
callback: () => {
|
4420
|
-
selection.transformEnd(-1, 0);
|
4421
|
-
}
|
4422
|
-
}, {
|
4423
|
-
keys: [['ArrowUp', 'Shift', 'Control/Meta']],
|
4424
|
-
captureCtrl: true,
|
4425
|
-
callback: () => {
|
4426
|
-
const {
|
4427
|
-
from,
|
4428
|
-
to
|
4429
|
-
} = instance.getSelectedRangeLast();
|
4430
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
4431
|
-
selection.setRangeStart(from.clone());
|
4432
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4433
|
-
},
|
4434
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4435
|
-
}, {
|
4436
|
-
keys: [['ArrowDown']],
|
4437
|
-
callback: () => {
|
4438
|
-
selection.transformStart(1, 0);
|
4439
|
-
}
|
4440
|
-
}, {
|
4441
|
-
keys: [['ArrowDown', 'Control/Meta']],
|
4442
|
-
captureCtrl: true,
|
4443
|
-
callback: () => {
|
4444
|
-
selection.setRangeStart(instance._createCellCoords(instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1), instance.getSelectedRangeLast().highlight.col));
|
4445
|
-
}
|
4446
|
-
}, {
|
4447
|
-
keys: [['ArrowDown', 'Shift']],
|
4448
|
-
callback: () => {
|
4449
|
-
selection.transformEnd(1, 0);
|
4450
|
-
}
|
4451
|
-
}, {
|
4452
|
-
keys: [['ArrowDown', 'Shift', 'Control/Meta']],
|
4453
|
-
captureCtrl: true,
|
4454
|
-
callback: () => {
|
4455
|
-
const {
|
4456
|
-
from,
|
4457
|
-
to
|
4458
|
-
} = instance.getSelectedRangeLast();
|
4459
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
|
4460
|
-
selection.setRangeStart(from.clone());
|
4461
|
-
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
4462
|
-
},
|
4463
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByColumnHeader())
|
4464
|
-
}, {
|
4465
|
-
keys: [['ArrowLeft']],
|
4466
|
-
callback: () => {
|
4467
|
-
selection.transformStart(0, -1 * instance.getDirectionFactor());
|
4468
|
-
}
|
4469
|
-
}, {
|
4470
|
-
keys: [['ArrowLeft', 'Control/Meta']],
|
4471
|
-
captureCtrl: true,
|
4472
|
-
callback: () => {
|
4473
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4474
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4475
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4476
|
-
}
|
4477
|
-
}, {
|
4478
|
-
keys: [['ArrowLeft', 'Shift']],
|
4479
|
-
callback: () => {
|
4480
|
-
selection.transformEnd(0, -1 * instance.getDirectionFactor());
|
4481
|
-
}
|
4482
|
-
}, {
|
4483
|
-
keys: [['ArrowLeft', 'Shift', 'Control/Meta']],
|
4484
|
-
captureCtrl: true,
|
4485
|
-
callback: () => {
|
4486
|
-
const {
|
4487
|
-
from,
|
4488
|
-
to
|
4489
|
-
} = instance.getSelectedRangeLast();
|
4490
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4491
|
-
selection.setRangeStart(from.clone());
|
4492
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4493
|
-
},
|
4494
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4495
|
-
}, {
|
4496
|
-
keys: [['ArrowRight']],
|
4497
|
-
callback: () => {
|
4498
|
-
selection.transformStart(0, instance.getDirectionFactor());
|
4499
|
-
}
|
4500
|
-
}, {
|
4501
|
-
keys: [['ArrowRight', 'Control/Meta']],
|
4502
|
-
captureCtrl: true,
|
4503
|
-
callback: () => {
|
4504
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4505
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4506
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4507
|
-
}
|
4508
|
-
}, {
|
4509
|
-
keys: [['ArrowRight', 'Shift']],
|
4510
|
-
callback: () => {
|
4511
|
-
selection.transformEnd(0, instance.getDirectionFactor());
|
4512
|
-
}
|
4513
|
-
}, {
|
4514
|
-
keys: [['ArrowRight', 'Shift', 'Control/Meta']],
|
4515
|
-
captureCtrl: true,
|
4516
|
-
callback: () => {
|
4517
|
-
const {
|
4518
|
-
from,
|
4519
|
-
to
|
4520
|
-
} = instance.getSelectedRangeLast();
|
4521
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(...(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4522
|
-
selection.setRangeStart(from.clone());
|
4523
|
-
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4524
|
-
},
|
4525
|
-
runOnlyIf: () => !(instance.selection.isSelectedByCorner() || instance.selection.isSelectedByRowHeader())
|
4526
|
-
}, {
|
4527
|
-
keys: [['Home']],
|
4528
|
-
captureCtrl: true,
|
4529
|
-
callback: () => {
|
4530
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4531
|
-
const row = instance.getSelectedRangeLast().highlight.row;
|
4532
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4533
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4534
|
-
},
|
4535
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4536
|
-
}, {
|
4537
|
-
keys: [['Home', 'Shift']],
|
4538
|
-
callback: () => {
|
4539
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(0, 1)));
|
4540
|
-
}
|
4541
|
-
}, {
|
4542
|
-
keys: [['Home', 'Control/Meta']],
|
4543
|
-
captureCtrl: true,
|
4544
|
-
callback: () => {
|
4545
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsTop, 10);
|
4546
|
-
const fixedColumns = parseInt(instance.getSettings().fixedColumnsStart, 10);
|
4547
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(fixedRows, 1);
|
4548
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(fixedColumns, 1);
|
4549
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4550
|
-
},
|
4551
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4552
|
-
}, {
|
4553
|
-
keys: [['End']],
|
4554
|
-
captureCtrl: true,
|
4555
|
-
callback: () => {
|
4556
|
-
selection.setRangeStart(instance._createCellCoords(instance.getSelectedRangeLast().highlight.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4557
|
-
},
|
4558
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4559
|
-
}, {
|
4560
|
-
keys: [['End', 'Shift']],
|
4561
|
-
callback: () => {
|
4562
|
-
selection.setRangeEnd(instance._createCellCoords(selection.selectedRange.current().from.row, instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1)));
|
4563
|
-
}
|
4564
|
-
}, {
|
4565
|
-
keys: [['End', 'Control/Meta']],
|
4566
|
-
captureCtrl: true,
|
4567
|
-
callback: () => {
|
4568
|
-
const fixedRows = parseInt(instance.getSettings().fixedRowsBottom, 10);
|
4569
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - fixedRows - 1, -1);
|
4570
|
-
const column = instance.columnIndexMapper.getNearestNotHiddenIndex(instance.countCols() - 1, -1);
|
4571
|
-
selection.setRangeStart(instance._createCellCoords(row, column));
|
4572
|
-
},
|
4573
|
-
runOnlyIf: () => instance.view.isMainTableNotFullyCoveredByOverlays()
|
4574
|
-
}, {
|
4575
|
-
keys: [['PageUp']],
|
4576
|
-
callback: () => {
|
4577
|
-
selection.transformStart(-instance.countVisibleRows(), 0);
|
4578
|
-
}
|
4579
|
-
}, {
|
4580
|
-
keys: [['PageUp', 'Shift']],
|
4581
|
-
callback: () => {
|
4582
|
-
const {
|
4583
|
-
to
|
4584
|
-
} = instance.getSelectedRangeLast();
|
4585
|
-
const nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
|
4586
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
4587
|
-
if (row !== null) {
|
4588
|
-
const coords = instance._createCellCoords(row, to.col);
|
4589
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4590
|
-
const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
4591
|
-
selection.setRangeEnd(coords);
|
4592
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4593
|
-
}
|
4594
|
-
}
|
4595
|
-
}, {
|
4596
|
-
keys: [['PageDown']],
|
4597
|
-
callback: () => {
|
4598
|
-
selection.transformStart(instance.countVisibleRows(), 0);
|
4599
|
-
}
|
4600
|
-
}, {
|
4601
|
-
keys: [['PageDown', 'Shift']],
|
4602
|
-
callback: () => {
|
4603
|
-
const {
|
4604
|
-
to
|
4605
|
-
} = instance.getSelectedRangeLast();
|
4606
|
-
const nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
|
4607
|
-
const row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
4608
|
-
if (row !== null) {
|
4609
|
-
const coords = instance._createCellCoords(row, to.col);
|
4610
|
-
const scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4611
|
-
const nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
|
4612
|
-
selection.setRangeEnd(coords);
|
4613
|
-
instance.scrollViewportTo(nextVerticalScroll);
|
4614
|
-
}
|
4615
|
-
}
|
4616
|
-
}, {
|
4617
|
-
keys: [['Tab']],
|
4618
|
-
callback: event => {
|
4619
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4620
|
-
selection.transformStart(tabMoves.row, tabMoves.col, true);
|
4621
|
-
}
|
4622
|
-
}, {
|
4623
|
-
keys: [['Shift', 'Tab']],
|
4624
|
-
callback: event => {
|
4625
|
-
const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
|
4626
|
-
selection.transformStart(-tabMoves.row, -tabMoves.col);
|
4627
|
-
}
|
4628
|
-
}], gridConfig);
|
4629
4585
|
getPluginsNames().forEach(pluginName => {
|
4630
4586
|
const PluginClass = getPlugin(pluginName);
|
4631
4587
|
pluginsRegistry.addItem(pluginName, new PluginClass(this));
|
4632
4588
|
});
|
4589
|
+
registerAllShortcutContexts(instance);
|
4590
|
+
shortcutManager.setActiveContextName('grid');
|
4633
4591
|
Hooks.getSingleton().run(instance, 'construct');
|
4634
4592
|
}
|