vxe-gantt 3.0.0-beta.4 → 3.0.0

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 (46) hide show
  1. package/es/gantt/src/gantt-body.js +22 -9
  2. package/es/gantt/src/gantt-chart.js +6 -1
  3. package/es/gantt/src/gantt-footer.js +51 -0
  4. package/es/gantt/src/gantt-header.js +1 -5
  5. package/es/gantt/src/gantt-view.js +38 -5
  6. package/es/gantt/src/gantt.js +29 -7
  7. package/es/gantt/style.css +24 -0
  8. package/es/gantt/style.min.css +1 -1
  9. package/es/style.css +1 -1
  10. package/es/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-gantt/style.css +24 -0
  14. package/es/vxe-gantt/style.min.css +1 -1
  15. package/lib/gantt/src/gantt-body.js +26 -9
  16. package/lib/gantt/src/gantt-body.min.js +1 -1
  17. package/lib/gantt/src/gantt-chart.js +6 -1
  18. package/lib/gantt/src/gantt-chart.min.js +1 -1
  19. package/lib/gantt/src/gantt-footer.js +55 -0
  20. package/lib/gantt/src/gantt-footer.min.js +1 -0
  21. package/lib/gantt/src/gantt-header.js +1 -5
  22. package/lib/gantt/src/gantt-header.min.js +1 -1
  23. package/lib/gantt/src/gantt-view.js +39 -6
  24. package/lib/gantt/src/gantt-view.min.js +1 -1
  25. package/lib/gantt/src/gantt.js +29 -6
  26. package/lib/gantt/src/gantt.min.js +1 -1
  27. package/lib/gantt/style/style.css +24 -0
  28. package/lib/gantt/style/style.min.css +1 -1
  29. package/lib/index.umd.js +154 -29
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/style.css +1 -1
  32. package/lib/style.min.css +1 -1
  33. package/lib/ui/index.js +1 -1
  34. package/lib/ui/index.min.js +1 -1
  35. package/lib/ui/src/log.js +1 -1
  36. package/lib/ui/src/log.min.js +1 -1
  37. package/lib/vxe-gantt/style/style.css +24 -0
  38. package/lib/vxe-gantt/style/style.min.css +1 -1
  39. package/package.json +3 -3
  40. package/packages/gantt/src/gantt-body.ts +22 -9
  41. package/packages/gantt/src/gantt-chart.ts +7 -1
  42. package/packages/gantt/src/gantt-footer.ts +62 -0
  43. package/packages/gantt/src/gantt-header.ts +1 -5
  44. package/packages/gantt/src/gantt-view.ts +43 -5
  45. package/packages/gantt/src/gantt.ts +32 -8
  46. package/styles/components/gantt.scss +26 -0
@@ -6,6 +6,7 @@ import { getRefElem } from './util'
6
6
  import XEUtils from 'xe-utils'
7
7
  import GanttViewHeaderComponent from './gantt-header'
8
8
  import GanttViewBodyComponent from './gantt-body'
9
+ import GanttViewFooterComponent from './gantt-footer'
9
10
 
10
11
  import type { TableReactData, TableInternalData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table'
11
12
  import type { VxeGanttViewConstructor, GanttViewReactData, VxeGanttPropTypes, VxeGanttDefines, VxeGanttViewPrivateMethods, GanttViewInternalData, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
@@ -258,13 +259,15 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
258
259
  return
259
260
  }
260
261
 
262
+ const scrollbarOpts = $xeGantt.computeScrollbarOpts
261
263
  const scrollbarXToTop = $xeGantt.computeScrollbarXToTop
264
+ const scrollbarYToLeft = $xeGantt.computeScrollbarYToLeft
262
265
 
263
266
  const xLeftCornerEl = $xeGanttView.$refs.refScrollXLeftCornerElem as HTMLDivElement
264
267
  const xRightCornerEl = $xeGanttView.$refs.refScrollXRightCornerElem as HTMLDivElement
265
268
  const scrollXVirtualEl = $xeGanttView.$refs.refScrollXVirtualElem as HTMLDivElement
266
269
 
267
- const osbWidth = scrollbarWidth
270
+ let osbWidth = scrollbarWidth
268
271
  const osbHeight = scrollbarHeight
269
272
 
270
273
  let tbHeight = 0
@@ -277,6 +280,12 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
277
280
  tFooterHeight = tableInternalData.tFooterHeight
278
281
  }
279
282
 
283
+ let yScrollbarVisible = 'visible'
284
+ if (scrollbarYToLeft && (scrollbarOpts.y && scrollbarOpts.y.visible === false)) {
285
+ osbWidth = 0
286
+ yScrollbarVisible = 'hidden'
287
+ }
288
+
280
289
  const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
281
290
  if (headerScrollElem) {
282
291
  headerScrollElem.style.height = `${tHeaderHeight}px`
@@ -285,6 +294,10 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
285
294
  if (bodyScrollElem) {
286
295
  bodyScrollElem.style.height = `${tbHeight}px`
287
296
  }
297
+ const footerScrollElem = getRefElem(elemStore['main-footer-scroll'])
298
+ if (footerScrollElem) {
299
+ footerScrollElem.style.height = `${tFooterHeight}px`
300
+ }
288
301
 
289
302
  if (scrollXVirtualEl) {
290
303
  scrollXVirtualEl.style.height = `${osbHeight}px`
@@ -308,7 +321,7 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
308
321
  if (scrollYVirtualEl) {
309
322
  scrollYVirtualEl.style.width = `${osbWidth}px`
310
323
  scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`
311
- scrollYVirtualEl.style.visibility = 'visible'
324
+ scrollYVirtualEl.style.visibility = yScrollbarVisible
312
325
  }
313
326
  const yTopCornerEl = $xeGanttView.$refs.refScrollYTopCornerElem as HTMLDivElement
314
327
  if (yTopCornerEl) {
@@ -790,12 +803,36 @@ export default defineVxeComponent({
790
803
  handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, currTopNum, wrapperEl.scrollLeft)
791
804
  }
792
805
  },
793
- updateScrollYSpace () {
806
+ handleUpdateSXSpace () {
807
+ const $xeGanttView = this
808
+ const reactData = $xeGanttView.reactData
809
+ const internalData = $xeGanttView.internalData
810
+
811
+ const { scrollXLoad, scrollXWidth } = reactData
812
+ const { elemStore } = internalData
813
+
814
+ const layoutList = ['header', 'body', 'footer']
815
+ layoutList.forEach(layout => {
816
+ const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
817
+ if (xSpaceElem) {
818
+ xSpaceElem.style.width = scrollXLoad ? `${scrollXWidth}px` : ''
819
+ }
820
+ })
821
+
822
+ const scrollXSpaceEl = $xeGanttView.$refs.refScrollXSpaceElem as HTMLDivElement
823
+ if (scrollXSpaceEl) {
824
+ scrollXSpaceEl.style.width = `${scrollXWidth}px`
825
+ }
826
+
827
+ calcScrollbar($xeGanttView)
828
+ return $xeGanttView.$nextTick()
829
+ },
830
+ handleUpdateSYSpace () {
794
831
  const $xeGanttView = this
795
832
 
796
833
  return updateScrollYSpace($xeGanttView)
797
834
  },
798
- updateScrollYStatus (sYLoad: boolean) {
835
+ handleUpdateSYStatus (sYLoad: boolean) {
799
836
  const $xeGanttView = this
800
837
  const reactData = $xeGanttView.reactData
801
838
 
@@ -884,7 +921,8 @@ export default defineVxeComponent({
884
921
  class: 'vxe-gantt-view--viewport-wrapper'
885
922
  }, [
886
923
  h(GanttViewHeaderComponent),
887
- h(GanttViewBodyComponent)
924
+ h(GanttViewBodyComponent),
925
+ h(GanttViewFooterComponent)
888
926
  ])
889
927
  },
890
928
  renderBody (h: CreateElement) {
@@ -10,7 +10,7 @@ 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'
13
+ import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes } from 'vxe-table'
14
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
@@ -81,6 +81,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
81
81
  editConfig: PropType<VxeTablePropTypes.EditConfig>
82
82
  sortConfig: PropType<VxeTablePropTypes.SortConfig>
83
83
  filterConfig: PropType<VxeTablePropTypes.FilterConfig>
84
+ expandConfig: PropType<VxeTablePropTypes.ExpandConfig>
85
+ aggregateConfig: PropType<VxeTablePropTypes.AggregateConfig>
84
86
  validConfig: PropType<VxeTablePropTypes.ValidConfig>
85
87
  editRules: PropType<VxeTablePropTypes.EditRules>
86
88
  animat: PropType<VxeTablePropTypes.Animat>
@@ -317,10 +319,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
317
319
  const pagerOpts = $xeGantt.computePagerOpts
318
320
  const isLoading = $xeGantt.computeIsLoading
319
321
  const tProps = Object.assign({}, tableExtendProps, {
322
+ // 不支持修改的属性
320
323
  showOverflow: true,
321
324
  showHeaderOverflow: true,
322
- showFooterOverflow: true,
323
- showFooter: false
325
+ showFooterOverflow: true
324
326
  })
325
327
  if (isZMax) {
326
328
  if (tableExtendProps.maxHeight) {
@@ -1514,6 +1516,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
1514
1516
  if ($xeTable) {
1515
1517
  const tableProps = $xeTable
1516
1518
  const { highlightCurrentRow } = tableProps
1519
+ const tableReactData = $xeTable as unknown as TableReactData
1520
+ const { radioColumn, checkboxColumn } = tableReactData
1521
+ const radioOpts = $xeTable.computeRadioOpts
1522
+ const checkboxOpts = $xeTable.computeCheckboxOpts
1517
1523
  const rowOpts = $xeTable.computeRowOpts
1518
1524
  const { row } = params
1519
1525
  // 如果是当前行
@@ -1524,6 +1530,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
1524
1530
  $rowIndex: $xeTable.getVMRowIndex(row)
1525
1531
  }, params))
1526
1532
  }
1533
+ // 如果是单选框
1534
+ if ((radioColumn && radioOpts.trigger === 'row')) {
1535
+ $xeTable.triggerRadioRowEvent(evnt, params)
1536
+ }
1537
+ // 如果是复选框
1538
+ if ((checkboxColumn && checkboxOpts.trigger === 'row')) {
1539
+ $xeTable.handleToggleCheckRowEvent(evnt, params)
1540
+ }
1527
1541
  }
1528
1542
  $xeGantt.dispatchEvent('task-cell-click', params, evnt)
1529
1543
  },
@@ -1548,6 +1562,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1548
1562
  const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
1549
1563
 
1550
1564
  XEUtils.eachTree(columns, column => {
1565
+ const { type } = column
1551
1566
  if (column.slots) {
1552
1567
  XEUtils.each(column.slots, (func) => {
1553
1568
  if (!XEUtils.isFunction(func)) {
@@ -1557,6 +1572,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
1557
1572
  }
1558
1573
  })
1559
1574
  }
1575
+ if (type === 'expand') {
1576
+ errLog('vxe.error.errProp', ['type=expand', 'type=seq,radio,checkbox,html'])
1577
+ }
1560
1578
  })
1561
1579
  return $xeTable.loadColumn(columns)
1562
1580
  },
@@ -1971,7 +1989,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
1971
1989
  class: 'vxe-gantt--resizable-split-number-right'
1972
1990
  }, '20px')
1973
1991
  ])
1974
- ])
1992
+ ]),
1993
+ h('div', {
1994
+ class: 'vxe-gantt--border-line'
1995
+ })
1975
1996
  ])
1976
1997
  )
1977
1998
  break
@@ -2019,10 +2040,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
2019
2040
  ]),
2020
2041
  h('div', {
2021
2042
  class: 'vxe-gantt--layout-footer-wrapper'
2022
- }, $xeGantt.renderChildLayout(h, footKeys)),
2023
- h('div', {
2024
- class: 'vxe-gantt--border-line'
2025
- })
2043
+ }, $xeGantt.renderChildLayout(h, footKeys))
2026
2044
  ]
2027
2045
  },
2028
2046
  renderVN (h: CreateElement): VNode {
@@ -2071,6 +2089,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
2071
2089
  if (proxyOpts.props) {
2072
2090
  warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
2073
2091
  }
2092
+ if (props.expandConfig) {
2093
+ warnLog('vxe.error.notProp', ['expand-config'])
2094
+ }
2095
+ if (props.aggregateConfig) {
2096
+ warnLog('vxe.error.notProp', ['aggregate-config'])
2097
+ }
2074
2098
 
2075
2099
  $xeGantt.$nextTick(() => {
2076
2100
  if (props.formConfig) {
@@ -259,6 +259,13 @@
259
259
  background-position: right bottom;
260
260
  }
261
261
  }
262
+ &.border--default,
263
+ &.border--full,
264
+ &.border--inner {
265
+ .vxe-gantt-view--footer-wrapper {
266
+ border-top: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
267
+ }
268
+ }
262
269
  &.border--inner {
263
270
  .vxe-gantt--border-line {
264
271
  border-width: 0 0 1px 0;
@@ -531,6 +538,9 @@
531
538
  float: left;
532
539
  }
533
540
  }
541
+ .vxe-gantt-view--header-table {
542
+ height: 100%;
543
+ }
534
544
  .vxe-gantt-view--header-table,
535
545
  .vxe-gantt-view--body-table {
536
546
  border: 0;
@@ -544,6 +554,10 @@
544
554
  .vxe-gantt-view--header-wrapper {
545
555
  background-color: var(--vxe-ui-table-header-background-color);
546
556
  }
557
+ .vxe-gantt-view--footer-wrapper {
558
+ margin-top: calc(var(--vxe-ui-table-border-width) * -1);
559
+ background-color: var(--vxe-ui-table-footer-background-color);
560
+ }
547
561
  .vxe-gantt-view--header-wrapper,
548
562
  .vxe-gantt-view--body-wrapper {
549
563
  overflow: hidden;
@@ -583,6 +597,12 @@
583
597
  &.row--stripe {
584
598
  background-color: var(--vxe-ui-table-row-striped-background-color);
585
599
  }
600
+ &.row--radio {
601
+ background-color: var(--vxe-ui-table-row-radio-checked-background-color);
602
+ }
603
+ &.row--checked {
604
+ background-color: var(--vxe-ui-table-row-checkbox-checked-background-color);
605
+ }
586
606
  &.row--current {
587
607
  background-color: var(--vxe-ui-table-row-current-background-color);
588
608
  }
@@ -591,6 +611,12 @@
591
611
  &.row--stripe {
592
612
  background-color: var(--vxe-ui-table-row-hover-striped-background-color);
593
613
  }
614
+ &.row--radio {
615
+ background-color: var(--vxe-ui-table-row-hover-radio-checked-background-color);
616
+ }
617
+ &.row--checked {
618
+ background-color: var(--vxe-ui-table-row-hover-checkbox-checked-background-color);
619
+ }
594
620
  &.row--current {
595
621
  background-color: var(--vxe-ui-table-row-hover-current-background-color);
596
622
  }