@ackplus/react-tanstack-data-table 1.0.19-beta-0.12 → 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.
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ const DEFAULT_INITIAL_STATE = {
|
|
|
40
40
|
pendingLogic: 'AND',
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, columns, data = [], totalRow = 0, idKey = 'id', extraFilter = null, footerFilter = null, dataMode = 'client', initialLoadData = true, onFetchData, onDataStateChange, enableRowSelection = false, enableMultiRowSelection = true, selectMode = 'page', isRowSelectable, onSelectionChange, enableBulkActions = false, bulkActions, enableColumnResizing = false, columnResizeMode = 'onChange', enableColumnDragging = false, onColumnDragEnd, enableColumnPinning = false, onColumnPinningChange, enableExpanding = false, getRowCanExpand, renderSubComponent, enablePagination = true, paginationMode = 'client', enableGlobalFilter = true, enableColumnFilter = false, filterMode = 'client', enableSorting = true, sortingMode = 'client', onSortingChange, exportFilename = 'export', onExportProgress, onExportComplete, onExportError, onServerExport, onExportCancel, enableHover = true, enableStripes = false, tableContainerProps = {}, tableProps = {}, fitToScreen = true, tableSize: initialTableSize = 'medium', enableStickyHeaderOrFooter = false, maxHeight = '400px', enableVirtualization = false, estimateRowHeight = 52, enableColumnVisibility = true, enableTableSizeControl = true, enableExport = true, enableReset = true, loading = false, emptyMessage = 'No data available', skeletonRows = 5, onColumnFiltersChange,
|
|
43
|
+
exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, columns, data = [], totalRow = 0, idKey = 'id', extraFilter = null, footerFilter = null, dataMode = 'client', initialLoadData = true, onFetchData, onDataStateChange, enableRowSelection = false, enableMultiRowSelection = true, selectMode = 'page', isRowSelectable, onSelectionChange, enableBulkActions = false, bulkActions, enableColumnResizing = false, columnResizeMode = 'onChange', enableColumnDragging = false, onColumnDragEnd, enableColumnPinning = false, onColumnPinningChange, enableExpanding = false, getRowCanExpand, renderSubComponent, enablePagination = true, paginationMode = 'client', enableGlobalFilter = true, enableColumnFilter = false, filterMode = 'client', enableSorting = true, sortingMode = 'client', onSortingChange, exportFilename = 'export', onExportProgress, onExportComplete, onExportError, onServerExport, onExportCancel, enableHover = true, enableStripes = false, tableContainerProps = {}, tableProps = {}, fitToScreen = true, tableSize: initialTableSize = 'medium', enableStickyHeaderOrFooter = false, maxHeight = '400px', enableVirtualization = false, estimateRowHeight = 52, enableColumnVisibility = true, enableTableSizeControl = true, enableExport = true, enableReset = true, loading = false, emptyMessage = 'No data available', skeletonRows = 5, onColumnFiltersChange, slots = {}, slotProps = {}, }, ref) {
|
|
44
44
|
var _a;
|
|
45
45
|
const isServerMode = dataMode === 'server';
|
|
46
46
|
const isServerPagination = paginationMode === 'server' || isServerMode;
|
|
@@ -60,7 +60,7 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
60
60
|
const [tableSize, setTableSize] = (0, react_1.useState)(initialTableSize);
|
|
61
61
|
const [columnOrder, setColumnOrder] = (0, react_1.useState)(DEFAULT_INITIAL_STATE.columnOrder);
|
|
62
62
|
const [columnPinning, setColumnPinning] = (0, react_1.useState)(DEFAULT_INITIAL_STATE.columnPinning);
|
|
63
|
-
const [serverData, setServerData] = (0, react_1.useState)(
|
|
63
|
+
const [serverData, setServerData] = (0, react_1.useState)(null);
|
|
64
64
|
const [serverTotal, setServerTotal] = (0, react_1.useState)(0);
|
|
65
65
|
const [exportController, setExportController] = (0, react_1.useState)(null);
|
|
66
66
|
const tableContainerRef = (0, react_1.useRef)(null);
|
|
@@ -77,8 +77,8 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
77
77
|
setColumnPinning(initialStateConfig.columnPinning);
|
|
78
78
|
}, [initialStateConfig]);
|
|
79
79
|
const { debouncedFetch, isLoading: fetchLoading } = (0, debounced_fetch_utils_1.useDebouncedFetch)(onFetchData);
|
|
80
|
-
const tableData = (0, react_1.useMemo)(() =>
|
|
81
|
-
const tableTotalRow = (0, react_1.useMemo)(() =>
|
|
80
|
+
const tableData = (0, react_1.useMemo)(() => serverData ? serverData : data, [onFetchData, serverData, data]);
|
|
81
|
+
const tableTotalRow = (0, react_1.useMemo)(() => serverData ? serverTotal : totalRow, [onFetchData, serverTotal, totalRow]);
|
|
82
82
|
const tableLoading = (0, react_1.useMemo)(() => onFetchData ? (loading || fetchLoading) : loading, [onFetchData, loading, fetchLoading]);
|
|
83
83
|
const enhancedColumns = (0, react_1.useMemo)(() => {
|
|
84
84
|
let columnsMap = [...columns];
|
|
@@ -451,26 +451,16 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
451
451
|
}, [exportController, onExportCancel]);
|
|
452
452
|
(0, use_data_table_api_1.useDataTableApi)({
|
|
453
453
|
table,
|
|
454
|
-
data: tableData,
|
|
455
454
|
idKey,
|
|
456
|
-
globalFilter,
|
|
457
|
-
columnFilter,
|
|
458
|
-
sorting,
|
|
459
|
-
pagination,
|
|
460
|
-
columnOrder,
|
|
461
|
-
columnPinning,
|
|
462
455
|
enhancedColumns,
|
|
463
456
|
enablePagination,
|
|
464
457
|
enableColumnPinning,
|
|
465
|
-
|
|
466
|
-
initialPageSize: pagination.pageSize,
|
|
467
|
-
pageSize: pagination.pageSize,
|
|
458
|
+
initialStateConfig,
|
|
468
459
|
selectMode,
|
|
469
460
|
onSelectionChange: handleSelectionStateChange,
|
|
470
461
|
handleColumnFilterStateChange,
|
|
471
462
|
onDataStateChange,
|
|
472
463
|
onFetchData: fetchData,
|
|
473
|
-
onDataChange,
|
|
474
464
|
exportFilename,
|
|
475
465
|
onExportProgress,
|
|
476
466
|
onExportComplete,
|
|
@@ -479,6 +469,7 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
479
469
|
exportController,
|
|
480
470
|
setExportController,
|
|
481
471
|
isExporting,
|
|
472
|
+
onDataChange: setServerData,
|
|
482
473
|
dataMode,
|
|
483
474
|
}, internalApiRef);
|
|
484
475
|
(0, react_1.useImperativeHandle)(ref, () => internalApiRef.current, []);
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Table } from '@tanstack/react-table';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
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
|
-
columnFilter: ColumnFilterState;
|
|
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
|
-
|
|
23
|
-
initialPageSize?: number;
|
|
24
|
-
pageSize: number;
|
|
12
|
+
initialStateConfig: Partial<TableState>;
|
|
25
13
|
selectMode?: 'page' | 'all';
|
|
26
14
|
onSelectionChange?: (state: SelectionState) => void;
|
|
27
15
|
handleColumnFilterStateChange: (filterState: ColumnFilterState) => void;
|
|
@@ -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,
|
|
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,
|
|
@@ -123,6 +123,7 @@ function useDataTableApi(props, ref) {
|
|
|
123
123
|
operator,
|
|
124
124
|
value,
|
|
125
125
|
};
|
|
126
|
+
const columnFilter = table.getState().columnFilter;
|
|
126
127
|
const currentFilters = columnFilter.filters || [];
|
|
127
128
|
const newFilters = [...currentFilters, newFilter];
|
|
128
129
|
handleColumnFilterStateChange({
|
|
@@ -133,6 +134,7 @@ function useDataTableApi(props, ref) {
|
|
|
133
134
|
});
|
|
134
135
|
},
|
|
135
136
|
removeColumnFilter: (filterId) => {
|
|
137
|
+
const columnFilter = table.getState().columnFilter;
|
|
136
138
|
const currentFilters = columnFilter.filters || [];
|
|
137
139
|
const newFilters = currentFilters.filter((f) => f.id !== filterId);
|
|
138
140
|
handleColumnFilterStateChange({
|
|
@@ -220,98 +222,95 @@ function useDataTableApi(props, ref) {
|
|
|
220
222
|
},
|
|
221
223
|
data: {
|
|
222
224
|
refresh: () => {
|
|
223
|
-
const
|
|
224
|
-
globalFilter,
|
|
225
|
-
columnFilter: columnFilter,
|
|
226
|
-
sorting,
|
|
227
|
-
pagination,
|
|
228
|
-
};
|
|
225
|
+
const pagination = table.getState().pagination;
|
|
229
226
|
if (onDataStateChange) {
|
|
230
|
-
|
|
231
|
-
columnPinning });
|
|
232
|
-
onDataStateChange(currentState);
|
|
227
|
+
onDataStateChange({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
|
|
233
228
|
}
|
|
234
229
|
if (onFetchData) {
|
|
235
|
-
onFetchData(
|
|
230
|
+
onFetchData({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
|
|
236
231
|
}
|
|
237
232
|
},
|
|
238
233
|
reload: () => {
|
|
239
|
-
const
|
|
240
|
-
globalFilter,
|
|
241
|
-
columnFilter: columnFilter,
|
|
242
|
-
sorting,
|
|
243
|
-
pagination,
|
|
244
|
-
};
|
|
234
|
+
const pagination = table.getState().pagination;
|
|
245
235
|
if (onDataStateChange) {
|
|
246
|
-
|
|
247
|
-
columnPinning });
|
|
248
|
-
onDataStateChange(Object.assign({}, currentState));
|
|
236
|
+
onDataStateChange({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
|
|
249
237
|
}
|
|
250
238
|
if (onFetchData) {
|
|
251
|
-
onFetchData(
|
|
239
|
+
onFetchData({ pagination: { pageIndex: 0, pageSize: pagination.pageSize } });
|
|
252
240
|
}
|
|
253
241
|
},
|
|
254
242
|
getAllData: () => {
|
|
255
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
|
|
270
|
-
|
|
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
|
|
265
|
+
onDataChange(newData);
|
|
273
266
|
}
|
|
274
267
|
},
|
|
275
268
|
insertRow: (newRow, index) => {
|
|
276
|
-
|
|
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
|
|
277
|
+
onDataChange(newData || []);
|
|
284
278
|
},
|
|
285
279
|
deleteRow: (rowId) => {
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
298
|
-
onDataChange === null ||
|
|
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 =
|
|
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
|
|
309
|
+
onDataChange(newData || []);
|
|
312
310
|
},
|
|
313
311
|
insertMultipleRows: (newRows, startIndex) => {
|
|
314
|
-
|
|
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 =
|
|
326
|
-
onDataChange
|
|
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
|
-
|
|
330
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
columnFilter: columnFilter,
|
|
391
|
+
columnFilter: table.getState().columnFilter,
|
|
396
392
|
};
|
|
397
393
|
},
|
|
398
394
|
restoreLayout: (layout) => {
|
|
@@ -427,7 +423,7 @@ function useDataTableApi(props, ref) {
|
|
|
427
423
|
return table.getState();
|
|
428
424
|
},
|
|
429
425
|
getCurrentFilters: () => {
|
|
430
|
-
return columnFilter;
|
|
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
|
-
columnFilter,
|
|
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
|
-
columnFilter,
|
|
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
|
-
columnFilter,
|
|
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
|
-
columnFilter,
|
|
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,
|