feat(neo4j): expand node query properties into result columns

This commit is contained in:
Hand Sonic authored and GitHub committed 2026-10-01 15:52:30 +08:00
1 parent 38a00c7cb7
commit 660071870b
12 files changed
+433 -29

No files matched your search

@@ -500,6 +500,7 @@ interface DataGridProps {
sortColumnIndex?: number;
sortDirection?: DataGridSortDirection;
sortMode?: DataGridSortMode;
databaseSortEnabled?: boolean;
tableMeta?: {
catalog?: string;
database?: string;
@@ -599,6 +600,7 @@ const props = withDefaults(defineProps<DataGridProps>(), {
totalRowCountIsExact: true,
inexactTotalRowCountMode: "at-least",
paginationEnabled: true,
databaseSortEnabled: true,
loadAllRowsEnabled: true,
// Omitted row-action limits must keep normal table-data editing.
allowInsertRows: undefined,
@@ -922,7 +924,7 @@ function sortMenuItems(column: string, columnIndex: number) {
column,
columnIndex,
state: currentColumnSortState(),
databaseSortEnabled: databaseSortSupportedForDatabase(resolvedDatabaseType.value),
databaseSortEnabled: props.databaseSortEnabled !== false && databaseSortSupportedForDatabase(resolvedDatabaseType.value),
labels: {
databaseAscending: t("grid.sortDatabaseAscending"),
databaseDescending: t("grid.sortDatabaseDescending"),
@@ -12358,7 +12360,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
canFilter: canUseWhereSearch.value,
hasSort: !!sortCol.value,
sortMode: sortMode.value,
databaseSortEnabled: databaseSortSupportedForDatabase(resolvedDatabaseType.value),
databaseSortEnabled: props.databaseSortEnabled !== false && databaseSortSupportedForDatabase(resolvedDatabaseType.value),
frozenColumnCount: frozenColumnCount.value,
contextVisibleColIdx: contextHeaderVisibleColIdx.value ?? undefined,
hasColumnSelection: hasColumnSelection.value,
@@ -75,7 +75,7 @@ function transposeRecordHeader(host: HTMLElement, recordIndex: number): HTMLElem
return header;
}
function mountGrid() {
function mountGrid(databaseSortEnabled?: boolean) {
const pinia = createPinia();
setActivePinia(pinia);
const settingsStore = useSettingsStore();
@@ -121,6 +121,7 @@ function mountGrid() {
h(DataGrid, {
result: result.value,
databaseType: "mysql",
databaseSortEnabled,
context: "table-data",
sortColumn: sortColumn.value,
sortColumnIndex: sortColumnIndex.value,
@@ -174,6 +175,21 @@ afterEach(() => {
});
describe("DataGrid transpose sorting", () => {
it("retains local sorting when database sorting is explicitly disabled", async () => {
const { host, onSort } = mountGrid(false);
await settle();
await openTranspose(host);
transposeField(host, 1).querySelector<HTMLButtonElement>("[data-grid-transpose-sort]")!.click();
await settle();
const labels = [...document.querySelectorAll('[role="menuitem"]')].map((item) => item.textContent?.trim());
expect(labels).toContain(i18n.global.t("grid.sortCurrentPageAscending"));
expect(labels).not.toContain(i18n.global.t("grid.sortDatabaseDescending"));
menuAction(i18n.global.t("grid.sortCurrentPageAscending")).click();
await settle();
expect(onSort).toHaveBeenLastCalledWith("score", 1, "asc", undefined, "local");
expect(transposeValues(host, 1)).toEqual(["2", "10", "NULL"]);
});
it("uses the shared local/database sort actions and keeps the active record and row selection", async () => {
const { host, onSort } = mountGrid();
await settle();