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

controls-library

v2.4.8

Published

For angular 6+ versions apps. Custom controls for input currency, input with range numbers, percents, positive integers etc.

Downloads

24

Readme

Controls library – Angular 6+ form controls library.

For angular 6+ versions apps. Custom controls for input currency, percents, positive numbers.

Installation.

Run for installation Components Library in your project.

npm install controls-library --save

Add in import section in your module

ControlsLibraryModule

Don't forget import this module:

import { ControlsLibraryModule } from 'controls-library';

Number range input form control.

Add form tag in your template with defined form group name.

<form [formGroup]="formGroup">

or use single as single form control with formControl attribute.

Add

<number-range-input></number-range-input>

tag for use number range input in your template form.

Number range input form control attributes.

  • containerClass – Div container css class.

  • inputId – Input form field id.

  • controlClass – Css class name for input.

  • additionalClass – Additional css class for input.

  • range – String with range in 0..100 format (negative number ranges not tested). Contains min and max values.

  • placeholder – Input placeholder string.

  • prefix – Template prefix before input form control (TemplateRef).

  • suffix – Template suffix after input form control (TemplateRef).

Example usage template part.

<form [formGroup]="form">

  <ng-template #numberRangeLabel>
    <label for="rangeInput">Number range input</label><br>
  </ng-template>

  <number-range-input
    containerClass="input-group"
    inputId="rangeInput"
    controlClass="range"
    formControlName="range"
    placeholder="range test"
    range="1..100"
    [prefix]="numberRangeLabel"
    [suffix]="numberRangeError"
    [additionalClass]="form.get('range').hasError('required') ? 'additional-class' : ''">
  </number-range-input>

  <ng-template #numberRangeError>
    <div>
      Required
    </div>
  </ng-template>

</form>

Currency input form control.

Currency input form field depends on defined user's locale.

Add form tag in your template with defined form group name.

<form [formGroup]="formGroup">

or use single as single form control with formControl attribute.

Add

<currency-input></currency-input>

tag for use currency input in your template form.

Currency input form control attributes.

  • containerClass – Div container css class.

  • controlClass – Css class name for input.

  • inputId – Input form field id.

  • placeholder – Input placeholder string, if set 0 (nil) placeholder will be shown with two decimals and decimal separator for current locale.

  • locale – Current user's locale (Needs for decimal separator (. dot or , comma)). If not defined, will be used app locale.

  • positive – True if needs only positive or false if needs positive and negative numbers (false by default).

  • prefix – Template prefix before input form control (TemplateRef).

  • suffix – Template suffix after input form control (TemplateRef).

  • additionalClass – Additional css class for input.

Example usage template part

<form [formGroup]="form">

  <ng-template #currencyInputLabel>
    <label for="currencyInput">Currency input</label><br>
  </ng-template>

  <currency-input
      containerClass="input-group"
      inputId="currencyInput"
      controlClass="currency-input"
      formControlName="currency"
      placeholder="currency test"
      [locale]="locale"
      [positive]="true"
      [prefix]="currencyInputLabel"
      [suffix]="currencyInputError"
      [additionalClass]="form.get('range').hasError('required') ? 'additional-class' : ''">
  </currency-input>

  <ng-template #currencyInputError>
    <div>
      Required
    </div>
  </ng-template>

</form>

Positive integer input form control.

Add form tag in your template with defined form group name.

<form [formGroup]="formGroup">

or use single as single form control with formControl attribute.

Add

<positive-integer-input></positive-integer-input>

tag for use positive integer input in your template form.

Positive integer input form control attributes.

  • containerClass – Div container css class.

  • controlClass – Css class name for input.

  • inputId – Input form field id.

  • placeholder – Input placeholder string.

  • prefix – Template prefix before input form control (TemplateRef).

  • suffix – Template suffix after input form control (TemplateRef).

  • additionalClass – Additional css class for input.

  • allowLeadingNil – Allows input nil in lead of number (allow by default).

Example usage template part

<form [formGroup]="form">

  <ng-template #positiveIntegerInputLabel>
    <label for="positiveInteger">Positive integer input</label><br>
  </ng-template>

  <positive-integer-input
      containerClass="input-group"
      inputId="positiveIntegerInput"
      controlClass="positive-integer-input"
      formControlName="positiveInteger"
      placeholder="0"
      [allowLeadingNil]="false"
      [prefix]="positiveIntegerInputLabel"
      [suffix]="positiveIntegerInputError"
      [additionalClass]="form.get('positiveInteger').hasError('required') ? 'additional-class' : ''">
  </positive-integer-input>

  <ng-template #positiveIntegerInputError>
    <div>
      Required
    </div>
  </ng-template>

</form>

This project was generated with Angular CLI version 7.0.2.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.