vxe-gantt 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/gantt/src/gantt-body.js +24 -2
- package/es/gantt/src/gantt-chart.js +36 -17
- package/es/gantt/src/gantt-header.js +11 -8
- package/es/gantt/src/gantt-view.js +5 -2
- package/es/gantt/src/gantt.js +155 -7
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +6 -0
- package/lib/gantt/src/gantt-body.js +6 -0
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +35 -16
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +9 -7
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +5 -2
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +151 -5
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +218 -33
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +4 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +8 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/package.json +2 -2
- package/packages/gantt/src/gantt-body.ts +24 -2
- package/packages/gantt/src/gantt-chart.ts +42 -17
- package/packages/gantt/src/gantt-header.ts +9 -7
- package/packages/gantt/src/gantt-view.ts +5 -2
- package/packages/gantt/src/gantt.ts +161 -7
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +8 -0
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.2";
|
|
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.2",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.2");
|
|
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.2"),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.2",
|
|
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.45",
|
|
68
68
|
"vxe-table": "^3.19.26"
|
|
69
69
|
},
|
|
70
70
|
"vetur": {
|
|
@@ -51,6 +51,7 @@ export default defineVxeComponent({
|
|
|
51
51
|
const { todayDateMaps } = internalData
|
|
52
52
|
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
53
53
|
const { showNowLine, viewStyle } = taskViewOpts
|
|
54
|
+
const scaleUnit = $xeGantt.computeScaleUnit
|
|
54
55
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {}
|
|
55
56
|
const { field, dateObj } = column
|
|
56
57
|
const { cellClassName, cellStyle } = viewStyle || {}
|
|
@@ -99,7 +100,18 @@ export default defineVxeComponent({
|
|
|
99
100
|
})
|
|
100
101
|
)
|
|
101
102
|
}
|
|
102
|
-
const ctParams = {
|
|
103
|
+
const ctParams = {
|
|
104
|
+
$gantt: $xeGantt,
|
|
105
|
+
source: sourceType,
|
|
106
|
+
type: viewType,
|
|
107
|
+
scaleType: scaleUnit,
|
|
108
|
+
dateObj,
|
|
109
|
+
row,
|
|
110
|
+
column,
|
|
111
|
+
$rowIndex,
|
|
112
|
+
rowIndex,
|
|
113
|
+
_rowIndex
|
|
114
|
+
}
|
|
103
115
|
return h('td', {
|
|
104
116
|
key: $columnIndex,
|
|
105
117
|
class: [
|
|
@@ -149,6 +161,7 @@ export default defineVxeComponent({
|
|
|
149
161
|
const { transform } = treeOpts
|
|
150
162
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
151
163
|
|
|
164
|
+
const scaleUnit = $xeGantt.computeScaleUnit
|
|
152
165
|
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
153
166
|
const { viewStyle } = taskViewOpts
|
|
154
167
|
const { rowClassName, rowStyle } = viewStyle || {}
|
|
@@ -186,7 +199,16 @@ export default defineVxeComponent({
|
|
|
186
199
|
trOns.dragend = $xeTable.handleRowDragDragendEvent
|
|
187
200
|
trOns.dragover = $xeTable.handleRowDragDragoverEvent
|
|
188
201
|
}
|
|
189
|
-
const rowParams = {
|
|
202
|
+
const rowParams = {
|
|
203
|
+
$gantt: $xeGantt,
|
|
204
|
+
source: sourceType,
|
|
205
|
+
type: viewType,
|
|
206
|
+
scaleType: scaleUnit,
|
|
207
|
+
row,
|
|
208
|
+
rowIndex,
|
|
209
|
+
$rowIndex,
|
|
210
|
+
_rowIndex
|
|
211
|
+
}
|
|
190
212
|
trVNs.push(
|
|
191
213
|
h('tr', {
|
|
192
214
|
key: treeConfig ? rowid : $rowIndex,
|
|
@@ -58,8 +58,9 @@ export default defineVxeComponent({
|
|
|
58
58
|
const titleField = $xeGantt.computeTitleField
|
|
59
59
|
const progressField = $xeGantt.computeProgressField
|
|
60
60
|
const taskBarOpts = $xeGantt.computeTaskBarOpts
|
|
61
|
-
const
|
|
62
|
-
const {
|
|
61
|
+
const scaleUnit = $xeGantt.computeScaleUnit
|
|
62
|
+
const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit }
|
|
63
|
+
const { showProgress, showContent, contentMethod, barStyle, drag, showTooltip } = taskBarOpts
|
|
63
64
|
const isBarRowStyle = XEUtils.isFunction(barStyle)
|
|
64
65
|
const barStyObj = (barStyle ? (isBarRowStyle ? barStyle(barParams) : barStyle) : {}) || {}
|
|
65
66
|
const { round } = barStyObj
|
|
@@ -87,10 +88,46 @@ export default defineVxeComponent({
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
if (contentMethod) {
|
|
90
|
-
title = getStringValue(contentMethod({ row, title }))
|
|
91
|
+
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }))
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
const ctParams = {
|
|
94
|
+
const ctParams = {
|
|
95
|
+
$gantt: $xeGantt,
|
|
96
|
+
source: sourceType,
|
|
97
|
+
type: viewType,
|
|
98
|
+
scaleType: scaleUnit,
|
|
99
|
+
row,
|
|
100
|
+
$rowIndex,
|
|
101
|
+
rowIndex,
|
|
102
|
+
_rowIndex
|
|
103
|
+
}
|
|
104
|
+
const ons: {
|
|
105
|
+
click: any
|
|
106
|
+
dblclick: any
|
|
107
|
+
mousedown: any
|
|
108
|
+
mouseover?: any
|
|
109
|
+
mouseleave?: any
|
|
110
|
+
} = {
|
|
111
|
+
click (evnt: MouseEvent) {
|
|
112
|
+
$xeGantt.handleTaskBarClickEvent(evnt, barParams)
|
|
113
|
+
},
|
|
114
|
+
dblclick (evnt: MouseEvent) {
|
|
115
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, barParams)
|
|
116
|
+
},
|
|
117
|
+
mousedown (evnt: MouseEvent) {
|
|
118
|
+
if ($xeGantt.handleTaskBarMousedownEvent) {
|
|
119
|
+
$xeGantt.handleTaskBarMousedownEvent(evnt, barParams)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (showTooltip) {
|
|
124
|
+
ons.mouseover = (evnt: MouseEvent) => {
|
|
125
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({ $event: evnt }, ctParams))
|
|
126
|
+
}
|
|
127
|
+
ons.mouseleave = (evnt: MouseEvent) => {
|
|
128
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({ $event: evnt }, ctParams))
|
|
129
|
+
}
|
|
130
|
+
}
|
|
94
131
|
return h('div', {
|
|
95
132
|
key: treeConfig ? rowid : $rowIndex,
|
|
96
133
|
attrs: {
|
|
@@ -116,19 +153,7 @@ export default defineVxeComponent({
|
|
|
116
153
|
attrs: {
|
|
117
154
|
rowid
|
|
118
155
|
},
|
|
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
|
-
}
|
|
156
|
+
on: ons
|
|
132
157
|
}, taskBarSlot
|
|
133
158
|
? $xeGantt.callSlot(taskBarSlot, barParams, h)
|
|
134
159
|
: [
|
|
@@ -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,75 @@ 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
|
+
const customContnet = contentMethod(params)
|
|
1905
|
+
if (!XEUtils.eqNull(customContnet)) {
|
|
1906
|
+
content = `${customContnet}`
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
$xeGantt.handleTargetEnterEvent(barTipStore.row !== row)
|
|
1910
|
+
const tipContent = formatText(content)
|
|
1911
|
+
Object.assign(barTipStore, {
|
|
1912
|
+
row,
|
|
1913
|
+
visible: true,
|
|
1914
|
+
content: tipContent,
|
|
1915
|
+
params
|
|
1916
|
+
})
|
|
1917
|
+
$xeGantt.$nextTick(() => {
|
|
1918
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1919
|
+
if ($tooltip) {
|
|
1920
|
+
if ($tooltip.openByEvent) {
|
|
1921
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent)
|
|
1922
|
+
} else if ($tooltip.open) {
|
|
1923
|
+
$tooltip.open(evnt.currentTarget, tipContent)
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
})
|
|
1927
|
+
},
|
|
1928
|
+
handleTargetEnterEvent (isClear: boolean) {
|
|
1929
|
+
const $xeGantt = this
|
|
1930
|
+
const internalData = $xeGantt.internalData
|
|
1931
|
+
|
|
1932
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1933
|
+
clearTimeout(internalData.barTipTimeout)
|
|
1934
|
+
if (isClear) {
|
|
1935
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1936
|
+
} else {
|
|
1937
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1938
|
+
$tooltip.setActived(true)
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
handleTaskBarTooltipLeaveEvent () {
|
|
1943
|
+
const $xeGantt = this
|
|
1944
|
+
const internalData = $xeGantt.internalData
|
|
1945
|
+
|
|
1946
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
1947
|
+
let $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1948
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1949
|
+
$tooltip.setActived(false)
|
|
1950
|
+
}
|
|
1951
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1952
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1953
|
+
$tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1954
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1955
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1956
|
+
}
|
|
1957
|
+
}, taskBarTooltipOpts.leaveDelay)
|
|
1958
|
+
} else {
|
|
1959
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1960
|
+
}
|
|
1961
|
+
},
|
|
1849
1962
|
handleTaskHeaderContextmenuEvent (evnt: Event, params: VxeGanttDefines.TaskHeaderContextmenuParams) {
|
|
1850
1963
|
const $xeGantt = this
|
|
1851
1964
|
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -2356,13 +2469,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2356
2469
|
return childVNs
|
|
2357
2470
|
},
|
|
2358
2471
|
renderLayout (h: CreateElement) {
|
|
2472
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
2473
|
+
|
|
2359
2474
|
const $xeGantt = this
|
|
2475
|
+
const reactData = $xeGantt.reactData
|
|
2360
2476
|
const slots = $xeGantt.$scopedSlots
|
|
2361
2477
|
|
|
2478
|
+
const { barTipStore } = reactData
|
|
2362
2479
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf
|
|
2363
2480
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
2481
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
2364
2482
|
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
2365
2483
|
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
2484
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip']
|
|
2366
2485
|
return [
|
|
2367
2486
|
h('div', {
|
|
2368
2487
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2389,7 +2508,42 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2389
2508
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2390
2509
|
h('div', {
|
|
2391
2510
|
ref: 'refPopupContainerElem'
|
|
2392
|
-
})
|
|
2511
|
+
}),
|
|
2512
|
+
h('div', {}, [
|
|
2513
|
+
/**
|
|
2514
|
+
* 任务条提示
|
|
2515
|
+
*/
|
|
2516
|
+
h(VxeUITooltipComponent, {
|
|
2517
|
+
key: 'gtp',
|
|
2518
|
+
ref: 'refTooltip',
|
|
2519
|
+
props: {
|
|
2520
|
+
theme: taskBarTooltipOpts.theme,
|
|
2521
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2522
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2523
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2524
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2525
|
+
width: taskBarTooltipOpts.width,
|
|
2526
|
+
height: taskBarTooltipOpts.height,
|
|
2527
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2528
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2529
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2530
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2531
|
+
isArrow: false
|
|
2532
|
+
},
|
|
2533
|
+
scopedSlots: taskBarTooltipSlot
|
|
2534
|
+
? {
|
|
2535
|
+
content: () => {
|
|
2536
|
+
const { row, content: tooltipContent } = barTipStore
|
|
2537
|
+
if (row) {
|
|
2538
|
+
return h('div', {
|
|
2539
|
+
}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)))
|
|
2540
|
+
}
|
|
2541
|
+
return renderEmptyElement($xeGantt)
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
: {}
|
|
2545
|
+
})
|
|
2546
|
+
])
|
|
2393
2547
|
]
|
|
2394
2548
|
},
|
|
2395
2549
|
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
|
*/
|