Vuepic / vue3-date-time-picker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
158 stars 13 forks source link

altPosition not work correctly #97

Closed nipanimaju closed 2 years ago

nipanimaju commented 2 years ago

If is enought space in the top Datepicker recalculate top position, when is enought space in the bottom Datepicker take my custom 'top' position.

code:

            <Datepicker v-else-if="getInputType(name) == 'date'"
              v-model="gObject[name]"
              autoPosition="false"
              :altPosition="() => { return { top: '80px', left: '50%', transform: 'translateX(-50%)' } }"
              :enableTimePicker="false"
              :placeholder="dateConvert(name, value)"
              @closed="dateWithoutTime(gObject[name], name)"
              :locale="$i18n.locale"
              hideInputIcon/>

Windows 10 64, Chrome 111a 111b

Jasenkoo commented 2 years ago

I just got the time to take a deeper look, I am not sure what is happening, can you explain a little bit better?

nipanimaju commented 2 years ago
            <Datepicker v-else-if="getInputType(name) == 'date'"
              v-model="gObject[name]"
              :enableTimePicker="false"
              autoPosition="false"
              :altPosition="() => { return { top: '80px', left: '50%', transform: 'translateX(-50%)' } }"
              :placeholder="dateConvert(name, value)"
              @closed="dateWithoutTime(gObject[name], name)"
              :locale="$i18n.locale"
              teleport=".table-nav"
              hideInputIcon/>

Datepicker is created dynamicly in table with another input fields (text, number). All this fields are in wrapper .table-nav where ist set teleport, this ist scrollable div with height auto. On Large screen everything is fine i dont need altPosition, but on mobile i need to show Datapicker in the midle on screen and there i added altPosition. When Datepicker field is at the top of the application in css property is my custom top: 80px, but when Datepicker field is at the bottom my custom pos is ignored (or recalculate?) is 350px sometimes 500px. Screen one - everyting ok, sceen two - not. Red square shows the current position of the Datapicker field screen screen2

Jasenkoo commented 2 years ago

Tnx, I know what is causing it, will be fixed

nipanimaju commented 2 years ago

I have updated the package but the problem persists

// edit: i forgot to set autoposition = false, work good, thx

ekkode commented 2 years ago

@Jasenkoo I confirm that the issue is still present in v2.6.0. I have downgraded to v2.3.6 and everything is ok, it seems that the problem started from v2.4.0

The issue is present on mobile and small devices.

Jasenkoo commented 2 years ago

@ekkode Did you set autoPosition to false?