UNPKG

primeng

Version:

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

177 lines (172 loc) 7.46 kB
import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, inject, booleanAttribute, ContentChildren, ContentChild, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { SharedModule, PrimeTemplate } from 'primeng/api'; import { BaseComponent } from 'primeng/basecomponent'; import { style } from '@primeuix/styles/tag'; import { BaseStyle } from 'primeng/base'; const classes = { root: ({ instance }) => [ 'p-tag p-component', { 'p-tag-info': instance.severity === 'info', 'p-tag-success': instance.severity === 'success', 'p-tag-warn': instance.severity === 'warn', 'p-tag-danger': instance.severity === 'danger', 'p-tag-secondary': instance.severity === 'secondary', 'p-tag-contrast': instance.severity === 'contrast', 'p-tag-rounded': instance.rounded } ], icon: 'p-tag-icon', label: 'p-tag-label' }; class TagStyle extends BaseStyle { name = 'tag'; theme = style; classes = classes; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagStyle, decorators: [{ type: Injectable }] }); /** * * Tag component is used to categorize content. * * [Live Demo](https://www.primeng.org/tag) * * @module tagstyle * */ var TagClasses; (function (TagClasses) { /** * Class name of the root element */ TagClasses["root"] = "p-tag"; /** * Class name of the icon element */ TagClasses["icon"] = "p-tag-icon"; /** * Class name of the label element */ TagClasses["label"] = "p-tag-label"; })(TagClasses || (TagClasses = {})); /** * Tag component is used to categorize content. * @group Components */ class Tag extends BaseComponent { /** * Style class of the component. * @deprecated since v20.0.0, use `class` instead. * @group Props */ styleClass; /** * Severity type of the tag. * @group Props */ severity; /** * Value to display inside the tag. * @group Props */ value; /** * Icon of the tag to display next to the value. * @group Props */ icon; /** * Whether the corners of the tag are rounded. * @group Props */ rounded; iconTemplate; templates; _iconTemplate; _componentStyle = inject(TagStyle); ngAfterContentInit() { this.templates?.forEach((item) => { switch (item.getType()) { case 'icon': this._iconTemplate = item.template; break; } }); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Tag, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.1.3", type: Tag, isStandalone: true, selector: "p-tag", inputs: { styleClass: "styleClass", severity: "severity", value: "value", icon: "icon", rounded: ["rounded", "rounded", booleanAttribute] }, host: { properties: { "class": "cn(cx('root'), styleClass)" } }, providers: [TagStyle], queries: [{ propertyName: "iconTemplate", first: true, predicate: ["icon"] }, { propertyName: "templates", predicate: PrimeTemplate }], usesInheritance: true, ngImport: i0, template: ` <ng-content></ng-content> <ng-container *ngIf="!iconTemplate && !_iconTemplate"> <span [class]="cx('icon')" [ngClass]="icon" *ngIf="icon"></span> </ng-container> <span [class]="cx('icon')" *ngIf="iconTemplate || _iconTemplate"> <ng-template *ngTemplateOutlet="iconTemplate || _iconTemplate"></ng-template> </span> <span [class]="cx('label')">{{ value }}</span> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Tag, decorators: [{ type: Component, args: [{ selector: 'p-tag', standalone: true, imports: [CommonModule, SharedModule], template: ` <ng-content></ng-content> <ng-container *ngIf="!iconTemplate && !_iconTemplate"> <span [class]="cx('icon')" [ngClass]="icon" *ngIf="icon"></span> </ng-container> <span [class]="cx('icon')" *ngIf="iconTemplate || _iconTemplate"> <ng-template *ngTemplateOutlet="iconTemplate || _iconTemplate"></ng-template> </span> <span [class]="cx('label')">{{ value }}</span> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [TagStyle], host: { '[class]': "cn(cx('root'), styleClass)" } }] }], propDecorators: { styleClass: [{ type: Input }], severity: [{ type: Input }], value: [{ type: Input }], icon: [{ type: Input }], rounded: [{ type: Input, args: [{ transform: booleanAttribute }] }], iconTemplate: [{ type: ContentChild, args: ['icon', { descendants: false }] }], templates: [{ type: ContentChildren, args: [PrimeTemplate] }] } }); class TagModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: TagModule, imports: [Tag, SharedModule], exports: [Tag, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagModule, imports: [Tag, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: TagModule, decorators: [{ type: NgModule, args: [{ imports: [Tag, SharedModule], exports: [Tag, SharedModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { Tag, TagClasses, TagModule, TagStyle }; //# sourceMappingURL=primeng-tag.mjs.map