Merge branch 'release' into 'master'

Release

See merge request theappsmith/internal-tools-client!323
This commit is contained in:
Arpit Mohan 2020-02-25 08:48:24 +00:00
commit 39edf1dc74
5 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -567,7 +567,7 @@ const PropertyPaneConfigResponse = {
id: "16.2",
propertyName: "defaultOptionValue",
label: "Default Selected Value",
controlType: "SWITCH",
controlType: "INPUT_TEXT",
},
{
id: "16.3",

View File

@ -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: {
@ -154,6 +154,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
files: [],
columns: 4,
widgetName: "FilePicker",
isDefaultClickDisabled: true,
},
},
configVersion: 1,

View File

@ -12,6 +12,7 @@ import { VALIDATION_TYPES } from "constants/WidgetValidation";
import { EventType } from "constants/ActionConstants";
import { TriggerPropertiesMap } from "utils/WidgetFactory";
import Dashboard from "@uppy/dashboard";
import shallowequal from "shallowequal";
class FilePickerWidget extends BaseWidget<FilePickerWidgetProps, WidgetState> {
uppy: any;
@ -124,7 +125,7 @@ class FilePickerWidget extends BaseWidget<FilePickerWidgetProps, WidgetState> {
componentDidUpdate(prevProps: FilePickerWidgetProps) {
super.componentDidUpdate(prevProps);
if (
prevProps.allowedFileTypes !== this.props.allowedFileTypes ||
!shallowequal(prevProps.allowedFileTypes, this.props.allowedFileTypes) ||
prevProps.maxNumFiles !== this.props.maxNumFiles
) {
this.refreshUppy(this.props);

View File

@ -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;