Intermediate refactoring

This commit is contained in:
Pieter Vander Vennet 2020-07-20 18:24:00 +02:00
parent 069cddf034
commit 7b80e945bb
16 changed files with 43 additions and 44 deletions

View file

@ -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<UserDetails>, selectedElement: UIEventSource<any>,

View file

@ -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 {

View file

@ -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
}
}