Merge branch 'develop' into feature/json-editor

This commit is contained in:
Robin van der Linde 2024-02-22 02:24:17 +01:00
commit e932bfd9cd
Signed by untrusted user: Robin-van-der-Linde
GPG key ID: 53956B3252478F0D
201 changed files with 4529 additions and 4456 deletions

View file

@ -38,10 +38,5 @@
</script>
<div>
<TagRenderingEditable
{config}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable {config} selectedElement={undefined} {state} {tags} />
</div>

View file

@ -30,7 +30,7 @@
let thenText: UIEventSource<Record<string, string>> = state.getStoreFor([...path, "then"])
let thenTextEn = thenText.mapD((translation) =>
typeof translation === "string" ? translation : translation["en"],
typeof translation === "string" ? translation : translation["en"]
)
let editMode = Object.keys($thenText ?? {})?.length === 0
@ -72,7 +72,7 @@
<FromHtml src={$parsedTag?.asHumanString(false, false, $exampleTags)} />
{#if $messages.length > 0}
<div class="alert m-2 flex">
<ExclamationTriangle class="w-6 h-6" />
<ExclamationTriangle class="h-6 w-6" />
{$messages.length} errors
</div>
{/if}

View file

@ -83,7 +83,6 @@
helperArgs,
},
}
if (schema.hints.default) {
configJson.mappings = [
@ -95,7 +94,7 @@
schema.hints.default +
"</b> will be used. " +
(schema.hints.ifunset ?? ""),
hideInAnswer: mightBeBoolean(schema.type)
hideInAnswer: mightBeBoolean(schema.type),
},
]
} else if (!schema.required) {
@ -107,7 +106,6 @@
]
}
if (mightBeBoolean(schema.type)) {
configJson.mappings = configJson.mappings ?? []
configJson.mappings.push(
@ -147,19 +145,19 @@
tags.map((tgs) => {
const v = tgs["value"]
if (typeof v === "object") {
return { ...<object>v }
return { ...(<object>v) }
}
if (schema.type === "boolean") {
if(v === null || v === undefined){
return v
}
if (v === null || v === undefined) {
return v
}
return v === "true" || v === "yes" || v === "1"
}
if (mightBeBoolean(schema.type)) {
if (v === "true" || v === "yes" || v === "1") {
return true
}
if (v === "false" || v === "no" || v === "0" || (<any> v) === false) {
if (v === "false" || v === "no" || v === "0" || <any>v === false) {
return false
}
}

View file

@ -212,12 +212,7 @@
with MapComplete Studio
{:else}
<div>
<TagRenderingEditable
{config}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable {config} selectedElement={undefined} {state} {tags} />
</div>
{#if chosenOption !== undefined}

View file

@ -6,7 +6,7 @@
export let state: EditLayerState
export let path: (string | number)[] = []
let value = new UIEventSource<Record<string,string>>({})
let value = new UIEventSource<Record<string, string>>({})
console.log("Registering translation to path", path)
state.register(
path,

View file

@ -29,7 +29,7 @@
const store = state.getStoreFor(path)
let value = store.data
let hasSeenIntro = UIEventSource.asBoolean(
LocalStorageSource.Get("studio-seen-tagrendering-tutorial", "false"),
LocalStorageSource.Get("studio-seen-tagrendering-tutorial", "false")
)
onMount(() => {
if (!hasSeenIntro.data) {
@ -42,7 +42,7 @@
* Should only be enabled for 'tagrenderings' in the theme, if the source is OSM
*/
let allowQuestions: Store<boolean> = state.configuration.mapD(
(config) => path.at(0) === "tagRenderings" && config.source?.["geoJson"] === undefined,
(config) => path.at(0) === "tagRenderings" && config.source?.["geoJson"] === undefined
)
let mappingsBuiltin: MappingConfigJson[] = []
@ -118,7 +118,7 @@
const freeformSchemaAll = <ConfigMeta[]>(
questionableTagRenderingSchemaRaw.filter(
(schema) => schema.path.length == 2 && schema.path[0] === "freeform" && $allowQuestions,
(schema) => schema.path.length == 2 && schema.path[0] === "freeform" && $allowQuestions
)
)
let freeformSchema = $expertMode
@ -127,7 +127,7 @@
const missing: string[] = questionableTagRenderingSchemaRaw
.filter(
(schema) =>
schema.path.length >= 1 && !items.has(schema.path[0]) && !ignored.has(schema.path[0]),
schema.path.length >= 1 && !items.has(schema.path[0]) && !ignored.has(schema.path[0])
)
.map((schema) => schema.path.join("."))
console.log({ state })
@ -135,12 +135,7 @@
{#if typeof $store === "string"}
<div class="low-interaction flex">
<TagRenderingEditable
config={configBuiltin}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable config={configBuiltin} selectedElement={undefined} {state} {tags} />
<slot name="upper-right" />
</div>
{:else}
@ -177,7 +172,6 @@
</button>
</MappingInput>
</div>
{/each}
<button