From 6d0271ae9746694d849cf0ed0cb2418bcf6edeb3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 22 Jun 2023 08:26:14 +0100 Subject: [PATCH] Prevent adding rows when no columns are rendered --- .../src/components/grid/layout/NewRow.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/frontend-core/src/components/grid/layout/NewRow.svelte b/packages/frontend-core/src/components/grid/layout/NewRow.svelte index d986f61f92..60945bdae2 100644 --- a/packages/frontend-core/src/components/grid/layout/NewRow.svelte +++ b/packages/frontend-core/src/components/grid/layout/NewRow.svelte @@ -27,6 +27,7 @@ rowVerticalInversionIndex, columnHorizontalInversionIndex, selectedRows, + config, } = getContext("grid") let visible = false @@ -77,7 +78,7 @@ } const startAdding = async () => { - if (visible) { + if (visible || !$renderedColumns.length) { return } @@ -131,9 +132,6 @@ e.preventDefault() clear() } - } else if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { - e.preventDefault() - addRow() } } @@ -144,7 +142,7 @@ -{#if !visible && !selectedRowCount} +{#if !visible && !selectedRowCount && $config.allowAddRows && $renderedColumns.length}
dispatch("add-row-inline")}