vxe-gantt 3.7.0 → 3.7.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 +16 -11
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +7 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt-chart.js +16 -11
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/index.umd.js +25 -14
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +7 -1
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/gantt/src/gantt-chart.ts +17 -11
- package/packages/ui/src/dom.ts +7 -1
|
@@ -74,16 +74,19 @@ export default defineVxeComponent({
|
|
|
74
74
|
let title = getStringValue(XEUtils.get(row, titleField));
|
|
75
75
|
const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0;
|
|
76
76
|
const renderTaskType = getTaskType(XEUtils.get(row, typeField));
|
|
77
|
+
const isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType));
|
|
77
78
|
const ctParams = Object.assign({}, barParams);
|
|
78
79
|
const vbStyle = {};
|
|
79
80
|
const vpStyle = {
|
|
80
81
|
width: `${progressValue || 0}%`
|
|
81
82
|
};
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
if (!isMilestone) {
|
|
84
|
+
if (barBgColor) {
|
|
85
|
+
vbStyle.backgroundColor = barBgColor;
|
|
86
|
+
}
|
|
87
|
+
if (barCompletedBgColor) {
|
|
88
|
+
vpStyle.backgroundColor = barCompletedBgColor;
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
91
|
if (barHtmlStyle) {
|
|
89
92
|
XEUtils.assign(vbStyle, barHtmlStyle);
|
|
@@ -97,7 +100,6 @@ export default defineVxeComponent({
|
|
|
97
100
|
});
|
|
98
101
|
}
|
|
99
102
|
else {
|
|
100
|
-
const isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType));
|
|
101
103
|
const isSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(renderTaskType));
|
|
102
104
|
if (contentMethod) {
|
|
103
105
|
title = getStringValue(contentMethod({ row, title, scaleType: scaleUnit }));
|
|
@@ -186,6 +188,7 @@ export default defineVxeComponent({
|
|
|
186
188
|
let childTitle = getStringValue(XEUtils.get(childRow, titleField));
|
|
187
189
|
const childProgressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(childRow, progressField)))) : 0;
|
|
188
190
|
const childRenderTaskType = getTaskType(XEUtils.get(childRow, typeField));
|
|
191
|
+
const isChildMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(childRenderTaskType));
|
|
189
192
|
const isChildSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(childRenderTaskType));
|
|
190
193
|
if (isChildSubview) {
|
|
191
194
|
return;
|
|
@@ -194,11 +197,13 @@ export default defineVxeComponent({
|
|
|
194
197
|
const childVpStyle = {
|
|
195
198
|
width: `${childProgressValue || 0}%`
|
|
196
199
|
};
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
if (!isChildMilestone) {
|
|
201
|
+
if (childBgColor) {
|
|
202
|
+
childVbStyle.backgroundColor = childBgColor;
|
|
203
|
+
}
|
|
204
|
+
if (childCompletedBgColor) {
|
|
205
|
+
childVpStyle.backgroundColor = childCompletedBgColor;
|
|
206
|
+
}
|
|
202
207
|
}
|
|
203
208
|
// 已废弃
|
|
204
209
|
if (childBarStyObj.top) {
|
package/es/ui/index.js
CHANGED
package/es/ui/src/dom.js
CHANGED
|
@@ -45,7 +45,13 @@ export function isScale(val) {
|
|
|
45
45
|
return val && /^\d+(\.\d+)?%$/.test(val);
|
|
46
46
|
}
|
|
47
47
|
export function hasClass(elem, cls) {
|
|
48
|
-
|
|
48
|
+
if (elem) {
|
|
49
|
+
if (elem.classList) {
|
|
50
|
+
return elem.classList.contains(cls);
|
|
51
|
+
}
|
|
52
|
+
return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
49
55
|
}
|
|
50
56
|
export function removeClass(elem, cls) {
|
|
51
57
|
if (elem && hasClass(elem, cls)) {
|
package/es/ui/src/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
const { log } = VxeUI;
|
|
3
|
-
const ganttVersion = `gantt v${"3.7.
|
|
3
|
+
const ganttVersion = `gantt v${"3.7.1"}`;
|
|
4
4
|
export function createComponentLog(name) {
|
|
5
5
|
const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
|
|
6
6
|
const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
|
|
@@ -99,16 +99,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
99
99
|
var title = (0, _utils.getStringValue)(_xeUtils.default.get(row, titleField));
|
|
100
100
|
var progressValue = showProgress ? Math.min(100, Math.max(0, _xeUtils.default.toNumber(_xeUtils.default.get(row, progressField)))) : 0;
|
|
101
101
|
var renderTaskType = (0, _util.getTaskType)(_xeUtils.default.get(row, typeField));
|
|
102
|
+
var isMilestone = !!((0, _utils.hasEnableConf)(taskBarMilestoneConfig, taskBarMilestoneOpts) && (0, _util.hasMilestoneTask)(renderTaskType));
|
|
102
103
|
var ctParams = Object.assign({}, barParams);
|
|
103
104
|
var vbStyle = {};
|
|
104
105
|
var vpStyle = {
|
|
105
106
|
width: "".concat(progressValue || 0, "%")
|
|
106
107
|
};
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
if (!isMilestone) {
|
|
109
|
+
if (barBgColor) {
|
|
110
|
+
vbStyle.backgroundColor = barBgColor;
|
|
111
|
+
}
|
|
112
|
+
if (barCompletedBgColor) {
|
|
113
|
+
vpStyle.backgroundColor = barCompletedBgColor;
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
if (barHtmlStyle) {
|
|
114
117
|
_xeUtils.default.assign(vbStyle, barHtmlStyle);
|
|
@@ -121,7 +124,6 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
121
124
|
rowid: rowid
|
|
122
125
|
});
|
|
123
126
|
} else {
|
|
124
|
-
var isMilestone = !!((0, _utils.hasEnableConf)(taskBarMilestoneConfig, taskBarMilestoneOpts) && (0, _util.hasMilestoneTask)(renderTaskType));
|
|
125
127
|
var isSubview = !!((0, _utils.hasEnableConf)(taskBarSubviewConfig, taskBarSubviewOpts) && (0, _util.hasSubviewTask)(renderTaskType));
|
|
126
128
|
if (contentMethod) {
|
|
127
129
|
title = (0, _utils.getStringValue)(contentMethod({
|
|
@@ -205,6 +207,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
205
207
|
var childTitle = (0, _utils.getStringValue)(_xeUtils.default.get(childRow, titleField));
|
|
206
208
|
var childProgressValue = showProgress ? Math.min(100, Math.max(0, _xeUtils.default.toNumber(_xeUtils.default.get(childRow, progressField)))) : 0;
|
|
207
209
|
var childRenderTaskType = (0, _util.getTaskType)(_xeUtils.default.get(childRow, typeField));
|
|
210
|
+
var isChildMilestone = !!((0, _utils.hasEnableConf)(taskBarMilestoneConfig, taskBarMilestoneOpts) && (0, _util.hasMilestoneTask)(childRenderTaskType));
|
|
208
211
|
var isChildSubview = !!((0, _utils.hasEnableConf)(taskBarSubviewConfig, taskBarSubviewOpts) && (0, _util.hasSubviewTask)(childRenderTaskType));
|
|
209
212
|
if (isChildSubview) {
|
|
210
213
|
return;
|
|
@@ -213,11 +216,13 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
213
216
|
var childVpStyle = {
|
|
214
217
|
width: "".concat(childProgressValue || 0, "%")
|
|
215
218
|
};
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
if (!isChildMilestone) {
|
|
220
|
+
if (childBgColor) {
|
|
221
|
+
childVbStyle.backgroundColor = childBgColor;
|
|
222
|
+
}
|
|
223
|
+
if (childCompletedBgColor) {
|
|
224
|
+
childVpStyle.backgroundColor = childCompletedBgColor;
|
|
225
|
+
}
|
|
221
226
|
}
|
|
222
227
|
// 已废弃
|
|
223
228
|
if (childBarStyObj.top) {
|
|
@@ -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 a;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(a="Object"===(a={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_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 a=0,r=Array(t);a<t;a++)r[a]=e[a];return r}var getIcon=_core.VxeUI.getIcon,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(v,w,e,t,a,r,n,o,M){var g,f,h=this.$xeGantt,V=w.resizeHeightFlag,G=w.pendingRowFlag,i=w.fullAllDataRowIdData,F=w.pendingRowMaps,s=w.computeCellOpts,l=w.computeRowOpts,c=w.computeDefaultRowHeight,u=w.computeTreeOpts,u=u.children||u.childrenField,d=h.reactData,p=h.internalData,m=h.$scopedSlots,b=m.taskBar||m["task-bar"],m=m.taskBarOverview||m["task-bar-overview"],x=h.treeConfig,k=h.taskBarMilestoneConfig,L=h.taskBarSubviewConfig,y=d.activeLink,d=d.activeBarRowid,j=h.computeTitleField,N=h.computeProgressField,W=h.computeTypeField,T=h.computeTaskBarOpts,_=h.computeTaskBarMilestoneOpts,E=h.computeTaskBarSubviewOpts,q=E.showOverview,C=E.barStyle,B=h.computeScaleUnit,S={$gantt:h,source:sourceType,type:viewType,scaleType:B,row:e,$rowIndex:r,rowIndex:a,_rowIndex:n},A=T.showProgress,I=T.showContent,$=T.contentMethod,U=T.barStyle,R=T.moveable,r=T.showTooltip,a=(U?_xeUtils.default.isFunction(U)?U(S):U:{})||{},n=a.round,T=a.bgColor,D=a.completedBgColor,a=a.style,i=i[t]||{},V=V?(0,_util.getCellRestHeight)(i,s,l,c):0,i=(0,_utils.getStringValue)(_xeUtils.default.get(e,j)),s=A?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(e,N)))):0,l=(0,_util.getTaskType)(_xeUtils.default.get(e,W)),O=Object.assign({},S),c={},s={width:"".concat(s||0,"%")},T=(T&&(c.backgroundColor=T),D&&(s.backgroundColor=D),a&&_xeUtils.default.assign(c,a),[]);return h.renderGanttTaskBarContent?T=h.renderGanttTaskBarContent(v,O,{$gantt:h,$table:w,rowid:t}):(D=!(!(0,_utils.hasEnableConf)(k,_)||!(0,_util.hasMilestoneTask)(l)),a=!(!(0,_utils.hasEnableConf)(L,E)||!(0,_util.hasSubviewTask)(l)),$&&(i=(0,_utils.getStringValue)($({row:e,title:i,scaleType:B}))),g={},r&&(g.mouseover=function(e){var t=p.dragBarRow,a=Object.assign({$event:e},O);t||h.triggerTaskBarTooltipEvent(e,a),h.dispatchEvent("task-bar-mouseenter",a,e)},g.mouseleave=function(e){var t=p.dragBarRow,a=Object.assign({$event:e},O);t||h.handleTaskBarTooltipLeaveEvent(e,a),h.dispatchEvent("task-bar-mouseleave",a,e)}),a&&x&&o&&o.length?M?q&&T.push(v("div",{key:"vcso",class:"vxe-gantt-view--chart-subview-wrapper is--overview"},[v("div",{key:t,attrs:{rowid:t},class:["vxe-gantt-view--chart-subview-row",{"is--progress":A,"is--round":n,"is--move":R}]},[v("div",{attrs:{rowid:t},class:[m?"vxe-gantt-view--chart-subview-custom-bar":"vxe-gantt-view--chart-subview-bar","is--".concat(l)]},[m?v("div",{key:"cbc",class:"vxe-gantt-view--chart-subview-custom-bar-content-wrapper"},h.callSlot(m,S,v)):v("div",{class:"vxe-gantt-view--chart-subview-bar-content-wrapper"},[I?v("div",{class:"vxe-gantt-view--chart-content"},i):renderEmptyElement(h)])])])])):(f=[],_xeUtils.default.eachTree(o,function(e){var t,a,r={$gantt:h,source:sourceType,type:viewType,scaleType:B,row:e,$rowIndex:w.getRowIndex(e),rowIndex:w.getVMRowIndex(e),_rowIndex:w.getVTRowIndex(e)},n=_xeUtils.default.assign({},(U?_xeUtils.default.isFunction(U)?U(r):U:{})||{},(C?_xeUtils.default.isFunction(C)?C(r):C:{})||{}),o=n.round,i=n.bgColor,s=n.completedBgColor,l=n.style,c=w.getRowid(e),u=(0,_utils.getStringValue)(_xeUtils.default.get(e,j)),d=A?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(e,N)))):0,p=(0,_util.getTaskType)(_xeUtils.default.get(e,W));(!(0,_utils.hasEnableConf)(L,E)||!(0,_util.hasSubviewTask)(p))&&(t={},d={width:"".concat(d||0,"%")},i&&(t.backgroundColor=i),s&&(d.backgroundColor=s),n.top&&(t.top=n.top),l&&_xeUtils.default.assign(t,l),a=Object.assign({},r),$&&(u=(0,_utils.getStringValue)($({row:e,title:u,scaleType:B}))),f.push(v("div",{key:c,attrs:{rowid:c},class:["vxe-gantt-view--chart-subview-row","is--".concat(p),{"is--progress":A,"is--round":o,"is--move":R,"row--pending":!!G&&!!F[c]}]},[v("div",{attrs:{rowid:c},class:[b?"vxe-gantt-view--chart-subview-custom-bar":"vxe-gantt-view--chart-subview-bar","is--".concat(p)],style:t,on:{click:function(e){e.stopPropagation(),h.handleTaskBarClickEvent(e,a)},dblclick:function(e){e.stopPropagation(),h.handleTaskBarDblclickEvent(e,a)},mousedown:function(e){e.stopPropagation(),h.handleTaskBarMousedownEvent&&h.handleTaskBarMousedownEvent(e,a)}}},[b?v("div",{key:"cbc",class:"vxe-gantt-view--chart-subview-custom-bar-content-wrapper",on:g},h.callSlot(b,a,v)):v("div",{class:"vxe-gantt-view--chart-subview-bar-content-wrapper",on:g},[A?v("div",{class:"vxe-gantt-view--chart-progress",style:d}):renderEmptyElement(h),I?v("div",{class:"vxe-gantt-view--chart-content"},u):renderEmptyElement(h)])])])))},{children:u}),T.push(v("div",{key:"vcsc",class:"vxe-gantt-view--chart-subview-wrapper is--inline"},f))):b?T.push(v("div",{key:"cbc",class:"vxe-gantt-view--chart-custom-bar-content-wrapper",on:g},h.callSlot(b,S,v))):D?(k=_.icon,r=_.iconStatus,a=_.iconStyle,x={$gantt:h,row:e},T.push(v("div",{key:"vcm",class:"vxe-gantt-view--chart-milestone-wrapper",on:g},[v("div",{class:["vxe-gantt-view--chart-milestone-icon",r?"theme--".concat(_xeUtils.default.isFunction(r)?r(x):r):""],style:a?Object.assign({},_xeUtils.default.isFunction(a)?a(x):a):void 0},[v("i",{class:(k?_xeUtils.default.isFunction(k)?k(x):k:"")||getIcon().GANTT_VIEW_TASK_MILESTONE})]),I?v("div",{class:"vxe-gantt-view--chart-milestone-content"},i):renderEmptyElement(h)]))):T.push(v("div",{key:"vbc",class:"vxe-gantt-view--chart-bar-content-wrapper",on:g},[A?v("div",{class:"vxe-gantt-view--chart-progress",style:s}):renderEmptyElement(h),I?v("div",{class:"vxe-gantt-view--chart-content"},i):renderEmptyElement(h)]))),v("div",{key:t,attrs:{rowid:t},class:["vxe-gantt-view--chart-row","is--".concat(l),{"is--progress":A,"row--pending":!!G&&!!F[t],"is--round":n,"is--move":R}],style:{height:"".concat(V,"px")},on:{onDragstart:function(e){p.dragBarRow&&e.preventDefault()},contextmenu:function(e){h.handleTaskBarContextmenuEvent(e,O)}}},[v("div",{class:[b?"vxe-gantt-view--chart-custom-bar":"vxe-gantt-view--chart-bar","is--".concat(l),{"is--active":d===t,"active--link":y&&(t==="".concat(y.from)||t==="".concat(y.to))}],style:c,attrs:{rowid:t},on:{click:function(e){h.handleTaskBarClickEvent(e,S)},dblclick:function(e){h.handleTaskBarDblclickEvent(e,S)},mousedown:function(e){h.handleTaskBarMousedownEvent&&h.handleTaskBarMousedownEvent(e,S)}}},T)])},renderTaskRows:function(s,l,e){var c=this,t=c.$xeGanttView.reactData,u=l.treeConfig,d=l.treeExpandedFlag,p=l.fullAllDataRowIdData,v=l.treeExpandedMaps,a=l.computeTreeOpts,w=a.transform,g=a.children||a.childrenField,f=t.scrollYLoad,h=[];return e.forEach(function(e,t){var a=l.getRowid(e),r=p[a]||{},n=t,o=-1,r=(r&&(n=r.index,o=r._index),!1),i=[];u&&(i=e[g],r=!!d&&i&&0<i.length&&!!v[a]),h.push(c.renderTaskBar(s,l,e,a,n,t,o,i,r)),u&&r&&!f&&!w&&h.push.apply(h,_toConsumableArray(c.renderTaskRows(s,l,i)))}),h},renderVN:function(e){var t=this.$xeGantt,a=this.$xeGanttView,r=t.reactData,n=a.internalData.xeTable,o=t.$scopedSlots,r=r.dragLinkFromStore,i=a.reactData.tableData,s=t.computeTaskLinkOpts,a=a.computeNowLineLeft,l=s.isCurrent,c=s.isHover,u=t.computeTaskBarOpts.linkCreatable,o=o.taskNowLine||o["task-now-line"];return e("div",{ref:"refElem",class:["vxe-gantt-view--chart-wrapper",{"is--cl-drag":r.rowid}]},[0<a?e("div",{ref:"refNowLineElem",class:"vxe-gantt-view--chart-now-line",style:{left:a+"px"}},o?o({}):[]):renderEmptyElement(t),t.renderGanttTaskChartBefores?e("div",{ref:"refChartBeforeWrapperElem",class:["vxe-gantt-view--chart-before-wrapper",{"link--current":l,"link--hover":c}]},n&&(0,_utils.isEnableConf)(s)?t.renderGanttTaskChartBefores(e):[]):renderEmptyElement(t),e("div",{ref:"refTaskWrapperElem",class:["vxe-gantt-view--chart-task-wrapper",{"link--current":l,"link--create":u}]},n?this.renderTaskRows(e,n,i):[]),t.renderGanttTaskChartAfters?e("div",{ref:"refChartAfterWrapperElem",class:"vxe-gantt-view--chart-after-wrapper"},n&&(0,_utils.isEnableConf)(s)?t.renderGanttTaskChartAfters(e):[]):renderEmptyElement(t)])}},mounted:function(){var e=this,t=e.$xeGanttView.internalData.elemStore,a="main-chart-";t["".concat(a,"now-line")]=e.$refs.refNowLineElem,t["".concat(a,"task-wrapper")]=e.$refs.refTaskWrapperElem,t["".concat(a,"before-wrapper")]=e.$refs.refChartBeforeWrapperElem,t["".concat(a,"after-wrapper")]=e.$refs.refChartAfterWrapperElem},destroyed:function(){var e=this.$xeGanttView.internalData.elemStore,t="main-chart-";e["".concat(t,"now-line")]=null,e["".concat(t,"task-wrapper")]=null,e["".concat(t,"before-wrapper")]=null,e["".concat(t,"after-wrapper")]=null},render:function(e){return this.renderVN(e)}});
|
|
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 a;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(a="Object"===(a={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_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 a=0,r=Array(t);a<t;a++)r[a]=e[a];return r}var getIcon=_core.VxeUI.getIcon,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(w,g,e,t,a,r,n,o,O){var f,h,m=this.$xeGantt,V=g.resizeHeightFlag,G=g.pendingRowFlag,i=g.fullAllDataRowIdData,F=g.pendingRowMaps,s=g.computeCellOpts,l=g.computeRowOpts,c=g.computeDefaultRowHeight,u=g.computeTreeOpts,u=u.children||u.childrenField,d=m.reactData,p=m.internalData,v=m.$scopedSlots,b=v.taskBar||v["task-bar"],v=v.taskBarOverview||v["task-bar-overview"],x=m.treeConfig,L=m.taskBarMilestoneConfig,j=m.taskBarSubviewConfig,k=d.activeLink,d=d.activeBarRowid,N=m.computeTitleField,W=m.computeProgressField,q=m.computeTypeField,y=m.computeTaskBarOpts,T=m.computeTaskBarMilestoneOpts,_=m.computeTaskBarSubviewOpts,H=_.showOverview,E=_.barStyle,C=m.computeScaleUnit,B={$gantt:m,source:sourceType,type:viewType,scaleType:C,row:e,$rowIndex:r,rowIndex:a,_rowIndex:n},S=y.showProgress,A=y.showContent,I=y.contentMethod,$=y.barStyle,U=y.moveable,r=y.showTooltip,a=($?_xeUtils.default.isFunction($)?$(B):$:{})||{},n=a.round,y=a.bgColor,R=a.completedBgColor,a=a.style,i=i[t]||{},V=V?(0,_util.getCellRestHeight)(i,s,l,c):0,i=(0,_utils.getStringValue)(_xeUtils.default.get(e,N)),s=S?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(e,W)))):0,l=(0,_util.getTaskType)(_xeUtils.default.get(e,q)),c=!(!(0,_utils.hasEnableConf)(L,T)||!(0,_util.hasMilestoneTask)(l)),D=Object.assign({},B),M={},s={width:"".concat(s||0,"%")},y=(c||(y&&(M.backgroundColor=y),R&&(s.backgroundColor=R)),a&&_xeUtils.default.assign(M,a),[]);return m.renderGanttTaskBarContent?y=m.renderGanttTaskBarContent(w,D,{$gantt:m,$table:g,rowid:t}):(R=!(!(0,_utils.hasEnableConf)(j,_)||!(0,_util.hasSubviewTask)(l)),I&&(i=(0,_utils.getStringValue)(I({row:e,title:i,scaleType:C}))),f={},r&&(f.mouseover=function(e){var t=p.dragBarRow,a=Object.assign({$event:e},D);t||m.triggerTaskBarTooltipEvent(e,a),m.dispatchEvent("task-bar-mouseenter",a,e)},f.mouseleave=function(e){var t=p.dragBarRow,a=Object.assign({$event:e},D);t||m.handleTaskBarTooltipLeaveEvent(e,a),m.dispatchEvent("task-bar-mouseleave",a,e)}),R&&x&&o&&o.length?O?H&&y.push(w("div",{key:"vcso",class:"vxe-gantt-view--chart-subview-wrapper is--overview"},[w("div",{key:t,attrs:{rowid:t},class:["vxe-gantt-view--chart-subview-row",{"is--progress":S,"is--round":n,"is--move":U}]},[w("div",{attrs:{rowid:t},class:[v?"vxe-gantt-view--chart-subview-custom-bar":"vxe-gantt-view--chart-subview-bar","is--".concat(l)]},[v?w("div",{key:"cbc",class:"vxe-gantt-view--chart-subview-custom-bar-content-wrapper"},m.callSlot(v,B,w)):w("div",{class:"vxe-gantt-view--chart-subview-bar-content-wrapper"},[A?w("div",{class:"vxe-gantt-view--chart-content"},i):renderEmptyElement(m)])])])])):(h=[],_xeUtils.default.eachTree(o,function(e){var t,a,r={$gantt:m,source:sourceType,type:viewType,scaleType:C,row:e,$rowIndex:g.getRowIndex(e),rowIndex:g.getVMRowIndex(e),_rowIndex:g.getVTRowIndex(e)},n=_xeUtils.default.assign({},($?_xeUtils.default.isFunction($)?$(r):$:{})||{},(E?_xeUtils.default.isFunction(E)?E(r):E:{})||{}),o=n.round,i=n.bgColor,s=n.completedBgColor,l=n.style,c=g.getRowid(e),u=(0,_utils.getStringValue)(_xeUtils.default.get(e,N)),d=S?Math.min(100,Math.max(0,_xeUtils.default.toNumber(_xeUtils.default.get(e,W)))):0,p=(0,_util.getTaskType)(_xeUtils.default.get(e,q)),v=!(!(0,_utils.hasEnableConf)(L,T)||!(0,_util.hasMilestoneTask)(p));(!(0,_utils.hasEnableConf)(j,_)||!(0,_util.hasSubviewTask)(p))&&(t={},d={width:"".concat(d||0,"%")},v||(i&&(t.backgroundColor=i),s&&(d.backgroundColor=s)),n.top&&(t.top=n.top),l&&_xeUtils.default.assign(t,l),a=Object.assign({},r),I&&(u=(0,_utils.getStringValue)(I({row:e,title:u,scaleType:C}))),h.push(w("div",{key:c,attrs:{rowid:c},class:["vxe-gantt-view--chart-subview-row","is--".concat(p),{"is--progress":S,"is--round":o,"is--move":U,"row--pending":!!G&&!!F[c]}]},[w("div",{attrs:{rowid:c},class:[b?"vxe-gantt-view--chart-subview-custom-bar":"vxe-gantt-view--chart-subview-bar","is--".concat(p)],style:t,on:{click:function(e){e.stopPropagation(),m.handleTaskBarClickEvent(e,a)},dblclick:function(e){e.stopPropagation(),m.handleTaskBarDblclickEvent(e,a)},mousedown:function(e){e.stopPropagation(),m.handleTaskBarMousedownEvent&&m.handleTaskBarMousedownEvent(e,a)}}},[b?w("div",{key:"cbc",class:"vxe-gantt-view--chart-subview-custom-bar-content-wrapper",on:f},m.callSlot(b,a,w)):w("div",{class:"vxe-gantt-view--chart-subview-bar-content-wrapper",on:f},[S?w("div",{class:"vxe-gantt-view--chart-progress",style:d}):renderEmptyElement(m),A?w("div",{class:"vxe-gantt-view--chart-content"},u):renderEmptyElement(m)])])])))},{children:u}),y.push(w("div",{key:"vcsc",class:"vxe-gantt-view--chart-subview-wrapper is--inline"},h))):b?y.push(w("div",{key:"cbc",class:"vxe-gantt-view--chart-custom-bar-content-wrapper",on:f},m.callSlot(b,B,w))):c?(a=T.icon,r=T.iconStatus,R=T.iconStyle,x={$gantt:m,row:e},y.push(w("div",{key:"vcm",class:"vxe-gantt-view--chart-milestone-wrapper",on:f},[w("div",{class:["vxe-gantt-view--chart-milestone-icon",r?"theme--".concat(_xeUtils.default.isFunction(r)?r(x):r):""],style:R?Object.assign({},_xeUtils.default.isFunction(R)?R(x):R):void 0},[w("i",{class:(a?_xeUtils.default.isFunction(a)?a(x):a:"")||getIcon().GANTT_VIEW_TASK_MILESTONE})]),A?w("div",{class:"vxe-gantt-view--chart-milestone-content"},i):renderEmptyElement(m)]))):y.push(w("div",{key:"vbc",class:"vxe-gantt-view--chart-bar-content-wrapper",on:f},[S?w("div",{class:"vxe-gantt-view--chart-progress",style:s}):renderEmptyElement(m),A?w("div",{class:"vxe-gantt-view--chart-content"},i):renderEmptyElement(m)]))),w("div",{key:t,attrs:{rowid:t},class:["vxe-gantt-view--chart-row","is--".concat(l),{"is--progress":S,"row--pending":!!G&&!!F[t],"is--round":n,"is--move":U}],style:{height:"".concat(V,"px")},on:{onDragstart:function(e){p.dragBarRow&&e.preventDefault()},contextmenu:function(e){m.handleTaskBarContextmenuEvent(e,D)}}},[w("div",{class:[b?"vxe-gantt-view--chart-custom-bar":"vxe-gantt-view--chart-bar","is--".concat(l),{"is--active":d===t,"active--link":k&&(t==="".concat(k.from)||t==="".concat(k.to))}],style:M,attrs:{rowid:t},on:{click:function(e){m.handleTaskBarClickEvent(e,B)},dblclick:function(e){m.handleTaskBarDblclickEvent(e,B)},mousedown:function(e){m.handleTaskBarMousedownEvent&&m.handleTaskBarMousedownEvent(e,B)}}},y)])},renderTaskRows:function(s,l,e){var c=this,t=c.$xeGanttView.reactData,u=l.treeConfig,d=l.treeExpandedFlag,p=l.fullAllDataRowIdData,v=l.treeExpandedMaps,a=l.computeTreeOpts,w=a.transform,g=a.children||a.childrenField,f=t.scrollYLoad,h=[];return e.forEach(function(e,t){var a=l.getRowid(e),r=p[a]||{},n=t,o=-1,r=(r&&(n=r.index,o=r._index),!1),i=[];u&&(i=e[g],r=!!d&&i&&0<i.length&&!!v[a]),h.push(c.renderTaskBar(s,l,e,a,n,t,o,i,r)),u&&r&&!f&&!w&&h.push.apply(h,_toConsumableArray(c.renderTaskRows(s,l,i)))}),h},renderVN:function(e){var t=this.$xeGantt,a=this.$xeGanttView,r=t.reactData,n=a.internalData.xeTable,o=t.$scopedSlots,r=r.dragLinkFromStore,i=a.reactData.tableData,s=t.computeTaskLinkOpts,a=a.computeNowLineLeft,l=s.isCurrent,c=s.isHover,u=t.computeTaskBarOpts.linkCreatable,o=o.taskNowLine||o["task-now-line"];return e("div",{ref:"refElem",class:["vxe-gantt-view--chart-wrapper",{"is--cl-drag":r.rowid}]},[0<a?e("div",{ref:"refNowLineElem",class:"vxe-gantt-view--chart-now-line",style:{left:a+"px"}},o?o({}):[]):renderEmptyElement(t),t.renderGanttTaskChartBefores?e("div",{ref:"refChartBeforeWrapperElem",class:["vxe-gantt-view--chart-before-wrapper",{"link--current":l,"link--hover":c}]},n&&(0,_utils.isEnableConf)(s)?t.renderGanttTaskChartBefores(e):[]):renderEmptyElement(t),e("div",{ref:"refTaskWrapperElem",class:["vxe-gantt-view--chart-task-wrapper",{"link--current":l,"link--create":u}]},n?this.renderTaskRows(e,n,i):[]),t.renderGanttTaskChartAfters?e("div",{ref:"refChartAfterWrapperElem",class:"vxe-gantt-view--chart-after-wrapper"},n&&(0,_utils.isEnableConf)(s)?t.renderGanttTaskChartAfters(e):[]):renderEmptyElement(t)])}},mounted:function(){var e=this,t=e.$xeGanttView.internalData.elemStore,a="main-chart-";t["".concat(a,"now-line")]=e.$refs.refNowLineElem,t["".concat(a,"task-wrapper")]=e.$refs.refTaskWrapperElem,t["".concat(a,"before-wrapper")]=e.$refs.refChartBeforeWrapperElem,t["".concat(a,"after-wrapper")]=e.$refs.refChartAfterWrapperElem},destroyed:function(){var e=this.$xeGanttView.internalData.elemStore,t="main-chart-";e["".concat(t,"now-line")]=null,e["".concat(t,"task-wrapper")]=null,e["".concat(t,"before-wrapper")]=null,e["".concat(t,"after-wrapper")]=null},render:function(e){return this.renderVN(e)}});
|
package/lib/index.umd.js
CHANGED
|
@@ -8468,7 +8468,7 @@ var core_ = __webpack_require__(4345);
|
|
|
8468
8468
|
|
|
8469
8469
|
var setConfig = core_.VxeUI.setConfig,
|
|
8470
8470
|
setIcon = core_.VxeUI.setIcon;
|
|
8471
|
-
core_.VxeUI.ganttVersion = "3.7.
|
|
8471
|
+
core_.VxeUI.ganttVersion = "3.7.1";
|
|
8472
8472
|
var ymdFormat = 'yyyy-MM-dd';
|
|
8473
8473
|
var ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
|
|
8474
8474
|
setConfig({
|
|
@@ -8593,7 +8593,7 @@ var es_array_join = __webpack_require__(8598);
|
|
|
8593
8593
|
|
|
8594
8594
|
|
|
8595
8595
|
var log = core_.VxeUI.log;
|
|
8596
|
-
var ganttVersion = "gantt v".concat("3.7.
|
|
8596
|
+
var ganttVersion = "gantt v".concat("3.7.1");
|
|
8597
8597
|
function createComponentLog(name) {
|
|
8598
8598
|
var uiVersion = core_.VxeUI.uiVersion ? "ui v".concat(core_.VxeUI.uiVersion) : '';
|
|
8599
8599
|
var tableVersion = core_.VxeUI.tableVersion ? "table v".concat(core_.VxeUI.tableVersion) : '';
|
|
@@ -9145,7 +9145,13 @@ function isScale(val) {
|
|
|
9145
9145
|
return val && /^\d+(\.\d+)?%$/.test(val);
|
|
9146
9146
|
}
|
|
9147
9147
|
function hasClass(elem, cls) {
|
|
9148
|
-
|
|
9148
|
+
if (elem) {
|
|
9149
|
+
if (elem.classList) {
|
|
9150
|
+
return elem.classList.contains(cls);
|
|
9151
|
+
}
|
|
9152
|
+
return !!(elem.className && elem.className.match && elem.className.match(getClsRE(cls)));
|
|
9153
|
+
}
|
|
9154
|
+
return false;
|
|
9149
9155
|
}
|
|
9150
9156
|
function removeClass(elem, cls) {
|
|
9151
9157
|
if (elem && hasClass(elem, cls)) {
|
|
@@ -9641,16 +9647,19 @@ var gantt_chart_viewType = 'chart';
|
|
|
9641
9647
|
var title = getStringValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, titleField));
|
|
9642
9648
|
var progressValue = showProgress ? Math.min(100, Math.max(0, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, progressField)))) : 0;
|
|
9643
9649
|
var renderTaskType = getTaskType(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, typeField));
|
|
9650
|
+
var isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType));
|
|
9644
9651
|
var ctParams = _objectSpread2({}, barParams);
|
|
9645
9652
|
var vbStyle = {};
|
|
9646
9653
|
var vpStyle = {
|
|
9647
9654
|
width: "".concat(progressValue || 0, "%")
|
|
9648
9655
|
};
|
|
9649
|
-
if (
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9656
|
+
if (!isMilestone) {
|
|
9657
|
+
if (barBgColor) {
|
|
9658
|
+
vbStyle.backgroundColor = barBgColor;
|
|
9659
|
+
}
|
|
9660
|
+
if (barCompletedBgColor) {
|
|
9661
|
+
vpStyle.backgroundColor = barCompletedBgColor;
|
|
9662
|
+
}
|
|
9654
9663
|
}
|
|
9655
9664
|
if (barHtmlStyle) {
|
|
9656
9665
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(vbStyle, barHtmlStyle);
|
|
@@ -9663,7 +9672,6 @@ var gantt_chart_viewType = 'chart';
|
|
|
9663
9672
|
rowid: rowid
|
|
9664
9673
|
});
|
|
9665
9674
|
} else {
|
|
9666
|
-
var isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType));
|
|
9667
9675
|
var isSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(renderTaskType));
|
|
9668
9676
|
if (contentMethod) {
|
|
9669
9677
|
title = getStringValue(contentMethod({
|
|
@@ -9747,6 +9755,7 @@ var gantt_chart_viewType = 'chart';
|
|
|
9747
9755
|
var childTitle = getStringValue(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(childRow, titleField));
|
|
9748
9756
|
var childProgressValue = showProgress ? Math.min(100, Math.max(0, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(childRow, progressField)))) : 0;
|
|
9749
9757
|
var childRenderTaskType = getTaskType(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(childRow, typeField));
|
|
9758
|
+
var isChildMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(childRenderTaskType));
|
|
9750
9759
|
var isChildSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(childRenderTaskType));
|
|
9751
9760
|
if (isChildSubview) {
|
|
9752
9761
|
return;
|
|
@@ -9755,11 +9764,13 @@ var gantt_chart_viewType = 'chart';
|
|
|
9755
9764
|
var childVpStyle = {
|
|
9756
9765
|
width: "".concat(childProgressValue || 0, "%")
|
|
9757
9766
|
};
|
|
9758
|
-
if (
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9767
|
+
if (!isChildMilestone) {
|
|
9768
|
+
if (childBgColor) {
|
|
9769
|
+
childVbStyle.backgroundColor = childBgColor;
|
|
9770
|
+
}
|
|
9771
|
+
if (childCompletedBgColor) {
|
|
9772
|
+
childVpStyle.backgroundColor = childCompletedBgColor;
|
|
9773
|
+
}
|
|
9763
9774
|
}
|
|
9764
9775
|
// 已废弃
|
|
9765
9776
|
if (childBarStyObj.top) {
|