1 | import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Directive } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import { SharedModule } from 'primeng/api';
|
---|
4 | import { DomHandler } from 'primeng/dom';
|
---|
5 | import { UniqueComponentId } from 'primeng/utils';
|
---|
6 | import * as i0 from "@angular/core";
|
---|
7 | import * as i1 from "@angular/common";
|
---|
8 | export class BadgeDirective {
|
---|
9 | constructor(el) {
|
---|
10 | this.el = el;
|
---|
11 | this.iconPos = 'left';
|
---|
12 | }
|
---|
13 | ngAfterViewInit() {
|
---|
14 | this.id = UniqueComponentId() + '_badge';
|
---|
15 | let el = this.el.nativeElement.nodeName.indexOf("-") != -1 ? this.el.nativeElement.firstChild : this.el.nativeElement;
|
---|
16 | let badge = document.createElement('span');
|
---|
17 | badge.id = this.id;
|
---|
18 | badge.className = 'p-badge p-component';
|
---|
19 | if (this.severity) {
|
---|
20 | DomHandler.addClass(badge, 'p-badge-' + this.severity);
|
---|
21 | }
|
---|
22 | if (this.value != null) {
|
---|
23 | badge.appendChild(document.createTextNode(this.value));
|
---|
24 | if (String(this.value).length === 1) {
|
---|
25 | DomHandler.addClass(badge, 'p-badge-no-gutter');
|
---|
26 | }
|
---|
27 | }
|
---|
28 | else {
|
---|
29 | DomHandler.addClass(badge, 'p-badge-dot');
|
---|
30 | }
|
---|
31 | DomHandler.addClass(el, 'p-overlay-badge');
|
---|
32 | el.appendChild(badge);
|
---|
33 | this.initialized = true;
|
---|
34 | }
|
---|
35 | get value() {
|
---|
36 | return this._value;
|
---|
37 | }
|
---|
38 | set value(val) {
|
---|
39 | if (val !== this._value) {
|
---|
40 | this._value = val;
|
---|
41 | if (this.initialized) {
|
---|
42 | let badge = document.getElementById(this.id);
|
---|
43 | if (this._value) {
|
---|
44 | if (DomHandler.hasClass(badge, 'p-badge-dot'))
|
---|
45 | DomHandler.removeClass(badge, 'p-badge-dot');
|
---|
46 | if (String(this._value).length === 1) {
|
---|
47 | DomHandler.addClass(badge, 'p-badge-no-gutter');
|
---|
48 | }
|
---|
49 | else {
|
---|
50 | DomHandler.removeClass(badge, 'p-badge-no-gutter');
|
---|
51 | }
|
---|
52 | }
|
---|
53 | else if (!this._value && !DomHandler.hasClass(badge, 'p-badge-dot')) {
|
---|
54 | DomHandler.addClass(badge, 'p-badge-dot');
|
---|
55 | }
|
---|
56 | badge.innerHTML = '';
|
---|
57 | badge.appendChild(document.createTextNode(this._value));
|
---|
58 | }
|
---|
59 | }
|
---|
60 | }
|
---|
61 | ngOnDestroy() {
|
---|
62 | this.initialized = false;
|
---|
63 | }
|
---|
64 | }
|
---|
65 | BadgeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
---|
66 | 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 });
|
---|
67 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeDirective, decorators: [{
|
---|
68 | type: Directive,
|
---|
69 | args: [{
|
---|
70 | selector: '[pBadge]',
|
---|
71 | host: {
|
---|
72 | 'class': 'p-element'
|
---|
73 | }
|
---|
74 | }]
|
---|
75 | }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { iconPos: [{
|
---|
76 | type: Input
|
---|
77 | }], value: [{
|
---|
78 | type: Input
|
---|
79 | }], severity: [{
|
---|
80 | type: Input
|
---|
81 | }] } });
|
---|
82 | export class Badge {
|
---|
83 | containerClass() {
|
---|
84 | return {
|
---|
85 | 'p-badge p-component': true,
|
---|
86 | 'p-badge-no-gutter': this.value != undefined && String(this.value).length === 1,
|
---|
87 | 'p-badge-lg': this.size === 'large',
|
---|
88 | 'p-badge-xl': this.size === 'xlarge',
|
---|
89 | 'p-badge-info': this.severity === 'info',
|
---|
90 | 'p-badge-success': this.severity === 'success',
|
---|
91 | 'p-badge-warning': this.severity === 'warning',
|
---|
92 | 'p-badge-danger': this.severity === 'danger'
|
---|
93 | };
|
---|
94 | }
|
---|
95 | }
|
---|
96 | Badge.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
---|
97 | 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: `
|
---|
98 | <span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
|
---|
99 | {{value}}
|
---|
100 | </span>
|
---|
101 | `, 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 });
|
---|
102 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Badge, decorators: [{
|
---|
103 | type: Component,
|
---|
104 | args: [{ selector: 'p-badge', template: `
|
---|
105 | <span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
|
---|
106 | {{value}}
|
---|
107 | </span>
|
---|
108 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
109 | 'class': 'p-element'
|
---|
110 | }, 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"] }]
|
---|
111 | }], propDecorators: { styleClass: [{
|
---|
112 | type: Input
|
---|
113 | }], style: [{
|
---|
114 | type: Input
|
---|
115 | }], size: [{
|
---|
116 | type: Input
|
---|
117 | }], severity: [{
|
---|
118 | type: Input
|
---|
119 | }], value: [{
|
---|
120 | type: Input
|
---|
121 | }] } });
|
---|
122 | export class BadgeModule {
|
---|
123 | }
|
---|
124 | BadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
125 | 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] });
|
---|
126 | BadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, imports: [[CommonModule], SharedModule] });
|
---|
127 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BadgeModule, decorators: [{
|
---|
128 | type: NgModule,
|
---|
129 | args: [{
|
---|
130 | imports: [CommonModule],
|
---|
131 | exports: [Badge, BadgeDirective, SharedModule],
|
---|
132 | declarations: [Badge, BadgeDirective]
|
---|
133 | }]
|
---|
134 | }] });
|
---|
135 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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cy5fdmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKERvbUhhbmRsZXIuaGFzQ2xhc3MoYmFkZ2UsICdwLWJhZGdlLWRvdCcpKVxuICAgICAgICAgICAgICAgICAgICAgICAgRG9tSGFuZGxlci5yZW1vdmVDbGFzcyhiYWRnZSwgJ3AtYmFkZ2UtZG90Jyk7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKFN0cmluZyh0aGlzLl92YWx1ZSkubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBEb21IYW5kbGVyLmFkZENsYXNzKGJhZGdlLCAncC1iYWRnZS1uby1ndXR0ZXInKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIERvbUhhbmRsZXIucmVtb3ZlQ2xhc3MoYmFkZ2UsICdwLWJhZGdlLW5vLWd1dHRlcicpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKCF0aGlzLl92YWx1ZSAmJiAhRG9tSGFuZGxlci5oYXNDbGFzcyhiYWRnZSwgJ3AtYmFkZ2UtZG90JykpIHtcbiAgICAgICAgICAgICAgICAgICAgRG9tSGFuZGxlci5hZGRDbGFzcyhiYWRnZSwgJ3AtYmFkZ2UtZG90Jyk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgYmFkZ2UuaW5uZXJIVE1MID0gJyc7XG4gICAgICAgICAgICAgICAgYmFkZ2UuYXBwZW5kQ2hpbGQoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodGhpcy5fdmFsdWUpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIEBJbnB1dCgpIHNldmVyaXR5OiBzdHJpbmc7XG5cbiAgICBuZ09uRGVzdHJveSgpIHtcbiAgICAgICAgdGhpc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