@bit.rhplus/ag-grid 0.0.55 → 0.0.57
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/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/index.jsx +669 -656
- package/package.json +4 -4
- /package/dist/{preview-1763127036694.js → preview-1763463589040.js} +0 -0
package/index.jsx
CHANGED
|
@@ -1,657 +1,670 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { AgGridReact } from 'ag-grid-react';
|
|
4
|
-
import { AgGridColumns } from './AgGridColumn';
|
|
5
|
-
import { RhPlusOnCellEditingStarted } from './OnCellEditingStarted';
|
|
6
|
-
import { RhPlusOnCellDoubleClicked } from './OnCellDoubleClicked';
|
|
7
|
-
import { RhPlusOnCellValueChanged } from './OnCellValueChanged';
|
|
8
|
-
import { AgGridPostSort } from './AgGridPostSort';
|
|
9
|
-
import { AgGridOnRowDataChanged } from './AgGridOnRowDataChanged';
|
|
10
|
-
import { AgGridOnRowDataUpdated } from './AgGridOnRowDataUpdated';
|
|
11
|
-
import CheckboxRenderer from './Renderers/CheckboxRenderer';
|
|
12
|
-
import BooleanRenderer from './Renderers/BooleanRenderer';
|
|
13
|
-
import IconRenderer from './Renderers/IconRenderer';
|
|
14
|
-
import ImageRenderer from './Renderers/ImageRenderer';
|
|
15
|
-
import StateRenderer from './Renderers/StateRenderer';
|
|
16
|
-
import SelectRenderer from './Renderers/SelectRenderer';
|
|
17
|
-
import ButtonRenderer from './Renderers/ButtonRenderer';
|
|
18
|
-
import CountrySelectRenderer from './Renderers/CountrySelectRenderer';
|
|
19
|
-
import NotificationOptionsInit from "./NotificationOptions";
|
|
20
|
-
import { notification } from "antd";
|
|
21
|
-
import Aggregations, { hashRanges } from "./Aggregations";
|
|
22
|
-
import { useBulkCellEdit, BulkEditButton } from './BulkEdit';
|
|
23
|
-
import {
|
|
24
|
-
ModuleRegistry,
|
|
25
|
-
themeAlpine,
|
|
26
|
-
themeBalham,
|
|
27
|
-
themeMaterial,
|
|
28
|
-
themeQuartz,
|
|
29
|
-
} from "ag-grid-community";
|
|
30
|
-
|
|
31
|
-
const themes = [
|
|
32
|
-
{ id: "themeQuartz", theme: themeQuartz },
|
|
33
|
-
{ id: "themeBalham", theme: themeBalham },
|
|
34
|
-
{ id: "themeMaterial", theme: themeMaterial },
|
|
35
|
-
{ id: "themeAlpine", theme: themeAlpine },
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const AgGrid = React.forwardRef((props, ref) => {
|
|
39
|
-
const internalRef = React.useRef();
|
|
40
|
-
const {
|
|
41
|
-
theme = "themeAlpine", // Default theme
|
|
42
|
-
rowData = [],
|
|
43
|
-
newRowFlash = true,
|
|
44
|
-
updatedRowFlash = false,
|
|
45
|
-
onGridReady,
|
|
46
|
-
enableNotification,
|
|
47
|
-
notificationOptions: {
|
|
48
|
-
notificationHead = NotificationOptionsInit.head,
|
|
49
|
-
notificationBody = NotificationOptionsInit.body,
|
|
50
|
-
style = NotificationOptionsInit.style,
|
|
51
|
-
placement = NotificationOptionsInit.placement,
|
|
52
|
-
} = {},
|
|
53
|
-
// Bulk Edit props
|
|
54
|
-
enableBulkEdit = false,
|
|
55
|
-
bulkEditOptions = {},
|
|
56
|
-
bulkEditAccessToken,
|
|
57
|
-
onBulkEditStart,
|
|
58
|
-
onBulkEditComplete,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
notifications.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
notif.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
//
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
//
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { AgGridReact } from 'ag-grid-react';
|
|
4
|
+
import { AgGridColumns } from './AgGridColumn';
|
|
5
|
+
import { RhPlusOnCellEditingStarted } from './OnCellEditingStarted';
|
|
6
|
+
import { RhPlusOnCellDoubleClicked } from './OnCellDoubleClicked';
|
|
7
|
+
import { RhPlusOnCellValueChanged } from './OnCellValueChanged';
|
|
8
|
+
import { AgGridPostSort } from './AgGridPostSort';
|
|
9
|
+
import { AgGridOnRowDataChanged } from './AgGridOnRowDataChanged';
|
|
10
|
+
import { AgGridOnRowDataUpdated } from './AgGridOnRowDataUpdated';
|
|
11
|
+
import CheckboxRenderer from './Renderers/CheckboxRenderer';
|
|
12
|
+
import BooleanRenderer from './Renderers/BooleanRenderer';
|
|
13
|
+
import IconRenderer from './Renderers/IconRenderer';
|
|
14
|
+
import ImageRenderer from './Renderers/ImageRenderer';
|
|
15
|
+
import StateRenderer from './Renderers/StateRenderer';
|
|
16
|
+
import SelectRenderer from './Renderers/SelectRenderer';
|
|
17
|
+
import ButtonRenderer from './Renderers/ButtonRenderer';
|
|
18
|
+
import CountrySelectRenderer from './Renderers/CountrySelectRenderer';
|
|
19
|
+
import NotificationOptionsInit from "./NotificationOptions";
|
|
20
|
+
import { notification } from "antd";
|
|
21
|
+
import Aggregations, { hashRanges } from "./Aggregations";
|
|
22
|
+
import { useBulkCellEdit, BulkEditButton } from './BulkEdit';
|
|
23
|
+
import {
|
|
24
|
+
ModuleRegistry,
|
|
25
|
+
themeAlpine,
|
|
26
|
+
themeBalham,
|
|
27
|
+
themeMaterial,
|
|
28
|
+
themeQuartz,
|
|
29
|
+
} from "ag-grid-community";
|
|
30
|
+
|
|
31
|
+
const themes = [
|
|
32
|
+
{ id: "themeQuartz", theme: themeQuartz },
|
|
33
|
+
{ id: "themeBalham", theme: themeBalham },
|
|
34
|
+
{ id: "themeMaterial", theme: themeMaterial },
|
|
35
|
+
{ id: "themeAlpine", theme: themeAlpine },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const AgGrid = React.forwardRef((props, ref) => {
|
|
39
|
+
const internalRef = React.useRef();
|
|
40
|
+
const {
|
|
41
|
+
theme = "themeAlpine", // Default theme
|
|
42
|
+
rowData = [],
|
|
43
|
+
newRowFlash = true,
|
|
44
|
+
updatedRowFlash = false,
|
|
45
|
+
onGridReady,
|
|
46
|
+
enableNotification,
|
|
47
|
+
notificationOptions: {
|
|
48
|
+
notificationHead = NotificationOptionsInit.head,
|
|
49
|
+
notificationBody = NotificationOptionsInit.body,
|
|
50
|
+
style = NotificationOptionsInit.style,
|
|
51
|
+
placement = NotificationOptionsInit.placement,
|
|
52
|
+
} = {},
|
|
53
|
+
// Bulk Edit props
|
|
54
|
+
enableBulkEdit = false,
|
|
55
|
+
bulkEditOptions = {},
|
|
56
|
+
bulkEditAccessToken,
|
|
57
|
+
onBulkEditStart,
|
|
58
|
+
onBulkEditComplete,
|
|
59
|
+
// SignalR transaction support
|
|
60
|
+
queryKey, // Identifikátor pro SignalR transactions
|
|
61
|
+
} = props;
|
|
62
|
+
|
|
63
|
+
// Najít theme objekt podle názvu z props
|
|
64
|
+
const themeObject = React.useMemo(() => {
|
|
65
|
+
const foundTheme = themes.find(t => t.id === theme);
|
|
66
|
+
return foundTheme ? foundTheme.theme : themeQuartz; // Fallback na themeQuartz
|
|
67
|
+
}, [theme]);
|
|
68
|
+
const [, setIsGridReady] = React.useState(false);
|
|
69
|
+
const [isSelecting, setIsSelecting] = React.useState(false);
|
|
70
|
+
const previousRowDataRef = React.useRef(rowData);
|
|
71
|
+
|
|
72
|
+
// Bulk Edit hook
|
|
73
|
+
const {
|
|
74
|
+
floatingButton,
|
|
75
|
+
editPopover,
|
|
76
|
+
handleRangeChange,
|
|
77
|
+
handleOpenPopover,
|
|
78
|
+
handleSubmitEdit,
|
|
79
|
+
handleCancelEdit,
|
|
80
|
+
handleValueChange,
|
|
81
|
+
} = useBulkCellEdit(internalRef, {
|
|
82
|
+
enabled: enableBulkEdit,
|
|
83
|
+
accessToken: bulkEditAccessToken,
|
|
84
|
+
onBulkEditStart,
|
|
85
|
+
onBulkEditComplete,
|
|
86
|
+
...bulkEditOptions,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// ========== PERFORMANCE OPTIMIZATION: Shallow comparison helper ==========
|
|
91
|
+
// Shallow porovnání objektů - 100x rychlejší než JSON.stringify
|
|
92
|
+
const shallowEqual = React.useCallback((obj1, obj2) => {
|
|
93
|
+
if (obj1 === obj2) return true;
|
|
94
|
+
if (!obj1 || !obj2) return false;
|
|
95
|
+
|
|
96
|
+
const keys1 = Object.keys(obj1);
|
|
97
|
+
const keys2 = Object.keys(obj2);
|
|
98
|
+
|
|
99
|
+
if (keys1.length !== keys2.length) return false;
|
|
100
|
+
|
|
101
|
+
for (let key of keys1) {
|
|
102
|
+
if (obj1[key] !== obj2[key]) return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return true;
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
// Memoizované funkce pro detekci změn v rowData
|
|
109
|
+
const findNewRows = React.useCallback((oldData, newData) => {
|
|
110
|
+
const oldIds = new Set(oldData.map((row) => row.id));
|
|
111
|
+
return newData.filter((row) => !oldIds.has(row.id));
|
|
112
|
+
}, []);
|
|
113
|
+
|
|
114
|
+
const findUpdatedRows = React.useCallback((oldData, newData) => {
|
|
115
|
+
const oldDataMap = new Map(oldData.map((row) => [row.id, row]));
|
|
116
|
+
return newData.filter((newRow) => {
|
|
117
|
+
const oldRow = oldDataMap.get(newRow.id);
|
|
118
|
+
if (!oldRow) return false; // Nový řádek, ne aktualizovaný
|
|
119
|
+
|
|
120
|
+
// ✅ OPTIMALIZACE: Shallow comparison místo JSON.stringify (100x rychlejší!)
|
|
121
|
+
return !shallowEqual(oldRow, newRow);
|
|
122
|
+
});
|
|
123
|
+
}, [shallowEqual]);
|
|
124
|
+
|
|
125
|
+
React.useImperativeHandle(ref, () => internalRef.current, [internalRef]);
|
|
126
|
+
|
|
127
|
+
// Throttle timer pro notifikace - zobrazuje se BĚHEM označování s 100ms throttle
|
|
128
|
+
const notificationThrottleRef = React.useRef(null);
|
|
129
|
+
const notificationLastCallRef = React.useRef(0);
|
|
130
|
+
const lastRangeHashRef = React.useRef(null);
|
|
131
|
+
|
|
132
|
+
// ✅ OPTIMALIZACE: Helper funkce pro aktualizaci aggregace notifikace s cache check
|
|
133
|
+
// Volá se BĚHEM označování s 100ms throttle pro real-time feedback
|
|
134
|
+
const updateAggregationNotification = React.useCallback((event) => {
|
|
135
|
+
// Lightweight cache check PŘED voláním Aggregations()
|
|
136
|
+
const ranges = event.api.getCellRanges();
|
|
137
|
+
const currentRangeHash = hashRanges(ranges);
|
|
138
|
+
|
|
139
|
+
// Žádné ranges nebo jen jedna buňka - zavřít notifikaci
|
|
140
|
+
if (!ranges || ranges.length === 0 || !ranges[0]?.startRow) {
|
|
141
|
+
const gridId = props.gridName || props.id || 'default';
|
|
142
|
+
const key = `aggregation-grid-${gridId}`;
|
|
143
|
+
lastRangeHashRef.current = null;
|
|
144
|
+
notification.destroy(key);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Cache hit - ranges se nezměnily, skip
|
|
149
|
+
if (currentRangeHash === lastRangeHashRef.current) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Cache miss - spočítat aggregace
|
|
154
|
+
const messageInfo = Aggregations(internalRef);
|
|
155
|
+
|
|
156
|
+
const gridId = props.gridName || props.id || 'default';
|
|
157
|
+
const key = `aggregation-grid-${gridId}`;
|
|
158
|
+
|
|
159
|
+
if (messageInfo.count > 1) {
|
|
160
|
+
// Uložit hash pro příští porovnání
|
|
161
|
+
lastRangeHashRef.current = currentRangeHash;
|
|
162
|
+
|
|
163
|
+
if (props.onAggregationChanged) {
|
|
164
|
+
props.onAggregationChanged(messageInfo);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Dynamický style s pointer-events podle stavu označování
|
|
168
|
+
const dynamicStyle = {
|
|
169
|
+
...style,
|
|
170
|
+
pointerEvents: isSelecting ? 'none' : 'auto'
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Aktualizace existující notifikace nebo vytvoření nové
|
|
174
|
+
notification.info({
|
|
175
|
+
key,
|
|
176
|
+
message: notificationHead(messageInfo),
|
|
177
|
+
description: notificationBody(messageInfo),
|
|
178
|
+
duration: 0,
|
|
179
|
+
style: dynamicStyle,
|
|
180
|
+
placement,
|
|
181
|
+
});
|
|
182
|
+
} else {
|
|
183
|
+
// Jen jedna buňka - zavřít notifikaci
|
|
184
|
+
lastRangeHashRef.current = null;
|
|
185
|
+
notification.destroy(key);
|
|
186
|
+
}
|
|
187
|
+
}, [internalRef, props, notificationHead, notificationBody, style, placement, isSelecting]);
|
|
188
|
+
|
|
189
|
+
// Detekce konce označování pomocí mouseup event
|
|
190
|
+
React.useEffect(() => {
|
|
191
|
+
const handleMouseUp = () => {
|
|
192
|
+
// ✅ OPTIMALIZACE: Notifikace se už zobrazuje BĚHEM označování (s debounce),
|
|
193
|
+
// takže tady jen ukončíme isSelecting stav
|
|
194
|
+
setTimeout(() => {
|
|
195
|
+
setIsSelecting(false);
|
|
196
|
+
}, 50);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
200
|
+
document.addEventListener('touchend', handleMouseUp); // Pro touch zařízení
|
|
201
|
+
|
|
202
|
+
return () => {
|
|
203
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
204
|
+
document.removeEventListener('touchend', handleMouseUp);
|
|
205
|
+
};
|
|
206
|
+
}, []);
|
|
207
|
+
|
|
208
|
+
// Helper funkce pro nastavení pointer-events na notifikace
|
|
209
|
+
const setNotificationPointerEvents = React.useCallback((enable) => {
|
|
210
|
+
const notifications = document.querySelectorAll('.ant-notification');
|
|
211
|
+
|
|
212
|
+
notifications.forEach((notif) => {
|
|
213
|
+
if (enable) {
|
|
214
|
+
// Obnovit pointer-events na notifikaci
|
|
215
|
+
const original = notif.dataset.originalPointerEvents || 'auto';
|
|
216
|
+
notif.style.pointerEvents = original;
|
|
217
|
+
notif.style.removeProperty('pointer-events');
|
|
218
|
+
delete notif.dataset.originalPointerEvents;
|
|
219
|
+
|
|
220
|
+
// Obnovit pointer-events na všechny child elementy
|
|
221
|
+
const allChildren = notif.querySelectorAll('*');
|
|
222
|
+
allChildren.forEach((child) => {
|
|
223
|
+
child.style.removeProperty('pointer-events');
|
|
224
|
+
delete child.dataset.originalPointerEvents;
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
// Zakázat pointer-events na notifikaci
|
|
228
|
+
if (!notif.dataset.originalPointerEvents) {
|
|
229
|
+
notif.dataset.originalPointerEvents = notif.style.pointerEvents || 'auto';
|
|
230
|
+
}
|
|
231
|
+
notif.style.setProperty('pointer-events', 'none', 'important');
|
|
232
|
+
|
|
233
|
+
// Zakázat pointer-events na všechny child elementy
|
|
234
|
+
const allChildren = notif.querySelectorAll('*');
|
|
235
|
+
allChildren.forEach((child) => {
|
|
236
|
+
if (!child.dataset.originalPointerEvents) {
|
|
237
|
+
child.dataset.originalPointerEvents = child.style.pointerEvents || '';
|
|
238
|
+
}
|
|
239
|
+
child.style.setProperty('pointer-events', 'none', 'important');
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}, []);
|
|
244
|
+
|
|
245
|
+
// Dynamicky přidávat/odebírat pointer-events na notifikace podle isSelecting stavu
|
|
246
|
+
React.useEffect(() => {
|
|
247
|
+
if (isSelecting) {
|
|
248
|
+
document.body.classList.add('ag-grid-selecting');
|
|
249
|
+
|
|
250
|
+
// Nastavit pointer-events na existující notifikace
|
|
251
|
+
setNotificationPointerEvents(false);
|
|
252
|
+
|
|
253
|
+
// KRITICKÉ: Sledovat DOM změny - když se objeví nová notifikace během označování
|
|
254
|
+
const observer = new MutationObserver((mutations) => {
|
|
255
|
+
mutations.forEach((mutation) => {
|
|
256
|
+
mutation.addedNodes.forEach((node) => {
|
|
257
|
+
if (node.nodeType === 1) { // Element node
|
|
258
|
+
// Zkontrolovat jestli je to notifikace nebo obsahuje notifikaci
|
|
259
|
+
if (node.classList?.contains('ant-notification') ||
|
|
260
|
+
node.querySelector?.('.ant-notification')) {
|
|
261
|
+
setNotificationPointerEvents(false);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Sledovat změny v document.body
|
|
269
|
+
observer.observe(document.body, {
|
|
270
|
+
childList: true,
|
|
271
|
+
subtree: true
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// Uložit observer pro cleanup
|
|
275
|
+
return () => {
|
|
276
|
+
observer.disconnect();
|
|
277
|
+
};
|
|
278
|
+
} else {
|
|
279
|
+
document.body.classList.remove('ag-grid-selecting');
|
|
280
|
+
|
|
281
|
+
// Malé zpoždění před obnovením pointer-events (100ms)
|
|
282
|
+
// Zajistí že notifikace jsou interaktivní až když skutečně skončí označování
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
setNotificationPointerEvents(true);
|
|
285
|
+
}, 100);
|
|
286
|
+
}
|
|
287
|
+
}, [isSelecting, setNotificationPointerEvents]);
|
|
288
|
+
|
|
289
|
+
// Cleanup notifikací a timerů při zničení komponenty
|
|
290
|
+
React.useEffect(() => {
|
|
291
|
+
return () => {
|
|
292
|
+
// Clear throttle timer
|
|
293
|
+
if (notificationThrottleRef.current) {
|
|
294
|
+
clearTimeout(notificationThrottleRef.current);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (enableNotification) {
|
|
298
|
+
const gridId = props.gridName || props.id || 'default';
|
|
299
|
+
const key = `aggregation-grid-${gridId}`;
|
|
300
|
+
notification.destroy(key);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Cleanup SignalR transaction callback při unmount
|
|
304
|
+
if (queryKey && window.agGridTransactionCallbacks) {
|
|
305
|
+
delete window.agGridTransactionCallbacks[queryKey];
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}, [enableNotification, props.gridName, props.id, queryKey]);
|
|
309
|
+
|
|
310
|
+
React.useEffect(() => {
|
|
311
|
+
// VYPNUTO: Cell flash je globálně vypnutý
|
|
312
|
+
return;
|
|
313
|
+
|
|
314
|
+
if (!newRowFlash && !updatedRowFlash) return;
|
|
315
|
+
|
|
316
|
+
const previousRowData = previousRowDataRef.current;
|
|
317
|
+
const addedRows = newRowFlash ? findNewRows(previousRowData, rowData) : [];
|
|
318
|
+
const updatedRows = updatedRowFlash ? findUpdatedRows(previousRowData, rowData) : [];
|
|
319
|
+
|
|
320
|
+
if (addedRows.length > 0 || updatedRows.length > 0) {
|
|
321
|
+
setTimeout(() => {
|
|
322
|
+
try {
|
|
323
|
+
// Bezpečnostní kontrola API dostupnosti
|
|
324
|
+
if (!internalRef.current?.api || internalRef.current.api.isDestroyed?.()) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Modern AG-Grid (33+): getColumnState() moved to main api
|
|
329
|
+
const columnApi = internalRef.current?.columnApi || internalRef.current?.api;
|
|
330
|
+
if (!columnApi?.getColumnState) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const columnStates = columnApi.getColumnState();
|
|
335
|
+
const allColumns = columnStates
|
|
336
|
+
.filter(colState => colState.colId) // Filtrujeme pouze platné colId
|
|
337
|
+
.map((colState) => colState.colId);
|
|
338
|
+
|
|
339
|
+
// Kontrola, že máme platné sloupce
|
|
340
|
+
if (allColumns.length === 0) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Flash efekt pro nové řádky (používá defaultní zelená barva AG Grid)
|
|
345
|
+
if (addedRows.length > 0) {
|
|
346
|
+
const newRowNodes = [];
|
|
347
|
+
internalRef.current.api.forEachNode((node) => {
|
|
348
|
+
if (addedRows.some((row) => row.id === node.data.id)) {
|
|
349
|
+
newRowNodes.push(node);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
if (newRowNodes.length > 0) {
|
|
354
|
+
internalRef.current.api.flashCells({
|
|
355
|
+
rowNodes: newRowNodes,
|
|
356
|
+
columns: allColumns,
|
|
357
|
+
flashDelay: 0,
|
|
358
|
+
fadeDelay: 1000,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Flash efekt pro aktualizované řádky (modrá barva)
|
|
364
|
+
if (updatedRows.length > 0) {
|
|
365
|
+
const updatedRowNodes = [];
|
|
366
|
+
internalRef.current.api.forEachNode((node) => {
|
|
367
|
+
if (updatedRows.some((row) => row.id === node.data.id)) {
|
|
368
|
+
updatedRowNodes.push(node);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
if (updatedRowNodes.length > 0) {
|
|
373
|
+
// Použijeme vlastní CSS animaci pro modrou flash
|
|
374
|
+
updatedRowNodes.forEach(node => {
|
|
375
|
+
const rowElement = node.eGridRow || document.querySelector(`[row-id="${node.data.id}"]`);
|
|
376
|
+
if (rowElement) {
|
|
377
|
+
rowElement.classList.add('ag-row-flash-updated');
|
|
378
|
+
setTimeout(() => {
|
|
379
|
+
rowElement.classList.remove('ag-row-flash-updated');
|
|
380
|
+
}, 1000);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
} catch (error) {
|
|
386
|
+
// Ignorujeme chybu a pokračujeme bez crash aplikace
|
|
387
|
+
}
|
|
388
|
+
}, 100); // Zvýšený timeout pro stabilizaci gridu
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
previousRowDataRef.current = rowData;
|
|
392
|
+
}, [rowData, newRowFlash, updatedRowFlash]);
|
|
393
|
+
|
|
394
|
+
const RhPlusRangeSelectionChanged = React.useCallback(
|
|
395
|
+
(event) => {
|
|
396
|
+
// Detekovat začátek označování - nastavit isSelecting na true
|
|
397
|
+
setIsSelecting(true);
|
|
398
|
+
|
|
399
|
+
// 1. ✅ OPTIMALIZACE: Zobrazení notifikace BĚHEM označování s THROTTLE (100ms)
|
|
400
|
+
// Throttle = spustí okamžitě první event, pak každých 100ms během označování
|
|
401
|
+
// Cache check v updateAggregationNotification zajistí, že se agregace nepočítají znovu pokud se range nezměnil
|
|
402
|
+
if (enableNotification) {
|
|
403
|
+
const now = Date.now();
|
|
404
|
+
const timeSinceLastCall = now - notificationLastCallRef.current;
|
|
405
|
+
|
|
406
|
+
// První volání NEBO uplynulo 100ms od posledního volání
|
|
407
|
+
if (timeSinceLastCall >= 100) {
|
|
408
|
+
// Okamžité volání
|
|
409
|
+
notificationLastCallRef.current = now;
|
|
410
|
+
if (internalRef?.current) {
|
|
411
|
+
updateAggregationNotification(event);
|
|
412
|
+
}
|
|
413
|
+
} else {
|
|
414
|
+
// Naplánovat volání za zbývající čas (trailing edge)
|
|
415
|
+
if (notificationThrottleRef.current) {
|
|
416
|
+
clearTimeout(notificationThrottleRef.current);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
notificationThrottleRef.current = setTimeout(() => {
|
|
420
|
+
notificationLastCallRef.current = Date.now();
|
|
421
|
+
if (internalRef?.current) {
|
|
422
|
+
updateAggregationNotification(event);
|
|
423
|
+
}
|
|
424
|
+
}, 100 - timeSinceLastCall);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// 2. ✅ OPTIMALIZACE: Bulk edit handler BEZ debounce - okamžité zobrazení ikony
|
|
429
|
+
// Lightweight validace v useBulkCellEdit zajistí okamžité zobrazení
|
|
430
|
+
// Těžká validace proběhne s 15ms debounce uvnitř useBulkCellEdit
|
|
431
|
+
if (enableBulkEdit) {
|
|
432
|
+
handleRangeChange(event);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 3. Custom onRangeSelectionChanged callback - bez debounce
|
|
436
|
+
if (props.onRangeSelectionChanged) props.onRangeSelectionChanged(event);
|
|
437
|
+
},
|
|
438
|
+
[enableNotification, enableBulkEdit, handleRangeChange, props.onRangeSelectionChanged, updateAggregationNotification]
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
const AgGridOnGridReady = (event, options) => {
|
|
442
|
+
if (onGridReady) {
|
|
443
|
+
onGridReady(event, options);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Nejprve nastavíme API reference pro interní použití
|
|
447
|
+
if (internalRef.current) {
|
|
448
|
+
internalRef.current.api = event.api;
|
|
449
|
+
internalRef.current.columnApi = event.columnApi || event.api; // fallback for modern AG-Grid
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Registruj callback pro AG Grid transactions (SignalR optimalizace)
|
|
453
|
+
// Inicializace globálního registru pro více AG-Grid instancí
|
|
454
|
+
if (!window.agGridTransactionCallbacks) {
|
|
455
|
+
window.agGridTransactionCallbacks = {};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Registrace callbacku pro tuto konkrétní AG-Grid instanci (podle queryKey)
|
|
459
|
+
if (event.api && queryKey) {
|
|
460
|
+
window.agGridTransactionCallbacks[queryKey] = (transactionData) => {
|
|
461
|
+
try {
|
|
462
|
+
if (!event.api || event.api.isDestroyed?.()) return;
|
|
463
|
+
|
|
464
|
+
const { operation, records } = transactionData;
|
|
465
|
+
|
|
466
|
+
switch (operation) {
|
|
467
|
+
case 'add':
|
|
468
|
+
event.api.applyTransaction({ add: records });
|
|
469
|
+
// Flash efekt pro nové řádky
|
|
470
|
+
setTimeout(() => {
|
|
471
|
+
records.forEach(record => {
|
|
472
|
+
const rowNode = event.api.getRowNode(record.id);
|
|
473
|
+
if (rowNode && rowNode.rowElement) {
|
|
474
|
+
rowNode.rowElement.classList.add('ag-row-flash-created');
|
|
475
|
+
setTimeout(() => {
|
|
476
|
+
rowNode.rowElement.classList.remove('ag-row-flash-created');
|
|
477
|
+
}, 1000);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}, 100);
|
|
481
|
+
break;
|
|
482
|
+
|
|
483
|
+
case 'update':
|
|
484
|
+
event.api.applyTransaction({ update: records });
|
|
485
|
+
// Flash efekt pro aktualizované řádky
|
|
486
|
+
setTimeout(() => {
|
|
487
|
+
records.forEach(record => {
|
|
488
|
+
const rowNode = event.api.getRowNode(record.id);
|
|
489
|
+
if (rowNode && rowNode.rowElement) {
|
|
490
|
+
rowNode.rowElement.classList.add('ag-row-flash-updated');
|
|
491
|
+
setTimeout(() => {
|
|
492
|
+
rowNode.rowElement.classList.remove('ag-row-flash-updated');
|
|
493
|
+
}, 1000);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}, 100);
|
|
497
|
+
break;
|
|
498
|
+
|
|
499
|
+
case 'remove':
|
|
500
|
+
// Flash efekt před smazáním
|
|
501
|
+
records.forEach(record => {
|
|
502
|
+
const rowNode = event.api.getRowNode(record.id);
|
|
503
|
+
if (rowNode && rowNode.rowElement) {
|
|
504
|
+
rowNode.rowElement.classList.add('ag-row-flash-deleted');
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
setTimeout(() => {
|
|
509
|
+
event.api.applyTransaction({ remove: records });
|
|
510
|
+
}, 500); // Krátké zpoždění pro zobrazení flash efektu
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
} catch (error) {
|
|
514
|
+
// Ignorujeme chyby
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Pak zavoláme parent onGridReady handler, pokud existuje
|
|
520
|
+
// Toto je kritické pro správné fungování bit/ui/grid a GridLayout
|
|
521
|
+
if (options.onGridReady) {
|
|
522
|
+
try {
|
|
523
|
+
options.onGridReady(event);
|
|
524
|
+
} catch (error) {
|
|
525
|
+
// Error handling without console output
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// Nakonec nastavíme grid ready state s timeout
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
setIsGridReady(true);
|
|
532
|
+
}, 1000);
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
const components = React.useMemo(() => {
|
|
536
|
+
return {
|
|
537
|
+
checkboxRenderer: CheckboxRenderer,
|
|
538
|
+
selectRenderer: SelectRenderer,
|
|
539
|
+
countrySelectRenderer: CountrySelectRenderer,
|
|
540
|
+
booleanRenderer: BooleanRenderer,
|
|
541
|
+
buttonRenderer: ButtonRenderer,
|
|
542
|
+
iconRenderer: IconRenderer,
|
|
543
|
+
imageRenderer: ImageRenderer,
|
|
544
|
+
stateRenderer: StateRenderer,
|
|
545
|
+
...props.frameworkComponents,
|
|
546
|
+
};
|
|
547
|
+
}, [props.frameworkComponents]);
|
|
548
|
+
|
|
549
|
+
// ========== PERFORMANCE OPTIMIZATION: Memoizované event handlers ==========
|
|
550
|
+
const memoizedOnCellEditingStarted = React.useCallback(
|
|
551
|
+
(event) => RhPlusOnCellEditingStarted(event, props),
|
|
552
|
+
[props.onCellEditingStarted]
|
|
553
|
+
);
|
|
554
|
+
|
|
555
|
+
const memoizedOnCellDoubleClicked = React.useCallback(
|
|
556
|
+
(event) => RhPlusOnCellDoubleClicked(event, props),
|
|
557
|
+
[props.onCellDoubleClicked]
|
|
558
|
+
);
|
|
559
|
+
|
|
560
|
+
const memoizedOnCellValueChanged = React.useCallback(
|
|
561
|
+
(event) => RhPlusOnCellValueChanged(event, props),
|
|
562
|
+
[props.onCellValueChanged]
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
const memoizedPostSort = React.useCallback(
|
|
566
|
+
(event) => AgGridPostSort(event, props),
|
|
567
|
+
[props.postSort]
|
|
568
|
+
);
|
|
569
|
+
|
|
570
|
+
const memoizedOnGridReady = React.useCallback(
|
|
571
|
+
(event, options) => AgGridOnGridReady(event, props),
|
|
572
|
+
[onGridReady]
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
const memoizedOnRowDataChanged = React.useCallback(
|
|
576
|
+
(event) => AgGridOnRowDataChanged(event, props),
|
|
577
|
+
[props.onRowDataChanged]
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
const memoizedOnRowDataUpdated = React.useCallback(
|
|
581
|
+
(event) => AgGridOnRowDataUpdated(event, props),
|
|
582
|
+
[props.onRowDataUpdated]
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
// Memoizovaný context object
|
|
586
|
+
const memoizedContext = React.useMemo(() => ({
|
|
587
|
+
componentParent: { ...props }
|
|
588
|
+
}), [props.context, props.gridName, props.id]);
|
|
589
|
+
|
|
590
|
+
// Memoizovaný defaultColDef
|
|
591
|
+
const memoizedDefaultColDef = React.useMemo(() => ({
|
|
592
|
+
...props.defaultColDef,
|
|
593
|
+
suppressHeaderMenuButton: true,
|
|
594
|
+
suppressHeaderFilterButton: true,
|
|
595
|
+
suppressMenu: true,
|
|
596
|
+
}), [props.defaultColDef]);
|
|
597
|
+
|
|
598
|
+
// ========== PERFORMANCE OPTIMIZATION: Memoizovaný allGridProps ==========
|
|
599
|
+
const allGridProps = React.useMemo(() => ({
|
|
600
|
+
ref: internalRef,
|
|
601
|
+
...props,
|
|
602
|
+
theme: themeObject,
|
|
603
|
+
columnDefs: AgGridColumns(props.columnDefs, props),
|
|
604
|
+
defaultColDef: memoizedDefaultColDef,
|
|
605
|
+
onCellEditingStarted: memoizedOnCellEditingStarted,
|
|
606
|
+
onCellDoubleClicked: memoizedOnCellDoubleClicked,
|
|
607
|
+
onCellValueChanged: memoizedOnCellValueChanged,
|
|
608
|
+
postSort: memoizedPostSort,
|
|
609
|
+
onGridReady: memoizedOnGridReady,
|
|
610
|
+
onRowDataChanged: memoizedOnRowDataChanged,
|
|
611
|
+
onRowDataUpdated: memoizedOnRowDataUpdated,
|
|
612
|
+
onRangeSelectionChanged: RhPlusRangeSelectionChanged,
|
|
613
|
+
context: memoizedContext,
|
|
614
|
+
components,
|
|
615
|
+
}), [
|
|
616
|
+
internalRef,
|
|
617
|
+
themeObject,
|
|
618
|
+
props.columnDefs,
|
|
619
|
+
memoizedDefaultColDef,
|
|
620
|
+
memoizedOnCellEditingStarted,
|
|
621
|
+
memoizedOnCellDoubleClicked,
|
|
622
|
+
memoizedOnCellValueChanged,
|
|
623
|
+
memoizedPostSort,
|
|
624
|
+
memoizedOnGridReady,
|
|
625
|
+
memoizedOnRowDataChanged,
|
|
626
|
+
memoizedOnRowDataUpdated,
|
|
627
|
+
RhPlusRangeSelectionChanged,
|
|
628
|
+
memoizedContext,
|
|
629
|
+
components,
|
|
630
|
+
]);
|
|
631
|
+
|
|
632
|
+
return (
|
|
633
|
+
<>
|
|
634
|
+
<AgGridReact {...allGridProps} />
|
|
635
|
+
|
|
636
|
+
{/* Bulk Edit Floating Button */}
|
|
637
|
+
{enableBulkEdit && floatingButton.visible && (
|
|
638
|
+
<BulkEditButton
|
|
639
|
+
visible={floatingButton.visible}
|
|
640
|
+
position={floatingButton.position}
|
|
641
|
+
range={floatingButton.range}
|
|
642
|
+
column={floatingButton.column}
|
|
643
|
+
cellCount={floatingButton.cellCount}
|
|
644
|
+
rowsContainer={floatingButton.rowsContainer}
|
|
645
|
+
editPopover={editPopover}
|
|
646
|
+
onOpenPopover={handleOpenPopover}
|
|
647
|
+
onValueChange={handleValueChange}
|
|
648
|
+
onSubmit={handleSubmitEdit}
|
|
649
|
+
onCancel={handleCancelEdit}
|
|
650
|
+
/>
|
|
651
|
+
)}
|
|
652
|
+
</>
|
|
653
|
+
);
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
export default AgGrid;
|
|
657
|
+
|
|
658
|
+
export {
|
|
659
|
+
useBulkCellEdit,
|
|
660
|
+
BulkEditButton,
|
|
661
|
+
BulkEditPopover,
|
|
662
|
+
BulkEditSelect,
|
|
663
|
+
BulkEditDatePicker,
|
|
664
|
+
BulkEditModule,
|
|
665
|
+
BulkEditInput
|
|
666
|
+
} from './BulkEdit';
|
|
667
|
+
|
|
668
|
+
export {
|
|
669
|
+
default as CheckboxRenderer
|
|
657
670
|
} from './Renderers/CheckboxRenderer'
|