feat(desktop): add pinned auto-show table info panel
This commit is contained in:
14 files changed
+104
No files matched your search
@@ -47,6 +47,7 @@ import {
|
||||
Eraser,
|
||||
Columns3,
|
||||
PencilRuler,
|
||||
Pin,
|
||||
Settings2,
|
||||
WandSparkles,
|
||||
Camera,
|
||||
@@ -493,6 +494,7 @@ interface DataGridProps {
|
||||
primaryKeys: string[];
|
||||
};
|
||||
tableInfoTab?: TableInfoTab;
|
||||
autoShowTableInfo?: boolean;
|
||||
pageOffset?: number;
|
||||
pageLimit?: number;
|
||||
countSql?: string;
|
||||
@@ -11005,6 +11007,8 @@ function clampCellDetailPanelSize(value: number, layout = cellDetailPanelLayout.
|
||||
// module-global leaks the drawer into other kept-alive tabs.
|
||||
const showTableInfo = ref(false);
|
||||
const activeTableInfoTab = ref<TableInfoTab>(settingsStore.editorSettings.tableInfoActiveTab);
|
||||
const canPinTableInfo = computed(() => props.context === "table-data");
|
||||
const tableInfoDrawerPinned = computed(() => settingsStore.editorSettings.tableInfoDrawerPinned);
|
||||
const ddlContent = ref("");
|
||||
const tableInfoColumns = ref<ColumnInfo[]>(props.tableMeta?.columns ?? []);
|
||||
const tableInfoColumnsLoading = ref(false);
|
||||
@@ -11337,6 +11341,10 @@ async function toggleTableInfo(tab?: TableInfoTab) {
|
||||
await selectTableInfoTab(nextTab);
|
||||
}
|
||||
|
||||
function toggleTableInfoDrawerPinned() {
|
||||
settingsStore.updateEditorSettings({ tableInfoDrawerPinned: !tableInfoDrawerPinned.value });
|
||||
}
|
||||
|
||||
async function selectTableInfoTab(tab: TableInfoTab) {
|
||||
const tabSupported = tableInfoTabs.value.some((item) => item.id === tab);
|
||||
const nextTab = tabSupported ? tab : tableInfoTabs.value[0]?.id;
|
||||
@@ -11358,6 +11366,16 @@ watch(
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.autoShowTableInfo,
|
||||
(shouldShow) => {
|
||||
if (!shouldShow || !props.tableMeta) return;
|
||||
showTableInfo.value = true;
|
||||
void selectTableInfoTab(activeTableInfoTab.value);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
async function fetchDdl(force = settingsStore.editorSettings.refreshDdlOnOpen) {
|
||||
if (!props.connectionId || !props.tableMeta) return;
|
||||
showTableInfo.value = true;
|
||||
@@ -11648,6 +11666,7 @@ watch(
|
||||
if (showIndexIndicatorsInHeader.value && canShowTableIndexes.value && currentIndexTableIdentity.value) {
|
||||
void fetchIndexes();
|
||||
}
|
||||
if (props.autoShowTableInfo && props.tableMeta) showTableInfo.value = true;
|
||||
if (showTableInfo.value) selectTableInfoTab(activeTableInfoTab.value);
|
||||
if (showTableInfo.value) void fetchTableOwner();
|
||||
},
|
||||
@@ -14320,6 +14339,19 @@ function openGridSnapshot() {
|
||||
<PencilRuler class="w-3 h-3" />
|
||||
<span class="table-info-action-label">{{ t("contextMenu.editStructure") }}</span>
|
||||
</Button>
|
||||
<Button
|
||||
v-if="canPinTableInfo"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-5 w-5"
|
||||
:class="{ 'bg-accent text-primary': tableInfoDrawerPinned }"
|
||||
:title="tableInfoDrawerPinned ? t('grid.unpinTableInfo') : t('grid.pinTableInfo')"
|
||||
:aria-label="tableInfoDrawerPinned ? t('grid.unpinTableInfo') : t('grid.pinTableInfo')"
|
||||
:aria-pressed="tableInfoDrawerPinned"
|
||||
@click="toggleTableInfoDrawerPinned"
|
||||
>
|
||||
<Pin class="w-3 h-3" :class="{ 'fill-current': tableInfoDrawerPinned }" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" class="h-5 w-5" @click="showTableInfo = false">
|
||||
<X class="w-3 h-3" />
|
||||
</Button>
|
||||
|
||||
@@ -2294,6 +2294,7 @@ defineExpose({
|
||||
:execution-database="activeDataTabExecutionDatabase"
|
||||
:table-meta="activeDataTabTableMeta"
|
||||
:table-info-tab="activeTab.tableInfoTab"
|
||||
:auto-show-table-info="settingsStore.editorSettings.tableInfoDrawerPinned"
|
||||
:page-offset="activeTab.resultPageOffset"
|
||||
:page-limit="activeTab.resultPageLimit"
|
||||
:total-row-count="activeTab.resultTotalRowCount"
|
||||
|
||||
Reference in new issue
Block a user