vxe-table 4.23.8 → 4.23.9
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/all.esm.js +5715 -3783
- package/es/components.d.ts +1 -0
- package/es/components.js +2 -7
- package/es/grid/src/emits.js +1 -15
- package/es/grid/src/grid.js +397 -120
- package/es/index.esm.js +1 -0
- package/es/index.js +1 -0
- package/es/table/module/custom/hook.js +49 -42
- package/es/table/module/custom/panel.js +777 -527
- package/es/table/module/edit/hook.js +140 -62
- package/es/table/module/export/export-panel.js +399 -316
- package/es/table/module/export/hook.js +395 -337
- package/es/table/module/export/import-panel.js +152 -123
- package/es/table/module/filter/hook.js +16 -2
- package/es/table/module/filter/panel.js +146 -84
- package/es/table/module/keyboard/hook.js +8 -4
- package/es/table/module/menu/panel.js +197 -126
- package/es/table/render/index.js +151 -98
- package/es/table/src/body.js +355 -233
- package/es/table/src/cell.js +426 -269
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/footer.js +144 -99
- package/es/table/src/group.js +7 -3
- package/es/table/src/header.js +229 -172
- package/es/table/src/table.js +1503 -1030
- package/es/table/src/util.js +15 -19
- package/es/toolbar/src/toolbar.js +132 -75
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +9 -6
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.d.ts +1 -1
- package/lib/components.js +2 -7
- package/lib/grid/src/emits.js +1 -15
- package/lib/grid/src/grid.js +397 -120
- package/lib/index.common.js +1 -0
- package/lib/index.js +1 -0
- package/lib/index.umd.js +5732 -3800
- package/lib/index.umd.min.js +3 -3
- package/lib/table/module/custom/hook.js +49 -42
- package/lib/table/module/custom/panel.js +777 -527
- package/lib/table/module/edit/hook.js +140 -62
- package/lib/table/module/export/export-panel.js +399 -316
- package/lib/table/module/export/hook.js +395 -337
- package/lib/table/module/export/import-panel.js +152 -123
- package/lib/table/module/filter/hook.js +16 -2
- package/lib/table/module/filter/panel.js +146 -84
- package/lib/table/module/keyboard/hook.js +8 -4
- package/lib/table/module/menu/panel.js +197 -126
- package/lib/table/render/index.js +151 -98
- package/lib/table/src/body.js +355 -233
- package/lib/table/src/cell.js +426 -269
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/footer.js +144 -99
- package/lib/table/src/group.js +7 -3
- package/lib/table/src/header.js +229 -172
- package/lib/table/src/table.js +1471 -1029
- package/lib/table/src/util.js +15 -19
- package/lib/toolbar/src/toolbar.js +132 -75
- package/lib/ui/index.js +1 -1
- package/lib/ui/src/dom.js +9 -6
- package/lib/ui/src/log.js +1 -1
- package/package.json +2 -2
- package/packages/colgroup/index.ts +22 -22
- package/packages/column/index.ts +22 -22
- package/packages/components.ts +41 -44
- package/packages/grid/index.ts +18 -18
- package/packages/grid/src/emits.ts +5 -19
- package/packages/grid/src/grid.ts +2229 -1925
- package/packages/grid/src/props.ts +22 -23
- package/packages/index.ts +11 -11
- package/packages/locale/lang/fr-FR.ts +15 -15
- package/packages/locale/lang/it-IT.ts +4 -4
- package/packages/locale/lang/uk-UA.ts +1 -1
- package/packages/locale/lang/uz-UZ.ts +13 -13
- package/packages/locale/lang/zh-CN.ts +907 -907
- package/packages/table/index.ts +26 -26
- package/packages/table/module/custom/hook.ts +510 -503
- package/packages/table/module/custom/panel.ts +2002 -1743
- package/packages/table/module/edit/hook.ts +1224 -1131
- package/packages/table/module/export/export-panel.ts +697 -611
- package/packages/table/module/export/hook.ts +2160 -2059
- package/packages/table/module/export/import-panel.ts +319 -279
- package/packages/table/module/export/util.ts +25 -24
- package/packages/table/module/filter/hook.ts +519 -501
- package/packages/table/module/filter/panel.ts +368 -304
- package/packages/table/module/keyboard/hook.ts +498 -494
- package/packages/table/module/menu/hook.ts +330 -330
- package/packages/table/module/menu/panel.ts +272 -201
- package/packages/table/module/validator/hook.ts +653 -635
- package/packages/table/render/index.ts +1819 -1744
- package/packages/table/src/body.ts +1078 -955
- package/packages/table/src/cell.ts +1524 -1359
- package/packages/table/src/column.ts +192 -192
- package/packages/table/src/columnInfo.ts +232 -232
- package/packages/table/src/emits.ts +134 -134
- package/packages/table/src/footer.ts +425 -380
- package/packages/table/src/group.ts +67 -63
- package/packages/table/src/header.ts +642 -581
- package/packages/table/src/props.ts +336 -336
- package/packages/table/src/store.ts +14 -14
- package/packages/table/src/table.ts +16011 -15454
- package/packages/table/src/use/cell-view.ts +41 -44
- package/packages/table/src/use/index.ts +1 -1
- package/packages/table/src/util.ts +1206 -1216
- package/packages/toolbar/index.ts +18 -18
- package/packages/toolbar/src/toolbar.ts +768 -706
- package/packages/ui/index.ts +519 -520
- package/packages/ui/src/anime.ts +51 -52
- package/packages/ui/src/comp.ts +3 -3
- package/packages/ui/src/dom.ts +466 -463
- package/packages/ui/src/log.ts +19 -19
- package/packages/ui/src/utils.ts +66 -66
- package/packages/ui/src/vn.ts +55 -55
- package/packages/v-x-e-table/index.d.ts +3 -3
- package/packages/v-x-e-table/index.ts +3 -3
- package/types/all.d.ts +76 -76
- package/types/index.d.ts +4 -4
- /package/dist/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/dist/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/dist/{iconfont.1793007753347.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/es/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/es/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/es/{iconfont.1793007753347.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/lib/{iconfont.1793007753347.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/lib/{iconfont.1793007753347.woff → iconfont.1793009263429.woff} +0 -0
- /package/lib/{iconfont.1793007753347.woff2 → iconfont.1793009263429.woff2} +0 -0
|
@@ -1,1925 +1,2229 @@
|
|
|
1
|
-
import { h, ref, computed, provide, reactive, onBeforeUnmount, watch, nextTick, VNode, onMounted } from 'vue'
|
|
2
|
-
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
-
import { defineVxeComponent } from '../../ui/src/comp'
|
|
4
|
-
import XEUtils from 'xe-utils'
|
|
5
|
-
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
6
|
-
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, hasClass } from '../../ui/src/dom'
|
|
7
|
-
import { gridProps } from './props'
|
|
8
|
-
import { gridEmits } from './emits'
|
|
9
|
-
import { getSlotVNs } from '../../ui/src/vn'
|
|
10
|
-
import { createComponentLog } from '../../ui/src/log'
|
|
11
|
-
import { tableEmits } from '../../table/src/emits'
|
|
12
|
-
import { tableProps } from '../../table/src/props'
|
|
13
|
-
import VxeTableComponent from '../../table'
|
|
14
|
-
import VxeToolbarComponent from '../../toolbar'
|
|
15
|
-
|
|
16
|
-
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
17
|
-
import type {
|
|
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
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const
|
|
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
|
-
const
|
|
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
|
-
const
|
|
415
|
-
|
|
416
|
-
if (
|
|
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
|
-
|
|
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
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
)
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
const
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
if (
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
return
|
|
1807
|
-
},
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
}
|
|
1
|
+
import { h, ref, computed, provide, reactive, onBeforeUnmount, watch, nextTick, VNode, onMounted } from 'vue'
|
|
2
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
4
|
+
import XEUtils from 'xe-utils'
|
|
5
|
+
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
6
|
+
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, hasClass } from '../../ui/src/dom'
|
|
7
|
+
import { gridProps } from './props'
|
|
8
|
+
import { gridEmits } from './emits'
|
|
9
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
10
|
+
import { createComponentLog } from '../../ui/src/log'
|
|
11
|
+
import { tableEmits } from '../../table/src/emits'
|
|
12
|
+
import { tableProps } from '../../table/src/props'
|
|
13
|
+
import VxeTableComponent from '../../table'
|
|
14
|
+
import VxeToolbarComponent from '../../toolbar'
|
|
15
|
+
|
|
16
|
+
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
17
|
+
import type {
|
|
18
|
+
VxeTableMethods,
|
|
19
|
+
VxeGridConstructor,
|
|
20
|
+
VxeGridEmits,
|
|
21
|
+
GridReactData,
|
|
22
|
+
GridInternalData,
|
|
23
|
+
VxeGridPropTypes,
|
|
24
|
+
VxeToolbarPropTypes,
|
|
25
|
+
GridMethods,
|
|
26
|
+
GridPrivateMethods,
|
|
27
|
+
VxeGridPrivateComputed,
|
|
28
|
+
VxeGridPrivateMethods,
|
|
29
|
+
VxeToolbarInstance,
|
|
30
|
+
GridPrivateRef,
|
|
31
|
+
VxeTableProps,
|
|
32
|
+
VxeTableConstructor,
|
|
33
|
+
VxeTablePrivateMethods,
|
|
34
|
+
VxeTableEvents,
|
|
35
|
+
VxeTableDefines,
|
|
36
|
+
VxeTableEventProps,
|
|
37
|
+
VxeGridProps,
|
|
38
|
+
VxeGridDefines
|
|
39
|
+
} from '../../../types'
|
|
40
|
+
|
|
41
|
+
const { warnLog, errLog } = createComponentLog('grid')
|
|
42
|
+
|
|
43
|
+
const { getConfig, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
44
|
+
|
|
45
|
+
const tableComponentPropKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
|
|
46
|
+
const tableComponentMethodKeys: (keyof VxeTableMethods)[] = [
|
|
47
|
+
'clearAll',
|
|
48
|
+
'syncData',
|
|
49
|
+
'updateData',
|
|
50
|
+
'loadData',
|
|
51
|
+
'reloadData',
|
|
52
|
+
'reloadRow',
|
|
53
|
+
'loadColumn',
|
|
54
|
+
'reloadColumn',
|
|
55
|
+
'getRowNode',
|
|
56
|
+
'getColumnNode',
|
|
57
|
+
'getRowIndex',
|
|
58
|
+
'getVTRowIndex',
|
|
59
|
+
'getVMRowIndex',
|
|
60
|
+
'getColumnIndex',
|
|
61
|
+
'getVTColumnIndex',
|
|
62
|
+
'getVMColumnIndex',
|
|
63
|
+
'setRow',
|
|
64
|
+
'createData',
|
|
65
|
+
'createRow',
|
|
66
|
+
'revertData',
|
|
67
|
+
'clearData',
|
|
68
|
+
'isRemoveByRow',
|
|
69
|
+
'isInsertByRow',
|
|
70
|
+
'isUpdateByRow',
|
|
71
|
+
'getColumns',
|
|
72
|
+
'getColumnById',
|
|
73
|
+
'getColumnByField',
|
|
74
|
+
'getTableColumn',
|
|
75
|
+
'getFullColumns',
|
|
76
|
+
'getData',
|
|
77
|
+
'getCheckboxRecords',
|
|
78
|
+
'getParentRow',
|
|
79
|
+
'getTreeRowChildren',
|
|
80
|
+
'getTreeRowLevel',
|
|
81
|
+
'getTreeParentRow',
|
|
82
|
+
'getRowSeq',
|
|
83
|
+
'getRowById',
|
|
84
|
+
'getRowid',
|
|
85
|
+
'getTableData',
|
|
86
|
+
'getFullData',
|
|
87
|
+
'setColumnFixed',
|
|
88
|
+
'clearColumnFixed',
|
|
89
|
+
'setColumnWidth',
|
|
90
|
+
'getColumnWidth',
|
|
91
|
+
'recalcRowHeight',
|
|
92
|
+
'setRowHeightConf',
|
|
93
|
+
'getRowHeightConf',
|
|
94
|
+
'setRowHeight',
|
|
95
|
+
'getRowHeight',
|
|
96
|
+
'hideColumn',
|
|
97
|
+
'showColumn',
|
|
98
|
+
'resetColumn',
|
|
99
|
+
'refreshColumn',
|
|
100
|
+
'refreshScroll',
|
|
101
|
+
'recalculate',
|
|
102
|
+
'closeTooltip',
|
|
103
|
+
'isAllCheckboxChecked',
|
|
104
|
+
'isAllCheckboxIndeterminate',
|
|
105
|
+
'getCheckboxIndeterminateRecords',
|
|
106
|
+
'setCheckboxRow',
|
|
107
|
+
'setCheckboxRowKey',
|
|
108
|
+
'isCheckedByCheckboxRow',
|
|
109
|
+
'isCheckedByCheckboxRowKey',
|
|
110
|
+
'isIndeterminateByCheckboxRow',
|
|
111
|
+
'isIndeterminateByCheckboxRowKey',
|
|
112
|
+
'toggleCheckboxRow',
|
|
113
|
+
'setAllCheckboxRow',
|
|
114
|
+
'getRadioReserveRecord',
|
|
115
|
+
'clearRadioReserve',
|
|
116
|
+
'getCheckboxReserveRecords',
|
|
117
|
+
'clearCheckboxReserve',
|
|
118
|
+
'toggleAllCheckboxRow',
|
|
119
|
+
'clearCheckboxRow',
|
|
120
|
+
'setCurrentRow',
|
|
121
|
+
'isCheckedByRadioRow',
|
|
122
|
+
'isCheckedByRadioRowKey',
|
|
123
|
+
'setRadioRow',
|
|
124
|
+
'setRadioRowKey',
|
|
125
|
+
'clearCurrentRow',
|
|
126
|
+
'clearRadioRow',
|
|
127
|
+
'getCurrentRecord',
|
|
128
|
+
'getRadioRecord',
|
|
129
|
+
'getCurrentColumn',
|
|
130
|
+
'setCurrentColumn',
|
|
131
|
+
'clearCurrentColumn',
|
|
132
|
+
'setPendingRow',
|
|
133
|
+
'togglePendingRow',
|
|
134
|
+
'hasPendingByRow',
|
|
135
|
+
'isPendingByRow',
|
|
136
|
+
'getPendingRecords',
|
|
137
|
+
'clearPendingRow',
|
|
138
|
+
'setFilterByEvent',
|
|
139
|
+
'sort',
|
|
140
|
+
'setSort',
|
|
141
|
+
'setSortByEvent',
|
|
142
|
+
'clearSort',
|
|
143
|
+
'clearSortByEvent',
|
|
144
|
+
'isSort',
|
|
145
|
+
'getSortColumns',
|
|
146
|
+
'closeFilter',
|
|
147
|
+
'isFilter',
|
|
148
|
+
'clearFilterByEvent',
|
|
149
|
+
'isActiveFilterByColumn',
|
|
150
|
+
'isRowExpandLoaded',
|
|
151
|
+
'clearRowExpandLoaded',
|
|
152
|
+
'reloadRowExpand',
|
|
153
|
+
'reloadRowExpand',
|
|
154
|
+
'toggleRowExpand',
|
|
155
|
+
'setAllRowExpand',
|
|
156
|
+
'setRowExpand',
|
|
157
|
+
'isExpandByRow',
|
|
158
|
+
'isRowExpandByRow',
|
|
159
|
+
'clearRowExpand',
|
|
160
|
+
'clearRowExpandReserve',
|
|
161
|
+
'getRowExpandRecords',
|
|
162
|
+
'getTreeExpandRecords',
|
|
163
|
+
'isTreeExpandLoaded',
|
|
164
|
+
'clearTreeExpandLoaded',
|
|
165
|
+
'reloadTreeExpand',
|
|
166
|
+
'reloadTreeChilds',
|
|
167
|
+
'toggleTreeExpand',
|
|
168
|
+
'setAllTreeExpand',
|
|
169
|
+
'setTreeExpand',
|
|
170
|
+
'isTreeExpandByRow',
|
|
171
|
+
'clearTreeExpand',
|
|
172
|
+
'clearTreeExpandReserve',
|
|
173
|
+
'getScroll',
|
|
174
|
+
'getScrollData',
|
|
175
|
+
'scrollTo',
|
|
176
|
+
'scrollToStartRow',
|
|
177
|
+
'scrollToEndRow',
|
|
178
|
+
'scrollToRow',
|
|
179
|
+
'scrollToStartColumn',
|
|
180
|
+
'scrollToEndColumn',
|
|
181
|
+
'scrollToColumn',
|
|
182
|
+
'clearScroll',
|
|
183
|
+
'updateFooter',
|
|
184
|
+
'updateStatus',
|
|
185
|
+
'setMergeCells',
|
|
186
|
+
'removeInsertRow',
|
|
187
|
+
'removeMergeCells',
|
|
188
|
+
'getMergeCells',
|
|
189
|
+
'setMergeHeaderCells',
|
|
190
|
+
'removeMergeHeaderCells',
|
|
191
|
+
'getMergeHeaderCells',
|
|
192
|
+
'clearMergeHeaderCells',
|
|
193
|
+
'clearMergeCells',
|
|
194
|
+
'setMergeFooterItems',
|
|
195
|
+
'removeMergeFooterItems',
|
|
196
|
+
'getMergeFooterItems',
|
|
197
|
+
'clearMergeFooterItems',
|
|
198
|
+
'setCustomStoreData',
|
|
199
|
+
'getCustomStoreData',
|
|
200
|
+
'setRowGroupExpand',
|
|
201
|
+
'setRowGroupExpandByField',
|
|
202
|
+
'setAllRowGroupExpand',
|
|
203
|
+
'clearRowGroupExpand',
|
|
204
|
+
'isRowGroupExpandByRow',
|
|
205
|
+
'isRowGroupRecord',
|
|
206
|
+
'isAggregateRecord',
|
|
207
|
+
'isAggregateExpandByRow',
|
|
208
|
+
'getAggregateContentByRow',
|
|
209
|
+
'getAggregateRowChildren',
|
|
210
|
+
'setRowGroups',
|
|
211
|
+
'clearRowGroups',
|
|
212
|
+
'openTooltip',
|
|
213
|
+
'moveColumnTo',
|
|
214
|
+
'moveRowTo',
|
|
215
|
+
'getCellLabel',
|
|
216
|
+
'updateCellLabel',
|
|
217
|
+
'clearFormatterCache',
|
|
218
|
+
'getFooterCellLabel',
|
|
219
|
+
'updateFooterCellLabel',
|
|
220
|
+
'clearFooterFormatterCache',
|
|
221
|
+
'getUpdateCells',
|
|
222
|
+
'undo',
|
|
223
|
+
'redo',
|
|
224
|
+
'effectCellData',
|
|
225
|
+
'getCellElement',
|
|
226
|
+
'focus',
|
|
227
|
+
'blur',
|
|
228
|
+
'connect',
|
|
229
|
+
'connectToolbar'
|
|
230
|
+
]
|
|
231
|
+
|
|
232
|
+
function createReactData(): GridReactData {
|
|
233
|
+
return {
|
|
234
|
+
tableLoading: false,
|
|
235
|
+
proxyInited: false,
|
|
236
|
+
isZMax: false,
|
|
237
|
+
tableData: [],
|
|
238
|
+
filterData: [],
|
|
239
|
+
formData: {},
|
|
240
|
+
sortData: [],
|
|
241
|
+
footerData: [],
|
|
242
|
+
tZindex: 0,
|
|
243
|
+
tablePage: {
|
|
244
|
+
total: 0,
|
|
245
|
+
pageSize: getConfig().pager?.pageSize || 10,
|
|
246
|
+
currentPage: 1
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function createInternalData(): GridInternalData {
|
|
252
|
+
return {
|
|
253
|
+
uFoot: false
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export default defineVxeComponent({
|
|
258
|
+
name: 'VxeGrid',
|
|
259
|
+
props: gridProps,
|
|
260
|
+
emits: gridEmits,
|
|
261
|
+
setup(props, context) {
|
|
262
|
+
const { slots, emit } = context
|
|
263
|
+
|
|
264
|
+
const xID = XEUtils.uniqueId()
|
|
265
|
+
|
|
266
|
+
// 使用已安装的组件,如果未安装则不渲染
|
|
267
|
+
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
268
|
+
const VxeUIPagerComponent = VxeUI.getComponent('VxePager')
|
|
269
|
+
|
|
270
|
+
const defaultLayouts: VxeGridPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']]
|
|
271
|
+
|
|
272
|
+
const { computeSize } = useFns.useSize(props)
|
|
273
|
+
const { computeIsVScrollbar } = useFns.useVScrollbar(props)
|
|
274
|
+
|
|
275
|
+
const reactData = reactive(createReactData())
|
|
276
|
+
|
|
277
|
+
const internalData = createInternalData()
|
|
278
|
+
|
|
279
|
+
const refElem = ref<HTMLDivElement>()
|
|
280
|
+
const refTable = ref<VxeTableConstructor & VxeTablePrivateMethods>()
|
|
281
|
+
const refForm = ref<VxeFormInstance>()
|
|
282
|
+
const refToolbar = ref<VxeToolbarInstance>()
|
|
283
|
+
const refPager = ref<VxePagerInstance>()
|
|
284
|
+
|
|
285
|
+
const refPopupContainerElem = ref<HTMLDivElement>()
|
|
286
|
+
|
|
287
|
+
const refFormWrapper = ref<HTMLDivElement>()
|
|
288
|
+
const refToolbarWrapper = ref<HTMLDivElement>()
|
|
289
|
+
const refTopWrapper = ref<HTMLDivElement>()
|
|
290
|
+
const refBottomWrapper = ref<HTMLDivElement>()
|
|
291
|
+
const refPagerWrapper = ref<HTMLDivElement>()
|
|
292
|
+
|
|
293
|
+
const extendTableMethods = <T>(methodKeys: T[]) => {
|
|
294
|
+
const funcs: any = {}
|
|
295
|
+
methodKeys.forEach((name) => {
|
|
296
|
+
funcs[name] = (...args: any[]) => {
|
|
297
|
+
const $xeTable: any = refTable.value
|
|
298
|
+
if ($xeTable && $xeTable[name]) {
|
|
299
|
+
return $xeTable[name](...args)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
})
|
|
303
|
+
return funcs
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const gridExtendTableMethods = extendTableMethods(tableComponentMethodKeys) as VxeTableMethods
|
|
307
|
+
|
|
308
|
+
tableComponentMethodKeys.forEach((name) => {
|
|
309
|
+
gridExtendTableMethods[name] = (...args: any[]) => {
|
|
310
|
+
const $xeTable: any = refTable.value
|
|
311
|
+
if ($xeTable && $xeTable[name]) {
|
|
312
|
+
return $xeTable && $xeTable[name](...args)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
const computeProxyOpts = computed(() => {
|
|
318
|
+
return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
const computeIsRespMsg = computed(() => {
|
|
322
|
+
const proxyOpts = computeProxyOpts.value
|
|
323
|
+
return !!(XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
const computeIsActiveMsg = computed(() => {
|
|
327
|
+
const proxyOpts = computeProxyOpts.value
|
|
328
|
+
return XEUtils.isBoolean(proxyOpts.showActionMsg) ? proxyOpts.showActionMsg : !!proxyOpts.showActiveMsg
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
const computePagerOpts = computed(() => {
|
|
332
|
+
return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig)
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
const computePagerProps = computed(() => {
|
|
336
|
+
const pagerOpts = computePagerOpts.value
|
|
337
|
+
return Object.assign({}, pagerOpts, { enabled: undefined, slots: undefined })
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
const computeFormOpts = computed(() => {
|
|
341
|
+
return Object.assign({}, getConfig().grid.formConfig, props.formConfig)
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
const computeToolbarOpts = computed(() => {
|
|
345
|
+
return Object.assign({}, getConfig().grid.toolbarConfig, props.toolbarConfig)
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
const computeZoomOpts = computed(() => {
|
|
349
|
+
return Object.assign({}, getConfig().grid.zoomConfig, props.zoomConfig)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
const computeStyles = computed(() => {
|
|
353
|
+
const { height, maxHeight } = props
|
|
354
|
+
const { isZMax, tZindex } = reactData
|
|
355
|
+
const stys: VxeComponentStyleType = {}
|
|
356
|
+
if (isZMax) {
|
|
357
|
+
stys.zIndex = tZindex
|
|
358
|
+
} else {
|
|
359
|
+
if (height) {
|
|
360
|
+
stys.height = height === 'auto' || height === '100%' ? '100%' : toCssUnit(height)
|
|
361
|
+
}
|
|
362
|
+
if (maxHeight) {
|
|
363
|
+
stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return stys
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
const computeTableExtendProps = computed(() => {
|
|
370
|
+
const rest: Record<string, any> = {}
|
|
371
|
+
tableComponentPropKeys.forEach((key) => {
|
|
372
|
+
if (props[key] !== undefined) {
|
|
373
|
+
rest[key] = props[key]
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
return rest
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
const computeTableProps = computed(() => {
|
|
380
|
+
const { showFooter, seqConfig, pagerConfig, editConfig, proxyConfig } = props
|
|
381
|
+
const { isZMax, tablePage, footerData } = reactData
|
|
382
|
+
const tableExtendProps = computeTableExtendProps.value
|
|
383
|
+
const proxyOpts = computeProxyOpts.value
|
|
384
|
+
const pagerOpts = computePagerOpts.value
|
|
385
|
+
const isLoading = computeIsLoading.value
|
|
386
|
+
const tProps = Object.assign({}, tableExtendProps)
|
|
387
|
+
if (showFooter && !tProps.footerData) {
|
|
388
|
+
// 如果未设置自己的标位数据,则使用代理的
|
|
389
|
+
tProps.footerData = footerData
|
|
390
|
+
} else if (proxyOpts.footer && footerData.length) {
|
|
391
|
+
// 如果代理标为数据,且未请求到数据,则用自己的
|
|
392
|
+
tProps.footerData = footerData
|
|
393
|
+
}
|
|
394
|
+
if (isZMax) {
|
|
395
|
+
if (tProps.maxHeight) {
|
|
396
|
+
tProps.maxHeight = '100%'
|
|
397
|
+
} else {
|
|
398
|
+
tProps.height = '100%'
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
402
|
+
tProps.loading = isLoading
|
|
403
|
+
if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
|
|
404
|
+
tProps.seqConfig = Object.assign({}, seqConfig, { startIndex: (tablePage.currentPage - 1) * tablePage.pageSize })
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (editConfig) {
|
|
408
|
+
tProps.editConfig = Object.assign({}, editConfig)
|
|
409
|
+
}
|
|
410
|
+
return tProps
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
const computeCurrLayoutConf = computed(() => {
|
|
414
|
+
const { layouts } = props
|
|
415
|
+
let confs: VxeGridPropTypes.Layouts = []
|
|
416
|
+
if (layouts && layouts.length) {
|
|
417
|
+
confs = layouts
|
|
418
|
+
} else {
|
|
419
|
+
confs = getConfig().grid.layouts || defaultLayouts
|
|
420
|
+
}
|
|
421
|
+
let headKeys: VxeGridDefines.LayoutKey[] = []
|
|
422
|
+
let bodyKeys: VxeGridDefines.LayoutKey[] = []
|
|
423
|
+
let footKeys: VxeGridDefines.LayoutKey[] = []
|
|
424
|
+
if (confs.length) {
|
|
425
|
+
if (XEUtils.isArray(confs[0])) {
|
|
426
|
+
headKeys = confs[0] as VxeGridDefines.LayoutKey[]
|
|
427
|
+
bodyKeys = (confs[1] || []) as VxeGridDefines.LayoutKey[]
|
|
428
|
+
footKeys = (confs[2] || []) as VxeGridDefines.LayoutKey[]
|
|
429
|
+
} else {
|
|
430
|
+
bodyKeys = confs as VxeGridDefines.LayoutKey[]
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return {
|
|
434
|
+
headKeys,
|
|
435
|
+
bodyKeys,
|
|
436
|
+
footKeys
|
|
437
|
+
}
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
const computeCustomCurrentPageFlag = computed(() => {
|
|
441
|
+
const pagerOpts = computePagerOpts.value
|
|
442
|
+
return pagerOpts.currentPage
|
|
443
|
+
})
|
|
444
|
+
|
|
445
|
+
const computeCustomPageSizeFlag = computed(() => {
|
|
446
|
+
const pagerOpts = computePagerOpts.value
|
|
447
|
+
return pagerOpts.pageSize
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
const computeCustomTotalFlag = computed(() => {
|
|
451
|
+
const pagerOpts = computePagerOpts.value
|
|
452
|
+
return pagerOpts.total
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
const computePageCount = computed(() => {
|
|
456
|
+
const { tablePage } = reactData
|
|
457
|
+
return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1)
|
|
458
|
+
})
|
|
459
|
+
|
|
460
|
+
const computeIsLoading = computed(() => {
|
|
461
|
+
const { loading, proxyConfig } = props
|
|
462
|
+
const { tableLoading } = reactData
|
|
463
|
+
const proxyOpts = computeProxyOpts.value
|
|
464
|
+
const { showLoading } = proxyOpts
|
|
465
|
+
return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts))
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
const refMaps: GridPrivateRef = {
|
|
469
|
+
refElem,
|
|
470
|
+
refTable,
|
|
471
|
+
refForm,
|
|
472
|
+
refToolbar,
|
|
473
|
+
refPager,
|
|
474
|
+
refPopupContainerElem
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const computeMaps: VxeGridPrivateComputed = {
|
|
478
|
+
computeSize,
|
|
479
|
+
computeIsVScrollbar,
|
|
480
|
+
computeProxyOpts,
|
|
481
|
+
computePagerOpts,
|
|
482
|
+
computeFormOpts,
|
|
483
|
+
computeToolbarOpts,
|
|
484
|
+
computeZoomOpts
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const $xeGrid = {
|
|
488
|
+
xID,
|
|
489
|
+
props: props as VxeGridProps,
|
|
490
|
+
context,
|
|
491
|
+
reactData,
|
|
492
|
+
internalData,
|
|
493
|
+
getRefMaps: () => refMaps,
|
|
494
|
+
getComputeMaps: () => computeMaps
|
|
495
|
+
} as VxeGridConstructor & VxeGridPrivateMethods
|
|
496
|
+
|
|
497
|
+
const initToolbar = () => {
|
|
498
|
+
const toolbarOpts = computeToolbarOpts.value
|
|
499
|
+
if (props.toolbarConfig && isEnableConf(toolbarOpts)) {
|
|
500
|
+
nextTick(() => {
|
|
501
|
+
const $xeTable = refTable.value
|
|
502
|
+
const $xeToolbar = refToolbar.value
|
|
503
|
+
if ($xeTable && $xeToolbar) {
|
|
504
|
+
$xeTable.connectToolbar($xeToolbar)
|
|
505
|
+
}
|
|
506
|
+
})
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const getFormData = () => {
|
|
511
|
+
const { proxyConfig } = props
|
|
512
|
+
const { formData } = reactData
|
|
513
|
+
const proxyOpts = computeProxyOpts.value
|
|
514
|
+
const formOpts = computeFormOpts.value
|
|
515
|
+
return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const initPages = (propKey?: 'currentPage' | 'pageSize' | 'total') => {
|
|
519
|
+
const { tablePage } = reactData
|
|
520
|
+
const { pagerConfig } = props
|
|
521
|
+
const pagerOpts = computePagerOpts.value
|
|
522
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
523
|
+
if (propKey) {
|
|
524
|
+
if (pagerOpts[propKey]) {
|
|
525
|
+
tablePage[propKey] = XEUtils.toNumber(pagerOpts[propKey])
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
const { currentPage, pageSize, total } = pagerOpts
|
|
529
|
+
if (currentPage) {
|
|
530
|
+
tablePage.currentPage = currentPage
|
|
531
|
+
}
|
|
532
|
+
if (pageSize) {
|
|
533
|
+
tablePage.pageSize = pageSize
|
|
534
|
+
}
|
|
535
|
+
if (total) {
|
|
536
|
+
tablePage.total = total
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const triggerPendingEvent = (code: string) => {
|
|
543
|
+
const isActiveMsg = computeIsActiveMsg.value
|
|
544
|
+
const $xeTable = refTable.value
|
|
545
|
+
const selectRecords = $xeTable ? $xeTable.getCheckboxRecords() : []
|
|
546
|
+
if (selectRecords.length) {
|
|
547
|
+
if ($xeTable) {
|
|
548
|
+
$xeTable.togglePendingRow(selectRecords)
|
|
549
|
+
}
|
|
550
|
+
$xeGrid.clearCheckboxRow()
|
|
551
|
+
} else {
|
|
552
|
+
if (isActiveMsg) {
|
|
553
|
+
if (VxeUI.modal) {
|
|
554
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' })
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
const getRespMsg = (rest: any, defaultMsg: string) => {
|
|
561
|
+
const proxyOpts = computeProxyOpts.value
|
|
562
|
+
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
563
|
+
const messageProp = resConfigs.message
|
|
564
|
+
const $xeTable = refTable.value
|
|
565
|
+
let msg
|
|
566
|
+
if (rest && messageProp) {
|
|
567
|
+
msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable as VxeTableConstructor, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, messageProp)
|
|
568
|
+
}
|
|
569
|
+
return msg || getI18n(defaultMsg)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const handleDeleteRow = (code: string, alertKey: string, callback: () => void): Promise<void> => {
|
|
573
|
+
const isActiveMsg = computeIsActiveMsg.value
|
|
574
|
+
const selectRecords = $xeGrid.getCheckboxRecords()
|
|
575
|
+
if (isActiveMsg) {
|
|
576
|
+
if (selectRecords.length) {
|
|
577
|
+
if (VxeUI.modal) {
|
|
578
|
+
return VxeUI.modal.confirm({ id: `cfm_${code}`, content: getI18n(alertKey), escClosable: true }).then((type) => {
|
|
579
|
+
if (type === 'confirm') {
|
|
580
|
+
return callback()
|
|
581
|
+
}
|
|
582
|
+
})
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
if (VxeUI.modal) {
|
|
586
|
+
VxeUI.modal.message({ id: `msg_${code}`, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' })
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
} else {
|
|
590
|
+
if (selectRecords.length) {
|
|
591
|
+
callback()
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return Promise.resolve()
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const pageChangeEvent: VxePagerEvents.PageChange = (params) => {
|
|
598
|
+
const { proxyConfig } = props
|
|
599
|
+
const { tablePage } = reactData
|
|
600
|
+
const { $event, currentPage, pageSize } = params
|
|
601
|
+
const proxyOpts = computeProxyOpts.value
|
|
602
|
+
tablePage.currentPage = currentPage
|
|
603
|
+
tablePage.pageSize = pageSize
|
|
604
|
+
$xeGrid.dispatchEvent('page-change', params, $event)
|
|
605
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
606
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
607
|
+
$xeGrid.dispatchEvent('proxy-query', rest, $event)
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const handleSortEvent: VxeTableEvents.SortChange | VxeTableEvents.ClearAllSort = (params) => {
|
|
613
|
+
const $xeTable = refTable.value
|
|
614
|
+
const { proxyConfig } = props
|
|
615
|
+
if (!$xeTable) {
|
|
616
|
+
return
|
|
617
|
+
}
|
|
618
|
+
const { computeSortOpts } = $xeTable.getComputeMaps()
|
|
619
|
+
const proxyOpts = computeProxyOpts.value
|
|
620
|
+
const sortOpts = computeSortOpts.value
|
|
621
|
+
// 如果是服务端排序
|
|
622
|
+
if (sortOpts.remote) {
|
|
623
|
+
reactData.sortData = params.sortList
|
|
624
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
625
|
+
reactData.tablePage.currentPage = 1
|
|
626
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
627
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event)
|
|
628
|
+
})
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const sortChangeEvent: VxeTableEvents.SortChange = (params) => {
|
|
634
|
+
handleSortEvent(params)
|
|
635
|
+
$xeGrid.dispatchEvent('sort-change', params, params.$event)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
const clearAllSortEvent: VxeTableEvents.ClearAllSort = (params) => {
|
|
639
|
+
handleSortEvent(params)
|
|
640
|
+
$xeGrid.dispatchEvent('clear-all-sort', params, params.$event)
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
const handleFilterEvent: VxeTableEvents.FilterChange | VxeTableEvents.ClearAllFilter = (params) => {
|
|
644
|
+
const $xeTable = refTable.value
|
|
645
|
+
const { proxyConfig } = props
|
|
646
|
+
if (!$xeTable) {
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
const { computeFilterOpts } = $xeTable.getComputeMaps()
|
|
650
|
+
const proxyOpts = computeProxyOpts.value
|
|
651
|
+
const filterOpts = computeFilterOpts.value
|
|
652
|
+
// 如果是服务端过滤
|
|
653
|
+
if (filterOpts.remote) {
|
|
654
|
+
reactData.filterData = params.filterList
|
|
655
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
656
|
+
reactData.tablePage.currentPage = 1
|
|
657
|
+
internalData.uFoot = true
|
|
658
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
659
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event)
|
|
660
|
+
})
|
|
661
|
+
internalData.uFoot = false
|
|
662
|
+
updateQueryFooter()
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const filterChangeEvent: VxeTableEvents.FilterChange = (params) => {
|
|
668
|
+
handleFilterEvent(params)
|
|
669
|
+
$xeGrid.dispatchEvent('filter-change', params, params.$event)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
const clearAllFilterEvent: VxeTableEvents.ClearAllFilter = (params) => {
|
|
673
|
+
handleFilterEvent(params)
|
|
674
|
+
$xeGrid.dispatchEvent('clear-all-filter', params, params.$event)
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
const submitFormEvent: VxeFormEvents.Submit = (params) => {
|
|
678
|
+
const { proxyConfig } = props
|
|
679
|
+
const proxyOpts = computeProxyOpts.value
|
|
680
|
+
const formOptions = proxyOpts.formOptions || {}
|
|
681
|
+
if (reactData.tableLoading) {
|
|
682
|
+
return
|
|
683
|
+
}
|
|
684
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
685
|
+
$xeGrid.dispatchEvent('form-submit', params, params.$event)
|
|
686
|
+
internalData.uFoot = true
|
|
687
|
+
$xeGrid.commitProxy(formOptions.submitMode || 'reload').then((rest) => {
|
|
688
|
+
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, params.$event)
|
|
689
|
+
})
|
|
690
|
+
internalData.uFoot = false
|
|
691
|
+
updateQueryFooter()
|
|
692
|
+
} else {
|
|
693
|
+
$xeGrid.dispatchEvent('form-submit', params, params.$event)
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
const resetFormEvent: VxeFormEvents.Reset = (params) => {
|
|
698
|
+
const $xeTable = refTable.value
|
|
699
|
+
const { proxyConfig } = props
|
|
700
|
+
const { $event } = params
|
|
701
|
+
const proxyOpts = computeProxyOpts.value
|
|
702
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
703
|
+
const formOptions = proxyOpts.formOptions || {}
|
|
704
|
+
$xeGrid.dispatchEvent('form-reset', params, $event)
|
|
705
|
+
if ($xeTable) {
|
|
706
|
+
$xeTable.clearScroll()
|
|
707
|
+
}
|
|
708
|
+
internalData.uFoot = true
|
|
709
|
+
$xeGrid.commitProxy(formOptions.resetMode === 'reset_form' ? 'query' : 'reload').then((rest) => {
|
|
710
|
+
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
|
|
711
|
+
})
|
|
712
|
+
internalData.uFoot = false
|
|
713
|
+
updateQueryFooter()
|
|
714
|
+
} else {
|
|
715
|
+
$xeGrid.dispatchEvent('form-reset', params, $event)
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
const submitInvalidEvent: VxeFormEvents.SubmitInvalid = (params) => {
|
|
720
|
+
$xeGrid.dispatchEvent('form-submit-invalid', params, params.$event)
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const collapseEvent: VxeFormEvents.Collapse = (params) => {
|
|
724
|
+
const { $event } = params
|
|
725
|
+
$xeGrid.dispatchEvent('form-toggle-collapse', params, $event)
|
|
726
|
+
$xeGrid.dispatchEvent('form-collapse', params, $event)
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
const handleZoom = (isMax?: boolean) => {
|
|
730
|
+
const { isZMax } = reactData
|
|
731
|
+
if (isMax ? !isZMax : isZMax) {
|
|
732
|
+
reactData.isZMax = !isZMax
|
|
733
|
+
if (reactData.tZindex < getLastZIndex()) {
|
|
734
|
+
reactData.tZindex = nextZIndex()
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return nextTick()
|
|
738
|
+
.then(() => $xeGrid.recalculate(true))
|
|
739
|
+
.then(() => {
|
|
740
|
+
setTimeout(() => $xeGrid.recalculate(true), 15)
|
|
741
|
+
return reactData.isZMax
|
|
742
|
+
})
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
const getFuncSlot = (optSlots: any, slotKey: string) => {
|
|
746
|
+
const funcSlot = optSlots[slotKey]
|
|
747
|
+
if (funcSlot) {
|
|
748
|
+
if (XEUtils.isString(funcSlot)) {
|
|
749
|
+
if (slots[funcSlot]) {
|
|
750
|
+
return slots[funcSlot]
|
|
751
|
+
} else {
|
|
752
|
+
errLog('vxe.error.notSlot', [funcSlot])
|
|
753
|
+
}
|
|
754
|
+
} else {
|
|
755
|
+
return funcSlot
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return null
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const getConfigSlot = (slotConfigs?: Record<string, any>) => {
|
|
762
|
+
const slotConf: Record<string, any> = {}
|
|
763
|
+
XEUtils.objectMap(slotConfigs, (slotFunc, slotKey) => {
|
|
764
|
+
if (slotFunc) {
|
|
765
|
+
if (XEUtils.isString(slotFunc)) {
|
|
766
|
+
if (slots[slotFunc]) {
|
|
767
|
+
slotConf[slotKey] = slots[slotFunc]
|
|
768
|
+
} else {
|
|
769
|
+
errLog('vxe.error.notSlot', [slotFunc])
|
|
770
|
+
}
|
|
771
|
+
} else {
|
|
772
|
+
slotConf[slotKey] = slotFunc
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
})
|
|
776
|
+
return slotConf
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* 渲染表单
|
|
781
|
+
*/
|
|
782
|
+
const renderForm = () => {
|
|
783
|
+
const { formConfig, proxyConfig } = props
|
|
784
|
+
const { formData } = reactData
|
|
785
|
+
const proxyOpts = computeProxyOpts.value
|
|
786
|
+
const formOpts = computeFormOpts.value
|
|
787
|
+
if ((formConfig && isEnableConf(formOpts)) || slots.form) {
|
|
788
|
+
let slotVNs: VNode[] = []
|
|
789
|
+
if (slots.form) {
|
|
790
|
+
slotVNs = slots.form({ $grid: $xeGrid, $gantt: null })
|
|
791
|
+
} else {
|
|
792
|
+
if (formOpts.items) {
|
|
793
|
+
const formSlots: { [key: string]: () => VNode[] } = {}
|
|
794
|
+
if (!(formOpts as any).inited) {
|
|
795
|
+
;(formOpts as any).inited = true
|
|
796
|
+
const beforeItem = proxyOpts.beforeItem
|
|
797
|
+
if (proxyOpts && beforeItem) {
|
|
798
|
+
formOpts.items.forEach((item) => {
|
|
799
|
+
beforeItem({ $grid: $xeGrid, $gantt: null, item })
|
|
800
|
+
})
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
// 处理插槽
|
|
804
|
+
formOpts.items.forEach((item) => {
|
|
805
|
+
XEUtils.each(item.slots, (func) => {
|
|
806
|
+
if (func && !XEUtils.isFunction(func)) {
|
|
807
|
+
if (slots[func]) {
|
|
808
|
+
formSlots[func] = slots[func] as any
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
})
|
|
812
|
+
})
|
|
813
|
+
if (VxeUIFormComponent) {
|
|
814
|
+
slotVNs.push(
|
|
815
|
+
h(
|
|
816
|
+
VxeUIFormComponent,
|
|
817
|
+
{
|
|
818
|
+
ref: refForm,
|
|
819
|
+
...Object.assign({}, formOpts, {
|
|
820
|
+
data: proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
|
|
821
|
+
}),
|
|
822
|
+
onSubmit: submitFormEvent,
|
|
823
|
+
onReset: resetFormEvent,
|
|
824
|
+
onSubmitInvalid: submitInvalidEvent,
|
|
825
|
+
onCollapse: collapseEvent
|
|
826
|
+
},
|
|
827
|
+
formSlots
|
|
828
|
+
)
|
|
829
|
+
)
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return h(
|
|
834
|
+
'div',
|
|
835
|
+
{
|
|
836
|
+
ref: refFormWrapper,
|
|
837
|
+
key: 'form',
|
|
838
|
+
class: 'vxe-grid--form-wrapper'
|
|
839
|
+
},
|
|
840
|
+
slotVNs
|
|
841
|
+
)
|
|
842
|
+
}
|
|
843
|
+
return renderEmptyElement($xeGrid)
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* 渲染工具栏
|
|
848
|
+
*/
|
|
849
|
+
const renderToolbar = () => {
|
|
850
|
+
const { toolbarConfig } = props
|
|
851
|
+
const toolbarOpts = computeToolbarOpts.value
|
|
852
|
+
const toolbarSlot = slots.toolbar
|
|
853
|
+
if ((toolbarConfig && isEnableConf(toolbarOpts)) || toolbarSlot) {
|
|
854
|
+
let slotVNs: VNode[] = []
|
|
855
|
+
if (toolbarSlot) {
|
|
856
|
+
slotVNs = toolbarSlot({ $grid: $xeGrid, $gantt: null })
|
|
857
|
+
} else {
|
|
858
|
+
const toolbarOptSlots = toolbarOpts.slots
|
|
859
|
+
const toolbarSlots: {
|
|
860
|
+
buttons?(params: any): any
|
|
861
|
+
buttonPrefix?(params: any): any
|
|
862
|
+
buttonSuffix?(params: any): any
|
|
863
|
+
tools?(params: any): any
|
|
864
|
+
toolPrefix?(params: any): any
|
|
865
|
+
toolSuffix?(params: any): any
|
|
866
|
+
} = {}
|
|
867
|
+
if (toolbarOptSlots) {
|
|
868
|
+
const buttonsSlot = getFuncSlot(toolbarOptSlots, 'buttons')
|
|
869
|
+
const buttonPrefixSlot = getFuncSlot(toolbarOptSlots, 'buttonPrefix')
|
|
870
|
+
const buttonSuffixSlot = getFuncSlot(toolbarOptSlots, 'buttonSuffix')
|
|
871
|
+
const toolsSlot = getFuncSlot(toolbarOptSlots, 'tools')
|
|
872
|
+
const toolPrefixSlot = getFuncSlot(toolbarOptSlots, 'toolPrefix')
|
|
873
|
+
const toolSuffixSlot = getFuncSlot(toolbarOptSlots, 'toolSuffix')
|
|
874
|
+
if (buttonsSlot) {
|
|
875
|
+
toolbarSlots.buttons = buttonsSlot
|
|
876
|
+
}
|
|
877
|
+
if (buttonPrefixSlot) {
|
|
878
|
+
toolbarSlots.buttonPrefix = buttonPrefixSlot
|
|
879
|
+
}
|
|
880
|
+
if (buttonSuffixSlot) {
|
|
881
|
+
toolbarSlots.buttonSuffix = buttonSuffixSlot
|
|
882
|
+
}
|
|
883
|
+
if (toolsSlot) {
|
|
884
|
+
toolbarSlots.tools = toolsSlot
|
|
885
|
+
}
|
|
886
|
+
if (toolPrefixSlot) {
|
|
887
|
+
toolbarSlots.toolPrefix = toolPrefixSlot
|
|
888
|
+
}
|
|
889
|
+
if (toolSuffixSlot) {
|
|
890
|
+
toolbarSlots.toolSuffix = toolSuffixSlot
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
slotVNs.push(
|
|
894
|
+
h(
|
|
895
|
+
VxeToolbarComponent,
|
|
896
|
+
{
|
|
897
|
+
ref: refToolbar,
|
|
898
|
+
...toolbarOpts,
|
|
899
|
+
slots: undefined
|
|
900
|
+
},
|
|
901
|
+
toolbarSlots
|
|
902
|
+
)
|
|
903
|
+
)
|
|
904
|
+
}
|
|
905
|
+
return h(
|
|
906
|
+
'div',
|
|
907
|
+
{
|
|
908
|
+
ref: refToolbarWrapper,
|
|
909
|
+
key: 'toolbar',
|
|
910
|
+
class: 'vxe-grid--toolbar-wrapper'
|
|
911
|
+
},
|
|
912
|
+
slotVNs
|
|
913
|
+
)
|
|
914
|
+
}
|
|
915
|
+
return renderEmptyElement($xeGrid)
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* 渲染表格顶部区域
|
|
920
|
+
*/
|
|
921
|
+
const renderTop = () => {
|
|
922
|
+
const topSlot = slots.top
|
|
923
|
+
if (topSlot) {
|
|
924
|
+
return h(
|
|
925
|
+
'div',
|
|
926
|
+
{
|
|
927
|
+
ref: refTopWrapper,
|
|
928
|
+
key: 'top',
|
|
929
|
+
class: 'vxe-grid--top-wrapper'
|
|
930
|
+
},
|
|
931
|
+
topSlot({ $grid: $xeGrid, $gantt: null })
|
|
932
|
+
)
|
|
933
|
+
}
|
|
934
|
+
return renderEmptyElement($xeGrid)
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
const renderTableLeft = () => {
|
|
938
|
+
const leftSlot = slots.left
|
|
939
|
+
if (leftSlot) {
|
|
940
|
+
return h(
|
|
941
|
+
'div',
|
|
942
|
+
{
|
|
943
|
+
class: 'vxe-grid--left-wrapper'
|
|
944
|
+
},
|
|
945
|
+
leftSlot({ $grid: $xeGrid, $gantt: null })
|
|
946
|
+
)
|
|
947
|
+
}
|
|
948
|
+
return renderEmptyElement($xeGrid)
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
const renderTableRight = () => {
|
|
952
|
+
const rightSlot = slots.right
|
|
953
|
+
if (rightSlot) {
|
|
954
|
+
return h(
|
|
955
|
+
'div',
|
|
956
|
+
{
|
|
957
|
+
class: 'vxe-grid--right-wrapper'
|
|
958
|
+
},
|
|
959
|
+
rightSlot({ $grid: $xeGrid, $gantt: null })
|
|
960
|
+
)
|
|
961
|
+
}
|
|
962
|
+
return renderEmptyElement($xeGrid)
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* 渲染表格
|
|
967
|
+
*/
|
|
968
|
+
const renderTable = () => {
|
|
969
|
+
const { proxyConfig } = props
|
|
970
|
+
const tableProps = computeTableProps.value
|
|
971
|
+
const proxyOpts = computeProxyOpts.value
|
|
972
|
+
const tableOns = Object.assign({}, tableCompEvents)
|
|
973
|
+
const emptySlot = slots.empty
|
|
974
|
+
const loadingSlot = slots.loading
|
|
975
|
+
const rowDragIconSlot = slots.rowDragIcon || slots['row-drag-icon']
|
|
976
|
+
const columnDragIconSlot = slots.columnDragIcon || slots['column-drag-icon']
|
|
977
|
+
const headerTooltipSlot = slots.headerTooltip || slots['header-tooltip']
|
|
978
|
+
const tooltipSlot = slots.tooltip
|
|
979
|
+
const footerTooltipSlot = slots.footerTooltip || slots['footer-tooltip']
|
|
980
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
981
|
+
if (proxyOpts.sort) {
|
|
982
|
+
tableOns.onSortChange = sortChangeEvent
|
|
983
|
+
tableOns.onClearAllSort = clearAllSortEvent
|
|
984
|
+
}
|
|
985
|
+
if (proxyOpts.filter) {
|
|
986
|
+
tableOns.onFilterChange = filterChangeEvent
|
|
987
|
+
tableOns.onClearAllFilter = clearAllFilterEvent
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
const slotObj: {
|
|
991
|
+
empty?(params: any): any
|
|
992
|
+
loading?(params: any): any
|
|
993
|
+
rowDragIcon?(params: any): any
|
|
994
|
+
columnDragIcon?(params: any): any
|
|
995
|
+
headerTooltip?(params: any): any
|
|
996
|
+
tooltip?(params: any): any
|
|
997
|
+
footerTooltip?(params: any): any
|
|
998
|
+
} = {}
|
|
999
|
+
if (emptySlot) {
|
|
1000
|
+
slotObj.empty = emptySlot
|
|
1001
|
+
}
|
|
1002
|
+
if (loadingSlot) {
|
|
1003
|
+
slotObj.loading = loadingSlot
|
|
1004
|
+
}
|
|
1005
|
+
if (rowDragIconSlot) {
|
|
1006
|
+
slotObj.rowDragIcon = rowDragIconSlot
|
|
1007
|
+
}
|
|
1008
|
+
if (columnDragIconSlot) {
|
|
1009
|
+
slotObj.columnDragIcon = columnDragIconSlot
|
|
1010
|
+
}
|
|
1011
|
+
if (headerTooltipSlot) {
|
|
1012
|
+
slotObj.headerTooltip = headerTooltipSlot
|
|
1013
|
+
}
|
|
1014
|
+
if (tooltipSlot) {
|
|
1015
|
+
slotObj.tooltip = tooltipSlot
|
|
1016
|
+
}
|
|
1017
|
+
if (footerTooltipSlot) {
|
|
1018
|
+
slotObj.footerTooltip = footerTooltipSlot
|
|
1019
|
+
}
|
|
1020
|
+
return h(
|
|
1021
|
+
'div',
|
|
1022
|
+
{
|
|
1023
|
+
class: 'vxe-grid--table-wrapper'
|
|
1024
|
+
},
|
|
1025
|
+
[
|
|
1026
|
+
h(
|
|
1027
|
+
VxeTableComponent,
|
|
1028
|
+
{
|
|
1029
|
+
ref: refTable,
|
|
1030
|
+
...tableProps,
|
|
1031
|
+
...tableOns
|
|
1032
|
+
},
|
|
1033
|
+
slotObj
|
|
1034
|
+
)
|
|
1035
|
+
]
|
|
1036
|
+
)
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* 渲染表格底部区域
|
|
1041
|
+
*/
|
|
1042
|
+
const renderBottom = () => {
|
|
1043
|
+
if (slots.bottom) {
|
|
1044
|
+
return h(
|
|
1045
|
+
'div',
|
|
1046
|
+
{
|
|
1047
|
+
ref: refBottomWrapper,
|
|
1048
|
+
key: 'bottom',
|
|
1049
|
+
class: 'vxe-grid--bottom-wrapper'
|
|
1050
|
+
},
|
|
1051
|
+
slots.bottom({ $grid: $xeGrid, $gantt: null })
|
|
1052
|
+
)
|
|
1053
|
+
}
|
|
1054
|
+
return renderEmptyElement($xeGrid)
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* 渲染分页
|
|
1059
|
+
*/
|
|
1060
|
+
const renderPager = () => {
|
|
1061
|
+
const { proxyConfig, pagerConfig } = props
|
|
1062
|
+
const proxyOpts = computeProxyOpts.value
|
|
1063
|
+
const pagerOpts = computePagerOpts.value
|
|
1064
|
+
const pagerProps = computePagerProps.value
|
|
1065
|
+
const pagerSlot = slots.pager
|
|
1066
|
+
if ((pagerConfig && isEnableConf(pagerOpts)) || slots.pager) {
|
|
1067
|
+
return h(
|
|
1068
|
+
'div',
|
|
1069
|
+
{
|
|
1070
|
+
ref: refPagerWrapper,
|
|
1071
|
+
key: 'pager',
|
|
1072
|
+
class: 'vxe-grid--pager-wrapper'
|
|
1073
|
+
},
|
|
1074
|
+
pagerSlot
|
|
1075
|
+
? pagerSlot({ $grid: $xeGrid, $gantt: null })
|
|
1076
|
+
: [
|
|
1077
|
+
VxeUIPagerComponent
|
|
1078
|
+
? h(
|
|
1079
|
+
VxeUIPagerComponent,
|
|
1080
|
+
{
|
|
1081
|
+
ref: refPager,
|
|
1082
|
+
...pagerProps,
|
|
1083
|
+
...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {}),
|
|
1084
|
+
onPageChange: pageChangeEvent
|
|
1085
|
+
},
|
|
1086
|
+
getConfigSlot(pagerOpts.slots)
|
|
1087
|
+
)
|
|
1088
|
+
: renderEmptyElement($xeGrid)
|
|
1089
|
+
]
|
|
1090
|
+
)
|
|
1091
|
+
}
|
|
1092
|
+
return renderEmptyElement($xeGrid)
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
const renderChildLayout = (layoutKeys: VxeGridDefines.LayoutKey[]) => {
|
|
1096
|
+
const childVNs: VNode[] = []
|
|
1097
|
+
layoutKeys.forEach((key) => {
|
|
1098
|
+
switch (key) {
|
|
1099
|
+
case 'Form':
|
|
1100
|
+
childVNs.push(renderForm())
|
|
1101
|
+
break
|
|
1102
|
+
case 'Toolbar':
|
|
1103
|
+
childVNs.push(renderToolbar())
|
|
1104
|
+
break
|
|
1105
|
+
case 'Top':
|
|
1106
|
+
childVNs.push(renderTop())
|
|
1107
|
+
break
|
|
1108
|
+
case 'Table':
|
|
1109
|
+
childVNs.push(
|
|
1110
|
+
h(
|
|
1111
|
+
'div',
|
|
1112
|
+
{
|
|
1113
|
+
key: 'table',
|
|
1114
|
+
class: 'vxe-grid--table-container'
|
|
1115
|
+
},
|
|
1116
|
+
[renderTableLeft(), renderTable(), renderTableRight()]
|
|
1117
|
+
)
|
|
1118
|
+
)
|
|
1119
|
+
break
|
|
1120
|
+
case 'Bottom':
|
|
1121
|
+
childVNs.push(renderBottom())
|
|
1122
|
+
break
|
|
1123
|
+
case 'Pager':
|
|
1124
|
+
childVNs.push(renderPager())
|
|
1125
|
+
break
|
|
1126
|
+
default:
|
|
1127
|
+
errLog('vxe.error.notProp', [`layouts -> ${key}`])
|
|
1128
|
+
break
|
|
1129
|
+
}
|
|
1130
|
+
})
|
|
1131
|
+
return childVNs
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
const renderLayout = () => {
|
|
1135
|
+
const currLayoutConf = computeCurrLayoutConf.value
|
|
1136
|
+
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
1137
|
+
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
1138
|
+
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
1139
|
+
return [
|
|
1140
|
+
h(
|
|
1141
|
+
'div',
|
|
1142
|
+
{
|
|
1143
|
+
class: 'vxe-grid--layout-header-wrapper'
|
|
1144
|
+
},
|
|
1145
|
+
renderChildLayout(headKeys)
|
|
1146
|
+
),
|
|
1147
|
+
h(
|
|
1148
|
+
'div',
|
|
1149
|
+
{
|
|
1150
|
+
class: 'vxe-grid--layout-body-wrapper'
|
|
1151
|
+
},
|
|
1152
|
+
[
|
|
1153
|
+
asideLeftSlot
|
|
1154
|
+
? h(
|
|
1155
|
+
'div',
|
|
1156
|
+
{
|
|
1157
|
+
class: 'vxe-grid--layout-aside-left-wrapper'
|
|
1158
|
+
},
|
|
1159
|
+
asideLeftSlot({})
|
|
1160
|
+
)
|
|
1161
|
+
: renderEmptyElement($xeGrid),
|
|
1162
|
+
h(
|
|
1163
|
+
'div',
|
|
1164
|
+
{
|
|
1165
|
+
class: 'vxe-grid--layout-body-content-wrapper'
|
|
1166
|
+
},
|
|
1167
|
+
renderChildLayout(bodyKeys)
|
|
1168
|
+
),
|
|
1169
|
+
asideRightSlot
|
|
1170
|
+
? h(
|
|
1171
|
+
'div',
|
|
1172
|
+
{
|
|
1173
|
+
class: 'vxe-grid--layout-aside-right-wrapper'
|
|
1174
|
+
},
|
|
1175
|
+
asideRightSlot({})
|
|
1176
|
+
)
|
|
1177
|
+
: renderEmptyElement($xeGrid)
|
|
1178
|
+
]
|
|
1179
|
+
),
|
|
1180
|
+
h(
|
|
1181
|
+
'div',
|
|
1182
|
+
{
|
|
1183
|
+
class: 'vxe-grid--layout-footer-wrapper'
|
|
1184
|
+
},
|
|
1185
|
+
renderChildLayout(footKeys)
|
|
1186
|
+
),
|
|
1187
|
+
h('div', {
|
|
1188
|
+
ref: refPopupContainerElem
|
|
1189
|
+
})
|
|
1190
|
+
]
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
const tableCompEvents: VxeTableEventProps = {}
|
|
1194
|
+
tableEmits.forEach((name) => {
|
|
1195
|
+
const type = XEUtils.camelCase(`on-${name}`) as keyof VxeTableEventProps
|
|
1196
|
+
tableCompEvents[type] = (...args: any[]) => emit(name, ...args)
|
|
1197
|
+
})
|
|
1198
|
+
|
|
1199
|
+
const getDefaultFormData = () => {
|
|
1200
|
+
const formOpts = computeFormOpts.value
|
|
1201
|
+
if (formOpts.items) {
|
|
1202
|
+
const fData: any = {}
|
|
1203
|
+
formOpts.items.forEach((item) => {
|
|
1204
|
+
const { field, itemRender } = item
|
|
1205
|
+
if (field) {
|
|
1206
|
+
let itemValue: any = null
|
|
1207
|
+
if (itemRender) {
|
|
1208
|
+
const { startField, endField, defaultValue } = itemRender
|
|
1209
|
+
if (XEUtils.isFunction(defaultValue)) {
|
|
1210
|
+
itemValue = defaultValue({ item })
|
|
1211
|
+
} else if (!XEUtils.isUndefined(defaultValue)) {
|
|
1212
|
+
itemValue = defaultValue
|
|
1213
|
+
}
|
|
1214
|
+
if (startField && endField) {
|
|
1215
|
+
XEUtils.set(fData, startField, null)
|
|
1216
|
+
XEUtils.set(fData, endField, null)
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
fData[field] = itemValue
|
|
1220
|
+
}
|
|
1221
|
+
})
|
|
1222
|
+
return fData
|
|
1223
|
+
}
|
|
1224
|
+
return {}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
const initProxy = () => {
|
|
1228
|
+
const { proxyConfig, formConfig } = props
|
|
1229
|
+
const { proxyInited } = reactData
|
|
1230
|
+
const proxyOpts = computeProxyOpts.value
|
|
1231
|
+
const formOpts = computeFormOpts.value
|
|
1232
|
+
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
1233
|
+
if (formConfig && isEnableConf(formOpts) && proxyOpts.form && formOpts.items) {
|
|
1234
|
+
reactData.formData = getDefaultFormData()
|
|
1235
|
+
}
|
|
1236
|
+
if (!proxyInited) {
|
|
1237
|
+
reactData.proxyInited = true
|
|
1238
|
+
if (proxyOpts.autoLoad !== false) {
|
|
1239
|
+
nextTick()
|
|
1240
|
+
.then(() => {
|
|
1241
|
+
internalData.uFoot = true
|
|
1242
|
+
const rest = $xeGrid.commitProxy('initial')
|
|
1243
|
+
internalData.uFoot = false
|
|
1244
|
+
updateQueryFooter()
|
|
1245
|
+
return rest
|
|
1246
|
+
})
|
|
1247
|
+
.then((rest) => {
|
|
1248
|
+
dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
|
|
1249
|
+
})
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
const updateQueryFooter = () => {
|
|
1256
|
+
const proxyOpts = computeProxyOpts.value
|
|
1257
|
+
const { ajax } = proxyOpts
|
|
1258
|
+
if (ajax && ajax.queryFooter) {
|
|
1259
|
+
return $xeGrid.commitProxy('queryFooter')
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
|
|
1264
|
+
const zoomOpts = computeZoomOpts.value
|
|
1265
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
1266
|
+
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
1267
|
+
$xeGrid.triggerZoomEvent(evnt)
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
const dispatchEvent = (type: ValueOf<VxeGridEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
1272
|
+
emit(type, createEvent(evnt, { $grid: $xeGrid, $gantt: null }, params))
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
const gridMethods: GridMethods = {
|
|
1276
|
+
dispatchEvent,
|
|
1277
|
+
getEl() {
|
|
1278
|
+
return refElem.value as HTMLDivElement
|
|
1279
|
+
},
|
|
1280
|
+
/**
|
|
1281
|
+
* 提交指令,支持 code 或 button
|
|
1282
|
+
* @param {String/Object} code 字符串或对象
|
|
1283
|
+
*/
|
|
1284
|
+
commitProxy(proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) {
|
|
1285
|
+
const { showFooter, proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
1286
|
+
const { tablePage } = reactData
|
|
1287
|
+
const isActiveMsg = computeIsActiveMsg.value
|
|
1288
|
+
const isRespMsg = computeIsRespMsg.value
|
|
1289
|
+
const proxyOpts = computeProxyOpts.value
|
|
1290
|
+
const pagerOpts = computePagerOpts.value
|
|
1291
|
+
const toolbarOpts = computeToolbarOpts.value
|
|
1292
|
+
const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts
|
|
1293
|
+
const resConfigs = (proxyOpts.response || proxyOpts.props || {}) as VxeGridDefines.ProxyConfigResponseConfig
|
|
1294
|
+
const $xeTable = refTable.value
|
|
1295
|
+
if (!$xeTable) {
|
|
1296
|
+
return nextTick()
|
|
1297
|
+
}
|
|
1298
|
+
let formData = getFormData()
|
|
1299
|
+
let button: VxeToolbarPropTypes.ButtonConfig | null = null
|
|
1300
|
+
let code: string | null = null
|
|
1301
|
+
if (XEUtils.isString(proxyTarget)) {
|
|
1302
|
+
const { buttons } = toolbarOpts
|
|
1303
|
+
const matchObj = toolbarConfig && isEnableConf(toolbarOpts) && buttons ? XEUtils.findTree(buttons, (item) => item.code === proxyTarget, { children: 'dropdowns' }) : null
|
|
1304
|
+
button = matchObj ? matchObj.item : null
|
|
1305
|
+
code = proxyTarget
|
|
1306
|
+
} else {
|
|
1307
|
+
button = proxyTarget
|
|
1308
|
+
code = button.code as string
|
|
1309
|
+
}
|
|
1310
|
+
const btnParams = button ? button.params : null
|
|
1311
|
+
switch (code) {
|
|
1312
|
+
case 'insert':
|
|
1313
|
+
return $xeTable.insert({})
|
|
1314
|
+
case 'insert_edit':
|
|
1315
|
+
return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
|
|
1316
|
+
|
|
1317
|
+
// 已废弃
|
|
1318
|
+
case 'insert_actived':
|
|
1319
|
+
return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
|
|
1320
|
+
// 已废弃
|
|
1321
|
+
|
|
1322
|
+
case 'mark_cancel':
|
|
1323
|
+
triggerPendingEvent(code)
|
|
1324
|
+
break
|
|
1325
|
+
case 'remove':
|
|
1326
|
+
return handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => $xeTable.removeCheckboxRow())
|
|
1327
|
+
case 'import':
|
|
1328
|
+
$xeTable.importData(btnParams)
|
|
1329
|
+
break
|
|
1330
|
+
case 'open_import':
|
|
1331
|
+
$xeTable.openImport(btnParams)
|
|
1332
|
+
break
|
|
1333
|
+
case 'export':
|
|
1334
|
+
$xeTable.exportData(btnParams)
|
|
1335
|
+
break
|
|
1336
|
+
case 'open_export':
|
|
1337
|
+
$xeTable.openExport(btnParams)
|
|
1338
|
+
break
|
|
1339
|
+
case 'reset_custom':
|
|
1340
|
+
return $xeTable.resetCustom(true)
|
|
1341
|
+
case 'initial':
|
|
1342
|
+
case 'reload':
|
|
1343
|
+
case 'query': {
|
|
1344
|
+
const bqMethod = ajax.beforeQuery
|
|
1345
|
+
const qMethod = ajax.query
|
|
1346
|
+
const aqMethod = ajax.afterQuery
|
|
1347
|
+
const qsMethod = ajax.querySuccess
|
|
1348
|
+
const qeMethod = ajax.queryError
|
|
1349
|
+
if (qMethod) {
|
|
1350
|
+
const isInited = code === 'initial'
|
|
1351
|
+
const isReload = code === 'reload'
|
|
1352
|
+
if (!isInited && reactData.tableLoading) {
|
|
1353
|
+
return nextTick()
|
|
1354
|
+
}
|
|
1355
|
+
let operPromise = null
|
|
1356
|
+
let sortList: any[] = []
|
|
1357
|
+
let filterList: VxeTableDefines.FilterCheckedParams[] = []
|
|
1358
|
+
let pageParams: any = {}
|
|
1359
|
+
if (pagerConfig) {
|
|
1360
|
+
if (isInited || isReload) {
|
|
1361
|
+
// 重置分页
|
|
1362
|
+
tablePage.currentPage = 1
|
|
1363
|
+
}
|
|
1364
|
+
if (isEnableConf(pagerOpts)) {
|
|
1365
|
+
pageParams = { ...tablePage }
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (isInited) {
|
|
1369
|
+
// 重置代理表单数据
|
|
1370
|
+
if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
|
|
1371
|
+
formData = getDefaultFormData()
|
|
1372
|
+
reactData.formData = formData
|
|
1373
|
+
}
|
|
1374
|
+
if ($xeTable) {
|
|
1375
|
+
const tableInternalData = $xeTable.internalData
|
|
1376
|
+
const { tableFullColumn, fullColumnFieldData } = tableInternalData
|
|
1377
|
+
const { computeSortOpts } = $xeTable.getComputeMaps()
|
|
1378
|
+
const sortOpts = computeSortOpts.value
|
|
1379
|
+
let defaultSort = sortOpts.defaultSort
|
|
1380
|
+
tableFullColumn.forEach((column) => {
|
|
1381
|
+
column.order = null
|
|
1382
|
+
})
|
|
1383
|
+
// 如果使用默认排序
|
|
1384
|
+
if (defaultSort) {
|
|
1385
|
+
if (!XEUtils.isArray(defaultSort)) {
|
|
1386
|
+
defaultSort = [defaultSort]
|
|
1387
|
+
}
|
|
1388
|
+
sortList = defaultSort.map((item) => {
|
|
1389
|
+
const { field, order } = item
|
|
1390
|
+
const colRest = fullColumnFieldData[field]
|
|
1391
|
+
if (colRest) {
|
|
1392
|
+
const column = colRest.column
|
|
1393
|
+
if (column) {
|
|
1394
|
+
column.order = order
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
return {
|
|
1398
|
+
field,
|
|
1399
|
+
property: field,
|
|
1400
|
+
order
|
|
1401
|
+
}
|
|
1402
|
+
})
|
|
1403
|
+
}
|
|
1404
|
+
filterList = $xeTable.getCheckedFilters()
|
|
1405
|
+
}
|
|
1406
|
+
} else {
|
|
1407
|
+
if ($xeTable) {
|
|
1408
|
+
if (isReload) {
|
|
1409
|
+
operPromise = $xeTable.clearAll()
|
|
1410
|
+
} else {
|
|
1411
|
+
sortList = $xeTable.getSortColumns()
|
|
1412
|
+
filterList = $xeTable.getCheckedFilters()
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
const commitParams = {
|
|
1417
|
+
$table: $xeTable,
|
|
1418
|
+
$grid: $xeGrid,
|
|
1419
|
+
$gantt: null,
|
|
1420
|
+
code,
|
|
1421
|
+
button,
|
|
1422
|
+
isInited,
|
|
1423
|
+
isReload,
|
|
1424
|
+
page: pageParams,
|
|
1425
|
+
sort: sortList.length ? sortList[0] : {},
|
|
1426
|
+
sorts: sortList,
|
|
1427
|
+
filters: filterList,
|
|
1428
|
+
form: formData,
|
|
1429
|
+
options: qMethod
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
const handleQuery = () => {
|
|
1433
|
+
reactData.sortData = sortList
|
|
1434
|
+
reactData.filterData = filterList
|
|
1435
|
+
reactData.tableLoading = true
|
|
1436
|
+
return Promise.all([Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)), operPromise])
|
|
1437
|
+
.then(([rest]) => {
|
|
1438
|
+
reactData.tableLoading = false
|
|
1439
|
+
if (aqMethod) {
|
|
1440
|
+
aqMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1441
|
+
} else {
|
|
1442
|
+
let tableData: any[] = []
|
|
1443
|
+
if (rest) {
|
|
1444
|
+
const listProp = resConfigs.list
|
|
1445
|
+
const resultProp = resConfigs.result
|
|
1446
|
+
const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }
|
|
1447
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1448
|
+
const totalProp = resConfigs.total
|
|
1449
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1450
|
+
tablePage.total = XEUtils.toNumber(total)
|
|
1451
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1452
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1453
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
1454
|
+
if (tablePage.currentPage > pageCount) {
|
|
1455
|
+
tablePage.currentPage = pageCount
|
|
1456
|
+
}
|
|
1457
|
+
} else {
|
|
1458
|
+
if (XEUtils.isArray(rest)) {
|
|
1459
|
+
tableData = rest
|
|
1460
|
+
} else if (listProp) {
|
|
1461
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || []
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
if (showFooter) {
|
|
1465
|
+
const fdProp = resConfigs.footerData
|
|
1466
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : []
|
|
1467
|
+
if (XEUtils.isArray(footerList)) {
|
|
1468
|
+
reactData.footerData = footerList
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if ($xeTable) {
|
|
1473
|
+
$xeTable.loadData(tableData)
|
|
1474
|
+
} else {
|
|
1475
|
+
nextTick(() => {
|
|
1476
|
+
const $xeTable = refTable.value
|
|
1477
|
+
if ($xeTable) {
|
|
1478
|
+
$xeTable.loadData(tableData)
|
|
1479
|
+
}
|
|
1480
|
+
})
|
|
1481
|
+
}
|
|
1482
|
+
if (oldAfterQuery) {
|
|
1483
|
+
oldAfterQuery({ ...commitParams, response: rest }, ...args)
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
if (qsMethod) {
|
|
1488
|
+
qsMethod({ ...commitParams, response: rest })
|
|
1489
|
+
}
|
|
1490
|
+
return { status: true }
|
|
1491
|
+
})
|
|
1492
|
+
.catch((rest) => {
|
|
1493
|
+
reactData.tableLoading = false
|
|
1494
|
+
if (aqMethod) {
|
|
1495
|
+
aqMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1496
|
+
}
|
|
1497
|
+
if (qeMethod) {
|
|
1498
|
+
qeMethod({ ...commitParams, response: rest })
|
|
1499
|
+
}
|
|
1500
|
+
return { status: false }
|
|
1501
|
+
})
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
if (bqMethod) {
|
|
1505
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then((status) => {
|
|
1506
|
+
if (status !== false) {
|
|
1507
|
+
return handleQuery()
|
|
1508
|
+
}
|
|
1509
|
+
})
|
|
1510
|
+
}
|
|
1511
|
+
return handleQuery()
|
|
1512
|
+
} else {
|
|
1513
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.query'])
|
|
1514
|
+
}
|
|
1515
|
+
break
|
|
1516
|
+
}
|
|
1517
|
+
case 'queryFooter':
|
|
1518
|
+
case 'query_footer': {
|
|
1519
|
+
const bqfMethod = ajax.beforeQueryFooter
|
|
1520
|
+
const qfMethod = ajax.queryFooter
|
|
1521
|
+
const aqfMethod = ajax.afterQueryFooter
|
|
1522
|
+
const qfSuccessMethod = ajax.queryFooterSuccess
|
|
1523
|
+
const qfErrorMethod = ajax.queryFooterError
|
|
1524
|
+
if (qfMethod) {
|
|
1525
|
+
let filterList: VxeTableDefines.FilterCheckedParams[] = []
|
|
1526
|
+
if ($xeTable) {
|
|
1527
|
+
filterList = $xeTable.getCheckedFilters()
|
|
1528
|
+
}
|
|
1529
|
+
let pageParams: any = {}
|
|
1530
|
+
if (pagerConfig) {
|
|
1531
|
+
if (isEnableConf(pagerOpts)) {
|
|
1532
|
+
pageParams = { ...tablePage }
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
const commitParams = {
|
|
1536
|
+
$table: $xeTable,
|
|
1537
|
+
$grid: $xeGrid,
|
|
1538
|
+
$gantt: null,
|
|
1539
|
+
code,
|
|
1540
|
+
button,
|
|
1541
|
+
page: pageParams,
|
|
1542
|
+
filters: filterList,
|
|
1543
|
+
form: formData,
|
|
1544
|
+
options: qfMethod
|
|
1545
|
+
}
|
|
1546
|
+
const handleQueryFooter = () => {
|
|
1547
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args))
|
|
1548
|
+
.then((rest) => {
|
|
1549
|
+
if (aqfMethod) {
|
|
1550
|
+
aqfMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1551
|
+
} else {
|
|
1552
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : []
|
|
1553
|
+
if (oldAfterQueryFooter) {
|
|
1554
|
+
oldAfterQueryFooter({ ...commitParams, response: rest }, ...args)
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
if (qfSuccessMethod) {
|
|
1558
|
+
qfSuccessMethod({ ...commitParams, response: rest })
|
|
1559
|
+
}
|
|
1560
|
+
return { status: true }
|
|
1561
|
+
})
|
|
1562
|
+
.catch((rest) => {
|
|
1563
|
+
if (aqfMethod) {
|
|
1564
|
+
aqfMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1565
|
+
}
|
|
1566
|
+
if (qfErrorMethod) {
|
|
1567
|
+
qfErrorMethod({ ...commitParams, response: rest })
|
|
1568
|
+
}
|
|
1569
|
+
return { status: false }
|
|
1570
|
+
})
|
|
1571
|
+
}
|
|
1572
|
+
if (bqfMethod) {
|
|
1573
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then((status) => {
|
|
1574
|
+
if (status !== false) {
|
|
1575
|
+
return handleQueryFooter()
|
|
1576
|
+
}
|
|
1577
|
+
})
|
|
1578
|
+
}
|
|
1579
|
+
return handleQueryFooter()
|
|
1580
|
+
} else {
|
|
1581
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter'])
|
|
1582
|
+
}
|
|
1583
|
+
break
|
|
1584
|
+
}
|
|
1585
|
+
case 'delete': {
|
|
1586
|
+
const bdMethod = ajax.beforeDelete
|
|
1587
|
+
const dMethod = ajax.delete
|
|
1588
|
+
const adMethod = ajax.afterDelete
|
|
1589
|
+
const deleteSuccessMethods = ajax.deleteSuccess
|
|
1590
|
+
const deleteErrorMethods = ajax.deleteError
|
|
1591
|
+
if (dMethod) {
|
|
1592
|
+
const selectRecords = $xeGrid.getCheckboxRecords()
|
|
1593
|
+
const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row))
|
|
1594
|
+
const body = { removeRecords }
|
|
1595
|
+
const commitParams = {
|
|
1596
|
+
$table: $xeTable,
|
|
1597
|
+
$grid: $xeGrid,
|
|
1598
|
+
$gantt: null,
|
|
1599
|
+
code,
|
|
1600
|
+
button,
|
|
1601
|
+
body,
|
|
1602
|
+
form: formData,
|
|
1603
|
+
options: dMethod
|
|
1604
|
+
}
|
|
1605
|
+
if (selectRecords.length) {
|
|
1606
|
+
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1607
|
+
if (!removeRecords.length) {
|
|
1608
|
+
return $xeTable.remove(selectRecords)
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
const handleDelete = () => {
|
|
1612
|
+
reactData.tableLoading = true
|
|
1613
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
|
|
1614
|
+
.then((rest) => {
|
|
1615
|
+
reactData.tableLoading = false
|
|
1616
|
+
if (adMethod) {
|
|
1617
|
+
adMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1618
|
+
} else {
|
|
1619
|
+
$xeTable.setPendingRow(removeRecords, false)
|
|
1620
|
+
if (isRespMsg) {
|
|
1621
|
+
if (VxeUI.modal) {
|
|
1622
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' })
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (oldAfterDelete) {
|
|
1626
|
+
oldAfterDelete({ ...commitParams, response: rest }, ...args)
|
|
1627
|
+
} else {
|
|
1628
|
+
internalData.uFoot = true
|
|
1629
|
+
$xeGrid.commitProxy('query')
|
|
1630
|
+
internalData.uFoot = false
|
|
1631
|
+
updateQueryFooter()
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
if (deleteSuccessMethods) {
|
|
1635
|
+
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
1636
|
+
}
|
|
1637
|
+
return { status: true }
|
|
1638
|
+
})
|
|
1639
|
+
.catch((rest) => {
|
|
1640
|
+
reactData.tableLoading = false
|
|
1641
|
+
if (adMethod) {
|
|
1642
|
+
adMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1643
|
+
} else {
|
|
1644
|
+
if (isRespMsg) {
|
|
1645
|
+
if (VxeUI.modal) {
|
|
1646
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
if (deleteErrorMethods) {
|
|
1651
|
+
deleteErrorMethods({ ...commitParams, response: rest })
|
|
1652
|
+
}
|
|
1653
|
+
return { status: false }
|
|
1654
|
+
})
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
if (bdMethod) {
|
|
1658
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then((status) => {
|
|
1659
|
+
if (status !== false) {
|
|
1660
|
+
return handleDelete()
|
|
1661
|
+
}
|
|
1662
|
+
})
|
|
1663
|
+
}
|
|
1664
|
+
return handleDelete()
|
|
1665
|
+
})
|
|
1666
|
+
} else {
|
|
1667
|
+
if (isActiveMsg) {
|
|
1668
|
+
if (VxeUI.modal) {
|
|
1669
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' })
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
} else {
|
|
1674
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.delete'])
|
|
1675
|
+
}
|
|
1676
|
+
break
|
|
1677
|
+
}
|
|
1678
|
+
case 'save': {
|
|
1679
|
+
const bSaveMethod = ajax.beforeSave
|
|
1680
|
+
const sMethod = ajax.save
|
|
1681
|
+
const aSaveMethod = ajax.afterSave
|
|
1682
|
+
const sSuccessMethod = ajax.saveSuccess
|
|
1683
|
+
const sErrorMethod = ajax.saveError
|
|
1684
|
+
if (sMethod) {
|
|
1685
|
+
const body = $xeTable.getRecordset()
|
|
1686
|
+
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
|
|
1687
|
+
const commitParams = {
|
|
1688
|
+
$table: $xeTable,
|
|
1689
|
+
$grid: $xeGrid,
|
|
1690
|
+
$gantt: null,
|
|
1691
|
+
code,
|
|
1692
|
+
button,
|
|
1693
|
+
body,
|
|
1694
|
+
form: formData,
|
|
1695
|
+
options: sMethod
|
|
1696
|
+
}
|
|
1697
|
+
// 排除掉新增且标记为删除的数据
|
|
1698
|
+
if (insertRecords.length) {
|
|
1699
|
+
body.pendingRecords = pendingRecords.filter((row) => $xeTable.findRowIndexOf(insertRecords, row) === -1)
|
|
1700
|
+
}
|
|
1701
|
+
// 排除已标记为删除的数据
|
|
1702
|
+
if (pendingRecords.length) {
|
|
1703
|
+
body.insertRecords = insertRecords.filter((row) => $xeTable.findRowIndexOf(pendingRecords, row) === -1)
|
|
1704
|
+
}
|
|
1705
|
+
let restPromise: Promise<any> = Promise.resolve()
|
|
1706
|
+
if (editRules) {
|
|
1707
|
+
// 只校验新增和修改的数据
|
|
1708
|
+
restPromise = $xeTable[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords))
|
|
1709
|
+
}
|
|
1710
|
+
return restPromise.then((errMap) => {
|
|
1711
|
+
if (errMap) {
|
|
1712
|
+
// 如果校验不通过
|
|
1713
|
+
return
|
|
1714
|
+
}
|
|
1715
|
+
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1716
|
+
const handleSave = () => {
|
|
1717
|
+
reactData.tableLoading = true
|
|
1718
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
|
|
1719
|
+
.then((rest) => {
|
|
1720
|
+
reactData.tableLoading = false
|
|
1721
|
+
if (aSaveMethod) {
|
|
1722
|
+
aSaveMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1723
|
+
} else {
|
|
1724
|
+
$xeTable.clearPendingRow()
|
|
1725
|
+
if (isRespMsg) {
|
|
1726
|
+
if (VxeUI.modal) {
|
|
1727
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' })
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
if (oldAfterSave) {
|
|
1731
|
+
oldAfterSave({ ...commitParams, response: rest }, ...args)
|
|
1732
|
+
} else {
|
|
1733
|
+
internalData.uFoot = true
|
|
1734
|
+
$xeGrid.commitProxy('query')
|
|
1735
|
+
internalData.uFoot = false
|
|
1736
|
+
updateQueryFooter()
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (sSuccessMethod) {
|
|
1740
|
+
sSuccessMethod({ ...commitParams, response: rest })
|
|
1741
|
+
}
|
|
1742
|
+
return { status: true }
|
|
1743
|
+
})
|
|
1744
|
+
.catch((rest) => {
|
|
1745
|
+
reactData.tableLoading = false
|
|
1746
|
+
if (aSaveMethod) {
|
|
1747
|
+
aSaveMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1748
|
+
} else {
|
|
1749
|
+
if (isRespMsg) {
|
|
1750
|
+
if (VxeUI.modal) {
|
|
1751
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
if (sErrorMethod) {
|
|
1756
|
+
sErrorMethod({ ...commitParams, response: rest })
|
|
1757
|
+
}
|
|
1758
|
+
return { status: false }
|
|
1759
|
+
})
|
|
1760
|
+
}
|
|
1761
|
+
if (bSaveMethod) {
|
|
1762
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then((status) => {
|
|
1763
|
+
if (status !== false) {
|
|
1764
|
+
return handleSave()
|
|
1765
|
+
}
|
|
1766
|
+
})
|
|
1767
|
+
}
|
|
1768
|
+
return handleSave()
|
|
1769
|
+
} else {
|
|
1770
|
+
if (isActiveMsg) {
|
|
1771
|
+
if (VxeUI.modal) {
|
|
1772
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' })
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
})
|
|
1777
|
+
} else {
|
|
1778
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.save'])
|
|
1779
|
+
}
|
|
1780
|
+
break
|
|
1781
|
+
}
|
|
1782
|
+
default: {
|
|
1783
|
+
const gCommandOpts = commands.get(code)
|
|
1784
|
+
if (gCommandOpts) {
|
|
1785
|
+
const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
|
|
1786
|
+
if (tCommandMethod) {
|
|
1787
|
+
tCommandMethod({ code, button, $grid: $xeGrid, $table: $xeTable, $gantt: null }, ...args)
|
|
1788
|
+
} else {
|
|
1789
|
+
errLog('vxe.error.notCommands', [code])
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
return nextTick()
|
|
1795
|
+
},
|
|
1796
|
+
getParams() {
|
|
1797
|
+
return props.params
|
|
1798
|
+
},
|
|
1799
|
+
zoom() {
|
|
1800
|
+
if (reactData.isZMax) {
|
|
1801
|
+
return $xeGrid.revert()
|
|
1802
|
+
}
|
|
1803
|
+
return $xeGrid.maximize()
|
|
1804
|
+
},
|
|
1805
|
+
isMaximized() {
|
|
1806
|
+
return reactData.isZMax
|
|
1807
|
+
},
|
|
1808
|
+
maximize() {
|
|
1809
|
+
return handleZoom(true)
|
|
1810
|
+
},
|
|
1811
|
+
revert() {
|
|
1812
|
+
return handleZoom()
|
|
1813
|
+
},
|
|
1814
|
+
getFormData,
|
|
1815
|
+
/**
|
|
1816
|
+
* 已废弃,被 getFormFlatItems 替换
|
|
1817
|
+
* @deprecated
|
|
1818
|
+
*/
|
|
1819
|
+
getFormItems(itemIndex?: number): any {
|
|
1820
|
+
const formOpts = computeFormOpts.value
|
|
1821
|
+
const { formConfig } = props
|
|
1822
|
+
const { items } = formOpts
|
|
1823
|
+
const itemList: VxeFormItemProps[] = []
|
|
1824
|
+
XEUtils.eachTree(
|
|
1825
|
+
formConfig && isEnableConf(formOpts) && items ? items : [],
|
|
1826
|
+
(item) => {
|
|
1827
|
+
itemList.push(item)
|
|
1828
|
+
},
|
|
1829
|
+
{ children: 'children' }
|
|
1830
|
+
)
|
|
1831
|
+
// errLog('vxe.error.delFunc', ['getFormItems', 'getFormFlatItems'])
|
|
1832
|
+
return XEUtils.isUndefined(itemIndex) ? itemList : itemList[itemIndex]
|
|
1833
|
+
},
|
|
1834
|
+
getFormFlatItems() {
|
|
1835
|
+
const $form = refForm.value
|
|
1836
|
+
if ($form) {
|
|
1837
|
+
return $form.getFlatItems()
|
|
1838
|
+
}
|
|
1839
|
+
return []
|
|
1840
|
+
},
|
|
1841
|
+
getFormNestedItems() {
|
|
1842
|
+
const $form = refForm.value
|
|
1843
|
+
if ($form) {
|
|
1844
|
+
return $form.getNestedItems()
|
|
1845
|
+
}
|
|
1846
|
+
return []
|
|
1847
|
+
},
|
|
1848
|
+
getFormItemByField(field: string) {
|
|
1849
|
+
const $form = refForm.value
|
|
1850
|
+
if ($form) {
|
|
1851
|
+
return $form.getItemByField(field)
|
|
1852
|
+
}
|
|
1853
|
+
return null
|
|
1854
|
+
},
|
|
1855
|
+
resetForm() {
|
|
1856
|
+
const $form = refForm.value
|
|
1857
|
+
if ($form) {
|
|
1858
|
+
return $form.reset()
|
|
1859
|
+
}
|
|
1860
|
+
return nextTick()
|
|
1861
|
+
},
|
|
1862
|
+
validateForm() {
|
|
1863
|
+
const $form = refForm.value
|
|
1864
|
+
if ($form) {
|
|
1865
|
+
return $form.validate()
|
|
1866
|
+
}
|
|
1867
|
+
return Promise.resolve()
|
|
1868
|
+
},
|
|
1869
|
+
validateFormField(field) {
|
|
1870
|
+
const $form = refForm.value
|
|
1871
|
+
if ($form) {
|
|
1872
|
+
return $form.validateField(field)
|
|
1873
|
+
}
|
|
1874
|
+
return Promise.resolve()
|
|
1875
|
+
},
|
|
1876
|
+
clearFormValidate(field) {
|
|
1877
|
+
const $form = refForm.value
|
|
1878
|
+
if ($form) {
|
|
1879
|
+
return $form.clearValidate(field)
|
|
1880
|
+
}
|
|
1881
|
+
return nextTick()
|
|
1882
|
+
},
|
|
1883
|
+
homePage() {
|
|
1884
|
+
const { tablePage } = reactData
|
|
1885
|
+
tablePage.currentPage = 1
|
|
1886
|
+
return nextTick()
|
|
1887
|
+
},
|
|
1888
|
+
homePageByEvent(evnt) {
|
|
1889
|
+
const $pager = refPager.value
|
|
1890
|
+
if ($pager) {
|
|
1891
|
+
$pager.homePageByEvent(evnt)
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
endPage() {
|
|
1895
|
+
const { tablePage } = reactData
|
|
1896
|
+
const pageCount = computePageCount.value
|
|
1897
|
+
tablePage.currentPage = pageCount
|
|
1898
|
+
return nextTick()
|
|
1899
|
+
},
|
|
1900
|
+
endPageByEvent(evnt) {
|
|
1901
|
+
const $pager = refPager.value
|
|
1902
|
+
if ($pager) {
|
|
1903
|
+
$pager.endPageByEvent(evnt)
|
|
1904
|
+
}
|
|
1905
|
+
},
|
|
1906
|
+
getCurrentPage() {
|
|
1907
|
+
const { tablePage } = reactData
|
|
1908
|
+
return tablePage.currentPage
|
|
1909
|
+
},
|
|
1910
|
+
setCurrentPage(currentPage) {
|
|
1911
|
+
const { tablePage } = reactData
|
|
1912
|
+
const pageCount = computePageCount.value
|
|
1913
|
+
tablePage.currentPage = Math.min(pageCount, Math.max(1, XEUtils.toNumber(currentPage)))
|
|
1914
|
+
return nextTick()
|
|
1915
|
+
},
|
|
1916
|
+
setCurrentPageByEvent(evnt, currentPage) {
|
|
1917
|
+
const $pager = refPager.value
|
|
1918
|
+
if ($pager) {
|
|
1919
|
+
$pager.setCurrentPageByEvent(evnt, currentPage)
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
getPageSize() {
|
|
1923
|
+
const { tablePage } = reactData
|
|
1924
|
+
return tablePage.pageSize
|
|
1925
|
+
},
|
|
1926
|
+
setPageSize(pageSize) {
|
|
1927
|
+
const { tablePage } = reactData
|
|
1928
|
+
tablePage.pageSize = Math.max(1, XEUtils.toNumber(pageSize))
|
|
1929
|
+
return nextTick()
|
|
1930
|
+
},
|
|
1931
|
+
setPageSizeByEvent(evnt, pageSize) {
|
|
1932
|
+
const $pager = refPager.value
|
|
1933
|
+
if ($pager) {
|
|
1934
|
+
$pager.setPageSizeByEvent(evnt, pageSize)
|
|
1935
|
+
}
|
|
1936
|
+
},
|
|
1937
|
+
getProxyInfo() {
|
|
1938
|
+
const $xeTable = refTable.value
|
|
1939
|
+
if (props.proxyConfig) {
|
|
1940
|
+
const { sortData } = reactData
|
|
1941
|
+
return {
|
|
1942
|
+
data: $xeTable ? $xeTable.getFullData() : [],
|
|
1943
|
+
filter: reactData.filterData,
|
|
1944
|
+
form: getFormData(),
|
|
1945
|
+
sort: sortData.length ? sortData[0] : {},
|
|
1946
|
+
sorts: sortData,
|
|
1947
|
+
pager: reactData.tablePage,
|
|
1948
|
+
pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
return null
|
|
1952
|
+
},
|
|
1953
|
+
getCustomPagerData() {
|
|
1954
|
+
const { pagerConfig } = props
|
|
1955
|
+
const { tablePage } = reactData
|
|
1956
|
+
const pagerOpts = computePagerOpts.value
|
|
1957
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1958
|
+
return {
|
|
1959
|
+
pSize: tablePage.pageSize
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
return {}
|
|
1963
|
+
}
|
|
1964
|
+
// setProxyInfo (options) {
|
|
1965
|
+
// if (props.proxyConfig && options) {
|
|
1966
|
+
// const { pager, form } = options
|
|
1967
|
+
// const proxyOpts = computeProxyOpts.value
|
|
1968
|
+
// if (pager) {
|
|
1969
|
+
// if (pager.currentPage) {
|
|
1970
|
+
// reactData.tablePage.currentPage = Number(pager.currentPage)
|
|
1971
|
+
// }
|
|
1972
|
+
// if (pager.pageSize) {
|
|
1973
|
+
// reactData.tablePage.pageSize = Number(pager.pageSize)
|
|
1974
|
+
// }
|
|
1975
|
+
// }
|
|
1976
|
+
// if (proxyOpts.form && form) {
|
|
1977
|
+
// Object.assign(reactData.formData, form)
|
|
1978
|
+
// }
|
|
1979
|
+
// }
|
|
1980
|
+
// return nextTick()
|
|
1981
|
+
// }
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
const gridPrivateMethods: GridPrivateMethods = {
|
|
1985
|
+
extendTableMethods,
|
|
1986
|
+
callSlot(slotFunc, params) {
|
|
1987
|
+
if (slotFunc) {
|
|
1988
|
+
if (XEUtils.isString(slotFunc)) {
|
|
1989
|
+
slotFunc = slots[slotFunc] || null
|
|
1990
|
+
}
|
|
1991
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
1992
|
+
return getSlotVNs(slotFunc(params))
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return []
|
|
1996
|
+
},
|
|
1997
|
+
/**
|
|
1998
|
+
* 获取需要排除的高度
|
|
1999
|
+
*/
|
|
2000
|
+
getExcludeHeight() {
|
|
2001
|
+
const { height } = props
|
|
2002
|
+
const { isZMax } = reactData
|
|
2003
|
+
const el = refElem.value
|
|
2004
|
+
if (el) {
|
|
2005
|
+
const formWrapper = refFormWrapper.value
|
|
2006
|
+
const toolbarWrapper = refToolbarWrapper.value
|
|
2007
|
+
const topWrapper = refTopWrapper.value
|
|
2008
|
+
const bottomWrapper = refBottomWrapper.value
|
|
2009
|
+
const pagerWrapper = refPagerWrapper.value
|
|
2010
|
+
const parentEl = el.parentElement
|
|
2011
|
+
let parentPaddingSize = 0
|
|
2012
|
+
if (parentEl && (height === '100%' || height === 'auto')) {
|
|
2013
|
+
parentPaddingSize = isZMax ? 0 : getPaddingTopBottomSize(parentEl)
|
|
2014
|
+
}
|
|
2015
|
+
return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper)
|
|
2016
|
+
}
|
|
2017
|
+
return 0
|
|
2018
|
+
},
|
|
2019
|
+
getParentElem() {
|
|
2020
|
+
const el = refElem.value
|
|
2021
|
+
if (!el) {
|
|
2022
|
+
return null
|
|
2023
|
+
}
|
|
2024
|
+
let parentEl = el.parentElement
|
|
2025
|
+
// 如果是虚拟滚动条
|
|
2026
|
+
if (parentEl && hasClass(parentEl, 'vxe-scrollbar--view-inner')) {
|
|
2027
|
+
parentEl = parentEl.parentElement
|
|
2028
|
+
}
|
|
2029
|
+
return parentEl
|
|
2030
|
+
},
|
|
2031
|
+
getParentHeight() {
|
|
2032
|
+
const el = refElem.value
|
|
2033
|
+
if (el) {
|
|
2034
|
+
const parentEl = $xeGrid.getParentElem()
|
|
2035
|
+
return (reactData.isZMax ? getDomNode().visibleHeight : parentEl ? XEUtils.toNumber(getComputedStyle(parentEl).height) : 0) - gridPrivateMethods.getExcludeHeight()
|
|
2036
|
+
}
|
|
2037
|
+
return 0
|
|
2038
|
+
},
|
|
2039
|
+
triggerToolbarCommitEvent(params, evnt) {
|
|
2040
|
+
const { code } = params
|
|
2041
|
+
if (code) {
|
|
2042
|
+
const isUf = ['reload', 'delete', 'save'].includes(code)
|
|
2043
|
+
if (isUf) {
|
|
2044
|
+
internalData.uFoot = true
|
|
2045
|
+
}
|
|
2046
|
+
const rest = $xeGrid.commitProxy(params, evnt).then((rest) => {
|
|
2047
|
+
if (rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
2048
|
+
$xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
|
|
2049
|
+
}
|
|
2050
|
+
})
|
|
2051
|
+
internalData.uFoot = false
|
|
2052
|
+
if (isUf) {
|
|
2053
|
+
updateQueryFooter()
|
|
2054
|
+
}
|
|
2055
|
+
return rest
|
|
2056
|
+
}
|
|
2057
|
+
return nextTick()
|
|
2058
|
+
},
|
|
2059
|
+
triggerToolbarBtnEvent(button, evnt) {
|
|
2060
|
+
$xeGrid.triggerToolbarCommitEvent(button, evnt)
|
|
2061
|
+
$xeGrid.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
|
|
2062
|
+
},
|
|
2063
|
+
triggerToolbarTolEvent(tool, evnt) {
|
|
2064
|
+
$xeGrid.triggerToolbarCommitEvent(tool, evnt)
|
|
2065
|
+
$xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
|
|
2066
|
+
},
|
|
2067
|
+
triggerZoomEvent(evnt) {
|
|
2068
|
+
$xeGrid.zoom()
|
|
2069
|
+
$xeGrid.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
Object.assign($xeGrid, gridExtendTableMethods, gridMethods, gridPrivateMethods, {
|
|
2074
|
+
// 检查插槽
|
|
2075
|
+
loadColumn(columns: any[]) {
|
|
2076
|
+
const $xeTable = refTable.value
|
|
2077
|
+
XEUtils.eachTree(columns, (column) => {
|
|
2078
|
+
if (column.slots) {
|
|
2079
|
+
XEUtils.each(column.slots, (func) => {
|
|
2080
|
+
if (func && !XEUtils.isFunction(func)) {
|
|
2081
|
+
if (!slots[func]) {
|
|
2082
|
+
errLog('vxe.error.notSlot', [func])
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
})
|
|
2086
|
+
}
|
|
2087
|
+
})
|
|
2088
|
+
if ($xeTable) {
|
|
2089
|
+
return $xeTable.loadColumn(columns)
|
|
2090
|
+
}
|
|
2091
|
+
return nextTick()
|
|
2092
|
+
},
|
|
2093
|
+
reloadColumn(columns: any[]) {
|
|
2094
|
+
$xeGrid.clearAll()
|
|
2095
|
+
return $xeGrid.loadColumn(columns)
|
|
2096
|
+
}
|
|
2097
|
+
})
|
|
2098
|
+
|
|
2099
|
+
const renderVN = () => {
|
|
2100
|
+
const vSize = computeSize.value
|
|
2101
|
+
const styles = computeStyles.value
|
|
2102
|
+
const isLoading = computeIsLoading.value
|
|
2103
|
+
return h(
|
|
2104
|
+
'div',
|
|
2105
|
+
{
|
|
2106
|
+
ref: refElem,
|
|
2107
|
+
class: [
|
|
2108
|
+
'vxe-grid',
|
|
2109
|
+
{
|
|
2110
|
+
[`size--${vSize}`]: vSize,
|
|
2111
|
+
'is--animat': !!props.animat,
|
|
2112
|
+
'is--round': props.round,
|
|
2113
|
+
'is--maximize': reactData.isZMax,
|
|
2114
|
+
'is--loading': isLoading
|
|
2115
|
+
}
|
|
2116
|
+
],
|
|
2117
|
+
style: styles
|
|
2118
|
+
},
|
|
2119
|
+
renderLayout()
|
|
2120
|
+
)
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
const columnFlag = ref(0)
|
|
2124
|
+
watch(
|
|
2125
|
+
() => (props.columns ? props.columns.length : -1),
|
|
2126
|
+
() => {
|
|
2127
|
+
columnFlag.value++
|
|
2128
|
+
}
|
|
2129
|
+
)
|
|
2130
|
+
watch(
|
|
2131
|
+
() => props.columns,
|
|
2132
|
+
() => {
|
|
2133
|
+
columnFlag.value++
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
watch(columnFlag, () => {
|
|
2137
|
+
nextTick(() => $xeGrid.loadColumn(props.columns || []))
|
|
2138
|
+
})
|
|
2139
|
+
|
|
2140
|
+
watch(
|
|
2141
|
+
() => props.toolbarConfig,
|
|
2142
|
+
() => {
|
|
2143
|
+
initToolbar()
|
|
2144
|
+
}
|
|
2145
|
+
)
|
|
2146
|
+
|
|
2147
|
+
watch(computeCustomCurrentPageFlag, () => {
|
|
2148
|
+
initPages('currentPage')
|
|
2149
|
+
})
|
|
2150
|
+
|
|
2151
|
+
watch(computeCustomPageSizeFlag, () => {
|
|
2152
|
+
initPages('pageSize')
|
|
2153
|
+
})
|
|
2154
|
+
|
|
2155
|
+
watch(computeCustomTotalFlag, () => {
|
|
2156
|
+
initPages('total')
|
|
2157
|
+
})
|
|
2158
|
+
|
|
2159
|
+
watch(
|
|
2160
|
+
() => props.proxyConfig,
|
|
2161
|
+
() => {
|
|
2162
|
+
initProxy()
|
|
2163
|
+
}
|
|
2164
|
+
)
|
|
2165
|
+
|
|
2166
|
+
hooks.forEach((options) => {
|
|
2167
|
+
const { setupGrid } = options
|
|
2168
|
+
if (setupGrid) {
|
|
2169
|
+
const hookRest = setupGrid($xeGrid)
|
|
2170
|
+
if (hookRest && XEUtils.isObject(hookRest)) {
|
|
2171
|
+
Object.assign($xeGrid, hookRest)
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
})
|
|
2175
|
+
|
|
2176
|
+
initPages()
|
|
2177
|
+
|
|
2178
|
+
onMounted(() => {
|
|
2179
|
+
nextTick(() => {
|
|
2180
|
+
const { columns } = props
|
|
2181
|
+
const proxyOpts = computeProxyOpts.value
|
|
2182
|
+
|
|
2183
|
+
if (props.formConfig) {
|
|
2184
|
+
if (!VxeUIFormComponent) {
|
|
2185
|
+
errLog('vxe.error.reqComp', ['vxe-form'])
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
if (props.pagerConfig) {
|
|
2189
|
+
if (!VxeUIPagerComponent) {
|
|
2190
|
+
errLog('vxe.error.reqComp', ['vxe-pager'])
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
// const { data, columns, proxyConfig } = props
|
|
2195
|
+
// const formOpts = computeFormOpts.value
|
|
2196
|
+
// if (isEnableConf(proxyConfig) && (data || (proxyOpts.form && formOpts.data))) {
|
|
2197
|
+
// errLog('vxe.error.errConflicts', ['[grid] data', 'proxy-config'])
|
|
2198
|
+
// }
|
|
2199
|
+
|
|
2200
|
+
if (proxyOpts.props) {
|
|
2201
|
+
warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
if (columns && columns.length) {
|
|
2205
|
+
$xeGrid.loadColumn(columns)
|
|
2206
|
+
}
|
|
2207
|
+
initToolbar()
|
|
2208
|
+
initProxy()
|
|
2209
|
+
})
|
|
2210
|
+
globalEvents.on($xeGrid, 'keydown', handleGlobalKeydownEvent)
|
|
2211
|
+
})
|
|
2212
|
+
|
|
2213
|
+
onBeforeUnmount(() => {
|
|
2214
|
+
globalEvents.off($xeGrid, 'keydown')
|
|
2215
|
+
XEUtils.assign(reactData, createReactData())
|
|
2216
|
+
XEUtils.assign(internalData, createInternalData())
|
|
2217
|
+
})
|
|
2218
|
+
|
|
2219
|
+
$xeGrid.renderVN = renderVN
|
|
2220
|
+
|
|
2221
|
+
provide('$xeGrid', $xeGrid)
|
|
2222
|
+
provide('$xeGantt', null)
|
|
2223
|
+
|
|
2224
|
+
return $xeGrid
|
|
2225
|
+
},
|
|
2226
|
+
render() {
|
|
2227
|
+
return this.renderVN()
|
|
2228
|
+
}
|
|
2229
|
+
})
|