Skip to content

Commit 0503566

Browse files
fix(header): implementa ajuste 5
ajuste 5 Fixes: DTHFUI-12554
1 parent 6c43164 commit 0503566

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

projects/ui/src/lib/components/po-popover/po-popover.component.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
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
}

projects/ui/src/lib/components/po-popover/po-popover.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)