@ackplus/react-tanstack-data-table 1.0.35 → 1.1.3
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/{src → dist}/index.d.ts +21 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/{src → dist}/lib/components/droupdown/menu-dropdown.d.ts +2 -1
- package/dist/lib/components/droupdown/menu-dropdown.d.ts.map +1 -0
- package/{src → dist}/lib/components/droupdown/menu-dropdown.js +38 -7
- package/{src → dist}/lib/components/filters/filter-value-input.d.ts +3 -1
- package/dist/lib/components/filters/filter-value-input.d.ts.map +1 -0
- package/dist/lib/components/filters/filter-value-input.js +83 -0
- package/{src → dist}/lib/components/filters/index.d.ts +1 -0
- package/dist/lib/components/filters/index.d.ts.map +1 -0
- package/dist/lib/components/filters/index.js +142 -0
- package/{src → dist}/lib/components/headers/draggable-header.d.ts +2 -2
- package/dist/lib/components/headers/draggable-header.d.ts.map +1 -0
- package/{src → dist}/lib/components/headers/draggable-header.js +81 -17
- package/dist/lib/components/headers/index.d.ts +6 -0
- package/dist/lib/components/headers/index.d.ts.map +1 -0
- package/dist/lib/components/headers/index.js +21 -0
- package/{src → dist}/lib/components/headers/table-header.d.ts +15 -1
- package/dist/lib/components/headers/table-header.d.ts.map +1 -0
- package/{src → dist}/lib/components/headers/table-header.js +50 -17
- package/{src → dist}/lib/components/index.d.ts +6 -1
- package/dist/lib/components/index.d.ts.map +1 -0
- package/dist/lib/components/index.js +32 -0
- package/{src → dist}/lib/components/pagination/data-table-pagination.d.ts +2 -1
- package/dist/lib/components/pagination/data-table-pagination.d.ts.map +1 -0
- package/{src → dist}/lib/components/pagination/data-table-pagination.js +20 -6
- package/dist/lib/components/pagination/index.d.ts +5 -0
- package/dist/lib/components/pagination/index.d.ts.map +1 -0
- package/dist/lib/components/pagination/index.js +20 -0
- package/{src → dist}/lib/components/rows/data-table-row.d.ts +15 -2
- package/dist/lib/components/rows/data-table-row.d.ts.map +1 -0
- package/{src → dist}/lib/components/rows/data-table-row.js +58 -25
- package/{src → dist}/lib/components/rows/empty-data-row.d.ts +3 -3
- package/dist/lib/components/rows/empty-data-row.d.ts.map +1 -0
- package/{src → dist}/lib/components/rows/empty-data-row.js +12 -4
- package/dist/lib/components/rows/index.d.ts +7 -0
- package/dist/lib/components/rows/index.d.ts.map +1 -0
- package/dist/lib/components/rows/index.js +22 -0
- package/{src → dist}/lib/components/rows/loading-rows.d.ts +3 -1
- package/dist/lib/components/rows/loading-rows.d.ts.map +1 -0
- package/{src → dist}/lib/components/rows/loading-rows.js +27 -19
- package/{src → dist}/lib/components/toolbar/bulk-actions-toolbar.d.ts +4 -3
- package/dist/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +1 -0
- package/dist/lib/components/toolbar/bulk-actions-toolbar.js +49 -0
- package/{src → dist}/lib/components/toolbar/column-filter-control.d.ts +3 -1
- package/dist/lib/components/toolbar/column-filter-control.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/column-filter-control.js +73 -4
- package/{src → dist}/lib/components/toolbar/column-pinning-control.d.ts +2 -1
- package/dist/lib/components/toolbar/column-pinning-control.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/column-pinning-control.js +70 -6
- package/{src → dist}/lib/components/toolbar/column-reset-control.d.ts +3 -1
- package/dist/lib/components/toolbar/column-reset-control.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/column-reset-control.js +9 -2
- package/{src → dist}/lib/components/toolbar/column-visibility-control.d.ts +2 -1
- package/dist/lib/components/toolbar/column-visibility-control.d.ts.map +1 -0
- package/dist/lib/components/toolbar/column-visibility-control.js +77 -0
- package/{src → dist}/lib/components/toolbar/data-table-toolbar.d.ts +3 -2
- package/dist/lib/components/toolbar/data-table-toolbar.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/data-table-toolbar.js +17 -4
- package/{src → dist}/lib/components/toolbar/index.d.ts +4 -0
- package/dist/lib/components/toolbar/index.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/index.js +6 -0
- package/dist/lib/components/toolbar/table-export-control.d.ts +12 -0
- package/dist/lib/components/toolbar/table-export-control.d.ts.map +1 -0
- package/dist/lib/components/toolbar/table-export-control.js +67 -0
- package/{src → dist}/lib/components/toolbar/table-search-control.d.ts +3 -1
- package/dist/lib/components/toolbar/table-search-control.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/table-search-control.js +45 -2
- package/{src → dist}/lib/components/toolbar/table-size-control.d.ts +3 -1
- package/dist/lib/components/toolbar/table-size-control.d.ts.map +1 -0
- package/{src → dist}/lib/components/toolbar/table-size-control.js +20 -8
- package/{src → dist}/lib/contexts/data-table-context.d.ts +6 -2
- package/dist/lib/contexts/data-table-context.d.ts.map +1 -0
- package/{src → dist}/lib/contexts/data-table-context.js +34 -1
- package/dist/lib/data-table.d.ts +5 -0
- package/dist/lib/data-table.d.ts.map +1 -0
- package/{src/lib/components/table → dist/lib}/data-table.js +427 -143
- package/dist/lib/features/column-filter.feature.d.ts +55 -0
- package/dist/lib/features/column-filter.feature.d.ts.map +1 -0
- package/{src → dist}/lib/features/column-filter.feature.js +116 -18
- package/dist/lib/features/index.d.ts +9 -0
- package/dist/lib/features/index.d.ts.map +1 -0
- package/{src → dist}/lib/features/index.js +7 -0
- package/{src → dist}/lib/features/selection.feature.d.ts +8 -1
- package/dist/lib/features/selection.feature.d.ts.map +1 -0
- package/{src → dist}/lib/features/selection.feature.js +76 -15
- package/dist/lib/icons/add-icon.d.ts +4 -0
- package/dist/lib/icons/add-icon.d.ts.map +1 -0
- package/dist/lib/icons/add-icon.js +12 -0
- package/dist/lib/icons/csv-icon.d.ts +4 -0
- package/dist/lib/icons/csv-icon.d.ts.map +1 -0
- package/dist/lib/icons/csv-icon.js +12 -0
- package/dist/lib/icons/delete-icon.d.ts +4 -0
- package/dist/lib/icons/delete-icon.d.ts.map +1 -0
- package/dist/lib/icons/delete-icon.js +12 -0
- package/dist/lib/icons/excel-icon.d.ts +4 -0
- package/dist/lib/icons/excel-icon.d.ts.map +1 -0
- package/dist/lib/icons/excel-icon.js +12 -0
- package/dist/lib/icons/index.d.ts +8 -0
- package/dist/lib/icons/index.d.ts.map +1 -0
- package/dist/lib/icons/unpin-icon.d.ts +4 -0
- package/dist/lib/icons/unpin-icon.d.ts.map +1 -0
- package/dist/lib/icons/unpin-icon.js +12 -0
- package/{src → dist}/lib/icons/view-comfortable-icon.d.ts +3 -1
- package/dist/lib/icons/view-comfortable-icon.d.ts.map +1 -0
- package/dist/lib/icons/view-comfortable-icon.js +12 -0
- package/dist/lib/icons/view-compact-icon.d.ts +4 -0
- package/dist/lib/icons/view-compact-icon.d.ts.map +1 -0
- package/dist/lib/icons/view-compact-icon.js +12 -0
- package/{src → dist}/lib/types/column.types.d.ts +10 -1
- package/dist/lib/types/column.types.d.ts.map +1 -0
- package/{src → dist}/lib/types/data-table-api.d.ts +2 -1
- package/dist/lib/types/data-table-api.d.ts.map +1 -0
- package/{src/lib/components/table → dist/lib/types}/data-table.types.d.ts +10 -11
- package/dist/lib/types/data-table.types.d.ts.map +1 -0
- package/{src → dist}/lib/types/export.types.d.ts +38 -0
- package/dist/lib/types/export.types.d.ts.map +1 -0
- package/dist/lib/types/export.types.js +6 -0
- package/{src → dist}/lib/types/index.d.ts +6 -0
- package/dist/lib/types/index.d.ts.map +1 -0
- package/dist/lib/types/index.js +32 -0
- package/{src → dist}/lib/types/slots.types.d.ts +50 -3
- package/dist/lib/types/slots.types.d.ts.map +1 -0
- package/{src → dist}/lib/types/table.types.d.ts +14 -0
- package/dist/lib/types/table.types.d.ts.map +1 -0
- package/{src → dist}/lib/utils/column-helpers.d.ts +10 -0
- package/dist/lib/utils/column-helpers.d.ts.map +1 -0
- package/{src → dist}/lib/utils/column-helpers.js +20 -4
- package/{src → dist}/lib/utils/debounced-fetch.utils.d.ts +3 -5
- package/dist/lib/utils/debounced-fetch.utils.d.ts.map +1 -0
- package/{src → dist}/lib/utils/debounced-fetch.utils.js +12 -6
- package/{src → dist}/lib/utils/export-utils.d.ts +13 -0
- package/dist/lib/utils/export-utils.d.ts.map +1 -0
- package/dist/lib/utils/export-utils.js +252 -0
- package/{src → dist}/lib/utils/index.d.ts +4 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +35 -0
- package/{src → dist}/lib/utils/logger.d.ts +43 -0
- package/dist/lib/utils/logger.d.ts.map +1 -0
- package/{src → dist}/lib/utils/logger.js +22 -2
- package/{src → dist}/lib/utils/slot-helpers.d.ts +39 -1
- package/dist/lib/utils/slot-helpers.d.ts.map +1 -0
- package/{src → dist}/lib/utils/slot-helpers.js +55 -6
- package/{src → dist}/lib/utils/special-columns.utils.d.ts +10 -0
- package/dist/lib/utils/special-columns.utils.d.ts.map +1 -0
- package/{src → dist}/lib/utils/special-columns.utils.js +41 -5
- package/{src → dist}/lib/utils/styling-helpers.d.ts +20 -0
- package/dist/lib/utils/styling-helpers.d.ts.map +1 -0
- package/dist/lib/utils/styling-helpers.js +108 -0
- package/{src → dist}/lib/utils/table-helpers.d.ts +25 -0
- package/dist/lib/utils/table-helpers.d.ts.map +1 -0
- package/{src → dist}/lib/utils/table-helpers.js +24 -0
- package/package.json +36 -11
- package/src/index.ts +71 -0
- package/src/lib/components/droupdown/menu-dropdown.tsx +97 -0
- package/src/lib/components/filters/filter-value-input.tsx +225 -0
- package/src/lib/components/filters/{index.js → index.ts} +3 -6
- package/src/lib/components/headers/draggable-header.tsx +326 -0
- package/src/lib/components/headers/{index.d.ts → index.ts} +4 -0
- package/src/lib/components/headers/table-header.tsx +173 -0
- package/src/lib/components/index.ts +21 -0
- package/src/lib/components/pagination/data-table-pagination.tsx +99 -0
- package/src/lib/components/pagination/index.ts +5 -0
- package/src/lib/components/rows/data-table-row.tsx +208 -0
- package/src/lib/components/rows/empty-data-row.tsx +69 -0
- package/src/lib/components/rows/{index.d.ts → index.ts} +4 -0
- package/src/lib/components/rows/loading-rows.tsx +160 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.tsx +125 -0
- package/src/lib/components/toolbar/column-filter-control.tsx +374 -0
- package/src/lib/components/toolbar/column-pinning-control.tsx +275 -0
- package/src/lib/components/toolbar/column-reset-control.tsx +74 -0
- package/src/lib/components/toolbar/column-visibility-control.tsx +105 -0
- package/src/lib/components/toolbar/data-table-toolbar.tsx +229 -0
- package/src/lib/components/toolbar/index.ts +17 -0
- package/src/lib/components/toolbar/table-export-control.tsx +179 -0
- package/src/lib/components/toolbar/table-search-control.tsx +155 -0
- package/src/lib/components/toolbar/table-size-control.tsx +102 -0
- package/src/lib/contexts/data-table-context.tsx +112 -0
- package/src/lib/data-table.tsx +1911 -0
- package/src/lib/features/README.md +161 -0
- package/src/lib/features/column-filter.feature.ts +456 -0
- package/src/lib/features/index.ts +23 -0
- package/src/lib/features/selection.feature.ts +318 -0
- package/src/lib/icons/add-icon.tsx +23 -0
- package/src/lib/icons/csv-icon.tsx +15 -0
- package/src/lib/icons/delete-icon.tsx +30 -0
- package/src/lib/icons/excel-icon.tsx +15 -0
- package/src/lib/icons/unpin-icon.tsx +18 -0
- package/src/lib/icons/view-comfortable-icon.tsx +45 -0
- package/src/lib/icons/view-compact-icon.tsx +55 -0
- package/src/lib/types/column.types.ts +44 -0
- package/src/lib/types/data-table-api.ts +169 -0
- package/src/lib/types/data-table.types.ts +136 -0
- package/src/lib/types/export.types.ts +154 -0
- package/src/lib/types/index.ts +24 -0
- package/src/lib/types/slots.types.ts +332 -0
- package/src/lib/types/table.types.ts +90 -0
- package/src/lib/utils/column-helpers.ts +72 -0
- package/src/lib/utils/debounced-fetch.utils.ts +54 -0
- package/src/lib/utils/export-utils.ts +285 -0
- package/src/lib/utils/index.ts +27 -0
- package/src/lib/utils/logger.ts +203 -0
- package/src/lib/utils/slot-helpers.tsx +194 -0
- package/src/lib/utils/special-columns.utils.ts +94 -0
- package/src/lib/utils/styling-helpers.ts +126 -0
- package/src/lib/utils/table-helpers.ts +106 -0
- package/src/index.js +0 -27
- package/src/lib/components/filters/filter-value-input.js +0 -41
- package/src/lib/components/headers/index.js +0 -5
- package/src/lib/components/index.js +0 -10
- package/src/lib/components/pagination/index.d.ts +0 -1
- package/src/lib/components/pagination/index.js +0 -4
- package/src/lib/components/rows/index.js +0 -6
- package/src/lib/components/table/data-table.d.ts +0 -4
- package/src/lib/components/table/index.d.ts +0 -2
- package/src/lib/components/table/index.js +0 -5
- package/src/lib/components/toolbar/bulk-actions-toolbar.js +0 -30
- package/src/lib/components/toolbar/column-visibility-control.js +0 -31
- package/src/lib/components/toolbar/table-export-control.d.ts +0 -31
- package/src/lib/components/toolbar/table-export-control.js +0 -56
- package/src/lib/examples/advanced-features-example.d.ts +0 -1
- package/src/lib/examples/advanced-features-example.js +0 -269
- package/src/lib/examples/bulk-actions-test.d.ts +0 -1
- package/src/lib/examples/bulk-actions-test.js +0 -44
- package/src/lib/examples/custom-column-filter-example.d.ts +0 -1
- package/src/lib/examples/custom-column-filter-example.js +0 -60
- package/src/lib/examples/index.d.ts +0 -8
- package/src/lib/examples/index.js +0 -19
- package/src/lib/examples/selection-test-example.d.ts +0 -1
- package/src/lib/examples/selection-test-example.js +0 -101
- package/src/lib/examples/server-side-fetching-example.d.ts +0 -1
- package/src/lib/examples/server-side-fetching-example.js +0 -245
- package/src/lib/examples/server-side-test.d.ts +0 -1
- package/src/lib/examples/server-side-test.js +0 -9
- package/src/lib/examples/simple-local-example.d.ts +0 -1
- package/src/lib/examples/simple-local-example.js +0 -95
- package/src/lib/examples/simple-slots-example.d.ts +0 -1
- package/src/lib/examples/simple-slots-example.js +0 -115
- package/src/lib/features/column-filter.feature.d.ts +0 -45
- package/src/lib/features/index.d.ts +0 -2
- package/src/lib/hooks/index.d.ts +0 -1
- package/src/lib/hooks/index.js +0 -4
- package/src/lib/hooks/use-data-table-api.d.ts +0 -46
- package/src/lib/hooks/use-data-table-api.js +0 -690
- package/src/lib/icons/add-icon.d.ts +0 -2
- package/src/lib/icons/add-icon.js +0 -8
- package/src/lib/icons/csv-icon.d.ts +0 -2
- package/src/lib/icons/csv-icon.js +0 -8
- package/src/lib/icons/delete-icon.d.ts +0 -2
- package/src/lib/icons/delete-icon.js +0 -8
- package/src/lib/icons/excel-icon.d.ts +0 -2
- package/src/lib/icons/excel-icon.js +0 -8
- package/src/lib/icons/unpin-icon.d.ts +0 -2
- package/src/lib/icons/unpin-icon.js +0 -8
- package/src/lib/icons/view-comfortable-icon.js +0 -8
- package/src/lib/icons/view-compact-icon.d.ts +0 -2
- package/src/lib/icons/view-compact-icon.js +0 -8
- package/src/lib/types/export.types.js +0 -2
- package/src/lib/types/index.js +0 -8
- package/src/lib/utils/export-utils.js +0 -175
- package/src/lib/utils/index.js +0 -11
- package/src/lib/utils/styling-helpers.js +0 -70
- package/tsconfig.tsbuildinfo +0 -1
- /package/{src → dist}/lib/icons/index.js +0 -0
- /package/{src → dist}/lib/types/column.types.js +0 -0
- /package/{src → dist}/lib/types/data-table-api.js +0 -0
- /package/{src/lib/components/table → dist/lib/types}/data-table.types.js +0 -0
- /package/{src → dist}/lib/types/slots.types.js +0 -0
- /package/{src → dist}/lib/types/table.types.js +0 -0
- /package/src/lib/icons/{index.d.ts → index.ts} +0 -0
|
@@ -1,78 +1,111 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataTableRow = DataTableRow;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* DataTableRow Component
|
|
7
|
+
*
|
|
8
|
+
* Renders individual table rows with support for:
|
|
9
|
+
* - Column pinning
|
|
10
|
+
* - Row expansion
|
|
11
|
+
* - Hover effects
|
|
12
|
+
* - Striped styling
|
|
13
|
+
*/
|
|
6
14
|
const material_1 = require("@mui/material");
|
|
7
15
|
const react_table_1 = require("@tanstack/react-table");
|
|
8
16
|
const utils_1 = require("../../utils");
|
|
9
17
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
10
18
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
19
|
+
/**
|
|
20
|
+
* Individual table row component with cell rendering and expansion support
|
|
21
|
+
*/
|
|
11
22
|
function DataTableRow(props) {
|
|
12
23
|
var _a;
|
|
13
|
-
const { row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, onRowClick, selectOnRowClick = false, cellProps, expandedRowProps, expandedCellProps, containerSx, expandedContainerSx, slots, slotProps
|
|
24
|
+
const { row, enableHover = true, enableStripes = false, isOdd = false, renderSubComponent, disableStickyHeader = false, onRowClick, selectOnRowClick = false, cellProps, expandedRowProps, expandedCellProps, containerSx, expandedContainerSx, slots, slotProps, ...otherProps } = props;
|
|
14
25
|
const { table } = (0, data_table_context_1.useDataTableContext)();
|
|
26
|
+
// Extract slot-specific props with enhanced merging
|
|
15
27
|
const cellSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'cell');
|
|
16
28
|
const expandedRowSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'expandedRow');
|
|
17
29
|
const rowSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'row');
|
|
18
30
|
const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
19
31
|
const ExpandedRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'expandedRow', material_1.TableRow);
|
|
20
32
|
const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
|
|
33
|
+
// Handle row click
|
|
21
34
|
const handleRowClick = (event) => {
|
|
35
|
+
// Check if click target is a checkbox, button, or interactive element
|
|
22
36
|
const target = event.target;
|
|
23
37
|
const isCheckboxClick = target.closest('input[type="checkbox"]') !== null;
|
|
24
38
|
const isButtonClick = target.closest('button') !== null;
|
|
25
39
|
const isLinkClick = target.closest('a') !== null;
|
|
40
|
+
// If selectOnRowClick is enabled and it's not a checkbox/interactive element click, toggle selection
|
|
26
41
|
if (selectOnRowClick && !isCheckboxClick && !isButtonClick && !isLinkClick && (table === null || table === void 0 ? void 0 : table.toggleRowSelected)) {
|
|
27
42
|
table.toggleRowSelected(row.id);
|
|
28
43
|
}
|
|
44
|
+
// Always call onRowClick if provided
|
|
29
45
|
if (onRowClick) {
|
|
30
46
|
onRowClick(event, row);
|
|
31
47
|
}
|
|
32
48
|
};
|
|
49
|
+
// Merge all props for maximum flexibility
|
|
33
50
|
const mergedRowProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
34
51
|
hover: enableHover,
|
|
35
52
|
selected: !!((_a = table === null || table === void 0 ? void 0 : table.getIsRowSelected) === null || _a === void 0 ? void 0 : _a.call(table, row.id)),
|
|
36
53
|
onClick: (onRowClick || selectOnRowClick) ? handleRowClick : undefined,
|
|
37
|
-
sx: (theme) => (
|
|
54
|
+
sx: (theme) => ({
|
|
55
|
+
// set the row background as a variable
|
|
56
|
+
'--row-bg': enableStripes && isOdd
|
|
38
57
|
? theme.palette.action.hover
|
|
39
|
-
: theme.palette.background.paper,
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
: theme.palette.background.paper,
|
|
59
|
+
backgroundColor: 'var(--row-bg)',
|
|
60
|
+
// keep the variable in sync for hover/selected
|
|
61
|
+
...(enableHover && {
|
|
62
|
+
'&:hover': { '--row-bg': theme.palette.action.hover },
|
|
63
|
+
}),
|
|
64
|
+
[`&.${material_1.tableRowClasses.selected}`]: {
|
|
42
65
|
'--row-bg': theme.palette.action.selected,
|
|
43
66
|
backgroundColor: 'var(--row-bg)',
|
|
44
|
-
}
|
|
45
|
-
cursor
|
|
46
|
-
|
|
67
|
+
},
|
|
68
|
+
// Add cursor pointer if row is clickable
|
|
69
|
+
...((onRowClick || selectOnRowClick) && {
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
}),
|
|
72
|
+
...containerSx,
|
|
73
|
+
}),
|
|
47
74
|
}, rowSlotProps, otherProps);
|
|
48
75
|
const mergedExpandedRowProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
49
76
|
sx: expandedContainerSx,
|
|
50
77
|
}, expandedRowSlotProps, expandedRowProps || {});
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableRowSlot,
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TableRowSlot, { ...mergedRowProps, children: row.getVisibleCells().map(cell => {
|
|
52
79
|
var _a, _b;
|
|
53
80
|
const isPinned = cell.column.getIsPinned();
|
|
54
81
|
const pinnedPosition = isPinned ? cell.column.getStart('left') : undefined;
|
|
55
82
|
const pinnedRightPosition = isPinned === 'right' ? cell.column.getAfter('right') : undefined;
|
|
56
83
|
const alignment = (0, utils_1.getColumnAlignment)(cell.column.columnDef);
|
|
84
|
+
// Get minSize and maxSize from column definition
|
|
57
85
|
const minSize = (_a = cell.column.columnDef) === null || _a === void 0 ? void 0 : _a.minSize;
|
|
58
86
|
const maxSize = cell.column.columnDef.maxSize;
|
|
59
87
|
const wrapText = (_b = cell.column.columnDef.wrapText) !== null && _b !== void 0 ? _b : false;
|
|
60
88
|
const mergedCellProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
61
89
|
align: alignment,
|
|
62
|
-
sx:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
sx: {
|
|
91
|
+
...(0, utils_1.getPinnedColumnStyle)({
|
|
92
|
+
width: cell.column.getSize() || 'auto',
|
|
93
|
+
minWidth: minSize !== undefined ? minSize : undefined,
|
|
94
|
+
maxWidth: maxSize !== undefined ? maxSize : undefined,
|
|
95
|
+
isPinned,
|
|
96
|
+
pinnedPosition,
|
|
97
|
+
pinnedRightPosition,
|
|
98
|
+
zIndex: isPinned ? 9 : 1,
|
|
99
|
+
disableStickyHeader,
|
|
100
|
+
isLastLeftPinnedColumn: isPinned === 'left' && cell.column.getIsLastColumn('left'),
|
|
101
|
+
isFirstRightPinnedColumn: isPinned === 'right' && cell.column.getIsFirstColumn('right'),
|
|
102
|
+
wrapText,
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
75
105
|
}, cellSlotProps, cellProps || {});
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(CellSlot,
|
|
77
|
-
}) })
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(CellSlot, { ...mergedCellProps, children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
107
|
+
}) }), row.getIsExpanded() && renderSubComponent ? ((0, jsx_runtime_1.jsx)(ExpandedRowSlot, { ...mergedExpandedRowProps, children: (0, jsx_runtime_1.jsx)(CellSlot, { colSpan: row.getVisibleCells().length, sx: {
|
|
108
|
+
py: 0,
|
|
109
|
+
...expandedCellProps === null || expandedCellProps === void 0 ? void 0 : expandedCellProps.sx,
|
|
110
|
+
}, ...(0, slot_helpers_1.mergeSlotProps)({}, cellSlotProps, expandedCellProps || {}), children: (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: row.getIsExpanded(), timeout: "auto", unmountOnExit: true, children: renderSubComponent(row) }) }) })) : null] }));
|
|
78
111
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableRowProps, TableCellProps, SxProps } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
3
|
export interface EmptyDataRowProps {
|
|
4
4
|
colSpan: number;
|
|
5
5
|
message: string | ReactNode;
|
|
@@ -9,6 +9,6 @@ export interface EmptyDataRowProps {
|
|
|
9
9
|
messageSx?: SxProps;
|
|
10
10
|
slots?: Record<string, any>;
|
|
11
11
|
slotProps?: Record<string, any>;
|
|
12
|
-
[key: string]: any;
|
|
13
12
|
}
|
|
14
|
-
export declare function EmptyDataRow(props: EmptyDataRowProps):
|
|
13
|
+
export declare function EmptyDataRow(props: EmptyDataRowProps): ReactElement;
|
|
14
|
+
//# sourceMappingURL=empty-data-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-data-row.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/empty-data-row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAoDnE"}
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.EmptyDataRow = EmptyDataRow;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
7
10
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
8
11
|
function EmptyDataRow(props) {
|
|
9
|
-
const { colSpan, message, rowProps, cellProps, containerSx, messageSx, slots, slotProps } = props
|
|
12
|
+
const { colSpan, message, rowProps, cellProps, containerSx, messageSx, slots, slotProps, } = props;
|
|
13
|
+
// Extract slot-specific props with enhanced merging
|
|
10
14
|
const emptyRowSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'emptyRow');
|
|
11
15
|
const cellSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'cell');
|
|
12
16
|
const EmptyRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'emptyRow', material_1.TableRow);
|
|
13
17
|
const EmptyCellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
18
|
+
// Merge all props for maximum flexibility
|
|
14
19
|
const mergedRowProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
15
20
|
sx: containerSx,
|
|
16
21
|
}, emptyRowSlotProps, rowProps || {});
|
|
17
22
|
const mergedCellProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
18
23
|
colSpan,
|
|
19
24
|
align: 'center',
|
|
20
|
-
sx:
|
|
25
|
+
sx: {
|
|
26
|
+
py: 4,
|
|
27
|
+
...messageSx,
|
|
28
|
+
},
|
|
21
29
|
}, cellSlotProps, cellProps || {});
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(EmptyRowSlot,
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(EmptyRowSlot, { ...mergedRowProps, children: (0, jsx_runtime_1.jsx)(EmptyCellSlot, { ...mergedCellProps, children: message }) }));
|
|
23
31
|
}
|
|
@@ -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,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Row components for DataTable
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./data-table-row"), exports);
|
|
21
|
+
__exportStar(require("./empty-data-row"), exports);
|
|
22
|
+
__exportStar(require("./loading-rows"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { TableRowProps, TableCellProps, SxProps } from '@mui/material';
|
|
2
3
|
export interface LoadingRowsProps {
|
|
3
4
|
rowCount?: number;
|
|
@@ -9,4 +10,5 @@ export interface LoadingRowsProps {
|
|
|
9
10
|
slotProps?: Record<string, any>;
|
|
10
11
|
[key: string]: any;
|
|
11
12
|
}
|
|
12
|
-
export declare function LoadingRows(props: LoadingRowsProps):
|
|
13
|
+
export declare function LoadingRows(props: LoadingRowsProps): ReactElement;
|
|
14
|
+
//# sourceMappingURL=loading-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-rows.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/rows/loading-rows.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAiC,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMtG,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CA4IjE"}
|
|
@@ -1,59 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.LoadingRows = LoadingRows;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
6
9
|
const material_1 = require("@mui/material");
|
|
7
10
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
11
|
const utils_1 = require("../../utils");
|
|
9
12
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
10
13
|
function LoadingRows(props) {
|
|
11
|
-
const { rowCount = 5, rowProps, cellProps, skeletonProps, containerSx, slots, slotProps } = props
|
|
14
|
+
const { rowCount = 5, rowProps, cellProps, skeletonProps, containerSx, slots, slotProps, } = props;
|
|
12
15
|
const { table } = (0, data_table_context_1.useDataTableContext)();
|
|
13
16
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
17
|
+
// Extract slot-specific props with enhanced merging
|
|
14
18
|
const cellSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'cell');
|
|
15
19
|
const rowSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'row');
|
|
16
20
|
const CellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'cell', material_1.TableCell);
|
|
17
21
|
const TableRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'row', material_1.TableRow);
|
|
22
|
+
// Merge all props for maximum flexibility
|
|
18
23
|
const mergedRowProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
19
24
|
sx: containerSx,
|
|
20
25
|
}, rowSlotProps, rowProps || {});
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => ((0, jsx_runtime_1.jsx)(TableRowSlot,
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => ((0, jsx_runtime_1.jsx)(TableRowSlot, { ...mergedRowProps, children: visibleColumns.map((column, colIndex) => {
|
|
22
27
|
var _a;
|
|
23
28
|
const isPinned = column.getIsPinned();
|
|
24
29
|
const pinnedPosition = isPinned ? column.getStart('left') : undefined;
|
|
25
30
|
const pinnedRightPosition = isPinned === 'right' ? column.getAfter('right') : undefined;
|
|
31
|
+
// Determine skeleton type based on column meta or content
|
|
26
32
|
const columnMeta = (_a = column.columnDef) === null || _a === void 0 ? void 0 : _a.meta;
|
|
27
33
|
const isDateColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'date';
|
|
28
34
|
const isBooleanColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'boolean';
|
|
29
35
|
const isNumberColumn = (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.type) === 'number';
|
|
30
36
|
const isSelectionColumn = column.id === 'select';
|
|
31
37
|
const mergedCellProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
32
|
-
sx:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
sx: {
|
|
39
|
+
...(0, utils_1.getPinnedColumnStyle)({
|
|
40
|
+
width: column.getSize() || 'auto',
|
|
41
|
+
isPinned,
|
|
42
|
+
pinnedPosition,
|
|
43
|
+
pinnedRightPosition,
|
|
44
|
+
zIndex: isPinned ? 9 : 1,
|
|
45
|
+
isLastLeftPinnedColumn: isPinned === 'left' && column.getIsLastColumn('left'),
|
|
46
|
+
isFirstRightPinnedColumn: isPinned === 'right' && column.getIsFirstColumn('right'),
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
41
49
|
}, cellSlotProps, cellProps || {});
|
|
42
50
|
const getSkeletonContent = () => {
|
|
43
51
|
if (isSelectionColumn) {
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton,
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 20, height: 20, animation: "wave", ...skeletonProps }));
|
|
45
53
|
}
|
|
46
54
|
if (isBooleanColumn) {
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton,
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 16, height: 16, animation: "wave", ...skeletonProps }));
|
|
48
56
|
}
|
|
49
57
|
if (isDateColumn) {
|
|
50
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton,
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: "80%", height: 20, animation: "wave", ...skeletonProps }));
|
|
51
59
|
}
|
|
52
60
|
if (isNumberColumn) {
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton,
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: "60%", height: 20, animation: "wave", ...skeletonProps }));
|
|
54
62
|
}
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton,
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: `${Math.random() * 40 + 60}%`, height: 20, animation: "wave", ...skeletonProps }));
|
|
56
64
|
};
|
|
57
|
-
return ((0, jsx_runtime_1.jsx)(CellSlot,
|
|
58
|
-
}) }
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(CellSlot, { ...mergedCellProps, children: getSkeletonContent() }, `skeleton-${column.id || colIndex}-${rowIndex}`));
|
|
66
|
+
}) }, `skeleton-row-${rowIndex}`))) }));
|
|
59
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToolbarProps, SxProps } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { SelectionState } from '../../features';
|
|
4
|
-
export interface BulkActionsToolbarProps
|
|
4
|
+
export interface BulkActionsToolbarProps extends ToolbarProps {
|
|
5
5
|
selectionState: SelectionState;
|
|
6
6
|
selectedRowCount: number;
|
|
7
7
|
bulkActions?: (selectionState: SelectionState) => ReactNode;
|
|
@@ -12,4 +12,5 @@ export interface BulkActionsToolbarProps<T = any> extends ToolbarProps {
|
|
|
12
12
|
fadeProps?: any;
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}
|
|
15
|
-
export declare function BulkActionsToolbar
|
|
15
|
+
export declare function BulkActionsToolbar(props: BulkActionsToolbarProps): ReactElement;
|
|
16
|
+
//# sourceMappingURL=bulk-actions-toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-actions-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/bulk-actions-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQH,YAAY,EACZ,OAAO,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAW,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IACzD,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,SAAS,CAAC;IAE5D,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,YAAY,CA8F/E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BulkActionsToolbar = BulkActionsToolbar;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
9
|
+
function BulkActionsToolbar(props) {
|
|
10
|
+
const { selectionState, selectedRowCount, bulkActions, chipProps, containerSx, leftSectionSx, rightSectionSx, fadeProps, sx, ...otherProps } = props;
|
|
11
|
+
const { slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
12
|
+
// Extract slot-specific props with enhanced merging
|
|
13
|
+
const toolbarSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'bulkActionsToolbar');
|
|
14
|
+
const ToolbarSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'bulkActionsToolbar', material_1.Toolbar);
|
|
15
|
+
// Memoize the bulk actions rendering to prevent infinite re-renders
|
|
16
|
+
const renderedBulkActions = (0, react_1.useMemo)(() => {
|
|
17
|
+
if (!bulkActions)
|
|
18
|
+
return null;
|
|
19
|
+
return bulkActions(selectionState);
|
|
20
|
+
}, [bulkActions, selectionState]);
|
|
21
|
+
// Merge all props for maximum flexibility
|
|
22
|
+
const mergedToolbarProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
23
|
+
sx: {
|
|
24
|
+
pl: { sm: 2 },
|
|
25
|
+
pr: { xs: 1, sm: 1 },
|
|
26
|
+
bgcolor: (theme) => (0, material_1.alpha)(theme.palette.primary.main, 0.05),
|
|
27
|
+
mb: 1,
|
|
28
|
+
position: 'relative',
|
|
29
|
+
zIndex: 1,
|
|
30
|
+
...sx,
|
|
31
|
+
...containerSx,
|
|
32
|
+
},
|
|
33
|
+
}, toolbarSlotProps, otherProps);
|
|
34
|
+
const mergedChipProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
35
|
+
label: `${selectedRowCount} selected`,
|
|
36
|
+
size: 'small',
|
|
37
|
+
color: 'primary',
|
|
38
|
+
variant: 'outlined',
|
|
39
|
+
}, chipProps || {});
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Fade, { in: selectedRowCount > 0, ...fadeProps, children: (0, jsx_runtime_1.jsxs)(ToolbarSlot, { ...mergedToolbarProps, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
41
|
+
flex: '1 1 100%',
|
|
42
|
+
...leftSectionSx,
|
|
43
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "inherit", variant: "subtitle1", component: "div", children: (0, jsx_runtime_1.jsx)(material_1.Chip, { ...mergedChipProps }) }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
gap: 1,
|
|
47
|
+
...rightSectionSx,
|
|
48
|
+
}, children: renderedBulkActions })] }) }));
|
|
49
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IconButtonProps, SxProps } from '@mui/material';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
2
3
|
export interface ColumnFilterControlProps {
|
|
3
4
|
title?: string;
|
|
4
5
|
titleSx?: SxProps;
|
|
@@ -11,4 +12,5 @@ export interface ColumnFilterControlProps {
|
|
|
11
12
|
logicSelectProps?: any;
|
|
12
13
|
[key: string]: any;
|
|
13
14
|
}
|
|
14
|
-
export declare function ColumnFilterControl(props?: ColumnFilterControlProps):
|
|
15
|
+
export declare function ColumnFilterControl(props?: ColumnFilterControlProps): ReactElement;
|
|
16
|
+
//# sourceMappingURL=column-filter-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-filter-control.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/column-filter-control.tsx"],"names":[],"mappings":"AACA,OAAO,EAYH,eAAe,EACf,OAAO,EACV,MAAM,eAAe,CAAC;AACvB,OAAc,EAAmC,YAAY,EAAE,MAAM,OAAO,CAAC;AAc7E,MAAM,WAAW,wBAAwB;IAErC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,wBAA6B,GAAG,YAAY,CAyUtF"}
|