@fto-consult/expo-ui 2.15.0 → 2.15.1

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": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,6 +22,7 @@ import cActions from "$cactions";
22
22
  import APP from "$capp/instance";
23
23
  import { generatedColumnsProperties } from "./utils";
24
24
  import i18n from "$i18n";
25
+ import fetch from "$capi/fetch";
25
26
 
26
27
 
27
28
  const HIDE_PRELOADER_TIMEOUT = 300;
@@ -93,12 +94,12 @@ export default class TableDataScreenComponent extends FormDataScreen{
93
94
  if((f.type =='id' || f.type =='piece' || f.unique === true) && f.unique !== false && f.disabled !== true && f.editable !== false && f.readOnly !== true){
94
95
  const {onBlur} = f;
95
96
  f.onBlur = (args)=>{
96
- args = {...f,...args,columnField:name,fieldName:name,id:args.value};
97
+ args = {...f,...args,fetch,columnField:name,fieldName:name,id:args.value};
97
98
  const {context} = args;
98
99
  const r = typeof onBlur =='function'? onBlur (args) : undefined;
99
100
  if(r === false) return r;
100
101
  //on applique la validation seulement en cas de non mise à jour
101
- if(!this.isDocEditingRef.current && context && typeof context.onNoValidate =='function'){
102
+ if(!this.isCurrentDocEditingUpdate() && context && typeof context.onNoValidate =='function'){
102
103
  const cb = typeof field.fetchUniqueId =='function'? field.fetchUniqueId : typeof this.fetchUniqueId =='function'? this.fetchUniqueId : undefined;
103
104
  if(cb){
104
105
  const r2 = cb(args);
@@ -152,6 +153,9 @@ export default class TableDataScreenComponent extends FormDataScreen{
152
153
  this.hidePreloader = this.hidePreloader.bind(this);
153
154
  this.showPreloader = this.showPreloader.bind(this);
154
155
  };
156
+ isCurrentDocEditingUpdate(){
157
+ return this.isDocEditingRef.current === true ? true : false;
158
+ }
155
159
  resetState(){
156
160
  Object.map(this.INITIAL_STATE,(s,k)=>{
157
161
  delete this.INITIAL_STATE[k];
@@ -231,7 +235,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
231
235
  const tableName = this.tableName;
232
236
  const sessionName = this.INITIAL_STATE.sessionName = defaultStr(customSessionName,"table-form-data"+tableName);
233
237
  const isUpdated = this.isDocEditing(data);
234
- this.isDocEditingRef.current = isUpdated;
238
+ this.isDocEditingRef.current = !!isUpdated;
235
239
  const isMobOrTab = isMobileOrTabletMedia();
236
240
  let archived = this.isArchived();
237
241
  this.INITIAL_STATE.archived = archived;
@@ -398,7 +402,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
398
402
  }
399
403
  } else {
400
404
  mainContent = <Surface {...contentProps} testID={testID+"_MainContentContainer"} elevation={elevation} style={[styles.container,styles.noPadding,{paddingTop:0,marginTop:0}]}>
401
- <ScrollView virtualized testID={testID+"_MainContentScrollView"}>
405
+ <ScrollView virtualized testID={testID+"_MainContentScrollViewWithoutTab"}>
402
406
  <View testID={testID+"_MainContent"} style={[styles.screenContent,!isMobOrTab && theme.styles.p1,header?styles.screenContentWithHeader:null]}>
403
407
  {header}
404
408
  {content}
@@ -3,7 +3,6 @@
3
3
  // license that can be found in the LICENSE file.
4
4
  import {navigate,sanitizeName} from "$cnavigation";
5
5
  import {isNonNullString,defaultObj,isObj} from "$utils";
6
-
7
6
  export const tableDataRouteName = 'TableData';
8
7
 
9
8
  export const navigateToTableData = function(tableName,params,actionType){
@@ -54,6 +53,9 @@ export const getTableDataListRouteName = function(tableName){
54
53
  export const navigateToTableDataList = function (tableName,params){
55
54
  const route = getTableDataListRouteName(tableName);
56
55
  if(isNonNullString(route)){
56
+ if(!Auth.isTableDataAllowed({table:tableName,action:'read'})){
57
+ return Auth.showError()
58
+ }
57
59
  return navigate({routeName:route,params});
58
60
  }
59
61
  return false;