2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00

fix: toggle popover on click

- hide clear if required
This commit is contained in:
18alantom 2022-12-05 16:44:34 +05:30
parent c6fe61c545
commit d17352b8f3
2 changed files with 10 additions and 12 deletions

View File

@ -33,17 +33,13 @@
</template> </template>
<!-- Datetime Input Popover --> <!-- Datetime Input Popover -->
<template #content="{ togglePopover }"> <template #content>
<DatetimePicker <DatetimePicker
:show-clear="!isRequired"
:select-time="selectTime" :select-time="selectTime"
:model-value="internalValue" :model-value="internalValue"
:format-value="formatValue" :format-value="formatValue"
@update:model-value=" @update:model-value="(value) => triggerChange(value)"
(value) => {
triggerChange(value);
togglePopover();
}
"
/> />
</template> </template>
</Popover> </Popover>

View File

@ -2,10 +2,7 @@
<div> <div>
<!-- Datetime header --> <!-- Datetime header -->
<div class="flex justify-between items-center text-sm px-4 pt-4"> <div class="flex justify-between items-center text-sm px-4 pt-4">
<div <div class="text-blue-500">
class="text-blue-500 cursor-pointer"
@click="selectMonthYear = !selectMonthYear"
>
{{ datetimeString }} {{ datetimeString }}
</div> </div>
@ -88,7 +85,10 @@
class="border-l flex flex-col justify-between" class="border-l flex flex-col justify-between"
> >
<!-- Month Selector --> <!-- Month Selector -->
<div class="flex flex-col gap-2 overflow-auto h-40 p-4"> <div
class="flex flex-col gap-2 overflow-auto m-4"
style="height: calc(248px - 79.5px - 1px - 2rem)"
>
<div <div
v-for="(m, i) of months" v-for="(m, i) of months"
:key="m" :key="m"
@ -170,6 +170,7 @@
</button> </button>
<button <button
v-if="showClear"
class="text-xs text-gray-600 hover:text-gray-600 ml-auto" class="text-xs text-gray-600 hover:text-gray-600 ml-auto"
@click="clearClicked" @click="clearClicked"
> >
@ -204,6 +205,7 @@ export default defineComponent({
props: { props: {
modelValue: { type: Date }, modelValue: { type: Date },
selectTime: { type: Boolean, default: true }, selectTime: { type: Boolean, default: true },
showClear: { type: Boolean, default: true },
formatValue: { type: Function as PropType<(value: Date | null) => string> }, formatValue: { type: Function as PropType<(value: Date | null) => string> },
}, },
mounted() { mounted() {