mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Fixes select box issue (#9808)
* Fixes select box issue * Flip the if statement * length check and error * Theres apparently 0 length arrays using this * Remove length check
This commit is contained in:
@@ -38,6 +38,8 @@ export interface ISelectBoxStyles extends vsISelectBoxStyles {
|
||||
inputValidationErrorForeground?: Color;
|
||||
}
|
||||
|
||||
export class SelectBoxEmptyError extends Error { }
|
||||
|
||||
export class SelectBox extends vsSelectBox {
|
||||
private _optionsDictionary: Map<string, number>;
|
||||
private _dialogOptions: SelectOptionItemSQL[];
|
||||
@@ -66,12 +68,13 @@ export class SelectBox extends vsSelectBox {
|
||||
|
||||
constructor(options: SelectOptionItemSQL[] | string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
||||
let optionItems: SelectOptionItemSQL[];
|
||||
if (Array.isArray<string>(options)) {
|
||||
optionItems = (options as string[]).map(o => {
|
||||
|
||||
if (Array.isArray<string>(options) && typeof (options[0]) === 'string') {
|
||||
optionItems = (options).map(o => {
|
||||
return { text: o, value: o } as SelectOptionItemSQL;
|
||||
});
|
||||
} else {
|
||||
optionItems = options;
|
||||
optionItems = options as SelectOptionItemSQL[];
|
||||
}
|
||||
|
||||
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
|
||||
|
||||
Reference in New Issue
Block a user