mirror of
https://github.com/tenrok/vue-ganttastic.git
synced 2026-06-24 15:30:33 +03:00
fix: grid height
This commit is contained in:
+9
-9
@@ -1,15 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
arrowParens: 'avoid',
|
arrowParens: 'avoid',
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
// "embeddedLanguageFormatting": "auto",
|
// embeddedLanguageFormatting: 'auto',
|
||||||
// "htmlWhitespaceSensitivity": "css",
|
// htmlWhitespaceSensitivity: 'css',
|
||||||
// "insertPragma": false,
|
// insertPragma: false,
|
||||||
// "jsxBracketSameLine": false,
|
// jsxBracketSameLine: false,
|
||||||
// "jsxSingleQuote": false,
|
// jsxSingleQuote: false,
|
||||||
// "printWidth": 80,
|
printWidth: 80,
|
||||||
// "proseWrap": "preserve",
|
// proseWrap: 'preserve',
|
||||||
// "quoteProps": "as-needed",
|
// quoteProps: 'as-needed',
|
||||||
// "requirePragma": false,
|
// requirePragma: false,
|
||||||
semi: false,
|
semi: false,
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
tabWidth: 2,
|
tabWidth: 2,
|
||||||
|
|||||||
@@ -17,24 +17,22 @@
|
|||||||
:grid-size="gridSize"
|
:grid-size="gridSize"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<g-gantt-grid
|
|
||||||
v-if="grid"
|
|
||||||
:chart-start="chartStart"
|
|
||||||
:chart-end="chartEnd"
|
|
||||||
:row-label-width="rowLabelWidth"
|
|
||||||
:highlighted-hours="highlightedHours"
|
|
||||||
:highlighted-days="highlightedDays"
|
|
||||||
:precision="precision"
|
|
||||||
:time-count="timeCount"
|
|
||||||
:grid-size="gridSize"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="g-gantt-rows-container"
|
class="g-gantt-rows-container"
|
||||||
:style="{ width: `${timeCount * gridSize + rowLabelWidth}px` }"
|
:style="{ width: `${timeCount * gridSize + rowLabelWidth}px` }"
|
||||||
>
|
>
|
||||||
|
<g-gantt-grid
|
||||||
|
v-if="grid"
|
||||||
|
:chart-start="chartStart"
|
||||||
|
:chart-end="chartEnd"
|
||||||
|
:row-label-width="rowLabelWidth"
|
||||||
|
:highlighted-hours="highlightedHours"
|
||||||
|
:highlighted-days="highlightedDays"
|
||||||
|
:precision="precision"
|
||||||
|
:time-count="timeCount"
|
||||||
|
:grid-size="gridSize"
|
||||||
|
/>
|
||||||
<slot />
|
<slot />
|
||||||
<!-- the g-gantt-row components go here -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,12 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
ref="g-grid-container"
|
ref="g-grid-container"
|
||||||
class="g-grid-container"
|
class="g-grid-container"
|
||||||
:style="{
|
:style="{ left: `${rowLabelWidth}px`, width: `${timeCount * gridSize}px` }"
|
||||||
left: `${rowLabelWidth}px`,
|
|
||||||
width: `${timeCount * gridSize}px`,
|
|
||||||
top,
|
|
||||||
height,
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="(childPoint, index) in allChildPoints"
|
v-for="(childPoint, index) in allChildPoints"
|
||||||
@@ -43,11 +38,6 @@ export default {
|
|||||||
gridSize: { type: Number },
|
gridSize: { type: Number },
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
|
||||||
top: '0px',
|
|
||||||
height: '0px',
|
|
||||||
}),
|
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
allChildPoints() {
|
allChildPoints() {
|
||||||
let start = moment(this.chartStart)
|
let start = moment(this.chartStart)
|
||||||
@@ -68,26 +58,6 @@ export default {
|
|||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.$nextTick(() => this.onWindowResize())
|
|
||||||
window.addEventListener('resize', this.onWindowResize)
|
|
||||||
},
|
|
||||||
|
|
||||||
destroyed() {
|
|
||||||
window.removeEventListener('resize', this.onWindowResize)
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onWindowResize() {
|
|
||||||
let gridContainer = this.$refs['g-grid-container']
|
|
||||||
if (!gridContainer) return
|
|
||||||
let rowsContainer = gridContainer.nextSibling
|
|
||||||
if (!rowsContainer) return
|
|
||||||
this.top = `${rowsContainer.offsetTop}px`
|
|
||||||
this.height = `${rowsContainer.offsetHeight}px`
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -95,7 +65,7 @@ export default {
|
|||||||
.g-grid-container {
|
.g-grid-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: calc(100% - 23px);
|
bottom: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,12 +96,14 @@ export default {
|
|||||||
this.initAxis()
|
this.initAxis()
|
||||||
this.onWindowResize()
|
this.onWindowResize()
|
||||||
window.addEventListener('resize', this.onWindowResize)
|
window.addEventListener('resize', this.onWindowResize)
|
||||||
window.addEventListener('mousemove', event => this.moveTimemarker(event))
|
window.addEventListener('mousemove', this.moveTimemarker)
|
||||||
window.addEventListener('dragover', event => this.moveTimemarker(event))
|
window.addEventListener('dragover', this.moveTimemarker)
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
window.removeEventListener('resize', this.onWindowResize)
|
window.removeEventListener('resize', this.onWindowResize)
|
||||||
|
window.removeEventListener('mousemove', this.moveTimemarker)
|
||||||
|
window.removeEventListener('dragover', this.moveTimemarker)
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user