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
@@ -1,6 +1,8 @@
|
|
1
1
|
import { BasePlugin } from "../base/index.mjs";
|
2
2
|
import { arrayEach } from "../../helpers/array.mjs";
|
3
|
+
import { objectEach } from "../../helpers/object.mjs";
|
3
4
|
import CommandExecutor from "../contextMenu/commandExecutor.mjs";
|
5
|
+
import { getDocumentOffsetByElement } from "../contextMenu/utils.mjs";
|
4
6
|
import EventManager from "../../eventManager.mjs";
|
5
7
|
import { hasClass } from "../../helpers/dom/element.mjs";
|
6
8
|
import ItemsFactory from "../contextMenu/itemsFactory.mjs";
|
@@ -15,6 +17,7 @@ Hooks.getSingleton().register('afterDropdownMenuExecute');
|
|
15
17
|
export const PLUGIN_KEY = 'dropdownMenu';
|
16
18
|
export const PLUGIN_PRIORITY = 230;
|
17
19
|
const BUTTON_CLASS_NAME = 'changeType';
|
20
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
18
21
|
|
19
22
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
20
23
|
/**
|
@@ -151,6 +154,7 @@ export class DropdownMenu extends BasePlugin {
|
|
151
154
|
if (typeof settings.callback === 'function') {
|
152
155
|
this.commandExecutor.setCommonCallback(settings.callback);
|
153
156
|
}
|
157
|
+
this.registerShortcuts();
|
154
158
|
super.enablePlugin();
|
155
159
|
this.callOnPluginsReady(() => {
|
156
160
|
this.hot.runHooks('afterDropdownMenuDefaultOptions', predefinedItems);
|
@@ -201,9 +205,68 @@ export class DropdownMenu extends BasePlugin {
|
|
201
205
|
if (this.menu) {
|
202
206
|
this.menu.destroy();
|
203
207
|
}
|
208
|
+
this.unregisterShortcuts();
|
204
209
|
super.disablePlugin();
|
205
210
|
}
|
206
211
|
|
212
|
+
/**
|
213
|
+
* Register shortcuts responsible for toggling dropdown menu.
|
214
|
+
*
|
215
|
+
* @private
|
216
|
+
*/
|
217
|
+
registerShortcuts() {
|
218
|
+
const context = this.hot.getShortcutManager().getContext('grid');
|
219
|
+
const callback = () => {
|
220
|
+
const {
|
221
|
+
highlight
|
222
|
+
} = this.hot.getSelectedRangeLast();
|
223
|
+
if ((highlight.isHeader() && highlight.row === -1 || highlight.isCell()) && highlight.col >= 0) {
|
224
|
+
this.hot.selectColumns(highlight.col, highlight.col, -1);
|
225
|
+
const {
|
226
|
+
from
|
227
|
+
} = this.hot.getSelectedRangeLast();
|
228
|
+
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
229
|
+
const target = this.hot.getCell(-1, from.col, true);
|
230
|
+
const rect = target.getBoundingClientRect();
|
231
|
+
this.open({
|
232
|
+
left: rect.left + offset.left,
|
233
|
+
top: rect.top + target.offsetHeight + offset.top
|
234
|
+
}, {
|
235
|
+
left: rect.width
|
236
|
+
});
|
237
|
+
this.hot._registerTimeout(() => {
|
238
|
+
this.menu.selectFirstCell();
|
239
|
+
});
|
240
|
+
}
|
241
|
+
};
|
242
|
+
context.addShortcuts([{
|
243
|
+
keys: [['Shift', 'Alt', 'ArrowDown'], ['Shift', 'Enter']],
|
244
|
+
callback,
|
245
|
+
runOnlyIf: () => {
|
246
|
+
var _this$hot$getSelected;
|
247
|
+
return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader()) && !this.menu.isOpened();
|
248
|
+
},
|
249
|
+
group: SHORTCUTS_GROUP
|
250
|
+
}, {
|
251
|
+
keys: [['Shift', 'Alt', 'ArrowDown']],
|
252
|
+
callback,
|
253
|
+
runOnlyIf: () => {
|
254
|
+
var _this$hot$getSelected2;
|
255
|
+
return ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isCell()) && !this.menu.isOpened();
|
256
|
+
},
|
257
|
+
group: SHORTCUTS_GROUP
|
258
|
+
}]);
|
259
|
+
}
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Unregister shortcuts responsible for toggling dropdown menu.
|
263
|
+
*
|
264
|
+
* @private
|
265
|
+
*/
|
266
|
+
unregisterShortcuts() {
|
267
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
268
|
+
}
|
269
|
+
|
207
270
|
/**
|
208
271
|
* Registers the DOM listeners.
|
209
272
|
*
|
@@ -216,23 +279,30 @@ export class DropdownMenu extends BasePlugin {
|
|
216
279
|
/**
|
217
280
|
* Opens menu and re-position it based on the passed coordinates.
|
218
281
|
*
|
219
|
-
* @param {
|
220
|
-
*
|
221
|
-
*
|
222
|
-
*
|
223
|
-
*
|
282
|
+
* @param {{ top: number, left: number }|Event} position An object with `top` and `left` properties
|
283
|
+
* which contains coordinates relative to the browsers viewport (without included scroll offsets).
|
284
|
+
* Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`
|
285
|
+
* coordinates.
|
286
|
+
* @param {{ above: number, below: number, left: number, right: number }} offset An object allows applying
|
287
|
+
* the offset to the menu position.
|
224
288
|
* @fires Hooks#beforeDropdownMenuShow
|
225
289
|
* @fires Hooks#afterDropdownMenuShow
|
226
290
|
*/
|
227
|
-
|
228
291
|
open(position) {
|
229
|
-
|
292
|
+
var _this$menu;
|
293
|
+
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
294
|
+
above: 0,
|
295
|
+
below: 0,
|
296
|
+
left: 0,
|
297
|
+
right: 0
|
298
|
+
};
|
299
|
+
if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {
|
230
300
|
return;
|
231
301
|
}
|
232
302
|
this.menu.open();
|
233
|
-
|
234
|
-
this.menu.setOffset(
|
235
|
-
}
|
303
|
+
objectEach(offset, (value, key) => {
|
304
|
+
this.menu.setOffset(key, value);
|
305
|
+
});
|
236
306
|
this.menu.setPosition(position);
|
237
307
|
}
|
238
308
|
|
@@ -240,10 +310,8 @@ export class DropdownMenu extends BasePlugin {
|
|
240
310
|
* Closes dropdown menu.
|
241
311
|
*/
|
242
312
|
close() {
|
243
|
-
|
244
|
-
|
245
|
-
}
|
246
|
-
this.menu.close();
|
313
|
+
var _this$menu2;
|
314
|
+
(_this$menu2 = this.menu) === null || _this$menu2 === void 0 ? void 0 : _this$menu2.close();
|
247
315
|
}
|
248
316
|
|
249
317
|
/**
|
@@ -308,26 +376,14 @@ export class DropdownMenu extends BasePlugin {
|
|
308
376
|
*/
|
309
377
|
onTableClick(event) {
|
310
378
|
event.stopPropagation();
|
311
|
-
if (hasClass(event.target, BUTTON_CLASS_NAME)
|
312
|
-
|
313
|
-
let offsetLeft = 0;
|
314
|
-
if (this.hot.rootDocument !== this.menu.container.ownerDocument) {
|
315
|
-
const {
|
316
|
-
frameElement
|
317
|
-
} = this.hot.rootWindow;
|
318
|
-
const {
|
319
|
-
top,
|
320
|
-
left
|
321
|
-
} = frameElement.getBoundingClientRect();
|
322
|
-
offsetTop = top;
|
323
|
-
offsetLeft = left;
|
324
|
-
}
|
379
|
+
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
380
|
+
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
325
381
|
const rect = event.target.getBoundingClientRect();
|
326
382
|
this.open({
|
327
|
-
left: rect.left +
|
328
|
-
top: rect.top + event.target.offsetHeight + 3 +
|
329
|
-
|
330
|
-
|
383
|
+
left: rect.left + offset.left,
|
384
|
+
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
385
|
+
}, {
|
386
|
+
left: rect.width
|
331
387
|
});
|
332
388
|
}
|
333
389
|
}
|
@@ -366,6 +422,7 @@ export class DropdownMenu extends BasePlugin {
|
|
366
422
|
const button = this.hot.rootDocument.createElement('button');
|
367
423
|
button.className = BUTTON_CLASS_NAME;
|
368
424
|
button.type = 'button';
|
425
|
+
button.tabIndex = -1;
|
369
426
|
|
370
427
|
// prevent page reload on button click
|
371
428
|
button.onclick = function () {
|
@@ -27,6 +27,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
27
27
|
const PLUGIN_KEY = 'filters';
|
28
28
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
29
29
|
const PLUGIN_PRIORITY = 250;
|
30
|
+
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
31
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
30
32
|
|
31
33
|
/**
|
32
34
|
* @plugin Filters
|
@@ -63,7 +65,6 @@ const PLUGIN_PRIORITY = 250;
|
|
63
65
|
* ```
|
64
66
|
* :::
|
65
67
|
*/
|
66
|
-
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
67
68
|
class Filters extends _base.BasePlugin {
|
68
69
|
static get PLUGIN_KEY() {
|
69
70
|
return PLUGIN_KEY;
|
@@ -210,6 +211,7 @@ class Filters extends _base.BasePlugin {
|
|
210
211
|
this.dropdownMenuPlugin.disablePlugin();
|
211
212
|
this.dropdownMenuPlugin.enablePlugin();
|
212
213
|
}
|
214
|
+
this.registerShortcuts();
|
213
215
|
super.enablePlugin();
|
214
216
|
}
|
215
217
|
|
@@ -230,9 +232,36 @@ class Filters extends _base.BasePlugin {
|
|
230
232
|
this.conditionCollection = null;
|
231
233
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
232
234
|
}
|
235
|
+
this.unregisterShortcuts();
|
233
236
|
super.disablePlugin();
|
234
237
|
}
|
235
238
|
|
239
|
+
/**
|
240
|
+
* Register shortcuts responsible for clearing the filters.
|
241
|
+
*
|
242
|
+
* @private
|
243
|
+
*/
|
244
|
+
registerShortcuts() {
|
245
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
246
|
+
keys: [['Alt', 'A']],
|
247
|
+
stopPropagation: true,
|
248
|
+
callback: () => {
|
249
|
+
this.clearConditions();
|
250
|
+
this.filter();
|
251
|
+
},
|
252
|
+
group: SHORTCUTS_GROUP
|
253
|
+
});
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Unregister shortcuts responsible for clearing the filters.
|
258
|
+
*
|
259
|
+
* @private
|
260
|
+
*/
|
261
|
+
unregisterShortcuts() {
|
262
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
263
|
+
}
|
264
|
+
|
236
265
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
237
266
|
/**
|
238
267
|
* @memberof Filters#
|
@@ -422,7 +451,6 @@ class Filters extends _base.BasePlugin {
|
|
422
451
|
this.hot.runHooks('afterFilter', conditions);
|
423
452
|
this.hot.view.adjustElementsSize(true);
|
424
453
|
this.hot.render();
|
425
|
-
this.clearColumnSelection();
|
426
454
|
}
|
427
455
|
|
428
456
|
/**
|
@@ -444,18 +472,6 @@ class Filters extends _base.BasePlugin {
|
|
444
472
|
};
|
445
473
|
}
|
446
474
|
|
447
|
-
/**
|
448
|
-
* Clears column selection.
|
449
|
-
*
|
450
|
-
* @private
|
451
|
-
*/
|
452
|
-
clearColumnSelection() {
|
453
|
-
const selectedColumn = this.getSelectedColumn();
|
454
|
-
if (selectedColumn !== null) {
|
455
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
456
|
-
}
|
457
|
-
}
|
458
|
-
|
459
475
|
/**
|
460
476
|
* Returns handsontable source data with cell meta based on current selection.
|
461
477
|
*
|
@@ -655,6 +671,7 @@ class Filters extends _base.BasePlugin {
|
|
655
671
|
this.components.forEach(component => component.saveState(physicalIndex));
|
656
672
|
this.filtersRowsMap.clear();
|
657
673
|
this.filter();
|
674
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
658
675
|
}
|
659
676
|
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
660
677
|
}
|
@@ -20,6 +20,7 @@ import { CONDITION_NONE, CONDITION_BY_VALUE, OPERATION_AND, OPERATION_OR, OPERAT
|
|
20
20
|
import { TrimmingMap } from "../../translations/index.mjs";
|
21
21
|
export const PLUGIN_KEY = 'filters';
|
22
22
|
export const PLUGIN_PRIORITY = 250;
|
23
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
23
24
|
|
24
25
|
/**
|
25
26
|
* @plugin Filters
|
@@ -202,6 +203,7 @@ export class Filters extends BasePlugin {
|
|
202
203
|
this.dropdownMenuPlugin.disablePlugin();
|
203
204
|
this.dropdownMenuPlugin.enablePlugin();
|
204
205
|
}
|
206
|
+
this.registerShortcuts();
|
205
207
|
super.enablePlugin();
|
206
208
|
}
|
207
209
|
|
@@ -222,9 +224,36 @@ export class Filters extends BasePlugin {
|
|
222
224
|
this.conditionCollection = null;
|
223
225
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
224
226
|
}
|
227
|
+
this.unregisterShortcuts();
|
225
228
|
super.disablePlugin();
|
226
229
|
}
|
227
230
|
|
231
|
+
/**
|
232
|
+
* Register shortcuts responsible for clearing the filters.
|
233
|
+
*
|
234
|
+
* @private
|
235
|
+
*/
|
236
|
+
registerShortcuts() {
|
237
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
238
|
+
keys: [['Alt', 'A']],
|
239
|
+
stopPropagation: true,
|
240
|
+
callback: () => {
|
241
|
+
this.clearConditions();
|
242
|
+
this.filter();
|
243
|
+
},
|
244
|
+
group: SHORTCUTS_GROUP
|
245
|
+
});
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Unregister shortcuts responsible for clearing the filters.
|
250
|
+
*
|
251
|
+
* @private
|
252
|
+
*/
|
253
|
+
unregisterShortcuts() {
|
254
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
255
|
+
}
|
256
|
+
|
228
257
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
229
258
|
/**
|
230
259
|
* @memberof Filters#
|
@@ -414,7 +443,6 @@ export class Filters extends BasePlugin {
|
|
414
443
|
this.hot.runHooks('afterFilter', conditions);
|
415
444
|
this.hot.view.adjustElementsSize(true);
|
416
445
|
this.hot.render();
|
417
|
-
this.clearColumnSelection();
|
418
446
|
}
|
419
447
|
|
420
448
|
/**
|
@@ -436,18 +464,6 @@ export class Filters extends BasePlugin {
|
|
436
464
|
};
|
437
465
|
}
|
438
466
|
|
439
|
-
/**
|
440
|
-
* Clears column selection.
|
441
|
-
*
|
442
|
-
* @private
|
443
|
-
*/
|
444
|
-
clearColumnSelection() {
|
445
|
-
const selectedColumn = this.getSelectedColumn();
|
446
|
-
if (selectedColumn !== null) {
|
447
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
448
|
-
}
|
449
|
-
}
|
450
|
-
|
451
467
|
/**
|
452
468
|
* Returns handsontable source data with cell meta based on current selection.
|
453
469
|
*
|
@@ -647,6 +663,7 @@ export class Filters extends BasePlugin {
|
|
647
663
|
this.components.forEach(component => component.saveState(physicalIndex));
|
648
664
|
this.filtersRowsMap.clear();
|
649
665
|
this.filter();
|
666
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
650
667
|
}
|
651
668
|
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
652
669
|
}
|
@@ -221,12 +221,6 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
221
221
|
return;
|
222
222
|
}
|
223
223
|
this.currentTH = TH;
|
224
|
-
const hotRootElement = this.hot.rootElement;
|
225
|
-
|
226
|
-
// Handling elements placed only inside columns header of the main instance.
|
227
|
-
if ((0, _element.overlayContainsElement)('top_inline_start_corner', this.currentTH, hotRootElement) === false && (0, _element.overlayContainsElement)('top', this.currentTH, hotRootElement) === false) {
|
228
|
-
return;
|
229
|
-
}
|
230
224
|
const {
|
231
225
|
_wt: wt
|
232
226
|
} = this.hot.view;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
2
|
import { BasePlugin } from "../base/index.mjs";
|
3
|
-
import { addClass, closest, hasClass, removeClass, outerHeight, isDetached
|
3
|
+
import { addClass, closest, hasClass, removeClass, outerHeight, isDetached } from "../../helpers/dom/element.mjs";
|
4
4
|
import EventManager from "../../eventManager.mjs";
|
5
5
|
import { arrayEach } from "../../helpers/array.mjs";
|
6
6
|
import { rangeEach } from "../../helpers/number.mjs";
|
@@ -213,12 +213,6 @@ export class ManualColumnResize extends BasePlugin {
|
|
213
213
|
return;
|
214
214
|
}
|
215
215
|
this.currentTH = TH;
|
216
|
-
const hotRootElement = this.hot.rootElement;
|
217
|
-
|
218
|
-
// Handling elements placed only inside columns header of the main instance.
|
219
|
-
if (overlayContainsElement('top_inline_start_corner', this.currentTH, hotRootElement) === false && overlayContainsElement('top', this.currentTH, hotRootElement) === false) {
|
220
|
-
return;
|
221
|
-
}
|
222
216
|
const {
|
223
217
|
_wt: wt
|
224
218
|
} = this.hot.view;
|
@@ -188,9 +188,6 @@ class MergeCells extends _base.BasePlugin {
|
|
188
188
|
this.addHook('afterDrawSelection', function () {
|
189
189
|
return _this.onAfterDrawSelection(...arguments);
|
190
190
|
});
|
191
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
192
|
-
return _this.onBeforeRemoveCellClassNames(...arguments);
|
193
|
-
});
|
194
191
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
195
192
|
if (source === 'MergeCells') {
|
196
193
|
return false;
|
@@ -497,7 +494,6 @@ class MergeCells extends _base.BasePlugin {
|
|
497
494
|
(0, _number.rangeEach)(0, currentCollection.rowspan - 1, i => {
|
498
495
|
(0, _number.rangeEach)(0, currentCollection.colspan - 1, j => {
|
499
496
|
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
|
500
|
-
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'copyable');
|
501
497
|
});
|
502
498
|
});
|
503
499
|
this.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
|
@@ -575,8 +571,11 @@ class MergeCells extends _base.BasePlugin {
|
|
575
571
|
gridContext.addShortcut({
|
576
572
|
keys: [['Control', 'm']],
|
577
573
|
callback: () => {
|
578
|
-
this.
|
579
|
-
|
574
|
+
const range = this.hot.getSelectedRangeLast();
|
575
|
+
if (range && !range.isSingleHeader()) {
|
576
|
+
this.toggleMerge(range);
|
577
|
+
this.hot.render();
|
578
|
+
}
|
580
579
|
},
|
581
580
|
runOnlyIf: event => !event.altKey,
|
582
581
|
// right ALT in some systems triggers ALT+CTRL
|
@@ -1199,16 +1198,5 @@ class MergeCells extends _base.BasePlugin {
|
|
1199
1198
|
}
|
1200
1199
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1201
1200
|
}
|
1202
|
-
|
1203
|
-
/**
|
1204
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1205
|
-
*
|
1206
|
-
* @private
|
1207
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1208
|
-
* all the cells in the table.
|
1209
|
-
*/
|
1210
|
-
onBeforeRemoveCellClassNames() {
|
1211
|
-
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1212
|
-
}
|
1213
1201
|
}
|
1214
1202
|
exports.MergeCells = MergeCells;
|
@@ -182,9 +182,6 @@ export class MergeCells extends BasePlugin {
|
|
182
182
|
this.addHook('afterDrawSelection', function () {
|
183
183
|
return _this.onAfterDrawSelection(...arguments);
|
184
184
|
});
|
185
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
186
|
-
return _this.onBeforeRemoveCellClassNames(...arguments);
|
187
|
-
});
|
188
185
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
189
186
|
if (source === 'MergeCells') {
|
190
187
|
return false;
|
@@ -491,7 +488,6 @@ export class MergeCells extends BasePlugin {
|
|
491
488
|
rangeEach(0, currentCollection.rowspan - 1, i => {
|
492
489
|
rangeEach(0, currentCollection.colspan - 1, j => {
|
493
490
|
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
|
494
|
-
this.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'copyable');
|
495
491
|
});
|
496
492
|
});
|
497
493
|
this.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
|
@@ -569,8 +565,11 @@ export class MergeCells extends BasePlugin {
|
|
569
565
|
gridContext.addShortcut({
|
570
566
|
keys: [['Control', 'm']],
|
571
567
|
callback: () => {
|
572
|
-
this.
|
573
|
-
|
568
|
+
const range = this.hot.getSelectedRangeLast();
|
569
|
+
if (range && !range.isSingleHeader()) {
|
570
|
+
this.toggleMerge(range);
|
571
|
+
this.hot.render();
|
572
|
+
}
|
574
573
|
},
|
575
574
|
runOnlyIf: event => !event.altKey,
|
576
575
|
// right ALT in some systems triggers ALT+CTRL
|
@@ -1193,15 +1192,4 @@ export class MergeCells extends BasePlugin {
|
|
1193
1192
|
}
|
1194
1193
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1195
1194
|
}
|
1196
|
-
|
1197
|
-
/**
|
1198
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1199
|
-
*
|
1200
|
-
* @private
|
1201
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1202
|
-
* all the cells in the table.
|
1203
|
-
*/
|
1204
|
-
onBeforeRemoveCellClassNames() {
|
1205
|
-
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1206
|
-
}
|
1207
1195
|
}
|
@@ -12,8 +12,8 @@ const PLUGIN_KEY = 'multiColumnSorting';
|
|
12
12
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
13
13
|
const PLUGIN_PRIORITY = 170;
|
14
14
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
15
|
-
const APPEND_COLUMN_CONFIG_STRATEGY = 'append';
|
16
15
|
const CONFLICTED_PLUGIN_KEY = 'columnSorting';
|
16
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
17
17
|
(0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
|
18
18
|
|
19
19
|
/**
|
@@ -113,6 +113,41 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
|
|
113
113
|
super.disablePlugin();
|
114
114
|
}
|
115
115
|
|
116
|
+
/**
|
117
|
+
* Register shortcuts responsible for toggling column sorting functionality.
|
118
|
+
*
|
119
|
+
* @private
|
120
|
+
*/
|
121
|
+
registerShortcuts() {
|
122
|
+
super.registerShortcuts();
|
123
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
124
|
+
keys: [['Control/Meta', 'Enter']],
|
125
|
+
callback: () => {
|
126
|
+
const {
|
127
|
+
highlight
|
128
|
+
} = this.hot.getSelectedRangeLast();
|
129
|
+
if (highlight.row === -1 && highlight.col >= 0) {
|
130
|
+
this.sort(this.getNextSortConfig(highlight.col, _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY));
|
131
|
+
}
|
132
|
+
},
|
133
|
+
runOnlyIf: () => {
|
134
|
+
var _this$hot$getSelected;
|
135
|
+
return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
|
136
|
+
},
|
137
|
+
group: SHORTCUTS_GROUP
|
138
|
+
});
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Unregister shortcuts responsible for toggling column sorting functionality.
|
143
|
+
*
|
144
|
+
* @private
|
145
|
+
*/
|
146
|
+
unregisterShortcuts() {
|
147
|
+
super.unregisterShortcuts();
|
148
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
149
|
+
}
|
150
|
+
|
116
151
|
/**
|
117
152
|
* Sorts the table by chosen columns and orders.
|
118
153
|
*
|
@@ -262,7 +297,7 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
|
|
262
297
|
if (this.hot.getShortcutManager().isCtrlPressed()) {
|
263
298
|
this.hot.deselectCell();
|
264
299
|
this.hot.selectColumns(coords.col);
|
265
|
-
this.sort(this.getNextSortConfig(coords.col, APPEND_COLUMN_CONFIG_STRATEGY));
|
300
|
+
this.sort(this.getNextSortConfig(coords.col, _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY));
|
266
301
|
} else {
|
267
302
|
this.sort(this.getColumnNextConfig(coords.col));
|
268
303
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ColumnSorting } from "../columnSorting/index.mjs";
|
1
|
+
import { APPEND_COLUMN_CONFIG_STRATEGY, ColumnSorting } from "../columnSorting/index.mjs";
|
2
2
|
import { registerRootComparator } from "../columnSorting/sortService/index.mjs";
|
3
3
|
import { wasHeaderClickedProperly } from "../columnSorting/utils.mjs";
|
4
4
|
import { addClass, removeClass } from "../../helpers/dom/element.mjs";
|
@@ -7,8 +7,8 @@ import { warnAboutPluginsConflict } from "./utils.mjs";
|
|
7
7
|
import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
|
8
8
|
export const PLUGIN_KEY = 'multiColumnSorting';
|
9
9
|
export const PLUGIN_PRIORITY = 170;
|
10
|
-
const APPEND_COLUMN_CONFIG_STRATEGY = 'append';
|
11
10
|
const CONFLICTED_PLUGIN_KEY = 'columnSorting';
|
11
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
12
12
|
registerRootComparator(PLUGIN_KEY, rootComparator);
|
13
13
|
|
14
14
|
/**
|
@@ -108,6 +108,41 @@ export class MultiColumnSorting extends ColumnSorting {
|
|
108
108
|
super.disablePlugin();
|
109
109
|
}
|
110
110
|
|
111
|
+
/**
|
112
|
+
* Register shortcuts responsible for toggling column sorting functionality.
|
113
|
+
*
|
114
|
+
* @private
|
115
|
+
*/
|
116
|
+
registerShortcuts() {
|
117
|
+
super.registerShortcuts();
|
118
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
119
|
+
keys: [['Control/Meta', 'Enter']],
|
120
|
+
callback: () => {
|
121
|
+
const {
|
122
|
+
highlight
|
123
|
+
} = this.hot.getSelectedRangeLast();
|
124
|
+
if (highlight.row === -1 && highlight.col >= 0) {
|
125
|
+
this.sort(this.getNextSortConfig(highlight.col, APPEND_COLUMN_CONFIG_STRATEGY));
|
126
|
+
}
|
127
|
+
},
|
128
|
+
runOnlyIf: () => {
|
129
|
+
var _this$hot$getSelected;
|
130
|
+
return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
|
131
|
+
},
|
132
|
+
group: SHORTCUTS_GROUP
|
133
|
+
});
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Unregister shortcuts responsible for toggling column sorting functionality.
|
138
|
+
*
|
139
|
+
* @private
|
140
|
+
*/
|
141
|
+
unregisterShortcuts() {
|
142
|
+
super.unregisterShortcuts();
|
143
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
144
|
+
}
|
145
|
+
|
111
146
|
/**
|
112
147
|
* Sorts the table by chosen columns and orders.
|
113
148
|
*
|