1
0
Fork 0
mirror of synced 2024-09-17 01:38:40 +12:00

Prevent deleting autocolumns via keyboard

This commit is contained in:
Andrew Kingston 2023-03-14 12:06:33 +00:00
parent 43edf37f74
commit d25128d45a
2 changed files with 8 additions and 2 deletions

View file

@ -112,6 +112,9 @@
if (!$selectedCellId) { if (!$selectedCellId) {
return return
} }
if ($selectedCellAPI?.isReadonly()) {
return
}
const [rowId, column] = $selectedCellId.split("-") const [rowId, column] = $selectedCellId.split("-")
rows.actions.updateRow(rowId, column, null) rows.actions.updateRow(rowId, column, null)
}, 100) }, 100)

View file

@ -20,7 +20,10 @@
$: { $: {
if (selected) { if (selected) {
selectedCellAPI.set(api) selectedCellAPI.set({
...api,
isReadonly: () => !!column.schema.autocolumn,
})
} }
} }
</script> </script>
@ -46,4 +49,4 @@
onChange={val => rows.actions.updateRow(row._id, column.name, val)} onChange={val => rows.actions.updateRow(row._id, column.name, val)}
readonly={column.schema.autocolumn} readonly={column.schema.autocolumn}
/> />
</SheetCell> </SheetCell>