Module: alfresco/node/MetadataGroups

alfresco/node/MetadataGroups

This widget provides a way in which the metadata from a given node can be displayed in one or more groups. Each group should be provided with its own title along with a "widgets" array defining all the metadata properties to be rendered in that group. This allows complete control over what metadata properties are displayed, the order that they are displayed and the renderer to display their values. The most basic read-only value renderer used is most likely to be the Property widget.
Author:
  • Dave Draper
License:
Source:

Example

Basic configuration of a single group rendering two properties

{
  name: "alfresco/node/MetadataGroups",
  config: {
    groups: [
      {
        title: "Audio Details",
        widgets: [
          {
            label: "Artist",
            name: "alfresco/renderers/Property",
            config: {
              propertyToRender: "node.properties.audio:artist"
            }
          },
          {
            label: "Genre",
            name: "alfresco/renderers/Property",
            config: {
              propertyToRender: "node.properties.audio:genre"
            }
          }
        ]
      }
    ]
  }
}

Members

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/MetadataGroups.css"}]
Source:

groups :object[]

An array of groups of metadata to be rendered.
Type:
  • object[]
Default Value:
  • null
Source:

labelToValueRatio :number

When a specific width is configured then this atttribute can be used to define what ratio the width of the label should be to the width of the value. This should be a percentage figure (the % symbol should not be included) between 1 and 99.
Type:
  • number
Default Value:
  • 30
Source:

separated :boolean

Indicates whether or not each group should be separated by a standard horizontal border line. Defaults to false.
Type:
  • boolean
Default Value:
  • false
Source:

templateString :string

The HTML template to use for the widget.
Type:
  • string
Source:

width :number

An optional width of the displayed metadata groups. If not configured then the width will be that of the standard Twister which is defined by the "@sidebar-component-width" LESS variable. This is expected to be a value in pixels (the "px" units suffix should not be included).
Type:
  • number
Default Value:
  • "initial"
Source:

Methods

addMetadata(idPrefix, widgets, group)

Constructs a new metadata item for the metadata configuration provided and then adds it to the supplied array.
Parameters:
Name Type Description
idPrefix string The identifier of the parent to use as a prefix
widgets object[] An array to add the new metadata widget to
group object A single grouping of metadata properties to render
Source:

addMetadataGroup(group)

Calls the addMetadata for each "widgets" attribute defined in the group to construct the individual metadata item widget and then creates a single twister containing all the requested metadata
Parameters:
Name Type Description
group object A single grouping of metadata properties to render
Source:

postCreate()

Processes any custom width values to ensure that labels and values of each metadata item have the correct widths according to the configured labelToValueRatio. It then iterates over the configured groups and calls the addMetadataGroup to add each group into a twister.
Source: