handsontable 0.0.0-next-baf2fcf-20230809 → 0.0.0-next-be16baf-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 +176 -293
- package/core.mjs +176 -293
- 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 +8682 -5384
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +25 -25
- package/dist/handsontable.js +10989 -7691
- 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 +293 -154
- package/selection/selection.mjs +290 -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
@@ -5,8 +5,8 @@ exports.__esModule = true;
|
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
6
|
var _element = require("../../helpers/dom/element");
|
7
7
|
var _number = require("../../helpers/number");
|
8
|
-
var _event = require("../../helpers/dom/event");
|
9
8
|
var _templateLiteralTag = require("../../helpers/templateLiteralTag");
|
9
|
+
var _event = require("../../helpers/dom/event");
|
10
10
|
var _console = require("../../helpers/console");
|
11
11
|
var _selection = require("../../selection");
|
12
12
|
var _base = require("../base");
|
@@ -158,6 +158,10 @@ class NestedHeaders extends _base.BasePlugin {
|
|
158
158
|
this.addHook('beforeOnCellMouseOver', function () {
|
159
159
|
return _this.onBeforeOnCellMouseOver(...arguments);
|
160
160
|
});
|
161
|
+
this.addHook('modifyTransformStart', function () {
|
162
|
+
return _this.onModifyTransformStart(...arguments);
|
163
|
+
});
|
164
|
+
this.addHook('afterSelection', () => this.updateFocusHighlightPosition());
|
161
165
|
this.addHook('afterGetColumnHeaderRenderers', array => this.onAfterGetColumnHeaderRenderers(array));
|
162
166
|
this.addHook('modifyColWidth', function () {
|
163
167
|
return _this.onModifyColWidth(...arguments);
|
@@ -171,9 +175,14 @@ class NestedHeaders extends _base.BasePlugin {
|
|
171
175
|
this.addHook('beforeCopy', function () {
|
172
176
|
return _this.onBeforeCopy(...arguments);
|
173
177
|
});
|
178
|
+
this.addHook('beforeSelectColumns', function () {
|
179
|
+
return _this.onBeforeSelectColumns(...arguments);
|
180
|
+
});
|
174
181
|
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
175
182
|
return _this.onAfterViewportColumnCalculatorOverride(...arguments);
|
176
183
|
});
|
184
|
+
this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
|
185
|
+
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
|
177
186
|
super.enablePlugin();
|
178
187
|
this.updatePlugin(); // @TODO: Workaround for broken plugin initialization abstraction.
|
179
188
|
}
|
@@ -389,6 +398,34 @@ class NestedHeaders extends _base.BasePlugin {
|
|
389
398
|
return this.hot.getColHeader(visualColumnIndex, headerLevel);
|
390
399
|
}
|
391
400
|
|
401
|
+
/**
|
402
|
+
* Updates the selection focus highlight position to point to the nested header root element (TH)
|
403
|
+
* even when the logical coordinates point in-between the header.
|
404
|
+
*
|
405
|
+
* @private
|
406
|
+
*/
|
407
|
+
updateFocusHighlightPosition() {
|
408
|
+
var _this$hot;
|
409
|
+
const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();
|
410
|
+
if (!selection) {
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
const {
|
414
|
+
highlight
|
415
|
+
} = selection;
|
416
|
+
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
417
|
+
if (isNestedHeadersRange) {
|
418
|
+
const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
419
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
420
|
+
|
421
|
+
// Correct the highlight/focus selection to highlight the correct TH element
|
422
|
+
focusHighlight.visualCellRange.highlight.col = columnIndex;
|
423
|
+
focusHighlight.visualCellRange.from.col = columnIndex;
|
424
|
+
focusHighlight.visualCellRange.to.col = columnIndex;
|
425
|
+
focusHighlight.commit();
|
426
|
+
}
|
427
|
+
}
|
428
|
+
|
392
429
|
/**
|
393
430
|
* Allows to control which header DOM element will be used to highlight.
|
394
431
|
*
|
@@ -404,7 +441,6 @@ class NestedHeaders extends _base.BasePlugin {
|
|
404
441
|
return visualColumn;
|
405
442
|
}
|
406
443
|
const {
|
407
|
-
classNames,
|
408
444
|
columnCursor,
|
409
445
|
selectionType,
|
410
446
|
selectionWidth
|
@@ -419,8 +455,8 @@ class NestedHeaders extends _base.BasePlugin {
|
|
419
455
|
}
|
420
456
|
} else if (selectionType === _selection.ACTIVE_HEADER_TYPE) {
|
421
457
|
if (colspan > selectionWidth - columnCursor || !isRoot) {
|
422
|
-
//
|
423
|
-
|
458
|
+
// Prevents adding any CSS class names to the TH element
|
459
|
+
return null;
|
424
460
|
}
|
425
461
|
}
|
426
462
|
return visualColumn;
|
@@ -574,13 +610,90 @@ class NestedHeaders extends _base.BasePlugin {
|
|
574
610
|
controller.cell = true;
|
575
611
|
const columnsToSelect = [];
|
576
612
|
if (coords.col < from.col) {
|
577
|
-
columnsToSelect.push(bottomEndCoords.col, columnIndex);
|
613
|
+
columnsToSelect.push(bottomEndCoords.col, columnIndex, coords.row);
|
578
614
|
} else if (coords.col > from.col) {
|
579
|
-
columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1);
|
615
|
+
columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, coords.row);
|
580
616
|
} else {
|
581
|
-
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1);
|
617
|
+
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
618
|
+
}
|
619
|
+
this.hot.selection.selectColumns(...columnsToSelect);
|
620
|
+
}
|
621
|
+
|
622
|
+
/**
|
623
|
+
* `modifyTransformStart` hook is called every time the keyboard navigation is used.
|
624
|
+
*
|
625
|
+
* @private
|
626
|
+
* @param {object} delta The transformation delta.
|
627
|
+
*/
|
628
|
+
onModifyTransformStart(delta) {
|
629
|
+
const {
|
630
|
+
highlight
|
631
|
+
} = this.hot.getSelectedRangeLast();
|
632
|
+
const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);
|
633
|
+
const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;
|
634
|
+
if (!isNestedHeadersRange) {
|
635
|
+
return;
|
636
|
+
}
|
637
|
+
const visualColumnIndexStart = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);
|
638
|
+
const visualColumnIndexEnd = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(nextCoords.row, nextCoords.col);
|
639
|
+
if (delta.col < 0) {
|
640
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
641
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
642
|
+
if (notHiddenColumnIndex === null) {
|
643
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
644
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
645
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
646
|
+
} else {
|
647
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
648
|
+
}
|
649
|
+
} else if (delta.col > 0) {
|
650
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
651
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
652
|
+
if (notHiddenColumnIndex === null) {
|
653
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
654
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
655
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
656
|
+
} else {
|
657
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
}
|
661
|
+
|
662
|
+
/**
|
663
|
+
* The hook observes the column selection from the Selection API and modifies the column range to
|
664
|
+
* ensure that the whole nested column will be covered.
|
665
|
+
*
|
666
|
+
* @private
|
667
|
+
* @param {*} from The coords object where the selection starts.
|
668
|
+
* @param {*} to The coords object where the selection ends.
|
669
|
+
*/
|
670
|
+
onBeforeSelectColumns(from, to) {
|
671
|
+
const headerLevel = from.row;
|
672
|
+
const startNodeData = this._getHeaderTreeNodeDataByCoords({
|
673
|
+
row: headerLevel,
|
674
|
+
col: from.col
|
675
|
+
});
|
676
|
+
const endNodeData = this._getHeaderTreeNodeDataByCoords({
|
677
|
+
row: headerLevel,
|
678
|
+
col: to.col
|
679
|
+
});
|
680
|
+
if (to.col < from.col) {
|
681
|
+
// Column selection from right to left
|
682
|
+
if (startNodeData) {
|
683
|
+
from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
|
684
|
+
}
|
685
|
+
if (endNodeData) {
|
686
|
+
to.col = endNodeData.columnIndex;
|
687
|
+
}
|
688
|
+
} else if (to.col >= from.col) {
|
689
|
+
// Column selection from left to right or a single column selection
|
690
|
+
if (startNodeData) {
|
691
|
+
from.col = startNodeData.columnIndex;
|
692
|
+
}
|
693
|
+
if (endNodeData) {
|
694
|
+
to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
|
695
|
+
}
|
582
696
|
}
|
583
|
-
this.hot.selectColumns(...columnsToSelect);
|
584
697
|
}
|
585
698
|
|
586
699
|
/**
|
@@ -12,8 +12,8 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
12
12
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
13
13
|
import { addClass, removeClass } from "../../helpers/dom/element.mjs";
|
14
14
|
import { isNumeric } from "../../helpers/number.mjs";
|
15
|
-
import { isLeftClick, isRightClick } from "../../helpers/dom/event.mjs";
|
16
15
|
import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
|
16
|
+
import { isLeftClick, isRightClick } from "../../helpers/dom/event.mjs";
|
17
17
|
import { warn } from "../../helpers/console.mjs";
|
18
18
|
import { ACTIVE_HEADER_TYPE, HEADER_TYPE } from "../../selection/index.mjs";
|
19
19
|
import { BasePlugin } from "../base/index.mjs";
|
@@ -152,6 +152,10 @@ export class NestedHeaders extends BasePlugin {
|
|
152
152
|
this.addHook('beforeOnCellMouseOver', function () {
|
153
153
|
return _this.onBeforeOnCellMouseOver(...arguments);
|
154
154
|
});
|
155
|
+
this.addHook('modifyTransformStart', function () {
|
156
|
+
return _this.onModifyTransformStart(...arguments);
|
157
|
+
});
|
158
|
+
this.addHook('afterSelection', () => this.updateFocusHighlightPosition());
|
155
159
|
this.addHook('afterGetColumnHeaderRenderers', array => this.onAfterGetColumnHeaderRenderers(array));
|
156
160
|
this.addHook('modifyColWidth', function () {
|
157
161
|
return _this.onModifyColWidth(...arguments);
|
@@ -165,9 +169,14 @@ export class NestedHeaders extends BasePlugin {
|
|
165
169
|
this.addHook('beforeCopy', function () {
|
166
170
|
return _this.onBeforeCopy(...arguments);
|
167
171
|
});
|
172
|
+
this.addHook('beforeSelectColumns', function () {
|
173
|
+
return _this.onBeforeSelectColumns(...arguments);
|
174
|
+
});
|
168
175
|
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
169
176
|
return _this.onAfterViewportColumnCalculatorOverride(...arguments);
|
170
177
|
});
|
178
|
+
this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
|
179
|
+
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => this.updateFocusHighlightPosition());
|
171
180
|
super.enablePlugin();
|
172
181
|
this.updatePlugin(); // @TODO: Workaround for broken plugin initialization abstraction.
|
173
182
|
}
|
@@ -383,6 +392,34 @@ export class NestedHeaders extends BasePlugin {
|
|
383
392
|
return this.hot.getColHeader(visualColumnIndex, headerLevel);
|
384
393
|
}
|
385
394
|
|
395
|
+
/**
|
396
|
+
* Updates the selection focus highlight position to point to the nested header root element (TH)
|
397
|
+
* even when the logical coordinates point in-between the header.
|
398
|
+
*
|
399
|
+
* @private
|
400
|
+
*/
|
401
|
+
updateFocusHighlightPosition() {
|
402
|
+
var _this$hot;
|
403
|
+
const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();
|
404
|
+
if (!selection) {
|
405
|
+
return;
|
406
|
+
}
|
407
|
+
const {
|
408
|
+
highlight
|
409
|
+
} = selection;
|
410
|
+
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
411
|
+
if (isNestedHeadersRange) {
|
412
|
+
const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
413
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
414
|
+
|
415
|
+
// Correct the highlight/focus selection to highlight the correct TH element
|
416
|
+
focusHighlight.visualCellRange.highlight.col = columnIndex;
|
417
|
+
focusHighlight.visualCellRange.from.col = columnIndex;
|
418
|
+
focusHighlight.visualCellRange.to.col = columnIndex;
|
419
|
+
focusHighlight.commit();
|
420
|
+
}
|
421
|
+
}
|
422
|
+
|
386
423
|
/**
|
387
424
|
* Allows to control which header DOM element will be used to highlight.
|
388
425
|
*
|
@@ -398,7 +435,6 @@ export class NestedHeaders extends BasePlugin {
|
|
398
435
|
return visualColumn;
|
399
436
|
}
|
400
437
|
const {
|
401
|
-
classNames,
|
402
438
|
columnCursor,
|
403
439
|
selectionType,
|
404
440
|
selectionWidth
|
@@ -413,8 +449,8 @@ export class NestedHeaders extends BasePlugin {
|
|
413
449
|
}
|
414
450
|
} else if (selectionType === ACTIVE_HEADER_TYPE) {
|
415
451
|
if (colspan > selectionWidth - columnCursor || !isRoot) {
|
416
|
-
//
|
417
|
-
|
452
|
+
// Prevents adding any CSS class names to the TH element
|
453
|
+
return null;
|
418
454
|
}
|
419
455
|
}
|
420
456
|
return visualColumn;
|
@@ -568,13 +604,90 @@ export class NestedHeaders extends BasePlugin {
|
|
568
604
|
controller.cell = true;
|
569
605
|
const columnsToSelect = [];
|
570
606
|
if (coords.col < from.col) {
|
571
|
-
columnsToSelect.push(bottomEndCoords.col, columnIndex);
|
607
|
+
columnsToSelect.push(bottomEndCoords.col, columnIndex, coords.row);
|
572
608
|
} else if (coords.col > from.col) {
|
573
|
-
columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1);
|
609
|
+
columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, coords.row);
|
574
610
|
} else {
|
575
|
-
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1);
|
611
|
+
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
612
|
+
}
|
613
|
+
this.hot.selection.selectColumns(...columnsToSelect);
|
614
|
+
}
|
615
|
+
|
616
|
+
/**
|
617
|
+
* `modifyTransformStart` hook is called every time the keyboard navigation is used.
|
618
|
+
*
|
619
|
+
* @private
|
620
|
+
* @param {object} delta The transformation delta.
|
621
|
+
*/
|
622
|
+
onModifyTransformStart(delta) {
|
623
|
+
const {
|
624
|
+
highlight
|
625
|
+
} = this.hot.getSelectedRangeLast();
|
626
|
+
const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);
|
627
|
+
const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;
|
628
|
+
if (!isNestedHeadersRange) {
|
629
|
+
return;
|
630
|
+
}
|
631
|
+
const visualColumnIndexStart = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);
|
632
|
+
const visualColumnIndexEnd = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(nextCoords.row, nextCoords.col);
|
633
|
+
if (delta.col < 0) {
|
634
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
635
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
636
|
+
if (notHiddenColumnIndex === null) {
|
637
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
638
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
639
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
640
|
+
} else {
|
641
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
642
|
+
}
|
643
|
+
} else if (delta.col > 0) {
|
644
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
645
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
646
|
+
if (notHiddenColumnIndex === null) {
|
647
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
648
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
649
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
650
|
+
} else {
|
651
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
652
|
+
}
|
653
|
+
}
|
654
|
+
}
|
655
|
+
|
656
|
+
/**
|
657
|
+
* The hook observes the column selection from the Selection API and modifies the column range to
|
658
|
+
* ensure that the whole nested column will be covered.
|
659
|
+
*
|
660
|
+
* @private
|
661
|
+
* @param {*} from The coords object where the selection starts.
|
662
|
+
* @param {*} to The coords object where the selection ends.
|
663
|
+
*/
|
664
|
+
onBeforeSelectColumns(from, to) {
|
665
|
+
const headerLevel = from.row;
|
666
|
+
const startNodeData = this._getHeaderTreeNodeDataByCoords({
|
667
|
+
row: headerLevel,
|
668
|
+
col: from.col
|
669
|
+
});
|
670
|
+
const endNodeData = this._getHeaderTreeNodeDataByCoords({
|
671
|
+
row: headerLevel,
|
672
|
+
col: to.col
|
673
|
+
});
|
674
|
+
if (to.col < from.col) {
|
675
|
+
// Column selection from right to left
|
676
|
+
if (startNodeData) {
|
677
|
+
from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
|
678
|
+
}
|
679
|
+
if (endNodeData) {
|
680
|
+
to.col = endNodeData.columnIndex;
|
681
|
+
}
|
682
|
+
} else if (to.col >= from.col) {
|
683
|
+
// Column selection from left to right or a single column selection
|
684
|
+
if (startNodeData) {
|
685
|
+
from.col = startNodeData.columnIndex;
|
686
|
+
}
|
687
|
+
if (endNodeData) {
|
688
|
+
to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
|
689
|
+
}
|
576
690
|
}
|
577
|
-
this.hot.selectColumns(...columnsToSelect);
|
578
691
|
}
|
579
692
|
|
580
693
|
/**
|
@@ -367,6 +367,43 @@ class StateManager {
|
|
367
367
|
return stepBackColumn;
|
368
368
|
}
|
369
369
|
|
370
|
+
/**
|
371
|
+
* The method is helpful in cases where the column index targets in-between currently
|
372
|
+
* collapsed column. In that case, the method returns the right-most column index
|
373
|
+
* where the nested header ends.
|
374
|
+
*
|
375
|
+
* @param {number} headerLevel Header level (there is support for negative and positive values).
|
376
|
+
* @param {number} columnIndex A visual column index.
|
377
|
+
* @returns {number}
|
378
|
+
*/
|
379
|
+
findRightMostColumnIndex(headerLevel, columnIndex) {
|
380
|
+
var _this$getHeaderSettin3;
|
381
|
+
const {
|
382
|
+
isRoot,
|
383
|
+
origColspan
|
384
|
+
} = (_this$getHeaderSettin3 = this.getHeaderSettings(headerLevel, columnIndex)) !== null && _this$getHeaderSettin3 !== void 0 ? _this$getHeaderSettin3 : {
|
385
|
+
isRoot: true,
|
386
|
+
origColspan: 1
|
387
|
+
};
|
388
|
+
if (isRoot) {
|
389
|
+
return columnIndex + origColspan - 1;
|
390
|
+
}
|
391
|
+
let stepForthColumn = columnIndex + 1;
|
392
|
+
while (stepForthColumn < this.getColumnsCount()) {
|
393
|
+
var _this$getHeaderSettin4;
|
394
|
+
const {
|
395
|
+
isRoot: isRootNode
|
396
|
+
} = (_this$getHeaderSettin4 = this.getHeaderSettings(headerLevel, stepForthColumn)) !== null && _this$getHeaderSettin4 !== void 0 ? _this$getHeaderSettin4 : {
|
397
|
+
isRoot: true
|
398
|
+
};
|
399
|
+
if (isRootNode) {
|
400
|
+
break;
|
401
|
+
}
|
402
|
+
stepForthColumn += 1;
|
403
|
+
}
|
404
|
+
return stepForthColumn - 1;
|
405
|
+
}
|
406
|
+
|
370
407
|
/**
|
371
408
|
* Gets a total number of headers levels.
|
372
409
|
*
|
@@ -363,6 +363,43 @@ export default class StateManager {
|
|
363
363
|
return stepBackColumn;
|
364
364
|
}
|
365
365
|
|
366
|
+
/**
|
367
|
+
* The method is helpful in cases where the column index targets in-between currently
|
368
|
+
* collapsed column. In that case, the method returns the right-most column index
|
369
|
+
* where the nested header ends.
|
370
|
+
*
|
371
|
+
* @param {number} headerLevel Header level (there is support for negative and positive values).
|
372
|
+
* @param {number} columnIndex A visual column index.
|
373
|
+
* @returns {number}
|
374
|
+
*/
|
375
|
+
findRightMostColumnIndex(headerLevel, columnIndex) {
|
376
|
+
var _this$getHeaderSettin3;
|
377
|
+
const {
|
378
|
+
isRoot,
|
379
|
+
origColspan
|
380
|
+
} = (_this$getHeaderSettin3 = this.getHeaderSettings(headerLevel, columnIndex)) !== null && _this$getHeaderSettin3 !== void 0 ? _this$getHeaderSettin3 : {
|
381
|
+
isRoot: true,
|
382
|
+
origColspan: 1
|
383
|
+
};
|
384
|
+
if (isRoot) {
|
385
|
+
return columnIndex + origColspan - 1;
|
386
|
+
}
|
387
|
+
let stepForthColumn = columnIndex + 1;
|
388
|
+
while (stepForthColumn < this.getColumnsCount()) {
|
389
|
+
var _this$getHeaderSettin4;
|
390
|
+
const {
|
391
|
+
isRoot: isRootNode
|
392
|
+
} = (_this$getHeaderSettin4 = this.getHeaderSettings(headerLevel, stepForthColumn)) !== null && _this$getHeaderSettin4 !== void 0 ? _this$getHeaderSettin4 : {
|
393
|
+
isRoot: true
|
394
|
+
};
|
395
|
+
if (isRootNode) {
|
396
|
+
break;
|
397
|
+
}
|
398
|
+
stepForthColumn += 1;
|
399
|
+
}
|
400
|
+
return stepForthColumn - 1;
|
401
|
+
}
|
402
|
+
|
366
403
|
/**
|
367
404
|
* Gets a total number of headers levels.
|
368
405
|
*
|
@@ -16,6 +16,7 @@ const PLUGIN_KEY = 'nestedRows';
|
|
16
16
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
17
17
|
const PLUGIN_PRIORITY = 300;
|
18
18
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
19
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
19
20
|
const privatePool = new WeakMap();
|
20
21
|
|
21
22
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
@@ -150,6 +151,7 @@ class NestedRows extends _base.BasePlugin {
|
|
150
151
|
});
|
151
152
|
this.addHook('beforeLoadData', data => this.onBeforeLoadData(data));
|
152
153
|
this.addHook('beforeUpdateData', data => this.onBeforeLoadData(data));
|
154
|
+
this.registerShortcuts();
|
153
155
|
super.enablePlugin();
|
154
156
|
}
|
155
157
|
|
@@ -158,6 +160,7 @@ class NestedRows extends _base.BasePlugin {
|
|
158
160
|
*/
|
159
161
|
disablePlugin() {
|
160
162
|
this.hot.rowIndexMapper.unregisterMap('nestedRows');
|
163
|
+
this.unregisterShortcuts();
|
161
164
|
super.disablePlugin();
|
162
165
|
}
|
163
166
|
|
@@ -179,6 +182,44 @@ class NestedRows extends _base.BasePlugin {
|
|
179
182
|
super.updatePlugin();
|
180
183
|
}
|
181
184
|
|
185
|
+
/**
|
186
|
+
* Register shortcuts responsible for toggling collapsible columns.
|
187
|
+
*
|
188
|
+
* @private
|
189
|
+
*/
|
190
|
+
registerShortcuts() {
|
191
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
192
|
+
keys: [['Enter']],
|
193
|
+
callback: () => {
|
194
|
+
const {
|
195
|
+
highlight
|
196
|
+
} = this.hot.getSelectedRangeLast();
|
197
|
+
if (highlight.col === -1 && highlight.row >= 0) {
|
198
|
+
const row = this.collapsingUI.translateTrimmedRow(highlight.row);
|
199
|
+
if (this.collapsingUI.areChildrenCollapsed(row)) {
|
200
|
+
this.collapsingUI.expandChildren(row);
|
201
|
+
} else {
|
202
|
+
this.collapsingUI.collapseChildren(row);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
},
|
206
|
+
runOnlyIf: () => {
|
207
|
+
var _this$hot$getSelected;
|
208
|
+
return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
|
209
|
+
},
|
210
|
+
group: SHORTCUTS_GROUP
|
211
|
+
});
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Unregister shortcuts responsible for toggling collapsible columns.
|
216
|
+
*
|
217
|
+
* @private
|
218
|
+
*/
|
219
|
+
unregisterShortcuts() {
|
220
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
221
|
+
}
|
222
|
+
|
182
223
|
/**
|
183
224
|
* `beforeRowMove` hook callback.
|
184
225
|
*
|
@@ -10,6 +10,7 @@ import { TrimmingMap } from "../../translations/index.mjs";
|
|
10
10
|
import RowMoveController from "./utils/rowMoveController.mjs";
|
11
11
|
export const PLUGIN_KEY = 'nestedRows';
|
12
12
|
export const PLUGIN_PRIORITY = 300;
|
13
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
13
14
|
const privatePool = new WeakMap();
|
14
15
|
|
15
16
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
@@ -144,6 +145,7 @@ export class NestedRows extends BasePlugin {
|
|
144
145
|
});
|
145
146
|
this.addHook('beforeLoadData', data => this.onBeforeLoadData(data));
|
146
147
|
this.addHook('beforeUpdateData', data => this.onBeforeLoadData(data));
|
148
|
+
this.registerShortcuts();
|
147
149
|
super.enablePlugin();
|
148
150
|
}
|
149
151
|
|
@@ -152,6 +154,7 @@ export class NestedRows extends BasePlugin {
|
|
152
154
|
*/
|
153
155
|
disablePlugin() {
|
154
156
|
this.hot.rowIndexMapper.unregisterMap('nestedRows');
|
157
|
+
this.unregisterShortcuts();
|
155
158
|
super.disablePlugin();
|
156
159
|
}
|
157
160
|
|
@@ -173,6 +176,44 @@ export class NestedRows extends BasePlugin {
|
|
173
176
|
super.updatePlugin();
|
174
177
|
}
|
175
178
|
|
179
|
+
/**
|
180
|
+
* Register shortcuts responsible for toggling collapsible columns.
|
181
|
+
*
|
182
|
+
* @private
|
183
|
+
*/
|
184
|
+
registerShortcuts() {
|
185
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
186
|
+
keys: [['Enter']],
|
187
|
+
callback: () => {
|
188
|
+
const {
|
189
|
+
highlight
|
190
|
+
} = this.hot.getSelectedRangeLast();
|
191
|
+
if (highlight.col === -1 && highlight.row >= 0) {
|
192
|
+
const row = this.collapsingUI.translateTrimmedRow(highlight.row);
|
193
|
+
if (this.collapsingUI.areChildrenCollapsed(row)) {
|
194
|
+
this.collapsingUI.expandChildren(row);
|
195
|
+
} else {
|
196
|
+
this.collapsingUI.collapseChildren(row);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
},
|
200
|
+
runOnlyIf: () => {
|
201
|
+
var _this$hot$getSelected;
|
202
|
+
return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
|
203
|
+
},
|
204
|
+
group: SHORTCUTS_GROUP
|
205
|
+
});
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Unregister shortcuts responsible for toggling collapsible columns.
|
210
|
+
*
|
211
|
+
* @private
|
212
|
+
*/
|
213
|
+
unregisterShortcuts() {
|
214
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
215
|
+
}
|
216
|
+
|
176
217
|
/**
|
177
218
|
* `beforeRowMove` hook callback.
|
178
219
|
*
|
@@ -7,7 +7,7 @@ var _baseRenderer = require("../baseRenderer");
|
|
7
7
|
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
8
8
|
var _element = require("../../helpers/dom/element");
|
9
9
|
var _mixed = require("../../helpers/mixed");
|
10
|
-
var
|
10
|
+
var _shortcutContexts = require("../../shortcutContexts");
|
11
11
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
const isListeningKeyDownEvent = new WeakMap();
|
@@ -158,7 +158,7 @@ function checkboxRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
|
158
158
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
159
159
|
},
|
160
160
|
|
161
|
-
relativeToGroup:
|
161
|
+
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
162
162
|
position: 'before'
|
163
163
|
}], config);
|
164
164
|
}
|
@@ -3,7 +3,7 @@ import { baseRenderer } from "../baseRenderer/index.mjs";
|
|
3
3
|
import EventManager from "../../eventManager.mjs";
|
4
4
|
import { empty, addClass } from "../../helpers/dom/element.mjs";
|
5
5
|
import { isEmpty, stringify } from "../../helpers/mixed.mjs";
|
6
|
-
import { SHORTCUTS_GROUP_EDITOR } from "../../
|
6
|
+
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
7
7
|
import Hooks from "../../pluginHooks.mjs";
|
8
8
|
const isListeningKeyDownEvent = new WeakMap();
|
9
9
|
const isCheckboxListenerAdded = new WeakMap();
|