Refactoring: fix delete indication, fix splitroad, fix addition of multiple new points snapped onto the same way (all will properly attach now)

This commit is contained in:
Pieter Vander Vennet 2023-04-20 17:42:07 +02:00
parent 1f9aacfb29
commit 4172af6a72
118 changed files with 1422 additions and 1357 deletions

View file

@ -591,6 +591,13 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
): { result: LayerConfigJson; errors?: string[]; warnings?: string[]; information?: string[] } {
json = JSON.parse(JSON.stringify(json))
if (
json.tagRenderings &&
!json.tagRenderings.some((tr) => tr === "just_created" || tr["id"] === "just_created")
) {
json.tagRenderings.unshift(this._desugaring.tagRenderings.get("just_created"))
}
if (json.allowSplit && !ValidationUtils.hasSpecialVisualisation(json, "split_button")) {
json.tagRenderings.push({
id: "split-button",

View file

@ -18,6 +18,12 @@ export interface TagRenderingConfigJson {
*/
labels?: string[]
/**
* A list of css-classes to apply to the entire tagRendering if the answer is known (not applied on the question).
* This is only for advanced users
*/
classes?: string | string[]
/**
* A human-readable text explaining what this tagRendering does
*/

View file

@ -69,7 +69,7 @@ export default class TagRenderingConfig {
public readonly mappings?: Mapping[]
public readonly labels: string[]
public readonly classes: string[]
constructor(json: string | QuestionableTagRenderingConfigJson, context?: string) {
if (json === undefined) {
throw "Initing a TagRenderingConfig with undefined in " + context
@ -110,6 +110,11 @@ export default class TagRenderingConfig {
}
this.labels = json.labels ?? []
if (typeof json.classes === "string") {
this.classes = json.classes.split(" ")
} else {
this.classes = json.classes ?? []
}
this.render = Translations.T(<any>json.render, translationKey + ".render")
this.question = Translations.T(json.question, translationKey + ".question")
this.questionhint = Translations.T(json.questionHint, translationKey + ".questionHint")