@fto-consult/expo-ui 6.62.5 → 6.64.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.
package/bin/create-app.js
CHANGED
@@ -112,6 +112,7 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
|
|
112
112
|
"version":"${version}",
|
113
113
|
"orientation": "portrait",
|
114
114
|
"icon": "./assets/icon.png",
|
115
|
+
"jsEngine": "hermes",
|
115
116
|
"splash": {
|
116
117
|
"image": "./assets/splash.png",
|
117
118
|
"resizeMode": "contain",
|
package/metro.config.js
CHANGED
@@ -16,7 +16,7 @@ module.exports = function(opts){
|
|
16
16
|
const config = getDefaultConfig(projectRoot,{
|
17
17
|
// Enable CSS support.,
|
18
18
|
isCSSEnabled: true,
|
19
|
-
mode: hasTranspilePath && 'exotic' || undefined,
|
19
|
+
//mode: hasTranspilePath && 'exotic' || undefined,
|
20
20
|
});
|
21
21
|
if(hasTranspilePath){
|
22
22
|
config.transformer.babelTransformerPath = transpilePath;
|
@@ -26,6 +26,9 @@ module.exports = function(opts){
|
|
26
26
|
if(!isLocalTest && isDev){
|
27
27
|
config.watchFolders.push(localDir);
|
28
28
|
}
|
29
|
+
if(isDev){
|
30
|
+
config.watchFolders.push(path.resolve(projectRoot,"node_modules","fto-consult","common"));
|
31
|
+
}
|
29
32
|
// 2. Let Metro know where to resolve packages and in what order
|
30
33
|
const nodeModulesPaths = (Array.isArray(config.resolver.nodeModulesPaths)?config.resolver.nodeModulesPaths : []);
|
31
34
|
const nodeModulePath = path.resolve(projectRoot, 'node_modules');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.64.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"main": "main",
|
6
6
|
"scripts": {
|
@@ -111,7 +111,7 @@
|
|
111
111
|
"react-native-gesture-handler": "~2.12.0",
|
112
112
|
"react-native-iphone-x-helper": "^1.3.1",
|
113
113
|
"react-native-mime-types": "^2.4.0",
|
114
|
-
"react-native-paper": "^5.11.
|
114
|
+
"react-native-paper": "^5.11.1",
|
115
115
|
"react-native-paper-dates": "^0.20.1",
|
116
116
|
"react-native-reanimated": "~3.3.0",
|
117
117
|
"react-native-safe-area-context": "4.6.3",
|
@@ -62,7 +62,7 @@ const DrawerItem = ({icon,iconProps,borderRadius,color,minimized,contentContaine
|
|
62
62
|
],
|
63
63
|
}
|
64
64
|
const labelContent = typeof label =='function'? label(lProps) : label;
|
65
|
-
return React.isValidElement(labelContent,true)? <Label testID={testID+"
|
65
|
+
return React.isValidElement(labelContent,true)? <Label testID={testID+"_DrawerItemLabel"} {...lProps}>
|
66
66
|
{labelContent}
|
67
67
|
</Label> : null;
|
68
68
|
},[labelProps,typeof label =='function'?true:label,theme.name,theme.colors.primary,minimized]);
|
@@ -87,11 +87,11 @@ const DrawerItem = ({icon,iconProps,borderRadius,color,minimized,contentContaine
|
|
87
87
|
accessibilityState={{ selected: active }}
|
88
88
|
accessibilityLabel={accessibilityLabel}
|
89
89
|
>
|
90
|
-
<View {...contentContainerProps} style={[styles.contentContainer,contentContainerProps.style]} testID={testID+"
|
91
|
-
<View {...contentProps} style={[styles.content,contentProps.style]} testID={testID+"
|
90
|
+
<View {...contentContainerProps} style={[styles.contentContainer,contentContainerProps.style]} testID={testID+"_DrawerItemContentContainer"}>
|
91
|
+
<View {...contentProps} style={[styles.content,contentProps.style]} testID={testID+"_DrawerItemContent"}>
|
92
92
|
{left}
|
93
93
|
{icon ? (
|
94
|
-
<Icon testID={testID+"
|
94
|
+
<Icon testID={testID+"_DrawerItemIcon"} icon={icon} {...iconProps}
|
95
95
|
style={[iconProps.style,styles.icon,!minimized?{
|
96
96
|
alignItems : 'flex-start'
|
97
97
|
}:{alignItems:isExpandable?'flex-end':'center'}]} tooltip={minimized?defaultStr(title,label,accessibilityLabel):""}
|
@@ -162,6 +162,8 @@ const icTye = PropTypes.oneOfType([
|
|
162
162
|
DrawerItem.propTypes = {
|
163
163
|
icon : icTye,
|
164
164
|
active : PropTypes.bool,
|
165
|
+
contentProps : PropTypes.object,///les props du content
|
166
|
+
contentContainerProps : PropTypes.object,///les props du contentContainer
|
165
167
|
borderRadius : PropTypes.oneOfType([
|
166
168
|
PropTypes.string,
|
167
169
|
PropTypes.number,
|
package/src/context/Provider.js
CHANGED
@@ -21,7 +21,11 @@ import {extendFormFields} from "$ecomponents/Form/Fields";
|
|
21
21
|
beforeExit : ()=><Promise>
|
22
22
|
getTableData : ()=>{object|array}
|
23
23
|
getStructData : ()=>{object|array}
|
24
|
-
tablesData : {object
|
24
|
+
tablesData : {object:{
|
25
|
+
table1:{drawerSortOrder:{number,l'ordre d'apparition dans le drawer},showInDrawer:{boolean|{funct<{boolean}>},si l'on affichera la table de données dans le drawers}},
|
26
|
+
table2:{},
|
27
|
+
table3:{},...[tableN]:{}}
|
28
|
+
}, la liste des tables de données
|
25
29
|
structsData : {object}, la liste des données de structures
|
26
30
|
handleHelpScreen : {boolean}, //si l'écran d'aide sera pris en compte, l'écran d'aide ainsi que les écrans des termes d'utilisations et autres
|
27
31
|
convertFiltersToSQL : {boolean}, si les filtres de datagrid ou filtres seront convertis au format SQL
|
@@ -42,7 +46,13 @@ import {extendFormFields} from "$ecomponents/Form/Fields";
|
|
42
46
|
navigation : {
|
43
47
|
screens : {Array}, les écrans de navigation,
|
44
48
|
screenOptions : {object}, les options du composant Stack.Navigator, voir https://reactnavigation.org/docs/native-stack-navigator/
|
45
|
-
drawerItems : {object|array|function}, la fonction permettant d'obtenir les items du drawer principal de l'application,
|
49
|
+
drawerItems : {object|array|function}, la fonction permettant d'obtenir les items du drawer principal de l'application, Chaque item du drawer doit avoir la chaine drawerSection, chaine de caractère determinant le code de la section dans lequel l'afficher
|
50
|
+
drawerSections : {object : {
|
51
|
+
[key{string}]:{string}} |
|
52
|
+
[key{string}] : {object { code:{string},label:{Node},order:{number, l'ordre de trie de la section}}}
|
53
|
+
} //les différentes sections à utiliser pour le rendu du drawer, deux sections par défaut existent :
|
54
|
+
les sectionis help et dashboard; help pour le rendu des items de la section Aide et Dashboard pour le rendu des items de la section Dashboard/Home
|
55
|
+
drawerItemsMutator : {function}, la fonction permettant de muter les drawerItems à chaque fois qu'on appelle la fonction de récupératioin des drawerItems
|
46
56
|
containerProps : {object}, les props à passer au composant NavigationContainer de react-navigation
|
47
57
|
},
|
48
58
|
realm : {}, //les options de configurations de la base de données realmdb
|
@@ -3,7 +3,7 @@
|
|
3
3
|
// license that can be found in the LICENSE file.
|
4
4
|
|
5
5
|
import { isRouteActive} from "$cnavigation";
|
6
|
-
import {defaultObj} from "$cutils";
|
6
|
+
import {defaultObj,sortBy,defaultStr,isObj} from "$cutils";
|
7
7
|
import appConfig from "$capp/config";
|
8
8
|
import useContext from "$econtext/hooks";
|
9
9
|
import {useMemo,useEffect,useRef} from "react";
|
@@ -12,9 +12,12 @@ import { screenName as aboutScreenName} from "$escreens/Help/About";
|
|
12
12
|
import theme from "$theme";
|
13
13
|
import APP from "$capp/instance";
|
14
14
|
import useExpoUI from "$econtext/hooks";
|
15
|
+
import Auth from "$cauth";
|
16
|
+
import {getTableDataListRouteName} from "$enavigation/utils";
|
17
|
+
import {isValidElement} from "$react";
|
15
18
|
|
16
19
|
const useGetItems = (options)=>{
|
17
|
-
const {navigation:{drawerItems}} = useContext();
|
20
|
+
const {navigation:{drawerItems,drawerSections,drawerItemsMutator},tablesData} = useContext();
|
18
21
|
options = defaultObj(options);
|
19
22
|
const {refresh,force} = options;
|
20
23
|
const showProfilOnDrawer = theme.showProfilAvatarOnDrawer;
|
@@ -42,38 +45,100 @@ const useGetItems = (options)=>{
|
|
42
45
|
return useMemo(()=>{
|
43
46
|
const name = !showProfilOnDrawer ? 'Dashboard' : appConfig.name;
|
44
47
|
const itx = typeof drawerItems === "function" ? drawerItems() : drawerItems;
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
let items = {};
|
49
|
+
const tables = Object.size(tablesData,true)? sortBy(tablesData,{
|
50
|
+
column : "drawerSortOrder",
|
51
|
+
dir : "asc"
|
52
|
+
}) : null;
|
53
|
+
let hasDrawerSectionOrder = false;
|
54
|
+
Object.map(drawerSections,(section,s)=>{
|
55
|
+
if(typeof(section) =='string' && section){
|
56
|
+
section = {label:section.trim(),code:String(s)};
|
57
|
+
}
|
58
|
+
if(!isObj(section)) return null;
|
59
|
+
const sCode = defaultStr(section.code,s);
|
60
|
+
const sLabel = isValidElement(section.label,true) && section.label || isValidElement(section.text,true) && section.text || null;
|
61
|
+
if(!sLabel || !sCode) return null;
|
62
|
+
items[sCode] = {section:true,divider:true,...section,label:sLabel,code:sCode,items : Array.isArray(section.items)? section.items : []};
|
63
|
+
if(typeof section.order =="number"){
|
64
|
+
hasDrawerSectionOrder = true;
|
65
|
+
}
|
66
|
+
});
|
67
|
+
if(hasDrawerSectionOrder){
|
68
|
+
items = sortBy(items,{column:"order",dir:"asc"});
|
69
|
+
}
|
70
|
+
let sections = null;
|
71
|
+
Object.map(tables,(table,index)=>{
|
72
|
+
if(!isObj(table) || !isNonNullString(table.drawerSection)) return null;
|
73
|
+
const tableName = defaultStr(table.table,table.tableName,index).trim();
|
74
|
+
if(typeof table.showInDrawer =='function' && table.showInDrawer() === false) return;
|
75
|
+
if(!tableName || table.showInDrawer === false || !Auth.isTableDataAllowed({resource:tableName})){
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
if(isNonNullString(table.perm) && !Auth.isAllowedFromStr(table.perm)) return;
|
79
|
+
const section = (table.drawerSection).trim();
|
80
|
+
if(!items[section]){
|
81
|
+
if(!sections) sections = Object.keys(items);
|
82
|
+
console.error("invalid drawer section ",section,"for table's drawer item ",table," please provide any section from the list of sections : ",sections)
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
const tProps = {};
|
86
|
+
["icon","label","text","desc","table","title","dbName","dataFileType","data","routeParams"].map((v)=>{
|
87
|
+
if(v in table){
|
88
|
+
tProps[v] = table[v];
|
89
|
+
}
|
90
|
+
})
|
91
|
+
const toP = {
|
92
|
+
routeName : defaultStr(table.routeName,getTableDataListRouteName(tableName)),
|
93
|
+
...tProps,
|
94
|
+
routeParams : {tableName,...Object.assign({},tProps.routeParams)}
|
95
|
+
};
|
96
|
+
items[section].items.push(toP);
|
97
|
+
});
|
54
98
|
Object.map(itx,(item,i)=>{
|
55
|
-
if(isObj(item)){
|
56
|
-
|
99
|
+
if(isObj(item) && isNonNullString(item.drawerSection) && (item.drawerSection.trim()) in items){
|
100
|
+
items[item.drawerSection.trim()].items.push(item);
|
57
101
|
}
|
58
102
|
})
|
59
103
|
if(handleHelp){
|
60
|
-
|
61
|
-
|
62
|
-
key : '
|
104
|
+
const dHelp = isObj(items.help)? items.help : {};
|
105
|
+
items.help = {
|
106
|
+
key : 'help',
|
63
107
|
label : 'Aide',
|
64
108
|
section : true,
|
65
109
|
divider : false,
|
66
|
-
|
67
|
-
|
68
|
-
icon : 'help',
|
69
|
-
label : 'A propos de '+APP.getName(),
|
70
|
-
routeName : aboutScreenName,
|
71
|
-
}
|
72
|
-
]
|
110
|
+
...dHelp,
|
111
|
+
items : Array.isArray(dHelp.items)? dHelp.items : [],
|
73
112
|
};
|
74
|
-
|
113
|
+
items.help.items.push({
|
114
|
+
icon : 'help',
|
115
|
+
label : 'A propos de '+APP.getName(),
|
116
|
+
routeName : aboutScreenName,
|
117
|
+
});
|
75
118
|
}
|
76
|
-
|
119
|
+
const dashboard = isObj(items.dashboard) ? items.dashboard : {};
|
120
|
+
const dash = {
|
121
|
+
icon : 'view-dashboard',
|
122
|
+
title : 'Dashboard',
|
123
|
+
routeName : "Home",
|
124
|
+
divider : true,
|
125
|
+
...dashboard,
|
126
|
+
label : isValidElement(dashboard.label,true) && dashboard.label || isValidElement(dashboard.text,true) && dashboard.text || name,
|
127
|
+
};
|
128
|
+
items = {
|
129
|
+
dashboard : dash?.showInDrawer === false || typeof dash.showInDrawer ==='function' && dash.showInDrawer() === false ? null : dash,
|
130
|
+
...items,
|
131
|
+
};
|
132
|
+
if(typeof drawerItemsMutator ==='function'){
|
133
|
+
items = drawerItemsMutator(items);
|
134
|
+
}
|
135
|
+
Object.map(items,(item,section)=>{
|
136
|
+
if(!isObj(item) || item.section !== true) return;
|
137
|
+
if(!Array.isArray(item.items) || !item.items.length){
|
138
|
+
delete items[section];
|
139
|
+
}
|
140
|
+
});
|
141
|
+
return items;
|
77
142
|
},[showProfilOnDrawer,handleHelp,refreshItemsRef.current,force])
|
78
143
|
}
|
79
144
|
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.
|
1
|
+
module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.63.0","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"},"@babel/plugin-proposal-export-namespace-from":{"version":"7.18.9","url":"https://babel.dev/docs/en/next/babel-plugin-proposal-export-namespace-from","license":"MIT"},"@emotion/native":{"version":"11.11.0","url":"https://emotion.sh","license":"MIT"},"@emotion/react":{"version":"11.11.1","url":"https://github.com/emotion-js/emotion/tree/main/packages/react","license":"MIT"},"@expo/html-elements":{"version":"0.5.1","url":"https://github.com/expo/expo/tree/main/packages/html-elements","license":"MIT"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/vector-icons":{"version":"13.0.0","url":"https://expo.github.io/vector-icons","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"@faker-js/faker":{"version":"8.0.2","url":"https://github.com/faker-js/faker.git","license":"MIT"},"@fto-consult/common":{"version":"3.54.2","url":"https://github.com/borispipo/common#readme","license":"ISC"},"@pchmn/expo-material3-theme":{"version":"1.3.1","url":"https://github.com/pchmn/expo-material3-theme#readme","license":"MIT"},"@react-native-async-storage/async-storage":{"version":"1.18.2","url":"https://github.com/react-native-async-storage/async-storage#readme","license":"MIT"},"@react-native-community/datetimepicker":{"version":"7.2.0","url":"https://github.com/react-native-community/datetimepicker#readme","license":"MIT"},"@react-native-community/netinfo":{"version":"9.3.10","url":"https://github.com/react-native-netinfo/react-native-netinfo#readme","license":"MIT"},"@react-native/assets-registry":{"version":"0.72.0","url":"git@github.com:facebook/react-native.git","license":"MIT"},"@react-navigation/native":{"version":"6.1.9","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.16","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@react-navigation/stack":{"version":"6.3.20","url":"https://reactnavigation.org/docs/stack-navigator/","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.44.0","url":"https://apexcharts.com","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"},"expo":{"version":"49.0.16","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.4","url":"https://docs.expo.dev/versions/latest/sdk/camera/","license":"MIT"},"expo-clipboard":{"version":"4.3.1","url":"https://docs.expo.dev/versions/latest/sdk/clipboard","license":"MIT"},"expo-font":{"version":"11.4.0","url":"https://docs.expo.dev/versions/latest/sdk/font/","license":"MIT"},"expo-image-picker":{"version":"14.3.2","url":"https://docs.expo.dev/versions/latest/sdk/imagepicker/","license":"MIT"},"expo-linking":{"version":"5.0.2","url":"https://docs.expo.dev/versions/latest/sdk/linking","license":"MIT"},"expo-sharing":{"version":"11.5.0","url":"https://docs.expo.dev/versions/latest/sdk/sharing/","license":"MIT"},"expo-sqlite":{"version":"11.3.3","url":"https://docs.expo.dev/versions/latest/sdk/sqlite/","license":"MIT"},"expo-status-bar":{"version":"1.6.0","url":"https://docs.expo.dev/versions/latest/sdk/status-bar/","license":"MIT"},"expo-system-ui":{"version":"2.4.0","url":"https://docs.expo.dev/versions/latest/sdk/system-ui","license":"MIT"},"expo-web-browser":{"version":"12.3.2","url":"https://docs.expo.dev/versions/latest/sdk/webbrowser/","license":"MIT"},"file-saver":{"version":"2.0.5","url":"https://github.com/eligrey/FileSaver.js#readme","license":"MIT"},"fs-extra":{"version":"11.1.1","url":"https://github.com/jprichardson/node-fs-extra","license":"MIT"},"google-libphonenumber":{"version":"3.2.33","url":"https://ruimarinho.github.io/google-libphonenumber/","license":"(MIT AND Apache-2.0)"},"htmlparser2-without-node-native":{"version":"3.9.2","url":"git://github.com/fb55/htmlparser2.git","license":"MIT"},"is-plain-obj":{"version":"4.1.0","license":"MIT"},"js-base64":{"version":"3.7.5","license":"BSD-3-Clause"},"pdfmake":{"version":"0.2.7","url":"http://pdfmake.org","license":"MIT"},"process":{"version":"0.11.10","url":"git://github.com/shtylman/node-process.git","license":"MIT"},"prop-types":{"version":"15.8.1","url":"https://facebook.github.io/react/","license":"MIT"},"react":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-content-loader":{"version":"6.2.1","url":"https://github.com/danilowoz/react-content-loader","license":"MIT"},"react-dom":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-native":{"version":"0.72.6","license":"MIT"},"react-native-big-list":{"version":"1.6.1","url":"https://marcocesarato.github.io/react-native-big-list-docs/","license":"GPL-3.0-or-later"},"react-native-blob-util":{"version":"0.18.6","url":"https://github.com/RonRadtke/react-native-blob-util","license":"MIT"},"react-native-gesture-handler":{"version":"2.12.1","url":"https://github.com/software-mansion/react-native-gesture-handler#readme","license":"MIT"},"react-native-iphone-x-helper":{"version":"1.3.1","url":"https://github.com/ptelad/react-native-iphone-x-helper#readme","license":"MIT"},"react-native-mime-types":{"version":"2.4.0","license":"MIT"},"react-native-paper":{"version":"5.11.1","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.20.1","url":"https://github.com/web-ridge/react-native-paper-dates#readme","license":"MIT"},"react-native-reanimated":{"version":"3.3.0","url":"https://github.com/software-mansion/react-native-reanimated#readme","license":"MIT"},"react-native-safe-area-context":{"version":"4.6.3","url":"https://github.com/th3rdwave/react-native-safe-area-context#readme","license":"MIT"},"react-native-screens":{"version":"3.22.1","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"react-native-svg":{"version":"13.9.0","url":"https://github.com/react-native-community/react-native-svg","license":"MIT"},"react-native-web":{"version":"0.19.9","url":"git://github.com/necolas/react-native-web.git","license":"MIT"},"react-native-webview":{"version":"13.2.2","url":"https://github.com/react-native-webview/react-native-webview#readme","license":"MIT"},"react-virtuoso":{"version":"4.6.2","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"2.1.0","url":"https://github.com/vseventer/sharp-cli","license":"MIT"},"tippy.js":{"version":"6.3.7","url":"https://atomiks.github.io/tippyjs/","license":"MIT"},"uninstall":{"version":"0.0.0","license":"MIT"},"websql":{"version":"2.0.3","url":"git://github.com/nolanlawson/node-websql.git","license":"Apache-2.0"},"xlsx":{"version":"0.18.5","url":"https://sheetjs.com/","license":"Apache-2.0"}};
|