@fto-consult/expo-ui 8.83.3 → 9.0.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/babel.config.alias.js +2 -2
- package/babel.config.js +1 -7
- package/bin/create-app/App.js +1 -0
- package/bin/create-app/app.json +1 -1
- package/bin/create-app/dependencies.js +31 -28
- package/bin/create-app/devDependencies.js +0 -1
- package/bin/create-app.js +2 -3
- package/docs/expo-upgrades.txt +1 -0
- package/expo-ui-path.js +18 -23
- package/metro.config.js +5 -0
- package/package.json +5 -15
- package/readMe.md +9 -9
- package/src/auth/Login.js +16 -7
- package/src/auth/utils.js +10 -0
- package/src/components/AppBar/utils.js +3 -5
- package/src/components/Avatar/AutoHeightImage/cache.js +2 -1
- package/src/components/BottomSheet/Sheet.js +5 -5
- package/src/components/Chart/appexChart/appexChart.html +23 -23
- package/src/components/Datagrid/Accordion/Filters.js +2 -2
- package/src/components/Datagrid/Common/Common.js +7 -10
- package/src/components/Drawer/DrawerItems/index.js +5 -5
- package/src/components/Fab/Group.js +2 -3
- package/src/components/Filter/index.js +2 -1
- package/src/components/Form/Form.js +2 -1
- package/src/components/Form/FormData/DialogProvider.js +2 -2
- package/src/components/Form/FormData/FieldContent.js +2 -1
- package/src/components/Form/FormData/FormData.js +2 -1
- package/src/components/Grid/Cell.js +1 -1
- package/src/components/Icon/Checkbox.js +3 -3
- package/src/components/Image/index.js +5 -2
- package/src/components/Table/Header/index.js +2 -2
- package/src/components/Table/index.js +4 -4
- package/src/components/TableLink/index.js +4 -7
- package/src/context/Provider.js +1 -0
- package/src/layouts/DatabaseStatistics/index.js +3 -3
- package/src/layouts/Screen/TableData.js +1 -1
- package/src/navigation/Drawer/index.js +2 -2
- package/src/navigation/Drawer/items/index.js +2 -1
- package/src/navigation/utils.js +3 -2
- package/src/pdf/index.js +3 -8
- package/src/screens/Auth/PermLines.js +0 -8
- package/src/screens/Auth/Profile.js +3 -6
- package/bin/create-app/webpack.config.js +0 -1
- package/compiler.config.js +0 -33
- package/webpack.config.js +0 -82
package/babel.config.alias.js
CHANGED
@@ -3,7 +3,7 @@ const fs = require("fs");
|
|
3
3
|
|
4
4
|
module.exports = (opts)=>{
|
5
5
|
const dir = path.resolve(__dirname);
|
6
|
-
const isDev = String(process.env.NODE_ENV).toLowerCase() !="production";
|
6
|
+
const isDev = String(process.env.NODE_ENV).toLowerCase().trim() !="production";
|
7
7
|
const projectRoot = typeof opts.projectRoot =='string' && fs.existsSync(opts.projectRoot.trim()) && opts.projectRoot.trim() || process.cwd();
|
8
8
|
opts = typeof opts =='object' && opts ? opts : {};
|
9
9
|
opts.platform = "expo";
|
@@ -12,7 +12,7 @@ module.exports = (opts)=>{
|
|
12
12
|
opts.assets = opts.assets || opts.alias && typeof opts.alias =='object' && opts.alias.$assets || assets;
|
13
13
|
opts.withPouchDB = opts.withPouchDB !== false && opts.withPouchdb !== false ? true : false;
|
14
14
|
delete opts.withPouchdb;
|
15
|
-
const expoUI = require("./expo-ui-path")();
|
15
|
+
const expoUI = require("./expo-ui-path")(projectRoot);
|
16
16
|
const cPath = isDev && fs.existsSync(path.resolve(expoUI,"node_modules","@fto-consult","common"))? path.resolve(expoUI,"node_modules","@fto-consult","common") : null;
|
17
17
|
const r = require(`${cPath ? path.resolve(cPath,"babel.config.alias.js"):'@fto-consult/common/babel.config.alias'}`)(opts);
|
18
18
|
const expo = path.resolve(expoUI,"src");
|
package/babel.config.js
CHANGED
@@ -3,15 +3,10 @@ const fs = require("fs");
|
|
3
3
|
|
4
4
|
module.exports = function(api,opts) {
|
5
5
|
opts = typeof opts =='object' && opts ? opts : {};
|
6
|
-
const inlineDovOptions = { unsafe: true};
|
7
6
|
const platform = api.caller(caller => caller && caller.platform);
|
8
7
|
const isWeb = platform === 'web';
|
9
8
|
const options = {...opts,isWeb,isAndroid:platform==="android",isIos : platform==="ios",platform:"expo"};
|
10
|
-
|
11
|
-
if(environmentPath && fs.existsSync(environmentPath)){
|
12
|
-
inlineDovOptions.path ='./.env';
|
13
|
-
}
|
14
|
-
/*** par défaut, les variables d'environnements sont stockés dans le fichier .env situé à la racine du projet, référencée par la prop base */
|
9
|
+
options.projectRoot = typeof options.projectRoot == 'string' && fs.existsSync(path.resolve(options.projectRoot)) ? path.resolve(options.projectRoot) : process.cwd();
|
15
10
|
const alias = require("./babel.config.alias")(options);
|
16
11
|
if(typeof options.aliasMutator =="function"){
|
17
12
|
options.aliasMutator({...options,alias});
|
@@ -35,7 +30,6 @@ module.exports = function(api,opts) {
|
|
35
30
|
],
|
36
31
|
plugins : [
|
37
32
|
...plugins,
|
38
|
-
["inline-dotenv",inlineDovOptions],
|
39
33
|
["module-resolver", {"alias": alias}],
|
40
34
|
"@babel/plugin-proposal-export-namespace-from",
|
41
35
|
...(reanimated?[reanimated]:[]),
|
package/bin/create-app/App.js
CHANGED
package/bin/create-app/app.json
CHANGED
@@ -4,36 +4,39 @@
|
|
4
4
|
"@expo/html-elements": "^0.5.1",
|
5
5
|
"@expo/vector-icons": "^14.0.0",
|
6
6
|
"@pchmn/expo-material3-theme": "^1.3.2",
|
7
|
-
"@react-native-community/netinfo": "11.1
|
8
|
-
"@react-native/
|
7
|
+
"@react-native-community/netinfo": "11.3.1",
|
8
|
+
"@react-native-community/netinfo": "11.3.1",
|
9
9
|
"react-native-get-random-values": "~1.8.0",
|
10
10
|
"@react-navigation/native": "^6.1.17",
|
11
|
-
|
11
|
+
"@react-navigation/native-stack": "^6.9.26",
|
12
12
|
"@react-navigation/stack": "^6.3.29",
|
13
|
-
"@shopify/flash-list": "1.6.
|
14
|
-
|
15
|
-
"expo
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
"expo-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"react-native-gesture-handler": "~2.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
13
|
+
"@shopify/flash-list": "1.6.4",
|
14
|
+
|
15
|
+
"expo": "51.0.0",
|
16
|
+
"expo-camera": "~15.0.4",
|
17
|
+
"expo-clipboard": "~6.0.3",
|
18
|
+
"expo-document-picker": "~12.0.1",
|
19
|
+
"expo-font": "~12.0.4",
|
20
|
+
"expo-image-manipulator": "~12.0.3",
|
21
|
+
"expo-image-picker": "~15.0.4",
|
22
|
+
"expo-intent-launcher": "~11.0.1",
|
23
|
+
"expo-linking": "~6.3.1",
|
24
|
+
"@expo/metro-runtime": "^3.2.1",
|
25
|
+
"expo-sharing": "~12.0.1",
|
26
|
+
"expo-sqlite": "~14.0.3",
|
27
|
+
"expo-status-bar": "~1.12.1",
|
28
|
+
"expo-system-ui": "~3.0.4",
|
29
|
+
"expo-web-browser": "~13.0.3",
|
30
|
+
"react-native": "0.74.1",
|
31
|
+
"react-native-gesture-handler": "~2.16.1",
|
32
|
+
"react-native-get-random-values": "~1.11.0",
|
33
|
+
"react-native-reanimated": "3.10.0",
|
34
|
+
"react-native-safe-area-context": "4.10.1",
|
35
|
+
"react-native-screens": "3.31.1",
|
36
|
+
"react-native-svg": "15.2.0-rc.0",
|
37
|
+
"react-native-view-shot": "3.8.0",
|
38
|
+
"react-native-web": "~0.19.10",
|
39
|
+
"react-native-webview": "13.8.6",
|
40
|
+
"react-virtuoso": "latest",
|
38
41
|
};
|
39
42
|
|
package/bin/create-app.js
CHANGED
@@ -75,7 +75,7 @@ module.exports = function(appName,{projectRoot:root}){
|
|
75
75
|
writeFile(mainPackagePath,JSON.stringify(mainPackage,null,2),{overwrite:true});
|
76
76
|
}
|
77
77
|
console.log("creating application .....");
|
78
|
-
["babel.config.js","metro.config.js"
|
78
|
+
["babel.config.js","metro.config.js"].map((p)=>{
|
79
79
|
const rP = path.join(projectRoot,p);
|
80
80
|
const pp = path.join(getAppDir(),p);
|
81
81
|
if(!fs.existsSync(rP) && fs.existsSync(pp)){
|
@@ -98,7 +98,6 @@ module.exports = function(appName,{projectRoot:root}){
|
|
98
98
|
});
|
99
99
|
}
|
100
100
|
const defaultDevDependencies = {
|
101
|
-
"@expo/webpack-config":"latest",
|
102
101
|
"@expo/metro-config" : "latest",
|
103
102
|
}
|
104
103
|
const createEntryFile = (projectRoot)=>{
|
@@ -191,7 +190,7 @@ electron/**/*
|
|
191
190
|
},
|
192
191
|
"web": {
|
193
192
|
"favicon": "./assets/favicon.png",
|
194
|
-
"bundler": "
|
193
|
+
"bundler": "metro"
|
195
194
|
}
|
196
195
|
}
|
197
196
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Upgrade to SDK 51 : https://expo.dev/changelog/2024/05-07-sdk-51
|
package/expo-ui-path.js
CHANGED
@@ -4,34 +4,29 @@
|
|
4
4
|
|
5
5
|
const fs = require("fs");
|
6
6
|
const path = require("path");
|
7
|
+
const {JSONManager} = require("@fto-consult/node-utils");
|
7
8
|
///retourne le chemin vers le package @expo-ui
|
8
|
-
module.exports = function (){
|
9
|
-
const ag = Array.prototype.slice.call(arguments,0);
|
10
|
-
let suffix ="";
|
11
|
-
ag.map(p=>{
|
12
|
-
if(typeof p ==='string' && p){
|
13
|
-
suffix = path.join(suffix,p);
|
14
|
-
}
|
15
|
-
})
|
9
|
+
module.exports = function (projectRoot){
|
16
10
|
const sep = path.sep;
|
17
11
|
if(require("./is-local-dev")()){//le programme s'exécute en environnement fix bugs sur electron
|
18
|
-
return path.resolve(__dirname
|
12
|
+
return path.resolve(__dirname).replace(sep,(sep+sep));///pour la résolution du module expo-ui en mode test
|
19
13
|
}
|
20
|
-
const
|
21
|
-
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
14
|
+
const isDev = String(process.env.NODE_ENV).toLowerCase().trim() !="production";
|
15
|
+
projectRoot = typeof projectRoot =='string' && fs.existsSync(path.resolve(projectRoot)) && path.resolve(projectRoot) || process.cwd();
|
16
|
+
const packageJSON = path.resolve(projectRoot,"package.json");
|
17
|
+
const expoUIPath = path.resolve(projectRoot,"node_modules","@fto-consult","expo-ui");
|
18
|
+
if(isDev && fs.existsSync(packageJSON)){
|
19
|
+
const pM = JSONManager(packageJSON);
|
20
|
+
if(pM.hasPackage){
|
21
|
+
const expoUIRootPath = pM.get("expoUIRootPath");
|
22
|
+
if(typeof expoUIRootPath =="string" && expoUIRootPath){
|
23
|
+
const p = path.resolve(expoUIRootPath);
|
24
|
+
const pM2 = JSONManager(path.resolve(expoUIRootPath,"package.json"));
|
25
|
+
if(pM2.hasPackage && pM2.get("name") =="@fto-consult/expo-ui" && fs.existsSync(p) && fs.existsSync(path.resolve(p,"src"))){
|
26
|
+
return p;
|
30
27
|
}
|
31
28
|
}
|
32
|
-
|
33
|
-
} catch (e){}
|
29
|
+
}
|
34
30
|
}
|
35
|
-
|
36
|
-
return suffix ? path.join(expoUIPath,suffix).replace(sep,"/"): expoUIPath;
|
31
|
+
return expoUIPath;
|
37
32
|
};
|
package/metro.config.js
CHANGED
@@ -3,6 +3,7 @@ const fs = require("fs");
|
|
3
3
|
const { getDefaultConfig } = require('@expo/metro-config');
|
4
4
|
module.exports = function(opts){
|
5
5
|
opts = opts && typeof opts =='object'? opts : {};
|
6
|
+
const isDev = String(process.env.NODE_ENV).toLowerCase().trim() !="production";
|
6
7
|
let {assetExts,sourceExts} = opts;
|
7
8
|
assetExts = Array.isArray(assetExts)? assetExts: [];
|
8
9
|
sourceExts= Array.isArray(sourceExts)?sourceExts : [];
|
@@ -38,6 +39,10 @@ module.exports = function(opts){
|
|
38
39
|
'jsx', 'js','tsx',
|
39
40
|
]
|
40
41
|
config.watchFolders = Array.isArray(config.watchFolders)? config.watchFolders : [];
|
42
|
+
const expoUIP = require("./expo-ui-path")(projectRoot);
|
43
|
+
if(!config.watchFolders.includes(expoUIP)){
|
44
|
+
config.watchFolders.push(expoUIP);
|
45
|
+
}
|
41
46
|
let hasFTO = false;
|
42
47
|
for(let i in config.watchFolders){
|
43
48
|
if(typeof config.watchFolders[i] ==="string" && config.watchFolders[i].includes("@fto-consult")){
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "
|
3
|
+
"version": "9.0.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
|
6
6
|
"scripts": {
|
@@ -31,9 +31,6 @@
|
|
31
31
|
"install-apk": "adb -s emulator-5554 install myapp.apk",
|
32
32
|
"android-emulator": "emulator -avd EMULATOR",
|
33
33
|
"flipper": "npx cross-env METRO_SERVER_PORT=19000 E:\\Studies\\react-native\\debugger\\Flipper-win\\Flipper.exe",
|
34
|
-
"test:build": "electron-webpack && electron-builder --dir -c.compression=store -c.mac.identity=null",
|
35
|
-
"compile-electron": "webpack --env platform=electron",
|
36
|
-
"compile-electron-p": "webpack --config ./electron/webpack.config.js --mode=production",
|
37
34
|
"electron": "electron ./electron",
|
38
35
|
"logcat": "adb -d logcat com.ftc.apps.salite1:E > errors.txt",
|
39
36
|
"logcat-export": "adb -d logcat com.ftc.apps.salite1 *:S > logcat.txt",
|
@@ -48,7 +45,7 @@
|
|
48
45
|
"delete-node-modules": "rimraf ./**/node_modules",
|
49
46
|
"dev": "npx expo start --no-dev --minify -c",
|
50
47
|
"modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'",
|
51
|
-
"update": "npm i @fto-consult/common@latest react-native-big-list@latest apexcharts@latest file-saver@latest google-libphonenumber@latest
|
48
|
+
"update": "npm i @emotion/react@latest @fto-consult/common@latest react-native-big-list@latest apexcharts@latest file-saver@latest google-libphonenumber@latest react-native-paper@latest react-native-paper-dates@latest react-native-mime-types@latest tippy.js@latest xlsx@latest && npm run update-apexchart && npm run find-licenses"
|
52
49
|
},
|
53
50
|
"bin": {
|
54
51
|
"expo-ui": "bin/index.js"
|
@@ -68,10 +65,9 @@
|
|
68
65
|
},
|
69
66
|
"homepage": "https://github.com/borispipo/expo-ui#readme",
|
70
67
|
"dependencies": {
|
71
|
-
"@emotion/react": "^11.11.
|
68
|
+
"@emotion/react": "^11.11.4",
|
72
69
|
"@faker-js/faker": "^8.0.2",
|
73
|
-
"@fto-consult/common": "^4.52.
|
74
|
-
"@fto-consult/expo-ui": "^8.73.1",
|
70
|
+
"@fto-consult/common": "^4.52.1",
|
75
71
|
"apexcharts": "^3.49.0",
|
76
72
|
"file-saver": "^2.0.5",
|
77
73
|
"google-libphonenumber": "^3.2.34",
|
@@ -86,8 +82,6 @@
|
|
86
82
|
"react-native-mime-types": "^2.5.0",
|
87
83
|
"react-native-paper": "^5.12.3",
|
88
84
|
"react-native-paper-dates": "^0.22.7",
|
89
|
-
"react-virtuoso": "^4.7.10",
|
90
|
-
"readable-stream": "^4.5.2",
|
91
85
|
"sanitize-filename": "^1.6.3",
|
92
86
|
"tippy.js": "^6.3.7",
|
93
87
|
"xlsx": "^0.18.5"
|
@@ -95,12 +89,8 @@
|
|
95
89
|
"devDependencies": {
|
96
90
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
97
91
|
"@expo/metro-config": "~0.17.1",
|
98
|
-
"@expo/webpack-config": "^19.0.1",
|
99
92
|
"babel-plugin-inline-dotenv": "^1.7.0",
|
100
93
|
"babel-plugin-module-resolver": "^5.0.0",
|
101
|
-
"
|
102
|
-
"sharp-cli": "^2.1.1",
|
103
|
-
"stream-browserify": "^3.0.0",
|
104
|
-
"vm": "^0.1.0"
|
94
|
+
"sharp-cli": "^2.1.1"
|
105
95
|
}
|
106
96
|
}
|
package/readMe.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
## Installation des dépendences, packages de dévéloppement
|
2
2
|
|
3
3
|
```javascript
|
4
|
-
npm i --D babel-plugin-module-resolver babel-plugin-inline-dotenv @expo/metro-config
|
4
|
+
npm i --D babel-plugin-module-resolver babel-plugin-inline-dotenv @expo/metro-config
|
5
5
|
```
|
6
6
|
|
7
7
|
## **#ELECTRON**
|
@@ -12,14 +12,14 @@ npm i --D babel-plugin-module-resolver babel-plugin-inline-dotenv @expo/metro-co
|
|
12
12
|
|
13
13
|
### `expo-ui [build|start] [compile] [build] [url=local-url] [platform=[win32|darwin|linux|mas]] [arch=x64|x86] [out=outpout dir]`
|
14
14
|
|
15
|
-
1.
|
16
|
-
2.
|
17
|
-
3.
|
18
|
-
4.
|
19
|
-
5.
|
20
|
-
6.
|
21
|
-
7.
|
15
|
+
1. \[build|start|package\], le script à exécuter : build|start
|
16
|
+
2. \[compile\], si l'application sera compilé, via la commande expo export:web; valide lorsque aucune url n'est spécifiée
|
17
|
+
3. \[build\]\], si l'exécutable sera crée pour la plateforme \[platform\], valide uniquement pour le script \<\<build>>
|
18
|
+
4. \[url=local-url\], l'url à ouvrir via l'application electron (exemple : http://localhost:19006/), valide uniquement pour le script \<\<start>>;
|
19
|
+
5. \[platform\], la plateforme vers laquelle on souhaite exporter l'exécutable electron, vailde uniquement pour le script \<\<build>>
|
20
|
+
6. \[arch\], l'architecture de l'exécutable à exporter, valide uniquement pour le script \<\<build>>
|
21
|
+
7. \[out\], le repertoire destitation, valide pour les scripts \[build et package\]
|
22
22
|
|
23
23
|
## **Générer le fichier binaire**
|
24
24
|
|
25
|
-
1.
|
25
|
+
1. installer le package electron-packager : `npm install --save-dev electron-packager`
|
package/src/auth/Login.js
CHANGED
@@ -36,7 +36,8 @@ export default function LoginComponent(props){
|
|
36
36
|
const backgroundColor = theme.colors.surface;
|
37
37
|
const _getForm = x=> getForm(formName);
|
38
38
|
const isMounted = React.useIsMounted();
|
39
|
-
|
39
|
+
const initializeRef = React.useRef(props.initialize);
|
40
|
+
const onStepChangeRef = React.useRef(props.onStepChange);
|
40
41
|
const auth = useAuth();
|
41
42
|
const notifyUser = (message,title)=> {
|
42
43
|
if(isObj(message)){
|
@@ -87,15 +88,15 @@ export default function LoginComponent(props){
|
|
87
88
|
React.useEffect(()=>{
|
88
89
|
Preloader.closeAll();
|
89
90
|
/*** pour initializer les cordonnées du composant login */
|
90
|
-
if(typeof
|
91
|
-
|
91
|
+
if(typeof initializeRef.current =='function'){
|
92
|
+
initializeRef.current();
|
92
93
|
}
|
93
94
|
},[]);
|
94
95
|
const prevStep = React.usePrevious(state.step);
|
95
96
|
React.useEffect(()=>{
|
96
97
|
/*** lorsque le state du composant change */
|
97
|
-
if(typeof
|
98
|
-
return
|
98
|
+
if(typeof onStepChangeRef.current =='function'){
|
99
|
+
return onStepChangeRef.current({...state,previousStep:prevStep,focusField,nextButtonRef})
|
99
100
|
}
|
100
101
|
},[state.step]);
|
101
102
|
const getButtonAction = React.useMemo(()=>{
|
@@ -160,7 +161,7 @@ export default function LoginComponent(props){
|
|
160
161
|
const mediaQueryUpdateStyle = ()=>{
|
161
162
|
return StyleSheet.flatten([updateMediaQueryStyle()]);
|
162
163
|
};
|
163
|
-
|
164
|
+
let withScrollView = typeof props.withScrollView =='boolean'? props.withScrollView : true;
|
164
165
|
const Wrapper = withPortal ? ScreenWithoutAuthContainer : withScrollView ? ScrollView: View;
|
165
166
|
if(React.isComponent(Login)) return <Login
|
166
167
|
{...props}
|
@@ -231,7 +232,15 @@ export default function LoginComponent(props){
|
|
231
232
|
formProps,
|
232
233
|
wrapperProps : cWrapperProps,
|
233
234
|
title : customTitle,
|
234
|
-
withScrollView:customWithScrollView,children,initialize,renderNextButton,renderPreviousButton,data:loginData,canGoToNext,keyboardEvents,onSuccess:onLoginSuccess,beforeSubmit:beforeSubmitForm,canSubmit:canSubmitForm,onStepChange,...loginProps} = loginPropsMutator(callArgs);
|
235
|
+
withScrollView:customWithScrollView,children,initialize,renderNextButton,renderPreviousButton,data:loginData,canGoToNext,keyboardEvents,onSuccess:onLoginSuccess,beforeSubmit:beforeSubmitForm,canSubmit:canSubmitForm,onStepChange,...loginProps} = loginPropsMutator(callArgs);
|
236
|
+
|
237
|
+
if(typeof initialize =="function"){
|
238
|
+
initializeRef.current = initialize;
|
239
|
+
}
|
240
|
+
if(typeof onStepChange =="function"){
|
241
|
+
onStepChangeRef.current = onStepChange;
|
242
|
+
}
|
243
|
+
withScrollView = typeof customWithScrollView =='boolean'? customWithScrollView : withScrollView;
|
235
244
|
if(isNonNullString(customTitle)){
|
236
245
|
loginTitle = customTitle;
|
237
246
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import {isAllowedFromStr} from "$cauth/perms";
|
2
|
+
/***
|
3
|
+
* vérifie si pour la permission perm, l'utilisateur connecté à accès à la resource
|
4
|
+
*/
|
5
|
+
export const isPermAllowed = (perm,...permsArgs)=>{
|
6
|
+
if(typeof perm === 'boolean') return perm;
|
7
|
+
if(typeof perm ==='function' && perm(...permsArgs) === false) return false;
|
8
|
+
if(isNonNullString(perm) && !isAllowedFromStr(perm,...permsArgs)) return false;
|
9
|
+
return true;
|
10
|
+
}
|
@@ -7,8 +7,8 @@ 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";
|
11
10
|
import breakpoints from "$cdimensions/breakpoints";
|
11
|
+
import {isPermAllowed} from "$eauth/utils";
|
12
12
|
|
13
13
|
export const ACTION_ICON_SIZE = 30;
|
14
14
|
|
@@ -104,9 +104,7 @@ export const splitActions = (args)=>{
|
|
104
104
|
let cEl = null;
|
105
105
|
if(!React.isValidElement(act)&& isPlainObj(act)){
|
106
106
|
let {label,perm,text,...action} = act;
|
107
|
-
if(
|
108
|
-
continue;
|
109
|
-
} else if(typeof perm =='function' && perm(args) === false){
|
107
|
+
if(!isPermAllowed(perm,args)) {
|
110
108
|
continue;
|
111
109
|
}
|
112
110
|
action = {...defaultObj(action)};
|
@@ -146,7 +144,7 @@ export const splitActions = (args)=>{
|
|
146
144
|
}
|
147
145
|
if(isPlainObj(cancelButton) && !React.isValidElement(cancelButton)){
|
148
146
|
let {label,perm,text,...action} = cancelButton;
|
149
|
-
|
147
|
+
const canAddCancelBtn = isPermAllowed(perm,{...args,cancelButton,action:cancelButton});
|
150
148
|
if(canAddCancelBtn && (text||label)){
|
151
149
|
action = {...defaultObj(action)};
|
152
150
|
action.label = defaultVal(label,text)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Image } from 'react-native';
|
2
|
+
import { resolveAssetSource } from '$ecomponents/Image';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* store with
|
@@ -22,7 +23,7 @@ const loadImageSize = (image) => {
|
|
22
23
|
return new Promise((resolve, reject) => {
|
23
24
|
//number indicates import X or require(X) was used (i.e. local file)
|
24
25
|
if (typeof image === 'number') {
|
25
|
-
const { width, height } =
|
26
|
+
const { width, height } = defaultObj(resolveAssetSource(image));
|
26
27
|
resolve({ width, height });
|
27
28
|
} else {
|
28
29
|
Image.getSize(
|
@@ -31,12 +31,12 @@ export const defaultHeight = 300;
|
|
31
31
|
const useNativeDriver = false;
|
32
32
|
|
33
33
|
const BottomSheetComponent = React.forwardRef((props,ref)=> {
|
34
|
-
|
34
|
+
let {
|
35
35
|
animationType,
|
36
36
|
animationDuration,
|
37
37
|
animationPosition,
|
38
38
|
closeOnDragDown,
|
39
|
-
|
39
|
+
dragFromTopOnly,
|
40
40
|
closeOnPressMask,
|
41
41
|
closeOnPressBack,
|
42
42
|
children,
|
@@ -62,7 +62,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
|
|
62
62
|
actionTitle,
|
63
63
|
elevation:customElevation,
|
64
64
|
containerProps : customContainerProps,
|
65
|
-
backdropProps
|
65
|
+
backdropProps,
|
66
66
|
...rest
|
67
67
|
} = props;
|
68
68
|
const {height:winHeight} = Dimensions.get("window");
|
@@ -192,7 +192,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
|
|
192
192
|
transform: pan.getTranslateTransform()
|
193
193
|
};
|
194
194
|
const actionProps = Object.assign({},rest.actionProps);
|
195
|
-
|
195
|
+
backdropProps = defaultObj(backdropProps);
|
196
196
|
//actionProps.size = actionProps.size || 25;
|
197
197
|
actionProps.style = [{marginVertical:0,paddingVertical:0},actionProps.style]
|
198
198
|
const aStyle = {color:theme.colors.primaryOnSurface};
|
@@ -231,7 +231,7 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
|
|
231
231
|
React.setRef(ref,null);
|
232
232
|
}
|
233
233
|
},[]);
|
234
|
-
|
234
|
+
dragFromTopOnly = typeof dragFromTopOnly ==='boolean' ? dragFromTopOnly : withScrollView !== false ? true : isTouchDevice();
|
235
235
|
const testID = defaultStr(customTestID,"RN_BottomSheetComponent");
|
236
236
|
const containerProps = defaultObj(customContainerProps);
|
237
237
|
const elevation = typeof customElevation =='number'? Math.ceil(customElevation) : 10;
|