vxe-gantt 3.1.6 → 3.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 +37 -21
- package/es/gantt/src/gantt-view.js +33 -12
- package/es/gantt/src/gantt.js +69 -4
- package/es/gantt/src/static.js +22 -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 +31 -20
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +28 -10
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +86 -3
- 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/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 +195 -42
- 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 +37 -21
- package/packages/gantt/src/gantt-view.ts +36 -13
- package/packages/gantt/src/gantt.ts +86 -14
- package/packages/gantt/src/static.ts +21 -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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VNode, CreateElement } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
|
-
import { setScrollTop, setScrollLeft, removeClass, addClass
|
|
5
|
-
import { getRefElem, getStandardGapTime } from './util'
|
|
4
|
+
import { setScrollTop, setScrollLeft, removeClass, addClass } from '../../ui/src/dom'
|
|
5
|
+
import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth } from './util'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
import GanttViewHeaderComponent from './gantt-header'
|
|
8
8
|
import GanttViewBodyComponent from './gantt-body'
|
|
@@ -601,30 +601,37 @@ function calcScrollbar ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPriv
|
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
-
function
|
|
604
|
+
function updateTaskChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
605
|
+
const $xeGantt = $xeGanttView.$xeGantt
|
|
605
606
|
const reactData = $xeGanttView.reactData
|
|
606
607
|
const internalData = $xeGanttView.internalData
|
|
608
|
+
const ganttInternalData = $xeGantt.internalData
|
|
609
|
+
const $xeTable = internalData.xeTable
|
|
607
610
|
|
|
611
|
+
const { dragBarRow } = ganttInternalData
|
|
608
612
|
const { viewCellWidth } = reactData
|
|
609
613
|
const { elemStore, chartMaps } = internalData
|
|
610
|
-
const chartWrapper = getRefElem(elemStore['main-chart-wrapper'])
|
|
611
|
-
if (chartWrapper) {
|
|
614
|
+
const chartWrapper = getRefElem(elemStore['main-chart-task-wrapper'])
|
|
615
|
+
if (chartWrapper && $xeTable) {
|
|
612
616
|
XEUtils.arrayEach(chartWrapper.children, (rowEl) => {
|
|
613
617
|
const barEl = rowEl.children[0] as HTMLDivElement
|
|
614
|
-
if (!barEl
|
|
618
|
+
if (!barEl) {
|
|
615
619
|
return
|
|
616
620
|
}
|
|
617
621
|
const rowid = rowEl.getAttribute('rowid')
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
622
|
+
if (dragBarRow && $xeTable.getRowid(dragBarRow) === rowid) {
|
|
623
|
+
return
|
|
624
|
+
}
|
|
625
|
+
const chartRest = rowid ? chartMaps[rowid] : null
|
|
626
|
+
barEl.style.left = `${getTaskBarLeft(chartRest, viewCellWidth)}px`
|
|
627
|
+
barEl.style.width = `${getTaskBarWidth(chartRest, viewCellWidth)}px`
|
|
621
628
|
})
|
|
622
629
|
}
|
|
623
630
|
return $xeGanttView.$nextTick()
|
|
624
631
|
}
|
|
625
632
|
|
|
626
633
|
function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
627
|
-
const $xeGantt = $xeGanttView.$xeGantt
|
|
634
|
+
const $xeGantt = $xeGanttView.$xeGantt as VxeGanttConstructor & VxeGanttPrivateMethods
|
|
628
635
|
const reactData = $xeGanttView.reactData
|
|
629
636
|
const internalData = $xeGanttView.internalData
|
|
630
637
|
|
|
@@ -636,6 +643,9 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
636
643
|
if (!el) {
|
|
637
644
|
return
|
|
638
645
|
}
|
|
646
|
+
if (!$xeGantt) {
|
|
647
|
+
return
|
|
648
|
+
}
|
|
639
649
|
|
|
640
650
|
const scrollbarOpts = $xeGantt.computeScrollbarOpts
|
|
641
651
|
const scrollbarXToTop = $xeGantt.computeScrollbarXToTop
|
|
@@ -746,20 +756,26 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
|
|
|
746
756
|
|
|
747
757
|
reactData.scrollXWidth = viewTableWidth
|
|
748
758
|
|
|
749
|
-
return
|
|
759
|
+
return Promise.all([
|
|
760
|
+
updateTaskChart($xeGanttView),
|
|
761
|
+
$xeGantt.handleUpdateTaskLink ? $xeGantt.handleUpdateTaskLink($xeGanttView) : null
|
|
762
|
+
])
|
|
750
763
|
}
|
|
751
764
|
|
|
752
765
|
function handleRecalculateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
|
|
753
766
|
const internalData = $xeGanttView.internalData
|
|
767
|
+
const $xeGantt = $xeGanttView.$xeGantt
|
|
754
768
|
|
|
755
769
|
const el = $xeGanttView.$refs.refElem as HTMLDivElement
|
|
756
770
|
internalData.rceRunTime = Date.now()
|
|
757
771
|
if (!el || !el.clientWidth) {
|
|
758
772
|
return $xeGanttView.$nextTick()
|
|
759
773
|
}
|
|
774
|
+
if (!$xeGantt) {
|
|
775
|
+
return $xeGanttView.$nextTick()
|
|
776
|
+
}
|
|
760
777
|
calcScrollbar($xeGanttView)
|
|
761
778
|
updateStyle($xeGanttView)
|
|
762
|
-
updateChart($xeGanttView)
|
|
763
779
|
return computeScrollLoad($xeGanttView)
|
|
764
780
|
}
|
|
765
781
|
|
|
@@ -975,7 +991,7 @@ function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
|
|
|
975
991
|
scrollYTop = 0
|
|
976
992
|
}
|
|
977
993
|
|
|
978
|
-
const bodyChartWrapperElem = getRefElem(elemStore['main-chart-wrapper'])
|
|
994
|
+
const bodyChartWrapperElem = getRefElem(elemStore['main-chart-task-wrapper'])
|
|
979
995
|
if (bodyTableElem) {
|
|
980
996
|
bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`
|
|
981
997
|
}
|
|
@@ -992,6 +1008,13 @@ function updateScrollYSpace ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
|
|
|
992
1008
|
if (scrollYSpaceEl) {
|
|
993
1009
|
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
994
1010
|
}
|
|
1011
|
+
|
|
1012
|
+
const lineWrapper = getRefElem(elemStore['main-chart-line-wrapper'])
|
|
1013
|
+
const svgElem = lineWrapper ? lineWrapper.firstElementChild as HTMLDivElement : null
|
|
1014
|
+
if (svgElem) {
|
|
1015
|
+
svgElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : ''
|
|
1016
|
+
}
|
|
1017
|
+
|
|
995
1018
|
reactData.scrollYTop = scrollYTop
|
|
996
1019
|
reactData.scrollYHeight = scrollYHeight
|
|
997
1020
|
reactData.isScrollYBig = isScrollYBig
|
|
@@ -5,13 +5,14 @@ import XEUtils from 'xe-utils'
|
|
|
5
5
|
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
6
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
|
+
import { getTaskLinkKey } from './util'
|
|
8
9
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
9
10
|
import GanttViewComponent from './gantt-view'
|
|
10
11
|
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
11
12
|
|
|
12
13
|
import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxePagerDefines, VxeComponentStyleType, VxeComponentSizeType, VxeFormDefines, VxeFormItemPropTypes } from 'vxe-pc-ui'
|
|
13
14
|
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTooltipInstance, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
14
|
-
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines, VxeGanttConstructor } from '../../../types'
|
|
15
|
+
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
15
16
|
|
|
16
17
|
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
17
18
|
|
|
@@ -74,8 +75,29 @@ XEUtils.each((VxeTableComponent as any).methods, (fn, name) => {
|
|
|
74
75
|
}
|
|
75
76
|
})
|
|
76
77
|
|
|
78
|
+
function handleTaskAddLink (item: VxeGanttPropTypes.Link, linkConfs: VxeGanttDefines.LinkConfObj[], fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]>, fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj>, uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj>) {
|
|
79
|
+
if (item) {
|
|
80
|
+
const { type, from, to, lineStatus, lineColor, lineTyle, lineWidth, showArrow } = item
|
|
81
|
+
const tlKey = getTaskLinkKey(from, to)
|
|
82
|
+
if (from && to && !uniqueMaps[tlKey]) {
|
|
83
|
+
let confs = fromConfMaps[from]
|
|
84
|
+
if (!confs) {
|
|
85
|
+
confs = fromConfMaps[from] = []
|
|
86
|
+
}
|
|
87
|
+
const confObj: VxeGanttDefines.LinkConfObj = { type, from, to, lineStatus, lineColor, lineTyle, lineWidth, showArrow }
|
|
88
|
+
confs.push(confObj)
|
|
89
|
+
linkConfs.push(confObj)
|
|
90
|
+
fromKeyMaps[from] = confObj
|
|
91
|
+
uniqueMaps[tlKey] = confObj
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
77
96
|
function createInternalData (): GanttInternalData {
|
|
78
97
|
return {
|
|
98
|
+
linkFromConfMaps: {},
|
|
99
|
+
linkFromKeyMaps: {},
|
|
100
|
+
linkUniqueMaps: {},
|
|
79
101
|
uFoot: false,
|
|
80
102
|
resizeTableWidth: 0
|
|
81
103
|
// barTipTimeout: null
|
|
@@ -110,17 +132,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
110
132
|
params: PropType<VxeTablePropTypes.Params>
|
|
111
133
|
}),
|
|
112
134
|
|
|
113
|
-
columns: Array as PropType<VxeGridPropTypes.Columns
|
|
135
|
+
columns: Array as PropType<VxeGridPropTypes.Columns>,
|
|
114
136
|
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
115
137
|
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
116
138
|
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
117
139
|
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
118
140
|
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
119
141
|
|
|
142
|
+
links: Array as PropType<VxeGanttPropTypes.Links>,
|
|
120
143
|
layouts: Array as PropType<VxeGanttPropTypes.Layouts>,
|
|
121
144
|
taskConfig: Object as PropType<VxeGanttPropTypes.TaskConfig>,
|
|
122
145
|
taskViewScaleConfig: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfig>,
|
|
123
146
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
147
|
+
taskLinkConfig: Object as PropType<VxeGanttPropTypes.TaskLinkConfig>,
|
|
124
148
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
125
149
|
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
126
150
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
@@ -147,6 +171,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
147
171
|
tableLoading: false,
|
|
148
172
|
proxyInited: false,
|
|
149
173
|
isZMax: false,
|
|
174
|
+
tableLinks: [],
|
|
150
175
|
tableData: [],
|
|
151
176
|
filterData: [],
|
|
152
177
|
formData: {},
|
|
@@ -167,7 +192,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
167
192
|
content: '',
|
|
168
193
|
visible: false,
|
|
169
194
|
params: null
|
|
170
|
-
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
linkList: [],
|
|
198
|
+
upLinkFlag: 0
|
|
171
199
|
}
|
|
172
200
|
|
|
173
201
|
const internalData = createInternalData()
|
|
@@ -272,6 +300,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
272
300
|
|
|
273
301
|
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
274
302
|
},
|
|
303
|
+
computeTaskLinkOpts () {
|
|
304
|
+
const $xeGantt = this
|
|
305
|
+
const props = $xeGantt
|
|
306
|
+
|
|
307
|
+
return Object.assign({}, getConfig().gantt.taskLinkConfig, props.taskLinkConfig)
|
|
308
|
+
},
|
|
275
309
|
computeScaleUnit () {
|
|
276
310
|
const $xeGantt = this
|
|
277
311
|
|
|
@@ -679,7 +713,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
679
713
|
}
|
|
680
714
|
},
|
|
681
715
|
getRespMsg (rest: any, defaultMsg: string) {
|
|
682
|
-
const $xeGantt = this
|
|
716
|
+
const $xeGantt = this as unknown as VxeGanttConstructor & VxeGanttPrivateMethods
|
|
683
717
|
|
|
684
718
|
const proxyOpts = $xeGantt.computeProxyOpts
|
|
685
719
|
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
@@ -1187,7 +1221,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1187
1221
|
const commitParams = {
|
|
1188
1222
|
$table: $xeTable,
|
|
1189
1223
|
$grid: null,
|
|
1190
|
-
$gantt: $xeGantt,
|
|
1224
|
+
$gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods,
|
|
1191
1225
|
code,
|
|
1192
1226
|
button,
|
|
1193
1227
|
isInited,
|
|
@@ -1209,7 +1243,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1209
1243
|
let tableData: any[] = []
|
|
1210
1244
|
reactData.tableLoading = false
|
|
1211
1245
|
if (rest) {
|
|
1212
|
-
const reParams = { data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }
|
|
1246
|
+
const reParams = { data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods }
|
|
1213
1247
|
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1214
1248
|
const totalProp = resConfigs.total
|
|
1215
1249
|
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
@@ -1278,7 +1312,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1278
1312
|
const commitParams = {
|
|
1279
1313
|
$table: $xeTable,
|
|
1280
1314
|
$grid: null,
|
|
1281
|
-
$gantt: $xeGantt,
|
|
1315
|
+
$gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods,
|
|
1282
1316
|
code,
|
|
1283
1317
|
button,
|
|
1284
1318
|
filters: filterList,
|
|
@@ -1316,7 +1350,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1316
1350
|
const commitParams = {
|
|
1317
1351
|
$table: $xeTable,
|
|
1318
1352
|
$grid: null,
|
|
1319
|
-
$gantt: $xeGantt,
|
|
1353
|
+
$gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods,
|
|
1320
1354
|
code,
|
|
1321
1355
|
button,
|
|
1322
1356
|
body,
|
|
@@ -1393,7 +1427,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1393
1427
|
const commitParams = {
|
|
1394
1428
|
$table: $xeTable,
|
|
1395
1429
|
$grid: null,
|
|
1396
|
-
$gantt: $xeGantt,
|
|
1430
|
+
$gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods,
|
|
1397
1431
|
code,
|
|
1398
1432
|
button,
|
|
1399
1433
|
body,
|
|
@@ -1479,7 +1513,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1479
1513
|
if (gCommandOpts) {
|
|
1480
1514
|
const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
|
|
1481
1515
|
if (tCommandMethod) {
|
|
1482
|
-
tCommandMethod({ code, button, $grid: null, $table: $xeTable, $gantt: $xeGantt }, ...args)
|
|
1516
|
+
tCommandMethod({ code, button, $grid: null, $table: $xeTable, $gantt: $xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods }, ...args)
|
|
1483
1517
|
} else {
|
|
1484
1518
|
errLog('vxe.error.notCommands', [code])
|
|
1485
1519
|
}
|
|
@@ -1729,8 +1763,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1729
1763
|
return $xeGantt.$nextTick()
|
|
1730
1764
|
},
|
|
1731
1765
|
/**
|
|
1732
|
-
|
|
1733
|
-
|
|
1766
|
+
* 关闭 bar tooltip
|
|
1767
|
+
*/
|
|
1734
1768
|
closeTaskBarTooltip () {
|
|
1735
1769
|
const $xeGantt = this
|
|
1736
1770
|
const reactData = $xeGantt.reactData
|
|
@@ -1953,6 +1987,33 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1953
1987
|
$xeGantt.closeTaskBarTooltip()
|
|
1954
1988
|
}
|
|
1955
1989
|
},
|
|
1990
|
+
handleTableLinks () {
|
|
1991
|
+
const $xeGantt = this
|
|
1992
|
+
const reactData = $xeGantt.reactData
|
|
1993
|
+
|
|
1994
|
+
const { linkList } = reactData
|
|
1995
|
+
reactData.tableLinks = linkList.slice(0)
|
|
1996
|
+
},
|
|
1997
|
+
handleTaskAddLink,
|
|
1998
|
+
handleTaskUpdateLinks (links: VxeGanttPropTypes.Links) {
|
|
1999
|
+
const $xeGantt = this
|
|
2000
|
+
const reactData = $xeGantt.reactData
|
|
2001
|
+
const internalData = $xeGantt.internalData
|
|
2002
|
+
|
|
2003
|
+
const linkConfs: VxeGanttDefines.LinkConfObj[] = []
|
|
2004
|
+
const fromConfMaps: Record<string, VxeGanttDefines.LinkConfObj[]> = {}
|
|
2005
|
+
const fromKeyMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
|
|
2006
|
+
const uniqueMaps: Record<string, VxeGanttDefines.LinkConfObj> = {}
|
|
2007
|
+
XEUtils.each(links || [], item => {
|
|
2008
|
+
handleTaskAddLink(item, linkConfs, fromConfMaps, fromKeyMaps, uniqueMaps)
|
|
2009
|
+
})
|
|
2010
|
+
reactData.linkList = linkConfs
|
|
2011
|
+
internalData.linkFromConfMaps = fromConfMaps
|
|
2012
|
+
internalData.linkFromKeyMaps = fromKeyMaps
|
|
2013
|
+
internalData.linkUniqueMaps = uniqueMaps
|
|
2014
|
+
$xeGantt.handleTableLinks()
|
|
2015
|
+
return $xeGantt.$nextTick()
|
|
2016
|
+
},
|
|
1956
2017
|
handleTaskHeaderContextmenuEvent (evnt: Event, params: VxeGanttDefines.TaskHeaderContextmenuParams) {
|
|
1957
2018
|
const $xeGantt = this
|
|
1958
2019
|
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -2260,7 +2321,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2260
2321
|
return renderEmptyElement($xeGantt)
|
|
2261
2322
|
},
|
|
2262
2323
|
renderTable (h: CreateElement) {
|
|
2263
|
-
const $xeGantt = this
|
|
2324
|
+
const $xeGantt = this as unknown as VxeGanttConstructor & VxeGanttPrivateMethods
|
|
2264
2325
|
const slots = $xeGantt.$scopedSlots
|
|
2265
2326
|
|
|
2266
2327
|
const tableProps = $xeGantt.computeTableProps
|
|
@@ -2271,7 +2332,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2271
2332
|
h(VxeTableComponent as Component, {
|
|
2272
2333
|
key: 'table',
|
|
2273
2334
|
props: tableProps,
|
|
2274
|
-
on: getTableOns($xeGantt
|
|
2335
|
+
on: getTableOns($xeGantt),
|
|
2275
2336
|
scopedSlots: slots,
|
|
2276
2337
|
ref: 'refTable'
|
|
2277
2338
|
})
|
|
@@ -2590,6 +2651,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2590
2651
|
warnLog('vxe.error.notProp', ['expand-config'])
|
|
2591
2652
|
}
|
|
2592
2653
|
|
|
2654
|
+
if (!($xeGantt as unknown as VxeGanttConstructor & VxeGanttPrivateMethods).handleUpdateTaskLink) {
|
|
2655
|
+
if (props.taskLinkConfig) {
|
|
2656
|
+
warnLog('vxe.error.notProp', ['task-link-config'])
|
|
2657
|
+
}
|
|
2658
|
+
if (props.links) {
|
|
2659
|
+
errLog('vxe.error.notProp', ['links'])
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2593
2662
|
$xeGantt.$nextTick(() => {
|
|
2594
2663
|
if (props.formConfig) {
|
|
2595
2664
|
if (!VxeUIFormComponent) {
|
|
@@ -2608,6 +2677,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2608
2677
|
}
|
|
2609
2678
|
})
|
|
2610
2679
|
|
|
2680
|
+
if (props.links) {
|
|
2681
|
+
$xeGantt.handleTaskUpdateLinks(props.links)
|
|
2682
|
+
}
|
|
2611
2683
|
$xeGantt.handleTaskScaleConfig()
|
|
2612
2684
|
$xeGantt.initPages()
|
|
2613
2685
|
},
|
|
@@ -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
|
+
}
|
|
@@ -23,3 +23,15 @@ export function getStandardGapTime (type: VxeGanttDefines.ColumnScaleType) {
|
|
|
23
23
|
}
|
|
24
24
|
return 1000 * 60 * 60 * 24
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
export function getTaskBarLeft (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
|
|
28
|
+
return chartRest ? viewCellWidth * chartRest.oLeftSize : 0
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
|
|
32
|
+
return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getTaskLinkKey (from: string | number, to: string | number) {
|
|
36
|
+
return `${from}_${to}`
|
|
37
|
+
}
|
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
|
}
|