vxe-gantt 4.1.0 → 4.1.2
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 +2 -0
- package/es/gantt/src/gantt-body.js +25 -3
- package/es/gantt/src/gantt-chart.js +41 -21
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +138 -8
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/emits.js +1 -1
- package/lib/gantt/src/emits.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +8 -1
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +43 -18
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +9 -7
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +5 -2
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +146 -6
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +216 -35
- package/lib/index.umd.min.js +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/package.json +2 -2
- package/packages/gantt/src/emits.ts +2 -0
- package/packages/gantt/src/gantt-body.ts +25 -3
- package/packages/gantt/src/gantt-chart.ts +47 -16
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +146 -8
- package/packages/ui/index.ts +3 -0
|
@@ -17,7 +17,7 @@ export default defineVxeComponent({
|
|
|
17
17
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
18
18
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
19
19
|
|
|
20
|
-
const { computeTaskViewOpts } = $xeGantt.getComputeMaps()
|
|
20
|
+
const { computeTaskViewOpts, computeScaleUnit } = $xeGantt.getComputeMaps()
|
|
21
21
|
const { reactData, internalData } = $xeGanttView
|
|
22
22
|
|
|
23
23
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
@@ -42,6 +42,7 @@ export default defineVxeComponent({
|
|
|
42
42
|
const { todayDateMaps } = internalData
|
|
43
43
|
const taskViewOpts = computeTaskViewOpts.value
|
|
44
44
|
const { showNowLine, viewStyle } = taskViewOpts
|
|
45
|
+
const scaleUnit = computeScaleUnit.value
|
|
45
46
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {}
|
|
46
47
|
const { field, dateObj } = column
|
|
47
48
|
const { cellClassName, cellStyle } = viewStyle || {}
|
|
@@ -88,7 +89,18 @@ export default defineVxeComponent({
|
|
|
88
89
|
})
|
|
89
90
|
)
|
|
90
91
|
}
|
|
91
|
-
const ctParams = {
|
|
92
|
+
const ctParams = {
|
|
93
|
+
$gantt: $xeGantt,
|
|
94
|
+
source: sourceType,
|
|
95
|
+
type: viewType,
|
|
96
|
+
scaleType: scaleUnit,
|
|
97
|
+
dateObj,
|
|
98
|
+
row,
|
|
99
|
+
column,
|
|
100
|
+
$rowIndex,
|
|
101
|
+
rowIndex,
|
|
102
|
+
_rowIndex
|
|
103
|
+
}
|
|
92
104
|
return h('td', {
|
|
93
105
|
key: $columnIndex,
|
|
94
106
|
class: [
|
|
@@ -133,6 +145,7 @@ export default defineVxeComponent({
|
|
|
133
145
|
const { transform } = treeOpts
|
|
134
146
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
135
147
|
|
|
148
|
+
const scaleUnit = computeScaleUnit.value
|
|
136
149
|
const taskViewOpts = computeTaskViewOpts.value
|
|
137
150
|
const { viewStyle } = taskViewOpts
|
|
138
151
|
const { rowClassName, rowStyle } = viewStyle || {}
|
|
@@ -170,7 +183,16 @@ export default defineVxeComponent({
|
|
|
170
183
|
trOns.onDragend = $xeTable.handleRowDragDragendEvent
|
|
171
184
|
trOns.onDragover = $xeTable.handleRowDragDragoverEvent
|
|
172
185
|
}
|
|
173
|
-
const rowParams = {
|
|
186
|
+
const rowParams = {
|
|
187
|
+
$gantt: $xeGantt,
|
|
188
|
+
source: sourceType,
|
|
189
|
+
type: viewType,
|
|
190
|
+
scaleType: scaleUnit,
|
|
191
|
+
row,
|
|
192
|
+
rowIndex,
|
|
193
|
+
$rowIndex,
|
|
194
|
+
_rowIndex
|
|
195
|
+
}
|
|
174
196
|
trVNs.push(
|
|
175
197
|
h('tr', {
|
|
176
198
|
key: treeConfig ? rowid : $rowIndex,
|
|
@@ -21,7 +21,7 @@ export default defineVxeComponent({
|
|
|
21
21
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
22
22
|
|
|
23
23
|
const { reactData, internalData } = $xeGanttView
|
|
24
|
-
const { computeProgressField, computeTitleField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
|
|
24
|
+
const { computeProgressField, computeTitleField, computeTaskBarOpts, computeScaleUnit } = $xeGantt.getComputeMaps()
|
|
25
25
|
|
|
26
26
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
27
27
|
|
|
@@ -43,8 +43,9 @@ export default defineVxeComponent({
|
|
|
43
43
|
const titleField = computeTitleField.value
|
|
44
44
|
const progressField = computeProgressField.value
|
|
45
45
|
const taskBarOpts = computeTaskBarOpts.value
|
|
46
|
-
const
|
|
47
|
-
const {
|
|
46
|
+
const scaleUnit = computeScaleUnit.value
|
|
47
|
+
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit }
|
|
48
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts
|
|
48
49
|
const isBarRowStyle = XEUtils.isFunction(barStyle)
|
|
49
50
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {}
|
|
50
51
|
const { round } = barStyObj
|
|
@@ -72,10 +73,50 @@ export default defineVxeComponent({
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
if (contentMethod) {
|
|
75
|
-
title = getStringValue(contentMethod({ row, title }))
|
|
76
|
+
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }))
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
const ctParams = {
|
|
79
|
+
const ctParams = {
|
|
80
|
+
$gantt: $xeGantt,
|
|
81
|
+
source: sourceType,
|
|
82
|
+
type: viewType,
|
|
83
|
+
scaleType: scaleUnit,
|
|
84
|
+
row,
|
|
85
|
+
$rowIndex,
|
|
86
|
+
rowIndex,
|
|
87
|
+
_rowIndex
|
|
88
|
+
}
|
|
89
|
+
const ons: {
|
|
90
|
+
onClick: any
|
|
91
|
+
onDblclick: any
|
|
92
|
+
onMousedown: any
|
|
93
|
+
onMouseover?: any
|
|
94
|
+
onMouseleave?: any
|
|
95
|
+
} = {
|
|
96
|
+
onClick (evnt: MouseEvent) {
|
|
97
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
98
|
+
},
|
|
99
|
+
onDblclick (evnt: MouseEvent) {
|
|
100
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
101
|
+
},
|
|
102
|
+
onMousedown (evnt: MouseEvent) {
|
|
103
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
104
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (showTooltip) {
|
|
109
|
+
ons.onMouseover = (evnt: MouseEvent) => {
|
|
110
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
111
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams)
|
|
112
|
+
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt)
|
|
113
|
+
}
|
|
114
|
+
ons.onMouseleave = (evnt: MouseEvent) => {
|
|
115
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
116
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams)
|
|
117
|
+
$xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
79
120
|
return h('div', {
|
|
80
121
|
key: treeConfig ? rowid : $rowIndex,
|
|
81
122
|
rowid,
|
|
@@ -95,17 +136,7 @@ export default defineVxeComponent({
|
|
|
95
136
|
class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
|
|
96
137
|
style: vbStyle,
|
|
97
138
|
rowid,
|
|
98
|
-
|
|
99
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
100
|
-
},
|
|
101
|
-
onDblclick (evnt: MouseEvent) {
|
|
102
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
103
|
-
},
|
|
104
|
-
onMousedown (evnt: MouseEvent) {
|
|
105
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
106
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
139
|
+
...ons
|
|
109
140
|
}, taskBarSlot
|
|
110
141
|
? $xeGantt.callSlot(taskBarSlot, barParams)
|
|
111
142
|
: [
|
|
@@ -65,15 +65,17 @@ export default defineVxeComponent({
|
|
|
65
65
|
}, columns.map((column, cIndex) => {
|
|
66
66
|
const { field, childCount, dateObj } = column
|
|
67
67
|
let label = `${column.title}`
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
|
|
71
|
-
} else {
|
|
72
|
-
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj)
|
|
73
|
-
}
|
|
68
|
+
if (scaleItem.type === 'day') {
|
|
69
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
|
|
74
70
|
} else {
|
|
75
|
-
if (
|
|
71
|
+
if ($rowIndex) {
|
|
76
72
|
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj)
|
|
73
|
+
} else {
|
|
74
|
+
if (isLast && scaleItem.type === 'week') {
|
|
75
|
+
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj)
|
|
76
|
+
} else {
|
|
77
|
+
label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj)
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
let cellVNs: string | VxeComponentSlotType[] = label
|
|
@@ -337,7 +337,7 @@ export default defineVxeComponent({
|
|
|
337
337
|
if (minScale.level < 17) {
|
|
338
338
|
handleData('quarter', colMaps, minCol)
|
|
339
339
|
}
|
|
340
|
-
if (minScale.level <
|
|
340
|
+
if (minScale.level < 15) {
|
|
341
341
|
handleData('month', colMaps, minCol)
|
|
342
342
|
}
|
|
343
343
|
if (minScale.level < 13) {
|
|
@@ -346,7 +346,7 @@ export default defineVxeComponent({
|
|
|
346
346
|
if (minScale.level < 11) {
|
|
347
347
|
handleData('day', colMaps, minCol)
|
|
348
348
|
}
|
|
349
|
-
if (minScale.level <
|
|
349
|
+
if (minScale.level < 9) {
|
|
350
350
|
handleData('date', colMaps, minCol)
|
|
351
351
|
}
|
|
352
352
|
if (minScale.level < 7) {
|
|
@@ -355,6 +355,9 @@ export default defineVxeComponent({
|
|
|
355
355
|
if (minScale.level < 5) {
|
|
356
356
|
handleData('minute', colMaps, minCol)
|
|
357
357
|
}
|
|
358
|
+
if (minScale.level < 3) {
|
|
359
|
+
handleData('second', colMaps, minCol)
|
|
360
|
+
}
|
|
358
361
|
|
|
359
362
|
fullCols.push(minCol)
|
|
360
363
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, ref, PropType, computed, provide, reactive, onUnmounted, watch, nextTick, VNode, onMounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
|
-
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
4
|
+
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
5
5
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
7
7
|
import { VxeUI } from '@vxe-ui/core'
|
|
@@ -12,7 +12,7 @@ import GanttViewComponent from './gantt-view'
|
|
|
12
12
|
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
13
13
|
|
|
14
14
|
import type { VxeGanttConstructor, VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, GanttMethods, GanttPrivateMethods, VxeGanttPrivateMethods, GanttPrivateRef, VxeGanttProps, VxeGanttPrivateComputed, VxeGanttViewInstance, VxeGanttDefines } from '../../../types'
|
|
15
|
-
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
15
|
+
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxeTooltipInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
16
16
|
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTablePropTypes, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeToolbarInstance, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
17
17
|
|
|
18
18
|
const { getConfig, getIcon, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
@@ -28,6 +28,7 @@ function createInternalData (): GanttInternalData {
|
|
|
28
28
|
return {
|
|
29
29
|
uFoot: false,
|
|
30
30
|
resizeTableWidth: 0
|
|
31
|
+
// barTipTimeout: undefined
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -84,6 +85,7 @@ export default defineVxeComponent({
|
|
|
84
85
|
taskViewScaleConfig: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfig>,
|
|
85
86
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
86
87
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
88
|
+
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
87
89
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
88
90
|
taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
|
|
89
91
|
taskBarDragConfig: Object as PropType<VxeGanttPropTypes.TaskBarDragConfig>,
|
|
@@ -103,6 +105,7 @@ export default defineVxeComponent({
|
|
|
103
105
|
const VxeUIPagerComponent = VxeUI.getComponent('VxePager')
|
|
104
106
|
const VxeTableComponent = VxeUI.getComponent('VxeTable')
|
|
105
107
|
const VxeToolbarComponent = VxeUI.getComponent('VxeToolbar')
|
|
108
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
106
109
|
|
|
107
110
|
const { computeSize } = useFns.useSize(props)
|
|
108
111
|
|
|
@@ -123,7 +126,14 @@ export default defineVxeComponent({
|
|
|
123
126
|
},
|
|
124
127
|
showLeftView: true,
|
|
125
128
|
showRightView: true,
|
|
126
|
-
taskScaleList: []
|
|
129
|
+
taskScaleList: [],
|
|
130
|
+
|
|
131
|
+
barTipStore: {
|
|
132
|
+
row: null,
|
|
133
|
+
content: '',
|
|
134
|
+
visible: false,
|
|
135
|
+
params: null
|
|
136
|
+
}
|
|
127
137
|
})
|
|
128
138
|
|
|
129
139
|
const internalData = createInternalData()
|
|
@@ -147,6 +157,8 @@ export default defineVxeComponent({
|
|
|
147
157
|
const refTableWrapper = ref<HTMLDivElement>()
|
|
148
158
|
const refGanttWrapper = ref<HTMLDivElement>()
|
|
149
159
|
|
|
160
|
+
const refTooltip = ref<VxeTooltipInstance>()
|
|
161
|
+
|
|
150
162
|
const refResizableSplitTip = ref<HTMLDivElement>()
|
|
151
163
|
|
|
152
164
|
const extendTableMethods = <T>(methodKeys: T[]) => {
|
|
@@ -231,6 +243,10 @@ export default defineVxeComponent({
|
|
|
231
243
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
232
244
|
})
|
|
233
245
|
|
|
246
|
+
const computeTaskBarTooltipOpts = computed(() => {
|
|
247
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
248
|
+
})
|
|
249
|
+
|
|
234
250
|
const computeScaleUnit = computed(() => {
|
|
235
251
|
const minScale = computeMinScale.value
|
|
236
252
|
return minScale ? minScale.type : 'date'
|
|
@@ -246,7 +262,7 @@ export default defineVxeComponent({
|
|
|
246
262
|
return taskScaleList.find(item => item.type === 'week')
|
|
247
263
|
})
|
|
248
264
|
|
|
249
|
-
const
|
|
265
|
+
const computeTaskViewScales = computed(() => {
|
|
250
266
|
const taskViewOpts = computeTaskViewOpts.value
|
|
251
267
|
const { scales } = taskViewOpts
|
|
252
268
|
return scales
|
|
@@ -477,7 +493,8 @@ export default defineVxeComponent({
|
|
|
477
493
|
computeTaskBarDragOpts,
|
|
478
494
|
computeTaskBarResizeOpts,
|
|
479
495
|
computeTaskSplitOpts,
|
|
480
|
-
|
|
496
|
+
computeTaskBarTooltipOpts,
|
|
497
|
+
computeTaskViewScales,
|
|
481
498
|
computeScaleUnit,
|
|
482
499
|
computeMinScale,
|
|
483
500
|
computeWeekScale,
|
|
@@ -490,6 +507,12 @@ export default defineVxeComponent({
|
|
|
490
507
|
computeScrollbarYToLeft
|
|
491
508
|
}
|
|
492
509
|
|
|
510
|
+
/**
|
|
511
|
+
* 已废弃,保留兼容
|
|
512
|
+
* @deprecated
|
|
513
|
+
*/
|
|
514
|
+
;(computeMaps as any).computeTaskScaleConfs = computeTaskViewScales
|
|
515
|
+
|
|
493
516
|
const $xeGantt = {
|
|
494
517
|
xID,
|
|
495
518
|
props: props as VxeGanttProps,
|
|
@@ -501,7 +524,7 @@ export default defineVxeComponent({
|
|
|
501
524
|
} as VxeGanttConstructor & VxeGanttPrivateMethods
|
|
502
525
|
|
|
503
526
|
const handleTaskScaleConfig = () => {
|
|
504
|
-
const taskScaleConfs =
|
|
527
|
+
const taskScaleConfs = computeTaskViewScales.value
|
|
505
528
|
const taskViewScaleOpts = computeTaskViewScaleOpts.value
|
|
506
529
|
const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
|
|
507
530
|
if (taskScaleConfs) {
|
|
@@ -980,6 +1003,18 @@ export default defineVxeComponent({
|
|
|
980
1003
|
emit(type, createEvent(evnt, { $grid: null, $gantt: $xeGantt }, params))
|
|
981
1004
|
}
|
|
982
1005
|
|
|
1006
|
+
const handleTargetEnterEvent = (isClear: boolean) => {
|
|
1007
|
+
const $tooltip = refTooltip.value
|
|
1008
|
+
clearTimeout(internalData.barTipTimeout)
|
|
1009
|
+
if (isClear) {
|
|
1010
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1011
|
+
} else {
|
|
1012
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1013
|
+
$tooltip.setActived(true)
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
983
1018
|
const ganttMethods: GanttMethods = {
|
|
984
1019
|
dispatchEvent,
|
|
985
1020
|
getEl () {
|
|
@@ -1582,6 +1617,25 @@ export default defineVxeComponent({
|
|
|
1582
1617
|
hideTaskView () {
|
|
1583
1618
|
reactData.showRightView = false
|
|
1584
1619
|
return nextTick()
|
|
1620
|
+
},
|
|
1621
|
+
/**
|
|
1622
|
+
* 关闭 bar tooltip
|
|
1623
|
+
*/
|
|
1624
|
+
closeTaskBarTooltip () {
|
|
1625
|
+
const { barTipStore } = reactData
|
|
1626
|
+
const $tooltip = refTooltip.value
|
|
1627
|
+
if (barTipStore.visible) {
|
|
1628
|
+
Object.assign(barTipStore, {
|
|
1629
|
+
row: null,
|
|
1630
|
+
content: null,
|
|
1631
|
+
visible: false,
|
|
1632
|
+
params: {}
|
|
1633
|
+
})
|
|
1634
|
+
if ($tooltip && $tooltip.close) {
|
|
1635
|
+
$tooltip.close()
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
return nextTick()
|
|
1585
1639
|
}
|
|
1586
1640
|
}
|
|
1587
1641
|
|
|
@@ -1700,6 +1754,55 @@ export default defineVxeComponent({
|
|
|
1700
1754
|
handleTaskBarDblclickEvent (evnt, params) {
|
|
1701
1755
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1702
1756
|
},
|
|
1757
|
+
triggerTaskBarTooltipEvent (evnt, params) {
|
|
1758
|
+
const { barTipStore } = reactData
|
|
1759
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value
|
|
1760
|
+
const titleField = computeTitleField.value
|
|
1761
|
+
const { contentMethod } = taskBarTooltipOpts
|
|
1762
|
+
const { row } = params
|
|
1763
|
+
let content = formatText(XEUtils.get(row, titleField))
|
|
1764
|
+
if (contentMethod) {
|
|
1765
|
+
const customContnet = contentMethod(params)
|
|
1766
|
+
if (!XEUtils.eqNull(customContnet)) {
|
|
1767
|
+
content = `${customContnet}`
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
handleTargetEnterEvent(barTipStore.row !== row)
|
|
1771
|
+
const tipContent = formatText(content)
|
|
1772
|
+
Object.assign(barTipStore, {
|
|
1773
|
+
row,
|
|
1774
|
+
visible: true,
|
|
1775
|
+
content: tipContent,
|
|
1776
|
+
params
|
|
1777
|
+
})
|
|
1778
|
+
nextTick(() => {
|
|
1779
|
+
const $tooltip = refTooltip.value
|
|
1780
|
+
if ($tooltip) {
|
|
1781
|
+
if ($tooltip.openByEvent) {
|
|
1782
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent)
|
|
1783
|
+
} else if ($tooltip.open) {
|
|
1784
|
+
$tooltip.open(evnt.currentTarget, tipContent)
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
})
|
|
1788
|
+
},
|
|
1789
|
+
handleTaskBarTooltipLeaveEvent () {
|
|
1790
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value
|
|
1791
|
+
let $tooltip = refTooltip.value
|
|
1792
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1793
|
+
$tooltip.setActived(false)
|
|
1794
|
+
}
|
|
1795
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1796
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1797
|
+
$tooltip = refTooltip.value
|
|
1798
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1799
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1800
|
+
}
|
|
1801
|
+
}, taskBarTooltipOpts.leaveDelay)
|
|
1802
|
+
} else {
|
|
1803
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1703
1806
|
handleTaskHeaderContextmenuEvent (evnt, params) {
|
|
1704
1807
|
const $xeTable = refTable.value
|
|
1705
1808
|
if ($xeTable) {
|
|
@@ -2174,10 +2277,13 @@ export default defineVxeComponent({
|
|
|
2174
2277
|
}
|
|
2175
2278
|
|
|
2176
2279
|
const renderLayout = () => {
|
|
2280
|
+
const { barTipStore } = reactData
|
|
2177
2281
|
const currLayoutConf = computeCurrLayoutConf.value
|
|
2178
2282
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
2283
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value
|
|
2179
2284
|
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
2180
2285
|
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
2286
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip']
|
|
2181
2287
|
return [
|
|
2182
2288
|
h('div', {
|
|
2183
2289
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2204,7 +2310,39 @@ export default defineVxeComponent({
|
|
|
2204
2310
|
}, renderChildLayout(footKeys)),
|
|
2205
2311
|
h('div', {
|
|
2206
2312
|
ref: refPopupContainerElem
|
|
2207
|
-
})
|
|
2313
|
+
}),
|
|
2314
|
+
h('div', {}, [
|
|
2315
|
+
/**
|
|
2316
|
+
* 任务条提示
|
|
2317
|
+
*/
|
|
2318
|
+
h(VxeUITooltipComponent, {
|
|
2319
|
+
key: 'gtp',
|
|
2320
|
+
ref: refTooltip,
|
|
2321
|
+
theme: taskBarTooltipOpts.theme,
|
|
2322
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2323
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2324
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2325
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2326
|
+
width: taskBarTooltipOpts.width,
|
|
2327
|
+
height: taskBarTooltipOpts.height,
|
|
2328
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2329
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2330
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2331
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2332
|
+
isArrow: false
|
|
2333
|
+
}, taskBarTooltipSlot
|
|
2334
|
+
? {
|
|
2335
|
+
content: () => {
|
|
2336
|
+
const { row, content: tooltipContent } = barTipStore
|
|
2337
|
+
if (row) {
|
|
2338
|
+
return h('div', {
|
|
2339
|
+
}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)))
|
|
2340
|
+
}
|
|
2341
|
+
return renderEmptyElement($xeGantt)
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
: {})
|
|
2345
|
+
])
|
|
2208
2346
|
]
|
|
2209
2347
|
}
|
|
2210
2348
|
|
|
@@ -2261,7 +2399,7 @@ export default defineVxeComponent({
|
|
|
2261
2399
|
initProxy()
|
|
2262
2400
|
})
|
|
2263
2401
|
|
|
2264
|
-
watch(
|
|
2402
|
+
watch(computeTaskViewScales, () => {
|
|
2265
2403
|
handleTaskScaleConfig()
|
|
2266
2404
|
$xeGantt.refreshTaskView()
|
|
2267
2405
|
})
|