2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-25 09:20:34 +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", "name": "vue-ganttastic",
"version": "0.9.30", "version": "0.9.31",
"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",
+11 -7
View File
@@ -153,25 +153,28 @@ export default {
clearTimeout(this.tooltipTimeout) clearTimeout(this.tooltipTimeout)
} }
this.tooltipTimeout = setTimeout(() => this.showTooltip = true, 800) this.tooltipTimeout = setTimeout(() => this.showTooltip = true, 800)
this.onBarEvent(e, this) this.onBarEvent({event: e, type: e.type}, this)
}, },
onMouseleave(e){ onMouseleave(e){
clearTimeout(this.tooltipTimeout) clearTimeout(this.tooltipTimeout)
this.showTooltip = false this.showTooltip = false
this.onBarEvent(e, this) this.onBarEvent({event: e, type: e.type}, this)
}, },
onContextmenu(e){ 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){ 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) { 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){ onMousedown(e){
@@ -189,7 +192,8 @@ export default {
{once: true} {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){ onFirstMousemove(e){
@@ -234,7 +238,7 @@ export default {
this.barStartMoment = this.mapPositionToTime(newXStart) this.barStartMoment = this.mapPositionToTime(newXStart)
this.barEndMoment = this.mapPositionToTime(newXEnd) this.barEndMoment = this.mapPositionToTime(newXEnd)
this.manageOverlapping() this.manageOverlapping()
this.onBarEvent({...e, type: "drag"}, this) this.onBarEvent({event: e, type: "drag"}, this)
}, },
dragByHandleLeft(e){ dragByHandleLeft(e){
+2 -2
View File
@@ -149,8 +149,8 @@ export default {
return false return false
}, },
onBarEvent(e, ganttBar){ onBarEvent({event, type, time}, ganttBar){
this.$emit(`${e.type}-bar`, {event: e, bar: ganttBar.bar}) this.$emit(`${type}-bar`, {event, bar: ganttBar.bar, time})
}, },
onDragendBar(e, ganttBar){ onDragendBar(e, ganttBar){