vxe-gantt 4.1.12 → 4.1.13
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 +66 -35
- package/es/gantt/src/gantt-view.js +19 -7
- package/es/gantt/src/gantt.js +10 -1
- package/es/gantt/src/static.js +10 -0
- package/es/gantt/src/util.js +9 -0
- package/es/gantt/style.css +46 -8
- 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 +3 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-gantt/style.css +46 -8
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/src/gantt-chart.js +63 -20
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +17 -4
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +10 -0
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/static.js +12 -2
- package/lib/gantt/src/static.min.js +1 -1
- package/lib/gantt/src/util.js +11 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +46 -8
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +118 -30
- 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 +3 -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/lib/vxe-gantt/style/style.css +46 -8
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-chart.ts +73 -36
- package/packages/gantt/src/gantt-view.ts +19 -7
- package/packages/gantt/src/gantt.ts +12 -0
- package/packages/gantt/src/static.ts +10 -0
- package/packages/gantt/src/util.ts +11 -0
- package/packages/ui/index.ts +2 -1
- package/styles/components/gantt-module/gantt-chart.scss +71 -18
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h, ref, reactive, nextTick, inject, watch, provide, computed, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
-
import { setScrollTop, setScrollLeft, removeClass, addClass } from '../../ui/src/dom'
|
|
3
|
+
import { setScrollTop, setScrollLeft, removeClass, addClass, hasClass } from '../../ui/src/dom'
|
|
4
4
|
import { VxeUI } from '@vxe-ui/core'
|
|
5
|
-
import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth } from './util'
|
|
5
|
+
import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth, hasMilestoneTask } from './util'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
import GanttViewHeaderComponent from './gantt-header'
|
|
8
8
|
import GanttViewBodyComponent from './gantt-body'
|
|
@@ -52,7 +52,7 @@ export default defineVxeComponent({
|
|
|
52
52
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
53
53
|
|
|
54
54
|
const { internalData: ganttInternalData } = $xeGantt
|
|
55
|
-
const { computeTaskOpts, computeTaskViewOpts, computeStartField, computeEndField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft, computeScaleUnit, computeWeekScale, computeMinScale } = $xeGantt.getComputeMaps()
|
|
55
|
+
const { computeTaskOpts, computeTaskViewOpts, computeStartField, computeEndField, computeTypeField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft, computeScaleUnit, computeWeekScale, computeMinScale } = $xeGantt.getComputeMaps()
|
|
56
56
|
|
|
57
57
|
const refElem = ref<HTMLDivElement>()
|
|
58
58
|
|
|
@@ -612,6 +612,7 @@ export default defineVxeComponent({
|
|
|
612
612
|
if ($xeTable) {
|
|
613
613
|
const startField = computeStartField.value
|
|
614
614
|
const endField = computeEndField.value
|
|
615
|
+
const typeField = computeTypeField.value
|
|
615
616
|
const { computeAggregateOpts, computeTreeOpts } = $xeTable.getComputeMaps()
|
|
616
617
|
const tableReactData = $xeTable.reactData
|
|
617
618
|
const { isRowGroupStatus } = tableReactData
|
|
@@ -626,8 +627,15 @@ export default defineVxeComponent({
|
|
|
626
627
|
const renderFn = createChartRender(fullCols)
|
|
627
628
|
const handleParseRender = (row: any) => {
|
|
628
629
|
const rowid = $xeTable.getRowid(row)
|
|
629
|
-
|
|
630
|
-
|
|
630
|
+
let startValue = XEUtils.get(row, startField)
|
|
631
|
+
let endValue = XEUtils.get(row, endField)
|
|
632
|
+
const isMilestone = hasMilestoneTask(XEUtils.get(row, typeField))
|
|
633
|
+
if (isMilestone) {
|
|
634
|
+
if (!startValue) {
|
|
635
|
+
startValue = endValue
|
|
636
|
+
}
|
|
637
|
+
endValue = startValue
|
|
638
|
+
}
|
|
631
639
|
if (startValue && endValue) {
|
|
632
640
|
const { offsetLeftSize, offsetWidthSize } = renderFn(startValue, endValue)
|
|
633
641
|
ctMaps[rowid] = {
|
|
@@ -686,11 +694,13 @@ export default defineVxeComponent({
|
|
|
686
694
|
const handleMinMaxData = (row: any) => {
|
|
687
695
|
const startValue = XEUtils.get(row, startField)
|
|
688
696
|
const endValue = XEUtils.get(row, endField)
|
|
689
|
-
if (startValue
|
|
697
|
+
if (startValue) {
|
|
690
698
|
const startDate = parseStringDate(startValue)
|
|
691
699
|
if (!minDate || minDate.getTime() > startDate.getTime()) {
|
|
692
700
|
minDate = startDate
|
|
693
701
|
}
|
|
702
|
+
}
|
|
703
|
+
if (endValue) {
|
|
694
704
|
const endDate = parseStringDate(endValue)
|
|
695
705
|
if (!maxDate || maxDate.getTime() < endDate.getTime()) {
|
|
696
706
|
maxDate = endDate
|
|
@@ -763,7 +773,9 @@ export default defineVxeComponent({
|
|
|
763
773
|
}
|
|
764
774
|
const chartRest = rowid ? chartMaps[rowid] : null
|
|
765
775
|
barEl.style.left = `${getTaskBarLeft(chartRest, viewCellWidth)}px`
|
|
766
|
-
|
|
776
|
+
if (!hasClass(barEl, 'is--milestone')) {
|
|
777
|
+
barEl.style.width = `${getTaskBarWidth(chartRest, viewCellWidth)}px`
|
|
778
|
+
}
|
|
767
779
|
})
|
|
768
780
|
}
|
|
769
781
|
return nextTick()
|
|
@@ -92,6 +92,7 @@ export default defineVxeComponent({
|
|
|
92
92
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
93
93
|
taskLinkConfig: Object as PropType<VxeGanttPropTypes.TaskLinkConfig>,
|
|
94
94
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
95
|
+
taskBarMilestoneConfig: Object as PropType<VxeGanttPropTypes.TaskBarMilestoneConfig>,
|
|
95
96
|
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
96
97
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
97
98
|
taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
|
|
@@ -254,6 +255,10 @@ export default defineVxeComponent({
|
|
|
254
255
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
255
256
|
})
|
|
256
257
|
|
|
258
|
+
const computeTaskBarMilestoneOpts = computed(() => {
|
|
259
|
+
return Object.assign({}, getConfig().gantt.taskBarMilestoneConfig, props.taskBarMilestoneConfig)
|
|
260
|
+
})
|
|
261
|
+
|
|
257
262
|
const computeTaskBarTooltipOpts = computed(() => {
|
|
258
263
|
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
259
264
|
})
|
|
@@ -298,6 +303,11 @@ export default defineVxeComponent({
|
|
|
298
303
|
return taskOpts.endField || 'end'
|
|
299
304
|
})
|
|
300
305
|
|
|
306
|
+
const computeTypeField = computed(() => {
|
|
307
|
+
const taskOpts = computeTaskOpts.value
|
|
308
|
+
return taskOpts.typeField || 'type'
|
|
309
|
+
})
|
|
310
|
+
|
|
301
311
|
const computeProgressField = computed(() => {
|
|
302
312
|
const taskOpts = computeTaskOpts.value
|
|
303
313
|
return taskOpts.progressField || 'progress'
|
|
@@ -509,6 +519,7 @@ export default defineVxeComponent({
|
|
|
509
519
|
computeTaskBarMoveOpts,
|
|
510
520
|
computeTaskBarResizeOpts,
|
|
511
521
|
computeTaskSplitOpts,
|
|
522
|
+
computeTaskBarMilestoneOpts,
|
|
512
523
|
computeTaskBarTooltipOpts,
|
|
513
524
|
computeTaskLinkOpts,
|
|
514
525
|
computeTaskViewScales,
|
|
@@ -518,6 +529,7 @@ export default defineVxeComponent({
|
|
|
518
529
|
computeTitleField,
|
|
519
530
|
computeStartField,
|
|
520
531
|
computeEndField,
|
|
532
|
+
computeTypeField,
|
|
521
533
|
computeProgressField,
|
|
522
534
|
computeScrollbarOpts,
|
|
523
535
|
computeScrollbarXToTop,
|
|
@@ -45,3 +45,14 @@ export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null,
|
|
|
45
45
|
export function getTaskLinkKey (from: string | number, to: string | number) {
|
|
46
46
|
return `${from}_${to}`
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
export function hasMilestoneTask (type: string) {
|
|
50
|
+
return type === 'milestone'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const taskTypeMaps: Record<string, number> = {
|
|
54
|
+
milestone: 1
|
|
55
|
+
}
|
|
56
|
+
export function gettaskType (type: string) {
|
|
57
|
+
return taskTypeMaps[type] ? type : 'default'
|
|
58
|
+
}
|
package/packages/ui/index.ts
CHANGED
|
@@ -105,7 +105,8 @@ setIcon({
|
|
|
105
105
|
GANTT_VIEW_LEFT_OPEN: iconPrefix + 'arrow-left',
|
|
106
106
|
GANTT_VIEW_LEFT_CLOSE: iconPrefix + 'arrow-right',
|
|
107
107
|
GANTT_VIEW_RIGHT_OPEN: iconPrefix + 'arrow-right',
|
|
108
|
-
GANTT_VIEW_RIGHT_CLOSE: iconPrefix + 'arrow-left'
|
|
108
|
+
GANTT_VIEW_RIGHT_CLOSE: iconPrefix + 'arrow-left',
|
|
109
|
+
GANTT_VIEW_TASK_MILESTONE: iconPrefix + 'square-fill rotate45'
|
|
109
110
|
})
|
|
110
111
|
|
|
111
112
|
export {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use "sass:list";
|
|
3
|
+
|
|
1
4
|
.vxe-gantt-view--chart-task-wrapper {
|
|
2
5
|
position: absolute;
|
|
3
6
|
top: 0;
|
|
@@ -20,12 +23,6 @@
|
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
|
-
&.is--move {
|
|
24
|
-
& > .vxe-gantt-view--chart-bar,
|
|
25
|
-
& > .vxe-gantt-view--chart-custom-bar {
|
|
26
|
-
user-select: none;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
26
|
}
|
|
30
27
|
.vxe-gantt-view--chart-bar,
|
|
31
28
|
.vxe-gantt-view--chart-custom-bar {
|
|
@@ -35,10 +32,12 @@
|
|
|
35
32
|
top: 50%;
|
|
36
33
|
left: 0;
|
|
37
34
|
transform: translateY(-50%);
|
|
38
|
-
color: #ffffff;
|
|
39
|
-
background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
|
|
40
35
|
overflow: hidden;
|
|
41
36
|
pointer-events: all;
|
|
37
|
+
&.is--default {
|
|
38
|
+
color: #ffffff;
|
|
39
|
+
background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
|
|
40
|
+
}
|
|
42
41
|
}
|
|
43
42
|
.vxe-gantt-view--chart-custom-bar-content {
|
|
44
43
|
width: 100%;
|
|
@@ -46,18 +45,23 @@
|
|
|
46
45
|
.vxe-gantt-view--chart-bar {
|
|
47
46
|
align-items: center;
|
|
48
47
|
height: var(--vxe-ui-gantt-view-chart-bar-height);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
&.is--default {
|
|
49
|
+
&:hover {
|
|
50
|
+
&::after {
|
|
51
|
+
content: "";
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
left: 0;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
&.is--milestone {
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
.vxe-gantt-view--chart-progress {
|
|
63
67
|
flex-shrink: 0;
|
|
@@ -79,6 +83,55 @@
|
|
|
79
83
|
padding: 0 0.6em;
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
$iconThemeList: (
|
|
87
|
+
(
|
|
88
|
+
name: "primary",
|
|
89
|
+
color: var(--vxe-ui-font-primary-color),
|
|
90
|
+
),
|
|
91
|
+
(
|
|
92
|
+
name: "success",
|
|
93
|
+
color: var(--vxe-ui-status-success-color),
|
|
94
|
+
),
|
|
95
|
+
(
|
|
96
|
+
name: "info",
|
|
97
|
+
color: var(--vxe-ui-status-info-color),
|
|
98
|
+
),
|
|
99
|
+
(
|
|
100
|
+
name: "warning",
|
|
101
|
+
color: var(--vxe-ui-status-warning-color),
|
|
102
|
+
),
|
|
103
|
+
(
|
|
104
|
+
name: "danger",
|
|
105
|
+
color: var(--vxe-ui-status-danger-color),
|
|
106
|
+
),
|
|
107
|
+
(
|
|
108
|
+
name: "error",
|
|
109
|
+
color: var(--vxe-ui-status-error-color),
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
.vxe-gantt-view--chart-milestone-wrapper {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
align-items: center;
|
|
116
|
+
}
|
|
117
|
+
.vxe-gantt-view--chart-milestone-icon {
|
|
118
|
+
flex-shrink: 0;
|
|
119
|
+
padding: 0 0.3em;
|
|
120
|
+
color: var(--vxe-ui-font-primary-color);
|
|
121
|
+
@for $index from 0 to list.length($iconThemeList) {
|
|
122
|
+
$item: list.nth($iconThemeList, $index + 1);
|
|
123
|
+
&.theme--#{map.get($item, name)} {
|
|
124
|
+
color: map.get($item, color);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
i {
|
|
128
|
+
display: inline-block;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
.vxe-gantt-view--chart-milestone-content {
|
|
132
|
+
flex-grow: 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
82
135
|
/*行拖拽*/
|
|
83
136
|
.vxe-gantt-view--chart-row {
|
|
84
137
|
&.row--drag-move {
|