mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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;
|
inputValidationErrorForeground?: Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SelectBoxEmptyError extends Error { }
|
||||||
|
|
||||||
export class SelectBox extends vsSelectBox {
|
export class SelectBox extends vsSelectBox {
|
||||||
private _optionsDictionary: Map<string, number>;
|
private _optionsDictionary: Map<string, number>;
|
||||||
private _dialogOptions: SelectOptionItemSQL[];
|
private _dialogOptions: SelectOptionItemSQL[];
|
||||||
@@ -66,12 +68,13 @@ export class SelectBox extends vsSelectBox {
|
|||||||
|
|
||||||
constructor(options: SelectOptionItemSQL[] | string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
constructor(options: SelectOptionItemSQL[] | string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
||||||
let optionItems: SelectOptionItemSQL[];
|
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;
|
return { text: o, value: o } as SelectOptionItemSQL;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
optionItems = options;
|
optionItems = options as SelectOptionItemSQL[];
|
||||||
}
|
}
|
||||||
|
|
||||||
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
|
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user