Studio: fix dynamic markers
This commit is contained in:
parent
e0a755aa6a
commit
25075bf881
20 changed files with 28 additions and 26 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue