ng-zorro-antd-mobile
Version:
An enterprise-class mobile UI components based on Ant Design and Angular
113 lines (108 loc) • 6.57 kB
JavaScript
import * as i0 from '@angular/core';
import { TemplateRef, EventEmitter, Component, Input, Output, HostBinding, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from 'ng-zorro-antd-mobile/icon';
import { IconModule } from 'ng-zorro-antd-mobile/icon';
class NavBarComponent {
set mode(value) {
this.defaultProps.mode = value;
this.amNavbarLight = this.defaultProps.mode === 'light';
this.amNavbardark = this.defaultProps.mode === 'dark';
}
get icon() {
return this._icon;
}
set icon(value) {
if (value instanceof TemplateRef) {
this.isIconString = false;
}
else {
this.isIconString = true;
}
this._icon = value;
}
get leftContent() {
return this._leftContent;
}
set leftContent(value) {
if (value instanceof TemplateRef) {
this.isLeftContentString = false;
}
else {
this.isLeftContentString = true;
}
this._leftContent = value;
}
get rightContent() {
return this._rightContent;
}
set rightContent(value) {
if (value instanceof TemplateRef) {
this.isRightContentString = false;
}
else {
this.isRightContentString = true;
}
this._rightContent = value;
}
constructor() {
this.defaultProps = {
prefixCls: 'am-navbar',
mode: 'dark',
onLeftClick: () => { }
};
this.navbarCls = {};
this.isIconString = true;
this.isLeftContentString = true;
this.isRightContentString = true;
this.onLeftClick = new EventEmitter();
this.amNavbar = true;
}
click(event) {
this.onLeftClick.emit(event);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NavBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.8", type: NavBarComponent, selector: "Navbar, nzm-nav-bar", inputs: { mode: "mode", icon: "icon", leftContent: "leftContent", rightContent: "rightContent" }, outputs: { onLeftClick: "onLeftClick" }, host: { properties: { "class.am-navbar": "this.amNavbar", "class.am-navbar-light": "this.amNavbarLight", "class.am-navbar-dark": "this.amNavbardark" } }, ngImport: i0, template: "<div role=\"button\" class=\"{{ defaultProps.prefixCls }}-left\" (click)=\"click($event)\">\n <ng-template *ngIf=\"!isLeftContentString\" [ngTemplateOutlet]=\"leftContent\"></ng-template>\n <span *ngIf=\"icon\" class=\"{{ defaultProps.prefixCls }}-left-icon\" aria-hidden=\"true\">\n <Icon *ngIf=\"isIconString\" [type]=\"icon\"></Icon>\n <ng-template *ngIf=\"!isIconString\" [ngTemplateOutlet]=\"icon\"></ng-template>\n </span>\n {{ isLeftContentString ? leftContent : null }}\n</div>\n<div class=\"{{ defaultProps.prefixCls }}-title\">\n <ng-content></ng-content>\n</div>\n<div class=\"{{ defaultProps.prefixCls }}-right\">\n {{ isRightContentString ? rightContent : null }}\n <ng-template *ngIf=\"!isRightContentString\" [ngTemplateOutlet]=\"rightContent\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.IconComponent, selector: "Icon, nzm-icon", inputs: ["color", "type", "src", "size"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NavBarComponent, decorators: [{
type: Component,
args: [{ selector: 'Navbar, nzm-nav-bar', template: "<div role=\"button\" class=\"{{ defaultProps.prefixCls }}-left\" (click)=\"click($event)\">\n <ng-template *ngIf=\"!isLeftContentString\" [ngTemplateOutlet]=\"leftContent\"></ng-template>\n <span *ngIf=\"icon\" class=\"{{ defaultProps.prefixCls }}-left-icon\" aria-hidden=\"true\">\n <Icon *ngIf=\"isIconString\" [type]=\"icon\"></Icon>\n <ng-template *ngIf=\"!isIconString\" [ngTemplateOutlet]=\"icon\"></ng-template>\n </span>\n {{ isLeftContentString ? leftContent : null }}\n</div>\n<div class=\"{{ defaultProps.prefixCls }}-title\">\n <ng-content></ng-content>\n</div>\n<div class=\"{{ defaultProps.prefixCls }}-right\">\n {{ isRightContentString ? rightContent : null }}\n <ng-template *ngIf=\"!isRightContentString\" [ngTemplateOutlet]=\"rightContent\"></ng-template>\n</div>\n" }]
}], ctorParameters: () => [], propDecorators: { mode: [{
type: Input
}], icon: [{
type: Input
}], leftContent: [{
type: Input
}], rightContent: [{
type: Input
}], onLeftClick: [{
type: Output
}], amNavbar: [{
type: HostBinding,
args: ['class.am-navbar']
}], amNavbarLight: [{
type: HostBinding,
args: ['class.am-navbar-light']
}], amNavbardark: [{
type: HostBinding,
args: ['class.am-navbar-dark']
}] } });
class NavBarModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NavBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: NavBarModule, declarations: [NavBarComponent], imports: [CommonModule, IconModule], exports: [NavBarComponent] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NavBarModule, imports: [CommonModule, IconModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NavBarModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, IconModule],
exports: [NavBarComponent],
declarations: [NavBarComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { NavBarComponent, NavBarModule };
//# sourceMappingURL=ng-zorro-antd-mobile-nav-bar.mjs.map