Tidy up
This commit is contained in:
parent
878ebfb8c5
commit
c83286cb61
|
@ -62,7 +62,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStyle = (col, scrollLeft, rowCount) => {
|
const getStyle = (col, scrollLeft, rowCount) => {
|
||||||
console.log("stye")
|
|
||||||
const left = col.left + col.width - (col.idx === 0 ? 0 : scrollLeft)
|
const left = col.left + col.width - (col.idx === 0 ? 0 : scrollLeft)
|
||||||
const contentHeight = (rowCount + 2) * cellHeight
|
const contentHeight = (rowCount + 2) * cellHeight
|
||||||
return `--left:${left}px; --content-height:${contentHeight}px;`
|
return `--left:${left}px; --content-height:${contentHeight}px;`
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
$: contentHeight = ($rows.length + 2) * cellHeight
|
$: contentHeight = ($rows.length + 2) * cellHeight
|
||||||
$: contentWidth = computeContentWidth($columns)
|
$: contentWidth = computeContentWidth($columns)
|
||||||
|
$: scrollLeft = $scroll.left
|
||||||
|
|
||||||
const computeContentWidth = columns => {
|
const computeContentWidth = columns => {
|
||||||
if (!columns.length) {
|
if (!columns.length) {
|
||||||
|
@ -43,7 +44,7 @@
|
||||||
<div
|
<div
|
||||||
bind:this={ref}
|
bind:this={ref}
|
||||||
class="sheet-body"
|
class="sheet-body"
|
||||||
class:horizontally-scrolled={$scroll.left > 0}
|
class:horizontally-scrolled={scrollLeft > 0}
|
||||||
on:click|self={() => ($selectedCellId = null)}
|
on:click|self={() => ($selectedCellId = null)}
|
||||||
on:scroll={handleScroll}
|
on:scroll={handleScroll}
|
||||||
>
|
>
|
||||||
|
|
|
@ -62,7 +62,6 @@ export const createRowsStore = context => {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
// Hydrate initial data
|
// Hydrate initial data
|
||||||
loaded = true
|
loaded = true
|
||||||
console.log("instantiate new fetch data")
|
|
||||||
schema.set($$fetch.schema)
|
schema.set($$fetch.schema)
|
||||||
primaryDisplay.set($$fetch.definition?.primaryDisplay)
|
primaryDisplay.set($$fetch.definition?.primaryDisplay)
|
||||||
}
|
}
|
||||||
|
@ -179,9 +178,7 @@ export const createRowsStore = context => {
|
||||||
|
|
||||||
// Loads the next page of data if available
|
// Loads the next page of data if available
|
||||||
const loadNextPage = () => {
|
const loadNextPage = () => {
|
||||||
const $fetch = get(fetch)
|
get(fetch)?.nextPage()
|
||||||
console.log("fetch next page")
|
|
||||||
$fetch?.nextPage()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -33,7 +33,6 @@ export const createViewportStores = context => {
|
||||||
const visibleRows = derived(
|
const visibleRows = derived(
|
||||||
[rows, scrollTopStore, height],
|
[rows, scrollTopStore, height],
|
||||||
([$rows, $scrollTop, $height]) => {
|
([$rows, $scrollTop, $height]) => {
|
||||||
console.log("new rows")
|
|
||||||
const maxRows = Math.ceil($height / cellHeight) + 16
|
const maxRows = Math.ceil($height / cellHeight) + 16
|
||||||
const firstRow = Math.max(0, Math.floor($scrollTop / cellHeight) - 8)
|
const firstRow = Math.max(0, Math.floor($scrollTop / cellHeight) - 8)
|
||||||
return $rows.slice(firstRow, firstRow + maxRows)
|
return $rows.slice(firstRow, firstRow + maxRows)
|
||||||
|
@ -44,7 +43,6 @@ export const createViewportStores = context => {
|
||||||
const visibleColumns = derived(
|
const visibleColumns = derived(
|
||||||
[columns, scrollLeftStore, width],
|
[columns, scrollLeftStore, width],
|
||||||
([$columns, $scrollLeft, $width]) => {
|
([$columns, $scrollLeft, $width]) => {
|
||||||
console.log("new columns")
|
|
||||||
if (!$columns.length) {
|
if (!$columns.length) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue