handsontable 14.0.0-next-c22ab6f-20231030 → 14.0.0-next-f88c253-20231106
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.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +8 -2
- package/dist/handsontable.full.css +8 -2
- package/dist/handsontable.full.js +2084 -3359
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +59 -66
- package/dist/handsontable.js +2086 -3361
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +16 -23
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +6 -28
- package/pluginHooks.js +63 -117
- package/pluginHooks.mjs +63 -117
- package/plugins/copyPaste/clipboardData.js +18 -0
- package/plugins/copyPaste/clipboardData.mjs +14 -0
- package/plugins/copyPaste/copyPaste.js +92 -38
- package/plugins/copyPaste/copyPaste.mjs +94 -40
- package/plugins/copyPaste/pasteEvent.js +14 -0
- package/plugins/copyPaste/pasteEvent.mjs +9 -0
- package/plugins/mergeCells/mergeCells.js +14 -0
- package/plugins/mergeCells/mergeCells.mjs +14 -0
- package/plugins/nestedHeaders/nestedHeaders.js +22 -21
- package/plugins/nestedHeaders/nestedHeaders.mjs +22 -21
- package/utils/parseTable.js +83 -527
- package/utils/parseTable.mjs +82 -523
- package/plugins/copyPaste/clipboardData/clipboardData.js +0 -516
- package/plugins/copyPaste/clipboardData/clipboardData.mjs +0 -512
- package/plugins/copyPaste/clipboardData/copyClipboardData.js +0 -69
- package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +0 -65
- package/plugins/copyPaste/clipboardData/index.js +0 -9
- package/plugins/copyPaste/clipboardData/index.mjs +0 -4
- package/plugins/copyPaste/clipboardData/pasteClipboardData.js +0 -81
- 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-
|
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)("
|
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-
|
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("
|
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-
|
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?: (
|
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?: (
|
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?: (
|
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?: (
|
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?: (
|
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?: (
|
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 {
|
1512
|
-
* @param {
|
1513
|
-
*
|
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
|
1516
|
+
* // To disregard a single row, remove it from the array using data.splice(i, 1).
|
1526
1517
|
* new Handsontable(element, {
|
1527
|
-
* beforeCut: function(
|
1528
|
-
* //
|
1529
|
-
*
|
1530
|
-
*
|
1531
|
-
* //
|
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(
|
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
|
1536
|
+
* // To disregard a single row, remove it from the array using data.splice(i, 1).
|
1546
1537
|
* <HotTable
|
1547
|
-
* beforeCut={(
|
1548
|
-
* //
|
1549
|
-
*
|
1550
|
-
*
|
1551
|
-
* //
|
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={(
|
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 {
|
1572
|
-
* @param {
|
1573
|
-
*
|
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 {
|
1590
|
-
* @param {
|
1591
|
-
*
|
1592
|
-
* @param {
|
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
|
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: (
|
1608
|
-
* //
|
1609
|
-
*
|
1610
|
-
*
|
1611
|
-
* //
|
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: (
|
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
|
1603
|
+
* // To disregard a single row, remove it from array using data.splice(i, 1).
|
1630
1604
|
* ...
|
1631
1605
|
* <HotTable
|
1632
|
-
* beforeCopy={(
|
1633
|
-
* //
|
1634
|
-
*
|
1635
|
-
*
|
1636
|
-
* //
|
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={(
|
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 {
|
1661
|
-
* @param {
|
1662
|
-
*
|
1663
|
-
* @param {
|
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 {
|
1680
|
-
* @param {
|
1681
|
-
*
|
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
|
1650
|
+
* // To disregard a single row, remove it from array using data.splice(i, 1).
|
1695
1651
|
* new Handsontable(example, {
|
1696
|
-
* beforePaste: (
|
1697
|
-
* //
|
1698
|
-
*
|
1699
|
-
*
|
1700
|
-
* //
|
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: (
|
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
|
1670
|
+
* // To disregard a single row, remove it from array using data.splice(i, 1).
|
1715
1671
|
* <HotTable
|
1716
|
-
* beforePaste={(
|
1717
|
-
* //
|
1718
|
-
*
|
1719
|
-
*
|
1720
|
-
* //
|
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={(
|
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 {
|
1741
|
-
* @param {
|
1742
|
-
*
|
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([[
|
2568
|
+
const DEPRECATED_HOOKS = new Map([[]]);
|
2623
2569
|
class Hooks {
|
2624
2570
|
static getSingleton() {
|
2625
2571
|
return getGlobalSingleton();
|