2.0.1 • Published 6 years ago

salte-filter v2.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Salte Filter

NPM Version NPM Downloads Travis Coveralls

Commitizen friendly semantic-release Greenkeeper badge

Registers filter components allowing for a single input and output!

Install

You can install this package either with npm or with bower.

npm

$ npm install salte-filter

Then add a <script> to your index.html:

<script src="/node_modules/salte-filter/salte-filter.js"></script>

Or require('salte-filter') from your code.

bower

$ bower install salte-io/salte-filter

Then add a <script> to your index.html:

<script src="/bower_components/salte-filter/salte-filter.js"></script>

Example

Live Demo

Usage

<salte-filter data="myData" filtered-data="myFilteredData">
  <my-custom-filter></my-custom-filter>
</salte-filter>

Documentation

salteFilter must be required into your component in order to be used

(add/remove)Filter

  • filter: A filter to be called anytime the filter function is called
const component = {
  require: {
    parent: '^salteFilter'
  },
  controller: () => {
    const view = this;

    view.filter = (item) => {
      // ... returns the item if the function returns truthy
    };

    view.$onInit = () => {
      // This will add the filter
      view.parent.addFilter(view.filter);
      // This will remove the filter
      view.parent.removeFilter(view.filter);
    };
  }
}

(add/remove)FilterListener

  • listener: A listener to be called anytime the filter function is called
const component = {
  require: {
    parent: '^salteFilter'
  },
  controller: () => {
    const view = this;

    view.onFilter = (filteredData) => {
      // ...
    };

    view.$onInit = () => {
      // This will add the listener
      view.parent.addFilterListener(view.onFilter);
      // This will remove the listener
      view.parent.removeFilterListener(view.onFilter);
    };
  }
}

filter

Runs all of the filters, useful for triggering a filter when an input value is changed

2.0.1

6 years ago

2.0.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.21

8 years ago

1.0.20

9 years ago

1.0.19

9 years ago

1.0.18

9 years ago

1.0.17

9 years ago

1.0.16

9 years ago

1.0.15

9 years ago

1.0.14

9 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago