@fto-consult/expo-ui 1.1.37 → 1.1.38

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": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  "@expo/html-elements": "^0.2.0",
62
62
  "@expo/metro-config": "^0.4.0",
63
63
  "@expo/webpack-config": "^0.17.2",
64
- "@fto-consult/common": "^1.1.29",
64
+ "@fto-consult/common": "^1.2.0",
65
65
  "@gorhom/portal": "^1.0.14",
66
66
  "@react-native-async-storage/async-storage": "~1.17.3",
67
67
  "@react-native-community/datetimepicker": "6.2.0",
@@ -7,6 +7,7 @@ import theme from "$theme"
7
7
  import Action from "$ecomponents/Form/Action";
8
8
  import Menu from "$ecomponents/Menu";
9
9
  import Icon,{ MORE_ICON } from "$ecomponents/Icon";
10
+ import {isAllowedFromStr} from "$cauth/perms";
10
11
 
11
12
  export const ACTION_ICON_SIZE = 30;
12
13
 
@@ -91,7 +92,9 @@ export const splitActions = (args)=>{
91
92
  let cEl = null;
92
93
  if(!React.isValidElement(act)&& isPlainObj(act)){
93
94
  let {label,perm,text,...action} = act;
94
- if(typeof perm =='function' && perm(args) === false){
95
+ if(isNonNullString(perm) && !isAllowedFromStr(perm)){
96
+ continue;
97
+ } else if(typeof perm =='function' && perm(args) === false){
95
98
  continue;
96
99
  }
97
100
  action = {...defaultObj(action)};
@@ -131,7 +134,7 @@ export const splitActions = (args)=>{
131
134
  }
132
135
  if(isPlainObj(cancelButton) && !React.isValidElement(cancelButton)){
133
136
  let {label,perm,text,...action} = cancelButton;
134
- let canAddCancelBtn = typeof perm =='function' ? perm(args) : true;
137
+ let canAddCancelBtn = isNonNullString(perm) ? isAllowedFromStr(perm) : typeof perm =='function' ? perm(args) : true;
135
138
  if(canAddCancelBtn && (text||label)){
136
139
  action = {...defaultObj(action)};
137
140
  action.label = defaultVal(label,text)
@@ -104,6 +104,9 @@ export default class FormComponent extends React.AppComponent {
104
104
  testID,
105
105
  ...rest
106
106
  } = this.props;
107
+ if(isNonNullString(perm) && !Auth.isAllowedFromStr(perm)){
108
+ return null;
109
+ }
107
110
  rest = defaultObj(rest);
108
111
  const ComponentNode = defaultVal(Component,defaultComponentNode);
109
112
  testID = defaultStr(testID,"RN_FormComponent");
@@ -25,7 +25,7 @@ export default class FormDataComponent extends AppComponent{
25
25
  value : x=> formName,
26
26
  },
27
27
  isAllowed : {
28
- value : true
28
+ value : isNonNullString(this.props.perm) ? Auth.isAllowedFromStr(this.props.perm) : true
29
29
  },
30
30
  });
31
31
  }