This commit is contained in:
Andrew Kingston 2023-02-28 14:40:36 +00:00
parent 878ebfb8c5
commit c83286cb61
4 changed files with 3 additions and 8 deletions

View File

@ -62,7 +62,6 @@
}
const getStyle = (col, scrollLeft, rowCount) => {
console.log("stye")
const left = col.left + col.width - (col.idx === 0 ? 0 : scrollLeft)
const contentHeight = (rowCount + 2) * cellHeight
return `--left:${left}px; --content-height:${contentHeight}px;`

View File

@ -11,6 +11,7 @@
$: contentHeight = ($rows.length + 2) * cellHeight
$: contentWidth = computeContentWidth($columns)
$: scrollLeft = $scroll.left
const computeContentWidth = columns => {
if (!columns.length) {
@ -43,7 +44,7 @@
<div
bind:this={ref}
class="sheet-body"
class:horizontally-scrolled={$scroll.left > 0}
class:horizontally-scrolled={scrollLeft > 0}
on:click|self={() => ($selectedCellId = null)}
on:scroll={handleScroll}
>

View File

@ -62,7 +62,6 @@ export const createRowsStore = context => {
if (!loaded) {
// Hydrate initial data
loaded = true
console.log("instantiate new fetch data")
schema.set($$fetch.schema)
primaryDisplay.set($$fetch.definition?.primaryDisplay)
}
@ -179,9 +178,7 @@ export const createRowsStore = context => {
// Loads the next page of data if available
const loadNextPage = () => {
const $fetch = get(fetch)
console.log("fetch next page")
$fetch?.nextPage()
get(fetch)?.nextPage()
}
return {

View File

@ -33,7 +33,6 @@ export const createViewportStores = context => {
const visibleRows = derived(
[rows, scrollTopStore, height],
([$rows, $scrollTop, $height]) => {
console.log("new rows")
const maxRows = Math.ceil($height / cellHeight) + 16
const firstRow = Math.max(0, Math.floor($scrollTop / cellHeight) - 8)
return $rows.slice(firstRow, firstRow + maxRows)
@ -44,7 +43,6 @@ export const createViewportStores = context => {
const visibleColumns = derived(
[columns, scrollLeftStore, width],
([$columns, $scrollLeft, $width]) => {
console.log("new columns")
if (!$columns.length) {
return []
}