vxe-gantt 3.1.0 → 3.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/gantt-chart.js +24 -15
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +152 -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-chart.js +30 -15
- 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 +148 -5
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +204 -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/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-chart.ts +30 -15
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +158 -7
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +8 -0
|
@@ -43,7 +43,7 @@ export default defineVxeComponent({
|
|
|
43
43
|
const progressField = $xeGantt.computeProgressField;
|
|
44
44
|
const taskBarOpts = $xeGantt.computeTaskBarOpts;
|
|
45
45
|
const barParams = { $gantt: $xeGantt, row };
|
|
46
|
-
const { showProgress, showContent, contentMethod, barStyle, drag } = taskBarOpts;
|
|
46
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts;
|
|
47
47
|
const isBarRowStyle = XEUtils.isFunction(barStyle);
|
|
48
48
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {};
|
|
49
49
|
const { round } = barStyObj;
|
|
@@ -69,7 +69,28 @@ export default defineVxeComponent({
|
|
|
69
69
|
if (contentMethod) {
|
|
70
70
|
title = getStringValue(contentMethod({ row, title }));
|
|
71
71
|
}
|
|
72
|
-
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex };
|
|
72
|
+
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex, $gantt: $xeGantt };
|
|
73
|
+
const ons = {
|
|
74
|
+
click(evnt) {
|
|
75
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
76
|
+
},
|
|
77
|
+
dblclick(evnt) {
|
|
78
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
79
|
+
},
|
|
80
|
+
mousedown(evnt) {
|
|
81
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
82
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
if (showTooltip) {
|
|
87
|
+
ons.mouseover = (evnt) => {
|
|
88
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams));
|
|
89
|
+
};
|
|
90
|
+
ons.mouseleave = (evnt) => {
|
|
91
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams));
|
|
92
|
+
};
|
|
93
|
+
}
|
|
73
94
|
return h('div', {
|
|
74
95
|
key: treeConfig ? rowid : $rowIndex,
|
|
75
96
|
attrs: {
|
|
@@ -95,19 +116,7 @@ export default defineVxeComponent({
|
|
|
95
116
|
attrs: {
|
|
96
117
|
rowid
|
|
97
118
|
},
|
|
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
|
-
}
|
|
119
|
+
on: ons
|
|
111
120
|
}, taskBarSlot
|
|
112
121
|
? $xeGantt.callSlot(taskBarSlot, barParams, h)
|
|
113
122
|
: [
|
|
@@ -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,72 @@ 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
|
+
content = formatText(contentMethod(params));
|
|
1741
|
+
}
|
|
1742
|
+
$xeGantt.handleTargetEnterEvent(barTipStore.row !== row);
|
|
1743
|
+
const tipContent = formatText(content);
|
|
1744
|
+
Object.assign(barTipStore, {
|
|
1745
|
+
row,
|
|
1746
|
+
visible: true,
|
|
1747
|
+
content: tipContent,
|
|
1748
|
+
params
|
|
1749
|
+
});
|
|
1750
|
+
$xeGantt.$nextTick(() => {
|
|
1751
|
+
const $tooltip = $xeGantt.$refs.refTooltip;
|
|
1752
|
+
if ($tooltip) {
|
|
1753
|
+
if ($tooltip.openByEvent) {
|
|
1754
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
|
|
1755
|
+
}
|
|
1756
|
+
else if ($tooltip.open) {
|
|
1757
|
+
$tooltip.open(evnt.currentTarget, tipContent);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
},
|
|
1762
|
+
handleTargetEnterEvent(isClear) {
|
|
1763
|
+
const $xeGantt = this;
|
|
1764
|
+
const internalData = $xeGantt.internalData;
|
|
1765
|
+
const $tooltip = $xeGantt.$refs.refTooltip;
|
|
1766
|
+
clearTimeout(internalData.barTipTimeout);
|
|
1767
|
+
if (isClear) {
|
|
1768
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1769
|
+
}
|
|
1770
|
+
else {
|
|
1771
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1772
|
+
$tooltip.setActived(true);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
handleTaskBarTooltipLeaveEvent() {
|
|
1777
|
+
const $xeGantt = this;
|
|
1778
|
+
const internalData = $xeGantt.internalData;
|
|
1779
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
1780
|
+
let $tooltip = $xeGantt.$refs.refTooltip;
|
|
1781
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1782
|
+
$tooltip.setActived(false);
|
|
1783
|
+
}
|
|
1784
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1785
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1786
|
+
$tooltip = $xeGantt.$refs.refTooltip;
|
|
1787
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1788
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1789
|
+
}
|
|
1790
|
+
}, taskBarTooltipOpts.leaveDelay);
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
$xeGantt.closeTaskBarTooltip();
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1690
1796
|
handleTaskHeaderContextmenuEvent(evnt, params) {
|
|
1691
1797
|
const $xeGantt = this;
|
|
1692
1798
|
const $xeTable = $xeGantt.$refs.refTable;
|
|
@@ -2160,12 +2266,17 @@ export default {
|
|
|
2160
2266
|
return childVNs;
|
|
2161
2267
|
},
|
|
2162
2268
|
renderLayout(h) {
|
|
2269
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
2163
2270
|
const $xeGantt = this;
|
|
2271
|
+
const reactData = $xeGantt.reactData;
|
|
2164
2272
|
const slots = $xeGantt.$scopedSlots;
|
|
2273
|
+
const { barTipStore } = reactData;
|
|
2165
2274
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf;
|
|
2166
2275
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf;
|
|
2276
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
2167
2277
|
const asideLeftSlot = slots.asideLeft || slots['aside-left'];
|
|
2168
2278
|
const asideRightSlot = slots.asideRight || slots['aside-right'];
|
|
2279
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
|
|
2169
2280
|
return [
|
|
2170
2281
|
h('div', {
|
|
2171
2282
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2192,7 +2303,41 @@ export default {
|
|
|
2192
2303
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2193
2304
|
h('div', {
|
|
2194
2305
|
ref: 'refPopupContainerElem'
|
|
2195
|
-
})
|
|
2306
|
+
}),
|
|
2307
|
+
h('div', {}, [
|
|
2308
|
+
/**
|
|
2309
|
+
* 任务条提示
|
|
2310
|
+
*/
|
|
2311
|
+
h(VxeUITooltipComponent, {
|
|
2312
|
+
key: 'gtp',
|
|
2313
|
+
ref: 'refTooltip',
|
|
2314
|
+
props: {
|
|
2315
|
+
theme: taskBarTooltipOpts.theme,
|
|
2316
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2317
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2318
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2319
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2320
|
+
width: taskBarTooltipOpts.width,
|
|
2321
|
+
height: taskBarTooltipOpts.height,
|
|
2322
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2323
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2324
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2325
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2326
|
+
isArrow: false
|
|
2327
|
+
},
|
|
2328
|
+
scopedSlots: taskBarTooltipSlot
|
|
2329
|
+
? {
|
|
2330
|
+
content: () => {
|
|
2331
|
+
const { row, content: tooltipContent } = barTipStore;
|
|
2332
|
+
if (row) {
|
|
2333
|
+
return h('div', {}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)));
|
|
2334
|
+
}
|
|
2335
|
+
return renderEmptyElement($xeGantt);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
: {}
|
|
2339
|
+
})
|
|
2340
|
+
])
|
|
2196
2341
|
];
|
|
2197
2342
|
},
|
|
2198
2343
|
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.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/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
|
*/
|
|
@@ -63,7 +63,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
63
63
|
showContent = taskBarOpts.showContent,
|
|
64
64
|
contentMethod = taskBarOpts.contentMethod,
|
|
65
65
|
barStyle = taskBarOpts.barStyle,
|
|
66
|
-
drag = taskBarOpts.drag
|
|
66
|
+
drag = taskBarOpts.drag,
|
|
67
|
+
showTooltip = taskBarOpts.showTooltip;
|
|
67
68
|
var isBarRowStyle = _xeUtils.default.isFunction(barStyle);
|
|
68
69
|
var barStyObj = (barStyle ? isBarRowStyle ? barStyle(barParams) : barStyle : {}) || {};
|
|
69
70
|
var round = barStyObj.round;
|
|
@@ -99,8 +100,34 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
99
100
|
row: row,
|
|
100
101
|
$rowIndex: $rowIndex,
|
|
101
102
|
rowIndex: rowIndex,
|
|
102
|
-
_rowIndex: _rowIndex
|
|
103
|
+
_rowIndex: _rowIndex,
|
|
104
|
+
$gantt: $xeGantt
|
|
103
105
|
};
|
|
106
|
+
var ons = {
|
|
107
|
+
click: function click(evnt) {
|
|
108
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams);
|
|
109
|
+
},
|
|
110
|
+
dblclick: function dblclick(evnt) {
|
|
111
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
|
|
112
|
+
},
|
|
113
|
+
mousedown: function mousedown(evnt) {
|
|
114
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
115
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
if (showTooltip) {
|
|
120
|
+
ons.mouseover = function (evnt) {
|
|
121
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({
|
|
122
|
+
$event: evnt
|
|
123
|
+
}, ctParams));
|
|
124
|
+
};
|
|
125
|
+
ons.mouseleave = function (evnt) {
|
|
126
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({
|
|
127
|
+
$event: evnt
|
|
128
|
+
}, ctParams));
|
|
129
|
+
};
|
|
130
|
+
}
|
|
104
131
|
return h('div', {
|
|
105
132
|
key: treeConfig ? rowid : $rowIndex,
|
|
106
133
|
attrs: {
|
|
@@ -125,19 +152,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
125
152
|
attrs: {
|
|
126
153
|
rowid: rowid
|
|
127
154
|
},
|
|
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
|
-
}
|
|
155
|
+
on: ons
|
|
141
156
|
}, taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams, h) : [showProgress ? h('div', {
|
|
142
157
|
class: 'vxe-gantt-view--chart-progress',
|
|
143
158
|
style: vpStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}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,a=Array(t);r<t;r++)a[r]=e[r];return a}var renderEmptyElement=_core.VxeUI.renderEmptyElement,sourceType="gantt",viewType="chart",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewChart",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},props:{},data:function(){return{}},computed:Object.assign({},{}),methods:{renderTaskBar:function(e,t,r,a,n,o,i){var l=this.$xeGantt,
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}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,a=Array(t);r<t;r++)a[r]=e[r];return a}var renderEmptyElement=_core.VxeUI.renderEmptyElement,sourceType="gantt",viewType="chart",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewChart",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},props:{},data:function(){return{}},computed:Object.assign({},{}),methods:{renderTaskBar:function(e,t,r,a,n,o,i){var l=this.$xeGantt,s=t.treeConfig,u=t.resizeHeightFlag,c=t.fullAllDataRowIdData,d=t.computeCellOpts,p=t.computeRowOpts,t=t.computeDefaultRowHeight,f=l.$scopedSlots,f=f.taskBar||f["task-bar"],h=l.computeTitleField,m=l.computeProgressField,g=l.computeTaskBarOpts,y={$gantt:l,row:r},v=g.showProgress,w=g.showContent,x=g.contentMethod,_=g.barStyle,b=g.drag,g=g.showTooltip,T=_xeUtils.default.isFunction(_),_=(_?T?_(y):_:{})||{},k=_.round,c=c[a]||{},u=0<(u?c.resizeHeight:0),c=(0,_util.getCellRestHeight)(c,d,p,t),d=(0,_utils.getStringValue)(_xeUtils.default.get(r,h)),p=v?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(r,m)))):0,t={},h={width:"".concat(p||0,"%")},E=(T&&(m=_.bgColor,p=_.completedBgColor,m&&(t.backgroundColor=m),p)&&(h.backgroundColor=p),x&&(d=(0,_utils.getStringValue)(x({row:r,title:d}))),{source:sourceType,type:viewType,row:r,$rowIndex:o,rowIndex:n,_rowIndex:i,$gantt:l}),T={click:function(e){l.handleTaskBarClickEvent(e,y)},dblclick:function(e){l.handleTaskBarDblclickEvent(e,y)},mousedown:function(e){l.handleTaskBarMousedownEvent&&l.handleTaskBarMousedownEvent(e,y)}};return g&&(T.mouseover=function(e){l.triggerTaskBarTooltipEvent(e,Object.assign({$event:e},E))},T.mouseleave=function(e){l.handleTaskBarTooltipLeaveEvent(e,Object.assign({$event:e},E))}),e("div",{key:s?a:o,attrs:{rowid:a},class:["vxe-gantt-view--chart-row",{"is--round":k,"is--drag":b,"col--rs-height":u}],style:{height:"".concat(c,"px")},on:{contextmenu:function(e){l.handleTaskBarContextmenuEvent(e,E)}}},[e("div",{class:f?"vxe-gantt-view--chart-custom-bar":"vxe-gantt-view--chart-bar",style:t,attrs:{rowid:a},on:T},f?l.callSlot(f,y,e):[v?e("div",{class:"vxe-gantt-view--chart-progress",style:h}):renderEmptyElement(l),w?e("div",{class:"vxe-gantt-view--chart-content"},d):renderEmptyElement(l)])])},renderRows:function(i,l,e){var s=this,t=s.$xeGanttView.reactData,u=l.treeConfig,c=l.treeExpandedFlag,d=l.fullAllDataRowIdData,p=l.treeExpandedMaps,r=l.computeTreeOpts,f=r.transform,h=r.children||r.childrenField,m=t.scrollYLoad,g=[];return e.forEach(function(e,t){var r=l?l.getRowid(e):"",a=d[r]||{},n=t,o=-1,a=(a&&(n=a.index,o=a._index),g.push(s.renderTaskBar(i,l,e,r,n,t,o)),!1),n=[];!u||m||f||(n=e[h],a=!!c&&n&&0<n.length&&!!p[r]),a&&g.push.apply(g,_toConsumableArray(s.renderRows(i,l,n)))}),g},renderVN:function(e){var t=this.$xeGanttView,r=t.reactData,t=t.internalData.xeTable,r=r.tableData;return e("div",{ref:"refElem",class:"vxe-gantt-view--chart-wrapper"},t?this.renderRows(e,t,r):[])}},mounted:function(){this.$xeGanttView.internalData.elemStore["".concat("main-chart-","wrapper")]=this.$refs.refElem},destroyed:function(){this.$xeGanttView.internalData.elemStore["".concat("main-chart-","wrapper")]=null},render:function(e){return this.renderVN(e)}});
|
|
@@ -78,15 +78,17 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
78
78
|
childCount = column.childCount,
|
|
79
79
|
dateObj = column.dateObj;
|
|
80
80
|
var label = "".concat(column.title);
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
label = getI18n("vxe.gantt.dayss.w".concat(dateObj.e));
|
|
84
|
-
} else {
|
|
85
|
-
label = getI18n("vxe.gantt.".concat(!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat', ".").concat(type), dateObj);
|
|
86
|
-
}
|
|
81
|
+
if (scaleItem.type === 'day') {
|
|
82
|
+
label = getI18n("vxe.gantt.dayss.w".concat(dateObj.e));
|
|
87
83
|
} else {
|
|
88
|
-
if (
|
|
84
|
+
if ($rowIndex) {
|
|
89
85
|
label = getI18n("vxe.gantt.tSimpleFormat.".concat(type), dateObj);
|
|
86
|
+
} else {
|
|
87
|
+
if (isLast && scaleItem.type === 'week') {
|
|
88
|
+
label = getI18n("vxe.gantt.tSimpleFormat.".concat(type), dateObj);
|
|
89
|
+
} else {
|
|
90
|
+
label = getI18n("vxe.gantt.tFullFormat.".concat(type), dateObj);
|
|
91
|
+
}
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
var cellVNs = label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}var getI18n=_core.VxeUI.getI18n,sourceType="gantt",viewType="header",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewHeader",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},computed:Object.assign({},{}),methods:{renderVN:function(h){var w=this.$xeGantt,e=this.$xeGanttView,t=e.reactData,a=e.internalData,
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _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}}var getI18n=_core.VxeUI.getI18n,sourceType="gantt",viewType="header",_default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttViewHeader",inject:{$xeGantt:{default:null},$xeGanttView:{default:null}},computed:Object.assign({},{}),methods:{renderVN:function(h){var w=this.$xeGantt,e=this.$xeGanttView,t=e.reactData,a=e.internalData,r=t.headerGroups,n=t.viewCellWidth,l=a.todayDateMaps,t=a.visibleColumn,y=w.computeTaskViewOpts.showNowLine;return h("div",{ref:"refElem",class:"vxe-gantt-view--header-wrapper"},[h("div",{ref:"refHeaderScroll",class:"vxe-gantt-view--header-inner-wrapper",on:{scroll:e.triggerHeaderScrollEvent}},[h("div",{ref:"refHeaderXSpace",class:"vxe-body--x-space"}),h("table",{ref:"refHeaderTable",class:"vxe-gantt-view--header-table"},[h("colgroup",{},t.map(function(e,t){return h("col",{key:t,style:{width:"".concat(n,"px")}})})),h("thead",{},r.map(function(e,i){var u=e.scaleItem,e=e.columns,s=u.type,d=u.titleFormat,p=u.titleMethod,f=u.headerCellStyle,t=u.slots,x=t?t.title:null,v=i===r.length-1,m=v&&y?l[s]:null;return h("tr",{key:i},e.map(function(e,t){var a=e.field,r=e.childCount,n=e.dateObj,l="".concat(e.title),o=l="day"===u.type?getI18n("vxe.gantt.dayss.w".concat(n.e)):i||v&&"week"===u.type?getI18n("vxe.gantt.tSimpleFormat.".concat(s),n):getI18n("vxe.gantt.tFullFormat.".concat(s),n),c={source:sourceType,type:viewType,column:e,scaleObj:u,title:l,dateObj:n,$rowIndex:i},e=(x?o=w.callSlot(x,c,h):p?o="".concat(p(c)):d&&(o=_xeUtils.default.toDateString(n.date,d)),{});return f&&(e=_xeUtils.default.isFunction(f)?f(c):f),h("th",{key:t,class:["vxe-gantt-view--header-column",{"is--now":y&&m&&m===a}],attrs:{colspan:r||null,title:x?null:l},style:e,on:{contextmenu:function(e){w.handleTaskHeaderContextmenuEvent(e,c)}}},o)}))}))])])])}},mounted:function(){var e=this,t=e.$xeGanttView.internalData.elemStore,a="main-header-";t["".concat(a,"wrapper")]=e.$refs.refElem,t["".concat(a,"scroll")]=e.$refs.refHeaderScroll,t["".concat(a,"table")]=e.$refs.refHeaderTable,t["".concat(a,"xSpace")]=e.$refs.refHeaderXSpace},destroyed:function(){var e=this.$xeGanttView.internalData.elemStore,t="main-header-";e["".concat(t,"wrapper")]=null,e["".concat(t,"scroll")]=null,e["".concat(t,"table")]=null,e["".concat(t,"xSpace")]=null},render:function(e){return this.renderVN(e)}});
|
|
@@ -221,7 +221,7 @@ function handleColumnHeader($xeGanttView) {
|
|
|
221
221
|
if (minScale.level < 17) {
|
|
222
222
|
handleData('quarter', colMaps, minCol);
|
|
223
223
|
}
|
|
224
|
-
if (minScale.level <
|
|
224
|
+
if (minScale.level < 15) {
|
|
225
225
|
handleData('month', colMaps, minCol);
|
|
226
226
|
}
|
|
227
227
|
if (minScale.level < 13) {
|
|
@@ -230,7 +230,7 @@ function handleColumnHeader($xeGanttView) {
|
|
|
230
230
|
if (minScale.level < 11) {
|
|
231
231
|
handleData('day', colMaps, minCol);
|
|
232
232
|
}
|
|
233
|
-
if (minScale.level <
|
|
233
|
+
if (minScale.level < 9) {
|
|
234
234
|
handleData('date', colMaps, minCol);
|
|
235
235
|
}
|
|
236
236
|
if (minScale.level < 7) {
|
|
@@ -239,6 +239,9 @@ function handleColumnHeader($xeGanttView) {
|
|
|
239
239
|
if (minScale.level < 5) {
|
|
240
240
|
handleData('minute', colMaps, minCol);
|
|
241
241
|
}
|
|
242
|
+
if (minScale.level < 3) {
|
|
243
|
+
handleData('second', colMaps, minCol);
|
|
244
|
+
}
|
|
242
245
|
fullCols.push(minCol);
|
|
243
246
|
}
|
|
244
247
|
taskScaleList.forEach(function (scaleItem) {
|