mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
Fixed dynamic enablement (#19742)
* Fixed dynamic enablement * Set to false or original logic in constructor * Changed boolean to also undefined * Moved comment to constructor Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
@@ -12,9 +12,12 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
||||
private _optionsLoadingBuilder: azdata.LoadingComponentBuilder;
|
||||
private _onValueChangedEmitter: vscode.EventEmitter<void> = new vscode.EventEmitter();
|
||||
private _currentRadioOption!: azdata.RadioButtonComponent;
|
||||
private _enabled: boolean | undefined;
|
||||
constructor(private _view: azdata.ModelView, private _onNewDisposableCreated: (disposable: vscode.Disposable) => void, private _fieldInfo: FieldInfo) {
|
||||
this._optionsDivContainer = this._view!.modelBuilder.divContainer().withProps({ clickable: false }).component();
|
||||
this._optionsLoadingBuilder = this._view!.modelBuilder.loadingComponent().withItem(this._optionsDivContainer);
|
||||
// Dynamic enablement fields will default to false since they're calculated later
|
||||
this._enabled = instanceOfDynamicEnablementInfo(this._fieldInfo.enabled) ? false : this._fieldInfo.enabled;
|
||||
}
|
||||
|
||||
component(): azdata.LoadingComponent {
|
||||
@@ -51,7 +54,7 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
||||
label: option.displayName,
|
||||
value: option.name,
|
||||
checked: option.displayName === defaultValue,
|
||||
enabled: instanceOfDynamicEnablementInfo(this._fieldInfo.enabled) ? false : this._fieldInfo.enabled // Dynamic enablement is initially set to false
|
||||
enabled: this._enabled
|
||||
}).component();
|
||||
if (radioOption.checked) {
|
||||
this._currentRadioOption = radioOption;
|
||||
@@ -90,6 +93,7 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
||||
this._optionsDivContainer.items.forEach(radioButton => {
|
||||
radioButton.enabled = enabled;
|
||||
});
|
||||
this._enabled = enabled;
|
||||
}
|
||||
|
||||
get onValueChanged(): vscode.Event<void> {
|
||||
|
||||
Reference in New Issue
Block a user