UNPKG

@ohayojp.com/components

Version:

Common business components of ohayojp.

186 lines (180 loc) 5.69 kB
import { __decorate, __metadata } from 'tslib'; import { Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, ElementRef, Renderer2, Input, NgModule } from '@angular/core'; import { InputNumber, OhayoUtilModule } from '@ohayojp.com/util'; import { CommonModule } from '@angular/common'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { NzIconModule } from 'ng-zorro-antd/icon'; /** * @fileoverview added by tsickle * Generated from: quick-menu.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class QuickMenuComponent { /** * @param {?} cdr * @param {?} el * @param {?} render */ constructor(cdr, el, render) { this.cdr = cdr; this.el = el; this.render = render; this.ctrlStyle = {}; this.icon = 'question-circle'; this.top = 120; this.width = 200; this.show = false; this.initFlag = false; } /** * @return {?} */ _click() { this.show = !this.show; this.setStyle(); } /** * @private * @return {?} */ setStyle() { this.ctrlStyle = { 'background-color': this.bgColor, 'border-color': this.borderColor, }; /** @type {?} */ const res = [`top:${this.top}px`, `width:${this.width}px`, `margin-right:-${this.show ? 0 : this.width}px`]; if (this.bgColor) { res.push(`background-color:${this.bgColor}`); } if (this.borderColor) { res.push(`border-color:${this.borderColor}`); } this.render.setAttribute(this.el.nativeElement, 'style', res.join(';')); this.cdr.detectChanges(); } /** * @return {?} */ ngOnInit() { this.initFlag = true; this.setStyle(); } /** * @return {?} */ ngOnChanges() { if (this.initFlag) this.setStyle(); } } QuickMenuComponent.decorators = [ { type: Component, args: [{ selector: 'quick-menu', exportAs: 'quickMenu', template: "<div class=\"quick-menu__inner\">\n <div class=\"quick-menu__ctrl\" [ngStyle]=\"ctrlStyle\">\n <div class=\"quick-menu__ctrl-icon\">\n <ng-container *nzStringTemplateOutlet=\"icon\">\n <i nz-icon [nzType]=\"icon\"></i>\n </ng-container>\n </div>\n </div>\n <ng-content></ng-content>\n</div>\n", host: { '[class.quick-menu]': 'true', '(click)': '_click()', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ QuickMenuComponent.ctorParameters = () => [ { type: ChangeDetectorRef }, { type: ElementRef }, { type: Renderer2 } ]; QuickMenuComponent.propDecorators = { icon: [{ type: Input }], top: [{ type: Input }], width: [{ type: Input }], bgColor: [{ type: Input }], borderColor: [{ type: Input }] }; __decorate([ InputNumber(), __metadata("design:type", Object) ], QuickMenuComponent.prototype, "top", void 0); __decorate([ InputNumber(), __metadata("design:type", Object) ], QuickMenuComponent.prototype, "width", void 0); if (false) { /** @type {?} */ QuickMenuComponent.ngAcceptInputType_top; /** @type {?} */ QuickMenuComponent.ngAcceptInputType_width; /** @type {?} */ QuickMenuComponent.prototype.ctrlStyle; /** @type {?} */ QuickMenuComponent.prototype.icon; /** @type {?} */ QuickMenuComponent.prototype.top; /** @type {?} */ QuickMenuComponent.prototype.width; /** @type {?} */ QuickMenuComponent.prototype.bgColor; /** @type {?} */ QuickMenuComponent.prototype.borderColor; /** * @type {?} * @private */ QuickMenuComponent.prototype.show; /** * @type {?} * @private */ QuickMenuComponent.prototype.initFlag; /** * @type {?} * @private */ QuickMenuComponent.prototype.cdr; /** * @type {?} * @private */ QuickMenuComponent.prototype.el; /** * @type {?} * @private */ QuickMenuComponent.prototype.render; } /** * @fileoverview added by tsickle * Generated from: quick-menu.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const COMPONENTS = [QuickMenuComponent]; class QuickMenuModule { } QuickMenuModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, NzIconModule, OhayoUtilModule, NzOutletModule], declarations: [...COMPONENTS], exports: [...COMPONENTS], },] } ]; /** * @fileoverview added by tsickle * Generated from: public_api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: quickMenu.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { QuickMenuComponent, QuickMenuModule }; //# sourceMappingURL=quickMenu.js.map