@fto-consult/expo-ui 5.11.6 → 5.11.8

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": "5.11.6",
3
+ "version": "5.11.8",
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
  "@emotion/native": "^11.11.0",
62
62
  "@expo/html-elements": "^0.2.0",
63
63
  "@expo/vector-icons": "^13.0.0",
64
- "@fto-consult/common": "^3.18.0",
64
+ "@fto-consult/common": "^3.18.22",
65
65
  "@gorhom/portal": "^1.0.14",
66
66
  "@react-native-async-storage/async-storage": "^1.17.11",
67
67
  "@react-native-community/datetimepicker": "^6.7.3",
package/src/auth/Login.js CHANGED
@@ -213,7 +213,7 @@ export default function LoginComponent(props){
213
213
  return <Wrapper testID = {testID+"_Wrapper" }{...wrapperProps}>
214
214
  <DialogProvider ref={dialogProviderRef}/>
215
215
  {sH}
216
- <Surface style={[styles.container,{backgroundColor}]} {...containerProps} testID={testID}>
216
+ <Surface {...containerProps} {...defaultObj(loginProps?.containerProps)} style={[styles.container,{backgroundColor},containerProps.style,loginProps?.containerProps?.style]} testID={testID}>
217
217
  <Surface elevation = {0} {...contentProps} mediaQueryUpdateNativeProps = {mQueryUpdateProps} {...contentProps} testID={testID+"_Content"} style={[styles.content,updateMediaQueryStyle(),{backgroundColor},contentProps.style]}>
218
218
  <FormData
219
219
  formName = {formName}
@@ -347,3 +347,10 @@ LoginComponent.propTypes = {
347
347
  PropTypes.element,
348
348
  ]),
349
349
  }
350
+
351
+ /*** les loginProps sont les porps à passer au composant FormData
352
+ */
353
+ const loginPropTypes = {
354
+ containerProps : PropTypes.object, //les props à passer au container
355
+ ...FormData.propTypes, //les props type du composant form data
356
+ }
@@ -4,7 +4,7 @@
4
4
  ///permet de sélectionner un theme utilisateur
5
5
  import React from "$react";
6
6
  import Label from "$ecomponents/Label";
7
- import Auth,{login} from "$cauth";
7
+ import Auth,{login,getLoginId} from "$cauth";
8
8
  import View from "$ecomponents/View";
9
9
  import { StyleSheet } from "react-native";
10
10
  import defaultTheme,{getColors} from "$theme/defaultTheme";
@@ -38,8 +38,10 @@ export const getThemeFieldProps = (props,ref)=>{
38
38
  props = defaultObj(props);
39
39
  let {user,showAdd,onValidate,onChange,onUpsert,...rest} = props;
40
40
  const loggedUser = defaultObj(Auth.getLoggedUser());
41
- user = defaultObj(user,loggedUser);
42
- const isUserActive = loggedUser.code == user.code && user.code ? true : false;
41
+ user = defaultObj(user,loggedUser);
42
+ const loginId = getLoginId(user);
43
+ const hasLoginId = isNonNullString(loginId) || typeof loginId =='number';
44
+ const isUserActive = getLoginId(loggedUser) == loginId && hasLoginId ? true : false;
43
45
  const userTheme = defaultObj(user.theme);
44
46
  const userThemeName = defaultStr(userTheme.name,defaultTheme.name);
45
47
  const isDark = theme.isDark() || theme.isDarkUI();
@@ -48,7 +50,7 @@ export const getThemeFieldProps = (props,ref)=>{
48
50
  const showThemeExplorer = (data)=>{
49
51
  data = defaultObj(data,defTheme);
50
52
  fields.name.disabled = ({data})=> data && isNonNullString(data.name);
51
- const title = data && data.name ? ("Modifier ["+data.name+"]") : ('Nouv theme['+user.code+"]");
53
+ const title = data && data.name ? ("Modifier ["+data.name+"]") : ('Nouv theme['+loginId+"]");
52
54
  const isEditing = isDocEditing(data);
53
55
  fields.textFieldMode.defaultValue = theme.textFieldMode;
54
56
  fields.profilAvatarPosition.defaultValue = theme.profilAvatarPosition;
@@ -86,7 +88,7 @@ export const getThemeFieldProps = (props,ref)=>{
86
88
  user.customThemes = customThemes;
87
89
  open((isEditing?"Modification ":"Enregistrement ")+"du thème...");
88
90
  Auth.upsertUser(user,false).then(()=>{
89
- if(Auth.getLoggedUserCode() == user.code){
91
+ if(Auth.getLoginId(Auth.getLoggedUser()) == getLoginId(user)){
90
92
  login(user,false);
91
93
  }
92
94
  if(ref && ref.current && ref.current.refresh){
package/src/index.js CHANGED
@@ -227,8 +227,9 @@ function App({init:initApp,initialRouteName:appInitialRouteName,render,onMount,p
227
227
  }
228
228
  },[isInitialized]);
229
229
  const hasGetStarted = state.hasGetStarted !== false? true : false;
230
-
231
- const [theme,setTheme] = React.useState(updateTheme(defaultTheme));
230
+ const themeRef = React.useRef(null);
231
+ const [theme,setTheme] = React.useState(themeRef.current || updateTheme(defaultTheme));
232
+ themeRef.current = theme;
232
233
  const updatePreferenceTheme = (customTheme,persist)=>{
233
234
  setTheme(updateTheme(customTheme));
234
235
  };
@@ -136,7 +136,7 @@ const PermProfile = React.forwardRef((props,ref)=>{
136
136
  profiles.push(<View key={index} style={[theme.styles.row,{justifyContent:'space-between'}]}>
137
137
  <Label>{profile.code}</Label>
138
138
  <View style={[theme.styles.row]}>
139
- <Icon primary title={isAssigned?'Profil de permission ['+profile.code+'] assigné à l\'utilisateur':'Profil de permission ['+profile.code+'] non assigné à l\'utilisateur '+defaultStr(user.code)} name={isAssigned?'checkbox-marked':'checkbox-blank-outline'}
139
+ <Icon primary title={isAssigned?'Profil de permission ['+profile.code+'] assigné à l\'utilisateur':'Profil de permission ['+profile.code+'] non assigné à l\'utilisateur '+String(Auth.getLoginId(user))} name={isAssigned?'checkbox-marked':'checkbox-blank-outline'}
140
140
  onPress={()=>{
141
141
  assignProfile(profile,isAssigned?false:true)
142
142
  }}
@@ -77,7 +77,7 @@ export default function UserProfileScreen(props){
77
77
  }
78
78
 
79
79
  return <FormDataScreen
80
- title = {(user.label?(user.label+" ["+user.code+"] | "):"")+"Profil : Modifier"}
80
+ title = {(user.label?(user.label+" ["+Auth.getLoginId(user)+"] | "):"")+"Profil : Modifier"}
81
81
  {...props}
82
82
  modal
83
83
  withScrollView