Convert markdown into UIElements
This commit is contained in:
parent
73cec987c9
commit
f5ae73aac1
3 changed files with 28 additions and 10 deletions
|
@ -27,6 +27,7 @@ import FilterConfigJson from "./Json/FilterConfigJson";
|
||||||
import {And} from "../../Logic/Tags/And";
|
import {And} from "../../Logic/Tags/And";
|
||||||
import {Overpass} from "../../Logic/Osm/Overpass";
|
import {Overpass} from "../../Logic/Osm/Overpass";
|
||||||
import Constants from "../Constants";
|
import Constants from "../Constants";
|
||||||
|
import {FixedUiElement} from "../../UI/Base/FixedUiElement";
|
||||||
|
|
||||||
export default class LayerConfig extends WithContextLoader {
|
export default class LayerConfig extends WithContextLoader {
|
||||||
|
|
||||||
|
@ -416,7 +417,8 @@ export default class LayerConfig extends WithContextLoader {
|
||||||
let quickOverview: BaseUIElement = undefined;
|
let quickOverview: BaseUIElement = undefined;
|
||||||
if (tableRows.length > 0) {
|
if (tableRows.length > 0) {
|
||||||
quickOverview = new Combine([
|
quickOverview = new Combine([
|
||||||
"**Warning** This quick overview is incomplete",
|
new FixedUiElement("Warning: ").SetClass("bold"),
|
||||||
|
"this quick overview is incomplete",
|
||||||
new Table(["attribute", "type", "values which are supported by this layer"], tableRows)
|
new Table(["attribute", "type", "values which are supported by this layer"], tableRows)
|
||||||
]).SetClass("flex-col flex")
|
]).SetClass("flex-col flex")
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import Link from "../../UI/Base/Link";
|
||||||
import List from "../../UI/Base/List";
|
import List from "../../UI/Base/List";
|
||||||
import {QuestionableTagRenderingConfigJson} from "./Json/QuestionableTagRenderingConfigJson";
|
import {QuestionableTagRenderingConfigJson} from "./Json/QuestionableTagRenderingConfigJson";
|
||||||
import {FixedUiElement} from "../../UI/Base/FixedUiElement";
|
import {FixedUiElement} from "../../UI/Base/FixedUiElement";
|
||||||
|
import {Paragraph} from "../../UI/Base/Paragraph";
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* The parsed version of TagRenderingConfigJSON
|
* The parsed version of TagRenderingConfigJSON
|
||||||
|
@ -514,7 +515,10 @@ export default class TagRenderingConfig {
|
||||||
withRender = [
|
withRender = [
|
||||||
`This rendering asks information about the property `,
|
`This rendering asks information about the property `,
|
||||||
Link.OsmWiki(this.freeform.key),
|
Link.OsmWiki(this.freeform.key),
|
||||||
`\nThis is rendered with \`${this.render.txt}\``
|
new Paragraph(new Combine([
|
||||||
|
"This is rendered with",
|
||||||
|
new FixedUiElement(this.render.txt).SetClass("literalcode bold")
|
||||||
|
]))
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -522,17 +526,25 @@ export default class TagRenderingConfig {
|
||||||
let mappings: BaseUIElement = undefined;
|
let mappings: BaseUIElement = undefined;
|
||||||
if (this.mappings !== undefined) {
|
if (this.mappings !== undefined) {
|
||||||
mappings = new List(
|
mappings = new List(
|
||||||
this.mappings.map(m => {
|
[].concat(...this.mappings.map(m => {
|
||||||
let txt = "**" + m.then.txt + "** corresponds with " + m.if.asHumanString(true, false, {});
|
const msgs: (string| BaseUIElement)[] = [
|
||||||
|
new Combine(
|
||||||
|
[
|
||||||
|
new FixedUiElement(m.then.txt).SetClass("bold"),
|
||||||
|
"corresponds with",
|
||||||
|
m.if.asHumanString(true, false, {})
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
if (m.hideInAnswer === true) {
|
if (m.hideInAnswer === true) {
|
||||||
txt += "_This option cannot be chosen as answer_"
|
msgs.push(new FixedUiElement("This option cannot be chosen as answer").SetClass("italic"))
|
||||||
}
|
}
|
||||||
if (m.ifnot !== undefined) {
|
if (m.ifnot !== undefined) {
|
||||||
txt += "Unselecting this answer will add " + m.ifnot.asHumanString(true, false, {})
|
msgs.push( "Unselecting this answer will add " + m.ifnot.asHumanString(true, false, {}))
|
||||||
}
|
}
|
||||||
return txt;
|
return msgs;
|
||||||
}
|
}
|
||||||
)
|
))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +571,11 @@ export default class TagRenderingConfig {
|
||||||
}
|
}
|
||||||
return new Combine([
|
return new Combine([
|
||||||
new Title(this.id, 3),
|
new Title(this.id, 3),
|
||||||
this.question !== undefined ? "The question is **" + this.question.txt + "**" : "_This tagrendering has no question and is thus read-only_",
|
this.question !== undefined ?
|
||||||
|
new Combine([ "The question is " , new FixedUiElement( this.question.txt).SetClass("bold")]) :
|
||||||
|
new FixedUiElement(
|
||||||
|
"This tagrendering has no question and is thus read-only"
|
||||||
|
).SetClass("italic"),
|
||||||
new Combine(withRender),
|
new Combine(withRender),
|
||||||
mappings,
|
mappings,
|
||||||
condition,
|
condition,
|
||||||
|
|
Loading…
Reference in a new issue