@ackplus/react-tanstack-data-table 1.0.19-beta-0.10 → 1.0.19-beta-0.13

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 (30) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/lib/components/table/data-table.d.ts +2 -1
  4. package/src/lib/components/table/data-table.js +128 -125
  5. package/src/lib/components/table/data-table.types.d.ts +9 -9
  6. package/src/lib/components/toolbar/bulk-actions-toolbar.d.ts +1 -1
  7. package/src/lib/components/toolbar/column-filter-control.d.ts +1 -0
  8. package/src/lib/components/toolbar/{column-custom-filter-control.js → column-filter-control.js} +22 -20
  9. package/src/lib/components/toolbar/data-table-toolbar.js +2 -2
  10. package/src/lib/components/toolbar/index.d.ts +1 -0
  11. package/src/lib/components/toolbar/index.js +3 -1
  12. package/src/lib/components/toolbar/table-export-control.d.ts +4 -4
  13. package/src/lib/contexts/data-table-context.d.ts +8 -8
  14. package/src/lib/contexts/data-table-context.js +5 -5
  15. package/src/lib/examples/server-side-fetching-example.js +12 -3
  16. package/src/lib/features/{custom-column-filter.feature.d.ts → column-filter.feature.d.ts} +14 -14
  17. package/src/lib/features/{custom-column-filter.feature.js → column-filter.feature.js} +51 -26
  18. package/src/lib/features/index.d.ts +2 -2
  19. package/src/lib/features/index.js +6 -6
  20. package/src/lib/features/{custom-selection.feature.d.ts → selection.feature.d.ts} +8 -8
  21. package/src/lib/features/{custom-selection.feature.js → selection.feature.js} +20 -8
  22. package/src/lib/hooks/use-data-table-api.d.ts +7 -19
  23. package/src/lib/hooks/use-data-table-api.js +84 -104
  24. package/src/lib/types/data-table-api.d.ts +4 -4
  25. package/src/lib/types/table.types.d.ts +4 -4
  26. package/src/lib/utils/column-helpers.d.ts +1 -2
  27. package/src/lib/utils/column-helpers.js +3 -2
  28. package/src/lib/utils/export-utils.d.ts +4 -4
  29. package/src/lib/utils/export-utils.js +32 -15
  30. package/src/lib/components/toolbar/column-custom-filter-control.d.ts +0 -1
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CustomSelectionFeature = void 0;
3
+ exports.SelectionFeature = void 0;
4
4
  const react_table_1 = require("@tanstack/react-table");
5
- exports.CustomSelectionFeature = {
5
+ exports.SelectionFeature = {
6
6
  getInitialState: (state) => {
7
7
  return Object.assign({ selectionState: {
8
8
  ids: [],
@@ -12,7 +12,7 @@ exports.CustomSelectionFeature = {
12
12
  },
13
13
  getDefaultOptions: (table) => {
14
14
  return {
15
- enableCustomSelection: true,
15
+ enableAdvanceSelection: true,
16
16
  selectMode: 'page',
17
17
  onSelectionStateChange: (0, react_table_1.makeStateUpdater)('selectionState', table),
18
18
  };
@@ -20,6 +20,8 @@ exports.CustomSelectionFeature = {
20
20
  createTable: (table) => {
21
21
  table.setSelectionState = (updater) => {
22
22
  var _a, _b;
23
+ if (!table.options.enableAdvanceSelection)
24
+ return;
23
25
  const safeUpdater = (old) => {
24
26
  const newState = (0, react_table_1.functionalUpdate)(updater, old);
25
27
  return newState;
@@ -27,6 +29,8 @@ exports.CustomSelectionFeature = {
27
29
  return (_b = (_a = table.options).onSelectionStateChange) === null || _b === void 0 ? void 0 : _b.call(_a, safeUpdater);
28
30
  };
29
31
  table.selectRow = (rowId) => {
32
+ if (!table.options.enableAdvanceSelection)
33
+ return;
30
34
  if (!table.canSelectRow(rowId))
31
35
  return;
32
36
  table.setSelectionState((old) => {
@@ -40,6 +44,8 @@ exports.CustomSelectionFeature = {
40
44
  });
41
45
  };
42
46
  table.deselectRow = (rowId) => {
47
+ if (!table.options.enableAdvanceSelection)
48
+ return;
43
49
  table.setSelectionState((old) => {
44
50
  if (old.type === 'exclude') {
45
51
  const newIds = old.ids.includes(rowId) ? old.ids : [...old.ids, rowId];
@@ -51,6 +57,8 @@ exports.CustomSelectionFeature = {
51
57
  });
52
58
  };
53
59
  table.toggleRowSelected = (rowId) => {
60
+ if (!table.options.enableAdvanceSelection)
61
+ return;
54
62
  if (table.getIsRowSelected(rowId)) {
55
63
  table.deselectRow(rowId);
56
64
  }
@@ -59,6 +67,8 @@ exports.CustomSelectionFeature = {
59
67
  }
60
68
  };
61
69
  table.selectAll = () => {
70
+ if (!table.options.enableAdvanceSelection)
71
+ return;
62
72
  const selectMode = table.options.selectMode || 'page';
63
73
  if (selectMode === 'all') {
64
74
  table.setSelectionState((old) => (Object.assign(Object.assign({}, old), { ids: [], type: 'exclude' })));
@@ -72,9 +82,13 @@ exports.CustomSelectionFeature = {
72
82
  }
73
83
  };
74
84
  table.deselectAll = () => {
85
+ if (!table.options.enableAdvanceSelection)
86
+ return;
75
87
  table.setSelectionState((old) => (Object.assign(Object.assign({}, old), { ids: [], type: 'include' })));
76
88
  };
77
89
  table.toggleAllRowsSelected = () => {
90
+ if (!table.options.enableAdvanceSelection)
91
+ return;
78
92
  if (table.getIsAllRowsSelected()) {
79
93
  table.deselectAll();
80
94
  }
@@ -143,12 +157,10 @@ exports.CustomSelectionFeature = {
143
157
  table.getSelectedRowIds = () => {
144
158
  const state = table.getSelectionState();
145
159
  if (state.type === 'exclude') {
146
- console.warn('getSelectedRowIds() in exclude mode returns exclude list. Use getSelectionState() instead.');
147
- return state.ids;
148
- }
149
- else {
150
- return state.ids;
160
+ console.warn('[SelectionFeature] getSelectedRowIds() is not accurate in exclude mode. Use getSelectionState() to interpret selection properly.');
161
+ return [];
151
162
  }
163
+ return state.ids;
152
164
  };
153
165
  table.getSelectedRows = () => {
154
166
  const state = table.getSelectionState();
@@ -1,38 +1,26 @@
1
- import { ColumnOrderState, ColumnPinningState, SortingState, Table } from '@tanstack/react-table';
1
+ import { Table } from '@tanstack/react-table';
2
2
  import { Ref } from 'react';
3
- import { CustomColumnFilterState, TableFilters, TableState } from '../types';
3
+ import { ColumnFilterState, TableFilters, TableState } from '../types';
4
4
  import { DataTableApi } from '../types/data-table-api';
5
5
  import { SelectionState } from '../features';
6
6
  interface UseDataTableApiProps<T> {
7
7
  table: Table<T>;
8
- data: T[];
9
8
  idKey: keyof T;
10
- globalFilter: string;
11
- customColumnsFilter: CustomColumnFilterState;
12
- sorting: SortingState;
13
- pagination: {
14
- pageIndex: number;
15
- pageSize: number;
16
- };
17
- columnOrder: ColumnOrderState;
18
- columnPinning: ColumnPinningState;
19
9
  enhancedColumns: any[];
20
10
  enablePagination: boolean;
21
11
  enableColumnPinning: boolean;
22
- initialPageIndex: number;
23
- initialPageSize?: number;
24
- pageSize: number;
12
+ initialStateConfig: Partial<TableState>;
25
13
  selectMode?: 'page' | 'all';
26
14
  onSelectionChange?: (state: SelectionState) => void;
27
- handleColumnFilterStateChange: (filterState: CustomColumnFilterState) => void;
15
+ handleColumnFilterStateChange: (filterState: ColumnFilterState) => void;
28
16
  onDataStateChange?: (state: Partial<TableState>) => void;
29
17
  onFetchData?: (filters: Partial<TableFilters>) => void;
30
18
  onDataChange?: (newData: T[]) => void;
31
19
  exportFilename?: string;
32
20
  onExportProgress?: (progress: {
33
- processedRows: number;
34
- totalRows: number;
35
- percentage: number;
21
+ processedRows?: number;
22
+ totalRows?: number;
23
+ percentage?: number;
36
24
  }) => void;
37
25
  onExportComplete?: (result: {
38
26
  success: boolean;
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = require("react");
6
6
  const export_utils_1 = require("../utils/export-utils");
7
7
  function useDataTableApi(props, ref) {
8
- const { table, data, idKey, globalFilter, customColumnsFilter, sorting, pagination, columnOrder, columnPinning, enhancedColumns, enablePagination, enableColumnPinning, initialPageIndex, initialPageSize, pageSize, selectMode = 'page', onSelectionChange, handleColumnFilterStateChange, onDataStateChange, onFetchData, onDataChange, exportFilename = 'export', onExportProgress, onExportComplete, onExportError, onServerExport, exportController, setExportController, isExporting, dataMode = 'client', } = props;
8
+ const { table, idKey, enhancedColumns, enablePagination, enableColumnPinning, initialStateConfig, selectMode = 'page', onSelectionChange, handleColumnFilterStateChange, onDataStateChange, onFetchData, onDataChange, exportFilename = 'export', onExportProgress, onExportComplete, onExportError, onServerExport, exportController, setExportController, isExporting, dataMode = 'client', } = props;
9
9
  (0, react_1.useImperativeHandle)(ref, () => ({
10
10
  table: {
11
11
  getTable: () => table,
@@ -113,7 +113,7 @@ function useDataTableApi(props, ref) {
113
113
  clearGlobalFilter: () => {
114
114
  table.setGlobalFilter('');
115
115
  },
116
- setCustomColumnFilters: (filters) => {
116
+ setColumnFilters: (filters) => {
117
117
  handleColumnFilterStateChange(filters);
118
118
  },
119
119
  addColumnFilter: (columnId, operator, value) => {
@@ -123,23 +123,25 @@ function useDataTableApi(props, ref) {
123
123
  operator,
124
124
  value,
125
125
  };
126
- const currentFilters = customColumnsFilter.filters || [];
126
+ const columnFilter = table.getState().columnFilter;
127
+ const currentFilters = columnFilter.filters || [];
127
128
  const newFilters = [...currentFilters, newFilter];
128
129
  handleColumnFilterStateChange({
129
130
  filters: newFilters,
130
- logic: customColumnsFilter.logic,
131
- pendingFilters: customColumnsFilter.pendingFilters || [],
132
- pendingLogic: customColumnsFilter.pendingLogic || 'AND',
131
+ logic: columnFilter.logic,
132
+ pendingFilters: columnFilter.pendingFilters || [],
133
+ pendingLogic: columnFilter.pendingLogic || 'AND',
133
134
  });
134
135
  },
135
136
  removeColumnFilter: (filterId) => {
136
- const currentFilters = customColumnsFilter.filters || [];
137
+ const columnFilter = table.getState().columnFilter;
138
+ const currentFilters = columnFilter.filters || [];
137
139
  const newFilters = currentFilters.filter((f) => f.id !== filterId);
138
140
  handleColumnFilterStateChange({
139
141
  filters: newFilters,
140
- logic: customColumnsFilter.logic,
141
- pendingFilters: customColumnsFilter.pendingFilters || [],
142
- pendingLogic: customColumnsFilter.pendingLogic || 'AND',
142
+ logic: columnFilter.logic,
143
+ pendingFilters: columnFilter.pendingFilters || [],
144
+ pendingLogic: columnFilter.pendingLogic || 'AND',
143
145
  });
144
146
  },
145
147
  clearAllFilters: () => {
@@ -220,98 +222,95 @@ function useDataTableApi(props, ref) {
220
222
  },
221
223
  data: {
222
224
  refresh: () => {
223
- const currentFilters = {
224
- globalFilter,
225
- customColumnsFilter: customColumnsFilter,
226
- sorting,
227
- pagination,
228
- };
225
+ const pagination = table.getState().pagination;
229
226
  if (onDataStateChange) {
230
- const currentState = Object.assign(Object.assign({}, currentFilters), { columnOrder,
231
- columnPinning });
232
- onDataStateChange(currentState);
227
+ onDataStateChange({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
233
228
  }
234
229
  if (onFetchData) {
235
- onFetchData(currentFilters);
230
+ onFetchData({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
236
231
  }
237
232
  },
238
233
  reload: () => {
239
- const currentFilters = {
240
- globalFilter,
241
- customColumnsFilter: customColumnsFilter,
242
- sorting,
243
- pagination,
244
- };
234
+ const pagination = table.getState().pagination;
245
235
  if (onDataStateChange) {
246
- const currentState = Object.assign(Object.assign({}, currentFilters), { columnOrder,
247
- columnPinning });
248
- onDataStateChange(Object.assign({}, currentState));
236
+ onDataStateChange({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
249
237
  }
250
238
  if (onFetchData) {
251
- onFetchData(Object.assign({}, currentFilters));
239
+ onFetchData({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
252
240
  }
253
241
  },
254
242
  getAllData: () => {
255
- return [...data];
243
+ var _a;
244
+ return ((_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a.map(row => row.original)) || [];
256
245
  },
257
246
  getRowData: (rowId) => {
258
- return data.find(row => String(row[idKey]) === rowId);
247
+ var _a, _b;
248
+ return (_b = (_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a.find(row => String(row.original[idKey]) === rowId)) === null || _b === void 0 ? void 0 : _b.original;
259
249
  },
260
250
  getRowByIndex: (index) => {
261
- return data[index];
251
+ var _a, _b;
252
+ return (_b = (_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.original;
262
253
  },
263
254
  updateRow: (rowId, updates) => {
264
- const newData = data.map(row => String(row[idKey]) === rowId
265
- ? Object.assign(Object.assign({}, row), updates) : row);
266
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
255
+ var _a;
256
+ const newData = (_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a.map(row => String(row.original[idKey]) === rowId
257
+ ? Object.assign(Object.assign({}, row.original), updates) : row.original);
258
+ onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData || []);
267
259
  },
268
260
  updateRowByIndex: (index, updates) => {
269
- const newData = [...data];
270
- if (newData[index]) {
261
+ var _a;
262
+ const newData = (_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a.map(row => row.original);
263
+ if (newData === null || newData === void 0 ? void 0 : newData[index]) {
271
264
  newData[index] = Object.assign(Object.assign({}, newData[index]), updates);
272
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
265
+ onDataChange(newData);
273
266
  }
274
267
  },
275
268
  insertRow: (newRow, index) => {
276
- const newData = [...data];
269
+ var _a;
270
+ const newData = ((_a = table.getRowModel().rows) === null || _a === void 0 ? void 0 : _a.map(row => row.original)) || [];
277
271
  if (index !== undefined) {
278
272
  newData.splice(index, 0, newRow);
279
273
  }
280
274
  else {
281
275
  newData.push(newRow);
282
276
  }
283
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
277
+ onDataChange(newData || []);
284
278
  },
285
279
  deleteRow: (rowId) => {
286
- const newData = data.filter(row => String(row[idKey]) !== rowId);
287
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
280
+ var _a;
281
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.filter(row => String(row.original[idKey]) !== rowId);
282
+ onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange((newData === null || newData === void 0 ? void 0 : newData.map(row => row.original)) || []);
288
283
  },
289
284
  deleteRowByIndex: (index) => {
290
- const newData = [...data];
285
+ var _a;
286
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.map(row => row.original);
291
287
  newData.splice(index, 1);
292
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
288
+ onDataChange(newData);
293
289
  },
294
290
  deleteSelectedRows: () => {
291
+ var _a;
295
292
  const selectedRowIds = Object.keys(table.getState().rowSelection)
296
293
  .filter(key => table.getState().rowSelection[key]);
297
- const newData = data.filter(row => !selectedRowIds.includes(String(row[idKey])));
298
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
294
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.filter(row => !selectedRowIds.includes(String(row.original[idKey])));
295
+ onDataChange((newData === null || newData === void 0 ? void 0 : newData.map(row => row.original)) || []);
299
296
  table.resetRowSelection();
300
297
  },
301
298
  replaceAllData: (newData) => {
302
299
  onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
303
300
  },
304
301
  updateMultipleRows: (updates) => {
302
+ var _a;
305
303
  const updateMap = new Map(updates.map(u => [u.rowId, u.data]));
306
- const newData = data.map(row => {
307
- const rowId = String(row[idKey]);
304
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.map(row => {
305
+ const rowId = String(row.original[idKey]);
308
306
  const updateData = updateMap.get(rowId);
309
- return updateData ? Object.assign(Object.assign({}, row), updateData) : row;
307
+ return updateData ? Object.assign(Object.assign({}, row.original), updateData) : row.original;
310
308
  });
311
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
309
+ onDataChange(newData || []);
312
310
  },
313
311
  insertMultipleRows: (newRows, startIndex) => {
314
- const newData = [...data];
312
+ var _a;
313
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.map(row => row.original);
315
314
  if (startIndex !== undefined) {
316
315
  newData.splice(startIndex, 0, ...newRows);
317
316
  }
@@ -321,30 +320,36 @@ function useDataTableApi(props, ref) {
321
320
  onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
322
321
  },
323
322
  deleteMultipleRows: (rowIds) => {
323
+ var _a, _b;
324
324
  const idsToDelete = new Set(rowIds);
325
- const newData = data.filter(row => !idsToDelete.has(String(row[idKey])));
326
- onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
325
+ const newData = (_b = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.filter(row => !idsToDelete.has(String(row.original[idKey])))) === null || _b === void 0 ? void 0 : _b.map(row => row.original);
326
+ onDataChange(newData);
327
327
  },
328
328
  updateField: (rowId, fieldName, value) => {
329
- const newData = data.map(row => String(row[idKey]) === rowId
330
- ? Object.assign(Object.assign({}, row), { [fieldName]: value }) : row);
329
+ var _a;
330
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.map(row => String(row.original[idKey]) === rowId
331
+ ? Object.assign(Object.assign({}, row.original), { [fieldName]: value }) : row.original);
331
332
  onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
332
333
  },
333
334
  updateFieldByIndex: (index, fieldName, value) => {
334
- const newData = [...data];
335
+ var _a;
336
+ const newData = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.map(row => row.original);
335
337
  if (newData[index]) {
336
338
  newData[index] = Object.assign(Object.assign({}, newData[index]), { [fieldName]: value });
337
339
  onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(newData);
338
340
  }
339
341
  },
340
342
  findRows: (predicate) => {
341
- return data.filter(predicate);
343
+ var _a, _b;
344
+ return (_b = (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.filter(row => predicate(row.original))) === null || _b === void 0 ? void 0 : _b.map(row => row.original);
342
345
  },
343
346
  findRowIndex: (predicate) => {
344
- return data.findIndex(predicate);
347
+ var _a;
348
+ return (_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.findIndex(row => predicate(row.original));
345
349
  },
346
350
  getDataCount: () => {
347
- return data.length;
351
+ var _a;
352
+ return ((_a = (table.getRowModel().rows || [])) === null || _a === void 0 ? void 0 : _a.length) || 0;
348
353
  },
349
354
  getFilteredDataCount: () => {
350
355
  return table.getFilteredRowModel().rows.length;
@@ -366,21 +371,12 @@ function useDataTableApi(props, ref) {
366
371
  table.resetExpanded();
367
372
  table.resetRowSelection();
368
373
  table.resetColumnPinning();
369
- handleColumnFilterStateChange({
370
- filters: [],
371
- logic: 'AND',
372
- pendingFilters: [],
373
- pendingLogic: 'AND',
374
- });
374
+ handleColumnFilterStateChange(initialStateConfig.columnFilter || { filters: [], logic: 'AND', pendingFilters: [], pendingLogic: 'AND' });
375
375
  if (enablePagination) {
376
- table.setPageIndex(initialPageIndex);
377
- table.setPageSize(initialPageSize || pageSize);
376
+ table.setPagination(initialStateConfig.pagination || { pageIndex: 0, pageSize: 10 });
378
377
  }
379
378
  if (enableColumnPinning) {
380
- table.setColumnPinning({
381
- left: [],
382
- right: [],
383
- });
379
+ table.setColumnPinning(initialStateConfig.columnPinning || { left: [], right: [] });
384
380
  }
385
381
  },
386
382
  saveLayout: () => {
@@ -392,7 +388,7 @@ function useDataTableApi(props, ref) {
392
388
  sorting: table.getState().sorting,
393
389
  pagination: table.getState().pagination,
394
390
  globalFilter: table.getState().globalFilter,
395
- customColumnsFilter: customColumnsFilter,
391
+ columnFilter: table.getState().columnFilter,
396
392
  };
397
393
  },
398
394
  restoreLayout: (layout) => {
@@ -417,8 +413,8 @@ function useDataTableApi(props, ref) {
417
413
  if (layout.globalFilter !== undefined) {
418
414
  table.setGlobalFilter(layout.globalFilter);
419
415
  }
420
- if (layout.customColumnsFilter) {
421
- handleColumnFilterStateChange(layout.customColumnsFilter);
416
+ if (layout.columnFilter) {
417
+ handleColumnFilterStateChange(layout.columnFilter);
422
418
  }
423
419
  },
424
420
  },
@@ -427,7 +423,7 @@ function useDataTableApi(props, ref) {
427
423
  return table.getState();
428
424
  },
429
425
  getCurrentFilters: () => {
430
- return customColumnsFilter;
426
+ return table.getState().columnFilter;
431
427
  },
432
428
  getCurrentSorting: () => {
433
429
  return table.getState().sorting;
@@ -449,12 +445,10 @@ function useDataTableApi(props, ref) {
449
445
  setExportController === null || setExportController === void 0 ? void 0 : setExportController(controller);
450
446
  if (dataMode === 'server' && onServerExport) {
451
447
  const currentFilters = {
452
- globalFilter,
453
- customColumnsFilter,
454
- sorting,
455
- pagination,
456
- columnOrder,
457
- columnPinning,
448
+ globalFilter: table.getState().globalFilter,
449
+ columnFilter: table.getState().columnFilter,
450
+ sorting: table.getState().sorting,
451
+ pagination: table.getState().pagination,
458
452
  };
459
453
  yield (0, export_utils_1.exportServerData)(table, {
460
454
  format: 'csv',
@@ -495,12 +489,10 @@ function useDataTableApi(props, ref) {
495
489
  setExportController === null || setExportController === void 0 ? void 0 : setExportController(controller);
496
490
  if (dataMode === 'server' && onServerExport) {
497
491
  const currentFilters = {
498
- globalFilter,
499
- customColumnsFilter,
500
- sorting,
501
- pagination,
502
- columnOrder,
503
- columnPinning,
492
+ globalFilter: table.getState().globalFilter,
493
+ columnFilter: table.getState().columnFilter,
494
+ sorting: table.getState().sorting,
495
+ pagination: table.getState().pagination,
504
496
  };
505
497
  yield (0, export_utils_1.exportServerData)(table, {
506
498
  format: 'excel',
@@ -547,12 +539,10 @@ function useDataTableApi(props, ref) {
547
539
  const controller = new AbortController();
548
540
  setExportController === null || setExportController === void 0 ? void 0 : setExportController(controller);
549
541
  const currentFilters = {
550
- globalFilter,
551
- customColumnsFilter,
552
- sorting,
553
- pagination,
554
- columnOrder,
555
- columnPinning,
542
+ globalFilter: table.getState().globalFilter,
543
+ columnFilter: table.getState().columnFilter,
544
+ sorting: table.getState().sorting,
545
+ pagination: table.getState().pagination,
556
546
  };
557
547
  yield (0, export_utils_1.exportServerData)(table, {
558
548
  format,
@@ -585,22 +575,12 @@ function useDataTableApi(props, ref) {
585
575
  table,
586
576
  enhancedColumns,
587
577
  handleColumnFilterStateChange,
588
- customColumnsFilter,
589
- data,
590
578
  idKey,
591
579
  onDataStateChange,
592
580
  onFetchData,
593
- globalFilter,
594
- sorting,
595
- pagination,
596
- columnOrder,
597
- columnPinning,
598
581
  onDataChange,
599
582
  enableColumnPinning,
600
583
  enablePagination,
601
- initialPageIndex,
602
- initialPageSize,
603
- pageSize,
604
584
  exportFilename,
605
585
  onExportProgress,
606
586
  onExportComplete,
@@ -1,6 +1,6 @@
1
1
  import { ColumnPinningState, SortingState, ColumnOrderState, TableState, Row } from '@tanstack/react-table';
2
- import { CustomColumnFilterState } from './table.types';
3
- import { SelectionState } from '../features/custom-selection.feature';
2
+ import { ColumnFilterState } from './table.types';
3
+ import { SelectionState } from '../features';
4
4
  export interface DataTableApi<T = any> {
5
5
  columnVisibility: {
6
6
  showColumn: (columnId: string) => void;
@@ -31,7 +31,7 @@ export interface DataTableApi<T = any> {
31
31
  filtering: {
32
32
  setGlobalFilter: (filter: string) => void;
33
33
  clearGlobalFilter: () => void;
34
- setCustomColumnFilters: (filters: CustomColumnFilterState) => void;
34
+ setColumnFilters: (filters: ColumnFilterState) => void;
35
35
  addColumnFilter: (columnId: string, operator: string, value: any) => void;
36
36
  removeColumnFilter: (filterId: string) => void;
37
37
  clearAllFilters: () => void;
@@ -97,7 +97,7 @@ export interface DataTableApi<T = any> {
97
97
  };
98
98
  state: {
99
99
  getTableState: () => any;
100
- getCurrentFilters: () => CustomColumnFilterState;
100
+ getCurrentFilters: () => ColumnFilterState;
101
101
  getCurrentSorting: () => SortingState;
102
102
  getCurrentPagination: () => {
103
103
  pageIndex: number;
@@ -2,7 +2,7 @@ import { SortingState } from '@tanstack/react-table';
2
2
  import { ColumnFilterRule, SelectionState } from '../features';
3
3
  export type TableSize = 'small' | 'medium';
4
4
  export interface TableState {
5
- customColumnsFilter: CustomColumnFilterState;
5
+ columnFilter: ColumnFilterState;
6
6
  selectionState?: SelectionState;
7
7
  globalFilter?: string;
8
8
  sorting?: SortingState;
@@ -20,7 +20,7 @@ export interface TableState {
20
20
  }
21
21
  export interface TableFilters {
22
22
  globalFilter: string;
23
- customColumnsFilter: CustomColumnFilterState;
23
+ columnFilter: ColumnFilterState;
24
24
  sorting: SortingState;
25
25
  pagination: {
26
26
  pageIndex: number;
@@ -37,9 +37,9 @@ export interface TableFiltersForFetch {
37
37
  page?: number;
38
38
  pageSize?: number;
39
39
  sorting?: SortingState;
40
- customColumnsFilter?: CustomColumnFilterState;
40
+ columnFilter?: ColumnFilterState;
41
41
  }
42
- export interface CustomColumnFilterState {
42
+ export interface ColumnFilterState {
43
43
  filters: ColumnFilterRule[];
44
44
  logic: 'AND' | 'OR';
45
45
  pendingFilters: ColumnFilterRule[];
@@ -1,7 +1,6 @@
1
- import { DataTableColumn } from '../types';
2
1
  import { Column } from "@tanstack/react-table";
3
2
  export type ColumnType = 'text' | 'number' | 'date' | 'boolean' | 'select' | 'actions';
4
3
  export declare function getColumnType(column: Column<any, unknown>): ColumnType;
5
4
  export declare function getCustomFilterComponent(column: Column<any, unknown>): any;
6
5
  export declare function getColumnOptions(column: Column<any, unknown>): any[];
7
- export declare function isColumnFilterable(column: DataTableColumn<any, unknown>): boolean;
6
+ export declare function isColumnFilterable(column: Column<any, unknown>): boolean;
@@ -36,8 +36,9 @@ function getColumnOptions(column) {
36
36
  return [];
37
37
  }
38
38
  function isColumnFilterable(column) {
39
- if ((column === null || column === void 0 ? void 0 : column.filterable) !== undefined) {
40
- return column === null || column === void 0 ? void 0 : column.filterable;
39
+ var _a, _b;
40
+ if (((_a = column === null || column === void 0 ? void 0 : column.columnDef) === null || _a === void 0 ? void 0 : _a.filterable) !== undefined) {
41
+ return (_b = column === null || column === void 0 ? void 0 : column.columnDef) === null || _b === void 0 ? void 0 : _b.filterable;
41
42
  }
42
43
  return true;
43
44
  }
@@ -1,12 +1,12 @@
1
1
  import { Table } from '@tanstack/react-table';
2
- import { SelectionState } from '../features/custom-selection.feature';
2
+ import { SelectionState } from '../features';
3
3
  export interface ExportOptions {
4
4
  format: 'csv' | 'excel';
5
5
  filename: string;
6
6
  onProgress?: (progress: {
7
- processedRows: number;
8
- totalRows: number;
9
- percentage: number;
7
+ processedRows?: number;
8
+ totalRows?: number;
9
+ percentage?: number;
10
10
  }) => void;
11
11
  onComplete?: (result: {
12
12
  success: boolean;