@fto-consult/expo-ui 6.74.3 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.74.3",
3
+ "version": "6.74.5",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -186,7 +186,10 @@ export default class TableDataScreenComponent extends FormDataScreen{
186
186
  return isObj(permsR) ? extendObj({},ePerms,permsR) : ePerms;
187
187
  }
188
188
  getRenderedActionPrefix (){}
189
- renderActions(){
189
+ renderActions(args,...rest){
190
+ if(typeof this.props.renderActions =="function"){
191
+ return this.props.renderActions(args,...rest);
192
+ }
190
193
  return null;
191
194
  }
192
195
  isLoading(){
@@ -707,7 +710,12 @@ export default class TableDataScreenComponent extends FormDataScreen{
707
710
  if(isPromise(upToDB)){
708
711
  upToDB.then((upserted)=>{
709
712
  const willCloseAfterSave = action === 'save2close' || !hasManyData;
710
- let savedData = this.isDocEditing(upserted)? upserted : data;
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;
711
719
  const newArgs = {tableName,actionName:action,action,table:this.table,data:savedData,result:upserted,context};
712
720
  APP.trigger(cActions.upsert(tableName),newArgs);
713
721
  if(this.onSaveTableData(newArgs) === false || (isFunction(this.props.onSave)&& this.props.onSave(newArgs) === false)){
@@ -736,6 +744,15 @@ export default class TableDataScreenComponent extends FormDataScreen{
736
744
  } else {
737
745
  notify('Données modifiée avec succès!!','success');
738
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
+ }
739
756
  closePreloader();
740
757
  }).catch((e)=>{
741
758
  console.log('error on saving table data ',e);