vxe-gantt 3.0.0-beta.1 → 3.0.0-beta.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/es/gantt/src/gantt-body.js +77 -36
- package/es/gantt/src/gantt-chart.js +87 -60
- package/es/gantt/src/gantt-view.js +63 -7
- package/es/gantt/src/gantt.js +30 -6
- package/es/gantt/style.css +17 -0
- package/es/gantt/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +7 -2
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +10 -1
- package/es/vxe-gantt/style.css +17 -0
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/gantt-body.js +98 -40
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +95 -62
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +72 -6
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +31 -8
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/style/style.css +17 -0
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +309 -122
- 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 +13 -2
- package/lib/ui/index.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/vn.js +17 -1
- package/lib/ui/src/vn.min.js +1 -0
- package/lib/vxe-gantt/style/style.css +17 -0
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +4 -4
- package/packages/gantt/src/gantt-body.ts +85 -39
- package/packages/gantt/src/gantt-chart.ts +99 -66
- package/packages/gantt/src/gantt-view.ts +65 -7
- package/packages/gantt/src/gantt.ts +30 -6
- package/packages/ui/index.ts +9 -1
- package/packages/ui/src/vn.ts +13 -0
- package/styles/components/gantt-module/gantt-chart.scss +1 -0
- package/styles/components/gantt.scss +19 -0
|
@@ -5,7 +5,7 @@ import XEUtils from 'xe-utils'
|
|
|
5
5
|
import { getCellRestHeight } from './util'
|
|
6
6
|
import { getStringValue } from '../../ui/src/utils'
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { TableInternalData, TableReactData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table'
|
|
9
9
|
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
10
10
|
|
|
11
11
|
const { renderEmptyElement } = VxeUI
|
|
@@ -34,89 +34,122 @@ export default defineVxeComponent({
|
|
|
34
34
|
//
|
|
35
35
|
// Render
|
|
36
36
|
//
|
|
37
|
-
|
|
37
|
+
renderTaskBar (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, $rowIndex: number) {
|
|
38
38
|
const _vm = this
|
|
39
39
|
const $xeGantt = _vm.$xeGantt
|
|
40
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
41
|
-
const $xeTable = $xeGanttView.internalData.xeTable
|
|
42
40
|
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rowOpts = $xeTable.computeRowOpts
|
|
51
|
-
defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
52
|
-
}
|
|
41
|
+
const tableProps = $xeTable
|
|
42
|
+
const { treeConfig } = tableProps
|
|
43
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
44
|
+
const { fullAllDataRowIdData } = tableInternalData
|
|
45
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
46
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
47
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
53
48
|
|
|
54
|
-
const { reactData } = $xeGanttView
|
|
55
|
-
const { tableData } = reactData
|
|
56
49
|
const titleField = $xeGantt.computeTitleField
|
|
57
50
|
const progressField = $xeGantt.computeProgressField
|
|
58
51
|
const taskBarOpts = $xeGantt.computeTaskBarOpts
|
|
59
52
|
const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts
|
|
60
53
|
const { round } = barStyle || {}
|
|
61
54
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
56
|
+
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
57
|
+
let title = getStringValue(XEUtils.get(row, titleField))
|
|
58
|
+
const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0
|
|
59
|
+
|
|
60
|
+
if (contentMethod) {
|
|
61
|
+
title = getStringValue(contentMethod({ row, title }))
|
|
62
|
+
}
|
|
63
|
+
return h('div', {
|
|
64
|
+
key: treeConfig ? rowid : $rowIndex,
|
|
65
|
+
attrs: {
|
|
66
|
+
rowid
|
|
67
|
+
},
|
|
68
|
+
class: ['vxe-gantt-view--chart-row', {
|
|
69
|
+
'is--round': round
|
|
70
|
+
}],
|
|
71
|
+
style: {
|
|
72
|
+
height: `${cellHeight}px`
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
}, [
|
|
75
|
+
h('div', {
|
|
76
|
+
class: 'vxe-gantt-view--chart-bar',
|
|
77
|
+
attrs: {
|
|
78
|
+
rowid
|
|
79
|
+
},
|
|
80
|
+
on: {
|
|
81
|
+
click (evnt: MouseEvent) {
|
|
82
|
+
$xeGantt.handleTaskBarClickEvent(evnt, { row })
|
|
77
83
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}],
|
|
81
|
-
style: {
|
|
82
|
-
height: `${cellHeight}px`
|
|
84
|
+
dblclick (evnt: MouseEvent) {
|
|
85
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, { row })
|
|
83
86
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
click (evnt: MouseEvent) {
|
|
92
|
-
$xeGantt.handleTaskBarClickEvent(evnt, { row })
|
|
93
|
-
},
|
|
94
|
-
dblclick (evnt: MouseEvent) {
|
|
95
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, { row })
|
|
96
|
-
}
|
|
87
|
+
}
|
|
88
|
+
}, [
|
|
89
|
+
showProgress
|
|
90
|
+
? h('div', {
|
|
91
|
+
class: 'vxe-gantt-view--chart-progress',
|
|
92
|
+
style: {
|
|
93
|
+
width: `${progressValue || 0}%`
|
|
97
94
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
})
|
|
96
|
+
: renderEmptyElement($xeGantt),
|
|
97
|
+
showContent
|
|
98
|
+
? h('div', {
|
|
99
|
+
class: 'vxe-gantt-view--chart-content'
|
|
100
|
+
}, title)
|
|
101
|
+
: renderEmptyElement($xeGantt)
|
|
102
|
+
])
|
|
103
|
+
])
|
|
104
|
+
},
|
|
105
|
+
renderRows (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, tableData: any[]) {
|
|
106
|
+
const _vm = this
|
|
107
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
108
|
+
const { reactData } = $xeGanttView
|
|
109
|
+
|
|
110
|
+
const tableProps = $xeTable
|
|
111
|
+
const { treeConfig } = tableProps
|
|
112
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
113
|
+
const { treeExpandedFlag } = tableReactData
|
|
114
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
115
|
+
const { treeExpandedMaps } = tableInternalData
|
|
116
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
117
|
+
const { transform } = treeOpts
|
|
118
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
119
|
+
|
|
120
|
+
const { scrollYLoad } = reactData
|
|
121
|
+
|
|
122
|
+
const trVNs: VNode[] = []
|
|
123
|
+
tableData.forEach((row, $rowIndex) => {
|
|
124
|
+
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
125
|
+
trVNs.push(_vm.renderTaskBar(h, $xeTable, row, rowid, $rowIndex))
|
|
126
|
+
let isExpandTree = false
|
|
127
|
+
let rowChildren: any[] = []
|
|
128
|
+
|
|
129
|
+
if (treeConfig && !scrollYLoad && !transform) {
|
|
130
|
+
rowChildren = row[childrenField]
|
|
131
|
+
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
132
|
+
}
|
|
133
|
+
// 如果是树形表格
|
|
134
|
+
if (isExpandTree) {
|
|
135
|
+
trVNs.push(..._vm.renderRows(h, $xeTable, rowChildren))
|
|
136
|
+
}
|
|
115
137
|
})
|
|
138
|
+
return trVNs
|
|
139
|
+
},
|
|
140
|
+
renderVN (h: CreateElement): VNode {
|
|
141
|
+
const _vm = this
|
|
142
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
143
|
+
const { reactData } = $xeGanttView
|
|
144
|
+
|
|
145
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
146
|
+
|
|
147
|
+
const { tableData } = reactData
|
|
148
|
+
|
|
116
149
|
return h('div', {
|
|
117
150
|
ref: 'refElem',
|
|
118
151
|
class: 'vxe-gantt-view--chart-wrapper'
|
|
119
|
-
},
|
|
152
|
+
}, $xeTable ? _vm.renderRows(h, $xeTable, tableData) : [])
|
|
120
153
|
}
|
|
121
154
|
},
|
|
122
155
|
mounted () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VNode, CreateElement } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
|
-
import { setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
4
|
+
import { setScrollTop, setScrollLeft, removeClass, addClass } from '../../ui/src/dom'
|
|
5
5
|
import { getRefElem } from './util'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
import GanttViewHeaderComponent from './gantt-header'
|
|
@@ -49,6 +49,8 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
49
49
|
const reactData = $xeGanttView.reactData
|
|
50
50
|
const internalData = $xeGanttView.internalData
|
|
51
51
|
|
|
52
|
+
const ganttProps = $xeGantt
|
|
53
|
+
const { treeConfig } = ganttProps
|
|
52
54
|
const { minViewDate, maxViewDate } = reactData
|
|
53
55
|
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
54
56
|
const fullCols: VxeGanttPropTypes.Column[] = []
|
|
@@ -101,9 +103,13 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
101
103
|
const startField = $xeGantt.computeStartField
|
|
102
104
|
const endField = $xeGantt.computeEndField
|
|
103
105
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
104
|
-
const { afterFullData } = tableInternalData
|
|
106
|
+
const { afterFullData, afterTreeFullData } = tableInternalData
|
|
107
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
108
|
+
const { transform } = treeOpts
|
|
109
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
110
|
+
|
|
105
111
|
const ctMaps: Record<string, VxeGanttDefines.RowCacheItem> = {}
|
|
106
|
-
|
|
112
|
+
const handleParseRender = (row: any) => {
|
|
107
113
|
const rowid = $xeTable.getRowid(row)
|
|
108
114
|
const startValue = XEUtils.get(row, startField)
|
|
109
115
|
const endValue = XEUtils.get(row, endField)
|
|
@@ -119,7 +125,13 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
119
125
|
oWidthSize
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
|
-
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (treeConfig) {
|
|
131
|
+
XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
132
|
+
} else {
|
|
133
|
+
afterFullData.forEach(handleParseRender)
|
|
134
|
+
}
|
|
123
135
|
internalData.chartMaps = ctMaps
|
|
124
136
|
}
|
|
125
137
|
}
|
|
@@ -135,6 +147,8 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
135
147
|
const reactData = $xeGanttView.reactData
|
|
136
148
|
const internalData = $xeGanttView.internalData
|
|
137
149
|
|
|
150
|
+
const ganttProps = $xeGantt
|
|
151
|
+
const { treeConfig } = ganttProps
|
|
138
152
|
const $xeTable = internalData.xeTable
|
|
139
153
|
const sdMaps: Record<string, any> = {}
|
|
140
154
|
const edMaps: Record<string, any> = {}
|
|
@@ -144,8 +158,12 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
144
158
|
const startField = $xeGantt.computeStartField
|
|
145
159
|
const endField = $xeGantt.computeEndField
|
|
146
160
|
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
147
|
-
const { afterFullData } = tableInternalData
|
|
148
|
-
|
|
161
|
+
const { afterFullData, afterTreeFullData } = tableInternalData
|
|
162
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
163
|
+
const { transform } = treeOpts
|
|
164
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
165
|
+
|
|
166
|
+
const handleMinMaxData = (row: any) => {
|
|
149
167
|
const startValue = XEUtils.get(row, startField)
|
|
150
168
|
const endValue = XEUtils.get(row, endField)
|
|
151
169
|
if (startValue && endValue) {
|
|
@@ -158,7 +176,13 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
|
|
|
158
176
|
maxDate = endDate
|
|
159
177
|
}
|
|
160
178
|
}
|
|
161
|
-
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (treeConfig) {
|
|
182
|
+
XEUtils.eachTree(afterTreeFullData, handleMinMaxData, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
183
|
+
} else {
|
|
184
|
+
afterFullData.forEach(handleMinMaxData)
|
|
185
|
+
}
|
|
162
186
|
}
|
|
163
187
|
reactData.minViewDate = minDate
|
|
164
188
|
reactData.maxViewDate = maxDate
|
|
@@ -333,6 +357,7 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
333
357
|
function handleLazyRecalculate ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
334
358
|
calcScrollbar($xeGanttView)
|
|
335
359
|
updateStyle($xeGanttView)
|
|
360
|
+
updateChart($xeGanttView)
|
|
336
361
|
return $xeGanttView.$nextTick()
|
|
337
362
|
}
|
|
338
363
|
|
|
@@ -619,6 +644,39 @@ export default defineVxeComponent({
|
|
|
619
644
|
|
|
620
645
|
return handleLazyRecalculate($xeGanttView)
|
|
621
646
|
},
|
|
647
|
+
handleUpdateCurrentRow (row: any) {
|
|
648
|
+
const $xeGanttView = this
|
|
649
|
+
const internalData = $xeGanttView.internalData
|
|
650
|
+
|
|
651
|
+
const $xeTable = internalData.xeTable
|
|
652
|
+
const el = $xeGanttView.$refs.refElem as HTMLDivElement
|
|
653
|
+
if ($xeTable && el) {
|
|
654
|
+
if (row) {
|
|
655
|
+
const tableProps = $xeTable
|
|
656
|
+
const { highlightCurrentRow } = tableProps
|
|
657
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
658
|
+
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
659
|
+
XEUtils.arrayEach(el.querySelectorAll(`[rowid="${$xeTable.getRowid(row)}"]`), elem => addClass(elem, 'row--current'))
|
|
660
|
+
}
|
|
661
|
+
} else {
|
|
662
|
+
XEUtils.arrayEach(el.querySelectorAll('.row--current'), elem => removeClass(elem, 'row--current'))
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
handleUpdateHoverRow (row: any) {
|
|
667
|
+
const $xeGanttView = this
|
|
668
|
+
const internalData = $xeGanttView.internalData
|
|
669
|
+
|
|
670
|
+
const $xeTable = internalData.xeTable
|
|
671
|
+
const el = $xeGanttView.$refs.refElem as HTMLDivElement
|
|
672
|
+
if ($xeTable && el) {
|
|
673
|
+
if (row) {
|
|
674
|
+
XEUtils.arrayEach(el.querySelectorAll(`.vxe-body--row[rowid="${$xeTable.getRowid(row)}"]`), elem => addClass(elem, 'row--hover'))
|
|
675
|
+
} else {
|
|
676
|
+
XEUtils.arrayEach(el.querySelectorAll('.vxe-body--row.row--hover'), elem => removeClass(elem, 'row--hover'))
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
},
|
|
622
680
|
triggerHeaderScrollEvent (evnt: Event) {
|
|
623
681
|
const $xeGanttView = this
|
|
624
682
|
const internalData = $xeGanttView.internalData
|
|
@@ -4,6 +4,7 @@ import { VxeUI } from '@vxe-ui/core'
|
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
5
|
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
6
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
7
|
+
import { getSlotVNs } from '../../ui/src/vn'
|
|
7
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
8
9
|
import GanttViewComponent from './gantt-view'
|
|
9
10
|
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
@@ -12,7 +13,7 @@ import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxeP
|
|
|
12
13
|
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes } from 'vxe-table'
|
|
13
14
|
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines } from '../../../types'
|
|
14
15
|
|
|
15
|
-
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement
|
|
16
|
+
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
16
17
|
|
|
17
18
|
const tableProps = (VxeTableComponent as any).props
|
|
18
19
|
|
|
@@ -100,8 +101,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
100
101
|
},
|
|
101
102
|
provide () {
|
|
102
103
|
const $xeGantt = this
|
|
104
|
+
const $xeGrid = null
|
|
103
105
|
|
|
104
106
|
return {
|
|
107
|
+
$xeGrid,
|
|
105
108
|
$xeGantt
|
|
106
109
|
}
|
|
107
110
|
},
|
|
@@ -307,7 +310,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
307
310
|
const proxyOpts = $xeGantt.computeProxyOpts
|
|
308
311
|
const pagerOpts = $xeGantt.computePagerOpts
|
|
309
312
|
const isLoading = $xeGantt.computeIsLoading
|
|
310
|
-
const tProps = Object.assign({}, tableExtendProps
|
|
313
|
+
const tProps = Object.assign({}, tableExtendProps, {
|
|
314
|
+
showOverflow: true,
|
|
315
|
+
showHeaderOverflow: true,
|
|
316
|
+
showFooterOverflow: true,
|
|
317
|
+
showFooter: false
|
|
318
|
+
})
|
|
311
319
|
if (isZMax) {
|
|
312
320
|
if (tableExtendProps.maxHeight) {
|
|
313
321
|
tProps.maxHeight = '100%'
|
|
@@ -1495,7 +1503,22 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1495
1503
|
},
|
|
1496
1504
|
handleTaskCellClickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
1497
1505
|
const $xeGantt = this
|
|
1506
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
1498
1507
|
|
|
1508
|
+
if ($xeTable) {
|
|
1509
|
+
const tableProps = $xeTable
|
|
1510
|
+
const { highlightCurrentRow } = tableProps
|
|
1511
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
1512
|
+
const { row } = params
|
|
1513
|
+
// 如果是当前行
|
|
1514
|
+
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
1515
|
+
$xeTable.triggerCurrentRowEvent(evnt, Object.assign({
|
|
1516
|
+
$table: $xeTable,
|
|
1517
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
1518
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
1519
|
+
}, params))
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1499
1522
|
$xeGantt.dispatchEvent('task-cell-click', params, evnt)
|
|
1500
1523
|
},
|
|
1501
1524
|
handleTaskCellDblclickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
@@ -1853,20 +1876,21 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1853
1876
|
if (!enabled) {
|
|
1854
1877
|
return renderEmptyElement($xeGantt)
|
|
1855
1878
|
}
|
|
1879
|
+
const isResize = resize && showLeftView && showRightView
|
|
1856
1880
|
const ons: {
|
|
1857
1881
|
mousedown?: any
|
|
1858
1882
|
} = {}
|
|
1859
|
-
if (
|
|
1883
|
+
if (isResize) {
|
|
1860
1884
|
ons.mousedown = $xeGantt.dragSplitEvent
|
|
1861
1885
|
}
|
|
1862
1886
|
return h('div', {
|
|
1863
1887
|
class: ['vxe-gantt--view-split-bar', {
|
|
1864
|
-
'is--resize':
|
|
1865
|
-
on: ons
|
|
1888
|
+
'is--resize': isResize
|
|
1866
1889
|
}]
|
|
1867
1890
|
}, [
|
|
1868
1891
|
h('div', {
|
|
1869
|
-
class: 'vxe-gantt--view-split-bar-handle'
|
|
1892
|
+
class: 'vxe-gantt--view-split-bar-handle',
|
|
1893
|
+
on: ons
|
|
1870
1894
|
}),
|
|
1871
1895
|
showCollapseTableButton || showCollapseTaskButton
|
|
1872
1896
|
? h('div', {
|
package/packages/ui/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core'
|
|
2
|
+
import { errLog } from './src/log'
|
|
2
3
|
|
|
3
|
-
const { setConfig, setIcon } = VxeUI
|
|
4
|
+
const { setConfig, setIcon, checkVersion } = VxeUI
|
|
4
5
|
|
|
5
6
|
VxeUI.ganttVersion = process.env.VUE_APP_VXE_VERSION as string
|
|
6
7
|
|
|
@@ -61,4 +62,11 @@ setIcon({
|
|
|
61
62
|
GANTT_VIEW_RIGHT_CLOSE: iconPrefix + 'arrow-left'
|
|
62
63
|
})
|
|
63
64
|
|
|
65
|
+
if (!checkVersion(VxeUI.tableVersion, 3, 18)) {
|
|
66
|
+
errLog('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, 'vxe-table v3.18+'])
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
VxeUI
|
|
71
|
+
}
|
|
64
72
|
export default VxeUI
|
package/packages/ui/src/vn.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import type { VxeComponentSlotType } from '../../../types'
|
|
4
|
+
|
|
5
|
+
export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[] | undefined) {
|
|
6
|
+
if (vns === null || vns === undefined) {
|
|
7
|
+
return []
|
|
8
|
+
}
|
|
9
|
+
if (XEUtils.isArray(vns)) {
|
|
10
|
+
return vns
|
|
11
|
+
}
|
|
12
|
+
return [vns]
|
|
13
|
+
}
|
|
@@ -578,6 +578,25 @@
|
|
|
578
578
|
white-space: nowrap;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
+
// 行高亮
|
|
582
|
+
.vxe-gantt-view--body-row {
|
|
583
|
+
&.row--stripe {
|
|
584
|
+
background-color: var(--vxe-ui-table-row-striped-background-color);
|
|
585
|
+
}
|
|
586
|
+
&.row--current {
|
|
587
|
+
background-color: var(--vxe-ui-table-row-current-background-color);
|
|
588
|
+
}
|
|
589
|
+
&.row--hover {
|
|
590
|
+
background-color: var(--vxe-ui-table-row-hover-background-color);
|
|
591
|
+
&.row--stripe {
|
|
592
|
+
background-color: var(--vxe-ui-table-row-hover-striped-background-color);
|
|
593
|
+
}
|
|
594
|
+
&.row--current {
|
|
595
|
+
background-color: var(--vxe-ui-table-row-hover-current-background-color);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
581
600
|
.vxe-gantt-view {
|
|
582
601
|
&.mode--day {
|
|
583
602
|
.vxe-gantt-view--header-column {
|