handsontable 0.0.0-next-bbc9650-20230220 → 0.0.0-next-ac3a342-20230222
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/viewportColumns.js +31 -9
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +31 -9
- package/3rdparty/walkontable/src/calculator/viewportRows.js +21 -6
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +21 -6
- package/3rdparty/walkontable/src/core/_base.js +3 -0
- package/3rdparty/walkontable/src/core/_base.mjs +3 -0
- package/3rdparty/walkontable/src/scroll.js +14 -3
- package/3rdparty/walkontable/src/scroll.mjs +14 -3
- package/3rdparty/walkontable/src/table.js +4 -2
- package/3rdparty/walkontable/src/table.mjs +4 -2
- package/3rdparty/walkontable/src/types.js +1 -0
- package/3rdparty/walkontable/src/types.mjs +1 -0
- package/3rdparty/walkontable/src/viewport.js +11 -14
- package/3rdparty/walkontable/src/viewport.mjs +11 -14
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +89 -47
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +90 -90
- package/dist/handsontable.js +89 -47
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/filters/filters.js +0 -8
- package/plugins/filters/filters.mjs +0 -8
@@ -35,8 +35,10 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
35
35
|
* @param {number} options.scrollOffset Current horizontal scroll position of the viewport.
|
36
36
|
* @param {number} options.totalItems Total number of columns.
|
37
37
|
* @param {Function} options.itemSizeFn Function that returns the width of the column at a given index (in px).
|
38
|
-
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
|
38
|
+
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
|
39
|
+
* MergeCells plugin).
|
39
40
|
* @param {string} options.calculationType String which describes types of calculation which will be performed.
|
41
|
+
* @param {string} options.inlineStartOffset Inline-start offset of the parent container.
|
40
42
|
* @param {string} [options.stretchMode] Stretch mode 'all' or 'last'.
|
41
43
|
* @param {Function} [options.stretchingItemWidthFn] Function that returns the new width of the stretched column.
|
42
44
|
*/
|
@@ -52,7 +54,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
52
54
|
_ref$stretchingItemWi = _ref.stretchingItemWidthFn,
|
53
55
|
stretchingItemWidthFn = _ref$stretchingItemWi === void 0 ? function (width) {
|
54
56
|
return width;
|
55
|
-
} : _ref$stretchingItemWi
|
57
|
+
} : _ref$stretchingItemWi,
|
58
|
+
inlineStartOffset = _ref.inlineStartOffset;
|
56
59
|
_classCallCheck(this, ViewportColumnsCalculator);
|
57
60
|
privatePool.set(this, {
|
58
61
|
viewportWidth: viewportSize,
|
@@ -61,7 +64,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
61
64
|
columnWidthFn: itemSizeFn,
|
62
65
|
overrideFn: overrideFn,
|
63
66
|
calculationType: calculationType,
|
64
|
-
stretchingColumnWidthFn: stretchingItemWidthFn
|
67
|
+
stretchingColumnWidthFn: stretchingItemWidthFn,
|
68
|
+
inlineStartOffset: inlineStartOffset
|
65
69
|
});
|
66
70
|
|
67
71
|
/**
|
@@ -91,6 +95,7 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
91
95
|
* @type {number|null}
|
92
96
|
*/
|
93
97
|
this.startPosition = null;
|
98
|
+
this.isVisibleInTrimmingContainer = false;
|
94
99
|
this.stretchAllRatio = 0;
|
95
100
|
this.stretchLastWidth = 0;
|
96
101
|
this.stretch = stretchMode;
|
@@ -110,36 +115,53 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
110
115
|
var needReverse = true;
|
111
116
|
var startPositions = [];
|
112
117
|
var columnWidth;
|
118
|
+
var firstVisibleColumnWidth = 0;
|
119
|
+
var lastVisibleColumnWidth = 0;
|
113
120
|
var priv = privatePool.get(this);
|
114
121
|
var calculationType = priv.calculationType;
|
115
122
|
var overrideFn = priv.overrideFn;
|
116
123
|
var scrollOffset = priv.scrollOffset;
|
124
|
+
var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
|
117
125
|
var totalColumns = priv.totalColumns;
|
118
126
|
var viewportWidth = priv.viewportWidth;
|
127
|
+
// +1 pixel for row header width compensation for horizontal scroll > 0
|
128
|
+
var compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
|
119
129
|
for (var i = 0; i < totalColumns; i++) {
|
120
130
|
columnWidth = this._getColumnWidth(i);
|
121
|
-
if (sum <=
|
131
|
+
if (sum <= zeroBasedScrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
122
132
|
this.startColumn = i;
|
133
|
+
firstVisibleColumnWidth = columnWidth;
|
123
134
|
}
|
124
|
-
|
125
|
-
// +1 pixel for row header width compensation for horizontal scroll > 0
|
126
|
-
var compensatedViewportWidth = scrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
|
127
|
-
if (sum >= scrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= scrollOffset + compensatedViewportWidth) {
|
135
|
+
if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= zeroBasedScrollOffset + compensatedViewportWidth) {
|
128
136
|
if (this.startColumn === null || this.startColumn === void 0) {
|
129
137
|
this.startColumn = i;
|
138
|
+
firstVisibleColumnWidth = columnWidth;
|
130
139
|
}
|
131
140
|
this.endColumn = i;
|
132
141
|
}
|
133
142
|
startPositions.push(sum);
|
134
143
|
sum += columnWidth;
|
144
|
+
lastVisibleColumnWidth = columnWidth;
|
135
145
|
if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
136
146
|
this.endColumn = i;
|
137
147
|
}
|
138
|
-
if (sum >=
|
148
|
+
if (sum >= zeroBasedScrollOffset + viewportWidth) {
|
139
149
|
needReverse = false;
|
140
150
|
break;
|
141
151
|
}
|
142
152
|
}
|
153
|
+
var mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
|
154
|
+
var inlineEndColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleColumnWidth;
|
155
|
+
var inlineStartColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
|
156
|
+
if (
|
157
|
+
// The table is on the left of the viewport
|
158
|
+
mostRightScrollOffset < -1 * priv.inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
|
159
|
+
// The table is on the right of the viewport
|
160
|
+
-1 * priv.scrollOffset - priv.viewportWidth > -1 * inlineStartColumnOffset) {
|
161
|
+
this.isVisibleInTrimmingContainer = false;
|
162
|
+
} else {
|
163
|
+
this.isVisibleInTrimmingContainer = true;
|
164
|
+
}
|
143
165
|
if (this.endColumn === totalColumns - 1 && needReverse) {
|
144
166
|
this.startColumn = this.endColumn;
|
145
167
|
while (this.startColumn > 0) {
|
@@ -31,8 +31,10 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
31
31
|
* @param {number} options.scrollOffset Current horizontal scroll position of the viewport.
|
32
32
|
* @param {number} options.totalItems Total number of columns.
|
33
33
|
* @param {Function} options.itemSizeFn Function that returns the width of the column at a given index (in px).
|
34
|
-
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
|
34
|
+
* @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
|
35
|
+
* MergeCells plugin).
|
35
36
|
* @param {string} options.calculationType String which describes types of calculation which will be performed.
|
37
|
+
* @param {string} options.inlineStartOffset Inline-start offset of the parent container.
|
36
38
|
* @param {string} [options.stretchMode] Stretch mode 'all' or 'last'.
|
37
39
|
* @param {Function} [options.stretchingItemWidthFn] Function that returns the new width of the stretched column.
|
38
40
|
*/
|
@@ -48,7 +50,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
48
50
|
_ref$stretchingItemWi = _ref.stretchingItemWidthFn,
|
49
51
|
stretchingItemWidthFn = _ref$stretchingItemWi === void 0 ? function (width) {
|
50
52
|
return width;
|
51
|
-
} : _ref$stretchingItemWi
|
53
|
+
} : _ref$stretchingItemWi,
|
54
|
+
inlineStartOffset = _ref.inlineStartOffset;
|
52
55
|
_classCallCheck(this, ViewportColumnsCalculator);
|
53
56
|
privatePool.set(this, {
|
54
57
|
viewportWidth: viewportSize,
|
@@ -57,7 +60,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
57
60
|
columnWidthFn: itemSizeFn,
|
58
61
|
overrideFn: overrideFn,
|
59
62
|
calculationType: calculationType,
|
60
|
-
stretchingColumnWidthFn: stretchingItemWidthFn
|
63
|
+
stretchingColumnWidthFn: stretchingItemWidthFn,
|
64
|
+
inlineStartOffset: inlineStartOffset
|
61
65
|
});
|
62
66
|
|
63
67
|
/**
|
@@ -87,6 +91,7 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
87
91
|
* @type {number|null}
|
88
92
|
*/
|
89
93
|
this.startPosition = null;
|
94
|
+
this.isVisibleInTrimmingContainer = false;
|
90
95
|
this.stretchAllRatio = 0;
|
91
96
|
this.stretchLastWidth = 0;
|
92
97
|
this.stretch = stretchMode;
|
@@ -106,36 +111,53 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
|
|
106
111
|
var needReverse = true;
|
107
112
|
var startPositions = [];
|
108
113
|
var columnWidth;
|
114
|
+
var firstVisibleColumnWidth = 0;
|
115
|
+
var lastVisibleColumnWidth = 0;
|
109
116
|
var priv = privatePool.get(this);
|
110
117
|
var calculationType = priv.calculationType;
|
111
118
|
var overrideFn = priv.overrideFn;
|
112
119
|
var scrollOffset = priv.scrollOffset;
|
120
|
+
var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
|
113
121
|
var totalColumns = priv.totalColumns;
|
114
122
|
var viewportWidth = priv.viewportWidth;
|
123
|
+
// +1 pixel for row header width compensation for horizontal scroll > 0
|
124
|
+
var compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
|
115
125
|
for (var i = 0; i < totalColumns; i++) {
|
116
126
|
columnWidth = this._getColumnWidth(i);
|
117
|
-
if (sum <=
|
127
|
+
if (sum <= zeroBasedScrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
|
118
128
|
this.startColumn = i;
|
129
|
+
firstVisibleColumnWidth = columnWidth;
|
119
130
|
}
|
120
|
-
|
121
|
-
// +1 pixel for row header width compensation for horizontal scroll > 0
|
122
|
-
var compensatedViewportWidth = scrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
|
123
|
-
if (sum >= scrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? columnWidth : 0) <= scrollOffset + compensatedViewportWidth) {
|
131
|
+
if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? columnWidth : 0) <= zeroBasedScrollOffset + compensatedViewportWidth) {
|
124
132
|
if (this.startColumn === null || this.startColumn === void 0) {
|
125
133
|
this.startColumn = i;
|
134
|
+
firstVisibleColumnWidth = columnWidth;
|
126
135
|
}
|
127
136
|
this.endColumn = i;
|
128
137
|
}
|
129
138
|
startPositions.push(sum);
|
130
139
|
sum += columnWidth;
|
140
|
+
lastVisibleColumnWidth = columnWidth;
|
131
141
|
if (calculationType !== FULLY_VISIBLE_TYPE) {
|
132
142
|
this.endColumn = i;
|
133
143
|
}
|
134
|
-
if (sum >=
|
144
|
+
if (sum >= zeroBasedScrollOffset + viewportWidth) {
|
135
145
|
needReverse = false;
|
136
146
|
break;
|
137
147
|
}
|
138
148
|
}
|
149
|
+
var mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
|
150
|
+
var inlineEndColumnOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleColumnWidth;
|
151
|
+
var inlineStartColumnOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
|
152
|
+
if (
|
153
|
+
// The table is on the left of the viewport
|
154
|
+
mostRightScrollOffset < -1 * priv.inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
|
155
|
+
// The table is on the right of the viewport
|
156
|
+
-1 * priv.scrollOffset - priv.viewportWidth > -1 * inlineStartColumnOffset) {
|
157
|
+
this.isVisibleInTrimmingContainer = false;
|
158
|
+
} else {
|
159
|
+
this.isVisibleInTrimmingContainer = true;
|
160
|
+
}
|
139
161
|
if (this.endColumn === totalColumns - 1 && needReverse) {
|
140
162
|
this.startColumn = this.endColumn;
|
141
163
|
while (this.startColumn > 0) {
|
@@ -86,6 +86,7 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
86
86
|
* @type {number|null}
|
87
87
|
*/
|
88
88
|
this.startPosition = null;
|
89
|
+
this.isVisibleInTrimmingContainer = false;
|
89
90
|
this.calculate();
|
90
91
|
}
|
91
92
|
|
@@ -95,18 +96,21 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
95
96
|
_createClass(ViewportRowsCalculator, [{
|
96
97
|
key: "calculate",
|
97
98
|
value: function calculate() {
|
98
|
-
var sum = 0;
|
99
|
-
var needReverse = true;
|
100
|
-
var startPositions = [];
|
101
99
|
var priv = privatePool.get(this);
|
102
100
|
var calculationType = priv.calculationType;
|
103
101
|
var overrideFn = priv.overrideFn;
|
104
102
|
var rowHeightFn = priv.rowHeightFn;
|
105
103
|
var scrollOffset = priv.scrollOffset;
|
104
|
+
var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
|
106
105
|
var totalRows = priv.totalRows;
|
107
106
|
var viewportHeight = priv.viewportHeight;
|
108
107
|
var horizontalScrollbarHeight = priv.horizontalScrollbarHeight || 0;
|
108
|
+
var sum = 0;
|
109
|
+
var needReverse = true;
|
110
|
+
var startPositions = [];
|
109
111
|
var rowHeight;
|
112
|
+
var firstVisibleRowHeight = 0;
|
113
|
+
var lastVisibleRowHeight = 0;
|
110
114
|
|
111
115
|
// Calculate the number (start and end index) of rows needed
|
112
116
|
for (var i = 0; i < totalRows; i++) {
|
@@ -114,26 +118,37 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
114
118
|
if (isNaN(rowHeight)) {
|
115
119
|
rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
|
116
120
|
}
|
117
|
-
if (sum <=
|
121
|
+
if (sum <= zeroBasedScrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
118
122
|
this.startRow = i;
|
123
|
+
firstVisibleRowHeight = rowHeight;
|
119
124
|
}
|
120
|
-
if (sum >=
|
125
|
+
if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
|
121
126
|
// eslint-disable-line max-len
|
122
127
|
if (this.startRow === null) {
|
123
128
|
this.startRow = i;
|
129
|
+
firstVisibleRowHeight = rowHeight;
|
124
130
|
}
|
125
131
|
this.endRow = i;
|
126
132
|
}
|
127
133
|
startPositions.push(sum);
|
128
134
|
sum += rowHeight;
|
135
|
+
lastVisibleRowHeight = rowHeight;
|
129
136
|
if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
130
137
|
this.endRow = i;
|
131
138
|
}
|
132
|
-
if (sum >=
|
139
|
+
if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
|
133
140
|
needReverse = false;
|
134
141
|
break;
|
135
142
|
}
|
136
143
|
}
|
144
|
+
var mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
|
145
|
+
var topRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
|
146
|
+
var bottomRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
|
147
|
+
if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
|
148
|
+
this.isVisibleInTrimmingContainer = false;
|
149
|
+
} else {
|
150
|
+
this.isVisibleInTrimmingContainer = true;
|
151
|
+
}
|
137
152
|
|
138
153
|
// If the estimation has reached the last row and there is still some space available in the viewport,
|
139
154
|
// we need to render in reverse in order to fill the whole viewport with rows
|
@@ -82,6 +82,7 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
82
82
|
* @type {number|null}
|
83
83
|
*/
|
84
84
|
this.startPosition = null;
|
85
|
+
this.isVisibleInTrimmingContainer = false;
|
85
86
|
this.calculate();
|
86
87
|
}
|
87
88
|
|
@@ -91,18 +92,21 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
91
92
|
_createClass(ViewportRowsCalculator, [{
|
92
93
|
key: "calculate",
|
93
94
|
value: function calculate() {
|
94
|
-
var sum = 0;
|
95
|
-
var needReverse = true;
|
96
|
-
var startPositions = [];
|
97
95
|
var priv = privatePool.get(this);
|
98
96
|
var calculationType = priv.calculationType;
|
99
97
|
var overrideFn = priv.overrideFn;
|
100
98
|
var rowHeightFn = priv.rowHeightFn;
|
101
99
|
var scrollOffset = priv.scrollOffset;
|
100
|
+
var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
|
102
101
|
var totalRows = priv.totalRows;
|
103
102
|
var viewportHeight = priv.viewportHeight;
|
104
103
|
var horizontalScrollbarHeight = priv.horizontalScrollbarHeight || 0;
|
104
|
+
var sum = 0;
|
105
|
+
var needReverse = true;
|
106
|
+
var startPositions = [];
|
105
107
|
var rowHeight;
|
108
|
+
var firstVisibleRowHeight = 0;
|
109
|
+
var lastVisibleRowHeight = 0;
|
106
110
|
|
107
111
|
// Calculate the number (start and end index) of rows needed
|
108
112
|
for (var i = 0; i < totalRows; i++) {
|
@@ -110,26 +114,37 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
|
|
110
114
|
if (isNaN(rowHeight)) {
|
111
115
|
rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
|
112
116
|
}
|
113
|
-
if (sum <=
|
117
|
+
if (sum <= zeroBasedScrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
|
114
118
|
this.startRow = i;
|
119
|
+
firstVisibleRowHeight = rowHeight;
|
115
120
|
}
|
116
|
-
if (sum >=
|
121
|
+
if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
|
117
122
|
// eslint-disable-line max-len
|
118
123
|
if (this.startRow === null) {
|
119
124
|
this.startRow = i;
|
125
|
+
firstVisibleRowHeight = rowHeight;
|
120
126
|
}
|
121
127
|
this.endRow = i;
|
122
128
|
}
|
123
129
|
startPositions.push(sum);
|
124
130
|
sum += rowHeight;
|
131
|
+
lastVisibleRowHeight = rowHeight;
|
125
132
|
if (calculationType !== FULLY_VISIBLE_TYPE) {
|
126
133
|
this.endRow = i;
|
127
134
|
}
|
128
|
-
if (sum >=
|
135
|
+
if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
|
129
136
|
needReverse = false;
|
130
137
|
break;
|
131
138
|
}
|
132
139
|
}
|
140
|
+
var mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
|
141
|
+
var topRowOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
|
142
|
+
var bottomRowOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
|
143
|
+
if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
|
144
|
+
this.isVisibleInTrimmingContainer = false;
|
145
|
+
} else {
|
146
|
+
this.isVisibleInTrimmingContainer = true;
|
147
|
+
}
|
133
148
|
|
134
149
|
// If the estimation has reached the last row and there is still some space available in the viewport,
|
135
150
|
// we need to render in reverse in order to fill the whole viewport with rows
|
@@ -292,6 +292,9 @@ var CoreAbstract = /*#__PURE__*/function () {
|
|
292
292
|
return wot.wtViewport; // TODO refactoring: move outside dao, use IOC
|
293
293
|
},
|
294
294
|
|
295
|
+
get wtSettings() {
|
296
|
+
return wot.wtSettings;
|
297
|
+
},
|
295
298
|
get rootWindow() {
|
296
299
|
return wot.domBindings.rootWindow; // TODO refactoring: move outside dao
|
297
300
|
},
|
@@ -287,6 +287,9 @@ var CoreAbstract = /*#__PURE__*/function () {
|
|
287
287
|
return wot.wtViewport; // TODO refactoring: move outside dao, use IOC
|
288
288
|
},
|
289
289
|
|
290
|
+
get wtSettings() {
|
291
|
+
return wot.wtSettings;
|
292
|
+
},
|
290
293
|
get rootWindow() {
|
291
294
|
return wot.domBindings.rootWindow; // TODO refactoring: move outside dao
|
292
295
|
},
|
@@ -295,6 +295,7 @@ var Scroll = /*#__PURE__*/function () {
|
|
295
295
|
key: "getLastVisibleColumn",
|
296
296
|
value: function getLastVisibleColumn() {
|
297
297
|
var _this$dataAccessObjec8 = this.dataAccessObject,
|
298
|
+
wtSettings = _this$dataAccessObjec8.wtSettings,
|
298
299
|
inlineStartOverlay = _this$dataAccessObjec8.inlineStartOverlay,
|
299
300
|
wtTable = _this$dataAccessObjec8.wtTable,
|
300
301
|
wtViewport = _this$dataAccessObjec8.wtViewport,
|
@@ -302,16 +303,26 @@ var Scroll = /*#__PURE__*/function () {
|
|
302
303
|
rootWindow = _this$dataAccessObjec8.rootWindow;
|
303
304
|
var lastVisibleColumn = wtTable.getLastVisibleColumn();
|
304
305
|
if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
|
305
|
-
var
|
306
|
+
var isRtl = wtSettings.getSetting('rtlMode');
|
307
|
+
var inlineStartRootElementOffset = null;
|
308
|
+
if (isRtl) {
|
309
|
+
var tableRect = wtTable.TABLE.getBoundingClientRect();
|
310
|
+
var rootDocument = this.dataAccessObject.rootWindow.document;
|
311
|
+
var docOffsetWidth = rootDocument.documentElement.offsetWidth;
|
312
|
+
inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
|
313
|
+
} else {
|
314
|
+
var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
|
315
|
+
inlineStartRootElementOffset = rootElementOffset.left;
|
316
|
+
}
|
306
317
|
var windowScrollLeft = Math.abs((0, _element.getScrollLeft)(rootWindow, rootWindow));
|
307
318
|
|
308
319
|
// Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
|
309
|
-
if (
|
320
|
+
if (inlineStartRootElementOffset > windowScrollLeft) {
|
310
321
|
var windowWidth = (0, _element.innerWidth)(rootWindow);
|
311
322
|
var columnsWidth = wtViewport.getRowHeaderWidth();
|
312
323
|
for (var column = 1; column <= totalColumns; column++) {
|
313
324
|
columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
|
314
|
-
if (
|
325
|
+
if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
|
315
326
|
// Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
|
316
327
|
lastVisibleColumn = column - 2;
|
317
328
|
break;
|
@@ -291,6 +291,7 @@ var Scroll = /*#__PURE__*/function () {
|
|
291
291
|
key: "getLastVisibleColumn",
|
292
292
|
value: function getLastVisibleColumn() {
|
293
293
|
var _this$dataAccessObjec8 = this.dataAccessObject,
|
294
|
+
wtSettings = _this$dataAccessObjec8.wtSettings,
|
294
295
|
inlineStartOverlay = _this$dataAccessObjec8.inlineStartOverlay,
|
295
296
|
wtTable = _this$dataAccessObjec8.wtTable,
|
296
297
|
wtViewport = _this$dataAccessObjec8.wtViewport,
|
@@ -298,16 +299,26 @@ var Scroll = /*#__PURE__*/function () {
|
|
298
299
|
rootWindow = _this$dataAccessObjec8.rootWindow;
|
299
300
|
var lastVisibleColumn = wtTable.getLastVisibleColumn();
|
300
301
|
if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
|
301
|
-
var
|
302
|
+
var isRtl = wtSettings.getSetting('rtlMode');
|
303
|
+
var inlineStartRootElementOffset = null;
|
304
|
+
if (isRtl) {
|
305
|
+
var tableRect = wtTable.TABLE.getBoundingClientRect();
|
306
|
+
var rootDocument = this.dataAccessObject.rootWindow.document;
|
307
|
+
var docOffsetWidth = rootDocument.documentElement.offsetWidth;
|
308
|
+
inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
|
309
|
+
} else {
|
310
|
+
var rootElementOffset = offset(wtTable.wtRootElement);
|
311
|
+
inlineStartRootElementOffset = rootElementOffset.left;
|
312
|
+
}
|
302
313
|
var windowScrollLeft = Math.abs(getScrollLeft(rootWindow, rootWindow));
|
303
314
|
|
304
315
|
// Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
|
305
|
-
if (
|
316
|
+
if (inlineStartRootElementOffset > windowScrollLeft) {
|
306
317
|
var windowWidth = innerWidth(rootWindow);
|
307
318
|
var columnsWidth = wtViewport.getRowHeaderWidth();
|
308
319
|
for (var column = 1; column <= totalColumns; column++) {
|
309
320
|
columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
|
310
|
-
if (
|
321
|
+
if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
|
311
322
|
// Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
|
312
323
|
lastVisibleColumn = column - 2;
|
313
324
|
break;
|
@@ -677,7 +677,8 @@ var Table = /*#__PURE__*/function () {
|
|
677
677
|
*
|
678
678
|
* @param {number} row Row index.
|
679
679
|
* @param {number} [level=0] Header level (0 = most distant to the table).
|
680
|
-
* @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
|
680
|
+
* @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
|
681
|
+
* row headers`.
|
681
682
|
*/
|
682
683
|
}, {
|
683
684
|
key: "getRowHeader",
|
@@ -722,7 +723,8 @@ var Table = /*#__PURE__*/function () {
|
|
722
723
|
* Returns cell coords object for a given TD (or a child element of a TD element).
|
723
724
|
*
|
724
725
|
* @param {HTMLTableCellElement} TD A cell DOM element (or a child of one).
|
725
|
-
* @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
|
726
|
+
* @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
|
727
|
+
* provided element is not applicable.
|
726
728
|
*/
|
727
729
|
}, {
|
728
730
|
key: "getCoords",
|
@@ -672,7 +672,8 @@ var Table = /*#__PURE__*/function () {
|
|
672
672
|
*
|
673
673
|
* @param {number} row Row index.
|
674
674
|
* @param {number} [level=0] Header level (0 = most distant to the table).
|
675
|
-
* @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
|
675
|
+
* @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
|
676
|
+
* row headers`.
|
676
677
|
*/
|
677
678
|
}, {
|
678
679
|
key: "getRowHeader",
|
@@ -717,7 +718,8 @@ var Table = /*#__PURE__*/function () {
|
|
717
718
|
* Returns cell coords object for a given TD (or a child element of a TD element).
|
718
719
|
*
|
719
720
|
* @param {HTMLTableCellElement} TD A cell DOM element (or a child of one).
|
720
|
-
* @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
|
721
|
+
* @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
|
722
|
+
* provided element is not applicable.
|
721
723
|
*/
|
722
724
|
}, {
|
723
725
|
key: "getCoords",
|
@@ -303,13 +303,10 @@ var Viewport = /*#__PURE__*/function () {
|
|
303
303
|
height = this.getViewportHeight();
|
304
304
|
}
|
305
305
|
var pos = this.dataAccessObject.topScrollPosition - this.dataAccessObject.topParentOffset;
|
306
|
-
if (pos < 0) {
|
307
|
-
pos = 0;
|
308
|
-
}
|
309
306
|
var fixedRowsTop = wtSettings.getSetting('fixedRowsTop');
|
310
307
|
var fixedRowsBottom = wtSettings.getSetting('fixedRowsBottom');
|
311
308
|
var totalRows = wtSettings.getSetting('totalRows');
|
312
|
-
if (fixedRowsTop) {
|
309
|
+
if (fixedRowsTop && pos >= 0) {
|
313
310
|
fixedRowsHeight = this.dataAccessObject.topOverlay.sumCellSizes(0, fixedRowsTop);
|
314
311
|
pos += fixedRowsHeight;
|
315
312
|
height -= fixedRowsHeight;
|
@@ -354,11 +351,8 @@ var Viewport = /*#__PURE__*/function () {
|
|
354
351
|
var width = this.getViewportWidth();
|
355
352
|
var pos = Math.abs(this.dataAccessObject.inlineStartScrollPosition) - this.dataAccessObject.inlineStartParentOffset;
|
356
353
|
this.columnHeaderHeight = NaN;
|
357
|
-
if (pos < 0) {
|
358
|
-
pos = 0;
|
359
|
-
}
|
360
354
|
var fixedColumnsStart = wtSettings.getSetting('fixedColumnsStart');
|
361
|
-
if (fixedColumnsStart) {
|
355
|
+
if (fixedColumnsStart && pos >= 0) {
|
362
356
|
var fixedColumnsWidth = this.dataAccessObject.inlineStartOverlay.sumCellSizes(0, fixedColumnsStart);
|
363
357
|
pos += fixedColumnsWidth;
|
364
358
|
width -= fixedColumnsWidth;
|
@@ -368,7 +362,7 @@ var Viewport = /*#__PURE__*/function () {
|
|
368
362
|
}
|
369
363
|
return new _calculator.ViewportColumnsCalculator({
|
370
364
|
viewportSize: width,
|
371
|
-
scrollOffset:
|
365
|
+
scrollOffset: pos,
|
372
366
|
totalItems: wtSettings.getSetting('totalColumns'),
|
373
367
|
itemSizeFn: function itemSizeFn(sourceCol) {
|
374
368
|
return wtTable.getColumnWidth(sourceCol);
|
@@ -378,7 +372,8 @@ var Viewport = /*#__PURE__*/function () {
|
|
378
372
|
stretchMode: wtSettings.getSetting('stretchH'),
|
379
373
|
stretchingItemWidthFn: function stretchingItemWidthFn(stretchedWidth, column) {
|
380
374
|
return wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column);
|
381
|
-
}
|
375
|
+
},
|
376
|
+
inlineStartOffset: this.dataAccessObject.inlineStartParentOffset
|
382
377
|
});
|
383
378
|
}
|
384
379
|
|
@@ -438,11 +433,12 @@ var Viewport = /*#__PURE__*/function () {
|
|
438
433
|
return false;
|
439
434
|
}
|
440
435
|
var startRow = proposedRowsVisibleCalculator.startRow,
|
441
|
-
endRow = proposedRowsVisibleCalculator.endRow
|
436
|
+
endRow = proposedRowsVisibleCalculator.endRow,
|
437
|
+
isVisibleInTrimmingContainer = proposedRowsVisibleCalculator.isVisibleInTrimmingContainer;
|
442
438
|
|
443
439
|
// if there are no fully visible rows at all, return false
|
444
440
|
if (startRow === null && endRow === null) {
|
445
|
-
return
|
441
|
+
return !isVisibleInTrimmingContainer;
|
446
442
|
}
|
447
443
|
var _this$rowsRenderCalcu = this.rowsRenderCalculator,
|
448
444
|
renderedStartRow = _this$rowsRenderCalcu.startRow,
|
@@ -470,11 +466,12 @@ var Viewport = /*#__PURE__*/function () {
|
|
470
466
|
return false;
|
471
467
|
}
|
472
468
|
var startColumn = proposedColumnsVisibleCalculator.startColumn,
|
473
|
-
endColumn = proposedColumnsVisibleCalculator.endColumn
|
469
|
+
endColumn = proposedColumnsVisibleCalculator.endColumn,
|
470
|
+
isVisibleInTrimmingContainer = proposedColumnsVisibleCalculator.isVisibleInTrimmingContainer;
|
474
471
|
|
475
472
|
// if there are no fully visible columns at all, return false
|
476
473
|
if (startColumn === null && endColumn === null) {
|
477
|
-
return
|
474
|
+
return !isVisibleInTrimmingContainer;
|
478
475
|
}
|
479
476
|
var _this$columnsRenderCa = this.columnsRenderCalculator,
|
480
477
|
renderedStartColumn = _this$columnsRenderCa.startColumn,
|
@@ -299,13 +299,10 @@ var Viewport = /*#__PURE__*/function () {
|
|
299
299
|
height = this.getViewportHeight();
|
300
300
|
}
|
301
301
|
var pos = this.dataAccessObject.topScrollPosition - this.dataAccessObject.topParentOffset;
|
302
|
-
if (pos < 0) {
|
303
|
-
pos = 0;
|
304
|
-
}
|
305
302
|
var fixedRowsTop = wtSettings.getSetting('fixedRowsTop');
|
306
303
|
var fixedRowsBottom = wtSettings.getSetting('fixedRowsBottom');
|
307
304
|
var totalRows = wtSettings.getSetting('totalRows');
|
308
|
-
if (fixedRowsTop) {
|
305
|
+
if (fixedRowsTop && pos >= 0) {
|
309
306
|
fixedRowsHeight = this.dataAccessObject.topOverlay.sumCellSizes(0, fixedRowsTop);
|
310
307
|
pos += fixedRowsHeight;
|
311
308
|
height -= fixedRowsHeight;
|
@@ -350,11 +347,8 @@ var Viewport = /*#__PURE__*/function () {
|
|
350
347
|
var width = this.getViewportWidth();
|
351
348
|
var pos = Math.abs(this.dataAccessObject.inlineStartScrollPosition) - this.dataAccessObject.inlineStartParentOffset;
|
352
349
|
this.columnHeaderHeight = NaN;
|
353
|
-
if (pos < 0) {
|
354
|
-
pos = 0;
|
355
|
-
}
|
356
350
|
var fixedColumnsStart = wtSettings.getSetting('fixedColumnsStart');
|
357
|
-
if (fixedColumnsStart) {
|
351
|
+
if (fixedColumnsStart && pos >= 0) {
|
358
352
|
var fixedColumnsWidth = this.dataAccessObject.inlineStartOverlay.sumCellSizes(0, fixedColumnsStart);
|
359
353
|
pos += fixedColumnsWidth;
|
360
354
|
width -= fixedColumnsWidth;
|
@@ -364,7 +358,7 @@ var Viewport = /*#__PURE__*/function () {
|
|
364
358
|
}
|
365
359
|
return new ViewportColumnsCalculator({
|
366
360
|
viewportSize: width,
|
367
|
-
scrollOffset:
|
361
|
+
scrollOffset: pos,
|
368
362
|
totalItems: wtSettings.getSetting('totalColumns'),
|
369
363
|
itemSizeFn: function itemSizeFn(sourceCol) {
|
370
364
|
return wtTable.getColumnWidth(sourceCol);
|
@@ -374,7 +368,8 @@ var Viewport = /*#__PURE__*/function () {
|
|
374
368
|
stretchMode: wtSettings.getSetting('stretchH'),
|
375
369
|
stretchingItemWidthFn: function stretchingItemWidthFn(stretchedWidth, column) {
|
376
370
|
return wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column);
|
377
|
-
}
|
371
|
+
},
|
372
|
+
inlineStartOffset: this.dataAccessObject.inlineStartParentOffset
|
378
373
|
});
|
379
374
|
}
|
380
375
|
|
@@ -434,11 +429,12 @@ var Viewport = /*#__PURE__*/function () {
|
|
434
429
|
return false;
|
435
430
|
}
|
436
431
|
var startRow = proposedRowsVisibleCalculator.startRow,
|
437
|
-
endRow = proposedRowsVisibleCalculator.endRow
|
432
|
+
endRow = proposedRowsVisibleCalculator.endRow,
|
433
|
+
isVisibleInTrimmingContainer = proposedRowsVisibleCalculator.isVisibleInTrimmingContainer;
|
438
434
|
|
439
435
|
// if there are no fully visible rows at all, return false
|
440
436
|
if (startRow === null && endRow === null) {
|
441
|
-
return
|
437
|
+
return !isVisibleInTrimmingContainer;
|
442
438
|
}
|
443
439
|
var _this$rowsRenderCalcu = this.rowsRenderCalculator,
|
444
440
|
renderedStartRow = _this$rowsRenderCalcu.startRow,
|
@@ -466,11 +462,12 @@ var Viewport = /*#__PURE__*/function () {
|
|
466
462
|
return false;
|
467
463
|
}
|
468
464
|
var startColumn = proposedColumnsVisibleCalculator.startColumn,
|
469
|
-
endColumn = proposedColumnsVisibleCalculator.endColumn
|
465
|
+
endColumn = proposedColumnsVisibleCalculator.endColumn,
|
466
|
+
isVisibleInTrimmingContainer = proposedColumnsVisibleCalculator.isVisibleInTrimmingContainer;
|
470
467
|
|
471
468
|
// if there are no fully visible columns at all, return false
|
472
469
|
if (startColumn === null && endColumn === null) {
|
473
|
-
return
|
470
|
+
return !isVisibleInTrimmingContainer;
|
474
471
|
}
|
475
472
|
var _this$columnsRenderCa = this.columnsRenderCalculator,
|
476
473
|
renderedStartColumn = _this$columnsRenderCa.startColumn,
|