@ackplus/react-tanstack-data-table 1.0.34 → 1.1.1
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 +71 -7
- 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 -3
- 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 +449 -151
- 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 -10
- 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 +5 -0
- package/dist/lib/types/index.d.ts.map +1 -0
- package/dist/lib/types/index.js +30 -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 +139 -0
- package/src/lib/types/export.types.ts +154 -0
- package/src/lib/types/index.ts +22 -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,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ColumnFilterControl = ColumnFilterControl;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
38
|
const icons_material_1 = require("@mui/icons-material");
|
|
6
39
|
const material_1 = require("@mui/material");
|
|
7
|
-
const react_1 = require("react");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const menu_dropdown_1 = require("../droupdown/menu-dropdown");
|
|
9
42
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
10
43
|
const icons_1 = require("../../icons");
|
|
@@ -15,22 +48,28 @@ const filter_value_input_1 = require("../filters/filter-value-input");
|
|
|
15
48
|
function ColumnFilterControl(props = {}) {
|
|
16
49
|
var _a, _b, _c;
|
|
17
50
|
const { table, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
51
|
+
// Extract slot-specific props with enhanced merging
|
|
18
52
|
const iconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'filterIcon');
|
|
19
53
|
const FilterIconSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'filterIcon', icons_material_1.FilterList);
|
|
54
|
+
// Use the custom feature state from the table - now using pending filters for UI
|
|
20
55
|
const filterState = ((_a = table === null || table === void 0 ? void 0 : table.getColumnFilterState) === null || _a === void 0 ? void 0 : _a.call(table)) || {
|
|
21
56
|
filters: [],
|
|
22
57
|
logic: 'AND',
|
|
23
58
|
pendingFilters: [],
|
|
24
59
|
pendingLogic: 'AND'
|
|
25
60
|
};
|
|
61
|
+
// Use pending filters for the UI (draft state)
|
|
26
62
|
const filters = filterState.pendingFilters;
|
|
27
63
|
const filterLogic = filterState.pendingLogic;
|
|
64
|
+
// Active filters are the actual applied filters
|
|
28
65
|
const activeFiltersCount = ((_c = (_b = table === null || table === void 0 ? void 0 : table.getActiveColumnFilters) === null || _b === void 0 ? void 0 : _b.call(table)) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
29
66
|
const filterableColumns = (0, react_1.useMemo)(() => {
|
|
30
67
|
return table === null || table === void 0 ? void 0 : table.getAllLeafColumns().filter(column => (0, column_helpers_1.isColumnFilterable)(column));
|
|
31
68
|
}, [table]);
|
|
32
69
|
const addFilter = (0, react_1.useCallback)((columnId, operator) => {
|
|
33
70
|
var _a, _b;
|
|
71
|
+
// If no column specified, use empty (user will select)
|
|
72
|
+
// If column specified, get its appropriate default operator
|
|
34
73
|
let defaultOperator = operator || '';
|
|
35
74
|
if (columnId && !operator) {
|
|
36
75
|
const column = filterableColumns === null || filterableColumns === void 0 ? void 0 : filterableColumns.find(col => col.id === columnId);
|
|
@@ -53,23 +92,29 @@ function ColumnFilterControl(props = {}) {
|
|
|
53
92
|
}, [table]);
|
|
54
93
|
const clearAllFilters = (0, react_1.useCallback)((closeDialog) => {
|
|
55
94
|
var _a;
|
|
95
|
+
// Clear all pending filters
|
|
56
96
|
(_a = table === null || table === void 0 ? void 0 : table.clearAllPendingColumnFilters) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
97
|
+
// Immediately apply the clear (which will clear active filters too)
|
|
57
98
|
setTimeout(() => {
|
|
58
99
|
var _a;
|
|
59
100
|
(_a = table === null || table === void 0 ? void 0 : table.applyPendingColumnFilters) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
101
|
+
// Close dialog if callback provided
|
|
60
102
|
if (closeDialog) {
|
|
61
103
|
closeDialog();
|
|
62
104
|
}
|
|
63
105
|
}, 0);
|
|
64
106
|
}, [table]);
|
|
107
|
+
// Handle filter logic change (AND/OR)
|
|
65
108
|
const handleLogicChange = (0, react_1.useCallback)((newLogic) => {
|
|
66
109
|
var _a;
|
|
67
110
|
(_a = table === null || table === void 0 ? void 0 : table.setPendingFilterLogic) === null || _a === void 0 ? void 0 : _a.call(table, newLogic);
|
|
68
111
|
}, [table]);
|
|
112
|
+
// Apply all pending filters
|
|
69
113
|
const applyFilters = (0, react_1.useCallback)(() => {
|
|
70
114
|
var _a;
|
|
71
115
|
(_a = table === null || table === void 0 ? void 0 : table.applyPendingColumnFilters) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
72
116
|
}, [table]);
|
|
117
|
+
// Handle apply button click
|
|
73
118
|
const handleApplyFilters = (0, react_1.useCallback)((closeDialog) => {
|
|
74
119
|
applyFilters();
|
|
75
120
|
closeDialog();
|
|
@@ -79,40 +124,53 @@ function ColumnFilterControl(props = {}) {
|
|
|
79
124
|
const type = (0, column_helpers_1.getColumnType)(column);
|
|
80
125
|
return filters_1.FILTER_OPERATORS[type] || filters_1.FILTER_OPERATORS.text;
|
|
81
126
|
}, [filterableColumns]);
|
|
127
|
+
// Handle column selection change
|
|
82
128
|
const handleColumnChange = (0, react_1.useCallback)((filterId, newColumnId, currentFilter) => {
|
|
83
129
|
var _a;
|
|
84
130
|
const newColumn = filterableColumns === null || filterableColumns === void 0 ? void 0 : filterableColumns.find(col => col.id === newColumnId);
|
|
85
131
|
const columnType = (0, column_helpers_1.getColumnType)(newColumn);
|
|
86
132
|
const operators = filters_1.FILTER_OPERATORS[columnType] || filters_1.FILTER_OPERATORS.text;
|
|
133
|
+
// Only reset operator if current operator is not valid for new column type
|
|
87
134
|
const currentOperatorValid = operators.some(op => op.value === currentFilter.operator);
|
|
88
135
|
const newOperator = currentOperatorValid ? currentFilter.operator : ((_a = operators[0]) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
89
136
|
updateFilter(filterId, {
|
|
90
137
|
columnId: newColumnId,
|
|
91
138
|
operator: newOperator,
|
|
139
|
+
// Keep the current value unless operator is empty/notEmpty
|
|
92
140
|
value: ['isEmpty', 'isNotEmpty'].includes(newOperator) ? '' : currentFilter.value,
|
|
93
141
|
});
|
|
94
142
|
}, [filterableColumns, updateFilter]);
|
|
143
|
+
// Handle operator selection change
|
|
95
144
|
const handleOperatorChange = (0, react_1.useCallback)((filterId, newOperator, currentFilter) => {
|
|
96
145
|
updateFilter(filterId, {
|
|
97
146
|
operator: newOperator,
|
|
147
|
+
// Only reset value if operator is empty/notEmpty, otherwise preserve it
|
|
98
148
|
value: ['isEmpty', 'isNotEmpty'].includes(newOperator) ? '' : currentFilter.value,
|
|
99
149
|
});
|
|
100
150
|
}, [updateFilter]);
|
|
151
|
+
// Handle filter value change
|
|
101
152
|
const handleFilterValueChange = (0, react_1.useCallback)((filterId, value) => {
|
|
102
153
|
updateFilter(filterId, { value });
|
|
103
154
|
}, [updateFilter]);
|
|
155
|
+
// Handle filter removal
|
|
104
156
|
const handleRemoveFilter = (0, react_1.useCallback)((filterId) => {
|
|
105
157
|
removeFilter(filterId);
|
|
106
158
|
}, [removeFilter]);
|
|
159
|
+
// Count pending filters that are ready to apply (have column, operator, and value OR are empty/notEmpty operators)
|
|
107
160
|
const pendingFiltersCount = filters.filter(f => {
|
|
108
161
|
if (!f.columnId || !f.operator)
|
|
109
162
|
return false;
|
|
163
|
+
// For empty/notEmpty operators, no value is needed
|
|
110
164
|
if (['isEmpty', 'isNotEmpty'].includes(f.operator))
|
|
111
165
|
return true;
|
|
166
|
+
// For other operators, value is required
|
|
112
167
|
return f.value && f.value.toString().trim() !== '';
|
|
113
168
|
}).length;
|
|
169
|
+
// Check if we need to show "Clear Applied Filters" button
|
|
114
170
|
const hasAppliedFilters = activeFiltersCount > 0;
|
|
171
|
+
// Determine if there are pending changes that can be applied
|
|
115
172
|
const hasPendingChanges = pendingFiltersCount > 0 || (filters.length === 0 && hasAppliedFilters);
|
|
173
|
+
// Auto-add default filter when opening if no filters exist AND no applied filters
|
|
116
174
|
(0, react_1.useEffect)(() => {
|
|
117
175
|
var _a;
|
|
118
176
|
if (filters.length === 0 && filterableColumns && (filterableColumns === null || filterableColumns === void 0 ? void 0 : filterableColumns.length) > 0 && activeFiltersCount === 0) {
|
|
@@ -120,19 +178,30 @@ function ColumnFilterControl(props = {}) {
|
|
|
120
178
|
const columnType = (0, column_helpers_1.getColumnType)(firstColumn);
|
|
121
179
|
const operators = filters_1.FILTER_OPERATORS[columnType] || filters_1.FILTER_OPERATORS.text;
|
|
122
180
|
const defaultOperator = ((_a = operators[0]) === null || _a === void 0 ? void 0 : _a.value) || 'contains';
|
|
181
|
+
// Add default filter with first column and its first operator
|
|
123
182
|
addFilter(firstColumn === null || firstColumn === void 0 ? void 0 : firstColumn.id, defaultOperator);
|
|
124
183
|
}
|
|
125
184
|
}, [filters.length, filterableColumns, addFilter, activeFiltersCount]);
|
|
185
|
+
// Merge all props for maximum flexibility
|
|
126
186
|
const mergedProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
187
|
+
// Default props
|
|
127
188
|
size: 'small',
|
|
128
189
|
sx: { flexShrink: 0 },
|
|
129
190
|
}, (slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnFilterControl) || {}, props);
|
|
130
|
-
return ((0, jsx_runtime_1.jsx)(menu_dropdown_1.MenuDropdown, { anchor: ((0, jsx_runtime_1.jsx)(material_1.Badge,
|
|
191
|
+
return ((0, jsx_runtime_1.jsx)(menu_dropdown_1.MenuDropdown, { anchor: ((0, jsx_runtime_1.jsx)(material_1.Badge, { badgeContent: activeFiltersCount > 0 ? activeFiltersCount : 0, color: "primary", invisible: activeFiltersCount === 0, ...mergedProps.badgeProps, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...mergedProps, children: (0, jsx_runtime_1.jsx)(FilterIconSlot, { ...iconSlotProps }) }) })), children: ({ handleClose }) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
192
|
+
p: 2,
|
|
193
|
+
minWidth: 400,
|
|
194
|
+
maxWidth: 600,
|
|
195
|
+
...mergedProps.menuSx,
|
|
196
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", sx: {
|
|
197
|
+
mb: 1,
|
|
198
|
+
...mergedProps.titleSx,
|
|
199
|
+
}, children: mergedProps.title || 'Column Filters' }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { mb: 2 } }), filters.length > 1 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { mb: 2 }, children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Logic" }), (0, jsx_runtime_1.jsxs)(material_1.Select, { value: filterLogic, label: "Logic", onChange: (e) => handleLogicChange(e.target.value), ...mergedProps.logicSelectProps, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: "AND", children: "AND" }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: "OR", children: "OR" })] })] }) })), (0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: 2, sx: { mb: 2 }, children: filters.map((filter) => {
|
|
131
200
|
const selectedColumn = filterableColumns === null || filterableColumns === void 0 ? void 0 : filterableColumns.find(col => col.id === filter.columnId);
|
|
132
201
|
const operators = filter.columnId ? getOperatorsForColumn(filter.columnId) : [];
|
|
133
202
|
const needsValue = !['isEmpty', 'isNotEmpty'].includes(filter.operator);
|
|
134
203
|
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Column" }), (0, jsx_runtime_1.jsx)(material_1.Select, { value: filter.columnId || '', label: "Column", onChange: (e) => handleColumnChange(filter.id, e.target.value, filter), children: filterableColumns === null || filterableColumns === void 0 ? void 0 : filterableColumns.map(column => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: column.id, children: typeof column.columnDef.header === 'string'
|
|
135
204
|
? column.columnDef.header
|
|
136
|
-
: column.id }, column.id))) })] }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Operator" }), (0, jsx_runtime_1.jsx)(material_1.Select, { value: filter.operator || '', label: "Operator", onChange: (e) => handleOperatorChange(filter.id, e.target.value, filter), disabled: !filter.columnId, children: operators.map(op => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: op.value, children: op.label }, op.value))) })] }), needsValue && selectedColumn && ((0, jsx_runtime_1.jsx)(filter_value_input_1.FilterValueInput, { filter: filter, column: selectedColumn, onValueChange: (value) => handleFilterValueChange(filter.id, value) })), (0, jsx_runtime_1.jsx)(material_1.IconButton,
|
|
137
|
-
}) }), (0, jsx_runtime_1.jsx)(material_1.Button,
|
|
205
|
+
: column.id }, column.id))) })] }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Operator" }), (0, jsx_runtime_1.jsx)(material_1.Select, { value: filter.operator || '', label: "Operator", onChange: (e) => handleOperatorChange(filter.id, e.target.value, filter), disabled: !filter.columnId, children: operators.map(op => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: op.value, children: op.label }, op.value))) })] }), needsValue && selectedColumn && ((0, jsx_runtime_1.jsx)(filter_value_input_1.FilterValueInput, { filter: filter, column: selectedColumn, onValueChange: (value) => handleFilterValueChange(filter.id, value) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => handleRemoveFilter(filter.id), color: "error", ...mergedProps.deleteButtonProps, children: (0, jsx_runtime_1.jsx)(icons_1.DeleteIcon, { fontSize: "small" }) })] }, filter.id));
|
|
206
|
+
}) }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", size: "small", startIcon: (0, jsx_runtime_1.jsx)(icons_1.AddIcon, {}), onClick: handleAddFilter, disabled: !filterableColumns || filterableColumns.length === 0, sx: { mb: 2 }, ...mergedProps.addButtonProps, children: "Add Filter" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 1, justifyContent: "flex-end", children: [hasAppliedFilters && ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", size: "small", onClick: () => clearAllFilters(handleClose), color: "error", ...mergedProps.clearButtonProps, children: "Clear All" })), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", size: "small", onClick: () => handleApplyFilters(handleClose), disabled: !hasPendingChanges, ...mergedProps.applyButtonProps, children: "Apply" })] })] })) }));
|
|
138
207
|
}
|
|
@@ -9,4 +9,5 @@ export interface ColumnPinningControlProps {
|
|
|
9
9
|
clearButtonProps?: any;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
export declare function ColumnPinningControl(props?: ColumnPinningControlProps):
|
|
12
|
+
export declare function ColumnPinningControl(props?: ColumnPinningControlProps): any;
|
|
13
|
+
//# sourceMappingURL=column-pinning-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-pinning-control.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/column-pinning-control.tsx"],"names":[],"mappings":"AACA,OAAO,EASH,eAAe,EACf,OAAO,EACV,MAAM,eAAe,CAAC;AAWvB,MAAM,WAAW,yBAAyB;IAEtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,yBAA8B,OA+OzE"}
|
|
@@ -1,17 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ColumnPinningControl = ColumnPinningControl;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
38
|
const icons_material_1 = require("@mui/icons-material");
|
|
6
39
|
const material_1 = require("@mui/material");
|
|
7
|
-
const react_1 = require("react");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const menu_dropdown_1 = require("../droupdown/menu-dropdown");
|
|
9
42
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
10
43
|
const icons_1 = require("../../icons");
|
|
11
44
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
12
45
|
function ColumnPinningControl(props = {}) {
|
|
13
46
|
var _a, _b, _c;
|
|
47
|
+
// Use context if no props provided (MUI DataGrid style)
|
|
14
48
|
const { table, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
49
|
+
// Extract slot-specific props with enhanced merging
|
|
15
50
|
const pinIconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'pinIcon');
|
|
16
51
|
const unpinIconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'unpinIcon');
|
|
17
52
|
const leftIconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'leftIcon');
|
|
@@ -30,14 +65,19 @@ function ColumnPinningControl(props = {}) {
|
|
|
30
65
|
}, [slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnsPanel, table]);
|
|
31
66
|
const handlePinColumn = (columnId, position) => {
|
|
32
67
|
const currentPinning = (table === null || table === void 0 ? void 0 : table.getState().columnPinning) || {};
|
|
33
|
-
const newPinning =
|
|
68
|
+
const newPinning = { ...currentPinning };
|
|
69
|
+
// Remove from current position
|
|
34
70
|
newPinning.left = (newPinning.left || []).filter(id => id !== columnId);
|
|
35
71
|
newPinning.right = (newPinning.right || []).filter(id => id !== columnId);
|
|
72
|
+
// Add to new position
|
|
36
73
|
if (position === 'left') {
|
|
74
|
+
// Left-pinned: append to end (appears leftmost to rightmost)
|
|
37
75
|
newPinning.left = [...(newPinning.left || []), columnId];
|
|
38
76
|
}
|
|
39
77
|
else if (position === 'right') {
|
|
40
|
-
|
|
78
|
+
// Right-pinned: prepend to beginning (appears rightmost to leftmost)
|
|
79
|
+
// First column pinned appears rightmost, second appears to its left, etc.
|
|
80
|
+
newPinning.right = [columnId, ...(newPinning.right || [])];
|
|
41
81
|
}
|
|
42
82
|
table === null || table === void 0 ? void 0 : table.setColumnPinning(newPinning);
|
|
43
83
|
};
|
|
@@ -59,20 +99,44 @@ function ColumnPinningControl(props = {}) {
|
|
|
59
99
|
var _a;
|
|
60
100
|
table === null || table === void 0 ? void 0 : table.setColumnPinning(((_a = table === null || table === void 0 ? void 0 : table.initialState) === null || _a === void 0 ? void 0 : _a.columnPinning) || {});
|
|
61
101
|
}, [table]);
|
|
102
|
+
// Count only user-pinned columns (exclude system columns like select and action)
|
|
62
103
|
const userPinnedLeft = (((_a = columnPinning.left) === null || _a === void 0 ? void 0 : _a.filter((id) => allColumns.some((column) => column.id === id))) || []);
|
|
63
104
|
const userPinnedRight = (((_b = columnPinning.right) === null || _b === void 0 ? void 0 : _b.filter((id) => allColumns.some((column) => column.id === id))) || []);
|
|
64
105
|
const totalPinned = userPinnedLeft.length + userPinnedRight.length;
|
|
106
|
+
// Merge all props for maximum flexibility
|
|
65
107
|
const mergedIconButtonProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
66
108
|
size: 'small',
|
|
67
109
|
sx: { flexShrink: 0 },
|
|
68
110
|
}, pinIconSlotProps, props.iconButtonProps || {});
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)(menu_dropdown_1.MenuDropdown, { anchor: ((0, jsx_runtime_1.jsx)(material_1.Tooltip,
|
|
111
|
+
return ((0, jsx_runtime_1.jsx)(menu_dropdown_1.MenuDropdown, { anchor: ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Pin columns", ...props.tooltipProps, children: (0, jsx_runtime_1.jsxs)(material_1.IconButton, { ...mergedIconButtonProps, children: [(0, jsx_runtime_1.jsx)(PinIconSlot, { ...pinIconSlotProps }), totalPinned > 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: -2,
|
|
114
|
+
right: -2,
|
|
115
|
+
backgroundColor: 'primary.main',
|
|
116
|
+
color: 'white',
|
|
117
|
+
borderRadius: '50%',
|
|
118
|
+
width: 16,
|
|
119
|
+
height: 16,
|
|
120
|
+
fontSize: 10,
|
|
121
|
+
display: 'flex',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
...(_c = props.badgeProps) === null || _c === void 0 ? void 0 : _c.sx,
|
|
125
|
+
}, ...props.badgeProps, children: totalPinned }))] }) })), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
126
|
+
p: 2,
|
|
127
|
+
minWidth: 300,
|
|
128
|
+
maxWidth: 400,
|
|
129
|
+
...props.menuSx,
|
|
130
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", sx: {
|
|
131
|
+
mb: 1,
|
|
132
|
+
...props.titleSx,
|
|
133
|
+
}, children: props.title || 'Pin Columns' }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { mb: 2 } }), totalPinned > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mb: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: handleUnpinAll, color: "warning", ...props.clearButtonProps, children: (0, jsx_runtime_1.jsx)(UnpinIconSlot, { ...unpinIconSlotProps }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", sx: { ml: 1 }, children: "Unpin all columns" })] })), (0, jsx_runtime_1.jsx)(material_1.List, { dense: true, sx: { py: 0 }, children: allColumns.map((column) => {
|
|
70
134
|
const pinStatus = getColumnPinStatus(column.id);
|
|
71
135
|
const displayName = getColumnDisplayName(column);
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: { py: 0.
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: { py: 0.25 }, secondaryAction: ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
73
137
|
display: 'flex',
|
|
74
138
|
gap: 0.5,
|
|
75
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Pin left", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => handlePinColumn(column.id, pinStatus === 'left' ? 'none' : 'left'), color: pinStatus === 'left' ? 'primary' : 'default', children: (0, jsx_runtime_1.jsx)(LeftIconSlot,
|
|
139
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Pin left", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => handlePinColumn(column.id, pinStatus === 'left' ? 'none' : 'left'), color: pinStatus === 'left' ? 'primary' : 'default', children: (0, jsx_runtime_1.jsx)(LeftIconSlot, { fontSize: "small", ...leftIconSlotProps }) }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Pin right", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => handlePinColumn(column.id, pinStatus === 'right' ? 'none' : 'right'), color: pinStatus === 'right' ? 'secondary' : 'default', children: (0, jsx_runtime_1.jsx)(RightIconSlot, { fontSize: "small", ...rightIconSlotProps }) }) }), pinStatus !== 'none' && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Unpin", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => handlePinColumn(column.id, 'none'), children: (0, jsx_runtime_1.jsx)(UnpinIconSlot, { fontSize: "small", ...unpinIconSlotProps }) }) }))] })), children: (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: displayName, secondary: pinStatus === 'left' ? 'Pinned left' :
|
|
76
140
|
pinStatus === 'right' ? 'Pinned right' :
|
|
77
141
|
'Not pinned', slotProps: {
|
|
78
142
|
primary: {
|
|
@@ -84,5 +148,5 @@ function ColumnPinningControl(props = {}) {
|
|
|
84
148
|
color: pinStatus !== 'none' ? 'primary.main' : 'text.secondary',
|
|
85
149
|
},
|
|
86
150
|
} }) }, column.id));
|
|
87
|
-
}) })] })
|
|
151
|
+
}) })] }) }));
|
|
88
152
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { IconButtonProps } from '@mui/material';
|
|
2
3
|
export interface ColumnResetControlProps {
|
|
3
4
|
iconButtonProps?: IconButtonProps;
|
|
@@ -5,4 +6,5 @@ export interface ColumnResetControlProps {
|
|
|
5
6
|
resetActions?: ('columnOrder' | 'columnPinning' | 'columnSizing' | 'columnVisibility' | 'filters' | 'sorting' | 'pagination')[];
|
|
6
7
|
[key: string]: any;
|
|
7
8
|
}
|
|
8
|
-
export declare function ColumnResetControl(props?: ColumnResetControlProps):
|
|
9
|
+
export declare function ColumnResetControl(props?: ColumnResetControlProps): ReactElement;
|
|
10
|
+
//# sourceMappingURL=column-reset-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-reset-control.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/column-reset-control.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAuB,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrE,MAAM,WAAW,uBAAuB;IAEpC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC,EAAE,CAAC;IAChI,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,GAAE,uBAA4B,GAAG,YAAY,CA0DpF"}
|
|
@@ -1,21 +1,26 @@
|
|
|
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.ColumnResetControl = ColumnResetControl;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
5
9
|
const icons_material_1 = require("@mui/icons-material");
|
|
6
10
|
const material_1 = require("@mui/material");
|
|
7
11
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
12
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
9
13
|
function ColumnResetControl(props = {}) {
|
|
10
|
-
const { apiRef,
|
|
14
|
+
const { apiRef, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
15
|
+
// Extract slot-specific props with enhanced merging
|
|
11
16
|
const resetIconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'resetIcon');
|
|
12
17
|
const ResetIconSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'resetIcon', icons_material_1.Autorenew);
|
|
13
18
|
const handleResetLayout = () => {
|
|
14
19
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
15
20
|
const actions = props.resetActions || ['columnOrder', 'columnPinning', 'columnSizing'];
|
|
16
|
-
console.log('actions', actions);
|
|
17
21
|
if (!(apiRef === null || apiRef === void 0 ? void 0 : apiRef.current))
|
|
18
22
|
return;
|
|
23
|
+
// Reset based on specified actions
|
|
19
24
|
if (actions.includes('columnOrder')) {
|
|
20
25
|
(_b = (_a = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _a === void 0 ? void 0 : _a.columnOrdering) === null || _b === void 0 ? void 0 : _b.resetColumnOrder();
|
|
21
26
|
}
|
|
@@ -38,10 +43,11 @@ function ColumnResetControl(props = {}) {
|
|
|
38
43
|
(_p = (_o = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _o === void 0 ? void 0 : _o.pagination) === null || _p === void 0 ? void 0 : _p.resetPagination();
|
|
39
44
|
}
|
|
40
45
|
};
|
|
46
|
+
// Merge all props for maximum flexibility
|
|
41
47
|
const mergedIconButtonProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
42
48
|
size: 'small',
|
|
43
49
|
onClick: handleResetLayout,
|
|
44
50
|
sx: { flexShrink: 0 },
|
|
45
51
|
}, resetIconSlotProps, props.iconButtonProps || {});
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip,
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Reset layout", ...props.tooltipProps, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...mergedIconButtonProps, children: (0, jsx_runtime_1.jsx)(ResetIconSlot, { ...resetIconSlotProps }) }) }));
|
|
47
53
|
}
|
|
@@ -7,4 +7,5 @@ export interface ColumnVisibilityControlProps {
|
|
|
7
7
|
labelProps?: FormControlLabelProps;
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
-
export declare function ColumnVisibilityControl(props?: ColumnVisibilityControlProps):
|
|
10
|
+
export declare function ColumnVisibilityControl(props?: ColumnVisibilityControlProps): any;
|
|
11
|
+
//# sourceMappingURL=column-visibility-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-visibility-control.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/column-visibility-control.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,aAAa,EAA6B,OAAO,EAA8C,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAOpK,MAAM,WAAW,4BAA4B;IAEzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,GAAE,4BAAiC,OAsF/E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ColumnVisibilityControl = ColumnVisibilityControl;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
39
|
+
const material_1 = require("@mui/material");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const menu_dropdown_1 = require("../droupdown/menu-dropdown");
|
|
42
|
+
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
43
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
44
|
+
function ColumnVisibilityControl(props = {}) {
|
|
45
|
+
// Use context if no props provided (MUI DataGrid style)
|
|
46
|
+
const { table, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
47
|
+
// Extract slot-specific props with enhanced merging
|
|
48
|
+
const iconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'columnIcon');
|
|
49
|
+
const ColumnIconSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'columnIcon', icons_material_1.ViewColumnOutlined);
|
|
50
|
+
const columns = (0, react_1.useMemo)(() => {
|
|
51
|
+
var _a, _b, _c;
|
|
52
|
+
if ((_a = slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnsPanel) === null || _a === void 0 ? void 0 : _a.getTogglableColumns) {
|
|
53
|
+
return (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnsPanel) === null || _b === void 0 ? void 0 : _b.getTogglableColumns((table === null || table === void 0 ? void 0 : table.getAllLeafColumns()) || []);
|
|
54
|
+
}
|
|
55
|
+
return ((_c = table === null || table === void 0 ? void 0 : table.getAllLeafColumns()) === null || _c === void 0 ? void 0 : _c.filter(column => column.getCanHide())) || [];
|
|
56
|
+
}, [slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnsPanel, table]);
|
|
57
|
+
const handleColumnVisibilityChange = ((columnId, visible) => {
|
|
58
|
+
var _a;
|
|
59
|
+
(_a = table === null || table === void 0 ? void 0 : table.getColumn(columnId)) === null || _a === void 0 ? void 0 : _a.toggleVisibility(visible);
|
|
60
|
+
});
|
|
61
|
+
// Merge all props for maximum flexibility
|
|
62
|
+
const mergedProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
63
|
+
// Default props
|
|
64
|
+
size: 'small',
|
|
65
|
+
sx: { flexShrink: 0 },
|
|
66
|
+
}, (slotProps === null || slotProps === void 0 ? void 0 : slotProps.columnVisibilityControl) || {}, props);
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(menu_dropdown_1.MenuDropdown, { anchor: ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: "Column visibility", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...mergedProps, children: (0, jsx_runtime_1.jsx)(ColumnIconSlot, { ...iconSlotProps }) }) })), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
68
|
+
p: 2,
|
|
69
|
+
minWidth: 200,
|
|
70
|
+
// Allow user to override these styles
|
|
71
|
+
...mergedProps.menuSx,
|
|
72
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", sx: {
|
|
73
|
+
mb: 1,
|
|
74
|
+
// Allow user to override title styles
|
|
75
|
+
...mergedProps.titleSx,
|
|
76
|
+
}, children: mergedProps.title || 'Show/Hide Columns' }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { mb: 1 } }), (0, jsx_runtime_1.jsx)(material_1.FormGroup, { children: columns.map((column) => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { disabled: !column.getCanHide(), checked: column.getIsVisible(), onChange: (e) => handleColumnVisibilityChange(column.id, e.target.checked), size: "small", ...mergedProps.checkboxProps })), label: typeof column.columnDef.header === 'string' ? column.columnDef.header : column.id, ...mergedProps.labelProps }, column.id))) })] }) }));
|
|
77
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolbarProps, SxProps } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
export interface DataTableToolbarProps extends ToolbarProps {
|
|
4
4
|
extraFilter?: ReactNode;
|
|
5
5
|
enableGlobalFilter?: boolean;
|
|
@@ -18,4 +18,5 @@ export interface DataTableToolbarProps extends ToolbarProps {
|
|
|
18
18
|
rightSectionSx?: SxProps;
|
|
19
19
|
[key: string]: any;
|
|
20
20
|
}
|
|
21
|
-
export declare function DataTableToolbar(props?: DataTableToolbarProps):
|
|
21
|
+
export declare function DataTableToolbar(props?: DataTableToolbarProps): ReactElement;
|
|
22
|
+
//# sourceMappingURL=data-table-toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/data-table-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKH,YAAY,EACZ,OAAO,EACV,MAAM,eAAe,CAAC;AACvB,OAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAYvD,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACvD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,qBAA0B,GAAG,YAAY,CA2LhF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
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.DataTableToolbar = DataTableToolbar;
|
|
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 column_filter_control_1 = require("./column-filter-control");
|
|
8
11
|
const column_pinning_control_1 = require("./column-pinning-control");
|
|
9
12
|
const column_reset_control_1 = require("./column-reset-control");
|
|
@@ -14,8 +17,9 @@ const table_size_control_1 = require("./table-size-control");
|
|
|
14
17
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
15
18
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
16
19
|
function DataTableToolbar(props = {}) {
|
|
17
|
-
const { extraFilter = null, enableGlobalFilter = true, title, subtitle, enableColumnVisibility = true, enableExport = true, enableReset = true, enableColumnFilter = true, enableTableSizeControl = true, enableColumnPinning = true, titleSx, subtitleSx, containerSx, leftSectionSx, rightSectionSx
|
|
20
|
+
const { extraFilter = null, enableGlobalFilter = true, title, subtitle, enableColumnVisibility = true, enableExport = true, enableReset = true, enableColumnFilter = true, enableTableSizeControl = true, enableColumnPinning = true, titleSx, subtitleSx, containerSx, leftSectionSx, rightSectionSx, ...otherProps } = props;
|
|
18
21
|
const { table, slots, slotProps = {} } = (0, data_table_context_1.useDataTableContext)();
|
|
22
|
+
// Extract slot-specific props with enhanced merging
|
|
19
23
|
const toolbarSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'toolbar');
|
|
20
24
|
const searchInputSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'searchInput');
|
|
21
25
|
const tableSizeControlSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'tableSizeControl');
|
|
@@ -32,8 +36,17 @@ function DataTableToolbar(props = {}) {
|
|
|
32
36
|
const ColumnVisibilityControlSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'columnVisibilityControl', column_visibility_control_1.ColumnVisibilityControl);
|
|
33
37
|
const ColumnResetControlSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'resetButton', column_reset_control_1.ColumnResetControl);
|
|
34
38
|
const TableExportControlSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'exportButton', table_export_control_1.TableExportControl);
|
|
39
|
+
// Merge all props for maximum flexibility
|
|
35
40
|
const mergedToolbarProps = (0, slot_helpers_1.mergeSlotProps)({
|
|
41
|
+
// Default toolbar props
|
|
36
42
|
table,
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
...otherProps,
|
|
44
|
+
}, toolbarSlotProps);
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(ToolbarSlot, { ...mergedToolbarProps, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
46
|
+
width: '100%',
|
|
47
|
+
...containerSx,
|
|
48
|
+
}, children: [(title || subtitle) ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mb: 2 }, children: [title ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", component: "div", sx: titleSx, children: title })) : null, subtitle ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", sx: subtitleSx, children: subtitle })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 2, justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 0.5, alignItems: "center", sx: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
...leftSectionSx,
|
|
51
|
+
}, children: [enableTableSizeControl ? ((0, jsx_runtime_1.jsx)(TableSizeControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, tableSizeControlSlotProps, props.tableSizeControlProps || {}) })) : null, enableColumnFilter ? ((0, jsx_runtime_1.jsx)(ColumnCustomFilterControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, columnCustomFilterControlSlotProps, props.columnFilterProps || {}) })) : null, enableColumnPinning ? ((0, jsx_runtime_1.jsx)(ColumnPinningControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, columnPinningControlSlotProps, props.columnPinningProps || {}) })) : null, enableColumnVisibility ? ((0, jsx_runtime_1.jsx)(ColumnVisibilityControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, columnVisibilityControlSlotProps, props.columnVisibilityProps || {}) })) : null, enableReset ? ((0, jsx_runtime_1.jsx)(ColumnResetControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, resetButtonSlotProps, props.resetButtonProps || {}) })) : null, enableExport ? ((0, jsx_runtime_1.jsx)(TableExportControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, exportButtonSlotProps, props.exportButtonProps || {}) })) : null, enableGlobalFilter ? ((0, jsx_runtime_1.jsx)(TableSearchControlSlot, { ...(0, slot_helpers_1.mergeSlotProps)({}, searchInputSlotProps, props.searchInputProps || {}) })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", spacing: 1, alignItems: "center", sx: rightSectionSx, children: extraFilter })] })] }) }));
|
|
39
52
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar components for DataTable
|
|
3
|
+
*/
|
|
1
4
|
export { DataTableToolbar } from './data-table-toolbar';
|
|
2
5
|
export { ColumnVisibilityControl } from './column-visibility-control';
|
|
3
6
|
export { ColumnPinningControl } from './column-pinning-control';
|
|
@@ -7,3 +10,4 @@ export { TableSizeControl } from './table-size-control';
|
|
|
7
10
|
export { ColumnFilterControl } from './column-filter-control';
|
|
8
11
|
export { BulkActionsToolbar } from './bulk-actions-toolbar';
|
|
9
12
|
export type { BulkActionsToolbarProps } from './bulk-actions-toolbar';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/toolbar/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Toolbar components for DataTable
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.BulkActionsToolbar = exports.ColumnFilterControl = exports.TableSizeControl = exports.TableExportControl = exports.ColumnResetControl = exports.ColumnPinningControl = exports.ColumnVisibilityControl = exports.DataTableToolbar = void 0;
|
|
7
|
+
// Main toolbar component
|
|
4
8
|
var data_table_toolbar_1 = require("./data-table-toolbar");
|
|
5
9
|
Object.defineProperty(exports, "DataTableToolbar", { enumerable: true, get: function () { return data_table_toolbar_1.DataTableToolbar; } });
|
|
10
|
+
// Individual toolbar building blocks - export for custom toolbars
|
|
6
11
|
var column_visibility_control_1 = require("./column-visibility-control");
|
|
7
12
|
Object.defineProperty(exports, "ColumnVisibilityControl", { enumerable: true, get: function () { return column_visibility_control_1.ColumnVisibilityControl; } });
|
|
8
13
|
var column_pinning_control_1 = require("./column-pinning-control");
|
|
@@ -15,5 +20,6 @@ var table_size_control_1 = require("./table-size-control");
|
|
|
15
20
|
Object.defineProperty(exports, "TableSizeControl", { enumerable: true, get: function () { return table_size_control_1.TableSizeControl; } });
|
|
16
21
|
var column_filter_control_1 = require("./column-filter-control");
|
|
17
22
|
Object.defineProperty(exports, "ColumnFilterControl", { enumerable: true, get: function () { return column_filter_control_1.ColumnFilterControl; } });
|
|
23
|
+
// Bulk actions
|
|
18
24
|
var bulk_actions_toolbar_1 = require("./bulk-actions-toolbar");
|
|
19
25
|
Object.defineProperty(exports, "BulkActionsToolbar", { enumerable: true, get: function () { return bulk_actions_toolbar_1.BulkActionsToolbar; } });
|