112 lines
14 KiB
JavaScript
112 lines
14 KiB
JavaScript
import { CommonModule } from '@angular/common';
|
|
import { ChangeDetectionStrategy, Component, Input, NgModule, ViewEncapsulation, booleanAttribute } from '@angular/core';
|
|
import { CheckIcon } from 'primeng/icons/check';
|
|
import { ExclamationTriangleIcon } from 'primeng/icons/exclamationtriangle';
|
|
import { InfoCircleIcon } from 'primeng/icons/infocircle';
|
|
import { TimesCircleIcon } from 'primeng/icons/timescircle';
|
|
import * as i0 from "@angular/core";
|
|
import * as i1 from "@angular/common";
|
|
/**
|
|
* Message groups a collection of contents in tabs.
|
|
* @group Components
|
|
*/
|
|
export class UIMessage {
|
|
/**
|
|
* Severity level of the message.
|
|
* @group Props
|
|
*/
|
|
severity;
|
|
/**
|
|
* Text content.
|
|
* @group Props
|
|
*/
|
|
text;
|
|
/**
|
|
* Whether displaying messages would be escaped or not.
|
|
* @group Props
|
|
*/
|
|
escape = true;
|
|
/**
|
|
* Inline style of the component.
|
|
* @group Props
|
|
*/
|
|
style;
|
|
/**
|
|
* Style class of the component.
|
|
* @group Props
|
|
*/
|
|
styleClass;
|
|
get icon() {
|
|
if (this.severity) {
|
|
return this.severity === 'success' ? 'success' : this.severity === 'info' ? 'info' : this.severity === 'warning' ? 'warn' : this.severity === 'danger' ? 'error' : 'info';
|
|
}
|
|
else {
|
|
return 'info';
|
|
}
|
|
}
|
|
get containerClass() {
|
|
return {
|
|
[`p-inline-message-${this.severity}`]: this.severity,
|
|
'p-inline-message-icon-only': this.text == null
|
|
};
|
|
}
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: UIMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: UIMessage, selector: "p-message", inputs: { severity: "severity", text: "text", escape: ["escape", "escape", booleanAttribute], style: "style", styleClass: "styleClass" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
|
<div aria-live="polite" class="p-inline-message p-component p-inline-message" [ngStyle]="style" [class]="styleClass" [ngClass]="containerClass">
|
|
<CheckIcon *ngIf="icon === 'success'" [styleClass]="'p-inline-message-icon'" />
|
|
<InfoCircleIcon *ngIf="icon === 'info'" [styleClass]="'p-inline-message-icon'" />
|
|
<TimesCircleIcon *ngIf="icon === 'error'" [styleClass]="'p-inline-message-icon'" />
|
|
<ExclamationTriangleIcon *ngIf="icon === 'warn'" [styleClass]="'p-inline-message-icon'" />
|
|
<div *ngIf="!escape; else escapeOut">
|
|
<span *ngIf="!escape" class="p-inline-message-text" [innerHTML]="text"></span>
|
|
</div>
|
|
<ng-template #escapeOut>
|
|
<span *ngIf="escape" class="p-inline-message-text">{{ text }}</span>
|
|
</ng-template>
|
|
</div>
|
|
`, isInline: true, styles: ["@layer primeng{.p-inline-message{display:inline-flex;align-items:center;justify-content:center;vertical-align:top}.p-inline-message-icon-only .p-inline-message-text{visibility:hidden;width:0}.p-fluid .p-inline-message{display:flex}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i0.forwardRef(() => CheckIcon), selector: "CheckIcon" }, { kind: "component", type: i0.forwardRef(() => InfoCircleIcon), selector: "InfoCircleIcon" }, { kind: "component", type: i0.forwardRef(() => TimesCircleIcon), selector: "TimesCircleIcon" }, { kind: "component", type: i0.forwardRef(() => ExclamationTriangleIcon), selector: "ExclamationTriangleIcon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: UIMessage, decorators: [{
|
|
type: Component,
|
|
args: [{ selector: 'p-message', template: `
|
|
<div aria-live="polite" class="p-inline-message p-component p-inline-message" [ngStyle]="style" [class]="styleClass" [ngClass]="containerClass">
|
|
<CheckIcon *ngIf="icon === 'success'" [styleClass]="'p-inline-message-icon'" />
|
|
<InfoCircleIcon *ngIf="icon === 'info'" [styleClass]="'p-inline-message-icon'" />
|
|
<TimesCircleIcon *ngIf="icon === 'error'" [styleClass]="'p-inline-message-icon'" />
|
|
<ExclamationTriangleIcon *ngIf="icon === 'warn'" [styleClass]="'p-inline-message-icon'" />
|
|
<div *ngIf="!escape; else escapeOut">
|
|
<span *ngIf="!escape" class="p-inline-message-text" [innerHTML]="text"></span>
|
|
</div>
|
|
<ng-template #escapeOut>
|
|
<span *ngIf="escape" class="p-inline-message-text">{{ text }}</span>
|
|
</ng-template>
|
|
</div>
|
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
class: 'p-element'
|
|
}, styles: ["@layer primeng{.p-inline-message{display:inline-flex;align-items:center;justify-content:center;vertical-align:top}.p-inline-message-icon-only .p-inline-message-text{visibility:hidden;width:0}.p-fluid .p-inline-message{display:flex}}\n"] }]
|
|
}], propDecorators: { severity: [{
|
|
type: Input
|
|
}], text: [{
|
|
type: Input
|
|
}], escape: [{
|
|
type: Input,
|
|
args: [{ transform: booleanAttribute }]
|
|
}], style: [{
|
|
type: Input
|
|
}], styleClass: [{
|
|
type: Input
|
|
}] } });
|
|
export class MessageModule {
|
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: MessageModule, declarations: [UIMessage], imports: [CommonModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon], exports: [UIMessage] });
|
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageModule, imports: [CommonModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon] });
|
|
}
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
imports: [CommonModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon],
|
|
exports: [UIMessage],
|
|
declarations: [UIMessage]
|
|
}]
|
|
}] });
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9tZXNzYWdlL21lc3NhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLFFBQVEsRUFBRSxpQkFBaUIsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6SCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDaEQsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDNUUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzFELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQzs7O0FBQzVEOzs7R0FHRztBQXdCSCxNQUFNLE9BQU8sU0FBUztJQUNsQjs7O09BR0c7SUFDTSxRQUFRLENBQStHO0lBQ2hJOzs7T0FHRztJQUNNLElBQUksQ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