handsontable 0.0.0-next-b96fb9f-20231207 → 0.0.0-next-3d099da-20231208
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.
- package/3rdparty/walkontable/src/calculator/index.js +6 -11
- package/3rdparty/walkontable/src/calculator/index.mjs +3 -5
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +122 -1
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +124 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -1
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -2
- package/3rdparty/walkontable/src/core/_base.js +12 -0
- package/3rdparty/walkontable/src/core/_base.mjs +12 -0
- package/3rdparty/walkontable/src/core/core.js +2 -0
- package/3rdparty/walkontable/src/core/core.mjs +2 -0
- package/3rdparty/walkontable/src/facade/core.js +9 -0
- package/3rdparty/walkontable/src/facade/core.mjs +9 -0
- package/3rdparty/walkontable/src/index.js +4 -3
- package/3rdparty/walkontable/src/index.mjs +2 -1
- package/3rdparty/walkontable/src/overlays.js +3 -0
- package/3rdparty/walkontable/src/overlays.mjs +4 -0
- package/3rdparty/walkontable/src/renderer/colGroup.js +0 -10
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +0 -10
- package/3rdparty/walkontable/src/renderer/rows.js +3 -4
- package/3rdparty/walkontable/src/renderer/rows.mjs +3 -4
- package/3rdparty/walkontable/src/selection/manager.js +1 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +1 -0
- package/3rdparty/walkontable/src/settings.js +0 -3
- package/3rdparty/walkontable/src/settings.mjs +0 -2
- package/3rdparty/walkontable/src/table.js +1 -0
- package/3rdparty/walkontable/src/table.mjs +1 -0
- package/3rdparty/walkontable/src/utils/column.js +12 -27
- package/3rdparty/walkontable/src/utils/column.mjs +12 -27
- package/3rdparty/walkontable/src/viewport.js +17 -22
- package/3rdparty/walkontable/src/viewport.mjs +18 -23
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core/focusCatcher/index.js +6 -44
- package/core/focusCatcher/index.mjs +6 -44
- package/core.js +11 -0
- package/core.mjs +11 -0
- package/dataMap/dataMap.js +0 -1
- package/dataMap/metaManager/metaSchema.js +2 -28
- package/dataMap/metaManager/metaSchema.mjs +2 -28
- package/dataMap/metaManager/mods/extendMetaProperties.js +0 -12
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +0 -12
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3903 -2640
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +70 -66
- package/dist/handsontable.js +3906 -2643
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +39 -35
- package/editorManager.js +4 -3
- package/editorManager.mjs +4 -3
- package/editors/autocompleteEditor/autocompleteEditor.js +2 -0
- package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -0
- package/editors/handsontableEditor/handsontableEditor.js +1 -0
- package/editors/handsontableEditor/handsontableEditor.mjs +1 -0
- package/editors/textEditor/textEditor.js +4 -0
- package/editors/textEditor/textEditor.mjs +4 -0
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +29 -6
- package/pluginHooks.js +123 -65
- package/pluginHooks.mjs +122 -62
- package/plugins/copyPaste/clipboardData/clipboardData.js +588 -0
- package/plugins/copyPaste/clipboardData/clipboardData.mjs +584 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.js +69 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +65 -0
- package/plugins/copyPaste/clipboardData/index.js +9 -0
- package/plugins/copyPaste/clipboardData/index.mjs +4 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.js +81 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +77 -0
- package/plugins/copyPaste/copyPaste.js +51 -129
- package/plugins/copyPaste/copyPaste.mjs +54 -132
- package/plugins/copyPaste/copyableRanges.js +7 -43
- package/plugins/copyPaste/copyableRanges.mjs +7 -42
- package/plugins/copyPaste/pasteEvent.mjs +1 -1
- package/plugins/customBorders/customBorders.js +5 -0
- package/plugins/customBorders/customBorders.mjs +5 -0
- package/plugins/customBorders/utils.js +1 -0
- package/plugins/customBorders/utils.mjs +1 -0
- package/plugins/filters/ui/radioInput.js +1 -1
- package/plugins/filters/ui/radioInput.mjs +1 -1
- package/plugins/formulas/formulas.js +2 -0
- package/plugins/formulas/formulas.mjs +2 -0
- package/plugins/formulas/indexSyncer/axisSyncer.js +1 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +1 -0
- package/plugins/manualColumnResize/manualColumnResize.js +1 -0
- package/plugins/manualColumnResize/manualColumnResize.mjs +1 -0
- package/plugins/mergeCells/mergeCells.js +127 -1
- package/plugins/mergeCells/mergeCells.mjs +127 -1
- package/plugins/nestedHeaders/nestedHeaders.js +87 -41
- package/plugins/nestedHeaders/nestedHeaders.mjs +88 -42
- package/plugins/nestedHeaders/stateManager/headersTree.js +1 -0
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +1 -0
- package/plugins/undoRedo/undoRedo.js +2 -0
- package/plugins/undoRedo/undoRedo.mjs +2 -0
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -0
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -0
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +2 -0
- package/selection/highlight/highlight.js +1 -0
- package/selection/highlight/highlight.mjs +1 -0
- package/selection/index.js +3 -1
- package/selection/index.mjs +2 -2
- package/selection/utils.js +34 -0
- package/selection/utils.mjs +33 -0
- package/settings.d.ts +0 -1
- package/tableView.js +2 -1
- package/tableView.mjs +2 -1
- package/translations/indexMapper.js +1 -2
- package/utils/parseTable.js +538 -84
- package/utils/parseTable.mjs +534 -83
- package/validators/timeValidator/timeValidator.js +1 -0
- package/validators/timeValidator/timeValidator.mjs +1 -0
- package/3rdparty/walkontable/src/calculator/renderAllColumns.js +0 -50
- package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +0 -46
- package/3rdparty/walkontable/src/calculator/renderAllRows.js +0 -50
- package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +0 -46
- package/3rdparty/walkontable/src/utils/columnStretching.js +0 -219
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +0 -215
- package/plugins/copyPaste/clipboardData.js +0 -18
- package/plugins/copyPaste/clipboardData.mjs +0 -14
@@ -14,8 +14,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
14
14
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
15
15
|
import { BasePlugin } from "../base/index.mjs";
|
16
16
|
import Hooks from "../../pluginHooks.mjs";
|
17
|
-
import { stringify
|
18
|
-
import { arrayEach } from "../../helpers/array.mjs";
|
17
|
+
import { stringify } from "../../3rdparty/SheetClip/index.mjs";
|
19
18
|
import { sanitize } from "../../helpers/string.mjs";
|
20
19
|
import { removeContentEditableFromElementAndDeselect, runWithSelectedContendEditableElement, makeElementContentEditableAndSelectItsContent } from "../../helpers/dom/element.mjs";
|
21
20
|
import { isSafari } from "../../helpers/browser.mjs";
|
@@ -24,9 +23,11 @@ import copyColumnHeadersOnlyItem from "./contextMenuItem/copyColumnHeadersOnly.m
|
|
24
23
|
import copyWithColumnGroupHeadersItem from "./contextMenuItem/copyWithColumnGroupHeaders.mjs";
|
25
24
|
import copyWithColumnHeadersItem from "./contextMenuItem/copyWithColumnHeaders.mjs";
|
26
25
|
import cutItem from "./contextMenuItem/cut.mjs";
|
27
|
-
import
|
28
|
-
import {
|
29
|
-
import {
|
26
|
+
import { CopyableRangesFactory } from "./copyableRanges.mjs";
|
27
|
+
import { transformRangeLikeToIndexes } from "../../selection/index.mjs";
|
28
|
+
import { getDataByCoords, getHTMLFromConfig } from "../../utils/parseTable.mjs";
|
29
|
+
import EventManager from "../../eventManager.mjs";
|
30
|
+
import { CopyClipboardData, PasteClipboardData, META_HEAD } from "./clipboardData/index.mjs";
|
30
31
|
Hooks.getSingleton().register('afterCopyLimit');
|
31
32
|
Hooks.getSingleton().register('modifyCopyableRange');
|
32
33
|
Hooks.getSingleton().register('beforeCut');
|
@@ -38,7 +39,6 @@ Hooks.getSingleton().register('afterCopy');
|
|
38
39
|
export const PLUGIN_KEY = 'copyPaste';
|
39
40
|
export const PLUGIN_PRIORITY = 80;
|
40
41
|
const SETTING_KEYS = ['fragmentSelection'];
|
41
|
-
const META_HEAD = ['<meta name="generator" content="Handsontable"/>', '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'].join('');
|
42
42
|
|
43
43
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
44
44
|
/**
|
@@ -82,13 +82,10 @@ var _copyMode = /*#__PURE__*/new WeakMap();
|
|
82
82
|
var _isTriggeredByCopy = /*#__PURE__*/new WeakMap();
|
83
83
|
var _isTriggeredByCut = /*#__PURE__*/new WeakMap();
|
84
84
|
var _copyableRangesFactory = /*#__PURE__*/new WeakMap();
|
85
|
-
var _preventViewportScrollOnPaste = /*#__PURE__*/new WeakMap();
|
86
85
|
var _ensureClipboardEventsGetTriggered = /*#__PURE__*/new WeakSet();
|
87
|
-
var _countCopiedHeaders = /*#__PURE__*/new WeakSet();
|
88
86
|
var _addContentEditableToHighlightedCell = /*#__PURE__*/new WeakSet();
|
89
87
|
var _removeContentEditableFromHighlightedCell = /*#__PURE__*/new WeakSet();
|
90
88
|
var _onAfterContextMenuDefaultOptions = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onAfterSelection = /*#__PURE__*/new WeakSet();
|
92
89
|
var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
|
93
90
|
var _onSafariMouseEnter = /*#__PURE__*/new WeakSet();
|
94
91
|
var _onSafariMouseLeave = /*#__PURE__*/new WeakSet();
|
@@ -98,35 +95,32 @@ export class CopyPaste extends BasePlugin {
|
|
98
95
|
super(...arguments);
|
99
96
|
/**
|
100
97
|
* `afterSelection` hook callback triggered only on Safari.
|
98
|
+
*
|
99
|
+
* @private
|
101
100
|
*/
|
102
101
|
_classPrivateMethodInitSpec(this, _onSafariAfterSelection);
|
103
102
|
/**
|
104
103
|
* `document.body` `mouseleave` callback used to work around a Safari's problem with copying/cutting from the
|
105
104
|
* browser's menu.
|
105
|
+
*
|
106
|
+
* @private
|
106
107
|
*/
|
107
108
|
_classPrivateMethodInitSpec(this, _onSafariMouseLeave);
|
108
109
|
/**
|
109
110
|
* `document.body` `mouseenter` callback used to work around a Safari's problem with copying/cutting from the
|
110
111
|
* browser's menu.
|
112
|
+
*
|
113
|
+
* @private
|
111
114
|
*/
|
112
115
|
_classPrivateMethodInitSpec(this, _onSafariMouseEnter);
|
113
116
|
/**
|
114
117
|
* Force focus on focusableElement after end of the selection.
|
115
118
|
*/
|
116
119
|
_classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
|
117
|
-
/**
|
118
|
-
* Disables the viewport scroll after pasting the data.
|
119
|
-
*
|
120
|
-
* @param {number} fromRow Selection start row visual index.
|
121
|
-
* @param {number} fromColumn Selection start column visual index.
|
122
|
-
* @param {number} toRow Selection end row visual index.
|
123
|
-
* @param {number} toColumn Selection end column visual index.
|
124
|
-
* @param {object} preventScrolling Object with `value` property. If `true`, the viewport scroll will be prevented.
|
125
|
-
*/
|
126
|
-
_classPrivateMethodInitSpec(this, _onAfterSelection);
|
127
120
|
/**
|
128
121
|
* Add copy and cut options to the Context Menu.
|
129
122
|
*
|
123
|
+
* @private
|
130
124
|
* @param {object} options Contains default added options of the Context Menu.
|
131
125
|
*/
|
132
126
|
_classPrivateMethodInitSpec(this, _onAfterContextMenuDefaultOptions);
|
@@ -138,15 +132,6 @@ export class CopyPaste extends BasePlugin {
|
|
138
132
|
* Add the `contenteditable` attribute to the highlighted cell and select its content.
|
139
133
|
*/
|
140
134
|
_classPrivateMethodInitSpec(this, _addContentEditableToHighlightedCell);
|
141
|
-
/**
|
142
|
-
* Counts how many column headers will be copied based on the passed range.
|
143
|
-
*
|
144
|
-
* @private
|
145
|
-
* @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges Array of objects with properties `startRow`, `startCol`, `endRow` and `endCol`.
|
146
|
-
* @returns {{ columnHeadersCount: number }} Returns an object with keys that holds
|
147
|
-
* information with the number of copied headers.
|
148
|
-
*/
|
149
|
-
_classPrivateMethodInitSpec(this, _countCopiedHeaders);
|
150
135
|
/**
|
151
136
|
* Ensure that the `copy`/`cut` events get triggered properly in Safari.
|
152
137
|
*
|
@@ -263,15 +248,6 @@ export class CopyPaste extends BasePlugin {
|
|
263
248
|
countColumnHeaders: () => this.hot.view.getColumnHeadersCount()
|
264
249
|
})
|
265
250
|
});
|
266
|
-
/**
|
267
|
-
* Flag that indicates if the viewport scroll should be prevented after pasting the data.
|
268
|
-
*
|
269
|
-
* @type {boolean}
|
270
|
-
*/
|
271
|
-
_classPrivateFieldInitSpec(this, _preventViewportScrollOnPaste, {
|
272
|
-
writable: true,
|
273
|
-
value: false
|
274
|
-
});
|
275
251
|
/**
|
276
252
|
* Ranges of the cells coordinates, which should be used to copy/cut/paste actions.
|
277
253
|
*
|
@@ -323,13 +299,8 @@ export class CopyPaste extends BasePlugin {
|
|
323
299
|
this.uiContainer = (_settings$uiContainer = settings.uiContainer) !== null && _settings$uiContainer !== void 0 ? _settings$uiContainer : this.uiContainer;
|
324
300
|
}
|
325
301
|
this.addHook('afterContextMenuDefaultOptions', options => _classPrivateMethodGet(this, _onAfterContextMenuDefaultOptions, _onAfterContextMenuDefaultOptions2).call(this, options));
|
326
|
-
this.addHook('afterSelection', function () {
|
327
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
328
|
-
args[_key] = arguments[_key];
|
329
|
-
}
|
330
|
-
return _classPrivateMethodGet(_this, _onAfterSelection, _onAfterSelection2).call(_this, ...args);
|
331
|
-
});
|
332
302
|
this.addHook('afterSelectionEnd', () => _classPrivateMethodGet(this, _onAfterSelectionEnd, _onAfterSelectionEnd2).call(this));
|
303
|
+
this.eventManager = new EventManager(this);
|
333
304
|
this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {
|
334
305
|
return _this.onCopy(...arguments);
|
335
306
|
});
|
@@ -343,14 +314,14 @@ export class CopyPaste extends BasePlugin {
|
|
343
314
|
// Without this workaround Safari (tested on Safari@16.5.2) does allow copying/cutting from the browser menu.
|
344
315
|
if (isSafari()) {
|
345
316
|
this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseenter', function () {
|
346
|
-
for (var
|
347
|
-
args[
|
317
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
318
|
+
args[_key] = arguments[_key];
|
348
319
|
}
|
349
320
|
return _classPrivateMethodGet(_this, _onSafariMouseEnter, _onSafariMouseEnter2).call(_this, ...args);
|
350
321
|
});
|
351
322
|
this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseleave', function () {
|
352
|
-
for (var
|
353
|
-
args[
|
323
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
324
|
+
args[_key2] = arguments[_key2];
|
354
325
|
}
|
355
326
|
return _classPrivateMethodGet(_this, _onSafariMouseLeave, _onSafariMouseLeave2).call(_this, ...args);
|
356
327
|
});
|
@@ -451,26 +422,14 @@ export class CopyPaste extends BasePlugin {
|
|
451
422
|
* @returns {Array[]} An array of arrays that will be copied to the clipboard.
|
452
423
|
*/
|
453
424
|
getRangedData(ranges) {
|
454
|
-
const data = [];
|
455
425
|
const {
|
456
426
|
rows,
|
457
427
|
columns
|
458
|
-
} =
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
const rowSet = [];
|
463
|
-
arrayEach(columns, column => {
|
464
|
-
if (row < 0) {
|
465
|
-
// `row` as the second argument acts here as the `headerLevel` argument
|
466
|
-
rowSet.push(this.hot.getColHeader(column, row));
|
467
|
-
} else {
|
468
|
-
rowSet.push(this.hot.getCopyableData(row, column));
|
469
|
-
}
|
470
|
-
});
|
471
|
-
data.push(rowSet);
|
428
|
+
} = transformRangeLikeToIndexes(ranges);
|
429
|
+
return getDataByCoords(this.hot, {
|
430
|
+
rows,
|
431
|
+
columns
|
472
432
|
});
|
473
|
-
return data;
|
474
433
|
}
|
475
434
|
|
476
435
|
/**
|
@@ -487,7 +446,17 @@ export class CopyPaste extends BasePlugin {
|
|
487
446
|
if (!pastableText && !pastableHtml) {
|
488
447
|
return;
|
489
448
|
}
|
490
|
-
const pasteData =
|
449
|
+
const pasteData = {
|
450
|
+
clipboardData: {
|
451
|
+
data: {},
|
452
|
+
setData(type, value) {
|
453
|
+
this.data[type] = value;
|
454
|
+
},
|
455
|
+
getData(type) {
|
456
|
+
return this.data[type];
|
457
|
+
}
|
458
|
+
}
|
459
|
+
};
|
491
460
|
if (pastableText) {
|
492
461
|
pasteData.clipboardData.setData('text/plain', pastableText);
|
493
462
|
}
|
@@ -620,7 +589,6 @@ export class CopyPaste extends BasePlugin {
|
|
620
589
|
}
|
621
590
|
newRows.push(newRow);
|
622
591
|
}
|
623
|
-
_classPrivateFieldSet(this, _preventViewportScrollOnPaste, true);
|
624
592
|
this.hot.populateFromArray(startRow, startColumn, newRows, undefined, undefined, 'CopyPaste.paste', this.pasteMode);
|
625
593
|
return [startRow, startColumn, lastVisualRow, lastVisualColumn];
|
626
594
|
}
|
@@ -636,19 +604,12 @@ export class CopyPaste extends BasePlugin {
|
|
636
604
|
}
|
637
605
|
this.setCopyableText();
|
638
606
|
_classPrivateFieldSet(this, _isTriggeredByCopy, false);
|
639
|
-
const
|
640
|
-
const
|
641
|
-
const allowCopying = !!this.hot.runHooks('beforeCopy', data, this.copyableRanges, copiedHeadersCount);
|
607
|
+
const copyClipboardData = new CopyClipboardData(this.hot, this.copyableRanges);
|
608
|
+
const allowCopying = !!this.hot.runHooks('beforeCopy', copyClipboardData);
|
642
609
|
if (allowCopying) {
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
event.clipboardData.setData('text/plain', textPlain);
|
647
|
-
event.clipboardData.setData('text/html', [META_HEAD, textHTML].join(''));
|
648
|
-
} else if (typeof ClipboardEvent === 'undefined') {
|
649
|
-
this.hot.rootWindow.clipboardData.setData('Text', textPlain);
|
650
|
-
}
|
651
|
-
this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);
|
610
|
+
event.clipboardData.setData('text/plain', stringify(copyClipboardData.getData()));
|
611
|
+
event.clipboardData.setData('text/html', [copyClipboardData.getType() === 'handsontable' ? META_HEAD : '', getHTMLFromConfig(copyClipboardData.getMetaInfo())].join(''));
|
612
|
+
this.hot.runHooks('afterCopy', copyClipboardData);
|
652
613
|
}
|
653
614
|
_classPrivateFieldSet(this, _copyMode, 'cells-only');
|
654
615
|
event.preventDefault();
|
@@ -666,19 +627,13 @@ export class CopyPaste extends BasePlugin {
|
|
666
627
|
}
|
667
628
|
this.setCopyableText();
|
668
629
|
_classPrivateFieldSet(this, _isTriggeredByCut, false);
|
669
|
-
const
|
670
|
-
const allowCuttingOut = !!this.hot.runHooks('beforeCut',
|
630
|
+
const copyClipboardData = new CopyClipboardData(this.hot, this.copyableRanges);
|
631
|
+
const allowCuttingOut = !!this.hot.runHooks('beforeCut', copyClipboardData);
|
671
632
|
if (allowCuttingOut) {
|
672
|
-
|
673
|
-
|
674
|
-
const textHTML = _dataToHTML(rangedData, this.hot.rootDocument);
|
675
|
-
event.clipboardData.setData('text/plain', textPlain);
|
676
|
-
event.clipboardData.setData('text/html', [META_HEAD, textHTML].join(''));
|
677
|
-
} else if (typeof ClipboardEvent === 'undefined') {
|
678
|
-
this.hot.rootWindow.clipboardData.setData('Text', textPlain);
|
679
|
-
}
|
633
|
+
event.clipboardData.setData('text/plain', stringify(copyClipboardData.getData()));
|
634
|
+
event.clipboardData.setData('text/html', [copyClipboardData.getType() === 'handsontable' ? META_HEAD : '', getHTMLFromConfig(copyClipboardData.getMetaInfo())].join(''));
|
680
635
|
this.hot.emptySelectedCells('CopyPaste.cut');
|
681
|
-
this.hot.runHooks('afterCut',
|
636
|
+
this.hot.runHooks('afterCut', copyClipboardData);
|
682
637
|
}
|
683
638
|
event.preventDefault();
|
684
639
|
}
|
@@ -696,34 +651,22 @@ export class CopyPaste extends BasePlugin {
|
|
696
651
|
if (event && event.preventDefault) {
|
697
652
|
event.preventDefault();
|
698
653
|
}
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
if (textHTML && /(<table)|(<TABLE)/g.test(textHTML)) {
|
707
|
-
const parsedConfig = htmlToGridSettings(textHTML, this.hot.rootDocument);
|
708
|
-
pastedData = parsedConfig.data;
|
709
|
-
} else {
|
710
|
-
pastedData = event.clipboardData.getData('text/plain');
|
711
|
-
}
|
712
|
-
} else if (typeof ClipboardEvent === 'undefined' && typeof this.hot.rootWindow.clipboardData !== 'undefined') {
|
713
|
-
pastedData = this.hot.rootWindow.clipboardData.getData('Text');
|
714
|
-
}
|
715
|
-
if (typeof pastedData === 'string') {
|
716
|
-
pastedData = parse(pastedData);
|
717
|
-
}
|
718
|
-
if (pastedData === void 0 || pastedData && pastedData.length === 0) {
|
654
|
+
const html = sanitize(event.clipboardData.getData('text/html'), {
|
655
|
+
ADD_TAGS: ['meta'],
|
656
|
+
ADD_ATTR: ['content'],
|
657
|
+
FORCE_BODY: true
|
658
|
+
});
|
659
|
+
const pasteClipboardData = new PasteClipboardData(event.clipboardData.getData('text/plain'), html);
|
660
|
+
if (this.hot.runHooks('beforePaste', pasteClipboardData) === false) {
|
719
661
|
return;
|
720
662
|
}
|
721
|
-
|
663
|
+
const pastedTable = pasteClipboardData.getData();
|
664
|
+
if (pastedTable.length === 0) {
|
722
665
|
return;
|
723
666
|
}
|
724
|
-
const [startRow, startColumn, endRow, endColumn] = this.populateValues(
|
667
|
+
const [startRow, startColumn, endRow, endColumn] = this.populateValues(pastedTable);
|
725
668
|
this.hot.selectCell(startRow, startColumn, Math.min(this.hot.countRows() - 1, endRow), Math.min(this.hot.countCols() - 1, endColumn));
|
726
|
-
this.hot.runHooks('afterPaste',
|
669
|
+
this.hot.runHooks('afterPaste', pasteClipboardData);
|
727
670
|
}
|
728
671
|
/**
|
729
672
|
* Destroys the `CopyPaste` plugin instance.
|
@@ -752,21 +695,6 @@ function _ensureClipboardEventsGetTriggered2(eventName) {
|
|
752
695
|
this.hot.rootDocument.execCommand(eventName);
|
753
696
|
}
|
754
697
|
}
|
755
|
-
function _countCopiedHeaders2(ranges) {
|
756
|
-
const {
|
757
|
-
rows
|
758
|
-
} = normalizeRanges(ranges);
|
759
|
-
let columnHeadersCount = 0;
|
760
|
-
for (let row = 0; row < rows.length; row++) {
|
761
|
-
if (rows[row] >= 0) {
|
762
|
-
break;
|
763
|
-
}
|
764
|
-
columnHeadersCount += 1;
|
765
|
-
}
|
766
|
-
return {
|
767
|
-
columnHeadersCount
|
768
|
-
};
|
769
|
-
}
|
770
698
|
function _addContentEditableToHighlightedCell2() {
|
771
699
|
if (this.hot.isListening()) {
|
772
700
|
const lastSelectedRange = this.hot.getSelectedRangeLast();
|
@@ -813,12 +741,6 @@ function _onAfterContextMenuDefaultOptions2(options) {
|
|
813
741
|
}
|
814
742
|
options.items.push(cutItem(this));
|
815
743
|
}
|
816
|
-
function _onAfterSelection2(fromRow, fromColumn, toRow, toColumn, preventScrolling) {
|
817
|
-
if (_classPrivateFieldGet(this, _preventViewportScrollOnPaste)) {
|
818
|
-
preventScrolling.value = true;
|
819
|
-
}
|
820
|
-
_classPrivateFieldSet(this, _preventViewportScrollOnPaste, false);
|
821
|
-
}
|
822
744
|
function _onAfterSelectionEnd2() {
|
823
745
|
if (this.isEditorOpened()) {
|
824
746
|
return;
|
@@ -1,11 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
exports.normalizeRanges = normalizeRanges;
|
5
|
-
require("core-js/modules/es.array.push.js");
|
6
4
|
require("core-js/modules/es.error.cause.js");
|
7
|
-
var _array = require("../../helpers/array");
|
8
|
-
var _number = require("../../helpers/number");
|
9
5
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
10
6
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
11
7
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
@@ -15,13 +11,6 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
15
11
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
16
12
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
17
13
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
18
|
-
/**
|
19
|
-
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
20
|
-
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
21
|
-
* appropriate data ready to copy to the clipboard.
|
22
|
-
*
|
23
|
-
* @private
|
24
|
-
*/
|
25
14
|
var _selectedRange = /*#__PURE__*/new WeakMap();
|
26
15
|
var _countRows = /*#__PURE__*/new WeakMap();
|
27
16
|
var _countColumns = /*#__PURE__*/new WeakMap();
|
@@ -30,6 +19,13 @@ var _columnsLimit = /*#__PURE__*/new WeakMap();
|
|
30
19
|
var _countColumnHeaders = /*#__PURE__*/new WeakMap();
|
31
20
|
var _trimColumnsRange = /*#__PURE__*/new WeakSet();
|
32
21
|
var _trimRowsRange = /*#__PURE__*/new WeakSet();
|
22
|
+
/**
|
23
|
+
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
24
|
+
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
25
|
+
* appropriate data ready to copy to the clipboard.
|
26
|
+
*
|
27
|
+
* @private
|
28
|
+
*/
|
33
29
|
class CopyableRangesFactory {
|
34
30
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
35
31
|
/**
|
@@ -208,42 +204,10 @@ class CopyableRangesFactory {
|
|
208
204
|
};
|
209
205
|
}
|
210
206
|
}
|
211
|
-
|
212
|
-
/**
|
213
|
-
* Returns an object with `rows` and `columns` keys. The arrays contains sorted indexes
|
214
|
-
* generated according to the given `ranges` array.
|
215
|
-
*
|
216
|
-
* @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges The range to process.
|
217
|
-
* @returns {{rows: number[], columns: number[]}}
|
218
|
-
*/
|
219
207
|
exports.CopyableRangesFactory = CopyableRangesFactory;
|
220
208
|
function _trimColumnsRange2(startColumn, endColumn) {
|
221
209
|
return Math.min(endColumn, Math.max(startColumn + _classPrivateFieldGet(this, _columnsLimit).call(this) - 1, startColumn));
|
222
210
|
}
|
223
211
|
function _trimRowsRange2(startRow, endRow) {
|
224
212
|
return Math.min(endRow, Math.max(startRow + _classPrivateFieldGet(this, _rowsLimit).call(this) - 1, startRow));
|
225
|
-
}
|
226
|
-
function normalizeRanges(ranges) {
|
227
|
-
const rows = [];
|
228
|
-
const columns = [];
|
229
|
-
(0, _array.arrayEach)(ranges, range => {
|
230
|
-
const minRow = Math.min(range.startRow, range.endRow);
|
231
|
-
const maxRow = Math.max(range.startRow, range.endRow);
|
232
|
-
(0, _number.rangeEach)(minRow, maxRow, row => {
|
233
|
-
if (rows.indexOf(row) === -1) {
|
234
|
-
rows.push(row);
|
235
|
-
}
|
236
|
-
});
|
237
|
-
const minColumn = Math.min(range.startCol, range.endCol);
|
238
|
-
const maxColumn = Math.max(range.startCol, range.endCol);
|
239
|
-
(0, _number.rangeEach)(minColumn, maxColumn, column => {
|
240
|
-
if (columns.indexOf(column) === -1) {
|
241
|
-
columns.push(column);
|
242
|
-
}
|
243
|
-
});
|
244
|
-
});
|
245
|
-
return {
|
246
|
-
rows,
|
247
|
-
columns
|
248
|
-
};
|
249
213
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import "core-js/modules/es.array.push.js";
|
2
1
|
import "core-js/modules/es.error.cause.js";
|
3
2
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
3
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
@@ -9,15 +8,6 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
9
8
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
10
9
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
11
10
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
12
|
-
import { arrayEach } from "../../helpers/array.mjs";
|
13
|
-
import { rangeEach } from "../../helpers/number.mjs";
|
14
|
-
/**
|
15
|
-
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
16
|
-
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
17
|
-
* appropriate data ready to copy to the clipboard.
|
18
|
-
*
|
19
|
-
* @private
|
20
|
-
*/
|
21
11
|
var _selectedRange = /*#__PURE__*/new WeakMap();
|
22
12
|
var _countRows = /*#__PURE__*/new WeakMap();
|
23
13
|
var _countColumns = /*#__PURE__*/new WeakMap();
|
@@ -26,6 +16,13 @@ var _columnsLimit = /*#__PURE__*/new WeakMap();
|
|
26
16
|
var _countColumnHeaders = /*#__PURE__*/new WeakMap();
|
27
17
|
var _trimColumnsRange = /*#__PURE__*/new WeakSet();
|
28
18
|
var _trimRowsRange = /*#__PURE__*/new WeakSet();
|
19
|
+
/**
|
20
|
+
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
21
|
+
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
22
|
+
* appropriate data ready to copy to the clipboard.
|
23
|
+
*
|
24
|
+
* @private
|
25
|
+
*/
|
29
26
|
export class CopyableRangesFactory {
|
30
27
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
31
28
|
/**
|
@@ -204,41 +201,9 @@ export class CopyableRangesFactory {
|
|
204
201
|
};
|
205
202
|
}
|
206
203
|
}
|
207
|
-
|
208
|
-
/**
|
209
|
-
* Returns an object with `rows` and `columns` keys. The arrays contains sorted indexes
|
210
|
-
* generated according to the given `ranges` array.
|
211
|
-
*
|
212
|
-
* @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges The range to process.
|
213
|
-
* @returns {{rows: number[], columns: number[]}}
|
214
|
-
*/
|
215
204
|
function _trimColumnsRange2(startColumn, endColumn) {
|
216
205
|
return Math.min(endColumn, Math.max(startColumn + _classPrivateFieldGet(this, _columnsLimit).call(this) - 1, startColumn));
|
217
206
|
}
|
218
207
|
function _trimRowsRange2(startRow, endRow) {
|
219
208
|
return Math.min(endRow, Math.max(startRow + _classPrivateFieldGet(this, _rowsLimit).call(this) - 1, startRow));
|
220
|
-
}
|
221
|
-
export function normalizeRanges(ranges) {
|
222
|
-
const rows = [];
|
223
|
-
const columns = [];
|
224
|
-
arrayEach(ranges, range => {
|
225
|
-
const minRow = Math.min(range.startRow, range.endRow);
|
226
|
-
const maxRow = Math.max(range.startRow, range.endRow);
|
227
|
-
rangeEach(minRow, maxRow, row => {
|
228
|
-
if (rows.indexOf(row) === -1) {
|
229
|
-
rows.push(row);
|
230
|
-
}
|
231
|
-
});
|
232
|
-
const minColumn = Math.min(range.startCol, range.endCol);
|
233
|
-
const maxColumn = Math.max(range.startCol, range.endCol);
|
234
|
-
rangeEach(minColumn, maxColumn, column => {
|
235
|
-
if (columns.indexOf(column) === -1) {
|
236
|
-
columns.push(column);
|
237
|
-
}
|
238
|
-
});
|
239
|
-
});
|
240
|
-
return {
|
241
|
-
rows,
|
242
|
-
columns
|
243
|
-
};
|
244
209
|
}
|
@@ -323,6 +323,7 @@ class CustomBorders extends _base.BasePlugin {
|
|
323
323
|
}
|
324
324
|
});
|
325
325
|
}
|
326
|
+
|
326
327
|
this.hot.setCellMeta(row, column, 'borders', (0, _utils.denormalizeBorder)(border));
|
327
328
|
this.insertBorderIntoSettings(border, place);
|
328
329
|
}
|
@@ -607,6 +608,7 @@ class CustomBorders extends _base.BasePlugin {
|
|
607
608
|
}
|
608
609
|
});
|
609
610
|
}
|
611
|
+
|
610
612
|
return check;
|
611
613
|
}
|
612
614
|
|
@@ -629,10 +631,12 @@ class CustomBorders extends _base.BasePlugin {
|
|
629
631
|
(0, _array.arrayEach)(borders, borderObject => {
|
630
632
|
borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
|
631
633
|
});
|
634
|
+
|
632
635
|
check = true;
|
633
636
|
return false; // breaks forAll
|
634
637
|
}
|
635
638
|
});
|
639
|
+
|
636
640
|
return check;
|
637
641
|
}
|
638
642
|
|
@@ -668,6 +672,7 @@ class CustomBorders extends _base.BasePlugin {
|
|
668
672
|
}
|
669
673
|
});
|
670
674
|
}
|
675
|
+
|
671
676
|
return check;
|
672
677
|
}
|
673
678
|
|
@@ -318,6 +318,7 @@ export class CustomBorders extends BasePlugin {
|
|
318
318
|
}
|
319
319
|
});
|
320
320
|
}
|
321
|
+
|
321
322
|
this.hot.setCellMeta(row, column, 'borders', denormalizeBorder(border));
|
322
323
|
this.insertBorderIntoSettings(border, place);
|
323
324
|
}
|
@@ -602,6 +603,7 @@ export class CustomBorders extends BasePlugin {
|
|
602
603
|
}
|
603
604
|
});
|
604
605
|
}
|
606
|
+
|
605
607
|
return check;
|
606
608
|
}
|
607
609
|
|
@@ -624,10 +626,12 @@ export class CustomBorders extends BasePlugin {
|
|
624
626
|
arrayEach(borders, borderObject => {
|
625
627
|
borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
|
626
628
|
});
|
629
|
+
|
627
630
|
check = true;
|
628
631
|
return false; // breaks forAll
|
629
632
|
}
|
630
633
|
});
|
634
|
+
|
631
635
|
return check;
|
632
636
|
}
|
633
637
|
|
@@ -663,6 +667,7 @@ export class CustomBorders extends BasePlugin {
|
|
663
667
|
}
|
664
668
|
});
|
665
669
|
}
|
670
|
+
|
666
671
|
return check;
|
667
672
|
}
|
668
673
|
|
@@ -1189,6 +1189,7 @@ function _onBeforeCreateRow2(visualRow, amount) {
|
|
1189
1189
|
if (visualRow >= this.hot.countRows()) {
|
1190
1190
|
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1191
1191
|
}
|
1192
|
+
|
1192
1193
|
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
1193
1194
|
return false;
|
1194
1195
|
}
|
@@ -1198,6 +1199,7 @@ function _onBeforeCreateCol2(visualColumn, amount) {
|
|
1198
1199
|
if (visualColumn >= this.hot.countCols()) {
|
1199
1200
|
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1200
1201
|
}
|
1202
|
+
|
1201
1203
|
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
1202
1204
|
return false;
|
1203
1205
|
}
|
@@ -1184,6 +1184,7 @@ function _onBeforeCreateRow2(visualRow, amount) {
|
|
1184
1184
|
if (visualRow >= this.hot.countRows()) {
|
1185
1185
|
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1186
1186
|
}
|
1187
|
+
|
1187
1188
|
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
1188
1189
|
return false;
|
1189
1190
|
}
|
@@ -1193,6 +1194,7 @@ function _onBeforeCreateCol2(visualColumn, amount) {
|
|
1193
1194
|
if (visualColumn >= this.hot.countCols()) {
|
1194
1195
|
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1195
1196
|
}
|
1197
|
+
|
1196
1198
|
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
1197
1199
|
return false;
|
1198
1200
|
}
|
@@ -192,6 +192,7 @@ class AxisSyncer {
|
|
192
192
|
var _notMovedElements$fin;
|
193
193
|
return (_notMovedElements$fin = notMovedElements[finalHfIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
|
194
194
|
}
|
195
|
+
|
195
196
|
return notMovedElements[finalHfIndex - 1] + 1; // Moving before another element.
|
196
197
|
}
|
197
198
|
|
@@ -189,6 +189,7 @@ class AxisSyncer {
|
|
189
189
|
var _notMovedElements$fin;
|
190
190
|
return (_notMovedElements$fin = notMovedElements[finalHfIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
|
191
191
|
}
|
192
|
+
|
192
193
|
return notMovedElements[finalHfIndex - 1] + 1; // Moving before another element.
|
193
194
|
}
|
194
195
|
|