Skip to content

Commit

Permalink
Merge pull request #15261 from jacver/#15260-messages-closable-fix
Browse files Browse the repository at this point in the history
#15260: Messages component uses `closable` and `id` from `Message`
  • Loading branch information
cetincakiroglu authored Apr 18, 2024
2 parents ca020d4 + 38df04c commit 0038037
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/app/components/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { Subscription, timer } from 'rxjs';
role="alert"
[@messageAnimation]="{ value: 'visible', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }"
>
<div class="p-message-wrapper" [attr.data-pc-section]="'wrapper'">
<div class="p-message-wrapper" [attr.data-pc-section]="'wrapper'" [attr.id]="msg.id || null">
<span *ngIf="msg.icon" [class]="'p-message-icon pi ' + msg.icon" [attr.data-pc-section]="'icon'"> </span>
<span class="p-message-icon" *ngIf="!msg.icon">
<ng-container>
Expand All @@ -60,7 +60,7 @@ import { Subscription, timer } from 'rxjs';
<span *ngIf="msg.summary" class="p-message-summary" [attr.data-pc-section]="'summary'">{{ msg.summary }}</span>
<span *ngIf="msg.detail" class="p-message-detail" [attr.data-pc-section]="'detail'">{{ msg.detail }}</span>
</ng-template>
<button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable" type="button" pRipple [attr.aria-label]="closeAriaLabel" [attr.data-pc-section]="'closebutton'">
<button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable && (msg.closable ?? true)" type="button" pRipple [attr.aria-label]="closeAriaLabel" [attr.data-pc-section]="'closebutton'">
<TimesIcon [styleClass]="'p-message-close-icon'" [attr.data-pc-section]="'closeicon'" />
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/showcase/doc/apidoc/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@
"values": [
{
"name": "Message",
"description": "Deines valid options for the message.",
"description": "Defines valid options for the message.",
"props": [
{
"name": "severity",
Expand Down
4 changes: 2 additions & 2 deletions src/app/showcase/doc/messages/servicedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class MessagesServiceDemo {
addMultiple() {
this.messageService.addAll([
{severity:'success', summary:'Service Message', detail:'Via MessageService'},
{severity:'info', summary:'Info Message', detail:'Via MessageService'}
{ severity: 'success', summary: 'Service Message', detail: 'Via MessageService' },
{ severity: 'info', summary: 'Info Message', detail: 'Via MessageService' }
]);
}
Expand Down

0 comments on commit 0038037

Please sign in to comment.