handsontable 0.0.0-next-2becb78-20240313 → 0.0.0-next-bff5041-20240315
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 +12 -17
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +12 -17
- package/3rdparty/walkontable/src/calculator/viewportRows.js +10 -15
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +10 -15
- package/3rdparty/walkontable/src/cell/coords.js +12 -17
- package/3rdparty/walkontable/src/cell/coords.mjs +12 -17
- package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
- package/3rdparty/walkontable/src/cell/range.js +23 -45
- package/3rdparty/walkontable/src/cell/range.mjs +23 -45
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +72 -104
- package/3rdparty/walkontable/src/event.mjs +72 -104
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/scroll.js +15 -17
- package/3rdparty/walkontable/src/scroll.mjs +15 -17
- package/3rdparty/walkontable/src/selection/manager.js +48 -69
- package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
- package/3rdparty/walkontable/src/selection/scanner.js +33 -42
- package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
- package/3rdparty/walkontable/src/utils/columnStretching.js +27 -44
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +27 -44
- 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 -82
- package/core.mjs +22 -82
- 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/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7619 -10404
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +277 -277
- package/dist/handsontable.js +5525 -7857
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +33 -33
- 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 +21 -27
- package/editorManager.mjs +21 -27
- package/editors/autocompleteEditor/autocompleteEditor.js +6 -10
- package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -10
- package/eventManager.js +1 -1
- package/eventManager.mjs +1 -1
- package/focusManager.js +58 -82
- package/focusManager.mjs +58 -82
- 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 +10 -0
- package/package.json +2 -1
- package/pluginHooks.d.ts +0 -4
- package/pluginHooks.js +2 -44
- package/pluginHooks.mjs +2 -44
- package/plugins/autoColumnSize/autoColumnSize.js +49 -65
- package/plugins/autoColumnSize/autoColumnSize.mjs +49 -65
- package/plugins/autoRowSize/autoRowSize.js +28 -34
- package/plugins/autoRowSize/autoRowSize.mjs +28 -34
- package/plugins/autofill/autofill.js +30 -38
- package/plugins/autofill/autofill.mjs +30 -38
- package/plugins/base/base.js +12 -17
- package/plugins/base/base.mjs +12 -17
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
- package/plugins/collapsibleColumns/collapsibleColumns.js +36 -54
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +36 -54
- package/plugins/columnSorting/columnSorting.js +40 -46
- package/plugins/columnSorting/columnSorting.mjs +40 -46
- package/plugins/columnSummary/columnSummary.js +22 -26
- package/plugins/columnSummary/columnSummary.mjs +22 -26
- package/plugins/comments/comments.js +116 -158
- package/plugins/comments/comments.mjs +116 -158
- package/plugins/contextMenu/contextMenu.js +20 -26
- package/plugins/contextMenu/contextMenu.mjs +20 -26
- 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 +13 -21
- package/plugins/contextMenu/menu/menu.mjs +13 -21
- package/plugins/contextMenu/menu/positioner.js +41 -58
- package/plugins/contextMenu/menu/positioner.mjs +41 -58
- package/plugins/copyPaste/copyPaste.js +113 -154
- package/plugins/copyPaste/copyPaste.mjs +113 -154
- package/plugins/copyPaste/copyableRanges.js +43 -66
- package/plugins/copyPaste/copyableRanges.mjs +43 -66
- package/plugins/customBorders/customBorders.js +11 -13
- package/plugins/customBorders/customBorders.mjs +11 -13
- package/plugins/dragToScroll/dragToScroll.js +6 -6
- package/plugins/dragToScroll/dragToScroll.mjs +6 -6
- package/plugins/dropdownMenu/dropdownMenu.js +78 -100
- package/plugins/dropdownMenu/dropdownMenu.mjs +78 -100
- 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 +13 -15
- package/plugins/filters/component/condition.mjs +13 -15
- package/plugins/filters/component/operators.js +6 -6
- package/plugins/filters/component/operators.mjs +6 -6
- package/plugins/filters/component/value.js +24 -28
- package/plugins/filters/component/value.mjs +24 -28
- package/plugins/filters/conditionUpdateObserver.js +22 -24
- package/plugins/filters/conditionUpdateObserver.mjs +22 -24
- package/plugins/filters/dataFilter.js +1 -1
- package/plugins/filters/dataFilter.mjs +1 -1
- package/plugins/filters/filters.js +81 -95
- package/plugins/filters/filters.mjs +81 -95
- package/plugins/filters/ui/input.js +13 -19
- package/plugins/filters/ui/input.mjs +13 -19
- package/plugins/filters/ui/link.js +8 -13
- package/plugins/filters/ui/link.mjs +8 -13
- package/plugins/filters/ui/multipleSelect.js +85 -112
- package/plugins/filters/ui/multipleSelect.mjs +85 -112
- package/plugins/filters/ui/radioInput.js +12 -20
- package/plugins/filters/ui/radioInput.mjs +12 -20
- package/plugins/filters/ui/select.js +50 -72
- package/plugins/filters/ui/select.mjs +49 -71
- package/plugins/formulas/formulas.js +268 -326
- package/plugins/formulas/formulas.mjs +269 -327
- package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
- package/plugins/formulas/indexSyncer/index.js +25 -48
- package/plugins/formulas/indexSyncer/index.mjs +25 -48
- package/plugins/hiddenColumns/hiddenColumns.js +64 -83
- package/plugins/hiddenColumns/hiddenColumns.mjs +64 -83
- package/plugins/hiddenRows/hiddenRows.js +63 -82
- package/plugins/hiddenRows/hiddenRows.mjs +63 -82
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
- package/plugins/manualColumnMove/manualColumnMove.js +126 -170
- package/plugins/manualColumnMove/manualColumnMove.mjs +126 -170
- package/plugins/manualColumnResize/manualColumnResize.js +169 -230
- package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
- package/plugins/manualRowMove/manualRowMove.js +99 -128
- package/plugins/manualRowMove/manualRowMove.mjs +99 -128
- package/plugins/manualRowResize/manualRowResize.js +150 -209
- package/plugins/manualRowResize/manualRowResize.mjs +150 -209
- 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 +353 -593
- package/plugins/mergeCells/mergeCells.mjs +353 -593
- package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +204 -254
- package/plugins/nestedHeaders/nestedHeaders.mjs +205 -255
- package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
- package/plugins/nestedHeaders/stateManager/index.js +30 -41
- package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
- package/plugins/nestedRows/data/dataManager.js +1 -1
- package/plugins/nestedRows/data/dataManager.mjs +1 -1
- package/plugins/nestedRows/nestedRows.js +138 -179
- package/plugins/nestedRows/nestedRows.mjs +139 -180
- package/plugins/nestedRows/ui/contextMenu.js +11 -15
- package/plugins/nestedRows/ui/contextMenu.mjs +10 -14
- 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 +15 -19
- package/plugins/touchScroll/touchScroll.mjs +16 -20
- 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 +2 -16
- package/selection/highlight/visualSelection.mjs +2 -16
- package/selection/selection.js +60 -255
- package/selection/selection.mjs +59 -254
- package/selection/transformation.js +101 -175
- package/selection/transformation.mjs +101 -175
- 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 +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/tableView.js +52 -98
- package/tableView.mjs +52 -98
- package/translations/changesObservable/observable.js +21 -38
- package/translations/changesObservable/observable.mjs +21 -38
- package/translations/changesObservable/observer.js +7 -12
- package/translations/changesObservable/observer.mjs +6 -11
- 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 +26 -44
- package/utils/interval.mjs +26 -44
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
- package/plugins/mergeCells/focusOrder.js +0 -327
- package/plugins/mergeCells/focusOrder.mjs +0 -322
@@ -1,17 +1,14 @@
|
|
1
|
-
import "core-js/modules/es.array.push.js";
|
2
1
|
import "core-js/modules/es.error.cause.js";
|
2
|
+
import "core-js/modules/es.array.push.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
|
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; }
|
9
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
10
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
11
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
15
12
|
import { BasePlugin } from "../base/index.mjs";
|
16
13
|
import Hooks from "../../pluginHooks.mjs";
|
17
14
|
import MergedCellsCollection from "./cellsCollection.mjs";
|
@@ -26,7 +23,6 @@ import { rangeEach } from "../../helpers/number.mjs";
|
|
26
23
|
import { applySpanProperties } from "./utils.mjs";
|
27
24
|
import { getStyle } from "../../helpers/dom/element.mjs";
|
28
25
|
import { isChrome } from "../../helpers/browser.mjs";
|
29
|
-
import { FocusOrder } from "./focusOrder.mjs";
|
30
26
|
Hooks.getSingleton().register('beforeMergeCells');
|
31
27
|
Hooks.getSingleton().register('afterMergeCells');
|
32
28
|
Hooks.getSingleton().register('beforeUnmergeCells');
|
@@ -72,225 +68,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
72
68
|
* ```
|
73
69
|
* :::
|
74
70
|
*/
|
75
|
-
var
|
76
|
-
var
|
77
|
-
var _focusOrder = /*#__PURE__*/new WeakMap();
|
78
|
-
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
79
|
-
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
80
|
-
var _onModifyTransformFocus = /*#__PURE__*/new WeakSet();
|
81
|
-
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
82
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onModifyTransformEndRestDelta = /*#__PURE__*/new WeakSet();
|
84
|
-
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
85
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
86
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
89
|
-
var _onBeforeSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
90
|
-
var _onAfterSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
99
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
100
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
101
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
102
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
103
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
104
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
71
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
72
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
105
73
|
export class MergeCells extends BasePlugin {
|
106
74
|
constructor() {
|
107
75
|
super(...arguments);
|
108
|
-
/**
|
109
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
110
|
-
*
|
111
|
-
* @param {number} row Visual row index of the edited cell.
|
112
|
-
* @param {number} column Visual column index of the edited cell.
|
113
|
-
* @param {string | null} initialValue The initial editor value.
|
114
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
115
|
-
* @returns {boolean | undefined}
|
116
|
-
*/
|
117
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
118
|
-
/**
|
119
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
120
|
-
*
|
121
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
122
|
-
* all the cells in the table.
|
123
|
-
*/
|
124
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
125
|
-
/**
|
126
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
127
|
-
*
|
128
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
129
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
130
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
131
|
-
* endColumn]`.
|
132
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
133
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
134
|
-
* processed cell.
|
135
|
-
*/
|
136
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
137
|
-
/**
|
138
|
-
* `beforeDrawAreaBorders` hook callback.
|
139
|
-
*
|
140
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
141
|
-
* @param {string} className Class name for the area.
|
142
|
-
*/
|
143
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
144
|
-
/**
|
145
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
146
|
-
*
|
147
|
-
* @param {Array} changes The changes array.
|
148
|
-
* @param {string} source Determines the source of the change.
|
149
|
-
*/
|
150
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
151
|
-
/**
|
152
|
-
* `afterRemoveRow` hook callback.
|
153
|
-
*
|
154
|
-
* @param {number} row Row index.
|
155
|
-
* @param {number} count Number of removed rows.
|
156
|
-
*/
|
157
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
158
|
-
/**
|
159
|
-
* `afterCreateRow` hook callback.
|
160
|
-
*
|
161
|
-
* @param {number} row Row index.
|
162
|
-
* @param {number} count Number of created rows.
|
163
|
-
* @param {string} source Source of change.
|
164
|
-
*/
|
165
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
166
|
-
/**
|
167
|
-
* `afterRemoveCol` hook callback.
|
168
|
-
*
|
169
|
-
* @param {number} column Column index.
|
170
|
-
* @param {number} count Number of removed columns.
|
171
|
-
*/
|
172
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
173
|
-
/**
|
174
|
-
* `afterCreateCol` hook callback.
|
175
|
-
*
|
176
|
-
* @param {number} column Column index.
|
177
|
-
* @param {number} count Number of created columns.
|
178
|
-
*/
|
179
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
180
|
-
/**
|
181
|
-
* The `modifyAutofillRange` hook callback.
|
182
|
-
*
|
183
|
-
* @param {Array} drag The drag area coordinates.
|
184
|
-
* @param {Array} select The selection information.
|
185
|
-
* @returns {Array} The new drag area.
|
186
|
-
*/
|
187
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
188
|
-
/**
|
189
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
190
|
-
*
|
191
|
-
* @param {object} calc The column calculator object.
|
192
|
-
*/
|
193
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
194
|
-
/**
|
195
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
196
|
-
*
|
197
|
-
* @param {object} calc The row calculator object.
|
198
|
-
*/
|
199
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
200
|
-
/**
|
201
|
-
* The `afterGetCellMeta` hook callback.
|
202
|
-
*
|
203
|
-
* @param {number} row Row index.
|
204
|
-
* @param {number} col Column index.
|
205
|
-
* @param {object} cellProperties The cell properties object.
|
206
|
-
*/
|
207
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
208
|
-
/**
|
209
|
-
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
210
|
-
*/
|
211
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
212
|
-
/**
|
213
|
-
* Changes the focus selection to the next or previous cell or merged cell position.
|
214
|
-
*
|
215
|
-
* @param {number} row The visual row index.
|
216
|
-
* @param {number} column The visual column index.
|
217
|
-
*/
|
218
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionFocusSet);
|
219
|
-
/**
|
220
|
-
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
221
|
-
* computations.
|
222
|
-
*/
|
223
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionFocusSet);
|
224
|
-
/**
|
225
|
-
* Clears the last selected coordinates before setting a new selection range.
|
226
|
-
*/
|
227
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
228
|
-
/**
|
229
|
-
* `afterRenderer` hook callback.
|
230
|
-
*
|
231
|
-
* @param {HTMLElement} TD The cell to be modified.
|
232
|
-
* @param {number} row Row index.
|
233
|
-
* @param {number} col Visual column index.
|
234
|
-
*/
|
235
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
236
|
-
/**
|
237
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
238
|
-
*
|
239
|
-
* @param {object} defaultOptions The default context menu options.
|
240
|
-
*/
|
241
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
242
|
-
/**
|
243
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
244
|
-
*
|
245
|
-
* @param {number} row Row index.
|
246
|
-
* @param {number} column Visual column index.
|
247
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
248
|
-
*/
|
249
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
250
|
-
/**
|
251
|
-
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
252
|
-
* It expands the range to cover the entire area of the selected merged cells.
|
253
|
-
*/
|
254
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
255
|
-
/**
|
256
|
-
* The hooks allows to modify the delta transformation object necessary for correct selection end transformations.
|
257
|
-
*
|
258
|
-
* @param {{ row: number, col: number }} restDelta The transformation delta for the rest of the selection.
|
259
|
-
* @param {{ row: number, col: number }} delta The general transformation delta.
|
260
|
-
* @param {CellCoords} coords The coordinates of the next position of the end selection.
|
261
|
-
*/
|
262
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEndRestDelta);
|
263
|
-
/**
|
264
|
-
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
265
|
-
* The logic here handles "jumping over" merged merged cells, while selecting.
|
266
|
-
*
|
267
|
-
* @param {{ row: number, col: number }} delta The transformation delta.
|
268
|
-
*/
|
269
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
270
|
-
/**
|
271
|
-
* `modifyTransformStart` hook callback.
|
272
|
-
*
|
273
|
-
* @param {object} delta The transformation delta.
|
274
|
-
*/
|
275
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
276
|
-
/**
|
277
|
-
* `modifyTransformFocus` hook callback.
|
278
|
-
*
|
279
|
-
* @param {object} delta The transformation delta.
|
280
|
-
*/
|
281
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformFocus);
|
282
|
-
/**
|
283
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
284
|
-
* hook callback.
|
285
|
-
*
|
286
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
287
|
-
* @returns {boolean}
|
288
|
-
*/
|
289
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
290
76
|
/**
|
291
77
|
* `afterInit` hook callback.
|
292
78
|
*/
|
293
|
-
_classPrivateMethodInitSpec(this,
|
79
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
294
80
|
/**
|
295
81
|
* A container for all the merged cells.
|
296
82
|
*
|
@@ -313,41 +99,9 @@ export class MergeCells extends BasePlugin {
|
|
313
99
|
*/
|
314
100
|
_defineProperty(this, "selectionCalculations", null);
|
315
101
|
/**
|
316
|
-
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
317
|
-
* focus is moved out of the merged cell.
|
318
|
-
*
|
319
102
|
* @type {CellCoords}
|
320
103
|
*/
|
321
|
-
_classPrivateFieldInitSpec(this,
|
322
|
-
writable: true,
|
323
|
-
value: null
|
324
|
-
});
|
325
|
-
/**
|
326
|
-
* The last used transformation delta.
|
327
|
-
*
|
328
|
-
* @type {{ row: number, col: number }}
|
329
|
-
*/
|
330
|
-
_classPrivateFieldInitSpec(this, _lastDelta, {
|
331
|
-
writable: true,
|
332
|
-
value: {
|
333
|
-
row: 0,
|
334
|
-
col: 0
|
335
|
-
}
|
336
|
-
});
|
337
|
-
/**
|
338
|
-
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
339
|
-
* contains merged cells.
|
340
|
-
*
|
341
|
-
* @type {FocusOrder}
|
342
|
-
*/
|
343
|
-
_classPrivateFieldInitSpec(this, _focusOrder, {
|
344
|
-
writable: true,
|
345
|
-
value: new FocusOrder({
|
346
|
-
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
347
|
-
rowIndexMapper: this.hot.rowIndexMapper,
|
348
|
-
columnIndexMapper: this.hot.columnIndexMapper
|
349
|
-
})
|
350
|
-
});
|
104
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, null);
|
351
105
|
}
|
352
106
|
static get PLUGIN_KEY() {
|
353
107
|
return PLUGIN_KEY;
|
@@ -380,169 +134,145 @@ export class MergeCells extends BasePlugin {
|
|
380
134
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
381
135
|
args[_key] = arguments[_key];
|
382
136
|
}
|
383
|
-
return
|
137
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
384
138
|
});
|
385
|
-
this.addHook('
|
139
|
+
this.addHook('modifyTransformStart', function () {
|
386
140
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
387
141
|
args[_key2] = arguments[_key2];
|
388
142
|
}
|
389
|
-
return
|
143
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
390
144
|
});
|
391
|
-
this.addHook('
|
145
|
+
this.addHook('afterModifyTransformStart', function () {
|
392
146
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
393
147
|
args[_key3] = arguments[_key3];
|
394
148
|
}
|
395
|
-
return
|
149
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterModifyTransformStart).call(_this, ...args);
|
396
150
|
});
|
397
151
|
this.addHook('modifyTransformEnd', function () {
|
398
152
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
399
153
|
args[_key4] = arguments[_key4];
|
400
154
|
}
|
401
|
-
return
|
155
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
402
156
|
});
|
403
|
-
this.addHook('
|
157
|
+
this.addHook('modifyGetCellCoords', function () {
|
404
158
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
405
159
|
args[_key5] = arguments[_key5];
|
406
160
|
}
|
407
|
-
return
|
161
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
408
162
|
});
|
409
|
-
this.addHook('
|
163
|
+
this.addHook('beforeSetRangeStart', function () {
|
410
164
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
411
165
|
args[_key6] = arguments[_key6];
|
412
166
|
}
|
413
|
-
return
|
167
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
414
168
|
});
|
415
|
-
this.addHook('
|
169
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
416
170
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
417
171
|
args[_key7] = arguments[_key7];
|
418
172
|
}
|
419
|
-
return
|
173
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
420
174
|
});
|
421
|
-
this.addHook('
|
175
|
+
this.addHook('beforeSetRangeEnd', function () {
|
422
176
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
423
177
|
args[_key8] = arguments[_key8];
|
424
178
|
}
|
425
|
-
return
|
179
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeEnd).call(_this, ...args);
|
426
180
|
});
|
427
|
-
this.addHook('
|
181
|
+
this.addHook('afterIsMultipleSelection', function () {
|
428
182
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
429
183
|
args[_key9] = arguments[_key9];
|
430
184
|
}
|
431
|
-
return
|
185
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
432
186
|
});
|
433
|
-
this.addHook('
|
187
|
+
this.addHook('afterRenderer', function () {
|
434
188
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
435
189
|
args[_key10] = arguments[_key10];
|
436
190
|
}
|
437
|
-
return
|
191
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
438
192
|
});
|
439
|
-
this.addHook('
|
193
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
440
194
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
441
195
|
args[_key11] = arguments[_key11];
|
442
196
|
}
|
443
|
-
return
|
197
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
444
198
|
});
|
445
|
-
this.addHook('
|
199
|
+
this.addHook('afterGetCellMeta', function () {
|
446
200
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
447
201
|
args[_key12] = arguments[_key12];
|
448
202
|
}
|
449
|
-
return
|
203
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
450
204
|
});
|
451
|
-
this.addHook('
|
205
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
452
206
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
453
207
|
args[_key13] = arguments[_key13];
|
454
208
|
}
|
455
|
-
return
|
209
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
456
210
|
});
|
457
|
-
this.addHook('
|
211
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
458
212
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
459
213
|
args[_key14] = arguments[_key14];
|
460
214
|
}
|
461
|
-
return
|
215
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
462
216
|
});
|
463
|
-
this.addHook('
|
217
|
+
this.addHook('modifyAutofillRange', function () {
|
464
218
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
465
219
|
args[_key15] = arguments[_key15];
|
466
220
|
}
|
467
|
-
return
|
221
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
468
222
|
});
|
469
|
-
this.addHook('
|
223
|
+
this.addHook('afterCreateCol', function () {
|
470
224
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
471
225
|
args[_key16] = arguments[_key16];
|
472
226
|
}
|
473
|
-
return
|
227
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
474
228
|
});
|
475
|
-
this.addHook('
|
229
|
+
this.addHook('afterRemoveCol', function () {
|
476
230
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
477
231
|
args[_key17] = arguments[_key17];
|
478
232
|
}
|
479
|
-
return
|
233
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
480
234
|
});
|
481
|
-
this.addHook('
|
235
|
+
this.addHook('afterCreateRow', function () {
|
482
236
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
483
237
|
args[_key18] = arguments[_key18];
|
484
238
|
}
|
485
|
-
return
|
239
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
486
240
|
});
|
487
|
-
this.addHook('
|
241
|
+
this.addHook('afterRemoveRow', function () {
|
488
242
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
489
243
|
args[_key19] = arguments[_key19];
|
490
244
|
}
|
491
|
-
return
|
245
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
492
246
|
});
|
493
|
-
this.addHook('
|
247
|
+
this.addHook('afterChange', function () {
|
494
248
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
495
249
|
args[_key20] = arguments[_key20];
|
496
250
|
}
|
497
|
-
return
|
251
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
498
252
|
});
|
499
|
-
this.addHook('
|
253
|
+
this.addHook('beforeDrawBorders', function () {
|
500
254
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
501
255
|
args[_key21] = arguments[_key21];
|
502
256
|
}
|
503
|
-
return
|
257
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
504
258
|
});
|
505
|
-
this.addHook('
|
259
|
+
this.addHook('afterDrawSelection', function () {
|
506
260
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
507
261
|
args[_key22] = arguments[_key22];
|
508
262
|
}
|
509
|
-
return
|
263
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
510
264
|
});
|
511
|
-
this.addHook('
|
265
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
512
266
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
513
267
|
args[_key23] = arguments[_key23];
|
514
268
|
}
|
515
|
-
return
|
269
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
516
270
|
});
|
517
|
-
this.addHook('
|
271
|
+
this.addHook('beforeBeginEditing', function () {
|
518
272
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
519
273
|
args[_key24] = arguments[_key24];
|
520
274
|
}
|
521
|
-
return
|
522
|
-
});
|
523
|
-
this.addHook('beforeDrawBorders', function () {
|
524
|
-
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
525
|
-
args[_key25] = arguments[_key25];
|
526
|
-
}
|
527
|
-
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
528
|
-
});
|
529
|
-
this.addHook('afterDrawSelection', function () {
|
530
|
-
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
531
|
-
args[_key26] = arguments[_key26];
|
532
|
-
}
|
533
|
-
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
534
|
-
});
|
535
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
536
|
-
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
537
|
-
args[_key27] = arguments[_key27];
|
538
|
-
}
|
539
|
-
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
540
|
-
});
|
541
|
-
this.addHook('beforeBeginEditing', function () {
|
542
|
-
for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
|
543
|
-
args[_key28] = arguments[_key28];
|
544
|
-
}
|
545
|
-
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
275
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
546
276
|
});
|
547
277
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
548
278
|
if (source === 'MergeCells') {
|
@@ -710,6 +440,25 @@ export class MergeCells extends BasePlugin {
|
|
710
440
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
711
441
|
}
|
712
442
|
|
443
|
+
/**
|
444
|
+
* Merge or unmerge, based on last selected range.
|
445
|
+
*
|
446
|
+
* @private
|
447
|
+
*/
|
448
|
+
toggleMergeOnSelection() {
|
449
|
+
const currentRange = this.hot.getSelectedRangeLast();
|
450
|
+
if (!currentRange) {
|
451
|
+
return;
|
452
|
+
}
|
453
|
+
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
454
|
+
const {
|
455
|
+
from,
|
456
|
+
to
|
457
|
+
} = currentRange;
|
458
|
+
this.toggleMerge(currentRange);
|
459
|
+
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
460
|
+
}
|
461
|
+
|
713
462
|
/**
|
714
463
|
* Merges the selection provided as a cell range.
|
715
464
|
*
|
@@ -920,6 +669,15 @@ export class MergeCells extends BasePlugin {
|
|
920
669
|
const gridContext = shortcutManager.getContext('grid');
|
921
670
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
922
671
|
}
|
672
|
+
|
673
|
+
/**
|
674
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
675
|
+
* hook callback.
|
676
|
+
*
|
677
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
678
|
+
* @returns {boolean}
|
679
|
+
*/
|
680
|
+
|
923
681
|
/**
|
924
682
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
925
683
|
*
|
@@ -976,6 +734,13 @@ export class MergeCells extends BasePlugin {
|
|
976
734
|
}
|
977
735
|
}
|
978
736
|
}
|
737
|
+
|
738
|
+
/**
|
739
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
740
|
+
*
|
741
|
+
* @param {object} calc The column calculator object.
|
742
|
+
*/
|
743
|
+
|
979
744
|
/**
|
980
745
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
981
746
|
*
|
@@ -1070,209 +835,120 @@ export class MergeCells extends BasePlugin {
|
|
1070
835
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1071
836
|
return [renderableRow, renderableColumn];
|
1072
837
|
}
|
838
|
+
|
839
|
+
/**
|
840
|
+
* The `modifyAutofillRange` hook callback.
|
841
|
+
*
|
842
|
+
* @param {Array} drag The drag area coordinates.
|
843
|
+
* @param {Array} select The selection information.
|
844
|
+
* @returns {Array} The new drag area.
|
845
|
+
*/
|
1073
846
|
}
|
1074
|
-
function
|
847
|
+
function _onAfterInit() {
|
1075
848
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1076
849
|
this.hot.render();
|
1077
850
|
}
|
1078
|
-
function
|
851
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1079
852
|
if (isMultiple) {
|
1080
853
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1081
854
|
const selectionRange = this.hot.getSelectedRangeLast();
|
1082
|
-
const topStartCoords = selectionRange.getTopStartCorner();
|
1083
|
-
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1084
855
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1085
|
-
if (
|
856
|
+
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) {
|
1086
857
|
return false;
|
1087
858
|
}
|
1088
859
|
}
|
1089
860
|
}
|
1090
861
|
return isMultiple;
|
1091
862
|
}
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
}
|
1096
|
-
|
1097
|
-
|
1098
|
-
const
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
columnIndexMapper,
|
1103
|
-
rowIndexMapper
|
1104
|
-
} = this.hot;
|
1105
|
-
if (_classPrivateFieldGet(this, _lastSelectedFocus)) {
|
1106
|
-
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).row) !== null) {
|
1107
|
-
highlight.row = _classPrivateFieldGet(this, _lastSelectedFocus).row;
|
1108
|
-
}
|
1109
|
-
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).col) !== null) {
|
1110
|
-
highlight.col = _classPrivateFieldGet(this, _lastSelectedFocus).col;
|
1111
|
-
}
|
1112
|
-
_classPrivateFieldSet(this, _lastSelectedFocus, null);
|
1113
|
-
}
|
1114
|
-
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1115
|
-
if (!mergedParent) {
|
1116
|
-
return;
|
1117
|
-
}
|
1118
|
-
const visualColumnIndexStart = mergedParent.col;
|
1119
|
-
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1120
|
-
if (delta.col < 0) {
|
1121
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1122
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1123
|
-
if (notHiddenColumnIndex === null) {
|
1124
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1125
|
-
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1126
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1127
|
-
} else {
|
1128
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1129
|
-
}
|
1130
|
-
} else if (delta.col > 0) {
|
1131
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1132
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1133
|
-
if (notHiddenColumnIndex === null) {
|
1134
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1135
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1136
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1137
|
-
} else {
|
1138
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1139
|
-
}
|
1140
|
-
}
|
1141
|
-
const visualRowIndexStart = mergedParent.row;
|
1142
|
-
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1143
|
-
if (delta.row < 0) {
|
1144
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1145
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1146
|
-
if (notHiddenRowIndex === null) {
|
1147
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1148
|
-
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1149
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1150
|
-
} else {
|
1151
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1152
|
-
}
|
1153
|
-
} else if (delta.row > 0) {
|
1154
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1155
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1156
|
-
if (notHiddenRowIndex === null) {
|
1157
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1158
|
-
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1159
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1160
|
-
} else {
|
1161
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1162
|
-
}
|
1163
|
-
}
|
1164
|
-
}
|
1165
|
-
function _onModifyTransformEnd2(delta) {
|
1166
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1167
|
-
const cloneRange = selectedRange.clone();
|
1168
|
-
const {
|
1169
|
-
to
|
1170
|
-
} = selectedRange;
|
1171
|
-
const {
|
1172
|
-
columnIndexMapper,
|
1173
|
-
rowIndexMapper
|
1174
|
-
} = this.hot;
|
1175
|
-
const expandCloneRange = (row, col) => {
|
1176
|
-
cloneRange.expand(this.hot._createCellCoords(row, col));
|
1177
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1178
|
-
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1179
|
-
}
|
863
|
+
/**
|
864
|
+
* `modifyTransformStart` hook callback.
|
865
|
+
*
|
866
|
+
* @param {object} delta The transformation delta.
|
867
|
+
*/
|
868
|
+
function _onModifyTransformStart(delta) {
|
869
|
+
const currentlySelectedRange = this.hot.getSelectedRangeLast();
|
870
|
+
let newDelta = {
|
871
|
+
row: delta.row,
|
872
|
+
col: delta.col
|
1180
873
|
};
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
}
|
1187
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1188
|
-
if (notHiddenColumnIndex !== null) {
|
1189
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1190
|
-
}
|
1191
|
-
} else if (delta.col > 0) {
|
1192
|
-
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1193
|
-
expandCloneRange(to.row, nextColumn);
|
1194
|
-
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1195
|
-
nextColumn = cloneRange.getBottomEndCorner().col;
|
1196
|
-
}
|
1197
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1198
|
-
if (notHiddenColumnIndex !== null) {
|
1199
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1200
|
-
}
|
874
|
+
let nextPosition = null;
|
875
|
+
const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
|
876
|
+
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
877
|
+
if (!_classPrivateFieldGet(_lastDesiredCoords, this)) {
|
878
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null));
|
1201
879
|
}
|
1202
|
-
if (
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
if (notHiddenRowIndex !== null) {
|
1210
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
880
|
+
if (mergedParent) {
|
881
|
+
// only merge selected
|
882
|
+
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
883
|
+
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
884
|
+
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
885
|
+
if (!mergeRange.includes(_classPrivateFieldGet(_lastDesiredCoords, this))) {
|
886
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1211
887
|
}
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
888
|
+
newDelta.row = _classPrivateFieldGet(_lastDesiredCoords, this).row ? _classPrivateFieldGet(_lastDesiredCoords, this).row - currentPosition.row : newDelta.row;
|
889
|
+
newDelta.col = _classPrivateFieldGet(_lastDesiredCoords, this).col ? _classPrivateFieldGet(_lastDesiredCoords, this).col - currentPosition.col : newDelta.col;
|
890
|
+
if (delta.row > 0) {
|
891
|
+
// moving down
|
892
|
+
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
893
|
+
} else if (delta.row < 0) {
|
894
|
+
// moving up
|
895
|
+
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1217
896
|
}
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
897
|
+
if (delta.col > 0) {
|
898
|
+
// moving right
|
899
|
+
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
900
|
+
} else if (delta.col < 0) {
|
901
|
+
// moving left
|
902
|
+
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
1221
903
|
}
|
1222
904
|
}
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
905
|
+
nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
|
906
|
+
const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
|
907
|
+
if (nextPositionMergedCell) {
|
908
|
+
// skipping the invisible cells in the merge range
|
909
|
+
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
910
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, nextPosition);
|
911
|
+
newDelta = {
|
912
|
+
row: firstRenderableCoords.row - currentPosition.row,
|
913
|
+
col: firstRenderableCoords.col - currentPosition.col
|
914
|
+
};
|
1232
915
|
}
|
1233
|
-
|
1234
|
-
|
1235
|
-
const bottomEndCorner = selectedRange.getBottomEndCorner();
|
1236
|
-
if (delta.col > 0) {
|
1237
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(topEndCorner.col, coords.col) - 1;
|
1238
|
-
restDelta.col = Math.max(renderableColumns, 1);
|
1239
|
-
} else if (delta.col < 0) {
|
1240
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(coords.col, topStartCorner.col) - 1;
|
1241
|
-
restDelta.col = -Math.max(renderableColumns, 1);
|
916
|
+
if (newDelta.row !== 0) {
|
917
|
+
delta.row = newDelta.row;
|
1242
918
|
}
|
1243
|
-
if (
|
1244
|
-
|
1245
|
-
restDelta.row = Math.max(renderableRows, 1);
|
1246
|
-
} else if (delta.row < 0) {
|
1247
|
-
const renderableRows = this.hot.view.countRenderableRowsInRange(coords.row, topStartCorner.row) - 1;
|
1248
|
-
restDelta.row = -Math.max(renderableRows, 1);
|
919
|
+
if (newDelta.col !== 0) {
|
920
|
+
delta.col = newDelta.col;
|
1249
921
|
}
|
1250
922
|
}
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
}
|
1269
|
-
|
1270
|
-
|
1271
|
-
if (mergedParent) {
|
1272
|
-
highlight.assign(mergedParent);
|
1273
|
-
}
|
923
|
+
/**
|
924
|
+
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
925
|
+
*
|
926
|
+
* @param {object} delta The transformation delta.
|
927
|
+
*/
|
928
|
+
function _onModifyTransformEnd(delta) {
|
929
|
+
const currentSelectionRange = this.hot.getSelectedRangeLast();
|
930
|
+
const newDelta = clone(delta);
|
931
|
+
const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
|
932
|
+
let tempDelta = clone(newDelta);
|
933
|
+
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
|
934
|
+
do {
|
935
|
+
tempDelta = clone(newDelta);
|
936
|
+
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
937
|
+
arrayEach(mergedCellsWithinRange, mergedCell => {
|
938
|
+
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
939
|
+
});
|
940
|
+
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
941
|
+
delta.row = newDelta.row;
|
942
|
+
delta.col = newDelta.col;
|
1274
943
|
}
|
1275
|
-
|
944
|
+
/**
|
945
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
946
|
+
*
|
947
|
+
* @param {number} row Row index.
|
948
|
+
* @param {number} column Visual column index.
|
949
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
950
|
+
*/
|
951
|
+
function _onModifyGetCellCoords(row, column) {
|
1276
952
|
if (row < 0 || column < 0) {
|
1277
953
|
return;
|
1278
954
|
}
|
@@ -1292,12 +968,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1292
968
|
// Most bottom-right merged cell coords.
|
1293
969
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1294
970
|
}
|
1295
|
-
|
971
|
+
/**
|
972
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
973
|
+
*
|
974
|
+
* @param {object} defaultOptions The default context menu options.
|
975
|
+
*/
|
976
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1296
977
|
defaultOptions.items.push({
|
1297
978
|
name: '---------'
|
1298
979
|
}, toggleMergeItem(this));
|
1299
980
|
}
|
1300
|
-
|
981
|
+
/**
|
982
|
+
* `afterRenderer` hook callback.
|
983
|
+
*
|
984
|
+
* @param {HTMLElement} TD The cell to be modified.
|
985
|
+
* @param {number} row Row index.
|
986
|
+
* @param {number} col Visual column index.
|
987
|
+
*/
|
988
|
+
function _onAfterRenderer(TD, row, col) {
|
1301
989
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1302
990
|
// We shouldn't override data in the collection.
|
1303
991
|
const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : undefined;
|
@@ -1329,88 +1017,61 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1329
1017
|
}
|
1330
1018
|
applySpanProperties(TD, mergedCellCopy, row, col);
|
1331
1019
|
}
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
if (
|
1345
|
-
_classPrivateFieldGet(this, _focusOrder).setPrevNodeAsActive();
|
1346
|
-
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(this, _lastDelta).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1347
|
-
_classPrivateFieldGet(this, _focusOrder).setNextNodeAsActive();
|
1348
|
-
}
|
1349
|
-
}
|
1350
|
-
function _onAfterSelectionFocusSet2(row, column) {
|
1351
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1352
|
-
const {
|
1353
|
-
columnIndexMapper,
|
1354
|
-
rowIndexMapper
|
1355
|
-
} = this.hot;
|
1356
|
-
let notHiddenRowIndex = null;
|
1357
|
-
let notHiddenColumnIndex = null;
|
1358
|
-
if (_classPrivateFieldGet(this, _lastDelta).col < 0) {
|
1359
|
-
const {
|
1360
|
-
rowEnd,
|
1361
|
-
colEnd
|
1362
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevHorizontalNode();
|
1363
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1364
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1365
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).col > 0) {
|
1366
|
-
const {
|
1367
|
-
rowStart,
|
1368
|
-
colStart
|
1369
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextHorizontalNode();
|
1370
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1371
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1372
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1373
|
-
const {
|
1374
|
-
rowEnd,
|
1375
|
-
colEnd
|
1376
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevVerticalNode();
|
1377
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1378
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1379
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).row > 0) {
|
1380
|
-
const {
|
1381
|
-
rowStart,
|
1382
|
-
colStart
|
1383
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextVerticalNode();
|
1384
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1385
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1386
|
-
}
|
1387
|
-
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1388
|
-
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1020
|
+
/**
|
1021
|
+
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
1022
|
+
* A selection within merge area should be rewritten to the start of merge area.
|
1023
|
+
*
|
1024
|
+
* @param {object} coords Cell coords.
|
1025
|
+
*/
|
1026
|
+
function _onBeforeSetRangeStart(coords) {
|
1027
|
+
// TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
|
1028
|
+
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
1029
|
+
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
1030
|
+
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
1031
|
+
// and what was idea for flipping direction inside `expandByRange` method.
|
1032
|
+
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1389
1033
|
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1390
|
-
|
1391
|
-
row = coords.row;
|
1392
|
-
column = coords.col;
|
1393
|
-
if (mergeParent) {
|
1394
|
-
selectedRange.highlight.assign(mergeParent);
|
1395
|
-
} else {
|
1396
|
-
selectedRange.highlight.assign(coords);
|
1397
|
-
}
|
1398
|
-
focusHighlight.clear();
|
1399
|
-
focusHighlight.add(coords).commit();
|
1034
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1400
1035
|
}
|
1401
|
-
_classPrivateFieldGet(this, _focusOrder).setActiveNode(row, column);
|
1402
|
-
_classPrivateFieldSet(this, _lastDelta, {
|
1403
|
-
row: 0,
|
1404
|
-
col: 0
|
1405
|
-
});
|
1406
1036
|
}
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1037
|
+
/**
|
1038
|
+
* `beforeSetRangeEnd` hook callback.
|
1039
|
+
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
1040
|
+
* merged cell.
|
1041
|
+
*
|
1042
|
+
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
1043
|
+
*
|
1044
|
+
* @param {object} coords Cell coords.
|
1045
|
+
*/
|
1046
|
+
function _onBeforeSetRangeEnd(coords) {
|
1047
|
+
const selRange = this.hot.getSelectedRangeLast();
|
1048
|
+
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
1049
|
+
selRange.to = coords;
|
1050
|
+
let rangeExpanded = false;
|
1051
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1052
|
+
return;
|
1411
1053
|
}
|
1054
|
+
do {
|
1055
|
+
rangeExpanded = false;
|
1056
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1057
|
+
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1058
|
+
const mergedCellRange = cellInfo.getRange();
|
1059
|
+
if (selRange.expandByRange(mergedCellRange)) {
|
1060
|
+
coords.row = selRange.to.row;
|
1061
|
+
coords.col = selRange.to.col;
|
1062
|
+
rangeExpanded = true;
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
} while (rangeExpanded);
|
1412
1066
|
}
|
1413
|
-
|
1067
|
+
/**
|
1068
|
+
* The `afterGetCellMeta` hook callback.
|
1069
|
+
*
|
1070
|
+
* @param {number} row Row index.
|
1071
|
+
* @param {number} col Column index.
|
1072
|
+
* @param {object} cellProperties The cell properties object.
|
1073
|
+
*/
|
1074
|
+
function _onAfterGetCellMeta(row, col, cellProperties) {
|
1414
1075
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1415
1076
|
if (mergeParent) {
|
1416
1077
|
if (mergeParent.row !== row || mergeParent.col !== col) {
|
@@ -1421,17 +1082,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
|
|
1421
1082
|
}
|
1422
1083
|
}
|
1423
1084
|
}
|
1424
|
-
|
1085
|
+
/**
|
1086
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
1087
|
+
*
|
1088
|
+
* @param {object} calc The row calculator object.
|
1089
|
+
*/
|
1090
|
+
function _onAfterViewportRowCalculatorOverride(calc) {
|
1425
1091
|
const nrOfColumns = this.hot.countCols();
|
1426
1092
|
this.modifyViewportRowStart(calc, nrOfColumns);
|
1427
1093
|
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1428
1094
|
}
|
1429
|
-
function
|
1095
|
+
function _onAfterViewportColumnCalculatorOverride(calc) {
|
1430
1096
|
const nrOfRows = this.hot.countRows();
|
1431
1097
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1432
1098
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1433
1099
|
}
|
1434
|
-
function
|
1100
|
+
function _onModifyAutofillRange(drag, select) {
|
1435
1101
|
this.autofillCalculations.correctSelectionAreaSize(select);
|
1436
1102
|
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1437
1103
|
let dragArea = drag;
|
@@ -1455,28 +1121,65 @@ function _onModifyAutofillRange2(drag, select) {
|
|
1455
1121
|
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1456
1122
|
return dragArea;
|
1457
1123
|
}
|
1458
|
-
|
1124
|
+
/**
|
1125
|
+
* `afterCreateCol` hook callback.
|
1126
|
+
*
|
1127
|
+
* @param {number} column Column index.
|
1128
|
+
* @param {number} count Number of created columns.
|
1129
|
+
*/
|
1130
|
+
function _onAfterCreateCol(column, count) {
|
1459
1131
|
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1460
1132
|
}
|
1461
|
-
|
1133
|
+
/**
|
1134
|
+
* `afterRemoveCol` hook callback.
|
1135
|
+
*
|
1136
|
+
* @param {number} column Column index.
|
1137
|
+
* @param {number} count Number of removed columns.
|
1138
|
+
*/
|
1139
|
+
function _onAfterRemoveCol(column, count) {
|
1462
1140
|
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1463
1141
|
}
|
1464
|
-
|
1142
|
+
/**
|
1143
|
+
* `afterCreateRow` hook callback.
|
1144
|
+
*
|
1145
|
+
* @param {number} row Row index.
|
1146
|
+
* @param {number} count Number of created rows.
|
1147
|
+
* @param {string} source Source of change.
|
1148
|
+
*/
|
1149
|
+
function _onAfterCreateRow(row, count, source) {
|
1465
1150
|
if (source === 'auto') {
|
1466
1151
|
return;
|
1467
1152
|
}
|
1468
1153
|
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1469
1154
|
}
|
1470
|
-
|
1155
|
+
/**
|
1156
|
+
* `afterRemoveRow` hook callback.
|
1157
|
+
*
|
1158
|
+
* @param {number} row Row index.
|
1159
|
+
* @param {number} count Number of removed rows.
|
1160
|
+
*/
|
1161
|
+
function _onAfterRemoveRow(row, count) {
|
1471
1162
|
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1472
1163
|
}
|
1473
|
-
|
1164
|
+
/**
|
1165
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1166
|
+
*
|
1167
|
+
* @param {Array} changes The changes array.
|
1168
|
+
* @param {string} source Determines the source of the change.
|
1169
|
+
*/
|
1170
|
+
function _onAfterChange(changes, source) {
|
1474
1171
|
if (source !== 'Autofill.fill') {
|
1475
1172
|
return;
|
1476
1173
|
}
|
1477
1174
|
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1478
1175
|
}
|
1479
|
-
|
1176
|
+
/**
|
1177
|
+
* `beforeDrawAreaBorders` hook callback.
|
1178
|
+
*
|
1179
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
1180
|
+
* @param {string} className Class name for the area.
|
1181
|
+
*/
|
1182
|
+
function _onBeforeDrawAreaBorders(corners, className) {
|
1480
1183
|
if (className && className === 'area') {
|
1481
1184
|
const selectedRange = this.hot.getSelectedRangeLast();
|
1482
1185
|
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
@@ -1488,17 +1191,74 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1488
1191
|
});
|
1489
1192
|
}
|
1490
1193
|
}
|
1491
|
-
|
1194
|
+
/**
|
1195
|
+
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
1196
|
+
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
1197
|
+
*
|
1198
|
+
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
1199
|
+
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
1200
|
+
* down).
|
1201
|
+
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
1202
|
+
* down).
|
1203
|
+
*/
|
1204
|
+
function _onAfterModifyTransformStart(coords, rowTransformDir, colTransformDir) {
|
1205
|
+
if (!this.enabled) {
|
1206
|
+
return;
|
1207
|
+
}
|
1208
|
+
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1209
|
+
if (!mergedCellAtCoords) {
|
1210
|
+
return;
|
1211
|
+
}
|
1212
|
+
const goingDown = rowTransformDir > 0;
|
1213
|
+
const goingUp = rowTransformDir < 0;
|
1214
|
+
const goingLeft = colTransformDir < 0;
|
1215
|
+
const goingRight = colTransformDir > 0;
|
1216
|
+
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1217
|
+
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1218
|
+
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1219
|
+
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1220
|
+
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1221
|
+
coords.row = mergedCellAtCoords.row;
|
1222
|
+
coords.col = mergedCellAtCoords.col;
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
/**
|
1226
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1227
|
+
*
|
1228
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
1229
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
1230
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
1231
|
+
* endColumn]`.
|
1232
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
1233
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
1234
|
+
* processed cell.
|
1235
|
+
*/
|
1236
|
+
function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1492
1237
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1493
1238
|
if (!cornersOfSelection) {
|
1494
1239
|
return;
|
1495
1240
|
}
|
1496
1241
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1497
1242
|
}
|
1498
|
-
|
1243
|
+
/**
|
1244
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1245
|
+
*
|
1246
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1247
|
+
* all the cells in the table.
|
1248
|
+
*/
|
1249
|
+
function _onBeforeRemoveCellClassNames() {
|
1499
1250
|
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1500
1251
|
}
|
1501
|
-
|
1252
|
+
/**
|
1253
|
+
* Allows to prevent opening the editor while more than one merged cell is selected.
|
1254
|
+
*
|
1255
|
+
* @param {number} row Visual row index of the edited cell.
|
1256
|
+
* @param {number} column Visual column index of the edited cell.
|
1257
|
+
* @param {string | null} initialValue The initial editor value.
|
1258
|
+
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
1259
|
+
* @returns {boolean | undefined}
|
1260
|
+
*/
|
1261
|
+
function _onBeforeBeginEditing(row, column, initialValue, event) {
|
1502
1262
|
if (!(event instanceof MouseEvent)) {
|
1503
1263
|
return;
|
1504
1264
|
}
|