Add background stripes and such
This commit is contained in:
parent
affaa95e3f
commit
1817a1f958
2 changed files with 49 additions and 6 deletions
|
@ -24,8 +24,10 @@
|
||||||
:push-on-overlap="true"
|
:push-on-overlap="true"
|
||||||
row-label-width="0"
|
row-label-width="0"
|
||||||
:row-height="37"
|
:row-height="37"
|
||||||
:grid="true"
|
:grid="false"
|
||||||
@dragend-bar="dragged($event)"
|
@dragend-bar="dragged($event)"
|
||||||
|
:style="{'--day-width': dayWidthPercent + 'px'}"
|
||||||
|
ref="g-gantt-chart-container"
|
||||||
>
|
>
|
||||||
<g-gantt-row
|
<g-gantt-row
|
||||||
v-for="(t, k) in ganttBars"
|
v-for="(t, k) in ganttBars"
|
||||||
|
@ -236,6 +238,18 @@ import Rights from '../../models/rights.json'
|
||||||
import FilterPopup from '@/components/list/partials/filter-popup'
|
import FilterPopup from '@/components/list/partials/filter-popup'
|
||||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||||
|
|
||||||
|
// Source: https://stackoverflow.com/a/11252167/10924593
|
||||||
|
const treatAsUTC = date => {
|
||||||
|
const result = new Date(date)
|
||||||
|
result.setMinutes(result.getMinutes() - result.getTimezoneOffset())
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const daysBetween = (startDate, endDate) => {
|
||||||
|
const millisecondsPerDay = 24 * 60 * 60 * 1000;
|
||||||
|
return (treatAsUTC(endDate) - treatAsUTC(startDate)) / millisecondsPerDay;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GanttChart',
|
name: 'GanttChart',
|
||||||
components: {
|
components: {
|
||||||
|
@ -313,9 +327,21 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.buildTheGanttChart()
|
this.buildTheGanttChart()
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: {
|
||||||
|
...mapState({
|
||||||
canWrite: (state) => state.currentList.maxRight > Rights.READ,
|
canWrite: (state) => state.currentList.maxRight > Rights.READ,
|
||||||
}),
|
}),
|
||||||
|
dayWidthPercent() {
|
||||||
|
const days = daysBetween(this.startDate, this.endDate)
|
||||||
|
|
||||||
|
let containerWidth = 1
|
||||||
|
if(this.$refs['g-gantt-chart-container']) {
|
||||||
|
containerWidth = this.$refs['g-gantt-chart-container'].$el.clientWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.round(containerWidth / days)
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buildTheGanttChart() {
|
buildTheGanttChart() {
|
||||||
this.setDates()
|
this.setDates()
|
||||||
|
|
|
@ -236,12 +236,29 @@ $gantt-vertical-border-color: $grey-100;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--day-width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
#g-gantt-chart {
|
#g-gantt-chart {
|
||||||
* {
|
* {
|
||||||
font-family: $family-sans-serif !important;
|
font-family: $family-sans-serif !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .85rem
|
|
||||||
|
.g-gantt-row {
|
||||||
|
&:nth-child(even) {
|
||||||
|
background: rgba(0, 0, 0, 0) repeating-linear-gradient(90deg, #ededed, #ededed 1px, #fff 1px, #fff var(--day-width)) repeat scroll 0% 0%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(odd) {
|
||||||
|
background: rgba(0, 0, 0, 0) repeating-linear-gradient(90deg, #ededed, #ededed 1px, #fafafa 1px, #fafafa var(--day-width)) repeat scroll 0% 0%;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .g-gantt-row-bars-container {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.g-gantt-bar {
|
.g-gantt-bar {
|
||||||
border-radius: 6px !important;
|
border-radius: 6px !important;
|
||||||
|
|
Loading…
Reference in a new issue