UNPKG

@ohayojp.com/components

Version:

Common business components of ohayojp.

150 lines (144 loc) 4.68 kB
import { __decorate, __metadata } from 'tslib'; import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, Input, Output, NgModule } from '@angular/core'; import { OhayoLocaleService, OhayoLocaleModule } from '@ohayojp.com/theme'; import { InputBoolean, OhayoUtilModule } from '@ohayojp.com/util'; import { CommonModule } from '@angular/common'; import { NzIconModule } from 'ng-zorro-antd/icon'; /** * @fileoverview added by tsickle * Generated from: tag-select.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class TagSelectComponent { /** * @param {?} i18n * @param {?} cdr */ constructor(i18n, cdr) { this.i18n = i18n; this.cdr = cdr; this.locale = {}; this.expand = false; /** * 是否启用 `展开与收进` */ this.expandable = true; // tslint:disable-next-line:no-output-native this.change = new EventEmitter(); } /** * @return {?} */ ngOnInit() { this.i18n$ = this.i18n.change.subscribe((/** * @return {?} */ () => { this.locale = this.i18n.getData('tagSelect'); this.cdr.detectChanges(); })); } /** * @return {?} */ trigger() { this.expand = !this.expand; this.change.emit(this.expand); } /** * @return {?} */ ngOnDestroy() { this.i18n$.unsubscribe(); } } TagSelectComponent.decorators = [ { type: Component, args: [{ selector: 'tag-select', exportAs: 'tagSelect', template: "<ng-content></ng-content>\n<a *ngIf=\"expandable\" class=\"tag-select__trigger\" (click)=\"trigger()\">\n {{ expand ? locale.collapse : locale.expand }}<i nz-icon [nzType]=\"expand ? 'up' : 'down'\" class=\"tag-select__trigger-icon\"></i>\n</a>\n", host: { '[class.tag-select]': 'true', '[class.tag-select__has-expand]': 'expandable', '[class.tag-select__expanded]': 'expand', }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ TagSelectComponent.ctorParameters = () => [ { type: OhayoLocaleService }, { type: ChangeDetectorRef } ]; TagSelectComponent.propDecorators = { expandable: [{ type: Input }], change: [{ type: Output }] }; __decorate([ InputBoolean(), __metadata("design:type", Object) ], TagSelectComponent.prototype, "expandable", void 0); if (false) { /** @type {?} */ TagSelectComponent.ngAcceptInputType_expandable; /** * @type {?} * @private */ TagSelectComponent.prototype.i18n$; /** @type {?} */ TagSelectComponent.prototype.locale; /** @type {?} */ TagSelectComponent.prototype.expand; /** * 是否启用 `展开与收进` * @type {?} */ TagSelectComponent.prototype.expandable; /** @type {?} */ TagSelectComponent.prototype.change; /** * @type {?} * @private */ TagSelectComponent.prototype.i18n; /** * @type {?} * @private */ TagSelectComponent.prototype.cdr; } /** * @fileoverview added by tsickle * Generated from: tag-select.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const COMPONENTS = [TagSelectComponent]; class TagSelectModule { } TagSelectModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, NzIconModule, OhayoLocaleModule, OhayoUtilModule], 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: tagSelect.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { TagSelectComponent, TagSelectModule }; //# sourceMappingURL=tagSelect.js.map