handsontable 0.0.0-next-820d8a2-20221122 → 0.0.0-next-6812ce6-20221122

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (57) hide show
  1. package/3rdparty/walkontable/src/cell/range.js +8 -0
  2. package/3rdparty/walkontable/src/cell/range.mjs +8 -0
  3. package/base.js +2 -2
  4. package/base.mjs +2 -2
  5. package/core.d.ts +1 -1
  6. package/core.js +37 -29
  7. package/core.mjs +37 -29
  8. package/dist/handsontable.css +2 -2
  9. package/dist/handsontable.full.css +2 -2
  10. package/dist/handsontable.full.js +3135 -2444
  11. package/dist/handsontable.full.min.css +2 -2
  12. package/dist/handsontable.full.min.js +62 -62
  13. package/dist/handsontable.js +2563 -1872
  14. package/dist/handsontable.min.css +2 -2
  15. package/dist/handsontable.min.js +3 -3
  16. package/dist/languages/all.js +1 -1
  17. package/dist/languages/all.min.js +1 -1
  18. package/dist/languages/en-US.js +1 -1
  19. package/dist/languages/en-US.min.js +1 -1
  20. package/helpers/mixed.js +1 -1
  21. package/helpers/mixed.mjs +1 -1
  22. package/i18n/constants.js +49 -42
  23. package/i18n/constants.mjs +45 -41
  24. package/i18n/languages/en-US.js +1 -1
  25. package/i18n/languages/en-US.mjs +1 -1
  26. package/languages/all.js +1 -1
  27. package/languages/en-US.js +1 -1
  28. package/languages/en-US.mjs +1 -1
  29. package/languages/index.js +1 -1
  30. package/package.json +1 -1
  31. package/pluginHooks.d.ts +7 -2
  32. package/pluginHooks.js +23 -3
  33. package/pluginHooks.mjs +23 -3
  34. package/plugins/contextMenu/contextMenu.d.ts +4 -3
  35. package/plugins/copyPaste/contextMenuItem/copy.js +4 -16
  36. package/plugins/copyPaste/contextMenuItem/copy.mjs +4 -4
  37. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +35 -0
  38. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +31 -0
  39. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +35 -0
  40. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +31 -0
  41. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +35 -0
  42. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +31 -0
  43. package/plugins/copyPaste/copyPaste.d.ts +10 -2
  44. package/plugins/copyPaste/copyPaste.js +263 -173
  45. package/plugins/copyPaste/copyPaste.mjs +263 -173
  46. package/plugins/copyPaste/copyableRanges.js +260 -0
  47. package/plugins/copyPaste/copyableRanges.mjs +255 -0
  48. package/plugins/nestedHeaders/nestedHeaders.js +114 -11
  49. package/plugins/nestedHeaders/nestedHeaders.mjs +114 -11
  50. package/plugins/nestedHeaders/stateManager/headersTree.js +1 -0
  51. package/plugins/nestedHeaders/stateManager/headersTree.mjs +1 -0
  52. package/plugins/nestedHeaders/stateManager/index.js +21 -10
  53. package/plugins/nestedHeaders/stateManager/index.mjs +21 -10
  54. package/selection/selection.js +2 -1
  55. package/selection/selection.mjs +2 -1
  56. package/tableView.js +133 -63
  57. package/tableView.mjs +133 -63
@@ -176,9 +176,15 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
176
176
  this.addHook('modifyColWidth', function () {
177
177
  return _this2.onModifyColWidth.apply(_this2, arguments);
178
178
  });
179
+ this.addHook('modifyColumnHeaderValue', function () {
180
+ return _this2.onModifyColumnHeaderValue.apply(_this2, arguments);
181
+ });
179
182
  this.addHook('beforeHighlightingColumnHeader', function () {
180
183
  return _this2.onBeforeHighlightingColumnHeader.apply(_this2, arguments);
181
184
  });
185
+ this.addHook('beforeCopy', function () {
186
+ return _this2.onBeforeCopy.apply(_this2, arguments);
187
+ });
182
188
  this.addHook('afterViewportColumnCalculatorOverride', function () {
183
189
  return _this2.onAfterViewportColumnCalculatorOverride.apply(_this2, arguments);
184
190
  });
@@ -347,17 +353,16 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
347
353
  var _this4$hot = _this4.hot,
348
354
  columnIndexMapper = _this4$hot.columnIndexMapper,
349
355
  view = _this4$hot.view;
350
- var visualColumnsIndex = columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
351
- if (visualColumnsIndex === null) {
352
- visualColumnsIndex = renderedColumnIndex;
356
+ var visualColumnIndex = columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
357
+ if (visualColumnIndex === null) {
358
+ visualColumnIndex = renderedColumnIndex;
353
359
  }
354
360
  TH.removeAttribute('colspan');
355
361
  (0, _element.removeClass)(TH, 'hiddenHeader');
356
- var _ref2 = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this4, _stateManager).getHeaderSettings(headerLevel, visualColumnsIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {
362
+ var _ref2 = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this4, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {
357
363
  label: ''
358
364
  },
359
365
  colspan = _ref2.colspan,
360
- label = _ref2.label,
361
366
  isHidden = _ref2.isHidden,
362
367
  isPlaceholder = _ref2.isPlaceholder;
363
368
  if (isPlaceholder || isHidden) {
@@ -374,12 +379,36 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
374
379
  TH.setAttribute('colspan', correctedColspan);
375
380
  }
376
381
  }
377
- _this4.hot.view.appendColHeader(visualColumnsIndex, TH, function () {
378
- return label;
382
+ _this4.hot.view.appendColHeader(visualColumnIndex, TH, function () {
383
+ return _this4.getColumnHeaderValue.apply(_this4, arguments);
379
384
  }, headerLevel);
380
385
  };
381
386
  }
382
387
 
388
+ /**
389
+ * Returns the column header value for specified column and header level index.
390
+ *
391
+ * @private
392
+ * @param {number} visualColumnIndex Visual column index.
393
+ * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
394
+ * and negative (-1 to -N) values. For positive values, 0 points to the
395
+ * top most header, and for negative direction, -1 points to the most bottom
396
+ * header (the header closest to the cells).
397
+ * @returns {string} Returns the column header value to update.
398
+ */
399
+ }, {
400
+ key: "getColumnHeaderValue",
401
+ value: function getColumnHeaderValue(visualColumnIndex, headerLevel) {
402
+ var _classPrivateFieldGet3;
403
+ var _ref3 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : {},
404
+ isHidden = _ref3.isHidden,
405
+ isPlaceholder = _ref3.isPlaceholder;
406
+ if (isPlaceholder || isHidden) {
407
+ return '';
408
+ }
409
+ return this.hot.getColHeader(visualColumnIndex, headerLevel);
410
+ }
411
+
383
412
  /**
384
413
  * Allows to control which header DOM element will be used to highlight.
385
414
  *
@@ -400,9 +429,9 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
400
429
  columnCursor = highlightMeta.columnCursor,
401
430
  selectionType = highlightMeta.selectionType,
402
431
  selectionWidth = highlightMeta.selectionWidth;
403
- var _classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn),
404
- isRoot = _classPrivateFieldGet3.isRoot,
405
- colspan = _classPrivateFieldGet3.colspan;
432
+ var _classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn),
433
+ isRoot = _classPrivateFieldGet4.isRoot,
434
+ colspan = _classPrivateFieldGet4.colspan;
406
435
  if (selectionType === _selection.HEADER_TYPE) {
407
436
  if (!isRoot) {
408
437
  return headerNodeData.columnIndex;
@@ -417,7 +446,57 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
417
446
  }
418
447
 
419
448
  /**
420
- * Allows to block the column selection that is controlled by the core Selection module.
449
+ * Listens the `beforeCopy` hook that allows processing the copied column headers so that the
450
+ * merged column headers do not propagate the value for each column but only once at the beginning
451
+ * of the column.
452
+ *
453
+ * @private
454
+ * @param {Array[]} data An array of arrays which contains data to copied.
455
+ * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
456
+ * which will copied.
457
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
458
+ * the number of copied headers.
459
+ */
460
+ }, {
461
+ key: "onBeforeCopy",
462
+ value: function onBeforeCopy(data, copyableRanges, _ref4) {
463
+ var columnHeadersCount = _ref4.columnHeadersCount;
464
+ if (columnHeadersCount === 0) {
465
+ return;
466
+ }
467
+ for (var rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
468
+ var _copyableRanges$range = copyableRanges[rangeIndex],
469
+ startRow = _copyableRanges$range.startRow,
470
+ startCol = _copyableRanges$range.startCol,
471
+ endRow = _copyableRanges$range.endRow,
472
+ endCol = _copyableRanges$range.endCol;
473
+ var rowsCount = endRow - startRow + 1;
474
+ var columnsCount = startCol - endCol + 1;
475
+
476
+ // do not process dataset ranges and column headers where only one column is copied
477
+ if (startRow >= 0 || columnsCount === 1) {
478
+ break;
479
+ }
480
+ for (var column = startCol; column <= endCol; column++) {
481
+ for (var row = startRow; row <= endRow; row++) {
482
+ var _classPrivateFieldGet5;
483
+ var zeroBasedColumnHeaderLevel = rowsCount + row;
484
+ var zeroBasedColumnIndex = column - startCol;
485
+ if (zeroBasedColumnIndex === 0) {
486
+ continue; // eslint-disable-line no-continue
487
+ }
488
+
489
+ var isRoot = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isRoot;
490
+ if (isRoot === false) {
491
+ data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
492
+ }
493
+ }
494
+ }
495
+ }
496
+ }
497
+
498
+ /**
499
+ * Allows blocking the column selection that is controlled by the core Selection module.
421
500
  *
422
501
  * @private
423
502
  * @param {MouseEvent} event Mouse event.
@@ -586,6 +665,30 @@ var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
586
665
  return width > cachedWidth ? width : cachedWidth;
587
666
  }
588
667
 
668
+ /**
669
+ * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
670
+ * the internal state and settings of the plugin.
671
+ *
672
+ * @private
673
+ * @param {string} value The column header value.
674
+ * @param {number} visualColumnIndex The visual column index.
675
+ * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
676
+ * and negative (-1 to -N) values. For positive values, 0 points to the
677
+ * top most header, and for negative direction, -1 points to the most bottom
678
+ * header (the header closest to the cells).
679
+ * @returns {string} Returns the column header value to update.
680
+ */
681
+ }, {
682
+ key: "onModifyColumnHeaderValue",
683
+ value: function onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
684
+ var _classPrivateFieldGet6;
685
+ var _ref5 = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
686
+ label: ''
687
+ },
688
+ label = _ref5.label;
689
+ return label;
690
+ }
691
+
589
692
  /**
590
693
  * Updates the plugin state after HoT initialization.
591
694
  *
@@ -169,9 +169,15 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
169
169
  this.addHook('modifyColWidth', function () {
170
170
  return _this2.onModifyColWidth.apply(_this2, arguments);
171
171
  });
172
+ this.addHook('modifyColumnHeaderValue', function () {
173
+ return _this2.onModifyColumnHeaderValue.apply(_this2, arguments);
174
+ });
172
175
  this.addHook('beforeHighlightingColumnHeader', function () {
173
176
  return _this2.onBeforeHighlightingColumnHeader.apply(_this2, arguments);
174
177
  });
178
+ this.addHook('beforeCopy', function () {
179
+ return _this2.onBeforeCopy.apply(_this2, arguments);
180
+ });
175
181
  this.addHook('afterViewportColumnCalculatorOverride', function () {
176
182
  return _this2.onAfterViewportColumnCalculatorOverride.apply(_this2, arguments);
177
183
  });
@@ -340,17 +346,16 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
340
346
  var _this4$hot = _this4.hot,
341
347
  columnIndexMapper = _this4$hot.columnIndexMapper,
342
348
  view = _this4$hot.view;
343
- var visualColumnsIndex = columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
344
- if (visualColumnsIndex === null) {
345
- visualColumnsIndex = renderedColumnIndex;
349
+ var visualColumnIndex = columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
350
+ if (visualColumnIndex === null) {
351
+ visualColumnIndex = renderedColumnIndex;
346
352
  }
347
353
  TH.removeAttribute('colspan');
348
354
  removeClass(TH, 'hiddenHeader');
349
- var _ref2 = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this4, _stateManager).getHeaderSettings(headerLevel, visualColumnsIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {
355
+ var _ref2 = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this4, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {
350
356
  label: ''
351
357
  },
352
358
  colspan = _ref2.colspan,
353
- label = _ref2.label,
354
359
  isHidden = _ref2.isHidden,
355
360
  isPlaceholder = _ref2.isPlaceholder;
356
361
  if (isPlaceholder || isHidden) {
@@ -367,12 +372,36 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
367
372
  TH.setAttribute('colspan', correctedColspan);
368
373
  }
369
374
  }
370
- _this4.hot.view.appendColHeader(visualColumnsIndex, TH, function () {
371
- return label;
375
+ _this4.hot.view.appendColHeader(visualColumnIndex, TH, function () {
376
+ return _this4.getColumnHeaderValue.apply(_this4, arguments);
372
377
  }, headerLevel);
373
378
  };
374
379
  }
375
380
 
381
+ /**
382
+ * Returns the column header value for specified column and header level index.
383
+ *
384
+ * @private
385
+ * @param {number} visualColumnIndex Visual column index.
386
+ * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
387
+ * and negative (-1 to -N) values. For positive values, 0 points to the
388
+ * top most header, and for negative direction, -1 points to the most bottom
389
+ * header (the header closest to the cells).
390
+ * @returns {string} Returns the column header value to update.
391
+ */
392
+ }, {
393
+ key: "getColumnHeaderValue",
394
+ value: function getColumnHeaderValue(visualColumnIndex, headerLevel) {
395
+ var _classPrivateFieldGet3;
396
+ var _ref3 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : {},
397
+ isHidden = _ref3.isHidden,
398
+ isPlaceholder = _ref3.isPlaceholder;
399
+ if (isPlaceholder || isHidden) {
400
+ return '';
401
+ }
402
+ return this.hot.getColHeader(visualColumnIndex, headerLevel);
403
+ }
404
+
376
405
  /**
377
406
  * Allows to control which header DOM element will be used to highlight.
378
407
  *
@@ -393,9 +422,9 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
393
422
  columnCursor = highlightMeta.columnCursor,
394
423
  selectionType = highlightMeta.selectionType,
395
424
  selectionWidth = highlightMeta.selectionWidth;
396
- var _classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn),
397
- isRoot = _classPrivateFieldGet3.isRoot,
398
- colspan = _classPrivateFieldGet3.colspan;
425
+ var _classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn),
426
+ isRoot = _classPrivateFieldGet4.isRoot,
427
+ colspan = _classPrivateFieldGet4.colspan;
399
428
  if (selectionType === HEADER_TYPE) {
400
429
  if (!isRoot) {
401
430
  return headerNodeData.columnIndex;
@@ -410,7 +439,57 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
410
439
  }
411
440
 
412
441
  /**
413
- * Allows to block the column selection that is controlled by the core Selection module.
442
+ * Listens the `beforeCopy` hook that allows processing the copied column headers so that the
443
+ * merged column headers do not propagate the value for each column but only once at the beginning
444
+ * of the column.
445
+ *
446
+ * @private
447
+ * @param {Array[]} data An array of arrays which contains data to copied.
448
+ * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
449
+ * which will copied.
450
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
451
+ * the number of copied headers.
452
+ */
453
+ }, {
454
+ key: "onBeforeCopy",
455
+ value: function onBeforeCopy(data, copyableRanges, _ref4) {
456
+ var columnHeadersCount = _ref4.columnHeadersCount;
457
+ if (columnHeadersCount === 0) {
458
+ return;
459
+ }
460
+ for (var rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
461
+ var _copyableRanges$range = copyableRanges[rangeIndex],
462
+ startRow = _copyableRanges$range.startRow,
463
+ startCol = _copyableRanges$range.startCol,
464
+ endRow = _copyableRanges$range.endRow,
465
+ endCol = _copyableRanges$range.endCol;
466
+ var rowsCount = endRow - startRow + 1;
467
+ var columnsCount = startCol - endCol + 1;
468
+
469
+ // do not process dataset ranges and column headers where only one column is copied
470
+ if (startRow >= 0 || columnsCount === 1) {
471
+ break;
472
+ }
473
+ for (var column = startCol; column <= endCol; column++) {
474
+ for (var row = startRow; row <= endRow; row++) {
475
+ var _classPrivateFieldGet5;
476
+ var zeroBasedColumnHeaderLevel = rowsCount + row;
477
+ var zeroBasedColumnIndex = column - startCol;
478
+ if (zeroBasedColumnIndex === 0) {
479
+ continue; // eslint-disable-line no-continue
480
+ }
481
+
482
+ var isRoot = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isRoot;
483
+ if (isRoot === false) {
484
+ data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
485
+ }
486
+ }
487
+ }
488
+ }
489
+ }
490
+
491
+ /**
492
+ * Allows blocking the column selection that is controlled by the core Selection module.
414
493
  *
415
494
  * @private
416
495
  * @param {MouseEvent} event Mouse event.
@@ -579,6 +658,30 @@ export var NestedHeaders = /*#__PURE__*/function (_BasePlugin) {
579
658
  return width > cachedWidth ? width : cachedWidth;
580
659
  }
581
660
 
661
+ /**
662
+ * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
663
+ * the internal state and settings of the plugin.
664
+ *
665
+ * @private
666
+ * @param {string} value The column header value.
667
+ * @param {number} visualColumnIndex The visual column index.
668
+ * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
669
+ * and negative (-1 to -N) values. For positive values, 0 points to the
670
+ * top most header, and for negative direction, -1 points to the most bottom
671
+ * header (the header closest to the cells).
672
+ * @returns {string} Returns the column header value to update.
673
+ */
674
+ }, {
675
+ key: "onModifyColumnHeaderValue",
676
+ value: function onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
677
+ var _classPrivateFieldGet6;
678
+ var _ref5 = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
679
+ label: ''
680
+ },
681
+ label = _ref5.label;
682
+ return label;
683
+ }
684
+
582
685
  /**
583
686
  * Updates the plugin state after HoT initialization.
584
687
  *
@@ -178,6 +178,7 @@ var HeadersTree = /*#__PURE__*/function () {
178
178
  if (headerLevel === nodeHeaderLevel) {
179
179
  if (normColumnIndex >= columnCursor && normColumnIndex <= columnCursor + origColspan - 1) {
180
180
  treeNode = node;
181
+ treeNode.data.isRoot = columnIndex === treeNode.data.columnIndex;
181
182
  return false; // Cancel tree traversing.
182
183
  }
183
184
 
@@ -173,6 +173,7 @@ var HeadersTree = /*#__PURE__*/function () {
173
173
  if (headerLevel === nodeHeaderLevel) {
174
174
  if (normColumnIndex >= columnCursor && normColumnIndex <= columnCursor + origColspan - 1) {
175
175
  treeNode = node;
176
+ treeNode.data.isRoot = columnIndex === treeNode.data.columnIndex;
176
177
  return false; // Cancel tree traversing.
177
178
  }
178
179
 
@@ -253,16 +253,20 @@ var StateManager = /*#__PURE__*/function () {
253
253
  * │ │ │ │
254
254
  *
255
255
  * @param {number} rowIndex A visual row index.
256
- * @returns {number} Returns unsigned number.
256
+ * @returns {number|null} Returns unsigned number.
257
257
  */
258
258
  /* eslint-enable jsdoc/require-description-complete-sentence */
259
259
  }, {
260
260
  key: "rowCoordsToLevel",
261
261
  value: function rowCoordsToLevel(rowIndex) {
262
- var layersCount = Math.max(this.getLayersCount(), 1);
263
- var highestPossibleLevel = layersCount - 1;
264
- var lowestPossibleLevel = 0;
265
- return Math.min(Math.max(rowIndex + layersCount, lowestPossibleLevel), highestPossibleLevel);
262
+ if (rowIndex >= 0) {
263
+ return null;
264
+ }
265
+ var headerLevel = rowIndex + Math.max(this.getLayersCount(), 1);
266
+ if (headerLevel < 0) {
267
+ return null;
268
+ }
269
+ return headerLevel;
266
270
  }
267
271
 
268
272
  /* eslint-disable jsdoc/require-description-complete-sentence */
@@ -294,10 +298,14 @@ var StateManager = /*#__PURE__*/function () {
294
298
  }, {
295
299
  key: "levelToRowCoords",
296
300
  value: function levelToRowCoords(headerLevel) {
297
- var layersCount = Math.max(this.getLayersCount(), 1);
298
- var highestPossibleRow = -1;
299
- var lowestPossibleRow = -layersCount;
300
- return Math.min(Math.max(headerLevel - layersCount, lowestPossibleRow), highestPossibleRow);
301
+ if (headerLevel < 0) {
302
+ return null;
303
+ }
304
+ var rowIndex = headerLevel - Math.max(this.getLayersCount(), 1);
305
+ if (rowIndex >= 0) {
306
+ return null;
307
+ }
308
+ return rowIndex;
301
309
  }
302
310
 
303
311
  /**
@@ -316,7 +324,7 @@ var StateManager = /*#__PURE__*/function () {
316
324
  if (headerLevel < 0) {
317
325
  headerLevel = this.rowCoordsToLevel(headerLevel);
318
326
  }
319
- if (headerLevel >= this.getLayersCount()) {
327
+ if (headerLevel === null || headerLevel >= this.getLayersCount()) {
320
328
  return null;
321
329
  }
322
330
  return (_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateMatrix)[headerLevel]) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3[columnIndex]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : null;
@@ -337,6 +345,9 @@ var StateManager = /*#__PURE__*/function () {
337
345
  if (headerLevel < 0) {
338
346
  headerLevel = this.rowCoordsToLevel(headerLevel);
339
347
  }
348
+ if (headerLevel === null || headerLevel >= this.getLayersCount()) {
349
+ return null;
350
+ }
340
351
  var node = _classPrivateFieldGet(this, _headersTree).getNode(headerLevel, columnIndex);
341
352
  if (!node) {
342
353
  return null;
@@ -248,16 +248,20 @@ var StateManager = /*#__PURE__*/function () {
248
248
  * │ │ │ │
249
249
  *
250
250
  * @param {number} rowIndex A visual row index.
251
- * @returns {number} Returns unsigned number.
251
+ * @returns {number|null} Returns unsigned number.
252
252
  */
253
253
  /* eslint-enable jsdoc/require-description-complete-sentence */
254
254
  }, {
255
255
  key: "rowCoordsToLevel",
256
256
  value: function rowCoordsToLevel(rowIndex) {
257
- var layersCount = Math.max(this.getLayersCount(), 1);
258
- var highestPossibleLevel = layersCount - 1;
259
- var lowestPossibleLevel = 0;
260
- return Math.min(Math.max(rowIndex + layersCount, lowestPossibleLevel), highestPossibleLevel);
257
+ if (rowIndex >= 0) {
258
+ return null;
259
+ }
260
+ var headerLevel = rowIndex + Math.max(this.getLayersCount(), 1);
261
+ if (headerLevel < 0) {
262
+ return null;
263
+ }
264
+ return headerLevel;
261
265
  }
262
266
 
263
267
  /* eslint-disable jsdoc/require-description-complete-sentence */
@@ -289,10 +293,14 @@ var StateManager = /*#__PURE__*/function () {
289
293
  }, {
290
294
  key: "levelToRowCoords",
291
295
  value: function levelToRowCoords(headerLevel) {
292
- var layersCount = Math.max(this.getLayersCount(), 1);
293
- var highestPossibleRow = -1;
294
- var lowestPossibleRow = -layersCount;
295
- return Math.min(Math.max(headerLevel - layersCount, lowestPossibleRow), highestPossibleRow);
296
+ if (headerLevel < 0) {
297
+ return null;
298
+ }
299
+ var rowIndex = headerLevel - Math.max(this.getLayersCount(), 1);
300
+ if (rowIndex >= 0) {
301
+ return null;
302
+ }
303
+ return rowIndex;
296
304
  }
297
305
 
298
306
  /**
@@ -311,7 +319,7 @@ var StateManager = /*#__PURE__*/function () {
311
319
  if (headerLevel < 0) {
312
320
  headerLevel = this.rowCoordsToLevel(headerLevel);
313
321
  }
314
- if (headerLevel >= this.getLayersCount()) {
322
+ if (headerLevel === null || headerLevel >= this.getLayersCount()) {
315
323
  return null;
316
324
  }
317
325
  return (_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateMatrix)[headerLevel]) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3[columnIndex]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : null;
@@ -332,6 +340,9 @@ var StateManager = /*#__PURE__*/function () {
332
340
  if (headerLevel < 0) {
333
341
  headerLevel = this.rowCoordsToLevel(headerLevel);
334
342
  }
343
+ if (headerLevel === null || headerLevel >= this.getLayersCount()) {
344
+ return null;
345
+ }
335
346
  var node = _classPrivateFieldGet(this, _headersTree).getNode(headerLevel, columnIndex);
336
347
  if (!node) {
337
348
  return null;
@@ -644,11 +644,12 @@ var Selection = /*#__PURE__*/function () {
644
644
  return;
645
645
  }
646
646
  var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
647
+ var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
647
648
  this.clear();
648
649
  this.setRangeStartOnly(startCoords);
649
650
  this.selectedByRowHeader.add(this.getLayerLevel());
650
651
  this.selectedByColumnHeader.add(this.getLayerLevel());
651
- this.setRangeEnd(this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1));
652
+ this.setRangeEnd(endCoords);
652
653
  this.finish();
653
654
  }
654
655
 
@@ -639,11 +639,12 @@ var Selection = /*#__PURE__*/function () {
639
639
  return;
640
640
  }
641
641
  var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
642
+ var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
642
643
  this.clear();
643
644
  this.setRangeStartOnly(startCoords);
644
645
  this.selectedByRowHeader.add(this.getLayerLevel());
645
646
  this.selectedByColumnHeader.add(this.getLayerLevel());
646
- this.setRangeEnd(this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1));
647
+ this.setRangeEnd(endCoords);
647
648
  this.finish();
648
649
  }
649
650