UNPKG

yoyo-ng-modulewindy

Version:

服务于52ABP模板的前端开源的相关组件内容。整合了ng-alain和你NG ZORRO的内容

71 lines 2.79 kB
import { Component, Input, HostListener, ChangeDetectionStrategy, ChangeDetectorRef, Renderer2, ElementRef, } from '@angular/core'; var QuickMenuComponent = /** @class */ (function () { // endregion function QuickMenuComponent(cd, el, render) { this.cd = cd; this.el = el; this.render = render; // region: fields this.icon = 'anticon anticon-question-circle-o'; this.top = 120; this.width = 200; this.bgColor = '#fff'; this.borderColor = '#ddd'; this.show = false; this.ctrlStyle = {}; this.initFlag = false; } QuickMenuComponent.prototype._click = function () { this.show = !this.show; this.setStyle(); }; QuickMenuComponent.prototype.setStyle = function () { this.ctrlStyle = { 'background-color': this.bgColor, 'border-color': this.borderColor, }; var res = [ "top:" + this.top + "px", "width:" + this.width + "px", "background-color:" + this.bgColor, "border-color:" + this.borderColor, "margin-right:-" + (this.show ? 0 : this.width) + "px", ]; this.render.setAttribute(this.el.nativeElement, 'style', res.join(';')); this.cd.detectChanges(); }; QuickMenuComponent.prototype.ngOnInit = function () { this.initFlag = true; this.setStyle(); }; QuickMenuComponent.prototype.ngOnChanges = function (changes) { if (this.initFlag) this.setStyle(); }; QuickMenuComponent.decorators = [ { type: Component, args: [{ selector: 'quick-menu', template: "\n <div class=\"ad-quick-menu__inner\">\n <div class=\"ad-quick-menu__ctrl\" [ngStyle]=\"ctrlStyle\">\n <i [ngClass]=\"icon\"></i>\n </div>\n <ng-content></ng-content>\n </div>\n ", host: { '[class.ad-quick-menu]': 'true' }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, },] }, ]; /** @nocollapse */ QuickMenuComponent.ctorParameters = function () { return [ { type: ChangeDetectorRef }, { type: ElementRef }, { type: Renderer2 } ]; }; QuickMenuComponent.propDecorators = { icon: [{ type: Input }], top: [{ type: Input }], width: [{ type: Input }], bgColor: [{ type: Input }], borderColor: [{ type: Input }], _click: [{ type: HostListener, args: ['click',] }] }; return QuickMenuComponent; }()); export { QuickMenuComponent }; //# sourceMappingURL=quick-menu.component.js.map