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