-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement is-draggable feature #135
base: master
Are you sure you want to change the base?
Conversation
Not sure how you feel about another package included in this one, but I am in need of the ability to tag things and then sort them. I implemented the vue-draggable package into this in a lightweight way. |
Hmm, I'm not sure either. I just realized my dist js file is only 14kb and this package is 70kb. How do you mean "in a lightweight way"? |
I just mean that I didn't go into depth of the package trying to implement many of their possible features. It's just the ability to rearrange tags. If you don't want to implement it, I will use my own fork. There might be a way to implement a draggable/sortable feature in your package without adding a 3rd party package to keep the size down and stay in control of the code, but it will be harder and more work. The vue-draggable package already works really well. |
I'd also be interested in this feature but I totally understand the concerns of adding Didn't try it out, but maybe it would be sufficient to allow the user to configure the wrapper element? If it was possible to pass a custom component and objects for props and event listeners which are applied on the wrapper tag? E.g. if <template>
<div class="tags-input-root" style="position: relative;">
<component
:is="wrapperComponent"
v-bind="wrapperProps"
v-on="wrapperEvents"
:class="{
[wrapperClass + ' tags-input']: true,
'active': isActive,
'disabled': disabled,
}">
<!-- removed for brevity -->
</component>
</div>
</template>
<script>
export default {
// Only new props shown:
props: {
wrapperComponent: {
type: [String, Object],
default: 'div'
},
wrapperProps: {
type: Object,
default: {}
},,
wrapperEvents: {
type: Object,
default: {}
},
}
}
</script> If this works as I expect, we could then inject in the draggable component at runtime, we can't pass <template>
<TagsInput
v-model="tags"
:wrapperComponent="$options.draggable"
:wrapperProps="{value: tags, style: '100%'}"
:wrapperEvents="{input: (newList) => tags = newList}"
/>
</template>
<script>
import draggable from "@/vuedraggable";
export default {
data() {
return {
tags: []
}
},
draggable,
}
</script> |
Allows user to turn on draggable sorting of tags.