forked from MapComplete/MapComplete
Fix: rendering of 'inline' was not dynamic
This commit is contained in:
parent
2b05d79dbb
commit
60d825de3c
2 changed files with 50 additions and 22 deletions
|
|
@ -17,11 +17,15 @@
|
|||
export let unit: Unit | undefined
|
||||
|
||||
let placeholder = config.freeform?.placeholder
|
||||
let inline = config.freeform?.inline
|
||||
$: {
|
||||
console.log("Config is", config)
|
||||
placeholder = config.freeform?.placeholder
|
||||
inline = false
|
||||
inline = config.freeform?.inline
|
||||
}
|
||||
let inline = config.freeform.inline
|
||||
|
||||
console.log("Inline is", inline )
|
||||
export let feedback: UIEventSource<Translation> = new UIEventSource<Translation>(undefined);
|
||||
|
||||
let dispatch = createEventDispatcher<{ "selected" }>();
|
||||
|
|
@ -36,7 +40,7 @@
|
|||
|
||||
<div class="inline-flex flex-col">
|
||||
|
||||
{#if config.freeform.inline}
|
||||
{#if inline}
|
||||
<Inline key={config.freeform.key} {tags} template={config.render}>
|
||||
<ValidatedInput {feedback} {getCountry} {unit} on:selected={() => dispatch("selected")}
|
||||
type={config.freeform.type} {placeholder} {value}></ValidatedInput>
|
||||
|
|
|
|||
|
|
@ -6,18 +6,42 @@
|
|||
import Locale from "../../i18n/Locale";
|
||||
import FromHtml from "../../Base/FromHtml.svelte";
|
||||
|
||||
export let template: Translation;
|
||||
let _template: string
|
||||
onDestroy(Locale.language.addCallbackAndRunD(l => {
|
||||
_template = template.textFor(l)
|
||||
}))
|
||||
export let key: string;
|
||||
export let tags: UIEventSource<Record<string, string>>;
|
||||
let _tags = tags.data;
|
||||
onDestroy(tags.addCallbackAndRunD(tags => {
|
||||
_tags = tags;
|
||||
}));
|
||||
let [before, after] = _template.split("{" + key + "}");
|
||||
|
||||
export let template: Translation;
|
||||
let _template: string
|
||||
let before: string
|
||||
let after: string
|
||||
|
||||
onDestroy(Locale.language.addCallbackAndRunD(l => {
|
||||
_template = template.textFor(l)
|
||||
if (_template) {
|
||||
const splt = _template.split("{" + key + "}")
|
||||
before = splt[0]
|
||||
after = splt[1]
|
||||
console.log("Updating template to", _template, before, after)
|
||||
}
|
||||
}))
|
||||
|
||||
$: {
|
||||
_template = template.textFor(Locale.language.data)
|
||||
if (_template) {
|
||||
const splt = _template.split("{" + key + "}")
|
||||
before = splt[0]
|
||||
after = splt[1]
|
||||
console.log("Updating template to", _template, before, after)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$: {
|
||||
console.log("B/A:", before, after)
|
||||
}
|
||||
</script>
|
||||
|
||||
<span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue