Skip to content

Commit

Permalink
Merge pull request #15371 from primefaces/issue-15013
Browse files Browse the repository at this point in the history
Fixed #15013
  • Loading branch information
cetincakiroglu authored Apr 26, 2024
2 parents 7815968 + db74ec2 commit 647b1d5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/app/components/card/card.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { CommonModule } from '@angular/common';
import { AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, ContentChildren, ElementRef, Input, NgModule, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';
import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, ElementRef, Input, NgModule, QueryList, SimpleChange, TemplateRef, ViewEncapsulation, signal } from '@angular/core';
import { BlockableUI, Footer, Header, PrimeTemplate, SharedModule } from 'primeng/api';
import { ObjectUtils } from '../utils/objectutils';
/**
* Card is a flexible container component.
* @group Components
*/
@Component({
selector: 'p-card',
template: `
<div [ngClass]="'p-card p-component'" [ngStyle]="style" [class]="styleClass" [attr.data-pc-name]="'card'">
<div [ngClass]="'p-card p-component'" [ngStyle]="_style()" [class]="styleClass" [attr.data-pc-name]="'card'">
<div class="p-card-header" *ngIf="headerFacet || headerTemplate">
<ng-content select="p-header"></ng-content>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
Expand Down Expand Up @@ -55,7 +56,11 @@ export class Card implements AfterContentInit, BlockableUI {
* Inline style of the element.
* @group Props
*/
@Input() style: { [klass: string]: any } | null | undefined;
@Input() set style(value: { [klass: string]: any } | null | undefined) {
if (!ObjectUtils.equals(this._style(), value)) {
this._style.set(value);
}
}
/**
* Class of the element.
* @group Props
Expand All @@ -78,6 +83,8 @@ export class Card implements AfterContentInit, BlockableUI {

footerTemplate: TemplateRef<any> | undefined;

_style = signal<{ [klass: string]: any } | null | undefined>(null);

constructor(private el: ElementRef) {}

ngAfterContentInit() {
Expand Down

0 comments on commit 647b1d5

Please sign in to comment.