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

angular-ui-tree-filter

v0.1.1

Published

A module providing an AngularJS filter which can be used with angular-ui-tree to match tree nodes

Downloads

862

Readme

#ui.tree-filter Build Status Built with Grunt

A module providing an AngularJS filter which can be used with angular-ui-tree to match tree nodes.

Table of Contents generated with DocToc

How it works?

  1. It's is configurable:
  • you may provide default properties of your nodes that should matched against provided pattern:
angular.module('myApp')
  .config(function (uiTreeFilterSettingsProvider) {
    uiTreeFilterSettingsProvider.addresses = ['title', 'description', 'username'];
  });
  • or you may pass property list as an optional 3rd argument:
$filter('uiTreeFilter')(nodeObject, pattern, ['title', 'description', 'username'])
  1. It matches the whole path If a sub-node matches all its ancestors up to the tree root match as well:
Filtered string: "the matched string"

    1. Foo
    2. Bar                            # matches as one of its descendants matches
        2.1 Baz                       # matches as one of its descendants matches
            2.1.1 The matched string  # matches exactly

How to use?

Filter can be used in the template to as an argument of the ng-show or ng-if.

<input ng-model="pattern">
<script type="text/ng-template" id="items_renderer.html">
  <div ui-tree-handle>{{item.title}}</div>
  <ol ui-tree-nodes ng-model="item.items">
    <li ng-repeat="item in item.items" ui-tree-node ng-include="'items_renderer.html'" 
        ng-hide="filter(item, pattern)">
    </li>
  </ol>
</script>
<div ui-tree>
  <ol ui-tree-nodes ng-model="list">
    <li ng-repeat="item in list" ui-tree-node ng-include="'items_renderer.html'" 
        ng-hide="filter(item, pattern)"></li>
  </ol>
</div>

Configuration reference

  • addresses (default: ['title']): properties of notes against which pattern will be matched. Deep filed access is supported: one can provide foo.bar.baz to match against item.foo.bar.baz value.
  • regexFlags (default: 'gi'): Regular expression flags applied during he matching
  • descendantCollection (default: 'items'): name of item property that holds item descendants

Performance

The filter is not provided with any performance improving mechanisms. It may turn out suboptimal for large trees with thousands of nodes and. If you need it to become perform better let us know what your case is by filing an issue

Support

Basically all the browsers down to Firefox 3.0, IE 9, Opera 10.5 and Safari 4.0 are supported.

Potential support blockers:

  • Array.reduce support: Fx 3, IE 9, Op 10.5, Sf4
  • Array.forEach support IE 9

If you wish to support IE8 (as AngularJS 1.2.x do) you'd have to provide proper polyfills. But you know it anyway

License

The module is available under the MIT license (see LICENSE for details).