Allow dynamic point renderings in studio, fixes #1986

This commit is contained in:
Pieter Vander Vennet 2024-06-19 00:31:38 +02:00
parent ad7976f142
commit 436738ffa2
5 changed files with 600 additions and 368 deletions

View file

@ -1,6 +1,6 @@
{
"name": "mapcomplete",
"version": "0.43.2",
"version": "0.43.3",
"repository": "https://github.com/pietervdvn/MapComplete",
"description": "A small website to edit OSM easily",
"bugs": "https://github.com/pietervdvn/MapComplete/issues",

View file

@ -5,6 +5,7 @@ export interface IconConfigJson {
/**
* question: What icon should be used?
* type: icon
* types: Use a dynamic value ; icon
* suggestions: return Constants.defaultPinIcons.map(i => ({if: "value="+i, then: i, icon: i}))
*/
icon: string | MinimalTagRenderingConfigJson | { builtin: string; override: any }
@ -12,6 +13,7 @@ export interface IconConfigJson {
* question: What colour should the icon be?
* This will only work for the default icons such as `pin`,`circle`,...
* type: color
* types: Use a dynamic color ; icon
*/
color?: string | MinimalTagRenderingConfigJson | { builtin: string; override: any }
}

View file

@ -1660,6 +1660,7 @@
"required": true,
"hints": {
"typehint": "icon",
"types": "Use a dynamic value ; icon",
"question": "What icon should be used?",
"suggestions": [
{
@ -1993,6 +1994,7 @@
"required": false,
"hints": {
"typehint": "color",
"types": "Use a dynamic color ; icon",
"question": "What colour should the icon be?"
},
"type": [
@ -10111,10 +10113,6 @@
"if": "value=bicycle_rental",
"then": "bicycle_rental - Bicycle rental stations"
},
{
"if": "value=bicycle_tube_vending_machine",
"then": "bicycle_tube_vending_machine - A layer showing vending machines for bicycle tubes (either purpose-built bicycle tube vending machines or classical vending machines with bicycle tubes and optionally additional bicycle related objects such as lights, gloves, locks, …)"
},
{
"if": "value=bike_cafe",
"then": "bike_cafe - A bike café is a café geared towards cyclists, for example with services such as a pump, with lots of bicycle-related decoration, …"
@ -10311,6 +10309,10 @@
"if": "value=gps_track",
"then": "gps_track - Meta layer showing the previous locations of the user as single line with controls, e.g. to erase, upload or download this track. Add this to your theme and override the maprendering to change the appearance of the travelled track."
},
{
"if": "value=grave",
"then": "grave - Tombstones (and graves) indicate where a person was buried. On this map, those can be recorded and a link to Wikipedia can be made"
},
{
"if": "value=guidepost",
"then": "guidepost - Guideposts (also known as fingerposts or finger posts) are often found along official hiking/cycling/riding/skiing routes to indicate the directions to different destinations"
@ -10375,6 +10377,10 @@
"if": "value=last_click",
"then": "last_click - This 'layer' is not really a layer, but contains part of the code how the popup to 'add a new marker' is displayed"
},
{
"if": "value=lighthouse",
"then": "lighthouse - undefined"
},
{
"if": "value=love_hotel",
"then": "love_hotel - A love hotel is a type of short-stay hotel found around the world operated primarily for the purpose of allowing guests privacy for sexual activities"
@ -10720,7 +10726,7 @@
}
},
"multiAnswer": {
"description": "If true, use checkboxes instead of radio buttons when asking the question\n\nquestion: Should a contributor be allowed to select multiple mappings?\n\niftrue: allow to select multiple mappings\niffalse: only allow to select a single mapping\nifunset: only allow to select a single mapping",
"description": "question: Should a contributor be allowed to select multiple mappings?\n\nIf true, use checkboxes instead of radio buttons when asking the question.\n\niftrue: allow to select multiple mappings (and show a freeform-value as list if ';'-separated)\niffalse: only allow to select a single mapping\nifunset: only allow to select a single mapping",
"type": "boolean"
},
"freeform": {
@ -10746,11 +10752,6 @@
}
]
},
"helperArgs": {
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'\ngroup: expert",
"type": "array",
"items": {}
},
"addExtraTags": {
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'\ngroup: expert",
"type": "array",
@ -10779,6 +10780,10 @@
"type": "string"
}
]
},
"postfixDistinguished": {
"description": "question: If this key shared and distinguished by a postfix, what is the postfix?\nThis option is used specifically for `charge`, where the cost is indicated with `/item`.\n\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`\n\nifunset: Don't distinguish by postfix\ngroup: expert",
"type": "string"
}
}
},
@ -11542,12 +11547,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -11668,6 +11673,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -11700,19 +11709,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -11852,6 +11848,21 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -12817,12 +12828,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -12946,6 +12957,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -12979,20 +12994,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"override",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -13138,6 +13139,22 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"override",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -13548,6 +13565,18 @@
"type": "object",
"description": "Rewrites and multiplies the given renderings of type T.\nThis can be used for introducing many similar questions automatically,\nwhich also makes translations easier.\n(Note that the key does _not_ need to be wrapped in {}.\nHowever, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts)\nFor example:\n```\n{\n rewrite: {\n sourceString: [\"key\", \"a|b|c\"],\n into: [\n [\"X\", 0]\n [\"Y\", 1],\n [\"Z\", 2]\n ],\n renderings: [{\n \"key\":\"a|b|c\"\n }]\n }\n}\n```\nwill result in _three_ copies (as the values to rewrite into have three values, namely:\n[\n {\n # The first pair: key --> X, a|b|c --> 0\n \"X\": 0\n },\n {\n \"Y\": 1\n },\n {\n \"Z\": 2\n }\n]"
},
{
"path": [
"tagRenderings",
"subexpand"
],
"required": false,
"hints": {
"question": "ion: \"Is some X\","
},
"type": "object",
"description": "Used to expand a sublist.\nE.g. a target `rendering` is:\ne.g.\n{\n rewrite: [\"{{x}}\", \"{{y}}\"],\n into:[\n [\"{{x}}\": \"some X\"],\n [\"{{y}}\", [\"option 1\", \"option 2\"]]\n ],\n renderings:[\n {\n \"question\":\"Is {{x}}\",\n \"mappings\": [\"if={{y}}\",then: \"...\"]\n }\n ]\n subExpand: {\n // The list with the key\n \"mappings\":\n // will be taken and multiplied by all possible values of\n \"{{y}}\"\n // Note that this implies that `into.[*].[{{y}}]` should be a list of items\n }\n}\nExpansion will result in:\n{\n mappings: [{\"if=option 1\", then: \"...\"}, {\"if=option 2\", then: \"...\"}]\n}"
},
{
"path": [
"tagRenderings",
@ -14128,12 +14157,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -14257,6 +14286,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -14290,20 +14323,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"renderings",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -14449,6 +14468,22 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"renderings",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -15452,12 +15487,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -15584,6 +15619,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -15618,21 +15657,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"renderings",
"override",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -15784,6 +15808,23 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"renderings",
"override",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -16781,12 +16822,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -16910,6 +16951,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -16943,20 +16988,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"renderings",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -17102,6 +17133,22 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"renderings",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -18105,12 +18152,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -18237,6 +18284,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -18271,21 +18322,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"tagRenderings",
"renderings",
"override",
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"tagRenderings",
@ -18437,6 +18473,23 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"tagRenderings",
"renderings",
"override",
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"tagRenderings",
@ -19661,7 +19714,7 @@
]
},
"type": "string",
"description": "If set, synchronizes whether or not this layer is enabled."
"description": "If set, synchronizes whether this layer is enabled."
},
{
"path": [
@ -19684,5 +19737,18 @@
},
"type": "boolean",
"description": "_Set automatically by MapComplete, please ignore_"
},
{
"path": [
"enableMorePrivacy"
],
"required": false,
"hints": {
"question": "Should a theme using this layer leak some location info when making changes?",
"iftrue": "Do not write 'change_within_x_m' and do not indicate that this was done by survey",
"ifunset": "Write 'change_within_x_m' as usual and if GPS is enabled"
},
"type": "boolean",
"description": "When a changeset is made, a 'distance to object'-class is written to the changeset.\nFor some particular themes and layers, this might leak too much information, and we want to obfuscate this"
}
]

File diff suppressed because it is too large Load diff

View file

@ -542,12 +542,12 @@
"required": false,
"hints": {
"question": "Should a contributor be allowed to select multiple mappings?",
"iftrue": "allow to select multiple mappings",
"iftrue": "allow to select multiple mappings (and show a freeform-value as list if ';'-separated)",
"iffalse": "only allow to select a single mapping",
"ifunset": "only allow to select a single mapping"
},
"type": "boolean",
"description": "If true, use checkboxes instead of radio buttons when asking the question"
"description": "If true, use checkboxes instead of radio buttons when asking the question."
},
{
"path": [
@ -665,6 +665,10 @@
"if": "value=velopark",
"then": "<b>velopark</b> A special URL-validator that checks the domain name and rewrites to the correct velopark format."
},
{
"if": "value=nsi",
"then": "<b>nsi</b> Gives a list of possible suggestions for a brand or operator tag. "
},
{
"if": "value=currency",
"then": "<b>currency</b> Validates monetary amounts"
@ -696,18 +700,6 @@
],
"description": "A (translated) text that is shown (as gray text) within the textfield"
},
{
"path": [
"freeform",
"helperArgs"
],
"required": false,
"hints": {
"group": "expert"
},
"type": "array",
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
},
{
"path": [
"freeform",
@ -841,6 +833,20 @@
],
"description": "The main representation of Tags.\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for more documentation"
},
{
"path": [
"freeform",
"postfixDistinguished"
],
"required": false,
"hints": {
"group": "expert",
"question": "If this key shared and distinguished by a postfix, what is the postfix?",
"ifunset": "Don't distinguish by postfix"
},
"type": "string",
"description": "This option is used specifically for `charge`, where the cost is indicated with `/item`.\nFor example, a vending machine might sell `bicycle_tube`.\nSetting this value to `bicycle_tube`, then answering this question will set `charge= €XX/bicycle_tube`.\nIf charge did already contain another value, e.g. `charge= €YY/some_item; €ZZ/other_item`, then `€XX/bicycle_tube`will be added.\nNote: those values are sorted alphabetically\nNote: no need to add the `/`"
},
{
"path": [
"question"