vxe-gantt 3.2.5 → 3.2.8
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-chart.js +94 -14
- package/es/gantt/src/gantt-view.js +91 -8
- package/es/gantt/src/gantt.js +13 -4
- package/es/gantt/src/static.js +6 -2
- package/es/gantt/src/util.js +8 -4
- package/es/gantt/style.css +34 -6
- 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 +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +3 -0
- package/es/vxe-gantt/style.css +34 -6
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/gantt-chart.js +78 -12
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +92 -7
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +14 -2
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/static.js +6 -2
- package/lib/gantt/src/static.min.js +1 -1
- package/lib/gantt/src/util.js +10 -5
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +34 -6
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +208 -29
- 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 +4 -1
- 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/utils.js +4 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +34 -6
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/gantt/src/gantt-chart.ts +100 -14
- package/packages/gantt/src/gantt-view.ts +90 -8
- package/packages/gantt/src/gantt.ts +14 -3
- package/packages/gantt/src/static.ts +7 -3
- package/packages/gantt/src/util.ts +11 -7
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +4 -0
- package/styles/components/gantt-module/gantt-chart.scss +35 -4
- package/styles/theme/base.scss +1 -0
|
@@ -2,8 +2,8 @@ import { VNode, CreateElement } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
|
-
import { getCellRestHeight, hasMilestoneTask,
|
|
6
|
-
import { getStringValue, isEnableConf } from '../../ui/src/utils'
|
|
5
|
+
import { getCellRestHeight, hasMilestoneTask, getTaskType, hasSubviewTask } from './util'
|
|
6
|
+
import { getStringValue, isEnableConf, hasEnableConf } from '../../ui/src/utils'
|
|
7
7
|
|
|
8
8
|
import type { VxeComponentStyleType } from 'vxe-pc-ui'
|
|
9
9
|
import type { TableInternalData, TableReactData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table'
|
|
@@ -38,7 +38,7 @@ export default defineVxeComponent({
|
|
|
38
38
|
//
|
|
39
39
|
// Render
|
|
40
40
|
//
|
|
41
|
-
renderTaskBar (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number) {
|
|
41
|
+
renderTaskBar (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number, rowChildren: any[], isExpandTree: boolean) {
|
|
42
42
|
const _vm = this
|
|
43
43
|
const $xeGantt = _vm.$xeGantt
|
|
44
44
|
|
|
@@ -56,13 +56,14 @@ export default defineVxeComponent({
|
|
|
56
56
|
const ganttSlots = $xeGantt.$scopedSlots
|
|
57
57
|
const taskBarSlot = ganttSlots.taskBar || ganttSlots['task-bar']
|
|
58
58
|
|
|
59
|
-
const { taskBarMilestoneConfig } = ganttProps
|
|
59
|
+
const { taskBarMilestoneConfig, taskBarSubviewConfig } = ganttProps
|
|
60
60
|
const { activeLink, activeBarRowid } = ganttReactData
|
|
61
61
|
const titleField = $xeGantt.computeTitleField
|
|
62
62
|
const progressField = $xeGantt.computeProgressField
|
|
63
63
|
const typeField = $xeGantt.computeTypeField
|
|
64
64
|
const taskBarOpts = $xeGantt.computeTaskBarOpts
|
|
65
65
|
const taskBarMilestoneOpts = $xeGantt.computeTaskBarMilestoneOpts
|
|
66
|
+
const taskBarSubviewOpts = $xeGantt.computeTaskBarSubviewOpts
|
|
66
67
|
const scaleUnit = $xeGantt.computeScaleUnit
|
|
67
68
|
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit }
|
|
68
69
|
const { showProgress, showContent, contentMethod, barStyle, moveable, showTooltip } = taskBarOpts
|
|
@@ -75,8 +76,9 @@ export default defineVxeComponent({
|
|
|
75
76
|
|
|
76
77
|
let title = getStringValue(XEUtils.get(row, titleField))
|
|
77
78
|
const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0
|
|
78
|
-
const
|
|
79
|
-
const isMilestone = !!(taskBarMilestoneConfig && hasMilestoneTask(
|
|
79
|
+
const renderTaskType = getTaskType(XEUtils.get(row, typeField))
|
|
80
|
+
const isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType))
|
|
81
|
+
const isSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(renderTaskType))
|
|
80
82
|
|
|
81
83
|
const vbStyle: VxeComponentStyleType = {}
|
|
82
84
|
const vpStyle: VxeComponentStyleType = {
|
|
@@ -148,7 +150,92 @@ export default defineVxeComponent({
|
|
|
148
150
|
}, $xeGantt.callSlot(taskBarSlot, barParams, h))
|
|
149
151
|
)
|
|
150
152
|
} else {
|
|
151
|
-
if (
|
|
153
|
+
if (isSubview && rowChildren && rowChildren.length) {
|
|
154
|
+
if (isExpandTree) {
|
|
155
|
+
if (taskBarSubviewOpts.showOverview) {
|
|
156
|
+
cbVNs.push(
|
|
157
|
+
h('div', {
|
|
158
|
+
key: 'vcso',
|
|
159
|
+
class: ['vxe-gantt-view--chart-subview-wrapper is--overview', {
|
|
160
|
+
'is--round': round,
|
|
161
|
+
'is--move': moveable
|
|
162
|
+
}]
|
|
163
|
+
}, [
|
|
164
|
+
h('div', {
|
|
165
|
+
key: rowid,
|
|
166
|
+
attrs: {
|
|
167
|
+
rowid: rowid
|
|
168
|
+
},
|
|
169
|
+
class: 'vxe-gantt-view--chart-subview-bar'
|
|
170
|
+
}, [
|
|
171
|
+
h('div', {
|
|
172
|
+
class: 'vxe-gantt-view--chart-subview-bar-content-wrapper'
|
|
173
|
+
}, [
|
|
174
|
+
showContent
|
|
175
|
+
? h('div', {
|
|
176
|
+
class: 'vxe-gantt-view--chart-content'
|
|
177
|
+
}, title)
|
|
178
|
+
: renderEmptyElement($xeGantt)
|
|
179
|
+
])
|
|
180
|
+
])
|
|
181
|
+
])
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
cbVNs.push(
|
|
186
|
+
h('div', {
|
|
187
|
+
key: 'vcsc',
|
|
188
|
+
class: ['vxe-gantt-view--chart-subview-wrapper is--inline', {
|
|
189
|
+
'is--round': round,
|
|
190
|
+
'is--move': moveable
|
|
191
|
+
}]
|
|
192
|
+
}, rowChildren.map(childRow => {
|
|
193
|
+
const childRowid = $xeTable.getRowid(childRow)
|
|
194
|
+
let childTitle = getStringValue(XEUtils.get(childRow, titleField))
|
|
195
|
+
const childProgressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(childRow, progressField)))) : 0
|
|
196
|
+
const childRenderTaskType = getTaskType(XEUtils.get(childRow, typeField))
|
|
197
|
+
|
|
198
|
+
const vpcStyle: VxeComponentStyleType = {
|
|
199
|
+
width: `${childProgressValue || 0}%`
|
|
200
|
+
}
|
|
201
|
+
if (isBarRowStyle) {
|
|
202
|
+
const { completedBgColor } = barStyObj
|
|
203
|
+
if (completedBgColor) {
|
|
204
|
+
vpcStyle.backgroundColor = completedBgColor
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (contentMethod) {
|
|
209
|
+
childTitle = getStringValue(contentMethod({ row: childRow, title: childTitle, scaleType: scaleUnit }))
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return h('div', {
|
|
213
|
+
key: childRowid,
|
|
214
|
+
attrs: {
|
|
215
|
+
rowid: childRowid
|
|
216
|
+
},
|
|
217
|
+
class: ['vxe-gantt-view--chart-subview-bar', `is--${childRenderTaskType}`]
|
|
218
|
+
}, [
|
|
219
|
+
h('div', {
|
|
220
|
+
class: 'vxe-gantt-view--chart-subview-bar-content-wrapper'
|
|
221
|
+
}, [
|
|
222
|
+
showProgress
|
|
223
|
+
? h('div', {
|
|
224
|
+
class: 'vxe-gantt-view--chart-progress',
|
|
225
|
+
style: vpcStyle
|
|
226
|
+
})
|
|
227
|
+
: renderEmptyElement($xeGantt),
|
|
228
|
+
showContent
|
|
229
|
+
? h('div', {
|
|
230
|
+
class: 'vxe-gantt-view--chart-content'
|
|
231
|
+
}, childTitle)
|
|
232
|
+
: renderEmptyElement($xeGantt)
|
|
233
|
+
])
|
|
234
|
+
])
|
|
235
|
+
}))
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
} else if (isMilestone) {
|
|
152
239
|
const { icon, iconStatus, iconStyle } = taskBarMilestoneOpts
|
|
153
240
|
const tbmParams = { $gantt: $xeGantt, row }
|
|
154
241
|
cbVNs.push(
|
|
@@ -181,14 +268,12 @@ export default defineVxeComponent({
|
|
|
181
268
|
}, [
|
|
182
269
|
showProgress
|
|
183
270
|
? h('div', {
|
|
184
|
-
key: 'vcp',
|
|
185
271
|
class: 'vxe-gantt-view--chart-progress',
|
|
186
272
|
style: vpStyle
|
|
187
273
|
})
|
|
188
274
|
: renderEmptyElement($xeGantt),
|
|
189
275
|
showContent
|
|
190
276
|
? h('div', {
|
|
191
|
-
key: 'vcc',
|
|
192
277
|
class: 'vxe-gantt-view--chart-content'
|
|
193
278
|
}, title)
|
|
194
279
|
: renderEmptyElement($xeGantt)
|
|
@@ -202,7 +287,7 @@ export default defineVxeComponent({
|
|
|
202
287
|
attrs: {
|
|
203
288
|
rowid
|
|
204
289
|
},
|
|
205
|
-
class: ['vxe-gantt-view--chart-row', `is--${
|
|
290
|
+
class: ['vxe-gantt-view--chart-row', `is--${renderTaskType}`, {
|
|
206
291
|
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
|
|
207
292
|
'is--round': round,
|
|
208
293
|
'is--move': moveable
|
|
@@ -217,7 +302,7 @@ export default defineVxeComponent({
|
|
|
217
302
|
}
|
|
218
303
|
}, [
|
|
219
304
|
h('div', {
|
|
220
|
-
class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${
|
|
305
|
+
class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${renderTaskType}`, {
|
|
221
306
|
'is--active': activeBarRowid === rowid,
|
|
222
307
|
'active--link': activeLink && (rowid === `${activeLink.from}` || rowid === `${activeLink.to}`)
|
|
223
308
|
}],
|
|
@@ -268,16 +353,17 @@ export default defineVxeComponent({
|
|
|
268
353
|
rowIndex = rowRest.index
|
|
269
354
|
_rowIndex = rowRest._index
|
|
270
355
|
}
|
|
271
|
-
trVNs.push(_vm.renderTaskBar(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex))
|
|
272
356
|
let isExpandTree = false
|
|
273
357
|
let rowChildren: any[] = []
|
|
274
358
|
|
|
275
|
-
if (treeConfig
|
|
359
|
+
if (treeConfig) {
|
|
276
360
|
rowChildren = row[childrenField]
|
|
277
361
|
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
278
362
|
}
|
|
363
|
+
|
|
364
|
+
trVNs.push(_vm.renderTaskBar(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, rowChildren, isExpandTree))
|
|
279
365
|
// 如果是树形表格
|
|
280
|
-
if (isExpandTree) {
|
|
366
|
+
if (treeConfig && isExpandTree && !scrollYLoad && !transform) {
|
|
281
367
|
trVNs.push(..._vm.renderTaskRows(h, $xeTable, rowChildren))
|
|
282
368
|
}
|
|
283
369
|
})
|
|
@@ -2,7 +2,7 @@ import { VNode, CreateElement } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import { setScrollTop, setScrollLeft, removeClass, addClass, hasClass } from '../../ui/src/dom'
|
|
5
|
-
import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth, hasMilestoneTask } from './util'
|
|
5
|
+
import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth, hasMilestoneTask, getTaskType, hasSubviewTask } from './util'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
import GanttViewHeaderComponent from './gantt-header'
|
|
8
8
|
import GanttViewBodyComponent from './gantt-body'
|
|
@@ -556,14 +556,23 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
|
|
|
556
556
|
const rowid = $xeTable.getRowid(row)
|
|
557
557
|
let startValue = XEUtils.get(row, startField)
|
|
558
558
|
let endValue = XEUtils.get(row, endField)
|
|
559
|
-
const
|
|
559
|
+
const renderTaskType = getTaskType(XEUtils.get(row, typeField))
|
|
560
|
+
const isMilestone = hasMilestoneTask(renderTaskType)
|
|
561
|
+
const isSubview = hasSubviewTask(renderTaskType)
|
|
560
562
|
if (isMilestone) {
|
|
561
563
|
if (!startValue) {
|
|
562
564
|
startValue = endValue
|
|
563
565
|
}
|
|
564
566
|
endValue = startValue
|
|
565
567
|
}
|
|
566
|
-
if (
|
|
568
|
+
if (isSubview) {
|
|
569
|
+
ctMaps[rowid] = {
|
|
570
|
+
row,
|
|
571
|
+
rowid,
|
|
572
|
+
oLeftSize: 0,
|
|
573
|
+
oWidthSize: 0
|
|
574
|
+
}
|
|
575
|
+
} else if (startValue && endValue) {
|
|
567
576
|
const { offsetLeftSize, offsetWidthSize } = renderFn(startValue, endValue)
|
|
568
577
|
ctMaps[rowid] = {
|
|
569
578
|
row,
|
|
@@ -698,7 +707,36 @@ function calcScrollbar ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPriv
|
|
|
698
707
|
}
|
|
699
708
|
}
|
|
700
709
|
|
|
701
|
-
function
|
|
710
|
+
function handleSubTaskMinMaxSize ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods, $xeTable: VxeTableConstructor, list: any[]) {
|
|
711
|
+
const $xeGantt = $xeGanttView.$xeGantt
|
|
712
|
+
const internalData = $xeGanttView.internalData
|
|
713
|
+
|
|
714
|
+
const { chartMaps } = internalData
|
|
715
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
716
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
717
|
+
|
|
718
|
+
const typeField = $xeGantt.computeTypeField
|
|
719
|
+
let minChildLeftSize = 0
|
|
720
|
+
let maxChildLeftSize = 0
|
|
721
|
+
XEUtils.eachTree(list, childRow => {
|
|
722
|
+
const childRowid = $xeTable.getRowid(childRow)
|
|
723
|
+
const renderTaskType = XEUtils.get(childRow, typeField)
|
|
724
|
+
if (hasSubviewTask(renderTaskType)) {
|
|
725
|
+
return
|
|
726
|
+
}
|
|
727
|
+
const childChartRest = childRowid ? chartMaps[childRowid] : null
|
|
728
|
+
if (childChartRest) {
|
|
729
|
+
maxChildLeftSize = Math.max(maxChildLeftSize, childChartRest.oLeftSize + childChartRest.oWidthSize)
|
|
730
|
+
minChildLeftSize = minChildLeftSize ? Math.min(minChildLeftSize, childChartRest.oLeftSize) : childChartRest.oLeftSize
|
|
731
|
+
}
|
|
732
|
+
}, { children: childrenField })
|
|
733
|
+
return {
|
|
734
|
+
minSize: minChildLeftSize,
|
|
735
|
+
maxSize: maxChildLeftSize
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function updateTaskChartStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
702
740
|
const $xeGantt = $xeGanttView.$xeGantt
|
|
703
741
|
const reactData = $xeGanttView.reactData
|
|
704
742
|
const internalData = $xeGanttView.internalData
|
|
@@ -710,6 +748,8 @@ function updateTaskChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPr
|
|
|
710
748
|
const { elemStore, chartMaps } = internalData
|
|
711
749
|
const chartWrapper = getRefElem(elemStore['main-chart-task-wrapper'])
|
|
712
750
|
if (chartWrapper && $xeTable) {
|
|
751
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
752
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
713
753
|
XEUtils.arrayEach(chartWrapper.children, (rowEl) => {
|
|
714
754
|
const barEl = rowEl.children[0] as HTMLDivElement
|
|
715
755
|
if (!barEl) {
|
|
@@ -720,9 +760,51 @@ function updateTaskChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPr
|
|
|
720
760
|
return
|
|
721
761
|
}
|
|
722
762
|
const chartRest = rowid ? chartMaps[rowid] : null
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
763
|
+
const row = chartRest ? chartRest.row : null
|
|
764
|
+
// 子任务视图
|
|
765
|
+
if (hasClass(barEl, 'is--subview')) {
|
|
766
|
+
const childWrapperEl = barEl.firstElementChild as HTMLDivElement
|
|
767
|
+
if (childWrapperEl) {
|
|
768
|
+
// 行内展示
|
|
769
|
+
if (hasClass(childWrapperEl, 'is--inline')) {
|
|
770
|
+
XEUtils.arrayEach(childWrapperEl.children, (childEl) => {
|
|
771
|
+
const childBarEl = childEl as HTMLDivElement
|
|
772
|
+
const childRowid = childBarEl.getAttribute('rowid') || ''
|
|
773
|
+
const childChartRest = childRowid ? chartMaps[childRowid] : null
|
|
774
|
+
if (childChartRest) {
|
|
775
|
+
const childRow = childChartRest.row
|
|
776
|
+
// 如果是子视图
|
|
777
|
+
if (hasClass(childBarEl, 'is--subview')) {
|
|
778
|
+
const subChildren: any[] = childRow[childrenField]
|
|
779
|
+
const { minSize: minChildLeftSize, maxSize: maxChildLeftSize } = handleSubTaskMinMaxSize($xeGanttView, $xeTable, subChildren)
|
|
780
|
+
childBarEl.style.left = `${viewCellWidth * minChildLeftSize}px`
|
|
781
|
+
childBarEl.style.width = `${viewCellWidth * (maxChildLeftSize - minChildLeftSize)}px`
|
|
782
|
+
} else {
|
|
783
|
+
childBarEl.style.left = `${getTaskBarLeft(childChartRest, viewCellWidth)}px`
|
|
784
|
+
if (!hasClass(childBarEl, 'is--milestone')) {
|
|
785
|
+
// 里程碑不需要宽度
|
|
786
|
+
childBarEl.style.width = `${getTaskBarWidth(childChartRest, viewCellWidth)}px`
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
})
|
|
791
|
+
} else {
|
|
792
|
+
// 如果展开子任务
|
|
793
|
+
const childBarEl = childWrapperEl.firstElementChild as HTMLDivElement
|
|
794
|
+
if (childBarEl) {
|
|
795
|
+
const rowChildren: any[] = row ? row[childrenField] : []
|
|
796
|
+
const { minSize: minChildLeftSize, maxSize: maxChildLeftSize } = handleSubTaskMinMaxSize($xeGanttView, $xeTable, rowChildren)
|
|
797
|
+
childBarEl.style.left = `${viewCellWidth * minChildLeftSize}px`
|
|
798
|
+
childBarEl.style.width = `${viewCellWidth * (maxChildLeftSize - minChildLeftSize)}px`
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
} else {
|
|
803
|
+
barEl.style.left = `${getTaskBarLeft(chartRest, viewCellWidth)}px`
|
|
804
|
+
// 里程碑不需要宽度
|
|
805
|
+
if (!hasClass(barEl, 'is--milestone')) {
|
|
806
|
+
barEl.style.width = `${getTaskBarWidth(chartRest, viewCellWidth)}px`
|
|
807
|
+
}
|
|
726
808
|
}
|
|
727
809
|
})
|
|
728
810
|
}
|
|
@@ -859,7 +941,7 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
859
941
|
reactData.scrollXWidth = viewTableWidth
|
|
860
942
|
|
|
861
943
|
return Promise.all([
|
|
862
|
-
|
|
944
|
+
updateTaskChartStyle($xeGanttView),
|
|
863
945
|
$xeGantt.handleUpdateTaskLinkStyle ? $xeGantt.handleUpdateTaskLinkStyle($xeGanttView) : null
|
|
864
946
|
])
|
|
865
947
|
}
|
|
@@ -2,7 +2,7 @@ import { PropType, VNode, CreateElement, Component } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
|
-
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
5
|
+
import { getLastZIndex, nextZIndex, isEnableConf, hasEnableConf, formatText } from '../../ui/src/utils'
|
|
6
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -174,6 +174,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
174
174
|
taskLinkConfig: Object as PropType<VxeGanttPropTypes.TaskLinkConfig>,
|
|
175
175
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
176
176
|
taskBarMilestoneConfig: Object as PropType<VxeGanttPropTypes.TaskBarMilestoneConfig>,
|
|
177
|
+
taskBarSubviewConfig: Object as PropType<VxeGanttPropTypes.TaskBarSubviewConfig>,
|
|
177
178
|
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
178
179
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
179
180
|
taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
|
|
@@ -299,6 +300,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
299
300
|
|
|
300
301
|
return Object.assign({}, getConfig().gantt.taskBarMilestoneConfig, props.taskBarMilestoneConfig)
|
|
301
302
|
},
|
|
303
|
+
computeTaskBarSubviewOpts () {
|
|
304
|
+
const $xeGantt = this
|
|
305
|
+
const props = $xeGantt
|
|
306
|
+
|
|
307
|
+
return Object.assign({}, getConfig().gantt.taskBarSubviewConfig, props.taskBarSubviewConfig)
|
|
308
|
+
},
|
|
302
309
|
computeTaskBarTooltipOpts () {
|
|
303
310
|
const $xeGantt = this
|
|
304
311
|
const props = $xeGantt
|
|
@@ -404,12 +411,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
404
411
|
const props = $xeGantt
|
|
405
412
|
const reactData = $xeGantt.reactData
|
|
406
413
|
|
|
407
|
-
const { height, maxHeight } = props
|
|
414
|
+
const { height, maxHeight, taskBarSubviewConfig } = props
|
|
408
415
|
const { isZMax, tZindex } = reactData
|
|
409
416
|
const taskViewOpts = $xeGantt.computeTaskViewOpts as VxeGanttPropTypes.TaskViewConfig
|
|
410
417
|
const { tableStyle } = taskViewOpts
|
|
411
418
|
const taskBarOpts = $xeGantt.computeTaskBarOpts as VxeGanttPropTypes.TaskBarConfig
|
|
412
419
|
const { barStyle } = taskBarOpts
|
|
420
|
+
const taskBarSubviewOpts = $xeGantt.computeTaskBarSubviewOpts
|
|
413
421
|
const stys: VxeComponentStyleType = {}
|
|
414
422
|
if (isZMax) {
|
|
415
423
|
stys.zIndex = tZindex
|
|
@@ -422,13 +430,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
422
430
|
}
|
|
423
431
|
}
|
|
424
432
|
if (barStyle && !XEUtils.isFunction(barStyle)) {
|
|
425
|
-
const { bgColor, completedBgColor } = barStyle
|
|
433
|
+
const { bgColor, completedBgColor, overviewBgColor } = barStyle
|
|
426
434
|
if (bgColor) {
|
|
427
435
|
stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor
|
|
428
436
|
}
|
|
429
437
|
if (completedBgColor) {
|
|
430
438
|
stys['--vxe-ui-gantt-view-task-bar-completed-background-color'] = completedBgColor
|
|
431
439
|
}
|
|
440
|
+
if (overviewBgColor && hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts)) {
|
|
441
|
+
stys['--vxe-ui-gantt-view-task-bar-overview-background-color'] = overviewBgColor
|
|
442
|
+
}
|
|
432
443
|
}
|
|
433
444
|
if (tableStyle) {
|
|
434
445
|
const { width: defTbWidth } = tableStyle
|
|
@@ -21,11 +21,15 @@ export enum VxeGanttDependencyType {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 任务渲染类型
|
|
25
25
|
*/
|
|
26
26
|
export enum VxeGanttTaskType {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 里程碑类型,该类型节点不需要结束日期
|
|
29
29
|
*/
|
|
30
|
-
Milestone = 'milestone'
|
|
30
|
+
Milestone = 'milestone',
|
|
31
|
+
/**
|
|
32
|
+
* 子视图类型,该类型会将子任务渲染到一行,无需开始日期和结束日期
|
|
33
|
+
*/
|
|
34
|
+
Subview = 'subview'
|
|
31
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VxeGanttDefines } from '../../../types'
|
|
1
|
+
import type { VxeGanttDefines, VxeGanttTaskType } from '../../../types'
|
|
2
2
|
import type { VxeTableDefines, VxeTablePropTypes } from 'vxe-table'
|
|
3
3
|
|
|
4
4
|
export function getRefElem (refEl: any) {
|
|
@@ -29,15 +29,19 @@ export function getTaskBarLeft (chartRest: VxeGanttDefines.RowCacheItem | null,
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
|
|
32
|
-
return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
|
|
32
|
+
return chartRest && chartRest.oWidthSize ? Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0) : 0
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const taskTypeMaps: Record<
|
|
36
|
-
milestone: true
|
|
35
|
+
const taskTypeMaps: Record<VxeGanttTaskType, boolean> = {
|
|
36
|
+
milestone: true,
|
|
37
|
+
subview: true
|
|
37
38
|
}
|
|
38
39
|
export function hasMilestoneTask (type: string) {
|
|
39
|
-
return
|
|
40
|
+
return type === 'milestone'
|
|
40
41
|
}
|
|
41
|
-
export function
|
|
42
|
-
return
|
|
42
|
+
export function hasSubviewTask (type: string) {
|
|
43
|
+
return type === 'subview'
|
|
44
|
+
}
|
|
45
|
+
export function getTaskType (type: string) {
|
|
46
|
+
return taskTypeMaps[type as VxeGanttTaskType] ? type as VxeGanttTaskType : 'default'
|
|
43
47
|
}
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -8,6 +8,10 @@ export function isEnableConf (conf: any): boolean {
|
|
|
8
8
|
return conf && conf.enabled !== false
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function hasEnableConf (conf: any, opts: any): boolean {
|
|
12
|
+
return opts && (conf ? opts.enabled !== false : opts.enabled)
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export function isEmptyValue (cellValue: any) {
|
|
12
16
|
return cellValue === null || cellValue === undefined || cellValue === ''
|
|
13
17
|
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
width: 100%;
|
|
14
14
|
height: 0;
|
|
15
15
|
&.row--pending {
|
|
16
|
-
.vxe-gantt-view--chart-bar
|
|
16
|
+
.vxe-gantt-view--chart-bar,
|
|
17
|
+
.vxe-gantt-view--chart-subview-bar {
|
|
17
18
|
color: var(--vxe-ui-font-disabled-color);
|
|
18
19
|
opacity: 0.5;
|
|
19
20
|
text-decoration: line-through;
|
|
@@ -35,7 +36,30 @@
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
.vxe-gantt-view--chart-subview-wrapper {
|
|
40
|
+
&.is--round {
|
|
41
|
+
& > .vxe-gantt-view--chart-subview-bar {
|
|
42
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
43
|
+
.vxe-gantt-view--chart-subview-bar-content-wrapper {
|
|
44
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
45
|
+
}
|
|
46
|
+
&:hover {
|
|
47
|
+
&::after {
|
|
48
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&.is--overview {
|
|
54
|
+
& > .vxe-gantt-view--chart-subview-bar {
|
|
55
|
+
color: #ffffff;
|
|
56
|
+
background-color: var(--vxe-ui-gantt-view-task-bar-overview-background-color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
38
61
|
.vxe-gantt-view--chart-bar,
|
|
62
|
+
.vxe-gantt-view--chart-subview-bar,
|
|
39
63
|
.vxe-gantt-view--chart-custom-bar {
|
|
40
64
|
display: flex;
|
|
41
65
|
flex-direction: row;
|
|
@@ -48,20 +72,27 @@
|
|
|
48
72
|
color: #ffffff;
|
|
49
73
|
background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
|
|
50
74
|
}
|
|
75
|
+
&.is--subview {
|
|
76
|
+
color: #ffffff;
|
|
77
|
+
background-color: var(--vxe-ui-gantt-view-task-bar-overview-background-color);
|
|
78
|
+
}
|
|
51
79
|
}
|
|
52
80
|
.vxe-gantt-view--chart-bar-content-wrapper,
|
|
53
|
-
.vxe-gantt-view--chart-custom-bar-content-wrapper
|
|
81
|
+
.vxe-gantt-view--chart-custom-bar-content-wrapper,
|
|
82
|
+
.vxe-gantt-view--chart-subview-bar-content-wrapper {
|
|
54
83
|
width: 100%;
|
|
55
84
|
overflow: hidden;
|
|
56
85
|
}
|
|
57
|
-
.vxe-gantt-view--chart-bar-content-wrapper
|
|
86
|
+
.vxe-gantt-view--chart-bar-content-wrapper,
|
|
87
|
+
.vxe-gantt-view--chart-subview-bar-content-wrapper {
|
|
58
88
|
width: 100%;
|
|
59
89
|
height: 100%;
|
|
60
90
|
display: flex;
|
|
61
91
|
flex-direction: row;
|
|
62
92
|
align-items: center;
|
|
63
93
|
}
|
|
64
|
-
.vxe-gantt-view--chart-bar
|
|
94
|
+
.vxe-gantt-view--chart-bar,
|
|
95
|
+
.vxe-gantt-view--chart-subview-bar {
|
|
65
96
|
align-items: center;
|
|
66
97
|
height: var(--vxe-ui-gantt-view-chart-bar-height);
|
|
67
98
|
&.is--default {
|
package/styles/theme/base.scss
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
--vxe-ui-gantt-view-task-bar-border-radius: calc(var(--vxe-ui-gantt-view-split-bar-height) / 2);
|
|
9
9
|
--vxe-ui-gantt-view-task-bar-background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
10
10
|
--vxe-ui-gantt-view-task-bar-completed-background-color: var(--vxe-ui-font-primary-color);
|
|
11
|
+
--vxe-ui-gantt-view-task-bar-overview-background-color: var(--vxe-ui-font-primary-darken-color);
|
|
11
12
|
--vxe-ui-gantt-view-task-line-color: var(--vxe-ui-font-primary-color);
|
|
12
13
|
--vxe-ui-gantt-view-task-line-width: 2px;
|
|
13
14
|
--vxe-ui-gantt-view-task-line-arrow-width: 5;
|