handsontable 0.0.0-next-d96e9b5-20240220 → 0.0.0-next-d4816a9-20240221
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/cell/range.d.ts +0 -1
- package/3rdparty/walkontable/src/cell/range.js +0 -12
- package/3rdparty/walkontable/src/cell/range.mjs +0 -12
- 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.js +0 -14
- package/core.mjs +0 -14
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1328 -1606
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +151 -151
- package/dist/handsontable.js +1328 -1606
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +8 -12
- package/editorManager.mjs +8 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -1
- package/pluginHooks.js +1 -43
- package/pluginHooks.mjs +1 -43
- package/plugins/collapsibleColumns/collapsibleColumns.js +1 -7
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -7
- package/plugins/columnSorting/columnSorting.js +0 -6
- package/plugins/columnSorting/columnSorting.mjs +0 -6
- package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
- package/plugins/mergeCells/calculations/selection.js +70 -1
- package/plugins/mergeCells/calculations/selection.mjs +70 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
- package/plugins/mergeCells/mergeCells.js +207 -182
- package/plugins/mergeCells/mergeCells.mjs +207 -182
- package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
- package/plugins/nestedHeaders/nestedHeaders.js +0 -1
- package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
- package/plugins/nestedRows/nestedRows.js +1 -7
- package/plugins/nestedRows/nestedRows.mjs +1 -7
- package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- package/selection/highlight/visualSelection.js +0 -2
- package/selection/highlight/visualSelection.mjs +0 -2
- package/selection/selection.js +34 -195
- package/selection/selection.mjs +33 -194
- package/selection/transformation.js +30 -45
- package/selection/transformation.mjs +30 -45
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +3 -18
- package/shortcutContexts/commands/editor/open.mjs +3 -18
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
- package/shortcutContexts/grid.js +2 -2
- package/shortcutContexts/grid.mjs +2 -2
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
@@ -360,7 +360,6 @@ export class NestedHeaders extends BasePlugin {
|
|
360
360
|
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
361
361
|
});
|
362
362
|
this.addHook('afterSelection', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
|
363
|
-
this.addHook('afterSelectionFocusSet', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
|
364
363
|
this.addHook('beforeViewportScrollHorizontally', function () {
|
365
364
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
366
365
|
args[_key8] = arguments[_key8];
|
@@ -11,7 +11,6 @@ var _contextMenu = _interopRequireDefault(require("./ui/contextMenu"));
|
|
11
11
|
var _console = require("../../helpers/console");
|
12
12
|
var _data = require("../../helpers/data");
|
13
13
|
var _translations = require("../../translations");
|
14
|
-
var _shortcutContexts = require("../../shortcutContexts");
|
15
14
|
var _rowMoveController = _interopRequireDefault(require("./utils/rowMoveController"));
|
16
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
16
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
@@ -401,18 +400,13 @@ class NestedRows extends _base.BasePlugin {
|
|
401
400
|
this.collapsingUI.collapseChildren(row);
|
402
401
|
}
|
403
402
|
}
|
404
|
-
|
405
|
-
// prevent default Enter behavior (move to the next row within a selection range)
|
406
|
-
return false;
|
407
403
|
},
|
408
404
|
runOnlyIf: () => {
|
409
405
|
var _this$hot$getSelected;
|
410
406
|
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
411
407
|
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
|
412
408
|
},
|
413
|
-
group: SHORTCUTS_GROUP
|
414
|
-
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
415
|
-
position: 'before'
|
409
|
+
group: SHORTCUTS_GROUP
|
416
410
|
});
|
417
411
|
}
|
418
412
|
|
@@ -20,7 +20,6 @@ import ContextMenuUI from "./ui/contextMenu.mjs";
|
|
20
20
|
import { error } from "../../helpers/console.mjs";
|
21
21
|
import { isArrayOfObjects } from "../../helpers/data.mjs";
|
22
22
|
import { TrimmingMap } from "../../translations/index.mjs";
|
23
|
-
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
24
23
|
import RowMoveController from "./utils/rowMoveController.mjs";
|
25
24
|
export const PLUGIN_KEY = 'nestedRows';
|
26
25
|
export const PLUGIN_PRIORITY = 300;
|
@@ -397,18 +396,13 @@ export class NestedRows extends BasePlugin {
|
|
397
396
|
this.collapsingUI.collapseChildren(row);
|
398
397
|
}
|
399
398
|
}
|
400
|
-
|
401
|
-
// prevent default Enter behavior (move to the next row within a selection range)
|
402
|
-
return false;
|
403
399
|
},
|
404
400
|
runOnlyIf: () => {
|
405
401
|
var _this$hot$getSelected;
|
406
402
|
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
407
403
|
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
|
408
404
|
},
|
409
|
-
group: SHORTCUTS_GROUP
|
410
|
-
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
411
|
-
position: 'before'
|
405
|
+
group: SHORTCUTS_GROUP
|
412
406
|
});
|
413
407
|
}
|
414
408
|
|
@@ -139,9 +139,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
|
|
139
139
|
const shortcutManager = hotInstance.getShortcutManager();
|
140
140
|
const gridContext = shortcutManager.getContext('grid');
|
141
141
|
const config = {
|
142
|
-
group: SHORTCUTS_GROUP
|
143
|
-
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
144
|
-
position: 'before'
|
142
|
+
group: SHORTCUTS_GROUP
|
145
143
|
};
|
146
144
|
gridContext.addShortcuts([{
|
147
145
|
keys: [['space']],
|
@@ -161,7 +159,9 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
|
|
161
159
|
callback: () => {
|
162
160
|
changeSelectedCheckboxesState(true);
|
163
161
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
164
|
-
}
|
162
|
+
},
|
163
|
+
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
164
|
+
position: 'before'
|
165
165
|
}], config);
|
166
166
|
}
|
167
167
|
|
@@ -134,9 +134,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
|
|
134
134
|
const shortcutManager = hotInstance.getShortcutManager();
|
135
135
|
const gridContext = shortcutManager.getContext('grid');
|
136
136
|
const config = {
|
137
|
-
group: SHORTCUTS_GROUP
|
138
|
-
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
139
|
-
position: 'before'
|
137
|
+
group: SHORTCUTS_GROUP
|
140
138
|
};
|
141
139
|
gridContext.addShortcuts([{
|
142
140
|
keys: [['space']],
|
@@ -156,7 +154,9 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
|
|
156
154
|
callback: () => {
|
157
155
|
changeSelectedCheckboxesState(true);
|
158
156
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
159
|
-
}
|
157
|
+
},
|
158
|
+
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
159
|
+
position: 'before'
|
160
160
|
}], config);
|
161
161
|
}
|
162
162
|
|
@@ -170,13 +170,11 @@ class VisualSelection extends _src.Selection {
|
|
170
170
|
this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
|
171
171
|
}
|
172
172
|
|
173
|
-
// TODO
|
174
173
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
175
174
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
176
175
|
broaderCellRange.setHighlight(currentHighlight);
|
177
176
|
}
|
178
177
|
|
179
|
-
// TODO
|
180
178
|
// Sync the highlight coords from the visual selection layer with logical coords.
|
181
179
|
if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
|
182
180
|
broaderCellRange.setHighlight(this.visualCellRange.highlight);
|
@@ -167,13 +167,11 @@ class VisualSelection extends Selection {
|
|
167
167
|
this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
|
168
168
|
}
|
169
169
|
|
170
|
-
// TODO
|
171
170
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
172
171
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
173
172
|
broaderCellRange.setHighlight(currentHighlight);
|
174
173
|
}
|
175
174
|
|
176
|
-
// TODO
|
177
175
|
// Sync the highlight coords from the visual selection layer with logical coords.
|
178
176
|
if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
|
179
177
|
broaderCellRange.setHighlight(this.visualCellRange.highlight);
|
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");
|
@@ -30,9 +30,6 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
|
|
30
30
|
* @class Selection
|
31
31
|
* @util
|
32
32
|
*/
|
33
|
-
var _transformation = /*#__PURE__*/new WeakMap();
|
34
|
-
var _focusTransformation = /*#__PURE__*/new WeakMap();
|
35
|
-
var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
|
36
33
|
var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
|
37
34
|
var _selectionSource = /*#__PURE__*/new WeakMap();
|
38
35
|
var _expectedLayersCount = /*#__PURE__*/new WeakMap();
|
@@ -72,23 +69,11 @@ class Selection {
|
|
72
69
|
*/
|
73
70
|
_defineProperty(this, "highlight", void 0);
|
74
71
|
/**
|
75
|
-
* The module for modifying coordinates
|
72
|
+
* The module for modifying coordinates.
|
76
73
|
*
|
77
74
|
* @type {Transformation}
|
78
75
|
*/
|
79
|
-
|
80
|
-
writable: true,
|
81
|
-
value: void 0
|
82
|
-
});
|
83
|
-
/**
|
84
|
-
* The module for modifying coordinates of the focus selection.
|
85
|
-
*
|
86
|
-
* @type {Transformation}
|
87
|
-
*/
|
88
|
-
_classPrivateFieldInitSpec(this, _focusTransformation, {
|
89
|
-
writable: true,
|
90
|
-
value: void 0
|
91
|
-
});
|
76
|
+
_defineProperty(this, "transformation", void 0);
|
92
77
|
/**
|
93
78
|
* The collection of the selection layer levels where the whole row was selected using the row header or
|
94
79
|
* the corner header.
|
@@ -103,15 +88,6 @@ class Selection {
|
|
103
88
|
* @type {Set<number>}
|
104
89
|
*/
|
105
90
|
_defineProperty(this, "selectedByColumnHeader", new Set());
|
106
|
-
/**
|
107
|
-
* The flag which determines if the focus selection was changed.
|
108
|
-
*
|
109
|
-
* @type {boolean}
|
110
|
-
*/
|
111
|
-
_classPrivateFieldInitSpec(this, _isFocusSelectionChanged, {
|
112
|
-
writable: true,
|
113
|
-
value: false
|
114
|
-
});
|
115
91
|
/**
|
116
92
|
* When sets disable highlighting the headers even when the logical coordinates points on them.
|
117
93
|
*
|
@@ -162,100 +138,71 @@ class Selection {
|
|
162
138
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
163
139
|
createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
|
164
140
|
});
|
165
|
-
|
141
|
+
this.transformation = new _transformation.default(this.selectedRange, {
|
166
142
|
rowIndexMapper: this.tableProps.rowIndexMapper,
|
167
143
|
columnIndexMapper: this.tableProps.columnIndexMapper,
|
168
144
|
countRenderableRows: () => this.tableProps.countRenderableRows(),
|
169
145
|
countRenderableColumns: () => this.tableProps.countRenderableColumns(),
|
146
|
+
countRowHeaders: () => this.tableProps.countRowHeaders(),
|
147
|
+
countColHeaders: () => this.tableProps.countColHeaders(),
|
170
148
|
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
171
149
|
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
172
150
|
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
151
|
+
navigableHeaders: () => settings.navigableHeaders,
|
173
152
|
fixedRowsBottom: () => settings.fixedRowsBottom,
|
174
153
|
minSpareRows: () => settings.minSpareRows,
|
175
154
|
minSpareCols: () => settings.minSpareCols,
|
176
155
|
autoWrapRow: () => settings.autoWrapRow,
|
177
156
|
autoWrapCol: () => settings.autoWrapCol
|
178
|
-
})
|
179
|
-
|
180
|
-
rowIndexMapper: this.tableProps.rowIndexMapper,
|
181
|
-
columnIndexMapper: this.tableProps.columnIndexMapper,
|
182
|
-
countRenderableRows: () => {
|
183
|
-
const range = this.selectedRange.current();
|
184
|
-
return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
|
185
|
-
},
|
186
|
-
countRenderableColumns: () => {
|
187
|
-
const range = this.selectedRange.current();
|
188
|
-
return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
|
189
|
-
},
|
190
|
-
visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
|
191
|
-
renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
|
192
|
-
createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
|
193
|
-
fixedRowsBottom: () => 0,
|
194
|
-
minSpareRows: () => 0,
|
195
|
-
minSpareCols: () => 0,
|
196
|
-
autoWrapRow: () => true,
|
197
|
-
autoWrapCol: () => true
|
198
|
-
}));
|
199
|
-
_classPrivateFieldGet(this, _transformation).addLocalHook('beforeTransformStart', function () {
|
157
|
+
});
|
158
|
+
this.transformation.addLocalHook('beforeTransformStart', function () {
|
200
159
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
201
160
|
args[_key] = arguments[_key];
|
202
161
|
}
|
203
162
|
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
204
163
|
});
|
205
|
-
|
164
|
+
this.transformation.addLocalHook('afterTransformStart', function () {
|
206
165
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
207
166
|
args[_key2] = arguments[_key2];
|
208
167
|
}
|
209
168
|
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
210
169
|
});
|
211
|
-
|
170
|
+
this.transformation.addLocalHook('beforeTransformEnd', function () {
|
212
171
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
213
172
|
args[_key3] = arguments[_key3];
|
214
173
|
}
|
215
174
|
return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
|
216
175
|
});
|
217
|
-
|
176
|
+
this.transformation.addLocalHook('afterTransformEnd', function () {
|
218
177
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
219
178
|
args[_key4] = arguments[_key4];
|
220
179
|
}
|
221
180
|
return _this.runLocalHooks('afterModifyTransformEnd', ...args);
|
222
181
|
});
|
223
|
-
|
182
|
+
this.transformation.addLocalHook('insertRowRequire', function () {
|
224
183
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
225
184
|
args[_key5] = arguments[_key5];
|
226
185
|
}
|
227
186
|
return _this.runLocalHooks('insertRowRequire', ...args);
|
228
187
|
});
|
229
|
-
|
188
|
+
this.transformation.addLocalHook('insertColRequire', function () {
|
230
189
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
231
190
|
args[_key6] = arguments[_key6];
|
232
191
|
}
|
233
192
|
return _this.runLocalHooks('insertColRequire', ...args);
|
234
193
|
});
|
235
|
-
|
194
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
236
195
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
237
196
|
args[_key7] = arguments[_key7];
|
238
197
|
}
|
239
198
|
return _this.runLocalHooks('beforeRowWrap', ...args);
|
240
199
|
});
|
241
|
-
|
200
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
242
201
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
243
202
|
args[_key8] = arguments[_key8];
|
244
203
|
}
|
245
204
|
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
246
205
|
});
|
247
|
-
_classPrivateFieldGet(this, _focusTransformation).addLocalHook('beforeTransformStart', function () {
|
248
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
249
|
-
args[_key9] = arguments[_key9];
|
250
|
-
}
|
251
|
-
return _this.runLocalHooks('beforeModifyTransformStart', ...args);
|
252
|
-
});
|
253
|
-
_classPrivateFieldGet(this, _focusTransformation).addLocalHook('afterTransformStart', function () {
|
254
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
255
|
-
args[_key10] = arguments[_key10];
|
256
|
-
}
|
257
|
-
return _this.runLocalHooks('afterModifyTransformStart', ...args);
|
258
|
-
});
|
259
206
|
}
|
260
207
|
|
261
208
|
/**
|
@@ -346,7 +293,6 @@ class Selection {
|
|
346
293
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
347
294
|
// should be handled by next methods.
|
348
295
|
const coordsClone = coords.clone();
|
349
|
-
_classPrivateFieldSet(this, _isFocusSelectionChanged, false);
|
350
296
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
351
297
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
|
352
298
|
this.selectedRange.clear();
|
@@ -404,20 +350,7 @@ class Selection {
|
|
404
350
|
cellRange.setFrom(cellRange.highlight);
|
405
351
|
cellRange.setTo(cellRange.highlight);
|
406
352
|
} else {
|
407
|
-
const horizontalDir = cellRange.getHorizontalDirection();
|
408
|
-
const verticalDir = cellRange.getVerticalDirection();
|
409
|
-
const isMultiple = this.isMultiple();
|
410
353
|
cellRange.setTo(coordsClone);
|
411
|
-
if (isMultiple && horizontalDir !== cellRange.getHorizontalDirection()) {
|
412
|
-
cellRange.from.assign({
|
413
|
-
col: cellRange.highlight.col
|
414
|
-
});
|
415
|
-
}
|
416
|
-
if (isMultiple && verticalDir !== cellRange.getVerticalDirection()) {
|
417
|
-
cellRange.from.assign({
|
418
|
-
row: cellRange.highlight.row
|
419
|
-
});
|
420
|
-
}
|
421
354
|
}
|
422
355
|
|
423
356
|
// Prevent creating "area" selection that overlaps headers.
|
@@ -427,7 +360,11 @@ class Selection {
|
|
427
360
|
}
|
428
361
|
}
|
429
362
|
this.runLocalHooks('beforeHighlightSet');
|
430
|
-
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
|
+
}
|
431
368
|
const layerLevel = this.getLayerLevel();
|
432
369
|
|
433
370
|
// If the next layer level is lower than previous then clear all area and header highlights. This is the
|
@@ -515,28 +452,15 @@ class Selection {
|
|
515
452
|
}
|
516
453
|
|
517
454
|
/**
|
518
|
-
*
|
455
|
+
* Returns information if we have a multiselection. This method check multiselection only on the latest layer of
|
456
|
+
* the selection.
|
519
457
|
*
|
520
|
-
* @
|
458
|
+
* @returns {boolean}
|
521
459
|
*/
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
const cellRange = this.selectedRange.current();
|
527
|
-
const focusHighlight = this.highlight.getFocus();
|
528
|
-
focusHighlight.clear();
|
529
|
-
cellRange.setHighlight(coords);
|
530
|
-
if (!this.inProgress) {
|
531
|
-
this.runLocalHooks('beforeHighlightSet');
|
532
|
-
}
|
533
|
-
if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
|
534
|
-
focusHighlight.add(cellRange.highlight).commit().syncWith(cellRange);
|
535
|
-
}
|
536
|
-
if (!this.inProgress) {
|
537
|
-
_classPrivateFieldSet(this, _isFocusSelectionChanged, true);
|
538
|
-
this.runLocalHooks('afterSetFocus', cellRange.highlight);
|
539
|
-
}
|
460
|
+
isMultiple() {
|
461
|
+
const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
|
462
|
+
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
463
|
+
return isMultipleListener.value;
|
540
464
|
}
|
541
465
|
|
542
466
|
/**
|
@@ -549,13 +473,7 @@ class Selection {
|
|
549
473
|
*/
|
550
474
|
transformStart(rowDelta, colDelta) {
|
551
475
|
let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
552
|
-
|
553
|
-
_classPrivateFieldGet(this, _transformation).setOffsetSize({
|
554
|
-
x: this.tableProps.countRowHeaders(),
|
555
|
-
y: this.tableProps.countColHeaders()
|
556
|
-
});
|
557
|
-
}
|
558
|
-
this.setRangeStart(_classPrivateFieldGet(this, _transformation).transformStart(rowDelta, colDelta, createMissingRecords));
|
476
|
+
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
|
559
477
|
}
|
560
478
|
|
561
479
|
/**
|
@@ -565,44 +483,7 @@ class Selection {
|
|
565
483
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
566
484
|
*/
|
567
485
|
transformEnd(rowDelta, colDelta) {
|
568
|
-
|
569
|
-
_classPrivateFieldGet(this, _transformation).setOffsetSize({
|
570
|
-
x: this.tableProps.countRowHeaders(),
|
571
|
-
y: this.tableProps.countColHeaders()
|
572
|
-
});
|
573
|
-
}
|
574
|
-
this.setRangeEnd(_classPrivateFieldGet(this, _transformation).transformEnd(rowDelta, colDelta));
|
575
|
-
}
|
576
|
-
|
577
|
-
/**
|
578
|
-
* Transforms the focus cell selection relative to the current focus position.
|
579
|
-
*
|
580
|
-
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
581
|
-
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
582
|
-
*/
|
583
|
-
transformFocus(rowDelta, colDelta) {
|
584
|
-
const range = this.selectedRange.current();
|
585
|
-
const {
|
586
|
-
row,
|
587
|
-
col
|
588
|
-
} = range.getOuterTopStartCorner();
|
589
|
-
const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
|
590
|
-
const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
|
591
|
-
if (range.highlight.isHeader()) {
|
592
|
-
// for header focus selection calculate the new coords based on the selection including headers
|
593
|
-
_classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
|
594
|
-
x: col < 0 ? Math.abs(col) : -columnsInRange,
|
595
|
-
y: row < 0 ? Math.abs(row) : -rowsInRange
|
596
|
-
});
|
597
|
-
} else {
|
598
|
-
// for focus selection in cells calculate the new coords only based on the selected cells
|
599
|
-
_classPrivateFieldGet(this, _focusTransformation).setOffsetSize({
|
600
|
-
x: col < 0 ? 0 : -columnsInRange,
|
601
|
-
y: row < 0 ? 0 : -rowsInRange
|
602
|
-
});
|
603
|
-
}
|
604
|
-
const focusCoords = _classPrivateFieldGet(this, _focusTransformation).transformStart(rowDelta, colDelta);
|
605
|
-
this.setRangeFocus(focusCoords.normalize());
|
486
|
+
this.setRangeEnd(this.transformation.transformEnd(rowDelta, colDelta));
|
606
487
|
}
|
607
488
|
|
608
489
|
/**
|
@@ -623,30 +504,6 @@ class Selection {
|
|
623
504
|
return !this.selectedRange.isEmpty();
|
624
505
|
}
|
625
506
|
|
626
|
-
/**
|
627
|
-
* Returns information if we have a multi-selection. This method check multi-selection only on the latest layer of
|
628
|
-
* the selection.
|
629
|
-
*
|
630
|
-
* @returns {boolean}
|
631
|
-
*/
|
632
|
-
isMultiple() {
|
633
|
-
if (!this.isSelected()) {
|
634
|
-
return false;
|
635
|
-
}
|
636
|
-
const isMultipleListener = (0, _object.createObjectPropListener)(!this.selectedRange.current().isSingle());
|
637
|
-
this.runLocalHooks('afterIsMultipleSelection', isMultipleListener);
|
638
|
-
return isMultipleListener.value;
|
639
|
-
}
|
640
|
-
|
641
|
-
/**
|
642
|
-
* Checks if the last selection involves changing the focus cell position only.
|
643
|
-
*
|
644
|
-
* @returns {boolean}
|
645
|
-
*/
|
646
|
-
isFocusSelectionChanged() {
|
647
|
-
return this.isSelected() && _classPrivateFieldGet(this, _isFocusSelectionChanged);
|
648
|
-
}
|
649
|
-
|
650
507
|
/**
|
651
508
|
* Returns `true` if the selection was applied by clicking to the row header. If the `layerLevel`
|
652
509
|
* argument is passed then only that layer will be checked. Otherwise, it checks if any row header
|
@@ -952,20 +809,11 @@ class Selection {
|
|
952
809
|
countColHeaders
|
953
810
|
});
|
954
811
|
if (isValid) {
|
955
|
-
|
956
|
-
let highlightColumn = 0;
|
957
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
958
|
-
highlightRow = (0, _number.clamp)(focusPosition.row, columnHeaderLastIndex, countRows - 1);
|
959
|
-
highlightColumn = (0, _number.clamp)(focusPosition.col, Math.min(start, end), Math.max(start, end));
|
960
|
-
} else {
|
961
|
-
highlightRow = (0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1);
|
962
|
-
highlightColumn = start;
|
963
|
-
}
|
964
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
965
|
-
const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(highlight.row, columnHeaderLastIndex, -1);
|
812
|
+
const fromRow = countColHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, columnHeaderLastIndex, -1);
|
966
813
|
const toRow = countRows - 1;
|
967
814
|
const from = this.tableProps.createCellCoords(fromRow, start);
|
968
815
|
const to = this.tableProps.createCellCoords(toRow, end);
|
816
|
+
const highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition, columnHeaderLastIndex, countRows - 1), start);
|
969
817
|
this.runLocalHooks('beforeSelectColumns', from, to, highlight);
|
970
818
|
|
971
819
|
// disallow modifying row axis for that hooks
|
@@ -1006,20 +854,11 @@ class Selection {
|
|
1006
854
|
countColHeaders: 0
|
1007
855
|
});
|
1008
856
|
if (isValid) {
|
1009
|
-
|
1010
|
-
let highlightColumn = 0;
|
1011
|
-
if (Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
1012
|
-
highlightRow = (0, _number.clamp)(focusPosition.row, Math.min(startRow, endRow), Math.max(startRow, endRow));
|
1013
|
-
highlightColumn = (0, _number.clamp)(focusPosition.col, rowHeaderLastIndex, countCols - 1);
|
1014
|
-
} else {
|
1015
|
-
highlightRow = startRow;
|
1016
|
-
highlightColumn = (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1);
|
1017
|
-
}
|
1018
|
-
const highlight = this.tableProps.createCellCoords(highlightRow, highlightColumn);
|
1019
|
-
const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(highlight.col, rowHeaderLastIndex, -1);
|
857
|
+
const fromColumn = countRowHeaders === 0 ? 0 : (0, _number.clamp)(focusPosition, rowHeaderLastIndex, -1);
|
1020
858
|
const toColumn = countCols - 1;
|
1021
859
|
const from = this.tableProps.createCellCoords(startRow, fromColumn);
|
1022
860
|
const to = this.tableProps.createCellCoords(endRow, toColumn);
|
861
|
+
const highlight = this.tableProps.createCellCoords(startRow, (0, _number.clamp)(focusPosition, rowHeaderLastIndex, countCols - 1));
|
1023
862
|
this.runLocalHooks('beforeSelectRows', from, to, highlight);
|
1024
863
|
|
1025
864
|
// disallow modifying column axis for that hooks
|