Refactoring: remove some old, UIElement based code

This commit is contained in:
Pieter Vander Vennet 2025-07-26 00:30:39 +02:00
parent b84655f2cb
commit 56a55e8b54
14 changed files with 58 additions and 261 deletions

View file

@ -0,0 +1,10 @@
<script lang="ts">
/**
* Simple wrapper around the HTML-time field.
*/
import { UIEventSource } from "../../../Logic/UIEventSource"
export let value: UIEventSource<undefined | string>
</script>
<input bind:value={$value} type="time" />

View file

@ -4,14 +4,14 @@
Wrapper around 'WikidataInput.svelte' which handles the arguments
*/
import { UIEventSource } from "../../Logic/UIEventSource"
import Locale from "../i18n/Locale"
import { Utils } from "../../Utils"
import Wikidata from "../../Logic/Web/Wikidata"
import WikidataInput from "./Helpers/WikidataInput.svelte"
import { UIEventSource } from "../../../Logic/UIEventSource"
import Locale from "../../i18n/Locale"
import { Utils } from "../../../Utils"
import Wikidata from "../../../Logic/Web/Wikidata"
import WikidataInput from "../Helpers/WikidataInput.svelte"
import type { Feature } from "geojson"
import { onDestroy } from "svelte"
import WikidataValidator from "./Validators/WikidataValidator"
import WikidataValidator from "../Validators/WikidataValidator"
export let args: (string | number | boolean)[] = []
export let feature: Feature

View file

@ -18,8 +18,9 @@
import OpeningHoursInput from "./Helpers/OpeningHoursInput.svelte"
import SlopeInput from "./Helpers/SlopeInput.svelte"
import type { SpecialVisualizationState } from "../SpecialVisualization"
import WikidataInputHelper from "./WikidataInputHelper.svelte"
import WikidataInputHelper from "./Helpers/WikidataInputHelper.svelte"
import DistanceInput from "./Helpers/DistanceInput.svelte"
import TimeInput from "./Helpers/TimeInput.svelte"
export let type: ValidatorType
export let value: UIEventSource<string | object>
@ -39,6 +40,8 @@
/>
{:else if type === "date"}
<DateInput {value} />
{:else if type === "time"}
<TimeInput {value} />
{:else if type === "color"}
<ColorInput {value} />
{:else if type === "image"}
@ -55,6 +58,7 @@
<WikidataInputHelper {value} {feature} {state} {args} />
{:else if type === "distance"}
<DistanceInput {value} {state} {feature} {args} />
{:else}
<slot name="fallback" />
{/if}

View file

@ -25,7 +25,7 @@ export interface InputHelperProperties {
}
export default class InputHelpers {
public static hideInputField: string[] = ["translation", "simple_tag", "tag"]
public static hideInputField: string[] = ["translation", "simple_tag", "tag","time"]
/**
* Constructs a mapProperties-object for the given properties.

View file

@ -1,5 +1,6 @@
import { Translation } from "../i18n/Translation"
import Translations from "../i18n/Translations"
import { HTMLInputTypeAttribute } from "svelte/elements"
/**
* A 'TextFieldValidator' contains various methods to check and cleanup an entered value or to give feedback.
@ -16,15 +17,7 @@ export abstract class Validator {
* What HTML-inputmode to use?
* Note: some inputHelpers will completely hide the default text field. This is kept in InputHelpers.hideInputField
*/
public readonly inputmode?:
| "none"
| "text"
| "tel"
| "url"
| "email"
| "numeric"
| "decimal"
| "search"
public readonly inputmode?: HTMLInputTypeAttribute
public readonly textArea: boolean
public readonly isMeta?: boolean

View file

@ -28,6 +28,7 @@ import VeloparkValidator from "./Validators/VeloparkValidator"
import NameSuggestionIndexValidator from "./Validators/NameSuggestionIndexValidator"
import CurrencyValidator from "./Validators/CurrencyValidator"
import RegexValidator from "./Validators/RegexValidator"
import { TimeValidator } from "./Validators/TimeValidator"
export type ValidatorType = (typeof Validators.availableTypes)[number]
@ -36,6 +37,7 @@ export default class Validators {
"color",
"currency",
"date",
"time",
"direction",
"distance",
"email",
@ -68,6 +70,7 @@ export default class Validators {
new StringValidator(),
new TextValidator(),
new DateValidator(),
new TimeValidator(),
new NatValidator(),
new IntValidator(),
new DistanceValidator(),

View file

@ -0,0 +1,11 @@
import { Validator } from "../Validator"
export class TimeValidator extends Validator {
inputmode = "time"
constructor() {
super("time", "A time picker")
}
}