dispatch("close")}>
diff --git a/UI/BaseUIElement.ts b/UI/BaseUIElement.ts
index 601218a91..9a213b79f 100644
--- a/UI/BaseUIElement.ts
+++ b/UI/BaseUIElement.ts
@@ -49,33 +49,10 @@ export default abstract class BaseUIElement {
return this
}
- public ScrollToTop() {
- this._constructedHtmlElement?.scrollTo(0, 0)
- }
-
- public ScrollIntoView(options?: { onlyIfPartiallyHidden?: boolean }) {
+ public ScrollIntoView() {
if (this._constructedHtmlElement === undefined) {
return
}
- let alignToTop = true
- if (options?.onlyIfPartiallyHidden) {
- // Is the element completely in the view?
- const parentRect = Utils.findParentWithScrolling(
- this._constructedHtmlElement.parentElement
- ).getBoundingClientRect()
- const elementRect = this._constructedHtmlElement.getBoundingClientRect()
-
- // Check if the element is within the vertical bounds of the parent element
- const topIsVisible = elementRect.top >= parentRect.top
- const bottomIsVisible = elementRect.bottom <= parentRect.bottom
- const inView = topIsVisible && bottomIsVisible
- if (inView) {
- return
- }
- if (topIsVisible) {
- alignToTop = false
- }
- }
this._constructedHtmlElement?.scrollIntoView({
behavior: "smooth",
block: "start",
diff --git a/UI/BigComponents/SelectedElementView.svelte b/UI/BigComponents/SelectedElementView.svelte
index 9bf83d432..5a5b732fc 100644
--- a/UI/BigComponents/SelectedElementView.svelte
+++ b/UI/BigComponents/SelectedElementView.svelte
@@ -1,67 +1,71 @@
{#if _tags._deleted === "yes"}
-
|
+
|
{:else}
-
-
-
-
-
-
+
+
+
-
- {#each layer.titleIcons as titleIconConfig}
- {#if ( titleIconConfig.condition?.matchesProperties(_tags) ?? true) && (titleIconConfig.metacondition?.matchesProperties(_tags) ?? true) && titleIconConfig.IsKnown(_tags)}
-
-
+
+
+
+
+
+
+ {#each layer.titleIcons as titleIconConfig}
+ {#if (titleIconConfig.condition?.matchesProperties(_tags) ?? true) && (titleIconConfig.metacondition?.matchesProperties(_tags) ?? true) && titleIconConfig.IsKnown(_tags)}
+
+
+
+ {/if}
+ {/each}
+
+
- {/if}
- {/each}
-
-
+
state.selectedElement.setData(undefined)}/>
+
+
+ {#each layer.tagRenderings as config (config.id)}
+ {#if (config.condition === undefined || config.condition.matchesProperties(_tags)) && (config.metacondition === undefined || config.metacondition.matchesProperties({..._tags, ..._metatags}))}
+ {#if config.IsKnown(_tags)}
+
+ {/if}
+ {/if}
+ {/each}
+
-
-
- {#each layer.tagRenderings as config (config.id)}
- {#if (config.condition === undefined || config.condition.matchesProperties(_tags)) && (config.metacondition === undefined || config.metacondition.matchesProperties({ ..._tags, ..._metatags }))}
- {#if config.IsKnown(_tags)}
-
- {/if}
- {/if}
- {/each}
-
-
-
{/if}
diff --git a/UI/InputElement/ValidatedInput.svelte b/UI/InputElement/ValidatedInput.svelte
index e85dbaaf1..3a621802c 100644
--- a/UI/InputElement/ValidatedInput.svelte
+++ b/UI/InputElement/ValidatedInput.svelte
@@ -14,13 +14,16 @@
export let type: ValidatorType;
export let feedback: UIEventSource
| undefined = undefined;
export let getCountry: () => string | undefined
-
+ export let placeholder: string | Translation | undefined
let validator : Validator = Validators.get(type)
+ let _placeholder = placeholder ?? validator?.getPlaceholder() ?? type
+
$: {
// The type changed -> reset some values
validator = Validators.get(type)
_value.setData(value.data ?? "")
feedback = feedback?.setData(validator?.getFeedback(_value.data, getCountry));
+ _placeholder = placeholder ?? validator?.getPlaceholder() ?? type
}
onDestroy(_value.addCallbackAndRun(v => {
@@ -50,10 +53,10 @@
{#if validator.textArea}
-
+
{:else }
-
+
{#if !$isValid}
{/if}
diff --git a/UI/InputElement/Validator.ts b/UI/InputElement/Validator.ts
index 4736b28d3..110821971 100644
--- a/UI/InputElement/Validator.ts
+++ b/UI/InputElement/Validator.ts
@@ -52,6 +52,10 @@ export abstract class Validator {
}
}
+ public getPlaceholder(){
+ return Translations.t.validation[this.name].description
+ }
+
public isValid(string: string, requestCountry?: () => string): boolean {
return true
}
diff --git a/UI/Popup/AllTagsPanel.svelte b/UI/Popup/AllTagsPanel.svelte
index e2e918bed..6baa5009b 100644
--- a/UI/Popup/AllTagsPanel.svelte
+++ b/UI/Popup/AllTagsPanel.svelte
@@ -63,9 +63,3 @@
-
-
diff --git a/UI/Popup/EditableTagRendering.ts b/UI/Popup/EditableTagRendering.ts
deleted file mode 100644
index 6675721b1..000000000
--- a/UI/Popup/EditableTagRendering.ts
+++ /dev/null
@@ -1,121 +0,0 @@
-import { Store, UIEventSource } from "../../Logic/UIEventSource"
-import TagRenderingQuestion from "./TagRenderingQuestion"
-import Translations from "../i18n/Translations"
-import Combine from "../Base/Combine"
-import TagRenderingAnswer from "./TagRenderingAnswer"
-import Toggle from "../Input/Toggle"
-import BaseUIElement from "../BaseUIElement"
-import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
-import { Unit } from "../../Models/Unit"
-import Lazy from "../Base/Lazy"
-import { FixedUiElement } from "../Base/FixedUiElement"
-import { EditButton } from "./SaveButton"
-import { UploadableTag } from "../../Logic/Tags/TagUtils"
-
-export default class EditableTagRendering extends Toggle {
- constructor(
- tags: UIEventSource,
- configuration: TagRenderingConfig,
- units: Unit[],
- state,
- options: {
- editMode?: UIEventSource
- innerElementClasses?: string
- /* Classes applied _only_ on the rendered element, not on the question*/
- answerElementClasses?: string
- /* Default will apply the tags to the relevant object, only use in special cases */
- createSaveButton?: (src: Store) => BaseUIElement
- }
- ) {
- // The tagrendering is hidden if:
- // - The answer is unknown. The questionbox will then show the question
- // - There is a condition hiding the answer
- const renderingIsShown = tags.map(
- (tags) =>
- configuration.IsKnown(tags) &&
- (configuration?.condition?.matchesProperties(tags) ?? true)
- )
- const editMode = options.editMode ?? new UIEventSource(false)
-
- super(
- new Lazy(() => {
- let rendering = EditableTagRendering.CreateRendering(
- state,
- tags,
- configuration,
- units,
- editMode,
- {
- saveButtonConstructor: options?.createSaveButton,
- answerElementClasses: options?.answerElementClasses,
- }
- )
- rendering.SetClass(options.innerElementClasses)
- if (state?.featureSwitchIsDebugging?.data || state?.featureSwitchIsTesting?.data) {
- rendering = new Combine([
- new FixedUiElement(configuration.id).SetClass("self-end subtle"),
- rendering,
- ]).SetClass("flex flex-col")
- }
- return rendering
- }),
- undefined,
- renderingIsShown
- )
- const self = this
- editMode.addCallback((editing) => {
- if (editing) {
- self.ScrollIntoView()
- }
- })
- }
-
- private static CreateRendering(
- state: any /*FeaturePipelineState*/,
- tags: UIEventSource,
- configuration: TagRenderingConfig,
- units: Unit[],
- editMode: UIEventSource,
- options?: {
- saveButtonConstructor?: (src: Store) => BaseUIElement
- answerElementClasses?: string
- }
- ): BaseUIElement {
- const answer: BaseUIElement = new TagRenderingAnswer(tags, configuration, state)
- answer.SetClass("w-full")
- let rendering = answer
-
- if (configuration.question !== undefined && (state?.featureSwitchUserbadge?.data ?? true)) {
- // We have a question and editing is enabled
-
- const question = new Lazy(
- () =>
- new TagRenderingQuestion(tags, configuration, state, {
- units: units,
- cancelButton: Translations.t.general.cancel
- .Clone()
- .SetClass("btn btn-secondary")
- .onClick(() => {
- editMode.setData(false)
- }),
- saveButtonConstr: options?.saveButtonConstructor,
- afterSave: () => {
- editMode.setData(false)
- },
- })
- )
-
- const answerWithEditButton = new Combine([
- answer,
- new EditButton(state?.osmConnection, () => {
- editMode.setData(true)
- question.ScrollIntoView({
- onlyIfPartiallyHidden: true,
- })
- }),
- ]).SetClass("flex justify-between w-full " + (options?.answerElementClasses ?? ""))
- rendering = new Toggle(question, answerWithEditButton, editMode)
- }
- return rendering
- }
-}
diff --git a/UI/Popup/QuestionBox.ts b/UI/Popup/QuestionBox.ts
deleted file mode 100644
index b41477a64..000000000
--- a/UI/Popup/QuestionBox.ts
+++ /dev/null
@@ -1,139 +0,0 @@
-import { Store, UIEventSource } from "../../Logic/UIEventSource"
-import TagRenderingQuestion from "./TagRenderingQuestion"
-import Translations from "../i18n/Translations"
-import Combine from "../Base/Combine"
-import BaseUIElement from "../BaseUIElement"
-import { VariableUiElement } from "../Base/VariableUIElement"
-import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
-import { Unit } from "../../Models/Unit"
-import Lazy from "../Base/Lazy"
-import { OsmServiceState } from "../../Logic/Osm/OsmConnection"
-
-/**
- * @deprecated
- * This element is getting stripped and is not used anymore
- * Generates all the questions, one by one
- */
-export default class QuestionBox extends VariableUiElement {
- constructor(
- state,
- options: {
- tagsSource: UIEventSource
- tagRenderings: TagRenderingConfig[]
- units: Unit[]
- showAllQuestionsAtOnce?: boolean | Store
- }
- ) {
- const skippedQuestions: UIEventSource = new UIEventSource([])
-
- const tagsSource = options.tagsSource
- const units = options.units
-
- let focus: () => void = () => {}
-
- const tagRenderingQuestions = tagRenderings.map(
- (tagRendering, i) =>
- new Lazy(
- () =>
- new TagRenderingQuestion(tagsSource, tagRendering, state, {
- units: units,
- afterSave: () => {
- // We save and indicate progress by pinging and recalculating
- skippedQuestions.ping()
- focus()
- },
- cancelButton: Translations.t.general.skip
- .Clone()
- .SetClass("btn btn-secondary")
- .onClick(() => {
- skippedQuestions.data.push(i)
- skippedQuestions.ping()
- focus()
- }),
- })
- )
- )
-
- tagsSource.map(
- (tags) => {
- if (tags === undefined) {
- return undefined
- }
- for (let i = 0; i < tagRenderingQuestions.length; i++) {
- let tagRendering = tagRenderings[i]
-
- if (skippedQuestions.data.indexOf(i) >= 0) {
- continue
- }
- if (tagRendering.IsKnown(tags)) {
- continue
- }
- if (tagRendering.condition) {
- if (!tagRendering.condition.matchesProperties(tags)) {
- // Filtered away by the condition, so it is kindof known
- continue
- }
- }
-
- // this value is NOT known - this is the question we have to show!
- return i
- }
- return undefined // The questions are depleted
- },
- [skippedQuestions]
- )
-
- const questionsToAsk: Store = tagsSource.map(
- (tags) => {
- if (tags === undefined) {
- return []
- }
- const qs = []
- for (let i = 0; i < tagRenderingQuestions.length; i++) {
- let tagRendering = tagRenderings[i]
-
- if (skippedQuestions.data.indexOf(i) >= 0) {
- continue
- }
- if (tagRendering.IsKnown(tags)) {
- continue
- }
- if (tagRendering.condition && !tagRendering.condition.matchesProperties(tags)) {
- // Filtered away by the condition, so it is kindof known
- continue
- }
-
- // this value is NOT known - this is the question we have to show!
- qs.push(tagRenderingQuestions[i])
- }
- return qs
- },
- [skippedQuestions]
- )
-
- super(
- questionsToAsk.map(
- (allQuestions) => {
- const apiState: OsmServiceState = state.osmConnection.apiIsOnline.data
- if (apiState !== "online" && apiState !== "unknown") {
- return undefined
- }
- const els: BaseUIElement[] = []
- if (
- options.showAllQuestionsAtOnce === true ||
- options.showAllQuestionsAtOnce["data"]
- ) {
- els.push(...questionsToAsk.data)
- } else {
- els.push(allQuestions[0])
- }
-
- return new Combine(els).SetClass("block mb-8")
- },
- [state.osmConnection.apiIsOnline]
- )
- )
-
- focus = () => this.ScrollIntoView()
- }
-}
diff --git a/UI/Popup/TagRendering/FreeformInput.svelte b/UI/Popup/TagRendering/FreeformInput.svelte
index c49d841f1..fdee1d851 100644
--- a/UI/Popup/TagRendering/FreeformInput.svelte
+++ b/UI/Popup/TagRendering/FreeformInput.svelte
@@ -14,6 +14,11 @@
export let tags: UIEventSource>;
export let feature: Feature = undefined;
+
+ let placeholder = config.freeform?.placeholder
+ $: {
+ placeholder = config.freeform?.placeholder
+ }
let feedback: UIEventSource = new UIEventSource(undefined);
@@ -29,11 +34,11 @@
{#if config.freeform.inline}
dispatch("selected")}
- type={config.freeform.type} {value}>
+ type={config.freeform.type} {placeholder} {value}>
{:else}
dispatch("selected")}
- type={config.freeform.type} {value}>
+ type={config.freeform.type} {placeholder} {value}>
{/if}
diff --git a/UI/Popup/TagRendering/TagRenderingEditable.svelte b/UI/Popup/TagRendering/TagRenderingEditable.svelte
index f0480fff7..e6e0ea4a3 100644
--- a/UI/Popup/TagRendering/TagRenderingEditable.svelte
+++ b/UI/Popup/TagRendering/TagRenderingEditable.svelte
@@ -1,74 +1,90 @@
- {#if config.question}
- {#if editMode}
-
-
-
- {:else}
-
-
-
-
+ {#if config.question && $editingEnabled}
+ {#if editMode}
+
+