@reactorui/datagrid 1.2.0 → 1.2.2
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/README.md +100 -33
- package/dist/components/DataGrid/DataGrid.d.ts +1 -1
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +2 -1
- package/dist/components/Filter/FilterControls.js +1 -1
- package/dist/hooks/useDataGrid.d.ts +8 -2
- package/dist/hooks/useDataGrid.d.ts.map +1 -1
- package/dist/hooks/useDataGrid.js +34 -28
- package/dist/types/index.d.ts +7 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -276,10 +276,11 @@ function ServerSideExample() {
|
|
|
276
276
|
const [loadingState, setLoadingState] = useState<LoadingState>({});
|
|
277
277
|
const [totalRecords, setTotalRecords] = useState(0);
|
|
278
278
|
const [currentPage, setCurrentPage] = useState(1);
|
|
279
|
+
const [pageSize, setPageSize] = useState(25);
|
|
279
280
|
const [error, setError] = useState<string | null>(null);
|
|
280
281
|
|
|
281
282
|
// Fetch data from your API
|
|
282
|
-
const fetchData = async (page: number, filters: ActiveFilter[], search: string) => {
|
|
283
|
+
const fetchData = async (page: number, size: number, filters: ActiveFilter[], search: string) => {
|
|
283
284
|
setLoadingState({ data: true });
|
|
284
285
|
setError(null);
|
|
285
286
|
|
|
@@ -287,7 +288,7 @@ function ServerSideExample() {
|
|
|
287
288
|
const response = await fetch('/api/users', {
|
|
288
289
|
method: 'POST',
|
|
289
290
|
headers: { 'Content-Type': 'application/json' },
|
|
290
|
-
body: JSON.stringify({ page, pageSize:
|
|
291
|
+
body: JSON.stringify({ page, pageSize: size, filters, search }),
|
|
291
292
|
});
|
|
292
293
|
|
|
293
294
|
const result = await response.json();
|
|
@@ -301,36 +302,44 @@ function ServerSideExample() {
|
|
|
301
302
|
};
|
|
302
303
|
|
|
303
304
|
useEffect(() => {
|
|
304
|
-
fetchData(1, [], '');
|
|
305
|
+
fetchData(1, pageSize, [], '');
|
|
305
306
|
}, []);
|
|
306
307
|
|
|
307
308
|
return (
|
|
308
309
|
<DataGrid
|
|
309
310
|
data={data}
|
|
310
|
-
|
|
311
|
+
loadingState={loadingState}
|
|
311
312
|
totalRecords={totalRecords}
|
|
312
313
|
currentPage={currentPage}
|
|
313
314
|
error={error}
|
|
314
|
-
pageSize={
|
|
315
|
+
pageSize={pageSize}
|
|
316
|
+
paginationMode="server"
|
|
317
|
+
filterMode="server"
|
|
318
|
+
// Pagination callbacks - YOU handle the server call
|
|
319
|
+
onPageChange={(page) => {
|
|
320
|
+
setCurrentPage(page);
|
|
321
|
+
fetchData(page, pageSize, [], '');
|
|
322
|
+
}}
|
|
323
|
+
onPageSizeChange={(size) => {
|
|
324
|
+
setPageSize(size);
|
|
325
|
+
setCurrentPage(1);
|
|
326
|
+
fetchData(1, size, [], '');
|
|
327
|
+
}}
|
|
315
328
|
// Filter callbacks - YOU handle the server call
|
|
316
329
|
onApplyFilter={(filter, allFilters) => {
|
|
317
330
|
setLoadingState({ filter: true });
|
|
318
|
-
fetchData(1, allFilters, '');
|
|
331
|
+
fetchData(1, pageSize, allFilters, '');
|
|
319
332
|
}}
|
|
320
333
|
onClearFilters={() => {
|
|
321
|
-
fetchData(1, [], '');
|
|
334
|
+
fetchData(1, pageSize, [], '');
|
|
322
335
|
}}
|
|
323
336
|
onSearchChange={(term) => {
|
|
324
337
|
setLoadingState({ search: true });
|
|
325
|
-
fetchData(1, [], term);
|
|
326
|
-
}}
|
|
327
|
-
onPageChange={(page) => {
|
|
328
|
-
setCurrentPage(page);
|
|
329
|
-
fetchData(page, [], '');
|
|
338
|
+
fetchData(1, pageSize, [], term);
|
|
330
339
|
}}
|
|
331
340
|
onTableRefresh={() => {
|
|
332
341
|
setLoadingState({ refresh: true });
|
|
333
|
-
fetchData(currentPage, [], '');
|
|
342
|
+
fetchData(currentPage, pageSize, [], '');
|
|
334
343
|
}}
|
|
335
344
|
/>
|
|
336
345
|
);
|
|
@@ -396,6 +405,7 @@ For large datasets, enable scrollable body with fixed headers:
|
|
|
396
405
|
<DataGrid
|
|
397
406
|
data={data}
|
|
398
407
|
enableFilters={true}
|
|
408
|
+
filterMode="server"
|
|
399
409
|
// Called when "Apply Filter" is clicked
|
|
400
410
|
onApplyFilter={(filter, allFilters) => {
|
|
401
411
|
console.log('New filter:', filter);
|
|
@@ -493,15 +503,15 @@ For large datasets, enable scrollable body with fixed headers:
|
|
|
493
503
|
|
|
494
504
|
### Data & State
|
|
495
505
|
|
|
496
|
-
| Prop | Type | Default | Description
|
|
497
|
-
| -------------- | ---------------- | ------------- |
|
|
498
|
-
| `data` | `T[]` | **Required** | Array of data to display
|
|
499
|
-
| `columns` | `Column<T>[]` | Auto-detected | Column definitions
|
|
500
|
-
| `loading` | `boolean` | `false` | Simple loading state (backward compat)
|
|
501
|
-
| `loadingState` | `LoadingState` | `{}` | Granular loading states
|
|
502
|
-
| `totalRecords` | `number` | - | Total records for
|
|
503
|
-
| `currentPage` | `number` | - | Controlled current page
|
|
504
|
-
| `error` | `string \| null` | - | Error message to display
|
|
506
|
+
| Prop | Type | Default | Description |
|
|
507
|
+
| -------------- | ---------------- | ------------- | -------------------------------------- |
|
|
508
|
+
| `data` | `T[]` | **Required** | Array of data to display |
|
|
509
|
+
| `columns` | `Column<T>[]` | Auto-detected | Column definitions |
|
|
510
|
+
| `loading` | `boolean` | `false` | Simple loading state (backward compat) |
|
|
511
|
+
| `loadingState` | `LoadingState` | `{}` | Granular loading states |
|
|
512
|
+
| `totalRecords` | `number` | - | Total records for pagination display |
|
|
513
|
+
| `currentPage` | `number` | - | Controlled current page |
|
|
514
|
+
| `error` | `string \| null` | - | Error message to display |
|
|
505
515
|
|
|
506
516
|
### Layout & Styling
|
|
507
517
|
|
|
@@ -516,16 +526,22 @@ For large datasets, enable scrollable body with fixed headers:
|
|
|
516
526
|
|
|
517
527
|
### Features
|
|
518
528
|
|
|
519
|
-
| Prop | Type | Default | Description
|
|
520
|
-
| -------------------- | ----------------------------------------- | ---------- |
|
|
521
|
-
| `enableSearch` | `boolean` | `true` | Show search input
|
|
522
|
-
| `enableSorting` | `boolean` | `true` | Enable column sorting
|
|
523
|
-
| `enableFilters` | `boolean` | `true` | Show filter controls
|
|
524
|
-
| `enableSelection` | `boolean` | `true` | Show row checkboxes
|
|
525
|
-
| `enableDelete` | `boolean` | `false` | Show delete button
|
|
526
|
-
| `enableRefresh` | `boolean` | `false` | Show refresh button
|
|
527
|
-
| `deleteConfirmation` | `boolean` | `false` | Confirm before delete
|
|
528
|
-
| `
|
|
529
|
+
| Prop | Type | Default | Description |
|
|
530
|
+
| -------------------- | ----------------------------------------- | ---------- | --------------------- |
|
|
531
|
+
| `enableSearch` | `boolean` | `true` | Show search input |
|
|
532
|
+
| `enableSorting` | `boolean` | `true` | Enable column sorting |
|
|
533
|
+
| `enableFilters` | `boolean` | `true` | Show filter controls |
|
|
534
|
+
| `enableSelection` | `boolean` | `true` | Show row checkboxes |
|
|
535
|
+
| `enableDelete` | `boolean` | `false` | Show delete button |
|
|
536
|
+
| `enableRefresh` | `boolean` | `false` | Show refresh button |
|
|
537
|
+
| `deleteConfirmation` | `boolean` | `false` | Confirm before delete |
|
|
538
|
+
| `paginationMode` | `'client' \| 'server'` | `'client'` | Pagination behavior |
|
|
539
|
+
| `filterMode` | `'client' \| 'server' \| 'client&server'` | `'client'` | Filter behavior |
|
|
540
|
+
|
|
541
|
+
**paginationMode options:**
|
|
542
|
+
|
|
543
|
+
- `'client'` (default) - Slices data locally, `totalRecords` is display-only
|
|
544
|
+
- `'server'` - No local slicing, parent handles pagination via `onPageChange`/`onPageSizeChange`
|
|
529
545
|
|
|
530
546
|
**filterMode options:**
|
|
531
547
|
|
|
@@ -640,7 +656,14 @@ import { DataGrid } from '@reactorui/datagrid';
|
|
|
640
656
|
|
|
641
657
|
test('handles filter application', async () => {
|
|
642
658
|
const onApplyFilter = jest.fn();
|
|
643
|
-
render(
|
|
659
|
+
render(
|
|
660
|
+
<DataGrid
|
|
661
|
+
data={testData}
|
|
662
|
+
enableFilters={true}
|
|
663
|
+
filterMode="server"
|
|
664
|
+
onApplyFilter={onApplyFilter}
|
|
665
|
+
/>
|
|
666
|
+
);
|
|
644
667
|
|
|
645
668
|
// Select column, enter value, click Apply
|
|
646
669
|
const selects = screen.getAllByRole('combobox');
|
|
@@ -663,6 +686,27 @@ test('applies custom theme', () => {
|
|
|
663
686
|
|
|
664
687
|
expect(container.firstChild).toHaveClass('dark:bg-zinc-900');
|
|
665
688
|
});
|
|
689
|
+
|
|
690
|
+
test('client mode slices data locally', () => {
|
|
691
|
+
const largeData = Array.from({ length: 50 }, (_, i) => ({ id: i, name: `User ${i}` }));
|
|
692
|
+
render(<DataGrid data={largeData} pageSize={10} paginationMode="client" />);
|
|
693
|
+
|
|
694
|
+
// Should only show 10 rows
|
|
695
|
+
const rows = screen.getAllByRole('row');
|
|
696
|
+
expect(rows.length - 1).toBe(10); // minus header
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
test('server mode does not slice data', () => {
|
|
700
|
+
const pageData = Array.from({ length: 5 }, (_, i) => ({ id: i, name: `User ${i}` }));
|
|
701
|
+
render(<DataGrid data={pageData} totalRecords={100} pageSize={10} paginationMode="server" />);
|
|
702
|
+
|
|
703
|
+
// Shows all 5 rows (server already sliced)
|
|
704
|
+
const rows = screen.getAllByRole('row');
|
|
705
|
+
expect(rows.length - 1).toBe(5);
|
|
706
|
+
|
|
707
|
+
// But displays totalRecords
|
|
708
|
+
expect(screen.getByText(/of 100 records/)).toBeInTheDocument();
|
|
709
|
+
});
|
|
666
710
|
```
|
|
667
711
|
|
|
668
712
|
## ⚠️ Migration Guide
|
|
@@ -739,6 +783,29 @@ function MyGrid() {
|
|
|
739
783
|
/>
|
|
740
784
|
```
|
|
741
785
|
|
|
786
|
+
### Pagination Mode (New in v1.2.2)
|
|
787
|
+
|
|
788
|
+
`totalRecords` no longer automatically triggers server-side pagination. Use explicit `paginationMode`:
|
|
789
|
+
|
|
790
|
+
```tsx
|
|
791
|
+
// Client-side pagination (default) - totalRecords is display only
|
|
792
|
+
<DataGrid
|
|
793
|
+
data={allData}
|
|
794
|
+
totalRecords={500} // Just for display: "Showing 1-25 of 500"
|
|
795
|
+
pageSize={25}
|
|
796
|
+
// paginationMode="client" is the default
|
|
797
|
+
/>
|
|
798
|
+
|
|
799
|
+
// Server-side pagination - parent handles slicing
|
|
800
|
+
<DataGrid
|
|
801
|
+
data={currentPageData}
|
|
802
|
+
totalRecords={500}
|
|
803
|
+
paginationMode="server" // Explicit opt-in
|
|
804
|
+
onPageChange={handlePageChange}
|
|
805
|
+
onPageSizeChange={handlePageSizeChange}
|
|
806
|
+
/>
|
|
807
|
+
```
|
|
808
|
+
|
|
742
809
|
## 🔧 Development
|
|
743
810
|
|
|
744
811
|
```bash
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataGridProps } from '../../types';
|
|
2
2
|
export declare const DataGrid: <T extends {
|
|
3
3
|
[key: string]: any;
|
|
4
|
-
} = any>({ data, columns: columnsProp, loading: simpleLoading, loadingState: externalLoadingState, totalRecords: externalTotalRecords, error: externalError, currentPage: externalCurrentPage, enableSearch, enableSorting, enableFilters, enableSelection, enableDelete, enableRefresh, deleteConfirmation, filterMode, maxHeight, stickyHeader, pageSize, pageSizeOptions, variant, size, className, theme: customTheme, onPageChange, onPageSizeChange, onSortChange, onSearchChange, onApplyFilter, onRemoveFilter, onClearFilters, onFilterChange, onTableRowClick, onTableRowDoubleClick, onRowSelect, onSelectionChange, onTableRowHover, onCellClick, onTableRefresh, onBulkDelete, endpoint, httpConfig, serverPageSize, onDataLoad, onDataError, onLoadingStateChange, ...rest }: DataGridProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
} = any>({ data, columns: columnsProp, loading: simpleLoading, loadingState: externalLoadingState, totalRecords: externalTotalRecords, error: externalError, currentPage: externalCurrentPage, enableSearch, enableSorting, enableFilters, enableSelection, enableDelete, enableRefresh, deleteConfirmation, paginationMode, filterMode, maxHeight, stickyHeader, pageSize, pageSizeOptions, variant, size, className, theme: customTheme, onPageChange, onPageSizeChange, onSortChange, onSearchChange, onApplyFilter, onRemoveFilter, onClearFilters, onFilterChange, onTableRowClick, onTableRowDoubleClick, onRowSelect, onSelectionChange, onTableRowHover, onCellClick, onTableRefresh, onBulkDelete, endpoint, httpConfig, serverPageSize, onDataLoad, onDataError, onLoadingStateChange, ...rest }: DataGridProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
//# sourceMappingURL=DataGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../../src/components/DataGrid/DataGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AA0ClE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../../src/components/DataGrid/DataGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AA0ClE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,GAAG,EAAE,mwBA0E9D,aAAa,CAAC,CAAC,CAAC,4CAyYlB,CAAC"}
|
|
@@ -22,7 +22,7 @@ loading: simpleLoading = false, loadingState: externalLoadingState,
|
|
|
22
22
|
// External state (controlled mode)
|
|
23
23
|
totalRecords: externalTotalRecords, error: externalError, currentPage: externalCurrentPage,
|
|
24
24
|
// Features
|
|
25
|
-
enableSearch = true, enableSorting = true, enableFilters = true, enableSelection = true, enableDelete = false, enableRefresh = false, deleteConfirmation = false, filterMode = 'client',
|
|
25
|
+
enableSearch = true, enableSorting = true, enableFilters = true, enableSelection = true, enableDelete = false, enableRefresh = false, deleteConfirmation = false, paginationMode = 'client', filterMode = 'client',
|
|
26
26
|
// Layout
|
|
27
27
|
maxHeight, stickyHeader = false,
|
|
28
28
|
// Pagination
|
|
@@ -101,6 +101,7 @@ endpoint, httpConfig, serverPageSize, onDataLoad, onDataError, onLoadingStateCha
|
|
|
101
101
|
totalRecords: externalTotalRecords,
|
|
102
102
|
currentPage: externalCurrentPage,
|
|
103
103
|
loading: isDataLoading,
|
|
104
|
+
paginationMode,
|
|
104
105
|
filterMode,
|
|
105
106
|
onPageChange,
|
|
106
107
|
onPageSizeChange,
|
|
@@ -184,5 +184,5 @@ export const FilterControls = ({ columns, activeFilters, onApplyFilter, onRemove
|
|
|
184
184
|
padding: 14,
|
|
185
185
|
left: popoverPosition.left,
|
|
186
186
|
zIndex: 99999,
|
|
187
|
-
}, children: _jsxs("div", { className: "
|
|
187
|
+
}, children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: `text-base font-semibold ${theme.text.replace('text-gray-700', 'text-gray-900').replace('dark:text-zinc-300', 'dark:text-zinc-100')}`, children: "Add Filter" }), _jsx("button", { onClick: () => setIsOpen(false), className: `p-1 ${theme.textMuted} hover:${theme.text} rounded-md ${theme.buttonSecondary.replace(/px-3 py-2 bg-\S+ /g, '')} transition-colors`, children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }), _jsxs("div", { children: [_jsx("label", { className: `block text-sm font-medium ${theme.text} mb-1.5`, children: "Column" }), _jsxs("select", { value: filterColumn, onChange: (e) => handleColumnChange(e.target.value), disabled: isDisabled, className: `w-full px-3 py-2.5 ${theme.select}`, children: [_jsx("option", { value: "", children: "Select column" }), filterableColumns.map((col) => (_jsx("option", { value: String(col.key), children: col.label }, String(col.key))))] })] }), _jsxs("div", { children: [_jsx("label", { className: `block text-sm font-medium ${theme.text} mb-1.5`, children: "Operator" }), _jsx("select", { value: filterOperator, onChange: (e) => setFilterOperator(e.target.value), disabled: isDisabled || !filterColumn, className: `w-full px-3 py-2.5 ${theme.select}`, children: operatorOptions.map((op) => (_jsx("option", { value: op.value, children: op.label }, op.value))) })] }), _jsxs("div", { children: [_jsx("label", { className: `block text-sm font-medium ${theme.text} mb-1.5`, children: "Value" }), renderValueInput()] }), _jsx("button", { onClick: handleApply, disabled: isDisabled || !canApply, className: `w-full px-4 py-2.5 ${theme.button} font-medium`, children: "Apply Filter" })] }) }), document.body)] }));
|
|
188
188
|
};
|
|
@@ -5,6 +5,12 @@ interface UseDataGridProps<T> {
|
|
|
5
5
|
totalRecords?: number;
|
|
6
6
|
currentPage?: number;
|
|
7
7
|
loading?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Pagination behavior mode:
|
|
10
|
+
* - 'client' (default): Slices data locally, totalRecords used for display only
|
|
11
|
+
* - 'server': No local slicing, parent handles pagination via onPageChange/onPageSizeChange
|
|
12
|
+
*/
|
|
13
|
+
paginationMode?: 'client' | 'server';
|
|
8
14
|
/**
|
|
9
15
|
* Filter behavior mode:
|
|
10
16
|
* - 'client' (default): Filters locally, no onApplyFilter callback
|
|
@@ -21,7 +27,7 @@ interface UseDataGridProps<T> {
|
|
|
21
27
|
onClearFilters?: () => void;
|
|
22
28
|
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
23
29
|
}
|
|
24
|
-
export declare const useDataGrid: <T extends BaseRowData>({ data, pageSize
|
|
30
|
+
export declare const useDataGrid: <T extends BaseRowData>({ data, pageSize, totalRecords: externalTotalRecords, currentPage: externalCurrentPage, loading: externalLoading, paginationMode, filterMode, onPageChange, onPageSizeChange, onSortChange, onSearchChange, onApplyFilter, onRemoveFilter, onClearFilters, onFilterChange, }: UseDataGridProps<T>) => {
|
|
25
31
|
data: T[];
|
|
26
32
|
processedData: T[];
|
|
27
33
|
paginatedData: T[];
|
|
@@ -49,7 +55,7 @@ export declare const useDataGrid: <T extends BaseRowData>({ data, pageSize: init
|
|
|
49
55
|
selectedData: T[];
|
|
50
56
|
hasSelection: boolean;
|
|
51
57
|
getRowId: (row: T) => string;
|
|
52
|
-
|
|
58
|
+
isServerPagination: boolean;
|
|
53
59
|
};
|
|
54
60
|
export {};
|
|
55
61
|
//# sourceMappingURL=useDataGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataGrid.d.ts","sourceRoot":"","sources":["../../src/hooks/useDataGrid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAOjF,UAAU,gBAAgB,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,eAAe,CAAC;IAGnD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IACpE,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE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AAE,KAAK,IAAI,CAAC;IAC5E,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACpD;AAMD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EAAE,8QAgBhD,gBAAgB,CAAC,CAAC,CAAC;;;;;;;;;;;0BAkHX,MAAM;sBASJ,MAAM;2BAaR,MAAM;+BAQN,MAAM;;;wBAsBJ,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;0BAoB5B,MAAM;;uBA4BsB,MAAM,YAAY,OAAO;0BASlD,OAAO;;;;;;oBA3LZ,CAAC,KAAG,MAAM;;CA2PnB,CAAC"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
// File: src/hooks/useDataGrid.ts
|
|
2
|
-
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useState, useCallback, useMemo, useEffect } from 'react';
|
|
3
3
|
import { compareValues, sortData } from '../utils';
|
|
4
4
|
// ============================================================================
|
|
5
5
|
// Hook Implementation
|
|
6
6
|
// ============================================================================
|
|
7
|
-
export const useDataGrid = ({ data, pageSize
|
|
7
|
+
export const useDataGrid = ({ data, pageSize = 10, totalRecords: externalTotalRecords, currentPage: externalCurrentPage, loading: externalLoading = false, paginationMode = 'client', filterMode = 'client', onPageChange, onPageSizeChange, onSortChange, onSearchChange, onApplyFilter, onRemoveFilter, onClearFilters, onFilterChange, }) => {
|
|
8
8
|
// ===== Internal State =====
|
|
9
9
|
const [searchTerm, setSearchTermState] = useState('');
|
|
10
10
|
const [activeFilters, setActiveFilters] = useState([]);
|
|
11
11
|
const [sortConfig, setSortConfig] = useState({ column: '', direction: 'asc' });
|
|
12
12
|
const [selectedRows, setSelectedRows] = useState(new Set());
|
|
13
13
|
const [internalPage, setInternalPage] = useState(1);
|
|
14
|
-
const [currentPageSize, setCurrentPageSizeState] = useState(
|
|
15
|
-
//
|
|
16
|
-
|
|
14
|
+
const [currentPageSize, setCurrentPageSizeState] = useState(pageSize);
|
|
15
|
+
// ===== Sync pageSize prop with internal state =====
|
|
16
|
+
// This ensures the component responds to prop changes from parent
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setCurrentPageSizeState(pageSize);
|
|
19
|
+
}, [pageSize]);
|
|
20
|
+
// Determine if pagination is server-controlled
|
|
21
|
+
const isServerPagination = paginationMode === 'server';
|
|
17
22
|
const currentPage = externalCurrentPage ?? internalPage;
|
|
18
23
|
// ===== Row ID Generation =====
|
|
19
24
|
const rowIdMap = useMemo(() => {
|
|
@@ -36,7 +41,7 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
36
41
|
const processedData = useMemo(() => {
|
|
37
42
|
// Determine if we should filter locally
|
|
38
43
|
const shouldFilterLocally = filterMode === 'client' || filterMode === 'client&server';
|
|
39
|
-
if (
|
|
44
|
+
if (isServerPagination && filterMode === 'server') {
|
|
40
45
|
// Server mode with controlled data - parent handles everything, just sort
|
|
41
46
|
return sortConfig.column ? sortData(data, sortConfig.column, sortConfig.direction) : data;
|
|
42
47
|
}
|
|
@@ -60,17 +65,18 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
60
65
|
result = sortData(result, sortConfig.column, sortConfig.direction);
|
|
61
66
|
}
|
|
62
67
|
return result;
|
|
63
|
-
}, [data, searchTerm, activeFilters, sortConfig,
|
|
68
|
+
}, [data, searchTerm, activeFilters, sortConfig, isServerPagination, filterMode]);
|
|
64
69
|
// ===== Pagination =====
|
|
65
70
|
const paginatedData = useMemo(() => {
|
|
66
|
-
if (
|
|
71
|
+
if (isServerPagination)
|
|
67
72
|
return data; // Parent handles pagination
|
|
68
73
|
const start = (currentPage - 1) * currentPageSize;
|
|
69
74
|
return processedData.slice(start, start + currentPageSize);
|
|
70
|
-
}, [processedData, currentPage, currentPageSize,
|
|
75
|
+
}, [processedData, currentPage, currentPageSize, isServerPagination, data]);
|
|
76
|
+
// ===== Pagination Info =====
|
|
71
77
|
const paginationInfo = useMemo(() => {
|
|
72
|
-
const total =
|
|
73
|
-
const totalPages = Math.ceil(total / currentPageSize);
|
|
78
|
+
const total = isServerPagination ? (externalTotalRecords ?? 0) : processedData.length;
|
|
79
|
+
const totalPages = Math.ceil(total / currentPageSize) || 1;
|
|
74
80
|
const start = total === 0 ? 0 : (currentPage - 1) * currentPageSize + 1;
|
|
75
81
|
const end = Math.min(currentPage * currentPageSize, total);
|
|
76
82
|
return {
|
|
@@ -83,7 +89,7 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
83
89
|
hasNext: currentPage < totalPages,
|
|
84
90
|
hasPrevious: currentPage > 1,
|
|
85
91
|
};
|
|
86
|
-
}, [processedData
|
|
92
|
+
}, [processedData, currentPage, currentPageSize, isServerPagination, externalTotalRecords]);
|
|
87
93
|
// ===== Selection =====
|
|
88
94
|
const selectedData = useMemo(() => {
|
|
89
95
|
return data.filter((row) => selectedRows.has(getRowId(row)));
|
|
@@ -91,31 +97,31 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
91
97
|
// ===== Actions =====
|
|
92
98
|
const setSearchTerm = useCallback((term) => {
|
|
93
99
|
setSearchTermState(term);
|
|
94
|
-
if (!
|
|
100
|
+
if (!isServerPagination)
|
|
95
101
|
setInternalPage(1);
|
|
96
102
|
onSearchChange?.(term);
|
|
97
|
-
}, [
|
|
103
|
+
}, [isServerPagination, onSearchChange]);
|
|
98
104
|
const setSort = useCallback((column) => {
|
|
99
105
|
const newConfig = {
|
|
100
106
|
column,
|
|
101
107
|
direction: sortConfig.column === column && sortConfig.direction === 'asc' ? 'desc' : 'asc',
|
|
102
108
|
};
|
|
103
109
|
setSortConfig(newConfig);
|
|
104
|
-
if (!
|
|
110
|
+
if (!isServerPagination)
|
|
105
111
|
setInternalPage(1);
|
|
106
112
|
onSortChange?.(newConfig);
|
|
107
|
-
}, [sortConfig,
|
|
113
|
+
}, [sortConfig, isServerPagination, onSortChange]);
|
|
108
114
|
const setCurrentPage = useCallback((page) => {
|
|
109
|
-
if (!
|
|
115
|
+
if (!isServerPagination)
|
|
110
116
|
setInternalPage(page);
|
|
111
117
|
onPageChange?.(page, { ...paginationInfo, currentPage: page });
|
|
112
|
-
}, [
|
|
118
|
+
}, [isServerPagination, paginationInfo, onPageChange]);
|
|
113
119
|
const setCurrentPageSize = useCallback((size) => {
|
|
114
120
|
setCurrentPageSizeState(size);
|
|
115
|
-
if (!
|
|
116
|
-
setInternalPage(1);
|
|
121
|
+
if (!isServerPagination)
|
|
122
|
+
setInternalPage(1); // Reset to page 1 when page size changes
|
|
117
123
|
onPageSizeChange?.(size);
|
|
118
|
-
}, [
|
|
124
|
+
}, [isServerPagination, onPageSizeChange]);
|
|
119
125
|
const navigateNext = useCallback(() => {
|
|
120
126
|
if (paginationInfo.hasNext) {
|
|
121
127
|
setCurrentPage(currentPage + 1);
|
|
@@ -133,19 +139,19 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
133
139
|
// Replace existing filter on same column or add new
|
|
134
140
|
const newFilters = [...activeFilters.filter((f) => f.column !== filter.column), fullFilter];
|
|
135
141
|
setActiveFilters(newFilters);
|
|
136
|
-
if (!
|
|
142
|
+
if (!isServerPagination)
|
|
137
143
|
setInternalPage(1);
|
|
138
144
|
// Fire callbacks only for 'server' or 'client&server' modes
|
|
139
145
|
if (filterMode !== 'client') {
|
|
140
146
|
onApplyFilter?.(fullFilter, newFilters);
|
|
141
147
|
onFilterChange?.(newFilters);
|
|
142
148
|
}
|
|
143
|
-
}, [activeFilters,
|
|
149
|
+
}, [activeFilters, isServerPagination, filterMode, onApplyFilter, onFilterChange]);
|
|
144
150
|
const removeFilter = useCallback((index) => {
|
|
145
151
|
const removed = activeFilters[index];
|
|
146
152
|
const newFilters = activeFilters.filter((_, i) => i !== index);
|
|
147
153
|
setActiveFilters(newFilters);
|
|
148
|
-
if (!
|
|
154
|
+
if (!isServerPagination)
|
|
149
155
|
setInternalPage(1);
|
|
150
156
|
// Fire callbacks only for 'server' or 'client&server' modes
|
|
151
157
|
if (filterMode !== 'client') {
|
|
@@ -153,17 +159,17 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
153
159
|
onRemoveFilter?.(removed, newFilters);
|
|
154
160
|
onFilterChange?.(newFilters);
|
|
155
161
|
}
|
|
156
|
-
}, [activeFilters,
|
|
162
|
+
}, [activeFilters, isServerPagination, filterMode, onRemoveFilter, onFilterChange]);
|
|
157
163
|
const clearFilters = useCallback(() => {
|
|
158
164
|
setActiveFilters([]);
|
|
159
|
-
if (!
|
|
165
|
+
if (!isServerPagination)
|
|
160
166
|
setInternalPage(1);
|
|
161
167
|
// Fire callbacks only for 'server' or 'client&server' modes
|
|
162
168
|
if (filterMode !== 'client') {
|
|
163
169
|
onClearFilters?.();
|
|
164
170
|
onFilterChange?.([]);
|
|
165
171
|
}
|
|
166
|
-
}, [
|
|
172
|
+
}, [isServerPagination, filterMode, onClearFilters, onFilterChange]);
|
|
167
173
|
// ===== Selection Actions =====
|
|
168
174
|
const selectRow = useCallback((rowId, selected) => {
|
|
169
175
|
setSelectedRows((prev) => {
|
|
@@ -226,6 +232,6 @@ export const useDataGrid = ({ data, pageSize: initialPageSize = 10, totalRecords
|
|
|
226
232
|
hasSelection: selectedRows.size > 0,
|
|
227
233
|
getRowId,
|
|
228
234
|
// Mode
|
|
229
|
-
|
|
235
|
+
isServerPagination,
|
|
230
236
|
};
|
|
231
237
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export interface DataGridProps<T = BaseRowData> extends Omit<HTMLAttributes<HTML
|
|
|
126
126
|
* @deprecated Prefer loadingState for granular control
|
|
127
127
|
*/
|
|
128
128
|
loading?: boolean;
|
|
129
|
-
/** Total records for pagination display (server
|
|
129
|
+
/** Total records for pagination display (used by both client and server modes) */
|
|
130
130
|
totalRecords?: number;
|
|
131
131
|
/** Whether more data is available (server-side) */
|
|
132
132
|
hasMore?: boolean;
|
|
@@ -139,6 +139,12 @@ export interface DataGridProps<T = BaseRowData> extends Omit<HTMLAttributes<HTML
|
|
|
139
139
|
enableDelete?: boolean;
|
|
140
140
|
enableRefresh?: boolean;
|
|
141
141
|
deleteConfirmation?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Pagination behavior mode:
|
|
144
|
+
* - 'client' (default): Slices data locally, totalRecords used for display only
|
|
145
|
+
* - 'server': No local slicing, parent handles pagination via onPageChange/onPageSizeChange
|
|
146
|
+
*/
|
|
147
|
+
paginationMode?: 'client' | 'server';
|
|
142
148
|
/**
|
|
143
149
|
* Filter behavior mode:
|
|
144
150
|
* - 'client' (default): Filters data locally, no onApplyFilter callback fired
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAMlC,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,WAAW;IACrC,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,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AAC;IAC7C,WAAW,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAGrC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,YAAY,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAEnC;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAElC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;CACrD;AAMD,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,WAAW;IAC/C,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactorui/datagrid",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "A flexible, high-performance React data grid component with TypeScript support, advanced filtering, pagination, sorting, and customizable theming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|