2025-04-13 22:28:28 +03:00
|
|
|
import { ComboBox } from '@/components/input/combo-box';
|
2025-02-20 20:22:05 +03:00
|
|
|
import { type Styling } from '@/components/props';
|
2025-02-10 01:32:16 +03:00
|
|
|
|
2025-02-20 20:22:05 +03:00
|
|
|
import { type IOperation } from '../models/oss';
|
2024-07-21 15:17:36 +03:00
|
|
|
|
2025-02-20 20:22:05 +03:00
|
|
|
interface SelectOperationProps extends Styling {
|
2025-04-11 19:59:08 +03:00
|
|
|
id?: string;
|
2025-02-19 22:32:50 +03:00
|
|
|
value: IOperation | null;
|
|
|
|
onChange: (newValue: IOperation | null) => void;
|
2024-07-26 21:08:31 +03:00
|
|
|
|
2025-02-19 22:32:50 +03:00
|
|
|
items?: IOperation[];
|
2024-07-21 15:17:36 +03:00
|
|
|
placeholder?: string;
|
2024-07-26 21:08:31 +03:00
|
|
|
noBorder?: boolean;
|
2025-04-11 19:59:08 +03:00
|
|
|
popoverClassname?: string;
|
2024-07-21 15:17:36 +03:00
|
|
|
}
|
|
|
|
|
2025-04-11 19:59:08 +03:00
|
|
|
export function SelectOperation({ items, placeholder = 'Выберите операцию', ...restProps }: SelectOperationProps) {
|
2024-07-21 15:17:36 +03:00
|
|
|
return (
|
2025-04-11 19:59:08 +03:00
|
|
|
<ComboBox
|
|
|
|
items={items}
|
2024-07-21 15:17:36 +03:00
|
|
|
placeholder={placeholder}
|
2025-04-11 19:59:08 +03:00
|
|
|
idFunc={operation => String(operation.id)}
|
|
|
|
labelValueFunc={operation => `${operation.alias}: ${operation.title}`}
|
|
|
|
labelOptionFunc={operation => `${operation.alias}: ${operation.title}`}
|
2024-07-21 15:17:36 +03:00
|
|
|
{...restProps}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|