vxe-gantt 4.1.6 → 4.1.7
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/index.js +1 -0
- package/es/gantt/src/gantt-body.js +2 -5
- package/es/gantt/src/gantt-chart.js +35 -19
- package/es/gantt/src/gantt-view.js +22 -9
- package/es/gantt/src/gantt.js +63 -2
- package/es/gantt/src/static.js +22 -0
- package/es/gantt/src/table-emits.js +1 -0
- package/es/gantt/src/util.js +9 -0
- package/es/gantt/style.css +1 -1
- 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 +5 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-gantt/style.css +1 -1
- package/es/vxe-gantt/style.min.css +1 -1
- package/lib/gantt/index.js +16 -0
- package/lib/gantt/index.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +2 -5
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +33 -19
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +18 -8
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +84 -1
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/static.js +28 -0
- package/lib/gantt/src/static.min.js +1 -0
- package/lib/gantt/src/table-emits.js +1 -1
- package/lib/gantt/src/table-emits.min.js +1 -1
- package/lib/gantt/src/util.js +12 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +1 -1
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.umd.js +186 -43
- 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 +5 -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 +1 -1
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/gantt/index.ts +2 -0
- package/packages/gantt/src/gantt-body.ts +2 -5
- package/packages/gantt/src/gantt-chart.ts +36 -20
- package/packages/gantt/src/gantt-view.ts +24 -9
- package/packages/gantt/src/gantt.ts +70 -2
- package/packages/gantt/src/static.ts +21 -0
- package/packages/gantt/src/table-emits.ts +1 -0
- package/packages/gantt/src/util.ts +12 -0
- package/packages/ui/index.ts +4 -0
- package/styles/components/gantt-module/gantt-chart.scss +2 -1
- package/styles/components/gantt.scss +0 -1
- package/styles/theme/base.scss +2 -0
|
@@ -5,6 +5,7 @@ import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/sr
|
|
|
5
5
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
7
7
|
import { VxeUI } from '@vxe-ui/core'
|
|
8
|
+
import { getTaskLinkKey } from './util'
|
|
8
9
|
import { ganttEmits } from './emits'
|
|
9
10
|
import { tableEmits } from './table-emits'
|
|
10
11
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -26,6 +27,9 @@ const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top',
|
|
|
26
27
|
|
|
27
28
|
function createInternalData (): GanttInternalData {
|
|
28
29
|
return {
|
|
30
|
+
linkFromConfMaps: {},
|
|
31
|
+
linkFromKeyMaps: {},
|
|
32
|
+
linkUniqueMaps: {},
|
|
29
33
|
uFoot: false,
|
|
30
34
|
resizeTableWidth: 0
|
|
31
35
|
// barTipTimeout: null
|
|
@@ -74,17 +78,19 @@ export default defineVxeComponent({
|
|
|
74
78
|
params: PropType<VxeTablePropTypes.Params>
|
|
75
79
|
}),
|
|
76
80
|
|
|
77
|
-
columns: Array as PropType<VxeGridPropTypes.Columns
|
|
81
|
+
columns: Array as PropType<VxeGridPropTypes.Columns>,
|
|
78
82
|
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
79
83
|
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
80
84
|
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
81
85
|
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
82
86
|
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
83
87
|
|
|
88
|
+
links: Array as PropType<VxeGanttPropTypes.Links>,
|
|
84
89
|
layouts: Array as PropType<VxeGanttPropTypes.Layouts>,
|
|
85
90
|
taskConfig: Object as PropType<VxeGanttPropTypes.TaskConfig>,
|
|
86
91
|
taskViewScaleConfig: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfig>,
|
|
87
92
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
93
|
+
taskLinkConfig: Object as PropType<VxeGanttPropTypes.TaskLinkConfig>,
|
|
88
94
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
89
95
|
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
90
96
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
@@ -114,6 +120,7 @@ export default defineVxeComponent({
|
|
|
114
120
|
tableLoading: false,
|
|
115
121
|
proxyInited: false,
|
|
116
122
|
isZMax: false,
|
|
123
|
+
tableLinks: [],
|
|
117
124
|
tableData: [],
|
|
118
125
|
filterData: [],
|
|
119
126
|
formData: {},
|
|
@@ -134,7 +141,10 @@ export default defineVxeComponent({
|
|
|
134
141
|
content: '',
|
|
135
142
|
visible: false,
|
|
136
143
|
params: null
|
|
137
|
-
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
linkList: [],
|
|
147
|
+
upLinkFlag: 0
|
|
138
148
|
})
|
|
139
149
|
|
|
140
150
|
const internalData = createInternalData()
|
|
@@ -248,6 +258,10 @@ export default defineVxeComponent({
|
|
|
248
258
|
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
249
259
|
})
|
|
250
260
|
|
|
261
|
+
const computeTaskLinkOpts = computed(() => {
|
|
262
|
+
return Object.assign({}, getConfig().gantt.taskLinkConfig, props.taskLinkConfig)
|
|
263
|
+
})
|
|
264
|
+
|
|
251
265
|
const computeScaleUnit = computed(() => {
|
|
252
266
|
const minScale = computeMinScale.value
|
|
253
267
|
return minScale ? minScale.type : 'date'
|
|
@@ -496,6 +510,7 @@ export default defineVxeComponent({
|
|
|
496
510
|
computeTaskBarResizeOpts,
|
|
497
511
|
computeTaskSplitOpts,
|
|
498
512
|
computeTaskBarTooltipOpts,
|
|
513
|
+
computeTaskLinkOpts,
|
|
499
514
|
computeTaskViewScales,
|
|
500
515
|
computeScaleUnit,
|
|
501
516
|
computeMinScale,
|
|
@@ -918,6 +933,45 @@ export default defineVxeComponent({
|
|
|
918
933
|
reactData.showRightView = !reactData.showRightView
|
|
919
934
|
}
|
|
920
935
|
|
|
936
|
+
const handleTableLinks = () => {
|
|
937
|
+
const { linkList } = reactData
|
|
938
|
+
reactData.tableLinks = linkList.slice(0)
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
const handleTaskAddLink = (item: VxeGanttPropTypes.Link, linkConfs: VxeGanttDefines.LinkConfObj[], fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]>, fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj>, uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj>) => {
|
|
942
|
+
if (item) {
|
|
943
|
+
const { type, from, to, lineStatus, lineColor, lineTyle, lineWidth, showArrow } = item
|
|
944
|
+
const tlKey = getTaskLinkKey(from, to)
|
|
945
|
+
if (from && to && !uniqueMaps[tlKey]) {
|
|
946
|
+
let confs = fromConfMaps[from]
|
|
947
|
+
if (!confs) {
|
|
948
|
+
confs = fromConfMaps[from] = []
|
|
949
|
+
}
|
|
950
|
+
const confObj: VxeGanttDefines.LinkConfObj = { type, from, to, lineStatus, lineColor, lineTyle, lineWidth, showArrow }
|
|
951
|
+
confs.push(confObj)
|
|
952
|
+
linkConfs.push(confObj)
|
|
953
|
+
fromKeyMaps[from] = confObj
|
|
954
|
+
uniqueMaps[tlKey] = confObj
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
const handleTaskUpdateLinks = (links: VxeGanttPropTypes.Links) => {
|
|
960
|
+
const linkConfs: VxeGanttDefines.LinkConfObj[] = []
|
|
961
|
+
const fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]> = {}
|
|
962
|
+
const fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
|
|
963
|
+
const uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
|
|
964
|
+
XEUtils.each(links || [], item => {
|
|
965
|
+
handleTaskAddLink(item, linkConfs, fromConfMaps, fromKeyMaps, uniqueMaps)
|
|
966
|
+
})
|
|
967
|
+
reactData.linkList = linkConfs
|
|
968
|
+
internalData.linkFromConfMaps = fromConfMaps
|
|
969
|
+
internalData.linkFromKeyMaps = fromKeyMaps
|
|
970
|
+
internalData.linkUniqueMaps = uniqueMaps
|
|
971
|
+
$xeGantt.handleTableLinks()
|
|
972
|
+
return nextTick()
|
|
973
|
+
}
|
|
974
|
+
|
|
921
975
|
const tableCompEvents: VxeTableEventProps = {}
|
|
922
976
|
tableEmits.forEach(name => {
|
|
923
977
|
const type = XEUtils.camelCase(`on-${name}`) as keyof VxeTableEventProps
|
|
@@ -1798,6 +1852,9 @@ export default defineVxeComponent({
|
|
|
1798
1852
|
$xeGantt.closeTaskBarTooltip()
|
|
1799
1853
|
}
|
|
1800
1854
|
},
|
|
1855
|
+
handleTableLinks,
|
|
1856
|
+
handleTaskAddLink,
|
|
1857
|
+
handleTaskUpdateLinks,
|
|
1801
1858
|
handleTaskHeaderContextmenuEvent (evnt, params) {
|
|
1802
1859
|
const $xeTable = refTable.value
|
|
1803
1860
|
if ($xeTable) {
|
|
@@ -2409,10 +2466,21 @@ export default defineVxeComponent({
|
|
|
2409
2466
|
}
|
|
2410
2467
|
})
|
|
2411
2468
|
|
|
2469
|
+
if (props.links) {
|
|
2470
|
+
$xeGantt.handleTaskUpdateLinks(props.links)
|
|
2471
|
+
}
|
|
2412
2472
|
handleTaskScaleConfig()
|
|
2413
2473
|
initPages()
|
|
2414
2474
|
|
|
2415
2475
|
onMounted(() => {
|
|
2476
|
+
if (!$xeGantt.handleUpdateTaskLink) {
|
|
2477
|
+
if (props.links) {
|
|
2478
|
+
warnLog('vxe.error.notProp', ['links'])
|
|
2479
|
+
}
|
|
2480
|
+
if (props.taskLinkConfig) {
|
|
2481
|
+
warnLog('vxe.error.notProp', ['task-link-config'])
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2416
2484
|
nextTick(() => {
|
|
2417
2485
|
const { columns } = props
|
|
2418
2486
|
const proxyOpts = computeProxyOpts.value
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 依赖线枚举类型
|
|
3
|
+
*/
|
|
4
|
+
export enum VxeGanttDependencyType {
|
|
5
|
+
/**
|
|
6
|
+
* 结束后才开始,表示一个任务必须在另一个任务开始之前完成
|
|
7
|
+
*/
|
|
8
|
+
FinishToStart = 0,
|
|
9
|
+
/**
|
|
10
|
+
* 开始到结束,表示从某个过程的开始到结束的整个过程
|
|
11
|
+
*/
|
|
12
|
+
StartToFinish = 1,
|
|
13
|
+
/**
|
|
14
|
+
* 开始后才开始,表示一个活动结束了,另一个活动才能开始,它们之间按先后顺序进行
|
|
15
|
+
*/
|
|
16
|
+
StartToStart = 2,
|
|
17
|
+
/**
|
|
18
|
+
* 完成到完成,表示一个任务必须在另一个任务完成之后才能完成
|
|
19
|
+
*/
|
|
20
|
+
FinishToFinish = 3
|
|
21
|
+
}
|
|
@@ -33,3 +33,15 @@ export function getStandardGapTime (type: VxeGanttDefines.ColumnScaleType) {
|
|
|
33
33
|
}
|
|
34
34
|
return 1000 * 60 * 60 * 24
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
export function getTaskBarLeft (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
|
|
38
|
+
return chartRest ? viewCellWidth * chartRest.oLeftSize : 0
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
|
|
42
|
+
return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getTaskLinkKey (from: string | number, to: string | number) {
|
|
46
|
+
return `${from}_${to}`
|
|
47
|
+
}
|
package/packages/ui/index.ts
CHANGED
package/styles/theme/base.scss
CHANGED
|
@@ -8,4 +8,6 @@
|
|
|
8
8
|
--vxe-ui-gantt-view-task-bar-border-radius: calc(var(--vxe-ui-gantt-view-split-bar-height) / 2);
|
|
9
9
|
--vxe-ui-gantt-view-task-bar-background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
10
10
|
--vxe-ui-gantt-view-task-bar-completed-background-color: var(--vxe-ui-font-primary-color);
|
|
11
|
+
--vxe-ui-gantt-view-task-line-color: var(--vxe-ui-font-primary-color);
|
|
12
|
+
--vxe-ui-gantt-view-task-line-arrow-width: 5;
|
|
11
13
|
}
|