vxe-gantt 0.0.3 → 4.0.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-gantt",
3
- "version": "0.0.3",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "A Gantt chart based on Vxe UI and for use on PC systems",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -1,11 +1,14 @@
1
1
  import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
+ import { VxeUI } from '../../ui'
3
4
  import XEUtils from 'xe-utils'
4
5
  import { getCellRestHeight } from './util'
5
6
 
6
7
  import type { VxeTablePropTypes } from 'vxe-table'
7
8
  import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
8
9
 
10
+ const { renderEmptyElement } = VxeUI
11
+
9
12
  export default defineVxeComponent({
10
13
  name: 'VxeGanttViewChart',
11
14
  setup () {
@@ -14,7 +17,7 @@ export default defineVxeComponent({
14
17
 
15
18
  const { reactData, internalData } = $xeGanttView
16
19
  const { refTable } = $xeGantt.getRefMaps()
17
- const { computeProgressField } = $xeGantt.getComputeMaps()
20
+ const { computeProgressField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
18
21
 
19
22
  const refElem = ref() as Ref<HTMLDivElement>
20
23
 
@@ -34,13 +37,15 @@ export default defineVxeComponent({
34
37
 
35
38
  const { tableData } = reactData
36
39
  const progressField = computeProgressField.value
40
+ const taskBarOpts = computeTaskBarOpts.value
41
+ const { showProgress } = taskBarOpts
37
42
 
38
43
  const trVNs:VNode[] = []
39
44
  tableData.forEach((row, rIndex) => {
40
45
  const rowid = $xeTable ? $xeTable.getRowid(row) : ''
41
46
  const rowRest = fullAllDataRowIdData[rowid] || {}
42
47
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
43
- const progressValue = XEUtils.get(row, progressField)
48
+ const progressValue = showProgress ? XEUtils.get(row, progressField) : 0
44
49
  trVNs.push(
45
50
  h('div', {
46
51
  key: rIndex,
@@ -54,14 +59,14 @@ export default defineVxeComponent({
54
59
  class: 'vxe-gantt-view--chart-bar',
55
60
  rowid
56
61
  }, [
57
- h('div', {
58
- class: 'vxe-gantt-view--chart-progress',
59
- style: progressValue
60
- ? {
61
- width: `${progressValue}%`
62
- }
63
- : undefined
64
- }),
62
+ showProgress
63
+ ? h('div', {
64
+ class: 'vxe-gantt-view--chart-progress',
65
+ style: {
66
+ width: `${progressValue || 0}%`
67
+ }
68
+ })
69
+ : renderEmptyElement($xeGantt),
65
70
  h('div', {
66
71
  class: 'vxe-gantt-view--chart-content'
67
72
  })
@@ -156,12 +156,12 @@ export default defineVxeComponent({
156
156
 
157
157
  const computeStartField = computed(() => {
158
158
  const taskOpts = computeTaskOpts.value
159
- return taskOpts.startField || 'startDate'
159
+ return taskOpts.startField || 'start'
160
160
  })
161
161
 
162
162
  const computeEndField = computed(() => {
163
163
  const taskOpts = computeTaskOpts.value
164
- return taskOpts.endField || 'endDate'
164
+ return taskOpts.endField || 'end'
165
165
  })
166
166
 
167
167
  const computeProgressField = computed(() => {
@@ -11,7 +11,7 @@
11
11
  display: flex;
12
12
  flex-direction: row;
13
13
  position: absolute;
14
- width: 100px;
14
+ width: 0;
15
15
  top: 50%;
16
16
  left: 0;
17
17
  color: #ffffff;