@coveord/plasma-mantine
Version:
A Plasma flavoured Mantine theme
38 lines (37 loc) • 1.35 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Checkbox, Tooltip } from '@mantine/core';
/**
* Generic column to use when your table needs multi selection of rows
*/ export const TableSelectableColumn = {
id: 'select',
enableSorting: false,
enableHiding: false,
meta: {
controlColumn: true
},
header: ({ table })=>{
const label = table.getIsAllRowsSelected() ? 'Unselect all from this page' : 'Select all from this page';
return /*#__PURE__*/ _jsx(Tooltip, {
label: label,
children: /*#__PURE__*/ _jsx(Checkbox, {
checked: table.getIsAllPageRowsSelected(),
indeterminate: table.getIsSomePageRowsSelected(),
onChange: table.getToggleAllPageRowsSelectedHandler(),
flex: 1,
"aria-label": label
})
});
},
cell: ({ row })=>/*#__PURE__*/ _jsx(Checkbox, {
checked: row.getIsSelected(),
indeterminate: row.getIsSomeSelected(),
onChange: row.getToggleSelectedHandler(),
flex: 1,
"aria-label": "Select row",
onDoubleClick: (event)=>{
event.preventDefault();
event.stopPropagation();
}
})
};
//# sourceMappingURL=TableSelectableColumn.js.map