vxe-gantt 0.0.2 → 0.0.3
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 +27 -1
- package/es/gantt/src/emits.js +4 -0
- package/es/gantt/src/gantt-body.js +103 -0
- package/es/gantt/src/gantt-chart.js +77 -0
- package/es/gantt/src/gantt-header.js +70 -0
- package/es/gantt/src/gantt-view.js +768 -0
- package/es/gantt/src/gantt.js +1707 -22
- package/es/gantt/src/grid-emits.js +16 -0
- package/es/gantt/src/grid-props.js +7 -0
- package/es/gantt/src/props.js +2 -0
- package/es/gantt/src/table-emits.js +97 -0
- package/es/gantt/src/table-props.js +298 -0
- package/es/gantt/src/util.js +12 -0
- package/es/gantt/style.css +599 -0
- package/es/gantt/style.min.css +1 -0
- package/es/style.css +1 -0
- package/es/style.min.css +1 -0
- package/es/ui/index.js +47 -3
- package/es/ui/src/dom.js +44 -105
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +18 -17
- package/es/ui/src/vn.js +1 -32
- package/es/vxe-gantt/style.css +599 -0
- package/es/vxe-gantt/style.min.css +1 -0
- package/lib/gantt/src/emits.js +8 -0
- package/lib/gantt/src/emits.min.js +1 -0
- package/lib/gantt/src/gantt-body.js +118 -0
- package/lib/gantt/src/gantt-body.min.js +1 -0
- package/lib/gantt/src/gantt-chart.js +94 -0
- package/lib/gantt/src/gantt-chart.min.js +1 -0
- package/lib/gantt/src/gantt-header.js +78 -0
- package/lib/gantt/src/gantt-header.min.js +1 -0
- package/lib/gantt/src/gantt-view.js +810 -0
- package/lib/gantt/src/gantt-view.min.js +1 -0
- package/lib/gantt/src/gantt.js +1945 -20
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/grid-emits.js +8 -0
- package/lib/gantt/src/grid-emits.min.js +1 -0
- package/lib/gantt/src/grid-props.js +24 -0
- package/lib/gantt/src/grid-props.min.js +1 -0
- package/lib/gantt/src/props.js +13 -0
- package/lib/gantt/src/props.min.js +1 -0
- package/lib/gantt/src/table-emits.js +7 -0
- package/lib/gantt/src/table-emits.min.js +1 -0
- package/lib/gantt/src/table-props.js +306 -0
- package/lib/gantt/src/table-props.min.js +1 -0
- package/lib/gantt/src/util.js +19 -0
- package/lib/gantt/src/util.min.js +1 -0
- package/lib/gantt/style/style.css +599 -0
- package/lib/gantt/style/style.min.css +1 -0
- package/lib/index.umd.js +6554 -140
- 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 +47 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +50 -110
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +24 -20
- 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/style/style.css +599 -0
- package/lib/vxe-gantt/style/style.min.css +1 -0
- package/package.json +4 -4
- package/packages/gantt/src/emits.ts +7 -0
- package/packages/gantt/src/gantt-body.ts +119 -0
- package/packages/gantt/src/gantt-chart.ts +92 -0
- package/packages/gantt/src/gantt-header.ts +79 -0
- package/packages/gantt/src/gantt-view.ts +840 -0
- package/packages/gantt/src/gantt.ts +1806 -24
- package/packages/gantt/src/grid-emits.ts +19 -0
- package/packages/gantt/src/grid-props.ts +23 -0
- package/packages/gantt/src/props.ts +13 -0
- package/packages/gantt/src/table-emits.ts +109 -0
- package/packages/gantt/src/table-props.ts +304 -0
- package/packages/gantt/src/util.ts +15 -0
- package/packages/ui/index.ts +48 -2
- package/packages/ui/src/dom.ts +53 -110
- package/packages/ui/src/log.ts +1 -1
- package/packages/ui/src/utils.ts +22 -21
- 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 +46 -0
- package/styles/components/gantt.scss +586 -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 +7 -0
- package/styles/theme/dark.scss +5 -0
- package/styles/theme/light.scss +5 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } 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 } from 'vxe-table'
|
|
7
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
8
|
+
|
|
9
|
+
export default defineVxeComponent({
|
|
10
|
+
name: 'VxeGanttViewBody',
|
|
11
|
+
setup () {
|
|
12
|
+
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
13
|
+
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
14
|
+
|
|
15
|
+
const { reactData, internalData } = $xeGanttView
|
|
16
|
+
const { refTable } = $xeGantt.getRefMaps()
|
|
17
|
+
|
|
18
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
19
|
+
const refBodyScroll = ref() as Ref<HTMLDivElement>
|
|
20
|
+
const refBodyTable = ref() as Ref<HTMLTableElement>
|
|
21
|
+
const refBodyXSpace = ref() as Ref<HTMLDivElement>
|
|
22
|
+
const refBodyYSpace = ref() as Ref<HTMLDivElement>
|
|
23
|
+
|
|
24
|
+
const renderRows = () => {
|
|
25
|
+
const $xeTable = refTable.value
|
|
26
|
+
|
|
27
|
+
const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {}
|
|
28
|
+
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
29
|
+
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
30
|
+
let defaultRowHeight = 0
|
|
31
|
+
if ($xeTable) {
|
|
32
|
+
const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
|
|
33
|
+
cellOpts = computeCellOpts.value
|
|
34
|
+
rowOpts = computeRowOpts.value
|
|
35
|
+
defaultRowHeight = computeDefaultRowHeight.value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const { tableData, tableColumn } = reactData
|
|
39
|
+
|
|
40
|
+
const trVNs:VNode[] = []
|
|
41
|
+
tableData.forEach((row, rIndex) => {
|
|
42
|
+
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
43
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
44
|
+
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
45
|
+
trVNs.push(
|
|
46
|
+
h('tr', {
|
|
47
|
+
key: rIndex
|
|
48
|
+
}, tableColumn.map((column, cIndex) => {
|
|
49
|
+
return h('td', {
|
|
50
|
+
key: cIndex,
|
|
51
|
+
class: 'vxe-gantt-view--body-column',
|
|
52
|
+
style: {
|
|
53
|
+
height: `${cellHeight}px`
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}))
|
|
57
|
+
)
|
|
58
|
+
})
|
|
59
|
+
return trVNs
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const renderVN = () => {
|
|
63
|
+
const { tableColumn } = reactData
|
|
64
|
+
return h('div', {
|
|
65
|
+
ref: refElem,
|
|
66
|
+
class: 'vxe-gantt-view--body-wrapper'
|
|
67
|
+
}, [
|
|
68
|
+
h('div', {
|
|
69
|
+
ref: refBodyScroll,
|
|
70
|
+
class: 'vxe-gantt-view--body-inner-wrapper',
|
|
71
|
+
onScroll: $xeGanttView.triggerBodyScrollEvent
|
|
72
|
+
}, [
|
|
73
|
+
h('div', {
|
|
74
|
+
ref: refBodyXSpace,
|
|
75
|
+
class: 'vxe-body--x-space'
|
|
76
|
+
}),
|
|
77
|
+
h('div', {
|
|
78
|
+
ref: refBodyYSpace,
|
|
79
|
+
class: 'vxe-body--y-space'
|
|
80
|
+
}),
|
|
81
|
+
h('table', {
|
|
82
|
+
ref: refBodyTable,
|
|
83
|
+
class: 'vxe-gantt-view--body-table'
|
|
84
|
+
}, [
|
|
85
|
+
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
86
|
+
return h('col', {
|
|
87
|
+
key: cIndex
|
|
88
|
+
})
|
|
89
|
+
})),
|
|
90
|
+
h('tbody', {}, renderRows())
|
|
91
|
+
]),
|
|
92
|
+
h(GanttViewChartComponent)
|
|
93
|
+
])
|
|
94
|
+
])
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onMounted(() => {
|
|
98
|
+
const { elemStore } = internalData
|
|
99
|
+
const prefix = 'main-body-'
|
|
100
|
+
elemStore[`${prefix}wrapper`] = refElem
|
|
101
|
+
elemStore[`${prefix}scroll`] = refBodyScroll
|
|
102
|
+
elemStore[`${prefix}table`] = refBodyTable
|
|
103
|
+
elemStore[`${prefix}xSpace`] = refBodyXSpace
|
|
104
|
+
elemStore[`${prefix}ySpace`] = refBodyYSpace
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
onUnmounted(() => {
|
|
108
|
+
const { elemStore } = internalData
|
|
109
|
+
const prefix = 'main-body-'
|
|
110
|
+
elemStore[`${prefix}wrapper`] = null
|
|
111
|
+
elemStore[`${prefix}scroll`] = null
|
|
112
|
+
elemStore[`${prefix}table`] = null
|
|
113
|
+
elemStore[`${prefix}xSpace`] = null
|
|
114
|
+
elemStore[`${prefix}ySpace`] = null
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
return renderVN
|
|
118
|
+
}
|
|
119
|
+
})
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
import { getCellRestHeight } from './util'
|
|
5
|
+
|
|
6
|
+
import type { VxeTablePropTypes } from 'vxe-table'
|
|
7
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
8
|
+
|
|
9
|
+
export default defineVxeComponent({
|
|
10
|
+
name: 'VxeGanttViewChart',
|
|
11
|
+
setup () {
|
|
12
|
+
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
13
|
+
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
14
|
+
|
|
15
|
+
const { reactData, internalData } = $xeGanttView
|
|
16
|
+
const { refTable } = $xeGantt.getRefMaps()
|
|
17
|
+
const { computeProgressField } = $xeGantt.getComputeMaps()
|
|
18
|
+
|
|
19
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
20
|
+
|
|
21
|
+
const renderVN = () => {
|
|
22
|
+
const $xeTable = refTable.value
|
|
23
|
+
|
|
24
|
+
const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {}
|
|
25
|
+
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
26
|
+
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
27
|
+
let defaultRowHeight = 0
|
|
28
|
+
if ($xeTable) {
|
|
29
|
+
const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
|
|
30
|
+
cellOpts = computeCellOpts.value
|
|
31
|
+
rowOpts = computeRowOpts.value
|
|
32
|
+
defaultRowHeight = computeDefaultRowHeight.value
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { tableData } = reactData
|
|
36
|
+
const progressField = computeProgressField.value
|
|
37
|
+
|
|
38
|
+
const trVNs:VNode[] = []
|
|
39
|
+
tableData.forEach((row, rIndex) => {
|
|
40
|
+
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
41
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
42
|
+
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
43
|
+
const progressValue = XEUtils.get(row, progressField)
|
|
44
|
+
trVNs.push(
|
|
45
|
+
h('div', {
|
|
46
|
+
key: rIndex,
|
|
47
|
+
rowid,
|
|
48
|
+
class: 'vxe-gantt-view--chart-row',
|
|
49
|
+
style: {
|
|
50
|
+
height: `${cellHeight}px`
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
h('div', {
|
|
54
|
+
class: 'vxe-gantt-view--chart-bar',
|
|
55
|
+
rowid
|
|
56
|
+
}, [
|
|
57
|
+
h('div', {
|
|
58
|
+
class: 'vxe-gantt-view--chart-progress',
|
|
59
|
+
style: progressValue
|
|
60
|
+
? {
|
|
61
|
+
width: `${progressValue}%`
|
|
62
|
+
}
|
|
63
|
+
: undefined
|
|
64
|
+
}),
|
|
65
|
+
h('div', {
|
|
66
|
+
class: 'vxe-gantt-view--chart-content'
|
|
67
|
+
})
|
|
68
|
+
])
|
|
69
|
+
])
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
return h('div', {
|
|
73
|
+
ref: refElem,
|
|
74
|
+
class: 'vxe-gantt-view--chart-wrapper'
|
|
75
|
+
}, trVNs)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onMounted(() => {
|
|
79
|
+
const { elemStore } = internalData
|
|
80
|
+
const prefix = 'main-chart-'
|
|
81
|
+
elemStore[`${prefix}wrapper`] = refElem
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
onUnmounted(() => {
|
|
85
|
+
const { elemStore } = internalData
|
|
86
|
+
const prefix = 'main-chart-'
|
|
87
|
+
elemStore[`${prefix}wrapper`] = null
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
return renderVN
|
|
91
|
+
}
|
|
92
|
+
})
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { h, inject, ref, Ref, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
|
|
4
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods } from '../../../types'
|
|
5
|
+
|
|
6
|
+
export default defineVxeComponent({
|
|
7
|
+
name: 'VxeGanttView',
|
|
8
|
+
setup () {
|
|
9
|
+
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
10
|
+
|
|
11
|
+
const { reactData, internalData } = $xeGanttView
|
|
12
|
+
|
|
13
|
+
const refElem = ref() as Ref<HTMLDivElement>
|
|
14
|
+
const refHeaderScroll = ref() as Ref<HTMLDivElement>
|
|
15
|
+
const refHeaderTable = ref() as Ref<HTMLTableElement>
|
|
16
|
+
const refHeaderXSpace = ref() as Ref<HTMLDivElement>
|
|
17
|
+
|
|
18
|
+
const renderVN = () => {
|
|
19
|
+
const { tableColumn, headerGroups } = reactData
|
|
20
|
+
return h('div', {
|
|
21
|
+
ref: refElem,
|
|
22
|
+
class: 'vxe-gantt-view--header-wrapper'
|
|
23
|
+
}, [
|
|
24
|
+
h('div', {
|
|
25
|
+
ref: refHeaderScroll,
|
|
26
|
+
class: 'vxe-gantt-view--header-inner-wrapper',
|
|
27
|
+
onScroll: $xeGanttView.triggerHeaderScrollEvent
|
|
28
|
+
}, [
|
|
29
|
+
h('div', {
|
|
30
|
+
ref: refHeaderXSpace,
|
|
31
|
+
class: 'vxe-body--x-space'
|
|
32
|
+
}),
|
|
33
|
+
h('table', {
|
|
34
|
+
ref: refHeaderTable,
|
|
35
|
+
class: 'vxe-gantt-view--header-table'
|
|
36
|
+
}, [
|
|
37
|
+
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
38
|
+
return h('col', {
|
|
39
|
+
key: cIndex
|
|
40
|
+
})
|
|
41
|
+
})),
|
|
42
|
+
h('thead', {}, headerGroups.map((cols, rIndex) => {
|
|
43
|
+
return h('tr', {
|
|
44
|
+
key: rIndex
|
|
45
|
+
}, cols.map((column, cIndex) => {
|
|
46
|
+
return h('th', {
|
|
47
|
+
key: cIndex,
|
|
48
|
+
class: 'vxe-gantt-view--header-column',
|
|
49
|
+
colspan: column.children ? column.children.length : null,
|
|
50
|
+
title: `${column.field}`
|
|
51
|
+
}, column.title)
|
|
52
|
+
}))
|
|
53
|
+
}))
|
|
54
|
+
])
|
|
55
|
+
])
|
|
56
|
+
])
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
onMounted(() => {
|
|
60
|
+
const { elemStore } = internalData
|
|
61
|
+
const prefix = 'main-header-'
|
|
62
|
+
elemStore[`${prefix}wrapper`] = refElem
|
|
63
|
+
elemStore[`${prefix}scroll`] = refHeaderScroll
|
|
64
|
+
elemStore[`${prefix}table`] = refHeaderTable
|
|
65
|
+
elemStore[`${prefix}xSpace`] = refHeaderXSpace
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
onUnmounted(() => {
|
|
69
|
+
const { elemStore } = internalData
|
|
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
|
+
})
|
|
76
|
+
|
|
77
|
+
return renderVN
|
|
78
|
+
}
|
|
79
|
+
})
|