mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
unified format for viewer sub-menus (#901)
* unified format for viewer sub-menus * fix tests * update prettier
This commit is contained in:
parent
d2e0f688e8
commit
da3527b0db
@ -30,7 +30,6 @@ All the customizations are stored in the `features` section of the configuration
|
||||
"contextMenu": [],
|
||||
"viewer": {
|
||||
"toolbarActions:": [],
|
||||
"toolbarMoreMenu:": [],
|
||||
"openWith": [],
|
||||
"content": []
|
||||
},
|
||||
@ -243,7 +242,7 @@ 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. |
|
||||
@ -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,8 +465,14 @@ The ACA provides an extension point for this menu that you can utilize to popula
|
||||
|
||||
"features": {
|
||||
"viewer": {
|
||||
"toolbarActions": [...],
|
||||
"toolbarMoreMenu": [
|
||||
"toolbarActions": [
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.share",
|
||||
"order": 300,
|
||||
@ -485,6 +487,8 @@ The ACA provides an extension point for this menu that you can utilize to popula
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -547,18 +551,21 @@ In order to modify or disable existing entries, you need to know the id of the
|
||||
</p>
|
||||
|
||||
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.
|
||||
|
||||
- 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",
|
||||
@ -591,10 +598,12 @@ Review this code snippet to see how you can overwrite the properties for `exif:e
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
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": [
|
||||
@ -631,6 +640,7 @@ Here is the initial setting from `app.extension.json`:
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
<p class="tip">
|
||||
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.
|
||||
|
@ -759,9 +759,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -865,6 +870,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -692,9 +692,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -798,6 +803,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -674,9 +674,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -783,6 +788,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -710,9 +710,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -819,6 +824,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -709,9 +709,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -818,6 +823,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -689,9 +689,14 @@
|
||||
"rules": {
|
||||
"visible": "app.toolbar.canViewFile"
|
||||
}
|
||||
}
|
||||
],
|
||||
"toolbarMoreMenu": [
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -811,6 +816,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
@ -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",
|
||||
|
51
package-lock.json
generated
51
package-lock.json
generated
@ -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": {
|
||||
|
@ -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",
|
||||
|
@ -59,7 +59,6 @@ export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
sharedPreviewUrl$: Observable<string>;
|
||||
actions: Array<ContentActionRef> = [];
|
||||
viewerToolbarActions: Array<ContentActionRef> = [];
|
||||
viewerToolbarMoreActions: Array<ContentActionRef> = [];
|
||||
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);
|
||||
|
@ -32,17 +32,6 @@
|
||||
</ng-container>
|
||||
</adf-viewer-toolbar-actions>
|
||||
|
||||
<adf-viewer-more-actions *ngIf="viewerToolbarMoreActions.length">
|
||||
<ng-container
|
||||
*ngFor="
|
||||
let action of viewerToolbarMoreActions;
|
||||
trackBy: trackByActionId
|
||||
"
|
||||
>
|
||||
<app-toolbar-menu-item [actionRef]="action"></app-toolbar-menu-item>
|
||||
</ng-container>
|
||||
</adf-viewer-more-actions>
|
||||
|
||||
<ng-container *ngFor="let ext of contentExtensions">
|
||||
<adf-viewer-extension [supportedExtensions]="[ext.fileExtension]">
|
||||
<ng-template let-url="urlFileContent" let-extension="extension">
|
||||
|
@ -3,22 +3,16 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.hide-last-divider .adf-viewer-toolbar .mat-toolbar {
|
||||
> adf-toolbar-divider:last-of-type {
|
||||
.adf-viewer-toolbar .adf-toolbar-divider {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> button:last-of-type {
|
||||
right: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
#adf-viewer-moreactions {
|
||||
right: -40px;
|
||||
}
|
||||
|
||||
.adf-viewer-toolbar-actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.adf-toolbar-divider {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ describe('AppExtensionService', () => {
|
||||
});
|
||||
|
||||
it('should filter out all disabled items', () => {
|
||||
const items = [
|
||||
const items: any[] = [
|
||||
{ id: '1', disabled: true },
|
||||
{
|
||||
id: '2',
|
||||
|
@ -71,7 +71,6 @@ export class AppExtensionService implements RuleContext {
|
||||
headerActions: Array<ContentActionRef> = [];
|
||||
toolbarActions: Array<ContentActionRef> = [];
|
||||
viewerToolbarActions: Array<ContentActionRef> = [];
|
||||
viewerToolbarMoreActions: Array<ContentActionRef> = [];
|
||||
viewerContentExtensions: Array<ViewerExtensionRef> = [];
|
||||
contextMenuActions: Array<ContentActionRef> = [];
|
||||
openWithActions: Array<ContentActionRef> = [];
|
||||
@ -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<ViewerExtensionRef>(
|
||||
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<ContentActionRef> {
|
||||
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<ContentActionRef> {
|
||||
return this.viewerToolbarActions.filter(action =>
|
||||
this.filterByRules(action)
|
||||
);
|
||||
}
|
||||
|
||||
getHeaderActions(): Array<ContentActionRef> {
|
||||
return this.headerActions.filter(action => this.filterByRules(action));
|
||||
}
|
||||
|
||||
getViewerToolbarMoreActions(): Array<ContentActionRef> {
|
||||
return this.viewerToolbarMoreActions.filter(action =>
|
||||
this.filterByRules(action)
|
||||
);
|
||||
}
|
||||
|
||||
getAllowedContextMenuActions(): Array<ContentActionRef> {
|
||||
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<ContentActionRef> {
|
||||
return this.getAllowedActions(this.toolbarActions);
|
||||
}
|
||||
|
||||
getViewerToolbarActions(): Array<ContentActionRef> {
|
||||
return this.getAllowedActions(this.viewerToolbarActions);
|
||||
}
|
||||
|
||||
getHeaderActions(): Array<ContentActionRef> {
|
||||
return this.headerActions.filter(action => this.filterByRules(action));
|
||||
}
|
||||
|
||||
getAllowedContextMenuActions(): Array<ContentActionRef> {
|
||||
return this.getAllowedActions(this.contextMenuActions);
|
||||
}
|
||||
|
||||
copyAction(action: ContentActionRef): ContentActionRef {
|
||||
return {
|
||||
...action,
|
||||
|
@ -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,48 +916,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"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.toolbar.more",
|
||||
"type": "menu",
|
||||
"order": 10000,
|
||||
"icon": "more_vert",
|
||||
"title": "APP.ACTIONS.MORE",
|
||||
"children": [
|
||||
{
|
||||
"id": "app.viewer.favorite.add",
|
||||
"order": 100,
|
||||
@ -1021,6 +1026,8 @@
|
||||
"visible": "app.toolbar.permissions"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"content": [
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user