primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.18k stars 4.55k forks source link

InputMask | Prefix with number +9 #14833

Open cetincakiroglu opened 6 months ago

cetincakiroglu commented 6 months ago

See discussion: https://github.com/orgs/primefaces/discussions/1202

Reproducer: https://stackblitz.com/edit/acnz1y?file=src%2Fapp%2Fdemo%2Finput-mask-basic-demo.html

DanaDovzh commented 6 months ago

But when we focus on the input and enter a number we should see the prefix "+998" instead we see "+888". It's a different phone code

cetincakiroglu commented 6 months ago

Hi,

This issue also happens in PrimeVue and PrimeReact. Because of that, we'll revisit and discuss this issue in 17.12.0 milestone next week with the team.

byStrange commented 2 weeks ago

You can use InputGroup as a solution, since the prefix is meant to be static. More about InputGroup


<script setup>
import InputGroup from 'primevue/inputgroup'
import InputGroupAddon from 'primevue/inputgroupaddon'
import InputMask from 'primevue/inputmask'
import { ref } from 'vue';

const phoneNumber = ref('');
</script>

<template>
   <InputGroup>
      <InputGroupAddon>+998</InputGroupAddon>
       <InputMask
         v-model="phoneNumber"
         mask="(99) 999-99-99"
         placeholder="(xx) xxx-xx-xx"
       />
   </InputGroup>
</template>