@refinitiv-ui/efx-grid 6.0.122 → 6.0.124

Sign up to get free protection for your applications and to get access to all the features.
@@ -25971,7 +25971,7 @@ Core_Core.prototype._hasPendingRowChange = false;
25971
25971
  * @return {string}
25972
25972
  */
25973
25973
  Core_Core.getVersion = function () {
25974
- return "5.1.123";
25974
+ return "5.1.124";
25975
25975
  };
25976
25976
  /** {@link ElementWrapper#dispose}
25977
25977
  * @override
@@ -29037,37 +29037,37 @@ Core_Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
29037
29037
  section = this.getSection(sectionRef);
29038
29038
  }
29039
29039
 
29040
+ let rowIndexOffset = (section) ? section.getRowOffset() : this._sectionStarts[this._startVScrollbarIndex];
29041
+ let heightOffset = this._layoutY.getLaneStart(this._startVScrollbarIndex);
29042
+
29040
29043
  let rowCount = this._layoutY.getLaneCount();
29041
29044
  if (rowIndex <= 0) { rowIndex = 0; }
29042
29045
  else if (rowIndex >= rowCount) { rowIndex = rowCount - 1; }
29043
29046
 
29047
+ if (topOfView) {
29048
+ return this._layoutY.getLaneStart(rowIndex + rowIndexOffset) - heightOffset;
29049
+ }
29050
+
29051
+ let bufferSize = 2; // for more appealing space
29044
29052
  let viewInfo = this.getVerticalViewInfo();
29045
29053
  let firstFullRow = viewInfo.firstFullRow; // TODO: Make it work in zooming mode
29046
-
29047
- let scrollIndex = -1;
29048
- if (topOfView) {
29049
- scrollIndex = rowIndex;
29050
- } else {
29051
- if(rowIndex < firstFullRow) { // Scroll up
29052
- scrollIndex = rowIndex - 2; // Have some spaces at the top for more appealing visual
29053
- if(scrollIndex < 0) {
29054
- scrollIndex = 0;
29055
- }
29056
- } else { // Scroll down
29057
- let lastFullRow = viewInfo.lastFullRow;
29058
- if (rowIndex > lastFullRow) {
29059
- let viewIndexSize = lastFullRow - firstFullRow;
29060
- scrollIndex = rowIndex - viewIndexSize + 2;
29061
- if(scrollIndex < 0) {
29062
- scrollIndex = 0;
29063
- }
29064
- }
29054
+ if(rowIndex < firstFullRow) { // Scroll up, as the target row is outside of view
29055
+ let targetIndex = rowIndex - bufferSize; // Have some spaces at the top for more appealing visual
29056
+ if(targetIndex < 0) {
29057
+ targetIndex = 0;
29065
29058
  }
29059
+
29060
+ return this._layoutY.getLaneStart(targetIndex + rowIndexOffset) - heightOffset;
29066
29061
  }
29067
29062
 
29068
- let rowIndexOffset = (section) ? section.getRowOffset() : this._sectionStarts[this._startVScrollbarIndex];
29069
- let heightOffset = this._layoutY.getLaneStart(this._startVScrollbarIndex);
29070
- return (scrollIndex >= 0) ? (this._layoutY.getLaneStart(scrollIndex + rowIndexOffset) - heightOffset) : null;
29063
+ let lastFullRow = viewInfo.lastFullRow;
29064
+ if (rowIndex > lastFullRow) { // Scroll down, as the target row is outside of view
29065
+ let targetScroll = this._layoutY.getLaneStart(rowIndex + rowIndexOffset + bufferSize + 1);
29066
+
29067
+ return targetScroll - viewInfo.viewHeight - heightOffset;
29068
+ }
29069
+
29070
+ return null;
29071
29071
  };
29072
29072
  /** Scroll up or down to make specified row visible in the view
29073
29073
  * @public
@@ -29092,7 +29092,12 @@ Core_Core.prototype.getVerticalViewInfo = function() {
29092
29092
  let viewBottom = viewTop + viewHeight;
29093
29093
 
29094
29094
  let topRowIndex = this._layoutY.hitTest(viewTop) - rowIndexOffset;
29095
- let bottomRowIndex = this._layoutY.hitTest(viewBottom - 0.1) - rowIndexOffset;
29095
+ let bottomRowIndex = this._layoutY.hitTest(viewBottom - 0.1);
29096
+ if(bottomRowIndex < 0) { // view is larger than existing row count
29097
+ bottomRowIndex = this._layoutY.getLaneCount() - 1;
29098
+ }
29099
+ bottomRowIndex -= rowIndexOffset;
29100
+
29096
29101
  let laneTop = this._layoutY.getLaneStart(topRowIndex + rowIndexOffset);
29097
29102
  let laneBottom = this._layoutY.getLaneEnd(bottomRowIndex + rowIndexOffset);
29098
29103
 
@@ -29100,7 +29105,10 @@ Core_Core.prototype.getVerticalViewInfo = function() {
29100
29105
  topRowIndex: topRowIndex,
29101
29106
  firstFullRow: (laneTop < viewTop) ? topRowIndex + 1 : topRowIndex,
29102
29107
  lastFullRow: (laneBottom > viewBottom) ? bottomRowIndex - 1 : bottomRowIndex,
29103
- bottomRowIndex: bottomRowIndex
29108
+ bottomRowIndex: bottomRowIndex,
29109
+ viewHeight: viewHeight,
29110
+ viewTop: viewTop,
29111
+ viewBottom: viewBottom
29104
29112
  };
29105
29113
  };
29106
29114
  /** @public