@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
@@ -1,8 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback } from 'react';
3
- import { Box, Typography, Chip } from '@mui/material';
4
- import { DataTable } from '../components';
5
- // Simple static data
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleLocalExample = SimpleLocalExample;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const material_1 = require("@mui/material");
7
+ const components_1 = require("../components");
6
8
  const products = [
7
9
  { id: 1, name: 'Laptop Pro', category: 'Electronics', price: 1299, inStock: true, rating: 4.5 },
8
10
  { id: 2, name: 'Wireless Mouse', category: 'Electronics', price: 29, inStock: true, rating: 4.2 },
@@ -22,7 +24,6 @@ const products = [
22
24
  { id: 16, name: 'Phone Case', category: 'Electronics', price: 25, inStock: true, rating: 4.6 },
23
25
  { id: 17, name: 'Phone Case', category: 'Electronics', price: 25, inStock: true, rating: 4.6 },
24
26
  ];
25
- // Simple column definitions
26
27
  const columns = [
27
28
  {
28
29
  accessorKey: 'name',
@@ -33,7 +34,7 @@ const columns = [
33
34
  accessorKey: 'category',
34
35
  header: 'Category',
35
36
  size: 120,
36
- cell: ({ getValue }) => (_jsx(Chip, { label: getValue(), size: "small", variant: "outlined", color: "primary" })),
37
+ cell: ({ getValue }) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: getValue(), size: "small", variant: "outlined", color: "primary" })),
37
38
  },
38
39
  {
39
40
  accessorKey: 'price',
@@ -45,7 +46,7 @@ const columns = [
45
46
  accessorKey: 'inStock',
46
47
  header: 'In Stock',
47
48
  size: 100,
48
- cell: ({ getValue }) => (_jsx(Chip, { label: getValue() ? 'Yes' : 'No', color: getValue() ? 'success' : 'error', size: "small" })),
49
+ cell: ({ getValue }) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: getValue() ? 'Yes' : 'No', color: getValue() ? 'success' : 'error', size: "small" })),
49
50
  },
50
51
  {
51
52
  accessorKey: 'rating',
@@ -54,9 +55,8 @@ const columns = [
54
55
  cell: ({ getValue }) => `⭐ ${getValue().toFixed(1)}`,
55
56
  },
56
57
  ];
57
- export function SimpleLocalExample() {
58
- // Memoize bulkActions function to prevent infinite re-renders
59
- const bulkActions = useCallback((selectionState) => (_jsxs(Box, { sx: { display: 'flex', gap: 1 }, children: [_jsx("button", { onClick: () => {
58
+ function SimpleLocalExample() {
59
+ const bulkActions = (0, react_1.useCallback)((selectionState) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', gap: 1 }, children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
60
60
  const count = selectionState.type === 'include'
61
61
  ? selectionState.ids.length
62
62
  : products.length - selectionState.ids.length;
@@ -67,7 +67,7 @@ export function SimpleLocalExample() {
67
67
  border: '1px solid #ccc',
68
68
  background: '#f5f5f5',
69
69
  cursor: 'pointer'
70
- }, children: "\uD83D\uDCCA Show Count" }), _jsx("button", { onClick: () => {
70
+ }, children: "\uD83D\uDCCA Show Count" }), (0, jsx_runtime_1.jsx)("button", { onClick: () => {
71
71
  let selectedProducts;
72
72
  if (selectionState.type === 'include') {
73
73
  selectedProducts = products.filter(p => selectionState.ids.includes(p.id.toString()));
@@ -84,11 +84,7 @@ export function SimpleLocalExample() {
84
84
  background: '#f5f5f5',
85
85
  cursor: 'pointer'
86
86
  }, children: "\uD83D\uDCB0 Calculate Total" })] })), []);
87
- return (_jsxs(Box, { sx: { p: 3 }, children: [_jsx(Typography, { variant: "h4", gutterBottom: true, children: "Simple Local Data Example" }), _jsx(Typography, { variant: "body1", color: "text.secondary", sx: { mb: 3 }, children: "A basic example using static local data with no API calls. Demonstrates essential DataTable features with minimal setup." }), _jsx(DataTable, { data: products, totalRow: products.length, columns: columns,
88
- //Enable basic features
89
- enableSorting: true, enableGlobalFilter: true, enableColumnFilter: true,
90
- // enablePagination={false}
91
- enableColumnResizing: true, enableRowSelection: true, enableBulkActions: true, bulkActions: bulkActions, fitToScreen: true, initialState: {
87
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { p: 3 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", gutterBottom: true, children: "Simple Local Data Example" }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", color: "text.secondary", sx: { mb: 3 }, children: "A basic example using static local data with no API calls. Demonstrates essential DataTable features with minimal setup." }), (0, jsx_runtime_1.jsx)(components_1.DataTable, { data: products, totalRow: products.length, columns: columns, enableSorting: true, enableGlobalFilter: true, enableColumnFilter: true, enableColumnResizing: true, enableRowSelection: true, enableBulkActions: true, bulkActions: bulkActions, fitToScreen: true, initialState: {
92
88
  pagination: {
93
89
  pageIndex: 0,
94
90
  pageSize: 5,
@@ -97,5 +93,5 @@ export function SimpleLocalExample() {
97
93
  pagination: {
98
94
  rowsPerPageOptions: [5, 10, 20, 30, 40, 50],
99
95
  },
100
- } }), _jsx(Box, { sx: { mt: 2, p: 2, backgroundColor: 'grey.50', borderRadius: 1 }, children: _jsxs(Typography, { variant: "body2", color: "text.secondary", children: ["\uD83D\uDCA1 ", _jsx("strong", { children: "This example demonstrates:" }), _jsx("br", {}), "\u2022 Basic table with static local data", _jsx("br", {}), "\u2022 Simple column definitions with custom cell renderers", _jsx("br", {}), "\u2022 Sorting, filtering, and pagination", _jsx("br", {}), "\u2022 Row selection with bulk actions", _jsx("br", {}), "\u2022 Minimal setup - perfect for getting started"] }) })] }));
96
+ } }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { mt: 2, p: 2, backgroundColor: 'grey.50', borderRadius: 1 }, children: (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", color: "text.secondary", children: ["\uD83D\uDCA1 ", (0, jsx_runtime_1.jsx)("strong", { children: "This example demonstrates:" }), (0, jsx_runtime_1.jsx)("br", {}), "\u2022 Basic table with static local data", (0, jsx_runtime_1.jsx)("br", {}), "\u2022 Simple column definitions with custom cell renderers", (0, jsx_runtime_1.jsx)("br", {}), "\u2022 Sorting, filtering, and pagination", (0, jsx_runtime_1.jsx)("br", {}), "\u2022 Row selection with bulk actions", (0, jsx_runtime_1.jsx)("br", {}), "\u2022 Minimal setup - perfect for getting started"] }) })] }));
101
97
  }
@@ -0,0 +1,45 @@
1
+ import { Table, TableFeature, RowData, Updater, RowModel } from '@tanstack/react-table';
2
+ import type { CustomColumnFilterState } from '../types/table.types';
3
+ export interface ColumnFilterRule {
4
+ id: string;
5
+ columnId: string;
6
+ operator: string;
7
+ value: any;
8
+ columnType?: string;
9
+ }
10
+ export interface CustomColumnFilterOptions {
11
+ enableCustomColumnFilter?: boolean;
12
+ onCustomColumnFilterChange?: (updater: Updater<CustomColumnFilterState>) => void;
13
+ onCustomColumnFilterApply?: (state: CustomColumnFilterState) => void;
14
+ }
15
+ export interface CustomColumnFilterTableState {
16
+ customColumnFilter: CustomColumnFilterState;
17
+ }
18
+ declare module '@tanstack/table-core' {
19
+ interface TableState extends CustomColumnFilterTableState {
20
+ }
21
+ interface TableOptionsResolved<TData extends RowData> extends CustomColumnFilterOptions {
22
+ }
23
+ interface Table<TData extends RowData> extends CustomColumnFilterInstance<TData> {
24
+ }
25
+ }
26
+ export interface CustomColumnFilterInstance<TData extends RowData> {
27
+ setCustomColumnFilter: (updater: Updater<CustomColumnFilterState>) => void;
28
+ addPendingColumnFilter: (columnId: string, operator: string, value: any) => void;
29
+ updatePendingColumnFilter: (filterId: string, updates: Partial<ColumnFilterRule>) => void;
30
+ removePendingColumnFilter: (filterId: string) => void;
31
+ clearAllPendingColumnFilters: () => void;
32
+ setPendingFilterLogic: (logic: 'AND' | 'OR') => void;
33
+ applyPendingColumnFilters: () => void;
34
+ addColumnFilter: (columnId: string, operator: string, value: any) => void;
35
+ updateColumnFilter: (filterId: string, updates: Partial<ColumnFilterRule>) => void;
36
+ removeColumnFilter: (filterId: string) => void;
37
+ clearAllColumnFilters: () => void;
38
+ setFilterLogic: (logic: 'AND' | 'OR') => void;
39
+ getActiveColumnFilters: () => ColumnFilterRule[];
40
+ getPendingColumnFilters: () => ColumnFilterRule[];
41
+ getCustomColumnFilterState: () => CustomColumnFilterState;
42
+ }
43
+ export declare const CustomColumnFilterFeature: TableFeature<any>;
44
+ export declare function matchesCustomColumnFilters<TData extends RowData>(row: any, filters: ColumnFilterRule[], logic?: 'AND' | 'OR'): boolean;
45
+ export declare const getCombinedFilteredRowModel: <TData>() => (table: Table<TData>) => () => RowModel<TData>;
@@ -1,45 +1,36 @@
1
- /**
2
- * Custom Column Filter Feature for TanStack Table
3
- *
4
- * This feature adds advanced column filtering capabilities to TanStack Table
5
- * following the official custom features pattern introduced in v8.14.0
6
- */
7
- import { functionalUpdate, makeStateUpdater, getFilteredRowModel as getDefaultFilter, } from '@tanstack/react-table';
8
- import moment from 'moment';
9
- // The custom feature implementation
10
- export const CustomColumnFilterFeature = {
11
- // Define the feature's initial state
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCombinedFilteredRowModel = exports.CustomColumnFilterFeature = void 0;
4
+ exports.matchesCustomColumnFilters = matchesCustomColumnFilters;
5
+ const tslib_1 = require("tslib");
6
+ const react_table_1 = require("@tanstack/react-table");
7
+ const moment_1 = tslib_1.__importDefault(require("moment"));
8
+ exports.CustomColumnFilterFeature = {
12
9
  getInitialState: (state) => {
13
- return {
14
- customColumnFilter: {
10
+ return Object.assign({ customColumnFilter: {
15
11
  filters: [],
16
12
  logic: 'AND',
17
13
  pendingFilters: [],
18
14
  pendingLogic: 'AND',
19
- },
20
- ...state,
21
- };
15
+ } }, state);
22
16
  },
23
- // Define the feature's default options
24
17
  getDefaultOptions: (table) => {
25
18
  return {
26
19
  enableCustomColumnFilter: true,
27
- onCustomColumnFilterChange: makeStateUpdater('customColumnFilter', table),
20
+ onCustomColumnFilterChange: (0, react_table_1.makeStateUpdater)('customColumnFilter', table),
28
21
  onCustomColumnFilterApply: (state) => {
29
- // Implementation of onCustomColumnFilterApply
30
22
  },
31
23
  };
32
24
  },
33
- // Define the feature's table instance methods
34
25
  createTable: (table) => {
35
26
  table.setCustomColumnFilter = (updater) => {
27
+ var _a, _b;
36
28
  const safeUpdater = (old) => {
37
- const newState = functionalUpdate(updater, old);
29
+ const newState = (0, react_table_1.functionalUpdate)(updater, old);
38
30
  return newState;
39
31
  };
40
- return table.options.onCustomColumnFilterChange?.(safeUpdater);
32
+ return (_b = (_a = table.options).onCustomColumnFilterChange) === null || _b === void 0 ? void 0 : _b.call(_a, safeUpdater);
41
33
  };
42
- // === PENDING FILTER METHODS (Draft state) ===
43
34
  table.addPendingColumnFilter = (columnId, operator, value) => {
44
35
  table.setCustomColumnFilter((old) => {
45
36
  const newFilter = {
@@ -48,57 +39,35 @@ export const CustomColumnFilterFeature = {
48
39
  operator,
49
40
  value,
50
41
  };
51
- return {
52
- ...old,
53
- pendingFilters: [...old.pendingFilters, newFilter],
54
- };
42
+ return Object.assign(Object.assign({}, old), { pendingFilters: [...old.pendingFilters, newFilter] });
55
43
  });
56
44
  };
57
45
  table.updatePendingColumnFilter = (filterId, updates) => {
58
46
  table.setCustomColumnFilter((old) => {
59
- const updatedFilters = old.pendingFilters.map((filter) => filter.id === filterId ? { ...filter, ...updates } : filter);
60
- return {
61
- ...old,
62
- pendingFilters: updatedFilters,
63
- };
47
+ const updatedFilters = old.pendingFilters.map((filter) => filter.id === filterId ? Object.assign(Object.assign({}, filter), updates) : filter);
48
+ return Object.assign(Object.assign({}, old), { pendingFilters: updatedFilters });
64
49
  });
65
50
  };
66
51
  table.removePendingColumnFilter = (filterId) => {
67
- table.setCustomColumnFilter((old) => ({
68
- ...old,
69
- pendingFilters: old.pendingFilters.filter((filter) => filter.id !== filterId),
70
- }));
52
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { pendingFilters: old.pendingFilters.filter((filter) => filter.id !== filterId) })));
71
53
  };
72
54
  table.clearAllPendingColumnFilters = () => {
73
- table.setCustomColumnFilter((old) => ({
74
- ...old,
75
- pendingFilters: [],
76
- }));
55
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { pendingFilters: [] })));
77
56
  };
78
57
  table.setPendingFilterLogic = (logic) => {
79
- table.setCustomColumnFilter((old) => ({
80
- ...old,
81
- pendingLogic: logic,
82
- }));
58
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { pendingLogic: logic })));
83
59
  };
84
- // === APPLY PENDING FILTERS ===
85
60
  table.applyPendingColumnFilters = () => {
86
61
  table.setCustomColumnFilter((old) => {
87
- const newState = {
88
- ...old,
89
- filters: [...old.pendingFilters],
90
- logic: old.pendingLogic,
91
- };
92
- // Call the apply callback after state update
62
+ const newState = Object.assign(Object.assign({}, old), { filters: [...old.pendingFilters], logic: old.pendingLogic });
93
63
  setTimeout(() => {
94
- table.options.onCustomColumnFilterApply?.(newState);
64
+ var _a, _b;
65
+ (_b = (_a = table.options).onCustomColumnFilterApply) === null || _b === void 0 ? void 0 : _b.call(_a, newState);
95
66
  }, 0);
96
67
  return newState;
97
68
  });
98
69
  };
99
- // === LEGACY METHODS (for backward compatibility) ===
100
70
  table.addColumnFilter = (columnId, operator, value) => {
101
- // For backward compatibility, add directly to active filters
102
71
  table.setCustomColumnFilter((old) => {
103
72
  const newFilter = {
104
73
  id: `filter_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
@@ -106,40 +75,24 @@ export const CustomColumnFilterFeature = {
106
75
  operator,
107
76
  value,
108
77
  };
109
- return {
110
- ...old,
111
- filters: [...old.filters, newFilter],
112
- };
78
+ return Object.assign(Object.assign({}, old), { filters: [...old.filters, newFilter] });
113
79
  });
114
80
  };
115
81
  table.updateColumnFilter = (filterId, updates) => {
116
82
  table.setCustomColumnFilter((old) => {
117
- const updatedFilters = old.filters.map((filter) => filter.id === filterId ? { ...filter, ...updates } : filter);
118
- return {
119
- ...old,
120
- filters: updatedFilters,
121
- };
83
+ const updatedFilters = old.filters.map((filter) => filter.id === filterId ? Object.assign(Object.assign({}, filter), updates) : filter);
84
+ return Object.assign(Object.assign({}, old), { filters: updatedFilters });
122
85
  });
123
86
  };
124
87
  table.removeColumnFilter = (filterId) => {
125
- table.setCustomColumnFilter((old) => ({
126
- ...old,
127
- filters: old.filters.filter((filter) => filter.id !== filterId),
128
- }));
88
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { filters: old.filters.filter((filter) => filter.id !== filterId) })));
129
89
  };
130
90
  table.clearAllColumnFilters = () => {
131
- table.setCustomColumnFilter((old) => ({
132
- ...old,
133
- filters: [],
134
- }));
91
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { filters: [] })));
135
92
  };
136
93
  table.setFilterLogic = (logic) => {
137
- table.setCustomColumnFilter((old) => ({
138
- ...old,
139
- logic,
140
- }));
94
+ table.setCustomColumnFilter((old) => (Object.assign(Object.assign({}, old), { logic })));
141
95
  };
142
- // === GETTERS ===
143
96
  table.getActiveColumnFilters = () => {
144
97
  const state = table.getState().customColumnFilter;
145
98
  return state.filters.filter((f) => f.columnId && f.operator);
@@ -153,25 +106,20 @@ export const CustomColumnFilterFeature = {
153
106
  };
154
107
  },
155
108
  };
156
- /**
157
- * Utility function to check if a row matches the custom column filters
158
- * This can be used for client-side filtering
159
- */
160
- export function matchesCustomColumnFilters(row, filters, logic = 'AND') {
109
+ function matchesCustomColumnFilters(row, filters, logic = 'AND') {
161
110
  if (filters.length === 0)
162
111
  return true;
163
112
  const activeFilters = filters.filter((f) => f.columnId && f.operator);
164
113
  if (activeFilters.length === 0)
165
114
  return true;
166
115
  const results = activeFilters.map((filter) => {
116
+ var _a;
167
117
  let columnValue;
168
118
  let columnType = filter.columnType || 'text';
169
119
  try {
170
- // Try to get the value safely to avoid infinite loops
171
120
  const column = row.getAllCells().find((cell) => cell.column.id === filter.columnId);
172
121
  if (column) {
173
122
  columnValue = column.getValue();
174
- // Try to get type from columnDef if not set
175
123
  if (!filter.columnType && column.column.columnDef && column.column.columnDef.type) {
176
124
  columnType = column.column.columnDef.type;
177
125
  }
@@ -179,30 +127,30 @@ export function matchesCustomColumnFilters(row, filters, logic = 'AND') {
179
127
  }
180
128
  catch (error) {
181
129
  console.warn(`Error getting value for column ${filter.columnId}:`, error);
182
- columnValue = row.original?.[filter.columnId] || '';
130
+ columnValue = ((_a = row.original) === null || _a === void 0 ? void 0 : _a[filter.columnId]) || '';
183
131
  }
184
132
  return evaluateFilterCondition(columnValue, filter.operator, filter.value, columnType);
185
133
  });
186
134
  return logic === 'AND' ? results.every(Boolean) : results.some(Boolean);
187
135
  }
188
- export const getCombinedFilteredRowModel = () => {
136
+ const getCombinedFilteredRowModel = () => {
189
137
  return (table) => () => {
190
- // Run the built-in global + column filters first:
191
- const baseFilteredModel = getDefaultFilter()(table)();
192
- const { filters, logic } = table.getState().customColumnFilter ?? {
138
+ var _a;
139
+ const baseFilteredModel = (0, react_table_1.getFilteredRowModel)()(table)();
140
+ const { filters, logic } = (_a = table.getState().customColumnFilter) !== null && _a !== void 0 ? _a : {
193
141
  filters: [],
194
142
  logic: 'AND',
195
143
  };
196
144
  if (!filters.length)
197
145
  return baseFilteredModel;
198
- // Apply custom column filters to pre-filtered rows
199
146
  const filteredRows = baseFilteredModel.rows.filter(row => matchesCustomColumnFilters(row, filters, logic));
200
147
  const flatRows = [];
201
148
  const rowsById = {};
202
149
  const addRow = (row) => {
150
+ var _a;
203
151
  flatRows.push(row);
204
152
  rowsById[row.id] = row;
205
- row.subRows?.forEach(addRow);
153
+ (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach(addRow);
206
154
  };
207
155
  filteredRows.forEach(addRow);
208
156
  return {
@@ -212,18 +160,14 @@ export const getCombinedFilteredRowModel = () => {
212
160
  };
213
161
  };
214
162
  };
215
- /**
216
- * Evaluate a single filter condition
217
- */
163
+ exports.getCombinedFilteredRowModel = getCombinedFilteredRowModel;
218
164
  function evaluateFilterCondition(columnValue, operator, filterValue, type = 'text') {
219
- // --- Date helpers using moment ---
220
165
  function toMoment(val) {
221
166
  if (!val)
222
167
  return null;
223
- const m = moment(val);
168
+ const m = (0, moment_1.default)(val);
224
169
  return m.isValid() ? m : null;
225
170
  }
226
- // --- Date type logic ---
227
171
  if (type === 'date') {
228
172
  const mCol = toMoment(columnValue);
229
173
  const mFilter = toMoment(filterValue);
@@ -246,7 +190,6 @@ function evaluateFilterCondition(columnValue, operator, filterValue, type = 'tex
246
190
  return true;
247
191
  }
248
192
  }
249
- // --- Boolean type logic ---
250
193
  if (type === 'boolean') {
251
194
  switch (operator) {
252
195
  case 'is':
@@ -261,7 +204,6 @@ function evaluateFilterCondition(columnValue, operator, filterValue, type = 'tex
261
204
  return true;
262
205
  }
263
206
  }
264
- // --- Select type logic (in, notIn, single select) ---
265
207
  if (type === 'select') {
266
208
  if (operator === 'in' || operator === 'notIn') {
267
209
  if (Array.isArray(filterValue)) {
@@ -278,7 +220,6 @@ function evaluateFilterCondition(columnValue, operator, filterValue, type = 'tex
278
220
  : columnValue !== filterValue;
279
221
  }
280
222
  }
281
- // --- Text/Number type logic ---
282
223
  switch (operator) {
283
224
  case 'contains':
284
225
  return String(columnValue).toLowerCase().includes(String(filterValue).toLowerCase());
@@ -0,0 +1,46 @@
1
+ import { TableFeature, RowData, Updater, Row } from '@tanstack/react-table';
2
+ export interface SelectionState {
3
+ ids: string[];
4
+ type: 'include' | 'exclude';
5
+ selectMode?: 'page' | 'all';
6
+ }
7
+ export type IsRowSelectableFunction<T = any> = (params: {
8
+ row: T;
9
+ id: string;
10
+ }) => boolean;
11
+ export type SelectMode = 'page' | 'all';
12
+ export interface CustomSelectionOptions {
13
+ enableCustomSelection?: boolean;
14
+ selectMode?: SelectMode;
15
+ isRowSelectable?: IsRowSelectableFunction;
16
+ onSelectionStateChange?: (updater: Updater<SelectionState>) => void;
17
+ }
18
+ export interface CustomSelectionTableState {
19
+ selectionState: SelectionState;
20
+ }
21
+ declare module '@tanstack/table-core' {
22
+ interface TableState extends CustomSelectionTableState {
23
+ }
24
+ interface TableOptionsResolved<TData extends RowData> extends CustomSelectionOptions {
25
+ }
26
+ interface Table<TData extends RowData> extends CustomSelectionInstance<TData> {
27
+ }
28
+ }
29
+ export interface CustomSelectionInstance<TData extends RowData> {
30
+ setSelectionState: (updater: Updater<SelectionState>) => void;
31
+ toggleAllRowsSelected: () => void;
32
+ toggleRowSelected: (rowId: string) => void;
33
+ selectRow: (rowId: string) => void;
34
+ deselectRow: (rowId: string) => void;
35
+ selectAll: () => void;
36
+ deselectAll: () => void;
37
+ getIsAllRowsSelected: () => boolean;
38
+ getIsSomeRowsSelected: () => boolean;
39
+ getIsRowSelected: (rowId: string) => boolean;
40
+ getSelectionState: () => SelectionState;
41
+ getSelectedCount: () => number;
42
+ getSelectedRows: () => Row<TData>[];
43
+ getSelectedRowIds: () => string[];
44
+ canSelectRow: (rowId: string) => boolean;
45
+ }
46
+ export declare const CustomSelectionFeature: TableFeature<any>;
@@ -1,78 +1,52 @@
1
- /**
2
- * Custom Selection Feature for TanStack Table
3
- *
4
- * This feature adds custom selection capabilities to TanStack Table
5
- * following the official custom features pattern (same as CustomColumnFilterFeature)
6
- */
7
- import { functionalUpdate, makeStateUpdater, } from '@tanstack/react-table';
8
- // The custom selection feature implementation (same pattern as CustomColumnFilterFeature)
9
- export const CustomSelectionFeature = {
10
- // Define the feature's initial state
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomSelectionFeature = void 0;
4
+ const react_table_1 = require("@tanstack/react-table");
5
+ exports.CustomSelectionFeature = {
11
6
  getInitialState: (state) => {
12
- return {
13
- selectionState: {
7
+ return Object.assign({ selectionState: {
14
8
  ids: [],
15
9
  type: 'include',
16
10
  selectMode: 'page',
17
- },
18
- ...state,
19
- };
11
+ } }, state);
20
12
  },
21
- // Define the feature's default options
22
13
  getDefaultOptions: (table) => {
23
14
  return {
24
15
  enableCustomSelection: true,
25
16
  selectMode: 'page',
26
- onSelectionStateChange: makeStateUpdater('selectionState', table),
17
+ onSelectionStateChange: (0, react_table_1.makeStateUpdater)('selectionState', table),
27
18
  };
28
19
  },
29
- // Define the feature's table instance methods
30
20
  createTable: (table) => {
31
21
  table.setSelectionState = (updater) => {
22
+ var _a, _b;
32
23
  const safeUpdater = (old) => {
33
- const newState = functionalUpdate(updater, old);
24
+ const newState = (0, react_table_1.functionalUpdate)(updater, old);
34
25
  return newState;
35
26
  };
36
- return table.options.onSelectionStateChange?.(safeUpdater);
27
+ return (_b = (_a = table.options).onSelectionStateChange) === null || _b === void 0 ? void 0 : _b.call(_a, safeUpdater);
37
28
  };
38
- // === BASIC SELECTION METHODS ===
39
29
  table.selectRow = (rowId) => {
40
30
  if (!table.canSelectRow(rowId))
41
31
  return;
42
32
  table.setSelectionState((old) => {
43
33
  if (old.type === 'exclude') {
44
- // In exclude mode, selecting means removing from exclude list
45
- return {
46
- ...old,
47
- ids: old.ids.filter(id => id !== rowId),
48
- };
34
+ return Object.assign(Object.assign({}, old), { ids: old.ids.filter(id => id !== rowId) });
49
35
  }
50
36
  else {
51
- // In include mode, selecting means adding to include list
52
37
  const newIds = old.ids.includes(rowId) ? old.ids : [...old.ids, rowId];
53
- return {
54
- ...old,
55
- ids: newIds,
56
- };
38
+ return Object.assign(Object.assign({}, old), { ids: newIds });
57
39
  }
58
40
  });
59
41
  };
60
42
  table.deselectRow = (rowId) => {
61
43
  table.setSelectionState((old) => {
62
44
  if (old.type === 'exclude') {
63
- // In exclude mode, deselecting means adding to exclude list
64
45
  const newIds = old.ids.includes(rowId) ? old.ids : [...old.ids, rowId];
65
- return {
66
- ...old,
67
- ids: newIds,
68
- };
46
+ return Object.assign(Object.assign({}, old), { ids: newIds });
69
47
  }
70
48
  else {
71
- // In include mode, deselecting means removing from include list
72
- return {
73
- ...old,
74
- ids: old.ids.filter(id => id !== rowId),
75
- };
49
+ return Object.assign(Object.assign({}, old), { ids: old.ids.filter(id => id !== rowId) });
76
50
  }
77
51
  });
78
52
  };
@@ -87,32 +61,18 @@ export const CustomSelectionFeature = {
87
61
  table.selectAll = () => {
88
62
  const selectMode = table.options.selectMode || 'page';
89
63
  if (selectMode === 'all') {
90
- // In 'all' mode, use exclude type with empty list (select all)
91
- table.setSelectionState((old) => ({
92
- ...old,
93
- ids: [],
94
- type: 'exclude',
95
- }));
64
+ table.setSelectionState((old) => (Object.assign(Object.assign({}, old), { ids: [], type: 'exclude' })));
96
65
  }
97
66
  else {
98
- // In 'page' mode, select current page rows
99
67
  const currentPageRows = table.getPaginationRowModel().rows;
100
68
  const selectableRowIds = currentPageRows
101
69
  .filter(row => table.canSelectRow(row.id))
102
70
  .map(row => row.id);
103
- table.setSelectionState((old) => ({
104
- ...old,
105
- ids: selectableRowIds,
106
- type: 'include',
107
- }));
71
+ table.setSelectionState((old) => (Object.assign(Object.assign({}, old), { ids: selectableRowIds, type: 'include' })));
108
72
  }
109
73
  };
110
74
  table.deselectAll = () => {
111
- table.setSelectionState((old) => ({
112
- ...old,
113
- ids: [],
114
- type: 'include',
115
- }));
75
+ table.setSelectionState((old) => (Object.assign(Object.assign({}, old), { ids: [], type: 'include' })));
116
76
  };
117
77
  table.toggleAllRowsSelected = () => {
118
78
  if (table.getIsAllRowsSelected()) {
@@ -122,15 +82,12 @@ export const CustomSelectionFeature = {
122
82
  table.selectAll();
123
83
  }
124
84
  };
125
- // === STATE CHECKERS ===
126
85
  table.getIsRowSelected = (rowId) => {
127
86
  const state = table.getSelectionState();
128
87
  if (state.type === 'exclude') {
129
- // In exclude mode, selected if NOT in exclude list
130
88
  return !state.ids.includes(rowId);
131
89
  }
132
90
  else {
133
- // In include mode, selected if in include list
134
91
  return state.ids.includes(rowId);
135
92
  }
136
93
  };
@@ -147,7 +104,6 @@ export const CustomSelectionFeature = {
147
104
  }
148
105
  }
149
106
  else {
150
- // Page mode - check if all selectable rows on current page are selected
151
107
  const currentPageRows = table.getPaginationRowModel().rows;
152
108
  const selectableRows = currentPageRows.filter(row => table.canSelectRow(row.id));
153
109
  if (selectableRows.length === 0)
@@ -159,16 +115,13 @@ export const CustomSelectionFeature = {
159
115
  const state = table.getSelectionState();
160
116
  const selectMode = table.options.selectMode || 'page';
161
117
  if (selectMode === 'all' && state.type === 'exclude') {
162
- // In exclude mode, we have some selected if not all are excluded
163
118
  const totalCount = table.getRowCount();
164
119
  return state.ids.length < totalCount;
165
120
  }
166
121
  else {
167
- // In include mode, we have some selected if list has items
168
122
  return state.ids.length > 0;
169
123
  }
170
124
  };
171
- // === GETTERS ===
172
125
  table.getSelectionState = () => {
173
126
  return table.getState().selectionState || {
174
127
  ids: [],
@@ -190,8 +143,6 @@ export const CustomSelectionFeature = {
190
143
  table.getSelectedRowIds = () => {
191
144
  const state = table.getSelectionState();
192
145
  if (state.type === 'exclude') {
193
- // In exclude mode, return all row IDs minus excluded ones
194
- // Note: This is simplified - for full functionality, you'd need all possible row IDs
195
146
  console.warn('getSelectedRowIds() in exclude mode returns exclude list. Use getSelectionState() instead.');
196
147
  return state.ids;
197
148
  }
@@ -203,15 +154,12 @@ export const CustomSelectionFeature = {
203
154
  const state = table.getSelectionState();
204
155
  const allRows = table.getRowModel().rows;
205
156
  if (state.type === 'exclude') {
206
- // Return all rows except excluded ones
207
157
  return allRows.filter(row => !state.ids.includes(row.id));
208
158
  }
209
159
  else {
210
- // Return only included rows
211
160
  return allRows.filter(row => state.ids.includes(row.id));
212
161
  }
213
162
  };
214
- // === HELPER METHODS ===
215
163
  table.canSelectRow = (rowId) => {
216
164
  if (!table.options.isRowSelectable)
217
165
  return true;
@@ -0,0 +1,2 @@
1
+ export { CustomColumnFilterFeature, matchesCustomColumnFilters, type ColumnFilterRule, type CustomColumnFilterOptions, type CustomColumnFilterTableState, type CustomColumnFilterInstance, } from './custom-column-filter.feature';
2
+ export { CustomSelectionFeature, type SelectionState, type SelectMode, type CustomSelectionOptions, type CustomSelectionTableState, type CustomSelectionInstance, } from './custom-selection.feature';