From ba26de2742209e17277354ff1985810e3ce032a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:09:56 +0300 Subject: [PATCH 01/30] Fixed #15012 - TabMenu: Highlight does not update when selecting routerLink to unloaded module --- src/app/components/tabmenu/tabmenu.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/components/tabmenu/tabmenu.ts b/src/app/components/tabmenu/tabmenu.ts index fa72cdfc3e6..75f9a3837f0 100644 --- a/src/app/components/tabmenu/tabmenu.ts +++ b/src/app/components/tabmenu/tabmenu.ts @@ -23,7 +23,7 @@ import { booleanAttribute, signal } from '@angular/core'; -import { ActivatedRoute, Router, RouterModule } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, Router, RouterModule } from '@angular/router'; import { MenuItem, PrimeTemplate, SharedModule } from 'primeng/api'; import { DomHandler } from 'primeng/dom'; import { ChevronLeftIcon } from 'primeng/icons/chevronleft'; @@ -32,6 +32,7 @@ import { RippleModule } from 'primeng/ripple'; import { TooltipModule } from 'primeng/tooltip'; import { Nullable } from 'primeng/ts-helpers'; import { ObjectUtils } from 'primeng/utils'; +import { filter } from 'rxjs/operators'; /** * TabMenu is a navigation component that displays items as tab headers. @@ -245,12 +246,11 @@ export class TabMenu implements AfterContentInit, AfterViewInit, AfterViewChecke return this._focusableItems; } - constructor( - @Inject(PLATFORM_ID) private platformId: any, - private router: Router, - private route: ActivatedRoute, - private cd: ChangeDetectorRef - ) {} + constructor(@Inject(PLATFORM_ID) private platformId: any, private router: Router, private route: ActivatedRoute, private cd: ChangeDetectorRef) { + this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => { + this.cd.markForCheck(); + }); + } ngAfterContentInit() { this.templates?.forEach((item) => { From cdbd8f408bae6f41748b36bc36e5d1211f5ad9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:28:10 +0300 Subject: [PATCH 02/30] Fixed #15779 - Closing nested dialog removes CSS class still needed for parent dialog --- src/app/components/dynamicdialog/dynamicdialog.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/components/dynamicdialog/dynamicdialog.ts b/src/app/components/dynamicdialog/dynamicdialog.ts index 378ab0c535c..6e553361bbd 100755 --- a/src/app/components/dynamicdialog/dynamicdialog.ts +++ b/src/app/components/dynamicdialog/dynamicdialog.ts @@ -217,6 +217,7 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { get parent() { const domElements = Array.from(this.document.getElementsByClassName('p-dialog')); + if (domElements.length > 1) { return domElements.pop(); } @@ -266,6 +267,13 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { return this.config?.templates?.closeicon; } + get dynamicDialogCount() { + let dynamicDialogs = this.document.querySelectorAll('p-dynamicdialog'); + let dynamicDialogCount = dynamicDialogs?.length; + + return dynamicDialogCount; + } + constructor( @Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, @@ -305,6 +313,7 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { } } } + destroyStyle() { if (this.styleElement) { this.renderer.removeChild(this.document.head, this.styleElement); @@ -409,7 +418,7 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { }); } - if (this.config.modal !== false) { + if (this.dynamicDialogCount === 1) { DomHandler.addClass(this.document.body, 'p-overflow-hidden'); } } @@ -419,8 +428,7 @@ export class DynamicDialogComponent implements AfterViewInit, OnDestroy { if (this.config.dismissableMask) { this.unbindMaskClickListener(); } - - if (this.config.modal !== false) { + if (this.dynamicDialogCount === 1) { DomHandler.removeClass(this.document.body, 'p-overflow-hidden'); } From f0a265947548d67b81bf677aa13506470d40f9c3 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Sat, 15 Jun 2024 22:10:47 +0300 Subject: [PATCH 03/30] fix doc menu > steps routerlink active --- src/app/showcase/layout/menu/app.menuitem.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/showcase/layout/menu/app.menuitem.component.ts b/src/app/showcase/layout/menu/app.menuitem.component.ts index 3d2e11e3465..d6d9716c468 100644 --- a/src/app/showcase/layout/menu/app.menuitem.component.ts +++ b/src/app/showcase/layout/menu/app.menuitem.component.ts @@ -22,7 +22,7 @@ import { TagModule } from 'primeng/tag'; {{ item.name }} - + @@ -48,6 +48,6 @@ export class AppMenuItemComponent { isActiveRootMenuItem(menuitem: MenuItem): boolean { const url = this.router.url.split('#')[0]; - return menuitem.children && !menuitem.children.some((item) => item.routerLink === `${url}` || (item.children && item.children.some((it) => it.routerLink === `${url}`))); + return menuitem.children && !menuitem.children.some((item) => url.includes( item.routerLink) || (item.children && item.children.some((it) => url.includes(it.routerLink)))); } } From 64ed9ddc59e5a5caabebcbcdf7ef36c3bda85ee8 Mon Sep 17 00:00:00 2001 From: Will McAllister <53065222+willmca@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:32:16 -0400 Subject: [PATCH 04/30] Update dropdown.ts address issue by adding p-dropdown-open class when overlayVisible is true --- src/app/components/dropdown/dropdown.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index cdc9379fcdf..904f34a9ef5 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -932,7 +932,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV 'p-focus': this.focused, 'p-inputwrapper-filled': this.modelValue() !== undefined && this.modelValue() !== null && !this.modelValue().length, 'p-inputwrapper-focus': this.focused || this.overlayVisible, - 'p-variant-filled': this.variant === 'filled' || this.config.inputStyle() === 'filled' + 'p-variant-filled': this.variant === 'filled' || this.config.inputStyle() === 'filled', + 'p-dropdown-open': this.overlayVisible }; } From 62e1b3bf9c4d0a29325c64317724ef32945c5a79 Mon Sep 17 00:00:00 2001 From: Will McAllister <53065222+willmca@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:32:26 -0400 Subject: [PATCH 05/30] Update dropdown.spec.ts add a check for class name to unit test --- src/app/components/dropdown/dropdown.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/components/dropdown/dropdown.spec.ts b/src/app/components/dropdown/dropdown.spec.ts index 98f37ba2529..127a29c0b44 100755 --- a/src/app/components/dropdown/dropdown.spec.ts +++ b/src/app/components/dropdown/dropdown.spec.ts @@ -160,6 +160,7 @@ describe('Dropdown', () => { const dropdownPanel = fixture.debugElement.query(By.css('.p-dropdown-panel')); expect(dropdownPanel).toBeTruthy(); + expect(container.className).toContain('p-dropdown-open'); expect(dropdown.overlayVisible).toBeTrue(); }); From b9d15505aafb82cfc6aba60f99a06945baeb3564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:56:06 +0300 Subject: [PATCH 06/30] Fixed #15851 - Component: Accordion --- src/app/components/accordion/accordion.ts | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/app/components/accordion/accordion.ts b/src/app/components/accordion/accordion.ts index 447dbf88104..4a085387e85 100755 --- a/src/app/components/accordion/accordion.ts +++ b/src/app/components/accordion/accordion.ts @@ -230,11 +230,7 @@ export class AccordionTab implements AfterContentInit, OnDestroy { accordion: Accordion; - constructor( - @Inject(forwardRef(() => Accordion)) accordion: Accordion, - public el: ElementRef, - public changeDetector: ChangeDetectorRef - ) { + constructor(@Inject(forwardRef(() => Accordion)) accordion: Accordion, public el: ElementRef, public changeDetector: ChangeDetectorRef) { this.accordion = accordion as Accordion; this.id = UniqueComponentId(); } @@ -261,10 +257,20 @@ export class AccordionTab implements AfterContentInit, OnDestroy { }); } + isElementInList(target: HTMLElement | null, elementList: string[]): boolean { + if (!target) { + return false; + } + + const tagName = target.tagName.toLowerCase(); + return elementList.includes(tagName); + } + toggle(event?: MouseEvent | KeyboardEvent) { const target = event.target as HTMLElement; + const elements = ['a', 'button', 'input']; - if (this.disabled || !(target.tagName.toLowerCase() === 'a' && target.classList.contains('p-accordion-header-link'))) { + if (this.disabled || (this.isElementInList(target, elements) && !target.classList.contains('p-accordion-header-link'))) { return false; } @@ -316,7 +322,6 @@ export class AccordionTab implements AfterContentInit, OnDestroy { case 'Enter': case 'Space': this.toggle(event); - event.preventDefault(); break; default: break; @@ -443,10 +448,7 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy { public tabs: AccordionTab[] = []; - constructor( - public el: ElementRef, - public changeDetector: ChangeDetectorRef - ) {} + constructor(public el: ElementRef, public changeDetector: ChangeDetectorRef) {} @HostListener('keydown', ['$event']) onKeydown(event) { @@ -646,3 +648,4 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy { declarations: [Accordion, AccordionTab] }) export class AccordionModule {} + From b6422b3e754fd491b3594466a49976ad4b23190c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:08:09 +0300 Subject: [PATCH 07/30] refactor --- src/app/components/accordion/accordion.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/accordion/accordion.ts b/src/app/components/accordion/accordion.ts index 4a085387e85..ff5aa5f8ff1 100755 --- a/src/app/components/accordion/accordion.ts +++ b/src/app/components/accordion/accordion.ts @@ -268,7 +268,7 @@ export class AccordionTab implements AfterContentInit, OnDestroy { toggle(event?: MouseEvent | KeyboardEvent) { const target = event.target as HTMLElement; - const elements = ['a', 'button', 'input']; + const elements = ['a', 'button', 'input', 'textarea']; if (this.disabled || (this.isElementInList(target, elements) && !target.classList.contains('p-accordion-header-link'))) { return false; From 26f91f0245a1b45c1427f9fc874d3da4d6aba838 Mon Sep 17 00:00:00 2001 From: Kisters-BS <84901454+Kisters-BS@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:39:05 +0200 Subject: [PATCH 08/30] Fix aligment of popup menu for svg --- src/app/components/dom/domhandler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/dom/domhandler.ts b/src/app/components/dom/domhandler.ts index 24b232e37ac..bec25545745 100755 --- a/src/app/components/dom/domhandler.ts +++ b/src/app/components/dom/domhandler.ts @@ -126,7 +126,7 @@ export class DomHandler { }; const elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); - const targetHeight = target.offsetHeight; + const targetHeight = target.offsetHeight ?? target.getBoundingClientRect().height; const targetOffset = target.getBoundingClientRect(); const windowScrollTop = this.getWindowScrollTop(); const windowScrollLeft = this.getWindowScrollLeft(); @@ -168,8 +168,8 @@ export class DomHandler { const elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); const elementOuterHeight = elementDimensions.height; const elementOuterWidth = elementDimensions.width; - const targetOuterHeight = target.offsetHeight; - const targetOuterWidth = target.offsetWidth; + const targetOuterHeight = target.offsetHeight ?? target.getBoundingClientRect().height; + const targetOuterWidth = target.offsetWidth ?? target.getBoundingClientRect().width; const targetOffset = target.getBoundingClientRect(); const windowScrollTop = this.getWindowScrollTop(); const windowScrollLeft = this.getWindowScrollLeft(); From e564d56af9c592669115daad482aefb6f24dd65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:04:49 +0300 Subject: [PATCH 09/30] Fixed #15886 - Tree | Tree hierarchy --- src/app/components/tree/tree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/tree/tree.ts b/src/app/components/tree/tree.ts index 7ab4a17a4ca..ba4664498d7 100755 --- a/src/app/components/tree/tree.ts +++ b/src/app/components/tree/tree.ts @@ -134,7 +134,7 @@ import { -