vxe-gantt 3.0.3 → 3.0.5

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 (41) hide show
  1. package/es/gantt/src/gantt-body.js +47 -5
  2. package/es/gantt/src/gantt-header.js +22 -6
  3. package/es/gantt/src/gantt-view.js +230 -87
  4. package/es/gantt/src/gantt.js +64 -2
  5. package/es/gantt/style.css +35 -3
  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 +35 -3
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-body.js +53 -5
  14. package/lib/gantt/src/gantt-body.min.js +1 -1
  15. package/lib/gantt/src/gantt-header.js +29 -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 -1
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +35 -3
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +550 -112
  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 +35 -3
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +3 -3
  34. package/packages/gantt/src/gantt-body.ts +51 -6
  35. package/packages/gantt/src/gantt-header.ts +23 -7
  36. package/packages/gantt/src/gantt-view.ts +241 -91
  37. package/packages/gantt/src/gantt.ts +73 -1
  38. package/packages/ui/index.ts +5 -0
  39. package/styles/components/gantt-module/gantt-chart.scss +10 -0
  40. package/styles/components/gantt.scss +37 -3
  41. package/styles/theme/base.scss +1 -1
@@ -16,20 +16,56 @@ export default defineVxeComponent({
16
16
  //
17
17
  // Render
18
18
  //
19
- renderColumn(h, $xeTable, row, rowid, $rowIndex, column, $columnIndex) {
19
+ renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex) {
20
20
  const _vm = this;
21
21
  const $xeGantt = _vm.$xeGantt;
22
22
  const tableReactData = $xeTable;
23
23
  const { resizeHeightFlag } = tableReactData;
24
24
  const tableInternalData = $xeTable;
25
- const { fullAllDataRowIdData } = tableInternalData;
25
+ const { fullAllDataRowIdData, visibleColumn } = tableInternalData;
26
26
  const cellOpts = $xeTable.computeCellOpts;
27
27
  const rowOpts = $xeTable.computeRowOpts;
28
28
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
29
+ const resizableOpts = $xeTable.computeResizableOpts;
30
+ const { isAllRowDrag } = resizableOpts;
29
31
  const rowRest = fullAllDataRowIdData[rowid] || {};
30
32
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
31
33
  const isRsHeight = resizeHeight > 0;
32
34
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
35
+ const tdVNs = [];
36
+ if (isAllRowDrag && rowOpts.resizable) {
37
+ const cellParams = {
38
+ $table: $xeTable,
39
+ $grid: null,
40
+ $gantt: $xeGantt,
41
+ seq: -1,
42
+ rowid,
43
+ row,
44
+ rowIndex,
45
+ $rowIndex,
46
+ _rowIndex,
47
+ column: visibleColumn[0],
48
+ columnIndex: 0,
49
+ $columnIndex: 0,
50
+ _columnIndex: 0,
51
+ fixed: '',
52
+ type: '',
53
+ isHidden: false,
54
+ isEdit: false,
55
+ level: -1,
56
+ // 已废弃属性
57
+ visibleData: [],
58
+ data: [],
59
+ items: []
60
+ };
61
+ tdVNs.push(h('div', {
62
+ class: 'vxe-gantt-view-cell--row-resizable',
63
+ on: {
64
+ mousedown: (evnt) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
65
+ dblclick: (evnt) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
66
+ }
67
+ }));
68
+ }
33
69
  return h('td', {
34
70
  key: $columnIndex,
35
71
  class: ['vxe-gantt-view--body-column', {
@@ -46,7 +82,7 @@ export default defineVxeComponent({
46
82
  $xeGantt.handleTaskCellDblclickEvent(evnt, { row, column });
47
83
  }
48
84
  }
49
- });
85
+ }, tdVNs);
50
86
  },
51
87
  renderRows(h, $xeTable, tableData) {
52
88
  const _vm = this;
@@ -55,7 +91,7 @@ export default defineVxeComponent({
55
91
  const tableProps = $xeTable;
56
92
  const { treeConfig, stripe, highlightHoverRow, editConfig } = tableProps;
57
93
  const tableReactData = $xeTable;
58
- const { treeExpandedFlag, selectRadioRow, pendingRowFlag } = tableReactData;
94
+ const { treeExpandedFlag, selectRadioRow, pendingRowFlag, isRowGroupStatus } = tableReactData;
59
95
  const tableInternalData = $xeTable;
60
96
  const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps } = tableInternalData;
61
97
  const radioOpts = $xeTable.computeRadioOpts;
@@ -90,6 +126,12 @@ export default defineVxeComponent({
90
126
  $xeTable.clearHoverRow();
91
127
  };
92
128
  }
129
+ // 拖拽行事件
130
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
131
+ trOns.dragstart = $xeTable.handleRowDragDragstartEvent;
132
+ trOns.dragend = $xeTable.handleRowDragDragendEvent;
133
+ trOns.dragover = $xeTable.handleRowDragDragoverEvent;
134
+ }
93
135
  trVNs.push(h('tr', {
94
136
  key: treeConfig ? rowid : $rowIndex,
95
137
  class: ['vxe-gantt-view--body-row', {
@@ -103,7 +145,7 @@ export default defineVxeComponent({
103
145
  rowid
104
146
  },
105
147
  on: trOns
106
- }, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, $rowIndex, column, $columnIndex))));
148
+ }, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
107
149
  let isExpandTree = false;
108
150
  let rowChildren = [];
109
151
  if (treeConfig && !scrollYLoad && !transform) {
@@ -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: {
@@ -46,18 +48,32 @@ export default defineVxeComponent({
46
48
  }
47
49
  });
48
50
  })),
49
- h('thead', {}, headerGroups.map((cols, rIndex) => {
51
+ h('thead', {}, headerGroups.map(({ scaleItem, columns }, $rowIndex) => {
52
+ const { type, titleMethod } = scaleItem;
50
53
  return h('tr', {
51
- key: rIndex
52
- }, cols.map((column, cIndex) => {
54
+ key: $rowIndex
55
+ }, columns.map((column, cIndex) => {
56
+ const dateObj = column.params;
57
+ let label = `${column.title}`;
58
+ if ($rowIndex < headerGroups.length - 1) {
59
+ if (scaleItem.type === 'day') {
60
+ label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
61
+ }
62
+ else {
63
+ label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
64
+ }
65
+ }
66
+ if (titleMethod) {
67
+ label = `${titleMethod({ scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex })}`;
68
+ }
53
69
  return h('th', {
54
70
  key: cIndex,
55
71
  class: 'vxe-gantt-view--header-column',
56
72
  attrs: {
57
- colspan: column.children ? column.children.length : null,
58
- title: `${column.field}`
73
+ colspan: column.childCount || null,
74
+ title: label
59
75
  }
60
- }, column.title);
76
+ }, label);
61
77
  }));
62
78
  }))
63
79
  ])
@@ -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
+ params: dateObj
165
+ },
166
+ quarter: {
167
+ field: `${yyyy}_q${q}`,
168
+ title: q,
169
+ params: dateObj
170
+ },
171
+ month: {
172
+ field: `${yyyy}_${MM}`,
173
+ title: MM,
174
+ params: dateObj
175
+ },
176
+ week: {
177
+ field: `${yyyy}_W${W}`,
178
+ title: W,
179
+ params: dateObj
180
+ },
181
+ day: {
182
+ field: `${yyyy}_${MM}_${dd}_E${E}`,
183
+ title: E,
184
+ params: dateObj
185
+ },
186
+ date: {
187
+ field: `${yyyy}_${MM}_${dd}`,
188
+ title: dd,
189
+ params: dateObj
190
+ },
191
+ hour: {
192
+ field: `${yyyy}_${MM}_${dd}_${HH}`,
193
+ title: HH,
194
+ params: dateObj
195
+ },
196
+ minute: {
197
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
198
+ title: mm,
199
+ params: dateObj
200
+ },
201
+ second: {
202
+ field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
203
+ title: ss,
204
+ params: 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;
@@ -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(() => {
@@ -1709,6 +1769,7 @@ export default {
1709
1769
  const slots = $xeGantt.$scopedSlots;
1710
1770
  const tableProps = $xeGantt.computeTableProps;
1711
1771
  return h('div', {
1772
+ ref: 'refTableWrapper',
1712
1773
  class: 'vxe-gantt--table-wrapper'
1713
1774
  }, [
1714
1775
  h(VxeTableComponent, {
@@ -1990,6 +2051,7 @@ export default {
1990
2051
  }
1991
2052
  }
1992
2053
  });
2054
+ $xeGantt.handleTaskScaleConfig();
1993
2055
  $xeGantt.initPages();
1994
2056
  },
1995
2057
  mounted() {