forked from MapComplete/MapComplete
UI(specialVis): only 'leftover-questions' now hides tagRenderings with 'hidden'-label by default, rename variables for imageCarousel and use ';'-separated values
This commit is contained in:
parent
e92dae92b7
commit
b507f799ed
4 changed files with 12 additions and 24 deletions
|
@ -1,18 +1,6 @@
|
||||||
import {
|
import { Concat, DesugaringContext, DesugaringStep, Each, FirstOf, Fuse, On, SetDefault } from "./Conversion"
|
||||||
Concat,
|
|
||||||
DesugaringContext,
|
|
||||||
DesugaringStep,
|
|
||||||
Each,
|
|
||||||
FirstOf,
|
|
||||||
Fuse,
|
|
||||||
On,
|
|
||||||
SetDefault,
|
|
||||||
} from "./Conversion"
|
|
||||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||||
import {
|
import { MinimalTagRenderingConfigJson, TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
|
||||||
MinimalTagRenderingConfigJson,
|
|
||||||
TagRenderingConfigJson,
|
|
||||||
} from "../Json/TagRenderingConfigJson"
|
|
||||||
import { Utils } from "../../../Utils"
|
import { Utils } from "../../../Utils"
|
||||||
import RewritableConfigJson from "../Json/RewritableConfigJson"
|
import RewritableConfigJson from "../Json/RewritableConfigJson"
|
||||||
import SpecialVisualizations from "../../../UI/SpecialVisualizations"
|
import SpecialVisualizations from "../../../UI/SpecialVisualizations"
|
||||||
|
@ -262,6 +250,7 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
||||||
/* At this point, we know which question labels are not yet handled and which already are handled, and we
|
/* At this point, we know which question labels are not yet handled and which already are handled, and we
|
||||||
* know there is no previous catch-all questions
|
* know there is no previous catch-all questions
|
||||||
*/
|
*/
|
||||||
|
seen.add("hidden")
|
||||||
const question: QuestionableTagRenderingConfigJson = {
|
const question: QuestionableTagRenderingConfigJson = {
|
||||||
id: "leftover-questions",
|
id: "leftover-questions",
|
||||||
render: {
|
render: {
|
||||||
|
@ -879,7 +868,7 @@ export class AddRatingBadge extends DesugaringStep<LayerConfigJson> {
|
||||||
const funcs = new Set<string>(specialVis.map((rs) => rs.func.funcName))
|
const funcs = new Set<string>(specialVis.map((rs) => rs.func.funcName))
|
||||||
|
|
||||||
if (funcs.has("list_reviews")) {
|
if (funcs.has("list_reviews")) {
|
||||||
;(<(string | TagRenderingConfigJson)[]>json.titleIcons).push("icons.rating")
|
(<(string | TagRenderingConfigJson)[]>json.titleIcons).push("icons.rating")
|
||||||
}
|
}
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
import type { OsmTags } from "../../Models/OsmFeature"
|
import type { OsmTags } from "../../Models/OsmFeature"
|
||||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||||
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
|
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
|
||||||
import SelectedElementView from "../BigComponents/SelectedElementView.svelte"
|
|
||||||
import TagRenderingAnswer from "./TagRendering/TagRenderingAnswer.svelte"
|
import TagRenderingAnswer from "./TagRendering/TagRenderingAnswer.svelte"
|
||||||
import TagRenderingEditableDynamic from "./TagRendering/TagRenderingEditableDynamic.svelte"
|
import TagRenderingEditableDynamic from "./TagRendering/TagRenderingEditableDynamic.svelte"
|
||||||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
||||||
|
@ -38,6 +37,8 @@
|
||||||
<TagRenderingAnswer {tags} {layer} config={headerTr} {state} {selectedElement} />
|
<TagRenderingAnswer {tags} {layer} config={headerTr} {state} {selectedElement} />
|
||||||
</div>
|
</div>
|
||||||
{#each trgs as config (config.id)}
|
{#each trgs as config (config.id)}
|
||||||
<TagRenderingEditableDynamic {tags} {config} {state} {selectedElement} {layer} />
|
{#if config.IsKnown($tags) && (config.condition === undefined || config.condition.matchesProperties($tags))}
|
||||||
|
<TagRenderingEditableDynamic {tags} {config} {state} {selectedElement} {layer} />
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</AccordionSingle>
|
</AccordionSingle>
|
||||||
|
|
|
@ -65,7 +65,7 @@ export class ImageVisualisations {
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
name: "image_key",
|
name: "image_key",
|
||||||
defaultValue: AllImageProviders.defaultKeys.join(","),
|
defaultValue: AllImageProviders.defaultKeys.join(";"),
|
||||||
doc: "The keys given to the images, e.g. if <span class='literal-code'>image</span> is given, the first picture URL will be added as <span class='literal-code'>image</span>, the second as <span class='literal-code'>image:0</span>, the third as <span class='literal-code'>image:1</span>, etc... Multiple values are allowed if ';'-separated ",
|
doc: "The keys given to the images, e.g. if <span class='literal-code'>image</span> is given, the first picture URL will be added as <span class='literal-code'>image</span>, the second as <span class='literal-code'>image:0</span>, the third as <span class='literal-code'>image:1</span>, etc... Multiple values are allowed if ';'-separated ",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -73,7 +73,7 @@ export class ImageVisualisations {
|
||||||
constr: (state, tags, args) => {
|
constr: (state, tags, args) => {
|
||||||
let imagePrefixes: string[] = undefined
|
let imagePrefixes: string[] = undefined
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
imagePrefixes = [].concat(...args.map((a) => a.split(",")))
|
imagePrefixes = [].concat(...args.map((a) => a.split(";")))
|
||||||
}
|
}
|
||||||
const images = AllImageProviders.loadImagesFor(tags, imagePrefixes)
|
const images = AllImageProviders.loadImagesFor(tags, imagePrefixes)
|
||||||
const estimated = tags.mapD((tags) =>
|
const estimated = tags.mapD((tags) =>
|
||||||
|
@ -89,8 +89,9 @@ export class ImageVisualisations {
|
||||||
needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls],
|
needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
name: "image-key",
|
name: "image_key",
|
||||||
doc: "Image tag to add the URL to (or image-tag:0, image-tag:1 when multiple images are added)",
|
doc: "Image tag to add the URL to (or image-tag:0, image-tag:1 when multiple images are added)",
|
||||||
|
defaultValue: "panoramax",
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ class QuestionViz implements SpecialVisualizationSvelte {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "blacklisted-labels",
|
name: "blacklisted-labels",
|
||||||
doc: "One or more ';'-separated labels of questions which should _not_ be included. Default: 'hidden'",
|
doc: "One or more ';'-separated labels of questions which should _not_ be included. Note that the questionbox which is added by default will blacklist 'hidden'"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
svelteBased = true
|
svelteBased = true
|
||||||
|
@ -50,9 +50,6 @@ class QuestionViz implements SpecialVisualizationSvelte {
|
||||||
?.split(";")
|
?.split(";")
|
||||||
?.map((s) => s.trim())
|
?.map((s) => s.trim())
|
||||||
?.filter((s) => s !== "")
|
?.filter((s) => s !== "")
|
||||||
if (blacklist.length === 0) {
|
|
||||||
blacklist.push("hidden")
|
|
||||||
}
|
|
||||||
return new SvelteUIElement(Questionbox, {
|
return new SvelteUIElement(Questionbox, {
|
||||||
layer,
|
layer,
|
||||||
tags,
|
tags,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue