mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 11:03:57 +00:00
code cleanup
This commit is contained in:
@@ -76,7 +76,6 @@ export class PerspectiveDisplayRow {
|
|||||||
rowCellSkips: boolean[] = null;
|
rowCellSkips: boolean[] = null;
|
||||||
|
|
||||||
rowJoinIds: number[] = [];
|
rowJoinIds: number[] = [];
|
||||||
// incompleteRowsIndicator: string[] = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PerspectiveDisplay {
|
export class PerspectiveDisplay {
|
||||||
|
|||||||
@@ -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 _, { values } from 'lodash';
|
||||||
import { onMount, tick } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
import resizeObserver from '../utility/resizeObserver';
|
import resizeObserver from '../utility/resizeObserver';
|
||||||
import PerspectiveIntersectionObserver from './PerspectiveIntersectionObserver.svelte';
|
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
import contextMenu from '../utility/contextMenu';
|
import contextMenu from '../utility/contextMenu';
|
||||||
import DataFilterControl from '../datagrid/DataFilterControl.svelte';
|
import DataFilterControl from '../datagrid/DataFilterControl.svelte';
|
||||||
@@ -257,34 +256,15 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{#each display.rows as row}
|
{#each display.rows as row}
|
||||||
<tr>
|
<tr>
|
||||||
{#if row.incompleteRowsIndicator}
|
{#each display.columns as column}
|
||||||
<td colspan={display.columns.length}
|
{#if !row.rowCellSkips[column.columnIndex]}
|
||||||
><PerspectiveIntersectionObserver
|
<PerspectiveCell
|
||||||
rootNode={domWrapper}
|
value={row.rowData[column.columnIndex]}
|
||||||
incompleteRowsIndicator={row.incompleteRowsIndicator}
|
rowSpan={row.rowSpans[column.columnIndex]}
|
||||||
onLoadNext={() => {
|
rowData={row.rowData}
|
||||||
dbg('load next', row.incompleteRowsIndicator);
|
/>
|
||||||
loadedCounts.update(counts => {
|
{/if}
|
||||||
const res = { ...counts };
|
{/each}
|
||||||
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}
|
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user