mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
extension enhancements (#552)
* default action types * move context-menu to the correct folder
This commit is contained in:
committed by
Cilibiu Bogdan
parent
22eac50d27
commit
8f3030760a
@@ -76,7 +76,7 @@ import { DirectivesModule } from './directives/directives.module';
|
||||
import { ToggleInfoDrawerComponent } from './components/toolbar/toggle-info-drawer/toggle-info-drawer.component';
|
||||
import { DocumentDisplayModeComponent } from './components/toolbar/document-display-mode/document-display-mode.component';
|
||||
import { ToggleFavoriteComponent } from './components/toolbar/toggle-favorite/toggle-favorite.component';
|
||||
import { ContextMenuModule } from './context-menu/context-menu.module';
|
||||
import { ContextMenuModule } from './components/context-menu/context-menu.module';
|
||||
|
||||
export function setupExtensionServiceFactory(service: ExtensionService): Function {
|
||||
return () => service.load();
|
||||
|
@@ -1,6 +1,16 @@
|
||||
<div mat-menu class="mat-menu-panel" @panelAnimation>
|
||||
<div class="mat-menu-content">
|
||||
<ng-container *ngFor="let entry of actions" [ngSwitch]="entry.type">
|
||||
<ng-container *ngSwitchCase="'default'">
|
||||
<button mat-menu-item
|
||||
[id]="entry.id"
|
||||
acaContextMenuItem
|
||||
(click)="runAction(entry.actions.click)">
|
||||
<mat-icon color="primary">{{ entry.icon }}</mat-icon>
|
||||
<span>{{ entry.title | translate }}</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="'button'">
|
||||
<button mat-menu-item
|
||||
[id]="entry.id"
|
@@ -31,15 +31,15 @@ import { trigger } from '@angular/animations';
|
||||
import { FocusKeyManager } from '@angular/cdk/a11y';
|
||||
import { DOWN_ARROW, UP_ARROW } from '@angular/cdk/keycodes';
|
||||
|
||||
import { ExtensionService } from '../extensions/extension.service';
|
||||
import { AppStore, SelectionState } from '../store/states';
|
||||
import { appSelection } from '../store/selectors/app.selectors';
|
||||
import { ExtensionService } from '../../extensions/extension.service';
|
||||
import { AppStore, SelectionState } from '../../store/states';
|
||||
import { appSelection } from '../../store/selectors/app.selectors';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject } from 'rxjs/Rx';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
import { ContextMenuOverlayRef } from './context-menu-overlay';
|
||||
import { ContentActionRef } from '../extensions/action.extensions';
|
||||
import { ContentActionRef } from '../../extensions/action.extensions';
|
||||
import { contextMenuAnimation } from './animations';
|
||||
import { ContextMenuItemDirective } from './context-menu-item.directive';
|
||||
|
@@ -27,7 +27,7 @@ import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { MatMenuModule, MatListModule, MatIconModule, MatButtonModule } from '@angular/material';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { CoreExtensionsModule } from '../extensions/core.extensions.module';
|
||||
import { CoreExtensionsModule } from '../../extensions/core.extensions.module';
|
||||
|
||||
import { ContextActionsDirective } from './context-menu.directive';
|
||||
import { ContextMenuService } from './context-menu.service';
|
@@ -1,4 +1,8 @@
|
||||
<ng-container [ngSwitch]="entry.type">
|
||||
<ng-container *ngSwitchCase="'default'">
|
||||
<app-toolbar-button [type]="type" [actionRef]="entry"></app-toolbar-button>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="'button'">
|
||||
<app-toolbar-button [type]="type" [actionRef]="entry"></app-toolbar-button>
|
||||
</ng-container>
|
||||
|
@@ -125,7 +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.contentContextmenuActions = this.loadContentContextMenuActions(config);
|
||||
this.openWithActions = this.loadViewerOpenWith(config);
|
||||
this.createActions = this.loadCreateActions(config);
|
||||
this.navbar = this.loadNavBar(config);
|
||||
@@ -159,26 +159,27 @@ export class ExtensionService implements RuleContext {
|
||||
|
||||
protected loadContentActions(config: ExtensionConfig) {
|
||||
if (config && config.features && config.features.content) {
|
||||
return (config.features.content.actions || []).sort(
|
||||
this.sortByOrder
|
||||
);
|
||||
return (config.features.content.actions || [])
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadViewerActions(config: ExtensionConfig) {
|
||||
if (config && config.features && config.features.viewer) {
|
||||
return (config.features.viewer.actions || []).sort(
|
||||
this.sortByOrder
|
||||
);
|
||||
return (config.features.viewer.actions || [])
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected loadContentContextmenuActions(config: ExtensionConfig): Array<ContentActionRef> {
|
||||
protected loadContentContextMenuActions(config: ExtensionConfig): Array<ContentActionRef> {
|
||||
if (config && config.features && config.features.content) {
|
||||
return (config.features.content.contextActions || [])
|
||||
.sort(this.sortByOrder);
|
||||
.sort(this.sortByOrder)
|
||||
.map(this.setActionDefaults);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
@@ -351,6 +352,14 @@ export class ExtensionService implements RuleContext {
|
||||
.filter(action => this.filterByRules(action));
|
||||
}
|
||||
|
||||
setActionDefaults(action: ContentActionRef): ContentActionRef {
|
||||
if (action) {
|
||||
action.type = action.type || ContentActionType.default;
|
||||
action.icon = action.icon || 'extension';
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
reduceSeparators(
|
||||
acc: ContentActionRef[],
|
||||
el: ContentActionRef,
|
||||
|
@@ -8,8 +8,8 @@
|
||||
@import '../components/settings/settings.component.theme';
|
||||
@import '../components/current-user/current-user.component.theme';
|
||||
@import '../components/permission-manager/permissions-manager.component.theme';
|
||||
@import '../components/context-menu/context-menu.component.theme';
|
||||
@import '../dialogs/node-versions/node-versions.dialog.theme';
|
||||
@import '../context-menu/context-menu.component.theme';
|
||||
|
||||
@import './overrides/adf-toolbar.theme';
|
||||
@import './overrides/adf-search-filter.theme';
|
||||
|
Reference in New Issue
Block a user