@gp-grid/vue 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 +114 -9
- package/dist/index.js +1 -1934
- package/package.json +8 -8
- 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/vue 🏁 🏎️
|
|
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 Vue 3 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 Vue 3 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,14 +47,14 @@ A high-performance, feature lean Vue 3 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/vue
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Quick Start
|
|
54
54
|
|
|
55
55
|
```vue
|
|
56
56
|
<script setup lang="ts">
|
|
57
|
-
import { GpGrid, type ColumnDefinition } from "gp-grid
|
|
57
|
+
import { GpGrid, type ColumnDefinition } from "@gp-grid/vue";
|
|
58
58
|
|
|
59
59
|
interface Person {
|
|
60
60
|
id: number;
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
GpGrid,
|
|
98
98
|
createClientDataSource,
|
|
99
99
|
type ColumnDefinition,
|
|
100
|
-
} from "gp-grid
|
|
100
|
+
} from "@gp-grid/vue";
|
|
101
101
|
|
|
102
102
|
interface Product {
|
|
103
103
|
id: number;
|
|
@@ -155,7 +155,7 @@ import {
|
|
|
155
155
|
type ColumnDefinition,
|
|
156
156
|
type DataSourceRequest,
|
|
157
157
|
type DataSourceResponse,
|
|
158
|
-
} from "gp-grid
|
|
158
|
+
} from "@gp-grid/vue";
|
|
159
159
|
|
|
160
160
|
interface User {
|
|
161
161
|
id: number;
|
|
@@ -251,7 +251,7 @@ import {
|
|
|
251
251
|
type ColumnDefinition,
|
|
252
252
|
type CellRendererParams,
|
|
253
253
|
type VueCellRenderer,
|
|
254
|
-
} from "gp-grid
|
|
254
|
+
} from "@gp-grid/vue";
|
|
255
255
|
|
|
256
256
|
interface Order {
|
|
257
257
|
id: number;
|
|
@@ -363,7 +363,7 @@ import {
|
|
|
363
363
|
type ColumnDefinition,
|
|
364
364
|
type EditRendererParams,
|
|
365
365
|
type VueEditRenderer,
|
|
366
|
-
} from "gp-grid
|
|
366
|
+
} from "@gp-grid/vue";
|
|
367
367
|
|
|
368
368
|
interface Task {
|
|
369
369
|
id: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue0 from "vue";
|
|
2
|
-
import { Component, ComputedRef, Ref, ShallowRef, VNode } from "vue";
|
|
2
|
+
import { Component as Component$1, ComputedRef, Ref, ShallowRef, VNode } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region ../core/src/types/basic.d.ts
|
|
5
5
|
/** Cell data type primitive types */
|
|
@@ -60,6 +60,21 @@ interface FillHandleState {
|
|
|
60
60
|
/** Target column */
|
|
61
61
|
targetCol: number;
|
|
62
62
|
}
|
|
63
|
+
/** Event emitted when a cell value is changed via editing or fill drag */
|
|
64
|
+
interface CellValueChangedEvent<TData = Row> {
|
|
65
|
+
/** Stable row ID (from getRowId) */
|
|
66
|
+
rowId: RowId;
|
|
67
|
+
/** Column index */
|
|
68
|
+
colIndex: number;
|
|
69
|
+
/** Column field name */
|
|
70
|
+
field: string;
|
|
71
|
+
/** Previous cell value */
|
|
72
|
+
oldValue: CellValue;
|
|
73
|
+
/** New cell value */
|
|
74
|
+
newValue: CellValue;
|
|
75
|
+
/** The full row data object */
|
|
76
|
+
rowData: TData;
|
|
77
|
+
}
|
|
63
78
|
//#endregion
|
|
64
79
|
//#region ../core/src/types/highlighting.d.ts
|
|
65
80
|
/**
|
|
@@ -504,6 +519,8 @@ interface GridCoreOptions<TData = Row> {
|
|
|
504
519
|
getRowId?: (row: TData) => RowId;
|
|
505
520
|
/** Row/column/cell highlighting configuration */
|
|
506
521
|
highlighting?: HighlightingOptions<TData>;
|
|
522
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
523
|
+
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
507
524
|
}
|
|
508
525
|
//#endregion
|
|
509
526
|
//#region ../core/src/types/input.d.ts
|
|
@@ -1081,6 +1098,8 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1081
1098
|
private headerHeight;
|
|
1082
1099
|
private overscan;
|
|
1083
1100
|
private sortingEnabled;
|
|
1101
|
+
private getRowId?;
|
|
1102
|
+
private onCellValueChanged?;
|
|
1084
1103
|
private scrollTop;
|
|
1085
1104
|
private scrollLeft;
|
|
1086
1105
|
private viewportWidth;
|
|
@@ -1107,6 +1126,7 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1107
1126
|
private virtualContentHeight;
|
|
1108
1127
|
private scrollRatio;
|
|
1109
1128
|
private isDestroyed;
|
|
1129
|
+
private _isDataLoading;
|
|
1110
1130
|
constructor(options: GridCoreOptions<TData>);
|
|
1111
1131
|
/**
|
|
1112
1132
|
* Initialize the grid and load initial data.
|
|
@@ -1141,6 +1161,7 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1141
1161
|
getEditState(): EditState | null;
|
|
1142
1162
|
getCellValue(row: number, col: number): CellValue;
|
|
1143
1163
|
setCellValue(row: number, col: number, value: CellValue): void;
|
|
1164
|
+
private clearSelectionIfInvalid;
|
|
1144
1165
|
private computeColumnPositions;
|
|
1145
1166
|
private emitContentSize;
|
|
1146
1167
|
private emitHeaders;
|
|
@@ -1192,6 +1213,12 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1192
1213
|
* Refresh data from the data source.
|
|
1193
1214
|
*/
|
|
1194
1215
|
refresh(): Promise<void>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Fast-path refresh for transaction-based mutations.
|
|
1218
|
+
* Only re-fetches the visible window instead of all rows.
|
|
1219
|
+
* Use this when data was mutated via MutableDataSource transactions.
|
|
1220
|
+
*/
|
|
1221
|
+
refreshFromTransaction(): Promise<void>;
|
|
1195
1222
|
/**
|
|
1196
1223
|
* Refresh slot display without refetching data.
|
|
1197
1224
|
* Useful after in-place data modifications like fill operations.
|
|
@@ -1224,6 +1251,8 @@ declare class GridCore<TData extends Row = Row> {
|
|
|
1224
1251
|
setRow(index: number, data: TData): void;
|
|
1225
1252
|
/**
|
|
1226
1253
|
* Update the data source and refresh.
|
|
1254
|
+
* Preserves grid state (sort, filter, scroll position).
|
|
1255
|
+
* Cancels any active edit and clamps selection to valid range.
|
|
1227
1256
|
*/
|
|
1228
1257
|
setDataSource(dataSource: DataSource<TData>): Promise<void>;
|
|
1229
1258
|
/**
|
|
@@ -1324,10 +1353,15 @@ interface MutableClientDataSourceOptions<TData> {
|
|
|
1324
1353
|
debounceMs?: number;
|
|
1325
1354
|
/** Callback when transactions are processed. */
|
|
1326
1355
|
onTransactionProcessed?: (result: TransactionResult) => void;
|
|
1356
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1357
|
+
useWorker?: boolean;
|
|
1358
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1359
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1327
1360
|
}
|
|
1328
1361
|
/**
|
|
1329
1362
|
* Creates a mutable client-side data source with transaction support.
|
|
1330
1363
|
* Uses IndexedDataStore for efficient incremental operations.
|
|
1364
|
+
* For large datasets, sorting is automatically offloaded to a Web Worker.
|
|
1331
1365
|
*/
|
|
1332
1366
|
declare function createMutableClientDataSource<TData extends Row = Row>(data: TData[], options: MutableClientDataSourceOptions<TData>): MutableDataSource<TData>;
|
|
1333
1367
|
//#endregion
|
|
@@ -1421,12 +1455,20 @@ interface GpGridProps<TData extends Row = Row> {
|
|
|
1421
1455
|
sortingEnabled?: boolean;
|
|
1422
1456
|
darkMode?: boolean;
|
|
1423
1457
|
wheelDampening?: number;
|
|
1424
|
-
cellRenderers?: Record<string, VueCellRenderer<TData> | Component>;
|
|
1425
|
-
editRenderers?: Record<string, VueEditRenderer<TData> | Component>;
|
|
1426
|
-
headerRenderers?: Record<string, VueHeaderRenderer | Component>;
|
|
1427
|
-
cellRenderer?: VueCellRenderer<TData> | Component;
|
|
1428
|
-
editRenderer?: VueEditRenderer<TData> | Component;
|
|
1429
|
-
headerRenderer?: VueHeaderRenderer | Component;
|
|
1458
|
+
cellRenderers?: Record<string, VueCellRenderer<TData> | Component$1>;
|
|
1459
|
+
editRenderers?: Record<string, VueEditRenderer<TData> | Component$1>;
|
|
1460
|
+
headerRenderers?: Record<string, VueHeaderRenderer | Component$1>;
|
|
1461
|
+
cellRenderer?: VueCellRenderer<TData> | Component$1;
|
|
1462
|
+
editRenderer?: VueEditRenderer<TData> | Component$1;
|
|
1463
|
+
headerRenderer?: VueHeaderRenderer | Component$1;
|
|
1464
|
+
/** Function to extract unique ID from row. Required when onCellValueChanged is provided. */
|
|
1465
|
+
getRowId?: (row: TData) => RowId;
|
|
1466
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
1467
|
+
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
1468
|
+
/** Custom loading component to render instead of default spinner */
|
|
1469
|
+
loadingComponent?: Component$1<{
|
|
1470
|
+
isLoading: boolean;
|
|
1471
|
+
}>;
|
|
1430
1472
|
}
|
|
1431
1473
|
//#endregion
|
|
1432
1474
|
//#region src/GpGrid.vue.d.ts
|
|
@@ -1452,6 +1494,14 @@ type __VLS_Props = {
|
|
|
1452
1494
|
initialHeight?: number;
|
|
1453
1495
|
/** Row/column/cell highlighting configuration */
|
|
1454
1496
|
highlighting?: HighlightingOptions<Row>;
|
|
1497
|
+
/** Function to extract unique ID from row. Required when onCellValueChanged is provided. */
|
|
1498
|
+
getRowId?: (row: Row) => RowId;
|
|
1499
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
1500
|
+
onCellValueChanged?: (event: CellValueChangedEvent<Row>) => void;
|
|
1501
|
+
/** Custom loading component to render instead of default spinner */
|
|
1502
|
+
loadingComponent?: Component<{
|
|
1503
|
+
isLoading: boolean;
|
|
1504
|
+
}>;
|
|
1455
1505
|
};
|
|
1456
1506
|
declare const __VLS_export: vue0.DefineComponent<__VLS_Props, {
|
|
1457
1507
|
core: vue0.ShallowRef<GridCore<unknown> | null, GridCore<unknown> | null>;
|
|
@@ -1478,6 +1528,10 @@ interface UseGpGridOptions<TData extends Row = Row> {
|
|
|
1478
1528
|
darkMode?: boolean;
|
|
1479
1529
|
wheelDampening?: number;
|
|
1480
1530
|
highlighting?: HighlightingOptions<TData>;
|
|
1531
|
+
/** Function to extract unique ID from row. Required when onCellValueChanged is provided. */
|
|
1532
|
+
getRowId?: (row: TData) => RowId;
|
|
1533
|
+
/** Called when a cell value is changed via editing or fill drag. Requires getRowId. */
|
|
1534
|
+
onCellValueChanged?: (event: CellValueChangedEvent<TData>) => void;
|
|
1481
1535
|
cellRenderers?: Record<string, VueCellRenderer<TData>>;
|
|
1482
1536
|
editRenderers?: Record<string, VueEditRenderer<TData>>;
|
|
1483
1537
|
headerRenderers?: Record<string, VueHeaderRenderer>;
|
|
@@ -1535,6 +1589,58 @@ interface UseGpGridResult<TData extends Row = Row> {
|
|
|
1535
1589
|
*/
|
|
1536
1590
|
declare function useGpGrid<TData extends Row = Row>(options: UseGpGridOptions<TData>): UseGpGridResult<TData>;
|
|
1537
1591
|
//#endregion
|
|
1592
|
+
//#region src/composables/useGridData.d.ts
|
|
1593
|
+
interface UseGridDataOptions<TData> {
|
|
1594
|
+
/** Function to extract a unique ID from each row. Required. */
|
|
1595
|
+
getRowId: (row: TData) => RowId;
|
|
1596
|
+
/** Debounce time for batching transactions in ms. Default 50. */
|
|
1597
|
+
debounceMs?: number;
|
|
1598
|
+
/** Use Web Worker for sorting large datasets (default: true) */
|
|
1599
|
+
useWorker?: boolean;
|
|
1600
|
+
/** Options for parallel sorting (only used when useWorker is true) */
|
|
1601
|
+
parallelSort?: ParallelSortOptions | false;
|
|
1602
|
+
}
|
|
1603
|
+
interface UseGridDataResult<TData> {
|
|
1604
|
+
/** The data source to pass to <GpGrid :data-source="dataSource" />. */
|
|
1605
|
+
dataSource: MutableDataSource<TData>;
|
|
1606
|
+
/** Update a single row by ID with partial data. */
|
|
1607
|
+
updateRow: (id: RowId, data: Partial<TData>) => void;
|
|
1608
|
+
/** Add rows to the data source. */
|
|
1609
|
+
addRows: (rows: TData[]) => void;
|
|
1610
|
+
/** Remove rows by ID. */
|
|
1611
|
+
removeRows: (ids: RowId[]) => void;
|
|
1612
|
+
/** Update a single cell value. */
|
|
1613
|
+
updateCell: (id: RowId, field: string, value: CellValue) => void;
|
|
1614
|
+
/** Clear all data from the data source. */
|
|
1615
|
+
clear: () => void;
|
|
1616
|
+
/** Get a row by its ID. */
|
|
1617
|
+
getRowById: (id: RowId) => TData | undefined;
|
|
1618
|
+
/** Get the current total row count. */
|
|
1619
|
+
getTotalRowCount: () => number;
|
|
1620
|
+
/** Force immediate processing of queued transactions. */
|
|
1621
|
+
flushTransactions: () => Promise<void>;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Vue composable for efficient grid data mutations.
|
|
1625
|
+
*
|
|
1626
|
+
* Wraps `createMutableClientDataSource` to provide a simple API for
|
|
1627
|
+
* updating grid data without triggering full pipeline rebuilds.
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```vue
|
|
1631
|
+
* <script setup>
|
|
1632
|
+
* const { dataSource, updateRow, addRows } = useGridData(initialData, {
|
|
1633
|
+
* getRowId: (row) => row.id,
|
|
1634
|
+
* });
|
|
1635
|
+
* </script>
|
|
1636
|
+
*
|
|
1637
|
+
* <template>
|
|
1638
|
+
* <GpGrid :data-source="dataSource" :columns="columns" :row-height="36" />
|
|
1639
|
+
* </template>
|
|
1640
|
+
* ```
|
|
1641
|
+
*/
|
|
1642
|
+
declare const useGridData: <TData extends Row = Row>(initialData: TData[], options: UseGridDataOptions<TData>) => UseGridDataResult<TData>;
|
|
1643
|
+
//#endregion
|
|
1538
1644
|
//#region src/composables/useInputHandler.d.ts
|
|
1539
1645
|
interface VisibleColumnInfo$1 {
|
|
1540
1646
|
column: ColumnDefinition;
|
|
@@ -1817,5 +1923,4 @@ interface RenderHeaderOptions {
|
|
|
1817
1923
|
*/
|
|
1818
1924
|
declare function renderHeader(options: RenderHeaderOptions): VNode;
|
|
1819
1925
|
//#endregion
|
|
1820
|
-
export { type CellDataType, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type ColumnDefinition, type ColumnFilterModel, type ContainerBounds, type DataSource, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DragState, type EditRendererParams, type FilterCondition, type FilterModel, type FilterPopupState, _default as GpGrid, _default as default, type GpGridProps, GridCore, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type KeyEventData, type LocalFilterCondition, type MutableDataSource, type NumberFilterCondition, type PointerEventData, type Row, type RowId, type SelectionState, type SlotData, type SortDirection, type SortModel, type TextFilterCondition, type UseFillHandleOptions, type UseFillHandleResult, type UseFilterConditionsResult, type UseFilterPopupOptions, type UseGpGridOptions, type UseGpGridResult, type UseInputHandlerOptions, type UseInputHandlerResult, type VueCellRenderer, type VueEditRenderer, type VueHeaderRenderer, buildCellClasses, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, findColumnAtX, getCellValue, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, renderCell, renderEditCell, renderHeader, useAutoScroll, useFillHandle, useFilterConditions, useFilterPopup, useGpGrid, useGridState, useInputHandler };
|
|
1821
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1926
|
+
export { type CellDataType, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type ColumnDefinition, type ColumnFilterModel, type ContainerBounds, type DataSource, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DragState, type EditRendererParams, type FilterCondition, type FilterModel, type FilterPopupState, _default as GpGrid, _default as default, type GpGridProps, GridCore, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type KeyEventData, type LocalFilterCondition, type MutableDataSource, type NumberFilterCondition, type PointerEventData, type Row, type RowId, type SelectionState, type SlotData, type SortDirection, type SortModel, type TextFilterCondition, type UseFillHandleOptions, type UseFillHandleResult, type UseFilterConditionsResult, type UseFilterPopupOptions, type UseGpGridOptions, type UseGpGridResult, type UseGridDataOptions, type UseGridDataResult, type UseInputHandlerOptions, type UseInputHandlerResult, type VueCellRenderer, type VueEditRenderer, type VueHeaderRenderer, buildCellClasses, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, findColumnAtX, getCellValue, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, renderCell, renderEditCell, renderHeader, useAutoScroll, useFillHandle, useFilterConditions, useFilterPopup, useGpGrid, useGridData, useGridState, useInputHandler };
|