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

sdk-select

v2.2.4

Published

Simple to use (Angular) select option.

Downloads

252

Readme

Description:

The sdk-select component is a versatile dropdown element that includes single and multi-select capabilities.

NOTE: This package leverages the sdk-core-library for core configurations (i.e., colors, icons, etc.).

INSTALLATION:

Using NPM:

npm install --save sdk-select

CONFIGURATION:

To configure the sdk-select for your application, add the following lines to your app.module.ts file:

import { SDKSelectModule } from 'sdk-select';

@NgModule({
    imports: [
        SDKSelectModule
    ]
})
export class AppModule { }

PROPERTIES:

// Inputs:
// Required
options: any; // Values to select from. This is the RAW data. Not necessarily viewed by the the user.

// Optional
selectedOptions: any; // Values (RAW data) pre-selected in dropdown.
hoverColor: any; // Color used when mouse hovers over values.
selectedColor: any; // Font color used to indicate selected value (single selection dropdown ONLY).
selectedBackground: any; //  Background color used to indicate selected value (single selection dropdown ONLY).

label: any; // Text to display to the left/top of dropdown.
labelPosition: string = "left"; // Text located to the 'left' or 'top' position of dropdown.
labelStyle: any; // Style applied to 'label'.

optionStyle: any; // Main styling for the dropdown (e.g., font, border, colors, etc.).
optionValuesStyle: any; // Main styling for the dropdown values list (e.g., max-height, overflow, etc.).

noValueLabel: string = "..."; // 'No Value' label.
noValueDisabled: boolean = true; // Prevent 'No Value' from being selected.

displayValue: any; // Property (key) to display as value if options are of type 'object'.
resetLabel: string = "[clear]"; // Text to display for 'clearing/resetting' selected options.

multiSelect: boolean = false; // Indicates single or multiple selections.
multiValues: boolean = true; // Show multiple values in the dropdown display or 'n selected' message after 2+ values selected.

// Output:
selectChangeEvent: EventEmitter<any> = new EventEmitter(); // Event triggered on selections.

USAGE:

textArrayValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
textArray = [
    {
        id: 1,
        name: "a"
    },
    {
        id: 2,
        name: "b"
    },
    {
        id: 3,
        name: "c"
    },
    {
        id: 4,
        name: "d"
    },
    {
        id: 5,
        name: "e"
    }
];
<sdk-select 
    [label]="'My Data'"
    [labelStyle]="'font-family: Courier New; white-space: nowrap;'"
    [optionStyle]="'height: 30px; width: 100%;'" 
    [options]="textArrayValues" 
    noValueLabel="ALL"
    [noValueDisabled]=false 
    [selectedOptions]="5"
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

<br />

<sdk-select 
    [options]="textArray"
    displayValue="name"
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

<sdk-select 
    [options]="textArray" 
    displayValue="[id]: [name]"
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

<br />

<sdk-select 
    label="My Data" 
    labelPosition="top"
    labelStyle="white-space: nowrap; padding-bottom: 5px; font-weight: 700;" 
    [options]="textArray"
    optionStyle="font-family: Courier New; height: 40px; width: 500px; border: 1px solid red; background-color: yellow;"
    noValueLabel="ALL" 
    [multiSelect]=true 
    displayValue="name" 
    [selectedOptions]="['b', 'c']"
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

<sdk-select 
    [options]="textArray" 
    [multiSelect]=true 
    [multiValues]=false 
    optionStyle="height: 40px; width: 100px;"
    displayValue="[id]: [name]"
    [selectedOptions]="['4: d', '2: b']" 
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

<sdk-select 
    [options]="textArray" 
    [multiSelect]=true 
    optionStyle="height: 100%; width: 100%;"
    displayValue="[id]: [name]" 
    [selectedOptions]="['1: a', '3: c', '4: d', '2: b']"
    (selectChangeEvent)="selectedValue($event)">
</sdk-select>

NOTE: Use brackets [] in the displayValue parameter to indicate properties (keys) used in the options array.