handsontable 14.0.0-next-07c0a60-20231107 → 14.0.0-next-7ee54cb-20231108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/cell/coords.js +7 -5
- package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +31 -26
- package/core.mjs +31 -26
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7337 -6394
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +154 -154
- package/dist/handsontable.js +7336 -6393
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +98 -102
- package/plugins/autofill/autofill.mjs +97 -101
- package/plugins/base/base.js +61 -28
- package/plugins/base/base.mjs +60 -28
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +107 -99
- package/plugins/columnSorting/columnSorting.mjs +106 -98
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +96 -102
- package/plugins/contextMenu/contextMenu.mjs +95 -101
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +57 -50
- package/plugins/customBorders/customBorders.mjs +56 -49
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +136 -131
- package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +328 -279
- package/plugins/nestedRows/nestedRows.mjs +327 -278
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/highlight/highlight.js +1 -4
- package/selection/highlight/highlight.mjs +1 -4
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +28 -10
- package/selection/selection.mjs +28 -10
- package/selection/utils.js +24 -14
- package/selection/utils.mjs +25 -15
- package/shortcuts/manager.js +1 -1
- package/shortcuts/manager.mjs +1 -1
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,18 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
4
5
|
var _base = require("../base");
|
5
6
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
6
7
|
var _array = require("../../helpers/array");
|
7
8
|
var _object = require("../../helpers/object");
|
8
9
|
var _commandExecutor = require("./commandExecutor");
|
9
|
-
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
10
10
|
var _itemsFactory = require("./itemsFactory");
|
11
11
|
var _menu = require("./menu");
|
12
12
|
var _utils = require("./utils");
|
13
13
|
var _element = require("../../helpers/dom/element");
|
14
14
|
var _predefinedItems = require("./predefinedItems");
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
17
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
21
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
16
22
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'contextMenu';
|
17
23
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 70;
|
18
24
|
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
@@ -46,61 +52,71 @@ _pluginHooks.default.getSingleton().register('afterContextMenuExecute');
|
|
46
52
|
*
|
47
53
|
* @plugin ContextMenu
|
48
54
|
*/
|
55
|
+
var _onAfterOnCellContextMenu = /*#__PURE__*/new WeakSet();
|
56
|
+
var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
57
|
+
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
58
|
+
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
49
59
|
class ContextMenu extends _base.BasePlugin {
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
static get PLUGIN_PRIORITY() {
|
54
|
-
return PLUGIN_PRIORITY;
|
55
|
-
}
|
56
|
-
static get PLUGIN_DEPS() {
|
57
|
-
return ['plugin:AutoColumnSize'];
|
58
|
-
}
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Context menu default items order when `contextMenu` options is set as `true`.
|
62
|
-
*
|
63
|
-
* @returns {string[]}
|
64
|
-
*/
|
65
|
-
static get DEFAULT_ITEMS() {
|
66
|
-
return [_predefinedItems.ROW_ABOVE, _predefinedItems.ROW_BELOW, _predefinedItems.SEPARATOR, _predefinedItems.COLUMN_LEFT, _predefinedItems.COLUMN_RIGHT, _predefinedItems.SEPARATOR, _predefinedItems.REMOVE_ROW, _predefinedItems.REMOVE_COLUMN, _predefinedItems.SEPARATOR, _predefinedItems.UNDO, _predefinedItems.REDO, _predefinedItems.SEPARATOR, _predefinedItems.READ_ONLY, _predefinedItems.SEPARATOR, _predefinedItems.ALIGNMENT];
|
67
|
-
}
|
68
|
-
|
69
|
-
/**
|
70
|
-
* @param {Core} hotInstance Handsontable instance.
|
71
|
-
*/
|
72
|
-
constructor(hotInstance) {
|
73
|
-
super(hotInstance);
|
60
|
+
constructor() {
|
61
|
+
super(...arguments);
|
74
62
|
/**
|
75
|
-
*
|
63
|
+
* On menu after close listener.
|
64
|
+
*/
|
65
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterClose);
|
66
|
+
/**
|
67
|
+
* On menu after open listener.
|
68
|
+
*/
|
69
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterOpen);
|
70
|
+
/**
|
71
|
+
* On menu before open listener.
|
72
|
+
*/
|
73
|
+
_classPrivateMethodInitSpec(this, _onMenuBeforeOpen);
|
74
|
+
/**
|
75
|
+
* On contextmenu listener.
|
76
76
|
*
|
77
|
-
* @
|
78
|
-
* @type {EventManager}
|
77
|
+
* @param {Event} event The mouse event object.
|
79
78
|
*/
|
80
|
-
this
|
79
|
+
_classPrivateMethodInitSpec(this, _onAfterOnCellContextMenu);
|
81
80
|
/**
|
82
81
|
* Instance of {@link CommandExecutor}.
|
83
82
|
*
|
84
83
|
* @private
|
85
84
|
* @type {CommandExecutor}
|
86
85
|
*/
|
87
|
-
this
|
86
|
+
_defineProperty(this, "commandExecutor", new _commandExecutor.CommandExecutor(this.hot));
|
88
87
|
/**
|
89
88
|
* Instance of {@link ItemsFactory}.
|
90
89
|
*
|
91
90
|
* @private
|
92
91
|
* @type {ItemsFactory}
|
93
92
|
*/
|
94
|
-
this
|
93
|
+
_defineProperty(this, "itemsFactory", null);
|
95
94
|
/**
|
96
95
|
* Instance of {@link Menu}.
|
97
96
|
*
|
98
97
|
* @private
|
99
98
|
* @type {Menu}
|
100
99
|
*/
|
101
|
-
this
|
100
|
+
_defineProperty(this, "menu", null);
|
101
|
+
}
|
102
|
+
static get PLUGIN_KEY() {
|
103
|
+
return PLUGIN_KEY;
|
104
|
+
}
|
105
|
+
static get PLUGIN_PRIORITY() {
|
106
|
+
return PLUGIN_PRIORITY;
|
107
|
+
}
|
108
|
+
static get PLUGIN_DEPS() {
|
109
|
+
return ['plugin:AutoColumnSize'];
|
102
110
|
}
|
103
111
|
|
112
|
+
/**
|
113
|
+
* Context menu default items order when `contextMenu` options is set as `true`.
|
114
|
+
*
|
115
|
+
* @returns {string[]}
|
116
|
+
*/
|
117
|
+
static get DEFAULT_ITEMS() {
|
118
|
+
return [_predefinedItems.ROW_ABOVE, _predefinedItems.ROW_BELOW, _predefinedItems.SEPARATOR, _predefinedItems.COLUMN_LEFT, _predefinedItems.COLUMN_RIGHT, _predefinedItems.SEPARATOR, _predefinedItems.REMOVE_ROW, _predefinedItems.REMOVE_COLUMN, _predefinedItems.SEPARATOR, _predefinedItems.UNDO, _predefinedItems.REDO, _predefinedItems.SEPARATOR, _predefinedItems.READ_ONLY, _predefinedItems.SEPARATOR, _predefinedItems.ALIGNMENT];
|
119
|
+
}
|
104
120
|
/**
|
105
121
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
106
122
|
* hook and if it returns `true` then the {@link ContextMenu#enablePlugin} method is called.
|
@@ -128,16 +144,16 @@ class ContextMenu extends _base.BasePlugin {
|
|
128
144
|
keepInViewport: true,
|
129
145
|
container: settings.uiContainer || this.hot.rootDocument.body
|
130
146
|
});
|
131
|
-
this.menu.addLocalHook('beforeOpen', () => this.
|
132
|
-
this.menu.addLocalHook('afterOpen', () => this.
|
133
|
-
this.menu.addLocalHook('afterClose', () => this.
|
147
|
+
this.menu.addLocalHook('beforeOpen', () => _classPrivateMethodGet(this, _onMenuBeforeOpen, _onMenuBeforeOpen2).call(this));
|
148
|
+
this.menu.addLocalHook('afterOpen', () => _classPrivateMethodGet(this, _onMenuAfterOpen, _onMenuAfterOpen2).call(this));
|
149
|
+
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
134
150
|
this.menu.addLocalHook('executeCommand', function () {
|
135
151
|
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
136
152
|
params[_key] = arguments[_key];
|
137
153
|
}
|
138
154
|
return _this.executeCommand.call(_this, ...params);
|
139
155
|
});
|
140
|
-
this.addHook('afterOnCellContextMenu', event => this.
|
156
|
+
this.addHook('afterOnCellContextMenu', event => _classPrivateMethodGet(this, _onAfterOnCellContextMenu, _onAfterOnCellContextMenu2).call(this, event));
|
141
157
|
this.registerShortcuts();
|
142
158
|
super.enablePlugin();
|
143
159
|
}
|
@@ -190,7 +206,11 @@ class ContextMenu extends _base.BasePlugin {
|
|
190
206
|
above: -rect.height
|
191
207
|
});
|
192
208
|
},
|
193
|
-
runOnlyIf: () =>
|
209
|
+
runOnlyIf: () => {
|
210
|
+
var _this$hot$getSelected;
|
211
|
+
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
212
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && !this.menu.isOpened();
|
213
|
+
},
|
194
214
|
group: SHORTCUTS_GROUP
|
195
215
|
});
|
196
216
|
}
|
@@ -306,85 +326,59 @@ class ContextMenu extends _base.BasePlugin {
|
|
306
326
|
// Register all commands. Predefined and added by user or by plugins
|
307
327
|
(0, _array.arrayEach)(menuItems, command => this.commandExecutor.registerCommand(command.key, command));
|
308
328
|
}
|
309
|
-
|
310
329
|
/**
|
311
|
-
*
|
312
|
-
*
|
313
|
-
* @private
|
314
|
-
* @param {Event} event The mouse event object.
|
330
|
+
* Destroys the plugin instance.
|
315
331
|
*/
|
316
|
-
|
317
|
-
const settings = this.hot.getSettings();
|
318
|
-
const showRowHeaders = settings.rowHeaders;
|
319
|
-
const showColHeaders = settings.colHeaders;
|
320
|
-
|
321
|
-
/**
|
322
|
-
* @private
|
323
|
-
* @param {HTMLElement} element The element to validate.
|
324
|
-
* @returns {boolean}
|
325
|
-
*/
|
326
|
-
function isValidElement(element) {
|
327
|
-
return element.nodeName === 'TD' || element.parentNode.nodeName === 'TD';
|
328
|
-
}
|
329
|
-
const element = event.target;
|
332
|
+
destroy() {
|
330
333
|
this.close();
|
331
|
-
if (
|
332
|
-
|
333
|
-
}
|
334
|
-
event.preventDefault();
|
335
|
-
event.stopPropagation();
|
336
|
-
if (!(showRowHeaders || showColHeaders)) {
|
337
|
-
if (!isValidElement(element) && !((0, _element.hasClass)(element, 'current') && (0, _element.hasClass)(element, 'wtBorder'))) {
|
338
|
-
return;
|
339
|
-
}
|
334
|
+
if (this.menu) {
|
335
|
+
this.menu.destroy();
|
340
336
|
}
|
341
|
-
|
342
|
-
this.open({
|
343
|
-
top: event.clientY + offset.top,
|
344
|
-
left: event.clientX + offset.left
|
345
|
-
});
|
346
|
-
}
|
347
|
-
|
348
|
-
/**
|
349
|
-
* On menu before open listener.
|
350
|
-
*
|
351
|
-
* @private
|
352
|
-
*/
|
353
|
-
onMenuBeforeOpen() {
|
354
|
-
this.hot.runHooks('beforeContextMenuShow', this);
|
337
|
+
super.destroy();
|
355
338
|
}
|
339
|
+
}
|
340
|
+
exports.ContextMenu = ContextMenu;
|
341
|
+
function _onAfterOnCellContextMenu2(event) {
|
342
|
+
const settings = this.hot.getSettings();
|
343
|
+
const showRowHeaders = settings.rowHeaders;
|
344
|
+
const showColHeaders = settings.colHeaders;
|
356
345
|
|
357
346
|
/**
|
358
|
-
* On menu after open listener.
|
359
|
-
*
|
360
347
|
* @private
|
348
|
+
* @param {HTMLElement} element The element to validate.
|
349
|
+
* @returns {boolean}
|
361
350
|
*/
|
362
|
-
|
363
|
-
|
351
|
+
function isValidElement(element) {
|
352
|
+
return element.nodeName === 'TD' || element.parentNode.nodeName === 'TD';
|
364
353
|
}
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
* @private
|
370
|
-
*/
|
371
|
-
onMenuAfterClose() {
|
372
|
-
this.hot.listen();
|
373
|
-
this.hot.runHooks('afterContextMenuHide', this);
|
354
|
+
const element = event.target;
|
355
|
+
this.close();
|
356
|
+
if ((0, _element.hasClass)(element, 'handsontableInput')) {
|
357
|
+
return;
|
374
358
|
}
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
this.close();
|
381
|
-
if (this.menu) {
|
382
|
-
this.menu.destroy();
|
359
|
+
event.preventDefault();
|
360
|
+
event.stopPropagation();
|
361
|
+
if (!(showRowHeaders || showColHeaders)) {
|
362
|
+
if (!isValidElement(element) && !((0, _element.hasClass)(element, 'current') && (0, _element.hasClass)(element, 'wtBorder'))) {
|
363
|
+
return;
|
383
364
|
}
|
384
|
-
super.destroy();
|
385
365
|
}
|
366
|
+
const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
|
367
|
+
this.open({
|
368
|
+
top: event.clientY + offset.top,
|
369
|
+
left: event.clientX + offset.left
|
370
|
+
});
|
371
|
+
}
|
372
|
+
function _onMenuBeforeOpen2() {
|
373
|
+
this.hot.runHooks('beforeContextMenuShow', this);
|
374
|
+
}
|
375
|
+
function _onMenuAfterOpen2() {
|
376
|
+
this.hot.runHooks('afterContextMenuShow', this);
|
377
|
+
}
|
378
|
+
function _onMenuAfterClose2() {
|
379
|
+
this.hot.listen();
|
380
|
+
this.hot.runHooks('afterContextMenuHide', this);
|
386
381
|
}
|
387
|
-
exports.ContextMenu = ContextMenu;
|
388
382
|
ContextMenu.SEPARATOR = {
|
389
383
|
name: _predefinedItems.SEPARATOR
|
390
384
|
};
|
@@ -1,9 +1,15 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
7
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
1
8
|
import { BasePlugin } from "../base/index.mjs";
|
2
9
|
import Hooks from "../../pluginHooks.mjs";
|
3
10
|
import { arrayEach } from "../../helpers/array.mjs";
|
4
11
|
import { objectEach } from "../../helpers/object.mjs";
|
5
12
|
import { CommandExecutor } from "./commandExecutor.mjs";
|
6
|
-
import EventManager from "../../eventManager.mjs";
|
7
13
|
import { ItemsFactory } from "./itemsFactory.mjs";
|
8
14
|
import { Menu } from "./menu/index.mjs";
|
9
15
|
import { getDocumentOffsetByElement } from "./utils.mjs";
|
@@ -42,61 +48,71 @@ Hooks.getSingleton().register('afterContextMenuExecute');
|
|
42
48
|
*
|
43
49
|
* @plugin ContextMenu
|
44
50
|
*/
|
51
|
+
var _onAfterOnCellContextMenu = /*#__PURE__*/new WeakSet();
|
52
|
+
var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
53
|
+
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
54
|
+
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
45
55
|
export class ContextMenu extends BasePlugin {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
static get PLUGIN_DEPS() {
|
53
|
-
return ['plugin:AutoColumnSize'];
|
54
|
-
}
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Context menu default items order when `contextMenu` options is set as `true`.
|
58
|
-
*
|
59
|
-
* @returns {string[]}
|
60
|
-
*/
|
61
|
-
static get DEFAULT_ITEMS() {
|
62
|
-
return [ROW_ABOVE, ROW_BELOW, SEPARATOR, COLUMN_LEFT, COLUMN_RIGHT, SEPARATOR, REMOVE_ROW, REMOVE_COLUMN, SEPARATOR, UNDO, REDO, SEPARATOR, READ_ONLY, SEPARATOR, ALIGNMENT];
|
63
|
-
}
|
64
|
-
|
65
|
-
/**
|
66
|
-
* @param {Core} hotInstance Handsontable instance.
|
67
|
-
*/
|
68
|
-
constructor(hotInstance) {
|
69
|
-
super(hotInstance);
|
56
|
+
constructor() {
|
57
|
+
super(...arguments);
|
58
|
+
/**
|
59
|
+
* On menu after close listener.
|
60
|
+
*/
|
61
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterClose);
|
70
62
|
/**
|
71
|
-
*
|
63
|
+
* On menu after open listener.
|
64
|
+
*/
|
65
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterOpen);
|
66
|
+
/**
|
67
|
+
* On menu before open listener.
|
68
|
+
*/
|
69
|
+
_classPrivateMethodInitSpec(this, _onMenuBeforeOpen);
|
70
|
+
/**
|
71
|
+
* On contextmenu listener.
|
72
72
|
*
|
73
|
-
* @
|
74
|
-
* @type {EventManager}
|
73
|
+
* @param {Event} event The mouse event object.
|
75
74
|
*/
|
76
|
-
this
|
75
|
+
_classPrivateMethodInitSpec(this, _onAfterOnCellContextMenu);
|
77
76
|
/**
|
78
77
|
* Instance of {@link CommandExecutor}.
|
79
78
|
*
|
80
79
|
* @private
|
81
80
|
* @type {CommandExecutor}
|
82
81
|
*/
|
83
|
-
this
|
82
|
+
_defineProperty(this, "commandExecutor", new CommandExecutor(this.hot));
|
84
83
|
/**
|
85
84
|
* Instance of {@link ItemsFactory}.
|
86
85
|
*
|
87
86
|
* @private
|
88
87
|
* @type {ItemsFactory}
|
89
88
|
*/
|
90
|
-
this
|
89
|
+
_defineProperty(this, "itemsFactory", null);
|
91
90
|
/**
|
92
91
|
* Instance of {@link Menu}.
|
93
92
|
*
|
94
93
|
* @private
|
95
94
|
* @type {Menu}
|
96
95
|
*/
|
97
|
-
this
|
96
|
+
_defineProperty(this, "menu", null);
|
97
|
+
}
|
98
|
+
static get PLUGIN_KEY() {
|
99
|
+
return PLUGIN_KEY;
|
100
|
+
}
|
101
|
+
static get PLUGIN_PRIORITY() {
|
102
|
+
return PLUGIN_PRIORITY;
|
103
|
+
}
|
104
|
+
static get PLUGIN_DEPS() {
|
105
|
+
return ['plugin:AutoColumnSize'];
|
98
106
|
}
|
99
107
|
|
108
|
+
/**
|
109
|
+
* Context menu default items order when `contextMenu` options is set as `true`.
|
110
|
+
*
|
111
|
+
* @returns {string[]}
|
112
|
+
*/
|
113
|
+
static get DEFAULT_ITEMS() {
|
114
|
+
return [ROW_ABOVE, ROW_BELOW, SEPARATOR, COLUMN_LEFT, COLUMN_RIGHT, SEPARATOR, REMOVE_ROW, REMOVE_COLUMN, SEPARATOR, UNDO, REDO, SEPARATOR, READ_ONLY, SEPARATOR, ALIGNMENT];
|
115
|
+
}
|
100
116
|
/**
|
101
117
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
102
118
|
* hook and if it returns `true` then the {@link ContextMenu#enablePlugin} method is called.
|
@@ -124,16 +140,16 @@ export class ContextMenu extends BasePlugin {
|
|
124
140
|
keepInViewport: true,
|
125
141
|
container: settings.uiContainer || this.hot.rootDocument.body
|
126
142
|
});
|
127
|
-
this.menu.addLocalHook('beforeOpen', () => this.
|
128
|
-
this.menu.addLocalHook('afterOpen', () => this.
|
129
|
-
this.menu.addLocalHook('afterClose', () => this.
|
143
|
+
this.menu.addLocalHook('beforeOpen', () => _classPrivateMethodGet(this, _onMenuBeforeOpen, _onMenuBeforeOpen2).call(this));
|
144
|
+
this.menu.addLocalHook('afterOpen', () => _classPrivateMethodGet(this, _onMenuAfterOpen, _onMenuAfterOpen2).call(this));
|
145
|
+
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
130
146
|
this.menu.addLocalHook('executeCommand', function () {
|
131
147
|
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
132
148
|
params[_key] = arguments[_key];
|
133
149
|
}
|
134
150
|
return _this.executeCommand.call(_this, ...params);
|
135
151
|
});
|
136
|
-
this.addHook('afterOnCellContextMenu', event => this.
|
152
|
+
this.addHook('afterOnCellContextMenu', event => _classPrivateMethodGet(this, _onAfterOnCellContextMenu, _onAfterOnCellContextMenu2).call(this, event));
|
137
153
|
this.registerShortcuts();
|
138
154
|
super.enablePlugin();
|
139
155
|
}
|
@@ -186,7 +202,11 @@ export class ContextMenu extends BasePlugin {
|
|
186
202
|
above: -rect.height
|
187
203
|
});
|
188
204
|
},
|
189
|
-
runOnlyIf: () =>
|
205
|
+
runOnlyIf: () => {
|
206
|
+
var _this$hot$getSelected;
|
207
|
+
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
208
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && !this.menu.isOpened();
|
209
|
+
},
|
190
210
|
group: SHORTCUTS_GROUP
|
191
211
|
});
|
192
212
|
}
|
@@ -302,83 +322,57 @@ export class ContextMenu extends BasePlugin {
|
|
302
322
|
// Register all commands. Predefined and added by user or by plugins
|
303
323
|
arrayEach(menuItems, command => this.commandExecutor.registerCommand(command.key, command));
|
304
324
|
}
|
305
|
-
|
306
325
|
/**
|
307
|
-
*
|
308
|
-
*
|
309
|
-
* @private
|
310
|
-
* @param {Event} event The mouse event object.
|
326
|
+
* Destroys the plugin instance.
|
311
327
|
*/
|
312
|
-
|
313
|
-
const settings = this.hot.getSettings();
|
314
|
-
const showRowHeaders = settings.rowHeaders;
|
315
|
-
const showColHeaders = settings.colHeaders;
|
316
|
-
|
317
|
-
/**
|
318
|
-
* @private
|
319
|
-
* @param {HTMLElement} element The element to validate.
|
320
|
-
* @returns {boolean}
|
321
|
-
*/
|
322
|
-
function isValidElement(element) {
|
323
|
-
return element.nodeName === 'TD' || element.parentNode.nodeName === 'TD';
|
324
|
-
}
|
325
|
-
const element = event.target;
|
328
|
+
destroy() {
|
326
329
|
this.close();
|
327
|
-
if (
|
328
|
-
|
329
|
-
}
|
330
|
-
event.preventDefault();
|
331
|
-
event.stopPropagation();
|
332
|
-
if (!(showRowHeaders || showColHeaders)) {
|
333
|
-
if (!isValidElement(element) && !(hasClass(element, 'current') && hasClass(element, 'wtBorder'))) {
|
334
|
-
return;
|
335
|
-
}
|
330
|
+
if (this.menu) {
|
331
|
+
this.menu.destroy();
|
336
332
|
}
|
337
|
-
|
338
|
-
this.open({
|
339
|
-
top: event.clientY + offset.top,
|
340
|
-
left: event.clientX + offset.left
|
341
|
-
});
|
342
|
-
}
|
343
|
-
|
344
|
-
/**
|
345
|
-
* On menu before open listener.
|
346
|
-
*
|
347
|
-
* @private
|
348
|
-
*/
|
349
|
-
onMenuBeforeOpen() {
|
350
|
-
this.hot.runHooks('beforeContextMenuShow', this);
|
333
|
+
super.destroy();
|
351
334
|
}
|
335
|
+
}
|
336
|
+
function _onAfterOnCellContextMenu2(event) {
|
337
|
+
const settings = this.hot.getSettings();
|
338
|
+
const showRowHeaders = settings.rowHeaders;
|
339
|
+
const showColHeaders = settings.colHeaders;
|
352
340
|
|
353
341
|
/**
|
354
|
-
* On menu after open listener.
|
355
|
-
*
|
356
342
|
* @private
|
343
|
+
* @param {HTMLElement} element The element to validate.
|
344
|
+
* @returns {boolean}
|
357
345
|
*/
|
358
|
-
|
359
|
-
|
346
|
+
function isValidElement(element) {
|
347
|
+
return element.nodeName === 'TD' || element.parentNode.nodeName === 'TD';
|
360
348
|
}
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
* @private
|
366
|
-
*/
|
367
|
-
onMenuAfterClose() {
|
368
|
-
this.hot.listen();
|
369
|
-
this.hot.runHooks('afterContextMenuHide', this);
|
349
|
+
const element = event.target;
|
350
|
+
this.close();
|
351
|
+
if (hasClass(element, 'handsontableInput')) {
|
352
|
+
return;
|
370
353
|
}
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
this.close();
|
377
|
-
if (this.menu) {
|
378
|
-
this.menu.destroy();
|
354
|
+
event.preventDefault();
|
355
|
+
event.stopPropagation();
|
356
|
+
if (!(showRowHeaders || showColHeaders)) {
|
357
|
+
if (!isValidElement(element) && !(hasClass(element, 'current') && hasClass(element, 'wtBorder'))) {
|
358
|
+
return;
|
379
359
|
}
|
380
|
-
super.destroy();
|
381
360
|
}
|
361
|
+
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
362
|
+
this.open({
|
363
|
+
top: event.clientY + offset.top,
|
364
|
+
left: event.clientX + offset.left
|
365
|
+
});
|
366
|
+
}
|
367
|
+
function _onMenuBeforeOpen2() {
|
368
|
+
this.hot.runHooks('beforeContextMenuShow', this);
|
369
|
+
}
|
370
|
+
function _onMenuAfterOpen2() {
|
371
|
+
this.hot.runHooks('afterContextMenuShow', this);
|
372
|
+
}
|
373
|
+
function _onMenuAfterClose2() {
|
374
|
+
this.hot.listen();
|
375
|
+
this.hot.runHooks('afterContextMenuHide', this);
|
382
376
|
}
|
383
377
|
ContextMenu.SEPARATOR = {
|
384
378
|
name: SEPARATOR
|
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _object = require("../../helpers/object");
|
6
7
|
var _array = require("../../helpers/array");
|
7
8
|
var _predefinedItems = require("./predefinedItems");
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
11
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
8
12
|
/**
|
9
13
|
* Predefined items class factory for menu items.
|
10
14
|
*
|
@@ -14,8 +18,19 @@ var _predefinedItems = require("./predefinedItems");
|
|
14
18
|
class ItemsFactory {
|
15
19
|
constructor(hotInstance) {
|
16
20
|
let orderPattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
21
|
+
/**
|
22
|
+
* @type {Core}
|
23
|
+
*/
|
24
|
+
_defineProperty(this, "hot", void 0);
|
25
|
+
/**
|
26
|
+
* @type {object}
|
27
|
+
*/
|
28
|
+
_defineProperty(this, "predefinedItems", (0, _predefinedItems.predefinedItems)());
|
29
|
+
/**
|
30
|
+
* @type {Array}
|
31
|
+
*/
|
32
|
+
_defineProperty(this, "defaultOrderPattern", void 0);
|
17
33
|
this.hot = hotInstance;
|
18
|
-
this.predefinedItems = (0, _predefinedItems.predefinedItems)();
|
19
34
|
this.defaultOrderPattern = orderPattern;
|
20
35
|
}
|
21
36
|
|
@@ -35,7 +50,7 @@ class ItemsFactory {
|
|
35
50
|
|
36
51
|
// Menu item added as a property to array
|
37
52
|
} else if (isNaN(parseInt(key, 10))) {
|
38
|
-
value.key = value.key ===
|
53
|
+
value.key = value.key === undefined ? key : value.key;
|
39
54
|
items[key] = value;
|
40
55
|
menuItemKey = value.key;
|
41
56
|
} else {
|
@@ -91,7 +106,7 @@ function getItems() {
|
|
91
106
|
name: item
|
92
107
|
};
|
93
108
|
}
|
94
|
-
if (item.key ===
|
109
|
+
if (item.key === undefined) {
|
95
110
|
item.key = key;
|
96
111
|
}
|
97
112
|
result.push(item);
|
@@ -113,7 +128,7 @@ function getItems() {
|
|
113
128
|
if ((0, _object.isObject)(name)) {
|
114
129
|
(0, _object.extend)(item, name);
|
115
130
|
}
|
116
|
-
if (item.key ===
|
131
|
+
if (item.key === undefined) {
|
117
132
|
item.key = key;
|
118
133
|
}
|
119
134
|
result.push(item);
|
@@ -1,4 +1,8 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
2
6
|
import { objectEach, isObject, extend } from "../../helpers/object.mjs";
|
3
7
|
import { arrayEach } from "../../helpers/array.mjs";
|
4
8
|
import { SEPARATOR, ITEMS, predefinedItems } from "./predefinedItems/index.mjs";
|
@@ -11,8 +15,19 @@ import { SEPARATOR, ITEMS, predefinedItems } from "./predefinedItems/index.mjs";
|
|
11
15
|
export class ItemsFactory {
|
12
16
|
constructor(hotInstance) {
|
13
17
|
let orderPattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
18
|
+
/**
|
19
|
+
* @type {Core}
|
20
|
+
*/
|
21
|
+
_defineProperty(this, "hot", void 0);
|
22
|
+
/**
|
23
|
+
* @type {object}
|
24
|
+
*/
|
25
|
+
_defineProperty(this, "predefinedItems", predefinedItems());
|
26
|
+
/**
|
27
|
+
* @type {Array}
|
28
|
+
*/
|
29
|
+
_defineProperty(this, "defaultOrderPattern", void 0);
|
14
30
|
this.hot = hotInstance;
|
15
|
-
this.predefinedItems = predefinedItems();
|
16
31
|
this.defaultOrderPattern = orderPattern;
|
17
32
|
}
|
18
33
|
|
@@ -32,7 +47,7 @@ export class ItemsFactory {
|
|
32
47
|
|
33
48
|
// Menu item added as a property to array
|
34
49
|
} else if (isNaN(parseInt(key, 10))) {
|
35
|
-
value.key = value.key ===
|
50
|
+
value.key = value.key === undefined ? key : value.key;
|
36
51
|
items[key] = value;
|
37
52
|
menuItemKey = value.key;
|
38
53
|
} else {
|
@@ -87,7 +102,7 @@ function getItems() {
|
|
87
102
|
name: item
|
88
103
|
};
|
89
104
|
}
|
90
|
-
if (item.key ===
|
105
|
+
if (item.key === undefined) {
|
91
106
|
item.key = key;
|
92
107
|
}
|
93
108
|
result.push(item);
|
@@ -109,7 +124,7 @@ function getItems() {
|
|
109
124
|
if (isObject(name)) {
|
110
125
|
extend(item, name);
|
111
126
|
}
|
112
|
-
if (item.key ===
|
127
|
+
if (item.key === undefined) {
|
113
128
|
item.key = key;
|
114
129
|
}
|
115
130
|
result.push(item);
|