handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-834f47e-20230509
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/{selection/border/border.js → border.js} +12 -7
- package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
- package/3rdparty/walkontable/src/cell/coords.js +13 -40
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- package/3rdparty/walkontable/src/core/_base.js +3 -9
- package/3rdparty/walkontable/src/core/_base.mjs +3 -9
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +2 -3
- package/3rdparty/walkontable/src/core/core.mjs +2 -3
- package/3rdparty/walkontable/src/event.js +10 -12
- package/3rdparty/walkontable/src/event.mjs +10 -12
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +2 -10
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +7 -8
- package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
- package/3rdparty/walkontable/src/overlay/top.js +10 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
- package/3rdparty/walkontable/src/overlays.js +55 -64
- package/3rdparty/walkontable/src/overlays.mjs +55 -64
- package/3rdparty/walkontable/src/renderer/table.js +0 -2
- package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/selection.js +354 -0
- package/3rdparty/walkontable/src/selection.mjs +348 -0
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
- package/3rdparty/walkontable/src/table.js +101 -33
- package/3rdparty/walkontable/src/table.mjs +102 -34
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.d.ts +0 -4
- package/core.js +19 -52
- package/core.mjs +19 -52
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +1 -8
- package/dataMap/metaManager/metaSchema.mjs +1 -8
- package/dist/handsontable.css +2 -7
- package/dist/handsontable.full.css +2 -7
- package/dist/handsontable.full.js +9162 -9474
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +123 -115
- package/dist/handsontable.js +8763 -9076
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +11 -3
- package/dist/languages/all.js +133 -0
- package/dist/languages/ar-AR.js +7 -0
- package/dist/languages/cs-CZ.js +7 -0
- package/dist/languages/de-CH.js +7 -0
- package/dist/languages/de-DE.js +7 -0
- package/dist/languages/en-US.js +7 -0
- package/dist/languages/es-MX.js +7 -0
- package/dist/languages/fr-FR.js +7 -0
- package/dist/languages/it-IT.js +7 -0
- package/dist/languages/ja-JP.js +7 -0
- package/dist/languages/ko-KR.js +7 -0
- package/dist/languages/lv-LV.js +7 -0
- package/dist/languages/nb-NO.js +7 -0
- package/dist/languages/nl-NL.js +7 -0
- package/dist/languages/pl-PL.js +7 -0
- package/dist/languages/pt-BR.js +7 -0
- package/dist/languages/ru-RU.js +7 -0
- package/dist/languages/sr-SP.js +7 -0
- package/dist/languages/zh-CN.js +7 -0
- package/dist/languages/zh-TW.js +7 -0
- package/editorManager.js +3 -7
- package/editorManager.mjs +3 -7
- package/editors/textEditor/textEditor.js +16 -3
- package/editors/textEditor/textEditor.mjs +17 -4
- package/helpers/dom/element.js +0 -11
- package/helpers/dom/element.mjs +0 -10
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/i18n/languages/ar-AR.js +7 -1
- package/i18n/languages/cs-CZ.js +7 -1
- package/i18n/languages/de-CH.js +7 -1
- package/i18n/languages/de-DE.js +7 -1
- package/i18n/languages/en-US.js +7 -1
- package/i18n/languages/es-MX.js +7 -1
- package/i18n/languages/fr-FR.js +7 -1
- package/i18n/languages/it-IT.js +7 -1
- package/i18n/languages/ja-JP.js +7 -1
- package/i18n/languages/ko-KR.js +7 -1
- package/i18n/languages/lv-LV.js +7 -1
- package/i18n/languages/nb-NO.js +7 -1
- package/i18n/languages/nl-NL.js +7 -1
- package/i18n/languages/pl-PL.js +7 -1
- package/i18n/languages/pt-BR.js +7 -1
- package/i18n/languages/ru-RU.js +7 -1
- package/i18n/languages/sr-SP.js +7 -1
- package/i18n/languages/zh-CN.js +7 -1
- package/i18n/languages/zh-TW.js +7 -1
- package/languages/all.js +133 -0
- package/languages/ar-AR.js +7 -0
- package/languages/cs-CZ.js +7 -0
- package/languages/de-CH.js +7 -0
- package/languages/de-DE.js +7 -0
- package/languages/en-US.js +7 -0
- package/languages/es-MX.js +7 -0
- package/languages/fr-FR.js +7 -0
- package/languages/index.js +133 -0
- package/languages/it-IT.js +7 -0
- package/languages/ja-JP.js +7 -0
- package/languages/ko-KR.js +7 -0
- package/languages/lv-LV.js +7 -0
- package/languages/nb-NO.js +7 -0
- package/languages/nl-NL.js +7 -0
- package/languages/pl-PL.js +7 -0
- package/languages/pt-BR.js +7 -0
- package/languages/ru-RU.js +7 -0
- package/languages/sr-SP.js +7 -0
- package/languages/zh-CN.js +7 -0
- package/languages/zh-TW.js +7 -0
- package/package.json +3 -2
- package/pluginHooks.js +17 -7
- package/pluginHooks.mjs +16 -4
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +93 -12
- package/plugins/copyPaste/copyPaste.mjs +93 -12
- package/plugins/copyPaste/copyableRanges.js +25 -31
- package/plugins/copyPaste/copyableRanges.mjs +18 -24
- package/plugins/copyPaste/focusableElement.js +219 -0
- package/plugins/copyPaste/focusableElement.mjs +213 -0
- package/plugins/customBorders/customBorders.js +2 -6
- package/plugins/customBorders/customBorders.mjs +3 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/formulas.js +190 -168
- package/plugins/formulas/formulas.mjs +190 -168
- package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
- package/plugins/formulas/indexSyncer/index.js +225 -0
- package/plugins/formulas/indexSyncer/index.mjs +219 -0
- package/plugins/mergeCells/mergeCells.js +16 -0
- package/plugins/mergeCells/mergeCells.mjs +16 -0
- package/plugins/nestedHeaders/nestedHeaders.js +4 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +3 -3
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
- package/plugins/registry.js +3 -1
- package/plugins/undoRedo/undoRedo.js +0 -1
- package/plugins/undoRedo/undoRedo.mjs +0 -1
- package/renderers/baseRenderer/baseRenderer.js +0 -3
- package/renderers/baseRenderer/baseRenderer.mjs +0 -3
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +133 -335
- package/selection/highlight/highlight.mjs +129 -325
- package/selection/highlight/types/activeHeader.js +9 -10
- package/selection/highlight/types/activeHeader.mjs +8 -10
- package/selection/highlight/types/area.js +27 -12
- package/selection/highlight/types/area.mjs +30 -16
- package/selection/highlight/types/{focus.js → cell.js} +8 -5
- package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
- package/selection/highlight/types/customSelection.js +10 -7
- package/selection/highlight/types/customSelection.mjs +9 -7
- package/selection/highlight/types/fill.js +8 -5
- package/selection/highlight/types/fill.mjs +7 -5
- package/selection/highlight/types/header.js +20 -10
- package/selection/highlight/types/header.mjs +19 -10
- package/selection/highlight/types/{row.js → index.js} +31 -27
- package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
- package/selection/highlight/visualSelection.js +21 -12
- package/selection/highlight/visualSelection.mjs +21 -12
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- package/selection/selection.js +46 -88
- package/selection/selection.mjs +44 -82
- package/settings.d.ts +0 -1
- package/tableView.js +66 -94
- package/tableView.mjs +66 -94
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +1 -1
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/utils/dataStructures/tree.js +15 -18
- package/utils/dataStructures/tree.mjs +15 -18
- package/utils/parseTable.js +5 -1
- package/utils/parseTable.mjs +5 -1
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
- package/3rdparty/walkontable/src/selection/constants.js +0 -63
- package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
- package/3rdparty/walkontable/src/selection/index.js +0 -30
- package/3rdparty/walkontable/src/selection/index.mjs +0 -5
- package/3rdparty/walkontable/src/selection/manager.js +0 -334
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
- package/3rdparty/walkontable/src/selection/scanner.js +0 -363
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
- package/3rdparty/walkontable/src/selection/selection.js +0 -133
- package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
- package/focusManager.d.ts +0 -12
- package/focusManager.js +0 -249
- package/focusManager.mjs +0 -245
- package/selection/highlight/types/areaLayered.js +0 -54
- package/selection/highlight/types/areaLayered.mjs +0 -49
- package/selection/highlight/types/column.js +0 -50
- package/selection/highlight/types/column.mjs +0 -45
@@ -33,15 +33,16 @@ var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
|
33
33
|
var _SheetClip = require("../../3rdparty/SheetClip");
|
34
34
|
var _array = require("../../helpers/array");
|
35
35
|
var _string = require("../../helpers/string");
|
36
|
+
var _element = require("../../helpers/dom/element");
|
36
37
|
var _copy = _interopRequireDefault(require("./contextMenuItem/copy"));
|
37
38
|
var _copyColumnHeadersOnly = _interopRequireDefault(require("./contextMenuItem/copyColumnHeadersOnly"));
|
38
39
|
var _copyWithColumnGroupHeaders = _interopRequireDefault(require("./contextMenuItem/copyWithColumnGroupHeaders"));
|
39
40
|
var _copyWithColumnHeaders = _interopRequireDefault(require("./contextMenuItem/copyWithColumnHeaders"));
|
40
41
|
var _cut = _interopRequireDefault(require("./contextMenuItem/cut"));
|
41
42
|
var _pasteEvent = _interopRequireDefault(require("./pasteEvent"));
|
43
|
+
var _focusableElement = require("./focusableElement");
|
42
44
|
var _copyableRanges = require("./copyableRanges");
|
43
45
|
var _parseTable = require("../../utils/parseTable");
|
44
|
-
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
45
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
46
47
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
47
48
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -278,6 +279,13 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
278
279
|
* @type {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>}
|
279
280
|
*/
|
280
281
|
_defineProperty(_assertThisInitialized(_this), "copyableRanges", []);
|
282
|
+
/**
|
283
|
+
* Provides focusable element to support IME and copy/paste/cut actions.
|
284
|
+
*
|
285
|
+
* @private
|
286
|
+
* @type {FocusableWrapper}
|
287
|
+
*/
|
288
|
+
_defineProperty(_assertThisInitialized(_this), "focusableElement", void 0);
|
281
289
|
return _this;
|
282
290
|
}
|
283
291
|
_createClass(CopyPaste, [{
|
@@ -320,18 +328,22 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
320
328
|
this.addHook('afterContextMenuDefaultOptions', function (options) {
|
321
329
|
return _this2.onAfterContextMenuDefaultOptions(options);
|
322
330
|
});
|
331
|
+
this.addHook('afterOnCellMouseUp', function () {
|
332
|
+
return _this2.onAfterOnCellMouseUp();
|
333
|
+
});
|
323
334
|
this.addHook('afterSelectionEnd', function () {
|
324
335
|
return _this2.onAfterSelectionEnd();
|
325
336
|
});
|
326
|
-
this.
|
327
|
-
|
328
|
-
return _this2.onCopy.apply(_this2, arguments);
|
337
|
+
this.addHook('beforeKeyDown', function () {
|
338
|
+
return _this2.onBeforeKeyDown();
|
329
339
|
});
|
330
|
-
this.
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
return _this2.
|
340
|
+
this.focusableElement = (0, _focusableElement.createElement)(this.uiContainer);
|
341
|
+
this.focusableElement.addLocalHook('copy', function (event) {
|
342
|
+
return _this2.onCopy(event);
|
343
|
+
}).addLocalHook('cut', function (event) {
|
344
|
+
return _this2.onCut(event);
|
345
|
+
}).addLocalHook('paste', function (event) {
|
346
|
+
return _this2.onPaste(event);
|
335
347
|
});
|
336
348
|
_get(_getPrototypeOf(CopyPaste.prototype), "enablePlugin", this).call(this);
|
337
349
|
}
|
@@ -349,6 +361,7 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
349
361
|
value: function updatePlugin() {
|
350
362
|
this.disablePlugin();
|
351
363
|
this.enablePlugin();
|
364
|
+
this.getOrCreateFocusableElement();
|
352
365
|
_get(_getPrototypeOf(CopyPaste.prototype), "updatePlugin", this).call(this);
|
353
366
|
}
|
354
367
|
|
@@ -358,6 +371,9 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
358
371
|
}, {
|
359
372
|
key: "disablePlugin",
|
360
373
|
value: function disablePlugin() {
|
374
|
+
if (this.focusableElement) {
|
375
|
+
(0, _focusableElement.destroyElement)(this.focusableElement);
|
376
|
+
}
|
361
377
|
_get(_getPrototypeOf(CopyPaste.prototype), "disablePlugin", this).call(this);
|
362
378
|
}
|
363
379
|
|
@@ -381,6 +397,8 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
381
397
|
var copyMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cells-only';
|
382
398
|
_classPrivateFieldSet(this, _copyMode, copyMode);
|
383
399
|
_classPrivateFieldSet(this, _isTriggeredByCopy, true);
|
400
|
+
this.getOrCreateFocusableElement();
|
401
|
+
this.focusableElement.focus();
|
384
402
|
this.hot.rootDocument.execCommand('copy');
|
385
403
|
}
|
386
404
|
|
@@ -424,6 +442,8 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
424
442
|
key: "cut",
|
425
443
|
value: function cut() {
|
426
444
|
_classPrivateFieldSet(this, _isTriggeredByCut, true);
|
445
|
+
this.getOrCreateFocusableElement();
|
446
|
+
this.focusableElement.focus();
|
427
447
|
this.hot.rootDocument.execCommand('cut');
|
428
448
|
}
|
429
449
|
|
@@ -493,6 +513,7 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
493
513
|
if (pastableHtml) {
|
494
514
|
pasteData.clipboardData.setData('text/html', pastableHtml);
|
495
515
|
}
|
516
|
+
this.getOrCreateFocusableElement();
|
496
517
|
this.onPaste(pasteData);
|
497
518
|
}
|
498
519
|
|
@@ -543,6 +564,23 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
543
564
|
}
|
544
565
|
}
|
545
566
|
|
567
|
+
/**
|
568
|
+
* Force focus on editable element.
|
569
|
+
*
|
570
|
+
* @private
|
571
|
+
*/
|
572
|
+
}, {
|
573
|
+
key: "getOrCreateFocusableElement",
|
574
|
+
value: function getOrCreateFocusableElement() {
|
575
|
+
var _this$hot$getActiveEd;
|
576
|
+
var editableElement = (_this$hot$getActiveEd = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd === void 0 ? void 0 : _this$hot$getActiveEd.TEXTAREA;
|
577
|
+
if (editableElement) {
|
578
|
+
this.focusableElement.setFocusableElement(editableElement);
|
579
|
+
} else {
|
580
|
+
this.focusableElement.useSecondaryElement();
|
581
|
+
}
|
582
|
+
}
|
583
|
+
|
546
584
|
/**
|
547
585
|
* Verifies if editor exists and is open.
|
548
586
|
*
|
@@ -552,8 +590,8 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
552
590
|
}, {
|
553
591
|
key: "isEditorOpened",
|
554
592
|
value: function isEditorOpened() {
|
555
|
-
var _this$hot$
|
556
|
-
return (_this$hot$
|
593
|
+
var _this$hot$getActiveEd2;
|
594
|
+
return (_this$hot$getActiveEd2 = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd2 === void 0 ? void 0 : _this$hot$getActiveEd2.isOpened();
|
557
595
|
}
|
558
596
|
}, {
|
559
597
|
key: "populateValues",
|
@@ -757,6 +795,23 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
757
795
|
options.items.push((0, _cut.default)(this));
|
758
796
|
}
|
759
797
|
|
798
|
+
/**
|
799
|
+
* Force focus on focusableElement.
|
800
|
+
*
|
801
|
+
* @private
|
802
|
+
*/
|
803
|
+
}, {
|
804
|
+
key: "onAfterOnCellMouseUp",
|
805
|
+
value: function onAfterOnCellMouseUp() {
|
806
|
+
// Changing focused element will remove current selection. It's unnecessary in case when we give possibility
|
807
|
+
// for fragment selection
|
808
|
+
if (!this.hot.isListening() || this.isEditorOpened() || this.hot.getSettings().fragmentSelection) {
|
809
|
+
return;
|
810
|
+
}
|
811
|
+
this.getOrCreateFocusableElement();
|
812
|
+
this.focusableElement.focus();
|
813
|
+
}
|
814
|
+
|
760
815
|
/**
|
761
816
|
* Force focus on focusableElement after end of the selection.
|
762
817
|
*
|
@@ -768,10 +823,32 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
768
823
|
if (this.isEditorOpened()) {
|
769
824
|
return;
|
770
825
|
}
|
771
|
-
|
826
|
+
this.getOrCreateFocusableElement();
|
827
|
+
if (this.hot.getSettings().fragmentSelection && this.focusableElement.getFocusableElement() !== this.hot.rootDocument.activeElement && (0, _element.getSelectionText)()) {
|
772
828
|
return;
|
773
829
|
}
|
774
830
|
this.setCopyableText();
|
831
|
+
this.focusableElement.focus();
|
832
|
+
}
|
833
|
+
|
834
|
+
/**
|
835
|
+
* `beforeKeyDown` listener to force focus of focusableElement.
|
836
|
+
*
|
837
|
+
* @private
|
838
|
+
*/
|
839
|
+
}, {
|
840
|
+
key: "onBeforeKeyDown",
|
841
|
+
value: function onBeforeKeyDown() {
|
842
|
+
if (!this.hot.isListening() || this.isEditorOpened()) {
|
843
|
+
return;
|
844
|
+
}
|
845
|
+
var activeElement = this.hot.rootDocument.activeElement;
|
846
|
+
var activeEditor = this.hot.getActiveEditor();
|
847
|
+
if (!activeEditor || activeElement !== this.focusableElement.getFocusableElement() && activeElement !== activeEditor.select) {
|
848
|
+
return;
|
849
|
+
}
|
850
|
+
this.getOrCreateFocusableElement();
|
851
|
+
this.focusableElement.focus();
|
775
852
|
}
|
776
853
|
|
777
854
|
/**
|
@@ -780,6 +857,10 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
780
857
|
}, {
|
781
858
|
key: "destroy",
|
782
859
|
value: function destroy() {
|
860
|
+
if (this.focusableElement) {
|
861
|
+
(0, _focusableElement.destroyElement)(this.focusableElement);
|
862
|
+
this.focusableElement = null;
|
863
|
+
}
|
783
864
|
_get(_getPrototypeOf(CopyPaste.prototype), "destroy", this).call(this);
|
784
865
|
}
|
785
866
|
}], [{
|
@@ -60,15 +60,16 @@ import Hooks from "../../pluginHooks.mjs";
|
|
60
60
|
import { stringify, parse } from "../../3rdparty/SheetClip/index.mjs";
|
61
61
|
import { arrayEach } from "../../helpers/array.mjs";
|
62
62
|
import { sanitize } from "../../helpers/string.mjs";
|
63
|
+
import { getSelectionText } from "../../helpers/dom/element.mjs";
|
63
64
|
import copyItem from "./contextMenuItem/copy.mjs";
|
64
65
|
import copyColumnHeadersOnlyItem from "./contextMenuItem/copyColumnHeadersOnly.mjs";
|
65
66
|
import copyWithColumnGroupHeadersItem from "./contextMenuItem/copyWithColumnGroupHeaders.mjs";
|
66
67
|
import copyWithColumnHeadersItem from "./contextMenuItem/copyWithColumnHeaders.mjs";
|
67
68
|
import cutItem from "./contextMenuItem/cut.mjs";
|
68
69
|
import PasteEvent from "./pasteEvent.mjs";
|
70
|
+
import { createElement, destroyElement } from "./focusableElement.mjs";
|
69
71
|
import { CopyableRangesFactory, normalizeRanges } from "./copyableRanges.mjs";
|
70
72
|
import { _dataToHTML, htmlToGridSettings } from "../../utils/parseTable.mjs";
|
71
|
-
import EventManager from "../../eventManager.mjs";
|
72
73
|
Hooks.getSingleton().register('afterCopyLimit');
|
73
74
|
Hooks.getSingleton().register('modifyCopyableRange');
|
74
75
|
Hooks.getSingleton().register('beforeCut');
|
@@ -271,6 +272,13 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
271
272
|
* @type {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>}
|
272
273
|
*/
|
273
274
|
_defineProperty(_assertThisInitialized(_this), "copyableRanges", []);
|
275
|
+
/**
|
276
|
+
* Provides focusable element to support IME and copy/paste/cut actions.
|
277
|
+
*
|
278
|
+
* @private
|
279
|
+
* @type {FocusableWrapper}
|
280
|
+
*/
|
281
|
+
_defineProperty(_assertThisInitialized(_this), "focusableElement", void 0);
|
274
282
|
return _this;
|
275
283
|
}
|
276
284
|
_createClass(CopyPaste, [{
|
@@ -313,18 +321,22 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
313
321
|
this.addHook('afterContextMenuDefaultOptions', function (options) {
|
314
322
|
return _this2.onAfterContextMenuDefaultOptions(options);
|
315
323
|
});
|
324
|
+
this.addHook('afterOnCellMouseUp', function () {
|
325
|
+
return _this2.onAfterOnCellMouseUp();
|
326
|
+
});
|
316
327
|
this.addHook('afterSelectionEnd', function () {
|
317
328
|
return _this2.onAfterSelectionEnd();
|
318
329
|
});
|
319
|
-
this.
|
320
|
-
|
321
|
-
return _this2.onCopy.apply(_this2, arguments);
|
330
|
+
this.addHook('beforeKeyDown', function () {
|
331
|
+
return _this2.onBeforeKeyDown();
|
322
332
|
});
|
323
|
-
this.
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
return _this2.
|
333
|
+
this.focusableElement = createElement(this.uiContainer);
|
334
|
+
this.focusableElement.addLocalHook('copy', function (event) {
|
335
|
+
return _this2.onCopy(event);
|
336
|
+
}).addLocalHook('cut', function (event) {
|
337
|
+
return _this2.onCut(event);
|
338
|
+
}).addLocalHook('paste', function (event) {
|
339
|
+
return _this2.onPaste(event);
|
328
340
|
});
|
329
341
|
_get(_getPrototypeOf(CopyPaste.prototype), "enablePlugin", this).call(this);
|
330
342
|
}
|
@@ -342,6 +354,7 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
342
354
|
value: function updatePlugin() {
|
343
355
|
this.disablePlugin();
|
344
356
|
this.enablePlugin();
|
357
|
+
this.getOrCreateFocusableElement();
|
345
358
|
_get(_getPrototypeOf(CopyPaste.prototype), "updatePlugin", this).call(this);
|
346
359
|
}
|
347
360
|
|
@@ -351,6 +364,9 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
351
364
|
}, {
|
352
365
|
key: "disablePlugin",
|
353
366
|
value: function disablePlugin() {
|
367
|
+
if (this.focusableElement) {
|
368
|
+
destroyElement(this.focusableElement);
|
369
|
+
}
|
354
370
|
_get(_getPrototypeOf(CopyPaste.prototype), "disablePlugin", this).call(this);
|
355
371
|
}
|
356
372
|
|
@@ -374,6 +390,8 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
374
390
|
var copyMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cells-only';
|
375
391
|
_classPrivateFieldSet(this, _copyMode, copyMode);
|
376
392
|
_classPrivateFieldSet(this, _isTriggeredByCopy, true);
|
393
|
+
this.getOrCreateFocusableElement();
|
394
|
+
this.focusableElement.focus();
|
377
395
|
this.hot.rootDocument.execCommand('copy');
|
378
396
|
}
|
379
397
|
|
@@ -417,6 +435,8 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
417
435
|
key: "cut",
|
418
436
|
value: function cut() {
|
419
437
|
_classPrivateFieldSet(this, _isTriggeredByCut, true);
|
438
|
+
this.getOrCreateFocusableElement();
|
439
|
+
this.focusableElement.focus();
|
420
440
|
this.hot.rootDocument.execCommand('cut');
|
421
441
|
}
|
422
442
|
|
@@ -486,6 +506,7 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
486
506
|
if (pastableHtml) {
|
487
507
|
pasteData.clipboardData.setData('text/html', pastableHtml);
|
488
508
|
}
|
509
|
+
this.getOrCreateFocusableElement();
|
489
510
|
this.onPaste(pasteData);
|
490
511
|
}
|
491
512
|
|
@@ -536,6 +557,23 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
536
557
|
}
|
537
558
|
}
|
538
559
|
|
560
|
+
/**
|
561
|
+
* Force focus on editable element.
|
562
|
+
*
|
563
|
+
* @private
|
564
|
+
*/
|
565
|
+
}, {
|
566
|
+
key: "getOrCreateFocusableElement",
|
567
|
+
value: function getOrCreateFocusableElement() {
|
568
|
+
var _this$hot$getActiveEd;
|
569
|
+
var editableElement = (_this$hot$getActiveEd = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd === void 0 ? void 0 : _this$hot$getActiveEd.TEXTAREA;
|
570
|
+
if (editableElement) {
|
571
|
+
this.focusableElement.setFocusableElement(editableElement);
|
572
|
+
} else {
|
573
|
+
this.focusableElement.useSecondaryElement();
|
574
|
+
}
|
575
|
+
}
|
576
|
+
|
539
577
|
/**
|
540
578
|
* Verifies if editor exists and is open.
|
541
579
|
*
|
@@ -545,8 +583,8 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
545
583
|
}, {
|
546
584
|
key: "isEditorOpened",
|
547
585
|
value: function isEditorOpened() {
|
548
|
-
var _this$hot$
|
549
|
-
return (_this$hot$
|
586
|
+
var _this$hot$getActiveEd2;
|
587
|
+
return (_this$hot$getActiveEd2 = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd2 === void 0 ? void 0 : _this$hot$getActiveEd2.isOpened();
|
550
588
|
}
|
551
589
|
}, {
|
552
590
|
key: "populateValues",
|
@@ -750,6 +788,23 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
750
788
|
options.items.push(cutItem(this));
|
751
789
|
}
|
752
790
|
|
791
|
+
/**
|
792
|
+
* Force focus on focusableElement.
|
793
|
+
*
|
794
|
+
* @private
|
795
|
+
*/
|
796
|
+
}, {
|
797
|
+
key: "onAfterOnCellMouseUp",
|
798
|
+
value: function onAfterOnCellMouseUp() {
|
799
|
+
// Changing focused element will remove current selection. It's unnecessary in case when we give possibility
|
800
|
+
// for fragment selection
|
801
|
+
if (!this.hot.isListening() || this.isEditorOpened() || this.hot.getSettings().fragmentSelection) {
|
802
|
+
return;
|
803
|
+
}
|
804
|
+
this.getOrCreateFocusableElement();
|
805
|
+
this.focusableElement.focus();
|
806
|
+
}
|
807
|
+
|
753
808
|
/**
|
754
809
|
* Force focus on focusableElement after end of the selection.
|
755
810
|
*
|
@@ -761,10 +816,32 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
761
816
|
if (this.isEditorOpened()) {
|
762
817
|
return;
|
763
818
|
}
|
764
|
-
|
819
|
+
this.getOrCreateFocusableElement();
|
820
|
+
if (this.hot.getSettings().fragmentSelection && this.focusableElement.getFocusableElement() !== this.hot.rootDocument.activeElement && getSelectionText()) {
|
765
821
|
return;
|
766
822
|
}
|
767
823
|
this.setCopyableText();
|
824
|
+
this.focusableElement.focus();
|
825
|
+
}
|
826
|
+
|
827
|
+
/**
|
828
|
+
* `beforeKeyDown` listener to force focus of focusableElement.
|
829
|
+
*
|
830
|
+
* @private
|
831
|
+
*/
|
832
|
+
}, {
|
833
|
+
key: "onBeforeKeyDown",
|
834
|
+
value: function onBeforeKeyDown() {
|
835
|
+
if (!this.hot.isListening() || this.isEditorOpened()) {
|
836
|
+
return;
|
837
|
+
}
|
838
|
+
var activeElement = this.hot.rootDocument.activeElement;
|
839
|
+
var activeEditor = this.hot.getActiveEditor();
|
840
|
+
if (!activeEditor || activeElement !== this.focusableElement.getFocusableElement() && activeElement !== activeEditor.select) {
|
841
|
+
return;
|
842
|
+
}
|
843
|
+
this.getOrCreateFocusableElement();
|
844
|
+
this.focusableElement.focus();
|
768
845
|
}
|
769
846
|
|
770
847
|
/**
|
@@ -773,6 +850,10 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
773
850
|
}, {
|
774
851
|
key: "destroy",
|
775
852
|
value: function destroy() {
|
853
|
+
if (this.focusableElement) {
|
854
|
+
destroyElement(this.focusableElement);
|
855
|
+
this.focusableElement = null;
|
856
|
+
}
|
776
857
|
_get(_getPrototypeOf(CopyPaste.prototype), "destroy", this).call(this);
|
777
858
|
}
|
778
859
|
}], [{
|
@@ -33,6 +33,13 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
33
33
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
34
34
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
35
35
|
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; } }
|
36
|
+
/**
|
37
|
+
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
38
|
+
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
39
|
+
* appropriate data ready to copy to the clipboard.
|
40
|
+
*
|
41
|
+
* @private
|
42
|
+
*/
|
36
43
|
var _selectedRange = /*#__PURE__*/new WeakMap();
|
37
44
|
var _countRows = /*#__PURE__*/new WeakMap();
|
38
45
|
var _countColumns = /*#__PURE__*/new WeakMap();
|
@@ -41,38 +48,7 @@ var _columnsLimit = /*#__PURE__*/new WeakMap();
|
|
41
48
|
var _countColumnHeaders = /*#__PURE__*/new WeakMap();
|
42
49
|
var _trimColumnsRange = /*#__PURE__*/new WeakSet();
|
43
50
|
var _trimRowsRange = /*#__PURE__*/new WeakSet();
|
44
|
-
/**
|
45
|
-
* The utils class produces the selection ranges in the `{startRow, startCol, endRow, endCol}` format
|
46
|
-
* based on the current table selection. The CopyPaste plugin consumes that ranges to generate
|
47
|
-
* appropriate data ready to copy to the clipboard.
|
48
|
-
*
|
49
|
-
* @private
|
50
|
-
*/
|
51
51
|
var CopyableRangesFactory = /*#__PURE__*/function () {
|
52
|
-
/**
|
53
|
-
* @type {CellRange}
|
54
|
-
*/
|
55
|
-
|
56
|
-
/**
|
57
|
-
* @type {function(): number}
|
58
|
-
*/
|
59
|
-
|
60
|
-
/**
|
61
|
-
* @type {function(): number}
|
62
|
-
*/
|
63
|
-
|
64
|
-
/**
|
65
|
-
* @type {function(): number}
|
66
|
-
*/
|
67
|
-
|
68
|
-
/**
|
69
|
-
* @type {function(): number}
|
70
|
-
*/
|
71
|
-
|
72
|
-
/**
|
73
|
-
* @type {function(): number}
|
74
|
-
*/
|
75
|
-
|
76
52
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
77
53
|
/**
|
78
54
|
* @param {{
|
@@ -106,26 +82,44 @@ var CopyableRangesFactory = /*#__PURE__*/function () {
|
|
106
82
|
* @returns {number} Returns trimmed column index if it exceeds the limit.
|
107
83
|
*/
|
108
84
|
_classPrivateMethodInitSpec(this, _trimColumnsRange);
|
85
|
+
/**
|
86
|
+
* @type {CellRange}
|
87
|
+
*/
|
109
88
|
_classPrivateFieldInitSpec(this, _selectedRange, {
|
110
89
|
writable: true,
|
111
90
|
value: void 0
|
112
91
|
});
|
92
|
+
/**
|
93
|
+
* @type {function(): number}
|
94
|
+
*/
|
113
95
|
_classPrivateFieldInitSpec(this, _countRows, {
|
114
96
|
writable: true,
|
115
97
|
value: void 0
|
116
98
|
});
|
99
|
+
/**
|
100
|
+
* @type {function(): number}
|
101
|
+
*/
|
117
102
|
_classPrivateFieldInitSpec(this, _countColumns, {
|
118
103
|
writable: true,
|
119
104
|
value: void 0
|
120
105
|
});
|
106
|
+
/**
|
107
|
+
* @type {function(): number}
|
108
|
+
*/
|
121
109
|
_classPrivateFieldInitSpec(this, _rowsLimit, {
|
122
110
|
writable: true,
|
123
111
|
value: void 0
|
124
112
|
});
|
113
|
+
/**
|
114
|
+
* @type {function(): number}
|
115
|
+
*/
|
125
116
|
_classPrivateFieldInitSpec(this, _columnsLimit, {
|
126
117
|
writable: true,
|
127
118
|
value: void 0
|
128
119
|
});
|
120
|
+
/**
|
121
|
+
* @type {function(): number}
|
122
|
+
*/
|
129
123
|
_classPrivateFieldInitSpec(this, _countColumnHeaders, {
|
130
124
|
writable: true,
|
131
125
|
value: void 0
|
@@ -44,30 +44,6 @@ var _countColumnHeaders = /*#__PURE__*/new WeakMap();
|
|
44
44
|
var _trimColumnsRange = /*#__PURE__*/new WeakSet();
|
45
45
|
var _trimRowsRange = /*#__PURE__*/new WeakSet();
|
46
46
|
export var CopyableRangesFactory = /*#__PURE__*/function () {
|
47
|
-
/**
|
48
|
-
* @type {CellRange}
|
49
|
-
*/
|
50
|
-
|
51
|
-
/**
|
52
|
-
* @type {function(): number}
|
53
|
-
*/
|
54
|
-
|
55
|
-
/**
|
56
|
-
* @type {function(): number}
|
57
|
-
*/
|
58
|
-
|
59
|
-
/**
|
60
|
-
* @type {function(): number}
|
61
|
-
*/
|
62
|
-
|
63
|
-
/**
|
64
|
-
* @type {function(): number}
|
65
|
-
*/
|
66
|
-
|
67
|
-
/**
|
68
|
-
* @type {function(): number}
|
69
|
-
*/
|
70
|
-
|
71
47
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
72
48
|
/**
|
73
49
|
* @param {{
|
@@ -101,26 +77,44 @@ export var CopyableRangesFactory = /*#__PURE__*/function () {
|
|
101
77
|
* @returns {number} Returns trimmed column index if it exceeds the limit.
|
102
78
|
*/
|
103
79
|
_classPrivateMethodInitSpec(this, _trimColumnsRange);
|
80
|
+
/**
|
81
|
+
* @type {CellRange}
|
82
|
+
*/
|
104
83
|
_classPrivateFieldInitSpec(this, _selectedRange, {
|
105
84
|
writable: true,
|
106
85
|
value: void 0
|
107
86
|
});
|
87
|
+
/**
|
88
|
+
* @type {function(): number}
|
89
|
+
*/
|
108
90
|
_classPrivateFieldInitSpec(this, _countRows, {
|
109
91
|
writable: true,
|
110
92
|
value: void 0
|
111
93
|
});
|
94
|
+
/**
|
95
|
+
* @type {function(): number}
|
96
|
+
*/
|
112
97
|
_classPrivateFieldInitSpec(this, _countColumns, {
|
113
98
|
writable: true,
|
114
99
|
value: void 0
|
115
100
|
});
|
101
|
+
/**
|
102
|
+
* @type {function(): number}
|
103
|
+
*/
|
116
104
|
_classPrivateFieldInitSpec(this, _rowsLimit, {
|
117
105
|
writable: true,
|
118
106
|
value: void 0
|
119
107
|
});
|
108
|
+
/**
|
109
|
+
* @type {function(): number}
|
110
|
+
*/
|
120
111
|
_classPrivateFieldInitSpec(this, _columnsLimit, {
|
121
112
|
writable: true,
|
122
113
|
value: void 0
|
123
114
|
});
|
115
|
+
/**
|
116
|
+
* @type {function(): number}
|
117
|
+
*/
|
124
118
|
_classPrivateFieldInitSpec(this, _countColumnHeaders, {
|
125
119
|
writable: true,
|
126
120
|
value: void 0
|