Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ng-select2-component
Advanced tools
[![npm version](https://badge.fury.io/js/ng-select2-component.svg)](https://badge.fury.io/js/ng-select2-component) [![Downloads](https://img.shields.io/npm/dm/ng-select2-component.svg)](https://www.npmjs.com/package/ng-select2-component) [![GitHub license
This Angular CLI module it's a fork of select2-component without Vue & React. For Vue or React, please use the original component.
npm i ng-select2-component --save
import { Select2Module } from "ng-select2-component";
@NgModule({
imports: [BrowserModule, FormsModule, Select2Module],
declarations: [MainComponent],
bootstrap: [MainComponent],
})
class MainModule { }
<select2 [data]="data"
[value]="value"
(update)="update($event)">
</select2>
name | type | status | default | description |
---|---|---|---|---|
data | Select2Data | required | the data of the select2 | |
value | Select2Value | initial value | ||
disabled | boolean | whether the component is disabled | ||
minCharForSearch | number | 0 | start the search when the number of characters is reached | |
minCountForSearch | number | 6 | hide search box if options.length < minCountForSearch | |
displaySearchStatus | 'default' or 'hidden' or 'always' | 'default' | display the search box (default : is based on minCountForSearch ) | |
placeholder | string | the placeholder string if nothing selected | ||
customSearchEnabled | boolean | will trigger search event, and disable inside filter | ||
multiple | boolean | select multiple options | ||
hideSelectedItems | boolean | for multiple , remove selected values | ||
resultMaxHeight | string | change the height size of results | ||
listPosition | 'below' or 'above' | 'below' | the position for the dropdown list | |
material | "" or true or 'true' | enable material style | ||
nostyle | "" or true or 'true' | remove border and background color | ||
editPattern | (str: string) => string | use it for change the pattern of the filter search | ||
ngModel /id /required /disabled /readonly /tabIndex | just like a select control | |||
(update) | (event: Select2UpdateEvent ) => void | event | triggered when user select an option | |
(open) | () => void | event | triggered when user open the options | |
(search) | (text: string) => void | event | triggered when search text changed |
type Select2Data = (Select2Group | Select2Option)[];
interface Select2Group = {
label: string;
options: Select2Option[];
classes?: string;
};
interface Select2Option = {
value: Select2Value;
label: string;
disabled?: boolean;
component?: string | Function; // the component
classes?: string;
};
type Select2Value = string | number | boolean;
type Select2UpdateValue = Select2Value | Select2Value[];
interface Select2UpdateEvent<U extends Select2UpdateValue> {
component: Select2;
value: U;
options: Select2Option[];
}
It's possible to change different colors (and more) with CSS variables without having to modify them with ::ng-deep
or other CSS rules :
:root {
--select2-required-color: red;
--select2-selection-background-color: #fff;
--select2-selection-disabled-background-color: #eee;
--select2-selection-choice-background-color: #e4e4e4;
--select2-selection-border-color: #aaa;
--select2-selection-focus-border-color: #000;
--select2-selection-text-color: #444;
--select2-selection-choice-text-color: #999;
--select2-selection-choice-hover-text-color: #333;
--select2-placeholder-color: #999;
--select2-arrow-color: #888;
--select2-dropdown-background-color: #fff;
--select2-dropdown-border-color: #aaa;
--select2-option-disabled-color: #999;
--select2-option-selected-background-color: #ddd;
--select2-option-highlighted-background-color: #5897fb;
--select2-option-highlighted-color: #fff;
--select2-option-group-color: gray;
--select2-border-radius: 4px;
/* for Material */
--select2-material-underline: #ddd;
--select2-material-underline-active: #5a419e;
--select2-material-underline-disabled: linear-gradient(to right, rgba(0, 0, 0, 0.26) 0, rgba(0, 0, 0, 0.26) 33%, transparent 0);
--select2-material-underline-invalid: red;
--select2-material-placeholder-color: rgba(0, 0, 0, 0.38);
--select2-material-selection-background-color: #ddd;
--select2-material-option-selected-background-color: rgba(0, 0, 0, 0.04);
--select2-material-option-highlighted-text-color: #000;
--select2-material-option-selected-text-color: #ff5722;
}
For IE11, see css-vars-ponyfill.
npm run build:lib
cd dist/ng-select2-component
npm publish
npm run build:demo
Like Angular, this module is released under the permissive MIT license. Your contributions are always welcome.
V7.1.0 (2020-04-23)
(update)
: return object Select2UpdateValue
change for Select2UpdateEvent
object. Please, see the readme.listPosition
, minCharForSearch
, noStyle
FAQs
An Angular select2 component.
The npm package ng-select2-component receives a total of 5,046 weekly downloads. As such, ng-select2-component popularity was classified as popular.
We found that ng-select2-component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.