handsontable 0.0.0-next-3e0b40d-20241017 → 0.0.0-next-802f59c-20241024
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/viewportRows.js +1 -5
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +2 -5
- package/3rdparty/walkontable/src/core/clone.js +0 -1
- package/3rdparty/walkontable/src/core/clone.mjs +0 -1
- package/3rdparty/walkontable/src/core/core.js +0 -2
- package/3rdparty/walkontable/src/core/core.mjs +0 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
- 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 +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/overlays.js +7 -6
- package/3rdparty/walkontable/src/overlays.mjs +7 -6
- package/3rdparty/walkontable/src/renderer/colGroup.js +1 -1
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/table.js +1 -1
- package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +2 -7
- package/3rdparty/walkontable/src/settings.mjs +2 -7
- package/3rdparty/walkontable/src/table.js +8 -35
- package/3rdparty/walkontable/src/table.mjs +8 -35
- package/3rdparty/walkontable/src/utils/column.js +1 -43
- package/3rdparty/walkontable/src/utils/column.mjs +1 -43
- package/3rdparty/walkontable/src/viewport.js +66 -88
- package/3rdparty/walkontable/src/viewport.mjs +67 -89
- package/CHANGELOG.md +5 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/hooks/constants.js +2 -0
- package/core/hooks/constants.mjs +2 -0
- package/core/hooks/index.d.ts +2 -2
- package/core.d.ts +2 -2
- package/core.js +6 -15
- package/core.mjs +6 -15
- package/dataMap/metaManager/metaSchema.js +0 -17
- package/dataMap/metaManager/metaSchema.mjs +0 -17
- package/dist/handsontable.css +5 -236
- package/dist/handsontable.full.css +3 -3
- package/dist/handsontable.full.js +4539 -4231
- package/dist/handsontable.full.min.css +3 -4
- package/dist/handsontable.full.min.js +26 -26
- package/dist/handsontable.js +4230 -3928
- package/dist/handsontable.min.css +4 -9
- package/dist/handsontable.min.js +24 -24
- 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 +0 -2
- package/editors/dateEditor/dateEditor.mjs +0 -2
- package/editors/handsontableEditor/handsontableEditor.js +1 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
- package/editors/passwordEditor/passwordEditor.js +0 -4
- package/editors/passwordEditor/passwordEditor.mjs +1 -5
- package/editors/selectEditor/selectEditor.js +9 -20
- package/editors/selectEditor/selectEditor.mjs +9 -20
- package/editors/textEditor/textEditor.js +11 -7
- package/editors/textEditor/textEditor.mjs +12 -8
- package/helpers/mixed.js +3 -3
- package/helpers/mixed.mjs +3 -3
- package/index.d.ts +7 -0
- package/package.json +8 -10
- package/plugins/comments/commentEditor.js +1 -8
- package/plugins/comments/commentEditor.mjs +1 -8
- package/plugins/comments/comments.js +2 -2
- package/plugins/comments/comments.mjs +2 -2
- package/plugins/contextMenu/menu/menu.js +4 -4
- package/plugins/contextMenu/menu/menu.mjs +4 -4
- package/plugins/index.d.ts +3 -0
- package/plugins/index.js +3 -0
- package/plugins/index.mjs +3 -1
- package/plugins/manualColumnMove/manualColumnMove.js +1 -3
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -3
- package/plugins/manualColumnResize/manualColumnResize.js +24 -12
- package/plugins/manualColumnResize/manualColumnResize.mjs +24 -12
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedRows/ui/headers.js +1 -3
- package/plugins/nestedRows/ui/headers.mjs +1 -3
- package/plugins/stretchColumns/calculator.js +159 -0
- package/plugins/stretchColumns/calculator.mjs +155 -0
- package/plugins/stretchColumns/index.d.ts +1 -0
- package/plugins/stretchColumns/index.js +7 -0
- package/plugins/stretchColumns/index.mjs +1 -0
- package/plugins/stretchColumns/strategies/_base.js +85 -0
- package/plugins/stretchColumns/strategies/_base.mjs +81 -0
- package/plugins/stretchColumns/strategies/all.js +68 -0
- package/plugins/stretchColumns/strategies/all.mjs +64 -0
- package/plugins/stretchColumns/strategies/last.js +77 -0
- package/plugins/stretchColumns/strategies/last.mjs +73 -0
- package/plugins/stretchColumns/stretchColumns.d.ts +11 -0
- package/plugins/stretchColumns/stretchColumns.js +211 -0
- package/plugins/stretchColumns/stretchColumns.mjs +207 -0
- package/tableView.js +39 -39
- package/tableView.mjs +39 -39
- package/utils/autoResize.js +1 -4
- package/utils/autoResize.mjs +1 -4
- package/utils/ghostTable.js +1 -1
- package/utils/ghostTable.mjs +1 -1
- package/3rdparty/walkontable/src/utils/columnStretching.js +0 -197
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +0 -193
- package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -185
- package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -181
- package/helpers/themes.js +0 -17
- package/helpers/themes.mjs +0 -13
- package/styles/handsontable.css +0 -1920
- package/styles/handsontable.min.css +0 -30
- package/styles/ht-theme-gemini.css +0 -690
- package/styles/ht-theme-gemini.min.css +0 -30
- package/styles/ht-theme-main.css +0 -712
- package/styles/ht-theme-main.min.css +0 -30
package/plugins/index.d.ts
CHANGED
@@ -29,6 +29,7 @@ import { NestedHeaders } from './nestedHeaders';
|
|
29
29
|
import { NestedRows } from './nestedRows';
|
30
30
|
import { PersistentState } from './persistentState';
|
31
31
|
import { Search } from './search';
|
32
|
+
import { StretchColumns } from './stretchColumns';
|
32
33
|
import { TouchScroll } from './touchScroll';
|
33
34
|
import { TrimRows } from './trimRows';
|
34
35
|
import { UndoRedo } from './undoRedo';
|
@@ -65,6 +66,7 @@ export interface Plugins {
|
|
65
66
|
nestedRows: NestedRows;
|
66
67
|
persistentState: PersistentState;
|
67
68
|
search: Search;
|
69
|
+
stretchColumns: StretchColumns;
|
68
70
|
touchScroll: TouchScroll;
|
69
71
|
trimRows: TrimRows;
|
70
72
|
undoRedo: UndoRedo;
|
@@ -105,6 +107,7 @@ export {
|
|
105
107
|
NestedRows,
|
106
108
|
PersistentState,
|
107
109
|
Search,
|
110
|
+
StretchColumns,
|
108
111
|
TouchScroll,
|
109
112
|
TrimRows,
|
110
113
|
UndoRedo
|
package/plugins/index.js
CHANGED
@@ -64,6 +64,8 @@ var _persistentState = require("./persistentState");
|
|
64
64
|
exports.PersistentState = _persistentState.PersistentState;
|
65
65
|
var _search = require("./search");
|
66
66
|
exports.Search = _search.Search;
|
67
|
+
var _stretchColumns = require("./stretchColumns");
|
68
|
+
exports.StretchColumns = _stretchColumns.StretchColumns;
|
67
69
|
var _touchScroll = require("./touchScroll");
|
68
70
|
exports.TouchScroll = _touchScroll.TouchScroll;
|
69
71
|
var _trimRows = require("./trimRows");
|
@@ -108,6 +110,7 @@ function registerAllPlugins() {
|
|
108
110
|
(0, _registry.registerPlugin)(_nestedRows.NestedRows);
|
109
111
|
(0, _registry.registerPlugin)(_persistentState.PersistentState);
|
110
112
|
(0, _registry.registerPlugin)(_search.Search);
|
113
|
+
(0, _registry.registerPlugin)(_stretchColumns.StretchColumns);
|
111
114
|
(0, _registry.registerPlugin)(_touchScroll.TouchScroll);
|
112
115
|
(0, _registry.registerPlugin)(_trimRows.TrimRows);
|
113
116
|
(0, _registry.registerPlugin)(_undoRedo.UndoRedo);
|
package/plugins/index.mjs
CHANGED
@@ -29,6 +29,7 @@ import { NestedHeaders } from "./nestedHeaders/index.mjs";
|
|
29
29
|
import { NestedRows } from "./nestedRows/index.mjs";
|
30
30
|
import { PersistentState } from "./persistentState/index.mjs";
|
31
31
|
import { Search } from "./search/index.mjs";
|
32
|
+
import { StretchColumns } from "./stretchColumns/index.mjs";
|
32
33
|
import { TouchScroll } from "./touchScroll/index.mjs";
|
33
34
|
import { TrimRows } from "./trimRows/index.mjs";
|
34
35
|
import { UndoRedo } from "./undoRedo/index.mjs";
|
@@ -67,9 +68,10 @@ export function registerAllPlugins() {
|
|
67
68
|
registerPlugin(NestedRows);
|
68
69
|
registerPlugin(PersistentState);
|
69
70
|
registerPlugin(Search);
|
71
|
+
registerPlugin(StretchColumns);
|
70
72
|
registerPlugin(TouchScroll);
|
71
73
|
registerPlugin(TrimRows);
|
72
74
|
registerPlugin(UndoRedo);
|
73
75
|
}
|
74
|
-
export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, PersistentState, Search, TouchScroll, TrimRows, UndoRedo };
|
76
|
+
export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, PersistentState, Search, StretchColumns, TouchScroll, TrimRows, UndoRedo };
|
75
77
|
export { getPlugin, getPluginsNames, registerPlugin } from "./registry.mjs";
|
@@ -339,13 +339,11 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
339
339
|
const columnMapper = this.hot.columnIndexMapper;
|
340
340
|
let columnsWidth = 0;
|
341
341
|
for (let visualColumnIndex = fromColumn; visualColumnIndex <= toColumn; visualColumnIndex += 1) {
|
342
|
-
// We can't use just `getColWidth` (even without indexes translation) as it doesn't return proper values
|
343
|
-
// when column is stretched.
|
344
342
|
const renderableIndex = columnMapper.getRenderableFromVisualIndex(visualColumnIndex);
|
345
343
|
if (visualColumnIndex < 0) {
|
346
344
|
columnsWidth += this.hot.view._wt.wtViewport.getRowHeaderWidth() || 0;
|
347
345
|
} else if (renderableIndex !== null) {
|
348
|
-
columnsWidth += this.hot.view._wt.wtTable.
|
346
|
+
columnsWidth += this.hot.view._wt.wtTable.getColumnWidth(renderableIndex) || 0;
|
349
347
|
}
|
350
348
|
}
|
351
349
|
return columnsWidth;
|
@@ -335,13 +335,11 @@ export class ManualColumnMove extends BasePlugin {
|
|
335
335
|
const columnMapper = this.hot.columnIndexMapper;
|
336
336
|
let columnsWidth = 0;
|
337
337
|
for (let visualColumnIndex = fromColumn; visualColumnIndex <= toColumn; visualColumnIndex += 1) {
|
338
|
-
// We can't use just `getColWidth` (even without indexes translation) as it doesn't return proper values
|
339
|
-
// when column is stretched.
|
340
338
|
const renderableIndex = columnMapper.getRenderableFromVisualIndex(visualColumnIndex);
|
341
339
|
if (visualColumnIndex < 0) {
|
342
340
|
columnsWidth += this.hot.view._wt.wtViewport.getRowHeaderWidth() || 0;
|
343
341
|
} else if (renderableIndex !== null) {
|
344
|
-
columnsWidth += this.hot.view._wt.wtTable.
|
342
|
+
columnsWidth += this.hot.view._wt.wtTable.getColumnWidth(renderableIndex) || 0;
|
345
343
|
}
|
346
344
|
}
|
347
345
|
return columnsWidth;
|
@@ -162,15 +162,31 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
162
162
|
* Enables the plugin functionality for this Handsontable instance.
|
163
163
|
*/
|
164
164
|
enablePlugin() {
|
165
|
+
var _this = this;
|
165
166
|
if (this.enabled) {
|
166
167
|
return;
|
167
168
|
}
|
168
169
|
_classPrivateFieldSet(_columnWidthsMap, this, new _translations.PhysicalIndexToValueMap());
|
169
170
|
_classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
|
170
171
|
this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
|
171
|
-
this.addHook('modifyColWidth',
|
172
|
-
|
173
|
-
|
172
|
+
this.addHook('modifyColWidth', function () {
|
173
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
174
|
+
args[_key] = arguments[_key];
|
175
|
+
}
|
176
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onModifyColWidth).call(_this, ...args);
|
177
|
+
}, 1);
|
178
|
+
this.addHook('beforeStretchingColumnWidth', function () {
|
179
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
180
|
+
args[_key2] = arguments[_key2];
|
181
|
+
}
|
182
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeStretchingColumnWidth).call(_this, ...args);
|
183
|
+
}, 1);
|
184
|
+
this.addHook('beforeColumnResize', function () {
|
185
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
186
|
+
args[_key3] = arguments[_key3];
|
187
|
+
}
|
188
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeColumnResize).call(_this, ...args);
|
189
|
+
});
|
174
190
|
this.bindEvents();
|
175
191
|
super.enablePlugin();
|
176
192
|
}
|
@@ -408,11 +424,7 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
408
424
|
if (hookNewSize !== undefined) {
|
409
425
|
_classPrivateFieldSet(_newSize, this, hookNewSize);
|
410
426
|
}
|
411
|
-
|
412
|
-
this.clearManualSize(column);
|
413
|
-
} else {
|
414
|
-
this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
|
415
|
-
}
|
427
|
+
this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
|
416
428
|
this.saveManualColumnWidths();
|
417
429
|
this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, true);
|
418
430
|
if (forceRender) {
|
@@ -630,11 +642,11 @@ function _onModifyColWidth(width, column) {
|
|
630
642
|
* @returns {number}
|
631
643
|
*/
|
632
644
|
function _onBeforeStretchingColumnWidth(stretchedWidth, column) {
|
633
|
-
|
634
|
-
if (width ===
|
635
|
-
width
|
645
|
+
const width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column));
|
646
|
+
if (typeof width === 'number') {
|
647
|
+
return width;
|
636
648
|
}
|
637
|
-
return
|
649
|
+
return stretchedWidth;
|
638
650
|
}
|
639
651
|
/**
|
640
652
|
* `beforeColumnResize` hook callback.
|
@@ -157,15 +157,31 @@ export class ManualColumnResize extends BasePlugin {
|
|
157
157
|
* Enables the plugin functionality for this Handsontable instance.
|
158
158
|
*/
|
159
159
|
enablePlugin() {
|
160
|
+
var _this = this;
|
160
161
|
if (this.enabled) {
|
161
162
|
return;
|
162
163
|
}
|
163
164
|
_classPrivateFieldSet(_columnWidthsMap, this, new IndexToValueMap());
|
164
165
|
_classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
|
165
166
|
this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
|
166
|
-
this.addHook('modifyColWidth',
|
167
|
-
|
168
|
-
|
167
|
+
this.addHook('modifyColWidth', function () {
|
168
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
169
|
+
args[_key] = arguments[_key];
|
170
|
+
}
|
171
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onModifyColWidth).call(_this, ...args);
|
172
|
+
}, 1);
|
173
|
+
this.addHook('beforeStretchingColumnWidth', function () {
|
174
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
175
|
+
args[_key2] = arguments[_key2];
|
176
|
+
}
|
177
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeStretchingColumnWidth).call(_this, ...args);
|
178
|
+
}, 1);
|
179
|
+
this.addHook('beforeColumnResize', function () {
|
180
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
181
|
+
args[_key3] = arguments[_key3];
|
182
|
+
}
|
183
|
+
return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeColumnResize).call(_this, ...args);
|
184
|
+
});
|
169
185
|
this.bindEvents();
|
170
186
|
super.enablePlugin();
|
171
187
|
}
|
@@ -403,11 +419,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
403
419
|
if (hookNewSize !== undefined) {
|
404
420
|
_classPrivateFieldSet(_newSize, this, hookNewSize);
|
405
421
|
}
|
406
|
-
|
407
|
-
this.clearManualSize(column);
|
408
|
-
} else {
|
409
|
-
this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
|
410
|
-
}
|
422
|
+
this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
|
411
423
|
this.saveManualColumnWidths();
|
412
424
|
this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, true);
|
413
425
|
if (forceRender) {
|
@@ -624,11 +636,11 @@ function _onModifyColWidth(width, column) {
|
|
624
636
|
* @returns {number}
|
625
637
|
*/
|
626
638
|
function _onBeforeStretchingColumnWidth(stretchedWidth, column) {
|
627
|
-
|
628
|
-
if (width ===
|
629
|
-
width
|
639
|
+
const width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column));
|
640
|
+
if (typeof width === 'number') {
|
641
|
+
return width;
|
630
642
|
}
|
631
|
-
return
|
643
|
+
return stretchedWidth;
|
632
644
|
}
|
633
645
|
/**
|
634
646
|
* `beforeColumnResize` hook callback.
|
@@ -317,7 +317,7 @@ class ManualRowMove extends _base.BasePlugin {
|
|
317
317
|
for (let visualRowIndex = fromRow; visualRowIndex <= toRow; visualRowIndex++) {
|
318
318
|
const renderableIndex = rowMapper.getRenderableFromVisualIndex(visualRowIndex);
|
319
319
|
if (renderableIndex !== null) {
|
320
|
-
rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) ||
|
320
|
+
rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || 23;
|
321
321
|
}
|
322
322
|
}
|
323
323
|
return rowsHeight;
|
@@ -313,7 +313,7 @@ export class ManualRowMove extends BasePlugin {
|
|
313
313
|
for (let visualRowIndex = fromRow; visualRowIndex <= toRow; visualRowIndex++) {
|
314
314
|
const renderableIndex = rowMapper.getRenderableFromVisualIndex(visualRowIndex);
|
315
315
|
if (renderableIndex !== null) {
|
316
|
-
rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) ||
|
316
|
+
rowsHeight += this.hot.view._wt.wtTable.getRowHeight(renderableIndex) || 23;
|
317
317
|
}
|
318
318
|
}
|
319
319
|
return rowsHeight;
|
@@ -1491,7 +1491,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1491
1491
|
* @returns {number}
|
1492
1492
|
*/
|
1493
1493
|
function _sumCellsHeights(row, rowspan) {
|
1494
|
-
const defaultHeight = this.hot.view.
|
1494
|
+
const defaultHeight = this.hot.view._wt.wtSettings.getSettingPure('defaultRowHeight');
|
1495
1495
|
const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
|
1496
1496
|
let height = 0;
|
1497
1497
|
for (let i = row; i < row + rowspan; i++) {
|
@@ -1486,7 +1486,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1486
1486
|
* @returns {number}
|
1487
1487
|
*/
|
1488
1488
|
function _sumCellsHeights(row, rowspan) {
|
1489
|
-
const defaultHeight = this.hot.view.
|
1489
|
+
const defaultHeight = this.hot.view._wt.wtSettings.getSettingPure('defaultRowHeight');
|
1490
1490
|
const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
|
1491
1491
|
let height = 0;
|
1492
1492
|
for (let i = row; i < row + rowspan; i++) {
|
@@ -125,9 +125,7 @@ class HeadersUI extends _base.default {
|
|
125
125
|
if (!deepestLevelIndex) {
|
126
126
|
deepestLevelIndex = this.dataManager.cache.levelCount;
|
127
127
|
}
|
128
|
-
|
129
|
-
const completeVerticalPadding = this.hot.view.isUsingClassicTheme() ? 11 : verticalPadding * 2;
|
130
|
-
this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 10 * deepestLevelIndex + 25);
|
128
|
+
this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
|
131
129
|
this.hot.render();
|
132
130
|
}
|
133
131
|
}
|
@@ -121,9 +121,7 @@ class HeadersUI extends BaseUI {
|
|
121
121
|
if (!deepestLevelIndex) {
|
122
122
|
deepestLevelIndex = this.dataManager.cache.levelCount;
|
123
123
|
}
|
124
|
-
|
125
|
-
const completeVerticalPadding = this.hot.view.isUsingClassicTheme() ? 11 : verticalPadding * 2;
|
126
|
-
this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 10 * deepestLevelIndex + 25);
|
124
|
+
this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
|
127
125
|
this.hot.render();
|
128
126
|
}
|
129
127
|
}
|
@@ -0,0 +1,159 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
5
|
+
var _src = require("../../3rdparty/walkontable/src");
|
6
|
+
var _element = require("../../helpers/dom/element");
|
7
|
+
var _all = require("./strategies/all");
|
8
|
+
var _last = require("./strategies/last");
|
9
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
10
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
11
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
12
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
13
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
14
|
+
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"); }
|
15
|
+
const STRETCH_WIDTH_MAP_NAME = 'stretchColumns';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The class responsible for calculating the column widths based on the specified column stretching strategy.
|
19
|
+
*
|
20
|
+
* @private
|
21
|
+
* @class StretchCalculator
|
22
|
+
*/
|
23
|
+
var _hot = /*#__PURE__*/new WeakMap();
|
24
|
+
var _widthsMap = /*#__PURE__*/new WeakMap();
|
25
|
+
var _stretchStrategies = /*#__PURE__*/new WeakMap();
|
26
|
+
var _activeStrategy = /*#__PURE__*/new WeakMap();
|
27
|
+
var _StretchCalculator_brand = /*#__PURE__*/new WeakSet();
|
28
|
+
class StretchCalculator {
|
29
|
+
constructor(hotInstance) {
|
30
|
+
/**
|
31
|
+
* Checks if the vertical scrollbar will appear. Based on the current data and viewport size
|
32
|
+
* the method calculates if the vertical scrollbar will appear after the table is rendered.
|
33
|
+
* The method is a workaround for the issue in the Walkontable that returns unstable viewport
|
34
|
+
* size.
|
35
|
+
*
|
36
|
+
* @returns {boolean}
|
37
|
+
*/
|
38
|
+
_classPrivateMethodInitSpec(this, _StretchCalculator_brand);
|
39
|
+
/**
|
40
|
+
* The Handsontable instance.
|
41
|
+
*
|
42
|
+
* @type {Core}
|
43
|
+
*/
|
44
|
+
_classPrivateFieldInitSpec(this, _hot, void 0);
|
45
|
+
/**
|
46
|
+
* The map that stores the calculated column widths.
|
47
|
+
*
|
48
|
+
* @type {IndexToValueMap}
|
49
|
+
*/
|
50
|
+
_classPrivateFieldInitSpec(this, _widthsMap, void 0);
|
51
|
+
/**
|
52
|
+
* The map that stores the available stretch strategies.
|
53
|
+
*
|
54
|
+
* @type {Map<string, StretchAllStrategy | StretchLastStrategy>}
|
55
|
+
*/
|
56
|
+
_classPrivateFieldInitSpec(this, _stretchStrategies, new Map([['all', new _all.StretchAllStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))], ['last', new _last.StretchLastStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))]]));
|
57
|
+
/**
|
58
|
+
* The active stretch mode.
|
59
|
+
*
|
60
|
+
* @type {'all' | 'last' | 'none'}
|
61
|
+
*/
|
62
|
+
_classPrivateFieldInitSpec(this, _activeStrategy, 'none');
|
63
|
+
_classPrivateFieldSet(_hot, this, hotInstance);
|
64
|
+
_classPrivateFieldSet(_widthsMap, this, _classPrivateFieldGet(_hot, this).columnIndexMapper.createAndRegisterIndexMap(STRETCH_WIDTH_MAP_NAME, 'physicalIndexToValue'));
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Sets the active stretch strategy.
|
69
|
+
*
|
70
|
+
* @param {'all' | 'last' | 'none'} strategyName The stretch strategy to use.
|
71
|
+
*/
|
72
|
+
useStrategy(strategyName) {
|
73
|
+
_classPrivateFieldSet(_activeStrategy, this, _classPrivateFieldGet(_stretchStrategies, this).has(strategyName) ? strategyName : 'none');
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Recalculates the column widths.
|
78
|
+
*/
|
79
|
+
refreshStretching() {
|
80
|
+
if (_classPrivateFieldGet(_activeStrategy, this) === 'none') {
|
81
|
+
_classPrivateFieldGet(_widthsMap, this).clear();
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
_classPrivateFieldGet(_hot, this).batchExecution(() => {
|
85
|
+
_classPrivateFieldGet(_widthsMap, this).clear();
|
86
|
+
const stretchStrategy = _classPrivateFieldGet(_stretchStrategies, this).get(_classPrivateFieldGet(_activeStrategy, this));
|
87
|
+
const view = _classPrivateFieldGet(_hot, this).view;
|
88
|
+
let viewportWidth = view.getViewportWidth();
|
89
|
+
if (_assertClassBrand(_StretchCalculator_brand, this, _willVerticalScrollAppear).call(this)) {
|
90
|
+
viewportWidth -= (0, _element.getScrollbarWidth)(_classPrivateFieldGet(_hot, this).rootDocument);
|
91
|
+
}
|
92
|
+
stretchStrategy.prepare({
|
93
|
+
viewportWidth
|
94
|
+
});
|
95
|
+
for (let columnIndex = 0; columnIndex < _classPrivateFieldGet(_hot, this).countCols(); columnIndex++) {
|
96
|
+
if (!_classPrivateFieldGet(_hot, this).columnIndexMapper.isHidden(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex))) {
|
97
|
+
stretchStrategy.setColumnBaseWidth(columnIndex, _assertClassBrand(_StretchCalculator_brand, this, _getWidthWithoutStretching).call(this, columnIndex));
|
98
|
+
}
|
99
|
+
}
|
100
|
+
stretchStrategy.calculate();
|
101
|
+
stretchStrategy.getWidths().forEach(_ref => {
|
102
|
+
let [columnIndex, width] = _ref;
|
103
|
+
_classPrivateFieldGet(_widthsMap, this).setValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex), width);
|
104
|
+
});
|
105
|
+
}, true);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Gets the calculated column width.
|
110
|
+
*
|
111
|
+
* @param {number} columnVisualIndex Column visual index.
|
112
|
+
* @returns {number | null}
|
113
|
+
*/
|
114
|
+
getStretchedWidth(columnVisualIndex) {
|
115
|
+
return _classPrivateFieldGet(_widthsMap, this).getValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnVisualIndex));
|
116
|
+
}
|
117
|
+
}
|
118
|
+
exports.StretchCalculator = StretchCalculator;
|
119
|
+
function _willVerticalScrollAppear() {
|
120
|
+
const {
|
121
|
+
view
|
122
|
+
} = _classPrivateFieldGet(_hot, this);
|
123
|
+
if (view.isVerticallyScrollableByWindow()) {
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
const viewportHeight = view.getViewportHeight();
|
127
|
+
const totalRows = _classPrivateFieldGet(_hot, this).countRows();
|
128
|
+
let totalHeight = 0;
|
129
|
+
let hasVerticalScroll = false;
|
130
|
+
for (let row = 0; row < totalRows; row++) {
|
131
|
+
var _classPrivateFieldGet2;
|
132
|
+
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _src.DEFAULT_ROW_HEIGHT) + (row === 0 ? 1 : 0);
|
133
|
+
if (totalHeight > viewportHeight) {
|
134
|
+
hasVerticalScroll = true;
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
return hasVerticalScroll;
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* Gets the column width from the Handsontable API without logic related to stretching.
|
142
|
+
*
|
143
|
+
* @param {number} columnVisualIndex Column visual index.
|
144
|
+
* @returns {number}
|
145
|
+
*/
|
146
|
+
function _getWidthWithoutStretching(columnVisualIndex) {
|
147
|
+
var _classPrivateFieldGet3;
|
148
|
+
return (_classPrivateFieldGet3 = _classPrivateFieldGet(_hot, this).getColWidth(columnVisualIndex, 'StretchColumns')) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _src.DEFAULT_COLUMN_WIDTH;
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* Executes the hook that allows to overwrite the column width.
|
152
|
+
*
|
153
|
+
* @param {number} columnWidth The column width.
|
154
|
+
* @param {number} columnVisualIndex Column visual index.
|
155
|
+
* @returns {number}
|
156
|
+
*/
|
157
|
+
function _overwriteColumnWidthFn(columnWidth, columnVisualIndex) {
|
158
|
+
return _classPrivateFieldGet(_hot, this).runHooks('beforeStretchingColumnWidth', columnWidth, columnVisualIndex);
|
159
|
+
}
|
@@ -0,0 +1,155 @@
|
|
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
|
+
import { DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT } from "../../3rdparty/walkontable/src/index.mjs";
|
9
|
+
import { getScrollbarWidth } from "../../helpers/dom/element.mjs";
|
10
|
+
import { StretchAllStrategy } from "./strategies/all.mjs";
|
11
|
+
import { StretchLastStrategy } from "./strategies/last.mjs";
|
12
|
+
const STRETCH_WIDTH_MAP_NAME = 'stretchColumns';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The class responsible for calculating the column widths based on the specified column stretching strategy.
|
16
|
+
*
|
17
|
+
* @private
|
18
|
+
* @class StretchCalculator
|
19
|
+
*/
|
20
|
+
var _hot = /*#__PURE__*/new WeakMap();
|
21
|
+
var _widthsMap = /*#__PURE__*/new WeakMap();
|
22
|
+
var _stretchStrategies = /*#__PURE__*/new WeakMap();
|
23
|
+
var _activeStrategy = /*#__PURE__*/new WeakMap();
|
24
|
+
var _StretchCalculator_brand = /*#__PURE__*/new WeakSet();
|
25
|
+
export class StretchCalculator {
|
26
|
+
constructor(hotInstance) {
|
27
|
+
/**
|
28
|
+
* Checks if the vertical scrollbar will appear. Based on the current data and viewport size
|
29
|
+
* the method calculates if the vertical scrollbar will appear after the table is rendered.
|
30
|
+
* The method is a workaround for the issue in the Walkontable that returns unstable viewport
|
31
|
+
* size.
|
32
|
+
*
|
33
|
+
* @returns {boolean}
|
34
|
+
*/
|
35
|
+
_classPrivateMethodInitSpec(this, _StretchCalculator_brand);
|
36
|
+
/**
|
37
|
+
* The Handsontable instance.
|
38
|
+
*
|
39
|
+
* @type {Core}
|
40
|
+
*/
|
41
|
+
_classPrivateFieldInitSpec(this, _hot, void 0);
|
42
|
+
/**
|
43
|
+
* The map that stores the calculated column widths.
|
44
|
+
*
|
45
|
+
* @type {IndexToValueMap}
|
46
|
+
*/
|
47
|
+
_classPrivateFieldInitSpec(this, _widthsMap, void 0);
|
48
|
+
/**
|
49
|
+
* The map that stores the available stretch strategies.
|
50
|
+
*
|
51
|
+
* @type {Map<string, StretchAllStrategy | StretchLastStrategy>}
|
52
|
+
*/
|
53
|
+
_classPrivateFieldInitSpec(this, _stretchStrategies, new Map([['all', new StretchAllStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))], ['last', new StretchLastStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))]]));
|
54
|
+
/**
|
55
|
+
* The active stretch mode.
|
56
|
+
*
|
57
|
+
* @type {'all' | 'last' | 'none'}
|
58
|
+
*/
|
59
|
+
_classPrivateFieldInitSpec(this, _activeStrategy, 'none');
|
60
|
+
_classPrivateFieldSet(_hot, this, hotInstance);
|
61
|
+
_classPrivateFieldSet(_widthsMap, this, _classPrivateFieldGet(_hot, this).columnIndexMapper.createAndRegisterIndexMap(STRETCH_WIDTH_MAP_NAME, 'physicalIndexToValue'));
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Sets the active stretch strategy.
|
66
|
+
*
|
67
|
+
* @param {'all' | 'last' | 'none'} strategyName The stretch strategy to use.
|
68
|
+
*/
|
69
|
+
useStrategy(strategyName) {
|
70
|
+
_classPrivateFieldSet(_activeStrategy, this, _classPrivateFieldGet(_stretchStrategies, this).has(strategyName) ? strategyName : 'none');
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Recalculates the column widths.
|
75
|
+
*/
|
76
|
+
refreshStretching() {
|
77
|
+
if (_classPrivateFieldGet(_activeStrategy, this) === 'none') {
|
78
|
+
_classPrivateFieldGet(_widthsMap, this).clear();
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
_classPrivateFieldGet(_hot, this).batchExecution(() => {
|
82
|
+
_classPrivateFieldGet(_widthsMap, this).clear();
|
83
|
+
const stretchStrategy = _classPrivateFieldGet(_stretchStrategies, this).get(_classPrivateFieldGet(_activeStrategy, this));
|
84
|
+
const view = _classPrivateFieldGet(_hot, this).view;
|
85
|
+
let viewportWidth = view.getViewportWidth();
|
86
|
+
if (_assertClassBrand(_StretchCalculator_brand, this, _willVerticalScrollAppear).call(this)) {
|
87
|
+
viewportWidth -= getScrollbarWidth(_classPrivateFieldGet(_hot, this).rootDocument);
|
88
|
+
}
|
89
|
+
stretchStrategy.prepare({
|
90
|
+
viewportWidth
|
91
|
+
});
|
92
|
+
for (let columnIndex = 0; columnIndex < _classPrivateFieldGet(_hot, this).countCols(); columnIndex++) {
|
93
|
+
if (!_classPrivateFieldGet(_hot, this).columnIndexMapper.isHidden(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex))) {
|
94
|
+
stretchStrategy.setColumnBaseWidth(columnIndex, _assertClassBrand(_StretchCalculator_brand, this, _getWidthWithoutStretching).call(this, columnIndex));
|
95
|
+
}
|
96
|
+
}
|
97
|
+
stretchStrategy.calculate();
|
98
|
+
stretchStrategy.getWidths().forEach(_ref => {
|
99
|
+
let [columnIndex, width] = _ref;
|
100
|
+
_classPrivateFieldGet(_widthsMap, this).setValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex), width);
|
101
|
+
});
|
102
|
+
}, true);
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Gets the calculated column width.
|
107
|
+
*
|
108
|
+
* @param {number} columnVisualIndex Column visual index.
|
109
|
+
* @returns {number | null}
|
110
|
+
*/
|
111
|
+
getStretchedWidth(columnVisualIndex) {
|
112
|
+
return _classPrivateFieldGet(_widthsMap, this).getValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnVisualIndex));
|
113
|
+
}
|
114
|
+
}
|
115
|
+
function _willVerticalScrollAppear() {
|
116
|
+
const {
|
117
|
+
view
|
118
|
+
} = _classPrivateFieldGet(_hot, this);
|
119
|
+
if (view.isVerticallyScrollableByWindow()) {
|
120
|
+
return false;
|
121
|
+
}
|
122
|
+
const viewportHeight = view.getViewportHeight();
|
123
|
+
const totalRows = _classPrivateFieldGet(_hot, this).countRows();
|
124
|
+
let totalHeight = 0;
|
125
|
+
let hasVerticalScroll = false;
|
126
|
+
for (let row = 0; row < totalRows; row++) {
|
127
|
+
var _classPrivateFieldGet2;
|
128
|
+
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : DEFAULT_ROW_HEIGHT) + (row === 0 ? 1 : 0);
|
129
|
+
if (totalHeight > viewportHeight) {
|
130
|
+
hasVerticalScroll = true;
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return hasVerticalScroll;
|
135
|
+
}
|
136
|
+
/**
|
137
|
+
* Gets the column width from the Handsontable API without logic related to stretching.
|
138
|
+
*
|
139
|
+
* @param {number} columnVisualIndex Column visual index.
|
140
|
+
* @returns {number}
|
141
|
+
*/
|
142
|
+
function _getWidthWithoutStretching(columnVisualIndex) {
|
143
|
+
var _classPrivateFieldGet3;
|
144
|
+
return (_classPrivateFieldGet3 = _classPrivateFieldGet(_hot, this).getColWidth(columnVisualIndex, 'StretchColumns')) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : DEFAULT_COLUMN_WIDTH;
|
145
|
+
}
|
146
|
+
/**
|
147
|
+
* Executes the hook that allows to overwrite the column width.
|
148
|
+
*
|
149
|
+
* @param {number} columnWidth The column width.
|
150
|
+
* @param {number} columnVisualIndex Column visual index.
|
151
|
+
* @returns {number}
|
152
|
+
*/
|
153
|
+
function _overwriteColumnWidthFn(columnWidth, columnVisualIndex) {
|
154
|
+
return _classPrivateFieldGet(_hot, this).runHooks('beforeStretchingColumnWidth', columnWidth, columnVisualIndex);
|
155
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './stretchColumns';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
var _stretchColumns = require("./stretchColumns");
|
5
|
+
exports.PLUGIN_KEY = _stretchColumns.PLUGIN_KEY;
|
6
|
+
exports.PLUGIN_PRIORITY = _stretchColumns.PLUGIN_PRIORITY;
|
7
|
+
exports.StretchColumns = _stretchColumns.StretchColumns;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { PLUGIN_KEY, PLUGIN_PRIORITY, StretchColumns } from "./stretchColumns.mjs";
|