diff --git a/apps/client/src/widgets/PromotedAttributes.tsx b/apps/client/src/widgets/PromotedAttributes.tsx index 49b4c33ef..a0b1699a7 100644 --- a/apps/client/src/widgets/PromotedAttributes.tsx +++ b/apps/client/src/widgets/PromotedAttributes.tsx @@ -3,9 +3,13 @@ import "./PromotedAttributes.css"; import { useNoteContext } from "./react/hooks"; import { Attribute } from "../services/attribute_parser"; import FAttribute from "../entities/fattribute"; +import clsx from "clsx"; +import { t } from "../services/i18n"; +import { DefinitionObject } from "../services/promoted_attribute_definition_parser"; interface Cell { definitionAttr: FAttribute; + definition: DefinitionObject; valueAttr: Attribute; valueName: string; } @@ -44,7 +48,8 @@ export default function PromotedAttributes() { } for (const valueAttr of valueAttrs) { - cells.push({ definitionAttr, valueAttr, valueName }); + const definition = definitionAttr.getDefinition(); + cells.push({ definitionAttr, definition, valueAttr, valueName }); } } setCells(cells); @@ -60,17 +65,49 @@ export default function PromotedAttributes() { } function PromotedAttributeCell({ cell }: { cell: Cell }) { - const { valueName, valueAttr, definitionAttr } = cell; + const { valueName, valueAttr, definition, definitionAttr } = cell; const inputId = `value-${valueAttr.attributeId}`; - const definition = definitionAttr.getDefinition(); return (
- +
+ +
+ +
) } + +function ActionCell({ cell }: { cell: Cell }) { + return ( +
+ +
+ ) +} + +function MultiplicityCell({ cell }: { cell: Cell }) { + return (cell.definition.multiplicity === "multi" && + + {' '} + + + ) +} + +function PromotedActionButton({ icon, title }: { + icon: string, + title: string }) +{ + return ( + + ) +} diff --git a/apps/client/src/widgets/promoted_attributes.ts b/apps/client/src/widgets/promoted_attributes.ts index 4ddcb7d7e..b89d8ea7f 100644 --- a/apps/client/src/widgets/promoted_attributes.ts +++ b/apps/client/src/widgets/promoted_attributes.ts @@ -62,18 +62,6 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { .addClass("promoted-attribute-input") .on("change", (event) => this.promotedAttributeChanged(event)); - const $actionCell = $("
"); - const $multiplicityCell = $("").addClass("multiplicity").attr("nowrap", "true"); - - const $wrapper = $('