vxe-gantt 0.0.1 → 0.0.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/LICENSE +21 -0
- package/README.en.md +72 -0
- package/README.ja-JP.md +72 -0
- package/README.md +82 -2
- package/README.zh-TW.md +73 -0
- package/es/components.js +12 -0
- package/es/gantt/index.js +13 -0
- package/es/gantt/src/emits.js +4 -0
- package/es/gantt/src/gantt-body.js +103 -0
- package/es/gantt/src/gantt-chart.js +77 -0
- package/es/gantt/src/gantt-header.js +70 -0
- package/es/gantt/src/gantt-view.js +768 -0
- package/es/gantt/src/gantt.js +1746 -0
- package/es/gantt/src/grid-emits.js +16 -0
- package/es/gantt/src/grid-props.js +7 -0
- package/es/gantt/src/props.js +2 -0
- package/es/gantt/src/table-emits.js +97 -0
- package/es/gantt/src/table-props.js +298 -0
- package/es/gantt/src/util.js +12 -0
- package/es/gantt/style.css +599 -0
- package/es/gantt/style.min.css +1 -0
- package/es/index.esm.js +3 -0
- package/es/style.css +1 -0
- package/es/style.min.css +1 -0
- package/es/ui/index.js +52 -0
- package/es/ui/src/comp.js +2 -0
- package/es/ui/src/dom.js +169 -0
- package/es/ui/src/log.js +4 -0
- package/es/ui/src/utils.js +41 -0
- package/es/ui/src/vn.js +1 -0
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/vxe-gantt/index.js +3 -0
- package/es/vxe-gantt/style.css +599 -0
- package/es/vxe-gantt/style.min.css +1 -0
- package/es/vxe-ui/index.js +3 -0
- package/es/vxe-ui/style.css +0 -0
- package/es/vxe-ui/style.min.css +0 -0
- package/helper/vetur/attributes.json +1 -0
- package/helper/vetur/tags.json +1 -0
- package/lib/components.js +42 -0
- package/lib/components.min.js +1 -0
- package/lib/gantt/index.js +20 -0
- package/lib/gantt/index.min.js +1 -0
- package/lib/gantt/src/emits.js +8 -0
- package/lib/gantt/src/emits.min.js +1 -0
- package/lib/gantt/src/gantt-body.js +118 -0
- package/lib/gantt/src/gantt-body.min.js +1 -0
- package/lib/gantt/src/gantt-chart.js +94 -0
- package/lib/gantt/src/gantt-chart.min.js +1 -0
- package/lib/gantt/src/gantt-header.js +78 -0
- package/lib/gantt/src/gantt-header.min.js +1 -0
- package/lib/gantt/src/gantt-view.js +810 -0
- package/lib/gantt/src/gantt-view.min.js +1 -0
- package/lib/gantt/src/gantt.js +1997 -0
- package/lib/gantt/src/gantt.min.js +1 -0
- package/lib/gantt/src/grid-emits.js +8 -0
- package/lib/gantt/src/grid-emits.min.js +1 -0
- package/lib/gantt/src/grid-props.js +24 -0
- package/lib/gantt/src/grid-props.min.js +1 -0
- package/lib/gantt/src/props.js +13 -0
- package/lib/gantt/src/props.min.js +1 -0
- package/lib/gantt/src/table-emits.js +7 -0
- package/lib/gantt/src/table-emits.min.js +1 -0
- package/lib/gantt/src/table-props.js +306 -0
- package/lib/gantt/src/table-props.min.js +1 -0
- package/lib/gantt/src/util.js +19 -0
- package/lib/gantt/src/util.min.js +1 -0
- package/lib/gantt/style/index.js +1 -0
- package/lib/gantt/style/style.css +599 -0
- package/lib/gantt/style/style.min.css +1 -0
- package/lib/index.common.js +21 -0
- package/lib/index.umd.js +6731 -0
- package/lib/index.umd.min.js +1 -0
- package/lib/style.css +1 -0
- package/lib/style.min.css +1 -0
- package/lib/ui/index.js +69 -0
- package/lib/ui/index.min.js +1 -0
- package/lib/ui/src/comp.js +8 -0
- package/lib/ui/src/comp.min.js +1 -0
- package/lib/ui/src/dom.js +217 -0
- package/lib/ui/src/dom.min.js +1 -0
- package/lib/ui/src/log.js +10 -0
- package/lib/ui/src/log.min.js +1 -0
- package/lib/ui/src/utils.js +59 -0
- package/lib/ui/src/utils.min.js +1 -0
- package/lib/ui/src/vn.js +1 -0
- package/lib/ui/src/vn.min.js +0 -0
- package/lib/ui/style/index.js +1 -0
- package/lib/ui/style/style.css +0 -0
- package/lib/ui/style/style.min.css +0 -0
- package/lib/vxe-gantt/index.js +21 -0
- package/lib/vxe-gantt/index.min.js +1 -0
- package/lib/vxe-gantt/style/index.js +1 -0
- package/lib/vxe-gantt/style/style.css +599 -0
- package/lib/vxe-gantt/style/style.min.css +1 -0
- package/lib/vxe-ui/index.js +21 -0
- package/lib/vxe-ui/index.min.js +1 -0
- package/lib/vxe-ui/style/index.js +1 -0
- package/lib/vxe-ui/style/style.css +0 -0
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/package.json +58 -21
- package/packages/components.ts +19 -0
- package/packages/gantt/index.ts +17 -0
- package/packages/gantt/src/emits.ts +7 -0
- package/packages/gantt/src/gantt-body.ts +119 -0
- package/packages/gantt/src/gantt-chart.ts +92 -0
- package/packages/gantt/src/gantt-header.ts +79 -0
- package/packages/gantt/src/gantt-view.ts +840 -0
- package/packages/gantt/src/gantt.ts +1869 -0
- package/packages/gantt/src/grid-emits.ts +19 -0
- package/packages/gantt/src/grid-props.ts +23 -0
- package/packages/gantt/src/props.ts +13 -0
- package/packages/gantt/src/table-emits.ts +109 -0
- package/packages/gantt/src/table-props.ts +304 -0
- package/packages/gantt/src/util.ts +15 -0
- package/packages/index.ts +4 -0
- package/packages/ui/index.ts +58 -0
- package/packages/ui/src/comp.ts +3 -0
- package/packages/ui/src/dom.ts +196 -0
- package/packages/ui/src/log.ts +6 -0
- package/packages/ui/src/utils.ts +50 -0
- package/packages/ui/src/vn.ts +0 -0
- package/styles/all.scss +3 -0
- package/styles/base.scss +2 -0
- package/styles/components/gantt-module/all.scss +1 -0
- package/styles/components/gantt-module/gantt-chart.scss +46 -0
- package/styles/components/gantt.scss +586 -0
- package/styles/components/ui.scss +0 -0
- package/styles/cssvar.scss +0 -0
- package/styles/helpers/baseMixin.scss +96 -0
- package/styles/helpers/baseVar.scss +4 -0
- package/styles/helpers/placement.scss +39 -0
- package/styles/theme/base.scss +7 -0
- package/styles/theme/dark.scss +7 -0
- package/styles/theme/light.scss +7 -0
- package/styles/variable.scss +0 -0
- package/types/all.d.ts +16 -0
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _comp = require("../../ui/src/comp");
|
|
9
|
+
var _dom = require("../../ui/src/dom");
|
|
10
|
+
var _ui = require("../../ui");
|
|
11
|
+
var _util = require("./util");
|
|
12
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
13
|
+
var _ganttHeader = _interopRequireDefault(require("./gantt-header"));
|
|
14
|
+
var _ganttBody = _interopRequireDefault(require("./gantt-body"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const {
|
|
17
|
+
globalEvents
|
|
18
|
+
} = _ui.VxeUI;
|
|
19
|
+
function createInternalData() {
|
|
20
|
+
return {
|
|
21
|
+
xeTable: null,
|
|
22
|
+
startMaps: {},
|
|
23
|
+
endMaps: {},
|
|
24
|
+
chartMaps: {},
|
|
25
|
+
elemStore: {},
|
|
26
|
+
// 存放横向 X 虚拟滚动相关的信息
|
|
27
|
+
scrollXStore: {
|
|
28
|
+
preloadSize: 0,
|
|
29
|
+
offsetSize: 0,
|
|
30
|
+
visibleSize: 0,
|
|
31
|
+
visibleStartIndex: 0,
|
|
32
|
+
visibleEndIndex: 0,
|
|
33
|
+
startIndex: 0,
|
|
34
|
+
endIndex: 0
|
|
35
|
+
},
|
|
36
|
+
// 存放纵向 Y 虚拟滚动相关信息
|
|
37
|
+
scrollYStore: {
|
|
38
|
+
preloadSize: 0,
|
|
39
|
+
offsetSize: 0,
|
|
40
|
+
visibleSize: 0,
|
|
41
|
+
visibleStartIndex: 0,
|
|
42
|
+
visibleEndIndex: 0,
|
|
43
|
+
startIndex: 0,
|
|
44
|
+
endIndex: 0
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const maxYHeight = 5e6;
|
|
49
|
+
const maxXWidth = 5e6;
|
|
50
|
+
var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
51
|
+
name: 'VxeGanttView',
|
|
52
|
+
setup(props, context) {
|
|
53
|
+
const xID = _xeUtils.default.uniqueId();
|
|
54
|
+
const $xeGantt = (0, _vue.inject)('$xeGantt', {});
|
|
55
|
+
const {
|
|
56
|
+
computeTaskViewOpts,
|
|
57
|
+
computeStartField,
|
|
58
|
+
computeEndField,
|
|
59
|
+
computeScrollbarOpts,
|
|
60
|
+
computeScrollbarXToTop,
|
|
61
|
+
computeScrollbarYToLeft
|
|
62
|
+
} = $xeGantt.getComputeMaps();
|
|
63
|
+
const refElem = (0, _vue.ref)();
|
|
64
|
+
const refScrollXVirtualElem = (0, _vue.ref)();
|
|
65
|
+
const refScrollYVirtualElem = (0, _vue.ref)();
|
|
66
|
+
const refScrollXHandleElem = (0, _vue.ref)();
|
|
67
|
+
const refScrollXLeftCornerElem = (0, _vue.ref)();
|
|
68
|
+
const refScrollXRightCornerElem = (0, _vue.ref)();
|
|
69
|
+
const refScrollYHandleElem = (0, _vue.ref)();
|
|
70
|
+
const refScrollYTopCornerElem = (0, _vue.ref)();
|
|
71
|
+
const refScrollXWrapperElem = (0, _vue.ref)();
|
|
72
|
+
const refScrollYWrapperElem = (0, _vue.ref)();
|
|
73
|
+
const refScrollYBottomCornerElem = (0, _vue.ref)();
|
|
74
|
+
const refScrollXSpaceElem = (0, _vue.ref)();
|
|
75
|
+
const refScrollYSpaceElem = (0, _vue.ref)();
|
|
76
|
+
const refColInfoElem = (0, _vue.ref)();
|
|
77
|
+
const reactData = (0, _vue.reactive)({
|
|
78
|
+
// 是否启用了横向 X 可视渲染方式加载
|
|
79
|
+
scrollXLoad: false,
|
|
80
|
+
// 是否启用了纵向 Y 可视渲染方式加载
|
|
81
|
+
scrollYLoad: false,
|
|
82
|
+
// 是否存在纵向滚动条
|
|
83
|
+
overflowY: false,
|
|
84
|
+
// 是否存在横向滚动条
|
|
85
|
+
overflowX: false,
|
|
86
|
+
// 纵向滚动条的宽度
|
|
87
|
+
scrollbarWidth: 0,
|
|
88
|
+
// 横向滚动条的高度
|
|
89
|
+
scrollbarHeight: 0,
|
|
90
|
+
lazScrollLoading: false,
|
|
91
|
+
scrollVMLoading: false,
|
|
92
|
+
scrollYHeight: 0,
|
|
93
|
+
scrollYTop: 0,
|
|
94
|
+
isScrollYBig: false,
|
|
95
|
+
scrollXLeft: 0,
|
|
96
|
+
scrollXWidth: 0,
|
|
97
|
+
isScrollXBig: false,
|
|
98
|
+
minViewDate: null,
|
|
99
|
+
maxViewDate: null,
|
|
100
|
+
tableData: [],
|
|
101
|
+
tableColumn: [],
|
|
102
|
+
headerGroups: [],
|
|
103
|
+
viewCellWidth: 40,
|
|
104
|
+
rowHeightStore: {
|
|
105
|
+
large: 52,
|
|
106
|
+
default: 48,
|
|
107
|
+
medium: 44,
|
|
108
|
+
small: 40,
|
|
109
|
+
mini: 36
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const internalData = createInternalData();
|
|
113
|
+
const refMaps = {
|
|
114
|
+
refElem
|
|
115
|
+
};
|
|
116
|
+
const computeMaps = {};
|
|
117
|
+
const $xeGanttView = {
|
|
118
|
+
xID,
|
|
119
|
+
props,
|
|
120
|
+
context,
|
|
121
|
+
reactData,
|
|
122
|
+
internalData,
|
|
123
|
+
getRefMaps: () => refMaps,
|
|
124
|
+
getComputeMaps: () => computeMaps
|
|
125
|
+
};
|
|
126
|
+
const handleParseColumn = () => {
|
|
127
|
+
const {
|
|
128
|
+
minViewDate,
|
|
129
|
+
maxViewDate
|
|
130
|
+
} = reactData;
|
|
131
|
+
const taskViewOpts = computeTaskViewOpts.value;
|
|
132
|
+
const fullCols = [];
|
|
133
|
+
const groupCols = [];
|
|
134
|
+
switch (taskViewOpts.mode) {
|
|
135
|
+
case 'year':
|
|
136
|
+
break;
|
|
137
|
+
case 'quarter':
|
|
138
|
+
break;
|
|
139
|
+
case 'month':
|
|
140
|
+
break;
|
|
141
|
+
case 'week':
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
{
|
|
145
|
+
if (minViewDate && maxViewDate) {
|
|
146
|
+
const currTime = minViewDate.getTime();
|
|
147
|
+
const diffDayNum = maxViewDate.getTime() - minViewDate.getTime();
|
|
148
|
+
const countDayNum = Math.max(6, Math.floor(diffDayNum / 86400000) + 1);
|
|
149
|
+
const groupList = [];
|
|
150
|
+
const colList = [];
|
|
151
|
+
const groupMaps = {};
|
|
152
|
+
for (let i = 0; i < countDayNum; i++) {
|
|
153
|
+
const itemDate = new Date(currTime + i * 86400000);
|
|
154
|
+
const yyyyy = `${itemDate.getFullYear()}-${itemDate.getMonth() + 1}`;
|
|
155
|
+
const mmDd = `${itemDate.getDate()}`;
|
|
156
|
+
let groupCol = groupMaps[yyyyy];
|
|
157
|
+
const column = {
|
|
158
|
+
field: `${yyyyy}-${mmDd}`,
|
|
159
|
+
title: mmDd
|
|
160
|
+
};
|
|
161
|
+
if (groupCol) {
|
|
162
|
+
groupCol.children.push(column);
|
|
163
|
+
fullCols.push(groupCol);
|
|
164
|
+
} else {
|
|
165
|
+
groupCol = {
|
|
166
|
+
field: yyyyy,
|
|
167
|
+
title: yyyyy,
|
|
168
|
+
children: [column]
|
|
169
|
+
};
|
|
170
|
+
groupList.push(groupCol);
|
|
171
|
+
fullCols.push(groupCol);
|
|
172
|
+
groupMaps[yyyyy] = groupCol;
|
|
173
|
+
}
|
|
174
|
+
colList.push(column);
|
|
175
|
+
}
|
|
176
|
+
groupCols.push(groupList, colList);
|
|
177
|
+
const $xeTable = internalData.xeTable;
|
|
178
|
+
if ($xeTable) {
|
|
179
|
+
const startField = computeStartField.value;
|
|
180
|
+
const endField = computeEndField.value;
|
|
181
|
+
const tableInternalData = $xeTable.internalData;
|
|
182
|
+
const {
|
|
183
|
+
afterFullData
|
|
184
|
+
} = tableInternalData;
|
|
185
|
+
const ctMaps = {};
|
|
186
|
+
afterFullData.forEach(row => {
|
|
187
|
+
const rowid = $xeTable.getRowid(row);
|
|
188
|
+
const startValue = _xeUtils.default.get(row, startField);
|
|
189
|
+
const endValue = _xeUtils.default.get(row, endField);
|
|
190
|
+
if (startValue && endValue) {
|
|
191
|
+
const startDate = _xeUtils.default.toStringDate(startValue);
|
|
192
|
+
const endDate = _xeUtils.default.toStringDate(endValue);
|
|
193
|
+
const oLeftSize = Math.floor((startDate.getTime() - minViewDate.getTime()) / 86400000);
|
|
194
|
+
const oWidthSize = Math.floor((endDate.getTime() - startDate.getTime()) / 86400000) + 1;
|
|
195
|
+
ctMaps[rowid] = {
|
|
196
|
+
row,
|
|
197
|
+
rowid,
|
|
198
|
+
oLeftSize,
|
|
199
|
+
oWidthSize
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
internalData.chartMaps = ctMaps;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
reactData.tableColumn = fullCols;
|
|
210
|
+
reactData.headerGroups = groupCols;
|
|
211
|
+
};
|
|
212
|
+
const handleUpdateData = () => {
|
|
213
|
+
const $xeTable = internalData.xeTable;
|
|
214
|
+
const sdMaps = {};
|
|
215
|
+
const edMaps = {};
|
|
216
|
+
let minDate = null;
|
|
217
|
+
let maxDate = null;
|
|
218
|
+
if ($xeTable) {
|
|
219
|
+
const startField = computeStartField.value;
|
|
220
|
+
const endField = computeEndField.value;
|
|
221
|
+
const tableInternalData = $xeTable.internalData;
|
|
222
|
+
const {
|
|
223
|
+
afterFullData
|
|
224
|
+
} = tableInternalData;
|
|
225
|
+
afterFullData.forEach(row => {
|
|
226
|
+
const startValue = _xeUtils.default.get(row, startField);
|
|
227
|
+
const endValue = _xeUtils.default.get(row, endField);
|
|
228
|
+
if (startValue && endValue) {
|
|
229
|
+
const startDate = _xeUtils.default.toStringDate(startValue);
|
|
230
|
+
if (!minDate || minDate.getTime() > startDate.getTime()) {
|
|
231
|
+
minDate = startDate;
|
|
232
|
+
}
|
|
233
|
+
const endDate = _xeUtils.default.toStringDate(endValue);
|
|
234
|
+
if (!maxDate || maxDate.getTime() < endDate.getTime()) {
|
|
235
|
+
maxDate = endDate;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
reactData.minViewDate = minDate;
|
|
241
|
+
reactData.maxViewDate = maxDate;
|
|
242
|
+
internalData.startMaps = sdMaps;
|
|
243
|
+
internalData.endMaps = edMaps;
|
|
244
|
+
handleParseColumn();
|
|
245
|
+
};
|
|
246
|
+
const calcScrollbar = () => {
|
|
247
|
+
const {
|
|
248
|
+
scrollXWidth,
|
|
249
|
+
scrollYHeight
|
|
250
|
+
} = reactData;
|
|
251
|
+
const {
|
|
252
|
+
elemStore
|
|
253
|
+
} = internalData;
|
|
254
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
255
|
+
const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
|
|
256
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
257
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
258
|
+
let overflowY = false;
|
|
259
|
+
let overflowX = false;
|
|
260
|
+
if (bodyWrapperElem) {
|
|
261
|
+
overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
|
|
262
|
+
if (yHandleEl) {
|
|
263
|
+
reactData.scrollbarWidth = scrollbarOpts.width || yHandleEl.offsetWidth - yHandleEl.clientWidth || 14;
|
|
264
|
+
}
|
|
265
|
+
reactData.overflowY = overflowY;
|
|
266
|
+
overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
|
|
267
|
+
if (xHandleEl) {
|
|
268
|
+
reactData.scrollbarHeight = scrollbarOpts.height || xHandleEl.offsetHeight - xHandleEl.clientHeight || 14;
|
|
269
|
+
}
|
|
270
|
+
reactData.overflowX = overflowX;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const updateChart = () => {
|
|
274
|
+
const {
|
|
275
|
+
viewCellWidth
|
|
276
|
+
} = reactData;
|
|
277
|
+
const {
|
|
278
|
+
elemStore,
|
|
279
|
+
chartMaps
|
|
280
|
+
} = internalData;
|
|
281
|
+
const chartWrapper = (0, _util.getRefElem)(elemStore['main-chart-wrapper']);
|
|
282
|
+
if (chartWrapper) {
|
|
283
|
+
_xeUtils.default.arrayEach(chartWrapper.children, rowEl => {
|
|
284
|
+
const barEl = rowEl.children[0];
|
|
285
|
+
if (!barEl) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const rowid = rowEl.getAttribute('rowid');
|
|
289
|
+
const rowRest = rowid ? chartMaps[rowid] : null;
|
|
290
|
+
if (rowRest) {
|
|
291
|
+
barEl.style.left = `${viewCellWidth * rowRest.oLeftSize}px`;
|
|
292
|
+
barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return (0, _vue.nextTick)();
|
|
297
|
+
};
|
|
298
|
+
const updateStyle = () => {
|
|
299
|
+
const {
|
|
300
|
+
scrollbarWidth,
|
|
301
|
+
scrollbarHeight,
|
|
302
|
+
tableColumn
|
|
303
|
+
} = reactData;
|
|
304
|
+
const {
|
|
305
|
+
elemStore
|
|
306
|
+
} = internalData;
|
|
307
|
+
const $xeTable = internalData.xeTable;
|
|
308
|
+
const el = refElem.value;
|
|
309
|
+
if (!el || !el.clientHeight) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
313
|
+
const xLeftCornerEl = refScrollXLeftCornerElem.value;
|
|
314
|
+
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
315
|
+
const scrollXVirtualEl = refScrollXVirtualElem.value;
|
|
316
|
+
const osbWidth = scrollbarWidth;
|
|
317
|
+
const osbHeight = scrollbarHeight;
|
|
318
|
+
let tbHeight = 0;
|
|
319
|
+
let tHeaderHeight = 0;
|
|
320
|
+
let tFooterHeight = 0;
|
|
321
|
+
if ($xeTable) {
|
|
322
|
+
const tableInternalData = $xeTable.internalData;
|
|
323
|
+
tbHeight = tableInternalData.tBodyHeight;
|
|
324
|
+
tHeaderHeight = tableInternalData.tHeaderHeight;
|
|
325
|
+
tFooterHeight = tableInternalData.tFooterHeight;
|
|
326
|
+
}
|
|
327
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
328
|
+
if (headerScrollElem) {
|
|
329
|
+
headerScrollElem.style.height = `${tHeaderHeight}px`;
|
|
330
|
+
}
|
|
331
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
332
|
+
if (bodyScrollElem) {
|
|
333
|
+
bodyScrollElem.style.height = `${tbHeight}px`;
|
|
334
|
+
}
|
|
335
|
+
if (scrollXVirtualEl) {
|
|
336
|
+
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
337
|
+
scrollXVirtualEl.style.visibility = 'visible';
|
|
338
|
+
}
|
|
339
|
+
const xWrapperEl = refScrollXWrapperElem.value;
|
|
340
|
+
if (xWrapperEl) {
|
|
341
|
+
xWrapperEl.style.left = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
342
|
+
xWrapperEl.style.width = `${el.clientWidth - osbWidth}px`;
|
|
343
|
+
}
|
|
344
|
+
if (xLeftCornerEl) {
|
|
345
|
+
xLeftCornerEl.style.width = scrollbarXToTop ? `${osbWidth}px` : '';
|
|
346
|
+
xLeftCornerEl.style.display = scrollbarXToTop ? osbHeight ? 'block' : '' : '';
|
|
347
|
+
}
|
|
348
|
+
if (xRightCornerEl) {
|
|
349
|
+
xRightCornerEl.style.width = scrollbarXToTop ? '' : `${osbWidth}px`;
|
|
350
|
+
xRightCornerEl.style.display = scrollbarXToTop ? '' : osbHeight ? 'block' : '';
|
|
351
|
+
}
|
|
352
|
+
const scrollYVirtualEl = refScrollYVirtualElem.value;
|
|
353
|
+
if (scrollYVirtualEl) {
|
|
354
|
+
scrollYVirtualEl.style.width = `${osbWidth}px`;
|
|
355
|
+
scrollYVirtualEl.style.height = `${tbHeight + tHeaderHeight + tFooterHeight}px`;
|
|
356
|
+
scrollYVirtualEl.style.visibility = 'visible';
|
|
357
|
+
}
|
|
358
|
+
const yTopCornerEl = refScrollYTopCornerElem.value;
|
|
359
|
+
if (yTopCornerEl) {
|
|
360
|
+
yTopCornerEl.style.height = `${tHeaderHeight}px`;
|
|
361
|
+
yTopCornerEl.style.display = tHeaderHeight ? 'block' : '';
|
|
362
|
+
}
|
|
363
|
+
const yWrapperEl = refScrollYWrapperElem.value;
|
|
364
|
+
if (yWrapperEl) {
|
|
365
|
+
yWrapperEl.style.height = `${tbHeight}px`;
|
|
366
|
+
yWrapperEl.style.top = `${tHeaderHeight}px`;
|
|
367
|
+
}
|
|
368
|
+
const yBottomCornerEl = refScrollYBottomCornerElem.value;
|
|
369
|
+
if (yBottomCornerEl) {
|
|
370
|
+
yBottomCornerEl.style.height = `${tFooterHeight}px`;
|
|
371
|
+
yBottomCornerEl.style.top = `${tHeaderHeight + tbHeight}px`;
|
|
372
|
+
yBottomCornerEl.style.display = tFooterHeight ? 'block' : '';
|
|
373
|
+
}
|
|
374
|
+
const colInfoElem = refColInfoElem.value;
|
|
375
|
+
if (colInfoElem) {
|
|
376
|
+
reactData.viewCellWidth = colInfoElem.clientWidth || 40;
|
|
377
|
+
}
|
|
378
|
+
let viewTableWidth = reactData.viewCellWidth * tableColumn.length;
|
|
379
|
+
if (bodyScrollElem) {
|
|
380
|
+
const viewWidth = bodyScrollElem.clientWidth;
|
|
381
|
+
const remainWidth = viewWidth - viewTableWidth;
|
|
382
|
+
if (remainWidth > 0) {
|
|
383
|
+
reactData.viewCellWidth += Math.floor(remainWidth / tableColumn.length);
|
|
384
|
+
viewTableWidth = viewWidth;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
|
|
388
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
389
|
+
if (headerTableElem) {
|
|
390
|
+
headerTableElem.style.width = `${viewTableWidth}px`;
|
|
391
|
+
}
|
|
392
|
+
if (bodyTableElem) {
|
|
393
|
+
bodyTableElem.style.width = `${viewTableWidth}px`;
|
|
394
|
+
}
|
|
395
|
+
reactData.scrollXWidth = viewTableWidth;
|
|
396
|
+
return updateChart();
|
|
397
|
+
};
|
|
398
|
+
const handleLazyRecalculate = () => {
|
|
399
|
+
calcScrollbar();
|
|
400
|
+
updateStyle();
|
|
401
|
+
return (0, _vue.nextTick)();
|
|
402
|
+
};
|
|
403
|
+
const updateScrollXSpace = () => {
|
|
404
|
+
const {
|
|
405
|
+
scrollXLoad,
|
|
406
|
+
scrollXWidth
|
|
407
|
+
} = reactData;
|
|
408
|
+
const {
|
|
409
|
+
elemStore
|
|
410
|
+
} = internalData;
|
|
411
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
412
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
413
|
+
let xSpaceLeft = 0;
|
|
414
|
+
let clientWidth = 0;
|
|
415
|
+
if (bodyScrollElem) {
|
|
416
|
+
clientWidth = bodyScrollElem.clientWidth;
|
|
417
|
+
}
|
|
418
|
+
// 虚拟渲染
|
|
419
|
+
let isScrollXBig = false;
|
|
420
|
+
let ySpaceWidth = scrollXWidth;
|
|
421
|
+
if (scrollXWidth > maxXWidth) {
|
|
422
|
+
// 触右
|
|
423
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
|
|
424
|
+
xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
|
|
425
|
+
} else {
|
|
426
|
+
xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
|
|
427
|
+
}
|
|
428
|
+
ySpaceWidth = maxXWidth;
|
|
429
|
+
isScrollXBig = true;
|
|
430
|
+
}
|
|
431
|
+
if (bodyTableElem) {
|
|
432
|
+
bodyTableElem.style.transform = `translate(${xSpaceLeft}px, ${reactData.scrollYTop || 0}px)`;
|
|
433
|
+
}
|
|
434
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
435
|
+
layoutList.forEach(layout => {
|
|
436
|
+
const xSpaceElem = (0, _util.getRefElem)(elemStore[`main-${layout}-xSpace`]);
|
|
437
|
+
if (xSpaceElem) {
|
|
438
|
+
xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
reactData.scrollXLeft = xSpaceLeft;
|
|
442
|
+
reactData.scrollXWidth = ySpaceWidth;
|
|
443
|
+
reactData.isScrollXBig = isScrollXBig;
|
|
444
|
+
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
445
|
+
if (scrollXSpaceEl) {
|
|
446
|
+
scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
|
|
447
|
+
}
|
|
448
|
+
calcScrollbar();
|
|
449
|
+
return (0, _vue.nextTick)().then(() => {
|
|
450
|
+
updateStyle();
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
const updateScrollYSpace = () => {
|
|
454
|
+
const {
|
|
455
|
+
scrollYLoad,
|
|
456
|
+
overflowY
|
|
457
|
+
} = reactData;
|
|
458
|
+
const {
|
|
459
|
+
elemStore
|
|
460
|
+
} = internalData;
|
|
461
|
+
const $xeTable = internalData.xeTable;
|
|
462
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
463
|
+
const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
|
|
464
|
+
let ySpaceTop = 0;
|
|
465
|
+
let scrollYHeight = 0;
|
|
466
|
+
let isScrollYBig = false;
|
|
467
|
+
if ($xeTable) {
|
|
468
|
+
const tableReactData = $xeTable.reactData;
|
|
469
|
+
ySpaceTop = tableReactData.scrollYTop;
|
|
470
|
+
scrollYHeight = tableReactData.scrollYHeight;
|
|
471
|
+
isScrollYBig = tableReactData.isScrollYBig;
|
|
472
|
+
}
|
|
473
|
+
let ySpaceHeight = scrollYHeight;
|
|
474
|
+
let scrollYTop = ySpaceTop;
|
|
475
|
+
let clientHeight = 0;
|
|
476
|
+
if (bodyScrollElem) {
|
|
477
|
+
clientHeight = bodyScrollElem.clientHeight;
|
|
478
|
+
}
|
|
479
|
+
if (isScrollYBig) {
|
|
480
|
+
// 触底
|
|
481
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
|
|
482
|
+
scrollYTop = maxYHeight - bodyTableElem.clientHeight;
|
|
483
|
+
} else {
|
|
484
|
+
scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
|
|
485
|
+
}
|
|
486
|
+
ySpaceHeight = maxYHeight;
|
|
487
|
+
}
|
|
488
|
+
if (!(scrollYLoad && overflowY)) {
|
|
489
|
+
scrollYTop = 0;
|
|
490
|
+
}
|
|
491
|
+
if (bodyTableElem) {
|
|
492
|
+
bodyTableElem.style.transform = `translate(${reactData.scrollXLeft || 0}px, ${scrollYTop}px)`;
|
|
493
|
+
}
|
|
494
|
+
const layoutList = ['header', 'body', 'footer'];
|
|
495
|
+
layoutList.forEach(layout => {
|
|
496
|
+
const ySpaceElem = (0, _util.getRefElem)(elemStore[`main-${layout}-ySpace`]);
|
|
497
|
+
if (ySpaceElem) {
|
|
498
|
+
ySpaceElem.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
const scrollYSpaceEl = refScrollYSpaceElem.value;
|
|
502
|
+
if (scrollYSpaceEl) {
|
|
503
|
+
scrollYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
504
|
+
}
|
|
505
|
+
reactData.scrollYTop = scrollYTop;
|
|
506
|
+
reactData.scrollYHeight = scrollYHeight;
|
|
507
|
+
reactData.isScrollYBig = isScrollYBig;
|
|
508
|
+
calcScrollbar();
|
|
509
|
+
return (0, _vue.nextTick)().then(() => {
|
|
510
|
+
updateStyle();
|
|
511
|
+
});
|
|
512
|
+
};
|
|
513
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
514
|
+
const checkLastSyncScroll = (isRollX, isRollY) => {
|
|
515
|
+
const {
|
|
516
|
+
lcsTimeout
|
|
517
|
+
} = internalData;
|
|
518
|
+
reactData.lazScrollLoading = true;
|
|
519
|
+
if (lcsTimeout) {
|
|
520
|
+
clearTimeout(lcsTimeout);
|
|
521
|
+
}
|
|
522
|
+
internalData.lcsTimeout = setTimeout(() => {
|
|
523
|
+
internalData.lcsRunTime = Date.now();
|
|
524
|
+
internalData.lcsTimeout = undefined;
|
|
525
|
+
internalData.intoRunScroll = false;
|
|
526
|
+
internalData.inVirtualScroll = false;
|
|
527
|
+
internalData.inWheelScroll = false;
|
|
528
|
+
internalData.inHeaderScroll = false;
|
|
529
|
+
internalData.inBodyScroll = false;
|
|
530
|
+
internalData.inFooterScroll = false;
|
|
531
|
+
reactData.lazScrollLoading = false;
|
|
532
|
+
}, 200);
|
|
533
|
+
};
|
|
534
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
535
|
+
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
536
|
+
checkLastSyncScroll(isRollX, isRollY);
|
|
537
|
+
};
|
|
538
|
+
const ganttViewMethods = {
|
|
539
|
+
updateViewData() {
|
|
540
|
+
const $xeTable = internalData.xeTable;
|
|
541
|
+
if ($xeTable) {
|
|
542
|
+
const tableReactData = $xeTable.reactData;
|
|
543
|
+
const {
|
|
544
|
+
tableData
|
|
545
|
+
} = tableReactData;
|
|
546
|
+
reactData.tableData = tableData;
|
|
547
|
+
}
|
|
548
|
+
return (0, _vue.nextTick)();
|
|
549
|
+
},
|
|
550
|
+
connectUpdate({
|
|
551
|
+
$table
|
|
552
|
+
}) {
|
|
553
|
+
if ($table) {
|
|
554
|
+
internalData.xeTable = $table;
|
|
555
|
+
}
|
|
556
|
+
return (0, _vue.nextTick)();
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* 同步表格滚动
|
|
561
|
+
*/
|
|
562
|
+
const syncTableScrollTop = scrollTop => {
|
|
563
|
+
const $xeTable = internalData.xeTable;
|
|
564
|
+
if ($xeTable) {
|
|
565
|
+
const tableInternalData = $xeTable.internalData;
|
|
566
|
+
const {
|
|
567
|
+
elemStore: tableElemStore
|
|
568
|
+
} = tableInternalData;
|
|
569
|
+
const tableBodyScrollElem = (0, _util.getRefElem)(tableElemStore['main-body-scroll']);
|
|
570
|
+
if (tableBodyScrollElem) {
|
|
571
|
+
tableBodyScrollElem.scrollTop = scrollTop;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
const ganttViewPrivateMethods = {
|
|
576
|
+
handleUpdateStyle: updateStyle,
|
|
577
|
+
handleLazyRecalculate,
|
|
578
|
+
triggerHeaderScrollEvent(evnt) {
|
|
579
|
+
const {
|
|
580
|
+
elemStore,
|
|
581
|
+
inVirtualScroll,
|
|
582
|
+
inBodyScroll,
|
|
583
|
+
inFooterScroll
|
|
584
|
+
} = internalData;
|
|
585
|
+
if (inVirtualScroll) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
if (inBodyScroll || inFooterScroll) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const wrapperEl = evnt.currentTarget;
|
|
592
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
593
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
594
|
+
if (bodyScrollElem && wrapperEl) {
|
|
595
|
+
const isRollX = true;
|
|
596
|
+
const isRollY = false;
|
|
597
|
+
const currLeftNum = wrapperEl.scrollLeft;
|
|
598
|
+
internalData.inHeaderScroll = true;
|
|
599
|
+
(0, _dom.setScrollLeft)(xHandleEl, currLeftNum);
|
|
600
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, currLeftNum);
|
|
601
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
triggerBodyScrollEvent(evnt) {
|
|
605
|
+
const {
|
|
606
|
+
elemStore,
|
|
607
|
+
inVirtualScroll,
|
|
608
|
+
inHeaderScroll,
|
|
609
|
+
inFooterScroll
|
|
610
|
+
} = internalData;
|
|
611
|
+
if (inVirtualScroll) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (inHeaderScroll || inFooterScroll) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const wrapperEl = evnt.currentTarget;
|
|
618
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
619
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
620
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
621
|
+
if (headerScrollElem && wrapperEl) {
|
|
622
|
+
const isRollX = true;
|
|
623
|
+
const isRollY = true;
|
|
624
|
+
const currLeftNum = wrapperEl.scrollLeft;
|
|
625
|
+
const currTopNum = wrapperEl.scrollTop;
|
|
626
|
+
internalData.inBodyScroll = true;
|
|
627
|
+
(0, _dom.setScrollLeft)(xHandleEl, currLeftNum);
|
|
628
|
+
(0, _dom.setScrollLeft)(headerScrollElem, currLeftNum);
|
|
629
|
+
(0, _dom.setScrollTop)(yHandleEl, currTopNum);
|
|
630
|
+
syncTableScrollTop(currTopNum);
|
|
631
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
triggerFooterScrollEvent(evnt) {
|
|
635
|
+
const {
|
|
636
|
+
inVirtualScroll,
|
|
637
|
+
inHeaderScroll,
|
|
638
|
+
inBodyScroll
|
|
639
|
+
} = internalData;
|
|
640
|
+
if (inVirtualScroll) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (inHeaderScroll || inBodyScroll) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
const wrapperEl = evnt.currentTarget;
|
|
647
|
+
if (wrapperEl) {
|
|
648
|
+
const isRollX = true;
|
|
649
|
+
const isRollY = false;
|
|
650
|
+
const currLeftNum = wrapperEl.scrollLeft;
|
|
651
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
triggerVirtualScrollXEvent(evnt) {
|
|
655
|
+
const {
|
|
656
|
+
elemStore,
|
|
657
|
+
inHeaderScroll,
|
|
658
|
+
inBodyScroll
|
|
659
|
+
} = internalData;
|
|
660
|
+
if (inHeaderScroll || inBodyScroll) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
const wrapperEl = evnt.currentTarget;
|
|
664
|
+
const headerScrollElem = (0, _util.getRefElem)(elemStore['main-header-scroll']);
|
|
665
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
666
|
+
if (wrapperEl) {
|
|
667
|
+
const isRollY = false;
|
|
668
|
+
const isRollX = true;
|
|
669
|
+
const currLeftNum = wrapperEl.scrollLeft;
|
|
670
|
+
internalData.inVirtualScroll = true;
|
|
671
|
+
(0, _dom.setScrollLeft)(headerScrollElem, currLeftNum);
|
|
672
|
+
(0, _dom.setScrollLeft)(bodyScrollElem, currLeftNum);
|
|
673
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, currLeftNum);
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
triggerVirtualScrollYEvent(evnt) {
|
|
677
|
+
const {
|
|
678
|
+
elemStore,
|
|
679
|
+
inHeaderScroll,
|
|
680
|
+
inBodyScroll
|
|
681
|
+
} = internalData;
|
|
682
|
+
if (inHeaderScroll || inBodyScroll) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const wrapperEl = evnt.currentTarget;
|
|
686
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
687
|
+
if (wrapperEl) {
|
|
688
|
+
const isRollY = true;
|
|
689
|
+
const isRollX = false;
|
|
690
|
+
const currTopNum = wrapperEl.scrollTop;
|
|
691
|
+
internalData.inVirtualScroll = true;
|
|
692
|
+
(0, _dom.setScrollTop)(bodyScrollElem, currTopNum);
|
|
693
|
+
syncTableScrollTop(currTopNum);
|
|
694
|
+
handleScrollEvent(evnt, isRollY, isRollX, currTopNum, wrapperEl.scrollLeft);
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
updateScrollXSpace,
|
|
698
|
+
updateScrollYSpace
|
|
699
|
+
};
|
|
700
|
+
const handleGlobalResizeEvent = () => {
|
|
701
|
+
handleLazyRecalculate();
|
|
702
|
+
};
|
|
703
|
+
Object.assign($xeGanttView, ganttViewMethods, ganttViewPrivateMethods);
|
|
704
|
+
const renderScrollX = () => {
|
|
705
|
+
return (0, _vue.h)('div', {
|
|
706
|
+
key: 'vsx',
|
|
707
|
+
ref: refScrollXVirtualElem,
|
|
708
|
+
class: 'vxe-gantt-view--scroll-x-virtual'
|
|
709
|
+
}, [(0, _vue.h)('div', {
|
|
710
|
+
ref: refScrollXLeftCornerElem,
|
|
711
|
+
class: 'vxe-gantt-view--scroll-x-left-corner'
|
|
712
|
+
}), (0, _vue.h)('div', {
|
|
713
|
+
ref: refScrollXWrapperElem,
|
|
714
|
+
class: 'vxe-gantt-view--scroll-x-wrapper'
|
|
715
|
+
}, [(0, _vue.h)('div', {
|
|
716
|
+
ref: refScrollXHandleElem,
|
|
717
|
+
class: 'vxe-gantt-view--scroll-x-handle',
|
|
718
|
+
onScroll: $xeGanttView.triggerVirtualScrollXEvent
|
|
719
|
+
}, [(0, _vue.h)('div', {
|
|
720
|
+
ref: refScrollXSpaceElem,
|
|
721
|
+
class: 'vxe-gantt-view--scroll-x-space'
|
|
722
|
+
})])]), (0, _vue.h)('div', {
|
|
723
|
+
ref: refScrollXRightCornerElem,
|
|
724
|
+
class: 'vxe-gantt-view--scroll-x-right-corner'
|
|
725
|
+
})]);
|
|
726
|
+
};
|
|
727
|
+
const renderScrollY = () => {
|
|
728
|
+
return (0, _vue.h)('div', {
|
|
729
|
+
ref: refScrollYVirtualElem,
|
|
730
|
+
class: 'vxe-gantt-view--scroll-y-virtual'
|
|
731
|
+
}, [(0, _vue.h)('div', {
|
|
732
|
+
ref: refScrollYTopCornerElem,
|
|
733
|
+
class: 'vxe-gantt-view--scroll-y-top-corner'
|
|
734
|
+
}), (0, _vue.h)('div', {
|
|
735
|
+
ref: refScrollYWrapperElem,
|
|
736
|
+
class: 'vxe-gantt-view--scroll-y-wrapper'
|
|
737
|
+
}, [(0, _vue.h)('div', {
|
|
738
|
+
ref: refScrollYHandleElem,
|
|
739
|
+
class: 'vxe-gantt-view--scroll-y-handle',
|
|
740
|
+
onScroll: $xeGanttView.triggerVirtualScrollYEvent
|
|
741
|
+
}, [(0, _vue.h)('div', {
|
|
742
|
+
ref: refScrollYSpaceElem,
|
|
743
|
+
class: 'vxe-gantt-view--scroll-y-space'
|
|
744
|
+
})])]), (0, _vue.h)('div', {
|
|
745
|
+
ref: refScrollYBottomCornerElem,
|
|
746
|
+
class: 'vxe-gantt-view--scroll-y-bottom-corner'
|
|
747
|
+
})]);
|
|
748
|
+
};
|
|
749
|
+
const renderViewport = () => {
|
|
750
|
+
return (0, _vue.h)('div', {
|
|
751
|
+
class: 'vxe-gantt-view--viewport-wrapper'
|
|
752
|
+
}, [(0, _vue.h)(_ganttHeader.default), (0, _vue.h)(_ganttBody.default)]);
|
|
753
|
+
};
|
|
754
|
+
const renderBody = () => {
|
|
755
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
756
|
+
return (0, _vue.h)('div', {
|
|
757
|
+
class: 'vxe-gantt-view--layout-wrapper'
|
|
758
|
+
}, scrollbarYToLeft ? [renderScrollY(), renderViewport()] : [renderViewport(), renderScrollY()]);
|
|
759
|
+
};
|
|
760
|
+
const renderVN = () => {
|
|
761
|
+
const {
|
|
762
|
+
overflowX,
|
|
763
|
+
overflowY,
|
|
764
|
+
scrollXLoad,
|
|
765
|
+
scrollYLoad
|
|
766
|
+
} = reactData;
|
|
767
|
+
const taskViewOpts = computeTaskViewOpts.value;
|
|
768
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
769
|
+
return (0, _vue.h)('div', {
|
|
770
|
+
ref: refElem,
|
|
771
|
+
class: ['vxe-gantt-view', `mode--${taskViewOpts.mode || 'day'}`, {
|
|
772
|
+
'is--scroll-y': overflowY,
|
|
773
|
+
'is--scroll-x': overflowX,
|
|
774
|
+
'is--virtual-x': scrollXLoad,
|
|
775
|
+
'is--virtual-y': scrollYLoad
|
|
776
|
+
}]
|
|
777
|
+
}, [(0, _vue.h)('div', {
|
|
778
|
+
class: 'vxe-gantt-view--render-wrapper'
|
|
779
|
+
}, scrollbarXToTop ? [renderScrollX(), renderBody()] : [renderBody(), renderScrollX()]), (0, _vue.h)('div', {
|
|
780
|
+
class: 'vxe-gantt-view--render-vars'
|
|
781
|
+
}, [(0, _vue.h)('div', {
|
|
782
|
+
ref: refColInfoElem,
|
|
783
|
+
class: 'vxe-gantt-view--column-info'
|
|
784
|
+
})])]);
|
|
785
|
+
};
|
|
786
|
+
const tdFlag = (0, _vue.ref)(0);
|
|
787
|
+
(0, _vue.watch)(() => reactData.tableData, () => {
|
|
788
|
+
tdFlag.value++;
|
|
789
|
+
});
|
|
790
|
+
(0, _vue.watch)(() => reactData.tableData.length, () => {
|
|
791
|
+
tdFlag.value++;
|
|
792
|
+
});
|
|
793
|
+
(0, _vue.watch)(tdFlag, () => {
|
|
794
|
+
handleUpdateData();
|
|
795
|
+
});
|
|
796
|
+
(0, _vue.onMounted)(() => {
|
|
797
|
+
globalEvents.on($xeGanttView, 'resize', handleGlobalResizeEvent);
|
|
798
|
+
});
|
|
799
|
+
(0, _vue.onUnmounted)(() => {
|
|
800
|
+
globalEvents.off($xeGanttView, 'keydown');
|
|
801
|
+
_xeUtils.default.assign(internalData, createInternalData());
|
|
802
|
+
});
|
|
803
|
+
$xeGanttView.renderVN = renderVN;
|
|
804
|
+
(0, _vue.provide)('$xeGanttView', $xeGanttView);
|
|
805
|
+
return $xeGanttView;
|
|
806
|
+
},
|
|
807
|
+
render() {
|
|
808
|
+
return this.renderVN();
|
|
809
|
+
}
|
|
810
|
+
});
|