feat(cardex): implement cardex module with filters, templates, and service integration
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Maybe } from '@/core';
|
||||
import { Component, Input, model, signal } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, model, Output, signal } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
|
||||
export interface ISelectItem {
|
||||
@@ -18,6 +18,7 @@ export abstract class AbstractSelectComponent<T = ISelectItem> {
|
||||
@Input() showErrors: boolean = true;
|
||||
@Input() isFullDataOptionValue: boolean = false;
|
||||
@Input() optionValue = 'id';
|
||||
@Output() onChange = new EventEmitter<Maybe<T>>();
|
||||
|
||||
loading = signal(false);
|
||||
items = signal<Maybe<T[]>>(null);
|
||||
@@ -50,4 +51,13 @@ export abstract class AbstractSelectComponent<T = ISelectItem> {
|
||||
}
|
||||
return this.optionValue;
|
||||
}
|
||||
|
||||
change(value: Maybe<T>) {
|
||||
if (typeof value !== 'object') {
|
||||
// @ts-ignore
|
||||
this.onChange.emit(this.items()?.find((item) => item[this.optionValue] === value));
|
||||
} else {
|
||||
this.onChange.emit(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user