vxe-gantt 0.0.3 → 3.0.0-beta.1
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/README.md +14 -46
- package/es/components.js +3 -2
- package/es/gantt/src/gantt-body.js +83 -49
- package/es/gantt/src/gantt-chart.js +91 -43
- package/es/gantt/src/gantt-header.js +63 -36
- package/es/gantt/src/gantt-view.js +638 -586
- package/es/gantt/src/gantt.js +1346 -1178
- package/es/gantt/src/util.js +1 -4
- package/es/gantt/style.css +62 -28
- package/es/gantt/style.min.css +1 -1
- package/es/index.esm.js +5 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +9 -3
- package/es/ui/src/comp.js +1 -2
- package/es/ui/src/log.js +3 -2
- package/es/ui/src/utils.js +17 -17
- package/es/vxe-gantt/style.css +62 -28
- package/es/vxe-gantt/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/components.js +20 -19
- package/lib/components.min.js +1 -1
- package/lib/gantt/index.js +3 -3
- package/lib/gantt/index.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +109 -87
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +109 -69
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +75 -56
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +684 -686
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +1630 -1559
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +1 -4
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +62 -28
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.common.js +12 -7
- package/lib/index.umd.js +10704 -5870
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +12 -16
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/comp.js +3 -2
- package/lib/ui/src/comp.min.js +1 -1
- package/lib/ui/src/dom.js +33 -33
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +4 -3
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +21 -24
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/vxe-gantt/index.js +4 -2
- package/lib/vxe-gantt/index.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +62 -28
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/lib/vxe-ui/index.js +4 -2
- package/lib/vxe-ui/index.min.js +1 -1
- package/package.json +13 -13
- package/packages/components.ts +8 -5
- package/packages/gantt/index.ts +2 -2
- package/packages/gantt/src/gantt-body.ts +89 -53
- package/packages/gantt/src/gantt-chart.ts +100 -49
- package/packages/gantt/src/gantt-header.ts +69 -39
- package/packages/gantt/src/gantt-view.ts +692 -624
- package/packages/gantt/src/gantt.ts +1459 -1240
- package/packages/gantt/src/util.ts +1 -4
- package/packages/index.ts +6 -2
- package/packages/ui/index.ts +9 -3
- package/packages/ui/src/comp.ts +2 -2
- package/packages/ui/src/log.ts +3 -1
- package/packages/ui/src/utils.ts +22 -21
- package/styles/components/gantt-module/gantt-chart.scss +28 -9
- package/styles/components/gantt.scss +36 -21
- package/styles/theme/base.scss +5 -1
- package/types/all.d.ts +3 -3
- package/types/index.d.ts +2 -2
- package/README.en.md +0 -72
- package/README.ja-JP.md +0 -72
- package/README.zh-TW.md +0 -73
- package/es/gantt/src/emits.js +0 -4
- package/es/gantt/src/grid-emits.js +0 -16
- package/es/gantt/src/grid-props.js +0 -7
- package/es/gantt/src/props.js +0 -2
- package/es/gantt/src/table-emits.js +0 -97
- package/es/gantt/src/table-props.js +0 -298
- package/lib/gantt/src/emits.js +0 -8
- package/lib/gantt/src/emits.min.js +0 -1
- package/lib/gantt/src/grid-emits.js +0 -8
- package/lib/gantt/src/grid-emits.min.js +0 -1
- package/lib/gantt/src/grid-props.js +0 -24
- package/lib/gantt/src/grid-props.min.js +0 -1
- package/lib/gantt/src/props.js +0 -13
- package/lib/gantt/src/props.min.js +0 -1
- package/lib/gantt/src/table-emits.js +0 -7
- package/lib/gantt/src/table-emits.min.js +0 -1
- package/lib/gantt/src/table-props.js +0 -306
- package/lib/gantt/src/table-props.min.js +0 -1
- package/packages/gantt/src/emits.ts +0 -7
- package/packages/gantt/src/grid-emits.ts +0 -19
- package/packages/gantt/src/grid-props.ts +0 -23
- package/packages/gantt/src/props.ts +0 -13
- package/packages/gantt/src/table-emits.ts +0 -109
- package/packages/gantt/src/table-props.ts +0 -304
|
@@ -1,92 +1,143 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VNode, CreateElement } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
4
|
import XEUtils from 'xe-utils'
|
|
4
5
|
import { getCellRestHeight } from './util'
|
|
6
|
+
import { getStringValue } from '../../ui/src/utils'
|
|
5
7
|
|
|
6
|
-
import type { VxeTablePropTypes } from 'vxe-table'
|
|
8
|
+
import type { VxeTablePropTypes, TableInternalData } from 'vxe-table'
|
|
7
9
|
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
8
10
|
|
|
11
|
+
const { renderEmptyElement } = VxeUI
|
|
12
|
+
|
|
9
13
|
export default defineVxeComponent({
|
|
10
14
|
name: 'VxeGanttViewChart',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
inject: {
|
|
16
|
+
$xeGantt: {
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
$xeGanttView: {
|
|
20
|
+
default: null
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
props: {},
|
|
24
|
+
data () {
|
|
25
|
+
return {}
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
...({} as {
|
|
29
|
+
$xeGantt(): (VxeGanttConstructor & VxeGanttPrivateMethods)
|
|
30
|
+
$xeGanttView(): (VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
//
|
|
35
|
+
// Render
|
|
36
|
+
//
|
|
37
|
+
renderVN (h: CreateElement) {
|
|
38
|
+
const _vm = this
|
|
39
|
+
const $xeGantt = _vm.$xeGantt
|
|
40
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
41
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
23
42
|
|
|
24
|
-
const
|
|
43
|
+
const tableInternalData = ($xeTable ? $xeTable as unknown : {}) as TableInternalData
|
|
44
|
+
const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {}
|
|
25
45
|
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
26
46
|
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
27
47
|
let defaultRowHeight = 0
|
|
28
48
|
if ($xeTable) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
defaultRowHeight = computeDefaultRowHeight.value
|
|
49
|
+
cellOpts = $xeTable.computeCellOpts
|
|
50
|
+
rowOpts = $xeTable.computeRowOpts
|
|
51
|
+
defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
33
52
|
}
|
|
34
53
|
|
|
54
|
+
const { reactData } = $xeGanttView
|
|
35
55
|
const { tableData } = reactData
|
|
36
|
-
const
|
|
56
|
+
const titleField = $xeGantt.computeTitleField
|
|
57
|
+
const progressField = $xeGantt.computeProgressField
|
|
58
|
+
const taskBarOpts = $xeGantt.computeTaskBarOpts
|
|
59
|
+
const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts
|
|
60
|
+
const { round } = barStyle || {}
|
|
37
61
|
|
|
38
|
-
const trVNs:VNode[] = []
|
|
62
|
+
const trVNs: VNode[] = []
|
|
39
63
|
tableData.forEach((row, rIndex) => {
|
|
40
64
|
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
41
65
|
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
42
66
|
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
43
|
-
|
|
67
|
+
let title = getStringValue(XEUtils.get(row, titleField))
|
|
68
|
+
const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0
|
|
69
|
+
if (contentMethod) {
|
|
70
|
+
title = getStringValue(contentMethod({ row, title }))
|
|
71
|
+
}
|
|
44
72
|
trVNs.push(
|
|
45
73
|
h('div', {
|
|
46
74
|
key: rIndex,
|
|
47
|
-
|
|
48
|
-
|
|
75
|
+
attrs: {
|
|
76
|
+
rowid
|
|
77
|
+
},
|
|
78
|
+
class: ['vxe-gantt-view--chart-row', {
|
|
79
|
+
'is--round': round
|
|
80
|
+
}],
|
|
49
81
|
style: {
|
|
50
82
|
height: `${cellHeight}px`
|
|
51
83
|
}
|
|
52
84
|
}, [
|
|
53
85
|
h('div', {
|
|
54
86
|
class: 'vxe-gantt-view--chart-bar',
|
|
55
|
-
|
|
87
|
+
attrs: {
|
|
88
|
+
rowid
|
|
89
|
+
},
|
|
90
|
+
on: {
|
|
91
|
+
click (evnt: MouseEvent) {
|
|
92
|
+
$xeGantt.handleTaskBarClickEvent(evnt, { row })
|
|
93
|
+
},
|
|
94
|
+
dblclick (evnt: MouseEvent) {
|
|
95
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, { row })
|
|
96
|
+
}
|
|
97
|
+
}
|
|
56
98
|
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
99
|
+
showProgress
|
|
100
|
+
? h('div', {
|
|
101
|
+
class: 'vxe-gantt-view--chart-progress',
|
|
102
|
+
style: {
|
|
103
|
+
width: `${progressValue || 0}%`
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
: renderEmptyElement($xeGantt),
|
|
107
|
+
showContent
|
|
108
|
+
? h('div', {
|
|
109
|
+
class: 'vxe-gantt-view--chart-content'
|
|
110
|
+
}, title)
|
|
111
|
+
: renderEmptyElement($xeGantt)
|
|
68
112
|
])
|
|
69
113
|
])
|
|
70
114
|
)
|
|
71
115
|
})
|
|
72
116
|
return h('div', {
|
|
73
|
-
ref: refElem,
|
|
117
|
+
ref: 'refElem',
|
|
74
118
|
class: 'vxe-gantt-view--chart-wrapper'
|
|
75
119
|
}, trVNs)
|
|
76
120
|
}
|
|
121
|
+
},
|
|
122
|
+
mounted () {
|
|
123
|
+
const _vm = this
|
|
124
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
125
|
+
const { internalData } = $xeGanttView
|
|
77
126
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const prefix = 'main-chart-'
|
|
87
|
-
elemStore[`${prefix}wrapper`] = null
|
|
88
|
-
})
|
|
127
|
+
const { elemStore } = internalData
|
|
128
|
+
const prefix = 'main-chart-'
|
|
129
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem as HTMLDivElement
|
|
130
|
+
},
|
|
131
|
+
destroyed () {
|
|
132
|
+
const _vm = this
|
|
133
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
134
|
+
const { internalData } = $xeGanttView
|
|
89
135
|
|
|
90
|
-
|
|
136
|
+
const { elemStore } = internalData
|
|
137
|
+
const prefix = 'main-chart-'
|
|
138
|
+
elemStore[`${prefix}wrapper`] = null
|
|
139
|
+
},
|
|
140
|
+
render (this: any, h) {
|
|
141
|
+
return this.renderVN(h)
|
|
91
142
|
}
|
|
92
143
|
})
|
|
@@ -1,42 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateElement } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
|
|
4
|
-
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods } from '../../../types'
|
|
4
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
5
5
|
|
|
6
6
|
export default defineVxeComponent({
|
|
7
7
|
name: 'VxeGanttView',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
inject: {
|
|
9
|
+
$xeGantt: {
|
|
10
|
+
default: null
|
|
11
|
+
},
|
|
12
|
+
$xeGanttView: {
|
|
13
|
+
default: null
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
props: {},
|
|
17
|
+
data () {
|
|
18
|
+
return {}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
...({} as {
|
|
22
|
+
$xeGantt(): (VxeGanttConstructor & VxeGanttPrivateMethods)
|
|
23
|
+
$xeGanttView(): (VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
//
|
|
28
|
+
// Render
|
|
29
|
+
//
|
|
30
|
+
renderVN (h: CreateElement) {
|
|
31
|
+
const _vm = this
|
|
32
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
33
|
+
const { reactData } = $xeGanttView
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
const { tableColumn, headerGroups } = reactData
|
|
35
|
+
const { tableColumn, headerGroups, viewCellWidth } = reactData
|
|
20
36
|
return h('div', {
|
|
21
|
-
ref: refElem,
|
|
37
|
+
ref: 'refElem',
|
|
22
38
|
class: 'vxe-gantt-view--header-wrapper'
|
|
23
39
|
}, [
|
|
24
40
|
h('div', {
|
|
25
|
-
ref: refHeaderScroll,
|
|
41
|
+
ref: 'refHeaderScroll',
|
|
26
42
|
class: 'vxe-gantt-view--header-inner-wrapper',
|
|
27
|
-
|
|
43
|
+
on: {
|
|
44
|
+
scroll: $xeGanttView.triggerHeaderScrollEvent
|
|
45
|
+
}
|
|
28
46
|
}, [
|
|
29
47
|
h('div', {
|
|
30
|
-
ref: refHeaderXSpace,
|
|
48
|
+
ref: 'refHeaderXSpace',
|
|
31
49
|
class: 'vxe-body--x-space'
|
|
32
50
|
}),
|
|
33
51
|
h('table', {
|
|
34
|
-
ref: refHeaderTable,
|
|
52
|
+
ref: 'refHeaderTable',
|
|
35
53
|
class: 'vxe-gantt-view--header-table'
|
|
36
54
|
}, [
|
|
37
55
|
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
38
56
|
return h('col', {
|
|
39
|
-
key: cIndex
|
|
57
|
+
key: cIndex,
|
|
58
|
+
style: {
|
|
59
|
+
width: `${viewCellWidth}px`
|
|
60
|
+
}
|
|
40
61
|
})
|
|
41
62
|
})),
|
|
42
63
|
h('thead', {}, headerGroups.map((cols, rIndex) => {
|
|
@@ -46,8 +67,10 @@ export default defineVxeComponent({
|
|
|
46
67
|
return h('th', {
|
|
47
68
|
key: cIndex,
|
|
48
69
|
class: 'vxe-gantt-view--header-column',
|
|
49
|
-
|
|
50
|
-
|
|
70
|
+
attrs: {
|
|
71
|
+
colspan: column.children ? column.children.length : null,
|
|
72
|
+
title: `${column.field}`
|
|
73
|
+
}
|
|
51
74
|
}, column.title)
|
|
52
75
|
}))
|
|
53
76
|
}))
|
|
@@ -55,25 +78,32 @@ export default defineVxeComponent({
|
|
|
55
78
|
])
|
|
56
79
|
])
|
|
57
80
|
}
|
|
81
|
+
},
|
|
82
|
+
mounted () {
|
|
83
|
+
const _vm = this
|
|
84
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
85
|
+
const { internalData } = $xeGanttView
|
|
58
86
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const prefix = 'main-header-'
|
|
71
|
-
elemStore[`${prefix}wrapper`] = null
|
|
72
|
-
elemStore[`${prefix}scroll`] = null
|
|
73
|
-
elemStore[`${prefix}table`] = null
|
|
74
|
-
elemStore[`${prefix}xSpace`] = null
|
|
75
|
-
})
|
|
87
|
+
const { elemStore } = internalData
|
|
88
|
+
const prefix = 'main-header-'
|
|
89
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem as HTMLDivElement
|
|
90
|
+
elemStore[`${prefix}scroll`] = _vm.$refs.refHeaderScroll as HTMLDivElement
|
|
91
|
+
elemStore[`${prefix}table`] = _vm.$refs.refHeaderTable as HTMLDivElement
|
|
92
|
+
elemStore[`${prefix}xSpace`] = _vm.$refs.refHeaderXSpace as HTMLDivElement
|
|
93
|
+
},
|
|
94
|
+
destroyed () {
|
|
95
|
+
const _vm = this
|
|
96
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
97
|
+
const { internalData } = $xeGanttView
|
|
76
98
|
|
|
77
|
-
|
|
99
|
+
const { elemStore } = internalData
|
|
100
|
+
const prefix = 'main-header-'
|
|
101
|
+
elemStore[`${prefix}wrapper`] = null
|
|
102
|
+
elemStore[`${prefix}scroll`] = null
|
|
103
|
+
elemStore[`${prefix}table`] = null
|
|
104
|
+
elemStore[`${prefix}xSpace`] = null
|
|
105
|
+
},
|
|
106
|
+
render (this: any, h) {
|
|
107
|
+
return this.renderVN(h)
|
|
78
108
|
}
|
|
79
109
|
})
|