vxe-table 3.17.7 → 3.17.8

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 (47) hide show
  1. package/es/grid/src/grid.js +47 -29
  2. package/es/style.css +1 -1
  3. package/es/table/module/export/mixin.js +3 -1
  4. package/es/table/src/methods.js +109 -42
  5. package/es/table/src/props.js +1 -1
  6. package/es/table/src/table.js +7 -1
  7. package/es/table/src/util.js +0 -4
  8. package/es/toolbar/src/toolbar.js +2 -2
  9. package/es/ui/index.js +13 -4
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/grid/src/grid.js +49 -26
  12. package/lib/grid/src/grid.min.js +1 -1
  13. package/lib/index.umd.js +13411 -13299
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/table/module/export/mixin.js +5 -1
  17. package/lib/table/module/export/mixin.min.js +1 -1
  18. package/lib/table/src/methods.js +114 -43
  19. package/lib/table/src/methods.min.js +1 -1
  20. package/lib/table/src/props.js +2 -2
  21. package/lib/table/src/props.min.js +1 -1
  22. package/lib/table/src/table.js +8 -2
  23. package/lib/table/src/table.min.js +1 -1
  24. package/lib/table/src/util.js +0 -4
  25. package/lib/table/src/util.min.js +1 -1
  26. package/lib/toolbar/src/toolbar.js +2 -0
  27. package/lib/toolbar/src/toolbar.min.js +1 -1
  28. package/lib/ui/index.js +12 -3
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +1 -1
  33. package/packages/grid/src/grid.ts +49 -30
  34. package/packages/table/module/export/mixin.ts +5 -3
  35. package/packages/table/src/methods.ts +118 -46
  36. package/packages/table/src/props.ts +1 -1
  37. package/packages/table/src/table.ts +7 -1
  38. package/packages/table/src/util.ts +0 -4
  39. package/packages/toolbar/src/toolbar.ts +2 -2
  40. package/packages/ui/index.ts +12 -2
  41. package/packages/ui/src/dom.ts +1 -1
  42. /package/es/{iconfont.1754614978390.ttf → iconfont.1754905462391.ttf} +0 -0
  43. /package/es/{iconfont.1754614978390.woff → iconfont.1754905462391.woff} +0 -0
  44. /package/es/{iconfont.1754614978390.woff2 → iconfont.1754905462391.woff2} +0 -0
  45. /package/lib/{iconfont.1754614978390.ttf → iconfont.1754905462391.ttf} +0 -0
  46. /package/lib/{iconfont.1754614978390.woff → iconfont.1754905462391.woff} +0 -0
  47. /package/lib/{iconfont.1754614978390.woff2 → iconfont.1754905462391.woff2} +0 -0
@@ -4,19 +4,19 @@ import XEUtils from 'xe-utils'
4
4
  import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
5
5
  import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit } from '../../ui/src/dom'
6
6
  import { VxeUI } from '../../ui'
7
- import VxeTableComponent from '../../table/src/table'
8
- import VxeToolbarComponent from '../../toolbar/src/toolbar'
9
- import tableComponentProps from '../../table/src/props'
10
7
  import { getSlotVNs } from '../../ui/src/vn'
11
8
  import { warnLog, errLog } from '../../ui/src/log'
9
+ import { tableProps } from '../../table/src/props'
10
+ import VxeTableComponent from '../../table/src/table'
11
+ import VxeToolbarComponent from '../../toolbar/src/toolbar'
12
12
 
13
13
  import type { VxeFormItemProps, VxeFormDefines, VxeComponentStyleType, VxeComponentSizeType, ValueOf, VxeFormInstance, VxeFormItemPropTypes, VxePagerInstance } from 'vxe-pc-ui'
14
- import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, GridInternalData, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData } from '../../../types'
14
+ import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, GridInternalData, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData, VxeTableProps } from '../../../types'
15
15
 
16
16
  const { getConfig, getI18n, commands, globalEvents, globalMixins, createEvent, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
17
17
 
18
18
  const tableMethods: VxeTableMethods = {} as VxeTableMethods
19
- const propKeys = Object.keys(tableComponentProps)
19
+ const propKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
20
20
 
21
21
  const defaultLayouts: VxeGridPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']]
22
22
 
@@ -42,7 +42,7 @@ function getTableOns (_vm: any) {
42
42
  }
43
43
 
44
44
  XEUtils.each(VxeTableComponent.methods, (fn, name) => {
45
- (tableMethods as any)[name] = function (...args: any[]) {
45
+ tableMethods[name as keyof VxeTableMethods] = function (this: any, ...args: any[]) {
46
46
  const $xeGrid = this
47
47
  const $xeTable = $xeGrid.$refs.refTable
48
48
 
@@ -52,7 +52,6 @@ XEUtils.each(VxeTableComponent.methods, (fn, name) => {
52
52
 
53
53
  function createInternalData (): GridInternalData {
54
54
  return {
55
- connectTable: null
56
55
  }
57
56
  }
58
57
 
@@ -75,11 +74,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
75
74
  validConfig: Object as PropType<VxeTablePropTypes.ValidConfig>,
76
75
  editRules: Object as PropType<VxeTablePropTypes.EditRules>,
77
76
  animat: { type: Boolean, default: () => getConfig().table.animat },
78
-
79
- // eslint-disable-next-line @typescript-eslint/ban-types
80
- ...(tableComponentProps as {}),
81
77
  // 以上仅用于类型
82
78
 
79
+ // eslint-disable-next-line @typescript-eslint/ban-types
80
+ ...(tableProps as {}),
83
81
  layouts: Array as PropType<VxeGridPropTypes.Layouts>,
84
82
  columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
85
83
  pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
@@ -385,7 +383,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
385
383
  ...tableMethods,
386
384
  dispatchEvent (type: ValueOf<VxeGridEmits>, params: Record<string, any>, evnt: Event | null) {
387
385
  const $xeGrid = this
388
- $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid }, params))
386
+ $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid, $gantt: null }, params))
389
387
  },
390
388
  initPages (propKey?: 'currentPage' | 'pageSize' | 'total') {
391
389
  const $xeGrid = this
@@ -472,7 +470,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
472
470
  const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
473
471
  const $xeToolbar = $xeGrid.$refs.refToolbar as VxeToolbarInstance
474
472
  if ($xeTable && $xeToolbar) {
475
- $xeTable.connect($xeToolbar)
473
+ $xeTable.connectToolbar($xeToolbar)
476
474
  }
477
475
  })
478
476
  },
@@ -538,9 +536,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
538
536
  const proxyOpts = $xeGrid.computeProxyOpts
539
537
  const resConfigs = proxyOpts.response || proxyOpts.props || {}
540
538
  const messageProp = resConfigs.message
539
+ const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
541
540
  let msg
542
541
  if (rest && messageProp) {
543
- msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, messageProp)
542
+ msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, messageProp)
544
543
  }
545
544
  return msg || getI18n(defaultMsg)
546
545
  },
@@ -727,11 +726,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
727
726
  }
728
727
  }
729
728
  const commitParams = {
729
+ $table: $xeTable,
730
+ $grid: $xeGrid as VxeGridConstructor,
731
+ $gantt: null,
730
732
  code,
731
733
  button,
732
734
  isInited,
733
735
  isReload,
734
- $grid: $xeGrid as unknown as VxeGridConstructor,
735
736
  page: pageParams,
736
737
  sort: sortList.length ? sortList[0] : {},
737
738
  sorts: sortList,
@@ -750,10 +751,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
750
751
  if (rest) {
751
752
  if (pagerConfig && isEnableConf(pagerOpts)) {
752
753
  const totalProp = resConfigs.total
753
- const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
754
+ const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
754
755
  tablePage.total = XEUtils.toNumber(total)
755
756
  const resultProp = resConfigs.result
756
- tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, resultProp || 'result')) || []
757
+ tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, resultProp || 'result')) || []
757
758
  // 检验当前页码,不能超出当前最大页数
758
759
  const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
759
760
  if (tablePage.currentPage > pageCount) {
@@ -761,7 +762,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
761
762
  }
762
763
  } else {
763
764
  const listProp = resConfigs.list
764
- tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, listProp)) : rest) || []
765
+ tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, listProp)) : rest) || []
765
766
  }
766
767
  }
767
768
  if ($xeTable as any) {
@@ -800,7 +801,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
800
801
  const selectRecords = $xeTable.getCheckboxRecords()
801
802
  const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row))
802
803
  const body = { removeRecords }
803
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods }
804
+ const commitParams = {
805
+ $table: $xeTable,
806
+ $grid: $xeGrid as VxeGridConstructor,
807
+ $gantt: null,
808
+ code,
809
+ button,
810
+ body,
811
+ form: formData,
812
+ options: ajaxMethods
813
+ }
804
814
  const applyArgs = [commitParams].concat(args)
805
815
  if (selectRecords.length) {
806
816
  return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
@@ -865,7 +875,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
865
875
  if (ajaxMethods) {
866
876
  const body = $xeGrid.getRecordset()
867
877
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
868
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods }
878
+ const commitParams = {
879
+ $table: $xeTable,
880
+ $grid: $xeGrid as VxeGridConstructor,
881
+ $gantt: null,
882
+ code,
883
+ button,
884
+ body,
885
+ form: formData,
886
+ options: ajaxMethods
887
+ }
869
888
  const applyArgs = [commitParams].concat(args)
870
889
  // 排除掉新增且标记为删除的数据
871
890
  if (insertRecords.length) {
@@ -940,8 +959,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
940
959
  default: {
941
960
  const gCommandOpts = commands.get(code)
942
961
  if (gCommandOpts) {
943
- if (gCommandOpts.commandMethod) {
944
- gCommandOpts.commandMethod({ code, button, $grid: $xeGrid as unknown as VxeGridConstructor, $table: $xeTable }, ...args)
962
+ const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
963
+ if (tCommandMethod) {
964
+ tCommandMethod({ code, button, $grid: $xeGrid as VxeGridConstructor, $table: $xeTable, $gantt: null }, ...args)
945
965
  } else {
946
966
  errLog('vxe.error.notCommands', [code])
947
967
  }
@@ -1431,7 +1451,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1431
1451
  const beforeItem = proxyOpts.beforeItem
1432
1452
  if (proxyOpts && beforeItem) {
1433
1453
  formOpts.items.forEach((item: any) => {
1434
- beforeItem.call($xeGrid, { $grid: $xeGrid, item })
1454
+ beforeItem.call($xeGrid, { $grid: $xeGrid, $gantt: null, item })
1435
1455
  })
1436
1456
  }
1437
1457
  }
@@ -1478,7 +1498,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1478
1498
  key: 'form',
1479
1499
  ref: 'refFormWrapper',
1480
1500
  class: 'vxe-grid--form-wrapper'
1481
- }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid }) : $xeGrid.renderDefaultForm(h))
1501
+ }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }) : $xeGrid.renderDefaultForm(h))
1482
1502
  }
1483
1503
  return renderEmptyElement($xeGrid)
1484
1504
  },
@@ -1498,7 +1518,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1498
1518
  ref: 'refToolbarWrapper',
1499
1519
  class: 'vxe-grid--toolbar-wrapper'
1500
1520
  }, toolbarSlot
1501
- ? toolbarSlot.call($xeGrid, { $grid: $xeGrid })
1521
+ ? toolbarSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1502
1522
  : [
1503
1523
  h(VxeToolbarComponent, {
1504
1524
  props: Object.assign({}, toolbarOpts, { slots: undefined }),
@@ -1520,7 +1540,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1520
1540
  key: 'top',
1521
1541
  ref: 'refTopWrapper',
1522
1542
  class: 'vxe-grid--top-wrapper'
1523
- }, topSlot.call($xeGrid, { $grid: $xeGrid }))
1543
+ }, topSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1524
1544
  : renderEmptyElement($xeGrid)
1525
1545
  },
1526
1546
  renderTableLeft (h: CreateElement) {
@@ -1531,7 +1551,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1531
1551
  if (leftSlot) {
1532
1552
  return h('div', {
1533
1553
  class: 'vxe-grid--left-wrapper'
1534
- }, leftSlot({ $grid: $xeGrid }))
1554
+ }, leftSlot({ $grid: $xeGrid, $gantt: null }))
1535
1555
  }
1536
1556
  return renderEmptyElement($xeGrid)
1537
1557
  },
@@ -1543,7 +1563,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1543
1563
  if (rightSlot) {
1544
1564
  return h('div', {
1545
1565
  class: 'vxe-grid--right-wrapper'
1546
- }, rightSlot({ $grid: $xeGrid }))
1566
+ }, rightSlot({ $grid: $xeGrid, $gantt: null }))
1547
1567
  }
1548
1568
  return renderEmptyElement($xeGrid)
1549
1569
  },
@@ -1570,13 +1590,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
1570
1590
  const slots = $xeGrid.$scopedSlots
1571
1591
 
1572
1592
  const bottomSlot = slots.bottom
1573
-
1574
1593
  return bottomSlot
1575
1594
  ? h('div', {
1576
1595
  key: 'bottom',
1577
1596
  ref: 'refBottomWrapper',
1578
1597
  class: 'vxe-grid--bottom-wrapper'
1579
- }, bottomSlot.call($xeGrid, { $grid: $xeGrid }))
1598
+ }, bottomSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1580
1599
  : renderEmptyElement($xeGrid)
1581
1600
  },
1582
1601
  renderPager (h: CreateElement) {
@@ -1597,7 +1616,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1597
1616
  key: 'pager',
1598
1617
  class: 'vxe-grid--pager-wrapper'
1599
1618
  }, pagerSlot
1600
- ? pagerSlot.call($xeGrid, { $grid: $xeGrid })
1619
+ ? pagerSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1601
1620
  : [
1602
1621
  VxeUIPagerComponent
1603
1622
  ? h(VxeUIPagerComponent, {
@@ -6,7 +6,7 @@ import { hasClass } from '../../../ui/src/dom'
6
6
  import { createHtmlPage, getExportBlobByContent } from './util'
7
7
  import { warnLog, errLog } from '../../../ui/src/log'
8
8
 
9
- import type { VxeTablePropTypes, VxeGridConstructor, VxeTableDefines, TableReactData, VxeTablePrivateMethods, TableInternalData, GridReactData, VxeColumnPropTypes, VxeTableConstructor } from '../../../../types'
9
+ import type { VxeTablePropTypes, VxeTableDefines, TableReactData, VxeTablePrivateMethods, TableInternalData, GridReactData, VxeColumnPropTypes, VxeTableConstructor } from '../../../../types'
10
10
 
11
11
  const { getI18n, renderer } = VxeUI
12
12
 
@@ -1176,7 +1176,8 @@ export default {
1176
1176
  const props = $xeTable
1177
1177
  const reactData = $xeTable as unknown as TableReactData
1178
1178
  const internalData = $xeTable as unknown as TableInternalData
1179
- const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor
1179
+ const $xeGrid = $xeTable.$xeGrid
1180
+ const $xeGantt = $xeTable.$xeGantt
1180
1181
 
1181
1182
  const { treeConfig, showHeader, showFooter } = props
1182
1183
  const { isGroup } = reactData
@@ -1382,6 +1383,7 @@ export default {
1382
1383
  const params = {
1383
1384
  $table: $xeTable,
1384
1385
  $grid: $xeGrid,
1386
+ $gantt: $xeGantt,
1385
1387
  sort: sortData.length ? sortData[0] : {} as any,
1386
1388
  sorts: sortData as any[],
1387
1389
  filters: gridReactData.filterData,
@@ -1391,7 +1393,7 @@ export default {
1391
1393
  return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
1392
1394
  .then(rest => {
1393
1395
  const listProp = resConfigs.list
1394
- handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || []
1396
+ handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || []
1395
1397
  if (afterQueryAll) {
1396
1398
  afterQueryAll(params)
1397
1399
  }
@@ -8,7 +8,7 @@ import { getSlotVNs } from '../../ui/src/vn'
8
8
  import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime'
9
9
  import { warnLog, errLog } from '../../ui/src/log'
10
10
 
11
- import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeGridConstructor, GridPrivateMethods, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
11
+ import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, VxeToolbarInstance, TableInternalData, VxeGridConstructor, GridPrivateMethods, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
12
12
 
13
13
  const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI
14
14
 
@@ -971,14 +971,15 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
971
971
  const internalData = $xeTable as unknown as TableInternalData
972
972
 
973
973
  const { showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props
974
- const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn, isColLoading } = reactData
975
- const { visibleColumn, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
974
+ const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn, isColLoading, tHeaderHeight, tFooterHeight } = reactData
975
+ const { visibleColumn, tableHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData
976
+ const $xeGanttView = internalData.xeGanttView
976
977
  const el = $xeTable.$refs.refElem as HTMLDivElement
977
- if (!el) {
978
+ if (!el || !el.clientHeight) {
978
979
  return
979
980
  }
980
981
  const containerList = ['main', 'left', 'right']
981
- const osbWidth = overflowY ? scrollbarWidth : 0
982
+ let osbWidth = overflowY ? scrollbarWidth : 0
982
983
  const osbHeight = overflowX ? scrollbarHeight : 0
983
984
  const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder as HTMLDivElement
984
985
  const mouseOpts = $xeTable.computeMouseOpts
@@ -986,39 +987,49 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
986
987
  const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper'])
987
988
  const bodyTableElem = getRefElem(elemStore['main-body-table'])
988
989
  if (emptyPlaceholderElem) {
989
- emptyPlaceholderElem.style.top = `${headerHeight}px`
990
+ emptyPlaceholderElem.style.top = `${tHeaderHeight}px`
990
991
  emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
991
992
  }
992
993
 
993
- let bodyHeight = 0
994
+ const scrollbarXToTop = $xeTable.computeScrollbarXToTop
995
+ const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
996
+
997
+ const xScrollbarVisible = overflowX ? 'visible' : 'hidden'
998
+ let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
999
+ if ($xeGanttView) {
1000
+ if (!scrollbarYToLeft) {
1001
+ osbWidth = 0
1002
+ yScrollbarVisible = 'hidden'
1003
+ }
1004
+ }
1005
+
1006
+ let tbHeight = 0
994
1007
  let bodyMaxHeight = 0
995
- const bodyMinHeight = customMinHeight - headerHeight - footerHeight - osbHeight
1008
+ const bodyMinHeight = customMinHeight - tHeaderHeight - tFooterHeight - osbHeight
996
1009
  if (customMaxHeight) {
997
- bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - headerHeight - footerHeight - osbHeight)
1010
+ bodyMaxHeight = Math.max(bodyMinHeight, customMaxHeight - tHeaderHeight - tFooterHeight - osbHeight)
998
1011
  }
999
1012
  if (customHeight) {
1000
- bodyHeight = customHeight - headerHeight - footerHeight - osbHeight
1013
+ tbHeight = customHeight - tHeaderHeight - tFooterHeight - osbHeight
1001
1014
  }
1002
- if (!bodyHeight) {
1015
+ if (!tbHeight) {
1003
1016
  if (bodyTableElem) {
1004
- bodyHeight = bodyTableElem.clientHeight
1017
+ tbHeight = bodyTableElem.clientHeight
1005
1018
  }
1006
1019
  }
1007
- if (bodyHeight) {
1020
+ if (tbHeight) {
1008
1021
  if (bodyMaxHeight) {
1009
- bodyHeight = Math.min(bodyMaxHeight, bodyHeight)
1022
+ tbHeight = Math.min(bodyMaxHeight, tbHeight)
1010
1023
  }
1011
- bodyHeight = Math.max(bodyMinHeight, bodyHeight)
1024
+ tbHeight = Math.max(bodyMinHeight, tbHeight)
1012
1025
  }
1013
1026
 
1014
- const scrollbarXToTop = $xeTable.$refs.computeScrollbarXToTop
1015
-
1016
1027
  const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem as HTMLDivElement
1017
1028
  const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem as HTMLDivElement
1018
1029
  const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem as HTMLDivElement
1019
1030
  if (scrollXVirtualEl) {
1020
1031
  scrollXVirtualEl.style.height = `${osbHeight}px`
1021
- scrollXVirtualEl.style.visibility = overflowX ? 'visible' : 'hidden'
1032
+ scrollXVirtualEl.style.visibility = xScrollbarVisible
1022
1033
  }
1023
1034
  const xWrapperEl = $xeTable.$refs.refScrollXWrapperElem as HTMLDivElement
1024
1035
  if (xWrapperEl) {
@@ -1037,32 +1048,34 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1037
1048
  const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem as HTMLDivElement
1038
1049
  if (scrollYVirtualEl) {
1039
1050
  scrollYVirtualEl.style.width = `${osbWidth}px`
1040
- scrollYVirtualEl.style.height = `${bodyHeight + headerHeight + footerHeight}px`
1041
- scrollYVirtualEl.style.visibility = overflowY ? 'visible' : 'hidden'
1051
+ scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`
1052
+ scrollYVirtualEl.style.visibility = yScrollbarVisible
1042
1053
  }
1043
1054
  const yTopCornerEl = $xeTable.$refs.refScrollYTopCornerElem as HTMLDivElement
1044
1055
  if (yTopCornerEl) {
1045
- yTopCornerEl.style.height = `${headerHeight}px`
1046
- yTopCornerEl.style.display = overflowY && headerHeight ? 'block' : ''
1056
+ yTopCornerEl.style.height = `${tHeaderHeight}px`
1057
+ yTopCornerEl.style.display = overflowY && tHeaderHeight ? 'block' : ''
1047
1058
  }
1048
1059
  const yWrapperEl = $xeTable.$refs.refScrollYWrapperElem as HTMLDivElement
1049
1060
  if (yWrapperEl) {
1050
- yWrapperEl.style.height = `${bodyHeight}px`
1051
- yWrapperEl.style.top = `${headerHeight}px`
1061
+ yWrapperEl.style.height = `${tbHeight}px`
1062
+ yWrapperEl.style.top = `${tHeaderHeight}px`
1052
1063
  }
1053
1064
  const yBottomCornerEl = $xeTable.$refs.refScrollYBottomCornerElem as HTMLDivElement
1054
1065
  if (yBottomCornerEl) {
1055
- yBottomCornerEl.style.height = `${footerHeight}px`
1056
- yBottomCornerEl.style.top = `${headerHeight + bodyHeight}px`
1057
- yBottomCornerEl.style.display = overflowY && footerHeight ? 'block' : ''
1066
+ yBottomCornerEl.style.height = `${tFooterHeight}px`
1067
+ yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`
1068
+ yBottomCornerEl.style.display = overflowY && tFooterHeight ? 'block' : ''
1058
1069
  }
1059
1070
 
1060
1071
  const rowExpandEl = $xeTable.$refs.refRowExpandElem as HTMLDivElement
1061
1072
  if (rowExpandEl) {
1062
- rowExpandEl.style.height = `${bodyHeight}px`
1063
- rowExpandEl.style.top = `${headerHeight}px`
1073
+ rowExpandEl.style.height = `${tbHeight}px`
1074
+ rowExpandEl.style.top = `${tHeaderHeight}px`
1064
1075
  }
1065
1076
 
1077
+ reactData.tBodyHeight = tbHeight
1078
+
1066
1079
  containerList.forEach((name, index) => {
1067
1080
  const fixedType = index > 0 ? name : ''
1068
1081
  const layoutList = ['header', 'body', 'footer']
@@ -1128,7 +1141,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1128
1141
  }
1129
1142
 
1130
1143
  if (currScrollElem) {
1131
- currScrollElem.style.height = `${headerHeight}px`
1144
+ currScrollElem.style.height = `${tHeaderHeight}px`
1132
1145
  }
1133
1146
 
1134
1147
  if (tableElem) {
@@ -1137,16 +1150,16 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1137
1150
  } else if (layout === 'body') {
1138
1151
  if (currScrollElem) {
1139
1152
  currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : ''
1140
- currScrollElem.style.height = customHeight ? `${bodyHeight}px` : ''
1153
+ currScrollElem.style.height = customHeight ? `${tbHeight}px` : ''
1141
1154
  currScrollElem.style.minHeight = `${bodyMinHeight}px`
1142
1155
  }
1143
1156
 
1144
1157
  // 如果是固定列
1145
1158
  if (fixedWrapperElem) {
1146
1159
  if (wrapperElem) {
1147
- wrapperElem.style.top = `${headerHeight}px`
1160
+ wrapperElem.style.top = `${tHeaderHeight}px`
1148
1161
  }
1149
- fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + headerHeight + footerHeight + osbHeight)}px`
1162
+ fixedWrapperElem.style.height = `${customHeight > 0 ? customHeight : (tableHeight + tHeaderHeight + tFooterHeight + osbHeight)}px`
1150
1163
  fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, 0)}px`
1151
1164
  }
1152
1165
 
@@ -1229,11 +1242,11 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1229
1242
  }
1230
1243
 
1231
1244
  if (currScrollElem) {
1232
- currScrollElem.style.height = `${footerHeight}px`
1245
+ currScrollElem.style.height = `${tFooterHeight}px`
1233
1246
  // 如果是固定列
1234
1247
  if (fixedWrapperElem) {
1235
1248
  if (wrapperElem) {
1236
- wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight - osbHeight : tableHeight + headerHeight}px`
1249
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - tFooterHeight - osbHeight : tableHeight + tHeaderHeight}px`
1237
1250
  }
1238
1251
  }
1239
1252
  }
@@ -1249,6 +1262,9 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1249
1262
  if (mouseConfig && mouseOpts.selected && editStore.selected.row && editStore.selected.column) {
1250
1263
  $xeTable.addCellSelectedClass()
1251
1264
  }
1265
+ if ($xeGanttView) {
1266
+ $xeGanttView.handleUpdateStyle()
1267
+ }
1252
1268
  return $xeTable.$nextTick()
1253
1269
  }
1254
1270
 
@@ -2762,13 +2778,13 @@ function calcScrollbar ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
2762
2778
  }
2763
2779
  reactData.overflowX = overflowX
2764
2780
 
2765
- const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0
2766
- const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0
2781
+ const hHeight = headerTableElem ? headerTableElem.clientHeight : 0
2782
+ const fHeight = footerTableElem ? footerTableElem.clientHeight : 0
2767
2783
  internalData.tableHeight = bodyWrapperElem.offsetHeight
2768
- internalData.headerHeight = headerHeight
2769
- internalData.footerHeight = footerHeight
2770
-
2771
- reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight())
2784
+ reactData.tHeaderHeight = hHeight
2785
+ reactData.tFooterHeight = fHeight
2786
+ reactData.overflowX = overflowX
2787
+ reactData.parentHeight = Math.max(hHeight + fHeight + 20, $xeTable.getParentHeight())
2772
2788
  }
2773
2789
  if (overflowX) {
2774
2790
  $xeTable.checkScrolling()
@@ -2828,6 +2844,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
2828
2844
 
2829
2845
  return new Promise<void>(resolve => {
2830
2846
  const { rceTimeout, rceRunTime } = internalData
2847
+ const $xeGanttView = internalData.xeGanttView
2831
2848
  const resizeOpts = $xeTable.computeResizeOpts
2832
2849
  const refreshDelay = resizeOpts.refreshDelay || 20
2833
2850
  const el = $xeTable.$refs.refElem as HTMLElement
@@ -2851,6 +2868,9 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
2851
2868
  handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
2852
2869
  )
2853
2870
  }
2871
+ if ($xeGanttView) {
2872
+ $xeGanttView.handleLazyRecalculate()
2873
+ }
2854
2874
  internalData.rceTimeout = setTimeout(() => {
2855
2875
  internalData.rceTimeout = undefined
2856
2876
  handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
@@ -3658,6 +3678,20 @@ const wheelScrollTopTo = (diffNum: number, cb: (progress: number) => void) => {
3658
3678
  requestAnimationFrame(step)
3659
3679
  }
3660
3680
 
3681
+ const syncGanttScrollTop = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, scrollTop: number) => {
3682
+ const internalData = $xeTable as unknown as TableInternalData
3683
+
3684
+ const $xeGanttView = internalData.xeGanttView
3685
+ if ($xeGanttView) {
3686
+ const ganttInternalData = $xeGanttView.internalData
3687
+ const { elemStore: ganttElemStore } = ganttInternalData
3688
+ const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll'])
3689
+ if (ganttBodyScrollElem) {
3690
+ ganttBodyScrollElem.scrollTop = scrollTop
3691
+ }
3692
+ }
3693
+ }
3694
+
3661
3695
  function updateHeight ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
3662
3696
  const reactData = $xeTable as unknown as TableReactData
3663
3697
  const internalData = $xeTable as unknown as TableInternalData
@@ -3988,6 +4022,7 @@ const Methods = {
3988
4022
 
3989
4023
  const { scrollYLoad } = reactData
3990
4024
  const { scrollYStore, fullDataRowIdData } = internalData
4025
+ const $xeGanttView = internalData.xeGanttView
3991
4026
  let fullList: any[] = internalData.afterFullData
3992
4027
  // 是否进行数据处理
3993
4028
  if (force) {
@@ -4008,6 +4043,9 @@ const Methods = {
4008
4043
  })
4009
4044
  reactData.tableData = tableData
4010
4045
  internalData.visibleDataRowIdData = visibleDataRowIdMaps
4046
+ if ($xeGanttView) {
4047
+ $xeGanttView.updateViewData()
4048
+ }
4011
4049
  return $xeTable.$nextTick()
4012
4050
  },
4013
4051
  /**
@@ -10289,6 +10327,7 @@ const Methods = {
10289
10327
  }
10290
10328
  setScrollTop(yHandleEl, scrollTop)
10291
10329
  setScrollTop(rowExpandEl, scrollTop)
10330
+ syncGanttScrollTop($xeTable, scrollTop)
10292
10331
  if (scrollYLoad) {
10293
10332
  $xeTable.triggerScrollYEvent(evnt)
10294
10333
  }
@@ -10493,6 +10532,7 @@ const Methods = {
10493
10532
  setScrollTop(leftScrollElem, currTopNum)
10494
10533
  setScrollTop(rightScrollElem, currTopNum)
10495
10534
  setScrollTop(rowExpandEl, currTopNum)
10535
+ syncGanttScrollTop($xeTable, currTopNum)
10496
10536
  if (scrollYLoad) {
10497
10537
  $xeTable.triggerScrollYEvent(evnt)
10498
10538
  }
@@ -10509,6 +10549,7 @@ const Methods = {
10509
10549
  setScrollTop(leftScrollElem, currTopNum)
10510
10550
  setScrollTop(rightScrollElem, currTopNum)
10511
10551
  setScrollTop(rowExpandEl, currTopNum)
10552
+ syncGanttScrollTop($xeTable, currTopNum)
10512
10553
  if (scrollYLoad) {
10513
10554
  $xeTable.triggerScrollYEvent(evnt)
10514
10555
  }
@@ -10592,6 +10633,7 @@ const Methods = {
10592
10633
  setScrollTop(leftScrollElem, scrollTop)
10593
10634
  setScrollTop(rightScrollElem, scrollTop)
10594
10635
  setScrollTop(rowExpandEl, scrollTop)
10636
+ syncGanttScrollTop($xeTable, scrollTop)
10595
10637
  if (scrollYLoad) {
10596
10638
  $xeTable.triggerScrollYEvent(evnt)
10597
10639
  }
@@ -10623,6 +10665,7 @@ const Methods = {
10623
10665
 
10624
10666
  const { scrollXLoad, overflowX, scrollXWidth } = reactData
10625
10667
  const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData
10668
+ const $xeGanttView = internalData.xeGanttView
10626
10669
  const mouseOpts = $xeTable.computeMouseOpts
10627
10670
  const tableBody = $xeTable.$refs.refTableBody
10628
10671
  const tableBodyElem = tableBody ? (tableBody as any).$el as HTMLDivElement : null
@@ -10690,10 +10733,13 @@ const Methods = {
10690
10733
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`
10691
10734
  }
10692
10735
 
10736
+ calcScrollbar($xeTable)
10693
10737
  if (isScrollXBig && mouseOpts.area) {
10694
10738
  errLog('vxe.error.notProp', ['mouse-config.area'])
10695
10739
  }
10696
- calcScrollbar($xeTable)
10740
+ if ($xeGanttView) {
10741
+ $xeGanttView.updateScrollXSpace()
10742
+ }
10697
10743
  return $xeTable.$nextTick(() => {
10698
10744
  updateStyle($xeTable)
10699
10745
  })
@@ -10717,6 +10763,7 @@ const Methods = {
10717
10763
 
10718
10764
  const { isAllOverflow, scrollYLoad, expandColumn } = reactData
10719
10765
  const { scrollYStore, elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData, rowExpandedMaps } = internalData
10766
+ const $xeGanttView = internalData.xeGanttView
10720
10767
  const { startIndex } = scrollYStore
10721
10768
  const mouseOpts = $xeTable.computeMouseOpts
10722
10769
  const expandOpts = $xeTable.computeExpandOpts
@@ -10811,10 +10858,13 @@ const Methods = {
10811
10858
  reactData.scrollYHeight = scrollYHeight
10812
10859
  reactData.isScrollYBig = isScrollYBig
10813
10860
 
10861
+ calcScrollbar($xeTable)
10814
10862
  if (isScrollYBig && mouseOpts.area) {
10815
10863
  errLog('vxe.error.notProp', ['mouse-config.area'])
10816
10864
  }
10817
- calcScrollbar($xeTable)
10865
+ if ($xeGanttView) {
10866
+ $xeGanttView.updateScrollYSpace()
10867
+ }
10818
10868
  return $xeTable.$nextTick().then(() => {
10819
10869
  updateStyle($xeTable)
10820
10870
  })
@@ -11193,16 +11243,38 @@ const Methods = {
11193
11243
  this.isActivated = false
11194
11244
  return this.$nextTick()
11195
11245
  },
11196
- // 连接工具栏
11197
- connect ($toolbar: any) {
11246
+ /**
11247
+ * 已废弃,被 connectToolbar 替换
11248
+ * @deprecated
11249
+ */
11250
+ connect ($toolbar: VxeToolbarConstructor | VxeToolbarInstance) {
11251
+ return this.connectToolbar($toolbar)
11252
+ },
11253
+ /**
11254
+ * 连接工具栏
11255
+ * @param $toolbar
11256
+ */
11257
+ connectToolbar ($toolbar: VxeToolbarConstructor | VxeToolbarInstance) {
11258
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
11259
+
11198
11260
  if ($toolbar && $toolbar.syncUpdate) {
11199
- $toolbar.syncUpdate({ collectColumn: this.collectColumn, $table: this })
11261
+ $toolbar.syncUpdate({ collectColumn: this.collectColumn, $table: $xeTable })
11200
11262
  this.$toolbar = $toolbar
11201
11263
  } else {
11202
11264
  errLog('vxe.error.barUnableLink')
11203
11265
  }
11204
11266
  return this.$nextTick()
11205
11267
  },
11268
+ handleConnectGanttView ($ganttView: any) {
11269
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
11270
+ const internalData = $xeTable as unknown as TableInternalData
11271
+
11272
+ if ($ganttView && $ganttView.connectUpdate) {
11273
+ $ganttView.connectUpdate({ $table: $xeTable })
11274
+ internalData.xeGanttView = $ganttView
11275
+ }
11276
+ return $xeTable.$nextTick()
11277
+ },
11206
11278
 
11207
11279
  /*************************
11208
11280
  * Publish methods