handsontable 0.0.0-next-eaf150e-20240823 → 0.0.0-next-0306a1a-20240826
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/constants.js +26 -0
- package/3rdparty/walkontable/src/calculator/constants.mjs +23 -0
- package/3rdparty/walkontable/src/calculator/index.js +17 -18
- package/3rdparty/walkontable/src/calculator/index.mjs +6 -11
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.js → renderAllColumns.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.mjs → renderAllColumns.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.mjs → renderAllRows.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +145 -51
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +145 -51
- package/3rdparty/walkontable/src/calculator/viewportRows.js +141 -59
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +141 -59
- package/3rdparty/walkontable/src/index.js +0 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +11 -5
- package/3rdparty/walkontable/src/table.mjs +11 -5
- package/3rdparty/walkontable/src/utils/column.js +1 -2
- package/3rdparty/walkontable/src/utils/column.mjs +1 -2
- package/3rdparty/walkontable/src/utils/columnStretching.js +19 -10
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +19 -10
- package/3rdparty/walkontable/src/viewport.js +46 -35
- package/3rdparty/walkontable/src/viewport.mjs +47 -36
- package/CHANGELOG.md +0 -27
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -1
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +6 -5
- package/dataMap/metaManager/metaSchema.mjs +6 -5
- package/dist/handsontable.css +20 -32
- package/dist/handsontable.full.css +20 -32
- package/dist/handsontable.full.js +2091 -2741
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2092 -2742
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +32 -32
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
- package/helpers/a11y.js +0 -2
- package/helpers/a11y.mjs +0 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +1 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/autoRowSize/autoRowSize.js +2 -1
- package/plugins/autoRowSize/autoRowSize.mjs +2 -1
- package/plugins/columnSorting/columnSorting.js +1 -10
- package/plugins/columnSorting/columnSorting.mjs +1 -10
- package/plugins/contextMenu/menu/menuItemRenderer.js +4 -3
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +6 -5
- package/plugins/contextMenu/menu/positioner.js +12 -4
- package/plugins/contextMenu/menu/positioner.mjs +12 -4
- package/plugins/contextMenu/menu/utils.js +0 -11
- package/plugins/contextMenu/menu/utils.mjs +0 -10
- package/plugins/contextMenu/predefinedItems/alignment.js +49 -67
- package/plugins/contextMenu/predefinedItems/alignment.mjs +50 -68
- package/plugins/contextMenu/predefinedItems/readOnly.js +0 -11
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -11
- package/plugins/contextMenu/utils.js +0 -26
- package/plugins/contextMenu/utils.mjs +0 -24
- package/plugins/copyPaste/copyPaste.js +14 -14
- package/plugins/copyPaste/copyPaste.mjs +14 -14
- package/plugins/dropdownMenu/dropdownMenu.js +4 -10
- package/plugins/dropdownMenu/dropdownMenu.mjs +4 -10
- package/plugins/filters/component/condition.js +1 -6
- package/plugins/filters/component/condition.mjs +1 -6
- package/plugins/filters/component/value.js +1 -6
- package/plugins/filters/component/value.mjs +1 -6
- package/plugins/filters/conditionCollection.d.ts +3 -4
- package/plugins/filters/conditionCollection.js +0 -26
- package/plugins/filters/conditionCollection.mjs +0 -26
- package/plugins/filters/filters.js +1 -2
- package/plugins/filters/filters.mjs +1 -2
- package/plugins/filters/ui/multipleSelect.js +9 -7
- package/plugins/filters/ui/multipleSelect.mjs +9 -7
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +9 -11
- package/plugins/mergeCells/cellsCollection.mjs +10 -12
- package/plugins/undoRedo/undoRedo.js +5 -9
- package/plugins/undoRedo/undoRedo.mjs +5 -9
- package/shortcuts/utils.js +1 -3
- package/shortcuts/utils.mjs +1 -3
- package/utils/ghostTable.js +9 -11
- package/utils/ghostTable.mjs +10 -12
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +0 -126
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +0 -122
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +0 -119
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +0 -115
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +0 -125
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +0 -121
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +0 -118
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +0 -114
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/viewportBase.js +0 -92
- package/3rdparty/walkontable/src/calculator/viewportBase.mjs +0 -88
@@ -1,61 +1,84 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
|
+
import "core-js/modules/es.array.at.js";
|
2
3
|
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"); }
|
3
6
|
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; }
|
4
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
5
8
|
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); }
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
10
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
11
|
+
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"); }
|
12
|
+
import { RENDER_TYPE, FULLY_VISIBLE_TYPE } from "./constants.mjs";
|
9
13
|
/**
|
10
14
|
* @typedef {object} ViewportRowsCalculatorOptions
|
11
|
-
* @property {Map<string, ViewportBaseCalculator>} calculationTypes The calculation types to be performed.
|
12
15
|
* @property {number} viewportHeight Height of the viewport.
|
13
16
|
* @property {number} scrollOffset Current vertical scroll position of the viewport.
|
14
17
|
* @property {number} totalRows Total number of rows.
|
15
18
|
* @property {Function} rowHeightFn Function that returns the height of the row at a given index (in px).
|
16
|
-
* @property {Function} overrideFn Function that
|
19
|
+
* @property {Function} overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin).
|
20
|
+
* @property {string} calculationType String which describes types of calculation which will be performed.
|
17
21
|
* @property {number} horizontalScrollbarHeight The scrollbar height.
|
18
22
|
*/
|
19
23
|
/**
|
20
|
-
* Calculates indexes of rows to render OR rows that are visible
|
24
|
+
* Calculates indexes of rows to render OR rows that are visible.
|
25
|
+
* To redo the calculation, you need to create a new calculator.
|
21
26
|
*
|
22
27
|
* @class ViewportRowsCalculator
|
23
28
|
*/
|
24
|
-
|
29
|
+
var _options = /*#__PURE__*/new WeakMap();
|
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
|
+
|
25
46
|
/**
|
26
47
|
* @param {ViewportRowsCalculatorOptions} options Object with all options specified for row viewport calculation.
|
27
48
|
*/
|
28
|
-
constructor(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
_defineProperty(this, "
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
_defineProperty(this, "
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
this
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
constructor(options) {
|
50
|
+
_defineProperty(this, "count", 0);
|
51
|
+
/**
|
52
|
+
* Index of the first rendered/visible row (can be overwritten using overrideFn).
|
53
|
+
*
|
54
|
+
* @type {number|null}
|
55
|
+
*/
|
56
|
+
_defineProperty(this, "startRow", null);
|
57
|
+
/**
|
58
|
+
* Index of the last rendered/visible row (can be overwritten using overrideFn).
|
59
|
+
*
|
60
|
+
* @type {null}
|
61
|
+
*/
|
62
|
+
_defineProperty(this, "endRow", null);
|
63
|
+
/**
|
64
|
+
* Position of the first rendered/visible row (in px).
|
65
|
+
*
|
66
|
+
* @type {number|null}
|
67
|
+
*/
|
68
|
+
_defineProperty(this, "startPosition", null);
|
69
|
+
/**
|
70
|
+
* Determines if the viewport is visible in the trimming container.
|
71
|
+
*
|
72
|
+
* @type {boolean}
|
73
|
+
*/
|
74
|
+
_defineProperty(this, "isVisibleInTrimmingContainer", false);
|
75
|
+
/**
|
76
|
+
* The calculator options.
|
77
|
+
*
|
78
|
+
* @type {ViewportRowsCalculatorOptions}
|
79
|
+
*/
|
80
|
+
_classPrivateFieldInitSpec(this, _options, void 0);
|
81
|
+
_classPrivateFieldSet(_options, this, options);
|
59
82
|
this.calculate();
|
60
83
|
}
|
61
84
|
|
@@ -63,31 +86,90 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
|
63
86
|
* Calculates viewport.
|
64
87
|
*/
|
65
88
|
calculate() {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
89
|
+
const {
|
90
|
+
calculationType,
|
91
|
+
overrideFn,
|
92
|
+
rowHeightFn,
|
93
|
+
scrollOffset,
|
94
|
+
totalRows,
|
95
|
+
viewportHeight
|
96
|
+
} = _classPrivateFieldGet(_options, this);
|
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;
|
74
132
|
break;
|
75
133
|
}
|
76
134
|
}
|
77
|
-
|
78
|
-
|
135
|
+
const mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
|
136
|
+
const topRowOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
|
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
|
+
}
|
79
143
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
+
}
|
166
|
+
|
167
|
+
// If totalRows exceeded its total rows size set endRow to the latest item
|
168
|
+
if (totalRows < this.endRow) {
|
169
|
+
this.endRow = totalRows - 1;
|
170
|
+
}
|
171
|
+
if (this.startRow !== null) {
|
172
|
+
this.count = this.endRow - this.startRow + 1;
|
90
173
|
}
|
91
|
-
return rowHeight;
|
92
174
|
}
|
93
175
|
}
|
@@ -4,8 +4,6 @@ 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;
|
9
7
|
var _coords = _interopRequireDefault(require("./cell/coords"));
|
10
8
|
exports.CellCoords = _coords.default;
|
11
9
|
var _range = _interopRequireDefault(require("./cell/range"));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewportColumnsCalculator, ViewportRowsCalculator
|
1
|
+
import { ViewportColumnsCalculator, ViewportRowsCalculator } 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 {
|
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 };
|
@@ -253,9 +253,8 @@ class Table {
|
|
253
253
|
const columnHeadersCount = columnHeaders.length;
|
254
254
|
let runFastDraw = fastDraw;
|
255
255
|
if (this.isMaster) {
|
256
|
-
wtOverlays.beforeDraw();
|
257
256
|
this.holderOffset = (0, _element.offset)(this.holder);
|
258
|
-
runFastDraw = wtViewport.
|
257
|
+
runFastDraw = wtViewport.createRenderCalculators(runFastDraw);
|
259
258
|
if (rowHeadersCount && !wtSettings.getSetting('fixedColumnsStart')) {
|
260
259
|
const leftScrollPos = wtOverlays.inlineStartOverlay.getScrollPosition();
|
261
260
|
const previousState = this.correctHeaderWidth;
|
@@ -265,8 +264,16 @@ class Table {
|
|
265
264
|
}
|
266
265
|
}
|
267
266
|
}
|
267
|
+
if (this.isMaster) {
|
268
|
+
wtOverlays.beforeDraw();
|
269
|
+
}
|
268
270
|
if (runFastDraw) {
|
269
271
|
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) {
|
270
277
|
wtOverlays.refresh(true);
|
271
278
|
}
|
272
279
|
} else {
|
@@ -307,9 +314,8 @@ class Table {
|
|
307
314
|
this.markOversizedRows();
|
308
315
|
}
|
309
316
|
if (this.isMaster) {
|
310
|
-
|
311
|
-
|
312
|
-
}
|
317
|
+
wtViewport.createVisibleCalculators();
|
318
|
+
wtViewport.createPartiallyVisibleCalculators();
|
313
319
|
wtOverlays.refresh(false);
|
314
320
|
wtOverlays.applyToDOM();
|
315
321
|
const hiderWidth = (0, _element.outerWidth)(this.hider);
|
@@ -249,9 +249,8 @@ class Table {
|
|
249
249
|
const columnHeadersCount = columnHeaders.length;
|
250
250
|
let runFastDraw = fastDraw;
|
251
251
|
if (this.isMaster) {
|
252
|
-
wtOverlays.beforeDraw();
|
253
252
|
this.holderOffset = offset(this.holder);
|
254
|
-
runFastDraw = wtViewport.
|
253
|
+
runFastDraw = wtViewport.createRenderCalculators(runFastDraw);
|
255
254
|
if (rowHeadersCount && !wtSettings.getSetting('fixedColumnsStart')) {
|
256
255
|
const leftScrollPos = wtOverlays.inlineStartOverlay.getScrollPosition();
|
257
256
|
const previousState = this.correctHeaderWidth;
|
@@ -261,8 +260,16 @@ class Table {
|
|
261
260
|
}
|
262
261
|
}
|
263
262
|
}
|
263
|
+
if (this.isMaster) {
|
264
|
+
wtOverlays.beforeDraw();
|
265
|
+
}
|
264
266
|
if (runFastDraw) {
|
265
267
|
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) {
|
266
273
|
wtOverlays.refresh(true);
|
267
274
|
}
|
268
275
|
} else {
|
@@ -303,9 +310,8 @@ class Table {
|
|
303
310
|
this.markOversizedRows();
|
304
311
|
}
|
305
312
|
if (this.isMaster) {
|
306
|
-
|
307
|
-
|
308
|
-
}
|
313
|
+
wtViewport.createVisibleCalculators();
|
314
|
+
wtViewport.createPartiallyVisibleCalculators();
|
309
315
|
wtOverlays.refresh(false);
|
310
316
|
wtOverlays.applyToDOM();
|
311
317
|
const hiderWidth = outerWidth(this.hider);
|
@@ -51,8 +51,7 @@ class ColumnUtils {
|
|
51
51
|
* @returns {number}
|
52
52
|
*/
|
53
53
|
getWidth(sourceIndex) {
|
54
|
-
|
55
|
-
return width;
|
54
|
+
return this.wtSettings.getSetting('columnWidth', sourceIndex) || this.wtSettings.getSetting('defaultColumnWidth');
|
56
55
|
}
|
57
56
|
|
58
57
|
/**
|
@@ -48,8 +48,7 @@ export default class ColumnUtils {
|
|
48
48
|
* @returns {number}
|
49
49
|
*/
|
50
50
|
getWidth(sourceIndex) {
|
51
|
-
|
52
|
-
return width;
|
51
|
+
return this.wtSettings.getSetting('columnWidth', sourceIndex) || this.wtSettings.getSetting('defaultColumnWidth');
|
53
52
|
}
|
54
53
|
|
55
54
|
/**
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
-
var _calculator = require("../calculator");
|
6
5
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
7
6
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
8
7
|
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; }
|
@@ -11,6 +10,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
11
10
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
12
11
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
13
12
|
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();
|
14
18
|
/**
|
15
19
|
* @typedef {object} ColumnStretchingOptions
|
16
20
|
* @property {number} totalColumns Total number of columns.
|
@@ -21,12 +25,20 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
|
|
21
25
|
/**
|
22
26
|
* @class ColumnStretching
|
23
27
|
*/
|
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();
|
29
28
|
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
|
+
|
30
42
|
/**
|
31
43
|
* @param {ColumnStretchingOptions} options Object with all options specified for column viewport calculation.
|
32
44
|
*/
|
@@ -37,9 +49,6 @@ class ColumnStretching {
|
|
37
49
|
stretchingColumnWidthFn,
|
38
50
|
columnWidthFn
|
39
51
|
} = _ref;
|
40
|
-
/**
|
41
|
-
* @type {number}
|
42
|
-
*/
|
43
52
|
_defineProperty(this, "stretchAllRatio", 0);
|
44
53
|
/**
|
45
54
|
* @type {number}
|
@@ -189,7 +198,7 @@ class ColumnStretching {
|
|
189
198
|
_getColumnWidth(column) {
|
190
199
|
let width = _classPrivateFieldGet(_columnWidthFn, this).call(this, column);
|
191
200
|
if (isNaN(width)) {
|
192
|
-
width =
|
201
|
+
width = ColumnStretching.DEFAULT_WIDTH;
|
193
202
|
}
|
194
203
|
return width;
|
195
204
|
}
|
@@ -7,7 +7,11 @@ 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
|
-
|
10
|
+
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
11
|
+
var _totalColumns = /*#__PURE__*/new WeakMap();
|
12
|
+
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
13
|
+
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
14
|
+
var _stretchMode = /*#__PURE__*/new WeakMap();
|
11
15
|
/**
|
12
16
|
* @typedef {object} ColumnStretchingOptions
|
13
17
|
* @property {number} totalColumns Total number of columns.
|
@@ -18,12 +22,20 @@ import { DEFAULT_COLUMN_WIDTH } from "../calculator/index.mjs";
|
|
18
22
|
/**
|
19
23
|
* @class ColumnStretching
|
20
24
|
*/
|
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();
|
26
25
|
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
|
+
|
27
39
|
/**
|
28
40
|
* @param {ColumnStretchingOptions} options Object with all options specified for column viewport calculation.
|
29
41
|
*/
|
@@ -34,9 +46,6 @@ export class ColumnStretching {
|
|
34
46
|
stretchingColumnWidthFn,
|
35
47
|
columnWidthFn
|
36
48
|
} = _ref;
|
37
|
-
/**
|
38
|
-
* @type {number}
|
39
|
-
*/
|
40
49
|
_defineProperty(this, "stretchAllRatio", 0);
|
41
50
|
/**
|
42
51
|
* @type {number}
|
@@ -186,7 +195,7 @@ export class ColumnStretching {
|
|
186
195
|
_getColumnWidth(column) {
|
187
196
|
let width = _classPrivateFieldGet(_columnWidthFn, this).call(this, column);
|
188
197
|
if (isNaN(width)) {
|
189
|
-
width =
|
198
|
+
width = ColumnStretching.DEFAULT_WIDTH;
|
190
199
|
}
|
191
200
|
return width;
|
192
201
|
}
|
@@ -31,8 +31,6 @@ 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()]]);
|
36
34
|
this.eventManager = eventManager;
|
37
35
|
this.eventManager.addEventListener(this.domBindings.rootWindow, 'resize', () => {
|
38
36
|
this.clientHeight = this.getWorkspaceHeight();
|
@@ -243,20 +241,25 @@ class Viewport {
|
|
243
241
|
}
|
244
242
|
|
245
243
|
/**
|
246
|
-
* Creates
|
247
|
-
*
|
248
|
-
*
|
249
|
-
* - 'partiallyVisible' Calculates rows that are partially visible (used mostly for scrolling purposes).
|
244
|
+
* Creates:
|
245
|
+
* - rowsRenderCalculator (before draw, to qualify rows for rendering)
|
246
|
+
* - rowsVisibleCalculator (after draw, to measure which rows are actually visible).
|
250
247
|
*
|
251
|
-
* @param {
|
248
|
+
* @param {number} calculationType The render type ID, which determines for what type of
|
249
|
+
* calculation calculator is created.
|
252
250
|
* @returns {ViewportRowsCalculator}
|
253
251
|
*/
|
254
252
|
createRowsCalculator() {
|
255
|
-
let
|
253
|
+
let calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _calculator.RENDER_TYPE;
|
256
254
|
const {
|
257
255
|
wtSettings,
|
258
256
|
wtTable
|
259
257
|
} = this;
|
258
|
+
if (wtSettings.getSetting('renderAllRows') && calculationType === _calculator.RENDER_TYPE) {
|
259
|
+
return new _calculator.RenderAllRowsCalculator({
|
260
|
+
totalRows: wtSettings.getSetting('totalRows')
|
261
|
+
});
|
262
|
+
}
|
260
263
|
let height = this.getViewportHeight();
|
261
264
|
let scrollbarHeight;
|
262
265
|
let fixedRowsHeight;
|
@@ -280,31 +283,36 @@ class Viewport {
|
|
280
283
|
scrollbarHeight = (0, _element.getScrollbarWidth)(this.domBindings.rootDocument);
|
281
284
|
}
|
282
285
|
return new _calculator.ViewportRowsCalculator({
|
283
|
-
calculationTypes: calculatorTypes.map(type => [type, this.rowsCalculatorTypes.get(type)()]),
|
284
286
|
viewportHeight: height,
|
285
287
|
scrollOffset: pos,
|
286
288
|
totalRows: wtSettings.getSetting('totalRows'),
|
287
289
|
rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
|
288
290
|
overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
|
291
|
+
calculationType,
|
289
292
|
horizontalScrollbarHeight: scrollbarHeight
|
290
293
|
});
|
291
294
|
}
|
292
295
|
|
293
296
|
/**
|
294
|
-
* Creates
|
295
|
-
*
|
296
|
-
*
|
297
|
-
* - 'partiallyVisible' Calculates columns that are partially visible (used mostly for scrolling purposes).
|
297
|
+
* Creates:
|
298
|
+
* - columnsRenderCalculator (before draw, to qualify columns for rendering)
|
299
|
+
* - columnsVisibleCalculator (after draw, to measure which columns are actually visible).
|
298
300
|
*
|
299
|
-
* @param {
|
301
|
+
* @param {number} calculationType The render type ID, which determines for what type of
|
302
|
+
* calculation calculator is created.
|
300
303
|
* @returns {ViewportColumnsCalculator}
|
301
304
|
*/
|
302
305
|
createColumnsCalculator() {
|
303
|
-
let
|
306
|
+
let calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _calculator.RENDER_TYPE;
|
304
307
|
const {
|
305
308
|
wtSettings,
|
306
309
|
wtTable
|
307
310
|
} = this;
|
311
|
+
if (wtSettings.getSetting('renderAllColumns') && calculationType === _calculator.RENDER_TYPE) {
|
312
|
+
return new _calculator.RenderAllColumnsCalculator({
|
313
|
+
totalColumns: wtSettings.getSetting('totalColumns')
|
314
|
+
});
|
315
|
+
}
|
308
316
|
let width = this.getViewportWidth();
|
309
317
|
let pos = Math.abs(this.dataAccessObject.inlineStartScrollPosition) - this.dataAccessObject.inlineStartParentOffset;
|
310
318
|
this.columnHeaderHeight = NaN;
|
@@ -318,12 +326,12 @@ class Viewport {
|
|
318
326
|
width -= (0, _element.getScrollbarWidth)(this.domBindings.rootDocument);
|
319
327
|
}
|
320
328
|
return new _calculator.ViewportColumnsCalculator({
|
321
|
-
calculationTypes: calculatorTypes.map(type => [type, this.columnsCalculatorTypes.get(type)()]),
|
322
329
|
viewportWidth: width,
|
323
330
|
scrollOffset: pos,
|
324
331
|
totalColumns: wtSettings.getSetting('totalColumns'),
|
325
332
|
columnWidthFn: sourceCol => wtTable.getColumnWidth(sourceCol),
|
326
333
|
overrideFn: wtSettings.getSettingPure('viewportColumnCalculatorOverride'),
|
334
|
+
calculationType,
|
327
335
|
inlineStartOffset: this.dataAccessObject.inlineStartParentOffset
|
328
336
|
});
|
329
337
|
}
|
@@ -336,43 +344,46 @@ class Viewport {
|
|
336
344
|
* If `false` or `undefined`, will perform a full redraw.
|
337
345
|
* @returns {boolean} The fastDraw value, possibly modified.
|
338
346
|
*/
|
339
|
-
|
347
|
+
createRenderCalculators() {
|
340
348
|
let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
341
349
|
const {
|
342
350
|
wtSettings
|
343
351
|
} = this;
|
344
|
-
const rowsCalculator = this.createRowsCalculator();
|
345
|
-
const columnsCalculator = this.createColumnsCalculator();
|
346
352
|
if (fastDraw && !wtSettings.getSetting('renderAllRows')) {
|
347
|
-
const proposedRowsVisibleCalculator =
|
353
|
+
const proposedRowsVisibleCalculator = this.createRowsCalculator(_calculator.FULLY_VISIBLE_TYPE);
|
348
354
|
fastDraw = this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator);
|
349
355
|
}
|
350
356
|
if (fastDraw && !wtSettings.getSetting('renderAllColumns')) {
|
351
|
-
const proposedColumnsVisibleCalculator =
|
357
|
+
const proposedColumnsVisibleCalculator = this.createColumnsCalculator(_calculator.FULLY_VISIBLE_TYPE);
|
352
358
|
fastDraw = this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator);
|
353
359
|
}
|
354
360
|
if (!fastDraw) {
|
355
|
-
this.rowsRenderCalculator =
|
356
|
-
this.columnsRenderCalculator =
|
361
|
+
this.rowsRenderCalculator = this.createRowsCalculator(_calculator.RENDER_TYPE);
|
362
|
+
this.columnsRenderCalculator = this.createColumnsCalculator(_calculator.RENDER_TYPE);
|
357
363
|
}
|
358
|
-
|
359
|
-
|
360
|
-
this.
|
361
|
-
this.
|
364
|
+
|
365
|
+
// delete temporarily to make sure that renderers always use rowsRenderCalculator, not rowsVisibleCalculator
|
366
|
+
this.rowsVisibleCalculator = null;
|
367
|
+
this.columnsVisibleCalculator = null;
|
362
368
|
return fastDraw;
|
363
369
|
}
|
364
370
|
|
365
371
|
/**
|
366
|
-
* Creates
|
367
|
-
* the actually fully visible
|
372
|
+
* Creates rowsVisibleCalculator and columnsVisibleCalculator (after draw, to determine what are
|
373
|
+
* the actually fully visible rows and columns).
|
368
374
|
*/
|
369
375
|
createVisibleCalculators() {
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
+
this.rowsVisibleCalculator = this.createRowsCalculator(_calculator.FULLY_VISIBLE_TYPE);
|
377
|
+
this.columnsVisibleCalculator = this.createColumnsCalculator(_calculator.FULLY_VISIBLE_TYPE);
|
378
|
+
}
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Creates rowsPartiallyVisibleCalculator and columnsPartiallyVisibleCalculator (after draw, to determine what are
|
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);
|
376
387
|
}
|
377
388
|
|
378
389
|
/**
|