handsontable 0.0.0-next-b0eaa90-20241016 → 0.0.0-next-662a118-20241017

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 (80) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -5
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +2 -5
  3. package/3rdparty/walkontable/src/core/clone.js +0 -1
  4. package/3rdparty/walkontable/src/core/clone.mjs +0 -1
  5. package/3rdparty/walkontable/src/core/core.js +0 -2
  6. package/3rdparty/walkontable/src/core/core.mjs +0 -2
  7. package/3rdparty/walkontable/src/overlay/_base.js +1 -3
  8. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
  9. package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
  10. package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
  11. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  12. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  13. package/3rdparty/walkontable/src/settings.js +2 -0
  14. package/3rdparty/walkontable/src/settings.mjs +2 -0
  15. package/3rdparty/walkontable/src/table.js +5 -6
  16. package/3rdparty/walkontable/src/table.mjs +5 -6
  17. package/3rdparty/walkontable/src/utils/column.js +1 -1
  18. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  19. package/3rdparty/walkontable/src/viewport.js +0 -1
  20. package/3rdparty/walkontable/src/viewport.mjs +0 -1
  21. package/CHANGELOG.md +5 -0
  22. package/base.js +2 -2
  23. package/base.mjs +2 -2
  24. package/core.js +0 -11
  25. package/core.mjs +0 -11
  26. package/dataMap/metaManager/metaSchema.js +0 -17
  27. package/dataMap/metaManager/metaSchema.mjs +0 -17
  28. package/dist/handsontable.css +5 -236
  29. package/dist/handsontable.full.css +3 -3
  30. package/dist/handsontable.full.js +3816 -3902
  31. package/dist/handsontable.full.min.css +3 -4
  32. package/dist/handsontable.full.min.js +26 -26
  33. package/dist/handsontable.js +3508 -3600
  34. package/dist/handsontable.min.css +4 -9
  35. package/dist/handsontable.min.js +24 -24
  36. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  37. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  38. package/editors/baseEditor/baseEditor.js +1 -1
  39. package/editors/baseEditor/baseEditor.mjs +1 -1
  40. package/editors/dateEditor/dateEditor.js +0 -2
  41. package/editors/dateEditor/dateEditor.mjs +0 -2
  42. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  43. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  44. package/editors/passwordEditor/passwordEditor.js +0 -4
  45. package/editors/passwordEditor/passwordEditor.mjs +1 -5
  46. package/editors/selectEditor/selectEditor.js +9 -20
  47. package/editors/selectEditor/selectEditor.mjs +9 -20
  48. package/editors/textEditor/textEditor.js +11 -7
  49. package/editors/textEditor/textEditor.mjs +12 -8
  50. package/helpers/mixed.js +3 -3
  51. package/helpers/mixed.mjs +3 -3
  52. package/package.json +3 -10
  53. package/plugins/comments/commentEditor.js +1 -8
  54. package/plugins/comments/commentEditor.mjs +1 -8
  55. package/plugins/comments/comments.js +1 -1
  56. package/plugins/comments/comments.mjs +1 -1
  57. package/plugins/contextMenu/menu/menu.js +4 -4
  58. package/plugins/contextMenu/menu/menu.mjs +4 -4
  59. package/plugins/manualRowMove/manualRowMove.js +1 -1
  60. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  61. package/plugins/mergeCells/mergeCells.js +1 -1
  62. package/plugins/mergeCells/mergeCells.mjs +1 -1
  63. package/plugins/nestedRows/ui/headers.js +1 -3
  64. package/plugins/nestedRows/ui/headers.mjs +1 -3
  65. package/tableView.js +0 -33
  66. package/tableView.mjs +0 -33
  67. package/utils/autoResize.js +1 -4
  68. package/utils/autoResize.mjs +1 -4
  69. package/utils/ghostTable.js +1 -1
  70. package/utils/ghostTable.mjs +1 -1
  71. package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -185
  72. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -181
  73. package/helpers/themes.js +0 -17
  74. package/helpers/themes.mjs +0 -13
  75. package/styles/handsontable.css +0 -1920
  76. package/styles/handsontable.min.css +0 -30
  77. package/styles/ht-theme-gemini.css +0 -690
  78. package/styles/ht-theme-gemini.min.css +0 -30
  79. package/styles/ht-theme-main.css +0 -712
  80. package/styles/ht-theme-main.min.css +0 -30
@@ -121,9 +121,7 @@ class HeadersUI extends BaseUI {
121
121
  if (!deepestLevelIndex) {
122
122
  deepestLevelIndex = this.dataManager.cache.levelCount;
123
123
  }
124
- const verticalPadding = this.hot.view.getCSSVariableValue('cell-horizontal-padding');
125
- const completeVerticalPadding = this.hot.view.isUsingClassicTheme() ? 11 : verticalPadding * 2;
126
- this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 10 * deepestLevelIndex + 25);
124
+ this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
127
125
  this.hot.render();
128
126
  }
129
127
  }
package/tableView.js CHANGED
@@ -587,39 +587,6 @@ class TableView {
587
587
  return count;
588
588
  }
589
589
 
590
- /**
591
- * Returns the default row height.
592
- *
593
- * This method retrieves the default row height from the Walkontable styles handler.
594
- *
595
- * @returns {number} The default row height.
596
- */
597
- getDefaultRowHeight() {
598
- return this._wt._wot.stylesHandler.getDefaultRowHeight();
599
- }
600
-
601
- /**
602
- * Retrieves the value of a specified CSS variable for the instance's container.
603
- *
604
- * @param {string} variableName - The name of the CSS variable to retrieve.
605
- * @returns {string} The value of the specified CSS variable.
606
- */
607
- getCSSVariableValue(variableName) {
608
- return this._wt._wot.stylesHandler.getCSSVariableValue(variableName);
609
- }
610
-
611
- /**
612
- * Checks if the classic theme is being used.
613
- *
614
- * This method verifies if the current theme applied to the Handsontable instance
615
- * is the classic theme.
616
- *
617
- * @returns {boolean} `true` if the classic theme is being used, `false` otherwise.
618
- */
619
- isUsingClassicTheme() {
620
- return this._wt._wot.stylesHandler.isClassicTheme();
621
- }
622
-
623
590
  /**
624
591
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
625
592
  * bottom overlay.
package/tableView.mjs CHANGED
@@ -583,39 +583,6 @@ class TableView {
583
583
  return count;
584
584
  }
585
585
 
586
- /**
587
- * Returns the default row height.
588
- *
589
- * This method retrieves the default row height from the Walkontable styles handler.
590
- *
591
- * @returns {number} The default row height.
592
- */
593
- getDefaultRowHeight() {
594
- return this._wt._wot.stylesHandler.getDefaultRowHeight();
595
- }
596
-
597
- /**
598
- * Retrieves the value of a specified CSS variable for the instance's container.
599
- *
600
- * @param {string} variableName - The name of the CSS variable to retrieve.
601
- * @returns {string} The value of the specified CSS variable.
602
- */
603
- getCSSVariableValue(variableName) {
604
- return this._wt._wot.stylesHandler.getCSSVariableValue(variableName);
605
- }
606
-
607
- /**
608
- * Checks if the classic theme is being used.
609
- *
610
- * This method verifies if the current theme applied to the Handsontable instance
611
- * is the classic theme.
612
- *
613
- * @returns {boolean} `true` if the classic theme is being used, `false` otherwise.
614
- */
615
- isUsingClassicTheme() {
616
- return this._wt._wot.stylesHandler.isClassicTheme();
617
- }
618
-
619
586
  /**
620
587
  * Checks if at least one cell than belongs to the main table is not covered by the top, left or
621
588
  * bottom overlay.
@@ -77,7 +77,6 @@ function createInputElementResizer(ownerDocument) {
77
77
  * Resizes the element.
78
78
  */
79
79
  function resize() {
80
- var _getComputedStyle, _getComputedStyle2;
81
80
  textHolder.textContent = observedElement.value;
82
81
  // Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
83
82
  // `flex-direction` set as `column`.
@@ -86,9 +85,7 @@ function createInputElementResizer(ownerDocument) {
86
85
  textContainer.style.fontFamily = getComputedStyle(observedElement).fontFamily;
87
86
  textContainer.style.whiteSpace = 'pre';
88
87
  body.appendChild(textContainer);
89
- const paddingStart = parseInt(((_getComputedStyle = getComputedStyle(observedElement)) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.paddingInlineStart) || 0, 10);
90
- const paddingEnd = parseInt(((_getComputedStyle2 = getComputedStyle(observedElement)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.paddingInlineEnd) || 0, 10);
91
- const width = textContainer.clientWidth + 2 + paddingStart + paddingEnd;
88
+ const width = textContainer.clientWidth + 2;
92
89
  body.removeChild(textContainer);
93
90
  const elementStyle = observedElement.style;
94
91
  elementStyle.height = `${defaults.minHeight}px`;
@@ -73,7 +73,6 @@ export function createInputElementResizer(ownerDocument) {
73
73
  * Resizes the element.
74
74
  */
75
75
  function resize() {
76
- var _getComputedStyle, _getComputedStyle2;
77
76
  textHolder.textContent = observedElement.value;
78
77
  // Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
79
78
  // `flex-direction` set as `column`.
@@ -82,9 +81,7 @@ export function createInputElementResizer(ownerDocument) {
82
81
  textContainer.style.fontFamily = getComputedStyle(observedElement).fontFamily;
83
82
  textContainer.style.whiteSpace = 'pre';
84
83
  body.appendChild(textContainer);
85
- const paddingStart = parseInt(((_getComputedStyle = getComputedStyle(observedElement)) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.paddingInlineStart) || 0, 10);
86
- const paddingEnd = parseInt(((_getComputedStyle2 = getComputedStyle(observedElement)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.paddingInlineEnd) || 0, 10);
87
- const width = textContainer.clientWidth + 2 + paddingStart + paddingEnd;
84
+ const width = textContainer.clientWidth + 2;
88
85
  body.removeChild(textContainer);
89
86
  const elementStyle = observedElement.style;
90
87
  elementStyle.height = `${defaults.minHeight}px`;
@@ -131,7 +131,7 @@ class GhostTable {
131
131
  if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) {
132
132
  // Please keep in mind that the renderable column index equal to the visual columns index for the GhostTable.
133
133
  // We render all columns.
134
- this.hot.view.appendColHeader(column, this.table.th, undefined, -1);
134
+ this.hot.view.appendColHeader(column, this.table.th);
135
135
  }
136
136
  this.table.tBody.appendChild(this.createCol(column));
137
137
  this.container.container.appendChild(this.table.fragment);
@@ -128,7 +128,7 @@ class GhostTable {
128
128
  if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) {
129
129
  // Please keep in mind that the renderable column index equal to the visual columns index for the GhostTable.
130
130
  // We render all columns.
131
- this.hot.view.appendColHeader(column, this.table.th, undefined, -1);
131
+ this.hot.view.appendColHeader(column, this.table.th);
132
132
  }
133
133
  this.table.tBody.appendChild(this.createCol(column));
134
134
  this.container.container.appendChild(this.table.fragment);
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- require("core-js/modules/es.error.cause.js");
5
- function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
6
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
7
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
8
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
9
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
10
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
11
- var _rootElement = /*#__PURE__*/new WeakMap();
12
- var _rootComputedStyle = /*#__PURE__*/new WeakMap();
13
- var _rootDocument = /*#__PURE__*/new WeakMap();
14
- var _isClassicTheme = /*#__PURE__*/new WeakMap();
15
- var _cssVars = /*#__PURE__*/new WeakMap();
16
- var _computedStyles = /*#__PURE__*/new WeakMap();
17
- var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
18
- /**
19
- * Handles the theme-related style operations.
20
- */
21
- class StylesHandler {
22
- /**
23
- * Initializes a new instance of the `StylesHandler` class.
24
- *
25
- * @param {object} domBindings - The DOM bindings for the instance.
26
- */
27
- constructor(domBindings) {
28
- var _classPrivateFieldGet2;
29
- /**
30
- * Retrieves and processes the computed styles for a `td` element.
31
- *
32
- * This method creates a temporary table structure, appends it to the root element,
33
- * retrieves the computed styles for the `td` element, and then removes the table
34
- * from the DOM. The computed styles are passed to the provided callback function.
35
- *
36
- * @param {Function} getterCallback - A callback function that processes the computed styles.
37
- * It receives a `CSSStyleDeclaration` object as its argument.
38
- * @private
39
- */
40
- _classPrivateMethodInitSpec(this, _StylesHandler_brand);
41
- /**
42
- * The instance's root element.
43
- *
44
- * @type {HTMLElement}
45
- */
46
- _classPrivateFieldInitSpec(this, _rootElement, void 0);
47
- /**
48
- * The computed style of the root element.
49
- *
50
- * @type {CSSStyleDeclaration}
51
- * @private
52
- */
53
- _classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
54
- /**
55
- * The root document of the instance.
56
- *
57
- * @type {Document}
58
- * @private
59
- */
60
- _classPrivateFieldInitSpec(this, _rootDocument, void 0);
61
- /**
62
- * `true` if the classic theme is enabled, `false` otherwise.
63
- *
64
- * @type {boolean}
65
- */
66
- _classPrivateFieldInitSpec(this, _isClassicTheme, false);
67
- /**
68
- * An object to store CSS variable values.
69
- *
70
- * @type {object}
71
- * @private
72
- */
73
- _classPrivateFieldInitSpec(this, _cssVars, {});
74
- /**
75
- * Stores the computed styles for various elements.
76
- *
77
- * @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
78
- * @private
79
- */
80
- _classPrivateFieldInitSpec(this, _computedStyles, {});
81
- _classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement);
82
- _classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
83
- _classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
84
- if (((_classPrivateFieldGet2 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.getPropertyValue('--ht-line-height')) === '') {
85
- _classPrivateFieldSet(_isClassicTheme, this, true);
86
- }
87
-
88
- // Some of the properties are not stored in the CSS variables, so we need to get them from the computed style.
89
- _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, computedStyle => {
90
- _classPrivateFieldSet(_computedStyles, this, {
91
- ..._classPrivateFieldGet(_computedStyles, this),
92
- ...{
93
- td: {
94
- 'box-sizing': computedStyle['box-sizing'],
95
- 'border-top-width': parseInt(computedStyle['border-top-width'], 10),
96
- 'border-bottom-width': parseInt(computedStyle['border-bottom-width'], 10)
97
- }
98
- }
99
- });
100
- });
101
- }
102
-
103
- /**
104
- * Gets the value indicating whether the classic theme is enabled.
105
- *
106
- * @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
107
- */
108
- isClassicTheme() {
109
- return _classPrivateFieldGet(_isClassicTheme, this);
110
- }
111
-
112
- /**
113
- * Retrieves the value of a specified CSS variable.
114
- *
115
- * @param {string} variableName - The name of the CSS variable to retrieve.
116
- * @returns {number|string|undefined} The value of the specified CSS variable, or `undefined` if not found.
117
- */
118
- getCSSVariableValue(variableName) {
119
- if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
120
- return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
121
- }
122
- const acquiredValue = _assertClassBrand(_StylesHandler_brand, this, _getParsedCSSValue).call(this, `--ht-${variableName}`);
123
- if (acquiredValue && acquiredValue !== '') {
124
- _classPrivateFieldSet(_cssVars, this, {
125
- ..._classPrivateFieldGet(_cssVars, this),
126
- ...{
127
- [variableName]: acquiredValue
128
- }
129
- });
130
- return acquiredValue;
131
- }
132
- }
133
-
134
- /**
135
- * Retrieves the computed style value for a specified CSS property of a `td` element.
136
- *
137
- * @param {string} cssProperty - The CSS property to retrieve the value for.
138
- * @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
139
- */
140
- getStyleForTD(cssProperty) {
141
- var _classPrivateFieldGet3;
142
- const value = (_classPrivateFieldGet3 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.td[cssProperty];
143
- if (value !== undefined && value !== '') {
144
- return value;
145
- }
146
- }
147
-
148
- /**
149
- * Calculates the row height based on the current theme and CSS variables.
150
- *
151
- * @returns {number} The calculated row height.
152
- */
153
- getDefaultRowHeight() {
154
- if (_classPrivateFieldGet(_isClassicTheme, this)) {
155
- return 23;
156
- }
157
- return this.getStyleForTD('border-top-width') + this.getCSSVariableValue('cell-vertical-padding') * 2 + this.getCSSVariableValue('line-height') + this.getStyleForTD('border-bottom-width');
158
- }
159
- }
160
- exports.StylesHandler = StylesHandler;
161
- function _getStylesForTD(getterCallback) {
162
- const table = _classPrivateFieldGet(_rootDocument, this).createElement('table');
163
- const tbody = _classPrivateFieldGet(_rootDocument, this).createElement('tbody');
164
- const tr = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
165
- // This needs not to be the first row in order to get "regular" vaules.
166
- const tr2 = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
167
- const td = _classPrivateFieldGet(_rootDocument, this).createElement('td');
168
- tr2.appendChild(td);
169
- tbody.appendChild(tr);
170
- tbody.appendChild(tr2);
171
- table.appendChild(tbody);
172
- _classPrivateFieldGet(_rootElement, this).appendChild(table);
173
- getterCallback(getComputedStyle(td));
174
- _classPrivateFieldGet(_rootElement, this).removeChild(table);
175
- }
176
- /**
177
- * Parses the value of a specified CSS property from the root element's computed style.
178
- *
179
- * @param {string} property - The CSS property to retrieve and parse.
180
- * @returns {number|string} The parsed value of the CSS property.
181
- */
182
- function _getParsedCSSValue(property) {
183
- var _classPrivateFieldGet4;
184
- return parseInt((_classPrivateFieldGet4 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.getPropertyValue(property), 10);
185
- }
@@ -1,181 +0,0 @@
1
- import "core-js/modules/es.error.cause.js";
2
- function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
3
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
4
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
5
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
6
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
7
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
8
- var _rootElement = /*#__PURE__*/new WeakMap();
9
- var _rootComputedStyle = /*#__PURE__*/new WeakMap();
10
- var _rootDocument = /*#__PURE__*/new WeakMap();
11
- var _isClassicTheme = /*#__PURE__*/new WeakMap();
12
- var _cssVars = /*#__PURE__*/new WeakMap();
13
- var _computedStyles = /*#__PURE__*/new WeakMap();
14
- var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
15
- /**
16
- * Handles the theme-related style operations.
17
- */
18
- export class StylesHandler {
19
- /**
20
- * Initializes a new instance of the `StylesHandler` class.
21
- *
22
- * @param {object} domBindings - The DOM bindings for the instance.
23
- */
24
- constructor(domBindings) {
25
- var _classPrivateFieldGet2;
26
- /**
27
- * Retrieves and processes the computed styles for a `td` element.
28
- *
29
- * This method creates a temporary table structure, appends it to the root element,
30
- * retrieves the computed styles for the `td` element, and then removes the table
31
- * from the DOM. The computed styles are passed to the provided callback function.
32
- *
33
- * @param {Function} getterCallback - A callback function that processes the computed styles.
34
- * It receives a `CSSStyleDeclaration` object as its argument.
35
- * @private
36
- */
37
- _classPrivateMethodInitSpec(this, _StylesHandler_brand);
38
- /**
39
- * The instance's root element.
40
- *
41
- * @type {HTMLElement}
42
- */
43
- _classPrivateFieldInitSpec(this, _rootElement, void 0);
44
- /**
45
- * The computed style of the root element.
46
- *
47
- * @type {CSSStyleDeclaration}
48
- * @private
49
- */
50
- _classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
51
- /**
52
- * The root document of the instance.
53
- *
54
- * @type {Document}
55
- * @private
56
- */
57
- _classPrivateFieldInitSpec(this, _rootDocument, void 0);
58
- /**
59
- * `true` if the classic theme is enabled, `false` otherwise.
60
- *
61
- * @type {boolean}
62
- */
63
- _classPrivateFieldInitSpec(this, _isClassicTheme, false);
64
- /**
65
- * An object to store CSS variable values.
66
- *
67
- * @type {object}
68
- * @private
69
- */
70
- _classPrivateFieldInitSpec(this, _cssVars, {});
71
- /**
72
- * Stores the computed styles for various elements.
73
- *
74
- * @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
75
- * @private
76
- */
77
- _classPrivateFieldInitSpec(this, _computedStyles, {});
78
- _classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement);
79
- _classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
80
- _classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
81
- if (((_classPrivateFieldGet2 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.getPropertyValue('--ht-line-height')) === '') {
82
- _classPrivateFieldSet(_isClassicTheme, this, true);
83
- }
84
-
85
- // Some of the properties are not stored in the CSS variables, so we need to get them from the computed style.
86
- _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, computedStyle => {
87
- _classPrivateFieldSet(_computedStyles, this, {
88
- ..._classPrivateFieldGet(_computedStyles, this),
89
- ...{
90
- td: {
91
- 'box-sizing': computedStyle['box-sizing'],
92
- 'border-top-width': parseInt(computedStyle['border-top-width'], 10),
93
- 'border-bottom-width': parseInt(computedStyle['border-bottom-width'], 10)
94
- }
95
- }
96
- });
97
- });
98
- }
99
-
100
- /**
101
- * Gets the value indicating whether the classic theme is enabled.
102
- *
103
- * @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
104
- */
105
- isClassicTheme() {
106
- return _classPrivateFieldGet(_isClassicTheme, this);
107
- }
108
-
109
- /**
110
- * Retrieves the value of a specified CSS variable.
111
- *
112
- * @param {string} variableName - The name of the CSS variable to retrieve.
113
- * @returns {number|string|undefined} The value of the specified CSS variable, or `undefined` if not found.
114
- */
115
- getCSSVariableValue(variableName) {
116
- if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
117
- return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
118
- }
119
- const acquiredValue = _assertClassBrand(_StylesHandler_brand, this, _getParsedCSSValue).call(this, `--ht-${variableName}`);
120
- if (acquiredValue && acquiredValue !== '') {
121
- _classPrivateFieldSet(_cssVars, this, {
122
- ..._classPrivateFieldGet(_cssVars, this),
123
- ...{
124
- [variableName]: acquiredValue
125
- }
126
- });
127
- return acquiredValue;
128
- }
129
- }
130
-
131
- /**
132
- * Retrieves the computed style value for a specified CSS property of a `td` element.
133
- *
134
- * @param {string} cssProperty - The CSS property to retrieve the value for.
135
- * @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
136
- */
137
- getStyleForTD(cssProperty) {
138
- var _classPrivateFieldGet3;
139
- const value = (_classPrivateFieldGet3 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.td[cssProperty];
140
- if (value !== undefined && value !== '') {
141
- return value;
142
- }
143
- }
144
-
145
- /**
146
- * Calculates the row height based on the current theme and CSS variables.
147
- *
148
- * @returns {number} The calculated row height.
149
- */
150
- getDefaultRowHeight() {
151
- if (_classPrivateFieldGet(_isClassicTheme, this)) {
152
- return 23;
153
- }
154
- return this.getStyleForTD('border-top-width') + this.getCSSVariableValue('cell-vertical-padding') * 2 + this.getCSSVariableValue('line-height') + this.getStyleForTD('border-bottom-width');
155
- }
156
- }
157
- function _getStylesForTD(getterCallback) {
158
- const table = _classPrivateFieldGet(_rootDocument, this).createElement('table');
159
- const tbody = _classPrivateFieldGet(_rootDocument, this).createElement('tbody');
160
- const tr = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
161
- // This needs not to be the first row in order to get "regular" vaules.
162
- const tr2 = _classPrivateFieldGet(_rootDocument, this).createElement('tr');
163
- const td = _classPrivateFieldGet(_rootDocument, this).createElement('td');
164
- tr2.appendChild(td);
165
- tbody.appendChild(tr);
166
- tbody.appendChild(tr2);
167
- table.appendChild(tbody);
168
- _classPrivateFieldGet(_rootElement, this).appendChild(table);
169
- getterCallback(getComputedStyle(td));
170
- _classPrivateFieldGet(_rootElement, this).removeChild(table);
171
- }
172
- /**
173
- * Parses the value of a specified CSS property from the root element's computed style.
174
- *
175
- * @param {string} property - The CSS property to retrieve and parse.
176
- * @returns {number|string} The parsed value of the CSS property.
177
- */
178
- function _getParsedCSSValue(property) {
179
- var _classPrivateFieldGet4;
180
- return parseInt((_classPrivateFieldGet4 = _classPrivateFieldGet(_rootComputedStyle, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.getPropertyValue(property), 10);
181
- }
package/helpers/themes.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.getThemeClassName = getThemeClassName;
5
- /**
6
- * Get theme class name from rootElement class.
7
- *
8
- * @param {string} className Class names.
9
- * @returns {string}
10
- */
11
- function getThemeClassName(className) {
12
- if (!className || typeof className !== 'string') {
13
- return false;
14
- }
15
- const [match] = className.match(/ht-theme-[a-zA-Z0-9_-]+/) || [];
16
- return match;
17
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Get theme class name from rootElement class.
3
- *
4
- * @param {string} className Class names.
5
- * @returns {string}
6
- */
7
- export function getThemeClassName(className) {
8
- if (!className || typeof className !== 'string') {
9
- return false;
10
- }
11
- const [match] = className.match(/ht-theme-[a-zA-Z0-9_-]+/) || [];
12
- return match;
13
- }