ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
63 lines (52 loc) • 1.3 kB
text/typescript
import {
Component,
EventEmitter,
HostBinding,
HostListener,
Input,
Output,
} from '@angular/core';
import { toBoolean } from '../util/convert';
export class NzRowExpandIconComponent {
private _expand = false;
private _showExpand = true;
nzExpandChange = new EventEmitter();
set nzExpand(value: boolean) {
this._expand = toBoolean(value);
}
get nzExpand(): boolean {
return this._expand;
}
set nzShowExpand(value: boolean) {
this._showExpand = toBoolean(value);
}
get nzShowExpand(): boolean {
return this._showExpand;
}
get hidden(): boolean {
return !this.nzShowExpand;
}
get expanded(): boolean {
return this.nzShowExpand && this.nzExpand;
}
get collapsed(): boolean {
return this.nzShowExpand && !this.nzExpand;
}
onClick(): void {
this.nzExpand = !this.nzExpand;
this.nzExpandChange.emit(this.nzExpand);
}
}