vxe-table 3.9.21 → 3.10.0-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 (88) 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 +50 -115
  11. package/es/table/src/footer.js +24 -21
  12. package/es/table/src/methods.js +392 -123
  13. package/es/table/src/table.js +68 -10
  14. package/es/table/src/util.js +58 -33
  15. package/es/table/style.css +46 -3
  16. package/es/table/style.min.css +1 -1
  17. package/es/ui/index.js +2 -2
  18. package/es/ui/src/log.js +1 -1
  19. package/es/vxe-table/style.css +46 -3
  20. package/es/vxe-table/style.min.css +1 -1
  21. package/lib/index.umd.js +672 -361
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/locale/lang/ja-JP.js +5 -5
  24. package/lib/locale/lang/ja-JP.min.js +1 -1
  25. package/lib/locale/lang/ja-JP.umd.js +5 -5
  26. package/lib/locale/lang/ko-KR.js +5 -5
  27. package/lib/locale/lang/ko-KR.min.js +1 -1
  28. package/lib/locale/lang/ko-KR.umd.js +5 -5
  29. package/lib/locale/lang/uk-UA.js +5 -5
  30. package/lib/locale/lang/uk-UA.min.js +1 -1
  31. package/lib/locale/lang/uk-UA.umd.js +5 -5
  32. package/lib/locale/lang/vi-VN.js +5 -5
  33. package/lib/locale/lang/vi-VN.min.js +1 -1
  34. package/lib/locale/lang/zh-CHT.js +5 -5
  35. package/lib/locale/lang/zh-CHT.min.js +1 -1
  36. package/lib/locale/lang/zh-CHT.umd.js +5 -5
  37. package/lib/locale/lang/zh-CN.js +5 -5
  38. package/lib/locale/lang/zh-CN.min.js +1 -1
  39. package/lib/locale/lang/zh-CN.umd.js +5 -5
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/table/module/edit/mixin.js +6 -3
  43. package/lib/table/module/edit/mixin.min.js +1 -1
  44. package/lib/table/src/body.js +49 -118
  45. package/lib/table/src/body.min.js +1 -1
  46. package/lib/table/src/footer.js +24 -33
  47. package/lib/table/src/footer.min.js +1 -1
  48. package/lib/table/src/methods.js +449 -148
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/table.js +61 -13
  51. package/lib/table/src/table.min.js +1 -1
  52. package/lib/table/src/util.js +72 -38
  53. package/lib/table/src/util.min.js +1 -1
  54. package/lib/table/style/style.css +46 -3
  55. package/lib/table/style/style.min.css +1 -1
  56. package/lib/ui/index.js +2 -2
  57. package/lib/ui/index.min.js +1 -1
  58. package/lib/ui/src/log.js +1 -1
  59. package/lib/ui/src/log.min.js +1 -1
  60. package/lib/vxe-table/style/style.css +46 -3
  61. package/lib/vxe-table/style/style.min.css +1 -1
  62. package/package.json +2 -2
  63. package/packages/locale/lang/ja-JP.ts +5 -5
  64. package/packages/locale/lang/ko-KR.ts +5 -5
  65. package/packages/locale/lang/uk-UA.ts +5 -5
  66. package/packages/locale/lang/vi-VN.ts +5 -5
  67. package/packages/locale/lang/zh-CHT.ts +5 -5
  68. package/packages/locale/lang/zh-CN.ts +5 -5
  69. package/packages/table/module/edit/mixin.ts +3 -3
  70. package/packages/table/src/body.ts +50 -118
  71. package/packages/table/src/footer.ts +24 -22
  72. package/packages/table/src/methods.ts +418 -127
  73. package/packages/table/src/props.ts +8 -8
  74. package/packages/table/src/table.ts +70 -10
  75. package/packages/table/src/util.ts +61 -36
  76. package/packages/ui/index.ts +1 -1
  77. package/styles/components/table-module/filter.scss +1 -1
  78. package/styles/components/table.scss +45 -6
  79. package/styles/modules.scss +0 -2
  80. package/styles/theme/base.scss +1 -1
  81. package/styles/theme/dark.scss +7 -4
  82. package/styles/variable.scss +5 -1
  83. /package/es/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  84. /package/es/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  85. /package/es/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
  86. /package/lib/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
  87. /package/lib/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
  88. /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730347297462.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,
@@ -104,12 +104,13 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
104
104
  const isEdit = isEnableConf(editRender)
105
105
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
106
106
  const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow
107
- let showEllipsis = cellOverflow === 'ellipsis'
107
+ const showEllipsis = cellOverflow === 'ellipsis'
108
108
  const showTitle = cellOverflow === 'title'
109
109
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
110
- let hasEllipsis = showTitle || showTooltip || showEllipsis
110
+ const hasEllipsis = showTitle || showTooltip || showEllipsis
111
111
  let isDirty: any
112
112
  const tdOns: any = {}
113
+ const rest = fullAllDataRowIdData[rowid]
113
114
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign
114
115
  const errorValidItem = validErrorMaps[`${rowid}:${column.id}`]
115
116
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
@@ -118,10 +119,6 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
118
119
  const bindMouseleave = tableListeners['cell-mouseleave']
119
120
  const triggerDblclick = (editRender && editConfig && editOpts.trigger === 'dblclick')
120
121
  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
122
  // hover 进入事件
126
123
  if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
127
124
  tdOns.mouseenter = (evnt: any) => {
@@ -294,7 +291,7 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
294
291
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
295
292
  attrs,
296
293
  style: Object.assign({
297
- height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
294
+ height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : (scrollYLoad ? `${rest.height || scrollYRHeight || rowHeight}px` : '')
298
295
  }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
299
296
  on: tdOns
300
297
  }, tdVNs)
@@ -447,46 +444,6 @@ function renderRows (h: CreateElement, _vm: any, $xetable: any, fixedType: any,
447
444
  return rows
448
445
  }
449
446
 
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
447
  export default {
491
448
  name: 'VxeTableBody',
492
449
  props: {
@@ -515,17 +472,9 @@ export default {
515
472
  elemStore[`${prefix}xSpace`] = $refs.xSpace
516
473
  elemStore[`${prefix}ySpace`] = $refs.ySpace
517
474
  elemStore[`${prefix}emptyBlock`] = $refs.emptyBlock
518
- if (this.$el) {
519
- this.$el.onscroll = this.scrollEvent
520
- this.$el._onscroll = this.scrollEvent
521
- }
522
475
  },
523
476
  beforeDestroy (this: any) {
524
477
  clearTimeout(this.wheelTime)
525
- if (this.$el) {
526
- this.$el._onscroll = null
527
- this.$el.onscroll = null
528
- }
529
478
  },
530
479
  destroyed (this: any) {
531
480
  const { $parent: $xetable, fixedType } = this
@@ -580,11 +529,9 @@ export default {
580
529
  attrs: {
581
530
  xid: tId
582
531
  },
583
- on: scrollYLoad && sYOpts.mode === 'wheel'
584
- ? {
585
- wheel: this.wheelEvent
586
- }
587
- : {}
532
+ on: Object.assign({
533
+ scroll: this.scrollEvent
534
+ }, scrollYLoad && sYOpts.mode === 'wheel' ? { wheel: this.wheelEvent } : null)
588
535
  }, [
589
536
  fixedType
590
537
  ? _e()
@@ -679,72 +626,57 @@ export default {
679
626
  * 如果存在列固定左侧,同步更新滚动状态
680
627
  * 如果存在列固定右侧,同步更新滚动状态
681
628
  */
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
629
+ scrollEvent (evnt: Event) {
630
+ const { $el: scrollBodyElem, $parent: $xeTable, fixedType } = this
631
+ const { $refs, lastScrollTop, lastScrollLeft } = $xeTable
632
+ const { tableHeader, tableBody, leftBody, rightBody, tableFooter } = $refs
686
633
  const headerElem = tableHeader ? tableHeader.$el : null
687
634
  const footerElem = tableFooter ? tableFooter.$el : null
688
635
  const bodyElem = tableBody.$el
689
636
  const leftElem = leftBody ? leftBody.$el : null
690
637
  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
638
+ const scrollTop = scrollBodyElem.scrollTop
696
639
  const scrollLeft = bodyElem.scrollLeft
697
640
  const isRollX = scrollLeft !== lastScrollLeft
698
641
  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
- }
642
+ const xHandleEl = $refs.refScrollXHandleElem
643
+ const yHandleEl = $refs.refScrollYHandleElem
644
+ if (yHandleEl) {
645
+ yHandleEl.scrollTop = scrollTop
646
+ } else if (isRollY) {
647
+ $xeTable.lastScrollTop = scrollTop
648
+ $xeTable.lastScrollLeft = scrollLeft
649
+ if (leftElem && fixedType === 'left') {
650
+ setScrollTop(bodyElem, scrollTop)
651
+ setScrollTop(rightElem, scrollTop)
652
+ } else if (rightElem && fixedType === 'right') {
653
+ setScrollTop(bodyElem, scrollTop)
654
+ setScrollTop(leftElem, scrollTop)
655
+ } else {
656
+ setScrollTop(leftElem, scrollTop)
657
+ setScrollTop(rightElem, scrollTop)
725
658
  }
659
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
660
+ type: renderType,
661
+ fixed: fixedType,
662
+ scrollTop,
663
+ scrollLeft
664
+ })
726
665
  }
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()
666
+ if (xHandleEl) {
667
+ xHandleEl.scrollLeft = scrollLeft
668
+ } else if (isRollX) {
669
+ $xeTable.lastScrollTop = scrollTop
670
+ $xeTable.lastScrollLeft = scrollLeft
671
+ setScrollLeft(headerElem, scrollLeft)
672
+ setScrollLeft(footerElem, scrollLeft)
673
+ $xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
674
+ type: renderType,
675
+ fixed: fixedType,
676
+ scrollTop,
677
+ scrollLeft
678
+ })
735
679
  }
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
680
  },
749
681
  handleWheel (evnt: any, isTopWheel: any, deltaTop: any, isRollX: any, isRollY: any) {
750
682
  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