ng-zorro-antd-mobile
Version:
An enterprise-class mobile UI components based on Ant Design and Angular
97 lines (92 loc) • 6.11 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, TemplateRef, Component, ViewEncapsulation, Input, Output, HostBinding, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import { IconModule } from 'ng-zorro-antd-mobile/icon';
class ResultComponent {
get title() {
return this._title;
}
set title(value) {
if (this.isTemplateRef(value)) {
this.isTitleString = false;
}
else {
this.isTitleString = true;
}
this._title = value;
}
get message() {
return this._message;
}
set message(value) {
if (this.isTemplateRef(value)) {
this.isMessageString = false;
}
else {
this.isMessageString = true;
}
this._message = value;
}
constructor() {
this.prefixCls = 'am-result';
this.isTitleString = true;
this.isMessageString = true;
this.onButtonClick = new EventEmitter();
this.role = 'alert';
this.amResult = true;
}
buttonClick(event) {
this.onButtonClick.emit(event);
}
isTemplateRef(value) {
if (value) {
return value instanceof TemplateRef;
}
return false;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ResultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: ResultComponent, selector: "Result, nzm-result", inputs: { title: "title", imgUrl: "imgUrl", buttonText: "buttonText", buttonType: "buttonType", img: "img", message: "message" }, outputs: { onButtonClick: "onButtonClick" }, host: { properties: { "attr.role": "this.role", "class.am-result": "this.amResult" } }, ngImport: i0, template: "<div *ngIf=\"img\" class=\"{{ prefixCls }}-pic\">\n <ng-template [ngTemplateOutlet]=\"img\"></ng-template>\n</div>\n<div *ngIf=\"!img && imgUrl\" class=\"{{ prefixCls }}-pic\" [ngStyle]=\"{ backgroundImage: 'url(' + imgUrl + ')' }\"></div>\n<div *ngIf=\"title\" class=\"{{ prefixCls }}-title\">\n <ng-template *ngIf=\"!isTitleString\" [ngTemplateOutlet]=\"title\"></ng-template>\n <span *ngIf=\"isTitleString\">{{ title }}</span>\n</div>\n<div [ngClass]=\"prefixCls + '-message'\">\n <ng-template *ngIf=\"!isMessageString\" [ngTemplateOutlet]=\"message\"></ng-template>\n <span *ngIf=\"isMessageString\">{{ message }}</span>\n</div>\n<div *ngIf=\"buttonText\" class=\"{{ prefixCls }}-button\">\n <a Button [type]=\"buttonType\" (click)=\"buttonClick($event)\">\n {{ buttonText }}\n </a>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ResultComponent, decorators: [{
type: Component,
args: [{ selector: 'Result, nzm-result', encapsulation: ViewEncapsulation.None, template: "<div *ngIf=\"img\" class=\"{{ prefixCls }}-pic\">\n <ng-template [ngTemplateOutlet]=\"img\"></ng-template>\n</div>\n<div *ngIf=\"!img && imgUrl\" class=\"{{ prefixCls }}-pic\" [ngStyle]=\"{ backgroundImage: 'url(' + imgUrl + ')' }\"></div>\n<div *ngIf=\"title\" class=\"{{ prefixCls }}-title\">\n <ng-template *ngIf=\"!isTitleString\" [ngTemplateOutlet]=\"title\"></ng-template>\n <span *ngIf=\"isTitleString\">{{ title }}</span>\n</div>\n<div [ngClass]=\"prefixCls + '-message'\">\n <ng-template *ngIf=\"!isMessageString\" [ngTemplateOutlet]=\"message\"></ng-template>\n <span *ngIf=\"isMessageString\">{{ message }}</span>\n</div>\n<div *ngIf=\"buttonText\" class=\"{{ prefixCls }}-button\">\n <a Button [type]=\"buttonType\" (click)=\"buttonClick($event)\">\n {{ buttonText }}\n </a>\n</div>\n" }]
}], ctorParameters: () => [], propDecorators: { title: [{
type: Input
}], imgUrl: [{
type: Input
}], buttonText: [{
type: Input
}], buttonType: [{
type: Input
}], img: [{
type: Input
}], message: [{
type: Input
}], onButtonClick: [{
type: Output
}], role: [{
type: HostBinding,
args: ['attr.role']
}], amResult: [{
type: HostBinding,
args: ['class.am-result']
}] } });
class ResultModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ResultModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: ResultModule, declarations: [ResultComponent], imports: [CommonModule, IconModule], exports: [ResultComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ResultModule, imports: [CommonModule, IconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: ResultModule, decorators: [{
type: NgModule,
args: [{
declarations: [ResultComponent],
exports: [ResultComponent],
imports: [CommonModule, IconModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { ResultComponent, ResultModule };
//# sourceMappingURL=ng-zorro-antd-mobile-result.mjs.map