mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 19:08:56 +01:00
feat(board/relation): group by relation
This commit is contained in:
parent
455b190a5b
commit
47f7968dc4
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user