Refactor
parent
1ff31531e9
commit
208aaba527
|
@ -621,7 +621,6 @@ export default {
|
||||||
onRowClick(e) {
|
onRowClick(e) {
|
||||||
const event = e.originalEvent;
|
const event = e.originalEvent;
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
const rowIndex = event.index;
|
|
||||||
const targetNode = target.nodeName;
|
const targetNode = target.nodeName;
|
||||||
const parentNode = target.parentElement && target.parentElement.nodeName;
|
const parentNode = target.parentElement && target.parentElement.nodeName;
|
||||||
|
|
||||||
|
@ -661,7 +660,7 @@ export default {
|
||||||
this.$emit('update:selection', _selection);
|
this.$emit('update:selection', _selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(this.isSingleSelectionMode()) {
|
if(this.isSingleSelectionMode()) {
|
||||||
|
@ -673,18 +672,18 @@ export default {
|
||||||
this.$emit('update:selection', _selection);
|
this.$emit('update:selection', _selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('row-select', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-select', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.selectionMode === 'single') {
|
if (this.selectionMode === 'single') {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
this.$emit('update:selection', null);
|
this.$emit('update:selection', null);
|
||||||
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.$emit('update:selection', rowData);
|
this.$emit('update:selection', rowData);
|
||||||
this.$emit('row-select', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-select', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.selectionMode === 'multiple') {
|
else if (this.selectionMode === 'multiple') {
|
||||||
|
@ -692,12 +691,12 @@ export default {
|
||||||
const selectionIndex = this.findIndexInSelection(rowData);
|
const selectionIndex = this.findIndexInSelection(rowData);
|
||||||
const _selection = this.selection.filter((val, i) => i != selectionIndex);
|
const _selection = this.selection.filter((val, i) => i != selectionIndex);
|
||||||
this.$emit('update:selection', _selection);
|
this.$emit('update:selection', _selection);
|
||||||
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-unselect', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const _selection = this.selection ? [...this.selection, rowData] : [rowData];
|
const _selection = this.selection ? [...this.selection, rowData] : [rowData];
|
||||||
this.$emit('update:selection', _selection);
|
this.$emit('update:selection', _selection);
|
||||||
this.$emit('row-select', {originalEvent: event, data: rowData, index: rowIndex, type: 'row'});
|
this.$emit('row-select', {originalEvent: event, data: rowData, index: event.index, type: 'row'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue