ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
73 lines • 9.19 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Host, Input, Optional, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { slideMotion } from '../core/animation/slide';
import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive';
import { NzDropDownComponent } from './nz-dropdown.component';
import { NzDropDownDirective } from './nz-dropdown.directive';
import { NzMenuDropdownService } from './nz-menu-dropdown.service';
var NzDropDownButtonComponent = /** @class */ (function (_super) {
tslib_1.__extends(NzDropDownButtonComponent, _super);
function NzDropDownButtonComponent(cdr, nzMenuDropdownService, noAnimation) {
var _this = _super.call(this, cdr, nzMenuDropdownService, noAnimation) || this;
_this.noAnimation = noAnimation;
_this.nzSize = 'default';
_this.nzType = 'default';
_this.nzClick = new EventEmitter();
return _this;
}
/** rewrite afterViewInit hook */
/**
* rewrite afterViewInit hook
* @return {?}
*/
NzDropDownButtonComponent.prototype.ngAfterContentInit = /**
* rewrite afterViewInit hook
* @return {?}
*/
function () {
this.startSubscribe(this.visible$);
};
NzDropDownButtonComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-dropdown-button',
preserveWhitespaces: false,
animations: [slideMotion],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [NzMenuDropdownService],
template: "<div class=\"ant-btn-group ant-dropdown-button\" nz-dropdown>\n <button nz-button\n type=\"button\"\n [disabled]=\"nzDisabled\"\n [nzType]=\"nzType\"\n [nzSize]=\"nzSize\"\n (click)=\"nzClick.emit($event)\">\n <span><ng-content></ng-content></span>\n </button>\n <button nz-button\n type=\"button\"\n class=\"ant-dropdown-trigger\"\n [nzType]=\"nzType\"\n [nzSize]=\"nzSize\"\n [disabled]=\"nzDisabled\"\n (click)=\"setVisibleStateWhen(true,'click')\"\n (mouseenter)=\"setVisibleStateWhen(true,'hover')\"\n (mouseleave)=\"setVisibleStateWhen(false,'hover')\">\n <i nz-icon type=\"ellipsis\"></i>\n </button>\n</div>\n<ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]=\"nzTrigger === 'click'\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayOrigin]=\"nzDropDownDirective\"\n (backdropClick)=\"setVisibleStateWhen(false)\"\n (detach)=\"setVisibleStateWhen(false)\"\n [cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n (positionChange)=\"onPositionChange($event)\"\n [cdkConnectedOverlayOpen]=\"nzVisible\">\n <div class=\"{{'ant-dropdown ant-dropdown-placement-'+nzPlacement}}\"\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n [@slideMotion]=\"dropDownPosition\"\n (mouseenter)=\"setVisibleStateWhen(true,'hover')\"\n (mouseleave)=\"setVisibleStateWhen(false,'hover')\"\n [style.minWidth.px]=\"triggerWidth\">\n <ng-content select=\"[nz-menu]\"></ng-content>\n </div>\n</ng-template>",
styles: ["\n nz-dropdown-button {\n position: relative;\n display: inline-block;\n }\n\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 */
NzDropDownButtonComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: NzMenuDropdownService },
{ type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] }
]; };
NzDropDownButtonComponent.propDecorators = {
nzSize: [{ type: Input }],
nzType: [{ type: Input }],
nzClick: [{ type: Output }],
nzDropDownDirective: [{ type: ViewChild, args: [NzDropDownDirective,] }]
};
return NzDropDownButtonComponent;
}(NzDropDownComponent));
export { NzDropDownButtonComponent };
if (false) {
/** @type {?} */
NzDropDownButtonComponent.prototype.nzSize;
/** @type {?} */
NzDropDownButtonComponent.prototype.nzType;
/** @type {?} */
NzDropDownButtonComponent.prototype.nzClick;
/** @type {?} */
NzDropDownButtonComponent.prototype.nzDropDownDirective;
/** @type {?} */
NzDropDownButtonComponent.prototype.noAnimation;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotZHJvcGRvd24tYnV0dG9uLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQteWovIiwic291cmNlcyI6WyJkcm9wZG93bi9uei1kcm9wZG93bi1idXR0b24uY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUVMLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULFlBQVksRUFDWixJQUFJLEVBQ0osS0FBSyxFQUdMLFFBQVEsRUFDUixNQUFNLEVBQ04sU0FBUyxFQUNULGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0RBQWdELENBQUM7QUFDeEYsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDOUQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDOUQsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFFbkU7SUEwQitDLHFEQUFtQjtJQU1oRSxtQ0FDRSxHQUFzQixFQUN0QixxQkFBNEMsRUFDakIsV0FBb0M7UUFIakUsWUFLRSxrQkFBTSxHQUFHLEVBQUUscUJBQXFCLEVBQUUsV0FBVyxDQUFDLFNBQy9DO1FBSDRCLGlCQUFXLEdBQVgsV0FBVyxDQUF5QjtRQVJ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