vxe-gantt 4.1.19 → 4.2.0
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/README.md +20 -3
- package/es/gantt/src/gantt-body.js +2 -2
- package/es/gantt/src/gantt-view.js +50 -47
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt-body.js +4 -2
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +49 -46
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/index.umd.js +58 -53
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +1 -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-body.ts +2 -2
- package/packages/gantt/src/gantt-view.ts +58 -52
|
@@ -145,7 +145,7 @@ export default defineVxeComponent({
|
|
|
145
145
|
const scaleUnit = computeScaleUnit.value
|
|
146
146
|
const taskViewOpts = computeTaskViewOpts.value
|
|
147
147
|
const { viewStyle } = taskViewOpts
|
|
148
|
-
const { rowClassName, rowStyle } = viewStyle || {}
|
|
148
|
+
const { rowClassName, rowStyle, cellClassName, cellStyle } = viewStyle || {}
|
|
149
149
|
|
|
150
150
|
const { tableColumn, scrollYLoad } = reactData
|
|
151
151
|
|
|
@@ -192,7 +192,7 @@ export default defineVxeComponent({
|
|
|
192
192
|
}
|
|
193
193
|
trVNs.push(
|
|
194
194
|
h('tr', {
|
|
195
|
-
key:
|
|
195
|
+
key: rowClassName || rowStyle || cellClassName || cellStyle ? rowid : $rowIndex,
|
|
196
196
|
class: [
|
|
197
197
|
'vxe-gantt-view--body-row',
|
|
198
198
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, ref, reactive, nextTick, inject,
|
|
1
|
+
import { h, ref, reactive, nextTick, inject, onBeforeUnmount, provide, computed, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { setScrollTop, setScrollLeft, removeClass, addClass, hasClass } from '../../ui/src/dom'
|
|
4
4
|
import { VxeUI } from '@vxe-ui/core'
|
|
@@ -41,6 +41,43 @@ function createInternalData (): GanttViewInternalData {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function createReactData (): GanttViewReactData {
|
|
45
|
+
return {
|
|
46
|
+
// 是否启用了横向 X 可视渲染方式加载
|
|
47
|
+
scrollXLoad: false,
|
|
48
|
+
// 是否启用了纵向 Y 可视渲染方式加载
|
|
49
|
+
scrollYLoad: false,
|
|
50
|
+
// 是否存在纵向滚动条
|
|
51
|
+
overflowY: true,
|
|
52
|
+
// 是否存在横向滚动条
|
|
53
|
+
overflowX: true,
|
|
54
|
+
// 纵向滚动条的宽度
|
|
55
|
+
scrollbarWidth: 0,
|
|
56
|
+
// 横向滚动条的高度
|
|
57
|
+
scrollbarHeight: 0,
|
|
58
|
+
|
|
59
|
+
// 最后滚动时间戳
|
|
60
|
+
lastScrollTime: 0,
|
|
61
|
+
lazScrollLoading: false,
|
|
62
|
+
|
|
63
|
+
scrollVMLoading: false,
|
|
64
|
+
scrollYHeight: 0,
|
|
65
|
+
scrollYTop: 0,
|
|
66
|
+
isScrollYBig: false,
|
|
67
|
+
scrollXLeft: 0,
|
|
68
|
+
scrollXWidth: 0,
|
|
69
|
+
isScrollXBig: false,
|
|
70
|
+
|
|
71
|
+
minViewDate: null,
|
|
72
|
+
maxViewDate: null,
|
|
73
|
+
tableData: [],
|
|
74
|
+
tableColumn: [],
|
|
75
|
+
headerGroups: [],
|
|
76
|
+
|
|
77
|
+
viewCellWidth: 40
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
44
81
|
const maxYHeight = 5e6
|
|
45
82
|
// const maxXWidth = 5e6
|
|
46
83
|
|
|
@@ -71,40 +108,7 @@ export default defineVxeComponent({
|
|
|
71
108
|
|
|
72
109
|
const refColInfoElem = ref<HTMLDivElement>()
|
|
73
110
|
|
|
74
|
-
const reactData = reactive
|
|
75
|
-
// 是否启用了横向 X 可视渲染方式加载
|
|
76
|
-
scrollXLoad: false,
|
|
77
|
-
// 是否启用了纵向 Y 可视渲染方式加载
|
|
78
|
-
scrollYLoad: false,
|
|
79
|
-
// 是否存在纵向滚动条
|
|
80
|
-
overflowY: true,
|
|
81
|
-
// 是否存在横向滚动条
|
|
82
|
-
overflowX: true,
|
|
83
|
-
// 纵向滚动条的宽度
|
|
84
|
-
scrollbarWidth: 0,
|
|
85
|
-
// 横向滚动条的高度
|
|
86
|
-
scrollbarHeight: 0,
|
|
87
|
-
|
|
88
|
-
// 最后滚动时间戳
|
|
89
|
-
lastScrollTime: 0,
|
|
90
|
-
lazScrollLoading: false,
|
|
91
|
-
|
|
92
|
-
scrollVMLoading: false,
|
|
93
|
-
scrollYHeight: 0,
|
|
94
|
-
scrollYTop: 0,
|
|
95
|
-
isScrollYBig: false,
|
|
96
|
-
scrollXLeft: 0,
|
|
97
|
-
scrollXWidth: 0,
|
|
98
|
-
isScrollXBig: false,
|
|
99
|
-
|
|
100
|
-
minViewDate: null,
|
|
101
|
-
maxViewDate: null,
|
|
102
|
-
tableData: [],
|
|
103
|
-
tableColumn: [],
|
|
104
|
-
headerGroups: [],
|
|
105
|
-
|
|
106
|
-
viewCellWidth: 40
|
|
107
|
-
})
|
|
111
|
+
const reactData = reactive(createReactData())
|
|
108
112
|
|
|
109
113
|
const internalData = createInternalData()
|
|
110
114
|
|
|
@@ -1102,30 +1106,35 @@ export default defineVxeComponent({
|
|
|
1102
1106
|
// footerTableElem.style.transform = `translate(${xSpaceLeft}px, 0px)`
|
|
1103
1107
|
// }
|
|
1104
1108
|
|
|
1109
|
+
const ySpaceWidth = scrollXWidth
|
|
1110
|
+
|
|
1105
1111
|
const layoutList = ['header', 'body', 'footer']
|
|
1106
1112
|
layoutList.forEach(layout => {
|
|
1107
1113
|
const xSpaceElem = getRefElem(elemStore[`main-${layout}-xSpace`])
|
|
1108
1114
|
if (xSpaceElem) {
|
|
1109
|
-
xSpaceElem.style.width = scrollXLoad ? `${
|
|
1115
|
+
xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : ''
|
|
1110
1116
|
}
|
|
1111
1117
|
})
|
|
1112
1118
|
|
|
1113
1119
|
const scrollXSpaceEl = refScrollXSpaceElem.value
|
|
1114
1120
|
if (scrollXSpaceEl) {
|
|
1115
|
-
scrollXSpaceEl.style.width = `${
|
|
1121
|
+
scrollXSpaceEl.style.width = `${ySpaceWidth}px`
|
|
1116
1122
|
}
|
|
1117
1123
|
|
|
1118
1124
|
const beforeWrapper = getRefElem(elemStore['main-chart-before-wrapper'])
|
|
1119
1125
|
const beforeSvgElem = beforeWrapper ? beforeWrapper.firstElementChild as HTMLDivElement : null
|
|
1120
1126
|
if (beforeSvgElem) {
|
|
1121
|
-
beforeSvgElem.style.width = `${
|
|
1127
|
+
beforeSvgElem.style.width = `${ySpaceWidth}px`
|
|
1122
1128
|
}
|
|
1123
1129
|
const afterWrapper = getRefElem(elemStore['main-chart-after-wrapper'])
|
|
1124
1130
|
const afterSvgElem = afterWrapper ? afterWrapper.firstElementChild as HTMLDivElement : null
|
|
1125
1131
|
if (afterSvgElem) {
|
|
1126
|
-
afterSvgElem.style.width = `${
|
|
1132
|
+
afterSvgElem.style.width = `${ySpaceWidth}px`
|
|
1127
1133
|
}
|
|
1128
1134
|
|
|
1135
|
+
reactData.scrollXLeft = xSpaceLeft
|
|
1136
|
+
reactData.scrollXWidth = ySpaceWidth
|
|
1137
|
+
|
|
1129
1138
|
calcScrollbar()
|
|
1130
1139
|
return nextTick()
|
|
1131
1140
|
}
|
|
@@ -1172,7 +1181,7 @@ export default defineVxeComponent({
|
|
|
1172
1181
|
bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`
|
|
1173
1182
|
}
|
|
1174
1183
|
if (bodyChartWrapperElem) {
|
|
1175
|
-
bodyChartWrapperElem.style.transform = `
|
|
1184
|
+
bodyChartWrapperElem.style.transform = `translateY(${scrollYTop}px)`
|
|
1176
1185
|
}
|
|
1177
1186
|
|
|
1178
1187
|
const bodyYSpaceElem = getRefElem(elemStore['main-body-ySpace'])
|
|
@@ -1334,12 +1343,16 @@ export default defineVxeComponent({
|
|
|
1334
1343
|
}
|
|
1335
1344
|
})
|
|
1336
1345
|
},
|
|
1337
|
-
updateViewData () {
|
|
1346
|
+
updateViewData (force?: boolean) {
|
|
1338
1347
|
const $xeTable = internalData.xeTable
|
|
1339
1348
|
if ($xeTable) {
|
|
1340
1349
|
const tableReactData = $xeTable.reactData
|
|
1341
1350
|
const { tableData } = tableReactData
|
|
1342
1351
|
reactData.tableData = tableData
|
|
1352
|
+
if (force) {
|
|
1353
|
+
handleUpdateData()
|
|
1354
|
+
}
|
|
1355
|
+
handleRecalculateStyle()
|
|
1343
1356
|
}
|
|
1344
1357
|
return nextTick()
|
|
1345
1358
|
},
|
|
@@ -1655,21 +1668,14 @@ export default defineVxeComponent({
|
|
|
1655
1668
|
])
|
|
1656
1669
|
}
|
|
1657
1670
|
|
|
1658
|
-
const tdFlag = ref(0)
|
|
1659
|
-
watch(() => reactData.tableData, () => {
|
|
1660
|
-
tdFlag.value++
|
|
1661
|
-
})
|
|
1662
|
-
watch(() => reactData.tableData.length, () => {
|
|
1663
|
-
tdFlag.value++
|
|
1664
|
-
})
|
|
1665
|
-
watch(tdFlag, () => {
|
|
1666
|
-
handleUpdateData()
|
|
1667
|
-
})
|
|
1668
|
-
|
|
1669
1671
|
onMounted(() => {
|
|
1670
1672
|
globalEvents.on($xeGanttView, 'resize', handleGlobalResizeEvent)
|
|
1671
1673
|
})
|
|
1672
1674
|
|
|
1675
|
+
onBeforeUnmount(() => {
|
|
1676
|
+
XEUtils.assign(reactData, createReactData())
|
|
1677
|
+
})
|
|
1678
|
+
|
|
1673
1679
|
onUnmounted(() => {
|
|
1674
1680
|
globalEvents.off($xeGanttView, 'keydown')
|
|
1675
1681
|
XEUtils.assign(internalData, createInternalData())
|