import { Component, Input, } from '@angular/core'; import { ChevronDown } from 'lucide-angular'; import { AbmList } from '../../interface'; @Component({ selector: 'kit-abm-list-multi-select', templateUrl: './multi-select.component.html', }) export class AbmListMultiSelectComponent { @Input() control: any; @Input() options?: any[] = []; @Input() isLoading = false; @Input() valueOptionIsNotObject = false; private _abmListInput!: AbmList; @Input() public set abmListInput(abmListInput: AbmList) { this._abmListInput = abmListInput; } public get abmListInput() { return this._abmListInput; } defaultCompareWithFn = (o1: any, o2: any) => o1 === o2; readonly chevronDownI = ChevronDown; onChange(event: any){ this.control.setValue(event.value); } compareWithFn(o1: any, o2: any): boolean { return o1 && o2 ? o1.value === o2.value : o1 === o2; } isControlRequired(): boolean { if( this.control && this.control.validator) { const validator = this.control.validator({} as any); return !!(validator && validator.required); } return false } }