handsontable 0.0.0-next-d1c8e0e-20230621 → 0.0.0-next-c765185-20230622
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/{selection/border/border.js → border.js} +12 -7
- package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
- package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
- package/3rdparty/walkontable/src/cell/coords.js +12 -61
- package/3rdparty/walkontable/src/cell/coords.mjs +12 -61
- package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
- package/3rdparty/walkontable/src/cell/range.js +7 -44
- package/3rdparty/walkontable/src/cell/range.mjs +7 -44
- package/3rdparty/walkontable/src/core/_base.js +3 -9
- package/3rdparty/walkontable/src/core/_base.mjs +3 -9
- 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 +2 -3
- package/3rdparty/walkontable/src/core/core.mjs +2 -3
- 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 +2 -10
- 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 +4 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
- package/3rdparty/walkontable/src/overlay/top.js +4 -2
- package/3rdparty/walkontable/src/overlay/top.mjs +4 -2
- package/3rdparty/walkontable/src/selection.js +355 -0
- package/3rdparty/walkontable/src/selection.mjs +349 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
- package/3rdparty/walkontable/src/table.js +79 -7
- package/3rdparty/walkontable/src/table.mjs +80 -8
- package/CHANGELOG.md +31 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +3 -5
- package/core.js +309 -127
- package/core.mjs +309 -127
- package/dataMap/metaManager/metaSchema.js +0 -19
- package/dataMap/metaManager/metaSchema.mjs +0 -19
- package/dist/handsontable.css +3 -8
- package/dist/handsontable.full.css +3 -8
- package/dist/handsontable.full.js +10826 -13821
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +115 -115
- package/dist/handsontable.js +13565 -16560
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +94 -21
- package/editorManager.mjs +98 -26
- package/editors/textEditor/textEditor.js +11 -3
- package/editors/textEditor/textEditor.mjs +12 -4
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/number.d.ts +0 -1
- package/helpers/number.js +0 -18
- package/helpers/number.mjs +0 -17
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -5
- package/pluginHooks.js +1 -89
- package/pluginHooks.mjs +1 -89
- package/plugins/collapsibleColumns/collapsibleColumns.js +24 -81
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -81
- package/plugins/columnSorting/columnSorting.js +8 -50
- package/plugins/columnSorting/columnSorting.mjs +9 -49
- package/plugins/columnSorting/index.js +2 -4
- package/plugins/columnSorting/index.mjs +1 -1
- package/plugins/comments/comments.js +4 -11
- package/plugins/comments/comments.mjs +4 -11
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +29 -80
- package/plugins/contextMenu/contextMenu.mjs +30 -81
- package/plugins/contextMenu/predefinedItems/alignment.js +0 -7
- package/plugins/contextMenu/predefinedItems/alignment.mjs +0 -7
- package/plugins/contextMenu/predefinedItems/clearColumn.js +3 -5
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -5
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/columnRight.js +3 -5
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/readOnly.js +0 -7
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -7
- package/plugins/contextMenu/predefinedItems/removeColumn.js +5 -7
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/removeRow.js +5 -7
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -5
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -5
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -5
- package/plugins/contextMenu/utils.js +16 -25
- package/plugins/contextMenu/utils.mjs +15 -24
- package/plugins/copyPaste/contextMenuItem/copy.js +0 -7
- package/plugins/copyPaste/contextMenuItem/copy.mjs +0 -7
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/cut.js +0 -7
- package/plugins/copyPaste/contextMenuItem/cut.mjs +0 -7
- package/plugins/copyPaste/copyPaste.js +1 -5
- package/plugins/copyPaste/copyPaste.mjs +1 -5
- package/plugins/customBorders/customBorders.js +53 -25
- package/plugins/customBorders/customBorders.mjs +54 -26
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +30 -94
- package/plugins/dropdownMenu/dropdownMenu.mjs +30 -94
- package/plugins/filters/filters.js +42 -62
- package/plugins/filters/filters.mjs +41 -61
- package/plugins/mergeCells/mergeCells.js +18 -5
- package/plugins/mergeCells/mergeCells.mjs +18 -5
- package/plugins/multiColumnSorting/multiColumnSorting.js +3 -42
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +3 -42
- package/plugins/nestedHeaders/nestedHeaders.js +10 -132
- package/plugins/nestedHeaders/nestedHeaders.mjs +10 -132
- package/plugins/nestedHeaders/stateManager/index.js +0 -37
- package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
- package/plugins/nestedRows/nestedRows.js +7 -52
- package/plugins/nestedRows/nestedRows.mjs +7 -52
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +89 -312
- package/selection/highlight/highlight.mjs +85 -302
- package/selection/highlight/types/activeHeader.js +9 -10
- package/selection/highlight/types/activeHeader.mjs +8 -10
- package/selection/highlight/types/area.js +27 -12
- package/selection/highlight/types/area.mjs +30 -16
- package/selection/highlight/types/{focus.js → cell.js} +8 -5
- package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
- package/selection/highlight/types/customSelection.js +10 -7
- package/selection/highlight/types/customSelection.mjs +9 -7
- package/selection/highlight/types/fill.js +8 -5
- package/selection/highlight/types/fill.mjs +7 -5
- package/selection/highlight/types/header.js +20 -10
- package/selection/highlight/types/header.mjs +19 -10
- package/selection/highlight/types/{row.js → index.js} +31 -27
- package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
- package/selection/highlight/visualSelection.js +27 -31
- package/selection/highlight/visualSelection.mjs +27 -31
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- 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 +181 -315
- package/selection/selection.mjs +180 -310
- package/selection/transformation.js +96 -233
- package/selection/transformation.mjs +93 -230
- package/selection/utils.js +36 -12
- package/selection/utils.mjs +36 -13
- package/settings.d.ts +0 -1
- package/shortcuts/manager.js +0 -2
- package/shortcuts/manager.mjs +0 -2
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +5 -21
- package/shortcuts/utils.mjs +4 -20
- package/tableView.js +9 -58
- package/tableView.mjs +9 -58
- package/translations/indexMapper.js +9 -8
- package/translations/indexMapper.mjs +9 -8
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
- package/3rdparty/walkontable/src/selection/constants.js +0 -63
- package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
- package/3rdparty/walkontable/src/selection/index.js +0 -30
- package/3rdparty/walkontable/src/selection/index.mjs +0 -5
- package/3rdparty/walkontable/src/selection/manager.js +0 -329
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -323
- package/3rdparty/walkontable/src/selection/scanner.js +0 -364
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -360
- package/3rdparty/walkontable/src/selection/selection.js +0 -133
- package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
- package/selection/highlight/types/areaLayered.js +0 -54
- package/selection/highlight/types/areaLayered.mjs +0 -49
- package/selection/highlight/types/column.js +0 -50
- package/selection/highlight/types/column.mjs +0 -45
- package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
- package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
- package/shortcutContexts/commands/editor/fastOpen.js +0 -16
- package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
- package/shortcutContexts/commands/editor/index.js +0 -16
- package/shortcutContexts/commands/editor/index.mjs +0 -12
- package/shortcutContexts/commands/editor/open.js +0 -29
- package/shortcutContexts/commands/editor/open.mjs +0 -24
- package/shortcutContexts/commands/emptySelectedCells.js +0 -12
- package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
- package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
- package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
- package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -14
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -40
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -35
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -40
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -35
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -14
- package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
- package/shortcutContexts/commands/index.js +0 -52
- package/shortcutContexts/commands/index.mjs +0 -48
- package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
- package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -29
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -24
- package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
- package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
- package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
- package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
- package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -36
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -31
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -36
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -31
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
- package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
- package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -29
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -24
- package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
- package/shortcutContexts/commands/selectAll.js +0 -11
- package/shortcutContexts/commands/selectAll.mjs +0 -6
- package/shortcutContexts/constants.js +0 -19
- package/shortcutContexts/constants.mjs +0 -12
- package/shortcutContexts/editor.js +0 -29
- package/shortcutContexts/editor.mjs +0 -25
- package/shortcutContexts/grid.js +0 -247
- package/shortcutContexts/grid.mjs +0 -243
- package/shortcutContexts/index.js +0 -29
- package/shortcutContexts/index.mjs +0 -15
@@ -19,7 +19,7 @@ require("core-js/modules/es.regexp.to-string.js");
|
|
19
19
|
require("core-js/modules/es.function.name.js");
|
20
20
|
require("core-js/modules/es.regexp.exec.js");
|
21
21
|
exports.__esModule = true;
|
22
|
-
exports.
|
22
|
+
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = void 0;
|
23
23
|
require("core-js/modules/es.array.sort.js");
|
24
24
|
require("core-js/modules/es.array.slice.js");
|
25
25
|
require("core-js/modules/es.object.to-string.js");
|
@@ -79,10 +79,7 @@ exports.PLUGIN_KEY = PLUGIN_KEY;
|
|
79
79
|
var PLUGIN_PRIORITY = 50;
|
80
80
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
81
81
|
var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
|
82
|
-
exports.APPEND_COLUMN_CONFIG_STRATEGY = APPEND_COLUMN_CONFIG_STRATEGY;
|
83
82
|
var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
|
84
|
-
exports.REPLACE_COLUMN_CONFIG_STRATEGY = REPLACE_COLUMN_CONFIG_STRATEGY;
|
85
|
-
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
86
83
|
(0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
|
87
84
|
_pluginHooks.default.getSingleton().register('beforeColumnSort');
|
88
85
|
_pluginHooks.default.getSingleton().register('afterColumnSort');
|
@@ -226,7 +223,6 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
226
223
|
if (this.hot.view) {
|
227
224
|
this.loadOrSortBySettings();
|
228
225
|
}
|
229
|
-
this.registerShortcuts();
|
230
226
|
_get(_getPrototypeOf(ColumnSorting.prototype), "enablePlugin", this).call(this);
|
231
227
|
}
|
232
228
|
|
@@ -260,47 +256,9 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
260
256
|
this.columnStatesManager.destroy();
|
261
257
|
this.columnMetaCache = null;
|
262
258
|
this.columnStatesManager = null;
|
263
|
-
this.unregisterShortcuts();
|
264
259
|
_get(_getPrototypeOf(ColumnSorting.prototype), "disablePlugin", this).call(this);
|
265
260
|
}
|
266
261
|
|
267
|
-
/**
|
268
|
-
* Register shortcuts responsible for toggling column sorting functionality.
|
269
|
-
*
|
270
|
-
* @private
|
271
|
-
*/
|
272
|
-
}, {
|
273
|
-
key: "registerShortcuts",
|
274
|
-
value: function registerShortcuts() {
|
275
|
-
var _this4 = this;
|
276
|
-
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
277
|
-
keys: [['Enter']],
|
278
|
-
callback: function callback() {
|
279
|
-
var _this4$hot$getSelecte = _this4.hot.getSelectedRangeLast(),
|
280
|
-
highlight = _this4$hot$getSelecte.highlight;
|
281
|
-
if (highlight.row === -1 && highlight.col >= 0) {
|
282
|
-
_this4.sort(_this4.getColumnNextConfig(highlight.col));
|
283
|
-
}
|
284
|
-
},
|
285
|
-
runOnlyIf: function runOnlyIf() {
|
286
|
-
var _this4$hot$getSelecte2;
|
287
|
-
return (_this4$hot$getSelecte2 = _this4.hot.getSelectedRangeLast()) === null || _this4$hot$getSelecte2 === void 0 ? void 0 : _this4$hot$getSelecte2.highlight.isHeader();
|
288
|
-
},
|
289
|
-
group: SHORTCUTS_GROUP
|
290
|
-
});
|
291
|
-
}
|
292
|
-
|
293
|
-
/**
|
294
|
-
* Unregister shortcuts responsible for toggling column sorting functionality.
|
295
|
-
*
|
296
|
-
* @private
|
297
|
-
*/
|
298
|
-
}, {
|
299
|
-
key: "unregisterShortcuts",
|
300
|
-
value: function unregisterShortcuts() {
|
301
|
-
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
302
|
-
}
|
303
|
-
|
304
262
|
// DIFF - MultiColumnSorting & ColumnSorting: changed function documentation.
|
305
263
|
/**
|
306
264
|
* Sorts the table by chosen columns and orders.
|
@@ -470,13 +428,13 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
470
428
|
}, {
|
471
429
|
key: "saveAllSortSettings",
|
472
430
|
value: function saveAllSortSettings(sortConfigs) {
|
473
|
-
var
|
431
|
+
var _this4 = this;
|
474
432
|
var allSortSettings = this.columnStatesManager.getAllColumnsProperties();
|
475
433
|
var translateColumnToPhysical = function translateColumnToPhysical(_ref2) {
|
476
434
|
var visualColumn = _ref2.column,
|
477
435
|
restOfProperties = _objectWithoutProperties(_ref2, _excluded);
|
478
436
|
return _objectSpread({
|
479
|
-
column:
|
437
|
+
column: _this4.hot.toPhysicalColumn(visualColumn)
|
480
438
|
}, restOfProperties);
|
481
439
|
};
|
482
440
|
allSortSettings.initialConfig = (0, _array.arrayMap)(sortConfigs, translateColumnToPhysical);
|
@@ -494,7 +452,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
494
452
|
}, {
|
495
453
|
key: "getAllSavedSortSettings",
|
496
454
|
value: function getAllSavedSortSettings() {
|
497
|
-
var
|
455
|
+
var _this5 = this;
|
498
456
|
var storedAllSortSettings = {};
|
499
457
|
this.hot.runHooks('persistentStateLoad', 'columnSorting', storedAllSortSettings);
|
500
458
|
var allSortSettings = storedAllSortSettings.value;
|
@@ -502,7 +460,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
502
460
|
var physicalColumn = _ref3.column,
|
503
461
|
restOfProperties = _objectWithoutProperties(_ref3, _excluded2);
|
504
462
|
return _objectSpread({
|
505
|
-
column:
|
463
|
+
column: _this5.hot.toVisualColumn(physicalColumn)
|
506
464
|
}, restOfProperties);
|
507
465
|
};
|
508
466
|
if ((0, _mixed.isDefined)(allSortSettings) && Array.isArray(allSortSettings.initialConfig)) {
|
@@ -667,7 +625,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
667
625
|
}, {
|
668
626
|
key: "sortByPresetSortStates",
|
669
627
|
value: function sortByPresetSortStates(sortConfigs) {
|
670
|
-
var
|
628
|
+
var _this6 = this;
|
671
629
|
if (sortConfigs.length === 0) {
|
672
630
|
this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues());
|
673
631
|
return;
|
@@ -676,7 +634,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
676
634
|
var numberOfRows = this.hot.countRows();
|
677
635
|
var getDataForSortedColumns = function getDataForSortedColumns(visualRowIndex) {
|
678
636
|
return (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
|
679
|
-
return
|
637
|
+
return _this6.hot.getDataAtCell(visualRowIndex, sortConfig.column);
|
680
638
|
});
|
681
639
|
};
|
682
640
|
for (var visualRowIndex = 0; visualRowIndex < this.getNumberOfRowsToSort(numberOfRows); visualRowIndex += 1) {
|
@@ -688,7 +646,7 @@ var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
688
646
|
(0, _sortService.sort)(indexesWithData, this.pluginKey, (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
|
689
647
|
return sortConfig.sortOrder;
|
690
648
|
}), (0, _array.arrayMap)(sortConfigs, function (sortConfig) {
|
691
|
-
return
|
649
|
+
return _this6.getFirstCellSettings(sortConfig.column);
|
692
650
|
}));
|
693
651
|
|
694
652
|
// Append spareRows
|
@@ -71,9 +71,8 @@ import { rootComparator } from "./rootComparator.mjs";
|
|
71
71
|
import { registerRootComparator, sort } from "./sortService/index.mjs";
|
72
72
|
export var PLUGIN_KEY = 'columnSorting';
|
73
73
|
export var PLUGIN_PRIORITY = 50;
|
74
|
-
|
75
|
-
|
76
|
-
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
74
|
+
var APPEND_COLUMN_CONFIG_STRATEGY = 'append';
|
75
|
+
var REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
|
77
76
|
registerRootComparator(PLUGIN_KEY, rootComparator);
|
78
77
|
Hooks.getSingleton().register('beforeColumnSort');
|
79
78
|
Hooks.getSingleton().register('afterColumnSort');
|
@@ -217,7 +216,6 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
217
216
|
if (this.hot.view) {
|
218
217
|
this.loadOrSortBySettings();
|
219
218
|
}
|
220
|
-
this.registerShortcuts();
|
221
219
|
_get(_getPrototypeOf(ColumnSorting.prototype), "enablePlugin", this).call(this);
|
222
220
|
}
|
223
221
|
|
@@ -251,47 +249,9 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
251
249
|
this.columnStatesManager.destroy();
|
252
250
|
this.columnMetaCache = null;
|
253
251
|
this.columnStatesManager = null;
|
254
|
-
this.unregisterShortcuts();
|
255
252
|
_get(_getPrototypeOf(ColumnSorting.prototype), "disablePlugin", this).call(this);
|
256
253
|
}
|
257
254
|
|
258
|
-
/**
|
259
|
-
* Register shortcuts responsible for toggling column sorting functionality.
|
260
|
-
*
|
261
|
-
* @private
|
262
|
-
*/
|
263
|
-
}, {
|
264
|
-
key: "registerShortcuts",
|
265
|
-
value: function registerShortcuts() {
|
266
|
-
var _this4 = this;
|
267
|
-
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
268
|
-
keys: [['Enter']],
|
269
|
-
callback: function callback() {
|
270
|
-
var _this4$hot$getSelecte = _this4.hot.getSelectedRangeLast(),
|
271
|
-
highlight = _this4$hot$getSelecte.highlight;
|
272
|
-
if (highlight.row === -1 && highlight.col >= 0) {
|
273
|
-
_this4.sort(_this4.getColumnNextConfig(highlight.col));
|
274
|
-
}
|
275
|
-
},
|
276
|
-
runOnlyIf: function runOnlyIf() {
|
277
|
-
var _this4$hot$getSelecte2;
|
278
|
-
return (_this4$hot$getSelecte2 = _this4.hot.getSelectedRangeLast()) === null || _this4$hot$getSelecte2 === void 0 ? void 0 : _this4$hot$getSelecte2.highlight.isHeader();
|
279
|
-
},
|
280
|
-
group: SHORTCUTS_GROUP
|
281
|
-
});
|
282
|
-
}
|
283
|
-
|
284
|
-
/**
|
285
|
-
* Unregister shortcuts responsible for toggling column sorting functionality.
|
286
|
-
*
|
287
|
-
* @private
|
288
|
-
*/
|
289
|
-
}, {
|
290
|
-
key: "unregisterShortcuts",
|
291
|
-
value: function unregisterShortcuts() {
|
292
|
-
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
293
|
-
}
|
294
|
-
|
295
255
|
// DIFF - MultiColumnSorting & ColumnSorting: changed function documentation.
|
296
256
|
/**
|
297
257
|
* Sorts the table by chosen columns and orders.
|
@@ -461,13 +421,13 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
461
421
|
}, {
|
462
422
|
key: "saveAllSortSettings",
|
463
423
|
value: function saveAllSortSettings(sortConfigs) {
|
464
|
-
var
|
424
|
+
var _this4 = this;
|
465
425
|
var allSortSettings = this.columnStatesManager.getAllColumnsProperties();
|
466
426
|
var translateColumnToPhysical = function translateColumnToPhysical(_ref2) {
|
467
427
|
var visualColumn = _ref2.column,
|
468
428
|
restOfProperties = _objectWithoutProperties(_ref2, _excluded);
|
469
429
|
return _objectSpread({
|
470
|
-
column:
|
430
|
+
column: _this4.hot.toPhysicalColumn(visualColumn)
|
471
431
|
}, restOfProperties);
|
472
432
|
};
|
473
433
|
allSortSettings.initialConfig = arrayMap(sortConfigs, translateColumnToPhysical);
|
@@ -485,7 +445,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
485
445
|
}, {
|
486
446
|
key: "getAllSavedSortSettings",
|
487
447
|
value: function getAllSavedSortSettings() {
|
488
|
-
var
|
448
|
+
var _this5 = this;
|
489
449
|
var storedAllSortSettings = {};
|
490
450
|
this.hot.runHooks('persistentStateLoad', 'columnSorting', storedAllSortSettings);
|
491
451
|
var allSortSettings = storedAllSortSettings.value;
|
@@ -493,7 +453,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
493
453
|
var physicalColumn = _ref3.column,
|
494
454
|
restOfProperties = _objectWithoutProperties(_ref3, _excluded2);
|
495
455
|
return _objectSpread({
|
496
|
-
column:
|
456
|
+
column: _this5.hot.toVisualColumn(physicalColumn)
|
497
457
|
}, restOfProperties);
|
498
458
|
};
|
499
459
|
if (isDefined(allSortSettings) && Array.isArray(allSortSettings.initialConfig)) {
|
@@ -658,7 +618,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
658
618
|
}, {
|
659
619
|
key: "sortByPresetSortStates",
|
660
620
|
value: function sortByPresetSortStates(sortConfigs) {
|
661
|
-
var
|
621
|
+
var _this6 = this;
|
662
622
|
if (sortConfigs.length === 0) {
|
663
623
|
this.hot.rowIndexMapper.setIndexesSequence(this.indexesSequenceCache.getValues());
|
664
624
|
return;
|
@@ -667,7 +627,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
667
627
|
var numberOfRows = this.hot.countRows();
|
668
628
|
var getDataForSortedColumns = function getDataForSortedColumns(visualRowIndex) {
|
669
629
|
return arrayMap(sortConfigs, function (sortConfig) {
|
670
|
-
return
|
630
|
+
return _this6.hot.getDataAtCell(visualRowIndex, sortConfig.column);
|
671
631
|
});
|
672
632
|
};
|
673
633
|
for (var visualRowIndex = 0; visualRowIndex < this.getNumberOfRowsToSort(numberOfRows); visualRowIndex += 1) {
|
@@ -679,7 +639,7 @@ export var ColumnSorting = /*#__PURE__*/function (_BasePlugin) {
|
|
679
639
|
sort(indexesWithData, this.pluginKey, arrayMap(sortConfigs, function (sortConfig) {
|
680
640
|
return sortConfig.sortOrder;
|
681
641
|
}), arrayMap(sortConfigs, function (sortConfig) {
|
682
|
-
return
|
642
|
+
return _this6.getFirstCellSettings(sortConfig.column);
|
683
643
|
}));
|
684
644
|
|
685
645
|
// Append spareRows
|
@@ -1,10 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports.
|
4
|
+
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.ColumnSorting = void 0;
|
5
5
|
var _columnSorting = require("./columnSorting");
|
6
6
|
exports.PLUGIN_KEY = _columnSorting.PLUGIN_KEY;
|
7
7
|
exports.PLUGIN_PRIORITY = _columnSorting.PLUGIN_PRIORITY;
|
8
|
-
exports.ColumnSorting = _columnSorting.ColumnSorting;
|
9
|
-
exports.APPEND_COLUMN_CONFIG_STRATEGY = _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY;
|
10
|
-
exports.REPLACE_COLUMN_CONFIG_STRATEGY = _columnSorting.REPLACE_COLUMN_CONFIG_STRATEGY;
|
8
|
+
exports.ColumnSorting = _columnSorting.ColumnSorting;
|
@@ -1 +1 @@
|
|
1
|
-
export { PLUGIN_KEY, PLUGIN_PRIORITY, ColumnSorting
|
1
|
+
export { PLUGIN_KEY, PLUGIN_PRIORITY, ColumnSorting } from "./columnSorting.mjs";
|
@@ -835,14 +835,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
835
835
|
key: "addToContextMenu",
|
836
836
|
value: function addToContextMenu(defaultOptions) {
|
837
837
|
var _this6 = this;
|
838
|
-
var
|
839
|
-
var range = _this6.hot.getSelectedRangeLast();
|
840
|
-
if (!range) {
|
841
|
-
return false;
|
842
|
-
}
|
843
|
-
if (range.isSingleHeader() || range.highlight.isHeader()) {
|
844
|
-
return false;
|
845
|
-
}
|
838
|
+
var isThereAnyCellRendered = function isThereAnyCellRendered() {
|
846
839
|
return _this6.hot.rowIndexMapper.getRenderableIndexesLength() > 0 && _this6.hot.columnIndexMapper.getRenderableIndexesLength() > 0;
|
847
840
|
};
|
848
841
|
defaultOptions.items.push({
|
@@ -859,7 +852,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
859
852
|
return _this6.onContextMenuAddComment();
|
860
853
|
},
|
861
854
|
disabled: function disabled() {
|
862
|
-
if (!
|
855
|
+
if (!isThereAnyCellRendered()) {
|
863
856
|
return true;
|
864
857
|
}
|
865
858
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
@@ -873,7 +866,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
873
866
|
return _this6.onContextMenuRemoveComment();
|
874
867
|
},
|
875
868
|
disabled: function disabled() {
|
876
|
-
if (!
|
869
|
+
if (!isThereAnyCellRendered()) {
|
877
870
|
return true;
|
878
871
|
}
|
879
872
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
@@ -901,7 +894,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
901
894
|
return _this6.onContextMenuMakeReadOnly();
|
902
895
|
},
|
903
896
|
disabled: function disabled() {
|
904
|
-
if (!
|
897
|
+
if (!isThereAnyCellRendered()) {
|
905
898
|
return true;
|
906
899
|
}
|
907
900
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
|
@@ -826,14 +826,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
826
826
|
key: "addToContextMenu",
|
827
827
|
value: function addToContextMenu(defaultOptions) {
|
828
828
|
var _this6 = this;
|
829
|
-
var
|
830
|
-
var range = _this6.hot.getSelectedRangeLast();
|
831
|
-
if (!range) {
|
832
|
-
return false;
|
833
|
-
}
|
834
|
-
if (range.isSingleHeader() || range.highlight.isHeader()) {
|
835
|
-
return false;
|
836
|
-
}
|
829
|
+
var isThereAnyCellRendered = function isThereAnyCellRendered() {
|
837
830
|
return _this6.hot.rowIndexMapper.getRenderableIndexesLength() > 0 && _this6.hot.columnIndexMapper.getRenderableIndexesLength() > 0;
|
838
831
|
};
|
839
832
|
defaultOptions.items.push({
|
@@ -850,7 +843,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
850
843
|
return _this6.onContextMenuAddComment();
|
851
844
|
},
|
852
845
|
disabled: function disabled() {
|
853
|
-
if (!
|
846
|
+
if (!isThereAnyCellRendered()) {
|
854
847
|
return true;
|
855
848
|
}
|
856
849
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
@@ -864,7 +857,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
864
857
|
return _this6.onContextMenuRemoveComment();
|
865
858
|
},
|
866
859
|
disabled: function disabled() {
|
867
|
-
if (!
|
860
|
+
if (!isThereAnyCellRendered()) {
|
868
861
|
return true;
|
869
862
|
}
|
870
863
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
@@ -892,7 +885,7 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
892
885
|
return _this6.onContextMenuMakeReadOnly();
|
893
886
|
},
|
894
887
|
disabled: function disabled() {
|
895
|
-
if (!
|
888
|
+
if (!isThereAnyCellRendered()) {
|
896
889
|
return true;
|
897
890
|
}
|
898
891
|
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
|
@@ -60,7 +60,7 @@ export class ContextMenu extends BasePlugin {
|
|
60
60
|
|
61
61
|
constructor(hotInstance: Core);
|
62
62
|
isEnabled(): boolean;
|
63
|
-
open(
|
63
|
+
open(event: Event): void;
|
64
64
|
close(): void;
|
65
65
|
executeCommand(commandName: string, ...params: any): void;
|
66
66
|
}
|
@@ -22,12 +22,10 @@ require("core-js/modules/es.object.get-prototype-of.js");
|
|
22
22
|
var _base = require("../base");
|
23
23
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
24
24
|
var _array = require("../../helpers/array");
|
25
|
-
var _object = require("../../helpers/object");
|
26
25
|
var _commandExecutor = _interopRequireDefault(require("./commandExecutor"));
|
27
26
|
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
28
27
|
var _itemsFactory = _interopRequireDefault(require("./itemsFactory"));
|
29
28
|
var _menu = _interopRequireDefault(require("./menu"));
|
30
|
-
var _utils = require("./utils");
|
31
29
|
var _element = require("../../helpers/dom/element");
|
32
30
|
var _predefinedItems = require("./predefinedItems");
|
33
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -49,7 +47,6 @@ var PLUGIN_KEY = 'contextMenu';
|
|
49
47
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
50
48
|
var PLUGIN_PRIORITY = 70;
|
51
49
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
52
|
-
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
53
50
|
_pluginHooks.default.getSingleton().register('afterContextMenuDefaultOptions');
|
54
51
|
_pluginHooks.default.getSingleton().register('beforeContextMenuShow');
|
55
52
|
_pluginHooks.default.getSingleton().register('afterContextMenuShow');
|
@@ -171,7 +168,6 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
171
168
|
this.addHook('afterOnCellContextMenu', function (event) {
|
172
169
|
return _this2.onAfterOnCellContextMenu(event);
|
173
170
|
});
|
174
|
-
this.registerShortcuts();
|
175
171
|
_get(_getPrototypeOf(ContextMenu.prototype), "enablePlugin", this).call(this);
|
176
172
|
}
|
177
173
|
|
@@ -186,7 +182,6 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
186
182
|
value: function updatePlugin() {
|
187
183
|
this.disablePlugin();
|
188
184
|
this.enablePlugin();
|
189
|
-
this.unregisterShortcuts();
|
190
185
|
_get(_getPrototypeOf(ContextMenu.prototype), "updatePlugin", this).call(this);
|
191
186
|
}
|
192
187
|
|
@@ -204,83 +199,39 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
204
199
|
_get(_getPrototypeOf(ContextMenu.prototype), "disablePlugin", this).call(this);
|
205
200
|
}
|
206
201
|
|
207
|
-
/**
|
208
|
-
* Register shortcuts responsible for toggling context menu.
|
209
|
-
*
|
210
|
-
* @private
|
211
|
-
*/
|
212
|
-
}, {
|
213
|
-
key: "registerShortcuts",
|
214
|
-
value: function registerShortcuts() {
|
215
|
-
var _this3 = this;
|
216
|
-
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
217
|
-
keys: [['Control/Meta', 'Shift', '\\'], ['Shift', 'F10']],
|
218
|
-
callback: function callback() {
|
219
|
-
var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
|
220
|
-
highlight = _this3$hot$getSelecte.highlight;
|
221
|
-
var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
|
222
|
-
var offset = (0, _utils.getDocumentOffsetByElement)(_this3.menu.container, _this3.hot.rootDocument);
|
223
|
-
_this3.open({
|
224
|
-
left: rect.left + offset.left,
|
225
|
-
top: rect.top + offset.top - 1 + rect.height
|
226
|
-
}, {
|
227
|
-
left: rect.width,
|
228
|
-
above: -rect.height
|
229
|
-
});
|
230
|
-
_this3.hot._registerTimeout(function () {
|
231
|
-
_this3.menu.selectFirstCell();
|
232
|
-
});
|
233
|
-
},
|
234
|
-
runOnlyIf: function runOnlyIf() {
|
235
|
-
return _this3.hot.getSelectedRangeLast() && !_this3.menu.isOpened();
|
236
|
-
},
|
237
|
-
group: SHORTCUTS_GROUP
|
238
|
-
});
|
239
|
-
}
|
240
|
-
|
241
|
-
/**
|
242
|
-
* Unregister shortcuts responsible for toggling context menu.
|
243
|
-
*
|
244
|
-
* @private
|
245
|
-
*/
|
246
|
-
}, {
|
247
|
-
key: "unregisterShortcuts",
|
248
|
-
value: function unregisterShortcuts() {
|
249
|
-
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
250
|
-
}
|
251
|
-
|
252
202
|
/**
|
253
203
|
* Opens menu and re-position it based on the passed coordinates.
|
254
204
|
*
|
255
|
-
* @param {
|
256
|
-
* which contains coordinates relative to the browsers viewport (without included scroll offsets).
|
257
|
-
* Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`
|
258
|
-
* coordinates.
|
259
|
-
* @param {{ above: number, below: number, left: number, right: number }} offset An object allows applying
|
260
|
-
* the offset to the menu position.
|
261
|
-
* @fires Hooks#beforeContextMenuShow
|
262
|
-
* @fires Hooks#afterContextMenuShow
|
205
|
+
* @param {Event} event The mouse event object.
|
263
206
|
*/
|
264
207
|
}, {
|
265
208
|
key: "open",
|
266
|
-
value: function open(
|
267
|
-
|
268
|
-
_this4 = this;
|
269
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
270
|
-
above: 0,
|
271
|
-
below: 0,
|
272
|
-
left: 0,
|
273
|
-
right: 0
|
274
|
-
};
|
275
|
-
if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {
|
209
|
+
value: function open(event) {
|
210
|
+
if (!this.menu) {
|
276
211
|
return;
|
277
212
|
}
|
278
213
|
this.prepareMenuItems();
|
279
214
|
this.menu.open();
|
280
|
-
(
|
281
|
-
|
215
|
+
if (!this.menu.isOpened()) {
|
216
|
+
return;
|
217
|
+
}
|
218
|
+
var offsetTop = 0;
|
219
|
+
var offsetLeft = 0;
|
220
|
+
if (this.hot.rootDocument !== this.menu.container.ownerDocument) {
|
221
|
+
var frameElement = this.hot.rootWindow.frameElement;
|
222
|
+
var _frameElement$getBoun = frameElement.getBoundingClientRect(),
|
223
|
+
top = _frameElement$getBoun.top,
|
224
|
+
left = _frameElement$getBoun.left;
|
225
|
+
offsetTop = top - (0, _element.getWindowScrollTop)(event.view);
|
226
|
+
offsetLeft = left - (0, _element.getWindowScrollLeft)(event.view);
|
227
|
+
} else {
|
228
|
+
offsetTop = -1 * (0, _element.getWindowScrollTop)(this.menu.hotMenu.rootWindow);
|
229
|
+
offsetLeft = -1 * (0, _element.getWindowScrollLeft)(this.menu.hotMenu.rootWindow);
|
230
|
+
}
|
231
|
+
this.menu.setPosition({
|
232
|
+
top: parseInt(event.pageY, 10) + offsetTop,
|
233
|
+
left: parseInt(event.pageX, 10) + offsetLeft
|
282
234
|
});
|
283
|
-
this.menu.setPosition(position);
|
284
235
|
}
|
285
236
|
|
286
237
|
/**
|
@@ -289,8 +240,10 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
289
240
|
}, {
|
290
241
|
key: "close",
|
291
242
|
value: function close() {
|
292
|
-
|
293
|
-
|
243
|
+
if (!this.menu) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
this.menu.close();
|
294
247
|
this.itemsFactory = null;
|
295
248
|
}
|
296
249
|
|
@@ -347,7 +300,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
347
300
|
}, {
|
348
301
|
key: "prepareMenuItems",
|
349
302
|
value: function prepareMenuItems() {
|
350
|
-
var
|
303
|
+
var _this3 = this;
|
351
304
|
this.itemsFactory = new _itemsFactory.default(this.hot, ContextMenu.DEFAULT_ITEMS);
|
352
305
|
var settings = this.hot.getSettings()[PLUGIN_KEY];
|
353
306
|
var predefinedItems = {
|
@@ -361,7 +314,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
361
314
|
|
362
315
|
// Register all commands. Predefined and added by user or by plugins
|
363
316
|
(0, _array.arrayEach)(menuItems, function (command) {
|
364
|
-
return
|
317
|
+
return _this3.commandExecutor.registerCommand(command.key, command);
|
365
318
|
});
|
366
319
|
}
|
367
320
|
|
@@ -398,11 +351,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
398
351
|
return;
|
399
352
|
}
|
400
353
|
}
|
401
|
-
|
402
|
-
this.open({
|
403
|
-
top: event.clientY + offset.top,
|
404
|
-
left: event.clientX + offset.left
|
405
|
-
});
|
354
|
+
this.open(event);
|
406
355
|
}
|
407
356
|
|
408
357
|
/**
|