vxe-gantt 3.0.0-beta.3 → 3.0.0-beta.5

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 (38) hide show
  1. package/es/gantt/src/gantt-body.js +22 -5
  2. package/es/gantt/src/gantt-chart.js +6 -1
  3. package/es/gantt/src/gantt-view.js +82 -61
  4. package/es/gantt/src/gantt.js +24 -8
  5. package/es/gantt/style.css +16 -0
  6. package/es/gantt/style.min.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-gantt/style.css +16 -0
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-body.js +26 -5
  14. package/lib/gantt/src/gantt-body.min.js +1 -1
  15. package/lib/gantt/src/gantt-chart.js +6 -1
  16. package/lib/gantt/src/gantt-chart.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +85 -63
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +24 -9
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +16 -0
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +143 -80
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-gantt/style/style.css +16 -0
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +3 -3
  34. package/packages/gantt/src/gantt-body.ts +22 -5
  35. package/packages/gantt/src/gantt-chart.ts +7 -1
  36. package/packages/gantt/src/gantt-view.ts +94 -68
  37. package/packages/gantt/src/gantt.ts +29 -11
  38. package/styles/components/gantt.scss +15 -0
@@ -42,7 +42,7 @@ function createInternalData (): GanttViewInternalData {
42
42
  }
43
43
  }
44
44
  const maxYHeight = 5e6
45
- const maxXWidth = 5e6
45
+ // const maxXWidth = 5e6
46
46
 
47
47
  function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
48
48
  const $xeGantt = $xeGanttView.$xeGantt
@@ -361,61 +361,61 @@ function handleLazyRecalculate ($xeGanttView: VxeGanttViewConstructor & VxeGantt
361
361
  return $xeGanttView.$nextTick()
362
362
  }
363
363
 
364
- function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
365
- const reactData = $xeGanttView.reactData
366
- const internalData = $xeGanttView.internalData
367
-
368
- const { scrollXLoad, scrollXWidth } = reactData
369
- const { elemStore } = internalData
370
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
371
- const bodyTableElem = getRefElem(elemStore['main-body-table'])
372
-
373
- let xSpaceLeft = 0
374
-
375
- let clientWidth = 0
376
- if (bodyScrollElem) {
377
- clientWidth = bodyScrollElem.clientWidth
378
- }
379
- // 虚拟渲染
380
- let isScrollXBig = false
381
- let ySpaceWidth = scrollXWidth
382
- if (scrollXWidth > maxXWidth) {
383
- // 触右
384
- if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
385
- xSpaceLeft = maxXWidth - bodyTableElem.clientWidth
386
- } else {
387
- xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth))
388
- }
389
- ySpaceWidth = maxXWidth
390
- isScrollXBig = true
391
- }
392
-
393
- if (bodyTableElem) {
394
- bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
395
- }
396
-
397
- const layoutList = ['header', 'body', 'footer']
398
- layoutList.forEach(layout => {
399
- const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
400
- if (xSpaceElem) {
401
- xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : ''
402
- }
403
- })
404
-
405
- reactData.scrollXLeft = xSpaceLeft
406
- reactData.scrollXWidth = ySpaceWidth
407
- reactData.isScrollXBig = isScrollXBig
408
-
409
- const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
410
- if (scrollXSpaceEl) {
411
- scrollXSpaceEl.style.width = `${ySpaceWidth}px`
412
- }
413
-
414
- calcScrollbar($xeGanttView)
415
- return $xeGanttView.$nextTick().then(() => {
416
- updateStyle($xeGanttView)
417
- })
418
- }
364
+ // function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
365
+ // const reactData = $xeGanttView.reactData
366
+ // const internalData = $xeGanttView.internalData
367
+
368
+ // const { scrollXLoad, scrollXWidth } = reactData
369
+ // const { elemStore } = internalData
370
+ // const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
371
+ // const bodyTableElem = getRefElem(elemStore['main-body-table'])
372
+
373
+ // let xSpaceLeft = 0
374
+
375
+ // let clientWidth = 0
376
+ // if (bodyScrollElem) {
377
+ // clientWidth = bodyScrollElem.clientWidth
378
+ // }
379
+ // // 虚拟渲染
380
+ // let isScrollXBig = false
381
+ // let ySpaceWidth = scrollXWidth
382
+ // if (scrollXWidth > maxXWidth) {
383
+ // // 触右
384
+ // if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
385
+ // xSpaceLeft = maxXWidth - bodyTableElem.clientWidth
386
+ // } else {
387
+ // xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth))
388
+ // }
389
+ // ySpaceWidth = maxXWidth
390
+ // isScrollXBig = true
391
+ // }
392
+
393
+ // if (bodyTableElem) {
394
+ // bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`
395
+ // }
396
+
397
+ // const layoutList = ['header', 'body', 'footer']
398
+ // layoutList.forEach(layout => {
399
+ // const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
400
+ // if (xSpaceElem) {
401
+ // xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : ''
402
+ // }
403
+ // })
404
+
405
+ // reactData.scrollXLeft = xSpaceLeft
406
+ // reactData.scrollXWidth = ySpaceWidth
407
+ // reactData.isScrollXBig = isScrollXBig
408
+
409
+ // const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
410
+ // if (scrollXSpaceEl) {
411
+ // scrollXSpaceEl.style.width = `${ySpaceWidth}px`
412
+ // }
413
+
414
+ // calcScrollbar($xeGanttView)
415
+ // return $xeGanttView.$nextTick().then(() => {
416
+ // updateStyle($xeGanttView)
417
+ // })
418
+ // }
419
419
 
420
420
  function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
421
421
  const reactData = $xeGanttView.reactData
@@ -457,17 +457,18 @@ function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
457
457
  scrollYTop = 0
458
458
  }
459
459
 
460
+ const bodyChartWrapperElem = getRefElem(elemStore['main-chart-wrapper'])
460
461
  if (bodyTableElem) {
461
462
  bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`
462
463
  }
464
+ if (bodyChartWrapperElem) {
465
+ bodyChartWrapperElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`
466
+ }
463
467
 
464
- const layoutList = ['header', 'body', 'footer']
465
- layoutList.forEach(layout => {
466
- const ySpaceElem = getRefElem(elemStore[`main-${layout}-ySpace`])
467
- if (ySpaceElem) {
468
- ySpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
469
- }
470
- })
468
+ const bodyYSpaceElem = getRefElem(elemStore['main-body-ySpace'])
469
+ if (bodyYSpaceElem) {
470
+ bodyYSpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
471
+ }
471
472
 
472
473
  const scrollYSpaceEl = $xeGanttView.$refs.refScrollYSpaceElem as HTMLDivElement
473
474
  if (scrollYSpaceEl) {
@@ -552,9 +553,9 @@ export default defineVxeComponent({
552
553
  // 是否启用了纵向 Y 可视渲染方式加载
553
554
  scrollYLoad: false,
554
555
  // 是否存在纵向滚动条
555
- overflowY: false,
556
+ overflowY: true,
556
557
  // 是否存在横向滚动条
557
- overflowX: false,
558
+ overflowX: true,
558
559
  // 纵向滚动条的宽度
559
560
  scrollbarWidth: 0,
560
561
  // 横向滚动条的高度
@@ -789,16 +790,41 @@ export default defineVxeComponent({
789
790
  handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, currTopNum, wrapperEl.scrollLeft)
790
791
  }
791
792
  },
792
- updateScrollXSpace () {
793
+ handleUpdateSXSpace () {
793
794
  const $xeGanttView = this
795
+ const reactData = $xeGanttView.reactData
796
+ const internalData = $xeGanttView.internalData
794
797
 
795
- return updateScrollXSpace($xeGanttView)
798
+ const { scrollXLoad, scrollXWidth } = reactData
799
+ const { elemStore } = internalData
800
+
801
+ const layoutList = ['header', 'body', 'footer']
802
+ layoutList.forEach(layout => {
803
+ const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
804
+ if (xSpaceElem) {
805
+ xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : ''
806
+ }
807
+ })
808
+
809
+ const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
810
+ if (scrollXSpaceEl) {
811
+ scrollXSpaceEl.style.width = `${scrollXWidth}px`
812
+ }
813
+
814
+ calcScrollbar($xeGanttView)
815
+ return $xeGanttView.$nextTick()
796
816
  },
797
- updateScrollYSpace () {
817
+ handleUpdateSYSpace () {
798
818
  const $xeGanttView = this
799
819
 
800
820
  return updateScrollYSpace($xeGanttView)
801
821
  },
822
+ handleUpdateSYStatus (sYLoad: boolean) {
823
+ const $xeGanttView = this
824
+ const reactData = $xeGanttView.reactData
825
+
826
+ reactData.scrollYLoad = sYLoad
827
+ },
802
828
  handleGlobalResizeEvent () {
803
829
  const $xeGanttView = this
804
830
 
@@ -10,8 +10,8 @@ import GanttViewComponent from './gantt-view'
10
10
  import { VxeTable as VxeTableComponent } from 'vxe-table'
11
11
 
12
12
  import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxePagerDefines, VxeComponentStyleType, VxeComponentSizeType, VxeFormDefines, VxeFormItemPropTypes } from 'vxe-pc-ui'
13
- import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes } from 'vxe-table'
14
- import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines } from '../../../types'
13
+ import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes } from 'vxe-table'
14
+ import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines, VxeGanttConstructor } from '../../../types'
15
15
 
16
16
  const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
17
17
 
@@ -22,12 +22,18 @@ const propKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
22
22
 
23
23
  const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']]
24
24
 
25
- function getTableOns (_vm: any) {
26
- const { $listeners, proxyConfig, proxyOpts } = _vm
25
+ function getTableOns ($xeGantt: VxeGanttConstructor) {
26
+ const _vm = $xeGantt as any
27
+ const $listeners = _vm.$listeners
28
+
29
+ const props = $xeGantt
30
+
31
+ const { proxyConfig } = props
32
+ const proxyOpts = $xeGantt.computeProxyOpts
27
33
  const ons: any = {}
28
34
  XEUtils.each($listeners, (cb: any, type: any) => {
29
35
  ons[type] = (...args: any[]) => {
30
- _vm.$emit(type, ...args)
36
+ $xeGantt.$emit(type, ...args)
31
37
  }
32
38
  })
33
39
  if (proxyConfig) {
@@ -1508,6 +1514,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
1508
1514
  if ($xeTable) {
1509
1515
  const tableProps = $xeTable
1510
1516
  const { highlightCurrentRow } = tableProps
1517
+ const tableReactData = $xeTable as unknown as TableReactData
1518
+ const { radioColumn, checkboxColumn } = tableReactData
1519
+ const radioOpts = $xeTable.computeRadioOpts
1520
+ const checkboxOpts = $xeTable.computeCheckboxOpts
1511
1521
  const rowOpts = $xeTable.computeRowOpts
1512
1522
  const { row } = params
1513
1523
  // 如果是当前行
@@ -1518,6 +1528,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
1518
1528
  $rowIndex: $xeTable.getVMRowIndex(row)
1519
1529
  }, params))
1520
1530
  }
1531
+ // 如果是单选框
1532
+ if ((radioColumn && radioOpts.trigger === 'row')) {
1533
+ $xeTable.triggerRadioRowEvent(evnt, params)
1534
+ }
1535
+ // 如果是复选框
1536
+ if ((checkboxColumn && checkboxOpts.trigger === 'row')) {
1537
+ $xeTable.handleToggleCheckRowEvent(evnt, params)
1538
+ }
1521
1539
  }
1522
1540
  $xeGantt.dispatchEvent('task-cell-click', params, evnt)
1523
1541
  },
@@ -1797,7 +1815,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1797
1815
  h(VxeTableComponent as Component, {
1798
1816
  key: 'table',
1799
1817
  props: tableProps,
1800
- on: getTableOns($xeGantt),
1818
+ on: getTableOns($xeGantt as VxeGanttConstructor),
1801
1819
  scopedSlots: slots,
1802
1820
  ref: 'refTable'
1803
1821
  })
@@ -1965,7 +1983,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
1965
1983
  class: 'vxe-gantt--resizable-split-number-right'
1966
1984
  }, '20px')
1967
1985
  ])
1968
- ])
1986
+ ]),
1987
+ h('div', {
1988
+ class: 'vxe-gantt--border-line'
1989
+ })
1969
1990
  ])
1970
1991
  )
1971
1992
  break
@@ -2013,10 +2034,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
2013
2034
  ]),
2014
2035
  h('div', {
2015
2036
  class: 'vxe-gantt--layout-footer-wrapper'
2016
- }, $xeGantt.renderChildLayout(h, footKeys)),
2017
- h('div', {
2018
- class: 'vxe-gantt--border-line'
2019
- })
2037
+ }, $xeGantt.renderChildLayout(h, footKeys))
2020
2038
  ]
2021
2039
  },
2022
2040
  renderVN (h: CreateElement): VNode {
@@ -531,6 +531,9 @@
531
531
  float: left;
532
532
  }
533
533
  }
534
+ .vxe-gantt-view--header-table {
535
+ height: 100%;
536
+ }
534
537
  .vxe-gantt-view--header-table,
535
538
  .vxe-gantt-view--body-table {
536
539
  border: 0;
@@ -583,6 +586,12 @@
583
586
  &.row--stripe {
584
587
  background-color: var(--vxe-ui-table-row-striped-background-color);
585
588
  }
589
+ &.row--radio {
590
+ background-color: var(--vxe-ui-table-row-radio-checked-background-color);
591
+ }
592
+ &.row--checked {
593
+ background-color: var(--vxe-ui-table-row-checkbox-checked-background-color);
594
+ }
586
595
  &.row--current {
587
596
  background-color: var(--vxe-ui-table-row-current-background-color);
588
597
  }
@@ -591,6 +600,12 @@
591
600
  &.row--stripe {
592
601
  background-color: var(--vxe-ui-table-row-hover-striped-background-color);
593
602
  }
603
+ &.row--radio {
604
+ background-color: var(--vxe-ui-table-row-hover-radio-checked-background-color);
605
+ }
606
+ &.row--checked {
607
+ background-color: var(--vxe-ui-table-row-hover-checkbox-checked-background-color);
608
+ }
594
609
  &.row--current {
595
610
  background-color: var(--vxe-ui-table-row-hover-current-background-color);
596
611
  }