Clean up
This commit is contained in:
parent
1c702d5f07
commit
e48e2ff7f0
|
@ -118,7 +118,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SheetScrollWrapper scrollHorizontally wheelInteractive foo>
|
<SheetScrollWrapper scrollHorizontally wheelInteractive>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{#each $visibleColumns as column}
|
{#each $visibleColumns as column}
|
||||||
{@const cellId = `new-${column.name}`}
|
{@const cellId = `new-${column.name}`}
|
||||||
|
|
|
@ -10,12 +10,10 @@
|
||||||
focusedCellId,
|
focusedCellId,
|
||||||
reorder,
|
reorder,
|
||||||
selectedRows,
|
selectedRows,
|
||||||
visibleColumns,
|
|
||||||
renderedColumns,
|
renderedColumns,
|
||||||
hoveredRowId,
|
hoveredRowId,
|
||||||
selectedCellMap,
|
selectedCellMap,
|
||||||
focusedRow,
|
focusedRow,
|
||||||
hiddenColumnsWidth,
|
|
||||||
columnHorizontalInversionIndex,
|
columnHorizontalInversionIndex,
|
||||||
} = getContext("sheet")
|
} = getContext("sheet")
|
||||||
|
|
||||||
|
@ -23,8 +21,6 @@
|
||||||
$: rowHovered = $hoveredRowId === row._id
|
$: rowHovered = $hoveredRowId === row._id
|
||||||
$: rowFocused = $focusedRow?._id === row._id
|
$: rowFocused = $focusedRow?._id === row._id
|
||||||
$: reorderSource = $reorder.sourceColumn
|
$: reorderSource = $reorder.sourceColumn
|
||||||
$: cols = rowFocused ? $visibleColumns : $renderedColumns
|
|
||||||
$: foo = `margin-left: ${-1 * $hiddenColumnsWidth}px;`
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -17,19 +17,12 @@
|
||||||
export let scrollVertically = false
|
export let scrollVertically = false
|
||||||
export let scrollHorizontally = false
|
export let scrollHorizontally = false
|
||||||
export let wheelInteractive = false
|
export let wheelInteractive = false
|
||||||
export let foo = false
|
|
||||||
|
|
||||||
$: style = generateStyle($scroll, $rowHeight, $hiddenColumnsWidth, foo)
|
$: style = generateStyle($scroll, $rowHeight, $hiddenColumnsWidth)
|
||||||
|
|
||||||
const generateStyle = (scroll, rowHeight, hiddenWidths, foo) => {
|
const generateStyle = (scroll, rowHeight, hiddenWidths) => {
|
||||||
let offsetX, offsetY
|
const offsetX = scrollHorizontally ? -1 * scroll.left + hiddenWidths : 0
|
||||||
if (!foo) {
|
const offsetY = scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
||||||
offsetX = scrollHorizontally ? -1 * scroll.left + hiddenWidths : 0
|
|
||||||
offsetY = scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
|
||||||
} else {
|
|
||||||
offsetX = scrollHorizontally ? -1 * scroll.left : 0
|
|
||||||
offsetY = scrollVertically ? -1 * scroll.top : 0
|
|
||||||
}
|
|
||||||
return `transform: translate3d(${offsetX}px, ${offsetY}px, 0);`
|
return `transform: translate3d(${offsetX}px, ${offsetY}px, 0);`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue