handsontable 0.0.0-next-c8116f8-20240920 → 0.0.0-next-ffdf116-20240926

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 (33) hide show
  1. package/3rdparty/walkontable/src/selection/border/border.js +1 -1
  2. package/3rdparty/walkontable/src/selection/border/border.mjs +2 -2
  3. package/3rdparty/walkontable/src/table/master.js +1 -1
  4. package/3rdparty/walkontable/src/table/master.mjs +2 -2
  5. package/base.js +2 -2
  6. package/base.mjs +2 -2
  7. package/dist/handsontable.css +2 -2
  8. package/dist/handsontable.full.css +2 -2
  9. package/dist/handsontable.full.js +110 -44
  10. package/dist/handsontable.full.min.css +2 -2
  11. package/dist/handsontable.full.min.js +5 -5
  12. package/dist/handsontable.js +110 -44
  13. package/dist/handsontable.min.css +2 -2
  14. package/dist/handsontable.min.js +5 -5
  15. package/editors/autocompleteEditor/autocompleteEditor.js +31 -14
  16. package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -14
  17. package/editors/baseEditor/baseEditor.js +1 -1
  18. package/editors/baseEditor/baseEditor.mjs +2 -2
  19. package/editors/handsontableEditor/handsontableEditor.js +24 -0
  20. package/editors/handsontableEditor/handsontableEditor.mjs +24 -0
  21. package/editors/textEditor/textEditor.js +2 -2
  22. package/editors/textEditor/textEditor.mjs +3 -3
  23. package/helpers/dom/element.js +4 -17
  24. package/helpers/dom/element.mjs +4 -16
  25. package/helpers/mixed.js +1 -1
  26. package/helpers/mixed.mjs +1 -1
  27. package/package.json +1 -1
  28. package/plugins/contextMenu/menu/menu.js +1 -1
  29. package/plugins/contextMenu/menu/menu.mjs +2 -2
  30. package/plugins/contextMenu/menu/positioner.js +4 -2
  31. package/plugins/contextMenu/menu/positioner.mjs +4 -2
  32. package/tableView.js +36 -0
  33. package/tableView.mjs +36 -0
@@ -9,7 +9,6 @@ var _element = require("../../helpers/dom/element");
9
9
  var _mixed = require("../../helpers/mixed");
10
10
  var _string = require("../../helpers/string");
11
11
  var _unicode = require("../../helpers/unicode");
12
- var _browser = require("../../helpers/browser");
13
12
  var _textRenderer = require("../../renderers/textRenderer");
14
13
  var _a11y = require("../../helpers/a11y");
15
14
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
@@ -183,15 +182,11 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
183
182
  } = this;
184
183
  this.showEditableElement();
185
184
  this.focus();
186
- let scrollbarWidth = (0, _element.getScrollbarWidth)();
187
- if (scrollbarWidth === 0 && (0, _browser.isMacOS)()) {
188
- scrollbarWidth += 15; // default scroll bar width if scroll bars are visible only when scrolling
189
- }
190
185
  this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
191
186
  this.htEditor.updateSettings({
192
187
  colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : undefined,
193
- width: trimDropdown ? (0, _element.outerWidth)(this.TEXTAREA) + scrollbarWidth : undefined,
194
188
  autoColumnSize: true,
189
+ autoRowSize: true,
195
190
  renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
196
191
  (0, _textRenderer.textRenderer)(hotInstance, TD, row, col, prop, value, cellProperties);
197
192
  const {
@@ -350,7 +345,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
350
345
  }
351
346
  const textareaOffset = (0, _element.offset)(this.TEXTAREA);
352
347
  const textareaHeight = (0, _element.outerHeight)(this.TEXTAREA);
353
- const dropdownHeight = this.getDropdownHeight();
348
+ const dropdownHeight = this.getHeight();
354
349
  const trimmingContainerScrollTop = trimmingContainer.scrollTop;
355
350
  const headersHeight = (0, _element.outerHeight)(this.hot.view._wt.wtTable.THEAD);
356
351
  const containerOffset = (0, _element.offset)(trimmingContainer);
@@ -423,12 +418,18 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
423
418
  * @private
424
419
  */
425
420
  updateDropdownDimensions() {
426
- const currentDropdownWidth = this.htEditor.getColWidth(0) + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 2;
427
421
  const trimDropdown = this.cellProperties.trimDropdown;
422
+ const width = trimDropdown ? this.getWidth() : undefined;
423
+ const height = this.getHeight();
428
424
  this.htEditor.updateSettings({
429
- height: this.getDropdownHeight(),
430
- width: trimDropdown ? undefined : currentDropdownWidth
425
+ width,
426
+ height
431
427
  });
428
+ if (trimDropdown && this.htEditor.view.hasVerticalScroll()) {
429
+ this.htEditor.updateSettings({
430
+ width: width + (0, _element.getScrollbarWidth)(this.hot.rootDocument)
431
+ });
432
+ }
432
433
  this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer();
433
434
  }
434
435
 
@@ -464,10 +465,26 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
464
465
  * @private
465
466
  * @returns {number}
466
467
  */
467
- getDropdownHeight() {
468
- const firstRowHeight = this.htEditor.getRowHeight(0) || 23;
469
- const visibleRows = this.cellProperties.visibleRows;
470
- return this.strippedChoices.length >= visibleRows ? visibleRows * firstRowHeight : this.strippedChoices.length * firstRowHeight + 8; // eslint-disable-line max-len
468
+ getHeight() {
469
+ const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
470
+ const borderVerticalCompensation = parseInt(containerStyle.borderTopWidth, 10) + parseInt(containerStyle.borderBottomWidth, 10);
471
+ const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
472
+ const height = Array.from({
473
+ length: maxItems
474
+ }, (_, i) => i).reduce((h, index) => h + this.htEditor.getRowHeight(index), 0);
475
+ return height + borderVerticalCompensation + 1;
476
+ }
477
+
478
+ /**
479
+ * Calculates and return the internal Handsontable's width.
480
+ *
481
+ * @private
482
+ * @returns {number}
483
+ */
484
+ getWidth() {
485
+ const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
486
+ const borderHorizontalCompensation = parseInt(containerStyle.borderInlineStartWidth, 10) + parseInt(containerStyle.borderInlineEndWidth, 10);
487
+ return this.htEditor.getColWidth(0) + borderHorizontalCompensation;
471
488
  }
472
489
 
473
490
  /**
@@ -13,7 +13,6 @@ import { addClass, getCaretPosition, getScrollbarWidth, getSelectionEndPosition,
13
13
  import { isDefined, stringify } from "../../helpers/mixed.mjs";
14
14
  import { stripTags } from "../../helpers/string.mjs";
15
15
  import { KEY_CODES, isPrintableChar } from "../../helpers/unicode.mjs";
16
- import { isMacOS } from "../../helpers/browser.mjs";
17
16
  import { textRenderer } from "../../renderers/textRenderer/index.mjs";
18
17
  import { A11Y_ACTIVEDESCENDANT, A11Y_AUTOCOMPLETE, A11Y_COMBOBOX, A11Y_CONTROLS, A11Y_EXPANDED, A11Y_HASPOPUP, A11Y_LISTBOX, A11Y_LIVE, A11Y_OPTION, A11Y_POSINSET, A11Y_PRESENTATION, A11Y_RELEVANT, A11Y_SELECTED, A11Y_SETSIZE, A11Y_TEXT } from "../../helpers/a11y.mjs";
19
18
  export const EDITOR_TYPE = 'autocomplete';
@@ -180,15 +179,11 @@ export class AutocompleteEditor extends HandsontableEditor {
180
179
  } = this;
181
180
  this.showEditableElement();
182
181
  this.focus();
183
- let scrollbarWidth = getScrollbarWidth();
184
- if (scrollbarWidth === 0 && isMacOS()) {
185
- scrollbarWidth += 15; // default scroll bar width if scroll bars are visible only when scrolling
186
- }
187
182
  this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
188
183
  this.htEditor.updateSettings({
189
184
  colWidths: trimDropdown ? [outerWidth(this.TEXTAREA) - 2] : undefined,
190
- width: trimDropdown ? outerWidth(this.TEXTAREA) + scrollbarWidth : undefined,
191
185
  autoColumnSize: true,
186
+ autoRowSize: true,
192
187
  renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
193
188
  textRenderer(hotInstance, TD, row, col, prop, value, cellProperties);
194
189
  const {
@@ -347,7 +342,7 @@ export class AutocompleteEditor extends HandsontableEditor {
347
342
  }
348
343
  const textareaOffset = offset(this.TEXTAREA);
349
344
  const textareaHeight = outerHeight(this.TEXTAREA);
350
- const dropdownHeight = this.getDropdownHeight();
345
+ const dropdownHeight = this.getHeight();
351
346
  const trimmingContainerScrollTop = trimmingContainer.scrollTop;
352
347
  const headersHeight = outerHeight(this.hot.view._wt.wtTable.THEAD);
353
348
  const containerOffset = offset(trimmingContainer);
@@ -420,12 +415,18 @@ export class AutocompleteEditor extends HandsontableEditor {
420
415
  * @private
421
416
  */
422
417
  updateDropdownDimensions() {
423
- const currentDropdownWidth = this.htEditor.getColWidth(0) + getScrollbarWidth(this.hot.rootDocument) + 2;
424
418
  const trimDropdown = this.cellProperties.trimDropdown;
419
+ const width = trimDropdown ? this.getWidth() : undefined;
420
+ const height = this.getHeight();
425
421
  this.htEditor.updateSettings({
426
- height: this.getDropdownHeight(),
427
- width: trimDropdown ? undefined : currentDropdownWidth
422
+ width,
423
+ height
428
424
  });
425
+ if (trimDropdown && this.htEditor.view.hasVerticalScroll()) {
426
+ this.htEditor.updateSettings({
427
+ width: width + getScrollbarWidth(this.hot.rootDocument)
428
+ });
429
+ }
429
430
  this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer();
430
431
  }
431
432
 
@@ -461,10 +462,26 @@ export class AutocompleteEditor extends HandsontableEditor {
461
462
  * @private
462
463
  * @returns {number}
463
464
  */
464
- getDropdownHeight() {
465
- const firstRowHeight = this.htEditor.getRowHeight(0) || 23;
466
- const visibleRows = this.cellProperties.visibleRows;
467
- return this.strippedChoices.length >= visibleRows ? visibleRows * firstRowHeight : this.strippedChoices.length * firstRowHeight + 8; // eslint-disable-line max-len
465
+ getHeight() {
466
+ const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
467
+ const borderVerticalCompensation = parseInt(containerStyle.borderTopWidth, 10) + parseInt(containerStyle.borderBottomWidth, 10);
468
+ const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
469
+ const height = Array.from({
470
+ length: maxItems
471
+ }, (_, i) => i).reduce((h, index) => h + this.htEditor.getRowHeight(index), 0);
472
+ return height + borderVerticalCompensation + 1;
473
+ }
474
+
475
+ /**
476
+ * Calculates and return the internal Handsontable's width.
477
+ *
478
+ * @private
479
+ * @returns {number}
480
+ */
481
+ getWidth() {
482
+ const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
483
+ const borderHorizontalCompensation = parseInt(containerStyle.borderInlineStartWidth, 10) + parseInt(containerStyle.borderInlineEndWidth, 10);
484
+ return this.htEditor.getColWidth(0) + borderHorizontalCompensation;
468
485
  }
469
486
 
470
487
  /**
@@ -476,7 +476,7 @@ class BaseEditor {
476
476
  } else if (['top', 'master', 'bottom'].includes(overlayName)) {
477
477
  cellStartOffset += firstColumnOffset - horizontalScrollPosition;
478
478
  }
479
- const cellComputedStyle = (0, _element.getComputedStyle)(this.TD, this.hot.rootWindow);
479
+ const cellComputedStyle = rootWindow.getComputedStyle(this.TD);
480
480
  const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
481
481
  const inlineStartBorderCompensation = parseInt(cellComputedStyle[borderPhysicalWidthProp], 10) > 0 ? 0 : 1;
482
482
  const topBorderCompensation = parseInt(cellComputedStyle.borderTopWidth, 10) > 0 ? 0 : 1;
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
5
5
  import { stringify } from "../../helpers/mixed.mjs";
6
6
  import { mixin } from "../../helpers/object.mjs";
7
7
  import hooksRefRegisterer from "../../mixins/hooksRefRegisterer.mjs";
8
- import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight, getComputedStyle } from "../../helpers/dom/element.mjs";
8
+ import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight } from "../../helpers/dom/element.mjs";
9
9
  export const EDITOR_TYPE = 'base';
10
10
  export const EDITOR_STATE = Object.freeze({
11
11
  VIRGIN: 'STATE_VIRGIN',
@@ -472,7 +472,7 @@ export class BaseEditor {
472
472
  } else if (['top', 'master', 'bottom'].includes(overlayName)) {
473
473
  cellStartOffset += firstColumnOffset - horizontalScrollPosition;
474
474
  }
475
- const cellComputedStyle = getComputedStyle(this.TD, this.hot.rootWindow);
475
+ const cellComputedStyle = rootWindow.getComputedStyle(this.TD);
476
476
  const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
477
477
  const inlineStartBorderCompensation = parseInt(cellComputedStyle[borderPhysicalWidthProp], 10) > 0 ? 0 : 1;
478
478
  const topBorderCompensation = parseInt(cellComputedStyle.borderTopWidth, 10) > 0 ? 0 : 1;
@@ -41,6 +41,10 @@ class HandsontableEditor extends _textEditor.TextEditor {
41
41
  }
42
42
  (0, _element.setCaretPosition)(this.TEXTAREA, 0, this.TEXTAREA.value.length);
43
43
  this.refreshDimensions();
44
+ this.htEditor.updateSettings({
45
+ width: this.getWidth(),
46
+ height: this.getHeight()
47
+ });
44
48
  }
45
49
 
46
50
  /**
@@ -147,6 +151,26 @@ class HandsontableEditor extends _textEditor.TextEditor {
147
151
  super.finishEditing(restoreOriginalValue, ctrlDown, callback);
148
152
  }
149
153
 
154
+ /**
155
+ * Calculates and return the internal Handsontable's height.
156
+ *
157
+ * @private
158
+ * @returns {number}
159
+ */
160
+ getHeight() {
161
+ return this.htEditor.view.getTableHeight();
162
+ }
163
+
164
+ /**
165
+ * Calculates and return the internal Handsontable's width.
166
+ *
167
+ * @private
168
+ * @returns {number}
169
+ */
170
+ getWidth() {
171
+ return this.htEditor.view.getTableWidth();
172
+ }
173
+
150
174
  /**
151
175
  * Assigns afterDestroy callback to prevent memory leaks.
152
176
  *
@@ -38,6 +38,10 @@ export class HandsontableEditor extends TextEditor {
38
38
  }
39
39
  setCaretPosition(this.TEXTAREA, 0, this.TEXTAREA.value.length);
40
40
  this.refreshDimensions();
41
+ this.htEditor.updateSettings({
42
+ width: this.getWidth(),
43
+ height: this.getHeight()
44
+ });
41
45
  }
42
46
 
43
47
  /**
@@ -144,6 +148,26 @@ export class HandsontableEditor extends TextEditor {
144
148
  super.finishEditing(restoreOriginalValue, ctrlDown, callback);
145
149
  }
146
150
 
151
+ /**
152
+ * Calculates and return the internal Handsontable's height.
153
+ *
154
+ * @private
155
+ * @returns {number}
156
+ */
157
+ getHeight() {
158
+ return this.htEditor.view.getTableHeight();
159
+ }
160
+
161
+ /**
162
+ * Calculates and return the internal Handsontable's width.
163
+ *
164
+ * @private
165
+ * @returns {number}
166
+ */
167
+ getWidth() {
168
+ return this.htEditor.view.getTableWidth();
169
+ }
170
+
147
171
  /**
148
172
  * Assigns afterDestroy callback to prevent memory leaks.
149
173
  *
@@ -308,11 +308,11 @@ class TextEditor extends _baseEditor.BaseEditor {
308
308
  this.textareaParentStyle.top = `${top}px`;
309
309
  this.textareaParentStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
310
310
  this.showEditableElement();
311
- const cellComputedStyle = (0, _element.getComputedStyle)(this.TD, this.hot.rootWindow);
311
+ const cellComputedStyle = this.hot.rootWindow.getComputedStyle(this.TD);
312
312
  this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
313
313
  this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
314
314
  this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
315
- const textareaComputedStyle = (0, _element.getComputedStyle)(this.TEXTAREA);
315
+ const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
316
316
  const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
317
317
  const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
318
318
  const finalWidth = width - horizontalPadding;
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
5
5
  import { BaseEditor, EDITOR_STATE } from "../baseEditor/index.mjs";
6
6
  import EventManager from "../../eventManager.mjs";
7
7
  import { isEdge, isIOS } from "../../helpers/browser.mjs";
8
- import { addClass, getComputedStyle, isThisHotChild, setCaretPosition, hasClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
8
+ import { addClass, isThisHotChild, setCaretPosition, hasClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
9
9
  import { rangeEach } from "../../helpers/number.mjs";
10
10
  import { createInputElementResizer } from "../../utils/autoResize.mjs";
11
11
  import { isDefined } from "../../helpers/mixed.mjs";
@@ -304,11 +304,11 @@ export class TextEditor extends BaseEditor {
304
304
  this.textareaParentStyle.top = `${top}px`;
305
305
  this.textareaParentStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
306
306
  this.showEditableElement();
307
- const cellComputedStyle = getComputedStyle(this.TD, this.hot.rootWindow);
307
+ const cellComputedStyle = this.hot.rootWindow.getComputedStyle(this.TD);
308
308
  this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
309
309
  this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
310
310
  this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
311
- const textareaComputedStyle = getComputedStyle(this.TEXTAREA);
311
+ const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
312
312
  const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
313
313
  const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
314
314
  const finalWidth = width - horizontalPadding;
@@ -10,7 +10,6 @@ exports.empty = empty;
10
10
  exports.fastInnerHTML = fastInnerHTML;
11
11
  exports.fastInnerText = fastInnerText;
12
12
  exports.getCaretPosition = getCaretPosition;
13
- exports.getComputedStyle = getComputedStyle;
14
13
  exports.getCssTransform = getCssTransform;
15
14
  exports.getFrameElement = getFrameElement;
16
15
  exports.getMaximumScrollLeft = getMaximumScrollLeft;
@@ -488,6 +487,7 @@ function fastInnerText(element, content) {
488
487
  */
489
488
  function isVisible(element) {
490
489
  const documentElement = element.ownerDocument.documentElement;
490
+ const windowElement = element.ownerDocument.defaultView;
491
491
  let next = element;
492
492
  while (next !== documentElement) {
493
493
  // until <html> reached
@@ -510,7 +510,7 @@ function isVisible(element) {
510
510
  } else {
511
511
  return false; // this is a node detached from document in IE8
512
512
  }
513
- } else if (getComputedStyle(next).display === 'none') {
513
+ } else if (windowElement.getComputedStyle(next).display === 'none') {
514
514
  return false;
515
515
  }
516
516
  next = next.parentNode;
@@ -700,7 +700,7 @@ function getTrimmingContainer(base) {
700
700
  if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
701
701
  return el;
702
702
  }
703
- const computedStyle = getComputedStyle(el, rootWindow);
703
+ const computedStyle = rootWindow.getComputedStyle(el);
704
704
  const allowedProperties = ['scroll', 'hidden', 'auto'];
705
705
  const property = computedStyle.getPropertyValue('overflow');
706
706
  const propertyY = computedStyle.getPropertyValue('overflow-y');
@@ -738,7 +738,7 @@ function getStyle(element, prop) {
738
738
  if (styleProp !== '' && styleProp !== undefined) {
739
739
  return styleProp;
740
740
  }
741
- const computedStyle = getComputedStyle(element, rootWindow);
741
+ const computedStyle = rootWindow.getComputedStyle(element);
742
742
  if (computedStyle[prop] !== '' && computedStyle[prop] !== undefined) {
743
743
  return computedStyle[prop];
744
744
  }
@@ -766,19 +766,6 @@ function matchesCSSRules(element, rule) {
766
766
  return result;
767
767
  }
768
768
 
769
- /**
770
- * Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet).
771
- *
772
- * @param {HTMLElement} element An element to get style from.
773
- * @param {Window} [rootWindow] The document window owner.
774
- * @returns {IEElementStyle|CssStyle} Elements computed style object.
775
- */
776
- // eslint-disable-next-line no-restricted-globals
777
- function getComputedStyle(element) {
778
- let rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
779
- return element.currentStyle || rootWindow.getComputedStyle(element);
780
- }
781
-
782
769
  /**
783
770
  * Returns the element's outer width.
784
771
  *
@@ -428,6 +428,7 @@ export function fastInnerText(element, content) {
428
428
  */
429
429
  export function isVisible(element) {
430
430
  const documentElement = element.ownerDocument.documentElement;
431
+ const windowElement = element.ownerDocument.defaultView;
431
432
  let next = element;
432
433
  while (next !== documentElement) {
433
434
  // until <html> reached
@@ -450,7 +451,7 @@ export function isVisible(element) {
450
451
  } else {
451
452
  return false; // this is a node detached from document in IE8
452
453
  }
453
- } else if (getComputedStyle(next).display === 'none') {
454
+ } else if (windowElement.getComputedStyle(next).display === 'none') {
454
455
  return false;
455
456
  }
456
457
  next = next.parentNode;
@@ -640,7 +641,7 @@ export function getTrimmingContainer(base) {
640
641
  if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
641
642
  return el;
642
643
  }
643
- const computedStyle = getComputedStyle(el, rootWindow);
644
+ const computedStyle = rootWindow.getComputedStyle(el);
644
645
  const allowedProperties = ['scroll', 'hidden', 'auto'];
645
646
  const property = computedStyle.getPropertyValue('overflow');
646
647
  const propertyY = computedStyle.getPropertyValue('overflow-y');
@@ -678,7 +679,7 @@ export function getStyle(element, prop) {
678
679
  if (styleProp !== '' && styleProp !== undefined) {
679
680
  return styleProp;
680
681
  }
681
- const computedStyle = getComputedStyle(element, rootWindow);
682
+ const computedStyle = rootWindow.getComputedStyle(element);
682
683
  if (computedStyle[prop] !== '' && computedStyle[prop] !== undefined) {
683
684
  return computedStyle[prop];
684
685
  }
@@ -706,19 +707,6 @@ export function matchesCSSRules(element, rule) {
706
707
  return result;
707
708
  }
708
709
 
709
- /**
710
- * Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet).
711
- *
712
- * @param {HTMLElement} element An element to get style from.
713
- * @param {Window} [rootWindow] The document window owner.
714
- * @returns {IEElementStyle|CssStyle} Elements computed style object.
715
- */
716
- // eslint-disable-next-line no-restricted-globals
717
- export function getComputedStyle(element) {
718
- let rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
719
- return element.currentStyle || rootWindow.getComputedStyle(element);
720
- }
721
-
722
710
  /**
723
711
  * Returns the element's outer width.
724
712
  *
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-c8116f8-20240920";
137
+ const hotVersion = "0.0.0-next-ffdf116-20240926";
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-c8116f8-20240920";
127
+ const hotVersion = "0.0.0-next-ffdf116-20240926";
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-c8116f8-20240920",
13
+ "version": "0.0.0-next-ffdf116-20240926",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -57,7 +57,7 @@ class Menu {
57
57
  */
58
58
  get tableBorderWidth() {
59
59
  if (_classPrivateFieldGet(_tableBorderWidth, this) === undefined && this.hotMenu) {
60
- _classPrivateFieldSet(_tableBorderWidth, this, parseInt((0, _element.getComputedStyle)(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
60
+ _classPrivateFieldSet(_tableBorderWidth, this, parseInt(this.hotMenu.rootWindow.getComputedStyle(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
61
61
  }
62
62
  return _classPrivateFieldGet(_tableBorderWidth, this);
63
63
  }
@@ -16,7 +16,7 @@ import { filterSeparators, hasSubMenu, isItemHidden, normalizeSelection, isItemS
16
16
  import EventManager from "../../../eventManager.mjs";
17
17
  import { arrayEach, arrayFilter, arrayReduce } from "../../../helpers/array.mjs";
18
18
  import { isWindowsOS, isMobileBrowser, isIpadOS } from "../../../helpers/browser.mjs";
19
- import { addClass, isChildOf, getComputedStyle, getParentWindow, hasClass, setAttribute, outerHeight } from "../../../helpers/dom/element.mjs";
19
+ import { addClass, isChildOf, getParentWindow, hasClass, setAttribute, outerHeight } from "../../../helpers/dom/element.mjs";
20
20
  import { isRightClick } from "../../../helpers/dom/event.mjs";
21
21
  import { debounce, isFunction } from "../../../helpers/function.mjs";
22
22
  import { isUndefined, isDefined } from "../../../helpers/mixed.mjs";
@@ -53,7 +53,7 @@ export class Menu {
53
53
  */
54
54
  get tableBorderWidth() {
55
55
  if (_classPrivateFieldGet(_tableBorderWidth, this) === undefined && this.hotMenu) {
56
- _classPrivateFieldSet(_tableBorderWidth, this, parseInt(getComputedStyle(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
56
+ _classPrivateFieldSet(_tableBorderWidth, this, parseInt(this.hotMenu.rootWindow.getComputedStyle(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
57
57
  }
58
58
  return _classPrivateFieldGet(_tableBorderWidth, this);
59
59
  }
@@ -165,7 +165,8 @@ class Positioner {
165
165
  setPositionOnRightOfCursor() {
166
166
  let left = _classPrivateFieldGet(_cursor, this).left;
167
167
  if (_classPrivateFieldGet(_parentContainer, this)) {
168
- const borderRightWidth = Number.parseInt(getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderRightWidth, 10);
168
+ const rootWindow = _classPrivateFieldGet(_parentContainer, this).ownerDocument.defaultView;
169
+ const borderRightWidth = Number.parseInt(rootWindow.getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderRightWidth, 10);
169
170
  left += _classPrivateFieldGet(_cursor, this).cellWidth + borderRightWidth;
170
171
  } else {
171
172
  left += _classPrivateFieldGet(_offset, this).right;
@@ -179,7 +180,8 @@ class Positioner {
179
180
  setPositionOnLeftOfCursor() {
180
181
  let left = _classPrivateFieldGet(_offset, this).left + _classPrivateFieldGet(_cursor, this).left - _classPrivateFieldGet(_container, this).offsetWidth;
181
182
  if (_classPrivateFieldGet(_parentContainer, this)) {
182
- const borderLeftWidth = Number.parseInt(getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderLeftWidth, 10);
183
+ const rootWindow = _classPrivateFieldGet(_parentContainer, this).ownerDocument.defaultView;
184
+ const borderLeftWidth = Number.parseInt(rootWindow.getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderLeftWidth, 10);
183
185
  left -= borderLeftWidth;
184
186
  }
185
187
  _classPrivateFieldGet(_container, this).style.left = `${left}px`;
@@ -162,7 +162,8 @@ export class Positioner {
162
162
  setPositionOnRightOfCursor() {
163
163
  let left = _classPrivateFieldGet(_cursor, this).left;
164
164
  if (_classPrivateFieldGet(_parentContainer, this)) {
165
- const borderRightWidth = Number.parseInt(getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderRightWidth, 10);
165
+ const rootWindow = _classPrivateFieldGet(_parentContainer, this).ownerDocument.defaultView;
166
+ const borderRightWidth = Number.parseInt(rootWindow.getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderRightWidth, 10);
166
167
  left += _classPrivateFieldGet(_cursor, this).cellWidth + borderRightWidth;
167
168
  } else {
168
169
  left += _classPrivateFieldGet(_offset, this).right;
@@ -176,7 +177,8 @@ export class Positioner {
176
177
  setPositionOnLeftOfCursor() {
177
178
  let left = _classPrivateFieldGet(_offset, this).left + _classPrivateFieldGet(_cursor, this).left - _classPrivateFieldGet(_container, this).offsetWidth;
178
179
  if (_classPrivateFieldGet(_parentContainer, this)) {
179
- const borderLeftWidth = Number.parseInt(getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderLeftWidth, 10);
180
+ const rootWindow = _classPrivateFieldGet(_parentContainer, this).ownerDocument.defaultView;
181
+ const borderLeftWidth = Number.parseInt(rootWindow.getComputedStyle(_classPrivateFieldGet(_parentContainer, this).querySelector('.htCore')).borderLeftWidth, 10);
180
182
  left -= borderLeftWidth;
181
183
  }
182
184
  _classPrivateFieldGet(_container, this).style.left = `${left}px`;
package/tableView.js CHANGED
@@ -1472,6 +1472,42 @@ class TableView {
1472
1472
  isVisible() {
1473
1473
  return this._wt.wtTable.isVisible();
1474
1474
  }
1475
+
1476
+ /**
1477
+ * Checks if the table has a horizontal scrollbar.
1478
+ *
1479
+ * @returns {boolean}
1480
+ */
1481
+ hasVerticalScroll() {
1482
+ return this._wt.wtViewport.hasVerticalScroll();
1483
+ }
1484
+
1485
+ /**
1486
+ * Checks if the table has a vertical scrollbar.
1487
+ *
1488
+ * @returns {boolean}
1489
+ */
1490
+ hasHorizontalScroll() {
1491
+ return this._wt.wtViewport.hasHorizontalScroll();
1492
+ }
1493
+
1494
+ /**
1495
+ * Gets the table's width.
1496
+ *
1497
+ * @returns {boolean}
1498
+ */
1499
+ getTableWidth() {
1500
+ return this._wt.wtTable.getWidth();
1501
+ }
1502
+
1503
+ /**
1504
+ * Gets the table's height.
1505
+ *
1506
+ * @returns {boolean}
1507
+ */
1508
+ getTableHeight() {
1509
+ return this._wt.wtTable.getHeight();
1510
+ }
1475
1511
  /**
1476
1512
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1477
1513
  *
package/tableView.mjs CHANGED
@@ -1468,6 +1468,42 @@ class TableView {
1468
1468
  isVisible() {
1469
1469
  return this._wt.wtTable.isVisible();
1470
1470
  }
1471
+
1472
+ /**
1473
+ * Checks if the table has a horizontal scrollbar.
1474
+ *
1475
+ * @returns {boolean}
1476
+ */
1477
+ hasVerticalScroll() {
1478
+ return this._wt.wtViewport.hasVerticalScroll();
1479
+ }
1480
+
1481
+ /**
1482
+ * Checks if the table has a vertical scrollbar.
1483
+ *
1484
+ * @returns {boolean}
1485
+ */
1486
+ hasHorizontalScroll() {
1487
+ return this._wt.wtViewport.hasHorizontalScroll();
1488
+ }
1489
+
1490
+ /**
1491
+ * Gets the table's width.
1492
+ *
1493
+ * @returns {boolean}
1494
+ */
1495
+ getTableWidth() {
1496
+ return this._wt.wtTable.getWidth();
1497
+ }
1498
+
1499
+ /**
1500
+ * Gets the table's height.
1501
+ *
1502
+ * @returns {boolean}
1503
+ */
1504
+ getTableHeight() {
1505
+ return this._wt.wtTable.getHeight();
1506
+ }
1471
1507
  /**
1472
1508
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1473
1509
  *