UNPKG

@taiga-ui/cdk

Version:

Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance

36 lines (32 loc) 1.69 kB
import * as i0 from '@angular/core'; import { inject, Directive, Output } from '@angular/core'; import { ControlContainer, NgControl } from '@angular/forms'; import { tuiControlValue } from '@taiga-ui/cdk/observables'; import { Subject, distinctUntilChanged, switchMap, skip } from 'rxjs'; class TuiValueChanges { constructor() { this.container = inject(ControlContainer, { optional: true }); this.control = inject(NgControl, { optional: true }); this.control$ = new Subject(); this.tuiValueChanges = this.control$.pipe(distinctUntilChanged(), switchMap((tuiControlValue)), distinctUntilChanged(), skip(1)); } ngDoCheck() { this.control$.next(this.control || this.container); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiValueChanges, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiValueChanges, isStandalone: true, selector: "[tuiValueChanges]", outputs: { tuiValueChanges: "tuiValueChanges" }, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiValueChanges, decorators: [{ type: Directive, args: [{ standalone: true, selector: '[tuiValueChanges]', }] }], propDecorators: { tuiValueChanges: [{ type: Output }] } }); /** * Generated bundle index. Do not edit. */ export { TuiValueChanges }; //# sourceMappingURL=taiga-ui-cdk-directives-value-changes.mjs.map