@spacego/fe-components 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/lib/fe-form/fe-form-label/index.js +4 -4
- package/lib/fe-layouts/auth-layout/index.js +1 -1
- package/lib/fe-layouts/layout.js +1 -1
- package/lib/fe-table/fe-edit-table-cell/index.js +1 -1
- package/lib/fe-table/fe-normal-table/index.js +1 -1
- package/lib/fe-table/fe-table-link/index.js +1 -1
- package/lib/fe-table/fe-table-toolbar/index.js +1 -1
- package/lib/fe-table/use-table/index.js +1 -1
- package/lib/index.css +1 -1
- package/lib/store/modules/layout-config.store.js +1 -1
- package/lib/store/modules/theme.store.js +1 -1
- package/lib/types/fe-checkbox-group/index.d.ts +4 -6
- package/lib/types/fe-form/fe-form/index.d.ts +336 -338
- package/lib/types/fe-form/fe-form-item/index.d.ts +66 -68
- package/lib/types/fe-form/fe-form-label/index.d.ts +42 -44
- package/lib/types/fe-layouts/context/global-context.d.ts +238 -240
- package/lib/types/fe-table/fe-table-link/index.d.ts +8 -10
- package/lib/types/fe-table/fe-table-render/index.d.ts +10 -12
- package/lib/types/fe-table/fe-table-toolbar/index.d.ts +14 -16
- package/lib/types/fe-table/type/table-context.d.ts +60 -60
- package/lib/types/fe-table/type/table.d.ts +789 -791
- package/lib/types/hooks/use-form/index.d.ts +11 -13
- package/lib/types/typings/index.d.ts +98 -98
- package/lib/types/typings/shims-axios.d.ts +38 -38
- package/package.json +78 -78
|
@@ -4,794 +4,792 @@ import { DebouncedFunc } from 'lodash-es';
|
|
|
4
4
|
import { default as React } from 'react';
|
|
5
5
|
import { IFeFormItems } from '../../../form/fe-form/index.d';
|
|
6
6
|
import { TableContext } from '../utils/table-utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
export
|
|
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
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
export
|
|
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
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
export
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
*
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
declare const FeTable: React.ForwardRefExoticComponent<FeTableProps>;
|
|
7
|
+
export interface FeTableProps {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
tableKey?: string;
|
|
10
|
+
columnSetting?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FeEditTableProps extends FeTableProps {
|
|
14
|
+
onTableValueChange?: (values: any) => void;
|
|
15
|
+
onInternalStateChange?: (params: { values: Record<string, any>; record: Record<string, any> }) => void;
|
|
16
|
+
formData?: any;
|
|
17
|
+
editTable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface FeFullTableProps extends FeTableProps, FeEditTableProps {
|
|
21
|
+
edit?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface FeTableTitlePropsType {
|
|
25
|
+
width: number;
|
|
26
|
+
onResize: (e: React.SyntheticEvent<Element>, data: ResizeCallbackData) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 基础分页响应接口
|
|
30
|
+
interface IBasePageRsp<T> {
|
|
31
|
+
pageNo: number;
|
|
32
|
+
pageSize: number;
|
|
33
|
+
totalCount: number;
|
|
34
|
+
totalPage?: number;
|
|
35
|
+
records: T[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 子表格配置接口
|
|
39
|
+
interface ISubTableConfig extends TableProps {
|
|
40
|
+
/**
|
|
41
|
+
* 子表格列配置
|
|
42
|
+
*/
|
|
43
|
+
columns: ITableColumns[];
|
|
44
|
+
/**
|
|
45
|
+
* 默认展开所有行
|
|
46
|
+
*/
|
|
47
|
+
defaultExpandAllRows?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 通过点击行来展开子行
|
|
50
|
+
*/
|
|
51
|
+
expandRowByClick?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 是否显示序号列
|
|
54
|
+
*/
|
|
55
|
+
showIndex?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 子表格行键
|
|
58
|
+
*/
|
|
59
|
+
rowKey?: string;
|
|
60
|
+
/**
|
|
61
|
+
* 子表格操作列配置
|
|
62
|
+
*/
|
|
63
|
+
columnsHandleConfig?: any[];
|
|
64
|
+
/**
|
|
65
|
+
* 按钮权限列表
|
|
66
|
+
*/
|
|
67
|
+
btnPermissionList?: string[];
|
|
68
|
+
/**
|
|
69
|
+
* 子表格初始数据
|
|
70
|
+
*/
|
|
71
|
+
initDataSource?: any[];
|
|
72
|
+
/**
|
|
73
|
+
* 子表格展开行key
|
|
74
|
+
*/
|
|
75
|
+
expandRowKey?: string;
|
|
76
|
+
/**
|
|
77
|
+
* 子表格数据获取函数
|
|
78
|
+
*/
|
|
79
|
+
fetchModel?: (
|
|
80
|
+
record: DataType,
|
|
81
|
+
pageOption: ITablePageOption & Record<string, any>
|
|
82
|
+
) => Promise<IBasePageRsp<SubDataType>>;
|
|
83
|
+
/**
|
|
84
|
+
* 分页配置
|
|
85
|
+
*/
|
|
86
|
+
pageOption?: ITablePageOption;
|
|
87
|
+
/**
|
|
88
|
+
* 是否启用分页
|
|
89
|
+
*/
|
|
90
|
+
pagination?: boolean;
|
|
91
|
+
|
|
92
|
+
expandableConfig?: TableProps['expandable'];
|
|
93
|
+
|
|
94
|
+
columnsHandleAttr?: {
|
|
95
|
+
fixed?: false | 'left' | 'right';
|
|
96
|
+
width?: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface FeSubTableProps<MainData = any, SubData = any> {
|
|
101
|
+
/**
|
|
102
|
+
* 子表格列配置
|
|
103
|
+
*/
|
|
104
|
+
columns: ITableColumns<SubData>[];
|
|
105
|
+
/**
|
|
106
|
+
* 父行数据
|
|
107
|
+
*/
|
|
108
|
+
record: MainData;
|
|
109
|
+
/**
|
|
110
|
+
* 子表格配置
|
|
111
|
+
*/
|
|
112
|
+
config: ISubTableConfig;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface SubTableState<T> {
|
|
116
|
+
data: T[];
|
|
117
|
+
pageInfo: ITablePageOption;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 请求结果类型
|
|
121
|
+
interface RequestResult<T> {
|
|
122
|
+
data: T[];
|
|
123
|
+
pageInfo: ITablePageOption;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type SubData = any;
|
|
127
|
+
|
|
128
|
+
export interface EditableCellProps extends ITableColumns {
|
|
129
|
+
/*
|
|
130
|
+
* 数据索引
|
|
131
|
+
*/
|
|
132
|
+
dataIndex: string;
|
|
133
|
+
/*
|
|
134
|
+
* 标签
|
|
135
|
+
*/
|
|
136
|
+
label: string;
|
|
137
|
+
/*
|
|
138
|
+
* 是否编辑
|
|
139
|
+
*/
|
|
140
|
+
editing: boolean;
|
|
141
|
+
/*
|
|
142
|
+
* 记录
|
|
143
|
+
*/
|
|
144
|
+
record: any;
|
|
145
|
+
/*
|
|
146
|
+
* 行key
|
|
147
|
+
*/
|
|
148
|
+
rowKey: string;
|
|
149
|
+
/*
|
|
150
|
+
* 索引
|
|
151
|
+
*/
|
|
152
|
+
index: number;
|
|
153
|
+
/*
|
|
154
|
+
* 子元素
|
|
155
|
+
*/
|
|
156
|
+
children: React.ReactNode;
|
|
157
|
+
/*
|
|
158
|
+
* 表单引用
|
|
159
|
+
*/
|
|
160
|
+
formRef: React.RefObject<any>;
|
|
161
|
+
/*
|
|
162
|
+
* 表格值变化
|
|
163
|
+
*/
|
|
164
|
+
onTableValueChange: (values: any) => void;
|
|
165
|
+
/*
|
|
166
|
+
* 错误
|
|
167
|
+
*/
|
|
168
|
+
errorKey: Array<string>;
|
|
169
|
+
/*
|
|
170
|
+
* 其他属性
|
|
171
|
+
*/
|
|
172
|
+
[key: string]: any;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface IFeTableFormItems extends IFeFormItems {
|
|
176
|
+
/**
|
|
177
|
+
* @name 与实体映射的key
|
|
178
|
+
*/
|
|
179
|
+
dataIndex?: keyof DataType;
|
|
180
|
+
/**
|
|
181
|
+
* @name 标题
|
|
182
|
+
*/
|
|
183
|
+
label?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface IEditRenderParams {
|
|
187
|
+
/**
|
|
188
|
+
* @name 是否可编辑
|
|
189
|
+
*/
|
|
190
|
+
editable: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* @name 是否需要提示
|
|
193
|
+
*/
|
|
194
|
+
formProps?: IFeTableFormItems | ((ctx: TableContext) => IFeTableFormItems);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface ITableColumns<T = any> {
|
|
198
|
+
/**
|
|
199
|
+
* T
|
|
200
|
+
*
|
|
201
|
+
* @name 与实体映射的key
|
|
202
|
+
*/
|
|
203
|
+
dataIndex: keyof T | 'handle';
|
|
204
|
+
/**
|
|
205
|
+
* @name 确定这个列的唯一值,一般用于 dataIndex 重复的情况
|
|
206
|
+
*/
|
|
207
|
+
key?: React.Key;
|
|
208
|
+
/**
|
|
209
|
+
* @name 标题
|
|
210
|
+
*/
|
|
211
|
+
title: string | React.ReactNode;
|
|
212
|
+
/**
|
|
213
|
+
* @name 自定义标题渲染
|
|
214
|
+
*/
|
|
215
|
+
titleRender?: React.ReactNode;
|
|
216
|
+
/**
|
|
217
|
+
* @name 是否开启标题hint
|
|
218
|
+
*/
|
|
219
|
+
showHint?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* @name 标题hint内容
|
|
222
|
+
*/
|
|
223
|
+
hintText?: string | React.ReactNode;
|
|
224
|
+
/**
|
|
225
|
+
* @name 是否开启ellipsis
|
|
226
|
+
*/
|
|
227
|
+
ellipsis?: boolean | { showTitle: boolean };
|
|
228
|
+
/**
|
|
229
|
+
* Render 方法只管理的只读模式,编辑模式需要使用 renderFormItem
|
|
230
|
+
*
|
|
231
|
+
* @name 自定义只读模式的dom
|
|
232
|
+
*/
|
|
233
|
+
render?: (text: any, record: any, index: number) => React.ReactNode;
|
|
234
|
+
/**
|
|
235
|
+
* @name 对齐方式 left | center | right
|
|
236
|
+
* @default center
|
|
237
|
+
*/
|
|
238
|
+
align?: 'left' | 'center' | 'right';
|
|
239
|
+
/**
|
|
240
|
+
* @name 固定列
|
|
241
|
+
* @default false
|
|
242
|
+
*/
|
|
243
|
+
fixed?: false | 'left' | 'right';
|
|
244
|
+
/**
|
|
245
|
+
* @name 列宽
|
|
246
|
+
*/
|
|
247
|
+
width?: number;
|
|
248
|
+
/**
|
|
249
|
+
* @name 数据类型
|
|
250
|
+
* @default string
|
|
251
|
+
*/
|
|
252
|
+
dataType?: 'string' | 'integer' | 'double' | 'dict';
|
|
253
|
+
/**
|
|
254
|
+
* @name 渲染类型
|
|
255
|
+
* @default default
|
|
256
|
+
* @options default:纯文本静态展示
|
|
257
|
+
* tag:枚举tag展示,支持多个tag
|
|
258
|
+
*/
|
|
259
|
+
renderType?: TRenderType;
|
|
260
|
+
/**
|
|
261
|
+
* 默认过滤器猜数
|
|
262
|
+
*/
|
|
263
|
+
renderParams?: {
|
|
264
|
+
/**
|
|
265
|
+
* 是否开启tooltip
|
|
266
|
+
*/
|
|
267
|
+
tooltip: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* 是否开启省略
|
|
270
|
+
*/
|
|
271
|
+
ellipsis: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* 溢出省略时最多展示行数
|
|
274
|
+
* */
|
|
275
|
+
maxLines?: number;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* @name 默认渲染器参数
|
|
279
|
+
*/
|
|
280
|
+
defaultRenderParams?: {
|
|
281
|
+
/**
|
|
282
|
+
* @name 过滤器
|
|
283
|
+
*/
|
|
284
|
+
filter?: any;
|
|
285
|
+
/**
|
|
286
|
+
* @name 过滤器参数
|
|
287
|
+
*/
|
|
288
|
+
dictfilterParams?: {
|
|
289
|
+
dictList: Array<{ dataIndex: string; label: string }>;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* @name 枚举字典配置
|
|
294
|
+
*/
|
|
295
|
+
tagRenderParams?: {
|
|
296
|
+
/**
|
|
297
|
+
* @name 过滤器
|
|
298
|
+
*/
|
|
299
|
+
filter?: any;
|
|
300
|
+
/**
|
|
301
|
+
* @name 过滤器参数
|
|
302
|
+
*/
|
|
303
|
+
dictfilterParams?: {
|
|
304
|
+
dictList: Array<{ dataIndex: string; label: string }>;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* @name 分割符
|
|
308
|
+
* @default |
|
|
309
|
+
*/
|
|
310
|
+
separator?: string;
|
|
311
|
+
/**
|
|
312
|
+
* @name 颜色类型枚举
|
|
313
|
+
*/
|
|
314
|
+
themeEnums?: Record<string, 'processing' | 'success' | 'error' | 'default' | 'warning'>;
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* @name 编辑器配置
|
|
318
|
+
*/
|
|
319
|
+
editRenderParams?: IEditRenderParams;
|
|
320
|
+
/**
|
|
321
|
+
* @name 千分位配置
|
|
322
|
+
*/
|
|
323
|
+
thousandsParams?: {
|
|
324
|
+
/**
|
|
325
|
+
* @name 小数位
|
|
326
|
+
*/
|
|
327
|
+
precision?: number;
|
|
328
|
+
/**
|
|
329
|
+
* @name 是否补0
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
fillZero?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* @name 千分位分隔符
|
|
335
|
+
* @default ,
|
|
336
|
+
*/
|
|
337
|
+
separator?: string;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* @name 是否在列配置中隐藏
|
|
341
|
+
* @description 设置为true时,该列不会出现在列配置面板中
|
|
342
|
+
* @default false
|
|
343
|
+
*/
|
|
344
|
+
hideInSetting?: boolean;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @name 渲染类型
|
|
349
|
+
* @default default
|
|
350
|
+
* @options default:纯文本静态展示
|
|
351
|
+
* tag:枚举tag展示,支持多个tag
|
|
352
|
+
*
|
|
353
|
+
*/
|
|
354
|
+
export type TRenderType = 'default' | 'tag' | 'thousands';
|
|
355
|
+
|
|
356
|
+
export interface ITablePageOption {
|
|
357
|
+
/**
|
|
358
|
+
* @name 当前页码
|
|
359
|
+
*/
|
|
360
|
+
pageNo: number;
|
|
361
|
+
/**
|
|
362
|
+
* @name 每页条数
|
|
363
|
+
*/
|
|
364
|
+
pageSize: number;
|
|
365
|
+
/**
|
|
366
|
+
* @name 总条数
|
|
367
|
+
*/
|
|
368
|
+
totalCount?: number;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export interface ITableParams<DataType> {
|
|
372
|
+
/**
|
|
373
|
+
* @name 列表加载类型
|
|
374
|
+
* @default page
|
|
375
|
+
*/
|
|
376
|
+
loadType?: 'static' | 'page';
|
|
377
|
+
/**
|
|
378
|
+
* @name 表格列配置
|
|
379
|
+
*/
|
|
380
|
+
columns: ITableColumns<DataType>[];
|
|
381
|
+
/**
|
|
382
|
+
* @name 表格数据
|
|
383
|
+
*/
|
|
384
|
+
initDataSource?: DataType[];
|
|
385
|
+
/**
|
|
386
|
+
* @name 表格最大宽度,超过此宽度会出现横向滚动条
|
|
387
|
+
*/
|
|
388
|
+
scrollX?: string;
|
|
389
|
+
/**
|
|
390
|
+
* @name 表格最大高度,超过此高度会出现纵向滚动条
|
|
391
|
+
*/
|
|
392
|
+
scrollY?: string;
|
|
393
|
+
/**
|
|
394
|
+
* @name 表格行唯一标识,默认id
|
|
395
|
+
*/
|
|
396
|
+
rowKey?: string;
|
|
397
|
+
/**
|
|
398
|
+
* @name 是否展示分页
|
|
399
|
+
*/
|
|
400
|
+
pageVisible?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* @name 表格搜索配置
|
|
403
|
+
*/
|
|
404
|
+
searchOption?: Record<string, any>;
|
|
405
|
+
/**
|
|
406
|
+
* @name 分页配置
|
|
407
|
+
*/
|
|
408
|
+
pageOption?: ITablePageOption;
|
|
409
|
+
/**
|
|
410
|
+
* @name 表格标题
|
|
411
|
+
*/
|
|
412
|
+
headerTitle?: string | React.ReactNode;
|
|
413
|
+
/**
|
|
414
|
+
* @name 表格副标题
|
|
415
|
+
*/
|
|
416
|
+
subTitle?: string;
|
|
417
|
+
/**
|
|
418
|
+
* @name 表格功能区按钮配置
|
|
419
|
+
*/
|
|
420
|
+
toolBarConfig?: IToolBarBtnConfig[];
|
|
421
|
+
/**
|
|
422
|
+
* @name 表格操作列配置属性
|
|
423
|
+
*/
|
|
424
|
+
columnsHandleAttr?: {
|
|
425
|
+
fixed?: false | 'left' | 'right';
|
|
426
|
+
width?: number;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* @name 表格操作列配置
|
|
430
|
+
*/
|
|
431
|
+
columnsHandleConfig?: IColumnsHandleConfig[];
|
|
432
|
+
/**
|
|
433
|
+
* @name 是否展示索引
|
|
434
|
+
* @default true
|
|
435
|
+
*/
|
|
436
|
+
showIndex?: boolean;
|
|
437
|
+
/**
|
|
438
|
+
* @name 表格功能区
|
|
439
|
+
*/
|
|
440
|
+
toolBarRender?: () => React.ReactNode[];
|
|
441
|
+
/**
|
|
442
|
+
* @name 获取列表数据
|
|
443
|
+
*/
|
|
444
|
+
fetchModel?: (pageOption: ITablePageOption & Record<string, any>) => Promise<IBasePageRsp<DataType>>;
|
|
445
|
+
/**
|
|
446
|
+
* @name 唯一标识,更改后刷新columns
|
|
447
|
+
*/
|
|
448
|
+
rawKeyRef?: React.RefObject<string>;
|
|
449
|
+
/**
|
|
450
|
+
* @name 按钮权限
|
|
451
|
+
*/
|
|
452
|
+
btnPermissionList?: string[];
|
|
453
|
+
/**
|
|
454
|
+
* @name 行展开配置
|
|
455
|
+
*/
|
|
456
|
+
rowExpandable?: (record: DataType) => boolean;
|
|
457
|
+
/**
|
|
458
|
+
* @name 子表格配置
|
|
459
|
+
*/
|
|
460
|
+
subTableConfig?: ISubTableConfig;
|
|
461
|
+
/**
|
|
462
|
+
* 扩展属性
|
|
463
|
+
*/
|
|
464
|
+
expandable?: ExpandableConfig;
|
|
465
|
+
/**
|
|
466
|
+
* @name 批量操作工具栏渲染函数
|
|
467
|
+
* @description 自定义批量操作工具栏左侧信息区域,false 时不显示
|
|
468
|
+
*/
|
|
469
|
+
tableAlertRender?:
|
|
470
|
+
| ((params: { selectedRowKeys: Key[]; selectedRows: DataType[]; onCleanSelected: () => void }) => React.ReactNode)
|
|
471
|
+
| false;
|
|
472
|
+
/**
|
|
473
|
+
* @name 表格行选择配置
|
|
474
|
+
* @description 表格行是否可选择,配置项
|
|
475
|
+
*/
|
|
476
|
+
rowSelection?: TableProps<DataType>['rowSelection'];
|
|
477
|
+
/**
|
|
478
|
+
* @name 是否启用列配置功能
|
|
479
|
+
* @description 是否显示列设置按钮,支持拖拽排序和显示/隐藏列
|
|
480
|
+
* @default true
|
|
481
|
+
*/
|
|
482
|
+
columnSetting?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* @name 默认隐藏的列
|
|
485
|
+
* @description 默认隐藏的列的dataIndex数组
|
|
486
|
+
*/
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export interface IColumnsHandleConfig {
|
|
490
|
+
/**
|
|
491
|
+
* @name 按钮文字
|
|
492
|
+
*/
|
|
493
|
+
label: string;
|
|
494
|
+
/**
|
|
495
|
+
* @name 按钮点击事件
|
|
496
|
+
* @param record 表格行数据
|
|
497
|
+
* @param index 表格行索引
|
|
498
|
+
* @returns
|
|
499
|
+
*/
|
|
500
|
+
onClick: (record: any, index: number) => Promise<void>;
|
|
501
|
+
/**
|
|
502
|
+
* @name 是否需要二次确认
|
|
503
|
+
*/
|
|
504
|
+
needConfirm?: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* @name 确认文案
|
|
507
|
+
* @default 确定{$label}吗?
|
|
508
|
+
*/
|
|
509
|
+
confirmText?: string | ((record?: any) => string);
|
|
510
|
+
/**
|
|
511
|
+
* @name 是否隐藏
|
|
512
|
+
* @param record 表格行数据
|
|
513
|
+
* @param index 表格行索引
|
|
514
|
+
* @returns
|
|
515
|
+
*/
|
|
516
|
+
hidden?: (record: any, index: number) => boolean;
|
|
517
|
+
/**
|
|
518
|
+
* @name 按钮权限
|
|
519
|
+
*/
|
|
520
|
+
btnPermission?: string;
|
|
521
|
+
/**
|
|
522
|
+
* @name 是否禁用
|
|
523
|
+
*/
|
|
524
|
+
disabled?: (record: any, index: number) => boolean;
|
|
525
|
+
/**
|
|
526
|
+
* @name 按钮禁用文案
|
|
527
|
+
*/
|
|
528
|
+
disabledText?: string;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface IToolBarBtnConfig {
|
|
532
|
+
/**
|
|
533
|
+
* @name 按钮类型
|
|
534
|
+
* @default primary
|
|
535
|
+
*/
|
|
536
|
+
type?: 'primary' | 'default';
|
|
537
|
+
/**
|
|
538
|
+
* @name 按钮文案
|
|
539
|
+
*/
|
|
540
|
+
label: string;
|
|
541
|
+
/**
|
|
542
|
+
* @name 按钮权限
|
|
543
|
+
*/
|
|
544
|
+
btnPermission?: string;
|
|
545
|
+
/**
|
|
546
|
+
* @name 是否禁用
|
|
547
|
+
*/
|
|
548
|
+
disabled?: () => boolean;
|
|
549
|
+
/**
|
|
550
|
+
* @name 按钮禁用文案
|
|
551
|
+
*/
|
|
552
|
+
disabledText?: string;
|
|
553
|
+
/**
|
|
554
|
+
* @name 按钮点击事件
|
|
555
|
+
*/
|
|
556
|
+
onClick: () => void;
|
|
557
|
+
/**
|
|
558
|
+
* @name 是否需要二次确认
|
|
559
|
+
*/
|
|
560
|
+
needConfirm?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* @name 确认文案
|
|
563
|
+
* @default 确定{$label}吗?
|
|
564
|
+
*/
|
|
565
|
+
confirmText?: string;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export interface IUseTableRsp<DataType = Record<string, any>> {
|
|
569
|
+
tableProps: {
|
|
570
|
+
actionRef: React.MutableRefObject<any>;
|
|
571
|
+
columns: any[];
|
|
572
|
+
dataSource: any[];
|
|
573
|
+
scroll: { x: string; y: string };
|
|
574
|
+
rowKey: string;
|
|
575
|
+
headerTitle: string;
|
|
576
|
+
toolBarRender: any;
|
|
577
|
+
pagination: any;
|
|
578
|
+
options: any;
|
|
579
|
+
search: any;
|
|
580
|
+
cardProps: any;
|
|
581
|
+
tableLayout: any;
|
|
582
|
+
subTableConfig: any;
|
|
583
|
+
expandable: any;
|
|
584
|
+
tableAlertRender?:
|
|
585
|
+
| ((params: { selectedRowKeys: Key[]; selectedRows: DataType[]; onCleanSelected: () => void }) => React.ReactNode)
|
|
586
|
+
| false;
|
|
587
|
+
rowSelection?: any;
|
|
588
|
+
columnSetting?: boolean;
|
|
589
|
+
};
|
|
590
|
+
fetchPageOption: () => any;
|
|
591
|
+
search: (searchOption?: Record<string, any>) => void;
|
|
592
|
+
refresh: () => void;
|
|
593
|
+
shouldRequestPreviousPage: (record: any[], pageNo: number) => boolean;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export const useTable = <DataType = Record<string, any>>(params: ITableParams<DataType>) => IUseTableRsp<DataType>;
|
|
597
|
+
|
|
598
|
+
export interface UseTableSelectionProps<T = any> {
|
|
599
|
+
/**
|
|
600
|
+
* 表格行选择配置
|
|
601
|
+
*/
|
|
602
|
+
rowSelection?: TableProps<T>['rowSelection'];
|
|
603
|
+
/**
|
|
604
|
+
* 表格数据源,用于根据selectedRowKeys获取selectedRows
|
|
605
|
+
*/
|
|
606
|
+
dataSource?: T[];
|
|
607
|
+
/**
|
|
608
|
+
* 行唯一标识键名,默认为 'id'
|
|
609
|
+
*/
|
|
610
|
+
rowKey?: string | ((record: T) => string);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export interface UseTableSelectionReturn<T = any> {
|
|
614
|
+
/**
|
|
615
|
+
* 当前选中的行keys
|
|
616
|
+
*/
|
|
617
|
+
selectedRowKeys: Key[];
|
|
618
|
+
/**
|
|
619
|
+
* 当前选中的行数据
|
|
620
|
+
*/
|
|
621
|
+
selectedRows: T[];
|
|
622
|
+
/**
|
|
623
|
+
* 处理后的rowSelection配置,传递给Table组件
|
|
624
|
+
*/
|
|
625
|
+
rowSelection: TableProps<T>['rowSelection'] | undefined;
|
|
626
|
+
/**
|
|
627
|
+
* 清空选择
|
|
628
|
+
*/
|
|
629
|
+
onCleanSelected: () => void;
|
|
630
|
+
/**
|
|
631
|
+
* 是否为受控模式
|
|
632
|
+
*/
|
|
633
|
+
isControlled: boolean;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export interface IEditTableHookProps<DataType = Record<string, any>> {
|
|
637
|
+
/**
|
|
638
|
+
* @name 表格属性
|
|
639
|
+
*/
|
|
640
|
+
tableProps: IUseTableRsp<DataType>['tableProps'];
|
|
641
|
+
/**
|
|
642
|
+
* @name 表格变化事件
|
|
643
|
+
*/
|
|
644
|
+
onTableChange?: (params: {
|
|
645
|
+
key: string;
|
|
646
|
+
value: any;
|
|
647
|
+
record: DataType;
|
|
648
|
+
form: {
|
|
649
|
+
setFieldValue: (key: string, value: any) => void;
|
|
650
|
+
setFieldsValue: (values: Record<string, any>) => void;
|
|
651
|
+
validate: (key?: string) => Promise<any>;
|
|
652
|
+
onReload: () => void;
|
|
653
|
+
};
|
|
654
|
+
}) => void;
|
|
655
|
+
/**
|
|
656
|
+
* @name 是否开启编辑
|
|
657
|
+
*/
|
|
658
|
+
editTable?: boolean;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export type IUseEditTableRsp<DataType = Record<string, any>> = {
|
|
662
|
+
/**
|
|
663
|
+
* @name 表单引用
|
|
664
|
+
*/
|
|
665
|
+
formRef: React.MutableRefObject<{
|
|
666
|
+
validate: (key?: string) => Promise<any>;
|
|
667
|
+
setFieldsValue: (values: Record<string, any>) => void;
|
|
668
|
+
setFieldValue: (key: string, value: any) => void;
|
|
669
|
+
onReload: () => void;
|
|
670
|
+
}>;
|
|
671
|
+
/**
|
|
672
|
+
* @name 表格变化事件
|
|
673
|
+
*/
|
|
674
|
+
onTableValueChange: DebouncedFunc<(params: { values: Record<string, any>; record: DataType }) => void>;
|
|
675
|
+
/**
|
|
676
|
+
* @name 更新内部状态(不触发外部回调)
|
|
677
|
+
*/
|
|
678
|
+
onInternalStateChange: (params: { values: Record<string, any>; record: Record<string, any> }) => void;
|
|
679
|
+
/**
|
|
680
|
+
* @name 表单数据
|
|
681
|
+
*/
|
|
682
|
+
formData: Record<string, any>;
|
|
683
|
+
/**
|
|
684
|
+
* @name 表格数据
|
|
685
|
+
*/
|
|
686
|
+
tableData: Record<string, any>[];
|
|
687
|
+
/**
|
|
688
|
+
* @name 读取最新表格数据
|
|
689
|
+
*/
|
|
690
|
+
getTableData: () => Record<string, any>[];
|
|
691
|
+
/**
|
|
692
|
+
* @name 错误key
|
|
693
|
+
*/
|
|
694
|
+
errorKey: string[];
|
|
695
|
+
/**
|
|
696
|
+
* @name 是否全部使用编辑功能
|
|
697
|
+
*/
|
|
698
|
+
editTable: boolean;
|
|
699
|
+
/**
|
|
700
|
+
* @name 是否使用编辑组件
|
|
701
|
+
*/
|
|
702
|
+
edit: boolean;
|
|
703
|
+
/**
|
|
704
|
+
* @name 表格变化事件
|
|
705
|
+
*/
|
|
706
|
+
onEditingChange: (record: Record<string, any>) => void;
|
|
707
|
+
/**
|
|
708
|
+
* @name 取消变化事件
|
|
709
|
+
*/
|
|
710
|
+
onCancelChange: () => void;
|
|
711
|
+
/**
|
|
712
|
+
* @name 验证事件
|
|
713
|
+
*/
|
|
714
|
+
onValidate: () => Promise<any>;
|
|
715
|
+
/**
|
|
716
|
+
* @name 是否开启编辑单行功能
|
|
717
|
+
*/
|
|
718
|
+
isEditing: (record: Record<string, any>, rowKey: string) => boolean;
|
|
719
|
+
/**
|
|
720
|
+
* @name 重置表单数据
|
|
721
|
+
*/
|
|
722
|
+
onReload: () => void;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// 分页Hook所需类型定义
|
|
726
|
+
export type Data = Record<string, any>;
|
|
727
|
+
|
|
728
|
+
export interface Params {
|
|
729
|
+
[key: string]: any;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
export interface PaginationOptions<TData extends Data, TParams extends Params> {
|
|
733
|
+
defaultPageSize?: number;
|
|
734
|
+
defaultCurrent?: number;
|
|
735
|
+
onSuccess?: (data: IBasePageRsp<TData>, params: [TParams & Partial<ITablePageOption>]) => void;
|
|
736
|
+
onError?: (e: Error) => void;
|
|
737
|
+
refreshDeps?: any[];
|
|
738
|
+
manual?: boolean;
|
|
739
|
+
ready?: boolean;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
export type Service<TData extends Data, TParams extends Params> = (
|
|
743
|
+
params: TParams & Partial<ITablePageOption>
|
|
744
|
+
) => Promise<IBasePageRsp<TData>>;
|
|
745
|
+
|
|
746
|
+
export interface PaginationResult<TData extends Data, TParams extends Params> {
|
|
747
|
+
data: TData[];
|
|
748
|
+
pageInfo: ITablePageOption;
|
|
749
|
+
pagination: {
|
|
750
|
+
pageNo: number;
|
|
751
|
+
pageSize: number;
|
|
752
|
+
totalCount: number;
|
|
753
|
+
totalPage: number;
|
|
754
|
+
onChange: (page: number, pageSize: number) => void;
|
|
755
|
+
changePageNo: (page: number) => void;
|
|
756
|
+
changePageSize: (pageSize: number) => void;
|
|
757
|
+
};
|
|
758
|
+
loading: boolean;
|
|
759
|
+
run: (params?: TParams & Partial<ITablePageOption>) => void;
|
|
760
|
+
params: (TParams & Partial<ITablePageOption>)[];
|
|
761
|
+
refresh: () => void;
|
|
762
|
+
mutate: (data: IBasePageRsp<TData> | ((oldData: IBasePageRsp<TData>) => IBasePageRsp<TData>)) => void;
|
|
763
|
+
error?: Error;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* 表格校验上下文类型
|
|
768
|
+
*
|
|
769
|
+
* 使用方式:
|
|
770
|
+
* validator: (rule, value, callback, tableContext) => {
|
|
771
|
+
* const { currentRecord, allTableData, form } = tableContext;
|
|
772
|
+
* // 校验逻辑...
|
|
773
|
+
* }
|
|
774
|
+
*
|
|
775
|
+
* 注意:保持antd原有的callback参数顺序,tableContext作为第4个参数
|
|
776
|
+
*/
|
|
777
|
+
export interface ITableValidatorContext {
|
|
778
|
+
/**
|
|
779
|
+
* 当前行的记录数据(已合并最新的表单输入值)
|
|
780
|
+
* 包含原始record数据和用户当前输入的最新值
|
|
781
|
+
*/
|
|
782
|
+
currentRecord: any;
|
|
783
|
+
/**
|
|
784
|
+
* 所有行的数据,按行ID分组
|
|
785
|
+
* 每行数据都是最新的表单值
|
|
786
|
+
* 开发者可以从中过滤出需要的其他行数据
|
|
787
|
+
*/
|
|
788
|
+
allTableData: Record<string, any>;
|
|
789
|
+
/**
|
|
790
|
+
* 表单实例,可用于获取表单数据或执行表单操作
|
|
791
|
+
*/
|
|
792
|
+
form: any;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
declare const FeTable: React.ForwardRefExoticComponent<FeTableProps>;
|