source: trip-planner-front/node_modules/primeng/fesm2015/primeng-badge.mjs@ 6fe77af

Last change on this file since 6fe77af was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

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