handsontable 0.0.0-next-200799f-20240311 → 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 -79
- package/core.mjs +22 -79
- 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 +7620 -10327
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +277 -277
- package/dist/handsontable.js +5525 -7779
- 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 +355 -595
- package/plugins/mergeCells/mergeCells.mjs +355 -595
- 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 +4 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- 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 -252
- package/selection/selection.mjs +59 -251
- 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 -258
- package/plugins/mergeCells/focusOrder.mjs +0 -253
@@ -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,219 +68,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
72
68
|
* ```
|
73
69
|
* :::
|
74
70
|
*/
|
75
|
-
var
|
76
|
-
var
|
77
|
-
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
78
|
-
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
79
|
-
var _onModifyTransformFocus = /*#__PURE__*/new WeakSet();
|
80
|
-
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
81
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
82
|
-
var _onModifyTransformEndRestDelta = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
84
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
85
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
86
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onAfterSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
89
|
-
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
90
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
99
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
100
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
101
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
102
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
71
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
72
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
103
73
|
export class MergeCells extends BasePlugin {
|
104
74
|
constructor() {
|
105
75
|
super(...arguments);
|
106
|
-
/**
|
107
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
108
|
-
*
|
109
|
-
* @param {number} row Visual row index of the edited cell.
|
110
|
-
* @param {number} column Visual column index of the edited cell.
|
111
|
-
* @param {string | null} initialValue The initial editor value.
|
112
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
113
|
-
* @returns {boolean | undefined}
|
114
|
-
*/
|
115
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
116
|
-
/**
|
117
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
118
|
-
*
|
119
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
120
|
-
* all the cells in the table.
|
121
|
-
*/
|
122
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
123
|
-
/**
|
124
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
125
|
-
*
|
126
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
127
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
128
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
129
|
-
* endColumn]`.
|
130
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
131
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
132
|
-
* processed cell.
|
133
|
-
*/
|
134
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
135
|
-
/**
|
136
|
-
* `beforeDrawAreaBorders` hook callback.
|
137
|
-
*
|
138
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
139
|
-
* @param {string} className Class name for the area.
|
140
|
-
*/
|
141
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
142
|
-
/**
|
143
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
144
|
-
*
|
145
|
-
* @param {Array} changes The changes array.
|
146
|
-
* @param {string} source Determines the source of the change.
|
147
|
-
*/
|
148
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
149
|
-
/**
|
150
|
-
* `afterRemoveRow` hook callback.
|
151
|
-
*
|
152
|
-
* @param {number} row Row index.
|
153
|
-
* @param {number} count Number of removed rows.
|
154
|
-
*/
|
155
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
156
|
-
/**
|
157
|
-
* `afterCreateRow` hook callback.
|
158
|
-
*
|
159
|
-
* @param {number} row Row index.
|
160
|
-
* @param {number} count Number of created rows.
|
161
|
-
* @param {string} source Source of change.
|
162
|
-
*/
|
163
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
164
|
-
/**
|
165
|
-
* `afterRemoveCol` hook callback.
|
166
|
-
*
|
167
|
-
* @param {number} column Column index.
|
168
|
-
* @param {number} count Number of removed columns.
|
169
|
-
*/
|
170
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
171
|
-
/**
|
172
|
-
* `afterCreateCol` hook callback.
|
173
|
-
*
|
174
|
-
* @param {number} column Column index.
|
175
|
-
* @param {number} count Number of created columns.
|
176
|
-
*/
|
177
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
178
|
-
/**
|
179
|
-
* The `modifyAutofillRange` hook callback.
|
180
|
-
*
|
181
|
-
* @param {Array} drag The drag area coordinates.
|
182
|
-
* @param {Array} select The selection information.
|
183
|
-
* @returns {Array} The new drag area.
|
184
|
-
*/
|
185
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
186
|
-
/**
|
187
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
188
|
-
*
|
189
|
-
* @param {object} calc The column calculator object.
|
190
|
-
*/
|
191
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
192
|
-
/**
|
193
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
194
|
-
*
|
195
|
-
* @param {object} calc The row calculator object.
|
196
|
-
*/
|
197
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
198
|
-
/**
|
199
|
-
* The `afterGetCellMeta` hook callback.
|
200
|
-
*
|
201
|
-
* @param {number} row Row index.
|
202
|
-
* @param {number} col Column index.
|
203
|
-
* @param {object} cellProperties The cell properties object.
|
204
|
-
*/
|
205
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
206
|
-
/**
|
207
|
-
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
208
|
-
*/
|
209
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
210
|
-
/**
|
211
|
-
* Searches for the node that is currently focused within the vertical and horizontal linked lists.
|
212
|
-
*
|
213
|
-
* @param {number} row Visual row index.
|
214
|
-
* @param {number} column Visual column index.
|
215
|
-
*/
|
216
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionFocusSet);
|
217
|
-
/**
|
218
|
-
* Clears the last selected coordinates before setting a new selection range.
|
219
|
-
*/
|
220
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
221
|
-
/**
|
222
|
-
* `afterRenderer` hook callback.
|
223
|
-
*
|
224
|
-
* @param {HTMLElement} TD The cell to be modified.
|
225
|
-
* @param {number} row Row index.
|
226
|
-
* @param {number} col Visual column index.
|
227
|
-
*/
|
228
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
229
|
-
/**
|
230
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
231
|
-
*
|
232
|
-
* @param {object} defaultOptions The default context menu options.
|
233
|
-
*/
|
234
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
235
|
-
/**
|
236
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
237
|
-
*
|
238
|
-
* @param {number} row Row index.
|
239
|
-
* @param {number} column Visual column index.
|
240
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
241
|
-
*/
|
242
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
243
|
-
/**
|
244
|
-
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
245
|
-
* It expands the range to cover the entire area of the selected merged cells.
|
246
|
-
*/
|
247
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
248
|
-
/**
|
249
|
-
* The hooks allows to modify the delta transformation object necessary for correct selection end transformations.
|
250
|
-
*
|
251
|
-
* @param {{ row: number, col: number }} restDelta The transformation delta for the rest of the selection.
|
252
|
-
* @param {{ row: number, col: number }} delta The general transformation delta.
|
253
|
-
* @param {CellCoords} coords The coordinates of the next position of the end selection.
|
254
|
-
*/
|
255
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEndRestDelta);
|
256
|
-
/**
|
257
|
-
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
258
|
-
* The logic here handles "jumping over" merged merged cells, while selecting.
|
259
|
-
*
|
260
|
-
* @param {{ row: number, col: number }} delta The transformation delta.
|
261
|
-
*/
|
262
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
263
|
-
/**
|
264
|
-
* `modifyTransformStart` hook callback.
|
265
|
-
*
|
266
|
-
* @param {object} delta The transformation delta.
|
267
|
-
*/
|
268
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
269
|
-
/**
|
270
|
-
* The hook controls the position of the focus position. For merge cells there is need to shift the focus to the
|
271
|
-
* next merged cell not to the next hidden cell (overlapped by merged cell).
|
272
|
-
*
|
273
|
-
* @param {object} delta The transformation delta.
|
274
|
-
*/
|
275
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformFocus);
|
276
|
-
/**
|
277
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
278
|
-
* hook callback.
|
279
|
-
*
|
280
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
281
|
-
* @returns {boolean}
|
282
|
-
*/
|
283
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
284
76
|
/**
|
285
77
|
* `afterInit` hook callback.
|
286
78
|
*/
|
287
|
-
_classPrivateMethodInitSpec(this,
|
79
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
288
80
|
/**
|
289
81
|
* A container for all the merged cells.
|
290
82
|
*
|
@@ -307,25 +99,9 @@ export class MergeCells extends BasePlugin {
|
|
307
99
|
*/
|
308
100
|
_defineProperty(this, "selectionCalculations", null);
|
309
101
|
/**
|
310
|
-
* The holder for the last selected coordinates. This allows keeping the correct coordinates in cases after the
|
311
|
-
* focus is moved out of the merged cell.
|
312
|
-
*
|
313
102
|
* @type {CellCoords}
|
314
103
|
*/
|
315
|
-
_classPrivateFieldInitSpec(this,
|
316
|
-
writable: true,
|
317
|
-
value: null
|
318
|
-
});
|
319
|
-
/**
|
320
|
-
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
321
|
-
* contains merged cells.
|
322
|
-
*
|
323
|
-
* @type {FocusOrder}
|
324
|
-
*/
|
325
|
-
_classPrivateFieldInitSpec(this, _focusOrder, {
|
326
|
-
writable: true,
|
327
|
-
value: new FocusOrder((row, column) => this.mergedCellsCollection.get(row, column))
|
328
|
-
});
|
104
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, null);
|
329
105
|
}
|
330
106
|
static get PLUGIN_KEY() {
|
331
107
|
return PLUGIN_KEY;
|
@@ -358,163 +134,145 @@ export class MergeCells extends BasePlugin {
|
|
358
134
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
359
135
|
args[_key] = arguments[_key];
|
360
136
|
}
|
361
|
-
return
|
137
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
362
138
|
});
|
363
|
-
this.addHook('
|
139
|
+
this.addHook('modifyTransformStart', function () {
|
364
140
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
365
141
|
args[_key2] = arguments[_key2];
|
366
142
|
}
|
367
|
-
return
|
143
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
368
144
|
});
|
369
|
-
this.addHook('
|
145
|
+
this.addHook('afterModifyTransformStart', function () {
|
370
146
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
371
147
|
args[_key3] = arguments[_key3];
|
372
148
|
}
|
373
|
-
return
|
149
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterModifyTransformStart).call(_this, ...args);
|
374
150
|
});
|
375
151
|
this.addHook('modifyTransformEnd', function () {
|
376
152
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
377
153
|
args[_key4] = arguments[_key4];
|
378
154
|
}
|
379
|
-
return
|
155
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
380
156
|
});
|
381
|
-
this.addHook('
|
157
|
+
this.addHook('modifyGetCellCoords', function () {
|
382
158
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
383
159
|
args[_key5] = arguments[_key5];
|
384
160
|
}
|
385
|
-
return
|
161
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
386
162
|
});
|
387
|
-
this.addHook('
|
163
|
+
this.addHook('beforeSetRangeStart', function () {
|
388
164
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
389
165
|
args[_key6] = arguments[_key6];
|
390
166
|
}
|
391
|
-
return
|
167
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
392
168
|
});
|
393
|
-
this.addHook('
|
169
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
394
170
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
395
171
|
args[_key7] = arguments[_key7];
|
396
172
|
}
|
397
|
-
return
|
173
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
398
174
|
});
|
399
|
-
this.addHook('
|
175
|
+
this.addHook('beforeSetRangeEnd', function () {
|
400
176
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
401
177
|
args[_key8] = arguments[_key8];
|
402
178
|
}
|
403
|
-
return
|
179
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeEnd).call(_this, ...args);
|
404
180
|
});
|
405
|
-
this.addHook('
|
181
|
+
this.addHook('afterIsMultipleSelection', function () {
|
406
182
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
407
183
|
args[_key9] = arguments[_key9];
|
408
184
|
}
|
409
|
-
return
|
185
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
410
186
|
});
|
411
|
-
this.addHook('
|
187
|
+
this.addHook('afterRenderer', function () {
|
412
188
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
413
189
|
args[_key10] = arguments[_key10];
|
414
190
|
}
|
415
|
-
return
|
191
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
416
192
|
});
|
417
|
-
this.addHook('
|
193
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
418
194
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
419
195
|
args[_key11] = arguments[_key11];
|
420
196
|
}
|
421
|
-
return
|
197
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
422
198
|
});
|
423
|
-
this.addHook('
|
199
|
+
this.addHook('afterGetCellMeta', function () {
|
424
200
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
425
201
|
args[_key12] = arguments[_key12];
|
426
202
|
}
|
427
|
-
return
|
203
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
428
204
|
});
|
429
|
-
this.addHook('
|
205
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
430
206
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
431
207
|
args[_key13] = arguments[_key13];
|
432
208
|
}
|
433
|
-
return
|
209
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
434
210
|
});
|
435
|
-
this.addHook('
|
211
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
436
212
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
437
213
|
args[_key14] = arguments[_key14];
|
438
214
|
}
|
439
|
-
return
|
215
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
440
216
|
});
|
441
|
-
this.addHook('
|
217
|
+
this.addHook('modifyAutofillRange', function () {
|
442
218
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
443
219
|
args[_key15] = arguments[_key15];
|
444
220
|
}
|
445
|
-
return
|
221
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
446
222
|
});
|
447
|
-
this.addHook('
|
223
|
+
this.addHook('afterCreateCol', function () {
|
448
224
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
449
225
|
args[_key16] = arguments[_key16];
|
450
226
|
}
|
451
|
-
return
|
227
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
452
228
|
});
|
453
|
-
this.addHook('
|
229
|
+
this.addHook('afterRemoveCol', function () {
|
454
230
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
455
231
|
args[_key17] = arguments[_key17];
|
456
232
|
}
|
457
|
-
return
|
233
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
458
234
|
});
|
459
|
-
this.addHook('
|
235
|
+
this.addHook('afterCreateRow', function () {
|
460
236
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
461
237
|
args[_key18] = arguments[_key18];
|
462
238
|
}
|
463
|
-
return
|
239
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
464
240
|
});
|
465
|
-
this.addHook('
|
241
|
+
this.addHook('afterRemoveRow', function () {
|
466
242
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
467
243
|
args[_key19] = arguments[_key19];
|
468
244
|
}
|
469
|
-
return
|
245
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
470
246
|
});
|
471
|
-
this.addHook('
|
247
|
+
this.addHook('afterChange', function () {
|
472
248
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
473
249
|
args[_key20] = arguments[_key20];
|
474
250
|
}
|
475
|
-
return
|
251
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
476
252
|
});
|
477
|
-
this.addHook('
|
253
|
+
this.addHook('beforeDrawBorders', function () {
|
478
254
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
479
255
|
args[_key21] = arguments[_key21];
|
480
256
|
}
|
481
|
-
return
|
257
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
482
258
|
});
|
483
|
-
this.addHook('
|
259
|
+
this.addHook('afterDrawSelection', function () {
|
484
260
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
485
261
|
args[_key22] = arguments[_key22];
|
486
262
|
}
|
487
|
-
return
|
263
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
488
264
|
});
|
489
|
-
this.addHook('
|
265
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
490
266
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
491
267
|
args[_key23] = arguments[_key23];
|
492
268
|
}
|
493
|
-
return
|
269
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
494
270
|
});
|
495
|
-
this.addHook('
|
271
|
+
this.addHook('beforeBeginEditing', function () {
|
496
272
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
497
273
|
args[_key24] = arguments[_key24];
|
498
274
|
}
|
499
|
-
return
|
500
|
-
});
|
501
|
-
this.addHook('afterDrawSelection', function () {
|
502
|
-
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
503
|
-
args[_key25] = arguments[_key25];
|
504
|
-
}
|
505
|
-
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
506
|
-
});
|
507
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
508
|
-
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
509
|
-
args[_key26] = arguments[_key26];
|
510
|
-
}
|
511
|
-
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
512
|
-
});
|
513
|
-
this.addHook('beforeBeginEditing', function () {
|
514
|
-
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
515
|
-
args[_key27] = arguments[_key27];
|
516
|
-
}
|
517
|
-
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
275
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
518
276
|
});
|
519
277
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
520
278
|
if (source === 'MergeCells') {
|
@@ -682,6 +440,25 @@ export class MergeCells extends BasePlugin {
|
|
682
440
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
683
441
|
}
|
684
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
|
+
|
685
462
|
/**
|
686
463
|
* Merges the selection provided as a cell range.
|
687
464
|
*
|
@@ -892,6 +669,15 @@ export class MergeCells extends BasePlugin {
|
|
892
669
|
const gridContext = shortcutManager.getContext('grid');
|
893
670
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
894
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
|
+
|
895
681
|
/**
|
896
682
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
897
683
|
*
|
@@ -948,6 +734,13 @@ export class MergeCells extends BasePlugin {
|
|
948
734
|
}
|
949
735
|
}
|
950
736
|
}
|
737
|
+
|
738
|
+
/**
|
739
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
740
|
+
*
|
741
|
+
* @param {object} calc The column calculator object.
|
742
|
+
*/
|
743
|
+
|
951
744
|
/**
|
952
745
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
953
746
|
*
|
@@ -1042,306 +835,120 @@ export class MergeCells extends BasePlugin {
|
|
1042
835
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1043
836
|
return [renderableRow, renderableColumn];
|
1044
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
|
+
*/
|
1045
846
|
}
|
1046
|
-
function
|
847
|
+
function _onAfterInit() {
|
1047
848
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1048
849
|
this.hot.render();
|
1049
850
|
}
|
1050
|
-
function
|
851
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1051
852
|
if (isMultiple) {
|
1052
853
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1053
854
|
const selectionRange = this.hot.getSelectedRangeLast();
|
1054
|
-
const topStartCoords = selectionRange.getTopStartCorner();
|
1055
|
-
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1056
855
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1057
|
-
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) {
|
1058
857
|
return false;
|
1059
858
|
}
|
1060
859
|
}
|
1061
860
|
}
|
1062
861
|
return isMultiple;
|
1063
862
|
}
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
row: 0,
|
1075
|
-
col: 0
|
1076
|
-
};
|
1077
|
-
if (delta.col < 0) {
|
1078
|
-
const {
|
1079
|
-
rowStart,
|
1080
|
-
colEnd
|
1081
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevHorizontalNode();
|
1082
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1083
|
-
const notHiddenRowStart = rowIndexMapper.getNearestNotHiddenIndex(rowStart, -1);
|
1084
|
-
if (notHiddenRowStart > highlight.row) {
|
1085
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1086
|
-
deltaCorrection.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowStart) - 1;
|
1087
|
-
} else if (notHiddenRowStart < highlight.row) {
|
1088
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1089
|
-
deltaCorrection.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowStart, highlight.row) - 1);
|
1090
|
-
} else if (notHiddenColumnIndex === null) {
|
1091
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1092
|
-
} else if (notHiddenColumnIndex <= highlight.col) {
|
1093
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1094
|
-
} else {
|
1095
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1096
|
-
}
|
1097
|
-
} else if (delta.col > 0) {
|
1098
|
-
const {
|
1099
|
-
rowStart,
|
1100
|
-
colStart
|
1101
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextHorizontalNode();
|
1102
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1103
|
-
const notHiddenRowStart = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1104
|
-
if (notHiddenRowStart > highlight.row) {
|
1105
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1106
|
-
deltaCorrection.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowStart) - 1;
|
1107
|
-
} else if (notHiddenRowStart < highlight.row) {
|
1108
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1109
|
-
deltaCorrection.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowStart, highlight.row) - 1);
|
1110
|
-
} else if (notHiddenColumnIndex === null) {
|
1111
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1112
|
-
} else if (highlight.col <= notHiddenColumnIndex) {
|
1113
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1114
|
-
} else {
|
1115
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1116
|
-
}
|
1117
|
-
}
|
1118
|
-
if (delta.row < 0) {
|
1119
|
-
const {
|
1120
|
-
colStart,
|
1121
|
-
rowEnd
|
1122
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevVerticalNode();
|
1123
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1124
|
-
const notHiddenColumnStart = columnIndexMapper.getNearestNotHiddenIndex(colStart, -1);
|
1125
|
-
if (notHiddenColumnStart > highlight.col) {
|
1126
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1127
|
-
deltaCorrection.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnStart) - 1;
|
1128
|
-
} else if (notHiddenColumnStart < highlight.col) {
|
1129
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1130
|
-
deltaCorrection.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnStart, highlight.col) - 1);
|
1131
|
-
} else if (notHiddenRowIndex === null) {
|
1132
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1133
|
-
} else if (notHiddenRowIndex <= highlight.row) {
|
1134
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1135
|
-
} else {
|
1136
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1137
|
-
}
|
1138
|
-
} else if (delta.row > 0) {
|
1139
|
-
const {
|
1140
|
-
colStart,
|
1141
|
-
rowStart
|
1142
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextVerticalNode();
|
1143
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1144
|
-
const notHiddenColumnStart = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1145
|
-
if (notHiddenColumnStart > highlight.col) {
|
1146
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1147
|
-
deltaCorrection.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnStart) - 1;
|
1148
|
-
} else if (notHiddenColumnStart < highlight.col) {
|
1149
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1150
|
-
deltaCorrection.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnStart, highlight.col) - 1);
|
1151
|
-
} else if (notHiddenRowIndex === null) {
|
1152
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1153
|
-
} else if (highlight.row <= notHiddenRowIndex) {
|
1154
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1155
|
-
} else {
|
1156
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1157
|
-
}
|
1158
|
-
}
|
1159
|
-
if (deltaCorrection.row !== 0) {
|
1160
|
-
delta.row = deltaCorrection.row;
|
1161
|
-
}
|
1162
|
-
if (deltaCorrection.col !== 0) {
|
1163
|
-
delta.col = deltaCorrection.col;
|
1164
|
-
}
|
1165
|
-
}
|
1166
|
-
function _onModifyTransformStart2(delta) {
|
1167
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1168
|
-
const {
|
1169
|
-
highlight
|
1170
|
-
} = selectedRange;
|
1171
|
-
const {
|
1172
|
-
columnIndexMapper,
|
1173
|
-
rowIndexMapper
|
1174
|
-
} = this.hot;
|
1175
|
-
if (_classPrivateFieldGet(this, _lastSelectedCoords)) {
|
1176
|
-
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedCoords).row) !== null) {
|
1177
|
-
highlight.row = _classPrivateFieldGet(this, _lastSelectedCoords).row;
|
1178
|
-
}
|
1179
|
-
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedCoords).col) !== null) {
|
1180
|
-
highlight.col = _classPrivateFieldGet(this, _lastSelectedCoords).col;
|
1181
|
-
}
|
1182
|
-
_classPrivateFieldSet(this, _lastSelectedCoords, null);
|
1183
|
-
}
|
1184
|
-
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1185
|
-
if (!mergedParent) {
|
1186
|
-
return;
|
1187
|
-
}
|
1188
|
-
const visualColumnIndexStart = mergedParent.col;
|
1189
|
-
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1190
|
-
if (delta.col < 0) {
|
1191
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1192
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1193
|
-
if (notHiddenColumnIndex === null) {
|
1194
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1195
|
-
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1196
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1197
|
-
} else {
|
1198
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1199
|
-
}
|
1200
|
-
} else if (delta.col > 0) {
|
1201
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1202
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1203
|
-
if (notHiddenColumnIndex === null) {
|
1204
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1205
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1206
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1207
|
-
} else {
|
1208
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1209
|
-
}
|
1210
|
-
}
|
1211
|
-
const visualRowIndexStart = mergedParent.row;
|
1212
|
-
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1213
|
-
if (delta.row < 0) {
|
1214
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1215
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1216
|
-
if (notHiddenRowIndex === null) {
|
1217
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1218
|
-
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1219
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1220
|
-
} else {
|
1221
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1222
|
-
}
|
1223
|
-
} else if (delta.row > 0) {
|
1224
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1225
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1226
|
-
if (notHiddenRowIndex === null) {
|
1227
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1228
|
-
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1229
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1230
|
-
} else {
|
1231
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1232
|
-
}
|
1233
|
-
}
|
1234
|
-
}
|
1235
|
-
function _onModifyTransformEnd2(delta) {
|
1236
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1237
|
-
const cloneRange = selectedRange.clone();
|
1238
|
-
const {
|
1239
|
-
to
|
1240
|
-
} = selectedRange;
|
1241
|
-
const {
|
1242
|
-
columnIndexMapper,
|
1243
|
-
rowIndexMapper
|
1244
|
-
} = this.hot;
|
1245
|
-
const expandCloneRange = (row, col) => {
|
1246
|
-
cloneRange.expand(this.hot._createCellCoords(row, col));
|
1247
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1248
|
-
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1249
|
-
}
|
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
|
1250
873
|
};
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
}
|
1257
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1258
|
-
if (notHiddenColumnIndex !== null) {
|
1259
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1260
|
-
}
|
1261
|
-
} else if (delta.col > 0) {
|
1262
|
-
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1263
|
-
expandCloneRange(to.row, nextColumn);
|
1264
|
-
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1265
|
-
nextColumn = cloneRange.getBottomEndCorner().col;
|
1266
|
-
}
|
1267
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1268
|
-
if (notHiddenColumnIndex !== null) {
|
1269
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1270
|
-
}
|
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));
|
1271
879
|
}
|
1272
|
-
if (
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
if (notHiddenRowIndex !== null) {
|
1280
|
-
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
|
1281
887
|
}
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
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;
|
1287
896
|
}
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
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;
|
1291
903
|
}
|
1292
904
|
}
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
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
|
+
};
|
1302
915
|
}
|
1303
|
-
|
1304
|
-
|
1305
|
-
const bottomEndCorner = selectedRange.getBottomEndCorner();
|
1306
|
-
if (delta.col > 0) {
|
1307
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(topEndCorner.col, coords.col) - 1;
|
1308
|
-
restDelta.col = Math.max(renderableColumns, 1);
|
1309
|
-
} else if (delta.col < 0) {
|
1310
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(coords.col, topStartCorner.col) - 1;
|
1311
|
-
restDelta.col = -Math.max(renderableColumns, 1);
|
916
|
+
if (newDelta.row !== 0) {
|
917
|
+
delta.row = newDelta.row;
|
1312
918
|
}
|
1313
|
-
if (
|
1314
|
-
|
1315
|
-
restDelta.row = Math.max(renderableRows, 1);
|
1316
|
-
} else if (delta.row < 0) {
|
1317
|
-
const renderableRows = this.hot.view.countRenderableRowsInRange(coords.row, topStartCorner.row) - 1;
|
1318
|
-
restDelta.row = -Math.max(renderableRows, 1);
|
919
|
+
if (newDelta.col !== 0) {
|
920
|
+
delta.col = newDelta.col;
|
1319
921
|
}
|
1320
922
|
}
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
highlight.assign(mergedParent);
|
1342
|
-
}
|
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;
|
1343
943
|
}
|
1344
|
-
|
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) {
|
1345
952
|
if (row < 0 || column < 0) {
|
1346
953
|
return;
|
1347
954
|
}
|
@@ -1361,12 +968,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1361
968
|
// Most bottom-right merged cell coords.
|
1362
969
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1363
970
|
}
|
1364
|
-
|
971
|
+
/**
|
972
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
973
|
+
*
|
974
|
+
* @param {object} defaultOptions The default context menu options.
|
975
|
+
*/
|
976
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1365
977
|
defaultOptions.items.push({
|
1366
978
|
name: '---------'
|
1367
979
|
}, toggleMergeItem(this));
|
1368
980
|
}
|
1369
|
-
|
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) {
|
1370
989
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1371
990
|
// We shouldn't override data in the collection.
|
1372
991
|
const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : undefined;
|
@@ -1398,19 +1017,61 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1398
1017
|
}
|
1399
1018
|
applySpanProperties(TD, mergedCellCopy, row, col);
|
1400
1019
|
}
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
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)) {
|
1033
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1034
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1035
|
+
}
|
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
|
}
|