forked from MapComplete/MapComplete
Studio: fix dynamic markers
This commit is contained in:
parent
e0a755aa6a
commit
25075bf881
20 changed files with 28 additions and 26 deletions
|
@ -2,7 +2,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -2,7 +2,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -588,7 +588,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -582,7 +582,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -479,7 +479,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -473,7 +473,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -260,7 +260,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -254,7 +254,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -281,7 +281,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -334,7 +334,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -328,7 +328,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -396,7 +396,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -390,7 +390,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -208,7 +208,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"icon": {
|
||||
"description": "question: What icon should be used?\ntype: icon\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"description": "question: What icon should be used?\ntypes: <span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/MinimalTagRenderingConfigJson"
|
||||
|
|
|
@ -4,7 +4,6 @@ import { TagConfigJson } from "./TagConfigJson"
|
|||
export interface IconConfigJson {
|
||||
/**
|
||||
* question: What icon should be used?
|
||||
* type: icon
|
||||
* types: <span class="text-lg font-bold">Use a different icon depending on the value of some attributes</span> ; icon
|
||||
* suggestions: return Constants.defaultPinIcons.map(i => ({if: "value="+i, then: i, icon: i}))
|
||||
*/
|
||||
|
|
|
@ -97,11 +97,17 @@
|
|||
currentValue.ping()
|
||||
}
|
||||
|
||||
function genTitle(value: any, singular: string, i: number) {
|
||||
if (schema.hints.title) {
|
||||
return Function("value", "return " + schema.hints.title)(value)
|
||||
function genTitle(value: any, singular: string, i: number): Translation {
|
||||
try {
|
||||
|
||||
if (schema.hints.title) {
|
||||
const v = Function("value", "return " + schema.hints.title)(value)
|
||||
return Translations.T(v)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Warning: could not translate a title for " + `${singular} ${i} with function ` + schema.hints.title + " and value " + JSON.stringify(value))
|
||||
}
|
||||
return `${singular} ${i}`
|
||||
return Translations.T(`${singular} ${i}`)
|
||||
}
|
||||
|
||||
let genIconF: (x: any) => { icon: string; color: string } = <any>(
|
||||
|
@ -166,7 +172,7 @@
|
|||
|
||||
{#if schema.hints.title}
|
||||
<div class="subtle ml-2">
|
||||
<Tr t={Translations.T(genTitle(value, singular, i))} />
|
||||
<Tr t={genTitle(value, singular, i)} />
|
||||
</div>
|
||||
{/if}
|
||||
</h3>
|
||||
|
@ -182,7 +188,7 @@
|
|||
{:else if typeof value === "string"}
|
||||
Builtin: <b>{value}</b>
|
||||
{:else}
|
||||
<Tr cls="font-bold" t={Translations.T(value?.question ?? value?.render)}/>
|
||||
<Tr cls="font-bold" t={Translations.T(value?.question ?? value?.render)} />
|
||||
{/if}
|
||||
</span>
|
||||
<div class="normal-background p-2">
|
||||
|
|
|
@ -1662,7 +1662,6 @@
|
|||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "icon",
|
||||
"types": "<span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon",
|
||||
"question": "What icon should be used?",
|
||||
"suggestions": [
|
||||
|
|
|
@ -3661,7 +3661,6 @@
|
|||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "icon",
|
||||
"types": "<span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon",
|
||||
"question": "What icon should be used?",
|
||||
"suggestions": [
|
||||
|
@ -24245,7 +24244,6 @@
|
|||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "icon",
|
||||
"types": "<span class=\"text-lg font-bold\">Use a different icon depending on the value of some attributes</span> ; icon",
|
||||
"question": "What icon should be used?",
|
||||
"suggestions": [
|
||||
|
|
Loading…
Reference in a new issue