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

@bugsplat/ngb-filterable-dropdown

v16.1.0

Published

[![bugsplat-github-banner-basic-outline](https://user-images.githubusercontent.com/20464226/149019306-3186103c-5315-4dad-a499-4fd1df408475.png)](https://bugsplat.com) <br/> # <div align="center">BugSplat</div> ### **<div align="center">Crash and error re

Downloads

48

Readme

bugsplat-github-banner-basic-outline

BugSplat

Crash and error reporting built for busy developers.

👋 Introduction

BugSplat's @bugsplat/ngb-filterable-dropdown package provides a powerful dropdown control for complicated filtering. Take a peek our example that demonstrates how to filter and select various items in a collection.

🏗 Installation

Install @bugsplat/ngb-filterable-dropdown and the associated peer dependencies @ng-bootstrap/ng-bootstrap and Bootstrap:

npm i @bugsplat/ngb-filterable-dropdown @ng-boostrap/ng-bootstrap bootstrap

🏃 Usage

Add NgbFilterableDropdownModule to your NgModule imports for each module where you plan to use the filterable dropdown:

import { NgbFilterableDropdownModule } from '@bugsplat/ngb-filterable-dropdown'

@NgModule({
  ...
  imports: [
    NgbFilterableDropdownModule
  ],
  ...
})

Add ngb-filterable-dropdown to your component's template:

<ngb-filterable-dropdown
  [allowCreateItem]="allowCreateItem"
  [autoClose]="autoClose"
  [items]="items"
  [disabled]="disabled"
  [placeholder]="placeholder"
  [searchInputPlaceholder]="searchInputPlaceholder"
  [selection]="selection"
  [selectionMode]="selectionMode"
  (itemCreated)="onItemCreated($event)"
  (openChanged)="onOpenChanged($event)"
  (selectionChanged)="onSelectionChanged($event)"
>
</ngb-filterable-dropdown>

🧩 API

Customize your dropdown by leveraging the inputs and outputs of @bugsplat/ngb-filterable-dropdown as described below.

Selection

The component takes two main inputs, a list of strings that are selectable and a sub-list of strings that are already selected.

items: Array<string> = ['Beetle', 'Ant', 'Moth', 'Fire Ant', 'Dung Beetle', 'Grass Ant'];
selection: Array<string> = ['Moth'];

Selection Modes

You can also specify whether or not to allow multiple items to be selected. By default, the component allows one item to be selected.

selectionMode: NgbFilterableDropdownSelectionMode =
  NgbFilterableDropdownSelectionMode.SingleSelect;

Create New Items

You can specify whether or not to allow new items to be created. By default, the component does not allow new items to be created.

allowCreateItem: boolean = false;

Opening and Closing

The open/close behavior of the dialog can be changed by setting autoClose to true or false. Alternatively you can specify whether to close on an outside or inside click.

autoClose: boolean | 'inside' | 'outside' = false;

Disabling

Dropdowns can be disabled at any time by setting disabled to true.

disabled: boolean = false;

Loading

You can also display a loading placeholder by setting loading to true.

loading: boolean = false;

Placeholders

If you'd like to specify the placeholder in the search input you can set the value of searchInputPlaceholder to a string of your choosing.

placeholder: string = 'No Items Selected';
searchInputPlaceholder: string = 'Search';

Outputs

The component provides the selected data back to the parent through the selectionChanged event.

onSelectionChanged(event: SelectionChangedEvent) {
  const selection = event.selection;
}

When an item is created the component outputs an event with the properties created, items, and selection.

onItemCreated(event: ItemCreatedEvent) {
  const created = event.created;
  const selection = event.selection;
  const items = event.items;
}

The component also provides an event when the dropdown is opened or closed through the openChanged event.

onOpenChanged(event: OpenChangedEvent) {
  const open = event.open;
}

🐛 About

@bugsplat/ngb-filterable-dropdown is an open source library developed by BugSplat! BugSplat is a crash and error reporting tool used by developers to find, fix, and track errors in their applications.

If you're interested in error reporting, check out our Angular integration.

With :heart:
BugSplat