ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
61 lines (53 loc) • 1.38 kB
text/typescript
import {
Component,
Input,
ViewEncapsulation,
} from '@angular/core';
import { toBoolean } from '../util/convert';
import { NzCollapseComponent } from './nz-collapse.component';
export class NzCollapsesetComponent {
private _accordion = false;
private _bordered = true;
// all child collapse
panels: NzCollapseComponent[] = [];
set nzAccordion(value: boolean) {
this._accordion = toBoolean(value);
}
get nzAccordion(): boolean {
return this._accordion;
}
set nzBordered(value: boolean) {
this._bordered = toBoolean(value);
}
get nzBordered(): boolean {
return this._bordered;
}
nzClick(collapse: NzCollapseComponent): void {
if (this.nzAccordion) {
this.panels.map((item, index) => {
const curIndex = this.panels.indexOf(collapse);
if (index !== curIndex) {
item.nzActive = false;
}
});
}
}
addTab(collapse: NzCollapseComponent): void {
this.panels.push(collapse);
}
}