Merge branch 'fix/update-loop-form-input' into 'release'
Fix another issue with dropdown default value See merge request theappsmith/internal-tools-client!388
This commit is contained in:
commit
d42d40dd6d
|
|
@ -21,6 +21,7 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
|
||||||
selectionType: VALIDATION_TYPES.TEXT,
|
selectionType: VALIDATION_TYPES.TEXT,
|
||||||
selectedIndexArr: VALIDATION_TYPES.ARRAY,
|
selectedIndexArr: VALIDATION_TYPES.ARRAY,
|
||||||
isRequired: VALIDATION_TYPES.BOOLEAN,
|
isRequired: VALIDATION_TYPES.BOOLEAN,
|
||||||
|
defaultOptionValue: VALIDATION_TYPES.TEXT,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
static getDerivedPropertiesMap() {
|
static getDerivedPropertiesMap() {
|
||||||
|
|
@ -64,18 +65,21 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
|
||||||
) {
|
) {
|
||||||
this.updateWidgetMetaProperty("selectedIndex", undefined);
|
this.updateWidgetMetaProperty("selectedIndex", undefined);
|
||||||
this.updateWidgetMetaProperty("selectedIndexArr", []);
|
this.updateWidgetMetaProperty("selectedIndexArr", []);
|
||||||
} else if (
|
}
|
||||||
(this.props.selectedIndex !== prevProps.selectedIndex &&
|
if (this.props.defaultOptionValue) {
|
||||||
this.props.selectedIndex === undefined) ||
|
if (
|
||||||
this.props.defaultOptionValue !== prevProps.defaultOptionValue
|
(this.props.selectedIndex !== prevProps.selectedIndex &&
|
||||||
) {
|
this.props.selectedIndex === undefined) ||
|
||||||
const selectedIndex = _.findIndex(this.props.options, option => {
|
this.props.defaultOptionValue !== prevProps.defaultOptionValue
|
||||||
return option.value === this.props.defaultOptionValue;
|
) {
|
||||||
});
|
const selectedIndex = _.findIndex(this.props.options, option => {
|
||||||
if (selectedIndex > -1) {
|
return option.value === this.props.defaultOptionValue;
|
||||||
this.updateWidgetMetaProperty("selectedIndex", selectedIndex);
|
});
|
||||||
} else {
|
if (selectedIndex > -1) {
|
||||||
this.updateWidgetMetaProperty("selectedIndex", undefined);
|
this.updateWidgetMetaProperty("selectedIndex", selectedIndex);
|
||||||
|
} else {
|
||||||
|
this.updateWidgetMetaProperty("selectedIndex", undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user