primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [ • 2.22 kB
JavaScript
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
class Chip {
constructor() {
this.removeIcon = "pi pi-times-circle";
this.onRemove = new EventEmitter();
this.visible = true;
}
containerClass() {
return {
'p-chip p-component': true,
'p-chip-image': this.image != null
};
}
close(event) {
this.visible = false;
this.onRemove.emit(event);
}
}
Chip.decorators = [
{ type: Component, args: [{
selector: 'p-chip',
template: `
<div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style" *ngIf="visible">
<ng-content></ng-content>
<img [src]="image" *ngIf="image;else iconTemplate">
<ng-template #iconTemplate><span *ngIf="icon" [class]="icon" [ngClass]="'p-chip-icon'"></span></ng-template>
<div class="p-chip-text" *ngIf="label">{{label}}</div>
<span *ngIf="removable" tabindex="0" [class]="removeIcon" [ngClass]="'pi-chip-remove-icon'" (click)="close($event)" (keydown.enter)="close($event)"></span>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
styles: [".p-chip{align-items:center;display:inline-flex}.p-chip-icon.pi,.p-chip-text{line-height:1.5}.pi-chip-remove-icon{cursor:pointer;line-height:1.5}.p-chip img{border-radius:50%}"]
},] }
];
Chip.propDecorators = {
label: [{ type: Input }],
icon: [{ type: Input }],
image: [{ type: Input }],
style: [{ type: Input }],
styleClass: [{ type: Input }],
removable: [{ type: Input }],
removeIcon: [{ type: Input }],
onRemove: [{ type: Output }]
};
class ChipModule {
}
ChipModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule],
exports: [Chip],
declarations: [Chip]
},] }
];
/**
* Generated bundle index. Do not edit.
*/
export { Chip, ChipModule };
//# sourceMappingURL=primeng-chip.js.map