primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [ • 3.61 kB
JavaScript
import { Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Input, ContentChild, ContentChildren, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Header, Footer, PrimeTemplate, SharedModule } from 'primeng/api';
class Card {
constructor(el) {
this.el = el;
}
ngAfterContentInit() {
this.templates.forEach((item) => {
switch (item.getType()) {
case 'header':
this.headerTemplate = item.template;
break;
case 'title':
this.titleTemplate = item.template;
break;
case 'subtitle':
this.subtitleTemplate = item.template;
break;
case 'content':
this.contentTemplate = item.template;
break;
case 'footer':
this.footerTemplate = item.template;
break;
default:
this.contentTemplate = item.template;
break;
}
});
}
getBlockableElement() {
return this.el.nativeElement.children[0];
}
}
Card.decorators = [
{ type: Component, args: [{
selector: 'p-card',
template: `
<div [ngClass]="'p-card p-component'" [ngStyle]="style" [class]="styleClass">
<div class="p-card-header" *ngIf="headerFacet || headerTemplate">
<ng-content select="p-header"></ng-content>
<ng-container *ngTemplateOutlet="headerTemplate"></ng-container>
</div>
<div class="p-card-body">
<div class="p-card-title" *ngIf="header || titleTemplate">
{{header}}
<ng-container *ngTemplateOutlet="titleTemplate"></ng-container>
</div>
<div class="p-card-subtitle" *ngIf="subheader || subtitleTemplate">
{{subheader}}
<ng-container *ngTemplateOutlet="subtitleTemplate"></ng-container>
</div>
<div class="p-card-content">
<ng-content></ng-content>
<ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
</div>
<div class="p-card-footer" *ngIf="footerFacet || footerTemplate">
<ng-content select="p-footer"></ng-content>
<ng-container *ngTemplateOutlet="footerTemplate"></ng-container>
</div>
</div>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
styles: [".p-card-header img{width:100%}"]
},] }
];
Card.ctorParameters = () => [
{ type: ElementRef }
];
Card.propDecorators = {
header: [{ type: Input }],
subheader: [{ type: Input }],
style: [{ type: Input }],
styleClass: [{ type: Input }],
headerFacet: [{ type: ContentChild, args: [Header,] }],
footerFacet: [{ type: ContentChild, args: [Footer,] }],
templates: [{ type: ContentChildren, args: [PrimeTemplate,] }]
};
class CardModule {
}
CardModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule],
exports: [Card, SharedModule],
declarations: [Card]
},] }
];
/**
* Generated bundle index. Do not edit.
*/
export { Card, CardModule };
//# sourceMappingURL=primeng-card.js.map