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