handsontable 14.0.0-next-c080457-20231107 → 14.0.0-next-bfad250-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 +25 -25
- package/core.mjs +25 -25
- 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 -6389
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +154 -154
- package/dist/handsontable.js +7336 -6388
- 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.d.ts +0 -1
- 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 +335 -279
- package/plugins/nestedRows/nestedRows.mjs +334 -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/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,11 +1,16 @@
|
|
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
|
-
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
6
6
|
var _event = require("../../helpers/dom/event");
|
7
7
|
var _element = require("../../helpers/dom/element");
|
8
|
-
function
|
8
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
9
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
10
|
+
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; }
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
12
|
+
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); }
|
13
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
9
14
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'dragToScroll';
|
10
15
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 100;
|
11
16
|
|
@@ -19,45 +24,44 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 100;
|
|
19
24
|
* @class DragToScroll
|
20
25
|
* @plugin DragToScroll
|
21
26
|
*/
|
27
|
+
var _setupListening = /*#__PURE__*/new WeakSet();
|
22
28
|
class DragToScroll extends _base.BasePlugin {
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
static get PLUGIN_PRIORITY() {
|
27
|
-
return PLUGIN_PRIORITY;
|
28
|
-
}
|
29
|
-
constructor(hotInstance) {
|
30
|
-
super(hotInstance);
|
29
|
+
constructor() {
|
30
|
+
super(...arguments);
|
31
31
|
/**
|
32
|
-
*
|
32
|
+
* On after on cell/cellCorner mouse down listener.
|
33
33
|
*
|
34
|
-
* @
|
35
|
-
* @type {EventManager}
|
34
|
+
* @param {MouseEvent} event The mouse event object.
|
36
35
|
*/
|
37
|
-
this
|
36
|
+
_classPrivateMethodInitSpec(this, _setupListening);
|
38
37
|
/**
|
39
38
|
* Size of an element and its position relative to the viewport,
|
40
39
|
* e.g. {bottom: 449, height: 441, left: 8, right: 814, top: 8, width: 806, x: 8, y:8}.
|
41
40
|
*
|
42
41
|
* @type {DOMRect}
|
43
42
|
*/
|
44
|
-
this
|
43
|
+
_defineProperty(this, "boundaries", null);
|
45
44
|
/**
|
46
45
|
* Callback function.
|
47
46
|
*
|
48
47
|
* @private
|
49
48
|
* @type {Function}
|
50
49
|
*/
|
51
|
-
this
|
50
|
+
_defineProperty(this, "callback", null);
|
52
51
|
/**
|
53
52
|
* Flag indicates mouseDown/mouseUp.
|
54
53
|
*
|
55
54
|
* @private
|
56
55
|
* @type {boolean}
|
57
56
|
*/
|
58
|
-
this
|
57
|
+
_defineProperty(this, "listening", false);
|
58
|
+
}
|
59
|
+
static get PLUGIN_KEY() {
|
60
|
+
return PLUGIN_KEY;
|
61
|
+
}
|
62
|
+
static get PLUGIN_PRIORITY() {
|
63
|
+
return PLUGIN_PRIORITY;
|
59
64
|
}
|
60
|
-
|
61
65
|
/**
|
62
66
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
63
67
|
* hook and if it returns `true` then the {@link DragToScroll#enablePlugin} method is called.
|
@@ -75,8 +79,8 @@ class DragToScroll extends _base.BasePlugin {
|
|
75
79
|
if (this.enabled) {
|
76
80
|
return;
|
77
81
|
}
|
78
|
-
this.addHook('afterOnCellMouseDown', event => this.
|
79
|
-
this.addHook('afterOnCellCornerMouseDown', event => this.
|
82
|
+
this.addHook('afterOnCellMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
83
|
+
this.addHook('afterOnCellCornerMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
80
84
|
this.registerEvents();
|
81
85
|
super.enablePlugin();
|
82
86
|
}
|
@@ -200,39 +204,6 @@ class DragToScroll extends _base.BasePlugin {
|
|
200
204
|
unregisterEvents() {
|
201
205
|
this.eventManager.clear();
|
202
206
|
}
|
203
|
-
|
204
|
-
/**
|
205
|
-
* On after on cell/cellCorner mouse down listener.
|
206
|
-
*
|
207
|
-
* @private
|
208
|
-
* @param {MouseEvent} event The mouse event object.
|
209
|
-
*/
|
210
|
-
setupListening(event) {
|
211
|
-
if ((0, _event.isRightClick)(event)) {
|
212
|
-
return;
|
213
|
-
}
|
214
|
-
const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
|
215
|
-
|
216
|
-
if (scrollHandler === this.hot.rootWindow) {
|
217
|
-
// not much we can do currently
|
218
|
-
return;
|
219
|
-
}
|
220
|
-
this.setBoundaries(scrollHandler.getBoundingClientRect());
|
221
|
-
this.setCallback((scrollX, scrollY) => {
|
222
|
-
if (scrollX < 0) {
|
223
|
-
scrollHandler.scrollLeft -= 50;
|
224
|
-
} else if (scrollX > 0) {
|
225
|
-
scrollHandler.scrollLeft += 50;
|
226
|
-
}
|
227
|
-
if (scrollY < 0) {
|
228
|
-
scrollHandler.scrollTop -= 20;
|
229
|
-
} else if (scrollY > 0) {
|
230
|
-
scrollHandler.scrollTop += 20;
|
231
|
-
}
|
232
|
-
});
|
233
|
-
this.listen();
|
234
|
-
}
|
235
|
-
|
236
207
|
/**
|
237
208
|
* 'mouseMove' event callback.
|
238
209
|
*
|
@@ -253,4 +224,29 @@ class DragToScroll extends _base.BasePlugin {
|
|
253
224
|
super.destroy();
|
254
225
|
}
|
255
226
|
}
|
256
|
-
exports.DragToScroll = DragToScroll;
|
227
|
+
exports.DragToScroll = DragToScroll;
|
228
|
+
function _setupListening2(event) {
|
229
|
+
if ((0, _event.isRightClick)(event)) {
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
|
233
|
+
|
234
|
+
if (scrollHandler === this.hot.rootWindow) {
|
235
|
+
// not much we can do currently
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
this.setBoundaries(scrollHandler.getBoundingClientRect());
|
239
|
+
this.setCallback((scrollX, scrollY) => {
|
240
|
+
if (scrollX < 0) {
|
241
|
+
scrollHandler.scrollLeft -= 50;
|
242
|
+
} else if (scrollX > 0) {
|
243
|
+
scrollHandler.scrollLeft += 50;
|
244
|
+
}
|
245
|
+
if (scrollY < 0) {
|
246
|
+
scrollHandler.scrollTop -= 20;
|
247
|
+
} else if (scrollY > 0) {
|
248
|
+
scrollHandler.scrollTop += 20;
|
249
|
+
}
|
250
|
+
});
|
251
|
+
this.listen();
|
252
|
+
}
|
@@ -1,5 +1,11 @@
|
|
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
|
-
import EventManager from "../../eventManager.mjs";
|
3
9
|
import { isRightClick } from "../../helpers/dom/event.mjs";
|
4
10
|
import { getParentWindow } from "../../helpers/dom/element.mjs";
|
5
11
|
export const PLUGIN_KEY = 'dragToScroll';
|
@@ -15,45 +21,44 @@ export const PLUGIN_PRIORITY = 100;
|
|
15
21
|
* @class DragToScroll
|
16
22
|
* @plugin DragToScroll
|
17
23
|
*/
|
24
|
+
var _setupListening = /*#__PURE__*/new WeakSet();
|
18
25
|
export class DragToScroll extends BasePlugin {
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
static get PLUGIN_PRIORITY() {
|
23
|
-
return PLUGIN_PRIORITY;
|
24
|
-
}
|
25
|
-
constructor(hotInstance) {
|
26
|
-
super(hotInstance);
|
26
|
+
constructor() {
|
27
|
+
super(...arguments);
|
27
28
|
/**
|
28
|
-
*
|
29
|
+
* On after on cell/cellCorner mouse down listener.
|
29
30
|
*
|
30
|
-
* @
|
31
|
-
* @type {EventManager}
|
31
|
+
* @param {MouseEvent} event The mouse event object.
|
32
32
|
*/
|
33
|
-
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}.
|
37
37
|
*
|
38
38
|
* @type {DOMRect}
|
39
39
|
*/
|
40
|
-
this
|
40
|
+
_defineProperty(this, "boundaries", null);
|
41
41
|
/**
|
42
42
|
* Callback function.
|
43
43
|
*
|
44
44
|
* @private
|
45
45
|
* @type {Function}
|
46
46
|
*/
|
47
|
-
this
|
47
|
+
_defineProperty(this, "callback", null);
|
48
48
|
/**
|
49
49
|
* Flag indicates mouseDown/mouseUp.
|
50
50
|
*
|
51
51
|
* @private
|
52
52
|
* @type {boolean}
|
53
53
|
*/
|
54
|
-
this
|
54
|
+
_defineProperty(this, "listening", false);
|
55
|
+
}
|
56
|
+
static get PLUGIN_KEY() {
|
57
|
+
return PLUGIN_KEY;
|
58
|
+
}
|
59
|
+
static get PLUGIN_PRIORITY() {
|
60
|
+
return PLUGIN_PRIORITY;
|
55
61
|
}
|
56
|
-
|
57
62
|
/**
|
58
63
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
59
64
|
* hook and if it returns `true` then the {@link DragToScroll#enablePlugin} method is called.
|
@@ -71,8 +76,8 @@ export class DragToScroll extends BasePlugin {
|
|
71
76
|
if (this.enabled) {
|
72
77
|
return;
|
73
78
|
}
|
74
|
-
this.addHook('afterOnCellMouseDown', event => this.
|
75
|
-
this.addHook('afterOnCellCornerMouseDown', event => this.
|
79
|
+
this.addHook('afterOnCellMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
80
|
+
this.addHook('afterOnCellCornerMouseDown', event => _classPrivateMethodGet(this, _setupListening, _setupListening2).call(this, event));
|
76
81
|
this.registerEvents();
|
77
82
|
super.enablePlugin();
|
78
83
|
}
|
@@ -196,39 +201,6 @@ export class DragToScroll extends BasePlugin {
|
|
196
201
|
unregisterEvents() {
|
197
202
|
this.eventManager.clear();
|
198
203
|
}
|
199
|
-
|
200
|
-
/**
|
201
|
-
* On after on cell/cellCorner mouse down listener.
|
202
|
-
*
|
203
|
-
* @private
|
204
|
-
* @param {MouseEvent} event The mouse event object.
|
205
|
-
*/
|
206
|
-
setupListening(event) {
|
207
|
-
if (isRightClick(event)) {
|
208
|
-
return;
|
209
|
-
}
|
210
|
-
const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
|
211
|
-
|
212
|
-
if (scrollHandler === this.hot.rootWindow) {
|
213
|
-
// not much we can do currently
|
214
|
-
return;
|
215
|
-
}
|
216
|
-
this.setBoundaries(scrollHandler.getBoundingClientRect());
|
217
|
-
this.setCallback((scrollX, scrollY) => {
|
218
|
-
if (scrollX < 0) {
|
219
|
-
scrollHandler.scrollLeft -= 50;
|
220
|
-
} else if (scrollX > 0) {
|
221
|
-
scrollHandler.scrollLeft += 50;
|
222
|
-
}
|
223
|
-
if (scrollY < 0) {
|
224
|
-
scrollHandler.scrollTop -= 20;
|
225
|
-
} else if (scrollY > 0) {
|
226
|
-
scrollHandler.scrollTop += 20;
|
227
|
-
}
|
228
|
-
});
|
229
|
-
this.listen();
|
230
|
-
}
|
231
|
-
|
232
204
|
/**
|
233
205
|
* 'mouseMove' event callback.
|
234
206
|
*
|
@@ -248,4 +220,29 @@ export class DragToScroll extends BasePlugin {
|
|
248
220
|
destroy() {
|
249
221
|
super.destroy();
|
250
222
|
}
|
223
|
+
}
|
224
|
+
function _setupListening2(event) {
|
225
|
+
if (isRightClick(event)) {
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
const scrollHandler = this.hot.view._wt.wtTable.holder; // native scroll
|
229
|
+
|
230
|
+
if (scrollHandler === this.hot.rootWindow) {
|
231
|
+
// not much we can do currently
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
this.setBoundaries(scrollHandler.getBoundingClientRect());
|
235
|
+
this.setCallback((scrollX, scrollY) => {
|
236
|
+
if (scrollX < 0) {
|
237
|
+
scrollHandler.scrollLeft -= 50;
|
238
|
+
} else if (scrollX > 0) {
|
239
|
+
scrollHandler.scrollLeft += 50;
|
240
|
+
}
|
241
|
+
if (scrollY < 0) {
|
242
|
+
scrollHandler.scrollTop -= 20;
|
243
|
+
} else if (scrollY > 0) {
|
244
|
+
scrollHandler.scrollTop += 20;
|
245
|
+
}
|
246
|
+
});
|
247
|
+
this.listen();
|
251
248
|
}
|
@@ -7,7 +7,6 @@ var _array = require("../../helpers/array");
|
|
7
7
|
var _object = require("../../helpers/object");
|
8
8
|
var _commandExecutor = require("../contextMenu/commandExecutor");
|
9
9
|
var _utils = require("../contextMenu/utils");
|
10
|
-
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
11
10
|
var _element = require("../../helpers/dom/element");
|
12
11
|
var _itemsFactory = require("../contextMenu/itemsFactory");
|
13
12
|
var _menu = require("../contextMenu/menu");
|
@@ -18,6 +17,9 @@ var _a11y = require("../../helpers/a11y");
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
18
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
20
19
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
22
|
+
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
23
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
22
24
|
_pluginHooks.default.getSingleton().register('afterDropdownMenuDefaultOptions');
|
23
25
|
_pluginHooks.default.getSingleton().register('beforeDropdownMenuShow');
|
@@ -80,6 +82,12 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
80
82
|
* :::
|
81
83
|
*/
|
82
84
|
var _addCustomShortcuts = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onTableClick = /*#__PURE__*/new WeakSet();
|
86
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onSubMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
83
91
|
class DropdownMenu extends _base.BasePlugin {
|
84
92
|
static get PLUGIN_KEY() {
|
85
93
|
return PLUGIN_KEY;
|
@@ -99,45 +107,83 @@ class DropdownMenu extends _base.BasePlugin {
|
|
99
107
|
static get DEFAULT_ITEMS() {
|
100
108
|
return [_predefinedItems.COLUMN_LEFT, _predefinedItems.COLUMN_RIGHT, _predefinedItems.SEPARATOR, _predefinedItems.REMOVE_COLUMN, _predefinedItems.SEPARATOR, _predefinedItems.CLEAR_COLUMN, _predefinedItems.SEPARATOR, _predefinedItems.READ_ONLY, _predefinedItems.SEPARATOR, _predefinedItems.ALIGNMENT];
|
101
109
|
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Instance of {@link CommandExecutor}.
|
113
|
+
*
|
114
|
+
* @private
|
115
|
+
* @type {CommandExecutor}
|
116
|
+
*/
|
117
|
+
|
102
118
|
constructor(hotInstance) {
|
103
119
|
super(hotInstance);
|
120
|
+
|
121
|
+
// One listener for enable/disable functionality
|
104
122
|
/**
|
105
|
-
*
|
123
|
+
* On menu after close listener.
|
106
124
|
*
|
107
125
|
* @private
|
108
|
-
* @
|
126
|
+
* @fires Hooks#afterDropdownMenuHide
|
109
127
|
*/
|
128
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterClose);
|
110
129
|
/**
|
111
|
-
*
|
130
|
+
* Listener for the `afterSubmenuOpen` hook.
|
112
131
|
*
|
113
|
-
* @
|
132
|
+
* @private
|
133
|
+
* @param {Menu} subMenuInstance The opened sub menu instance.
|
114
134
|
*/
|
115
|
-
_classPrivateMethodInitSpec(this,
|
116
|
-
|
135
|
+
_classPrivateMethodInitSpec(this, _onSubMenuAfterOpen);
|
136
|
+
/**
|
137
|
+
* On menu after open listener.
|
138
|
+
*
|
139
|
+
* @private
|
140
|
+
* @fires Hooks#afterDropdownMenuShow
|
141
|
+
*/
|
142
|
+
_classPrivateMethodInitSpec(this, _onMenuAfterOpen);
|
143
|
+
/**
|
144
|
+
* On menu before open listener.
|
145
|
+
*
|
146
|
+
* @private
|
147
|
+
* @fires Hooks#beforeDropdownMenuShow
|
148
|
+
*/
|
149
|
+
_classPrivateMethodInitSpec(this, _onMenuBeforeOpen);
|
117
150
|
/**
|
118
|
-
*
|
151
|
+
* On after get column header listener.
|
119
152
|
*
|
120
153
|
* @private
|
121
|
-
* @
|
154
|
+
* @param {number} col Visual column index.
|
155
|
+
* @param {HTMLTableCellElement} TH Header's TH element.
|
122
156
|
*/
|
123
|
-
this
|
157
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
158
|
+
/**
|
159
|
+
* Table click listener.
|
160
|
+
*
|
161
|
+
* @private
|
162
|
+
* @param {Event} event The mouse event object.
|
163
|
+
*/
|
164
|
+
_classPrivateMethodInitSpec(this, _onTableClick);
|
165
|
+
/**
|
166
|
+
* Add custom shortcuts to the provided menu instance.
|
167
|
+
*
|
168
|
+
* @param {Menu} menuInstance The menu instance.
|
169
|
+
*/
|
170
|
+
_classPrivateMethodInitSpec(this, _addCustomShortcuts);
|
171
|
+
_defineProperty(this, "commandExecutor", new _commandExecutor.CommandExecutor(this.hot));
|
124
172
|
/**
|
125
173
|
* Instance of {@link ItemsFactory}.
|
126
174
|
*
|
127
175
|
* @private
|
128
176
|
* @type {ItemsFactory}
|
129
177
|
*/
|
130
|
-
this
|
178
|
+
_defineProperty(this, "itemsFactory", null);
|
131
179
|
/**
|
132
180
|
* Instance of {@link Menu}.
|
133
181
|
*
|
134
182
|
* @private
|
135
183
|
* @type {Menu}
|
136
184
|
*/
|
137
|
-
this
|
138
|
-
|
139
|
-
// One listener for enable/disable functionality
|
140
|
-
this.hot.addHook('afterGetColHeader', (col, TH) => this.onAfterGetColHeader(col, TH));
|
185
|
+
_defineProperty(this, "menu", null);
|
186
|
+
this.hot.addHook('afterGetColHeader', (col, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, col, TH));
|
141
187
|
}
|
142
188
|
|
143
189
|
/**
|
@@ -186,10 +232,10 @@ class DropdownMenu extends _base.BasePlugin {
|
|
186
232
|
});
|
187
233
|
this.hot.runHooks('beforeDropdownMenuSetItems', menuItems);
|
188
234
|
this.menu.setMenuItems(menuItems);
|
189
|
-
this.menu.addLocalHook('beforeOpen', () => this.
|
190
|
-
this.menu.addLocalHook('afterOpen', () => this.
|
191
|
-
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => this.
|
192
|
-
this.menu.addLocalHook('afterClose', () => this.
|
235
|
+
this.menu.addLocalHook('beforeOpen', () => _classPrivateMethodGet(this, _onMenuBeforeOpen, _onMenuBeforeOpen2).call(this));
|
236
|
+
this.menu.addLocalHook('afterOpen', () => _classPrivateMethodGet(this, _onMenuAfterOpen, _onMenuAfterOpen2).call(this));
|
237
|
+
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _classPrivateMethodGet(this, _onSubMenuAfterOpen, _onSubMenuAfterOpen2).call(this, subMenuInstance));
|
238
|
+
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
193
239
|
this.menu.addLocalHook('executeCommand', function () {
|
194
240
|
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
195
241
|
params[_key] = arguments[_key];
|
@@ -258,7 +304,8 @@ class DropdownMenu extends _base.BasePlugin {
|
|
258
304
|
callback,
|
259
305
|
runOnlyIf: () => {
|
260
306
|
var _this$hot$getSelected;
|
261
|
-
|
307
|
+
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
308
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader() && !this.menu.isOpened();
|
262
309
|
},
|
263
310
|
captureCtrl: true,
|
264
311
|
group: SHORTCUTS_GROUP
|
@@ -267,7 +314,8 @@ class DropdownMenu extends _base.BasePlugin {
|
|
267
314
|
callback,
|
268
315
|
runOnlyIf: () => {
|
269
316
|
var _this$hot$getSelected2;
|
270
|
-
|
317
|
+
const highlight = (_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight;
|
318
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isCell() && !this.menu.isOpened();
|
271
319
|
},
|
272
320
|
group: SHORTCUTS_GROUP
|
273
321
|
}]);
|
@@ -288,7 +336,7 @@ class DropdownMenu extends _base.BasePlugin {
|
|
288
336
|
* @private
|
289
337
|
*/
|
290
338
|
registerEvents() {
|
291
|
-
this.eventManager.addEventListener(this.hot.rootElement, 'click', event => this.
|
339
|
+
this.eventManager.addEventListener(this.hot.rootElement, 'click', event => _classPrivateMethodGet(this, _onTableClick, _onTableClick2).call(this, event));
|
292
340
|
}
|
293
341
|
|
294
342
|
/**
|
@@ -382,115 +430,6 @@ class DropdownMenu extends _base.BasePlugin {
|
|
382
430
|
}
|
383
431
|
}
|
384
432
|
}
|
385
|
-
/**
|
386
|
-
* Table click listener.
|
387
|
-
*
|
388
|
-
* @private
|
389
|
-
* @param {Event} event The mouse event object.
|
390
|
-
*/
|
391
|
-
onTableClick(event) {
|
392
|
-
event.stopPropagation();
|
393
|
-
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
394
|
-
const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
|
395
|
-
const rect = event.target.getBoundingClientRect();
|
396
|
-
this.open({
|
397
|
-
left: rect.left + offset.left,
|
398
|
-
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
399
|
-
}, {
|
400
|
-
left: rect.width
|
401
|
-
});
|
402
|
-
}
|
403
|
-
}
|
404
|
-
|
405
|
-
/**
|
406
|
-
* On after get column header listener.
|
407
|
-
*
|
408
|
-
* @private
|
409
|
-
* @param {number} col Visual column index.
|
410
|
-
* @param {HTMLTableCellElement} TH Header's TH element.
|
411
|
-
*/
|
412
|
-
onAfterGetColHeader(col, TH) {
|
413
|
-
// Corner or a higher-level header
|
414
|
-
const headerRow = TH.parentNode;
|
415
|
-
if (!headerRow) {
|
416
|
-
return;
|
417
|
-
}
|
418
|
-
const headerRowList = headerRow.parentNode.childNodes;
|
419
|
-
const level = Array.prototype.indexOf.call(headerRowList, headerRow);
|
420
|
-
if (col < 0 || level !== headerRowList.length - 1) {
|
421
|
-
return;
|
422
|
-
}
|
423
|
-
const existingButton = TH.querySelector(`.${BUTTON_CLASS_NAME}`);
|
424
|
-
|
425
|
-
// Plugin enabled and buttons already exists, return.
|
426
|
-
if (this.enabled && existingButton) {
|
427
|
-
return;
|
428
|
-
}
|
429
|
-
// Plugin disabled and buttons still exists, so remove them.
|
430
|
-
if (!this.enabled) {
|
431
|
-
if (existingButton) {
|
432
|
-
existingButton.parentNode.removeChild(existingButton);
|
433
|
-
}
|
434
|
-
return;
|
435
|
-
}
|
436
|
-
const button = this.hot.rootDocument.createElement('button');
|
437
|
-
button.className = BUTTON_CLASS_NAME;
|
438
|
-
button.type = 'button';
|
439
|
-
button.tabIndex = -1;
|
440
|
-
if (this.hot.getSettings().ariaTags) {
|
441
|
-
(0, _element.setAttribute)(button, [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_OPEN_MENU))]);
|
442
|
-
(0, _element.setAttribute)(TH, [(0, _a11y.A11Y_HASPOPUP)('menu')]);
|
443
|
-
}
|
444
|
-
|
445
|
-
// prevent page reload on button click
|
446
|
-
button.onclick = function () {
|
447
|
-
return false;
|
448
|
-
};
|
449
|
-
TH.firstChild.insertBefore(button, TH.firstChild.firstChild);
|
450
|
-
}
|
451
|
-
|
452
|
-
/**
|
453
|
-
* On menu before open listener.
|
454
|
-
*
|
455
|
-
* @private
|
456
|
-
* @fires Hooks#beforeDropdownMenuShow
|
457
|
-
*/
|
458
|
-
onMenuBeforeOpen() {
|
459
|
-
this.hot.runHooks('beforeDropdownMenuShow', this);
|
460
|
-
}
|
461
|
-
|
462
|
-
/**
|
463
|
-
* On menu after open listener.
|
464
|
-
*
|
465
|
-
* @private
|
466
|
-
* @fires Hooks#afterDropdownMenuShow
|
467
|
-
*/
|
468
|
-
onMenuAfterOpen() {
|
469
|
-
this.hot.runHooks('afterDropdownMenuShow', this);
|
470
|
-
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, this.menu);
|
471
|
-
}
|
472
|
-
|
473
|
-
/**
|
474
|
-
* Listener for the `afterSubmenuOpen` hook.
|
475
|
-
*
|
476
|
-
* @private
|
477
|
-
* @param {Menu} subMenuInstance The opened sub menu instance.
|
478
|
-
*/
|
479
|
-
onSubMenuAfterOpen(subMenuInstance) {
|
480
|
-
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, subMenuInstance);
|
481
|
-
}
|
482
|
-
|
483
|
-
/**
|
484
|
-
* On menu after close listener.
|
485
|
-
*
|
486
|
-
* @private
|
487
|
-
* @fires Hooks#afterDropdownMenuHide
|
488
|
-
*/
|
489
|
-
onMenuAfterClose() {
|
490
|
-
this.hot.listen();
|
491
|
-
this.hot.runHooks('afterDropdownMenuHide', this);
|
492
|
-
}
|
493
|
-
|
494
433
|
/**
|
495
434
|
* Destroys the plugin instance.
|
496
435
|
*/
|
@@ -509,6 +448,72 @@ function _addCustomShortcuts2(menuInstance) {
|
|
509
448
|
callback: () => false
|
510
449
|
}]);
|
511
450
|
}
|
451
|
+
function _onTableClick2(event) {
|
452
|
+
event.stopPropagation();
|
453
|
+
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
454
|
+
const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
|
455
|
+
const rect = event.target.getBoundingClientRect();
|
456
|
+
this.open({
|
457
|
+
left: rect.left + offset.left,
|
458
|
+
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
459
|
+
}, {
|
460
|
+
left: rect.width
|
461
|
+
});
|
462
|
+
}
|
463
|
+
}
|
464
|
+
function _onAfterGetColHeader2(col, TH) {
|
465
|
+
// Corner or a higher-level header
|
466
|
+
const headerRow = TH.parentNode;
|
467
|
+
if (!headerRow) {
|
468
|
+
return;
|
469
|
+
}
|
470
|
+
const headerRowList = headerRow.parentNode.childNodes;
|
471
|
+
const level = Array.prototype.indexOf.call(headerRowList, headerRow);
|
472
|
+
if (col < 0 || level !== headerRowList.length - 1) {
|
473
|
+
return;
|
474
|
+
}
|
475
|
+
const existingButton = TH.querySelector(`.${BUTTON_CLASS_NAME}`);
|
476
|
+
|
477
|
+
// Plugin enabled and buttons already exists, return.
|
478
|
+
if (this.enabled && existingButton) {
|
479
|
+
return;
|
480
|
+
}
|
481
|
+
// Plugin disabled and buttons still exists, so remove them.
|
482
|
+
if (!this.enabled) {
|
483
|
+
if (existingButton) {
|
484
|
+
existingButton.parentNode.removeChild(existingButton);
|
485
|
+
}
|
486
|
+
return;
|
487
|
+
}
|
488
|
+
const button = this.hot.rootDocument.createElement('button');
|
489
|
+
button.className = BUTTON_CLASS_NAME;
|
490
|
+
button.type = 'button';
|
491
|
+
button.tabIndex = -1;
|
492
|
+
if (this.hot.getSettings().ariaTags) {
|
493
|
+
(0, _element.setAttribute)(button, [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_OPEN_MENU))]);
|
494
|
+
(0, _element.setAttribute)(TH, [(0, _a11y.A11Y_HASPOPUP)('menu')]);
|
495
|
+
}
|
496
|
+
|
497
|
+
// prevent page reload on button click
|
498
|
+
button.onclick = function () {
|
499
|
+
return false;
|
500
|
+
};
|
501
|
+
TH.firstChild.insertBefore(button, TH.firstChild.firstChild);
|
502
|
+
}
|
503
|
+
function _onMenuBeforeOpen2() {
|
504
|
+
this.hot.runHooks('beforeDropdownMenuShow', this);
|
505
|
+
}
|
506
|
+
function _onMenuAfterOpen2() {
|
507
|
+
this.hot.runHooks('afterDropdownMenuShow', this);
|
508
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, this.menu);
|
509
|
+
}
|
510
|
+
function _onSubMenuAfterOpen2(subMenuInstance) {
|
511
|
+
_classPrivateMethodGet(this, _addCustomShortcuts, _addCustomShortcuts2).call(this, subMenuInstance);
|
512
|
+
}
|
513
|
+
function _onMenuAfterClose2() {
|
514
|
+
this.hot.listen();
|
515
|
+
this.hot.runHooks('afterDropdownMenuHide', this);
|
516
|
+
}
|
512
517
|
DropdownMenu.SEPARATOR = {
|
513
518
|
name: _predefinedItems.SEPARATOR
|
514
519
|
};
|