handsontable 0.0.0-next-2becb78-20240313 → 0.0.0-next-bff5041-20240315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +12 -17
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +12 -17
- package/3rdparty/walkontable/src/calculator/viewportRows.js +10 -15
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +10 -15
- package/3rdparty/walkontable/src/cell/coords.js +12 -17
- package/3rdparty/walkontable/src/cell/coords.mjs +12 -17
- package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
- package/3rdparty/walkontable/src/cell/range.js +23 -45
- package/3rdparty/walkontable/src/cell/range.mjs +23 -45
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +72 -104
- package/3rdparty/walkontable/src/event.mjs +72 -104
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/scroll.js +15 -17
- package/3rdparty/walkontable/src/scroll.mjs +15 -17
- package/3rdparty/walkontable/src/selection/manager.js +48 -69
- package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
- package/3rdparty/walkontable/src/selection/scanner.js +33 -42
- package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
- package/3rdparty/walkontable/src/utils/columnStretching.js +27 -44
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +27 -44
- package/3rdparty/walkontable/src/utils/orderView/view.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +1 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +1 -4
- package/core/viewportScroll/index.mjs +1 -4
- package/core.d.ts +3 -4
- package/core.js +22 -82
- package/core.mjs +22 -82
- package/dataMap/dataSource.js +1 -1
- package/dataMap/dataSource.mjs +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -1
- package/dataMap/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7619 -10404
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +277 -277
- package/dist/handsontable.js +5525 -7857
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +33 -33
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +21 -27
- package/editorManager.mjs +21 -27
- package/editors/autocompleteEditor/autocompleteEditor.js +6 -10
- package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -10
- package/eventManager.js +1 -1
- package/eventManager.mjs +1 -1
- package/focusManager.js +58 -82
- package/focusManager.mjs +58 -82
- package/helpers/dom/element.js +1 -1
- package/helpers/dom/element.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +2 -2
- package/helpers/object.mjs +2 -2
- package/index.d.ts +10 -0
- package/package.json +2 -1
- package/pluginHooks.d.ts +0 -4
- package/pluginHooks.js +2 -44
- package/pluginHooks.mjs +2 -44
- package/plugins/autoColumnSize/autoColumnSize.js +49 -65
- package/plugins/autoColumnSize/autoColumnSize.mjs +49 -65
- package/plugins/autoRowSize/autoRowSize.js +28 -34
- package/plugins/autoRowSize/autoRowSize.mjs +28 -34
- package/plugins/autofill/autofill.js +30 -38
- package/plugins/autofill/autofill.mjs +30 -38
- package/plugins/base/base.js +12 -17
- package/plugins/base/base.mjs +12 -17
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
- package/plugins/collapsibleColumns/collapsibleColumns.js +36 -54
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +36 -54
- package/plugins/columnSorting/columnSorting.js +40 -46
- package/plugins/columnSorting/columnSorting.mjs +40 -46
- package/plugins/columnSummary/columnSummary.js +22 -26
- package/plugins/columnSummary/columnSummary.mjs +22 -26
- package/plugins/comments/comments.js +116 -158
- package/plugins/comments/comments.mjs +116 -158
- package/plugins/contextMenu/contextMenu.js +20 -26
- package/plugins/contextMenu/contextMenu.mjs +20 -26
- package/plugins/contextMenu/itemsFactory.js +1 -1
- package/plugins/contextMenu/itemsFactory.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
- package/plugins/contextMenu/menu/menu.js +13 -21
- package/plugins/contextMenu/menu/menu.mjs +13 -21
- package/plugins/contextMenu/menu/positioner.js +41 -58
- package/plugins/contextMenu/menu/positioner.mjs +41 -58
- package/plugins/copyPaste/copyPaste.js +113 -154
- package/plugins/copyPaste/copyPaste.mjs +113 -154
- package/plugins/copyPaste/copyableRanges.js +43 -66
- package/plugins/copyPaste/copyableRanges.mjs +43 -66
- package/plugins/customBorders/customBorders.js +11 -13
- package/plugins/customBorders/customBorders.mjs +11 -13
- package/plugins/dragToScroll/dragToScroll.js +6 -6
- package/plugins/dragToScroll/dragToScroll.mjs +6 -6
- package/plugins/dropdownMenu/dropdownMenu.js +78 -100
- package/plugins/dropdownMenu/dropdownMenu.mjs +78 -100
- package/plugins/exportFile/dataProvider.js +1 -1
- package/plugins/exportFile/dataProvider.mjs +1 -1
- package/plugins/filters/component/actionBar.js +9 -9
- package/plugins/filters/component/actionBar.mjs +8 -8
- package/plugins/filters/component/condition.js +13 -15
- package/plugins/filters/component/condition.mjs +13 -15
- package/plugins/filters/component/operators.js +6 -6
- package/plugins/filters/component/operators.mjs +6 -6
- package/plugins/filters/component/value.js +24 -28
- package/plugins/filters/component/value.mjs +24 -28
- package/plugins/filters/conditionUpdateObserver.js +22 -24
- package/plugins/filters/conditionUpdateObserver.mjs +22 -24
- package/plugins/filters/dataFilter.js +1 -1
- package/plugins/filters/dataFilter.mjs +1 -1
- package/plugins/filters/filters.js +81 -95
- package/plugins/filters/filters.mjs +81 -95
- package/plugins/filters/ui/input.js +13 -19
- package/plugins/filters/ui/input.mjs +13 -19
- package/plugins/filters/ui/link.js +8 -13
- package/plugins/filters/ui/link.mjs +8 -13
- package/plugins/filters/ui/multipleSelect.js +85 -112
- package/plugins/filters/ui/multipleSelect.mjs +85 -112
- package/plugins/filters/ui/radioInput.js +12 -20
- package/plugins/filters/ui/radioInput.mjs +12 -20
- package/plugins/filters/ui/select.js +50 -72
- package/plugins/filters/ui/select.mjs +49 -71
- package/plugins/formulas/formulas.js +268 -326
- package/plugins/formulas/formulas.mjs +269 -327
- package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
- package/plugins/formulas/indexSyncer/index.js +25 -48
- package/plugins/formulas/indexSyncer/index.mjs +25 -48
- package/plugins/hiddenColumns/hiddenColumns.js +64 -83
- package/plugins/hiddenColumns/hiddenColumns.mjs +64 -83
- package/plugins/hiddenRows/hiddenRows.js +63 -82
- package/plugins/hiddenRows/hiddenRows.mjs +63 -82
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
- package/plugins/manualColumnMove/manualColumnMove.js +126 -170
- package/plugins/manualColumnMove/manualColumnMove.mjs +126 -170
- package/plugins/manualColumnResize/manualColumnResize.js +169 -230
- package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
- package/plugins/manualRowMove/manualRowMove.js +99 -128
- package/plugins/manualRowMove/manualRowMove.mjs +99 -128
- package/plugins/manualRowResize/manualRowResize.js +150 -209
- package/plugins/manualRowResize/manualRowResize.mjs +150 -209
- package/plugins/mergeCells/calculations/selection.js +71 -2
- package/plugins/mergeCells/calculations/selection.mjs +71 -2
- package/plugins/mergeCells/cellsCollection.js +1 -117
- package/plugins/mergeCells/cellsCollection.mjs +1 -117
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
- package/plugins/mergeCells/mergeCells.js +353 -593
- package/plugins/mergeCells/mergeCells.mjs +353 -593
- package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +204 -254
- package/plugins/nestedHeaders/nestedHeaders.mjs +205 -255
- package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
- package/plugins/nestedHeaders/stateManager/index.js +30 -41
- package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
- package/plugins/nestedRows/data/dataManager.js +1 -1
- package/plugins/nestedRows/data/dataManager.mjs +1 -1
- package/plugins/nestedRows/nestedRows.js +138 -179
- package/plugins/nestedRows/nestedRows.mjs +139 -180
- package/plugins/nestedRows/ui/contextMenu.js +11 -15
- package/plugins/nestedRows/ui/contextMenu.mjs +10 -14
- package/plugins/nestedRows/utils/rowMoveController.js +1 -1
- package/plugins/nestedRows/utils/rowMoveController.mjs +1 -1
- package/plugins/persistentState/storage.js +2 -2
- package/plugins/persistentState/storage.mjs +2 -2
- package/plugins/search/search.js +7 -7
- package/plugins/search/search.mjs +7 -7
- package/plugins/touchScroll/touchScroll.js +15 -19
- package/plugins/touchScroll/touchScroll.mjs +16 -20
- package/plugins/trimRows/trimRows.js +6 -6
- package/plugins/trimRows/trimRows.mjs +6 -6
- package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
- package/selection/highlight/highlight.js +14 -14
- package/selection/highlight/highlight.mjs +13 -13
- package/selection/highlight/visualSelection.js +2 -16
- package/selection/highlight/visualSelection.mjs +2 -16
- package/selection/selection.js +60 -255
- package/selection/selection.mjs +59 -254
- package/selection/transformation.js +101 -175
- package/selection/transformation.mjs +101 -175
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +3 -18
- package/shortcutContexts/commands/editor/open.mjs +3 -18
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
- package/shortcutContexts/grid.js +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/tableView.js +52 -98
- package/tableView.mjs +52 -98
- package/translations/changesObservable/observable.js +21 -38
- package/translations/changesObservable/observable.mjs +21 -38
- package/translations/changesObservable/observer.js +7 -12
- package/translations/changesObservable/observer.mjs +6 -11
- package/translations/mapCollections/aggregatedCollection.js +1 -1
- package/translations/mapCollections/aggregatedCollection.mjs +1 -1
- package/translations/maps/indexMap.js +1 -1
- package/translations/maps/indexMap.mjs +1 -1
- package/utils/dataStructures/linkedList.js +1 -6
- package/utils/dataStructures/linkedList.mjs +1 -6
- package/utils/dataStructures/tree.js +1 -1
- package/utils/dataStructures/tree.mjs +1 -1
- package/utils/interval.js +26 -44
- package/utils/interval.mjs +26 -44
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
- package/plugins/mergeCells/focusOrder.js +0 -327
- package/plugins/mergeCells/focusOrder.mjs +0 -322
@@ -1,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,225 +72,15 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
76
72
|
* ```
|
77
73
|
* :::
|
78
74
|
*/
|
79
|
-
var
|
80
|
-
var
|
81
|
-
var _focusOrder = /*#__PURE__*/new WeakMap();
|
82
|
-
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
84
|
-
var _onModifyTransformFocus = /*#__PURE__*/new WeakSet();
|
85
|
-
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
86
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onModifyTransformEndRestDelta = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
89
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
90
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onBeforeSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterSelectionFocusSet = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
99
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
100
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
101
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
102
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
103
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
104
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
105
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
106
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
107
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
108
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
75
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
76
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
109
77
|
class MergeCells extends _base.BasePlugin {
|
110
78
|
constructor() {
|
111
79
|
super(...arguments);
|
112
|
-
/**
|
113
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
114
|
-
*
|
115
|
-
* @param {number} row Visual row index of the edited cell.
|
116
|
-
* @param {number} column Visual column index of the edited cell.
|
117
|
-
* @param {string | null} initialValue The initial editor value.
|
118
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
119
|
-
* @returns {boolean | undefined}
|
120
|
-
*/
|
121
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
122
|
-
/**
|
123
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
124
|
-
*
|
125
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
126
|
-
* all the cells in the table.
|
127
|
-
*/
|
128
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
129
|
-
/**
|
130
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
131
|
-
*
|
132
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
133
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
134
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
135
|
-
* endColumn]`.
|
136
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
137
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
138
|
-
* processed cell.
|
139
|
-
*/
|
140
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
141
|
-
/**
|
142
|
-
* `beforeDrawAreaBorders` hook callback.
|
143
|
-
*
|
144
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
145
|
-
* @param {string} className Class name for the area.
|
146
|
-
*/
|
147
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
148
|
-
/**
|
149
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
150
|
-
*
|
151
|
-
* @param {Array} changes The changes array.
|
152
|
-
* @param {string} source Determines the source of the change.
|
153
|
-
*/
|
154
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
155
|
-
/**
|
156
|
-
* `afterRemoveRow` hook callback.
|
157
|
-
*
|
158
|
-
* @param {number} row Row index.
|
159
|
-
* @param {number} count Number of removed rows.
|
160
|
-
*/
|
161
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
162
|
-
/**
|
163
|
-
* `afterCreateRow` hook callback.
|
164
|
-
*
|
165
|
-
* @param {number} row Row index.
|
166
|
-
* @param {number} count Number of created rows.
|
167
|
-
* @param {string} source Source of change.
|
168
|
-
*/
|
169
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
170
|
-
/**
|
171
|
-
* `afterRemoveCol` hook callback.
|
172
|
-
*
|
173
|
-
* @param {number} column Column index.
|
174
|
-
* @param {number} count Number of removed columns.
|
175
|
-
*/
|
176
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
177
|
-
/**
|
178
|
-
* `afterCreateCol` hook callback.
|
179
|
-
*
|
180
|
-
* @param {number} column Column index.
|
181
|
-
* @param {number} count Number of created columns.
|
182
|
-
*/
|
183
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
184
|
-
/**
|
185
|
-
* The `modifyAutofillRange` hook callback.
|
186
|
-
*
|
187
|
-
* @param {Array} drag The drag area coordinates.
|
188
|
-
* @param {Array} select The selection information.
|
189
|
-
* @returns {Array} The new drag area.
|
190
|
-
*/
|
191
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
192
|
-
/**
|
193
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
194
|
-
*
|
195
|
-
* @param {object} calc The column calculator object.
|
196
|
-
*/
|
197
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
198
|
-
/**
|
199
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
200
|
-
*
|
201
|
-
* @param {object} calc The row calculator object.
|
202
|
-
*/
|
203
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
204
|
-
/**
|
205
|
-
* The `afterGetCellMeta` hook callback.
|
206
|
-
*
|
207
|
-
* @param {number} row Row index.
|
208
|
-
* @param {number} col Column index.
|
209
|
-
* @param {object} cellProperties The cell properties object.
|
210
|
-
*/
|
211
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
212
|
-
/**
|
213
|
-
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
214
|
-
*/
|
215
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
216
|
-
/**
|
217
|
-
* Changes the focus selection to the next or previous cell or merged cell position.
|
218
|
-
*
|
219
|
-
* @param {number} row The visual row index.
|
220
|
-
* @param {number} column The visual column index.
|
221
|
-
*/
|
222
|
-
_classPrivateMethodInitSpec(this, _onAfterSelectionFocusSet);
|
223
|
-
/**
|
224
|
-
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
225
|
-
* computations.
|
226
|
-
*/
|
227
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionFocusSet);
|
228
|
-
/**
|
229
|
-
* Clears the last selected coordinates before setting a new selection range.
|
230
|
-
*/
|
231
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
232
|
-
/**
|
233
|
-
* `afterRenderer` hook callback.
|
234
|
-
*
|
235
|
-
* @param {HTMLElement} TD The cell to be modified.
|
236
|
-
* @param {number} row Row index.
|
237
|
-
* @param {number} col Visual column index.
|
238
|
-
*/
|
239
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
240
|
-
/**
|
241
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
242
|
-
*
|
243
|
-
* @param {object} defaultOptions The default context menu options.
|
244
|
-
*/
|
245
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
246
|
-
/**
|
247
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
248
|
-
*
|
249
|
-
* @param {number} row Row index.
|
250
|
-
* @param {number} column Visual column index.
|
251
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
252
|
-
*/
|
253
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
254
|
-
/**
|
255
|
-
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
256
|
-
* It expands the range to cover the entire area of the selected merged cells.
|
257
|
-
*/
|
258
|
-
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
259
|
-
/**
|
260
|
-
* The hooks allows to modify the delta transformation object necessary for correct selection end transformations.
|
261
|
-
*
|
262
|
-
* @param {{ row: number, col: number }} restDelta The transformation delta for the rest of the selection.
|
263
|
-
* @param {{ row: number, col: number }} delta The general transformation delta.
|
264
|
-
* @param {CellCoords} coords The coordinates of the next position of the end selection.
|
265
|
-
*/
|
266
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEndRestDelta);
|
267
|
-
/**
|
268
|
-
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
269
|
-
* The logic here handles "jumping over" merged merged cells, while selecting.
|
270
|
-
*
|
271
|
-
* @param {{ row: number, col: number }} delta The transformation delta.
|
272
|
-
*/
|
273
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
274
|
-
/**
|
275
|
-
* `modifyTransformStart` hook callback.
|
276
|
-
*
|
277
|
-
* @param {object} delta The transformation delta.
|
278
|
-
*/
|
279
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
280
|
-
/**
|
281
|
-
* `modifyTransformFocus` hook callback.
|
282
|
-
*
|
283
|
-
* @param {object} delta The transformation delta.
|
284
|
-
*/
|
285
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformFocus);
|
286
|
-
/**
|
287
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
288
|
-
* hook callback.
|
289
|
-
*
|
290
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
291
|
-
* @returns {boolean}
|
292
|
-
*/
|
293
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
294
80
|
/**
|
295
81
|
* `afterInit` hook callback.
|
296
82
|
*/
|
297
|
-
_classPrivateMethodInitSpec(this,
|
83
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
298
84
|
/**
|
299
85
|
* A container for all the merged cells.
|
300
86
|
*
|
@@ -317,41 +103,9 @@ class MergeCells extends _base.BasePlugin {
|
|
317
103
|
*/
|
318
104
|
_defineProperty(this, "selectionCalculations", null);
|
319
105
|
/**
|
320
|
-
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
321
|
-
* focus is moved out of the merged cell.
|
322
|
-
*
|
323
106
|
* @type {CellCoords}
|
324
107
|
*/
|
325
|
-
_classPrivateFieldInitSpec(this,
|
326
|
-
writable: true,
|
327
|
-
value: null
|
328
|
-
});
|
329
|
-
/**
|
330
|
-
* The last used transformation delta.
|
331
|
-
*
|
332
|
-
* @type {{ row: number, col: number }}
|
333
|
-
*/
|
334
|
-
_classPrivateFieldInitSpec(this, _lastDelta, {
|
335
|
-
writable: true,
|
336
|
-
value: {
|
337
|
-
row: 0,
|
338
|
-
col: 0
|
339
|
-
}
|
340
|
-
});
|
341
|
-
/**
|
342
|
-
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
343
|
-
* contains merged cells.
|
344
|
-
*
|
345
|
-
* @type {FocusOrder}
|
346
|
-
*/
|
347
|
-
_classPrivateFieldInitSpec(this, _focusOrder, {
|
348
|
-
writable: true,
|
349
|
-
value: new _focusOrder2.FocusOrder({
|
350
|
-
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
351
|
-
rowIndexMapper: this.hot.rowIndexMapper,
|
352
|
-
columnIndexMapper: this.hot.columnIndexMapper
|
353
|
-
})
|
354
|
-
});
|
108
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, null);
|
355
109
|
}
|
356
110
|
static get PLUGIN_KEY() {
|
357
111
|
return PLUGIN_KEY;
|
@@ -384,169 +138,145 @@ class MergeCells extends _base.BasePlugin {
|
|
384
138
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
385
139
|
args[_key] = arguments[_key];
|
386
140
|
}
|
387
|
-
return
|
141
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
388
142
|
});
|
389
|
-
this.addHook('
|
143
|
+
this.addHook('modifyTransformStart', function () {
|
390
144
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
391
145
|
args[_key2] = arguments[_key2];
|
392
146
|
}
|
393
|
-
return
|
147
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
394
148
|
});
|
395
|
-
this.addHook('
|
149
|
+
this.addHook('afterModifyTransformStart', function () {
|
396
150
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
397
151
|
args[_key3] = arguments[_key3];
|
398
152
|
}
|
399
|
-
return
|
153
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterModifyTransformStart).call(_this, ...args);
|
400
154
|
});
|
401
155
|
this.addHook('modifyTransformEnd', function () {
|
402
156
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
403
157
|
args[_key4] = arguments[_key4];
|
404
158
|
}
|
405
|
-
return
|
159
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
406
160
|
});
|
407
|
-
this.addHook('
|
161
|
+
this.addHook('modifyGetCellCoords', function () {
|
408
162
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
409
163
|
args[_key5] = arguments[_key5];
|
410
164
|
}
|
411
|
-
return
|
165
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
412
166
|
});
|
413
|
-
this.addHook('
|
167
|
+
this.addHook('beforeSetRangeStart', function () {
|
414
168
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
415
169
|
args[_key6] = arguments[_key6];
|
416
170
|
}
|
417
|
-
return
|
171
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
418
172
|
});
|
419
|
-
this.addHook('
|
173
|
+
this.addHook('beforeSetRangeStartOnly', function () {
|
420
174
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
421
175
|
args[_key7] = arguments[_key7];
|
422
176
|
}
|
423
|
-
return
|
177
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
424
178
|
});
|
425
|
-
this.addHook('
|
179
|
+
this.addHook('beforeSetRangeEnd', function () {
|
426
180
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
427
181
|
args[_key8] = arguments[_key8];
|
428
182
|
}
|
429
|
-
return
|
183
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeEnd).call(_this, ...args);
|
430
184
|
});
|
431
|
-
this.addHook('
|
185
|
+
this.addHook('afterIsMultipleSelection', function () {
|
432
186
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
433
187
|
args[_key9] = arguments[_key9];
|
434
188
|
}
|
435
|
-
return
|
189
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
436
190
|
});
|
437
|
-
this.addHook('
|
191
|
+
this.addHook('afterRenderer', function () {
|
438
192
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
439
193
|
args[_key10] = arguments[_key10];
|
440
194
|
}
|
441
|
-
return
|
195
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
442
196
|
});
|
443
|
-
this.addHook('
|
197
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
444
198
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
445
199
|
args[_key11] = arguments[_key11];
|
446
200
|
}
|
447
|
-
return
|
201
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
448
202
|
});
|
449
|
-
this.addHook('
|
203
|
+
this.addHook('afterGetCellMeta', function () {
|
450
204
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
451
205
|
args[_key12] = arguments[_key12];
|
452
206
|
}
|
453
|
-
return
|
207
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
454
208
|
});
|
455
|
-
this.addHook('
|
209
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
456
210
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
457
211
|
args[_key13] = arguments[_key13];
|
458
212
|
}
|
459
|
-
return
|
213
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
460
214
|
});
|
461
|
-
this.addHook('
|
215
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
462
216
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
463
217
|
args[_key14] = arguments[_key14];
|
464
218
|
}
|
465
|
-
return
|
219
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
466
220
|
});
|
467
|
-
this.addHook('
|
221
|
+
this.addHook('modifyAutofillRange', function () {
|
468
222
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
469
223
|
args[_key15] = arguments[_key15];
|
470
224
|
}
|
471
|
-
return
|
225
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
472
226
|
});
|
473
|
-
this.addHook('
|
227
|
+
this.addHook('afterCreateCol', function () {
|
474
228
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
475
229
|
args[_key16] = arguments[_key16];
|
476
230
|
}
|
477
|
-
return
|
231
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
478
232
|
});
|
479
|
-
this.addHook('
|
233
|
+
this.addHook('afterRemoveCol', function () {
|
480
234
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
481
235
|
args[_key17] = arguments[_key17];
|
482
236
|
}
|
483
|
-
return
|
237
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
484
238
|
});
|
485
|
-
this.addHook('
|
239
|
+
this.addHook('afterCreateRow', function () {
|
486
240
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
487
241
|
args[_key18] = arguments[_key18];
|
488
242
|
}
|
489
|
-
return
|
243
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
490
244
|
});
|
491
|
-
this.addHook('
|
245
|
+
this.addHook('afterRemoveRow', function () {
|
492
246
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
493
247
|
args[_key19] = arguments[_key19];
|
494
248
|
}
|
495
|
-
return
|
249
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
496
250
|
});
|
497
|
-
this.addHook('
|
251
|
+
this.addHook('afterChange', function () {
|
498
252
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
499
253
|
args[_key20] = arguments[_key20];
|
500
254
|
}
|
501
|
-
return
|
255
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
502
256
|
});
|
503
|
-
this.addHook('
|
257
|
+
this.addHook('beforeDrawBorders', function () {
|
504
258
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
505
259
|
args[_key21] = arguments[_key21];
|
506
260
|
}
|
507
|
-
return
|
261
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
508
262
|
});
|
509
|
-
this.addHook('
|
263
|
+
this.addHook('afterDrawSelection', function () {
|
510
264
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
511
265
|
args[_key22] = arguments[_key22];
|
512
266
|
}
|
513
|
-
return
|
267
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
514
268
|
});
|
515
|
-
this.addHook('
|
269
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
516
270
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
517
271
|
args[_key23] = arguments[_key23];
|
518
272
|
}
|
519
|
-
return
|
273
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
520
274
|
});
|
521
|
-
this.addHook('
|
275
|
+
this.addHook('beforeBeginEditing', function () {
|
522
276
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
523
277
|
args[_key24] = arguments[_key24];
|
524
278
|
}
|
525
|
-
return
|
526
|
-
});
|
527
|
-
this.addHook('beforeDrawBorders', function () {
|
528
|
-
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
529
|
-
args[_key25] = arguments[_key25];
|
530
|
-
}
|
531
|
-
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
532
|
-
});
|
533
|
-
this.addHook('afterDrawSelection', function () {
|
534
|
-
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
535
|
-
args[_key26] = arguments[_key26];
|
536
|
-
}
|
537
|
-
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
538
|
-
});
|
539
|
-
this.addHook('beforeRemoveCellClassNames', function () {
|
540
|
-
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
541
|
-
args[_key27] = arguments[_key27];
|
542
|
-
}
|
543
|
-
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
544
|
-
});
|
545
|
-
this.addHook('beforeBeginEditing', function () {
|
546
|
-
for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
|
547
|
-
args[_key28] = arguments[_key28];
|
548
|
-
}
|
549
|
-
return _classPrivateMethodGet(_this, _onBeforeBeginEditing, _onBeforeBeginEditing2).call(_this, ...args);
|
279
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
550
280
|
});
|
551
281
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
552
282
|
if (source === 'MergeCells') {
|
@@ -714,6 +444,25 @@ class MergeCells extends _base.BasePlugin {
|
|
714
444
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
715
445
|
}
|
716
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
|
+
|
717
466
|
/**
|
718
467
|
* Merges the selection provided as a cell range.
|
719
468
|
*
|
@@ -924,6 +673,15 @@ class MergeCells extends _base.BasePlugin {
|
|
924
673
|
const gridContext = shortcutManager.getContext('grid');
|
925
674
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
926
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
|
+
|
927
685
|
/**
|
928
686
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
929
687
|
*
|
@@ -980,6 +738,13 @@ class MergeCells extends _base.BasePlugin {
|
|
980
738
|
}
|
981
739
|
}
|
982
740
|
}
|
741
|
+
|
742
|
+
/**
|
743
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
744
|
+
*
|
745
|
+
* @param {object} calc The column calculator object.
|
746
|
+
*/
|
747
|
+
|
983
748
|
/**
|
984
749
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
985
750
|
*
|
@@ -1074,210 +839,121 @@ class MergeCells extends _base.BasePlugin {
|
|
1074
839
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1075
840
|
return [renderableRow, renderableColumn];
|
1076
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
|
+
*/
|
1077
850
|
}
|
1078
851
|
exports.MergeCells = MergeCells;
|
1079
|
-
function
|
852
|
+
function _onAfterInit() {
|
1080
853
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1081
854
|
this.hot.render();
|
1082
855
|
}
|
1083
|
-
function
|
856
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1084
857
|
if (isMultiple) {
|
1085
858
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1086
859
|
const selectionRange = this.hot.getSelectedRangeLast();
|
1087
|
-
const topStartCoords = selectionRange.getTopStartCorner();
|
1088
|
-
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1089
860
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1090
|
-
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) {
|
1091
862
|
return false;
|
1092
863
|
}
|
1093
864
|
}
|
1094
865
|
}
|
1095
866
|
return isMultiple;
|
1096
867
|
}
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
}
|
1101
|
-
|
1102
|
-
|
1103
|
-
const
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
columnIndexMapper,
|
1108
|
-
rowIndexMapper
|
1109
|
-
} = this.hot;
|
1110
|
-
if (_classPrivateFieldGet(this, _lastSelectedFocus)) {
|
1111
|
-
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).row) !== null) {
|
1112
|
-
highlight.row = _classPrivateFieldGet(this, _lastSelectedFocus).row;
|
1113
|
-
}
|
1114
|
-
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(this, _lastSelectedFocus).col) !== null) {
|
1115
|
-
highlight.col = _classPrivateFieldGet(this, _lastSelectedFocus).col;
|
1116
|
-
}
|
1117
|
-
_classPrivateFieldSet(this, _lastSelectedFocus, null);
|
1118
|
-
}
|
1119
|
-
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1120
|
-
if (!mergedParent) {
|
1121
|
-
return;
|
1122
|
-
}
|
1123
|
-
const visualColumnIndexStart = mergedParent.col;
|
1124
|
-
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
1125
|
-
if (delta.col < 0) {
|
1126
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
1127
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1128
|
-
if (notHiddenColumnIndex === null) {
|
1129
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1130
|
-
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
1131
|
-
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
1132
|
-
} else {
|
1133
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
1134
|
-
}
|
1135
|
-
} else if (delta.col > 0) {
|
1136
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
1137
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1138
|
-
if (notHiddenColumnIndex === null) {
|
1139
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
1140
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
1141
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
1142
|
-
} else {
|
1143
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
1144
|
-
}
|
1145
|
-
}
|
1146
|
-
const visualRowIndexStart = mergedParent.row;
|
1147
|
-
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
1148
|
-
if (delta.row < 0) {
|
1149
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
1150
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1151
|
-
if (notHiddenRowIndex === null) {
|
1152
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1153
|
-
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
1154
|
-
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
1155
|
-
} else {
|
1156
|
-
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
1157
|
-
}
|
1158
|
-
} else if (delta.row > 0) {
|
1159
|
-
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
1160
|
-
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1161
|
-
if (notHiddenRowIndex === null) {
|
1162
|
-
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
1163
|
-
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
1164
|
-
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
1165
|
-
} else {
|
1166
|
-
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
1167
|
-
}
|
1168
|
-
}
|
1169
|
-
}
|
1170
|
-
function _onModifyTransformEnd2(delta) {
|
1171
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1172
|
-
const cloneRange = selectedRange.clone();
|
1173
|
-
const {
|
1174
|
-
to
|
1175
|
-
} = selectedRange;
|
1176
|
-
const {
|
1177
|
-
columnIndexMapper,
|
1178
|
-
rowIndexMapper
|
1179
|
-
} = this.hot;
|
1180
|
-
const expandCloneRange = (row, col) => {
|
1181
|
-
cloneRange.expand(this.hot._createCellCoords(row, col));
|
1182
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1183
|
-
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1184
|
-
}
|
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
|
1185
878
|
};
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
}
|
1192
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1193
|
-
if (notHiddenColumnIndex !== null) {
|
1194
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1195
|
-
}
|
1196
|
-
} else if (delta.col > 0) {
|
1197
|
-
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1198
|
-
expandCloneRange(to.row, nextColumn);
|
1199
|
-
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1200
|
-
nextColumn = cloneRange.getBottomEndCorner().col;
|
1201
|
-
}
|
1202
|
-
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1203
|
-
if (notHiddenColumnIndex !== null) {
|
1204
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1205
|
-
}
|
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));
|
1206
884
|
}
|
1207
|
-
if (
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
if (notHiddenRowIndex !== null) {
|
1215
|
-
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
|
1216
892
|
}
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
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;
|
1222
901
|
}
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
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;
|
1226
908
|
}
|
1227
909
|
}
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
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
|
+
};
|
1237
920
|
}
|
1238
|
-
|
1239
|
-
|
1240
|
-
const bottomEndCorner = selectedRange.getBottomEndCorner();
|
1241
|
-
if (delta.col > 0) {
|
1242
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(topEndCorner.col, coords.col) - 1;
|
1243
|
-
restDelta.col = Math.max(renderableColumns, 1);
|
1244
|
-
} else if (delta.col < 0) {
|
1245
|
-
const renderableColumns = this.hot.view.countRenderableColumnsInRange(coords.col, topStartCorner.col) - 1;
|
1246
|
-
restDelta.col = -Math.max(renderableColumns, 1);
|
921
|
+
if (newDelta.row !== 0) {
|
922
|
+
delta.row = newDelta.row;
|
1247
923
|
}
|
1248
|
-
if (
|
1249
|
-
|
1250
|
-
restDelta.row = Math.max(renderableRows, 1);
|
1251
|
-
} else if (delta.row < 0) {
|
1252
|
-
const renderableRows = this.hot.view.countRenderableRowsInRange(coords.row, topStartCorner.row) - 1;
|
1253
|
-
restDelta.row = -Math.max(renderableRows, 1);
|
924
|
+
if (newDelta.col !== 0) {
|
925
|
+
delta.col = newDelta.col;
|
1254
926
|
}
|
1255
927
|
}
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
}
|
1274
|
-
|
1275
|
-
|
1276
|
-
if (mergedParent) {
|
1277
|
-
highlight.assign(mergedParent);
|
1278
|
-
}
|
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;
|
1279
948
|
}
|
1280
|
-
|
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) {
|
1281
957
|
if (row < 0 || column < 0) {
|
1282
958
|
return;
|
1283
959
|
}
|
@@ -1297,12 +973,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1297
973
|
// Most bottom-right merged cell coords.
|
1298
974
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1299
975
|
}
|
1300
|
-
|
976
|
+
/**
|
977
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
978
|
+
*
|
979
|
+
* @param {object} defaultOptions The default context menu options.
|
980
|
+
*/
|
981
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1301
982
|
defaultOptions.items.push({
|
1302
983
|
name: '---------'
|
1303
984
|
}, (0, _toggleMerge.default)(this));
|
1304
985
|
}
|
1305
|
-
|
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) {
|
1306
994
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1307
995
|
// We shouldn't override data in the collection.
|
1308
996
|
const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
|
@@ -1334,88 +1022,61 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1334
1022
|
}
|
1335
1023
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1336
1024
|
}
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
if (
|
1350
|
-
_classPrivateFieldGet(this, _focusOrder).setPrevNodeAsActive();
|
1351
|
-
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(this, _lastDelta).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1352
|
-
_classPrivateFieldGet(this, _focusOrder).setNextNodeAsActive();
|
1353
|
-
}
|
1354
|
-
}
|
1355
|
-
function _onAfterSelectionFocusSet2(row, column) {
|
1356
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
1357
|
-
const {
|
1358
|
-
columnIndexMapper,
|
1359
|
-
rowIndexMapper
|
1360
|
-
} = this.hot;
|
1361
|
-
let notHiddenRowIndex = null;
|
1362
|
-
let notHiddenColumnIndex = null;
|
1363
|
-
if (_classPrivateFieldGet(this, _lastDelta).col < 0) {
|
1364
|
-
const {
|
1365
|
-
rowEnd,
|
1366
|
-
colEnd
|
1367
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevHorizontalNode();
|
1368
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1369
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1370
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).col > 0) {
|
1371
|
-
const {
|
1372
|
-
rowStart,
|
1373
|
-
colStart
|
1374
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextHorizontalNode();
|
1375
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1376
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1377
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).row < 0) {
|
1378
|
-
const {
|
1379
|
-
rowEnd,
|
1380
|
-
colEnd
|
1381
|
-
} = _classPrivateFieldGet(this, _focusOrder).getPrevVerticalNode();
|
1382
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1383
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1384
|
-
} else if (_classPrivateFieldGet(this, _lastDelta).row > 0) {
|
1385
|
-
const {
|
1386
|
-
rowStart,
|
1387
|
-
colStart
|
1388
|
-
} = _classPrivateFieldGet(this, _focusOrder).getNextVerticalNode();
|
1389
|
-
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1390
|
-
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1391
|
-
}
|
1392
|
-
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1393
|
-
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
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)) {
|
1394
1038
|
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1395
|
-
|
1396
|
-
row = coords.row;
|
1397
|
-
column = coords.col;
|
1398
|
-
if (mergeParent) {
|
1399
|
-
selectedRange.highlight.assign(mergeParent);
|
1400
|
-
} else {
|
1401
|
-
selectedRange.highlight.assign(coords);
|
1402
|
-
}
|
1403
|
-
focusHighlight.clear();
|
1404
|
-
focusHighlight.add(coords).commit();
|
1039
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1405
1040
|
}
|
1406
|
-
_classPrivateFieldGet(this, _focusOrder).setActiveNode(row, column);
|
1407
|
-
_classPrivateFieldSet(this, _lastDelta, {
|
1408
|
-
row: 0,
|
1409
|
-
col: 0
|
1410
|
-
});
|
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
|
}
|