From fee7c2846ea7977098918d2efc12eea05674ec7c Mon Sep 17 00:00:00 2001 From: zipg Date: Wed, 1 Jul 2026 15:30:24 +0800 Subject: [PATCH] =?UTF-8?q?Feature=EF=BC=9A=E4=BC=98=E5=8C=96=E7=AB=96?= =?UTF-8?q?=E7=89=88=E5=8D=95=E5=85=83=E6=A0=BC=E8=AF=A6=E6=83=85=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: staff --- apps/desktop/src/components/grid/DataGrid.vue | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 5af714363..3e89cb24f 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -4036,6 +4036,13 @@ const detailTemporalEditorKind = computed(() => { const detail = activeCellDetail.value; return detail ? temporalEditorKindForColumn(detail.colIndex) : undefined; }); +const sideDetailPrioritizesValue = computed(() => !cellDetailPanelIsBottom.value && !isEditingDetail.value && !!activeCellDetail.value?.formattedJson); +const sideDetailValueFillsHeight = computed(() => cellDetailPanelIsBottom.value || isEditingDetail.value || (!cellDetailPanelIsBottom.value && !activeCellDetail.value?.imagePreviewUrl)); +const sideJsonPreviewText = computed(() => { + const detail = activeCellDetail.value; + if (!detail?.formattedJson) return ""; + return sideDetailJsonView.value ? detail.formattedJson : detail.rawValuePreview; +}); // CodeMirror-based cell detail editors const detailsEditorContainer = ref(); @@ -4056,7 +4063,7 @@ const SIDE_DETAIL_EDITOR_MAX_HEIGHT = 360; const SIDE_DETAIL_EDITOR_LINE_HEIGHT = 20; const SIDE_DETAIL_EDITOR_SOFT_WRAP_CHARS = 48; const sideDetailEditorStyle = computed(() => { - if (cellDetailPanelIsBottom.value) return undefined; + if (cellDetailPanelIsBottom.value || isEditingDetail.value) return undefined; const lines = detailEditValue.value.split(/\r\n|\r|\n/).reduce((total, line) => total + Math.max(1, Math.ceil(line.length / SIDE_DETAIL_EDITOR_SOFT_WRAP_CHARS)), 0); const height = Math.min(SIDE_DETAIL_EDITOR_MAX_HEIGHT, Math.max(SIDE_DETAIL_EDITOR_MIN_HEIGHT, lines * SIDE_DETAIL_EDITOR_LINE_HEIGHT + 28)); return { height: `${height}px` }; @@ -4115,7 +4122,7 @@ watch(sideJsonPreviewContainer, async (el) => { fontSize: editorFontSize, fontFamily: editorFontFamily, }); - await sideJsonPreviewEditor.create(el, activeCellDetail.value?.formattedJson ?? "", "json"); + await sideJsonPreviewEditor.create(el, sideJsonPreviewText.value, "json"); } else if (!el && sideJsonPreviewEditor) { sideJsonPreviewEditor.destroy(); sideJsonPreviewEditor = null; @@ -4139,12 +4146,9 @@ watch(dialogJsonPreviewContainer, async (el) => { } }); -watch( - () => activeCellDetail.value?.formattedJson ?? "", - (value) => { - sideJsonPreviewEditor?.setValue(value, "json"); - }, -); +watch(sideJsonPreviewText, (value) => { + sideJsonPreviewEditor?.setValue(value, "json"); +}); watch( () => dialogCellDetail.value?.formattedJson ?? "", @@ -8853,7 +8857,7 @@ const gridContextMenuItems = computed(() => { -
+
{{ t("grid.columnName") }}
@@ -8886,7 +8890,7 @@ const gridContextMenuItems = computed(() => {
-