Giter VIP home page Giter VIP logo

ember-cli-super-number's Introduction

Ember Super Number

*The conversion of this to an Ember CLI addon has been documented in this blog post: "Building Ember CLI Addons Simply"

Ember Super Number is a component that lets you intelligently deal with increment and decrement controls on a given input. It handles all sorts of configurations, and user input sanitization. You can see a demo below. Let me know what you think!

This is mostly feature compatible with Shane Riley's super number plugin with some minor differences around precision.

Demo

example image

Installation

npm install ember-cli-super-number --save-dev

Usage

{{super-number id="standard"}}

{{super-number id="min" min=1}}

{{super-number id="max" max=1}}

{{super-number id="step" step=5}}

{{super-number id="precision" precision=3}}

{{super-number id="scale" scale=2}}

{{super-number id="loop" loop=true min=1 max=9}}

{{super-number id="max-hold" max=3}}

Options can be composed interchangeably. They are:

  • Min - The lowest number you'd like to be reachable
  • Max - The largest number you'd like to be reachable
  • Loop (requisites min,max) - Behavior that states when value reaches min or max will cycle around to its opposite.
  • Precision - Total number of digits you'd like to represent your value as.
    • examples:
      • 30000 is a precision of 5
      • 12 is a precision of 2
      • 0001 is a precision of 4
  • Scale - number of digits to the right of the decimal to represent in value
    • examples:
      • 2.00 is a scale of 2
      • 3.1091 is a scale of 4
  • Step - Sets the number to add or subtract to value each time increment action is triggered (on click or arrow keys)
  • Value - The intial value. You will likely set this something property on your context controller to do meaningful actions with. (defaults to 0)

Lastly

Thanks!

If you'd like to contribute just open a PR. :)))

ember-cli-super-number's People

Contributors

rondale-sc avatar kalmanh avatar ramybenaroya avatar rwjblue avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.