handsontable 0.0.0-next-9a52a6a-20241128 → 0.0.0-next-b3759c7-20241203
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.
- package/3rdparty/walkontable/src/calculator/index.js +1 -2
- package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
- package/3rdparty/walkontable/src/core/_base.js +3 -0
- package/3rdparty/walkontable/src/core/_base.mjs +3 -0
- package/3rdparty/walkontable/src/core/clone.js +1 -0
- package/3rdparty/walkontable/src/core/clone.mjs +1 -0
- package/3rdparty/walkontable/src/core/core.js +2 -0
- package/3rdparty/walkontable/src/core/core.mjs +2 -0
- package/3rdparty/walkontable/src/facade/core.js +3 -0
- package/3rdparty/walkontable/src/facade/core.mjs +3 -0
- package/3rdparty/walkontable/src/index.js +0 -1
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +3 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +3 -2
- package/3rdparty/walkontable/src/overlay/top.js +3 -2
- package/3rdparty/walkontable/src/overlay/top.mjs +4 -3
- package/3rdparty/walkontable/src/renderer/index.js +4 -2
- package/3rdparty/walkontable/src/renderer/index.mjs +4 -2
- package/3rdparty/walkontable/src/renderer/table.js +12 -3
- package/3rdparty/walkontable/src/renderer/table.mjs +12 -3
- package/3rdparty/walkontable/src/selection/border/border.js +19 -13
- package/3rdparty/walkontable/src/selection/border/border.mjs +19 -13
- package/3rdparty/walkontable/src/selection/border/utils.js +26 -0
- package/3rdparty/walkontable/src/selection/border/utils.mjs +22 -0
- package/3rdparty/walkontable/src/selection/index.js +4 -4
- package/3rdparty/walkontable/src/selection/index.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +0 -2
- package/3rdparty/walkontable/src/settings.mjs +0 -2
- package/3rdparty/walkontable/src/table.js +17 -9
- package/3rdparty/walkontable/src/table.mjs +17 -9
- package/3rdparty/walkontable/src/types.js +1 -0
- package/3rdparty/walkontable/src/types.mjs +1 -0
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/utils/stylesHandler.js +295 -0
- package/3rdparty/walkontable/src/utils/stylesHandler.mjs +291 -0
- package/3rdparty/walkontable/src/viewport.js +1 -0
- package/3rdparty/walkontable/src/viewport.mjs +1 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/hooks/constants.js +9 -0
- package/core/hooks/constants.mjs +9 -0
- package/core/hooks/index.d.ts +1 -0
- package/core.d.ts +2 -0
- package/core.js +50 -1
- package/core.mjs +50 -1
- package/dataMap/metaManager/metaSchema.js +23 -3
- package/dataMap/metaManager/metaSchema.mjs +23 -3
- package/dist/handsontable.css +84 -72
- package/dist/handsontable.full.css +317 -304
- package/dist/handsontable.full.js +5888 -5727
- package/dist/handsontable.full.min.css +15 -10
- package/dist/handsontable.full.min.js +54 -53
- package/dist/handsontable.js +4337 -3944
- package/dist/handsontable.min.css +10 -6
- package/dist/handsontable.min.js +32 -32
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +9 -0
- package/editors/dateEditor/dateEditor.mjs +10 -1
- package/editors/handsontableEditor/handsontableEditor.js +7 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +7 -1
- package/editors/selectEditor/selectEditor.js +20 -9
- package/editors/selectEditor/selectEditor.mjs +20 -9
- package/editors/textEditor/textEditor.js +4 -11
- package/editors/textEditor/textEditor.mjs +4 -11
- package/helpers/dom/element.js +32 -1
- package/helpers/dom/element.mjs +31 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/themes.js +17 -0
- package/helpers/themes.mjs +13 -0
- package/package.json +12 -3
- package/plugins/comments/commentEditor.js +9 -0
- package/plugins/comments/commentEditor.mjs +9 -0
- package/plugins/comments/comments.js +14 -0
- package/plugins/comments/comments.mjs +15 -1
- package/plugins/contextMenu/menu/menu.js +9 -4
- package/plugins/contextMenu/menu/menu.mjs +9 -4
- package/plugins/filters/ui/multipleSelect.js +6 -0
- package/plugins/filters/ui/multipleSelect.mjs +6 -0
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +1 -2
- package/plugins/manualRowResize/manualRowResize.mjs +2 -3
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedRows/ui/headers.js +7 -1
- package/plugins/nestedRows/ui/headers.mjs +7 -1
- package/plugins/stretchColumns/calculator.js +2 -1
- package/plugins/stretchColumns/calculator.mjs +3 -2
- package/settings.d.ts +1 -0
- package/styles/handsontable.css +2307 -0
- package/styles/handsontable.min.css +30 -0
- package/styles/ht-theme-horizon.css +607 -0
- package/styles/ht-theme-horizon.min.css +30 -0
- package/styles/ht-theme-main.css +613 -0
- package/styles/ht-theme-main.min.css +30 -0
- package/tableView.js +67 -0
- package/tableView.mjs +68 -1
- package/utils/autoResize.js +4 -1
- package/utils/autoResize.mjs +4 -1
- package/utils/ghostTable.js +5 -3
- package/utils/ghostTable.mjs +5 -3
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -15
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -12
@@ -0,0 +1,291 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
3
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
4
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
5
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
6
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
7
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
8
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
9
|
+
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"); }
|
10
|
+
import { addClass, hasClass, removeClass } from "../../../../helpers/dom/element.mjs";
|
11
|
+
import { warn } from "../../../../helpers/console.mjs";
|
12
|
+
const CLASSIC_THEME_DEFAULT_HEIGHT = 23;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Handles the theme-related style operations.
|
16
|
+
*/
|
17
|
+
var _themeName = /*#__PURE__*/new WeakMap();
|
18
|
+
var _rootElement = /*#__PURE__*/new WeakMap();
|
19
|
+
var _rootComputedStyle = /*#__PURE__*/new WeakMap();
|
20
|
+
var _rootDocument = /*#__PURE__*/new WeakMap();
|
21
|
+
var _isClassicTheme = /*#__PURE__*/new WeakMap();
|
22
|
+
var _cssVars = /*#__PURE__*/new WeakMap();
|
23
|
+
var _computedStyles = /*#__PURE__*/new WeakMap();
|
24
|
+
var _StylesHandler_brand = /*#__PURE__*/new WeakSet();
|
25
|
+
export class StylesHandler {
|
26
|
+
/**
|
27
|
+
* Initializes a new instance of the `StylesHandler` class.
|
28
|
+
*
|
29
|
+
* @param {object} domBindings - The DOM bindings for the instance.
|
30
|
+
*/
|
31
|
+
constructor(domBindings) {
|
32
|
+
/**
|
33
|
+
* Calculates the row height based on the current theme and CSS variables.
|
34
|
+
*
|
35
|
+
* @returns {number|null} The calculated row height, or `null` if any required CSS variable is not found.
|
36
|
+
*/
|
37
|
+
_classPrivateMethodInitSpec(this, _StylesHandler_brand);
|
38
|
+
/**
|
39
|
+
* The name of the theme.
|
40
|
+
*
|
41
|
+
* @type {string|undefined}
|
42
|
+
*/
|
43
|
+
_classPrivateFieldInitSpec(this, _themeName, void 0);
|
44
|
+
/**
|
45
|
+
* The instance's root element.
|
46
|
+
*
|
47
|
+
* @type {HTMLElement}
|
48
|
+
*/
|
49
|
+
_classPrivateFieldInitSpec(this, _rootElement, void 0);
|
50
|
+
/**
|
51
|
+
* The computed style of the root element.
|
52
|
+
*
|
53
|
+
* @type {CSSStyleDeclaration}
|
54
|
+
* @private
|
55
|
+
*/
|
56
|
+
_classPrivateFieldInitSpec(this, _rootComputedStyle, void 0);
|
57
|
+
/**
|
58
|
+
* The root document of the instance.
|
59
|
+
*
|
60
|
+
* @type {Document}
|
61
|
+
* @private
|
62
|
+
*/
|
63
|
+
_classPrivateFieldInitSpec(this, _rootDocument, void 0);
|
64
|
+
/**
|
65
|
+
* `true` if the classic theme is enabled, `false` otherwise.
|
66
|
+
*
|
67
|
+
* @type {boolean}
|
68
|
+
*/
|
69
|
+
_classPrivateFieldInitSpec(this, _isClassicTheme, true);
|
70
|
+
/**
|
71
|
+
* An object to store CSS variable values.
|
72
|
+
*
|
73
|
+
* @type {object}
|
74
|
+
* @private
|
75
|
+
*/
|
76
|
+
_classPrivateFieldInitSpec(this, _cssVars, {});
|
77
|
+
/**
|
78
|
+
* Stores the computed styles for various elements.
|
79
|
+
*
|
80
|
+
* @type {object} - An object containing the computed styles if a nested structore of `element: { [element type]: {property: value} }`.
|
81
|
+
* @private
|
82
|
+
*/
|
83
|
+
_classPrivateFieldInitSpec(this, _computedStyles, {});
|
84
|
+
_classPrivateFieldSet(_rootElement, this, domBindings.rootTable.parentElement.parentElement);
|
85
|
+
_classPrivateFieldSet(_rootDocument, this, domBindings.rootDocument);
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Gets the value indicating whether the classic theme is enabled.
|
90
|
+
*
|
91
|
+
* @returns {boolean} `true` if the classic theme is enabled, `false` otherwise.
|
92
|
+
*/
|
93
|
+
isClassicTheme() {
|
94
|
+
return _classPrivateFieldGet(_isClassicTheme, this);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Retrieves the value of a specified CSS variable.
|
99
|
+
*
|
100
|
+
* @param {string} variableName - The name of the CSS variable to retrieve.
|
101
|
+
* @returns {number|null|undefined} The value of the specified CSS variable, or `undefined` if not found.
|
102
|
+
*/
|
103
|
+
getCSSVariableValue(variableName) {
|
104
|
+
var _assertClassBrand$cal;
|
105
|
+
if (_classPrivateFieldGet(_isClassicTheme, this)) {
|
106
|
+
return null;
|
107
|
+
}
|
108
|
+
if (_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`]) {
|
109
|
+
return _classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`];
|
110
|
+
}
|
111
|
+
const acquiredValue = (_assertClassBrand$cal = _assertClassBrand(_StylesHandler_brand, this, _getParsedNumericCSSValue).call(this, `--ht-${variableName}`)) !== null && _assertClassBrand$cal !== void 0 ? _assertClassBrand$cal : _assertClassBrand(_StylesHandler_brand, this, _getCSSValue).call(this, `--ht-${variableName}`);
|
112
|
+
if (acquiredValue !== null) {
|
113
|
+
_classPrivateFieldGet(_cssVars, this)[`--ht-${variableName}`] = acquiredValue;
|
114
|
+
return acquiredValue;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Retrieves the computed style value for a specified CSS property of a `td` element.
|
120
|
+
*
|
121
|
+
* @param {string} cssProperty - The CSS property to retrieve the value for.
|
122
|
+
* @returns {number|string|undefined} The value of the specified CSS property, or `undefined` if not found.
|
123
|
+
*/
|
124
|
+
getStyleForTD(cssProperty) {
|
125
|
+
var _classPrivateFieldGet2;
|
126
|
+
return (_classPrivateFieldGet2 = _classPrivateFieldGet(_computedStyles, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.td[cssProperty];
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Calculates the row height based on the current theme and CSS variables.
|
131
|
+
*
|
132
|
+
* @returns {number} The calculated row height.
|
133
|
+
*/
|
134
|
+
getDefaultRowHeight() {
|
135
|
+
if (_classPrivateFieldGet(_isClassicTheme, this)) {
|
136
|
+
return CLASSIC_THEME_DEFAULT_HEIGHT;
|
137
|
+
}
|
138
|
+
const calculatedRowHeight = _assertClassBrand(_StylesHandler_brand, this, _calculateRowHeight).call(this);
|
139
|
+
if (!calculatedRowHeight && hasClass(_classPrivateFieldGet(_rootElement, this), 'ht-wrapper')) {
|
140
|
+
warn(`The "${_classPrivateFieldGet(_themeName, this)}" theme is enabled, but its stylesheets are missing or not imported correctly. \
|
141
|
+
Import the correct CSS files in order to use that theme.`);
|
142
|
+
_classPrivateFieldSet(_isClassicTheme, this, true);
|
143
|
+
this.useTheme();
|
144
|
+
return CLASSIC_THEME_DEFAULT_HEIGHT;
|
145
|
+
}
|
146
|
+
return calculatedRowHeight;
|
147
|
+
}
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Checks if the cells are using the `border-box` box-sizing model.
|
151
|
+
*
|
152
|
+
* @returns {boolean}
|
153
|
+
*/
|
154
|
+
areCellsBorderBox() {
|
155
|
+
return this.getStyleForTD('box-sizing') === 'border-box';
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Applies the specified theme to the instance.
|
160
|
+
*
|
161
|
+
* @param {string|undefined|boolean} [themeName] - The name of the theme to apply.
|
162
|
+
*/
|
163
|
+
useTheme(themeName) {
|
164
|
+
if (!themeName) {
|
165
|
+
_assertClassBrand(_StylesHandler_brand, this, _cacheStylesheetValues).call(this);
|
166
|
+
_classPrivateFieldSet(_isClassicTheme, this, true);
|
167
|
+
_classPrivateFieldSet(_themeName, this, themeName || undefined);
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
if (themeName && themeName !== _classPrivateFieldGet(_themeName, this)) {
|
171
|
+
if (_classPrivateFieldGet(_themeName, this)) {
|
172
|
+
_assertClassBrand(_StylesHandler_brand, this, _clearCachedValues).call(this);
|
173
|
+
}
|
174
|
+
_classPrivateFieldSet(_themeName, this, themeName);
|
175
|
+
_classPrivateFieldSet(_isClassicTheme, this, false);
|
176
|
+
_assertClassBrand(_StylesHandler_brand, this, _applyClassNames).call(this);
|
177
|
+
_assertClassBrand(_StylesHandler_brand, this, _cacheStylesheetValues).call(this);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Gets the name of the theme.
|
183
|
+
*
|
184
|
+
* @returns {string|undefined}
|
185
|
+
*/
|
186
|
+
getThemeName() {
|
187
|
+
return _classPrivateFieldGet(_themeName, this);
|
188
|
+
}
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Removes the theme-related class names from the root element.
|
192
|
+
*/
|
193
|
+
removeClassNames() {
|
194
|
+
if (hasClass(_classPrivateFieldGet(_rootElement, this), _classPrivateFieldGet(_themeName, this))) {
|
195
|
+
removeClass(_classPrivateFieldGet(_rootElement, this), _classPrivateFieldGet(_themeName, this));
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
function _calculateRowHeight() {
|
200
|
+
const lineHeightVarValue = this.getCSSVariableValue('line-height');
|
201
|
+
const verticalPaddingVarValue = this.getCSSVariableValue('cell-vertical-padding');
|
202
|
+
const bottomBorderWidth = Math.ceil(parseFloat(this.getStyleForTD('border-bottom-width')));
|
203
|
+
if (lineHeightVarValue === null || verticalPaddingVarValue === null || isNaN(bottomBorderWidth)) {
|
204
|
+
return null;
|
205
|
+
}
|
206
|
+
return lineHeightVarValue + 2 * verticalPaddingVarValue + bottomBorderWidth;
|
207
|
+
}
|
208
|
+
/**
|
209
|
+
* Applies the necessary class names to the root element.
|
210
|
+
*/
|
211
|
+
function _applyClassNames() {
|
212
|
+
removeClass(_classPrivateFieldGet(_rootElement, this), /ht-theme-.*/g);
|
213
|
+
addClass(_classPrivateFieldGet(_rootElement, this), _classPrivateFieldGet(_themeName, this));
|
214
|
+
}
|
215
|
+
/**
|
216
|
+
* Caches the computed style values for the root element and `td` element.
|
217
|
+
*/
|
218
|
+
function _cacheStylesheetValues() {
|
219
|
+
if (!this.isClassicTheme()) {
|
220
|
+
_classPrivateFieldSet(_rootComputedStyle, this, getComputedStyle(_classPrivateFieldGet(_rootElement, this)));
|
221
|
+
}
|
222
|
+
const stylesForTD = _assertClassBrand(_StylesHandler_brand, this, _getStylesForTD).call(this, ['box-sizing', 'border-bottom-width']);
|
223
|
+
_classPrivateFieldGet(_computedStyles, this).td = {
|
224
|
+
..._classPrivateFieldGet(_computedStyles, this).td,
|
225
|
+
...{
|
226
|
+
'box-sizing': stylesForTD['box-sizing'],
|
227
|
+
'border-bottom-width': stylesForTD['border-bottom-width']
|
228
|
+
}
|
229
|
+
};
|
230
|
+
}
|
231
|
+
/**
|
232
|
+
* Retrieves and processes the computed styles for a `td` element.
|
233
|
+
*
|
234
|
+
* This method creates a temporary table structure, appends it to the root element,
|
235
|
+
* retrieves the computed styles for the `td` element, and then removes the table
|
236
|
+
* from the DOM. The computed styles are passed to the provided callback function.
|
237
|
+
*
|
238
|
+
* @param {Array} cssProps - An array of CSS properties to retrieve.
|
239
|
+
* @returns {object} An object containing the requested computed styles for the `td` element.
|
240
|
+
* @private
|
241
|
+
*/
|
242
|
+
function _getStylesForTD(cssProps) {
|
243
|
+
const rootDocument = _classPrivateFieldGet(_rootDocument, this);
|
244
|
+
const rootElement = _classPrivateFieldGet(_rootElement, this);
|
245
|
+
const table = rootDocument.createElement('table');
|
246
|
+
const tbody = rootDocument.createElement('tbody');
|
247
|
+
const tr = rootDocument.createElement('tr');
|
248
|
+
// This needs not to be the first row in order to get "regular" vaules.
|
249
|
+
const tr2 = rootDocument.createElement('tr');
|
250
|
+
const td = rootDocument.createElement('td');
|
251
|
+
tr2.appendChild(td);
|
252
|
+
tbody.appendChild(tr);
|
253
|
+
tbody.appendChild(tr2);
|
254
|
+
table.appendChild(tbody);
|
255
|
+
rootElement.appendChild(table);
|
256
|
+
const computedStyle = getComputedStyle(td);
|
257
|
+
const returnObject = {};
|
258
|
+
cssProps.forEach(prop => {
|
259
|
+
returnObject[prop] = computedStyle.getPropertyValue(prop);
|
260
|
+
});
|
261
|
+
rootElement.removeChild(table);
|
262
|
+
return returnObject;
|
263
|
+
}
|
264
|
+
/**
|
265
|
+
* Parses the numeric value of a specified CSS property from the root element's computed style.
|
266
|
+
*
|
267
|
+
* @param {string} property - The CSS property to retrieve and parse.
|
268
|
+
* @returns {number|null} The parsed value of the CSS property or `null` if non-existent.
|
269
|
+
*/
|
270
|
+
function _getParsedNumericCSSValue(property) {
|
271
|
+
const parsedValue = Math.ceil(parseFloat(_assertClassBrand(_StylesHandler_brand, this, _getCSSValue).call(this, property)));
|
272
|
+
return Number.isNaN(parsedValue) ? null : parsedValue;
|
273
|
+
}
|
274
|
+
/**
|
275
|
+
* Retrieves the non-numeric value of a specified CSS property from the root element's computed style.
|
276
|
+
*
|
277
|
+
* @param {string} property - The CSS property to retrieve.
|
278
|
+
* @returns {string|null} The value of the specified CSS property or `null` if non-existent.
|
279
|
+
*/
|
280
|
+
function _getCSSValue(property) {
|
281
|
+
const acquiredValue = _classPrivateFieldGet(_rootComputedStyle, this).getPropertyValue(property);
|
282
|
+
return acquiredValue === '' ? null : acquiredValue;
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* Clears the cached values.
|
286
|
+
*/
|
287
|
+
function _clearCachedValues() {
|
288
|
+
_classPrivateFieldSet(_computedStyles, this, {});
|
289
|
+
_classPrivateFieldSet(_cssVars, this, {});
|
290
|
+
_classPrivateFieldSet(_isClassicTheme, this, true);
|
291
|
+
}
|
@@ -264,6 +264,7 @@ class Viewport {
|
|
264
264
|
viewportHeight: height,
|
265
265
|
scrollOffset: pos,
|
266
266
|
totalRows: wtSettings.getSetting('totalRows'),
|
267
|
+
defaultRowHeight: this.instance.stylesHandler.getDefaultRowHeight(),
|
267
268
|
rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
|
268
269
|
overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
|
269
270
|
horizontalScrollbarHeight: scrollbarHeight
|
@@ -261,6 +261,7 @@ class Viewport {
|
|
261
261
|
viewportHeight: height,
|
262
262
|
scrollOffset: pos,
|
263
263
|
totalRows: wtSettings.getSetting('totalRows'),
|
264
|
+
defaultRowHeight: this.instance.stylesHandler.getDefaultRowHeight(),
|
264
265
|
rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
|
265
266
|
overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
|
266
267
|
horizontalScrollbarHeight: scrollbarHeight
|
package/base.js
CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
|
|
45
45
|
Handsontable.CellCoords = _src.CellCoords;
|
46
46
|
Handsontable.CellRange = _src.CellRange;
|
47
47
|
Handsontable.packageName = 'handsontable';
|
48
|
-
Handsontable.buildDate = "
|
49
|
-
Handsontable.version = "0.0.0-next-
|
48
|
+
Handsontable.buildDate = "03/12/2024 12:19:25";
|
49
|
+
Handsontable.version = "0.0.0-next-b3759c7-20241203";
|
50
50
|
Handsontable.languages = {
|
51
51
|
dictionaryKeys: _registry.dictionaryKeys,
|
52
52
|
getLanguageDictionary: _registry.getLanguageDictionary,
|
package/base.mjs
CHANGED
@@ -35,8 +35,8 @@ Handsontable.hooks = Hooks.getSingleton();
|
|
35
35
|
Handsontable.CellCoords = CellCoords;
|
36
36
|
Handsontable.CellRange = CellRange;
|
37
37
|
Handsontable.packageName = 'handsontable';
|
38
|
-
Handsontable.buildDate = "
|
39
|
-
Handsontable.version = "0.0.0-next-
|
38
|
+
Handsontable.buildDate = "03/12/2024 12:19:30";
|
39
|
+
Handsontable.version = "0.0.0-next-b3759c7-20241203";
|
40
40
|
Handsontable.languages = {
|
41
41
|
dictionaryKeys,
|
42
42
|
getLanguageDictionary,
|
package/core/hooks/constants.js
CHANGED
@@ -872,6 +872,15 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
|
|
872
872
|
* @param {string} [source] String that identifies source of hook call.
|
873
873
|
*/
|
874
874
|
'afterSetSourceDataAtCell',
|
875
|
+
/**
|
876
|
+
* Fired after a theme is enabled, changed, or disabled.
|
877
|
+
*
|
878
|
+
* @since 15.0.0
|
879
|
+
* @event Hooks#afterSetTheme
|
880
|
+
* @param {string|boolean|undefined} themeName The theme name.
|
881
|
+
* @param {boolean} firstRun `true` if it's the initial setting of the theme, `false` otherwise.
|
882
|
+
*/
|
883
|
+
'afterSetTheme',
|
875
884
|
/**
|
876
885
|
* Fired after calling the [`updateSettings`](@/api/core.md#updatesettings) method.
|
877
886
|
*
|
package/core/hooks/constants.mjs
CHANGED
@@ -869,6 +869,15 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
|
|
869
869
|
* @param {string} [source] String that identifies source of hook call.
|
870
870
|
*/
|
871
871
|
'afterSetSourceDataAtCell',
|
872
|
+
/**
|
873
|
+
* Fired after a theme is enabled, changed, or disabled.
|
874
|
+
*
|
875
|
+
* @since 15.0.0
|
876
|
+
* @event Hooks#afterSetTheme
|
877
|
+
* @param {string|boolean|undefined} themeName The theme name.
|
878
|
+
* @param {boolean} firstRun `true` if it's the initial setting of the theme, `false` otherwise.
|
879
|
+
*/
|
880
|
+
'afterSetTheme',
|
872
881
|
/**
|
873
882
|
* Fired after calling the [`updateSettings`](@/api/core.md#updatesettings) method.
|
874
883
|
*
|
package/core/hooks/index.d.ts
CHANGED
@@ -134,6 +134,7 @@ export interface Events {
|
|
134
134
|
afterSetDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
|
135
135
|
afterSetDataAtRowProp?: (changes: CellChange[], source?: ChangeSource) => void;
|
136
136
|
afterSetSourceDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
|
137
|
+
afterSetTheme?: (themeName: string|boolean|undefined, firstRun: boolean) => void;
|
137
138
|
afterSheetAdded?: (addedSheetDisplayName: string) => void;
|
138
139
|
afterSheetRemoved?: (removedSheetDisplayName: string, changes: ExportedChange[]) => void;
|
139
140
|
afterSheetRenamed?: (oldDisplayName: string, newDisplayName: string) => void;
|
package/core.d.ts
CHANGED
@@ -73,6 +73,7 @@ export default class Core {
|
|
73
73
|
getCoords(element: Element | null): CellCoords;
|
74
74
|
getCopyableData(row: number, column: number): string;
|
75
75
|
getCopyableText(startRow: number, startColumn: number, endRow: number, endColumn: number): string;
|
76
|
+
getCurrentThemeName(): string | undefined;
|
76
77
|
getData(row?: number, column?: number, row2?: number, column2?: number): CellValue[];
|
77
78
|
getDataAtCell(row: number, column: number): CellValue;
|
78
79
|
getDataAtCol(column: number): CellValue[];
|
@@ -179,6 +180,7 @@ export default class Core {
|
|
179
180
|
unlisten(): void;
|
180
181
|
updateData(data: CellValue[][] | RowObject[], source?: string): void;
|
181
182
|
updateSettings(settings: GridSettings, init?: boolean): void;
|
183
|
+
useTheme(themeName: string|boolean|undefined): void;
|
182
184
|
validateCell(value: any, cellProperties: CellProperties, callback: (valid: boolean) => void, source: string): void;
|
183
185
|
validateCells(callback?: (valid: boolean) => void): void;
|
184
186
|
validateColumns(columns: number[], callback?: (valid: boolean) => void): void;
|
package/core.js
CHANGED
@@ -47,6 +47,7 @@ var _index3 = require("./core/index");
|
|
47
47
|
var _uniqueMap = require("./utils/dataStructures/uniqueMap");
|
48
48
|
var _shortcuts = require("./shortcuts");
|
49
49
|
var _shortcutContexts = require("./shortcutContexts");
|
50
|
+
var _themes = require("./helpers/themes");
|
50
51
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
51
52
|
let activeGuid = null;
|
52
53
|
|
@@ -234,6 +235,7 @@ function Core(rootElement, userSettings) {
|
|
234
235
|
rootElement.insertBefore(this.container, rootElement.firstChild);
|
235
236
|
if ((0, _rootInstance.isRootInstance)(this)) {
|
236
237
|
(0, _mixed._injectProductInfo)(userSettings.licenseKey, rootElement);
|
238
|
+
(0, _element.addClass)(rootElement, 'ht-wrapper');
|
237
239
|
}
|
238
240
|
this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
|
239
241
|
|
@@ -946,7 +948,9 @@ function Core(rootElement, userSettings) {
|
|
946
948
|
// when 'value' is array and 'orgValue' is null, set 'orgValue' to
|
947
949
|
// an empty array so that the null value can be compared to 'value'
|
948
950
|
// as an empty value for the array context
|
949
|
-
if (Array.isArray(value) && orgValue === null)
|
951
|
+
if (Array.isArray(value) && orgValue === null) {
|
952
|
+
orgValue = [];
|
953
|
+
}
|
950
954
|
if (orgValue === null || typeof orgValue !== 'object') {
|
951
955
|
pushData = false;
|
952
956
|
} else {
|
@@ -1034,6 +1038,13 @@ function Core(rootElement, userSettings) {
|
|
1034
1038
|
}
|
1035
1039
|
this.updateSettings(tableMeta, true);
|
1036
1040
|
this.view = new _tableView.default(this);
|
1041
|
+
const themeName = tableMeta.themeName || (0, _themes.getThemeClassName)(instance.rootElement);
|
1042
|
+
|
1043
|
+
// Use the theme defined as a root element class or in the settings (in that order).
|
1044
|
+
instance.useTheme(themeName);
|
1045
|
+
|
1046
|
+
// Add the theme class name to the license info element.
|
1047
|
+
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
1037
1048
|
editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
|
1038
1049
|
viewportScroller = (0, _index3.createViewportScroller)(instance);
|
1039
1050
|
focusManager = new _focusManager.FocusManager(instance);
|
@@ -2387,6 +2398,19 @@ function Core(rootElement, userSettings) {
|
|
2387
2398
|
if (instance.view) {
|
2388
2399
|
instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
|
2389
2400
|
instance.view._wt.exportSettingsAsClassNames();
|
2401
|
+
const currentThemeName = instance.getCurrentThemeName();
|
2402
|
+
const themeNameOptionExists = (0, _object.hasOwnProperty)(settings, 'themeName');
|
2403
|
+
if (currentThemeName && themeNameOptionExists) {
|
2404
|
+
instance.view.getStylesHandler().removeClassNames();
|
2405
|
+
instance.view.removeClassNameFromLicenseElement(currentThemeName);
|
2406
|
+
}
|
2407
|
+
const themeName = themeNameOptionExists && settings.themeName || (0, _themes.getThemeClassName)(instance.rootElement);
|
2408
|
+
|
2409
|
+
// Use the theme defined as a root element class or in the settings (in that order).
|
2410
|
+
instance.useTheme(themeName);
|
2411
|
+
|
2412
|
+
// Add the theme class name to the license info element.
|
2413
|
+
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
2390
2414
|
}
|
2391
2415
|
instance.runHooks('afterUpdateSettings', settings);
|
2392
2416
|
}
|
@@ -4576,6 +4600,31 @@ function Core(rootElement, userSettings) {
|
|
4576
4600
|
};
|
4577
4601
|
this.timeouts = [];
|
4578
4602
|
|
4603
|
+
/**
|
4604
|
+
* Use the theme specified by the provided name.
|
4605
|
+
*
|
4606
|
+
* @memberof Core#
|
4607
|
+
* @function useTheme
|
4608
|
+
* @since 15.0.0
|
4609
|
+
* @param {string|boolean|undefined} themeName The name of the theme to use.
|
4610
|
+
*/
|
4611
|
+
this.useTheme = themeName => {
|
4612
|
+
this.view.getStylesHandler().useTheme(themeName);
|
4613
|
+
this.runHooks('afterSetTheme', themeName, !!firstRun);
|
4614
|
+
};
|
4615
|
+
|
4616
|
+
/**
|
4617
|
+
* Gets the name of the currently used theme.
|
4618
|
+
*
|
4619
|
+
* @memberof Core#
|
4620
|
+
* @function getCurrentThemeName
|
4621
|
+
* @since 15.0.0
|
4622
|
+
* @returns {string|undefined} The name of the currently used theme.
|
4623
|
+
*/
|
4624
|
+
this.getCurrentThemeName = () => {
|
4625
|
+
return this.view.getStylesHandler().getThemeName();
|
4626
|
+
};
|
4627
|
+
|
4579
4628
|
/**
|
4580
4629
|
* Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
|
4581
4630
|
*
|
package/core.mjs
CHANGED
@@ -43,6 +43,7 @@ import { installFocusCatcher, createViewportScroller } from "./core/index.mjs";
|
|
43
43
|
import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
|
44
44
|
import { createShortcutManager } from "./shortcuts/index.mjs";
|
45
45
|
import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
|
46
|
+
import { getThemeClassName } from "./helpers/themes.mjs";
|
46
47
|
let activeGuid = null;
|
47
48
|
|
48
49
|
/**
|
@@ -229,6 +230,7 @@ export default function Core(rootElement, userSettings) {
|
|
229
230
|
rootElement.insertBefore(this.container, rootElement.firstChild);
|
230
231
|
if (isRootInstance(this)) {
|
231
232
|
_injectProductInfo(userSettings.licenseKey, rootElement);
|
233
|
+
addClass(rootElement, 'ht-wrapper');
|
232
234
|
}
|
233
235
|
this.guid = `ht_${randomString()}`; // this is the namespace for global events
|
234
236
|
|
@@ -941,7 +943,9 @@ export default function Core(rootElement, userSettings) {
|
|
941
943
|
// when 'value' is array and 'orgValue' is null, set 'orgValue' to
|
942
944
|
// an empty array so that the null value can be compared to 'value'
|
943
945
|
// as an empty value for the array context
|
944
|
-
if (Array.isArray(value) && orgValue === null)
|
946
|
+
if (Array.isArray(value) && orgValue === null) {
|
947
|
+
orgValue = [];
|
948
|
+
}
|
945
949
|
if (orgValue === null || typeof orgValue !== 'object') {
|
946
950
|
pushData = false;
|
947
951
|
} else {
|
@@ -1029,6 +1033,13 @@ export default function Core(rootElement, userSettings) {
|
|
1029
1033
|
}
|
1030
1034
|
this.updateSettings(tableMeta, true);
|
1031
1035
|
this.view = new TableView(this);
|
1036
|
+
const themeName = tableMeta.themeName || getThemeClassName(instance.rootElement);
|
1037
|
+
|
1038
|
+
// Use the theme defined as a root element class or in the settings (in that order).
|
1039
|
+
instance.useTheme(themeName);
|
1040
|
+
|
1041
|
+
// Add the theme class name to the license info element.
|
1042
|
+
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
1032
1043
|
editorManager = EditorManager.getInstance(instance, tableMeta, selection);
|
1033
1044
|
viewportScroller = createViewportScroller(instance);
|
1034
1045
|
focusManager = new FocusManager(instance);
|
@@ -2382,6 +2393,19 @@ export default function Core(rootElement, userSettings) {
|
|
2382
2393
|
if (instance.view) {
|
2383
2394
|
instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
|
2384
2395
|
instance.view._wt.exportSettingsAsClassNames();
|
2396
|
+
const currentThemeName = instance.getCurrentThemeName();
|
2397
|
+
const themeNameOptionExists = hasOwnProperty(settings, 'themeName');
|
2398
|
+
if (currentThemeName && themeNameOptionExists) {
|
2399
|
+
instance.view.getStylesHandler().removeClassNames();
|
2400
|
+
instance.view.removeClassNameFromLicenseElement(currentThemeName);
|
2401
|
+
}
|
2402
|
+
const themeName = themeNameOptionExists && settings.themeName || getThemeClassName(instance.rootElement);
|
2403
|
+
|
2404
|
+
// Use the theme defined as a root element class or in the settings (in that order).
|
2405
|
+
instance.useTheme(themeName);
|
2406
|
+
|
2407
|
+
// Add the theme class name to the license info element.
|
2408
|
+
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
2385
2409
|
}
|
2386
2410
|
instance.runHooks('afterUpdateSettings', settings);
|
2387
2411
|
}
|
@@ -4571,6 +4595,31 @@ export default function Core(rootElement, userSettings) {
|
|
4571
4595
|
};
|
4572
4596
|
this.timeouts = [];
|
4573
4597
|
|
4598
|
+
/**
|
4599
|
+
* Use the theme specified by the provided name.
|
4600
|
+
*
|
4601
|
+
* @memberof Core#
|
4602
|
+
* @function useTheme
|
4603
|
+
* @since 15.0.0
|
4604
|
+
* @param {string|boolean|undefined} themeName The name of the theme to use.
|
4605
|
+
*/
|
4606
|
+
this.useTheme = themeName => {
|
4607
|
+
this.view.getStylesHandler().useTheme(themeName);
|
4608
|
+
this.runHooks('afterSetTheme', themeName, !!firstRun);
|
4609
|
+
};
|
4610
|
+
|
4611
|
+
/**
|
4612
|
+
* Gets the name of the currently used theme.
|
4613
|
+
*
|
4614
|
+
* @memberof Core#
|
4615
|
+
* @function getCurrentThemeName
|
4616
|
+
* @since 15.0.0
|
4617
|
+
* @returns {string|undefined} The name of the currently used theme.
|
4618
|
+
*/
|
4619
|
+
this.getCurrentThemeName = () => {
|
4620
|
+
return this.view.getStylesHandler().getThemeName();
|
4621
|
+
};
|
4622
|
+
|
4574
4623
|
/**
|
4575
4624
|
* Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
|
4576
4625
|
*
|
@@ -3842,8 +3842,8 @@ var _default = () => {
|
|
3842
3842
|
/**
|
3843
3843
|
* The `rowHeights` option sets rows' heights, in pixels.
|
3844
3844
|
*
|
3845
|
-
* In the rendering process, the default row height is 23 px (22 px + 1 px of the row's bottom border).
|
3846
|
-
* You can change it to equal or greater than
|
3845
|
+
* In the rendering process, the default row height is 23 px (in the classic theme: 22 px + 1 px of the row's bottom border) or whatever is defined in the used theme (based on the line height, vertical padding and cell borders).
|
3846
|
+
* You can change it to equal or greater than the defautl value, by setting the `rowHeights` option to one of the following:
|
3847
3847
|
*
|
3848
3848
|
* | Setting | Description | Example |
|
3849
3849
|
* | ----------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
@@ -3875,7 +3875,7 @@ var _default = () => {
|
|
3875
3875
|
* // set the first (by visual index) row's height to 100
|
3876
3876
|
* // set the second (by visual index) row's height to 120
|
3877
3877
|
* // set the third (by visual index) row's height to `undefined`
|
3878
|
-
* // set any other row's height to the default
|
3878
|
+
* // set any other row's height to the default height value
|
3879
3879
|
* rowHeights: [100, 120, undefined],
|
3880
3880
|
*
|
3881
3881
|
* // set each row's height individually, using a function
|
@@ -4313,6 +4313,26 @@ var _default = () => {
|
|
4313
4313
|
* ```
|
4314
4314
|
*/
|
4315
4315
|
tableClassName: undefined,
|
4316
|
+
/**
|
4317
|
+
* The `themeName` option allows enabling a theme by that name.
|
4318
|
+
*
|
4319
|
+
* If no `themeName` is provided, the table will use the classic theme (if the correct CSS files are imported).
|
4320
|
+
*
|
4321
|
+
* Read more:
|
4322
|
+
* - [Themes](@/guides/styling/themes/themes.md)
|
4323
|
+
*
|
4324
|
+
* @memberof Options#
|
4325
|
+
* @type {string|boolean|undefined}
|
4326
|
+
* @default undefined
|
4327
|
+
* @category Core
|
4328
|
+
* @since 15.0.0
|
4329
|
+
*
|
4330
|
+
* @example
|
4331
|
+
* ```js
|
4332
|
+
* themeName: 'ht-theme-name',
|
4333
|
+
* ```
|
4334
|
+
*/
|
4335
|
+
themeName: undefined,
|
4316
4336
|
/**
|
4317
4337
|
* The `tabMoves` option configures the action of the <kbd>**Tab**</kbd> key.
|
4318
4338
|
*
|
@@ -3839,8 +3839,8 @@ export default () => {
|
|
3839
3839
|
/**
|
3840
3840
|
* The `rowHeights` option sets rows' heights, in pixels.
|
3841
3841
|
*
|
3842
|
-
* In the rendering process, the default row height is 23 px (22 px + 1 px of the row's bottom border).
|
3843
|
-
* You can change it to equal or greater than
|
3842
|
+
* In the rendering process, the default row height is 23 px (in the classic theme: 22 px + 1 px of the row's bottom border) or whatever is defined in the used theme (based on the line height, vertical padding and cell borders).
|
3843
|
+
* You can change it to equal or greater than the defautl value, by setting the `rowHeights` option to one of the following:
|
3844
3844
|
*
|
3845
3845
|
* | Setting | Description | Example |
|
3846
3846
|
* | ----------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
@@ -3872,7 +3872,7 @@ export default () => {
|
|
3872
3872
|
* // set the first (by visual index) row's height to 100
|
3873
3873
|
* // set the second (by visual index) row's height to 120
|
3874
3874
|
* // set the third (by visual index) row's height to `undefined`
|
3875
|
-
* // set any other row's height to the default
|
3875
|
+
* // set any other row's height to the default height value
|
3876
3876
|
* rowHeights: [100, 120, undefined],
|
3877
3877
|
*
|
3878
3878
|
* // set each row's height individually, using a function
|
@@ -4310,6 +4310,26 @@ export default () => {
|
|
4310
4310
|
* ```
|
4311
4311
|
*/
|
4312
4312
|
tableClassName: undefined,
|
4313
|
+
/**
|
4314
|
+
* The `themeName` option allows enabling a theme by that name.
|
4315
|
+
*
|
4316
|
+
* If no `themeName` is provided, the table will use the classic theme (if the correct CSS files are imported).
|
4317
|
+
*
|
4318
|
+
* Read more:
|
4319
|
+
* - [Themes](@/guides/styling/themes/themes.md)
|
4320
|
+
*
|
4321
|
+
* @memberof Options#
|
4322
|
+
* @type {string|boolean|undefined}
|
4323
|
+
* @default undefined
|
4324
|
+
* @category Core
|
4325
|
+
* @since 15.0.0
|
4326
|
+
*
|
4327
|
+
* @example
|
4328
|
+
* ```js
|
4329
|
+
* themeName: 'ht-theme-name',
|
4330
|
+
* ```
|
4331
|
+
*/
|
4332
|
+
themeName: undefined,
|
4313
4333
|
/**
|
4314
4334
|
* The `tabMoves` option configures the action of the <kbd>**Tab**</kbd> key.
|
4315
4335
|
*
|