JosephusPaye / Keen-UI

A lightweight Vue.js UI library with a simple API, inspired by Google's Material Design.
https://josephuspaye.github.io/Keen-UI/
MIT License
4.1k stars 438 forks source link

UiSelect improvements #557

Open kilobyte2007 opened 1 year ago

kilobyte2007 commented 1 year ago

This is a proposal PR handling an issue I've long had in our project.

  1. UiSelect to emit only the value and not the whole object up. This is more and more relevant considering the way modern apps work where you have a list of options but only store the value in your database, without the label. I know it's a very breaking change but it seems like it would be the correct way forward. Most other UI libraries do it this way and it seems much more logical. #285 #270
  2. Added a clear button to UiSelect - allowing it to clear the value (similarly to the way UiAutocomplete works). It can be configured using a prop. I've also added it to the UiDatepicker component as it also didn't have a way of clearing the value out of the box. Also, I've added support for a null value for the UiSelect - this way we can have null values coming from the database and the UiSelect won't turn them into a String automatically. #446 #406
  3. Added support to providing UiSelect options as an object - just a QOL improvement as very often it's much easier to provide the options like this: `{ 1: 'Sergiu', 2: 'Tom', 3: 'John' }.

We already use all of these in our production apps by linking to a forked branch and it helped me remove so much redundant code so I would really be glad if this landed. Let me know what you think.