mirror of
https://github.com/immich-app/immich.git
synced 2025-11-21 09:20:40 +09:00
fix(web): validation of number input fields (#9789)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { quintOut } from 'svelte/easing';
|
||||
import type { FormEventHandler } from 'svelte/elements';
|
||||
import { fly } from 'svelte/transition';
|
||||
import PasswordField from '../password-field.svelte';
|
||||
|
||||
@@ -25,7 +26,9 @@
|
||||
export let isEdited = false;
|
||||
export let passwordAutocomplete: string = 'current-password';
|
||||
|
||||
const validateInput = () => {
|
||||
const handleChange: FormEventHandler<HTMLInputElement> = (e) => {
|
||||
value = e.currentTarget.value;
|
||||
|
||||
if (inputType === SettingInputFieldType.NUMBER) {
|
||||
let newValue = Number(value) || 0;
|
||||
if (newValue < min) {
|
||||
@@ -77,8 +80,7 @@
|
||||
{step}
|
||||
{required}
|
||||
{value}
|
||||
on:input={(e) => (value = e.currentTarget.value)}
|
||||
on:blur={validateInput}
|
||||
on:change={handleChange}
|
||||
{disabled}
|
||||
{title}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user