File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
projects/ui/src/lib/components/po-popover Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1212}
1313
1414< ng-template #sharedPopoverContent >
15- < div #popoverElement [hidden] ="isHidden " class ="po-popover " [style.width.px] ="width " [ngClass] ="customClasses() ">
15+ < div
16+ #popoverElement
17+ [hidden] ="isHidden "
18+ class ="po-popover "
19+ [style.width.px] ="width ?? widthPopover "
20+ [ngClass] ="customClasses() "
21+ >
1622 @if (!hideArrow) {
1723 < div class ="po-popover-arrow po-arrow-{{ arrowDirection }} "> </ div >
1824 }
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export class PoPopoverComponent extends PoPopoverBaseComponent implements AfterV
4747 timeoutResize ;
4848 targetElement ;
4949 afterViewInitWasCalled = false ;
50+ widthPopover : number = undefined ;
5051 private keydownTargetListener ?: ( ) => void ;
5152 private keydownPopoverListener ?: ( ) => void ;
5253 private resizeObserver : ResizeObserver ;
@@ -129,6 +130,17 @@ export class PoPopoverComponent extends PoPopoverBaseComponent implements AfterV
129130 this . setOpacity ( 1 ) ;
130131 this . openPopover . emit ( ) ;
131132 this . observeContentResize ( ) ;
133+ if ( this . cornerAligned && ! this . width ) {
134+ const el = this . popoverElement . nativeElement ;
135+
136+ el . style . width = 'auto' ;
137+ const width = el . scrollWidth ;
138+ this . widthPopover = width ;
139+
140+ requestAnimationFrame ( ( ) => {
141+ this . setPopoverPosition ( ) ;
142+ } ) ;
143+ }
132144 this . cd . detectChanges ( ) ;
133145 } ) ;
134146
You can’t perform that action at this time.
0 commit comments