Tidy up
This commit is contained in:
parent
878ebfb8c5
commit
c83286cb61
|
@ -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;`
|
||||
|
|
|
@ -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}
|
||||
>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 []
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue