@WidgetComponent
File
Metadata
selector |
nm-imarket-empty-widget |
styleUrls |
emptywidget.component.scss |
templateUrl |
./emptywidget.component.html |
Index
Widget inputs
|
|
|
|
|
|
Widget outputs
|
|
Properties
|
|
Methods
|
|
Methods
Protected
configureWidget
|
configureWidget(configuration: WidgetConfig)
|
Decorators : WidgetConfigure
|
|
|
Public
enableOverlay
|
enableOverlay: Subject<boolean>
|
Type : Subject<boolean>
|
Default value : new Subject<boolean>()
|
Decorators : WidgetInput
|
|
Input that enables or disables the overlay
|
Public
hide
|
hide: Subject<any>
|
Type : Subject<any>
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
|
Input that hides or shows widget
|
Public
title
|
title: Subject<any>
|
Type : Subject<any>
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
|
Appends text to the title shown in the empty widget header
|
Public
titleAdditionInput
|
titleAdditionInput: Subject<string>
|
Type : Subject<string>
|
Default value : new Subject<string>()
|
Decorators : WidgetInput
|
|
Sets additional title of empty widget
|
Private
unsubscribe
|
unsubscribe:
|
Default value : NgUnsubscribe.create()
|
|
import { Component } from "@angular/core";
import { WidgetConfig, getOrDefault } from "../../widget.configuration";
import {
WidgetComponent,
WidgetConfiguration,
WidgetConfigure,
WidgetInput,
} from "../../widget.metadata";
import { ReplaySubject, Subject } from "rxjs";
import { takeUntil } from "rxjs/operators";
import { NgUnsubscribe } from "../../../ng-unsubscribe";
import { BaseConfiguration } from "../../widgetframe/widgetframe.component";
export interface IMarketEmptyWidgetConfiguration extends BaseConfiguration {
/**
* Enables header for empty widget @default(true)
*/
withHeader?: boolean;
/**
* Hides empty widget @default(false)
*/
hideWidget?: boolean;
/**
* Sets overlay message
*/
overlayMessage?: string;
/**
* Sets width of empty widget
*/
width?: string;
}
@WidgetComponent("nm-imarket-empty-widget")
@Component({
selector: "nm-imarket-empty-widget",
templateUrl: "./emptywidget.component.html",
styleUrls: ["./emptywidget.component.scss"],
})
export class IMarketEmptyWidgetComponent {
@WidgetConfiguration()
public configuration: WidgetConfig<IMarketEmptyWidgetConfiguration>;
/**
* Input that hides or shows widget
*/
@WidgetInput("hide")
public hide: Subject<any> = new ReplaySubject<any>();
/**
* Sets additional title of empty widget
*/
@WidgetInput("titleAdditionInput")
public titleAdditionInput: Subject<string> = new Subject<string>();
/**
* Input that enables or disables the overlay
*/
@WidgetInput("enableOverlay")
public enableOverlay: Subject<boolean> = new Subject<boolean>();
/**
* Appends text to the title shown in the empty widget header
*/
@WidgetInput("title")
public title: Subject<any> = new ReplaySubject<any>();
public withHeader: boolean;
public hideWidget: boolean;
public titleAddition: string;
public overlayMessage: string;
public widgetTitle: string;
private unsubscribe = NgUnsubscribe.create();
@WidgetConfigure()
protected configureWidget(
configuration: WidgetConfig<IMarketEmptyWidgetConfiguration>
) {
this.withHeader = getOrDefault(
this.configuration.configuration.withHeader,
true
);
this.hideWidget = getOrDefault(
this.configuration.configuration.hideWidget,
false
);
this.overlayMessage = this.configuration.configuration.overlayMessage;
this.widgetTitle = this.configuration.configuration.title;
this.titleAdditionInput
.asObservable()
.pipe(takeUntil(this.unsubscribe))
.subscribe((info) => {
this.titleAddition = info;
});
this.hide
.asObservable()
.pipe(takeUntil(this.unsubscribe))
.subscribe((hide) => {
this.hideWidget = hide;
});
this.title
.asObservable()
.pipe(takeUntil(this.unsubscribe))
.subscribe((title) => {
this.widgetTitle = title;
});
}
}
<nm-widgetframe
[visible]="!hideWidget"
[toolbarInvisible]="!withHeader"
[configuration]="configuration"
[header]="configuration.configuration.header"
[width]="configuration.configuration.width"
[infoTitle]="configuration.configuration.title"
[infoText]="configuration.configuration.infoText"
[wikiLink]="configuration.configuration.wikiLink"
[withBorder]="configuration.configuration.withBorder"
[infoWidth]="'550px'"
[infoPlacement]="'bottom'"
>
<ng-container slot="title" class="nm-widgetframe__title">
<span> {{ widgetTitle | translate }} </span>
<span *ngIf="titleAddition"> ({{ titleAddition }}) </span>
</ng-container>
<ng-container slot="content" class="nm-widgetframe__content">
<nm-overlay
[overlayMessage]="overlayMessage"
[enableOverlay]="enableOverlay"
></nm-overlay>
</ng-container>
</nm-widgetframe>
Legend
Html element with directive