Changed default option to text.
This commit is contained in:
parent
4cb0e5c0cf
commit
9b7a0731e9
|
|
@ -44,7 +44,11 @@ class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
|
|||
</Label>
|
||||
)}
|
||||
<StyledRadioGroup
|
||||
selectedValue={this.props.selectedOptionValue}
|
||||
selectedValue={
|
||||
this.props.selectedOptionValue === undefined
|
||||
? this.props.defaultOptionValue
|
||||
: this.props.selectedOptionValue
|
||||
}
|
||||
onChange={this.onRadioSelectionChange}
|
||||
>
|
||||
{this.props.options.map(option => {
|
||||
|
|
@ -73,6 +77,7 @@ export interface RadioGroupComponentProps extends ComponentProps {
|
|||
onRadioSelectionChange: (updatedOptionValue: string) => void;
|
||||
selectedOptionValue: string;
|
||||
isLoading: boolean;
|
||||
defaultOptionValue: string;
|
||||
}
|
||||
|
||||
export default RadioGroupComponent;
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ const PropertyPaneConfigResponse = {
|
|||
id: "16.2",
|
||||
propertyName: "defaultOptionValue",
|
||||
label: "Default Selected Value",
|
||||
controlType: "SWITCH",
|
||||
controlType: "INPUT_TEXT",
|
||||
},
|
||||
{
|
||||
id: "16.3",
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
|
|||
{ id: "2", label: "Bravo", value: "2" },
|
||||
{ id: "3", label: "Charlie", value: "3" },
|
||||
],
|
||||
selectedOptionValue: "1",
|
||||
defaultOptionValue: "1",
|
||||
widgetName: "RadioGroup",
|
||||
},
|
||||
ALERT_WIDGET: {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class RadioGroupWidget extends BaseWidget<RadioGroupWidgetProps, WidgetState> {
|
|||
onRadioSelectionChange={this.onRadioSelectionChange}
|
||||
key={this.props.widgetId}
|
||||
label={this.props.label}
|
||||
defaultOptionValue={this.props.defaultOptionValue}
|
||||
selectedOptionValue={this.props.selectedOptionValue}
|
||||
options={this.props.options}
|
||||
isLoading={this.props.isLoading}
|
||||
|
|
@ -41,7 +42,7 @@ class RadioGroupWidget extends BaseWidget<RadioGroupWidgetProps, WidgetState> {
|
|||
}
|
||||
|
||||
onRadioSelectionChange = (updatedValue: string) => {
|
||||
this.updateWidgetProperty("selectedOptionValue", updatedValue);
|
||||
super.updateWidgetMetaProperty("selectedOptionValue", updatedValue);
|
||||
if (this.props.onSelectionChange) {
|
||||
super.executeAction({
|
||||
dynamicString: this.props.onSelectionChange,
|
||||
|
|
@ -68,6 +69,7 @@ export interface RadioGroupWidgetProps extends WidgetProps {
|
|||
options: RadioOption[];
|
||||
selectedOptionValue: string;
|
||||
onSelectionChange: string;
|
||||
defaultOptionValue: string;
|
||||
}
|
||||
|
||||
export default RadioGroupWidget;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user