feat: add two inputs to toggle flatpickr

This commit is contained in:
kolaente 2022-01-09 13:33:12 +01:00
parent dabe87af4b
commit 8d5bfbe828
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 48 additions and 4 deletions

View file

@ -22,7 +22,29 @@
{{ $t('misc.custom') }} {{ $t('misc.custom') }}
</button> </button>
</div> </div>
<div class="flatpickr-container"> <div class="flatpickr-container input-group">
<label class="label">
{{ $t('input.datepickerRange.from') }}
<div class="field has-addons">
<div class="control is-fullwidth">
<input class="input" type="text"/>
</div>
<div class="control">
<x-button icon="calendar" variant="secondary" data-toggle/>
</div>
</div>
</label>
<label class="label">
{{ $t('input.datepickerRange.to') }}
<div class="field has-addons">
<div class="control is-fullwidth">
<input class="input" type="text"/>
</div>
<div class="control">
<x-button icon="calendar" variant="secondary" data-toggle/>
</div>
</div>
</label>
<flat-pickr <flat-pickr
:config="flatPickerConfig" :config="flatPickerConfig"
v-model="dateRange" v-model="dateRange"
@ -54,7 +76,7 @@ const flatPickerConfig = computed(() => ({
altInput: true, altInput: true,
dateFormat: 'Y-m-d H:i', dateFormat: 'Y-m-d H:i',
enableTime: false, enableTime: false,
inline: true, wrap: true,
mode: 'range', mode: 'range',
locale: { locale: {
firstDayOf7Days: weekStart.value, firstDayOf7Days: weekStart.value,
@ -137,9 +159,27 @@ const customRangeActive = computed<Boolean>(() => {
.flatpickr-container { .flatpickr-container {
width: 70%; width: 70%;
border-left: 1px solid var(--grey-200); border-left: 1px solid var(--grey-200);
padding: 1rem;
font-size: .9rem;
:deep(input.input) { // Flatpickr has no option to use it without an input field so we're hiding it instead
display: none; :deep(input.form-control.input) {
height: 0;
padding: 0;
border: 0;
}
.field .control :deep(.button) {
border: 1px solid var(--input-border-color);
height: 2.25rem;
&:hover {
border: 1px solid var(--input-hover-border-color);
}
}
.label, .input, :deep(.button) {
font-size: .9rem;
} }
} }

View file

@ -522,6 +522,10 @@
"multiselect": { "multiselect": {
"createPlaceholder": "Create new", "createPlaceholder": "Create new",
"selectPlaceholder": "Click or press enter to select" "selectPlaceholder": "Click or press enter to select"
},
"datepickerRange": {
"to": "To",
"from": "From"
} }
}, },
"task": { "task": {