mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 14:46:01 +00:00
code cleanup
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
export let rootNode;
|
||||
export let onLoadNext;
|
||||
export let incompleteRowsIndicator;
|
||||
|
||||
let domObserved;
|
||||
|
||||
function handleObserver(entries) {
|
||||
// // console.log('HANDLE OBSERVER', loadedRows.length);
|
||||
// if (isLoading || loadedRows.length == 0) return;
|
||||
// loadNextData();
|
||||
const [entry] = entries;
|
||||
|
||||
if (entry.isIntersecting) {
|
||||
onLoadNext();
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const observer = new IntersectionObserver(handleObserver, {
|
||||
root: rootNode,
|
||||
rootMargin: '100px',
|
||||
threshold: 0.1,
|
||||
});
|
||||
observer.observe(domObserved);
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<div bind:this={domObserved} on:click={onLoadNext}>... data to be loaded {incompleteRowsIndicator.join(',')}</div>
|
||||
@@ -16,7 +16,6 @@
|
||||
import _, { values } from 'lodash';
|
||||
import { onMount, tick } from 'svelte';
|
||||
import resizeObserver from '../utility/resizeObserver';
|
||||
import PerspectiveIntersectionObserver from './PerspectiveIntersectionObserver.svelte';
|
||||
import debug from 'debug';
|
||||
import contextMenu from '../utility/contextMenu';
|
||||
import DataFilterControl from '../datagrid/DataFilterControl.svelte';
|
||||
@@ -257,34 +256,15 @@
|
||||
<tbody>
|
||||
{#each display.rows as row}
|
||||
<tr>
|
||||
{#if row.incompleteRowsIndicator}
|
||||
<td colspan={display.columns.length}
|
||||
><PerspectiveIntersectionObserver
|
||||
rootNode={domWrapper}
|
||||
incompleteRowsIndicator={row.incompleteRowsIndicator}
|
||||
onLoadNext={() => {
|
||||
dbg('load next', row.incompleteRowsIndicator);
|
||||
loadedCounts.update(counts => {
|
||||
const res = { ...counts };
|
||||
for (const id of row.incompleteRowsIndicator) {
|
||||
res[id] = (res[id] || PERSPECTIVE_PAGE_SIZE) + PERSPECTIVE_PAGE_SIZE;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
}}
|
||||
/></td
|
||||
>
|
||||
{:else}
|
||||
{#each display.columns as column}
|
||||
{#if !row.rowCellSkips[column.columnIndex]}
|
||||
<PerspectiveCell
|
||||
value={row.rowData[column.columnIndex]}
|
||||
rowSpan={row.rowSpans[column.columnIndex]}
|
||||
rowData={row.rowData}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#each display.columns as column}
|
||||
{#if !row.rowCellSkips[column.columnIndex]}
|
||||
<PerspectiveCell
|
||||
value={row.rowData[column.columnIndex]}
|
||||
rowSpan={row.rowSpans[column.columnIndex]}
|
||||
rowData={row.rowData}
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user