|
|
@ -304,6 +304,8 @@ export function useMultiSelect( |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey |
|
|
|
|
|
|
|
|
|
|
|
/** on tab key press navigate through cells */ |
|
|
|
/** on tab key press navigate through cells */ |
|
|
|
switch (e.key) { |
|
|
|
switch (e.key) { |
|
|
|
case 'Tab': |
|
|
|
case 'Tab': |
|
|
@ -355,11 +357,18 @@ export function useMultiSelect( |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
|
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
if ((selectedRange._end?.col || activeCell.col) < unref(columnLength) - 1) { |
|
|
|
if (cmdOrCtrl) { |
|
|
|
|
|
|
|
editEnabled.value = false |
|
|
|
|
|
|
|
selectedRange.endRange({ |
|
|
|
|
|
|
|
row: selectedRange._end?.row ?? activeCell.row, |
|
|
|
|
|
|
|
col: unref(columnLength) - 1, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
|
|
|
|
} else if ((selectedRange._end?.col ?? activeCell.col) < unref(columnLength) - 1) { |
|
|
|
editEnabled.value = false |
|
|
|
editEnabled.value = false |
|
|
|
selectedRange.endRange({ |
|
|
|
selectedRange.endRange({ |
|
|
|
row: selectedRange._end?.row || activeCell.row, |
|
|
|
row: selectedRange._end?.row ?? activeCell.row, |
|
|
|
col: (selectedRange._end?.col || activeCell.col) + 1, |
|
|
|
col: (selectedRange._end?.col ?? activeCell.col) + 1, |
|
|
|
}) |
|
|
|
}) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
} |
|
|
|
} |
|
|
@ -378,11 +387,18 @@ export function useMultiSelect( |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
|
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
if ((selectedRange._end?.col || activeCell.col) > 0) { |
|
|
|
if (cmdOrCtrl) { |
|
|
|
|
|
|
|
editEnabled.value = false |
|
|
|
|
|
|
|
selectedRange.endRange({ |
|
|
|
|
|
|
|
row: selectedRange._end?.row ?? activeCell.row, |
|
|
|
|
|
|
|
col: 0, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
|
|
|
|
} else if ((selectedRange._end?.col ?? activeCell.col) > 0) { |
|
|
|
editEnabled.value = false |
|
|
|
editEnabled.value = false |
|
|
|
selectedRange.endRange({ |
|
|
|
selectedRange.endRange({ |
|
|
|
row: selectedRange._end?.row || activeCell.row, |
|
|
|
row: selectedRange._end?.row ?? activeCell.row, |
|
|
|
col: (selectedRange._end?.col || activeCell.col) - 1, |
|
|
|
col: (selectedRange._end?.col ?? activeCell.col) - 1, |
|
|
|
}) |
|
|
|
}) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
} |
|
|
|
} |
|
|
@ -401,11 +417,20 @@ export function useMultiSelect( |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
|
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
if ((selectedRange._end?.row || activeCell.row) > 0) { |
|
|
|
if (cmdOrCtrl) { |
|
|
|
editEnabled.value = false |
|
|
|
editEnabled.value = false |
|
|
|
|
|
|
|
console.log(selectedRange._end?.col) |
|
|
|
selectedRange.endRange({ |
|
|
|
selectedRange.endRange({ |
|
|
|
row: (selectedRange._end?.row || activeCell.row) - 1, |
|
|
|
row: 0, |
|
|
|
col: selectedRange._end?.col || activeCell.col, |
|
|
|
col: selectedRange._end?.col ?? activeCell.col, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
console.log(selectedRange._end?.col) |
|
|
|
|
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
|
|
|
|
} else if ((selectedRange._end?.row ?? activeCell.row) > 0) { |
|
|
|
|
|
|
|
editEnabled.value = false |
|
|
|
|
|
|
|
selectedRange.endRange({ |
|
|
|
|
|
|
|
row: (selectedRange._end?.row ?? activeCell.row) - 1, |
|
|
|
|
|
|
|
col: selectedRange._end?.col ?? activeCell.col, |
|
|
|
}) |
|
|
|
}) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
} |
|
|
|
} |
|
|
@ -424,11 +449,18 @@ export function useMultiSelect( |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
|
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
if ((selectedRange._end?.row || activeCell.row) < unref(data).length - 1) { |
|
|
|
if (cmdOrCtrl) { |
|
|
|
|
|
|
|
editEnabled.value = false |
|
|
|
|
|
|
|
selectedRange.endRange({ |
|
|
|
|
|
|
|
row: unref(data).length - 1, |
|
|
|
|
|
|
|
col: selectedRange._end?.col ?? activeCell.col, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
|
|
|
|
} else if ((selectedRange._end?.row ?? activeCell.row) < unref(data).length - 1) { |
|
|
|
editEnabled.value = false |
|
|
|
editEnabled.value = false |
|
|
|
selectedRange.endRange({ |
|
|
|
selectedRange.endRange({ |
|
|
|
row: (selectedRange._end?.row || activeCell.row) + 1, |
|
|
|
row: (selectedRange._end?.row ?? activeCell.row) + 1, |
|
|
|
col: selectedRange._end?.col || activeCell.col, |
|
|
|
col: selectedRange._end?.col ?? activeCell.col, |
|
|
|
}) |
|
|
|
}) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
scrollToCell?.(selectedRange._end?.row, selectedRange._end?.col) |
|
|
|
} |
|
|
|
} |
|
|
@ -461,7 +493,7 @@ export function useMultiSelect( |
|
|
|
// select all - ctrl/cmd +a
|
|
|
|
// select all - ctrl/cmd +a
|
|
|
|
case 65: |
|
|
|
case 65: |
|
|
|
selectedRange.startRange({ row: 0, col: 0 }) |
|
|
|
selectedRange.startRange({ row: 0, col: 0 }) |
|
|
|
selectedRange.endRange({ row: unref(data).length - 1, col: unref(fields).length - 1 }) |
|
|
|
selectedRange.endRange({ row: unref(data).length - 1, col: unref(columnLength) - 1 }) |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|