Description:
Simple to use (Angular) select option.
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 { }
USAGE:
<sdk-select></sdk-select>
List of properties:
options: any;
selectedOptions: any;
hoverColor: any;
selectedColor: any;
label: any;
labelPosition: string = "left";
labelStyle: any;
optionStyle: any;
noValueLabel: string = "...";
noValueDisabled: boolean = true;
displayValue: any;
multiSelect: boolean = false;
multiValues: boolean = true;
selectChangeEvent: EventEmitter<any> = new EventEmitter();
Examples
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"
valueField="name"
(selectChangeEvent)="selectedValue($event)">
</sdk-select>
<sdk-select
[options]="textArray"
valueField="[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
valueField="name"
[selectedOptions]="['b', 'c']"
(selectChangeEvent)="selectedValue($event)">
</sdk-select>
<sdk-select
[options]="textArray"
[multiSelect]=true
[multiValues]=false
optionStyle="height: 40px; width: 100px;"
valueField="[id]: [name]"
[selectedOptions]="['4: d', '2: b']"
(selectChangeEvent)="selectedValue($event)">
</sdk-select>
<sdk-select
[options]="textArray"
[multiSelect]=true
optionStyle="height: 100%; width: 100%;"
valueField="[id]: [name]"
[selectedOptions]="['1: a', '3: c', '4: d', '2: b']"
(selectChangeEvent)="selectedValue($event)">
</sdk-select>
NOTE: Use brackets [] in the valueField
parameter to indicate properties (keys) used in the options
array.