vxe-gantt 3.6.5 → 3.6.7

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.
@@ -40,7 +40,7 @@ export default defineVxeComponent({
40
40
  const { showNowLine, viewStyle } = taskViewOpts;
41
41
  const scaleUnit = $xeGantt.computeScaleUnit;
42
42
  const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
43
- const { field, dateObj } = column;
43
+ const { field, dateObj, startDateObj, endDateObj } = column;
44
44
  const { cellClassName, cellStyle } = viewStyle || {};
45
45
  const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
46
46
  const rowRest = fullAllDataRowIdData[rowid] || {};
@@ -86,6 +86,8 @@ export default defineVxeComponent({
86
86
  type: viewType,
87
87
  scaleType: scaleUnit,
88
88
  dateObj,
89
+ startDateObj,
90
+ endDateObj,
89
91
  row,
90
92
  column,
91
93
  $rowIndex,
@@ -28,6 +28,8 @@ export default defineVxeComponent({
28
28
  const { headerGroups, viewCellWidth } = reactData;
29
29
  const { todayDateMaps, visibleColumn } = internalData;
30
30
  const taskViewOpts = $xeGantt.computeTaskViewOpts;
31
+ const minScale = $xeGantt.computeMinScale;
32
+ const scaleStep = $xeGantt.computeScaleStep;
31
33
  const { showNowLine } = taskViewOpts;
32
34
  return h('div', {
33
35
  ref: 'refElem',
@@ -64,17 +66,31 @@ export default defineVxeComponent({
64
66
  return h('tr', {
65
67
  key: $rowIndex
66
68
  }, columns.map((column, cIndex) => {
67
- const { field, childCount, dateObj } = column;
69
+ const { field, childCount, dateObj, startDateObj, endDateObj } = column;
68
70
  let label = `${column.title}`;
69
- if (scaleItem.type === 'day') {
70
- label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
71
+ if ((isLast || (minScale && (minScale.type === 'date' || minScale.type === 'day') && (type === 'date' || type === 'day'))) && scaleStep > 1) {
72
+ label = getI18n(`vxe.gantt.stepFormat.${type}`, {
73
+ start: startDateObj,
74
+ end: endDateObj,
75
+ eStartLabel: getI18n(`vxe.gantt.dayss.w${startDateObj.e}`),
76
+ eEndLabel: getI18n(`vxe.gantt.dayss.w${endDateObj.e}`)
77
+ });
71
78
  }
72
79
  else {
73
- if ($rowIndex) {
74
- label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
80
+ if (type === 'day') {
81
+ if ($rowIndex) {
82
+ label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, {
83
+ eLabel: getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
84
+ });
85
+ }
86
+ else {
87
+ label = getI18n(`vxe.gantt.tFullFormat.${type}`, {
88
+ eLabel: getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
89
+ });
90
+ }
75
91
  }
76
92
  else {
77
- if (isLast && scaleItem.type === 'week') {
93
+ if ($rowIndex) {
78
94
  label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
79
95
  }
80
96
  else {
@@ -83,7 +99,17 @@ export default defineVxeComponent({
83
99
  }
84
100
  }
85
101
  let cellVNs = label;
86
- const ctParams = { source: sourceType, type: viewType, column, scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex };
102
+ const ctParams = {
103
+ source: sourceType,
104
+ type: viewType,
105
+ column,
106
+ scaleObj: scaleItem,
107
+ title: label,
108
+ dateObj,
109
+ startDateObj,
110
+ endDateObj,
111
+ $rowIndex
112
+ };
87
113
  if (titleSlot) {
88
114
  cellVNs = $xeGantt.callSlot(titleSlot, ctParams, h);
89
115
  }
@@ -117,6 +117,8 @@ function handleColumnHeader($xeGanttView) {
117
117
  const minScale = $xeGantt.computeMinScale;
118
118
  const weekScale = $xeGantt.computeWeekScale;
119
119
  const scaleDateList = $xeGanttView.computeScaleDateList;
120
+ const scaleStep = $xeGantt.computeScaleStep;
121
+ const weekStartDay = weekScale ? weekScale.startDay : undefined;
120
122
  const fullCols = [];
121
123
  const groupCols = [];
122
124
  if (minScale && scaleUnit && scaleDateList.length) {
@@ -162,65 +164,88 @@ function handleColumnHeader($xeGanttView) {
162
164
  currGpCol.children.push(minCol);
163
165
  }
164
166
  };
165
- for (let i = 0; i < scaleDateList.length; i++) {
166
- const itemDate = scaleDateList[i];
167
- let [yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss] = XEUtils.toDateString(itemDate, 'yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss').split('-');
168
- const e = itemDate.getDay();
167
+ const createDateObj = (date) => {
168
+ let [yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss] = XEUtils.toDateString(date, 'yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss').split('-');
169
+ const e = date.getDay();
169
170
  const E = e + 1;
170
- const q = Math.ceil((itemDate.getMonth() + 1) / 3);
171
- const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
171
+ const q = Math.ceil((date.getMonth() + 1) / 3);
172
+ const W = `${XEUtils.getYearWeek(date, weekScale ? weekScale.startDay : undefined)}`;
172
173
  const WW = XEUtils.padStart(W, 2, '0');
173
174
  if (isMinWeek && checkWeekOfsetYear(W, M)) {
174
175
  yyyy = `${Number(yyyy) + 1}`;
175
176
  M = '1';
176
177
  MM = '0' + M;
177
178
  }
178
- const dateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e };
179
+ return { date, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e };
180
+ };
181
+ for (let i = 0; i < scaleDateList.length; i++) {
182
+ const itemDate = scaleDateList[i];
183
+ const dateObj = createDateObj(itemDate);
184
+ const { yyyy, MM, dd, HH, mm, ss, q, W, E } = dateObj;
185
+ const startDateObj = dateObj;
179
186
  const colMaps = {
180
187
  year: {
181
188
  field: yyyy,
182
189
  title: yyyy,
183
- dateObj
190
+ dateObj,
191
+ startDateObj,
192
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatYear(itemDate, scaleStep - 1)) : startDateObj
184
193
  },
185
194
  quarter: {
186
195
  field: `${yyyy}_q${q}`,
187
196
  title: `${q}`,
188
- dateObj
197
+ dateObj,
198
+ startDateObj,
199
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatQuarter(itemDate, scaleStep - 1)) : startDateObj
189
200
  },
190
201
  month: {
191
202
  field: `${yyyy}_${MM}`,
192
203
  title: MM,
193
- dateObj
204
+ dateObj,
205
+ startDateObj,
206
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatMonth(itemDate, scaleStep - 1)) : startDateObj
194
207
  },
195
208
  week: {
196
209
  field: `${yyyy}_W${W}`,
197
210
  title: `${W}`,
198
- dateObj
211
+ dateObj,
212
+ startDateObj,
213
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatWeek(itemDate, scaleStep - 1, weekStartDay, weekStartDay)) : startDateObj
199
214
  },
200
215
  day: {
201
216
  field: `${yyyy}_${MM}_${dd}_E${E}`,
202
217
  title: `${E}`,
203
- dateObj
218
+ dateObj,
219
+ startDateObj,
220
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatDay(itemDate, scaleStep - 1)) : startDateObj
204
221
  },
205
222
  date: {
206
223
  field: `${yyyy}_${MM}_${dd}`,
207
224
  title: dd,
208
- dateObj
225
+ dateObj,
226
+ startDateObj,
227
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatDay(itemDate, scaleStep - 1)) : startDateObj
209
228
  },
210
229
  hour: {
211
230
  field: `${yyyy}_${MM}_${dd}_${HH}`,
212
231
  title: HH,
213
- dateObj
232
+ dateObj,
233
+ startDateObj,
234
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatHours(itemDate, scaleStep - 1)) : startDateObj
214
235
  },
215
236
  minute: {
216
237
  field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
217
238
  title: mm,
218
- dateObj
239
+ dateObj,
240
+ startDateObj,
241
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatMinutes(itemDate, scaleStep - 1)) : startDateObj
219
242
  },
220
243
  second: {
221
244
  field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
222
245
  title: ss,
223
- dateObj
246
+ dateObj,
247
+ startDateObj,
248
+ endDateObj: scaleStep > 1 ? createDateObj(XEUtils.getWhatSeconds(itemDate, scaleStep - 1)) : startDateObj
224
249
  }
225
250
  };
226
251
  const minCol = colMaps[minScale.type];
@@ -1518,7 +1543,7 @@ export default defineVxeComponent({
1518
1543
  let rightSize = ganttReactData.currRightSpacing + XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0);
1519
1544
  if (scaleStep > 0) {
1520
1545
  leftSize *= scaleStep;
1521
- rightSize *= rightSize;
1546
+ rightSize *= scaleStep;
1522
1547
  }
1523
1548
  switch (type) {
1524
1549
  case 'year': {