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.js
CHANGED
@@ -9,7 +9,7 @@ var _mixed = require("./../helpers/mixed");
|
|
9
9
|
var _number = require("./../helpers/number");
|
10
10
|
var _array = require("./../helpers/array");
|
11
11
|
var _localHooks = _interopRequireDefault(require("./../mixins/localHooks"));
|
12
|
-
var
|
12
|
+
var _transformation = _interopRequireDefault(require("./transformation"));
|
13
13
|
var _utils = require("./utils");
|
14
14
|
var _templateLiteralTag = require("./../helpers/templateLiteralTag");
|
15
15
|
var _a11y = require("../helpers/a11y");
|
@@ -21,16 +21,15 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
21
21
|
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; }
|
22
22
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
23
23
|
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); }
|
24
|
-
function _classPrivateFieldGet(
|
25
|
-
function
|
26
|
-
function
|
24
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
25
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
26
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
27
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
28
|
+
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; } }
|
27
29
|
/**
|
28
30
|
* @class Selection
|
29
31
|
* @util
|
30
32
|
*/
|
31
|
-
var _transformation = /*#__PURE__*/new WeakMap();
|
32
|
-
var _focusTransformation = /*#__PURE__*/new WeakMap();
|
33
|
-
var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
|
34
33
|
var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
|
35
34
|
var _selectionSource = /*#__PURE__*/new WeakMap();
|
36
35
|
var _expectedLayersCount = /*#__PURE__*/new WeakMap();
|
@@ -70,17 +69,11 @@ class Selection {
|
|
70
69
|
*/
|
71
70
|
_defineProperty(this, "highlight", void 0);
|
72
71
|
/**
|
73
|
-
* The module for modifying coordinates
|
72
|
+
* The module for modifying coordinates.
|
74
73
|
*
|
75
74
|
* @type {Transformation}
|
76
75
|
*/
|
77
|
-
|
78
|
-
/**
|
79
|
-
* The module for modifying coordinates of the focus selection.
|
80
|
-
*
|
81
|
-
* @type {Transformation}
|
82
|
-
*/
|
83
|
-
_classPrivateFieldInitSpec(this, _focusTransformation, void 0);
|
76
|
+
_defineProperty(this, "transformation", void 0);
|
84
77
|
/**
|
85
78
|
* The collection of the selection layer levels where the whole row was selected using the row header or
|
86
79
|
* the corner header.
|
@@ -95,31 +88,34 @@ class Selection {
|
|
95
88
|
* @type {Set<number>}
|
96
89
|
*/
|
97
90
|
_defineProperty(this, "selectedByColumnHeader", new Set());
|
98
|
-
/**
|
99
|
-
* The flag which determines if the focus selection was changed.
|
100
|
-
*
|
101
|
-
* @type {boolean}
|
102
|
-
*/
|
103
|
-
_classPrivateFieldInitSpec(this, _isFocusSelectionChanged, false);
|
104
91
|
/**
|
105
92
|
* When sets disable highlighting the headers even when the logical coordinates points on them.
|
106
93
|
*
|
107
94
|
* @type {boolean}
|
108
95
|
*/
|
109
|
-
_classPrivateFieldInitSpec(this, _disableHeadersHighlight,
|
96
|
+
_classPrivateFieldInitSpec(this, _disableHeadersHighlight, {
|
97
|
+
writable: true,
|
98
|
+
value: false
|
99
|
+
});
|
110
100
|
/**
|
111
101
|
* The source of the selection. It can be one of the following values: `mouse`, `unknown` or any other string.
|
112
102
|
*
|
113
103
|
* @type {'mouse' | 'unknown' | string}
|
114
104
|
*/
|
115
|
-
_classPrivateFieldInitSpec(this, _selectionSource,
|
105
|
+
_classPrivateFieldInitSpec(this, _selectionSource, {
|
106
|
+
writable: true,
|
107
|
+
value: 'unknown'
|
108
|
+
});
|
116
109
|
/**
|
117
110
|
* The number of expected layers. It is used mostly to track when the last selection layer of non-contiguous
|
118
111
|
* selection is applied, thus the viewport scroll is triggered.
|
119
112
|
*
|
120
113
|
* @param {number}
|
121
114
|
*/
|
122
|
-
_classPrivateFieldInitSpec(this, _expectedLayersCount,
|
115
|
+
_classPrivateFieldInitSpec(this, _expectedLayersCount, {
|
116
|
+
writable: true,
|
117
|
+
value: -1
|
118
|
+
});
|
123
119
|
this.settings = settings;
|
124
120
|
this.tableProps = tableProps;
|
125
121
|
this.highlight = new _highlight.default({
|
@@ -142,112 +138,71 @@ class Selection {
|
|
142
138
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
143
139
|
createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
|
144
140
|
});
|
145
|
-
|
141
|
+
this.transformation = new _transformation.default(this.selectedRange, {
|
146
142
|
rowIndexMapper: this.tableProps.rowIndexMapper,
|
147
143
|
columnIndexMapper: this.tableProps.columnIndexMapper,
|
148
144
|
countRenderableRows: () => this.tableProps.countRenderableRows(),
|
149
145
|
countRenderableColumns: () => this.tableProps.countRenderableColumns(),
|
146
|
+
countRowHeaders: () => this.tableProps.countRowHeaders(),
|
147
|
+
countColHeaders: () => this.tableProps.countColHeaders(),
|
150
148
|
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
151
149
|
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
152
|
-
findFirstNonHiddenRenderableRow: function () {
|
153
|
-
return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
|
154
|
-
},
|
155
|
-
findFirstNonHiddenRenderableColumn: function () {
|
156
|
-
return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
|
157
|
-
},
|
158
150
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
151
|
+
navigableHeaders: () => settings.navigableHeaders,
|
159
152
|
fixedRowsBottom: () => settings.fixedRowsBottom,
|
160
153
|
minSpareRows: () => settings.minSpareRows,
|
161
154
|
minSpareCols: () => settings.minSpareCols,
|
162
155
|
autoWrapRow: () => settings.autoWrapRow,
|
163
156
|
autoWrapCol: () => settings.autoWrapCol
|
164
|
-
})
|
165
|
-
|
166
|
-
rowIndexMapper: this.tableProps.rowIndexMapper,
|
167
|
-
columnIndexMapper: this.tableProps.columnIndexMapper,
|
168
|
-
countRenderableRows: () => {
|
169
|
-
const range = this.selectedRange.current();
|
170
|
-
return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
|
171
|
-
},
|
172
|
-
countRenderableColumns: () => {
|
173
|
-
const range = this.selectedRange.current();
|
174
|
-
return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
|
175
|
-
},
|
176
|
-
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
177
|
-
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
178
|
-
findFirstNonHiddenRenderableRow: function () {
|
179
|
-
return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
|
180
|
-
},
|
181
|
-
findFirstNonHiddenRenderableColumn: function () {
|
182
|
-
return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
|
183
|
-
},
|
184
|
-
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
185
|
-
fixedRowsBottom: () => 0,
|
186
|
-
minSpareRows: () => 0,
|
187
|
-
minSpareCols: () => 0,
|
188
|
-
autoWrapRow: () => true,
|
189
|
-
autoWrapCol: () => true
|
190
|
-
}));
|
191
|
-
_classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformStart', function () {
|
157
|
+
});
|
158
|
+
this.transformation.addLocalHook('beforeTransformStart', function () {
|
192
159
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
193
160
|
args[_key] = arguments[_key];
|
194
161
|
}
|
195
162
|
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
196
163
|
});
|
197
|
-
|
164
|
+
this.transformation.addLocalHook('afterTransformStart', function () {
|
198
165
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
199
166
|
args[_key2] = arguments[_key2];
|
200
167
|
}
|
201
168
|
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
202
169
|
});
|
203
|
-
|
170
|
+
this.transformation.addLocalHook('beforeTransformEnd', function () {
|
204
171
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
205
172
|
args[_key3] = arguments[_key3];
|
206
173
|
}
|
207
174
|
return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
|
208
175
|
});
|
209
|
-
|
176
|
+
this.transformation.addLocalHook('afterTransformEnd', function () {
|
210
177
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
211
178
|
args[_key4] = arguments[_key4];
|
212
179
|
}
|
213
180
|
return _this.runLocalHooks('afterModifyTransformEnd', ...args);
|
214
181
|
});
|
215
|
-
|
182
|
+
this.transformation.addLocalHook('insertRowRequire', function () {
|
216
183
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
217
184
|
args[_key5] = arguments[_key5];
|
218
185
|
}
|
219
186
|
return _this.runLocalHooks('insertRowRequire', ...args);
|
220
187
|
});
|
221
|
-
|
188
|
+
this.transformation.addLocalHook('insertColRequire', function () {
|
222
189
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
223
190
|
args[_key6] = arguments[_key6];
|
224
191
|
}
|
225
192
|
return _this.runLocalHooks('insertColRequire', ...args);
|
226
193
|
});
|
227
|
-
|
194
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
228
195
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
229
196
|
args[_key7] = arguments[_key7];
|
230
197
|
}
|
231
198
|
return _this.runLocalHooks('beforeRowWrap', ...args);
|
232
199
|
});
|
233
|
-
|
200
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
234
201
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
235
202
|
args[_key8] = arguments[_key8];
|
236
203
|
}
|
237
204
|
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
238
205
|
});
|
239
|
-
_classPrivateFieldGet(_focusTransformation, this).addLocalHook('beforeTransformStart', function () {
|
240
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
241
|
-
args[_key9] = arguments[_key9];
|
242
|
-
}
|
243
|
-
return _this.runLocalHooks('beforeModifyTransformFocus', ...args);
|
244
|
-
});
|
245
|
-
_classPrivateFieldGet(_focusTransformation, this).addLocalHook('afterTransformStart', function () {
|
246
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
247
|
-
args[_key10] = arguments[_key10];
|
248
|
-
}
|
249
|
-
return _this.runLocalHooks('afterModifyTransformFocus', ...args);
|
250
|
-
});
|
251
206
|
}
|
252
207
|
|
253
208
|
/**
|
@@ -265,14 +220,14 @@ class Selection {
|
|
265
220
|
* @param {'mouse' | 'unknown' | string} sourceName The source name.
|
266
221
|
*/
|
267
222
|
markSource(sourceName) {
|
268
|
-
_classPrivateFieldSet(
|
223
|
+
_classPrivateFieldSet(this, _selectionSource, sourceName);
|
269
224
|
}
|
270
225
|
|
271
226
|
/**
|
272
227
|
* Marks end of the selection source. It restores the selection source to default value which is 'unknown'.
|
273
228
|
*/
|
274
229
|
markEndSource() {
|
275
|
-
_classPrivateFieldSet(
|
230
|
+
_classPrivateFieldSet(this, _selectionSource, 'unknown');
|
276
231
|
}
|
277
232
|
|
278
233
|
/**
|
@@ -281,7 +236,7 @@ class Selection {
|
|
281
236
|
* @returns {'mouse' | 'unknown' | string}
|
282
237
|
*/
|
283
238
|
getSelectionSource() {
|
284
|
-
return _classPrivateFieldGet(
|
239
|
+
return _classPrivateFieldGet(this, _selectionSource);
|
285
240
|
}
|
286
241
|
|
287
242
|
/**
|
@@ -291,7 +246,7 @@ class Selection {
|
|
291
246
|
* @param {number} layersCount The number of expected layers.
|
292
247
|
*/
|
293
248
|
setExpectedLayers(layersCount) {
|
294
|
-
_classPrivateFieldSet(
|
249
|
+
_classPrivateFieldSet(this, _expectedLayersCount, layersCount);
|
295
250
|
}
|
296
251
|
|
297
252
|
/**
|
@@ -307,7 +262,7 @@ class Selection {
|
|
307
262
|
finish() {
|
308
263
|
this.runLocalHooks('afterSelectionFinished', Array.from(this.selectedRange));
|
309
264
|
this.inProgress = false;
|
310
|
-
_classPrivateFieldSet(
|
265
|
+
_classPrivateFieldSet(this, _expectedLayersCount, -1);
|
311
266
|
}
|
312
267
|
|
313
268
|
/**
|
@@ -338,7 +293,6 @@ class Selection {
|
|
338
293
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
339
294
|
// should be handled by next methods.
|
340
295
|
const coordsClone = coords.clone();
|
341
|
-
_classPrivateFieldSet(_isFocusSelectionChanged, this, false);
|
342
296
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
343
297
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
|
344
298
|
this.selectedRange.clear();
|
@@ -396,20 +350,7 @@ class Selection {
|
|
396
350
|
cellRange.setFrom(cellRange.highlight);
|
397
351
|
cellRange.setTo(cellRange.highlight);
|
398
352
|
} else {
|
399
|
-
const horizontalDir = cellRange.getHorizontalDirection();
|
400
|
-
const verticalDir = cellRange.getVerticalDirection();
|
401
|
-
const isMultiple = this.isMultiple();
|
402
353
|
cellRange.setTo(coordsClone);
|
403
|
-
if (isMultiple && (horizontalDir !== cellRange.getHorizontalDirection() || cellRange.getWidth() === 1 && !cellRange.includes(cellRange.highlight))) {
|
404
|
-
cellRange.from.assign({
|
405
|
-
col: cellRange.highlight.col
|
406
|
-
});
|
407
|
-
}
|
408
|
-
if (isMultiple && (verticalDir !== cellRange.getVerticalDirection() || cellRange.getHeight() === 1 && !cellRange.includes(cellRange.highlight))) {
|
409
|
-
cellRange.from.assign({
|
410
|
-
row: cellRange.highlight.row
|
411
|
-
});
|
412
|
-
}
|
413
354
|
}
|
414
355
|
|
415
356
|
// Prevent creating "area" selection that overlaps headers.
|
@@ -419,7 +360,11 @@ class Selection {
|
|
419
360
|
}
|
420
361
|
}
|
421
362
|
this.runLocalHooks('beforeHighlightSet');
|
422
|
-
this.
|
363
|
+
const focusHighlight = this.highlight.getFocus();
|
364
|
+
focusHighlight.clear();
|
365
|
+
if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
|
366
|
+
focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
367
|
+
}
|
423
368
|
const layerLevel = this.getLayerLevel();
|
424
369
|
|
425
370
|
// If the next layer level is lower than previous then clear all area and header highlights. This is the
|
@@ -490,8 +435,8 @@ class Selection {
|
|
490
435
|
columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
491
436
|
}
|
492
437
|
}
|
493
|
-
const highlightRowHeaders = !_classPrivateFieldGet(
|
494
|
-
const highlightColumnHeaders = !_classPrivateFieldGet(
|
438
|
+
const highlightRowHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && this.isSelectedByRowHeader());
|
439
|
+
const highlightColumnHeaders = !_classPrivateFieldGet(this, _disableHeadersHighlight) && this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && this.isSelectedByColumnHeader());
|
495
440
|
if (highlightRowHeaders) {
|
496
441
|
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();
|
497
442
|
}
|
@@ -502,36 +447,20 @@ class Selection {
|
|
502
447
|
activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
|
503
448
|
}
|
504
449
|
}
|
505
|
-
const isLastLayer = _classPrivateFieldGet(
|
450
|
+
const isLastLayer = _classPrivateFieldGet(this, _expectedLayersCount) === -1 || this.selectedRange.size() === _classPrivateFieldGet(this, _expectedLayersCount);
|
506
451
|
this.runLocalHooks('afterSetRangeEnd', coords, isLastLayer);
|
507
452
|
}
|
508
453
|
|
509
454
|
/**
|
510
|
-
*
|
455
|
+
* Returns information if we have a multiselection. This method check multiselection only on the latest layer of
|
456
|
+
* the selection.
|
511
457
|
*
|
512
|
-
* @
|
458
|
+
* @returns {boolean}
|
513
459
|
*/
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
const cellRange = this.selectedRange.current();
|
519
|
-
if (!this.inProgress) {
|
520
|
-
this.runLocalHooks('beforeSetFocus', coords);
|
521
|
-
}
|
522
|
-
const focusHighlight = this.highlight.getFocus();
|
523
|
-
focusHighlight.clear();
|
524
|
-
cellRange.setHighlight(coords);
|
525
|
-
if (!this.inProgress) {
|
526
|
-
this.runLocalHooks('beforeHighlightSet');
|
527
|
-
}
|
528
|
-
if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
|
529
|
-
focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
|
530
|
-
}
|
531
|
-
if (!this.inProgress) {
|
532
|
-
_classPrivateFieldSet(_isFocusSelectionChanged, this, true);
|
533
|
-
this.runLocalHooks('afterSetFocus', cellRange.highlight);
|
534
|
-
}
|
460
|
+
isMultiple() {
|
461
|
+
const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
|
462
|
+
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
463
|
+
return isMultipleListener.value;
|
535
464
|
}
|
536
465
|
|
537
466
|
/**
|
@@ -544,13 +473,7 @@ class Selection {
|
|
544
473
|
*/
|
545
474
|
transformStart(rowDelta, colDelta) {
|
546
475
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
547
|
-
|
548
|
-
_classPrivateFieldGet(_transformation, this).setOffsetSize({
|
549
|
-
x: this.tableProps.countRowHeaders(),
|
550
|
-
y: this.tableProps.countColHeaders()
|
551
|
-
});
|
552
|
-
}
|
553
|
-
this.setRangeStart(_classPrivateFieldGet(_transformation, this).transformStart(rowDelta, colDelta, createMissingRecords));
|
476
|
+
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
|
554
477
|
}
|
555
478
|
|
556
479
|
/**
|
@@ -560,44 +483,7 @@ class Selection {
|
|
560
483
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
561
484
|
*/
|
562
485
|
transformEnd(rowDelta, colDelta) {
|
563
|
-
|
564
|
-
_classPrivateFieldGet(_transformation, this).setOffsetSize({
|
565
|
-
x: this.tableProps.countRowHeaders(),
|
566
|
-
y: this.tableProps.countColHeaders()
|
567
|
-
});
|
568
|
-
}
|
569
|
-
this.setRangeEnd(_classPrivateFieldGet(_transformation, this).transformEnd(rowDelta, colDelta));
|
570
|
-
}
|
571
|
-
|
572
|
-
/**
|
573
|
-
* Transforms the focus cell selection relative to the current focus position.
|
574
|
-
*
|
575
|
-
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
576
|
-
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
577
|
-
*/
|
578
|
-
transformFocus(rowDelta, colDelta) {
|
579
|
-
const range = this.selectedRange.current();
|
580
|
-
const {
|
581
|
-
row,
|
582
|
-
col
|
583
|
-
} = range.getOuterTopStartCorner();
|
584
|
-
const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
|
585
|
-
const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
|
586
|
-
if (range.highlight.isHeader()) {
|
587
|
-
// for header focus selection calculate the new coords based on the selection including headers
|
588
|
-
_classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
|
589
|
-
x: col < 0 ? Math.abs(col) : -columnsInRange,
|
590
|
-
y: row < 0 ? Math.abs(row) : -rowsInRange
|
591
|
-
});
|
592
|
-
} else {
|
593
|
-
// for focus selection in cells calculate the new coords only based on the selected cells
|
594
|
-
_classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
|
595
|
-
x: col < 0 ? 0 : -columnsInRange,
|
596
|
-
y: row < 0 ? 0 : -rowsInRange
|
597
|
-
});
|
598
|
-
}
|
599
|
-
const focusCoords = _classPrivateFieldGet(_focusTransformation, this).transformStart(rowDelta, colDelta);
|
600
|
-
this.setRangeFocus(focusCoords.normalize());
|
486
|
+
this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
|
601
487
|
}
|
602
488
|
|
603
489
|
/**
|
@@ -618,30 +504,6 @@ class Selection {
|
|
618
504
|
return !this.selectedRange.isEmpty();
|
619
505
|
}
|
620
506
|
|
621
|
-
/**
|
622
|
-
* Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
|
623
|
-
* the selection.
|
624
|
-
*
|
625
|
-
* @returns {boolean}
|
626
|
-
*/
|
627
|
-
isMultiple() {
|
628
|
-
if (!this.isSelected()) {
|
629
|
-
return false;
|
630
|
-
}
|
631
|
-
const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
|
632
|
-
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
633
|
-
return isMultipleListener.value;
|
634
|
-
}
|
635
|
-
|
636
|
-
/**
|
637
|
-
* Checks if the last selection involves changing the focus cell position only.
|
638
|
-
*
|
639
|
-
* @returns {boolean}
|
640
|
-
*/
|
641
|
-
isFocusSelectionChanged() {
|
642
|
-
return this.isSelected() && _classPrivateFieldGet(_isFocusSelectionChanged, this);
|
643
|
-
}
|
644
|
-
|
645
507
|
/**
|
646
508
|
* Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
|
647
509
|
* argument is passed then only that layer will be checked. Otherwise, it checks if any row header
|
@@ -840,7 +702,7 @@ class Selection {
|
|
840
702
|
focusPosition,
|
841
703
|
disableHeadersHighlight
|
842
704
|
} = options;
|
843
|
-
_classPrivateFieldSet(
|
705
|
+
_classPrivateFieldSet(this, _disableHeadersHighlight, disableHeadersHighlight);
|
844
706
|
if (focusPosition && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
845
707
|
highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition.row, rowFrom, nrOfRows - 1), (0, _number.clamp)(focusPosition.col, columnFrom, nrOfColumns - 1));
|
846
708
|
}
|
@@ -856,7 +718,7 @@ class Selection {
|
|
856
718
|
}
|
857
719
|
this.setRangeEnd(endCoords);
|
858
720
|
this.finish();
|
859
|
-
_classPrivateFieldSet(
|
721
|
+
_classPrivateFieldSet(this, _disableHeadersHighlight, false);
|
860
722
|
}
|
861
723
|
|
862
724
|
/**
|
@@ -924,10 +786,9 @@ class Selection {
|
|
924
786
|
*
|
925
787
|
* @param {number|string} startColumn Visual column index or column property from which the selection starts.
|
926
788
|
* @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
|
927
|
-
* @param {number
|
928
|
-
*
|
929
|
-
*
|
930
|
-
* position horizontally.
|
789
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
790
|
+
* The value can take visual row index from -N to N, where negative values
|
791
|
+
* point to the headers and positive values point to the cell range.
|
931
792
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
932
793
|
*/
|
933
794
|
selectColumns(startColumn) {
|
@@ -948,20 +809,11 @@ class Selection {
|
|
948
809
|
countColHeaders
|
949
810
|
});
|
950
811
|
if (isValid) {
|
951
|
-
|
952
|
-
let highlightColumn = 0;
|
953
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
954
|
-
highlightRow = (0, _number.clamp)(focusPosition.row, columnHeaderLastIndex, countRows - 1);
|
955
|
-
highlightColumn = (0, _number.clamp)(focusPosition.col, Math.min(start, end), Math.max(start, end));
|
956
|
-
} else {
|
957
|
-
highlightRow = (0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1);
|
958
|
-
highlightColumn = start;
|
959
|
-
}
|
960
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
961
|
-
const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(highlight.row, columnHeaderLastIndex, -1);
|
812
|
+
const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, columnHeaderLastIndex, -1);
|
962
813
|
const toRow = countRows - 1;
|
963
814
|
const from = this.tableProps.createCellCoords(fromRow, start);
|
964
815
|
const to = this.tableProps.createCellCoords(toRow, end);
|
816
|
+
const highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1), start);
|
965
817
|
this.runLocalHooks('beforeSelectColumns', from, to, highlight);
|
966
818
|
|
967
819
|
// disallow modifying row axis for that hooks
|
@@ -981,10 +833,9 @@ class Selection {
|
|
981
833
|
*
|
982
834
|
* @param {number} startRow Visual row index from which the selection starts.
|
983
835
|
* @param {number} [endRow] Visual row index from to the selection finishes.
|
984
|
-
* @param {number
|
985
|
-
*
|
986
|
-
*
|
987
|
-
* position horizontally.
|
836
|
+
* @param {number} [focusPosition=0] The argument allows changing the cell/header focus position.
|
837
|
+
* The value can take visual column index from -N to N, where negative values
|
838
|
+
* point to the headers and positive values point to the cell range.
|
988
839
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
989
840
|
*/
|
990
841
|
selectRows(startRow) {
|
@@ -1003,20 +854,11 @@ class Selection {
|
|
1003
854
|
countColHeaders: 0
|
1004
855
|
});
|
1005
856
|
if (isValid) {
|
1006
|
-
|
1007
|
-
let highlightColumn = 0;
|
1008
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
1009
|
-
highlightRow = (0, _number.clamp)(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
|
1010
|
-
highlightColumn = (0, _number.clamp)(focusPosition.col, rowHeaderLastIndex, countCols - 1);
|
1011
|
-
} else {
|
1012
|
-
highlightRow = startRow;
|
1013
|
-
highlightColumn = (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1);
|
1014
|
-
}
|
1015
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
1016
|
-
const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(highlight.col, rowHeaderLastIndex, -1);
|
857
|
+
const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, rowHeaderLastIndex, -1);
|
1017
858
|
const toColumn = countCols - 1;
|
1018
859
|
const from = this.tableProps.createCellCoords(startRow, fromColumn);
|
1019
860
|
const to = this.tableProps.createCellCoords(endRow, toColumn);
|
861
|
+
const highlight = this.tableProps.createCellCoords(startRow, (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1));
|
1020
862
|
this.runLocalHooks('beforeSelectRows', from, to, highlight);
|
1021
863
|
|
1022
864
|
// disallow modifying column axis for that hooks
|