Skip to content

MetadataFormElementRegistry

injectable

Object forms are used to render and edit metadata of DMS objects. Each property of an object can be rendered in a diffenrent way, depending on the type of the property. This service allows to register and retrieve templates for rendering these form elements.

You can register templates for different situations like EDIT, SEARCH, and CREATE. The templates will then be used to render the form elements in the object form component.

So based on the property type you can register custom templates for rendering certain form elements. This is useful if you want to render a property in a different way.

Example: Having a number property representing a rating, you might want to render it as a list of stars instead of a simple input field.

Type: string

Default Value: '@name:'

Register default form element component. Usually this will be done by the object form component itself.

_addDefaultElementTemplate(propertyType: string, templateRef: TemplateRef<any>): void
NameTypeDescription
propertyTypestring
templateRefTemplateRef<any>

Remove a registered default form element.

_removeDefaultElementTemplate(propertyType: string): void
NameTypeDescription
propertyTypestring

Register an object form element for a certain internal type. You might add a new component or overwrite an existung one.

addElementTemplate(propertyType: string, templateRef: TemplateRef<any>, situation: Situation): void
NameTypeDescription
propertyTypestring
templateRefTemplateRef<any>
situationSituation

Get a template to render a certain form element

getElementTemplate(propertyType: string, situation: string): TemplateRef | undefined
NameTypeDescription
propertyTypestring
situationstring

Remove a registered form element.

removeElementTemplate(propertyType: string, situation: Situation): void
NameTypeDescription
propertyTypestring
situationSituation