forked from MapComplete/MapComplete
		
	UX: fix #1932
This commit is contained in:
		
							parent
							
								
									4b49a08914
								
							
						
					
					
						commit
						7072f2d93d
					
				
					 2 changed files with 14 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -11,7 +11,7 @@
 | 
			
		|||
  export let configs: ConfigMeta[]
 | 
			
		||||
  export let title: string | undefined = undefined
 | 
			
		||||
 | 
			
		||||
  export let path: (string | number)[] = []
 | 
			
		||||
  export let path: readonly (string | number)[] = []
 | 
			
		||||
 | 
			
		||||
  let expertMode = state.expertMode
 | 
			
		||||
  let configsNoHidden = configs.filter((schema) => schema.hints?.group !== "hidden")
 | 
			
		||||
| 
						 | 
				
			
			@ -21,9 +21,9 @@
 | 
			
		|||
</script>
 | 
			
		||||
 | 
			
		||||
{#if configs === undefined}
 | 
			
		||||
  Bug: 'Region' received 'undefined'
 | 
			
		||||
  Bug: 'Region' received 'undefined' at {path.join(".")}
 | 
			
		||||
{: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}
 | 
			
		||||
  <div class="flex w-full flex-col">
 | 
			
		||||
    <h3>{title}</h3>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
  import type { ConfigMeta } from "./configMeta"
 | 
			
		||||
  import type {
 | 
			
		||||
    MappingConfigJson,
 | 
			
		||||
    QuestionableTagRenderingConfigJson,
 | 
			
		||||
    QuestionableTagRenderingConfigJson
 | 
			
		||||
  } from "../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
 | 
			
		||||
  import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
 | 
			
		||||
  import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte"
 | 
			
		||||
| 
						 | 
				
			
			@ -59,8 +59,8 @@
 | 
			
		|||
          labelMapping = {
 | 
			
		||||
            if: "value=" + label,
 | 
			
		||||
            then: {
 | 
			
		||||
              en: "Builtin collection <b>" + label + "</b>:",
 | 
			
		||||
            },
 | 
			
		||||
              en: "Builtin collection <b>" + label + "</b>:"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          perLabel[label] = labelMapping
 | 
			
		||||
          mappingsBuiltin.push(labelMapping)
 | 
			
		||||
| 
						 | 
				
			
			@ -72,14 +72,14 @@
 | 
			
		|||
    mappingsBuiltin.push({
 | 
			
		||||
      if: "value=" + tr["id"],
 | 
			
		||||
      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>{
 | 
			
		||||
    question: "Which builtin element should be shown?",
 | 
			
		||||
    mappings: mappingsBuiltin,
 | 
			
		||||
    mappings: mappingsBuiltin
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  const tags = new UIEventSource({ value })
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +112,7 @@
 | 
			
		|||
    "condition",
 | 
			
		||||
    "metacondition",
 | 
			
		||||
    "mappings",
 | 
			
		||||
    "icon",
 | 
			
		||||
    "icon"
 | 
			
		||||
  ])
 | 
			
		||||
  const ignored = new Set(["labels", "description", "classes"])
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +196,10 @@
 | 
			
		|||
    <h3>Text field and input element configuration</h3>
 | 
			
		||||
    <div class="border-l border-dashed border-gray-800 pl-2">
 | 
			
		||||
      <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"]} />
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue