handsontable 14.0.0-next-c22ab6f-20231030 → 14.0.0-next-f88c253-20231106

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/dist/handsontable.css +8 -2
  4. package/dist/handsontable.full.css +8 -2
  5. package/dist/handsontable.full.js +2084 -3359
  6. package/dist/handsontable.full.min.css +3 -3
  7. package/dist/handsontable.full.min.js +59 -66
  8. package/dist/handsontable.js +2086 -3361
  9. package/dist/handsontable.min.css +3 -3
  10. package/dist/handsontable.min.js +16 -23
  11. package/helpers/mixed.js +2 -2
  12. package/helpers/mixed.mjs +2 -2
  13. package/package.json +1 -1
  14. package/pluginHooks.d.ts +6 -28
  15. package/pluginHooks.js +63 -117
  16. package/pluginHooks.mjs +63 -117
  17. package/plugins/copyPaste/clipboardData.js +18 -0
  18. package/plugins/copyPaste/clipboardData.mjs +14 -0
  19. package/plugins/copyPaste/copyPaste.js +92 -38
  20. package/plugins/copyPaste/copyPaste.mjs +94 -40
  21. package/plugins/copyPaste/pasteEvent.js +14 -0
  22. package/plugins/copyPaste/pasteEvent.mjs +9 -0
  23. package/plugins/mergeCells/mergeCells.js +14 -0
  24. package/plugins/mergeCells/mergeCells.mjs +14 -0
  25. package/plugins/nestedHeaders/nestedHeaders.js +22 -21
  26. package/plugins/nestedHeaders/nestedHeaders.mjs +22 -21
  27. package/utils/parseTable.js +83 -527
  28. package/utils/parseTable.mjs +82 -523
  29. package/plugins/copyPaste/clipboardData/clipboardData.js +0 -516
  30. package/plugins/copyPaste/clipboardData/clipboardData.mjs +0 -512
  31. package/plugins/copyPaste/clipboardData/copyClipboardData.js +0 -69
  32. package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +0 -65
  33. package/plugins/copyPaste/clipboardData/index.js +0 -9
  34. package/plugins/copyPaste/clipboardData/index.mjs +0 -4
  35. package/plugins/copyPaste/clipboardData/pasteClipboardData.js +0 -81
  36. package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +0 -77
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "14.0.0-next-c22ab6f-20231030";
137
+ const hotVersion = "14.0.0-next-f88c253-20231106";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
@@ -142,7 +142,7 @@ function _injectProductInfo(key, element) {
142
142
  const schemaValidity = _checkKeySchema(key);
143
143
  if (hasValidType || isNonCommercial || schemaValidity) {
144
144
  if (schemaValidity) {
145
- const releaseDate = (0, _moment.default)("08/11/2023", 'DD/MM/YYYY');
145
+ const releaseDate = (0, _moment.default)("15/11/2023", 'DD/MM/YYYY');
146
146
  const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
147
147
  const keyValidityDays = _extractTime(key);
148
148
  keyValidityDate = (0, _moment.default)((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "14.0.0-next-c22ab6f-20231030";
127
+ const hotVersion = "14.0.0-next-f88c253-20231106";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
@@ -132,7 +132,7 @@ export function _injectProductInfo(key, element) {
132
132
  const schemaValidity = _checkKeySchema(key);
133
133
  if (hasValidType || isNonCommercial || schemaValidity) {
134
134
  if (schemaValidity) {
135
- const releaseDate = moment("08/11/2023", 'DD/MM/YYYY');
135
+ const releaseDate = moment("15/11/2023", 'DD/MM/YYYY');
136
136
  const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
137
137
  const keyValidityDays = _extractTime(key);
138
138
  keyValidityDate = moment((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "14.0.0-next-c22ab6f-20231030",
13
+ "version": "14.0.0-next-f88c253-20231106",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.d.ts CHANGED
@@ -49,7 +49,6 @@ interface HookHighlightRowHeaderMeta {
49
49
  selectionHeight: number;
50
50
  classNames: string[];
51
51
  }
52
-
53
52
  interface HookHighlightColumnHeaderMeta {
54
53
  selectionType: string;
55
54
  columnCursor: number;
@@ -57,27 +56,6 @@ interface HookHighlightColumnHeaderMeta {
57
56
  classNames: string[];
58
57
  }
59
58
 
60
- interface ClipboardData {
61
- removeRows: (rows: number[]) => void;
62
- removeColumns: (columns: number[]) => void;
63
- insertAtRow: (rowIndex: number, values: any[]) => void;
64
- insertAtColumn: (columnIndex: number, values: any[]) => void;
65
- getCellAt: (row: number, col: number) => string;
66
- setCellAt: (row: number, column: number, value: any) => void;
67
- getData: () => any[][];
68
- getMetaInfo: () => GridSettings;
69
- getType: () => 'handsontable' | 'table' | 'unrecognizable';
70
- }
71
-
72
- interface PasteClipboardData extends ClipboardData {
73
- getType: () => 'handsontable' | 'table' | 'unrecognizable';
74
- }
75
-
76
- interface CopyClipboardData extends ClipboardData {
77
- getRanges: () => RangeType[];
78
- getType: () => 'handsontable';
79
- }
80
-
81
59
  export interface Events {
82
60
  afterAddChild?: (parent: RowObject, element: RowObject | undefined, index: number | undefined) => void;
83
61
  afterAutofill?: (fillData: CellValue[][], sourceRange: CellRange, targetRange: CellRange, direction: 'up' | 'down' | 'left' | 'right') => void;
@@ -96,11 +74,11 @@ export interface Events {
96
74
  afterContextMenuDefaultOptions?: (predefinedItems: Array<ContextMenuPredefinedMenuItemKey | ContextMenuMenuItemConfig>) => void;
97
75
  afterContextMenuHide?: (context: ContextMenu) => void;
98
76
  afterContextMenuShow?: (context: ContextMenu) => void;
99
- afterCopy?: (clipboardData: CopyClipboardData) => void;
77
+ afterCopy?: (data: CellValue[][], coords: RangeType[], copiedHeadersCount: { columnHeadersCount: number }) => void;
100
78
  afterCopyLimit?: (selectedRows: number, selectedColumns: number, copyRowsLimit: number, copyColumnsLimit: number) => void;
101
79
  afterCreateCol?: (index: number, amount: number, source?: ChangeSource) => void;
102
80
  afterCreateRow?: (index: number, amount: number, source?: ChangeSource) => void;
103
- afterCut?: (clipboardData: CopyClipboardData) => void;
81
+ afterCut?: (data: CellValue[][], coords: RangeType[]) => void;
104
82
  afterDeselect?: () => void;
105
83
  afterDestroy?: () => void;
106
84
  afterDetachChild?: (parent: RowObject, element: RowObject) => void;
@@ -135,7 +113,7 @@ export interface Events {
135
113
  afterOnCellMouseOut?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
136
114
  afterOnCellMouseOver?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
137
115
  afterOnCellMouseUp?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
138
- afterPaste?: (clipboardData: PasteClipboardData) => void;
116
+ afterPaste?: (data: CellValue[][], coords: RangeType[]) => void;
139
117
  afterPluginsInitialized?: () => void;
140
118
  afterRedo?: (action: UndoRedoAction) => void;
141
119
  afterRedoStackChange?: (undoneActionsBefore: UndoRedoAction[], undoneActionsAfter: UndoRedoAction[]) => void;
@@ -194,10 +172,10 @@ export interface Events {
194
172
  beforeColumnUnfreeze?: (columnIndex: number, isUnfreezingPerformed: boolean) => void | boolean;
195
173
  beforeContextMenuSetItems?: (menuItems: ContextMenuMenuItemConfig[]) => void;
196
174
  beforeContextMenuShow?: (context: ContextMenu) => void;
197
- beforeCopy?: (clipboardData: CopyClipboardData) => void | boolean;
175
+ beforeCopy?: (data: CellValue[][], coords: RangeType[], copiedHeadersCount: { columnHeadersCount: number }) => void | boolean;
198
176
  beforeCreateCol?: (index: number, amount: number, source?: ChangeSource) => void | boolean;
199
177
  beforeCreateRow?: (index: number, amount: number, source?: ChangeSource) => void | boolean;
200
- beforeCut?: (clipboardData: CopyClipboardData) => void | boolean;
178
+ beforeCut?: (data: CellValue[][], coords: RangeType[]) => void | boolean;
201
179
  beforeDetachChild?: (parent: RowObject, element: RowObject) => void;
202
180
  beforeDrawBorders?: (corners: number[], borderClassName: 'current' | 'area' | 'highlight' | undefined) => void;
203
181
  beforeDropdownMenuSetItems?: (menuItems: ContextMenuMenuItemConfig[]) => void;
@@ -219,7 +197,7 @@ export interface Events {
219
197
  beforeOnCellMouseOut?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
220
198
  beforeOnCellMouseOver?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement, controller: SelectionController) => void;
221
199
  beforeOnCellMouseUp?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
222
- beforePaste?: (clipboardData: PasteClipboardData) => boolean | void;
200
+ beforePaste?: (data: CellValue[][], coords: RangeType[]) => void | boolean;
223
201
  beforeRedo?: (action: UndoRedoAction) => void;
224
202
  beforeRedoStackChange?: (undoneActions: UndoRedoAction[]) => void;
225
203
  beforeRefreshDimensions?: (previousDimensions: object, currentDimensions: object, actionPossible: boolean) => boolean | void;
package/pluginHooks.js CHANGED
@@ -1505,35 +1505,26 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1505
1505
  * Fired by {@link CopyPaste} plugin before copying the values to the clipboard and before clearing values of
1506
1506
  * the selected cells. This hook is fired when {@link Options#copyPaste} option is enabled.
1507
1507
  *
1508
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1509
- *
1510
1508
  * @event Hooks#beforeCut
1511
- * @param {object} clipboardData Information about cut action which is going to happen.
1512
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1513
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1514
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1515
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1516
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1517
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1518
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1519
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1520
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1509
+ * @param {Array[]} data An array of arrays which contains data to cut.
1510
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1511
+ * which will be cut out.
1521
1512
  * @returns {*} If returns `false` then operation of the cutting out is canceled.
1522
1513
  * @example
1523
1514
  * ::: only-for javascript
1524
1515
  * ```js
1525
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1516
+ * // To disregard a single row, remove it from the array using data.splice(i, 1).
1526
1517
  * new Handsontable(element, {
1527
- * beforeCut: function(clipboardData) {
1528
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1529
- * clipboardData.removeRows([0]);
1530
- * clipboardData.removeColumns([0]);
1531
- * // clipboardData.getData() -> [[5, 6]]
1518
+ * beforeCut: function(data, coords) {
1519
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1520
+ * data.splice(0, 1);
1521
+ * // data -> [[4, 5, 6]]
1522
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1532
1523
  * }
1533
1524
  * });
1534
1525
  * // To cancel a cutting action, just return `false`.
1535
1526
  * new Handsontable(element, {
1536
- * beforeCut: function(clipboardData) {
1527
+ * beforeCut: function(data, coords) {
1537
1528
  * return false;
1538
1529
  * }
1539
1530
  * });
@@ -1542,18 +1533,18 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1542
1533
  *
1543
1534
  * ::: only-for react
1544
1535
  * ```jsx
1545
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1536
+ * // To disregard a single row, remove it from the array using data.splice(i, 1).
1546
1537
  * <HotTable
1547
- * beforeCut={(clipboardData) => {
1548
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1549
- * clipboardData.removeRows([0]);
1550
- * clipboardData.removeColumns([0]);
1551
- * // clipboardData.getData() -> [[5, 6]]
1538
+ * beforeCut={(data, coords) => {
1539
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1540
+ * data.splice(0, 1);
1541
+ * // data -> [[4, 5, 6]]
1542
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1552
1543
  * }}
1553
1544
  * />
1554
1545
  * // To cancel a cutting action, just return `false`.
1555
1546
  * <HotTable
1556
- * beforeCut={(clipboardData) => {
1547
+ * beforeCut={(data, coords) => {
1557
1548
  * return false;
1558
1549
  * }}
1559
1550
  * />
@@ -1565,50 +1556,33 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1565
1556
  * Fired by {@link CopyPaste} plugin after data was cut out from the table. This hook is fired when
1566
1557
  * {@link Options#copyPaste} option is enabled.
1567
1558
  *
1568
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1569
- *
1570
1559
  * @event Hooks#afterCut
1571
- * @param {object} clipboardData Information about already performed cut action.
1572
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1573
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1574
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1575
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1576
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1577
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1578
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1579
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1580
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1560
+ * @param {Array[]} data An array of arrays with the cut data.
1561
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1562
+ * which was cut out.
1581
1563
  */
1582
1564
  'afterCut',
1583
1565
  /**
1584
1566
  * Fired before values are copied to the clipboard.
1585
1567
  *
1586
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1587
- *
1588
1568
  * @event Hooks#beforeCopy
1589
- * @param {object} clipboardData Information about copy action which is going to happen.
1590
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1591
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1592
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1593
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1594
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1595
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1596
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1597
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1598
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1569
+ * @param {Array[]} data An array of arrays which contains data to copied.
1570
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1571
+ * which will copied.
1572
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount (Since 12.3.0) The number of copied column headers.
1599
1573
  * @returns {*} If returns `false` then copying is canceled.
1600
1574
  *
1601
1575
  * @example
1602
1576
  * ::: only-for javascript
1603
1577
  * ```js
1604
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1578
+ * // To disregard a single row, remove it from array using data.splice(i, 1).
1605
1579
  * ...
1606
1580
  * new Handsontable(document.getElementById('example'), {
1607
- * beforeCopy: (clipboardData) => {
1608
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1609
- * clipboardData.removeRows([0]);
1610
- * clipboardData.removeColumns([0]);
1611
- * // clipboardData.getData() -> [[5, 6]]
1581
+ * beforeCopy: (data, coords) => {
1582
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1583
+ * data.splice(0, 1);
1584
+ * // data -> [[4, 5, 6]]
1585
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1612
1586
  * }
1613
1587
  * });
1614
1588
  * ...
@@ -1616,7 +1590,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1616
1590
  * // To cancel copying, return false from the callback.
1617
1591
  * ...
1618
1592
  * new Handsontable(document.getElementById('example'), {
1619
- * beforeCopy: (clipboardData) => {
1593
+ * beforeCopy: (data, coords) => {
1620
1594
  * return false;
1621
1595
  * }
1622
1596
  * });
@@ -1626,14 +1600,14 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1626
1600
  *
1627
1601
  * ::: only-for react
1628
1602
  * ```jsx
1629
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1603
+ * // To disregard a single row, remove it from array using data.splice(i, 1).
1630
1604
  * ...
1631
1605
  * <HotTable
1632
- * beforeCopy={(clipboardData) => {
1633
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1634
- * clipboardData.removeRows([0]);
1635
- * clipboardData.removeColumns([0]);
1636
- * // clipboardData.getData() -> [[5, 6]]
1606
+ * beforeCopy={(data, coords) => {
1607
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1608
+ * data.splice(0, 1);
1609
+ * // data -> [[4, 5, 6]]
1610
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1637
1611
  * }}
1638
1612
  * />
1639
1613
  * ...
@@ -1641,7 +1615,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1641
1615
  * // To cancel copying, return false from the callback.
1642
1616
  * ...
1643
1617
  * <HotTable
1644
- * beforeCopy={(clipboardData) => {
1618
+ * beforeCopy={(data, coords) => {
1645
1619
  * return false;
1646
1620
  * }}
1647
1621
  * />
@@ -1654,55 +1628,37 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1654
1628
  * Fired by {@link CopyPaste} plugin after data are pasted into table. This hook is fired when {@link Options#copyPaste}
1655
1629
  * option is enabled.
1656
1630
  *
1657
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1658
- *
1659
1631
  * @event Hooks#afterCopy
1660
- * @param {object} clipboardData Information about already performed copy action.
1661
- * @param {Function} clipboardData.removeRow Remove row from the copied dataset.
1662
- * @param {Function} clipboardData.removeColumn Remove column from the copied dataset.
1663
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1664
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1665
- * @param {Function} clipboardData.setCellAt Change headers or cells in the copied dataset.
1666
- * @param {Function} clipboardData.getCellAt Get headers or cells from the copied dataset.
1667
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1668
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1669
- * @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
1632
+ * @param {Array[]} data An array of arrays which contains the copied data.
1633
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1634
+ * which was copied.
1635
+ * @param {{ columnHeadersCount: number }} copiedHeadersCount (Since 12.3.0) The number of copied column headers.
1670
1636
  */
1671
1637
  'afterCopy',
1672
1638
  /**
1673
1639
  * Fired by {@link CopyPaste} plugin before values are pasted into table. This hook is fired when
1674
1640
  * {@link Options#copyPaste} option is enabled.
1675
1641
  *
1676
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1677
- *
1678
1642
  * @event Hooks#beforePaste
1679
- * @param {object} clipboardData Information about paste action which is going to happen.
1680
- * @param {Function} clipboardData.removeRow Remove row from the pasted dataset.
1681
- * @param {Function} clipboardData.removeColumn Remove column from the pasted dataset.
1682
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1683
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1684
- * @param {Function} clipboardData.setCellAt Change headers or cells in the pasted dataset.
1685
- * @param {Function} clipboardData.getCellAt Get headers or cells from the pasted dataset.
1686
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1687
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1688
- * @param {Function} clipboardData.getSource Gets information about source of the copied data
1689
- * (Handsontable, table or string).
1643
+ * @param {Array[]} data An array of arrays which contains data to paste.
1644
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1645
+ * that correspond to the previously selected area.
1690
1646
  * @returns {*} If returns `false` then pasting is canceled.
1691
1647
  * @example
1692
1648
  * ```js
1693
1649
  * ::: only-for javascript
1694
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1650
+ * // To disregard a single row, remove it from array using data.splice(i, 1).
1695
1651
  * new Handsontable(example, {
1696
- * beforePaste: (clipboardData) => {
1697
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1698
- * clipboardData.removeRows([0]);
1699
- * clipboardData.removeColumns([0]);
1700
- * // clipboardData.getData() -> [[5, 6]]
1652
+ * beforePaste: (data, coords) => {
1653
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1654
+ * data.splice(0, 1);
1655
+ * // data -> [[4, 5, 6]]
1656
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1701
1657
  * }
1702
1658
  * });
1703
1659
  * // To cancel pasting, return false from the callback.
1704
1660
  * new Handsontable(example, {
1705
- * beforePaste: (clipboardData) => {
1661
+ * beforePaste: (data, coords) => {
1706
1662
  * return false;
1707
1663
  * }
1708
1664
  * });
@@ -1711,18 +1667,18 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1711
1667
  *
1712
1668
  * ::: only-for react
1713
1669
  * ```jsx
1714
- * // To disregard a single row or column, remove it from copied dataset using `removeRows`/`removeColumns` method on the object from the first callback argument.
1670
+ * // To disregard a single row, remove it from array using data.splice(i, 1).
1715
1671
  * <HotTable
1716
- * beforePaste={(clipboardData) => {
1717
- * // clipboardData.getData() -> [[1, 2, 3], [4, 5, 6]]
1718
- * clipboardData.removeRows([0]);
1719
- * clipboardData.removeColumns([0]);
1720
- * // clipboardData.getData() -> [[5, 6]]
1672
+ * beforePaste={(data, coords) => {
1673
+ * // data -> [[1, 2, 3], [4, 5, 6]]
1674
+ * data.splice(0, 1);
1675
+ * // data -> [[4, 5, 6]]
1676
+ * // coords -> [{startRow: 0, startCol: 0, endRow: 1, endCol: 2}]
1721
1677
  * }}
1722
1678
  * />
1723
1679
  * // To cancel pasting, return false from the callback.
1724
1680
  * <HotTable
1725
- * beforePaste={(clipboardData) => {
1681
+ * beforePaste={(data, coords) => {
1726
1682
  * return false;
1727
1683
  * }}
1728
1684
  * />
@@ -1734,20 +1690,10 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1734
1690
  * Fired by {@link CopyPaste} plugin after values are pasted into table. This hook is fired when
1735
1691
  * {@link Options#copyPaste} option is enabled.
1736
1692
  *
1737
- * Note: Please keep in mind since @14.0.0 the method arguments has been changed.
1738
- *
1739
1693
  * @event Hooks#afterPaste
1740
- * @param {object} clipboardData Information about already performed paste action.
1741
- * @param {Function} clipboardData.removeRow Remove row from the pasted dataset.
1742
- * @param {Function} clipboardData.removeColumn Remove column from the pasted dataset.
1743
- * @param {Function} clipboardData.insertAtRow Insert values at row index.
1744
- * @param {Function} clipboardData.insertAtColumn Insert values at column index.
1745
- * @param {Function} clipboardData.setCellAt Change headers or cells in the pasted dataset.
1746
- * @param {Function} clipboardData.getCellAt Get headers or cells from the pasted dataset.
1747
- * @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
1748
- * @param {Function} clipboardData.getMetaInfo Gets meta information for the copied data.
1749
- * @param {Function} clipboardData.getSource Gets information about source of the copied data
1750
- * (Handsontable, table or string).
1694
+ * @param {Array[]} data An array of arrays with the pasted data.
1695
+ * @param {object[]} coords An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
1696
+ * that correspond to the previously selected area.
1751
1697
  */
1752
1698
  'afterPaste',
1753
1699
  /**
@@ -2619,7 +2565,7 @@ const REMOVED_HOOKS = new Map([['modifyRow', '8.0.0'], ['modifyCol', '8.0.0'], [
2619
2565
  * @type {Map<string, string>}
2620
2566
  */
2621
2567
  /* eslint-enable jsdoc/require-description-complete-sentence */
2622
- const DEPRECATED_HOOKS = new Map([['beforeRemoveCellClassNames', 'The hook "beforeRemoveCellClassNames" is deprecated and will be removed in the next major release.']]);
2568
+ const DEPRECATED_HOOKS = new Map([[]]);
2623
2569
  class Hooks {
2624
2570
  static getSingleton() {
2625
2571
  return getGlobalSingleton();