@syncfusion/ej2-lists 26.2.5 → 26.2.11

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.
@@ -1328,6 +1328,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
1328
1328
  }
1329
1329
  break;
1330
1330
  case 'dataSource':
1331
+ this.previousScrollTop = this.element.scrollTop;
1331
1332
  if (this.enableVirtualization) {
1332
1333
  this.virtualizationModule.reRenderUiVirtualization();
1333
1334
  }
@@ -2061,8 +2062,9 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
2061
2062
  if (!isNullOrUndefined(this.scroll)) {
2062
2063
  EventHandler.remove(this.element, 'scroll', this.onListScroll);
2063
2064
  }
2064
- if (this.touchModule)
2065
+ if (this.touchModule) {
2065
2066
  this.touchModule.destroy();
2067
+ }
2066
2068
  this.touchModule = null;
2067
2069
  };
2068
2070
  ListView.prototype.removeFocus = function () {
@@ -3221,8 +3223,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3221
3223
  */
3222
3224
  Virtualization.prototype.uiVirtualization = function () {
3223
3225
  this.wireScrollEvent(false);
3226
+ var isRendered = this.listViewInstance.isRendered;
3227
+ var firstIndex = isRendered && !isNullOrUndefined(this.uiFirstIndex) ? this.uiFirstIndex : 0;
3224
3228
  var curViewDS = this.listViewInstance.curViewDS;
3225
- var firstDs = curViewDS.slice(0, 1);
3229
+ var firstDs = curViewDS.slice(firstIndex, firstIndex + 1);
3226
3230
  this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
3227
3231
  this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.container });
3228
3232
  this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer);
@@ -3230,9 +3234,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3230
3234
  this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
3231
3235
  this.expectedDomItemCount = this.ValidateItemCount(10000);
3232
3236
  this.domItemCount = this.ValidateItemCount(Object.keys(this.listViewInstance.curViewDS).length);
3233
- this.uiFirstIndex = 0;
3234
- this.uiLastIndex = this.domItemCount - 1;
3235
- var otherDs = curViewDS.slice(1, this.domItemCount);
3237
+ var lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) ? this.uiLastIndex : this.domItemCount - 1;
3238
+ this.uiFirstIndex = firstIndex;
3239
+ this.uiLastIndex = lastIndex;
3240
+ var otherDs = curViewDS.slice(firstIndex + 1, lastIndex + 1);
3236
3241
  var listItems = ListBase.createListItemFromJson(this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
3237
3242
  append(listItems, this.listViewInstance.ulElement);
3238
3243
  this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
@@ -3241,11 +3246,14 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3241
3246
  this.bottomElement = this.listViewInstance.createElement('div');
3242
3247
  this.listViewInstance.ulElement.insertBefore(this.bottomElement, null);
3243
3248
  this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
3244
- this.topElement.style.height = 0 + 'px';
3245
- this.bottomElement.style.height = this.totalHeight + 'px';
3246
- this.topElementHeight = 0;
3247
- this.bottomElementHeight = this.totalHeight;
3248
- this.listDiff = 0;
3249
+ this.topElement.style.height = isRendered ? this.topElementHeight + 'px' : '0px';
3250
+ this.bottomElement.style.height = isRendered ? (this.totalHeight - this.topElementHeight) + 'px' : this.totalHeight + 'px';
3251
+ this.topElementHeight = isRendered ? this.topElementHeight : 0;
3252
+ this.bottomElementHeight = isRendered ? (this.totalHeight - this.topElementHeight) : this.totalHeight;
3253
+ this.listDiff = isRendered ? this.listDiff : 0;
3254
+ if (isRendered) {
3255
+ this.listViewInstance.element.scrollTop = this.listViewInstance.previousScrollTop;
3256
+ }
3249
3257
  this.uiIndicesInitialization();
3250
3258
  };
3251
3259
  Virtualization.prototype.wireScrollEvent = function (destroy) {