studierende in die gruppe ziehen ohne vorheriges selektieren

This commit is contained in:
ma0048
2026-02-17 11:16:44 +01:00
parent 827b6148a7
commit 2f51f18447
@@ -128,6 +128,7 @@ export default {
if (row.getData().bnaktiv === false) {
row.getElement().classList.add('text-black','text-opacity-50','fst-italic');
}
row.getElement().draggable = true
},
ajaxRequestFunc: (url, config, params) => {
@@ -179,6 +180,10 @@ export default {
{
event: 'rowClick',
handler: this.handleRowClick // TODO(chris): this should be in the filter component
},
{
event: 'rowMouseDown',
handler: this.handleMouseDown
}
],
focusObj: null, // TODO(chris): this should be in the filter component
@@ -187,7 +192,8 @@ export default {
count: 0,
filteredcount: 0,
selectedcount: 0,
currentEndpoint: null
currentEndpoint: null,
dragSource: []
}
},
computed: {
@@ -203,7 +209,9 @@ export default {
+ ': <strong>' + (this.count || 0) + '</strong>';
},
selectedDragObject() {
return this.selected.map(item => {
let items = this.dragSource?.length ? this.dragSource : this.selected;
return items.map(item => {
let type, id;
if (item.uid) {
type = 'student';
@@ -328,15 +336,6 @@ export default {
this.selectedcount = data.length;
this.lastSelected = this.selected;
this.$emit('update:selected', data);
// set selected elements draggable
const tableEl = this.$refs.table?.$refs?.table;
if (tableEl) {
const oldDragables = tableEl.querySelectorAll('[draggable]');
for (const draggable of oldDragables)
draggable.removeAttribute('draggable');
}
rows.forEach(row => row.getElement().draggable = true);
},
autoSelectRows(data) {
if (this.lastSelected) {
@@ -404,6 +403,7 @@ export default {
this.$refs.table.tabulator.setData(endpoint.url, params, method);
},
dragCleanup(evt) {
this.dragSource = [];
if (evt.dataTransfer.dropEffect == 'none')
return; // aborted or wrong target
@@ -471,7 +471,16 @@ export default {
if (el != this.focusObj)
this.changeFocus(this.focusObj, el);
}
}
},
handleMouseDown(e, row)
{
let data = row.getData();
let id = data.uid ?? data.prestudent_id ?? data.person_id;
const isAlreadySelected = this.selected?.some(row => (row.uid ?? row.prestudent_id ?? row.person_id) === id);
this.dragSource = (isAlreadySelected && this.selected?.length) ? this.selected : [data];
},
},
// TODO(chris): focusin, focusout, keydown and tabindex should be in the filter component
// TODO(chris): filter component column chooser has no accessibilty features