@coveord/plasma-mantine
Version:
A Plasma flavoured Mantine theme
40 lines (39 loc) • 1.17 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { MoreSize16Px } from '@coveord/plasma-react-icons';
import { useProps } from '@mantine/core';
import { TableActionsList } from '../table-actions/TableActionsList';
import { useTableContext } from '../TableContext';
/**
* Generic column to use when your table needs actions on rows
*/ export const TableActionsColumn = {
id: 'actions',
enableSorting: false,
enableHiding: false,
meta: {
controlColumn: true
},
header: '',
size: 84,
cell: (info)=>/*#__PURE__*/ _jsx(ActionsMenu, {
info: info
})
};
const defaultProps = {
label: 'Actions',
icon: /*#__PURE__*/ _jsx(MoreSize16Px, {
height: 16
})
};
const ActionsMenu = (props)=>{
const { getRowActions } = useTableContext();
const { info, ...others } = useProps('PlasmaTableActionsColumn', defaultProps, props);
const actionsElements = getRowActions([
info.row.original
]);
return /*#__PURE__*/ _jsx(TableActionsList, {
actions: actionsElements,
variant: "combined",
...others
});
};
//# sourceMappingURL=TableActionsColumn.js.map