2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-20 09:50:33 +03:00

Fixed bug when setting drag limit when there are other components besides g-gantt-row in g-gantt-chart

Fixed drag limit when push-on-overlap dynamically changes
This commit is contained in:
Marko Zunic
2020-06-03 10:58:54 +02:00
parent ba318235a9
commit f5edfb0f4c
5 changed files with 20 additions and 11 deletions
+1 -6
View File
@@ -1,6 +1,6 @@
{
"name": "vue-ganttastic",
"version": "0.9.6",
"version": "0.9.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -3174,11 +3174,6 @@
"minimist": "1.2.5"
}
},
"moment": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.26.0.tgz",
"integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "vue-ganttastic",
"version": "0.9.6",
"version": "0.9.8",
"description": "A simple and customizable Gantt chart component for Vue.js",
"repository": {
"type": "git",
@@ -30,7 +30,7 @@
"rollup-plugin-vue": "^5.1.9",
"vue-template-compiler": "^2.6.11"
},
"dependencies": {
"peerDependencies": {
"moment": "^2.26.0"
}
}
+3
View File
@@ -248,6 +248,9 @@ export default {
},
isPosOutOfDragRange(xStart, xEnd){
if(!this.ganttChartProps.pushOnOverlap) {
return false
}
if(xStart && this.dragLimitLeft !== null && xStart < this.dragLimitLeft+2){
return true
}
+7 -3
View File
@@ -107,7 +107,7 @@ export default {
this.ganttBarChildrenList.forEach(ganttBarChild => {
if(ganttBarChild.barConfig.bundle === gGanttBar.barConfig.bundle && ganttBarChild !== gGanttBar){
ganttBarChild.initDrag(e)
this.movedBarsInDrag.add(ganttBarChild)
this.movedBarsInDrag.add(ganttBarChild.bar)
}
})
}
@@ -240,11 +240,15 @@ export default {
let allBarsLeftOrRight = []
if(side === "left"){
allBarsLeftOrRight = bar.$parent.$children.filter(gBar => {
return gBar.$parent === bar.$parent && gBar.$refs['g-gantt-bar'].offsetLeft < bar.$refs['g-gantt-bar'].offsetLeft
return gBar.$options.name === GGanttBar.name
&& gBar.$parent === bar.$parent
&& gBar.$refs['g-gantt-bar'].offsetLeft < bar.$refs['g-gantt-bar'].offsetLeft
})
} else {
allBarsLeftOrRight = bar.$parent.$children.filter(gBar => {
return gBar.$parent === bar.$parent && gBar.$refs['g-gantt-bar'].offsetLeft > bar.$refs['g-gantt-bar'].offsetLeft
return gBar.$options.name === GGanttBar.name
&& gBar.$parent === bar.$parent
&& gBar.$refs['g-gantt-bar'].offsetLeft > bar.$refs['g-gantt-bar'].offsetLeft
})
}
if(allBarsLeftOrRight.length > 0){
+7
View File
@@ -12,6 +12,7 @@
:row-label-width="`${rowLabelWidth}%`"
:row-height="rowHeight"
:theme="selectedTheme"
@dragend-bar="onDragend($event)"
>
<template v-for="row in rowList">
<g-gantt-row
@@ -165,6 +166,12 @@ export default {
]
}
},
methods: {
onDragend(e){
console.log(e)
}
}
}
</script>