@WidgetComponent
File
Metadata
selector |
nm-footer |
styleUrls |
footer.component.scss |
templateUrl |
./footer.component.html |
Index
Widget inputs
|
|
Widget outputs
|
|
Properties
|
|
Methods
|
|
Constructor
constructor(translateService: TranslateService, dialog: MatDialog)
|
|
Parameters :
Name |
Type |
Optional |
translateService |
TranslateService
|
no
|
dialog |
MatDialog
|
no
|
|
Methods
Protected
configureWidget
|
configureWidget(configuration: WidgetConfig)
|
Decorators : WidgetConfigure
|
|
|
openTextPopup
|
openTextPopup(currentLink: )
|
|
Parameters :
Name |
Optional |
currentLink |
no
|
|
Public
_id
|
_id:
|
Decorators : WidgetId
|
|
Public
dialog
|
dialog: MatDialog
|
Type : MatDialog
|
|
Public
translateService
|
translateService: TranslateService
|
Type : TranslateService
|
|
import { Component } from "@angular/core";
import { WidgetConfig } from "../widget.configuration";
import {
WidgetComponent,
WidgetId,
WidgetConfiguration,
WidgetConfigure,
} from "../widget.metadata";
import { MatDialog } from "@angular/material/dialog";
import { TranslateService } from "@ngx-translate/core";
import { TextDialogComponent } from "../../components/dialog/textDialog.component";
export interface FooterLink {
/**
* Sets the type of the link target.
* Currently it supports the value 'popup' only
*/
type: string;
/**
* Sets the link name (displayed in the footer) and the title of the pop-up opened when clicking the link.
* It could be set with a localization key (e.g. "infotext.help") to show a localized name / title
*/
name: string;
/**
* Sets the message displayed in the pop-up opened when clicking the link.
* It could be set with a localization key (e.g. "infotext.help.message") to show a localized message
*/
content: string;
}
export interface FooterWidgetConfiguration {
/**
* Sets the links to be displayed in the footer
*/
links: FooterLink[];
}
@WidgetComponent("nm-footer")
@Component({
selector: "nm-footer",
templateUrl: "./footer.component.html",
styleUrls: ["./footer.component.scss"],
})
export class FooterWidgetComponent {
@WidgetId()
public _id;
@WidgetConfiguration()
public configuration: WidgetConfig<FooterWidgetConfiguration>;
public links: FooterLink[] = [];
constructor(
public translateService: TranslateService,
public dialog: MatDialog
) {}
@WidgetConfigure()
protected configureWidget(
configuration: WidgetConfig<FooterWidgetConfiguration>
) {
this.links = configuration.configuration.links;
}
openTextPopup(currentLink) {
if (currentLink.type === "popup") {
let dialogRef = this.dialog.open(TextDialogComponent, {
autoFocus: false,
});
dialogRef.componentInstance["title"] = this.translateService.instant(
currentLink.name
);
dialogRef.componentInstance["message"] = this.translateService.instant(
currentLink.content
);
dialogRef.componentInstance[
"buttonCloseTitle"
] = this.translateService.instant("button.close");
}
}
}
<footer class="nm-footer-toolbar mat-toolbar mat-toolbar-single-row">
<button
mat-button
class="nm-footer-links"
(click)="openTextPopup(link)"
*ngFor="let link of links"
>
{{ link.name | translate }}
</button>
</footer>
Legend
Html element with directive