baloise / design-system

The Baloise Design System consists of reusable components and a clearly defined visual style, that can be assembled together to build any number of applications.
https://design.baloise.dev
Apache License 2.0
100 stars 27 forks source link

:speech_balloon: question(component): title #1474

Closed hirsch88 closed 2 months ago

hirsch88 commented 2 months ago

Question

import { AfterViewInit, Directive, ElementRef, HostListener, Injector, OnDestroy } from '@angular/core' import { ControlValueAccessor, NgControl } from '@angular/forms' import { Subscription } from 'rxjs'

import type { BaloiseDesignSystemAngularConfig } from '..' import { BalTokenUserConfig, raf } from '..'

@Directive() export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDestroy { private onChange: (value: any) => void = () => { // } private onTouched: () => void = () => { // }

protected lastValue: any private statusChanges?: Subscription

constructor( protected injector: Injector, protected elementRef: ElementRef, ) {}

writeValue(value: any): void { this.elementRef.nativeElement.value = this.lastValue = value === null ? '' : value this.onStatusChange() }

/**

export const findFieldComponent = (element: ElementRef): { disabled: boolean; invalid: boolean } | undefined => { if (element && element.nativeElement) { return element.nativeElement.closest('bal-field') || undefined } return undefined }

Additional Information

No response

Code of Conduct