Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo update #14357

Merged
merged 130 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
cf9964e
progressSpinner demo update completed
mehmetcetin01140 Dec 4, 2023
4f54f79
progressbar update completed
mehmetcetin01140 Dec 4, 2023
c961583
skeleton update completed
mehmetcetin01140 Dec 4, 2023
a4c01bf
scrolltop update completed
mehmetcetin01140 Dec 4, 2023
755b51c
chip update completed
mehmetcetin01140 Dec 4, 2023
07116e0
tieredmenu update completed
mehmetcetin01140 Dec 4, 2023
aaf7e22
tieredmenu | routerdoc added
mehmetcetin01140 Dec 4, 2023
1609781
routerdoc links updated
mehmetcetin01140 Dec 5, 2023
769d13c
delay | template doc updated
mehmetcetin01140 Dec 5, 2023
3aad5df
sidebar headless and stackblitz update
mehmetcetin01140 Dec 5, 2023
ffa098c
toast templatedoc update completed
mehmetcetin01140 Dec 5, 2023
2e65ed1
toast | template and headless doc completed
mehmetcetin01140 Dec 5, 2023
9b20587
datatable doc update completed
mehmetcetin01140 Dec 6, 2023
e43ef5a
dialog | headless mode added
mehmetcetin01140 Dec 6, 2023
925d309
dialog mask style added
mehmetcetin01140 Dec 6, 2023
46e1253
dialog template doc updated
mehmetcetin01140 Dec 6, 2023
3465fa6
confirmpopup demo update completed
mehmetcetin01140 Dec 6, 2023
a975383
confirmdialog basic demo updated
mehmetcetin01140 Dec 6, 2023
fe9dd92
confirmdialog position doc updated
mehmetcetin01140 Dec 7, 2023
d1028f2
confirmdialog template update completed
mehmetcetin01140 Dec 7, 2023
619436b
confirmdialog headless template added
mehmetcetin01140 Dec 7, 2023
1b415cb
toolbar basic doc update completed
mehmetcetin01140 Dec 7, 2023
3578067
toolbar doc update completed
mehmetcetin01140 Dec 7, 2023
f4d27a5
tabview controlled doc updated
mehmetcetin01140 Dec 7, 2023
36d4bbc
tabview dynamic doc added
mehmetcetin01140 Dec 7, 2023
79566c7
panel template doc update completed
mehmetcetin01140 Dec 7, 2023
462125b
panel template doc updated
mehmetcetin01140 Dec 7, 2023
4757d55
divider content demo updated
mehmetcetin01140 Dec 7, 2023
947c82a
accordion controlled doc updated
mehmetcetin01140 Dec 7, 2023
3077d97
accordion controlled fix and template update
mehmetcetin01140 Dec 7, 2023
de67587
treetable template updated
mehmetcetin01140 Dec 7, 2023
221ffe2
tree controlled doc updated
mehmetcetin01140 Dec 7, 2023
35e300e
accordion controlled fix
mehmetcetin01140 Dec 8, 2023
b8e733e
button link doc updated
mehmetcetin01140 Dec 8, 2023
38e5594
tabview lazyload demo added
mehmetcetin01140 Dec 8, 2023
7592df9
button template doc updated
mehmetcetin01140 Dec 8, 2023
611e63e
button badge doc updated
mehmetcetin01140 Dec 8, 2023
ab7e8d7
togglebutton disabled doc added
mehmetcetin01140 Dec 8, 2023
ec91177
tristatecheckbox invalid doc added
mehmetcetin01140 Dec 8, 2023
6a20d4f
rating template doc cancel icon fix
mehmetcetin01140 Dec 8, 2023
62ad019
rating disabled doc fix
mehmetcetin01140 Dec 8, 2023
6a5839e
password locale doc added
mehmetcetin01140 Dec 8, 2023
c0b6bd7
knob reactive doc added
mehmetcetin01140 Dec 8, 2023
7b774eb
inputtextarea invalid doc added
mehmetcetin01140 Dec 8, 2023
887365a
inputgroup dependency fix and button class update
mehmetcetin01140 Dec 8, 2023
175be18
editor template doc updated
mehmetcetin01140 Dec 8, 2023
96643f9
lazyvirutalscroll doc added
mehmetcetin01140 Dec 8, 2023
25340ec
progressSpinner demo update completed
mehmetcetin01140 Dec 4, 2023
b7c1950
progressbar update completed
mehmetcetin01140 Dec 4, 2023
e5e854b
skeleton update completed
mehmetcetin01140 Dec 4, 2023
d701f3a
scrolltop update completed
mehmetcetin01140 Dec 4, 2023
b616267
chip update completed
mehmetcetin01140 Dec 4, 2023
72a5b9e
tieredmenu update completed
mehmetcetin01140 Dec 4, 2023
b134adb
tieredmenu | routerdoc added
mehmetcetin01140 Dec 4, 2023
566b8c3
routerdoc links updated
mehmetcetin01140 Dec 5, 2023
9627000
delay | template doc updated
mehmetcetin01140 Dec 5, 2023
e83b5bf
sidebar headless and stackblitz update
mehmetcetin01140 Dec 5, 2023
033b89e
toast templatedoc update completed
mehmetcetin01140 Dec 5, 2023
1162d77
toast | template and headless doc completed
mehmetcetin01140 Dec 5, 2023
fe37bd9
datatable doc update completed
mehmetcetin01140 Dec 6, 2023
c445fcd
dialog | headless mode added
mehmetcetin01140 Dec 6, 2023
c4c3853
dialog mask style added
mehmetcetin01140 Dec 6, 2023
85ee52a
dialog template doc updated
mehmetcetin01140 Dec 6, 2023
ebe637c
confirmpopup demo update completed
mehmetcetin01140 Dec 6, 2023
487dd1e
confirmdialog basic demo updated
mehmetcetin01140 Dec 6, 2023
a054113
confirmdialog position doc updated
mehmetcetin01140 Dec 7, 2023
533e799
confirmdialog template update completed
mehmetcetin01140 Dec 7, 2023
12d8bcd
confirmdialog headless template added
mehmetcetin01140 Dec 7, 2023
0418b94
toolbar basic doc update completed
mehmetcetin01140 Dec 7, 2023
b8fcb8d
toolbar doc update completed
mehmetcetin01140 Dec 7, 2023
5c88fcb
tabview controlled doc updated
mehmetcetin01140 Dec 7, 2023
e82f583
tabview dynamic doc added
mehmetcetin01140 Dec 7, 2023
e69e391
panel template doc update completed
mehmetcetin01140 Dec 7, 2023
22816cc
panel template doc updated
mehmetcetin01140 Dec 7, 2023
4103770
divider content demo updated
mehmetcetin01140 Dec 7, 2023
37ba0be
accordion controlled doc updated
mehmetcetin01140 Dec 7, 2023
09ec4e3
accordion controlled fix and template update
mehmetcetin01140 Dec 7, 2023
ba186a5
treetable template updated
mehmetcetin01140 Dec 7, 2023
8cba68f
tree controlled doc updated
mehmetcetin01140 Dec 7, 2023
91ba63e
accordion controlled fix
mehmetcetin01140 Dec 8, 2023
84cdfb3
button link doc updated
mehmetcetin01140 Dec 8, 2023
9e7639f
tabview lazyload demo added
mehmetcetin01140 Dec 8, 2023
1164e23
button template doc updated
mehmetcetin01140 Dec 8, 2023
86c2f10
button badge doc updated
mehmetcetin01140 Dec 8, 2023
169a002
togglebutton disabled doc added
mehmetcetin01140 Dec 8, 2023
8660819
tristatecheckbox invalid doc added
mehmetcetin01140 Dec 8, 2023
9a00d07
rating template doc cancel icon fix
mehmetcetin01140 Dec 8, 2023
76c4d54
rating disabled doc fix
mehmetcetin01140 Dec 8, 2023
6025fbd
password locale doc added
mehmetcetin01140 Dec 8, 2023
fd63dd9
knob reactive doc added
mehmetcetin01140 Dec 8, 2023
2bd7eb8
inputtextarea invalid doc added
mehmetcetin01140 Dec 8, 2023
87c5551
inputgroup dependency fix and button class update
mehmetcetin01140 Dec 8, 2023
2d4b73c
editor template doc updated
mehmetcetin01140 Dec 8, 2023
7aeb156
lazyvirutalscroll doc added
mehmetcetin01140 Dec 8, 2023
e0366ae
checkbox multiple doc updated
mehmetcetin01140 Dec 8, 2023
f0bab8c
merge demo update
mehmetcetin01140 Dec 8, 2023
d0c4e53
checkbox invalid doc added
mehmetcetin01140 Dec 8, 2023
b952389
cascadeselect floatlabel and invalid doc added
mehmetcetin01140 Dec 8, 2023
9d989ad
checkbox dynamic doc updated
mehmetcetin01140 Dec 8, 2023
78e3bf8
calendar float label doc added
mehmetcetin01140 Dec 9, 2023
14f4c38
calendar invalid doc added
mehmetcetin01140 Dec 9, 2023
eb21fd3
calendar disabled doc added
mehmetcetin01140 Dec 9, 2023
6218ecc
cascadeselect disabled doc added
mehmetcetin01140 Dec 9, 2023
2f618ad
autocomplete doc update
mehmetcetin01140 Dec 9, 2023
38a5ec1
types added
mehmetcetin01140 Dec 11, 2023
2d86940
dynamic dialog demo update
mehmetcetin01140 Dec 11, 2023
2ea94e3
Add missing class
cetincakiroglu Dec 11, 2023
5f80e58
Refactor lazy virtual scroll demo
cetincakiroglu Dec 11, 2023
24bb2aa
Calendar | Refactor icon demo, add inputIconTemplate
cetincakiroglu Dec 11, 2023
ae13c1c
Add missing invalid styles
cetincakiroglu Dec 11, 2023
d05c74f
dropdown invalid doc added
mehmetcetin01140 Dec 11, 2023
58de04b
tristate invalid doc added
mehmetcetin01140 Dec 11, 2023
8b63cf2
Update invalid styles for inputswitch
cetincakiroglu Dec 11, 2023
e6f0443
Merge branch 'demo-update' of https://github.com/primefaces/primeng i…
cetincakiroglu Dec 11, 2023
927106a
Update invalid input styles
cetincakiroglu Dec 11, 2023
b807bcf
inputswitch invalid doc added
mehmetcetin01140 Dec 11, 2023
56d7332
Merge branch 'demo-update' of https://github.com/primefaces/primeng i…
mehmetcetin01140 Dec 11, 2023
47e6353
code refactor
mehmetcetin01140 Dec 11, 2023
1bb10b9
Update dynamic dialog demo
cetincakiroglu Dec 12, 2023
251abad
refactor dynamic dialog example
cetincakiroglu Dec 12, 2023
5d37291
dynamic dialog updated
mehmetcetin01140 Dec 12, 2023
b9f043e
Fixed #14289
cetincakiroglu Dec 12, 2023
c45214c
Merge branch 'demo-update' of https://github.com/primefaces/primeng i…
cetincakiroglu Dec 12, 2023
6c3a5d2
Refactor
cetincakiroglu Dec 12, 2023
05e98df
dynamic dialog routefiles updated
mehmetcetin01140 Dec 12, 2023
602062f
infodemo update
mehmetcetin01140 Dec 12, 2023
dbb9b65
Refactor dynamicdialog demo
cetincakiroglu Dec 13, 2023
0de8fc8
Fixed #14313
cetincakiroglu Dec 13, 2023
7a07950
Fix typo
cetincakiroglu Dec 13, 2023
c8c387e
Fixed #14354 - DynamicDialog | Add templating support
cetincakiroglu Dec 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
436 changes: 123 additions & 313 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/app/components/calendar/calendar.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ export interface CalendarTemplates {
* Custom header template.
*/
header(): TemplateRef<any>;
/**
* Custom input icon template.
* @param {Object} context - input icon template params.
*/
inputIconTemplate(context: {
/**
* Click callback
*/
clickCallBack: () => void;
}): TemplateRef<{ clickCallBack: Function }>;
/**
* Custom previous icon template.
*/
Expand Down
29 changes: 26 additions & 3 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@ export const CALENDAR_VALUE_ACCESSOR: any = {
@Component({
selector: 'p-calendar',
template: `
<span #container [ngClass]="{ 'p-calendar': true, 'p-calendar-w-btn': showIcon, 'p-calendar-timeonly': timeOnly, 'p-calendar-disabled': disabled, 'p-focus': focus || overlayVisible }" [ngStyle]="style" [class]="styleClass">
<span
#container
[ngClass]="{
'p-calendar': true,
'p-input-icon-right': showIcon && iconDisplay === 'input',
'p-calendar-w-btn': showIcon && iconDisplay === 'button',
'p-calendar-timeonly': timeOnly,
'p-calendar-disabled': disabled,
'p-focus': focus || overlayVisible
}"
[ngStyle]="style"
[class]="styleClass"
>
<ng-template [ngIf]="!inline">
<input
#inputfield
Expand Down Expand Up @@ -95,7 +107,7 @@ export const CALENDAR_VALUE_ACCESSOR: any = {
[attr.aria-controls]="panelId"
pButton
pRipple
*ngIf="showIcon"
*ngIf="showIcon && iconDisplay === 'button'"
(click)="onButtonClick($event, inputfield)"
class="p-datepicker-trigger p-button-icon-only"
[disabled]="disabled"
Expand All @@ -107,6 +119,10 @@ export const CALENDAR_VALUE_ACCESSOR: any = {
<ng-template *ngTemplateOutlet="triggerIconTemplate"></ng-template>
</ng-container>
</button>
<ng-container *ngIf="iconDisplay === 'input' && showIcon">
<CalendarIcon *ngIf="!inputIconTemplate" (click)="onButtonClick($event)" />
<ng-container *ngTemplateOutlet="inputIconTemplate; context: { clickCallBack: onButtonClick.bind(this) }"></ng-container>
</ng-container>
</ng-template>
<div
#contentWrapper
Expand Down Expand Up @@ -442,6 +458,7 @@ export const CALENDAR_VALUE_ACCESSOR: any = {
styleUrls: ['./calendar.css']
})
export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
@Input() iconDisplay: 'input' | 'button' = 'button';
/**
* Inline style of the component.
* @group Props
Expand Down Expand Up @@ -1048,6 +1065,8 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {

incrementIconTemplate: Nullable<TemplateRef<any>>;

inputIconTemplate: Nullable<TemplateRef<any>>;

_disabledDates!: Array<Date>;

_disabledDays!: Array<number>;
Expand Down Expand Up @@ -1156,6 +1175,10 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
this.headerTemplate = item.template;
break;

case 'inputicon':
this.inputIconTemplate = item.template;
break;

case 'previousicon':
this.previousIconTemplate = item.template;
break;
Expand Down Expand Up @@ -1884,7 +1907,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
this.onModelTouched();
}

onButtonClick(event: Event, inputfield: any) {
onButtonClick(event: Event, inputfield: any = this.inputfieldViewChild?.nativeElement) {
if (!this.overlayVisible) {
inputfield.focus();
this.showOverlay();
Expand Down
10 changes: 9 additions & 1 deletion src/app/components/confirmdialog/confirmdialog.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export interface ConfirmDialogTemplates {
/**
* Custom template of message.
*/
message(): TemplateRef<any>;
message(context:{
$implicit?:any
}): TemplateRef<any>;
/**
* Custom template of icon.
*/
Expand All @@ -28,4 +30,10 @@ export interface ConfirmDialogTemplates {
* Custom template of accepticon.
*/
accepticon(): TemplateRef<any>;
/**
* Headless template.
*/
headless(context:{
$implicit?:any
}): TemplateRef<any>;
}
135 changes: 73 additions & 62 deletions src/app/components/confirmdialog/confirmdialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,71 +56,76 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
[attr.aria-labelledby]="getAriaLabelledBy()"
[attr.aria-modal]="true"
>
<div class="p-dialog-header" *ngIf="headerTemplate">
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</div>
<div class="p-dialog-header" *ngIf="!headerTemplate">
<span class="p-dialog-title" [id]="getAriaLabelledBy()" *ngIf="option('header')">{{ option('header') }}</span>
<div class="p-dialog-header-icons">
<button *ngIf="closable" type="button" role="button" [attr.aria-label]="closeAriaLabel" [ngClass]="{ 'p-dialog-header-icon p-dialog-header-close p-link': true }" (click)="close($event)" (keydown.enter)="close($event)">
<TimesIcon />
</button>
<ng-container *ngIf="headlessTemplate; else notHeadless">
<ng-container *ngTemplateOutlet="headlessTemplate; context: { $implicit: confirmation }"></ng-container>
</ng-container>
<ng-template #notHeadless>
<div class="p-dialog-header" *ngIf="headerTemplate">
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</div>
<div class="p-dialog-header" *ngIf="!headerTemplate">
<span class="p-dialog-title" [id]="getAriaLabelledBy()" *ngIf="option('header')">{{ option('header') }}</span>
<div class="p-dialog-header-icons">
<button *ngIf="closable" type="button" role="button" [attr.aria-label]="closeAriaLabel" [ngClass]="{ 'p-dialog-header-icon p-dialog-header-close p-link': true }" (click)="close($event)" (keydown.enter)="close($event)">
<TimesIcon />
</button>
</div>
</div>
</div>
<div #content class="p-dialog-content">
<i [ngClass]="'p-confirm-dialog-icon'" [class]="option('icon')" *ngIf="!iconTemplate && option('icon')"></i>
<ng-container *ngIf="iconTemplate">
<ng-template *ngTemplateOutlet="iconTemplate"></ng-template>
</ng-container>
<span class="p-confirm-dialog-message" *ngIf="!messageTemplate" [innerHTML]="option('message')"></span>
<ng-container *ngIf="messageTemplate">
<ng-template *ngTemplateOutlet="messageTemplate"></ng-template>
</ng-container>
</div>
<div class="p-dialog-footer" *ngIf="footer || footerTemplate">
<ng-content select="p-footer"></ng-content>
<ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
</div>
<div class="p-dialog-footer" *ngIf="!footer && !footerTemplate">
<button
type="button"
pRipple
pButton
[label]="rejectButtonLabel"
(click)="reject()"
[ngClass]="'p-confirm-dialog-reject'"
[class]="option('rejectButtonStyleClass')"
*ngIf="option('rejectVisible')"
[attr.aria-label]="rejectAriaLabel"
>
<ng-container *ngIf="!rejectIconTemplate">
<i *ngIf="option('rejectIcon')" [class]="option('rejectIcon')"></i>
<TimesIcon *ngIf="!option('rejectIcon')" [styleClass]="'p-button-icon-left'" />
<div #content class="p-dialog-content">
<i [ngClass]="'p-confirm-dialog-icon'" [class]="option('icon')" *ngIf="!iconTemplate && option('icon')"></i>
<ng-container *ngIf="iconTemplate">
<ng-template *ngTemplateOutlet="iconTemplate"></ng-template>
</ng-container>
<span *ngIf="rejectIconTemplate" class="p-button-icon-left">
<ng-template *ngTemplateOutlet="rejectIconTemplate"></ng-template>
</span>
</button>
<button
type="button"
pRipple
pButton
[label]="acceptButtonLabel"
(click)="accept()"
[ngClass]="'p-confirm-dialog-accept'"
[class]="option('acceptButtonStyleClass')"
*ngIf="option('acceptVisible')"
[attr.aria-label]="acceptAriaLabel"
>
<ng-container *ngIf="!acceptIconTemplate">
<i *ngIf="option('acceptIcon')" [class]="option('acceptIcon')"></i>
<CheckIcon *ngIf="!option('acceptIcon')" [styleClass]="'p-button-icon-left'" />
<span class="p-confirm-dialog-message" *ngIf="!messageTemplate" [innerHTML]="option('message')"></span>
<ng-container *ngIf="messageTemplate">
<ng-template *ngTemplateOutlet="messageTemplate; context: { $implicit: confirmation }"></ng-template>
</ng-container>
<span *ngIf="acceptIconTemplate" class="p-button-icon-left">
<ng-template *ngTemplateOutlet="acceptIconTemplate"></ng-template>
</span>
</button>
</div>
</div>
<div class="p-dialog-footer" *ngIf="footer || footerTemplate">
<ng-content select="p-footer"></ng-content>
<ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
</div>
<div class="p-dialog-footer" *ngIf="!footer && !footerTemplate">
<button
type="button"
pRipple
pButton
[label]="rejectButtonLabel"
(click)="reject()"
[ngClass]="'p-confirm-dialog-reject'"
[class]="option('rejectButtonStyleClass')"
*ngIf="option('rejectVisible')"
[attr.aria-label]="rejectAriaLabel"
>
<ng-container *ngIf="!rejectIconTemplate">
<i *ngIf="option('rejectIcon')" [class]="option('rejectIcon')"></i>
<TimesIcon *ngIf="!option('rejectIcon')" [styleClass]="'p-button-icon-left'" />
</ng-container>
<span *ngIf="rejectIconTemplate" class="p-button-icon-left">
<ng-template *ngTemplateOutlet="rejectIconTemplate"></ng-template>
</span>
</button>
<button
type="button"
pRipple
pButton
[label]="acceptButtonLabel"
(click)="accept()"
[ngClass]="'p-confirm-dialog-accept'"
[class]="option('acceptButtonStyleClass')"
*ngIf="option('acceptVisible')"
[attr.aria-label]="acceptAriaLabel"
>
<ng-container *ngIf="!acceptIconTemplate">
<i *ngIf="option('acceptIcon')" [class]="option('acceptIcon')"></i>
<CheckIcon *ngIf="!option('acceptIcon')" [styleClass]="'p-button-icon-left'" />
</ng-container>
<span *ngIf="acceptIconTemplate" class="p-button-icon-left">
<ng-template *ngTemplateOutlet="acceptIconTemplate"></ng-template>
</span>
</button>
</div>
</ng-template>
</div>
</div>
`,
Expand Down Expand Up @@ -377,6 +382,10 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy {
case 'accepticon':
this.acceptIconTemplate = item.template;
break;

case 'headless':
this.headlessTemplate = item.template;
break;
}
});
}
Expand All @@ -393,6 +402,8 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy {

iconTemplate: Nullable<TemplateRef<any>>;

headlessTemplate: Nullable<TemplateRef<any>>;

confirmation: Nullable<Confirmation>;

_visible: boolean | undefined;
Expand Down
12 changes: 12 additions & 0 deletions src/app/components/confirmpopup/confirmpopup.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { TemplateRef } from '@angular/core';
* @group Templates
*/
export interface ConfirmPopupTemplates {
/**
* Custom content template.
*/
content(context:{
$implicit?:any
}): TemplateRef<any>;
/**
* Custom template of rejecticon.
*/
Expand All @@ -13,4 +19,10 @@ export interface ConfirmPopupTemplates {
* Custom template of accepticon.
*/
accepticon(): TemplateRef<any>;
/**
* Headless template.
*/
headless(context:{
$implicit?:any
}): TemplateRef<any>;
}
28 changes: 25 additions & 3 deletions src/app/components/confirmpopup/confirmpopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ import { Subscription } from 'rxjs';
(@animation.start)="onAnimationStart($event)"
(@animation.done)="onAnimationEnd($event)"
>
<div #content class="p-confirm-popup-content">
<i [ngClass]="'p-confirm-popup-icon'" [class]="confirmation?.icon" *ngIf="confirmation?.icon"></i>
<span class="p-confirm-popup-message">{{ confirmation?.message }}</span>
<ng-container *ngIf="headlessTemplate; else notHeadless">
<ng-container *ngTemplateOutlet="headlessTemplate; context:{$implicit:confirmation}"></ng-container>
</ng-container>
<ng-template #notHeadless>
<div #content class="p-confirm-popup-content">
<ng-container *ngIf="contentTemplate; else withoutContentTemplate">
<ng-container *ngTemplateOutlet="contentTemplate; context:{$implicit:confirmation}"></ng-container>
</ng-container>
<ng-template #withoutContentTemplate>
<i [ngClass]="'p-confirm-popup-icon'" [class]="confirmation?.icon" *ngIf="confirmation?.icon"></i>
<span class="p-confirm-popup-message">{{ confirmation?.message }}</span>
</ng-template>
</div>
<div class="p-confirm-popup-footer">
<button
Expand Down Expand Up @@ -74,6 +83,7 @@ import { Subscription } from 'rxjs';
<ng-template #accepticon *ngTemplateOutlet="acceptIconTemplate"></ng-template>
</button>
</div>
</ng-template>
</div>
`,
animations: [
Expand Down Expand Up @@ -164,10 +174,14 @@ export class ConfirmPopup implements AfterContentInit, OnDestroy {

confirmation: Nullable<Confirmation>;

contentTemplate: Nullable<TemplateRef<any>>;

acceptIconTemplate: Nullable<TemplateRef<any>>;

rejectIconTemplate: Nullable<TemplateRef<any>>;

headlessTemplate: Nullable<TemplateRef<any>>;

_visible: boolean | undefined;

documentClickListener: VoidListener;
Expand Down Expand Up @@ -214,13 +228,21 @@ export class ConfirmPopup implements AfterContentInit, OnDestroy {
ngAfterContentInit() {
this.templates?.forEach((item) => {
switch (item.getType()) {
case 'content':
this.contentTemplate = item.template;
break;

case 'rejecticon':
this.rejectIconTemplate = item.template;
break;

case 'accepticon':
this.acceptIconTemplate = item.template;
break;

case 'headless':
this.headlessTemplate = item.template;
break;
}
});
}
Expand Down
Loading
Loading