Closed ghiscoding closed 3 months ago
Although I generally like the quality and style of your code, I took the liberty of refactoring the code a little. I don’t like a lot of if/esle
, especially nested ones.
sure go ahead and change as you like it, thanks for merging :)
using auto position, its cutting off the calendar in browser window ?
@SohanChotia your space is very tight in your print screen above, so it most probably cannot properly find the best position because none of the side have enough space to position itself. To troubleshoot that, you can maybe modify the code and add an alert on the canShow
object to see if any side is true
or not. There's not much more the auto position function can do if it can't find where to position itself.
I'm assuming the logic below is returning ['top', 'right']
in your use case
if we assume it returns top right, why its still aligned from left corner, its right corner should be aligned from right side of the container
auto
will calculate available space on all sides and will always try to position itself to the bottom but when there's not enough space, it will then use the other best positionpositionToInput
, for example the new functiongetAvailablePosition()
will return an object with something like the following:We can see that the
parentPosition
is something that we can then provide to thepositionToInput
because it uses the same structure.Below are a couple of animated gifs of the auto-positioning depending on available space