cps-ui-kit 0.72.0 → 0.73.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.
@@ -5280,13 +5280,17 @@ class CpsTreeTableComponent {
5280
5280
  });
5281
5281
  }
5282
5282
  ngOnInit() {
5283
- if (this.virtualScroll)
5284
- window.addEventListener('resize', this._onWindowResize.bind(this));
5285
5283
  this.emptyBodyHeight = convertSize(this.emptyBodyHeight);
5286
5284
  if (!this.scrollable)
5287
5285
  this.virtualScroll = false;
5288
- if (this.virtualScroll)
5286
+ if (this.virtualScroll) {
5289
5287
  this.defScrollHeight = this.scrollHeight;
5288
+ if (this.defScrollHeight === 'flex')
5289
+ window.addEventListener('resize', this._onWindowResize.bind(this));
5290
+ if (this.defScrollHeight && this.defScrollHeight !== 'flex') {
5291
+ this.defScrollHeightPx = parseInt(this.scrollHeight, 10);
5292
+ }
5293
+ }
5290
5294
  if (this.paginator) {
5291
5295
  if (this.rowsPerPageOptions.length < 1)
5292
5296
  this.rowsPerPageOptions = [5, 10, 25, 50];
@@ -5313,7 +5317,8 @@ class CpsTreeTableComponent {
5313
5317
  this.scrollableBody = this.primengTreeTable.el.nativeElement.querySelector('.p-treetable-scrollable-body');
5314
5318
  if (this.scrollableBody) {
5315
5319
  this.headerBox = this.primengTreeTable.el.nativeElement.querySelector('.p-treetable-scrollable-header-box');
5316
- this.defScrollHeightPx = this.scrollableBody.clientHeight;
5320
+ if (this.virtualScroll && this.defScrollHeight === 'flex')
5321
+ this.defScrollHeightPx = this.scrollableBody.clientHeight;
5317
5322
  if (this.headerBox) {
5318
5323
  this.scrollbarWidth = DomHandler.calculateScrollbarWidth();
5319
5324
  this.resizeObserver.observe(this.scrollableBody);
@@ -5331,7 +5336,7 @@ class CpsTreeTableComponent {
5331
5336
  }
5332
5337
  ngOnDestroy() {
5333
5338
  this.resizeObserver?.disconnect();
5334
- if (this.virtualScroll)
5339
+ if (this.virtualScroll && this.defScrollHeight === 'flex')
5335
5340
  window.removeEventListener('resize', this._onWindowResize.bind(this));
5336
5341
  }
5337
5342
  _onWindowResize() {
@@ -5380,7 +5385,7 @@ class CpsTreeTableComponent {
5380
5385
  : this.virtualScrollItemSize + 1 + 'px';
5381
5386
  }
5382
5387
  else {
5383
- const curHeight = this.virtualScrollItemSize * itemsLen + 1;
5388
+ const curHeight = this.virtualScrollItemSize * itemsLen + 2;
5384
5389
  if (this.defScrollHeight === 'flex') {
5385
5390
  if (curHeight >= this.defScrollHeightPx) {
5386
5391
  this.scrollHeight = 'flex';