vxe-table 4.15.5 → 4.15.7

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 (80) hide show
  1. package/README.md +12 -7
  2. package/es/grid/src/emits.js +16 -0
  3. package/es/grid/src/grid.js +77 -62
  4. package/es/grid/src/props.js +7 -0
  5. package/es/style.css +1 -1
  6. package/es/table/index.js +0 -8
  7. package/es/table/module/custom/hook.js +3 -0
  8. package/es/table/module/edit/hook.js +3 -0
  9. package/es/table/module/export/hook.js +6 -1
  10. package/es/table/module/filter/hook.js +3 -0
  11. package/es/table/module/menu/hook.js +3 -0
  12. package/es/table/module/validator/hook.js +3 -0
  13. package/es/table/src/emits.js +1 -1
  14. package/es/table/src/props.js +1 -1
  15. package/es/table/src/table.js +137 -53
  16. package/es/table/src/util.js +6 -4
  17. package/es/toolbar/src/toolbar.js +2 -2
  18. package/es/ui/index.js +13 -4
  19. package/es/ui/src/log.js +1 -1
  20. package/lib/grid/src/emits.js +8 -0
  21. package/lib/grid/src/emits.min.js +1 -0
  22. package/lib/grid/src/grid.js +78 -54
  23. package/lib/grid/src/grid.min.js +1 -1
  24. package/lib/grid/src/props.js +24 -0
  25. package/lib/grid/src/props.min.js +1 -0
  26. package/lib/index.umd.js +12062 -11985
  27. package/lib/index.umd.min.js +1 -1
  28. package/lib/style.css +1 -1
  29. package/lib/table/index.js +0 -8
  30. package/lib/table/index.min.js +1 -1
  31. package/lib/table/module/custom/hook.js +3 -0
  32. package/lib/table/module/custom/hook.min.js +1 -1
  33. package/lib/table/module/edit/hook.js +3 -0
  34. package/lib/table/module/edit/hook.min.js +1 -1
  35. package/lib/table/module/export/hook.js +8 -1
  36. package/lib/table/module/export/hook.min.js +1 -1
  37. package/lib/table/module/filter/hook.js +3 -0
  38. package/lib/table/module/filter/hook.min.js +1 -1
  39. package/lib/table/module/menu/hook.js +3 -0
  40. package/lib/table/module/menu/hook.min.js +1 -1
  41. package/lib/table/module/validator/hook.js +3 -0
  42. package/lib/table/module/validator/hook.min.js +1 -1
  43. package/lib/table/src/emits.js +2 -2
  44. package/lib/table/src/emits.min.js +1 -1
  45. package/lib/table/src/props.js +2 -2
  46. package/lib/table/src/props.min.js +1 -1
  47. package/lib/table/src/table.js +35 -31
  48. package/lib/table/src/table.min.js +1 -1
  49. package/lib/table/src/util.js +6 -4
  50. package/lib/table/src/util.min.js +1 -1
  51. package/lib/toolbar/src/toolbar.js +2 -0
  52. package/lib/toolbar/src/toolbar.min.js +1 -1
  53. package/lib/ui/index.js +12 -3
  54. package/lib/ui/index.min.js +1 -1
  55. package/lib/ui/src/log.js +1 -1
  56. package/lib/ui/src/log.min.js +1 -1
  57. package/package.json +1 -1
  58. package/packages/grid/src/emits.ts +19 -0
  59. package/packages/grid/src/grid.ts +98 -94
  60. package/packages/grid/src/props.ts +23 -0
  61. package/packages/table/index.ts +0 -8
  62. package/packages/table/module/custom/hook.ts +3 -0
  63. package/packages/table/module/edit/hook.ts +3 -0
  64. package/packages/table/module/export/hook.ts +8 -3
  65. package/packages/table/module/filter/hook.ts +3 -0
  66. package/packages/table/module/menu/hook.ts +3 -0
  67. package/packages/table/module/validator/hook.ts +3 -0
  68. package/packages/table/src/emits.ts +2 -2
  69. package/packages/table/src/props.ts +1 -1
  70. package/packages/table/src/table.ts +144 -55
  71. package/packages/table/src/util.ts +7 -4
  72. package/packages/toolbar/src/toolbar.ts +2 -2
  73. package/packages/ui/index.ts +12 -2
  74. package/packages/ui/src/dom.ts +1 -1
  75. /package/es/{iconfont.1754615009926.ttf → iconfont.1755066378525.ttf} +0 -0
  76. /package/es/{iconfont.1754615009926.woff → iconfont.1755066378525.woff} +0 -0
  77. /package/es/{iconfont.1754615009926.woff2 → iconfont.1755066378525.woff2} +0 -0
  78. /package/lib/{iconfont.1754615009926.ttf → iconfont.1755066378525.ttf} +0 -0
  79. /package/lib/{iconfont.1754615009926.woff → iconfont.1755066378525.woff} +0 -0
  80. /package/lib/{iconfont.1754615009926.woff2 → iconfont.1755066378525.woff2} +0 -0
@@ -315,5 +315,8 @@ VxeUI.hooks.add('tableCustomModule', {
315
315
  },
316
316
  setupGrid($xeGrid) {
317
317
  return $xeGrid.extendTableMethods(tableCustomMethodKeys);
318
+ },
319
+ setupGantt($xeGantt) {
320
+ return $xeGantt.extendTableMethods(tableCustomMethodKeys);
318
321
  }
319
322
  });
@@ -973,5 +973,8 @@ hooks.add('tableEditModule', {
973
973
  },
974
974
  setupGrid($xeGrid) {
975
975
  return $xeGrid.extendTableMethods(tableEditMethodKeys);
976
+ },
977
+ setupGantt($xeGantt) {
978
+ return $xeGantt.extendTableMethods(tableEditMethodKeys);
976
979
  }
977
980
  });
@@ -256,6 +256,7 @@ hooks.add('tableExportModule', {
256
256
  const { props, reactData, internalData } = $xeTable;
257
257
  const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts } = $xeTable.getComputeMaps();
258
258
  const $xeGrid = inject('$xeGrid', null);
259
+ const $xeGantt = inject('$xeGantt', null);
259
260
  const hasTreeChildren = (row) => {
260
261
  const treeOpts = computeTreeOpts.value;
261
262
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -1297,6 +1298,7 @@ hooks.add('tableExportModule', {
1297
1298
  const params = {
1298
1299
  $table: $xeTable,
1299
1300
  $grid: $xeGrid,
1301
+ $gantt: $xeGantt,
1300
1302
  sort: sortData.length ? sortData[0] : {},
1301
1303
  sorts: sortData,
1302
1304
  filters: gridReactData.filterData,
@@ -1306,7 +1308,7 @@ hooks.add('tableExportModule', {
1306
1308
  return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
1307
1309
  .then(rest => {
1308
1310
  const listProp = resConfigs.list;
1309
- handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || [];
1311
+ handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || [];
1310
1312
  if (afterQueryAll) {
1311
1313
  afterQueryAll(params);
1312
1314
  }
@@ -1550,5 +1552,8 @@ hooks.add('tableExportModule', {
1550
1552
  },
1551
1553
  setupGrid($xeGrid) {
1552
1554
  return $xeGrid.extendTableMethods(tableExportMethodKeys);
1555
+ },
1556
+ setupGantt($xeGantt) {
1557
+ return $xeGantt.extendTableMethods(tableExportMethodKeys);
1553
1558
  }
1554
1559
  });
@@ -344,5 +344,8 @@ hooks.add('tableFilterModule', {
344
344
  },
345
345
  setupGrid($xeGrid) {
346
346
  return $xeGrid.extendTableMethods(tableFilterMethodKeys);
347
+ },
348
+ setupGantt($xeGantt) {
349
+ return $xeGantt.extendTableMethods(tableFilterMethodKeys);
347
350
  }
348
351
  });
@@ -298,5 +298,8 @@ hooks.add('tableMenuModule', {
298
298
  },
299
299
  setupGrid($xeGrid) {
300
300
  return $xeGrid.extendTableMethods(tableMenuMethodKeys);
301
+ },
302
+ setupGantt($xeGantt) {
303
+ return $xeGantt.extendTableMethods(tableMenuMethodKeys);
301
304
  }
302
305
  });
@@ -595,5 +595,8 @@ hooks.add('tableValidatorModule', {
595
595
  },
596
596
  setupGrid($xeGrid) {
597
597
  return $xeGrid.extendTableMethods(tableValidatorMethodKeys);
598
+ },
599
+ setupGantt($xeGantt) {
600
+ return $xeGantt.extendTableMethods(tableValidatorMethodKeys);
598
601
  }
599
602
  });
@@ -1,4 +1,4 @@
1
- export default [
1
+ export const tableEmits = [
2
2
  'update:data',
3
3
  'keydown-start',
4
4
  'keydown',
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '../../ui';
2
2
  const { getConfig } = VxeUI;
3
- export default {
3
+ export const tableProps = {
4
4
  /** 基本属性 */
5
5
  id: [String, Function],
6
6
  // 数据
@@ -12,13 +12,21 @@ 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
+ import '../module/filter/hook';
23
+ import '../module/menu/hook';
24
+ import '../module/edit/hook';
25
+ import '../module/export/hook';
26
+ import '../module/keyboard/hook';
27
+ import '../module/validator/hook';
28
+ import '../module/custom/hook';
29
+ import '../render';
22
30
  const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
23
31
  const supportMaxRow = 5e6;
24
32
  const customStorageKey = 'VXE_CUSTOM_STORE';
@@ -83,6 +91,8 @@ export default defineVxeComponent({
83
91
  rowGroupColumn: null,
84
92
  // 展开列信息
85
93
  expandColumn: null,
94
+ checkboxColumn: null,
95
+ radioColumn: null,
86
96
  // 树节点列信息
87
97
  treeNodeColumn: null,
88
98
  hasFixedColumn: false,
@@ -319,6 +329,7 @@ export default defineVxeComponent({
319
329
  const refScrollXSpaceElem = ref();
320
330
  const refScrollYSpaceElem = ref();
321
331
  const $xeGrid = inject('$xeGrid', null);
332
+ const $xeGantt = inject('$xeGantt', null);
322
333
  let $xeToolbar;
323
334
  const computeTableId = computed(() => {
324
335
  const { id } = props;
@@ -797,6 +808,8 @@ export default defineVxeComponent({
797
808
  getRefMaps: () => refMaps,
798
809
  getComputeMaps: () => computeMaps,
799
810
  xeGrid: $xeGrid,
811
+ xeGantt: $xeGantt,
812
+ // 已废弃
800
813
  xegrid: $xeGrid
801
814
  };
802
815
  const eqCellValue = (row1, row2, field) => {
@@ -1576,6 +1589,8 @@ export default defineVxeComponent({
1576
1589
  reactData.rowGroupColumn = rowGroupColumn;
1577
1590
  reactData.treeNodeColumn = treeNodeColumn;
1578
1591
  reactData.expandColumn = expandColumn;
1592
+ reactData.checkboxColumn = checkboxColumn;
1593
+ reactData.radioColumn = radioColumn;
1579
1594
  reactData.isAllOverflow = isAllOverflow;
1580
1595
  };
1581
1596
  const updateHeight = () => {
@@ -2141,50 +2156,67 @@ export default defineVxeComponent({
2141
2156
  const updateStyle = () => {
2142
2157
  const { showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
2143
2158
  const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn, isColLoading } = reactData;
2144
- const { visibleColumn, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
2159
+ const { visibleColumn, tableHeight, elemStore, customHeight, customMinHeight, customMaxHeight, tHeaderHeight, tFooterHeight } = internalData;
2160
+ const $xeGanttView = internalData.xeGanttView;
2145
2161
  const el = refElem.value;
2146
- if (!el) {
2162
+ if (!el || !el.clientHeight) {
2147
2163
  return;
2148
2164
  }
2149
2165
  const containerList = ['main', 'left', 'right'];
2150
- const osbWidth = overflowY ? scrollbarWidth : 0;
2151
- const osbHeight = overflowX ? scrollbarHeight : 0;
2166
+ let osbWidth = overflowY ? scrollbarWidth : 0;
2167
+ let osbHeight = overflowX ? scrollbarHeight : 0;
2152
2168
  const emptyPlaceholderElem = refEmptyPlaceholder.value;
2169
+ const scrollbarOpts = computeScrollbarOpts.value;
2153
2170
  const mouseOpts = computeMouseOpts.value;
2154
2171
  const expandOpts = computeExpandOpts.value;
2155
2172
  const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
2156
2173
  const bodyTableElem = getRefElem(elemStore['main-body-table']);
2157
2174
  if (emptyPlaceholderElem) {
2158
- emptyPlaceholderElem.style.top = `${headerHeight}px`;
2175
+ emptyPlaceholderElem.style.top = `${tHeaderHeight}px`;
2159
2176
  emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
2160
2177
  }
2161
- let bodyHeight = 0;
2178
+ const scrollbarXToTop = computeScrollbarXToTop.value;
2179
+ const scrollbarYToLeft = computeScrollbarYToLeft.value;
2180
+ let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
2181
+ if ($xeGanttView) {
2182
+ osbHeight = scrollbarHeight;
2183
+ xScrollbarVisible = 'visible';
2184
+ }
2185
+ else if (scrollbarOpts.x && scrollbarOpts.x.visible === false) {
2186
+ osbHeight = 0;
2187
+ xScrollbarVisible = 'hidden';
2188
+ }
2189
+ let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
2190
+ if ((scrollbarOpts.y && scrollbarOpts.y.visible === false) || ($xeGanttView && !scrollbarYToLeft)) {
2191
+ osbWidth = 0;
2192
+ yScrollbarVisible = 'hidden';
2193
+ }
2194
+ let tbHeight = 0;
2162
2195
  let bodyMaxHeight = 0;
2163
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight;
2196
+ const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight;
2164
2197
  if (customMaxHeight) {
2165
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight);
2198
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight);
2166
2199
  }
2167
2200
  if (customHeight) {
2168
- bodyHeight = customHeight - headerHeight - footerHeight - osbHeight;
2201
+ tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight;
2169
2202
  }
2170
- if (!bodyHeight) {
2203
+ if (!tbHeight) {
2171
2204
  if (bodyTableElem) {
2172
- bodyHeight = bodyTableElem.clientHeight;
2205
+ tbHeight = bodyTableElem.clientHeight;
2173
2206
  }
2174
2207
  }
2175
- if (bodyHeight) {
2208
+ if (tbHeight) {
2176
2209
  if (bodyMaxHeight) {
2177
- bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
2210
+ tbHeight = Math.min(bodyMaxHeight, tbHeight);
2178
2211
  }
2179
- bodyHeight = Math.max(bodyMinHeight, bodyHeight);
2212
+ tbHeight = Math.max(bodyMinHeight, tbHeight);
2180
2213
  }
2181
- const scrollbarXToTop = computeScrollbarXToTop.value;
2182
2214
  const xLeftCornerEl = refScrollXLeftCornerElem.value;
2183
2215
  const xRightCornerEl = refScrollXRightCornerElem.value;
2184
2216
  const scrollXVirtualEl = refScrollXVirtualElem.value;
2185
2217
  if (scrollXVirtualEl) {
2186
2218
  scrollXVirtualEl.style.height = `${osbHeight}px`;
2187
- scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden';
2219
+ scrollXVirtualEl.style.visibility = xScrollbarVisible;
2188
2220
  }
2189
2221
  const xWrapperEl = refScrollXWrapperElem.value;
2190
2222
  if (xWrapperEl) {
@@ -2202,30 +2234,31 @@ export default defineVxeComponent({
2202
2234
  const scrollYVirtualEl = refScrollYVirtualElem.value;
2203
2235
  if (scrollYVirtualEl) {
2204
2236
  scrollYVirtualEl.style.width = `${osbWidth}px`;
2205
- scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`;
2206
- scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden';
2237
+ scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`;
2238
+ scrollYVirtualEl.style.visibility = yScrollbarVisible;
2207
2239
  }
2208
2240
  const yTopCornerEl = refScrollYTopCornerElem.value;
2209
2241
  if (yTopCornerEl) {
2210
- yTopCornerEl.style.height = `${headerHeight}px`;
2211
- yTopCornerEl.style.display = overflowY && headerHeight ? 'block' : '';
2242
+ yTopCornerEl.style.height = `${tHeaderHeight}px`;
2243
+ yTopCornerEl.style.display = overflowY && tHeaderHeight ? 'block' : '';
2212
2244
  }
2213
2245
  const yWrapperEl = refScrollYWrapperElem.value;
2214
2246
  if (yWrapperEl) {
2215
- yWrapperEl.style.height = `${bodyHeight}px`;
2216
- yWrapperEl.style.top = `${headerHeight}px`;
2247
+ yWrapperEl.style.height = `${tbHeight}px`;
2248
+ yWrapperEl.style.top = `${tHeaderHeight}px`;
2217
2249
  }
2218
2250
  const yBottomCornerEl = refScrollYBottomCornerElem.value;
2219
2251
  if (yBottomCornerEl) {
2220
- yBottomCornerEl.style.height = `${footerHeight}px`;
2221
- yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`;
2222
- yBottomCornerEl.style.display = overflowY && footerHeight ? 'block' : '';
2252
+ yBottomCornerEl.style.height = `${tFooterHeight}px`;
2253
+ yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`;
2254
+ yBottomCornerEl.style.display = overflowY && tFooterHeight ? 'block' : '';
2223
2255
  }
2224
2256
  const rowExpandEl = refRowExpandElem.value;
2225
2257
  if (rowExpandEl) {
2226
- rowExpandEl.style.height = `${bodyHeight}px`;
2227
- rowExpandEl.style.top = `${headerHeight}px`;
2258
+ rowExpandEl.style.height = `${tbHeight}px`;
2259
+ rowExpandEl.style.top = `${tHeaderHeight}px`;
2228
2260
  }
2261
+ internalData.tBodyHeight = tbHeight;
2229
2262
  containerList.forEach((name, index) => {
2230
2263
  const fixedType = index > 0 ? name : '';
2231
2264
  const layoutList = ['header', 'body', 'footer'];
@@ -2289,7 +2322,7 @@ export default defineVxeComponent({
2289
2322
  }
2290
2323
  }
2291
2324
  if (currScrollElem) {
2292
- currScrollElem.style.height = `${headerHeight}px`;
2325
+ currScrollElem.style.height = `${tHeaderHeight}px`;
2293
2326
  }
2294
2327
  if (tableElem) {
2295
2328
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
@@ -2298,15 +2331,15 @@ export default defineVxeComponent({
2298
2331
  else if (layout === 'body') {
2299
2332
  if (currScrollElem) {
2300
2333
  currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
2301
- currScrollElem.style.height = customHeight ? `${bodyHeight}px` : '';
2334
+ currScrollElem.style.height = customHeight ? `${tbHeight}px` : '';
2302
2335
  currScrollElem.style.minHeight = `${bodyMinHeight}px`;
2303
2336
  }
2304
2337
  // 如果是固定列
2305
2338
  if (fixedWrapperElem) {
2306
2339
  if (wrapperElem) {
2307
- wrapperElem.style.top = `${headerHeight}px`;
2340
+ wrapperElem.style.top = `${tHeaderHeight}px`;
2308
2341
  }
2309
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`;
2342
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + tHeaderHeight + tFooterHeight + osbHeight)}px`;
2310
2343
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`;
2311
2344
  }
2312
2345
  let renderColumnList = tableColumn;
@@ -2383,11 +2416,11 @@ export default defineVxeComponent({
2383
2416
  }
2384
2417
  }
2385
2418
  if (currScrollElem) {
2386
- currScrollElem.style.height = `${footerHeight}px`;
2419
+ currScrollElem.style.height = `${tFooterHeight}px`;
2387
2420
  // 如果是固定列
2388
2421
  if (fixedWrapperElem) {
2389
2422
  if (wrapperElem) {
2390
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`;
2423
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`;
2391
2424
  }
2392
2425
  }
2393
2426
  }
@@ -2403,6 +2436,9 @@ export default defineVxeComponent({
2403
2436
  if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
2404
2437
  $xeTable.addCellSelectedClass();
2405
2438
  }
2439
+ if ($xeGanttView) {
2440
+ $xeGanttView.handleUpdateStyle();
2441
+ }
2406
2442
  return nextTick();
2407
2443
  };
2408
2444
  const checkValidate = (type) => {
@@ -2978,13 +3014,13 @@ export default defineVxeComponent({
2978
3014
  if (xHandleEl) {
2979
3015
  reactData.scrollbarHeight = scrollbarOpts.height || (xHandleEl.offsetHeight - xHandleEl.clientHeight) || 14;
2980
3016
  }
2981
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
2982
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
3017
+ const hHeight = headerTableElem ? headerTableElem.clientHeight : 0;
3018
+ const fHeight = footerTableElem ? footerTableElem.clientHeight : 0;
2983
3019
  internalData.tableHeight = bodyWrapperElem.offsetHeight;
2984
- internalData.headerHeight = headerHeight;
2985
- internalData.footerHeight = footerHeight;
3020
+ internalData.tHeaderHeight = hHeight;
3021
+ internalData.tFooterHeight = fHeight;
2986
3022
  reactData.overflowX = overflowX;
2987
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
3023
+ reactData.parentHeight = Math.max(hHeight + fHeight + 20, $xeTable.getParentHeight());
2988
3024
  }
2989
3025
  if (overflowX) {
2990
3026
  $xeTable.checkScrolling();
@@ -3037,6 +3073,7 @@ export default defineVxeComponent({
3037
3073
  };
3038
3074
  const handleLazyRecalculate = (reFull, reWidth, reHeight) => {
3039
3075
  return new Promise(resolve => {
3076
+ const $xeGanttView = internalData.xeGanttView;
3040
3077
  const { rceTimeout, rceRunTime } = internalData;
3041
3078
  const resizeOpts = computeResizeOpts.value;
3042
3079
  const refreshDelay = resizeOpts.refreshDelay || 20;
@@ -3059,12 +3096,18 @@ export default defineVxeComponent({
3059
3096
  else {
3060
3097
  resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
3061
3098
  }
3099
+ if ($xeGanttView) {
3100
+ $xeGanttView.handleLazyRecalculate();
3101
+ }
3062
3102
  internalData.rceTimeout = setTimeout(() => {
3063
3103
  internalData.rceTimeout = undefined;
3064
3104
  handleRecalculateStyle(reFull, reWidth, reHeight);
3065
3105
  }, refreshDelay);
3066
3106
  });
3067
3107
  };
3108
+ const handleResizeEvent = () => {
3109
+ handleLazyRecalculate(true, true, true);
3110
+ };
3068
3111
  const handleUpdateAggValues = () => {
3069
3112
  const { visibleColumn } = internalData;
3070
3113
  const aggCols = [];
@@ -3931,13 +3974,13 @@ export default defineVxeComponent({
3931
3974
  }, fpsTime);
3932
3975
  };
3933
3976
  const checkLastSyncScroll = (isRollX, isRollY) => {
3934
- const { scrollXLoad, scrollYLoad, isAllOverflow } = reactData;
3935
3977
  const { lcsTimeout } = internalData;
3936
3978
  reactData.lazScrollLoading = true;
3937
3979
  if (lcsTimeout) {
3938
3980
  clearTimeout(lcsTimeout);
3939
3981
  }
3940
3982
  internalData.lcsTimeout = setTimeout(() => {
3983
+ const { scrollXLoad, scrollYLoad, isAllOverflow } = reactData;
3941
3984
  internalData.lcsRunTime = Date.now();
3942
3985
  internalData.lcsTimeout = undefined;
3943
3986
  internalData.intoRunScroll = false;
@@ -4015,6 +4058,17 @@ export default defineVxeComponent({
4015
4058
  };
4016
4059
  requestAnimationFrame(step);
4017
4060
  };
4061
+ const syncGanttScrollTop = (scrollTop) => {
4062
+ const $xeGanttView = internalData.xeGanttView;
4063
+ if ($xeGanttView) {
4064
+ const ganttInternalData = $xeGanttView.internalData;
4065
+ const { elemStore: ganttElemStore } = ganttInternalData;
4066
+ const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll']);
4067
+ if (ganttBodyScrollElem) {
4068
+ ganttBodyScrollElem.scrollTop = scrollTop;
4069
+ }
4070
+ }
4071
+ };
4018
4072
  const dispatchEvent = (type, params, evnt) => {
4019
4073
  emit(type, createEvent(evnt, { $table: $xeTable, $grid: $xeGrid }, params));
4020
4074
  };
@@ -6907,11 +6961,18 @@ export default defineVxeComponent({
6907
6961
  internalData.isActivated = false;
6908
6962
  return nextTick();
6909
6963
  },
6964
+ /**
6965
+ * 已废弃,被 connectToolbar 替换
6966
+ * @deprecated
6967
+ */
6968
+ connect($toolbar) {
6969
+ return $xeTable.connectToolbar($toolbar);
6970
+ },
6910
6971
  /**
6911
6972
  * 连接工具栏
6912
6973
  * @param $toolbar
6913
6974
  */
6914
- connect($toolbar) {
6975
+ connectToolbar($toolbar) {
6915
6976
  if ($toolbar) {
6916
6977
  $xeToolbar = $toolbar;
6917
6978
  $xeToolbar.syncUpdate({ collectColumn: internalData.collectColumn, $table: $xeTable });
@@ -7491,7 +7552,7 @@ export default defineVxeComponent({
7491
7552
  if (!el || !el.clientWidth) {
7492
7553
  return;
7493
7554
  }
7494
- handleLazyRecalculate(true, true, true);
7555
+ handleResizeEvent();
7495
7556
  $xeTable.updateCellAreas();
7496
7557
  };
7497
7558
  const handleTargetEnterEvent = (isClear) => {
@@ -7843,6 +7904,7 @@ export default defineVxeComponent({
7843
7904
  handleTableData(force) {
7844
7905
  const { scrollYLoad } = reactData;
7845
7906
  const { scrollYStore, fullDataRowIdData } = internalData;
7907
+ const $xeGanttView = internalData.xeGanttView;
7846
7908
  let fullList = internalData.afterFullData;
7847
7909
  // 是否进行数据处理
7848
7910
  if (force) {
@@ -7863,6 +7925,9 @@ export default defineVxeComponent({
7863
7925
  });
7864
7926
  reactData.tableData = tableData;
7865
7927
  internalData.visibleDataRowIdData = visibleDataRowIdMaps;
7928
+ if ($xeGanttView) {
7929
+ $xeGanttView.updateViewData();
7930
+ }
7866
7931
  return nextTick();
7867
7932
  },
7868
7933
  /**
@@ -8940,8 +9005,8 @@ export default defineVxeComponent({
8940
9005
  * 如果是双击模式,则单击后选中状态
8941
9006
  */
8942
9007
  triggerCellClickEvent(evnt, params) {
8943
- const { highlightCurrentRow, highlightCurrentColumn, editConfig } = props;
8944
- const { editStore, isDragResize } = reactData;
9008
+ const { treeConfig, highlightCurrentRow, highlightCurrentColumn, editConfig, aggregateConfig, rowGroupConfig } = props;
9009
+ const { editStore, isDragResize, expandColumn, checkboxColumn, radioColumn } = reactData;
8945
9010
  if (isDragResize) {
8946
9011
  return;
8947
9012
  }
@@ -8970,15 +9035,15 @@ export default defineVxeComponent({
8970
9035
  params = Object.assign({ cell, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode }, params);
8971
9036
  if (!triggerCheckbox && !triggerRadio) {
8972
9037
  // 如果是展开行
8973
- if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
9038
+ if (!triggerExpandNode && ((expandColumn && expandOpts.trigger === 'row') || (isExpandType && expandOpts.trigger === 'cell'))) {
8974
9039
  $xeTable.triggerRowExpandEvent(evnt, params);
8975
9040
  }
8976
9041
  // 如果是树形表格
8977
- if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
9042
+ if (treeConfig && (treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
8978
9043
  $xeTable.triggerTreeExpandEvent(evnt, params);
8979
9044
  }
8980
9045
  // 如果是行分组
8981
- if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
9046
+ if ((aggregateConfig || rowGroupConfig) && (aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
8982
9047
  $xeTable.triggerRowGroupExpandEvent(evnt, params);
8983
9048
  }
8984
9049
  }
@@ -8998,11 +9063,11 @@ export default defineVxeComponent({
8998
9063
  }
8999
9064
  }
9000
9065
  // 如果是单选框
9001
- if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
9066
+ if (!triggerRadio && ((radioColumn && radioOpts.trigger === 'row') || (isRadioType && radioOpts.trigger === 'cell'))) {
9002
9067
  $xeTable.triggerRadioRowEvent(evnt, params);
9003
9068
  }
9004
9069
  // 如果是复选框
9005
- if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
9070
+ if (!triggerCheckbox && ((checkboxColumn && checkboxOpts.trigger === 'row') || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
9006
9071
  $xeTable.handleToggleCheckRowEvent(evnt, params);
9007
9072
  }
9008
9073
  }
@@ -10379,6 +10444,7 @@ export default defineVxeComponent({
10379
10444
  }
10380
10445
  setScrollTop(yHandleEl, scrollTop);
10381
10446
  setScrollTop(rowExpandEl, scrollTop);
10447
+ syncGanttScrollTop(scrollTop);
10382
10448
  if (scrollYLoad) {
10383
10449
  $xeTable.triggerScrollYEvent(evnt);
10384
10450
  }
@@ -10567,6 +10633,7 @@ export default defineVxeComponent({
10567
10633
  setScrollTop(leftScrollElem, currTopNum);
10568
10634
  setScrollTop(rightScrollElem, currTopNum);
10569
10635
  setScrollTop(rowExpandEl, currTopNum);
10636
+ syncGanttScrollTop(currTopNum);
10570
10637
  if (scrollYLoad) {
10571
10638
  $xeTable.triggerScrollYEvent(evnt);
10572
10639
  }
@@ -10584,6 +10651,7 @@ export default defineVxeComponent({
10584
10651
  setScrollTop(leftScrollElem, currTopNum);
10585
10652
  setScrollTop(rightScrollElem, currTopNum);
10586
10653
  setScrollTop(rowExpandEl, currTopNum);
10654
+ syncGanttScrollTop(currTopNum);
10587
10655
  if (scrollYLoad) {
10588
10656
  $xeTable.triggerScrollYEvent(evnt);
10589
10657
  }
@@ -10657,6 +10725,7 @@ export default defineVxeComponent({
10657
10725
  setScrollTop(leftScrollElem, scrollTop);
10658
10726
  setScrollTop(rightScrollElem, scrollTop);
10659
10727
  setScrollTop(rowExpandEl, scrollTop);
10728
+ syncGanttScrollTop(scrollTop);
10660
10729
  if (scrollYLoad) {
10661
10730
  $xeTable.triggerScrollYEvent(evnt);
10662
10731
  }
@@ -10696,6 +10765,7 @@ export default defineVxeComponent({
10696
10765
  updateScrollXSpace() {
10697
10766
  const { scrollXLoad, overflowX, scrollXWidth } = reactData;
10698
10767
  const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData;
10768
+ const $xeGanttView = internalData.xeGanttView;
10699
10769
  const mouseOpts = computeMouseOpts.value;
10700
10770
  const tableBody = refTableBody.value;
10701
10771
  const tableBodyElem = tableBody ? tableBody.$el : null;
@@ -10757,10 +10827,13 @@ export default defineVxeComponent({
10757
10827
  if (scrollXSpaceEl) {
10758
10828
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
10759
10829
  }
10830
+ calcScrollbar();
10760
10831
  if (isScrollXBig && mouseOpts.area) {
10761
10832
  errLog('vxe.error.notProp', ['mouse-config.area']);
10762
10833
  }
10763
- calcScrollbar();
10834
+ if ($xeGanttView) {
10835
+ $xeGanttView.updateScrollXSpace();
10836
+ }
10764
10837
  return nextTick().then(() => {
10765
10838
  updateStyle();
10766
10839
  });
@@ -10770,6 +10843,7 @@ export default defineVxeComponent({
10770
10843
  updateScrollYSpace() {
10771
10844
  const { isAllOverflow, overflowY, scrollYLoad, expandColumn } = reactData;
10772
10845
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData;
10846
+ const $xeGanttView = internalData.xeGanttView;
10773
10847
  const { startIndex } = scrollYStore;
10774
10848
  const mouseOpts = computeMouseOpts.value;
10775
10849
  const expandOpts = computeExpandOpts.value;
@@ -10865,10 +10939,13 @@ export default defineVxeComponent({
10865
10939
  reactData.scrollYTop = scrollYTop;
10866
10940
  reactData.scrollYHeight = scrollYHeight;
10867
10941
  reactData.isScrollYBig = isScrollYBig;
10942
+ calcScrollbar();
10868
10943
  if (isScrollYBig && mouseOpts.area) {
10869
10944
  errLog('vxe.error.notProp', ['mouse-config.area']);
10870
10945
  }
10871
- calcScrollbar();
10946
+ if ($xeGanttView) {
10947
+ $xeGanttView.updateScrollYSpace();
10948
+ }
10872
10949
  return nextTick().then(() => {
10873
10950
  updateStyle();
10874
10951
  });
@@ -10974,6 +11051,13 @@ export default defineVxeComponent({
10974
11051
  return getRowid($xeTable, row1) === getRowid($xeTable, row2);
10975
11052
  }
10976
11053
  return false;
11054
+ },
11055
+ handleConnectGanttView($ganttView) {
11056
+ if ($ganttView && $ganttView.connectUpdate) {
11057
+ $ganttView.connectUpdate({ $table: $xeTable });
11058
+ internalData.xeGanttView = $ganttView;
11059
+ }
11060
+ return nextTick();
10977
11061
  }
10978
11062
  };
10979
11063
  // 检测对应模块是否安装
@@ -11998,7 +12082,7 @@ export default defineVxeComponent({
11998
12082
  const parentEl = tablePrivateMethods.getParentElem();
11999
12083
  resizeObserver = globalResize.create(() => {
12000
12084
  if (props.autoResize) {
12001
- tableMethods.recalculate(true);
12085
+ handleResizeEvent();
12002
12086
  }
12003
12087
  });
12004
12088
  if (el) {
@@ -33,10 +33,6 @@ export function createInternalData() {
33
33
  tableWidth: 0,
34
34
  // 表格高度
35
35
  tableHeight: 0,
36
- // 表头高度
37
- headerHeight: 0,
38
- // 表尾高度
39
- footerHeight: 0,
40
36
  customHeight: 0,
41
37
  customMinHeight: 0,
42
38
  customMaxHeight: 0,
@@ -113,6 +109,12 @@ export function createInternalData() {
113
109
  // 已删除行
114
110
  removeRowMaps: {},
115
111
  cvCacheMaps: {},
112
+ // 表头高度
113
+ tHeaderHeight: 0,
114
+ // 表体高度
115
+ tBodyHeight: 0,
116
+ // 表尾高度
117
+ tFooterHeight: 0,
116
118
  inited: false,
117
119
  tooltipTimeout: null,
118
120
  initStatus: false,
@@ -276,7 +276,7 @@ export default defineVxeComponent({
276
276
  }
277
277
  else {
278
278
  const gCommandOpts = commands.get(code);
279
- const params = { code, button: item, $table: $table, $grid: $xeGrid, $event };
279
+ const params = { code, button: item, $table: $table, $grid: $xeGrid, $gantt: null, $event };
280
280
  if (gCommandOpts) {
281
281
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
282
282
  if (tCommandMethod) {
@@ -303,7 +303,7 @@ export default defineVxeComponent({
303
303
  }
304
304
  else {
305
305
  const gCommandOpts = commands.get(code);
306
- const params = { code, button: null, tool: item, $table: $table, $grid: $xeGrid, $event };
306
+ const params = { code, button: null, tool: item, $table: $table, $grid: $xeGrid, $gantt: null, $event };
307
307
  if (gCommandOpts) {
308
308
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
309
309
  if (tCommandMethod) {