From da3527b0dbc56d7fbf8057f254394a9503e683c0 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Sun, 20 Jan 2019 11:13:55 +0000 Subject: [PATCH] unified format for viewer sub-menus (#901) * unified format for viewer sub-menus * fix tests * update prettier --- docs/extending/application-features.md | 158 +++++----- .../context-submenus-ext.json | 213 +++++++------ .../document-presets-ext.json | 213 +++++++------ .../extensions-default.json | 219 ++++++------- .../extensibility-configs/header-ext.json | 219 ++++++------- .../extensibility-configs/metadata-ext.json | 219 ++++++------- .../extensibility-configs/viewer-ext.json | 227 ++++++------- extension.schema.json | 6 - package-lock.json | 51 ++- package.json | 4 +- src/app/components/page.component.ts | 2 - .../components/preview/preview.component.html | 11 - .../components/preview/preview.component.scss | 18 +- src/app/extensions/extension.service.spec.ts | 2 +- src/app/extensions/extension.service.ts | 64 ++-- src/assets/app.extensions.json | 297 +++++++++--------- 16 files changed, 976 insertions(+), 947 deletions(-) diff --git a/docs/extending/application-features.md b/docs/extending/application-features.md index cecaac05f..73730fecb 100644 --- a/docs/extending/application-features.md +++ b/docs/extending/application-features.md @@ -30,7 +30,6 @@ All the customizations are stored in the `features` section of the configuration "contextMenu": [], "viewer": { "toolbarActions:": [], - "toolbarMoreMenu:": [], "openWith": [], "content": [] }, @@ -242,14 +241,14 @@ on how to register your own entries to be re-used at runtime. ### Tab properties -| Name | Description | -| ------------- | ----------------------------------------------------------- | -| **id** | Unique identifier. | -| **component** | The main [component](/extending/components) to use for the route. | -| **title** | Tab title or resource key. | -| icon | Tab icon | -| disabled | Toggles disabled state. Can be assigned from other plugins. | -| order | The order of the element. | +| Name | Description | +| ------------- | ----------------------------------------------------------------- | +| **id** | Unique identifier. | +| **component** | The main [component](/extending/components) to use for the route. | +| **title** | Tab title or resource key. | +| icon | Tab icon | +| disabled | Toggles disabled state. Can be assigned from other plugins. | +| order | The order of the element. | ### Tab components @@ -378,7 +377,6 @@ Viewer component in ACA supports the following extension points: "viewer": { "content": [], "toolbarActions:": [], - "toolbarMoreMenu:": [], "openWith": [] } } @@ -451,15 +449,13 @@ New viewer toolbar actions can also be added from the extensions config: "visible": "app.toolbar.versions" } } - ], - "toolbarMoreMenu": [...] + ] } } } ``` -The ADF Viewer component allows you to provide custom entries for the `More` menu button on the toolbar. -The ACA provides an extension point for this menu that you can utilize to populate custom menu items: +You can also provide sub-menus: ```json { @@ -469,19 +465,27 @@ The ACA provides an extension point for this menu that you can utilize to popula "features": { "viewer": { - "toolbarActions": [...], - "toolbarMoreMenu": [ + "toolbarActions": [ { - "id": "app.viewer.share", - "order": 300, - "title": "Share", - "icon": "share", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.selection.file.canShare" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.share", + "order": 300, + "title": "Share", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } + } + ] } ] } @@ -532,69 +536,74 @@ As with other content actions, custom plugins can disable, update or extend `Ope ## Content metadata presets -The content metadata presets are needed by the [Content Metadata Component](https://alfresco.github.io/adf-component-catalog/components/ContentMetadataComponent.html#readme) to render the properties of metadata aspects for a given node. +The content metadata presets are needed by the [Content Metadata Component](https://alfresco.github.io/adf-component-catalog/components/ContentMetadataComponent.html#readme) to render the properties of metadata aspects for a given node. The different aspects and their properties are configured in the `app.config.json` file, but they can also be set on runtime through extension files. -Configuring these presets from `app.extensions.json` will overwrite the default application setting. +Configuring these presets from `app.extensions.json` will overwrite the default application setting. Settings them from custom plugins allows user to disable, update or extend these presets. Check out more info about merging extensions [here](/extending/extension-format#merging-properties). The `content-metadata-presets` elements can be switched off by setting the `disabled` property. -This can be applied also for nested items, allowing disabling down to aspect level. +This can be applied also for nested items, allowing disabling down to aspect level.

In order to modify or disable existing entries, you need to know the id of the target element, along with its parents ids.

Your extensions can perform the following actions at runtime: -* Add new presets items. -* Add new items to existing presets at any level. -* Disable specific items down to the aspect level. -* Modify any existing item based on id. + +- Add new presets items. +- Add new items to existing presets at any level. +- Disable specific items down to the aspect level. +- Modify any existing item based on id. Regarding properties, you can either: - * Add new properties to existing aspect, or - * Redefine the properties of an aspect. - -Review this code snippet to see how you can overwrite the properties for `exif:exif` aspect from an external plugin: -```json - { - "$schema": "../../../extension.schema.json", - "$version": "1.0.0", - "$name": "plugin1", - "features": { - "content-metadata-presets": [ - { - "id": "app.content.metadata.custom", - "custom": [ - { - "id": "app.content.metadata.customGroup", - "items": [ - { - "id": "app.content.metadata.exifAspect", - "disabled": true - }, - { - "id": "app.content.metadata.exifAspect2", - "aspect": "exif:exif", - "properties": [ - "exif:orientation", - "exif:manufacturer", - "exif:model", - "exif:software" - ] - } - ] - } - ] - } - ] - } - } -``` -This external plugin disables the initial `exif:exif` aspect already defined in the `app.extensions.json` and defines other properties for the `exif:exif` aspect. +- Add new properties to existing aspect, or +- Redefine the properties of an aspect. + +Review this code snippet to see how you can overwrite the properties for `exif:exif` aspect from an external plugin: + +```json +{ + "$schema": "../../../extension.schema.json", + "$version": "1.0.0", + "$name": "plugin1", + + "features": { + "content-metadata-presets": [ + { + "id": "app.content.metadata.custom", + "custom": [ + { + "id": "app.content.metadata.customGroup", + "items": [ + { + "id": "app.content.metadata.exifAspect", + "disabled": true + }, + { + "id": "app.content.metadata.exifAspect2", + "aspect": "exif:exif", + "properties": [ + "exif:orientation", + "exif:manufacturer", + "exif:model", + "exif:software" + ] + } + ] + } + ] + } + ] + } +} +``` + +This external plugin disables the initial `exif:exif` aspect already defined in the `app.extensions.json` and defines other properties for the `exif:exif` aspect. Here is the initial setting from `app.extension.json`: + ```json ... "content-metadata-presets": [ @@ -630,7 +639,8 @@ Here is the initial setting from `app.extension.json`: ] ... -``` +``` +

In order to allow the content-metadata presets to be extended, the settings from `app.config.json` must be copied to the `app.extensions.json` file and its ids must be added to all the items. Having ids allows external plugins to extend the current setting. diff --git a/e2e/resources/extensibility-configs/context-submenus-ext.json b/e2e/resources/extensibility-configs/context-submenus-ext.json index 5f86b51fd..51c26e0c2 100644 --- a/e2e/resources/extensibility-configs/context-submenus-ext.json +++ b/e2e/resources/extensibility-configs/context-submenus-ext.json @@ -759,111 +759,118 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.share", - "type": "custom", - "order": 300, - "component": "app.shared-link.toggleSharedLink", - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "type": "custom", + "order": 300, + "component": "app.shared-link.toggleSharedLink", + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [ diff --git a/e2e/resources/extensibility-configs/document-presets-ext.json b/e2e/resources/extensibility-configs/document-presets-ext.json index 5797cc32d..45f006c3d 100644 --- a/e2e/resources/extensibility-configs/document-presets-ext.json +++ b/e2e/resources/extensibility-configs/document-presets-ext.json @@ -692,111 +692,118 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.share", - "type": "custom", - "order": 300, - "component": "app.shared-link.toggleSharedLink", - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "type": "custom", + "order": 300, + "component": "app.shared-link.toggleSharedLink", + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [ diff --git a/e2e/resources/extensibility-configs/extensions-default.json b/e2e/resources/extensibility-configs/extensions-default.json index d46e6fa11..348d85289 100644 --- a/e2e/resources/extensibility-configs/extensions-default.json +++ b/e2e/resources/extensibility-configs/extensions-default.json @@ -674,114 +674,121 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.share", - "order": 300, - "title": "APP.ACTIONS.SHARE", - "icon": "share", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "order": 300, + "title": "APP.ACTIONS.SHARE", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [ diff --git a/e2e/resources/extensibility-configs/header-ext.json b/e2e/resources/extensibility-configs/header-ext.json index 5439bd575..7d3f5086a 100644 --- a/e2e/resources/extensibility-configs/header-ext.json +++ b/e2e/resources/extensibility-configs/header-ext.json @@ -710,114 +710,121 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.share", - "order": 300, - "title": "APP.ACTIONS.SHARE", - "icon": "share", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "order": 300, + "title": "APP.ACTIONS.SHARE", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [ diff --git a/e2e/resources/extensibility-configs/metadata-ext.json b/e2e/resources/extensibility-configs/metadata-ext.json index 01273636f..a93b3d156 100644 --- a/e2e/resources/extensibility-configs/metadata-ext.json +++ b/e2e/resources/extensibility-configs/metadata-ext.json @@ -709,114 +709,121 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.share", - "order": 300, - "title": "APP.ACTIONS.SHARE", - "icon": "share", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.share", + "order": 300, + "title": "APP.ACTIONS.SHARE", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [ diff --git a/e2e/resources/extensibility-configs/viewer-ext.json b/e2e/resources/extensibility-configs/viewer-ext.json index 74f0ce529..352f137e2 100644 --- a/e2e/resources/extensibility-configs/viewer-ext.json +++ b/e2e/resources/extensibility-configs/viewer-ext.json @@ -689,127 +689,134 @@ "rules": { "visible": "app.toolbar.canViewFile" } - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } }, { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" + "id": "app.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.toolbar.my-secondary-action", - "order": 150, - "title": "My secondary action", - "icon": "alarm", - "actions": { - "click": "PRINT_FILE" + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } }, - "rules": { - "visible": "app.toolbar.canViewFile" - } - }, - { - "id": "app.viewer.share", - "order": 300, - "title": "APP.ACTIONS.SHARE", - "icon": "share", - "actions": { - "click": "SHARE_NODE" + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } }, - "rules": { - "visible": "app.selection.file.canShare" - } - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" + { + "id": "app.toolbar.my-secondary-action", + "order": 150, + "title": "My secondary action", + "icon": "alarm", + "actions": { + "click": "PRINT_FILE" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "My new title", - "icon": "library_books", - "actions": { - "click": "MOVE_NODES" + { + "id": "app.viewer.share", + "order": 300, + "title": "APP.ACTIONS.SHARE", + "icon": "share", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.canShare" + } }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" + { + "id": "app.viewer.move", + "order": 500, + "title": "My new title", + "icon": "library_books", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "disabled": true, - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } }, - "rules": { - "visible": "app.toolbar.permissions" + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "disabled": true, + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } } + ] } ], "content": [ diff --git a/extension.schema.json b/extension.schema.json index 5d2786a0b..cd9fb2d71 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -674,12 +674,6 @@ "items": { "$ref": "#/definitions/contentActionRef" }, "minItems": 1 }, - "toolbarMoreMenu": { - "description": "Toolbar entries from the More actions menu", - "type": "array", - "items": { "$ref": "#/definitions/contentActionRef" }, - "minItems": 1 - }, "toolbarActions": { "description": "Toolbar entries from outside the More menu", "type": "array", diff --git a/package-lock.json b/package-lock.json index d84bafc10..fb1eb8259 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3100,6 +3100,7 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -6443,7 +6444,8 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6467,13 +6469,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6490,19 +6494,22 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6633,7 +6640,8 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6647,6 +6655,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6663,6 +6672,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6671,13 +6681,15 @@ "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6698,6 +6710,7 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6786,7 +6799,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6800,6 +6814,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6895,7 +6910,8 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6937,6 +6953,7 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6958,6 +6975,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7006,13 +7024,15 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "dev": true + "dev": true, + "optional": true } } }, @@ -10366,7 +10386,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true + "dev": true, + "optional": true }, "loose-envify": { "version": "1.4.0", @@ -12665,9 +12686,9 @@ "dev": true }, "prettier": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz", - "integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.16.0.tgz", + "integrity": "sha512-MCBCYeAuZfejUPdEpkleLWvpRBwLii/Sp5jQs0eb8Ul/drGIDjkL6tAU24tk6yCGf0KPV5rhPPPlczfBmN2pWQ==", "dev": true }, "pretty-format": { diff --git a/package.json b/package.json index e332e49fd..2ee7944f2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "e2e:docker": "npm run start:docker && npm run e2e && npm run stop:docker", "spellcheck": "cspell 'src/**/*.ts' 'e2e/**/*.ts' 'projects/**/*.ts'", "inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json", - "format:check": "prettier --list-different \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"", + "format:check": "prettier --check \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"", "format:fix": "prettier --write \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"", "build.tomcat": "npm run build -- --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .", "build.tomcat.e2e": "./build-tomcat-e2e.sh", @@ -93,7 +93,7 @@ "lint-staged": "^8.1.0", "ng-packagr": "^4.4.0", "pre-commit": "^1.2.2", - "prettier": "^1.15.3", + "prettier": "^1.16.0", "protractor": "^5.4.0", "rimraf": "2.6.2", "rxjs-tslint-rules": "^4.11.0", diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 3184392c4..3494898c2 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -59,7 +59,6 @@ export abstract class PageComponent implements OnInit, OnDestroy { sharedPreviewUrl$: Observable; actions: Array = []; viewerToolbarActions: Array = []; - viewerToolbarMoreActions: Array = []; canUpdateNode = false; canUpload = false; @@ -101,7 +100,6 @@ export abstract class PageComponent implements OnInit, OnDestroy { this.selection = selection; this.actions = this.extensions.getAllowedToolbarActions(); this.viewerToolbarActions = this.extensions.getViewerToolbarActions(); - this.viewerToolbarMoreActions = this.extensions.getViewerToolbarMoreActions(); this.canUpdateNode = this.selection.count === 1 && this.content.canUpdateNode(selection.first); diff --git a/src/app/components/preview/preview.component.html b/src/app/components/preview/preview.component.html index 1bb50988b..998a327b1 100644 --- a/src/app/components/preview/preview.component.html +++ b/src/app/components/preview/preview.component.html @@ -32,17 +32,6 @@ - - - - - - diff --git a/src/app/components/preview/preview.component.scss b/src/app/components/preview/preview.component.scss index 69d1ddb3c..f75a7fc5b 100644 --- a/src/app/components/preview/preview.component.scss +++ b/src/app/components/preview/preview.component.scss @@ -3,22 +3,16 @@ height: 100%; } -.hide-last-divider .adf-viewer-toolbar .mat-toolbar { - > adf-toolbar-divider:last-of-type { - display: none; - } - - > button:last-of-type { - right: 40px; - } -} - -#adf-viewer-moreactions { - right: -40px; +.adf-viewer-toolbar .adf-toolbar-divider { + display: none; } .adf-viewer-toolbar-actions { display: flex; flex-direction: row; align-items: center; + + .adf-toolbar-divider { + display: inline; + } } diff --git a/src/app/extensions/extension.service.spec.ts b/src/app/extensions/extension.service.spec.ts index 4709cbf6b..0e7629b22 100644 --- a/src/app/extensions/extension.service.spec.ts +++ b/src/app/extensions/extension.service.spec.ts @@ -586,7 +586,7 @@ describe('AppExtensionService', () => { }); it('should filter out all disabled items', () => { - const items = [ + const items: any[] = [ { id: '1', disabled: true }, { id: '2', diff --git a/src/app/extensions/extension.service.ts b/src/app/extensions/extension.service.ts index 18952f002..7c945da43 100644 --- a/src/app/extensions/extension.service.ts +++ b/src/app/extensions/extension.service.ts @@ -71,7 +71,6 @@ export class AppExtensionService implements RuleContext { headerActions: Array = []; toolbarActions: Array = []; viewerToolbarActions: Array = []; - viewerToolbarMoreActions: Array = []; viewerContentExtensions: Array = []; contextMenuActions: Array = []; openWithActions: Array = []; @@ -148,10 +147,6 @@ export class AppExtensionService implements RuleContext { config, 'features.viewer.toolbarActions' ); - this.viewerToolbarMoreActions = this.loader.getContentActions( - config, - 'features.viewer.toolbarMoreMenu' - ); this.viewerContentExtensions = this.loader.getElements( config, 'features.viewer.content' @@ -295,7 +290,7 @@ export class AppExtensionService implements RuleContext { return { presets }; } - filterDisabled(object) { + filterDisabled(object: Array<{ disabled: boolean }> | { disabled: boolean }) { if (Array.isArray(object)) { return object .filter(item => !item.disabled) @@ -398,45 +393,8 @@ export class AppExtensionService implements RuleContext { return actionRef; } - // evaluates content actions for the selection and parent folder node - getAllowedToolbarActions(): Array { - return this.toolbarActions - .filter(action => this.filterByRules(action)) - .map(action => { - if (action.type === ContentActionType.menu) { - const copy = this.copyAction(action); - if (copy.children && copy.children.length > 0) { - copy.children = copy.children - .filter(childAction => this.filterByRules(childAction)) - .sort(sortByOrder) - .reduce(reduceSeparators, []); - } - return copy; - } - return action; - }) - .reduce(reduceEmptyMenus, []) - .reduce(reduceSeparators, []); - } - - getViewerToolbarActions(): Array { - return this.viewerToolbarActions.filter(action => - this.filterByRules(action) - ); - } - - getHeaderActions(): Array { - return this.headerActions.filter(action => this.filterByRules(action)); - } - - getViewerToolbarMoreActions(): Array { - return this.viewerToolbarMoreActions.filter(action => - this.filterByRules(action) - ); - } - - getAllowedContextMenuActions(): Array { - return this.contextMenuActions + private getAllowedActions(actions: ContentActionRef[]): ContentActionRef[] { + return (actions || []) .filter(action => this.filterByRules(action)) .map(action => { if (action.type === ContentActionType.menu) { @@ -456,6 +414,22 @@ export class AppExtensionService implements RuleContext { .reduce(reduceSeparators, []); } + getAllowedToolbarActions(): Array { + return this.getAllowedActions(this.toolbarActions); + } + + getViewerToolbarActions(): Array { + return this.getAllowedActions(this.viewerToolbarActions); + } + + getHeaderActions(): Array { + return this.headerActions.filter(action => this.filterByRules(action)); + } + + getAllowedContextMenuActions(): Array { + return this.getAllowedActions(this.contextMenuActions); + } + copyAction(action: ContentActionRef): ContentActionRef { return { ...action, diff --git a/src/assets/app.extensions.json b/src/assets/app.extensions.json index 4c3cc3634..599721faa 100644 --- a/src/assets/app.extensions.json +++ b/src/assets/app.extensions.json @@ -850,6 +850,47 @@ ], "viewer": { "toolbarActions": [ + { + "id": "app.viewer.fullscreen", + "order": 100, + "title": "APP.ACTIONS.FULLSCREEN", + "icon": "fullscreen", + "actions": { + "click": "FULLSCREEN_VIEWER" + }, + "rules": { + "visible": "app.toolbar.canViewFile" + } + }, + { + "id": "app.viewer.separator.1", + "type": "separator", + "order": 180 + }, + { + "id": "app.viewer.share", + "order": 200, + "title": "APP.ACTIONS.SHARE", + "icon": "link", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.toolbar.canShare" + } + }, + { + "id": "app.viewer.share.edit", + "order": 250, + "title": "APP.ACTIONS.SHARE_EDIT", + "icon": "link", + "actions": { + "click": "SHARE_NODE" + }, + "rules": { + "visible": "app.selection.file.isShared" + } + }, { "id": "app.viewer.download", "order": 300, @@ -875,151 +916,117 @@ } }, { - "id": "app.viewer.share", - "order": 200, - "title": "APP.ACTIONS.SHARE", - "icon": "link", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.toolbar.canShare" - } - }, - { - "id": "app.viewer.share.edit", - "order": 201, - "title": "APP.ACTIONS.SHARE_EDIT", - "icon": "link", - "actions": { - "click": "SHARE_NODE" - }, - "rules": { - "visible": "app.selection.file.isShared" - } - }, - { - "id": "app.viewer.fullscreen", - "order": 100, - "title": "APP.ACTIONS.FULLSCREEN", - "icon": "fullscreen", - "actions": { - "click": "FULLSCREEN_VIEWER" - }, - "rules": { - "visible": "app.toolbar.canViewFile" - } - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 180 - } - ], - "toolbarMoreMenu": [ - { - "id": "app.viewer.favorite.add", - "order": 100, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star_border", - "actions": { - "click": "ADD_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canAdd" - } - }, - { - "id": "app.viewer.favorite.remove", - "order": 200, - "title": "APP.ACTIONS.FAVORITE", - "icon": "star", - "actions": { - "click": "REMOVE_FAVORITE" - }, - "rules": { - "visible": "app.toolbar.favorite.canRemove" - } - }, - { - "id": "app.viewer.favorite", - "comment": "workaround for Recent Files and Search API issue", - "type": "custom", - "order": 101, - "component": "app.toolbar.toggleFavorite", - "rules": { - "visible": "app.toolbar.favorite.canToggle" - } - }, - { - "id": "app.viewer.more.separator.1", - "type": "separator", - "order": 280 - }, - { - "id": "app.viewer.copy", - "order": 400, - "title": "APP.ACTIONS.COPY", - "icon": "content_copy", - "actions": { - "click": "COPY_NODES" - }, - "rules": { - "visible": "app.toolbar.canCopyNode" - } - }, - { - "id": "app.viewer.move", - "order": 500, - "title": "APP.ACTIONS.MOVE", - "icon": "adf:move_file", - "actions": { - "click": "MOVE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.delete", - "order": 600, - "title": "APP.ACTIONS.DELETE", - "icon": "delete", - "actions": { - "click": "DELETE_NODES" - }, - "rules": { - "visible": "app.selection.canDelete" - } - }, - { - "id": "app.viewer.more.separator.2", - "type": "separator", - "order": 680 - }, - { - "id": "app.viewer.versions", - "order": 700, - "title": "APP.ACTIONS.VERSIONS", - "icon": "history", - "actions": { - "click": "MANAGE_VERSIONS" - }, - "rules": { - "visible": "app.toolbar.versions" - } - }, - { - "id": "app.viewer.permissions", - "order": 800, - "title": "APP.ACTIONS.PERMISSIONS", - "icon": "settings_input_component", - "actions": { - "click": "MANAGE_PERMISSIONS" - }, - "rules": { - "visible": "app.toolbar.permissions" - } + "id": "app.viewer.toolbar.more", + "type": "menu", + "order": 10000, + "icon": "more_vert", + "title": "APP.ACTIONS.MORE", + "children": [ + { + "id": "app.viewer.favorite.add", + "order": 100, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star_border", + "actions": { + "click": "ADD_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canAdd" + } + }, + { + "id": "app.viewer.favorite.remove", + "order": 200, + "title": "APP.ACTIONS.FAVORITE", + "icon": "star", + "actions": { + "click": "REMOVE_FAVORITE" + }, + "rules": { + "visible": "app.toolbar.favorite.canRemove" + } + }, + { + "id": "app.viewer.favorite", + "comment": "workaround for Recent Files and Search API issue", + "type": "custom", + "order": 101, + "component": "app.toolbar.toggleFavorite", + "rules": { + "visible": "app.toolbar.favorite.canToggle" + } + }, + { + "id": "app.viewer.more.separator.1", + "type": "separator", + "order": 280 + }, + { + "id": "app.viewer.copy", + "order": 400, + "title": "APP.ACTIONS.COPY", + "icon": "content_copy", + "actions": { + "click": "COPY_NODES" + }, + "rules": { + "visible": "app.toolbar.canCopyNode" + } + }, + { + "id": "app.viewer.move", + "order": 500, + "title": "APP.ACTIONS.MOVE", + "icon": "adf:move_file", + "actions": { + "click": "MOVE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.delete", + "order": 600, + "title": "APP.ACTIONS.DELETE", + "icon": "delete", + "actions": { + "click": "DELETE_NODES" + }, + "rules": { + "visible": "app.selection.canDelete" + } + }, + { + "id": "app.viewer.more.separator.2", + "type": "separator", + "order": 680 + }, + { + "id": "app.viewer.versions", + "order": 700, + "title": "APP.ACTIONS.VERSIONS", + "icon": "history", + "actions": { + "click": "MANAGE_VERSIONS" + }, + "rules": { + "visible": "app.toolbar.versions" + } + }, + { + "id": "app.viewer.permissions", + "order": 800, + "title": "APP.ACTIONS.PERMISSIONS", + "icon": "settings_input_component", + "actions": { + "click": "MANAGE_PERMISSIONS" + }, + "rules": { + "visible": "app.toolbar.permissions" + } + } + ] } ], "content": [