@fto-consult/expo-ui 7.22.0 → 7.23.0

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.
@@ -6,6 +6,7 @@ import drawerSections from "$navigation/drawerSections";
6
6
  import TableDataListScreen from "$screens/TableData/TableDataListScreen";
7
7
  import TableDataScreen from "$screens/TableData/TableDataScreen";
8
8
  import Notifications from "$components/Notifications";
9
+ import auth from "$src/auth";
9
10
 
10
11
  export default function AppMainEntry(){
11
12
  return <ExpoUIProvider
@@ -29,11 +30,7 @@ export default function AppMainEntry(){
29
30
  },
30
31
  screenOptions : {},//les options du composant Stack.Navigator de react-navigation, voir https://reactnavigation.org/docs/native-stack-navigator/
31
32
  }}
32
- auth = {{
33
- enabled : false,//la gestion de l'authentification est désactivée par défaut
34
- loginPropsMutator : (props)=>props,//({object})=><{object}>, la fonction permettant de muter les props du composant Login,
35
- profilePropsMutator : ({fields,...props})=>({fields,...props}),//la fonction permettant de muter les champs liés à l'écran de mise à jour d'un profil utilisateur
36
- }}
33
+ auth = {auth}
37
34
  components = {{
38
35
  /*** utilisé pour le renu du contenu des écran de type liste sur les tables de données */
39
36
  TableDataListScreen,
@@ -0,0 +1,25 @@
1
+ export default {
2
+ enabled : false,//la gestion de l'authentification est désactivée par défaut
3
+ loginPropsMutator : (props)=>props,//({object})=><{object}>, la fonction permettant de muter les props du composant Login,
4
+ profilePropsMutator : ({fields,...props})=>({fields,...props}),//la fonction permettant de muter les champs liés à l'écran de mise à jour d'un profil utilisateur
5
+ signIn : ({user})=>Promise.resolve({message:"Connecté avec success"}), //la fonction permettant de connecter un utilisateur
6
+ signOut : ({user})=>Promise.resolve({message:"Déconnecté avec success"}),//la fonction permettant de déconnecter un utilisateur
7
+ /**** permet de mettre à jour les informations sur un utilisateurs, informations venant des préférences de ce dernier */
8
+ upsertUser: ({ user }) => Promise.resolve({message:`utilisateur mis à jour avec succèes`}),
9
+ /***** permet de déterminer si l'utilisateur est un super admin */
10
+ isMasterAdmin: (user) => {
11
+ return !!user?.isMasterAdmin;
12
+ },
13
+ //retourne le mail de l'utilisateur s'il y a en a
14
+ getUserEmail: (user) => user.email,
15
+ /*** retourne le code d'utilisateur, alis si un code est utilisé pour identifier l'utilisateur de façon unique, par exemple son pseudo*/
16
+ getUserCode: (user) => {
17
+ return user?.userId || user?._id;
18
+ },
19
+ /*** retourne l'id unique de l'utilisateur */
20
+ getLoginId: (user) => {
21
+ return user.id;
22
+ },
23
+ //retourne le pseudo de l'utilisateur, s'il y en a
24
+ getUserPseudo: (user) => user.pseudo,
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.22.0",
3
+ "version": "7.23.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -71,8 +71,7 @@
71
71
  "@expo/html-elements": "^0.5.1",
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
- "@fto-consult/common": "^4.6.0",
75
- "@fto-consult/expo-ui": "^7.17.9",
74
+ "@fto-consult/common": "^4.6.1",
76
75
  "@fto-consult/node-utils": "^1.3.4",
77
76
  "@pchmn/expo-material3-theme": "^1.3.1",
78
77
  "@react-native-async-storage/async-storage": "1.18.2",
@@ -70,7 +70,6 @@ function App({init:initApp,initialRouteName:appInitialRouteName,children}) {
70
70
  hasCallInitApp : false,
71
71
  });
72
72
  React.useEffect(() => {
73
- console.log(isNeutralino(),window,navigator.userAgent," is neutralino");
74
73
  const loadResources = ()=>{
75
74
  return new Promise((resolve)=>{
76
75
  loadFonts(FontsIconsFilter).catch((e)=>{
@@ -50,6 +50,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
50
50
  const params = defaultObj(route.params);
51
51
  appBarProps = Object.assign({},appBarProps);
52
52
  notificationsProps = {...Object.assign({},notificationsProps),...Object.assign({},appBarProps.notificationsProps)};
53
+ const notif = React.isComponent(Notifications)? <Notifications {...notificationsProps}/> : React.isValidElement(Notifications)? Notifications : null;
53
54
  const getCallAgs = ()=>{
54
55
  options = defaultObj(options,useScreenOptions());
55
56
  return {navigation,
@@ -115,8 +116,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
115
116
  elevation = typeof elevation === 'number'? elevation : undefined;
116
117
  const elevStyle = elevation && Elevations[elevation];
117
118
  titleProps = defaultObj(titleProps);
118
- React.setRef(ref,context);;
119
- const notif = React.isComponent(Notifications)? <Notifications {...notificationsProps}/> : React.isValidElement(Notifications)? Notifications : null;
119
+ React.setRef(ref,context);
120
120
  return (
121
121
  <Appbar.Header elevation={elevation} {...appBarProps} testID={testID} style={[styles.header,{backgroundColor},elevStyle,appBarProps.style]} onLayout={onPageResize}>
122
122
  {backAction}
@@ -19,6 +19,10 @@ export const useApp = useContext;
19
19
  export const ScreenContext = createContext(null);
20
20
 
21
21
  export const useScreen = x=>useReactContext(ScreenContext);
22
+ export const useIsScreenFocused = x=>{
23
+ const s = useScreen();
24
+ return !!(isObj(s) && typeof s.isFocused ==="function" && s.isFocused()) || false
25
+ }
22
26
  export const hasScreenContext = x=>!!useScreen();
23
27
 
24
28
  export const useSWR = (path,options)=>{
@@ -54,6 +54,7 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
54
54
  testID,
55
55
  keyboardAvoidingViewProps,
56
56
  backgroundColor,
57
+ notificationsProps,
57
58
  ...rest
58
59
  } = props;
59
60
 
@@ -62,9 +63,10 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
62
63
  containerProps = defaultObj(containerProps);
63
64
  backgroundColor = theme.Colors.isValid(backgroundColor)? backgroundColor : theme.colors.background;
64
65
  options = defaultObj(options);
65
- appBarProps = defaultObj(appBarProps)
66
+ appBarProps = defaultObj(appBarProps);
66
67
  title = defaultVal(title,appBarProps.title);
67
68
  subtitle = defaultVal(subtitle,appBarProps.subtitle);
69
+ notificationsProps = {...Object.assign({},notificationsProps),...Object.assign({},appBarProps.notificationsProps)};
68
70
  const appBarRef = createAppBarRef();
69
71
  const navigation = useNavigation();
70
72
  fabProps = defaultObj(fabProps);
@@ -93,7 +95,7 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
93
95
  }
94
96
  navigation.setOptions({
95
97
  ...options,
96
- appBarProps:{...options.appBarProps,...appBarProps,title,subtitle},
98
+ appBarProps:{...options.appBarProps,...appBarProps,notificationsProps,title,subtitle},
97
99
  subtitle :subtitle,
98
100
  title : screenTitle,
99
101
  });
@@ -112,11 +114,12 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
112
114
  <View testID={testID+"_ScreenContentContainer"} id={portalId} {...containerProps} style={[styles.container,{backgroundColor},modal && styles.modal,containerProps.style]} >
113
115
  <KeyboardAvoidingView testID={testID} {...keyboardAvoidingViewProps} style={[styles.keyboardAvoidingView,keyboardAvoidingViewProps.style]}>
114
116
  {withStatusBar !== false ? <StatusBar/> : null}
115
- {appBar === false ? null : React.isValidElement(appBar)? state.AppBar : <AppBar
117
+ {appBar === false ? null : React.isValidElement(appBar)? AppBar : <AppBar
116
118
  testID={testID+'_AppBar'}
117
119
  {...appBarProps}
118
120
  backAction = {defaultVal(appBarProps.backAction,backAction)}
119
121
  elevation={defaultNumber(appBarProps.elevation,elevation)}
122
+ notificationsProps = {notificationsProps}
120
123
  withDrawer={withDrawer} options={options}
121
124
  ref={appBarRef} title={title}
122
125
  subtitle={subtitle}
@@ -1,8 +1,12 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
- "version": "7.17.9",
4
- "url": "https://github.com/borispipo/expo-ui#readme",
5
- "license": "ISC"
3
+ "name": "@fto-consult/expo-ui",
4
+ "version": "7.22.1",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/borispipo/expo-ui.git"
8
+ },
9
+ "homepage": "https://github.com/borispipo/expo-ui#readme"
6
10
  },
7
11
  "@babel/plugin-proposal-export-namespace-from": {
8
12
  "version": "7.18.9",
@@ -45,7 +49,7 @@ module.exports = {
45
49
  "license": "MIT"
46
50
  },
47
51
  "@fto-consult/common": {
48
- "version": "4.6.0",
52
+ "version": "4.6.1",
49
53
  "url": "https://github.com/borispipo/common#readme",
50
54
  "license": "ISC"
51
55
  },