vxe-gantt 3.1.0 → 3.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/gantt-body.js +24 -2
- package/es/gantt/src/gantt-chart.js +36 -17
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +155 -7
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +6 -0
- package/lib/gantt/src/gantt-body.js +6 -0
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +35 -16
- 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 +151 -5
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +218 -33
- 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/lib/ui/src/utils.js +8 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/package.json +2 -2
- package/packages/gantt/src/gantt-body.ts +24 -2
- package/packages/gantt/src/gantt-chart.ts +42 -17
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +161 -7
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +8 -0
|
@@ -38,6 +38,7 @@ export default defineVxeComponent({
|
|
|
38
38
|
const { todayDateMaps } = internalData;
|
|
39
39
|
const taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
40
40
|
const { showNowLine, viewStyle } = taskViewOpts;
|
|
41
|
+
const scaleUnit = $xeGantt.computeScaleUnit;
|
|
41
42
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
|
|
42
43
|
const { field, dateObj } = column;
|
|
43
44
|
const { cellClassName, cellStyle } = viewStyle || {};
|
|
@@ -81,7 +82,18 @@ export default defineVxeComponent({
|
|
|
81
82
|
}
|
|
82
83
|
}));
|
|
83
84
|
}
|
|
84
|
-
const ctParams = {
|
|
85
|
+
const ctParams = {
|
|
86
|
+
$gantt: $xeGantt,
|
|
87
|
+
source: sourceType,
|
|
88
|
+
type: viewType,
|
|
89
|
+
scaleType: scaleUnit,
|
|
90
|
+
dateObj,
|
|
91
|
+
row,
|
|
92
|
+
column,
|
|
93
|
+
$rowIndex,
|
|
94
|
+
rowIndex,
|
|
95
|
+
_rowIndex
|
|
96
|
+
};
|
|
85
97
|
return h('td', {
|
|
86
98
|
key: $columnIndex,
|
|
87
99
|
class: [
|
|
@@ -129,6 +141,7 @@ export default defineVxeComponent({
|
|
|
129
141
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
130
142
|
const { transform } = treeOpts;
|
|
131
143
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
144
|
+
const scaleUnit = $xeGantt.computeScaleUnit;
|
|
132
145
|
const taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
133
146
|
const { viewStyle } = taskViewOpts;
|
|
134
147
|
const { rowClassName, rowStyle } = viewStyle || {};
|
|
@@ -164,7 +177,16 @@ export default defineVxeComponent({
|
|
|
164
177
|
trOns.dragend = $xeTable.handleRowDragDragendEvent;
|
|
165
178
|
trOns.dragover = $xeTable.handleRowDragDragoverEvent;
|
|
166
179
|
}
|
|
167
|
-
const rowParams = {
|
|
180
|
+
const rowParams = {
|
|
181
|
+
$gantt: $xeGantt,
|
|
182
|
+
source: sourceType,
|
|
183
|
+
type: viewType,
|
|
184
|
+
scaleType: scaleUnit,
|
|
185
|
+
row,
|
|
186
|
+
rowIndex,
|
|
187
|
+
$rowIndex,
|
|
188
|
+
_rowIndex
|
|
189
|
+
};
|
|
168
190
|
trVNs.push(h('tr', {
|
|
169
191
|
key: treeConfig ? rowid : $rowIndex,
|
|
170
192
|
class: [
|
|
@@ -42,8 +42,9 @@ export default defineVxeComponent({
|
|
|
42
42
|
const titleField = $xeGantt.computeTitleField;
|
|
43
43
|
const progressField = $xeGantt.computeProgressField;
|
|
44
44
|
const taskBarOpts = $xeGantt.computeTaskBarOpts;
|
|
45
|
-
const
|
|
46
|
-
const {
|
|
45
|
+
const scaleUnit = $xeGantt.computeScaleUnit;
|
|
46
|
+
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit };
|
|
47
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts;
|
|
47
48
|
const isBarRowStyle = XEUtils.isFunction(barStyle);
|
|
48
49
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {};
|
|
49
50
|
const { round } = barStyObj;
|
|
@@ -67,9 +68,39 @@ export default defineVxeComponent({
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
if (contentMethod) {
|
|
70
|
-
title = getStringValue(contentMethod({ row, title }));
|
|
71
|
+
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }));
|
|
72
|
+
}
|
|
73
|
+
const ctParams = {
|
|
74
|
+
$gantt: $xeGantt,
|
|
75
|
+
source: sourceType,
|
|
76
|
+
type: viewType,
|
|
77
|
+
scaleType: scaleUnit,
|
|
78
|
+
row,
|
|
79
|
+
$rowIndex,
|
|
80
|
+
rowIndex,
|
|
81
|
+
_rowIndex
|
|
82
|
+
};
|
|
83
|
+
const ons = {
|
|
84
|
+
click(evnt) {
|
|
85
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
86
|
+
},
|
|
87
|
+
dblclick(evnt) {
|
|
88
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
89
|
+
},
|
|
90
|
+
mousedown(evnt) {
|
|
91
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
92
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
if (showTooltip) {
|
|
97
|
+
ons.mouseover = (evnt) => {
|
|
98
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams));
|
|
99
|
+
};
|
|
100
|
+
ons.mouseleave = (evnt) => {
|
|
101
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams));
|
|
102
|
+
};
|
|
71
103
|
}
|
|
72
|
-
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex };
|
|
73
104
|
return h('div', {
|
|
74
105
|
key: treeConfig ? rowid : $rowIndex,
|
|
75
106
|
attrs: {
|
|
@@ -95,19 +126,7 @@ export default defineVxeComponent({
|
|
|
95
126
|
attrs: {
|
|
96
127
|
rowid
|
|
97
128
|
},
|
|
98
|
-
on:
|
|
99
|
-
click(evnt) {
|
|
100
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
101
|
-
},
|
|
102
|
-
dblclick(evnt) {
|
|
103
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
104
|
-
},
|
|
105
|
-
mousedown(evnt) {
|
|
106
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
107
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
129
|
+
on: ons
|
|
111
130
|
}, taskBarSlot
|
|
112
131
|
? $xeGantt.callSlot(taskBarSlot, barParams, h)
|
|
113
132
|
: [
|
|
@@ -66,18 +66,21 @@ export default defineVxeComponent({
|
|
|
66
66
|
}, columns.map((column, cIndex) => {
|
|
67
67
|
const { field, childCount, dateObj } = column;
|
|
68
68
|
let label = `${column.title}`;
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
|
|
75
|
-
}
|
|
69
|
+
if (scaleItem.type === 'day') {
|
|
70
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
76
71
|
}
|
|
77
72
|
else {
|
|
78
|
-
if (
|
|
73
|
+
if ($rowIndex) {
|
|
79
74
|
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
80
75
|
}
|
|
76
|
+
else {
|
|
77
|
+
if (isLast && scaleItem.type === 'week') {
|
|
78
|
+
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
let cellVNs = label;
|
|
83
86
|
const ctParams = { source: sourceType, type: viewType, column, scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex };
|
|
@@ -180,7 +180,7 @@ function handleColumnHeader($xeGanttView) {
|
|
|
180
180
|
if (minScale.level < 17) {
|
|
181
181
|
handleData('quarter', colMaps, minCol);
|
|
182
182
|
}
|
|
183
|
-
if (minScale.level <
|
|
183
|
+
if (minScale.level < 15) {
|
|
184
184
|
handleData('month', colMaps, minCol);
|
|
185
185
|
}
|
|
186
186
|
if (minScale.level < 13) {
|
|
@@ -189,7 +189,7 @@ function handleColumnHeader($xeGanttView) {
|
|
|
189
189
|
if (minScale.level < 11) {
|
|
190
190
|
handleData('day', colMaps, minCol);
|
|
191
191
|
}
|
|
192
|
-
if (minScale.level <
|
|
192
|
+
if (minScale.level < 9) {
|
|
193
193
|
handleData('date', colMaps, minCol);
|
|
194
194
|
}
|
|
195
195
|
if (minScale.level < 7) {
|
|
@@ -198,6 +198,9 @@ function handleColumnHeader($xeGanttView) {
|
|
|
198
198
|
if (minScale.level < 5) {
|
|
199
199
|
handleData('minute', colMaps, minCol);
|
|
200
200
|
}
|
|
201
|
+
if (minScale.level < 3) {
|
|
202
|
+
handleData('second', colMaps, minCol);
|
|
203
|
+
}
|
|
201
204
|
fullCols.push(minCol);
|
|
202
205
|
}
|
|
203
206
|
taskScaleList.forEach(scaleItem => {
|
package/es/gantt/src/gantt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
2
|
import { VxeUI } from '@vxe-ui/core';
|
|
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 { warnLog, errLog } from '../../ui/src/log';
|
|
@@ -61,6 +61,7 @@ function createInternalData() {
|
|
|
61
61
|
return {
|
|
62
62
|
uFoot: false,
|
|
63
63
|
resizeTableWidth: 0
|
|
64
|
+
// barTipTimeout: undefined
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
export default {
|
|
@@ -68,7 +69,7 @@ export default {
|
|
|
68
69
|
mixins: [
|
|
69
70
|
globalMixins.sizeMixin
|
|
70
71
|
],
|
|
71
|
-
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: {
|
|
72
|
+
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: {
|
|
72
73
|
type: String,
|
|
73
74
|
default: () => getConfig().gantt.size || getConfig().size
|
|
74
75
|
} }),
|
|
@@ -100,7 +101,13 @@ export default {
|
|
|
100
101
|
},
|
|
101
102
|
showLeftView: true,
|
|
102
103
|
showRightView: true,
|
|
103
|
-
taskScaleList: []
|
|
104
|
+
taskScaleList: [],
|
|
105
|
+
barTipStore: {
|
|
106
|
+
row: null,
|
|
107
|
+
content: '',
|
|
108
|
+
visible: false,
|
|
109
|
+
params: null
|
|
110
|
+
}
|
|
104
111
|
};
|
|
105
112
|
const internalData = createInternalData();
|
|
106
113
|
return {
|
|
@@ -179,6 +186,11 @@ export default {
|
|
|
179
186
|
const props = $xeGantt;
|
|
180
187
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
|
|
181
188
|
},
|
|
189
|
+
computeTaskBarTooltipOpts() {
|
|
190
|
+
const $xeGantt = this;
|
|
191
|
+
const props = $xeGantt;
|
|
192
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig);
|
|
193
|
+
},
|
|
182
194
|
computeScaleUnit() {
|
|
183
195
|
const $xeGantt = this;
|
|
184
196
|
const minScale = $xeGantt.computeMinScale;
|
|
@@ -196,12 +208,19 @@ export default {
|
|
|
196
208
|
const { taskScaleList } = reactData;
|
|
197
209
|
return taskScaleList.find(item => item.type === 'week');
|
|
198
210
|
},
|
|
199
|
-
|
|
211
|
+
computeTaskViewScales() {
|
|
200
212
|
const $xeGantt = this;
|
|
201
213
|
const taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
202
214
|
const { scales } = taskViewOpts;
|
|
203
215
|
return scales;
|
|
204
216
|
},
|
|
217
|
+
/**
|
|
218
|
+
* 已废弃,保留兼容
|
|
219
|
+
* @deprecated
|
|
220
|
+
*/
|
|
221
|
+
computeTaskScaleConfs() {
|
|
222
|
+
return this.computeTaskViewScales;
|
|
223
|
+
},
|
|
205
224
|
computeTitleField() {
|
|
206
225
|
const $xeGantt = this;
|
|
207
226
|
const taskOpts = $xeGantt.computeTaskOpts;
|
|
@@ -449,7 +468,7 @@ export default {
|
|
|
449
468
|
const $xeGantt = this;
|
|
450
469
|
$xeGantt.initProxy();
|
|
451
470
|
},
|
|
452
|
-
|
|
471
|
+
computeTaskViewScales() {
|
|
453
472
|
const $xeGantt = this;
|
|
454
473
|
$xeGantt.handleTaskScaleConfig();
|
|
455
474
|
$xeGantt.refreshTaskView();
|
|
@@ -462,7 +481,7 @@ export default {
|
|
|
462
481
|
handleTaskScaleConfig() {
|
|
463
482
|
const $xeGantt = this;
|
|
464
483
|
const reactData = $xeGantt.reactData;
|
|
465
|
-
const taskScaleConfs = $xeGantt.
|
|
484
|
+
const taskScaleConfs = $xeGantt.computeTaskViewScales;
|
|
466
485
|
const taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts;
|
|
467
486
|
const scaleConfs = [];
|
|
468
487
|
if (taskScaleConfs) {
|
|
@@ -1564,6 +1583,27 @@ export default {
|
|
|
1564
1583
|
reactData.showRightView = false;
|
|
1565
1584
|
return $xeGantt.$nextTick();
|
|
1566
1585
|
},
|
|
1586
|
+
/**
|
|
1587
|
+
* 关闭 bar tooltip
|
|
1588
|
+
*/
|
|
1589
|
+
closeTaskBarTooltip() {
|
|
1590
|
+
const $xeGantt = this;
|
|
1591
|
+
const reactData = $xeGantt.reactData;
|
|
1592
|
+
const { barTipStore } = reactData;
|
|
1593
|
+
const $tooltip = $xeGantt.$refs.refTooltip;
|
|
1594
|
+
if (barTipStore.visible) {
|
|
1595
|
+
Object.assign(barTipStore, {
|
|
1596
|
+
row: null,
|
|
1597
|
+
content: null,
|
|
1598
|
+
visible: false,
|
|
1599
|
+
params: {}
|
|
1600
|
+
});
|
|
1601
|
+
if ($tooltip && $tooltip.close) {
|
|
1602
|
+
$tooltip.close();
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
return $xeGantt.$nextTick();
|
|
1606
|
+
},
|
|
1567
1607
|
callSlot(slotFunc, params, h) {
|
|
1568
1608
|
const $xeGantt = this;
|
|
1569
1609
|
const slots = $xeGantt.$scopedSlots;
|
|
@@ -1687,6 +1727,75 @@ export default {
|
|
|
1687
1727
|
const $xeGantt = this;
|
|
1688
1728
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
|
|
1689
1729
|
},
|
|
1730
|
+
triggerTaskBarTooltipEvent(evnt, params) {
|
|
1731
|
+
const $xeGantt = this;
|
|
1732
|
+
const reactData = $xeGantt.reactData;
|
|
1733
|
+
const { barTipStore } = reactData;
|
|
1734
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
1735
|
+
const titleField = $xeGantt.computeTitleField;
|
|
1736
|
+
const { contentMethod } = taskBarTooltipOpts;
|
|
1737
|
+
const { row } = params;
|
|
1738
|
+
let content = formatText(XEUtils.get(row, titleField));
|
|
1739
|
+
if (contentMethod) {
|
|
1740
|
+
const customContnet = contentMethod(params);
|
|
1741
|
+
if (!XEUtils.eqNull(customContnet)) {
|
|
1742
|
+
content = `${customContnet}`;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
$xeGantt.handleTargetEnterEvent(barTipStore.row !== row);
|
|
1746
|
+
const tipContent = formatText(content);
|
|
1747
|
+
Object.assign(barTipStore, {
|
|
1748
|
+
row,
|
|
1749
|
+
visible: true,
|
|
1750
|
+
content: tipContent,
|
|
1751
|
+
params
|
|
1752
|
+
});
|
|
1753
|
+
$xeGantt.$nextTick(() => {
|
|
1754
|
+
const $tooltip = $xeGantt.$refs.refTooltip;
|
|
1755
|
+
if ($tooltip) {
|
|
1756
|
+
if ($tooltip.openByEvent) {
|
|
1757
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
|
|
1758
|
+
}
|
|
1759
|
+
else if ($tooltip.open) {
|
|
1760
|
+
$tooltip.open(evnt.currentTarget, tipContent);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
});
|
|
1764
|
+
},
|
|
1765
|
+
handleTargetEnterEvent(isClear) {
|
|
1766
|
+
const $xeGantt = this;
|
|
1767
|
+
const internalData = $xeGantt.internalData;
|
|
1768
|
+
const $tooltip = $xeGantt.$refs.refTooltip;
|
|
1769
|
+
clearTimeout(internalData.barTipTimeout);
|
|
1770
|
+
if (isClear) {
|
|
1771
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1772
|
+
}
|
|
1773
|
+
else {
|
|
1774
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1775
|
+
$tooltip.setActived(true);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
handleTaskBarTooltipLeaveEvent() {
|
|
1780
|
+
const $xeGantt = this;
|
|
1781
|
+
const internalData = $xeGantt.internalData;
|
|
1782
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
1783
|
+
let $tooltip = $xeGantt.$refs.refTooltip;
|
|
1784
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1785
|
+
$tooltip.setActived(false);
|
|
1786
|
+
}
|
|
1787
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1788
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1789
|
+
$tooltip = $xeGantt.$refs.refTooltip;
|
|
1790
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1791
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1792
|
+
}
|
|
1793
|
+
}, taskBarTooltipOpts.leaveDelay);
|
|
1794
|
+
}
|
|
1795
|
+
else {
|
|
1796
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1797
|
+
}
|
|
1798
|
+
},
|
|
1690
1799
|
handleTaskHeaderContextmenuEvent(evnt, params) {
|
|
1691
1800
|
const $xeGantt = this;
|
|
1692
1801
|
const $xeTable = $xeGantt.$refs.refTable;
|
|
@@ -2160,12 +2269,17 @@ export default {
|
|
|
2160
2269
|
return childVNs;
|
|
2161
2270
|
},
|
|
2162
2271
|
renderLayout(h) {
|
|
2272
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
2163
2273
|
const $xeGantt = this;
|
|
2274
|
+
const reactData = $xeGantt.reactData;
|
|
2164
2275
|
const slots = $xeGantt.$scopedSlots;
|
|
2276
|
+
const { barTipStore } = reactData;
|
|
2165
2277
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf;
|
|
2166
2278
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf;
|
|
2279
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
2167
2280
|
const asideLeftSlot = slots.asideLeft || slots['aside-left'];
|
|
2168
2281
|
const asideRightSlot = slots.asideRight || slots['aside-right'];
|
|
2282
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
|
|
2169
2283
|
return [
|
|
2170
2284
|
h('div', {
|
|
2171
2285
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2192,7 +2306,41 @@ export default {
|
|
|
2192
2306
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2193
2307
|
h('div', {
|
|
2194
2308
|
ref: 'refPopupContainerElem'
|
|
2195
|
-
})
|
|
2309
|
+
}),
|
|
2310
|
+
h('div', {}, [
|
|
2311
|
+
/**
|
|
2312
|
+
* 任务条提示
|
|
2313
|
+
*/
|
|
2314
|
+
h(VxeUITooltipComponent, {
|
|
2315
|
+
key: 'gtp',
|
|
2316
|
+
ref: 'refTooltip',
|
|
2317
|
+
props: {
|
|
2318
|
+
theme: taskBarTooltipOpts.theme,
|
|
2319
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2320
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2321
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2322
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2323
|
+
width: taskBarTooltipOpts.width,
|
|
2324
|
+
height: taskBarTooltipOpts.height,
|
|
2325
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2326
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2327
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2328
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2329
|
+
isArrow: false
|
|
2330
|
+
},
|
|
2331
|
+
scopedSlots: taskBarTooltipSlot
|
|
2332
|
+
? {
|
|
2333
|
+
content: () => {
|
|
2334
|
+
const { row, content: tooltipContent } = barTipStore;
|
|
2335
|
+
if (row) {
|
|
2336
|
+
return h('div', {}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)));
|
|
2337
|
+
}
|
|
2338
|
+
return renderEmptyElement($xeGantt);
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
: {}
|
|
2342
|
+
})
|
|
2343
|
+
])
|
|
2196
2344
|
];
|
|
2197
2345
|
},
|
|
2198
2346
|
renderVN(h) {
|
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 = "3.1.
|
|
4
|
+
VxeUI.ganttVersion = "3.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/es/ui/src/utils.js
CHANGED
|
@@ -5,6 +5,9 @@ const { getConfig } = VxeUI;
|
|
|
5
5
|
export function isEnableConf(conf) {
|
|
6
6
|
return conf && conf.enabled !== false;
|
|
7
7
|
}
|
|
8
|
+
export function isEmptyValue(cellValue) {
|
|
9
|
+
return cellValue === null || cellValue === undefined || cellValue === '';
|
|
10
|
+
}
|
|
8
11
|
export function nextZIndex() {
|
|
9
12
|
return DomZIndex.getNext();
|
|
10
13
|
}
|
|
@@ -30,6 +33,9 @@ export function getFuncText(content, args) {
|
|
|
30
33
|
}
|
|
31
34
|
return '';
|
|
32
35
|
}
|
|
36
|
+
export function formatText(value, placeholder) {
|
|
37
|
+
return '' + (isEmptyValue(value) ? (placeholder ? VxeUI.getConfig().emptyCell : '') : value);
|
|
38
|
+
}
|
|
33
39
|
/**
|
|
34
40
|
* 判断值为:'' | null | undefined 时都属于空值
|
|
35
41
|
*/
|
|
@@ -54,6 +54,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
54
54
|
var taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
55
55
|
var showNowLine = taskViewOpts.showNowLine,
|
|
56
56
|
viewStyle = taskViewOpts.viewStyle;
|
|
57
|
+
var scaleUnit = $xeGantt.computeScaleUnit;
|
|
57
58
|
var _ref = headerGroups[headerGroups.length - 1] || {},
|
|
58
59
|
scaleItem = _ref.scaleItem;
|
|
59
60
|
var field = column.field,
|
|
@@ -106,8 +107,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
106
107
|
}));
|
|
107
108
|
}
|
|
108
109
|
var ctParams = {
|
|
110
|
+
$gantt: $xeGantt,
|
|
109
111
|
source: sourceType,
|
|
110
112
|
type: viewType,
|
|
113
|
+
scaleType: scaleUnit,
|
|
111
114
|
dateObj: dateObj,
|
|
112
115
|
row: row,
|
|
113
116
|
column: column,
|
|
@@ -170,6 +173,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
170
173
|
var treeOpts = $xeTable.computeTreeOpts;
|
|
171
174
|
var transform = treeOpts.transform;
|
|
172
175
|
var childrenField = treeOpts.children || treeOpts.childrenField;
|
|
176
|
+
var scaleUnit = $xeGantt.computeScaleUnit;
|
|
173
177
|
var taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
174
178
|
var viewStyle = taskViewOpts.viewStyle;
|
|
175
179
|
var _ref3 = viewStyle || {},
|
|
@@ -212,8 +216,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
212
216
|
trOns.dragover = $xeTable.handleRowDragDragoverEvent;
|
|
213
217
|
}
|
|
214
218
|
var rowParams = {
|
|
219
|
+
$gantt: $xeGantt,
|
|
215
220
|
source: sourceType,
|
|
216
221
|
type: viewType,
|
|
222
|
+
scaleType: scaleUnit,
|
|
217
223
|
row: row,
|
|
218
224
|
rowIndex: rowIndex,
|
|
219
225
|
$rowIndex: $rowIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var sourceType="gantt",viewType="body",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewBody",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},computed:Object.assign({},{}),methods:{renderColumn:function(e,t,r,n,o,a,l,i,
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var sourceType="gantt",viewType="body",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewBody",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},computed:Object.assign({},{}),methods:{renderColumn:function(e,t,r,n,o,a,l,i,c){var s,u=this.$xeGanttView,d=this.$xeGantt,p=u.reactData,w=t.resizeHeightFlag,y=t.fullAllDataRowIdData,f=t.visibleColumn,m=t.computeCellOpts,g=t.computeRowOpts,h=t.computeResizableOpts.isAllRowDrag,p=p.headerGroups,u=u.internalData.todayDateMaps,v=d.computeTaskViewOpts,x=v.showNowLine,b=d.computeScaleUnit,p=(p[p.length-1]||{}).scaleItem,_=i.field,R=i.dateObj,v=v.viewStyle||{},T=v.cellClassName,v=v.cellStyle,u=x&&p?u[p.type]:null,p=y[n]||{},y=0<(w?p.resizeHeight:0),w=(0,_util.getCellRestHeight)(p,m,g,t.computeDefaultRowHeight),p=[],C=(h&&g.resizable&&(s={$table:t,$grid:null,$gantt:d,seq:-1,rowid:n,row:r,rowIndex:o,$rowIndex:a,_rowIndex:l,column:f[0],columnIndex:0,$columnIndex:0,_columnIndex:0,fixed:"",source:sourceType,type:viewType,isHidden:!1,isEdit:!1,level:-1,visibleData:[],data:[],items:[]},p.push(e("div",{class:"vxe-gantt-view-cell--row-resizable",on:{mousedown:function(e){return t.handleRowResizeMousedownEvent(e,s)},dblclick:function(e){return t.handleRowResizeDblclickEvent(e,s)}}}))),{$gantt:d,source:sourceType,type:viewType,scaleType:b,dateObj:R,row:r,column:i,$rowIndex:a,rowIndex:o,_rowIndex:l});return e("td",{key:c,class:["vxe-gantt-view--body-column",{"is--now":x&&u===_,"col--rs-height":y},(0,_utils.getClass)(T,C)],style:v?Object.assign({},_xeUtils.default.isFunction(v)?v(C):v,{height:"".concat(w,"px")}):{height:"".concat(w,"px")},on:{click:function(e){d.handleTaskCellClickEvent(e,{row:r,column:i})},dblclick:function(e){d.handleTaskCellDblclickEvent(e,{row:r,column:i})},contextmenu:function(e){d.handleTaskBodyContextmenuEvent(e,C)}}},p)},renderRows:function(c,s,e){var u=this,t=u.$xeGanttView,d=u.$xeGantt,t=t.reactData,p=s.treeConfig,w=s.stripe,y=s.highlightHoverRow,f=s.editConfig,m=s.treeExpandedFlag,g=s.selectRadioRow,h=s.pendingRowFlag,v=s.isRowGroupStatus,x=s.fullAllDataRowIdData,b=s.treeExpandedMaps,_=s.pendingRowMaps,R=s.computeRadioOpts,T=s.computeCheckboxOpts,C=s.computeRowOpts,r=s.computeTreeOpts,D=r.transform,I=r.children||r.childrenField,S=d.computeScaleUnit,r=d.computeTaskViewOpts.viewStyle||{},$=r.rowClassName,k=r.rowStyle,A=t.tableColumn,E=t.scrollYLoad,O=[];return e.forEach(function(r,n){var o=s.getRowid(r),e=x[o]||{},t={},a=n,l=-1,e=(e&&(a=e.index,l=e._index),!1),i=(f&&(e=s.isInsertByRow(r)),(C.isHover||y)&&(t.mouseenter=function(e){s.triggerHoverEvent(e,{row:r,rowIndex:a})},t.mouseleave=function(){s.clearHoverRow()}),!C.drag||v||p&&!D||(t.dragstart=s.handleRowDragDragstartEvent,t.dragend=s.handleRowDragDragendEvent,t.dragover=s.handleRowDragDragoverEvent),{$gantt:d,source:sourceType,type:viewType,scaleType:S,row:r,rowIndex:a,$rowIndex:n,_rowIndex:l}),e=(O.push(c("tr",{key:p?o:n,class:["vxe-gantt-view--body-row",{"row--stripe":w&&(l+1)%2==0,"is--new":e,"row--radio":R.highlight&&s.eqRow(g,r),"row--checked":T.highlight&&s.isCheckedByCheckboxRow(r),"row--pending":!!h&&!!_[o]},(0,_utils.getClass)($,i)],style:k?_xeUtils.default.isFunction(k)?k(i):k:void 0,attrs:{rowid:o},on:t},A.map(function(e,t){return u.renderColumn(c,s,r,o,a,n,l,e,t)}))),!1),i=[];!p||E||D||(i=r[I],e=!!m&&i&&0<i.length&&!!b[o]),e&&O.push.apply(O,_toConsumableArray(u.renderRows(c,s,i)))}),O},renderVN:function(r){var t=this.$xeGantt,e=this.$xeGanttView,n=e.reactData,o=e.internalData.xeTable,a=n.tableData,l=n.tableColumn,i=n.viewCellWidth;return r("div",{ref:"refElem",class:"vxe-gantt-view--body-wrapper"},[r("div",{ref:"refBodyScroll",class:"vxe-gantt-view--body-inner-wrapper",on:{scroll:e.triggerBodyScrollEvent,contextmenu:function(e){t.handleTaskBodyContextmenuEvent(e,{source:sourceType,type:viewType,rowIndex:-1,$rowIndex:-1,_rowIndex:-1})}}},[r("div",{ref:"refBodyXSpace",class:"vxe-body--x-space"}),r("div",{ref:"refBodyYSpace",class:"vxe-body--y-space"}),r("table",{ref:"refBodyTable",class:"vxe-gantt-view--body-table"},[r("colgroup",{},l.map(function(e,t){return r("col",{key:t,style:{width:"".concat(i,"px")}})})),r("tbody",{},o?this.renderRows(r,o,a):[])]),r(_ganttChart.default)])])}},mounted:function(){var e=this,t=e.$xeGanttView.internalData.elemStore,r="main-body-";t["".concat(r,"wrapper")]=e.$refs.refElem,t["".concat(r,"scroll")]=e.$refs.refBodyScroll,t["".concat(r,"table")]=e.$refs.refBodyTable,t["".concat(r,"xSpace")]=e.$refs.refBodyXSpace,t["".concat(r,"ySpace")]=e.$refs.refBodyYSpace},destroyed:function(){var e=this.$xeGanttView.internalData.elemStore,t="main-body-";e["".concat(t,"wrapper")]=null,e["".concat(t,"scroll")]=null,e["".concat(t,"table")]=null,e["".concat(t,"xSpace")]=null,e["".concat(t,"ySpace")]=null},render:function(e){return this.renderVN(e)}});
|
|
@@ -55,15 +55,18 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
55
55
|
var titleField = $xeGantt.computeTitleField;
|
|
56
56
|
var progressField = $xeGantt.computeProgressField;
|
|
57
57
|
var taskBarOpts = $xeGantt.computeTaskBarOpts;
|
|
58
|
+
var scaleUnit = $xeGantt.computeScaleUnit;
|
|
58
59
|
var barParams = {
|
|
59
60
|
$gantt: $xeGantt,
|
|
60
|
-
row: row
|
|
61
|
+
row: row,
|
|
62
|
+
scaleType: scaleUnit
|
|
61
63
|
};
|
|
62
64
|
var showProgress = taskBarOpts.showProgress,
|
|
63
65
|
showContent = taskBarOpts.showContent,
|
|
64
66
|
contentMethod = taskBarOpts.contentMethod,
|
|
65
67
|
barStyle = taskBarOpts.barStyle,
|
|
66
|
-
drag = taskBarOpts.drag
|
|
68
|
+
drag = taskBarOpts.drag,
|
|
69
|
+
showTooltip = taskBarOpts.showTooltip;
|
|
67
70
|
var isBarRowStyle = _xeUtils.default.isFunction(barStyle);
|
|
68
71
|
var barStyObj = (barStyle ? isBarRowStyle ? barStyle(barParams) : barStyle : {}) || {};
|
|
69
72
|
var round = barStyObj.round;
|
|
@@ -90,17 +93,45 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
90
93
|
if (contentMethod) {
|
|
91
94
|
title = (0, _utils.getStringValue)(contentMethod({
|
|
92
95
|
row: row,
|
|
93
|
-
title: title
|
|
96
|
+
title: title,
|
|
97
|
+
scaleType: scaleUnit
|
|
94
98
|
}));
|
|
95
99
|
}
|
|
96
100
|
var ctParams = {
|
|
101
|
+
$gantt: $xeGantt,
|
|
97
102
|
source: sourceType,
|
|
98
103
|
type: viewType,
|
|
104
|
+
scaleType: scaleUnit,
|
|
99
105
|
row: row,
|
|
100
106
|
$rowIndex: $rowIndex,
|
|
101
107
|
rowIndex: rowIndex,
|
|
102
108
|
_rowIndex: _rowIndex
|
|
103
109
|
};
|
|
110
|
+
var ons = {
|
|
111
|
+
click: function click(evnt) {
|
|
112
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
113
|
+
},
|
|
114
|
+
dblclick: function dblclick(evnt) {
|
|
115
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
116
|
+
},
|
|
117
|
+
mousedown: function mousedown(evnt) {
|
|
118
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
119
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
if (showTooltip) {
|
|
124
|
+
ons.mouseover = function (evnt) {
|
|
125
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({
|
|
126
|
+
$event: evnt
|
|
127
|
+
}, ctParams));
|
|
128
|
+
};
|
|
129
|
+
ons.mouseleave = function (evnt) {
|
|
130
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({
|
|
131
|
+
$event: evnt
|
|
132
|
+
}, ctParams));
|
|
133
|
+
};
|
|
134
|
+
}
|
|
104
135
|
return h('div', {
|
|
105
136
|
key: treeConfig ? rowid : $rowIndex,
|
|
106
137
|
attrs: {
|
|
@@ -125,19 +156,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
125
156
|
attrs: {
|
|
126
157
|
rowid: rowid
|
|
127
158
|
},
|
|
128
|
-
on:
|
|
129
|
-
click: function click(evnt) {
|
|
130
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
131
|
-
},
|
|
132
|
-
dblclick: function dblclick(evnt) {
|
|
133
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
134
|
-
},
|
|
135
|
-
mousedown: function mousedown(evnt) {
|
|
136
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
137
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
159
|
+
on: ons
|
|
141
160
|
}, taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams, h) : [showProgress ? h('div', {
|
|
142
161
|
class: 'vxe-gantt-view--chart-progress',
|
|
143
162
|
style: vpStyle
|