1 | import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import * as i0 from "@angular/core";
|
---|
4 | import * as i1 from "@angular/common";
|
---|
5 | export class Chip {
|
---|
6 | constructor() {
|
---|
7 | this.removeIcon = "pi pi-times-circle";
|
---|
8 | this.onRemove = new EventEmitter();
|
---|
9 | this.visible = true;
|
---|
10 | }
|
---|
11 | containerClass() {
|
---|
12 | return {
|
---|
13 | 'p-chip p-component': true,
|
---|
14 | 'p-chip-image': this.image != null
|
---|
15 | };
|
---|
16 | }
|
---|
17 | close(event) {
|
---|
18 | this.visible = false;
|
---|
19 | this.onRemove.emit(event);
|
---|
20 | }
|
---|
21 | }
|
---|
22 | Chip.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Chip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
---|
23 | Chip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Chip, selector: "p-chip", inputs: { label: "label", icon: "icon", image: "image", style: "style", styleClass: "styleClass", removable: "removable", removeIcon: "removeIcon" }, outputs: { onRemove: "onRemove" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
---|
24 | <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style" *ngIf="visible">
|
---|
25 | <ng-content></ng-content>
|
---|
26 | <img [src]="image" *ngIf="image;else iconTemplate">
|
---|
27 | <ng-template #iconTemplate><span *ngIf="icon" [class]="icon" [ngClass]="'p-chip-icon'"></span></ng-template>
|
---|
28 | <div class="p-chip-text" *ngIf="label">{{label}}</div>
|
---|
29 | <span *ngIf="removable" tabindex="0" [class]="removeIcon" [ngClass]="'pi-chip-remove-icon'" (click)="close($event)" (keydown.enter)="close($event)"></span>
|
---|
30 | </div>
|
---|
31 | `, isInline: true, styles: [".p-chip{display:inline-flex;align-items:center}.p-chip-text,.p-chip-icon.pi{line-height:1.5}.pi-chip-remove-icon{line-height:1.5;cursor:pointer}.p-chip img{border-radius:50%}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
32 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Chip, decorators: [{
|
---|
33 | type: Component,
|
---|
34 | args: [{ selector: 'p-chip', template: `
|
---|
35 | <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style" *ngIf="visible">
|
---|
36 | <ng-content></ng-content>
|
---|
37 | <img [src]="image" *ngIf="image;else iconTemplate">
|
---|
38 | <ng-template #iconTemplate><span *ngIf="icon" [class]="icon" [ngClass]="'p-chip-icon'"></span></ng-template>
|
---|
39 | <div class="p-chip-text" *ngIf="label">{{label}}</div>
|
---|
40 | <span *ngIf="removable" tabindex="0" [class]="removeIcon" [ngClass]="'pi-chip-remove-icon'" (click)="close($event)" (keydown.enter)="close($event)"></span>
|
---|
41 | </div>
|
---|
42 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
43 | 'class': 'p-element'
|
---|
44 | }, styles: [".p-chip{display:inline-flex;align-items:center}.p-chip-text,.p-chip-icon.pi{line-height:1.5}.pi-chip-remove-icon{line-height:1.5;cursor:pointer}.p-chip img{border-radius:50%}\n"] }]
|
---|
45 | }], propDecorators: { label: [{
|
---|
46 | type: Input
|
---|
47 | }], icon: [{
|
---|
48 | type: Input
|
---|
49 | }], image: [{
|
---|
50 | type: Input
|
---|
51 | }], style: [{
|
---|
52 | type: Input
|
---|
53 | }], styleClass: [{
|
---|
54 | type: Input
|
---|
55 | }], removable: [{
|
---|
56 | type: Input
|
---|
57 | }], removeIcon: [{
|
---|
58 | type: Input
|
---|
59 | }], onRemove: [{
|
---|
60 | type: Output
|
---|
61 | }] } });
|
---|
62 | export class ChipModule {
|
---|
63 | }
|
---|
64 | ChipModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ChipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
65 | ChipModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ChipModule, declarations: [Chip], imports: [CommonModule], exports: [Chip] });
|
---|
66 | ChipModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ChipModule, imports: [[CommonModule]] });
|
---|
67 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ChipModule, decorators: [{
|
---|
68 | type: NgModule,
|
---|
69 | args: [{
|
---|
70 | imports: [CommonModule],
|
---|
71 | exports: [Chip],
|
---|
72 | declarations: [Chip]
|
---|
73 | }]
|
---|
74 | }] });
|
---|
75 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hpcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9jaGlwL2NoaXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsdUJBQXVCLEVBQUUsaUJBQWlCLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDN0gsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDOzs7QUFvQi9DLE1BQU0sT0FBTyxJQUFJO0lBbEJqQjtRQWdDYSxlQUFV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