handsontable 0.0.0-next-bfb0e3a-20240403 → 0.0.0-next-5a535ed-20240403
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +17 -12
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +17 -12
- package/3rdparty/walkontable/src/calculator/viewportRows.js +15 -10
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +15 -10
- package/3rdparty/walkontable/src/cell/coords.js +17 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +17 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +1 -2
- package/3rdparty/walkontable/src/cell/range.js +28 -40
- package/3rdparty/walkontable/src/cell/range.mjs +28 -40
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +104 -72
- package/3rdparty/walkontable/src/event.mjs +104 -72
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/scroll.js +17 -15
- package/3rdparty/walkontable/src/scroll.mjs +17 -15
- package/3rdparty/walkontable/src/selection/manager.js +69 -48
- package/3rdparty/walkontable/src/selection/manager.mjs +69 -48
- package/3rdparty/walkontable/src/selection/scanner.js +42 -33
- package/3rdparty/walkontable/src/selection/scanner.mjs +42 -33
- package/3rdparty/walkontable/src/utils/columnStretching.js +44 -27
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +44 -27
- package/3rdparty/walkontable/src/utils/orderView/view.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +1 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +1 -4
- package/core/viewportScroll/index.mjs +1 -4
- package/core.d.ts +3 -4
- package/core.js +22 -77
- package/core.mjs +22 -77
- package/dataMap/dataSource.js +1 -1
- package/dataMap/dataSource.mjs +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -1
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dataMap/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +4 -4
- package/dist/handsontable.full.css +4 -4
- package/dist/handsontable.full.js +9117 -8969
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +6569 -6874
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +25 -25
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +23 -25
- package/editorManager.mjs +23 -25
- package/editors/autocompleteEditor/autocompleteEditor.js +10 -6
- package/editors/autocompleteEditor/autocompleteEditor.mjs +10 -6
- package/editors/selectEditor/selectEditor.js +19 -20
- package/editors/selectEditor/selectEditor.mjs +19 -20
- package/eventManager.js +1 -1
- package/eventManager.mjs +1 -1
- package/focusManager.js +82 -64
- package/focusManager.mjs +82 -64
- package/helpers/dom/element.js +1 -1
- package/helpers/dom/element.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +2 -2
- package/helpers/object.mjs +2 -2
- package/index.d.ts +0 -10
- package/package.json +2 -7
- package/pluginHooks.d.ts +3 -4
- package/pluginHooks.js +38 -99
- package/pluginHooks.mjs +38 -99
- package/plugins/autoColumnSize/autoColumnSize.js +65 -49
- package/plugins/autoColumnSize/autoColumnSize.mjs +65 -49
- package/plugins/autoRowSize/autoRowSize.js +34 -28
- package/plugins/autoRowSize/autoRowSize.mjs +34 -28
- package/plugins/autofill/autofill.js +38 -30
- package/plugins/autofill/autofill.mjs +38 -30
- package/plugins/base/base.js +17 -12
- package/plugins/base/base.mjs +17 -12
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
- package/plugins/collapsibleColumns/collapsibleColumns.js +50 -59
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +50 -59
- package/plugins/columnSorting/columnSorting.js +45 -49
- package/plugins/columnSorting/columnSorting.mjs +45 -49
- package/plugins/columnSummary/columnSummary.js +26 -22
- package/plugins/columnSummary/columnSummary.mjs +26 -22
- package/plugins/comments/comments.js +158 -116
- package/plugins/comments/comments.mjs +158 -116
- package/plugins/contextMenu/contextMenu.js +26 -20
- package/plugins/contextMenu/contextMenu.mjs +26 -20
- package/plugins/contextMenu/itemsFactory.js +1 -1
- package/plugins/contextMenu/itemsFactory.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
- package/plugins/contextMenu/menu/menu.js +21 -13
- package/plugins/contextMenu/menu/menu.mjs +21 -13
- package/plugins/contextMenu/menu/positioner.js +58 -41
- package/plugins/contextMenu/menu/positioner.mjs +58 -41
- package/plugins/copyPaste/copyPaste.js +157 -116
- package/plugins/copyPaste/copyPaste.mjs +157 -116
- package/plugins/copyPaste/copyableRanges.js +66 -43
- package/plugins/copyPaste/copyableRanges.mjs +66 -43
- package/plugins/customBorders/customBorders.js +13 -11
- package/plugins/customBorders/customBorders.mjs +13 -11
- package/plugins/dragToScroll/dragToScroll.js +6 -6
- package/plugins/dragToScroll/dragToScroll.mjs +6 -6
- package/plugins/dropdownMenu/dropdownMenu.js +106 -80
- package/plugins/dropdownMenu/dropdownMenu.mjs +106 -80
- package/plugins/exportFile/dataProvider.js +1 -1
- package/plugins/exportFile/dataProvider.mjs +1 -1
- package/plugins/filters/component/actionBar.js +9 -9
- package/plugins/filters/component/actionBar.mjs +8 -8
- package/plugins/filters/component/condition.js +15 -13
- package/plugins/filters/component/condition.mjs +15 -13
- package/plugins/filters/component/operators.js +6 -6
- package/plugins/filters/component/operators.mjs +6 -6
- package/plugins/filters/component/value.js +28 -24
- package/plugins/filters/component/value.mjs +28 -24
- package/plugins/filters/conditionUpdateObserver.js +24 -22
- package/plugins/filters/conditionUpdateObserver.mjs +24 -22
- package/plugins/filters/dataFilter.js +1 -1
- package/plugins/filters/dataFilter.mjs +1 -1
- package/plugins/filters/filters.js +95 -81
- package/plugins/filters/filters.mjs +95 -81
- package/plugins/filters/ui/input.js +19 -13
- package/plugins/filters/ui/input.mjs +19 -13
- package/plugins/filters/ui/link.js +13 -8
- package/plugins/filters/ui/link.mjs +13 -8
- package/plugins/filters/ui/multipleSelect.js +112 -85
- package/plugins/filters/ui/multipleSelect.mjs +112 -85
- package/plugins/filters/ui/radioInput.js +20 -12
- package/plugins/filters/ui/radioInput.mjs +20 -12
- package/plugins/filters/ui/select.js +72 -50
- package/plugins/filters/ui/select.mjs +71 -49
- package/plugins/formulas/formulas.js +326 -268
- package/plugins/formulas/formulas.mjs +327 -269
- package/plugins/formulas/indexSyncer/axisSyncer.js +61 -38
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +61 -38
- package/plugins/formulas/indexSyncer/index.js +48 -25
- package/plugins/formulas/indexSyncer/index.mjs +48 -25
- package/plugins/hiddenColumns/hiddenColumns.js +83 -64
- package/plugins/hiddenColumns/hiddenColumns.mjs +83 -64
- package/plugins/hiddenRows/hiddenRows.js +82 -63
- package/plugins/hiddenRows/hiddenRows.mjs +82 -63
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +32 -24
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +33 -25
- package/plugins/manualColumnMove/manualColumnMove.js +170 -126
- package/plugins/manualColumnMove/manualColumnMove.mjs +170 -126
- package/plugins/manualColumnResize/manualColumnResize.js +230 -169
- package/plugins/manualColumnResize/manualColumnResize.mjs +230 -169
- package/plugins/manualRowMove/manualRowMove.js +128 -99
- package/plugins/manualRowMove/manualRowMove.mjs +128 -99
- package/plugins/manualRowResize/manualRowResize.js +209 -150
- package/plugins/manualRowResize/manualRowResize.mjs +209 -150
- package/plugins/mergeCells/calculations/selection.js +71 -2
- package/plugins/mergeCells/calculations/selection.mjs +71 -2
- package/plugins/mergeCells/cellsCollection.js +1 -117
- package/plugins/mergeCells/cellsCollection.mjs +1 -117
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
- package/plugins/mergeCells/mergeCells.js +397 -499
- package/plugins/mergeCells/mergeCells.mjs +397 -499
- package/plugins/multiColumnSorting/multiColumnSorting.js +2 -8
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -8
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +253 -205
- package/plugins/nestedHeaders/nestedHeaders.mjs +254 -206
- package/plugins/nestedHeaders/stateManager/headersTree.js +32 -21
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +32 -21
- package/plugins/nestedHeaders/stateManager/index.js +41 -30
- package/plugins/nestedHeaders/stateManager/index.mjs +41 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +30 -19
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +30 -19
- package/plugins/nestedRows/data/dataManager.js +1 -1
- package/plugins/nestedRows/data/dataManager.mjs +1 -1
- package/plugins/nestedRows/nestedRows.js +182 -151
- package/plugins/nestedRows/nestedRows.mjs +183 -152
- package/plugins/nestedRows/ui/contextMenu.js +15 -11
- package/plugins/nestedRows/ui/contextMenu.mjs +14 -10
- package/plugins/nestedRows/utils/rowMoveController.js +1 -1
- package/plugins/nestedRows/utils/rowMoveController.mjs +1 -1
- package/plugins/persistentState/storage.js +2 -2
- package/plugins/persistentState/storage.mjs +2 -2
- package/plugins/search/search.js +7 -7
- package/plugins/search/search.mjs +7 -7
- package/plugins/touchScroll/touchScroll.js +19 -15
- package/plugins/touchScroll/touchScroll.mjs +20 -16
- package/plugins/trimRows/trimRows.js +6 -6
- package/plugins/trimRows/trimRows.mjs +6 -6
- package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
- package/selection/highlight/highlight.js +14 -14
- package/selection/highlight/highlight.mjs +13 -13
- package/selection/highlight/visualSelection.js +0 -2
- package/selection/highlight/visualSelection.mjs +0 -2
- package/selection/selection.js +67 -225
- package/selection/selection.mjs +66 -224
- package/selection/transformation.js +118 -149
- package/selection/transformation.mjs +118 -149
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +3 -18
- package/shortcutContexts/commands/editor/open.mjs +3 -18
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
- package/shortcutContexts/grid.js +3 -9
- package/shortcutContexts/grid.mjs +3 -9
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/tableView.js +78 -52
- package/tableView.mjs +78 -52
- package/translations/changesObservable/observable.js +38 -21
- package/translations/changesObservable/observable.mjs +38 -21
- package/translations/changesObservable/observer.js +12 -7
- package/translations/changesObservable/observer.mjs +11 -6
- package/translations/mapCollections/aggregatedCollection.js +1 -1
- package/translations/mapCollections/aggregatedCollection.mjs +1 -1
- package/translations/maps/indexMap.js +1 -1
- package/translations/maps/indexMap.mjs +1 -1
- package/utils/dataStructures/linkedList.js +1 -6
- package/utils/dataStructures/linkedList.mjs +1 -6
- package/utils/dataStructures/tree.js +1 -1
- package/utils/dataStructures/tree.mjs +1 -1
- package/utils/interval.js +44 -26
- package/utils/interval.mjs +44 -26
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
- package/i18n/languages/ar-AR.d.ts +0 -5
- package/i18n/languages/cs-CZ.d.ts +0 -5
- package/i18n/languages/hr-HR.d.ts +0 -5
- package/i18n/languages/sr-SP.d.ts +0 -5
- package/plugins/mergeCells/focusOrder.js +0 -305
- package/plugins/mergeCells/focusOrder.mjs +0 -300
@@ -4,7 +4,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
4
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
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
6
6
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
-
function
|
7
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
8
8
|
import { BasePlugin } from "../base/index.mjs";
|
9
9
|
import { isRightClick } from "../../helpers/dom/event.mjs";
|
10
10
|
import { getParentWindow } from "../../helpers/dom/element.mjs";
|
@@ -21,7 +21,7 @@ export const PLUGIN_PRIORITY = 100;
|
|
21
21
|
* @class DragToScroll
|
22
22
|
* @plugin DragToScroll
|
23
23
|
*/
|
24
|
-
var
|
24
|
+
var _setupListening = /*#__PURE__*/new WeakSet();
|
25
25
|
export class DragToScroll extends BasePlugin {
|
26
26
|
constructor() {
|
27
27
|
super(...arguments);
|
@@ -30,7 +30,7 @@ export class DragToScroll extends BasePlugin {
|
|
30
30
|
*
|
31
31
|
* @param {MouseEvent} event The mouse event object.
|
32
32
|
*/
|
33
|
-
_classPrivateMethodInitSpec(this,
|
33
|
+
_classPrivateMethodInitSpec(this, _setupListening);
|
34
34
|
/**
|
35
35
|
* Size of an element and its position relative to the viewport,
|
36
36
|
* e.g. {bottom: 449, height: 441, left: 8, right: 814, top: 8, width: 806, x: 8, y:8}.
|
@@ -76,8 +76,8 @@ export class DragToScroll extends BasePlugin {
|
|
76
76
|
if (this.enabled) {
|
77
77
|
return;
|
78
78
|
}
|
79
|
-
this.addHook('afterOnCellMouseDown', event =>
|
80
|
-
this.addHook('afterOnCellCornerMouseDown', event =>
|
79
|
+
this.addHook('afterOnCellMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
80
|
+
this.addHook('afterOnCellCornerMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
81
81
|
this.registerEvents();
|
82
82
|
super.enablePlugin();
|
83
83
|
}
|
@@ -228,7 +228,7 @@ export class DragToScroll extends BasePlugin {
|
|
228
228
|
super.destroy();
|
229
229
|
}
|
230
230
|
}
|
231
|
-
function
|
231
|
+
function _setupListening2(event) {
|
232
232
|
if (isRightClick(event)) {
|
233
233
|
return;
|
234
234
|
}
|
@@ -20,9 +20,12 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
20
20
|
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; }
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
22
22
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
23
|
-
function _classPrivateFieldGet(
|
24
|
-
function
|
25
|
-
function
|
23
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
24
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
25
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
26
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
27
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
28
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
26
29
|
_pluginHooks.default.getSingleton().register('afterDropdownMenuDefaultOptions');
|
27
30
|
_pluginHooks.default.getSingleton().register('beforeDropdownMenuShow');
|
28
31
|
_pluginHooks.default.getSingleton().register('afterDropdownMenuShow');
|
@@ -39,14 +42,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
39
42
|
* @class DropdownMenu
|
40
43
|
*
|
41
44
|
* @description
|
42
|
-
* This plugin creates the Handsontable Dropdown Menu. It allows to create a new column at any place in the grid
|
45
|
+
* This plugin creates the Handsontable Dropdown Menu. It allows to create a new row or column at any place in the grid
|
43
46
|
* among [other features](@/guides/accessories-and-menus/context-menu/context-menu.md#context-menu-with-specific-options).
|
44
47
|
* Possible values:
|
45
48
|
* * `true` (to enable default options),
|
46
49
|
* * `false` (to disable completely).
|
47
50
|
*
|
48
51
|
* or array of any available strings:
|
49
|
-
* * `["
|
52
|
+
* * `["row_above", "row_below", "col_left", "col_right",
|
53
|
+
* "remove_row", "remove_col", "---------", "undo", "redo"]`.
|
50
54
|
*
|
51
55
|
* See [the dropdown menu demo](@/guides/columns/column-menu/column-menu.md) for examples.
|
52
56
|
*
|
@@ -83,7 +87,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
83
87
|
* :::
|
84
88
|
*/
|
85
89
|
var _isButtonClicked = /*#__PURE__*/new WeakMap();
|
86
|
-
var
|
90
|
+
var _addCustomShortcuts = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onTableClick = /*#__PURE__*/new WeakSet();
|
92
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
95
|
+
var _onSubMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
96
|
+
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
97
|
+
var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
|
98
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
87
99
|
class DropdownMenu extends _base.BasePlugin {
|
88
100
|
static get PLUGIN_KEY() {
|
89
101
|
return PLUGIN_KEY;
|
@@ -115,12 +127,70 @@ class DropdownMenu extends _base.BasePlugin {
|
|
115
127
|
super(hotInstance);
|
116
128
|
|
117
129
|
// One listener for enable/disable functionality
|
130
|
+
/**
|
131
|
+
* Hook sets the internal flag to `true` when the button is clicked.
|
132
|
+
*
|
133
|
+
* @param {MouseEvent} event The mouse event object.
|
134
|
+
*/
|
135
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
136
|
+
/**
|
137
|
+
* Hook allows blocking horizontal scroll when the menu is opened by clicking on
|
138
|
+
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
139
|
+
* the button is clicked.
|
140
|
+
*
|
141
|
+
* @param {number} visualColumn Visual column index.
|
142
|
+
* @returns {number | null}
|
143
|
+
*/
|
144
|
+
_classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
|
145
|
+
/**
|
146
|
+
* On menu after close listener.
|
147
|
+
*
|
148
|
+
* @private
|
149
|
+
* @fires Hooks#afterDropdownMenuHide
|
150
|
+
*/
|
151
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterClose);
|
152
|
+
/**
|
153
|
+
* Listener for the `afterSubmenuOpen` hook.
|
154
|
+
*
|
155
|
+
* @private
|
156
|
+
* @param {Menu} subMenuInstance The opened sub menu instance.
|
157
|
+
*/
|
158
|
+
_classPrivateMethodInitSpec(this, _onSubMenuAfterOpen);
|
159
|
+
/**
|
160
|
+
* On menu after open listener.
|
161
|
+
*
|
162
|
+
* @private
|
163
|
+
* @fires Hooks#afterDropdownMenuShow
|
164
|
+
*/
|
165
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterOpen);
|
166
|
+
/**
|
167
|
+
* On menu before open listener.
|
168
|
+
*
|
169
|
+
* @private
|
170
|
+
* @fires Hooks#beforeDropdownMenuShow
|
171
|
+
*/
|
172
|
+
_classPrivateMethodInitSpec(this, _onMenuBeforeOpen);
|
173
|
+
/**
|
174
|
+
* On after get column header listener.
|
175
|
+
*
|
176
|
+
* @private
|
177
|
+
* @param {number} col Visual column index.
|
178
|
+
* @param {HTMLTableCellElement} TH Header's TH element.
|
179
|
+
*/
|
180
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
181
|
+
/**
|
182
|
+
* Table click listener.
|
183
|
+
*
|
184
|
+
* @private
|
185
|
+
* @param {Event} event The mouse event object.
|
186
|
+
*/
|
187
|
+
_classPrivateMethodInitSpec(this, _onTableClick);
|
118
188
|
/**
|
119
189
|
* Add custom shortcuts to the provided menu instance.
|
120
190
|
*
|
121
191
|
* @param {Menu} menuInstance The menu instance.
|
122
192
|
*/
|
123
|
-
_classPrivateMethodInitSpec(this,
|
193
|
+
_classPrivateMethodInitSpec(this, _addCustomShortcuts);
|
124
194
|
_defineProperty(this, "commandExecutor", new _commandExecutor.CommandExecutor(this.hot));
|
125
195
|
/**
|
126
196
|
* Instance of {@link ItemsFactory}.
|
@@ -141,8 +211,11 @@ class DropdownMenu extends _base.BasePlugin {
|
|
141
211
|
*
|
142
212
|
* @type {boolean}
|
143
213
|
*/
|
144
|
-
_classPrivateFieldInitSpec(this, _isButtonClicked,
|
145
|
-
|
214
|
+
_classPrivateFieldInitSpec(this, _isButtonClicked, {
|
215
|
+
writable: true,
|
216
|
+
value: false
|
217
|
+
});
|
218
|
+
this.hot.addHook('afterGetColHeader', (col, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, col, TH));
|
146
219
|
}
|
147
220
|
|
148
221
|
/**
|
@@ -171,13 +244,13 @@ class DropdownMenu extends _base.BasePlugin {
|
|
171
244
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
172
245
|
args[_key] = arguments[_key];
|
173
246
|
}
|
174
|
-
return
|
247
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
175
248
|
});
|
176
249
|
this.addHook('beforeViewportScrollHorizontally', function () {
|
177
250
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
178
251
|
args[_key2] = arguments[_key2];
|
179
252
|
}
|
180
|
-
return
|
253
|
+
return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
|
181
254
|
});
|
182
255
|
const settings = this.hot.getSettings()[PLUGIN_KEY];
|
183
256
|
const predefinedItems = {
|
@@ -203,10 +276,10 @@ class DropdownMenu extends _base.BasePlugin {
|
|
203
276
|
});
|
204
277
|
this.hot.runHooks('beforeDropdownMenuSetItems', menuItems);
|
205
278
|
this.menu.setMenuItems(menuItems);
|
206
|
-
this.menu.addLocalHook('beforeOpen', () =>
|
207
|
-
this.menu.addLocalHook('afterOpen', () =>
|
208
|
-
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance =>
|
209
|
-
this.menu.addLocalHook('afterClose', () =>
|
279
|
+
this.menu.addLocalHook('beforeOpen', () => _classPrivateMethodGet(this, _onMenuBeforeOpen, _onMenuBeforeOpen2).call(this));
|
280
|
+
this.menu.addLocalHook('afterOpen', () => _classPrivateMethodGet(this, _onMenuAfterOpen, _onMenuAfterOpen2).call(this));
|
281
|
+
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _classPrivateMethodGet(this, _onSubMenuAfterOpen, _onSubMenuAfterOpen2).call(this, subMenuInstance));
|
282
|
+
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
210
283
|
this.menu.addLocalHook('executeCommand', function () {
|
211
284
|
for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
212
285
|
params[_key3] = arguments[_key3];
|
@@ -310,7 +383,7 @@ class DropdownMenu extends _base.BasePlugin {
|
|
310
383
|
* @private
|
311
384
|
*/
|
312
385
|
registerEvents() {
|
313
|
-
this.eventManager.addEventListener(this.hot.rootElement, 'click', event =>
|
386
|
+
this.eventManager.addEventListener(this.hot.rootElement, 'click', event => _classPrivateMethodGet(this, _onTableClick, _onTableClick2).call(this, event));
|
314
387
|
}
|
315
388
|
|
316
389
|
/**
|
@@ -359,9 +432,12 @@ class DropdownMenu extends _base.BasePlugin {
|
|
359
432
|
* When no cells are selected, `executeCommand()` doesn't do anything.
|
360
433
|
*
|
361
434
|
* You can execute all predefined commands:
|
435
|
+
* * `'row_above'` - Insert row above
|
436
|
+
* * `'row_below'` - Insert row below
|
362
437
|
* * `'col_left'` - Insert column left
|
363
438
|
* * `'col_right'` - Insert column right
|
364
439
|
* * `'clear_column'` - Clear selected column
|
440
|
+
* * `'remove_row'` - Remove row
|
365
441
|
* * `'remove_col'` - Remove column
|
366
442
|
* * `'undo'` - Undo last action
|
367
443
|
* * `'redo'` - Redo last action
|
@@ -413,24 +489,18 @@ class DropdownMenu extends _base.BasePlugin {
|
|
413
489
|
}
|
414
490
|
}
|
415
491
|
exports.DropdownMenu = DropdownMenu;
|
416
|
-
function
|
492
|
+
function _addCustomShortcuts2(menuInstance) {
|
417
493
|
menuInstance.getKeyboardShortcutsCtrl().addCustomShortcuts([{
|
418
494
|
keys: [['Control/Meta', 'A']],
|
419
495
|
callback: () => false
|
420
496
|
}]);
|
421
497
|
}
|
422
|
-
|
423
|
-
* Table click listener.
|
424
|
-
*
|
425
|
-
* @private
|
426
|
-
* @param {Event} event The mouse event object.
|
427
|
-
*/
|
428
|
-
function _onTableClick(event) {
|
498
|
+
function _onTableClick2(event) {
|
429
499
|
event.stopPropagation();
|
430
500
|
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
431
501
|
const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
|
432
502
|
const rect = event.target.getBoundingClientRect();
|
433
|
-
_classPrivateFieldSet(
|
503
|
+
_classPrivateFieldSet(this, _isButtonClicked, false);
|
434
504
|
this.open({
|
435
505
|
left: rect.left + offset.left,
|
436
506
|
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
@@ -439,14 +509,7 @@ function _onTableClick(event) {
|
|
439
509
|
});
|
440
510
|
}
|
441
511
|
}
|
442
|
-
|
443
|
-
* On after get column header listener.
|
444
|
-
*
|
445
|
-
* @private
|
446
|
-
* @param {number} col Visual column index.
|
447
|
-
* @param {HTMLTableCellElement} TH Header's TH element.
|
448
|
-
*/
|
449
|
-
function _onAfterGetColHeader(col, TH) {
|
512
|
+
function _onAfterGetColHeader2(col, TH) {
|
450
513
|
// Corner or a higher-level header
|
451
514
|
const headerRow = TH.parentNode;
|
452
515
|
if (!headerRow) {
|
@@ -485,63 +548,26 @@ function _onAfterGetColHeader(col, TH) {
|
|
485
548
|
};
|
486
549
|
TH.firstChild.insertBefore(button, TH.firstChild.firstChild);
|
487
550
|
}
|
488
|
-
|
489
|
-
* On menu before open listener.
|
490
|
-
*
|
491
|
-
* @private
|
492
|
-
* @fires Hooks#beforeDropdownMenuShow
|
493
|
-
*/
|
494
|
-
function _onMenuBeforeOpen() {
|
551
|
+
function _onMenuBeforeOpen2() {
|
495
552
|
this.hot.runHooks('beforeDropdownMenuShow', this);
|
496
553
|
}
|
497
|
-
|
498
|
-
* On menu after open listener.
|
499
|
-
*
|
500
|
-
* @private
|
501
|
-
* @fires Hooks#afterDropdownMenuShow
|
502
|
-
*/
|
503
|
-
function _onMenuAfterOpen() {
|
554
|
+
function _onMenuAfterOpen2() {
|
504
555
|
this.hot.runHooks('afterDropdownMenuShow', this);
|
505
|
-
|
556
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, this.menu);
|
506
557
|
}
|
507
|
-
|
508
|
-
|
509
|
-
*
|
510
|
-
* @private
|
511
|
-
* @param {Menu} subMenuInstance The opened sub menu instance.
|
512
|
-
*/
|
513
|
-
function _onSubMenuAfterOpen(subMenuInstance) {
|
514
|
-
_assertClassBrand(_DropdownMenu_brand, this, _addCustomShortcuts).call(this, subMenuInstance);
|
558
|
+
function _onSubMenuAfterOpen2(subMenuInstance) {
|
559
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, subMenuInstance);
|
515
560
|
}
|
516
|
-
|
517
|
-
* On menu after close listener.
|
518
|
-
*
|
519
|
-
* @private
|
520
|
-
* @fires Hooks#afterDropdownMenuHide
|
521
|
-
*/
|
522
|
-
function _onMenuAfterClose() {
|
561
|
+
function _onMenuAfterClose2() {
|
523
562
|
this.hot.listen();
|
524
563
|
this.hot.runHooks('afterDropdownMenuHide', this);
|
525
564
|
}
|
526
|
-
|
527
|
-
|
528
|
-
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
529
|
-
* the button is clicked.
|
530
|
-
*
|
531
|
-
* @param {number} visualColumn Visual column index.
|
532
|
-
* @returns {number | null}
|
533
|
-
*/
|
534
|
-
function _onBeforeViewportScrollHorizontally(visualColumn) {
|
535
|
-
return _classPrivateFieldGet(_isButtonClicked, this) ? null : visualColumn;
|
565
|
+
function _onBeforeViewportScrollHorizontally2(visualColumn) {
|
566
|
+
return _classPrivateFieldGet(this, _isButtonClicked) ? null : visualColumn;
|
536
567
|
}
|
537
|
-
|
538
|
-
* Hook sets the internal flag to `true` when the button is clicked.
|
539
|
-
*
|
540
|
-
* @param {MouseEvent} event The mouse event object.
|
541
|
-
*/
|
542
|
-
function _onBeforeOnCellMouseDown(event) {
|
568
|
+
function _onBeforeOnCellMouseDown2(event) {
|
543
569
|
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
544
|
-
_classPrivateFieldSet(
|
570
|
+
_classPrivateFieldSet(this, _isButtonClicked, true);
|
545
571
|
}
|
546
572
|
}
|
547
573
|
DropdownMenu.SEPARATOR = {
|
@@ -5,9 +5,12 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
5
5
|
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; }
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
7
7
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
-
function _classPrivateFieldGet(
|
9
|
-
function
|
10
|
-
function
|
8
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
9
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
10
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
11
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
12
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
13
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
11
14
|
import { BasePlugin } from "../base/index.mjs";
|
12
15
|
import { arrayEach } from "../../helpers/array.mjs";
|
13
16
|
import { objectEach } from "../../helpers/object.mjs";
|
@@ -35,14 +38,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
35
38
|
* @class DropdownMenu
|
36
39
|
*
|
37
40
|
* @description
|
38
|
-
* This plugin creates the Handsontable Dropdown Menu. It allows to create a new column at any place in the grid
|
41
|
+
* This plugin creates the Handsontable Dropdown Menu. It allows to create a new row or column at any place in the grid
|
39
42
|
* among [other features](@/guides/accessories-and-menus/context-menu/context-menu.md#context-menu-with-specific-options).
|
40
43
|
* Possible values:
|
41
44
|
* * `true` (to enable default options),
|
42
45
|
* * `false` (to disable completely).
|
43
46
|
*
|
44
47
|
* or array of any available strings:
|
45
|
-
* * `["
|
48
|
+
* * `["row_above", "row_below", "col_left", "col_right",
|
49
|
+
* "remove_row", "remove_col", "---------", "undo", "redo"]`.
|
46
50
|
*
|
47
51
|
* See [the dropdown menu demo](@/guides/columns/column-menu/column-menu.md) for examples.
|
48
52
|
*
|
@@ -79,7 +83,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
79
83
|
* :::
|
80
84
|
*/
|
81
85
|
var _isButtonClicked = /*#__PURE__*/new WeakMap();
|
82
|
-
var
|
86
|
+
var _addCustomShortcuts = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onTableClick = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onSubMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
92
|
+
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
83
95
|
export class DropdownMenu extends BasePlugin {
|
84
96
|
static get PLUGIN_KEY() {
|
85
97
|
return PLUGIN_KEY;
|
@@ -111,12 +123,70 @@ export class DropdownMenu extends BasePlugin {
|
|
111
123
|
super(hotInstance);
|
112
124
|
|
113
125
|
// One listener for enable/disable functionality
|
126
|
+
/**
|
127
|
+
* Hook sets the internal flag to `true` when the button is clicked.
|
128
|
+
*
|
129
|
+
* @param {MouseEvent} event The mouse event object.
|
130
|
+
*/
|
131
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
132
|
+
/**
|
133
|
+
* Hook allows blocking horizontal scroll when the menu is opened by clicking on
|
134
|
+
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
135
|
+
* the button is clicked.
|
136
|
+
*
|
137
|
+
* @param {number} visualColumn Visual column index.
|
138
|
+
* @returns {number | null}
|
139
|
+
*/
|
140
|
+
_classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
|
141
|
+
/**
|
142
|
+
* On menu after close listener.
|
143
|
+
*
|
144
|
+
* @private
|
145
|
+
* @fires Hooks#afterDropdownMenuHide
|
146
|
+
*/
|
147
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterClose);
|
148
|
+
/**
|
149
|
+
* Listener for the `afterSubmenuOpen` hook.
|
150
|
+
*
|
151
|
+
* @private
|
152
|
+
* @param {Menu} subMenuInstance The opened sub menu instance.
|
153
|
+
*/
|
154
|
+
_classPrivateMethodInitSpec(this, _onSubMenuAfterOpen);
|
155
|
+
/**
|
156
|
+
* On menu after open listener.
|
157
|
+
*
|
158
|
+
* @private
|
159
|
+
* @fires Hooks#afterDropdownMenuShow
|
160
|
+
*/
|
161
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterOpen);
|
162
|
+
/**
|
163
|
+
* On menu before open listener.
|
164
|
+
*
|
165
|
+
* @private
|
166
|
+
* @fires Hooks#beforeDropdownMenuShow
|
167
|
+
*/
|
168
|
+
_classPrivateMethodInitSpec(this, _onMenuBeforeOpen);
|
169
|
+
/**
|
170
|
+
* On after get column header listener.
|
171
|
+
*
|
172
|
+
* @private
|
173
|
+
* @param {number} col Visual column index.
|
174
|
+
* @param {HTMLTableCellElement} TH Header's TH element.
|
175
|
+
*/
|
176
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
177
|
+
/**
|
178
|
+
* Table click listener.
|
179
|
+
*
|
180
|
+
* @private
|
181
|
+
* @param {Event} event The mouse event object.
|
182
|
+
*/
|
183
|
+
_classPrivateMethodInitSpec(this, _onTableClick);
|
114
184
|
/**
|
115
185
|
* Add custom shortcuts to the provided menu instance.
|
116
186
|
*
|
117
187
|
* @param {Menu} menuInstance The menu instance.
|
118
188
|
*/
|
119
|
-
_classPrivateMethodInitSpec(this,
|
189
|
+
_classPrivateMethodInitSpec(this, _addCustomShortcuts);
|
120
190
|
_defineProperty(this, "commandExecutor", new CommandExecutor(this.hot));
|
121
191
|
/**
|
122
192
|
* Instance of {@link ItemsFactory}.
|
@@ -137,8 +207,11 @@ export class DropdownMenu extends BasePlugin {
|
|
137
207
|
*
|
138
208
|
* @type {boolean}
|
139
209
|
*/
|
140
|
-
_classPrivateFieldInitSpec(this, _isButtonClicked,
|
141
|
-
|
210
|
+
_classPrivateFieldInitSpec(this, _isButtonClicked, {
|
211
|
+
writable: true,
|
212
|
+
value: false
|
213
|
+
});
|
214
|
+
this.hot.addHook('afterGetColHeader', (col, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, col, TH));
|
142
215
|
}
|
143
216
|
|
144
217
|
/**
|
@@ -167,13 +240,13 @@ export class DropdownMenu extends BasePlugin {
|
|
167
240
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
168
241
|
args[_key] = arguments[_key];
|
169
242
|
}
|
170
|
-
return
|
243
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
171
244
|
});
|
172
245
|
this.addHook('beforeViewportScrollHorizontally', function () {
|
173
246
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
174
247
|
args[_key2] = arguments[_key2];
|
175
248
|
}
|
176
|
-
return
|
249
|
+
return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
|
177
250
|
});
|
178
251
|
const settings = this.hot.getSettings()[PLUGIN_KEY];
|
179
252
|
const predefinedItems = {
|
@@ -199,10 +272,10 @@ export class DropdownMenu extends BasePlugin {
|
|
199
272
|
});
|
200
273
|
this.hot.runHooks('beforeDropdownMenuSetItems', menuItems);
|
201
274
|
this.menu.setMenuItems(menuItems);
|
202
|
-
this.menu.addLocalHook('beforeOpen', () =>
|
203
|
-
this.menu.addLocalHook('afterOpen', () =>
|
204
|
-
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance =>
|
205
|
-
this.menu.addLocalHook('afterClose', () =>
|
275
|
+
this.menu.addLocalHook('beforeOpen', () => _classPrivateMethodGet(this, _onMenuBeforeOpen, _onMenuBeforeOpen2).call(this));
|
276
|
+
this.menu.addLocalHook('afterOpen', () => _classPrivateMethodGet(this, _onMenuAfterOpen, _onMenuAfterOpen2).call(this));
|
277
|
+
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _classPrivateMethodGet(this, _onSubMenuAfterOpen, _onSubMenuAfterOpen2).call(this, subMenuInstance));
|
278
|
+
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
206
279
|
this.menu.addLocalHook('executeCommand', function () {
|
207
280
|
for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
208
281
|
params[_key3] = arguments[_key3];
|
@@ -306,7 +379,7 @@ export class DropdownMenu extends BasePlugin {
|
|
306
379
|
* @private
|
307
380
|
*/
|
308
381
|
registerEvents() {
|
309
|
-
this.eventManager.addEventListener(this.hot.rootElement, 'click', event =>
|
382
|
+
this.eventManager.addEventListener(this.hot.rootElement, 'click', event => _classPrivateMethodGet(this, _onTableClick, _onTableClick2).call(this, event));
|
310
383
|
}
|
311
384
|
|
312
385
|
/**
|
@@ -355,9 +428,12 @@ export class DropdownMenu extends BasePlugin {
|
|
355
428
|
* When no cells are selected, `executeCommand()` doesn't do anything.
|
356
429
|
*
|
357
430
|
* You can execute all predefined commands:
|
431
|
+
* * `'row_above'` - Insert row above
|
432
|
+
* * `'row_below'` - Insert row below
|
358
433
|
* * `'col_left'` - Insert column left
|
359
434
|
* * `'col_right'` - Insert column right
|
360
435
|
* * `'clear_column'` - Clear selected column
|
436
|
+
* * `'remove_row'` - Remove row
|
361
437
|
* * `'remove_col'` - Remove column
|
362
438
|
* * `'undo'` - Undo last action
|
363
439
|
* * `'redo'` - Redo last action
|
@@ -408,24 +484,18 @@ export class DropdownMenu extends BasePlugin {
|
|
408
484
|
super.destroy();
|
409
485
|
}
|
410
486
|
}
|
411
|
-
function
|
487
|
+
function _addCustomShortcuts2(menuInstance) {
|
412
488
|
menuInstance.getKeyboardShortcutsCtrl().addCustomShortcuts([{
|
413
489
|
keys: [['Control/Meta', 'A']],
|
414
490
|
callback: () => false
|
415
491
|
}]);
|
416
492
|
}
|
417
|
-
|
418
|
-
* Table click listener.
|
419
|
-
*
|
420
|
-
* @private
|
421
|
-
* @param {Event} event The mouse event object.
|
422
|
-
*/
|
423
|
-
function _onTableClick(event) {
|
493
|
+
function _onTableClick2(event) {
|
424
494
|
event.stopPropagation();
|
425
495
|
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
426
496
|
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
427
497
|
const rect = event.target.getBoundingClientRect();
|
428
|
-
_classPrivateFieldSet(
|
498
|
+
_classPrivateFieldSet(this, _isButtonClicked, false);
|
429
499
|
this.open({
|
430
500
|
left: rect.left + offset.left,
|
431
501
|
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
@@ -434,14 +504,7 @@ function _onTableClick(event) {
|
|
434
504
|
});
|
435
505
|
}
|
436
506
|
}
|
437
|
-
|
438
|
-
* On after get column header listener.
|
439
|
-
*
|
440
|
-
* @private
|
441
|
-
* @param {number} col Visual column index.
|
442
|
-
* @param {HTMLTableCellElement} TH Header's TH element.
|
443
|
-
*/
|
444
|
-
function _onAfterGetColHeader(col, TH) {
|
507
|
+
function _onAfterGetColHeader2(col, TH) {
|
445
508
|
// Corner or a higher-level header
|
446
509
|
const headerRow = TH.parentNode;
|
447
510
|
if (!headerRow) {
|
@@ -480,63 +543,26 @@ function _onAfterGetColHeader(col, TH) {
|
|
480
543
|
};
|
481
544
|
TH.firstChild.insertBefore(button, TH.firstChild.firstChild);
|
482
545
|
}
|
483
|
-
|
484
|
-
* On menu before open listener.
|
485
|
-
*
|
486
|
-
* @private
|
487
|
-
* @fires Hooks#beforeDropdownMenuShow
|
488
|
-
*/
|
489
|
-
function _onMenuBeforeOpen() {
|
546
|
+
function _onMenuBeforeOpen2() {
|
490
547
|
this.hot.runHooks('beforeDropdownMenuShow', this);
|
491
548
|
}
|
492
|
-
|
493
|
-
* On menu after open listener.
|
494
|
-
*
|
495
|
-
* @private
|
496
|
-
* @fires Hooks#afterDropdownMenuShow
|
497
|
-
*/
|
498
|
-
function _onMenuAfterOpen() {
|
549
|
+
function _onMenuAfterOpen2() {
|
499
550
|
this.hot.runHooks('afterDropdownMenuShow', this);
|
500
|
-
|
551
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, this.menu);
|
501
552
|
}
|
502
|
-
|
503
|
-
|
504
|
-
*
|
505
|
-
* @private
|
506
|
-
* @param {Menu} subMenuInstance The opened sub menu instance.
|
507
|
-
*/
|
508
|
-
function _onSubMenuAfterOpen(subMenuInstance) {
|
509
|
-
_assertClassBrand(_DropdownMenu_brand, this, _addCustomShortcuts).call(this, subMenuInstance);
|
553
|
+
function _onSubMenuAfterOpen2(subMenuInstance) {
|
554
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, subMenuInstance);
|
510
555
|
}
|
511
|
-
|
512
|
-
* On menu after close listener.
|
513
|
-
*
|
514
|
-
* @private
|
515
|
-
* @fires Hooks#afterDropdownMenuHide
|
516
|
-
*/
|
517
|
-
function _onMenuAfterClose() {
|
556
|
+
function _onMenuAfterClose2() {
|
518
557
|
this.hot.listen();
|
519
558
|
this.hot.runHooks('afterDropdownMenuHide', this);
|
520
559
|
}
|
521
|
-
|
522
|
-
|
523
|
-
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
524
|
-
* the button is clicked.
|
525
|
-
*
|
526
|
-
* @param {number} visualColumn Visual column index.
|
527
|
-
* @returns {number | null}
|
528
|
-
*/
|
529
|
-
function _onBeforeViewportScrollHorizontally(visualColumn) {
|
530
|
-
return _classPrivateFieldGet(_isButtonClicked, this) ? null : visualColumn;
|
560
|
+
function _onBeforeViewportScrollHorizontally2(visualColumn) {
|
561
|
+
return _classPrivateFieldGet(this, _isButtonClicked) ? null : visualColumn;
|
531
562
|
}
|
532
|
-
|
533
|
-
* Hook sets the internal flag to `true` when the button is clicked.
|
534
|
-
*
|
535
|
-
* @param {MouseEvent} event The mouse event object.
|
536
|
-
*/
|
537
|
-
function _onBeforeOnCellMouseDown(event) {
|
563
|
+
function _onBeforeOnCellMouseDown2(event) {
|
538
564
|
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
539
|
-
_classPrivateFieldSet(
|
565
|
+
_classPrivateFieldSet(this, _isButtonClicked, true);
|
540
566
|
}
|
541
567
|
}
|
542
568
|
DropdownMenu.SEPARATOR = {
|