allow nothing is selected as initial state (#22260)

This commit is contained in:
Alan Ren
2023-03-09 08:44:35 -08:00
committed by GitHub
parent 5fc69a0445
commit ec515a3b23
4 changed files with 33 additions and 57 deletions

View File

@@ -282,6 +282,21 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
return table;
}
protected createDropdown(ariaLabel: string, values: string[], value: string, 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.
// This is needed when no meaningful default value can be provided.
if (!value) {
values.unshift('');
}
return this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: ariaLabel,
values: values,
value: value,
width: DefaultInputWidth,
enabled: enabled
}).component();
}
protected removeItem(container: azdata.DivContainer | azdata.FlexContainer, item: azdata.Component): void {
if (container.items.indexOf(item) !== -1) {
container.removeItem(item);