mirror of
https://github.com/tenrok/vue-ganttastic.git
synced 2026-06-25 09:10:32 +03:00
Added prop 'min-gap-between-bars' (in minutes)
Fixed drag limit when a shadow is to the right Bumped version
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-ganttastic",
|
"name": "vue-ganttastic",
|
||||||
"version": "0.9.23",
|
"version": "0.9.24",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-ganttastic",
|
"name": "vue-ganttastic",
|
||||||
"version": "0.9.23",
|
"version": "0.9.25",
|
||||||
"description": "A simple and customizable Gantt chart component for Vue.js",
|
"description": "A simple and customizable Gantt chart component for Vue.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
+10
-7
@@ -65,7 +65,8 @@ export default {
|
|||||||
"moveBarsFromBundleOfPushedBar",
|
"moveBarsFromBundleOfPushedBar",
|
||||||
"setDragLimitsOfGanttBar",
|
"setDragLimitsOfGanttBar",
|
||||||
"onBarEvent",
|
"onBarEvent",
|
||||||
"onDragendBar"
|
"onDragendBar",
|
||||||
|
"getMinGapBetweenBars",
|
||||||
],
|
],
|
||||||
|
|
||||||
data(){
|
data(){
|
||||||
@@ -260,10 +261,10 @@ export default {
|
|||||||
if(!this.ganttChartProps.pushOnOverlap) {
|
if(!this.ganttChartProps.pushOnOverlap) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if(xStart && this.dragLimitLeft !== null && xStart < this.dragLimitLeft+2){
|
if(xStart && this.dragLimitLeft !== null && xStart < this.dragLimitLeft + this.getMinGapBetweenBars()){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if(xEnd && this.dragLimitRight !== null && xEnd > this.dragLimitRight-2){
|
if(xEnd && this.dragLimitRight !== null && xEnd > this.dragLimitRight - this.getMinGapBetweenBars()){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -301,16 +302,17 @@ export default {
|
|||||||
let overlapEndMoment = moment(overlapBar[this.barEnd])
|
let overlapEndMoment = moment(overlapBar[this.barEnd])
|
||||||
switch(overlapType){
|
switch(overlapType){
|
||||||
case "left":
|
case "left":
|
||||||
minuteDiff = overlapEndMoment.diff(currentStartMoment, "minutes", true)
|
minuteDiff = overlapEndMoment.diff(currentStartMoment, "minutes", true) + this.getMinGapBetweenBars()
|
||||||
overlapBar[this.barEnd] = currentBar[this.barStart]
|
overlapBar[this.barEnd] = moment(currentBar[this.barStart]).subtract(this.getMinGapBetweenBars(), "minutes", true)
|
||||||
overlapBar[this.barStart] = overlapStartMoment.subtract(minuteDiff, "minutes", true)
|
overlapBar[this.barStart] = overlapStartMoment.subtract(minuteDiff, "minutes", true)
|
||||||
break
|
break
|
||||||
case "right":
|
case "right":
|
||||||
minuteDiff = currentEndMoment.diff(overlapStartMoment, "minutes", true)
|
minuteDiff = currentEndMoment.diff(overlapStartMoment, "minutes", true) + this.getMinGapBetweenBars()
|
||||||
overlapBar[this.barStart] = currentBar[this.barEnd]
|
overlapBar[this.barStart] = moment(currentBar[this.barEnd]).add(this.getMinGapBetweenBars(), "minutes", true)
|
||||||
overlapBar[this.barEnd] = overlapEndMoment.add(minuteDiff, "minutes", true)
|
overlapBar[this.barEnd] = overlapEndMoment.add(minuteDiff, "minutes", true)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
// eslint-disable-next-line
|
||||||
console.warn("One bar is inside of the other one! This should never occur while push-on-overlap is active!")
|
console.warn("One bar is inside of the other one! This should never occur while push-on-overlap is active!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -353,6 +355,7 @@ export default {
|
|||||||
this.barEndMoment = moment(this.barEndMoment).add(minuteCount, "minutes", true)
|
this.barEndMoment = moment(this.barEndMoment).add(minuteCount, "minutes", true)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
// eslint-disable-next-line
|
||||||
console.warn("wrong direction in moveBarByMinutesAndPush")
|
console.warn("wrong direction in moveBarByMinutesAndPush")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-2
@@ -58,6 +58,10 @@ export default {
|
|||||||
width: {type: String, default: "100%"}, // the total width of the entire ganttastic component in %
|
width: {type: String, default: "100%"}, // the total width of the entire ganttastic component in %
|
||||||
pushOnOverlap: {type: Boolean},
|
pushOnOverlap: {type: Boolean},
|
||||||
snapBackOnOverlap: {type: Boolean},
|
snapBackOnOverlap: {type: Boolean},
|
||||||
|
minGapBetweenBars: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data(){
|
data(){
|
||||||
@@ -224,7 +228,7 @@ export default {
|
|||||||
while(nextBar){
|
while(nextBar){
|
||||||
let currentBarOffsetRight = currentBar.$refs['g-gantt-bar'].offsetLeft + currentBar.$refs['g-gantt-bar'].offsetWidth
|
let currentBarOffsetRight = currentBar.$refs['g-gantt-bar'].offsetLeft + currentBar.$refs['g-gantt-bar'].offsetWidth
|
||||||
gapDistanceSoFar += nextBar.$refs['g-gantt-bar'].offsetLeft - currentBarOffsetRight
|
gapDistanceSoFar += nextBar.$refs['g-gantt-bar'].offsetLeft - currentBarOffsetRight
|
||||||
if(nextBar.barConfig.immobile){
|
if(nextBar.barConfig.immobile || (nextBar.barConfig.isShadow && !ignoreShadows)){
|
||||||
return [gapDistanceSoFar, bundleBarsAndGapDist]
|
return [gapDistanceSoFar, bundleBarsAndGapDist]
|
||||||
} else if(nextBar.barConfig.bundle){
|
} else if(nextBar.barConfig.bundle){
|
||||||
bundleBarsAndGapDist.push({bar: nextBar, gapDistance: gapDistanceSoFar})
|
bundleBarsAndGapDist.push({bar: nextBar, gapDistance: gapDistanceSoFar})
|
||||||
@@ -290,7 +294,8 @@ export default {
|
|||||||
onBarEvent: (e, ganttBar) => this.onBarEvent(e, ganttBar),
|
onBarEvent: (e, ganttBar) => this.onBarEvent(e, ganttBar),
|
||||||
onDragendBar: (e, ganttBar) => this.onDragendBar(e, ganttBar),
|
onDragendBar: (e, ganttBar) => this.onDragendBar(e, ganttBar),
|
||||||
shouldSnapBackOnOverlap: () => this.snapBackOnOverlap,
|
shouldSnapBackOnOverlap: () => this.snapBackOnOverlap,
|
||||||
snapBackBundle: (ganttBar) => this.snapBackBundle(ganttBar)
|
snapBackBundle: (ganttBar) => this.snapBackBundle(ganttBar),
|
||||||
|
getMinGapBetweenBars: () => this.minGapBetweenBars
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user