fix(collections/table): colons in attribute name not working (closes #7860)

This commit is contained in:
Elian Doran
2025-11-25 21:03:27 +02:00
parent 976b1e1e0f
commit fddf73b1bb
5 changed files with 49 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import { Attribute } from "../services/attribute_parser";
import FAttribute from "../entities/fattribute";
import clsx from "clsx";
import { t } from "../services/i18n";
import { DefinitionObject, LabelType } from "../services/promoted_attribute_definition_parser";
import { DefinitionObject, extractAttributeDefinitionTypeAndName, LabelType } from "../services/promoted_attribute_definition_parser";
import server from "../services/server";
import FNote from "../entities/fnote";
import { ComponentChild, HTMLInputTypeAttribute, InputHTMLAttributes, MouseEventHandler, TargetedEvent, TargetedInputEvent } from "preact";
@@ -78,8 +78,7 @@ function usePromotedAttributeData(note: FNote | null | undefined, componentId: s
const cells: Cell[] = [];
for (const definitionAttr of promotedDefAttrs) {
const valueType = definitionAttr.name.startsWith("label:") ? "label" : "relation";
const valueName = definitionAttr.name.substr(valueType.length + 1);
const [ valueType, valueName ] = extractAttributeDefinitionTypeAndName(definitionAttr.name);
let valueAttrs = ownedAttributes.filter((el) => el.name === valueName && el.type === valueType) as Attribute[];