forked from MapComplete/MapComplete
More work on the custom theme generator, kindof works now
This commit is contained in:
parent
1fa6a8edfb
commit
ee9c9e201f
24 changed files with 1192 additions and 2265 deletions
62
UI/CustomGenerator/LayerPanelWithPreview.ts
Normal file
62
UI/CustomGenerator/LayerPanelWithPreview.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import SingleSetting from "./SingleSetting";
|
||||
import LayerPanel from "./LayerPanel";
|
||||
import HelpText from "../../Customizations/HelpText";
|
||||
import {MultiTagInput} from "../Input/MultiTagInput";
|
||||
import {FromJSON} from "../../Customizations/JSON/FromJSON";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import TagRenderingPanel from "./TagRenderingPanel";
|
||||
import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConfigJson";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import Combine from "../Base/Combine";
|
||||
import PageSplit from "../Base/PageSplit";
|
||||
import TagRenderingPreview from "./TagRenderingPreview";
|
||||
|
||||
|
||||
export default class LayerPanelWithPreview extends UIElement{
|
||||
private panel: UIElement;
|
||||
|
||||
constructor(config: UIEventSource<any>, languages: UIEventSource<string[]>, index: number) {
|
||||
super();
|
||||
|
||||
const currentlySelected = new UIEventSource<(SingleSetting<any>)>(undefined);
|
||||
const layer = new LayerPanel(config, languages, index, currentlySelected);
|
||||
const helpText = new HelpText(currentlySelected);
|
||||
|
||||
const previewTagInput = new MultiTagInput();
|
||||
previewTagInput.GetValue().setData(["id=123456"]);
|
||||
|
||||
const previewTagValue = previewTagInput.GetValue().map(tags => {
|
||||
const properties = {};
|
||||
for (const str of tags) {
|
||||
const tag = FromJSON.SimpleTag(str);
|
||||
if (tag !== undefined) {
|
||||
properties[tag.key] = tag.value;
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
});
|
||||
|
||||
const preview = new TagRenderingPreview(layer.selectedTagRendering, previewTagValue);
|
||||
|
||||
this.panel = new PageSplit(
|
||||
layer.SetClass("scrollable"),
|
||||
new Combine([
|
||||
helpText,
|
||||
"</br>",
|
||||
"<h2>Testing tags</h2>",
|
||||
previewTagInput,
|
||||
"<h2>Tag Rendering preview</h2>",
|
||||
preview
|
||||
|
||||
]), 60
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
return this.panel.Render();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue