jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

Option to Disable Automatic Clamping to Max Value in v-money3 #96

Open trombonist76 opened 6 months ago

trombonist76 commented 6 months ago

Description of the Issue:

Currently, the v-money3component has a max prop that automatically sets the input value to this maximum if a value exceeding max is entered. For instance, if max is set to 100 and a user inputs 99, then subsequently inputs an additional digit like '3', the input erroneously jumps to 993 and then automatically gets clamped back to 100 because it exceeds the max value.

Proposed Feature:

I suggest adding a new boolean flag, perhaps named setMaxIfBigger, that allows developers to choose whether the input should automatically clamp to the max value. When this flag is set to false, entering a value that exceeds the max should leave the input unchanged (e.g., remain at 99 in the scenario above). This would provide more control over the input behavior and prevent automatic adjustments that may not be intended in all use cases.

<Money3Component :max="100" :setMaxIfBigger="false" />

With setMaxIfBigger set to false, if the user tries to enter a value over the max, the input should retain the last valid value (e.g., stays at 99 instead of jumping to 100).

Rationale: This feature would enhance usability by accommodating different user requirements and scenarios where preventing automatic clamping to the maximum value is desirable.