vxe-table 3.9.21 → 3.10.0-beta.1

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 (91) hide show
  1. package/es/locale/lang/ja-JP.js +5 -5
  2. package/es/locale/lang/ko-KR.js +5 -5
  3. package/es/locale/lang/uk-UA.js +5 -5
  4. package/es/locale/lang/vi-VN.js +5 -5
  5. package/es/locale/lang/zh-CHT.js +5 -5
  6. package/es/locale/lang/zh-CN.js +5 -5
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/module/edit/mixin.js +3 -3
  10. package/es/table/src/body.js +53 -115
  11. package/es/table/src/footer.js +24 -21
  12. package/es/table/src/methods.js +392 -123
  13. package/es/table/src/props.js +2 -0
  14. package/es/table/src/table.js +71 -10
  15. package/es/table/src/util.js +58 -33
  16. package/es/table/style.css +47 -7
  17. package/es/table/style.min.css +1 -1
  18. package/es/ui/index.js +2 -2
  19. package/es/ui/src/log.js +1 -1
  20. package/es/vxe-table/style.css +47 -7
  21. package/es/vxe-table/style.min.css +1 -1
  22. package/lib/index.umd.js +682 -361
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/ja-JP.js +5 -5
  25. package/lib/locale/lang/ja-JP.min.js +1 -1
  26. package/lib/locale/lang/ja-JP.umd.js +5 -5
  27. package/lib/locale/lang/ko-KR.js +5 -5
  28. package/lib/locale/lang/ko-KR.min.js +1 -1
  29. package/lib/locale/lang/ko-KR.umd.js +5 -5
  30. package/lib/locale/lang/uk-UA.js +5 -5
  31. package/lib/locale/lang/uk-UA.min.js +1 -1
  32. package/lib/locale/lang/uk-UA.umd.js +5 -5
  33. package/lib/locale/lang/vi-VN.js +5 -5
  34. package/lib/locale/lang/vi-VN.min.js +1 -1
  35. package/lib/locale/lang/zh-CHT.js +5 -5
  36. package/lib/locale/lang/zh-CHT.min.js +1 -1
  37. package/lib/locale/lang/zh-CHT.umd.js +5 -5
  38. package/lib/locale/lang/zh-CN.js +5 -5
  39. package/lib/locale/lang/zh-CN.min.js +1 -1
  40. package/lib/locale/lang/zh-CN.umd.js +5 -5
  41. package/lib/style.css +1 -1
  42. package/lib/style.min.css +1 -1
  43. package/lib/table/module/edit/mixin.js +6 -3
  44. package/lib/table/module/edit/mixin.min.js +1 -1
  45. package/lib/table/src/body.js +54 -118
  46. package/lib/table/src/body.min.js +1 -1
  47. package/lib/table/src/footer.js +24 -33
  48. package/lib/table/src/footer.min.js +1 -1
  49. package/lib/table/src/methods.js +449 -148
  50. package/lib/table/src/methods.min.js +1 -1
  51. package/lib/table/src/props.js +2 -0
  52. package/lib/table/src/props.min.js +1 -1
  53. package/lib/table/src/table.js +64 -13
  54. package/lib/table/src/table.min.js +1 -1
  55. package/lib/table/src/util.js +72 -38
  56. package/lib/table/src/util.min.js +1 -1
  57. package/lib/table/style/style.css +47 -7
  58. package/lib/table/style/style.min.css +1 -1
  59. package/lib/ui/index.js +2 -2
  60. package/lib/ui/index.min.js +1 -1
  61. package/lib/ui/src/log.js +1 -1
  62. package/lib/ui/src/log.min.js +1 -1
  63. package/lib/vxe-table/style/style.css +47 -7
  64. package/lib/vxe-table/style/style.min.css +1 -1
  65. package/package.json +2 -2
  66. package/packages/locale/lang/ja-JP.ts +5 -5
  67. package/packages/locale/lang/ko-KR.ts +5 -5
  68. package/packages/locale/lang/uk-UA.ts +5 -5
  69. package/packages/locale/lang/vi-VN.ts +5 -5
  70. package/packages/locale/lang/zh-CHT.ts +5 -5
  71. package/packages/locale/lang/zh-CN.ts +5 -5
  72. package/packages/table/module/edit/mixin.ts +3 -3
  73. package/packages/table/src/body.ts +53 -118
  74. package/packages/table/src/footer.ts +24 -22
  75. package/packages/table/src/methods.ts +418 -127
  76. package/packages/table/src/props.ts +10 -8
  77. package/packages/table/src/table.ts +73 -10
  78. package/packages/table/src/util.ts +61 -36
  79. package/packages/ui/index.ts +1 -1
  80. package/styles/components/table-module/filter.scss +1 -1
  81. package/styles/components/table.scss +46 -13
  82. package/styles/modules.scss +0 -2
  83. package/styles/theme/base.scss +1 -1
  84. package/styles/theme/dark.scss +7 -4
  85. package/styles/variable.scss +5 -1
  86. /package/es/{iconfont.1729992873866.ttf → iconfont.1730364042434.ttf} +0 -0
  87. /package/es/{iconfont.1729992873866.woff → iconfont.1730364042434.woff} +0 -0
  88. /package/es/{iconfont.1729992873866.woff2 → iconfont.1730364042434.woff2} +0 -0
  89. /package/lib/{iconfont.1729992873866.ttf → iconfont.1730364042434.ttf} +0 -0
  90. /package/lib/{iconfont.1729992873866.woff → iconfont.1730364042434.woff} +0 -0
  91. /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730364042434.woff2} +0 -0
@@ -2,8 +2,8 @@ import { CreateElement } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { isEnableConf, getClass } from '../../ui/src/utils'
5
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, removeScrollListener, restoreScrollListener, getRowid } from './util'
6
- import { updateCellTitle } from '../../ui/src/dom'
5
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util'
6
+ import { updateCellTitle, setScrollTop, setScrollLeft } from '../../ui/src/dom'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
9
9
  const { getI18n, renderer } = VxeUI
@@ -57,13 +57,13 @@ function renderLine (h: CreateElement, _vm: any, $xetable: any, params: any) {
57
57
  function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fixedType: any, rowLevel: any, row: any, rowIndex: any, $rowIndex: any, _rowIndex: any, column: any, $columnIndex: any, columns: any, items: any) {
58
58
  const {
59
59
  $listeners: tableListeners,
60
+ fullAllDataRowIdData,
60
61
  afterFullData,
61
62
  tableData,
62
63
  height,
63
64
  columnKey,
64
65
  overflowX,
65
66
  sYOpts,
66
- scrollXLoad,
67
67
  scrollYLoad,
68
68
  highlightCurrentRow,
69
69
  showOverflow: allColumnOverflow,
@@ -90,7 +90,9 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
90
90
  columnOpts,
91
91
  validErrorMaps
92
92
  } = $xetable
93
+ const cellOpts = $xetable.computeCellOpts
93
94
  const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column
95
+ const { verticalAlign } = cellOpts
94
96
  const { actived } = editStore
95
97
  const { rHeight: scrollYRHeight } = sYOpts
96
98
  const { height: rowHeight } = rowOpts
@@ -104,12 +106,13 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
104
106
  const isEdit = isEnableConf(editRender)
105
107
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
106
108
  const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
107
- let showEllipsis = cellOverflow === 'ellipsis'
109
+ const showEllipsis = cellOverflow === 'ellipsis'
108
110
  const showTitle = cellOverflow === 'title'
109
111
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
110
- let hasEllipsis = showTitle || showTooltip || showEllipsis
112
+ const hasEllipsis = showTitle || showTooltip || showEllipsis
111
113
  let isDirty: any
112
114
  const tdOns: any = {}
115
+ const rest = fullAllDataRowIdData[rowid]
113
116
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign
114
117
  const errorValidItem = validErrorMaps[`${rowid}:${column.id}`]
115
118
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
@@ -118,10 +121,6 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
118
121
  const bindMouseleave = tableListeners['cell-mouseleave']
119
122
  const triggerDblclick = (editRender && editConfig && editOpts.trigger === 'dblclick')
120
123
  const params = { $table: $xetable, $grid: $xetable.$xegrid, isEdit: false, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items }
121
- // 虚拟滚动不支持动态高度
122
- if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
123
- showEllipsis = hasEllipsis = true
124
- }
125
124
  // hover 进入事件
126
125
  if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
127
126
  tdOns.mouseenter = (evnt: any) => {
@@ -275,6 +274,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
275
274
  column.id,
276
275
  {
277
276
  [`col--${cellAlign}`]: cellAlign,
277
+ [`col--vertical-${verticalAlign}`]: verticalAlign,
278
278
  [`col--${type}`]: type,
279
279
  'col--last': $columnIndex === columns.length - 1,
280
280
  'col--tree-node': treeNode,
@@ -294,7 +294,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
294
294
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
295
295
  attrs,
296
296
  style: Object.assign({
297
- height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
297
+ height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : (scrollYLoad ? `${rest.height || scrollYRHeight || rowHeight}px` : '')
298
298
  }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
299
299
  on: tdOns
300
300
  }, tdVNs)
@@ -447,46 +447,6 @@ function renderRows (h: CreateElement, _vm: any, $xetable: any, fixedType: any,
447
447
  return rows
448
448
  }
449
449
 
450
- /**
451
- * 同步滚动条
452
- */
453
- let scrollProcessTimeout: any
454
- function syncBodyScroll (_vm: any, fixedType: any, scrollTop: any, elem1: any, elem2: any) {
455
- if (elem1 || elem2) {
456
- if (elem1) {
457
- removeScrollListener(elem1)
458
- elem1.scrollTop = scrollTop
459
- }
460
- if (elem2) {
461
- removeScrollListener(elem2)
462
- elem2.scrollTop = scrollTop
463
- }
464
- clearTimeout(scrollProcessTimeout)
465
- scrollProcessTimeout = setTimeout(() => {
466
- // const { tableBody, leftBody, rightBody } = _vm.$refs
467
- // const bodyElem = tableBody.$el
468
- // const leftElem = leftBody ? leftBody.$el : null
469
- // const rightElem = rightBody ? rightBody.$el : null
470
- restoreScrollListener(elem1)
471
- restoreScrollListener(elem2)
472
- // 检查滚动条是的同步
473
- // let targetTop = bodyElem.scrollTop
474
- // if (fixedType === 'left') {
475
- // if (leftElem) {
476
- // targetTop = leftElem.scrollTop
477
- // }
478
- // } else if (fixedType === 'right') {
479
- // if (rightElem) {
480
- // targetTop = rightElem.scrollTop
481
- // }
482
- // }
483
- // setScrollTop(bodyElem, targetTop)
484
- // setScrollTop(leftElem, targetTop)
485
- // setScrollTop(rightElem, targetTop)
486
- }, 300)
487
- }
488
- }
489
-
490
450
  export default {
491
451
  name: 'VxeTableBody',
492
452
  props: {
@@ -515,17 +475,9 @@ export default {
515
475
  elemStore[`${prefix}xSpace`] = $refs.xSpace
516
476
  elemStore[`${prefix}ySpace`] = $refs.ySpace
517
477
  elemStore[`${prefix}emptyBlock`] = $refs.emptyBlock
518
- if (this.$el) {
519
- this.$el.onscroll = this.scrollEvent
520
- this.$el._onscroll = this.scrollEvent
521
- }
522
478
  },
523
479
  beforeDestroy (this: any) {
524
480
  clearTimeout(this.wheelTime)
525
- if (this.$el) {
526
- this.$el._onscroll = null
527
- this.$el.onscroll = null
528
- }
529
481
  },
530
482
  destroyed (this: any) {
531
483
  const { $parent: $xetable, fixedType } = this
@@ -580,11 +532,9 @@ export default {
580
532
  attrs: {
581
533
  xid: tId
582
534
  },
583
- on: scrollYLoad && sYOpts.mode === 'wheel'
584
- ? {
585
- wheel: this.wheelEvent
586
- }
587
- : {}
535
+ on: Object.assign({
536
+ scroll: this.scrollEvent
537
+ }, scrollYLoad && sYOpts.mode === 'wheel' ? { wheel: this.wheelEvent } : null)
588
538
  }, [
589
539
  fixedType
590
540
  ? _e()
@@ -679,72 +629,57 @@ export default {
679
629
  * 如果存在列固定左侧,同步更新滚动状态
680
630
  * 如果存在列固定右侧,同步更新滚动状态
681
631
  */
682
- scrollEvent (evnt: any) {
683
- const { $el: scrollBodyElem, $parent: $xetable, fixedType } = this
684
- const { $refs, elemStore, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft, rowOpts } = $xetable
685
- const { tableHeader, tableBody, leftBody, rightBody, tableFooter, validTip } = $refs
632
+ scrollEvent (evnt: Event) {
633
+ const { $el: scrollBodyElem, $parent: $xeTable, fixedType } = this
634
+ const { $refs, lastScrollTop, lastScrollLeft } = $xeTable
635
+ const { tableHeader, tableBody, leftBody, rightBody, tableFooter } = $refs
686
636
  const headerElem = tableHeader ? tableHeader.$el : null
687
637
  const footerElem = tableFooter ? tableFooter.$el : null
688
638
  const bodyElem = tableBody.$el
689
639
  const leftElem = leftBody ? leftBody.$el : null
690
640
  const rightElem = rightBody ? rightBody.$el : null
691
- const bodyYElem = elemStore['main-body-ySpace']
692
- const bodyXElem = elemStore['main-body-xSpace']
693
- const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight
694
- const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth
695
- let scrollTop = scrollBodyElem.scrollTop
641
+ const scrollTop = scrollBodyElem.scrollTop
696
642
  const scrollLeft = bodyElem.scrollLeft
697
643
  const isRollX = scrollLeft !== lastScrollLeft
698
644
  const isRollY = scrollTop !== lastScrollTop
699
- $xetable.lastScrollTop = scrollTop
700
- $xetable.lastScrollLeft = scrollLeft
701
- $xetable.lastScrollTime = Date.now()
702
- if (rowOpts.isHover || highlightHoverRow) {
703
- $xetable.clearHoverRow()
704
- }
705
- if (leftElem && fixedType === 'left') {
706
- scrollTop = leftElem.scrollTop
707
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, rightElem)
708
- } else if (rightElem && fixedType === 'right') {
709
- scrollTop = rightElem.scrollTop
710
- syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, leftElem)
711
- } else {
712
- if (isRollX) {
713
- if (headerElem) {
714
- headerElem.scrollLeft = bodyElem.scrollLeft
715
- }
716
- if (footerElem) {
717
- footerElem.scrollLeft = bodyElem.scrollLeft
718
- }
719
- }
720
- if (leftElem || rightElem) {
721
- $xetable.checkScrolling()
722
- if (isRollY) {
723
- syncBodyScroll($xetable, fixedType, scrollTop, leftElem, rightElem)
724
- }
645
+ const xHandleEl = $refs.refScrollXHandleElem
646
+ const yHandleEl = $refs.refScrollYHandleElem
647
+ if (yHandleEl) {
648
+ yHandleEl.scrollTop = scrollTop
649
+ } else if (isRollY) {
650
+ $xeTable.lastScrollTop = scrollTop
651
+ $xeTable.lastScrollLeft = scrollLeft
652
+ if (leftElem && fixedType === 'left') {
653
+ setScrollTop(bodyElem, scrollTop)
654
+ setScrollTop(rightElem, scrollTop)
655
+ } else if (rightElem && fixedType === 'right') {
656
+ setScrollTop(bodyElem, scrollTop)
657
+ setScrollTop(leftElem, scrollTop)
658
+ } else {
659
+ setScrollTop(leftElem, scrollTop)
660
+ setScrollTop(rightElem, scrollTop)
725
661
  }
662
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
663
+ type: renderType,
664
+ fixed: fixedType,
665
+ scrollTop,
666
+ scrollLeft
667
+ })
726
668
  }
727
- if (scrollXLoad && isRollX) {
728
- $xetable.triggerScrollXEvent(evnt)
729
- }
730
- if (scrollYLoad && isRollY) {
731
- $xetable.triggerScrollYEvent(evnt)
732
- }
733
- if (isRollX && validTip && validTip.visible) {
734
- validTip.updatePlacement()
669
+ if (xHandleEl) {
670
+ xHandleEl.scrollLeft = scrollLeft
671
+ } else if (isRollX) {
672
+ $xeTable.lastScrollTop = scrollTop
673
+ $xeTable.lastScrollLeft = scrollLeft
674
+ setScrollLeft(headerElem, scrollLeft)
675
+ setScrollLeft(footerElem, scrollLeft)
676
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
677
+ type: renderType,
678
+ fixed: fixedType,
679
+ scrollTop,
680
+ scrollLeft
681
+ })
735
682
  }
736
- $xetable.emitEvent('scroll', {
737
- type: renderType,
738
- fixed: fixedType,
739
- scrollTop,
740
- scrollLeft,
741
- scrollHeight: bodyElem.scrollHeight,
742
- scrollWidth: bodyElem.scrollWidth,
743
- bodyHeight,
744
- bodyWidth,
745
- isX: isRollX,
746
- isY: isRollY
747
- }, evnt)
748
683
  },
749
684
  handleWheel (evnt: any, isTopWheel: any, deltaTop: any, isRollX: any, isRollY: any) {
750
685
  const { $parent: $xetable } = this
@@ -2,9 +2,9 @@ import { CreateElement } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { getClass } from '../../ui/src/utils'
5
- import { updateCellTitle } from '../../ui/src/dom'
5
+ import { updateCellTitle, setScrollLeft } from '../../ui/src/dom'
6
6
 
7
- const cellType = 'footer'
7
+ const renderType = 'footer'
8
8
 
9
9
  const { renderer } = VxeUI
10
10
 
@@ -141,7 +141,7 @@ export default {
141
141
  ref: 'tfoot'
142
142
  }, footerTableData.map((list: any, _rowIndex: any) => {
143
143
  const $rowIndex = _rowIndex
144
- const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: cellType }
144
+ const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: renderType }
145
145
  return h('tr', {
146
146
  class: ['vxe-footer--row', footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
147
147
  style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
@@ -176,7 +176,7 @@ export default {
176
176
  itemIndex,
177
177
  items: list,
178
178
  fixed: fixedType,
179
- type: cellType,
179
+ type: renderType,
180
180
  data: footerTableData
181
181
  }
182
182
  // 虚拟滚动不支持动态高度
@@ -277,29 +277,31 @@ export default {
277
277
  * 如果存在列固定右侧,同步更新滚动状态
278
278
  */
279
279
  scrollEvent (evnt: any) {
280
- const { $parent: $xetable, fixedType } = this
281
- const { $refs, scrollXLoad, triggerScrollXEvent, lastScrollLeft } = $xetable
282
- const { tableHeader, tableBody, tableFooter, validTip } = $refs
280
+ const { $parent: $xeTable, fixedType } = this
281
+ const { $refs } = $xeTable
282
+ const { tableHeader, tableBody, tableFooter } = $refs
283
283
  const headerElem = tableHeader ? tableHeader.$el : null
284
284
  const footerElem = tableFooter ? tableFooter.$el : null
285
285
  const bodyElem = tableBody.$el
286
286
  const scrollLeft = footerElem ? footerElem.scrollLeft : 0
287
- const isX = scrollLeft !== lastScrollLeft
288
- $xetable.lastScrollLeft = scrollLeft
289
- $xetable.lastScrollTime = Date.now()
290
- if (headerElem) {
291
- headerElem.scrollLeft = scrollLeft
292
- }
293
- if (bodyElem) {
294
- bodyElem.scrollLeft = scrollLeft
295
- }
296
- if (scrollXLoad && isX) {
297
- triggerScrollXEvent(evnt)
298
- }
299
- if (isX && validTip && validTip.visible) {
300
- validTip.updatePlacement()
287
+ const xHandleEl = $refs.refScrollXHandleElem
288
+ if (xHandleEl) {
289
+ xHandleEl.scrollLeft = scrollLeft
290
+ } else {
291
+ const isRollX = true
292
+ const isRollY = false
293
+ const scrollTop = bodyElem.scrollTop
294
+ $xeTable.lastScrollLeft = scrollLeft
295
+ $xeTable.lastScrollTime = Date.now()
296
+ setScrollLeft(headerElem, scrollLeft)
297
+ setScrollLeft(bodyElem, scrollLeft)
298
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
299
+ type: renderType,
300
+ fixed: fixedType,
301
+ scrollTop,
302
+ scrollLeft
303
+ })
301
304
  }
302
- $xetable.emitEvent('scroll', { type: cellType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft, isX, isY: false }, evnt)
303
305
  }
304
306
  } as any
305
307
  } as any