vxe-gantt 3.0.4 → 3.0.6

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 +18 -4
  2. package/es/gantt/src/gantt-header.js +29 -6
  3. package/es/gantt/src/gantt-view.js +230 -87
  4. package/es/gantt/src/gantt.js +64 -3
  5. package/es/gantt/style.css +2 -0
  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 +6 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-gantt/style.css +2 -0
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-chart.js +22 -5
  14. package/lib/gantt/src/gantt-chart.min.js +1 -1
  15. package/lib/gantt/src/gantt-header.js +37 -6
  16. package/lib/gantt/src/gantt-header.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +261 -91
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +75 -2
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +2 -0
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +527 -113
  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 +6 -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 +2 -0
  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 +20 -4
  35. package/packages/gantt/src/gantt-header.ts +29 -6
  36. package/packages/gantt/src/gantt-view.ts +241 -91
  37. package/packages/gantt/src/gantt.ts +73 -2
  38. package/packages/ui/index.ts +5 -0
  39. package/styles/components/gantt-module/gantt-chart.scss +2 -0
  40. package/styles/theme/base.scss +1 -1
@@ -41,13 +41,28 @@ export default defineVxeComponent({
41
41
  const progressField = $xeGantt.computeProgressField;
42
42
  const taskBarOpts = $xeGantt.computeTaskBarOpts;
43
43
  const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts;
44
- const { round } = barStyle || {};
44
+ const isBarRowStyle = XEUtils.isFunction(barStyle);
45
+ const barStyObj = (barStyle ? (isBarRowStyle ? barStyle({ row, $gantt: $xeGantt }) : barStyle) : {}) || {};
46
+ const { round } = barStyObj;
45
47
  const rowRest = fullAllDataRowIdData[rowid] || {};
46
48
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
47
49
  const isRsHeight = resizeHeight > 0;
48
50
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
49
51
  let title = getStringValue(XEUtils.get(row, titleField));
50
52
  const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0;
53
+ const vbStyle = {};
54
+ const vpStyle = {
55
+ width: `${progressValue || 0}%`
56
+ };
57
+ if (isBarRowStyle) {
58
+ const { bgColor, completedBgColor } = barStyObj;
59
+ if (bgColor) {
60
+ vbStyle.backgroundColor = bgColor;
61
+ }
62
+ if (completedBgColor) {
63
+ vpStyle.backgroundColor = completedBgColor;
64
+ }
65
+ }
51
66
  if (contentMethod) {
52
67
  title = getStringValue(contentMethod({ row, title }));
53
68
  }
@@ -66,6 +81,7 @@ export default defineVxeComponent({
66
81
  }, [
67
82
  h('div', {
68
83
  class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
84
+ style: vbStyle,
69
85
  attrs: {
70
86
  rowid
71
87
  },
@@ -83,9 +99,7 @@ export default defineVxeComponent({
83
99
  showProgress
84
100
  ? h('div', {
85
101
  class: 'vxe-gantt-view--chart-progress',
86
- style: {
87
- width: `${progressValue}%`
88
- }
102
+ style: vpStyle
89
103
  })
90
104
  : renderEmptyElement($xeGantt),
91
105
  showContent
@@ -1,4 +1,6 @@
1
1
  import { defineVxeComponent } from '../../ui/src/comp';
2
+ import { VxeUI } from '@vxe-ui/core';
3
+ const { getI18n } = VxeUI;
2
4
  export default defineVxeComponent({
3
5
  name: 'VxeGanttViewHeader',
4
6
  inject: {
@@ -16,6 +18,7 @@ export default defineVxeComponent({
16
18
  //
17
19
  renderVN(h) {
18
20
  const _vm = this;
21
+ const $xeGantt = _vm.$xeGantt;
19
22
  const $xeGanttView = _vm.$xeGanttView;
20
23
  const { reactData } = $xeGanttView;
21
24
  const { tableColumn, headerGroups, viewCellWidth } = reactData;
@@ -46,18 +49,38 @@ export default defineVxeComponent({
46
49
  }
47
50
  });
48
51
  })),
49
- h('thead', {}, headerGroups.map((cols, rIndex) => {
52
+ h('thead', {}, headerGroups.map(({ scaleItem, columns }, $rowIndex) => {
53
+ const { type, titleMethod, slots } = scaleItem;
54
+ const titleSlot = slots ? slots.title : null;
50
55
  return h('tr', {
51
- key: rIndex
52
- }, cols.map((column, cIndex) => {
56
+ key: $rowIndex
57
+ }, columns.map((column, cIndex) => {
58
+ const { childCount, dateObj } = column;
59
+ let label = `${column.title}`;
60
+ if ($rowIndex < headerGroups.length - 1) {
61
+ if (scaleItem.type === 'day') {
62
+ label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
63
+ }
64
+ else {
65
+ label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
66
+ }
67
+ }
68
+ let cellVNs = label;
69
+ const ctParams = { scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex };
70
+ if (titleSlot) {
71
+ cellVNs = $xeGantt.callSlot(titleSlot, ctParams, h);
72
+ }
73
+ else if (titleMethod) {
74
+ cellVNs = `${titleMethod(ctParams)}`;
75
+ }
53
76
  return h('th', {
54
77
  key: cIndex,
55
78
  class: 'vxe-gantt-view--header-column',
56
79
  attrs: {
57
- colspan: column.children ? column.children.length : null,
58
- title: `${column.field}`
80
+ colspan: childCount || null,
81
+ title: titleSlot ? null : label
59
82
  }
60
- }, column.title);
83
+ }, cellVNs);
61
84
  }));
62
85
  }))
63
86
  ])
@@ -49,91 +49,242 @@ function handleParseColumn($xeGanttView) {
49
49
  const reactData = $xeGanttView.reactData;
50
50
  const internalData = $xeGanttView.internalData;
51
51
  const ganttProps = $xeGantt;
52
+ const ganttReactData = $xeGantt.reactData;
52
53
  const { treeConfig } = ganttProps;
54
+ const { taskScaleList } = ganttReactData;
53
55
  const { minViewDate, maxViewDate } = reactData;
54
- const taskViewOpts = $xeGantt.computeTaskViewOpts;
56
+ const minScale = XEUtils.last(taskScaleList);
55
57
  const fullCols = [];
56
58
  const groupCols = [];
57
- switch (taskViewOpts.mode) {
58
- case 'year':
59
- break;
60
- case 'quarter':
61
- break;
62
- case 'month':
63
- break;
64
- case 'week':
65
- break;
66
- default: {
67
- if (minViewDate && maxViewDate) {
68
- const currTime = minViewDate.getTime();
69
- const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
70
- const countDayNum = Math.max(6, Math.floor(diffDayNum / 86400000) + 1);
71
- const groupList = [];
72
- const colList = [];
73
- const groupMaps = {};
74
- for (let i = 0; i < countDayNum; i++) {
75
- const itemDate = new Date(currTime + (i * 86400000));
76
- const yyyyy = `${itemDate.getFullYear()}-${itemDate.getMonth() + 1}`;
77
- const mmDd = `${itemDate.getDate()}`;
78
- let groupCol = groupMaps[yyyyy];
79
- const column = {
80
- field: `${yyyyy}-${mmDd}`,
81
- title: mmDd
82
- };
83
- if (groupCol) {
84
- groupCol.children.push(column);
85
- fullCols.push(groupCol);
86
- }
87
- else {
88
- groupCol = {
89
- field: yyyyy,
90
- title: yyyyy,
91
- children: [column]
92
- };
93
- groupList.push(groupCol);
94
- fullCols.push(groupCol);
95
- groupMaps[yyyyy] = groupCol;
96
- }
97
- colList.push(column);
59
+ if (minScale && minViewDate && maxViewDate) {
60
+ const minSType = minScale.type;
61
+ const weekScale = taskScaleList.find(item => item.type === 'week');
62
+ let gapTime = 1000 * 60 * 60 * 24;
63
+ switch (minScale.type) {
64
+ case 'hour':
65
+ gapTime = 1000 * 60 * 60;
66
+ break;
67
+ case 'minute':
68
+ gapTime = 1000 * 60;
69
+ break;
70
+ case 'second':
71
+ gapTime = 1000;
72
+ break;
73
+ default: {
74
+ break;
75
+ }
76
+ }
77
+ const currTime = minViewDate.getTime();
78
+ const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
79
+ const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1);
80
+ switch (minScale.type) {
81
+ case 'day':
82
+ case 'date':
83
+ if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
84
+ reactData.tableColumn = [];
85
+ reactData.headerGroups = [];
86
+ return;
98
87
  }
99
- groupCols.push(groupList, colList);
100
- const $xeTable = internalData.xeTable;
101
- if ($xeTable) {
102
- const startField = $xeGantt.computeStartField;
103
- const endField = $xeGantt.computeEndField;
104
- const tableInternalData = $xeTable;
105
- const { afterFullData, afterTreeFullData } = tableInternalData;
106
- const treeOpts = $xeTable.computeTreeOpts;
107
- const { transform } = treeOpts;
108
- const childrenField = treeOpts.children || treeOpts.childrenField;
109
- const ctMaps = {};
110
- const handleParseRender = (row) => {
111
- const rowid = $xeTable.getRowid(row);
112
- const startValue = XEUtils.get(row, startField);
113
- const endValue = XEUtils.get(row, endField);
114
- if (startValue && endValue) {
115
- const startDate = parseStringDate($xeGanttView, startValue);
116
- const endDate = parseStringDate($xeGanttView, endValue);
117
- const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / 86400000);
118
- const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / 86400000) + 1;
119
- ctMaps[rowid] = {
120
- row,
121
- rowid,
122
- oLeftSize,
123
- oWidthSize
124
- };
125
- }
88
+ break;
89
+ case 'hour':
90
+ if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
91
+ reactData.tableColumn = [];
92
+ reactData.headerGroups = [];
93
+ return;
94
+ }
95
+ break;
96
+ case 'minute':
97
+ if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
98
+ reactData.tableColumn = [];
99
+ reactData.headerGroups = [];
100
+ return;
101
+ }
102
+ break;
103
+ case 'second':
104
+ if (diffDayNum > (1000 * 60 * 60 * 3)) {
105
+ reactData.tableColumn = [];
106
+ reactData.headerGroups = [];
107
+ return;
108
+ }
109
+ break;
110
+ }
111
+ const renderListMaps = {
112
+ year: [],
113
+ quarter: [],
114
+ month: [],
115
+ week: [],
116
+ day: [],
117
+ date: [],
118
+ hour: [],
119
+ minute: [],
120
+ second: []
121
+ };
122
+ const tempTypeMaps = {
123
+ year: {},
124
+ quarter: {},
125
+ month: {},
126
+ week: {},
127
+ day: {},
128
+ date: {},
129
+ hour: {},
130
+ minute: {},
131
+ second: {}
132
+ };
133
+ const handleData = (type, colMaps, minCol) => {
134
+ if (minSType === type) {
135
+ return;
136
+ }
137
+ const currCol = colMaps[type];
138
+ const currKey = `${currCol.field}`;
139
+ let currGpCol = tempTypeMaps[type][currKey];
140
+ if (!currGpCol) {
141
+ currGpCol = currCol;
142
+ tempTypeMaps[type][currKey] = currGpCol;
143
+ renderListMaps[type].push(currGpCol);
144
+ }
145
+ if (currGpCol) {
146
+ if (!currGpCol.children) {
147
+ currGpCol.children = [];
148
+ }
149
+ currGpCol.children.push(minCol);
150
+ }
151
+ };
152
+ for (let i = 0; i < countSize; i++) {
153
+ const itemDate = new Date(currTime + (i * gapTime));
154
+ const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-');
155
+ const e = itemDate.getDay();
156
+ const E = e + 1;
157
+ const q = Math.ceil((itemDate.getMonth() + 1) / 3);
158
+ const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined);
159
+ const dateObj = { yy: yyyy, M: MM, d: dd, H: HH, m: mm, s: ss, q, W, E, e };
160
+ const colMaps = {
161
+ year: {
162
+ field: yyyy,
163
+ title: yyyy,
164
+ dateObj
165
+ },
166
+ quarter: {
167
+ field: `${yyyy}_q${q}`,
168
+ title: `${q}`,
169
+ dateObj
170
+ },
171
+ month: {
172
+ field: `${yyyy}_${MM}`,
173
+ title: MM,
174
+ dateObj
175
+ },
176
+ week: {
177
+ field: `${yyyy}_W${W}`,
178
+ title: `${W}`,
179
+ dateObj
180
+ },
181
+ day: {
182
+ field: `${yyyy}_${MM}_${dd}_E${E}`,
183
+ title: `${E}`,
184
+ dateObj
185
+ },
186
+ date: {
187
+ field: `${yyyy}_${MM}_${dd}`,
188
+ title: dd,
189
+ dateObj
190
+ },
191
+ hour: {
192
+ field: `${yyyy}_${MM}_${dd}_${HH}`,
193
+ title: HH,
194
+ dateObj
195
+ },
196
+ minute: {
197
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
198
+ title: mm,
199
+ dateObj
200
+ },
201
+ second: {
202
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
203
+ title: ss,
204
+ dateObj
205
+ }
206
+ };
207
+ const minCol = colMaps[minSType];
208
+ if (minScale.level < 19) {
209
+ handleData('year', colMaps, minCol);
210
+ }
211
+ if (minScale.level < 17) {
212
+ handleData('quarter', colMaps, minCol);
213
+ }
214
+ if (minScale.level < 14) {
215
+ handleData('month', colMaps, minCol);
216
+ }
217
+ if (minScale.level < 13) {
218
+ handleData('week', colMaps, minCol);
219
+ }
220
+ if (minScale.level < 11) {
221
+ handleData('day', colMaps, minCol);
222
+ }
223
+ if (minScale.level < 12) {
224
+ handleData('date', colMaps, minCol);
225
+ }
226
+ if (minScale.level < 7) {
227
+ handleData('hour', colMaps, minCol);
228
+ }
229
+ if (minScale.level < 5) {
230
+ handleData('minute', colMaps, minCol);
231
+ }
232
+ fullCols.push(minCol);
233
+ }
234
+ taskScaleList.forEach(scaleItem => {
235
+ if (scaleItem.type === minSType) {
236
+ groupCols.push({
237
+ scaleItem,
238
+ columns: fullCols
239
+ });
240
+ return;
241
+ }
242
+ const list = renderListMaps[scaleItem.type] || [];
243
+ if (list) {
244
+ list.forEach(item => {
245
+ item.childCount = item.children ? item.children.length : 0;
246
+ item.children = undefined;
247
+ });
248
+ }
249
+ groupCols.push({
250
+ scaleItem,
251
+ columns: list
252
+ });
253
+ });
254
+ const $xeTable = internalData.xeTable;
255
+ if ($xeTable) {
256
+ const startField = $xeGantt.computeStartField;
257
+ const endField = $xeGantt.computeEndField;
258
+ const tableInternalData = $xeTable;
259
+ const { afterFullData, afterTreeFullData } = tableInternalData;
260
+ const treeOpts = $xeTable.computeTreeOpts;
261
+ const { transform } = treeOpts;
262
+ const childrenField = treeOpts.children || treeOpts.childrenField;
263
+ const ctMaps = {};
264
+ const handleParseRender = (row) => {
265
+ const rowid = $xeTable.getRowid(row);
266
+ const startValue = XEUtils.get(row, startField);
267
+ const endValue = XEUtils.get(row, endField);
268
+ if (startValue && endValue) {
269
+ const startDate = parseStringDate($xeGanttView, startValue);
270
+ const endDate = parseStringDate($xeGanttView, endValue);
271
+ const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / gapTime);
272
+ const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / gapTime) + 1;
273
+ ctMaps[rowid] = {
274
+ row,
275
+ rowid,
276
+ oLeftSize,
277
+ oWidthSize
126
278
  };
127
- if (treeConfig) {
128
- XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField });
129
- }
130
- else {
131
- afterFullData.forEach(handleParseRender);
132
- }
133
- internalData.chartMaps = ctMaps;
134
279
  }
280
+ };
281
+ if (treeConfig) {
282
+ XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField });
135
283
  }
136
- break;
284
+ else {
285
+ afterFullData.forEach(handleParseRender);
286
+ }
287
+ internalData.chartMaps = ctMaps;
137
288
  }
138
289
  }
139
290
  reactData.tableColumn = fullCols;
@@ -535,14 +686,7 @@ export default defineVxeComponent({
535
686
  tableData: [],
536
687
  tableColumn: [],
537
688
  headerGroups: [],
538
- viewCellWidth: 40,
539
- rowHeightStore: {
540
- large: 52,
541
- default: 48,
542
- medium: 44,
543
- small: 40,
544
- mini: 36
545
- }
689
+ viewCellWidth: 20
546
690
  };
547
691
  const internalData = createInternalData();
548
692
  return {
@@ -862,11 +1006,10 @@ export default defineVxeComponent({
862
1006
  const $xeGantt = $xeGanttView.$xeGantt;
863
1007
  const reactData = $xeGanttView.reactData;
864
1008
  const { overflowX, overflowY, scrollXLoad, scrollYLoad } = reactData;
865
- const taskViewOpts = $xeGantt.computeTaskViewOpts;
866
1009
  const scrollbarXToTop = $xeGantt.computeScrollbarXToTop;
867
1010
  return h('div', {
868
1011
  ref: 'refElem',
869
- class: ['vxe-gantt-view', `mode--${taskViewOpts.mode || 'day'}`, {
1012
+ class: ['vxe-gantt-view', {
870
1013
  'is--scroll-y': overflowY,
871
1014
  'is--scroll-x': overflowX,
872
1015
  'is--virtual-x': scrollXLoad,
@@ -12,6 +12,20 @@ const tableProps = VxeTableComponent.props;
12
12
  const tableMethods = {};
13
13
  const propKeys = Object.keys(tableProps);
14
14
  const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']];
15
+ const viewTypeLevelMaps = {
16
+ year: 19,
17
+ quarter: 17,
18
+ month: 15,
19
+ week: 13,
20
+ day: 11,
21
+ date: 9,
22
+ hour: 7,
23
+ minute: 5,
24
+ second: 3
25
+ };
26
+ function getViewTypeLevel(type) {
27
+ return viewTypeLevelMaps[type || 'date'] || viewTypeLevelMaps.date;
28
+ }
15
29
  function getTableOns($xeGantt) {
16
30
  const _vm = $xeGantt;
17
31
  const $listeners = _vm.$listeners;
@@ -53,7 +67,7 @@ export default {
53
67
  mixins: [
54
68
  globalMixins.sizeMixin
55
69
  ],
56
- props: Object.assign(Object.assign({}, tableProps), { columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, layouts: Array, taskConfig: Object, taskViewConfig: Object, taskBarConfig: Object, taskSplitConfig: Object, size: {
70
+ props: Object.assign(Object.assign({}, tableProps), { columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, layouts: Array, taskConfig: Object, taskViewScaleConfs: Object, taskViewConfig: Object, taskBarConfig: Object, taskSplitConfig: Object, size: {
57
71
  type: String,
58
72
  default: () => getConfig().gantt.size || getConfig().size
59
73
  } }),
@@ -83,7 +97,8 @@ export default {
83
97
  currentPage: 1
84
98
  },
85
99
  showLeftView: true,
86
- showRightView: true
100
+ showRightView: true,
101
+ taskScaleList: []
87
102
  };
88
103
  const internalData = createInternalData();
89
104
  return {
@@ -132,6 +147,11 @@ export default {
132
147
  const props = $xeGantt;
133
148
  return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig);
134
149
  },
150
+ computeTaskViewScaleMapsOpts() {
151
+ const $xeGantt = this;
152
+ const props = $xeGantt;
153
+ return XEUtils.merge({}, getConfig().gantt.taskViewScaleConfs, props.taskViewScaleConfs);
154
+ },
135
155
  computeTaskViewOpts() {
136
156
  const $xeGantt = this;
137
157
  const props = $xeGantt;
@@ -147,6 +167,12 @@ export default {
147
167
  const props = $xeGantt;
148
168
  return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
149
169
  },
170
+ computeTaskScaleConfs() {
171
+ const $xeGantt = this;
172
+ const taskViewOpts = $xeGantt.computeTaskViewOpts;
173
+ const { scales } = taskViewOpts;
174
+ return scales;
175
+ },
150
176
  computeTitleField() {
151
177
  const $xeGantt = this;
152
178
  const taskOpts = $xeGantt.computeTaskOpts;
@@ -204,7 +230,7 @@ export default {
204
230
  stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight);
205
231
  }
206
232
  }
207
- if (barStyle) {
233
+ if (barStyle && !XEUtils.isFunction(barStyle)) {
208
234
  const { bgColor, completedBgColor } = barStyle;
209
235
  if (bgColor) {
210
236
  stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor;
@@ -383,12 +409,46 @@ export default {
383
409
  proxyConfig() {
384
410
  const $xeGantt = this;
385
411
  $xeGantt.initProxy();
412
+ },
413
+ computeTaskScaleConfs() {
414
+ const $xeGantt = this;
415
+ $xeGantt.handleTaskScaleConfig();
386
416
  }
387
417
  },
388
418
  methods: Object.assign(Object.assign({}, tableMethods), { dispatchEvent(type, params, evnt) {
389
419
  const $xeGantt = this;
390
420
  $xeGantt.$emit(type, createEvent(evnt, { $grid: null, $gantt: $xeGantt }, params));
391
421
  },
422
+ handleTaskScaleConfig() {
423
+ const $xeGantt = this;
424
+ const reactData = $xeGantt.reactData;
425
+ const taskScaleConfs = $xeGantt.computeTaskScaleConfs;
426
+ const taskViewScaleMapsOpts = $xeGantt.computeTaskViewScaleMapsOpts;
427
+ const scaleConfs = [];
428
+ if (taskScaleConfs) {
429
+ const keyMaps = {};
430
+ taskScaleConfs.forEach(conf => {
431
+ const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf;
432
+ const { type } = sConf;
433
+ if (!type || !viewTypeLevelMaps[type]) {
434
+ errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')]);
435
+ return;
436
+ }
437
+ if (keyMaps[type]) {
438
+ errLog('vxe.error.repeatProp', ['type', type]);
439
+ return;
440
+ }
441
+ keyMaps[type] = true;
442
+ scaleConfs.push(Object.assign({}, type ? taskViewScaleMapsOpts[type] || {} : {}, sConf, {
443
+ level: getViewTypeLevel(type)
444
+ }));
445
+ });
446
+ }
447
+ if (!scaleConfs.length) {
448
+ scaleConfs.push({ type: 'month', level: viewTypeLevelMaps.month }, { type: 'day', level: viewTypeLevelMaps.day });
449
+ }
450
+ reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' });
451
+ },
392
452
  initToolbar() {
393
453
  const $xeGantt = this;
394
454
  $xeGantt.$nextTick(() => {
@@ -1991,6 +2051,7 @@ export default {
1991
2051
  }
1992
2052
  }
1993
2053
  });
2054
+ $xeGantt.handleTaskScaleConfig();
1994
2055
  $xeGantt.initPages();
1995
2056
  },
1996
2057
  mounted() {
@@ -8,6 +8,8 @@
8
8
 
9
9
  .vxe-gantt-view--chart-row {
10
10
  position: relative;
11
+ width: 100%;
12
+ height: 0;
11
13
  }
12
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 {
13
15
  border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);