@fto-consult/expo-ui 8.0.7 → 8.2.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/app.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "scheme": "fto-consult-expo-ui",
6
6
  "version": "1.0.0",
7
7
  "orientation": "portrait",
8
+ "expoSdkVersion" : "50",
8
9
  "web": {
9
10
  "bundler": "webpack"
10
11
  },
@@ -54,7 +54,7 @@ module.exports = (opts)=>{
54
54
  if(!r["$screen"]){
55
55
  r["$screen"] = r["$escreen"];
56
56
  }
57
- if(!r["$preloader"]){
57
+ if(!r["$preloader"] || r["$preloader"] === r["$cpreloader"]){
58
58
  r["$preloader"] = r["$epreloader"];
59
59
  }
60
60
  if(!r["$enotify"]){
package/babel.config.js CHANGED
@@ -15,16 +15,26 @@ module.exports = function(api,opts) {
15
15
  /*** 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 */
16
16
  const alias = require("./babel.config.alias")(options);
17
17
  require(`${path.resolve(__dirname,"bin","generate-tables")}`)();//génère les tables des bases de données
18
+ const plugins = (Array.isArray(opts.plugins) ? options.plugins : []);
19
+ let reanimated = "react-native-reanimated/plugin";
20
+ const filteredPlugins = plugins.filter((p)=>{
21
+ if(p === reanimated || Array.isArray(p) && p[0] === reanimated){
22
+ reanimated = p;
23
+ return false;
24
+ }
25
+ return true;
26
+ })
18
27
  return {
19
28
  presets: [
20
- ['babel-preset-expo']
29
+ ...filteredPlugins,
30
+ ['babel-preset-expo'],
21
31
  ],
22
32
  plugins : [
23
- ...(Array.isArray(opts.plugins) ? options.plugins : []),
33
+ ...plugins,
24
34
  ["inline-dotenv",inlineDovOptions],
25
35
  ["module-resolver", {"alias": alias}],
26
36
  "@babel/plugin-proposal-export-namespace-from",
27
- 'react-native-reanimated/plugin',
37
+ ...(reanimated?[reanimated]:[]),
28
38
  ],
29
39
  };
30
40
  };
package/bin/create-app.js CHANGED
@@ -103,6 +103,16 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
103
103
  writeFile(gP,gitignore);
104
104
  } catch{};
105
105
  }
106
+ const imagePluginOptions = {
107
+ "photosPermission": `Autoriser $(PRODUCT_NAME) d'accéder à vos photos.`,
108
+ "cameraPermission" : `Autoriser $(PRODUCT_NAME) d'accéder à votre camera`
109
+ }, cameraPluginsOptions = {
110
+ "cameraPermission" : `Autoriser $(PRODUCT_NAME) d'accéder à votre camera`
111
+ };
112
+ const plugins = [
113
+ ["expo-image-picker",imagePluginOptions],
114
+ ["expo-camera",cameraPluginsOptions]
115
+ ];
106
116
  appSheme = name? sanitizeFileName(name).replace(/ /g, '') : null;
107
117
  const appJSONPath = path.join(projectRoot,"app.json");
108
118
  if(!fs.existsSync(appJSONPath)){
@@ -114,6 +124,7 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
114
124
  "slug": "${name.toLowerCase().replace(/\s\s+/g, '-')}",
115
125
  "version":"${version}",
116
126
  "orientation": "portrait",
127
+ "plugins":${JSON.stringify(plugins,null,'\t')},
117
128
  "icon": "./assets/icon.png",
118
129
  "jsEngine": "hermes",
119
130
  "splash": {
@@ -153,6 +164,30 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
153
164
  });
154
165
  }
155
166
  appJSONManager.set({version})
167
+ let appPlugins = appJSONManager.get("expo.plugins");
168
+ if(!Array.isArray(appPlugins)){
169
+ appPlugins = plugins;
170
+ } else {
171
+ let hasFoundCamera = false, hasFoundImagePicker = false;
172
+ appPlugins.map(pl=>{
173
+ if(Array.isArray(pl)){
174
+ if(typeof pl[0] ==="expo-image-picker"){
175
+ hasFoundImagePicker = true;
176
+ } else if(pl[0] === "expo-camera"){
177
+ hasFoundCamera = true;
178
+ }
179
+ }
180
+ });
181
+ if(!hasFoundImagePicker){
182
+ appPlugins.push(plugins[0]);
183
+ }
184
+ if(!hasFoundCamera){
185
+ appPlugins.push(plugins[1]);
186
+ }
187
+ }
188
+ appJSONManager.set({
189
+ expo : {plugins:appPlugins}
190
+ });
156
191
  appJSONManager.save();
157
192
  }
158
193
  const eas = path.resolve(projectRoot,"eas.json");
@@ -6,7 +6,6 @@ import theme from "$theme";
6
6
  import Link from "$ecomponents/Link";
7
7
  import {StyleSheet} from "react-native";
8
8
  import {H1,H2,H3,H4,H5,Paragraph} from "$ecomponents/Typography";
9
-
10
9
  export default function ExpoUIHomeScreen (props){
11
10
  return <Screen {...props}>
12
11
  <View style={theme.styles.p1}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.0.7",
3
+ "version": "8.2.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -10,6 +10,8 @@
10
10
  "start": "npx expo start --dev --no-minify",
11
11
  "start-d": "npx expo start -c --no-dev --no-minify",
12
12
  "start-p": "npm run start-d",
13
+ "start-no-minify": "npx expo start --no-dev --minify",
14
+ "start-no-dev": "npx expo start --no-dev --minify",
13
15
  "expo-start-client": "npx expo start --dev --no-minify --dev-client",
14
16
  "start-m": "npx expo start - c--dev--no -minify",
15
17
  "android": "npx expo start --android -c",
@@ -70,7 +72,7 @@
70
72
  "@expo/html-elements": "^0.5.1",
71
73
  "@expo/vector-icons": "^14.0.0",
72
74
  "@faker-js/faker": "^8.0.2",
73
- "@fto-consult/common": "^4.8.33",
75
+ "@fto-consult/common": "^4.10.11",
74
76
  "@fto-consult/node-utils": "^1.4.7",
75
77
  "@pchmn/expo-material3-theme": "^1.3.2",
76
78
  "@react-native-async-storage/async-storage": "1.21.0",
@@ -84,7 +86,6 @@
84
86
  "apexcharts": "^3.45.1",
85
87
  "commander": "^11.1.0",
86
88
  "crypto-browserify": "^3.12.0",
87
- "expo": "^50.0.2",
88
89
  "expo-camera": "~14.0.1",
89
90
  "expo-clipboard": "~5.0.1",
90
91
  "expo-font": "~11.10.2",
@@ -115,6 +116,7 @@
115
116
  "react-native-mime-types": "^2.4.0",
116
117
  "react-native-paper": "^5.12.1",
117
118
  "react-native-paper-dates": "^0.21.7",
119
+ "react-native-reanimated": "~3.6.0",
118
120
  "react-native-safe-area-context": "4.8.2",
119
121
  "react-native-screens": "~3.29.0",
120
122
  "react-native-svg": "14.1.0",
@@ -27,7 +27,6 @@ import {
27
27
  Button,
28
28
  Platform
29
29
  } from "react-native";
30
- import Animation from "$ecomponents/Animation";
31
30
  export const defaultHeight = 300;
32
31
 
33
32
  const useNativeDriver = false;
@@ -1787,9 +1787,12 @@ export default class CommonDatagridComponent extends AppComponent {
1787
1787
  args.isOnlytotal = isOnlytotal;
1788
1788
  args.sessionData = sData;
1789
1789
  args.pdfConfig = pdfConfig;
1790
- args = this.handleTableExport({...args,excel,pdf});
1791
1790
  DialogProvider.close();
1792
- resolve(args);
1791
+ Preloader.open("export des données...");
1792
+ setTimeout(()=>{
1793
+ args = this.handleTableExport({...args,excel,pdf});
1794
+ resolve(args);
1795
+ },500)
1793
1796
  return args;
1794
1797
  },
1795
1798
  onCancel : reject,
@@ -1803,6 +1806,7 @@ export default class CommonDatagridComponent extends AppComponent {
1803
1806
  const wb = XLSX.utils.book_new();
1804
1807
  const ws = XLSX.utils.aoa_to_sheet(data);
1805
1808
  XLSX.utils.book_append_sheet(wb, ws, config.sheetName);
1809
+ Preloader.open(`Export des données, fichier : [${config.fileName|| ''}], fueille : ${config.sheetName}`)
1806
1810
  FileSystem.writeExcel({...config,workbook:wb}).then(({path})=>{
1807
1811
  if(isNonNullString(path)){
1808
1812
  notify.success("Fichier enregistré dans le répertoire {0}".sprintf(path))
@@ -15,6 +15,7 @@ export default function TestDatagridComponent({count,...props}){
15
15
  },[count])
16
16
  return <Table
17
17
  title = "Utilisateurs"
18
+ sessionName="datagrid-test-data"
18
19
  accordion = {({rowData})=>{
19
20
  return {
20
21
  content : `${rowData.email}`,
@@ -132,7 +132,9 @@ export default function ImageComponent(props){
132
132
  }
133
133
  const handlePickedImage = (image,opts)=>{
134
134
  opts = defaultObj(opts);
135
- image.dataUrl = image.dataURL = 'data:image/jpeg;base64,'+image.base64;
135
+ if(!isDataURL(image.dataURL)){
136
+ return notify.error(`Le fichier sélectionné est une image non valide`);
137
+ }
136
138
  let diffWidth = image.width - cropWidth - maxWidthDiff,
137
139
  diffHeight = image.height - cropHeight - maxHeightDiff;
138
140
  let canCrop = isMobileNative()? false : ((width && diffWidth > 0) || (height && diffHeight > 0)? true : false);
@@ -1,3 +1,5 @@
1
+ import "$session";
2
+ import "react-native-gesture-handler";
1
3
  import React from "$react";
2
4
  import appConfig from "$capp/config";
3
5
  import {MD3LightTheme,MD3DarkTheme,configureFonts} from "react-native-paper";
@@ -7,8 +7,18 @@ export const save = ({content,isBase64:isB64,share,directory,fileName,path})=>{
7
7
  path = defaultStr(path,directory,Directories.DOCUMENTS).trim().rtrim("/");
8
8
  share = defaultBool(share,true);
9
9
  let foundDirectory = null,dirToMake = null;
10
+ fileName = defaultStr(fileName).replaceAll("\\","/").trim();
10
11
  for(let i in Directories){
11
- if(path.includes(Directories[i].rtrim("/"))){
12
+ const dir = Directories[i].rtrim("/");
13
+ if(fileName.includes(dir)){
14
+ path = Directories[i];
15
+ const fName = fileName.split(Directories[i])[1];
16
+ const spl = fName.trim().ltrim("/").rtrim("/").split("/");
17
+ fileName = spl.pop();
18
+ path = p.join(path,spl);
19
+ break;
20
+ }
21
+ if(path.includes(dir)){
12
22
  foundDirectory = Directories[i];
13
23
  break;
14
24
  }
@@ -65,15 +75,21 @@ export const save = ({content,isBase64:isB64,share,directory,fileName,path})=>{
65
75
  }
66
76
  const dir = dirToMake.shift();
67
77
  path = p.join(path,dir);
68
- return FileSystem.makeDirectoryAsync(path,{ intermediates: true }).then(next).catch(reject);
78
+ const makeDir = ()=>FileSystem.makeDirectoryAsync(path,{ intermediates: true });
79
+ // Checks if gif directory exists. If not, creates it
80
+ return new Promise((r,err)=>{
81
+ return FileSystem.getInfoAsync(path).then((info)=>{
82
+ if(info.exists){
83
+ return r(info);
84
+ } else {
85
+ return makeDir().then(r);
86
+ }
87
+ }).catch((e)=>{
88
+ return makeDir().then(r).catch(err);
89
+ });
90
+ }).then(next).catch(reject);
69
91
  }
70
- return (typeof FileSystem.requestDirectoryPermissionsAsync == "function"? FileSystem.requestDirectoryPermissionsAsync: ()=>Promise.resolve(({directoryUri:path,granted:true})))(path).then(({directoryUri,granted})=>{
71
- if(granted){
72
- path = directoryUri;
73
- return next();
74
- }
75
- return {message:`Accès au repertoire ${path} non autorisé par l'utilisateur`}
76
- }).catch(reject);
92
+ return next();
77
93
  });
78
94
  }
79
95
  return success();
@@ -48,7 +48,13 @@ export * from "./utils";
48
48
 
49
49
  const prepareImageResult = (result)=>{
50
50
  if(!isObj(result)) return result;
51
- result.dataURL = result.dataUrl = isBase64(result.base64) ? ('data:image/jpeg;base64,'+result.base64) : undefined;
51
+ if(Array.isArray(result.assets) && isObj(result.assets[0])){
52
+ result = {
53
+ ...result,
54
+ ...result.assets[0],
55
+ }
56
+ }
57
+ result.dataURL = result.dataUrl = isBase64(result.base64) ? ('data:image/jpeg;base64,'+result.base64) : null;
52
58
  return result;
53
59
  }
54
60
 
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
3
  "name": "@fto-consult/expo-ui",
4
- "version": "8.0.3",
4
+ "version": "8.0.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/borispipo/expo-ui.git"