alfresco-ng2-components/docs/content-services/components/content-metadata-card.component.md
Anukriti Singh a900dd2551
[ACS-5645] Property Panel Feature (#8995)
* [ACS-5645]Added edit functionality for each panel and updated test cases

* metadata e2e fix

* [ACS-5725]fixed failing e2es

* added unit test cases for new functionality

* minor fixes

* minor fixes

* minor fixes

* [ACS-5645]code modification

* [ACS-5645]removed unwanted code

* [ACS-5645]modified the changes

* [ACS-5645]removed unwanted space

* [ACS-5645]removed unwanted code

* [ACS-5645]Implemented changes as per the review comments

* linting fixes

* [ACS-5645]minor fixes

* [ACS-5645] removed unwanted code

* [ACS-5645]modified the change

* [ACS-5645]aligned input

* [ACS-5645]modified changes

* [ACS-5645]Implemented the changes as per the review comments

* [ACS-5645]linting fixes

* [ACS-5645]fixed sonarcloud issue

* [ACS-5645]fixed errors

* [ACS-5645]rename the function

* [ACS-5645]fixes linting

* [ACS-5540]lint fixes

* [ACS-5645]Implemented the changes as per review comments

* [ACS-5645] Removed unused code

* [ACS-5645]linting fixes

* [ACS-5645]fixes for lint

* [ACS-5645] e2e fixes

* [ACS-5645]Added translation

* [ACS-5645]fixes for e2e

* [ACS-5645]fixes for e2e

* [ACS-5645]e2e fixes

* [ACS-5645] Renamed the theme

* [ACS-5645]modified changes

* [ACS-5645] fixed lock-file bug

* [ACS-5645] added tooltips for save and cancel icons

* [ACS-5645] Modified the changes

* [ACS-5645]Modified the changes

* [ACS-5645] Implemented the changes as per the review comments

* [ACS-5645] Implemented the changes as per the review comments

* [ACS-5645]Modified the changes

* [ACS-5645] added group panel lock changes

* [ACS-5645] Resolved sonarcloud issue

* [ACS-5645] added test cases for tags component

* [ACS-5645] updated the documentation

* [ACS-5645] updated the documentation

* [ACS-5645] updated the documentation

* [ACS-5645] Implemented changes as per review comments

* [ACS-5645] lint fixes

* [ACS-5645] Implemented the review comments

* [ACS-5645] added focus

* [ACS-5645] modified the changes

* [ACS-5645] Lint fixes

* [ACS-5645] Lint fixes

* [ACS-5645] Lint fixes

* [ACS-5645] Removed unwanted code

* [ACS-5645] fixed sonarcloud issue

* [ACS-5645] Added missing translation key

* [ACS-5645] renamed the methods

* [ACS-5645]Added edit functionality for each panel and updated test cases

* [ACS-5645]code modification

* [ACS-5645]removed unwanted code

* [ACS-5645]Implemented changes as per the review comments

* [ACS-5645]Implemented the changes as per review comments

* [ACS-5645]linting fixes

* [ACS-5645] fixed lock-file bug

* [ACS-5645] Modified the changes

* [ACS-5645] added group panel lock changes

* [ACS-5645]Added edit functionality for each panel and updated test cases

* minor fixes

* [ACS-5645] Modified the changes

* [ACS-5645] added group panel lock changes

* [ACS-5645]Added edit functionality for each panel and updated test cases

* metadata e2e fix

* [ACS-5725]fixed failing e2es

* minor fixes

* [ACS-5645]removed unwanted code

* [ACS-5645]Implemented changes as per the review comments

* [ACS-5551] property panel design

* [ACS-5551] minor changes

* [ACS-5551]minor change

* [ACS-5551] updated checks for non -editable field

* [ACS-5551] modified the changes

* [ACS-5551] modified changes

* [ACS-5551] content-metadata updated

* [ACS-5551] code updated

* [ACS-5551] remove extra space

* fixed scrollbar issue

* [ACS-5551] margin adjusted

* Fixed  ACS-6110

* [ACS-5551] design updated

* [ACCS-5551] unit test added

* [ACS-5551] margin issue fixed

* scroll issue fixed

* [ACS-5551] color updated

* [ACS-5551] design modify

* [ACS-5551] add missing methods

* [ACS-5654] translation added

* [ACS-5645] style updated

* [ACS-5654] hide toggle button for aspects

* [ACS-5645] theme updated

* [ACS-5645] tags and category tyle update

* [ACS-5645] unit test update

* [ACS-5645] code updated as per comments

* [ACS-5645] linting issue fix

* [ACS-5645] fixed the failed unit test cases

* [ACS-5645] e2e fixes

* [ACS-5645] e2e modify

* [ACS-5645] aspect issue resolved

* [ACS-5645] Address the comments

* [ACS-5645] Address the comments

* [ACS-5645] tags list design modify

* [ACS-5645] design modify for chips

* [ACS-5645] Removed unused property

* [ACS-5645] Stop reload on panel cancel changes

* [ACS-5645] Linting issue fixed

* revert file change

* [ACS-5645] update aspect issue fix

* Revert "[ACS-5645] update aspect issue fix"

This reverts commit 5212112f2293ad4c29afdd7c7faaf897cd3d00f6.

* reduce layout duplicates, header panel component

* code improvements

* remove useless logging

* cleanup css, remove mat-divider, fix tests

* remove useless styles

* cleanup e2e

* cleanup useless events

* rename nodeIcon to just icon

* disable transition animation for tabs

* remove "editable" hacks

* improved naming for state properties

* bug fixes for process cloud

* css stylelint fixes

* rework component, cleanup useless code

* fix allowable operations and readonly state

* wait for button

* cleanup css, disable e2e

* remove demo-shell only content, fix metadata

* restore reset date functionality

* fix incorrect styling

* fix clear date button styles

* cleanup text item styles

* remove useless classes

* text item rework, code cleanup

* style bug fixes

* cleanup useless tests

* fix styles and tests

* bug fixes for select item styles, revert PR changes

* rework categories styles

* rework tags creator styles

* rollback divider module

* fix css variable naming

* fix issue with hidden properties

* fix key value pairs layout and styles

* fix tag creator validation

* remove incorrect styles, raise proper errors

* fix unit tests

* fix theme vars naming

* remove css hacks for date items

* fix error borders

* fix css bugs

* reduce code

* cleanup e2e and en.json

* fix css linting

* cleanup unused template refs

* remove useless div for metadata container

* cleanup expanders api

* cleanup and remove useless tests

* cleanup i18n

* cleanup tests

* cleanup css

* cleanup css

* [ACS-5654] added the missing theme variables

* review comments resolved

* fixed  css issue

* [ACS-5654] removesd extra div

* [ACS-5654] save and cancel button bug fix

* [ACS-5654] unit test fix for expand the panel

* [ACS-5645] design issues fix

* [ACS-5654] cards design fixed

* [ACS-5654] node icon added to thumbnail service

* [ACS-5645] linting issue fixed

* [ACS-5645] thumbnail unit test updated

* [ACS-5645] linting updated

* [ACS-5645] removed extra div

* [ACS-5645] important removed

* [ACS-5645] tags text issue fix

* [ACS-5645] add missed class

* [ACS-5645] removed unused classes

* [ACS-5645]  removed unused code

* revert flags to original state

* fix missing semicolon

* fix linting issues

* reduce code duplication

* code cleanup

* [ACS-5645] unit test fix

* [ACS-5645] e2e fix for edit button

* fix linting issue for e2e

* Replaced getNodeIcon from thumbnail to content service

* fix indentation

* refactor css variable

* use rgba color value

---------

Co-authored-by: Yasa-Nataliya <yasa.nataliya@globallogic.com>
Co-authored-by: pkundu <priyanka.kundu@hyland.com>
Co-authored-by: rbahirsheth <raviraj.bahirsheth@globallogic.com>
Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
2023-12-21 16:37:13 +05:30

14 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Content Metadata Card component v2.1.0 Active 2019-03-15

Content Metadata Card component

Displays and edits metadata related to a node.

Content metadata screenshot

Contents

Basic Usage

<adf-content-metadata-card
    [displayEmpty]="false"
    [toggleDisplayProperties]="displayDefaultProperties"
    [preset]="'*'"
    [node]="node">
</adf-content-metadata-card>

Class members

Properties

Name Type Default value Description
displayAspect string null (optional) This flag displays desired aspect when open for the first time fields.
displayEmpty boolean false (optional) This flag displays/hides empty metadata fields.
multi boolean false (optional) This flag allows the component to display more than one accordion at a time.
node Node (required) The node entity to fetch metadata about
preset string | PresetConfig (required) Name or configuration of the metadata preset, which defines aspects and their properties.
readOnly boolean false (optional) This flag sets the metadata in read only mode preventing changes.
displayDefaultProperties boolean (optional) This flag displays/hides the metadata properties.
editable boolean (optional) This flag toggles editable of content.
customPanels ContentMetadataCustomPanel[] (optional) List of custom metadata panels to be displayed as Dynamic components.

Details

The component shows metadata related to a given node. It uses the Card View component to render the properties of metadata aspects. The different aspects and their properties to be shown can be configured as application config presets (see below) or the preset config can be provided directly as PresetConfig. By default the component only shows the basic properties of the node. The user can click on the pencil icon at the bottom of the component to edit the metadata properties.

Application config presets

You can define different presets for the metadata component or override the default presets in the app.config.json file. If nothing else is set, the default preset is "*", which will use the "indifferent" config described below.

You can define as many extra presets as you need for your components.

The example configurations below show the options in detail.

Indifferent config

The default configuration behaves like the following:

...
"content-metadata": {
    "presets": {
        "default": "*"
    }
}
...

This will display a default set of basic node properties: name, title, creator, created date, size, modifier, modified date, mime type, author, description.

Aspect oriented config

With this type of configuration you can "whitelist" aspects and properties for a preset, but everything will be grouped by aspects and there is no further way to group properties. Use a layout oriented configuration if you want to define your own custom groups.

The default configuration shows every aspect but you can restrict it to just a small selection of aspects by "whitelisting" the ones you want in the default section. In the example below, just the exif:exif and custom:aspect aspects are whitelisted:

...
"content-metadata": {
    "presets": {
        "default": {
            "custom:aspect": "*",
            "exif:exif": "*"
        }
    }
}
...

You can further restrict the whitelist to specific properties of one or more aspects by using an array of property names in place of the "*" filter:

...
"content-metadata": {
    "presets": {
        "default": {
            "custom:aspect": "*",
            "exif:exif": [ "exif:pixelXDimension", "exif:pixelYDimension"]
        }
    }
}
...

A final example shows the same process applied to a custom preset called "kitten-images":

...
"content-metadata": {
    "presets": {
        "default": "*",
        "kitten-images": {
            "custom:aspect": "*",
            "exif:exif": [ "exif:pixelXDimension", "exif:pixelYDimension"]
        }
    }
}
...

Layout oriented config

You can also go beyond the aspect oriented configuration if you need to configure the groups and properties in a more detailed way. With this type of configuration any property of any aspect/type can be "cherry picked" and grouped into an accordion drawer, along with a translatable title defined in the preset configuration.

Basic elements

The following config will produce one accordion group named "TRANSLATABLE_TITLE_FOR_GROUP_1", with all the properties from custom:aspect followed by the two properties (exif:pixelXDimension and exif:pixelYDimension) from the exif:exif aspect and then one property (custom:myPropertyName) from custom:type:

...
"content-metadata": {
    "presets": {
        "kitten-images": [{
            "title": "TRANSLATABLE_TITLE_FOR_GROUP_1",
            "items": [
                { "aspect": "custom:aspect", "properties": "*" },
                { "aspect": "exif:exif", "properties": [ "exif:pixelXDimension", "exif:pixelYDimension"] },
                { "type": "custom:type", "properties": [ "custom:myPropertyName" ] },
            ] 
        }]
    }
}
...

More complex example

A more complex config is shown in the example below:

  "content-metadata": {
    "presets": {
      "kittens": [
      {
        "title": "GROUP-TITLE1-TRANSLATION-KEY",
        "items": [
          { 
            "aspect": "exif:exif",
            "properties": "*"
          },
          { 
            "aspect": "kitten:vet-records", 
            "properties": [ "kitten:custom1", "kitten:custom3" ]
          },
          { 
            "aspect": "owner:parameters", 
            "properties": [ "owner:name" ]
          },
          { 
            "type": "kitten:kitten", 
            "properties": [ "kitten:name", "kitten:color" ]
          }
        ]
      },
      {
        "title": "GROUP-TITLE2-TRANSLATION-KEY",
        "items": [
          {
            "aspect": "kitten:food", 
            "properties": [ "kitten:favourite-food", "kitten:recommended-food" ] 
          }
        ]
      }
    ]
  }

Custom property title example

In layout oriented configuration, the metadata property title can be overridden from ADF as below.

  { 
    "name": "exif:pixelYDimension", // your desired property  name
    "title": "Custom YDimension Name" // your desired property title
  }
  "content-metadata": {
    "presets": {
      "kittens": [
      {
        "title": "GROUP-TITLE1-TRANSLATION-KEY",
        "items": [
          {
            "aspect": "exif:exif",
            "properties": [
              "exif:pixelXDimension",
              {
                "title": "Custom YDimension Name",
                "name": "exif:pixelYDimension"
              }
            ]
          }
    ]
  }

Note: The desired property title should be valid. otherwise it will take default value.

custom-ptoperty-title

The result of this config would be two accordion groups with the following properties:

GROUP-TITLE1-TRANSLATION-KEY
exif:param1
exif:param2
...
exif:paramN
kitten:custom1
kitten:custom3
owner:name
kitten:name
kitten:color
GROUP-TITLE2-TRANSLATION-KEY
kitten:favourite-food
kitten:recommended-food

Making properties editable

When using the layout oriented config you can also set whether or not the properties are going to be editable.

...
"content-metadata": {
    "presets": {
        "kitten-images": [{
            "title": "TRANSLATABLE_TITLE_FOR_GROUP_1",
            "items": [
                { 
                    "aspect": "custom:aspect", 
                    "properties": "*", 
                    "editable": false 
                }
            ] 
        }]
    }
}
...

As seen above in the example the custom:aspect aspect will always be on read-only mode since these properties are not editable. If the editable is enabled, then these properties will be able to be edited by the user.

Displaying all properties

You can list all the properties by simply adding the includeAll: boolean to your config. This config will display all the aspects and properties available for that specific file.

"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true
        }
    }
},

Futhermore, you can also exclude specific aspects by adding the exclude property. It can be either a string if it's only one aspect or an array if you want to exclude multiple aspects at once:

"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true,
            "exclude": "exif:exif"
        }
    }
},
"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true,
            "exclude": ["exif:exif", "owner:parameters"]
        }
    }
},

When using this configuration you can still whitelist aspects and properties as you desire. The example below shows this with an aspect-oriented config:

"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true,
            "exclude": "exif:exif",
            "exif:exif": [ "exif:pixelXDimension", "exif:pixelYDimension"]
        }
    }
},

Making aspects and properties read only

Whenever you have properties that you want to protect from users editing their values you can add them to your configuration to make them read only. readOnlyAspects will make the whole aspect and its properties non editable.

If you want to disable the editing for specific properties you will need to add them to the readOnlyProperties property.

"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true,
            "readOnlyAspects": ["cm:author"],
            "readOnlyProperties": ["cm:fileVersion"]
        }
    }
},

What happens when there is a whitelisted aspect in the config but the given node doesn't relate to that aspect

Nothing - since this aspect is not related to the node, it will simply be ignored and not displayed. The aspects to be displayed are calculated as an intersection of the preset's aspects and the aspects related to the node.

Multi value card properties

Multi value properties are displayed one after another separated by a comma. This card makes use of the Multi Value Pipe.

To customize the separator used by this card you can set it in your app.config.json inside your content-metadata configuration:

"content-metadata": {
    "presets": {
        "default": {
            "includeAll": true,
            "exclude": "exif:exif",
            "exif:exif": [ "exif:pixelXDimension", "exif:pixelYDimension"]
        }
    },
    "multi-value-pipe-separator" : " - ",
    "multi-value-chips" : false
},

Use chips for multi value properties

If you want to display chips fo each value instead of a composed string you just need to enable it in the content-metadata config.

Chips for multi value properties

Copy to Clipboard on click

For easier interaction with metadata properties you can enable the Copy to Clipboard feature from your configuration in the app.config.json file.

Once you have enabled this feature you will be able to double click on your metadata properties and they will get copied to your clipboard for you to use.

"content-metadata": {
   "presets": {
       "default": {
           "includeAll": true,
           "exclude": "exif:exif",
           "exif:exif": [ "exif:pixelXDimension", "exif:pixelYDimension"]
       }
   },
   "copy-to-clipboard-action": true
}

Search select options (ACS 7+)

When the list of values is too long, the options selection panel will be enhanced with a search input to make it easier for the user to find the value by a label. The default number is 5 and can be configured by selectFilterLimit property in app.config.json to change after how many options this search input should render.

"content-metadata": {
   "presets": {...},
   ...
   "selectFilterLimit": 10
}

Chips for multi value properties

Custom metadata panels

If there is a need to display some custom node properties that require additional UI or data to be fetched you can define custom metadata panels for the metadata component. After creating custom component to be displayed it has to be registered in Extension Service. Both panelTitle and component properties have to be defined. Chips for multi value properties