@ackplus/react-tanstack-data-table 1.0.19-beta-0.6
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/LICENSE +21 -0
- package/README.md +599 -0
- package/index.d.ts.map +1 -0
- package/index.js +42 -0
- package/lib/components/droupdown/menu-dropdown.d.ts.map +1 -0
- package/lib/components/droupdown/menu-dropdown.js +47 -0
- package/lib/components/export-progress-dialog.d.ts.map +1 -0
- package/lib/components/export-progress-dialog.js +30 -0
- package/lib/components/filters/filter-value-input.d.ts.map +1 -0
- package/lib/components/filters/filter-value-input.js +64 -0
- package/lib/components/filters/index.d.ts.map +1 -0
- package/lib/components/filters/index.js +125 -0
- package/lib/components/headers/draggable-header.d.ts.map +1 -0
- package/lib/components/headers/draggable-header.js +226 -0
- package/lib/components/headers/index.d.ts.map +1 -0
- package/lib/components/headers/index.js +5 -0
- package/lib/components/headers/table-header.d.ts.map +1 -0
- package/lib/components/headers/table-header.js +59 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +18 -0
- package/lib/components/pagination/data-table-pagination.d.ts.map +1 -0
- package/lib/components/pagination/data-table-pagination.js +24 -0
- package/lib/components/pagination/index.d.ts.map +1 -0
- package/lib/components/pagination/index.js +4 -0
- package/lib/components/rows/data-table-row.d.ts.map +1 -0
- package/lib/components/rows/data-table-row.js +42 -0
- package/lib/components/rows/empty-data-row.d.ts.map +1 -0
- package/lib/components/rows/empty-data-row.js +8 -0
- package/lib/components/rows/index.d.ts.map +1 -0
- package/lib/components/rows/index.js +6 -0
- package/lib/components/rows/loading-rows.d.ts.map +1 -0
- package/lib/components/rows/loading-rows.js +46 -0
- package/lib/components/table/data-table.d.ts.map +1 -0
- package/lib/components/table/data-table.js +663 -0
- package/lib/components/table/data-table.types.d.ts.map +1 -0
- package/lib/components/table/data-table.types.js +6 -0
- package/lib/components/table/index.d.ts.map +1 -0
- package/lib/components/table/index.js +5 -0
- package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +1 -0
- package/lib/components/toolbar/bulk-actions-toolbar.js +31 -0
- package/lib/components/toolbar/column-custom-filter-control.d.ts.map +1 -0
- package/lib/components/toolbar/column-custom-filter-control.js +149 -0
- package/lib/components/toolbar/column-custum-filter-control.d.ts.map +1 -0
- package/lib/components/toolbar/column-custum-filter-control.js +150 -0
- package/lib/components/toolbar/column-pinning-control.d.ts.map +1 -0
- package/lib/components/toolbar/column-pinning-control.js +103 -0
- package/lib/components/toolbar/column-reset-control.d.ts.map +1 -0
- package/lib/components/toolbar/column-reset-control.js +13 -0
- package/lib/components/toolbar/column-visibility-control.d.ts.map +1 -0
- package/lib/components/toolbar/column-visibility-control.js +27 -0
- package/lib/components/toolbar/data-table-toolbar.d.ts.map +1 -0
- package/lib/components/toolbar/data-table-toolbar.js +23 -0
- package/lib/components/toolbar/index.d.ts.map +1 -0
- package/lib/components/toolbar/index.js +13 -0
- package/lib/components/toolbar/table-export-control.d.ts.map +1 -0
- package/lib/components/toolbar/table-export-control.js +94 -0
- package/lib/components/toolbar/table-search-control.d.ts.map +1 -0
- package/lib/components/toolbar/table-search-control.js +61 -0
- package/lib/components/toolbar/table-size-control.d.ts.map +1 -0
- package/lib/components/toolbar/table-size-control.js +33 -0
- package/lib/contexts/data-table-context.d.ts.map +1 -0
- package/lib/contexts/data-table-context.js +50 -0
- package/lib/examples/advanced-features-example.d.ts.map +1 -0
- package/lib/examples/advanced-features-example.js +282 -0
- package/lib/examples/basic-example.d.ts.map +1 -0
- package/lib/examples/basic-example.js +323 -0
- package/lib/examples/bulk-actions-test.d.ts.map +1 -0
- package/lib/examples/bulk-actions-test.js +47 -0
- package/lib/examples/crud-api-example.d.ts.map +1 -0
- package/lib/examples/crud-api-example.js +321 -0
- package/lib/examples/custom-column-filter-example.d.ts.map +1 -0
- package/lib/examples/custom-column-filter-example.js +60 -0
- package/lib/examples/custom-selection-example.d.ts.map +1 -0
- package/lib/examples/custom-selection-example.js +184 -0
- package/lib/examples/export-callbacks-example.d.ts.map +1 -0
- package/lib/examples/export-callbacks-example.js +155 -0
- package/lib/examples/improved-export-example.d.ts.map +1 -0
- package/lib/examples/improved-export-example.js +153 -0
- package/lib/examples/improved-server-selection-example.d.ts.map +1 -0
- package/lib/examples/improved-server-selection-example.js +118 -0
- package/lib/examples/index.d.ts.map +1 -0
- package/lib/examples/index.js +5 -0
- package/lib/examples/selection-test-example.d.ts.map +1 -0
- package/lib/examples/selection-test-example.js +111 -0
- package/lib/examples/simple-local-example.d.ts.map +1 -0
- package/lib/examples/simple-local-example.js +101 -0
- package/lib/examples/simple-server-selection-example.d.ts.map +1 -0
- package/lib/examples/simple-server-selection-example.js +178 -0
- package/lib/examples/virtualized-example.d.ts.map +1 -0
- package/lib/examples/virtualized-example.js +119 -0
- package/lib/features/custom-column-filter.feature.d.ts.map +1 -0
- package/lib/features/custom-column-filter.feature.js +306 -0
- package/lib/features/custom-selection.feature.d.ts.map +1 -0
- package/lib/features/custom-selection.feature.js +224 -0
- package/lib/features/index.d.ts.map +1 -0
- package/lib/features/index.js +9 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +6 -0
- package/lib/hooks/use-data-table-api.d.ts.map +1 -0
- package/lib/hooks/use-data-table-api.js +673 -0
- package/lib/hooks/use-table-state.d.ts.map +1 -0
- package/lib/hooks/use-table-state.js +74 -0
- package/lib/icons/add-icon.d.ts.map +1 -0
- package/lib/icons/add-icon.js +5 -0
- package/lib/icons/csv-icon.d.ts.map +1 -0
- package/lib/icons/csv-icon.js +5 -0
- package/lib/icons/delete-icon.d.ts.map +1 -0
- package/lib/icons/delete-icon.js +5 -0
- package/lib/icons/excel-icon.d.ts.map +1 -0
- package/lib/icons/excel-icon.js +5 -0
- package/lib/icons/index.d.ts.map +1 -0
- package/lib/icons/index.js +7 -0
- package/lib/icons/unpin-icon.d.ts.map +1 -0
- package/lib/icons/unpin-icon.js +5 -0
- package/lib/icons/view-comfortable-icon.d.ts.map +1 -0
- package/lib/icons/view-comfortable-icon.js +5 -0
- package/lib/icons/view-compact-icon.d.ts.map +1 -0
- package/lib/icons/view-compact-icon.js +5 -0
- package/lib/types/column.types.d.ts.map +1 -0
- package/lib/types/column.types.js +2 -0
- package/lib/types/data-table-api.d.ts.map +1 -0
- package/lib/types/data-table-api.js +1 -0
- package/lib/types/export.types.d.ts.map +1 -0
- package/lib/types/export.types.js +5 -0
- package/lib/types/hooks.types.d.ts.map +1 -0
- package/lib/types/hooks.types.js +1 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +14 -0
- package/lib/types/slots.types.d.ts.map +1 -0
- package/lib/types/slots.types.js +1 -0
- package/lib/types/table.types.d.ts.map +1 -0
- package/lib/types/table.types.js +1 -0
- package/lib/utils/column-helpers.d.ts.map +1 -0
- package/lib/utils/column-helpers.js +46 -0
- package/lib/utils/debounced-fetch.utils.d.ts.map +1 -0
- package/lib/utils/debounced-fetch.utils.js +51 -0
- package/lib/utils/export-utils.d.ts.map +1 -0
- package/lib/utils/export-utils.js +181 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/selection-helpers.d.ts.map +1 -0
- package/lib/utils/selection-helpers.js +162 -0
- package/lib/utils/slot-helpers.d.ts.map +1 -0
- package/lib/utils/slot-helpers.js +27 -0
- package/lib/utils/special-columns.utils.d.ts.map +1 -0
- package/lib/utils/special-columns.utils.js +77 -0
- package/lib/utils/styling-helpers.d.ts.map +1 -0
- package/lib/utils/styling-helpers.js +97 -0
- package/lib/utils/table-helpers.d.ts.map +1 -0
- package/lib/utils/table-helpers.js +72 -0
- package/lib/utils/value-helpers.d.ts.map +1 -0
- package/lib/utils/value-helpers.js +48 -0
- package/package.json +57 -0
- package/tsconfig.lib.tsbuildinfo +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DataTableRow Component
|
|
4
|
+
*
|
|
5
|
+
* Renders individual table rows with support for:
|
|
6
|
+
* - Column pinning
|
|
7
|
+
* - Row expansion
|
|
8
|
+
* - Hover effects
|
|
9
|
+
* - Striped styling
|
|
10
|
+
*/
|
|
11
|
+
import { TableRow, TableCell, Collapse } from '@mui/material';
|
|
12
|
+
import { flexRender } from '@tanstack/react-table';
|
|
13
|
+
import { getPinnedColumnStyle, getColumnAlignment } from '../../utils';
|
|
14
|
+
import { getSlotComponent } from '../../utils/slot-helpers';
|
|
15
|
+
/**
|
|
16
|
+
* Individual table row component with cell rendering and expansion support
|
|
17
|
+
*/
|
|
18
|
+
export function DataTableRow({ row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, slots, slotProps, }) {
|
|
19
|
+
const CellSlot = getSlotComponent(slots, 'cell', TableCell);
|
|
20
|
+
const ExpandedRowSlot = getSlotComponent(slots, 'expandedRow', TableRow);
|
|
21
|
+
const TableRowSlot = getSlotComponent(slots, 'row', TableRow);
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(TableRowSlot, { hover: enableHover, sx: {
|
|
23
|
+
backgroundColor: enableStripes && isOdd ? 'action.hover' : 'transparent',
|
|
24
|
+
}, children: row.getVisibleCells().map(cell => {
|
|
25
|
+
const isPinned = cell.column.getIsPinned();
|
|
26
|
+
const pinnedPosition = isPinned ? cell.column.getStart('left') : undefined;
|
|
27
|
+
const pinnedRightPosition = isPinned === 'right' ? cell.column.getAfter('right') : undefined;
|
|
28
|
+
const alignment = getColumnAlignment(cell.column.columnDef);
|
|
29
|
+
return (_jsx(CellSlot, { align: alignment, sx: {
|
|
30
|
+
...getPinnedColumnStyle({
|
|
31
|
+
width: cell.column.getSize() || 'auto',
|
|
32
|
+
isPinned,
|
|
33
|
+
pinnedPosition,
|
|
34
|
+
pinnedRightPosition,
|
|
35
|
+
zIndex: isPinned ? 9 : 1,
|
|
36
|
+
disableStickyHeader,
|
|
37
|
+
isLastLeftPinnedColumn: isPinned === 'left' && cell.column.getIsLastColumn('left'),
|
|
38
|
+
isFirstRightPinnedColumn: isPinned === 'right' && cell.column.getIsFirstColumn('right'),
|
|
39
|
+
}),
|
|
40
|
+
}, ...slotProps?.cell, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
41
|
+
}) }), row.getIsExpanded() && renderSubComponent ? (_jsx(ExpandedRowSlot, { children: _jsx(CellSlot, { colSpan: row.getVisibleCells().length + 1, sx: { py: 0 }, children: _jsx(Collapse, { in: row.getIsExpanded(), timeout: "auto", unmountOnExit: true, children: renderSubComponent(row) }) }) })) : null] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-data-row.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/empty-data-row.tsx"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,2CAgBpK"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell, TableRow } from '@mui/material';
|
|
3
|
+
import { getSlotComponent } from '../../utils/slot-helpers';
|
|
4
|
+
export function EmptyDataRow({ colSpan, message, slots, slotProps }) {
|
|
5
|
+
const EmptyRowSlot = getSlotComponent(slots, 'emptyRow', TableRow);
|
|
6
|
+
const EmptyCellSlot = getSlotComponent(slots, 'cell', TableCell);
|
|
7
|
+
return (_jsx(EmptyRowSlot, { children: _jsx(EmptyCellSlot, { colSpan: colSpan, align: "center", sx: { py: 4 }, ...slotProps?.emptyCell, children: message }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-rows.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/loading-rows.tsx"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,EACxB,QAAY,EACZ,KAAK,EACL,SAAS,GACZ,EAAE;IACC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,2CA+FA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TableCell, TableRow } from '@mui/material';
|
|
3
|
+
import { Skeleton } from '@mui/material';
|
|
4
|
+
import { useDataTableContext } from '../../contexts/data-table-context';
|
|
5
|
+
import { getPinnedColumnStyle } from '../../utils';
|
|
6
|
+
import { getSlotComponent } from '../../utils/slot-helpers';
|
|
7
|
+
export function LoadingRows({ rowCount = 5, slots, slotProps, }) {
|
|
8
|
+
const { table } = useDataTableContext();
|
|
9
|
+
const visibleColumns = table.getVisibleLeafColumns();
|
|
10
|
+
const CellSlot = getSlotComponent(slots, 'cell', TableCell);
|
|
11
|
+
const TableRowSlot = getSlotComponent(slots, 'row', TableRow);
|
|
12
|
+
return (_jsx(_Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => (_jsx(TableRowSlot, { ...slotProps?.row, children: visibleColumns.map((column, colIndex) => {
|
|
13
|
+
const isPinned = column.getIsPinned();
|
|
14
|
+
const pinnedPosition = isPinned ? column.getStart('left') : undefined;
|
|
15
|
+
const pinnedRightPosition = isPinned === 'right' ? column.getAfter('right') : undefined;
|
|
16
|
+
// Determine skeleton type based on column meta or content
|
|
17
|
+
const columnMeta = column.columnDef?.meta;
|
|
18
|
+
const isDateColumn = columnMeta?.type === 'date';
|
|
19
|
+
const isBooleanColumn = columnMeta?.type === 'boolean';
|
|
20
|
+
const isNumberColumn = columnMeta?.type === 'number';
|
|
21
|
+
const isSelectionColumn = column.id === 'select';
|
|
22
|
+
return (_jsx(CellSlot, { sx: getPinnedColumnStyle({
|
|
23
|
+
width: column.getSize() || 'auto',
|
|
24
|
+
isPinned,
|
|
25
|
+
pinnedPosition,
|
|
26
|
+
pinnedRightPosition,
|
|
27
|
+
zIndex: isPinned ? 9 : 1,
|
|
28
|
+
isLastLeftPinnedColumn: isPinned === 'left' && column.getIsLastColumn('left'),
|
|
29
|
+
isFirstRightPinnedColumn: isPinned === 'right' && column.getIsFirstColumn('right'),
|
|
30
|
+
}), ...slotProps?.cell, children: (() => {
|
|
31
|
+
if (isSelectionColumn) {
|
|
32
|
+
return (_jsx(Skeleton, { variant: "rectangular", width: 20, height: 20 }));
|
|
33
|
+
}
|
|
34
|
+
if (isBooleanColumn) {
|
|
35
|
+
return (_jsx(Skeleton, { variant: "circular", width: 20, height: 20 }));
|
|
36
|
+
}
|
|
37
|
+
if (isDateColumn) {
|
|
38
|
+
return (_jsx(Skeleton, { variant: "text", width: "80%", height: 20, animation: "wave" }));
|
|
39
|
+
}
|
|
40
|
+
if (isNumberColumn) {
|
|
41
|
+
return (_jsx(Skeleton, { variant: "text", width: "60%", height: 20, animation: "wave" }));
|
|
42
|
+
}
|
|
43
|
+
return (_jsx(Skeleton, { variant: "text", width: `${Math.random() * 40 + 60}%`, height: 20, animation: "wave" }));
|
|
44
|
+
})() }, `skeleton-${column.id || colIndex}-${rowIndex}`));
|
|
45
|
+
}) }, `skeleton-row-${rowIndex}`))) }));
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/data-table.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA+B1D;;GAEG;AACH,eAAO,MAAM,SAAS,mHAw5BpB,CAAC"}
|