From c8539bcc329eccfd35ccf4a620a6b9965a38adca Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 4 Jun 2026 14:25:41 +0800 Subject: [PATCH] perf: replace column header Tooltip with hand-rolled LightTooltip --- apps/desktop/src/components/grid/DataGrid.vue | 886 +++++++++--------- .../src/components/ui/LightTooltip.vue | 16 +- 2 files changed, 451 insertions(+), 451 deletions(-) diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 8a9b09b25..1347f2745 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -66,6 +66,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Input } from "@/components/ui/input"; +import LightTooltip from "@/components/ui/LightTooltip.vue"; import LightDropdown from "@/components/ui/LightDropdown.vue"; import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; @@ -6170,496 +6171,489 @@ const gridContextMenuItems = computed(() => { #
- - -
- - - - {{ col.name }} - - - {{ headerColumnComment(col.name) }} - + +
+ + + + {{ col.name }} - + + + - - - - - - - - {{ t("grid.columnFormatter") }} - - - - {{ t("grid.localFilter") }} - - - - + + + - - - - - - - -
-
- {{ t("grid.columnFormatterFor", { column: col.name }) }} -
-
- {{ t("grid.columnFormatterHint") }} -
+ + {{ t("grid.columnFormatter") }} + + + + {{ t("grid.localFilter") }} + + + + + + + + + + + +
+
+ {{ t("grid.columnFormatterFor", { column: col.name }) }}
-
-
-
- {{ t("grid.formatterType") }} -
- +
+ {{ t("grid.columnFormatterHint") }} +
+
+
+
+
+ {{ t("grid.formatterType") }}
+ +
-
-
- {{ t("grid.formatterTimestampUnit") }} -
- +
+
+ {{ t("grid.formatterTimestampUnit") }}
+ +
-
-
- {{ t("grid.formatterJsonPathInput") }} -
+
+
+ {{ t("grid.formatterJsonPathInput") }} +
+ +
+ +
+ + +
+ +
+
+
+ {{ t("grid.formatterSavedCustom") }} +
+ +
+ +
- -
- - -
- -
-
-
- {{ t("grid.formatterSavedCustom") }} -
- -
- - -
- {{ t("grid.formatterCustomTemplateHint") }} -
-
- -
-
- {{ t("grid.formatterPreview") }} -
-
-
- {{ row.index }} - {{ row.raw }} - {{ row.formatted }} -
-
+ +
+ {{ t("grid.formatterCustomTemplateHint") }}
-
+
+
+ {{ t("grid.formatterPreview") }} +
+
+
+ {{ row.index }} + {{ row.raw }} + {{ row.formatted }} +
+
+
+
+ +
+ +
+ -
- - -
- - - + + + + + + + + + + - - - - +
+ {{ t("grid.localFilterFor", { column: col.name }) }} +
+
+ + +
+
- - -
- {{ t("grid.localFilterFor", { column: col.name }) }} -
-
- - -
-
{{ t("grid.value") }} + {{ t("grid.count") }} +
+
+ - {{ t("grid.value") }} - {{ t("grid.count") }} + + + + {{ option.label }} + + {{ + option.count + }} + +
+ {{ + t("grid.moreValues", { + count: localFilterAllOptions.length - localFilterOptions.length, + }) + }}
-
- -
- {{ - t("grid.moreValues", { - count: localFilterAllOptions.length - localFilterOptions.length, - }) - }} -
- -
- {{ t("grid.noSearchResults") }} -
+ +
+ {{ t("grid.noSearchResults") }}
-
-
+
+ +
+ + -
- - -
- - - -
-
- - - {{ t("grid.columnName") }} - - {{ col.name }} - +
+ + - - - - +
+
+ +
(); +const hasContent = computed(() => !!props.text || !!slots.content); + function open() { - if (isDisabled() || !props.text) return; + if (isDisabled() || !hasContent.value) return; if (!isTriggerActive()) return; updatePosition(); show.value = true; @@ -139,7 +142,7 @@ function open() { } function scheduleOpen() { - if (isDisabled() || !props.text) return; + if (isDisabled() || !hasContent.value) return; clearTimer(); timer = setTimeout(open, props.delay); } @@ -169,12 +172,15 @@ watch(