import "../../../../../themes/vuexy/vendor/libs/sortablejs/sortable.js"


class ListSortable{
    constructor(listItem,config = {}) {
    
    this.list = Sortable.create($(listItem)[0], {
            animation: 150,
            group: 'menuSorting',
            handle: '.drag-handle',
            direction : 'vertical',
            ...config,
          });
    }
    getArray(){
        const list = this.list.toArray()
        return list
    }
    onChange(callback)
    {
        this.list.option('onChange',callback)
    }
    onMove(callback)
    {
        this.list.option('onMove',callback)
    }
    onEnd(callback)
    {
        this.list.option('onEnd',callback)
    }
}





export default ListSortable