UNPKG

@taiga-ui/kit

Version:
77 lines (72 loc) 3.73 kB
import { __decorate, __param } from 'tslib'; import { Inject, Component, ChangeDetectionStrategy, NgModule } from '@angular/core'; import { NgControl } from '@angular/forms'; import { tuiReplayedValueChangesFrom, isPresent, TUI_DEFAULT_IDENTITY_MATCHER } from '@taiga-ui/cdk'; import { TUI_DATA_LIST_HOST, TuiOptionComponent, TuiSvgModule, TuiScrollIntoViewModule } from '@taiga-ui/core'; import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent } from '@tinkoff/ng-polymorpheus'; import { map } from 'rxjs/operators'; import { CommonModule } from '@angular/common'; var TuiSelectOptionComponent = /** @class */ (function () { function TuiSelectOptionComponent(context, host, option, control) { var _this = this; this.context = context; this.host = host; this.option = option; this.control = control; this.selected$ = tuiReplayedValueChangesFrom(this.control).pipe(map(function (value) { return isPresent(_this.option.value) && isPresent(value) && _this.matcher(value, _this.option.value); })); } Object.defineProperty(TuiSelectOptionComponent.prototype, "matcher", { get: function () { return this.host.identityMatcher || TUI_DEFAULT_IDENTITY_MATCHER; }, enumerable: true, configurable: true }); TuiSelectOptionComponent.prototype.ngOnInit = function () { if (isPresent(this.option.value) && this.host.checkOption) { this.host.checkOption(this.option.value); } }; TuiSelectOptionComponent.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: Inject, args: [POLYMORPHEUS_CONTEXT,] }] }, { type: undefined, decorators: [{ type: Inject, args: [TUI_DATA_LIST_HOST,] }] }, { type: TuiOptionComponent, decorators: [{ type: Inject, args: [TuiOptionComponent,] }] }, { type: NgControl, decorators: [{ type: Inject, args: [NgControl,] }] } ]; }; TuiSelectOptionComponent = __decorate([ Component({ selector: 'tui-select-option', template: "<ng-container *ngTemplateOutlet=\"context.$implicit\"></ng-container>\n<tui-svg\n *ngIf=\"selected$ | async else dummy\"\n automation-id=\"tui-select-option__checkmark\"\n class=\"checkmark\"\n src=\"tuiIconCheckLarge\"\n [tuiScrollIntoView]=\"true\"\n></tui-svg>\n<ng-template #dummy>\n <span class=\"dummy\"></span>\n</ng-template>\n", changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex:1;align-items:center}.checkmark{margin:0 -6px 0 auto;border-left:5px solid transparent}.dummy{width:24px}"] }), __param(0, Inject(POLYMORPHEUS_CONTEXT)), __param(1, Inject(TUI_DATA_LIST_HOST)), __param(2, Inject(TuiOptionComponent)), __param(3, Inject(NgControl)) ], TuiSelectOptionComponent); return TuiSelectOptionComponent; }()); var TUI_SELECT_OPTION = new PolymorpheusComponent(TuiSelectOptionComponent); var TuiSelectOptionModule = /** @class */ (function () { function TuiSelectOptionModule() { } TuiSelectOptionModule = __decorate([ NgModule({ imports: [CommonModule, TuiSvgModule, TuiScrollIntoViewModule], declarations: [TuiSelectOptionComponent], exports: [TuiSelectOptionComponent], entryComponents: [TuiSelectOptionComponent], }) ], TuiSelectOptionModule); return TuiSelectOptionModule; }()); /** * Generated bundle index. Do not edit. */ export { TUI_SELECT_OPTION, TuiSelectOptionComponent, TuiSelectOptionModule }; //# sourceMappingURL=taiga-ui-kit-components-select-option.js.map