@ackplus/react-tanstack-data-table 1.0.19-beta-0.6 → 1.0.19-beta-0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -11
- package/{index.js → src/index.d.ts} +3 -26
- package/src/index.js +31 -0
- package/src/lib/components/droupdown/menu-dropdown.d.ts +17 -0
- package/src/lib/components/droupdown/menu-dropdown.js +52 -0
- package/src/lib/components/filters/filter-value-input.d.ts +9 -0
- package/src/lib/components/filters/filter-value-input.js +58 -0
- package/src/lib/components/filters/index.d.ts +23 -0
- package/{lib → src/lib}/components/filters/index.js +6 -2
- package/src/lib/components/headers/draggable-header.d.ts +12 -0
- package/{lib → src/lib}/components/headers/draggable-header.js +35 -49
- package/{lib/components/headers/index.js → src/lib/components/headers/index.d.ts} +0 -3
- package/src/lib/components/headers/index.js +5 -0
- package/src/lib/components/headers/table-header.d.ts +10 -0
- package/src/lib/components/headers/table-header.js +48 -0
- package/src/lib/components/index.d.ts +7 -0
- package/src/lib/components/index.js +10 -0
- package/src/lib/components/pagination/data-table-pagination.d.ts +11 -0
- package/src/lib/components/pagination/data-table-pagination.js +25 -0
- package/src/lib/components/pagination/index.d.ts +1 -0
- package/src/lib/components/pagination/index.js +4 -0
- package/src/lib/components/rows/data-table-row.d.ts +13 -0
- package/src/lib/components/rows/data-table-row.js +31 -0
- package/src/lib/components/rows/empty-data-row.d.ts +6 -0
- package/src/lib/components/rows/empty-data-row.js +11 -0
- package/{lib/components/rows/index.js → src/lib/components/rows/index.d.ts} +0 -3
- package/src/lib/components/rows/index.js +6 -0
- package/src/lib/components/rows/loading-rows.d.ts +5 -0
- package/src/lib/components/rows/loading-rows.js +49 -0
- package/src/lib/components/table/data-table.d.ts +3 -0
- package/src/lib/components/table/data-table.js +492 -0
- package/src/lib/components/table/data-table.types.d.ts +114 -0
- package/src/lib/components/table/data-table.types.js +2 -0
- package/{lib/components/table/index.js → src/lib/components/table/index.d.ts} +0 -3
- package/src/lib/components/table/index.js +5 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +9 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.js +25 -0
- package/src/lib/components/toolbar/column-custom-filter-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-custom-filter-control.js +137 -0
- package/src/lib/components/toolbar/column-pinning-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-pinning-control.js +105 -0
- package/src/lib/components/toolbar/column-reset-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-reset-control.js +16 -0
- package/src/lib/components/toolbar/column-visibility-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-visibility-control.js +31 -0
- package/src/lib/components/toolbar/data-table-toolbar.d.ts +14 -0
- package/src/lib/components/toolbar/data-table-toolbar.js +26 -0
- package/{lib/components/toolbar/index.js → src/lib/components/toolbar/index.d.ts} +1 -6
- package/src/lib/components/toolbar/index.js +17 -0
- package/src/lib/components/toolbar/table-export-control.d.ts +25 -0
- package/src/lib/components/toolbar/table-export-control.js +93 -0
- package/src/lib/components/toolbar/table-search-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-search-control.js +61 -0
- package/src/lib/components/toolbar/table-size-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-size-control.js +36 -0
- package/src/lib/contexts/data-table-context.d.ts +43 -0
- package/{lib → src/lib}/contexts/data-table-context.js +12 -8
- package/src/lib/examples/advanced-features-example.d.ts +1 -0
- package/src/lib/examples/advanced-features-example.js +264 -0
- package/src/lib/examples/bulk-actions-test.d.ts +1 -0
- package/src/lib/examples/bulk-actions-test.js +44 -0
- package/src/lib/examples/custom-column-filter-example.d.ts +1 -0
- package/{lib → src/lib}/examples/custom-column-filter-example.js +10 -10
- package/src/lib/examples/index.js +13 -0
- package/src/lib/examples/selection-test-example.d.ts +1 -0
- package/src/lib/examples/selection-test-example.js +101 -0
- package/src/lib/examples/simple-local-example.d.ts +1 -0
- package/{lib → src/lib}/examples/simple-local-example.js +14 -18
- package/src/lib/features/custom-column-filter.feature.d.ts +45 -0
- package/{lib → src/lib}/features/custom-column-filter.feature.js +40 -99
- package/src/lib/features/custom-selection.feature.d.ts +46 -0
- package/{lib → src/lib}/features/custom-selection.feature.js +18 -70
- package/src/lib/features/index.d.ts +2 -0
- package/src/lib/features/index.js +8 -0
- package/src/lib/hooks/index.d.ts +1 -0
- package/src/lib/hooks/index.js +4 -0
- package/src/lib/hooks/use-data-table-api.d.ts +56 -0
- package/{lib → src/lib}/hooks/use-data-table-api.js +79 -136
- package/src/lib/icons/add-icon.d.ts +2 -0
- package/src/lib/icons/add-icon.js +8 -0
- package/src/lib/icons/csv-icon.d.ts +2 -0
- package/src/lib/icons/csv-icon.js +8 -0
- package/src/lib/icons/delete-icon.d.ts +2 -0
- package/src/lib/icons/delete-icon.js +8 -0
- package/src/lib/icons/excel-icon.d.ts +2 -0
- package/src/lib/icons/excel-icon.js +8 -0
- package/src/lib/icons/index.js +17 -0
- package/src/lib/icons/unpin-icon.d.ts +2 -0
- package/src/lib/icons/unpin-icon.js +8 -0
- package/src/lib/icons/view-comfortable-icon.d.ts +2 -0
- package/src/lib/icons/view-comfortable-icon.js +8 -0
- package/src/lib/icons/view-compact-icon.d.ts +2 -0
- package/src/lib/icons/view-compact-icon.js +8 -0
- package/src/lib/types/column.types.d.ts +29 -0
- package/src/lib/types/column.types.js +5 -0
- package/src/lib/types/data-table-api.d.ts +134 -0
- package/src/lib/types/data-table-api.js +2 -0
- package/src/lib/types/export.types.d.ts +99 -0
- package/src/lib/types/export.types.js +2 -0
- package/src/lib/types/index.d.ts +6 -0
- package/src/lib/types/index.js +8 -0
- package/src/lib/types/slots.types.d.ts +272 -0
- package/src/lib/types/slots.types.js +2 -0
- package/src/lib/types/table.types.d.ts +63 -0
- package/src/lib/types/table.types.js +2 -0
- package/src/lib/utils/column-helpers.d.ts +7 -0
- package/src/lib/utils/column-helpers.js +43 -0
- package/src/lib/utils/debounced-fetch.utils.d.ts +11 -0
- package/{lib → src/lib}/utils/debounced-fetch.utils.js +15 -17
- package/src/lib/utils/export-utils.d.ts +30 -0
- package/src/lib/utils/export-utils.js +152 -0
- package/{lib/utils/index.js → src/lib/utils/index.d.ts} +0 -10
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/slot-helpers.d.ts +9 -0
- package/src/lib/utils/slot-helpers.js +21 -0
- package/src/lib/utils/special-columns.utils.d.ts +6 -0
- package/src/lib/utils/special-columns.utils.js +52 -0
- package/src/lib/utils/styling-helpers.d.ts +36 -0
- package/src/lib/utils/styling-helpers.js +61 -0
- package/src/lib/utils/table-helpers.d.ts +9 -0
- package/{lib → src/lib}/utils/table-helpers.js +16 -31
- package/tsconfig.tsbuildinfo +1 -0
- package/LICENSE +0 -21
- package/index.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.js +0 -47
- package/lib/components/export-progress-dialog.d.ts.map +0 -1
- package/lib/components/export-progress-dialog.js +0 -30
- package/lib/components/filters/filter-value-input.d.ts.map +0 -1
- package/lib/components/filters/filter-value-input.js +0 -64
- package/lib/components/filters/index.d.ts.map +0 -1
- package/lib/components/headers/draggable-header.d.ts.map +0 -1
- package/lib/components/headers/index.d.ts.map +0 -1
- package/lib/components/headers/table-header.d.ts.map +0 -1
- package/lib/components/headers/table-header.js +0 -59
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/index.js +0 -18
- package/lib/components/pagination/data-table-pagination.d.ts.map +0 -1
- package/lib/components/pagination/data-table-pagination.js +0 -24
- package/lib/components/pagination/index.d.ts.map +0 -1
- package/lib/components/pagination/index.js +0 -4
- package/lib/components/rows/data-table-row.d.ts.map +0 -1
- package/lib/components/rows/data-table-row.js +0 -42
- package/lib/components/rows/empty-data-row.d.ts.map +0 -1
- package/lib/components/rows/empty-data-row.js +0 -8
- package/lib/components/rows/index.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.js +0 -46
- package/lib/components/table/data-table.d.ts.map +0 -1
- package/lib/components/table/data-table.js +0 -663
- package/lib/components/table/data-table.types.d.ts.map +0 -1
- package/lib/components/table/data-table.types.js +0 -6
- package/lib/components/table/index.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.js +0 -31
- package/lib/components/toolbar/column-custom-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custom-filter-control.js +0 -149
- package/lib/components/toolbar/column-custum-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custum-filter-control.js +0 -150
- package/lib/components/toolbar/column-pinning-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-pinning-control.js +0 -103
- package/lib/components/toolbar/column-reset-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-reset-control.js +0 -13
- package/lib/components/toolbar/column-visibility-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-visibility-control.js +0 -27
- package/lib/components/toolbar/data-table-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/data-table-toolbar.js +0 -23
- package/lib/components/toolbar/index.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.js +0 -94
- package/lib/components/toolbar/table-search-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-search-control.js +0 -61
- package/lib/components/toolbar/table-size-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-size-control.js +0 -33
- package/lib/contexts/data-table-context.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.js +0 -282
- package/lib/examples/basic-example.d.ts.map +0 -1
- package/lib/examples/basic-example.js +0 -323
- package/lib/examples/bulk-actions-test.d.ts.map +0 -1
- package/lib/examples/bulk-actions-test.js +0 -47
- package/lib/examples/crud-api-example.d.ts.map +0 -1
- package/lib/examples/crud-api-example.js +0 -321
- package/lib/examples/custom-column-filter-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.js +0 -184
- package/lib/examples/export-callbacks-example.d.ts.map +0 -1
- package/lib/examples/export-callbacks-example.js +0 -155
- package/lib/examples/improved-export-example.d.ts.map +0 -1
- package/lib/examples/improved-export-example.js +0 -153
- package/lib/examples/improved-server-selection-example.d.ts.map +0 -1
- package/lib/examples/improved-server-selection-example.js +0 -118
- package/lib/examples/index.d.ts.map +0 -1
- package/lib/examples/selection-test-example.d.ts.map +0 -1
- package/lib/examples/selection-test-example.js +0 -111
- package/lib/examples/simple-local-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.js +0 -178
- package/lib/examples/virtualized-example.d.ts.map +0 -1
- package/lib/examples/virtualized-example.js +0 -119
- package/lib/features/custom-column-filter.feature.d.ts.map +0 -1
- package/lib/features/custom-selection.feature.d.ts.map +0 -1
- package/lib/features/index.d.ts.map +0 -1
- package/lib/features/index.js +0 -9
- package/lib/hooks/index.d.ts.map +0 -1
- package/lib/hooks/index.js +0 -6
- package/lib/hooks/use-data-table-api.d.ts.map +0 -1
- package/lib/hooks/use-table-state.d.ts.map +0 -1
- package/lib/hooks/use-table-state.js +0 -74
- package/lib/icons/add-icon.d.ts.map +0 -1
- package/lib/icons/add-icon.js +0 -5
- package/lib/icons/csv-icon.d.ts.map +0 -1
- package/lib/icons/csv-icon.js +0 -5
- package/lib/icons/delete-icon.d.ts.map +0 -1
- package/lib/icons/delete-icon.js +0 -5
- package/lib/icons/excel-icon.d.ts.map +0 -1
- package/lib/icons/excel-icon.js +0 -5
- package/lib/icons/index.d.ts.map +0 -1
- package/lib/icons/unpin-icon.d.ts.map +0 -1
- package/lib/icons/unpin-icon.js +0 -5
- package/lib/icons/view-comfortable-icon.d.ts.map +0 -1
- package/lib/icons/view-comfortable-icon.js +0 -5
- package/lib/icons/view-compact-icon.d.ts.map +0 -1
- package/lib/icons/view-compact-icon.js +0 -5
- package/lib/types/column.types.d.ts.map +0 -1
- package/lib/types/column.types.js +0 -2
- package/lib/types/data-table-api.d.ts.map +0 -1
- package/lib/types/data-table-api.js +0 -1
- package/lib/types/export.types.d.ts.map +0 -1
- package/lib/types/export.types.js +0 -5
- package/lib/types/hooks.types.d.ts.map +0 -1
- package/lib/types/hooks.types.js +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -14
- package/lib/types/slots.types.d.ts.map +0 -1
- package/lib/types/slots.types.js +0 -1
- package/lib/types/table.types.d.ts.map +0 -1
- package/lib/types/table.types.js +0 -1
- package/lib/utils/column-helpers.d.ts.map +0 -1
- package/lib/utils/column-helpers.js +0 -46
- package/lib/utils/debounced-fetch.utils.d.ts.map +0 -1
- package/lib/utils/export-utils.d.ts.map +0 -1
- package/lib/utils/export-utils.js +0 -181
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/selection-helpers.d.ts.map +0 -1
- package/lib/utils/selection-helpers.js +0 -162
- package/lib/utils/slot-helpers.d.ts.map +0 -1
- package/lib/utils/slot-helpers.js +0 -27
- package/lib/utils/special-columns.utils.d.ts.map +0 -1
- package/lib/utils/special-columns.utils.js +0 -77
- package/lib/utils/styling-helpers.d.ts.map +0 -1
- package/lib/utils/styling-helpers.js +0 -97
- package/lib/utils/table-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.js +0 -48
- package/tsconfig.lib.tsbuildinfo +0 -1
- /package/{lib/examples/index.js → src/lib/examples/index.d.ts} +0 -0
- /package/{lib/icons/index.js → src/lib/icons/index.d.ts} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTablePagination = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
9
|
+
exports.DataTablePagination = (0, react_1.memo)((_a) => {
|
|
10
|
+
var { footerFilter = null, pagination, totalRow } = _a, props = tslib_1.__rest(_a, ["footerFilter", "pagination", "totalRow"]);
|
|
11
|
+
const { table } = (0, data_table_context_1.useDataTableContext)();
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: 1,
|
|
16
|
+
justifyContent: 'space-between',
|
|
17
|
+
px: 2,
|
|
18
|
+
}, children: [footerFilter, (0, jsx_runtime_1.jsx)(material_1.TablePagination, Object.assign({ component: "div", count: totalRow, rowsPerPage: pagination === null || pagination === void 0 ? void 0 : pagination.pageSize, page: pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex, onPageChange: (_, page) => {
|
|
19
|
+
table.setPageIndex(page);
|
|
20
|
+
}, onRowsPerPageChange: e => {
|
|
21
|
+
const newPageSize = Number(e.target.value);
|
|
22
|
+
table.setPageIndex(0);
|
|
23
|
+
table.setPageSize(newPageSize);
|
|
24
|
+
}, showFirstButton: true, showLastButton: true, labelRowsPerPage: "Rows per page:", labelDisplayedRows: ({ from, to, count }) => `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}` }, props))] }));
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './data-table-pagination';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Row } from '@tanstack/react-table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface DataTableRowProps<T> {
|
|
4
|
+
row: Row<T>;
|
|
5
|
+
enableHover?: boolean;
|
|
6
|
+
enableStripes?: boolean;
|
|
7
|
+
isOdd?: boolean;
|
|
8
|
+
renderSubComponent?: (row: Row<T>) => ReactNode;
|
|
9
|
+
disableStickyHeader?: boolean;
|
|
10
|
+
slots?: Record<string, any>;
|
|
11
|
+
slotProps?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export declare function DataTableRow<T>({ row, enableHover, enableStripes, isOdd, renderSubComponent, disableStickyHeader, slots, slotProps, }: DataTableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTableRow = DataTableRow;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_table_1 = require("@tanstack/react-table");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
9
|
+
function DataTableRow({ row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, slots, slotProps, }) {
|
|
10
|
+
const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
11
|
+
const ExpandedRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'expandedRow', material_1.TableRow);
|
|
12
|
+
const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableRowSlot, { hover: enableHover, sx: {
|
|
14
|
+
backgroundColor: enableStripes && isOdd ? 'action.hover' : 'transparent',
|
|
15
|
+
}, children: row.getVisibleCells().map(cell => {
|
|
16
|
+
const isPinned = cell.column.getIsPinned();
|
|
17
|
+
const pinnedPosition = isPinned ? cell.column.getStart('left') : undefined;
|
|
18
|
+
const pinnedRightPosition = isPinned === 'right' ? cell.column.getAfter('right') : undefined;
|
|
19
|
+
const alignment = (0, utils_1.getColumnAlignment)(cell.column.columnDef);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(CellSlot, Object.assign({ align: alignment, sx: Object.assign({}, (0, utils_1.getPinnedColumnStyle)({
|
|
21
|
+
width: cell.column.getSize() || 'auto',
|
|
22
|
+
isPinned,
|
|
23
|
+
pinnedPosition,
|
|
24
|
+
pinnedRightPosition,
|
|
25
|
+
zIndex: isPinned ? 9 : 1,
|
|
26
|
+
disableStickyHeader,
|
|
27
|
+
isLastLeftPinnedColumn: isPinned === 'left' && cell.column.getIsLastColumn('left'),
|
|
28
|
+
isFirstRightPinnedColumn: isPinned === 'right' && cell.column.getIsFirstColumn('right'),
|
|
29
|
+
})) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.cell, { children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }), cell.id));
|
|
30
|
+
}) }), row.getIsExpanded() && renderSubComponent ? ((0, jsx_runtime_1.jsx)(ExpandedRowSlot, { children: (0, jsx_runtime_1.jsx)(CellSlot, { colSpan: row.getVisibleCells().length + 1, sx: { py: 0 }, children: (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: row.getIsExpanded(), timeout: "auto", unmountOnExit: true, children: renderSubComponent(row) }) }) })) : null] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmptyDataRow = EmptyDataRow;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
7
|
+
function EmptyDataRow({ colSpan, message, slots, slotProps }) {
|
|
8
|
+
const EmptyRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'emptyRow', material_1.TableRow);
|
|
9
|
+
const EmptyCellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(EmptyRowSlot, { children: (0, jsx_runtime_1.jsx)(EmptyCellSlot, Object.assign({ colSpan: colSpan, align: "center", sx: { py: 4 } }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.emptyCell, { children: message })) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./data-table-row"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./empty-data-row"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./loading-rows"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoadingRows = LoadingRows;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const material_2 = require("@mui/material");
|
|
7
|
+
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
10
|
+
function LoadingRows({ rowCount = 5, slots, slotProps, }) {
|
|
11
|
+
const { table } = (0, data_table_context_1.useDataTableContext)();
|
|
12
|
+
const visibleColumns = table.getVisibleLeafColumns();
|
|
13
|
+
const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
14
|
+
const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => ((0, jsx_runtime_1.jsx)(TableRowSlot, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.row, { children: visibleColumns.map((column, colIndex) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const isPinned = column.getIsPinned();
|
|
18
|
+
const pinnedPosition = isPinned ? column.getStart('left') : undefined;
|
|
19
|
+
const pinnedRightPosition = isPinned === 'right' ? column.getAfter('right') : undefined;
|
|
20
|
+
const columnMeta = (_a = column.columnDef) === null || _a === void 0 ? void 0 : _a.meta;
|
|
21
|
+
const isDateColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'date';
|
|
22
|
+
const isBooleanColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'boolean';
|
|
23
|
+
const isNumberColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'number';
|
|
24
|
+
const isSelectionColumn = column.id === 'select';
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(CellSlot, Object.assign({ sx: (0, utils_1.getPinnedColumnStyle)({
|
|
26
|
+
width: column.getSize() || 'auto',
|
|
27
|
+
isPinned,
|
|
28
|
+
pinnedPosition,
|
|
29
|
+
pinnedRightPosition,
|
|
30
|
+
zIndex: isPinned ? 9 : 1,
|
|
31
|
+
isLastLeftPinnedColumn: isPinned === 'left' && column.getIsLastColumn('left'),
|
|
32
|
+
isFirstRightPinnedColumn: isPinned === 'right' && column.getIsFirstColumn('right'),
|
|
33
|
+
}) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.cell, { children: (() => {
|
|
34
|
+
if (isSelectionColumn) {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "rectangular", width: 20, height: 20 }));
|
|
36
|
+
}
|
|
37
|
+
if (isBooleanColumn) {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "circular", width: 20, height: 20 }));
|
|
39
|
+
}
|
|
40
|
+
if (isDateColumn) {
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: "80%", height: 20, animation: "wave" }));
|
|
42
|
+
}
|
|
43
|
+
if (isNumberColumn) {
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: "60%", height: 20, animation: "wave" }));
|
|
45
|
+
}
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(material_2.Skeleton, { variant: "text", width: `${Math.random() * 40 + 60}%`, height: 20, animation: "wave" }));
|
|
47
|
+
})() }), `skeleton-${column.id || colIndex}-${rowIndex}`));
|
|
48
|
+
}) }), `skeleton-row-${rowIndex}`))) }));
|
|
49
|
+
}
|