@openui5/sap.ui.table 1.123.1 → 1.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +9 -1
- package/package.json +3 -3
- package/src/sap/ui/table/.library +1 -1
- package/src/sap/ui/table/AnalyticalColumn.js +40 -40
- package/src/sap/ui/table/AnalyticalColumnMenu.js +11 -11
- package/src/sap/ui/table/AnalyticalTable.js +107 -107
- package/src/sap/ui/table/Column.js +83 -83
- package/src/sap/ui/table/ColumnMenu.js +54 -54
- package/src/sap/ui/table/CreationRow.js +29 -29
- package/src/sap/ui/table/CreationRowRenderer.js +21 -21
- package/src/sap/ui/table/Row.js +55 -56
- package/src/sap/ui/table/RowAction.js +27 -27
- package/src/sap/ui/table/RowActionItem.js +7 -7
- package/src/sap/ui/table/RowActionRenderer.js +3 -3
- package/src/sap/ui/table/RowSettings.js +28 -37
- package/src/sap/ui/table/Table.js +263 -266
- package/src/sap/ui/table/TablePersoController.js +46 -46
- package/src/sap/ui/table/TableRenderer.js +112 -113
- package/src/sap/ui/table/TreeTable.js +16 -16
- package/src/sap/ui/table/designtime/Table.designtime.js +2 -2
- package/src/sap/ui/table/extensions/Accessibility.js +185 -181
- package/src/sap/ui/table/extensions/AccessibilityRender.js +15 -15
- package/src/sap/ui/table/extensions/DragAndDrop.js +47 -47
- package/src/sap/ui/table/extensions/ExtensionBase.js +9 -9
- package/src/sap/ui/table/extensions/Keyboard.js +40 -40
- package/src/sap/ui/table/extensions/KeyboardDelegate.js +257 -264
- package/src/sap/ui/table/extensions/Pointer.js +108 -109
- package/src/sap/ui/table/extensions/Scrolling.js +289 -285
- package/src/sap/ui/table/extensions/ScrollingIOS.js +50 -50
- package/src/sap/ui/table/extensions/Synchronization.js +32 -32
- package/src/sap/ui/table/library.js +12 -12
- package/src/sap/ui/table/menus/ColumnHeaderMenuAdapter.js +9 -9
- package/src/sap/ui/table/menus/LegacyColumnMenuAdapter.js +35 -37
- package/src/sap/ui/table/menus/MobileColumnHeaderMenuAdapter.js +23 -23
- package/src/sap/ui/table/messagebundle_sh.properties +9 -9
- package/src/sap/ui/table/plugins/BindingSelection.js +26 -25
- package/src/sap/ui/table/plugins/MultiSelectionPlugin.js +77 -32
- package/src/sap/ui/table/plugins/ODataV4Selection.js +81 -35
- package/src/sap/ui/table/plugins/PluginBase.js +12 -12
- package/src/sap/ui/table/plugins/SelectionModelSelection.js +13 -12
- package/src/sap/ui/table/plugins/SelectionPlugin.js +3 -3
- package/src/sap/ui/table/plugins/V4Aggregation.js +38 -38
- package/src/sap/ui/table/rowmodes/Auto.js +59 -61
- package/src/sap/ui/table/rowmodes/Fixed.js +18 -18
- package/src/sap/ui/table/rowmodes/Interactive.js +42 -44
- package/src/sap/ui/table/rowmodes/RowMode.js +64 -63
- package/src/sap/ui/table/rowmodes/Type.js +1 -1
- package/src/sap/ui/table/rowmodes/Variable.js +4 -4
- package/src/sap/ui/table/rules/Accessibility.support.js +15 -16
- package/src/sap/ui/table/rules/Binding.support.js +11 -11
- package/src/sap/ui/table/rules/ColumnTemplate.support.js +10 -10
- package/src/sap/ui/table/rules/Plugins.support.js +7 -7
- package/src/sap/ui/table/rules/Rows.support.js +29 -29
- package/src/sap/ui/table/rules/TableHelper.support.js +10 -10
- package/src/sap/ui/table/themes/base/library.source.less +2 -0
- package/src/sap/ui/table/utils/TableUtils.js +130 -128
- package/src/sap/ui/table/utils/_BindingUtils.js +7 -7
- package/src/sap/ui/table/utils/_ColumnUtils.js +98 -97
- package/src/sap/ui/table/utils/_GroupingUtils.js +56 -56
- package/src/sap/ui/table/utils/_HookUtils.js +26 -26
- package/src/sap/ui/table/utils/_MenuUtils.js +19 -19
|
@@ -17,9 +17,9 @@ sap.ui.define([
|
|
|
17
17
|
], function(ExtensionBase, TableUtils, library, Device, Interaction, Log, jQuery) {
|
|
18
18
|
"use strict";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const SharedDomRef = library.SharedDomRef;
|
|
21
|
+
const Hook = TableUtils.Hook.Keys;
|
|
22
|
+
const _private = TableUtils.createWeakMapFacade();
|
|
23
23
|
|
|
24
24
|
/*
|
|
25
25
|
* Maximum width/height of elements in pixel:
|
|
@@ -36,7 +36,7 @@ sap.ui.define([
|
|
|
36
36
|
* @constant
|
|
37
37
|
* @type {int}
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
const MAX_VERTICAL_SCROLL_HEIGHT = 1000000;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The amount of default row heights reserved to scroll the final vertical overflow.
|
|
@@ -46,7 +46,7 @@ sap.ui.define([
|
|
|
46
46
|
* @constant
|
|
47
47
|
* @type {int}
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
const VERTICAL_OVERFLOW_BUFFER_LENGTH = 2; // Must be >= 1! A buffer is always required, because at least one row is always in the buffer.
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Scroll directions.
|
|
@@ -54,7 +54,7 @@ sap.ui.define([
|
|
|
54
54
|
* @enum {string}
|
|
55
55
|
* @memberOf sap.ui.table.extensions.Scrolling
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
const ScrollDirection = {
|
|
58
58
|
HORIZONAL: "HORIZONTAL",
|
|
59
59
|
VERTICAL: "VERTICAL",
|
|
60
60
|
/** Both horizontal and vertical scroll direction. */
|
|
@@ -118,10 +118,10 @@ sap.ui.define([
|
|
|
118
118
|
* @constructor
|
|
119
119
|
*/
|
|
120
120
|
function Process(fnExecutor, oProcessInfo) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
let bRunning = true;
|
|
122
|
+
let bCancelled = false;
|
|
123
|
+
const aCancelListeners = [];
|
|
124
|
+
const oProcessInterface = {
|
|
125
125
|
cancel: function() {
|
|
126
126
|
if (this.isCancelled() || !this.isRunning()) {
|
|
127
127
|
return;
|
|
@@ -129,7 +129,7 @@ sap.ui.define([
|
|
|
129
129
|
|
|
130
130
|
bCancelled = true;
|
|
131
131
|
|
|
132
|
-
for (
|
|
132
|
+
for (let i = 0; i < aCancelListeners.length; i++) {
|
|
133
133
|
aCancelListeners[i]();
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -149,7 +149,7 @@ sap.ui.define([
|
|
|
149
149
|
},
|
|
150
150
|
onPromiseCreated: function(oPromise) {}
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
let pCancellablePromise;
|
|
153
153
|
|
|
154
154
|
log("Process started: " + oProcessInfo.id);
|
|
155
155
|
|
|
@@ -321,8 +321,8 @@ sap.ui.define([
|
|
|
321
321
|
* @param {int} iRows The number of rows to scroll.
|
|
322
322
|
*/
|
|
323
323
|
ScrollPosition.prototype.scrollRows = function(iRows) {
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
const iNewIndex = this.getIndex() + iRows;
|
|
325
|
+
let iNewOffset = this.getOffset();
|
|
326
326
|
|
|
327
327
|
if (!this.isOffsetInPixel() || iNewIndex < 0) {
|
|
328
328
|
iNewOffset = 0;
|
|
@@ -338,7 +338,7 @@ sap.ui.define([
|
|
|
338
338
|
/**
|
|
339
339
|
* Helper for vertical scroll update processes.
|
|
340
340
|
*/
|
|
341
|
-
|
|
341
|
+
const VerticalScrollProcess = {
|
|
342
342
|
UpdateFromFirstVisibleRow: {id: "UpdateFromFirstVisibleRow", rank: 6},
|
|
343
343
|
UpdateFromScrollPosition: {id: "UpdateFromScrollPosition", rank: 5},
|
|
344
344
|
RestoreScrollPosition: {id: "RestoreScrollPosition", rank: 4},
|
|
@@ -348,8 +348,8 @@ sap.ui.define([
|
|
|
348
348
|
UpdateFromViewport: {id: "UpdateFromViewport", rank: 1},
|
|
349
349
|
|
|
350
350
|
canStart: function(oTable, oProcessInfo) {
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
const pCurrentProcess = _private(oTable).pVerticalScrollUpdateProcess;
|
|
352
|
+
const oCurrentProcessInfo = pCurrentProcess ? pCurrentProcess.getInfo() : null;
|
|
353
353
|
|
|
354
354
|
if (pCurrentProcess && pCurrentProcess.isRunning() && oCurrentProcessInfo.rank > oProcessInfo.rank) {
|
|
355
355
|
log("Cannot start update process " + oProcessInfo.id
|
|
@@ -380,27 +380,27 @@ sap.ui.define([
|
|
|
380
380
|
* @see ExtensionDelegate#onAfterRendering
|
|
381
381
|
* @private
|
|
382
382
|
*/
|
|
383
|
-
|
|
383
|
+
const HorizontalScrollingHelper = {
|
|
384
384
|
/**
|
|
385
385
|
* The scrollbar's scroll event handler.
|
|
386
386
|
*
|
|
387
387
|
* @param {jQuery.Event} oEvent The event object.
|
|
388
388
|
*/
|
|
389
389
|
onScrollbarScroll: function(oEvent) {
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
const iNewScrollLeft = oEvent.target.scrollLeft;
|
|
391
|
+
const iOldScrollLeft = oEvent.target._scrollLeft;
|
|
392
392
|
|
|
393
393
|
// For interaction detection.
|
|
394
394
|
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
|
|
395
395
|
|
|
396
396
|
if (iNewScrollLeft !== iOldScrollLeft) {
|
|
397
|
-
|
|
397
|
+
const aScrollAreas = HorizontalScrollingHelper.getScrollAreas(this);
|
|
398
398
|
|
|
399
399
|
oEvent.target._scrollLeft = iNewScrollLeft;
|
|
400
400
|
|
|
401
401
|
// Synchronize the scroll positions.
|
|
402
|
-
for (
|
|
403
|
-
|
|
402
|
+
for (let i = 0; i < aScrollAreas.length; i++) {
|
|
403
|
+
const oScrollArea = aScrollAreas[i];
|
|
404
404
|
|
|
405
405
|
if (oScrollArea !== oEvent.target && oScrollArea.scrollLeft !== iNewScrollLeft) {
|
|
406
406
|
oScrollArea.scrollLeft = iNewScrollLeft;
|
|
@@ -419,21 +419,21 @@ sap.ui.define([
|
|
|
419
419
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
420
420
|
*/
|
|
421
421
|
restoreScrollPosition: function(oTable) {
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
423
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
424
424
|
|
|
425
425
|
if (oHSb && _private(oTable).iHorizontalScrollPosition !== null) {
|
|
426
|
-
|
|
426
|
+
const aScrollTargets = HorizontalScrollingHelper.getScrollAreas(oTable);
|
|
427
427
|
|
|
428
|
-
for (
|
|
429
|
-
|
|
428
|
+
for (let i = 0; i < aScrollTargets.length; i++) {
|
|
429
|
+
const oScrollTarget = aScrollTargets[i];
|
|
430
430
|
delete oScrollTarget._scrollLeft;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
if (oHSb.scrollLeft !== _private(oTable).iHorizontalScrollPosition) {
|
|
434
434
|
oHSb.scrollLeft = _private(oTable).iHorizontalScrollPosition;
|
|
435
435
|
} else {
|
|
436
|
-
|
|
436
|
+
const oEvent = jQuery.Event("scroll");
|
|
437
437
|
oEvent.target = oHSb;
|
|
438
438
|
HorizontalScrollingHelper.onScrollbarScroll.call(oTable, oEvent);
|
|
439
439
|
}
|
|
@@ -446,22 +446,22 @@ sap.ui.define([
|
|
|
446
446
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
447
447
|
*/
|
|
448
448
|
updateScrollbar: function(oTable) {
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
450
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
451
451
|
|
|
452
452
|
if (!oHSb) {
|
|
453
453
|
return;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
456
|
+
const mTableSizes = oTable._collectTableSizes();
|
|
457
|
+
const $Table = oTable.$();
|
|
458
|
+
let iColsWidth = mTableSizes.tableCtrlScrollWidth;
|
|
459
459
|
|
|
460
460
|
if (Device.browser.safari) {
|
|
461
461
|
iColsWidth = Math.max(iColsWidth, oTable._getColumnsWidth(oTable.getComputedFixedColumnCount()));
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
|
|
464
|
+
const bHorizontalScrollbarRequired = iColsWidth > mTableSizes.tableCtrlScrWidth;
|
|
465
465
|
|
|
466
466
|
if (bHorizontalScrollbarRequired) {
|
|
467
467
|
// Show the horizontal scrollbar, if it is not already visible.
|
|
@@ -470,13 +470,13 @@ sap.ui.define([
|
|
|
470
470
|
oHSb.classList.remove("sapUiTableHidden");
|
|
471
471
|
|
|
472
472
|
if (Device.browser.safari) {
|
|
473
|
-
|
|
473
|
+
const $sapUiTableColHdr = $Table.find(".sapUiTableCtrlScroll, .sapUiTableColHdrScr > .sapUiTableColHdr");
|
|
474
474
|
// min-width on table elements does not work for safari
|
|
475
475
|
$sapUiTableColHdr.outerWidth(iColsWidth);
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
-
|
|
479
|
+
let iScrollPadding = mTableSizes.tableCtrlFixedWidth;
|
|
480
480
|
if ($Table.find(".sapUiTableRowHdrScr").length > 0) {
|
|
481
481
|
iScrollPadding += mTableSizes.tableRowHdrScrWidth;
|
|
482
482
|
}
|
|
@@ -489,7 +489,7 @@ sap.ui.define([
|
|
|
489
489
|
oHSb.style.marginRight = "";
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
|
|
492
|
+
const oHSbContent = oTable.getDomRef("hsb-content");
|
|
493
493
|
if (oHSbContent) {
|
|
494
494
|
oHSbContent.style.width = iColsWidth + "px";
|
|
495
495
|
}
|
|
@@ -521,15 +521,15 @@ sap.ui.define([
|
|
|
521
521
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
522
522
|
*/
|
|
523
523
|
addEventListeners: function(oTable) {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
525
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
526
|
+
const aScrollAreas = HorizontalScrollingHelper.getScrollAreas(oTable);
|
|
527
527
|
|
|
528
528
|
if (!oScrollExtension._onHorizontalScrollEventHandler) {
|
|
529
529
|
oScrollExtension._onHorizontalScrollEventHandler = HorizontalScrollingHelper.onScrollbarScroll.bind(oTable);
|
|
530
530
|
}
|
|
531
531
|
|
|
532
|
-
for (
|
|
532
|
+
for (let i = 0; i < aScrollAreas.length; i++) {
|
|
533
533
|
aScrollAreas[i].addEventListener("scroll", oScrollExtension._onHorizontalScrollEventHandler);
|
|
534
534
|
}
|
|
535
535
|
|
|
@@ -547,12 +547,12 @@ sap.ui.define([
|
|
|
547
547
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
548
548
|
*/
|
|
549
549
|
removeEventListeners: function(oTable) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
550
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
551
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
552
|
+
const aScrollAreas = HorizontalScrollingHelper.getScrollAreas(oTable);
|
|
553
553
|
|
|
554
554
|
if (oScrollExtension._onHorizontalScrollEventHandler) {
|
|
555
|
-
for (
|
|
555
|
+
for (let i = 0; i < aScrollAreas.length; i++) {
|
|
556
556
|
aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onHorizontalScrollEventHandler);
|
|
557
557
|
delete aScrollAreas[i]._scrollLeft;
|
|
558
558
|
}
|
|
@@ -573,14 +573,14 @@ sap.ui.define([
|
|
|
573
573
|
* @private
|
|
574
574
|
*/
|
|
575
575
|
getScrollAreas: function(oTable) {
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
const oDomRef = oTable.getDomRef();
|
|
577
|
+
let aScrollableColumnAreas;
|
|
578
578
|
|
|
579
579
|
if (oDomRef) {
|
|
580
580
|
aScrollableColumnAreas = Array.prototype.slice.call(oTable.getDomRef().querySelectorAll(".sapUiTableCtrlScr"));
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
|
|
583
|
+
const aScrollAreas = [
|
|
584
584
|
oTable._getScrollExtension().getHorizontalScrollbar()
|
|
585
585
|
].concat(aScrollableColumnAreas);
|
|
586
586
|
|
|
@@ -598,7 +598,7 @@ sap.ui.define([
|
|
|
598
598
|
* @see ExtensionDelegate#onAfterRendering
|
|
599
599
|
* @private
|
|
600
600
|
*/
|
|
601
|
-
|
|
601
|
+
const VerticalScrollingHelper = {
|
|
602
602
|
/**
|
|
603
603
|
* Performs all necessary steps to scroll the table based on the table's <code>firstVisibleRow</code> property.
|
|
604
604
|
*
|
|
@@ -617,7 +617,7 @@ sap.ui.define([
|
|
|
617
617
|
};
|
|
618
618
|
|
|
619
619
|
if (bExpectRowsUpdatedEvent === true) {
|
|
620
|
-
|
|
620
|
+
const fnOnRowsUpdatedPreprocessor = function() {
|
|
621
621
|
log("VerticalScrollingHelper.performUpdateFromFirstVisibleRow (async: rows update)", oTable);
|
|
622
622
|
VerticalScrollingHelper._performUpdateFromFirstVisibleRow(oTable, oProcessInterface).then(resolve);
|
|
623
623
|
return false;
|
|
@@ -626,7 +626,7 @@ sap.ui.define([
|
|
|
626
626
|
VerticalScrollingHelper.addOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
627
627
|
|
|
628
628
|
oProcessInterface.addCancelListener(function() {
|
|
629
|
-
|
|
629
|
+
const bRemoved = VerticalScrollingHelper.removeOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
630
630
|
if (bRemoved) {
|
|
631
631
|
resolve();
|
|
632
632
|
}
|
|
@@ -671,7 +671,7 @@ sap.ui.define([
|
|
|
671
671
|
return;
|
|
672
672
|
}
|
|
673
673
|
|
|
674
|
-
|
|
674
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
675
675
|
|
|
676
676
|
log("VerticalScrollingHelper.performUpdateFromScrollPosition (async: firstVisibleRow update)", oTable);
|
|
677
677
|
|
|
@@ -786,9 +786,9 @@ sap.ui.define([
|
|
|
786
786
|
// For interaction detection.
|
|
787
787
|
Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent);
|
|
788
788
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
const nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome.
|
|
790
|
+
const nOldScrollTop = oEvent.target._scrollTop; // This is set in VerticalScrollingHelper.scrollScrollbar.
|
|
791
|
+
const bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop;
|
|
792
792
|
|
|
793
793
|
delete oEvent.target._scrollTop;
|
|
794
794
|
|
|
@@ -813,8 +813,8 @@ sap.ui.define([
|
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
815
|
|
|
816
|
-
|
|
817
|
-
|
|
816
|
+
const nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome.
|
|
817
|
+
const nOldScrollTop = oEvent.target._scrollTop; // This is set in VerticalScrollingHelper.scrollViewport.
|
|
818
818
|
|
|
819
819
|
delete oEvent.target._scrollTop;
|
|
820
820
|
|
|
@@ -841,12 +841,12 @@ sap.ui.define([
|
|
|
841
841
|
|
|
842
842
|
bSuppressRendering = bSuppressRendering === true;
|
|
843
843
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
844
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
845
|
+
const bOffsetIsInPercentageOfViewport = oScrollPosition.getOffsetType() === ScrollPosition.OffsetType.PercentageOfViewport;
|
|
846
|
+
const iNewIndex = oScrollPosition.getIndex();
|
|
847
|
+
const iOldIndex = oTable.getFirstVisibleRow();
|
|
848
|
+
const bNewIndexIsInBuffer = VerticalScrollingHelper.isIndexInBuffer(oTable, iNewIndex);
|
|
849
|
+
const bNewIndexIsTemporary = bNewIndexIsInBuffer || bOffsetIsInPercentageOfViewport;
|
|
850
850
|
|
|
851
851
|
// Depending on the row heights, it can happen that the index needs to be decreased if it is in the buffer, or it needs to be
|
|
852
852
|
// increased if the offset is specified in percentage of the viewport.
|
|
@@ -854,7 +854,7 @@ sap.ui.define([
|
|
|
854
854
|
// VerticalScrollingHelper.fixTemporaryFirstVisibleRow.
|
|
855
855
|
log("VerticalScrollingHelper.adjustFirstVisibleRowToScrollPosition:"
|
|
856
856
|
+ " Set \"firstVisibleRow\" from " + iOldIndex + " to " + iNewIndex, oTable);
|
|
857
|
-
|
|
857
|
+
const bExpectRowsUpdatedEvent = oTable._setFirstVisibleRowIndex(iNewIndex, {
|
|
858
858
|
onScroll: true,
|
|
859
859
|
suppressEvent: bNewIndexIsTemporary,
|
|
860
860
|
suppressRendering: bSuppressRendering
|
|
@@ -868,7 +868,7 @@ sap.ui.define([
|
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
return new Promise(function(resolve) {
|
|
871
|
-
|
|
871
|
+
const fnOnRowsUpdatedPreprocessor = function(oEvent) {
|
|
872
872
|
log("VerticalScrollingHelper.adjustFirstVisibleRowToScrollPosition (async: rows updated):"
|
|
873
873
|
+ " Reason " + oEvent.getParameters().reason, this);
|
|
874
874
|
if (bNewIndexIsTemporary) {
|
|
@@ -883,7 +883,7 @@ sap.ui.define([
|
|
|
883
883
|
|
|
884
884
|
if (oProcessInterface) {
|
|
885
885
|
oProcessInterface.addCancelListener(function() {
|
|
886
|
-
|
|
886
|
+
const bRemoved = VerticalScrollingHelper.removeOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
887
887
|
if (bRemoved) {
|
|
888
888
|
resolve();
|
|
889
889
|
}
|
|
@@ -909,34 +909,34 @@ sap.ui.define([
|
|
|
909
909
|
|
|
910
910
|
bForceFirstVisibleRowChangedEvent = bForceFirstVisibleRowChangedEvent === true;
|
|
911
911
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
912
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
913
|
+
const bOffsetIsInPercentageOfViewport = oScrollPosition.getOffsetType() === ScrollPosition.OffsetType.PercentageOfViewport;
|
|
914
|
+
const iIndex = oScrollPosition.getIndex();
|
|
915
|
+
const bIndexIsInBuffer = VerticalScrollingHelper.isIndexInBuffer(oTable, iIndex);
|
|
916
|
+
const bIndexIsTemporary = bIndexIsInBuffer || bOffsetIsInPercentageOfViewport;
|
|
917
917
|
|
|
918
918
|
if (!bIndexIsTemporary) {
|
|
919
919
|
log("VerticalScrollingHelper.fixTemporaryFirstVisibleRow: Aborted - The index is already final", oTable);
|
|
920
920
|
return Promise.resolve();
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
923
|
+
let iNewIndex = iIndex;
|
|
924
|
+
const iViewportScrollRange = VerticalScrollingHelper.getScrollRangeOfViewport(oTable);
|
|
925
|
+
const iMaxFirstRenderedRowIndex = oTable._getMaxFirstRenderedRowIndex();
|
|
926
|
+
const aRowHeights = oTable._aRowHeights;
|
|
927
|
+
let iRowIndex;
|
|
928
928
|
|
|
929
929
|
log("VerticalScrollingHelper.fixTemporaryFirstVisibleRow", oTable);
|
|
930
930
|
|
|
931
931
|
if (bOffsetIsInPercentageOfViewport) {
|
|
932
|
-
|
|
932
|
+
let nRemaining = iViewportScrollRange * oScrollPosition.getOffset();
|
|
933
933
|
|
|
934
934
|
if (bIndexIsInBuffer) {
|
|
935
935
|
iNewIndex = iMaxFirstRenderedRowIndex;
|
|
936
936
|
}
|
|
937
937
|
|
|
938
938
|
for (iRowIndex = 0; iRowIndex < aRowHeights.length; iRowIndex++) {
|
|
939
|
-
|
|
939
|
+
const nRemainingTemp = nRemaining - aRowHeights[iRowIndex];
|
|
940
940
|
|
|
941
941
|
if (nRemainingTemp >= 0) {
|
|
942
942
|
nRemaining = nRemainingTemp;
|
|
@@ -946,8 +946,8 @@ sap.ui.define([
|
|
|
946
946
|
}
|
|
947
947
|
}
|
|
948
948
|
} else if (bIndexIsInBuffer) {
|
|
949
|
-
|
|
950
|
-
|
|
949
|
+
const iTargetRowIndex = Math.max(0, Math.min(aRowHeights.length - 1, iIndex - iMaxFirstRenderedRowIndex));
|
|
950
|
+
let iViewportVirtualScrollTop = 0;
|
|
951
951
|
|
|
952
952
|
for (iRowIndex = 0; iRowIndex < iTargetRowIndex; iRowIndex++) {
|
|
953
953
|
iViewportVirtualScrollTop += aRowHeights[iRowIndex];
|
|
@@ -1002,33 +1002,33 @@ sap.ui.define([
|
|
|
1002
1002
|
return Promise.resolve();
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1005
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1006
|
+
const nScrollbarScrollTop = VerticalScrollingHelper.getScrollPositionOfScrollbar(oTable);
|
|
1007
|
+
const iScrollRange = VerticalScrollingHelper.getScrollRange(oTable);
|
|
1008
|
+
const nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(oTable);
|
|
1009
|
+
let iNewIndex = 0;
|
|
1010
|
+
let nNewOffset = 0;
|
|
1011
|
+
let sNewOffsetType = ScrollPosition.OffsetType.Percentage;
|
|
1012
|
+
let nIndex;
|
|
1013
1013
|
|
|
1014
1014
|
log("VerticalScrollingHelper.adjustScrollPositionToScrollbar", oTable);
|
|
1015
1015
|
|
|
1016
1016
|
if (TableUtils.isVariableRowHeightEnabled(oTable)) {
|
|
1017
1017
|
if (VerticalScrollingHelper.isScrollPositionOfScrollbarInBuffer(oTable)) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1018
|
+
const iBuffer = VerticalScrollingHelper.getScrollRangeBuffer(oTable);
|
|
1019
|
+
const iScrollRangeWithoutBuffer = iScrollRange - iBuffer;
|
|
1020
|
+
const nScrolledBuffer = nScrollbarScrollTop - iScrollRangeWithoutBuffer;
|
|
1021
|
+
const nScrolledBufferPercentage = nScrolledBuffer / iBuffer;
|
|
1022
1022
|
|
|
1023
1023
|
iNewIndex = oTable._getMaxFirstRenderedRowIndex();
|
|
1024
1024
|
|
|
1025
1025
|
if (VerticalScrollingHelper.isIndexInBuffer(oTable, oScrollPosition.getIndex())) {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1026
|
+
const iViewportScrollRange = VerticalScrollingHelper.getScrollRangeOfViewport(oTable);
|
|
1027
|
+
let nRemaining = iViewportScrollRange * nScrolledBufferPercentage;
|
|
1028
|
+
const aRowHeights = oTable._aRowHeights;
|
|
1029
1029
|
|
|
1030
|
-
for (
|
|
1031
|
-
|
|
1030
|
+
for (let iRowIndex = 0; iRowIndex < aRowHeights.length; iRowIndex++) {
|
|
1031
|
+
const nRemainingTemp = nRemaining - aRowHeights[iRowIndex];
|
|
1032
1032
|
|
|
1033
1033
|
if (nRemainingTemp >= 0) {
|
|
1034
1034
|
nRemaining = nRemainingTemp;
|
|
@@ -1052,8 +1052,8 @@ sap.ui.define([
|
|
|
1052
1052
|
// Calculation of the row index can be inaccurate if scrolled to the end. This can happen due to rounding errors in case of
|
|
1053
1053
|
// large data or when zoomed in Chrome. In this case the table cannot be scrolled to the last row. To overcome this issue, we
|
|
1054
1054
|
// consider the table to be scrolled to the end if the scroll position is less than 1 pixel away from the maximum.
|
|
1055
|
-
|
|
1056
|
-
|
|
1055
|
+
const nDistanceToMaximumScrollPosition = iScrollRange - nScrollbarScrollTop;
|
|
1056
|
+
const bScrolledToBottom = nDistanceToMaximumScrollPosition < 1;
|
|
1057
1057
|
|
|
1058
1058
|
if (bScrolledToBottom) {
|
|
1059
1059
|
iNewIndex = oTable._getMaxFirstVisibleRowIndex();
|
|
@@ -1083,16 +1083,16 @@ sap.ui.define([
|
|
|
1083
1083
|
return Promise.resolve();
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1086
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1087
|
+
const aRowHeights = oTable._aRowHeights;
|
|
1088
|
+
let iNewIndex = oTable._getFirstRenderedRowIndex();
|
|
1089
|
+
let iNewOffset = 0;
|
|
1090
|
+
let nRemaining = VerticalScrollingHelper.getScrollPositionOfViewport(oTable);
|
|
1091
1091
|
|
|
1092
1092
|
log("VerticalScrollingHelper.adjustScrollPositionToViewport", oTable);
|
|
1093
1093
|
|
|
1094
|
-
for (
|
|
1095
|
-
|
|
1094
|
+
for (let iRowIndex = 0; iRowIndex < aRowHeights.length; iRowIndex++) {
|
|
1095
|
+
const nRemainingTemp = nRemaining - aRowHeights[iRowIndex];
|
|
1096
1096
|
|
|
1097
1097
|
if (nRemainingTemp >= 0) {
|
|
1098
1098
|
nRemaining = nRemainingTemp;
|
|
@@ -1122,10 +1122,10 @@ sap.ui.define([
|
|
|
1122
1122
|
return Promise.resolve();
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1125
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1126
|
+
const oViewport = oTable.getDomRef("tableCCnt");
|
|
1127
|
+
const iViewportScrollRange = VerticalScrollingHelper.getScrollRangeOfViewport(oTable);
|
|
1128
|
+
const aRowHeights = oTable._aRowHeights;
|
|
1129
1129
|
|
|
1130
1130
|
if (!oViewport || !oTable.getBinding()) {
|
|
1131
1131
|
log("VerticalScrollingHelper.fixScrollPosition: Aborted - Viewport or binding not available", oTable);
|
|
@@ -1134,21 +1134,21 @@ sap.ui.define([
|
|
|
1134
1134
|
|
|
1135
1135
|
log("VerticalScrollingHelper.fixScrollPosition", oTable);
|
|
1136
1136
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1137
|
+
let iNewIndex = oScrollPosition.getIndex();
|
|
1138
|
+
let iNewOffset = oScrollPosition.getOffset();
|
|
1139
|
+
let iTargetRowIndex = 0;
|
|
1140
|
+
let iRowIndex;
|
|
1141
|
+
const iFirstRenderedRowIndex = oTable._getFirstRenderedRowIndex();
|
|
1142
1142
|
|
|
1143
1143
|
switch (oScrollPosition.getOffsetType()) {
|
|
1144
1144
|
case ScrollPosition.OffsetType.Pixel:
|
|
1145
|
-
case ScrollPosition.OffsetType.Percentage:
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1145
|
+
case ScrollPosition.OffsetType.Percentage: {
|
|
1146
|
+
const iIndex = oScrollPosition.getIndex();
|
|
1147
|
+
let iVirtualViewportScrollTop = 0;
|
|
1148
|
+
let iCurrentOffsetType = oScrollPosition.getOffsetType();
|
|
1149
1149
|
|
|
1150
1150
|
if (VerticalScrollingHelper.isIndexInBuffer(oTable, iIndex)) {
|
|
1151
|
-
|
|
1151
|
+
let iVirtualScrollTop = 0;
|
|
1152
1152
|
|
|
1153
1153
|
iTargetRowIndex = Math.max(0, Math.min(aRowHeights.length - 1, iIndex - iFirstRenderedRowIndex));
|
|
1154
1154
|
|
|
@@ -1181,11 +1181,12 @@ sap.ui.define([
|
|
|
1181
1181
|
iNewOffset -= iVirtualViewportScrollTop - iViewportScrollRange;
|
|
1182
1182
|
}
|
|
1183
1183
|
break;
|
|
1184
|
-
|
|
1185
|
-
|
|
1184
|
+
}
|
|
1185
|
+
case ScrollPosition.OffsetType.PercentageOfViewport: {
|
|
1186
|
+
let nRemaining = iViewportScrollRange * oScrollPosition.getOffset();
|
|
1186
1187
|
|
|
1187
1188
|
for (iRowIndex = 0; iRowIndex < aRowHeights.length; iRowIndex++) {
|
|
1188
|
-
|
|
1189
|
+
const nRemainingTemp = nRemaining - aRowHeights[iRowIndex];
|
|
1189
1190
|
|
|
1190
1191
|
if (nRemainingTemp >= 0) {
|
|
1191
1192
|
nRemaining = nRemainingTemp;
|
|
@@ -1197,6 +1198,7 @@ sap.ui.define([
|
|
|
1197
1198
|
}
|
|
1198
1199
|
}
|
|
1199
1200
|
break;
|
|
1201
|
+
}
|
|
1200
1202
|
default:
|
|
1201
1203
|
}
|
|
1202
1204
|
|
|
@@ -1223,11 +1225,11 @@ sap.ui.define([
|
|
|
1223
1225
|
return Promise.resolve();
|
|
1224
1226
|
}
|
|
1225
1227
|
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1228
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1229
|
+
const oViewport = oTable.getDomRef("tableCCnt");
|
|
1230
|
+
const iScrollRange = VerticalScrollingHelper.getScrollRangeOfViewport(oTable);
|
|
1231
|
+
const aRowHeights = oTable._aRowHeights;
|
|
1232
|
+
let iScrollTop = 0;
|
|
1231
1233
|
|
|
1232
1234
|
if (iScrollRange === 0) {
|
|
1233
1235
|
log("VerticalScrollingHelper.scrollViewport: Aborted - No overflow in viewport", oTable);
|
|
@@ -1239,16 +1241,17 @@ sap.ui.define([
|
|
|
1239
1241
|
log("VerticalScrollingHelper.scrollViewport", oTable);
|
|
1240
1242
|
|
|
1241
1243
|
switch (oScrollPosition.getOffsetType()) {
|
|
1242
|
-
case ScrollPosition.OffsetType.Pixel:
|
|
1243
|
-
|
|
1244
|
-
|
|
1244
|
+
case ScrollPosition.OffsetType.Pixel: {
|
|
1245
|
+
const iIndex = oScrollPosition.getIndex();
|
|
1246
|
+
const iTargetRowIndex = Math.max(0, Math.min(aRowHeights.length - 1, iIndex - oTable._getFirstRenderedRowIndex()));
|
|
1245
1247
|
|
|
1246
|
-
for (
|
|
1248
|
+
for (let iRowIndex = 0; iRowIndex < iTargetRowIndex; iRowIndex++) {
|
|
1247
1249
|
iScrollTop += aRowHeights[iRowIndex];
|
|
1248
1250
|
}
|
|
1249
1251
|
|
|
1250
1252
|
iScrollTop += oScrollPosition.getOffset();
|
|
1251
1253
|
break;
|
|
1254
|
+
}
|
|
1252
1255
|
default:
|
|
1253
1256
|
log("VerticalScrollingHelper.scrollViewport: The viewport can only be scrolled if the offset is in pixel", oTable);
|
|
1254
1257
|
return Promise.resolve();
|
|
@@ -1273,16 +1276,16 @@ sap.ui.define([
|
|
|
1273
1276
|
return Promise.resolve();
|
|
1274
1277
|
}
|
|
1275
1278
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1279
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1280
|
+
const iIndex = oScrollPosition.getIndex();
|
|
1281
|
+
const iBuffer = VerticalScrollingHelper.getScrollRangeBuffer(oTable);
|
|
1282
|
+
const iScrollRange = VerticalScrollingHelper.getScrollRange(oTable);
|
|
1283
|
+
const iScrollRangeWithoutBuffer = iScrollRange - iBuffer;
|
|
1284
|
+
let nScrollPosition = 0;
|
|
1285
|
+
let iScrollTop = 0;
|
|
1286
|
+
const iViewportScrollRange = VerticalScrollingHelper.getScrollRangeOfViewport(oTable);
|
|
1287
|
+
const aRowHeights = oTable._aRowHeights;
|
|
1288
|
+
let iTargetRowIndex;
|
|
1286
1289
|
|
|
1287
1290
|
log("VerticalScrollingHelper.scrollScrollbar", oTable);
|
|
1288
1291
|
|
|
@@ -1294,22 +1297,22 @@ sap.ui.define([
|
|
|
1294
1297
|
switch (oScrollPosition.getOffsetType()) {
|
|
1295
1298
|
case ScrollPosition.OffsetType.Pixel:
|
|
1296
1299
|
if (VerticalScrollingHelper.isIndexInBuffer(oTable, iIndex)) {
|
|
1297
|
-
|
|
1300
|
+
let iVirtualViewportScrollTop = 0;
|
|
1298
1301
|
|
|
1299
1302
|
iTargetRowIndex = Math.max(0, Math.min(aRowHeights.length - 1, iIndex - oTable._getMaxFirstRenderedRowIndex()));
|
|
1300
1303
|
|
|
1301
|
-
for (
|
|
1304
|
+
for (let iRowIndex = 0; iRowIndex < iTargetRowIndex; iRowIndex++) {
|
|
1302
1305
|
iVirtualViewportScrollTop += aRowHeights[iRowIndex];
|
|
1303
1306
|
}
|
|
1304
1307
|
|
|
1305
1308
|
iVirtualViewportScrollTop += Math.min(aRowHeights[iTargetRowIndex], oScrollPosition.getOffset());
|
|
1306
1309
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1310
|
+
const nScrolledBufferPercentage = Math.min(iVirtualViewportScrollTop / iViewportScrollRange, 1);
|
|
1311
|
+
const nScrolledBuffer = iBuffer * nScrolledBufferPercentage;
|
|
1309
1312
|
|
|
1310
1313
|
nScrollPosition = iScrollRangeWithoutBuffer + nScrolledBuffer;
|
|
1311
1314
|
} else {
|
|
1312
|
-
|
|
1315
|
+
const nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(oTable);
|
|
1313
1316
|
|
|
1314
1317
|
nScrollPosition = iIndex * nScrollRangeRowFraction;
|
|
1315
1318
|
iTargetRowIndex = Math.max(0, Math.min(aRowHeights.length - 1, iIndex - oTable._getFirstRenderedRowIndex()));
|
|
@@ -1331,7 +1334,7 @@ sap.ui.define([
|
|
|
1331
1334
|
iScrollTop = Math.round(nScrollPosition);
|
|
1332
1335
|
}
|
|
1333
1336
|
|
|
1334
|
-
|
|
1337
|
+
const oVSb = oTable._getScrollExtension().getVerticalScrollbar();
|
|
1335
1338
|
|
|
1336
1339
|
if (oVSb) {
|
|
1337
1340
|
log("VerticalScrollingHelper.scrollScrollbar: Scroll from " + oVSb.scrollTop + " to " + iScrollTop, oTable);
|
|
@@ -1351,8 +1354,8 @@ sap.ui.define([
|
|
|
1351
1354
|
* @returns {int} The vertical scroll range.
|
|
1352
1355
|
*/
|
|
1353
1356
|
getScrollRange: function(oTable) {
|
|
1354
|
-
|
|
1355
|
-
|
|
1357
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1358
|
+
const iVerticalScrollRange = oScrollExtension.getVerticalScrollHeight() - oScrollExtension.getVerticalScrollbarHeight();
|
|
1356
1359
|
return Math.max(0, iVerticalScrollRange);
|
|
1357
1360
|
},
|
|
1358
1361
|
|
|
@@ -1377,7 +1380,7 @@ sap.ui.define([
|
|
|
1377
1380
|
* @returns {number} The vertical scroll position.
|
|
1378
1381
|
*/
|
|
1379
1382
|
getScrollPositionOfScrollbar: function(oTable) {
|
|
1380
|
-
|
|
1383
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1381
1384
|
|
|
1382
1385
|
if (oScrollExtension.isVerticalScrollbarVisible()) {
|
|
1383
1386
|
return oScrollExtension.getVerticalScrollbar().scrollTop;
|
|
@@ -1393,7 +1396,7 @@ sap.ui.define([
|
|
|
1393
1396
|
* @returns {number} The scroll position.
|
|
1394
1397
|
*/
|
|
1395
1398
|
getScrollPositionOfViewport: function(oTable) {
|
|
1396
|
-
|
|
1399
|
+
const oViewport = oTable ? oTable.getDomRef("tableCCnt") : null;
|
|
1397
1400
|
return oViewport ? oViewport.scrollTop : 0;
|
|
1398
1401
|
},
|
|
1399
1402
|
|
|
@@ -1405,9 +1408,9 @@ sap.ui.define([
|
|
|
1405
1408
|
* @returns {number} The fraction of the vertical scroll range which corresponds to a row.
|
|
1406
1409
|
*/
|
|
1407
1410
|
getScrollRangeRowFraction: function(oTable) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1412
|
+
const iVirtualRowCount = oTable._getTotalRowCount() - oTable._getRowCounts()._fullsize;
|
|
1413
|
+
let iScrollRangeWithoutBuffer;
|
|
1411
1414
|
|
|
1412
1415
|
if (TableUtils.isVariableRowHeightEnabled(oTable)) {
|
|
1413
1416
|
iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable) - VerticalScrollingHelper.getScrollRangeBuffer(oTable);
|
|
@@ -1415,7 +1418,7 @@ sap.ui.define([
|
|
|
1415
1418
|
// The last row is part of the buffer. To correctly calculate the fraction of the scroll range allocated to a row, all rows must be
|
|
1416
1419
|
// considered. This is not the case if the scroll range is at its maximum, then the buffer must be excluded from calculation
|
|
1417
1420
|
// completely.
|
|
1418
|
-
|
|
1421
|
+
const bScrollRangeMaxedOut = oScrollExtension.getVerticalScrollHeight() === MAX_VERTICAL_SCROLL_HEIGHT;
|
|
1419
1422
|
if (!bScrollRangeMaxedOut) {
|
|
1420
1423
|
iScrollRangeWithoutBuffer += oTable._getBaseRowHeight();
|
|
1421
1424
|
}
|
|
@@ -1437,9 +1440,9 @@ sap.ui.define([
|
|
|
1437
1440
|
return false;
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
+
const iScrollRange = VerticalScrollingHelper.getScrollRange(oTable);
|
|
1444
|
+
const nScrollPosition = VerticalScrollingHelper.getScrollPositionOfScrollbar(oTable);
|
|
1445
|
+
const iScrollRangeBuffer = VerticalScrollingHelper.getScrollRangeBuffer(oTable);
|
|
1443
1446
|
|
|
1444
1447
|
return iScrollRange - nScrollPosition <= iScrollRangeBuffer;
|
|
1445
1448
|
},
|
|
@@ -1470,15 +1473,15 @@ sap.ui.define([
|
|
|
1470
1473
|
return 0;
|
|
1471
1474
|
}
|
|
1472
1475
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1476
|
+
let aRowHeights = oTable._aRowHeights;
|
|
1477
|
+
const iViewportHeight = oTable._getBaseRowHeight() * oTable._getRowCounts()._fullsize;
|
|
1475
1478
|
|
|
1476
1479
|
// Only sum rows filled with data, ignore empty rows.
|
|
1477
1480
|
if (oTable._getRowCounts()._fullsize >= oTable._getTotalRowCount()) {
|
|
1478
1481
|
aRowHeights = aRowHeights.slice(0, oTable._getTotalRowCount());
|
|
1479
1482
|
}
|
|
1480
1483
|
|
|
1481
|
-
|
|
1484
|
+
let iInnerVerticalScrollRange = aRowHeights.reduce(function(a, b) { return a + b; }, 0) - iViewportHeight;
|
|
1482
1485
|
if (iInnerVerticalScrollRange > 0) {
|
|
1483
1486
|
iInnerVerticalScrollRange = Math.ceil(iInnerVerticalScrollRange);
|
|
1484
1487
|
}
|
|
@@ -1515,7 +1518,7 @@ sap.ui.define([
|
|
|
1515
1518
|
return false;
|
|
1516
1519
|
}
|
|
1517
1520
|
|
|
1518
|
-
|
|
1521
|
+
const iIndex = _private(oTable).aOnRowsUpdatedPreprocessors.indexOf(fnPreprocessor);
|
|
1519
1522
|
|
|
1520
1523
|
if (iIndex > -1) {
|
|
1521
1524
|
_private(oTable).aOnRowsUpdatedPreprocessors.splice(iIndex, 1);
|
|
@@ -1539,8 +1542,8 @@ sap.ui.define([
|
|
|
1539
1542
|
if (_private(this).aOnRowsUpdatedPreprocessors.length > 0) {
|
|
1540
1543
|
log("VerticalScrollingHelper.onRowsUpdated (preprocessors)", this);
|
|
1541
1544
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1545
|
+
const bExecuteDefault = _private(this).aOnRowsUpdatedPreprocessors.reduce(function(bExecuteDefault, fnPreprocessor) {
|
|
1546
|
+
const _bExecuteDefault = fnPreprocessor.call(this, oEvent);
|
|
1544
1547
|
return !(bExecuteDefault && !_bExecuteDefault);
|
|
1545
1548
|
}, true);
|
|
1546
1549
|
|
|
@@ -1557,7 +1560,7 @@ sap.ui.define([
|
|
|
1557
1560
|
return;
|
|
1558
1561
|
}
|
|
1559
1562
|
|
|
1560
|
-
|
|
1563
|
+
const that = this;
|
|
1561
1564
|
|
|
1562
1565
|
VerticalScrollProcess.start(this, VerticalScrollProcess.OnRowsUpdated, function(resolve, reject, oProcessInterface) {
|
|
1563
1566
|
TableUtils.Hook.call(that, Hook.Signal, "StartTableUpdate");
|
|
@@ -1606,7 +1609,7 @@ sap.ui.define([
|
|
|
1606
1609
|
return;
|
|
1607
1610
|
}
|
|
1608
1611
|
|
|
1609
|
-
|
|
1612
|
+
const fnOnRowsUpdatedPreprocessor = function() {
|
|
1610
1613
|
log("VerticalScrollingHelper.restoreScrollPosition (async: rows updated)", oTable);
|
|
1611
1614
|
resolve();
|
|
1612
1615
|
return false;
|
|
@@ -1615,7 +1618,7 @@ sap.ui.define([
|
|
|
1615
1618
|
VerticalScrollingHelper.addOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
1616
1619
|
|
|
1617
1620
|
oProcessInterface.addCancelListener(function() {
|
|
1618
|
-
|
|
1621
|
+
const bRemoved = VerticalScrollingHelper.removeOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
1619
1622
|
if (bRemoved) {
|
|
1620
1623
|
resolve();
|
|
1621
1624
|
}
|
|
@@ -1624,8 +1627,8 @@ sap.ui.define([
|
|
|
1624
1627
|
},
|
|
1625
1628
|
|
|
1626
1629
|
_restoreScrollPosition: function(oTable) {
|
|
1627
|
-
|
|
1628
|
-
|
|
1630
|
+
const oScrollPosition = _private(oTable).oVerticalScrollPosition;
|
|
1631
|
+
const bScrollPositionIsInitial = oScrollPosition.isInitial();
|
|
1629
1632
|
|
|
1630
1633
|
log("VerticalScrollingHelper.restoreScrollPosition: "
|
|
1631
1634
|
+ "Scroll position is" + (bScrollPositionIsInitial ? " " : " not ") + "initial", oTable);
|
|
@@ -1642,7 +1645,7 @@ sap.ui.define([
|
|
|
1642
1645
|
},
|
|
1643
1646
|
|
|
1644
1647
|
adjustToTotalRowCount: function(oTable) {
|
|
1645
|
-
|
|
1648
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1646
1649
|
|
|
1647
1650
|
log("VerticalScrollingHelper.adjustToTotalRowCount", oTable);
|
|
1648
1651
|
VerticalScrollingHelper.updateScrollbarVisibility(oTable);
|
|
@@ -1668,7 +1671,7 @@ sap.ui.define([
|
|
|
1668
1671
|
if (_private(oTable).oVerticalScrollPosition.isInitial()) {
|
|
1669
1672
|
resolve();
|
|
1670
1673
|
} else {
|
|
1671
|
-
|
|
1674
|
+
const fnOnRowsUpdatedPreprocessor = function() {
|
|
1672
1675
|
log("VerticalScrollingHelper.adjustToTotalRowCount (async: rows updated)", oTable);
|
|
1673
1676
|
resolve();
|
|
1674
1677
|
return false;
|
|
@@ -1677,7 +1680,7 @@ sap.ui.define([
|
|
|
1677
1680
|
VerticalScrollingHelper.addOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
1678
1681
|
|
|
1679
1682
|
oProcessInterface.addCancelListener(function() {
|
|
1680
|
-
|
|
1683
|
+
const bRemoved = VerticalScrollingHelper.removeOnRowsUpdatedPreprocessor(oTable, fnOnRowsUpdatedPreprocessor);
|
|
1681
1684
|
if (bRemoved) {
|
|
1682
1685
|
resolve();
|
|
1683
1686
|
}
|
|
@@ -1698,15 +1701,15 @@ sap.ui.define([
|
|
|
1698
1701
|
},
|
|
1699
1702
|
|
|
1700
1703
|
updateScrollbarVisibility: function(oTable) {
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1705
|
+
const oVSb = oScrollExtension.getVerticalScrollbar();
|
|
1706
|
+
const oTableElement = oTable ? oTable.getDomRef() : null;
|
|
1704
1707
|
|
|
1705
1708
|
if (!oVSb || !oTableElement) {
|
|
1706
1709
|
return;
|
|
1707
1710
|
}
|
|
1708
1711
|
|
|
1709
|
-
|
|
1712
|
+
const bVerticalScrollbarRequired = oScrollExtension.isVerticalScrollbarRequired();
|
|
1710
1713
|
|
|
1711
1714
|
oTableElement.classList.toggle("sapUiTableVScr", bVerticalScrollbarRequired && !oScrollExtension.isVerticalScrollbarExternal());
|
|
1712
1715
|
oVSb.parentElement.classList.toggle("sapUiTableHidden", !bVerticalScrollbarRequired);
|
|
@@ -1718,15 +1721,15 @@ sap.ui.define([
|
|
|
1718
1721
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
1719
1722
|
*/
|
|
1720
1723
|
addEventListeners: function(oTable) {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1725
|
+
const aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
|
|
1726
|
+
const oViewport = oTable.getDomRef("tableCCnt");
|
|
1724
1727
|
|
|
1725
1728
|
if (!oScrollExtension._onVerticalScrollEventHandler) {
|
|
1726
1729
|
oScrollExtension._onVerticalScrollEventHandler = VerticalScrollingHelper.onScrollbarScroll.bind(oTable);
|
|
1727
1730
|
}
|
|
1728
1731
|
|
|
1729
|
-
for (
|
|
1732
|
+
for (let i = 0; i < aScrollAreas.length; i++) {
|
|
1730
1733
|
aScrollAreas[i].addEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
|
|
1731
1734
|
}
|
|
1732
1735
|
|
|
@@ -1746,12 +1749,12 @@ sap.ui.define([
|
|
|
1746
1749
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
1747
1750
|
*/
|
|
1748
1751
|
removeEventListeners: function(oTable) {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
1753
|
+
const aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
|
|
1754
|
+
const oViewport = oTable.getDomRef("tableCCnt");
|
|
1752
1755
|
|
|
1753
1756
|
if (oScrollExtension._onVerticalScrollEventHandler) {
|
|
1754
|
-
for (
|
|
1757
|
+
for (let i = 0; i < aScrollAreas.length; i++) {
|
|
1755
1758
|
aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
|
|
1756
1759
|
}
|
|
1757
1760
|
delete oScrollExtension._onVerticalScrollEventHandler;
|
|
@@ -1773,7 +1776,7 @@ sap.ui.define([
|
|
|
1773
1776
|
* @private
|
|
1774
1777
|
*/
|
|
1775
1778
|
getScrollAreas: function(oTable) {
|
|
1776
|
-
|
|
1779
|
+
const aScrollAreas = [
|
|
1777
1780
|
oTable._getScrollExtension().getVerticalScrollbar()
|
|
1778
1781
|
];
|
|
1779
1782
|
|
|
@@ -1788,7 +1791,7 @@ sap.ui.define([
|
|
|
1788
1791
|
*
|
|
1789
1792
|
* @private
|
|
1790
1793
|
*/
|
|
1791
|
-
|
|
1794
|
+
const ScrollingHelper = {
|
|
1792
1795
|
/**
|
|
1793
1796
|
* Handles mouse wheel events.
|
|
1794
1797
|
*
|
|
@@ -1796,12 +1799,12 @@ sap.ui.define([
|
|
|
1796
1799
|
* @param {WheelEvent} oEvent The wheel event object.
|
|
1797
1800
|
*/
|
|
1798
1801
|
onMouseWheelScrolling: function(mOptions, oEvent) {
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1802
|
+
const oScrollExtension = this._getScrollExtension();
|
|
1803
|
+
const bVerticalDelta = Math.abs(oEvent.deltaY) > Math.abs(oEvent.deltaX);
|
|
1804
|
+
let iScrollDelta = bVerticalDelta ? oEvent.deltaY : oEvent.deltaX;
|
|
1805
|
+
const bHorizontalScrolling = bVerticalDelta && oEvent.shiftKey || !bVerticalDelta;
|
|
1806
|
+
const bScrollingForward = iScrollDelta > 0;
|
|
1807
|
+
let bScrolledToEnd = false;
|
|
1805
1808
|
|
|
1806
1809
|
if (iScrollDelta === 0) {
|
|
1807
1810
|
return;
|
|
@@ -1809,13 +1812,13 @@ sap.ui.define([
|
|
|
1809
1812
|
|
|
1810
1813
|
if (bHorizontalScrolling && (mOptions.scrollDirection === ScrollDirection.HORIZONAL
|
|
1811
1814
|
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
|
|
1812
|
-
|
|
1815
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
1813
1816
|
|
|
1814
1817
|
if (oEvent.deltaMode !== window.WheelEvent.DOM_DELTA_PIXEL) {
|
|
1815
1818
|
// For simplicity and performance reasons horizontal line and page scrolling is always performed by the distance of one minimum
|
|
1816
1819
|
// column width. To determine the real scroll distance reading from the DOM is necessary, but this should be avoided in an
|
|
1817
1820
|
// event handler.
|
|
1818
|
-
|
|
1821
|
+
const iMinColumnWidth = TableUtils.Column.getMinColumnWidth();
|
|
1819
1822
|
iScrollDelta = bScrollingForward ? iMinColumnWidth : -iMinColumnWidth;
|
|
1820
1823
|
}
|
|
1821
1824
|
|
|
@@ -1837,14 +1840,14 @@ sap.ui.define([
|
|
|
1837
1840
|
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
|
|
1838
1841
|
|
|
1839
1842
|
if (oEvent.target instanceof window.HTMLTextAreaElement) {
|
|
1840
|
-
|
|
1843
|
+
const oTextAreaRef = oEvent.target;
|
|
1841
1844
|
if (oTextAreaRef.clientHeight < oTextAreaRef.scrollHeight) {
|
|
1842
1845
|
return;
|
|
1843
1846
|
}
|
|
1844
1847
|
}
|
|
1845
1848
|
|
|
1846
|
-
|
|
1847
|
-
|
|
1849
|
+
const oVSb = oScrollExtension.getVerticalScrollbar();
|
|
1850
|
+
const oVerticalScrollPosition = _private(this).oVerticalScrollPosition;
|
|
1848
1851
|
|
|
1849
1852
|
if (bScrollingForward) {
|
|
1850
1853
|
bScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight;
|
|
@@ -1859,7 +1862,7 @@ sap.ui.define([
|
|
|
1859
1862
|
oEvent.stopPropagation();
|
|
1860
1863
|
|
|
1861
1864
|
if (oEvent.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) {
|
|
1862
|
-
|
|
1865
|
+
const nRowsToScroll = iScrollDelta / this._getDefaultRowHeight();
|
|
1863
1866
|
|
|
1864
1867
|
// Always scroll full rows.
|
|
1865
1868
|
// This is not perfect in case of variable row heights, but perfect pixel-wise scrolling requires a different DOM structure.
|
|
@@ -1889,10 +1892,10 @@ sap.ui.define([
|
|
|
1889
1892
|
*/
|
|
1890
1893
|
onTouchStart: function(mOptions, oEvent) {
|
|
1891
1894
|
if (oEvent.type === "touchstart" || oEvent.pointerType === "touch") {
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1895
|
+
const oScrollExtension = this._getScrollExtension();
|
|
1896
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
1897
|
+
const oVSb = oScrollExtension.getVerticalScrollbar();
|
|
1898
|
+
const oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent;
|
|
1896
1899
|
|
|
1897
1900
|
_private(this).mTouchSessionData = {
|
|
1898
1901
|
initialPageX: oTouchObject.pageX,
|
|
@@ -1916,17 +1919,17 @@ sap.ui.define([
|
|
|
1916
1919
|
return;
|
|
1917
1920
|
}
|
|
1918
1921
|
|
|
1919
|
-
|
|
1920
|
-
|
|
1922
|
+
const oScrollExtension = this._getScrollExtension();
|
|
1923
|
+
const mTouchSessionData = _private(this).mTouchSessionData;
|
|
1921
1924
|
|
|
1922
1925
|
if (!mTouchSessionData) {
|
|
1923
1926
|
return;
|
|
1924
1927
|
}
|
|
1925
1928
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1929
|
+
const oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent;
|
|
1930
|
+
const iTouchDistanceX = (oTouchObject.pageX - mTouchSessionData.initialPageX);
|
|
1931
|
+
const iTouchDistanceY = (oTouchObject.pageY - mTouchSessionData.initialPageY);
|
|
1932
|
+
let bScrollingPerformed = false;
|
|
1930
1933
|
|
|
1931
1934
|
if (!mTouchSessionData.touchMoveDirection) {
|
|
1932
1935
|
if (iTouchDistanceX === 0 && iTouchDistanceY === 0) {
|
|
@@ -1936,11 +1939,11 @@ sap.ui.define([
|
|
|
1936
1939
|
}
|
|
1937
1940
|
|
|
1938
1941
|
switch (mTouchSessionData.touchMoveDirection) {
|
|
1939
|
-
case "horizontal":
|
|
1940
|
-
|
|
1942
|
+
case "horizontal": {
|
|
1943
|
+
const oHSb = oScrollExtension.getHorizontalScrollbar();
|
|
1941
1944
|
|
|
1942
1945
|
if (oHSb && (mOptions.scrollDirection === ScrollDirection.HORIZONAL
|
|
1943
|
-
|
|
1946
|
+
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
|
|
1944
1947
|
this._getKeyboardExtension().setActionMode(false);
|
|
1945
1948
|
|
|
1946
1949
|
if (mTouchSessionData.initialScrolledToEnd == null) {
|
|
@@ -1957,12 +1960,12 @@ sap.ui.define([
|
|
|
1957
1960
|
}
|
|
1958
1961
|
}
|
|
1959
1962
|
break;
|
|
1960
|
-
|
|
1961
|
-
case "vertical":
|
|
1962
|
-
|
|
1963
|
+
}
|
|
1964
|
+
case "vertical": {
|
|
1965
|
+
const oVSb = oScrollExtension.getVerticalScrollbar();
|
|
1963
1966
|
|
|
1964
1967
|
if (oVSb && (mOptions.scrollDirection === ScrollDirection.VERTICAL
|
|
1965
|
-
|
|
1968
|
+
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
|
|
1966
1969
|
this._getKeyboardExtension().setActionMode(false);
|
|
1967
1970
|
|
|
1968
1971
|
if (mTouchSessionData.initialScrolledToEnd == null) {
|
|
@@ -1979,6 +1982,7 @@ sap.ui.define([
|
|
|
1979
1982
|
}
|
|
1980
1983
|
}
|
|
1981
1984
|
break;
|
|
1985
|
+
}
|
|
1982
1986
|
default:
|
|
1983
1987
|
}
|
|
1984
1988
|
|
|
@@ -1993,8 +1997,8 @@ sap.ui.define([
|
|
|
1993
1997
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
1994
1998
|
*/
|
|
1995
1999
|
addEventListeners: function(oTable) {
|
|
1996
|
-
|
|
1997
|
-
|
|
2000
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
2001
|
+
const aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable);
|
|
1998
2002
|
|
|
1999
2003
|
oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, {
|
|
2000
2004
|
scrollDirection: ScrollDirection.BOTH
|
|
@@ -2013,9 +2017,9 @@ sap.ui.define([
|
|
|
2013
2017
|
* @returns {{wheel: Function}} A key value map containing the event names as keys and listener functions as values.
|
|
2014
2018
|
*/
|
|
2015
2019
|
addMouseWheelEventListener: function(aEventListenerTargets, oTable, mOptions) {
|
|
2016
|
-
|
|
2020
|
+
const fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions);
|
|
2017
2021
|
|
|
2018
|
-
for (
|
|
2022
|
+
for (let i = 0; i < aEventListenerTargets.length; i++) {
|
|
2019
2023
|
aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler);
|
|
2020
2024
|
}
|
|
2021
2025
|
|
|
@@ -2034,11 +2038,11 @@ sap.ui.define([
|
|
|
2034
2038
|
* touchmove: Function}} A key value map containing the event names as keys and listener functions as values.
|
|
2035
2039
|
*/
|
|
2036
2040
|
addTouchEventListener: function(aEventListenerTargets, oTable, mOptions) {
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2041
|
+
const fnOnTouchStartEventHandler = ScrollingHelper.onTouchStart.bind(oTable, mOptions);
|
|
2042
|
+
const fnOnTouchMoveEventHandler = ScrollingHelper.onTouchMoveScrolling.bind(oTable, mOptions);
|
|
2043
|
+
let mListeners = {};
|
|
2040
2044
|
|
|
2041
|
-
for (
|
|
2045
|
+
for (let i = 0; i < aEventListenerTargets.length; i++) {
|
|
2042
2046
|
/* Touch events */
|
|
2043
2047
|
// Chrome on desktops and windows tablets - pointer events.
|
|
2044
2048
|
// Other browsers and tablets - touch events.
|
|
@@ -2067,19 +2071,19 @@ sap.ui.define([
|
|
|
2067
2071
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
2068
2072
|
*/
|
|
2069
2073
|
removeEventListeners: function(oTable) {
|
|
2070
|
-
|
|
2071
|
-
|
|
2074
|
+
const oScrollExtension = oTable._getScrollExtension();
|
|
2075
|
+
const aEventTargets = ScrollingHelper.getEventListenerTargets(oTable);
|
|
2072
2076
|
|
|
2073
2077
|
function removeEventListener(oTarget, mEventListenerMap) {
|
|
2074
|
-
for (
|
|
2075
|
-
|
|
2078
|
+
for (const sEventName in mEventListenerMap) {
|
|
2079
|
+
const fnListener = mEventListenerMap[sEventName];
|
|
2076
2080
|
if (fnListener) {
|
|
2077
2081
|
oTarget.removeEventListener(sEventName, fnListener);
|
|
2078
2082
|
}
|
|
2079
2083
|
}
|
|
2080
2084
|
}
|
|
2081
2085
|
|
|
2082
|
-
for (
|
|
2086
|
+
for (let i = 0; i < aEventTargets.length; i++) {
|
|
2083
2087
|
removeEventListener(aEventTargets[i], oScrollExtension._mMouseWheelEventListener);
|
|
2084
2088
|
removeEventListener(aEventTargets[i], oScrollExtension._mTouchEventListener);
|
|
2085
2089
|
}
|
|
@@ -2096,7 +2100,7 @@ sap.ui.define([
|
|
|
2096
2100
|
* @private
|
|
2097
2101
|
*/
|
|
2098
2102
|
getEventListenerTargets: function(oTable) {
|
|
2099
|
-
|
|
2103
|
+
const aEventListenerTargets = [
|
|
2100
2104
|
// Safari does not support touch-action:none and touch-action:pan-x/y. That means, the user can scroll by touch actions anywhere
|
|
2101
2105
|
// in the body of the table.
|
|
2102
2106
|
oTable.getDomRef("tableCCnt")
|
|
@@ -2108,14 +2112,14 @@ sap.ui.define([
|
|
|
2108
2112
|
}
|
|
2109
2113
|
};
|
|
2110
2114
|
|
|
2111
|
-
|
|
2115
|
+
const ExtensionDelegate = {
|
|
2112
2116
|
onBeforeRendering: function(oEvent) {
|
|
2113
2117
|
this._getScrollExtension()._clearCache();
|
|
2114
2118
|
},
|
|
2115
2119
|
|
|
2116
2120
|
onAfterRendering: function(oEvent) {
|
|
2117
|
-
|
|
2118
|
-
|
|
2121
|
+
const oScrollExtension = this._getScrollExtension();
|
|
2122
|
+
const bRenderedRows = oEvent != null && oEvent.isMarked("renderRows");
|
|
2119
2123
|
|
|
2120
2124
|
if (bRenderedRows) {
|
|
2121
2125
|
oScrollExtension.updateVerticalScrollbarHeight();
|
|
@@ -2129,9 +2133,9 @@ sap.ui.define([
|
|
|
2129
2133
|
onfocusin: function(oEvent) {
|
|
2130
2134
|
// Many browsers do not scroll the focused element into the viewport if it is partially visible. With this logic we ensure that the
|
|
2131
2135
|
// focused cell always gets scrolled into the viewport. If the cell is wider than the row container, no action is performed.
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2136
|
+
let oRowContainer;
|
|
2137
|
+
const oCellInfo = TableUtils.getCellInfo(oEvent.target);
|
|
2138
|
+
const oHSb = this._getScrollExtension().getHorizontalScrollbar();
|
|
2135
2139
|
|
|
2136
2140
|
if (oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL)) {
|
|
2137
2141
|
oRowContainer = this.getDomRef("sapUiTableCtrlScr");
|
|
@@ -2140,15 +2144,15 @@ sap.ui.define([
|
|
|
2140
2144
|
}
|
|
2141
2145
|
|
|
2142
2146
|
if (oRowContainer && oHSb && oCellInfo.columnIndex >= this.getComputedFixedColumnCount()) {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2147
|
+
const $HSb = jQuery(oHSb);
|
|
2148
|
+
const oCell = oCellInfo.cell;
|
|
2149
|
+
const iCurrentScrollLeft = this._bRtlMode ? $HSb.scrollLeftRTL() : oHSb.scrollLeft;
|
|
2150
|
+
const iRowContainerWidth = oRowContainer.clientWidth;
|
|
2151
|
+
const iCellLeft = oCell.offsetLeft;
|
|
2152
|
+
const iCellRight = iCellLeft + oCell.offsetWidth;
|
|
2153
|
+
const iOffsetLeft = iCellLeft - iCurrentScrollLeft;
|
|
2154
|
+
const iOffsetRight = iCellRight - iRowContainerWidth - iCurrentScrollLeft;
|
|
2155
|
+
let iNewScrollLeft;
|
|
2152
2156
|
|
|
2153
2157
|
if (iOffsetLeft < 0 && iOffsetRight < 0) {
|
|
2154
2158
|
iNewScrollLeft = iCurrentScrollLeft + iOffsetLeft;
|
|
@@ -2168,12 +2172,12 @@ sap.ui.define([
|
|
|
2168
2172
|
// On focus, the browsers scroll elements which are not visible into the viewport. This causes scrolling inside table cells, which is not
|
|
2169
2173
|
// desired. Flickering of the cell content cannot be avoided, as the browser performs scrolling after the event. This behavior cannot be
|
|
2170
2174
|
// prevented, only reverted.
|
|
2171
|
-
|
|
2175
|
+
const $ParentCell = TableUtils.getParentCell(this, oEvent.target);
|
|
2172
2176
|
|
|
2173
2177
|
if ($ParentCell) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2178
|
+
const that = this;
|
|
2179
|
+
const fnScrollBack = function() {
|
|
2180
|
+
const $InnerCellElement = $ParentCell.find(".sapUiTableCellInner");
|
|
2177
2181
|
|
|
2178
2182
|
if ($InnerCellElement.length > 0) {
|
|
2179
2183
|
if (that._bRtlMode) {
|
|
@@ -2264,19 +2268,19 @@ sap.ui.define([
|
|
|
2264
2268
|
* @class Extension for sap.ui.table.Table which handles scrolling.
|
|
2265
2269
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
2266
2270
|
* @author SAP SE
|
|
2267
|
-
* @version 1.
|
|
2271
|
+
* @version 1.124.0
|
|
2268
2272
|
* @constructor
|
|
2269
2273
|
* @private
|
|
2270
2274
|
* @alias sap.ui.table.extensions.Scrolling
|
|
2271
2275
|
*/
|
|
2272
|
-
|
|
2276
|
+
const ScrollExtension = ExtensionBase.extend("sap.ui.table.extensions.Scrolling", /** @lends sap.ui.table.extensions.Scrolling.prototype */ {
|
|
2273
2277
|
/**
|
|
2274
2278
|
* @override
|
|
2275
2279
|
* @inheritDoc
|
|
2276
2280
|
* @returns {string} The name of this extension.
|
|
2277
2281
|
*/
|
|
2278
2282
|
_init: function(oTable, sTableType, mSettings) {
|
|
2279
|
-
|
|
2283
|
+
const _ = _private(oTable);
|
|
2280
2284
|
|
|
2281
2285
|
// Horizontal scrolling
|
|
2282
2286
|
_.oHorizontalScrollbar = null;
|
|
@@ -2307,7 +2311,7 @@ sap.ui.define([
|
|
|
2307
2311
|
* @inheritDoc
|
|
2308
2312
|
*/
|
|
2309
2313
|
_attachEvents: function() {
|
|
2310
|
-
|
|
2314
|
+
const oTable = this.getTable();
|
|
2311
2315
|
|
|
2312
2316
|
HorizontalScrollingHelper.addEventListeners(oTable);
|
|
2313
2317
|
VerticalScrollingHelper.addEventListeners(oTable);
|
|
@@ -2321,7 +2325,7 @@ sap.ui.define([
|
|
|
2321
2325
|
* @inheritDoc
|
|
2322
2326
|
*/
|
|
2323
2327
|
_detachEvents: function() {
|
|
2324
|
-
|
|
2328
|
+
const oTable = this.getTable();
|
|
2325
2329
|
|
|
2326
2330
|
HorizontalScrollingHelper.removeEventListeners(oTable);
|
|
2327
2331
|
VerticalScrollingHelper.removeEventListeners(oTable);
|
|
@@ -2335,7 +2339,7 @@ sap.ui.define([
|
|
|
2335
2339
|
* @inheritDoc
|
|
2336
2340
|
*/
|
|
2337
2341
|
destroy: function() {
|
|
2338
|
-
|
|
2342
|
+
const oTable = this.getTable();
|
|
2339
2343
|
|
|
2340
2344
|
this._clearCache();
|
|
2341
2345
|
|
|
@@ -2360,15 +2364,15 @@ sap.ui.define([
|
|
|
2360
2364
|
* otherwise a single row is scrolled.
|
|
2361
2365
|
*/
|
|
2362
2366
|
ScrollExtension.prototype.scrollVertically = function(bDown, bPage) {
|
|
2363
|
-
|
|
2367
|
+
const oTable = this.getTable();
|
|
2364
2368
|
|
|
2365
2369
|
if (!oTable) {
|
|
2366
2370
|
return;
|
|
2367
2371
|
}
|
|
2368
2372
|
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2373
|
+
const mRowCounts = oTable._getRowCounts();
|
|
2374
|
+
const iFirstRenderedRowIndex = oTable._getFirstRenderedRowIndex();
|
|
2375
|
+
const iScrollDistance = bPage === true ? mRowCounts.scrollable : 1;
|
|
2372
2376
|
|
|
2373
2377
|
if (bDown === true) {
|
|
2374
2378
|
_private(oTable).oVerticalScrollPosition
|
|
@@ -2386,7 +2390,7 @@ sap.ui.define([
|
|
|
2386
2390
|
* @param {boolean} [bDown=false] If <code>true</code>, the table is scrolled down, otherwise up.
|
|
2387
2391
|
*/
|
|
2388
2392
|
ScrollExtension.prototype.scrollVerticallyMax = function(bDown) {
|
|
2389
|
-
|
|
2393
|
+
const oTable = this.getTable();
|
|
2390
2394
|
|
|
2391
2395
|
if (!oTable) {
|
|
2392
2396
|
return;
|
|
@@ -2408,7 +2412,7 @@ sap.ui.define([
|
|
|
2408
2412
|
* @returns {HTMLElement|null} Returns <code>null</code>, if the horizontal scrollbar does not exist.
|
|
2409
2413
|
*/
|
|
2410
2414
|
ScrollExtension.prototype.getHorizontalScrollbar = function() {
|
|
2411
|
-
|
|
2415
|
+
const oTable = this.getTable();
|
|
2412
2416
|
|
|
2413
2417
|
if (!oTable) {
|
|
2414
2418
|
return null;
|
|
@@ -2430,8 +2434,8 @@ sap.ui.define([
|
|
|
2430
2434
|
* @returns {HTMLElement|null} Returns <code>null</code>, if the vertical scrollbar does not exist.
|
|
2431
2435
|
*/
|
|
2432
2436
|
ScrollExtension.prototype.getVerticalScrollbar = function() {
|
|
2433
|
-
|
|
2434
|
-
|
|
2437
|
+
const oTable = this.getTable();
|
|
2438
|
+
const bIsExternal = this.isVerticalScrollbarExternal();
|
|
2435
2439
|
|
|
2436
2440
|
if (!oTable) {
|
|
2437
2441
|
return null;
|
|
@@ -2449,7 +2453,7 @@ sap.ui.define([
|
|
|
2449
2453
|
}
|
|
2450
2454
|
}
|
|
2451
2455
|
|
|
2452
|
-
|
|
2456
|
+
const oScrollbar = _private(oTable).oVerticalScrollbar;
|
|
2453
2457
|
|
|
2454
2458
|
if (oScrollbar && !bIsExternal && !oScrollbar.isConnected) {
|
|
2455
2459
|
// The internal scrollbar was removed from DOM without notifying the table.
|
|
@@ -2466,7 +2470,7 @@ sap.ui.define([
|
|
|
2466
2470
|
* @returns {boolean} Returns <code>true</code>, if the horizontal scrollbar is visible.
|
|
2467
2471
|
*/
|
|
2468
2472
|
ScrollExtension.prototype.isHorizontalScrollbarVisible = function() {
|
|
2469
|
-
|
|
2473
|
+
const oHSb = this.getHorizontalScrollbar();
|
|
2470
2474
|
return oHSb != null && !oHSb.classList.contains("sapUiTableHidden");
|
|
2471
2475
|
};
|
|
2472
2476
|
|
|
@@ -2476,7 +2480,7 @@ sap.ui.define([
|
|
|
2476
2480
|
* @returns {boolean} Returns <code>true</code>, if the vertical scrollbar is visible.
|
|
2477
2481
|
*/
|
|
2478
2482
|
ScrollExtension.prototype.isVerticalScrollbarVisible = function() {
|
|
2479
|
-
|
|
2483
|
+
const oVSb = this.getVerticalScrollbar();
|
|
2480
2484
|
return oVSb != null && !oVSb.parentElement.classList.contains("sapUiTableHidden");
|
|
2481
2485
|
};
|
|
2482
2486
|
|
|
@@ -2486,7 +2490,7 @@ sap.ui.define([
|
|
|
2486
2490
|
* @returns {boolean} Whether the vertical scrollbar is external.
|
|
2487
2491
|
*/
|
|
2488
2492
|
ScrollExtension.prototype.isVerticalScrollbarExternal = function() {
|
|
2489
|
-
|
|
2493
|
+
const oTable = this.getTable();
|
|
2490
2494
|
return oTable ? _private(oTable).bIsVerticalScrollbarExternal : false;
|
|
2491
2495
|
};
|
|
2492
2496
|
|
|
@@ -2497,7 +2501,7 @@ sap.ui.define([
|
|
|
2497
2501
|
* @param {HTMLElement} oScrollbarElement The reference to the external scrollbar element.
|
|
2498
2502
|
*/
|
|
2499
2503
|
ScrollExtension.prototype.markVerticalScrollbarAsExternal = function(oScrollbarElement) {
|
|
2500
|
-
|
|
2504
|
+
const oTable = this.getTable();
|
|
2501
2505
|
|
|
2502
2506
|
if (oTable && oScrollbarElement) {
|
|
2503
2507
|
_private(oTable).bIsVerticalScrollbarExternal = true;
|
|
@@ -2509,8 +2513,8 @@ sap.ui.define([
|
|
|
2509
2513
|
* Updates the height of the vertical scrollbar.
|
|
2510
2514
|
*/
|
|
2511
2515
|
ScrollExtension.prototype.updateVerticalScrollbarHeight = function() {
|
|
2512
|
-
|
|
2513
|
-
|
|
2516
|
+
const oTable = this.getTable();
|
|
2517
|
+
const oVSb = this.getVerticalScrollbar();
|
|
2514
2518
|
|
|
2515
2519
|
if (!oTable || !oVSb) {
|
|
2516
2520
|
return;
|
|
@@ -2526,7 +2530,7 @@ sap.ui.define([
|
|
|
2526
2530
|
* @returns {int} The height of the scrollbar.
|
|
2527
2531
|
*/
|
|
2528
2532
|
ScrollExtension.prototype.getVerticalScrollbarHeight = function() {
|
|
2529
|
-
|
|
2533
|
+
const oTable = this.getTable();
|
|
2530
2534
|
|
|
2531
2535
|
if (!oTable) {
|
|
2532
2536
|
return 0;
|
|
@@ -2541,7 +2545,7 @@ sap.ui.define([
|
|
|
2541
2545
|
* @param {boolean} [bExpectRowsUpdatedEvent=false] Whether an update of the rows will happen.
|
|
2542
2546
|
*/
|
|
2543
2547
|
ScrollExtension.prototype.updateVerticalScrollPosition = function(bExpectRowsUpdatedEvent) {
|
|
2544
|
-
|
|
2548
|
+
const oTable = this.getTable();
|
|
2545
2549
|
|
|
2546
2550
|
if (!oTable) {
|
|
2547
2551
|
return;
|
|
@@ -2567,8 +2571,8 @@ sap.ui.define([
|
|
|
2567
2571
|
* Updates the vertical scroll height. This is the content height of the vertical scrollbar.
|
|
2568
2572
|
*/
|
|
2569
2573
|
ScrollExtension.prototype.updateVerticalScrollHeight = function() {
|
|
2570
|
-
|
|
2571
|
-
|
|
2574
|
+
const oVSb = this.getVerticalScrollbar();
|
|
2575
|
+
const oVSbContent = oVSb ? oVSb.firstChild : null;
|
|
2572
2576
|
|
|
2573
2577
|
if (!oVSbContent) {
|
|
2574
2578
|
return;
|
|
@@ -2585,17 +2589,17 @@ sap.ui.define([
|
|
|
2585
2589
|
* @returns {int} The vertical scroll height.
|
|
2586
2590
|
*/
|
|
2587
2591
|
ScrollExtension.prototype.getVerticalScrollHeight = function(bBoundless) {
|
|
2588
|
-
|
|
2592
|
+
const oTable = this.getTable();
|
|
2589
2593
|
|
|
2590
2594
|
if (!oTable) {
|
|
2591
2595
|
return 0;
|
|
2592
2596
|
}
|
|
2593
2597
|
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2598
|
+
const iTotalRowCount = oTable._getTotalRowCount();
|
|
2599
|
+
const mRowCounts = oTable._getRowCounts();
|
|
2600
|
+
const iRowCount = Math.max(iTotalRowCount, mRowCounts.count);
|
|
2601
|
+
const iBaseRowHeight = oTable._getBaseRowHeight();
|
|
2602
|
+
let iScrollHeight;
|
|
2599
2603
|
|
|
2600
2604
|
if (TableUtils.isVariableRowHeightEnabled(oTable)) {
|
|
2601
2605
|
iScrollHeight = iBaseRowHeight * (iRowCount - 1 /* The last row is inside the buffer */)
|
|
@@ -2617,7 +2621,7 @@ sap.ui.define([
|
|
|
2617
2621
|
* @returns {boolean} Returns <code>true</code>, if the vertical scrollbar is required.
|
|
2618
2622
|
*/
|
|
2619
2623
|
ScrollExtension.prototype.isVerticalScrollbarRequired = function() {
|
|
2620
|
-
|
|
2624
|
+
const oTable = this.getTable();
|
|
2621
2625
|
|
|
2622
2626
|
if (!oTable) {
|
|
2623
2627
|
return false;
|
|
@@ -2635,7 +2639,7 @@ sap.ui.define([
|
|
|
2635
2639
|
* @returns {{wheel: Function}|null} A key value map containing the event names as keys and listener functions as values.
|
|
2636
2640
|
*/
|
|
2637
2641
|
ScrollExtension.prototype.registerForMouseWheel = function(aEventListenerTargets, mOptions) {
|
|
2638
|
-
|
|
2642
|
+
const oTable = this.getTable();
|
|
2639
2643
|
|
|
2640
2644
|
if (ExtensionBase.isEnrichedWith(oTable, "sap.ui.table.extensions.Synchronization")) {
|
|
2641
2645
|
return ScrollingHelper.addMouseWheelEventListener(aEventListenerTargets, oTable, mOptions);
|
|
@@ -2656,7 +2660,7 @@ sap.ui.define([
|
|
|
2656
2660
|
* touchmove: Function}|null} A key value map containing the event names as keys and listener functions as values.
|
|
2657
2661
|
*/
|
|
2658
2662
|
ScrollExtension.prototype.registerForTouch = function(aEventListenerTargets, mOptions) {
|
|
2659
|
-
|
|
2663
|
+
const oTable = this.getTable();
|
|
2660
2664
|
|
|
2661
2665
|
if (ExtensionBase.isEnrichedWith(oTable, "sap.ui.table.extensions.Synchronization")) {
|
|
2662
2666
|
return ScrollingHelper.addTouchEventListener(aEventListenerTargets, oTable, mOptions);
|
|
@@ -2672,7 +2676,7 @@ sap.ui.define([
|
|
|
2672
2676
|
* @private
|
|
2673
2677
|
*/
|
|
2674
2678
|
ScrollExtension.prototype._clearCache = function() {
|
|
2675
|
-
|
|
2679
|
+
const oTable = this.getTable();
|
|
2676
2680
|
|
|
2677
2681
|
if (!oTable) {
|
|
2678
2682
|
return;
|