arm-web/src/widgets/DocumentReview/LineMenuButton.tsx

25 lines
920 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { MoreOutlined } from '@ant-design/icons';
import { Button, Dropdown } from 'antd';
import { type LineMenuKey, lineMenuItems } from './lineMenu';
import type { LineAction } from './statementDraft';
import type { GridRow } from './statementGrid';
/** Меню строки в режиме правки: кнопка «⋮» рядом с наименованием. Пусто — кнопки нет. */
export function LineMenuButton({
row,
action,
onSelect,
}: {
row: GridRow;
action: LineAction | undefined;
onSelect: (key: LineMenuKey) => void;
}) {
const items = lineMenuItems(row, action);
if (items.length === 0) return null;
return (
<Dropdown trigger={['click']} menu={{ items, onClick: ({ key }) => onSelect(key as LineMenuKey) }}>
<Button type='text' size='small' icon={<MoreOutlined />} aria-label='Действия со строкой' style={{ marginLeft: 4 }} />
</Dropdown>
);
}