handsontable 0.0.0-next-802f59c-20241024 → 0.0.0-next-627918e-20241025

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 (128) 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/inlineStart.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  23. package/3rdparty/walkontable/src/overlays.js +6 -7
  24. package/3rdparty/walkontable/src/overlays.mjs +6 -7
  25. package/3rdparty/walkontable/src/renderer/colGroup.js +1 -1
  26. package/3rdparty/walkontable/src/renderer/colGroup.mjs +1 -1
  27. package/3rdparty/walkontable/src/renderer/table.js +1 -1
  28. package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
  29. package/3rdparty/walkontable/src/settings.js +8 -2
  30. package/3rdparty/walkontable/src/settings.mjs +8 -2
  31. package/3rdparty/walkontable/src/table.js +35 -8
  32. package/3rdparty/walkontable/src/table.mjs +35 -8
  33. package/3rdparty/walkontable/src/types.js +1 -0
  34. package/3rdparty/walkontable/src/types.mjs +1 -0
  35. package/3rdparty/walkontable/src/utils/column.js +43 -1
  36. package/3rdparty/walkontable/src/utils/column.mjs +43 -1
  37. package/3rdparty/walkontable/src/utils/columnStretching.js +197 -0
  38. package/3rdparty/walkontable/src/utils/columnStretching.mjs +193 -0
  39. package/3rdparty/walkontable/src/utils/stylesHandler.js +179 -0
  40. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +175 -0
  41. package/3rdparty/walkontable/src/viewport.js +88 -66
  42. package/3rdparty/walkontable/src/viewport.mjs +89 -67
  43. package/base.js +2 -2
  44. package/base.mjs +2 -2
  45. package/core/hooks/constants.js +0 -2
  46. package/core/hooks/constants.mjs +0 -2
  47. package/core/hooks/index.d.ts +2 -2
  48. package/core.d.ts +2 -2
  49. package/core.js +18 -6
  50. package/core.mjs +18 -6
  51. package/dataMap/metaManager/metaSchema.js +17 -0
  52. package/dataMap/metaManager/metaSchema.mjs +17 -0
  53. package/dist/handsontable.css +17 -9
  54. package/dist/handsontable.full.css +17 -7
  55. package/dist/handsontable.full.js +4217 -4534
  56. package/dist/handsontable.full.min.css +5 -4
  57. package/dist/handsontable.full.min.js +26 -26
  58. package/dist/handsontable.js +3923 -4234
  59. package/dist/handsontable.min.css +5 -4
  60. package/dist/handsontable.min.js +24 -24
  61. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  62. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  63. package/editors/baseEditor/baseEditor.js +1 -1
  64. package/editors/baseEditor/baseEditor.mjs +1 -1
  65. package/editors/dateEditor/dateEditor.js +2 -0
  66. package/editors/dateEditor/dateEditor.mjs +2 -0
  67. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  68. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  69. package/editors/selectEditor/selectEditor.js +20 -9
  70. package/editors/selectEditor/selectEditor.mjs +20 -9
  71. package/editors/textEditor/textEditor.js +4 -11
  72. package/editors/textEditor/textEditor.mjs +4 -11
  73. package/helpers/mixed.js +2 -2
  74. package/helpers/mixed.mjs +2 -2
  75. package/helpers/themes.js +17 -0
  76. package/helpers/themes.mjs +13 -0
  77. package/index.d.ts +0 -7
  78. package/package.json +10 -8
  79. package/plugins/comments/commentEditor.js +8 -1
  80. package/plugins/comments/commentEditor.mjs +8 -1
  81. package/plugins/comments/comments.js +2 -2
  82. package/plugins/comments/comments.mjs +2 -2
  83. package/plugins/contextMenu/menu/menu.js +4 -4
  84. package/plugins/contextMenu/menu/menu.mjs +4 -4
  85. package/plugins/index.d.ts +0 -3
  86. package/plugins/index.js +0 -3
  87. package/plugins/index.mjs +1 -3
  88. package/plugins/manualColumnMove/manualColumnMove.js +3 -1
  89. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
  90. package/plugins/manualColumnResize/manualColumnResize.js +12 -24
  91. package/plugins/manualColumnResize/manualColumnResize.mjs +12 -24
  92. package/plugins/manualRowMove/manualRowMove.js +1 -1
  93. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  94. package/plugins/manualRowResize/manualRowResize.js +1 -2
  95. package/plugins/manualRowResize/manualRowResize.mjs +2 -3
  96. package/plugins/mergeCells/mergeCells.js +1 -1
  97. package/plugins/mergeCells/mergeCells.mjs +1 -1
  98. package/plugins/nestedRows/ui/headers.js +3 -1
  99. package/plugins/nestedRows/ui/headers.mjs +3 -1
  100. package/settings.d.ts +1 -0
  101. package/styles/handsontable.css +1983 -0
  102. package/styles/handsontable.min.css +30 -0
  103. package/styles/ht-theme-gemini.css +706 -0
  104. package/styles/ht-theme-gemini.min.css +30 -0
  105. package/styles/ht-theme-main.css +714 -0
  106. package/styles/ht-theme-main.min.css +30 -0
  107. package/stylesManager.js +1 -0
  108. package/stylesManager.mjs +0 -0
  109. package/tableView.js +40 -39
  110. package/tableView.mjs +40 -39
  111. package/utils/autoResize.js +4 -1
  112. package/utils/autoResize.mjs +4 -1
  113. package/utils/ghostTable.js +1 -1
  114. package/utils/ghostTable.mjs +1 -1
  115. package/plugins/stretchColumns/calculator.js +0 -159
  116. package/plugins/stretchColumns/calculator.mjs +0 -155
  117. package/plugins/stretchColumns/index.d.ts +0 -1
  118. package/plugins/stretchColumns/index.js +0 -7
  119. package/plugins/stretchColumns/index.mjs +0 -1
  120. package/plugins/stretchColumns/strategies/_base.js +0 -85
  121. package/plugins/stretchColumns/strategies/_base.mjs +0 -81
  122. package/plugins/stretchColumns/strategies/all.js +0 -68
  123. package/plugins/stretchColumns/strategies/all.mjs +0 -64
  124. package/plugins/stretchColumns/strategies/last.js +0 -77
  125. package/plugins/stretchColumns/strategies/last.mjs +0 -73
  126. package/plugins/stretchColumns/stretchColumns.d.ts +0 -11
  127. package/plugins/stretchColumns/stretchColumns.js +0 -211
  128. package/plugins/stretchColumns/stretchColumns.mjs +0 -207
@@ -0,0 +1,179 @@
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
+ }
@@ -0,0 +1,175 @@
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
+ }
@@ -27,6 +27,7 @@ class Viewport {
27
27
  this.oversizedColumnHeaders = [];
28
28
  this.hasOversizedColumnHeadersMarked = {};
29
29
  this.clientHeight = 0;
30
+ this.containerWidth = NaN;
30
31
  this.rowHeaderWidth = NaN;
31
32
  this.rowsVisibleCalculator = null;
32
33
  this.columnsVisibleCalculator = null;
@@ -55,65 +56,55 @@ class Viewport {
55
56
  }
56
57
  return height;
57
58
  }
58
-
59
- /**
60
- * @returns {number}
61
- */
62
- getViewportHeight() {
63
- let containerHeight = this.getWorkspaceHeight();
64
- if (containerHeight === Infinity) {
65
- return containerHeight;
66
- }
67
- const columnHeaderHeight = this.getColumnHeaderHeight();
68
- if (columnHeaderHeight > 0) {
69
- containerHeight -= columnHeaderHeight;
70
- }
71
- return containerHeight;
72
- }
73
-
74
- /**
75
- * Gets the width of the table workspace (in pixels). The workspace size in the current
76
- * implementation returns the width of the table holder element including scrollbar width when
77
- * the table has defined size and the width of the window excluding scrollbar width when
78
- * the table has no defined size (the window is a scrollable container).
79
- *
80
- * This is a bug, as the method should always return stable values, always without scrollbar width.
81
- * Changing this behavior would break the column calculators, which would also need to be adjusted.
82
- *
83
- * @returns {number}
84
- */
85
59
  getWorkspaceWidth() {
60
+ const {
61
+ wtSettings
62
+ } = this;
86
63
  const {
87
64
  rootDocument,
88
65
  rootWindow
89
66
  } = this.domBindings;
90
67
  const trimmingContainer = this.dataAccessObject.inlineStartOverlayTrimmingContainer;
68
+ const docOffsetWidth = rootDocument.documentElement.offsetWidth;
69
+ const totalColumns = wtSettings.getSetting('totalColumns');
70
+ const preventOverflow = wtSettings.getSetting('preventOverflow');
71
+ const isRtl = wtSettings.getSetting('rtlMode');
72
+ const tableRect = this.wtTable.TABLE.getBoundingClientRect();
73
+ const inlineStart = isRtl ? tableRect.right - docOffsetWidth : tableRect.left;
74
+ const tableOffset = docOffsetWidth - inlineStart;
91
75
  let width;
92
- if (trimmingContainer === rootWindow) {
93
- const totalColumns = this.wtSettings.getSetting('totalColumns');
94
- width = this.wtTable.holder.offsetWidth;
95
- if (this.getRowHeaderWidth() + this.sumColumnWidths(0, totalColumns) > width) {
96
- width = rootDocument.documentElement.clientWidth;
97
- }
76
+ let overflow;
77
+ if (preventOverflow) {
78
+ return (0, _element.outerWidth)(this.wtTable.wtRootElement);
79
+ }
80
+ if (wtSettings.getSetting('freezeOverlays')) {
81
+ width = Math.min(tableOffset, docOffsetWidth);
98
82
  } else {
99
- width = trimmingContainer.clientWidth;
83
+ width = Math.min(this.getContainerFillWidth(), tableOffset, docOffsetWidth);
100
84
  }
101
- return width;
102
- }
103
-
104
- /**
105
- * @returns {number}
106
- */
107
- getViewportWidth() {
108
- const containerWidth = this.getWorkspaceWidth();
109
- if (containerWidth === Infinity) {
110
- return containerWidth;
85
+ if (trimmingContainer === rootWindow && totalColumns > 0 && this.sumColumnWidths(0, totalColumns - 1) > width) {
86
+ // in case sum of column widths is higher than available stylesheet width, let's assume using the whole window
87
+ // otherwise continue below, which will allow stretching
88
+ // this is used in `scroll_window.html`
89
+ // TODO test me
90
+ return rootDocument.documentElement.clientWidth;
111
91
  }
112
- const rowHeaderWidth = this.getRowHeaderWidth();
113
- if (rowHeaderWidth > 0) {
114
- return containerWidth - rowHeaderWidth;
92
+ if (trimmingContainer !== rootWindow) {
93
+ overflow = (0, _element.getStyle)(this.dataAccessObject.inlineStartOverlayTrimmingContainer, 'overflow', rootWindow);
94
+ if (overflow === 'scroll' || overflow === 'hidden' || overflow === 'auto') {
95
+ // this is used in `scroll.html`
96
+ // TODO test me
97
+ return Math.max(width, trimmingContainer.clientWidth);
98
+ }
115
99
  }
116
- return containerWidth;
100
+ const stretchSetting = wtSettings.getSetting('stretchH');
101
+ if (stretchSetting === 'none' || !stretchSetting) {
102
+ // if no stretching is used, return the maximum used workspace width
103
+ return Math.max(width, (0, _element.outerWidth)(this.wtTable.TABLE));
104
+ }
105
+
106
+ // if stretching is used, return the actual container width, so the columns can fit inside it
107
+ return width;
117
108
  }
118
109
 
119
110
  /**
@@ -134,24 +125,6 @@ class Viewport {
134
125
  return this.wtTable.hider.offsetWidth > this.getWorkspaceWidth();
135
126
  }
136
127
 
137
- /**
138
- * Checks if the table uses the window as a viewport and if there is a vertical scrollbar.
139
- *
140
- * @returns {boolean}
141
- */
142
- isVerticallyScrollableByWindow() {
143
- return this.dataAccessObject.topOverlayTrimmingContainer === this.domBindings.rootWindow;
144
- }
145
-
146
- /**
147
- * Checks if the table uses the window as a viewport and if there is a horizontal scrollbar.
148
- *
149
- * @returns {boolean}
150
- */
151
- isHorizontallyScrollableByWindow() {
152
- return this.dataAccessObject.inlineStartOverlayTrimmingContainer === this.domBindings.rootWindow;
153
- }
154
-
155
128
  /**
156
129
  * @param {number} from The visual column index from the width sum is start calculated.
157
130
  * @param {number} length The length of the column to traverse.
@@ -167,6 +140,24 @@ class Viewport {
167
140
  return sum;
168
141
  }
169
142
 
143
+ /**
144
+ * @returns {number}
145
+ */
146
+ getContainerFillWidth() {
147
+ if (this.containerWidth) {
148
+ return this.containerWidth;
149
+ }
150
+ const mainContainer = this.wtTable.holder;
151
+ const dummyElement = this.domBindings.rootDocument.createElement('div');
152
+ dummyElement.style.width = '100%';
153
+ dummyElement.style.height = '1px';
154
+ mainContainer.appendChild(dummyElement);
155
+ const fillWidth = dummyElement.offsetWidth;
156
+ this.containerWidth = fillWidth;
157
+ mainContainer.removeChild(dummyElement);
158
+ return fillWidth;
159
+ }
160
+
170
161
  /**
171
162
  * @returns {number}
172
163
  */
@@ -187,6 +178,21 @@ class Viewport {
187
178
  return this.columnHeaderHeight;
188
179
  }
189
180
 
181
+ /**
182
+ * @returns {number}
183
+ */
184
+ getViewportHeight() {
185
+ let containerHeight = this.getWorkspaceHeight();
186
+ if (containerHeight === Infinity) {
187
+ return containerHeight;
188
+ }
189
+ const columnHeaderHeight = this.getColumnHeaderHeight();
190
+ if (columnHeaderHeight > 0) {
191
+ containerHeight -= columnHeaderHeight;
192
+ }
193
+ return containerHeight;
194
+ }
195
+
190
196
  /**
191
197
  * @returns {number}
192
198
  */
@@ -221,6 +227,21 @@ class Viewport {
221
227
  return this.rowHeaderWidth;
222
228
  }
223
229
 
230
+ /**
231
+ * @returns {number}
232
+ */
233
+ getViewportWidth() {
234
+ const containerWidth = this.getWorkspaceWidth();
235
+ if (containerWidth === Infinity) {
236
+ return containerWidth;
237
+ }
238
+ const rowHeaderWidth = this.getRowHeaderWidth();
239
+ if (rowHeaderWidth > 0) {
240
+ return containerWidth - rowHeaderWidth;
241
+ }
242
+ return containerWidth;
243
+ }
244
+
224
245
  /**
225
246
  * Creates rows calculators. The type of the calculations can be chosen from the list:
226
247
  * - 'rendered' Calculates rows that should be rendered within the current table's viewport;
@@ -263,6 +284,7 @@ class Viewport {
263
284
  viewportHeight: height,
264
285
  scrollOffset: pos,
265
286
  totalRows: wtSettings.getSetting('totalRows'),
287
+ defaultRowHeight: this.instance.stylesHandler.getDefaultRowHeight(),
266
288
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
267
289
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
268
290
  horizontalScrollbarHeight: scrollbarHeight