Fix row hover state not being removed

This commit is contained in:
Andrew Kingston 2023-03-01 20:01:00 +00:00
parent 36f7d24d42
commit 15c07e13ac
4 changed files with 14 additions and 5 deletions

View File

@ -15,7 +15,11 @@
}
</script>
<div class="row" on:mouseover={() => ($hoveredRowId = "new")}>
<div
class="row"
on:mouseover={() => ($hoveredRowId = "new")}
on:mouseleave={() => ($hoveredRowId = null)}
>
{#each $visibleColumns as column}
<SheetCell
{rowHovered}
@ -30,6 +34,7 @@
<style>
.row {
width: 0;
display: flex;
}
.row:hover :global(.cell) {

View File

@ -2,7 +2,7 @@
import { getContext, onMount } from "svelte"
import SheetScrollWrapper from "./SheetScrollWrapper.svelte"
const { selectedCellId, hoveredRowId, bounds } = getContext("spreadsheet")
const { selectedCellId, bounds } = getContext("spreadsheet")
let ref
@ -22,7 +22,6 @@
bind:this={ref}
class="sheet-body"
on:click|self={() => ($selectedCellId = null)}
on:mouseleave={() => ($hoveredRowId = null)}
>
<SheetScrollWrapper>
<slot />

View File

@ -18,7 +18,11 @@
$: rowHovered = $hoveredRowId === row._id
</script>
<div class="row" on:mouseover={() => ($hoveredRowId = row._id)}>
<div
class="row"
on:mouseover={() => ($hoveredRowId = row._id)}
on:mouseleave={() => ($hoveredRowId = null)}
>
{#each $visibleColumns as column (column.name)}
{@const cellIdx = `${row._id}-${column.name}`}
<SheetCell
@ -45,6 +49,7 @@
<style>
.row {
width: 0;
display: flex;
}
</style>

View File

@ -155,7 +155,7 @@
flex: 0 0 var(--width);
z-index: 20;
overflow: visible;
border-right: 1px solid var(--spectrum-global-color-gray-200);
border-right: var(--cell-border);
}
.sticky-column.scrolled {
box-shadow: 1px -4px 8px rgba(0, 0, 0, 0.1);