tusen-ai / naive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
https://www.naiveui.com
MIT License
16.08k stars 1.67k forks source link

ability to re-order selected tags inside select multiple #501

Closed wc-matteo closed 3 years ago

wc-matteo commented 3 years ago

This function solves the problem (这个功能解决的问题)

for example, being able to define which of the selected value is the main one (you would make it the first)

Expected API (期望的 API)

maybe add a prop like sortable-values?

Volankey commented 3 years ago

I think there are few usage scenarios for this. @07akioni

07akioni commented 3 years ago

@wc-matteo I think set value to sorted value in on-update:value callback is enough.

wc-matteo commented 3 years ago

but how can you sort them?

wc-matteo commented 3 years ago

I was thinking by drag n drop

07akioni commented 3 years ago

I was thinking by drag n drop

Implement drag and drop inside select will take tons of code (and it's not useful).

07akioni commented 3 years ago

but how can you sort them?

<n-select :value="value" @update:value="v => this.value = Array.from(v).sort()" />
wc-matteo commented 3 years ago

I was thinking by drag n drop

Implement drag and drop inside select will take tons of code (and it's not useful).

image

I mean there. Not in the list

wc-matteo commented 3 years ago

the use case is, for example, to select a primary value (so you would put it first)

07akioni commented 3 years ago

I was thinking by drag n drop

Implement drag and drop inside select will take tons of code (and it's not useful).

image

I mean there. Not in the list

I mean here too, the order follows the value of the select, so you can order them everytime the value changes.

wc-matteo commented 3 years ago

I mean let the user decide the order tho .-.

07akioni commented 3 years ago

I mean let the user decide the order tho .-.

This can be done by add dnd listeners to tag by render-tag. Since select has many composition of props and we expect everyone should work, for example filterable, we can't implement the feature with no conflict with other props in a reasonable time.

wc-matteo commented 3 years ago

fair enough!