vxe-table 4.13.0-beta.3 → 4.13.0-beta.5

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 (41) 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/emits.js +4 -0
  6. package/es/table/src/table.js +83 -47
  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 +15 -13
  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/emits.js +1 -1
  20. package/lib/table/src/emits.min.js +1 -1
  21. package/lib/table/src/table.js +98 -53
  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/grid/src/grid.ts +1 -1
  33. package/packages/table/src/emits.ts +7 -1
  34. package/packages/table/src/table.ts +87 -48
  35. package/styles/components/table.scss +19 -0
  36. /package/es/{iconfont.1744078815150.ttf → iconfont.1744249431265.ttf} +0 -0
  37. /package/es/{iconfont.1744078815150.woff → iconfont.1744249431265.woff} +0 -0
  38. /package/es/{iconfont.1744078815150.woff2 → iconfont.1744249431265.woff2} +0 -0
  39. /package/lib/{iconfont.1744078815150.ttf → iconfont.1744249431265.ttf} +0 -0
  40. /package/lib/{iconfont.1744078815150.woff → iconfont.1744249431265.woff} +0 -0
  41. /package/lib/{iconfont.1744078815150.woff2 → iconfont.1744249431265.woff2} +0 -0
@@ -1564,10 +1564,8 @@ export default defineComponent({
1564
1564
  */
1565
1565
  const autoCellWidth = () => {
1566
1566
  const { elemStore } = internalData
1567
- const scrollbarOpts = computeScrollbarOpts.value
1568
- const tableBody = refTableBody.value
1569
- const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
1570
- if (!bodyElem) {
1567
+ const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
1568
+ if (!bodyWrapperElem) {
1571
1569
  return
1572
1570
  }
1573
1571
  const yHandleEl = refScrollYHandleElem.value
@@ -1580,7 +1578,7 @@ export default defineComponent({
1580
1578
  }
1581
1579
  let tWidth = 0
1582
1580
  const minCellWidth = 40 // 列宽最少限制 40px
1583
- const bodyWidth = bodyElem.clientWidth
1581
+ const bodyWidth = bodyWrapperElem.clientWidth
1584
1582
  let remainWidth = bodyWidth
1585
1583
  let meanWidth = remainWidth / 100
1586
1584
  const { fit } = props
@@ -1664,29 +1662,10 @@ export default defineComponent({
1664
1662
  }
1665
1663
  }
1666
1664
  }
1667
- const tableHeight = bodyElem.offsetHeight
1668
- const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight
1669
- reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
1670
- reactData.overflowY = overflowY
1671
1665
  reactData.scrollXWidth = tWidth
1672
- internalData.tableHeight = tableHeight
1673
-
1674
- const headerTableElem = getRefElem(elemStore['main-header-table'])
1675
- const footerTableElem = getRefElem(elemStore['main-footer-table'])
1676
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
1677
- const overflowX = tWidth > bodyWidth
1678
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
1679
- reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
1680
- internalData.headerHeight = headerHeight
1681
- internalData.footerHeight = footerHeight
1682
- reactData.overflowX = overflowX
1683
1666
  reactData.resizeWidthFlag++
1684
1667
  updateColumnOffsetLeft()
1685
1668
  updateHeight()
1686
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
1687
- if (overflowX) {
1688
- $xeTable.checkScrolling()
1689
- }
1690
1669
  }
1691
1670
 
1692
1671
  const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
@@ -2775,7 +2754,9 @@ export default defineComponent({
2775
2754
  }
2776
2755
  // 计算 Y 逻辑
2777
2756
  const rowHeight = computeRowHeight()
2778
- ;(scrollYStore as any).rowHeight = rowHeight
2757
+
2758
+ ;(scrollYStore as any).rowHeight = rowHeight // 已废弃
2759
+
2779
2760
  reactData.rowHeight = rowHeight
2780
2761
  const { toVisibleIndex: toYVisibleIndex, visibleSize: visibleYSize } = handleVirtualYVisible()
2781
2762
  if (scrollYLoad) {
@@ -2792,12 +2773,46 @@ export default defineComponent({
2792
2773
  } else {
2793
2774
  $xeTable.updateScrollYSpace()
2794
2775
  }
2795
- nextTick(() => {
2796
- updateStyle()
2797
- })
2798
2776
  })
2799
2777
  }
2800
2778
 
2779
+ const calcScrollbar = () => {
2780
+ const { scrollXWidth, scrollYHeight } = reactData
2781
+ const { elemStore } = internalData
2782
+ const scrollbarOpts = computeScrollbarOpts.value
2783
+ const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
2784
+ const headerTableElem = getRefElem(elemStore['main-header-table'])
2785
+ const footerTableElem = getRefElem(elemStore['main-footer-table'])
2786
+ const xHandleEl = refScrollXHandleElem.value
2787
+ const yHandleEl = refScrollYHandleElem.value
2788
+ let overflowY = false
2789
+ let overflowX = false
2790
+ if (bodyWrapperElem) {
2791
+ overflowY = scrollYHeight > bodyWrapperElem.clientHeight
2792
+ if (yHandleEl) {
2793
+ reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth)
2794
+ }
2795
+ reactData.overflowY = overflowY
2796
+
2797
+ overflowX = scrollXWidth > bodyWrapperElem.clientWidth
2798
+ if (xHandleEl) {
2799
+ reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight)
2800
+ }
2801
+
2802
+ const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
2803
+ const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
2804
+ internalData.tableHeight = bodyWrapperElem.offsetHeight
2805
+ internalData.headerHeight = headerHeight
2806
+ internalData.footerHeight = footerHeight
2807
+
2808
+ reactData.overflowX = overflowX
2809
+ reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
2810
+ }
2811
+ if (overflowX) {
2812
+ $xeTable.checkScrolling()
2813
+ }
2814
+ }
2815
+
2801
2816
  const handleRecalculateLayout = (reFull: boolean) => {
2802
2817
  const el = refElem.value
2803
2818
  internalData.rceRunTime = Date.now()
@@ -2814,18 +2829,22 @@ export default defineComponent({
2814
2829
  }
2815
2830
  calcCellWidth()
2816
2831
  autoCellWidth()
2832
+ calcScrollbar()
2817
2833
  updateStyle()
2818
2834
  updateRowExpandStyle()
2819
2835
  return computeScrollLoad().then(() => {
2820
- if (reFull === true) {
2821
- // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2822
- calcCellWidth()
2836
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
2837
+ calcCellWidth()
2838
+ if (reFull) {
2823
2839
  autoCellWidth()
2824
- updateStyle()
2825
- if (reFull) {
2826
- updateRowOffsetTop()
2827
- }
2828
- updateRowExpandStyle()
2840
+ }
2841
+ calcScrollbar()
2842
+ updateStyle()
2843
+ if (reFull) {
2844
+ updateRowOffsetTop()
2845
+ }
2846
+ updateRowExpandStyle()
2847
+ if (reFull) {
2829
2848
  return computeScrollLoad()
2830
2849
  }
2831
2850
  })
@@ -8210,7 +8229,7 @@ export default defineComponent({
8210
8229
  isChange = oldValue === newValue
8211
8230
  if (isChange) {
8212
8231
  newValue = null
8213
- tableMethods.clearRadioRow()
8232
+ $xeTable.clearRadioRow()
8214
8233
  }
8215
8234
  }
8216
8235
  if (isChange) {
@@ -8218,24 +8237,37 @@ export default defineComponent({
8218
8237
  }
8219
8238
  },
8220
8239
  triggerCurrentColumnEvent (evnt, params) {
8240
+ const { currentColumn: oldValue } = reactData
8221
8241
  const columnOpts = computeColumnOpts.value
8222
- const { currentMethod } = columnOpts
8223
- const { column } = params
8224
- if (!currentMethod || currentMethod({ column })) {
8225
- tableMethods.setCurrentColumn(column)
8242
+ const currentColumnOpts = computeCurrentColumnOpts.value
8243
+ const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod as any
8244
+ const { column: newValue } = params
8245
+ const isChange = oldValue !== newValue
8246
+ if (!beforeRowMethod || beforeRowMethod({ column: newValue, $table: $xeTable })) {
8247
+ $xeTable.setCurrentColumn(newValue)
8248
+ if (isChange) {
8249
+ dispatchEvent('current-column-change', { oldValue, newValue, ...params }, evnt)
8250
+ }
8251
+ } else {
8252
+ dispatchEvent('current-column-disabled', params, evnt)
8226
8253
  }
8227
8254
  },
8228
8255
  triggerCurrentRowEvent (evnt, params) {
8229
8256
  const { currentRow: oldValue } = reactData
8230
8257
  const rowOpts = computeRowOpts.value
8231
- const { currentMethod } = rowOpts
8258
+ const currentRowOpts = computeCurrentRowOpts.value
8259
+ const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod as any
8232
8260
  const { row: newValue } = params
8233
8261
  const isChange = oldValue !== newValue
8234
- if (!currentMethod || currentMethod({ row: newValue })) {
8235
- tableMethods.setCurrentRow(newValue)
8262
+ if (!beforeRowMethod || beforeRowMethod({ row: newValue, $table: $xeTable })) {
8263
+ $xeTable.setCurrentRow(newValue)
8236
8264
  if (isChange) {
8265
+ dispatchEvent('current-row-change', { oldValue, newValue, ...params }, evnt)
8266
+ // 已废弃
8237
8267
  dispatchEvent('current-change', { oldValue, newValue, ...params }, evnt)
8238
8268
  }
8269
+ } else {
8270
+ dispatchEvent('current-row-disabled', params, evnt)
8239
8271
  }
8240
8272
  },
8241
8273
  /**
@@ -9593,12 +9625,12 @@ export default defineComponent({
9593
9625
  const firstRow = afterFullData[startIndex]
9594
9626
  let rowid = getRowid($xeTable, firstRow)
9595
9627
  let rowRest = fullAllDataRowIdData[rowid] || {}
9596
- ySpaceTop = rowRest.oTop
9628
+ ySpaceTop = (rowRest.oTop || 0)
9597
9629
 
9598
9630
  const lastRow = afterFullData[afterFullData.length - 1]
9599
9631
  rowid = getRowid($xeTable, lastRow)
9600
9632
  rowRest = fullAllDataRowIdData[rowid] || {}
9601
- scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight)
9633
+ scrollYHeight = (rowRest.oTop || 0) + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight)
9602
9634
  // 是否展开行
9603
9635
  if (expandColumn && rowExpandedMaps[rowid]) {
9604
9636
  scrollYHeight += rowRest.expandHeight || expandOpts.height || 0
@@ -9663,7 +9695,7 @@ export default defineComponent({
9663
9695
  updateScrollXData () {
9664
9696
  const { isAllOverflow } = reactData
9665
9697
  handleTableColumn()
9666
- $xeTable.updateScrollYSpace()
9698
+ $xeTable.updateScrollXSpace()
9667
9699
  return nextTick().then(() => {
9668
9700
  handleTableColumn()
9669
9701
  $xeTable.updateScrollXSpace()
@@ -10343,7 +10375,8 @@ export default defineComponent({
10343
10375
  theme: tableTipConfig.theme,
10344
10376
  enterable: tableTipConfig.enterable,
10345
10377
  enterDelay: tableTipConfig.enterDelay,
10346
- leaveDelay: tableTipConfig.leaveDelay
10378
+ leaveDelay: tableTipConfig.leaveDelay,
10379
+ useHTML: tableTipConfig.useHTML
10347
10380
  }),
10348
10381
  /**
10349
10382
  * 校验提示
@@ -10694,6 +10727,12 @@ export default defineComponent({
10694
10727
  warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField'])
10695
10728
  }
10696
10729
 
10730
+ if (rowOpts.currentMethod) {
10731
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod'])
10732
+ }
10733
+ if (columnOpts.currentMethod) {
10734
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod'])
10735
+ }
10697
10736
  if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !XEUtils.isBoolean(currentRowOpts.isFollowSelected)) {
10698
10737
  warnLog('vxe.error.notConflictProp', ['row-config.isCurrent', 'current-row-config.isFollowSelected'])
10699
10738
  }
@@ -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;