mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 15:56:29 +01:00
feat(views/table): deduplicate columns
This commit is contained in:
@@ -88,15 +88,22 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[], exi
|
||||
}
|
||||
];
|
||||
|
||||
const seenFields = new Set<string>();
|
||||
for (const { name, title, type } of info) {
|
||||
const prefix = (type === "relation" ? "relations" : "labels");
|
||||
const field = `${prefix}.${name}`;
|
||||
|
||||
if (seenFields.has(field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
columnDefs.push({
|
||||
field: `${prefix}.${name}`,
|
||||
field,
|
||||
title: title ?? name,
|
||||
editor: "input",
|
||||
...labelTypeMappings[type ?? "text"],
|
||||
});
|
||||
seenFields.add(field);
|
||||
}
|
||||
|
||||
applyHeaderMenu(columnDefs);
|
||||
|
||||
Reference in New Issue
Block a user