* ACS-8706 split context menu to allow injecting actions * ACS-8706 fix class naming, add context menu components unit tests * ACS-8706 add context menu service, effects and directive unit tests * ACS-8706 review remarks - redundant condition, directive unit tests * ACS-8706 improve unit testing approach, remove unnecessary class attributes * ACS-8706 documentation * ACS-8706 fix sonar issues * ACS-8706 replace takeUntil with takeUntilDestroyed * ACS-8706 fix sonar lint issue * ACS-8706 change incorrect import path
1.9 KiB
Title
Title |
---|
Context Menu Actions |
Context Menu Actions
Context Menu Component, appearing on right-clicking a document list item, contains Actions executable on particular file or folder. This entry describes two ways of populating Context Menu.
Important: Those two ways are mutually exclusive.
Default behavior
When using acaContextActions
directive as shown below, Context Menu actions are loaded from app.extensions.json
by default.
<adf-document-list
#documentList
acaContextActions>
</adf-document-list>
Note: To learn more, see Extensibility features and Extension format.
Injecting Context Menu Actions
In order to inject custom actions into Context Menu, assign an array of rules, formatted as described in Extension format, to an attribute of a Component using Document List Component.
const contextMenuAction = [
{
"id": "custom.action.id",
"title": "CUSTOM_ACTION",
"order": 1,
"icon": "adf:custom-icon",
"actions": {
"click": "CUSTOM_ACTION"
},
"rules": {
"visible": "show.custom.action"
}
},
{
"id": "another.custom.action.id"
...
}
]
...
@Component({...})
export class ComponentWithDocumentList {
customContextMenuActions = contextMenuActions;
...
}
Next, pass them to customActions
input of acaContextActions
directive inside component's template.
<adf-document-list
#documentList
acaContextActions
customActions="customContextMenuActions">
</adf-document-list>
Note: Refer to Application Actions and Rules for information on creating custom "actions" and "rules" for Context Menu actions.