mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-08-17 22:30:36 +03:00
33 lines
911 B
TypeScript
33 lines
911 B
TypeScript
import { ComboBox } from '@/components/input/combo-box';
|
|
|
|
import { describeConstituenta, describeConstituentaTerm } from '../labels';
|
|
import { type IConstituenta } from '../models/rsform';
|
|
|
|
interface SelectConstituentaProps {
|
|
id?: string;
|
|
value: IConstituenta | null;
|
|
onChange: (newValue: IConstituenta | null) => void;
|
|
|
|
className?: string;
|
|
items?: IConstituenta[];
|
|
placeholder?: string;
|
|
noBorder?: boolean;
|
|
}
|
|
|
|
export function SelectConstituenta({
|
|
items,
|
|
placeholder = 'Выберите конституенту',
|
|
...restProps
|
|
}: SelectConstituentaProps) {
|
|
return (
|
|
<ComboBox
|
|
items={items}
|
|
placeholder={placeholder}
|
|
idFunc={cst => String(cst.id)}
|
|
labelValueFunc={cst => `${cst.alias}: ${describeConstituentaTerm(cst)}`}
|
|
labelOptionFunc={cst => `${cst.alias}${cst.is_inherited ? '*' : ''}: ${describeConstituenta(cst)}`}
|
|
{...restProps}
|
|
/>
|
|
);
|
|
}
|