Ensure dynamic row height is properly accounted for

This commit is contained in:
Andrew Kingston 2023-04-17 12:28:34 +01:00
parent 6931436006
commit bed6fe607c
5 changed files with 13 additions and 5 deletions

View File

@ -99,7 +99,7 @@
<div
class="header-cell"
class:open
style="flex: 0 0 {column.width}px"
style="flex: 0 0 {column.width}px;"
bind:this={anchor}
class:disabled={$isReordering || $isResizing}
class:sorted={sortedBy}
@ -110,6 +110,7 @@
on:contextmenu={onContextMenu}
width={column.width}
left={column.left}
defaultHeight
>
<Icon
size="S"

View File

@ -6,6 +6,7 @@
export let selectedUser = null
export let error = null
export let rowIdx
export let defaultHeight = false
$: style = getStyle(width, selectedUser)
@ -24,6 +25,7 @@
class:highlighted
class:focused
class:error
class:default-height={defaultHeight}
class:selected-other={selectedUser != null}
on:focus
on:mousedown
@ -64,6 +66,9 @@
width: 0;
--cell-color: transparent;
}
.cell.default-height {
height: var(--default-row-height);
}
/* Cell border */
.cell.focused:after,

View File

@ -21,7 +21,7 @@
background: var(--background);
border-bottom: var(--cell-border);
position: relative;
height: var(--row-height);
height: var(--default-row-height);
z-index: 1;
}
.row {

View File

@ -58,7 +58,7 @@
class:scrolled={$scrollLeft > 0}
>
<div class="header row">
<SheetCell width={GutterWidth}>
<SheetCell width={GutterWidth} defaultHeight>
<div class="gutter">
<div class="checkbox visible">
{#if $config.allowDeleteRows}

View File

@ -1,7 +1,7 @@
<script>
import { getContext } from "svelte"
import { domDebounce } from "../../../utils/utils"
import { ScrollBarSize } from "../lib/constants"
import { DefaultRowHeight, ScrollBarSize } from "../lib/constants"
const {
scroll,
@ -30,7 +30,9 @@
$: barHeight = Math.max(50, ($height / $contentHeight) * renderHeight)
$: availHeight = renderHeight - barHeight
$: barTop =
ScrollBarSize + $rowHeight + availHeight * ($scrollTop / $maxScrollTop)
ScrollBarSize +
DefaultRowHeight +
availHeight * ($scrollTop / $maxScrollTop)
// Calculate H scrollbar size and offset
$: renderWidth = $screenWidth - 2 * ScrollBarSize