|
|
@@ -5,14 +5,15 @@
|
|
|
{{ $t('period_choose') }}
|
|
|
</span>
|
|
|
|
|
|
- <UiInputDatePicker
|
|
|
- label="date_choose"
|
|
|
- :data="datesRange"
|
|
|
- range
|
|
|
- dense
|
|
|
- single-line
|
|
|
- height="22"
|
|
|
- @update="updateDateTimeRange"
|
|
|
+ <!-- @see https://vue3datepicker.com/props/modes/#multi-calendars -->
|
|
|
+ <VueDatePicker
|
|
|
+ :model-value="datesRange"
|
|
|
+ range
|
|
|
+ multi-calendars
|
|
|
+ :teleport="true"
|
|
|
+ :alt-position="dateRangePickerAltPosition"
|
|
|
+ :enable-time-picker="false"
|
|
|
+ @update="updateDateTimeRange"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
@@ -48,12 +49,20 @@ const { setDirty } = useFormStore()
|
|
|
const accessProfileStore = useAccessProfileStore()
|
|
|
const { em } = useEntityManager()
|
|
|
|
|
|
-const datesRange: Ref<Array<string | null | undefined>> = ref([
|
|
|
- accessProfileStore.historical.dateStart,
|
|
|
- accessProfileStore.historical.dateEnd
|
|
|
+const start = accessProfileStore.historical.dateStart
|
|
|
+const end = accessProfileStore.historical.dateStart
|
|
|
+
|
|
|
+const dateRangePickerAltPosition = (el: HTMLElement) => ({
|
|
|
+ top: el.getBoundingClientRect().bottom,
|
|
|
+ left: el.getBoundingClientRect().left - 100
|
|
|
+})
|
|
|
+
|
|
|
+const datesRange: Ref<Array<Date | null>> = ref([
|
|
|
+ start ? new Date(start) : null,
|
|
|
+ end ? new Date(end) : null
|
|
|
])
|
|
|
|
|
|
-const updateDateTimeRange = async (dates:Array<string>): Promise<any> => {
|
|
|
+const updateDateTimeRange = async (dates: Array<Date>): Promise<any> => {
|
|
|
if (accessProfileStore.id === null) {
|
|
|
throw new Error('Invalid profile id')
|
|
|
}
|
|
|
@@ -136,5 +145,4 @@ if (accessProfileStore.historical.dateStart || accessProfileStore.historical.dat
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</style>
|