handsontable 0.0.0-next-5e7f0fe-20230504 → 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 +49 -8
  65. package/core.mjs +49 -8
  66. package/dataMap/dataSource.js +5 -5
  67. package/dataMap/dataSource.mjs +5 -5
  68. package/dataMap/metaManager/metaSchema.js +7 -0
  69. package/dataMap/metaManager/metaSchema.mjs +7 -0
  70. package/dist/handsontable.css +7 -2
  71. package/dist/handsontable.full.css +7 -2
  72. package/dist/handsontable.full.js +9409 -9084
  73. package/dist/handsontable.full.min.css +3 -3
  74. package/dist/handsontable.full.min.js +115 -123
  75. package/dist/handsontable.js +9497 -9171
  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
@@ -42,7 +42,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
42
42
  import { BaseEditor, EDITOR_STATE } from "../baseEditor/index.mjs";
43
43
  import EventManager from "../../eventManager.mjs";
44
44
  import { isMobileBrowser, isIE, isEdge, isIOS } from "../../helpers/browser.mjs";
45
- import { addClass, getComputedStyle, setCaretPosition, hasClass, removeClass } from "../../helpers/dom/element.mjs";
45
+ import { addClass, getComputedStyle, isHotChild, setCaretPosition, hasClass, removeClass } from "../../helpers/dom/element.mjs";
46
46
  import { rangeEach } from "../../helpers/number.mjs";
47
47
  import { KEY_CODES } from "../../helpers/unicode.mjs";
48
48
  import { autoResize } from "../../3rdparty/autoResize/index.mjs";
@@ -172,7 +172,7 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
172
172
  key: "close",
173
173
  value: function close() {
174
174
  this.autoResize.unObserve();
175
- if (this.hot.rootDocument.activeElement === this.TEXTAREA) {
175
+ if (isHotChild(this.hot.rootDocument.activeElement)) {
176
176
  this.hot.listen(); // don't refocus the table if user focused some cell outside of HT on purpose
177
177
  }
178
178
 
@@ -212,7 +212,7 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
212
212
  // @TODO: The fragmentSelection functionality is conflicted with IME. For this feature
213
213
  // refocus has to be disabled (to make IME working).
214
214
  var restoreFocus = !fragmentSelection;
215
- if (restoreFocus && !isMobileBrowser()) {
215
+ if (this.hot.getSettings().imeFastEdit && restoreFocus && !isMobileBrowser()) {
216
216
  this.focus();
217
217
  }
218
218
  }
@@ -257,6 +257,7 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
257
257
  this.TEXTAREA = rootDocument.createElement('TEXTAREA');
258
258
  this.TEXTAREA.setAttribute('data-hot-input', ''); // Makes the element recognizable by Hot as its own component's element.
259
259
  this.TEXTAREA.tabIndex = -1;
260
+ this.TEXTAREA.setAttribute('aria-hidden', 'true');
260
261
  addClass(this.TEXTAREA, 'handsontableInput');
261
262
  this.textareaStyle = this.TEXTAREA.style;
262
263
  this.textareaStyle.width = 0;
@@ -404,12 +405,6 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
404
405
  key: "bindEvents",
405
406
  value: function bindEvents() {
406
407
  var _this3 = this;
407
- this.eventManager.addEventListener(this.TEXTAREA, 'cut', function (event) {
408
- return event.stopPropagation();
409
- });
410
- this.eventManager.addEventListener(this.TEXTAREA, 'paste', function (event) {
411
- return event.stopPropagation();
412
- });
413
408
  if (isIOS()) {
414
409
  // on iOS after click "Done" the edit isn't hidden by default, so we need to handle it manually.
415
410
  this.eventManager.addEventListener(this.TEXTAREA, 'focusout', function () {
@@ -422,14 +417,6 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
422
417
  this.addHook('afterScrollVertically', function () {
423
418
  return _this3.refreshDimensions();
424
419
  });
425
- this.addHook('afterColumnResize', function () {
426
- _this3.refreshDimensions();
427
- _this3.focus();
428
- });
429
- this.addHook('afterRowResize', function () {
430
- _this3.refreshDimensions();
431
- _this3.focus();
432
- });
433
420
  }
434
421
 
435
422
  /**
@@ -0,0 +1,12 @@
1
+ type FocusMode = 'cell' | 'mixed';
2
+
3
+ export interface FocusManager {
4
+ getFocusMode(): FocusMode;
5
+ setFocusMode(focusMode: FocusMode): void;
6
+ getRefocusDelay(): number;
7
+ setRefocusDelay(delay: number): void;
8
+ setRefocusElementGetter(getterFn: () => HTMLElement): void;
9
+ getRefocusElement(): HTMLElement | void;
10
+ focusOnHighlightedCell(): void;
11
+ refocusToEditorTextarea(delay: number): void;
12
+ }
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.to-primitive.js");
4
+ require("core-js/modules/es.date.to-primitive.js");
5
+ require("core-js/modules/es.symbol.js");
6
+ require("core-js/modules/es.symbol.description.js");
7
+ require("core-js/modules/es.number.constructor.js");
8
+ require("core-js/modules/es.symbol.iterator.js");
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ exports.__esModule = true;
11
+ exports.default = void 0;
12
+ require("core-js/modules/es.array.concat.js");
13
+ require("core-js/modules/es.array.includes.js");
14
+ require("core-js/modules/es.string.includes.js");
15
+ require("core-js/modules/es.object.values.js");
16
+ require("core-js/modules/es.array.iterator.js");
17
+ require("core-js/modules/es.object.to-string.js");
18
+ require("core-js/modules/es.string.iterator.js");
19
+ require("core-js/modules/es.weak-set.js");
20
+ require("core-js/modules/web.dom-collections.iterator.js");
21
+ var _console = require("./helpers/console");
22
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
+ 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); }
27
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
28
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
29
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
30
+ /**
31
+ * Possible focus modes.
32
+ * - CELL - The browser's focus stays on the lastly selected cell element.
33
+ * - MIXED - The browser's focus switches from the lastly selected cell element to the currently active editor's
34
+ * `TEXTAREA` element after a delay defined in the manager.
35
+ *
36
+ * @type {{CELL: string, MIXED: string}}
37
+ */
38
+ var FOCUS_MODES = {
39
+ CELL: 'cell',
40
+ MIXED: 'mixed'
41
+ };
42
+
43
+ /**
44
+ * Manages the browser's focus in the table.
45
+ */
46
+ var _manageFocus = /*#__PURE__*/new WeakSet();
47
+ var _onUpdateSettings = /*#__PURE__*/new WeakSet();
48
+ var FocusManager = /*#__PURE__*/function () {
49
+ function FocusManager(hotInstance) {
50
+ var _this = this;
51
+ _classCallCheck(this, FocusManager);
52
+ /**
53
+ * Update the manager configuration after calling `updateSettings`.
54
+ *
55
+ * @private
56
+ * @param {object} newSettings The new settings passed to the `updateSettings` method.
57
+ */
58
+ _classPrivateMethodInitSpec(this, _onUpdateSettings);
59
+ /**
60
+ * Manage the browser's focus after cell selection.
61
+ *
62
+ * @private
63
+ */
64
+ _classPrivateMethodInitSpec(this, _manageFocus);
65
+ var hotSettings = hotInstance.getSettings();
66
+
67
+ /**
68
+ * The Handsontable instance.
69
+ *
70
+ * @private
71
+ */
72
+ this._hot = hotInstance;
73
+
74
+ /**
75
+ * The currently enabled focus mode.
76
+ * Can be either:
77
+ *
78
+ * - 'cell' - The browser's focus stays on the lastly selected cell element.
79
+ * - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
80
+ * `TEXTAREA` element after a delay defined in the manager.
81
+ *
82
+ * @type {string}
83
+ * @private
84
+ */
85
+ this._focusMode = hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL;
86
+
87
+ /**
88
+ * The delay after which the focus switches from the lastly selected cell to the active editor's `TEXTAREA`
89
+ * element if the focus mode is set to 'mixed'.
90
+ *
91
+ * @type {number}
92
+ * @private
93
+ */
94
+ this._refocusDelay = 50;
95
+
96
+ /**
97
+ * Getter function for the element to be used when refocusing the browser after a delay. If `null`, the active
98
+ * editor's `TEXTAREA` element will be used.
99
+ *
100
+ * @type {null|Function}
101
+ * @private
102
+ */
103
+ this._refocusElementGetter = null;
104
+ this._hot.addHook('afterUpdateSettings', function () {
105
+ var _classPrivateMethodGe;
106
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
107
+ args[_key] = arguments[_key];
108
+ }
109
+ return (_classPrivateMethodGe = _classPrivateMethodGet(_this, _onUpdateSettings, _onUpdateSettings2)).call.apply(_classPrivateMethodGe, [_this].concat(args));
110
+ });
111
+ this._hot.addHook('afterSelectionEnd', function () {
112
+ var _classPrivateMethodGe2;
113
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
114
+ args[_key2] = arguments[_key2];
115
+ }
116
+ return (_classPrivateMethodGe2 = _classPrivateMethodGet(_this, _manageFocus, _manageFocus2)).call.apply(_classPrivateMethodGe2, [_this].concat(args));
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Get the current focus mode.
122
+ *
123
+ * @returns {string}
124
+ */
125
+ _createClass(FocusManager, [{
126
+ key: "getFocusMode",
127
+ value: function getFocusMode() {
128
+ return this._focusMode;
129
+ }
130
+
131
+ /**
132
+ * Set the focus mode.
133
+ *
134
+ * @param {string} focusMode The new focus mode.
135
+ */
136
+ }, {
137
+ key: "setFocusMode",
138
+ value: function setFocusMode(focusMode) {
139
+ if (Object.values(FOCUS_MODES).includes(focusMode)) {
140
+ this._focusMode = focusMode;
141
+ } else {
142
+ (0, _console.warn)("\"".concat(focusMode, "\" is not a valid focus mode."));
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Get the delay after which the focus will change from the cell elements to the active editor's `TEXTAREA`
148
+ * element if the focus mode is set to 'mixed'.
149
+ *
150
+ * @returns {number} Delay in milliseconds.
151
+ */
152
+ }, {
153
+ key: "getRefocusDelay",
154
+ value: function getRefocusDelay() {
155
+ return this._refocusDelay;
156
+ }
157
+
158
+ /**
159
+ * Set the delay after which the focus will change from the cell elements to the active editor's `TEXTAREA`
160
+ * element if the focus mode is set to 'mixed'.
161
+ *
162
+ * @param {number} delay Delay in milliseconds.
163
+ */
164
+ }, {
165
+ key: "setRefocusDelay",
166
+ value: function setRefocusDelay(delay) {
167
+ this._refocusDelay = delay;
168
+ }
169
+
170
+ /**
171
+ * Set the function to be used as the "refocus element" getter. It should return a focusable HTML element.
172
+ *
173
+ * @param {Function} getRefocusElementFunction The refocus element getter.
174
+ */
175
+ }, {
176
+ key: "setRefocusElementGetter",
177
+ value: function setRefocusElementGetter(getRefocusElementFunction) {
178
+ this._refocusElementGetter = getRefocusElementFunction;
179
+ }
180
+
181
+ /**
182
+ * Get the element to be used when refocusing the browser after a delay in case of the focus mode being 'mixed'.
183
+ *
184
+ * @returns {HTMLTextAreaElement|HTMLElement|undefined}
185
+ */
186
+ }, {
187
+ key: "getRefocusElement",
188
+ value: function getRefocusElement() {
189
+ if (this._refocusElementGetter !== null) {
190
+ return this._refocusElementGetter();
191
+ } else {
192
+ var _this$_hot$getActiveE;
193
+ return (_this$_hot$getActiveE = this._hot.getActiveEditor()) === null || _this$_hot$getActiveE === void 0 ? void 0 : _this$_hot$getActiveE.TEXTAREA;
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Set the browser's focus to the highlighted cell of the last selection.
199
+ */
200
+ }, {
201
+ key: "focusOnHighlightedCell",
202
+ value: function focusOnHighlightedCell() {
203
+ var _this$_hot$getActiveE2;
204
+ var lastSelectedRange = this._hot.getSelectedRangeLast();
205
+ var selectedCellCoords = lastSelectedRange.highlight;
206
+ var selectedCell = this._hot.getCell(selectedCellCoords.row, selectedCellCoords.col);
207
+ if (selectedCell && !((_this$_hot$getActiveE2 = this._hot.getActiveEditor()) !== null && _this$_hot$getActiveE2 !== void 0 && _this$_hot$getActiveE2.isOpened())) {
208
+ this._hot.getCell(selectedCellCoords.row, selectedCellCoords.col).focus({
209
+ preventScroll: true
210
+ });
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
216
+ * will be taken from the manager's configuration.
217
+ *
218
+ * @param {number} delay Delay in milliseconds.
219
+ */
220
+ }, {
221
+ key: "refocusToEditorTextarea",
222
+ value: function refocusToEditorTextarea() {
223
+ var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._refocusDelay;
224
+ var refocusElement = this.getRefocusElement();
225
+
226
+ // Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
227
+ if (this._hot.getSettings().imeFastEdit && !!refocusElement) {
228
+ this._hot._registerTimeout(function () {
229
+ refocusElement.select();
230
+ }, delay);
231
+ }
232
+ }
233
+ }]);
234
+ return FocusManager;
235
+ }();
236
+ exports.default = FocusManager;
237
+ function _manageFocus2() {
238
+ this.focusOnHighlightedCell();
239
+ if (this.getFocusMode() === FOCUS_MODES.MIXED) {
240
+ this.refocusToEditorTextarea();
241
+ }
242
+ }
243
+ function _onUpdateSettings2(newSettings) {
244
+ if (newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.MIXED) {
245
+ this.setFocusMode(FOCUS_MODES.MIXED);
246
+ } else if (!newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.CELL) {
247
+ this.setFocusMode(FOCUS_MODES.CELL);
248
+ }
249
+ }
@@ -0,0 +1,245 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ import "core-js/modules/es.array.concat.js";
3
+ import "core-js/modules/es.array.includes.js";
4
+ import "core-js/modules/es.string.includes.js";
5
+ import "core-js/modules/es.object.values.js";
6
+ import "core-js/modules/es.array.iterator.js";
7
+ import "core-js/modules/es.object.to-string.js";
8
+ import "core-js/modules/es.string.iterator.js";
9
+ import "core-js/modules/es.weak-set.js";
10
+ import "core-js/modules/web.dom-collections.iterator.js";
11
+ import "core-js/modules/es.symbol.to-primitive.js";
12
+ import "core-js/modules/es.date.to-primitive.js";
13
+ import "core-js/modules/es.symbol.js";
14
+ import "core-js/modules/es.symbol.description.js";
15
+ import "core-js/modules/es.number.constructor.js";
16
+ import "core-js/modules/es.symbol.iterator.js";
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ 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); }
22
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
23
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
24
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
25
+ import { warn } from "./helpers/console.mjs";
26
+ /**
27
+ * Possible focus modes.
28
+ * - CELL - The browser's focus stays on the lastly selected cell element.
29
+ * - MIXED - The browser's focus switches from the lastly selected cell element to the currently active editor's
30
+ * `TEXTAREA` element after a delay defined in the manager.
31
+ *
32
+ * @type {{CELL: string, MIXED: string}}
33
+ */
34
+ var FOCUS_MODES = {
35
+ CELL: 'cell',
36
+ MIXED: 'mixed'
37
+ };
38
+
39
+ /**
40
+ * Manages the browser's focus in the table.
41
+ */
42
+ var _manageFocus = /*#__PURE__*/new WeakSet();
43
+ var _onUpdateSettings = /*#__PURE__*/new WeakSet();
44
+ var FocusManager = /*#__PURE__*/function () {
45
+ function FocusManager(hotInstance) {
46
+ var _this = this;
47
+ _classCallCheck(this, FocusManager);
48
+ /**
49
+ * Update the manager configuration after calling `updateSettings`.
50
+ *
51
+ * @private
52
+ * @param {object} newSettings The new settings passed to the `updateSettings` method.
53
+ */
54
+ _classPrivateMethodInitSpec(this, _onUpdateSettings);
55
+ /**
56
+ * Manage the browser's focus after cell selection.
57
+ *
58
+ * @private
59
+ */
60
+ _classPrivateMethodInitSpec(this, _manageFocus);
61
+ var hotSettings = hotInstance.getSettings();
62
+
63
+ /**
64
+ * The Handsontable instance.
65
+ *
66
+ * @private
67
+ */
68
+ this._hot = hotInstance;
69
+
70
+ /**
71
+ * The currently enabled focus mode.
72
+ * Can be either:
73
+ *
74
+ * - 'cell' - The browser's focus stays on the lastly selected cell element.
75
+ * - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
76
+ * `TEXTAREA` element after a delay defined in the manager.
77
+ *
78
+ * @type {string}
79
+ * @private
80
+ */
81
+ this._focusMode = hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL;
82
+
83
+ /**
84
+ * The delay after which the focus switches from the lastly selected cell to the active editor's `TEXTAREA`
85
+ * element if the focus mode is set to 'mixed'.
86
+ *
87
+ * @type {number}
88
+ * @private
89
+ */
90
+ this._refocusDelay = 50;
91
+
92
+ /**
93
+ * Getter function for the element to be used when refocusing the browser after a delay. If `null`, the active
94
+ * editor's `TEXTAREA` element will be used.
95
+ *
96
+ * @type {null|Function}
97
+ * @private
98
+ */
99
+ this._refocusElementGetter = null;
100
+ this._hot.addHook('afterUpdateSettings', function () {
101
+ var _classPrivateMethodGe;
102
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
103
+ args[_key] = arguments[_key];
104
+ }
105
+ return (_classPrivateMethodGe = _classPrivateMethodGet(_this, _onUpdateSettings, _onUpdateSettings2)).call.apply(_classPrivateMethodGe, [_this].concat(args));
106
+ });
107
+ this._hot.addHook('afterSelectionEnd', function () {
108
+ var _classPrivateMethodGe2;
109
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
110
+ args[_key2] = arguments[_key2];
111
+ }
112
+ return (_classPrivateMethodGe2 = _classPrivateMethodGet(_this, _manageFocus, _manageFocus2)).call.apply(_classPrivateMethodGe2, [_this].concat(args));
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Get the current focus mode.
118
+ *
119
+ * @returns {string}
120
+ */
121
+ _createClass(FocusManager, [{
122
+ key: "getFocusMode",
123
+ value: function getFocusMode() {
124
+ return this._focusMode;
125
+ }
126
+
127
+ /**
128
+ * Set the focus mode.
129
+ *
130
+ * @param {string} focusMode The new focus mode.
131
+ */
132
+ }, {
133
+ key: "setFocusMode",
134
+ value: function setFocusMode(focusMode) {
135
+ if (Object.values(FOCUS_MODES).includes(focusMode)) {
136
+ this._focusMode = focusMode;
137
+ } else {
138
+ warn("\"".concat(focusMode, "\" is not a valid focus mode."));
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Get the delay after which the focus will change from the cell elements to the active editor's `TEXTAREA`
144
+ * element if the focus mode is set to 'mixed'.
145
+ *
146
+ * @returns {number} Delay in milliseconds.
147
+ */
148
+ }, {
149
+ key: "getRefocusDelay",
150
+ value: function getRefocusDelay() {
151
+ return this._refocusDelay;
152
+ }
153
+
154
+ /**
155
+ * Set the delay after which the focus will change from the cell elements to the active editor's `TEXTAREA`
156
+ * element if the focus mode is set to 'mixed'.
157
+ *
158
+ * @param {number} delay Delay in milliseconds.
159
+ */
160
+ }, {
161
+ key: "setRefocusDelay",
162
+ value: function setRefocusDelay(delay) {
163
+ this._refocusDelay = delay;
164
+ }
165
+
166
+ /**
167
+ * Set the function to be used as the "refocus element" getter. It should return a focusable HTML element.
168
+ *
169
+ * @param {Function} getRefocusElementFunction The refocus element getter.
170
+ */
171
+ }, {
172
+ key: "setRefocusElementGetter",
173
+ value: function setRefocusElementGetter(getRefocusElementFunction) {
174
+ this._refocusElementGetter = getRefocusElementFunction;
175
+ }
176
+
177
+ /**
178
+ * Get the element to be used when refocusing the browser after a delay in case of the focus mode being 'mixed'.
179
+ *
180
+ * @returns {HTMLTextAreaElement|HTMLElement|undefined}
181
+ */
182
+ }, {
183
+ key: "getRefocusElement",
184
+ value: function getRefocusElement() {
185
+ if (this._refocusElementGetter !== null) {
186
+ return this._refocusElementGetter();
187
+ } else {
188
+ var _this$_hot$getActiveE;
189
+ return (_this$_hot$getActiveE = this._hot.getActiveEditor()) === null || _this$_hot$getActiveE === void 0 ? void 0 : _this$_hot$getActiveE.TEXTAREA;
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Set the browser's focus to the highlighted cell of the last selection.
195
+ */
196
+ }, {
197
+ key: "focusOnHighlightedCell",
198
+ value: function focusOnHighlightedCell() {
199
+ var _this$_hot$getActiveE2;
200
+ var lastSelectedRange = this._hot.getSelectedRangeLast();
201
+ var selectedCellCoords = lastSelectedRange.highlight;
202
+ var selectedCell = this._hot.getCell(selectedCellCoords.row, selectedCellCoords.col);
203
+ if (selectedCell && !((_this$_hot$getActiveE2 = this._hot.getActiveEditor()) !== null && _this$_hot$getActiveE2 !== void 0 && _this$_hot$getActiveE2.isOpened())) {
204
+ this._hot.getCell(selectedCellCoords.row, selectedCellCoords.col).focus({
205
+ preventScroll: true
206
+ });
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
212
+ * will be taken from the manager's configuration.
213
+ *
214
+ * @param {number} delay Delay in milliseconds.
215
+ */
216
+ }, {
217
+ key: "refocusToEditorTextarea",
218
+ value: function refocusToEditorTextarea() {
219
+ var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._refocusDelay;
220
+ var refocusElement = this.getRefocusElement();
221
+
222
+ // Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
223
+ if (this._hot.getSettings().imeFastEdit && !!refocusElement) {
224
+ this._hot._registerTimeout(function () {
225
+ refocusElement.select();
226
+ }, delay);
227
+ }
228
+ }
229
+ }]);
230
+ return FocusManager;
231
+ }();
232
+ function _manageFocus2() {
233
+ this.focusOnHighlightedCell();
234
+ if (this.getFocusMode() === FOCUS_MODES.MIXED) {
235
+ this.refocusToEditorTextarea();
236
+ }
237
+ }
238
+ function _onUpdateSettings2(newSettings) {
239
+ if (newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.MIXED) {
240
+ this.setFocusMode(FOCUS_MODES.MIXED);
241
+ } else if (!newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.CELL) {
242
+ this.setFocusMode(FOCUS_MODES.CELL);
243
+ }
244
+ }
245
+ export { FocusManager as default };
@@ -43,6 +43,7 @@ exports.innerHeight = innerHeight;
43
43
  exports.innerWidth = innerWidth;
44
44
  exports.isChildOf = isChildOf;
45
45
  exports.isDetached = isDetached;
46
+ exports.isHotChild = isHotChild;
46
47
  exports.isInput = isInput;
47
48
  exports.isOutsideInput = isOutsideInput;
48
49
  exports.isVisible = isVisible;
@@ -110,6 +111,16 @@ function getParent(element) {
110
111
  return parent;
111
112
  }
112
113
 
114
+ /**
115
+ * Check if the provided element is a child of the Handsontable container.
116
+ *
117
+ * @param {HTMLElement} element Element to be analyzed.
118
+ * @returns {boolean}
119
+ */
120
+ function isHotChild(element) {
121
+ return !!element.closest('.handsontable');
122
+ }
123
+
113
124
  /**
114
125
  * Gets `frameElement` of the specified frame. Returns null if it is a top frame or if script has no access to read property.
115
126
  *
@@ -57,6 +57,16 @@ export function getParent(element) {
57
57
  return parent;
58
58
  }
59
59
 
60
+ /**
61
+ * Check if the provided element is a child of the Handsontable container.
62
+ *
63
+ * @param {HTMLElement} element Element to be analyzed.
64
+ * @returns {boolean}
65
+ */
66
+ export function isHotChild(element) {
67
+ return !!element.closest('.handsontable');
68
+ }
69
+
60
70
  /**
61
71
  * Gets `frameElement` of the specified frame. Returns null if it is a top frame or if script has no access to read property.
62
72
  *
package/helpers/mixed.js CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
152
152
  function _injectProductInfo(key, element) {
153
153
  var hasValidType = !isEmpty(key);
154
154
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
155
- var hotVersion = "0.0.0-next-5e7f0fe-20230504";
155
+ var hotVersion = "0.0.0-next-48677e7-20230509";
156
156
  var keyValidityDate;
157
157
  var consoleMessageState = 'invalid';
158
158
  var domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
142
142
  export function _injectProductInfo(key, element) {
143
143
  var hasValidType = !isEmpty(key);
144
144
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
145
- var hotVersion = "0.0.0-next-5e7f0fe-20230504";
145
+ var hotVersion = "0.0.0-next-48677e7-20230509";
146
146
  var keyValidityDate;
147
147
  var consoleMessageState = 'invalid';
148
148
  var domMessageState = 'invalid';
@@ -21,13 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
22
22
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
23
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
- 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); } /**
25
- * @preserve
26
- * Authors: Handsoncode
27
- * Last updated: Feb 9, 2022
28
- *
29
- * Description: Definition file for Arabic - Without a specific country.
30
- */
24
+ 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); }
31
25
  var dictionary = (_dictionary = {
32
26
  languageCode: 'ar-AR',
33
27
  languageDirection: 'rtl'