vxe-table 4.15.4 → 4.15.6

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 (87) hide show
  1. package/README.en.md +2 -6
  2. package/README.ja-JP.md +2 -6
  3. package/README.md +8 -10
  4. package/README.zh-TW.md +2 -6
  5. package/es/grid/src/emits.js +16 -0
  6. package/es/grid/src/grid.js +77 -62
  7. package/es/grid/src/props.js +7 -0
  8. package/es/style.css +1 -1
  9. package/es/table/index.js +0 -8
  10. package/es/table/module/custom/hook.js +3 -0
  11. package/es/table/module/edit/hook.js +3 -0
  12. package/es/table/module/export/hook.js +6 -1
  13. package/es/table/module/filter/hook.js +3 -0
  14. package/es/table/module/menu/hook.js +3 -0
  15. package/es/table/module/validator/hook.js +3 -0
  16. package/es/table/src/emits.js +1 -1
  17. package/es/table/src/header.js +2 -2
  18. package/es/table/src/props.js +1 -1
  19. package/es/table/src/table.js +161 -63
  20. package/es/table/src/util.js +1 -14
  21. package/es/toolbar/src/toolbar.js +2 -2
  22. package/es/ui/index.js +13 -4
  23. package/es/ui/src/log.js +1 -1
  24. package/lib/grid/src/emits.js +8 -0
  25. package/lib/grid/src/emits.min.js +1 -0
  26. package/lib/grid/src/grid.js +78 -54
  27. package/lib/grid/src/grid.min.js +1 -1
  28. package/lib/grid/src/props.js +24 -0
  29. package/lib/grid/src/props.min.js +1 -0
  30. package/lib/index.umd.js +12073 -12008
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/style.css +1 -1
  33. package/lib/table/index.js +0 -8
  34. package/lib/table/index.min.js +1 -1
  35. package/lib/table/module/custom/hook.js +3 -0
  36. package/lib/table/module/custom/hook.min.js +1 -1
  37. package/lib/table/module/edit/hook.js +3 -0
  38. package/lib/table/module/edit/hook.min.js +1 -1
  39. package/lib/table/module/export/hook.js +8 -1
  40. package/lib/table/module/export/hook.min.js +1 -1
  41. package/lib/table/module/filter/hook.js +3 -0
  42. package/lib/table/module/filter/hook.min.js +1 -1
  43. package/lib/table/module/menu/hook.js +3 -0
  44. package/lib/table/module/menu/hook.min.js +1 -1
  45. package/lib/table/module/validator/hook.js +3 -0
  46. package/lib/table/module/validator/hook.min.js +1 -1
  47. package/lib/table/src/emits.js +2 -2
  48. package/lib/table/src/emits.min.js +1 -1
  49. package/lib/table/src/header.js +2 -2
  50. package/lib/table/src/props.js +2 -2
  51. package/lib/table/src/props.min.js +1 -1
  52. package/lib/table/src/table.js +33 -26
  53. package/lib/table/src/table.min.js +1 -1
  54. package/lib/table/src/util.js +1 -14
  55. package/lib/table/src/util.min.js +1 -1
  56. package/lib/toolbar/src/toolbar.js +2 -0
  57. package/lib/toolbar/src/toolbar.min.js +1 -1
  58. package/lib/ui/index.js +12 -3
  59. package/lib/ui/index.min.js +1 -1
  60. package/lib/ui/src/log.js +1 -1
  61. package/lib/ui/src/log.min.js +1 -1
  62. package/package.json +1 -1
  63. package/packages/grid/src/emits.ts +19 -0
  64. package/packages/grid/src/grid.ts +89 -85
  65. package/packages/grid/src/props.ts +23 -0
  66. package/packages/table/index.ts +0 -8
  67. package/packages/table/module/custom/hook.ts +3 -0
  68. package/packages/table/module/edit/hook.ts +3 -0
  69. package/packages/table/module/export/hook.ts +8 -3
  70. package/packages/table/module/filter/hook.ts +3 -0
  71. package/packages/table/module/menu/hook.ts +3 -0
  72. package/packages/table/module/validator/hook.ts +3 -0
  73. package/packages/table/src/emits.ts +2 -2
  74. package/packages/table/src/header.ts +5 -5
  75. package/packages/table/src/props.ts +1 -1
  76. package/packages/table/src/table.ts +167 -66
  77. package/packages/table/src/util.ts +1 -14
  78. package/packages/toolbar/src/toolbar.ts +2 -2
  79. package/packages/ui/index.ts +12 -2
  80. package/packages/ui/src/dom.ts +1 -1
  81. package/styles/cssvar.scss +0 -2
  82. /package/es/{iconfont.1754457119712.ttf → iconfont.1754905357789.ttf} +0 -0
  83. /package/es/{iconfont.1754457119712.woff → iconfont.1754905357789.woff} +0 -0
  84. /package/es/{iconfont.1754457119712.woff2 → iconfont.1754905357789.woff2} +0 -0
  85. /package/lib/{iconfont.1754457119712.ttf → iconfont.1754905357789.ttf} +0 -0
  86. /package/lib/{iconfont.1754457119712.woff → iconfont.1754905357789.woff} +0 -0
  87. /package/lib/{iconfont.1754457119712.woff2 → iconfont.1754905357789.woff2} +0 -0
@@ -12,14 +12,23 @@ import Cell from './cell'
12
12
  import TableBodyComponent from './body'
13
13
  import TableHeaderComponent from './header'
14
14
  import TableFooterComponent from './footer'
15
- import tableProps from './props'
16
- import tableEmits from './emits'
15
+ import { tableProps } from './props'
16
+ import { tableEmits } from './emits'
17
17
  import TableCustomPanelComponent from '../module/custom/panel'
18
18
  import TableFilterPanelComponent from '../module/filter/panel'
19
19
  import TableImportPanelComponent from '../module/export/import-panel'
20
20
  import TableExportPanelComponent from '../module/export/export-panel'
21
21
  import TableMenuPanelComponent from '../module/menu/panel'
22
22
 
23
+ import '../module/filter/hook'
24
+ import '../module/menu/hook'
25
+ import '../module/edit/hook'
26
+ import '../module/export/hook'
27
+ import '../module/keyboard/hook'
28
+ import '../module/validator/hook'
29
+ import '../module/custom/hook'
30
+ import '../render'
31
+
23
32
  import type { VxeTooltipInstance, VxeTabsConstructor, VxeTabsPrivateMethods, ValueOf, VxeComponentSlotType } from 'vxe-pc-ui'
24
33
  import type { VxeGridConstructor, VxeGridPrivateMethods, VxeTableConstructor, TableReactData, VxeTablePropTypes, VxeToolbarConstructor, TablePrivateMethods, VxeTablePrivateRef, VxeTablePrivateComputed, VxeTablePrivateMethods, TableMethods, VxeTableMethods, VxeTableDefines, VxeTableEmits, VxeTableProps, VxeColumnPropTypes, VxeTableCustomPanelConstructor } from '../../../types'
25
34
 
@@ -74,6 +83,12 @@ export default defineVxeComponent({
74
83
  lastScrollTime: 0,
75
84
  // 行高
76
85
  rowHeight: 0,
86
+ // 表头高度
87
+ tHeaderHeight: 0,
88
+ // 表体高度
89
+ tBodyHeight: 0,
90
+ // 表尾高度
91
+ tFooterHeight: 0,
77
92
  // 表格父容器的高度
78
93
  parentHeight: 0,
79
94
  // 是否使用分组表头
@@ -350,6 +365,7 @@ export default defineVxeComponent({
350
365
  const refScrollYSpaceElem = ref<HTMLDivElement>()
351
366
 
352
367
  const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null)
368
+ const $xeGantt = inject('$xeGantt', null)
353
369
  let $xeToolbar: VxeToolbarConstructor
354
370
 
355
371
  const computeTableId = computed(() => {
@@ -901,6 +917,9 @@ export default defineVxeComponent({
901
917
  getComputeMaps: () => computeMaps,
902
918
 
903
919
  xeGrid: $xeGrid,
920
+ xeGantt: $xeGantt,
921
+
922
+ // 已废弃
904
923
  xegrid: $xeGrid
905
924
  } as unknown as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods
906
925
 
@@ -1875,12 +1894,17 @@ export default defineVxeComponent({
1875
1894
  const calcCellAutoHeight = (rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
1876
1895
  const cellElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
1877
1896
  let colHeight = rowRest.height
1897
+ let firstCellStyle: CSSStyleDeclaration | null = null
1898
+ let topBottomPadding = 0
1878
1899
  for (let i = 0; i < cellElemList.length; i++) {
1879
- const cellElem = cellElemList[i] as HTMLElement
1880
- const tdEl = cellElem.parentElement as HTMLTableCellElement
1881
- const topBottomPadding = Math.ceil(XEUtils.toNumber(tdEl.style.paddingTop) + XEUtils.toNumber(tdEl.style.paddingBottom))
1882
- const cellHeight = cellElem ? cellElem.clientHeight : 0
1883
- colHeight = Math.max(colHeight - topBottomPadding, Math.ceil(cellHeight))
1900
+ const wrapperElem = cellElemList[i] as HTMLElement
1901
+ const cellElem = wrapperElem.parentElement as HTMLTableCellElement
1902
+ if (!firstCellStyle) {
1903
+ firstCellStyle = getComputedStyle(cellElem)
1904
+ topBottomPadding = firstCellStyle ? Math.ceil(XEUtils.toNumber(firstCellStyle.paddingTop) + XEUtils.toNumber(firstCellStyle.paddingBottom)) : 0
1905
+ }
1906
+ const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0
1907
+ colHeight = Math.max(colHeight, Math.ceil(cellHeight + topBottomPadding))
1884
1908
  }
1885
1909
  return colHeight
1886
1910
  }
@@ -2258,14 +2282,15 @@ export default defineVxeComponent({
2258
2282
 
2259
2283
  const updateStyle = () => {
2260
2284
  const { showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props
2261
- const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn, isColLoading } = reactData
2262
- const { visibleColumn, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
2285
+ const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn, isColLoading, tHeaderHeight, tFooterHeight } = reactData
2286
+ const { visibleColumn, tableHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
2287
+ const $xeGanttView = internalData.xeGanttView
2263
2288
  const el = refElem.value
2264
- if (!el) {
2289
+ if (!el || !el.clientHeight) {
2265
2290
  return
2266
2291
  }
2267
2292
  const containerList = ['main', 'left', 'right']
2268
- const osbWidth = overflowY ? scrollbarWidth : 0
2293
+ let osbWidth = overflowY ? scrollbarWidth : 0
2269
2294
  const osbHeight = overflowX ? scrollbarHeight : 0
2270
2295
  const emptyPlaceholderElem = refEmptyPlaceholder.value
2271
2296
  const mouseOpts = computeMouseOpts.value
@@ -2273,39 +2298,49 @@ export default defineVxeComponent({
2273
2298
  const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
2274
2299
  const bodyTableElem = getRefElem(elemStore['main-body-table'])
2275
2300
  if (emptyPlaceholderElem) {
2276
- emptyPlaceholderElem.style.top = `${headerHeight}px`
2301
+ emptyPlaceholderElem.style.top = `${tHeaderHeight}px`
2277
2302
  emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
2278
2303
  }
2279
2304
 
2280
- let bodyHeight = 0
2305
+ const scrollbarXToTop = computeScrollbarXToTop.value
2306
+ const scrollbarYToLeft = computeScrollbarYToLeft.value
2307
+
2308
+ const xScrollbarVisible = overflowX ? 'visible' : 'hidden'
2309
+ let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
2310
+ if ($xeGanttView) {
2311
+ if (!scrollbarYToLeft) {
2312
+ osbWidth = 0
2313
+ yScrollbarVisible = 'hidden'
2314
+ }
2315
+ }
2316
+
2317
+ let tbHeight = 0
2281
2318
  let bodyMaxHeight = 0
2282
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight
2319
+ const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight
2283
2320
  if (customMaxHeight) {
2284
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight)
2321
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight)
2285
2322
  }
2286
2323
  if (customHeight) {
2287
- bodyHeight = customHeight - headerHeight - footerHeight - osbHeight
2324
+ tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight
2288
2325
  }
2289
- if (!bodyHeight) {
2326
+ if (!tbHeight) {
2290
2327
  if (bodyTableElem) {
2291
- bodyHeight = bodyTableElem.clientHeight
2328
+ tbHeight = bodyTableElem.clientHeight
2292
2329
  }
2293
2330
  }
2294
- if (bodyHeight) {
2331
+ if (tbHeight) {
2295
2332
  if (bodyMaxHeight) {
2296
- bodyHeight = Math.min(bodyMaxHeight, bodyHeight)
2333
+ tbHeight = Math.min(bodyMaxHeight, tbHeight)
2297
2334
  }
2298
- bodyHeight = Math.max(bodyMinHeight, bodyHeight)
2335
+ tbHeight = Math.max(bodyMinHeight, tbHeight)
2299
2336
  }
2300
2337
 
2301
- const scrollbarXToTop = computeScrollbarXToTop.value
2302
-
2303
2338
  const xLeftCornerEl = refScrollXLeftCornerElem.value
2304
2339
  const xRightCornerEl = refScrollXRightCornerElem.value
2305
2340
  const scrollXVirtualEl = refScrollXVirtualElem.value
2306
2341
  if (scrollXVirtualEl) {
2307
2342
  scrollXVirtualEl.style.height = `${osbHeight}px`
2308
- scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden'
2343
+ scrollXVirtualEl.style.visibility = xScrollbarVisible
2309
2344
  }
2310
2345
  const xWrapperEl = refScrollXWrapperElem.value
2311
2346
  if (xWrapperEl) {
@@ -2324,32 +2359,34 @@ export default defineVxeComponent({
2324
2359
  const scrollYVirtualEl = refScrollYVirtualElem.value
2325
2360
  if (scrollYVirtualEl) {
2326
2361
  scrollYVirtualEl.style.width = `${osbWidth}px`
2327
- scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`
2328
- scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden'
2362
+ scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`
2363
+ scrollYVirtualEl.style.visibility = yScrollbarVisible
2329
2364
  }
2330
2365
  const yTopCornerEl = refScrollYTopCornerElem.value
2331
2366
  if (yTopCornerEl) {
2332
- yTopCornerEl.style.height = `${headerHeight}px`
2333
- yTopCornerEl.style.display = overflowY && headerHeight ? 'block' : ''
2367
+ yTopCornerEl.style.height = `${tHeaderHeight}px`
2368
+ yTopCornerEl.style.display = overflowY && tHeaderHeight ? 'block' : ''
2334
2369
  }
2335
2370
  const yWrapperEl = refScrollYWrapperElem.value
2336
2371
  if (yWrapperEl) {
2337
- yWrapperEl.style.height = `${bodyHeight}px`
2338
- yWrapperEl.style.top = `${headerHeight}px`
2372
+ yWrapperEl.style.height = `${tbHeight}px`
2373
+ yWrapperEl.style.top = `${tHeaderHeight}px`
2339
2374
  }
2340
2375
  const yBottomCornerEl = refScrollYBottomCornerElem.value
2341
2376
  if (yBottomCornerEl) {
2342
- yBottomCornerEl.style.height = `${footerHeight}px`
2343
- yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`
2344
- yBottomCornerEl.style.display = overflowY && footerHeight ? 'block' : ''
2377
+ yBottomCornerEl.style.height = `${tFooterHeight}px`
2378
+ yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`
2379
+ yBottomCornerEl.style.display = overflowY && tFooterHeight ? 'block' : ''
2345
2380
  }
2346
2381
 
2347
2382
  const rowExpandEl = refRowExpandElem.value
2348
2383
  if (rowExpandEl) {
2349
- rowExpandEl.style.height = `${bodyHeight}px`
2350
- rowExpandEl.style.top = `${headerHeight}px`
2384
+ rowExpandEl.style.height = `${tbHeight}px`
2385
+ rowExpandEl.style.top = `${tHeaderHeight}px`
2351
2386
  }
2352
2387
 
2388
+ reactData.tBodyHeight = tbHeight
2389
+
2353
2390
  containerList.forEach((name, index) => {
2354
2391
  const fixedType = index > 0 ? name : ''
2355
2392
  const layoutList = ['header', 'body', 'footer']
@@ -2415,7 +2452,7 @@ export default defineVxeComponent({
2415
2452
  }
2416
2453
 
2417
2454
  if (currScrollElem) {
2418
- currScrollElem.style.height = `${headerHeight}px`
2455
+ currScrollElem.style.height = `${tHeaderHeight}px`
2419
2456
  }
2420
2457
 
2421
2458
  if (tableElem) {
@@ -2424,16 +2461,16 @@ export default defineVxeComponent({
2424
2461
  } else if (layout === 'body') {
2425
2462
  if (currScrollElem) {
2426
2463
  currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : ''
2427
- currScrollElem.style.height = customHeight ? `${bodyHeight}px` : ''
2464
+ currScrollElem.style.height = customHeight ? `${tbHeight}px` : ''
2428
2465
  currScrollElem.style.minHeight = `${bodyMinHeight}px`
2429
2466
  }
2430
2467
 
2431
2468
  // 如果是固定列
2432
2469
  if (fixedWrapperElem) {
2433
2470
  if (wrapperElem) {
2434
- wrapperElem.style.top = `${headerHeight}px`
2471
+ wrapperElem.style.top = `${tHeaderHeight}px`
2435
2472
  }
2436
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`
2473
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + tHeaderHeight + tFooterHeight + osbHeight)}px`
2437
2474
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`
2438
2475
  }
2439
2476
 
@@ -2516,11 +2553,11 @@ export default defineVxeComponent({
2516
2553
  }
2517
2554
 
2518
2555
  if (currScrollElem) {
2519
- currScrollElem.style.height = `${footerHeight}px`
2556
+ currScrollElem.style.height = `${tFooterHeight}px`
2520
2557
  // 如果是固定列
2521
2558
  if (fixedWrapperElem) {
2522
2559
  if (wrapperElem) {
2523
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`
2560
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`
2524
2561
  }
2525
2562
  }
2526
2563
  }
@@ -2536,6 +2573,9 @@ export default defineVxeComponent({
2536
2573
  if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
2537
2574
  $xeTable.addCellSelectedClass()
2538
2575
  }
2576
+ if ($xeGanttView) {
2577
+ $xeGanttView.handleUpdateStyle()
2578
+ }
2539
2579
  return nextTick()
2540
2580
  }
2541
2581
 
@@ -3121,14 +3161,13 @@ export default defineVxeComponent({
3121
3161
  reactData.scrollbarHeight = scrollbarOpts.height || (xHandleEl.offsetHeight - xHandleEl.clientHeight) || 14
3122
3162
  }
3123
3163
 
3124
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
3125
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
3164
+ const hHeight = headerTableElem ? headerTableElem.clientHeight : 0
3165
+ const fHeight = footerTableElem ? footerTableElem.clientHeight : 0
3126
3166
  internalData.tableHeight = bodyWrapperElem.offsetHeight
3127
- internalData.headerHeight = headerHeight
3128
- internalData.footerHeight = footerHeight
3129
-
3167
+ reactData.tHeaderHeight = hHeight
3168
+ reactData.tFooterHeight = fHeight
3130
3169
  reactData.overflowX = overflowX
3131
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
3170
+ reactData.parentHeight = Math.max(hHeight + fHeight + 20, $xeTable.getParentHeight())
3132
3171
  }
3133
3172
  if (overflowX) {
3134
3173
  $xeTable.checkScrolling()
@@ -3183,6 +3222,7 @@ export default defineVxeComponent({
3183
3222
 
3184
3223
  const handleLazyRecalculate = (reFull: boolean, reWidth: boolean, reHeight: boolean) => {
3185
3224
  return new Promise<void>(resolve => {
3225
+ const $xeGanttView = internalData.xeGanttView
3186
3226
  const { rceTimeout, rceRunTime } = internalData
3187
3227
  const resizeOpts = computeResizeOpts.value
3188
3228
  const refreshDelay = resizeOpts.refreshDelay || 20
@@ -3207,6 +3247,9 @@ export default defineVxeComponent({
3207
3247
  handleRecalculateStyle(reFull, reWidth, reHeight)
3208
3248
  )
3209
3249
  }
3250
+ if ($xeGanttView) {
3251
+ $xeGanttView.handleLazyRecalculate()
3252
+ }
3210
3253
  internalData.rceTimeout = setTimeout(() => {
3211
3254
  internalData.rceTimeout = undefined
3212
3255
  handleRecalculateStyle(reFull, reWidth, reHeight)
@@ -4182,6 +4225,18 @@ export default defineVxeComponent({
4182
4225
  requestAnimationFrame(step)
4183
4226
  }
4184
4227
 
4228
+ const syncGanttScrollTop = (scrollTop: number) => {
4229
+ const $xeGanttView = internalData.xeGanttView
4230
+ if ($xeGanttView) {
4231
+ const ganttInternalData = $xeGanttView.internalData
4232
+ const { elemStore: ganttElemStore } = ganttInternalData
4233
+ const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll'])
4234
+ if (ganttBodyScrollElem) {
4235
+ ganttBodyScrollElem.scrollTop = scrollTop
4236
+ }
4237
+ }
4238
+ }
4239
+
4185
4240
  const dispatchEvent = (type: ValueOf<VxeTableEmits>, params: Record<string, any>, evnt: Event | null) => {
4186
4241
  emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeGrid }, params))
4187
4242
  }
@@ -5358,6 +5413,25 @@ export default defineVxeComponent({
5358
5413
  })
5359
5414
  return rest
5360
5415
  },
5416
+ recalcRowHeight (rowOrId) {
5417
+ const { fullAllDataRowIdData } = internalData
5418
+ const rows = XEUtils.isArray(rowOrId) ? rowOrId : [rowOrId]
5419
+ const el = refElem.value
5420
+ if (el) {
5421
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
5422
+ el.setAttribute('data-calc-row', 'Y')
5423
+ rows.forEach(row => {
5424
+ const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : handleGetRowId(row)
5425
+ const rowRest = fullAllDataRowIdData[rowid]
5426
+ if (rowRest) {
5427
+ rowRest.resizeHeight = calcCellAutoHeight(rowRest, el)
5428
+ }
5429
+ el.removeAttribute('data-calc-row')
5430
+ })
5431
+ reactData.calcCellHeightFlag++
5432
+ }
5433
+ return nextTick()
5434
+ },
5361
5435
  setRowHeight (rowOrId, height) {
5362
5436
  const { fullAllDataRowIdData } = internalData
5363
5437
  let status = false
@@ -7046,11 +7120,18 @@ export default defineVxeComponent({
7046
7120
  internalData.isActivated = false
7047
7121
  return nextTick()
7048
7122
  },
7123
+ /**
7124
+ * 已废弃,被 connectToolbar 替换
7125
+ * @deprecated
7126
+ */
7127
+ connect ($toolbar) {
7128
+ return $xeTable.connectToolbar($toolbar)
7129
+ },
7049
7130
  /**
7050
7131
  * 连接工具栏
7051
7132
  * @param $toolbar
7052
7133
  */
7053
- connect ($toolbar) {
7134
+ connectToolbar ($toolbar) {
7054
7135
  if ($toolbar) {
7055
7136
  $xeToolbar = $toolbar
7056
7137
  $xeToolbar.syncUpdate({ collectColumn: internalData.collectColumn, $table: $xeTable })
@@ -7965,6 +8046,7 @@ export default defineVxeComponent({
7965
8046
  handleTableData (force?: boolean) {
7966
8047
  const { scrollYLoad } = reactData
7967
8048
  const { scrollYStore, fullDataRowIdData } = internalData
8049
+ const $xeGanttView = internalData.xeGanttView
7968
8050
  let fullList: any[] = internalData.afterFullData
7969
8051
  // 是否进行数据处理
7970
8052
  if (force) {
@@ -7985,6 +8067,9 @@ export default defineVxeComponent({
7985
8067
  })
7986
8068
  reactData.tableData = tableData
7987
8069
  internalData.visibleDataRowIdData = visibleDataRowIdMaps
8070
+ if ($xeGanttView) {
8071
+ $xeGanttView.updateViewData()
8072
+ }
7988
8073
  return nextTick()
7989
8074
  },
7990
8075
  /**
@@ -8322,6 +8407,7 @@ export default defineVxeComponent({
8322
8407
  evnt.stopPropagation()
8323
8408
  evnt.preventDefault()
8324
8409
  const { row } = params
8410
+ const { showOverflow } = props
8325
8411
  const { overflowX, scrollbarWidth, overflowY, scrollbarHeight } = reactData
8326
8412
  const { elemStore, fullAllDataRowIdData } = internalData
8327
8413
  const osbWidth = overflowY ? scrollbarWidth : 0
@@ -8350,7 +8436,10 @@ export default defineVxeComponent({
8350
8436
  return
8351
8437
  }
8352
8438
  const defaultRowHeight = computeDefaultRowHeight.value
8353
- const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
8439
+ let currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
8440
+ if (!showOverflow) {
8441
+ currCellHeight = tdEl.clientHeight
8442
+ }
8354
8443
  const tableRect = tableEl.getBoundingClientRect()
8355
8444
  const trRect = trEl.getBoundingClientRect()
8356
8445
  const targetOffsetY = dragClientY - trRect.y - trEl.clientHeight
@@ -10506,6 +10595,7 @@ export default defineVxeComponent({
10506
10595
  }
10507
10596
  setScrollTop(yHandleEl, scrollTop)
10508
10597
  setScrollTop(rowExpandEl, scrollTop)
10598
+ syncGanttScrollTop(scrollTop)
10509
10599
  if (scrollYLoad) {
10510
10600
  $xeTable.triggerScrollYEvent(evnt)
10511
10601
  }
@@ -10699,6 +10789,7 @@ export default defineVxeComponent({
10699
10789
  setScrollTop(leftScrollElem, currTopNum)
10700
10790
  setScrollTop(rightScrollElem, currTopNum)
10701
10791
  setScrollTop(rowExpandEl, currTopNum)
10792
+ syncGanttScrollTop(currTopNum)
10702
10793
  if (scrollYLoad) {
10703
10794
  $xeTable.triggerScrollYEvent(evnt)
10704
10795
  }
@@ -10715,6 +10806,7 @@ export default defineVxeComponent({
10715
10806
  setScrollTop(leftScrollElem, currTopNum)
10716
10807
  setScrollTop(rightScrollElem, currTopNum)
10717
10808
  setScrollTop(rowExpandEl, currTopNum)
10809
+ syncGanttScrollTop(currTopNum)
10718
10810
  if (scrollYLoad) {
10719
10811
  $xeTable.triggerScrollYEvent(evnt)
10720
10812
  }
@@ -10789,6 +10881,7 @@ export default defineVxeComponent({
10789
10881
  setScrollTop(leftScrollElem, scrollTop)
10790
10882
  setScrollTop(rightScrollElem, scrollTop)
10791
10883
  setScrollTop(rowExpandEl, scrollTop)
10884
+ syncGanttScrollTop(scrollTop)
10792
10885
  if (scrollYLoad) {
10793
10886
  $xeTable.triggerScrollYEvent(evnt)
10794
10887
  }
@@ -10828,6 +10921,7 @@ export default defineVxeComponent({
10828
10921
  updateScrollXSpace () {
10829
10922
  const { scrollXLoad, overflowX, scrollXWidth } = reactData
10830
10923
  const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData
10924
+ const $xeGanttView = internalData.xeGanttView
10831
10925
  const mouseOpts = computeMouseOpts.value
10832
10926
  const tableBody = refTableBody.value
10833
10927
  const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
@@ -10896,10 +10990,13 @@ export default defineVxeComponent({
10896
10990
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`
10897
10991
  }
10898
10992
 
10993
+ calcScrollbar()
10899
10994
  if (isScrollXBig && mouseOpts.area) {
10900
10995
  errLog('vxe.error.notProp', ['mouse-config.area'])
10901
10996
  }
10902
- calcScrollbar()
10997
+ if ($xeGanttView) {
10998
+ $xeGanttView.updateScrollXSpace()
10999
+ }
10903
11000
  return nextTick().then(() => {
10904
11001
  updateStyle()
10905
11002
  })
@@ -10909,6 +11006,7 @@ export default defineVxeComponent({
10909
11006
  updateScrollYSpace () {
10910
11007
  const { isAllOverflow, overflowY, scrollYLoad, expandColumn } = reactData
10911
11008
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData
11009
+ const $xeGanttView = internalData.xeGanttView
10912
11010
  const { startIndex } = scrollYStore
10913
11011
  const mouseOpts = computeMouseOpts.value
10914
11012
  const expandOpts = computeExpandOpts.value
@@ -11006,10 +11104,13 @@ export default defineVxeComponent({
11006
11104
  reactData.scrollYHeight = scrollYHeight
11007
11105
  reactData.isScrollYBig = isScrollYBig
11008
11106
 
11107
+ calcScrollbar()
11009
11108
  if (isScrollYBig && mouseOpts.area) {
11010
11109
  errLog('vxe.error.notProp', ['mouse-config.area'])
11011
11110
  }
11012
- calcScrollbar()
11111
+ if ($xeGanttView) {
11112
+ $xeGanttView.updateScrollYSpace()
11113
+ }
11013
11114
  return nextTick().then(() => {
11014
11115
  updateStyle()
11015
11116
  })
@@ -11112,6 +11213,13 @@ export default defineVxeComponent({
11112
11213
  return getRowid($xeTable, row1) === getRowid($xeTable, row2)
11113
11214
  }
11114
11215
  return false
11216
+ },
11217
+ handleConnectGanttView ($ganttView) {
11218
+ if ($ganttView && $ganttView.connectUpdate) {
11219
+ $ganttView.connectUpdate({ $table: $xeTable })
11220
+ internalData.xeGanttView = $ganttView as any
11221
+ }
11222
+ return nextTick()
11115
11223
  }
11116
11224
  }
11117
11225
 
@@ -11825,29 +11933,22 @@ export default defineVxeComponent({
11825
11933
  })
11826
11934
  })
11827
11935
 
11828
- const reScrollFlag = ref(0)
11936
+ const reLayoutFlag = ref(0)
11829
11937
  watch(computeSize, () => {
11830
- reScrollFlag.value++
11938
+ reLayoutFlag.value++
11831
11939
  })
11832
11940
  watch(() => props.showHeader, () => {
11833
- reScrollFlag.value++
11941
+ reLayoutFlag.value++
11834
11942
  })
11835
11943
  watch(() => props.showFooter, () => {
11836
- reScrollFlag.value++
11944
+ reLayoutFlag.value++
11837
11945
  })
11838
11946
  watch(() => reactData.overflowX, () => {
11839
- reScrollFlag.value++
11947
+ reLayoutFlag.value++
11840
11948
  })
11841
11949
  watch(() => reactData.overflowY, () => {
11842
- reScrollFlag.value++
11843
- })
11844
- watch(reScrollFlag, () => {
11845
- nextTick(() => {
11846
- tableMethods.recalculate(true).then(() => tableMethods.refreshScroll())
11847
- })
11950
+ reLayoutFlag.value++
11848
11951
  })
11849
-
11850
- const reLayoutFlag = ref(0)
11851
11952
  watch(() => props.height, () => {
11852
11953
  reLayoutFlag.value++
11853
11954
  })
@@ -11864,7 +11965,7 @@ export default defineVxeComponent({
11864
11965
  reLayoutFlag.value++
11865
11966
  })
11866
11967
  watch(reLayoutFlag, () => {
11867
- nextTick(() => tableMethods.recalculate(true))
11968
+ $xeTable.recalculate(true)
11868
11969
  })
11869
11970
 
11870
11971
  const footFlag = ref(0)
@@ -11875,7 +11976,7 @@ export default defineVxeComponent({
11875
11976
  footFlag.value++
11876
11977
  })
11877
11978
  watch(footFlag, () => {
11878
- tableMethods.updateFooter()
11979
+ $xeTable.updateFooter()
11879
11980
  })
11880
11981
 
11881
11982
  watch(() => props.syncResize, (value) => {
@@ -36,10 +36,6 @@ export function createInternalData (): TableInternalData {
36
36
  tableWidth: 0,
37
37
  // 表格高度
38
38
  tableHeight: 0,
39
- // 表头高度
40
- headerHeight: 0,
41
- // 表尾高度
42
- footerHeight: 0,
43
39
  customHeight: 0,
44
40
  customMinHeight: 0,
45
41
  customMaxHeight: 0,
@@ -671,18 +667,9 @@ export function rowToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
671
667
  if (!isCustomCellHeight && showOverflow) {
672
668
  return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight)
673
669
  }
674
- let scrollTop = 0
675
670
  const rowRest = fullAllDataRowIdData[rowid] || {}
676
671
  const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
677
- for (let i = 0; i < afterFullData.length; i++) {
678
- const currRow = afterFullData[i]
679
- const currRowid = getRowid($xeTable, currRow)
680
- if (currRow === row || currRowid === rowid) {
681
- break
682
- }
683
- const currRowRest = fullAllDataRowIdData[currRowid] || {}
684
- scrollTop += currRowRest.resizeHeight || cellOpts.height || rowOpts.height || currRowRest.height || defaultRowHeight
685
- }
672
+ const scrollTop = rowRest.oTop
686
673
  if (scrollTop < bodyScrollTop) {
687
674
  return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1)
688
675
  }
@@ -310,7 +310,7 @@ export default defineVxeComponent({
310
310
  $xeGrid.triggerToolbarBtnEvent(item, $event)
311
311
  } else {
312
312
  const gCommandOpts = commands.get(code)
313
- const params = { code, button: item, $table: $table!, $grid: $xeGrid, $event }
313
+ const params = { code, button: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: null, $event }
314
314
  if (gCommandOpts) {
315
315
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
316
316
  if (tCommandMethod) {
@@ -336,7 +336,7 @@ export default defineVxeComponent({
336
336
  $xeGrid.triggerToolbarTolEvent(item, $event)
337
337
  } else {
338
338
  const gCommandOpts = commands.get(code)
339
- const params = { code, button: null, tool: item, $table: $table!, $grid: $xeGrid, $event }
339
+ const params = { code, button: null, tool: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: null, $event }
340
340
  if (gCommandOpts) {
341
341
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
342
342
  if (tCommandMethod) {
@@ -239,7 +239,15 @@ VxeUI.setConfig({
239
239
  },
240
240
  scrollbarConfig: {
241
241
  // width: 14,
242
- // height: 14
242
+ // height: 14,
243
+ x: {
244
+ // position: 'bottom',
245
+ visible: true
246
+ },
247
+ y: {
248
+ // position: 'right',
249
+ visible: true
250
+ }
243
251
  }
244
252
  },
245
253
  // export: {
@@ -292,7 +300,9 @@ VxeUI.setConfig({
292
300
  // types: ['csv', 'html', 'xml', 'txt']
293
301
  // },
294
302
  // buttons: []
295
- }
303
+ },
304
+
305
+ gantt: {}
296
306
  })
297
307
 
298
308
  const iconPrefix = 'vxe-table-icon-'
@@ -100,7 +100,7 @@ export function getDomNode () {
100
100
  }
101
101
  }
102
102
 
103
- export function getOffsetHeight (elem: HTMLElement) {
103
+ export function getOffsetHeight (elem?: HTMLElement) {
104
104
  return elem ? elem.offsetHeight : 0
105
105
  }
106
106
 
@@ -1,3 +1 @@
1
- /*已废弃*/
2
-
3
1
  @use './base.scss';