-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #759 from christophercr/feature/app-menu-translati…
…on-support feat(stark-ui): integrate translation support in AppMenu component
- Loading branch information
Showing
18 changed files
with
101 additions
and
33 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/stark-ui/src/modules/app-menu/components/app-menu-config.intf.ts
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,9 +1,17 @@ | ||
import { StarkMenuGroup } from "./app-menu-group.intf"; | ||
import { StarkMenuSection } from "./app-menu-section.intf"; | ||
|
||
/** | ||
* StarkMenuConfig interface | ||
*/ | ||
export interface StarkMenuConfig { | ||
/** | ||
* Array of menu groups to include in the menu. | ||
*/ | ||
menuGroups?: StarkMenuGroup[]; | ||
|
||
/** | ||
* Array of menu sections to include in the menu. The menu sections provide a way to group a set of menu groups. | ||
*/ | ||
menuSections?: StarkMenuSection[]; | ||
} |
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
18 changes: 14 additions & 4 deletions
18
packages/stark-ui/src/modules/app-menu/components/app-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,9 +1,19 @@ | ||
<mat-list-item *ngIf="menuGroup.isVisible" [id]="menuGroup.id" [ngClass]="'stark-app-menu-item-level-'+level.toString()" [class.active]="isActive" [class.stark-disabled]="!menuGroup.isEnabled" [disableRipple]="!menuGroup.isEnabled" (click)="onClick()"> | ||
<mat-icon *ngIf="menuGroup.icon" [color]="isActive?'primary':''" starkSvgViewBox [svgIcon]="menuGroup.icon" class="stark-small-icon"></mat-icon> | ||
<span matLine>{{ menuGroup.label }}</span> | ||
<mat-list-item *ngIf="menuGroup.isVisible" | ||
[id]="menuGroup.id" | ||
[ngClass]="'stark-app-menu-item-level-'+level.toString()" | ||
[class.active]="isActive" [class.stark-disabled]="!menuGroup.isEnabled" | ||
[disableRipple]="!menuGroup.isEnabled" (click)="onClick()"> | ||
<mat-icon *ngIf="menuGroup.icon" | ||
[color]="isActive ? 'primary' : ''" | ||
starkSvgViewBox [svgIcon]="menuGroup.icon" | ||
class="stark-small-icon"></mat-icon> | ||
<span matLine translate>{{ menuGroup.label }}</span> | ||
</mat-list-item> | ||
<mat-expansion-panel *ngIf="menuGroup.entries" #menuGroupsPanel> | ||
<mat-nav-list> | ||
<stark-app-menu-item *ngFor="let entry of menuGroup.entries; trackBy: trackMenuItem" [level]="level+1" [menuGroup]="entry" (activated)="onActivate()" (deactivated)="onDeactivate()"></stark-app-menu-item> | ||
<stark-app-menu-item *ngFor="let entry of menuGroup.entries; trackBy: trackMenuItem" | ||
[level]="level+1" | ||
[menuGroup]="entry" (activated)="onActivate()" | ||
(deactivated)="onDeactivate()"></stark-app-menu-item> | ||
</mat-nav-list> | ||
</mat-expansion-panel> |
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
9 changes: 9 additions & 0 deletions
9
packages/stark-ui/src/modules/app-menu/components/app-menu-section.intf.ts
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,8 +1,17 @@ | ||
import { StarkMenuGroup } from "./app-menu-group.intf"; | ||
|
||
/** | ||
* StarkMenuSection interface | ||
*/ | ||
export interface StarkMenuSection { | ||
/** | ||
* Text to be displayed as the label in the header of the menu section | ||
* (dynamically translated via the Translate service if the provided text is defined in the translation keys). | ||
*/ | ||
label: string; | ||
|
||
/** | ||
* Array of menu groups to include in this section. | ||
*/ | ||
menuGroups: StarkMenuGroup[]; | ||
} |
6 changes: 3 additions & 3 deletions
6
packages/stark-ui/src/modules/app-menu/components/app-menu.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
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
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
2 changes: 1 addition & 1 deletion
2
packages/stark-ui/src/modules/date-range-picker/components/date-range-picker.component.ts
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 |
---|---|---|
@@ -1 +1 @@ | ||
<stark-app-menu [parentMenuConfig]="menuWithSections"></stark-app-menu> | ||
<stark-app-menu [menuConfig]="menuWithSections"></stark-app-menu> |
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 +1 @@ | ||
<stark-app-menu [parentMenuConfig]="simpleMenu"></stark-app-menu> | ||
<stark-app-menu [menuConfig]="simpleMenu"></stark-app-menu> |
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