Fix radio widget default value and Post api save error

This commit is contained in:
Hetu Nandu 2020-04-21 07:54:23 +00:00
parent dcf320e4e6
commit 2f5a3104f1
7 changed files with 13 additions and 22 deletions

View File

@ -21,7 +21,7 @@ export const transformRestAction = (data: any): any => {
data.displayFormat &&
data.displayFormat === POST_BODY_FORMAT_OPTIONS[0].value
) {
if (data.actionConfiguration.body[0]) {
if (data.actionConfiguration.body && data.actionConfiguration.body[0]) {
const body = data.actionConfiguration.body[0];
action = {
...data,
@ -36,7 +36,7 @@ export const transformRestAction = (data: any): any => {
data.displayFormat &&
data.displayFormat === POST_BODY_FORMAT_OPTIONS[1].value
) {
if (data.actionConfiguration.body[1]) {
if (data.actionConfiguration.body && data.actionConfiguration.body[1]) {
const body = data.actionConfiguration.body[1];
if (typeof data.actionConfiguration.body === "object") {
action = {

View File

@ -71,7 +71,7 @@ abstract class BaseWidget<
return {};
}
static getMetaPropertiesMap(): Record<string, string> {
static getMetaPropertiesMap(): Record<string, any> {
return {};
}

View File

@ -34,7 +34,7 @@ class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, WidgetState> {
static getMetaPropertiesMap(): Record<string, any> {
return {
isChecked: false,
isChecked: undefined,
};
}

View File

@ -88,7 +88,7 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
static getMetaPropertiesMap(): Record<string, any> {
return {
selectedOptionValue: undefined,
selectedOptionValueArr: [],
selectedOptionValueArr: undefined,
};
}

View File

@ -37,6 +37,13 @@ class MapWidget extends BaseWidget<MapWidgetProps, WidgetState> {
};
}
static getMetaPropertiesMap(): Record<string, undefined> {
return {
center: undefined,
markers: undefined,
};
}
updateCenter = (lat: number, lng: number) => {
this.updateWidgetMetaProperty("center", { lat, lng });
};

View File

@ -43,7 +43,7 @@ class RadioGroupWidget extends BaseWidget<RadioGroupWidgetProps, WidgetState> {
static getMetaPropertiesMap(): Record<string, any> {
return {
selectedOptionValue: "",
selectedOptionValue: undefined,
};
}

View File

@ -45,22 +45,6 @@ class RichTextEditorWidget extends BaseWidget<
};
}
componentDidMount() {
super.componentDidMount();
if (this.props.defaultText) {
this.updateWidgetMetaProperty("text", this.props.defaultText);
}
}
componentDidUpdate(prevProps: RichTextEditorWidgetProps) {
super.componentDidUpdate(prevProps);
if (this.props.defaultText) {
if (this.props.defaultText !== prevProps.defaultText) {
this.updateWidgetMetaProperty("text", this.props.defaultText);
}
}
}
onValueChange = (text: string) => {
this.updateWidgetMetaProperty("text", text);
if (this.props.onTextChange) {