Attract multi edit: Shift + mouse to select all between
and hopefully now command button on Mac works for multiselect.
This commit is contained in:
parent
379f743864
commit
01da240f54
@ -137,15 +137,24 @@ let PillarTable = Vue.component('pillar-table-base', {
|
|||||||
},
|
},
|
||||||
onItemClicked(clickEvent, itemId) {
|
onItemClicked(clickEvent, itemId) {
|
||||||
if(!this.canChangeSelectionCB()) return;
|
if(!this.canChangeSelectionCB()) return;
|
||||||
|
if(this.isMultiToggleClick(clickEvent) && this.canMultiSelect) {
|
||||||
if(this.isMultiSelectClick(clickEvent) && this.canMultiSelect) {
|
|
||||||
let slectedIdsWithoutClicked = this.selectedIds.filter(id => id !== itemId);
|
let slectedIdsWithoutClicked = this.selectedIds.filter(id => id !== itemId);
|
||||||
if (slectedIdsWithoutClicked.length < this.selectedIds.length) {
|
if (slectedIdsWithoutClicked.length < this.selectedIds.length) {
|
||||||
this.selectedIds = slectedIdsWithoutClicked;
|
this.selectedIds = slectedIdsWithoutClicked;
|
||||||
} else {
|
} else {
|
||||||
this.selectedIds = [itemId, ...this.selectedIds];
|
this.selectedIds = [itemId, ...this.selectedIds];
|
||||||
}
|
}
|
||||||
} else {
|
} else if(this.isSelectBetween(clickEvent) && this.canMultiSelect) {
|
||||||
|
if (this.selectedIds.length > 0) {
|
||||||
|
let betweenA = this.selectedIds[this.selectedIds.length -1];
|
||||||
|
let betweenB = itemId;
|
||||||
|
this.selectedIds = this.rowsBetween(betweenA, betweenB).map(it => it.getId());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.selectedIds = [itemId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (this.selectedIds.length === 1 && this.selectedIds[0] === itemId) {
|
if (this.selectedIds.length === 1 && this.selectedIds[0] === itemId) {
|
||||||
this.selectedIds = [];
|
this.selectedIds = [];
|
||||||
} else {
|
} else {
|
||||||
@ -153,9 +162,26 @@ let PillarTable = Vue.component('pillar-table-base', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isMultiSelectClick(clickEvent) {
|
isSelectBetween(clickEvent) {
|
||||||
return clickEvent.ctrlKey;
|
return clickEvent.shiftKey;
|
||||||
},
|
},
|
||||||
|
isMultiToggleClick(clickEvent) {
|
||||||
|
return clickEvent.ctrlKey ||
|
||||||
|
clickEvent.metaKey; // Mac command key
|
||||||
|
},
|
||||||
|
rowsBetween(id1, id2) {
|
||||||
|
let hasFoundFirst = false;
|
||||||
|
let hasFoundLast = false;
|
||||||
|
return this.visibleRowObjects.filter((it) => {
|
||||||
|
if (hasFoundLast) return false;
|
||||||
|
if (!hasFoundFirst) {
|
||||||
|
hasFoundFirst = [id1, id2].includes(it.getId());
|
||||||
|
return hasFoundFirst;
|
||||||
|
}
|
||||||
|
hasFoundLast = [id1, id2].includes(it.getId());
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user