Merge branch 'release' of github.com:appsmithorg/appsmith into release

This commit is contained in:
Hetu Nandu 2020-08-17 20:31:27 +05:30
commit 96cdc074f3
2 changed files with 41 additions and 8 deletions

View File

@ -16,6 +16,23 @@
transition: all ease-in 0.3s;
}
</style>
<script type="text/javascript">
// INTERCOM SETUP
const APP_ID = "%REACT_APP_INTERCOM_APP_ID%"
const CLOUD_HOSTING = "%REACT_APP_CLOUD_HOSTING%"
if(APP_ID.length && CLOUD_HOSTING.length) {
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
}
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=%REACT_APP_GOOGLE_ANALYTICS_ID%"></script>
<script>
// GA SETUP
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', "%REACT_APP_GOOGLE_ANALYTICS_ID%");
</script>
</head>
<body>
@ -84,13 +101,6 @@
intercomAppID: parseConfig("__APPSMITH_INTERCOM_APP_ID__"),
};
</script>
<script>
console.log({ window });
if(window.APPSMITH_FEATURE_CONFIGS.cloudHosting && window.APPSMITH_FEATURE_CONFIGS.intercomAppID) {
const WIDGET_URL = `https://widget.intercom.io/widget/${window.APPSMITH_FEATURE_CONFIGS.intercomAppID}`;
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src=WIDGET_URL;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
}
</script>
<script rel="prefetch" type="text/javascript" src="/shims/realms-shim.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.4.0/tinymce.min.js" referrerpolicy="origin"></script>
</body>

View File

@ -58,7 +58,29 @@ class InputWidget extends BaseWidget<InputWidgetProps, InputWidgetState> {
static getDerivedPropertiesMap(): DerivedPropertiesMap {
return {
isValid: `{{!!(this.isRequired ? this.text && this.text.length > 0 ? this.regex ? new RegExp(this.regex).test(this.text) : true : false : this.regex ? new RegExp(this.regex).test(this.text) : true)}}`,
isValid: `{{
function(){
const isEmailType = this.inputType === "EMAIL";
if(isEmailType) {
const emailRegex = new RegExp(/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/);
return emailRegex.test(this.text);
} else if(this.isRequired) {
if(this.text && this.text.length > 0) {
if(this.regex) {
return new RegExp(this.regex).test(this.text)
} else {
return true;
}
} else {
return false;
}
} if(this.regex) {
return new RegExp(this.regex).test(this.text)
} else {
return true;
}
}()
}}`,
value: `{{this.text}}`,
};
}
@ -117,6 +139,7 @@ class InputWidget extends BaseWidget<InputWidgetProps, InputWidgetState> {
const value = this.state.text || "";
const isInvalid =
"isValid" in this.props && !this.props.isValid && !!this.props.isDirty;
const conditionalProps: Partial<InputComponentProps> = {};
conditionalProps.errorMessage = this.props.errorMessage;
if (this.props.isRequired && value.length === 0) {