mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Remove placeholder on deployment wizards when field is disabled dynamically (#13658)
This commit is contained in:
@@ -371,7 +371,8 @@ async function hookUpDynamicEnablement(context: WizardPageContext): Promise<void
|
|||||||
}
|
}
|
||||||
const updateFields = async () => {
|
const updateFields = async () => {
|
||||||
const targetComponentValue = await targetComponent.getValue();
|
const targetComponentValue = await targetComponent.getValue();
|
||||||
fieldComponent.component.enabled = targetComponentValue === targetValue;
|
const valuesMatch = targetComponentValue === targetValue;
|
||||||
|
fieldComponent.component.enabled = valuesMatch;
|
||||||
const isRequired = fieldComponent.component.enabled === false ? false : field.required;
|
const isRequired = fieldComponent.component.enabled === false ? false : field.required;
|
||||||
if (fieldComponent.labelComponent) {
|
if (fieldComponent.labelComponent) {
|
||||||
fieldComponent.labelComponent.requiredIndicator = isRequired;
|
fieldComponent.labelComponent.requiredIndicator = isRequired;
|
||||||
@@ -380,6 +381,12 @@ async function hookUpDynamicEnablement(context: WizardPageContext): Promise<void
|
|||||||
if ('required' in fieldComponent.component) {
|
if ('required' in fieldComponent.component) {
|
||||||
fieldComponent.component.required = isRequired;
|
fieldComponent.component.required = isRequired;
|
||||||
}
|
}
|
||||||
|
// When we disable the field then remove the placeholder if it exists so it's clear this field isn't needed
|
||||||
|
// We only do this for dynamic enablement since if a field is disabled through the JSON directly then it can't
|
||||||
|
// be modified anyways and so just should not use a placeholder value if they don't want one
|
||||||
|
if ('placeHolder' in fieldComponent.component) {
|
||||||
|
fieldComponent.component.placeHolder = valuesMatch ? field.placeHolder : '';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
targetComponent.onValueChanged(() => {
|
targetComponent.onValueChanged(() => {
|
||||||
updateFields();
|
updateFields();
|
||||||
|
|||||||
Reference in New Issue
Block a user