UNPKG

@taiga-ui/kit

Version:
66 lines (61 loc) 3.19 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'; let TuiSelectOptionComponent = class TuiSelectOptionComponent { constructor(context, host, option, control) { this.context = context; this.host = host; this.option = option; this.control = control; this.selected$ = tuiReplayedValueChangesFrom(this.control).pipe(map(value => isPresent(this.option.value) && isPresent(value) && this.matcher(value, this.option.value))); } get matcher() { return this.host.identityMatcher || TUI_DEFAULT_IDENTITY_MATCHER; } ngOnInit() { if (isPresent(this.option.value) && this.host.checkOption) { this.host.checkOption(this.option.value); } } }; TuiSelectOptionComponent.ctorParameters = () => [ { 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); const TUI_SELECT_OPTION = new PolymorpheusComponent(TuiSelectOptionComponent); let TuiSelectOptionModule = class TuiSelectOptionModule { }; TuiSelectOptionModule = __decorate([ NgModule({ imports: [CommonModule, TuiSvgModule, TuiScrollIntoViewModule], declarations: [TuiSelectOptionComponent], exports: [TuiSelectOptionComponent], entryComponents: [TuiSelectOptionComponent], }) ], TuiSelectOptionModule); /** * Generated bundle index. Do not edit. */ export { TUI_SELECT_OPTION, TuiSelectOptionComponent, TuiSelectOptionModule }; //# sourceMappingURL=taiga-ui-kit-components-select-option.js.map