diff --git a/src/components/desktop/AmountInput.vue b/src/components/desktop/AmountInput.vue index cde42e14..85135df7 100644 --- a/src/components/desktop/AmountInput.vue +++ b/src/components/desktop/AmountInput.vue @@ -5,7 +5,7 @@ :label="label" :placeholder="placeholder" :persistent-placeholder="!!persistentPlaceholder" :rules="enableRules ? rules : []" v-model="currentValue" v-if="!hide" - @keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste"> + @keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste" @click="onClick"> @@ -19,7 +19,7 @@ :label="label" :placeholder="placeholder" :persistent-placeholder="!!persistentPlaceholder" :rules="enableRules ? rules : []" v-model="currentValue" v-if="hide" - @keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste"> + @keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste" @click="onClick"> @@ -90,6 +90,7 @@ const rules = [ ]; const currentValue = ref(getFormattedValue(props.modelValue)); + const prependText = computed(() => { if (!props.currency || !props.showCurrency) { return ''; @@ -261,6 +262,13 @@ function onPaste(e: ClipboardEvent): void { e.preventDefault(); } +function onClick(e: MouseEvent): void { + if (!props.disabled && !props.readonly && props.modelValue === 0) { + const input = e.target as HTMLInputElement; + input?.select(); + } +} + function getValidFormattedValue(value: number, textualValue: string, hasDecimalSeparator: boolean): string { let maxLength = TRANSACTION_MAX_AMOUNT.toString().length;