Studio: fix dynamic markers

This commit is contained in:
Pieter Vander Vennet 2024-07-16 23:06:26 +02:00
parent e0a755aa6a
commit 25075bf881
20 changed files with 28 additions and 26 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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}))
*/

View file

@ -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">

View file

@ -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": [

View file

@ -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": [