openlaw-elements
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -55,17 +55,14 @@ "use strict"; | ||
if (this.props.savedValue) { | ||
var identity = this.openLaw.checkValidity(this.props.savedValue); | ||
var identity = this.openLaw.checkValidity(this.props.variable, this.props.savedValue, this.props.executionResult); | ||
this.setState({ | ||
email: this.openLaw.getIdentityEmail(identity), | ||
validationError: false | ||
email: this.openLaw.getIdentityEmail(identity) | ||
}); | ||
} else { | ||
this.setState({ | ||
email: '', | ||
validationError: false | ||
email: '' | ||
}); | ||
} | ||
} catch (ex) { | ||
} catch (error) { | ||
this.setState({ | ||
email: '', | ||
validationError: false | ||
email: '' | ||
}); | ||
@@ -75,21 +72,2 @@ } | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
try { | ||
if (prevProps.savedValue !== this.props.savedValue) { | ||
var identity = this.openLaw.checkValidity(this.props.variable, this.props.savedValue, this.props.executionResult); | ||
if (!this.state.email) { | ||
this.setState({ | ||
email: this.openLaw.getIdentityEmail(identity) | ||
}); | ||
} | ||
} | ||
} catch (error) { | ||
// TODO actually handle error | ||
// eslint-disable-next-line no-undef | ||
console.error(error); | ||
} | ||
} | ||
}, { | ||
key: "onChange", | ||
@@ -104,4 +82,4 @@ value: function onChange(event) { | ||
this.setState({ | ||
validationError: false, | ||
email: eventValue | ||
email: '', | ||
validationError: false | ||
}, function () { | ||
@@ -115,6 +93,7 @@ _this2.props.onChange(_this2.openLaw.getName(_this2.props.variable), ''); | ||
}); | ||
this.props.onChange(this.openLaw.getName(this.props.variable), this.openLaw.createIdentityInternalValue('', eventValue)); | ||
var variableName = this.openLaw.getName(this.props.variable); | ||
this.props.onChange(variableName, this.openLaw.createIdentityInternalValue('', eventValue)); | ||
this.props.apiClient.getUserDetails(eventValue).then(function (result) { | ||
if (result.email) { | ||
_this2.props.onChange(_this2.openLaw.getName(_this2.props.variable), _this2.openLaw.createIdentityInternalValue(result.id, result.email)); | ||
_this2.props.onChange(variableName, _this2.openLaw.createIdentityInternalValue(result.id, result.email)); | ||
@@ -121,0 +100,0 @@ _this2.setState({ |
@@ -90,3 +90,4 @@ "use strict"; | ||
type: "radio", | ||
value: "true" | ||
value: "true", | ||
checked: this.state.currentValue === 'true' | ||
}), React.createElement("span", null, "Yes")), React.createElement("label", { | ||
@@ -99,3 +100,4 @@ className: "radio-label" | ||
type: "radio", | ||
value: "false" | ||
value: "false", | ||
checked: this.state.currentValue === 'false' | ||
}), React.createElement("span", null, "No")))); | ||
@@ -102,0 +104,0 @@ } |
@@ -39,17 +39,14 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
if (this.props.savedValue) { | ||
var identity = this.openLaw.checkValidity(this.props.savedValue); | ||
var identity = this.openLaw.checkValidity(this.props.variable, this.props.savedValue, this.props.executionResult); | ||
this.setState({ | ||
email: this.openLaw.getIdentityEmail(identity), | ||
validationError: false | ||
email: this.openLaw.getIdentityEmail(identity) | ||
}); | ||
} else { | ||
this.setState({ | ||
email: '', | ||
validationError: false | ||
email: '' | ||
}); | ||
} | ||
} catch (ex) { | ||
} catch (error) { | ||
this.setState({ | ||
email: '', | ||
validationError: false | ||
email: '' | ||
}); | ||
@@ -59,21 +56,2 @@ } | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
try { | ||
if (prevProps.savedValue !== this.props.savedValue) { | ||
var identity = this.openLaw.checkValidity(this.props.variable, this.props.savedValue, this.props.executionResult); | ||
if (!this.state.email) { | ||
this.setState({ | ||
email: this.openLaw.getIdentityEmail(identity) | ||
}); | ||
} | ||
} | ||
} catch (error) { | ||
// TODO actually handle error | ||
// eslint-disable-next-line no-undef | ||
console.error(error); | ||
} | ||
} | ||
}, { | ||
key: "onChange", | ||
@@ -88,4 +66,4 @@ value: function onChange(event) { | ||
this.setState({ | ||
validationError: false, | ||
email: eventValue | ||
email: '', | ||
validationError: false | ||
}, function () { | ||
@@ -99,6 +77,7 @@ _this2.props.onChange(_this2.openLaw.getName(_this2.props.variable), ''); | ||
}); | ||
this.props.onChange(this.openLaw.getName(this.props.variable), this.openLaw.createIdentityInternalValue('', eventValue)); | ||
var variableName = this.openLaw.getName(this.props.variable); | ||
this.props.onChange(variableName, this.openLaw.createIdentityInternalValue('', eventValue)); | ||
this.props.apiClient.getUserDetails(eventValue).then(function (result) { | ||
if (result.email) { | ||
_this2.props.onChange(_this2.openLaw.getName(_this2.props.variable), _this2.openLaw.createIdentityInternalValue(result.id, result.email)); | ||
_this2.props.onChange(variableName, _this2.openLaw.createIdentityInternalValue(result.id, result.email)); | ||
@@ -105,0 +84,0 @@ _this2.setState({ |
@@ -74,3 +74,4 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
type: "radio", | ||
value: "true" | ||
value: "true", | ||
checked: this.state.currentValue === 'true' | ||
}), React.createElement("span", null, "Yes")), React.createElement("label", { | ||
@@ -83,3 +84,4 @@ className: "radio-label" | ||
type: "radio", | ||
value: "false" | ||
value: "false", | ||
checked: this.state.currentValue === 'false' | ||
}), React.createElement("span", null, "No")))); | ||
@@ -86,0 +88,0 @@ } |
{ | ||
"name": "openlaw-elements", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "Dynamically render React form components from an OpenLaw template.", | ||
@@ -5,0 +5,0 @@ "author": "OpenLaw Team <opensource@openlaw.io>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
434515
5117