@ackplus/react-tanstack-data-table
Version:
A powerful React data table component built with MUI and TanStack Table
32 lines (31 loc) • 1.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmptyDataRow = EmptyDataRow;
const jsx_runtime_1 = require("react/jsx-runtime");
const material_1 = require("@mui/material");
const react_1 = __importDefault(require("react"));
const slot_helpers_1 = require("../../utils/slot-helpers");
function EmptyDataRow(props) {
const { colSpan, message, rowProps, cellProps, containerSx, messageSx, slots, slotProps, } = props;
// Extract slot-specific props with enhanced merging
const emptyRowSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'emptyRow');
const cellSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'cell');
const EmptyRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'emptyRow', material_1.TableRow);
const EmptyCellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
// Merge all props for maximum flexibility
const mergedRowProps = (0, slot_helpers_1.mergeSlotProps)({
sx: containerSx,
}, emptyRowSlotProps, rowProps || {});
const mergedCellProps = (0, slot_helpers_1.mergeSlotProps)({
colSpan,
align: 'center',
sx: {
py: 4,
...messageSx,
},
}, cellSlotProps, cellProps || {});
return ((0, jsx_runtime_1.jsx)(EmptyRowSlot, { ...mergedRowProps, children: (0, jsx_runtime_1.jsx)(EmptyCellSlot, { ...mergedCellProps, children: message }) }));
}