@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.
Files changed (258) hide show
  1. package/package.json +3 -11
  2. package/{index.js → src/index.d.ts} +3 -26
  3. package/src/index.js +31 -0
  4. package/src/lib/components/droupdown/menu-dropdown.d.ts +17 -0
  5. package/src/lib/components/droupdown/menu-dropdown.js +52 -0
  6. package/src/lib/components/filters/filter-value-input.d.ts +9 -0
  7. package/src/lib/components/filters/filter-value-input.js +58 -0
  8. package/src/lib/components/filters/index.d.ts +23 -0
  9. package/{lib → src/lib}/components/filters/index.js +6 -2
  10. package/src/lib/components/headers/draggable-header.d.ts +12 -0
  11. package/{lib → src/lib}/components/headers/draggable-header.js +35 -49
  12. package/{lib/components/headers/index.js → src/lib/components/headers/index.d.ts} +0 -3
  13. package/src/lib/components/headers/index.js +5 -0
  14. package/src/lib/components/headers/table-header.d.ts +10 -0
  15. package/src/lib/components/headers/table-header.js +48 -0
  16. package/src/lib/components/index.d.ts +7 -0
  17. package/src/lib/components/index.js +10 -0
  18. package/src/lib/components/pagination/data-table-pagination.d.ts +11 -0
  19. package/src/lib/components/pagination/data-table-pagination.js +25 -0
  20. package/src/lib/components/pagination/index.d.ts +1 -0
  21. package/src/lib/components/pagination/index.js +4 -0
  22. package/src/lib/components/rows/data-table-row.d.ts +13 -0
  23. package/src/lib/components/rows/data-table-row.js +31 -0
  24. package/src/lib/components/rows/empty-data-row.d.ts +6 -0
  25. package/src/lib/components/rows/empty-data-row.js +11 -0
  26. package/{lib/components/rows/index.js → src/lib/components/rows/index.d.ts} +0 -3
  27. package/src/lib/components/rows/index.js +6 -0
  28. package/src/lib/components/rows/loading-rows.d.ts +5 -0
  29. package/src/lib/components/rows/loading-rows.js +49 -0
  30. package/src/lib/components/table/data-table.d.ts +3 -0
  31. package/src/lib/components/table/data-table.js +492 -0
  32. package/src/lib/components/table/data-table.types.d.ts +114 -0
  33. package/src/lib/components/table/data-table.types.js +2 -0
  34. package/{lib/components/table/index.js → src/lib/components/table/index.d.ts} +0 -3
  35. package/src/lib/components/table/index.js +5 -0
  36. package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +9 -0
  37. package/src/lib/components/toolbar/bulk-actions-toolbar.js +25 -0
  38. package/src/lib/components/toolbar/column-custom-filter-control.d.ts +1 -0
  39. package/src/lib/components/toolbar/column-custom-filter-control.js +137 -0
  40. package/src/lib/components/toolbar/column-pinning-control.d.ts +1 -0
  41. package/src/lib/components/toolbar/column-pinning-control.js +105 -0
  42. package/src/lib/components/toolbar/column-reset-control.d.ts +1 -0
  43. package/src/lib/components/toolbar/column-reset-control.js +16 -0
  44. package/src/lib/components/toolbar/column-visibility-control.d.ts +1 -0
  45. package/src/lib/components/toolbar/column-visibility-control.js +31 -0
  46. package/src/lib/components/toolbar/data-table-toolbar.d.ts +14 -0
  47. package/src/lib/components/toolbar/data-table-toolbar.js +26 -0
  48. package/{lib/components/toolbar/index.js → src/lib/components/toolbar/index.d.ts} +1 -6
  49. package/src/lib/components/toolbar/index.js +17 -0
  50. package/src/lib/components/toolbar/table-export-control.d.ts +25 -0
  51. package/src/lib/components/toolbar/table-export-control.js +93 -0
  52. package/src/lib/components/toolbar/table-search-control.d.ts +1 -0
  53. package/src/lib/components/toolbar/table-search-control.js +61 -0
  54. package/src/lib/components/toolbar/table-size-control.d.ts +1 -0
  55. package/src/lib/components/toolbar/table-size-control.js +36 -0
  56. package/src/lib/contexts/data-table-context.d.ts +43 -0
  57. package/{lib → src/lib}/contexts/data-table-context.js +12 -8
  58. package/src/lib/examples/advanced-features-example.d.ts +1 -0
  59. package/src/lib/examples/advanced-features-example.js +264 -0
  60. package/src/lib/examples/bulk-actions-test.d.ts +1 -0
  61. package/src/lib/examples/bulk-actions-test.js +44 -0
  62. package/src/lib/examples/custom-column-filter-example.d.ts +1 -0
  63. package/{lib → src/lib}/examples/custom-column-filter-example.js +10 -10
  64. package/src/lib/examples/index.js +13 -0
  65. package/src/lib/examples/selection-test-example.d.ts +1 -0
  66. package/src/lib/examples/selection-test-example.js +101 -0
  67. package/src/lib/examples/simple-local-example.d.ts +1 -0
  68. package/{lib → src/lib}/examples/simple-local-example.js +14 -18
  69. package/src/lib/features/custom-column-filter.feature.d.ts +45 -0
  70. package/{lib → src/lib}/features/custom-column-filter.feature.js +40 -99
  71. package/src/lib/features/custom-selection.feature.d.ts +46 -0
  72. package/{lib → src/lib}/features/custom-selection.feature.js +18 -70
  73. package/src/lib/features/index.d.ts +2 -0
  74. package/src/lib/features/index.js +8 -0
  75. package/src/lib/hooks/index.d.ts +1 -0
  76. package/src/lib/hooks/index.js +4 -0
  77. package/src/lib/hooks/use-data-table-api.d.ts +56 -0
  78. package/{lib → src/lib}/hooks/use-data-table-api.js +79 -136
  79. package/src/lib/icons/add-icon.d.ts +2 -0
  80. package/src/lib/icons/add-icon.js +8 -0
  81. package/src/lib/icons/csv-icon.d.ts +2 -0
  82. package/src/lib/icons/csv-icon.js +8 -0
  83. package/src/lib/icons/delete-icon.d.ts +2 -0
  84. package/src/lib/icons/delete-icon.js +8 -0
  85. package/src/lib/icons/excel-icon.d.ts +2 -0
  86. package/src/lib/icons/excel-icon.js +8 -0
  87. package/src/lib/icons/index.js +17 -0
  88. package/src/lib/icons/unpin-icon.d.ts +2 -0
  89. package/src/lib/icons/unpin-icon.js +8 -0
  90. package/src/lib/icons/view-comfortable-icon.d.ts +2 -0
  91. package/src/lib/icons/view-comfortable-icon.js +8 -0
  92. package/src/lib/icons/view-compact-icon.d.ts +2 -0
  93. package/src/lib/icons/view-compact-icon.js +8 -0
  94. package/src/lib/types/column.types.d.ts +29 -0
  95. package/src/lib/types/column.types.js +5 -0
  96. package/src/lib/types/data-table-api.d.ts +134 -0
  97. package/src/lib/types/data-table-api.js +2 -0
  98. package/src/lib/types/export.types.d.ts +99 -0
  99. package/src/lib/types/export.types.js +2 -0
  100. package/src/lib/types/index.d.ts +6 -0
  101. package/src/lib/types/index.js +8 -0
  102. package/src/lib/types/slots.types.d.ts +272 -0
  103. package/src/lib/types/slots.types.js +2 -0
  104. package/src/lib/types/table.types.d.ts +63 -0
  105. package/src/lib/types/table.types.js +2 -0
  106. package/src/lib/utils/column-helpers.d.ts +7 -0
  107. package/src/lib/utils/column-helpers.js +43 -0
  108. package/src/lib/utils/debounced-fetch.utils.d.ts +11 -0
  109. package/{lib → src/lib}/utils/debounced-fetch.utils.js +15 -17
  110. package/src/lib/utils/export-utils.d.ts +30 -0
  111. package/src/lib/utils/export-utils.js +152 -0
  112. package/{lib/utils/index.js → src/lib/utils/index.d.ts} +0 -10
  113. package/src/lib/utils/index.js +10 -0
  114. package/src/lib/utils/slot-helpers.d.ts +9 -0
  115. package/src/lib/utils/slot-helpers.js +21 -0
  116. package/src/lib/utils/special-columns.utils.d.ts +6 -0
  117. package/src/lib/utils/special-columns.utils.js +52 -0
  118. package/src/lib/utils/styling-helpers.d.ts +36 -0
  119. package/src/lib/utils/styling-helpers.js +61 -0
  120. package/src/lib/utils/table-helpers.d.ts +9 -0
  121. package/{lib → src/lib}/utils/table-helpers.js +16 -31
  122. package/tsconfig.tsbuildinfo +1 -0
  123. package/LICENSE +0 -21
  124. package/index.d.ts.map +0 -1
  125. package/lib/components/droupdown/menu-dropdown.d.ts.map +0 -1
  126. package/lib/components/droupdown/menu-dropdown.js +0 -47
  127. package/lib/components/export-progress-dialog.d.ts.map +0 -1
  128. package/lib/components/export-progress-dialog.js +0 -30
  129. package/lib/components/filters/filter-value-input.d.ts.map +0 -1
  130. package/lib/components/filters/filter-value-input.js +0 -64
  131. package/lib/components/filters/index.d.ts.map +0 -1
  132. package/lib/components/headers/draggable-header.d.ts.map +0 -1
  133. package/lib/components/headers/index.d.ts.map +0 -1
  134. package/lib/components/headers/table-header.d.ts.map +0 -1
  135. package/lib/components/headers/table-header.js +0 -59
  136. package/lib/components/index.d.ts.map +0 -1
  137. package/lib/components/index.js +0 -18
  138. package/lib/components/pagination/data-table-pagination.d.ts.map +0 -1
  139. package/lib/components/pagination/data-table-pagination.js +0 -24
  140. package/lib/components/pagination/index.d.ts.map +0 -1
  141. package/lib/components/pagination/index.js +0 -4
  142. package/lib/components/rows/data-table-row.d.ts.map +0 -1
  143. package/lib/components/rows/data-table-row.js +0 -42
  144. package/lib/components/rows/empty-data-row.d.ts.map +0 -1
  145. package/lib/components/rows/empty-data-row.js +0 -8
  146. package/lib/components/rows/index.d.ts.map +0 -1
  147. package/lib/components/rows/loading-rows.d.ts.map +0 -1
  148. package/lib/components/rows/loading-rows.js +0 -46
  149. package/lib/components/table/data-table.d.ts.map +0 -1
  150. package/lib/components/table/data-table.js +0 -663
  151. package/lib/components/table/data-table.types.d.ts.map +0 -1
  152. package/lib/components/table/data-table.types.js +0 -6
  153. package/lib/components/table/index.d.ts.map +0 -1
  154. package/lib/components/toolbar/bulk-actions-toolbar.d.ts.map +0 -1
  155. package/lib/components/toolbar/bulk-actions-toolbar.js +0 -31
  156. package/lib/components/toolbar/column-custom-filter-control.d.ts.map +0 -1
  157. package/lib/components/toolbar/column-custom-filter-control.js +0 -149
  158. package/lib/components/toolbar/column-custum-filter-control.d.ts.map +0 -1
  159. package/lib/components/toolbar/column-custum-filter-control.js +0 -150
  160. package/lib/components/toolbar/column-pinning-control.d.ts.map +0 -1
  161. package/lib/components/toolbar/column-pinning-control.js +0 -103
  162. package/lib/components/toolbar/column-reset-control.d.ts.map +0 -1
  163. package/lib/components/toolbar/column-reset-control.js +0 -13
  164. package/lib/components/toolbar/column-visibility-control.d.ts.map +0 -1
  165. package/lib/components/toolbar/column-visibility-control.js +0 -27
  166. package/lib/components/toolbar/data-table-toolbar.d.ts.map +0 -1
  167. package/lib/components/toolbar/data-table-toolbar.js +0 -23
  168. package/lib/components/toolbar/index.d.ts.map +0 -1
  169. package/lib/components/toolbar/table-export-control.d.ts.map +0 -1
  170. package/lib/components/toolbar/table-export-control.js +0 -94
  171. package/lib/components/toolbar/table-search-control.d.ts.map +0 -1
  172. package/lib/components/toolbar/table-search-control.js +0 -61
  173. package/lib/components/toolbar/table-size-control.d.ts.map +0 -1
  174. package/lib/components/toolbar/table-size-control.js +0 -33
  175. package/lib/contexts/data-table-context.d.ts.map +0 -1
  176. package/lib/examples/advanced-features-example.d.ts.map +0 -1
  177. package/lib/examples/advanced-features-example.js +0 -282
  178. package/lib/examples/basic-example.d.ts.map +0 -1
  179. package/lib/examples/basic-example.js +0 -323
  180. package/lib/examples/bulk-actions-test.d.ts.map +0 -1
  181. package/lib/examples/bulk-actions-test.js +0 -47
  182. package/lib/examples/crud-api-example.d.ts.map +0 -1
  183. package/lib/examples/crud-api-example.js +0 -321
  184. package/lib/examples/custom-column-filter-example.d.ts.map +0 -1
  185. package/lib/examples/custom-selection-example.d.ts.map +0 -1
  186. package/lib/examples/custom-selection-example.js +0 -184
  187. package/lib/examples/export-callbacks-example.d.ts.map +0 -1
  188. package/lib/examples/export-callbacks-example.js +0 -155
  189. package/lib/examples/improved-export-example.d.ts.map +0 -1
  190. package/lib/examples/improved-export-example.js +0 -153
  191. package/lib/examples/improved-server-selection-example.d.ts.map +0 -1
  192. package/lib/examples/improved-server-selection-example.js +0 -118
  193. package/lib/examples/index.d.ts.map +0 -1
  194. package/lib/examples/selection-test-example.d.ts.map +0 -1
  195. package/lib/examples/selection-test-example.js +0 -111
  196. package/lib/examples/simple-local-example.d.ts.map +0 -1
  197. package/lib/examples/simple-server-selection-example.d.ts.map +0 -1
  198. package/lib/examples/simple-server-selection-example.js +0 -178
  199. package/lib/examples/virtualized-example.d.ts.map +0 -1
  200. package/lib/examples/virtualized-example.js +0 -119
  201. package/lib/features/custom-column-filter.feature.d.ts.map +0 -1
  202. package/lib/features/custom-selection.feature.d.ts.map +0 -1
  203. package/lib/features/index.d.ts.map +0 -1
  204. package/lib/features/index.js +0 -9
  205. package/lib/hooks/index.d.ts.map +0 -1
  206. package/lib/hooks/index.js +0 -6
  207. package/lib/hooks/use-data-table-api.d.ts.map +0 -1
  208. package/lib/hooks/use-table-state.d.ts.map +0 -1
  209. package/lib/hooks/use-table-state.js +0 -74
  210. package/lib/icons/add-icon.d.ts.map +0 -1
  211. package/lib/icons/add-icon.js +0 -5
  212. package/lib/icons/csv-icon.d.ts.map +0 -1
  213. package/lib/icons/csv-icon.js +0 -5
  214. package/lib/icons/delete-icon.d.ts.map +0 -1
  215. package/lib/icons/delete-icon.js +0 -5
  216. package/lib/icons/excel-icon.d.ts.map +0 -1
  217. package/lib/icons/excel-icon.js +0 -5
  218. package/lib/icons/index.d.ts.map +0 -1
  219. package/lib/icons/unpin-icon.d.ts.map +0 -1
  220. package/lib/icons/unpin-icon.js +0 -5
  221. package/lib/icons/view-comfortable-icon.d.ts.map +0 -1
  222. package/lib/icons/view-comfortable-icon.js +0 -5
  223. package/lib/icons/view-compact-icon.d.ts.map +0 -1
  224. package/lib/icons/view-compact-icon.js +0 -5
  225. package/lib/types/column.types.d.ts.map +0 -1
  226. package/lib/types/column.types.js +0 -2
  227. package/lib/types/data-table-api.d.ts.map +0 -1
  228. package/lib/types/data-table-api.js +0 -1
  229. package/lib/types/export.types.d.ts.map +0 -1
  230. package/lib/types/export.types.js +0 -5
  231. package/lib/types/hooks.types.d.ts.map +0 -1
  232. package/lib/types/hooks.types.js +0 -1
  233. package/lib/types/index.d.ts.map +0 -1
  234. package/lib/types/index.js +0 -14
  235. package/lib/types/slots.types.d.ts.map +0 -1
  236. package/lib/types/slots.types.js +0 -1
  237. package/lib/types/table.types.d.ts.map +0 -1
  238. package/lib/types/table.types.js +0 -1
  239. package/lib/utils/column-helpers.d.ts.map +0 -1
  240. package/lib/utils/column-helpers.js +0 -46
  241. package/lib/utils/debounced-fetch.utils.d.ts.map +0 -1
  242. package/lib/utils/export-utils.d.ts.map +0 -1
  243. package/lib/utils/export-utils.js +0 -181
  244. package/lib/utils/index.d.ts.map +0 -1
  245. package/lib/utils/selection-helpers.d.ts.map +0 -1
  246. package/lib/utils/selection-helpers.js +0 -162
  247. package/lib/utils/slot-helpers.d.ts.map +0 -1
  248. package/lib/utils/slot-helpers.js +0 -27
  249. package/lib/utils/special-columns.utils.d.ts.map +0 -1
  250. package/lib/utils/special-columns.utils.js +0 -77
  251. package/lib/utils/styling-helpers.d.ts.map +0 -1
  252. package/lib/utils/styling-helpers.js +0 -97
  253. package/lib/utils/table-helpers.d.ts.map +0 -1
  254. package/lib/utils/value-helpers.d.ts.map +0 -1
  255. package/lib/utils/value-helpers.js +0 -48
  256. package/tsconfig.lib.tsbuildinfo +0 -1
  257. /package/{lib/examples/index.js → src/lib/examples/index.d.ts} +0 -0
  258. /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
- "version": "1.0.19-beta-0.6",
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
- // Other component exports
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
- // Utilities and helpers
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
- // Custom features (this includes SelectMode from features)
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
- export const FILTER_OPERATORS = {
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
- export * from './filter-value-input';
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
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowUpwardOutlined, ArrowDownwardOutlined } from '@mui/icons-material';
3
- import { Box } from '@mui/material';
4
- import { flexRender } from '@tanstack/react-table';
5
- import { useState, useRef, useCallback } from 'react';
6
- import { getSlotComponent } from '../../utils/slot-helpers';
7
- export function DraggableHeader({ header, enableSorting = true, draggable = false, onColumnReorder, slots, slotProps, }) {
8
- const [isDragging, setIsDragging] = useState(false);
9
- const [dragOver, setDragOver] = useState(false);
10
- const autoScrollIntervalRef = useRef(null);
11
- const dragStartPositionRef = useRef(null);
12
- const headerElementRef = useRef(null);
13
- const SortIconAscSlot = getSlotComponent(slots, 'sortIconAsc', ArrowUpwardOutlined);
14
- const SortIconDescSlot = getSlotComponent(slots, 'sortIconDesc', ArrowDownwardOutlined);
15
- // Auto-scroll configuration
16
- const AUTO_SCROLL_THRESHOLD = 50; // Distance from edge to trigger scroll
17
- const AUTO_SCROLL_SPEED = 10; // Pixels per scroll interval
18
- const AUTO_SCROLL_INTERVAL = 16; // ~60fps
19
- const findScrollableContainer = useCallback((element) => {
20
- // Start from the provided element or try to find the current table
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
- // Check if this table contains a header with our ID
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 (_jsx(SortIconAscSlot, { fontSize: "small", ...slotProps?.sortIconAsc }));
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 (_jsx(SortIconDescSlot, { fontSize: "small", ...slotProps?.sortIconDesc }));
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); // asc
172
+ header.column.toggleSorting(false);
187
173
  }
188
174
  else if (currentSort === 'asc') {
189
- header.column.toggleSorting(true); // desc
175
+ header.column.toggleSorting(true);
190
176
  }
191
177
  else {
192
- header.column.clearSorting(); // none
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 (_jsx(Box, { ref: headerElementRef, sx: {
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: _jsxs(Box, { sx: {
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
  }
@@ -1,5 +1,2 @@
1
- /**
2
- * Header components for DataTable
3
- */
4
1
  export * from './table-header';
5
2
  export * from './draggable-header';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./table-header"), exports);
5
+ tslib_1.__exportStar(require("./draggable-header"), exports);
@@ -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,7 @@
1
+ export * from './table';
2
+ export * from './headers';
3
+ export * from './rows';
4
+ export * from './toolbar';
5
+ export * from './filters';
6
+ export * from './pagination';
7
+ export * from './droupdown/menu-dropdown';
@@ -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>;