@fto-consult/expo-ui 6.74.4 → 6.74.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -710,7 +710,12 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
710
710
|
if(isPromise(upToDB)){
|
711
711
|
upToDB.then((upserted)=>{
|
712
712
|
const willCloseAfterSave = action === 'save2close' || !hasManyData;
|
713
|
-
let
|
713
|
+
let hasUpserted = this.isDocEditing(upserted);
|
714
|
+
if(!hasUpserted && isObj(upserted) && isObj(upserted.data) && this.isDocEditing(upserted.data)){
|
715
|
+
upserted = upserted.data;
|
716
|
+
hasUpserted = true;
|
717
|
+
}
|
718
|
+
const savedData = hasUpserted? upserted : data;
|
714
719
|
const newArgs = {tableName,actionName:action,action,table:this.table,data:savedData,result:upserted,context};
|
715
720
|
APP.trigger(cActions.upsert(tableName),newArgs);
|
716
721
|
if(this.onSaveTableData(newArgs) === false || (isFunction(this.props.onSave)&& this.props.onSave(newArgs) === false)){
|
@@ -739,6 +744,15 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
739
744
|
} else {
|
740
745
|
notify('Données modifiée avec succès!!','success');
|
741
746
|
}
|
747
|
+
if(hasUpserted){
|
748
|
+
if(this.state.hasManyData && Array.isArray(this.state.datas)){
|
749
|
+
const sData = [...this.state.datas];
|
750
|
+
sData[this.state.currentIndex] = savedData;
|
751
|
+
return this.setState({data:upserted,datas:sData},closePreloader);
|
752
|
+
} else {
|
753
|
+
return this.setState({data:savedData},closePreloader);
|
754
|
+
}
|
755
|
+
}
|
742
756
|
closePreloader();
|
743
757
|
}).catch((e)=>{
|
744
758
|
console.log('error on saving table data ',e);
|