UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

65 lines 5.22 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Directive, ElementRef, Renderer2 } from '@angular/core'; import { fromEvent, merge } from 'rxjs'; import { mapTo, tap } from 'rxjs/operators'; var NzDropDownDirective = /** @class */ (function () { function NzDropDownDirective(elementRef, renderer) { this.elementRef = elementRef; this.renderer = renderer; this.el = this.elementRef.nativeElement; this.hover$ = merge(fromEvent(this.el, 'mouseenter').pipe(mapTo(true)), fromEvent(this.el, 'mouseleave').pipe(mapTo(false))); this.$click = fromEvent(this.el, 'click').pipe(tap((/** * @param {?} e * @return {?} */ function (e) { return e.stopPropagation(); })), mapTo(true)); renderer.addClass(elementRef.nativeElement, 'ant-dropdown-trigger'); } /** * @param {?} disabled * @return {?} */ NzDropDownDirective.prototype.setDisabled = /** * @param {?} disabled * @return {?} */ function (disabled) { if (disabled) { this.renderer.setAttribute(this.el, 'disabled', ''); } else { this.renderer.removeAttribute(this.el, 'disabled'); } }; NzDropDownDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-dropdown]' },] } ]; /** @nocollapse */ NzDropDownDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: Renderer2 } ]; }; return NzDropDownDirective; }()); export { NzDropDownDirective }; if (false) { /** @type {?} */ NzDropDownDirective.prototype.el; /** @type {?} */ NzDropDownDirective.prototype.hover$; /** @type {?} */ NzDropDownDirective.prototype.$click; /** @type {?} */ NzDropDownDirective.prototype.elementRef; /** * @type {?} * @private */ NzDropDownDirective.prototype.renderer; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotZHJvcGRvd24uZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImRyb3Bkb3duL256LWRyb3Bkb3duLmRp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