@ackplus/react-tanstack-data-table 1.0.19-beta-0.6 → 1.0.19-beta-0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -11
- package/{index.js → src/index.d.ts} +3 -26
- package/src/index.js +31 -0
- package/src/lib/components/droupdown/menu-dropdown.d.ts +17 -0
- package/src/lib/components/droupdown/menu-dropdown.js +52 -0
- package/src/lib/components/filters/filter-value-input.d.ts +9 -0
- package/src/lib/components/filters/filter-value-input.js +58 -0
- package/src/lib/components/filters/index.d.ts +23 -0
- package/{lib → src/lib}/components/filters/index.js +6 -2
- package/src/lib/components/headers/draggable-header.d.ts +12 -0
- package/{lib → src/lib}/components/headers/draggable-header.js +35 -49
- package/{lib/components/headers/index.js → src/lib/components/headers/index.d.ts} +0 -3
- package/src/lib/components/headers/index.js +5 -0
- package/src/lib/components/headers/table-header.d.ts +10 -0
- package/src/lib/components/headers/table-header.js +48 -0
- package/src/lib/components/index.d.ts +7 -0
- package/src/lib/components/index.js +10 -0
- package/src/lib/components/pagination/data-table-pagination.d.ts +11 -0
- package/src/lib/components/pagination/data-table-pagination.js +25 -0
- package/src/lib/components/pagination/index.d.ts +1 -0
- package/src/lib/components/pagination/index.js +4 -0
- package/src/lib/components/rows/data-table-row.d.ts +13 -0
- package/src/lib/components/rows/data-table-row.js +31 -0
- package/src/lib/components/rows/empty-data-row.d.ts +6 -0
- package/src/lib/components/rows/empty-data-row.js +11 -0
- package/{lib/components/rows/index.js → src/lib/components/rows/index.d.ts} +0 -3
- package/src/lib/components/rows/index.js +6 -0
- package/src/lib/components/rows/loading-rows.d.ts +5 -0
- package/src/lib/components/rows/loading-rows.js +49 -0
- package/src/lib/components/table/data-table.d.ts +3 -0
- package/src/lib/components/table/data-table.js +492 -0
- package/src/lib/components/table/data-table.types.d.ts +114 -0
- package/src/lib/components/table/data-table.types.js +2 -0
- package/{lib/components/table/index.js → src/lib/components/table/index.d.ts} +0 -3
- package/src/lib/components/table/index.js +5 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +9 -0
- package/src/lib/components/toolbar/bulk-actions-toolbar.js +25 -0
- package/src/lib/components/toolbar/column-custom-filter-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-custom-filter-control.js +137 -0
- package/src/lib/components/toolbar/column-pinning-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-pinning-control.js +105 -0
- package/src/lib/components/toolbar/column-reset-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-reset-control.js +16 -0
- package/src/lib/components/toolbar/column-visibility-control.d.ts +1 -0
- package/src/lib/components/toolbar/column-visibility-control.js +31 -0
- package/src/lib/components/toolbar/data-table-toolbar.d.ts +14 -0
- package/src/lib/components/toolbar/data-table-toolbar.js +26 -0
- package/{lib/components/toolbar/index.js → src/lib/components/toolbar/index.d.ts} +1 -6
- package/src/lib/components/toolbar/index.js +17 -0
- package/src/lib/components/toolbar/table-export-control.d.ts +25 -0
- package/src/lib/components/toolbar/table-export-control.js +93 -0
- package/src/lib/components/toolbar/table-search-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-search-control.js +61 -0
- package/src/lib/components/toolbar/table-size-control.d.ts +1 -0
- package/src/lib/components/toolbar/table-size-control.js +36 -0
- package/src/lib/contexts/data-table-context.d.ts +43 -0
- package/{lib → src/lib}/contexts/data-table-context.js +12 -8
- package/src/lib/examples/advanced-features-example.d.ts +1 -0
- package/src/lib/examples/advanced-features-example.js +264 -0
- package/src/lib/examples/bulk-actions-test.d.ts +1 -0
- package/src/lib/examples/bulk-actions-test.js +44 -0
- package/src/lib/examples/custom-column-filter-example.d.ts +1 -0
- package/{lib → src/lib}/examples/custom-column-filter-example.js +10 -10
- package/src/lib/examples/index.js +13 -0
- package/src/lib/examples/selection-test-example.d.ts +1 -0
- package/src/lib/examples/selection-test-example.js +101 -0
- package/src/lib/examples/simple-local-example.d.ts +1 -0
- package/{lib → src/lib}/examples/simple-local-example.js +14 -18
- package/src/lib/features/custom-column-filter.feature.d.ts +45 -0
- package/{lib → src/lib}/features/custom-column-filter.feature.js +40 -99
- package/src/lib/features/custom-selection.feature.d.ts +46 -0
- package/{lib → src/lib}/features/custom-selection.feature.js +18 -70
- package/src/lib/features/index.d.ts +2 -0
- package/src/lib/features/index.js +8 -0
- package/src/lib/hooks/index.d.ts +1 -0
- package/src/lib/hooks/index.js +4 -0
- package/src/lib/hooks/use-data-table-api.d.ts +56 -0
- package/{lib → src/lib}/hooks/use-data-table-api.js +79 -136
- package/src/lib/icons/add-icon.d.ts +2 -0
- package/src/lib/icons/add-icon.js +8 -0
- package/src/lib/icons/csv-icon.d.ts +2 -0
- package/src/lib/icons/csv-icon.js +8 -0
- package/src/lib/icons/delete-icon.d.ts +2 -0
- package/src/lib/icons/delete-icon.js +8 -0
- package/src/lib/icons/excel-icon.d.ts +2 -0
- package/src/lib/icons/excel-icon.js +8 -0
- package/src/lib/icons/index.js +17 -0
- package/src/lib/icons/unpin-icon.d.ts +2 -0
- package/src/lib/icons/unpin-icon.js +8 -0
- package/src/lib/icons/view-comfortable-icon.d.ts +2 -0
- package/src/lib/icons/view-comfortable-icon.js +8 -0
- package/src/lib/icons/view-compact-icon.d.ts +2 -0
- package/src/lib/icons/view-compact-icon.js +8 -0
- package/src/lib/types/column.types.d.ts +29 -0
- package/src/lib/types/column.types.js +5 -0
- package/src/lib/types/data-table-api.d.ts +134 -0
- package/src/lib/types/data-table-api.js +2 -0
- package/src/lib/types/export.types.d.ts +99 -0
- package/src/lib/types/export.types.js +2 -0
- package/src/lib/types/index.d.ts +6 -0
- package/src/lib/types/index.js +8 -0
- package/src/lib/types/slots.types.d.ts +272 -0
- package/src/lib/types/slots.types.js +2 -0
- package/src/lib/types/table.types.d.ts +63 -0
- package/src/lib/types/table.types.js +2 -0
- package/src/lib/utils/column-helpers.d.ts +7 -0
- package/src/lib/utils/column-helpers.js +43 -0
- package/src/lib/utils/debounced-fetch.utils.d.ts +11 -0
- package/{lib → src/lib}/utils/debounced-fetch.utils.js +15 -17
- package/src/lib/utils/export-utils.d.ts +30 -0
- package/src/lib/utils/export-utils.js +152 -0
- package/{lib/utils/index.js → src/lib/utils/index.d.ts} +0 -10
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/slot-helpers.d.ts +9 -0
- package/src/lib/utils/slot-helpers.js +21 -0
- package/src/lib/utils/special-columns.utils.d.ts +6 -0
- package/src/lib/utils/special-columns.utils.js +52 -0
- package/src/lib/utils/styling-helpers.d.ts +36 -0
- package/src/lib/utils/styling-helpers.js +61 -0
- package/src/lib/utils/table-helpers.d.ts +9 -0
- package/{lib → src/lib}/utils/table-helpers.js +16 -31
- package/tsconfig.tsbuildinfo +1 -0
- package/LICENSE +0 -21
- package/index.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.d.ts.map +0 -1
- package/lib/components/droupdown/menu-dropdown.js +0 -47
- package/lib/components/export-progress-dialog.d.ts.map +0 -1
- package/lib/components/export-progress-dialog.js +0 -30
- package/lib/components/filters/filter-value-input.d.ts.map +0 -1
- package/lib/components/filters/filter-value-input.js +0 -64
- package/lib/components/filters/index.d.ts.map +0 -1
- package/lib/components/headers/draggable-header.d.ts.map +0 -1
- package/lib/components/headers/index.d.ts.map +0 -1
- package/lib/components/headers/table-header.d.ts.map +0 -1
- package/lib/components/headers/table-header.js +0 -59
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/index.js +0 -18
- package/lib/components/pagination/data-table-pagination.d.ts.map +0 -1
- package/lib/components/pagination/data-table-pagination.js +0 -24
- package/lib/components/pagination/index.d.ts.map +0 -1
- package/lib/components/pagination/index.js +0 -4
- package/lib/components/rows/data-table-row.d.ts.map +0 -1
- package/lib/components/rows/data-table-row.js +0 -42
- package/lib/components/rows/empty-data-row.d.ts.map +0 -1
- package/lib/components/rows/empty-data-row.js +0 -8
- package/lib/components/rows/index.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.d.ts.map +0 -1
- package/lib/components/rows/loading-rows.js +0 -46
- package/lib/components/table/data-table.d.ts.map +0 -1
- package/lib/components/table/data-table.js +0 -663
- package/lib/components/table/data-table.types.d.ts.map +0 -1
- package/lib/components/table/data-table.types.js +0 -6
- package/lib/components/table/index.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/bulk-actions-toolbar.js +0 -31
- package/lib/components/toolbar/column-custom-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custom-filter-control.js +0 -149
- package/lib/components/toolbar/column-custum-filter-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-custum-filter-control.js +0 -150
- package/lib/components/toolbar/column-pinning-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-pinning-control.js +0 -103
- package/lib/components/toolbar/column-reset-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-reset-control.js +0 -13
- package/lib/components/toolbar/column-visibility-control.d.ts.map +0 -1
- package/lib/components/toolbar/column-visibility-control.js +0 -27
- package/lib/components/toolbar/data-table-toolbar.d.ts.map +0 -1
- package/lib/components/toolbar/data-table-toolbar.js +0 -23
- package/lib/components/toolbar/index.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-export-control.js +0 -94
- package/lib/components/toolbar/table-search-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-search-control.js +0 -61
- package/lib/components/toolbar/table-size-control.d.ts.map +0 -1
- package/lib/components/toolbar/table-size-control.js +0 -33
- package/lib/contexts/data-table-context.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.d.ts.map +0 -1
- package/lib/examples/advanced-features-example.js +0 -282
- package/lib/examples/basic-example.d.ts.map +0 -1
- package/lib/examples/basic-example.js +0 -323
- package/lib/examples/bulk-actions-test.d.ts.map +0 -1
- package/lib/examples/bulk-actions-test.js +0 -47
- package/lib/examples/crud-api-example.d.ts.map +0 -1
- package/lib/examples/crud-api-example.js +0 -321
- package/lib/examples/custom-column-filter-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.d.ts.map +0 -1
- package/lib/examples/custom-selection-example.js +0 -184
- package/lib/examples/export-callbacks-example.d.ts.map +0 -1
- package/lib/examples/export-callbacks-example.js +0 -155
- package/lib/examples/improved-export-example.d.ts.map +0 -1
- package/lib/examples/improved-export-example.js +0 -153
- package/lib/examples/improved-server-selection-example.d.ts.map +0 -1
- package/lib/examples/improved-server-selection-example.js +0 -118
- package/lib/examples/index.d.ts.map +0 -1
- package/lib/examples/selection-test-example.d.ts.map +0 -1
- package/lib/examples/selection-test-example.js +0 -111
- package/lib/examples/simple-local-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.d.ts.map +0 -1
- package/lib/examples/simple-server-selection-example.js +0 -178
- package/lib/examples/virtualized-example.d.ts.map +0 -1
- package/lib/examples/virtualized-example.js +0 -119
- package/lib/features/custom-column-filter.feature.d.ts.map +0 -1
- package/lib/features/custom-selection.feature.d.ts.map +0 -1
- package/lib/features/index.d.ts.map +0 -1
- package/lib/features/index.js +0 -9
- package/lib/hooks/index.d.ts.map +0 -1
- package/lib/hooks/index.js +0 -6
- package/lib/hooks/use-data-table-api.d.ts.map +0 -1
- package/lib/hooks/use-table-state.d.ts.map +0 -1
- package/lib/hooks/use-table-state.js +0 -74
- package/lib/icons/add-icon.d.ts.map +0 -1
- package/lib/icons/add-icon.js +0 -5
- package/lib/icons/csv-icon.d.ts.map +0 -1
- package/lib/icons/csv-icon.js +0 -5
- package/lib/icons/delete-icon.d.ts.map +0 -1
- package/lib/icons/delete-icon.js +0 -5
- package/lib/icons/excel-icon.d.ts.map +0 -1
- package/lib/icons/excel-icon.js +0 -5
- package/lib/icons/index.d.ts.map +0 -1
- package/lib/icons/unpin-icon.d.ts.map +0 -1
- package/lib/icons/unpin-icon.js +0 -5
- package/lib/icons/view-comfortable-icon.d.ts.map +0 -1
- package/lib/icons/view-comfortable-icon.js +0 -5
- package/lib/icons/view-compact-icon.d.ts.map +0 -1
- package/lib/icons/view-compact-icon.js +0 -5
- package/lib/types/column.types.d.ts.map +0 -1
- package/lib/types/column.types.js +0 -2
- package/lib/types/data-table-api.d.ts.map +0 -1
- package/lib/types/data-table-api.js +0 -1
- package/lib/types/export.types.d.ts.map +0 -1
- package/lib/types/export.types.js +0 -5
- package/lib/types/hooks.types.d.ts.map +0 -1
- package/lib/types/hooks.types.js +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -14
- package/lib/types/slots.types.d.ts.map +0 -1
- package/lib/types/slots.types.js +0 -1
- package/lib/types/table.types.d.ts.map +0 -1
- package/lib/types/table.types.js +0 -1
- package/lib/utils/column-helpers.d.ts.map +0 -1
- package/lib/utils/column-helpers.js +0 -46
- package/lib/utils/debounced-fetch.utils.d.ts.map +0 -1
- package/lib/utils/export-utils.d.ts.map +0 -1
- package/lib/utils/export-utils.js +0 -181
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/selection-helpers.d.ts.map +0 -1
- package/lib/utils/selection-helpers.js +0 -162
- package/lib/utils/slot-helpers.d.ts.map +0 -1
- package/lib/utils/slot-helpers.js +0 -27
- package/lib/utils/special-columns.utils.d.ts.map +0 -1
- package/lib/utils/special-columns.utils.js +0 -77
- package/lib/utils/styling-helpers.d.ts.map +0 -1
- package/lib/utils/styling-helpers.js +0 -97
- package/lib/utils/table-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.d.ts.map +0 -1
- package/lib/utils/value-helpers.js +0 -48
- package/tsconfig.lib.tsbuildinfo +0 -1
- /package/{lib/examples/index.js → src/lib/examples/index.d.ts} +0 -0
- /package/{lib/icons/index.js → src/lib/icons/index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ackplus/react-tanstack-data-table",
|
|
3
|
-
"
|
|
3
|
+
"type": "commonjs",
|
|
4
|
+
"version": "1.0.19-beta-0.8",
|
|
4
5
|
"description": "A powerful React data table component built with MUI and TanStack Table",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"react",
|
|
@@ -44,14 +45,5 @@
|
|
|
44
45
|
"@types/react": "^19.0.0",
|
|
45
46
|
"@types/react-dom": "^19.0.0",
|
|
46
47
|
"typescript": "^5.8.2"
|
|
47
|
-
},
|
|
48
|
-
"exports": {
|
|
49
|
-
"./package.json": "./package.json",
|
|
50
|
-
".": {
|
|
51
|
-
"development": "./src/index.ts",
|
|
52
|
-
"types": "./dist/index.d.ts",
|
|
53
|
-
"import": "./dist/index.js",
|
|
54
|
-
"default": "./dist/index.js"
|
|
55
|
-
}
|
|
56
48
|
}
|
|
57
|
-
}
|
|
49
|
+
}
|
|
@@ -1,42 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MUI TanStack DataTable
|
|
3
|
-
*
|
|
4
|
-
* A comprehensive, highly customizable data table component built with:
|
|
5
|
-
* - Material-UI (MUI) for styling
|
|
6
|
-
* - TanStack Table for table logic
|
|
7
|
-
* - TypeScript for type safety
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Column sorting, filtering, resizing, reordering, and pinning
|
|
11
|
-
* - Row selection, expansion, and virtualization
|
|
12
|
-
* - Pagination with customizable page sizes
|
|
13
|
-
* - Global and column-specific search/filtering
|
|
14
|
-
* - Export functionality (CSV, XLSX, JSON)
|
|
15
|
-
* - Responsive design with mobile support
|
|
16
|
-
* - Accessibility features
|
|
17
|
-
* - Customizable toolbar and actions
|
|
18
|
-
* - Loading states and empty data handling
|
|
19
|
-
*/
|
|
20
|
-
// Main components - be specific to avoid conflicts
|
|
21
1
|
export { DataTable } from './lib/components/table';
|
|
22
|
-
|
|
2
|
+
export type { DataTableProps } from './lib/components/table';
|
|
23
3
|
export * from './lib/components/headers';
|
|
24
4
|
export * from './lib/components/rows';
|
|
25
5
|
export * from './lib/components/filters';
|
|
26
6
|
export * from './lib/components/pagination';
|
|
27
7
|
export * from './lib/components/droupdown/menu-dropdown';
|
|
28
|
-
// Individual toolbar components for custom toolbars
|
|
29
8
|
export { ColumnVisibilityControl, ColumnPinningControl, ColumnResetControl, TableExportControl, TableSizeControl, BulkActionsToolbar, DataTableToolbar, } from './lib/components/toolbar';
|
|
30
|
-
|
|
9
|
+
export type { BulkActionsToolbarProps } from './lib/components/toolbar';
|
|
31
10
|
export * from './lib/utils/styling-helpers';
|
|
32
11
|
export * from './lib/utils/column-helpers';
|
|
33
12
|
export * from './lib/utils/table-helpers';
|
|
34
|
-
// Custom hooks
|
|
35
13
|
export * from './lib/hooks';
|
|
36
14
|
export * from './lib/types';
|
|
37
|
-
|
|
15
|
+
export type { Column, ColumnDef, Row, Table, Header, Cell, SortingState, ColumnFiltersState, VisibilityState, ColumnOrderState, ColumnPinningState, PaginationState, } from '@tanstack/react-table';
|
|
38
16
|
export * from './lib/features';
|
|
39
|
-
// Examples
|
|
40
17
|
export { CustomColumnFilterExample } from './lib/examples/custom-column-filter-example';
|
|
41
18
|
export { SimpleLocalExample } from './lib/examples/simple-local-example';
|
|
42
19
|
export { AdvancedFeaturesExample } from './lib/examples/advanced-features-example';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdvancedFeaturesExample = exports.SimpleLocalExample = exports.CustomColumnFilterExample = exports.DataTableToolbar = exports.BulkActionsToolbar = exports.TableSizeControl = exports.TableExportControl = exports.ColumnResetControl = exports.ColumnPinningControl = exports.ColumnVisibilityControl = exports.DataTable = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
var table_1 = require("./lib/components/table");
|
|
6
|
+
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return table_1.DataTable; } });
|
|
7
|
+
tslib_1.__exportStar(require("./lib/components/headers"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/components/rows"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/components/filters"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/components/pagination"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/components/droupdown/menu-dropdown"), exports);
|
|
12
|
+
var toolbar_1 = require("./lib/components/toolbar");
|
|
13
|
+
Object.defineProperty(exports, "ColumnVisibilityControl", { enumerable: true, get: function () { return toolbar_1.ColumnVisibilityControl; } });
|
|
14
|
+
Object.defineProperty(exports, "ColumnPinningControl", { enumerable: true, get: function () { return toolbar_1.ColumnPinningControl; } });
|
|
15
|
+
Object.defineProperty(exports, "ColumnResetControl", { enumerable: true, get: function () { return toolbar_1.ColumnResetControl; } });
|
|
16
|
+
Object.defineProperty(exports, "TableExportControl", { enumerable: true, get: function () { return toolbar_1.TableExportControl; } });
|
|
17
|
+
Object.defineProperty(exports, "TableSizeControl", { enumerable: true, get: function () { return toolbar_1.TableSizeControl; } });
|
|
18
|
+
Object.defineProperty(exports, "BulkActionsToolbar", { enumerable: true, get: function () { return toolbar_1.BulkActionsToolbar; } });
|
|
19
|
+
Object.defineProperty(exports, "DataTableToolbar", { enumerable: true, get: function () { return toolbar_1.DataTableToolbar; } });
|
|
20
|
+
tslib_1.__exportStar(require("./lib/utils/styling-helpers"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/utils/column-helpers"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./lib/utils/table-helpers"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./lib/hooks"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./lib/types"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./lib/features"), exports);
|
|
26
|
+
var custom_column_filter_example_1 = require("./lib/examples/custom-column-filter-example");
|
|
27
|
+
Object.defineProperty(exports, "CustomColumnFilterExample", { enumerable: true, get: function () { return custom_column_filter_example_1.CustomColumnFilterExample; } });
|
|
28
|
+
var simple_local_example_1 = require("./lib/examples/simple-local-example");
|
|
29
|
+
Object.defineProperty(exports, "SimpleLocalExample", { enumerable: true, get: function () { return simple_local_example_1.SimpleLocalExample; } });
|
|
30
|
+
var advanced_features_example_1 = require("./lib/examples/advanced-features-example");
|
|
31
|
+
Object.defineProperty(exports, "AdvancedFeaturesExample", { enumerable: true, get: function () { return advanced_features_example_1.AdvancedFeaturesExample; } });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Menu, MenuProps, Popover } from '@mui/material';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
type ChildrenEvent = {
|
|
4
|
+
handleClose: () => void;
|
|
5
|
+
open: boolean;
|
|
6
|
+
};
|
|
7
|
+
type AnchorEvent = {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface MenuDropdownProps extends Omit<MenuProps, 'children' | 'open'> {
|
|
11
|
+
children?: ((event: ChildrenEvent) => ReactNode) | ReactNode | any;
|
|
12
|
+
anchor?: ((event: AnchorEvent) => ReactElement<any>) | ReactElement<any>;
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
component?: typeof Popover | typeof Menu;
|
|
15
|
+
}
|
|
16
|
+
export declare function MenuDropdown({ children, anchor, label, component, sx, ...props }: MenuDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuDropdown = MenuDropdown;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
function MenuDropdown(_a) {
|
|
9
|
+
var { children, anchor, label, component, sx } = _a, props = tslib_1.__rest(_a, ["children", "anchor", "label", "component", "sx"]);
|
|
10
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
11
|
+
const isOpen = (0, react_1.useMemo)(() => Boolean(anchorEl), [anchorEl]);
|
|
12
|
+
const handleClick = (0, react_1.useCallback)((event) => {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
setAnchorEl(event.currentTarget);
|
|
16
|
+
}, []);
|
|
17
|
+
const handleClose = (0, react_1.useCallback)((event) => {
|
|
18
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
19
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
20
|
+
setAnchorEl(null);
|
|
21
|
+
}, []);
|
|
22
|
+
const anchorNode = (0, react_1.useMemo)(() => {
|
|
23
|
+
if (anchor) {
|
|
24
|
+
let node = anchor;
|
|
25
|
+
if (typeof anchor === 'function') {
|
|
26
|
+
node = anchor({ isOpen: isOpen });
|
|
27
|
+
}
|
|
28
|
+
return (0, react_1.cloneElement)(node, {
|
|
29
|
+
onClick: handleClick,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleClick, children: label });
|
|
33
|
+
}, [
|
|
34
|
+
anchor,
|
|
35
|
+
handleClick,
|
|
36
|
+
isOpen,
|
|
37
|
+
label,
|
|
38
|
+
]);
|
|
39
|
+
const DropDownComponent = (component || material_1.Popover);
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [anchorNode, (0, jsx_runtime_1.jsx)(DropDownComponent, Object.assign({ anchorEl: anchorEl, open: isOpen, onClose: handleClose, anchorOrigin: {
|
|
41
|
+
vertical: 'bottom',
|
|
42
|
+
horizontal: 'left',
|
|
43
|
+
}, transformOrigin: {
|
|
44
|
+
vertical: 'top',
|
|
45
|
+
horizontal: 'left',
|
|
46
|
+
} }, props, { children: typeof children === 'function' ?
|
|
47
|
+
children({
|
|
48
|
+
handleClose,
|
|
49
|
+
open: isOpen,
|
|
50
|
+
}) :
|
|
51
|
+
children }))] }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Column } from '@tanstack/react-table';
|
|
2
|
+
import { ColumnFilterRule } from '../../features';
|
|
3
|
+
interface FilterValueInputProps<T> {
|
|
4
|
+
filter: ColumnFilterRule;
|
|
5
|
+
column: Column<T, any>;
|
|
6
|
+
onValueChange: (value: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function FilterValueInput<T>({ filter, column, onValueChange, }: FilterValueInputProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterValueInput = FilterValueInput;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const DatePicker_1 = require("@mui/x-date-pickers/DatePicker");
|
|
8
|
+
const moment_1 = tslib_1.__importDefault(require("moment"));
|
|
9
|
+
const column_helpers_1 = require("../../utils/column-helpers");
|
|
10
|
+
const AdapterMoment_1 = require("@mui/x-date-pickers/AdapterMoment");
|
|
11
|
+
const x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
12
|
+
function FilterValueInput({ filter, column, onValueChange, }) {
|
|
13
|
+
const columnType = (0, column_helpers_1.getColumnType)(column);
|
|
14
|
+
const customComponent = (0, column_helpers_1.getCustomFilterComponent)(column);
|
|
15
|
+
const options = (0, column_helpers_1.getColumnOptions)(column);
|
|
16
|
+
const operator = filter.operator;
|
|
17
|
+
if (customComponent) {
|
|
18
|
+
const CustomComponent = customComponent;
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(CustomComponent, { value: filter.value, onChange: onValueChange, filter: filter, column: column }));
|
|
20
|
+
}
|
|
21
|
+
if (columnType === 'boolean') {
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
minWidth: 120,
|
|
25
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Value" }), (0, jsx_runtime_1.jsxs)(material_1.Select, { value: filter.value || 'any', label: "Value", onChange: (e) => onValueChange(e.target.value), children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: 'any', children: "Any" }, 'any'), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: 'true', children: "True" }, 'true'), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: 'false', children: "False" }, 'false')] })] }));
|
|
26
|
+
}
|
|
27
|
+
if (columnType === 'select' && options.length > 0) {
|
|
28
|
+
if (operator === 'in' || operator === 'notIn') {
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { flex: 1, minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Value" }), (0, jsx_runtime_1.jsx)(material_1.Select, { multiple: true, value: Array.isArray(filter.value) ? filter.value : [], label: "Value", onChange: (e) => onValueChange(e.target.value), renderValue: (selected) => selected.map(val => {
|
|
30
|
+
const opt = options.find(o => o.value === val);
|
|
31
|
+
return opt ? opt.label : val;
|
|
32
|
+
}).join(', '), children: options.map(option => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { value: option.value, children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: Array.isArray(filter.value) && filter.value.indexOf(option.value) > -1 }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: option.label })] }, String(option.value)))) })] }));
|
|
33
|
+
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { size: "small", sx: { flex: 1, minWidth: 120 }, children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: "Value" }), (0, jsx_runtime_1.jsx)(material_1.Select, { value: filter.value, label: "Value", onChange: (e) => onValueChange(e.target.value), children: options.map(option => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: option.value, children: option.label }, String(option.value)))) })] }));
|
|
35
|
+
}
|
|
36
|
+
if (columnType === 'date') {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(x_date_pickers_1.LocalizationProvider, { dateAdapter: AdapterMoment_1.AdapterMoment, children: (0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { value: filter.value ? (0, moment_1.default)(filter.value) : null, onChange: (e) => onValueChange(e === null || e === void 0 ? void 0 : e.toDate()), slotProps: {
|
|
38
|
+
textField: {
|
|
39
|
+
size: 'small',
|
|
40
|
+
label: 'Value',
|
|
41
|
+
sx: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
minWidth: 120,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
} }) }));
|
|
47
|
+
}
|
|
48
|
+
if (columnType === 'number') {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, { size: "small", label: "Value", value: filter.value, onChange: (e) => onValueChange(e.target.value), type: "number", sx: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
minWidth: 120,
|
|
52
|
+
} }));
|
|
53
|
+
}
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, { size: "small", label: "Value", value: filter.value, onChange: (e) => onValueChange(e.target.value), sx: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
minWidth: 120,
|
|
57
|
+
} }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const FILTER_OPERATORS: {
|
|
2
|
+
text: {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}[];
|
|
6
|
+
boolean: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
number: {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
date: {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}[];
|
|
18
|
+
select: {
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
export * from './filter-value-input';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FILTER_OPERATORS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
exports.FILTER_OPERATORS = {
|
|
2
6
|
text: [
|
|
3
7
|
{
|
|
4
8
|
value: 'contains',
|
|
@@ -122,4 +126,4 @@ export const FILTER_OPERATORS = {
|
|
|
122
126
|
},
|
|
123
127
|
],
|
|
124
128
|
};
|
|
125
|
-
|
|
129
|
+
tslib_1.__exportStar(require("./filter-value-input"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Header } from '@tanstack/react-table';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface DraggableHeaderProps<T> {
|
|
4
|
+
header: Header<T, unknown>;
|
|
5
|
+
enableSorting?: boolean;
|
|
6
|
+
draggable?: boolean;
|
|
7
|
+
onColumnReorder?: (draggedColumnId: string, targetColumnId: string) => void;
|
|
8
|
+
slots?: Record<string, any>;
|
|
9
|
+
slotProps?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export declare function DraggableHeader<T>({ header, enableSorting, draggable, onColumnReorder, slots, slotProps, }: DraggableHeaderProps<T>): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>> | import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DraggableHeader = DraggableHeader;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_table_1 = require("@tanstack/react-table");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
10
|
+
function DraggableHeader({ header, enableSorting = true, draggable = false, onColumnReorder, slots, slotProps, }) {
|
|
11
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
12
|
+
const [dragOver, setDragOver] = (0, react_1.useState)(false);
|
|
13
|
+
const autoScrollIntervalRef = (0, react_1.useRef)(null);
|
|
14
|
+
const dragStartPositionRef = (0, react_1.useRef)(null);
|
|
15
|
+
const headerElementRef = (0, react_1.useRef)(null);
|
|
16
|
+
const SortIconAscSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'sortIconAsc', icons_material_1.ArrowUpwardOutlined);
|
|
17
|
+
const SortIconDescSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'sortIconDesc', icons_material_1.ArrowDownwardOutlined);
|
|
18
|
+
const AUTO_SCROLL_THRESHOLD = 50;
|
|
19
|
+
const AUTO_SCROLL_SPEED = 10;
|
|
20
|
+
const AUTO_SCROLL_INTERVAL = 16;
|
|
21
|
+
const findScrollableContainer = (0, react_1.useCallback)((element) => {
|
|
21
22
|
let searchElement = element;
|
|
22
23
|
if (!searchElement) {
|
|
23
|
-
// Start from the header element if available
|
|
24
24
|
if (headerElementRef.current) {
|
|
25
25
|
searchElement = headerElementRef.current.closest('table');
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (!searchElement) {
|
|
29
|
-
// Find the table that contains our header
|
|
30
29
|
const tables = Array.from(document.querySelectorAll('table'));
|
|
31
30
|
for (const table of tables) {
|
|
32
|
-
|
|
33
|
-
const headerExists = table.querySelector('th'); // fallback
|
|
31
|
+
const headerExists = table.querySelector('th');
|
|
34
32
|
if (headerExists) {
|
|
35
33
|
searchElement = table;
|
|
36
34
|
break;
|
|
@@ -38,12 +36,10 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
if (!searchElement) {
|
|
41
|
-
// Last resort: use the first table found
|
|
42
39
|
searchElement = document.querySelector('table');
|
|
43
40
|
}
|
|
44
41
|
if (!searchElement)
|
|
45
42
|
return null;
|
|
46
|
-
// Walk up the DOM tree to find the scrollable container
|
|
47
43
|
let container = searchElement;
|
|
48
44
|
while (container && container !== document.body) {
|
|
49
45
|
const styles = window.getComputedStyle(container);
|
|
@@ -54,7 +50,7 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
54
50
|
}
|
|
55
51
|
return null;
|
|
56
52
|
}, []);
|
|
57
|
-
const startAutoScroll = useCallback((direction) => {
|
|
53
|
+
const startAutoScroll = (0, react_1.useCallback)((direction) => {
|
|
58
54
|
if (autoScrollIntervalRef.current) {
|
|
59
55
|
clearInterval(autoScrollIntervalRef.current);
|
|
60
56
|
}
|
|
@@ -64,7 +60,6 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
64
60
|
autoScrollIntervalRef.current = setInterval(() => {
|
|
65
61
|
const scrollAmount = direction === 'left' ? -AUTO_SCROLL_SPEED : AUTO_SCROLL_SPEED;
|
|
66
62
|
const newScrollLeft = container.scrollLeft + scrollAmount;
|
|
67
|
-
// Check bounds
|
|
68
63
|
if (direction === 'left' && newScrollLeft <= 0) {
|
|
69
64
|
container.scrollLeft = 0;
|
|
70
65
|
clearInterval(autoScrollIntervalRef.current);
|
|
@@ -80,13 +75,13 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
80
75
|
}
|
|
81
76
|
}, AUTO_SCROLL_INTERVAL);
|
|
82
77
|
}, [findScrollableContainer]);
|
|
83
|
-
const stopAutoScroll = useCallback(() => {
|
|
78
|
+
const stopAutoScroll = (0, react_1.useCallback)(() => {
|
|
84
79
|
if (autoScrollIntervalRef.current) {
|
|
85
80
|
clearInterval(autoScrollIntervalRef.current);
|
|
86
81
|
autoScrollIntervalRef.current = null;
|
|
87
82
|
}
|
|
88
83
|
}, []);
|
|
89
|
-
const checkAutoScroll = useCallback((clientX) => {
|
|
84
|
+
const checkAutoScroll = (0, react_1.useCallback)((clientX) => {
|
|
90
85
|
const container = findScrollableContainer();
|
|
91
86
|
if (!container) {
|
|
92
87
|
return;
|
|
@@ -94,16 +89,12 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
94
89
|
const rect = container.getBoundingClientRect();
|
|
95
90
|
const distanceFromLeft = clientX - rect.left;
|
|
96
91
|
const distanceFromRight = rect.right - clientX;
|
|
97
|
-
// Stop any existing auto-scroll
|
|
98
92
|
stopAutoScroll();
|
|
99
|
-
// Check if we should start auto-scrolling
|
|
100
93
|
if (distanceFromLeft < AUTO_SCROLL_THRESHOLD && container.scrollLeft > 0) {
|
|
101
|
-
// Near left edge and can scroll left
|
|
102
94
|
startAutoScroll('left');
|
|
103
95
|
}
|
|
104
96
|
else if (distanceFromRight < AUTO_SCROLL_THRESHOLD &&
|
|
105
97
|
container.scrollLeft < container.scrollWidth - container.clientWidth) {
|
|
106
|
-
// Near right edge and can scroll right
|
|
107
98
|
startAutoScroll('right');
|
|
108
99
|
}
|
|
109
100
|
}, [
|
|
@@ -122,10 +113,9 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
122
113
|
e.dataTransfer.setData('text/plain', header.id);
|
|
123
114
|
e.dataTransfer.effectAllowed = 'move';
|
|
124
115
|
};
|
|
125
|
-
const handleDrag = useCallback((e) => {
|
|
116
|
+
const handleDrag = (0, react_1.useCallback)((e) => {
|
|
126
117
|
if (!isDragging || !draggable)
|
|
127
118
|
return;
|
|
128
|
-
// Only check for auto-scroll if we have valid coordinates
|
|
129
119
|
if (e.clientX > 0 && e.clientY > 0) {
|
|
130
120
|
checkAutoScroll(e.clientX);
|
|
131
121
|
}
|
|
@@ -138,14 +128,12 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
138
128
|
if (!enableSorting)
|
|
139
129
|
return null;
|
|
140
130
|
const sortDirection = header.column.getIsSorted();
|
|
141
|
-
// Only show icons when column is actually sorted
|
|
142
131
|
if (sortDirection === 'asc') {
|
|
143
|
-
return (
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(SortIconAscSlot, Object.assign({ fontSize: "small" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.sortIconAsc)));
|
|
144
133
|
}
|
|
145
134
|
if (sortDirection === 'desc') {
|
|
146
|
-
return (
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)(SortIconDescSlot, Object.assign({ fontSize: "small" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.sortIconDesc)));
|
|
147
136
|
}
|
|
148
|
-
// Don't show any icon when not sorted
|
|
149
137
|
return null;
|
|
150
138
|
};
|
|
151
139
|
const handleDragEnd = () => {
|
|
@@ -160,12 +148,10 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
160
148
|
e.preventDefault();
|
|
161
149
|
e.dataTransfer.dropEffect = 'move';
|
|
162
150
|
setDragOver(true);
|
|
163
|
-
// Check for auto-scroll during drag over
|
|
164
151
|
checkAutoScroll(e.clientX);
|
|
165
152
|
};
|
|
166
153
|
const handleDragLeave = () => {
|
|
167
154
|
setDragOver(false);
|
|
168
|
-
// Don't stop auto-scroll on drag leave as the drag might continue outside this element
|
|
169
155
|
};
|
|
170
156
|
const handleDrop = (e) => {
|
|
171
157
|
if (!draggable)
|
|
@@ -183,13 +169,13 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
183
169
|
return;
|
|
184
170
|
const currentSort = header.column.getIsSorted();
|
|
185
171
|
if (currentSort === false) {
|
|
186
|
-
header.column.toggleSorting(false);
|
|
172
|
+
header.column.toggleSorting(false);
|
|
187
173
|
}
|
|
188
174
|
else if (currentSort === 'asc') {
|
|
189
|
-
header.column.toggleSorting(true);
|
|
175
|
+
header.column.toggleSorting(true);
|
|
190
176
|
}
|
|
191
177
|
else {
|
|
192
|
-
header.column.clearSorting();
|
|
178
|
+
header.column.clearSorting();
|
|
193
179
|
}
|
|
194
180
|
};
|
|
195
181
|
const getCursor = () => {
|
|
@@ -200,9 +186,9 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
200
186
|
return 'default';
|
|
201
187
|
};
|
|
202
188
|
if (!draggable && !enableSorting) {
|
|
203
|
-
return flexRender(header.column.columnDef.header, header.getContext());
|
|
189
|
+
return (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext());
|
|
204
190
|
}
|
|
205
|
-
return (
|
|
191
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { ref: headerElementRef, sx: {
|
|
206
192
|
display: 'flex',
|
|
207
193
|
alignItems: 'center',
|
|
208
194
|
gap: 1,
|
|
@@ -217,10 +203,10 @@ export function DraggableHeader({ header, enableSorting = true, draggable = fals
|
|
|
217
203
|
'&:active': {
|
|
218
204
|
cursor: draggable ? 'grabbing' : 'pointer',
|
|
219
205
|
},
|
|
220
|
-
}, draggable: draggable, onDragStart: handleDragStart, onDrag: handleDrag, onDragEnd: handleDragEnd, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: enableSorting ? handleSort : undefined, children:
|
|
206
|
+
}, draggable: draggable, onDragStart: handleDragStart, onDrag: handleDrag, onDragEnd: handleDragEnd, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: enableSorting ? handleSort : undefined, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
221
207
|
flex: 1,
|
|
222
208
|
display: 'flex',
|
|
223
209
|
alignItems: 'center',
|
|
224
210
|
gap: 1,
|
|
225
|
-
}, children: [flexRender(header.column.columnDef.header, header.getContext()), getSortIcon()] }) }));
|
|
211
|
+
}, children: [(0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()), getSortIcon()] }) }));
|
|
226
212
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TableHeaderProps {
|
|
2
|
+
draggable?: boolean;
|
|
3
|
+
enableColumnResizing?: boolean;
|
|
4
|
+
enableStickyHeader?: boolean;
|
|
5
|
+
fitToScreen?: boolean;
|
|
6
|
+
onColumnReorder?: (draggedColumnId: string, targetColumnId: string) => void;
|
|
7
|
+
slots?: Record<string, any>;
|
|
8
|
+
slotProps?: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
export declare function TableHeader<T>({ draggable, enableColumnResizing, enableStickyHeader, fitToScreen, onColumnReorder, slots, slotProps, }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHeader = TableHeader;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const draggable_header_1 = require("./draggable-header");
|
|
7
|
+
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
10
|
+
function TableHeader({ draggable = false, enableColumnResizing = false, enableStickyHeader = false, fitToScreen = true, onColumnReorder, slots, slotProps, }) {
|
|
11
|
+
const theme = (0, material_1.useTheme)();
|
|
12
|
+
const { table } = (0, data_table_context_1.useDataTableContext)();
|
|
13
|
+
const HeaderCellSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'headerCell', material_1.TableCell);
|
|
14
|
+
const HeaderRowSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'headerRow', material_1.TableRow);
|
|
15
|
+
const HeaderSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'header', material_1.TableHead);
|
|
16
|
+
const renderHeaderCell = (header) => {
|
|
17
|
+
const isPinned = header.column.getIsPinned();
|
|
18
|
+
const pinnedPosition = isPinned ? header.column.getStart('left') : undefined;
|
|
19
|
+
const pinnedRightPosition = isPinned === 'right' ? header.column.getAfter('right') : undefined;
|
|
20
|
+
const alignment = (0, utils_1.getColumnAlignment)(header.column.columnDef);
|
|
21
|
+
const enableSorting = header.column.getCanSort();
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(HeaderCellSlot, Object.assign({ align: alignment, sx: Object.assign({}, (0, utils_1.getPinnedColumnStyle)({
|
|
23
|
+
width: (fitToScreen && !enableColumnResizing) ? 'auto' : header.getSize(),
|
|
24
|
+
isPinned,
|
|
25
|
+
pinnedPosition,
|
|
26
|
+
isLastLeftPinnedColumn: isPinned === 'left' && header.column.getIsLastColumn('left'),
|
|
27
|
+
isFirstRightPinnedColumn: isPinned === 'right' && header.column.getIsFirstColumn('right'),
|
|
28
|
+
pinnedRightPosition,
|
|
29
|
+
zIndex: isPinned ? 10 : 1,
|
|
30
|
+
disableStickyHeader: enableStickyHeader,
|
|
31
|
+
})) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.headerCell, { children: [(0, jsx_runtime_1.jsx)(draggable_header_1.DraggableHeader, { header: header, enableSorting: enableSorting, draggable: !!(draggable && !isPinned), onColumnReorder: onColumnReorder, slots: slots, slotProps: slotProps }), enableColumnResizing && header.column.getCanResize() ? ((0, jsx_runtime_1.jsx)(material_1.Box, { onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
right: 0,
|
|
34
|
+
top: '25%',
|
|
35
|
+
height: '50%',
|
|
36
|
+
width: '3px',
|
|
37
|
+
cursor: 'col-resize',
|
|
38
|
+
userSelect: 'none',
|
|
39
|
+
touchAction: 'none',
|
|
40
|
+
borderRadius: '4px',
|
|
41
|
+
backgroundColor: header.column.getIsResizing() ? 'primary.main' : theme.palette.grey[300],
|
|
42
|
+
'&:hover': {
|
|
43
|
+
backgroundColor: theme.palette.primary.main,
|
|
44
|
+
},
|
|
45
|
+
} })) : null] }), header.id));
|
|
46
|
+
};
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(HeaderSlot, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.header, { children: table.getHeaderGroups().map(headerGroup => ((0, jsx_runtime_1.jsx)(HeaderRowSlot, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.headerRow, { children: headerGroup.headers.map(renderHeaderCell) }), headerGroup.id))) })));
|
|
48
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./table"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./headers"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./rows"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./toolbar"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./filters"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./pagination"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./droupdown/menu-dropdown"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TablePaginationProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface DataTablePaginationProps extends Omit<TablePaginationProps, 'count' | 'rowsPerPage' | 'page' | 'onPageChange' | 'onRowsPerPageChange'> {
|
|
4
|
+
totalRow: number;
|
|
5
|
+
footerFilter?: ReactNode | null;
|
|
6
|
+
pagination: {
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
pageSize: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const DataTablePagination: import("react").MemoExoticComponent<({ footerFilter, pagination, totalRow, ...props }: DataTablePaginationProps) => import("react/jsx-runtime").JSX.Element>;
|