From 7ab91b8b056014407f6437690a82900bed8f0f31 Mon Sep 17 00:00:00 2001 From: Sergey Solodyagin Date: Fri, 15 Oct 2021 16:06:44 +0300 Subject: [PATCH] feat: highlight days --- package.json | 2 +- src/components/GGanttBar.vue | 10 +- src/components/GGanttChart.vue | 46 ++++--- src/components/GGanttGrid.vue | 39 +++++- src/components/GGanttRow.vue | 3 +- src/components/GGanttTimeaxis.vue | 6 +- src/demo/App.vue | 217 +++++++++++++++++++++++------- 7 files changed, 238 insertions(+), 85 deletions(-) diff --git a/package.json b/package.json index 0e024e6..81ad590 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tenrok/vue-ganttastic", - "version": "0.10.9", + "version": "0.10.10", "description": "A simple and customizable Gantt chart component for Vue.js", "keywords": [ "gantt", diff --git a/src/components/GGanttBar.vue b/src/components/GGanttBar.vue index d59571e..b483897 100644 --- a/src/components/GGanttBar.vue +++ b/src/components/GGanttBar.vue @@ -356,14 +356,14 @@ export default { newXEnd && moment(this.bar[this.barEndKey]).isAfter(this.barEndBeforeDrag) - const currentIndex = this.allBarsInRow.findIndex((bar) => bar == this.bar) + const currentIndex = this.allBarsInRow.findIndex(bar => bar == this.bar) let otherBars = [] if (isSqueezeToRight) { otherBars = this.allBarsInRow.slice(currentIndex + 1) if (otherBars.length) { let otherBarTotalWidth = otherBars - .map((bar) => this.getBarWidth(bar)) + .map(bar => this.getBarWidth(bar)) .reduce((accumulator, currentValue) => accumulator + currentValue) if (newXEnd > this.barContainer.width - otherBarTotalWidth) { return true @@ -373,7 +373,7 @@ export default { otherBars = this.allBarsInRow.slice(0, currentIndex) if (otherBars.length) { let otherBarTotalWidth = otherBars - .map((bar) => this.getBarWidth(bar)) + .map(bar => this.getBarWidth(bar)) .reduce((accumulator, currentValue) => accumulator + currentValue) if (newXStart < otherBarTotalWidth) { return true @@ -478,7 +478,7 @@ export default { let barStartMoment = moment(bar[this.barStartKey]) let barEndMoment = moment(bar[this.barEndKey]) let overlapLeft, overlapRight, overlapInBetween - let overlapBar = this.allBarsInRow.find((otherBar) => { + let overlapBar = this.allBarsInRow.find(otherBar => { if ( otherBar === bar || otherBar.ganttBarConfig.pushOnOverlap === false @@ -685,4 +685,4 @@ export default { opacity: 1; } } - \ No newline at end of file + diff --git a/src/components/GGanttChart.vue b/src/components/GGanttChart.vue index 5e9593d..7262a5f 100644 --- a/src/components/GGanttChart.vue +++ b/src/components/GGanttChart.vue @@ -1,7 +1,7 @@