handsontable 0.0.0-next-7026906-20231107 → 0.0.0-next-7b93b7d-20231107
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +25 -25
- package/core.mjs +25 -25
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7244 -6347
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +7243 -6346
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +97 -102
- package/plugins/autofill/autofill.mjs +96 -101
- package/plugins/base/base.js +57 -22
- package/plugins/base/base.mjs +56 -22
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +105 -98
- package/plugins/columnSorting/columnSorting.mjs +104 -97
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +91 -101
- package/plugins/contextMenu/contextMenu.mjs +90 -100
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +49 -48
- package/plugins/customBorders/customBorders.mjs +48 -47
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +132 -129
- package/plugins/dropdownMenu/dropdownMenu.mjs +132 -129
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +67 -54
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +13 -10
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +13 -10
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +326 -278
- package/plugins/nestedRows/nestedRows.mjs +325 -277
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +3 -3
- package/selection/selection.mjs +3 -3
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,4 +1,17 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
5
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
8
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
9
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
10
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
11
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
12
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
14
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
2
15
|
import { BasePlugin } from "../base/index.mjs";
|
3
16
|
import Hooks from "../../pluginHooks.mjs";
|
4
17
|
import MergedCellsCollection from "./cellsCollection.mjs";
|
@@ -19,7 +32,6 @@ Hooks.getSingleton().register('beforeUnmergeCells');
|
|
19
32
|
Hooks.getSingleton().register('afterUnmergeCells');
|
20
33
|
export const PLUGIN_KEY = 'mergeCells';
|
21
34
|
export const PLUGIN_PRIORITY = 150;
|
22
|
-
const privatePool = new WeakMap();
|
23
35
|
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
24
36
|
|
25
37
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
@@ -59,42 +71,231 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
59
71
|
* ```
|
60
72
|
* :::
|
61
73
|
*/
|
74
|
+
var _lastDesiredCoords = /*#__PURE__*/new WeakMap();
|
75
|
+
var _onAfterInit = /*#__PURE__*/new WeakSet();
|
76
|
+
var _onAfterIsMultipleSelection = /*#__PURE__*/new WeakSet();
|
77
|
+
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
78
|
+
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
79
|
+
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
80
|
+
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
81
|
+
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
82
|
+
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
|
84
|
+
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
86
|
+
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
92
|
+
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
95
|
+
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
96
|
+
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
62
97
|
export class MergeCells extends BasePlugin {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
98
|
+
constructor() {
|
99
|
+
super(...arguments);
|
100
|
+
/**
|
101
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
102
|
+
*
|
103
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
104
|
+
* all the cells in the table.
|
105
|
+
*/
|
106
|
+
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
107
|
+
/**
|
108
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
109
|
+
*
|
110
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
111
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
112
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
113
|
+
* endColumn]`.
|
114
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
115
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
116
|
+
* processed cell.
|
117
|
+
*/
|
118
|
+
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
119
|
+
/**
|
120
|
+
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
121
|
+
* the table with the ENTER/SHIFT+ENTER/TAB/SHIFT+TAB keys.
|
122
|
+
*
|
123
|
+
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
124
|
+
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
125
|
+
* down).
|
126
|
+
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
127
|
+
* down).
|
128
|
+
*/
|
129
|
+
_classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
|
130
|
+
/**
|
131
|
+
* `beforeDrawAreaBorders` hook callback.
|
132
|
+
*
|
133
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
134
|
+
* @param {string} className Class name for the area.
|
135
|
+
*/
|
136
|
+
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
137
|
+
/**
|
138
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
139
|
+
*
|
140
|
+
* @param {Array} changes The changes array.
|
141
|
+
* @param {string} source Determines the source of the change.
|
142
|
+
*/
|
143
|
+
_classPrivateMethodInitSpec(this, _onAfterChange);
|
144
|
+
/**
|
145
|
+
* `afterRemoveRow` hook callback.
|
146
|
+
*
|
147
|
+
* @param {number} row Row index.
|
148
|
+
* @param {number} count Number of removed rows.
|
149
|
+
*/
|
150
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
151
|
+
/**
|
152
|
+
* `afterCreateRow` hook callback.
|
153
|
+
*
|
154
|
+
* @param {number} row Row index.
|
155
|
+
* @param {number} count Number of created rows.
|
156
|
+
* @param {string} source Source of change.
|
157
|
+
*/
|
158
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
159
|
+
/**
|
160
|
+
* `afterRemoveCol` hook callback.
|
161
|
+
*
|
162
|
+
* @param {number} column Column index.
|
163
|
+
* @param {number} count Number of removed columns.
|
164
|
+
*/
|
165
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
166
|
+
/**
|
167
|
+
* `afterCreateCol` hook callback.
|
168
|
+
*
|
169
|
+
* @param {number} column Column index.
|
170
|
+
* @param {number} count Number of created columns.
|
171
|
+
*/
|
172
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
173
|
+
/**
|
174
|
+
* The `modifyAutofillRange` hook callback.
|
175
|
+
*
|
176
|
+
* @param {Array} drag The drag area coordinates.
|
177
|
+
* @param {Array} select The selection information.
|
178
|
+
* @returns {Array} The new drag area.
|
179
|
+
*/
|
180
|
+
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
181
|
+
/**
|
182
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
183
|
+
*
|
184
|
+
* @param {object} calc The column calculator object.
|
185
|
+
*/
|
186
|
+
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
187
|
+
/**
|
188
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
189
|
+
*
|
190
|
+
* @param {object} calc The row calculator object.
|
191
|
+
*/
|
192
|
+
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
193
|
+
/**
|
194
|
+
* The `afterGetCellMeta` hook callback.
|
195
|
+
*
|
196
|
+
* @param {number} row Row index.
|
197
|
+
* @param {number} col Column index.
|
198
|
+
* @param {object} cellProperties The cell properties object.
|
199
|
+
*/
|
200
|
+
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
201
|
+
/**
|
202
|
+
* `beforeSetRangeEnd` hook callback.
|
203
|
+
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
204
|
+
* merged cell.
|
205
|
+
*
|
206
|
+
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
207
|
+
*
|
208
|
+
* @param {object} coords Cell coords.
|
209
|
+
*/
|
210
|
+
_classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
|
211
|
+
/**
|
212
|
+
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
213
|
+
* A selection within merge area should be rewritten to the start of merge area.
|
214
|
+
*
|
215
|
+
* @param {object} coords Cell coords.
|
216
|
+
*/
|
217
|
+
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
218
|
+
/**
|
219
|
+
* `afterRenderer` hook callback.
|
220
|
+
*
|
221
|
+
* @param {HTMLElement} TD The cell to be modified.
|
222
|
+
* @param {number} row Row index.
|
223
|
+
* @param {number} col Visual column index.
|
224
|
+
*/
|
225
|
+
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
226
|
+
/**
|
227
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
228
|
+
*
|
229
|
+
* @param {object} defaultOptions The default context menu options.
|
230
|
+
*/
|
231
|
+
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
232
|
+
/**
|
233
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
234
|
+
*
|
235
|
+
* @param {number} row Row index.
|
236
|
+
* @param {number} column Visual column index.
|
237
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
238
|
+
*/
|
239
|
+
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
240
|
+
/**
|
241
|
+
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
242
|
+
*
|
243
|
+
* @param {object} delta The transformation delta.
|
244
|
+
*/
|
245
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
246
|
+
/**
|
247
|
+
* `modifyTransformStart` hook callback.
|
248
|
+
*
|
249
|
+
* @param {object} delta The transformation delta.
|
250
|
+
*/
|
251
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
252
|
+
/**
|
253
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
254
|
+
* hook callback.
|
255
|
+
*
|
256
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
257
|
+
* @returns {boolean}
|
258
|
+
*/
|
259
|
+
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
260
|
+
/**
|
261
|
+
* `afterInit` hook callback.
|
262
|
+
*/
|
263
|
+
_classPrivateMethodInitSpec(this, _onAfterInit);
|
75
264
|
/**
|
76
265
|
* A container for all the merged cells.
|
77
266
|
*
|
78
267
|
* @private
|
79
268
|
* @type {MergedCellsCollection}
|
80
269
|
*/
|
81
|
-
this
|
270
|
+
_defineProperty(this, "mergedCellsCollection", null);
|
82
271
|
/**
|
83
272
|
* Instance of the class responsible for all the autofill-related calculations.
|
84
273
|
*
|
85
274
|
* @private
|
86
275
|
* @type {AutofillCalculations}
|
87
276
|
*/
|
88
|
-
this
|
277
|
+
_defineProperty(this, "autofillCalculations", null);
|
89
278
|
/**
|
90
279
|
* Instance of the class responsible for the selection-related calculations.
|
91
280
|
*
|
92
281
|
* @private
|
93
282
|
* @type {SelectionCalculations}
|
94
283
|
*/
|
95
|
-
this
|
284
|
+
_defineProperty(this, "selectionCalculations", null);
|
285
|
+
/**
|
286
|
+
* @type {CellCoords}
|
287
|
+
*/
|
288
|
+
_classPrivateFieldInitSpec(this, _lastDesiredCoords, {
|
289
|
+
writable: true,
|
290
|
+
value: null
|
291
|
+
});
|
292
|
+
}
|
293
|
+
static get PLUGIN_KEY() {
|
294
|
+
return PLUGIN_KEY;
|
295
|
+
}
|
296
|
+
static get PLUGIN_PRIORITY() {
|
297
|
+
return PLUGIN_PRIORITY;
|
96
298
|
}
|
97
|
-
|
98
299
|
/**
|
99
300
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
100
301
|
* hook and if it returns `true` then the {@link MergeCells#enablePlugin} method is called.
|
@@ -117,73 +318,142 @@ export class MergeCells extends BasePlugin {
|
|
117
318
|
this.autofillCalculations = new AutofillCalculations(this);
|
118
319
|
this.selectionCalculations = new SelectionCalculations(this);
|
119
320
|
this.addHook('afterInit', function () {
|
120
|
-
|
321
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
322
|
+
args[_key] = arguments[_key];
|
323
|
+
}
|
324
|
+
return _classPrivateMethodGet(_this, _onAfterInit, _onAfterInit2).call(_this, ...args);
|
121
325
|
});
|
122
326
|
this.addHook('modifyTransformStart', function () {
|
123
|
-
|
327
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
328
|
+
args[_key2] = arguments[_key2];
|
329
|
+
}
|
330
|
+
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
124
331
|
});
|
125
332
|
this.addHook('afterModifyTransformStart', function () {
|
126
|
-
|
333
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
334
|
+
args[_key3] = arguments[_key3];
|
335
|
+
}
|
336
|
+
return _classPrivateMethodGet(_this, _onAfterModifyTransformStart, _onAfterModifyTransformStart2).call(_this, ...args);
|
127
337
|
});
|
128
338
|
this.addHook('modifyTransformEnd', function () {
|
129
|
-
|
339
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
340
|
+
args[_key4] = arguments[_key4];
|
341
|
+
}
|
342
|
+
return _classPrivateMethodGet(_this, _onModifyTransformEnd, _onModifyTransformEnd2).call(_this, ...args);
|
130
343
|
});
|
131
344
|
this.addHook('modifyGetCellCoords', function () {
|
132
|
-
|
345
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
346
|
+
args[_key5] = arguments[_key5];
|
347
|
+
}
|
348
|
+
return _classPrivateMethodGet(_this, _onModifyGetCellCoords, _onModifyGetCellCoords2).call(_this, ...args);
|
133
349
|
});
|
134
350
|
this.addHook('beforeSetRangeStart', function () {
|
135
|
-
|
351
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
352
|
+
args[_key6] = arguments[_key6];
|
353
|
+
}
|
354
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
136
355
|
});
|
137
356
|
this.addHook('beforeSetRangeStartOnly', function () {
|
138
|
-
|
357
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
358
|
+
args[_key7] = arguments[_key7];
|
359
|
+
}
|
360
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeStart, _onBeforeSetRangeStart2).call(_this, ...args);
|
139
361
|
});
|
140
362
|
this.addHook('beforeSetRangeEnd', function () {
|
141
|
-
|
363
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
364
|
+
args[_key8] = arguments[_key8];
|
365
|
+
}
|
366
|
+
return _classPrivateMethodGet(_this, _onBeforeSetRangeEnd, _onBeforeSetRangeEnd2).call(_this, ...args);
|
142
367
|
});
|
143
368
|
this.addHook('afterIsMultipleSelection', function () {
|
144
|
-
|
369
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
370
|
+
args[_key9] = arguments[_key9];
|
371
|
+
}
|
372
|
+
return _classPrivateMethodGet(_this, _onAfterIsMultipleSelection, _onAfterIsMultipleSelection2).call(_this, ...args);
|
145
373
|
});
|
146
374
|
this.addHook('afterRenderer', function () {
|
147
|
-
|
375
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
376
|
+
args[_key10] = arguments[_key10];
|
377
|
+
}
|
378
|
+
return _classPrivateMethodGet(_this, _onAfterRenderer, _onAfterRenderer2).call(_this, ...args);
|
148
379
|
});
|
149
380
|
this.addHook('afterContextMenuDefaultOptions', function () {
|
150
|
-
|
381
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
382
|
+
args[_key11] = arguments[_key11];
|
383
|
+
}
|
384
|
+
return _classPrivateMethodGet(_this, _addMergeActionsToContextMenu, _addMergeActionsToContextMenu2).call(_this, ...args);
|
151
385
|
});
|
152
386
|
this.addHook('afterGetCellMeta', function () {
|
153
|
-
|
387
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
388
|
+
args[_key12] = arguments[_key12];
|
389
|
+
}
|
390
|
+
return _classPrivateMethodGet(_this, _onAfterGetCellMeta, _onAfterGetCellMeta2).call(_this, ...args);
|
154
391
|
});
|
155
392
|
this.addHook('afterViewportRowCalculatorOverride', function () {
|
156
|
-
|
393
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
394
|
+
args[_key13] = arguments[_key13];
|
395
|
+
}
|
396
|
+
return _classPrivateMethodGet(_this, _onAfterViewportRowCalculatorOverride, _onAfterViewportRowCalculatorOverride2).call(_this, ...args);
|
157
397
|
});
|
158
398
|
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
159
|
-
|
399
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
400
|
+
args[_key14] = arguments[_key14];
|
401
|
+
}
|
402
|
+
return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
|
160
403
|
});
|
161
404
|
this.addHook('modifyAutofillRange', function () {
|
162
|
-
|
405
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
406
|
+
args[_key15] = arguments[_key15];
|
407
|
+
}
|
408
|
+
return _classPrivateMethodGet(_this, _onModifyAutofillRange, _onModifyAutofillRange2).call(_this, ...args);
|
163
409
|
});
|
164
410
|
this.addHook('afterCreateCol', function () {
|
165
|
-
|
411
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
412
|
+
args[_key16] = arguments[_key16];
|
413
|
+
}
|
414
|
+
return _classPrivateMethodGet(_this, _onAfterCreateCol, _onAfterCreateCol2).call(_this, ...args);
|
166
415
|
});
|
167
416
|
this.addHook('afterRemoveCol', function () {
|
168
|
-
|
417
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
418
|
+
args[_key17] = arguments[_key17];
|
419
|
+
}
|
420
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this, ...args);
|
169
421
|
});
|
170
422
|
this.addHook('afterCreateRow', function () {
|
171
|
-
|
423
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
424
|
+
args[_key18] = arguments[_key18];
|
425
|
+
}
|
426
|
+
return _classPrivateMethodGet(_this, _onAfterCreateRow, _onAfterCreateRow2).call(_this, ...args);
|
172
427
|
});
|
173
428
|
this.addHook('afterRemoveRow', function () {
|
174
|
-
|
429
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
430
|
+
args[_key19] = arguments[_key19];
|
431
|
+
}
|
432
|
+
return _classPrivateMethodGet(_this, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this, ...args);
|
175
433
|
});
|
176
434
|
this.addHook('afterChange', function () {
|
177
|
-
|
435
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
436
|
+
args[_key20] = arguments[_key20];
|
437
|
+
}
|
438
|
+
return _classPrivateMethodGet(_this, _onAfterChange, _onAfterChange2).call(_this, ...args);
|
178
439
|
});
|
179
440
|
this.addHook('beforeDrawBorders', function () {
|
180
|
-
|
441
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
442
|
+
args[_key21] = arguments[_key21];
|
443
|
+
}
|
444
|
+
return _classPrivateMethodGet(_this, _onBeforeDrawAreaBorders, _onBeforeDrawAreaBorders2).call(_this, ...args);
|
181
445
|
});
|
182
446
|
this.addHook('afterDrawSelection', function () {
|
183
|
-
|
447
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
448
|
+
args[_key22] = arguments[_key22];
|
449
|
+
}
|
450
|
+
return _classPrivateMethodGet(_this, _onAfterDrawSelection, _onAfterDrawSelection2).call(_this, ...args);
|
184
451
|
});
|
185
452
|
this.addHook('beforeRemoveCellClassNames', function () {
|
186
|
-
|
453
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
454
|
+
args[_key23] = arguments[_key23];
|
455
|
+
}
|
456
|
+
return _classPrivateMethodGet(_this, _onBeforeRemoveCellClassNames, _onBeforeRemoveCellClassNames2).call(_this, ...args);
|
187
457
|
});
|
188
458
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
189
459
|
if (source === 'MergeCells') {
|
@@ -458,7 +728,7 @@ export class MergeCells extends BasePlugin {
|
|
458
728
|
if (preventPopulation) {
|
459
729
|
populationInfo = [mergeParent.row, mergeParent.col, clearedData];
|
460
730
|
} else {
|
461
|
-
this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData,
|
731
|
+
this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
|
462
732
|
}
|
463
733
|
if (!auto) {
|
464
734
|
this.ifChromeForceRepaint();
|
@@ -547,17 +817,6 @@ export class MergeCells extends BasePlugin {
|
|
547
817
|
const end = this.hot._createCellCoords(endRow, endColumn);
|
548
818
|
this.unmergeRange(this.hot._createCellRange(start, start, end));
|
549
819
|
}
|
550
|
-
|
551
|
-
/**
|
552
|
-
* `afterInit` hook callback.
|
553
|
-
*
|
554
|
-
* @private
|
555
|
-
*/
|
556
|
-
onAfterInit() {
|
557
|
-
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
558
|
-
this.hot.render();
|
559
|
-
}
|
560
|
-
|
561
820
|
/**
|
562
821
|
* Register shortcuts responsible for toggling a merge.
|
563
822
|
*
|
@@ -591,280 +850,6 @@ export class MergeCells extends BasePlugin {
|
|
591
850
|
const gridContext = shortcutManager.getContext('grid');
|
592
851
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
593
852
|
}
|
594
|
-
|
595
|
-
/**
|
596
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
597
|
-
* hook callback.
|
598
|
-
*
|
599
|
-
* @private
|
600
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
601
|
-
* @returns {boolean}
|
602
|
-
*/
|
603
|
-
onAfterIsMultipleSelection(isMultiple) {
|
604
|
-
if (isMultiple) {
|
605
|
-
const mergedCells = this.mergedCellsCollection.mergedCells;
|
606
|
-
const selectionRange = this.hot.getSelectedRangeLast();
|
607
|
-
for (let group = 0; group < mergedCells.length; group += 1) {
|
608
|
-
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) {
|
609
|
-
return false;
|
610
|
-
}
|
611
|
-
}
|
612
|
-
}
|
613
|
-
return isMultiple;
|
614
|
-
}
|
615
|
-
|
616
|
-
/**
|
617
|
-
* `modifyTransformStart` hook callback.
|
618
|
-
*
|
619
|
-
* @private
|
620
|
-
* @param {object} delta The transformation delta.
|
621
|
-
*/
|
622
|
-
onModifyTransformStart(delta) {
|
623
|
-
const priv = privatePool.get(this);
|
624
|
-
const currentlySelectedRange = this.hot.getSelectedRangeLast();
|
625
|
-
let newDelta = {
|
626
|
-
row: delta.row,
|
627
|
-
col: delta.col
|
628
|
-
};
|
629
|
-
let nextPosition = null;
|
630
|
-
const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
|
631
|
-
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
632
|
-
if (!priv.lastDesiredCoords) {
|
633
|
-
priv.lastDesiredCoords = this.hot._createCellCoords(null, null);
|
634
|
-
}
|
635
|
-
if (mergedParent) {
|
636
|
-
// only merge selected
|
637
|
-
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
638
|
-
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
639
|
-
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
640
|
-
if (!mergeRange.includes(priv.lastDesiredCoords)) {
|
641
|
-
priv.lastDesiredCoords = this.hot._createCellCoords(null, null); // reset outdated version of lastDesiredCoords
|
642
|
-
}
|
643
|
-
|
644
|
-
newDelta.row = priv.lastDesiredCoords.row ? priv.lastDesiredCoords.row - currentPosition.row : newDelta.row;
|
645
|
-
newDelta.col = priv.lastDesiredCoords.col ? priv.lastDesiredCoords.col - currentPosition.col : newDelta.col;
|
646
|
-
if (delta.row > 0) {
|
647
|
-
// moving down
|
648
|
-
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
649
|
-
} else if (delta.row < 0) {
|
650
|
-
// moving up
|
651
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
652
|
-
}
|
653
|
-
if (delta.col > 0) {
|
654
|
-
// moving right
|
655
|
-
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
656
|
-
} else if (delta.col < 0) {
|
657
|
-
// moving left
|
658
|
-
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
659
|
-
}
|
660
|
-
}
|
661
|
-
nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
|
662
|
-
const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
|
663
|
-
if (nextPositionMergedCell) {
|
664
|
-
// skipping the invisible cells in the merge range
|
665
|
-
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
666
|
-
priv.lastDesiredCoords = nextPosition;
|
667
|
-
newDelta = {
|
668
|
-
row: firstRenderableCoords.row - currentPosition.row,
|
669
|
-
col: firstRenderableCoords.col - currentPosition.col
|
670
|
-
};
|
671
|
-
}
|
672
|
-
if (newDelta.row !== 0) {
|
673
|
-
delta.row = newDelta.row;
|
674
|
-
}
|
675
|
-
if (newDelta.col !== 0) {
|
676
|
-
delta.col = newDelta.col;
|
677
|
-
}
|
678
|
-
}
|
679
|
-
|
680
|
-
/**
|
681
|
-
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
682
|
-
*
|
683
|
-
* @private
|
684
|
-
* @param {object} delta The transformation delta.
|
685
|
-
*/
|
686
|
-
onModifyTransformEnd(delta) {
|
687
|
-
const currentSelectionRange = this.hot.getSelectedRangeLast();
|
688
|
-
const newDelta = clone(delta);
|
689
|
-
const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
|
690
|
-
let tempDelta = clone(newDelta);
|
691
|
-
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
|
692
|
-
do {
|
693
|
-
tempDelta = clone(newDelta);
|
694
|
-
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
695
|
-
arrayEach(mergedCellsWithinRange, mergedCell => {
|
696
|
-
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
697
|
-
});
|
698
|
-
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
699
|
-
delta.row = newDelta.row;
|
700
|
-
delta.col = newDelta.col;
|
701
|
-
}
|
702
|
-
|
703
|
-
/**
|
704
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
705
|
-
*
|
706
|
-
* @private
|
707
|
-
* @param {number} row Row index.
|
708
|
-
* @param {number} column Visual column index.
|
709
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
710
|
-
*/
|
711
|
-
onModifyGetCellCoords(row, column) {
|
712
|
-
if (row < 0 || column < 0) {
|
713
|
-
return;
|
714
|
-
}
|
715
|
-
const mergeParent = this.mergedCellsCollection.get(row, column);
|
716
|
-
if (!mergeParent) {
|
717
|
-
return;
|
718
|
-
}
|
719
|
-
const {
|
720
|
-
row: mergeRow,
|
721
|
-
col: mergeColumn,
|
722
|
-
colspan,
|
723
|
-
rowspan
|
724
|
-
} = mergeParent;
|
725
|
-
return [
|
726
|
-
// Most top-left merged cell coords.
|
727
|
-
mergeRow, mergeColumn,
|
728
|
-
// Most bottom-right merged cell coords.
|
729
|
-
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
730
|
-
}
|
731
|
-
|
732
|
-
/**
|
733
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
734
|
-
*
|
735
|
-
* @private
|
736
|
-
* @param {object} defaultOptions The default context menu options.
|
737
|
-
*/
|
738
|
-
addMergeActionsToContextMenu(defaultOptions) {
|
739
|
-
defaultOptions.items.push({
|
740
|
-
name: '---------'
|
741
|
-
}, toggleMergeItem(this));
|
742
|
-
}
|
743
|
-
|
744
|
-
/**
|
745
|
-
* `afterRenderer` hook callback.
|
746
|
-
*
|
747
|
-
* @private
|
748
|
-
* @param {HTMLElement} TD The cell to be modified.
|
749
|
-
* @param {number} row Row index.
|
750
|
-
* @param {number} col Visual column index.
|
751
|
-
*/
|
752
|
-
onAfterRenderer(TD, row, col) {
|
753
|
-
const mergedCell = this.mergedCellsCollection.get(row, col);
|
754
|
-
// We shouldn't override data in the collection.
|
755
|
-
const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : void 0;
|
756
|
-
if (isObject(mergedCellCopy)) {
|
757
|
-
const {
|
758
|
-
rowIndexMapper: rowMapper,
|
759
|
-
columnIndexMapper: columnMapper
|
760
|
-
} = this.hot;
|
761
|
-
const {
|
762
|
-
row: mergeRow,
|
763
|
-
col: mergeColumn,
|
764
|
-
colspan,
|
765
|
-
rowspan
|
766
|
-
} = mergedCellCopy;
|
767
|
-
const [lastMergedRowIndex, lastMergedColumnIndex] = this.translateMergedCellToRenderable(mergeRow, rowspan, mergeColumn, colspan);
|
768
|
-
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
769
|
-
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
770
|
-
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
771
|
-
const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
|
772
|
-
|
773
|
-
// We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
|
774
|
-
mergedCellCopy.row = rowMapper.getNearestNotHiddenIndex(mergedCellCopy.row, 1);
|
775
|
-
// We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
|
776
|
-
mergedCellCopy.col = columnMapper.getNearestNotHiddenIndex(mergedCellCopy.col, 1);
|
777
|
-
// The `rowSpan` property for a `TD` element should be at most equal to number of rendered rows in the merge area.
|
778
|
-
mergedCellCopy.rowspan = Math.min(mergedCellCopy.rowspan, maxRowSpan);
|
779
|
-
// The `colSpan` property for a `TD` element should be at most equal to number of rendered columns in the merge area.
|
780
|
-
mergedCellCopy.colspan = Math.min(mergedCellCopy.colspan, maxColSpan);
|
781
|
-
}
|
782
|
-
applySpanProperties(TD, mergedCellCopy, row, col);
|
783
|
-
}
|
784
|
-
|
785
|
-
/**
|
786
|
-
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
787
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
788
|
-
*
|
789
|
-
* @private
|
790
|
-
* @param {object} coords Cell coords.
|
791
|
-
*/
|
792
|
-
onBeforeSetRangeStart(coords) {
|
793
|
-
// TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
|
794
|
-
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
795
|
-
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
796
|
-
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
797
|
-
// and what was idea for flipping direction inside `expandByRange` method.
|
798
|
-
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
799
|
-
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
800
|
-
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
801
|
-
}
|
802
|
-
}
|
803
|
-
|
804
|
-
/**
|
805
|
-
* `beforeSetRangeEnd` hook callback.
|
806
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
807
|
-
* merged cell.
|
808
|
-
*
|
809
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
810
|
-
*
|
811
|
-
* @private
|
812
|
-
* @param {object} coords Cell coords.
|
813
|
-
*/
|
814
|
-
onBeforeSetRangeEnd(coords) {
|
815
|
-
const selRange = this.hot.getSelectedRangeLast();
|
816
|
-
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
817
|
-
selRange.to = coords;
|
818
|
-
let rangeExpanded = false;
|
819
|
-
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
820
|
-
return;
|
821
|
-
}
|
822
|
-
do {
|
823
|
-
rangeExpanded = false;
|
824
|
-
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
825
|
-
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
826
|
-
const mergedCellRange = cellInfo.getRange();
|
827
|
-
if (selRange.expandByRange(mergedCellRange)) {
|
828
|
-
coords.row = selRange.to.row;
|
829
|
-
coords.col = selRange.to.col;
|
830
|
-
rangeExpanded = true;
|
831
|
-
}
|
832
|
-
}
|
833
|
-
} while (rangeExpanded);
|
834
|
-
}
|
835
|
-
|
836
|
-
/**
|
837
|
-
* The `afterGetCellMeta` hook callback.
|
838
|
-
*
|
839
|
-
* @private
|
840
|
-
* @param {number} row Row index.
|
841
|
-
* @param {number} col Column index.
|
842
|
-
* @param {object} cellProperties The cell properties object.
|
843
|
-
*/
|
844
|
-
onAfterGetCellMeta(row, col, cellProperties) {
|
845
|
-
const mergeParent = this.mergedCellsCollection.get(row, col);
|
846
|
-
if (mergeParent) {
|
847
|
-
if (mergeParent.row !== row || mergeParent.col !== col) {
|
848
|
-
cellProperties.copyable = false;
|
849
|
-
} else {
|
850
|
-
cellProperties.rowspan = mergeParent.rowspan;
|
851
|
-
cellProperties.colspan = mergeParent.colspan;
|
852
|
-
}
|
853
|
-
}
|
854
|
-
}
|
855
|
-
|
856
|
-
/**
|
857
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
858
|
-
*
|
859
|
-
* @private
|
860
|
-
* @param {object} calc The row calculator object.
|
861
|
-
*/
|
862
|
-
onAfterViewportRowCalculatorOverride(calc) {
|
863
|
-
const nrOfColumns = this.hot.countCols();
|
864
|
-
this.modifyViewportRowStart(calc, nrOfColumns);
|
865
|
-
this.modifyViewportRowEnd(calc, nrOfColumns);
|
866
|
-
}
|
867
|
-
|
868
853
|
/**
|
869
854
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
870
855
|
*
|
@@ -922,18 +907,6 @@ export class MergeCells extends BasePlugin {
|
|
922
907
|
}
|
923
908
|
}
|
924
909
|
|
925
|
-
/**
|
926
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
927
|
-
*
|
928
|
-
* @private
|
929
|
-
* @param {object} calc The column calculator object.
|
930
|
-
*/
|
931
|
-
onAfterViewportColumnCalculatorOverride(calc) {
|
932
|
-
const nrOfRows = this.hot.countRows();
|
933
|
-
this.modifyViewportColumnStart(calc, nrOfRows);
|
934
|
-
this.modifyViewportColumnEnd(calc, nrOfRows);
|
935
|
-
}
|
936
|
-
|
937
910
|
/**
|
938
911
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
939
912
|
*
|
@@ -1028,183 +1001,290 @@ export class MergeCells extends BasePlugin {
|
|
1028
1001
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1029
1002
|
return [renderableRow, renderableColumn];
|
1030
1003
|
}
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
let dragArea = drag;
|
1044
|
-
if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
|
1045
|
-
dragArea = select;
|
1046
|
-
return dragArea;
|
1047
|
-
}
|
1048
|
-
const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange({
|
1049
|
-
from: {
|
1050
|
-
row: select[0],
|
1051
|
-
col: select[1]
|
1052
|
-
},
|
1053
|
-
to: {
|
1054
|
-
row: select[2],
|
1055
|
-
col: select[3]
|
1004
|
+
}
|
1005
|
+
function _onAfterInit2() {
|
1006
|
+
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1007
|
+
this.hot.render();
|
1008
|
+
}
|
1009
|
+
function _onAfterIsMultipleSelection2(isMultiple) {
|
1010
|
+
if (isMultiple) {
|
1011
|
+
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1012
|
+
const selectionRange = this.hot.getSelectedRangeLast();
|
1013
|
+
for (let group = 0; group < mergedCells.length; group += 1) {
|
1014
|
+
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) {
|
1015
|
+
return false;
|
1056
1016
|
}
|
1057
|
-
});
|
1058
|
-
if (!mergedCellsWithinSelectionArea) {
|
1059
|
-
return dragArea;
|
1060
1017
|
}
|
1061
|
-
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1062
|
-
return dragArea;
|
1063
|
-
}
|
1064
|
-
|
1065
|
-
/**
|
1066
|
-
* `afterCreateCol` hook callback.
|
1067
|
-
*
|
1068
|
-
* @private
|
1069
|
-
* @param {number} column Column index.
|
1070
|
-
* @param {number} count Number of created columns.
|
1071
|
-
*/
|
1072
|
-
onAfterCreateCol(column, count) {
|
1073
|
-
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1074
1018
|
}
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1019
|
+
return isMultiple;
|
1020
|
+
}
|
1021
|
+
function _onModifyTransformStart2(delta) {
|
1022
|
+
const currentlySelectedRange = this.hot.getSelectedRangeLast();
|
1023
|
+
let newDelta = {
|
1024
|
+
row: delta.row,
|
1025
|
+
col: delta.col
|
1026
|
+
};
|
1027
|
+
let nextPosition = null;
|
1028
|
+
const currentPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row, currentlySelectedRange.highlight.col);
|
1029
|
+
const mergedParent = this.mergedCellsCollection.get(currentPosition.row, currentPosition.col);
|
1030
|
+
if (!_classPrivateFieldGet(this, _lastDesiredCoords)) {
|
1031
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null));
|
1085
1032
|
}
|
1033
|
+
if (mergedParent) {
|
1034
|
+
// only merge selected
|
1035
|
+
const mergeTopLeft = this.hot._createCellCoords(mergedParent.row, mergedParent.col);
|
1036
|
+
const mergeBottomRight = this.hot._createCellCoords(mergedParent.row + mergedParent.rowspan - 1, mergedParent.col + mergedParent.colspan - 1);
|
1037
|
+
const mergeRange = this.hot._createCellRange(mergeTopLeft, mergeTopLeft, mergeBottomRight);
|
1038
|
+
if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
|
1039
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1040
|
+
}
|
1086
1041
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
if (
|
1097
|
-
|
1042
|
+
newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
|
1043
|
+
newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
|
1044
|
+
if (delta.row > 0) {
|
1045
|
+
// moving down
|
1046
|
+
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
1047
|
+
} else if (delta.row < 0) {
|
1048
|
+
// moving up
|
1049
|
+
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1050
|
+
}
|
1051
|
+
if (delta.col > 0) {
|
1052
|
+
// moving right
|
1053
|
+
newDelta.col = mergedParent.col + mergedParent.colspan - 1 - currentPosition.col + delta.col;
|
1054
|
+
} else if (delta.col < 0) {
|
1055
|
+
// moving left
|
1056
|
+
newDelta.col = currentPosition.col - mergedParent.col + delta.col;
|
1098
1057
|
}
|
1099
|
-
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1100
1058
|
}
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1059
|
+
nextPosition = this.hot._createCellCoords(currentlySelectedRange.highlight.row + newDelta.row, currentlySelectedRange.highlight.col + newDelta.col);
|
1060
|
+
const nextPositionMergedCell = this.mergedCellsCollection.get(nextPosition.row, nextPosition.col);
|
1061
|
+
if (nextPositionMergedCell) {
|
1062
|
+
// skipping the invisible cells in the merge range
|
1063
|
+
const firstRenderableCoords = this.mergedCellsCollection.getFirstRenderableCoords(nextPositionMergedCell.row, nextPositionMergedCell.col);
|
1064
|
+
_classPrivateFieldSet(this, _lastDesiredCoords, nextPosition);
|
1065
|
+
newDelta = {
|
1066
|
+
row: firstRenderableCoords.row - currentPosition.row,
|
1067
|
+
col: firstRenderableCoords.col - currentPosition.col
|
1068
|
+
};
|
1111
1069
|
}
|
1112
|
-
|
1113
|
-
|
1114
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1115
|
-
*
|
1116
|
-
* @private
|
1117
|
-
* @param {Array} changes The changes array.
|
1118
|
-
* @param {string} source Determines the source of the change.
|
1119
|
-
*/
|
1120
|
-
onAfterChange(changes, source) {
|
1121
|
-
if (source !== 'Autofill.fill') {
|
1122
|
-
return;
|
1123
|
-
}
|
1124
|
-
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1070
|
+
if (newDelta.row !== 0) {
|
1071
|
+
delta.row = newDelta.row;
|
1125
1072
|
}
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1073
|
+
if (newDelta.col !== 0) {
|
1074
|
+
delta.col = newDelta.col;
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
function _onModifyTransformEnd2(delta) {
|
1078
|
+
const currentSelectionRange = this.hot.getSelectedRangeLast();
|
1079
|
+
const newDelta = clone(delta);
|
1080
|
+
const newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
|
1081
|
+
let tempDelta = clone(newDelta);
|
1082
|
+
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(newSelectionRange, true);
|
1083
|
+
do {
|
1084
|
+
tempDelta = clone(newDelta);
|
1085
|
+
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
1086
|
+
arrayEach(mergedCellsWithinRange, mergedCell => {
|
1087
|
+
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
1088
|
+
});
|
1089
|
+
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
1090
|
+
delta.row = newDelta.row;
|
1091
|
+
delta.col = newDelta.col;
|
1092
|
+
}
|
1093
|
+
function _onModifyGetCellCoords2(row, column) {
|
1094
|
+
if (row < 0 || column < 0) {
|
1095
|
+
return;
|
1096
|
+
}
|
1097
|
+
const mergeParent = this.mergedCellsCollection.get(row, column);
|
1098
|
+
if (!mergeParent) {
|
1099
|
+
return;
|
1145
1100
|
}
|
1101
|
+
const {
|
1102
|
+
row: mergeRow,
|
1103
|
+
col: mergeColumn,
|
1104
|
+
colspan,
|
1105
|
+
rowspan
|
1106
|
+
} = mergeParent;
|
1107
|
+
return [
|
1108
|
+
// Most top-left merged cell coords.
|
1109
|
+
mergeRow, mergeColumn,
|
1110
|
+
// Most bottom-right merged cell coords.
|
1111
|
+
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1112
|
+
}
|
1113
|
+
function _addMergeActionsToContextMenu2(defaultOptions) {
|
1114
|
+
defaultOptions.items.push({
|
1115
|
+
name: '---------'
|
1116
|
+
}, toggleMergeItem(this));
|
1117
|
+
}
|
1118
|
+
function _onAfterRenderer2(TD, row, col) {
|
1119
|
+
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1120
|
+
// We shouldn't override data in the collection.
|
1121
|
+
const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : undefined;
|
1122
|
+
if (isObject(mergedCellCopy)) {
|
1123
|
+
const {
|
1124
|
+
rowIndexMapper: rowMapper,
|
1125
|
+
columnIndexMapper: columnMapper
|
1126
|
+
} = this.hot;
|
1127
|
+
const {
|
1128
|
+
row: mergeRow,
|
1129
|
+
col: mergeColumn,
|
1130
|
+
colspan,
|
1131
|
+
rowspan
|
1132
|
+
} = mergedCellCopy;
|
1133
|
+
const [lastMergedRowIndex, lastMergedColumnIndex] = this.translateMergedCellToRenderable(mergeRow, rowspan, mergeColumn, colspan);
|
1134
|
+
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
1135
|
+
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
1136
|
+
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
1137
|
+
const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
|
1146
1138
|
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1139
|
+
// We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
|
1140
|
+
mergedCellCopy.row = rowMapper.getNearestNotHiddenIndex(mergedCellCopy.row, 1);
|
1141
|
+
// We just try to determine some values basing on the actual number of rendered indexes (some columns may be hidden).
|
1142
|
+
mergedCellCopy.col = columnMapper.getNearestNotHiddenIndex(mergedCellCopy.col, 1);
|
1143
|
+
// The `rowSpan` property for a `TD` element should be at most equal to number of rendered rows in the merge area.
|
1144
|
+
mergedCellCopy.rowspan = Math.min(mergedCellCopy.rowspan, maxRowSpan);
|
1145
|
+
// The `colSpan` property for a `TD` element should be at most equal to number of rendered columns in the merge area.
|
1146
|
+
mergedCellCopy.colspan = Math.min(mergedCellCopy.colspan, maxColSpan);
|
1147
|
+
}
|
1148
|
+
applySpanProperties(TD, mergedCellCopy, row, col);
|
1149
|
+
}
|
1150
|
+
function _onBeforeSetRangeStart2(coords) {
|
1151
|
+
// TODO: It is a workaround, but probably this hook may be needed. Every selection on the merge area
|
1152
|
+
// could set start point of the selection to the start of the merge area. However, logic inside `expandByRange` need
|
1153
|
+
// an initial start point. Click on the merge cell when there are some hidden indexes break the logic in some cases.
|
1154
|
+
// Please take a look at #7010 for more information. I'm not sure if selection directions are calculated properly
|
1155
|
+
// and what was idea for flipping direction inside `expandByRange` method.
|
1156
|
+
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1157
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1158
|
+
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
function _onBeforeSetRangeEnd2(coords) {
|
1162
|
+
const selRange = this.hot.getSelectedRangeLast();
|
1163
|
+
selRange.highlight = this.hot._createCellCoords(selRange.highlight.row, selRange.highlight.col); // clone in case we will modify its reference
|
1164
|
+
selRange.to = coords;
|
1165
|
+
let rangeExpanded = false;
|
1166
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1167
|
+
return;
|
1168
|
+
}
|
1169
|
+
do {
|
1170
|
+
rangeExpanded = false;
|
1171
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1172
|
+
const cellInfo = this.mergedCellsCollection.mergedCells[i];
|
1173
|
+
const mergedCellRange = cellInfo.getRange();
|
1174
|
+
if (selRange.expandByRange(mergedCellRange)) {
|
1175
|
+
coords.row = selRange.to.row;
|
1176
|
+
coords.col = selRange.to.col;
|
1177
|
+
rangeExpanded = true;
|
1178
|
+
}
|
1165
1179
|
}
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
coords.col = mergedCellAtCoords.col;
|
1180
|
+
} while (rangeExpanded);
|
1181
|
+
}
|
1182
|
+
function _onAfterGetCellMeta2(row, col, cellProperties) {
|
1183
|
+
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1184
|
+
if (mergeParent) {
|
1185
|
+
if (mergeParent.row !== row || mergeParent.col !== col) {
|
1186
|
+
cellProperties.copyable = false;
|
1187
|
+
} else {
|
1188
|
+
cellProperties.rowspan = mergeParent.rowspan;
|
1189
|
+
cellProperties.colspan = mergeParent.colspan;
|
1177
1190
|
}
|
1178
1191
|
}
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1192
|
+
}
|
1193
|
+
function _onAfterViewportRowCalculatorOverride2(calc) {
|
1194
|
+
const nrOfColumns = this.hot.countCols();
|
1195
|
+
this.modifyViewportRowStart(calc, nrOfColumns);
|
1196
|
+
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1197
|
+
}
|
1198
|
+
function _onAfterViewportColumnCalculatorOverride2(calc) {
|
1199
|
+
const nrOfRows = this.hot.countRows();
|
1200
|
+
this.modifyViewportColumnStart(calc, nrOfRows);
|
1201
|
+
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1202
|
+
}
|
1203
|
+
function _onModifyAutofillRange2(drag, select) {
|
1204
|
+
this.autofillCalculations.correctSelectionAreaSize(select);
|
1205
|
+
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1206
|
+
let dragArea = drag;
|
1207
|
+
if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
|
1208
|
+
dragArea = select;
|
1209
|
+
return dragArea;
|
1210
|
+
}
|
1211
|
+
const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange({
|
1212
|
+
from: {
|
1213
|
+
row: select[0],
|
1214
|
+
col: select[1]
|
1215
|
+
},
|
1216
|
+
to: {
|
1217
|
+
row: select[2],
|
1218
|
+
col: select[3]
|
1196
1219
|
}
|
1197
|
-
|
1220
|
+
});
|
1221
|
+
if (!mergedCellsWithinSelectionArea) {
|
1222
|
+
return dragArea;
|
1198
1223
|
}
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1224
|
+
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1225
|
+
return dragArea;
|
1226
|
+
}
|
1227
|
+
function _onAfterCreateCol2(column, count) {
|
1228
|
+
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1229
|
+
}
|
1230
|
+
function _onAfterRemoveCol2(column, count) {
|
1231
|
+
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1232
|
+
}
|
1233
|
+
function _onAfterCreateRow2(row, count, source) {
|
1234
|
+
if (source === 'auto') {
|
1235
|
+
return;
|
1236
|
+
}
|
1237
|
+
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1238
|
+
}
|
1239
|
+
function _onAfterRemoveRow2(row, count) {
|
1240
|
+
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1241
|
+
}
|
1242
|
+
function _onAfterChange2(changes, source) {
|
1243
|
+
if (source !== 'Autofill.fill') {
|
1244
|
+
return;
|
1245
|
+
}
|
1246
|
+
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1247
|
+
}
|
1248
|
+
function _onBeforeDrawAreaBorders2(corners, className) {
|
1249
|
+
if (className && className === 'area') {
|
1250
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1251
|
+
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
1252
|
+
arrayEach(mergedCellsWithinRange, mergedCell => {
|
1253
|
+
if (selectedRange.getBottomEndCorner().row === mergedCell.getLastRow() && selectedRange.getBottomEndCorner().col === mergedCell.getLastColumn()) {
|
1254
|
+
corners[2] = mergedCell.row;
|
1255
|
+
corners[3] = mergedCell.col;
|
1256
|
+
}
|
1257
|
+
});
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
function _onAfterModifyTransformStart2(coords, rowTransformDir, colTransformDir) {
|
1261
|
+
if (!this.enabled) {
|
1262
|
+
return;
|
1263
|
+
}
|
1264
|
+
const mergedCellAtCoords = this.mergedCellsCollection.get(coords.row, coords.col);
|
1265
|
+
if (!mergedCellAtCoords) {
|
1266
|
+
return;
|
1267
|
+
}
|
1268
|
+
const goingDown = rowTransformDir > 0;
|
1269
|
+
const goingUp = rowTransformDir < 0;
|
1270
|
+
const goingLeft = colTransformDir < 0;
|
1271
|
+
const goingRight = colTransformDir > 0;
|
1272
|
+
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1273
|
+
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1274
|
+
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1275
|
+
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1276
|
+
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1277
|
+
coords.row = mergedCellAtCoords.row;
|
1278
|
+
coords.col = mergedCellAtCoords.col;
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1282
|
+
// Nothing's selected (hook might be triggered by the custom borders)
|
1283
|
+
if (!cornersOfSelection) {
|
1284
|
+
return;
|
1209
1285
|
}
|
1286
|
+
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1287
|
+
}
|
1288
|
+
function _onBeforeRemoveCellClassNames2() {
|
1289
|
+
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1210
1290
|
}
|