orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Allow Relation field (tom-select) to display the dropdown input plugin and clear button by default #2816

Open didix16 opened 3 months ago

didix16 commented 3 months ago

Is your feature request related to a problem? Please describe. Well I think it's not a problem at all but a user experience improvement. Now, when you have to change the value from a Relation field, you have to type after the already inserted value which is very strange in my opinion and for many of my end users application. Also they don't know if the input can be erased or not. They need to guess that using backspace can erase the content (only if the Relation has marked as allowEmpty, which I think it should be eraseable by default but that's another history)

Describe the solution you'd like So a solution that I thought is that would be nice to modify the relation_controller.js to add the plugin dropdown-input which displays an input to type explicitly the value you want to search without polluting the final form element and is much clear and intuitive to the final user.

Additionally, I'll also add the 'clear_button' pluggin even if the select has no 'multiple' attribute so the user can see the cross indicating that the value can be erased.

Maybe you could add extra methods to Relation php class that controls those plugins, allowing the developers to choose which options want to be integrated/showed in the form control.

Additional context

imagen

What do you think @tabuna ?

Hope you can make those changes. Thanks in advance