ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
106 lines (99 loc) • 3.12 kB
text/typescript
import {
AfterViewInit,
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import { dropDownAnimation } from '../core/animation/dropdown-animations';
import { toBoolean } from '../util/convert';
import { NzDropDownComponent } from './nz-dropdown.component';
import { NzDropDownDirective } from './nz-dropdown.directive';
export class NzDropDownButtonComponent extends NzDropDownComponent implements OnInit, OnDestroy, AfterViewInit {
_disabled = false;
nzSize = 'default';
nzType = 'default';
content;
nzClick = new EventEmitter();
_nzOrigin;
set nzDisabled(value: boolean) {
this._disabled = toBoolean(value);
}
get nzDisabled(): boolean {
return this._disabled;
}
_onVisibleChange = (visible: boolean) => {
if (this.nzDisabled) {
return;
}
if (visible) {
this._setTriggerWidth();
}
if (this.nzVisible !== visible) {
this.nzVisible = visible;
this.nzVisibleChange.emit(this.nzVisible);
}
this._changeDetector.markForCheck();
}
/** rewrite afterViewInit hook */
ngAfterViewInit(): void {
this._startSubscribe(this._visibleChange);
}
}