handsontable 0.0.0-next-3d099da-20231208 → 0.0.0-next-51d3397-20231211

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 (129) hide show
  1. package/3rdparty/walkontable/src/calculator/index.js +11 -6
  2. package/3rdparty/walkontable/src/calculator/index.mjs +5 -3
  3. package/3rdparty/walkontable/src/calculator/renderAllColumns.js +50 -0
  4. package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +46 -0
  5. package/3rdparty/walkontable/src/calculator/renderAllRows.js +50 -0
  6. package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +46 -0
  7. package/3rdparty/walkontable/src/calculator/viewportColumns.js +1 -122
  8. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +2 -124
  9. package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -1
  10. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +2 -3
  11. package/3rdparty/walkontable/src/core/_base.js +0 -12
  12. package/3rdparty/walkontable/src/core/_base.mjs +0 -12
  13. package/3rdparty/walkontable/src/core/core.js +0 -2
  14. package/3rdparty/walkontable/src/core/core.mjs +0 -2
  15. package/3rdparty/walkontable/src/facade/core.js +0 -9
  16. package/3rdparty/walkontable/src/facade/core.mjs +0 -9
  17. package/3rdparty/walkontable/src/index.js +3 -4
  18. package/3rdparty/walkontable/src/index.mjs +1 -2
  19. package/3rdparty/walkontable/src/overlays.js +0 -3
  20. package/3rdparty/walkontable/src/overlays.mjs +0 -4
  21. package/3rdparty/walkontable/src/renderer/colGroup.js +10 -0
  22. package/3rdparty/walkontable/src/renderer/colGroup.mjs +10 -0
  23. package/3rdparty/walkontable/src/renderer/rows.js +4 -3
  24. package/3rdparty/walkontable/src/renderer/rows.mjs +4 -3
  25. package/3rdparty/walkontable/src/selection/manager.js +0 -1
  26. package/3rdparty/walkontable/src/selection/manager.mjs +0 -1
  27. package/3rdparty/walkontable/src/settings.js +3 -0
  28. package/3rdparty/walkontable/src/settings.mjs +2 -0
  29. package/3rdparty/walkontable/src/table.js +0 -1
  30. package/3rdparty/walkontable/src/table.mjs +0 -1
  31. package/3rdparty/walkontable/src/utils/column.js +27 -12
  32. package/3rdparty/walkontable/src/utils/column.mjs +27 -12
  33. package/3rdparty/walkontable/src/utils/columnStretching.js +219 -0
  34. package/3rdparty/walkontable/src/utils/columnStretching.mjs +215 -0
  35. package/3rdparty/walkontable/src/viewport.js +22 -17
  36. package/3rdparty/walkontable/src/viewport.mjs +23 -18
  37. package/base.js +4 -2
  38. package/base.mjs +2 -2
  39. package/core/focusCatcher/index.js +44 -6
  40. package/core/focusCatcher/index.mjs +44 -6
  41. package/core.js +0 -11
  42. package/core.mjs +0 -11
  43. package/dataMap/dataMap.js +1 -0
  44. package/dataMap/metaManager/metaSchema.js +28 -2
  45. package/dataMap/metaManager/metaSchema.mjs +28 -2
  46. package/dataMap/metaManager/mods/extendMetaProperties.js +12 -0
  47. package/dataMap/metaManager/mods/extendMetaProperties.mjs +12 -0
  48. package/dist/handsontable.css +2 -2
  49. package/dist/handsontable.full.css +3 -3
  50. package/dist/handsontable.full.js +3979 -5577
  51. package/dist/handsontable.full.min.css +3 -3
  52. package/dist/handsontable.full.min.js +66 -71
  53. package/dist/handsontable.js +3058 -4305
  54. package/dist/handsontable.min.css +2 -2
  55. package/dist/handsontable.min.js +35 -39
  56. package/editorManager.js +3 -4
  57. package/editorManager.mjs +3 -4
  58. package/editors/autocompleteEditor/autocompleteEditor.js +0 -2
  59. package/editors/autocompleteEditor/autocompleteEditor.mjs +0 -2
  60. package/editors/dateEditor/dateEditor.d.ts +1 -1
  61. package/editors/dateEditor/dateEditor.js +4 -1
  62. package/editors/dateEditor/dateEditor.mjs +4 -1
  63. package/editors/handsontableEditor/handsontableEditor.js +0 -1
  64. package/editors/handsontableEditor/handsontableEditor.mjs +0 -1
  65. package/editors/textEditor/textEditor.js +0 -4
  66. package/editors/textEditor/textEditor.mjs +0 -4
  67. package/helpers/browser.js +5 -2
  68. package/helpers/browser.mjs +5 -2
  69. package/helpers/feature.js +10 -0
  70. package/helpers/feature.mjs +9 -0
  71. package/helpers/mixed.js +1 -1
  72. package/helpers/mixed.mjs +1 -1
  73. package/package.json +3 -4
  74. package/pluginHooks.d.ts +6 -29
  75. package/pluginHooks.js +65 -123
  76. package/pluginHooks.mjs +62 -122
  77. package/plugins/copyPaste/clipboardData.js +18 -0
  78. package/plugins/copyPaste/clipboardData.mjs +14 -0
  79. package/plugins/copyPaste/copyPaste.js +129 -51
  80. package/plugins/copyPaste/copyPaste.mjs +132 -54
  81. package/plugins/copyPaste/copyableRanges.js +43 -7
  82. package/plugins/copyPaste/copyableRanges.mjs +42 -7
  83. package/plugins/copyPaste/pasteEvent.mjs +1 -1
  84. package/plugins/customBorders/customBorders.js +0 -5
  85. package/plugins/customBorders/customBorders.mjs +0 -5
  86. package/plugins/customBorders/utils.js +0 -1
  87. package/plugins/customBorders/utils.mjs +0 -1
  88. package/plugins/filters/ui/radioInput.js +1 -1
  89. package/plugins/filters/ui/radioInput.mjs +1 -1
  90. package/plugins/formulas/formulas.js +0 -2
  91. package/plugins/formulas/formulas.mjs +0 -2
  92. package/plugins/formulas/indexSyncer/axisSyncer.js +0 -1
  93. package/plugins/formulas/indexSyncer/axisSyncer.mjs +0 -1
  94. package/plugins/manualColumnResize/manualColumnResize.js +0 -1
  95. package/plugins/manualColumnResize/manualColumnResize.mjs +0 -1
  96. package/plugins/mergeCells/mergeCells.js +1 -127
  97. package/plugins/mergeCells/mergeCells.mjs +1 -127
  98. package/plugins/nestedHeaders/nestedHeaders.js +41 -87
  99. package/plugins/nestedHeaders/nestedHeaders.mjs +42 -88
  100. package/plugins/nestedHeaders/stateManager/headersTree.js +0 -1
  101. package/plugins/nestedHeaders/stateManager/headersTree.mjs +0 -1
  102. package/plugins/undoRedo/undoRedo.js +0 -2
  103. package/plugins/undoRedo/undoRedo.mjs +0 -2
  104. package/renderers/autocompleteRenderer/autocompleteRenderer.js +0 -1
  105. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +0 -1
  106. package/renderers/checkboxRenderer/checkboxRenderer.js +0 -2
  107. package/renderers/checkboxRenderer/checkboxRenderer.mjs +0 -2
  108. package/selection/highlight/highlight.js +0 -1
  109. package/selection/highlight/highlight.mjs +0 -1
  110. package/selection/index.js +1 -3
  111. package/selection/index.mjs +2 -2
  112. package/selection/utils.js +0 -34
  113. package/selection/utils.mjs +0 -33
  114. package/settings.d.ts +2 -1
  115. package/tableView.js +1 -2
  116. package/tableView.mjs +1 -2
  117. package/translations/indexMapper.js +2 -1
  118. package/utils/parseTable.js +84 -538
  119. package/utils/parseTable.mjs +83 -534
  120. package/validators/timeValidator/timeValidator.js +0 -1
  121. package/validators/timeValidator/timeValidator.mjs +0 -1
  122. package/plugins/copyPaste/clipboardData/clipboardData.js +0 -588
  123. package/plugins/copyPaste/clipboardData/clipboardData.mjs +0 -584
  124. package/plugins/copyPaste/clipboardData/copyClipboardData.js +0 -69
  125. package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +0 -65
  126. package/plugins/copyPaste/clipboardData/index.js +0 -9
  127. package/plugins/copyPaste/clipboardData/index.mjs +0 -4
  128. package/plugins/copyPaste/clipboardData/pasteClipboardData.js +0 -81
  129. package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +0 -77
@@ -509,7 +509,6 @@ class ManualColumnResize extends _base.BasePlugin {
509
509
  } else {
510
510
  this.setManualSize(column, _classPrivateFieldGet(this, _newSize)); // double click sets by auto row size plugin
511
511
  }
512
-
513
512
  this.saveManualColumnWidths();
514
513
  this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(this, _newSize), column, true);
515
514
  if (forceRender) {
@@ -504,7 +504,6 @@ export class ManualColumnResize extends BasePlugin {
504
504
  } else {
505
505
  this.setManualSize(column, _classPrivateFieldGet(this, _newSize)); // double click sets by auto row size plugin
506
506
  }
507
-
508
507
  this.saveManualColumnWidths();
509
508
  this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(this, _newSize), column, true);
510
509
  if (forceRender) {
@@ -17,7 +17,6 @@ var _number = require("../../helpers/number");
17
17
  var _utils = require("./utils");
18
18
  var _element = require("../../helpers/dom/element");
19
19
  var _browser = require("../../helpers/browser");
20
- var _mixed = require("../../helpers/mixed");
21
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
21
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
23
22
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
@@ -99,26 +98,9 @@ var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
99
98
  var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
100
99
  var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
101
100
  var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
102
- var _onBeforePaste = /*#__PURE__*/new WeakSet();
103
101
  class MergeCells extends _base.BasePlugin {
104
102
  constructor() {
105
103
  super(...arguments);
106
- /**
107
- * `beforePaste` hook callback. Used for manipulating with area of paste (by changing selection) and unmerging cells.
108
- *
109
- * @private
110
- * @param {object} clipboardData Information about copy action which is going to happen.
111
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
112
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
113
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
114
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
115
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
116
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
117
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
118
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
119
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
120
- */
121
- _classPrivateMethodInitSpec(this, _onBeforePaste);
122
104
  /**
123
105
  * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
124
106
  *
@@ -482,12 +464,6 @@ class MergeCells extends _base.BasePlugin {
482
464
  return false;
483
465
  }
484
466
  });
485
- this.addHook('beforePaste', function () {
486
- for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
487
- args[_key24] = arguments[_key24];
488
- }
489
- return _classPrivateMethodGet(_this, _onBeforePaste, _onBeforePaste2).call(_this, ...args);
490
- });
491
467
  this.registerShortcuts();
492
468
  super.enablePlugin();
493
469
  }
@@ -773,15 +749,13 @@ class MergeCells extends _base.BasePlugin {
773
749
  * @private
774
750
  * @param {CellRange} cellRange Selection cell range.
775
751
  * @param {boolean} [auto=false] `true` if called automatically by the plugin.
776
- * @param {boolean} [unmergePartials=false] If set to `true`, all the merged cells overlapping the range will be unmerged.
777
752
  *
778
753
  * @fires Hooks#beforeUnmergeCells
779
754
  * @fires Hooks#afterUnmergeCells
780
755
  */
781
756
  unmergeRange(cellRange) {
782
757
  let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
783
- let unmergePartials = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
784
- const mergedCells = this.mergedCellsCollection.getWithinRange(cellRange, unmergePartials);
758
+ const mergedCells = this.mergedCellsCollection.getWithinRange(cellRange);
785
759
  if (!mergedCells) {
786
760
  return;
787
761
  }
@@ -936,7 +910,6 @@ class MergeCells extends _base.BasePlugin {
936
910
  }
937
911
  }
938
912
  }
939
-
940
913
  /**
941
914
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
942
915
  *
@@ -1031,67 +1004,6 @@ class MergeCells extends _base.BasePlugin {
1031
1004
  const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
1032
1005
  return [renderableRow, renderableColumn];
1033
1006
  }
1034
- /**
1035
- * Creates cell range.
1036
- *
1037
- * @private
1038
- * @param {number} startRow Visual start row index for the range.
1039
- * @param {number} startColumn Visual start column index for the range.
1040
- * @param {number} numberOfRows Number of rows within the range.
1041
- * @param {number} numberOfColumns Number of columns within the range.
1042
- * @returns {CellRange}
1043
- */
1044
- getCellRange(startRow, startColumn, numberOfRows, numberOfColumns) {
1045
- const rangeStart = this.hot._createCellCoords(startRow, startColumn);
1046
- const rangeEnd = this.hot._createCellCoords(startRow + numberOfRows - 1, startColumn + numberOfColumns - 1);
1047
- return this.hot._createCellRange(rangeStart, rangeStart, rangeEnd);
1048
- }
1049
-
1050
- /**
1051
- * Adjusting selection to select complete area of previously merged cells.
1052
- *
1053
- * @private
1054
- * @param {Array|boolean} listOfUnmergedCells Array of found merged cells of `false` if none were found.
1055
- * @param {CellRange} unmergedRange Range for unmerged cells.
1056
- */
1057
- adjustSelectionAfterPasting(listOfUnmergedCells, unmergedRange) {
1058
- if (listOfUnmergedCells === false) {
1059
- return;
1060
- }
1061
- listOfUnmergedCells.forEach(mergedCell => {
1062
- const {
1063
- row,
1064
- col,
1065
- rowspan,
1066
- colspan
1067
- } = mergedCell;
1068
- const mergeRange = this.getCellRange(row, col, rowspan, colspan);
1069
- unmergedRange.expandByRange(mergeRange);
1070
- });
1071
- this.hot.addHookOnce('afterPaste', () => {
1072
- this.hot.selectCell(unmergedRange.from.row, unmergedRange.from.col, unmergedRange.to.row, unmergedRange.to.col);
1073
- });
1074
- }
1075
-
1076
- /**
1077
- * Checks if unmerge should be performed.
1078
- *
1079
- * @private
1080
- * @param {Array<object>} mergedCells List of merged cells.
1081
- * @param {number} pastedRows Number of pasted data rows.
1082
- * @param {number} pastedColumns Number of pasted data columns.
1083
- * @returns {boolean}
1084
- */
1085
- shouldUnmerge(mergedCells, pastedRows, pastedColumns) {
1086
- const isCopiedWithMergedCell = (0, _mixed.isDefined)(mergedCells);
1087
- const copiedOnlyMergedCell = isCopiedWithMergedCell && mergedCells.length === 1 && mergedCells[0].rowspan === pastedRows && mergedCells[0].colspan === pastedColumns;
1088
- const selectedRangeLast = this.hot.getSelectedRangeLast();
1089
- const pastingToMergedCell = this.mergedCellsCollection.getByRange(selectedRangeLast) !== false;
1090
- if (pastedRows === 1 && pastedColumns === 1 && pastingToMergedCell === true) {
1091
- return false;
1092
- }
1093
- return copiedOnlyMergedCell === false || pastingToMergedCell === false;
1094
- }
1095
1007
  }
1096
1008
  exports.MergeCells = MergeCells;
1097
1009
  function _onAfterInit2() {
@@ -1130,7 +1042,6 @@ function _onModifyTransformStart2(delta) {
1130
1042
  if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
1131
1043
  _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
1132
1044
  }
1133
-
1134
1045
  newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
1135
1046
  newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
1136
1047
  if (delta.row > 0) {
@@ -1379,41 +1290,4 @@ function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, l
1379
1290
  }
1380
1291
  function _onBeforeRemoveCellClassNames2() {
1381
1292
  return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1382
- }
1383
- function _onBeforePaste2(clipboardData) {
1384
- const selectedRangeLast = this.hot.getSelectedRangeLast();
1385
- const data = clipboardData.getData();
1386
- const pastedRows = data.length;
1387
- const pastedColumns = data[0].length;
1388
- const {
1389
- row: selectionFromRow,
1390
- col: selectionFromColumn
1391
- } = selectedRangeLast.from;
1392
- const selectedRows = selectedRangeLast.getHeight();
1393
- const selectedColumns = selectedRangeLast.getWidth();
1394
- if (this.shouldUnmerge(clipboardData.getMetaInfo().mergeCells, pastedRows, pastedColumns) === false) {
1395
- return;
1396
- }
1397
- const pasteRange = this.getCellRange(selectionFromRow, selectionFromColumn, pastedRows, pastedColumns);
1398
- const populationRange = this.getCellRange(selectionFromRow, selectionFromColumn, Math.max(pastedRows, selectedRows), Math.max(pastedColumns, selectedColumns));
1399
- let rangeToUnmerge = pasteRange;
1400
- const mergedCellsWithinPopulation = this.mergedCellsCollection.getWithinRange(populationRange, true);
1401
-
1402
- // Nothing to unmerge.
1403
- if (mergedCellsWithinPopulation.length === 0) {
1404
- return;
1405
- }
1406
- if (mergedCellsWithinPopulation.length === 1) {
1407
- rangeToUnmerge = populationRange;
1408
- }
1409
-
1410
- // Checking merged cells on unmerge range right before performing the unmerge.
1411
- const listOfUnmergedCells = this.mergedCellsCollection.getWithinRange(rangeToUnmerge, true);
1412
- this.unmergeRange(rangeToUnmerge, false, true);
1413
-
1414
- // Changing selection (place where the data is populated) only for greater range (at least two merged cells).
1415
- if (rangeToUnmerge === pasteRange) {
1416
- this.hot.selectCell(selectionFromRow, selectionFromColumn, pasteRange.endRow, pasteRange.endCol);
1417
- }
1418
- this.adjustSelectionAfterPasting(listOfUnmergedCells, rangeToUnmerge);
1419
1293
  }
@@ -26,7 +26,6 @@ import { rangeEach } from "../../helpers/number.mjs";
26
26
  import { applySpanProperties } from "./utils.mjs";
27
27
  import { getStyle } from "../../helpers/dom/element.mjs";
28
28
  import { isChrome } from "../../helpers/browser.mjs";
29
- import { isDefined } from "../../helpers/mixed.mjs";
30
29
  Hooks.getSingleton().register('beforeMergeCells');
31
30
  Hooks.getSingleton().register('afterMergeCells');
32
31
  Hooks.getSingleton().register('beforeUnmergeCells');
@@ -95,26 +94,9 @@ var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
95
94
  var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
96
95
  var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
97
96
  var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
98
- var _onBeforePaste = /*#__PURE__*/new WeakSet();
99
97
  export class MergeCells extends BasePlugin {
100
98
  constructor() {
101
99
  super(...arguments);
102
- /**
103
- * `beforePaste` hook callback. Used for manipulating with area of paste (by changing selection) and unmerging cells.
104
- *
105
- * @private
106
- * @param {object} clipboardData Information about copy action which is going to happen.
107
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
108
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
109
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
110
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
111
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
112
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
113
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
114
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
115
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
116
- */
117
- _classPrivateMethodInitSpec(this, _onBeforePaste);
118
100
  /**
119
101
  * `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
120
102
  *
@@ -478,12 +460,6 @@ export class MergeCells extends BasePlugin {
478
460
  return false;
479
461
  }
480
462
  });
481
- this.addHook('beforePaste', function () {
482
- for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
483
- args[_key24] = arguments[_key24];
484
- }
485
- return _classPrivateMethodGet(_this, _onBeforePaste, _onBeforePaste2).call(_this, ...args);
486
- });
487
463
  this.registerShortcuts();
488
464
  super.enablePlugin();
489
465
  }
@@ -769,15 +745,13 @@ export class MergeCells extends BasePlugin {
769
745
  * @private
770
746
  * @param {CellRange} cellRange Selection cell range.
771
747
  * @param {boolean} [auto=false] `true` if called automatically by the plugin.
772
- * @param {boolean} [unmergePartials=false] If set to `true`, all the merged cells overlapping the range will be unmerged.
773
748
  *
774
749
  * @fires Hooks#beforeUnmergeCells
775
750
  * @fires Hooks#afterUnmergeCells
776
751
  */
777
752
  unmergeRange(cellRange) {
778
753
  let auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
779
- let unmergePartials = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
780
- const mergedCells = this.mergedCellsCollection.getWithinRange(cellRange, unmergePartials);
754
+ const mergedCells = this.mergedCellsCollection.getWithinRange(cellRange);
781
755
  if (!mergedCells) {
782
756
  return;
783
757
  }
@@ -932,7 +906,6 @@ export class MergeCells extends BasePlugin {
932
906
  }
933
907
  }
934
908
  }
935
-
936
909
  /**
937
910
  * Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
938
911
  *
@@ -1027,67 +1000,6 @@ export class MergeCells extends BasePlugin {
1027
1000
  const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
1028
1001
  return [renderableRow, renderableColumn];
1029
1002
  }
1030
- /**
1031
- * Creates cell range.
1032
- *
1033
- * @private
1034
- * @param {number} startRow Visual start row index for the range.
1035
- * @param {number} startColumn Visual start column index for the range.
1036
- * @param {number} numberOfRows Number of rows within the range.
1037
- * @param {number} numberOfColumns Number of columns within the range.
1038
- * @returns {CellRange}
1039
- */
1040
- getCellRange(startRow, startColumn, numberOfRows, numberOfColumns) {
1041
- const rangeStart = this.hot._createCellCoords(startRow, startColumn);
1042
- const rangeEnd = this.hot._createCellCoords(startRow + numberOfRows - 1, startColumn + numberOfColumns - 1);
1043
- return this.hot._createCellRange(rangeStart, rangeStart, rangeEnd);
1044
- }
1045
-
1046
- /**
1047
- * Adjusting selection to select complete area of previously merged cells.
1048
- *
1049
- * @private
1050
- * @param {Array|boolean} listOfUnmergedCells Array of found merged cells of `false` if none were found.
1051
- * @param {CellRange} unmergedRange Range for unmerged cells.
1052
- */
1053
- adjustSelectionAfterPasting(listOfUnmergedCells, unmergedRange) {
1054
- if (listOfUnmergedCells === false) {
1055
- return;
1056
- }
1057
- listOfUnmergedCells.forEach(mergedCell => {
1058
- const {
1059
- row,
1060
- col,
1061
- rowspan,
1062
- colspan
1063
- } = mergedCell;
1064
- const mergeRange = this.getCellRange(row, col, rowspan, colspan);
1065
- unmergedRange.expandByRange(mergeRange);
1066
- });
1067
- this.hot.addHookOnce('afterPaste', () => {
1068
- this.hot.selectCell(unmergedRange.from.row, unmergedRange.from.col, unmergedRange.to.row, unmergedRange.to.col);
1069
- });
1070
- }
1071
-
1072
- /**
1073
- * Checks if unmerge should be performed.
1074
- *
1075
- * @private
1076
- * @param {Array<object>} mergedCells List of merged cells.
1077
- * @param {number} pastedRows Number of pasted data rows.
1078
- * @param {number} pastedColumns Number of pasted data columns.
1079
- * @returns {boolean}
1080
- */
1081
- shouldUnmerge(mergedCells, pastedRows, pastedColumns) {
1082
- const isCopiedWithMergedCell = isDefined(mergedCells);
1083
- const copiedOnlyMergedCell = isCopiedWithMergedCell && mergedCells.length === 1 && mergedCells[0].rowspan === pastedRows && mergedCells[0].colspan === pastedColumns;
1084
- const selectedRangeLast = this.hot.getSelectedRangeLast();
1085
- const pastingToMergedCell = this.mergedCellsCollection.getByRange(selectedRangeLast) !== false;
1086
- if (pastedRows === 1 && pastedColumns === 1 && pastingToMergedCell === true) {
1087
- return false;
1088
- }
1089
- return copiedOnlyMergedCell === false || pastingToMergedCell === false;
1090
- }
1091
1003
  }
1092
1004
  function _onAfterInit2() {
1093
1005
  this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
@@ -1125,7 +1037,6 @@ function _onModifyTransformStart2(delta) {
1125
1037
  if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
1126
1038
  _classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
1127
1039
  }
1128
-
1129
1040
  newDelta.row = _classPrivateFieldGet(this, _lastDesiredCoords).row ? _classPrivateFieldGet(this, _lastDesiredCoords).row - currentPosition.row : newDelta.row;
1130
1041
  newDelta.col = _classPrivateFieldGet(this, _lastDesiredCoords).col ? _classPrivateFieldGet(this, _lastDesiredCoords).col - currentPosition.col : newDelta.col;
1131
1042
  if (delta.row > 0) {
@@ -1374,41 +1285,4 @@ function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, l
1374
1285
  }
1375
1286
  function _onBeforeRemoveCellClassNames2() {
1376
1287
  return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
1377
- }
1378
- function _onBeforePaste2(clipboardData) {
1379
- const selectedRangeLast = this.hot.getSelectedRangeLast();
1380
- const data = clipboardData.getData();
1381
- const pastedRows = data.length;
1382
- const pastedColumns = data[0].length;
1383
- const {
1384
- row: selectionFromRow,
1385
- col: selectionFromColumn
1386
- } = selectedRangeLast.from;
1387
- const selectedRows = selectedRangeLast.getHeight();
1388
- const selectedColumns = selectedRangeLast.getWidth();
1389
- if (this.shouldUnmerge(clipboardData.getMetaInfo().mergeCells, pastedRows, pastedColumns) === false) {
1390
- return;
1391
- }
1392
- const pasteRange = this.getCellRange(selectionFromRow, selectionFromColumn, pastedRows, pastedColumns);
1393
- const populationRange = this.getCellRange(selectionFromRow, selectionFromColumn, Math.max(pastedRows, selectedRows), Math.max(pastedColumns, selectedColumns));
1394
- let rangeToUnmerge = pasteRange;
1395
- const mergedCellsWithinPopulation = this.mergedCellsCollection.getWithinRange(populationRange, true);
1396
-
1397
- // Nothing to unmerge.
1398
- if (mergedCellsWithinPopulation.length === 0) {
1399
- return;
1400
- }
1401
- if (mergedCellsWithinPopulation.length === 1) {
1402
- rangeToUnmerge = populationRange;
1403
- }
1404
-
1405
- // Checking merged cells on unmerge range right before performing the unmerge.
1406
- const listOfUnmergedCells = this.mergedCellsCollection.getWithinRange(rangeToUnmerge, true);
1407
- this.unmergeRange(rangeToUnmerge, false, true);
1408
-
1409
- // Changing selection (place where the data is populated) only for greater range (at least two merged cells).
1410
- if (rangeToUnmerge === pasteRange) {
1411
- this.hot.selectCell(selectionFromRow, selectionFromColumn, pasteRange.endRow, pasteRange.endCol);
1412
- }
1413
- this.adjustSelectionAfterPasting(listOfUnmergedCells, rangeToUnmerge);
1414
1288
  }
@@ -12,7 +12,6 @@ var _selection = require("../../selection");
12
12
  var _base = require("../base");
13
13
  var _stateManager2 = _interopRequireDefault(require("./stateManager"));
14
14
  var _ghostTable = _interopRequireDefault(require("./utils/ghostTable"));
15
- var _array = require("../../helpers/array");
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
18
17
  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; }
@@ -102,7 +101,6 @@ class NestedHeaders extends _base.BasePlugin {
102
101
  /**
103
102
  * Updates the plugin state after new dataset load.
104
103
  *
105
- * @private
106
104
  * @param {Array[]} sourceData Array of arrays or array of objects containing data.
107
105
  * @param {boolean} initialLoad Flag that determines whether the data has been loaded
108
106
  * during the initialization.
@@ -110,14 +108,11 @@ class NestedHeaders extends _base.BasePlugin {
110
108
  _classPrivateMethodInitSpec(this, _onAfterLoadData);
111
109
  /**
112
110
  * Updates the plugin state after HoT initialization.
113
- *
114
- * @private
115
111
  */
116
112
  _classPrivateMethodInitSpec(this, _onInit);
117
113
  /**
118
114
  * `modifyFocusedElement` hook callback.
119
115
  *
120
- * @private
121
116
  * @param {number} row Row index.
122
117
  * @param {number} column Column index.
123
118
  * @returns {HTMLTableCellElement} The `TH` element to be focused.
@@ -127,7 +122,6 @@ class NestedHeaders extends _base.BasePlugin {
127
122
  * Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
128
123
  * the internal state and settings of the plugin.
129
124
  *
130
- * @private
131
125
  * @param {string} value The column header value.
132
126
  * @param {number} visualColumnIndex The visual column index.
133
127
  * @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
@@ -140,7 +134,6 @@ class NestedHeaders extends _base.BasePlugin {
140
134
  /**
141
135
  * `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.
142
136
  *
143
- * @private
144
137
  * @param {number} width Width from hook.
145
138
  * @param {number} column Visual index of an column.
146
139
  * @returns {number}
@@ -149,14 +142,12 @@ class NestedHeaders extends _base.BasePlugin {
149
142
  /**
150
143
  * Make the renderer render the first nested column in its entirety.
151
144
  *
152
- * @private
153
145
  * @param {object} calc Viewport column calculator.
154
146
  */
155
147
  _classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
156
148
  /**
157
149
  * `afterGetColumnHeader` hook callback - prepares the header structure.
158
150
  *
159
- * @private
160
151
  * @param {Array} renderersArray Array of renderers.
161
152
  */
162
153
  _classPrivateMethodInitSpec(this, _onAfterGetColumnHeaderRenderers);
@@ -164,7 +155,6 @@ class NestedHeaders extends _base.BasePlugin {
164
155
  * The hook observes the column selection from the Selection API and modifies the column range to
165
156
  * ensure that the whole nested column will be covered.
166
157
  *
167
- * @private
168
158
  * @param {CellCoords} from The coords object where the selection starts.
169
159
  * @param {CellCoords} to The coords object where the selection ends.
170
160
  */
@@ -172,27 +162,21 @@ class NestedHeaders extends _base.BasePlugin {
172
162
  /**
173
163
  * `modifyTransformStart` hook is called every time the keyboard navigation is used.
174
164
  *
175
- * @private
176
165
  * @param {object} delta The transformation delta.
177
166
  */
178
167
  _classPrivateMethodInitSpec(this, _onModifyTransformStart);
179
168
  /**
180
169
  * The hook checks and ensures that the focus position that depends on the selected columns
181
170
  * range is always positioned within the range.
182
- *
183
- * @private
184
171
  */
185
172
  _classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
186
173
  /**
187
174
  * Switches internal flag about selection progress to `false`.
188
- *
189
- * @private
190
175
  */
191
176
  _classPrivateMethodInitSpec(this, _onBeforeOnCellMouseUp);
192
177
  /**
193
178
  * Makes the header-selection properly select the nested headers.
194
179
  *
195
- * @private
196
180
  * @param {MouseEvent} event Mouse event.
197
181
  * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
198
182
  * @param {HTMLElement} TD The cell element.
@@ -203,7 +187,6 @@ class NestedHeaders extends _base.BasePlugin {
203
187
  /**
204
188
  * Allows to control how the column selection based on the coordinates and the nested headers is made.
205
189
  *
206
- * @private
207
190
  * @param {MouseEvent} event Mouse event.
208
191
  * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
209
192
  */
@@ -211,7 +194,6 @@ class NestedHeaders extends _base.BasePlugin {
211
194
  /**
212
195
  * Allows blocking the column selection that is controlled by the core Selection module.
213
196
  *
214
- * @private
215
197
  * @param {MouseEvent} event Mouse event.
216
198
  * @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
217
199
  * @param {CellCoords} TD The table cell or header element.
@@ -225,23 +207,16 @@ class NestedHeaders extends _base.BasePlugin {
225
207
  * of the column.
226
208
  *
227
209
  * @private
228
- * @param {object} clipboardData Information about already performed copy action.
229
- * @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
230
- * @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
231
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
232
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
233
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
234
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
235
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
236
- * @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
237
- * @param {Function} clipboardData.setMetaInfo Sets grid settings for copied data.
238
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
210
+ * @param {Array[]} data An array of arrays which contains data to copied.
211
+ * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
212
+ * which will copied.
213
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
214
+ * the number of copied headers.
239
215
  */
240
216
  _classPrivateMethodInitSpec(this, _onBeforeCopy);
241
217
  /**
242
218
  * Allows to control which header DOM element will be used to highlight.
243
219
  *
244
- * @private
245
220
  * @param {number} visualColumn A visual column index of the highlighted row header.
246
221
  * @param {number} headerLevel A row header level that is currently highlighted.
247
222
  * @param {object} highlightMeta An object with meta data that describes the highlight state.
@@ -253,7 +228,6 @@ class NestedHeaders extends _base.BasePlugin {
253
228
  * is scrolled to the correct column for the nested header the most left and the most right visual column
254
229
  * indexes are used.
255
230
  *
256
- * @private
257
231
  * @param {number} visualColumn A visual column index to which the viewport will be scrolled.
258
232
  * @returns {number}
259
233
  */
@@ -261,8 +235,6 @@ class NestedHeaders extends _base.BasePlugin {
261
235
  /**
262
236
  * Updates the selection focus highlight position to point to the nested header root element (TH)
263
237
  * even when the logical coordinates point in-between the header.
264
- *
265
- * @private
266
238
  */
267
239
  _classPrivateMethodInitSpec(this, _updateFocusHighlightPosition);
268
240
  /**
@@ -754,60 +726,42 @@ function _onBeforeHighlightingColumnHeader2(visualColumn, headerLevel, highlight
754
726
  }
755
727
  return visualColumn;
756
728
  }
757
- function _onBeforeCopy2(clipboardData) {
758
- const {
759
- rows,
760
- columns
761
- } = (0, _selection.transformRangeLikeToIndexes)(clipboardData.getRanges());
762
- const headers = rows.filter(row => row < 0);
763
- const nestedHeaders = [];
764
- headers.forEach(header => {
765
- const headersForLevel = [];
766
- (0, _array.arrayEach)(columns, (column, index) => {
767
- const headerSettings = this.getHeaderSettings(header, column);
768
- if (headerSettings === null) {
769
- headersForLevel.push(this.hot.getColHeader(column, header));
770
- return;
771
- }
772
- const {
773
- isPlaceholder
774
- } = headerSettings;
775
- const columnsToEnd = columns.slice(index).length;
776
- const headerTreeNodeData = this.getStateManager().getHeaderTreeNodeData(header, column);
777
- if (index === 0 && isPlaceholder === true) {
778
- const {
779
- label,
780
- origColspan: colspan,
781
- columnIndex
782
- } = headerTreeNodeData;
783
- const columnFromStart = column - columnIndex;
784
- const reducedColspan = Math.min(colspan - columnFromStart, columnsToEnd);
785
- if (reducedColspan > 1) {
786
- headersForLevel.push({
787
- label,
788
- colspan: reducedColspan
789
- });
790
- } else {
791
- headersForLevel.push(label);
729
+ function _onBeforeCopy2(data, copyableRanges, _ref2) {
730
+ let {
731
+ columnHeadersCount
732
+ } = _ref2;
733
+ if (columnHeadersCount === 0) {
734
+ return;
735
+ }
736
+ for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
737
+ const {
738
+ startRow,
739
+ startCol,
740
+ endRow,
741
+ endCol
742
+ } = copyableRanges[rangeIndex];
743
+ const rowsCount = endRow - startRow + 1;
744
+ const columnsCount = startCol - endCol + 1;
745
+
746
+ // do not process dataset ranges and column headers where only one column is copied
747
+ if (startRow >= 0 || columnsCount === 1) {
748
+ break;
749
+ }
750
+ for (let column = startCol; column <= endCol; column++) {
751
+ for (let row = startRow; row <= endRow; row++) {
752
+ var _classPrivateFieldGet4;
753
+ const zeroBasedColumnHeaderLevel = rowsCount + row;
754
+ const zeroBasedColumnIndex = column - startCol;
755
+ if (zeroBasedColumnIndex === 0) {
756
+ continue; // eslint-disable-line no-continue
757
+ }
758
+ const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
759
+ if (isRoot === false) {
760
+ data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
792
761
  }
793
- } else if (isPlaceholder === false) {
794
- const {
795
- label,
796
- origColspan: colspan,
797
- columnIndex
798
- } = headerTreeNodeData;
799
- const columnFromStart = column - columnIndex;
800
- const reducedColspan = Math.min(colspan - columnFromStart, columnsToEnd);
801
- headersForLevel.push(reducedColspan > 1 ? {
802
- label,
803
- colspan: reducedColspan
804
- } : label);
805
762
  }
806
- });
807
- nestedHeaders.push(headersForLevel);
808
- });
809
- clipboardData.setMetaInfo('colHeaders', null);
810
- clipboardData.setMetaInfo('nestedHeaders', nestedHeaders);
763
+ }
764
+ }
811
765
  }
812
766
  function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
813
767
  const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
@@ -1010,10 +964,10 @@ function _onModifyColWidth2(width, column) {
1010
964
  return width > cachedWidth ? width : cachedWidth;
1011
965
  }
1012
966
  function _onModifyColumnHeaderValue2(value, visualColumnIndex, headerLevel) {
1013
- var _classPrivateFieldGet4;
967
+ var _classPrivateFieldGet5;
1014
968
  const {
1015
969
  label
1016
- } = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet4 !== void 0 ? _classPrivateFieldGet4 : {
970
+ } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
1017
971
  label: ''
1018
972
  };
1019
973
  return label;