Various bug fixes

This commit is contained in:
Pieter Vander Vennet 2020-09-14 20:16:03 +02:00
parent 9777a2666b
commit dc5fa5dabc
13 changed files with 103 additions and 111 deletions

View file

@ -31,6 +31,7 @@ export default class AllLayersPanel extends UIElement {
this.createPanels(userDetails);
const self = this;
this.dumbMode = false;
config.map<number>(config => config.layers.length).addCallback(() => self.createPanels(userDetails));
}

View file

@ -65,9 +65,6 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
setting(options?.noLanguage ? TextField.StringInput() : new MultiLingualTextFields(languages)
, "question", "Question", "If the key or mapping doesn't match, this question is asked"),
setting(new AndOrTagInput(), "condition", "Condition",
"Only show this tag rendering if these tags matches. Optional field.<br/>Note that the Overpass-tags are already always included in this object"),
"<h3>Freeform key</h3>",
setting(TextField.KeyInput(true), ["freeform", "key"], "Freeform key<br/>",
"If specified, the rendering will search if this key is present." +
@ -84,9 +81,9 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
const settings: (string | SingleSetting<any>)[] = [
setting(
options?.noLanguage ? TextField.StringInput() :
new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that <span class='literal-code'>{key}</span>-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."),
questionsNotUnlocked ? `You need at least ${State.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data`: "",
new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that <span class='literal-code'>{key}</span>-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."),
questionsNotUnlocked ? `You need at least ${State.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data` : "",
...(options?.disableQuestions ? [] : questionSettings),
"<h3>Mappings</h3>",
@ -94,7 +91,12 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
() => ({if: {and: []}, then: {}}),
() => new MappingInput(languages, options?.disableQuestions ?? false),
undefined, {allowMovement: true}), "mappings",
"If a tag matches, then show the first respective text", "")
"If a tag matches, then show the first respective text", ""),
"<h3>Condition</h3>",
setting(new AndOrTagInput(), "condition", "Only show this tagrendering if the following condition applies",
"Only show this tag rendering if these tags matches. Optional field.<br/>Note that the Overpass-tags are already always included in this object"),
];

View file

@ -2,7 +2,6 @@ import {UIElement} from "../UIElement";
import {UIEventSource} from "../../Logic/UIEventSource";
import TagRenderingPanel from "./TagRenderingPanel";
import {VariableUiElement} from "../Base/VariableUIElement";
import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConfigJson";
import {FromJSON} from "../../Customizations/JSON/FromJSON";
import {FixedUiElement} from "../Base/FixedUiElement";
import Combine from "../Base/Combine";
@ -33,7 +32,6 @@ export default class TagRenderingPreview extends UIElement {
}
let es = tagRenderingPanel.GetValue();
let tagRenderingConfig: TagRenderingConfigJson = es.data;
let rendering: UIElement;
try {

View file

@ -39,7 +39,7 @@ export class FeatureInfoBox extends UIElement {
this._feature = feature;
this._tagsES = tagsES;
this.ListenTo(State.state.osmConnection.userDetails);
this.SetClass("featureinfobox");
const deps = {tags: this._tagsES, changes: this._changes}
this._infoboxes = [];
@ -153,7 +153,7 @@ export class FeatureInfoBox extends UIElement {
this._title,
"<div class='infoboxcontents'>",
infoboxcontents,
"</div>"]).SetClass("featureinfobox")
"</div>"])
.Render();
}

View file

@ -25,6 +25,7 @@ export class MultiInput<T> extends InputElement<T[]> {
super(undefined);
this._value = value ?? new UIEventSource<T[]>([]);
value = this._value;
this.ListenTo(value.map((latest : T[]) => latest.length));
this._options = options ?? {};
this.addTag = new SubtleButton("./assets/addSmall.svg", addAElement)

View file

@ -42,7 +42,7 @@ export class SimpleAddUI extends UIElement {
this._loginButton = Translations.t.general.add.pleaseLogin.Clone().onClick(() => State.state.osmConnection.AttemptLogin());
this._addButtons = [];
this.SetClass("add-ui");
this.SetStyle("font-size:large");
const self = this;
for (const layer of State.state.filteredLayers.data) {
@ -137,10 +137,10 @@ export class SimpleAddUI extends UIElement {
tagInfo = this._confirmPreset.data .tags.map(t => t.asHumanString(csCount > State.userJourney.tagsVisibleAndWikiLinked, true)).join("&");
tagInfo = `<br/>More information about the preset: ${tagInfo}`
}
return new Combine([
Translations.t.general.add.confirmIntro.Subs({title: this._confirmPreset.data.name}),
userDetails.data.dryRun ? "<span class='alert'>TESTING - changes won't be saved</span>":"",
userDetails.data.dryRun ? "<span class='alert'>TESTING - changes won't be saved</span>" : "",
this.confirmButton,
this.cancelButton,
tagInfo

View file

@ -292,14 +292,13 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
private InputElementForMapping(mapping: { k: TagsFilter, txt: (string | Translation) }, substituteValues: boolean): FixedInputElement<TagsFilter> {
if (substituteValues) {
return new FixedInputElement(this.ApplyTemplate(mapping.txt),
mapping.k.substituteValues(this.currentTags.data),
(t0, t1) => t0.isEquivalent(t1)
);
}
return new FixedInputElement(this.ApplyTemplate(mapping.txt), mapping.k,
(t0, t1) => t0.isEquivalent(t1));
(t0, t1) => t1.isEquivalent(t0));
}

View file

@ -191,7 +191,6 @@ export abstract class UIElement extends UIEventSource<string> {
this.clss.push(clss);
this.Update();
}
console.log(this.clss)
return this;
}