handsontable 0.0.0-next-a01036f-20230508 → 0.0.0-next-48677e7-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.

Files changed (227) hide show
  1. package/3rdparty/walkontable/src/cell/coords.js +40 -13
  2. package/3rdparty/walkontable/src/cell/coords.mjs +40 -13
  3. package/3rdparty/walkontable/src/cell/range.js +29 -25
  4. package/3rdparty/walkontable/src/cell/range.mjs +28 -24
  5. package/3rdparty/walkontable/src/core/_base.js +9 -3
  6. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  7. package/3rdparty/walkontable/src/core/clone.js +2 -2
  8. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  9. package/3rdparty/walkontable/src/core/core.js +3 -2
  10. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  11. package/3rdparty/walkontable/src/event.js +12 -10
  12. package/3rdparty/walkontable/src/event.mjs +12 -10
  13. package/3rdparty/walkontable/src/facade/core.js +2 -2
  14. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  15. package/3rdparty/walkontable/src/index.js +10 -2
  16. package/3rdparty/walkontable/src/index.mjs +2 -2
  17. package/3rdparty/walkontable/src/overlay/_base.js +8 -7
  18. package/3rdparty/walkontable/src/overlay/_base.mjs +8 -7
  19. package/3rdparty/walkontable/src/overlay/bottom.js +7 -6
  20. package/3rdparty/walkontable/src/overlay/bottom.mjs +7 -6
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +9 -10
  24. package/3rdparty/walkontable/src/overlay/top.mjs +9 -10
  25. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +12 -10
  26. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +12 -10
  27. package/3rdparty/walkontable/src/overlays.js +64 -55
  28. package/3rdparty/walkontable/src/overlays.mjs +64 -55
  29. package/3rdparty/walkontable/src/renderer/table.js +2 -0
  30. package/3rdparty/walkontable/src/renderer/table.mjs +2 -0
  31. package/3rdparty/walkontable/src/scroll.js +23 -20
  32. package/3rdparty/walkontable/src/scroll.mjs +23 -20
  33. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  34. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  35. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  36. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  37. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  38. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  39. package/3rdparty/walkontable/src/selection/index.js +30 -0
  40. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  41. package/3rdparty/walkontable/src/selection/manager.js +334 -0
  42. package/3rdparty/walkontable/src/selection/manager.mjs +328 -0
  43. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  44. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  45. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  46. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  47. package/3rdparty/walkontable/src/settings.js +15 -13
  48. package/3rdparty/walkontable/src/settings.mjs +15 -13
  49. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  50. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  51. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  52. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  53. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  54. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  55. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  56. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  57. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  58. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  59. package/3rdparty/walkontable/src/table.js +33 -101
  60. package/3rdparty/walkontable/src/table.mjs +34 -102
  61. package/base.js +4 -2
  62. package/base.mjs +2 -2
  63. package/core.d.ts +4 -0
  64. package/core.js +52 -19
  65. package/core.mjs +52 -19
  66. package/dataMap/dataSource.js +5 -5
  67. package/dataMap/dataSource.mjs +5 -5
  68. package/dataMap/metaManager/metaSchema.js +8 -1
  69. package/dataMap/metaManager/metaSchema.mjs +8 -1
  70. package/dist/handsontable.css +7 -2
  71. package/dist/handsontable.full.css +7 -2
  72. package/dist/handsontable.full.js +9413 -9096
  73. package/dist/handsontable.full.min.css +3 -3
  74. package/dist/handsontable.full.min.js +115 -123
  75. package/dist/handsontable.js +9501 -9183
  76. package/dist/handsontable.min.css +3 -3
  77. package/dist/handsontable.min.js +3 -11
  78. package/dist/languages/all.js +0 -133
  79. package/dist/languages/ar-AR.js +0 -7
  80. package/dist/languages/cs-CZ.js +0 -7
  81. package/dist/languages/de-CH.js +0 -7
  82. package/dist/languages/de-DE.js +0 -7
  83. package/dist/languages/en-US.js +0 -7
  84. package/dist/languages/es-MX.js +0 -7
  85. package/dist/languages/fr-FR.js +0 -7
  86. package/dist/languages/it-IT.js +0 -7
  87. package/dist/languages/ja-JP.js +0 -7
  88. package/dist/languages/ko-KR.js +0 -7
  89. package/dist/languages/lv-LV.js +0 -7
  90. package/dist/languages/nb-NO.js +0 -7
  91. package/dist/languages/nl-NL.js +0 -7
  92. package/dist/languages/pl-PL.js +0 -7
  93. package/dist/languages/pt-BR.js +0 -7
  94. package/dist/languages/ru-RU.js +0 -7
  95. package/dist/languages/sr-SP.js +0 -7
  96. package/dist/languages/zh-CN.js +0 -7
  97. package/dist/languages/zh-TW.js +0 -7
  98. package/editorManager.js +7 -3
  99. package/editorManager.mjs +7 -3
  100. package/editors/textEditor/textEditor.js +3 -16
  101. package/editors/textEditor/textEditor.mjs +4 -17
  102. package/focusManager.d.ts +12 -0
  103. package/focusManager.js +249 -0
  104. package/focusManager.mjs +245 -0
  105. package/helpers/dom/element.js +11 -0
  106. package/helpers/dom/element.mjs +10 -0
  107. package/helpers/mixed.js +1 -1
  108. package/helpers/mixed.mjs +1 -1
  109. package/i18n/languages/ar-AR.js +1 -7
  110. package/i18n/languages/cs-CZ.js +1 -7
  111. package/i18n/languages/de-CH.js +1 -7
  112. package/i18n/languages/de-DE.js +1 -7
  113. package/i18n/languages/en-US.js +1 -7
  114. package/i18n/languages/es-MX.js +1 -7
  115. package/i18n/languages/fr-FR.js +1 -7
  116. package/i18n/languages/it-IT.js +1 -7
  117. package/i18n/languages/ja-JP.js +1 -7
  118. package/i18n/languages/ko-KR.js +1 -7
  119. package/i18n/languages/lv-LV.js +1 -7
  120. package/i18n/languages/nb-NO.js +1 -7
  121. package/i18n/languages/nl-NL.js +1 -7
  122. package/i18n/languages/pl-PL.js +1 -7
  123. package/i18n/languages/pt-BR.js +1 -7
  124. package/i18n/languages/ru-RU.js +1 -7
  125. package/i18n/languages/sr-SP.js +1 -7
  126. package/i18n/languages/zh-CN.js +1 -7
  127. package/i18n/languages/zh-TW.js +1 -7
  128. package/languages/all.js +0 -133
  129. package/languages/ar-AR.js +0 -7
  130. package/languages/cs-CZ.js +0 -7
  131. package/languages/de-CH.js +0 -7
  132. package/languages/de-DE.js +0 -7
  133. package/languages/en-US.js +0 -7
  134. package/languages/es-MX.js +0 -7
  135. package/languages/fr-FR.js +0 -7
  136. package/languages/index.js +0 -133
  137. package/languages/it-IT.js +0 -7
  138. package/languages/ja-JP.js +0 -7
  139. package/languages/ko-KR.js +0 -7
  140. package/languages/lv-LV.js +0 -7
  141. package/languages/nb-NO.js +0 -7
  142. package/languages/nl-NL.js +0 -7
  143. package/languages/pl-PL.js +0 -7
  144. package/languages/pt-BR.js +0 -7
  145. package/languages/ru-RU.js +0 -7
  146. package/languages/sr-SP.js +0 -7
  147. package/languages/zh-CN.js +0 -7
  148. package/languages/zh-TW.js +0 -7
  149. package/package.json +2 -3
  150. package/pluginHooks.js +7 -17
  151. package/pluginHooks.mjs +4 -16
  152. package/plugins/autoRowSize/autoRowSize.js +2 -2
  153. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  154. package/plugins/copyPaste/copyPaste.js +12 -93
  155. package/plugins/copyPaste/copyPaste.mjs +12 -93
  156. package/plugins/copyPaste/copyableRanges.js +31 -25
  157. package/plugins/copyPaste/copyableRanges.mjs +24 -18
  158. package/plugins/customBorders/customBorders.js +6 -2
  159. package/plugins/customBorders/customBorders.mjs +7 -3
  160. package/plugins/filters/filters.js +0 -5
  161. package/plugins/filters/filters.mjs +0 -5
  162. package/plugins/formulas/formulas.js +168 -190
  163. package/plugins/formulas/formulas.mjs +168 -190
  164. package/plugins/mergeCells/mergeCells.js +0 -16
  165. package/plugins/mergeCells/mergeCells.mjs +0 -16
  166. package/plugins/nestedHeaders/nestedHeaders.js +3 -4
  167. package/plugins/nestedHeaders/nestedHeaders.mjs +3 -4
  168. package/plugins/nestedHeaders/stateManager/headersTree.js +26 -23
  169. package/plugins/nestedHeaders/stateManager/headersTree.mjs +23 -20
  170. package/plugins/nestedHeaders/stateManager/index.js +3 -3
  171. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +0 -1
  172. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
  173. package/plugins/nestedHeaders/utils/ghostTable.js +35 -30
  174. package/plugins/nestedHeaders/utils/ghostTable.mjs +35 -30
  175. package/plugins/registry.js +1 -3
  176. package/plugins/undoRedo/undoRedo.js +1 -0
  177. package/plugins/undoRedo/undoRedo.mjs +1 -0
  178. package/renderers/baseRenderer/baseRenderer.js +3 -0
  179. package/renderers/baseRenderer/baseRenderer.mjs +3 -0
  180. package/selection/highlight/highlight.js +335 -133
  181. package/selection/highlight/highlight.mjs +325 -129
  182. package/selection/highlight/types/activeHeader.js +10 -9
  183. package/selection/highlight/types/activeHeader.mjs +10 -8
  184. package/selection/highlight/types/area.js +12 -27
  185. package/selection/highlight/types/area.mjs +16 -30
  186. package/selection/highlight/types/areaLayered.js +54 -0
  187. package/selection/highlight/types/areaLayered.mjs +49 -0
  188. package/selection/highlight/types/column.js +50 -0
  189. package/selection/highlight/types/column.mjs +45 -0
  190. package/selection/highlight/types/customSelection.js +7 -10
  191. package/selection/highlight/types/customSelection.mjs +7 -9
  192. package/selection/highlight/types/fill.js +5 -8
  193. package/selection/highlight/types/fill.mjs +5 -7
  194. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  195. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  196. package/selection/highlight/types/header.js +10 -20
  197. package/selection/highlight/types/header.mjs +10 -19
  198. package/selection/highlight/types/{index.js → row.js} +27 -31
  199. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  200. package/selection/highlight/visualSelection.js +12 -21
  201. package/selection/highlight/visualSelection.mjs +12 -21
  202. package/selection/index.js +4 -7
  203. package/selection/index.mjs +2 -3
  204. package/selection/selection.js +88 -46
  205. package/selection/selection.mjs +82 -44
  206. package/settings.d.ts +1 -0
  207. package/tableView.js +94 -66
  208. package/tableView.mjs +94 -66
  209. package/translations/changesObservable/observable.js +46 -41
  210. package/translations/changesObservable/observable.mjs +41 -36
  211. package/translations/changesObservable/observer.js +1 -1
  212. package/translations/indexMapper.js +0 -21
  213. package/translations/indexMapper.mjs +0 -21
  214. package/utils/dataStructures/tree.js +18 -15
  215. package/utils/dataStructures/tree.mjs +18 -15
  216. package/utils/parseTable.js +1 -5
  217. package/utils/parseTable.mjs +1 -5
  218. package/3rdparty/walkontable/src/selection.js +0 -354
  219. package/3rdparty/walkontable/src/selection.mjs +0 -348
  220. package/plugins/copyPaste/focusableElement.js +0 -219
  221. package/plugins/copyPaste/focusableElement.mjs +0 -213
  222. package/plugins/formulas/indexSyncer/axisSyncer.js +0 -379
  223. package/plugins/formulas/indexSyncer/axisSyncer.mjs +0 -374
  224. package/plugins/formulas/indexSyncer/index.js +0 -225
  225. package/plugins/formulas/indexSyncer/index.mjs +0 -219
  226. package/selection/highlight/constants.js +0 -16
  227. package/selection/highlight/constants.mjs +0 -6
@@ -33,16 +33,15 @@ 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");
37
36
  var _copy = _interopRequireDefault(require("./contextMenuItem/copy"));
38
37
  var _copyColumnHeadersOnly = _interopRequireDefault(require("./contextMenuItem/copyColumnHeadersOnly"));
39
38
  var _copyWithColumnGroupHeaders = _interopRequireDefault(require("./contextMenuItem/copyWithColumnGroupHeaders"));
40
39
  var _copyWithColumnHeaders = _interopRequireDefault(require("./contextMenuItem/copyWithColumnHeaders"));
41
40
  var _cut = _interopRequireDefault(require("./contextMenuItem/cut"));
42
41
  var _pasteEvent = _interopRequireDefault(require("./pasteEvent"));
43
- var _focusableElement = require("./focusableElement");
44
42
  var _copyableRanges = require("./copyableRanges");
45
43
  var _parseTable = require("../../utils/parseTable");
44
+ var _eventManager = _interopRequireDefault(require("../../eventManager"));
46
45
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
46
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
47
  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."); }
@@ -279,13 +278,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
279
278
  * @type {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>}
280
279
  */
281
280
  _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);
289
281
  return _this;
290
282
  }
291
283
  _createClass(CopyPaste, [{
@@ -328,22 +320,18 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
328
320
  this.addHook('afterContextMenuDefaultOptions', function (options) {
329
321
  return _this2.onAfterContextMenuDefaultOptions(options);
330
322
  });
331
- this.addHook('afterOnCellMouseUp', function () {
332
- return _this2.onAfterOnCellMouseUp();
333
- });
334
323
  this.addHook('afterSelectionEnd', function () {
335
324
  return _this2.onAfterSelectionEnd();
336
325
  });
337
- this.addHook('beforeKeyDown', function () {
338
- return _this2.onBeforeKeyDown();
326
+ this.eventManager = new _eventManager.default(this);
327
+ this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {
328
+ return _this2.onCopy.apply(_this2, arguments);
339
329
  });
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);
330
+ this.eventManager.addEventListener(this.hot.rootDocument, 'cut', function () {
331
+ return _this2.onCut.apply(_this2, arguments);
332
+ });
333
+ this.eventManager.addEventListener(this.hot.rootDocument, 'paste', function () {
334
+ return _this2.onPaste.apply(_this2, arguments);
347
335
  });
348
336
  _get(_getPrototypeOf(CopyPaste.prototype), "enablePlugin", this).call(this);
349
337
  }
@@ -361,7 +349,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
361
349
  value: function updatePlugin() {
362
350
  this.disablePlugin();
363
351
  this.enablePlugin();
364
- this.getOrCreateFocusableElement();
365
352
  _get(_getPrototypeOf(CopyPaste.prototype), "updatePlugin", this).call(this);
366
353
  }
367
354
 
@@ -371,9 +358,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
371
358
  }, {
372
359
  key: "disablePlugin",
373
360
  value: function disablePlugin() {
374
- if (this.focusableElement) {
375
- (0, _focusableElement.destroyElement)(this.focusableElement);
376
- }
377
361
  _get(_getPrototypeOf(CopyPaste.prototype), "disablePlugin", this).call(this);
378
362
  }
379
363
 
@@ -397,8 +381,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
397
381
  var copyMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cells-only';
398
382
  _classPrivateFieldSet(this, _copyMode, copyMode);
399
383
  _classPrivateFieldSet(this, _isTriggeredByCopy, true);
400
- this.getOrCreateFocusableElement();
401
- this.focusableElement.focus();
402
384
  this.hot.rootDocument.execCommand('copy');
403
385
  }
404
386
 
@@ -442,8 +424,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
442
424
  key: "cut",
443
425
  value: function cut() {
444
426
  _classPrivateFieldSet(this, _isTriggeredByCut, true);
445
- this.getOrCreateFocusableElement();
446
- this.focusableElement.focus();
447
427
  this.hot.rootDocument.execCommand('cut');
448
428
  }
449
429
 
@@ -513,7 +493,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
513
493
  if (pastableHtml) {
514
494
  pasteData.clipboardData.setData('text/html', pastableHtml);
515
495
  }
516
- this.getOrCreateFocusableElement();
517
496
  this.onPaste(pasteData);
518
497
  }
519
498
 
@@ -564,23 +543,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
564
543
  }
565
544
  }
566
545
 
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
-
584
546
  /**
585
547
  * Verifies if editor exists and is open.
586
548
  *
@@ -590,8 +552,8 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
590
552
  }, {
591
553
  key: "isEditorOpened",
592
554
  value: function isEditorOpened() {
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();
555
+ var _this$hot$getActiveEd;
556
+ return (_this$hot$getActiveEd = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd === void 0 ? void 0 : _this$hot$getActiveEd.isOpened();
595
557
  }
596
558
  }, {
597
559
  key: "populateValues",
@@ -795,23 +757,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
795
757
  options.items.push((0, _cut.default)(this));
796
758
  }
797
759
 
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
-
815
760
  /**
816
761
  * Force focus on focusableElement after end of the selection.
817
762
  *
@@ -823,32 +768,10 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
823
768
  if (this.isEditorOpened()) {
824
769
  return;
825
770
  }
826
- this.getOrCreateFocusableElement();
827
- if (this.hot.getSettings().fragmentSelection && this.focusableElement.getFocusableElement() !== this.hot.rootDocument.activeElement && (0, _element.getSelectionText)()) {
771
+ if (this.hot.getSettings().fragmentSelection) {
828
772
  return;
829
773
  }
830
774
  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();
852
775
  }
853
776
 
854
777
  /**
@@ -857,10 +780,6 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
857
780
  }, {
858
781
  key: "destroy",
859
782
  value: function destroy() {
860
- if (this.focusableElement) {
861
- (0, _focusableElement.destroyElement)(this.focusableElement);
862
- this.focusableElement = null;
863
- }
864
783
  _get(_getPrototypeOf(CopyPaste.prototype), "destroy", this).call(this);
865
784
  }
866
785
  }], [{
@@ -60,16 +60,15 @@ 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";
64
63
  import copyItem from "./contextMenuItem/copy.mjs";
65
64
  import copyColumnHeadersOnlyItem from "./contextMenuItem/copyColumnHeadersOnly.mjs";
66
65
  import copyWithColumnGroupHeadersItem from "./contextMenuItem/copyWithColumnGroupHeaders.mjs";
67
66
  import copyWithColumnHeadersItem from "./contextMenuItem/copyWithColumnHeaders.mjs";
68
67
  import cutItem from "./contextMenuItem/cut.mjs";
69
68
  import PasteEvent from "./pasteEvent.mjs";
70
- import { createElement, destroyElement } from "./focusableElement.mjs";
71
69
  import { CopyableRangesFactory, normalizeRanges } from "./copyableRanges.mjs";
72
70
  import { _dataToHTML, htmlToGridSettings } from "../../utils/parseTable.mjs";
71
+ import EventManager from "../../eventManager.mjs";
73
72
  Hooks.getSingleton().register('afterCopyLimit');
74
73
  Hooks.getSingleton().register('modifyCopyableRange');
75
74
  Hooks.getSingleton().register('beforeCut');
@@ -272,13 +271,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
272
271
  * @type {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>}
273
272
  */
274
273
  _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);
282
274
  return _this;
283
275
  }
284
276
  _createClass(CopyPaste, [{
@@ -321,22 +313,18 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
321
313
  this.addHook('afterContextMenuDefaultOptions', function (options) {
322
314
  return _this2.onAfterContextMenuDefaultOptions(options);
323
315
  });
324
- this.addHook('afterOnCellMouseUp', function () {
325
- return _this2.onAfterOnCellMouseUp();
326
- });
327
316
  this.addHook('afterSelectionEnd', function () {
328
317
  return _this2.onAfterSelectionEnd();
329
318
  });
330
- this.addHook('beforeKeyDown', function () {
331
- return _this2.onBeforeKeyDown();
319
+ this.eventManager = new EventManager(this);
320
+ this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {
321
+ return _this2.onCopy.apply(_this2, arguments);
332
322
  });
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);
323
+ this.eventManager.addEventListener(this.hot.rootDocument, 'cut', function () {
324
+ return _this2.onCut.apply(_this2, arguments);
325
+ });
326
+ this.eventManager.addEventListener(this.hot.rootDocument, 'paste', function () {
327
+ return _this2.onPaste.apply(_this2, arguments);
340
328
  });
341
329
  _get(_getPrototypeOf(CopyPaste.prototype), "enablePlugin", this).call(this);
342
330
  }
@@ -354,7 +342,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
354
342
  value: function updatePlugin() {
355
343
  this.disablePlugin();
356
344
  this.enablePlugin();
357
- this.getOrCreateFocusableElement();
358
345
  _get(_getPrototypeOf(CopyPaste.prototype), "updatePlugin", this).call(this);
359
346
  }
360
347
 
@@ -364,9 +351,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
364
351
  }, {
365
352
  key: "disablePlugin",
366
353
  value: function disablePlugin() {
367
- if (this.focusableElement) {
368
- destroyElement(this.focusableElement);
369
- }
370
354
  _get(_getPrototypeOf(CopyPaste.prototype), "disablePlugin", this).call(this);
371
355
  }
372
356
 
@@ -390,8 +374,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
390
374
  var copyMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cells-only';
391
375
  _classPrivateFieldSet(this, _copyMode, copyMode);
392
376
  _classPrivateFieldSet(this, _isTriggeredByCopy, true);
393
- this.getOrCreateFocusableElement();
394
- this.focusableElement.focus();
395
377
  this.hot.rootDocument.execCommand('copy');
396
378
  }
397
379
 
@@ -435,8 +417,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
435
417
  key: "cut",
436
418
  value: function cut() {
437
419
  _classPrivateFieldSet(this, _isTriggeredByCut, true);
438
- this.getOrCreateFocusableElement();
439
- this.focusableElement.focus();
440
420
  this.hot.rootDocument.execCommand('cut');
441
421
  }
442
422
 
@@ -506,7 +486,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
506
486
  if (pastableHtml) {
507
487
  pasteData.clipboardData.setData('text/html', pastableHtml);
508
488
  }
509
- this.getOrCreateFocusableElement();
510
489
  this.onPaste(pasteData);
511
490
  }
512
491
 
@@ -557,23 +536,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
557
536
  }
558
537
  }
559
538
 
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
-
577
539
  /**
578
540
  * Verifies if editor exists and is open.
579
541
  *
@@ -583,8 +545,8 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
583
545
  }, {
584
546
  key: "isEditorOpened",
585
547
  value: function isEditorOpened() {
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();
548
+ var _this$hot$getActiveEd;
549
+ return (_this$hot$getActiveEd = this.hot.getActiveEditor()) === null || _this$hot$getActiveEd === void 0 ? void 0 : _this$hot$getActiveEd.isOpened();
588
550
  }
589
551
  }, {
590
552
  key: "populateValues",
@@ -788,23 +750,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
788
750
  options.items.push(cutItem(this));
789
751
  }
790
752
 
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
-
808
753
  /**
809
754
  * Force focus on focusableElement after end of the selection.
810
755
  *
@@ -816,32 +761,10 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
816
761
  if (this.isEditorOpened()) {
817
762
  return;
818
763
  }
819
- this.getOrCreateFocusableElement();
820
- if (this.hot.getSettings().fragmentSelection && this.focusableElement.getFocusableElement() !== this.hot.rootDocument.activeElement && getSelectionText()) {
764
+ if (this.hot.getSettings().fragmentSelection) {
821
765
  return;
822
766
  }
823
767
  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();
845
768
  }
846
769
 
847
770
  /**
@@ -850,10 +773,6 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
850
773
  }, {
851
774
  key: "destroy",
852
775
  value: function destroy() {
853
- if (this.focusableElement) {
854
- destroyElement(this.focusableElement);
855
- this.focusableElement = null;
856
- }
857
776
  _get(_getPrototypeOf(CopyPaste.prototype), "destroy", this).call(this);
858
777
  }
859
778
  }], [{
@@ -33,13 +33,6 @@ 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
- */
43
36
  var _selectedRange = /*#__PURE__*/new WeakMap();
44
37
  var _countRows = /*#__PURE__*/new WeakMap();
45
38
  var _countColumns = /*#__PURE__*/new WeakMap();
@@ -48,7 +41,38 @@ var _columnsLimit = /*#__PURE__*/new WeakMap();
48
41
  var _countColumnHeaders = /*#__PURE__*/new WeakMap();
49
42
  var _trimColumnsRange = /*#__PURE__*/new WeakSet();
50
43
  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
+
52
76
  /* eslint-disable jsdoc/require-description-complete-sentence */
53
77
  /**
54
78
  * @param {{
@@ -82,44 +106,26 @@ var CopyableRangesFactory = /*#__PURE__*/function () {
82
106
  * @returns {number} Returns trimmed column index if it exceeds the limit.
83
107
  */
84
108
  _classPrivateMethodInitSpec(this, _trimColumnsRange);
85
- /**
86
- * @type {CellRange}
87
- */
88
109
  _classPrivateFieldInitSpec(this, _selectedRange, {
89
110
  writable: true,
90
111
  value: void 0
91
112
  });
92
- /**
93
- * @type {function(): number}
94
- */
95
113
  _classPrivateFieldInitSpec(this, _countRows, {
96
114
  writable: true,
97
115
  value: void 0
98
116
  });
99
- /**
100
- * @type {function(): number}
101
- */
102
117
  _classPrivateFieldInitSpec(this, _countColumns, {
103
118
  writable: true,
104
119
  value: void 0
105
120
  });
106
- /**
107
- * @type {function(): number}
108
- */
109
121
  _classPrivateFieldInitSpec(this, _rowsLimit, {
110
122
  writable: true,
111
123
  value: void 0
112
124
  });
113
- /**
114
- * @type {function(): number}
115
- */
116
125
  _classPrivateFieldInitSpec(this, _columnsLimit, {
117
126
  writable: true,
118
127
  value: void 0
119
128
  });
120
- /**
121
- * @type {function(): number}
122
- */
123
129
  _classPrivateFieldInitSpec(this, _countColumnHeaders, {
124
130
  writable: true,
125
131
  value: void 0
@@ -44,6 +44,30 @@ 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
+
47
71
  /* eslint-disable jsdoc/require-description-complete-sentence */
48
72
  /**
49
73
  * @param {{
@@ -77,44 +101,26 @@ export var CopyableRangesFactory = /*#__PURE__*/function () {
77
101
  * @returns {number} Returns trimmed column index if it exceeds the limit.
78
102
  */
79
103
  _classPrivateMethodInitSpec(this, _trimColumnsRange);
80
- /**
81
- * @type {CellRange}
82
- */
83
104
  _classPrivateFieldInitSpec(this, _selectedRange, {
84
105
  writable: true,
85
106
  value: void 0
86
107
  });
87
- /**
88
- * @type {function(): number}
89
- */
90
108
  _classPrivateFieldInitSpec(this, _countRows, {
91
109
  writable: true,
92
110
  value: void 0
93
111
  });
94
- /**
95
- * @type {function(): number}
96
- */
97
112
  _classPrivateFieldInitSpec(this, _countColumns, {
98
113
  writable: true,
99
114
  value: void 0
100
115
  });
101
- /**
102
- * @type {function(): number}
103
- */
104
116
  _classPrivateFieldInitSpec(this, _rowsLimit, {
105
117
  writable: true,
106
118
  value: void 0
107
119
  });
108
- /**
109
- * @type {function(): number}
110
- */
111
120
  _classPrivateFieldInitSpec(this, _columnsLimit, {
112
121
  writable: true,
113
122
  value: void 0
114
123
  });
115
- /**
116
- * @type {function(): number}
117
- */
118
124
  _classPrivateFieldInitSpec(this, _countColumnHeaders, {
119
125
  writable: true,
120
126
  value: void 0
@@ -735,10 +735,12 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
735
735
  }, {
736
736
  key: "checkCustomSelectionsFromContextMenu",
737
737
  value: function checkCustomSelectionsFromContextMenu(border, place, remove) {
738
+ var _this12 = this;
738
739
  var check = false;
739
740
  (0, _array.arrayEach)(this.hot.selection.highlight.customSelections, function (customSelection) {
740
741
  if (border.id === customSelection.settings.id) {
741
- (0, _object.objectEach)(customSelection.instanceBorders, function (borderObject) {
742
+ var borders = _this12.hot.view._wt.selectionManager.getBorderInstances(customSelection);
743
+ (0, _array.arrayEach)(borders, function (borderObject) {
742
744
  borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
743
745
  });
744
746
 
@@ -763,6 +765,7 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
763
765
  }, {
764
766
  key: "checkCustomSelections",
765
767
  value: function checkCustomSelections(border, cellRange, place) {
768
+ var _this13 = this;
766
769
  var hideCount = this.countHide(border);
767
770
  var check = false;
768
771
  if (hideCount === 4) {
@@ -774,7 +777,8 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
774
777
  customSelection.visualCellRange = cellRange;
775
778
  customSelection.commit();
776
779
  if (place) {
777
- (0, _object.objectEach)(customSelection.instanceBorders, function (borderObject) {
780
+ var borders = _this13.hot.view._wt.selectionManager.getBorderInstances(customSelection);
781
+ (0, _array.arrayEach)(borders, function (borderObject) {
778
782
  borderObject.changeBorderStyle(place, border);
779
783
  });
780
784
  }
@@ -45,7 +45,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
45
45
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
46
46
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
47
47
  import { BasePlugin } from "../base/index.mjs";
48
- import { hasOwnProperty, objectEach, deepClone } from "../../helpers/object.mjs";
48
+ import { hasOwnProperty, deepClone } from "../../helpers/object.mjs";
49
49
  import { rangeEach } from "../../helpers/number.mjs";
50
50
  import { arrayEach, arrayReduce, arrayMap } from "../../helpers/array.mjs";
51
51
  import * as C from "../../i18n/constants.mjs";
@@ -726,10 +726,12 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
726
726
  }, {
727
727
  key: "checkCustomSelectionsFromContextMenu",
728
728
  value: function checkCustomSelectionsFromContextMenu(border, place, remove) {
729
+ var _this12 = this;
729
730
  var check = false;
730
731
  arrayEach(this.hot.selection.highlight.customSelections, function (customSelection) {
731
732
  if (border.id === customSelection.settings.id) {
732
- objectEach(customSelection.instanceBorders, function (borderObject) {
733
+ var borders = _this12.hot.view._wt.selectionManager.getBorderInstances(customSelection);
734
+ arrayEach(borders, function (borderObject) {
733
735
  borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
734
736
  });
735
737
 
@@ -754,6 +756,7 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
754
756
  }, {
755
757
  key: "checkCustomSelections",
756
758
  value: function checkCustomSelections(border, cellRange, place) {
759
+ var _this13 = this;
757
760
  var hideCount = this.countHide(border);
758
761
  var check = false;
759
762
  if (hideCount === 4) {
@@ -765,7 +768,8 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
765
768
  customSelection.visualCellRange = cellRange;
766
769
  customSelection.commit();
767
770
  if (place) {
768
- objectEach(customSelection.instanceBorders, function (borderObject) {
771
+ var borders = _this13.hot.view._wt.selectionManager.getBorderInstances(customSelection);
772
+ arrayEach(borders, function (borderObject) {
769
773
  borderObject.changeBorderStyle(place, border);
770
774
  });
771
775
  }
@@ -329,11 +329,6 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
329
329
  * * `between` - Between
330
330
  * * `by_value` - By value
331
331
  * * `contains` - Contains
332
- * * `date_after` - After a date
333
- * * `date_before` - Before a date
334
- * * `date_today` - Today
335
- * * `date_tomorrow` - Tomorrow
336
- * * `date_yesterday` - Yesterday
337
332
  * * `empty` - Empty
338
333
  * * `ends_with` - Ends with
339
334
  * * `eq` - Equal