Browse Source

fix: clear selection if add row cancelled

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6004/head
mertmit 1 year ago
parent
commit
c2906b6222
  1. 15
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 2
      packages/nc-gui/composables/useViewData.ts

15
packages/nc-gui/components/smartsheet/Grid.vue

@ -942,6 +942,19 @@ const refreshFillHandle = () => {
}
}
const addRowExpandOnClose = (row: Row) => {
if (!skipRowRemovalOnCancel.value) {
const removed = removeRowIfNew(row)
if (removed) {
clearSelectedRange()
activeCell.row = null
activeCell.col = null
}
}
}
watch(
[() => selectedRange.end.row, () => selectedRange.end.col, () => activeCell.row, () => activeCell.col],
([sr, sc, ar, ac], [osr, osc, oar, oac]) => {
@ -1311,7 +1324,7 @@ useEventListener(document, 'mouseup', () => {
:state="expandedFormRowState"
:meta="meta"
:view="view"
@update:model-value="!skipRowRemovalOnCancel && removeRowIfNew(expandedFormRow)"
@update:model-value="addRowExpandOnClose(expandedFormRow)"
/>
</Suspense>

2
packages/nc-gui/composables/useViewData.ts

@ -938,7 +938,9 @@ export function useViewData(
if (index > -1 && row.rowMeta.new) {
formattedData.value.splice(index, 1)
return true
}
return false
}
// get current expanded row index

Loading…
Cancel
Save