UNPKG

primeng

Version:

PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,

253 lines (248 loc) 13.7 kB
export * from 'primeng/types/card'; import { NgTemplateOutlet } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, InjectionToken, inject, input, contentChild, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { Header, Footer, SharedModule } from 'primeng/api'; import { BaseComponent, PARENT_INSTANCE } from 'primeng/basecomponent'; import * as i1 from 'primeng/bind'; import { Bind, BindModule } from 'primeng/bind'; import { style } from '@primeuix/styles/card'; import { BaseStyle } from 'primeng/base'; const classes = { root: 'p-card p-component', header: 'p-card-header', body: 'p-card-body', caption: 'p-card-caption', title: 'p-card-title', subtitle: 'p-card-subtitle', content: 'p-card-content', footer: 'p-card-footer' }; class CardStyle extends BaseStyle { name = 'card'; style = style; classes = classes; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardStyle, decorators: [{ type: Injectable }] }); /** * * Card is a flexible container component. * * [Live Demo](https://www.primeng.org/card/) * * @module cardstyle * */ var CardClasses; (function (CardClasses) { /** * Class name of the root element */ CardClasses["root"] = "p-card"; /** * Class name of the header element */ CardClasses["header"] = "p-card-header"; /** * Class name of the body element */ CardClasses["body"] = "p-card-body"; /** * Class name of the caption element */ CardClasses["caption"] = "p-card-caption"; /** * Class name of the title element */ CardClasses["title"] = "p-card-title"; /** * Class name of the subtitle element */ CardClasses["subtitle"] = "p-card-subtitle"; /** * Class name of the content element */ CardClasses["content"] = "p-card-content"; /** * Class name of the footer element */ CardClasses["footer"] = "p-card-footer"; })(CardClasses || (CardClasses = {})); const CARD_INSTANCE = new InjectionToken('CARD_INSTANCE'); /** * Card is a flexible container component. * @group Components */ class Card extends BaseComponent { componentName = 'Card'; $pcCard = inject(CARD_INSTANCE, { optional: true, skipSelf: true }) ?? undefined; bindDirectiveInstance = inject(Bind, { self: true }); _componentStyle = inject(CardStyle); /** * Header of the card. * @group Props */ header = input(/* @ts-ignore */ ...(ngDevMode ? [undefined, { debugName: "header" }] : /* istanbul ignore next */ [])); /** * Subheader of the card. * @group Props */ subheader = input(/* @ts-ignore */ ...(ngDevMode ? [undefined, { debugName: "subheader" }] : /* istanbul ignore next */ [])); headerFacet = contentChild(Header, { ...(ngDevMode ? { debugName: "headerFacet" } : /* istanbul ignore next */ {}), descendants: false }); footerFacet = contentChild(Footer, { ...(ngDevMode ? { debugName: "footerFacet" } : /* istanbul ignore next */ {}), descendants: false }); /** * Custom header template. * @group Templates */ headerTemplate = contentChild('header', { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), descendants: false }); /** * Custom title template. * @group Templates */ titleTemplate = contentChild('title', { ...(ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {}), descendants: false }); /** * Custom subtitle template. * @group Templates */ subtitleTemplate = contentChild('subtitle', { ...(ngDevMode ? { debugName: "subtitleTemplate" } : /* istanbul ignore next */ {}), descendants: false }); /** * Custom content template. * @group Templates */ contentTemplate = contentChild('content', { ...(ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {}), descendants: false }); /** * Custom footer template. * @group Templates */ footerTemplate = contentChild('footer', { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), descendants: false }); // Template visibility computeds hasHeader = computed(() => !!(this.headerFacet() || this.headerTemplate()), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "hasHeader" }] : /* istanbul ignore next */ [])); hasTitle = computed(() => !!(this.header() || this.titleTemplate()), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "hasTitle" }] : /* istanbul ignore next */ [])); hasSubtitle = computed(() => !!(this.subheader() || this.subtitleTemplate()), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "hasSubtitle" }] : /* istanbul ignore next */ [])); hasFooter = computed(() => !!(this.footerFacet() || this.footerTemplate()), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "hasFooter" }] : /* istanbul ignore next */ [])); showHeaderText = computed(() => this.header() && !this.titleTemplate(), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "showHeaderText" }] : /* istanbul ignore next */ [])); showSubheaderText = computed(() => this.subheader() && !this.subtitleTemplate(), /* @ts-ignore */ ...(ngDevMode ? [{ debugName: "showSubheaderText" }] : /* istanbul ignore next */ [])); onAfterViewChecked() { this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root'])); } getBlockableElement() { return this.el.nativeElement; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: Card, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: Card, isStandalone: true, selector: "p-card", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "cx('root')" } }, providers: [CardStyle, { provide: CARD_INSTANCE, useExisting: Card }, { provide: PARENT_INSTANCE, useExisting: Card }], queries: [{ propertyName: "headerFacet", first: true, predicate: Header, isSignal: true }, { propertyName: "footerFacet", first: true, predicate: Footer, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ["header"], isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: ["title"], isSignal: true }, { propertyName: "subtitleTemplate", first: true, predicate: ["subtitle"], isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: ["content"], isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], isSignal: true }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: ` @if (hasHeader()) { <div [pBind]="ptm('header')" [class]="cx('header')"> <ng-content select="p-header"></ng-content> <ng-container *ngTemplateOutlet="headerTemplate()"></ng-container> </div> } <div [pBind]="ptm('body')" [class]="cx('body')"> @if (hasTitle()) { <div [pBind]="ptm('title')" [class]="cx('title')"> @if (showHeaderText()) { {{ header() }} } <ng-container *ngTemplateOutlet="titleTemplate()"></ng-container> </div> } @if (hasSubtitle()) { <div [pBind]="ptm('subtitle')" [class]="cx('subtitle')"> @if (showSubheaderText()) { {{ subheader() }} } <ng-container *ngTemplateOutlet="subtitleTemplate()"></ng-container> </div> } <div [pBind]="ptm('content')" [class]="cx('content')"> <ng-content></ng-content> <ng-container *ngTemplateOutlet="contentTemplate()"></ng-container> </div> @if (hasFooter()) { <div [pBind]="ptm('footer')" [class]="cx('footer')"> <ng-content select="p-footer"></ng-content> <ng-container *ngTemplateOutlet="footerTemplate()"></ng-container> </div> } </div> `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: BindModule }, { kind: "directive", type: i1.Bind, selector: "[pBind]", inputs: ["pBind"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: Card, decorators: [{ type: Component, args: [{ selector: 'p-card', standalone: true, imports: [NgTemplateOutlet, SharedModule, BindModule], template: ` @if (hasHeader()) { <div [pBind]="ptm('header')" [class]="cx('header')"> <ng-content select="p-header"></ng-content> <ng-container *ngTemplateOutlet="headerTemplate()"></ng-container> </div> } <div [pBind]="ptm('body')" [class]="cx('body')"> @if (hasTitle()) { <div [pBind]="ptm('title')" [class]="cx('title')"> @if (showHeaderText()) { {{ header() }} } <ng-container *ngTemplateOutlet="titleTemplate()"></ng-container> </div> } @if (hasSubtitle()) { <div [pBind]="ptm('subtitle')" [class]="cx('subtitle')"> @if (showSubheaderText()) { {{ subheader() }} } <ng-container *ngTemplateOutlet="subtitleTemplate()"></ng-container> </div> } <div [pBind]="ptm('content')" [class]="cx('content')"> <ng-content></ng-content> <ng-container *ngTemplateOutlet="contentTemplate()"></ng-container> </div> @if (hasFooter()) { <div [pBind]="ptm('footer')" [class]="cx('footer')"> <ng-content select="p-footer"></ng-content> <ng-container *ngTemplateOutlet="footerTemplate()"></ng-container> </div> } </div> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CardStyle, { provide: CARD_INSTANCE, useExisting: Card }, { provide: PARENT_INSTANCE, useExisting: Card }], host: { '[class]': "cx('root')" }, hostDirectives: [Bind] }] }], propDecorators: { header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], subheader: [{ type: i0.Input, args: [{ isSignal: true, alias: "subheader", required: false }] }], headerFacet: [{ type: i0.ContentChild, args: [i0.forwardRef(() => Header), { ...{ descendants: false }, isSignal: true }] }], footerFacet: [{ type: i0.ContentChild, args: [i0.forwardRef(() => Footer), { ...{ descendants: false }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: ['header', { ...{ descendants: false }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: ['title', { ...{ descendants: false }, isSignal: true }] }], subtitleTemplate: [{ type: i0.ContentChild, args: ['subtitle', { ...{ descendants: false }, isSignal: true }] }], contentTemplate: [{ type: i0.ContentChild, args: ['content', { ...{ descendants: false }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: ['footer', { ...{ descendants: false }, isSignal: true }] }] } }); class CardModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: CardModule, imports: [Card, SharedModule, BindModule], exports: [Card, SharedModule, BindModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardModule, imports: [Card, SharedModule, BindModule, SharedModule, BindModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardModule, decorators: [{ type: NgModule, args: [{ imports: [Card, SharedModule, BindModule], exports: [Card, SharedModule, BindModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { Card, CardClasses, CardModule, CardStyle }; //# sourceMappingURL=primeng-card.mjs.map