Files
feishin/src/renderer/components/item-list/item-table-list/columns/actions-column.tsx
T
jeffvli 646eb4a3b0 add double click play to album detail
- add mediaPlayByIndex
- add index property to item list controls args
- add overrides to item list controls
2025-11-29 19:33:37 -08:00

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}>&nbsp;</TableColumnContainer>;
};