import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Directive } from '@angular/core'; import { CommonModule } from '@angular/common'; import { SharedModule } from 'primeng/api'; import { DomHandler } from 'primeng/dom'; import { UniqueComponentId } from 'primeng/utils'; import * as i0 from "@angular/core"; import * as i1 from "@angular/common"; export class BadgeDirective { constructor(el) { this.el = el; this.iconPos = 'left'; } ngAfterViewInit() { this.id = UniqueComponentId() + '_badge'; let el = this.el.nativeElement.nodeName.indexOf("-") != -1 ? this.el.nativeElement.firstChild : this.el.nativeElement; let badge = document.createElement('span'); badge.id = this.id; badge.className = 'p-badge p-component'; if (this.severity) { DomHandler.addClass(badge, 'p-badge-' + this.severity); } if (this.value != null) { badge.appendChild(document.createTextNode(this.value)); if (String(this.value).length === 1) { DomHandler.addClass(badge, 'p-badge-no-gutter'); } } else { DomHandler.addClass(badge, 'p-badge-dot'); } DomHandler.addClass(el, 'p-overlay-badge'); el.appendChild(badge); this.initialized = true; } get value() { return this._value; } set value(val) { if (val !== this._value) { this._value = val; if (this.initialized) { let badge = document.getElementById(this.id); if (this._value) { if (DomHandler.hasClass(badge, 'p-badge-dot')) DomHandler.removeClass(badge, 'p-badge-dot'); if (String(this._value).length === 1) { DomHandler.addClass(badge, 'p-badge-no-gutter'); } else { DomHandler.removeClass(badge, 'p-badge-no-gutter'); } } else if (!this._value && !DomHandler.hasClass(badge, 'p-badge-dot')) { DomHandler.addClass(badge, 'p-badge-dot'); } badge.innerHTML = ''; badge.appendChild(document.createTextNode(this._value)); } } } ngOnDestroy() { this.initialized = false; } } BadgeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); BadgeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: BadgeDirective, selector: "[pBadge]", inputs: { iconPos: "iconPos", value: "value", severity: "severity" }, host: { classAttribute: "p-element" }, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeDirective, decorators: [{ type: Directive, args: [{ selector: '[pBadge]', host: { 'class': 'p-element' } }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { iconPos: [{ type: Input }], value: [{ type: Input }], severity: [{ type: Input }] } }); export class Badge { containerClass() { return { 'p-badge p-component': true, 'p-badge-no-gutter': this.value != undefined && String(this.value).length === 1, 'p-badge-lg': this.size === 'large', 'p-badge-xl': this.size === 'xlarge', 'p-badge-info': this.severity === 'info', 'p-badge-success': this.severity === 'success', 'p-badge-warning': this.severity === 'warning', 'p-badge-danger': this.severity === 'danger' }; } } Badge.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component }); Badge.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Badge, selector: "p-badge", inputs: { styleClass: "styleClass", style: "style", size: "size", severity: "severity", value: "value" }, host: { classAttribute: "p-element" }, ngImport: i0, template: ` {{value}} `, isInline: true, styles: [".p-badge{display:inline-block;border-radius:10px;text-align:center;padding:0 .5rem}.p-overlay-badge{position:relative}.p-overlay-badge .p-badge{position:absolute;top:0;right:0;transform:translate(50%,-50%);transform-origin:100% 0;margin:0}.p-badge-dot{width:.5rem;min-width:.5rem;height:.5rem;border-radius:50%;padding:0}.p-badge-no-gutter{padding:0;border-radius:50%}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Badge, decorators: [{ type: Component, args: [{ selector: 'p-badge', template: ` {{value}} `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'p-element' }, styles: [".p-badge{display:inline-block;border-radius:10px;text-align:center;padding:0 .5rem}.p-overlay-badge{position:relative}.p-overlay-badge .p-badge{position:absolute;top:0;right:0;transform:translate(50%,-50%);transform-origin:100% 0;margin:0}.p-badge-dot{width:.5rem;min-width:.5rem;height:.5rem;border-radius:50%;padding:0}.p-badge-no-gutter{padding:0;border-radius:50%}\n"] }] }], propDecorators: { styleClass: [{ type: Input }], style: [{ type: Input }], size: [{ type: Input }], severity: [{ type: Input }], value: [{ type: Input }] } }); export class BadgeModule { } BadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); BadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, declarations: [Badge, BadgeDirective], imports: [CommonModule], exports: [Badge, BadgeDirective, SharedModule] }); BadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, imports: [[CommonModule], SharedModule] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule], exports: [Badge, BadgeDirective, SharedModule], declarations: [Badge, BadgeDirective] }] }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFkZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvYmFkZ2UvYmFkZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsdUJBQXVCLEVBQUUsaUJBQW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gaWYgKFN0cmluZyh0aGlzLl92YWx1ZSkubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBEb21IYW5kbGVyLmFkZENsYXNzKGJhZGdlLCAncC1iYWRnZS1uby1ndXR0ZXInKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIERvbUhhbmRsZXIucmVtb3ZlQ2xhc3MoYmFkZ2UsICdwLWJhZGdlLW5vLWd1dHRlcicpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKCF0aGlzLl92YWx1ZSAmJiAhRG9tSGFuZGxlci5oYXNDbGFzcyhiYWRnZSwgJ3AtYmFkZ2UtZG90JykpIHtcbiAgICAgICAgICAgICAgICAgICAgRG9tSGFuZGxlci5hZGRDbGFzcyhiYWRnZSwgJ3AtYmFkZ2UtZG90Jyk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgYmFkZ2UuaW5uZXJIVE1MID0gJyc7XG4gICAgICAgICAgICAgICAgYmFkZ2UuYXBwZW5kQ2hpbGQoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodGhpcy5fdmFsdWUpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIEBJbnB1dCgpIHNldmVyaXR5OiBzdHJpbmc7XG5cbiAgICBuZ09uRGVzdHJveSgpIHtcbiAgICAgICAgdGhpcy5pbml0aWFsaXplZCA9IGZhbHNlO1xuICAgIH1cbn1cblxuQENvbXBvbmVudCh7XG4gICAgc2VsZWN0b3I6ICdwLWJhZGdlJyxcbiAgICB0ZW1wbGF0ZTogYFxuICAgICAgICA8c3BhbiBbbmdDbGFzc109XCJjb250YWluZXJDbGFzcygpXCIgW2NsYXNzXT1cInN0eWxlQ2xhc3NcIiBbbmdTdHlsZV09XC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