handsontable 0.0.0-next-53a190b-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/overlay/inlineStart.js +1 -15
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -16
- package/3rdparty/walkontable/src/overlay/top.js +0 -11
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -12
- package/3rdparty/walkontable/src/overlays.js +4 -46
- package/3rdparty/walkontable/src/overlays.mjs +4 -46
- 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 +9121 -9062
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +6573 -6967
- 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 -23
- package/helpers/dom/element.mjs +1 -21
- 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
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
5
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
6
6
|
var _base = require("../base");
|
7
7
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
8
8
|
var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
|
@@ -17,7 +17,6 @@ var _number = require("../../helpers/number");
|
|
17
17
|
var _utils = require("./utils");
|
18
18
|
var _element = require("../../helpers/dom/element");
|
19
19
|
var _browser = require("../../helpers/browser");
|
20
|
-
var _focusOrder2 = require("./focusOrder");
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22
21
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
23
22
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
@@ -25,9 +24,12 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
25
24
|
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; }
|
26
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
27
26
|
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); }
|
28
|
-
function _classPrivateFieldSet(
|
29
|
-
function
|
30
|
-
function
|
27
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
28
|
+
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; } }
|
29
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
30
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
31
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
32
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
31
33
|
_pluginHooks.default.getSingleton().register('beforeMergeCells');
|
32
34
|
_pluginHooks.default.getSingleton().register('afterMergeCells');
|
33
35
|
_pluginHooks.default.getSingleton().register('beforeUnmergeCells');
|
@@ -73,17 +75,207 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
73
75
|
* ```
|
74
76
|
* :::
|
75
77
|
*/
|
76
|
-
var
|
77
|
-
var
|
78
|
-
var
|
79
|
-
var
|
78
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
79
|
+
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
80
|
+
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
81
|
+
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
82
|
+
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
84
|
+
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
86
|
+
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
92
|
+
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
95
|
+
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
96
|
+
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
97
|
+
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
98
|
+
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
99
|
+
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
100
|
+
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
101
|
+
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
80
102
|
class MergeCells extends _base.BasePlugin {
|
81
103
|
constructor() {
|
82
104
|
super(...arguments);
|
105
|
+
/**
|
106
|
+
* Allows to prevent opening the editor while more than one merged cell is selected.
|
107
|
+
*
|
108
|
+
* @param {number} row Visual row index of the edited cell.
|
109
|
+
* @param {number} column Visual column index of the edited cell.
|
110
|
+
* @param {string | null} initialValue The initial editor value.
|
111
|
+
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
112
|
+
* @returns {boolean | undefined}
|
113
|
+
*/
|
114
|
+
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
115
|
+
/**
|
116
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
117
|
+
*
|
118
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
119
|
+
* all the cells in the table.
|
120
|
+
*/
|
121
|
+
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
122
|
+
/**
|
123
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
124
|
+
*
|
125
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
126
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
127
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
128
|
+
* endColumn]`.
|
129
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
130
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
131
|
+
* processed cell.
|
132
|
+
*/
|
133
|
+
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
134
|
+
/**
|
135
|
+
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
136
|
+
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
137
|
+
*
|
138
|
+
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
139
|
+
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
140
|
+
* down).
|
141
|
+
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
142
|
+
* down).
|
143
|
+
*/
|
144
|
+
_classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
|
145
|
+
/**
|
146
|
+
* `beforeDrawAreaBorders` hook callback.
|
147
|
+
*
|
148
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
149
|
+
* @param {string} className Class name for the area.
|
150
|
+
*/
|
151
|
+
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
152
|
+
/**
|
153
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
154
|
+
*
|
155
|
+
* @param {Array} changes The changes array.
|
156
|
+
* @param {string} source Determines the source of the change.
|
157
|
+
*/
|
158
|
+
_classPrivateMethodInitSpec(this, _onAfterChange);
|
159
|
+
/**
|
160
|
+
* `afterRemoveRow` hook callback.
|
161
|
+
*
|
162
|
+
* @param {number} row Row index.
|
163
|
+
* @param {number} count Number of removed rows.
|
164
|
+
*/
|
165
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
166
|
+
/**
|
167
|
+
* `afterCreateRow` hook callback.
|
168
|
+
*
|
169
|
+
* @param {number} row Row index.
|
170
|
+
* @param {number} count Number of created rows.
|
171
|
+
* @param {string} source Source of change.
|
172
|
+
*/
|
173
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
174
|
+
/**
|
175
|
+
* `afterRemoveCol` hook callback.
|
176
|
+
*
|
177
|
+
* @param {number} column Column index.
|
178
|
+
* @param {number} count Number of removed columns.
|
179
|
+
*/
|
180
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
181
|
+
/**
|
182
|
+
* `afterCreateCol` hook callback.
|
183
|
+
*
|
184
|
+
* @param {number} column Column index.
|
185
|
+
* @param {number} count Number of created columns.
|
186
|
+
*/
|
187
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
188
|
+
/**
|
189
|
+
* The `modifyAutofillRange` hook callback.
|
190
|
+
*
|
191
|
+
* @param {Array} drag The drag area coordinates.
|
192
|
+
* @param {Array} select The selection information.
|
193
|
+
* @returns {Array} The new drag area.
|
194
|
+
*/
|
195
|
+
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
196
|
+
/**
|
197
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
198
|
+
*
|
199
|
+
* @param {object} calc The column calculator object.
|
200
|
+
*/
|
201
|
+
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
202
|
+
/**
|
203
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
204
|
+
*
|
205
|
+
* @param {object} calc The row calculator object.
|
206
|
+
*/
|
207
|
+
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
208
|
+
/**
|
209
|
+
* The `afterGetCellMeta` hook callback.
|
210
|
+
*
|
211
|
+
* @param {number} row Row index.
|
212
|
+
* @param {number} col Column index.
|
213
|
+
* @param {object} cellProperties The cell properties object.
|
214
|
+
*/
|
215
|
+
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
216
|
+
/**
|
217
|
+
* `beforeSetRangeEnd` hook callback.
|
218
|
+
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
219
|
+
* merged cell.
|
220
|
+
*
|
221
|
+
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
222
|
+
*
|
223
|
+
* @param {object} coords Cell coords.
|
224
|
+
*/
|
225
|
+
_classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
|
226
|
+
/**
|
227
|
+
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
228
|
+
* A selection within merge area should be rewritten to the start of merge area.
|
229
|
+
*
|
230
|
+
* @param {object} coords Cell coords.
|
231
|
+
*/
|
232
|
+
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
233
|
+
/**
|
234
|
+
* `afterRenderer` hook callback.
|
235
|
+
*
|
236
|
+
* @param {HTMLElement} TD The cell to be modified.
|
237
|
+
* @param {number} row Row index.
|
238
|
+
* @param {number} col Visual column index.
|
239
|
+
*/
|
240
|
+
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
241
|
+
/**
|
242
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
243
|
+
*
|
244
|
+
* @param {object} defaultOptions The default context menu options.
|
245
|
+
*/
|
246
|
+
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
247
|
+
/**
|
248
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
249
|
+
*
|
250
|
+
* @param {number} row Row index.
|
251
|
+
* @param {number} column Visual column index.
|
252
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
253
|
+
*/
|
254
|
+
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
255
|
+
/**
|
256
|
+
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
257
|
+
*
|
258
|
+
* @param {object} delta The transformation delta.
|
259
|
+
*/
|
260
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
261
|
+
/**
|
262
|
+
* `modifyTransformStart` hook callback.
|
263
|
+
*
|
264
|
+
* @param {object} delta The transformation delta.
|
265
|
+
*/
|
266
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
267
|
+
/**
|
268
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
269
|
+
* hook callback.
|
270
|
+
*
|
271
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
272
|
+
* @returns {boolean}
|
273
|
+
*/
|
274
|
+
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
83
275
|
/**
|
84
276
|
* `afterInit` hook callback.
|
85
277
|
*/
|
86
|
-
_classPrivateMethodInitSpec(this,
|
278
|
+
_classPrivateMethodInitSpec(this, _onAfterInit);
|
87
279
|
/**
|
88
280
|
* A container for all the merged cells.
|
89
281
|
*
|
@@ -106,32 +298,12 @@ class MergeCells extends _base.BasePlugin {
|
|
106
298
|
*/
|
107
299
|
_defineProperty(this, "selectionCalculations", null);
|
108
300
|
/**
|
109
|
-
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
110
|
-
* focus is moved out of the merged cell.
|
111
|
-
*
|
112
301
|
* @type {CellCoords}
|
113
302
|
*/
|
114
|
-
_classPrivateFieldInitSpec(this,
|
115
|
-
|
116
|
-
|
117
|
-
*
|
118
|
-
* @type {{ row: number, col: number }}
|
119
|
-
*/
|
120
|
-
_classPrivateFieldInitSpec(this, _lastFocusDelta, {
|
121
|
-
row: 0,
|
122
|
-
col: 0
|
303
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, {
|
304
|
+
writable: true,
|
305
|
+
value: null
|
123
306
|
});
|
124
|
-
/**
|
125
|
-
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
126
|
-
* contains merged cells.
|
127
|
-
*
|
128
|
-
* @type {FocusOrder}
|
129
|
-
*/
|
130
|
-
_classPrivateFieldInitSpec(this, _focusOrder, new _focusOrder2.FocusOrder({
|
131
|
-
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
132
|
-
rowIndexMapper: this.hot.rowIndexMapper,
|
133
|
-
columnIndexMapper: this.hot.columnIndexMapper
|
134
|
-
}));
|
135
307
|
}
|
136
308
|
static get PLUGIN_KEY() {
|
137
309
|
return PLUGIN_KEY;
|
@@ -164,163 +336,145 @@ class MergeCells extends _base.BasePlugin {
|
|
164
336
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
165
337
|
args[_key] = arguments[_key];
|
166
338
|
}
|
167
|
-
return
|
339
|
+
return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
|
168
340
|
});
|
169
|
-
this.addHook('
|
341
|
+
this.addHook('modifyTransformStart', function () {
|
170
342
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
171
343
|
args[_key2] = arguments[_key2];
|
172
344
|
}
|
173
|
-
return
|
345
|
+
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
174
346
|
});
|
175
|
-
this.addHook('
|
347
|
+
this.addHook('afterModifyTransformStart', function () {
|
176
348
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
177
349
|
args[_key3] = arguments[_key3];
|
178
350
|
}
|
179
|
-
return
|
351
|
+
return _classPrivateMethodGet(_this, _onAfterModifyTransformStart, _onAfterModifyTransformStart2).call(_this, ...args);
|
180
352
|
});
|
181
353
|
this.addHook('modifyTransformEnd', function () {
|
182
354
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
183
355
|
args[_key4] = arguments[_key4];
|
184
356
|
}
|
185
|
-
return
|
357
|
+
return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
|
186
358
|
});
|
187
|
-
this.addHook('
|
359
|
+
this.addHook('modifyGetCellCoords', function () {
|
188
360
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
189
361
|
args[_key5] = arguments[_key5];
|
190
362
|
}
|
191
|
-
return
|
363
|
+
return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
|
192
364
|
});
|
193
365
|
this.addHook('beforeSetRangeStart', function () {
|
194
366
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
195
367
|
args[_key6] = arguments[_key6];
|
196
368
|
}
|
197
|
-
return
|
369
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
198
370
|
});
|
199
371
|
this.addHook('beforeSetRangeStartOnly', function () {
|
200
372
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
201
373
|
args[_key7] = arguments[_key7];
|
202
374
|
}
|
203
|
-
return
|
375
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
204
376
|
});
|
205
|
-
this.addHook('
|
377
|
+
this.addHook('beforeSetRangeEnd', function () {
|
206
378
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
207
379
|
args[_key8] = arguments[_key8];
|
208
380
|
}
|
209
|
-
return
|
381
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
|
210
382
|
});
|
211
|
-
this.addHook('
|
383
|
+
this.addHook('afterIsMultipleSelection', function () {
|
212
384
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
213
385
|
args[_key9] = arguments[_key9];
|
214
386
|
}
|
215
|
-
return
|
387
|
+
return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
|
216
388
|
});
|
217
|
-
this.addHook('
|
389
|
+
this.addHook('afterRenderer', function () {
|
218
390
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
219
391
|
args[_key10] = arguments[_key10];
|
220
392
|
}
|
221
|
-
return
|
393
|
+
return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
|
222
394
|
});
|
223
|
-
this.addHook('
|
395
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
224
396
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
225
397
|
args[_key11] = arguments[_key11];
|
226
398
|
}
|
227
|
-
return
|
399
|
+
return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
|
228
400
|
});
|
229
|
-
this.addHook('
|
401
|
+
this.addHook('afterGetCellMeta', function () {
|
230
402
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
231
403
|
args[_key12] = arguments[_key12];
|
232
404
|
}
|
233
|
-
return
|
405
|
+
return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
|
234
406
|
});
|
235
|
-
this.addHook('
|
407
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
236
408
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
237
409
|
args[_key13] = arguments[_key13];
|
238
410
|
}
|
239
|
-
return
|
411
|
+
return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
|
240
412
|
});
|
241
|
-
this.addHook('
|
413
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
242
414
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
243
415
|
args[_key14] = arguments[_key14];
|
244
416
|
}
|
245
|
-
return
|
417
|
+
return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
|
246
418
|
});
|
247
|
-
this.addHook('
|
419
|
+
this.addHook('modifyAutofillRange', function () {
|
248
420
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
249
421
|
args[_key15] = arguments[_key15];
|
250
422
|
}
|
251
|
-
return
|
423
|
+
return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
|
252
424
|
});
|
253
|
-
this.addHook('
|
425
|
+
this.addHook('afterCreateCol', function () {
|
254
426
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
255
427
|
args[_key16] = arguments[_key16];
|
256
428
|
}
|
257
|
-
return
|
429
|
+
return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
|
258
430
|
});
|
259
|
-
this.addHook('
|
431
|
+
this.addHook('afterRemoveCol', function () {
|
260
432
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
261
433
|
args[_key17] = arguments[_key17];
|
262
434
|
}
|
263
|
-
return
|
435
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
|
264
436
|
});
|
265
|
-
this.addHook('
|
437
|
+
this.addHook('afterCreateRow', function () {
|
266
438
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
267
439
|
args[_key18] = arguments[_key18];
|
268
440
|
}
|
269
|
-
return
|
441
|
+
return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
|
270
442
|
});
|
271
|
-
this.addHook('
|
443
|
+
this.addHook('afterRemoveRow', function () {
|
272
444
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
273
445
|
args[_key19] = arguments[_key19];
|
274
446
|
}
|
275
|
-
return
|
447
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
|
276
448
|
});
|
277
|
-
this.addHook('
|
449
|
+
this.addHook('afterChange', function () {
|
278
450
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
279
451
|
args[_key20] = arguments[_key20];
|
280
452
|
}
|
281
|
-
return
|
453
|
+
return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
|
282
454
|
});
|
283
|
-
this.addHook('
|
455
|
+
this.addHook('beforeDrawBorders', function () {
|
284
456
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
285
457
|
args[_key21] = arguments[_key21];
|
286
458
|
}
|
287
|
-
return
|
459
|
+
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
288
460
|
});
|
289
|
-
this.addHook('
|
461
|
+
this.addHook('afterDrawSelection', function () {
|
290
462
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
291
463
|
args[_key22] = arguments[_key22];
|
292
464
|
}
|
293
|
-
return
|
465
|
+
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
294
466
|
});
|
295
|
-
this.addHook('
|
467
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
296
468
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
297
469
|
args[_key23] = arguments[_key23];
|
298
470
|
}
|
299
|
-
return
|
471
|
+
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
300
472
|
});
|
301
|
-
this.addHook('
|
473
|
+
this.addHook('beforeBeginEditing', function () {
|
302
474
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
303
475
|
args[_key24] = arguments[_key24];
|
304
476
|
}
|
305
|
-
return
|
306
|
-
});
|
307
|
-
this.addHook('afterDrawSelection', function () {
|
308
|
-
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
309
|
-
args[_key25] = arguments[_key25];
|
310
|
-
}
|
311
|
-
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
312
|
-
});
|
313
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
314
|
-
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
315
|
-
args[_key26] = arguments[_key26];
|
316
|
-
}
|
317
|
-
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
318
|
-
});
|
319
|
-
this.addHook('beforeBeginEditing', function () {
|
320
|
-
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
321
|
-
args[_key27] = arguments[_key27];
|
322
|
-
}
|
323
|
-
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
477
|
+
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
324
478
|
});
|
325
479
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
326
480
|
if (source === 'MergeCells') {
|
@@ -464,9 +618,7 @@ class MergeCells extends _base.BasePlugin {
|
|
464
618
|
if (populatedNulls.length === 0) {
|
465
619
|
return;
|
466
620
|
}
|
467
|
-
|
468
|
-
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
469
|
-
this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);
|
621
|
+
this.hot.setDataAtCell(populatedNulls);
|
470
622
|
}
|
471
623
|
}
|
472
624
|
|
@@ -490,6 +642,25 @@ class MergeCells extends _base.BasePlugin {
|
|
490
642
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
491
643
|
}
|
492
644
|
|
645
|
+
/**
|
646
|
+
* Merge or unmerge, based on last selected range.
|
647
|
+
*
|
648
|
+
* @private
|
649
|
+
*/
|
650
|
+
toggleMergeOnSelection() {
|
651
|
+
const currentRange = this.hot.getSelectedRangeLast();
|
652
|
+
if (!currentRange) {
|
653
|
+
return;
|
654
|
+
}
|
655
|
+
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
656
|
+
const {
|
657
|
+
from,
|
658
|
+
to
|
659
|
+
} = currentRange;
|
660
|
+
this.toggleMerge(currentRange);
|
661
|
+
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
662
|
+
}
|
663
|
+
|
493
664
|
/**
|
494
665
|
* Merges the selection provided as a cell range.
|
495
666
|
*
|
@@ -578,7 +749,6 @@ class MergeCells extends _base.BasePlugin {
|
|
578
749
|
if (preventPopulation) {
|
579
750
|
populationInfo = [mergeParent.row, mergeParent.col, clearedData];
|
580
751
|
} else {
|
581
|
-
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
582
752
|
this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
|
583
753
|
}
|
584
754
|
if (!auto) {
|
@@ -701,15 +871,6 @@ class MergeCells extends _base.BasePlugin {
|
|
701
871
|
const gridContext = shortcutManager.getContext('grid');
|
702
872
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
703
873
|
}
|
704
|
-
|
705
|
-
/**
|
706
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
707
|
-
* hook callback.
|
708
|
-
*
|
709
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
710
|
-
* @returns {boolean}
|
711
|
-
*/
|
712
|
-
|
713
874
|
/**
|
714
875
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
715
876
|
*
|
@@ -766,13 +927,6 @@ class MergeCells extends _base.BasePlugin {
|
|
766
927
|
}
|
767
928
|
}
|
768
929
|
}
|
769
|
-
|
770
|
-
/**
|
771
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
772
|
-
*
|
773
|
-
* @param {object} calc The column calculator object.
|
774
|
-
*/
|
775
|
-
|
776
930
|
/**
|
777
931
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
778
932
|
*
|
@@ -867,218 +1021,96 @@ class MergeCells extends _base.BasePlugin {
|
|
867
1021
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
868
1022
|
return [renderableRow, renderableColumn];
|
869
1023
|
}
|
870
|
-
|
871
|
-
/**
|
872
|
-
* The `modifyAutofillRange` hook callback.
|
873
|
-
*
|
874
|
-
* @param {Array} drag The drag area coordinates.
|
875
|
-
* @param {Array} select The selection information.
|
876
|
-
* @returns {Array} The new drag area.
|
877
|
-
*/
|
878
1024
|
}
|
879
1025
|
exports.MergeCells = MergeCells;
|
880
|
-
function
|
1026
|
+
function _onAfterInit2() {
|
881
1027
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
882
1028
|
this.hot.render();
|
883
1029
|
}
|
884
|
-
function
|
1030
|
+
function _onAfterIsMultipleSelection2(isMultiple) {
|
885
1031
|
if (isMultiple) {
|
886
1032
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
887
1033
|
const selectionRange = this.hot.getSelectedRangeLast();
|
888
|
-
const topStartCoords = selectionRange.getTopStartCorner();
|
889
|
-
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
890
1034
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
891
|
-
if (
|
1035
|
+
if (selectionRange.from.row === mergedCells[group].row && selectionRange.from.col === mergedCells[group].col && selectionRange.to.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && selectionRange.to.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
|
892
1036
|
return false;
|
893
1037
|
}
|
894
1038
|
}
|
895
1039
|
}
|
896
1040
|
return isMultiple;
|
897
1041
|
}
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
function _onModifyTransformFocus(delta) {
|
904
|
-
_classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
|
905
|
-
_classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
|
906
|
-
}
|
907
|
-
/**
|
908
|
-
* `modifyTransformStart` hook callback.
|
909
|
-
*
|
910
|
-
* @param {object} delta The transformation delta.
|
911
|
-
*/
|
912
|
-
function _onModifyTransformStart(delta) {
|
913
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
914
|
-
const {
|
915
|
-
highlight
|
916
|
-
} = selectedRange;
|
917
|
-
const {
|
918
|
-
columnIndexMapper,
|
919
|
-
rowIndexMapper
|
920
|
-
} = this.hot;
|
921
|
-
if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
|
922
|
-
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
|
923
|
-
highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
|
924
|
-
}
|
925
|
-
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
|
926
|
-
highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
|
927
|
-
}
|
928
|
-
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
929
|
-
}
|
930
|
-
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
931
|
-
if (!mergedParent) {
|
932
|
-
return;
|
933
|
-
}
|
934
|
-
const visualColumnIndexStart = mergedParent.col;
|
935
|
-
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
936
|
-
if (delta.col < 0) {
|
937
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
938
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
939
|
-
if (notHiddenColumnIndex === null) {
|
940
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
941
|
-
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
942
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
943
|
-
} else {
|
944
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
945
|
-
}
|
946
|
-
} else if (delta.col > 0) {
|
947
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
948
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
949
|
-
if (notHiddenColumnIndex === null) {
|
950
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
951
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
952
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
953
|
-
} else {
|
954
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
955
|
-
}
|
956
|
-
}
|
957
|
-
const visualRowIndexStart = mergedParent.row;
|
958
|
-
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
959
|
-
if (delta.row < 0) {
|
960
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
961
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
962
|
-
if (notHiddenRowIndex === null) {
|
963
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
964
|
-
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
965
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
966
|
-
} else {
|
967
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
968
|
-
}
|
969
|
-
} else if (delta.row > 0) {
|
970
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
971
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
972
|
-
if (notHiddenRowIndex === null) {
|
973
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
974
|
-
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
975
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
976
|
-
} else {
|
977
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
978
|
-
}
|
979
|
-
}
|
980
|
-
}
|
981
|
-
/**
|
982
|
-
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
983
|
-
* The logic here handles "jumping over" merged merged cells, while selecting.
|
984
|
-
*
|
985
|
-
* @param {{ row: number, col: number }} delta The transformation delta.
|
986
|
-
*/
|
987
|
-
function _onModifyTransformEnd(delta) {
|
988
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
989
|
-
const cloneRange = selectedRange.clone();
|
990
|
-
const {
|
991
|
-
to
|
992
|
-
} = selectedRange;
|
993
|
-
const {
|
994
|
-
columnIndexMapper,
|
995
|
-
rowIndexMapper
|
996
|
-
} = this.hot;
|
997
|
-
const expandCloneRange = (row, col) => {
|
998
|
-
cloneRange.expand(this.hot._createCellCoords(row, col));
|
999
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1000
|
-
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1001
|
-
}
|
1042
|
+
function _onModifyTransformStart2(delta) {
|
1043
|
+
const currentlySelectedRange = this.hot.getSelectedRangeLast();
|
1044
|
+
let newDelta = {
|
1045
|
+
row: delta.row,
|
1046
|
+
col: delta.col
|
1002
1047
|
};
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
}
|
1009
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1010
|
-
if (notHiddenColumnIndex !== null) {
|
1011
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1012
|
-
}
|
1013
|
-
} else if (delta.col > 0) {
|
1014
|
-
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1015
|
-
expandCloneRange(to.row, nextColumn);
|
1016
|
-
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1017
|
-
nextColumn = cloneRange.getBottomEndCorner().col;
|
1018
|
-
}
|
1019
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1020
|
-
if (notHiddenColumnIndex !== null) {
|
1021
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1022
|
-
}
|
1048
|
+
let nextPosition = null;
|
1049
|
+
const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
|
1050
|
+
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
1051
|
+
if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
|
1052
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
|
1023
1053
|
}
|
1024
|
-
if (
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
if (notHiddenRowIndex !== null) {
|
1032
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1054
|
+
if (mergedParent) {
|
1055
|
+
// only merge selected
|
1056
|
+
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
1057
|
+
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
1058
|
+
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
1059
|
+
if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
|
1060
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1033
1061
|
}
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1062
|
+
newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
|
1063
|
+
newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
|
1064
|
+
if (delta.row > 0) {
|
1065
|
+
// moving down
|
1066
|
+
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
1067
|
+
} else if (delta.row < 0) {
|
1068
|
+
// moving up
|
1069
|
+
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1039
1070
|
}
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1071
|
+
if (delta.col > 0) {
|
1072
|
+
// moving right
|
1073
|
+
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
1074
|
+
} else if (delta.col < 0) {
|
1075
|
+
// moving left
|
1076
|
+
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
1043
1077
|
}
|
1044
1078
|
}
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1056
|
-
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1057
|
-
return;
|
1058
|
-
}
|
1059
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1060
|
-
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1079
|
+
nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
|
1080
|
+
const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
|
1081
|
+
if (nextPositionMergedCell) {
|
1082
|
+
// skipping the invisible cells in the merge range
|
1083
|
+
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
1084
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, nextPosition);
|
1085
|
+
newDelta = {
|
1086
|
+
row: firstRenderableCoords.row - currentPosition.row,
|
1087
|
+
col: firstRenderableCoords.col - currentPosition.col
|
1088
|
+
};
|
1061
1089
|
}
|
1062
|
-
|
1063
|
-
|
1064
|
-
// extended in that way that it covers all overlapped merge cells.
|
1065
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1066
|
-
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1090
|
+
if (newDelta.row !== 0) {
|
1091
|
+
delta.row = newDelta.row;
|
1067
1092
|
}
|
1068
|
-
|
1069
|
-
|
1070
|
-
if (mergedParent) {
|
1071
|
-
highlight.assign(mergedParent);
|
1093
|
+
if (newDelta.col !== 0) {
|
1094
|
+
delta.col = newDelta.col;
|
1072
1095
|
}
|
1073
1096
|
}
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1097
|
+
function _onModifyTransformEnd2(delta) {
|
1098
|
+
const currentSelectionRange = this.hot.getSelectedRangeLast();
|
1099
|
+
const newDelta = (0, _object.clone)(delta);
|
1100
|
+
const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
|
1101
|
+
let tempDelta = (0, _object.clone)(newDelta);
|
1102
|
+
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
|
1103
|
+
do {
|
1104
|
+
tempDelta = (0, _object.clone)(newDelta);
|
1105
|
+
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
1106
|
+
(0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
|
1107
|
+
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
1108
|
+
});
|
1109
|
+
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
1110
|
+
delta.row = newDelta.row;
|
1111
|
+
delta.col = newDelta.col;
|
1112
|
+
}
|
1113
|
+
function _onModifyGetCellCoords2(row, column) {
|
1082
1114
|
if (row < 0 || column < 0) {
|
1083
1115
|
return;
|
1084
1116
|
}
|
@@ -1098,24 +1130,12 @@ function _onModifyGetCellCoords(row, column) {
|
|
1098
1130
|
// Most bottom-right merged cell coords.
|
1099
1131
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1100
1132
|
}
|
1101
|
-
|
1102
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
1103
|
-
*
|
1104
|
-
* @param {object} defaultOptions The default context menu options.
|
1105
|
-
*/
|
1106
|
-
function _addMergeActionsToContextMenu(defaultOptions) {
|
1133
|
+
function _addMergeActionsToContextMenu2(defaultOptions) {
|
1107
1134
|
defaultOptions.items.push({
|
1108
1135
|
name: '---------'
|
1109
1136
|
}, (0, _toggleMerge.default)(this));
|
1110
1137
|
}
|
1111
|
-
|
1112
|
-
* `afterRenderer` hook callback.
|
1113
|
-
*
|
1114
|
-
* @param {HTMLElement} TD The cell to be modified.
|
1115
|
-
* @param {number} row Row index.
|
1116
|
-
* @param {number} col Visual column index.
|
1117
|
-
*/
|
1118
|
-
function _onAfterRenderer(TD, row, col) {
|
1138
|
+
function _onAfterRenderer2(TD, row, col) {
|
1119
1139
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1120
1140
|
// We shouldn't override data in the collection.
|
1121
1141
|
const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
|
@@ -1147,114 +1167,39 @@ function _onAfterRenderer(TD, row, col) {
|
|
1147
1167
|
}
|
1148
1168
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1149
1169
|
}
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
1158
|
-
* computations.
|
1159
|
-
*/
|
1160
|
-
function _onBeforeSelectionFocusSet() {
|
1161
|
-
if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
|
1162
|
-
return;
|
1163
|
-
}
|
1164
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1165
|
-
const verticalDir = selectedRange.getVerticalDirection();
|
1166
|
-
const horizontalDir = selectedRange.getHorizontalDirection();
|
1167
|
-
const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
|
1168
|
-
_classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
|
1169
|
-
if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1170
|
-
_classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
|
1171
|
-
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1172
|
-
_classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
|
1173
|
-
}
|
1174
|
-
}
|
1175
|
-
/**
|
1176
|
-
* Changes the focus selection to the next or previous cell or merged cell position.
|
1177
|
-
*
|
1178
|
-
* @param {number} row The visual row index.
|
1179
|
-
* @param {number} column The visual column index.
|
1180
|
-
*/
|
1181
|
-
function _onAfterSelectionFocusSet(row, column) {
|
1182
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1183
|
-
const {
|
1184
|
-
columnIndexMapper,
|
1185
|
-
rowIndexMapper
|
1186
|
-
} = this.hot;
|
1187
|
-
let notHiddenRowIndex = null;
|
1188
|
-
let notHiddenColumnIndex = null;
|
1189
|
-
if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
|
1190
|
-
const {
|
1191
|
-
rowEnd,
|
1192
|
-
colEnd
|
1193
|
-
} = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
|
1194
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1195
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1196
|
-
} else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1197
|
-
const {
|
1198
|
-
rowStart,
|
1199
|
-
colStart
|
1200
|
-
} = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
|
1201
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1202
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1203
|
-
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1204
|
-
const {
|
1205
|
-
rowEnd,
|
1206
|
-
colEnd
|
1207
|
-
} = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
|
1208
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1209
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1210
|
-
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
|
1211
|
-
const {
|
1212
|
-
rowStart,
|
1213
|
-
colStart
|
1214
|
-
} = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
|
1215
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1216
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1217
|
-
}
|
1218
|
-
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1219
|
-
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1170
|
+
function _onBeforeSetRangeStart2(coords) {
|
1171
|
+
// TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
|
1172
|
+
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
1173
|
+
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
1174
|
+
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
1175
|
+
// and what was idea for flipping direction inside `expandByRange` method.
|
1176
|
+
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1220
1177
|
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1221
|
-
|
1222
|
-
row = coords.row;
|
1223
|
-
column = coords.col;
|
1224
|
-
if (mergeParent) {
|
1225
|
-
selectedRange.highlight.assign({
|
1226
|
-
row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
|
1227
|
-
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
|
1228
|
-
});
|
1229
|
-
} else {
|
1230
|
-
selectedRange.highlight.assign(coords);
|
1231
|
-
}
|
1232
|
-
focusHighlight.clear();
|
1233
|
-
focusHighlight.add(coords).commit();
|
1178
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1234
1179
|
}
|
1235
|
-
_classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
|
1236
|
-
_classPrivateFieldSet(_lastFocusDelta, this, {
|
1237
|
-
row: 0,
|
1238
|
-
col: 0
|
1239
|
-
});
|
1240
1180
|
}
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
if (
|
1247
|
-
|
1181
|
+
function _onBeforeSetRangeEnd2(coords) {
|
1182
|
+
const selRange = this.hot.getSelectedRangeLast();
|
1183
|
+
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
1184
|
+
selRange.to = coords;
|
1185
|
+
let rangeExpanded = false;
|
1186
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1187
|
+
return;
|
1248
1188
|
}
|
1189
|
+
do {
|
1190
|
+
rangeExpanded = false;
|
1191
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1192
|
+
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1193
|
+
const mergedCellRange = cellInfo.getRange();
|
1194
|
+
if (selRange.expandByRange(mergedCellRange)) {
|
1195
|
+
coords.row = selRange.to.row;
|
1196
|
+
coords.col = selRange.to.col;
|
1197
|
+
rangeExpanded = true;
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
} while (rangeExpanded);
|
1249
1201
|
}
|
1250
|
-
|
1251
|
-
* The `afterGetCellMeta` hook callback.
|
1252
|
-
*
|
1253
|
-
* @param {number} row Row index.
|
1254
|
-
* @param {number} col Column index.
|
1255
|
-
* @param {object} cellProperties The cell properties object.
|
1256
|
-
*/
|
1257
|
-
function _onAfterGetCellMeta(row, col, cellProperties) {
|
1202
|
+
function _onAfterGetCellMeta2(row, col, cellProperties) {
|
1258
1203
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1259
1204
|
if (mergeParent) {
|
1260
1205
|
if (mergeParent.row !== row || mergeParent.col !== col) {
|
@@ -1265,22 +1210,17 @@ function _onAfterGetCellMeta(row, col, cellProperties) {
|
|
1265
1210
|
}
|
1266
1211
|
}
|
1267
1212
|
}
|
1268
|
-
|
1269
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
1270
|
-
*
|
1271
|
-
* @param {object} calc The row calculator object.
|
1272
|
-
*/
|
1273
|
-
function _onAfterViewportRowCalculatorOverride(calc) {
|
1213
|
+
function _onAfterViewportRowCalculatorOverride2(calc) {
|
1274
1214
|
const nrOfColumns = this.hot.countCols();
|
1275
1215
|
this.modifyViewportRowStart(calc, nrOfColumns);
|
1276
1216
|
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1277
1217
|
}
|
1278
|
-
function
|
1218
|
+
function _onAfterViewportColumnCalculatorOverride2(calc) {
|
1279
1219
|
const nrOfRows = this.hot.countRows();
|
1280
1220
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1281
1221
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1282
1222
|
}
|
1283
|
-
function
|
1223
|
+
function _onModifyAutofillRange2(drag, select) {
|
1284
1224
|
this.autofillCalculations.correctSelectionAreaSize(select);
|
1285
1225
|
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1286
1226
|
let dragArea = drag;
|
@@ -1304,65 +1244,28 @@ function _onModifyAutofillRange(drag, select) {
|
|
1304
1244
|
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1305
1245
|
return dragArea;
|
1306
1246
|
}
|
1307
|
-
|
1308
|
-
* `afterCreateCol` hook callback.
|
1309
|
-
*
|
1310
|
-
* @param {number} column Column index.
|
1311
|
-
* @param {number} count Number of created columns.
|
1312
|
-
*/
|
1313
|
-
function _onAfterCreateCol(column, count) {
|
1247
|
+
function _onAfterCreateCol2(column, count) {
|
1314
1248
|
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1315
1249
|
}
|
1316
|
-
|
1317
|
-
* `afterRemoveCol` hook callback.
|
1318
|
-
*
|
1319
|
-
* @param {number} column Column index.
|
1320
|
-
* @param {number} count Number of removed columns.
|
1321
|
-
*/
|
1322
|
-
function _onAfterRemoveCol(column, count) {
|
1250
|
+
function _onAfterRemoveCol2(column, count) {
|
1323
1251
|
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1324
1252
|
}
|
1325
|
-
|
1326
|
-
* `afterCreateRow` hook callback.
|
1327
|
-
*
|
1328
|
-
* @param {number} row Row index.
|
1329
|
-
* @param {number} count Number of created rows.
|
1330
|
-
* @param {string} source Source of change.
|
1331
|
-
*/
|
1332
|
-
function _onAfterCreateRow(row, count, source) {
|
1253
|
+
function _onAfterCreateRow2(row, count, source) {
|
1333
1254
|
if (source === 'auto') {
|
1334
1255
|
return;
|
1335
1256
|
}
|
1336
1257
|
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1337
1258
|
}
|
1338
|
-
|
1339
|
-
* `afterRemoveRow` hook callback.
|
1340
|
-
*
|
1341
|
-
* @param {number} row Row index.
|
1342
|
-
* @param {number} count Number of removed rows.
|
1343
|
-
*/
|
1344
|
-
function _onAfterRemoveRow(row, count) {
|
1259
|
+
function _onAfterRemoveRow2(row, count) {
|
1345
1260
|
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1346
1261
|
}
|
1347
|
-
|
1348
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1349
|
-
*
|
1350
|
-
* @param {Array} changes The changes array.
|
1351
|
-
* @param {string} source Determines the source of the change.
|
1352
|
-
*/
|
1353
|
-
function _onAfterChange(changes, source) {
|
1262
|
+
function _onAfterChange2(changes, source) {
|
1354
1263
|
if (source !== 'Autofill.fill') {
|
1355
1264
|
return;
|
1356
1265
|
}
|
1357
1266
|
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1358
1267
|
}
|
1359
|
-
|
1360
|
-
* `beforeDrawAreaBorders` hook callback.
|
1361
|
-
*
|
1362
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
1363
|
-
* @param {string} className Class name for the area.
|
1364
|
-
*/
|
1365
|
-
function _onBeforeDrawAreaBorders(corners, className) {
|
1268
|
+
function _onBeforeDrawAreaBorders2(corners, className) {
|
1366
1269
|
if (className && className === 'area') {
|
1367
1270
|
const selectedRange = this.hot.getSelectedRangeLast();
|
1368
1271
|
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
@@ -1374,43 +1277,38 @@ function _onBeforeDrawAreaBorders(corners, className) {
|
|
1374
1277
|
});
|
1375
1278
|
}
|
1376
1279
|
}
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1280
|
+
function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
|
1281
|
+
if (!this.enabled) {
|
1282
|
+
return;
|
1283
|
+
}
|
1284
|
+
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1285
|
+
if (!mergedCellAtCoords) {
|
1286
|
+
return;
|
1287
|
+
}
|
1288
|
+
const goingDown = rowTransformDir > 0;
|
1289
|
+
const goingUp = rowTransformDir < 0;
|
1290
|
+
const goingLeft = colTransformDir < 0;
|
1291
|
+
const goingRight = colTransformDir > 0;
|
1292
|
+
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1293
|
+
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1294
|
+
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1295
|
+
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1296
|
+
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1297
|
+
coords.row = mergedCellAtCoords.row;
|
1298
|
+
coords.col = mergedCellAtCoords.col;
|
1299
|
+
}
|
1300
|
+
}
|
1301
|
+
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1389
1302
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1390
1303
|
if (!cornersOfSelection) {
|
1391
1304
|
return;
|
1392
1305
|
}
|
1393
1306
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1394
1307
|
}
|
1395
|
-
|
1396
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1397
|
-
*
|
1398
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1399
|
-
* all the cells in the table.
|
1400
|
-
*/
|
1401
|
-
function _onBeforeRemoveCellClassNames() {
|
1308
|
+
function _onBeforeRemoveCellClassNames2() {
|
1402
1309
|
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1403
1310
|
}
|
1404
|
-
|
1405
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
1406
|
-
*
|
1407
|
-
* @param {number} row Visual row index of the edited cell.
|
1408
|
-
* @param {number} column Visual column index of the edited cell.
|
1409
|
-
* @param {string | null} initialValue The initial editor value.
|
1410
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
1411
|
-
* @returns {boolean | undefined}
|
1412
|
-
*/
|
1413
|
-
function _onBeforeBeginEditing(row, column, initialValue, event) {
|
1311
|
+
function _onBeforeBeginEditing2(row, column, initialValue, event) {
|
1414
1312
|
if (!(event instanceof MouseEvent)) {
|
1415
1313
|
return;
|
1416
1314
|
}
|