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
package/lib/ui/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _log = require("./src/log");
|
|
|
15
15
|
var setConfig = _core.VxeUI.setConfig,
|
|
16
16
|
setIcon = _core.VxeUI.setIcon,
|
|
17
17
|
checkVersion = _core.VxeUI.checkVersion;
|
|
18
|
-
_core.VxeUI.ganttVersion = "3.1.
|
|
18
|
+
_core.VxeUI.ganttVersion = "3.1.1";
|
|
19
19
|
setConfig({
|
|
20
20
|
gantt: {
|
|
21
21
|
// size: null,
|
|
@@ -54,6 +54,9 @@ setConfig({
|
|
|
54
54
|
// beforeSave: null,
|
|
55
55
|
// afterSave: null
|
|
56
56
|
},
|
|
57
|
+
taskBarTooltipConfig: {
|
|
58
|
+
enterable: true
|
|
59
|
+
},
|
|
57
60
|
taskViewScaleConfig: {
|
|
58
61
|
week: {
|
|
59
62
|
startDay: 1
|
package/lib/ui/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),_log=require("./src/log"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,checkVersion=_core.VxeUI.checkVersion,iconPrefix=(_core.VxeUI.ganttVersion="3.1.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),_log=require("./src/log"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,checkVersion=_core.VxeUI.checkVersion,iconPrefix=(_core.VxeUI.ganttVersion="3.1.1",setConfig({gantt:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:null,result:"result",total:"page.total",message:"message"}},taskBarTooltipConfig:{enterable:!0},taskViewScaleConfig:{week:{startDay:1}},taskViewConfig:{showNowLine:!0},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),pVersion=(setIcon({GANTT_VIEW_LEFT_OPEN:iconPrefix+"arrow-left",GANTT_VIEW_LEFT_CLOSE:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_OPEN:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_CLOSE:iconPrefix+"arrow-left"}),3),sVersion=18,_default=(checkVersion?checkVersion(_core.VxeUI.tableVersion,pVersion,sVersion)||(0,_log.errLog)("vxe.error.errorVersion",["vxe-table@".concat(_core.VxeUI.tableVersion||"?"),"vxe-table v".concat(pVersion,".").concat(sVersion,"+")]):(0,_log.errLog)("Requires vxe-table v".concat(pVersion,".").concat(sVersion,"+")),exports.default=_core.VxeUI);
|
package/lib/ui/src/log.js
CHANGED
|
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.warnLog = exports.errLog = void 0;
|
|
7
7
|
var _core = require("@vxe-ui/core");
|
|
8
8
|
var log = _core.VxeUI.log;
|
|
9
|
-
var version = "gantt v".concat("3.1.
|
|
9
|
+
var version = "gantt v".concat("3.1.1");
|
|
10
10
|
var warnLog = exports.warnLog = log.create('warn', version);
|
|
11
11
|
var errLog = exports.errLog = log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core"),log=_core.VxeUI.log,version="gantt v".concat("3.1.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core"),log=_core.VxeUI.log,version="gantt v".concat("3.1.1"),warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
|
package/lib/ui/src/utils.js
CHANGED
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.eqEmptyValue = eqEmptyValue;
|
|
7
|
+
exports.formatText = formatText;
|
|
7
8
|
exports.getClass = getClass;
|
|
8
9
|
exports.getFuncText = getFuncText;
|
|
9
10
|
exports.getGlobalDefaultConfig = getGlobalDefaultConfig;
|
|
10
11
|
exports.getLastZIndex = getLastZIndex;
|
|
11
12
|
exports.getStringValue = getStringValue;
|
|
12
13
|
exports.getSubLastZIndex = getSubLastZIndex;
|
|
14
|
+
exports.isEmptyValue = isEmptyValue;
|
|
13
15
|
exports.isEnableConf = isEnableConf;
|
|
14
16
|
exports.nextSubZIndex = nextSubZIndex;
|
|
15
17
|
exports.nextZIndex = nextZIndex;
|
|
@@ -21,6 +23,9 @@ var getConfig = _core.VxeUI.getConfig;
|
|
|
21
23
|
function isEnableConf(conf) {
|
|
22
24
|
return conf && conf.enabled !== false;
|
|
23
25
|
}
|
|
26
|
+
function isEmptyValue(cellValue) {
|
|
27
|
+
return cellValue === null || cellValue === undefined || cellValue === '';
|
|
28
|
+
}
|
|
24
29
|
function nextZIndex() {
|
|
25
30
|
return _domZindex.default.getNext();
|
|
26
31
|
}
|
|
@@ -46,6 +51,9 @@ function getFuncText(content, args) {
|
|
|
46
51
|
}
|
|
47
52
|
return '';
|
|
48
53
|
}
|
|
54
|
+
function formatText(value, placeholder) {
|
|
55
|
+
return '' + (isEmptyValue(value) ? placeholder ? _core.VxeUI.getConfig().emptyCell : '' : value);
|
|
56
|
+
}
|
|
49
57
|
/**
|
|
50
58
|
* 判断值为:'' | null | undefined 时都属于空值
|
|
51
59
|
*/
|
package/lib/ui/src/utils.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.eqEmptyValue=eqEmptyValue,exports.getClass=getClass,exports.getFuncText=getFuncText,exports.getGlobalDefaultConfig=getGlobalDefaultConfig,exports.getLastZIndex=getLastZIndex,exports.getStringValue=getStringValue,exports.getSubLastZIndex=getSubLastZIndex,exports.isEnableConf=isEnableConf,exports.nextSubZIndex=nextSubZIndex,exports.nextZIndex=nextZIndex;var _xeUtils=_interopRequireDefault(require("xe-utils")),_core=require("@vxe-ui/core"),_domZindex=_interopRequireDefault(require("dom-zindex"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var getConfig=_core.VxeUI.getConfig;function isEnableConf(e){return e&&!1!==e.enabled}function nextZIndex(){return _domZindex.default.getNext()}function getLastZIndex(){return _domZindex.default.getCurrent()}function nextSubZIndex(){return _domZindex.default.getSubNext()}function getSubLastZIndex(){return _domZindex.default.getSubCurrent()}function getGlobalDefaultConfig(e,t){return _xeUtils.default.eqNull(e)?t:e}function getFuncText(e,t){var n;return e?(n=getConfig().translate,_xeUtils.default.toValueString(n?n(""+e,t):e)):""}function eqEmptyValue(e){return null==e||""===e}function getStringValue(e){return eqEmptyValue(e)?"":e}function getClass(e,t){return e?_xeUtils.default.isFunction(e)?e(t):e:""}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.eqEmptyValue=eqEmptyValue,exports.formatText=formatText,exports.getClass=getClass,exports.getFuncText=getFuncText,exports.getGlobalDefaultConfig=getGlobalDefaultConfig,exports.getLastZIndex=getLastZIndex,exports.getStringValue=getStringValue,exports.getSubLastZIndex=getSubLastZIndex,exports.isEmptyValue=isEmptyValue,exports.isEnableConf=isEnableConf,exports.nextSubZIndex=nextSubZIndex,exports.nextZIndex=nextZIndex;var _xeUtils=_interopRequireDefault(require("xe-utils")),_core=require("@vxe-ui/core"),_domZindex=_interopRequireDefault(require("dom-zindex"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var getConfig=_core.VxeUI.getConfig;function isEnableConf(e){return e&&!1!==e.enabled}function isEmptyValue(e){return null==e||""===e}function nextZIndex(){return _domZindex.default.getNext()}function getLastZIndex(){return _domZindex.default.getCurrent()}function nextSubZIndex(){return _domZindex.default.getSubNext()}function getSubLastZIndex(){return _domZindex.default.getSubCurrent()}function getGlobalDefaultConfig(e,t){return _xeUtils.default.eqNull(e)?t:e}function getFuncText(e,t){var n;return e?(n=getConfig().translate,_xeUtils.default.toValueString(n?n(""+e,t):e)):""}function formatText(e,t){return""+(isEmptyValue(e)?t?_core.VxeUI.getConfig().emptyCell:"":e)}function eqEmptyValue(e){return null==e||""===e}function getStringValue(e){return eqEmptyValue(e)?"":e}function getClass(e,t){return e?_xeUtils.default.isFunction(e)?e(t):e:""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-gantt",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "A vue based gantt component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vue": "~2.6.14",
|
|
65
65
|
"vue-i18n": "^8.15.1",
|
|
66
66
|
"vue-router": "^3.5.1",
|
|
67
|
-
"vxe-pc-ui": "^3.10.
|
|
67
|
+
"vxe-pc-ui": "^3.10.44",
|
|
68
68
|
"vxe-table": "^3.19.26"
|
|
69
69
|
},
|
|
70
70
|
"vetur": {
|
|
@@ -59,7 +59,7 @@ export default defineVxeComponent({
|
|
|
59
59
|
const progressField = $xeGantt.computeProgressField
|
|
60
60
|
const taskBarOpts = $xeGantt.computeTaskBarOpts
|
|
61
61
|
const barParams = { $gantt: $xeGantt, row }
|
|
62
|
-
const { showProgress, showContent, contentMethod, barStyle, drag } = taskBarOpts
|
|
62
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts
|
|
63
63
|
const isBarRowStyle = XEUtils.isFunction(barStyle)
|
|
64
64
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {}
|
|
65
65
|
const { round } = barStyObj
|
|
@@ -90,7 +90,34 @@ export default defineVxeComponent({
|
|
|
90
90
|
title = getStringValue(contentMethod({ row, title }))
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex }
|
|
93
|
+
const ctParams = { source: sourceType, type: viewType, row, $rowIndex, rowIndex, _rowIndex, $gantt: $xeGantt }
|
|
94
|
+
const ons: {
|
|
95
|
+
click: any
|
|
96
|
+
dblclick: any
|
|
97
|
+
mousedown: any
|
|
98
|
+
mouseover?: any
|
|
99
|
+
mouseleave?: any
|
|
100
|
+
} = {
|
|
101
|
+
click (evnt: MouseEvent) {
|
|
102
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
103
|
+
},
|
|
104
|
+
dblclick (evnt: MouseEvent) {
|
|
105
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
106
|
+
},
|
|
107
|
+
mousedown (evnt: MouseEvent) {
|
|
108
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
109
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (showTooltip) {
|
|
114
|
+
ons.mouseover = (evnt: MouseEvent) => {
|
|
115
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams))
|
|
116
|
+
}
|
|
117
|
+
ons.mouseleave = (evnt: MouseEvent) => {
|
|
118
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
94
121
|
return h('div', {
|
|
95
122
|
key: treeConfig ? rowid : $rowIndex,
|
|
96
123
|
attrs: {
|
|
@@ -116,19 +143,7 @@ export default defineVxeComponent({
|
|
|
116
143
|
attrs: {
|
|
117
144
|
rowid
|
|
118
145
|
},
|
|
119
|
-
on:
|
|
120
|
-
click (evnt: MouseEvent) {
|
|
121
|
-
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
122
|
-
},
|
|
123
|
-
dblclick (evnt: MouseEvent) {
|
|
124
|
-
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
125
|
-
},
|
|
126
|
-
mousedown (evnt: MouseEvent) {
|
|
127
|
-
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
128
|
-
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
146
|
+
on: ons
|
|
132
147
|
}, taskBarSlot
|
|
133
148
|
? $xeGantt.callSlot(taskBarSlot, barParams, h)
|
|
134
149
|
: [
|
|
@@ -79,15 +79,17 @@ export default defineVxeComponent({
|
|
|
79
79
|
}, columns.map((column, cIndex) => {
|
|
80
80
|
const { field, childCount, dateObj } = column
|
|
81
81
|
let label = `${column.title}`
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
|
|
85
|
-
} else {
|
|
86
|
-
label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj)
|
|
87
|
-
}
|
|
82
|
+
if (scaleItem.type === 'day') {
|
|
83
|
+
label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`)
|
|
88
84
|
} else {
|
|
89
|
-
if (
|
|
85
|
+
if ($rowIndex) {
|
|
90
86
|
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj)
|
|
87
|
+
} else {
|
|
88
|
+
if (isLast && scaleItem.type === 'week') {
|
|
89
|
+
label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj)
|
|
90
|
+
} else {
|
|
91
|
+
label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj)
|
|
92
|
+
}
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
let cellVNs: string | VxeComponentSlotType[] = label
|
|
@@ -197,7 +197,7 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
|
|
|
197
197
|
if (minScale.level < 17) {
|
|
198
198
|
handleData('quarter', colMaps, minCol)
|
|
199
199
|
}
|
|
200
|
-
if (minScale.level <
|
|
200
|
+
if (minScale.level < 15) {
|
|
201
201
|
handleData('month', colMaps, minCol)
|
|
202
202
|
}
|
|
203
203
|
if (minScale.level < 13) {
|
|
@@ -206,7 +206,7 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
|
|
|
206
206
|
if (minScale.level < 11) {
|
|
207
207
|
handleData('day', colMaps, minCol)
|
|
208
208
|
}
|
|
209
|
-
if (minScale.level <
|
|
209
|
+
if (minScale.level < 9) {
|
|
210
210
|
handleData('date', colMaps, minCol)
|
|
211
211
|
}
|
|
212
212
|
if (minScale.level < 7) {
|
|
@@ -215,6 +215,9 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
|
|
|
215
215
|
if (minScale.level < 5) {
|
|
216
216
|
handleData('minute', colMaps, minCol)
|
|
217
217
|
}
|
|
218
|
+
if (minScale.level < 3) {
|
|
219
|
+
handleData('second', colMaps, minCol)
|
|
220
|
+
}
|
|
218
221
|
|
|
219
222
|
fullCols.push(minCol)
|
|
220
223
|
}
|
|
@@ -2,7 +2,7 @@ import { PropType, VNode, CreateElement, Component } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
|
-
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
|
+
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
6
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -10,7 +10,7 @@ import GanttViewComponent from './gantt-view'
|
|
|
10
10
|
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
11
11
|
|
|
12
12
|
import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxePagerDefines, VxeComponentStyleType, VxeComponentSizeType, VxeFormDefines, VxeFormItemPropTypes } from 'vxe-pc-ui'
|
|
13
|
-
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
13
|
+
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTooltipInstance, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
14
14
|
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines, VxeGanttConstructor } from '../../../types'
|
|
15
15
|
|
|
16
16
|
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
@@ -78,6 +78,7 @@ function createInternalData (): GanttInternalData {
|
|
|
78
78
|
return {
|
|
79
79
|
uFoot: false,
|
|
80
80
|
resizeTableWidth: 0
|
|
81
|
+
// barTipTimeout: undefined
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -120,6 +121,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
120
121
|
taskViewScaleConfig: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfig>,
|
|
121
122
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
122
123
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
124
|
+
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
123
125
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
124
126
|
taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
|
|
125
127
|
taskBarDragConfig: Object as PropType<VxeGanttPropTypes.TaskBarDragConfig>,
|
|
@@ -157,7 +159,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
157
159
|
},
|
|
158
160
|
showLeftView: true,
|
|
159
161
|
showRightView: true,
|
|
160
|
-
taskScaleList: []
|
|
162
|
+
taskScaleList: [],
|
|
163
|
+
|
|
164
|
+
barTipStore: {
|
|
165
|
+
row: null,
|
|
166
|
+
content: '',
|
|
167
|
+
visible: false,
|
|
168
|
+
params: null
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
const internalData = createInternalData()
|
|
@@ -256,6 +265,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
256
265
|
|
|
257
266
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
258
267
|
},
|
|
268
|
+
computeTaskBarTooltipOpts () {
|
|
269
|
+
const $xeGantt = this
|
|
270
|
+
const props = $xeGantt
|
|
271
|
+
|
|
272
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
273
|
+
},
|
|
259
274
|
computeScaleUnit () {
|
|
260
275
|
const $xeGantt = this
|
|
261
276
|
|
|
@@ -276,13 +291,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
276
291
|
const { taskScaleList } = reactData
|
|
277
292
|
return taskScaleList.find(item => item.type === 'week')
|
|
278
293
|
},
|
|
279
|
-
|
|
294
|
+
computeTaskViewScales () {
|
|
280
295
|
const $xeGantt = this
|
|
281
296
|
|
|
282
297
|
const taskViewOpts = $xeGantt.computeTaskViewOpts as VxeGanttPropTypes.TaskViewConfig
|
|
283
298
|
const { scales } = taskViewOpts
|
|
284
299
|
return scales
|
|
285
300
|
},
|
|
301
|
+
/**
|
|
302
|
+
* 已废弃,保留兼容
|
|
303
|
+
* @deprecated
|
|
304
|
+
*/
|
|
305
|
+
computeTaskScaleConfs () {
|
|
306
|
+
return this.computeTaskViewScales
|
|
307
|
+
},
|
|
286
308
|
computeTitleField () {
|
|
287
309
|
const $xeGantt = this
|
|
288
310
|
|
|
@@ -550,7 +572,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
550
572
|
|
|
551
573
|
$xeGantt.initProxy()
|
|
552
574
|
},
|
|
553
|
-
|
|
575
|
+
computeTaskViewScales () {
|
|
554
576
|
const $xeGantt = this
|
|
555
577
|
|
|
556
578
|
$xeGantt.handleTaskScaleConfig()
|
|
@@ -568,7 +590,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
568
590
|
const $xeGantt = this
|
|
569
591
|
const reactData = $xeGantt.reactData
|
|
570
592
|
|
|
571
|
-
const taskScaleConfs = $xeGantt.
|
|
593
|
+
const taskScaleConfs = $xeGantt.computeTaskViewScales
|
|
572
594
|
const taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts
|
|
573
595
|
const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
|
|
574
596
|
if (taskScaleConfs) {
|
|
@@ -1712,6 +1734,28 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1712
1734
|
reactData.showRightView = false
|
|
1713
1735
|
return $xeGantt.$nextTick()
|
|
1714
1736
|
},
|
|
1737
|
+
/**
|
|
1738
|
+
* 关闭 bar tooltip
|
|
1739
|
+
*/
|
|
1740
|
+
closeTaskBarTooltip () {
|
|
1741
|
+
const $xeGantt = this
|
|
1742
|
+
const reactData = $xeGantt.reactData
|
|
1743
|
+
|
|
1744
|
+
const { barTipStore } = reactData
|
|
1745
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1746
|
+
if (barTipStore.visible) {
|
|
1747
|
+
Object.assign(barTipStore, {
|
|
1748
|
+
row: null,
|
|
1749
|
+
content: null,
|
|
1750
|
+
visible: false,
|
|
1751
|
+
params: {}
|
|
1752
|
+
})
|
|
1753
|
+
if ($tooltip && $tooltip.close) {
|
|
1754
|
+
$tooltip.close()
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
return $xeGantt.$nextTick()
|
|
1758
|
+
},
|
|
1715
1759
|
callSlot (slotFunc: any, params: any, h: CreateElement) {
|
|
1716
1760
|
const $xeGantt = this
|
|
1717
1761
|
const slots = $xeGantt.$scopedSlots
|
|
@@ -1846,6 +1890,72 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1846
1890
|
|
|
1847
1891
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1848
1892
|
},
|
|
1893
|
+
triggerTaskBarTooltipEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskBarMouseoverParams) {
|
|
1894
|
+
const $xeGantt = this
|
|
1895
|
+
const reactData = $xeGantt.reactData
|
|
1896
|
+
|
|
1897
|
+
const { barTipStore } = reactData
|
|
1898
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
1899
|
+
const titleField = $xeGantt.computeTitleField
|
|
1900
|
+
const { contentMethod } = taskBarTooltipOpts
|
|
1901
|
+
const { row } = params
|
|
1902
|
+
let content = formatText(XEUtils.get(row, titleField))
|
|
1903
|
+
if (contentMethod) {
|
|
1904
|
+
content = formatText(contentMethod(params))
|
|
1905
|
+
}
|
|
1906
|
+
$xeGantt.handleTargetEnterEvent(barTipStore.row !== row)
|
|
1907
|
+
const tipContent = formatText(content)
|
|
1908
|
+
Object.assign(barTipStore, {
|
|
1909
|
+
row,
|
|
1910
|
+
visible: true,
|
|
1911
|
+
content: tipContent,
|
|
1912
|
+
params
|
|
1913
|
+
})
|
|
1914
|
+
$xeGantt.$nextTick(() => {
|
|
1915
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1916
|
+
if ($tooltip) {
|
|
1917
|
+
if ($tooltip.openByEvent) {
|
|
1918
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent)
|
|
1919
|
+
} else if ($tooltip.open) {
|
|
1920
|
+
$tooltip.open(evnt.currentTarget, tipContent)
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
})
|
|
1924
|
+
},
|
|
1925
|
+
handleTargetEnterEvent (isClear: boolean) {
|
|
1926
|
+
const $xeGantt = this
|
|
1927
|
+
const internalData = $xeGantt.internalData
|
|
1928
|
+
|
|
1929
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1930
|
+
clearTimeout(internalData.barTipTimeout)
|
|
1931
|
+
if (isClear) {
|
|
1932
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1933
|
+
} else {
|
|
1934
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1935
|
+
$tooltip.setActived(true)
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
handleTaskBarTooltipLeaveEvent () {
|
|
1940
|
+
const $xeGantt = this
|
|
1941
|
+
const internalData = $xeGantt.internalData
|
|
1942
|
+
|
|
1943
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
1944
|
+
let $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1945
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1946
|
+
$tooltip.setActived(false)
|
|
1947
|
+
}
|
|
1948
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1949
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1950
|
+
$tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1951
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1952
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1953
|
+
}
|
|
1954
|
+
}, taskBarTooltipOpts.leaveDelay)
|
|
1955
|
+
} else {
|
|
1956
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1957
|
+
}
|
|
1958
|
+
},
|
|
1849
1959
|
handleTaskHeaderContextmenuEvent (evnt: Event, params: VxeGanttDefines.TaskHeaderContextmenuParams) {
|
|
1850
1960
|
const $xeGantt = this
|
|
1851
1961
|
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -2356,13 +2466,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2356
2466
|
return childVNs
|
|
2357
2467
|
},
|
|
2358
2468
|
renderLayout (h: CreateElement) {
|
|
2469
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
2470
|
+
|
|
2359
2471
|
const $xeGantt = this
|
|
2472
|
+
const reactData = $xeGantt.reactData
|
|
2360
2473
|
const slots = $xeGantt.$scopedSlots
|
|
2361
2474
|
|
|
2475
|
+
const { barTipStore } = reactData
|
|
2362
2476
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf
|
|
2363
2477
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
2478
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
2364
2479
|
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
2365
2480
|
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
2481
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip']
|
|
2366
2482
|
return [
|
|
2367
2483
|
h('div', {
|
|
2368
2484
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2389,7 +2505,42 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2389
2505
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2390
2506
|
h('div', {
|
|
2391
2507
|
ref: 'refPopupContainerElem'
|
|
2392
|
-
})
|
|
2508
|
+
}),
|
|
2509
|
+
h('div', {}, [
|
|
2510
|
+
/**
|
|
2511
|
+
* 任务条提示
|
|
2512
|
+
*/
|
|
2513
|
+
h(VxeUITooltipComponent, {
|
|
2514
|
+
key: 'gtp',
|
|
2515
|
+
ref: 'refTooltip',
|
|
2516
|
+
props: {
|
|
2517
|
+
theme: taskBarTooltipOpts.theme,
|
|
2518
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2519
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2520
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2521
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2522
|
+
width: taskBarTooltipOpts.width,
|
|
2523
|
+
height: taskBarTooltipOpts.height,
|
|
2524
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2525
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2526
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2527
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2528
|
+
isArrow: false
|
|
2529
|
+
},
|
|
2530
|
+
scopedSlots: taskBarTooltipSlot
|
|
2531
|
+
? {
|
|
2532
|
+
content: () => {
|
|
2533
|
+
const { row, content: tooltipContent } = barTipStore
|
|
2534
|
+
if (row) {
|
|
2535
|
+
return h('div', {
|
|
2536
|
+
}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)))
|
|
2537
|
+
}
|
|
2538
|
+
return renderEmptyElement($xeGantt)
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
: {}
|
|
2542
|
+
})
|
|
2543
|
+
])
|
|
2393
2544
|
]
|
|
2394
2545
|
},
|
|
2395
2546
|
renderVN (h: CreateElement): VNode {
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -8,6 +8,10 @@ export function isEnableConf (conf: any): boolean {
|
|
|
8
8
|
return conf && conf.enabled !== false
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function isEmptyValue (cellValue: any) {
|
|
12
|
+
return cellValue === null || cellValue === undefined || cellValue === ''
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export function nextZIndex () {
|
|
12
16
|
return DomZIndex.getNext()
|
|
13
17
|
}
|
|
@@ -39,6 +43,10 @@ export function getFuncText (content: string | number | boolean | null | undefin
|
|
|
39
43
|
return ''
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
export function formatText (value: any, placeholder?: any) {
|
|
47
|
+
return '' + (isEmptyValue(value) ? (placeholder ? VxeUI.getConfig().emptyCell : '') : value)
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* 判断值为:'' | null | undefined 时都属于空值
|
|
44
52
|
*/
|