handsontable 0.0.0-next-50e428d-20231026 → 0.0.0-next-e54c3d6-20231026

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (34) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/dist/handsontable.css +2 -2
  4. package/dist/handsontable.full.css +2 -2
  5. package/dist/handsontable.full.js +3351 -2061
  6. package/dist/handsontable.full.min.css +2 -2
  7. package/dist/handsontable.full.min.js +88 -81
  8. package/dist/handsontable.js +3353 -2063
  9. package/dist/handsontable.min.css +2 -2
  10. package/dist/handsontable.min.js +24 -17
  11. package/helpers/mixed.js +1 -1
  12. package/helpers/mixed.mjs +1 -1
  13. package/package.json +1 -1
  14. package/pluginHooks.d.ts +28 -6
  15. package/pluginHooks.js +116 -62
  16. package/pluginHooks.mjs +116 -62
  17. package/plugins/copyPaste/clipboardData/clipboardData.js +517 -0
  18. package/plugins/copyPaste/clipboardData/clipboardData.mjs +512 -0
  19. package/plugins/copyPaste/clipboardData/copyClipboardData.js +69 -0
  20. package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +65 -0
  21. package/plugins/copyPaste/clipboardData/index.js +9 -0
  22. package/plugins/copyPaste/clipboardData/index.mjs +4 -0
  23. package/plugins/copyPaste/clipboardData/pasteClipboardData.js +81 -0
  24. package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +77 -0
  25. package/plugins/copyPaste/copyPaste.js +38 -92
  26. package/plugins/copyPaste/copyPaste.mjs +40 -94
  27. package/plugins/nestedHeaders/nestedHeaders.js +21 -22
  28. package/plugins/nestedHeaders/nestedHeaders.mjs +21 -22
  29. package/utils/parseTable.js +527 -83
  30. package/utils/parseTable.mjs +523 -82
  31. package/plugins/copyPaste/clipboardData.js +0 -18
  32. package/plugins/copyPaste/clipboardData.mjs +0 -14
  33. package/plugins/copyPaste/pasteEvent.js +0 -14
  34. package/plugins/copyPaste/pasteEvent.mjs +0 -9
@@ -531,45 +531,44 @@ class NestedHeaders extends _base.BasePlugin {
531
531
  * of the column.
532
532
  *
533
533
  * @private
534
- * @param {Array[]} data An array of arrays which contains data to copied.
535
- * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
536
- * which will copied.
537
- * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
538
- * the number of copied headers.
534
+ * @param {object} clipboardData Information about already performed copy action.
535
+ * @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
536
+ * @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
537
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
538
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
539
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
540
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
541
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
542
+ * @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
543
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
539
544
  */
540
- onBeforeCopy(data, copyableRanges, _ref2) {
541
- let {
542
- columnHeadersCount
543
- } = _ref2;
544
- if (columnHeadersCount === 0) {
545
- return;
546
- }
547
- for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
545
+ onBeforeCopy(clipboardData) {
546
+ const copyableRanges = clipboardData.getRanges();
547
+ for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex += 1) {
548
548
  const {
549
549
  startRow,
550
550
  startCol,
551
551
  endRow,
552
552
  endCol
553
553
  } = copyableRanges[rangeIndex];
554
- const rowsCount = endRow - startRow + 1;
555
554
  const columnsCount = startCol - endCol + 1;
556
555
 
557
556
  // do not process dataset ranges and column headers where only one column is copied
558
557
  if (startRow >= 0 || columnsCount === 1) {
559
558
  break;
560
559
  }
561
- for (let column = startCol; column <= endCol; column++) {
562
- for (let row = startRow; row <= endRow; row++) {
563
- var _classPrivateFieldGet4;
564
- const zeroBasedColumnHeaderLevel = rowsCount + row;
560
+ for (let column = startCol; column <= endCol; column += 1) {
561
+ for (let row = startRow; row <= endRow; row += 1) {
562
+ var _classPrivateFieldGet4, _classPrivateFieldGet5;
565
563
  const zeroBasedColumnIndex = column - startCol;
566
564
  if (zeroBasedColumnIndex === 0) {
567
565
  continue; // eslint-disable-line no-continue
568
566
  }
569
567
 
570
568
  const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
571
- if (isRoot === false) {
572
- data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
569
+ const collapsible = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.collapsible;
570
+ if (collapsible === true && isRoot === false) {
571
+ clipboardData.setCellAt(row, zeroBasedColumnIndex, '');
573
572
  }
574
573
  }
575
574
  }
@@ -872,10 +871,10 @@ class NestedHeaders extends _base.BasePlugin {
872
871
  * @returns {string} Returns the column header value to update.
873
872
  */
874
873
  onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
875
- var _classPrivateFieldGet5;
874
+ var _classPrivateFieldGet6;
876
875
  const {
877
876
  label
878
- } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
877
+ } = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
879
878
  label: ''
880
879
  };
881
880
  return label;
@@ -525,45 +525,44 @@ export class NestedHeaders extends BasePlugin {
525
525
  * of the column.
526
526
  *
527
527
  * @private
528
- * @param {Array[]} data An array of arrays which contains data to copied.
529
- * @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
530
- * which will copied.
531
- * @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
532
- * the number of copied headers.
528
+ * @param {object} clipboardData Information about already performed copy action.
529
+ * @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
530
+ * @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
531
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
532
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
533
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
534
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
535
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
536
+ * @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
537
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
533
538
  */
534
- onBeforeCopy(data, copyableRanges, _ref2) {
535
- let {
536
- columnHeadersCount
537
- } = _ref2;
538
- if (columnHeadersCount === 0) {
539
- return;
540
- }
541
- for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
539
+ onBeforeCopy(clipboardData) {
540
+ const copyableRanges = clipboardData.getRanges();
541
+ for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex += 1) {
542
542
  const {
543
543
  startRow,
544
544
  startCol,
545
545
  endRow,
546
546
  endCol
547
547
  } = copyableRanges[rangeIndex];
548
- const rowsCount = endRow - startRow + 1;
549
548
  const columnsCount = startCol - endCol + 1;
550
549
 
551
550
  // do not process dataset ranges and column headers where only one column is copied
552
551
  if (startRow >= 0 || columnsCount === 1) {
553
552
  break;
554
553
  }
555
- for (let column = startCol; column <= endCol; column++) {
556
- for (let row = startRow; row <= endRow; row++) {
557
- var _classPrivateFieldGet4;
558
- const zeroBasedColumnHeaderLevel = rowsCount + row;
554
+ for (let column = startCol; column <= endCol; column += 1) {
555
+ for (let row = startRow; row <= endRow; row += 1) {
556
+ var _classPrivateFieldGet4, _classPrivateFieldGet5;
559
557
  const zeroBasedColumnIndex = column - startCol;
560
558
  if (zeroBasedColumnIndex === 0) {
561
559
  continue; // eslint-disable-line no-continue
562
560
  }
563
561
 
564
562
  const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
565
- if (isRoot === false) {
566
- data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
563
+ const collapsible = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.collapsible;
564
+ if (collapsible === true && isRoot === false) {
565
+ clipboardData.setCellAt(row, zeroBasedColumnIndex, '');
567
566
  }
568
567
  }
569
568
  }
@@ -866,10 +865,10 @@ export class NestedHeaders extends BasePlugin {
866
865
  * @returns {string} Returns the column header value to update.
867
866
  */
868
867
  onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
869
- var _classPrivateFieldGet5;
868
+ var _classPrivateFieldGet6;
870
869
  const {
871
870
  label
872
- } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
871
+ } = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
873
872
  label: ''
874
873
  };
875
874
  return label;