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