vxe-gantt 3.0.27 → 3.1.1

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.
@@ -43,7 +43,7 @@ export default defineVxeComponent({
43
43
  const progressField = $xeGantt.computeProgressField;
44
44
  const taskBarOpts = $xeGantt.computeTaskBarOpts;
45
45
  const barParams = { $gantt: $xeGantt, row };
46
- const { showProgress, showContent, contentMethod, barStyle, drag } = taskBarOpts;
46
+ const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts;
47
47
  const isBarRowStyle = XEUtils.isFunction(barStyle);
48
48
  const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {};
49
49
  const { round } = barStyObj;
@@ -69,7 +69,28 @@ export default defineVxeComponent({
69
69
  if (contentMethod) {
70
70
  title = getStringValue(contentMethod({ row, title }));
71
71
  }
72
- const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex };
72
+ const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex, $gantt: $xeGantt };
73
+ const ons = {
74
+ click(evnt) {
75
+ $xeGantt.handleTaskBarClickEvent(evnt, barParams);
76
+ },
77
+ dblclick(evnt) {
78
+ $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
79
+ },
80
+ mousedown(evnt) {
81
+ if ($xeGantt.handleTaskBarMousedownEvent) {
82
+ $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
83
+ }
84
+ }
85
+ };
86
+ if (showTooltip) {
87
+ ons.mouseover = (evnt) => {
88
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams));
89
+ };
90
+ ons.mouseleave = (evnt) => {
91
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams));
92
+ };
93
+ }
73
94
  return h('div', {
74
95
  key: treeConfig ? rowid : $rowIndex,
75
96
  attrs: {
@@ -95,19 +116,7 @@ export default defineVxeComponent({
95
116
  attrs: {
96
117
  rowid
97
118
  },
98
- on: {
99
- click(evnt) {
100
- $xeGantt.handleTaskBarClickEvent(evnt, barParams);
101
- },
102
- dblclick(evnt) {
103
- $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
104
- },
105
- mousedown(evnt) {
106
- if ($xeGantt.handleTaskBarMousedownEvent) {
107
- $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
108
- }
109
- }
110
- }
119
+ on: ons
111
120
  }, taskBarSlot
112
121
  ? $xeGantt.callSlot(taskBarSlot, barParams, h)
113
122
  : [
@@ -57,20 +57,29 @@ export default defineVxeComponent({
57
57
  });
58
58
  })),
59
59
  h('thead', {}, headerGroups.map(({ scaleItem, columns }, $rowIndex) => {
60
- const { type, titleMethod, headerCellStyle, slots } = scaleItem;
60
+ const { type, titleFormat, titleMethod, headerCellStyle, slots } = scaleItem;
61
61
  const titleSlot = slots ? slots.title : null;
62
- const todayValue = showNowLine && $rowIndex === headerGroups.length - 1 ? todayDateMaps[type] : null;
62
+ const isLast = $rowIndex === headerGroups.length - 1;
63
+ const todayValue = isLast && showNowLine ? todayDateMaps[type] : null;
63
64
  return h('tr', {
64
65
  key: $rowIndex
65
66
  }, columns.map((column, cIndex) => {
66
67
  const { field, childCount, dateObj } = column;
67
68
  let label = `${column.title}`;
68
- if ($rowIndex < headerGroups.length - 1) {
69
- if (scaleItem.type === 'day') {
70
- label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
69
+ if (scaleItem.type === 'day') {
70
+ label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
71
+ }
72
+ else {
73
+ if ($rowIndex) {
74
+ label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
71
75
  }
72
76
  else {
73
- label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
77
+ if (isLast && scaleItem.type === 'week') {
78
+ label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
79
+ }
80
+ else {
81
+ label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj);
82
+ }
74
83
  }
75
84
  }
76
85
  let cellVNs = label;
@@ -81,6 +90,9 @@ export default defineVxeComponent({
81
90
  else if (titleMethod) {
82
91
  cellVNs = `${titleMethod(ctParams)}`;
83
92
  }
93
+ else if (titleFormat) {
94
+ cellVNs = XEUtils.toDateString(dateObj.date, titleFormat);
95
+ }
84
96
  let cellStys = {};
85
97
  if (headerCellStyle) {
86
98
  if (XEUtils.isFunction(headerCellStyle)) {
@@ -1,13 +1,15 @@
1
1
  import { defineVxeComponent } from '../../ui/src/comp';
2
2
  import { VxeUI } from '@vxe-ui/core';
3
3
  import { setScrollTop, setScrollLeft, removeClass, addClass } from '../../ui/src/dom';
4
- import { getRefElem } from './util';
4
+ import { getRefElem, getStandardGapTime } from './util';
5
5
  import XEUtils from 'xe-utils';
6
6
  import GanttViewHeaderComponent from './gantt-header';
7
7
  import GanttViewBodyComponent from './gantt-body';
8
8
  import GanttViewFooterComponent from './gantt-footer';
9
9
  const { globalEvents } = VxeUI;
10
10
  const sourceType = 'gantt';
11
+ const minuteMs = 1000 * 60;
12
+ const dayMs = minuteMs * 60 * 24;
11
13
  function createInternalData() {
12
14
  return {
13
15
  xeTable: null,
@@ -64,39 +66,17 @@ function updateTodayData($xeGanttView) {
64
66
  second: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`
65
67
  };
66
68
  }
67
- function handleParseColumn($xeGanttView) {
69
+ function handleColumnHeader($xeGanttView) {
68
70
  const $xeGantt = $xeGanttView.$xeGantt;
69
- const reactData = $xeGanttView.reactData;
70
- const internalData = $xeGanttView.internalData;
71
- const ganttProps = $xeGantt;
72
71
  const ganttReactData = $xeGantt.reactData;
73
- const { treeConfig } = ganttProps;
74
72
  const { taskScaleList } = ganttReactData;
75
- const { minViewDate, maxViewDate } = reactData;
76
- const minScale = XEUtils.last(taskScaleList);
73
+ const scaleUnit = $xeGantt.computeScaleUnit;
74
+ const minScale = $xeGantt.computeMinScale;
75
+ const weekScale = $xeGantt.computeWeekScale;
76
+ const scaleDateList = $xeGanttView.computeScaleDateList;
77
77
  const fullCols = [];
78
78
  const groupCols = [];
79
- if (minScale && minViewDate && maxViewDate) {
80
- const minSType = minScale.type;
81
- const weekScale = taskScaleList.find(item => item.type === 'week');
82
- let gapTime = 1000 * 60 * 60 * 24;
83
- switch (minScale.type) {
84
- case 'hour':
85
- gapTime = 1000 * 60 * 60;
86
- break;
87
- case 'minute':
88
- gapTime = 1000 * 60;
89
- break;
90
- case 'second':
91
- gapTime = 1000;
92
- break;
93
- default: {
94
- break;
95
- }
96
- }
97
- const currTime = minViewDate.getTime();
98
- const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
99
- const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
79
+ if (minScale && scaleUnit && scaleDateList.length) {
100
80
  const renderListMaps = {
101
81
  year: [],
102
82
  quarter: [],
@@ -120,7 +100,7 @@ function handleParseColumn($xeGanttView) {
120
100
  second: {}
121
101
  };
122
102
  const handleData = (type, colMaps, minCol) => {
123
- if (minSType === type) {
103
+ if (minScale.type === type) {
124
104
  return;
125
105
  }
126
106
  const currCol = colMaps[type];
@@ -138,14 +118,14 @@ function handleParseColumn($xeGanttView) {
138
118
  currGpCol.children.push(minCol);
139
119
  }
140
120
  };
141
- for (let i = 0; i < countSize; i++) {
142
- const itemDate = new Date(currTime + (i * gapTime));
121
+ for (let i = 0; i < scaleDateList.length; i++) {
122
+ const itemDate = scaleDateList[i];
143
123
  const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-');
144
124
  const e = itemDate.getDay();
145
125
  const E = e + 1;
146
126
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
147
127
  const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined);
148
- const dateObj = { yy: yyyy, M: MM, d: dd, H: HH, m: mm, s: ss, q, W, E, e };
128
+ const dateObj = { date: itemDate, yy: yyyy, M: MM, d: dd, H: HH, m: mm, s: ss, q, W, E, e };
149
129
  const colMaps = {
150
130
  year: {
151
131
  field: yyyy,
@@ -193,14 +173,14 @@ function handleParseColumn($xeGanttView) {
193
173
  dateObj
194
174
  }
195
175
  };
196
- const minCol = colMaps[minSType];
176
+ const minCol = colMaps[minScale.type];
197
177
  if (minScale.level < 19) {
198
178
  handleData('year', colMaps, minCol);
199
179
  }
200
180
  if (minScale.level < 17) {
201
181
  handleData('quarter', colMaps, minCol);
202
182
  }
203
- if (minScale.level < 14) {
183
+ if (minScale.level < 15) {
204
184
  handleData('month', colMaps, minCol);
205
185
  }
206
186
  if (minScale.level < 13) {
@@ -209,7 +189,7 @@ function handleParseColumn($xeGanttView) {
209
189
  if (minScale.level < 11) {
210
190
  handleData('day', colMaps, minCol);
211
191
  }
212
- if (minScale.level < 12) {
192
+ if (minScale.level < 9) {
213
193
  handleData('date', colMaps, minCol);
214
194
  }
215
195
  if (minScale.level < 7) {
@@ -218,10 +198,13 @@ function handleParseColumn($xeGanttView) {
218
198
  if (minScale.level < 5) {
219
199
  handleData('minute', colMaps, minCol);
220
200
  }
201
+ if (minScale.level < 3) {
202
+ handleData('second', colMaps, minCol);
203
+ }
221
204
  fullCols.push(minCol);
222
205
  }
223
206
  taskScaleList.forEach(scaleItem => {
224
- if (scaleItem.type === minSType) {
207
+ if (scaleItem.type === minScale.type) {
225
208
  groupCols.push({
226
209
  scaleItem,
227
210
  columns: fullCols
@@ -240,6 +223,216 @@ function handleParseColumn($xeGanttView) {
240
223
  columns: list
241
224
  });
242
225
  });
226
+ }
227
+ return {
228
+ fullCols,
229
+ groupCols
230
+ };
231
+ }
232
+ function createChartRender($xeGanttView, fullCols) {
233
+ const $xeGantt = $xeGanttView.$xeGantt;
234
+ const reactData = $xeGanttView.reactData;
235
+ const { minViewDate } = reactData;
236
+ const minScale = $xeGantt.computeMinScale;
237
+ const scaleUnit = $xeGantt.computeScaleUnit;
238
+ const weekScale = $xeGantt.computeWeekScale;
239
+ switch (scaleUnit) {
240
+ case 'year': {
241
+ const indexMaps = {};
242
+ fullCols.forEach(({ dateObj }, i) => {
243
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy');
244
+ indexMaps[yyyyMM] = i;
245
+ });
246
+ return (startValue, endValue) => {
247
+ const startDate = parseStringDate($xeGanttView, startValue);
248
+ const endDate = parseStringDate($xeGanttView, endValue);
249
+ const startStr = XEUtils.toDateString(startDate, 'yyyy');
250
+ const startFirstDate = XEUtils.getWhatYear(startDate, 0, 'first');
251
+ const endStr = XEUtils.toDateString(endDate, 'yyyy');
252
+ const endFirstDate = XEUtils.getWhatYear(endDate, 0, 'first');
253
+ const dateSize = Math.floor((XEUtils.getWhatYear(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
254
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
255
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
256
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
257
+ return {
258
+ offsetLeftSize,
259
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
260
+ };
261
+ };
262
+ }
263
+ case 'quarter': {
264
+ const indexMaps = {};
265
+ fullCols.forEach(({ dateObj }, i) => {
266
+ const q = XEUtils.toDateString(dateObj.date, 'yyyy-q');
267
+ indexMaps[q] = i;
268
+ });
269
+ return (startValue, endValue) => {
270
+ const startDate = parseStringDate($xeGanttView, startValue);
271
+ const endDate = parseStringDate($xeGanttView, endValue);
272
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-q');
273
+ const startFirstDate = XEUtils.getWhatQuarter(startDate, 0, 'first');
274
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-q');
275
+ const endFirstDate = XEUtils.getWhatQuarter(endDate, 0, 'first');
276
+ const dateSize = Math.floor((XEUtils.getWhatQuarter(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
277
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
278
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
279
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
280
+ return {
281
+ offsetLeftSize,
282
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
283
+ };
284
+ };
285
+ }
286
+ case 'month': {
287
+ const indexMaps = {};
288
+ fullCols.forEach(({ dateObj }, i) => {
289
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM');
290
+ indexMaps[yyyyMM] = i;
291
+ });
292
+ return (startValue, endValue) => {
293
+ const startDate = parseStringDate($xeGanttView, startValue);
294
+ const endDate = parseStringDate($xeGanttView, endValue);
295
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM');
296
+ const startFirstDate = XEUtils.getWhatMonth(startDate, 0, 'first');
297
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM');
298
+ const endFirstDate = XEUtils.getWhatMonth(endDate, 0, 'first');
299
+ const dateSize = Math.floor((XEUtils.getWhatMonth(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
300
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
301
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
302
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
303
+ return {
304
+ offsetLeftSize,
305
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
306
+ };
307
+ };
308
+ }
309
+ case 'week': {
310
+ const indexMaps = {};
311
+ fullCols.forEach(({ dateObj }, i) => {
312
+ const yyyyW = XEUtils.toDateString(dateObj.date, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
313
+ indexMaps[yyyyW] = i;
314
+ });
315
+ return (startValue, endValue) => {
316
+ const startDate = parseStringDate($xeGanttView, startValue);
317
+ const endDate = parseStringDate($xeGanttView, endValue);
318
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
319
+ const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
320
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
321
+ const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
322
+ const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
323
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
324
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
325
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
326
+ return {
327
+ offsetLeftSize,
328
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
329
+ };
330
+ };
331
+ }
332
+ case 'day':
333
+ case 'date': {
334
+ const indexMaps = {};
335
+ fullCols.forEach(({ dateObj }, i) => {
336
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd');
337
+ indexMaps[yyyyMM] = i;
338
+ });
339
+ return (startValue, endValue) => {
340
+ const startDate = parseStringDate($xeGanttView, startValue);
341
+ const endDate = parseStringDate($xeGanttView, endValue);
342
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd');
343
+ const startFirstDate = XEUtils.getWhatDay(startDate, 0, 'first');
344
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd');
345
+ const endFirstDate = XEUtils.getWhatDay(endDate, 0, 'first');
346
+ const minuteSize = Math.floor((XEUtils.getWhatDay(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
347
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
348
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
349
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
350
+ return {
351
+ offsetLeftSize,
352
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
353
+ };
354
+ };
355
+ }
356
+ case 'hour': {
357
+ const indexMaps = {};
358
+ fullCols.forEach(({ dateObj }, i) => {
359
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH');
360
+ indexMaps[yyyyMM] = i;
361
+ });
362
+ return (startValue, endValue) => {
363
+ const startDate = parseStringDate($xeGanttView, startValue);
364
+ const endDate = parseStringDate($xeGanttView, endValue);
365
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH');
366
+ const startFirstDate = XEUtils.getWhatHours(startDate, 0, 'first');
367
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH');
368
+ const endFirstDate = XEUtils.getWhatHours(endDate, 0, 'first');
369
+ const minuteSize = Math.floor((XEUtils.getWhatHours(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
370
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
371
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
372
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
373
+ return {
374
+ offsetLeftSize,
375
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
376
+ };
377
+ };
378
+ }
379
+ case 'minute': {
380
+ const indexMaps = {};
381
+ fullCols.forEach(({ dateObj }, i) => {
382
+ const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH:mm');
383
+ indexMaps[yyyyMM] = i;
384
+ });
385
+ return (startValue, endValue) => {
386
+ const startDate = parseStringDate($xeGanttView, startValue);
387
+ const endDate = parseStringDate($xeGanttView, endValue);
388
+ const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH:mm');
389
+ const startFirstDate = XEUtils.getWhatMinutes(startDate, 0, 'first');
390
+ const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH:mm');
391
+ const endFirstDate = XEUtils.getWhatMinutes(endDate, 0, 'first');
392
+ const minuteSize = Math.floor((XEUtils.getWhatMinutes(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
393
+ const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
394
+ const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
395
+ const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
396
+ return {
397
+ offsetLeftSize,
398
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
399
+ };
400
+ };
401
+ }
402
+ case 'second': {
403
+ const gapTime = getStandardGapTime(minScale.type);
404
+ return (startValue, endValue) => {
405
+ const startDate = parseStringDate($xeGanttView, startValue);
406
+ const endDate = parseStringDate($xeGanttView, endValue);
407
+ let offsetLeftSize = 0;
408
+ let offsetWidthSize = 0;
409
+ if (minViewDate) {
410
+ offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime;
411
+ offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime) + 1;
412
+ }
413
+ return {
414
+ offsetLeftSize,
415
+ offsetWidthSize
416
+ };
417
+ };
418
+ }
419
+ }
420
+ return () => {
421
+ return {
422
+ offsetLeftSize: 0,
423
+ offsetWidthSize: 0
424
+ };
425
+ };
426
+ }
427
+ function handleParseColumn($xeGanttView) {
428
+ const $xeGantt = $xeGanttView.$xeGantt;
429
+ const reactData = $xeGanttView.reactData;
430
+ const internalData = $xeGanttView.internalData;
431
+ const ganttProps = $xeGantt;
432
+ const { treeConfig } = ganttProps;
433
+ const { minViewDate, maxViewDate } = reactData;
434
+ const { fullCols, groupCols } = handleColumnHeader($xeGanttView);
435
+ if (minViewDate && maxViewDate) {
243
436
  const $xeTable = internalData.xeTable;
244
437
  if ($xeTable) {
245
438
  const startField = $xeGantt.computeStartField;
@@ -253,20 +446,18 @@ function handleParseColumn($xeGanttView) {
253
446
  const { transform } = treeOpts;
254
447
  const childrenField = treeOpts.children || treeOpts.childrenField;
255
448
  const ctMaps = {};
449
+ const renderFn = createChartRender($xeGanttView, fullCols);
256
450
  const handleParseRender = (row) => {
257
451
  const rowid = $xeTable.getRowid(row);
258
452
  const startValue = XEUtils.get(row, startField);
259
453
  const endValue = XEUtils.get(row, endField);
260
454
  if (startValue && endValue) {
261
- const startDate = parseStringDate($xeGanttView, startValue);
262
- const endDate = parseStringDate($xeGanttView, endValue);
263
- const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / gapTime);
264
- const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / gapTime) + 1;
455
+ const { offsetLeftSize, offsetWidthSize } = renderFn(startValue, endValue);
265
456
  ctMaps[rowid] = {
266
457
  row,
267
458
  rowid,
268
- oLeftSize,
269
- oWidthSize
459
+ oLeftSize: offsetLeftSize,
460
+ oWidthSize: offsetWidthSize
270
461
  };
271
462
  }
272
463
  };
@@ -527,10 +718,10 @@ function handleLazyRecalculate($xeGanttView) {
527
718
  return new Promise(resolve => {
528
719
  const { rceTimeout, rceRunTime } = internalData;
529
720
  const $xeTable = internalData.xeTable;
530
- let refreshDelay = 50;
721
+ let refreshDelay = 30;
531
722
  if ($xeTable) {
532
723
  const resizeOpts = $xeTable.computeResizeOpts;
533
- refreshDelay = resizeOpts.refreshDelay || 50;
724
+ refreshDelay = resizeOpts.refreshDelay || refreshDelay;
534
725
  }
535
726
  if (rceTimeout) {
536
727
  clearTimeout(rceTimeout);
@@ -918,15 +1109,88 @@ export default defineVxeComponent({
918
1109
  internalData
919
1110
  };
920
1111
  },
921
- computed: Object.assign({}, {}),
1112
+ computed: Object.assign(Object.assign({}, {}), { computeScaleDateList() {
1113
+ const $xeGanttView = this;
1114
+ const $xeGantt = $xeGanttView.$xeGantt;
1115
+ const reactData = $xeGanttView.reactData;
1116
+ const { minViewDate, maxViewDate } = reactData;
1117
+ const minScale = $xeGantt.computeMinScale;
1118
+ const dateList = [];
1119
+ if (!minViewDate || !maxViewDate) {
1120
+ return dateList;
1121
+ }
1122
+ const startTime = minViewDate.getTime();
1123
+ const endTime = maxViewDate.getTime();
1124
+ switch (minScale.type) {
1125
+ case 'year': {
1126
+ let currDate = XEUtils.getWhatYear(minViewDate, 0, 'first');
1127
+ while (currDate <= maxViewDate) {
1128
+ const itemDate = currDate;
1129
+ dateList.push(itemDate);
1130
+ currDate = XEUtils.getWhatYear(currDate, 1);
1131
+ }
1132
+ break;
1133
+ }
1134
+ case 'quarter': {
1135
+ let currDate = XEUtils.getWhatQuarter(minViewDate, 0, 'first');
1136
+ while (currDate <= maxViewDate) {
1137
+ const itemDate = currDate;
1138
+ dateList.push(itemDate);
1139
+ currDate = XEUtils.getWhatQuarter(currDate, 1);
1140
+ }
1141
+ break;
1142
+ }
1143
+ case 'month': {
1144
+ let currDate = XEUtils.getWhatMonth(minViewDate, 0, 'first');
1145
+ while (currDate <= maxViewDate) {
1146
+ const itemDate = currDate;
1147
+ dateList.push(itemDate);
1148
+ currDate = XEUtils.getWhatMonth(currDate, 1);
1149
+ }
1150
+ break;
1151
+ }
1152
+ case 'week': {
1153
+ let currDate = XEUtils.getWhatWeek(minViewDate, 0, minScale.startDay, minScale.startDay);
1154
+ while (currDate <= maxViewDate) {
1155
+ const itemDate = currDate;
1156
+ dateList.push(itemDate);
1157
+ currDate = XEUtils.getWhatWeek(currDate, 1);
1158
+ }
1159
+ break;
1160
+ }
1161
+ case 'day':
1162
+ case 'date':
1163
+ case 'hour':
1164
+ case 'minute':
1165
+ case 'second': {
1166
+ const gapTime = getStandardGapTime(minScale.type);
1167
+ let currTime = startTime;
1168
+ while (currTime <= endTime) {
1169
+ const itemDate = new Date(currTime);
1170
+ dateList.push(itemDate);
1171
+ currTime += gapTime;
1172
+ }
1173
+ break;
1174
+ }
1175
+ }
1176
+ return dateList;
1177
+ } }),
922
1178
  methods: {
923
1179
  //
924
1180
  // Method
925
1181
  //
926
1182
  refreshData() {
927
1183
  const $xeGanttView = this;
1184
+ const internalData = $xeGanttView.internalData;
928
1185
  handleUpdateData($xeGanttView);
929
- return handleLazyRecalculate($xeGanttView);
1186
+ handleRecalculateStyle($xeGanttView);
1187
+ return $xeGanttView.$nextTick().then(() => {
1188
+ const $xeTable = internalData.xeTable;
1189
+ handleRecalculateStyle($xeGanttView);
1190
+ if ($xeTable) {
1191
+ return $xeTable.recalculate();
1192
+ }
1193
+ });
930
1194
  },
931
1195
  updateViewData() {
932
1196
  const $xeGanttView = this;