handsontable 0.0.0-next-f748da8-20240318 → 0.0.0-next-76fc9bd-20240319

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.

Files changed (96) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +1 -2
  2. package/3rdparty/walkontable/src/cell/range.js +5 -22
  3. package/3rdparty/walkontable/src/cell/range.mjs +5 -22
  4. package/base.js +2 -2
  5. package/base.mjs +2 -2
  6. package/core/viewportScroll/index.js +1 -4
  7. package/core/viewportScroll/index.mjs +1 -4
  8. package/core.d.ts +3 -4
  9. package/core.js +21 -76
  10. package/core.mjs +21 -76
  11. package/dist/handsontable.css +2 -2
  12. package/dist/handsontable.full.css +2 -2
  13. package/dist/handsontable.full.js +1359 -2612
  14. package/dist/handsontable.full.min.css +2 -2
  15. package/dist/handsontable.full.min.js +64 -64
  16. package/dist/handsontable.js +1363 -2616
  17. package/dist/handsontable.min.css +2 -2
  18. package/dist/handsontable.min.js +19 -19
  19. package/editorManager.js +8 -12
  20. package/editorManager.mjs +8 -12
  21. package/helpers/mixed.js +1 -1
  22. package/helpers/mixed.mjs +1 -1
  23. package/package.json +1 -1
  24. package/pluginHooks.d.ts +0 -4
  25. package/pluginHooks.js +1 -69
  26. package/pluginHooks.mjs +1 -69
  27. package/plugins/collapsibleColumns/collapsibleColumns.js +3 -9
  28. package/plugins/collapsibleColumns/collapsibleColumns.mjs +3 -9
  29. package/plugins/columnSorting/columnSorting.js +2 -8
  30. package/plugins/columnSorting/columnSorting.mjs +2 -8
  31. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  32. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  33. package/plugins/mergeCells/calculations/selection.js +70 -1
  34. package/plugins/mergeCells/calculations/selection.mjs +70 -1
  35. package/plugins/mergeCells/cellsCollection.js +0 -116
  36. package/plugins/mergeCells/cellsCollection.mjs +0 -116
  37. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
  38. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
  39. package/plugins/mergeCells/mergeCells.js +192 -336
  40. package/plugins/mergeCells/mergeCells.mjs +192 -336
  41. package/plugins/multiColumnSorting/multiColumnSorting.js +2 -8
  42. package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -8
  43. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  44. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  45. package/plugins/nestedRows/nestedRows.js +3 -9
  46. package/plugins/nestedRows/nestedRows.mjs +3 -9
  47. package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
  48. package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
  49. package/selection/highlight/visualSelection.js +0 -2
  50. package/selection/highlight/visualSelection.mjs +0 -2
  51. package/selection/selection.js +40 -209
  52. package/selection/selection.mjs +39 -208
  53. package/selection/transformation.js +32 -83
  54. package/selection/transformation.mjs +32 -83
  55. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  56. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  57. package/shortcutContexts/commands/editor/open.js +3 -18
  58. package/shortcutContexts/commands/editor/open.mjs +3 -18
  59. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  60. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  61. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  62. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  63. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  64. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  65. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  66. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  67. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
  68. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
  69. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
  70. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
  71. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
  72. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
  73. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
  74. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
  75. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
  76. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
  77. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
  78. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
  79. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  80. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  81. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  82. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  83. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  84. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  85. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  86. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  87. package/shortcutContexts/grid.js +9 -3
  88. package/shortcutContexts/grid.mjs +9 -3
  89. package/shortcuts/context.js +1 -2
  90. package/shortcuts/context.mjs +1 -2
  91. package/utils/dataStructures/linkedList.js +1 -6
  92. package/utils/dataStructures/linkedList.mjs +1 -6
  93. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  94. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
  95. package/plugins/mergeCells/focusOrder.js +0 -303
  96. package/plugins/mergeCells/focusOrder.mjs +0 -298
@@ -37,7 +37,13 @@ function shortcutsGridContext(hot) {
37
37
  });
38
38
  context.addShortcuts([{
39
39
  keys: [['Control/Meta', 'A']],
40
- callback: () => commandsPool.selectAllCells()
40
+ callback: () => commandsPool.selectAllCells(),
41
+ runOnlyIf: () => !hot.getSelectedRangeLast().highlight.isHeader()
42
+ }, {
43
+ keys: [['Control/Meta', 'A']],
44
+ callback: () => {},
45
+ runOnlyIf: () => hot.getSelectedRangeLast().highlight.isHeader(),
46
+ preventDefault: true
41
47
  }, {
42
48
  keys: [['Control/Meta', 'Shift', 'Space']],
43
49
  callback: () => commandsPool.selectAllCellsAndHeaders()
@@ -157,12 +163,12 @@ function shortcutsGridContext(hot) {
157
163
  keys: [['Tab']],
158
164
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
159
165
  preventDefault: false,
160
- callback: event => commandsPool.moveCellSelectionInlineStart(event)
166
+ callback: () => commandsPool.moveCellSelectionInlineStart()
161
167
  }, {
162
168
  keys: [['Shift', 'Tab']],
163
169
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
164
170
  preventDefault: false,
165
- callback: event => commandsPool.moveCellSelectionInlineEnd(event)
171
+ callback: () => commandsPool.moveCellSelectionInlineEnd()
166
172
  }, {
167
173
  keys: [['Control/Meta', 'Backspace']],
168
174
  callback: () => commandsPool.scrollToFocusedCell()
@@ -33,7 +33,13 @@ export function shortcutsGridContext(hot) {
33
33
  });
34
34
  context.addShortcuts([{
35
35
  keys: [['Control/Meta', 'A']],
36
- callback: () => commandsPool.selectAllCells()
36
+ callback: () => commandsPool.selectAllCells(),
37
+ runOnlyIf: () => !hot.getSelectedRangeLast().highlight.isHeader()
38
+ }, {
39
+ keys: [['Control/Meta', 'A']],
40
+ callback: () => {},
41
+ runOnlyIf: () => hot.getSelectedRangeLast().highlight.isHeader(),
42
+ preventDefault: true
37
43
  }, {
38
44
  keys: [['Control/Meta', 'Shift', 'Space']],
39
45
  callback: () => commandsPool.selectAllCellsAndHeaders()
@@ -153,12 +159,12 @@ export function shortcutsGridContext(hot) {
153
159
  keys: [['Tab']],
154
160
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
155
161
  preventDefault: false,
156
- callback: event => commandsPool.moveCellSelectionInlineStart(event)
162
+ callback: () => commandsPool.moveCellSelectionInlineStart()
157
163
  }, {
158
164
  keys: [['Shift', 'Tab']],
159
165
  // The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
160
166
  preventDefault: false,
161
- callback: event => commandsPool.moveCellSelectionInlineEnd(event)
167
+ callback: () => commandsPool.moveCellSelectionInlineEnd()
162
168
  }, {
163
169
  keys: [['Control/Meta', 'Backspace']],
164
170
  callback: () => commandsPool.scrollToFocusedCell()
@@ -90,8 +90,7 @@ const createContext = name => {
90
90
  stopPropagation
91
91
  };
92
92
  if ((0, _mixed.isDefined)(relativeToGroup)) {
93
- newShortcut.relativeToGroup = relativeToGroup;
94
- newShortcut.position = position;
93
+ [newShortcut.relativeToGroup, newShortcut.position] = [relativeToGroup, position];
95
94
  }
96
95
  if (isContextObject(forwardToContext)) {
97
96
  newShortcut.forwardToContext = forwardToContext;
@@ -86,8 +86,7 @@ export const createContext = name => {
86
86
  stopPropagation
87
87
  };
88
88
  if (isDefined(relativeToGroup)) {
89
- newShortcut.relativeToGroup = relativeToGroup;
90
- newShortcut.position = position;
89
+ [newShortcut.relativeToGroup, newShortcut.position] = [relativeToGroup, position];
91
90
  }
92
91
  if (isContextObject(forwardToContext)) {
93
92
  newShortcut.forwardToContext = forwardToContext;
@@ -59,7 +59,6 @@ class LinkedList {
59
59
  * Add data to the end of linked list.
60
60
  *
61
61
  * @param {object} data Data which should be added.
62
- * @returns {NodeStructure} Returns the node which has been added.
63
62
  */
64
63
  push(data) {
65
64
  const node = new NodeStructure(data);
@@ -72,7 +71,6 @@ class LinkedList {
72
71
  node.prev = temp;
73
72
  temp.next = node;
74
73
  }
75
- return node;
76
74
  }
77
75
 
78
76
  /**
@@ -101,10 +99,7 @@ class LinkedList {
101
99
  inorder(callback) {
102
100
  let temp = this.first;
103
101
  while (temp) {
104
- const interrupt = callback(temp);
105
- if (temp === this.last || interrupt === true) {
106
- break;
107
- }
102
+ callback(temp);
108
103
  temp = temp.next;
109
104
  }
110
105
  }
@@ -55,7 +55,6 @@ class LinkedList {
55
55
  * Add data to the end of linked list.
56
56
  *
57
57
  * @param {object} data Data which should be added.
58
- * @returns {NodeStructure} Returns the node which has been added.
59
58
  */
60
59
  push(data) {
61
60
  const node = new NodeStructure(data);
@@ -68,7 +67,6 @@ class LinkedList {
68
67
  node.prev = temp;
69
68
  temp.next = node;
70
69
  }
71
- return node;
72
70
  }
73
71
 
74
72
  /**
@@ -97,10 +95,7 @@ class LinkedList {
97
95
  inorder(callback) {
98
96
  let temp = this.first;
99
97
  while (temp) {
100
- const interrupt = callback(temp);
101
- if (temp === this.last || interrupt === true) {
102
- break;
103
- }
98
+ callback(temp);
104
99
  temp = temp.next;
105
100
  }
106
101
  }
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.focusScrollStrategy = focusScrollStrategy;
5
- /**
6
- * Scroll strategy for changed the focus position of the selection.
7
- *
8
- * @param {Core} hot Handsontable instance.
9
- * @returns {function(): function(CellCoords): void}
10
- */
11
- function focusScrollStrategy(hot) {
12
- return cellCoords => {
13
- hot.scrollViewportTo(cellCoords.toObject());
14
- };
15
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Scroll strategy for changed the focus position of the selection.
3
- *
4
- * @param {Core} hot Handsontable instance.
5
- * @returns {function(): function(CellCoords): void}
6
- */
7
- export function focusScrollStrategy(hot) {
8
- return cellCoords => {
9
- hot.scrollViewportTo(cellCoords.toObject());
10
- };
11
- }
@@ -1,303 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- require("core-js/modules/es.error.cause.js");
5
- require("core-js/modules/es.array.push.js");
6
- var _linkedList = _interopRequireDefault(require("../../utils/dataStructures/linkedList"));
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
9
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
10
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
11
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
12
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
13
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
14
- /**
15
- * Class responsible for providing the correct focus order (vertical and horizontal) within a selection that
16
- * contains merged cells.
17
- */
18
- var _cellsHorizontalOrder = /*#__PURE__*/new WeakMap();
19
- var _cellsVerticalOrder = /*#__PURE__*/new WeakMap();
20
- var _currentHorizontalLinkedNode = /*#__PURE__*/new WeakMap();
21
- var _currentVerticalLinkedNode = /*#__PURE__*/new WeakMap();
22
- var _mergedCellsGetter = /*#__PURE__*/new WeakMap();
23
- var _rowIndexMapper = /*#__PURE__*/new WeakMap();
24
- var _columnIndexMapper = /*#__PURE__*/new WeakMap();
25
- var _FocusOrder_brand = /*#__PURE__*/new WeakSet();
26
- class FocusOrder {
27
- constructor(_ref) {
28
- let {
29
- mergedCellsGetter,
30
- rowIndexMapper,
31
- columnIndexMapper
32
- } = _ref;
33
- /**
34
- * Pushes a new node to the provided list order.
35
- *
36
- * @param {CellRange} selectedRange The selected range to build the focus order for.
37
- * @param {LinkedList} listOrder The list order to push the node to.
38
- * @param {WeakSet} mergeCellsVisitor The set of visited cells.
39
- * @param {number} row The visual row index.
40
- * @param {number} column The visual column index.
41
- * @returns {NodeStructure | null}
42
- */
43
- _classPrivateMethodInitSpec(this, _FocusOrder_brand);
44
- /**
45
- * The linked list of the all cells within the current selection in horizontal order. The list is
46
- * recreated every time the selection is changed.
47
- *
48
- * @type {LinkedList}
49
- */
50
- _classPrivateFieldInitSpec(this, _cellsHorizontalOrder, new _linkedList.default());
51
- /**
52
- * The linked list of the all cells within the current selection in horizontal order. The list is
53
- * recreated every time the selection is changed.
54
- *
55
- * @type {LinkedList}
56
- */
57
- _classPrivateFieldInitSpec(this, _cellsVerticalOrder, new _linkedList.default());
58
- /**
59
- * The currently highlighted cell within the horizontal linked list.
60
- *
61
- * @type {NodeStructure | null}
62
- */
63
- _classPrivateFieldInitSpec(this, _currentHorizontalLinkedNode, null);
64
- /**
65
- * The currently highlighted cell within the vertical linked list.
66
- *
67
- * @type {NodeStructure | null}
68
- */
69
- _classPrivateFieldInitSpec(this, _currentVerticalLinkedNode, null);
70
- /**
71
- * The merged cells getter function.
72
- *
73
- * @type {function(): {row: number, col: number, rowspan: number, colspan: number} | null}}
74
- */
75
- _classPrivateFieldInitSpec(this, _mergedCellsGetter, null);
76
- /**
77
- * The row index mapper.
78
- *
79
- * @type {IndexMapper}
80
- */
81
- _classPrivateFieldInitSpec(this, _rowIndexMapper, null);
82
- /**
83
- * The column index mapper.
84
- *
85
- * @type {IndexMapper}
86
- */
87
- _classPrivateFieldInitSpec(this, _columnIndexMapper, null);
88
- _classPrivateFieldSet(_mergedCellsGetter, this, mergedCellsGetter);
89
- _classPrivateFieldSet(_rowIndexMapper, this, rowIndexMapper);
90
- _classPrivateFieldSet(_columnIndexMapper, this, columnIndexMapper);
91
- }
92
-
93
- /**
94
- * Gets the currently selected node data from the vertical focus order list.
95
- *
96
- * @returns {NodeStructure}
97
- */
98
- getCurrentVerticalNode() {
99
- return _classPrivateFieldGet(_currentVerticalLinkedNode, this).data;
100
- }
101
-
102
- /**
103
- * Gets the first node data from the vertical focus order list.
104
- *
105
- * @returns {NodeStructure}
106
- */
107
- getFirstVerticalNode() {
108
- return _classPrivateFieldGet(_cellsVerticalOrder, this).first.data;
109
- }
110
-
111
- /**
112
- * Gets the next selected node data from the vertical focus order list.
113
- *
114
- * @returns {NodeStructure}
115
- */
116
- getNextVerticalNode() {
117
- return _classPrivateFieldGet(_currentVerticalLinkedNode, this).next.data;
118
- }
119
-
120
- /**
121
- * Gets the previous selected node data from the vertical focus order list.
122
- *
123
- * @returns {NodeStructure}
124
- */
125
- getPrevVerticalNode() {
126
- return _classPrivateFieldGet(_currentVerticalLinkedNode, this).prev.data;
127
- }
128
-
129
- /**
130
- * Gets the currently selected node data from the horizontal focus order list.
131
- *
132
- * @returns {NodeStructure}
133
- */
134
- getCurrentHorizontalNode() {
135
- return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).data;
136
- }
137
-
138
- /**
139
- * Gets the first node data from the horizontal focus order list.
140
- *
141
- * @returns {NodeStructure}
142
- */
143
- getFirstHorizontalNode() {
144
- return _classPrivateFieldGet(_cellsHorizontalOrder, this).first.data;
145
- }
146
-
147
- /**
148
- * Gets the next selected node data from the horizontal focus order list.
149
- *
150
- * @returns {NodeStructure}
151
- */
152
- getNextHorizontalNode() {
153
- return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).next.data;
154
- }
155
-
156
- /**
157
- * Gets the previous selected node data from the horizontal focus order list.
158
- *
159
- * @returns {NodeStructure}
160
- */
161
- getPrevHorizontalNode() {
162
- return _classPrivateFieldGet(_currentHorizontalLinkedNode, this).prev.data;
163
- }
164
-
165
- /**
166
- * Sets the previous node from the vertical focus order list as active.
167
- */
168
- setPrevNodeAsActive() {
169
- _classPrivateFieldSet(_currentVerticalLinkedNode, this, _classPrivateFieldGet(_currentVerticalLinkedNode, this).prev);
170
- _classPrivateFieldSet(_currentHorizontalLinkedNode, this, _classPrivateFieldGet(_currentHorizontalLinkedNode, this).prev);
171
- }
172
-
173
- /**
174
- * Sets the previous node from the horizontal focus order list as active.
175
- */
176
- setNextNodeAsActive() {
177
- _classPrivateFieldSet(_currentVerticalLinkedNode, this, _classPrivateFieldGet(_currentVerticalLinkedNode, this).next);
178
- _classPrivateFieldSet(_currentHorizontalLinkedNode, this, _classPrivateFieldGet(_currentHorizontalLinkedNode, this).next);
179
- }
180
-
181
- /**
182
- * Rebuilds the focus order list based on the provided selection.
183
- *
184
- * @param {CellRange} selectedRange The selected range to build the focus order for.
185
- */
186
- buildFocusOrder(selectedRange) {
187
- const topStart = selectedRange.getTopStartCorner();
188
- const bottomEnd = selectedRange.getBottomEndCorner();
189
- const visitedHorizontalCells = new WeakSet();
190
- _classPrivateFieldSet(_cellsHorizontalOrder, this, new _linkedList.default());
191
- for (let r = topStart.row; r <= bottomEnd.row; r++) {
192
- if (_classPrivateFieldGet(_rowIndexMapper, this).isHidden(r)) {
193
- // eslint-disable-next-line no-continue
194
- continue;
195
- }
196
- for (let c = topStart.col; c <= bottomEnd.col; c++) {
197
- if (_classPrivateFieldGet(_columnIndexMapper, this).isHidden(c)) {
198
- // eslint-disable-next-line no-continue
199
- continue;
200
- }
201
- const node = _assertClassBrand(_FocusOrder_brand, this, _pushOrderNode).call(this, selectedRange, _classPrivateFieldGet(_cellsHorizontalOrder, this), visitedHorizontalCells, r, c);
202
- if (node) {
203
- _classPrivateFieldSet(_currentHorizontalLinkedNode, this, node);
204
- }
205
- }
206
- }
207
-
208
- // create circular linked list
209
- if (_classPrivateFieldGet(_cellsHorizontalOrder, this).first) {
210
- _classPrivateFieldGet(_cellsHorizontalOrder, this).first.prev = _classPrivateFieldGet(_cellsHorizontalOrder, this).last;
211
- _classPrivateFieldGet(_cellsHorizontalOrder, this).last.next = _classPrivateFieldGet(_cellsHorizontalOrder, this).first;
212
- }
213
- const visitedVerticalCells = new WeakSet();
214
- _classPrivateFieldSet(_cellsVerticalOrder, this, new _linkedList.default());
215
- for (let c = topStart.col; c <= bottomEnd.col; c++) {
216
- if (_classPrivateFieldGet(_columnIndexMapper, this).isHidden(c)) {
217
- // eslint-disable-next-line no-continue
218
- continue;
219
- }
220
- for (let r = topStart.row; r <= bottomEnd.row; r++) {
221
- if (_classPrivateFieldGet(_rowIndexMapper, this).isHidden(r)) {
222
- // eslint-disable-next-line no-continue
223
- continue;
224
- }
225
- const node = _assertClassBrand(_FocusOrder_brand, this, _pushOrderNode).call(this, selectedRange, _classPrivateFieldGet(_cellsVerticalOrder, this), visitedVerticalCells, r, c);
226
- if (node) {
227
- _classPrivateFieldSet(_currentVerticalLinkedNode, this, node);
228
- }
229
- }
230
- }
231
-
232
- // create circular linked list
233
- if (_classPrivateFieldGet(_cellsVerticalOrder, this).first) {
234
- _classPrivateFieldGet(_cellsVerticalOrder, this).first.prev = _classPrivateFieldGet(_cellsVerticalOrder, this).last;
235
- _classPrivateFieldGet(_cellsVerticalOrder, this).last.next = _classPrivateFieldGet(_cellsVerticalOrder, this).first;
236
- }
237
- }
238
- /**
239
- * Sets the active node based on the provided row and column.
240
- *
241
- * @param {number} row The visual row index.
242
- * @param {number} column The visual column index.
243
- * @returns {FocusOrder}
244
- */
245
- setActiveNode(row, column) {
246
- _classPrivateFieldGet(_cellsHorizontalOrder, this).inorder(node => {
247
- const {
248
- rowStart,
249
- rowEnd,
250
- colStart,
251
- colEnd
252
- } = node.data;
253
- if (row >= rowStart && row <= rowEnd && column >= colStart && column <= colEnd) {
254
- _classPrivateFieldSet(_currentHorizontalLinkedNode, this, node);
255
- return false;
256
- }
257
- });
258
- _classPrivateFieldGet(_cellsVerticalOrder, this).inorder(node => {
259
- const {
260
- rowStart,
261
- rowEnd,
262
- colStart,
263
- colEnd
264
- } = node.data;
265
- if (row >= rowStart && row <= rowEnd && column >= colStart && column <= colEnd) {
266
- _classPrivateFieldSet(_currentVerticalLinkedNode, this, node);
267
- return false;
268
- }
269
- });
270
- return this;
271
- }
272
- }
273
- exports.FocusOrder = FocusOrder;
274
- function _pushOrderNode(selectedRange, listOrder, mergeCellsVisitor, row, column) {
275
- const topStart = selectedRange.getTopStartCorner();
276
- const bottomEnd = selectedRange.getBottomEndCorner();
277
- const highlight = selectedRange.highlight.clone().normalize();
278
- const mergeParent = _classPrivateFieldGet(_mergedCellsGetter, this).call(this, row, column);
279
- if (mergeParent && mergeCellsVisitor.has(mergeParent)) {
280
- return null;
281
- }
282
- const node = {
283
- colStart: column,
284
- colEnd: column,
285
- rowStart: row,
286
- rowEnd: row
287
- };
288
- if (mergeParent) {
289
- mergeCellsVisitor.add(mergeParent);
290
- if (mergeParent.row < topStart.row || mergeParent.row + mergeParent.rowspan - 1 > bottomEnd.row || mergeParent.col < topStart.col || mergeParent.col + mergeParent.colspan - 1 > bottomEnd.col) {
291
- return null;
292
- }
293
- node.colStart = mergeParent.col;
294
- node.colEnd = mergeParent.col + mergeParent.colspan - 1;
295
- node.rowStart = mergeParent.row;
296
- node.rowEnd = mergeParent.row + mergeParent.rowspan - 1;
297
- }
298
- const linkedNode = listOrder.push(node);
299
- if (row === highlight.row && column === highlight.col || mergeParent && highlight.row >= mergeParent.row && highlight.row <= mergeParent.row + mergeParent.rowspan - 1 && highlight.col >= mergeParent.col && highlight.col <= mergeParent.col + mergeParent.colspan - 1) {
300
- return linkedNode;
301
- }
302
- return null;
303
- }