-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* icon component, custom svg * split components, fix modules * simplify code * universal icon component * support custom icon registration * update docs * test fixes
- Loading branch information
1 parent
ec3eeb7
commit 99a8192
Showing
30 changed files
with
497 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Custom Icons | ||
|
||
You can register and use custom `.svg` icons with toolbars, context menus, etc. | ||
|
||
The icons are declared in the `features.icons` section, for example: | ||
|
||
```json | ||
{ | ||
"features": { | ||
"icons": [ | ||
{ | ||
"id": "adf:join_library", | ||
"value": "./assets/images/join-library.svg" | ||
}, | ||
{ | ||
"id": "adf:move_file", | ||
"value": "./assets/images/adf-move-file-24px.svg" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
The `id` value must conform to the format `[namespace]:[name]`, | ||
similar to that of the [Material Icon](https://material.angular.io/components/icon/api) component. | ||
The icon file path should be relative to the deployed application root (or `index.html` file); | ||
|
||
After that, you can use the icon id with other elements, for example: | ||
|
||
```json | ||
{ | ||
"id": "app.toolbar.move", | ||
"order": 500, | ||
"title": "APP.ACTIONS.MOVE", | ||
"icon": "adf:move_file", | ||
"actions": { | ||
"click": "MOVE_NODES" | ||
} | ||
} | ||
``` | ||
|
||
It is also possible to override the icon value or disable the entry from within external extensions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
- [Home](/) | ||
- [Documentation](/#documentation) | ||
- [How to contribute](/#how-to-contribute) | ||
- [Documentation](/#documentation) | ||
- [How to contribute](/#how-to-contribute) | ||
- [App features](/features/) | ||
- [User interface layout](/features/user-interface-layout) | ||
- [Header](/features/header) | ||
- [Side navigation](/features/side-navigation) | ||
- [Document List Layout](/features/document-list-layout) | ||
- [File Viewer](/features/file-viewer) | ||
- [Info Drawer](/features/info-drawer) | ||
- [Version Manager](/features/version-manager) | ||
- [Search results](/features/search-results) | ||
- [User interface layout](/features/user-interface-layout) | ||
- [Header](/features/header) | ||
- [Side navigation](/features/side-navigation) | ||
- [Document List Layout](/features/document-list-layout) | ||
- [File Viewer](/features/file-viewer) | ||
- [Info Drawer](/features/info-drawer) | ||
- [Version Manager](/features/version-manager) | ||
- [Search results](/features/search-results) | ||
- [Getting started](/getting-started/) | ||
- [Prerequisites](/getting-started/prerequisites) | ||
- [Building from source](/getting-started/building-from-source) | ||
- [Internationalization (i18n)](/getting-started/internationalization) | ||
- [CORS](/getting-started/cors) | ||
- [Configuration](/getting-started/configuration) | ||
- [Navigation](/getting-started/navigation) | ||
- [Docker](/getting-started/docker) | ||
- [Prerequisites](/getting-started/prerequisites) | ||
- [Building from source](/getting-started/building-from-source) | ||
- [Internationalization (i18n)](/getting-started/internationalization) | ||
- [CORS](/getting-started/cors) | ||
- [Configuration](/getting-started/configuration) | ||
- [Navigation](/getting-started/navigation) | ||
- [Docker](/getting-started/docker) | ||
- [Extending](/extending/) | ||
- [Extensibility features](/extending/extensibility-features) | ||
- [Extension format](/extending/extension-format) | ||
- [Routes](/extending/routes) | ||
- [Components](/extending/components) | ||
- [Actions](/extending/actions) | ||
- [Application actions](/extending/application-actions) | ||
- [Rules](/extending/rules) | ||
- [Application features](/extending/application-features) | ||
- [Registration](/extending/registration) | ||
- [Creating custom evaluators](/extending/creating-custom-evaluators) | ||
- [Tutorials](/extending/tutorials) | ||
- [Redistributable libraries](/extending/redistributable-libraries) | ||
- [Extensibility features](/extending/extensibility-features) | ||
- [Extension format](/extending/extension-format) | ||
- [Routes](/extending/routes) | ||
- [Components](/extending/components) | ||
- [Actions](/extending/actions) | ||
- [Application actions](/extending/application-actions) | ||
- [Rules](/extending/rules) | ||
- [Application features](/extending/application-features) | ||
- [Custom icons](/extending/icons) | ||
- [Registration](/extending/registration) | ||
- [Creating custom evaluators](/extending/creating-custom-evaluators) | ||
- [Tutorials](/extending/tutorials) | ||
- [Redistributable libraries](/extending/redistributable-libraries) | ||
- [Tutorials](/tutorials/) | ||
- [Introduction to extending ACA](/tutorials/introduction-to-extending) | ||
- [Custom route with parameters](/tutorials/custom-route-with-parameters) | ||
- [Dialog actions](/tutorials/dialog-actions) | ||
- [Introduction to extending ACA](/tutorials/introduction-to-extending) | ||
- [Custom route with parameters](/tutorials/custom-route-with-parameters) | ||
- [Dialog actions](/tutorials/dialog-actions) | ||
- [Get help](/help) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<ng-container *ngIf="isCustom; else: default"> | ||
<mat-icon [svgIcon]="value"></mat-icon> | ||
</ng-container> | ||
|
||
<ng-template #default> | ||
<mat-icon>{{ value }}</mat-icon> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.adf-icon { | ||
display: inline-flex; | ||
vertical-align: middle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*! | ||
* @license | ||
* Alfresco Example Content Application | ||
* | ||
* Copyright (C) 2005 - 2018 Alfresco Software Limited | ||
* | ||
* This file is part of the Alfresco Example Content Application. | ||
* If the software was purchased under a paid Alfresco license, the terms of | ||
* the paid license agreement will prevail. Otherwise, the software is | ||
* provided under the following open source license terms: | ||
* | ||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Alfresco Example Content Application is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { | ||
Component, | ||
Input, | ||
ViewEncapsulation, | ||
ChangeDetectionStrategy | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'adf-icon', | ||
templateUrl: './icon.component.html', | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
host: { class: 'adf-icon' }, | ||
styleUrls: ['./icon.component.scss'] | ||
}) | ||
export class IconComponent { | ||
private _value = ''; | ||
private _isCustom = false; | ||
|
||
get value(): string { | ||
return this._value; | ||
} | ||
|
||
@Input() | ||
set value(value: string) { | ||
this._value = value || 'settings'; | ||
this._isCustom = this._value.includes(':'); | ||
} | ||
|
||
get isCustom(): boolean { | ||
return this._isCustom; | ||
} | ||
} |
63 changes: 31 additions & 32 deletions
63
src/app/components/context-menu/context-menu-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
<div class="aca-context-menu"> | ||
<ng-container [ngSwitch]="actionRef.type"> | ||
<ng-container [ngSwitch]="actionRef.type"> | ||
<ng-container *ngSwitchCase="'menu'"> | ||
<button mat-menu-item [id]="actionRef.id" [matMenuTriggerFor]="childMenu"> | ||
<adf-icon [value]="actionRef.icon"></adf-icon> | ||
<span>{{ actionRef.title | translate }}</span> | ||
</button> | ||
|
||
<ng-container *ngSwitchCase="'menu'"> | ||
<button | ||
mat-menu-item | ||
[id]="actionRef.id" | ||
[matMenuTriggerFor]="childMenu"> | ||
<mat-icon color="primary">{{ actionRef.icon }}</mat-icon> | ||
<span>{{ actionRef.title | translate }}</span> | ||
</button> | ||
|
||
<mat-menu #childMenu="matMenu"> | ||
<ng-container *ngFor="let child of actionRef.children; trackBy: trackById"> | ||
<app-context-menu-item [actionRef]="child"></app-context-menu-item> | ||
</ng-container> | ||
</mat-menu> | ||
</ng-container> | ||
|
||
<ng-container *ngSwitchCase="'separator'"> | ||
<mat-divider></mat-divider> | ||
<mat-menu #childMenu="matMenu"> | ||
<ng-container | ||
*ngFor="let child of actionRef.children; trackBy: trackById" | ||
> | ||
<app-context-menu-item [actionRef]="child"></app-context-menu-item> | ||
</ng-container> | ||
</mat-menu> | ||
</ng-container> | ||
|
||
<ng-container *ngSwitchCase="'custom'"> | ||
<adf-dynamic-component [id]="actionRef.component"></adf-dynamic-component> | ||
</ng-container> | ||
<ng-container *ngSwitchCase="'separator'"> | ||
<mat-divider></mat-divider> | ||
</ng-container> | ||
|
||
<ng-container *ngSwitchCase="'custom'"> | ||
<adf-dynamic-component [id]="actionRef.component"></adf-dynamic-component> | ||
</ng-container> | ||
|
||
<ng-container *ngSwitchDefault> | ||
<button mat-menu-item | ||
color="primary" | ||
[id]="actionRef.id" | ||
(click)="runAction()"> | ||
<mat-icon color="primary">{{ actionRef.icon }}</mat-icon> | ||
<span>{{ actionRef.title | translate }}</span> | ||
</button> | ||
</ng-container> | ||
<ng-container *ngSwitchDefault> | ||
<button | ||
mat-menu-item | ||
color="primary" | ||
[id]="actionRef.id" | ||
(click)="runAction()" | ||
> | ||
<adf-icon [value]="actionRef.icon"></adf-icon> | ||
<span>{{ actionRef.title | translate }}</span> | ||
</button> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.