From 25075bf881d2bc90036cf2c9d8cfba5d3f15a735 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 16 Jul 2024 23:06:26 +0200 Subject: [PATCH] Studio: fix dynamic markers --- Docs/Schemas/IconConfigJson.schema.json | 2 +- Docs/Schemas/IconConfigJsonJSC.ts | 2 +- Docs/Schemas/LayerConfigJson.schema.json | 2 +- Docs/Schemas/LayerConfigJsonJSC.ts | 2 +- Docs/Schemas/LayoutConfigJson.schema.json | 2 +- Docs/Schemas/LayoutConfigJsonJSC.ts | 2 +- .../LineRenderingConfigJson.schema.json | 2 +- Docs/Schemas/LineRenderingConfigJsonJSC.ts | 2 +- Docs/Schemas/MappingConfigJson.schema.json | 2 +- Docs/Schemas/MappingConfigJsonJSC.ts | 2 +- .../PointRenderingConfigJson.schema.json | 2 +- Docs/Schemas/PointRenderingConfigJsonJSC.ts | 2 +- ...stionableTagRenderingConfigJson.schema.json | 2 +- .../QuestionableTagRenderingConfigJsonJSC.ts | 2 +- Docs/Schemas/RewritableConfigJson.schema.json | 2 +- Docs/Schemas/RewritableConfigJsonJSC.ts | 2 +- .../Json/PointRenderingConfigJson.ts | 1 - src/UI/Studio/SchemaBasedArray.svelte | 18 ++++++++++++------ src/assets/schemas/layerconfigmeta.json | 1 - src/assets/schemas/layoutconfigmeta.json | 2 -- 20 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Docs/Schemas/IconConfigJson.schema.json b/Docs/Schemas/IconConfigJson.schema.json index b88ee7eb5c..55a092fc54 100644 --- a/Docs/Schemas/IconConfigJson.schema.json +++ b/Docs/Schemas/IconConfigJson.schema.json @@ -2,7 +2,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/IconConfigJsonJSC.ts b/Docs/Schemas/IconConfigJsonJSC.ts index 27c9d34d1e..5350d63367 100644 --- a/Docs/Schemas/IconConfigJsonJSC.ts +++ b/Docs/Schemas/IconConfigJsonJSC.ts @@ -2,7 +2,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LayerConfigJson.schema.json b/Docs/Schemas/LayerConfigJson.schema.json index 64bf6a0ae2..813886e203 100644 --- a/Docs/Schemas/LayerConfigJson.schema.json +++ b/Docs/Schemas/LayerConfigJson.schema.json @@ -588,7 +588,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LayerConfigJsonJSC.ts b/Docs/Schemas/LayerConfigJsonJSC.ts index ceb3d20d57..081f0b0db1 100644 --- a/Docs/Schemas/LayerConfigJsonJSC.ts +++ b/Docs/Schemas/LayerConfigJsonJSC.ts @@ -582,7 +582,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LayoutConfigJson.schema.json b/Docs/Schemas/LayoutConfigJson.schema.json index 262a083621..86d663ac3f 100644 --- a/Docs/Schemas/LayoutConfigJson.schema.json +++ b/Docs/Schemas/LayoutConfigJson.schema.json @@ -479,7 +479,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LayoutConfigJsonJSC.ts b/Docs/Schemas/LayoutConfigJsonJSC.ts index 85d0e8fb1c..0365d9044c 100644 --- a/Docs/Schemas/LayoutConfigJsonJSC.ts +++ b/Docs/Schemas/LayoutConfigJsonJSC.ts @@ -473,7 +473,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LineRenderingConfigJson.schema.json b/Docs/Schemas/LineRenderingConfigJson.schema.json index 43a7dd60ea..d7ba3d7a2a 100644 --- a/Docs/Schemas/LineRenderingConfigJson.schema.json +++ b/Docs/Schemas/LineRenderingConfigJson.schema.json @@ -260,7 +260,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/LineRenderingConfigJsonJSC.ts b/Docs/Schemas/LineRenderingConfigJsonJSC.ts index dcd069e11d..ab350931a9 100644 --- a/Docs/Schemas/LineRenderingConfigJsonJSC.ts +++ b/Docs/Schemas/LineRenderingConfigJsonJSC.ts @@ -254,7 +254,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/MappingConfigJson.schema.json b/Docs/Schemas/MappingConfigJson.schema.json index 7c290771d6..76009aebe3 100644 --- a/Docs/Schemas/MappingConfigJson.schema.json +++ b/Docs/Schemas/MappingConfigJson.schema.json @@ -287,7 +287,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/MappingConfigJsonJSC.ts b/Docs/Schemas/MappingConfigJsonJSC.ts index 6ad32b6df5..0c89d99d92 100644 --- a/Docs/Schemas/MappingConfigJsonJSC.ts +++ b/Docs/Schemas/MappingConfigJsonJSC.ts @@ -281,7 +281,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/PointRenderingConfigJson.schema.json b/Docs/Schemas/PointRenderingConfigJson.schema.json index bce458db80..69ed58d520 100644 --- a/Docs/Schemas/PointRenderingConfigJson.schema.json +++ b/Docs/Schemas/PointRenderingConfigJson.schema.json @@ -334,7 +334,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/PointRenderingConfigJsonJSC.ts b/Docs/Schemas/PointRenderingConfigJsonJSC.ts index 204310ef29..5e36aff073 100644 --- a/Docs/Schemas/PointRenderingConfigJsonJSC.ts +++ b/Docs/Schemas/PointRenderingConfigJsonJSC.ts @@ -328,7 +328,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/QuestionableTagRenderingConfigJson.schema.json b/Docs/Schemas/QuestionableTagRenderingConfigJson.schema.json index 9a08886182..3a664c5c2f 100644 --- a/Docs/Schemas/QuestionableTagRenderingConfigJson.schema.json +++ b/Docs/Schemas/QuestionableTagRenderingConfigJson.schema.json @@ -396,7 +396,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/QuestionableTagRenderingConfigJsonJSC.ts b/Docs/Schemas/QuestionableTagRenderingConfigJsonJSC.ts index 4eb54c3d68..6e3cd82d7e 100644 --- a/Docs/Schemas/QuestionableTagRenderingConfigJsonJSC.ts +++ b/Docs/Schemas/QuestionableTagRenderingConfigJsonJSC.ts @@ -390,7 +390,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/RewritableConfigJson.schema.json b/Docs/Schemas/RewritableConfigJson.schema.json index 822013b7b8..56638afb76 100644 --- a/Docs/Schemas/RewritableConfigJson.schema.json +++ b/Docs/Schemas/RewritableConfigJson.schema.json @@ -214,7 +214,7 @@ "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/Docs/Schemas/RewritableConfigJsonJSC.ts b/Docs/Schemas/RewritableConfigJsonJSC.ts index dc970cb781..f8e6c018f2 100644 --- a/Docs/Schemas/RewritableConfigJsonJSC.ts +++ b/Docs/Schemas/RewritableConfigJsonJSC.ts @@ -208,7 +208,7 @@ export default { "type": "object", "properties": { "icon": { - "description": "question: What icon should be used?\ntype: icon\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", + "description": "question: What icon should be used?\ntypes: Use a different icon depending on the value of some attributes ; icon\nsuggestions: return Constants.defaultPinIcons.map(i => ({if: \"value=\"+i, then: i, icon: i}))", "anyOf": [ { "$ref": "#/definitions/MinimalTagRenderingConfigJson" diff --git a/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts index 0c48bc9ccf..42bf7563d6 100644 --- a/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts @@ -4,7 +4,6 @@ import { TagConfigJson } from "./TagConfigJson" export interface IconConfigJson { /** * question: What icon should be used? - * type: icon * types: Use a different icon depending on the value of some attributes ; icon * suggestions: return Constants.defaultPinIcons.map(i => ({if: "value="+i, then: i, icon: i})) */ diff --git a/src/UI/Studio/SchemaBasedArray.svelte b/src/UI/Studio/SchemaBasedArray.svelte index 1bc20d6fab..aa80f0a550 100644 --- a/src/UI/Studio/SchemaBasedArray.svelte +++ b/src/UI/Studio/SchemaBasedArray.svelte @@ -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 } = ( @@ -166,7 +172,7 @@ {#if schema.hints.title}
- +
{/if} @@ -182,7 +188,7 @@ {:else if typeof value === "string"} Builtin: {value} {:else} - + {/if}
diff --git a/src/assets/schemas/layerconfigmeta.json b/src/assets/schemas/layerconfigmeta.json index ffe57a3bb1..c4094d5b52 100644 --- a/src/assets/schemas/layerconfigmeta.json +++ b/src/assets/schemas/layerconfigmeta.json @@ -1662,7 +1662,6 @@ ], "required": true, "hints": { - "typehint": "icon", "types": "Use a different icon depending on the value of some attributes ; icon", "question": "What icon should be used?", "suggestions": [ diff --git a/src/assets/schemas/layoutconfigmeta.json b/src/assets/schemas/layoutconfigmeta.json index 10f650f8ff..3d159c8b86 100644 --- a/src/assets/schemas/layoutconfigmeta.json +++ b/src/assets/schemas/layoutconfigmeta.json @@ -3661,7 +3661,6 @@ ], "required": true, "hints": { - "typehint": "icon", "types": "Use a different icon depending on the value of some attributes ; icon", "question": "What icon should be used?", "suggestions": [ @@ -24245,7 +24244,6 @@ ], "required": true, "hints": { - "typehint": "icon", "types": "Use a different icon depending on the value of some attributes ; icon", "question": "What icon should be used?", "suggestions": [