@maherunlocker/custom-react-table
Version:
dynamic table based on react table v7
21 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TooltipCell = exports.TooltipCellRenderer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const material_1 = require("@mui/material");
const styles_1 = require("@mui/styles");
const useStyles = (0, styles_1.makeStyles)({
truncated: {
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
},
});
const TooltipCellRenderer = ({ cell: { value }, column: { align = 'left' }, }) => (0, jsx_runtime_1.jsx)(exports.TooltipCell, { text: value, align: align });
exports.TooltipCellRenderer = TooltipCellRenderer;
const TooltipCell = ({ text, tooltip = text, align, }) => {
const classes = useStyles({});
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: tooltip !== null && tooltip !== '' && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: tooltip !== undefined && tooltip !== null ? tooltip : ' ', className: classes.truncated, arrow: true, style: { textAlign: align } }, { children: (0, jsx_runtime_1.jsx)("span", { children: text }) }))) }));
};
exports.TooltipCell = TooltipCell;
//# sourceMappingURL=TooltipCell.js.map