diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue index f806eb3b1..aebb86a0b 100644 --- a/apps/desktop/src/components/sidebar/TreeItem.vue +++ b/apps/desktop/src/components/sidebar/TreeItem.vue @@ -45,7 +45,7 @@ import { Badge } from "@/components/ui/badge"; import { Input } from "@/components/ui/input"; import LightTooltip from "@/components/ui/LightTooltip.vue"; import type { ColumnInfo, ConnectionConfig, DatabaseType, TreeNode, TreeNodeType } from "@/types/database"; -import { canTreeNodeShowExpander, sidebarTreeNodeComment, trailingCommentAvailableWidth, trailingCommentGapPx, treeItemPaddingLeft, treeLabelWidthClass, usesFullWidthTreeLabel } from "@/lib/sidebar/sidebarTreeItemLayout"; +import { alignedCommentLeadingWidth, canTreeNodePin, canTreeNodeShowExpander, sidebarTreeNodeComment, trailingCommentAvailableWidth, trailingCommentGapPx, treeItemPaddingLeft, treeLabelWidthClass, usesFullWidthTreeLabel } from "@/lib/sidebar/sidebarTreeItemLayout"; import { clearActiveTableReferencePayload, createTableReferencePayload, createTableReferenceDropEvent, setActiveTableReferencePayload, type QueryEditorTableReferencePayload } from "@/lib/editor/queryEditorTableDrop"; import { formatSidebarObjectStorage } from "@/lib/sidebar/sidebarDatabaseStorage"; import { dataTabOpenModeFromTreeClick } from "@/lib/sidebar/dataTabOpenPolicy"; @@ -633,6 +633,11 @@ function formattedObjectStorage(): string { const alignedCommentLabelWidth = computed(() => (settingsStore.editorSettings.sidebarObjectInfoMode === "comment-aligned" ? props.commentLabelWidth : undefined)); +function alignedCommentLeadingStyle(): { width: string } | undefined { + const width = alignedCommentLeadingWidth(alignedCommentLabelWidth.value, canTreeNodePin(activeNode.value.type)); + return width === undefined ? undefined : { width: `${width}px` }; +} + function hasTrailingMetadata(): boolean { return !!trailingComment.value || !!formattedObjectStorage(); } @@ -641,7 +646,7 @@ const usesFullWidthLabel = computed(() => usesFullWidthTreeLabel(activeNode.valu const rowWidthClass = computed(() => (usesFullWidthLabel.value ? "w-max min-w-full" : "w-full min-w-0")); -const labelWidthClass = computed(() => treeLabelWidthClass({ fullWidth: usesFullWidthLabel.value, hasTrailingComment: hasTrailingMetadata() })); +const labelWidthClass = computed(() => treeLabelWidthClass({ fullWidth: usesFullWidthLabel.value, hasTrailingComment: hasTrailingMetadata(), hasInlineAction: isPinned.value })); watch(() => [isRightAlignedComment(), visibleLabel(activeNode.value), trailingComment.value, trailingCommentLayoutRef.value, trailingCommentLeadingRef.value], refreshTrailingCommentMeasurement, { flush: "post", immediate: true }); @@ -815,7 +820,7 @@ function isPinnedOrderDrag(): boolean { const dragVisual = computed(() => { const targetId = isPinnedOrderDrag() ? pinnedSortKey() : activeNode.value.id; - const isDropTarget = isPinnedOrderDrag() ? !!dragState.draggedId && connectionStore.canReorderPinnedTreeNodes(dragState.draggedId, pinnedSortKey()) : activeNode.value.type === "connection" || activeNode.value.type === "connection-group"; + const isDropTarget = isPinnedOrderDrag() ? connectionStore.isPinnedTreeNodeReorderTarget(pinnedSortKey()) : activeNode.value.type === "connection" || activeNode.value.type === "connection-group"; return { isDropTarget, @@ -827,8 +832,14 @@ const dragVisual = computed(() => { }); function startPinnedOrderDrag(event: MouseEvent) { - if (!canDragPinnedOrder()) return; - startDrag(event, pinnedSortKey(), PINNED_TREE_NODE_DRAG_TYPE); + if (event.button !== 0 || !canDragPinnedOrder()) return; + const draggedKey = pinnedSortKey(); + connectionStore.beginPinnedTreeNodeReorder(draggedKey); + startDrag(event, draggedKey, PINNED_TREE_NODE_DRAG_TYPE, { + autoScroll: true, + scrollContainer: rowRef.value?.closest(".connection-tree-scroller") ?? null, + onEnd: connectionStore.endPinnedTreeNodeReorder, + }); } function updateTreeDragTarget(event: MouseEvent) { @@ -1131,11 +1142,7 @@ function onKeydown(event: KeyboardEvent) {
-
+
{{ visibleLabel(node) }} + +