vxe-table 3.20.0 → 3.20.2

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 (53) 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/body.js +4 -2
  6. package/es/table/src/column.js +1 -1
  7. package/es/table/src/methods.js +23 -17
  8. package/es/table/src/table.js +16 -1
  9. package/es/table/src/util.js +1 -2
  10. package/es/table/style.css +2 -2
  11. package/es/table/style.min.css +1 -1
  12. package/es/ui/index.js +1 -1
  13. package/es/ui/src/log.js +1 -1
  14. package/es/vxe-table/style.css +2 -2
  15. package/es/vxe-table/style.min.css +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.min.css +1 -1
  18. package/lib/index.umd.js +34 -14
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/src/body.js +5 -2
  23. package/lib/table/src/body.min.js +1 -1
  24. package/lib/table/src/column.js +1 -1
  25. package/lib/table/src/column.min.js +1 -1
  26. package/lib/table/src/methods.js +7 -7
  27. package/lib/table/src/methods.min.js +1 -1
  28. package/lib/table/src/table.js +18 -0
  29. package/lib/table/src/table.min.js +1 -1
  30. package/lib/table/src/util.js +1 -2
  31. package/lib/table/src/util.min.js +1 -1
  32. package/lib/table/style/style.css +2 -2
  33. package/lib/table/style/style.min.css +1 -1
  34. package/lib/ui/index.js +1 -1
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/lib/vxe-table/style/style.css +2 -2
  39. package/lib/vxe-table/style/style.min.css +1 -1
  40. package/package.json +1 -1
  41. package/packages/table/src/body.ts +4 -2
  42. package/packages/table/src/column.ts +1 -1
  43. package/packages/table/src/methods.ts +23 -17
  44. package/packages/table/src/table.ts +18 -2
  45. package/packages/table/src/util.ts +2 -2
  46. package/styles/components/table.scss +2 -2
  47. package/styles/theme/base.scss +3 -0
  48. /package/es/{iconfont.1773027250443.ttf → iconfont.1773303132392.ttf} +0 -0
  49. /package/es/{iconfont.1773027250443.woff → iconfont.1773303132392.woff} +0 -0
  50. /package/es/{iconfont.1773027250443.woff2 → iconfont.1773303132392.woff2} +0 -0
  51. /package/lib/{iconfont.1773027250443.ttf → iconfont.1773303132392.ttf} +0 -0
  52. /package/lib/{iconfont.1773027250443.woff → iconfont.1773303132392.woff} +0 -0
  53. /package/lib/{iconfont.1773027250443.woff2 → iconfont.1773303132392.woff2} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.20.0",
3
+ "version": "3.20.2",
4
4
  "description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -17,10 +17,12 @@ const renderType = 'body'
17
17
  const isVMScrollProcess = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) => {
18
18
  const tableProps = $xeTable
19
19
  const tableReactData = $xeTable as unknown as TableReactData
20
+ const tableInternalData = $xeTable as unknown as TableInternalData
20
21
 
21
22
  const { delayHover } = tableProps
22
- const { lastScrollTime, isDragResize } = tableReactData
23
- return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
23
+ const { isDragResize } = tableReactData
24
+ const { lastSTime } = tableInternalData
25
+ return !!(isDragResize || (lastSTime && Date.now() < lastSTime + (delayHover as number)))
24
26
  }
25
27
 
26
28
  function renderLine (h: CreateElement, $xeTable : VxeTableConstructor & VxeTablePrivateMethods, rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number): VxeComponentSlotType[] {
@@ -138,7 +138,7 @@ export const columnProps = {
138
138
  contentRender: Object,
139
139
 
140
140
  // 聚合函数
141
- aggFunc: [String, Boolean] as PropType<VxeColumnPropTypes.AggFunc>,
141
+ aggFunc: [Boolean, String] as PropType<VxeColumnPropTypes.AggFunc>,
142
142
  // 将单元格复制到剪贴板
143
143
  copyMethod: Function as PropType<VxeColumnPropTypes.CopyMethod>,
144
144
  // 将剪贴单元格的值清除
@@ -3495,7 +3495,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
3495
3495
  if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
3496
3496
  errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"'])
3497
3497
  }
3498
- if (virtualYOpts.mode === 'scroll' && expandOpts.mode === 'fixed') {
3498
+ if (virtualYOpts.mode === 'scroll' && reactData.expandColumn && expandOpts.mode === 'fixed') {
3499
3499
  warnLog('vxe.error.notConflictProp', ['virtual-y-config.mode=scroll', 'expand-config.mode=inside'])
3500
3500
  }
3501
3501
  // if (showOverflow) {
@@ -4023,7 +4023,7 @@ function handleSyncScroll ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
4023
4023
  return Promise.all([
4024
4024
  xRest,
4025
4025
  yRest,
4026
- $xeTable.updateCellAreas()
4026
+ scrollXLoad || scrollYLoad ? $xeTable.updateCellAreas() : null
4027
4027
  ])
4028
4028
  }
4029
4029
 
@@ -8503,6 +8503,7 @@ const tableMethods: any = {
8503
8503
  if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
8504
8504
  let newValue = row
8505
8505
  let isChange = oldValue !== newValue
8506
+ const selected = !isChange
8506
8507
  if (isChange) {
8507
8508
  handleCheckedRadioRow($xeTable, newValue)
8508
8509
  } else if (!strict) {
@@ -8513,7 +8514,7 @@ const tableMethods: any = {
8513
8514
  }
8514
8515
  }
8515
8516
  if (isChange) {
8516
- $xeTable.dispatchEvent('radio-change', { oldValue, newValue, ...params }, evnt)
8517
+ $xeTable.dispatchEvent('radio-change', { oldValue, newValue, selected, ...params }, evnt)
8517
8518
  }
8518
8519
  }
8519
8520
  },
@@ -8527,7 +8528,7 @@ const tableMethods: any = {
8527
8528
  const columnOpts = $xeTable.computeColumnOpts
8528
8529
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts
8529
8530
  const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod as any
8530
- const { column: newValue } = params
8531
+ let { column: newValue } = params
8531
8532
  const { trigger, strict } = currentColumnOpts
8532
8533
  if (trigger === 'manual') {
8533
8534
  return
@@ -8538,15 +8539,16 @@ const tableMethods: any = {
8538
8539
  if (strict) {
8539
8540
  $xeTable.setCurrentColumn(newValue)
8540
8541
  } else {
8541
- isChange = true
8542
- if (selected) {
8542
+ isChange = oldValue === newValue
8543
+ if (isChange) {
8544
+ newValue = null as any
8543
8545
  $xeTable.clearCurrentColumn()
8544
8546
  } else {
8545
8547
  $xeTable.setCurrentColumn(newValue)
8546
8548
  }
8547
8549
  }
8548
8550
  if (isChange) {
8549
- $xeTable.dispatchEvent('current-column-change', { oldValue, newValue, ...params }, evnt)
8551
+ $xeTable.dispatchEvent('current-column-change', { oldValue, newValue, selected, ...params }, evnt)
8550
8552
  }
8551
8553
  } else {
8552
8554
  $xeTable.dispatchEvent('current-column-disabled', params, evnt)
@@ -8560,7 +8562,7 @@ const tableMethods: any = {
8560
8562
  const rowOpts = $xeTable.computeRowOpts
8561
8563
  const currentRowOpts = $xeTable.computeCurrentRowOpts
8562
8564
  const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod as any
8563
- const { row: newValue } = params
8565
+ let { row: newValue } = params
8564
8566
  const { trigger, strict } = currentRowOpts
8565
8567
  if (trigger === 'manual') {
8566
8568
  return
@@ -8571,17 +8573,18 @@ const tableMethods: any = {
8571
8573
  if (strict) {
8572
8574
  $xeTable.setCurrentRow(newValue)
8573
8575
  } else {
8574
- isChange = true
8575
- if (selected) {
8576
+ isChange = oldValue === newValue
8577
+ if (isChange) {
8578
+ newValue = null
8576
8579
  $xeTable.clearCurrentRow()
8577
8580
  } else {
8578
8581
  $xeTable.setCurrentRow(newValue)
8579
8582
  }
8580
8583
  }
8581
8584
  if (isChange) {
8582
- $xeTable.dispatchEvent('current-row-change', { oldValue, newValue, ...params }, evnt)
8585
+ $xeTable.dispatchEvent('current-row-change', { oldValue, newValue, selected, ...params }, evnt)
8583
8586
  // 已废弃
8584
- $xeTable.dispatchEvent('current-change', { oldValue, newValue, ...params }, evnt)
8587
+ $xeTable.dispatchEvent('current-change', { oldValue, newValue, selected, ...params }, evnt)
8585
8588
  }
8586
8589
  } else {
8587
8590
  $xeTable.dispatchEvent('current-row-disabled', params, evnt)
@@ -11432,7 +11435,6 @@ const tableMethods: any = {
11432
11435
  handleScrollEvent (evnt: Event, isRollY: boolean, isRollX: boolean, scrollTop: number, scrollLeft: number, params: any) {
11433
11436
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
11434
11437
  const props = $xeTable
11435
- const reactData = $xeTable as unknown as TableReactData
11436
11438
  const internalData = $xeTable as unknown as TableInternalData
11437
11439
 
11438
11440
  const { highlightHoverRow } = props
@@ -11497,7 +11499,7 @@ const tableMethods: any = {
11497
11499
  }
11498
11500
  internalData.lastScrollTop = scrollTop
11499
11501
  }
11500
- reactData.lastScrollTime = Date.now()
11502
+ internalData.lastSTime = Date.now()
11501
11503
  const evntParams = {
11502
11504
  source: sourceType,
11503
11505
  scrollTop,
@@ -11763,7 +11765,7 @@ const tableMethods: any = {
11763
11765
  return
11764
11766
  }
11765
11767
 
11766
- const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
11768
+ const wheelSpeed = getWheelSpeed(internalData.lastSTime)
11767
11769
  const deltaTop = shiftKey ? 0 : (deltaY * wheelSpeed)
11768
11770
  const deltaLeft = (shiftKey ? (deltaX || deltaY) : deltaX) * wheelSpeed
11769
11771
 
@@ -12271,14 +12273,18 @@ const tableMethods: any = {
12271
12273
  setScrollLeft(bodyScrollElem, scrollLeft)
12272
12274
  setScrollLeft(headerScrollElem, scrollLeft)
12273
12275
  setScrollLeft(footerScrollElem, scrollLeft)
12274
- loadScrollXData($xeTable)
12276
+ if (reactData.scrollXLoad) {
12277
+ loadScrollXData($xeTable)
12278
+ }
12275
12279
  }
12276
12280
  if (XEUtils.isNumber(scrollTop)) {
12277
12281
  setScrollTop(yHandleEl, scrollTop)
12278
12282
  setScrollTop(bodyScrollElem, scrollTop)
12279
12283
  setScrollTop(leftScrollElem, scrollTop)
12280
12284
  setScrollTop(rightScrollElem, scrollTop)
12281
- loadScrollYData($xeTable)
12285
+ if (reactData.scrollYLoad) {
12286
+ loadScrollYData($xeTable)
12287
+ }
12282
12288
  }
12283
12289
  return new Promise<void>(resolve => {
12284
12290
  setTimeout(() => {
@@ -1,7 +1,7 @@
1
1
  import { CreateElement } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { getFuncText, isEnableConf } from '../../ui/src/utils'
4
- import { initTpImg } from '../../ui/src/dom'
4
+ import { initTpImg, toCssUnit } from '../../ui/src/dom'
5
5
  import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
6
6
  import { VxeUI } from '../../ui'
7
7
  import methods from './methods'
@@ -26,7 +26,7 @@ import keyboardMixin from '../module/keyboard/mixin'
26
26
  import validatorMixin from '../module/validator/mixin'
27
27
  import customMixin from '../module/custom/mixin'
28
28
 
29
- import type { VxeTabsConstructor, VxeTabsPrivateMethods } from 'vxe-pc-ui'
29
+ import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType } from 'vxe-pc-ui'
30
30
  import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTablePropTypes, TableInternalData, TableReactData, VxeTableDefines } from '../../../types'
31
31
 
32
32
  const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
@@ -1232,6 +1232,20 @@ export default {
1232
1232
  }
1233
1233
  return ''
1234
1234
  },
1235
+ computeTableStyle () {
1236
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1237
+
1238
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
1239
+ const { width, height } = scrollbarOpts
1240
+ const tStys: VxeComponentStyleType = {}
1241
+ if (width) {
1242
+ tStys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(width)
1243
+ }
1244
+ if (height) {
1245
+ tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height)
1246
+ }
1247
+ return tStys
1248
+ },
1235
1249
  computeTableRowExpandedList () {
1236
1250
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1237
1251
  const reactData = $xeTable as unknown as TableReactData
@@ -2077,6 +2091,7 @@ export default {
2077
2091
  footer: slots.footerTooltip || slots['footer-tooltip']
2078
2092
  }
2079
2093
  const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null
2094
+ const tableStyle = ($xeTable as any).computeTableStyle as VxeComponentStyleType
2080
2095
  const rowDragOpts = $xeTable.computeRowDragOpts
2081
2096
  const tableTipConfig = $xeTable.computeTableTipConfig
2082
2097
  const validTipConfig = $xeTable.computeValidTipConfig
@@ -2148,6 +2163,7 @@ export default {
2148
2163
  'is--virtual-x': scrollXLoad,
2149
2164
  'is--virtual-y': scrollYLoad
2150
2165
  }],
2166
+ style: tableStyle,
2151
2167
  attrs: {
2152
2168
  spellcheck: false
2153
2169
  },
@@ -137,6 +137,8 @@ export function createInternalData (): TableInternalData {
137
137
  teleportToWrapperElem: null,
138
138
  popupToWrapperElem: null,
139
139
 
140
+ lastSTime: 0,
141
+
140
142
  inited: false,
141
143
  tooltipTimeout: null,
142
144
  initStatus: false,
@@ -167,8 +169,6 @@ export function createReactData (): TableReactData {
167
169
  scrollbarWidth: 0,
168
170
  // 横向滚动条的高度
169
171
  scrollbarHeight: 0,
170
- // 最后滚动时间戳
171
- lastScrollTime: 0,
172
172
  // 行高
173
173
  rowHeight: 0,
174
174
  // 表格父容器的高度
@@ -912,7 +912,7 @@ $btnThemeList: (
912
912
  .vxe-table--scroll-x-handle {
913
913
  overflow-y: hidden;
914
914
  overflow-x: scroll;
915
- height: 18px;
915
+ height: var(--vxe-ui-table-view-scrollbar-height);
916
916
  }
917
917
  .vxe-table--scroll-y-handle,
918
918
  .vxe-table--scroll-y-wrapper {
@@ -924,7 +924,7 @@ $btnThemeList: (
924
924
  .vxe-table--scroll-y-handle {
925
925
  overflow-y: scroll;
926
926
  overflow-x: hidden;
927
- width: 18px;
927
+ width: var(--vxe-ui-table-view-scrollbar-width);
928
928
  height: 100%;
929
929
  }
930
930
  .vxe-table--scroll-x-space {
@@ -78,6 +78,9 @@
78
78
 
79
79
  --vxe-ui-table-menu-item-width: 198px;
80
80
 
81
+ --vxe-ui-table-view-scrollbar-width: 18px;
82
+ --vxe-ui-table-view-scrollbar-height: 18px;
83
+
81
84
  --vxe-ui-table-validate-error-color: #f56c6c;
82
85
  --vxe-ui-table-validate-error-cell-background-color: rgba(245, 108,108, 0.1);
83
86
  --vxe-ui-table-validate-error-theme-normal-background-color: var(--vxe-ui-layout-background-color);