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.
- package/es/gantt/src/gantt-chart.js +18 -4
- package/es/gantt/src/gantt-header.js +29 -6
- package/es/gantt/src/gantt-view.js +230 -87
- package/es/gantt/src/gantt.js +64 -3
- package/es/gantt/style.css +2 -0
- package/es/gantt/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +6 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-gantt/style.css +2 -0
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/gantt-chart.js +22 -5
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +37 -6
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +261 -91
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +75 -2
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/style/style.css +2 -0
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +527 -113
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +6 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +2 -0
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-chart.ts +20 -4
- package/packages/gantt/src/gantt-header.ts +29 -6
- package/packages/gantt/src/gantt-view.ts +241 -91
- package/packages/gantt/src/gantt.ts +73 -2
- package/packages/ui/index.ts +5 -0
- package/styles/components/gantt-module/gantt-chart.scss +2 -0
- 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
|
|
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((
|
|
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:
|
|
52
|
-
},
|
|
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:
|
|
58
|
-
title:
|
|
80
|
+
colspan: childCount || null,
|
|
81
|
+
title: titleSlot ? null : label
|
|
59
82
|
}
|
|
60
|
-
},
|
|
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
|
|
56
|
+
const minScale = XEUtils.last(taskScaleList);
|
|
55
57
|
const fullCols = [];
|
|
56
58
|
const groupCols = [];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
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:
|
|
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',
|
|
1012
|
+
class: ['vxe-gantt-view', {
|
|
870
1013
|
'is--scroll-y': overflowY,
|
|
871
1014
|
'is--scroll-x': overflowX,
|
|
872
1015
|
'is--virtual-x': scrollXLoad,
|
package/es/gantt/src/gantt.js
CHANGED
|
@@ -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() {
|
package/es/gantt/style.css
CHANGED
|
@@ -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);
|