vxe-gantt 4.1.0 → 4.1.2
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/emits.js +2 -0
- package/es/gantt/src/gantt-body.js +25 -3
- package/es/gantt/src/gantt-chart.js +41 -21
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +138 -8
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/emits.js +1 -1
- package/lib/gantt/src/emits.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +8 -1
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +43 -18
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +9 -7
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +5 -2
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +146 -6
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +216 -35
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +4 -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 +2 -2
- package/packages/gantt/src/emits.ts +2 -0
- package/packages/gantt/src/gantt-body.ts +25 -3
- package/packages/gantt/src/gantt-chart.ts +47 -16
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +146 -8
- package/packages/ui/index.ts +3 -0
package/es/gantt/src/emits.js
CHANGED
|
@@ -11,7 +11,7 @@ export default defineVxeComponent({
|
|
|
11
11
|
setup() {
|
|
12
12
|
const $xeGantt = inject('$xeGantt', {});
|
|
13
13
|
const $xeGanttView = inject('$xeGanttView', {});
|
|
14
|
-
const { computeTaskViewOpts } = $xeGantt.getComputeMaps();
|
|
14
|
+
const { computeTaskViewOpts, computeScaleUnit } = $xeGantt.getComputeMaps();
|
|
15
15
|
const { reactData, internalData } = $xeGanttView;
|
|
16
16
|
const refElem = ref();
|
|
17
17
|
const refBodyScroll = ref();
|
|
@@ -33,6 +33,7 @@ export default defineVxeComponent({
|
|
|
33
33
|
const { todayDateMaps } = internalData;
|
|
34
34
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
35
35
|
const { showNowLine, viewStyle } = taskViewOpts;
|
|
36
|
+
const scaleUnit = computeScaleUnit.value;
|
|
36
37
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
|
|
37
38
|
const { field, dateObj } = column;
|
|
38
39
|
const { cellClassName, cellStyle } = viewStyle || {};
|
|
@@ -74,7 +75,18 @@ export default defineVxeComponent({
|
|
|
74
75
|
onDblclick: (evnt) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
|
|
75
76
|
}));
|
|
76
77
|
}
|
|
77
|
-
const ctParams = {
|
|
78
|
+
const ctParams = {
|
|
79
|
+
$gantt: $xeGantt,
|
|
80
|
+
source: sourceType,
|
|
81
|
+
type: viewType,
|
|
82
|
+
scaleType: scaleUnit,
|
|
83
|
+
dateObj,
|
|
84
|
+
row,
|
|
85
|
+
column,
|
|
86
|
+
$rowIndex,
|
|
87
|
+
rowIndex,
|
|
88
|
+
_rowIndex
|
|
89
|
+
};
|
|
78
90
|
return h('td', {
|
|
79
91
|
key: $columnIndex,
|
|
80
92
|
class: [
|
|
@@ -117,6 +129,7 @@ export default defineVxeComponent({
|
|
|
117
129
|
const treeOpts = computeTreeOpts.value;
|
|
118
130
|
const { transform } = treeOpts;
|
|
119
131
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
132
|
+
const scaleUnit = computeScaleUnit.value;
|
|
120
133
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
121
134
|
const { viewStyle } = taskViewOpts;
|
|
122
135
|
const { rowClassName, rowStyle } = viewStyle || {};
|
|
@@ -152,7 +165,16 @@ export default defineVxeComponent({
|
|
|
152
165
|
trOns.onDragend = $xeTable.handleRowDragDragendEvent;
|
|
153
166
|
trOns.onDragover = $xeTable.handleRowDragDragoverEvent;
|
|
154
167
|
}
|
|
155
|
-
const rowParams = {
|
|
168
|
+
const rowParams = {
|
|
169
|
+
$gantt: $xeGantt,
|
|
170
|
+
source: sourceType,
|
|
171
|
+
type: viewType,
|
|
172
|
+
scaleType: scaleUnit,
|
|
173
|
+
row,
|
|
174
|
+
rowIndex,
|
|
175
|
+
$rowIndex,
|
|
176
|
+
_rowIndex
|
|
177
|
+
};
|
|
156
178
|
trVNs.push(h('tr', Object.assign({ key: treeConfig ? rowid : $rowIndex, class: [
|
|
157
179
|
'vxe-gantt-view--body-row',
|
|
158
180
|
{
|
|
@@ -13,7 +13,7 @@ export default defineVxeComponent({
|
|
|
13
13
|
const $xeGantt = inject('$xeGantt', {});
|
|
14
14
|
const $xeGanttView = inject('$xeGanttView', {});
|
|
15
15
|
const { reactData, internalData } = $xeGanttView;
|
|
16
|
-
const { computeProgressField, computeTitleField, computeTaskBarOpts } = $xeGantt.getComputeMaps();
|
|
16
|
+
const { computeProgressField, computeTitleField, computeTaskBarOpts, computeScaleUnit } = $xeGantt.getComputeMaps();
|
|
17
17
|
const refElem = ref();
|
|
18
18
|
const renderTaskBar = ($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex) => {
|
|
19
19
|
const tableProps = $xeTable.props;
|
|
@@ -31,8 +31,9 @@ export default defineVxeComponent({
|
|
|
31
31
|
const titleField = computeTitleField.value;
|
|
32
32
|
const progressField = computeProgressField.value;
|
|
33
33
|
const taskBarOpts = computeTaskBarOpts.value;
|
|
34
|
-
const
|
|
35
|
-
const {
|
|
34
|
+
const scaleUnit = computeScaleUnit.value;
|
|
35
|
+
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit };
|
|
36
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts;
|
|
36
37
|
const isBarRowStyle = XEUtils.isFunction(barStyle);
|
|
37
38
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {};
|
|
38
39
|
const { round } = barStyObj;
|
|
@@ -56,9 +57,43 @@ export default defineVxeComponent({
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
if (contentMethod) {
|
|
59
|
-
title = getStringValue(contentMethod({ row, title }));
|
|
60
|
+
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }));
|
|
61
|
+
}
|
|
62
|
+
const ctParams = {
|
|
63
|
+
$gantt: $xeGantt,
|
|
64
|
+
source: sourceType,
|
|
65
|
+
type: viewType,
|
|
66
|
+
scaleType: scaleUnit,
|
|
67
|
+
row,
|
|
68
|
+
$rowIndex,
|
|
69
|
+
rowIndex,
|
|
70
|
+
_rowIndex
|
|
71
|
+
};
|
|
72
|
+
const ons = {
|
|
73
|
+
onClick(evnt) {
|
|
74
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
75
|
+
},
|
|
76
|
+
onDblclick(evnt) {
|
|
77
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
78
|
+
},
|
|
79
|
+
onMousedown(evnt) {
|
|
80
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
81
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (showTooltip) {
|
|
86
|
+
ons.onMouseover = (evnt) => {
|
|
87
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams);
|
|
88
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
|
|
89
|
+
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
|
|
90
|
+
};
|
|
91
|
+
ons.onMouseleave = (evnt) => {
|
|
92
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams);
|
|
93
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
|
|
94
|
+
$xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
|
|
95
|
+
};
|
|
60
96
|
}
|
|
61
|
-
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex };
|
|
62
97
|
return h('div', {
|
|
63
98
|
key: treeConfig ? rowid : $rowIndex,
|
|
64
99
|
rowid,
|
|
@@ -74,22 +109,7 @@ export default defineVxeComponent({
|
|
|
74
109
|
$xeGantt.handleTaskBarContextmenuEvent(evnt, ctParams);
|
|
75
110
|
}
|
|
76
111
|
}, [
|
|
77
|
-
h('div', {
|
|
78
|
-
class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
|
|
79
|
-
style: vbStyle,
|
|
80
|
-
rowid,
|
|
81
|
-
onClick(evnt) {
|
|
82
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
83
|
-
},
|
|
84
|
-
onDblclick(evnt) {
|
|
85
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
86
|
-
},
|
|
87
|
-
onMousedown(evnt) {
|
|
88
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
89
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, taskBarSlot
|
|
112
|
+
h('div', Object.assign({ class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', style: vbStyle, rowid }, ons), taskBarSlot
|
|
93
113
|
? $xeGantt.callSlot(taskBarSlot, barParams)
|
|
94
114
|
: [
|
|
95
115
|
showProgress
|
|
@@ -56,18 +56,21 @@ export default defineVxeComponent({
|
|
|
56
56
|
}, columns.map((column, cIndex) => {
|
|
57
57
|
const { field, childCount, dateObj } = column;
|
|
58
58
|
let label = `${column.title}`;
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
|
|
65
|
-
}
|
|
59
|
+
if (scaleItem.type === 'day') {
|
|
60
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
66
61
|
}
|
|
67
62
|
else {
|
|
68
|
-
if (
|
|
63
|
+
if ($rowIndex) {
|
|
69
64
|
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
70
65
|
}
|
|
66
|
+
else {
|
|
67
|
+
if (isLast && scaleItem.type === 'week') {
|
|
68
|
+
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
let cellVNs = label;
|
|
73
76
|
const ctParams = { source: sourceType, type: viewType, column, scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex };
|
|
@@ -306,7 +306,7 @@ export default defineVxeComponent({
|
|
|
306
306
|
if (minScale.level < 17) {
|
|
307
307
|
handleData('quarter', colMaps, minCol);
|
|
308
308
|
}
|
|
309
|
-
if (minScale.level <
|
|
309
|
+
if (minScale.level < 15) {
|
|
310
310
|
handleData('month', colMaps, minCol);
|
|
311
311
|
}
|
|
312
312
|
if (minScale.level < 13) {
|
|
@@ -315,7 +315,7 @@ export default defineVxeComponent({
|
|
|
315
315
|
if (minScale.level < 11) {
|
|
316
316
|
handleData('day', colMaps, minCol);
|
|
317
317
|
}
|
|
318
|
-
if (minScale.level <
|
|
318
|
+
if (minScale.level < 9) {
|
|
319
319
|
handleData('date', colMaps, minCol);
|
|
320
320
|
}
|
|
321
321
|
if (minScale.level < 7) {
|
|
@@ -324,6 +324,9 @@ export default defineVxeComponent({
|
|
|
324
324
|
if (minScale.level < 5) {
|
|
325
325
|
handleData('minute', colMaps, minCol);
|
|
326
326
|
}
|
|
327
|
+
if (minScale.level < 3) {
|
|
328
|
+
handleData('second', colMaps, minCol);
|
|
329
|
+
}
|
|
327
330
|
fullCols.push(minCol);
|
|
328
331
|
}
|
|
329
332
|
taskScaleList.forEach(scaleItem => {
|
package/es/gantt/src/gantt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, ref, computed, provide, reactive, onUnmounted, watch, nextTick, onMounted } from 'vue';
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import XEUtils from 'xe-utils';
|
|
4
|
-
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils';
|
|
4
|
+
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils';
|
|
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';
|
|
@@ -19,6 +19,7 @@ function createInternalData() {
|
|
|
19
19
|
return {
|
|
20
20
|
uFoot: false,
|
|
21
21
|
resizeTableWidth: 0
|
|
22
|
+
// barTipTimeout: undefined
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
const viewTypeLevelMaps = {
|
|
@@ -38,7 +39,7 @@ function getViewTypeLevel(type) {
|
|
|
38
39
|
export default defineVxeComponent({
|
|
39
40
|
name: 'VxeGantt',
|
|
40
41
|
mixins: [],
|
|
41
|
-
props: Object.assign(Object.assign({}, tableProps), { columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, layouts: Array, taskConfig: Object, taskViewScaleConfig: Object, taskViewConfig: Object, taskBarConfig: Object, taskSplitConfig: Object, taskBarResizeConfig: Object, taskBarDragConfig: Object, size: {
|
|
42
|
+
props: Object.assign(Object.assign({}, tableProps), { columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, layouts: Array, taskConfig: Object, taskViewScaleConfig: Object, taskViewConfig: Object, taskBarConfig: Object, taskBarTooltipConfig: Object, taskSplitConfig: Object, taskBarResizeConfig: Object, taskBarDragConfig: Object, size: {
|
|
42
43
|
type: String,
|
|
43
44
|
default: () => getConfig().gantt.size || getConfig().size
|
|
44
45
|
} }),
|
|
@@ -52,6 +53,7 @@ export default defineVxeComponent({
|
|
|
52
53
|
const VxeUIPagerComponent = VxeUI.getComponent('VxePager');
|
|
53
54
|
const VxeTableComponent = VxeUI.getComponent('VxeTable');
|
|
54
55
|
const VxeToolbarComponent = VxeUI.getComponent('VxeToolbar');
|
|
56
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
55
57
|
const { computeSize } = useFns.useSize(props);
|
|
56
58
|
const reactData = reactive({
|
|
57
59
|
tableLoading: false,
|
|
@@ -70,7 +72,13 @@ export default defineVxeComponent({
|
|
|
70
72
|
},
|
|
71
73
|
showLeftView: true,
|
|
72
74
|
showRightView: true,
|
|
73
|
-
taskScaleList: []
|
|
75
|
+
taskScaleList: [],
|
|
76
|
+
barTipStore: {
|
|
77
|
+
row: null,
|
|
78
|
+
content: '',
|
|
79
|
+
visible: false,
|
|
80
|
+
params: null
|
|
81
|
+
}
|
|
74
82
|
});
|
|
75
83
|
const internalData = createInternalData();
|
|
76
84
|
const refElem = ref();
|
|
@@ -89,6 +97,7 @@ export default defineVxeComponent({
|
|
|
89
97
|
const refPagerWrapper = ref();
|
|
90
98
|
const refTableWrapper = ref();
|
|
91
99
|
const refGanttWrapper = ref();
|
|
100
|
+
const refTooltip = ref();
|
|
92
101
|
const refResizableSplitTip = ref();
|
|
93
102
|
const extendTableMethods = (methodKeys) => {
|
|
94
103
|
const funcs = {};
|
|
@@ -155,6 +164,9 @@ export default defineVxeComponent({
|
|
|
155
164
|
const computeTaskSplitOpts = computed(() => {
|
|
156
165
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
|
|
157
166
|
});
|
|
167
|
+
const computeTaskBarTooltipOpts = computed(() => {
|
|
168
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig);
|
|
169
|
+
});
|
|
158
170
|
const computeScaleUnit = computed(() => {
|
|
159
171
|
const minScale = computeMinScale.value;
|
|
160
172
|
return minScale ? minScale.type : 'date';
|
|
@@ -167,7 +179,7 @@ export default defineVxeComponent({
|
|
|
167
179
|
const { taskScaleList } = reactData;
|
|
168
180
|
return taskScaleList.find(item => item.type === 'week');
|
|
169
181
|
});
|
|
170
|
-
const
|
|
182
|
+
const computeTaskViewScales = computed(() => {
|
|
171
183
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
172
184
|
const { scales } = taskViewOpts;
|
|
173
185
|
return scales;
|
|
@@ -384,7 +396,8 @@ export default defineVxeComponent({
|
|
|
384
396
|
computeTaskBarDragOpts,
|
|
385
397
|
computeTaskBarResizeOpts,
|
|
386
398
|
computeTaskSplitOpts,
|
|
387
|
-
|
|
399
|
+
computeTaskBarTooltipOpts,
|
|
400
|
+
computeTaskViewScales,
|
|
388
401
|
computeScaleUnit,
|
|
389
402
|
computeMinScale,
|
|
390
403
|
computeWeekScale,
|
|
@@ -396,6 +409,7 @@ export default defineVxeComponent({
|
|
|
396
409
|
computeScrollbarXToTop,
|
|
397
410
|
computeScrollbarYToLeft
|
|
398
411
|
};
|
|
412
|
+
computeMaps.computeTaskScaleConfs = computeTaskViewScales;
|
|
399
413
|
const $xeGantt = {
|
|
400
414
|
xID,
|
|
401
415
|
props: props,
|
|
@@ -406,7 +420,7 @@ export default defineVxeComponent({
|
|
|
406
420
|
getComputeMaps: () => computeMaps
|
|
407
421
|
};
|
|
408
422
|
const handleTaskScaleConfig = () => {
|
|
409
|
-
const taskScaleConfs =
|
|
423
|
+
const taskScaleConfs = computeTaskViewScales.value;
|
|
410
424
|
const taskViewScaleOpts = computeTaskViewScaleOpts.value;
|
|
411
425
|
const scaleConfs = [];
|
|
412
426
|
if (taskScaleConfs) {
|
|
@@ -860,6 +874,18 @@ export default defineVxeComponent({
|
|
|
860
874
|
const dispatchEvent = (type, params, evnt) => {
|
|
861
875
|
emit(type, createEvent(evnt, { $grid: null, $gantt: $xeGantt }, params));
|
|
862
876
|
};
|
|
877
|
+
const handleTargetEnterEvent = (isClear) => {
|
|
878
|
+
const $tooltip = refTooltip.value;
|
|
879
|
+
clearTimeout(internalData.barTipTimeout);
|
|
880
|
+
if (isClear) {
|
|
881
|
+
$xeGantt.closeTaskBarTooltip();
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
if ($tooltip && $tooltip.setActived) {
|
|
885
|
+
$tooltip.setActived(true);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
};
|
|
863
889
|
const ganttMethods = {
|
|
864
890
|
dispatchEvent,
|
|
865
891
|
getEl() {
|
|
@@ -1475,6 +1501,25 @@ export default defineVxeComponent({
|
|
|
1475
1501
|
hideTaskView() {
|
|
1476
1502
|
reactData.showRightView = false;
|
|
1477
1503
|
return nextTick();
|
|
1504
|
+
},
|
|
1505
|
+
/**
|
|
1506
|
+
* 关闭 bar tooltip
|
|
1507
|
+
*/
|
|
1508
|
+
closeTaskBarTooltip() {
|
|
1509
|
+
const { barTipStore } = reactData;
|
|
1510
|
+
const $tooltip = refTooltip.value;
|
|
1511
|
+
if (barTipStore.visible) {
|
|
1512
|
+
Object.assign(barTipStore, {
|
|
1513
|
+
row: null,
|
|
1514
|
+
content: null,
|
|
1515
|
+
visible: false,
|
|
1516
|
+
params: {}
|
|
1517
|
+
});
|
|
1518
|
+
if ($tooltip && $tooltip.close) {
|
|
1519
|
+
$tooltip.close();
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
return nextTick();
|
|
1478
1523
|
}
|
|
1479
1524
|
};
|
|
1480
1525
|
const ganttPrivateMethods = {
|
|
@@ -1592,6 +1637,57 @@ export default defineVxeComponent({
|
|
|
1592
1637
|
handleTaskBarDblclickEvent(evnt, params) {
|
|
1593
1638
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
|
|
1594
1639
|
},
|
|
1640
|
+
triggerTaskBarTooltipEvent(evnt, params) {
|
|
1641
|
+
const { barTipStore } = reactData;
|
|
1642
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
|
|
1643
|
+
const titleField = computeTitleField.value;
|
|
1644
|
+
const { contentMethod } = taskBarTooltipOpts;
|
|
1645
|
+
const { row } = params;
|
|
1646
|
+
let content = formatText(XEUtils.get(row, titleField));
|
|
1647
|
+
if (contentMethod) {
|
|
1648
|
+
const customContnet = contentMethod(params);
|
|
1649
|
+
if (!XEUtils.eqNull(customContnet)) {
|
|
1650
|
+
content = `${customContnet}`;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
handleTargetEnterEvent(barTipStore.row !== row);
|
|
1654
|
+
const tipContent = formatText(content);
|
|
1655
|
+
Object.assign(barTipStore, {
|
|
1656
|
+
row,
|
|
1657
|
+
visible: true,
|
|
1658
|
+
content: tipContent,
|
|
1659
|
+
params
|
|
1660
|
+
});
|
|
1661
|
+
nextTick(() => {
|
|
1662
|
+
const $tooltip = refTooltip.value;
|
|
1663
|
+
if ($tooltip) {
|
|
1664
|
+
if ($tooltip.openByEvent) {
|
|
1665
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
|
|
1666
|
+
}
|
|
1667
|
+
else if ($tooltip.open) {
|
|
1668
|
+
$tooltip.open(evnt.currentTarget, tipContent);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
},
|
|
1673
|
+
handleTaskBarTooltipLeaveEvent() {
|
|
1674
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
|
|
1675
|
+
let $tooltip = refTooltip.value;
|
|
1676
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1677
|
+
$tooltip.setActived(false);
|
|
1678
|
+
}
|
|
1679
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1680
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1681
|
+
$tooltip = refTooltip.value;
|
|
1682
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1683
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1684
|
+
}
|
|
1685
|
+
}, taskBarTooltipOpts.leaveDelay);
|
|
1686
|
+
}
|
|
1687
|
+
else {
|
|
1688
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1689
|
+
}
|
|
1690
|
+
},
|
|
1595
1691
|
handleTaskHeaderContextmenuEvent(evnt, params) {
|
|
1596
1692
|
const $xeTable = refTable.value;
|
|
1597
1693
|
if ($xeTable) {
|
|
@@ -2009,10 +2105,13 @@ export default defineVxeComponent({
|
|
|
2009
2105
|
return childVNs;
|
|
2010
2106
|
};
|
|
2011
2107
|
const renderLayout = () => {
|
|
2108
|
+
const { barTipStore } = reactData;
|
|
2012
2109
|
const currLayoutConf = computeCurrLayoutConf.value;
|
|
2013
2110
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf;
|
|
2111
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
|
|
2014
2112
|
const asideLeftSlot = slots.asideLeft || slots['aside-left'];
|
|
2015
2113
|
const asideRightSlot = slots.asideRight || slots['aside-right'];
|
|
2114
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
|
|
2016
2115
|
return [
|
|
2017
2116
|
h('div', {
|
|
2018
2117
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2039,7 +2138,38 @@ export default defineVxeComponent({
|
|
|
2039
2138
|
}, renderChildLayout(footKeys)),
|
|
2040
2139
|
h('div', {
|
|
2041
2140
|
ref: refPopupContainerElem
|
|
2042
|
-
})
|
|
2141
|
+
}),
|
|
2142
|
+
h('div', {}, [
|
|
2143
|
+
/**
|
|
2144
|
+
* 任务条提示
|
|
2145
|
+
*/
|
|
2146
|
+
h(VxeUITooltipComponent, {
|
|
2147
|
+
key: 'gtp',
|
|
2148
|
+
ref: refTooltip,
|
|
2149
|
+
theme: taskBarTooltipOpts.theme,
|
|
2150
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2151
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2152
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2153
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2154
|
+
width: taskBarTooltipOpts.width,
|
|
2155
|
+
height: taskBarTooltipOpts.height,
|
|
2156
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2157
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2158
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2159
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2160
|
+
isArrow: false
|
|
2161
|
+
}, taskBarTooltipSlot
|
|
2162
|
+
? {
|
|
2163
|
+
content: () => {
|
|
2164
|
+
const { row, content: tooltipContent } = barTipStore;
|
|
2165
|
+
if (row) {
|
|
2166
|
+
return h('div', {}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)));
|
|
2167
|
+
}
|
|
2168
|
+
return renderEmptyElement($xeGantt);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
: {})
|
|
2172
|
+
])
|
|
2043
2173
|
];
|
|
2044
2174
|
};
|
|
2045
2175
|
const renderVN = () => {
|
|
@@ -2088,7 +2218,7 @@ export default defineVxeComponent({
|
|
|
2088
2218
|
watch(() => props.proxyConfig, () => {
|
|
2089
2219
|
initProxy();
|
|
2090
2220
|
});
|
|
2091
|
-
watch(
|
|
2221
|
+
watch(computeTaskViewScales, () => {
|
|
2092
2222
|
handleTaskScaleConfig();
|
|
2093
2223
|
$xeGantt.refreshTaskView();
|
|
2094
2224
|
});
|
package/es/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { errLog } from './src/log';
|
|
3
3
|
const { setConfig, setIcon, checkVersion } = VxeUI;
|
|
4
|
-
VxeUI.ganttVersion = "4.1.
|
|
4
|
+
VxeUI.ganttVersion = "4.1.2";
|
|
5
5
|
setConfig({
|
|
6
6
|
gantt: {
|
|
7
7
|
// size: null,
|
|
@@ -40,6 +40,9 @@ setConfig({
|
|
|
40
40
|
// beforeSave: null,
|
|
41
41
|
// afterSave: null
|
|
42
42
|
},
|
|
43
|
+
taskBarTooltipConfig: {
|
|
44
|
+
enterable: true
|
|
45
|
+
},
|
|
43
46
|
taskViewScaleConfig: {
|
|
44
47
|
week: {
|
|
45
48
|
startDay: 1
|
package/es/ui/src/log.js
CHANGED
package/lib/gantt/src/emits.js
CHANGED
|
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ganttEmits = void 0;
|
|
7
7
|
var _gridEmits = require("./grid-emits");
|
|
8
|
-
const ganttEmits = exports.ganttEmits = [..._gridEmits.gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-click', 'task-bar-dblclick', 'task-view-cell-click', 'task-view-cell-dblclick'];
|
|
8
|
+
const ganttEmits = exports.ganttEmits = [..._gridEmits.gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-mouseenter', 'task-bar-mouseleave', 'task-bar-click', 'task-bar-dblclick', 'task-view-cell-click', 'task-view-cell-dblclick'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.ganttEmits=void 0;var _gridEmits=require("./grid-emits");let ganttEmits=exports.ganttEmits=[..._gridEmits.gridEmits,"task-cell-click","task-cell-dblclick","task-bar-click","task-bar-dblclick","task-view-cell-click","task-view-cell-dblclick"];
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.ganttEmits=void 0;var _gridEmits=require("./grid-emits");let ganttEmits=exports.ganttEmits=[..._gridEmits.gridEmits,"task-cell-click","task-cell-dblclick","task-bar-mouseenter","task-bar-mouseleave","task-bar-click","task-bar-dblclick","task-view-cell-click","task-view-cell-dblclick"];
|
|
@@ -19,7 +19,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
19
19
|
const $xeGantt = (0, _vue.inject)('$xeGantt', {});
|
|
20
20
|
const $xeGanttView = (0, _vue.inject)('$xeGanttView', {});
|
|
21
21
|
const {
|
|
22
|
-
computeTaskViewOpts
|
|
22
|
+
computeTaskViewOpts,
|
|
23
|
+
computeScaleUnit
|
|
23
24
|
} = $xeGantt.getComputeMaps();
|
|
24
25
|
const {
|
|
25
26
|
reactData,
|
|
@@ -64,6 +65,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
64
65
|
showNowLine,
|
|
65
66
|
viewStyle
|
|
66
67
|
} = taskViewOpts;
|
|
68
|
+
const scaleUnit = computeScaleUnit.value;
|
|
67
69
|
const {
|
|
68
70
|
scaleItem
|
|
69
71
|
} = headerGroups[headerGroups.length - 1] || {};
|
|
@@ -114,8 +116,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
114
116
|
}));
|
|
115
117
|
}
|
|
116
118
|
const ctParams = {
|
|
119
|
+
$gantt: $xeGantt,
|
|
117
120
|
source: sourceType,
|
|
118
121
|
type: viewType,
|
|
122
|
+
scaleType: scaleUnit,
|
|
119
123
|
dateObj,
|
|
120
124
|
row,
|
|
121
125
|
column,
|
|
@@ -186,6 +190,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
186
190
|
transform
|
|
187
191
|
} = treeOpts;
|
|
188
192
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
193
|
+
const scaleUnit = computeScaleUnit.value;
|
|
189
194
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
190
195
|
const {
|
|
191
196
|
viewStyle
|
|
@@ -233,8 +238,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
233
238
|
trOns.onDragover = $xeTable.handleRowDragDragoverEvent;
|
|
234
239
|
}
|
|
235
240
|
const rowParams = {
|
|
241
|
+
$gantt: $xeGantt,
|
|
236
242
|
source: sourceType,
|
|
237
243
|
type: viewType,
|
|
244
|
+
scaleType: scaleUnit,
|
|
238
245
|
row,
|
|
239
246
|
rowIndex,
|
|
240
247
|
$rowIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_util=require("./util"),_utils=require("../../ui/src/utils"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ganttChart=_interopRequireDefault(require("./gantt-chart"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let sourceType="gantt",viewType="body";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewBody",setup(){let
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_util=require("./util"),_utils=require("../../ui/src/utils"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ganttChart=_interopRequireDefault(require("./gantt-chart"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let sourceType="gantt",viewType="body";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewBody",setup(){let $=(0,_vue.inject)("$xeGantt",{}),o=(0,_vue.inject)("$xeGanttView",{}),{computeTaskViewOpts:q,computeScaleUnit:H}=$.getComputeMaps(),{reactData:j,internalData:R}=o,r=(0,_vue.ref)(),n=(0,_vue.ref)(),i=(0,_vue.ref)(),u=(0,_vue.ref)(),s=(0,_vue.ref)(),z=(l,a,e,o,r,n,t,i)=>{var u=l.reactData.resizeHeightFlag,{fullAllDataRowIdData:s,visibleColumn:d}=l.internalData,{computeCellOpts:v,computeRowOpts:c,computeDefaultRowHeight:p,computeResizableOpts:w}=l.getComputeMaps(),v=v.value,c=c.value,p=p.value,w=w.value.isAllRowDrag,g=j.headerGroups,h=R.todayDateMaps,{showNowLine:x,viewStyle:y}=q.value,_=H.value,g=(g[g.length-1]||{}).scaleItem,{field:m,dateObj:b}=t,{cellClassName:y,cellStyle:f}=y||{},h=x&&g?h[g.type]:null,g=s[e]||{},s=0<(u?g.resizeHeight:0),u=(0,_util.getCellRestHeight)(g,v,c,p),g=[];if(w&&c.resizable){let t={$table:l,$grid:null,$gantt:$,seq:-1,rowid:e,row:a,rowIndex:o,$rowIndex:r,_rowIndex:n,column:d[0],columnIndex:0,$columnIndex:0,_columnIndex:0,fixed:"",source:sourceType,type:viewType,isHidden:!1,isEdit:!1,level:-1,visibleData:[],data:[],items:[]};g.push((0,_vue.h)("div",{class:"vxe-gantt-view-cell--row-resizable",onMousedown:e=>l.handleRowResizeMousedownEvent(e,t),onDblclick:e=>l.handleRowResizeDblclickEvent(e,t)}))}let D={$gantt:$,source:sourceType,type:viewType,scaleType:_,dateObj:b,row:a,column:t,$rowIndex:r,rowIndex:o,_rowIndex:n};return(0,_vue.h)("td",{key:i,class:["vxe-gantt-view--body-column",{"is--now":x&&h===m,"col--rs-height":s},(0,_utils.getClass)(y,D)],style:f?Object.assign({},_xeUtils.default.isFunction(f)?f(D):f,{height:u+"px"}):{height:u+"px"},onClick(e){$.handleTaskCellClickEvent(e,{row:a,column:t})},onDblclick(e){$.handleTaskCellDblclickEvent(e,{row:a,column:t})},onContextmenu(e){$.handleTaskBodyContextmenuEvent(e,D)}},g)},B=(d,e)=>{let{treeConfig:v,stripe:c,highlightHoverRow:p,editConfig:w}=d.props,{treeExpandedFlag:g,selectRadioRow:h,pendingRowFlag:x,isRowGroupStatus:y}=d.reactData,{fullAllDataRowIdData:_,treeExpandedMaps:m,pendingRowMaps:b}=d.internalData;var{computeRadioOpts:t,computeCheckboxOpts:l,computeTreeOpts:a,computeRowOpts:o}=d.getComputeMaps();let f=t.value,D=l.value,R=o.value;t=a.value;let C=t.transform,I=t.children||t.childrenField,T=H.value;l=q.value.viewStyle;let{rowClassName:k,rowStyle:E}=l||{},{tableColumn:S,scrollYLoad:M}=j,O=[];return e.forEach((l,a)=>{let o=d.getRowid(l);var e=_[o]||{},t={};let r=a,n=-1,i=(e&&(r=e.index,n=e._index),!1);w&&(i=d.isInsertByRow(l)),(R.isHover||p)&&(t.onMouseenter=e=>{d.triggerHoverEvent(e,{row:l,rowIndex:r})},t.onMouseleave=()=>{d.clearHoverRow()}),!R.drag||y||v&&!C||(t.onDragstart=d.handleRowDragDragstartEvent,t.onDragend=d.handleRowDragDragendEvent,t.onDragover=d.handleRowDragDragoverEvent);e={$gantt:$,source:sourceType,type:viewType,scaleType:T,row:l,rowIndex:r,$rowIndex:a,_rowIndex:n};O.push((0,_vue.h)("tr",Object.assign({key:v?o:a,class:["vxe-gantt-view--body-row",{"row--stripe":c&&(n+1)%2==0,"is--new":i,"row--radio":f.highlight&&d.eqRow(h,l),"row--checked":D.highlight&&d.isCheckedByCheckboxRow(l),"row--pending":!!x&&!!b[o]},(0,_utils.getClass)(k,e)],rowid:o,style:E?_xeUtils.default.isFunction(E)?E(e):E:void 0},t),S.map((e,t)=>z(d,l,o,r,a,n,e,t))));let u=!1,s=[];!v||M||C||(s=l[I],u=!!g&&s&&0<s.length&&!!m[o]),u&&O.push(...B(d,s))}),O};return(0,_vue.onMounted)(()=>{var e=R.elemStore,t="main-body-";e[t+"wrapper"]=r,e[t+"scroll"]=n,e[t+"table"]=i,e[t+"xSpace"]=u,e[t+"ySpace"]=s}),(0,_vue.onUnmounted)(()=>{var e=R.elemStore,t="main-body-";e[t+"wrapper"]=null,e[t+"scroll"]=null,e[t+"table"]=null,e[t+"xSpace"]=null,e[t+"ySpace"]=null}),()=>{var e=o.internalData.xeTable;let{tableData:t,tableColumn:l,viewCellWidth:a}=j;return(0,_vue.h)("div",{ref:r,class:"vxe-gantt-view--body-wrapper"},[(0,_vue.h)("div",{ref:n,class:"vxe-gantt-view--body-inner-wrapper",onScroll:o.triggerBodyScrollEvent,onContextmenu(e){$.handleTaskBodyContextmenuEvent(e,{source:sourceType,type:viewType,rowIndex:-1,$rowIndex:-1,_rowIndex:-1})}},[(0,_vue.h)("div",{ref:u,class:"vxe-body--x-space"}),(0,_vue.h)("div",{ref:s,class:"vxe-body--y-space"}),(0,_vue.h)("table",{ref:i,class:"vxe-gantt-view--body-table"},[(0,_vue.h)("colgroup",{},l.map((e,t)=>(0,_vue.h)("col",{key:t,style:{width:a+"px"}}))),(0,_vue.h)("tbody",{},e?B(e,t):[])]),(0,_vue.h)(_ganttChart.default)])])}}});
|