vxe-gantt 4.1.17 → 4.1.19
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/emits.js +4 -1
- package/es/gantt/src/gantt-chart.js +75 -53
- package/es/gantt/src/gantt-view.js +49 -20
- package/es/gantt/src/gantt.js +79 -39
- package/es/gantt/src/util.js +0 -3
- package/es/gantt/style.css +16 -2
- 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 +2 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-gantt/style.css +16 -2
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/emits.js +1 -1
- package/lib/gantt/src/emits.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +72 -44
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +49 -24
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +89 -38
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +0 -4
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +16 -2
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +210 -106
- 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 +2 -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/vxe-gantt/style/style.css +16 -2
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/emits.ts +4 -1
- package/packages/gantt/src/gantt-chart.ts +78 -53
- package/packages/gantt/src/gantt-view.ts +51 -20
- package/packages/gantt/src/gantt.ts +84 -40
- package/packages/gantt/src/util.ts +0 -4
- package/packages/ui/index.ts +1 -0
- package/styles/components/gantt-module/gantt-chart.scss +14 -2
- package/styles/theme/base.scss +1 -0
|
@@ -20,17 +20,16 @@ export default defineVxeComponent({
|
|
|
20
20
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
21
21
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
22
22
|
|
|
23
|
-
const { props: ganttProps, internalData: ganttInternalData } = $xeGantt
|
|
23
|
+
const { props: ganttProps, reactData: ganttReactData, internalData: ganttInternalData } = $xeGantt
|
|
24
24
|
const { reactData: ganttViewReactData, internalData: ganttViewInternalData } = $xeGanttView
|
|
25
25
|
const { computeProgressField, computeTitleField, computeTypeField, computeTaskBarOpts, computeScaleUnit, computeTaskLinkOpts, computeTaskBarMilestoneOpts } = $xeGantt.getComputeMaps()
|
|
26
26
|
|
|
27
27
|
const refElem = ref<HTMLDivElement>()
|
|
28
28
|
const refTaskWrapperElem = ref() as Ref<HTMLDivElement>
|
|
29
|
-
const
|
|
29
|
+
const refChartBeforeWrapperElem = ref() as Ref<HTMLDivElement>
|
|
30
|
+
const refChartAfterWrapperElem = ref() as Ref<HTMLDivElement>
|
|
30
31
|
|
|
31
32
|
const renderTaskBar = ($xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number) => {
|
|
32
|
-
const tableProps = $xeTable.props
|
|
33
|
-
const { treeConfig } = tableProps
|
|
34
33
|
const tableReactData = $xeTable.reactData
|
|
35
34
|
const { resizeHeightFlag } = tableReactData
|
|
36
35
|
const tableInternalData = $xeTable.internalData
|
|
@@ -44,6 +43,7 @@ export default defineVxeComponent({
|
|
|
44
43
|
const taskBarSlot = ganttSlots.taskBar || ganttSlots['task-bar']
|
|
45
44
|
|
|
46
45
|
const { taskBarMilestoneConfig } = ganttProps
|
|
46
|
+
const { activeLink, activeBarRowid } = ganttReactData
|
|
47
47
|
const titleField = computeTitleField.value
|
|
48
48
|
const progressField = computeProgressField.value
|
|
49
49
|
const typeField = computeTypeField.value
|
|
@@ -92,27 +92,12 @@ export default defineVxeComponent({
|
|
|
92
92
|
rowIndex,
|
|
93
93
|
_rowIndex
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
onClick: any
|
|
97
|
-
onDblclick: any
|
|
98
|
-
onMousedown: any
|
|
95
|
+
const ctOns: {
|
|
99
96
|
onMouseover?: any
|
|
100
97
|
onMouseleave?: any
|
|
101
|
-
} = {
|
|
102
|
-
onClick (evnt: MouseEvent) {
|
|
103
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
104
|
-
},
|
|
105
|
-
onDblclick (evnt: MouseEvent) {
|
|
106
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
107
|
-
},
|
|
108
|
-
onMousedown (evnt: MouseEvent) {
|
|
109
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
110
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
98
|
+
} = {}
|
|
114
99
|
if (showTooltip) {
|
|
115
|
-
|
|
100
|
+
ctOns.onMouseover = (evnt: MouseEvent) => {
|
|
116
101
|
const { dragBarRow } = ganttInternalData
|
|
117
102
|
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
118
103
|
if (!dragBarRow) {
|
|
@@ -120,7 +105,7 @@ export default defineVxeComponent({
|
|
|
120
105
|
}
|
|
121
106
|
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt)
|
|
122
107
|
}
|
|
123
|
-
|
|
108
|
+
ctOns.onMouseleave = (evnt: MouseEvent) => {
|
|
124
109
|
const { dragBarRow } = ganttInternalData
|
|
125
110
|
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
126
111
|
if (!dragBarRow) {
|
|
@@ -136,13 +121,16 @@ export default defineVxeComponent({
|
|
|
136
121
|
isMilestone,
|
|
137
122
|
title,
|
|
138
123
|
vbStyle,
|
|
139
|
-
vpStyle
|
|
124
|
+
vpStyle,
|
|
125
|
+
rowid,
|
|
126
|
+
ctOns
|
|
140
127
|
})
|
|
141
128
|
} else if (taskBarSlot) {
|
|
142
129
|
cbVNs.push(
|
|
143
130
|
h('div', {
|
|
144
131
|
key: 'cbc',
|
|
145
|
-
class: 'vxe-gantt-view--chart-custom-bar-content'
|
|
132
|
+
class: 'vxe-gantt-view--chart-custom-bar-content-wrapper',
|
|
133
|
+
...ctOns
|
|
146
134
|
}, $xeGantt.callSlot(taskBarSlot, barParams))
|
|
147
135
|
)
|
|
148
136
|
} else {
|
|
@@ -152,7 +140,8 @@ export default defineVxeComponent({
|
|
|
152
140
|
cbVNs.push(
|
|
153
141
|
h('div', {
|
|
154
142
|
key: 'vcm',
|
|
155
|
-
class: 'vxe-gantt-view--chart-milestone-wrapper'
|
|
143
|
+
class: 'vxe-gantt-view--chart-milestone-wrapper',
|
|
144
|
+
...ctOns
|
|
156
145
|
}, [
|
|
157
146
|
h('div', {
|
|
158
147
|
class: ['vxe-gantt-view--chart-milestone-icon', iconStatus ? `theme--${XEUtils.isFunction(iconStatus) ? iconStatus(tbmParams) : iconStatus}` : ''],
|
|
@@ -171,25 +160,31 @@ export default defineVxeComponent({
|
|
|
171
160
|
)
|
|
172
161
|
} else {
|
|
173
162
|
cbVNs.push(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
163
|
+
h('div', {
|
|
164
|
+
key: 'vbc',
|
|
165
|
+
class: 'vxe-gantt-view--chart-bar-content-wrapper',
|
|
166
|
+
...ctOns
|
|
167
|
+
}, [
|
|
168
|
+
showProgress
|
|
169
|
+
? h('div', {
|
|
170
|
+
key: 'vcp',
|
|
171
|
+
class: 'vxe-gantt-view--chart-progress',
|
|
172
|
+
style: vpStyle
|
|
173
|
+
})
|
|
174
|
+
: renderEmptyElement($xeGantt),
|
|
175
|
+
showContent
|
|
176
|
+
? h('div', {
|
|
177
|
+
key: 'vcc',
|
|
178
|
+
class: 'vxe-gantt-view--chart-content'
|
|
179
|
+
}, title)
|
|
180
|
+
: renderEmptyElement($xeGantt)
|
|
181
|
+
])
|
|
187
182
|
)
|
|
188
183
|
}
|
|
189
184
|
}
|
|
190
185
|
|
|
191
186
|
return h('div', {
|
|
192
|
-
key:
|
|
187
|
+
key: rowid,
|
|
193
188
|
rowid,
|
|
194
189
|
class: ['vxe-gantt-view--chart-row', `is--${gettaskType(typeValue)}`, {
|
|
195
190
|
'is--round': round,
|
|
@@ -203,10 +198,23 @@ export default defineVxeComponent({
|
|
|
203
198
|
}
|
|
204
199
|
}, [
|
|
205
200
|
h('div', {
|
|
206
|
-
class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}
|
|
201
|
+
class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`, {
|
|
202
|
+
'is--active': activeBarRowid === rowid,
|
|
203
|
+
'active--link': activeLink && (rowid === `${activeLink.from}` || rowid === `${activeLink.to}`)
|
|
204
|
+
}],
|
|
207
205
|
style: vbStyle,
|
|
208
206
|
rowid,
|
|
209
|
-
|
|
207
|
+
onClick (evnt: MouseEvent) {
|
|
208
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
209
|
+
},
|
|
210
|
+
onDblclick (evnt: MouseEvent) {
|
|
211
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
212
|
+
},
|
|
213
|
+
onMousedown (evnt: MouseEvent) {
|
|
214
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
215
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
210
218
|
}, cbVNs)
|
|
211
219
|
])
|
|
212
220
|
}
|
|
@@ -254,26 +262,41 @@ export default defineVxeComponent({
|
|
|
254
262
|
const renderVN = () => {
|
|
255
263
|
const $xeTable = ganttViewInternalData.xeTable
|
|
256
264
|
|
|
265
|
+
const { dragLinkFromStore } = ganttReactData
|
|
257
266
|
const { tableData } = ganttViewReactData
|
|
258
267
|
const taskLinkOpts = computeTaskLinkOpts.value
|
|
259
|
-
const
|
|
268
|
+
const taskBarOpts = computeTaskBarOpts.value
|
|
269
|
+
const { isCurrent, isHover } = taskLinkOpts
|
|
270
|
+
const { linkCreatable } = taskBarOpts
|
|
260
271
|
|
|
261
272
|
return h('div', {
|
|
262
273
|
ref: refElem,
|
|
263
|
-
class: 'vxe-gantt-view--chart-wrapper'
|
|
274
|
+
class: ['vxe-gantt-view--chart-wrapper', {
|
|
275
|
+
'is--cl-drag': dragLinkFromStore.rowid
|
|
276
|
+
}]
|
|
264
277
|
}, [
|
|
265
|
-
$xeGantt.
|
|
278
|
+
$xeGantt.renderGanttTaskChartBefores
|
|
266
279
|
? h('div', {
|
|
267
|
-
ref:
|
|
268
|
-
class: ['vxe-gantt-view--chart-
|
|
269
|
-
'
|
|
280
|
+
ref: refChartBeforeWrapperElem,
|
|
281
|
+
class: ['vxe-gantt-view--chart-before-wrapper', {
|
|
282
|
+
'link--current': isCurrent,
|
|
283
|
+
'link--hover': isHover
|
|
270
284
|
}]
|
|
271
|
-
}, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.
|
|
285
|
+
}, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartBefores() : [])
|
|
272
286
|
: renderEmptyElement($xeGantt),
|
|
273
287
|
h('div', {
|
|
274
288
|
ref: refTaskWrapperElem,
|
|
275
|
-
class: 'vxe-gantt-view--chart-task-wrapper'
|
|
276
|
-
|
|
289
|
+
class: ['vxe-gantt-view--chart-task-wrapper', {
|
|
290
|
+
'link--current': isCurrent,
|
|
291
|
+
'link--create': linkCreatable
|
|
292
|
+
}]
|
|
293
|
+
}, $xeTable ? renderTaskRows($xeTable, tableData) : []),
|
|
294
|
+
$xeGantt.renderGanttTaskChartAfters
|
|
295
|
+
? h('div', {
|
|
296
|
+
ref: refChartAfterWrapperElem,
|
|
297
|
+
class: 'vxe-gantt-view--chart-after-wrapper'
|
|
298
|
+
}, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartAfters() : [])
|
|
299
|
+
: renderEmptyElement($xeGantt)
|
|
277
300
|
])
|
|
278
301
|
}
|
|
279
302
|
|
|
@@ -281,14 +304,16 @@ export default defineVxeComponent({
|
|
|
281
304
|
const { elemStore } = ganttViewInternalData
|
|
282
305
|
const prefix = 'main-chart-'
|
|
283
306
|
elemStore[`${prefix}task-wrapper`] = refTaskWrapperElem
|
|
284
|
-
elemStore[`${prefix}
|
|
307
|
+
elemStore[`${prefix}before-wrapper`] = refChartBeforeWrapperElem
|
|
308
|
+
elemStore[`${prefix}after-wrapper`] = refChartAfterWrapperElem
|
|
285
309
|
})
|
|
286
310
|
|
|
287
311
|
onUnmounted(() => {
|
|
288
312
|
const { elemStore } = ganttViewInternalData
|
|
289
313
|
const prefix = 'main-chart-'
|
|
290
314
|
elemStore[`${prefix}task-wrapper`] = null
|
|
291
|
-
elemStore[`${prefix}
|
|
315
|
+
elemStore[`${prefix}before-wrapper`] = null
|
|
316
|
+
elemStore[`${prefix}after-wrapper`] = null
|
|
292
317
|
})
|
|
293
318
|
|
|
294
319
|
return renderVN
|
|
@@ -303,15 +303,8 @@ export default defineVxeComponent({
|
|
|
303
303
|
const q = Math.ceil((itemDate.getMonth() + 1) / 3)
|
|
304
304
|
const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
|
|
305
305
|
const WW = XEUtils.padStart(W, 2, '0')
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
// '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
|
|
309
|
-
// '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
|
|
310
|
-
if (W === '1' && MM === '12') {
|
|
311
|
-
wYear = `${Number(yyyy) + 1}`
|
|
312
|
-
if (isMinWeek) {
|
|
313
|
-
yyyy = wYear
|
|
314
|
-
}
|
|
306
|
+
if (isMinWeek && checkWeekOfsetYear(W, M)) {
|
|
307
|
+
yyyy = `${Number(yyyy) + 1}`
|
|
315
308
|
}
|
|
316
309
|
const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
|
|
317
310
|
const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
|
|
@@ -421,6 +414,32 @@ export default defineVxeComponent({
|
|
|
421
414
|
}
|
|
422
415
|
}
|
|
423
416
|
|
|
417
|
+
/**
|
|
418
|
+
* 判断周的年份是否跨年
|
|
419
|
+
*/
|
|
420
|
+
const checkWeekOfsetYear = (W: number | string, M: number | string) => {
|
|
421
|
+
return `${W}` === '1' && `${M}` === '12'
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
|
|
426
|
+
* '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
|
|
427
|
+
* '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
|
|
428
|
+
*/
|
|
429
|
+
const parseWeekObj = (date: any, firstDay?: 0 | 5 | 1 | 2 | 3 | 4 | 6) => {
|
|
430
|
+
const currDate = XEUtils.toStringDate(date)
|
|
431
|
+
let yyyy = currDate.getFullYear()
|
|
432
|
+
const month = currDate.getMonth()
|
|
433
|
+
const weekNum = XEUtils.getYearWeek(currDate, firstDay)
|
|
434
|
+
if (checkWeekOfsetYear(weekNum, month + 1)) {
|
|
435
|
+
yyyy++
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
yyyy,
|
|
439
|
+
W: weekNum
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
424
443
|
const createChartRender = (fullCols: VxeGanttDefines.ViewColumn[]) => {
|
|
425
444
|
const { minViewDate } = reactData
|
|
426
445
|
const minScale = computeMinScale.value
|
|
@@ -505,9 +524,11 @@ export default defineVxeComponent({
|
|
|
505
524
|
return (startValue: any, endValue: any) => {
|
|
506
525
|
const startDate = parseStringDate(startValue)
|
|
507
526
|
const endDate = parseStringDate(endValue)
|
|
508
|
-
const
|
|
527
|
+
const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined)
|
|
528
|
+
const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`
|
|
509
529
|
const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined)
|
|
510
|
-
const
|
|
530
|
+
const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined)
|
|
531
|
+
const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`
|
|
511
532
|
const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined)
|
|
512
533
|
const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs)
|
|
513
534
|
const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize
|
|
@@ -930,7 +951,7 @@ export default defineVxeComponent({
|
|
|
930
951
|
|
|
931
952
|
return Promise.all([
|
|
932
953
|
updateTaskChart(),
|
|
933
|
-
$xeGantt.
|
|
954
|
+
$xeGantt.handleUpdateTaskLinkStyle ? $xeGantt.handleUpdateTaskLinkStyle($xeGanttView) : null
|
|
934
955
|
])
|
|
935
956
|
}
|
|
936
957
|
|
|
@@ -1094,10 +1115,15 @@ export default defineVxeComponent({
|
|
|
1094
1115
|
scrollXSpaceEl.style.width = `${scrollXWidth}px`
|
|
1095
1116
|
}
|
|
1096
1117
|
|
|
1097
|
-
const
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1118
|
+
const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper'])
|
|
1119
|
+
const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild as HTMLDivElement : null
|
|
1120
|
+
if (beforeSvgElem) {
|
|
1121
|
+
beforeSvgElem.style.width = `${scrollXWidth}px`
|
|
1122
|
+
}
|
|
1123
|
+
const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper'])
|
|
1124
|
+
const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild as HTMLDivElement : null
|
|
1125
|
+
if (afterSvgElem) {
|
|
1126
|
+
afterSvgElem.style.width = `${scrollXWidth}px`
|
|
1101
1127
|
}
|
|
1102
1128
|
|
|
1103
1129
|
calcScrollbar()
|
|
@@ -1159,10 +1185,15 @@ export default defineVxeComponent({
|
|
|
1159
1185
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
1160
1186
|
}
|
|
1161
1187
|
|
|
1162
|
-
const
|
|
1163
|
-
const
|
|
1164
|
-
if (
|
|
1165
|
-
|
|
1188
|
+
const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper'])
|
|
1189
|
+
const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild as HTMLDivElement : null
|
|
1190
|
+
if (beforeSvgElem) {
|
|
1191
|
+
beforeSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
1192
|
+
}
|
|
1193
|
+
const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper'])
|
|
1194
|
+
const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild as HTMLDivElement : null
|
|
1195
|
+
if (afterSvgElem) {
|
|
1196
|
+
afterSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
1166
1197
|
}
|
|
1167
1198
|
|
|
1168
1199
|
reactData.scrollYTop = scrollYTop
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, ref, PropType, computed, provide, reactive, onUnmounted, watch, nextTick, VNode, onMounted } from 'vue'
|
|
1
|
+
import { h, ref, PropType, computed, provide, reactive, onBeforeUnmount, onUnmounted, watch, nextTick, VNode, onMounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
@@ -30,9 +30,54 @@ function createInternalData (): GanttInternalData {
|
|
|
30
30
|
linkFromKeyMaps: {},
|
|
31
31
|
linkUniqueMaps: {},
|
|
32
32
|
uFoot: false,
|
|
33
|
-
resizeTableWidth: 0
|
|
34
|
-
// barTipTimeout: null
|
|
35
|
-
// dragBarRow: null
|
|
33
|
+
resizeTableWidth: 0,
|
|
34
|
+
// barTipTimeout: null,
|
|
35
|
+
// dragBarRow: null,
|
|
36
|
+
// dragLineRow: null,
|
|
37
|
+
dragLinkToStore: {
|
|
38
|
+
rowid: null,
|
|
39
|
+
type: 0
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function createReactData (): GanttReactData {
|
|
45
|
+
return {
|
|
46
|
+
tableLoading: false,
|
|
47
|
+
proxyInited: false,
|
|
48
|
+
isZMax: false,
|
|
49
|
+
tableLinks: [],
|
|
50
|
+
tableData: [],
|
|
51
|
+
filterData: [],
|
|
52
|
+
formData: {},
|
|
53
|
+
sortData: [],
|
|
54
|
+
footerData: [],
|
|
55
|
+
tZindex: 0,
|
|
56
|
+
tablePage: {
|
|
57
|
+
total: 0,
|
|
58
|
+
pageSize: getConfig().pager?.pageSize || 10,
|
|
59
|
+
currentPage: 1
|
|
60
|
+
},
|
|
61
|
+
showLeftView: true,
|
|
62
|
+
showRightView: true,
|
|
63
|
+
taskScaleList: [],
|
|
64
|
+
|
|
65
|
+
barTipStore: {
|
|
66
|
+
row: null,
|
|
67
|
+
content: '',
|
|
68
|
+
visible: false,
|
|
69
|
+
params: null
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
dragLinkFromStore: {
|
|
73
|
+
rowid: null,
|
|
74
|
+
type: 0
|
|
75
|
+
},
|
|
76
|
+
activeBarRowid: null,
|
|
77
|
+
activeLink: null,
|
|
78
|
+
isActiveCeLe: false,
|
|
79
|
+
linkList: [],
|
|
80
|
+
upLinkFlag: 0
|
|
36
81
|
}
|
|
37
82
|
}
|
|
38
83
|
|
|
@@ -117,36 +162,7 @@ export default defineVxeComponent({
|
|
|
117
162
|
|
|
118
163
|
const { computeSize } = useFns.useSize(props)
|
|
119
164
|
|
|
120
|
-
const reactData = reactive
|
|
121
|
-
tableLoading: false,
|
|
122
|
-
proxyInited: false,
|
|
123
|
-
isZMax: false,
|
|
124
|
-
tableLinks: [],
|
|
125
|
-
tableData: [],
|
|
126
|
-
filterData: [],
|
|
127
|
-
formData: {},
|
|
128
|
-
sortData: [],
|
|
129
|
-
footerData: [],
|
|
130
|
-
tZindex: 0,
|
|
131
|
-
tablePage: {
|
|
132
|
-
total: 0,
|
|
133
|
-
pageSize: getConfig().pager?.pageSize || 10,
|
|
134
|
-
currentPage: 1
|
|
135
|
-
},
|
|
136
|
-
showLeftView: true,
|
|
137
|
-
showRightView: true,
|
|
138
|
-
taskScaleList: [],
|
|
139
|
-
|
|
140
|
-
barTipStore: {
|
|
141
|
-
row: null,
|
|
142
|
-
content: '',
|
|
143
|
-
visible: false,
|
|
144
|
-
params: null
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
linkList: [],
|
|
148
|
-
upLinkFlag: 0
|
|
149
|
-
})
|
|
165
|
+
const reactData = reactive(createReactData())
|
|
150
166
|
|
|
151
167
|
const internalData = createInternalData()
|
|
152
168
|
|
|
@@ -288,6 +304,11 @@ export default defineVxeComponent({
|
|
|
288
304
|
return scales
|
|
289
305
|
})
|
|
290
306
|
|
|
307
|
+
const computeTaskLinkStyle = computed(() => {
|
|
308
|
+
const { lineType, lineWidth, lineStatus, lineColor } = computeTaskLinkOpts.value
|
|
309
|
+
return `${lineType || ''}_${lineWidth || ''}_${lineStatus || ''}_${lineColor || ''}`
|
|
310
|
+
})
|
|
311
|
+
|
|
291
312
|
const computeTitleField = computed(() => {
|
|
292
313
|
const taskOpts = computeTaskOpts.value
|
|
293
314
|
return taskOpts.titleField || 'title'
|
|
@@ -1768,21 +1789,34 @@ export default defineVxeComponent({
|
|
|
1768
1789
|
$xeTable.handleToggleCheckRowEvent(evnt, params)
|
|
1769
1790
|
}
|
|
1770
1791
|
}
|
|
1792
|
+
reactData.isActiveCeLe = false
|
|
1793
|
+
reactData.activeBarRowid = null
|
|
1794
|
+
reactData.activeLink = null
|
|
1771
1795
|
$xeGantt.dispatchEvent('task-cell-click', params, evnt)
|
|
1772
1796
|
},
|
|
1773
1797
|
handleTaskCellDblclickEvent (evnt, params) {
|
|
1774
1798
|
$xeGantt.dispatchEvent('task-cell-dblclick', params, evnt)
|
|
1775
1799
|
},
|
|
1776
1800
|
handleTaskBarClickEvent (evnt, params) {
|
|
1801
|
+
const $xeTable = refTable.value
|
|
1802
|
+
const taskBarOpts = computeTaskBarOpts.value
|
|
1803
|
+
const { linkCreatable } = taskBarOpts
|
|
1804
|
+
const { row } = params
|
|
1805
|
+
reactData.isActiveCeLe = !!linkCreatable
|
|
1806
|
+
reactData.activeBarRowid = $xeTable ? $xeTable.getRowid(row) : row
|
|
1807
|
+
reactData.activeLink = null
|
|
1777
1808
|
$xeGantt.dispatchEvent('task-bar-click', params, evnt)
|
|
1778
1809
|
},
|
|
1779
1810
|
handleTaskBarDblclickEvent (evnt, params) {
|
|
1780
1811
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1781
1812
|
},
|
|
1782
1813
|
triggerTaskBarTooltipEvent (evnt, params) {
|
|
1783
|
-
const { barTipStore } = reactData
|
|
1784
|
-
const { dragBarRow } = internalData
|
|
1785
|
-
if (dragBarRow) {
|
|
1814
|
+
const { barTipStore, activeLink } = reactData
|
|
1815
|
+
const { dragBarRow, dragLineRow } = internalData
|
|
1816
|
+
if (dragBarRow || dragLineRow) {
|
|
1817
|
+
return
|
|
1818
|
+
}
|
|
1819
|
+
if (activeLink) {
|
|
1786
1820
|
return
|
|
1787
1821
|
}
|
|
1788
1822
|
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value
|
|
@@ -2433,6 +2467,12 @@ export default defineVxeComponent({
|
|
|
2433
2467
|
$xeGantt.refreshTaskView()
|
|
2434
2468
|
})
|
|
2435
2469
|
|
|
2470
|
+
watch(computeTaskLinkStyle, () => {
|
|
2471
|
+
if ($xeGantt.handleUpdateTaskLinkData) {
|
|
2472
|
+
$xeGantt.handleUpdateTaskLinkData()
|
|
2473
|
+
}
|
|
2474
|
+
})
|
|
2475
|
+
|
|
2436
2476
|
hooks.forEach((options) => {
|
|
2437
2477
|
const { setupGantt } = options
|
|
2438
2478
|
if (setupGantt) {
|
|
@@ -2443,16 +2483,16 @@ export default defineVxeComponent({
|
|
|
2443
2483
|
}
|
|
2444
2484
|
})
|
|
2445
2485
|
|
|
2446
|
-
if ($xeGantt.
|
|
2486
|
+
if ($xeGantt.handleTaskLoadLinks) {
|
|
2447
2487
|
if (props.links) {
|
|
2448
|
-
$xeGantt.
|
|
2488
|
+
$xeGantt.handleTaskLoadLinks(props.links)
|
|
2449
2489
|
}
|
|
2450
2490
|
}
|
|
2451
2491
|
handleTaskScaleConfig()
|
|
2452
2492
|
initPages()
|
|
2453
2493
|
|
|
2454
2494
|
onMounted(() => {
|
|
2455
|
-
if (!$xeGantt.
|
|
2495
|
+
if (!$xeGantt.handleUpdateTaskLinkData) {
|
|
2456
2496
|
if (props.links) {
|
|
2457
2497
|
warnLog('vxe.error.notProp', ['links'])
|
|
2458
2498
|
}
|
|
@@ -2508,6 +2548,10 @@ export default defineVxeComponent({
|
|
|
2508
2548
|
globalEvents.on($xeGantt, 'keydown', handleGlobalKeydownEvent)
|
|
2509
2549
|
})
|
|
2510
2550
|
|
|
2551
|
+
onBeforeUnmount(() => {
|
|
2552
|
+
XEUtils.assign(reactData, createReactData())
|
|
2553
|
+
})
|
|
2554
|
+
|
|
2511
2555
|
onUnmounted(() => {
|
|
2512
2556
|
globalEvents.off($xeGantt, 'keydown')
|
|
2513
2557
|
XEUtils.assign(internalData, createInternalData())
|
|
@@ -42,10 +42,6 @@ export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null,
|
|
|
42
42
|
return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function getTaskLinkKey (from: string | number, to: string | number) {
|
|
46
|
-
return `${from}_${to}`
|
|
47
|
-
}
|
|
48
|
-
|
|
49
45
|
const taskTypeMaps: Record<string, boolean> = {
|
|
50
46
|
milestone: true
|
|
51
47
|
}
|
package/packages/ui/index.ts
CHANGED
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
& > .vxe-gantt-view--chart-bar,
|
|
17
17
|
& > .vxe-gantt-view--chart-custom-bar {
|
|
18
18
|
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
19
|
+
.vxe-gantt-view--chart-bar-content-wrapper,
|
|
20
|
+
.vxe-gantt-view--chart-custom-bar-content-wrapper {
|
|
21
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
22
|
+
}
|
|
19
23
|
&:hover {
|
|
20
24
|
&::after {
|
|
21
25
|
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
@@ -32,15 +36,23 @@
|
|
|
32
36
|
top: 50%;
|
|
33
37
|
left: 0;
|
|
34
38
|
transform: translateY(-50%);
|
|
35
|
-
overflow: hidden;
|
|
36
39
|
pointer-events: all;
|
|
37
40
|
&.is--default {
|
|
38
41
|
color: #ffffff;
|
|
39
42
|
background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
.vxe-gantt-view--chart-
|
|
45
|
+
.vxe-gantt-view--chart-bar-content-wrapper,
|
|
46
|
+
.vxe-gantt-view--chart-custom-bar-content-wrapper {
|
|
47
|
+
width: 100%;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
50
|
+
.vxe-gantt-view--chart-bar-content-wrapper {
|
|
43
51
|
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
align-items: center;
|
|
44
56
|
}
|
|
45
57
|
.vxe-gantt-view--chart-bar {
|
|
46
58
|
align-items: center;
|
package/styles/theme/base.scss
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
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
11
|
--vxe-ui-gantt-view-task-line-color: var(--vxe-ui-font-primary-color);
|
|
12
|
+
--vxe-ui-gantt-view-task-line-width: 2px;
|
|
12
13
|
--vxe-ui-gantt-view-task-line-arrow-width: 5;
|
|
13
14
|
}
|