You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
4.8 KiB
82 lines
4.8 KiB
import * as i0 from '@angular/core';
|
|
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
|
|
import * as i1 from '@angular/common';
|
|
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.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Chip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
Chip.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", 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: `
|
|
<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>
|
|
`, isInline: true, styles: [".p-chip{display:inline-flex;align-items:center}.p-chip-text{line-height:1.5}.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 });
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: 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, host: {
|
|
'class': 'p-element'
|
|
}, styles: [".p-chip{display:inline-flex;align-items:center}.p-chip-text{line-height:1.5}.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"] }]
|
|
}], 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.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ChipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
ChipModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ChipModule, declarations: [Chip], imports: [CommonModule], exports: [Chip] });
|
|
ChipModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ChipModule, imports: [[CommonModule]] });
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ChipModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [CommonModule],
|
|
exports: [Chip],
|
|
declarations: [Chip]
|
|
}]
|
|
}] });
|
|
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
export { Chip, ChipModule };
|
|
//# sourceMappingURL=primeng-chip.mjs.map
|