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

@ng-ar/mask

v14.0.4

Published

This angular npm library package will help us create input mask with more custom controls like preventing & allowing right click, meta keys.

Downloads

2

Readme

Angular mask

This angular npm library package will help us create input mask with more custom controls like preventing & allowing right click, meta keys.

Demo preview:

Here is how the inputs with mask look like on the screen:

Demo of ng-ar-mask

Installation

This is how to install the components:

npm install @ng-ar/mask

or

yarn add @ng-ar/mask

Minimum angular version needed for this library is v14.0.2.

And on your application module:

import { MaskModule } from '@ng-ar/mask';

@NgModule({
  declarations: [ ...],
  imports: [
    BrowserModule,
    ....,
    MaskModule
],
})
export class AppModule { }

We can use them as below in HTML view:

<div class="container">
  <h1> Input Mask Examples </h1>

  <label>Phone:</label>
  <input ng-ar-mask="(999) 999-9999" [rightClick]="true" [metaKeys]="true">

  <label>International Phone Number</label>
  <input ng-ar-mask="+99 999 99 99 99">

  <label>Credit Card</label>
  <input ng-ar-mask="9999 9999 9999 9999">


  <label>VAT Number</label>
  <input ng-ar-mask="AA-9999 9999 9999 9999">

  <label>Date</label>
  <input ng-ar-mask="39/12/9999">

  <label>Text</label>
  <input value="ABCD">
</div>

How to use ng-ar-mask in html(general view):

<input ng-ar-mask="AA-aa*9 9999 9999 9999" [rightClick]="true" [metaKeys]="true">
  • Props rightClick and metaKeys are false by default. If you're not providing, default values will be taken. When metaKeys is enabled, if you select the input, single key press (except meta keys) will clear your input. You can do copy & paste with keyboard, when metaKeys is enabled
  • Directive ng-ar-mask can fed with validators like number, characters.
    • When numeric value is provided, the input will be masked for that. For example, If you give 4, all the values below 4 are only allowed.
    • If A is fed, it'll allow only all upper case alphabets.
    • If a is fed, it'll allow only all lower case alphabets.
    • If * is fed, it'll allow all the characters and numbers.
  • Special characters to be used to prevent taking inputs are as described: whitespace, /, (, ), +, \, -, ,

SCSS for the above mentioned demo:

.container {
  margin: 0 auto;
  max-width: 350px;
  padding-top:65px;

  & label {
    display: block;
    margin-top: 30px;
  }

  & input {
    border-radius: 4px;
    height: 30px;
    line-height: 30px;
    font-size: 17px;
    font-family: "Courier", serif;
    width:310px;
    margin-bottom: 30px;
    border: 2px solid darkgray;
    padding: 5px 10px 5px 10px;
  } 
}