vxe-gantt 3.1.17 → 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 +50 -21
  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 +50 -25
  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 +226 -164
  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 +3 -3
  34. package/packages/gantt/src/gantt-chart.ts +92 -53
  35. package/packages/gantt/src/gantt-view.ts +52 -21
  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
@@ -28,8 +28,6 @@ export default defineVxeComponent({
28
28
  renderTaskBar(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex) {
29
29
  const _vm = this;
30
30
  const $xeGantt = _vm.$xeGantt;
31
- const tableProps = $xeTable;
32
- const { treeConfig } = tableProps;
33
31
  const tableReactData = $xeTable;
34
32
  const { resizeHeightFlag } = tableReactData;
35
33
  const tableInternalData = $xeTable;
@@ -38,9 +36,12 @@ export default defineVxeComponent({
38
36
  const rowOpts = $xeTable.computeRowOpts;
39
37
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
40
38
  const ganttProps = $xeGantt;
39
+ const ganttReactData = $xeGantt.reactData;
40
+ const ganttInternalData = $xeGantt.internalData;
41
41
  const ganttSlots = $xeGantt.$scopedSlots;
42
42
  const taskBarSlot = ganttSlots.taskBar || ganttSlots['task-bar'];
43
43
  const { taskBarMilestoneConfig } = ganttProps;
44
+ const { activeLink, activeBarRowid } = ganttReactData;
44
45
  const titleField = $xeGantt.computeTitleField;
45
46
  const progressField = $xeGantt.computeProgressField;
46
47
  const typeField = $xeGantt.computeTypeField;
@@ -84,25 +85,23 @@ export default defineVxeComponent({
84
85
  rowIndex,
85
86
  _rowIndex
86
87
  };
87
- const ons = {
88
- click(evnt) {
89
- $xeGantt.handleTaskBarClickEvent(evnt, barParams);
90
- },
91
- dblclick(evnt) {
92
- $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
93
- },
94
- mousedown(evnt) {
95
- if ($xeGantt.handleTaskBarMousedownEvent) {
96
- $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
97
- }
98
- }
99
- };
88
+ const ctOns = {};
100
89
  if (showTooltip) {
101
- ons.mouseover = (evnt) => {
102
- $xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams));
90
+ ctOns.mouseover = (evnt) => {
91
+ const { dragBarRow } = ganttInternalData;
92
+ const ttParams = Object.assign({ $event: evnt }, ctParams);
93
+ if (!dragBarRow) {
94
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
95
+ }
96
+ $xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
103
97
  };
104
- ons.mouseleave = (evnt) => {
105
- $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams));
98
+ ctOns.mouseleave = (evnt) => {
99
+ const { dragBarRow } = ganttInternalData;
100
+ const ttParams = Object.assign({ $event: evnt }, ctParams);
101
+ if (!dragBarRow) {
102
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
103
+ }
104
+ $xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
106
105
  };
107
106
  }
108
107
  let cbVNs = [];
@@ -111,13 +110,16 @@ export default defineVxeComponent({
111
110
  isMilestone,
112
111
  title,
113
112
  vbStyle,
114
- vpStyle
113
+ vpStyle,
114
+ rowid,
115
+ ctOns
115
116
  });
116
117
  }
117
118
  else if (taskBarSlot) {
118
119
  cbVNs.push(h('div', {
119
120
  key: 'cbc',
120
- class: 'vxe-gantt-view--chart-custom-bar-content'
121
+ class: 'vxe-gantt-view--chart-custom-bar-content-wrapper',
122
+ on: ctOns
121
123
  }, $xeGantt.callSlot(taskBarSlot, barParams, h)));
122
124
  }
123
125
  else {
@@ -126,7 +128,8 @@ export default defineVxeComponent({
126
128
  const tbmParams = { $gantt: $xeGantt, row };
127
129
  cbVNs.push(h('div', {
128
130
  key: 'vcm',
129
- class: 'vxe-gantt-view--chart-milestone-wrapper'
131
+ class: 'vxe-gantt-view--chart-milestone-wrapper',
132
+ on: ctOns
130
133
  }, [
131
134
  h('div', {
132
135
  class: ['vxe-gantt-view--chart-milestone-icon', iconStatus ? `theme--${XEUtils.isFunction(iconStatus) ? iconStatus(tbmParams) : iconStatus}` : ''],
@@ -144,22 +147,29 @@ export default defineVxeComponent({
144
147
  ]));
145
148
  }
146
149
  else {
147
- cbVNs.push(showProgress
148
- ? h('div', {
149
- key: 'vcp',
150
- class: 'vxe-gantt-view--chart-progress',
151
- style: vpStyle
152
- })
153
- : renderEmptyElement($xeGantt), showContent
154
- ? h('div', {
155
- key: 'vcc',
156
- class: 'vxe-gantt-view--chart-content'
157
- }, title)
158
- : renderEmptyElement($xeGantt));
150
+ cbVNs.push(h('div', {
151
+ key: 'vbc',
152
+ class: 'vxe-gantt-view--chart-bar-content-wrapper',
153
+ on: ctOns
154
+ }, [
155
+ showProgress
156
+ ? h('div', {
157
+ key: 'vcp',
158
+ class: 'vxe-gantt-view--chart-progress',
159
+ style: vpStyle
160
+ })
161
+ : renderEmptyElement($xeGantt),
162
+ showContent
163
+ ? h('div', {
164
+ key: 'vcc',
165
+ class: 'vxe-gantt-view--chart-content'
166
+ }, title)
167
+ : renderEmptyElement($xeGantt)
168
+ ]));
159
169
  }
160
170
  }
161
171
  return h('div', {
162
- key: treeConfig ? rowid : $rowIndex,
172
+ key: rowid,
163
173
  attrs: {
164
174
  rowid
165
175
  },
@@ -177,12 +187,27 @@ export default defineVxeComponent({
177
187
  }
178
188
  }, [
179
189
  h('div', {
180
- class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`],
190
+ class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`, {
191
+ 'is--active': activeBarRowid === rowid,
192
+ 'active--link': activeLink && (rowid === `${activeLink.from}` || rowid === `${activeLink.to}`)
193
+ }],
181
194
  style: vbStyle,
182
195
  attrs: {
183
196
  rowid
184
197
  },
185
- on: ons
198
+ on: {
199
+ click(evnt) {
200
+ $xeGantt.handleTaskBarClickEvent(evnt, barParams);
201
+ },
202
+ dblclick(evnt) {
203
+ $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
204
+ },
205
+ mousedown(evnt) {
206
+ if ($xeGantt.handleTaskBarMousedownEvent) {
207
+ $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
208
+ }
209
+ }
210
+ }
186
211
  }, cbVNs)
187
212
  ]);
188
213
  },
@@ -228,28 +253,44 @@ export default defineVxeComponent({
228
253
  const _vm = this;
229
254
  const $xeGantt = _vm.$xeGantt;
230
255
  const $xeGanttView = _vm.$xeGanttView;
256
+ const ganttReactData = $xeGantt.reactData;
231
257
  const ganttViewInternalData = $xeGanttView.internalData;
232
258
  const ganttViewReactData = $xeGanttView.reactData;
233
259
  const $xeTable = ganttViewInternalData.xeTable;
260
+ const { dragLinkFromStore } = ganttReactData;
234
261
  const { tableData } = ganttViewReactData;
235
262
  const taskLinkOpts = $xeGantt.computeTaskLinkOpts;
236
- const { showArrow } = taskLinkOpts;
263
+ const taskBarOpts = $xeGantt.computeTaskBarOpts;
264
+ const { isCurrent, isHover } = taskLinkOpts;
265
+ const { linkCreatable } = taskBarOpts;
237
266
  return h('div', {
238
267
  ref: 'refElem',
239
- class: 'vxe-gantt-view--chart-wrapper'
268
+ class: ['vxe-gantt-view--chart-wrapper', {
269
+ 'is--cl-drag': dragLinkFromStore.rowid
270
+ }]
240
271
  }, [
241
- $xeGantt.renderGanttTaskLines
272
+ $xeGantt.renderGanttTaskChartBefores
242
273
  ? h('div', {
243
- ref: 'reflineWrapperElem',
244
- class: ['vxe-gantt-view--chart-line-wrapper', {
245
- 'show-arrow': showArrow
274
+ ref: 'refChartBeforeWrapperElem',
275
+ class: ['vxe-gantt-view--chart-before-wrapper', {
276
+ 'link--current': isCurrent,
277
+ 'link--hover': isHover
246
278
  }]
247
- }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskLines(h) : [])
279
+ }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartBefores(h) : [])
248
280
  : renderEmptyElement($xeGantt),
249
281
  h('div', {
250
282
  ref: 'refTaskWrapperElem',
251
- class: 'vxe-gantt-view--chart-task-wrapper'
252
- }, $xeTable ? _vm.renderTaskRows(h, $xeTable, tableData) : [])
283
+ class: ['vxe-gantt-view--chart-task-wrapper', {
284
+ 'link--current': isCurrent,
285
+ 'link--create': linkCreatable
286
+ }]
287
+ }, $xeTable ? _vm.renderTaskRows(h, $xeTable, tableData) : []),
288
+ $xeGantt.renderGanttTaskChartAfters
289
+ ? h('div', {
290
+ ref: 'refChartAfterWrapperElem',
291
+ class: 'vxe-gantt-view--chart-after-wrapper'
292
+ }, $xeTable && isEnableConf(taskLinkOpts) ? $xeGantt.renderGanttTaskChartAfters(h) : [])
293
+ : renderEmptyElement($xeGantt)
253
294
  ]);
254
295
  }
255
296
  },
@@ -260,7 +301,8 @@ export default defineVxeComponent({
260
301
  const { elemStore } = ganttViewInternalData;
261
302
  const prefix = 'main-chart-';
262
303
  elemStore[`${prefix}task-wrapper`] = _vm.$refs.refTaskWrapperElem;
263
- elemStore[`${prefix}line-wrapper`] = _vm.$refs.reflineWrapperElem;
304
+ elemStore[`${prefix}before-wrapper`] = _vm.$refs.refChartBeforeWrapperElem;
305
+ elemStore[`${prefix}after-wrapper`] = _vm.$refs.refChartAfterWrapperElem;
264
306
  },
265
307
  destroyed() {
266
308
  const _vm = this;
@@ -269,7 +311,8 @@ export default defineVxeComponent({
269
311
  const { elemStore } = ganttViewInternalData;
270
312
  const prefix = 'main-chart-';
271
313
  elemStore[`${prefix}task-wrapper`] = null;
272
- elemStore[`${prefix}line-wrapper`] = null;
314
+ elemStore[`${prefix}before-wrapper`] = null;
315
+ elemStore[`${prefix}after-wrapper`] = null;
273
316
  },
274
317
  render(h) {
275
318
  return this.renderVN(h);
@@ -127,15 +127,8 @@ function handleColumnHeader($xeGanttView) {
127
127
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
128
128
  const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
129
129
  const WW = XEUtils.padStart(W, 2, '0');
130
- let wYear = yyyy;
131
- // 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
132
- // '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
133
- // '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
134
- if (W === '1' && MM === '12') {
135
- wYear = `${Number(yyyy) + 1}`;
136
- if (isMinWeek) {
137
- yyyy = wYear;
138
- }
130
+ if (isMinWeek && checkWeekOfsetYear(W, M)) {
131
+ yyyy = `${Number(yyyy) + 1}`;
139
132
  }
140
133
  const dateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e };
141
134
  const colMaps = {
@@ -155,7 +148,7 @@ function handleColumnHeader($xeGanttView) {
155
148
  dateObj
156
149
  },
157
150
  week: {
158
- field: `${wYear}_W${W}`,
151
+ field: `${yyyy}_W${W}`,
159
152
  title: `${W}`,
160
153
  dateObj
161
154
  },
@@ -241,6 +234,30 @@ function handleColumnHeader($xeGanttView) {
241
234
  groupCols
242
235
  };
243
236
  }
237
+ /**
238
+ * 判断周的年份是否跨年
239
+ */
240
+ function checkWeekOfsetYear(W, M) {
241
+ return `${W}` === '1' && `${M}` === '12';
242
+ }
243
+ /**
244
+ * 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
245
+ * '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
246
+ * '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
247
+ */
248
+ function parseWeekObj(date, firstDay) {
249
+ const currDate = XEUtils.toStringDate(date);
250
+ let yyyy = currDate.getFullYear();
251
+ const month = currDate.getMonth();
252
+ const weekNum = XEUtils.getYearWeek(currDate, firstDay);
253
+ if (checkWeekOfsetYear(weekNum, month + 1)) {
254
+ yyyy++;
255
+ }
256
+ return {
257
+ yyyy,
258
+ W: weekNum
259
+ };
260
+ }
244
261
  function createChartRender($xeGanttView, fullCols) {
245
262
  const $xeGantt = $xeGanttView.$xeGantt;
246
263
  const reactData = $xeGanttView.reactData;
@@ -327,9 +344,11 @@ function createChartRender($xeGanttView, fullCols) {
327
344
  return (startValue, endValue) => {
328
345
  const startDate = parseStringDate($xeGanttView, startValue);
329
346
  const endDate = parseStringDate($xeGanttView, endValue);
330
- const startStr = XEUtils.toDateString(startDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
347
+ const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined);
348
+ const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`;
331
349
  const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
332
- const endStr = XEUtils.toDateString(endDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
350
+ const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined);
351
+ const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`;
333
352
  const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
334
353
  const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
335
354
  const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
@@ -747,7 +766,7 @@ function updateStyle($xeGanttView) {
747
766
  reactData.scrollXWidth = viewTableWidth;
748
767
  return Promise.all([
749
768
  updateTaskChart($xeGanttView),
750
- $xeGantt.handleUpdateTaskLink ? $xeGantt.handleUpdateTaskLink($xeGanttView) : null
769
+ $xeGantt.handleUpdateTaskLinkStyle ? $xeGantt.handleUpdateTaskLinkStyle($xeGanttView) : null
751
770
  ]);
752
771
  }
753
772
  function handleRecalculateStyle($xeGanttView) {
@@ -909,10 +928,15 @@ function updateScrollXSpace($xeGanttView) {
909
928
  if (scrollXSpaceEl) {
910
929
  scrollXSpaceEl.style.width = `${scrollXWidth}px`;
911
930
  }
912
- const lineWrapper = getRefElem(elemStore['main-chart-line-wrapper']);
913
- const svgElem = lineWrapper ? lineWrapper.firstElementChild : null;
914
- if (svgElem) {
915
- svgElem.style.width = `${scrollXWidth}px`;
931
+ const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper']);
932
+ const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild : null;
933
+ if (beforeSvgElem) {
934
+ beforeSvgElem.style.width = `${scrollXWidth}px`;
935
+ }
936
+ const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper']);
937
+ const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild : null;
938
+ if (afterSvgElem) {
939
+ afterSvgElem.style.width = `${scrollXWidth}px`;
916
940
  }
917
941
  calcScrollbar($xeGanttView);
918
942
  return $xeGanttView.$nextTick();
@@ -971,10 +995,15 @@ function updateScrollYSpace($xeGanttView) {
971
995
  if (scrollYSpaceEl) {
972
996
  scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
973
997
  }
974
- const lineWrapper = getRefElem(elemStore['main-chart-line-wrapper']);
975
- const svgElem = lineWrapper ? lineWrapper.firstElementChild : null;
976
- if (svgElem) {
977
- svgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
998
+ const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper']);
999
+ const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild : null;
1000
+ if (beforeSvgElem) {
1001
+ beforeSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
1002
+ }
1003
+ const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper']);
1004
+ const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild : null;
1005
+ if (afterSvgElem) {
1006
+ afterSvgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
978
1007
  }
979
1008
  reactData.scrollYTop = scrollYTop;
980
1009
  reactData.scrollYHeight = scrollYHeight;
@@ -4,7 +4,6 @@ import XEUtils from 'xe-utils';
4
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
- import { getTaskLinkKey } from './util';
8
7
  import { warnLog, errLog } from '../../ui/src/log';
9
8
  import GanttViewComponent from './gantt-view';
10
9
  import { VxeTable as VxeTableComponent } from 'vxe-table';
@@ -58,32 +57,58 @@ XEUtils.each(VxeTableComponent.methods, (fn, name) => {
58
57
  return $xeTable && $xeTable[name](...args);
59
58
  };
60
59
  });
61
- function handleTaskAddLink(item, linkConfs, fromConfMaps, fromKeyMaps, uniqueMaps) {
62
- if (item) {
63
- const { type, from, to, lineStatus, lineColor, lineType, lineWidth, showArrow } = item;
64
- const tlKey = getTaskLinkKey(from, to);
65
- if (from && to && !uniqueMaps[tlKey]) {
66
- let confs = fromConfMaps[from];
67
- if (!confs) {
68
- confs = fromConfMaps[from] = [];
69
- }
70
- const confObj = { type, from, to, lineStatus, lineColor, lineType, lineWidth, showArrow };
71
- confs.push(confObj);
72
- linkConfs.push(confObj);
73
- fromKeyMaps[from] = confObj;
74
- uniqueMaps[tlKey] = confObj;
75
- }
76
- }
77
- }
78
60
  function createInternalData() {
79
61
  return {
80
62
  linkFromConfMaps: {},
81
63
  linkFromKeyMaps: {},
82
64
  linkUniqueMaps: {},
83
65
  uFoot: false,
84
- resizeTableWidth: 0
85
- // barTipTimeout: null
86
- // dragBarRow: null
66
+ resizeTableWidth: 0,
67
+ // barTipTimeout: null,
68
+ // dragBarRow: null,
69
+ // dragLineRow: null,
70
+ dragLinkToStore: {
71
+ rowid: null,
72
+ type: 0
73
+ }
74
+ };
75
+ }
76
+ function createReactData() {
77
+ var _a;
78
+ return {
79
+ tableLoading: false,
80
+ proxyInited: false,
81
+ isZMax: false,
82
+ tableLinks: [],
83
+ tableData: [],
84
+ filterData: [],
85
+ formData: {},
86
+ sortData: [],
87
+ footerData: [],
88
+ tZindex: 0,
89
+ tablePage: {
90
+ total: 0,
91
+ pageSize: ((_a = getConfig().pager) === null || _a === void 0 ? void 0 : _a.pageSize) || 10,
92
+ currentPage: 1
93
+ },
94
+ showLeftView: true,
95
+ showRightView: true,
96
+ taskScaleList: [],
97
+ barTipStore: {
98
+ row: null,
99
+ content: '',
100
+ visible: false,
101
+ params: null
102
+ },
103
+ dragLinkFromStore: {
104
+ rowid: null,
105
+ type: 0
106
+ },
107
+ activeBarRowid: null,
108
+ activeLink: null,
109
+ isActiveCeLe: false,
110
+ linkList: [],
111
+ upLinkFlag: 0
87
112
  };
88
113
  }
89
114
  export default {
@@ -104,36 +129,8 @@ export default {
104
129
  };
105
130
  },
106
131
  data() {
107
- var _a;
108
132
  const xID = XEUtils.uniqueId();
109
- const reactData = {
110
- tableLoading: false,
111
- proxyInited: false,
112
- isZMax: false,
113
- tableLinks: [],
114
- tableData: [],
115
- filterData: [],
116
- formData: {},
117
- sortData: [],
118
- footerData: [],
119
- tZindex: 0,
120
- tablePage: {
121
- total: 0,
122
- pageSize: ((_a = getConfig().pager) === null || _a === void 0 ? void 0 : _a.pageSize) || 10,
123
- currentPage: 1
124
- },
125
- showLeftView: true,
126
- showRightView: true,
127
- taskScaleList: [],
128
- barTipStore: {
129
- row: null,
130
- content: '',
131
- visible: false,
132
- params: null
133
- },
134
- linkList: [],
135
- upLinkFlag: 0
136
- };
133
+ const reactData = createReactData();
137
134
  const internalData = createInternalData();
138
135
  return {
139
136
  xID,
@@ -249,6 +246,11 @@ export default {
249
246
  const { scales } = taskViewOpts;
250
247
  return scales;
251
248
  },
249
+ computeTaskLinkStyle() {
250
+ const $xeGantt = this;
251
+ const { lineType, lineWidth, lineStatus, lineColor } = $xeGantt.computeTaskLinkOpts;
252
+ return `${lineType || ''}_${lineWidth || ''}_${lineStatus || ''}_${lineColor || ''}`;
253
+ },
252
254
  /**
253
255
  * 已废弃,保留兼容
254
256
  * @deprecated
@@ -512,6 +514,12 @@ export default {
512
514
  const $xeGantt = this;
513
515
  $xeGantt.handleTaskScaleConfig();
514
516
  $xeGantt.refreshTaskView();
517
+ },
518
+ computeTaskLinkStyle() {
519
+ const $xeGantt = this;
520
+ if ($xeGantt.handleUpdateTaskLinkData) {
521
+ $xeGantt.handleUpdateTaskLinkData();
522
+ }
515
523
  }
516
524
  },
517
525
  methods: Object.assign(Object.assign({}, tableMethods), { dispatchEvent(type, params, evnt) {
@@ -1725,6 +1733,7 @@ export default {
1725
1733
  },
1726
1734
  handleTaskCellClickEvent(evnt, params) {
1727
1735
  const $xeGantt = this;
1736
+ const reactData = $xeGantt.reactData;
1728
1737
  const $xeTable = $xeGantt.$refs.refTable;
1729
1738
  if ($xeTable) {
1730
1739
  const tableProps = $xeTable;
@@ -1752,6 +1761,9 @@ export default {
1752
1761
  $xeTable.handleToggleCheckRowEvent(evnt, params);
1753
1762
  }
1754
1763
  }
1764
+ reactData.isActiveCeLe = false;
1765
+ reactData.activeBarRowid = null;
1766
+ reactData.activeLink = null;
1755
1767
  $xeGantt.dispatchEvent('task-cell-click', params, evnt);
1756
1768
  },
1757
1769
  handleTaskCellDblclickEvent(evnt, params) {
@@ -1760,6 +1772,14 @@ export default {
1760
1772
  },
1761
1773
  handleTaskBarClickEvent(evnt, params) {
1762
1774
  const $xeGantt = this;
1775
+ const reactData = $xeGantt.reactData;
1776
+ const $xeTable = $xeGantt.$refs.refTable;
1777
+ const taskBarOpts = $xeGantt.computeTaskBarOpts;
1778
+ const { linkCreatable } = taskBarOpts;
1779
+ const { row } = params;
1780
+ reactData.isActiveCeLe = !!linkCreatable;
1781
+ reactData.activeBarRowid = $xeTable ? $xeTable.getRowid(row) : row;
1782
+ reactData.activeLink = null;
1763
1783
  $xeGantt.dispatchEvent('task-bar-click', params, evnt);
1764
1784
  },
1765
1785
  handleTaskBarDblclickEvent(evnt, params) {
@@ -1770,9 +1790,12 @@ export default {
1770
1790
  const $xeGantt = this;
1771
1791
  const reactData = $xeGantt.reactData;
1772
1792
  const internalData = $xeGantt.internalData;
1773
- const { barTipStore } = reactData;
1774
- const { dragBarRow } = internalData;
1775
- if (dragBarRow) {
1793
+ const { barTipStore, activeLink } = reactData;
1794
+ const { dragBarRow, dragLineRow } = internalData;
1795
+ if (dragBarRow || dragLineRow) {
1796
+ return;
1797
+ }
1798
+ if (activeLink) {
1776
1799
  return;
1777
1800
  }
1778
1801
  const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
@@ -1846,25 +1869,6 @@ export default {
1846
1869
  const { linkList } = reactData;
1847
1870
  reactData.tableLinks = linkList.slice(0);
1848
1871
  },
1849
- handleTaskAddLink,
1850
- handleTaskUpdateLinks(links) {
1851
- const $xeGantt = this;
1852
- const reactData = $xeGantt.reactData;
1853
- const internalData = $xeGantt.internalData;
1854
- const linkConfs = [];
1855
- const fromConfMaps = {};
1856
- const fromKeyMaps = {};
1857
- const uniqueMaps = {};
1858
- XEUtils.each(links || [], item => {
1859
- handleTaskAddLink(item, linkConfs, fromConfMaps, fromKeyMaps, uniqueMaps);
1860
- });
1861
- reactData.linkList = linkConfs;
1862
- internalData.linkFromConfMaps = fromConfMaps;
1863
- internalData.linkFromKeyMaps = fromKeyMaps;
1864
- internalData.linkUniqueMaps = uniqueMaps;
1865
- $xeGantt.handleTableLinks();
1866
- return $xeGantt.$nextTick();
1867
- },
1868
1872
  handleTaskHeaderContextmenuEvent(evnt, params) {
1869
1873
  const $xeGantt = this;
1870
1874
  const $xeTable = $xeGantt.$refs.refTable;
@@ -2456,7 +2460,7 @@ export default {
2456
2460
  if (props.expandConfig) {
2457
2461
  warnLog('vxe.error.notProp', ['expand-config']);
2458
2462
  }
2459
- if (!$xeGantt.handleUpdateTaskLink) {
2463
+ if (!$xeGantt.handleUpdateTaskLinkData) {
2460
2464
  if (props.taskLinkConfig) {
2461
2465
  warnLog('vxe.error.notProp', ['task-link-config']);
2462
2466
  }
@@ -2490,8 +2494,10 @@ export default {
2490
2494
  }
2491
2495
  }
2492
2496
  });
2493
- if (props.links) {
2494
- $xeGantt.handleTaskUpdateLinks(props.links);
2497
+ if ($xeGantt.handleTaskLoadLinks) {
2498
+ if (props.links) {
2499
+ $xeGantt.handleTaskLoadLinks(props.links);
2500
+ }
2495
2501
  }
2496
2502
  $xeGantt.handleTaskScaleConfig();
2497
2503
  $xeGantt.initPages();
@@ -2508,6 +2514,11 @@ export default {
2508
2514
  $xeGantt.initGanttView();
2509
2515
  globalEvents.on($xeGantt, 'keydown', $xeGantt.handleGlobalKeydownEvent);
2510
2516
  },
2517
+ beforeDestroy() {
2518
+ const $xeGantt = this;
2519
+ const reactData = $xeGantt.reactData;
2520
+ XEUtils.assign(reactData, createReactData());
2521
+ },
2511
2522
  destroyed() {
2512
2523
  const $xeGantt = this;
2513
2524
  const internalData = $xeGantt.internalData;
@@ -24,9 +24,6 @@ export function getTaskBarLeft(chartRest, viewCellWidth) {
24
24
  export function getTaskBarWidth(chartRest, viewCellWidth) {
25
25
  return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0);
26
26
  }
27
- export function getTaskLinkKey(from, to) {
28
- return `${from}_${to}`;
29
- }
30
27
  const taskTypeMaps = {
31
28
  milestone: true
32
29
  };
@@ -14,6 +14,11 @@
14
14
  .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-bar, .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-custom-bar {
15
15
  border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
16
16
  }
17
+ .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-bar .vxe-gantt-view--chart-bar-content-wrapper,
18
+ .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-bar .vxe-gantt-view--chart-custom-bar-content-wrapper, .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-custom-bar .vxe-gantt-view--chart-bar-content-wrapper,
19
+ .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-custom-bar .vxe-gantt-view--chart-custom-bar-content-wrapper {
20
+ border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
21
+ }
17
22
  .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-bar:hover::after, .vxe-gantt-view--chart-row.is--round > .vxe-gantt-view--chart-custom-bar:hover::after {
18
23
  border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
19
24
  }
@@ -26,7 +31,6 @@
26
31
  top: 50%;
27
32
  left: 0;
28
33
  transform: translateY(-50%);
29
- overflow: hidden;
30
34
  pointer-events: all;
31
35
  }
32
36
  .vxe-gantt-view--chart-bar.is--default,
@@ -35,8 +39,18 @@
35
39
  background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
36
40
  }
37
41
 
38
- .vxe-gantt-view--chart-custom-bar-content {
42
+ .vxe-gantt-view--chart-bar-content-wrapper,
43
+ .vxe-gantt-view--chart-custom-bar-content-wrapper {
39
44
  width: 100%;
45
+ overflow: hidden;
46
+ }
47
+
48
+ .vxe-gantt-view--chart-bar-content-wrapper {
49
+ width: 100%;
50
+ height: 100%;
51
+ display: flex;
52
+ flex-direction: row;
53
+ align-items: center;
40
54
  }
41
55
 
42
56
  .vxe-gantt-view--chart-bar {