@fto-consult/expo-ui 1.0.29 → 1.0.31
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/babel.config.alias.js +11 -0
- package/package.json +2 -2
- package/src/App.js +1 -1
- package/src/auth/index.js +7 -1
- package/src/navigation/Drawer/ProfilAvatar/index.js +4 -5
- package/src/navigation/Drawer/index.js +1 -1
- package/src/navigation/Drawer/items/default.js +5 -0
- package/src/navigation/Drawer/items/index.js +43 -3
- package/src/navigation/index.js +4 -3
- package/src/screens/utils.js +1 -1
- package/src/navigation/Drawer/items/SidebarFeedsItems.js +0 -0
- package/src/navigation/Drawer/items/SyncDataItem.js +0 -20
- package/src/navigation/Drawer/items/items.js +0 -31
- package/src/navigation/utils.js +0 -1
package/babel.config.alias.js
CHANGED
|
@@ -42,6 +42,17 @@ module.exports = (opts)=>{
|
|
|
42
42
|
if(!r["$file-system"]){
|
|
43
43
|
r["$file-system"] = r["$efile-system"];
|
|
44
44
|
}
|
|
45
|
+
/*** cet alias est utilisé pour modifier les différents items par défaut, rendu par le composant Drawer
|
|
46
|
+
* l'alias @drawerItems doit retourner en default, soit un tableau où un objet d'objet où une fonction
|
|
47
|
+
* si c'est une fonction, alors la function est exécutée pour obtenir la liste des items à utiliser par le drawer principal
|
|
48
|
+
*/
|
|
49
|
+
if(!r["$drawerItems"]){
|
|
50
|
+
r["$drawerItems"] = path.resolve(expo,"navigation","Drawer","items","default")
|
|
51
|
+
}
|
|
52
|
+
///si l'alias $navigation n'a pas été définie par défaut, alors celui cet allias prendra la même valeur que celle de $envigation
|
|
53
|
+
if(r["$navigation"] == r["$cnavigation"]){
|
|
54
|
+
r["$navigation"] = r["$enavigation"];
|
|
55
|
+
}
|
|
45
56
|
if(typeof opts.mutator =='function'){
|
|
46
57
|
opts.mutator(r);
|
|
47
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@emotion/native": "^11.10.0",
|
|
61
61
|
"@expo/metro-config": "^0.4.0",
|
|
62
62
|
"@expo/webpack-config": "^0.17.2",
|
|
63
|
-
"@fto-consult/common": "^1.1.
|
|
63
|
+
"@fto-consult/common": "^1.1.8",
|
|
64
64
|
"@gorhom/portal": "^1.0.14",
|
|
65
65
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
66
66
|
"@react-native-community/netinfo": "9.3.0",
|
package/src/App.js
CHANGED
|
@@ -12,7 +12,7 @@ import DialogProvider from "$ecomponents/Dialog/Provider";
|
|
|
12
12
|
import { DialogProvider as FormDataDialogProvider } from '$eform/FormData';
|
|
13
13
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
14
14
|
import { PreferencesContext } from './Preferences';
|
|
15
|
-
import {AuthProvider} from '$
|
|
15
|
+
import {AuthProvider} from '$eauth';
|
|
16
16
|
import {PortalProvider } from '$ecomponents/Portal';
|
|
17
17
|
import ErrorBoundary from "$ecomponents/ErrorBoundary";
|
|
18
18
|
import ErrorBoundaryProvider from "$ecomponents/ErrorBoundary/Provider";
|
package/src/auth/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import defaultSource from "./defaultAvatar";
|
|
|
10
10
|
import Button from "$ecomponents/Button";
|
|
11
11
|
import Label from "$ecomponents/Label";
|
|
12
12
|
import Icon from "$ecomponents/Icon";
|
|
13
|
-
import {navigate} from "$
|
|
13
|
+
import {navigate} from "$cnavigation";
|
|
14
14
|
import theme from "$theme";
|
|
15
15
|
import {isMobileNative} from "$cplatform";
|
|
16
16
|
|
|
@@ -34,7 +34,6 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
34
34
|
return navigate({
|
|
35
35
|
//routeName : screenName,
|
|
36
36
|
params : {
|
|
37
|
-
code : defaultStr(u.code),
|
|
38
37
|
user : u,
|
|
39
38
|
}
|
|
40
39
|
})
|
|
@@ -49,7 +48,7 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
];
|
|
52
|
-
let pseudo = defaultStr(u.code);
|
|
51
|
+
let pseudo = defaultStr(u.code,u.pseudo,u.email);
|
|
53
52
|
let pT = pseudo;
|
|
54
53
|
if(pseudo.length > 8){
|
|
55
54
|
pT = pseudo.substring(0,7)+".."
|
|
@@ -80,7 +79,7 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
80
79
|
} else {
|
|
81
80
|
u.avatar = dataURL;
|
|
82
81
|
}
|
|
83
|
-
Auth.upsertUser({
|
|
82
|
+
Auth.upsertUser({...u,avatar:u.avatar},false);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
/>}
|
|
@@ -96,7 +95,7 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
96
95
|
}}
|
|
97
96
|
>
|
|
98
97
|
<View style={styles.labelContainer}>
|
|
99
|
-
<Label splitText style={{color:theme.colors.primaryOnSurface}}>{
|
|
98
|
+
<Label splitText style={{color:theme.colors.primaryOnSurface}}>{pseudo}</Label>
|
|
100
99
|
<Label splitText style={{fontSize:12,color:theme.colors.secondaryOnSurface,marginTop:6}}>
|
|
101
100
|
{u.label}
|
|
102
101
|
</Label>
|
|
@@ -5,7 +5,7 @@ import items,{isItemActive,refresh as refreshItems} from "./items";
|
|
|
5
5
|
import APP from "$capp/instance";
|
|
6
6
|
import Auth from "$cauth";
|
|
7
7
|
import Login from "$eauth/Login";
|
|
8
|
-
import {navigate} from "$
|
|
8
|
+
import {navigate} from "$cnavigation";
|
|
9
9
|
|
|
10
10
|
const DrawerNavigator = React.forwardRef(({content,children,state,...props},ref)=>{
|
|
11
11
|
const drawerRef = React.useRef(null);
|
|
@@ -1,14 +1,54 @@
|
|
|
1
|
+
// Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
1
5
|
import { isRouteActive} from "$enavigation/utils";
|
|
2
|
-
import
|
|
6
|
+
import "$cutils";
|
|
7
|
+
import APP from "$capp";
|
|
8
|
+
///les items du drawer
|
|
9
|
+
import items from "$drawerItems";
|
|
10
|
+
|
|
11
|
+
export const getItems = (force)=>{
|
|
12
|
+
const name = APP.getName();
|
|
13
|
+
const itx = typeof items === "function" ? items() : items;
|
|
14
|
+
const r = [
|
|
15
|
+
{
|
|
16
|
+
label : name,
|
|
17
|
+
icon : 'view-dashboard',
|
|
18
|
+
title : 'Dashboard',
|
|
19
|
+
routeName : "Home",
|
|
20
|
+
divider : true,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
Object.map(itx,(item,i)=>{
|
|
24
|
+
if(isObj(item)){
|
|
25
|
+
r.push(item);
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
r.push({
|
|
29
|
+
key : 'dataHelp',
|
|
30
|
+
label : 'Aide',
|
|
31
|
+
section : true,
|
|
32
|
+
divider : false,
|
|
33
|
+
items : [
|
|
34
|
+
/*{
|
|
35
|
+
icon : 'timeline-help',
|
|
36
|
+
label : name+", Mises à jour",
|
|
37
|
+
},*/
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
return r;
|
|
41
|
+
}
|
|
42
|
+
|
|
3
43
|
|
|
4
44
|
let CACHED_ITEMS = []
|
|
5
45
|
|
|
6
46
|
export const refresh = ()=>{
|
|
7
|
-
CACHED_ITEMS =
|
|
47
|
+
CACHED_ITEMS = getItems();
|
|
8
48
|
return CACHED_ITEMS;
|
|
9
49
|
}
|
|
10
50
|
|
|
11
|
-
export default function
|
|
51
|
+
export default function mainDrawerItems(options){
|
|
12
52
|
if(!CACHED_ITEMS.length){
|
|
13
53
|
refresh();
|
|
14
54
|
}
|
package/src/navigation/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from "./utils";
|
|
2
1
|
import initScreens from "$escreens";
|
|
3
2
|
import {handleContent,sanitizeName} from '$escreens';
|
|
4
|
-
import {Stack,setInitialRouteName } from "
|
|
3
|
+
import {Stack,setInitialRouteName } from "$cnavigation";
|
|
5
4
|
import React from "$react";
|
|
6
5
|
import DrawerNavigator from "./Drawer";
|
|
7
6
|
|
|
@@ -42,4 +41,6 @@ export default function NavigationComponent (props){
|
|
|
42
41
|
</Stack.Group>
|
|
43
42
|
</Stack.Navigator> }
|
|
44
43
|
</DrawerNavigator>
|
|
45
|
-
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export * from "$cnavigation";
|
package/src/screens/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {sanitizeName} from "$cnavigation
|
|
1
|
+
export {sanitizeName} from "$cnavigation";
|
|
2
2
|
/**** les groupes d'écrans stack de l'application
|
|
3
3
|
* un écran peut appartenir à un seul ou plusieur groupe. cependant, le groupe préviée prend la priorité.
|
|
4
4
|
* Ainsi, un écran ne peut être a la fois être public et privée. si tel est le cas, le groupe privée emporte
|
|
File without changes
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Icon from "$ecomponents/Icon";
|
|
2
|
-
import React from "$react";
|
|
3
|
-
import sync from "$database/sync";
|
|
4
|
-
//import SyncInfos from "$ecomponents/Data/SyncInfos";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
icon : 'cloud-sync',
|
|
8
|
-
label : 'Synchroniser',
|
|
9
|
-
/*right : (props) => <Icon
|
|
10
|
-
{...props}
|
|
11
|
-
icon ="information-outline"
|
|
12
|
-
title="Cliquez pour afficher les informations relatives à la synchronisation des données."
|
|
13
|
-
/>,*/
|
|
14
|
-
onPress:(e)=>{
|
|
15
|
-
React.stopEventPropagation(e);
|
|
16
|
-
sync.run();
|
|
17
|
-
return false;
|
|
18
|
-
//mountDialog(<SyncInfos key={uniqid("sync-infos-k")}/>,"synch-data-dialog-id-mount")/>
|
|
19
|
-
} ,
|
|
20
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import APP from "$capp";
|
|
2
|
-
|
|
3
|
-
const refresh = (force)=>{
|
|
4
|
-
const name = APP.getName();
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
label : name,
|
|
8
|
-
icon : 'view-dashboard',
|
|
9
|
-
title : 'Dashboard',
|
|
10
|
-
routeName : "Home",
|
|
11
|
-
divider : true,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
divider : true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
key : 'dataHelp',
|
|
18
|
-
label : 'Aide',
|
|
19
|
-
section : true,
|
|
20
|
-
divider : false,
|
|
21
|
-
items : [
|
|
22
|
-
/*{
|
|
23
|
-
icon : 'timeline-help',
|
|
24
|
-
label : name+", Mises à jour",
|
|
25
|
-
},*/
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default refresh;
|
package/src/navigation/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "$cnavigation/utils";
|