handsontable 0.0.0-next-7463864-20240723 → 0.0.0-next-86a38ef-20240724
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/calculationType/fullyVisibleColumns.js +126 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +122 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +119 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +115 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +125 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +121 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +118 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +114 -0
- package/3rdparty/walkontable/src/calculator/{renderAllColumns.js → calculationType/renderedAllColumns.js} +32 -9
- package/3rdparty/walkontable/src/calculator/{renderAllColumns.mjs → calculationType/renderedAllColumns.mjs} +31 -8
- package/3rdparty/walkontable/src/calculator/{renderAllRows.js → calculationType/renderedAllRows.js} +32 -9
- package/3rdparty/walkontable/src/calculator/{renderAllRows.mjs → calculationType/renderedAllRows.mjs} +31 -8
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +37 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +33 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +37 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +33 -0
- package/3rdparty/walkontable/src/calculator/index.js +18 -17
- package/3rdparty/walkontable/src/calculator/index.mjs +11 -6
- package/3rdparty/walkontable/src/calculator/viewportBase.js +92 -0
- package/3rdparty/walkontable/src/calculator/viewportBase.mjs +88 -0
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +51 -145
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +51 -145
- package/3rdparty/walkontable/src/calculator/viewportRows.js +59 -141
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +59 -141
- package/3rdparty/walkontable/src/index.js +2 -0
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +5 -11
- package/3rdparty/walkontable/src/table.mjs +5 -11
- package/3rdparty/walkontable/src/utils/column.js +2 -1
- package/3rdparty/walkontable/src/utils/column.mjs +2 -1
- package/3rdparty/walkontable/src/utils/columnStretching.js +10 -19
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +10 -19
- package/3rdparty/walkontable/src/viewport.js +35 -46
- package/3rdparty/walkontable/src/viewport.mjs +36 -47
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2494 -1961
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2495 -1962
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +32 -32
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +1 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/constants.js +0 -26
- package/3rdparty/walkontable/src/calculator/constants.mjs +0 -23
@@ -1,84 +1,61 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
|
-
import "core-js/modules/es.array.at.js";
|
3
2
|
import "core-js/modules/es.array.push.js";
|
4
|
-
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
5
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
6
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
7
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
8
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
import { RENDER_TYPE, FULLY_VISIBLE_TYPE } from "./constants.mjs";
|
6
|
+
import { ViewportBaseCalculator } from "./viewportBase.mjs";
|
7
|
+
export const DEFAULT_HEIGHT = 23;
|
8
|
+
|
13
9
|
/**
|
14
10
|
* @typedef {object} ViewportRowsCalculatorOptions
|
11
|
+
* @property {Map<string, ViewportBaseCalculator>} calculationTypes The calculation types to be performed.
|
15
12
|
* @property {number} viewportHeight Height of the viewport.
|
16
13
|
* @property {number} scrollOffset Current vertical scroll position of the viewport.
|
17
14
|
* @property {number} totalRows Total number of rows.
|
18
15
|
* @property {Function} rowHeightFn Function that returns the height of the row at a given index (in px).
|
19
|
-
* @property {Function} overrideFn Function that
|
20
|
-
* @property {string} calculationType String which describes types of calculation which will be performed.
|
16
|
+
* @property {Function} overrideFn Function that allows to adjust the `startRow` and `endRow` parameters.
|
21
17
|
* @property {number} horizontalScrollbarHeight The scrollbar height.
|
22
18
|
*/
|
23
19
|
/**
|
24
|
-
* Calculates indexes of rows to render OR rows that are visible.
|
25
|
-
* To redo the calculation, you need to create a new calculator.
|
20
|
+
* Calculates indexes of rows to render OR rows that are visible OR partially visible in the viewport.
|
26
21
|
*
|
27
22
|
* @class ViewportRowsCalculator
|
28
23
|
*/
|
29
|
-
|
30
|
-
export class ViewportRowsCalculator {
|
31
|
-
/**
|
32
|
-
* Default row height.
|
33
|
-
*
|
34
|
-
* @type {number}
|
35
|
-
*/
|
36
|
-
static get DEFAULT_HEIGHT() {
|
37
|
-
return 23;
|
38
|
-
}
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Number of rendered/visible rows.
|
42
|
-
*
|
43
|
-
* @type {number}
|
44
|
-
*/
|
45
|
-
|
24
|
+
export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
46
25
|
/**
|
47
26
|
* @param {ViewportRowsCalculatorOptions} options Object with all options specified for row viewport calculation.
|
48
27
|
*/
|
49
|
-
constructor(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
_defineProperty(this, "
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
_defineProperty(this, "
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
_classPrivateFieldInitSpec(this, _options, void 0);
|
81
|
-
_classPrivateFieldSet(_options, this, options);
|
28
|
+
constructor(_ref) {
|
29
|
+
let {
|
30
|
+
calculationTypes,
|
31
|
+
viewportHeight,
|
32
|
+
scrollOffset,
|
33
|
+
totalRows,
|
34
|
+
rowHeightFn,
|
35
|
+
overrideFn,
|
36
|
+
horizontalScrollbarHeight
|
37
|
+
} = _ref;
|
38
|
+
super(calculationTypes);
|
39
|
+
_defineProperty(this, "viewportHeight", 0);
|
40
|
+
_defineProperty(this, "scrollOffset", 0);
|
41
|
+
_defineProperty(this, "zeroBasedScrollOffset", 0);
|
42
|
+
_defineProperty(this, "totalRows", 0);
|
43
|
+
_defineProperty(this, "rowHeightFn", null);
|
44
|
+
_defineProperty(this, "rowHeight", 0);
|
45
|
+
_defineProperty(this, "overrideFn", null);
|
46
|
+
_defineProperty(this, "horizontalScrollbarHeight", 0);
|
47
|
+
_defineProperty(this, "innerViewportHeight", 0);
|
48
|
+
_defineProperty(this, "totalCalculatedHeight", 0);
|
49
|
+
_defineProperty(this, "startPositions", []);
|
50
|
+
_defineProperty(this, "needReverse", true);
|
51
|
+
this.viewportHeight = viewportHeight;
|
52
|
+
this.scrollOffset = scrollOffset;
|
53
|
+
this.zeroBasedScrollOffset = Math.max(scrollOffset, 0);
|
54
|
+
this.totalRows = totalRows;
|
55
|
+
this.rowHeightFn = rowHeightFn;
|
56
|
+
this.overrideFn = overrideFn;
|
57
|
+
this.horizontalScrollbarHeight = horizontalScrollbarHeight !== null && horizontalScrollbarHeight !== void 0 ? horizontalScrollbarHeight : 0;
|
58
|
+
this.innerViewportHeight = this.zeroBasedScrollOffset + this.viewportHeight - this.horizontalScrollbarHeight;
|
82
59
|
this.calculate();
|
83
60
|
}
|
84
61
|
|
@@ -86,90 +63,31 @@ export class ViewportRowsCalculator {
|
|
86
63
|
* Calculates viewport.
|
87
64
|
*/
|
88
65
|
calculate() {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
const zeroBasedScrollOffset = Math.max(_classPrivateFieldGet(_options, this).scrollOffset, 0);
|
98
|
-
const horizontalScrollbarHeight = _classPrivateFieldGet(_options, this).horizontalScrollbarHeight || 0;
|
99
|
-
const innerViewportHeight = zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight;
|
100
|
-
let sum = 0;
|
101
|
-
let needReverse = true;
|
102
|
-
const startPositions = [];
|
103
|
-
let rowHeight;
|
104
|
-
let firstVisibleRowHeight = 0;
|
105
|
-
let lastVisibleRowHeight = 0;
|
106
|
-
|
107
|
-
// Calculate the number (start and end index) of rows needed
|
108
|
-
for (let i = 0; i < totalRows; i++) {
|
109
|
-
rowHeight = rowHeightFn(i);
|
110
|
-
if (isNaN(rowHeight)) {
|
111
|
-
rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
|
112
|
-
}
|
113
|
-
if (sum <= zeroBasedScrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
|
114
|
-
this.startRow = i;
|
115
|
-
firstVisibleRowHeight = rowHeight;
|
116
|
-
}
|
117
|
-
if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= innerViewportHeight) {
|
118
|
-
if (this.startRow === null) {
|
119
|
-
this.startRow = i;
|
120
|
-
firstVisibleRowHeight = rowHeight;
|
121
|
-
}
|
122
|
-
this.endRow = i;
|
123
|
-
}
|
124
|
-
startPositions.push(sum);
|
125
|
-
sum += rowHeight;
|
126
|
-
lastVisibleRowHeight = rowHeight;
|
127
|
-
if (calculationType !== FULLY_VISIBLE_TYPE) {
|
128
|
-
this.endRow = i;
|
129
|
-
}
|
130
|
-
if (sum >= innerViewportHeight) {
|
131
|
-
needReverse = false;
|
66
|
+
this._initialize(this);
|
67
|
+
for (let row = 0; row < this.totalRows; row++) {
|
68
|
+
this.rowHeight = this.getRowHeight(row);
|
69
|
+
this._process(row, this);
|
70
|
+
this.startPositions.push(this.totalCalculatedHeight);
|
71
|
+
this.totalCalculatedHeight += this.rowHeight;
|
72
|
+
if (this.totalCalculatedHeight >= this.innerViewportHeight) {
|
73
|
+
this.needReverse = false;
|
132
74
|
break;
|
133
75
|
}
|
134
76
|
}
|
135
|
-
|
136
|
-
|
137
|
-
const bottomRowOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
|
138
|
-
if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
|
139
|
-
this.isVisibleInTrimmingContainer = false;
|
140
|
-
} else {
|
141
|
-
this.isVisibleInTrimmingContainer = true;
|
142
|
-
}
|
143
|
-
|
144
|
-
// If the estimation has reached the last row and there is still some space available in the viewport,
|
145
|
-
// we need to render in reverse in order to fill the whole viewport with rows
|
146
|
-
if (this.endRow === totalRows - 1 && needReverse) {
|
147
|
-
this.startRow = this.endRow;
|
148
|
-
while (this.startRow > 0) {
|
149
|
-
// rowHeight is the height of the last row
|
150
|
-
const viewportSum = startPositions[this.endRow] + rowHeight - startPositions[this.startRow - 1];
|
151
|
-
if (viewportSum <= viewportHeight - horizontalScrollbarHeight || calculationType !== FULLY_VISIBLE_TYPE) {
|
152
|
-
this.startRow -= 1;
|
153
|
-
}
|
154
|
-
if (viewportSum >= viewportHeight - horizontalScrollbarHeight) {
|
155
|
-
break;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
}
|
159
|
-
if (calculationType === RENDER_TYPE && this.startRow !== null && overrideFn) {
|
160
|
-
overrideFn(this);
|
161
|
-
}
|
162
|
-
this.startPosition = startPositions[this.startRow];
|
163
|
-
if (this.startPosition === undefined) {
|
164
|
-
this.startPosition = null;
|
165
|
-
}
|
77
|
+
this._finalize(this);
|
78
|
+
}
|
166
79
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
80
|
+
/**
|
81
|
+
* Gets the row height at the specified row index.
|
82
|
+
*
|
83
|
+
* @param {number} row Row index.
|
84
|
+
* @returns {number}
|
85
|
+
*/
|
86
|
+
getRowHeight(row) {
|
87
|
+
const rowHeight = this.rowHeightFn(row);
|
88
|
+
if (isNaN(rowHeight)) {
|
89
|
+
return DEFAULT_HEIGHT;
|
173
90
|
}
|
91
|
+
return rowHeight;
|
174
92
|
}
|
175
93
|
}
|
@@ -4,6 +4,8 @@ exports.__esModule = true;
|
|
4
4
|
var _calculator = require("./calculator");
|
5
5
|
exports.ViewportColumnsCalculator = _calculator.ViewportColumnsCalculator;
|
6
6
|
exports.ViewportRowsCalculator = _calculator.ViewportRowsCalculator;
|
7
|
+
exports.DEFAULT_ROW_HEIGHT = _calculator.DEFAULT_ROW_HEIGHT;
|
8
|
+
exports.DEFAULT_COLUMN_WIDTH = _calculator.DEFAULT_COLUMN_WIDTH;
|
7
9
|
var _coords = _interopRequireDefault(require("./cell/coords"));
|
8
10
|
exports.CellCoords = _coords.default;
|
9
11
|
var _range = _interopRequireDefault(require("./cell/range"));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewportColumnsCalculator, ViewportRowsCalculator } from "./calculator/index.mjs";
|
1
|
+
import { ViewportColumnsCalculator, ViewportRowsCalculator, DEFAULT_ROW_HEIGHT, DEFAULT_COLUMN_WIDTH } from "./calculator/index.mjs";
|
2
2
|
import CellCoords from "./cell/coords.mjs";
|
3
3
|
import CellRange from "./cell/range.mjs";
|
4
4
|
import Walkontable from "./facade/core.mjs";
|
@@ -6,4 +6,4 @@ import { Selection, ACTIVE_HEADER_TYPE, AREA_TYPE, FOCUS_TYPE, FILL_TYPE, HEADER
|
|
6
6
|
import * as Renderer from "./renderer/index.mjs";
|
7
7
|
import { OrderView, SharedOrderView } from "./utils/orderView/index.mjs";
|
8
8
|
import { getListenersCounter } from "../../../eventManager.mjs";
|
9
|
-
export { ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, ACTIVE_HEADER_TYPE as HIGHLIGHT_ACTIVE_HEADER_TYPE, AREA_TYPE as HIGHLIGHT_AREA_TYPE, FOCUS_TYPE as HIGHLIGHT_FOCUS_TYPE, FILL_TYPE as HIGHLIGHT_FILL_TYPE, HEADER_TYPE as HIGHLIGHT_HEADER_TYPE, ROW_TYPE as HIGHLIGHT_ROW_TYPE, COLUMN_TYPE as HIGHLIGHT_COLUMN_TYPE, CUSTOM_SELECTION_TYPE as HIGHLIGHT_CUSTOM_SELECTION_TYPE, Renderer, OrderView, SharedOrderView, getListenersCounter };
|
9
|
+
export { DEFAULT_ROW_HEIGHT, DEFAULT_COLUMN_WIDTH, ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, ACTIVE_HEADER_TYPE as HIGHLIGHT_ACTIVE_HEADER_TYPE, AREA_TYPE as HIGHLIGHT_AREA_TYPE, FOCUS_TYPE as HIGHLIGHT_FOCUS_TYPE, FILL_TYPE as HIGHLIGHT_FILL_TYPE, HEADER_TYPE as HIGHLIGHT_HEADER_TYPE, ROW_TYPE as HIGHLIGHT_ROW_TYPE, COLUMN_TYPE as HIGHLIGHT_COLUMN_TYPE, CUSTOM_SELECTION_TYPE as HIGHLIGHT_CUSTOM_SELECTION_TYPE, Renderer, OrderView, SharedOrderView, getListenersCounter };
|
@@ -253,8 +253,9 @@ class Table {
|
|
253
253
|
const columnHeadersCount = columnHeaders.length;
|
254
254
|
let runFastDraw = fastDraw;
|
255
255
|
if (this.isMaster) {
|
256
|
+
wtOverlays.beforeDraw();
|
256
257
|
this.holderOffset = (0, _element.offset)(this.holder);
|
257
|
-
runFastDraw = wtViewport.
|
258
|
+
runFastDraw = wtViewport.createCalculators(runFastDraw);
|
258
259
|
if (rowHeadersCount && !wtSettings.getSetting('fixedColumnsStart')) {
|
259
260
|
const leftScrollPos = wtOverlays.inlineStartOverlay.getScrollPosition();
|
260
261
|
const previousState = this.correctHeaderWidth;
|
@@ -264,16 +265,8 @@ class Table {
|
|
264
265
|
}
|
265
266
|
}
|
266
267
|
}
|
267
|
-
if (this.isMaster) {
|
268
|
-
wtOverlays.beforeDraw();
|
269
|
-
}
|
270
268
|
if (runFastDraw) {
|
271
269
|
if (this.isMaster) {
|
272
|
-
// in case we only scrolled without redraw, update visible rows information in oldRowsCalculator
|
273
|
-
wtViewport.createVisibleCalculators();
|
274
|
-
wtViewport.createPartiallyVisibleCalculators();
|
275
|
-
}
|
276
|
-
if (wtOverlays) {
|
277
270
|
wtOverlays.refresh(true);
|
278
271
|
}
|
279
272
|
} else {
|
@@ -314,8 +307,9 @@ class Table {
|
|
314
307
|
this.markOversizedRows();
|
315
308
|
}
|
316
309
|
if (this.isMaster) {
|
317
|
-
|
318
|
-
|
310
|
+
if (!this.wtSettings.getSetting('externalRowCalculator')) {
|
311
|
+
wtViewport.createVisibleCalculators();
|
312
|
+
}
|
319
313
|
wtOverlays.refresh(false);
|
320
314
|
wtOverlays.applyToDOM();
|
321
315
|
const hiderWidth = (0, _element.outerWidth)(this.hider);
|
@@ -249,8 +249,9 @@ class Table {
|
|
249
249
|
const columnHeadersCount = columnHeaders.length;
|
250
250
|
let runFastDraw = fastDraw;
|
251
251
|
if (this.isMaster) {
|
252
|
+
wtOverlays.beforeDraw();
|
252
253
|
this.holderOffset = offset(this.holder);
|
253
|
-
runFastDraw = wtViewport.
|
254
|
+
runFastDraw = wtViewport.createCalculators(runFastDraw);
|
254
255
|
if (rowHeadersCount && !wtSettings.getSetting('fixedColumnsStart')) {
|
255
256
|
const leftScrollPos = wtOverlays.inlineStartOverlay.getScrollPosition();
|
256
257
|
const previousState = this.correctHeaderWidth;
|
@@ -260,16 +261,8 @@ class Table {
|
|
260
261
|
}
|
261
262
|
}
|
262
263
|
}
|
263
|
-
if (this.isMaster) {
|
264
|
-
wtOverlays.beforeDraw();
|
265
|
-
}
|
266
264
|
if (runFastDraw) {
|
267
265
|
if (this.isMaster) {
|
268
|
-
// in case we only scrolled without redraw, update visible rows information in oldRowsCalculator
|
269
|
-
wtViewport.createVisibleCalculators();
|
270
|
-
wtViewport.createPartiallyVisibleCalculators();
|
271
|
-
}
|
272
|
-
if (wtOverlays) {
|
273
266
|
wtOverlays.refresh(true);
|
274
267
|
}
|
275
268
|
} else {
|
@@ -310,8 +303,9 @@ class Table {
|
|
310
303
|
this.markOversizedRows();
|
311
304
|
}
|
312
305
|
if (this.isMaster) {
|
313
|
-
|
314
|
-
|
306
|
+
if (!this.wtSettings.getSetting('externalRowCalculator')) {
|
307
|
+
wtViewport.createVisibleCalculators();
|
308
|
+
}
|
315
309
|
wtOverlays.refresh(false);
|
316
310
|
wtOverlays.applyToDOM();
|
317
311
|
const hiderWidth = outerWidth(this.hider);
|
@@ -51,7 +51,8 @@ class ColumnUtils {
|
|
51
51
|
* @returns {number}
|
52
52
|
*/
|
53
53
|
getWidth(sourceIndex) {
|
54
|
-
|
54
|
+
const width = this.wtSettings.getSetting('columnWidth', sourceIndex) || this.wtSettings.getSetting('defaultColumnWidth');
|
55
|
+
return width;
|
55
56
|
}
|
56
57
|
|
57
58
|
/**
|
@@ -48,7 +48,8 @@ export default class ColumnUtils {
|
|
48
48
|
* @returns {number}
|
49
49
|
*/
|
50
50
|
getWidth(sourceIndex) {
|
51
|
-
|
51
|
+
const width = this.wtSettings.getSetting('columnWidth', sourceIndex) || this.wtSettings.getSetting('defaultColumnWidth');
|
52
|
+
return width;
|
52
53
|
}
|
53
54
|
|
54
55
|
/**
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
var _calculator = require("../calculator");
|
5
6
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
6
7
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
7
8
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
@@ -10,11 +11,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
10
11
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
11
12
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
12
13
|
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"); }
|
13
|
-
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
14
|
-
var _totalColumns = /*#__PURE__*/new WeakMap();
|
15
|
-
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
16
|
-
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
17
|
-
var _stretchMode = /*#__PURE__*/new WeakMap();
|
18
14
|
/**
|
19
15
|
* @typedef {object} ColumnStretchingOptions
|
20
16
|
* @property {number} totalColumns Total number of columns.
|
@@ -25,20 +21,12 @@ var _stretchMode = /*#__PURE__*/new WeakMap();
|
|
25
21
|
/**
|
26
22
|
* @class ColumnStretching
|
27
23
|
*/
|
24
|
+
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
25
|
+
var _totalColumns = /*#__PURE__*/new WeakMap();
|
26
|
+
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
27
|
+
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
28
|
+
var _stretchMode = /*#__PURE__*/new WeakMap();
|
28
29
|
class ColumnStretching {
|
29
|
-
/**
|
30
|
-
* Default column width.
|
31
|
-
*
|
32
|
-
* @type {number}
|
33
|
-
*/
|
34
|
-
static get DEFAULT_WIDTH() {
|
35
|
-
return 50;
|
36
|
-
}
|
37
|
-
|
38
|
-
/**
|
39
|
-
* @type {number}
|
40
|
-
*/
|
41
|
-
|
42
30
|
/**
|
43
31
|
* @param {ColumnStretchingOptions} options Object with all options specified for column viewport calculation.
|
44
32
|
*/
|
@@ -49,6 +37,9 @@ class ColumnStretching {
|
|
49
37
|
stretchingColumnWidthFn,
|
50
38
|
columnWidthFn
|
51
39
|
} = _ref;
|
40
|
+
/**
|
41
|
+
* @type {number}
|
42
|
+
*/
|
52
43
|
_defineProperty(this, "stretchAllRatio", 0);
|
53
44
|
/**
|
54
45
|
* @type {number}
|
@@ -198,7 +189,7 @@ class ColumnStretching {
|
|
198
189
|
_getColumnWidth(column) {
|
199
190
|
let width = _classPrivateFieldGet(_columnWidthFn, this).call(this, column);
|
200
191
|
if (isNaN(width)) {
|
201
|
-
width =
|
192
|
+
width = _calculator.DEFAULT_COLUMN_WIDTH;
|
202
193
|
}
|
203
194
|
return width;
|
204
195
|
}
|
@@ -7,11 +7,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
7
7
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
8
8
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
9
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
|
-
|
11
|
-
var _totalColumns = /*#__PURE__*/new WeakMap();
|
12
|
-
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
13
|
-
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
14
|
-
var _stretchMode = /*#__PURE__*/new WeakMap();
|
10
|
+
import { DEFAULT_COLUMN_WIDTH } from "../calculator/index.mjs";
|
15
11
|
/**
|
16
12
|
* @typedef {object} ColumnStretchingOptions
|
17
13
|
* @property {number} totalColumns Total number of columns.
|
@@ -22,20 +18,12 @@ var _stretchMode = /*#__PURE__*/new WeakMap();
|
|
22
18
|
/**
|
23
19
|
* @class ColumnStretching
|
24
20
|
*/
|
21
|
+
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
22
|
+
var _totalColumns = /*#__PURE__*/new WeakMap();
|
23
|
+
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
24
|
+
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
25
|
+
var _stretchMode = /*#__PURE__*/new WeakMap();
|
25
26
|
export class ColumnStretching {
|
26
|
-
/**
|
27
|
-
* Default column width.
|
28
|
-
*
|
29
|
-
* @type {number}
|
30
|
-
*/
|
31
|
-
static get DEFAULT_WIDTH() {
|
32
|
-
return 50;
|
33
|
-
}
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @type {number}
|
37
|
-
*/
|
38
|
-
|
39
27
|
/**
|
40
28
|
* @param {ColumnStretchingOptions} options Object with all options specified for column viewport calculation.
|
41
29
|
*/
|
@@ -46,6 +34,9 @@ export class ColumnStretching {
|
|
46
34
|
stretchingColumnWidthFn,
|
47
35
|
columnWidthFn
|
48
36
|
} = _ref;
|
37
|
+
/**
|
38
|
+
* @type {number}
|
39
|
+
*/
|
49
40
|
_defineProperty(this, "stretchAllRatio", 0);
|
50
41
|
/**
|
51
42
|
* @type {number}
|
@@ -195,7 +186,7 @@ export class ColumnStretching {
|
|
195
186
|
_getColumnWidth(column) {
|
196
187
|
let width = _classPrivateFieldGet(_columnWidthFn, this).call(this, column);
|
197
188
|
if (isNaN(width)) {
|
198
|
-
width =
|
189
|
+
width = DEFAULT_COLUMN_WIDTH;
|
199
190
|
}
|
200
191
|
return width;
|
201
192
|
}
|
@@ -31,6 +31,8 @@ class Viewport {
|
|
31
31
|
this.rowHeaderWidth = NaN;
|
32
32
|
this.rowsVisibleCalculator = null;
|
33
33
|
this.columnsVisibleCalculator = null;
|
34
|
+
this.rowsCalculatorTypes = new Map([['rendered', () => this.wtSettings.getSetting('renderAllRows') ? new _calculator.RenderedAllRowsCalculationType() : new _calculator.RenderedRowsCalculationType()], ['fullyVisible', () => new _calculator.FullyVisibleRowsCalculationType()], ['partiallyVisible', () => new _calculator.PartiallyVisibleRowsCalculationType()]]);
|
35
|
+
this.columnsCalculatorTypes = new Map([['rendered', () => this.wtSettings.getSetting('renderAllColumns') ? new _calculator.RenderedAllColumnsCalculationType() : new _calculator.RenderedColumnsCalculationType()], ['fullyVisible', () => new _calculator.FullyVisibleColumnsCalculationType()], ['partiallyVisible', () => new _calculator.PartiallyVisibleColumnsCalculationType()]]);
|
34
36
|
this.eventManager = eventManager;
|
35
37
|
this.eventManager.addEventListener(this.domBindings.rootWindow, 'resize', () => {
|
36
38
|
this.clientHeight = this.getWorkspaceHeight();
|
@@ -241,25 +243,20 @@ class Viewport {
|
|
241
243
|
}
|
242
244
|
|
243
245
|
/**
|
244
|
-
* Creates:
|
245
|
-
*
|
246
|
-
*
|
246
|
+
* Creates rows calculators. The type of the calculations can be chosen from the list:
|
247
|
+
* - 'rendered' Calculates rows that should be rendered within the current table's viewport;
|
248
|
+
* - 'fullyVisible' Calculates rows that are fully visible (used mostly for scrolling purposes);
|
249
|
+
* - 'partiallyVisible' Calculates rows that are partially visible (used mostly for scrolling purposes).
|
247
250
|
*
|
248
|
-
* @param {
|
249
|
-
* calculation calculator is created.
|
251
|
+
* @param {'rendered' | 'fullyVisible' | 'partiallyVisible'} calculatorTypes The list of the calculation types.
|
250
252
|
* @returns {ViewportRowsCalculator}
|
251
253
|
*/
|
252
254
|
createRowsCalculator() {
|
253
|
-
let
|
255
|
+
let calculatorTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['rendered', 'fullyVisible', 'partiallyVisible'];
|
254
256
|
const {
|
255
257
|
wtSettings,
|
256
258
|
wtTable
|
257
259
|
} = this;
|
258
|
-
if (wtSettings.getSetting('renderAllRows') && calculationType === _calculator.RENDER_TYPE) {
|
259
|
-
return new _calculator.RenderAllRowsCalculator({
|
260
|
-
totalRows: wtSettings.getSetting('totalRows')
|
261
|
-
});
|
262
|
-
}
|
263
260
|
let height = this.getViewportHeight();
|
264
261
|
let scrollbarHeight;
|
265
262
|
let fixedRowsHeight;
|
@@ -283,36 +280,31 @@ class Viewport {
|
|
283
280
|
scrollbarHeight = (0, _element.getScrollbarWidth)(this.domBindings.rootDocument);
|
284
281
|
}
|
285
282
|
return new _calculator.ViewportRowsCalculator({
|
283
|
+
calculationTypes: calculatorTypes.map(type => [type, this.rowsCalculatorTypes.get(type)()]),
|
286
284
|
viewportHeight: height,
|
287
285
|
scrollOffset: pos,
|
288
286
|
totalRows: wtSettings.getSetting('totalRows'),
|
289
287
|
rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
|
290
288
|
overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
|
291
|
-
calculationType,
|
292
289
|
horizontalScrollbarHeight: scrollbarHeight
|
293
290
|
});
|
294
291
|
}
|
295
292
|
|
296
293
|
/**
|
297
|
-
* Creates:
|
298
|
-
*
|
299
|
-
*
|
294
|
+
* Creates columns calculators. The type of the calculations can be chosen from the list:
|
295
|
+
* - 'rendered' Calculates columns that should be rendered within the current table's viewport;
|
296
|
+
* - 'fullyVisible' Calculates columns that are fully visible (used mostly for scrolling purposes);
|
297
|
+
* - 'partiallyVisible' Calculates columns that are partially visible (used mostly for scrolling purposes).
|
300
298
|
*
|
301
|
-
* @param {
|
302
|
-
* calculation calculator is created.
|
299
|
+
* @param {'rendered' | 'fullyVisible' | 'partiallyVisible'} calculatorTypes The list of the calculation types.
|
303
300
|
* @returns {ViewportColumnsCalculator}
|
304
301
|
*/
|
305
302
|
createColumnsCalculator() {
|
306
|
-
let
|
303
|
+
let calculatorTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['rendered', 'fullyVisible', 'partiallyVisible'];
|
307
304
|
const {
|
308
305
|
wtSettings,
|
309
306
|
wtTable
|
310
307
|
} = this;
|
311
|
-
if (wtSettings.getSetting('renderAllColumns') && calculationType === _calculator.RENDER_TYPE) {
|
312
|
-
return new _calculator.RenderAllColumnsCalculator({
|
313
|
-
totalColumns: wtSettings.getSetting('totalColumns')
|
314
|
-
});
|
315
|
-
}
|
316
308
|
let width = this.getViewportWidth();
|
317
309
|
let pos = Math.abs(this.dataAccessObject.inlineStartScrollPosition) - this.dataAccessObject.inlineStartParentOffset;
|
318
310
|
this.columnHeaderHeight = NaN;
|
@@ -326,12 +318,12 @@ class Viewport {
|
|
326
318
|
width -= (0, _element.getScrollbarWidth)(this.domBindings.rootDocument);
|
327
319
|
}
|
328
320
|
return new _calculator.ViewportColumnsCalculator({
|
321
|
+
calculationTypes: calculatorTypes.map(type => [type, this.columnsCalculatorTypes.get(type)()]),
|
329
322
|
viewportWidth: width,
|
330
323
|
scrollOffset: pos,
|
331
324
|
totalColumns: wtSettings.getSetting('totalColumns'),
|
332
325
|
columnWidthFn: sourceCol => wtTable.getColumnWidth(sourceCol),
|
333
326
|
overrideFn: wtSettings.getSettingPure('viewportColumnCalculatorOverride'),
|
334
|
-
calculationType,
|
335
327
|
inlineStartOffset: this.dataAccessObject.inlineStartParentOffset
|
336
328
|
});
|
337
329
|
}
|
@@ -344,46 +336,43 @@ class Viewport {
|
|
344
336
|
* If `false` or `undefined`, will perform a full redraw.
|
345
337
|
* @returns {boolean} The fastDraw value, possibly modified.
|
346
338
|
*/
|
347
|
-
|
339
|
+
createCalculators() {
|
348
340
|
let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
349
341
|
const {
|
350
342
|
wtSettings
|
351
343
|
} = this;
|
344
|
+
const rowsCalculator = this.createRowsCalculator();
|
345
|
+
const columnsCalculator = this.createColumnsCalculator();
|
352
346
|
if (fastDraw && !wtSettings.getSetting('renderAllRows')) {
|
353
|
-
const proposedRowsVisibleCalculator =
|
347
|
+
const proposedRowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
|
354
348
|
fastDraw = this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator);
|
355
349
|
}
|
356
350
|
if (fastDraw && !wtSettings.getSetting('renderAllColumns')) {
|
357
|
-
const proposedColumnsVisibleCalculator =
|
351
|
+
const proposedColumnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
|
358
352
|
fastDraw = this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator);
|
359
353
|
}
|
360
354
|
if (!fastDraw) {
|
361
|
-
this.rowsRenderCalculator =
|
362
|
-
this.columnsRenderCalculator =
|
355
|
+
this.rowsRenderCalculator = rowsCalculator.getResultsFor('rendered');
|
356
|
+
this.columnsRenderCalculator = columnsCalculator.getResultsFor('rendered');
|
363
357
|
}
|
364
|
-
|
365
|
-
|
366
|
-
this.
|
367
|
-
this.
|
358
|
+
this.rowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
|
359
|
+
this.columnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
|
360
|
+
this.rowsPartiallyVisibleCalculator = rowsCalculator.getResultsFor('partiallyVisible');
|
361
|
+
this.columnsPartiallyVisibleCalculator = columnsCalculator.getResultsFor('partiallyVisible');
|
368
362
|
return fastDraw;
|
369
363
|
}
|
370
364
|
|
371
365
|
/**
|
372
|
-
* Creates
|
373
|
-
* the actually fully visible rows and columns).
|
366
|
+
* Creates rows and columns calculators (after draw, to determine what are
|
367
|
+
* the actually fully visible and partially visible rows and columns).
|
374
368
|
*/
|
375
369
|
createVisibleCalculators() {
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
* the actually partially visible rows and columns).
|
383
|
-
*/
|
384
|
-
createPartiallyVisibleCalculators() {
|
385
|
-
this.rowsPartiallyVisibleCalculator = this.createRowsCalculator(_calculator.PARTIALLY_VISIBLE_TYPE);
|
386
|
-
this.columnsPartiallyVisibleCalculator = this.createColumnsCalculator(_calculator.PARTIALLY_VISIBLE_TYPE);
|
370
|
+
const rowsCalculator = this.createRowsCalculator(['fullyVisible', 'partiallyVisible']);
|
371
|
+
const columnsCalculator = this.createColumnsCalculator(['fullyVisible', 'partiallyVisible']);
|
372
|
+
this.rowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
|
373
|
+
this.columnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
|
374
|
+
this.rowsPartiallyVisibleCalculator = rowsCalculator.getResultsFor('partiallyVisible');
|
375
|
+
this.columnsPartiallyVisibleCalculator = columnsCalculator.getResultsFor('partiallyVisible');
|
387
376
|
}
|
388
377
|
|
389
378
|
/**
|