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

Some bar events also emit the time position in the gantt chart on which they occured (e.g. contextmenu-bar)

This commit is contained in:
Marko Zunic
2021-01-13 11:19:59 +01:00
parent 82a075472b
commit c2ed571162
4 changed files with 949 additions and 945 deletions
+935 -935
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vue-ganttastic",
"version": "0.9.30",
"version": "0.9.31",
"description": "A simple and customizable Gantt chart component for Vue.js",
"repository": {
"type": "git",
+11 -7
View File
@@ -153,25 +153,28 @@ export default {
clearTimeout(this.tooltipTimeout)
}
this.tooltipTimeout = setTimeout(() => this.showTooltip = true, 800)
this.onBarEvent(e, this)
this.onBarEvent({event: e, type: e.type}, this)
},
onMouseleave(e){
clearTimeout(this.tooltipTimeout)
this.showTooltip = false
this.onBarEvent(e, this)
this.onBarEvent({event: e, type: e.type}, this)
},
onContextmenu(e){
this.onBarEvent(e, this)
const time = this.mapPositionToTime(e.clientX - this.barContainer.left).format("YYYY-MM-DD HH:mm:ss")
this.onBarEvent({event: e, type: e.type, time}, this)
},
onClick(e){
this.onBarEvent(e, this)
const time = this.mapPositionToTime(e.clientX - this.barContainer.left).format("YYYY-MM-DD HH:mm:ss")
this.onBarEvent({event: e, type: e.type, time}, this)
},
onDblclick(e) {
this.onBarEvent(e, this)
const time = this.mapPositionToTime(e.clientX - this.barContainer.left).format("YYYY-MM-DD HH:mm:ss")
this.onBarEvent({event: e, type: e.type, time}, this)
},
onMousedown(e){
@@ -189,7 +192,8 @@ export default {
{once: true}
)
}
this.onBarEvent(e, this)
const time = this.mapPositionToTime(e.clientX - this.barContainer.left).format("YYYY-MM-DD HH:mm:ss")
this.onBarEvent({event: e, type: e.type, time}, this)
},
onFirstMousemove(e){
@@ -234,7 +238,7 @@ export default {
this.barStartMoment = this.mapPositionToTime(newXStart)
this.barEndMoment = this.mapPositionToTime(newXEnd)
this.manageOverlapping()
this.onBarEvent({...e, type: "drag"}, this)
this.onBarEvent({event: e, type: "drag"}, this)
},
dragByHandleLeft(e){
+2 -2
View File
@@ -149,8 +149,8 @@ export default {
return false
},
onBarEvent(e, ganttBar){
this.$emit(`${e.type}-bar`, {event: e, bar: ganttBar.bar})
onBarEvent({event, type, time}, ganttBar){
this.$emit(`${type}-bar`, {event, bar: ganttBar.bar, time})
},
onDragendBar(e, ganttBar){