diff --git a/packages/frontend-core/src/components/grid/layout/NewRow.svelte b/packages/frontend-core/src/components/grid/layout/NewRow.svelte index da5e557a58..0729e032ec 100644 --- a/packages/frontend-core/src/components/grid/layout/NewRow.svelte +++ b/packages/frontend-core/src/components/grid/layout/NewRow.svelte @@ -23,16 +23,25 @@ rowHeight, hasNextPage, maxScrollTop, + rowVerticalInversionIndex, + columnHorizontalInversionIndex, } = getContext("grid") let isAdding = false let newRow = {} let offset = 0 - $: minimumDesiredRenderHeight = $rowHeight + 96 $: firstColumn = $stickyColumn || $renderedColumns[0] $: width = GutterWidth + ($stickyColumn?.width || 0) $: $tableId, (isAdding = false) + $: invertY = shouldInvertY(offset, $rowVerticalInversionIndex, $renderedRows) + + const shouldInvertY = (offset, inversionIndex, rows) => { + if (offset === 0) { + return false + } + return rows.length >= inversionIndex + } const addRow = async () => { // Blur the active cell and tick to let final value updates propagate @@ -82,13 +91,16 @@ $renderedRows.length * $rowHeight - ($maxScrollTop % $rowHeight) - 1 } - document.addEventListener("keydown", handleKeyPress) + // Update state and select initial cell newRow = {} isAdding = true $hoveredRowId = NewRowID if (firstColumn) { $focusedCellId = `${NewRowID}-${firstColumn.name}` } + + // Attach key listener + document.addEventListener("keydown", handleKeyPress) } const updateValue = (rowId, columnName, val) => { @@ -127,24 +139,16 @@