Skip to content

v3.26.0

Latest

Choose a tag to compare

@jonathanpmartins jonathanpmartins released this 17 May 06:16
· 4 commits to main since this release

Feature

  • New property setMaxIfBigger (default true) gives developers control over the auto-clamp-to-max behavior. When set to false, a keystroke that would push the value past max is rejected and the display reverts to the last valid value — instead of jumping to the over-max digit sequence and snapping down to max. Applied to both format() / unformat() (which skip the max clamp under the flag) and the directive (which tracks the last in-bounds display and restores it on overflow). Closes issue #96.

Fix

  • The directive no longer leaves the host's v-model one keystroke behind the displayed value when applied to a wrapper component such as Vuetify's <v-text-field>, Nuxt UI's <UInput>, Element Plus's <el-input>, or any custom component that renders an inner <input> with its own @input listener. The wrapper attaches its listener during template render — before the directive's mounted() runs — so by DOM listener-order rules the wrapper's handler fired first and emitted the pre-reformat keystroke value, producing the off-by-10 v-model reported in #78 (typing 9876.54 left the display at $ 9,876.54 while v-model captured $ 987.654). After reformatting, setValue() now re-dispatches a synthetic input event so the wrapper's listener re-reads the post-format value; a flag on the synthetic event guards against re-entry through the directive's own oninput, and bubbles: false keeps the re-dispatch from reaching ancestor listeners that have nothing to do with the formatting pipeline. The re-fire is gated on host !== el (i.e. only fires when the directive sits on a wrapper, not a bare <input>), so native <input v-money3 v-model> users see no behavior change and no duplicate event dispatch.

See the new "Use with wrapper components" section in the README for usage examples and the e.__v_money3_synth__ filter contract.

Full changelog: https://github.com/jonathanpmartins/v-money3/blob/v3.26.0/CHANGELOG.md