Prevent adding rows when no columns are rendered

This commit is contained in:
Andrew Kingston 2023-06-22 08:26:14 +01:00
parent 50c807e60c
commit 6d0271ae97
1 changed files with 3 additions and 5 deletions

View File

@ -27,6 +27,7 @@
rowVerticalInversionIndex, rowVerticalInversionIndex,
columnHorizontalInversionIndex, columnHorizontalInversionIndex,
selectedRows, selectedRows,
config,
} = getContext("grid") } = getContext("grid")
let visible = false let visible = false
@ -77,7 +78,7 @@
} }
const startAdding = async () => { const startAdding = async () => {
if (visible) { if (visible || !$renderedColumns.length) {
return return
} }
@ -131,9 +132,6 @@
e.preventDefault() e.preventDefault()
clear() clear()
} }
} else if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
e.preventDefault()
addRow()
} }
} }
@ -144,7 +142,7 @@
</script> </script>
<!-- New row FAB --> <!-- New row FAB -->
{#if !visible && !selectedRowCount} {#if !visible && !selectedRowCount && $config.allowAddRows && $renderedColumns.length}
<div <div
class="new-row-fab" class="new-row-fab"
on:click={() => dispatch("add-row-inline")} on:click={() => dispatch("add-row-inline")}