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

ngx-custom-ng-select

v1.0.1

Published

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.

Downloads

3

Readme

NgxCustomNgSelect

This library was generated with Angular CLI version 16.2.0.

This is an extended version of the classic ng-select. It allows you to define callbacks for data loading, such as pagination, quickly and easily. It also allows you to integrate search with API calls.

Installation

npm install ngx-custom-ng-select

Usage

  • .ts
export class AppComponent {

  public initArrayValues: () => Observable<Array<any>>;
  public searchSpecificCallback: () => Observable<Array<any>>;
  public scrollToEndArrayCallback: () => Observable<Array<any>>;
  public searchingCallback: () => Observable<Array<any>>;

  initArrayValues = this.getInitValues.bind(this);
  searchSpecificCallback = this.getInitValues.bind(this);
  scrollToEndArrayCallback = this.simulateScrollToEndCallback.bind(this);
  searchingCallback = this.searchingCallbackValues.bind(this);

}
  • .html

<lib-ngx-custom-ng-select #customNgSelect
                          [selectId]="'testing-custom-ng-select'"
                          [items]="exampleArray"
                          [bindLabel]="'email'"
                          [bindValue]="'index'"
                          [selectedItem]="selectedItem"
                          [initLoadItems]="initArrayValues"
                          [searchExistingItemCallback]="searchSpecificCallback"
                          [scrollToEndCallback]="scrollToEndArrayCallback"
                          [searchingCallback]="searchingCallback"
                          [multiple]="isMultiple"
                          [isInError]="isInError"
                          [errorBorderColor]="'red'"
                          [placeholder]="'Insert a value'"
                          (focusEvent)="refreshValidation()"
                          (loadItemsEvent)="overWriteInitArray($event)"
                          (searchExistingItemEvent)="setSpecificValue($event)"
                          (scrollToEndEvent)="concatArray($event)"
                          (searchingParamsEvent)="changeSearchingParams($event)"
                          (searchingEvent)="overWriteSearchingArray($event)"
                          (selectedItemChangeEvent)="changeSelectedItem($event)">
</lib-ngx-custom-ng-select>

| Option | Description | Type | Default Value | |--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|-------------------------| | [notFound] | Message when no result found | string | 'No result' | | [name] | Name of html ng-select element | string | default-custom-select | | [items] | Array of object that ng-select uses as values | Array of any | | | [selectedItem] | Selected item of ng-select. It can be single or array of object | any | | | [bindValue] | Name of the object attribute that represents the object's value | string | | | [bindLabel] | Name of the object attribute that is shown in the ng-select | string | | | [selectId] | Id of html ng-select element | string | ngx-custom-ng-select | | [loadingText] | Text that is displayed in ng-select when loading items | string | Loading... | | [virtualScroll] | Enable virtual scroll to load only the elements visible in the ng-slect viewport | boolean | true | | [bufferDim] | Virtual scroll buffer size | number | 1 | | [multiple] | Determines whether the ng-select will have only one selectedItem or can have more | boolean | false | | [placeholder] | Text visible in the ng-select input when not even an element has been selected | string | | | [disabled] | Determines whether ng-select is enabled or not | boolean | false | | [clearable] | Allow to clear selected value | boolean | true | | [isInError] | Determines whether to highlight the edge of the input with a border | boolean | false | | [errorBorderColor] | border color of the failing input. The color can be represented in hexadecimal or simple string | string | red | | [customClass] | Additional html classes for any custom styles | (Array of string) or (string) | | | [addTag] | Allows to create custom options | boolean | false | | [addTagText] | Set custom text when using tagging | string | | | [returnFullObjectOnChanged] | when active, when the value is returned, the entire object will be returned instead of just the bindValue | boolean | false | | [isStaticItem] | If active, you will not have the option to select/change the selectedItem | boolean | false | | [headerTemplate] | Template for a possible custom header | TemplateRef of any | | | [initLoadItems] | Callback to pass in input. It will be executed in the ngOnInit of ng-select | () => Observable of any | | | (loadItemsEvent) | If [initLoadItems] succeeds, you will be notified of the returned values. it is the calling component's task to assign values to [items] | Response of [initLoadItems] | | | [searchExistingItemCallback] | Callback to pass in input. It will be executed after [initLoadItems] if selectedItem exist and it's not present in [items] | () => Observable of any | | | (searchExistingItemEvent) | If [searchExistingItemCallback] succeeds, you will be notified of the returned values. it is the calling component's task to assign values to [items] | Response of [searchExistingItemCallback] | | | [scrollToEndCallback] | Callback to pass in input. It will be executed when scroll to the bottom the ng-select | () => Observable of any | | | (scrollToEndEvent) | If [scrollToEndCallback] succeeds, you will be notified of the returned values. it is the calling component's task to assign values to [items] | Response of [scrollToEndCallback] | | | [searchingCallback] | Callback to pass in input. It Will be called while typing on the ng-select input with a 500ms debounce. **It's triggered only if the written text is greater than 1 character, otherwise it will be triggered [scrollToEndCallback] | () => Observable of any | | | (searchingEvent) | If [searchingCallback] succeeds, you will be notified of the returned values. After that, [searchExistingItemCallback] will be triggered. it is the calling component's task to assign values to [items] | Response of [searchingCallback] | | | (searchingParamsEvent) | Event emitter that notifies each change of the input field while the user writes to perform a search | string | | | (resetEvent) | Relaunch of (clear) ng-select | boolean | | | (focusEvent) | Triggered when the html element gets focus | boolean | | | (openEvent) | Triggered when the ng-select menu is opened | boolean | | | (closeEvent) | Triggered when the ng-select menu is closed | boolean | |

Credits: Ng-select