vxe-gantt 3.0.27 → 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 +18 -6
- package/es/gantt/src/gantt-view.js +311 -47
- package/es/gantt/src/gantt.js +170 -7
- package/es/gantt/src/util.js +11 -0
- 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 +15 -5
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +346 -51
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +168 -5
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +12 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/index.umd.js +588 -83
- 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 +3 -3
- package/packages/gantt/src/gantt-chart.ts +30 -15
- package/packages/gantt/src/gantt-header.ts +15 -6
- package/packages/gantt/src/gantt-view.ts +321 -49
- package/packages/gantt/src/gantt.ts +179 -7
- package/packages/gantt/src/util.ts +13 -0
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +8 -0
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,12 +186,41 @@ export default {
|
|
|
179
186
|
const props = $xeGantt;
|
|
180
187
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
|
|
181
188
|
},
|
|
182
|
-
|
|
189
|
+
computeTaskBarTooltipOpts() {
|
|
190
|
+
const $xeGantt = this;
|
|
191
|
+
const props = $xeGantt;
|
|
192
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig);
|
|
193
|
+
},
|
|
194
|
+
computeScaleUnit() {
|
|
195
|
+
const $xeGantt = this;
|
|
196
|
+
const minScale = $xeGantt.computeMinScale;
|
|
197
|
+
return minScale ? minScale.type : 'date';
|
|
198
|
+
},
|
|
199
|
+
computeMinScale() {
|
|
200
|
+
const $xeGantt = this;
|
|
201
|
+
const reactData = $xeGantt.reactData;
|
|
202
|
+
const { taskScaleList } = reactData;
|
|
203
|
+
return XEUtils.last(taskScaleList);
|
|
204
|
+
},
|
|
205
|
+
computeWeekScale() {
|
|
206
|
+
const $xeGantt = this;
|
|
207
|
+
const reactData = $xeGantt.reactData;
|
|
208
|
+
const { taskScaleList } = reactData;
|
|
209
|
+
return taskScaleList.find(item => item.type === 'week');
|
|
210
|
+
},
|
|
211
|
+
computeTaskViewScales() {
|
|
183
212
|
const $xeGantt = this;
|
|
184
213
|
const taskViewOpts = $xeGantt.computeTaskViewOpts;
|
|
185
214
|
const { scales } = taskViewOpts;
|
|
186
215
|
return scales;
|
|
187
216
|
},
|
|
217
|
+
/**
|
|
218
|
+
* 已废弃,保留兼容
|
|
219
|
+
* @deprecated
|
|
220
|
+
*/
|
|
221
|
+
computeTaskScaleConfs() {
|
|
222
|
+
return this.computeTaskViewScales;
|
|
223
|
+
},
|
|
188
224
|
computeTitleField() {
|
|
189
225
|
const $xeGantt = this;
|
|
190
226
|
const taskOpts = $xeGantt.computeTaskOpts;
|
|
@@ -432,9 +468,10 @@ export default {
|
|
|
432
468
|
const $xeGantt = this;
|
|
433
469
|
$xeGantt.initProxy();
|
|
434
470
|
},
|
|
435
|
-
|
|
471
|
+
computeTaskViewScales() {
|
|
436
472
|
const $xeGantt = this;
|
|
437
473
|
$xeGantt.handleTaskScaleConfig();
|
|
474
|
+
$xeGantt.refreshTaskView();
|
|
438
475
|
}
|
|
439
476
|
},
|
|
440
477
|
methods: Object.assign(Object.assign({}, tableMethods), { dispatchEvent(type, params, evnt) {
|
|
@@ -444,7 +481,7 @@ export default {
|
|
|
444
481
|
handleTaskScaleConfig() {
|
|
445
482
|
const $xeGantt = this;
|
|
446
483
|
const reactData = $xeGantt.reactData;
|
|
447
|
-
const taskScaleConfs = $xeGantt.
|
|
484
|
+
const taskScaleConfs = $xeGantt.computeTaskViewScales;
|
|
448
485
|
const taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts;
|
|
449
486
|
const scaleConfs = [];
|
|
450
487
|
if (taskScaleConfs) {
|
|
@@ -1546,6 +1583,27 @@ export default {
|
|
|
1546
1583
|
reactData.showRightView = false;
|
|
1547
1584
|
return $xeGantt.$nextTick();
|
|
1548
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
|
+
},
|
|
1549
1607
|
callSlot(slotFunc, params, h) {
|
|
1550
1608
|
const $xeGantt = this;
|
|
1551
1609
|
const slots = $xeGantt.$scopedSlots;
|
|
@@ -1669,6 +1727,72 @@ export default {
|
|
|
1669
1727
|
const $xeGantt = this;
|
|
1670
1728
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
|
|
1671
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
|
+
},
|
|
1672
1796
|
handleTaskHeaderContextmenuEvent(evnt, params) {
|
|
1673
1797
|
const $xeGantt = this;
|
|
1674
1798
|
const $xeTable = $xeGantt.$refs.refTable;
|
|
@@ -2142,12 +2266,17 @@ export default {
|
|
|
2142
2266
|
return childVNs;
|
|
2143
2267
|
},
|
|
2144
2268
|
renderLayout(h) {
|
|
2269
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
2145
2270
|
const $xeGantt = this;
|
|
2271
|
+
const reactData = $xeGantt.reactData;
|
|
2146
2272
|
const slots = $xeGantt.$scopedSlots;
|
|
2273
|
+
const { barTipStore } = reactData;
|
|
2147
2274
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf;
|
|
2148
2275
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf;
|
|
2276
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
|
|
2149
2277
|
const asideLeftSlot = slots.asideLeft || slots['aside-left'];
|
|
2150
2278
|
const asideRightSlot = slots.asideRight || slots['aside-right'];
|
|
2279
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
|
|
2151
2280
|
return [
|
|
2152
2281
|
h('div', {
|
|
2153
2282
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2174,7 +2303,41 @@ export default {
|
|
|
2174
2303
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2175
2304
|
h('div', {
|
|
2176
2305
|
ref: 'refPopupContainerElem'
|
|
2177
|
-
})
|
|
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
|
+
])
|
|
2178
2341
|
];
|
|
2179
2342
|
},
|
|
2180
2343
|
renderVN(h) {
|
package/es/gantt/src/util.js
CHANGED
|
@@ -7,3 +7,14 @@ export function getRefElem(refEl) {
|
|
|
7
7
|
export function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
|
|
8
8
|
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
9
9
|
}
|
|
10
|
+
export function getStandardGapTime(type) {
|
|
11
|
+
switch (type) {
|
|
12
|
+
case 'hour':
|
|
13
|
+
return 1000 * 60 * 60;
|
|
14
|
+
case 'minute':
|
|
15
|
+
return 1000 * 60;
|
|
16
|
+
case 'second':
|
|
17
|
+
return 1000;
|
|
18
|
+
}
|
|
19
|
+
return 1000 * 60 * 60 * 24;
|
|
20
|
+
}
|
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.
|
|
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)}});
|
|
@@ -64,11 +64,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
64
64
|
var scaleItem = _ref.scaleItem,
|
|
65
65
|
columns = _ref.columns;
|
|
66
66
|
var type = scaleItem.type,
|
|
67
|
+
titleFormat = scaleItem.titleFormat,
|
|
67
68
|
titleMethod = scaleItem.titleMethod,
|
|
68
69
|
headerCellStyle = scaleItem.headerCellStyle,
|
|
69
70
|
slots = scaleItem.slots;
|
|
70
71
|
var titleSlot = slots ? slots.title : null;
|
|
71
|
-
var
|
|
72
|
+
var isLast = $rowIndex === headerGroups.length - 1;
|
|
73
|
+
var todayValue = isLast && showNowLine ? todayDateMaps[type] : null;
|
|
72
74
|
return h('tr', {
|
|
73
75
|
key: $rowIndex
|
|
74
76
|
}, columns.map(function (column, cIndex) {
|
|
@@ -76,11 +78,17 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
76
78
|
childCount = column.childCount,
|
|
77
79
|
dateObj = column.dateObj;
|
|
78
80
|
var label = "".concat(column.title);
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
if (scaleItem.type === 'day') {
|
|
82
|
+
label = getI18n("vxe.gantt.dayss.w".concat(dateObj.e));
|
|
83
|
+
} else {
|
|
84
|
+
if ($rowIndex) {
|
|
85
|
+
label = getI18n("vxe.gantt.tSimpleFormat.".concat(type), dateObj);
|
|
82
86
|
} else {
|
|
83
|
-
|
|
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
|
+
}
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
var cellVNs = label;
|
|
@@ -97,6 +105,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
97
105
|
cellVNs = $xeGantt.callSlot(titleSlot, ctParams, h);
|
|
98
106
|
} else if (titleMethod) {
|
|
99
107
|
cellVNs = "".concat(titleMethod(ctParams));
|
|
108
|
+
} else if (titleFormat) {
|
|
109
|
+
cellVNs = _xeUtils.default.toDateString(dateObj.date, titleFormat);
|
|
100
110
|
}
|
|
101
111
|
var cellStys = {};
|
|
102
112
|
if (headerCellStyle) {
|
|
@@ -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(
|
|
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)}});
|