[ACA-1614] DocumentList - context menu actions (#544)

* context menu

* make same structure check

* align naming

* lazy loading support

* update module import implementation

* close context menu on Escape

* focus and navigate context menu items

* update with material cdk 'keycodes' name

* changed module folder name
This commit is contained in:
Cilibiu Bogdan
2018-08-03 14:14:19 +03:00
committed by GitHub
parent 50b0023967
commit 27977be9a2
20 changed files with 752 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ export class ExtensionService implements RuleContext {
contentActions: Array<ContentActionRef> = [];
viewerActions: Array<ContentActionRef> = [];
contentContextmenuActions: Array<ContentActionRef> = [];
openWithActions: Array<ContentActionRef> = [];
createActions: Array<ContentActionRef> = [];
navbar: Array<NavBarGroupRef> = [];
@@ -124,6 +125,7 @@ export class ExtensionService implements RuleContext {
this.routes = this.loadRoutes(config);
this.contentActions = this.loadContentActions(config);
this.viewerActions = this.loadViewerActions(config);
this.contentContextmenuActions = this.loadContentContextmenuActions(config);
this.openWithActions = this.loadViewerOpenWith(config);
this.createActions = this.loadCreateActions(config);
this.navbar = this.loadNavBar(config);
@@ -173,6 +175,14 @@ export class ExtensionService implements RuleContext {
return [];
}
protected loadContentContextmenuActions(config: ExtensionConfig): Array<ContentActionRef> {
if (config && config.features && config.features.content) {
return (config.features.content.contextActions || [])
.sort(this.sortByOrder);
}
return [];
}
protected loadNavBar(config: ExtensionConfig): any {
if (config && config.features) {
return (config.features.navbar || [])
@@ -335,6 +345,12 @@ export class ExtensionService implements RuleContext {
.filter(action => this.filterByRules(action));
}
getAllowedContentContextActions(): Array<ContentActionRef> {
return this.contentContextmenuActions
.filter(this.filterEnabled)
.filter(action => this.filterByRules(action));
}
reduceSeparators(
acc: ContentActionRef[],
el: ContentActionRef,