ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
249 lines • 22.7 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { CdkConnectedOverlay } from '@angular/cdk/overlay';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, EventEmitter, Host, Input, Optional, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { combineLatest, merge, EMPTY, Subject } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, mapTo, takeUntil } from 'rxjs/operators';
import { slideMotion } from '../core/animation/slide';
import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive';
import { DEFAULT_DROPDOWN_POSITIONS, POSITION_MAP } from '../core/overlay/overlay-position';
import { InputBoolean } from '../core/util/convert';
import { NzMenuDirective } from '../menu/nz-menu.directive';
import { NzDropDownDirective } from './nz-dropdown.directive';
import { NzMenuDropdownService } from './nz-menu-dropdown.service';
var NzDropDownComponent = /** @class */ (function () {
function NzDropDownComponent(cdr, nzMenuDropdownService, noAnimation) {
this.cdr = cdr;
this.nzMenuDropdownService = nzMenuDropdownService;
this.noAnimation = noAnimation;
this.triggerWidth = 0;
this.dropDownPosition = 'bottom';
this.positions = tslib_1.__spread(DEFAULT_DROPDOWN_POSITIONS);
this.visible$ = new Subject();
this.destroy$ = new Subject();
this.nzTrigger = 'hover';
this.nzOverlayClassName = '';
this.nzOverlayStyle = {};
this.nzPlacement = 'bottomLeft';
this.nzClickHide = true;
this.nzDisabled = false;
this.nzVisible = false;
this.nzTableFilter = false;
this.nzVisibleChange = new EventEmitter();
}
/**
* @param {?} visible
* @param {?=} trigger
* @return {?}
*/
NzDropDownComponent.prototype.setVisibleStateWhen = /**
* @param {?} visible
* @param {?=} trigger
* @return {?}
*/
function (visible, trigger) {
if (trigger === void 0) { trigger = 'all'; }
if (this.nzTrigger === trigger || trigger === 'all') {
this.visible$.next(visible);
}
};
/**
* @param {?} position
* @return {?}
*/
NzDropDownComponent.prototype.onPositionChange = /**
* @param {?} position
* @return {?}
*/
function (position) {
this.dropDownPosition = position.connectionPair.originY;
this.cdr.markForCheck();
};
/**
* @param {?} observable$
* @return {?}
*/
NzDropDownComponent.prototype.startSubscribe = /**
* @param {?} observable$
* @return {?}
*/
function (observable$) {
var _this = this;
/** @type {?} */
var click$ = this.nzClickHide ? this.nzMenuDropdownService.menuItemClick$.pipe(mapTo(false)) : EMPTY;
combineLatest(merge(observable$, click$), this.nzMenuDropdownService.menuOpen$)
.pipe(map((/**
* @param {?} value
* @return {?}
*/
function (value) { return value[0] || value[1]; })), debounceTime(50), distinctUntilChanged(), takeUntil(this.destroy$))
.subscribe((/**
* @param {?} visible
* @return {?}
*/
function (visible) {
if (!_this.nzDisabled && _this.nzVisible !== visible) {
_this.nzVisible = visible;
_this.nzVisibleChange.emit(_this.nzVisible);
_this.triggerWidth = _this.nzDropDownDirective.elementRef.nativeElement.getBoundingClientRect().width;
_this.cdr.markForCheck();
}
}));
};
/**
* @return {?}
*/
NzDropDownComponent.prototype.updateDisabledState = /**
* @return {?}
*/
function () {
if (this.nzDropDownDirective) {
this.nzDropDownDirective.setDisabled(this.nzDisabled);
}
};
/**
* @return {?}
*/
NzDropDownComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroy$.next();
this.destroy$.complete();
};
/**
* @return {?}
*/
NzDropDownComponent.prototype.ngAfterContentInit = /**
* @return {?}
*/
function () {
this.startSubscribe(merge(this.visible$, this.nzTrigger === 'hover' ? this.nzDropDownDirective.hover$ : this.nzDropDownDirective.$click));
this.updateDisabledState();
};
/**
* @param {?} changes
* @return {?}
*/
NzDropDownComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.nzVisible) {
this.visible$.next(this.nzVisible);
}
if (changes.nzDisabled) {
this.updateDisabledState();
}
if (changes.nzPlacement) {
this.dropDownPosition = this.nzPlacement.indexOf('top') !== -1 ? 'top' : 'bottom';
this.positions = tslib_1.__spread([POSITION_MAP[this.nzPlacement]], this.positions);
}
};
NzDropDownComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-dropdown',
preserveWhitespaces: false,
providers: [NzMenuDropdownService],
animations: [slideMotion],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
template: "<ng-content select=\"[nz-dropdown]\"></ng-content>\n<ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]=\"nzTrigger === 'click'\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayOrigin]=\"nzDropDownDirective\"\n [cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n [cdkConnectedOverlayOpen]=\"nzVisible\"\n (backdropClick)=\"setVisibleStateWhen(false)\"\n (detach)=\"setVisibleStateWhen(false)\"\n (positionChange)=\"onPositionChange($event)\">\n <div class=\"{{'ant-dropdown ant-dropdown-placement-'+nzPlacement}}\"\n [ngClass]=\"nzOverlayClassName\"\n [ngStyle]=\"nzOverlayStyle\"\n [@slideMotion]=\"dropDownPosition\"\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n [style.minWidth.px]=\"triggerWidth\"\n (mouseenter)=\"setVisibleStateWhen(true,'hover')\"\n (mouseleave)=\"setVisibleStateWhen(false,'hover')\">\n <div [class.ant-table-filter-dropdown]=\"nzTableFilter\">\n <ng-content select=\"[nz-menu]\"></ng-content>\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>",
styles: ["\n .ant-dropdown {\n top: 100%;\n left: 0;\n position: relative;\n width: 100%;\n margin-top: 4px;\n margin-bottom: 4px;\n }\n "]
}] }
];
/** @nocollapse */
NzDropDownComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: NzMenuDropdownService },
{ type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] }
]; };
NzDropDownComponent.propDecorators = {
nzDropDownDirective: [{ type: ContentChild, args: [NzDropDownDirective,] }],
nzMenuDirective: [{ type: ContentChild, args: [NzMenuDirective,] }],
cdkConnectedOverlay: [{ type: ViewChild, args: [CdkConnectedOverlay,] }],
nzTrigger: [{ type: Input }],
nzOverlayClassName: [{ type: Input }],
nzOverlayStyle: [{ type: Input }],
nzPlacement: [{ type: Input }],
nzClickHide: [{ type: Input }],
nzDisabled: [{ type: Input }],
nzVisible: [{ type: Input }],
nzTableFilter: [{ type: Input }],
nzVisibleChange: [{ type: Output }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzDropDownComponent.prototype, "nzClickHide", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzDropDownComponent.prototype, "nzDisabled", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzDropDownComponent.prototype, "nzVisible", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzDropDownComponent.prototype, "nzTableFilter", void 0);
return NzDropDownComponent;
}());
export { NzDropDownComponent };
if (false) {
/** @type {?} */
NzDropDownComponent.prototype.triggerWidth;
/** @type {?} */
NzDropDownComponent.prototype.dropDownPosition;
/** @type {?} */
NzDropDownComponent.prototype.positions;
/** @type {?} */
NzDropDownComponent.prototype.visible$;
/**
* @type {?}
* @private
*/
NzDropDownComponent.prototype.destroy$;
/** @type {?} */
NzDropDownComponent.prototype.nzDropDownDirective;
/** @type {?} */
NzDropDownComponent.prototype.nzMenuDirective;
/** @type {?} */
NzDropDownComponent.prototype.cdkConnectedOverlay;
/** @type {?} */
NzDropDownComponent.prototype.nzTrigger;
/** @type {?} */
NzDropDownComponent.prototype.nzOverlayClassName;
/** @type {?} */
NzDropDownComponent.prototype.nzOverlayStyle;
/** @type {?} */
NzDropDownComponent.prototype.nzPlacement;
/** @type {?} */
NzDropDownComponent.prototype.nzClickHide;
/** @type {?} */
NzDropDownComponent.prototype.nzDisabled;
/** @type {?} */
NzDropDownComponent.prototype.nzVisible;
/** @type {?} */
NzDropDownComponent.prototype.nzTableFilter;
/** @type {?} */
NzDropDownComponent.prototype.nzVisibleChange;
/**
* @type {?}
* @protected
*/
NzDropDownComponent.prototype.cdr;
/**
* @type {?}
* @private
*/
NzDropDownComponent.prototype.nzMenuDropdownService;
/** @type {?} */
NzDropDownComponent.prototype.noAnimation;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotZHJvcGRvd24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImRyb3Bkb3duL256LWRyb3Bkb3duLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxtQkFBbUIsRUFBMEQsTUFBTSxzQkFBc0IsQ0FBQztBQUNuSCxPQUFPLEVBRUwsdUJBQXVCLEVBQ3ZCLGlCQUFpQixFQUNqQixTQUFTLEVBQ1QsWUFBWSxFQUNaLFlBQVksRUFDWixJQUFJLEVBQ0osS0FBSyxFQUdMLFFBQVEsRUFDUixNQUFNLEVBRU4sU0FBUyxFQUNULGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsYUFBYSxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQWMsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQ3hFLE9BQU8sRUFBRSxZQUFZLEVBQUUsb0JBQW9CLEVBQUUsR0FBRyxFQUFFLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMzRixPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0RBQWdELENBQUM7QUFDeEYsT0FBTyxFQUFFLDBC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