From 3d474658ad071843e4726012ba101f7b79a2588a Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Fri, 31 May 2024 23:57:03 +0200 Subject: [PATCH 1/7] fix button icon --- src/app/components/button/button.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index 69576110130..ea668e0c125 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -172,7 +172,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { constructor( public el: ElementRef, @Inject(DOCUMENT) private document: Document - ) {} + ) { } ngAfterViewInit() { DomHandler.addMultipleClasses(this.htmlElement, this.getStyleClass().join(' ')); @@ -363,7 +363,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { - + {{ label }} @@ -518,7 +518,7 @@ export class Button implements AfterContentInit { @ContentChildren(PrimeTemplate) templates: QueryList | undefined; - constructor(public el: ElementRef) {} + constructor(public el: ElementRef) { } spinnerIconClass(): string { return Object.entries(this.iconClass()) @@ -529,7 +529,7 @@ export class Button implements AfterContentInit { iconClass() { return { [`p-button-loading-icon pi-spin ${this.loadingIcon ?? ''}`]: this.loading, - 'p-button-icon': true, + 'pi p-button-icon': true, 'p-button-icon-left': this.iconPos === 'left' && this.label, 'p-button-icon-right': this.iconPos === 'right' && this.label, 'p-button-icon-top': this.iconPos === 'top' && this.label, @@ -592,4 +592,4 @@ export class Button implements AfterContentInit { imports: [ButtonDirective, Button], exports: [ButtonDirective, Button, SharedModule] }) -export class ButtonModule {} +export class ButtonModule { } From e746ab9c82a2e14521ff3bc550983cc3496bfdce Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 1 Jun 2024 11:53:07 +0200 Subject: [PATCH 2/7] format code --- src/app/showcase/doc/apidoc/index.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/app/showcase/doc/apidoc/index.json b/src/app/showcase/doc/apidoc/index.json index f039c698085..a316803b222 100644 --- a/src/app/showcase/doc/apidoc/index.json +++ b/src/app/showcase/doc/apidoc/index.json @@ -22310,6 +22310,26 @@ ], "description": "Callback to invoke when default command button is clicked." }, + { + "name": "onMenuHide", + "parameters": [ + { + "name": "value", + "type": "any" + } + ], + "description": "Callback to invoke when overlay menu is hidden." + }, + { + "name": "onMenuShow", + "parameters": [ + { + "name": "value", + "type": "any" + } + ], + "description": "Callback to invoke when overlay menu is shown." + }, { "name": "onDropdownClick", "parameters": [ From 7294cfd6004cc741b4da893715beda803a3827fd Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 1 Jun 2024 11:56:51 +0200 Subject: [PATCH 3/7] format code --- src/app/components/button/button.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index ea668e0c125..18b8eab0040 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -172,7 +172,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { constructor( public el: ElementRef, @Inject(DOCUMENT) private document: Document - ) { } + ) {} ngAfterViewInit() { DomHandler.addMultipleClasses(this.htmlElement, this.getStyleClass().join(' ')); @@ -518,7 +518,7 @@ export class Button implements AfterContentInit { @ContentChildren(PrimeTemplate) templates: QueryList | undefined; - constructor(public el: ElementRef) { } + constructor(public el: ElementRef) {} spinnerIconClass(): string { return Object.entries(this.iconClass()) @@ -592,4 +592,4 @@ export class Button implements AfterContentInit { imports: [ButtonDirective, Button], exports: [ButtonDirective, Button, SharedModule] }) -export class ButtonModule { } +export class ButtonModule {} From 33b060e958db3521754a60960302cd91b797809a Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 1 Jun 2024 12:11:39 +0200 Subject: [PATCH 4/7] fix button icon --- src/app/components/button/button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index 18b8eab0040..a80d98b80ee 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -363,7 +363,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { - + {{ label }} From 48c4d4333efca7259a4c74720658c12536d3564e Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 1 Jun 2024 13:40:08 +0200 Subject: [PATCH 5/7] fix button icon and now detects whatever class you pass --- src/app/components/button/button.ts | 36 ++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index a80d98b80ee..da680a4e7d1 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -172,7 +172,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { constructor( public el: ElementRef, @Inject(DOCUMENT) private document: Document - ) {} + ) { } ngAfterViewInit() { DomHandler.addMultipleClasses(this.htmlElement, this.getStyleClass().join(' ')); @@ -280,7 +280,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { DomHandler.addMultipleClasses(iconElement, iconClass); } - if (!this.loadingIcon && this.loading) { + if (this.loading && !this.loadingIcon) { iconElement.innerHTML = this.spinnerIcon; } @@ -303,10 +303,17 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { let iconElement = DomHandler.findSingle(this.htmlElement, '.p-button-icon'); let labelElement = DomHandler.findSingle(this.htmlElement, '.p-button-label'); - if (this.loading && !this.loadingIcon && iconElement) { - iconElement.innerHTML = this.spinnerIcon; - } else if (iconElement?.innerHTML) { + if (this.loading) { + if (!this.loadingIcon && iconElement) { + iconElement.innerHTML = this.spinnerIcon; + } else if (this.loadingIcon && iconElement) { + iconElement.className = `p-button-icon ${this.loadingIcon}`; + } + } else if (this.icon && iconElement) { + iconElement.className = `p-button-icon ${this.icon}`; + } else if (iconElement) { iconElement.innerHTML = ''; + this.createIcon(); } if (iconElement) { @@ -363,7 +370,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { - + {{ label }} @@ -518,7 +525,7 @@ export class Button implements AfterContentInit { @ContentChildren(PrimeTemplate) templates: QueryList | undefined; - constructor(public el: ElementRef) {} + constructor(public el: ElementRef) { } spinnerIconClass(): string { return Object.entries(this.iconClass()) @@ -527,14 +534,21 @@ export class Button implements AfterContentInit { } iconClass() { - return { - [`p-button-loading-icon pi-spin ${this.loadingIcon ?? ''}`]: this.loading, - 'pi p-button-icon': true, + const iconClasses = { + 'p-button-icon': true, 'p-button-icon-left': this.iconPos === 'left' && this.label, 'p-button-icon-right': this.iconPos === 'right' && this.label, 'p-button-icon-top': this.iconPos === 'top' && this.label, 'p-button-icon-bottom': this.iconPos === 'bottom' && this.label }; + + if (this.loading) { + iconClasses[`p-button-loading-icon pi-spin ${this.loadingIcon ?? ''}`] = true; + } else if (this.icon) { + iconClasses[this.icon] = true; + } + + return iconClasses; } get buttonClass() { @@ -592,4 +606,4 @@ export class Button implements AfterContentInit { imports: [ButtonDirective, Button], exports: [ButtonDirective, Button, SharedModule] }) -export class ButtonModule {} +export class ButtonModule { } From 17f43183f842988a9570c882f1a8380a2c6df8ec Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sat, 1 Jun 2024 13:40:35 +0200 Subject: [PATCH 6/7] format code --- src/app/components/button/button.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index da680a4e7d1..41bed597aac 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -172,7 +172,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { constructor( public el: ElementRef, @Inject(DOCUMENT) private document: Document - ) { } + ) {} ngAfterViewInit() { DomHandler.addMultipleClasses(this.htmlElement, this.getStyleClass().join(' ')); @@ -525,7 +525,7 @@ export class Button implements AfterContentInit { @ContentChildren(PrimeTemplate) templates: QueryList | undefined; - constructor(public el: ElementRef) { } + constructor(public el: ElementRef) {} spinnerIconClass(): string { return Object.entries(this.iconClass()) @@ -606,4 +606,4 @@ export class Button implements AfterContentInit { imports: [ButtonDirective, Button], exports: [ButtonDirective, Button, SharedModule] }) -export class ButtonModule { } +export class ButtonModule {} From 45141f4a633685a0e250ddb2611e6f05c8d83d18 Mon Sep 17 00:00:00 2001 From: Diego Franchina Date: Sun, 2 Jun 2024 17:41:34 +0200 Subject: [PATCH 7/7] restore change --- src/app/components/button/button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index 41bed597aac..90495589755 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -280,7 +280,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { DomHandler.addMultipleClasses(iconElement, iconClass); } - if (this.loading && !this.loadingIcon) { + if (!this.loadingIcon && this.loading) { iconElement.innerHTML = this.spinnerIcon; }