79 lines
2.9 KiB
JavaScript
79 lines
2.9 KiB
JavaScript
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
|
|
class UIMessage {
|
|
constructor() {
|
|
this.escape = true;
|
|
}
|
|
get icon() {
|
|
let icon = null;
|
|
if (this.severity) {
|
|
switch (this.severity) {
|
|
case 'success':
|
|
icon = 'pi pi-check';
|
|
break;
|
|
case 'info':
|
|
icon = 'pi pi-info-circle';
|
|
break;
|
|
case 'error':
|
|
icon = 'pi pi-times-circle';
|
|
break;
|
|
case 'warn':
|
|
icon = 'pi pi-exclamation-triangle';
|
|
break;
|
|
default:
|
|
icon = 'pi pi-info-circle';
|
|
break;
|
|
}
|
|
}
|
|
return icon;
|
|
}
|
|
}
|
|
UIMessage.decorators = [
|
|
{ type: Component, args: [{
|
|
selector: 'p-message',
|
|
template: `
|
|
<div aria-live="polite" class="p-inline-message p-component p-inline-message" *ngIf="severity" [ngStyle]="style" [class]="styleClass"
|
|
[ngClass]="{'p-inline-message-info': (severity === 'info'),
|
|
'p-inline-message-warn': (severity === 'warn'),
|
|
'p-inline-message-error': (severity === 'error'),
|
|
'p-inline-message-success': (severity === 'success'),
|
|
'p-inline-message-icon-only': this.text == null}">
|
|
<span class="p-inline-message-icon" [ngClass]="icon"></span>
|
|
<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,
|
|
styles: [".p-inline-message{-ms-flex-align:center;-ms-flex-pack:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;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:-ms-flexbox;display:flex}"]
|
|
},] }
|
|
];
|
|
UIMessage.propDecorators = {
|
|
severity: [{ type: Input }],
|
|
text: [{ type: Input }],
|
|
escape: [{ type: Input }],
|
|
style: [{ type: Input }],
|
|
styleClass: [{ type: Input }]
|
|
};
|
|
class MessageModule {
|
|
}
|
|
MessageModule.decorators = [
|
|
{ type: NgModule, args: [{
|
|
imports: [CommonModule],
|
|
exports: [UIMessage],
|
|
declarations: [UIMessage]
|
|
},] }
|
|
];
|
|
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
export { MessageModule, UIMessage };
|
|
//# sourceMappingURL=primeng-message.js.map
|