nm-icon-cell
src/app/shared/widgets/imarket/list-cell-icon/icon-widget.component.ts
selector | nm-icon-cell |
styleUrls | icon-widget.component.scss |
templateUrl | ./icon-widget.component.html |
Widget inputs |
Widget outputs |
Properties |
|
Methods |
|
Protected configureWidget | ||||||
configureWidget(configuration: WidgetConfig
|
||||||
Decorators : WidgetConfigure
|
||||||
Parameters :
Returns :
void
|
Public configuration |
configuration:
|
Type : WidgetConfig<IconWidgetConfiguration>
|
Decorators : WidgetConfiguration
|
Public flagIcons |
flagIcons:
|
Type : boolean
|
Public row |
row:
|
Type : any
|
Public selectedIcon |
selectedIcon:
|
Type : Subject<any>
|
Default value : new Subject<any>()
|
Decorators : WidgetOutput
|
import { Component } from "@angular/core";
import {
WidgetComponent,
WidgetConfiguration,
WidgetConfigure,
WidgetOutput,
} from "../../widget.metadata";
import { WidgetConfig, getOrDefault } from "../../widget.configuration";
import { BaseConfiguration } from "../../../widgets/widgetframe/widgetframe.component";
import { CellWidget } from "../../../components/list-cell";
import { Subject } from "rxjs";
export interface IconWidgetConfiguration extends BaseConfiguration {
svg?: boolean;
flagIcons: boolean;
}
@WidgetComponent("nm-icon-cell")
@Component({
selector: "nm-icon-cell",
templateUrl: "./icon-widget.component.html",
styleUrls: ["./icon-widget.component.scss"],
})
export class IconWidgetComponent implements CellWidget {
public row: any;
public flagIcons: boolean;
@WidgetOutput("selectedIcon")
public selectedIcon: Subject<any> = new Subject<any>();
@WidgetConfiguration()
public configuration: WidgetConfig<IconWidgetConfiguration>;
@WidgetConfigure()
protected configureWidget(
configuration: WidgetConfig<IconWidgetConfiguration>
) {
this.flagIcons = getOrDefault(
this.configuration.configuration.flagIcons,
false
);
}
}
<nm-icon [data]="row" [flagIcons]="flagIcons" (selectedIcon)="selectedIcon.next($event)"></nm-icon>