diff --git a/Customizations/LayerDefinition.ts b/Customizations/LayerDefinition.ts index 1065f43..138102c 100644 --- a/Customizations/LayerDefinition.ts +++ b/Customizations/LayerDefinition.ts @@ -88,7 +88,6 @@ export class LayerDefinition { } } = undefined) { if (options === undefined) { - console.log("No options!") return; } this.name = options.name; @@ -100,7 +99,6 @@ export class LayerDefinition { this.title = options.title; this.elementsToShow = options.elementsToShow; this.style = options.style; - console.log(this) } asLayer(basemap: Basemap, allElements: ElementStorage, changes: Changes, userDetails: UIEventSource, selectedElement: UIEventSource, diff --git a/Customizations/Layers/Bookcases.ts b/Customizations/Layers/Bookcases.ts index 25953f4..16f78d9 100644 --- a/Customizations/Layers/Bookcases.ts +++ b/Customizations/Layers/Bookcases.ts @@ -1,10 +1,8 @@ import {LayerDefinition} from "../LayerDefinition"; import L from "leaflet"; -import {And, Or, Regex, Tag} from "../../Logic/TagsFilter"; -import {QuestionDefinition} from "../../Logic/Question"; +import {And, Or, Tag} from "../../Logic/TagsFilter"; import {TagRenderingOptions} from "../TagRendering"; import {NameInline} from "../Questions/NameInline"; -import {NameQuestion} from "../Questions/NameQuestion"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; export class Bookcases extends LayerDefinition { diff --git a/Customizations/TagRendering.ts b/Customizations/TagRendering.ts index 2b9c8bf..2be71e0 100644 --- a/Customizations/TagRendering.ts +++ b/Customizations/TagRendering.ts @@ -294,7 +294,19 @@ class TagRendering extends UIElement implements TagDependantUIElement { const elements = []; if (options.mappings !== undefined) { + + const previousTexts= []; for (const mapping of options.mappings) { + console.log(mapping); + if(mapping.k === null){ + continue; + } + if(previousTexts.indexOf(mapping.txt) >= 0){ + continue; + } + previousTexts.push(mapping.txt); + + console.log("PUshed") elements.push(this.InputElementForMapping(mapping)); } } @@ -350,6 +362,7 @@ class TagRendering extends UIElement implements TagDependantUIElement { } else if (tag instanceof Tag) { return tag.value } + console.log("Could not decode tag to string", tag) return undefined; } @@ -447,7 +460,7 @@ class TagRendering extends UIElement implements TagDependantUIElement { } - protected InnerRender(): string { + InnerRender(): string { if (this.IsQuestioning() || this._editMode.data) { // Not yet known or questioning, we have to ask a question @@ -492,5 +505,10 @@ class TagRendering extends UIElement implements TagDependantUIElement { return TagUtils.ApplyTemplate(template, tags); } + + InnerUpdate(htmlElement: HTMLElement) { + super.InnerUpdate(htmlElement); + this._questionElement.Update(); // Another manual update for them + } } \ No newline at end of file diff --git a/Logic/Imgur.ts b/Logic/Imgur.ts index bfba380..b41929f 100644 --- a/Logic/Imgur.ts +++ b/Logic/Imgur.ts @@ -60,7 +60,6 @@ export class Imgur { } - console.log(data); const licenseInfo = new LicenseInfo(); licenseInfo.licenseShortName = data.license; diff --git a/Logic/LayerUpdater.ts b/Logic/LayerUpdater.ts index 408d756..5478e89 100644 --- a/Logic/LayerUpdater.ts +++ b/Logic/LayerUpdater.ts @@ -57,8 +57,7 @@ export class LayerUpdater { } private handleFail(reason: any) { - console.log("QUERY FAILED", reason); - console.log("Retrying in 1s") + console.log("QUERY FAILED (retrying in 1 sec)", reason); this.previousBounds = undefined; const self = this; window.setTimeout( @@ -73,7 +72,6 @@ export class LayerUpdater { } console.log("Zoom level: ",this._map.map.getZoom(), "Least needed zoom:", this._minzoom) if (this._map.map.getZoom() < this._minzoom || this._map.Location.data.zoom < this._minzoom) { - console.log("Not running query: zoom not sufficient"); return; } diff --git a/UI/Base/Button.ts b/UI/Base/Button.ts index 3026729..817de11 100644 --- a/UI/Base/Button.ts +++ b/UI/Base/Button.ts @@ -18,7 +18,7 @@ export class Button extends UIElement { } - protected InnerRender(): string { + InnerRender(): string { return "
" + "" + diff --git a/UI/Base/FixedUiElement.ts b/UI/Base/FixedUiElement.ts index 6680b89..0579092 100644 --- a/UI/Base/FixedUiElement.ts +++ b/UI/Base/FixedUiElement.ts @@ -8,7 +8,7 @@ export class FixedUiElement extends UIElement { this._html = html ?? ""; } - protected InnerRender(): string { + InnerRender(): string { return this._html; } diff --git a/UI/Base/VariableUIElement.ts b/UI/Base/VariableUIElement.ts index b1f7f05..8afab13 100644 --- a/UI/Base/VariableUIElement.ts +++ b/UI/Base/VariableUIElement.ts @@ -12,16 +12,8 @@ export class VariableUiElement extends UIElement { } - protected InnerRender(): string { + InnerRender(): string { return this._html.data; } - InnerUpdate(htmlElement: HTMLElement) { - super.InnerUpdate(htmlElement); - if(this._innerUpdate !== undefined){ - this._innerUpdate(htmlElement); - } - } - - } \ No newline at end of file diff --git a/UI/Input/InputElementWrapper.ts b/UI/Input/InputElementWrapper.ts index e04a4f1..979a712 100644 --- a/UI/Input/InputElementWrapper.ts +++ b/UI/Input/InputElementWrapper.ts @@ -26,7 +26,7 @@ export class InputElementWrapper extends InputElement{ return this.input.GetValue(); } - protected InnerRender(): string { + InnerRender(): string { return this.pre.Render() + this.input.Render() + this.post.Render(); } diff --git a/UI/Input/RadioButton.ts b/UI/Input/RadioButton.ts index b463633..647fda1 100644 --- a/UI/Input/RadioButton.ts +++ b/UI/Input/RadioButton.ts @@ -62,7 +62,7 @@ export class RadioButton extends InputElement { return 'radio-' + this.id + '-' + i; } - protected InnerRender(): string { + InnerRender(): string { let body = ""; let i = 0; @@ -83,14 +83,16 @@ export class RadioButton extends InputElement { if (t === undefined) { return; } + console.log("Trying to find an option for", t) // We check that what is selected matches the previous rendering for (let i = 0; i < this._elements.length; i++) { const e = this._elements[i]; if (e.IsValid(t)) { this._selectedElementIndex.setData(i); e.GetValue().setData(t); + const radio = document.getElementById(this.IdFor(i)); // @ts-ignore - document.getElementById(this.IdFor(i)).checked = true; + radio?.checked = true; return; } diff --git a/UI/Input/TextField.ts b/UI/Input/TextField.ts index 32ffb1c..090dc45 100644 --- a/UI/Input/TextField.ts +++ b/UI/Input/TextField.ts @@ -18,8 +18,8 @@ export class TextField extends InputElement { constructor(options: { placeholder?: string | UIElement, - toString?: (t: T) => string, - fromString?: (string: string) => T, + toString: (t: T) => string, + fromString: (string: string) => T, value?: UIEventSource }) { super(undefined); @@ -33,15 +33,18 @@ export class TextField extends InputElement { this.mappedValue.addCallback((t) => this.value.setData(options.toString(t))); - this._placeholder = - typeof(options.placeholder) === "string" ? new FixedUiElement(options.placeholder) : - (options.placeholder ?? new FixedUiElement("")); + options.placeholder = options.placeholder ?? ""; + if (options.placeholder instanceof UIElement) { + this._placeholder = options.placeholder + } else { + this._placeholder = new FixedUiElement(options.placeholder); + } this._toString = options.toString ?? ((t) => ("" + t)); const self = this; this.mappedValue.addCallback((t) => { - if (t === undefined && t === null) { + if (t === undefined || t === null) { return; } const field = document.getElementById('text-' + this.id); @@ -57,7 +60,7 @@ export class TextField extends InputElement { return this.mappedValue; } - protected InnerRender(): string { + InnerRender(): string { return "" + "" + ""; diff --git a/UI/MessageBoxHandler.ts b/UI/MessageBoxHandler.ts index 5ce7bdb..2cdb96e 100644 --- a/UI/MessageBoxHandler.ts +++ b/UI/MessageBoxHandler.ts @@ -45,7 +45,6 @@ export class MessageBoxHandler { update() { const wrapper = document.getElementById("messagesboxmobilewrapper"); const gen = this._uielement.data; - console.log("Generator: ", gen); if (gen === undefined) { wrapper.classList.add("hidden") if (location.hash !== "") { @@ -55,10 +54,6 @@ export class MessageBoxHandler { } location.hash = "#element" wrapper.classList.remove("hidden"); - /* gen() - ?.HideOnEmpty(true) - ?.AttachTo("messagesbox") - ?.Activate();*/ gen() ?.HideOnEmpty(true) diff --git a/UI/SaveButton.ts b/UI/SaveButton.ts index 3bba390..60d8bda 100644 --- a/UI/SaveButton.ts +++ b/UI/SaveButton.ts @@ -12,7 +12,7 @@ export class SaveButton extends UIElement { this._value = value; } - protected InnerRender(): string { + InnerRender(): string { if (this._value.data === undefined || this._value.data === null || this._value.data === "" diff --git a/UI/SimpleAddUI.ts b/UI/SimpleAddUI.ts index b235437..956569b 100644 --- a/UI/SimpleAddUI.ts +++ b/UI/SimpleAddUI.ts @@ -60,7 +60,7 @@ export class SimpleAddUI extends UIElement { } } - protected InnerRender(): string { + InnerRender(): string { const header = "

Geen selectie

" + "Je klikte ergens waar er nog geen gezochte data is.
"; if (!this._userDetails.data.loggedIn) { @@ -83,10 +83,6 @@ export class SimpleAddUI extends UIElement { } InnerUpdate(htmlElement: HTMLElement) { - super.InnerUpdate(htmlElement); - for (const button of this._addButtons) { - button.Update(); - } this._userDetails.data.osmConnection.registerActivateOsmAUthenticationClass(); } diff --git a/UI/UIElement.ts b/UI/UIElement.ts index b4bdd69..700cc5c 100644 --- a/UI/UIElement.ts +++ b/UI/UIElement.ts @@ -100,7 +100,7 @@ export abstract class UIElement { return this; } - protected abstract InnerRender(): string; + public abstract InnerRender(): string; public Activate(): void { for (const i in this) { diff --git a/UI/UserBadge.ts b/UI/UserBadge.ts index c9a2bd5..403cb0b 100644 --- a/UI/UserBadge.ts +++ b/UI/UserBadge.ts @@ -58,7 +58,7 @@ export class UserBadge extends UIElement { } - protected InnerRender(): string { + InnerRender(): string { const user = this._userDetails.data; if (!user.loggedIn) { return "
Klik hier om aan te melden bij OSM
";