Skip to content

Commit

Permalink
fix CascadeSelect panel align issue (Issue primefaces#16910)
Browse files Browse the repository at this point in the history
  • Loading branch information
umyanl committed Dec 12, 2024
1 parent 1ba3274 commit 5f62cf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/primeng/src/cascadeselect/cascadeselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export class CascadeSelectSub extends BaseComponent implements OnInit {
(onHide)="hide($event)"
>
<ng-template #content>
<div #panel [ngClass]="{ 'p-cascadeselect-overlay p-component': true, 'p-cascadeselect-mobile-active': queryMatches() }" [class]="panelStyleClass" [ngStyle]="panelStyle" [attr.data-pc-section]="'panel'">
<div #panel [ngClass]="{ 'p-cascadeselect-overlay p-component': true, 'p-cascadeselect-mobile-active': queryMatches(), 'bottom-aligned': transformOrigin?.includes('bottom') }" [class]="panelStyleClass" [ngStyle]="panelStyle" [attr.data-pc-section]="'panel'">
<ng-template *ngTemplateOutlet="headerTemplate"></ng-template>
<div class="p-cascadeselect-list-container" [attr.data-pc-section]="'wrapper'">
<p-cascadeselect-sub
Expand Down Expand Up @@ -689,6 +689,8 @@ export class CascadeSelect extends BaseComponent implements OnInit {
*/
@ContentChild('clearicon') clearicon: Nullable<TemplateRef<any>>;

transformOrigin?: string;

_showTransitionOptions: string = '';

_hideTransitionOptions: string = '';
Expand Down Expand Up @@ -1388,6 +1390,7 @@ export class CascadeSelect extends BaseComponent implements OnInit {
const activeOptionPath = this.activeOptionPath();
if (isNotEmpty(activeOptionPath)) {
this.overlayViewChild.alignOverlay();
this.transformOrigin = this.overlayViewChild.overlayEl?.style?.['transform-origin'];
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ p-cascadeselect.ng-invalid.ng-dirty .p-cascadeselect-label.p-placeholder {
top: 0;
}
.bottom-aligned .p-cascadeselect-option-active > .p-cascadeselect-option-list {
top: auto;
bottom: 0;
}
.p-cascadeselect-option-content {
display: flex;
align-items: center;
Expand Down

0 comments on commit 5f62cf4

Please sign in to comment.