mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 18:25:51 +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) {
|
for (const { name, title, type } of info) {
|
||||||
const prefix = (type === "relation" ? "relations" : "labels");
|
const prefix = (type === "relation" ? "relations" : "labels");
|
||||||
|
const field = `${prefix}.${name}`;
|
||||||
|
|
||||||
|
if (seenFields.has(field)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
columnDefs.push({
|
columnDefs.push({
|
||||||
field: `${prefix}.${name}`,
|
field,
|
||||||
title: title ?? name,
|
title: title ?? name,
|
||||||
editor: "input",
|
editor: "input",
|
||||||
...labelTypeMappings[type ?? "text"],
|
...labelTypeMappings[type ?? "text"],
|
||||||
});
|
});
|
||||||
|
seenFields.add(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyHeaderMenu(columnDefs);
|
applyHeaderMenu(columnDefs);
|
||||||
|
|||||||
Reference in New Issue
Block a user