ConceptPortal-public/rsconcept/frontend/src/features/oss/components/select-operation.tsx

29 lines
850 B
TypeScript
Raw Normal View History

import { type Styling } from '@/components/props';
2025-04-11 20:00:42 +03:00
import { ComboBox } from '@/components/ui/combo-box';
import { type IOperation } from '../models/oss';
2024-07-21 15:19:57 +03:00
interface SelectOperationProps extends Styling {
2025-04-11 20:00:42 +03:00
id?: string;
value: IOperation | null;
onChange: (newValue: IOperation | null) => void;
2024-07-26 21:09:16 +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}
/>
);
}