ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
97 lines (88 loc) • 2.47 kB
text/typescript
import {
animate,
state,
style,
transition,
trigger,
} from '@angular/animations';
import {
Component,
ElementRef,
Host,
HostBinding,
Input,
} from '@angular/core';
import { toBoolean } from '../util/convert';
import { NzCollapsesetComponent } from './nz-collapseset.component';
export class NzCollapseComponent {
private _disabled = false;
_active = false;
_el;
nzTitle: string;
set nzDisabled(value: boolean) {
this._disabled = toBoolean(value);
}
get nzDisabled(): boolean {
return this._disabled;
}
set nzActive(value: boolean) {
const active = toBoolean(value);
if (this._active === active) {
return;
}
if (!this.nzDisabled) {
this._active = active;
}
}
get nzActive(): boolean {
return this._active;
}
clickHeader($event: MouseEvent): void {
this.nzActive = !this.nzActive;
/** trigger host collapseSet click event */
this._collapseSet.nzClick(this);
}
constructor( private _collapseSet: NzCollapsesetComponent, private _elementRef: ElementRef) {
this._el = this._elementRef.nativeElement;
this._collapseSet.addTab(this);
}
}