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
package/pluginHooks.mjs CHANGED
@@ -1503,26 +1503,35 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1503
1503
  * Fired by {@link CopyPaste} plugin before copying the values to the clipboard and before clearing values of
1504
1504
  * the selected cells. This hook is fired when {@link Options#copyPaste} option is enabled.
1505
1505
  *
1506
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1507
+ *
1506
1508
  * @event Hooks#beforeCut
1507
- * @param {Array[]} data An array of arrays which contains data to cut.
1508
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1509
- * which will be cut out.
1509
+ * @param {object} clipboardData Information about cut action which is going to happen.
1510
+ * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1511
+ * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1512
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1513
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1514
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1515
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1516
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1517
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1518
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1510
1519
  * @returns {*} If returns `false` then operation of the cutting out is canceled.
1511
1520
  * @example
1512
1521
  * ::: only-for javascript
1513
1522
  * ```js
1514
- * // To disregard a single row, remove it from the array using data.splice(i, 1).
1523
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1515
1524
  * new Handsontable(element, {
1516
- * beforeCut: function(data, coords) {
1517
- * // data -> [[1, 2, 3], [4, 5, 6]]
1518
- * data.splice(0, 1);
1519
- * // data -> [[4, 5, 6]]
1520
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1525
+ * beforeCut: function(clipboardData) {
1526
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1527
+ * clipboardData.removeRows([0]);
1528
+ * clipboardData.removeColumns([0]);
1529
+ * // clipboardData.getData() -> [[5, 6]]
1521
1530
  * }
1522
1531
  * });
1523
1532
  * // To cancel a cutting action, just return `false`.
1524
1533
  * new Handsontable(element, {
1525
- * beforeCut: function(data, coords) {
1534
+ * beforeCut: function(clipboardData) {
1526
1535
  * return false;
1527
1536
  * }
1528
1537
  * });
@@ -1531,18 +1540,18 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1531
1540
  *
1532
1541
  * ::: only-for react
1533
1542
  * ```jsx
1534
- * // To disregard a single row, remove it from the array using data.splice(i, 1).
1543
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1535
1544
  * <HotTable
1536
- * beforeCut={(data, coords) => {
1537
- * // data -> [[1, 2, 3], [4, 5, 6]]
1538
- * data.splice(0, 1);
1539
- * // data -> [[4, 5, 6]]
1540
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1545
+ * beforeCut={(clipboardData) => {
1546
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1547
+ * clipboardData.removeRows([0]);
1548
+ * clipboardData.removeColumns([0]);
1549
+ * // clipboardData.getData() -> [[5, 6]]
1541
1550
  * }}
1542
1551
  * />
1543
1552
  * // To cancel a cutting action, just return `false`.
1544
1553
  * <HotTable
1545
- * beforeCut={(data, coords) => {
1554
+ * beforeCut={(clipboardData) => {
1546
1555
  * return false;
1547
1556
  * }}
1548
1557
  * />
@@ -1554,33 +1563,50 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1554
1563
  * Fired by {@link CopyPaste} plugin after data was cut out from the table. This hook is fired when
1555
1564
  * {@link Options#copyPaste} option is enabled.
1556
1565
  *
1566
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1567
+ *
1557
1568
  * @event Hooks#afterCut
1558
- * @param {Array[]} data An array of arrays with the cut data.
1559
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1560
- * which was cut out.
1569
+ * @param {object} clipboardData Information about already performed cut action.
1570
+ * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1571
+ * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1572
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1573
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1574
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1575
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1576
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1577
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1578
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1561
1579
  */
1562
1580
  'afterCut',
1563
1581
  /**
1564
1582
  * Fired before values are copied to the clipboard.
1565
1583
  *
1584
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1585
+ *
1566
1586
  * @event Hooks#beforeCopy
1567
- * @param {Array[]} data An array of arrays which contains data to copied.
1568
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1569
- * which will copied.
1570
- * @param {{ columnHeadersCount: number }} copiedHeadersCount (Since 12.3.0) The number of copied column headers.
1587
+ * @param {object} clipboardData Information about copy action which is going to happen.
1588
+ * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1589
+ * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1590
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1591
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1592
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1593
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1594
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1595
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1596
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1571
1597
  * @returns {*} If returns `false` then copying is canceled.
1572
1598
  *
1573
1599
  * @example
1574
1600
  * ::: only-for javascript
1575
1601
  * ```js
1576
- * // To disregard a single row, remove it from array using data.splice(i, 1).
1602
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1577
1603
  * ...
1578
1604
  * new Handsontable(document.getElementById('example'), {
1579
- * beforeCopy: (data, coords) => {
1580
- * // data -> [[1, 2, 3], [4, 5, 6]]
1581
- * data.splice(0, 1);
1582
- * // data -> [[4, 5, 6]]
1583
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1605
+ * beforeCopy: (clipboardData) => {
1606
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1607
+ * clipboardData.removeRows([0]);
1608
+ * clipboardData.removeColumns([0]);
1609
+ * // clipboardData.getData() -> [[5, 6]]
1584
1610
  * }
1585
1611
  * });
1586
1612
  * ...
@@ -1588,7 +1614,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1588
1614
  * // To cancel copying, return false from the callback.
1589
1615
  * ...
1590
1616
  * new Handsontable(document.getElementById('example'), {
1591
- * beforeCopy: (data, coords) => {
1617
+ * beforeCopy: (clipboardData) => {
1592
1618
  * return false;
1593
1619
  * }
1594
1620
  * });
@@ -1598,14 +1624,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1598
1624
  *
1599
1625
  * ::: only-for react
1600
1626
  * ```jsx
1601
- * // To disregard a single row, remove it from array using data.splice(i, 1).
1627
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1602
1628
  * ...
1603
1629
  * <HotTable
1604
- * beforeCopy={(data, coords) => {
1605
- * // data -> [[1, 2, 3], [4, 5, 6]]
1606
- * data.splice(0, 1);
1607
- * // data -> [[4, 5, 6]]
1608
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1630
+ * beforeCopy={(clipboardData) => {
1631
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1632
+ * clipboardData.removeRows([0]);
1633
+ * clipboardData.removeColumns([0]);
1634
+ * // clipboardData.getData() -> [[5, 6]]
1609
1635
  * }}
1610
1636
  * />
1611
1637
  * ...
@@ -1613,7 +1639,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1613
1639
  * // To cancel copying, return false from the callback.
1614
1640
  * ...
1615
1641
  * <HotTable
1616
- * beforeCopy={(data, coords) => {
1642
+ * beforeCopy={(clipboardData) => {
1617
1643
  * return false;
1618
1644
  * }}
1619
1645
  * />
@@ -1626,37 +1652,55 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1626
1652
  * Fired by {@link CopyPaste} plugin after data are pasted into table. This hook is fired when {@link Options#copyPaste}
1627
1653
  * option is enabled.
1628
1654
  *
1655
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1656
+ *
1629
1657
  * @event Hooks#afterCopy
1630
- * @param {Array[]} data An array of arrays which contains the copied data.
1631
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1632
- * which was copied.
1633
- * @param {{ columnHeadersCount: number }} copiedHeadersCount (Since 12.3.0) The number of copied column headers.
1658
+ * @param {object} clipboardData Information about already performed copy action.
1659
+ * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1660
+ * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1661
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1662
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1663
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1664
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1665
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1666
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1667
+ * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1634
1668
  */
1635
1669
  'afterCopy',
1636
1670
  /**
1637
1671
  * Fired by {@link CopyPaste} plugin before values are pasted into table. This hook is fired when
1638
1672
  * {@link Options#copyPaste} option is enabled.
1639
1673
  *
1674
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1675
+ *
1640
1676
  * @event Hooks#beforePaste
1641
- * @param {Array[]} data An array of arrays which contains data to paste.
1642
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1643
- * that correspond to the previously selected area.
1677
+ * @param {object} clipboardData Information about paste action which is going to happen.
1678
+ * @param {Function} clipboardData.removeRow Remove row from the pasted dataset.
1679
+ * @param {Function} clipboardData.removeColumn Remove column from the pasted dataset.
1680
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1681
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1682
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the pasted dataset.
1683
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the pasted dataset.
1684
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1685
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1686
+ * @param {Function} clipboardData.getSource Gets information about source of the copied data
1687
+ * (Handsontable, table or string).
1644
1688
  * @returns {*} If returns `false` then pasting is canceled.
1645
1689
  * @example
1646
1690
  * ```js
1647
1691
  * ::: only-for javascript
1648
- * // To disregard a single row, remove it from array using data.splice(i, 1).
1692
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1649
1693
  * new Handsontable(example, {
1650
- * beforePaste: (data, coords) => {
1651
- * // data -> [[1, 2, 3], [4, 5, 6]]
1652
- * data.splice(0, 1);
1653
- * // data -> [[4, 5, 6]]
1654
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1694
+ * beforePaste: (clipboardData) => {
1695
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1696
+ * clipboardData.removeRows([0]);
1697
+ * clipboardData.removeColumns([0]);
1698
+ * // clipboardData.getData() -> [[5, 6]]
1655
1699
  * }
1656
1700
  * });
1657
1701
  * // To cancel pasting, return false from the callback.
1658
1702
  * new Handsontable(example, {
1659
- * beforePaste: (data, coords) => {
1703
+ * beforePaste: (clipboardData) => {
1660
1704
  * return false;
1661
1705
  * }
1662
1706
  * });
@@ -1665,18 +1709,18 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1665
1709
  *
1666
1710
  * ::: only-for react
1667
1711
  * ```jsx
1668
- * // To disregard a single row, remove it from array using data.splice(i, 1).
1712
+ * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1669
1713
  * <HotTable
1670
- * beforePaste={(data, coords) => {
1671
- * // data -> [[1, 2, 3], [4, 5, 6]]
1672
- * data.splice(0, 1);
1673
- * // data -> [[4, 5, 6]]
1674
- * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1714
+ * beforePaste={(clipboardData) => {
1715
+ * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1716
+ * clipboardData.removeRows([0]);
1717
+ * clipboardData.removeColumns([0]);
1718
+ * // clipboardData.getData() -> [[5, 6]]
1675
1719
  * }}
1676
1720
  * />
1677
1721
  * // To cancel pasting, return false from the callback.
1678
1722
  * <HotTable
1679
- * beforePaste={(data, coords) => {
1723
+ * beforePaste={(clipboardData) => {
1680
1724
  * return false;
1681
1725
  * }}
1682
1726
  * />
@@ -1688,10 +1732,20 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1688
1732
  * Fired by {@link CopyPaste} plugin after values are pasted into table. This hook is fired when
1689
1733
  * {@link Options#copyPaste} option is enabled.
1690
1734
  *
1735
+ * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1736
+ *
1691
1737
  * @event Hooks#afterPaste
1692
- * @param {Array[]} data An array of arrays with the pasted data.
1693
- * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1694
- * that correspond to the previously selected area.
1738
+ * @param {object} clipboardData Information about already performed paste action.
1739
+ * @param {Function} clipboardData.removeRow Remove row from the pasted dataset.
1740
+ * @param {Function} clipboardData.removeColumn Remove column from the pasted dataset.
1741
+ * @param {Function} clipboardData.insertAtRow Insert values at row index.
1742
+ * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1743
+ * @param {Function} clipboardData.setCellAt Change headers or cells in the pasted dataset.
1744
+ * @param {Function} clipboardData.getCellAt Get headers or cells from the pasted dataset.
1745
+ * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1746
+ * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1747
+ * @param {Function} clipboardData.getSource Gets information about source of the copied data
1748
+ * (Handsontable, table or string).
1695
1749
  */
1696
1750
  'afterPaste',
1697
1751
  /**