Fix linter errors in previous commit.

This commit is contained in:
Aditya Toshniwal 2021-07-05 15:58:09 +05:30 committed by Akshay Joshi
parent 6b9e8c3039
commit bd5536dbf9
4 changed files with 14 additions and 8 deletions

View File

@ -394,7 +394,7 @@ export default function DataGridView({
<FormView value={row.original} viewHelperProps={viewHelperProps} formErr={formErr} dataDispatch={dataDispatch} <FormView value={row.original} viewHelperProps={viewHelperProps} formErr={formErr} dataDispatch={dataDispatch}
schema={schemaRef.current} accessPath={accessPath.concat([row.index])} isNested={true} className={classes.expandedForm}/> schema={schemaRef.current} accessPath={accessPath.concat([row.index])} isNested={true} className={classes.expandedForm}/>
} }
</React.Fragment> </React.Fragment>;
})} })}
</div> </div>
</div> </div>
@ -412,6 +412,7 @@ DataGridView.propTypes = {
accessPath: PropTypes.array.isRequired, accessPath: PropTypes.array.isRequired,
dataDispatch: PropTypes.func.isRequired, dataDispatch: PropTypes.func.isRequired,
containerClassName: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), containerClassName: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
columns: PropTypes.array,
canEdit: PropTypes.bool, canEdit: PropTypes.bool,
canAdd: PropTypes.bool, canAdd: PropTypes.bool,
canDelete: PropTypes.bool, canDelete: PropTypes.bool,

View File

@ -267,4 +267,5 @@ FormView.propTypes = {
getSQLValue: PropTypes.func, getSQLValue: PropTypes.func,
onTabChange: PropTypes.func, onTabChange: PropTypes.func,
firstEleRef: CustomPropTypes.ref, firstEleRef: CustomPropTypes.ref,
className: CustomPropTypes.className,
}; };

View File

@ -91,7 +91,7 @@ function getChangedData(topSchema, mode, sessData, stringify=false) {
/* If the orig value and new value are of different datatype but of same value(numeric) "no change" */ /* If the orig value and new value are of different datatype but of same value(numeric) "no change" */
/* If the orig value is undefined or null and new value is boolean false "no change" */ /* If the orig value is undefined or null and new value is boolean false "no change" */
if ((_.isEqual(origVal, sessVal) if ((_.isEqual(origVal, sessVal)
|| ((origVal === null || _.isUndefined(origVal)) && !Boolean(sessVal)) || ((origVal === null || _.isUndefined(origVal)) && !sessVal)
|| (attrDefined ? _.isEqual(origVal.toString(), sessVal.toString()) : false)) || (attrDefined ? _.isEqual(origVal.toString(), sessVal.toString()) : false))
&& !force) { && !force) {
return; return;
@ -412,16 +412,19 @@ function SchemaDialogView({
setSaving(true); setSaving(true);
setLoaderText('Saving...'); setLoaderText('Saving...');
/* Get the changed data */ /* Get the changed data */
let data = getChangedData(schema, viewHelperProps.mode, sessData); let changeData = {};
/* Add the id when in edit mode */ /* Add the id when in edit mode */
if(viewHelperProps.mode === 'edit') { if(viewHelperProps.mode === 'edit') {
data[schema.idAttribute] = schema.origData[schema.idAttribute]; changeData = getChangedData(schema, viewHelperProps.mode, sessData);
changeData[schema.idAttribute] = schema.origData[schema.idAttribute];
} else { } else {
/* If new then merge the changed data with origData */ /* If new then merge the changed data with origData */
data = _.merge(schema.origData, data); changeData = {...schema.origData};
_.merge(changeData, sessData);
} }
props.onSave(isNew, data)
props.onSave(isNew, changeData)
.then(()=>{ .then(()=>{
if(schema.informText) { if(schema.informText) {
pgAlertify().alert( pgAlertify().alert(
@ -457,7 +460,8 @@ function SchemaDialogView({
changeData = getChangedData(schema, viewHelperProps.mode, sessData); changeData = getChangedData(schema, viewHelperProps.mode, sessData);
} else { } else {
/* If new then merge the changed data with origData */ /* If new then merge the changed data with origData */
changeData = _.merge(schema.origData, sessData); changeData = {...schema.origData};
_.merge(changeData, sessData);
} }
/* Call the passed incoming getSQLValue func to get the SQL /* Call the passed incoming getSQLValue func to get the SQL
return of getSQLValue should be a promise. return of getSQLValue should be a promise.

View File

@ -442,7 +442,7 @@ const customReactSelectStyles = (theme, readonly)=>({
...provided, ...provided,
padding: '0rem 0.25rem', padding: '0rem 0.25rem',
}), }),
valueContainer: (provided, state)=>({ valueContainer: (provided)=>({
...provided, ...provided,
padding: theme.otherVars.reactSelect.padding, padding: theme.otherVars.reactSelect.padding,
}), }),