npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-format-amount-input

v0.2.22

Published

Inspired by [AutoNumeric](https://github.com/autoNumeric/autoNumeric/), after using it for many years, decided to create my own amount format input for Vue3. Made this focused on my needs for my personal projects, but feel free to open issues for new beh

Downloads

25

Readme

vue-format-amount-input

Inspired by AutoNumeric, after using it for many years, decided to create my own amount format input for Vue3. Made this focused on my needs for my personal projects, but feel free to open issues for new behaviours or problems you found, I'll try my best to help you.

To Install

npm install --save vue-format-amount-input

Once you have installed the package, in your entry file of the repository (main.js) if you are using it in a Vue CLI project. Write the import command

import AmountFormatInputInstall from 'vue-format-amount-input'

app.use(AmountFormatInputInstall)

Options this input supports and it's default values:

Options allow you to customize how the input will format the amount as you type.

| Option | Description | Default Value | | :----------------: | :-----------: | :-----------: | | digitGroupSeparator | Thousands group separator | null | | decimalChar | Decimal separator character. Allowed values: . , ٫ | . | | alwaysAllowDecimalCharacter | Allows/Disables decimals in amounts | true | | allowNegativeValues | Allows/Disables negative amounts | false | | showCurrencyOnFocus | Defines if currency should be shown on input focus | false | | showCurrencyOnHover | Defines if currency should be shown on input hover | false | | currencySymbol | Defines currency symbol to display | null | | currencySymbolPlacement | Defines where currencySymbol will be displayed. Possible values p for prefix and s for suffix | p | | maxValue | The maximum value that can be entered | 999999999999999999999999.99 | | isIOS | Boolean to set inputMode when used on mobile apps/browsers | false |

Our Input will receive these options as an Object in prop options as the example below:

options = {
	digitGroupSeparator: '',
	decimalChar: '.',
	alwaysAllowDecimalCharacter: true,
	allowNegativeValues: false,
	showCurrencyOnFocus: false,
	showCurrencyOnHover: false,
	currencySymbolPlacement: 'p',
	currencySymbol: '',
	maxValue: 99999999999999999999999.99
}

TODO List

Options to be added to input:

  • emptyInputBehavior
  • decimalsLengthAllowed

Changelog

  • 0.1.13 - update vue-format-amount-input component blurEvent
  • 0.1.14 - build fixing
  • 0.1.15 - fixed behaviour of hover/focus when no currency is provided
  • 0.1.16 - fixed currency length validator when no currency is provided
  • 0.1.17 - updated blur function when no currency is provided
  • 0.1.18 - added option to have negative amounts
  • 0.1.19 - fixed bug when clearing negative value
  • 0.2.00 - changed maxValue logic and default value; To prevent Scientific notation on numbers value is now returned and used as a string
  • 0.2.01 - fixed bug when changing currency and input had no content
  • 0.2.02 - fixed variable used to compare maxValue and validation
  • 0.2.03 - fixed logic behind removing currency from value
  • 0.2.04 - removed console.logs
  • 0.2.05 - fixed logic when on clear of value, currency would be showed; fixed setSelectionRange to only be trigger if user is focus on input
  • 0.2.06 - Fixed maxValue validations and handling; Fixing replacing numbers
  • 0.2.07 - Fixed maxValue validations for decimals and numbers with currencies
  • 0.2.08 - Fixed maxValue validation when number has same length; fixed validation when swapping amounts
  • 0.2.09 - Added watch to handleMaxValue change on input lifetime
  • 0.2.10 - Added logic on initial value setup, so decimals (when allowed) are showed on mounted
  • 0.2.11 - Fixed validation for maxValue on initial render with value
  • 0.2.12 - Added missing validation before trying to stringify value
  • 0.2.13 - Added missing validations for value on watch
  • 0.2.14 - Fixed blur logic when value is empty
  • 0.2.15 - Added inputMode to input, and option to help define inputMode specifc for iOS apps/browsers
  • 0.2.16 - Added logic for pasted values when they fall out of maxValue
  • 0.2.17 - Fixed validation for decimalsChars; Fixed maxValue logic when having decimals
  • 0.2.18 - Fixed formating value before emiting it when its value is negative
  • 0.2.19 - Added emit for keydown.enter
  • 0.2.20 - Added logic to prevent zeros at left of natural number
  • 0.2.21 - Fixed bug removing zeros before decimal char and also removing decimal char
  • 0.2.22 - Fixed bug where inputValue being 0 would be treated as falsy validation