Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJKMLHdxMwSUeYcdkwqX4W
25 lines
920 B
TypeScript
25 lines
920 B
TypeScript
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>
|
||
);
|
||
}
|