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

Now obtaining gantt bar children in g-gantt-chart using a method instead of a computed property (because $refs are not reactive)

This commit is contained in:
Marko Zunic
2020-06-03 12:26:20 +02:00
parent 55ed159693
commit 6586ca95ee
2 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vue-ganttastic",
"version": "0.9.8",
"version": "0.9.11",
"description": "A simple and customizable Gantt chart component for Vue.js",
"repository": {
"type": "git",
+9 -9
View File
@@ -79,7 +79,11 @@ export default {
return GanttasticThemeColors[this.theme] || GanttasticThemeColors.default
},
ganttBarChildrenList(){
},
methods: {
getGanttBarChildrenList(){
let ganttBarChildren = []
let ganttRowChildrenList = this.$children.filter(childComp => childComp.$options.name === GGanttRow.name)
ganttRowChildrenList.forEach(row => {
@@ -87,24 +91,20 @@ export default {
ganttBarChildren.push(...ganttBarChildrenOfRow)
})
return ganttBarChildren
}
},
methods: {
},
getBarsFromBundle(bundleId){
if(bundleId === undefined || bundleId === null){
return []
}
return this.ganttBarChildrenList.filter(ganttBarChild => ganttBarChild.barConfig.bundle === bundleId)
return this.getGanttBarChildrenList().filter(ganttBarChild => ganttBarChild.barConfig.bundle === bundleId)
},
initDragOfBarsFromBundle(gGanttBar, e){
gGanttBar.initDrag(e)
this.movedBarsInDrag.add(gGanttBar.bar)
if(gGanttBar.barConfig.bundle !== null && gGanttBar.barConfig.bundle !== undefined){
this.ganttBarChildrenList.forEach(ganttBarChild => {
this.getGanttBarChildrenList().forEach(ganttBarChild => {
if(ganttBarChild.barConfig.bundle === gGanttBar.barConfig.bundle && ganttBarChild !== gGanttBar){
ganttBarChild.initDrag(e)
this.movedBarsInDrag.add(ganttBarChild.bar)
@@ -119,7 +119,7 @@ export default {
if(bundleId === undefined || bundleId === null){
return
}
this.ganttBarChildrenList.forEach(ganttBarChild => {
this.getGanttBarChildrenList().forEach(ganttBarChild => {
if(ganttBarChild.barConfig.bundle === bundleId && ganttBarChild.bar !== pushedBar){
ganttBarChild.moveBarByMinutesAndPush(minuteDiff, overlapType)
this.movedBarsInDrag.add(ganttBarChild.bar)