vxe-gantt 3.1.18 → 3.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.
Files changed (40) hide show
  1. package/es/gantt/src/gantt-chart.js +91 -48
  2. package/es/gantt/src/gantt-view.js +19 -9
  3. package/es/gantt/src/gantt.js +86 -75
  4. package/es/gantt/src/util.js +0 -3
  5. package/es/gantt/style.css +16 -2
  6. package/es/gantt/style.min.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +2 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-gantt/style.css +16 -2
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-chart.js +79 -40
  14. package/lib/gantt/src/gantt-chart.min.js +1 -1
  15. package/lib/gantt/src/gantt-view.js +19 -9
  16. package/lib/gantt/src/gantt-view.min.js +1 -1
  17. package/lib/gantt/src/gantt.js +92 -91
  18. package/lib/gantt/src/gantt.min.js +1 -1
  19. package/lib/gantt/src/util.js +0 -4
  20. package/lib/gantt/src/util.min.js +1 -1
  21. package/lib/gantt/style/style.css +16 -2
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +195 -148
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +2 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-gantt/style/style.css +16 -2
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +2 -2
  34. package/packages/gantt/src/gantt-chart.ts +92 -53
  35. package/packages/gantt/src/gantt-view.ts +19 -9
  36. package/packages/gantt/src/gantt.ts +91 -78
  37. package/packages/gantt/src/util.ts +0 -4
  38. package/packages/ui/index.ts +1 -0
  39. package/styles/components/gantt-module/gantt-chart.scss +14 -2
  40. package/styles/theme/base.scss +1 -0
@@ -42,8 +42,6 @@ export default defineVxeComponent({
42
42
  const _vm = this
43
43
  const $xeGantt = _vm.$xeGantt
44
44
 
45
- const tableProps = $xeTable
46
- const { treeConfig } = tableProps
47
45
  const tableReactData = $xeTable as unknown as TableReactData
48
46
  const { resizeHeightFlag } = tableReactData
49
47
  const tableInternalData = $xeTable as unknown as TableInternalData
@@ -53,10 +51,13 @@ export default defineVxeComponent({
53
51
  const defaultRowHeight = $xeTable.computeDefaultRowHeight
54
52
 
55
53
  const ganttProps = $xeGantt
54
+ const ganttReactData = $xeGantt.reactData
55
+ const ganttInternalData = $xeGantt.internalData
56
56
  const ganttSlots = $xeGantt.$scopedSlots
57
57
  const taskBarSlot = ganttSlots.taskBar || ganttSlots['task-bar']
58
58
 
59
59
  const { taskBarMilestoneConfig } = ganttProps
60
+ const { activeLink, activeBarRowid } = ganttReactData
60
61
  const titleField = $xeGantt.computeTitleField
61
62
  const progressField = $xeGantt.computeProgressField
62
63
  const typeField = $xeGantt.computeTypeField
@@ -105,31 +106,26 @@ export default defineVxeComponent({
105
106
  rowIndex,
106
107
  _rowIndex
107
108
  }
108
- const ons: {
109
- click: any
110
- dblclick: any
111
- mousedown: any
109
+ const ctOns: {
112
110
  mouseover?: any
113
111
  mouseleave?: any
114
- } = {
115
- click (evnt: MouseEvent) {
116
- $xeGantt.handleTaskBarClickEvent(evnt, barParams)
117
- },
118
- dblclick (evnt: MouseEvent) {
119
- $xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
120
- },
121
- mousedown (evnt: MouseEvent) {
122
- if ($xeGantt.handleTaskBarMousedownEvent) {
123
- $xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
124
- }
125
- }
126
- }
112
+ } = {}
127
113
  if (showTooltip) {
128
- ons.mouseover = (evnt: MouseEvent) => {
129
- $xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams))
114
+ ctOns.mouseover = (evnt: MouseEvent) => {
115
+ const { dragBarRow } = ganttInternalData
116
+ const ttParams = Object.assign({ $event: evnt }, ctParams)
117
+ if (!dragBarRow) {
118
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams)
119
+ }
120
+ $xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt)
130
121
  }
131
- ons.mouseleave = (evnt: MouseEvent) => {
132
- $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams))
122
+ ctOns.mouseleave = (evnt: MouseEvent) => {
123
+ const { dragBarRow } = ganttInternalData
124
+ const ttParams = Object.assign({ $event: evnt }, ctParams)
125
+ if (!dragBarRow) {
126
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams)
127
+ }
128
+ $xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt)
133
129
  }
134
130
  }
135
131
 
@@ -139,13 +135,16 @@ export default defineVxeComponent({
139
135
  isMilestone,
140
136
  title,
141
137
  vbStyle,
142
- vpStyle
138
+ vpStyle,
139
+ rowid,
140
+ ctOns
143
141
  })
144
142
  } else if (taskBarSlot) {
145
143
  cbVNs.push(
146
144
  h('div', {
147
145
  key: 'cbc',
148
- class: 'vxe-gantt-view--chart-custom-bar-content'
146
+ class: 'vxe-gantt-view--chart-custom-bar-content-wrapper',
147
+ on: ctOns
149
148
  }, $xeGantt.callSlot(taskBarSlot, barParams, h))
150
149
  )
151
150
  } else {
@@ -155,7 +154,8 @@ export default defineVxeComponent({
155
154
  cbVNs.push(
156
155
  h('div', {
157
156
  key: 'vcm',
158
- class: 'vxe-gantt-view--chart-milestone-wrapper'
157
+ class: 'vxe-gantt-view--chart-milestone-wrapper',
158
+ on: ctOns
159
159
  }, [
160
160
  h('div', {
161
161
  class: ['vxe-gantt-view--chart-milestone-icon', iconStatus ? `theme--${XEUtils.isFunction(iconStatus) ? iconStatus(tbmParams) : iconStatus}` : ''],
@@ -174,25 +174,31 @@ export default defineVxeComponent({
174
174
  )
175
175
  } else {
176
176
  cbVNs.push(
177
- showProgress
178
- ? h('div', {
179
- key: 'vcp',
180
- class: 'vxe-gantt-view--chart-progress',
181
- style: vpStyle
182
- })
183
- : renderEmptyElement($xeGantt),
184
- showContent
185
- ? h('div', {
186
- key: 'vcc',
187
- class: 'vxe-gantt-view--chart-content'
188
- }, title)
189
- : renderEmptyElement($xeGantt)
177
+ h('div', {
178
+ key: 'vbc',
179
+ class: 'vxe-gantt-view--chart-bar-content-wrapper',
180
+ on: ctOns
181
+ }, [
182
+ showProgress
183
+ ? h('div', {
184
+ key: 'vcp',
185
+ class: 'vxe-gantt-view--chart-progress',
186
+ style: vpStyle
187
+ })
188
+ : renderEmptyElement($xeGantt),
189
+ showContent
190
+ ? h('div', {
191
+ key: 'vcc',
192
+ class: 'vxe-gantt-view--chart-content'
193
+ }, title)
194
+ : renderEmptyElement($xeGantt)
195
+ ])
190
196
  )
191
197
  }
192
198
  }
193
199
 
194
200
  return h('div', {
195
- key: treeConfig ? rowid : $rowIndex,
201
+ key: rowid,
196
202
  attrs: {
197
203
  rowid
198
204
  },
@@ -210,12 +216,27 @@ export default defineVxeComponent({
210
216
  }
211
217
  }, [
212
218
  h('div', {
213
- class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`],
219
+ class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`, {
220
+ 'is--active': activeBarRowid === rowid,
221
+ 'active--link': activeLink && (rowid === `${activeLink.from}` || rowid === `${activeLink.to}`)
222
+ }],
214
223
  style: vbStyle,
215
224
  attrs: {
216
225
  rowid
217
226
  },
218
- on: ons
227
+ on: {
228
+ click (evnt: MouseEvent) {
229
+ $xeGantt.handleTaskBarClickEvent(evnt, barParams)
230
+ },
231
+ dblclick (evnt: MouseEvent) {
232
+ $xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
233
+ },
234
+ mousedown (evnt: MouseEvent) {
235
+ if ($xeGantt.handleTaskBarMousedownEvent) {
236
+ $xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
237
+ }
238
+ }
239
+ }
219
240
  }, cbVNs)
220
241
  ])
221
242
  },
@@ -265,31 +286,47 @@ export default defineVxeComponent({
265
286
  const _vm = this
266
287
  const $xeGantt = _vm.$xeGantt
267
288
  const $xeGanttView = _vm.$xeGanttView
289
+ const ganttReactData = $xeGantt.reactData
268
290
  const ganttViewInternalData = $xeGanttView.internalData
269
291
  const ganttViewReactData = $xeGanttView.reactData
270
292
 
271
293
  const $xeTable = ganttViewInternalData.xeTable
272
294
 
295
+ const { dragLinkFromStore } = ganttReactData
273
296
  const { tableData } = ganttViewReactData
274
297
  const taskLinkOpts = $xeGantt.computeTaskLinkOpts
275
- const { showArrow } = taskLinkOpts
298
+ const taskBarOpts = $xeGantt.computeTaskBarOpts
299
+ const { isCurrent, isHover } = taskLinkOpts
300
+ const { linkCreatable } = taskBarOpts
276
301
 
277
302
  return h('div', {
278
303
  ref: 'refElem',
279
- class: 'vxe-gantt-view--chart-wrapper'
304
+ class: ['vxe-gantt-view--chart-wrapper', {
305
+ 'is--cl-drag': dragLinkFromStore.rowid
306
+ }]
280
307
  }, [
281
- $xeGantt.renderGanttTaskLines
308
+ $xeGantt.renderGanttTaskChartBefores
282
309
  ? h('div', {
283
- ref: 'reflineWrapperElem',
284
- class: ['vxe-gantt-view--chart-line-wrapper', {
285
- 'show-arrow': showArrow
310
+ ref: 'refChartBeforeWrapperElem',
311
+ class: ['vxe-gantt-view--chart-before-wrapper', {
312
+ 'link--current': isCurrent,
313
+ 'link--hover': isHover
286
314
  }]
287
- }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskLines(h) : [])
315
+ }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartBefores(h) : [])
288
316
  : renderEmptyElement($xeGantt),
289
317
  h('div', {
290
318
  ref: 'refTaskWrapperElem',
291
- class: 'vxe-gantt-view--chart-task-wrapper'
292
- }, $xeTable ? _vm.renderTaskRows(h, $xeTable, tableData) : [])
319
+ class: ['vxe-gantt-view--chart-task-wrapper', {
320
+ 'link--current': isCurrent,
321
+ 'link--create': linkCreatable
322
+ }]
323
+ }, $xeTable ? _vm.renderTaskRows(h, $xeTable, tableData) : []),
324
+ $xeGantt.renderGanttTaskChartAfters
325
+ ? h('div', {
326
+ ref: 'refChartAfterWrapperElem',
327
+ class: 'vxe-gantt-view--chart-after-wrapper'
328
+ }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartAfters(h) : [])
329
+ : renderEmptyElement($xeGantt)
293
330
  ])
294
331
  }
295
332
  },
@@ -301,7 +338,8 @@ export default defineVxeComponent({
301
338
  const { elemStore } = ganttViewInternalData
302
339
  const prefix = 'main-chart-'
303
340
  elemStore[`${prefix}task-wrapper`] = _vm.$refs.refTaskWrapperElem as HTMLDivElement
304
- elemStore[`${prefix}line-wrapper`] = _vm.$refs.reflineWrapperElem as HTMLDivElement
341
+ elemStore[`${prefix}before-wrapper`] = _vm.$refs.refChartBeforeWrapperElem as HTMLDivElement
342
+ elemStore[`${prefix}after-wrapper`] = _vm.$refs.refChartAfterWrapperElem as HTMLDivElement
305
343
  },
306
344
  destroyed () {
307
345
  const _vm = this
@@ -311,7 +349,8 @@ export default defineVxeComponent({
311
349
  const { elemStore } = ganttViewInternalData
312
350
  const prefix = 'main-chart-'
313
351
  elemStore[`${prefix}task-wrapper`] = null
314
- elemStore[`${prefix}line-wrapper`] = null
352
+ elemStore[`${prefix}before-wrapper`] = null
353
+ elemStore[`${prefix}after-wrapper`] = null
315
354
  },
316
355
  render (this: any, h) {
317
356
  return this.renderVN(h)
@@ -813,7 +813,7 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
813
813
 
814
814
  return Promise.all([
815
815
  updateTaskChart($xeGanttView),
816
- $xeGantt.handleUpdateTaskLink ? $xeGantt.handleUpdateTaskLink($xeGanttView) : null
816
+ $xeGantt.handleUpdateTaskLinkStyle ? $xeGantt.handleUpdateTaskLinkStyle($xeGanttView) : null
817
817
  ])
818
818
  }
819
819
 
@@ -998,10 +998,15 @@ function updateScrollXSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
998
998
  scrollXSpaceEl.style.width = `${scrollXWidth}px`
999
999
  }
1000
1000
 
1001
- const lineWrapper = getRefElem(elemStore['main-chart-line-wrapper'])
1002
- const svgElem = lineWrapper ? lineWrapper.firstElementChild as HTMLDivElement : null
1003
- if (svgElem) {
1004
- svgElem.style.width = `${scrollXWidth}px`
1001
+ const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper'])
1002
+ const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild as HTMLDivElement : null
1003
+ if (beforeSvgElem) {
1004
+ beforeSvgElem.style.width = `${scrollXWidth}px`
1005
+ }
1006
+ const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper'])
1007
+ const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild as HTMLDivElement : null
1008
+ if (afterSvgElem) {
1009
+ afterSvgElem.style.width = `${scrollXWidth}px`
1005
1010
  }
1006
1011
 
1007
1012
  calcScrollbar($xeGanttView)
@@ -1070,10 +1075,15 @@ function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
1070
1075
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
1071
1076
  }
1072
1077
 
1073
- const lineWrapper = getRefElem(elemStore['main-chart-line-wrapper'])
1074
- const svgElem = lineWrapper ? lineWrapper.firstElementChild as HTMLDivElement : null
1075
- if (svgElem) {
1076
- svgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
1078
+ const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper'])
1079
+ const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild as HTMLDivElement : null
1080
+ if (beforeSvgElem) {
1081
+ beforeSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
1082
+ }
1083
+ const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper'])
1084
+ const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild as HTMLDivElement : null
1085
+ if (afterSvgElem) {
1086
+ afterSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
1077
1087
  }
1078
1088
 
1079
1089
  reactData.scrollYTop = scrollYTop
@@ -5,7 +5,6 @@ import XEUtils from 'xe-utils'
5
5
  import { getLastZIndex, nextZIndex, isEnableConf, 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
- import { getTaskLinkKey } from './util'
9
8
  import { warnLog, errLog } from '../../ui/src/log'
10
9
  import GanttViewComponent from './gantt-view'
11
10
  import { VxeTable as VxeTableComponent } from 'vxe-table'
@@ -75,33 +74,60 @@ XEUtils.each((VxeTableComponent as any).methods, (fn, name) => {
75
74
  }
76
75
  })
77
76
 
78
- function handleTaskAddLink (item: VxeGanttPropTypes.Link, linkConfs: VxeGanttDefines.LinkConfObj[], fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]>, fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj>, uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj>) {
79
- if (item) {
80
- const { type, from, to, lineStatus, lineColor, lineType, lineWidth, showArrow } = item
81
- const tlKey = getTaskLinkKey(from, to)
82
- if (from && to && !uniqueMaps[tlKey]) {
83
- let confs = fromConfMaps[from]
84
- if (!confs) {
85
- confs = fromConfMaps[from] = []
86
- }
87
- const confObj: VxeGanttDefines.LinkConfObj = { type, from, to, lineStatus, lineColor, lineType, lineWidth, showArrow }
88
- confs.push(confObj)
89
- linkConfs.push(confObj)
90
- fromKeyMaps[from] = confObj
91
- uniqueMaps[tlKey] = confObj
92
- }
93
- }
94
- }
95
-
96
77
  function createInternalData (): GanttInternalData {
97
78
  return {
98
79
  linkFromConfMaps: {},
99
80
  linkFromKeyMaps: {},
100
81
  linkUniqueMaps: {},
101
82
  uFoot: false,
102
- resizeTableWidth: 0
103
- // barTipTimeout: null
104
- // dragBarRow: null
83
+ resizeTableWidth: 0,
84
+ // barTipTimeout: null,
85
+ // dragBarRow: null,
86
+ // dragLineRow: null,
87
+ dragLinkToStore: {
88
+ rowid: null,
89
+ type: 0
90
+ }
91
+ }
92
+ }
93
+
94
+ function createReactData (): GanttReactData {
95
+ return {
96
+ tableLoading: false,
97
+ proxyInited: false,
98
+ isZMax: false,
99
+ tableLinks: [],
100
+ tableData: [],
101
+ filterData: [],
102
+ formData: {},
103
+ sortData: [],
104
+ footerData: [],
105
+ tZindex: 0,
106
+ tablePage: {
107
+ total: 0,
108
+ pageSize: getConfig().pager?.pageSize || 10,
109
+ currentPage: 1
110
+ },
111
+ showLeftView: true,
112
+ showRightView: true,
113
+ taskScaleList: [],
114
+
115
+ barTipStore: {
116
+ row: null,
117
+ content: '',
118
+ visible: false,
119
+ params: null
120
+ },
121
+
122
+ dragLinkFromStore: {
123
+ rowid: null,
124
+ type: 0
125
+ },
126
+ activeBarRowid: null,
127
+ activeLink: null,
128
+ isActiveCeLe: false,
129
+ linkList: [],
130
+ upLinkFlag: 0
105
131
  }
106
132
  }
107
133
 
@@ -169,36 +195,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
169
195
  data () {
170
196
  const xID = XEUtils.uniqueId()
171
197
 
172
- const reactData: GanttReactData = {
173
- tableLoading: false,
174
- proxyInited: false,
175
- isZMax: false,
176
- tableLinks: [],
177
- tableData: [],
178
- filterData: [],
179
- formData: {},
180
- sortData: [],
181
- footerData: [],
182
- tZindex: 0,
183
- tablePage: {
184
- total: 0,
185
- pageSize: getConfig().pager?.pageSize || 10,
186
- currentPage: 1
187
- },
188
- showLeftView: true,
189
- showRightView: true,
190
- taskScaleList: [],
191
-
192
- barTipStore: {
193
- row: null,
194
- content: '',
195
- visible: false,
196
- params: null
197
- },
198
-
199
- linkList: [],
200
- upLinkFlag: 0
201
- }
198
+ const reactData = createReactData()
202
199
 
203
200
  const internalData = createInternalData()
204
201
 
@@ -341,6 +338,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
341
338
  const { scales } = taskViewOpts
342
339
  return scales
343
340
  },
341
+ computeTaskLinkStyle () {
342
+ const $xeGantt = this
343
+
344
+ const { lineType, lineWidth, lineStatus, lineColor } = $xeGantt.computeTaskLinkOpts as VxeGanttPropTypes.TaskLinkConfig
345
+ return `${lineType || ''}_${lineWidth || ''}_${lineStatus || ''}_${lineColor || ''}`
346
+ },
344
347
  /**
345
348
  * 已废弃,保留兼容
346
349
  * @deprecated
@@ -626,6 +629,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
626
629
 
627
630
  $xeGantt.handleTaskScaleConfig()
628
631
  $xeGantt.refreshTaskView()
632
+ },
633
+ computeTaskLinkStyle () {
634
+ const $xeGantt = this as unknown as VxeGanttConstructor & VxeGanttPrivateMethods
635
+
636
+ if ($xeGantt.handleUpdateTaskLinkData) {
637
+ $xeGantt.handleUpdateTaskLinkData()
638
+ }
629
639
  }
630
640
  },
631
641
  methods: {
@@ -1890,6 +1900,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1890
1900
  },
1891
1901
  handleTaskCellClickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
1892
1902
  const $xeGantt = this
1903
+ const reactData = $xeGantt.reactData
1893
1904
  const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
1894
1905
 
1895
1906
  if ($xeTable) {
@@ -1918,6 +1929,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
1918
1929
  $xeTable.handleToggleCheckRowEvent(evnt, params)
1919
1930
  }
1920
1931
  }
1932
+ reactData.isActiveCeLe = false
1933
+ reactData.activeBarRowid = null
1934
+ reactData.activeLink = null
1921
1935
  $xeGantt.dispatchEvent('task-cell-click', params, evnt)
1922
1936
  },
1923
1937
  handleTaskCellDblclickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
@@ -1927,7 +1941,15 @@ export default /* define-vxe-component start */ defineVxeComponent({
1927
1941
  },
1928
1942
  handleTaskBarClickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
1929
1943
  const $xeGantt = this
1944
+ const reactData = $xeGantt.reactData
1945
+ const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
1930
1946
 
1947
+ const taskBarOpts = $xeGantt.computeTaskBarOpts
1948
+ const { linkCreatable } = taskBarOpts
1949
+ const { row } = params
1950
+ reactData.isActiveCeLe = !!linkCreatable
1951
+ reactData.activeBarRowid = $xeTable ? $xeTable.getRowid(row) : row
1952
+ reactData.activeLink = null
1931
1953
  $xeGantt.dispatchEvent('task-bar-click', params, evnt)
1932
1954
  },
1933
1955
  handleTaskBarDblclickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
@@ -1940,9 +1962,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
1940
1962
  const reactData = $xeGantt.reactData
1941
1963
  const internalData = $xeGantt.internalData
1942
1964
 
1943
- const { barTipStore } = reactData
1944
- const { dragBarRow } = internalData
1945
- if (dragBarRow) {
1965
+ const { barTipStore, activeLink } = reactData
1966
+ const { dragBarRow, dragLineRow } = internalData
1967
+ if (dragBarRow || dragLineRow) {
1968
+ return
1969
+ }
1970
+ if (activeLink) {
1946
1971
  return
1947
1972
  }
1948
1973
  const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
@@ -2016,26 +2041,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
2016
2041
  const { linkList } = reactData
2017
2042
  reactData.tableLinks = linkList.slice(0)
2018
2043
  },
2019
- handleTaskAddLink,
2020
- handleTaskUpdateLinks (links: VxeGanttPropTypes.Links) {
2021
- const $xeGantt = this
2022
- const reactData = $xeGantt.reactData
2023
- const internalData = $xeGantt.internalData
2024
-
2025
- const linkConfs: VxeGanttDefines.LinkConfObj[] = []
2026
- const fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]> = {}
2027
- const fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
2028
- const uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
2029
- XEUtils.each(links || [], item => {
2030
- handleTaskAddLink(item, linkConfs, fromConfMaps, fromKeyMaps, uniqueMaps)
2031
- })
2032
- reactData.linkList = linkConfs
2033
- internalData.linkFromConfMaps = fromConfMaps
2034
- internalData.linkFromKeyMaps = fromKeyMaps
2035
- internalData.linkUniqueMaps = uniqueMaps
2036
- $xeGantt.handleTableLinks()
2037
- return $xeGantt.$nextTick()
2038
- },
2039
2044
  handleTaskHeaderContextmenuEvent (evnt: Event, params: VxeGanttDefines.TaskHeaderContextmenuParams) {
2040
2045
  const $xeGantt = this
2041
2046
  const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
@@ -2673,7 +2678,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
2673
2678
  warnLog('vxe.error.notProp', ['expand-config'])
2674
2679
  }
2675
2680
 
2676
- if (!($xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods).handleUpdateTaskLink) {
2681
+ if (!($xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods).handleUpdateTaskLinkData) {
2677
2682
  if (props.taskLinkConfig) {
2678
2683
  warnLog('vxe.error.notProp', ['task-link-config'])
2679
2684
  }
@@ -2708,8 +2713,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
2708
2713
  }
2709
2714
  })
2710
2715
 
2711
- if (props.links) {
2712
- $xeGantt.handleTaskUpdateLinks(props.links)
2716
+ if (($xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods).handleTaskLoadLinks) {
2717
+ if (props.links) {
2718
+ ($xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods).handleTaskLoadLinks(props.links)
2719
+ }
2713
2720
  }
2714
2721
  $xeGantt.handleTaskScaleConfig()
2715
2722
  $xeGantt.initPages()
@@ -2727,6 +2734,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
2727
2734
  $xeGantt.initGanttView()
2728
2735
  globalEvents.on($xeGantt, 'keydown', $xeGantt.handleGlobalKeydownEvent)
2729
2736
  },
2737
+ beforeDestroy () {
2738
+ const $xeGantt = this
2739
+ const reactData = $xeGantt.reactData
2740
+
2741
+ XEUtils.assign(reactData, createReactData())
2742
+ },
2730
2743
  destroyed () {
2731
2744
  const $xeGantt = this
2732
2745
  const internalData = $xeGantt.internalData
@@ -32,10 +32,6 @@ export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null,
32
32
  return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
33
33
  }
34
34
 
35
- export function getTaskLinkKey (from: string | number, to: string | number) {
36
- return `${from}_${to}`
37
- }
38
-
39
35
  const taskTypeMaps: Record<string, boolean> = {
40
36
  milestone: true
41
37
  }
@@ -50,6 +50,7 @@ setConfig({
50
50
  },
51
51
  taskLinkConfig: {
52
52
  enabled: true,
53
+ isHover: true,
53
54
  showArrow: true
54
55
  },
55
56
  taskViewScaleConfig: {
@@ -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-custom-bar-content {
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;
@@ -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
  }