vxe-gantt 4.1.0 → 4.1.1
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-chart.js +28 -18
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +135 -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-chart.js +36 -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 +143 -6
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +198 -32
- 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-chart.ts +34 -13
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +143 -8
- package/packages/ui/index.ts +3 -0
package/es/gantt/src/emits.js
CHANGED
|
@@ -32,7 +32,7 @@ export default defineVxeComponent({
|
|
|
32
32
|
const progressField = computeProgressField.value;
|
|
33
33
|
const taskBarOpts = computeTaskBarOpts.value;
|
|
34
34
|
const barParams = { $gantt: $xeGantt, row };
|
|
35
|
-
const { showProgress, showContent, contentMethod, barStyle, drag } = taskBarOpts;
|
|
35
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts;
|
|
36
36
|
const isBarRowStyle = XEUtils.isFunction(barStyle);
|
|
37
37
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {};
|
|
38
38
|
const { round } = barStyObj;
|
|
@@ -58,7 +58,32 @@ export default defineVxeComponent({
|
|
|
58
58
|
if (contentMethod) {
|
|
59
59
|
title = getStringValue(contentMethod({ row, title }));
|
|
60
60
|
}
|
|
61
|
-
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex };
|
|
61
|
+
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex, $gantt: $xeGantt };
|
|
62
|
+
const ons = {
|
|
63
|
+
onClick(evnt) {
|
|
64
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
65
|
+
},
|
|
66
|
+
onDblclick(evnt) {
|
|
67
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
68
|
+
},
|
|
69
|
+
onMousedown(evnt) {
|
|
70
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
71
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
if (showTooltip) {
|
|
76
|
+
ons.onMouseover = (evnt) => {
|
|
77
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams);
|
|
78
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
|
|
79
|
+
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
|
|
80
|
+
};
|
|
81
|
+
ons.onMouseleave = (evnt) => {
|
|
82
|
+
const ttParams = Object.assign({ $event: evnt }, ctParams);
|
|
83
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
|
|
84
|
+
$xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
62
87
|
return h('div', {
|
|
63
88
|
key: treeConfig ? rowid : $rowIndex,
|
|
64
89
|
rowid,
|
|
@@ -74,22 +99,7 @@ export default defineVxeComponent({
|
|
|
74
99
|
$xeGantt.handleTaskBarContextmenuEvent(evnt, ctParams);
|
|
75
100
|
}
|
|
76
101
|
}, [
|
|
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
|
|
102
|
+
h('div', Object.assign({ class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', style: vbStyle, rowid }, ons), taskBarSlot
|
|
93
103
|
? $xeGantt.callSlot(taskBarSlot, barParams)
|
|
94
104
|
: [
|
|
95
105
|
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,54 @@ 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
|
+
content = formatText(contentMethod(params));
|
|
1649
|
+
}
|
|
1650
|
+
handleTargetEnterEvent(barTipStore.row !== row);
|
|
1651
|
+
const tipContent = formatText(content);
|
|
1652
|
+
Object.assign(barTipStore, {
|
|
1653
|
+
row,
|
|
1654
|
+
visible: true,
|
|
1655
|
+
content: tipContent,
|
|
1656
|
+
params
|
|
1657
|
+
});
|
|
1658
|
+
nextTick(() => {
|
|
1659
|
+
const $tooltip = refTooltip.value;
|
|
1660
|
+
if ($tooltip) {
|
|
1661
|
+
if ($tooltip.openByEvent) {
|
|
1662
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
|
|
1663
|
+
}
|
|
1664
|
+
else if ($tooltip.open) {
|
|
1665
|
+
$tooltip.open(evnt.currentTarget, tipContent);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
},
|
|
1670
|
+
handleTaskBarTooltipLeaveEvent() {
|
|
1671
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
|
|
1672
|
+
let $tooltip = refTooltip.value;
|
|
1673
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1674
|
+
$tooltip.setActived(false);
|
|
1675
|
+
}
|
|
1676
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1677
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1678
|
+
$tooltip = refTooltip.value;
|
|
1679
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1680
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1681
|
+
}
|
|
1682
|
+
}, taskBarTooltipOpts.leaveDelay);
|
|
1683
|
+
}
|
|
1684
|
+
else {
|
|
1685
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1595
1688
|
handleTaskHeaderContextmenuEvent(evnt, params) {
|
|
1596
1689
|
const $xeTable = refTable.value;
|
|
1597
1690
|
if ($xeTable) {
|
|
@@ -2009,10 +2102,13 @@ export default defineVxeComponent({
|
|
|
2009
2102
|
return childVNs;
|
|
2010
2103
|
};
|
|
2011
2104
|
const renderLayout = () => {
|
|
2105
|
+
const { barTipStore } = reactData;
|
|
2012
2106
|
const currLayoutConf = computeCurrLayoutConf.value;
|
|
2013
2107
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf;
|
|
2108
|
+
const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
|
|
2014
2109
|
const asideLeftSlot = slots.asideLeft || slots['aside-left'];
|
|
2015
2110
|
const asideRightSlot = slots.asideRight || slots['aside-right'];
|
|
2111
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
|
|
2016
2112
|
return [
|
|
2017
2113
|
h('div', {
|
|
2018
2114
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2039,7 +2135,38 @@ export default defineVxeComponent({
|
|
|
2039
2135
|
}, renderChildLayout(footKeys)),
|
|
2040
2136
|
h('div', {
|
|
2041
2137
|
ref: refPopupContainerElem
|
|
2042
|
-
})
|
|
2138
|
+
}),
|
|
2139
|
+
h('div', {}, [
|
|
2140
|
+
/**
|
|
2141
|
+
* 任务条提示
|
|
2142
|
+
*/
|
|
2143
|
+
h(VxeUITooltipComponent, {
|
|
2144
|
+
key: 'gtp',
|
|
2145
|
+
ref: refTooltip,
|
|
2146
|
+
theme: taskBarTooltipOpts.theme,
|
|
2147
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2148
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2149
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2150
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2151
|
+
width: taskBarTooltipOpts.width,
|
|
2152
|
+
height: taskBarTooltipOpts.height,
|
|
2153
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2154
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2155
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2156
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2157
|
+
isArrow: false
|
|
2158
|
+
}, taskBarTooltipSlot
|
|
2159
|
+
? {
|
|
2160
|
+
content: () => {
|
|
2161
|
+
const { row, content: tooltipContent } = barTipStore;
|
|
2162
|
+
if (row) {
|
|
2163
|
+
return h('div', {}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)));
|
|
2164
|
+
}
|
|
2165
|
+
return renderEmptyElement($xeGantt);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
: {})
|
|
2169
|
+
])
|
|
2043
2170
|
];
|
|
2044
2171
|
};
|
|
2045
2172
|
const renderVN = () => {
|
|
@@ -2088,7 +2215,7 @@ export default defineVxeComponent({
|
|
|
2088
2215
|
watch(() => props.proxyConfig, () => {
|
|
2089
2216
|
initProxy();
|
|
2090
2217
|
});
|
|
2091
|
-
watch(
|
|
2218
|
+
watch(computeTaskViewScales, () => {
|
|
2092
2219
|
handleTaskScaleConfig();
|
|
2093
2220
|
$xeGantt.refreshTaskView();
|
|
2094
2221
|
});
|
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.1";
|
|
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"];
|
|
@@ -66,7 +66,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
66
66
|
showContent,
|
|
67
67
|
contentMethod,
|
|
68
68
|
barStyle,
|
|
69
|
-
drag
|
|
69
|
+
drag,
|
|
70
|
+
showTooltip
|
|
70
71
|
} = taskBarOpts;
|
|
71
72
|
const isBarRowStyle = _xeUtils.default.isFunction(barStyle);
|
|
72
73
|
const barStyObj = (barStyle ? isBarRowStyle ? barStyle(barParams) : barStyle : {}) || {};
|
|
@@ -107,8 +108,38 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
107
108
|
row,
|
|
108
109
|
$rowIndex,
|
|
109
110
|
rowIndex,
|
|
110
|
-
_rowIndex
|
|
111
|
+
_rowIndex,
|
|
112
|
+
$gantt: $xeGantt
|
|
111
113
|
};
|
|
114
|
+
const ons = {
|
|
115
|
+
onClick(evnt) {
|
|
116
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
117
|
+
},
|
|
118
|
+
onDblclick(evnt) {
|
|
119
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
120
|
+
},
|
|
121
|
+
onMousedown(evnt) {
|
|
122
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
123
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
if (showTooltip) {
|
|
128
|
+
ons.onMouseover = evnt => {
|
|
129
|
+
const ttParams = Object.assign({
|
|
130
|
+
$event: evnt
|
|
131
|
+
}, ctParams);
|
|
132
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
|
|
133
|
+
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
|
|
134
|
+
};
|
|
135
|
+
ons.onMouseleave = evnt => {
|
|
136
|
+
const ttParams = Object.assign({
|
|
137
|
+
$event: evnt
|
|
138
|
+
}, ctParams);
|
|
139
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
|
|
140
|
+
$xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
112
143
|
return (0, _vue.h)('div', {
|
|
113
144
|
key: treeConfig ? rowid : $rowIndex,
|
|
114
145
|
rowid,
|
|
@@ -123,22 +154,11 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
123
154
|
onContextmenu(evnt) {
|
|
124
155
|
$xeGantt.handleTaskBarContextmenuEvent(evnt, ctParams);
|
|
125
156
|
}
|
|
126
|
-
}, [(0, _vue.h)('div', {
|
|
157
|
+
}, [(0, _vue.h)('div', Object.assign({
|
|
127
158
|
class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
|
|
128
159
|
style: vbStyle,
|
|
129
|
-
rowid
|
|
130
|
-
|
|
131
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
132
|
-
},
|
|
133
|
-
onDblclick(evnt) {
|
|
134
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
135
|
-
},
|
|
136
|
-
onMousedown(evnt) {
|
|
137
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
138
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams) : [showProgress ? (0, _vue.h)('div', {
|
|
160
|
+
rowid
|
|
161
|
+
}, ons), taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams) : [showProgress ? (0, _vue.h)('div', {
|
|
142
162
|
class: 'vxe-gantt-view--chart-progress',
|
|
143
163
|
style: vpStyle
|
|
144
164
|
}) : renderEmptyElement($xeGantt), showContent ? (0, _vue.h)('div', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("./util"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let renderEmptyElement=_core.VxeUI.renderEmptyElement,sourceType="gantt",viewType="chart";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewChart",setup(){let
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("./util"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let renderEmptyElement=_core.VxeUI.renderEmptyElement,sourceType="gantt",viewType="chart";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewChart",setup(){let T=(0,_vue.inject)("$xeGantt",{}),a=(0,_vue.inject)("$xeGanttView",{}),{reactData:r,internalData:t}=a,{computeProgressField:D,computeTitleField:y,computeTaskBarOpts:M}=T.getComputeMaps(),l=(0,_vue.ref)(),w=(e,t,a,r,l,n)=>{var o=e.props.treeConfig,u=e.reactData.resizeHeightFlag,i=e.internalData.fullAllDataRowIdData,{computeCellOpts:e,computeRowOpts:s,computeDefaultRowHeight:v}=e.getComputeMaps(),e=e.value,s=s.value,v=v.value,c=T.context.slots,c=c.taskBar||c["task-bar"],d=y.value,p=D.value,g=M.value;let h={$gantt:T,row:t};var{showProgress:g,showContent:m,contentMethod:w,barStyle:x,drag:_,showTooltip:f}=g,E=_xeUtils.default.isFunction(x),x=(x?E?x(h):x:{})||{},k=x.round,i=i[a]||{},u=0<(u?i.resizeHeight:0),i=(0,_util.getCellRestHeight)(i,e,s,v);let b=(0,_utils.getStringValue)(_xeUtils.default.get(t,d));e={},s={width:`${(g?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(t,p)))):0)||0}%`};E&&({bgColor:v,completedBgColor:d}=x,v&&(e.backgroundColor=v),d)&&(s.backgroundColor=d),w&&(b=(0,_utils.getStringValue)(w({row:t,title:b})));let C={source:sourceType,type:viewType,row:t,$rowIndex:l,rowIndex:r,_rowIndex:n,$gantt:T};p={onClick(e){T.handleTaskBarClickEvent(e,h)},onDblclick(e){T.handleTaskBarDblclickEvent(e,h)},onMousedown(e){T.handleTaskBarMousedownEvent&&T.handleTaskBarMousedownEvent(e,h)}};return f&&(p.onMouseover=e=>{var t=Object.assign({$event:e},C);T.triggerTaskBarTooltipEvent(e,t),T.dispatchEvent("task-bar-mouseenter",t,e)},p.onMouseleave=e=>{var t=Object.assign({$event:e},C);T.handleTaskBarTooltipLeaveEvent(e,t),T.dispatchEvent("task-bar-mouseleave",t,e)}),(0,_vue.h)("div",{key:o?a:l,rowid:a,class:["vxe-gantt-view--chart-row",{"is--round":k,"is--drag":_,"col--rs-height":u}],style:{height:i+"px"},onContextmenu(e){T.handleTaskBarContextmenuEvent(e,C)}},[(0,_vue.h)("div",Object.assign({class:c?"vxe-gantt-view--chart-custom-bar":"vxe-gantt-view--chart-bar",style:e,rowid:a},p),c?T.callSlot(c,h):[g?(0,_vue.h)("div",{class:"vxe-gantt-view--chart-progress",style:s}):renderEmptyElement(T),m?(0,_vue.h)("div",{class:"vxe-gantt-view--chart-content"},b):renderEmptyElement(T)])])},x=(i,e)=>{let s=i.props.treeConfig,v=i.reactData.treeExpandedFlag,{fullAllDataRowIdData:c,treeExpandedMaps:d}=i.internalData;var t=i.getComputeMaps().computeTreeOpts,t=t.value;let p=t.transform,g=t.children||t.childrenField,h=r.scrollYLoad,m=[];return e.forEach((e,t)=>{var a=i?i.getRowid(e):"",r=c[a]||{};let l=t,n=-1,o=(r&&(l=r.index,n=r._index),m.push(w(i,e,a,l,t,n)),!1),u=[];!s||h||p||(u=e[g],o=!!v&&u&&0<u.length&&!!d[a]),o&&m.push(...x(i,u))}),m};return(0,_vue.onMounted)(()=>{var e=t.elemStore;e["main-chart-wrapper"]=l}),(0,_vue.onUnmounted)(()=>{var e=t.elemStore;e["main-chart-wrapper"]=null}),()=>{var e=a.internalData.xeTable,t=r.tableData;return(0,_vue.h)("div",{ref:l,class:"vxe-gantt-view--chart-wrapper"},e?x(e,t):[])}}});
|
|
@@ -86,15 +86,17 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
86
86
|
dateObj
|
|
87
87
|
} = column;
|
|
88
88
|
let label = `${column.title}`;
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
92
|
-
} else {
|
|
93
|
-
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
|
|
94
|
-
}
|
|
89
|
+
if (scaleItem.type === 'day') {
|
|
90
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
|
|
95
91
|
} else {
|
|
96
|
-
if (
|
|
92
|
+
if ($rowIndex) {
|
|
97
93
|
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
94
|
+
} else {
|
|
95
|
+
if (isLast && scaleItem.type === 'week') {
|
|
96
|
+
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
|
|
97
|
+
} else {
|
|
98
|
+
label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj);
|
|
99
|
+
}
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
let cellVNs = label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let getI18n=_core.VxeUI.getI18n,sourceType="gantt",viewType="header";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewHeader",setup(){let f=(0,_vue.inject)("$xeGantt",{}),t=(0,_vue.inject)("$xeGanttView",{}),
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let getI18n=_core.VxeUI.getI18n,sourceType="gantt",viewType="header";var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewHeader",setup(){let f=(0,_vue.inject)("$xeGantt",{}),t=(0,_vue.inject)("$xeGanttView",{}),n=f.getComputeMaps().computeTaskViewOpts,{reactData:u,internalData:o}=t,i=(0,_vue.ref)(),v=(0,_vue.ref)(),s=(0,_vue.ref)(),d=(0,_vue.ref)();return(0,_vue.onMounted)(()=>{var e=o.elemStore,t="main-header-";e[t+"wrapper"]=i,e[t+"scroll"]=v,e[t+"table"]=s,e[t+"xSpace"]=d}),(0,_vue.onUnmounted)(()=>{var e=o.elemStore,t="main-header-";e[t+"wrapper"]=null,e[t+"scroll"]=null,e[t+"table"]=null,e[t+"xSpace"]=null}),()=>{let{headerGroups:l,viewCellWidth:a}=u,{todayDateMaps:r,visibleColumn:e}=o;let w=n.value.showNowLine;return(0,_vue.h)("div",{ref:i,class:"vxe-gantt-view--header-wrapper"},[(0,_vue.h)("div",{ref:v,class:"vxe-gantt-view--header-inner-wrapper",onScroll:t.triggerHeaderScrollEvent},[(0,_vue.h)("div",{ref:d,class:"vxe-body--x-space"}),(0,_vue.h)("table",{ref:s,class:"vxe-gantt-view--header-table"},[(0,_vue.h)("colgroup",{},e.map((e,t)=>(0,_vue.h)("col",{key:t,style:{width:a+"px"}}))),(0,_vue.h)("thead",{},l.map(({scaleItem:v,columns:e},s)=>{let{type:d,titleFormat:p,titleMethod:c,headerCellStyle:_,slots:t}=v,x=t?t.title:null,h=s===l.length-1,m=h&&w?r[d]:null;return(0,_vue.h)("tr",{key:s},e.map((e,t)=>{var{field:l,childCount:a,dateObj:r}=e;let n=""+e.title,u=n="day"===v.type?getI18n("vxe.gantt.dayss.w"+r.e):s||h&&"week"===v.type?getI18n("vxe.gantt.tSimpleFormat."+d,r):getI18n("vxe.gantt.tFullFormat."+d,r),o={source:sourceType,type:viewType,column:e,scaleObj:v,title:n,dateObj:r,$rowIndex:s},i=(x?u=f.callSlot(x,o):c?u=""+c(o):p&&(u=_xeUtils.default.toDateString(r.date,p)),{});return _&&(i=_xeUtils.default.isFunction(_)?_(o):_),(0,_vue.h)("th",{key:t,class:["vxe-gantt-view--header-column",{"is--now":w&&m&&m===l}],colspan:a||null,title:x?null:n,style:i,onContextmenu(e){f.handleTaskHeaderContextmenuEvent(e,o)}},u)}))}))])])])}}});
|
|
@@ -351,7 +351,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
351
351
|
if (minScale.level < 17) {
|
|
352
352
|
handleData('quarter', colMaps, minCol);
|
|
353
353
|
}
|
|
354
|
-
if (minScale.level <
|
|
354
|
+
if (minScale.level < 15) {
|
|
355
355
|
handleData('month', colMaps, minCol);
|
|
356
356
|
}
|
|
357
357
|
if (minScale.level < 13) {
|
|
@@ -360,7 +360,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
360
360
|
if (minScale.level < 11) {
|
|
361
361
|
handleData('day', colMaps, minCol);
|
|
362
362
|
}
|
|
363
|
-
if (minScale.level <
|
|
363
|
+
if (minScale.level < 9) {
|
|
364
364
|
handleData('date', colMaps, minCol);
|
|
365
365
|
}
|
|
366
366
|
if (minScale.level < 7) {
|
|
@@ -369,6 +369,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
369
369
|
if (minScale.level < 5) {
|
|
370
370
|
handleData('minute', colMaps, minCol);
|
|
371
371
|
}
|
|
372
|
+
if (minScale.level < 3) {
|
|
373
|
+
handleData('second', colMaps, minCol);
|
|
374
|
+
}
|
|
372
375
|
fullCols.push(minCol);
|
|
373
376
|
}
|
|
374
377
|
taskScaleList.forEach(scaleItem => {
|