fix(grid): remove inline NULL badge from result header

Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
This commit is contained in:
zipg
2026-08-10 10:32:46 +08:00
committed by GitHub
co-authored by zipg
parent a3cf5fe256
commit fff07ada83
2 changed files with 4 additions and 9 deletions
@@ -75,10 +75,7 @@ const emit = defineEmits<{
<KeyRound v-if="columnIndexKind === 'primary'" class="h-3 w-3 shrink-0" :class="columnIndexColorClass(columnIndexKind)" :title="columnIndexText(columnIndexKind)" />
<Hash v-else-if="columnIndexKind && columnIndexKind !== 'none'" class="h-3 w-3 shrink-0" :class="columnIndexColorClass(columnIndexKind)" :title="columnIndexText(columnIndexKind)" />
<span class="flex min-w-0 flex-1 flex-col overflow-hidden">
<span class="flex min-w-0 items-center gap-1 leading-4">
<span class="min-w-0 truncate">{{ name }}</span>
<span v-if="columnNullability === 'nullable'" data-grid-header-nullable class="shrink-0 rounded-sm border border-muted-foreground/40 px-0.5 text-[8px] font-semibold leading-3 text-muted-foreground" :title="nullableLabel" :aria-label="nullableLabel"> NULL </span>
</span>
<span class="min-w-0 truncate leading-4">{{ name }}</span>
<span v-if="showTypeLine" data-grid-header-type-line class="h-3 min-w-0 truncate text-[10px] font-normal leading-3" :class="[typeClass, { invisible: !columnType }]" :title="columnType || undefined" :aria-hidden="columnType ? undefined : true">{{ columnType }}</span>
<span v-if="showCommentLine" data-grid-header-comment-line class="h-3 min-w-0 truncate text-[10px] font-normal leading-3 text-muted-foreground" :class="{ invisible: !columnComment }" :title="columnComment || undefined" :aria-hidden="columnComment ? undefined : true">{{
columnComment
@@ -387,7 +387,7 @@ describe("DataGridColumnHeader", () => {
expect(findAll(mounted.root, (node) => node.props["data-grid-header-comment-line"] === "")).toHaveLength(0);
});
it("marks nullable columns without marking required columns", () => {
it("shows column nullability in the header tooltip without an inline badge", () => {
const baseProps = {
name: "nickname",
actualColumnIndex: 1,
@@ -406,12 +406,10 @@ describe("DataGridColumnHeader", () => {
};
const nullable = mountComponent(DataGridColumnHeader, { ...baseProps, columnNullability: "nullable" });
const required = mountComponent(DataGridColumnHeader, { ...baseProps, columnNullability: "required" });
const badge = findOne(nullable.root, (node) => node.props["data-grid-header-nullable"] === "");
expect(hostText(badge).trim()).toBe("NULL");
expect(badge.props.title).toBe("nullable");
expect(hostText(nullable.root)).toContain("nullableyes");
expect(findAll(nullable.root, (node) => node.props["data-grid-header-nullable"] === "")).toHaveLength(0);
expect(findAll(required.root, (node) => node.props["data-grid-header-nullable"] === "")).toHaveLength(0);
expect(hostText(nullable.root)).toContain("nullableyes");
expect(hostText(required.root)).toContain("nullableno");
});
});