vxe-table 3.15.0-beta.4 → 3.15.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 (40) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/src/methods.js +58 -43
  6. package/es/table/src/table.js +2 -1
  7. package/es/table/style.css +12 -0
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-table/style.css +12 -0
  12. package/es/vxe-table/style.min.css +1 -1
  13. package/lib/index.css +1 -1
  14. package/lib/index.min.css +1 -1
  15. package/lib/index.umd.js +67 -46
  16. package/lib/index.umd.min.js +1 -1
  17. package/lib/style.css +1 -1
  18. package/lib/style.min.css +1 -1
  19. package/lib/table/src/methods.js +63 -43
  20. package/lib/table/src/methods.min.js +1 -1
  21. package/lib/table/src/table.js +2 -1
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/style/style.css +12 -0
  24. package/lib/table/style/style.min.css +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/lib/vxe-table/style/style.css +12 -0
  30. package/lib/vxe-table/style/style.min.css +1 -1
  31. package/package.json +2 -2
  32. package/packages/table/src/methods.ts +65 -44
  33. package/packages/table/src/table.ts +23 -22
  34. package/styles/components/table.scss +19 -0
  35. /package/es/{iconfont.1744095177947.ttf → iconfont.1744252945243.ttf} +0 -0
  36. /package/es/{iconfont.1744095177947.woff → iconfont.1744252945243.woff} +0 -0
  37. /package/es/{iconfont.1744095177947.woff2 → iconfont.1744252945243.woff2} +0 -0
  38. /package/lib/{iconfont.1744095177947.ttf → iconfont.1744252945243.ttf} +0 -0
  39. /package/lib/{iconfont.1744095177947.woff → iconfont.1744252945243.woff} +0 -0
  40. /package/lib/{iconfont.1744095177947.woff2 → iconfont.1744252945243.woff2} +0 -0
@@ -1531,10 +1531,8 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
1531
1531
  const internalData = $xeTable as unknown as TableInternalData
1532
1532
 
1533
1533
  const { elemStore } = internalData
1534
- const scrollbarOpts = $xeTable.computeScrollbarOpts
1535
- const tableBody = $xeTable.$refs.refTableBody
1536
- const bodyElem = tableBody ? (tableBody as any).$el as HTMLDivElement : null
1537
- if (!bodyElem) {
1534
+ const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
1535
+ if (!bodyWrapperElem) {
1538
1536
  return
1539
1537
  }
1540
1538
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
@@ -1547,7 +1545,7 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
1547
1545
  }
1548
1546
  let tWidth = 0
1549
1547
  const minCellWidth = 40 // 列宽最少限制 40px
1550
- const bodyWidth = bodyElem.clientWidth
1548
+ const bodyWidth = bodyWrapperElem.clientWidth
1551
1549
  let remainWidth = bodyWidth
1552
1550
  let meanWidth = remainWidth / 100
1553
1551
  const { fit } = props
@@ -1615,9 +1613,9 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
1615
1613
  })
1616
1614
  if (fit) {
1617
1615
  /**
1618
- * 偏移量算法
1619
- * 如果所有列足够放的情况下,从最后动态列开始分配
1620
- */
1616
+ * 偏移量算法
1617
+ * 如果所有列足够放的情况下,从最后动态列开始分配
1618
+ */
1621
1619
  const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList)
1622
1620
  let dynamicSize = dynamicList.length - 1
1623
1621
  if (dynamicSize > 0) {
@@ -1631,29 +1629,10 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
1631
1629
  }
1632
1630
  }
1633
1631
  }
1634
- const tableHeight = bodyElem.offsetHeight
1635
- const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight
1636
- reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
1637
- reactData.overflowY = overflowY
1638
1632
  reactData.scrollXWidth = tWidth
1639
- internalData.tableHeight = tableHeight
1640
-
1641
- const headerTableElem = getRefElem(elemStore['main-header-table'])
1642
- const footerTableElem = getRefElem(elemStore['main-footer-table'])
1643
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
1644
- const overflowX = tWidth > bodyWidth
1645
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
1646
- reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
1647
- internalData.headerHeight = headerHeight
1648
- internalData.footerHeight = footerHeight
1649
- reactData.overflowX = overflowX
1650
1633
  reactData.resizeWidthFlag++
1651
1634
  updateColumnOffsetLeft($xeTable)
1652
1635
  updateHeight($xeTable)
1653
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
1654
- if (overflowX) {
1655
- $xeTable.checkScrolling()
1656
- }
1657
1636
  }
1658
1637
 
1659
1638
  const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
@@ -2033,7 +2012,9 @@ function computeScrollLoad ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
2033
2012
  }
2034
2013
  // 计算 Y 逻辑
2035
2014
  const rowHeight = computeRowHeight($xeTable)
2036
- ;(scrollYStore as any).rowHeight = rowHeight
2015
+
2016
+ ;(scrollYStore as any).rowHeight = rowHeight // 已废弃
2017
+
2037
2018
  reactData.rowHeight = rowHeight
2038
2019
  const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible($xeTable)
2039
2020
  if (scrollYLoad) {
@@ -2050,12 +2031,49 @@ function computeScrollLoad ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
2050
2031
  } else {
2051
2032
  $xeTable.updateScrollYSpace()
2052
2033
  }
2053
- $xeTable.$nextTick(() => {
2054
- updateStyle($xeTable)
2055
- })
2056
2034
  })
2057
2035
  }
2058
2036
 
2037
+ function calcScrollbar ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
2038
+ const reactData = $xeTable as unknown as TableReactData
2039
+ const internalData = $xeTable as unknown as TableInternalData
2040
+
2041
+ const { scrollXWidth, scrollYHeight } = reactData
2042
+ const { elemStore } = internalData
2043
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
2044
+ const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
2045
+ const headerTableElem = getRefElem(elemStore['main-header-table'])
2046
+ const footerTableElem = getRefElem(elemStore['main-footer-table'])
2047
+ const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
2048
+ const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
2049
+ let overflowY = false
2050
+ let overflowX = false
2051
+ if (bodyWrapperElem) {
2052
+ overflowY = scrollYHeight > bodyWrapperElem.clientHeight
2053
+ if (yHandleEl) {
2054
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
2055
+ }
2056
+ reactData.overflowY = overflowY
2057
+
2058
+ overflowX = scrollXWidth > bodyWrapperElem.clientWidth
2059
+ if (xHandleEl) {
2060
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
2061
+ }
2062
+ reactData.overflowX = overflowX
2063
+
2064
+ const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
2065
+ const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
2066
+ internalData.tableHeight = bodyWrapperElem.offsetHeight
2067
+ internalData.headerHeight = headerHeight
2068
+ internalData.footerHeight = footerHeight
2069
+
2070
+ reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
2071
+ }
2072
+ if (overflowX) {
2073
+ $xeTable.checkScrolling()
2074
+ }
2075
+ }
2076
+
2059
2077
  function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean) {
2060
2078
  const internalData = $xeTable as unknown as TableInternalData
2061
2079
 
@@ -2074,21 +2092,22 @@ function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivat
2074
2092
  }
2075
2093
  calcCellWidth($xeTable)
2076
2094
  autoCellWidth($xeTable)
2095
+ calcScrollbar($xeTable)
2077
2096
  updateStyle($xeTable)
2078
- if (reFull) {
2079
- updateRowOffsetTop($xeTable)
2080
- }
2081
2097
  updateRowExpandStyle($xeTable)
2082
2098
  return computeScrollLoad($xeTable).then(() => {
2083
- if (reFull === true) {
2084
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2085
- calcCellWidth($xeTable)
2099
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2100
+ calcCellWidth($xeTable)
2101
+ if (reFull) {
2086
2102
  autoCellWidth($xeTable)
2087
- updateStyle($xeTable)
2088
- if (reFull) {
2089
- updateRowOffsetTop($xeTable)
2090
- }
2091
- updateRowExpandStyle($xeTable)
2103
+ }
2104
+ calcScrollbar($xeTable)
2105
+ updateStyle($xeTable)
2106
+ if (reFull) {
2107
+ updateRowOffsetTop($xeTable)
2108
+ }
2109
+ updateRowExpandStyle($xeTable)
2110
+ if (reFull) {
2092
2111
  return computeScrollLoad($xeTable)
2093
2112
  }
2094
2113
  })
@@ -3010,6 +3029,7 @@ const Methods = {
3010
3029
  }
3011
3030
  reactData.isRowLoading = false
3012
3031
  calcCellHeight($xeTable)
3032
+ updateRowOffsetTop($xeTable)
3013
3033
  // 是否变更虚拟滚动
3014
3034
  if (oldScrollYLoad === sYLoad) {
3015
3035
  restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
@@ -5041,6 +5061,7 @@ const Methods = {
5041
5061
  }
5042
5062
  }
5043
5063
  return $xeTable.$nextTick().then(() => {
5064
+ updateRowOffsetTop($xeTable)
5044
5065
  return { status }
5045
5066
  })
5046
5067
  },
@@ -9250,12 +9271,12 @@ const Methods = {
9250
9271
  const firstRow = afterFullData[startIndex]
9251
9272
  let rowid = getRowid($xeTable, firstRow)
9252
9273
  let rowRest = fullAllDataRowIdData[rowid] || {}
9253
- ySpaceTop = rowRest.oTop
9274
+ ySpaceTop = (rowRest.oTop || 0)
9254
9275
 
9255
9276
  const lastRow = afterFullData[afterFullData.length - 1]
9256
9277
  rowid = getRowid($xeTable, lastRow)
9257
9278
  rowRest = fullAllDataRowIdData[rowid] || {}
9258
- scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight)
9279
+ scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight)
9259
9280
  // 是否展开行
9260
9281
  if (expandColumn && rowExpandedMaps[rowid]) {
9261
9282
  scrollYHeight += rowRest.expandHeight || expandOpts.height || 0
@@ -790,7 +790,7 @@ export default {
790
790
  return Object.assign({}, getConfig().table.currentColumnConfig, props.currentColumnConfig)
791
791
  },
792
792
  computeCellOpts () {
793
- const $xeTable = this
793
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
794
794
  const props = $xeTable
795
795
 
796
796
  const cellOpts = Object.assign({}, getConfig().table.cellConfig, props.cellConfig)
@@ -800,7 +800,7 @@ export default {
800
800
  return cellOpts
801
801
  },
802
802
  computeHeaderCellOpts () {
803
- const $xeTable = this
803
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
804
804
  const props = $xeTable
805
805
 
806
806
  const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
@@ -810,7 +810,7 @@ export default {
810
810
  return headerCellOpts
811
811
  },
812
812
  computeFooterCellOpts () {
813
- const $xeTable = this
813
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
814
814
  const props = $xeTable
815
815
 
816
816
  const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
@@ -856,7 +856,7 @@ export default {
856
856
  return this.computeSeqOpts
857
857
  },
858
858
  computeSeqOpts () {
859
- const $xeTable = this
859
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
860
860
  const props = $xeTable
861
861
 
862
862
  return Object.assign({ startIndex: 0 }, getConfig().table.seqConfig, props.seqConfig)
@@ -865,7 +865,7 @@ export default {
865
865
  return this.computeRadioOpts
866
866
  },
867
867
  computeRadioOpts () {
868
- const $xeTable = this
868
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
869
869
  const props = $xeTable
870
870
 
871
871
  return Object.assign({}, getConfig().table.radioConfig, props.radioConfig)
@@ -874,7 +874,7 @@ export default {
874
874
  return this.computeCheckboxOpts
875
875
  },
876
876
  computeCheckboxOpts () {
877
- const $xeTable = this
877
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
878
878
  const props = $xeTable
879
879
 
880
880
  return Object.assign({}, getConfig().table.checkboxConfig, props.checkboxConfig)
@@ -883,7 +883,7 @@ export default {
883
883
  return this.computeTooltipOpts
884
884
  },
885
885
  computeTooltipOpts () {
886
- const $xeTable = this
886
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
887
887
  const props = $xeTable
888
888
 
889
889
  return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig)
@@ -892,15 +892,15 @@ export default {
892
892
  return { ...this.tooltipOpts }
893
893
  },
894
894
  computeTableTipConfig () {
895
- const $xeTable = this
896
- const reactData = $xeTable
895
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
896
+ const reactData = $xeTable as unknown as TableReactData
897
897
 
898
898
  const { tooltipStore } = reactData
899
899
  const tooltipOpts = $xeTable.computeTooltipOpts
900
900
  return Object.assign({}, tooltipOpts, tooltipStore.currOpts)
901
901
  },
902
902
  computeValidTipConfig () {
903
- const $xeTable = this
903
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
904
904
 
905
905
  const tooltipOpts = $xeTable.computeTooltipOpts
906
906
  return Object.assign({}, tooltipOpts)
@@ -960,7 +960,7 @@ export default {
960
960
  return this.computeHeaderMenu
961
961
  },
962
962
  computeHeaderMenu () {
963
- const $xeTable = this
963
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
964
964
 
965
965
  const menuOpts = $xeTable.computeMenuOpts
966
966
  const headerOpts = menuOpts.header
@@ -970,7 +970,7 @@ export default {
970
970
  return this.computeBodyMenu
971
971
  },
972
972
  computeBodyMenu () {
973
- const $xeTable = this
973
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
974
974
 
975
975
  const menuOpts = $xeTable.computeMenuOpts
976
976
  const bodyOpts = menuOpts.body
@@ -980,7 +980,7 @@ export default {
980
980
  return this.computeFooterMenu
981
981
  },
982
982
  computeFooterMenu () {
983
- const $xeTable = this
983
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
984
984
 
985
985
  const menuOpts = $xeTable.computeMenuOpts
986
986
  const footerOpts = menuOpts.footer
@@ -990,21 +990,21 @@ export default {
990
990
  return this.computeIsMenu
991
991
  },
992
992
  computeIsMenu () {
993
- const $xeTable = this
993
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
994
994
  const props = $xeTable
995
995
 
996
996
  const menuOpts = $xeTable.computeMenuOpts
997
997
  const headerMenu = $xeTable.computeHeaderMenu
998
998
  const bodyMenu = $xeTable.computeBodyMenu
999
999
  const footerMenu = $xeTable.computeFooterMenu
1000
- return !!((props.contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length))
1000
+ return !!(((props as any).contextMenu || props.menuConfig) && isEnableConf(menuOpts) && (headerMenu.length || bodyMenu.length || footerMenu.length))
1001
1001
  },
1002
1002
  ctxMenuList () {
1003
1003
  return this.computeMenuList
1004
1004
  },
1005
1005
  computeMenuList () {
1006
- const $xeTable = this
1007
- const reactData = $xeTable as TableReactData
1006
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1007
+ const reactData = $xeTable as unknown as TableReactData
1008
1008
 
1009
1009
  const { ctxMenuStore } = reactData
1010
1010
  const rest: any[] = []
@@ -1022,8 +1022,8 @@ export default {
1022
1022
  return Object.assign({}, getConfig().table.menuConfig, this.contextMenu, this.menuConfig)
1023
1023
  },
1024
1024
  computeLeftFixedWidth () {
1025
- const $xeTable = this
1026
- const reactData = $xeTable as TableReactData
1025
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1026
+ const reactData = $xeTable as unknown as TableReactData
1027
1027
 
1028
1028
  const { columnStore } = reactData
1029
1029
  const { leftList } = columnStore
@@ -1035,8 +1035,8 @@ export default {
1035
1035
  return leftWidth
1036
1036
  },
1037
1037
  computeRightFixedWidth () {
1038
- const $xeTable = this
1039
- const reactData = $xeTable as TableReactData
1038
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1039
+ const reactData = $xeTable as unknown as TableReactData
1040
1040
 
1041
1041
  const { columnStore } = reactData
1042
1042
  const { rightList } = columnStore
@@ -2034,7 +2034,8 @@ export default {
2034
2034
  theme: tableTipConfig.theme,
2035
2035
  enterable: tableTipConfig.enterable,
2036
2036
  enterDelay: tableTipConfig.enterDelay,
2037
- leaveDelay: tableTipConfig.leaveDelay
2037
+ leaveDelay: tableTipConfig.leaveDelay,
2038
+ useHTML: tableTipConfig.useHTML
2038
2039
  }
2039
2040
  })
2040
2041
  : renderEmptyElement($xeTable),
@@ -820,11 +820,25 @@
820
820
  }
821
821
  }
822
822
  }
823
+ .vxe-header--column {
824
+ &:last-child {
825
+ & > .vxe-cell--col-resizable {
826
+ right: 0;
827
+ }
828
+ }
829
+ }
823
830
  .vxe-table--fixed-right-wrapper {
824
831
  .vxe-cell--col-resizable {
825
832
  right: auto;
826
833
  left: -0.3em;
827
834
  }
835
+ .vxe-header--column {
836
+ &:last-child {
837
+ & > .vxe-cell--col-resizable {
838
+ left: 0;
839
+ }
840
+ }
841
+ }
828
842
  }
829
843
 
830
844
  .vxe-body--column {
@@ -1024,6 +1038,11 @@
1024
1038
  }
1025
1039
  }
1026
1040
  }
1041
+ &.header-cell--area {
1042
+ .vxe-table--header-wrapper {
1043
+ user-select: none;
1044
+ }
1045
+ }
1027
1046
  &.body-cell--area {
1028
1047
  .vxe-table--body-wrapper {
1029
1048
  user-select: none;