mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
646eb4a3b0
- add mediaPlayByIndex - add index property to item list controls args - add overrides to item list controls
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import {
|
|
ItemTableListInnerColumn,
|
|
TableColumnContainer,
|
|
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
|
import { ItemListItem } from '/@/renderer/components/item-list/types';
|
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
|
|
|
export const ActionsColumn = (props: ItemTableListInnerColumn) => {
|
|
const row: any = (props.data as (any | undefined)[])[props.rowIndex];
|
|
|
|
const handleActionClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
if (row !== undefined) {
|
|
const item = row as ItemListItem;
|
|
const rowId = props.internalState.extractRowId(item);
|
|
const index = rowId ? props.internalState.findItemIndex(rowId) : -1;
|
|
props.controls.onMore?.({
|
|
event,
|
|
index,
|
|
internalState: props.internalState,
|
|
item,
|
|
itemType: props.itemType,
|
|
});
|
|
}
|
|
};
|
|
|
|
const handleActionDoubleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
};
|
|
|
|
if (row !== undefined) {
|
|
return (
|
|
<TableColumnContainer {...props}>
|
|
<ActionIcon
|
|
className="hover-only"
|
|
icon="ellipsisHorizontal"
|
|
iconProps={{
|
|
color: 'muted',
|
|
size: 'md',
|
|
}}
|
|
onClick={handleActionClick}
|
|
onDoubleClick={handleActionDoubleClick}
|
|
size="xs"
|
|
variant="subtle"
|
|
/>
|
|
</TableColumnContainer>
|
|
);
|
|
}
|
|
|
|
return <TableColumnContainer {...props}> </TableColumnContainer>;
|
|
};
|