mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 06:26:00 +00:00
grid row count shows in status bar
This commit is contained in:
@@ -176,7 +176,7 @@
|
||||
onClick: () => getCurrentDataGrid().openChartFromSelection(),
|
||||
});
|
||||
|
||||
function getRowCountInfo(selectedCells, grider, realColumnUniqueNames, selectedRowData, allRowCount) {
|
||||
function getSelectedCellsInfo(selectedCells, grider, realColumnUniqueNames, selectedRowData) {
|
||||
if (selectedCells.length > 1 && selectedCells.every(x => _.isNumber(x[0]) && _.isNumber(x[1]))) {
|
||||
let sum = _.sumBy(selectedCells, cell => {
|
||||
const row = grider.getRowData(cell[0]);
|
||||
@@ -196,8 +196,7 @@
|
||||
let rowCount = selectedRowData.length;
|
||||
return `Rows: ${rowCount.toLocaleString()}, Count: ${count.toLocaleString()}, Sum:${sum.toLocaleString()}`;
|
||||
}
|
||||
if (allRowCount == null) return 'Loading row count...';
|
||||
return `Rows: ${allRowCount.toLocaleString()}`;
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -249,6 +248,7 @@
|
||||
import CollapseButton from './CollapseButton.svelte';
|
||||
import GenerateSqlFromDataModal from '../modals/GenerateSqlFromDataModal.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import { updateStatuBarInfo } from '../widgets/StatusBar.svelte';
|
||||
|
||||
export let onLoadNextData = undefined;
|
||||
export let grider = undefined;
|
||||
@@ -271,6 +271,8 @@
|
||||
export let isDynamicStructure = false;
|
||||
export let selectedCellsPublished = () => [];
|
||||
export let collapsedLeftColumnStore;
|
||||
export let multipleGridsOnTab = false;
|
||||
export let tabControlHiddenTab = false;
|
||||
// export let generalAllowSave = false;
|
||||
|
||||
export const activator = createActivator('DataGridCore', false);
|
||||
@@ -296,6 +298,8 @@
|
||||
let autofillSelectedCells = emptyCellArray;
|
||||
const domFilterControlsRef = createRef({});
|
||||
|
||||
const tabid = getContext('tabid');
|
||||
|
||||
export function refresh() {
|
||||
display.reload();
|
||||
}
|
||||
@@ -606,6 +610,8 @@
|
||||
columns
|
||||
);
|
||||
|
||||
$: selectedCellsInfo = getSelectedCellsInfo(selectedCells, grider, realColumnUniqueNames, getSelectedRowData());
|
||||
|
||||
// $: console.log('visibleRealColumns', visibleRealColumns);
|
||||
// $: console.log('visibleRowCountUpperBound', visibleRowCountUpperBound);
|
||||
// $: console.log('rowHeight', rowHeight);
|
||||
@@ -1189,6 +1195,16 @@
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
$: {
|
||||
if (!tabControlHiddenTab) {
|
||||
if (!multipleGridsOnTab && allRowCount != null) {
|
||||
updateStatuBarInfo(tabid, [{ text: `Rows: ${allRowCount.toLocaleString()}` }]);
|
||||
} else {
|
||||
updateStatuBarInfo(tabid, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if !display || (!isDynamicStructure && (!columns || columns.length == 0))}
|
||||
@@ -1355,9 +1371,13 @@
|
||||
on:scroll={e => (firstVisibleRowScrollIndex = e.detail)}
|
||||
bind:this={domVerticalScroll}
|
||||
/>
|
||||
{#if allRowCount}
|
||||
{#if selectedCellsInfo}
|
||||
<div class="row-count-label">
|
||||
{getRowCountInfo(selectedCells, grider, realColumnUniqueNames, getSelectedRowData(), allRowCount)}
|
||||
{selectedCellsInfo}
|
||||
</div>
|
||||
{:else if allRowCount != null && multipleGridsOnTab}
|
||||
<div class="row-count-label">
|
||||
Rows: {allRowCount.toLocaleString()}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
{#key jslid}
|
||||
<DataGrid
|
||||
{...$$restProps}
|
||||
{display}
|
||||
{jslid}
|
||||
gridCoreComponent={JslDataGridCore}
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
export let cache;
|
||||
export let setCache;
|
||||
export let multipleGridsOnTab = false;
|
||||
|
||||
$: connection = useConnectionInfo({ conid });
|
||||
$: dbinfo = useDatabaseInfo({ conid, database });
|
||||
@@ -157,6 +158,7 @@
|
||||
onRunMacro={handleRunMacro}
|
||||
macroCondition={macro => macro.type == 'transformValue'}
|
||||
onReferenceSourceChanged={reference ? handleReferenceSourceChanged : null}
|
||||
multipleGridsOnTab={multipleGridsOnTab || !!reference}
|
||||
onReferenceClick={value => {
|
||||
if (value && value.referenceId && reference && reference.referenceId == value.referenceId) {
|
||||
// reference not changed
|
||||
@@ -181,6 +183,7 @@
|
||||
setCache={childCache.update}
|
||||
masterLoadedTime={myLoadedTime}
|
||||
isDetailView
|
||||
multipleGridsOnTab
|
||||
/>
|
||||
{/key}
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="content-container">
|
||||
{#each _.compact(tabs) as tab, index}
|
||||
<div class="container" class:isInline class:tabVisible={index == value}>
|
||||
<svelte:component this={tab.component} {...tab.props} />
|
||||
<svelte:component this={tab.component} {...tab.props} tabControlHiddenTab={index != value} />
|
||||
{#if tab.slot != null}
|
||||
{#if tab.slot == 0}<slot name="0" />
|
||||
{:else if tab.slot == 1}<slot name="1" />
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
>
|
||||
{#each resultInfos as info}
|
||||
<div class="wrapper">
|
||||
<JslDataGrid jslid={info.jslid} />
|
||||
<JslDataGrid jslid={info.jslid} multipleGridsOnTab={resultInfos.length >= 2} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user