import { Pipe, PipeTransform } from '@angular/core'; import { ICaInput } from '../../ca-input/config'; import { OptionModel } from '../models'; @Pipe({ name: 'inputDropdownLabelClass', standalone: true, }) export class InputDropdownLabelClassPipe implements PipeTransform { transform( option: OptionModel, options: OptionModel[], activeItem: OptionModel | 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', }; } }