handsontable 0.0.0-next-30767dd-20250207 → 0.0.0-next-8951d31-20250210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +1 -5
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +1 -5
- package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -5
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +1 -5
- package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -8
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -8
- package/3rdparty/walkontable/src/overlay/top.js +1 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -9
- package/3rdparty/walkontable/src/renderer/cells.js +4 -1
- package/3rdparty/walkontable/src/renderer/cells.mjs +4 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +4 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +4 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +3 -0
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +3 -0
- package/3rdparty/walkontable/src/table.js +5 -146
- package/3rdparty/walkontable/src/table.mjs +5 -146
- package/3rdparty/walkontable/src/utils/column.js +4 -25
- package/3rdparty/walkontable/src/utils/column.mjs +4 -25
- package/3rdparty/walkontable/src/utils/row.js +2 -12
- package/3rdparty/walkontable/src/utils/row.mjs +2 -12
- package/3rdparty/walkontable/src/viewport.js +2 -36
- package/3rdparty/walkontable/src/viewport.mjs +2 -36
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +4 -54
- package/core.mjs +4 -54
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +56 -333
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +9 -9
- package/dist/handsontable.js +51 -322
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +15 -15
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/copyPaste/copyPaste.js +6 -12
- package/plugins/copyPaste/copyPaste.mjs +6 -12
- package/renderers/textRenderer/textRenderer.js +8 -3
- package/renderers/textRenderer/textRenderer.mjs +8 -3
- package/styles/handsontable.css +2 -2
- package/styles/handsontable.min.css +2 -2
- package/styles/ht-theme-horizon.css +2 -2
- package/styles/ht-theme-horizon.min.css +2 -2
- package/styles/ht-theme-main.css +2 -2
- package/styles/ht-theme-main.min.css +2 -2
|
@@ -85,11 +85,7 @@ class ViewportColumnsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
|
85
85
|
* @returns {number}
|
|
86
86
|
*/
|
|
87
87
|
getColumnWidth(column) {
|
|
88
|
-
|
|
89
|
-
if (isNaN(width)) {
|
|
90
|
-
return DEFAULT_WIDTH;
|
|
91
|
-
}
|
|
92
|
-
return width;
|
|
88
|
+
return this.columnWidthFn(column);
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
exports.ViewportColumnsCalculator = ViewportColumnsCalculator;
|
|
@@ -82,10 +82,6 @@ export class ViewportColumnsCalculator extends ViewportBaseCalculator {
|
|
|
82
82
|
* @returns {number}
|
|
83
83
|
*/
|
|
84
84
|
getColumnWidth(column) {
|
|
85
|
-
|
|
86
|
-
if (isNaN(width)) {
|
|
87
|
-
return DEFAULT_WIDTH;
|
|
88
|
-
}
|
|
89
|
-
return width;
|
|
85
|
+
return this.columnWidthFn(column);
|
|
90
86
|
}
|
|
91
87
|
}
|
|
@@ -87,11 +87,7 @@ class ViewportRowsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
|
87
87
|
* @returns {number}
|
|
88
88
|
*/
|
|
89
89
|
getRowHeight(row) {
|
|
90
|
-
|
|
91
|
-
if (isNaN(rowHeight)) {
|
|
92
|
-
return this.defaultHeight;
|
|
93
|
-
}
|
|
94
|
-
return rowHeight;
|
|
90
|
+
return this.rowHeightFn(row);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
exports.ViewportRowsCalculator = ViewportRowsCalculator;
|
|
@@ -84,10 +84,6 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
|
|
84
84
|
* @returns {number}
|
|
85
85
|
*/
|
|
86
86
|
getRowHeight(row) {
|
|
87
|
-
|
|
88
|
-
if (isNaN(rowHeight)) {
|
|
89
|
-
return this.defaultHeight;
|
|
90
|
-
}
|
|
91
|
-
return rowHeight;
|
|
87
|
+
return this.rowHeightFn(row);
|
|
92
88
|
}
|
|
93
89
|
}
|
|
@@ -115,14 +115,7 @@ class InlineStartOverlay extends _base.Overlay {
|
|
|
115
115
|
* @returns {number} Width sum.
|
|
116
116
|
*/
|
|
117
117
|
sumCellSizes(from, to) {
|
|
118
|
-
|
|
119
|
-
let column = from;
|
|
120
|
-
let sum = 0;
|
|
121
|
-
while (column < to) {
|
|
122
|
-
sum += this.wot.wtTable.getColumnWidth(column) || defaultColumnWidth;
|
|
123
|
-
column += 1;
|
|
124
|
-
}
|
|
125
|
-
return sum;
|
|
118
|
+
return (to - from) * 80;
|
|
126
119
|
}
|
|
127
120
|
|
|
128
121
|
/**
|
|
@@ -111,14 +111,7 @@ export class InlineStartOverlay extends Overlay {
|
|
|
111
111
|
* @returns {number} Width sum.
|
|
112
112
|
*/
|
|
113
113
|
sumCellSizes(from, to) {
|
|
114
|
-
|
|
115
|
-
let column = from;
|
|
116
|
-
let sum = 0;
|
|
117
|
-
while (column < to) {
|
|
118
|
-
sum += this.wot.wtTable.getColumnWidth(column) || defaultColumnWidth;
|
|
119
|
-
column += 1;
|
|
120
|
-
}
|
|
121
|
-
return sum;
|
|
114
|
+
return (to - from) * 80;
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
/**
|
|
@@ -138,15 +138,7 @@ class TopOverlay extends _base.Overlay {
|
|
|
138
138
|
* @returns {number} Height sum.
|
|
139
139
|
*/
|
|
140
140
|
sumCellSizes(from, to) {
|
|
141
|
-
|
|
142
|
-
let row = from;
|
|
143
|
-
let sum = 0;
|
|
144
|
-
while (row < to) {
|
|
145
|
-
const height = this.wot.wtTable.getRowHeight(row);
|
|
146
|
-
sum += height === undefined ? defaultRowHeight : height;
|
|
147
|
-
row += 1;
|
|
148
|
-
}
|
|
149
|
-
return sum;
|
|
141
|
+
return (to - from) * 29;
|
|
150
142
|
}
|
|
151
143
|
|
|
152
144
|
/**
|
|
@@ -134,15 +134,7 @@ export class TopOverlay extends Overlay {
|
|
|
134
134
|
* @returns {number} Height sum.
|
|
135
135
|
*/
|
|
136
136
|
sumCellSizes(from, to) {
|
|
137
|
-
|
|
138
|
-
let row = from;
|
|
139
|
-
let sum = 0;
|
|
140
|
-
while (row < to) {
|
|
141
|
-
const height = this.wot.wtTable.getRowHeight(row);
|
|
142
|
-
sum += height === undefined ? defaultRowHeight : height;
|
|
143
|
-
row += 1;
|
|
144
|
-
}
|
|
145
|
-
return sum;
|
|
137
|
+
return (to - from) * 29;
|
|
146
138
|
}
|
|
147
139
|
|
|
148
140
|
/**
|
|
@@ -72,11 +72,14 @@ class CellsRenderer extends _base.BaseRenderer {
|
|
|
72
72
|
this.sourceRowIndex = sourceRowIndex;
|
|
73
73
|
const orderView = this.obtainOrderView(TR);
|
|
74
74
|
const rowHeadersView = rowHeaders.obtainOrderView(TR);
|
|
75
|
-
orderView.prependView(rowHeadersView).setSize(columnsToRender).setOffset(0).start();
|
|
75
|
+
orderView.prependView(rowHeadersView).setSize(columnsToRender).setOffset(this.table.renderedColumnToSource(0)).start();
|
|
76
76
|
for (let visibleColumnIndex = 0; visibleColumnIndex < columnsToRender; visibleColumnIndex++) {
|
|
77
77
|
orderView.render();
|
|
78
78
|
const sourceColumnIndex = this.table.renderedColumnToSource(visibleColumnIndex);
|
|
79
79
|
const TD = orderView.getCurrentNode();
|
|
80
|
+
if (TD.innerHTML !== '') {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
80
83
|
if (!(0, _element.hasClass)(TD, 'hide')) {
|
|
81
84
|
// Workaround for hidden columns plugin
|
|
82
85
|
TD.className = '';
|
|
@@ -69,11 +69,14 @@ export class CellsRenderer extends BaseRenderer {
|
|
|
69
69
|
this.sourceRowIndex = sourceRowIndex;
|
|
70
70
|
const orderView = this.obtainOrderView(TR);
|
|
71
71
|
const rowHeadersView = rowHeaders.obtainOrderView(TR);
|
|
72
|
-
orderView.prependView(rowHeadersView).setSize(columnsToRender).setOffset(0).start();
|
|
72
|
+
orderView.prependView(rowHeadersView).setSize(columnsToRender).setOffset(this.table.renderedColumnToSource(0)).start();
|
|
73
73
|
for (let visibleColumnIndex = 0; visibleColumnIndex < columnsToRender; visibleColumnIndex++) {
|
|
74
74
|
orderView.render();
|
|
75
75
|
const sourceColumnIndex = this.table.renderedColumnToSource(visibleColumnIndex);
|
|
76
76
|
const TD = orderView.getCurrentNode();
|
|
77
|
+
if (TD.innerHTML !== '') {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
77
80
|
if (!hasClass(TD, 'hide')) {
|
|
78
81
|
// Workaround for hidden columns plugin
|
|
79
82
|
TD.className = '';
|
|
@@ -18,7 +18,7 @@ var _a11y = require("../../../../helpers/a11y");
|
|
|
18
18
|
*/
|
|
19
19
|
class ColumnHeadersRenderer extends _base.BaseRenderer {
|
|
20
20
|
constructor(rootNode) {
|
|
21
|
-
super(
|
|
21
|
+
super('TR', rootNode); // NodePool is not implemented for this renderer yet
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -86,6 +86,9 @@ class ColumnHeadersRenderer extends _base.BaseRenderer {
|
|
|
86
86
|
// eslint-disable-line max-len
|
|
87
87
|
const sourceColumnIndex = this.table.renderedColumnToSource(renderedColumnIndex);
|
|
88
88
|
const TH = TR.childNodes[renderedColumnIndex + rowHeadersCount];
|
|
89
|
+
if (TH.innerHTML !== '') {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
89
92
|
TH.className = '';
|
|
90
93
|
TH.removeAttribute('style');
|
|
91
94
|
|
|
@@ -15,7 +15,7 @@ import { A11Y_COLINDEX, A11Y_COLUMNHEADER, A11Y_ROW, A11Y_ROWGROUP, A11Y_ROWINDE
|
|
|
15
15
|
*/
|
|
16
16
|
export class ColumnHeadersRenderer extends BaseRenderer {
|
|
17
17
|
constructor(rootNode) {
|
|
18
|
-
super(
|
|
18
|
+
super('TR', rootNode); // NodePool is not implemented for this renderer yet
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -83,6 +83,9 @@ export class ColumnHeadersRenderer extends BaseRenderer {
|
|
|
83
83
|
// eslint-disable-line max-len
|
|
84
84
|
const sourceColumnIndex = this.table.renderedColumnToSource(renderedColumnIndex);
|
|
85
85
|
const TH = TR.childNodes[renderedColumnIndex + rowHeadersCount];
|
|
86
|
+
if (TH.innerHTML !== '') {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
86
89
|
TH.className = '';
|
|
87
90
|
TH.removeAttribute('style');
|
|
88
91
|
|
|
@@ -77,6 +77,9 @@ class RowHeadersRenderer extends _base.BaseRenderer {
|
|
|
77
77
|
for (let visibleColumnIndex = 0; visibleColumnIndex < rowHeadersCount; visibleColumnIndex++) {
|
|
78
78
|
orderView.render();
|
|
79
79
|
const TH = orderView.getCurrentNode();
|
|
80
|
+
if (TH.innerHTML !== '') {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
80
83
|
TH.className = '';
|
|
81
84
|
TH.removeAttribute('style');
|
|
82
85
|
|
|
@@ -74,6 +74,9 @@ export class RowHeadersRenderer extends BaseRenderer {
|
|
|
74
74
|
for (let visibleColumnIndex = 0; visibleColumnIndex < rowHeadersCount; visibleColumnIndex++) {
|
|
75
75
|
orderView.render();
|
|
76
76
|
const TH = orderView.getCurrentNode();
|
|
77
|
+
if (TH.innerHTML !== '') {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
77
80
|
TH.className = '';
|
|
78
81
|
TH.removeAttribute('style');
|
|
79
82
|
|
|
@@ -300,16 +300,6 @@ class Table {
|
|
|
300
300
|
this.resetOversizedRows();
|
|
301
301
|
this.tableRenderer.setActiveOverlayName(this.name).setViewportSize(this.getRenderedRowsCount(), this.getRenderedColumnsCount()).setFilters(this.rowFilter, this.columnFilter).render();
|
|
302
302
|
if (this.isMaster) {
|
|
303
|
-
this.markOversizedColumnHeaders();
|
|
304
|
-
}
|
|
305
|
-
this.adjustColumnHeaderHeights();
|
|
306
|
-
if (this.isMaster || this.is(_overlay.CLONE_BOTTOM)) {
|
|
307
|
-
this.markOversizedRows();
|
|
308
|
-
}
|
|
309
|
-
if (this.isMaster) {
|
|
310
|
-
if (!this.wtSettings.getSetting('externalRowCalculator')) {
|
|
311
|
-
wtViewport.createVisibleCalculators();
|
|
312
|
-
}
|
|
313
303
|
wtOverlays.refresh(false);
|
|
314
304
|
wtOverlays.applyToDOM();
|
|
315
305
|
this.wtSettings.getSetting('onDraw', true);
|
|
@@ -351,85 +341,18 @@ class Table {
|
|
|
351
341
|
/**
|
|
352
342
|
* @param {number} col The visual column index.
|
|
353
343
|
*/
|
|
354
|
-
markIfOversizedColumnHeader(col) {
|
|
355
|
-
const sourceColIndex = this.columnFilter.renderedToSource(col);
|
|
356
|
-
let level = this.wtSettings.getSetting('columnHeaders').length;
|
|
357
|
-
const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
|
358
|
-
let previousColHeaderHeight;
|
|
359
|
-
let currentHeader;
|
|
360
|
-
let currentHeaderHeight;
|
|
361
|
-
const columnHeaderHeightSetting = this.wtSettings.getSetting('columnHeaderHeight') || [];
|
|
362
|
-
while (level) {
|
|
363
|
-
level -= 1;
|
|
364
|
-
previousColHeaderHeight = this.getColumnHeaderHeight(level);
|
|
365
|
-
currentHeader = this.getColumnHeader(sourceColIndex, level);
|
|
366
|
-
if (!currentHeader) {
|
|
367
|
-
/* eslint-disable no-continue */
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
currentHeaderHeight = (0, _element.innerHeight)(currentHeader);
|
|
371
|
-
if (!previousColHeaderHeight && defaultRowHeight < currentHeaderHeight || previousColHeaderHeight < currentHeaderHeight) {
|
|
372
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = currentHeaderHeight;
|
|
373
|
-
}
|
|
374
|
-
if (Array.isArray(columnHeaderHeightSetting)) {
|
|
375
|
-
if (columnHeaderHeightSetting[level] !== null && columnHeaderHeightSetting[level] !== undefined) {
|
|
376
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level];
|
|
377
|
-
}
|
|
378
|
-
} else if (!isNaN(columnHeaderHeightSetting)) {
|
|
379
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting;
|
|
380
|
-
}
|
|
381
|
-
if (this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] < (columnHeaderHeightSetting[level] || columnHeaderHeightSetting)) {
|
|
382
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level] || columnHeaderHeightSetting; // eslint-disable-line max-len
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
344
|
+
markIfOversizedColumnHeader(col) {}
|
|
386
345
|
|
|
387
346
|
/**
|
|
388
347
|
*
|
|
389
348
|
*/
|
|
390
|
-
adjustColumnHeaderHeights() {
|
|
391
|
-
const {
|
|
392
|
-
wtSettings
|
|
393
|
-
} = this;
|
|
394
|
-
const children = this.THEAD.childNodes;
|
|
395
|
-
const oversizedColumnHeaders = this.dataAccessObject.wtViewport.oversizedColumnHeaders;
|
|
396
|
-
const columnHeaders = wtSettings.getSetting('columnHeaders');
|
|
397
|
-
for (let i = 0, len = columnHeaders.length; i < len; i++) {
|
|
398
|
-
if (oversizedColumnHeaders[i]) {
|
|
399
|
-
if (!children[i] || children[i].childNodes.length === 0) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
children[i].childNodes[0].style.height = `${oversizedColumnHeaders[i]}px`;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
349
|
+
adjustColumnHeaderHeights() {}
|
|
406
350
|
|
|
407
351
|
/**
|
|
408
352
|
* Resets cache of row heights. The cache should be cached for each render cycle in a case
|
|
409
353
|
* when new cell values have content which increases/decreases cell height.
|
|
410
354
|
*/
|
|
411
|
-
resetOversizedRows() {
|
|
412
|
-
const {
|
|
413
|
-
wtSettings
|
|
414
|
-
} = this;
|
|
415
|
-
const {
|
|
416
|
-
wtViewport
|
|
417
|
-
} = this.dataAccessObject;
|
|
418
|
-
if (!this.isMaster && !this.is(_overlay.CLONE_BOTTOM)) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (!wtSettings.getSetting('externalRowCalculator')) {
|
|
422
|
-
const rowsToRender = this.getRenderedRowsCount();
|
|
423
|
-
|
|
424
|
-
// Reset the oversized row cache for rendered rows
|
|
425
|
-
for (let visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
|
|
426
|
-
const sourceRow = this.rowFilter.renderedToSource(visibleRowIndex);
|
|
427
|
-
if (wtViewport.oversizedRows && wtViewport.oversizedRows[sourceRow]) {
|
|
428
|
-
wtViewport.oversizedRows[sourceRow] = undefined;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
355
|
+
resetOversizedRows() {}
|
|
433
356
|
|
|
434
357
|
/**
|
|
435
358
|
* Get cell element at coords.
|
|
@@ -627,46 +550,7 @@ class Table {
|
|
|
627
550
|
/**
|
|
628
551
|
* Check if any of the rendered rows is higher than expected, and if so, cache them.
|
|
629
552
|
*/
|
|
630
|
-
markOversizedRows() {
|
|
631
|
-
if (this.wtSettings.getSetting('externalRowCalculator')) {
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
let rowCount = this.TBODY.childNodes.length;
|
|
635
|
-
const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
|
636
|
-
const actualTableHeight = (0, _element.innerHeight)(this.TBODY) - 1;
|
|
637
|
-
const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
|
|
638
|
-
const rowHeightFn = borderBoxSizing ? _element.outerHeight : _element.innerHeight;
|
|
639
|
-
const borderCompensation = borderBoxSizing ? 0 : 1;
|
|
640
|
-
const firstRowBorderCompensation = borderBoxSizing ? 1 : 0;
|
|
641
|
-
let previousRowHeight;
|
|
642
|
-
let rowCurrentHeight;
|
|
643
|
-
let sourceRowIndex;
|
|
644
|
-
let currentTr;
|
|
645
|
-
let rowHeader;
|
|
646
|
-
if (expectedTableHeight === actualTableHeight && !this.wtSettings.getSetting('fixedRowsBottom')) {
|
|
647
|
-
// If the actual table height equals rowCount * default single row height, no row is oversized -> no need to iterate over them
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
while (rowCount) {
|
|
651
|
-
rowCount -= 1;
|
|
652
|
-
sourceRowIndex = this.rowFilter.renderedToSource(rowCount);
|
|
653
|
-
previousRowHeight = this.getRowHeight(sourceRowIndex);
|
|
654
|
-
currentTr = this.getTrForRow(sourceRowIndex);
|
|
655
|
-
rowHeader = currentTr.querySelector('th');
|
|
656
|
-
const topBorderCompensation = sourceRowIndex === 0 ? firstRowBorderCompensation : 0;
|
|
657
|
-
if (rowHeader) {
|
|
658
|
-
rowCurrentHeight = rowHeightFn(rowHeader);
|
|
659
|
-
} else {
|
|
660
|
-
rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
|
|
661
|
-
}
|
|
662
|
-
if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight - topBorderCompensation || previousRowHeight < rowCurrentHeight) {
|
|
663
|
-
if (!borderBoxSizing) {
|
|
664
|
-
rowCurrentHeight += 1;
|
|
665
|
-
}
|
|
666
|
-
this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
553
|
+
markOversizedRows() {}
|
|
670
554
|
|
|
671
555
|
/**
|
|
672
556
|
* @param {number} row The visual row index.
|
|
@@ -981,32 +865,7 @@ class Table {
|
|
|
981
865
|
* @returns {number}
|
|
982
866
|
*/
|
|
983
867
|
_modifyRowHeaderWidth(rowHeaderWidthFactory) {
|
|
984
|
-
|
|
985
|
-
if (Array.isArray(widths)) {
|
|
986
|
-
widths = [...widths];
|
|
987
|
-
widths[widths.length - 1] = this._correctRowHeaderWidth(widths[widths.length - 1]);
|
|
988
|
-
} else {
|
|
989
|
-
widths = this._correctRowHeaderWidth(widths);
|
|
990
|
-
}
|
|
991
|
-
return widths;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
/**
|
|
995
|
-
* Correct row header width if necessary.
|
|
996
|
-
*
|
|
997
|
-
* @private
|
|
998
|
-
* @param {number} width The width to process.
|
|
999
|
-
* @returns {number}
|
|
1000
|
-
*/
|
|
1001
|
-
_correctRowHeaderWidth(width) {
|
|
1002
|
-
let rowHeaderWidth = width;
|
|
1003
|
-
if (typeof width !== 'number') {
|
|
1004
|
-
rowHeaderWidth = this.wtSettings.getSetting('defaultColumnWidth');
|
|
1005
|
-
}
|
|
1006
|
-
if (this.correctHeaderWidth) {
|
|
1007
|
-
rowHeaderWidth += 1;
|
|
1008
|
-
}
|
|
1009
|
-
return rowHeaderWidth;
|
|
868
|
+
return 50;
|
|
1010
869
|
}
|
|
1011
870
|
}
|
|
1012
871
|
var _default = exports.default = Table;
|
|
@@ -296,16 +296,6 @@ class Table {
|
|
|
296
296
|
this.resetOversizedRows();
|
|
297
297
|
this.tableRenderer.setActiveOverlayName(this.name).setViewportSize(this.getRenderedRowsCount(), this.getRenderedColumnsCount()).setFilters(this.rowFilter, this.columnFilter).render();
|
|
298
298
|
if (this.isMaster) {
|
|
299
|
-
this.markOversizedColumnHeaders();
|
|
300
|
-
}
|
|
301
|
-
this.adjustColumnHeaderHeights();
|
|
302
|
-
if (this.isMaster || this.is(CLONE_BOTTOM)) {
|
|
303
|
-
this.markOversizedRows();
|
|
304
|
-
}
|
|
305
|
-
if (this.isMaster) {
|
|
306
|
-
if (!this.wtSettings.getSetting('externalRowCalculator')) {
|
|
307
|
-
wtViewport.createVisibleCalculators();
|
|
308
|
-
}
|
|
309
299
|
wtOverlays.refresh(false);
|
|
310
300
|
wtOverlays.applyToDOM();
|
|
311
301
|
this.wtSettings.getSetting('onDraw', true);
|
|
@@ -347,85 +337,18 @@ class Table {
|
|
|
347
337
|
/**
|
|
348
338
|
* @param {number} col The visual column index.
|
|
349
339
|
*/
|
|
350
|
-
markIfOversizedColumnHeader(col) {
|
|
351
|
-
const sourceColIndex = this.columnFilter.renderedToSource(col);
|
|
352
|
-
let level = this.wtSettings.getSetting('columnHeaders').length;
|
|
353
|
-
const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
|
354
|
-
let previousColHeaderHeight;
|
|
355
|
-
let currentHeader;
|
|
356
|
-
let currentHeaderHeight;
|
|
357
|
-
const columnHeaderHeightSetting = this.wtSettings.getSetting('columnHeaderHeight') || [];
|
|
358
|
-
while (level) {
|
|
359
|
-
level -= 1;
|
|
360
|
-
previousColHeaderHeight = this.getColumnHeaderHeight(level);
|
|
361
|
-
currentHeader = this.getColumnHeader(sourceColIndex, level);
|
|
362
|
-
if (!currentHeader) {
|
|
363
|
-
/* eslint-disable no-continue */
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
currentHeaderHeight = innerHeight(currentHeader);
|
|
367
|
-
if (!previousColHeaderHeight && defaultRowHeight < currentHeaderHeight || previousColHeaderHeight < currentHeaderHeight) {
|
|
368
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = currentHeaderHeight;
|
|
369
|
-
}
|
|
370
|
-
if (Array.isArray(columnHeaderHeightSetting)) {
|
|
371
|
-
if (columnHeaderHeightSetting[level] !== null && columnHeaderHeightSetting[level] !== undefined) {
|
|
372
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level];
|
|
373
|
-
}
|
|
374
|
-
} else if (!isNaN(columnHeaderHeightSetting)) {
|
|
375
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting;
|
|
376
|
-
}
|
|
377
|
-
if (this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] < (columnHeaderHeightSetting[level] || columnHeaderHeightSetting)) {
|
|
378
|
-
this.dataAccessObject.wtViewport.oversizedColumnHeaders[level] = columnHeaderHeightSetting[level] || columnHeaderHeightSetting; // eslint-disable-line max-len
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
340
|
+
markIfOversizedColumnHeader(col) {}
|
|
382
341
|
|
|
383
342
|
/**
|
|
384
343
|
*
|
|
385
344
|
*/
|
|
386
|
-
adjustColumnHeaderHeights() {
|
|
387
|
-
const {
|
|
388
|
-
wtSettings
|
|
389
|
-
} = this;
|
|
390
|
-
const children = this.THEAD.childNodes;
|
|
391
|
-
const oversizedColumnHeaders = this.dataAccessObject.wtViewport.oversizedColumnHeaders;
|
|
392
|
-
const columnHeaders = wtSettings.getSetting('columnHeaders');
|
|
393
|
-
for (let i = 0, len = columnHeaders.length; i < len; i++) {
|
|
394
|
-
if (oversizedColumnHeaders[i]) {
|
|
395
|
-
if (!children[i] || children[i].childNodes.length === 0) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
children[i].childNodes[0].style.height = `${oversizedColumnHeaders[i]}px`;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
345
|
+
adjustColumnHeaderHeights() {}
|
|
402
346
|
|
|
403
347
|
/**
|
|
404
348
|
* Resets cache of row heights. The cache should be cached for each render cycle in a case
|
|
405
349
|
* when new cell values have content which increases/decreases cell height.
|
|
406
350
|
*/
|
|
407
|
-
resetOversizedRows() {
|
|
408
|
-
const {
|
|
409
|
-
wtSettings
|
|
410
|
-
} = this;
|
|
411
|
-
const {
|
|
412
|
-
wtViewport
|
|
413
|
-
} = this.dataAccessObject;
|
|
414
|
-
if (!this.isMaster && !this.is(CLONE_BOTTOM)) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
if (!wtSettings.getSetting('externalRowCalculator')) {
|
|
418
|
-
const rowsToRender = this.getRenderedRowsCount();
|
|
419
|
-
|
|
420
|
-
// Reset the oversized row cache for rendered rows
|
|
421
|
-
for (let visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
|
|
422
|
-
const sourceRow = this.rowFilter.renderedToSource(visibleRowIndex);
|
|
423
|
-
if (wtViewport.oversizedRows && wtViewport.oversizedRows[sourceRow]) {
|
|
424
|
-
wtViewport.oversizedRows[sourceRow] = undefined;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
351
|
+
resetOversizedRows() {}
|
|
429
352
|
|
|
430
353
|
/**
|
|
431
354
|
* Get cell element at coords.
|
|
@@ -623,46 +546,7 @@ class Table {
|
|
|
623
546
|
/**
|
|
624
547
|
* Check if any of the rendered rows is higher than expected, and if so, cache them.
|
|
625
548
|
*/
|
|
626
|
-
markOversizedRows() {
|
|
627
|
-
if (this.wtSettings.getSetting('externalRowCalculator')) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
let rowCount = this.TBODY.childNodes.length;
|
|
631
|
-
const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
|
632
|
-
const actualTableHeight = innerHeight(this.TBODY) - 1;
|
|
633
|
-
const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
|
|
634
|
-
const rowHeightFn = borderBoxSizing ? outerHeight : innerHeight;
|
|
635
|
-
const borderCompensation = borderBoxSizing ? 0 : 1;
|
|
636
|
-
const firstRowBorderCompensation = borderBoxSizing ? 1 : 0;
|
|
637
|
-
let previousRowHeight;
|
|
638
|
-
let rowCurrentHeight;
|
|
639
|
-
let sourceRowIndex;
|
|
640
|
-
let currentTr;
|
|
641
|
-
let rowHeader;
|
|
642
|
-
if (expectedTableHeight === actualTableHeight && !this.wtSettings.getSetting('fixedRowsBottom')) {
|
|
643
|
-
// If the actual table height equals rowCount * default single row height, no row is oversized -> no need to iterate over them
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
while (rowCount) {
|
|
647
|
-
rowCount -= 1;
|
|
648
|
-
sourceRowIndex = this.rowFilter.renderedToSource(rowCount);
|
|
649
|
-
previousRowHeight = this.getRowHeight(sourceRowIndex);
|
|
650
|
-
currentTr = this.getTrForRow(sourceRowIndex);
|
|
651
|
-
rowHeader = currentTr.querySelector('th');
|
|
652
|
-
const topBorderCompensation = sourceRowIndex === 0 ? firstRowBorderCompensation : 0;
|
|
653
|
-
if (rowHeader) {
|
|
654
|
-
rowCurrentHeight = rowHeightFn(rowHeader);
|
|
655
|
-
} else {
|
|
656
|
-
rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
|
|
657
|
-
}
|
|
658
|
-
if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight - topBorderCompensation || previousRowHeight < rowCurrentHeight) {
|
|
659
|
-
if (!borderBoxSizing) {
|
|
660
|
-
rowCurrentHeight += 1;
|
|
661
|
-
}
|
|
662
|
-
this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
549
|
+
markOversizedRows() {}
|
|
666
550
|
|
|
667
551
|
/**
|
|
668
552
|
* @param {number} row The visual row index.
|
|
@@ -977,32 +861,7 @@ class Table {
|
|
|
977
861
|
* @returns {number}
|
|
978
862
|
*/
|
|
979
863
|
_modifyRowHeaderWidth(rowHeaderWidthFactory) {
|
|
980
|
-
|
|
981
|
-
if (Array.isArray(widths)) {
|
|
982
|
-
widths = [...widths];
|
|
983
|
-
widths[widths.length - 1] = this._correctRowHeaderWidth(widths[widths.length - 1]);
|
|
984
|
-
} else {
|
|
985
|
-
widths = this._correctRowHeaderWidth(widths);
|
|
986
|
-
}
|
|
987
|
-
return widths;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Correct row header width if necessary.
|
|
992
|
-
*
|
|
993
|
-
* @private
|
|
994
|
-
* @param {number} width The width to process.
|
|
995
|
-
* @returns {number}
|
|
996
|
-
*/
|
|
997
|
-
_correctRowHeaderWidth(width) {
|
|
998
|
-
let rowHeaderWidth = width;
|
|
999
|
-
if (typeof width !== 'number') {
|
|
1000
|
-
rowHeaderWidth = this.wtSettings.getSetting('defaultColumnWidth');
|
|
1001
|
-
}
|
|
1002
|
-
if (this.correctHeaderWidth) {
|
|
1003
|
-
rowHeaderWidth += 1;
|
|
1004
|
-
}
|
|
1005
|
-
return rowHeaderWidth;
|
|
864
|
+
return 50;
|
|
1006
865
|
}
|
|
1007
866
|
}
|
|
1008
867
|
export default Table;
|
|
@@ -39,8 +39,7 @@ class ColumnUtils {
|
|
|
39
39
|
* @returns {number}
|
|
40
40
|
*/
|
|
41
41
|
getWidth(sourceIndex) {
|
|
42
|
-
|
|
43
|
-
return width;
|
|
42
|
+
return this.wtSettings.getSetting('columnWidth', sourceIndex);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -50,12 +49,7 @@ class ColumnUtils {
|
|
|
50
49
|
* @returns {number}
|
|
51
50
|
*/
|
|
52
51
|
getHeaderHeight(level) {
|
|
53
|
-
|
|
54
|
-
const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
|
|
55
|
-
if (oversizedHeight !== undefined) {
|
|
56
|
-
height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
|
|
57
|
-
}
|
|
58
|
-
return height;
|
|
52
|
+
return this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
|
59
53
|
}
|
|
60
54
|
|
|
61
55
|
/**
|
|
@@ -65,27 +59,12 @@ class ColumnUtils {
|
|
|
65
59
|
* @returns {number}
|
|
66
60
|
*/
|
|
67
61
|
getHeaderWidth(sourceIndex) {
|
|
68
|
-
return
|
|
62
|
+
return 50;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
/**
|
|
72
66
|
* Calculates column header widths that can be retrieved from the cache.
|
|
73
67
|
*/
|
|
74
|
-
calculateWidths() {
|
|
75
|
-
const {
|
|
76
|
-
wtSettings
|
|
77
|
-
} = this;
|
|
78
|
-
let rowHeaderWidthSetting = wtSettings.getSetting('rowHeaderWidth');
|
|
79
|
-
rowHeaderWidthSetting = wtSettings.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting);
|
|
80
|
-
if (rowHeaderWidthSetting !== null && rowHeaderWidthSetting !== undefined) {
|
|
81
|
-
const rowHeadersCount = wtSettings.getSetting('rowHeaders').length;
|
|
82
|
-
const defaultColumnWidth = wtSettings.getSetting('defaultColumnWidth');
|
|
83
|
-
for (let visibleColumnIndex = 0; visibleColumnIndex < rowHeadersCount; visibleColumnIndex++) {
|
|
84
|
-
let width = Array.isArray(rowHeaderWidthSetting) ? rowHeaderWidthSetting[visibleColumnIndex] : rowHeaderWidthSetting;
|
|
85
|
-
width = width === null || width === undefined ? defaultColumnWidth : width;
|
|
86
|
-
this.headerWidths.set(visibleColumnIndex, width);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
68
|
+
calculateWidths() {}
|
|
90
69
|
}
|
|
91
70
|
exports.default = ColumnUtils;
|