handsontable 0.0.0-next-407bbbc-20241107 → 0.0.0-next-6129043-20241108

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 (101) hide show
  1. package/3rdparty/walkontable/src/calculator/index.js +1 -2
  2. package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  5. package/3rdparty/walkontable/src/core/_base.js +3 -0
  6. package/3rdparty/walkontable/src/core/_base.mjs +3 -0
  7. package/3rdparty/walkontable/src/core/clone.js +1 -0
  8. package/3rdparty/walkontable/src/core/clone.mjs +1 -0
  9. package/3rdparty/walkontable/src/core/core.js +2 -0
  10. package/3rdparty/walkontable/src/core/core.mjs +2 -0
  11. package/3rdparty/walkontable/src/facade/core.js +3 -0
  12. package/3rdparty/walkontable/src/facade/core.mjs +3 -0
  13. package/3rdparty/walkontable/src/index.js +0 -1
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/overlay/_base.js +3 -1
  16. package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
  17. package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
  18. package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  21. package/3rdparty/walkontable/src/renderer/index.js +4 -2
  22. package/3rdparty/walkontable/src/renderer/index.mjs +4 -2
  23. package/3rdparty/walkontable/src/renderer/table.js +12 -3
  24. package/3rdparty/walkontable/src/renderer/table.mjs +12 -3
  25. package/3rdparty/walkontable/src/settings.js +0 -2
  26. package/3rdparty/walkontable/src/settings.mjs +0 -2
  27. package/3rdparty/walkontable/src/table.js +15 -9
  28. package/3rdparty/walkontable/src/table.mjs +15 -9
  29. package/3rdparty/walkontable/src/types.js +1 -0
  30. package/3rdparty/walkontable/src/types.mjs +1 -0
  31. package/3rdparty/walkontable/src/utils/column.js +1 -1
  32. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  33. package/3rdparty/walkontable/src/utils/stylesHandler.js +271 -0
  34. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +267 -0
  35. package/3rdparty/walkontable/src/viewport.js +1 -0
  36. package/3rdparty/walkontable/src/viewport.mjs +1 -0
  37. package/base.js +2 -2
  38. package/base.mjs +2 -2
  39. package/core.d.ts +2 -0
  40. package/core.js +46 -0
  41. package/core.mjs +46 -0
  42. package/dataMap/metaManager/metaSchema.js +23 -3
  43. package/dataMap/metaManager/metaSchema.mjs +23 -3
  44. package/dist/handsontable.css +17 -9
  45. package/dist/handsontable.full.css +249 -240
  46. package/dist/handsontable.full.js +4125 -3841
  47. package/dist/handsontable.full.min.css +11 -9
  48. package/dist/handsontable.full.min.js +26 -26
  49. package/dist/handsontable.js +3832 -3542
  50. package/dist/handsontable.min.css +5 -4
  51. package/dist/handsontable.min.js +24 -24
  52. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  53. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  54. package/editors/baseEditor/baseEditor.js +1 -1
  55. package/editors/baseEditor/baseEditor.mjs +1 -1
  56. package/editors/dateEditor/dateEditor.js +2 -0
  57. package/editors/dateEditor/dateEditor.mjs +2 -0
  58. package/editors/handsontableEditor/handsontableEditor.js +2 -1
  59. package/editors/handsontableEditor/handsontableEditor.mjs +2 -1
  60. package/editors/selectEditor/selectEditor.js +20 -9
  61. package/editors/selectEditor/selectEditor.mjs +20 -9
  62. package/editors/textEditor/textEditor.js +4 -11
  63. package/editors/textEditor/textEditor.mjs +4 -11
  64. package/helpers/dom/element.js +31 -0
  65. package/helpers/dom/element.mjs +30 -0
  66. package/helpers/mixed.js +2 -2
  67. package/helpers/mixed.mjs +2 -2
  68. package/helpers/themes.js +17 -0
  69. package/helpers/themes.mjs +13 -0
  70. package/package.json +10 -3
  71. package/plugins/comments/commentEditor.js +9 -0
  72. package/plugins/comments/commentEditor.mjs +9 -0
  73. package/plugins/comments/comments.js +8 -0
  74. package/plugins/comments/comments.mjs +8 -0
  75. package/plugins/contextMenu/menu/menu.js +3 -4
  76. package/plugins/contextMenu/menu/menu.mjs +3 -4
  77. package/plugins/manualRowMove/manualRowMove.js +1 -1
  78. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  79. package/plugins/manualRowResize/manualRowResize.js +1 -2
  80. package/plugins/manualRowResize/manualRowResize.mjs +2 -3
  81. package/plugins/mergeCells/mergeCells.js +1 -1
  82. package/plugins/mergeCells/mergeCells.mjs +1 -1
  83. package/plugins/nestedRows/ui/headers.js +7 -1
  84. package/plugins/nestedRows/ui/headers.mjs +7 -1
  85. package/plugins/stretchColumns/calculator.js +2 -1
  86. package/plugins/stretchColumns/calculator.mjs +3 -2
  87. package/renderers/checkboxRenderer/checkboxRenderer.js +6 -1
  88. package/renderers/checkboxRenderer/checkboxRenderer.mjs +6 -1
  89. package/settings.d.ts +1 -0
  90. package/styles/handsontable.css +2053 -0
  91. package/styles/handsontable.min.css +30 -0
  92. package/styles/ht-theme-horizon.css +571 -0
  93. package/styles/ht-theme-horizon.min.css +30 -0
  94. package/styles/ht-theme-main.css +575 -0
  95. package/styles/ht-theme-main.min.css +30 -0
  96. package/tableView.js +46 -0
  97. package/tableView.mjs +47 -1
  98. package/utils/autoResize.js +4 -1
  99. package/utils/autoResize.mjs +4 -1
  100. package/utils/ghostTable.js +5 -3
  101. package/utils/ghostTable.mjs +5 -3
@@ -375,7 +375,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
375
375
  let lastRowHeight = 0;
376
376
  let height = null;
377
377
  do {
378
- lastRowHeight = this.htEditor.getRowHeight(i) || this.htEditor.view._wt.getSetting('defaultRowHeight');
378
+ lastRowHeight = this.htEditor.getRowHeight(i) || this.htEditor.view.getDefaultRowHeight();
379
379
  tempHeight += lastRowHeight;
380
380
  i += 1;
381
381
  } while (tempHeight < spaceAvailable);
@@ -372,7 +372,7 @@ export class AutocompleteEditor extends HandsontableEditor {
372
372
  let lastRowHeight = 0;
373
373
  let height = null;
374
374
  do {
375
- lastRowHeight = this.htEditor.getRowHeight(i) || this.htEditor.view._wt.getSetting('defaultRowHeight');
375
+ lastRowHeight = this.htEditor.getRowHeight(i) || this.htEditor.view.getDefaultRowHeight();
376
376
  tempHeight += lastRowHeight;
377
377
  i += 1;
378
378
  } while (tempHeight < spaceAvailable);
@@ -492,7 +492,7 @@ class BaseEditor {
492
492
  const actualVerticalScrollbarWidth = (0, _element.hasVerticalScrollbar)(scrollableContainerTop) ? scrollbarWidth : 0;
493
493
  const actualHorizontalScrollbarWidth = (0, _element.hasHorizontalScrollbar)(scrollableContainerLeft) ? scrollbarWidth : 0;
494
494
  const maxWidth = this.hot.view.maximumVisibleElementWidth(cellStartOffset) - actualVerticalScrollbarWidth + inlineStartBorderCompensation;
495
- const maxHeight = Math.max(this.hot.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth + topBorderCompensation, 23);
495
+ const maxHeight = Math.max(this.hot.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth + topBorderCompensation, this.hot.view.getDefaultRowHeight());
496
496
  return {
497
497
  top: topPos,
498
498
  start: inlineStartPos,
@@ -488,7 +488,7 @@ export class BaseEditor {
488
488
  const actualVerticalScrollbarWidth = hasVerticalScrollbar(scrollableContainerTop) ? scrollbarWidth : 0;
489
489
  const actualHorizontalScrollbarWidth = hasHorizontalScrollbar(scrollableContainerLeft) ? scrollbarWidth : 0;
490
490
  const maxWidth = this.hot.view.maximumVisibleElementWidth(cellStartOffset) - actualVerticalScrollbarWidth + inlineStartBorderCompensation;
491
- const maxHeight = Math.max(this.hot.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth + topBorderCompensation, 23);
491
+ const maxHeight = Math.max(this.hot.view.maximumVisibleElementHeight(cellTopOffset) - actualHorizontalScrollbarWidth + topBorderCompensation, this.hot.view.getDefaultRowHeight());
492
492
  return {
493
493
  top: topPos,
494
494
  start: inlineStartPos,
@@ -66,7 +66,9 @@ class DateEditor extends _textEditor.TextEditor {
66
66
  this.datePickerStyle.left = 0;
67
67
  this.datePickerStyle.zIndex = 9999;
68
68
  this.datePicker.setAttribute('dir', this.hot.isRtl() ? 'rtl' : 'ltr');
69
+ const themeClassName = this.hot.getCurrentThemeName();
69
70
  (0, _element.addClass)(this.datePicker, 'htDatepickerHolder');
71
+ (0, _element.addClass)(this.datePicker, themeClassName);
70
72
  this.hot.rootDocument.body.appendChild(this.datePicker);
71
73
 
72
74
  /**
@@ -62,7 +62,9 @@ export class DateEditor extends TextEditor {
62
62
  this.datePickerStyle.left = 0;
63
63
  this.datePickerStyle.zIndex = 9999;
64
64
  this.datePicker.setAttribute('dir', this.hot.isRtl() ? 'rtl' : 'ltr');
65
+ const themeClassName = this.hot.getCurrentThemeName();
65
66
  addClass(this.datePicker, 'htDatepickerHolder');
67
+ addClass(this.datePicker, themeClassName);
66
68
  this.hot.rootDocument.body.appendChild(this.datePicker);
67
69
 
68
70
  /**
@@ -85,6 +85,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
85
85
  autoWrapCol: false,
86
86
  autoWrapRow: false,
87
87
  ariaTags: false,
88
+ themeName: this.hot.getCurrentThemeName(),
88
89
  afterOnCellMouseDown(_, coords) {
89
90
  const sourceValue = this.getSourceData(coords.row, coords.col);
90
91
 
@@ -158,7 +159,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
158
159
  * @returns {number}
159
160
  */
160
161
  getHeight() {
161
- return this.htEditor.view.getTableHeight();
162
+ return this.htEditor.view.getTableHeight() + 1;
162
163
  }
163
164
 
164
165
  /**
@@ -82,6 +82,7 @@ export class HandsontableEditor extends TextEditor {
82
82
  autoWrapCol: false,
83
83
  autoWrapRow: false,
84
84
  ariaTags: false,
85
+ themeName: this.hot.getCurrentThemeName(),
85
86
  afterOnCellMouseDown(_, coords) {
86
87
  const sourceValue = this.getSourceData(coords.row, coords.col);
87
88
 
@@ -155,7 +156,7 @@ export class HandsontableEditor extends TextEditor {
155
156
  * @returns {number}
156
157
  */
157
158
  getHeight() {
158
- return this.htEditor.view.getTableHeight();
159
+ return this.htEditor.view.getTableHeight() + 1;
159
160
  }
160
161
 
161
162
  /**
@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  var _baseEditor = require("../baseEditor");
5
5
  var _element = require("../../helpers/dom/element");
6
6
  var _object = require("../../helpers/object");
7
+ var _a11y = require("../../helpers/a11y");
7
8
  const EDITOR_VISIBLE_CLASS_NAME = 'ht_editor_visible';
8
9
  const SHORTCUTS_GROUP = 'selectEditor';
9
10
  const EDITOR_TYPE = exports.EDITOR_TYPE = 'select';
@@ -21,11 +22,21 @@ class SelectEditor extends _baseEditor.BaseEditor {
21
22
  * Initializes editor instance, DOM Element and mount hooks.
22
23
  */
23
24
  init() {
25
+ this.selectWrapper = this.hot.rootDocument.createElement('div');
24
26
  this.select = this.hot.rootDocument.createElement('select');
25
27
  this.select.setAttribute('data-hot-input', 'true');
26
- this.select.style.display = 'none';
27
- (0, _element.addClass)(this.select, 'htSelectEditor');
28
- this.hot.rootElement.appendChild(this.select);
28
+ this.selectWrapper.style.display = 'none';
29
+ const ARROW = this.hot.rootDocument.createElement('DIV');
30
+ const isAriaEnabled = this.hot.getSettings().ariaTags;
31
+ ARROW.className = 'htAutocompleteArrow';
32
+ if (isAriaEnabled) {
33
+ ARROW.setAttribute(...(0, _a11y.A11Y_HIDDEN)());
34
+ }
35
+ ARROW.appendChild(this.hot.rootDocument.createTextNode(String.fromCharCode(9660)));
36
+ (0, _element.addClass)(this.selectWrapper, 'htSelectEditor');
37
+ this.selectWrapper.appendChild(this.select);
38
+ this.selectWrapper.insertBefore(ARROW, this.selectWrapper.firstChild);
39
+ this.hot.rootElement.appendChild(this.selectWrapper);
29
40
  this.registerHooks();
30
41
  }
31
42
 
@@ -53,7 +64,7 @@ class SelectEditor extends _baseEditor.BaseEditor {
53
64
  open() {
54
65
  this._opened = true;
55
66
  this.refreshDimensions();
56
- this.select.style.display = '';
67
+ this.selectWrapper.style.display = '';
57
68
  const shortcutManager = this.hot.getShortcutManager();
58
69
  shortcutManager.setActiveContextName('editor');
59
70
  this.registerShortcuts();
@@ -64,9 +75,9 @@ class SelectEditor extends _baseEditor.BaseEditor {
64
75
  */
65
76
  close() {
66
77
  this._opened = false;
67
- this.select.style.display = 'none';
68
- if ((0, _element.hasClass)(this.select, EDITOR_VISIBLE_CLASS_NAME)) {
69
- (0, _element.removeClass)(this.select, EDITOR_VISIBLE_CLASS_NAME);
78
+ this.selectWrapper.style.display = 'none';
79
+ if ((0, _element.hasClass)(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME)) {
80
+ (0, _element.removeClass)(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME);
70
81
  }
71
82
  this.unregisterShortcuts();
72
83
  this.clearHooks();
@@ -172,13 +183,13 @@ class SelectEditor extends _baseEditor.BaseEditor {
172
183
  width,
173
184
  height
174
185
  } = this.getEditedCellRect();
175
- const selectStyle = this.select.style;
186
+ const selectStyle = this.selectWrapper.style;
176
187
  selectStyle.height = `${height}px`;
177
188
  selectStyle.width = `${width}px`;
178
189
  selectStyle.top = `${top}px`;
179
190
  selectStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
180
191
  selectStyle.margin = '0px';
181
- (0, _element.addClass)(this.select, EDITOR_VISIBLE_CLASS_NAME);
192
+ (0, _element.addClass)(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME);
182
193
  }
183
194
 
184
195
  /**
@@ -1,6 +1,7 @@
1
1
  import { BaseEditor, EDITOR_STATE } from "../baseEditor/index.mjs";
2
2
  import { addClass, empty, fastInnerHTML, hasClass, removeClass } from "../../helpers/dom/element.mjs";
3
3
  import { objectEach } from "../../helpers/object.mjs";
4
+ import { A11Y_HIDDEN } from "../../helpers/a11y.mjs";
4
5
  const EDITOR_VISIBLE_CLASS_NAME = 'ht_editor_visible';
5
6
  const SHORTCUTS_GROUP = 'selectEditor';
6
7
  export const EDITOR_TYPE = 'select';
@@ -18,11 +19,21 @@ export class SelectEditor extends BaseEditor {
18
19
  * Initializes editor instance, DOM Element and mount hooks.
19
20
  */
20
21
  init() {
22
+ this.selectWrapper = this.hot.rootDocument.createElement('div');
21
23
  this.select = this.hot.rootDocument.createElement('select');
22
24
  this.select.setAttribute('data-hot-input', 'true');
23
- this.select.style.display = 'none';
24
- addClass(this.select, 'htSelectEditor');
25
- this.hot.rootElement.appendChild(this.select);
25
+ this.selectWrapper.style.display = 'none';
26
+ const ARROW = this.hot.rootDocument.createElement('DIV');
27
+ const isAriaEnabled = this.hot.getSettings().ariaTags;
28
+ ARROW.className = 'htAutocompleteArrow';
29
+ if (isAriaEnabled) {
30
+ ARROW.setAttribute(...A11Y_HIDDEN());
31
+ }
32
+ ARROW.appendChild(this.hot.rootDocument.createTextNode(String.fromCharCode(9660)));
33
+ addClass(this.selectWrapper, 'htSelectEditor');
34
+ this.selectWrapper.appendChild(this.select);
35
+ this.selectWrapper.insertBefore(ARROW, this.selectWrapper.firstChild);
36
+ this.hot.rootElement.appendChild(this.selectWrapper);
26
37
  this.registerHooks();
27
38
  }
28
39
 
@@ -50,7 +61,7 @@ export class SelectEditor extends BaseEditor {
50
61
  open() {
51
62
  this._opened = true;
52
63
  this.refreshDimensions();
53
- this.select.style.display = '';
64
+ this.selectWrapper.style.display = '';
54
65
  const shortcutManager = this.hot.getShortcutManager();
55
66
  shortcutManager.setActiveContextName('editor');
56
67
  this.registerShortcuts();
@@ -61,9 +72,9 @@ export class SelectEditor extends BaseEditor {
61
72
  */
62
73
  close() {
63
74
  this._opened = false;
64
- this.select.style.display = 'none';
65
- if (hasClass(this.select, EDITOR_VISIBLE_CLASS_NAME)) {
66
- removeClass(this.select, EDITOR_VISIBLE_CLASS_NAME);
75
+ this.selectWrapper.style.display = 'none';
76
+ if (hasClass(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME)) {
77
+ removeClass(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME);
67
78
  }
68
79
  this.unregisterShortcuts();
69
80
  this.clearHooks();
@@ -169,13 +180,13 @@ export class SelectEditor extends BaseEditor {
169
180
  width,
170
181
  height
171
182
  } = this.getEditedCellRect();
172
- const selectStyle = this.select.style;
183
+ const selectStyle = this.selectWrapper.style;
173
184
  selectStyle.height = `${height}px`;
174
185
  selectStyle.width = `${width}px`;
175
186
  selectStyle.top = `${top}px`;
176
187
  selectStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
177
188
  selectStyle.margin = '0px';
178
- addClass(this.select, EDITOR_VISIBLE_CLASS_NAME);
189
+ addClass(this.selectWrapper, EDITOR_VISIBLE_CLASS_NAME);
179
190
  }
180
191
 
181
192
  /**
@@ -309,19 +309,12 @@ class TextEditor extends _baseEditor.BaseEditor {
309
309
  this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
310
310
  this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
311
311
  this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
312
- const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
313
- const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
314
- const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
315
- const finalWidth = width - horizontalPadding;
316
- const finalHeight = height - verticalPadding;
317
- const finalMaxWidth = maxWidth - horizontalPadding;
318
- const finalMaxHeight = maxHeight - verticalPadding;
319
312
  this.autoResize.init(this.TEXTAREA, {
320
- minWidth: Math.min(finalWidth, finalMaxWidth),
321
- minHeight: Math.min(finalHeight, finalMaxHeight),
313
+ minWidth: Math.min(width, maxWidth),
314
+ minHeight: Math.min(height, maxHeight),
322
315
  // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar)
323
- maxWidth: finalMaxWidth,
324
- maxHeight: finalMaxHeight
316
+ maxWidth,
317
+ maxHeight
325
318
  }, true);
326
319
  }
327
320
 
@@ -305,19 +305,12 @@ export class TextEditor extends BaseEditor {
305
305
  this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
306
306
  this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
307
307
  this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
308
- const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
309
- const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
310
- const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
311
- const finalWidth = width - horizontalPadding;
312
- const finalHeight = height - verticalPadding;
313
- const finalMaxWidth = maxWidth - horizontalPadding;
314
- const finalMaxHeight = maxHeight - verticalPadding;
315
308
  this.autoResize.init(this.TEXTAREA, {
316
- minWidth: Math.min(finalWidth, finalMaxWidth),
317
- minHeight: Math.min(finalHeight, finalMaxHeight),
309
+ minWidth: Math.min(width, maxWidth),
310
+ minHeight: Math.min(height, maxHeight),
318
311
  // TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar)
319
- maxWidth: finalMaxWidth,
320
- maxHeight: finalMaxHeight
312
+ maxWidth,
313
+ maxHeight
321
314
  }, true);
322
315
  }
323
316
 
@@ -9,6 +9,7 @@ exports.closestDown = closestDown;
9
9
  exports.empty = empty;
10
10
  exports.fastInnerHTML = fastInnerHTML;
11
11
  exports.fastInnerText = fastInnerText;
12
+ exports.findFirstParentWithClass = findFirstParentWithClass;
12
13
  exports.getCaretPosition = getCaretPosition;
13
14
  exports.getCssTransform = getCssTransform;
14
15
  exports.getFrameElement = getFrameElement;
@@ -194,6 +195,36 @@ function closestDown(element, nodes, until) {
194
195
  return length ? matched[length - 1] : null;
195
196
  }
196
197
 
198
+ /**
199
+ * Traverses up the DOM tree from the given element and finds parent elements that have a specified class name
200
+ * or match a provided class name regular expression.
201
+ *
202
+ * @param {HTMLElement} element - The element from which to start traversing.
203
+ * @param {string|RegExp} className - The class name or class name regular expression to check.
204
+ * @returns {{element: HTMLElement, classNames: string[]}} - Returns an object containing the matched parent element and an array of matched class names.
205
+ */
206
+ function findFirstParentWithClass(element, className) {
207
+ const matched = {
208
+ element: undefined,
209
+ classNames: []
210
+ };
211
+ let elementToCheck = element;
212
+ while (elementToCheck !== null && elementToCheck !== element.ownerDocument.documentElement && !matched.element) {
213
+ if (typeof className === 'string' && elementToCheck.classList.contains(className)) {
214
+ matched.element = elementToCheck;
215
+ matched.classNames.push(className);
216
+ } else if (className instanceof RegExp) {
217
+ const matchingClasses = Array.from(elementToCheck.classList).filter(cls => className.test(cls));
218
+ if (matchingClasses.length) {
219
+ matched.element = elementToCheck;
220
+ matched.classNames.push(...matchingClasses);
221
+ }
222
+ }
223
+ elementToCheck = elementToCheck.parentElement;
224
+ }
225
+ return matched;
226
+ }
227
+
197
228
  /**
198
229
  * Goes up the DOM tree and checks if element is child of another element.
199
230
  *
@@ -135,6 +135,36 @@ export function closestDown(element, nodes, until) {
135
135
  return length ? matched[length - 1] : null;
136
136
  }
137
137
 
138
+ /**
139
+ * Traverses up the DOM tree from the given element and finds parent elements that have a specified class name
140
+ * or match a provided class name regular expression.
141
+ *
142
+ * @param {HTMLElement} element - The element from which to start traversing.
143
+ * @param {string|RegExp} className - The class name or class name regular expression to check.
144
+ * @returns {{element: HTMLElement, classNames: string[]}} - Returns an object containing the matched parent element and an array of matched class names.
145
+ */
146
+ export function findFirstParentWithClass(element, className) {
147
+ const matched = {
148
+ element: undefined,
149
+ classNames: []
150
+ };
151
+ let elementToCheck = element;
152
+ while (elementToCheck !== null && elementToCheck !== element.ownerDocument.documentElement && !matched.element) {
153
+ if (typeof className === 'string' && elementToCheck.classList.contains(className)) {
154
+ matched.element = elementToCheck;
155
+ matched.classNames.push(className);
156
+ } else if (className instanceof RegExp) {
157
+ const matchingClasses = Array.from(elementToCheck.classList).filter(cls => className.test(cls));
158
+ if (matchingClasses.length) {
159
+ matched.element = elementToCheck;
160
+ matched.classNames.push(...matchingClasses);
161
+ }
162
+ }
163
+ elementToCheck = elementToCheck.parentElement;
164
+ }
165
+ return matched;
166
+ }
167
+
138
168
  /**
139
169
  * Goes up the DOM tree and checks if element is child of another element.
140
170
  *
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-407bbbc-20241107";
137
+ const hotVersion = "0.0.0-next-6129043-20241108";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
@@ -188,7 +188,7 @@ function _injectProductInfo(key, element) {
188
188
  });
189
189
  if (message) {
190
190
  const messageNode = document.createElement('div');
191
- messageNode.className = 'hot-display-license-info';
191
+ messageNode.className = 'handsontable hot-display-license-info';
192
192
  messageNode.innerHTML = domMessages[domMessageState]({
193
193
  keyValidityDate,
194
194
  hotVersion
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-407bbbc-20241107";
127
+ const hotVersion = "0.0.0-next-6129043-20241108";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
@@ -178,7 +178,7 @@ export function _injectProductInfo(key, element) {
178
178
  });
179
179
  if (message) {
180
180
  const messageNode = document.createElement('div');
181
- messageNode.className = 'hot-display-license-info';
181
+ messageNode.className = 'handsontable hot-display-license-info';
182
182
  messageNode.innerHTML = domMessages[domMessageState]({
183
183
  keyValidityDate,
184
184
  hotVersion
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getThemeClassName = getThemeClassName;
5
+ var _element = require("./dom/element");
6
+ /**
7
+ * Retrieves the theme class name from the closest parent element that matches the specified regex pattern.
8
+ *
9
+ * @param {HTMLElement} rootElement - The root element from which to start searching for the theme class.
10
+ * @returns {string} - The theme class name regex.
11
+ */
12
+ function getThemeClassName(rootElement) {
13
+ const {
14
+ classNames
15
+ } = (0, _element.findFirstParentWithClass)(rootElement, /ht-theme-[a-zA-Z0-9_-]+/);
16
+ return classNames.pop();
17
+ }
@@ -0,0 +1,13 @@
1
+ import { findFirstParentWithClass } from "./dom/element.mjs";
2
+ /**
3
+ * Retrieves the theme class name from the closest parent element that matches the specified regex pattern.
4
+ *
5
+ * @param {HTMLElement} rootElement - The root element from which to start searching for the theme class.
6
+ * @returns {string} - The theme class name regex.
7
+ */
8
+ export function getThemeClassName(rootElement) {
9
+ const {
10
+ classNames
11
+ } = findFirstParentWithClass(rootElement, /ht-theme-[a-zA-Z0-9_-]+/);
12
+ return classNames.pop();
13
+ }
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-407bbbc-20241107",
13
+ "version": "0.0.0-next-6129043-20241108",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -50,7 +50,6 @@
50
50
  "@babel/register": "^7.8.3",
51
51
  "@babel/runtime": "^7.11.2",
52
52
  "@babel/types": "^7.12.12",
53
- "@typescript-eslint/eslint-plugin": "^4.33.0",
54
53
  "babel-jest": "^26.6.3",
55
54
  "babel-loader": "^8.0.4",
56
55
  "babel-plugin-forbidden-imports": "^0.1.2",
@@ -94,8 +93,10 @@
94
93
  "string-replace-loader": "^3.1.0",
95
94
  "stylelint": "^16.3.1",
96
95
  "typescript": "3.8.2",
96
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
97
97
  "webpack": "^5.88.1",
98
- "webpack-cli": "^5.1.4"
98
+ "webpack-cli": "^5.1.4",
99
+ "webpack-remove-empty-scripts": "^1.0.4"
99
100
  },
100
101
  "optionalDependencies": {
101
102
  "hyperformula": "^2.6.2"
@@ -772,6 +773,12 @@
772
773
  "./dist/languages/zh-CN.min.js": "./dist/languages/zh-CN.min.js",
773
774
  "./dist/languages/zh-TW.js": "./dist/languages/zh-TW.js",
774
775
  "./dist/languages/zh-TW.min.js": "./dist/languages/zh-TW.min.js",
776
+ "./styles/handsontable.css": "./styles/handsontable.css",
777
+ "./styles/handsontable.min.css": "./styles/handsontable.min.css",
778
+ "./styles/ht-theme-horizon.css": "./styles/ht-theme-horizon.css",
779
+ "./styles/ht-theme-horizon.min.css": "./styles/ht-theme-horizon.min.css",
780
+ "./styles/ht-theme-main.css": "./styles/ht-theme-main.css",
781
+ "./styles/ht-theme-main.min.css": "./styles/ht-theme-main.min.css",
775
782
  ".": {
776
783
  "types": "./index.d.ts",
777
784
  "import": "./index.mjs",
@@ -241,6 +241,15 @@ class CommentEditor {
241
241
  return _classPrivateFieldGet(_editor, this).querySelector(`.${CommentEditor.CLASS_INPUT}`);
242
242
  }
243
243
 
244
+ /**
245
+ * Get the editor element.
246
+ *
247
+ * @returns {HTMLElement} The editor element.
248
+ */
249
+ getEditorElement() {
250
+ return _classPrivateFieldGet(_editor, this);
251
+ }
252
+
244
253
  /**
245
254
  * Destroy the comments editor.
246
255
  */
@@ -237,6 +237,15 @@ class CommentEditor {
237
237
  return _classPrivateFieldGet(_editor, this).querySelector(`.${CommentEditor.CLASS_INPUT}`);
238
238
  }
239
239
 
240
+ /**
241
+ * Get the editor element.
242
+ *
243
+ * @returns {HTMLElement} The editor element.
244
+ */
245
+ getEditorElement() {
246
+ return _classPrivateFieldGet(_editor, this);
247
+ }
248
+
240
249
  /**
241
250
  * Destroy the comments editor.
242
251
  */
@@ -234,6 +234,8 @@ class Comments extends _base.BasePlugin {
234
234
  this.addHook('afterScroll', () => _assertClassBrand(_Comments_brand, this, _onAfterScroll).call(this));
235
235
  this.addHook('afterBeginEditing', () => this.hide());
236
236
  this.addHook('afterDocumentKeyDown', event => _assertClassBrand(_Comments_brand, this, _onAfterDocumentKeyDown).call(this, event));
237
+ this.addHook('afterInit', () => _assertClassBrand(_Comments_brand, this, _updateEditorThemeClassName).call(this));
238
+ this.addHook('afterUpdateSettings', () => _assertClassBrand(_Comments_brand, this, _updateEditorThemeClassName).call(this));
237
239
  _classPrivateFieldGet(_displaySwitch, this).addLocalHook('hide', () => this.hide());
238
240
  _classPrivateFieldGet(_displaySwitch, this).addLocalHook('show', (row, col) => this.showAtCell(row, col));
239
241
  this.registerShortcuts();
@@ -788,4 +790,10 @@ function _onAfterScroll() {
788
790
  if (!_classPrivateFieldGet(_preventEditorHiding, this)) {
789
791
  this.hide();
790
792
  }
793
+ }
794
+ /**
795
+ * Updates the editor theme class name.
796
+ */
797
+ function _updateEditorThemeClassName() {
798
+ (0, _element.addClass)(_classPrivateFieldGet(_editor, this).getEditorElement(), this.hot.getCurrentThemeName());
791
799
  }
@@ -230,6 +230,8 @@ export class Comments extends BasePlugin {
230
230
  this.addHook('afterScroll', () => _assertClassBrand(_Comments_brand, this, _onAfterScroll).call(this));
231
231
  this.addHook('afterBeginEditing', () => this.hide());
232
232
  this.addHook('afterDocumentKeyDown', event => _assertClassBrand(_Comments_brand, this, _onAfterDocumentKeyDown).call(this, event));
233
+ this.addHook('afterInit', () => _assertClassBrand(_Comments_brand, this, _updateEditorThemeClassName).call(this));
234
+ this.addHook('afterUpdateSettings', () => _assertClassBrand(_Comments_brand, this, _updateEditorThemeClassName).call(this));
233
235
  _classPrivateFieldGet(_displaySwitch, this).addLocalHook('hide', () => this.hide());
234
236
  _classPrivateFieldGet(_displaySwitch, this).addLocalHook('show', (row, col) => this.showAtCell(row, col));
235
237
  this.registerShortcuts();
@@ -783,4 +785,10 @@ function _onAfterScroll() {
783
785
  if (!_classPrivateFieldGet(_preventEditorHiding, this)) {
784
786
  this.hide();
785
787
  }
788
+ }
789
+ /**
790
+ * Updates the editor theme class name.
791
+ */
792
+ function _updateEditorThemeClassName() {
793
+ addClass(_classPrivateFieldGet(_editor, this).getEditorElement(), this.hot.getCurrentThemeName());
786
794
  }
@@ -286,6 +286,7 @@ class Menu {
286
286
  disableVisualSelection: 'area',
287
287
  layoutDirection: this.hot.isRtl() ? 'rtl' : 'ltr',
288
288
  ariaTags: false,
289
+ themeName: this.hot.getCurrentThemeName(),
289
290
  beforeOnCellMouseOver: (event, coords) => {
290
291
  _classPrivateFieldGet(_navigator, this).setCurrentPage(coords.row);
291
292
  },
@@ -579,10 +580,8 @@ class Menu {
579
580
  const currentRowHeight = itemCell ? (0, _element.outerHeight)(this.hotMenu.getCell(index, 0)) : 0;
580
581
  return accumulator + (value.name === _predefinedItems.SEPARATOR ? 1 : currentRowHeight);
581
582
  }, 0);
582
-
583
- // Additional 3px to menu's size because of additional border around its `table.htCore`.
584
- holderStyle.width = `${currentHiderWidth + 3}px`;
585
- holderStyle.height = `${realHeight + 3}px`;
583
+ holderStyle.width = `${currentHiderWidth}px`;
584
+ holderStyle.height = `${realHeight}px`;
586
585
  hiderStyle.height = holderStyle.height;
587
586
  }
588
587
 
@@ -282,6 +282,7 @@ export class Menu {
282
282
  disableVisualSelection: 'area',
283
283
  layoutDirection: this.hot.isRtl() ? 'rtl' : 'ltr',
284
284
  ariaTags: false,
285
+ themeName: this.hot.getCurrentThemeName(),
285
286
  beforeOnCellMouseOver: (event, coords) => {
286
287
  _classPrivateFieldGet(_navigator, this).setCurrentPage(coords.row);
287
288
  },
@@ -575,10 +576,8 @@ export class Menu {
575
576
  const currentRowHeight = itemCell ? outerHeight(this.hotMenu.getCell(index, 0)) : 0;
576
577
  return accumulator + (value.name === SEPARATOR ? 1 : currentRowHeight);
577
578
  }, 0);
578
-
579
- // Additional 3px to menu's size because of additional border around its `table.htCore`.
580
- holderStyle.width = `${currentHiderWidth + 3}px`;
581
- holderStyle.height = `${realHeight + 3}px`;
579
+ holderStyle.width = `${currentHiderWidth}px`;
580
+ holderStyle.height = `${realHeight}px`;
582
581
  hiderStyle.height = holderStyle.height;
583
582
  }
584
583
 
@@ -317,7 +317,7 @@ class ManualRowMove extends _base.BasePlugin {
317
317
  for (let visualRowIndex = fromRow; visualRowIndex <= toRow; visualRowIndex++) {
318
318
  const renderableIndex = rowMapper.getRenderableFromVisualIndex(visualRowIndex);
319
319
  if (renderableIndex !== null) {
320
- rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || 23;
320
+ rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || this.hot.view.getDefaultRowHeight();
321
321
  }
322
322
  }
323
323
  return rowsHeight;
@@ -313,7 +313,7 @@ export class ManualRowMove extends BasePlugin {
313
313
  for (let visualRowIndex = fromRow; visualRowIndex <= toRow; visualRowIndex++) {
314
314
  const renderableIndex = rowMapper.getRenderableFromVisualIndex(visualRowIndex);
315
315
  if (renderableIndex !== null) {
316
- rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || 23;
316
+ rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || this.hot.view.getDefaultRowHeight();
317
317
  }
318
318
  }
319
319
  return rowsHeight;
@@ -8,7 +8,6 @@ var _element = require("../../helpers/dom/element");
8
8
  var _array = require("../../helpers/array");
9
9
  var _number = require("../../helpers/number");
10
10
  var _translations = require("../../translations");
11
- var _src = require("../../3rdparty/walkontable/src");
12
11
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
13
12
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
14
13
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -227,7 +226,7 @@ class ManualRowResize extends _base.BasePlugin {
227
226
  */
228
227
  setManualSize(row, height) {
229
228
  const physicalRow = this.hot.toPhysicalRow(row);
230
- const newHeight = Math.max(height, _src.DEFAULT_ROW_HEIGHT);
229
+ const newHeight = Math.max(height, this.hot.view.getDefaultRowHeight());
231
230
  _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
232
231
  return newHeight;
233
232
  }