vxe-gantt 4.1.1 → 4.1.3
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-body.js +25 -3
- package/es/gantt/src/gantt-chart.js +14 -4
- package/es/gantt/src/gantt.js +23 -23
- package/es/ui/index.js +29 -2
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt-body.js +8 -1
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +10 -5
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt.js +27 -33
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +75 -42
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +29 -2
- 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 +2 -2
- package/packages/gantt/src/gantt-body.ts +25 -3
- package/packages/gantt/src/gantt-chart.ts +14 -4
- package/packages/gantt/src/gantt.ts +23 -26
- package/packages/ui/index.ts +29 -1
|
@@ -17,7 +17,7 @@ export default defineVxeComponent({
|
|
|
17
17
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
18
18
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
19
19
|
|
|
20
|
-
const { computeTaskViewOpts } = $xeGantt.getComputeMaps()
|
|
20
|
+
const { computeTaskViewOpts, computeScaleUnit } = $xeGantt.getComputeMaps()
|
|
21
21
|
const { reactData, internalData } = $xeGanttView
|
|
22
22
|
|
|
23
23
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
@@ -42,6 +42,7 @@ export default defineVxeComponent({
|
|
|
42
42
|
const { todayDateMaps } = internalData
|
|
43
43
|
const taskViewOpts = computeTaskViewOpts.value
|
|
44
44
|
const { showNowLine, viewStyle } = taskViewOpts
|
|
45
|
+
const scaleUnit = computeScaleUnit.value
|
|
45
46
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {}
|
|
46
47
|
const { field, dateObj } = column
|
|
47
48
|
const { cellClassName, cellStyle } = viewStyle || {}
|
|
@@ -88,7 +89,18 @@ export default defineVxeComponent({
|
|
|
88
89
|
})
|
|
89
90
|
)
|
|
90
91
|
}
|
|
91
|
-
const ctParams = {
|
|
92
|
+
const ctParams = {
|
|
93
|
+
$gantt: $xeGantt,
|
|
94
|
+
source: sourceType,
|
|
95
|
+
type: viewType,
|
|
96
|
+
scaleType: scaleUnit,
|
|
97
|
+
dateObj,
|
|
98
|
+
row,
|
|
99
|
+
column,
|
|
100
|
+
$rowIndex,
|
|
101
|
+
rowIndex,
|
|
102
|
+
_rowIndex
|
|
103
|
+
}
|
|
92
104
|
return h('td', {
|
|
93
105
|
key: $columnIndex,
|
|
94
106
|
class: [
|
|
@@ -133,6 +145,7 @@ export default defineVxeComponent({
|
|
|
133
145
|
const { transform } = treeOpts
|
|
134
146
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
135
147
|
|
|
148
|
+
const scaleUnit = computeScaleUnit.value
|
|
136
149
|
const taskViewOpts = computeTaskViewOpts.value
|
|
137
150
|
const { viewStyle } = taskViewOpts
|
|
138
151
|
const { rowClassName, rowStyle } = viewStyle || {}
|
|
@@ -170,7 +183,16 @@ export default defineVxeComponent({
|
|
|
170
183
|
trOns.onDragend = $xeTable.handleRowDragDragendEvent
|
|
171
184
|
trOns.onDragover = $xeTable.handleRowDragDragoverEvent
|
|
172
185
|
}
|
|
173
|
-
const rowParams = {
|
|
186
|
+
const rowParams = {
|
|
187
|
+
$gantt: $xeGantt,
|
|
188
|
+
source: sourceType,
|
|
189
|
+
type: viewType,
|
|
190
|
+
scaleType: scaleUnit,
|
|
191
|
+
row,
|
|
192
|
+
rowIndex,
|
|
193
|
+
$rowIndex,
|
|
194
|
+
_rowIndex
|
|
195
|
+
}
|
|
174
196
|
trVNs.push(
|
|
175
197
|
h('tr', {
|
|
176
198
|
key: treeConfig ? rowid : $rowIndex,
|
|
@@ -21,7 +21,7 @@ export default defineVxeComponent({
|
|
|
21
21
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
22
22
|
|
|
23
23
|
const { reactData, internalData } = $xeGanttView
|
|
24
|
-
const { computeProgressField, computeTitleField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
|
|
24
|
+
const { computeProgressField, computeTitleField, computeTaskBarOpts, computeScaleUnit } = $xeGantt.getComputeMaps()
|
|
25
25
|
|
|
26
26
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
27
27
|
|
|
@@ -43,7 +43,8 @@ export default defineVxeComponent({
|
|
|
43
43
|
const titleField = computeTitleField.value
|
|
44
44
|
const progressField = computeProgressField.value
|
|
45
45
|
const taskBarOpts = computeTaskBarOpts.value
|
|
46
|
-
const
|
|
46
|
+
const scaleUnit = computeScaleUnit.value
|
|
47
|
+
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit }
|
|
47
48
|
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts
|
|
48
49
|
const isBarRowStyle = XEUtils.isFunction(barStyle)
|
|
49
50
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {}
|
|
@@ -72,10 +73,19 @@ export default defineVxeComponent({
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
if (contentMethod) {
|
|
75
|
-
title = getStringValue(contentMethod({ row, title }))
|
|
76
|
+
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }))
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
const ctParams = {
|
|
79
|
+
const ctParams = {
|
|
80
|
+
$gantt: $xeGantt,
|
|
81
|
+
source: sourceType,
|
|
82
|
+
type: viewType,
|
|
83
|
+
scaleType: scaleUnit,
|
|
84
|
+
row,
|
|
85
|
+
$rowIndex,
|
|
86
|
+
rowIndex,
|
|
87
|
+
_rowIndex
|
|
88
|
+
}
|
|
79
89
|
const ons: {
|
|
80
90
|
onClick: any
|
|
81
91
|
onDblclick: any
|
|
@@ -475,6 +475,7 @@ export default defineVxeComponent({
|
|
|
475
475
|
refForm,
|
|
476
476
|
refToolbar,
|
|
477
477
|
refPager,
|
|
478
|
+
refGanttView,
|
|
478
479
|
refGanttContainerElem,
|
|
479
480
|
refClassifyWrapperElem,
|
|
480
481
|
refPopupContainerElem
|
|
@@ -527,31 +528,24 @@ export default defineVxeComponent({
|
|
|
527
528
|
const taskScaleConfs = computeTaskViewScales.value
|
|
528
529
|
const taskViewScaleOpts = computeTaskViewScaleOpts.value
|
|
529
530
|
const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
549
|
-
if (!scaleConfs.length) {
|
|
550
|
-
scaleConfs.push(
|
|
551
|
-
{ type: 'month', level: viewTypeLevelMaps.month },
|
|
552
|
-
{ type: 'date', level: viewTypeLevelMaps.date }
|
|
553
|
-
)
|
|
554
|
-
}
|
|
531
|
+
const keyMaps: Record<string, boolean> = {}
|
|
532
|
+
const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date'] as VxeGanttDefines.ColumnScaleType[])
|
|
533
|
+
scaleList.forEach(conf => {
|
|
534
|
+
const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
|
|
535
|
+
const { type } = sConf
|
|
536
|
+
if (!type || !viewTypeLevelMaps[type]) {
|
|
537
|
+
errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
|
|
538
|
+
return
|
|
539
|
+
}
|
|
540
|
+
if (keyMaps[type]) {
|
|
541
|
+
errLog('vxe.error.repeatProp', ['type', type])
|
|
542
|
+
return
|
|
543
|
+
}
|
|
544
|
+
keyMaps[type] = true
|
|
545
|
+
scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
|
|
546
|
+
level: getViewTypeLevel(type)
|
|
547
|
+
}))
|
|
548
|
+
})
|
|
555
549
|
reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' })
|
|
556
550
|
}
|
|
557
551
|
|
|
@@ -1762,7 +1756,10 @@ export default defineVxeComponent({
|
|
|
1762
1756
|
const { row } = params
|
|
1763
1757
|
let content = formatText(XEUtils.get(row, titleField))
|
|
1764
1758
|
if (contentMethod) {
|
|
1765
|
-
|
|
1759
|
+
const customContnet = contentMethod(params)
|
|
1760
|
+
if (!XEUtils.eqNull(customContnet)) {
|
|
1761
|
+
content = `${customContnet}`
|
|
1762
|
+
}
|
|
1766
1763
|
}
|
|
1767
1764
|
handleTargetEnterEvent(barTipStore.row !== row)
|
|
1768
1765
|
const tipContent = formatText(content)
|
package/packages/ui/index.ts
CHANGED
|
@@ -5,6 +5,9 @@ const { setConfig, setIcon, checkVersion } = VxeUI
|
|
|
5
5
|
|
|
6
6
|
VxeUI.ganttVersion = process.env.VUE_APP_VXE_VERSION as string
|
|
7
7
|
|
|
8
|
+
const ymdFormat = 'yyyy-MM-dd'
|
|
9
|
+
const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss'
|
|
10
|
+
|
|
8
11
|
setConfig({
|
|
9
12
|
gantt: {
|
|
10
13
|
// size: null,
|
|
@@ -47,8 +50,33 @@ setConfig({
|
|
|
47
50
|
enterable: true
|
|
48
51
|
},
|
|
49
52
|
taskViewScaleConfig: {
|
|
53
|
+
year: {
|
|
54
|
+
valueFormat: ymdFormat
|
|
55
|
+
},
|
|
56
|
+
quarter: {
|
|
57
|
+
valueFormat: ymdFormat
|
|
58
|
+
},
|
|
59
|
+
month: {
|
|
60
|
+
valueFormat: ymdFormat
|
|
61
|
+
},
|
|
50
62
|
week: {
|
|
51
|
-
startDay: 1
|
|
63
|
+
startDay: 1,
|
|
64
|
+
valueFormat: ymdFormat
|
|
65
|
+
},
|
|
66
|
+
day: {
|
|
67
|
+
valueFormat: ymdFormat
|
|
68
|
+
},
|
|
69
|
+
date: {
|
|
70
|
+
valueFormat: ymdFormat
|
|
71
|
+
},
|
|
72
|
+
hour: {
|
|
73
|
+
valueFormat: ymdhmsFormat
|
|
74
|
+
},
|
|
75
|
+
minute: {
|
|
76
|
+
valueFormat: ymdhmsFormat
|
|
77
|
+
},
|
|
78
|
+
second: {
|
|
79
|
+
valueFormat: ymdhmsFormat
|
|
52
80
|
}
|
|
53
81
|
},
|
|
54
82
|
taskViewConfig: {
|