Combine dropped the empty elements, causing them not to be able to update

This commit is contained in:
pietervdvn 2021-02-20 02:25:29 +01:00
parent 5a358a2abc
commit 09599e9f15
3 changed files with 24 additions and 29 deletions

View file

@ -2,7 +2,7 @@ import { Utils } from "../Utils";
export default class Constants {
public static vNumber = "0.5.0-rc2";
public static vNumber = "0.5.0-rc3";
// The user journey states thresholds when a new feature gets unlocked
public static userJourney = {

View file

@ -25,11 +25,7 @@ export default class Combine extends UIElement {
console.error("Not a UI-element", ui);
return "";
}
let rendered = ui.Render();
if(ui.IsEmpty()){
return "";
}
return rendered;
return ui.Render();
}).join("");
}

View file

@ -10,6 +10,7 @@ import TagRenderingConfig from "../../Customizations/JSON/TagRenderingConfig";
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
export default class FeatureInfoBox extends UIElement {
private static featureInfoboxCache: Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>> = new Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>>();
private _component: ScrollableFullScreen;
private constructor(
@ -21,13 +22,25 @@ export default class FeatureInfoBox extends UIElement {
if (layerConfig === undefined) {
throw "Undefined layerconfig"
}
const title = FeatureInfoBox.GenerateTitleBar(tags, layerConfig);
const contents = FeatureInfoBox.GenerateContent(tags, layerConfig);
this._component = new ScrollableFullScreen(title, contents, onClose)
this._component = new ScrollableFullScreen(title, contents, onClose);
}
InnerRender(): string {
return this._component.Render();
static construct(tags: UIEventSource<any>, layer: LayerConfig, onClose: () => void) {
let innerMap = FeatureInfoBox.featureInfoboxCache.get(layer);
if (innerMap === undefined) {
innerMap = new Map<UIEventSource<any>, FeatureInfoBox>();
FeatureInfoBox.featureInfoboxCache.set(layer, innerMap);
}
let featureInfoBox = innerMap.get(tags);
if (featureInfoBox === undefined) {
featureInfoBox = new FeatureInfoBox(tags, layer, onClose);
innerMap.set(tags, featureInfoBox);
}
return featureInfoBox;
}
private static GenerateTitleBar(tags: UIEventSource<any>,
@ -56,8 +69,8 @@ export default class FeatureInfoBox extends UIElement {
let questionBoxIsUsed = false;
const renderings = layerConfig.tagRenderings.map(tr => {
if (tr.question === null) {
questionBoxIsUsed = true;
// This is the question box!
questionBoxIsUsed = true;
return questionBox;
}
return new EditableTagRendering(tags, tr);
@ -75,21 +88,7 @@ export default class FeatureInfoBox extends UIElement {
}
private static featureInfoboxCache : Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>> = new Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>>();
static construct(tags: UIEventSource<any>, layer: LayerConfig, onClose: () => void) {
let innerMap = FeatureInfoBox.featureInfoboxCache.get(layer);
if(innerMap === undefined){
innerMap = new Map<UIEventSource<any>, FeatureInfoBox>();
FeatureInfoBox.featureInfoboxCache.set(layer, innerMap);
}
let featureInfoBox = innerMap.get(tags);
if(featureInfoBox === undefined){
featureInfoBox = new FeatureInfoBox(tags, layer, onClose);
innerMap.set(tags, featureInfoBox);
}
return featureInfoBox;
InnerRender(): string {
return this._component.Render();
}
}