handsontable 0.0.0-next-0306a1a-20240826 → 0.0.0-next-1dfe61f-20240910
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/renderer/rows.js +10 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +11 -1
- 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/CHANGELOG.md +27 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -2
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +5 -6
- package/dataMap/metaManager/metaSchema.mjs +5 -6
- package/dist/handsontable.css +32 -20
- package/dist/handsontable.full.css +32 -20
- package/dist/handsontable.full.js +2751 -2091
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2752 -2092
- 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 +2 -0
- package/helpers/a11y.mjs +1 -0
- 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 +1 -2
- package/plugins/autoRowSize/autoRowSize.mjs +1 -2
- package/plugins/columnSorting/columnSorting.js +10 -1
- package/plugins/columnSorting/columnSorting.mjs +10 -1
- package/plugins/contextMenu/menu/menuItemRenderer.js +3 -4
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +5 -6
- package/plugins/contextMenu/menu/positioner.js +4 -12
- package/plugins/contextMenu/menu/positioner.mjs +4 -12
- package/plugins/contextMenu/menu/utils.js +11 -0
- package/plugins/contextMenu/menu/utils.mjs +10 -0
- package/plugins/contextMenu/predefinedItems/alignment.js +67 -49
- package/plugins/contextMenu/predefinedItems/alignment.mjs +68 -50
- package/plugins/contextMenu/predefinedItems/readOnly.js +11 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +11 -0
- package/plugins/contextMenu/utils.js +26 -0
- package/plugins/contextMenu/utils.mjs +24 -0
- package/plugins/copyPaste/copyPaste.js +14 -14
- package/plugins/copyPaste/copyPaste.mjs +14 -14
- package/plugins/dropdownMenu/dropdownMenu.js +10 -4
- package/plugins/dropdownMenu/dropdownMenu.mjs +10 -4
- package/plugins/filters/component/condition.js +6 -1
- package/plugins/filters/component/condition.mjs +6 -1
- package/plugins/filters/component/value.js +6 -1
- package/plugins/filters/component/value.mjs +6 -1
- package/plugins/filters/conditionCollection.d.ts +4 -3
- package/plugins/filters/conditionCollection.js +26 -0
- package/plugins/filters/conditionCollection.mjs +26 -0
- package/plugins/filters/filters.js +2 -1
- package/plugins/filters/filters.mjs +2 -1
- package/plugins/filters/ui/multipleSelect.js +7 -9
- package/plugins/filters/ui/multipleSelect.mjs +7 -9
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +11 -9
- package/plugins/mergeCells/cellsCollection.mjs +12 -10
- package/plugins/undoRedo/undoRedo.js +9 -5
- package/plugins/undoRedo/undoRedo.mjs +9 -5
- package/shortcuts/utils.js +3 -1
- package/shortcuts/utils.mjs +3 -1
- package/utils/ghostTable.js +11 -9
- package/utils/ghostTable.mjs +12 -10
- 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 };
|
@@ -12,6 +12,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
12
12
|
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; }
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
14
14
|
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); }
|
15
|
+
const ROW_CLASSNAMES = {
|
16
|
+
rowEven: 'ht__row_even',
|
17
|
+
rowOdd: 'ht__row_odd'
|
18
|
+
};
|
15
19
|
let performanceWarningAppeared = false;
|
16
20
|
|
17
21
|
/**
|
@@ -75,6 +79,12 @@ class RowsRenderer extends _base.default {
|
|
75
79
|
// `aria-rowindex` is incremented by both tbody and thead rows.
|
76
80
|
(0, _a11y.A11Y_ROWINDEX)(sourceRowIndex + ((_this$table$rowUtils$ = (_this$table$rowUtils = this.table.rowUtils) === null || _this$table$rowUtils === void 0 || (_this$table$rowUtils = _this$table$rowUtils.dataAccessObject) === null || _this$table$rowUtils === void 0 ? void 0 : _this$table$rowUtils.columnHeaders.length) !== null && _this$table$rowUtils$ !== void 0 ? _this$table$rowUtils$ : 0) + 1)]);
|
77
81
|
}
|
82
|
+
(0, _element.removeClass)(TR, [ROW_CLASSNAMES.rowEven, ROW_CLASSNAMES.rowOdd]);
|
83
|
+
if ((sourceRowIndex + 1) % 2 === 0) {
|
84
|
+
(0, _element.addClass)(TR, ROW_CLASSNAMES.rowEven);
|
85
|
+
} else {
|
86
|
+
(0, _element.addClass)(TR, ROW_CLASSNAMES.rowOdd);
|
87
|
+
}
|
78
88
|
}
|
79
89
|
this.orderView.end();
|
80
90
|
}
|
@@ -6,8 +6,12 @@ import BaseRenderer from "./_base.mjs";
|
|
6
6
|
import { warn } from "./../../../../helpers/console.mjs";
|
7
7
|
import { toSingleLine } from "./../../../../helpers/templateLiteralTag.mjs";
|
8
8
|
import { OrderView } from "./../utils/orderView/index.mjs";
|
9
|
-
import { setAttribute } from "../../../../helpers/dom/element.mjs";
|
9
|
+
import { addClass, removeClass, setAttribute } from "../../../../helpers/dom/element.mjs";
|
10
10
|
import { A11Y_ROW, A11Y_ROWGROUP, A11Y_ROWINDEX } from "../../../../helpers/a11y.mjs";
|
11
|
+
const ROW_CLASSNAMES = {
|
12
|
+
rowEven: 'ht__row_even',
|
13
|
+
rowOdd: 'ht__row_odd'
|
14
|
+
};
|
11
15
|
let performanceWarningAppeared = false;
|
12
16
|
|
13
17
|
/**
|
@@ -71,6 +75,12 @@ export default class RowsRenderer extends BaseRenderer {
|
|
71
75
|
// `aria-rowindex` is incremented by both tbody and thead rows.
|
72
76
|
A11Y_ROWINDEX(sourceRowIndex + ((_this$table$rowUtils$ = (_this$table$rowUtils = this.table.rowUtils) === null || _this$table$rowUtils === void 0 || (_this$table$rowUtils = _this$table$rowUtils.dataAccessObject) === null || _this$table$rowUtils === void 0 ? void 0 : _this$table$rowUtils.columnHeaders.length) !== null && _this$table$rowUtils$ !== void 0 ? _this$table$rowUtils$ : 0) + 1)]);
|
73
77
|
}
|
78
|
+
removeClass(TR, [ROW_CLASSNAMES.rowEven, ROW_CLASSNAMES.rowOdd]);
|
79
|
+
if ((sourceRowIndex + 1) % 2 === 0) {
|
80
|
+
addClass(TR, ROW_CLASSNAMES.rowEven);
|
81
|
+
} else {
|
82
|
+
addClass(TR, ROW_CLASSNAMES.rowOdd);
|
83
|
+
}
|
74
84
|
}
|
75
85
|
this.orderView.end();
|
76
86
|
}
|
@@ -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
|
}
|