mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 18:23:59 +00:00
datagrid
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
class:isModifiedCell
|
class:isModifiedCell
|
||||||
class:isInserted
|
class:isInserted
|
||||||
class:isDeleted
|
class:isDeleted
|
||||||
|
style={`width:${col.width}px; min-width:${col.width}px; max-width:${col.width}px`}
|
||||||
>
|
>
|
||||||
{#if value == null}
|
{#if value == null}
|
||||||
<span class="null">(NULL)</span>
|
<span class="null">(NULL)</span>
|
||||||
|
|||||||
@@ -42,9 +42,9 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// $: console.log('visibleRealColumns', visibleRealColumns);
|
// $: console.log('visibleRealColumns', visibleRealColumns);
|
||||||
$: console.log('visibleRowCountUpperBound', visibleRowCountUpperBound);
|
// $: console.log('visibleRowCountUpperBound', visibleRowCountUpperBound);
|
||||||
$: console.log('rowHeight', rowHeight);
|
// $: console.log('rowHeight', rowHeight);
|
||||||
$: console.log('containerHeight', containerHeight);
|
// $: console.log('containerHeight', containerHeight);
|
||||||
|
|
||||||
$: realColumnUniqueNames = _.range(columnSizes.realCount).map(
|
$: realColumnUniqueNames = _.range(columnSizes.realCount).map(
|
||||||
realIndex => (columns[columnSizes.realToModel(realIndex)] || {}).uniqueName
|
realIndex => (columns[columnSizes.realToModel(realIndex)] || {}).uniqueName
|
||||||
@@ -64,13 +64,19 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="header-cell" data-row="header" data-col="header" bind:clientHeight={rowHeight} />
|
<td
|
||||||
|
class="header-cell"
|
||||||
|
data-row="header"
|
||||||
|
data-col="header"
|
||||||
|
bind:clientHeight={rowHeight}
|
||||||
|
style={`width:${headerColWidth}px; min-width:${headerColWidth}px; max-width:${headerColWidth}px`}
|
||||||
|
/>
|
||||||
{#each visibleRealColumns as col (col.uniqueName)}
|
{#each visibleRealColumns as col (col.uniqueName)}
|
||||||
<td
|
<td
|
||||||
class="header-cell"
|
class="header-cell"
|
||||||
data-row="header"
|
data-row="header"
|
||||||
data-col={col.colIndex}
|
data-col={col.colIndex}
|
||||||
style={`width:${col.widthPx}; min-width:${col.widthPx}; max-width:${col.widthPx}`}
|
style={`width:${col.width}px; min-width:${col.width}px; max-width:${col.width}px`}
|
||||||
>
|
>
|
||||||
<ColumnHeaderControl column={col} {conid} {database} />
|
<ColumnHeaderControl column={col} {conid} {database} />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
const loadStart = new Date().getTime();
|
const loadStart = new Date().getTime();
|
||||||
|
|
||||||
// loadedTimeRef.current = loadStart;
|
// loadedTimeRef.current = loadStart;
|
||||||
|
// console.log('LOAD NEXT ROWS', loadedRows);
|
||||||
|
|
||||||
const nextRows = await loadDataPage($$props, loadedRows.length, 100);
|
const nextRows = await loadDataPage($$props, loadedRows.length, 100);
|
||||||
// if (loadedTimeRef.current !== loadStart) {
|
// if (loadedTimeRef.current !== loadStart) {
|
||||||
@@ -35,7 +36,7 @@
|
|||||||
errorMessage = nextRows.errorMessage;
|
errorMessage = nextRows.errorMessage;
|
||||||
} else {
|
} else {
|
||||||
// if (allRowCount == null) handleLoadRowCount();
|
// if (allRowCount == null) handleLoadRowCount();
|
||||||
loadedRows = [loadedRows, ...nextRows];
|
loadedRows = [...loadedRows, ...nextRows];
|
||||||
isLoadedAll = nextRows.length === 0;
|
isLoadedAll = nextRows.length === 0;
|
||||||
// const loadedInfo = {
|
// const loadedInfo = {
|
||||||
// loadedRows: [...loadedRows, ...nextRows],
|
// loadedRows: [...loadedRows, ...nextRows],
|
||||||
@@ -49,19 +50,21 @@
|
|||||||
// ...loadedInfo,
|
// ...loadedInfo,
|
||||||
// }));
|
// }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log('LOADED', nextRows, loadedRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $: griderProps = { ...$$props, sourceRows: loadProps.loadedRows };
|
// $: griderProps = { ...$$props, sourceRows: loadProps.loadedRows };
|
||||||
// $: grider = griderFactory(griderProps);
|
// $: grider = griderFactory(griderProps);
|
||||||
|
|
||||||
const handleLoadNextData = () => {
|
function handleLoadNextData() {
|
||||||
if (!isLoadedAll && !errorMessage && !grider.disableLoadNextPage) {
|
if (!isLoadedAll && !errorMessage && !grider.disableLoadNextPage) {
|
||||||
if (dataPageAvailable($$props)) {
|
if (dataPageAvailable($$props)) {
|
||||||
// If not, callbacks to load missing metadata are dispatched
|
// If not, callbacks to load missing metadata are dispatched
|
||||||
loadNextData();
|
loadNextData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DataGridCore {...$$props} loadNextData={handleLoadNextData} {grider} />
|
<DataGridCore {...$$props} loadNextData={handleLoadNextData} {grider} />
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
export let config;
|
export let config;
|
||||||
let loadedRows = [];
|
let loadedRows = [];
|
||||||
|
|
||||||
|
// $: console.log('loadedRows BIND', loadedRows);
|
||||||
$: grider = new ChangeSetGrider(loadedRows, null, null, display);
|
$: grider = new ChangeSetGrider(loadedRows, null, null, display);
|
||||||
|
// $: console.log('GRIDER', grider);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<LoadingDataGridCore {...$$props} {loadDataPage} {dataPageAvailable} {loadRowCount} bind:loadedRows {grider} />
|
<LoadingDataGridCore {...$$props} {loadDataPage} {dataPageAvailable} {loadRowCount} bind:loadedRows {grider} />
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export function countVisibleRealColumns(columnSizes, firstVisibleColumnScrollInd
|
|||||||
|
|
||||||
const visibleRealColumnIndexes = [];
|
const visibleRealColumnIndexes = [];
|
||||||
const modelIndexes = {};
|
const modelIndexes = {};
|
||||||
/** @type {(import('dbgate-datalib').DisplayColumn & {widthPx: string; colIndex: number})[]} */
|
/** @type {(import('dbgate-datalib').DisplayColumn & {width: number; colIndex: number})[]} */
|
||||||
const realColumns = [];
|
const realColumns = [];
|
||||||
|
|
||||||
// frozen columns
|
// frozen columns
|
||||||
@@ -112,12 +112,11 @@ export function countVisibleRealColumns(columnSizes, firstVisibleColumnScrollInd
|
|||||||
|
|
||||||
let col = columns[modelColumnIndex];
|
let col = columns[modelColumnIndex];
|
||||||
if (!col) continue;
|
if (!col) continue;
|
||||||
const widthNumber = columnSizes.getSizeByRealIndex(colIndex);
|
const width = columnSizes.getSizeByRealIndex(colIndex);
|
||||||
realColumns.push({
|
realColumns.push({
|
||||||
...col,
|
...col,
|
||||||
colIndex,
|
colIndex,
|
||||||
widthNumber,
|
width,
|
||||||
widthPx: `${widthNumber}px`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return realColumns;
|
return realColumns;
|
||||||
|
|||||||
Reference in New Issue
Block a user