2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-25 08:30:32 +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", "name": "vue-ganttastic",
"version": "0.9.8", "version": "0.9.11",
"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",
+8 -8
View File
@@ -79,7 +79,11 @@ export default {
return GanttasticThemeColors[this.theme] || GanttasticThemeColors.default return GanttasticThemeColors[this.theme] || GanttasticThemeColors.default
}, },
ganttBarChildrenList(){ },
methods: {
getGanttBarChildrenList(){
let ganttBarChildren = [] let ganttBarChildren = []
let ganttRowChildrenList = this.$children.filter(childComp => childComp.$options.name === GGanttRow.name) let ganttRowChildrenList = this.$children.filter(childComp => childComp.$options.name === GGanttRow.name)
ganttRowChildrenList.forEach(row => { ganttRowChildrenList.forEach(row => {
@@ -87,24 +91,20 @@ export default {
ganttBarChildren.push(...ganttBarChildrenOfRow) ganttBarChildren.push(...ganttBarChildrenOfRow)
}) })
return ganttBarChildren return ganttBarChildren
}
}, },
methods: {
getBarsFromBundle(bundleId){ getBarsFromBundle(bundleId){
if(bundleId === undefined || bundleId === null){ if(bundleId === undefined || bundleId === null){
return [] return []
} }
return this.ganttBarChildrenList.filter(ganttBarChild => ganttBarChild.barConfig.bundle === bundleId) return this.getGanttBarChildrenList().filter(ganttBarChild => ganttBarChild.barConfig.bundle === bundleId)
}, },
initDragOfBarsFromBundle(gGanttBar, e){ initDragOfBarsFromBundle(gGanttBar, e){
gGanttBar.initDrag(e) gGanttBar.initDrag(e)
this.movedBarsInDrag.add(gGanttBar.bar) this.movedBarsInDrag.add(gGanttBar.bar)
if(gGanttBar.barConfig.bundle !== null && gGanttBar.barConfig.bundle !== undefined){ 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){ if(ganttBarChild.barConfig.bundle === gGanttBar.barConfig.bundle && ganttBarChild !== gGanttBar){
ganttBarChild.initDrag(e) ganttBarChild.initDrag(e)
this.movedBarsInDrag.add(ganttBarChild.bar) this.movedBarsInDrag.add(ganttBarChild.bar)
@@ -119,7 +119,7 @@ export default {
if(bundleId === undefined || bundleId === null){ if(bundleId === undefined || bundleId === null){
return return
} }
this.ganttBarChildrenList.forEach(ganttBarChild => { this.getGanttBarChildrenList().forEach(ganttBarChild => {
if(ganttBarChild.barConfig.bundle === bundleId && ganttBarChild.bar !== pushedBar){ if(ganttBarChild.barConfig.bundle === bundleId && ganttBarChild.bar !== pushedBar){
ganttBarChild.moveBarByMinutesAndPush(minuteDiff, overlapType) ganttBarChild.moveBarByMinutesAndPush(minuteDiff, overlapType)
this.movedBarsInDrag.add(ganttBarChild.bar) this.movedBarsInDrag.add(ganttBarChild.bar)