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

View File

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

View File

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