cps-ui-kit 21.29.0 → 21.29.1

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.
@@ -13772,7 +13772,18 @@ class CpsBaseTreeDropdownComponent {
13772
13772
  setTimeout(() => {
13773
13773
  this.updateOptions();
13774
13774
  this.recalcVirtualListHeight();
13775
- const selected = this.treeContainerElement?.querySelector('.p-highlight');
13775
+ let key = '';
13776
+ if (this.treeSelection) {
13777
+ if (this.multiple) {
13778
+ if (this.treeSelection.length > 0)
13779
+ key = this.treeSelection[0].key;
13780
+ }
13781
+ else
13782
+ key = this.treeSelection.key;
13783
+ }
13784
+ const selected = key
13785
+ ? this.treeContainerElement?.querySelector(`.key-${key}`)
13786
+ : null;
13776
13787
  if (selected) {
13777
13788
  selected.scrollIntoView({
13778
13789
  behavior: 'instant',
@@ -13780,21 +13791,12 @@ class CpsBaseTreeDropdownComponent {
13780
13791
  inline: 'center'
13781
13792
  });
13782
13793
  }
13783
- else if (this.virtualScroll && this.treeSelection) {
13784
- let key = '';
13785
- if (this.multiple) {
13786
- if (this.treeSelection.length > 0)
13787
- key = this.treeSelection[0].key;
13788
- }
13789
- else
13790
- key = this.treeSelection.key;
13791
- if (key) {
13792
- const idx = this.treeList?.serializedValue?.findIndex(
13793
- // https://github.com/primefaces/primeng/blob/v16.4.3/src/app/components/tree/tree.ts#L1125
13794
- (v) => v.node.key === key) || -1;
13795
- if (idx >= 0)
13796
- this.treeList.scrollToVirtualIndex(idx);
13797
- }
13794
+ else if (this.virtualScroll && key) {
13795
+ const idx = this.treeList?.serializedValue?.findIndex(
13796
+ // https://github.com/primefaces/primeng/blob/v16.4.3/src/app/components/tree/tree.ts#L1125
13797
+ (v) => v.node.key === key) ?? -1;
13798
+ if (idx >= 0)
13799
+ this.treeList.scrollToVirtualIndex(idx);
13798
13800
  }
13799
13801
  });
13800
13802
  }
@@ -13936,6 +13938,10 @@ class CpsBaseTreeDropdownComponent {
13936
13938
  if (!this.virtualScroll)
13937
13939
  return;
13938
13940
  this.treeList?.updateSerializedValue();
13941
+ // treeList is OnPush and serializedValue is a plain field, so its new
13942
+ // value won't reach the scroller's items input until treeList's own
13943
+ // view is force-checked
13944
+ this.treeList?.cd?.detectChanges();
13939
13945
  }
13940
13946
  _initContainerClickListener() {
13941
13947
  this.treeContainerElement = this.treeList?.el?.nativeElement?.querySelector('.p-tree-root-children');