handsontable 0.0.0-next-627918e-20241025 → 0.0.0-next-7cc7ef7-20241028

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 (93) hide show
  1. package/3rdparty/walkontable/src/calculator/index.js +2 -1
  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 +0 -3
  6. package/3rdparty/walkontable/src/core/_base.mjs +0 -3
  7. package/3rdparty/walkontable/src/core/clone.js +0 -1
  8. package/3rdparty/walkontable/src/core/clone.mjs +0 -1
  9. package/3rdparty/walkontable/src/core/core.js +0 -2
  10. package/3rdparty/walkontable/src/core/core.mjs +0 -2
  11. package/3rdparty/walkontable/src/facade/core.js +0 -3
  12. package/3rdparty/walkontable/src/facade/core.mjs +0 -3
  13. package/3rdparty/walkontable/src/index.js +1 -0
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/overlay/_base.js +1 -3
  16. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
  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/settings.js +2 -1
  22. package/3rdparty/walkontable/src/settings.mjs +2 -1
  23. package/3rdparty/walkontable/src/table.js +8 -11
  24. package/3rdparty/walkontable/src/table.mjs +8 -11
  25. package/3rdparty/walkontable/src/types.js +0 -1
  26. package/3rdparty/walkontable/src/types.mjs +0 -1
  27. package/3rdparty/walkontable/src/utils/column.js +1 -1
  28. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  29. package/3rdparty/walkontable/src/viewport.js +0 -1
  30. package/3rdparty/walkontable/src/viewport.mjs +0 -1
  31. package/README.md +1 -1
  32. package/base.js +2 -2
  33. package/base.mjs +2 -2
  34. package/core.js +0 -14
  35. package/core.mjs +0 -14
  36. package/dataMap/metaManager/metaSchema.js +0 -17
  37. package/dataMap/metaManager/metaSchema.mjs +0 -17
  38. package/dist/handsontable.css +9 -17
  39. package/dist/handsontable.full.css +7 -17
  40. package/dist/handsontable.full.js +3814 -3893
  41. package/dist/handsontable.full.min.css +4 -5
  42. package/dist/handsontable.full.min.js +26 -26
  43. package/dist/handsontable.js +3515 -3600
  44. package/dist/handsontable.min.css +4 -5
  45. package/dist/handsontable.min.js +24 -24
  46. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  47. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  48. package/editors/baseEditor/baseEditor.js +1 -1
  49. package/editors/baseEditor/baseEditor.mjs +1 -1
  50. package/editors/dateEditor/dateEditor.js +0 -2
  51. package/editors/dateEditor/dateEditor.mjs +0 -2
  52. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  53. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  54. package/editors/selectEditor/selectEditor.js +9 -20
  55. package/editors/selectEditor/selectEditor.mjs +9 -20
  56. package/editors/textEditor/textEditor.js +11 -4
  57. package/editors/textEditor/textEditor.mjs +11 -4
  58. package/helpers/mixed.js +2 -2
  59. package/helpers/mixed.mjs +2 -2
  60. package/package.json +3 -10
  61. package/plugins/comments/commentEditor.js +1 -8
  62. package/plugins/comments/commentEditor.mjs +1 -8
  63. package/plugins/comments/comments.js +1 -1
  64. package/plugins/comments/comments.mjs +1 -1
  65. package/plugins/contextMenu/menu/menu.js +4 -4
  66. package/plugins/contextMenu/menu/menu.mjs +4 -4
  67. package/plugins/manualRowMove/manualRowMove.js +1 -1
  68. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  69. package/plugins/manualRowResize/manualRowResize.js +2 -1
  70. package/plugins/manualRowResize/manualRowResize.mjs +3 -2
  71. package/plugins/mergeCells/mergeCells.js +1 -1
  72. package/plugins/mergeCells/mergeCells.mjs +1 -1
  73. package/plugins/nestedRows/ui/headers.js +1 -3
  74. package/plugins/nestedRows/ui/headers.mjs +1 -3
  75. package/settings.d.ts +0 -1
  76. package/tableView.js +0 -34
  77. package/tableView.mjs +0 -34
  78. package/utils/autoResize.js +1 -4
  79. package/utils/autoResize.mjs +1 -4
  80. package/utils/ghostTable.js +1 -1
  81. package/utils/ghostTable.mjs +1 -1
  82. package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -179
  83. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -175
  84. package/helpers/themes.js +0 -17
  85. package/helpers/themes.mjs +0 -13
  86. package/styles/handsontable.css +0 -1983
  87. package/styles/handsontable.min.css +0 -30
  88. package/styles/ht-theme-gemini.css +0 -706
  89. package/styles/ht-theme-gemini.min.css +0 -30
  90. package/styles/ht-theme-main.css +0 -714
  91. package/styles/ht-theme-main.min.css +0 -30
  92. package/stylesManager.js +0 -1
  93. package/stylesManager.mjs +0 -0
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.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.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.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.
@@ -639,7 +606,6 @@ class TableView {
639
606
  */
640
607
  initializeWalkontable() {
641
608
  const walkontableConfig = {
642
- themeName: this.settings.themeName,
643
609
  ariaTags: this.settings.ariaTags,
644
610
  rtlMode: this.hot.isRtl(),
645
611
  externalRowCalculator: this.hot.getPlugin('autoRowSize') && this.hot.getPlugin('autoRowSize').isEnabled(),
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.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.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.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.
@@ -635,7 +602,6 @@ class TableView {
635
602
  */
636
603
  initializeWalkontable() {
637
604
  const walkontableConfig = {
638
- themeName: this.settings.themeName,
639
605
  ariaTags: this.settings.ariaTags,
640
606
  rtlMode: this.hot.isRtl(),
641
607
  externalRowCalculator: this.hot.getPlugin('autoRowSize') && this.hot.getPlugin('autoRowSize').isEnabled(),
@@ -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,179 +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
- const CLASSIC_THEME_DEFAULT_HEIGHT = 23;
12
-
13
- /**
14
- * Handles the theme-related style operations.
15
- */
16
- var _rootElement = /*#__PURE__*/new WeakMap();
17
- var _rootComputedStyle = /*#__PURE__*/new WeakMap();
18
- var _rootDocument = /*#__PURE__*/new WeakMap();
19
- var _isClassicTheme = /*#__PURE__*/new WeakMap();
20
- var _cssVars = /*#__PURE__*/new WeakMap();
21
- var _computedStyles = /*#__PURE__*/new WeakMap();
22
- var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
23
- class StylesHandler {
24
- /**
25
- * Initializes a new instance of the `StylesHandler` class.
26
- *
27
- * @param {string} themeName - The name of the theme.
28
- * @param {object} domBindings - The DOM bindings for the instance.
29
- */
30
- constructor(themeName, domBindings) {
31
- /**
32
- * Retrieves and processes the computed styles for a `td` element.
33
- *
34
- * This method creates a temporary table structure, appends it to the root element,
35
- * retrieves the computed styles for the `td` element, and then removes the table
36
- * from the DOM. The computed styles are passed to the provided callback function.
37
- *
38
- * @param {Array} cssProps - An array of CSS properties to retrieve.
39
- * @returns {object} An object containing the requested computed styles for the `td` element.
40
- * @private
41
- */
42
- _classPrivateMethodInitSpec(this, _StylesHandler_brand);
43
- /**
44
- * The instance's root element.
45
- *
46
- * @type {HTMLElement}
47
- */
48
- _classPrivateFieldInitSpec(this, _rootElement, void 0);
49
- /**
50
- * The computed style of the root element.
51
- *
52
- * @type {CSSStyleDeclaration}
53
- * @private
54
- */
55
- _classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
56
- /**
57
- * The root document of the instance.
58
- *
59
- * @type {Document}
60
- * @private
61
- */
62
- _classPrivateFieldInitSpec(this, _rootDocument, void 0);
63
- /**
64
- * `true` if the classic theme is enabled, `false` otherwise.
65
- *
66
- * @type {boolean}
67
- */
68
- _classPrivateFieldInitSpec(this, _isClassicTheme, false);
69
- /**
70
- * An object to store CSS variable values.
71
- *
72
- * @type {object}
73
- * @private
74
- */
75
- _classPrivateFieldInitSpec(this, _cssVars, {});
76
- /**
77
- * Stores the computed styles for various elements.
78
- *
79
- * @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
80
- * @private
81
- */
82
- _classPrivateFieldInitSpec(this, _computedStyles, {});
83
- _classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement);
84
- _classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
85
- _classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
86
- if (!themeName) {
87
- _classPrivateFieldSet(_isClassicTheme, this, true);
88
- }
89
- const stylesForTD = _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, ['box-sizing']);
90
- _classPrivateFieldGet(_computedStyles, this).td = {
91
- ..._classPrivateFieldGet(_computedStyles, this).td,
92
- ...{
93
- 'box-sizing': stylesForTD['box-sizing']
94
- }
95
- };
96
- }
97
-
98
- /**
99
- * Gets the value indicating whether the classic theme is enabled.
100
- *
101
- * @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
102
- */
103
- isClassicTheme() {
104
- return _classPrivateFieldGet(_isClassicTheme, this);
105
- }
106
-
107
- /**
108
- * Retrieves the value of a specified CSS variable.
109
- *
110
- * @param {string} variableName - The name of the CSS variable to retrieve.
111
- * @returns {number|undefined} The value of the specified CSS variable, or `undefined` if not found.
112
- */
113
- getCSSVariableValue(variableName) {
114
- if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
115
- return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
116
- }
117
- const acquiredValue = _assertClassBrand(_StylesHandler_brand, this, _getParsedCSSValue).call(this, `--ht-${variableName}`);
118
- if (acquiredValue !== null) {
119
- _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`] = acquiredValue;
120
- return acquiredValue;
121
- }
122
- }
123
-
124
- /**
125
- * Retrieves the computed style value for a specified CSS property of a `td` element.
126
- *
127
- * @param {string} cssProperty - The CSS property to retrieve the value for.
128
- * @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
129
- */
130
- getStyleForTD(cssProperty) {
131
- var _classPrivateFieldGet2;
132
- return (_classPrivateFieldGet2 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.td[cssProperty];
133
- }
134
-
135
- /**
136
- * Calculates the row height based on the current theme and CSS variables.
137
- *
138
- * @returns {number} The calculated row height.
139
- */
140
- getDefaultRowHeight() {
141
- if (_classPrivateFieldGet(_isClassicTheme, this)) {
142
- return CLASSIC_THEME_DEFAULT_HEIGHT;
143
- }
144
- return this.getCSSVariableValue('row-height');
145
- }
146
- }
147
- exports.StylesHandler = StylesHandler;
148
- function _getStylesForTD(cssProps) {
149
- const rootDocument = _classPrivateFieldGet(_rootDocument, this);
150
- const rootElement = _classPrivateFieldGet(_rootElement, this);
151
- const table = rootDocument.createElement('table');
152
- const tbody = rootDocument.createElement('tbody');
153
- const tr = rootDocument.createElement('tr');
154
- // This needs not to be the first row in order to get "regular" vaules.
155
- const tr2 = rootDocument.createElement('tr');
156
- const td = rootDocument.createElement('td');
157
- tr2.appendChild(td);
158
- tbody.appendChild(tr);
159
- tbody.appendChild(tr2);
160
- table.appendChild(tbody);
161
- rootElement.appendChild(table);
162
- const computedStyle = getComputedStyle(td);
163
- const returnObject = {};
164
- cssProps.forEach(prop => {
165
- returnObject[prop] = computedStyle.getPropertyValue(prop);
166
- });
167
- rootElement.removeChild(table);
168
- return returnObject;
169
- }
170
- /**
171
- * Parses the value of a specified CSS property from the root element's computed style.
172
- *
173
- * @param {string} property - The CSS property to retrieve and parse.
174
- * @returns {number|null} The parsed value of the CSS property.
175
- */
176
- function _getParsedCSSValue(property) {
177
- const parsedValue = parseInt(_classPrivateFieldGet(_rootComputedStyle, this).getPropertyValue(property), 10);
178
- return Number.isNaN(parsedValue) ? null : parsedValue;
179
- }
@@ -1,175 +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
- const CLASSIC_THEME_DEFAULT_HEIGHT = 23;
9
-
10
- /**
11
- * Handles the theme-related style operations.
12
- */
13
- var _rootElement = /*#__PURE__*/new WeakMap();
14
- var _rootComputedStyle = /*#__PURE__*/new WeakMap();
15
- var _rootDocument = /*#__PURE__*/new WeakMap();
16
- var _isClassicTheme = /*#__PURE__*/new WeakMap();
17
- var _cssVars = /*#__PURE__*/new WeakMap();
18
- var _computedStyles = /*#__PURE__*/new WeakMap();
19
- var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
20
- export class StylesHandler {
21
- /**
22
- * Initializes a new instance of the `StylesHandler` class.
23
- *
24
- * @param {string} themeName - The name of the theme.
25
- * @param {object} domBindings - The DOM bindings for the instance.
26
- */
27
- constructor(themeName, domBindings) {
28
- /**
29
- * Retrieves and processes the computed styles for a `td` element.
30
- *
31
- * This method creates a temporary table structure, appends it to the root element,
32
- * retrieves the computed styles for the `td` element, and then removes the table
33
- * from the DOM. The computed styles are passed to the provided callback function.
34
- *
35
- * @param {Array} cssProps - An array of CSS properties to retrieve.
36
- * @returns {object} An object containing the requested computed styles for the `td` element.
37
- * @private
38
- */
39
- _classPrivateMethodInitSpec(this, _StylesHandler_brand);
40
- /**
41
- * The instance's root element.
42
- *
43
- * @type {HTMLElement}
44
- */
45
- _classPrivateFieldInitSpec(this, _rootElement, void 0);
46
- /**
47
- * The computed style of the root element.
48
- *
49
- * @type {CSSStyleDeclaration}
50
- * @private
51
- */
52
- _classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
53
- /**
54
- * The root document of the instance.
55
- *
56
- * @type {Document}
57
- * @private
58
- */
59
- _classPrivateFieldInitSpec(this, _rootDocument, void 0);
60
- /**
61
- * `true` if the classic theme is enabled, `false` otherwise.
62
- *
63
- * @type {boolean}
64
- */
65
- _classPrivateFieldInitSpec(this, _isClassicTheme, false);
66
- /**
67
- * An object to store CSS variable values.
68
- *
69
- * @type {object}
70
- * @private
71
- */
72
- _classPrivateFieldInitSpec(this, _cssVars, {});
73
- /**
74
- * Stores the computed styles for various elements.
75
- *
76
- * @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
77
- * @private
78
- */
79
- _classPrivateFieldInitSpec(this, _computedStyles, {});
80
- _classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement);
81
- _classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
82
- _classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
83
- if (!themeName) {
84
- _classPrivateFieldSet(_isClassicTheme, this, true);
85
- }
86
- const stylesForTD = _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, ['box-sizing']);
87
- _classPrivateFieldGet(_computedStyles, this).td = {
88
- ..._classPrivateFieldGet(_computedStyles, this).td,
89
- ...{
90
- 'box-sizing': stylesForTD['box-sizing']
91
- }
92
- };
93
- }
94
-
95
- /**
96
- * Gets the value indicating whether the classic theme is enabled.
97
- *
98
- * @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
99
- */
100
- isClassicTheme() {
101
- return _classPrivateFieldGet(_isClassicTheme, this);
102
- }
103
-
104
- /**
105
- * Retrieves the value of a specified CSS variable.
106
- *
107
- * @param {string} variableName - The name of the CSS variable to retrieve.
108
- * @returns {number|undefined} The value of the specified CSS variable, or `undefined` if not found.
109
- */
110
- getCSSVariableValue(variableName) {
111
- if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
112
- return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
113
- }
114
- const acquiredValue = _assertClassBrand(_StylesHandler_brand, this, _getParsedCSSValue).call(this, `--ht-${variableName}`);
115
- if (acquiredValue !== null) {
116
- _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`] = acquiredValue;
117
- return acquiredValue;
118
- }
119
- }
120
-
121
- /**
122
- * Retrieves the computed style value for a specified CSS property of a `td` element.
123
- *
124
- * @param {string} cssProperty - The CSS property to retrieve the value for.
125
- * @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
126
- */
127
- getStyleForTD(cssProperty) {
128
- var _classPrivateFieldGet2;
129
- return (_classPrivateFieldGet2 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.td[cssProperty];
130
- }
131
-
132
- /**
133
- * Calculates the row height based on the current theme and CSS variables.
134
- *
135
- * @returns {number} The calculated row height.
136
- */
137
- getDefaultRowHeight() {
138
- if (_classPrivateFieldGet(_isClassicTheme, this)) {
139
- return CLASSIC_THEME_DEFAULT_HEIGHT;
140
- }
141
- return this.getCSSVariableValue('row-height');
142
- }
143
- }
144
- function _getStylesForTD(cssProps) {
145
- const rootDocument = _classPrivateFieldGet(_rootDocument, this);
146
- const rootElement = _classPrivateFieldGet(_rootElement, this);
147
- const table = rootDocument.createElement('table');
148
- const tbody = rootDocument.createElement('tbody');
149
- const tr = rootDocument.createElement('tr');
150
- // This needs not to be the first row in order to get "regular" vaules.
151
- const tr2 = rootDocument.createElement('tr');
152
- const td = rootDocument.createElement('td');
153
- tr2.appendChild(td);
154
- tbody.appendChild(tr);
155
- tbody.appendChild(tr2);
156
- table.appendChild(tbody);
157
- rootElement.appendChild(table);
158
- const computedStyle = getComputedStyle(td);
159
- const returnObject = {};
160
- cssProps.forEach(prop => {
161
- returnObject[prop] = computedStyle.getPropertyValue(prop);
162
- });
163
- rootElement.removeChild(table);
164
- return returnObject;
165
- }
166
- /**
167
- * Parses the value of a specified CSS property from the root element's computed style.
168
- *
169
- * @param {string} property - The CSS property to retrieve and parse.
170
- * @returns {number|null} The parsed value of the CSS property.
171
- */
172
- function _getParsedCSSValue(property) {
173
- const parsedValue = parseInt(_classPrivateFieldGet(_rootComputedStyle, this).getPropertyValue(property), 10);
174
- return Number.isNaN(parsedValue) ? null : parsedValue;
175
- }
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
- }