feat(board/relation): group by relation

This commit is contained in:
Elian Doran 2025-11-15 10:15:11 +02:00
parent 455b190a5b
commit 47f7968dc4
No known key found for this signature in database
2 changed files with 13 additions and 2 deletions

View File

@ -804,6 +804,16 @@ export default class FNote {
return this.getAttributeValue(LABEL, name);
}
getLabelOrRelation(nameWithPrefix: string) {
if (nameWithPrefix.startsWith("#")) {
return this.getLabelValue(nameWithPrefix.substring(1));
} else if (nameWithPrefix.startsWith("~")) {
return this.getRelationValue(nameWithPrefix.substring(1));
} else {
return this.getLabelValue(nameWithPrefix);
}
}
/**
* @param name - relation name
* @returns relation value if relation exists, null otherwise

View File

@ -57,7 +57,8 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per
return {
byColumn,
newPersistedData
newPersistedData,
isInRelationMode: groupByColumn.startsWith("~")
};
}
@ -70,7 +71,7 @@ async function recursiveGroupBy(branches: FBranch[], byColumn: ColumnMap, groupB
await recursiveGroupBy(note.getChildBranches(), byColumn, groupByColumn, includeArchived, seenNoteIds);
}
const group = note.getLabelValue(groupByColumn);
const group = note.getLabelOrRelation(groupByColumn);
if (!group || seenNoteIds.has(note.noteId)) {
continue;
}