praella-agency / polaris-vue

Polaris Vue by HulkApps is a component library for Vue.js based on Shopify Polaris style guide.
https://polaris-vue.hulkapps.com
MIT License
37 stars 10 forks source link

Multi Select valueField #98

Closed armandsdz closed 2 years ago

armandsdz commented 2 years ago

It says that for "Multi Select" component field "valueField" is this: Field name in the options array that should be used for the value

Despite this property being set, the value that is being returned, is full item object. I.e. in case of these options: [{label:'Label1',value:'value1'},{label:'Label2',value:'value2'}] When an item is selected it returns {label:'Label1',value:'value1'} instead if 'value1"

Am I missing something or is this as intended?

I would expect it to work similar to single Select component which returns value only.

Thanks!

uttam-praella commented 2 years ago

@armandsdz Yes this is intentional actually, we are using valueField to keep track of selected options, we can take it as suggestion and provide support for such feature to return only value instead of object with some additional prop. Right now, we are returning whole object as there can be some additional key values which can be needful for rendering purpose.

armandsdz commented 2 years ago

Ah, I see Yes, a feature like that would be useful! That would make it easier to switch between use of Simple Select and Multi Select components. For example, in cases where after some time you realise that you want the dropdown to be searchable. Also would be easier to use v-model on Multi Select if it's only a single value that circulates as in Single Select instead of whole object. Thanks!

uttam-praella commented 2 years ago

Sure, tagging this as a mini feature, we will involve it in our next release which is supporting Vue 3 :) We are close to get it done, so we will release it soon.

Thank you.