handsontable 0.0.0-next-d82e84a-20240117 → 0.0.0-next-40cdda4-20240118
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/core/_base.js +12 -0
- package/3rdparty/walkontable/src/core/_base.mjs +12 -0
- package/3rdparty/walkontable/src/scroll.js +125 -98
- package/3rdparty/walkontable/src/scroll.mjs +127 -100
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
- package/3rdparty/walkontable/src/table.js +2 -0
- package/3rdparty/walkontable/src/table.mjs +2 -0
- package/3rdparty/walkontable/src/viewport.js +9 -0
- package/3rdparty/walkontable/src/viewport.mjs +10 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/index.js +6 -0
- package/core/index.mjs +2 -1
- package/core/viewportScroll/index.js +65 -0
- package/core/viewportScroll/index.mjs +61 -0
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
- package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
- package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
- package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
- package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
- package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
- package/core.js +11 -52
- package/core.mjs +12 -53
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1577 -1073
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +41 -41
- package/dist/handsontable.js +1579 -1075
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +16 -16
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/selection/mouseEventHandler.js +4 -0
- package/selection/mouseEventHandler.mjs +4 -0
- package/selection/selection.js +63 -4
- package/selection/selection.mjs +63 -4
- package/tableView.js +76 -0
- package/tableView.mjs +76 -0
@@ -318,12 +318,18 @@ class CoreAbstract {
|
|
318
318
|
get startColumnVisible() {
|
319
319
|
return wot.wtViewport.columnsVisibleCalculator.startColumn;
|
320
320
|
},
|
321
|
+
get startColumnPartiallyVisible() {
|
322
|
+
return wot.wtViewport.columnsPartiallyVisibleCalculator.startColumn;
|
323
|
+
},
|
321
324
|
get endColumnRendered() {
|
322
325
|
return wot.wtViewport.columnsRenderCalculator.endColumn;
|
323
326
|
},
|
324
327
|
get endColumnVisible() {
|
325
328
|
return wot.wtViewport.columnsVisibleCalculator.endColumn;
|
326
329
|
},
|
330
|
+
get endColumnPartiallyVisible() {
|
331
|
+
return wot.wtViewport.columnsPartiallyVisibleCalculator.endColumn;
|
332
|
+
},
|
327
333
|
get countColumnsRendered() {
|
328
334
|
return wot.wtViewport.columnsRenderCalculator.count;
|
329
335
|
},
|
@@ -336,12 +342,18 @@ class CoreAbstract {
|
|
336
342
|
get startRowVisible() {
|
337
343
|
return wot.wtViewport.rowsVisibleCalculator.startRow;
|
338
344
|
},
|
345
|
+
get startRowPartiallyVisible() {
|
346
|
+
return wot.wtViewport.rowsPartiallyVisibleCalculator.startRow;
|
347
|
+
},
|
339
348
|
get endRowRendered() {
|
340
349
|
return wot.wtViewport.rowsRenderCalculator.endRow;
|
341
350
|
},
|
342
351
|
get endRowVisible() {
|
343
352
|
return wot.wtViewport.rowsVisibleCalculator.endRow;
|
344
353
|
},
|
354
|
+
get endRowPartiallyVisible() {
|
355
|
+
return wot.wtViewport.rowsPartiallyVisibleCalculator.endRow;
|
356
|
+
},
|
345
357
|
get countRowsRendered() {
|
346
358
|
return wot.wtViewport.rowsRenderCalculator.count;
|
347
359
|
},
|
@@ -314,12 +314,18 @@ export default class CoreAbstract {
|
|
314
314
|
get startColumnVisible() {
|
315
315
|
return wot.wtViewport.columnsVisibleCalculator.startColumn;
|
316
316
|
},
|
317
|
+
get startColumnPartiallyVisible() {
|
318
|
+
return wot.wtViewport.columnsPartiallyVisibleCalculator.startColumn;
|
319
|
+
},
|
317
320
|
get endColumnRendered() {
|
318
321
|
return wot.wtViewport.columnsRenderCalculator.endColumn;
|
319
322
|
},
|
320
323
|
get endColumnVisible() {
|
321
324
|
return wot.wtViewport.columnsVisibleCalculator.endColumn;
|
322
325
|
},
|
326
|
+
get endColumnPartiallyVisible() {
|
327
|
+
return wot.wtViewport.columnsPartiallyVisibleCalculator.endColumn;
|
328
|
+
},
|
323
329
|
get countColumnsRendered() {
|
324
330
|
return wot.wtViewport.columnsRenderCalculator.count;
|
325
331
|
},
|
@@ -332,12 +338,18 @@ export default class CoreAbstract {
|
|
332
338
|
get startRowVisible() {
|
333
339
|
return wot.wtViewport.rowsVisibleCalculator.startRow;
|
334
340
|
},
|
341
|
+
get startRowPartiallyVisible() {
|
342
|
+
return wot.wtViewport.rowsPartiallyVisibleCalculator.startRow;
|
343
|
+
},
|
335
344
|
get endRowRendered() {
|
336
345
|
return wot.wtViewport.rowsRenderCalculator.endRow;
|
337
346
|
},
|
338
347
|
get endRowVisible() {
|
339
348
|
return wot.wtViewport.rowsVisibleCalculator.endRow;
|
340
349
|
},
|
350
|
+
get endRowPartiallyVisible() {
|
351
|
+
return wot.wtViewport.rowsPartiallyVisibleCalculator.endRow;
|
352
|
+
},
|
341
353
|
get countRowsRendered() {
|
342
354
|
return wot.wtViewport.rowsRenderCalculator.count;
|
343
355
|
},
|
@@ -3,40 +3,43 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _element = require("../../../helpers/dom/element");
|
6
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
7
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
6
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
8
10
|
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); }
|
11
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
9
12
|
/**
|
10
13
|
* @class Scroll
|
11
14
|
*/
|
15
|
+
var _getLastColumnIndex = /*#__PURE__*/new WeakSet();
|
16
|
+
var _getLastRowIndex = /*#__PURE__*/new WeakSet();
|
12
17
|
class Scroll {
|
13
18
|
/**
|
14
19
|
* @param {ScrollDao} dataAccessObject Tha data access object.
|
15
20
|
*/
|
16
21
|
constructor(dataAccessObject) {
|
17
22
|
/**
|
18
|
-
*
|
23
|
+
* Get last visible row based on virtual dom and how table is visible in browser window viewport.
|
19
24
|
*
|
20
|
-
* @
|
21
|
-
* @
|
25
|
+
* @param {number} lastRowIndex The last visible row index.
|
26
|
+
* @returns {number}
|
22
27
|
*/
|
23
|
-
|
28
|
+
_classPrivateMethodInitSpec(this, _getLastRowIndex);
|
24
29
|
/**
|
25
|
-
*
|
26
|
-
* (left or right) for a next horizontal scroll.
|
30
|
+
* Get last visible column based on virtual dom and how table is visible in browser window viewport.
|
27
31
|
*
|
28
|
-
* @
|
29
|
-
* @
|
32
|
+
* @param {number} lastColumnIndex The last visible column index.
|
33
|
+
* @returns {number}
|
30
34
|
*/
|
31
|
-
|
35
|
+
_classPrivateMethodInitSpec(this, _getLastColumnIndex);
|
32
36
|
/**
|
33
|
-
*
|
34
|
-
* (top or bottom) for a next vertical scroll.
|
37
|
+
* The data access object.
|
35
38
|
*
|
36
39
|
* @protected
|
37
|
-
* @type {
|
40
|
+
* @type {ScrollDao}
|
38
41
|
*/
|
39
|
-
_defineProperty(this, "
|
42
|
+
_defineProperty(this, "dataAccessObject", void 0);
|
40
43
|
this.dataAccessObject = dataAccessObject;
|
41
44
|
}
|
42
45
|
|
@@ -74,8 +77,6 @@ class Scroll {
|
|
74
77
|
if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
|
75
78
|
return false;
|
76
79
|
}
|
77
|
-
const firstVisibleColumn = this.getFirstVisibleColumn();
|
78
|
-
const lastVisibleColumn = this.getLastVisibleColumn();
|
79
80
|
const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
|
80
81
|
const {
|
81
82
|
fixedColumnsStart,
|
@@ -87,20 +88,14 @@ class Scroll {
|
|
87
88
|
if (autoSnapping && column < fixedColumnsStart) {
|
88
89
|
return false;
|
89
90
|
}
|
90
|
-
let result = false;
|
91
91
|
column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
if (
|
96
|
-
result = inlineStartOverlay.scrollTo(column, autoSnapping ? column > this.lastScrolledColumnPos : snapToRight);
|
97
|
-
} else if (autoSnapping && (column < firstVisibleColumn || column > lastVisibleColumn) || !autoSnapping) {
|
92
|
+
const firstColumn = this.getFirstVisibleColumn();
|
93
|
+
const lastColumn = this.getLastVisibleColumn();
|
94
|
+
let result = false;
|
95
|
+
if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
|
98
96
|
// if there is at least one fully visible column determine the snapping direction based on
|
99
97
|
// that columns or by snapToRight/snapToLeft flags, if provided.
|
100
|
-
result = inlineStartOverlay.scrollTo(column, autoSnapping ? column
|
101
|
-
}
|
102
|
-
if (result) {
|
103
|
-
this.lastScrolledColumnPos = column;
|
98
|
+
result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
|
104
99
|
}
|
105
100
|
return result;
|
106
101
|
}
|
@@ -123,8 +118,6 @@ class Scroll {
|
|
123
118
|
if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
|
124
119
|
return false;
|
125
120
|
}
|
126
|
-
const firstVisibleRow = this.getFirstVisibleRow();
|
127
|
-
const lastVisibleRow = this.getLastVisibleRow();
|
128
121
|
const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
|
129
122
|
const {
|
130
123
|
fixedRowsBottom,
|
@@ -137,20 +130,14 @@ class Scroll {
|
|
137
130
|
if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
|
138
131
|
return false;
|
139
132
|
}
|
140
|
-
let result = false;
|
141
133
|
row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
if (
|
146
|
-
result = topOverlay.scrollTo(row, autoSnapping ? row > this.lastScrolledRowPos : snapToBottom);
|
147
|
-
} else if (autoSnapping && (row < firstVisibleRow || row > lastVisibleRow) || !autoSnapping) {
|
134
|
+
const firstRow = this.getFirstVisibleRow();
|
135
|
+
const lastRow = this.getLastVisibleRow();
|
136
|
+
let result = false;
|
137
|
+
if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
|
148
138
|
// if there is at least one fully visible row determine the snapping direction based on
|
149
139
|
// that rows or by snapToTop/snapToBottom flags, if provided.
|
150
|
-
result = topOverlay.scrollTo(row, autoSnapping ? row
|
151
|
-
}
|
152
|
-
if (result) {
|
153
|
-
this.lastScrolledRowPos = row;
|
140
|
+
result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
|
154
141
|
}
|
155
142
|
return result;
|
156
143
|
}
|
@@ -170,33 +157,25 @@ class Scroll {
|
|
170
157
|
* @returns {number}
|
171
158
|
*/
|
172
159
|
getLastVisibleRow() {
|
173
|
-
|
174
|
-
|
175
|
-
wtTable,
|
176
|
-
wtViewport,
|
177
|
-
totalRows,
|
178
|
-
rootWindow
|
179
|
-
} = this.dataAccessObject;
|
180
|
-
let lastVisibleRow = wtTable.getLastVisibleRow();
|
181
|
-
if (topOverlay.mainTableScrollableElement === rootWindow) {
|
182
|
-
const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
|
183
|
-
const windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow);
|
160
|
+
return _classPrivateMethodGet(this, _getLastRowIndex, _getLastRowIndex2).call(this, this.dataAccessObject.wtTable.getLastVisibleRow());
|
161
|
+
}
|
184
162
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
163
|
+
/**
|
164
|
+
* Get first partially visible row based on virtual dom and how table is visible in browser window viewport.
|
165
|
+
*
|
166
|
+
* @returns {number}
|
167
|
+
*/
|
168
|
+
getFirstPartiallyVisibleRow() {
|
169
|
+
return this.dataAccessObject.wtTable.getFirstPartiallyVisibleRow();
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Get last visible row based on virtual dom and how table is visible in browser window viewport.
|
174
|
+
*
|
175
|
+
* @returns {number}
|
176
|
+
*/
|
177
|
+
getLastPartiallyVisibleRow() {
|
178
|
+
return _classPrivateMethodGet(this, _getLastRowIndex, _getLastRowIndex2).call(this, this.dataAccessObject.wtTable.getLastPartiallyVisibleRow());
|
200
179
|
}
|
201
180
|
|
202
181
|
/**
|
@@ -214,44 +193,92 @@ class Scroll {
|
|
214
193
|
* @returns {number}
|
215
194
|
*/
|
216
195
|
getLastVisibleColumn() {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
196
|
+
return _classPrivateMethodGet(this, _getLastColumnIndex, _getLastColumnIndex2).call(this, this.dataAccessObject.wtTable.getLastVisibleColumn());
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Get first partially visible column based on virtual dom and how table is visible in browser window viewport.
|
201
|
+
*
|
202
|
+
* @returns {number}
|
203
|
+
*/
|
204
|
+
getFirstPartiallyVisibleColumn() {
|
205
|
+
return this.dataAccessObject.wtTable.getFirstPartiallyVisibleColumn();
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Get last partially visible column based on virtual dom and how table is visible in browser window viewport.
|
210
|
+
*
|
211
|
+
* @returns {number}
|
212
|
+
*/
|
213
|
+
getLastPartiallyVisibleColumn() {
|
214
|
+
return _classPrivateMethodGet(this, _getLastColumnIndex, _getLastColumnIndex2).call(this, this.dataAccessObject.wtTable.getLastPartiallyVisibleColumn());
|
215
|
+
}
|
216
|
+
}
|
217
|
+
function _getLastColumnIndex2(lastColumnIndex) {
|
218
|
+
const {
|
219
|
+
wtSettings,
|
220
|
+
inlineStartOverlay,
|
221
|
+
wtTable,
|
222
|
+
wtViewport,
|
223
|
+
totalColumns,
|
224
|
+
rootWindow
|
225
|
+
} = this.dataAccessObject;
|
226
|
+
if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
|
227
|
+
const isRtl = wtSettings.getSetting('rtlMode');
|
228
|
+
let inlineStartRootElementOffset = null;
|
229
|
+
if (isRtl) {
|
230
|
+
const tableRect = wtTable.TABLE.getBoundingClientRect();
|
231
|
+
const rootDocument = this.dataAccessObject.rootWindow.document;
|
232
|
+
const docOffsetWidth = rootDocument.documentElement.offsetWidth;
|
233
|
+
inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
|
234
|
+
} else {
|
235
|
+
const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
|
236
|
+
inlineStartRootElementOffset = rootElementOffset.left;
|
237
|
+
}
|
238
|
+
const windowScrollLeft = Math.abs((0, _element.getScrollLeft)(rootWindow, rootWindow));
|
239
|
+
|
240
|
+
// Only calculate lastColumnIndex when table didn't filled (from right) whole viewport space
|
241
|
+
if (inlineStartRootElementOffset > windowScrollLeft) {
|
242
|
+
const windowWidth = (0, _element.innerWidth)(rootWindow);
|
243
|
+
let columnsWidth = wtViewport.getRowHeaderWidth();
|
244
|
+
for (let column = 1; column <= totalColumns; column++) {
|
245
|
+
columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
|
246
|
+
if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
|
247
|
+
// Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
|
248
|
+
lastColumnIndex = column - 2;
|
249
|
+
break;
|
250
|
+
}
|
237
251
|
}
|
238
|
-
|
252
|
+
}
|
253
|
+
}
|
254
|
+
return lastColumnIndex;
|
255
|
+
}
|
256
|
+
function _getLastRowIndex2(lastRowIndex) {
|
257
|
+
const {
|
258
|
+
topOverlay,
|
259
|
+
wtTable,
|
260
|
+
wtViewport,
|
261
|
+
totalRows,
|
262
|
+
rootWindow
|
263
|
+
} = this.dataAccessObject;
|
264
|
+
if (topOverlay.mainTableScrollableElement === rootWindow) {
|
265
|
+
const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
|
266
|
+
const windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow);
|
239
267
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
}
|
268
|
+
// Only calculate lastRowIndex when table didn't filled (from bottom) whole viewport space
|
269
|
+
if (rootElementOffset.top > windowScrollTop) {
|
270
|
+
const windowHeight = (0, _element.innerHeight)(rootWindow);
|
271
|
+
let rowsHeight = wtViewport.getColumnHeaderHeight();
|
272
|
+
for (let row = 1; row <= totalRows; row++) {
|
273
|
+
rowsHeight += topOverlay.sumCellSizes(row - 1, row);
|
274
|
+
if (rootElementOffset.top + rowsHeight - windowScrollTop >= windowHeight) {
|
275
|
+
// Return physical row - 1 (-2 because rangeEach gives row index + 1 - sumCellSizes requirements)
|
276
|
+
lastRowIndex = row - 2;
|
277
|
+
break;
|
251
278
|
}
|
252
279
|
}
|
253
280
|
}
|
254
|
-
return lastVisibleColumn;
|
255
281
|
}
|
282
|
+
return lastRowIndex;
|
256
283
|
}
|
257
284
|
var _default = exports.default = Scroll;
|