Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Date dropdown clear buttons, keyboard support #148

Closed
wants to merge 9 commits into from
Closed

Date dropdown clear buttons, keyboard support #148

wants to merge 9 commits into from

Conversation

shamoon
Copy link
Contributor

@shamoon shamoon commented Dec 17, 2020

This PR closes #144 , it adds:

  • Clear buttons for each date field (after / before)
  • Allows date field searching using keyboard input
  • Shows visual feedback if date entered with keyboard is invalid
  • Executes search after 'Enter' key pressed
  • Swaps position of after & before (because I realized if you think of a range like From X to Y then "after" (X) comes first.

@shamoon shamoon changed the title Fix/issue 144 Date dropdown clear buttons, keyboard support Dec 17, 2020
@jonaswinkler
Copy link
Owner

Thank you! I'll have a look at it later.

@jonaswinkler
Copy link
Owner

This doesn't really work. Well, it kind of does, but If I try to manually edit the year the cursor jumps back to the end and a request is made to the server, which results in a Bad Request 400. I'd rather much like the request to be made when I'm done typing.

Maybe we should try using the other date selection inputs, the one I've also used on the document editing form.

@shamoon
Copy link
Contributor Author

shamoon commented Dec 17, 2020 via email

@jonaswinkler
Copy link
Owner

Or rather, until exiting the field (or pressing enter).

@shamoon
Copy link
Contributor Author

shamoon commented Dec 17, 2020

Ok I think I sorted it all. Also added a little visual feedback if the keyboard input is not a valid date and made it only submit on 'Enter'

@jonaswinkler
Copy link
Owner

When I select a date with the quick filters, close the drop down, clear all filters with the rightmost button, the dates don't get properly cleared. Open up the drop down again, and the list view reloads with the filter active again. Very strange.

@shamoon
Copy link
Contributor Author

shamoon commented Dec 18, 2020

Ok last commit should fix that hopefully.

jonaswinkler pushed a commit that referenced this pull request Dec 18, 2020
@jonaswinkler
Copy link
Owner

jonaswinkler commented Dec 18, 2020

Alright, I've replaced the ngbDatepicker with a regular <input type="date">, which works just as well for selecting dates. This thing also does not fire (change) events when the input is still incomplete. Debounce on that, works. Also, when passing around date strings (which is totally fine), the infinite loop you discovered does not trigger, so I was able to get rid of the hack.

That should wrap up this issue.

Edit: I've included both the per-field clear buttons and the changed order of both input fields.

@shamoon shamoon mentioned this pull request Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants