2020-10-14 12:15:09 +02:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
2020-10-27 01:01:34 +01:00
|
|
|
import LayerConfig from "../../Customizations/JSON/LayerConfig";
|
|
|
|
import EditableTagRendering from "./EditableTagRendering";
|
|
|
|
import QuestionBox from "./QuestionBox";
|
|
|
|
import Combine from "../Base/Combine";
|
|
|
|
import TagRenderingAnswer from "./TagRenderingAnswer";
|
2020-06-27 03:06:51 +02:00
|
|
|
|
|
|
|
export class FeatureInfoBox extends UIElement {
|
2020-10-27 01:01:34 +01:00
|
|
|
private _tags: UIEventSource<any>;
|
|
|
|
private _layerConfig: LayerConfig;
|
2020-06-27 03:06:51 +02:00
|
|
|
|
2020-10-27 01:01:34 +01:00
|
|
|
private _title : UIElement;
|
|
|
|
private _titleIcons: UIElement;
|
|
|
|
private _renderings: UIElement[];
|
|
|
|
private _questionBox : UIElement;
|
2020-07-22 00:18:07 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
constructor(
|
2020-07-22 01:07:32 +02:00
|
|
|
feature: any,
|
2020-10-27 01:01:34 +01:00
|
|
|
tags: UIEventSource<any>,
|
|
|
|
layerConfig: LayerConfig
|
2020-06-27 03:06:51 +02:00
|
|
|
) {
|
2020-10-27 01:01:34 +01:00
|
|
|
super();
|
|
|
|
this._tags = tags;
|
|
|
|
this._layerConfig = layerConfig;
|
2020-06-27 03:06:51 +02:00
|
|
|
|
2020-09-13 00:53:24 +02:00
|
|
|
|
2020-10-27 01:01:34 +01:00
|
|
|
this._title = new TagRenderingAnswer(tags, layerConfig.title)
|
|
|
|
.SetClass("featureinfobox-title");
|
|
|
|
this._titleIcons = new Combine(
|
|
|
|
layerConfig.titleIcons.map(icon => new TagRenderingAnswer(tags, icon)))
|
|
|
|
.SetClass("featureinfobox-icons");
|
|
|
|
this._renderings = layerConfig.tagRenderings.map(tr => new EditableTagRendering(tags, tr));
|
|
|
|
this._questionBox = new QuestionBox(tags, layerConfig.tagRenderings);
|
2020-09-13 00:53:24 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
InnerRender(): string {
|
2020-09-13 00:53:24 +02:00
|
|
|
return new Combine([
|
2020-10-27 01:01:34 +01:00
|
|
|
new Combine([this._title, this._titleIcons])
|
|
|
|
.SetClass("featureinfobox-titlebar"),
|
|
|
|
...this._renderings,
|
|
|
|
this._questionBox
|
|
|
|
]).Render();
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|
2020-07-20 15:54:50 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|