mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
@@ -286,14 +286,17 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
|
|||||||
protected createDropdown(ariaLabel: string, values: string[], value: string | undefined, enabled: boolean = true, width: number = DefaultInputWidth): azdata.DropDownComponent {
|
protected createDropdown(ariaLabel: string, values: string[], value: string | undefined, enabled: boolean = true, width: number = DefaultInputWidth): azdata.DropDownComponent {
|
||||||
// Automatically add an empty item to the beginning of the list if the current value is not specified.
|
// Automatically add an empty item to the beginning of the list if the current value is not specified.
|
||||||
// This is needed when no meaningful default value can be provided.
|
// This is needed when no meaningful default value can be provided.
|
||||||
|
// Create a new array so that the original array isn't modified.
|
||||||
|
const dropdownValues = [];
|
||||||
|
dropdownValues.push(...values);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
values.unshift('');
|
dropdownValues.unshift('');
|
||||||
}
|
}
|
||||||
return this.modelView.modelBuilder.dropDown().withProps({
|
return this.modelView.modelBuilder.dropDown().withProps({
|
||||||
ariaLabel: ariaLabel,
|
ariaLabel: ariaLabel,
|
||||||
values: values,
|
values: dropdownValues,
|
||||||
value: value,
|
value: value,
|
||||||
width: DefaultInputWidth,
|
width: width,
|
||||||
enabled: enabled
|
enabled: enabled
|
||||||
}).component();
|
}).component();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user