@gp-grid/react 0.7.2 → 0.8.0
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/LICENSE +190 -0
- package/README.md +8 -8
- package/dist/index.d.ts +91 -2
- package/dist/index.js +1 -1662
- package/package.json +11 -11
- package/dist/index.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Giovanni Patruno
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gp-grid
|
|
1
|
+
# @gp-grid/react 🏁 🏎️
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<a href="https://www.gp-grid.io">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
[](https://deepwiki.com/GioPat/gp-grid)
|
|
18
18
|
|
|
19
|
-
A high-performance, feature lean React data grid component built to manage grids with huge amount (millions) of rows. It's based on its core dependency:
|
|
19
|
+
A high-performance, feature lean React data grid component built to manage grids with huge amount (millions) of rows. It's based on its core dependency: `@gp-grid/core`, featuring virtual scrolling, cell selection, sorting, filtering, editing, and Excel-like fill handle.
|
|
20
20
|
|
|
21
21
|
## Table of Contents
|
|
22
22
|
|
|
@@ -47,13 +47,13 @@ A high-performance, feature lean React data grid component built to manage grids
|
|
|
47
47
|
Use `npm`, `yarn` or `pnpm`
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
pnpm add gp-grid
|
|
50
|
+
pnpm add @gp-grid/react
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Quick Start
|
|
54
54
|
|
|
55
55
|
```tsx
|
|
56
|
-
import { Grid, type ColumnDefinition } from "gp-grid
|
|
56
|
+
import { Grid, type ColumnDefinition } from "@gp-grid/react";
|
|
57
57
|
|
|
58
58
|
interface Person {
|
|
59
59
|
id: number;
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
Grid,
|
|
97
97
|
createClientDataSource,
|
|
98
98
|
type ColumnDefinition,
|
|
99
|
-
} from "gp-grid
|
|
99
|
+
} from "@gp-grid/react";
|
|
100
100
|
|
|
101
101
|
interface Product {
|
|
102
102
|
id: number;
|
|
@@ -161,7 +161,7 @@ import {
|
|
|
161
161
|
type ColumnDefinition,
|
|
162
162
|
type DataSourceRequest,
|
|
163
163
|
type DataSourceResponse,
|
|
164
|
-
} from "gp-grid
|
|
164
|
+
} from "@gp-grid/react";
|
|
165
165
|
|
|
166
166
|
interface User {
|
|
167
167
|
id: number;
|
|
@@ -260,7 +260,7 @@ import {
|
|
|
260
260
|
Grid,
|
|
261
261
|
type ColumnDefinition,
|
|
262
262
|
type CellRendererParams,
|
|
263
|
-
} from "gp-grid
|
|
263
|
+
} from "@gp-grid/react";
|
|
264
264
|
|
|
265
265
|
interface Order {
|
|
266
266
|
id: number;
|
|
@@ -367,7 +367,7 @@ import {
|
|
|
367
367
|
createClientDataSource,
|
|
368
368
|
type ColumnDefinition,
|
|
369
369
|
type EditRendererParams,
|
|
370
|
-
} from "gp-grid
|
|
370
|
+
} from "@gp-grid/react";
|
|
371
371
|
|
|
372
372
|
interface Task {
|
|
373
373
|
id: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,21 @@ interface FillHandleState {
|
|
|
59
59
|
/** Target column */
|
|
60
60
|
targetCol: number;
|
|
61
61
|
}
|
|
62
|
+
/** Event emitted when a cell value is changed via editing or fill drag */
|
|
63
|
+
interface CellValueChangedEvent<TData = Row> {
|
|
64
|
+
/** Stable row ID (from getRowId) */
|
|
65
|
+
rowId: RowId;
|
|
66
|
+
/** Column index */
|
|
67
|
+
colIndex: number;
|
|
68
|
+
/** Column field name */
|
|
69
|
+
field: string;
|
|
70
|
+
/** Previous cell value */
|
|
71
|
+
oldValue: CellValue;
|
|
72
|
+
/** New cell value */
|
|
73
|
+
newValue: CellValue;
|
|
74
|
+
/** The full row data object */
|
|
75
|
+
rowData: TData;
|
|
76
|
+
}
|
|
62
77
|
//#endregion
|
|
63
78
|
//#region ../core/src/types/highlighting.d.ts
|
|
64
79
|
/**
|
|
@@ -503,6 +518,8 @@ interface GridCoreOptions<TData = Row> {
|
|
|
503
518
|
getRowId?: (row: TData) => RowId;
|
|
504
519
|
/** Row/column/cell highlighting configuration */
|
|
505
520
|
highlighting?: HighlightingOptions<TData>;
|
|
521
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
522
|
+
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
506
523
|
}
|
|
507
524
|
//#endregion
|
|
508
525
|
//#region ../core/src/types/input.d.ts
|
|
@@ -1029,6 +1046,8 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1029
1046
|
private headerHeight;
|
|
1030
1047
|
private overscan;
|
|
1031
1048
|
private sortingEnabled;
|
|
1049
|
+
private getRowId?;
|
|
1050
|
+
private onCellValueChanged?;
|
|
1032
1051
|
private scrollTop;
|
|
1033
1052
|
private scrollLeft;
|
|
1034
1053
|
private viewportWidth;
|
|
@@ -1055,6 +1074,7 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1055
1074
|
private virtualContentHeight;
|
|
1056
1075
|
private scrollRatio;
|
|
1057
1076
|
private isDestroyed;
|
|
1077
|
+
private _isDataLoading;
|
|
1058
1078
|
constructor(options: GridCoreOptions<TData>);
|
|
1059
1079
|
/**
|
|
1060
1080
|
* Initialize the grid and load initial data.
|
|
@@ -1089,6 +1109,7 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1089
1109
|
getEditState(): EditState | null;
|
|
1090
1110
|
getCellValue(row: number, col: number): CellValue;
|
|
1091
1111
|
setCellValue(row: number, col: number, value: CellValue): void;
|
|
1112
|
+
private clearSelectionIfInvalid;
|
|
1092
1113
|
private computeColumnPositions;
|
|
1093
1114
|
private emitContentSize;
|
|
1094
1115
|
private emitHeaders;
|
|
@@ -1140,6 +1161,12 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1140
1161
|
* Refresh data from the data source.
|
|
1141
1162
|
*/
|
|
1142
1163
|
refresh(): Promise<void>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Fast-path refresh for transaction-based mutations.
|
|
1166
|
+
* Only re-fetches the visible window instead of all rows.
|
|
1167
|
+
* Use this when data was mutated via MutableDataSource transactions.
|
|
1168
|
+
*/
|
|
1169
|
+
refreshFromTransaction(): Promise<void>;
|
|
1143
1170
|
/**
|
|
1144
1171
|
* Refresh slot display without refetching data.
|
|
1145
1172
|
* Useful after in-place data modifications like fill operations.
|
|
@@ -1172,6 +1199,8 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1172
1199
|
setRow(index: number, data: TData): void;
|
|
1173
1200
|
/**
|
|
1174
1201
|
* Update the data source and refresh.
|
|
1202
|
+
* Preserves grid state (sort, filter, scroll position).
|
|
1203
|
+
* Cancels any active edit and clamps selection to valid range.
|
|
1175
1204
|
*/
|
|
1176
1205
|
setDataSource(dataSource: DataSource<TData>): Promise<void>;
|
|
1177
1206
|
/**
|
|
@@ -1272,10 +1301,15 @@ interface MutableClientDataSourceOptions<TData> {
|
|
|
1272
1301
|
debounceMs?: number;
|
|
1273
1302
|
/** Callback when transactions are processed. */
|
|
1274
1303
|
onTransactionProcessed?: (result: TransactionResult) => void;
|
|
1304
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1305
|
+
useWorker?: boolean;
|
|
1306
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1307
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1275
1308
|
}
|
|
1276
1309
|
/**
|
|
1277
1310
|
* Creates a mutable client-side data source with transaction support.
|
|
1278
1311
|
* Uses IndexedDataStore for efficient incremental operations.
|
|
1312
|
+
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
1279
1313
|
*/
|
|
1280
1314
|
declare function createMutableClientDataSource<TData extends Row = Row>(data: TData[], options: MutableClientDataSourceOptions<TData>): MutableDataSource<TData>;
|
|
1281
1315
|
//#endregion
|
|
@@ -1331,6 +1365,14 @@ interface GridProps<TData extends Row = Row> {
|
|
|
1331
1365
|
gridRef?: React.MutableRefObject<GridRef<TData> | null>;
|
|
1332
1366
|
/** Row/column/cell highlighting configuration */
|
|
1333
1367
|
highlighting?: HighlightingOptions<TData>;
|
|
1368
|
+
/** Function to extract unique ID from row. Required when onCellValueChanged is provided. */
|
|
1369
|
+
getRowId?: (row: TData) => RowId;
|
|
1370
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
1371
|
+
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
1372
|
+
/** Custom loading component to render instead of default spinner */
|
|
1373
|
+
loadingComponent?: React.ComponentType<{
|
|
1374
|
+
isLoading: boolean;
|
|
1375
|
+
}>;
|
|
1334
1376
|
}
|
|
1335
1377
|
//#endregion
|
|
1336
1378
|
//#region src/Grid.d.ts
|
|
@@ -1341,5 +1383,52 @@ interface GridProps<TData extends Row = Row> {
|
|
|
1341
1383
|
*/
|
|
1342
1384
|
declare function Grid<TData extends Row = Row>(props: GridProps<TData>): React$1.ReactNode;
|
|
1343
1385
|
//#endregion
|
|
1344
|
-
|
|
1345
|
-
|
|
1386
|
+
//#region src/useGridData.d.ts
|
|
1387
|
+
interface UseGridDataOptions<TData> {
|
|
1388
|
+
/** Function to extract a unique ID from each row. Required. */
|
|
1389
|
+
getRowId: (row: TData) => RowId;
|
|
1390
|
+
/** Debounce time for batching transactions in ms. Default 50. */
|
|
1391
|
+
debounceMs?: number;
|
|
1392
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1393
|
+
useWorker?: boolean;
|
|
1394
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1395
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1396
|
+
}
|
|
1397
|
+
interface UseGridDataResult<TData> {
|
|
1398
|
+
/** The data source to pass to <Grid dataSource={...} />. */
|
|
1399
|
+
dataSource: MutableDataSource<TData>;
|
|
1400
|
+
/** Update a single row by ID with partial data. */
|
|
1401
|
+
updateRow: (id: RowId, data: Partial<TData>) => void;
|
|
1402
|
+
/** Add rows to the data source. */
|
|
1403
|
+
addRows: (rows: TData[]) => void;
|
|
1404
|
+
/** Remove rows by ID. */
|
|
1405
|
+
removeRows: (ids: RowId[]) => void;
|
|
1406
|
+
/** Update a single cell value. */
|
|
1407
|
+
updateCell: (id: RowId, field: string, value: CellValue) => void;
|
|
1408
|
+
/** Clear all data from the data source. */
|
|
1409
|
+
clear: () => void;
|
|
1410
|
+
/** Get a row by its ID. */
|
|
1411
|
+
getRowById: (id: RowId) => TData | undefined;
|
|
1412
|
+
/** Get the current total row count. */
|
|
1413
|
+
getTotalRowCount: () => number;
|
|
1414
|
+
/** Force immediate processing of queued transactions. */
|
|
1415
|
+
flushTransactions: () => Promise<void>;
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* React hook for efficient grid data mutations.
|
|
1419
|
+
*
|
|
1420
|
+
* Wraps `createMutableClientDataSource` to provide a simple API for
|
|
1421
|
+
* updating grid data without triggering full pipeline rebuilds.
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* ```tsx
|
|
1425
|
+
* const { dataSource, updateRow, addRows } = useGridData(initialData, {
|
|
1426
|
+
* getRowId: (row) => row.id,
|
|
1427
|
+
* });
|
|
1428
|
+
*
|
|
1429
|
+
* return <Grid dataSource={dataSource} columns={columns} rowHeight={36} />;
|
|
1430
|
+
* ```
|
|
1431
|
+
*/
|
|
1432
|
+
declare const useGridData: <TData extends Row = Row>(initialData: TData[], options: UseGridDataOptions<TData>) => UseGridDataResult<TData>;
|
|
1433
|
+
//#endregion
|
|
1434
|
+
export { type CellDataType, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type ColumnDefinition, type ColumnFilterModel, type DataSource, type DataSourceRequest, type DataSourceResponse, type EditRendererParams, type FilterCondition, type FilterModel, Grid, GridCore, type GridInstruction, type GridProps, type GridRef, type HeaderRendererParams, type MutableDataSource, type ReactCellRenderer, type ReactEditRenderer, type ReactHeaderRenderer, type Row, type RowId, type SortDirection, type SortModel, type UseGridDataOptions, type UseGridDataResult, createClientDataSource, createDataSourceFromArray, createMutableClientDataSource, createServerDataSource, useGridData };
|