import { Pipe, PipeTransform } from '@angular/core'; // config import { ICaInput } from '../../ca-input-test/config'; // interfaces import { IOptionModel } from '../interfaces/input-dropdown-option.interface'; @Pipe({ name: 'inputDropdownLabelClass', standalone: true, }) export class InputDropdownLabelClassPipe implements PipeTransform { transform( option: IOptionModel, options: IOptionModel[], activeItem: IOptionModel | null, labelMode: string, inputConfig: ICaInput ): { [key: string]: boolean | undefined } { return { disabled: option?.disabled, 'add-new': option?.type === 'add-new', 'no-result': options.length === 1 && options[0]?.type === 'no-results', 'active-label': option.id === activeItem?.id && labelMode === 'Label' && inputConfig.customClass !== 'input-dropdown-table', 'active-dark': option.id === activeItem?.id && labelMode === 'Label' && inputConfig.customClass === 'input-dropdown-table', }; } }