Add a disabled property to the datepicker
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-11-28 13:52:27 +01:00
parent 590edc4f82
commit 68c48b5792
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="datepicker">
<a @click.stop="show = !show" class="show">
<div class="datepicker" :class="{'disabled': disabled}">
<a @click.stop="toggleDatePopup" class="show">
<template v-if="date === null">
{{ chooseDateLabel }}
</template>
@ -140,6 +140,10 @@ export default {
type: String,
default: 'Choose a date'
},
disabled: {
type: Boolean,
default: false,
}
},
mounted() {
this.date = this.value
@ -162,6 +166,13 @@ export default {
this.$emit('input', this.date)
this.$emit('change', this.date)
},
toggleDatePopup() {
if(this.disabled) {
return
}
this.show = !this.show
},
hideDatePopup(e) {
if (this.show) {

View File

@ -3,6 +3,10 @@
display: none;
}
&.disabled a {
cursor: default;
}
.datepicker-popup {
position: absolute;
z-index: 99;

View File

@ -73,6 +73,10 @@
background: $white;
}
}
&.disabled a.show:hover {
background: transparent;
}
}
table {