Merge pull request #2849 from brkcvn/drag

Sortable development for items in Document pages
This commit is contained in:
Cüneyt Şentürk
2022-12-26 09:34:46 +03:00
committed by GitHub
4 changed files with 416 additions and 369 deletions

View File

@ -14,6 +14,7 @@ import Global from './../../mixins/global';
import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action';
import draggable from 'vuedraggable';
// plugin setup
Vue.use(DashboardPlugin);
@ -25,6 +26,10 @@ const app = new Vue({
Global
],
components: {
draggable
},
data: function () {
return {
form: new Form('document'),
@ -77,6 +82,7 @@ const app = new Vue({
],
email_template: false,
send_to: false,
drag: false
}
},
@ -111,6 +117,16 @@ const app = new Vue({
},
methods: {
onEnd() {
this.dragging = false;
},
onUpdate(event) {
let fromIndex = this.form.items.indexOf(this.form.items[event.oldIndex]);
let element = this.form.items.splice(fromIndex, 1)[0];
this.form.items.splice(event.newIndex, 0, element);
},
onRefFocus(ref) {
let index = this.form.items.length - 1;