handsontable 0.0.0-next-44acfea-20231127 → 0.0.0-next-28e0541-20231128

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/focusManager.js CHANGED
@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _console = require("./helpers/console");
6
6
  var _element = require("./helpers/dom/element");
7
+ var _function = require("./helpers/function");
7
8
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
8
9
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
9
10
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -33,9 +34,10 @@ var _hot = /*#__PURE__*/new WeakMap();
33
34
  var _focusMode = /*#__PURE__*/new WeakMap();
34
35
  var _refocusDelay = /*#__PURE__*/new WeakMap();
35
36
  var _refocusElementGetter = /*#__PURE__*/new WeakMap();
36
- var _getCurrentHighlightCoords = /*#__PURE__*/new WeakSet();
37
+ var _debouncedSelect = /*#__PURE__*/new WeakMap();
37
38
  var _getSelectedCell = /*#__PURE__*/new WeakSet();
38
- var _manageFocus = /*#__PURE__*/new WeakSet();
39
+ var _focusCell = /*#__PURE__*/new WeakSet();
40
+ var _focusEditorElement = /*#__PURE__*/new WeakSet();
39
41
  var _onUpdateSettings = /*#__PURE__*/new WeakSet();
40
42
  class FocusManager {
41
43
  constructor(hotInstance) {
@@ -43,29 +45,23 @@ class FocusManager {
43
45
  /**
44
46
  * Update the manager configuration after calling `updateSettings`.
45
47
  *
46
- * @private
47
48
  * @param {object} newSettings The new settings passed to the `updateSettings` method.
48
49
  */
49
50
  _classPrivateMethodInitSpec(this, _onUpdateSettings);
50
51
  /**
51
- * Manage the browser's focus after cell selection.
52
- *
53
- * @private
52
+ * Manage the browser's focus after cell selection end.
54
53
  */
55
- _classPrivateMethodInitSpec(this, _manageFocus);
54
+ _classPrivateMethodInitSpec(this, _focusEditorElement);
56
55
  /**
57
- * Get and return the currently selected and highlighted cell/header element.
58
- *
59
- * @private
60
- * @returns {HTMLTableCellElement}
56
+ * Manage the browser's focus after each cell selection change.
61
57
  */
62
- _classPrivateMethodInitSpec(this, _getSelectedCell);
58
+ _classPrivateMethodInitSpec(this, _focusCell);
63
59
  /**
64
- * Get the coordinates of the highlight of the currently selected cell/header.
60
+ * Get and return the currently selected and highlighted cell/header element.
65
61
  *
66
- * @returns {CellCoords}
62
+ * @param {Function} callback Callback function to be called after the cell element is retrieved.
67
63
  */
68
- _classPrivateMethodInitSpec(this, _getCurrentHighlightCoords);
64
+ _classPrivateMethodInitSpec(this, _getSelectedCell);
69
65
  /**
70
66
  * The Handsontable instance.
71
67
  */
@@ -81,7 +77,7 @@ class FocusManager {
81
77
  * - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
82
78
  * `TEXTAREA` element after a delay defined in the manager.
83
79
  *
84
- * @type {string}
80
+ * @type {'cell' | 'mixed'}
85
81
  */
86
82
  _classPrivateFieldInitSpec(this, _focusMode, {
87
83
  writable: true,
@@ -107,6 +103,15 @@ class FocusManager {
107
103
  writable: true,
108
104
  value: null
109
105
  });
106
+ /**
107
+ * Map of the debounced `select` functions.
108
+ *
109
+ * @type {Map<number, Function>}
110
+ */
111
+ _classPrivateFieldInitSpec(this, _debouncedSelect, {
112
+ writable: true,
113
+ value: new Map()
114
+ });
110
115
  const hotSettings = hotInstance.getSettings();
111
116
  _classPrivateFieldSet(this, _hot, hotInstance);
112
117
  _classPrivateFieldSet(this, _focusMode, hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL);
@@ -120,7 +125,13 @@ class FocusManager {
120
125
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
121
126
  args[_key2] = arguments[_key2];
122
127
  }
123
- return _classPrivateMethodGet(_this, _manageFocus, _manageFocus2).call(_this, ...args);
128
+ return _classPrivateMethodGet(_this, _focusCell, _focusCell2).call(_this, ...args);
129
+ });
130
+ _classPrivateFieldGet(this, _hot).addHook('afterSelectionEnd', function () {
131
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
132
+ args[_key3] = arguments[_key3];
133
+ }
134
+ return _classPrivateMethodGet(_this, _focusEditorElement, _focusEditorElement2).call(_this, ...args);
124
135
  });
125
136
  }
126
137
 
@@ -195,17 +206,26 @@ class FocusManager {
195
206
  * @param {HTMLTableCellElement} [selectedCell] The highlighted cell/header element.
196
207
  */
197
208
  focusOnHighlightedCell(selectedCell) {
198
- var _classPrivateFieldGet3;
199
- const currentHighlightCoords = _classPrivateMethodGet(this, _getCurrentHighlightCoords, _getCurrentHighlightCoords2).call(this);
200
- const currentlySelectedHighlight = selectedCell || _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this);
201
- let elementToBeFocused = _classPrivateFieldGet(this, _hot).runHooks('modifyFocusedElement', currentHighlightCoords.row, currentHighlightCoords.col, currentlySelectedHighlight);
202
- if (!(elementToBeFocused instanceof HTMLElement)) {
203
- elementToBeFocused = currentlySelectedHighlight;
204
- }
205
- if (elementToBeFocused && !((_classPrivateFieldGet3 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet3 !== void 0 && _classPrivateFieldGet3.isOpened())) {
206
- elementToBeFocused.focus({
207
- preventScroll: true
208
- });
209
+ const focusElement = element => {
210
+ var _classPrivateFieldGet3, _classPrivateFieldGet4;
211
+ const currentHighlightCoords = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.highlight;
212
+ if (!currentHighlightCoords || !element) {
213
+ return;
214
+ }
215
+ let elementToBeFocused = _classPrivateFieldGet(this, _hot).runHooks('modifyFocusedElement', currentHighlightCoords.row, currentHighlightCoords.col, element);
216
+ if (!(elementToBeFocused instanceof HTMLElement)) {
217
+ elementToBeFocused = element;
218
+ }
219
+ if (elementToBeFocused && !((_classPrivateFieldGet4 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet4 !== void 0 && _classPrivateFieldGet4.isOpened())) {
220
+ elementToBeFocused.focus({
221
+ preventScroll: true
222
+ });
223
+ }
224
+ };
225
+ if (selectedCell) {
226
+ focusElement(selectedCell);
227
+ } else {
228
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, element => focusElement(element));
209
229
  }
210
230
  }
211
231
 
@@ -213,50 +233,64 @@ class FocusManager {
213
233
  * Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
214
234
  * will be taken from the manager's configuration.
215
235
  *
216
- * @param {number} delay Delay in milliseconds.
236
+ * @param {number} [delay] Delay in milliseconds.
217
237
  */
218
238
  refocusToEditorTextarea() {
219
- var _classPrivateFieldGet4;
239
+ var _classPrivateFieldGet5;
220
240
  let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _classPrivateFieldGet(this, _refocusDelay);
221
241
  const refocusElement = this.getRefocusElement();
222
242
 
223
243
  // Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
224
- if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet4 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet4 !== void 0 && _classPrivateFieldGet4.isOpened()) && !!refocusElement) {
225
- _classPrivateFieldGet(this, _hot)._registerTimeout(() => {
226
- refocusElement.select();
227
- }, delay);
244
+ if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet5 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet5 !== void 0 && _classPrivateFieldGet5.isOpened()) && !!refocusElement) {
245
+ if (!_classPrivateFieldGet(this, _debouncedSelect).has(delay)) {
246
+ _classPrivateFieldGet(this, _debouncedSelect).set(delay, (0, _function.debounce)(() => {
247
+ refocusElement.select();
248
+ }, delay));
249
+ }
250
+ _classPrivateFieldGet(this, _debouncedSelect).get(delay)();
228
251
  }
229
252
  }
230
253
  }
231
254
  exports.FocusManager = FocusManager;
232
- function _getCurrentHighlightCoords2() {
233
- const lastSelectedRange = _classPrivateFieldGet(this, _hot).getSelectedRangeLast();
234
- return lastSelectedRange.highlight;
235
- }
236
- function _getSelectedCell2() {
237
- const selectedCellCoords = _classPrivateMethodGet(this, _getCurrentHighlightCoords, _getCurrentHighlightCoords2).call(this);
238
- return _classPrivateFieldGet(this, _hot).getCell(selectedCellCoords.row, selectedCellCoords.col, true);
239
- }
240
- function _manageFocus2() {
241
- const selectedCell = _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this);
242
- const {
243
- activeElement
244
- } = _classPrivateFieldGet(this, _hot).rootDocument;
245
-
246
- // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
247
- // and resets the `document.activeElement` property. The blurring should happen only when the
248
- // previously selected input element has not belonged to the Handsontable editor. If blurring is
249
- // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
250
- if (activeElement && (0, _element.isOutsideInput)(activeElement)) {
251
- activeElement.blur();
255
+ function _getSelectedCell2(callback) {
256
+ var _classPrivateFieldGet6;
257
+ const highlight = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.highlight;
258
+ if (!highlight) {
259
+ callback(null);
260
+ return;
252
261
  }
253
- this.focusOnHighlightedCell(selectedCell);
254
- if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
255
- _classPrivateFieldGet(this, _hot).addHookOnce('afterSelectionEnd', () => {
256
- this.refocusToEditorTextarea();
262
+ const cell = _classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true);
263
+ if (cell === null) {
264
+ _classPrivateFieldGet(this, _hot).addHookOnce('afterScroll', () => {
265
+ callback(_classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true));
257
266
  });
267
+ } else {
268
+ callback(cell);
258
269
  }
259
270
  }
271
+ function _focusCell2() {
272
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
273
+ const {
274
+ activeElement
275
+ } = _classPrivateFieldGet(this, _hot).rootDocument;
276
+
277
+ // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
278
+ // and resets the `document.activeElement` property. The blurring should happen only when the
279
+ // previously selected input element has not belonged to the Handsontable editor. If blurring is
280
+ // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
281
+ if (activeElement && (0, _element.isOutsideInput)(activeElement)) {
282
+ activeElement.blur();
283
+ }
284
+ this.focusOnHighlightedCell(selectedCell);
285
+ });
286
+ }
287
+ function _focusEditorElement2() {
288
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
289
+ if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
290
+ this.refocusToEditorTextarea();
291
+ }
292
+ });
293
+ }
260
294
  function _onUpdateSettings2(newSettings) {
261
295
  if (newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.MIXED) {
262
296
  this.setFocusMode(FOCUS_MODES.MIXED);
package/focusManager.mjs CHANGED
@@ -10,6 +10,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
10
10
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
11
11
  import { warn } from "./helpers/console.mjs";
12
12
  import { isOutsideInput } from "./helpers/dom/element.mjs";
13
+ import { debounce } from "./helpers/function.mjs";
13
14
  /**
14
15
  * Possible focus modes.
15
16
  * - CELL - The browser's focus stays on the lastly selected cell element.
@@ -30,9 +31,10 @@ var _hot = /*#__PURE__*/new WeakMap();
30
31
  var _focusMode = /*#__PURE__*/new WeakMap();
31
32
  var _refocusDelay = /*#__PURE__*/new WeakMap();
32
33
  var _refocusElementGetter = /*#__PURE__*/new WeakMap();
33
- var _getCurrentHighlightCoords = /*#__PURE__*/new WeakSet();
34
+ var _debouncedSelect = /*#__PURE__*/new WeakMap();
34
35
  var _getSelectedCell = /*#__PURE__*/new WeakSet();
35
- var _manageFocus = /*#__PURE__*/new WeakSet();
36
+ var _focusCell = /*#__PURE__*/new WeakSet();
37
+ var _focusEditorElement = /*#__PURE__*/new WeakSet();
36
38
  var _onUpdateSettings = /*#__PURE__*/new WeakSet();
37
39
  export class FocusManager {
38
40
  constructor(hotInstance) {
@@ -40,29 +42,23 @@ export class FocusManager {
40
42
  /**
41
43
  * Update the manager configuration after calling `updateSettings`.
42
44
  *
43
- * @private
44
45
  * @param {object} newSettings The new settings passed to the `updateSettings` method.
45
46
  */
46
47
  _classPrivateMethodInitSpec(this, _onUpdateSettings);
47
48
  /**
48
- * Manage the browser's focus after cell selection.
49
- *
50
- * @private
49
+ * Manage the browser's focus after cell selection end.
51
50
  */
52
- _classPrivateMethodInitSpec(this, _manageFocus);
51
+ _classPrivateMethodInitSpec(this, _focusEditorElement);
53
52
  /**
54
- * Get and return the currently selected and highlighted cell/header element.
55
- *
56
- * @private
57
- * @returns {HTMLTableCellElement}
53
+ * Manage the browser's focus after each cell selection change.
58
54
  */
59
- _classPrivateMethodInitSpec(this, _getSelectedCell);
55
+ _classPrivateMethodInitSpec(this, _focusCell);
60
56
  /**
61
- * Get the coordinates of the highlight of the currently selected cell/header.
57
+ * Get and return the currently selected and highlighted cell/header element.
62
58
  *
63
- * @returns {CellCoords}
59
+ * @param {Function} callback Callback function to be called after the cell element is retrieved.
64
60
  */
65
- _classPrivateMethodInitSpec(this, _getCurrentHighlightCoords);
61
+ _classPrivateMethodInitSpec(this, _getSelectedCell);
66
62
  /**
67
63
  * The Handsontable instance.
68
64
  */
@@ -78,7 +74,7 @@ export class FocusManager {
78
74
  * - 'mixed' - The browser's focus switches from the lastly selected cell element to the currently active editor's
79
75
  * `TEXTAREA` element after a delay defined in the manager.
80
76
  *
81
- * @type {string}
77
+ * @type {'cell' | 'mixed'}
82
78
  */
83
79
  _classPrivateFieldInitSpec(this, _focusMode, {
84
80
  writable: true,
@@ -104,6 +100,15 @@ export class FocusManager {
104
100
  writable: true,
105
101
  value: null
106
102
  });
103
+ /**
104
+ * Map of the debounced `select` functions.
105
+ *
106
+ * @type {Map<number, Function>}
107
+ */
108
+ _classPrivateFieldInitSpec(this, _debouncedSelect, {
109
+ writable: true,
110
+ value: new Map()
111
+ });
107
112
  const hotSettings = hotInstance.getSettings();
108
113
  _classPrivateFieldSet(this, _hot, hotInstance);
109
114
  _classPrivateFieldSet(this, _focusMode, hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL);
@@ -117,7 +122,13 @@ export class FocusManager {
117
122
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
118
123
  args[_key2] = arguments[_key2];
119
124
  }
120
- return _classPrivateMethodGet(_this, _manageFocus, _manageFocus2).call(_this, ...args);
125
+ return _classPrivateMethodGet(_this, _focusCell, _focusCell2).call(_this, ...args);
126
+ });
127
+ _classPrivateFieldGet(this, _hot).addHook('afterSelectionEnd', function () {
128
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
129
+ args[_key3] = arguments[_key3];
130
+ }
131
+ return _classPrivateMethodGet(_this, _focusEditorElement, _focusEditorElement2).call(_this, ...args);
121
132
  });
122
133
  }
123
134
 
@@ -192,17 +203,26 @@ export class FocusManager {
192
203
  * @param {HTMLTableCellElement} [selectedCell] The highlighted cell/header element.
193
204
  */
194
205
  focusOnHighlightedCell(selectedCell) {
195
- var _classPrivateFieldGet3;
196
- const currentHighlightCoords = _classPrivateMethodGet(this, _getCurrentHighlightCoords, _getCurrentHighlightCoords2).call(this);
197
- const currentlySelectedHighlight = selectedCell || _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this);
198
- let elementToBeFocused = _classPrivateFieldGet(this, _hot).runHooks('modifyFocusedElement', currentHighlightCoords.row, currentHighlightCoords.col, currentlySelectedHighlight);
199
- if (!(elementToBeFocused instanceof HTMLElement)) {
200
- elementToBeFocused = currentlySelectedHighlight;
201
- }
202
- if (elementToBeFocused && !((_classPrivateFieldGet3 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet3 !== void 0 && _classPrivateFieldGet3.isOpened())) {
203
- elementToBeFocused.focus({
204
- preventScroll: true
205
- });
206
+ const focusElement = element => {
207
+ var _classPrivateFieldGet3, _classPrivateFieldGet4;
208
+ const currentHighlightCoords = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.highlight;
209
+ if (!currentHighlightCoords || !element) {
210
+ return;
211
+ }
212
+ let elementToBeFocused = _classPrivateFieldGet(this, _hot).runHooks('modifyFocusedElement', currentHighlightCoords.row, currentHighlightCoords.col, element);
213
+ if (!(elementToBeFocused instanceof HTMLElement)) {
214
+ elementToBeFocused = element;
215
+ }
216
+ if (elementToBeFocused && !((_classPrivateFieldGet4 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet4 !== void 0 && _classPrivateFieldGet4.isOpened())) {
217
+ elementToBeFocused.focus({
218
+ preventScroll: true
219
+ });
220
+ }
221
+ };
222
+ if (selectedCell) {
223
+ focusElement(selectedCell);
224
+ } else {
225
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, element => focusElement(element));
206
226
  }
207
227
  }
208
228
 
@@ -210,49 +230,63 @@ export class FocusManager {
210
230
  * Set the focus to the active editor's `TEXTAREA` element after the provided delay. If no delay is provided, it
211
231
  * will be taken from the manager's configuration.
212
232
  *
213
- * @param {number} delay Delay in milliseconds.
233
+ * @param {number} [delay] Delay in milliseconds.
214
234
  */
215
235
  refocusToEditorTextarea() {
216
- var _classPrivateFieldGet4;
236
+ var _classPrivateFieldGet5;
217
237
  let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _classPrivateFieldGet(this, _refocusDelay);
218
238
  const refocusElement = this.getRefocusElement();
219
239
 
220
240
  // Re-focus on the editor's `TEXTAREA` element (or a predefined element) if the `imeFastEdit` option is enabled.
221
- if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet4 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet4 !== void 0 && _classPrivateFieldGet4.isOpened()) && !!refocusElement) {
222
- _classPrivateFieldGet(this, _hot)._registerTimeout(() => {
223
- refocusElement.select();
224
- }, delay);
241
+ if (_classPrivateFieldGet(this, _hot).getSettings().imeFastEdit && !((_classPrivateFieldGet5 = _classPrivateFieldGet(this, _hot).getActiveEditor()) !== null && _classPrivateFieldGet5 !== void 0 && _classPrivateFieldGet5.isOpened()) && !!refocusElement) {
242
+ if (!_classPrivateFieldGet(this, _debouncedSelect).has(delay)) {
243
+ _classPrivateFieldGet(this, _debouncedSelect).set(delay, debounce(() => {
244
+ refocusElement.select();
245
+ }, delay));
246
+ }
247
+ _classPrivateFieldGet(this, _debouncedSelect).get(delay)();
225
248
  }
226
249
  }
227
250
  }
228
- function _getCurrentHighlightCoords2() {
229
- const lastSelectedRange = _classPrivateFieldGet(this, _hot).getSelectedRangeLast();
230
- return lastSelectedRange.highlight;
231
- }
232
- function _getSelectedCell2() {
233
- const selectedCellCoords = _classPrivateMethodGet(this, _getCurrentHighlightCoords, _getCurrentHighlightCoords2).call(this);
234
- return _classPrivateFieldGet(this, _hot).getCell(selectedCellCoords.row, selectedCellCoords.col, true);
235
- }
236
- function _manageFocus2() {
237
- const selectedCell = _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this);
238
- const {
239
- activeElement
240
- } = _classPrivateFieldGet(this, _hot).rootDocument;
241
-
242
- // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
243
- // and resets the `document.activeElement` property. The blurring should happen only when the
244
- // previously selected input element has not belonged to the Handsontable editor. If blurring is
245
- // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
246
- if (activeElement && isOutsideInput(activeElement)) {
247
- activeElement.blur();
251
+ function _getSelectedCell2(callback) {
252
+ var _classPrivateFieldGet6;
253
+ const highlight = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _hot).getSelectedRangeLast()) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.highlight;
254
+ if (!highlight) {
255
+ callback(null);
256
+ return;
248
257
  }
249
- this.focusOnHighlightedCell(selectedCell);
250
- if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
251
- _classPrivateFieldGet(this, _hot).addHookOnce('afterSelectionEnd', () => {
252
- this.refocusToEditorTextarea();
258
+ const cell = _classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true);
259
+ if (cell === null) {
260
+ _classPrivateFieldGet(this, _hot).addHookOnce('afterScroll', () => {
261
+ callback(_classPrivateFieldGet(this, _hot).getCell(highlight.row, highlight.col, true));
253
262
  });
263
+ } else {
264
+ callback(cell);
254
265
  }
255
266
  }
267
+ function _focusCell2() {
268
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
269
+ const {
270
+ activeElement
271
+ } = _classPrivateFieldGet(this, _hot).rootDocument;
272
+
273
+ // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
274
+ // and resets the `document.activeElement` property. The blurring should happen only when the
275
+ // previously selected input element has not belonged to the Handsontable editor. If blurring is
276
+ // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
277
+ if (activeElement && isOutsideInput(activeElement)) {
278
+ activeElement.blur();
279
+ }
280
+ this.focusOnHighlightedCell(selectedCell);
281
+ });
282
+ }
283
+ function _focusEditorElement2() {
284
+ _classPrivateMethodGet(this, _getSelectedCell, _getSelectedCell2).call(this, selectedCell => {
285
+ if (this.getFocusMode() === FOCUS_MODES.MIXED && selectedCell.nodeName === 'TD') {
286
+ this.refocusToEditorTextarea();
287
+ }
288
+ });
289
+ }
256
290
  function _onUpdateSettings2(newSettings) {
257
291
  if (newSettings.imeFastEdit && this.getFocusMode() !== FOCUS_MODES.MIXED) {
258
292
  this.setFocusMode(FOCUS_MODES.MIXED);
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-44acfea-20231127";
137
+ const hotVersion = "0.0.0-next-28e0541-20231128";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-44acfea-20231127";
127
+ const hotVersion = "0.0.0-next-28e0541-20231128";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-44acfea-20231127",
13
+ "version": "0.0.0-next-28e0541-20231128",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",