vxe-gantt 0.0.2 → 3.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/README.md +18 -24
- package/es/components.js +3 -2
- package/es/gantt/src/gantt-body.js +137 -0
- package/es/gantt/src/gantt-chart.js +125 -0
- package/es/gantt/src/gantt-header.js +97 -0
- package/es/gantt/src/gantt-view.js +820 -0
- package/es/gantt/src/gantt.js +1897 -43
- package/es/gantt/src/util.js +9 -0
- package/es/gantt/style.css +624 -0
- package/es/gantt/style.min.css +1 -0
- package/es/index.esm.js +5 -2
- package/es/style.css +1 -0
- package/es/style.min.css +1 -0
- package/es/ui/index.js +55 -5
- package/es/ui/src/comp.js +1 -2
- package/es/ui/src/dom.js +44 -105
- package/es/ui/src/log.js +3 -2
- package/es/ui/src/utils.js +4 -3
- package/es/ui/src/vn.js +1 -32
- package/es/vxe-gantt/style.css +624 -0
- package/es/vxe-gantt/style.min.css +1 -0
- 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 +140 -0
- package/lib/gantt/src/gantt-body.min.js +1 -0
- package/lib/gantt/src/gantt-chart.js +134 -0
- package/lib/gantt/src/gantt-chart.min.js +1 -0
- package/lib/gantt/src/gantt-header.js +97 -0
- package/lib/gantt/src/gantt-header.min.js +1 -0
- package/lib/gantt/src/gantt-view.js +808 -0
- package/lib/gantt/src/gantt-view.min.js +1 -0
- package/lib/gantt/src/gantt.js +2045 -48
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +16 -0
- package/lib/gantt/src/util.min.js +1 -0
- package/lib/gantt/style/style.css +624 -0
- package/lib/gantt/style/style.min.css +1 -0
- package/lib/index.common.js +12 -7
- package/lib/index.umd.js +11484 -235
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -0
- package/lib/style.min.css +1 -0
- package/lib/ui/index.js +54 -14
- 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 +78 -138
- 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 +5 -4
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/ui/src/vn.js +1 -43
- package/lib/ui/src/vn.min.js +0 -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 +624 -0
- package/lib/vxe-gantt/style/style.min.css +1 -0
- 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 +155 -0
- package/packages/gantt/src/gantt-chart.ts +143 -0
- package/packages/gantt/src/gantt-header.ts +109 -0
- package/packages/gantt/src/gantt-view.ts +908 -0
- package/packages/gantt/src/gantt.ts +2048 -46
- package/packages/gantt/src/util.ts +12 -0
- package/packages/index.ts +6 -2
- package/packages/ui/index.ts +56 -4
- package/packages/ui/src/comp.ts +2 -2
- package/packages/ui/src/dom.ts +53 -110
- package/packages/ui/src/log.ts +4 -2
- package/packages/ui/src/utils.ts +5 -3
- package/packages/ui/src/vn.ts +0 -37
- package/styles/components/gantt-module/all.scss +1 -0
- package/styles/components/gantt-module/gantt-chart.scss +65 -0
- package/styles/components/gantt.scss +591 -0
- package/styles/helpers/baseMixin.scss +96 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/helpers/placement.scss +39 -0
- package/styles/theme/base.scss +11 -0
- package/styles/theme/dark.scss +5 -0
- package/styles/theme/light.scss +5 -0
- 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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-gantt",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
|
+
"description": "A vue based gantt component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
7
7
|
"serve": "vue-cli-service serve",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
],
|
|
21
21
|
"main": "lib/index.common.js",
|
|
22
22
|
"module": "es/index.esm.js",
|
|
23
|
-
"unpkg": "lib/index.umd.js",
|
|
23
|
+
"unpkg": "lib/index.umd.js",
|
|
24
24
|
"jsdelivr": "lib/index.umd.js",
|
|
25
25
|
"style": "lib/style.css",
|
|
26
26
|
"typings": "types/index.d.ts",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"vxe-pc-ui": "^
|
|
29
|
-
"vxe-table": "^
|
|
28
|
+
"vxe-pc-ui": "^3.8.0",
|
|
29
|
+
"vxe-table": "^3.17.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
@@ -57,14 +57,15 @@
|
|
|
57
57
|
"gulp-sourcemaps": "^3.0.0",
|
|
58
58
|
"gulp-typescript": "^5.0.1",
|
|
59
59
|
"gulp-uglify": "^3.0.2",
|
|
60
|
-
"postcss": "^8.4.38",
|
|
61
60
|
"sass": "^1.80.4",
|
|
62
61
|
"sass-loader": "^14.2.1",
|
|
63
|
-
"typescript": "~4.
|
|
64
|
-
"vue": "
|
|
65
|
-
"vue
|
|
66
|
-
"
|
|
67
|
-
"
|
|
62
|
+
"typescript": "~4.5.5",
|
|
63
|
+
"vue-template-compiler": "2.6.14",
|
|
64
|
+
"vue": "~2.6.14",
|
|
65
|
+
"vue-i18n": "^8.15.1",
|
|
66
|
+
"vue-router": "^3.5.1",
|
|
67
|
+
"vxe-pc-ui": "^3.8.15",
|
|
68
|
+
"vxe-table": "^3.17.8"
|
|
68
69
|
},
|
|
69
70
|
"vetur": {
|
|
70
71
|
"tags": "helper/vetur/tags.json",
|
|
@@ -87,6 +88,5 @@
|
|
|
87
88
|
"license": "MIT",
|
|
88
89
|
"bugs": {
|
|
89
90
|
"url": "https://github.com/x-extends/vxe-gantt/issues"
|
|
90
|
-
}
|
|
91
|
-
"homepage": "https://github.com/x-extends/vxe-gantt/"
|
|
91
|
+
}
|
|
92
92
|
}
|
package/packages/components.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { VueConstructor } from 'vue'
|
|
2
|
+
import VxeUI from './ui'
|
|
4
3
|
import VxeGantt from './gantt'
|
|
5
4
|
|
|
5
|
+
import type { VxeGlobalConfig } from 'vxe-pc-ui'
|
|
6
|
+
|
|
7
|
+
const { setConfig } = VxeUI
|
|
8
|
+
|
|
6
9
|
const components = [
|
|
7
10
|
VxeGantt
|
|
8
11
|
]
|
|
9
12
|
|
|
10
|
-
export function install (app:
|
|
13
|
+
export function install (app: VueConstructor, options?: VxeGlobalConfig) {
|
|
11
14
|
setConfig(options)
|
|
12
15
|
|
|
13
16
|
components.forEach(component => app.use(component))
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export
|
|
19
|
+
export { VxeUI }
|
|
17
20
|
|
|
18
21
|
// Components
|
|
19
22
|
export * from './gantt'
|
package/packages/gantt/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VueConstructor } from 'vue'
|
|
2
2
|
import { VxeUI } from '@vxe-ui/core'
|
|
3
3
|
import VxeGanttComponent from './src/gantt'
|
|
4
4
|
|
|
5
5
|
export const VxeGantt = Object.assign({}, VxeGanttComponent, {
|
|
6
|
-
install (app:
|
|
6
|
+
install (app: VueConstructor) {
|
|
7
7
|
app.component(VxeGanttComponent.name as string, VxeGanttComponent)
|
|
8
8
|
}
|
|
9
9
|
})
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { VNode, CreateElement } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { getCellRestHeight } from './util'
|
|
4
|
+
import GanttViewChartComponent from './gantt-chart'
|
|
5
|
+
|
|
6
|
+
import type { VxeTablePropTypes, TableInternalData } from 'vxe-table'
|
|
7
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
8
|
+
|
|
9
|
+
export default defineVxeComponent({
|
|
10
|
+
name: 'VxeGanttViewBody',
|
|
11
|
+
inject: {
|
|
12
|
+
$xeGantt: {
|
|
13
|
+
default: null
|
|
14
|
+
},
|
|
15
|
+
$xeGanttView: {
|
|
16
|
+
default: null
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
props: {},
|
|
20
|
+
data () {
|
|
21
|
+
return {}
|
|
22
|
+
},
|
|
23
|
+
computed: {
|
|
24
|
+
...({} as {
|
|
25
|
+
$xeGantt(): (VxeGanttConstructor & VxeGanttPrivateMethods)
|
|
26
|
+
$xeGanttView(): (VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
//
|
|
31
|
+
// Render
|
|
32
|
+
//
|
|
33
|
+
renderRows (h: CreateElement) {
|
|
34
|
+
const _vm = this
|
|
35
|
+
const $xeGantt = _vm.$xeGantt
|
|
36
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
37
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
38
|
+
|
|
39
|
+
const tableInternalData = ($xeTable ? $xeTable as unknown : {}) as TableInternalData
|
|
40
|
+
const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {}
|
|
41
|
+
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
42
|
+
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
43
|
+
let defaultRowHeight = 0
|
|
44
|
+
if ($xeTable) {
|
|
45
|
+
cellOpts = $xeTable.computeCellOpts
|
|
46
|
+
rowOpts = $xeTable.computeRowOpts
|
|
47
|
+
defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { reactData } = $xeGanttView
|
|
51
|
+
const { tableData, tableColumn } = reactData
|
|
52
|
+
|
|
53
|
+
const trVNs:VNode[] = []
|
|
54
|
+
tableData.forEach((row, rIndex) => {
|
|
55
|
+
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
56
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
57
|
+
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
58
|
+
trVNs.push(
|
|
59
|
+
h('tr', {
|
|
60
|
+
key: rIndex
|
|
61
|
+
}, tableColumn.map((column, cIndex) => {
|
|
62
|
+
return h('td', {
|
|
63
|
+
key: cIndex,
|
|
64
|
+
class: 'vxe-gantt-view--body-column',
|
|
65
|
+
style: {
|
|
66
|
+
height: `${cellHeight}px`
|
|
67
|
+
},
|
|
68
|
+
on: {
|
|
69
|
+
click (evnt: MouseEvent) {
|
|
70
|
+
$xeGantt.handleTaskCellClickEvent(evnt, { row })
|
|
71
|
+
},
|
|
72
|
+
dblclick (evnt: MouseEvent) {
|
|
73
|
+
$xeGantt.handleTaskCellDblclickEvent(evnt, { row })
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}))
|
|
78
|
+
)
|
|
79
|
+
})
|
|
80
|
+
return trVNs
|
|
81
|
+
},
|
|
82
|
+
renderVN (h: CreateElement) {
|
|
83
|
+
const _vm = this
|
|
84
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
85
|
+
const { reactData } = $xeGanttView
|
|
86
|
+
|
|
87
|
+
const { tableColumn, viewCellWidth } = reactData
|
|
88
|
+
return h('div', {
|
|
89
|
+
ref: 'refElem',
|
|
90
|
+
class: 'vxe-gantt-view--body-wrapper'
|
|
91
|
+
}, [
|
|
92
|
+
h('div', {
|
|
93
|
+
ref: 'refBodyScroll',
|
|
94
|
+
class: 'vxe-gantt-view--body-inner-wrapper',
|
|
95
|
+
on: {
|
|
96
|
+
scroll: $xeGanttView.triggerBodyScrollEvent
|
|
97
|
+
}
|
|
98
|
+
}, [
|
|
99
|
+
h('div', {
|
|
100
|
+
ref: 'refBodyXSpace',
|
|
101
|
+
class: 'vxe-body--x-space'
|
|
102
|
+
}),
|
|
103
|
+
h('div', {
|
|
104
|
+
ref: 'refBodyYSpace',
|
|
105
|
+
class: 'vxe-body--y-space'
|
|
106
|
+
}),
|
|
107
|
+
h('table', {
|
|
108
|
+
ref: 'refBodyTable',
|
|
109
|
+
class: 'vxe-gantt-view--body-table'
|
|
110
|
+
}, [
|
|
111
|
+
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
112
|
+
return h('col', {
|
|
113
|
+
key: cIndex,
|
|
114
|
+
style: {
|
|
115
|
+
width: `${viewCellWidth}px`
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
})),
|
|
119
|
+
h('tbody', {}, _vm.renderRows(h))
|
|
120
|
+
]),
|
|
121
|
+
h(GanttViewChartComponent)
|
|
122
|
+
])
|
|
123
|
+
])
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
mounted () {
|
|
127
|
+
const _vm = this
|
|
128
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
129
|
+
const { internalData } = $xeGanttView
|
|
130
|
+
|
|
131
|
+
const { elemStore } = internalData
|
|
132
|
+
const prefix = 'main-body-'
|
|
133
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem as HTMLDivElement
|
|
134
|
+
elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll as HTMLDivElement
|
|
135
|
+
elemStore[`${prefix}table`] = _vm.$refs.refBodyTable as HTMLDivElement
|
|
136
|
+
elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace as HTMLDivElement
|
|
137
|
+
elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace as HTMLDivElement
|
|
138
|
+
},
|
|
139
|
+
destroyed () {
|
|
140
|
+
const _vm = this
|
|
141
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
142
|
+
const { internalData } = $xeGanttView
|
|
143
|
+
|
|
144
|
+
const { elemStore } = internalData
|
|
145
|
+
const prefix = 'main-body-'
|
|
146
|
+
elemStore[`${prefix}wrapper`] = null
|
|
147
|
+
elemStore[`${prefix}scroll`] = null
|
|
148
|
+
elemStore[`${prefix}table`] = null
|
|
149
|
+
elemStore[`${prefix}xSpace`] = null
|
|
150
|
+
elemStore[`${prefix}ySpace`] = null
|
|
151
|
+
},
|
|
152
|
+
render (this: any, h) {
|
|
153
|
+
return this.renderVN(h)
|
|
154
|
+
}
|
|
155
|
+
})
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { VNode, CreateElement } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
4
|
+
import XEUtils from 'xe-utils'
|
|
5
|
+
import { getCellRestHeight } from './util'
|
|
6
|
+
import { getStringValue } from '../../ui/src/utils'
|
|
7
|
+
|
|
8
|
+
import type { VxeTablePropTypes, TableInternalData } from 'vxe-table'
|
|
9
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
10
|
+
|
|
11
|
+
const { renderEmptyElement } = VxeUI
|
|
12
|
+
|
|
13
|
+
export default defineVxeComponent({
|
|
14
|
+
name: 'VxeGanttViewChart',
|
|
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
|
|
42
|
+
|
|
43
|
+
const tableInternalData = ($xeTable ? $xeTable as unknown : {}) as TableInternalData
|
|
44
|
+
const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {}
|
|
45
|
+
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
46
|
+
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
47
|
+
let defaultRowHeight = 0
|
|
48
|
+
if ($xeTable) {
|
|
49
|
+
cellOpts = $xeTable.computeCellOpts
|
|
50
|
+
rowOpts = $xeTable.computeRowOpts
|
|
51
|
+
defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { reactData } = $xeGanttView
|
|
55
|
+
const { tableData } = reactData
|
|
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 || {}
|
|
61
|
+
|
|
62
|
+
const trVNs: VNode[] = []
|
|
63
|
+
tableData.forEach((row, rIndex) => {
|
|
64
|
+
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
65
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
66
|
+
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
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
|
+
}
|
|
72
|
+
trVNs.push(
|
|
73
|
+
h('div', {
|
|
74
|
+
key: rIndex,
|
|
75
|
+
attrs: {
|
|
76
|
+
rowid
|
|
77
|
+
},
|
|
78
|
+
class: ['vxe-gantt-view--chart-row', {
|
|
79
|
+
'is--round': round
|
|
80
|
+
}],
|
|
81
|
+
style: {
|
|
82
|
+
height: `${cellHeight}px`
|
|
83
|
+
}
|
|
84
|
+
}, [
|
|
85
|
+
h('div', {
|
|
86
|
+
class: 'vxe-gantt-view--chart-bar',
|
|
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
|
+
}
|
|
98
|
+
}, [
|
|
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)
|
|
112
|
+
])
|
|
113
|
+
])
|
|
114
|
+
)
|
|
115
|
+
})
|
|
116
|
+
return h('div', {
|
|
117
|
+
ref: 'refElem',
|
|
118
|
+
class: 'vxe-gantt-view--chart-wrapper'
|
|
119
|
+
}, trVNs)
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
mounted () {
|
|
123
|
+
const _vm = this
|
|
124
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
125
|
+
const { internalData } = $xeGanttView
|
|
126
|
+
|
|
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
|
|
135
|
+
|
|
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)
|
|
142
|
+
}
|
|
143
|
+
})
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CreateElement } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
|
|
4
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
5
|
+
|
|
6
|
+
export default defineVxeComponent({
|
|
7
|
+
name: 'VxeGanttView',
|
|
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
|
|
34
|
+
|
|
35
|
+
const { tableColumn, headerGroups, viewCellWidth } = reactData
|
|
36
|
+
return h('div', {
|
|
37
|
+
ref: 'refElem',
|
|
38
|
+
class: 'vxe-gantt-view--header-wrapper'
|
|
39
|
+
}, [
|
|
40
|
+
h('div', {
|
|
41
|
+
ref: 'refHeaderScroll',
|
|
42
|
+
class: 'vxe-gantt-view--header-inner-wrapper',
|
|
43
|
+
on: {
|
|
44
|
+
scroll: $xeGanttView.triggerHeaderScrollEvent
|
|
45
|
+
}
|
|
46
|
+
}, [
|
|
47
|
+
h('div', {
|
|
48
|
+
ref: 'refHeaderXSpace',
|
|
49
|
+
class: 'vxe-body--x-space'
|
|
50
|
+
}),
|
|
51
|
+
h('table', {
|
|
52
|
+
ref: 'refHeaderTable',
|
|
53
|
+
class: 'vxe-gantt-view--header-table'
|
|
54
|
+
}, [
|
|
55
|
+
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
56
|
+
return h('col', {
|
|
57
|
+
key: cIndex,
|
|
58
|
+
style: {
|
|
59
|
+
width: `${viewCellWidth}px`
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
})),
|
|
63
|
+
h('thead', {}, headerGroups.map((cols, rIndex) => {
|
|
64
|
+
return h('tr', {
|
|
65
|
+
key: rIndex
|
|
66
|
+
}, cols.map((column, cIndex) => {
|
|
67
|
+
return h('th', {
|
|
68
|
+
key: cIndex,
|
|
69
|
+
class: 'vxe-gantt-view--header-column',
|
|
70
|
+
attrs: {
|
|
71
|
+
colspan: column.children ? column.children.length : null,
|
|
72
|
+
title: `${column.field}`
|
|
73
|
+
}
|
|
74
|
+
}, column.title)
|
|
75
|
+
}))
|
|
76
|
+
}))
|
|
77
|
+
])
|
|
78
|
+
])
|
|
79
|
+
])
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
mounted () {
|
|
83
|
+
const _vm = this
|
|
84
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
85
|
+
const { internalData } = $xeGanttView
|
|
86
|
+
|
|
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
|
|
98
|
+
|
|
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)
|
|
108
|
+
}
|
|
109
|
+
})
|