vxe-table 3.12.8 → 3.12.10-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/es/grid/src/grid.js +6 -1
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/export/mixin.js +3 -3
  7. package/es/table/module/filter/mixin.js +3 -3
  8. package/es/table/module/keyboard/mixin.js +4 -4
  9. package/es/table/module/menu/mixin.js +2 -2
  10. package/es/table/module/validator/mixin.js +2 -2
  11. package/es/table/src/body.js +262 -363
  12. package/es/table/src/footer.js +135 -154
  13. package/es/table/src/header.js +120 -100
  14. package/es/table/src/methods.js +1175 -816
  15. package/es/table/src/props.js +9 -3
  16. package/es/table/src/table.js +187 -103
  17. package/es/table/src/util.js +35 -21
  18. package/es/table/style.css +146 -63
  19. package/es/table/style.min.css +1 -1
  20. package/es/ui/index.js +14 -4
  21. package/es/ui/src/log.js +1 -1
  22. package/es/vxe-table/style.css +146 -63
  23. package/es/vxe-table/style.min.css +1 -1
  24. package/lib/grid/src/grid.js +4 -1
  25. package/lib/grid/src/grid.min.js +1 -1
  26. package/lib/index.css +1 -1
  27. package/lib/index.min.css +1 -1
  28. package/lib/index.umd.js +1920 -1599
  29. package/lib/index.umd.min.js +1 -1
  30. package/lib/style.css +1 -1
  31. package/lib/style.min.css +1 -1
  32. package/lib/table/module/export/mixin.js +3 -3
  33. package/lib/table/module/export/mixin.min.js +1 -1
  34. package/lib/table/module/filter/mixin.js +4 -4
  35. package/lib/table/module/filter/mixin.min.js +1 -1
  36. package/lib/table/module/keyboard/mixin.js +5 -5
  37. package/lib/table/module/keyboard/mixin.min.js +1 -1
  38. package/lib/table/module/menu/mixin.js +2 -2
  39. package/lib/table/module/menu/mixin.min.js +1 -1
  40. package/lib/table/module/validator/mixin.js +2 -2
  41. package/lib/table/module/validator/mixin.min.js +1 -1
  42. package/lib/table/src/body.js +205 -381
  43. package/lib/table/src/body.min.js +1 -1
  44. package/lib/table/src/footer.js +124 -151
  45. package/lib/table/src/footer.min.js +1 -1
  46. package/lib/table/src/header.js +97 -74
  47. package/lib/table/src/header.min.js +1 -1
  48. package/lib/table/src/methods.js +1261 -875
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/props.js +9 -3
  51. package/lib/table/src/props.min.js +1 -1
  52. package/lib/table/src/table.js +171 -90
  53. package/lib/table/src/table.min.js +1 -1
  54. package/lib/table/src/util.js +38 -22
  55. package/lib/table/src/util.min.js +1 -1
  56. package/lib/table/style/style.css +146 -63
  57. package/lib/table/style/style.min.css +1 -1
  58. package/lib/ui/index.js +14 -4
  59. package/lib/ui/index.min.js +1 -1
  60. package/lib/ui/src/log.js +1 -1
  61. package/lib/ui/src/log.min.js +1 -1
  62. package/lib/vxe-table/style/style.css +146 -63
  63. package/lib/vxe-table/style/style.min.css +1 -1
  64. package/package.json +2 -2
  65. package/packages/grid/src/grid.ts +6 -1
  66. package/packages/table/module/export/mixin.ts +3 -3
  67. package/packages/table/module/filter/mixin.ts +3 -3
  68. package/packages/table/module/keyboard/mixin.ts +4 -4
  69. package/packages/table/module/menu/mixin.ts +2 -2
  70. package/packages/table/module/validator/mixin.ts +2 -2
  71. package/packages/table/src/body.ts +296 -436
  72. package/packages/table/src/footer.ts +148 -164
  73. package/packages/table/src/header.ts +135 -111
  74. package/packages/table/src/methods.ts +1249 -873
  75. package/packages/table/src/props.ts +9 -3
  76. package/packages/table/src/table.ts +195 -146
  77. package/packages/table/src/util.ts +40 -23
  78. package/packages/ui/index.ts +13 -3
  79. package/styles/components/table.scss +164 -74
  80. /package/es/{iconfont.1736406699090.ttf → iconfont.1736688976404.ttf} +0 -0
  81. /package/es/{iconfont.1736406699090.woff → iconfont.1736688976404.woff} +0 -0
  82. /package/es/{iconfont.1736406699090.woff2 → iconfont.1736688976404.woff2} +0 -0
  83. /package/lib/{iconfont.1736406699090.ttf → iconfont.1736688976404.ttf} +0 -0
  84. /package/lib/{iconfont.1736406699090.woff → iconfont.1736688976404.woff} +0 -0
  85. /package/lib/{iconfont.1736406699090.woff2 → iconfont.1736688976404.woff2} +0 -0
@@ -3,6 +3,8 @@ import { ColumnInfo } from './columnInfo'
3
3
  import { isScale, isPx } from '../../ui/src/dom'
4
4
  import { warnLog, errLog } from '../../ui/src/log'
5
5
 
6
+ import type { VxeTableDefines, VxeTableConstructor, TableReactData } from '../../../types'
7
+
6
8
  const getAllConvertColumns = (columns: any, parentColumn?: any) => {
7
9
  const result: any[] = []
8
10
  columns.forEach((column: any) => {
@@ -66,12 +68,6 @@ export const convertHeaderColumnToRows = (originColumns: any) => {
66
68
  return rows
67
69
  }
68
70
 
69
- const lineOffsetSizes: any = {
70
- mini: 3,
71
- small: 2,
72
- medium: 1
73
- }
74
-
75
71
  export function restoreScrollLocation ($xeTable: any, scrollLeft: any, scrollTop: any) {
76
72
  const internalData = $xeTable
77
73
 
@@ -81,10 +77,13 @@ export function restoreScrollLocation ($xeTable: any, scrollLeft: any, scrollTop
81
77
  internalData.lastScrollLeft = 0
82
78
  internalData.lastScrollTop = 0
83
79
 
80
+ internalData.intoRunScroll = false
84
81
  internalData.inVirtualScroll = false
82
+ internalData.inWheelScroll = false
83
+ internalData.inHeaderScroll = false
85
84
  internalData.inBodyScroll = false
86
85
  internalData.inFooterScroll = false
87
- internalData.bodyScrollType = ''
86
+ internalData.scrollRenderType = ''
88
87
  // 还原滚动状态
89
88
  return $xeTable.scrollTo(scrollLeft, scrollTop)
90
89
  }
@@ -233,8 +232,8 @@ export function getColReMinWidth (params: any) {
233
232
  }
234
233
  // 如果设置最小宽
235
234
  if (colMinWidth) {
236
- const { tableBody } = $table.$refs
237
- const bodyElem = tableBody ? tableBody.$el : null
235
+ const { refTableBody } = $table.$refs
236
+ const bodyElem = refTableBody ? refTableBody.$el : null
238
237
  if (bodyElem) {
239
238
  if (isScale(colMinWidth)) {
240
239
  const bodyWidth = bodyElem.clientWidth - 1
@@ -248,15 +247,22 @@ export function getColReMinWidth (params: any) {
248
247
  return mWidth
249
248
  }
250
249
 
251
- function countTreeExpand (prevRow: any, params: any) {
250
+ const lineOffsetSizes: Record<string, any> = {
251
+ mini: 3,
252
+ small: 2,
253
+ medium: 1
254
+ }
255
+
256
+ function countTreeExpand (prevRow: any, params: VxeTableDefines.CellRenderBodyParams) {
252
257
  let count = 1
253
258
  if (!prevRow) {
254
259
  return count
255
260
  }
256
261
  const { $table } = params
257
- const { treeOpts } = $table
262
+ const treeOpts = $table.computeTreeOpts
263
+ const { transform, mapChildrenField } = treeOpts
258
264
  const childrenField = treeOpts.children || treeOpts.childrenField
259
- const rowChildren = prevRow[childrenField]
265
+ const rowChildren = prevRow[transform ? mapChildrenField : childrenField]
260
266
  if (rowChildren && $table.isTreeExpandByRow(prevRow)) {
261
267
  for (let index = 0; index < rowChildren.length; index++) {
262
268
  count += countTreeExpand(rowChildren[index], params)
@@ -265,18 +271,22 @@ function countTreeExpand (prevRow: any, params: any) {
265
271
  return count
266
272
  }
267
273
 
268
- export function getOffsetSize ($xetable: any) {
269
- const vSize = $xetable.computeSize
270
- return lineOffsetSizes[vSize] || 0
274
+ export function getOffsetSize ($xeTable: VxeTableConstructor) {
275
+ const vSize = $xeTable.computeSize
276
+ if (vSize) {
277
+ return lineOffsetSizes[vSize] || 0
278
+ }
279
+ return 0
271
280
  }
272
281
 
273
- export function calcTreeLine (params: any, items: any, rIndex: any) {
282
+ export function calcTreeLine (params: VxeTableDefines.CellRenderBodyParams, prevRow: any) {
274
283
  const { $table } = params
284
+ const tableReactData = $table as unknown as TableReactData
275
285
  let expandSize = 1
276
- if (rIndex) {
277
- expandSize = countTreeExpand(items[rIndex - 1], params)
286
+ if (prevRow) {
287
+ expandSize = countTreeExpand(prevRow, params)
278
288
  }
279
- return $table.rowHeight * expandSize - (rIndex ? 1 : (12 - getOffsetSize($table)))
289
+ return tableReactData.rowHeight * expandSize - (prevRow ? 1 : (12 - getOffsetSize($table)))
280
290
  }
281
291
 
282
292
  export function mergeBodyMethod (mergeList: any, _rowIndex: any, _columnIndex: any) {
@@ -301,6 +311,13 @@ export function setCellValue (row: any, column:any, value: any) {
301
311
  return XEUtils.set(row, column.field, value)
302
312
  }
303
313
 
314
+ export function getRefElem (refEl: any) {
315
+ if (refEl) {
316
+ return (refEl.$el || refEl) as HTMLElement
317
+ }
318
+ return null
319
+ }
320
+
304
321
  export function clearTableDefaultStatus (_vm: any) {
305
322
  _vm.initStatus = false
306
323
  _vm.clearSort()
@@ -346,12 +363,12 @@ export function rowToVisible ($xeTable: any, row: any) {
346
363
  const internalData = $xeTable
347
364
  const tableProps = $xeTable
348
365
  const { showOverflow } = tableProps
349
- const tableBody: any = $xeTable.$refs.tableBody
366
+ const refTableBody: any = $xeTable.$refs.refTableBody
350
367
  const { columnStore, scrollYLoad } = reactData
351
368
  const { afterFullData, scrollYStore, fullAllDataRowIdData } = internalData
352
369
  const { rowHeight } = scrollYStore
353
370
  const { leftList, rightList } = columnStore
354
- const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
371
+ const bodyElem = refTableBody ? refTableBody.$el as HTMLDivElement : null
355
372
  const rowid = getRowid($xeTable, row)
356
373
  let offsetFixedLeft = 0
357
374
  leftList.forEach((item: any) => {
@@ -405,9 +422,9 @@ export function rowToVisible ($xeTable: any, row: any) {
405
422
 
406
423
  export function colToVisible ($xeTable: any, column: any, row?: any) {
407
424
  const { columnStore, scrollXLoad, visibleColumn } = $xeTable
408
- const tableBody: any = $xeTable.$refs.tableBody
425
+ const refTableBody: any = $xeTable.$refs.refTableBody
409
426
  const { leftList, rightList } = columnStore
410
- const bodyElem = tableBody ? tableBody.$el : null
427
+ const bodyElem = refTableBody ? refTableBody.$el : null
411
428
  if (column.fixed) {
412
429
  return Promise.resolve()
413
430
  }
@@ -162,7 +162,13 @@ VxeUI.setConfig({
162
162
  areaConfig: {
163
163
  autoClear: true,
164
164
  selectCellByHeader: true,
165
- selectCellByBody: true
165
+ selectCellByBody: true,
166
+ extendDirection: {
167
+ top: true,
168
+ left: true,
169
+ bottom: true,
170
+ right: true
171
+ }
166
172
  },
167
173
  clipConfig: {
168
174
  isCopy: true,
@@ -173,15 +179,19 @@ VxeUI.setConfig({
173
179
  isFind: true,
174
180
  isReplace: true
175
181
  },
176
- scrollX: {
182
+ virtualXConfig: {
177
183
  // enabled: false,
178
184
  gt: 60
179
185
  // oSize: 0
180
186
  },
181
- scrollY: {
187
+ virtualYConfig: {
182
188
  // enabled: false,
183
189
  gt: 100
184
190
  // oSize: 0
191
+ },
192
+ scrollbarConfig: {
193
+ width: 10,
194
+ height: 10
185
195
  }
186
196
  },
187
197
  // export: {
@@ -32,17 +32,38 @@
32
32
  border: 0;
33
33
  }
34
34
  .vxe-table--render-wrapper {
35
+ display: flex;
36
+ flex-direction: row;
35
37
  background-color: var(--vxe-ui-layout-background-color);
36
38
  }
37
- .vxe-table--body-wrapper {
38
- scroll-behavior: auto;
39
+ .vxe-table--viewport-wrapper {
40
+ position: relative;
41
+ overflow: hidden;
42
+ flex-grow: 1;
39
43
  }
44
+ .vxe-table--header-wrapper,
40
45
  .vxe-table--body-wrapper,
46
+ .vxe-table--footer-wrapper,
41
47
  .vxe-table--fixed-left-body-wrapper,
42
48
  .vxe-table--fixed-right-body-wrapper {
43
- overflow-y: auto;
44
- overflow-x: auto;
49
+ overflow: hidden;
45
50
  outline: 0;
51
+ scrollbar-width: none;
52
+ }
53
+ .vxe-table--header-inner-wrapper,
54
+ .vxe-table--footer-inner-wrapper {
55
+ width: 100%;
56
+ height: 100% ;
57
+ overflow-y: hidden;
58
+ overflow-x: scroll;
59
+ scrollbar-width: none;
60
+ }
61
+ .vxe-table--body-inner-wrapper {
62
+ width: 100% ;
63
+ height: 100% ;
64
+ overflow-y: scroll;
65
+ overflow-x: scroll;
66
+ scrollbar-width: none;
46
67
  }
47
68
 
48
69
  .vxe-loading--custom-wrapper {
@@ -435,6 +456,142 @@
435
456
  }
436
457
  }
437
458
 
459
+ /*scroll*/
460
+ .vxe-table {
461
+ &.is--scroll-x {
462
+ &:hover {
463
+ & > .vxe-table--scroll-x-virtual {
464
+ .vxe-table--scroll-x-handle {
465
+ overflow-x: scroll;
466
+ }
467
+ }
468
+ }
469
+ }
470
+ &.is--scroll-y {
471
+ &:hover {
472
+ & > .vxe-table--render-wrapper {
473
+ & > .vxe-table--scroll-y-virtual {
474
+ .vxe-table--scroll-y-handle {
475
+ overflow-y: scroll;
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ &.is--loading {
482
+ & > .vxe-table--scroll-x-virtual {
483
+ visibility: hidden;
484
+ }
485
+ & > .vxe-table--render-wrapper {
486
+ & > .vxe-table--scroll-y-virtual {
487
+ visibility: hidden;
488
+ }
489
+ }
490
+ }
491
+ .vxe-table--scroll-x-virtual {
492
+ height: 0;
493
+ &::before {
494
+ content: "";
495
+ position: absolute;
496
+ left: 0;
497
+ top: -1px;
498
+ width: 100%;
499
+ height: 0;
500
+ z-index: 1;
501
+ border-top: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
502
+ }
503
+ }
504
+ .vxe-table--scroll-y-virtual {
505
+ width: 0;
506
+ &::before {
507
+ content: "";
508
+ position: absolute;
509
+ left:-1px;;
510
+ top: 0;
511
+ width: 0;
512
+ height: 100%;
513
+ z-index: 1;
514
+ border-left: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
515
+ }
516
+ }
517
+ .vxe-table--scroll-x-virtual,
518
+ .vxe-table--scroll-y-virtual {
519
+ visibility: hidden;
520
+ position: relative;
521
+ flex-shrink: 0;
522
+ z-index: 7;
523
+ }
524
+ .vxe-table--scroll-x-handle,
525
+ .vxe-table--scroll-y-handle,
526
+ .vxe-table--scroll-y-top-corner,
527
+ .vxe-table--scroll-y-bottom-corner,
528
+ .vxe-table--scroll-x-left-corner,
529
+ .vxe-table--scroll-x-right-corner {
530
+ position: absolute;
531
+ }
532
+ .vxe-table--scroll-x-virtual,
533
+ .vxe-table--scroll-x-handle {
534
+ width: 100%;
535
+ left: 0;
536
+ bottom: 0;
537
+ }
538
+ .vxe-table--scroll-x-handle {
539
+ overflow-y: hidden;
540
+ overflow-x: auto;
541
+ height: 18px;
542
+ }
543
+ .vxe-table--scroll-y-virtual,
544
+ .vxe-table--scroll-y-handle {
545
+ height: 100%;
546
+ right: 0;
547
+ top: 0;
548
+ }
549
+ .vxe-table--scroll-y-handle {
550
+ overflow-y: auto;
551
+ overflow-x: hidden;
552
+ width: 18px;
553
+ }
554
+ .vxe-table--scroll-x-space {
555
+ height: 1px;
556
+ }
557
+ .vxe-table--scroll-y-space {
558
+ width: 1px;
559
+ }
560
+ .vxe-table--scroll-x-left-corner,
561
+ .vxe-table--scroll-x-right-corner,
562
+ .vxe-table--scroll-y-top-corner,
563
+ .vxe-table--scroll-y-bottom-corner {
564
+ display: none;
565
+ position: absolute;
566
+ border-width: 0;
567
+ border-style: solid;
568
+ border-color: var(--vxe-ui-table-border-color);
569
+ }
570
+ .vxe-table--scroll-x-right-corner {
571
+ bottom: 1px;
572
+ right: 1px;
573
+ width: 0;
574
+ height: 100%;
575
+ border-top-width: var(--vxe-ui-table-border-width);
576
+ border-left-width: var(--vxe-ui-table-border-width);
577
+ }
578
+ .vxe-table--scroll-y-top-corner,
579
+ .vxe-table--scroll-y-bottom-corner {
580
+ top: 0;
581
+ right: 0;
582
+ width: 100%;
583
+ height: 0;
584
+ }
585
+ .vxe-table--scroll-y-top-corner {
586
+ background-color: var(--vxe-ui-table-header-background-color);
587
+ border-bottom-width: var(--vxe-ui-table-border-width);
588
+ }
589
+ .vxe-table--scroll-y-bottom-corner {
590
+ margin-top: -1px;
591
+ border-top-width: var(--vxe-ui-table-border-width);
592
+ }
593
+ }
594
+
438
595
  /*header*/
439
596
  .vxe-table {
440
597
  .vxe-table--header-wrapper {
@@ -597,6 +754,7 @@
597
754
  background-color: var(--vxe-ui-layout-background-color);
598
755
  }
599
756
  .vxe-table--footer-wrapper {
757
+ margin-top: -1px;
600
758
  background-color: var(--vxe-ui-table-footer-background-color);
601
759
  }
602
760
  .vxe-table--header,
@@ -607,17 +765,10 @@
607
765
  border-collapse: separate;
608
766
  table-layout: fixed;
609
767
  }
610
- .vxe-table--header-wrapper,
611
- .vxe-table--footer-wrapper {
612
- overflow-x: hidden;
613
- overflow-y: hidden;
614
- outline: 0;
615
- }
616
768
  &:not(.is--empty) {
617
769
  &.is--footer {
618
770
  &.is--scroll-x {
619
771
  .vxe-table--body-wrapper {
620
- overflow-x: scroll;
621
772
  outline: 0;
622
773
  }
623
774
  }
@@ -896,23 +1047,6 @@
896
1047
  }
897
1048
  }
898
1049
  }
899
- &.border--default,
900
- &.border--full,
901
- &.border--outer,
902
- &.border--inner {
903
- .vxe-table--header-wrapper {
904
- .vxe-header--row {
905
- &:last-child {
906
- .vxe-header--gutter {
907
- background-image: linear-gradient(var(--vxe-ui-table-border-color), var(--vxe-ui-table-border-color));
908
- background-repeat: no-repeat;
909
- background-size: 100% var(--vxe-ui-table-border-width);
910
- background-position: right bottom;
911
- }
912
- }
913
- }
914
- }
915
- }
916
1050
  &.border--inner,
917
1051
  &.border--none {
918
1052
  .vxe-table--header-wrapper {
@@ -1014,48 +1148,6 @@
1014
1148
  }
1015
1149
  }
1016
1150
  }
1017
- // 滚动条
1018
- .vxe-table--scroll-x-virtual,
1019
- .vxe-table--scroll-y-virtual {
1020
- position: absolute;
1021
- z-index: 7;
1022
- overflow: hidden;
1023
- }
1024
- .vxe-table--scroll-x-handle,
1025
- .vxe-table--scroll-y-handle {
1026
- position: absolute;
1027
- div {
1028
- display: block;
1029
- }
1030
- }
1031
- .vxe-table--scroll-x-virtual,
1032
- .vxe-table--scroll-x-handle {
1033
- width: 100%;
1034
- left: 0;
1035
- bottom: 0;
1036
- }
1037
- .vxe-table--scroll-x-handle {
1038
- overflow-y: hidden;
1039
- overflow-x: auto;
1040
- height: 18px;
1041
- }
1042
- .vxe-table--scroll-y-virtual,
1043
- .vxe-table--scroll-y-handle {
1044
- height: 100%;
1045
- right: 0;
1046
- top: 0;
1047
- }
1048
- .vxe-table--scroll-y-handle {
1049
- overflow-y: auto;
1050
- overflow-x: hidden;
1051
- width: 18px;
1052
- }
1053
- .vxe-table--scroll-x-space {
1054
- height: 1px;
1055
- }
1056
- .vxe-table--scroll-y-space {
1057
- width: 1px;
1058
- }
1059
1151
 
1060
1152
  &.is--padding {
1061
1153
  .vxe-body--column {
@@ -1105,7 +1197,6 @@
1105
1197
  outline: 0;
1106
1198
  background-color: var(--vxe-ui-layout-background-color);
1107
1199
  .vxe-table--body-wrapper {
1108
- overflow-x: hidden;
1109
1200
  outline: 0;
1110
1201
  }
1111
1202
  }
@@ -1141,6 +1232,7 @@
1141
1232
  .vxe-table--body-wrapper,
1142
1233
  .vxe-table--footer-wrapper {
1143
1234
  position: relative;
1235
+ width: 100%;
1144
1236
  &.fixed-left--wrapper,
1145
1237
  &.fixed-right--wrapper {
1146
1238
  position: absolute;
@@ -1152,7 +1244,6 @@
1152
1244
  }
1153
1245
  &.fixed-right--wrapper {
1154
1246
  right: 0;
1155
- overflow-y: auto;
1156
1247
  }
1157
1248
  }
1158
1249
  .vxe-body--x-space {
@@ -1189,6 +1280,7 @@
1189
1280
  padding: 0.25em 0.25em;
1190
1281
  font-size: 12px;
1191
1282
  border-radius: var(--vxe-ui-border-radius);
1283
+ white-space: nowrap;
1192
1284
  color: #ffffff;
1193
1285
  background-color: var(--vxe-ui-table-resizable-drag-line-color);
1194
1286
  }
@@ -1855,9 +1947,7 @@ div.vxe-table--tooltip-wrapper {
1855
1947
  /*footer*/
1856
1948
  .vxe-table--footer-wrapper {
1857
1949
  color: var(--vxe-ui-table-footer-font-color);
1858
- margin-top: -1px;
1859
1950
  &.body--wrapper{
1860
- overflow-x: auto;
1861
1951
  outline: 0;
1862
1952
  }
1863
1953
  }