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,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.array.push.js");
|
5
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
require("core-js/modules/es.array.push.js");
|
6
6
|
var _base = require("../base");
|
7
7
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
8
8
|
var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
|
@@ -17,7 +17,6 @@ var _number = require("../../helpers/number");
|
|
17
17
|
var _utils = require("./utils");
|
18
18
|
var _element = require("../../helpers/dom/element");
|
19
19
|
var _browser = require("../../helpers/browser");
|
20
|
-
var _focusOrder2 = require("./focusOrder");
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22
21
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
23
22
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
@@ -25,12 +24,9 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
25
24
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
26
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
27
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
28
|
-
function _classPrivateFieldSet(
|
29
|
-
function
|
30
|
-
function
|
31
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
32
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
33
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
27
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
28
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
29
|
+
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"); }
|
34
30
|
_pluginHooks.default.getSingleton().register('beforeMergeCells');
|
35
31
|
_pluginHooks.default.getSingleton().register('afterMergeCells');
|
36
32
|
_pluginHooks.default.getSingleton().register('beforeUnmergeCells');
|
@@ -76,219 +72,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
76
72
|
* ```
|
77
73
|
* :::
|
78
74
|
*/
|
79
|
-
var
|
80
|
-
var
|
81
|
-
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
82
|
-
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onModifyTransformFocus = /*#__PURE__*/new WeakSet();
|
84
|
-
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
85
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
86
|
-
var _onModifyTransformEndRestDelta = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
89
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
90
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onAfterSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
99
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
100
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
101
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
102
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
103
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
104
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
105
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
106
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
75
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
76
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
107
77
|
class MergeCells extends _base.BasePlugin {
|
108
78
|
constructor() {
|
109
79
|
super(...arguments);
|
110
|
-
/**
|
111
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
112
|
-
*
|
113
|
-
* @param {number} row Visual row index of the edited cell.
|
114
|
-
* @param {number} column Visual column index of the edited cell.
|
115
|
-
* @param {string | null} initialValue The initial editor value.
|
116
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
117
|
-
* @returns {boolean | undefined}
|
118
|
-
*/
|
119
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
120
|
-
/**
|
121
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
122
|
-
*
|
123
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
124
|
-
* all the cells in the table.
|
125
|
-
*/
|
126
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
127
|
-
/**
|
128
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
129
|
-
*
|
130
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
131
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
132
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
133
|
-
* endColumn]`.
|
134
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
135
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
136
|
-
* processed cell.
|
137
|
-
*/
|
138
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
139
|
-
/**
|
140
|
-
* `beforeDrawAreaBorders` hook callback.
|
141
|
-
*
|
142
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
143
|
-
* @param {string} className Class name for the area.
|
144
|
-
*/
|
145
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
146
|
-
/**
|
147
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
148
|
-
*
|
149
|
-
* @param {Array} changes The changes array.
|
150
|
-
* @param {string} source Determines the source of the change.
|
151
|
-
*/
|
152
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
153
|
-
/**
|
154
|
-
* `afterRemoveRow` hook callback.
|
155
|
-
*
|
156
|
-
* @param {number} row Row index.
|
157
|
-
* @param {number} count Number of removed rows.
|
158
|
-
*/
|
159
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
160
|
-
/**
|
161
|
-
* `afterCreateRow` hook callback.
|
162
|
-
*
|
163
|
-
* @param {number} row Row index.
|
164
|
-
* @param {number} count Number of created rows.
|
165
|
-
* @param {string} source Source of change.
|
166
|
-
*/
|
167
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
168
|
-
/**
|
169
|
-
* `afterRemoveCol` hook callback.
|
170
|
-
*
|
171
|
-
* @param {number} column Column index.
|
172
|
-
* @param {number} count Number of removed columns.
|
173
|
-
*/
|
174
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
175
|
-
/**
|
176
|
-
* `afterCreateCol` hook callback.
|
177
|
-
*
|
178
|
-
* @param {number} column Column index.
|
179
|
-
* @param {number} count Number of created columns.
|
180
|
-
*/
|
181
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
182
|
-
/**
|
183
|
-
* The `modifyAutofillRange` hook callback.
|
184
|
-
*
|
185
|
-
* @param {Array} drag The drag area coordinates.
|
186
|
-
* @param {Array} select The selection information.
|
187
|
-
* @returns {Array} The new drag area.
|
188
|
-
*/
|
189
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
190
|
-
/**
|
191
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
192
|
-
*
|
193
|
-
* @param {object} calc The column calculator object.
|
194
|
-
*/
|
195
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
196
|
-
/**
|
197
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
198
|
-
*
|
199
|
-
* @param {object} calc The row calculator object.
|
200
|
-
*/
|
201
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
202
|
-
/**
|
203
|
-
* The `afterGetCellMeta` hook callback.
|
204
|
-
*
|
205
|
-
* @param {number} row Row index.
|
206
|
-
* @param {number} col Column index.
|
207
|
-
* @param {object} cellProperties The cell properties object.
|
208
|
-
*/
|
209
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
210
|
-
/**
|
211
|
-
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
212
|
-
*/
|
213
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
214
|
-
/**
|
215
|
-
* Searches for the node that is currently focused within the vertical and horizontal linked lists.
|
216
|
-
*
|
217
|
-
* @param {number} row Visual row index.
|
218
|
-
* @param {number} column Visual column index.
|
219
|
-
*/
|
220
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionFocusSet);
|
221
|
-
/**
|
222
|
-
* Clears the last selected coordinates before setting a new selection range.
|
223
|
-
*/
|
224
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
225
|
-
/**
|
226
|
-
* `afterRenderer` hook callback.
|
227
|
-
*
|
228
|
-
* @param {HTMLElement} TD The cell to be modified.
|
229
|
-
* @param {number} row Row index.
|
230
|
-
* @param {number} col Visual column index.
|
231
|
-
*/
|
232
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
233
|
-
/**
|
234
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
235
|
-
*
|
236
|
-
* @param {object} defaultOptions The default context menu options.
|
237
|
-
*/
|
238
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
239
|
-
/**
|
240
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
241
|
-
*
|
242
|
-
* @param {number} row Row index.
|
243
|
-
* @param {number} column Visual column index.
|
244
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
245
|
-
*/
|
246
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
247
|
-
/**
|
248
|
-
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
249
|
-
* It expands the range to cover the entire area of the selected merged cells.
|
250
|
-
*/
|
251
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
252
|
-
/**
|
253
|
-
* The hooks allows to modify the delta transformation object necessary for correct selection end transformations.
|
254
|
-
*
|
255
|
-
* @param {{ row: number, col: number }} restDelta The transformation delta for the rest of the selection.
|
256
|
-
* @param {{ row: number, col: number }} delta The general transformation delta.
|
257
|
-
* @param {CellCoords} coords The coordinates of the next position of the end selection.
|
258
|
-
*/
|
259
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEndRestDelta);
|
260
|
-
/**
|
261
|
-
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
262
|
-
* The logic here handles "jumping over" merged merged cells, while selecting.
|
263
|
-
*
|
264
|
-
* @param {{ row: number, col: number }} delta The transformation delta.
|
265
|
-
*/
|
266
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
267
|
-
/**
|
268
|
-
* `modifyTransformStart` hook callback.
|
269
|
-
*
|
270
|
-
* @param {object} delta The transformation delta.
|
271
|
-
*/
|
272
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
273
|
-
/**
|
274
|
-
* The hook controls the position of the focus position. For merge cells there is need to shift the focus to the
|
275
|
-
* next merged cell not to the next hidden cell (overlapped by merged cell).
|
276
|
-
*
|
277
|
-
* @param {object} delta The transformation delta.
|
278
|
-
*/
|
279
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformFocus);
|
280
|
-
/**
|
281
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
282
|
-
* hook callback.
|
283
|
-
*
|
284
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
285
|
-
* @returns {boolean}
|
286
|
-
*/
|
287
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
288
80
|
/**
|
289
81
|
* `afterInit` hook callback.
|
290
82
|
*/
|
291
|
-
_classPrivateMethodInitSpec(this,
|
83
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
292
84
|
/**
|
293
85
|
* A container for all the merged cells.
|
294
86
|
*
|
@@ -311,25 +103,9 @@ class MergeCells extends _base.BasePlugin {
|
|
311
103
|
*/
|
312
104
|
_defineProperty(this, "selectionCalculations", null);
|
313
105
|
/**
|
314
|
-
* The holder for the last selected coordinates. This allows keeping the correct coordinates in cases after the
|
315
|
-
* focus is moved out of the merged cell.
|
316
|
-
*
|
317
106
|
* @type {CellCoords}
|
318
107
|
*/
|
319
|
-
_classPrivateFieldInitSpec(this,
|
320
|
-
writable: true,
|
321
|
-
value: null
|
322
|
-
});
|
323
|
-
/**
|
324
|
-
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
325
|
-
* contains merged cells.
|
326
|
-
*
|
327
|
-
* @type {FocusOrder}
|
328
|
-
*/
|
329
|
-
_classPrivateFieldInitSpec(this, _focusOrder, {
|
330
|
-
writable: true,
|
331
|
-
value: new _focusOrder2.FocusOrder((row, column) => this.mergedCellsCollection.get(row, column))
|
332
|
-
});
|
108
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, null);
|
333
109
|
}
|
334
110
|
static get PLUGIN_KEY() {
|
335
111
|
return PLUGIN_KEY;
|
@@ -362,163 +138,145 @@ class MergeCells extends _base.BasePlugin {
|
|
362
138
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
363
139
|
args[_key] = arguments[_key];
|
364
140
|
}
|
365
|
-
return
|
141
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
366
142
|
});
|
367
|
-
this.addHook('
|
143
|
+
this.addHook('modifyTransformStart', function () {
|
368
144
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
369
145
|
args[_key2] = arguments[_key2];
|
370
146
|
}
|
371
|
-
return
|
147
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
372
148
|
});
|
373
|
-
this.addHook('
|
149
|
+
this.addHook('afterModifyTransformStart', function () {
|
374
150
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
375
151
|
args[_key3] = arguments[_key3];
|
376
152
|
}
|
377
|
-
return
|
153
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterModifyTransformStart).call(_this, ...args);
|
378
154
|
});
|
379
155
|
this.addHook('modifyTransformEnd', function () {
|
380
156
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
381
157
|
args[_key4] = arguments[_key4];
|
382
158
|
}
|
383
|
-
return
|
159
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
384
160
|
});
|
385
|
-
this.addHook('
|
161
|
+
this.addHook('modifyGetCellCoords', function () {
|
386
162
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
387
163
|
args[_key5] = arguments[_key5];
|
388
164
|
}
|
389
|
-
return
|
165
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
390
166
|
});
|
391
|
-
this.addHook('
|
167
|
+
this.addHook('beforeSetRangeStart', function () {
|
392
168
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
393
169
|
args[_key6] = arguments[_key6];
|
394
170
|
}
|
395
|
-
return
|
171
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
396
172
|
});
|
397
|
-
this.addHook('
|
173
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
398
174
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
399
175
|
args[_key7] = arguments[_key7];
|
400
176
|
}
|
401
|
-
return
|
177
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
402
178
|
});
|
403
|
-
this.addHook('
|
179
|
+
this.addHook('beforeSetRangeEnd', function () {
|
404
180
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
405
181
|
args[_key8] = arguments[_key8];
|
406
182
|
}
|
407
|
-
return
|
183
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeEnd).call(_this, ...args);
|
408
184
|
});
|
409
|
-
this.addHook('
|
185
|
+
this.addHook('afterIsMultipleSelection', function () {
|
410
186
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
411
187
|
args[_key9] = arguments[_key9];
|
412
188
|
}
|
413
|
-
return
|
189
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
414
190
|
});
|
415
|
-
this.addHook('
|
191
|
+
this.addHook('afterRenderer', function () {
|
416
192
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
417
193
|
args[_key10] = arguments[_key10];
|
418
194
|
}
|
419
|
-
return
|
195
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
420
196
|
});
|
421
|
-
this.addHook('
|
197
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
422
198
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
423
199
|
args[_key11] = arguments[_key11];
|
424
200
|
}
|
425
|
-
return
|
201
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
426
202
|
});
|
427
|
-
this.addHook('
|
203
|
+
this.addHook('afterGetCellMeta', function () {
|
428
204
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
429
205
|
args[_key12] = arguments[_key12];
|
430
206
|
}
|
431
|
-
return
|
207
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
432
208
|
});
|
433
|
-
this.addHook('
|
209
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
434
210
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
435
211
|
args[_key13] = arguments[_key13];
|
436
212
|
}
|
437
|
-
return
|
213
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
438
214
|
});
|
439
|
-
this.addHook('
|
215
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
440
216
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
441
217
|
args[_key14] = arguments[_key14];
|
442
218
|
}
|
443
|
-
return
|
219
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
444
220
|
});
|
445
|
-
this.addHook('
|
221
|
+
this.addHook('modifyAutofillRange', function () {
|
446
222
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
447
223
|
args[_key15] = arguments[_key15];
|
448
224
|
}
|
449
|
-
return
|
225
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
450
226
|
});
|
451
|
-
this.addHook('
|
227
|
+
this.addHook('afterCreateCol', function () {
|
452
228
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
453
229
|
args[_key16] = arguments[_key16];
|
454
230
|
}
|
455
|
-
return
|
231
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
456
232
|
});
|
457
|
-
this.addHook('
|
233
|
+
this.addHook('afterRemoveCol', function () {
|
458
234
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
459
235
|
args[_key17] = arguments[_key17];
|
460
236
|
}
|
461
|
-
return
|
237
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
462
238
|
});
|
463
|
-
this.addHook('
|
239
|
+
this.addHook('afterCreateRow', function () {
|
464
240
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
465
241
|
args[_key18] = arguments[_key18];
|
466
242
|
}
|
467
|
-
return
|
243
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
468
244
|
});
|
469
|
-
this.addHook('
|
245
|
+
this.addHook('afterRemoveRow', function () {
|
470
246
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
471
247
|
args[_key19] = arguments[_key19];
|
472
248
|
}
|
473
|
-
return
|
249
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
474
250
|
});
|
475
|
-
this.addHook('
|
251
|
+
this.addHook('afterChange', function () {
|
476
252
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
477
253
|
args[_key20] = arguments[_key20];
|
478
254
|
}
|
479
|
-
return
|
255
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
480
256
|
});
|
481
|
-
this.addHook('
|
257
|
+
this.addHook('beforeDrawBorders', function () {
|
482
258
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
483
259
|
args[_key21] = arguments[_key21];
|
484
260
|
}
|
485
|
-
return
|
261
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
486
262
|
});
|
487
|
-
this.addHook('
|
263
|
+
this.addHook('afterDrawSelection', function () {
|
488
264
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
489
265
|
args[_key22] = arguments[_key22];
|
490
266
|
}
|
491
|
-
return
|
267
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
492
268
|
});
|
493
|
-
this.addHook('
|
269
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
494
270
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
495
271
|
args[_key23] = arguments[_key23];
|
496
272
|
}
|
497
|
-
return
|
273
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
498
274
|
});
|
499
|
-
this.addHook('
|
275
|
+
this.addHook('beforeBeginEditing', function () {
|
500
276
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
501
277
|
args[_key24] = arguments[_key24];
|
502
278
|
}
|
503
|
-
return
|
504
|
-
});
|
505
|
-
this.addHook('afterDrawSelection', function () {
|
506
|
-
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
507
|
-
args[_key25] = arguments[_key25];
|
508
|
-
}
|
509
|
-
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
510
|
-
});
|
511
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
512
|
-
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
513
|
-
args[_key26] = arguments[_key26];
|
514
|
-
}
|
515
|
-
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
516
|
-
});
|
517
|
-
this.addHook('beforeBeginEditing', function () {
|
518
|
-
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
519
|
-
args[_key27] = arguments[_key27];
|
520
|
-
}
|
521
|
-
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
279
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
522
280
|
});
|
523
281
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
524
282
|
if (source === 'MergeCells') {
|
@@ -686,6 +444,25 @@ class MergeCells extends _base.BasePlugin {
|
|
686
444
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
687
445
|
}
|
688
446
|
|
447
|
+
/**
|
448
|
+
* Merge or unmerge, based on last selected range.
|
449
|
+
*
|
450
|
+
* @private
|
451
|
+
*/
|
452
|
+
toggleMergeOnSelection() {
|
453
|
+
const currentRange = this.hot.getSelectedRangeLast();
|
454
|
+
if (!currentRange) {
|
455
|
+
return;
|
456
|
+
}
|
457
|
+
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
458
|
+
const {
|
459
|
+
from,
|
460
|
+
to
|
461
|
+
} = currentRange;
|
462
|
+
this.toggleMerge(currentRange);
|
463
|
+
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
464
|
+
}
|
465
|
+
|
689
466
|
/**
|
690
467
|
* Merges the selection provided as a cell range.
|
691
468
|
*
|
@@ -896,6 +673,15 @@ class MergeCells extends _base.BasePlugin {
|
|
896
673
|
const gridContext = shortcutManager.getContext('grid');
|
897
674
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
898
675
|
}
|
676
|
+
|
677
|
+
/**
|
678
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
679
|
+
* hook callback.
|
680
|
+
*
|
681
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
682
|
+
* @returns {boolean}
|
683
|
+
*/
|
684
|
+
|
899
685
|
/**
|
900
686
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
901
687
|
*
|
@@ -952,6 +738,13 @@ class MergeCells extends _base.BasePlugin {
|
|
952
738
|
}
|
953
739
|
}
|
954
740
|
}
|
741
|
+
|
742
|
+
/**
|
743
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
744
|
+
*
|
745
|
+
* @param {object} calc The column calculator object.
|
746
|
+
*/
|
747
|
+
|
955
748
|
/**
|
956
749
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
957
750
|
*
|
@@ -1046,307 +839,121 @@ class MergeCells extends _base.BasePlugin {
|
|
1046
839
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1047
840
|
return [renderableRow, renderableColumn];
|
1048
841
|
}
|
842
|
+
|
843
|
+
/**
|
844
|
+
* The `modifyAutofillRange` hook callback.
|
845
|
+
*
|
846
|
+
* @param {Array} drag The drag area coordinates.
|
847
|
+
* @param {Array} select The selection information.
|
848
|
+
* @returns {Array} The new drag area.
|
849
|
+
*/
|
1049
850
|
}
|
1050
851
|
exports.MergeCells = MergeCells;
|
1051
|
-
function
|
852
|
+
function _onAfterInit() {
|
1052
853
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1053
854
|
this.hot.render();
|
1054
855
|
}
|
1055
|
-
function
|
856
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1056
857
|
if (isMultiple) {
|
1057
858
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1058
859
|
const selectionRange = this.hot.getSelectedRangeLast();
|
1059
|
-
const topStartCoords = selectionRange.getTopStartCorner();
|
1060
|
-
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1061
860
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1062
|
-
if (
|
861
|
+
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) {
|
1063
862
|
return false;
|
1064
863
|
}
|
1065
864
|
}
|
1066
865
|
}
|
1067
866
|
return isMultiple;
|
1068
867
|
}
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
row: 0,
|
1080
|
-
col: 0
|
1081
|
-
};
|
1082
|
-
if (delta.col < 0) {
|
1083
|
-
const {
|
1084
|
-
rowStart,
|
1085
|
-
colEnd
|
1086
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevHorizontalNode();
|
1087
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1088
|
-
const notHiddenRowStart = rowIndexMapper.getNearestNotHiddenIndex(rowStart, -1);
|
1089
|
-
if (notHiddenRowStart > highlight.row) {
|
1090
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1091
|
-
deltaCorrection.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowStart) - 1;
|
1092
|
-
} else if (notHiddenRowStart < highlight.row) {
|
1093
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1094
|
-
deltaCorrection.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowStart, highlight.row) - 1);
|
1095
|
-
} else if (notHiddenColumnIndex === null) {
|
1096
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1097
|
-
} else if (notHiddenColumnIndex <= highlight.col) {
|
1098
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1099
|
-
} else {
|
1100
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1;
|
1101
|
-
}
|
1102
|
-
} else if (delta.col > 0) {
|
1103
|
-
const {
|
1104
|
-
rowStart,
|
1105
|
-
colStart
|
1106
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextHorizontalNode();
|
1107
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1108
|
-
const notHiddenRowStart = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1109
|
-
if (notHiddenRowStart > highlight.row) {
|
1110
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1111
|
-
deltaCorrection.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowStart) - 1;
|
1112
|
-
} else if (notHiddenRowStart < highlight.row) {
|
1113
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1114
|
-
deltaCorrection.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowStart, highlight.row) - 1);
|
1115
|
-
} else if (notHiddenColumnIndex === null) {
|
1116
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1117
|
-
} else if (highlight.col <= notHiddenColumnIndex) {
|
1118
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1119
|
-
} else {
|
1120
|
-
delta.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1);
|
1121
|
-
}
|
1122
|
-
}
|
1123
|
-
if (delta.row < 0) {
|
1124
|
-
const {
|
1125
|
-
colStart,
|
1126
|
-
rowEnd
|
1127
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevVerticalNode();
|
1128
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1129
|
-
const notHiddenColumnStart = columnIndexMapper.getNearestNotHiddenIndex(colStart, -1);
|
1130
|
-
if (notHiddenColumnStart > highlight.col) {
|
1131
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1132
|
-
deltaCorrection.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnStart) - 1;
|
1133
|
-
} else if (notHiddenColumnStart < highlight.col) {
|
1134
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1135
|
-
deltaCorrection.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnStart, highlight.col) - 1);
|
1136
|
-
} else if (notHiddenRowIndex === null) {
|
1137
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1138
|
-
} else if (notHiddenRowIndex <= highlight.row) {
|
1139
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1140
|
-
} else {
|
1141
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1;
|
1142
|
-
}
|
1143
|
-
} else if (delta.row > 0) {
|
1144
|
-
const {
|
1145
|
-
colStart,
|
1146
|
-
rowStart
|
1147
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextVerticalNode();
|
1148
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1149
|
-
const notHiddenColumnStart = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1150
|
-
if (notHiddenColumnStart > highlight.col) {
|
1151
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1152
|
-
deltaCorrection.col = this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnStart) - 1;
|
1153
|
-
} else if (notHiddenColumnStart < highlight.col) {
|
1154
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1155
|
-
deltaCorrection.col = -(this.hot.view.countRenderableColumnsInRange(notHiddenColumnStart, highlight.col) - 1);
|
1156
|
-
} else if (notHiddenRowIndex === null) {
|
1157
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1158
|
-
} else if (highlight.row <= notHiddenRowIndex) {
|
1159
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1160
|
-
} else {
|
1161
|
-
delta.row = -(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1);
|
1162
|
-
}
|
1163
|
-
}
|
1164
|
-
if (deltaCorrection.row !== 0) {
|
1165
|
-
delta.row = deltaCorrection.row;
|
1166
|
-
}
|
1167
|
-
if (deltaCorrection.col !== 0) {
|
1168
|
-
delta.col = deltaCorrection.col;
|
1169
|
-
}
|
1170
|
-
}
|
1171
|
-
function _onModifyTransformStart2(delta) {
|
1172
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1173
|
-
const {
|
1174
|
-
highlight
|
1175
|
-
} = selectedRange;
|
1176
|
-
const {
|
1177
|
-
columnIndexMapper,
|
1178
|
-
rowIndexMapper
|
1179
|
-
} = this.hot;
|
1180
|
-
if (_classPrivateFieldGet(this, _lastSelectedCoords)) {
|
1181
|
-
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedCoords).row) !== null) {
|
1182
|
-
highlight.row = _classPrivateFieldGet(this, _lastSelectedCoords).row;
|
1183
|
-
}
|
1184
|
-
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedCoords).col) !== null) {
|
1185
|
-
highlight.col = _classPrivateFieldGet(this, _lastSelectedCoords).col;
|
1186
|
-
}
|
1187
|
-
_classPrivateFieldSet(this, _lastSelectedCoords, null);
|
1188
|
-
}
|
1189
|
-
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1190
|
-
if (!mergedParent) {
|
1191
|
-
return;
|
1192
|
-
}
|
1193
|
-
const visualColumnIndexStart = mergedParent.col;
|
1194
|
-
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1195
|
-
if (delta.col < 0) {
|
1196
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1197
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1198
|
-
if (notHiddenColumnIndex === null) {
|
1199
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1200
|
-
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1201
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1202
|
-
} else {
|
1203
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1204
|
-
}
|
1205
|
-
} else if (delta.col > 0) {
|
1206
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1207
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1208
|
-
if (notHiddenColumnIndex === null) {
|
1209
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1210
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1211
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1212
|
-
} else {
|
1213
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1214
|
-
}
|
1215
|
-
}
|
1216
|
-
const visualRowIndexStart = mergedParent.row;
|
1217
|
-
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1218
|
-
if (delta.row < 0) {
|
1219
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1220
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1221
|
-
if (notHiddenRowIndex === null) {
|
1222
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1223
|
-
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1224
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1225
|
-
} else {
|
1226
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1227
|
-
}
|
1228
|
-
} else if (delta.row > 0) {
|
1229
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1230
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1231
|
-
if (notHiddenRowIndex === null) {
|
1232
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1233
|
-
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1234
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1235
|
-
} else {
|
1236
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1237
|
-
}
|
1238
|
-
}
|
1239
|
-
}
|
1240
|
-
function _onModifyTransformEnd2(delta) {
|
1241
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1242
|
-
const cloneRange = selectedRange.clone();
|
1243
|
-
const {
|
1244
|
-
to
|
1245
|
-
} = selectedRange;
|
1246
|
-
const {
|
1247
|
-
columnIndexMapper,
|
1248
|
-
rowIndexMapper
|
1249
|
-
} = this.hot;
|
1250
|
-
const expandCloneRange = (row, col) => {
|
1251
|
-
cloneRange.expand(this.hot._createCellCoords(row, col));
|
1252
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1253
|
-
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1254
|
-
}
|
868
|
+
/**
|
869
|
+
* `modifyTransformStart` hook callback.
|
870
|
+
*
|
871
|
+
* @param {object} delta The transformation delta.
|
872
|
+
*/
|
873
|
+
function _onModifyTransformStart(delta) {
|
874
|
+
const currentlySelectedRange = this.hot.getSelectedRangeLast();
|
875
|
+
let newDelta = {
|
876
|
+
row: delta.row,
|
877
|
+
col: delta.col
|
1255
878
|
};
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
}
|
1262
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1263
|
-
if (notHiddenColumnIndex !== null) {
|
1264
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1265
|
-
}
|
1266
|
-
} else if (delta.col > 0) {
|
1267
|
-
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1268
|
-
expandCloneRange(to.row, nextColumn);
|
1269
|
-
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1270
|
-
nextColumn = cloneRange.getBottomEndCorner().col;
|
1271
|
-
}
|
1272
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1273
|
-
if (notHiddenColumnIndex !== null) {
|
1274
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1275
|
-
}
|
879
|
+
let nextPosition = null;
|
880
|
+
const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
|
881
|
+
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
882
|
+
if (!_classPrivateFieldGet(_lastDesiredCoords, this)) {
|
883
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null));
|
1276
884
|
}
|
1277
|
-
if (
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
if (notHiddenRowIndex !== null) {
|
1285
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
885
|
+
if (mergedParent) {
|
886
|
+
// only merge selected
|
887
|
+
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
888
|
+
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
889
|
+
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
890
|
+
if (!mergeRange.includes(_classPrivateFieldGet(_lastDesiredCoords, this))) {
|
891
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1286
892
|
}
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
893
|
+
newDelta.row = _classPrivateFieldGet(_lastDesiredCoords, this).row ? _classPrivateFieldGet(_lastDesiredCoords, this).row - currentPosition.row : newDelta.row;
|
894
|
+
newDelta.col = _classPrivateFieldGet(_lastDesiredCoords, this).col ? _classPrivateFieldGet(_lastDesiredCoords, this).col - currentPosition.col : newDelta.col;
|
895
|
+
if (delta.row > 0) {
|
896
|
+
// moving down
|
897
|
+
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
898
|
+
} else if (delta.row < 0) {
|
899
|
+
// moving up
|
900
|
+
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1292
901
|
}
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
902
|
+
if (delta.col > 0) {
|
903
|
+
// moving right
|
904
|
+
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
905
|
+
} else if (delta.col < 0) {
|
906
|
+
// moving left
|
907
|
+
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
1296
908
|
}
|
1297
909
|
}
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
910
|
+
nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
|
911
|
+
const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
|
912
|
+
if (nextPositionMergedCell) {
|
913
|
+
// skipping the invisible cells in the merge range
|
914
|
+
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
915
|
+
_classPrivateFieldSet(_lastDesiredCoords, this, nextPosition);
|
916
|
+
newDelta = {
|
917
|
+
row: firstRenderableCoords.row - currentPosition.row,
|
918
|
+
col: firstRenderableCoords.col - currentPosition.col
|
919
|
+
};
|
1307
920
|
}
|
1308
|
-
|
1309
|
-
|
1310
|
-
const bottomEndCorner = selectedRange.getBottomEndCorner();
|
1311
|
-
if (delta.col > 0) {
|
1312
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(topEndCorner.col, coords.col) - 1;
|
1313
|
-
restDelta.col = Math.max(renderableColumns, 1);
|
1314
|
-
} else if (delta.col < 0) {
|
1315
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(coords.col, topStartCorner.col) - 1;
|
1316
|
-
restDelta.col = -Math.max(renderableColumns, 1);
|
921
|
+
if (newDelta.row !== 0) {
|
922
|
+
delta.row = newDelta.row;
|
1317
923
|
}
|
1318
|
-
if (
|
1319
|
-
|
1320
|
-
restDelta.row = Math.max(renderableRows, 1);
|
1321
|
-
} else if (delta.row < 0) {
|
1322
|
-
const renderableRows = this.hot.view.countRenderableRowsInRange(coords.row, topStartCorner.row) - 1;
|
1323
|
-
restDelta.row = -Math.max(renderableRows, 1);
|
924
|
+
if (newDelta.col !== 0) {
|
925
|
+
delta.col = newDelta.col;
|
1324
926
|
}
|
1325
927
|
}
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
highlight.assign(mergedParent);
|
1347
|
-
}
|
928
|
+
/**
|
929
|
+
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
930
|
+
*
|
931
|
+
* @param {object} delta The transformation delta.
|
932
|
+
*/
|
933
|
+
function _onModifyTransformEnd(delta) {
|
934
|
+
const currentSelectionRange = this.hot.getSelectedRangeLast();
|
935
|
+
const newDelta = (0, _object.clone)(delta);
|
936
|
+
const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
|
937
|
+
let tempDelta = (0, _object.clone)(newDelta);
|
938
|
+
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
|
939
|
+
do {
|
940
|
+
tempDelta = (0, _object.clone)(newDelta);
|
941
|
+
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
942
|
+
(0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
|
943
|
+
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
944
|
+
});
|
945
|
+
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
946
|
+
delta.row = newDelta.row;
|
947
|
+
delta.col = newDelta.col;
|
1348
948
|
}
|
1349
|
-
|
949
|
+
/**
|
950
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
951
|
+
*
|
952
|
+
* @param {number} row Row index.
|
953
|
+
* @param {number} column Visual column index.
|
954
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
955
|
+
*/
|
956
|
+
function _onModifyGetCellCoords(row, column) {
|
1350
957
|
if (row < 0 || column < 0) {
|
1351
958
|
return;
|
1352
959
|
}
|
@@ -1366,12 +973,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1366
973
|
// Most bottom-right merged cell coords.
|
1367
974
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1368
975
|
}
|
1369
|
-
|
976
|
+
/**
|
977
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
978
|
+
*
|
979
|
+
* @param {object} defaultOptions The default context menu options.
|
980
|
+
*/
|
981
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1370
982
|
defaultOptions.items.push({
|
1371
983
|
name: '---------'
|
1372
984
|
}, (0, _toggleMerge.default)(this));
|
1373
985
|
}
|
1374
|
-
|
986
|
+
/**
|
987
|
+
* `afterRenderer` hook callback.
|
988
|
+
*
|
989
|
+
* @param {HTMLElement} TD The cell to be modified.
|
990
|
+
* @param {number} row Row index.
|
991
|
+
* @param {number} col Visual column index.
|
992
|
+
*/
|
993
|
+
function _onAfterRenderer(TD, row, col) {
|
1375
994
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1376
995
|
// We shouldn't override data in the collection.
|
1377
996
|
const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
|
@@ -1403,19 +1022,61 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1403
1022
|
}
|
1404
1023
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1405
1024
|
}
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1025
|
+
/**
|
1026
|
+
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
1027
|
+
* A selection within merge area should be rewritten to the start of merge area.
|
1028
|
+
*
|
1029
|
+
* @param {object} coords Cell coords.
|
1030
|
+
*/
|
1031
|
+
function _onBeforeSetRangeStart(coords) {
|
1032
|
+
// TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
|
1033
|
+
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
1034
|
+
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
1035
|
+
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
1036
|
+
// and what was idea for flipping direction inside `expandByRange` method.
|
1037
|
+
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1038
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1039
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1040
|
+
}
|
1411
1041
|
}
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1042
|
+
/**
|
1043
|
+
* `beforeSetRangeEnd` hook callback.
|
1044
|
+
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
1045
|
+
* merged cell.
|
1046
|
+
*
|
1047
|
+
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
1048
|
+
*
|
1049
|
+
* @param {object} coords Cell coords.
|
1050
|
+
*/
|
1051
|
+
function _onBeforeSetRangeEnd(coords) {
|
1052
|
+
const selRange = this.hot.getSelectedRangeLast();
|
1053
|
+
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
1054
|
+
selRange.to = coords;
|
1055
|
+
let rangeExpanded = false;
|
1056
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1057
|
+
return;
|
1416
1058
|
}
|
1059
|
+
do {
|
1060
|
+
rangeExpanded = false;
|
1061
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1062
|
+
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1063
|
+
const mergedCellRange = cellInfo.getRange();
|
1064
|
+
if (selRange.expandByRange(mergedCellRange)) {
|
1065
|
+
coords.row = selRange.to.row;
|
1066
|
+
coords.col = selRange.to.col;
|
1067
|
+
rangeExpanded = true;
|
1068
|
+
}
|
1069
|
+
}
|
1070
|
+
} while (rangeExpanded);
|
1417
1071
|
}
|
1418
|
-
|
1072
|
+
/**
|
1073
|
+
* The `afterGetCellMeta` hook callback.
|
1074
|
+
*
|
1075
|
+
* @param {number} row Row index.
|
1076
|
+
* @param {number} col Column index.
|
1077
|
+
* @param {object} cellProperties The cell properties object.
|
1078
|
+
*/
|
1079
|
+
function _onAfterGetCellMeta(row, col, cellProperties) {
|
1419
1080
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1420
1081
|
if (mergeParent) {
|
1421
1082
|
if (mergeParent.row !== row || mergeParent.col !== col) {
|
@@ -1426,17 +1087,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
|
|
1426
1087
|
}
|
1427
1088
|
}
|
1428
1089
|
}
|
1429
|
-
|
1090
|
+
/**
|
1091
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
1092
|
+
*
|
1093
|
+
* @param {object} calc The row calculator object.
|
1094
|
+
*/
|
1095
|
+
function _onAfterViewportRowCalculatorOverride(calc) {
|
1430
1096
|
const nrOfColumns = this.hot.countCols();
|
1431
1097
|
this.modifyViewportRowStart(calc, nrOfColumns);
|
1432
1098
|
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1433
1099
|
}
|
1434
|
-
function
|
1100
|
+
function _onAfterViewportColumnCalculatorOverride(calc) {
|
1435
1101
|
const nrOfRows = this.hot.countRows();
|
1436
1102
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1437
1103
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1438
1104
|
}
|
1439
|
-
function
|
1105
|
+
function _onModifyAutofillRange(drag, select) {
|
1440
1106
|
this.autofillCalculations.correctSelectionAreaSize(select);
|
1441
1107
|
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1442
1108
|
let dragArea = drag;
|
@@ -1460,28 +1126,65 @@ function _onModifyAutofillRange2(drag, select) {
|
|
1460
1126
|
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1461
1127
|
return dragArea;
|
1462
1128
|
}
|
1463
|
-
|
1129
|
+
/**
|
1130
|
+
* `afterCreateCol` hook callback.
|
1131
|
+
*
|
1132
|
+
* @param {number} column Column index.
|
1133
|
+
* @param {number} count Number of created columns.
|
1134
|
+
*/
|
1135
|
+
function _onAfterCreateCol(column, count) {
|
1464
1136
|
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1465
1137
|
}
|
1466
|
-
|
1138
|
+
/**
|
1139
|
+
* `afterRemoveCol` hook callback.
|
1140
|
+
*
|
1141
|
+
* @param {number} column Column index.
|
1142
|
+
* @param {number} count Number of removed columns.
|
1143
|
+
*/
|
1144
|
+
function _onAfterRemoveCol(column, count) {
|
1467
1145
|
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1468
1146
|
}
|
1469
|
-
|
1147
|
+
/**
|
1148
|
+
* `afterCreateRow` hook callback.
|
1149
|
+
*
|
1150
|
+
* @param {number} row Row index.
|
1151
|
+
* @param {number} count Number of created rows.
|
1152
|
+
* @param {string} source Source of change.
|
1153
|
+
*/
|
1154
|
+
function _onAfterCreateRow(row, count, source) {
|
1470
1155
|
if (source === 'auto') {
|
1471
1156
|
return;
|
1472
1157
|
}
|
1473
1158
|
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1474
1159
|
}
|
1475
|
-
|
1160
|
+
/**
|
1161
|
+
* `afterRemoveRow` hook callback.
|
1162
|
+
*
|
1163
|
+
* @param {number} row Row index.
|
1164
|
+
* @param {number} count Number of removed rows.
|
1165
|
+
*/
|
1166
|
+
function _onAfterRemoveRow(row, count) {
|
1476
1167
|
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1477
1168
|
}
|
1478
|
-
|
1169
|
+
/**
|
1170
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1171
|
+
*
|
1172
|
+
* @param {Array} changes The changes array.
|
1173
|
+
* @param {string} source Determines the source of the change.
|
1174
|
+
*/
|
1175
|
+
function _onAfterChange(changes, source) {
|
1479
1176
|
if (source !== 'Autofill.fill') {
|
1480
1177
|
return;
|
1481
1178
|
}
|
1482
1179
|
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1483
1180
|
}
|
1484
|
-
|
1181
|
+
/**
|
1182
|
+
* `beforeDrawAreaBorders` hook callback.
|
1183
|
+
*
|
1184
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
1185
|
+
* @param {string} className Class name for the area.
|
1186
|
+
*/
|
1187
|
+
function _onBeforeDrawAreaBorders(corners, className) {
|
1485
1188
|
if (className && className === 'area') {
|
1486
1189
|
const selectedRange = this.hot.getSelectedRangeLast();
|
1487
1190
|
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
@@ -1493,17 +1196,74 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1493
1196
|
});
|
1494
1197
|
}
|
1495
1198
|
}
|
1496
|
-
|
1199
|
+
/**
|
1200
|
+
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
1201
|
+
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
1202
|
+
*
|
1203
|
+
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
1204
|
+
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
1205
|
+
* down).
|
1206
|
+
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
1207
|
+
* down).
|
1208
|
+
*/
|
1209
|
+
function _onAfterModifyTransformStart(coords, rowTransformDir, colTransformDir) {
|
1210
|
+
if (!this.enabled) {
|
1211
|
+
return;
|
1212
|
+
}
|
1213
|
+
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1214
|
+
if (!mergedCellAtCoords) {
|
1215
|
+
return;
|
1216
|
+
}
|
1217
|
+
const goingDown = rowTransformDir > 0;
|
1218
|
+
const goingUp = rowTransformDir < 0;
|
1219
|
+
const goingLeft = colTransformDir < 0;
|
1220
|
+
const goingRight = colTransformDir > 0;
|
1221
|
+
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1222
|
+
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1223
|
+
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1224
|
+
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1225
|
+
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1226
|
+
coords.row = mergedCellAtCoords.row;
|
1227
|
+
coords.col = mergedCellAtCoords.col;
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
/**
|
1231
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1232
|
+
*
|
1233
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
1234
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
1235
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
1236
|
+
* endColumn]`.
|
1237
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
1238
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
1239
|
+
* processed cell.
|
1240
|
+
*/
|
1241
|
+
function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1497
1242
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1498
1243
|
if (!cornersOfSelection) {
|
1499
1244
|
return;
|
1500
1245
|
}
|
1501
1246
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1502
1247
|
}
|
1503
|
-
|
1248
|
+
/**
|
1249
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1250
|
+
*
|
1251
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1252
|
+
* all the cells in the table.
|
1253
|
+
*/
|
1254
|
+
function _onBeforeRemoveCellClassNames() {
|
1504
1255
|
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1505
1256
|
}
|
1506
|
-
|
1257
|
+
/**
|
1258
|
+
* Allows to prevent opening the editor while more than one merged cell is selected.
|
1259
|
+
*
|
1260
|
+
* @param {number} row Visual row index of the edited cell.
|
1261
|
+
* @param {number} column Visual column index of the edited cell.
|
1262
|
+
* @param {string | null} initialValue The initial editor value.
|
1263
|
+
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
1264
|
+
* @returns {boolean | undefined}
|
1265
|
+
*/
|
1266
|
+
function _onBeforeBeginEditing(row, column, initialValue, event) {
|
1507
1267
|
if (!(event instanceof MouseEvent)) {
|
1508
1268
|
return;
|
1509
1269
|
}
|