gp-grid-react 0.1.2 → 0.1.4
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 +203 -0
- package/README.md +593 -520
- package/dist/index.d.ts +89 -6
- package/dist/index.js +35 -15
- package/dist/index.js.map +1 -1
- package/package.json +50 -10
- package/src/Grid.tsx +0 -1334
- package/src/SlotRow.tsx +0 -258
- package/src/index.ts +0 -47
- package/src/styles.ts +0 -440
- package/tsconfig.json +0 -29
- package/tsdown.config.ts +0 -11
- package/vitest.config.ts +0 -16
package/src/styles.ts
DELETED
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
// packages/react/src/styles.ts
|
|
2
|
-
// Dynamic CSS injection for gp-grid-react
|
|
3
|
-
|
|
4
|
-
const STYLE_ID = "gp-grid-styles";
|
|
5
|
-
|
|
6
|
-
export const gridStyles = `
|
|
7
|
-
/* =============================================================================
|
|
8
|
-
GP Grid - CSS Variables for Theming
|
|
9
|
-
============================================================================= */
|
|
10
|
-
|
|
11
|
-
.gp-grid-container {
|
|
12
|
-
/* Colors - Light Mode (default) */
|
|
13
|
-
--gp-grid-bg: #ffffff;
|
|
14
|
-
--gp-grid-bg-alt: #f8f9fa;
|
|
15
|
-
--gp-grid-text: #212529;
|
|
16
|
-
--gp-grid-text-secondary: #6c757d;
|
|
17
|
-
--gp-grid-text-muted: #adb5bd;
|
|
18
|
-
--gp-grid-border: #dee2e6;
|
|
19
|
-
--gp-grid-border-light: #e9ecef;
|
|
20
|
-
|
|
21
|
-
/* Header */
|
|
22
|
-
--gp-grid-header-bg: #f1f3f5;
|
|
23
|
-
--gp-grid-header-text: #212529;
|
|
24
|
-
|
|
25
|
-
/* Selection */
|
|
26
|
-
--gp-grid-primary: #228be6;
|
|
27
|
-
--gp-grid-primary-light: #e7f5ff;
|
|
28
|
-
--gp-grid-primary-border: #74c0fc;
|
|
29
|
-
--gp-grid-hover: #f1f3f5;
|
|
30
|
-
|
|
31
|
-
/* Filter */
|
|
32
|
-
--gp-grid-filter-bg: #f8f9fa;
|
|
33
|
-
--gp-grid-input-bg: #ffffff;
|
|
34
|
-
--gp-grid-input-border: #ced4da;
|
|
35
|
-
|
|
36
|
-
/* Error */
|
|
37
|
-
--gp-grid-error-bg: #fff5f5;
|
|
38
|
-
--gp-grid-error-text: #c92a2a;
|
|
39
|
-
|
|
40
|
-
/* Loading */
|
|
41
|
-
--gp-grid-loading-bg: rgba(255, 255, 255, 0.95);
|
|
42
|
-
--gp-grid-loading-text: #495057;
|
|
43
|
-
|
|
44
|
-
/* Scrollbar */
|
|
45
|
-
--gp-grid-scrollbar-track: #f1f3f5;
|
|
46
|
-
--gp-grid-scrollbar-thumb: #ced4da;
|
|
47
|
-
--gp-grid-scrollbar-thumb-hover: #adb5bd;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* Dark Mode */
|
|
51
|
-
.gp-grid-container--dark {
|
|
52
|
-
--gp-grid-bg: #1a1b1e;
|
|
53
|
-
--gp-grid-bg-alt: #25262b;
|
|
54
|
-
--gp-grid-text: #c1c2c5;
|
|
55
|
-
--gp-grid-text-secondary: #909296;
|
|
56
|
-
--gp-grid-text-muted: #5c5f66;
|
|
57
|
-
--gp-grid-border: #373a40;
|
|
58
|
-
--gp-grid-border-light: #2c2e33;
|
|
59
|
-
|
|
60
|
-
/* Header */
|
|
61
|
-
--gp-grid-header-bg: #25262b;
|
|
62
|
-
--gp-grid-header-text: #c1c2c5;
|
|
63
|
-
|
|
64
|
-
/* Selection */
|
|
65
|
-
--gp-grid-primary: #339af0;
|
|
66
|
-
--gp-grid-primary-light: #1c3d5a;
|
|
67
|
-
--gp-grid-primary-border: #1c7ed6;
|
|
68
|
-
--gp-grid-hover: #2c2e33;
|
|
69
|
-
|
|
70
|
-
/* Filter */
|
|
71
|
-
--gp-grid-filter-bg: #25262b;
|
|
72
|
-
--gp-grid-input-bg: #1a1b1e;
|
|
73
|
-
--gp-grid-input-border: #373a40;
|
|
74
|
-
|
|
75
|
-
/* Error */
|
|
76
|
-
--gp-grid-error-bg: #2c1a1a;
|
|
77
|
-
--gp-grid-error-text: #ff6b6b;
|
|
78
|
-
|
|
79
|
-
/* Loading */
|
|
80
|
-
--gp-grid-loading-bg: rgba(26, 27, 30, 0.95);
|
|
81
|
-
--gp-grid-loading-text: #c1c2c5;
|
|
82
|
-
|
|
83
|
-
/* Scrollbar */
|
|
84
|
-
--gp-grid-scrollbar-track: #25262b;
|
|
85
|
-
--gp-grid-scrollbar-thumb: #373a40;
|
|
86
|
-
--gp-grid-scrollbar-thumb-hover: #4a4d52;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/* =============================================================================
|
|
90
|
-
GP Grid - Clean Flat Design
|
|
91
|
-
============================================================================= */
|
|
92
|
-
|
|
93
|
-
/* Grid Container */
|
|
94
|
-
.gp-grid-container {
|
|
95
|
-
outline: none;
|
|
96
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
97
|
-
font-size: 13px;
|
|
98
|
-
line-height: 1.5;
|
|
99
|
-
color: var(--gp-grid-text);
|
|
100
|
-
background-color: var(--gp-grid-bg);
|
|
101
|
-
border: 1px solid var(--gp-grid-border);
|
|
102
|
-
border-radius: 6px;
|
|
103
|
-
user-select: none;
|
|
104
|
-
-webkit-user-select: none;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.gp-grid-container:focus {
|
|
108
|
-
outline: none;
|
|
109
|
-
border-color: var(--gp-grid-primary);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/* =============================================================================
|
|
113
|
-
Header
|
|
114
|
-
============================================================================= */
|
|
115
|
-
|
|
116
|
-
.gp-grid-header {
|
|
117
|
-
position: sticky;
|
|
118
|
-
top: 0;
|
|
119
|
-
left: 0;
|
|
120
|
-
z-index: 100;
|
|
121
|
-
background-color: var(--gp-grid-header-bg);
|
|
122
|
-
border-bottom: 1px solid var(--gp-grid-border);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.gp-grid-container .gp-grid-header-cell {
|
|
126
|
-
position: absolute;
|
|
127
|
-
box-sizing: border-box;
|
|
128
|
-
border-right: 1px solid var(--gp-grid-border);
|
|
129
|
-
font-weight: 600;
|
|
130
|
-
font-size: 12px;
|
|
131
|
-
text-transform: uppercase;
|
|
132
|
-
letter-spacing: 0.5px;
|
|
133
|
-
color: var(--gp-grid-header-text);
|
|
134
|
-
cursor: pointer;
|
|
135
|
-
user-select: none;
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
padding: 0 12px;
|
|
139
|
-
background-color: transparent;
|
|
140
|
-
transition: background-color 0.1s ease;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.gp-grid-container .gp-grid-header-cell:hover {
|
|
144
|
-
background-color: var(--gp-grid-hover);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.gp-grid-container .gp-grid-header-cell:active {
|
|
148
|
-
background-color: var(--gp-grid-border-light);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.gp-grid-container .gp-grid-header-text {
|
|
152
|
-
flex: 1;
|
|
153
|
-
overflow: hidden;
|
|
154
|
-
text-overflow: ellipsis;
|
|
155
|
-
white-space: nowrap;
|
|
156
|
-
color: var(--gp-grid-header-text);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.gp-grid-sort-indicator {
|
|
160
|
-
margin-left: 6px;
|
|
161
|
-
font-size: 10px;
|
|
162
|
-
color: var(--gp-grid-primary);
|
|
163
|
-
display: flex;
|
|
164
|
-
align-items: center;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.gp-grid-sort-index {
|
|
168
|
-
font-size: 9px;
|
|
169
|
-
margin-left: 2px;
|
|
170
|
-
color: var(--gp-grid-text-secondary);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* =============================================================================
|
|
174
|
-
Filter Row
|
|
175
|
-
============================================================================= */
|
|
176
|
-
|
|
177
|
-
.gp-grid-filter-row {
|
|
178
|
-
position: sticky;
|
|
179
|
-
left: 0;
|
|
180
|
-
z-index: 99;
|
|
181
|
-
background-color: var(--gp-grid-filter-bg);
|
|
182
|
-
border-bottom: 1px solid var(--gp-grid-border);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.gp-grid-filter-cell {
|
|
186
|
-
position: absolute;
|
|
187
|
-
box-sizing: border-box;
|
|
188
|
-
border-right: 1px solid var(--gp-grid-border);
|
|
189
|
-
padding: 6px 8px;
|
|
190
|
-
display: flex;
|
|
191
|
-
align-items: center;
|
|
192
|
-
background-color: var(--gp-grid-filter-bg);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.gp-grid-filter-input {
|
|
196
|
-
width: 100%;
|
|
197
|
-
height: 28px;
|
|
198
|
-
padding: 0 10px;
|
|
199
|
-
font-family: inherit;
|
|
200
|
-
font-size: 12px;
|
|
201
|
-
border: 1px solid var(--gp-grid-input-border);
|
|
202
|
-
border-radius: 4px;
|
|
203
|
-
background-color: var(--gp-grid-input-bg);
|
|
204
|
-
color: var(--gp-grid-text);
|
|
205
|
-
transition: border-color 0.15s ease;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.gp-grid-filter-input:focus {
|
|
209
|
-
outline: none;
|
|
210
|
-
border-color: var(--gp-grid-primary);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.gp-grid-filter-input::placeholder {
|
|
214
|
-
color: var(--gp-grid-text-muted);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* =============================================================================
|
|
218
|
-
Data Cells
|
|
219
|
-
============================================================================= */
|
|
220
|
-
|
|
221
|
-
.gp-grid-row {
|
|
222
|
-
position: absolute;
|
|
223
|
-
top: 0;
|
|
224
|
-
left: 0;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.gp-grid-cell {
|
|
228
|
-
position: absolute;
|
|
229
|
-
top: 0;
|
|
230
|
-
box-sizing: border-box;
|
|
231
|
-
padding: 0 12px;
|
|
232
|
-
display: flex;
|
|
233
|
-
align-items: center;
|
|
234
|
-
cursor: cell;
|
|
235
|
-
color: var(--gp-grid-text);
|
|
236
|
-
border-right: 1px solid var(--gp-grid-border-light);
|
|
237
|
-
border-bottom: 1px solid var(--gp-grid-border-light);
|
|
238
|
-
background-color: var(--gp-grid-bg);
|
|
239
|
-
overflow: hidden;
|
|
240
|
-
text-overflow: ellipsis;
|
|
241
|
-
white-space: nowrap;
|
|
242
|
-
user-select: none;
|
|
243
|
-
-webkit-user-select: none;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/* Alternating row colors */
|
|
247
|
-
.gp-grid-row--even .gp-grid-cell {
|
|
248
|
-
background-color: var(--gp-grid-bg-alt);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.gp-grid-cell:hover {
|
|
252
|
-
background-color: var(--gp-grid-hover) !important;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/* Active cell (focused) */
|
|
256
|
-
.gp-grid-cell--active {
|
|
257
|
-
background-color: var(--gp-grid-primary-light) !important;
|
|
258
|
-
border: 2px solid var(--gp-grid-primary) !important;
|
|
259
|
-
outline: none;
|
|
260
|
-
z-index: 5;
|
|
261
|
-
padding: 0 11px;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* Selected cells (range selection) */
|
|
265
|
-
.gp-grid-cell--selected {
|
|
266
|
-
background-color: var(--gp-grid-primary-light) !important;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/* Editing cell */
|
|
270
|
-
.gp-grid-cell--editing {
|
|
271
|
-
background-color: var(--gp-grid-bg) !important;
|
|
272
|
-
border: 2px solid var(--gp-grid-primary) !important;
|
|
273
|
-
padding: 0 !important;
|
|
274
|
-
z-index: 10;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/* =============================================================================
|
|
278
|
-
Fill Handle (drag to fill)
|
|
279
|
-
============================================================================= */
|
|
280
|
-
|
|
281
|
-
.gp-grid-fill-handle {
|
|
282
|
-
position: absolute;
|
|
283
|
-
width: 8px;
|
|
284
|
-
height: 8px;
|
|
285
|
-
background-color: var(--gp-grid-primary);
|
|
286
|
-
border: 2px solid var(--gp-grid-bg);
|
|
287
|
-
cursor: crosshair;
|
|
288
|
-
z-index: 100;
|
|
289
|
-
pointer-events: auto;
|
|
290
|
-
box-sizing: border-box;
|
|
291
|
-
border-radius: 1px;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.gp-grid-fill-handle:hover {
|
|
295
|
-
transform: scale(1.2);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/* Fill preview (cells being filled) */
|
|
299
|
-
.gp-grid-cell--fill-preview {
|
|
300
|
-
background-color: var(--gp-grid-primary-light) !important;
|
|
301
|
-
border: 1px dashed var(--gp-grid-primary) !important;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/* =============================================================================
|
|
305
|
-
Edit Input
|
|
306
|
-
============================================================================= */
|
|
307
|
-
|
|
308
|
-
.gp-grid-edit-input {
|
|
309
|
-
width: 100%;
|
|
310
|
-
height: 100%;
|
|
311
|
-
padding: 0 11px;
|
|
312
|
-
font-family: inherit;
|
|
313
|
-
font-size: inherit;
|
|
314
|
-
color: var(--gp-grid-text);
|
|
315
|
-
border: none;
|
|
316
|
-
background-color: transparent;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.gp-grid-edit-input:focus {
|
|
320
|
-
outline: none;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/* =============================================================================
|
|
324
|
-
Loading & Error States
|
|
325
|
-
============================================================================= */
|
|
326
|
-
|
|
327
|
-
.gp-grid-loading {
|
|
328
|
-
position: absolute;
|
|
329
|
-
top: 50%;
|
|
330
|
-
left: 50%;
|
|
331
|
-
transform: translate(-50%, -50%);
|
|
332
|
-
padding: 12px 20px;
|
|
333
|
-
background-color: var(--gp-grid-loading-bg);
|
|
334
|
-
color: var(--gp-grid-loading-text);
|
|
335
|
-
border-radius: 6px;
|
|
336
|
-
border: 1px solid var(--gp-grid-border);
|
|
337
|
-
font-weight: 500;
|
|
338
|
-
font-size: 13px;
|
|
339
|
-
z-index: 1000;
|
|
340
|
-
display: flex;
|
|
341
|
-
align-items: center;
|
|
342
|
-
gap: 10px;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.gp-grid-loading-spinner {
|
|
346
|
-
width: 16px;
|
|
347
|
-
height: 16px;
|
|
348
|
-
border: 2px solid var(--gp-grid-border);
|
|
349
|
-
border-top-color: var(--gp-grid-primary);
|
|
350
|
-
border-radius: 50%;
|
|
351
|
-
animation: gp-grid-spin 0.7s linear infinite;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
@keyframes gp-grid-spin {
|
|
355
|
-
to {
|
|
356
|
-
transform: rotate(360deg);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.gp-grid-error {
|
|
361
|
-
position: absolute;
|
|
362
|
-
top: 50%;
|
|
363
|
-
left: 50%;
|
|
364
|
-
transform: translate(-50%, -50%);
|
|
365
|
-
padding: 12px 20px;
|
|
366
|
-
background-color: var(--gp-grid-error-bg);
|
|
367
|
-
color: var(--gp-grid-error-text);
|
|
368
|
-
border-radius: 6px;
|
|
369
|
-
border: 1px solid var(--gp-grid-error-text);
|
|
370
|
-
font-weight: 500;
|
|
371
|
-
font-size: 13px;
|
|
372
|
-
z-index: 1000;
|
|
373
|
-
max-width: 80%;
|
|
374
|
-
text-align: center;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/* =============================================================================
|
|
378
|
-
Empty State
|
|
379
|
-
============================================================================= */
|
|
380
|
-
|
|
381
|
-
.gp-grid-empty {
|
|
382
|
-
position: absolute;
|
|
383
|
-
top: 50%;
|
|
384
|
-
left: 50%;
|
|
385
|
-
transform: translate(-50%, -50%);
|
|
386
|
-
color: var(--gp-grid-text-muted);
|
|
387
|
-
font-size: 14px;
|
|
388
|
-
text-align: center;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/* =============================================================================
|
|
392
|
-
Scrollbar Styling
|
|
393
|
-
============================================================================= */
|
|
394
|
-
|
|
395
|
-
.gp-grid-container::-webkit-scrollbar {
|
|
396
|
-
width: 8px;
|
|
397
|
-
height: 8px;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
.gp-grid-container::-webkit-scrollbar-track {
|
|
401
|
-
background-color: var(--gp-grid-scrollbar-track);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.gp-grid-container::-webkit-scrollbar-thumb {
|
|
405
|
-
background-color: var(--gp-grid-scrollbar-thumb);
|
|
406
|
-
border-radius: 4px;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.gp-grid-container::-webkit-scrollbar-thumb:hover {
|
|
410
|
-
background-color: var(--gp-grid-scrollbar-thumb-hover);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.gp-grid-container::-webkit-scrollbar-corner {
|
|
414
|
-
background-color: var(--gp-grid-scrollbar-track);
|
|
415
|
-
}
|
|
416
|
-
`;
|
|
417
|
-
|
|
418
|
-
let stylesInjected = false;
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Inject grid styles into the document head.
|
|
422
|
-
* This is called automatically when the Grid component mounts.
|
|
423
|
-
* Styles are only injected once, even if multiple Grid instances exist.
|
|
424
|
-
*/
|
|
425
|
-
export function injectStyles(): void {
|
|
426
|
-
if (stylesInjected) return;
|
|
427
|
-
if (typeof document === "undefined") return; // SSR safety
|
|
428
|
-
|
|
429
|
-
// Check if styles already exist (e.g., from a previous mount)
|
|
430
|
-
if (document.getElementById(STYLE_ID)) {
|
|
431
|
-
stylesInjected = true;
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const styleElement = document.createElement("style");
|
|
436
|
-
styleElement.id = STYLE_ID;
|
|
437
|
-
styleElement.textContent = gridStyles;
|
|
438
|
-
document.head.appendChild(styleElement);
|
|
439
|
-
stylesInjected = true;
|
|
440
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"lib": [
|
|
5
|
-
"ES2020",
|
|
6
|
-
"DOM",
|
|
7
|
-
"DOM.Iterable"
|
|
8
|
-
],
|
|
9
|
-
"module": "ESNext",
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"jsx": "react-jsx",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"noImplicitAny": false,
|
|
15
|
-
"strict": true,
|
|
16
|
-
"esModuleInterop": true,
|
|
17
|
-
"allowSyntheticDefaultImports": true,
|
|
18
|
-
"skipLibCheck": true,
|
|
19
|
-
"baseUrl": ".",
|
|
20
|
-
"paths": {
|
|
21
|
-
"gp-grid-core": [
|
|
22
|
-
"../core/src"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"include": [
|
|
27
|
-
"src"
|
|
28
|
-
]
|
|
29
|
-
}
|
package/tsdown.config.ts
DELETED
package/vitest.config.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [react()],
|
|
6
|
-
test: {
|
|
7
|
-
globals: true,
|
|
8
|
-
environment: 'happy-dom',
|
|
9
|
-
coverage: {
|
|
10
|
-
provider: 'v8',
|
|
11
|
-
reporter: ['text', 'json', 'html'],
|
|
12
|
-
include: ['src/**/*.tsx', 'src/**/*.ts'],
|
|
13
|
-
exclude: ['src/**/*.test.tsx', 'src/**/*.test.ts', 'src/**/*.bench.ts'],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|