vxe-table 4.18.0 → 4.18.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 +3 -2
  6. package/es/table/src/column.js +1 -1
  7. package/es/table/src/group.js +2 -1
  8. package/es/table/src/table.js +38 -18
  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 +20 -18
  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 +4 -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/group.js +2 -1
  27. package/lib/table/src/group.min.js +1 -1
  28. package/lib/table/src/table.js +10 -10
  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 +3 -2
  42. package/packages/table/src/column.ts +1 -1
  43. package/packages/table/src/group.ts +2 -1
  44. package/packages/table/src/table.ts +40 -18
  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.1773027275628.ttf → iconfont.1773303158382.ttf} +0 -0
  49. /package/es/{iconfont.1773027275628.woff → iconfont.1773303158382.woff} +0 -0
  50. /package/es/{iconfont.1773027275628.woff2 → iconfont.1773303158382.woff2} +0 -0
  51. /package/lib/{iconfont.1773027275628.ttf → iconfont.1773303158382.ttf} +0 -0
  52. /package/lib/{iconfont.1773027275628.woff → iconfont.1773303158382.woff} +0 -0
  53. /package/lib/{iconfont.1773027275628.woff2 → iconfont.1773303158382.woff2} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "4.18.0",
3
+ "version": "4.18.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",
@@ -43,8 +43,9 @@ export default defineVxeComponent({
43
43
  // 滚动、拖动过程中不需要触发
44
44
  const isVMScrollProcess = () => {
45
45
  const { delayHover } = tableProps
46
- const { lastScrollTime, isDragResize } = tableReactData
47
- return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
46
+ const { isDragResize } = tableReactData
47
+ const { lastSTime } = tableInternalData
48
+ return !!(isDragResize || (lastSTime && Date.now() < lastSTime + (delayHover as number)))
48
49
  }
49
50
 
50
51
  const renderLine = (rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number): VxeComponentSlotType[] => {
@@ -131,7 +131,7 @@ export const columnProps = {
131
131
  contentRender: Object as PropType<VxeColumnPropTypes.ContentRender>,
132
132
 
133
133
  // 聚合函数
134
- aggFunc: [String, Boolean] as PropType<VxeColumnPropTypes.AggFunc>,
134
+ aggFunc: [Boolean, String] as PropType<VxeColumnPropTypes.AggFunc>,
135
135
  // 将单元格复制到剪贴板
136
136
  copyMethod: Function as PropType<VxeColumnPropTypes.CopyMethod>,
137
137
  // 将剪贴单元格的值清除
@@ -42,9 +42,10 @@ export default defineVxeComponent({
42
42
  })
43
43
 
44
44
  const renderVN = () => {
45
+ const defaultSlot = slots.default
45
46
  return h('div', {
46
47
  ref: refElem
47
- }, slots.default ? slots.default() : [])
48
+ }, defaultSlot ? defaultSlot() : [])
48
49
  }
49
50
 
50
51
  const $xeColgroup = { columnConfig } as XEColumnInstance
@@ -30,7 +30,7 @@ import '../module/validator/hook'
30
30
  import '../module/custom/hook'
31
31
  import '../render'
32
32
 
33
- import type { VxeTooltipInstance, VxeTabsConstructor, VxeTabsPrivateMethods, ValueOf, VxeComponentSlotType } from 'vxe-pc-ui'
33
+ import type { VxeTooltipInstance, VxeTabsConstructor, VxeTabsPrivateMethods, ValueOf, VxeComponentSlotType, VxeComponentStyleType } from 'vxe-pc-ui'
34
34
  import type { VxeGridConstructor, VxeGridPrivateMethods, VxeTableConstructor, VxeTablePropTypes, VxeToolbarConstructor, TablePrivateMethods, VxeTablePrivateRef, VxeTablePrivateComputed, VxeTablePrivateMethods, TableMethods, VxeTableMethods, VxeTableDefines, VxeTableEmits, VxeTableProps, VxeColumnPropTypes, VxeTableCustomPanelConstructor } from '../../../types'
35
35
 
36
36
  const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI
@@ -615,6 +615,19 @@ export default defineVxeComponent({
615
615
  return ''
616
616
  })
617
617
 
618
+ const computeTableStyle = computed(() => {
619
+ const scrollbarOpts = computeScrollbarOpts.value
620
+ const { width, height } = scrollbarOpts
621
+ const tStys: VxeComponentStyleType = {}
622
+ if (width) {
623
+ tStys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(width)
624
+ }
625
+ if (height) {
626
+ tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height)
627
+ }
628
+ return tStys
629
+ })
630
+
618
631
  const computeTableRowExpandedList = computed(() => {
619
632
  const { tableData, rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData
620
633
  const { visibleDataRowIdData, rowExpandedMaps } = internalData
@@ -3755,7 +3768,7 @@ export default defineVxeComponent({
3755
3768
  if (reactData.expandColumn && expandOpts.mode !== 'fixed') {
3756
3769
  errLog('vxe.error.notConflictProp', ['column.type="expand', 'expand-config.mode="fixed"'])
3757
3770
  }
3758
- if (virtualYOpts.mode === 'scroll' && expandOpts.mode === 'fixed') {
3771
+ if (virtualYOpts.mode === 'scroll' && reactData.expandColumn && expandOpts.mode === 'fixed') {
3759
3772
  warnLog('vxe.error.notConflictProp', ['virtual-y-config.mode=scroll', 'expand-config.mode=inside'])
3760
3773
  }
3761
3774
  // if (showOverflow) {
@@ -4462,7 +4475,7 @@ export default defineVxeComponent({
4462
4475
  return Promise.all([
4463
4476
  xRest,
4464
4477
  yRest,
4465
- $xeTable.updateCellAreas()
4478
+ scrollXLoad || scrollYLoad ? $xeTable.updateCellAreas() : null
4466
4479
  ])
4467
4480
  }
4468
4481
 
@@ -5288,7 +5301,7 @@ export default defineVxeComponent({
5288
5301
  const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null
5289
5302
  cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : ''
5290
5303
  } else {
5291
- cellLabel = `${formatter(formatParams)}`
5304
+ cellLabel = formatter(formatParams)
5292
5305
  }
5293
5306
  } else if (renderOpts && tcFormatter) {
5294
5307
  cellLabel = tcFormatter(renderOpts, formatParams)
@@ -7299,14 +7312,18 @@ export default defineVxeComponent({
7299
7312
  setScrollLeft(bodyScrollElem, scrollLeft)
7300
7313
  setScrollLeft(headerScrollElem, scrollLeft)
7301
7314
  setScrollLeft(footerScrollElem, scrollLeft)
7302
- loadScrollXData()
7315
+ if (reactData.scrollXLoad) {
7316
+ loadScrollXData()
7317
+ }
7303
7318
  }
7304
7319
  if (XEUtils.isNumber(scrollTop)) {
7305
7320
  setScrollTop(yHandleEl, scrollTop)
7306
7321
  setScrollTop(bodyScrollElem, scrollTop)
7307
7322
  setScrollTop(leftScrollElem, scrollTop)
7308
7323
  setScrollTop(rightScrollElem, scrollTop)
7309
- loadScrollYData()
7324
+ if (reactData.scrollYLoad) {
7325
+ loadScrollYData()
7326
+ }
7310
7327
  }
7311
7328
  return new Promise<void>(resolve => {
7312
7329
  setTimeout(() => {
@@ -10184,6 +10201,7 @@ export default defineVxeComponent({
10184
10201
  if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
10185
10202
  let newValue = row
10186
10203
  let isChange = oldValue !== newValue
10204
+ const selected = !isChange
10187
10205
  if (isChange) {
10188
10206
  handleCheckedRadioRow(newValue)
10189
10207
  } else if (!strict) {
@@ -10194,7 +10212,7 @@ export default defineVxeComponent({
10194
10212
  }
10195
10213
  }
10196
10214
  if (isChange) {
10197
- dispatchEvent('radio-change', { oldValue, newValue, ...params }, evnt)
10215
+ dispatchEvent('radio-change', { oldValue, newValue, selected, ...params }, evnt)
10198
10216
  }
10199
10217
  }
10200
10218
  },
@@ -10203,7 +10221,7 @@ export default defineVxeComponent({
10203
10221
  const columnOpts = computeColumnOpts.value
10204
10222
  const currentColumnOpts = computeCurrentColumnOpts.value
10205
10223
  const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod as any
10206
- const { column: newValue } = params
10224
+ let { column: newValue } = params
10207
10225
  const { trigger, strict } = currentColumnOpts
10208
10226
  if (trigger === 'manual') {
10209
10227
  return
@@ -10214,15 +10232,16 @@ export default defineVxeComponent({
10214
10232
  if (strict) {
10215
10233
  $xeTable.setCurrentColumn(newValue)
10216
10234
  } else {
10217
- isChange = true
10218
- if (selected) {
10235
+ isChange = oldValue === newValue
10236
+ if (isChange) {
10237
+ newValue = null as any
10219
10238
  $xeTable.clearCurrentColumn()
10220
10239
  } else {
10221
10240
  $xeTable.setCurrentColumn(newValue)
10222
10241
  }
10223
10242
  }
10224
10243
  if (isChange) {
10225
- dispatchEvent('current-column-change', { oldValue, newValue, ...params }, evnt)
10244
+ dispatchEvent('current-column-change', { oldValue, newValue, selected, ...params }, evnt)
10226
10245
  }
10227
10246
  } else {
10228
10247
  dispatchEvent('current-column-disabled', params, evnt)
@@ -10233,7 +10252,7 @@ export default defineVxeComponent({
10233
10252
  const rowOpts = computeRowOpts.value
10234
10253
  const currentRowOpts = computeCurrentRowOpts.value
10235
10254
  const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod as any
10236
- const { row: newValue } = params
10255
+ let { row: newValue } = params
10237
10256
  const { trigger, strict } = currentRowOpts
10238
10257
  if (trigger === 'manual') {
10239
10258
  return
@@ -10244,17 +10263,18 @@ export default defineVxeComponent({
10244
10263
  if (strict) {
10245
10264
  $xeTable.setCurrentRow(newValue)
10246
10265
  } else {
10247
- isChange = true
10248
- if (selected) {
10266
+ isChange = oldValue === newValue
10267
+ if (isChange) {
10268
+ newValue = null
10249
10269
  $xeTable.clearCurrentRow()
10250
10270
  } else {
10251
10271
  $xeTable.setCurrentRow(newValue)
10252
10272
  }
10253
10273
  }
10254
10274
  if (isChange) {
10255
- dispatchEvent('current-row-change', { oldValue, newValue, ...params }, evnt)
10275
+ dispatchEvent('current-row-change', { oldValue, newValue, selected, ...params }, evnt)
10256
10276
  // 已废弃
10257
- dispatchEvent('current-change', { oldValue, newValue, ...params }, evnt)
10277
+ dispatchEvent('current-change', { oldValue, newValue, selected, ...params }, evnt)
10258
10278
  }
10259
10279
  } else {
10260
10280
  dispatchEvent('current-row-disabled', params, evnt)
@@ -11622,7 +11642,7 @@ export default defineVxeComponent({
11622
11642
  }
11623
11643
  internalData.lastScrollTop = scrollTop
11624
11644
  }
11625
- reactData.lastScrollTime = Date.now()
11645
+ internalData.lastSTime = Date.now()
11626
11646
  const evntParams = {
11627
11647
  source: sourceType,
11628
11648
  scrollTop,
@@ -11867,7 +11887,7 @@ export default defineVxeComponent({
11867
11887
  return
11868
11888
  }
11869
11889
 
11870
- const wheelSpeed = getWheelSpeed(reactData.lastScrollTime)
11890
+ const wheelSpeed = getWheelSpeed(internalData.lastSTime)
11871
11891
  const deltaTop = shiftKey ? 0 : (deltaY * wheelSpeed)
11872
11892
  const deltaLeft = (shiftKey ? (deltaX || deltaY) : deltaX) * wheelSpeed
11873
11893
 
@@ -12870,6 +12890,7 @@ export default defineVxeComponent({
12870
12890
  footer: slots.footerTooltip || slots['footer-tooltip']
12871
12891
  }
12872
12892
  const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null
12893
+ const tableStyle = computeTableStyle.value
12873
12894
  const rowDragOpts = computeRowDragOpts.value
12874
12895
  const tableTipConfig = computeTableTipConfig.value
12875
12896
  const validTipConfig = computeValidTipConfig.value
@@ -12941,6 +12962,7 @@ export default defineVxeComponent({
12941
12962
  'is--virtual-x': scrollXLoad,
12942
12963
  'is--virtual-y': scrollYLoad
12943
12964
  }],
12965
+ style: tableStyle,
12944
12966
  spellcheck: false,
12945
12967
  ...tbOns
12946
12968
  }, [
@@ -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);