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

aurelia-multiple-select

v1.1.0

Published

An aurelia plugin for multiselect control

Downloads

5

Readme

aurelia multi select

This is an Aurelia plugin in order for developers to create star-rate elements in their apps.

1. Installation

  • Aurelia CLI

    run the following command :

    npm install aurelia-multi-select --save

    or if you are using yarn

    yarn add aurelia-multi-select

    then update the aurelia.json with the following :

    {
        "name": "aurelia-multi-select",
        "path": "../node_modules/aurelia-multi-select/dist/amd",
        "main": "aurelia-multi-select",
        "resources": [
          "elements/multi-select.html"
        ]
     }

    no need to mention that you should have added jquery and bootstrap in aurelia.json file

    "jquery",
      {
        "name": "bootstrap",
        "path": "../node_modules/bootstrap/dist",
        "main": "js/bootstrap.min",
        "deps": ["jquery"],
        "exports": "$",
        "resources": [
          "css/bootstrap.css"
        ]
      }

    then add the plugin in your main.ts or main.js file.

    .plugin("aurelia-multi-select")

  • JSPM

    Run the jspm install command :

    jspm install aurelia-multiple-select=github:bondib/aurelia-multiple-select

    then update your main.ts or main.js file.

    .plugin("aurelia-multi-select")

2. Usage

Simple

Using the control in your .html files is so simple ;-)

<star-rate color="darkgoldenrod" read-only.bind="false" rate.bind="viewmodel.rate & validate" max-rate.bind="5"></star-rate>

keep in mind that once again you need the following line somwhere in your htmls :

<require from="bootstrap/css/bootstrap.css"></require>

Events

You can handle the callback for star rate clicked or changed in two forms :

  1. Globally : When any of the star-rate elemnts in your dom which are not read only change the rate a StarRateClicked message will be published which has newRate and oldRate as its data
import { EventAggregator } from 'aurelia-event-aggregator';
import { StarRateClicked } from 'aurelia-multi-select';

and then subscribe fo the message :

@autoinject
export class Welcome {
  
  constructor(ea: EventAggregator) {
    ea.subscribe(StarRateClicked, x => console.info(`E.Aggregator : Rate changed from  ${x.oldRate} to ${x.newRate}`));
  }

}
  1. Element based : You can handle seperate event callbacks for individual star-rate elements in your .html file use clicked.call as follows
 <star-rate clicked.call="star_clicked(newRate,oldRate)" max-rate.bind="8" rate.one-way="6" read-only.bind="false" color="darkgoldenrod"></star-rate>

and then in your .js or .ts file add your event handler :

private star_clicked(newRate, oldRate) {
    console.info(`clicked: Rate changed from  ${oldRate} to ${newRate}`);
}

3. Building The Code

To build the code, follow these steps.

  1. Ensure that NodeJS is installed. This provides the platform on which the build tooling runs.
  2. Ensure that Gulp is installed. If you need to install it, use the following command:
npm install -g gulp
  1. From the project folder (root), execute the following command:
npm install && jspm install
  1. Install the typings from the root
typings install
  1. To build the plugin, you can now run:
gulp build
  • You will find the compiled code in the dist folder, available in three module formats: AMD, CommonJS and ES2015.
  1. to run the sample do the followings :
  • run ```npm install && jsmp install`` in the sample older
  • run gulp watch
  1. See gulpfile.js for other tasks related to generating the docs and linting.