vxe-gantt 4.0.4 → 4.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.
- package/es/gantt/src/gantt-header.js +22 -6
- package/es/gantt/src/gantt-view.js +232 -89
- package/es/gantt/src/gantt.js +59 -2
- package/es/gantt/src/util.js +6 -0
- 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/lib/gantt/src/gantt-header.js +34 -6
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +255 -99
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +74 -1
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +7 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/index.umd.js +425 -115
- 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/package.json +3 -3
- package/packages/gantt/src/gantt-header.ts +23 -7
- package/packages/gantt/src/gantt-view.ts +243 -93
- package/packages/gantt/src/gantt.ts +68 -1
- package/packages/gantt/src/util.ts +7 -0
- package/packages/ui/index.ts +5 -0
- package/styles/theme/base.scss +1 -1
package/lib/ui/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const {
|
|
|
17
17
|
setIcon,
|
|
18
18
|
checkVersion
|
|
19
19
|
} = _core.VxeUI;
|
|
20
|
-
_core.VxeUI.ganttVersion = "4.0.
|
|
20
|
+
_core.VxeUI.ganttVersion = "4.0.5";
|
|
21
21
|
setConfig({
|
|
22
22
|
gantt: {
|
|
23
23
|
// size: null,
|
|
@@ -56,6 +56,11 @@ setConfig({
|
|
|
56
56
|
// beforeSave: null,
|
|
57
57
|
// afterSave: null
|
|
58
58
|
},
|
|
59
|
+
taskViewScaleConfs: {
|
|
60
|
+
week: {
|
|
61
|
+
startDay: 1
|
|
62
|
+
}
|
|
63
|
+
},
|
|
59
64
|
taskSplitConfig: {
|
|
60
65
|
enabled: true,
|
|
61
66
|
resize: true,
|
package/lib/ui/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),_log=require("./src/log");let{setConfig,setIcon,checkVersion}=_core.VxeUI,iconPrefix=(_core.VxeUI.ganttVersion="4.0.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),_log=require("./src/log");let{setConfig,setIcon,checkVersion}=_core.VxeUI,iconPrefix=(_core.VxeUI.ganttVersion="4.0.5",setConfig({gantt:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:null,result:"result",total:"page.total",message:"message"}},taskViewScaleConfs:{week:{startDay:1}},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),pVersion=(setIcon({GANTT_VIEW_LEFT_OPEN:iconPrefix+"arrow-left",GANTT_VIEW_LEFT_CLOSE:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_OPEN:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_CLOSE:iconPrefix+"arrow-left"}),4),sVersion=16;checkVersion?checkVersion(_core.VxeUI.tableVersion,pVersion,sVersion)||(0,_log.errLog)("vxe.error.errorVersion",["vxe-table@"+(_core.VxeUI.tableVersion||"?"),`vxe-table v${pVersion}.${sVersion}+`]):(0,_log.errLog)(`Requires vxe-table v${pVersion}.${sVersion}+`);var _default=exports.default=_core.VxeUI;
|
package/lib/ui/src/log.js
CHANGED
|
@@ -8,6 +8,6 @@ var _core = require("@vxe-ui/core");
|
|
|
8
8
|
const {
|
|
9
9
|
log
|
|
10
10
|
} = _core.VxeUI;
|
|
11
|
-
const version = `gantt v${"4.0.
|
|
11
|
+
const version = `gantt v${"4.0.5"}`;
|
|
12
12
|
const warnLog = exports.warnLog = log.create('warn', version);
|
|
13
13
|
const errLog = exports.errLog = log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="gantt v4.0.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="gantt v4.0.5",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-gantt",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "A vue based gantt component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"typescript": "~4.9.5",
|
|
64
64
|
"vue": "3.4.27",
|
|
65
65
|
"vue-router": "~4.5.1",
|
|
66
|
-
"vxe-pc-ui": "^4.8.
|
|
67
|
-
"vxe-table": "^4.16.0-beta.
|
|
66
|
+
"vxe-pc-ui": "^4.8.23",
|
|
67
|
+
"vxe-table": "^4.16.0-beta.8"
|
|
68
68
|
},
|
|
69
69
|
"vetur": {
|
|
70
70
|
"tags": "helper/vetur/tags.json",
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { h, inject, ref, Ref, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
4
|
|
|
4
|
-
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods } from '../../../types'
|
|
5
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttDefines } from '../../../types'
|
|
6
|
+
|
|
7
|
+
const { getI18n } = VxeUI
|
|
5
8
|
|
|
6
9
|
export default defineVxeComponent({
|
|
7
10
|
name: 'VxeGanttViewHeader',
|
|
@@ -42,16 +45,29 @@ export default defineVxeComponent({
|
|
|
42
45
|
}
|
|
43
46
|
})
|
|
44
47
|
})),
|
|
45
|
-
h('thead', {}, headerGroups.map((
|
|
48
|
+
h('thead', {}, headerGroups.map(({ scaleItem, columns }, $rowIndex) => {
|
|
49
|
+
const { type, titleMethod } = scaleItem
|
|
46
50
|
return h('tr', {
|
|
47
|
-
key:
|
|
48
|
-
},
|
|
51
|
+
key: $rowIndex
|
|
52
|
+
}, columns.map((column, cIndex) => {
|
|
53
|
+
const dateObj: VxeGanttDefines.ScaleDateObj = column.params
|
|
54
|
+
let label = `${column.title}`
|
|
55
|
+
if ($rowIndex < headerGroups.length - 1) {
|
|
56
|
+
if (scaleItem.type === 'day') {
|
|
57
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
|
|
58
|
+
} else {
|
|
59
|
+
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (titleMethod) {
|
|
63
|
+
label = `${titleMethod({ scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex })}`
|
|
64
|
+
}
|
|
49
65
|
return h('th', {
|
|
50
66
|
key: cIndex,
|
|
51
67
|
class: 'vxe-gantt-view--header-column',
|
|
52
|
-
colspan: column.
|
|
53
|
-
title:
|
|
54
|
-
},
|
|
68
|
+
colspan: column.childCount || null,
|
|
69
|
+
title: label
|
|
70
|
+
}, label)
|
|
55
71
|
}))
|
|
56
72
|
}))
|
|
57
73
|
])
|
|
@@ -8,7 +8,7 @@ import GanttViewHeaderComponent from './gantt-header'
|
|
|
8
8
|
import GanttViewBodyComponent from './gantt-body'
|
|
9
9
|
import GanttViewFooterComponent from './gantt-footer'
|
|
10
10
|
|
|
11
|
-
import type { VxeGanttViewConstructor, GanttViewReactData, GanttViewPrivateRef,
|
|
11
|
+
import type { VxeGanttViewConstructor, GanttViewReactData, GanttViewPrivateRef, VxeGanttDefines, VxeGanttViewPrivateMethods, GanttViewInternalData, VxeGanttViewMethods, GanttViewPrivateComputed, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
12
12
|
|
|
13
13
|
const { globalEvents } = VxeUI
|
|
14
14
|
|
|
@@ -41,6 +41,7 @@ function createInternalData (): GanttViewInternalData {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
|
|
44
45
|
const maxYHeight = 5e6
|
|
45
46
|
// const maxXWidth = 5e6
|
|
46
47
|
|
|
@@ -51,7 +52,7 @@ export default defineVxeComponent({
|
|
|
51
52
|
|
|
52
53
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
53
54
|
|
|
54
|
-
const { computeTaskOpts,
|
|
55
|
+
const { computeTaskOpts, computeStartField, computeEndField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft } = $xeGantt.getComputeMaps()
|
|
55
56
|
|
|
56
57
|
const refElem = ref<HTMLDivElement>()
|
|
57
58
|
|
|
@@ -100,15 +101,7 @@ export default defineVxeComponent({
|
|
|
100
101
|
tableColumn: [],
|
|
101
102
|
headerGroups: [],
|
|
102
103
|
|
|
103
|
-
viewCellWidth:
|
|
104
|
-
|
|
105
|
-
rowHeightStore: {
|
|
106
|
-
large: 52,
|
|
107
|
-
default: 48,
|
|
108
|
-
medium: 44,
|
|
109
|
-
small: 40,
|
|
110
|
-
mini: 36
|
|
111
|
-
}
|
|
104
|
+
viewCellWidth: 20
|
|
112
105
|
})
|
|
113
106
|
|
|
114
107
|
const internalData = createInternalData()
|
|
@@ -139,93 +132,251 @@ export default defineVxeComponent({
|
|
|
139
132
|
|
|
140
133
|
const handleParseColumn = () => {
|
|
141
134
|
const ganttProps = $xeGantt.props
|
|
135
|
+
const ganttReactData = $xeGantt.reactData
|
|
142
136
|
const { treeConfig } = ganttProps
|
|
137
|
+
const { taskScaleList } = ganttReactData
|
|
143
138
|
const { minViewDate, maxViewDate } = reactData
|
|
144
|
-
const
|
|
145
|
-
const fullCols:
|
|
146
|
-
const groupCols:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
} else {
|
|
177
|
-
groupCol = {
|
|
178
|
-
field: yyyyy,
|
|
179
|
-
title: yyyyy,
|
|
180
|
-
children: [column]
|
|
181
|
-
}
|
|
182
|
-
groupList.push(groupCol)
|
|
183
|
-
fullCols.push(groupCol)
|
|
184
|
-
groupMaps[yyyyy] = groupCol
|
|
185
|
-
}
|
|
186
|
-
colList.push(column)
|
|
139
|
+
const minScale = XEUtils.last(taskScaleList)
|
|
140
|
+
const fullCols: VxeGanttDefines.ViewColumn[] = []
|
|
141
|
+
const groupCols: VxeGanttDefines.HeaderColumn[] = []
|
|
142
|
+
if (minScale && minViewDate && maxViewDate) {
|
|
143
|
+
const minSType = minScale.type
|
|
144
|
+
const weekScale = taskScaleList.find(item => item.type === 'week')
|
|
145
|
+
let gapTime = 1000 * 60 * 60 * 24
|
|
146
|
+
switch (minScale.type) {
|
|
147
|
+
case 'hour':
|
|
148
|
+
gapTime = 1000 * 60 * 60
|
|
149
|
+
break
|
|
150
|
+
case 'minute':
|
|
151
|
+
gapTime = 1000 * 60
|
|
152
|
+
break
|
|
153
|
+
case 'second':
|
|
154
|
+
gapTime = 1000
|
|
155
|
+
break
|
|
156
|
+
default: {
|
|
157
|
+
break
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const currTime = minViewDate.getTime()
|
|
161
|
+
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime()
|
|
162
|
+
const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1)
|
|
163
|
+
|
|
164
|
+
switch (minScale.type) {
|
|
165
|
+
case 'day':
|
|
166
|
+
case 'date':
|
|
167
|
+
if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
|
|
168
|
+
reactData.tableColumn = []
|
|
169
|
+
reactData.headerGroups = []
|
|
170
|
+
return
|
|
187
171
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
172
|
+
break
|
|
173
|
+
case 'hour':
|
|
174
|
+
if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
|
|
175
|
+
reactData.tableColumn = []
|
|
176
|
+
reactData.headerGroups = []
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
break
|
|
180
|
+
case 'minute':
|
|
181
|
+
if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
|
|
182
|
+
reactData.tableColumn = []
|
|
183
|
+
reactData.headerGroups = []
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
break
|
|
187
|
+
case 'second':
|
|
188
|
+
if (diffDayNum > (1000 * 60 * 60 * 3)) {
|
|
189
|
+
reactData.tableColumn = []
|
|
190
|
+
reactData.headerGroups = []
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
break
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const renderListMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn[]> = {
|
|
197
|
+
year: [],
|
|
198
|
+
quarter: [],
|
|
199
|
+
month: [],
|
|
200
|
+
week: [],
|
|
201
|
+
day: [],
|
|
202
|
+
date: [],
|
|
203
|
+
hour: [],
|
|
204
|
+
minute: [],
|
|
205
|
+
second: []
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const tempTypeMaps: Record<VxeGanttDefines.ColumnScaleType, Record<string, VxeGanttDefines.ViewColumn>> = {
|
|
209
|
+
year: {},
|
|
210
|
+
quarter: {},
|
|
211
|
+
month: {},
|
|
212
|
+
week: {},
|
|
213
|
+
day: {},
|
|
214
|
+
date: {},
|
|
215
|
+
hour: {},
|
|
216
|
+
minute: {},
|
|
217
|
+
second: {}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const handleData = (type: VxeGanttDefines.ColumnScaleType, colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn>, minCol: VxeGanttDefines.ViewColumn) => {
|
|
221
|
+
if (minSType === type) {
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
const currCol = colMaps[type]
|
|
225
|
+
const currKey = `${currCol.field}`
|
|
226
|
+
let currGpCol = tempTypeMaps[type][currKey]
|
|
227
|
+
if (!currGpCol) {
|
|
228
|
+
currGpCol = currCol
|
|
229
|
+
tempTypeMaps[type][currKey] = currGpCol
|
|
230
|
+
renderListMaps[type].push(currGpCol)
|
|
231
|
+
}
|
|
232
|
+
if (currGpCol) {
|
|
233
|
+
if (!currGpCol.children) {
|
|
234
|
+
currGpCol.children = []
|
|
235
|
+
}
|
|
236
|
+
currGpCol.children.push(minCol)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
for (let i = 0; i < countSize; i++) {
|
|
240
|
+
const itemDate = new Date(currTime + (i * gapTime))
|
|
241
|
+
const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
|
|
242
|
+
const e = itemDate.getDay()
|
|
243
|
+
const E = e + 1
|
|
244
|
+
const q = Math.ceil((itemDate.getMonth() + 1) / 3)
|
|
245
|
+
const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)
|
|
246
|
+
const dateObj: VxeGanttDefines.ScaleDateObj = { yy: yyyy, M: MM, d: dd, H: HH, m: mm, s: ss, q, W, E, e }
|
|
247
|
+
const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
|
|
248
|
+
year: {
|
|
249
|
+
field: yyyy,
|
|
250
|
+
title: yyyy,
|
|
251
|
+
params: dateObj
|
|
252
|
+
},
|
|
253
|
+
quarter: {
|
|
254
|
+
field: `${yyyy}_q${q}`,
|
|
255
|
+
title: q,
|
|
256
|
+
params: dateObj
|
|
257
|
+
},
|
|
258
|
+
month: {
|
|
259
|
+
field: `${yyyy}_${MM}`,
|
|
260
|
+
title: MM,
|
|
261
|
+
params: dateObj
|
|
262
|
+
},
|
|
263
|
+
week: {
|
|
264
|
+
field: `${yyyy}_W${W}`,
|
|
265
|
+
title: W,
|
|
266
|
+
params: dateObj
|
|
267
|
+
},
|
|
268
|
+
day: {
|
|
269
|
+
field: `${yyyy}_${MM}_${dd}_E${E}`,
|
|
270
|
+
title: E,
|
|
271
|
+
params: dateObj
|
|
272
|
+
},
|
|
273
|
+
date: {
|
|
274
|
+
field: `${yyyy}_${MM}_${dd}`,
|
|
275
|
+
title: dd,
|
|
276
|
+
params: dateObj
|
|
277
|
+
},
|
|
278
|
+
hour: {
|
|
279
|
+
field: `${yyyy}_${MM}_${dd}_${HH}`,
|
|
280
|
+
title: HH,
|
|
281
|
+
params: dateObj
|
|
282
|
+
},
|
|
283
|
+
minute: {
|
|
284
|
+
field: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
|
|
285
|
+
title: mm,
|
|
286
|
+
params: dateObj
|
|
287
|
+
},
|
|
288
|
+
second: {
|
|
289
|
+
field: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`,
|
|
290
|
+
title: ss,
|
|
291
|
+
params: dateObj
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const minCol = colMaps[minSType]
|
|
295
|
+
if (minScale.level < 19) {
|
|
296
|
+
handleData('year', colMaps, minCol)
|
|
297
|
+
}
|
|
298
|
+
if (minScale.level < 17) {
|
|
299
|
+
handleData('quarter', colMaps, minCol)
|
|
300
|
+
}
|
|
301
|
+
if (minScale.level < 14) {
|
|
302
|
+
handleData('month', colMaps, minCol)
|
|
303
|
+
}
|
|
304
|
+
if (minScale.level < 13) {
|
|
305
|
+
handleData('week', colMaps, minCol)
|
|
306
|
+
}
|
|
307
|
+
if (minScale.level < 11) {
|
|
308
|
+
handleData('day', colMaps, minCol)
|
|
309
|
+
}
|
|
310
|
+
if (minScale.level < 12) {
|
|
311
|
+
handleData('date', colMaps, minCol)
|
|
312
|
+
}
|
|
313
|
+
if (minScale.level < 7) {
|
|
314
|
+
handleData('hour', colMaps, minCol)
|
|
315
|
+
}
|
|
316
|
+
if (minScale.level < 5) {
|
|
317
|
+
handleData('minute', colMaps, minCol)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
fullCols.push(minCol)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
taskScaleList.forEach(scaleItem => {
|
|
324
|
+
if (scaleItem.type === minSType) {
|
|
325
|
+
groupCols.push({
|
|
326
|
+
scaleItem,
|
|
327
|
+
columns: fullCols
|
|
328
|
+
})
|
|
329
|
+
return
|
|
330
|
+
}
|
|
331
|
+
const list = renderListMaps[scaleItem.type] || []
|
|
332
|
+
if (list) {
|
|
333
|
+
list.forEach(item => {
|
|
334
|
+
item.childCount = item.children ? item.children.length : 0
|
|
335
|
+
item.children = undefined
|
|
336
|
+
})
|
|
337
|
+
}
|
|
338
|
+
groupCols.push({
|
|
339
|
+
scaleItem,
|
|
340
|
+
columns: list
|
|
341
|
+
})
|
|
342
|
+
})
|
|
219
343
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
344
|
+
const $xeTable = internalData.xeTable
|
|
345
|
+
if ($xeTable) {
|
|
346
|
+
const startField = computeStartField.value
|
|
347
|
+
const endField = computeEndField.value
|
|
348
|
+
const { computeTreeOpts } = $xeTable.getComputeMaps()
|
|
349
|
+
const tableInternalData = $xeTable.internalData
|
|
350
|
+
const { afterFullData, afterTreeFullData } = tableInternalData
|
|
351
|
+
const treeOpts = computeTreeOpts.value
|
|
352
|
+
const { transform } = treeOpts
|
|
353
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
354
|
+
|
|
355
|
+
const ctMaps: Record<string, VxeGanttDefines.RowCacheItem> = {}
|
|
356
|
+
const handleParseRender = (row: any) => {
|
|
357
|
+
const rowid = $xeTable.getRowid(row)
|
|
358
|
+
const startValue = XEUtils.get(row, startField)
|
|
359
|
+
const endValue = XEUtils.get(row, endField)
|
|
360
|
+
if (startValue && endValue) {
|
|
361
|
+
const startDate = parseStringDate(startValue)
|
|
362
|
+
const endDate = parseStringDate(endValue)
|
|
363
|
+
const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / gapTime)
|
|
364
|
+
const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / gapTime) + 1
|
|
365
|
+
ctMaps[rowid] = {
|
|
366
|
+
row,
|
|
367
|
+
rowid,
|
|
368
|
+
oLeftSize,
|
|
369
|
+
oWidthSize
|
|
224
370
|
}
|
|
225
|
-
internalData.chartMaps = ctMaps
|
|
226
371
|
}
|
|
227
372
|
}
|
|
228
|
-
|
|
373
|
+
|
|
374
|
+
if (treeConfig) {
|
|
375
|
+
XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
376
|
+
} else {
|
|
377
|
+
afterFullData.forEach(handleParseRender)
|
|
378
|
+
}
|
|
379
|
+
internalData.chartMaps = ctMaps
|
|
229
380
|
}
|
|
230
381
|
}
|
|
231
382
|
reactData.tableColumn = fullCols
|
|
@@ -826,11 +977,10 @@ export default defineVxeComponent({
|
|
|
826
977
|
|
|
827
978
|
const renderVN = () => {
|
|
828
979
|
const { overflowX, overflowY, scrollXLoad, scrollYLoad } = reactData
|
|
829
|
-
const taskViewOpts = computeTaskViewOpts.value
|
|
830
980
|
const scrollbarXToTop = computeScrollbarXToTop.value
|
|
831
981
|
return h('div', {
|
|
832
982
|
ref: refElem,
|
|
833
|
-
class: ['vxe-gantt-view',
|
|
983
|
+
class: ['vxe-gantt-view', {
|
|
834
984
|
'is--scroll-y': overflowY,
|
|
835
985
|
'is--scroll-x': overflowX,
|
|
836
986
|
'is--virtual-x': scrollXLoad,
|
|
@@ -30,6 +30,22 @@ function createInternalData (): GanttInternalData {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
const viewTypeLevelMaps = {
|
|
34
|
+
year: 19,
|
|
35
|
+
quarter: 17,
|
|
36
|
+
month: 15,
|
|
37
|
+
week: 13,
|
|
38
|
+
day: 11,
|
|
39
|
+
date: 9,
|
|
40
|
+
hour: 7,
|
|
41
|
+
minute: 5,
|
|
42
|
+
second: 3
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getViewTypeLevel (type: VxeGanttDefines.ColumnScaleType) {
|
|
46
|
+
return viewTypeLevelMaps[type || 'date'] || viewTypeLevelMaps.date
|
|
47
|
+
}
|
|
48
|
+
|
|
33
49
|
export default defineVxeComponent({
|
|
34
50
|
name: 'VxeGantt',
|
|
35
51
|
props: {
|
|
@@ -62,6 +78,7 @@ export default defineVxeComponent({
|
|
|
62
78
|
|
|
63
79
|
layouts: Array as PropType<VxeGanttPropTypes.Layouts>,
|
|
64
80
|
taskConfig: Object as PropType<VxeGanttPropTypes.TaskConfig>,
|
|
81
|
+
taskViewScaleConfs: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfs>,
|
|
65
82
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
66
83
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
67
84
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
@@ -99,7 +116,8 @@ export default defineVxeComponent({
|
|
|
99
116
|
currentPage: 1
|
|
100
117
|
},
|
|
101
118
|
showLeftView: true,
|
|
102
|
-
showRightView: true
|
|
119
|
+
showRightView: true,
|
|
120
|
+
taskScaleList: []
|
|
103
121
|
})
|
|
104
122
|
|
|
105
123
|
const internalData = createInternalData()
|
|
@@ -181,6 +199,10 @@ export default defineVxeComponent({
|
|
|
181
199
|
return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig)
|
|
182
200
|
})
|
|
183
201
|
|
|
202
|
+
const computeTaskViewScaleMapsOpts = computed(() => {
|
|
203
|
+
return XEUtils.merge({}, getConfig().gantt.taskViewScaleConfs, props.taskViewScaleConfs)
|
|
204
|
+
})
|
|
205
|
+
|
|
184
206
|
const computeTaskViewOpts = computed(() => {
|
|
185
207
|
return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig)
|
|
186
208
|
})
|
|
@@ -193,6 +215,12 @@ export default defineVxeComponent({
|
|
|
193
215
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
194
216
|
})
|
|
195
217
|
|
|
218
|
+
const computeTaskScaleConfs = computed(() => {
|
|
219
|
+
const taskViewOpts = computeTaskViewOpts.value
|
|
220
|
+
const { scales } = taskViewOpts
|
|
221
|
+
return scales
|
|
222
|
+
})
|
|
223
|
+
|
|
196
224
|
const computeTitleField = computed(() => {
|
|
197
225
|
const taskOpts = computeTaskOpts.value
|
|
198
226
|
return taskOpts.titleField || 'title'
|
|
@@ -401,9 +429,11 @@ export default defineVxeComponent({
|
|
|
401
429
|
computeToolbarOpts,
|
|
402
430
|
computeZoomOpts,
|
|
403
431
|
computeTaskOpts,
|
|
432
|
+
computeTaskViewScaleMapsOpts,
|
|
404
433
|
computeTaskViewOpts,
|
|
405
434
|
computeTaskBarOpts,
|
|
406
435
|
computeTaskSplitOpts,
|
|
436
|
+
computeTaskScaleConfs,
|
|
407
437
|
computeTitleField,
|
|
408
438
|
computeStartField,
|
|
409
439
|
computeEndField,
|
|
@@ -423,6 +453,38 @@ export default defineVxeComponent({
|
|
|
423
453
|
getComputeMaps: () => computeMaps
|
|
424
454
|
} as VxeGanttConstructor & VxeGanttPrivateMethods
|
|
425
455
|
|
|
456
|
+
const handleTaskScaleConfig = () => {
|
|
457
|
+
const taskScaleConfs = computeTaskScaleConfs.value
|
|
458
|
+
const taskViewScaleMapsOpts = computeTaskViewScaleMapsOpts.value
|
|
459
|
+
const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
|
|
460
|
+
if (taskScaleConfs) {
|
|
461
|
+
const keyMaps: Record<string, boolean> = {}
|
|
462
|
+
taskScaleConfs.forEach(conf => {
|
|
463
|
+
const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
|
|
464
|
+
const { type } = sConf
|
|
465
|
+
if (!type || !viewTypeLevelMaps[type]) {
|
|
466
|
+
errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
|
|
467
|
+
return
|
|
468
|
+
}
|
|
469
|
+
if (keyMaps[type]) {
|
|
470
|
+
errLog('vxe.error.repeatProp', ['type', type])
|
|
471
|
+
return
|
|
472
|
+
}
|
|
473
|
+
keyMaps[type] = true
|
|
474
|
+
scaleConfs.push(Object.assign({}, type ? taskViewScaleMapsOpts[type] || {} : {}, sConf, {
|
|
475
|
+
level: getViewTypeLevel(type)
|
|
476
|
+
}))
|
|
477
|
+
})
|
|
478
|
+
}
|
|
479
|
+
if (!scaleConfs.length) {
|
|
480
|
+
scaleConfs.push(
|
|
481
|
+
{ type: 'month', level: viewTypeLevelMaps.month },
|
|
482
|
+
{ type: 'date', level: viewTypeLevelMaps.date }
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' })
|
|
486
|
+
}
|
|
487
|
+
|
|
426
488
|
const initToolbar = () => {
|
|
427
489
|
const toolbarOpts = computeToolbarOpts.value
|
|
428
490
|
if (props.toolbarConfig && isEnableConf(toolbarOpts)) {
|
|
@@ -1978,6 +2040,10 @@ export default defineVxeComponent({
|
|
|
1978
2040
|
initProxy()
|
|
1979
2041
|
})
|
|
1980
2042
|
|
|
2043
|
+
watch(computeTaskScaleConfs, () => {
|
|
2044
|
+
handleTaskScaleConfig()
|
|
2045
|
+
})
|
|
2046
|
+
|
|
1981
2047
|
hooks.forEach((options) => {
|
|
1982
2048
|
const { setupGantt } = options
|
|
1983
2049
|
if (setupGantt) {
|
|
@@ -1988,6 +2054,7 @@ export default defineVxeComponent({
|
|
|
1988
2054
|
}
|
|
1989
2055
|
})
|
|
1990
2056
|
|
|
2057
|
+
handleTaskScaleConfig()
|
|
1991
2058
|
initPages()
|
|
1992
2059
|
|
|
1993
2060
|
onMounted(() => {
|
|
@@ -10,6 +10,13 @@ export function getRefElem (refEl: any) {
|
|
|
10
10
|
return null
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export function getCalcHeight (height: number | 'unset' | undefined | null) {
|
|
14
|
+
if (height === 'unset') {
|
|
15
|
+
return 0
|
|
16
|
+
}
|
|
17
|
+
return height || 0
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
export function getCellRestHeight (rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
14
21
|
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
15
22
|
}
|
package/packages/ui/index.ts
CHANGED
package/styles/theme/base.scss
CHANGED