handsontable 0.0.0-next-53a190b-20240403 → 0.0.0-next-5a535ed-20240403
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 +17 -12
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +17 -12
- package/3rdparty/walkontable/src/calculator/viewportRows.js +15 -10
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +15 -10
- package/3rdparty/walkontable/src/cell/coords.js +17 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +17 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +1 -2
- package/3rdparty/walkontable/src/cell/range.js +28 -40
- package/3rdparty/walkontable/src/cell/range.mjs +28 -40
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +104 -72
- package/3rdparty/walkontable/src/event.mjs +104 -72
- package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -15
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -16
- package/3rdparty/walkontable/src/overlay/top.js +0 -11
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -12
- package/3rdparty/walkontable/src/overlays.js +4 -46
- package/3rdparty/walkontable/src/overlays.mjs +4 -46
- package/3rdparty/walkontable/src/scroll.js +17 -15
- package/3rdparty/walkontable/src/scroll.mjs +17 -15
- package/3rdparty/walkontable/src/selection/manager.js +69 -48
- package/3rdparty/walkontable/src/selection/manager.mjs +69 -48
- package/3rdparty/walkontable/src/selection/scanner.js +42 -33
- package/3rdparty/walkontable/src/selection/scanner.mjs +42 -33
- package/3rdparty/walkontable/src/utils/columnStretching.js +44 -27
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +44 -27
- 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 -77
- package/core.mjs +22 -77
- 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/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dataMap/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +4 -4
- package/dist/handsontable.full.css +4 -4
- package/dist/handsontable.full.js +9121 -9062
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +6573 -6967
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +25 -25
- 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 +23 -25
- package/editorManager.mjs +23 -25
- package/editors/autocompleteEditor/autocompleteEditor.js +10 -6
- package/editors/autocompleteEditor/autocompleteEditor.mjs +10 -6
- package/editors/selectEditor/selectEditor.js +19 -20
- package/editors/selectEditor/selectEditor.mjs +19 -20
- package/eventManager.js +1 -1
- package/eventManager.mjs +1 -1
- package/focusManager.js +82 -64
- package/focusManager.mjs +82 -64
- package/helpers/dom/element.js +1 -23
- package/helpers/dom/element.mjs +1 -21
- 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 +0 -10
- package/package.json +2 -7
- package/pluginHooks.d.ts +3 -4
- package/pluginHooks.js +38 -99
- package/pluginHooks.mjs +38 -99
- package/plugins/autoColumnSize/autoColumnSize.js +65 -49
- package/plugins/autoColumnSize/autoColumnSize.mjs +65 -49
- package/plugins/autoRowSize/autoRowSize.js +34 -28
- package/plugins/autoRowSize/autoRowSize.mjs +34 -28
- package/plugins/autofill/autofill.js +38 -30
- package/plugins/autofill/autofill.mjs +38 -30
- package/plugins/base/base.js +17 -12
- package/plugins/base/base.mjs +17 -12
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
- package/plugins/collapsibleColumns/collapsibleColumns.js +50 -59
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +50 -59
- package/plugins/columnSorting/columnSorting.js +45 -49
- package/plugins/columnSorting/columnSorting.mjs +45 -49
- package/plugins/columnSummary/columnSummary.js +26 -22
- package/plugins/columnSummary/columnSummary.mjs +26 -22
- package/plugins/comments/comments.js +158 -116
- package/plugins/comments/comments.mjs +158 -116
- package/plugins/contextMenu/contextMenu.js +26 -20
- package/plugins/contextMenu/contextMenu.mjs +26 -20
- 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 +21 -13
- package/plugins/contextMenu/menu/menu.mjs +21 -13
- package/plugins/contextMenu/menu/positioner.js +58 -41
- package/plugins/contextMenu/menu/positioner.mjs +58 -41
- package/plugins/copyPaste/copyPaste.js +157 -116
- package/plugins/copyPaste/copyPaste.mjs +157 -116
- package/plugins/copyPaste/copyableRanges.js +66 -43
- package/plugins/copyPaste/copyableRanges.mjs +66 -43
- package/plugins/customBorders/customBorders.js +13 -11
- package/plugins/customBorders/customBorders.mjs +13 -11
- package/plugins/dragToScroll/dragToScroll.js +6 -6
- package/plugins/dragToScroll/dragToScroll.mjs +6 -6
- package/plugins/dropdownMenu/dropdownMenu.js +106 -80
- package/plugins/dropdownMenu/dropdownMenu.mjs +106 -80
- 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 +15 -13
- package/plugins/filters/component/condition.mjs +15 -13
- package/plugins/filters/component/operators.js +6 -6
- package/plugins/filters/component/operators.mjs +6 -6
- package/plugins/filters/component/value.js +28 -24
- package/plugins/filters/component/value.mjs +28 -24
- package/plugins/filters/conditionUpdateObserver.js +24 -22
- package/plugins/filters/conditionUpdateObserver.mjs +24 -22
- package/plugins/filters/dataFilter.js +1 -1
- package/plugins/filters/dataFilter.mjs +1 -1
- package/plugins/filters/filters.js +95 -81
- package/plugins/filters/filters.mjs +95 -81
- package/plugins/filters/ui/input.js +19 -13
- package/plugins/filters/ui/input.mjs +19 -13
- package/plugins/filters/ui/link.js +13 -8
- package/plugins/filters/ui/link.mjs +13 -8
- package/plugins/filters/ui/multipleSelect.js +112 -85
- package/plugins/filters/ui/multipleSelect.mjs +112 -85
- package/plugins/filters/ui/radioInput.js +20 -12
- package/plugins/filters/ui/radioInput.mjs +20 -12
- package/plugins/filters/ui/select.js +72 -50
- package/plugins/filters/ui/select.mjs +71 -49
- package/plugins/formulas/formulas.js +326 -268
- package/plugins/formulas/formulas.mjs +327 -269
- package/plugins/formulas/indexSyncer/axisSyncer.js +61 -38
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +61 -38
- package/plugins/formulas/indexSyncer/index.js +48 -25
- package/plugins/formulas/indexSyncer/index.mjs +48 -25
- package/plugins/hiddenColumns/hiddenColumns.js +83 -64
- package/plugins/hiddenColumns/hiddenColumns.mjs +83 -64
- package/plugins/hiddenRows/hiddenRows.js +82 -63
- package/plugins/hiddenRows/hiddenRows.mjs +82 -63
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +32 -24
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +33 -25
- package/plugins/manualColumnMove/manualColumnMove.js +170 -126
- package/plugins/manualColumnMove/manualColumnMove.mjs +170 -126
- package/plugins/manualColumnResize/manualColumnResize.js +230 -169
- package/plugins/manualColumnResize/manualColumnResize.mjs +230 -169
- package/plugins/manualRowMove/manualRowMove.js +128 -99
- package/plugins/manualRowMove/manualRowMove.mjs +128 -99
- package/plugins/manualRowResize/manualRowResize.js +209 -150
- package/plugins/manualRowResize/manualRowResize.mjs +209 -150
- 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 +397 -499
- package/plugins/mergeCells/mergeCells.mjs +397 -499
- package/plugins/multiColumnSorting/multiColumnSorting.js +2 -8
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -8
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +253 -205
- package/plugins/nestedHeaders/nestedHeaders.mjs +254 -206
- package/plugins/nestedHeaders/stateManager/headersTree.js +32 -21
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +32 -21
- package/plugins/nestedHeaders/stateManager/index.js +41 -30
- package/plugins/nestedHeaders/stateManager/index.mjs +41 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +30 -19
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +30 -19
- package/plugins/nestedRows/data/dataManager.js +1 -1
- package/plugins/nestedRows/data/dataManager.mjs +1 -1
- package/plugins/nestedRows/nestedRows.js +182 -151
- package/plugins/nestedRows/nestedRows.mjs +183 -152
- package/plugins/nestedRows/ui/contextMenu.js +15 -11
- package/plugins/nestedRows/ui/contextMenu.mjs +14 -10
- 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 +19 -15
- package/plugins/touchScroll/touchScroll.mjs +20 -16
- 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 +0 -2
- package/selection/highlight/visualSelection.mjs +0 -2
- package/selection/selection.js +67 -225
- package/selection/selection.mjs +66 -224
- package/selection/transformation.js +118 -149
- package/selection/transformation.mjs +118 -149
- 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 +3 -9
- package/shortcutContexts/grid.mjs +3 -9
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/tableView.js +78 -52
- package/tableView.mjs +78 -52
- package/translations/changesObservable/observable.js +38 -21
- package/translations/changesObservable/observable.mjs +38 -21
- package/translations/changesObservable/observer.js +12 -7
- package/translations/changesObservable/observer.mjs +11 -6
- 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 +44 -26
- package/utils/interval.mjs +44 -26
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
- package/i18n/languages/ar-AR.d.ts +0 -5
- package/i18n/languages/cs-CZ.d.ts +0 -5
- package/i18n/languages/hr-HR.d.ts +0 -5
- package/i18n/languages/sr-SP.d.ts +0 -5
- package/plugins/mergeCells/focusOrder.js +0 -305
- package/plugins/mergeCells/focusOrder.mjs +0 -300
package/selection/selection.mjs
CHANGED
@@ -4,9 +4,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
4
4
|
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; }
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
6
6
|
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); }
|
7
|
-
function _classPrivateFieldGet(
|
8
|
-
function
|
9
|
-
function
|
7
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
8
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
9
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
10
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
11
|
+
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; } }
|
10
12
|
import Highlight, { AREA_TYPE, HEADER_TYPE, FOCUS_TYPE } from "./highlight/highlight.mjs";
|
11
13
|
import SelectionRange from "./range.mjs";
|
12
14
|
import { createObjectPropListener, mixin } from "./../helpers/object.mjs";
|
@@ -22,9 +24,6 @@ import { A11Y_SELECTED } from "../helpers/a11y.mjs";
|
|
22
24
|
* @class Selection
|
23
25
|
* @util
|
24
26
|
*/
|
25
|
-
var _transformation = /*#__PURE__*/new WeakMap();
|
26
|
-
var _focusTransformation = /*#__PURE__*/new WeakMap();
|
27
|
-
var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
|
28
27
|
var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
|
29
28
|
var _selectionSource = /*#__PURE__*/new WeakMap();
|
30
29
|
var _expectedLayersCount = /*#__PURE__*/new WeakMap();
|
@@ -64,17 +63,11 @@ class Selection {
|
|
64
63
|
*/
|
65
64
|
_defineProperty(this, "highlight", void 0);
|
66
65
|
/**
|
67
|
-
* The module for modifying coordinates
|
66
|
+
* The module for modifying coordinates.
|
68
67
|
*
|
69
68
|
* @type {Transformation}
|
70
69
|
*/
|
71
|
-
|
72
|
-
/**
|
73
|
-
* The module for modifying coordinates of the focus selection.
|
74
|
-
*
|
75
|
-
* @type {Transformation}
|
76
|
-
*/
|
77
|
-
_classPrivateFieldInitSpec(this, _focusTransformation, void 0);
|
70
|
+
_defineProperty(this, "transformation", void 0);
|
78
71
|
/**
|
79
72
|
* The collection of the selection layer levels where the whole row was selected using the row header or
|
80
73
|
* the corner header.
|
@@ -89,31 +82,34 @@ class Selection {
|
|
89
82
|
* @type {Set<number>}
|
90
83
|
*/
|
91
84
|
_defineProperty(this, "selectedByColumnHeader", new Set());
|
92
|
-
/**
|
93
|
-
* The flag which determines if the focus selection was changed.
|
94
|
-
*
|
95
|
-
* @type {boolean}
|
96
|
-
*/
|
97
|
-
_classPrivateFieldInitSpec(this, _isFocusSelectionChanged, false);
|
98
85
|
/**
|
99
86
|
* When sets disable highlighting the headers even when the logical coordinates points on them.
|
100
87
|
*
|
101
88
|
* @type {boolean}
|
102
89
|
*/
|
103
|
-
_classPrivateFieldInitSpec(this, _disableHeadersHighlight,
|
90
|
+
_classPrivateFieldInitSpec(this, _disableHeadersHighlight, {
|
91
|
+
writable: true,
|
92
|
+
value: false
|
93
|
+
});
|
104
94
|
/**
|
105
95
|
* The source of the selection. It can be one of the following values: `mouse`, `unknown` or any other string.
|
106
96
|
*
|
107
97
|
* @type {'mouse' | 'unknown' | string}
|
108
98
|
*/
|
109
|
-
_classPrivateFieldInitSpec(this, _selectionSource,
|
99
|
+
_classPrivateFieldInitSpec(this, _selectionSource, {
|
100
|
+
writable: true,
|
101
|
+
value: 'unknown'
|
102
|
+
});
|
110
103
|
/**
|
111
104
|
* The number of expected layers. It is used mostly to track when the last selection layer of non-contiguous
|
112
105
|
* selection is applied, thus the viewport scroll is triggered.
|
113
106
|
*
|
114
107
|
* @param {number}
|
115
108
|
*/
|
116
|
-
_classPrivateFieldInitSpec(this, _expectedLayersCount,
|
109
|
+
_classPrivateFieldInitSpec(this, _expectedLayersCount, {
|
110
|
+
writable: true,
|
111
|
+
value: -1
|
112
|
+
});
|
117
113
|
this.settings = settings;
|
118
114
|
this.tableProps = tableProps;
|
119
115
|
this.highlight = new Highlight({
|
@@ -136,112 +132,71 @@ class Selection {
|
|
136
132
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
137
133
|
createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
|
138
134
|
});
|
139
|
-
|
135
|
+
this.transformation = new Transformation(this.selectedRange, {
|
140
136
|
rowIndexMapper: this.tableProps.rowIndexMapper,
|
141
137
|
columnIndexMapper: this.tableProps.columnIndexMapper,
|
142
138
|
countRenderableRows: () => this.tableProps.countRenderableRows(),
|
143
139
|
countRenderableColumns: () => this.tableProps.countRenderableColumns(),
|
140
|
+
countRowHeaders: () => this.tableProps.countRowHeaders(),
|
141
|
+
countColHeaders: () => this.tableProps.countColHeaders(),
|
144
142
|
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
145
143
|
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
146
|
-
findFirstNonHiddenRenderableRow: function () {
|
147
|
-
return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
|
148
|
-
},
|
149
|
-
findFirstNonHiddenRenderableColumn: function () {
|
150
|
-
return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
|
151
|
-
},
|
152
144
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
145
|
+
navigableHeaders: () => settings.navigableHeaders,
|
153
146
|
fixedRowsBottom: () => settings.fixedRowsBottom,
|
154
147
|
minSpareRows: () => settings.minSpareRows,
|
155
148
|
minSpareCols: () => settings.minSpareCols,
|
156
149
|
autoWrapRow: () => settings.autoWrapRow,
|
157
150
|
autoWrapCol: () => settings.autoWrapCol
|
158
|
-
})
|
159
|
-
|
160
|
-
rowIndexMapper: this.tableProps.rowIndexMapper,
|
161
|
-
columnIndexMapper: this.tableProps.columnIndexMapper,
|
162
|
-
countRenderableRows: () => {
|
163
|
-
const range = this.selectedRange.current();
|
164
|
-
return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
|
165
|
-
},
|
166
|
-
countRenderableColumns: () => {
|
167
|
-
const range = this.selectedRange.current();
|
168
|
-
return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
|
169
|
-
},
|
170
|
-
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
171
|
-
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
172
|
-
findFirstNonHiddenRenderableRow: function () {
|
173
|
-
return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
|
174
|
-
},
|
175
|
-
findFirstNonHiddenRenderableColumn: function () {
|
176
|
-
return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
|
177
|
-
},
|
178
|
-
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
179
|
-
fixedRowsBottom: () => 0,
|
180
|
-
minSpareRows: () => 0,
|
181
|
-
minSpareCols: () => 0,
|
182
|
-
autoWrapRow: () => true,
|
183
|
-
autoWrapCol: () => true
|
184
|
-
}));
|
185
|
-
_classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformStart', function () {
|
151
|
+
});
|
152
|
+
this.transformation.addLocalHook('beforeTransformStart', function () {
|
186
153
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
187
154
|
args[_key] = arguments[_key];
|
188
155
|
}
|
189
156
|
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
190
157
|
});
|
191
|
-
|
158
|
+
this.transformation.addLocalHook('afterTransformStart', function () {
|
192
159
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
193
160
|
args[_key2] = arguments[_key2];
|
194
161
|
}
|
195
162
|
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
196
163
|
});
|
197
|
-
|
164
|
+
this.transformation.addLocalHook('beforeTransformEnd', function () {
|
198
165
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
199
166
|
args[_key3] = arguments[_key3];
|
200
167
|
}
|
201
168
|
return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
|
202
169
|
});
|
203
|
-
|
170
|
+
this.transformation.addLocalHook('afterTransformEnd', function () {
|
204
171
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
205
172
|
args[_key4] = arguments[_key4];
|
206
173
|
}
|
207
174
|
return _this.runLocalHooks('afterModifyTransformEnd', ...args);
|
208
175
|
});
|
209
|
-
|
176
|
+
this.transformation.addLocalHook('insertRowRequire', function () {
|
210
177
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
211
178
|
args[_key5] = arguments[_key5];
|
212
179
|
}
|
213
180
|
return _this.runLocalHooks('insertRowRequire', ...args);
|
214
181
|
});
|
215
|
-
|
182
|
+
this.transformation.addLocalHook('insertColRequire', function () {
|
216
183
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
217
184
|
args[_key6] = arguments[_key6];
|
218
185
|
}
|
219
186
|
return _this.runLocalHooks('insertColRequire', ...args);
|
220
187
|
});
|
221
|
-
|
188
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
222
189
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
223
190
|
args[_key7] = arguments[_key7];
|
224
191
|
}
|
225
192
|
return _this.runLocalHooks('beforeRowWrap', ...args);
|
226
193
|
});
|
227
|
-
|
194
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
228
195
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
229
196
|
args[_key8] = arguments[_key8];
|
230
197
|
}
|
231
198
|
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
232
199
|
});
|
233
|
-
_classPrivateFieldGet(_focusTransformation, this).addLocalHook('beforeTransformStart', function () {
|
234
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
235
|
-
args[_key9] = arguments[_key9];
|
236
|
-
}
|
237
|
-
return _this.runLocalHooks('beforeModifyTransformFocus', ...args);
|
238
|
-
});
|
239
|
-
_classPrivateFieldGet(_focusTransformation, this).addLocalHook('afterTransformStart', function () {
|
240
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
241
|
-
args[_key10] = arguments[_key10];
|
242
|
-
}
|
243
|
-
return _this.runLocalHooks('afterModifyTransformFocus', ...args);
|
244
|
-
});
|
245
200
|
}
|
246
201
|
|
247
202
|
/**
|
@@ -259,14 +214,14 @@ class Selection {
|
|
259
214
|
* @param {'mouse' | 'unknown' | string} sourceName The source name.
|
260
215
|
*/
|
261
216
|
markSource(sourceName) {
|
262
|
-
_classPrivateFieldSet(
|
217
|
+
_classPrivateFieldSet(this, _selectionSource, sourceName);
|
263
218
|
}
|
264
219
|
|
265
220
|
/**
|
266
221
|
* Marks end of the selection source. It restores the selection source to default value which is 'unknown'.
|
267
222
|
*/
|
268
223
|
markEndSource() {
|
269
|
-
_classPrivateFieldSet(
|
224
|
+
_classPrivateFieldSet(this, _selectionSource, 'unknown');
|
270
225
|
}
|
271
226
|
|
272
227
|
/**
|
@@ -275,7 +230,7 @@ class Selection {
|
|
275
230
|
* @returns {'mouse' | 'unknown' | string}
|
276
231
|
*/
|
277
232
|
getSelectionSource() {
|
278
|
-
return _classPrivateFieldGet(
|
233
|
+
return _classPrivateFieldGet(this, _selectionSource);
|
279
234
|
}
|
280
235
|
|
281
236
|
/**
|
@@ -285,7 +240,7 @@ class Selection {
|
|
285
240
|
* @param {number} layersCount The number of expected layers.
|
286
241
|
*/
|
287
242
|
setExpectedLayers(layersCount) {
|
288
|
-
_classPrivateFieldSet(
|
243
|
+
_classPrivateFieldSet(this, _expectedLayersCount, layersCount);
|
289
244
|
}
|
290
245
|
|
291
246
|
/**
|
@@ -301,7 +256,7 @@ class Selection {
|
|
301
256
|
finish() {
|
302
257
|
this.runLocalHooks('afterSelectionFinished', Array.from(this.selectedRange));
|
303
258
|
this.inProgress = false;
|
304
|
-
_classPrivateFieldSet(
|
259
|
+
_classPrivateFieldSet(this, _expectedLayersCount, -1);
|
305
260
|
}
|
306
261
|
|
307
262
|
/**
|
@@ -332,7 +287,6 @@ class Selection {
|
|
332
287
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
333
288
|
// should be handled by next methods.
|
334
289
|
const coordsClone = coords.clone();
|
335
|
-
_classPrivateFieldSet(_isFocusSelectionChanged, this, false);
|
336
290
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
337
291
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
|
338
292
|
this.selectedRange.clear();
|
@@ -390,20 +344,7 @@ class Selection {
|
|
390
344
|
cellRange.setFrom(cellRange.highlight);
|
391
345
|
cellRange.setTo(cellRange.highlight);
|
392
346
|
} else {
|
393
|
-
const horizontalDir = cellRange.getHorizontalDirection();
|
394
|
-
const verticalDir = cellRange.getVerticalDirection();
|
395
|
-
const isMultiple = this.isMultiple();
|
396
347
|
cellRange.setTo(coordsClone);
|
397
|
-
if (isMultiple && (horizontalDir !== cellRange.getHorizontalDirection() || cellRange.getWidth() === 1 && !cellRange.includes(cellRange.highlight))) {
|
398
|
-
cellRange.from.assign({
|
399
|
-
col: cellRange.highlight.col
|
400
|
-
});
|
401
|
-
}
|
402
|
-
if (isMultiple && (verticalDir !== cellRange.getVerticalDirection() || cellRange.getHeight() === 1 && !cellRange.includes(cellRange.highlight))) {
|
403
|
-
cellRange.from.assign({
|
404
|
-
row: cellRange.highlight.row
|
405
|
-
});
|
406
|
-
}
|
407
348
|
}
|
408
349
|
|
409
350
|
// Prevent creating "area" selection that overlaps headers.
|
@@ -413,7 +354,11 @@ class Selection {
|
|
413
354
|
}
|
414
355
|
}
|
415
356
|
this.runLocalHooks('beforeHighlightSet');
|
416
|
-
this.
|
357
|
+
const focusHighlight = this.highlight.getFocus();
|
358
|
+
focusHighlight.clear();
|
359
|
+
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
360
|
+
focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
361
|
+
}
|
417
362
|
const layerLevel = this.getLayerLevel();
|
418
363
|
|
419
364
|
// If the next layer level is lower than previous then clear all area and header highlights. This is the
|
@@ -484,8 +429,8 @@ class Selection {
|
|
484
429
|
columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
485
430
|
}
|
486
431
|
}
|
487
|
-
const highlightRowHeaders = !_classPrivateFieldGet(
|
488
|
-
const highlightColumnHeaders = !_classPrivateFieldGet(
|
432
|
+
const highlightRowHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && this.isSelectedByRowHeader());
|
433
|
+
const highlightColumnHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && this.isSelectedByColumnHeader());
|
489
434
|
if (highlightRowHeaders) {
|
490
435
|
activeRowHeaderHighlight.add(this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(Math.max(cellRange.to.row, 0), -1)).commit();
|
491
436
|
}
|
@@ -496,36 +441,20 @@ class Selection {
|
|
496
441
|
activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
|
497
442
|
}
|
498
443
|
}
|
499
|
-
const isLastLayer = _classPrivateFieldGet(
|
444
|
+
const isLastLayer = _classPrivateFieldGet(this, _expectedLayersCount) === -1 || this.selectedRange.size() === _classPrivateFieldGet(this, _expectedLayersCount);
|
500
445
|
this.runLocalHooks('afterSetRangeEnd', coords, isLastLayer);
|
501
446
|
}
|
502
447
|
|
503
448
|
/**
|
504
|
-
*
|
449
|
+
* Returns information if we have a multiselection. This method check multiselection only on the latest layer of
|
450
|
+
* the selection.
|
505
451
|
*
|
506
|
-
* @
|
452
|
+
* @returns {boolean}
|
507
453
|
*/
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
const cellRange = this.selectedRange.current();
|
513
|
-
if (!this.inProgress) {
|
514
|
-
this.runLocalHooks('beforeSetFocus', coords);
|
515
|
-
}
|
516
|
-
const focusHighlight = this.highlight.getFocus();
|
517
|
-
focusHighlight.clear();
|
518
|
-
cellRange.setHighlight(coords);
|
519
|
-
if (!this.inProgress) {
|
520
|
-
this.runLocalHooks('beforeHighlightSet');
|
521
|
-
}
|
522
|
-
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
523
|
-
focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
|
524
|
-
}
|
525
|
-
if (!this.inProgress) {
|
526
|
-
_classPrivateFieldSet(_isFocusSelectionChanged, this, true);
|
527
|
-
this.runLocalHooks('afterSetFocus', cellRange.highlight);
|
528
|
-
}
|
454
|
+
isMultiple() {
|
455
|
+
const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
|
456
|
+
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
457
|
+
return isMultipleListener.value;
|
529
458
|
}
|
530
459
|
|
531
460
|
/**
|
@@ -538,13 +467,7 @@ class Selection {
|
|
538
467
|
*/
|
539
468
|
transformStart(rowDelta, colDelta) {
|
540
469
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
541
|
-
|
542
|
-
_classPrivateFieldGet(_transformation, this).setOffsetSize({
|
543
|
-
x: this.tableProps.countRowHeaders(),
|
544
|
-
y: this.tableProps.countColHeaders()
|
545
|
-
});
|
546
|
-
}
|
547
|
-
this.setRangeStart(_classPrivateFieldGet(_transformation, this).transformStart(rowDelta, colDelta, createMissingRecords));
|
470
|
+
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
|
548
471
|
}
|
549
472
|
|
550
473
|
/**
|
@@ -554,44 +477,7 @@ class Selection {
|
|
554
477
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
555
478
|
*/
|
556
479
|
transformEnd(rowDelta, colDelta) {
|
557
|
-
|
558
|
-
_classPrivateFieldGet(_transformation, this).setOffsetSize({
|
559
|
-
x: this.tableProps.countRowHeaders(),
|
560
|
-
y: this.tableProps.countColHeaders()
|
561
|
-
});
|
562
|
-
}
|
563
|
-
this.setRangeEnd(_classPrivateFieldGet(_transformation, this).transformEnd(rowDelta, colDelta));
|
564
|
-
}
|
565
|
-
|
566
|
-
/**
|
567
|
-
* Transforms the focus cell selection relative to the current focus position.
|
568
|
-
*
|
569
|
-
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
570
|
-
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
571
|
-
*/
|
572
|
-
transformFocus(rowDelta, colDelta) {
|
573
|
-
const range = this.selectedRange.current();
|
574
|
-
const {
|
575
|
-
row,
|
576
|
-
col
|
577
|
-
} = range.getOuterTopStartCorner();
|
578
|
-
const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
|
579
|
-
const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
|
580
|
-
if (range.highlight.isHeader()) {
|
581
|
-
// for header focus selection calculate the new coords based on the selection including headers
|
582
|
-
_classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
|
583
|
-
x: col < 0 ? Math.abs(col) : -columnsInRange,
|
584
|
-
y: row < 0 ? Math.abs(row) : -rowsInRange
|
585
|
-
});
|
586
|
-
} else {
|
587
|
-
// for focus selection in cells calculate the new coords only based on the selected cells
|
588
|
-
_classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
|
589
|
-
x: col < 0 ? 0 : -columnsInRange,
|
590
|
-
y: row < 0 ? 0 : -rowsInRange
|
591
|
-
});
|
592
|
-
}
|
593
|
-
const focusCoords = _classPrivateFieldGet(_focusTransformation, this).transformStart(rowDelta, colDelta);
|
594
|
-
this.setRangeFocus(focusCoords.normalize());
|
480
|
+
this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
|
595
481
|
}
|
596
482
|
|
597
483
|
/**
|
@@ -612,30 +498,6 @@ class Selection {
|
|
612
498
|
return !this.selectedRange.isEmpty();
|
613
499
|
}
|
614
500
|
|
615
|
-
/**
|
616
|
-
* Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
|
617
|
-
* the selection.
|
618
|
-
*
|
619
|
-
* @returns {boolean}
|
620
|
-
*/
|
621
|
-
isMultiple() {
|
622
|
-
if (!this.isSelected()) {
|
623
|
-
return false;
|
624
|
-
}
|
625
|
-
const isMultipleListener = createObjectPropListener(!this.selectedRange.current().isSingle());
|
626
|
-
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
627
|
-
return isMultipleListener.value;
|
628
|
-
}
|
629
|
-
|
630
|
-
/**
|
631
|
-
* Checks if the last selection involves changing the focus cell position only.
|
632
|
-
*
|
633
|
-
* @returns {boolean}
|
634
|
-
*/
|
635
|
-
isFocusSelectionChanged() {
|
636
|
-
return this.isSelected() && _classPrivateFieldGet(_isFocusSelectionChanged, this);
|
637
|
-
}
|
638
|
-
|
639
501
|
/**
|
640
502
|
* Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
|
641
503
|
* argument is passed then only that layer will be checked. Otherwise, it checks if any row header
|
@@ -834,7 +696,7 @@ class Selection {
|
|
834
696
|
focusPosition,
|
835
697
|
disableHeadersHighlight
|
836
698
|
} = options;
|
837
|
-
_classPrivateFieldSet(
|
699
|
+
_classPrivateFieldSet(this, _disableHeadersHighlight, disableHeadersHighlight);
|
838
700
|
if (focusPosition && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
839
701
|
highlight = this.tableProps.createCellCoords(clamp(focusPosition.row, rowFrom, nrOfRows - 1), clamp(focusPosition.col, columnFrom, nrOfColumns - 1));
|
840
702
|
}
|
@@ -850,7 +712,7 @@ class Selection {
|
|
850
712
|
}
|
851
713
|
this.setRangeEnd(endCoords);
|
852
714
|
this.finish();
|
853
|
-
_classPrivateFieldSet(
|
715
|
+
_classPrivateFieldSet(this, _disableHeadersHighlight, false);
|
854
716
|
}
|
855
717
|
|
856
718
|
/**
|
@@ -918,10 +780,9 @@ class Selection {
|
|
918
780
|
*
|
919
781
|
* @param {number|string} startColumn Visual column index or column property from which the selection starts.
|
920
782
|
* @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
|
921
|
-
* @param {number
|
922
|
-
*
|
923
|
-
*
|
924
|
-
* position horizontally.
|
783
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
784
|
+
* The value can take visual row index from -N to N, where negative values
|
785
|
+
* point to the headers and positive values point to the cell range.
|
925
786
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
926
787
|
*/
|
927
788
|
selectColumns(startColumn) {
|
@@ -942,20 +803,11 @@ class Selection {
|
|
942
803
|
countColHeaders
|
943
804
|
});
|
944
805
|
if (isValid) {
|
945
|
-
|
946
|
-
let highlightColumn = 0;
|
947
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
948
|
-
highlightRow = clamp(focusPosition.row, columnHeaderLastIndex, countRows - 1);
|
949
|
-
highlightColumn = clamp(focusPosition.col, Math.min(start, end), Math.max(start, end));
|
950
|
-
} else {
|
951
|
-
highlightRow = clamp(focusPosition, columnHeaderLastIndex, countRows - 1);
|
952
|
-
highlightColumn = start;
|
953
|
-
}
|
954
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
955
|
-
const fromRow = countColHeaders === 0 ? 0 : clamp(highlight.row, columnHeaderLastIndex, -1);
|
806
|
+
const fromRow = countColHeaders === 0 ? 0 : clamp(focusPosition, columnHeaderLastIndex, -1);
|
956
807
|
const toRow = countRows - 1;
|
957
808
|
const from = this.tableProps.createCellCoords(fromRow, start);
|
958
809
|
const to = this.tableProps.createCellCoords(toRow, end);
|
810
|
+
const highlight = this.tableProps.createCellCoords(clamp(focusPosition, columnHeaderLastIndex, countRows - 1), start);
|
959
811
|
this.runLocalHooks('beforeSelectColumns', from, to, highlight);
|
960
812
|
|
961
813
|
// disallow modifying row axis for that hooks
|
@@ -975,10 +827,9 @@ class Selection {
|
|
975
827
|
*
|
976
828
|
* @param {number} startRow Visual row index from which the selection starts.
|
977
829
|
* @param {number} [endRow] Visual row index from to the selection finishes.
|
978
|
-
* @param {number
|
979
|
-
*
|
980
|
-
*
|
981
|
-
* position horizontally.
|
830
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
831
|
+
* The value can take visual column index from -N to N, where negative values
|
832
|
+
* point to the headers and positive values point to the cell range.
|
982
833
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
983
834
|
*/
|
984
835
|
selectRows(startRow) {
|
@@ -997,20 +848,11 @@ class Selection {
|
|
997
848
|
countColHeaders: 0
|
998
849
|
});
|
999
850
|
if (isValid) {
|
1000
|
-
|
1001
|
-
let highlightColumn = 0;
|
1002
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
1003
|
-
highlightRow = clamp(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
|
1004
|
-
highlightColumn = clamp(focusPosition.col, rowHeaderLastIndex, countCols - 1);
|
1005
|
-
} else {
|
1006
|
-
highlightRow = startRow;
|
1007
|
-
highlightColumn = clamp(focusPosition, rowHeaderLastIndex, countCols - 1);
|
1008
|
-
}
|
1009
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
1010
|
-
const fromColumn = countRowHeaders === 0 ? 0 : clamp(highlight.col, rowHeaderLastIndex, -1);
|
851
|
+
const fromColumn = countRowHeaders === 0 ? 0 : clamp(focusPosition, rowHeaderLastIndex, -1);
|
1011
852
|
const toColumn = countCols - 1;
|
1012
853
|
const from = this.tableProps.createCellCoords(startRow, fromColumn);
|
1013
854
|
const to = this.tableProps.createCellCoords(endRow, toColumn);
|
855
|
+
const highlight = this.tableProps.createCellCoords(startRow, clamp(focusPosition, rowHeaderLastIndex, countCols - 1));
|
1014
856
|
this.runLocalHooks('beforeSelectRows', from, to, highlight);
|
1015
857
|
|
1016
858
|
// disallow modifying column axis for that hooks
|