This commit is contained in:
Pieter Vander Vennet 2024-05-06 11:24:26 +02:00
parent 4b49a08914
commit 7072f2d93d
2 changed files with 14 additions and 11 deletions

View file

@ -11,7 +11,7 @@
export let configs: ConfigMeta[] export let configs: ConfigMeta[]
export let title: string | undefined = undefined export let title: string | undefined = undefined
export let path: (string | number)[] = [] export let path: readonly (string | number)[] = []
let expertMode = state.expertMode let expertMode = state.expertMode
let configsNoHidden = configs.filter((schema) => schema.hints?.group !== "hidden") let configsNoHidden = configs.filter((schema) => schema.hints?.group !== "hidden")
@ -21,9 +21,9 @@
</script> </script>
{#if configs === undefined} {#if configs === undefined}
Bug: 'Region' received 'undefined' Bug: 'Region' received 'undefined' at {path.join(".")}
{:else if configs.length === 0} {:else if configs.length === 0}
Bug: Region received empty list as configuration Bug: Region received empty list as configuration at {path.join(".")}
{:else if title} {:else if title}
<div class="flex w-full flex-col"> <div class="flex w-full flex-col">
<h3>{title}</h3> <h3>{title}</h3>

View file

@ -7,7 +7,7 @@
import type { ConfigMeta } from "./configMeta" import type { ConfigMeta } from "./configMeta"
import type { import type {
MappingConfigJson, MappingConfigJson,
QuestionableTagRenderingConfigJson, QuestionableTagRenderingConfigJson
} from "../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson" } from "../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte" import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte"
@ -59,8 +59,8 @@
labelMapping = { labelMapping = {
if: "value=" + label, if: "value=" + label,
then: { then: {
en: "Builtin collection <b>" + label + "</b>:", en: "Builtin collection <b>" + label + "</b>:"
}, }
} }
perLabel[label] = labelMapping perLabel[label] = labelMapping
mappingsBuiltin.push(labelMapping) mappingsBuiltin.push(labelMapping)
@ -72,14 +72,14 @@
mappingsBuiltin.push({ mappingsBuiltin.push({
if: "value=" + tr["id"], if: "value=" + tr["id"],
then: { then: {
en: "Builtin <b>" + tr["id"] + "</b> <div class='subtle'>" + description + "</div>", en: "Builtin <b>" + tr["id"] + "</b> <div class='subtle'>" + description + "</div>"
}, }
}) })
} }
const configBuiltin = new TagRenderingConfig(<QuestionableTagRenderingConfigJson>{ const configBuiltin = new TagRenderingConfig(<QuestionableTagRenderingConfigJson>{
question: "Which builtin element should be shown?", question: "Which builtin element should be shown?",
mappings: mappingsBuiltin, mappings: mappingsBuiltin
}) })
const tags = new UIEventSource({ value }) const tags = new UIEventSource({ value })
@ -112,7 +112,7 @@
"condition", "condition",
"metacondition", "metacondition",
"mappings", "mappings",
"icon", "icon"
]) ])
const ignored = new Set(["labels", "description", "classes"]) const ignored = new Set(["labels", "description", "classes"])
@ -196,7 +196,10 @@
<h3>Text field and input element configuration</h3> <h3>Text field and input element configuration</h3>
<div class="border-l border-dashed border-gray-800 pl-2"> <div class="border-l border-dashed border-gray-800 pl-2">
<SchemaBasedField {state} path={[...path, "render"]} schema={topLevelItems["render"]} /> <SchemaBasedField {state} path={[...path, "render"]} schema={topLevelItems["render"]} />
<Region {state} {path} configs={freeformSchema} /> {#if freeformSchema?.length > 0}
<!-- In read-only cases, (e.g. popup title) there will be no freeform-schema to set and thus freeformSchema will be undefined -->
<Region {state} {path} configs={freeformSchema} />
{/if}
<SchemaBasedField {state} path={[...path, "icon"]} schema={topLevelItems["icon"]} /> <SchemaBasedField {state} path={[...path, "icon"]} schema={topLevelItems["icon"]} />
</div> </div>