@fto-consult/expo-ui 6.62.0 → 6.62.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.62.0",
3
+ "version": "6.62.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -87,6 +87,7 @@
87
87
  "expo-font": "~11.4.0",
88
88
  "expo-image-picker": "~14.3.2",
89
89
  "expo-linking": "~5.0.2",
90
+ "expo-sharing": "~11.5.0",
90
91
  "expo-sqlite": "~11.3.3",
91
92
  "expo-status-bar": "~1.6.0",
92
93
  "expo-system-ui": "~2.4.0",
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  get join(){
3
3
  return function(...parts){
4
- const sep = sep='/';
4
+ const sep='/';
5
5
  return parts.filter(p=>p && typeof p=='string').join(sep).replace(new RegExp(sep+'{1,}', 'g'), sep)
6
6
  }
7
7
  }
@@ -1,7 +1,10 @@
1
1
  const FileSaver = require('file-saver');
2
2
  import {defaultNumber} from "$cutils";
3
3
 
4
- export const saveBlob = ({content,fileName,timeout,delay})=>{
4
+ /***
5
+ sauvegarde par défaut un fichier blob
6
+ */
7
+ export const save = ({content,fileName,timeout,delay})=>{
5
8
  return new Promise((resolve,reject)=>{
6
9
  try {
7
10
  FileSaver.saveAs(content, fileName);
@@ -1,10 +1,11 @@
1
1
  import { Directories,FileSystem } from "./native";
2
- import {defaultStr} from "$cutils";
2
+ import {defaultStr,defaultBool} from "$cutils";
3
3
  import p from "../path";
4
4
  import * as Sharing from 'expo-sharing';
5
5
 
6
- export const saveBlob = ({content,share,directory,fileName,path})=>{
6
+ export const save = ({content,isBase64:isB64,share,directory,fileName,path})=>{
7
7
  path = defaultStr(path,directory,Directories.DOCUMENTS).trim().rtrim("/");
8
+ share = defaultBool(share,true);
8
9
  let hasFound = false;
9
10
  for(let i in Directories){
10
11
  if(path.includes(Directories[i].rtrim("/"))){
@@ -16,16 +17,24 @@ export const saveBlob = ({content,share,directory,fileName,path})=>{
16
17
  path = Directories.DOCUMENTS;
17
18
  }
18
19
  path = p.join(path,fileName);
20
+ const cb = (r,resolve)=>{
21
+ setTimeout(()=>{
22
+ if(share){
23
+ Sharing.shareAsync(path);
24
+ }
25
+ },0);
26
+ const r2 = {fileName,path,result:r};
27
+ typeof resolve =='function' && resolve(r2);;
28
+ return r2;
29
+ }
30
+ if(isB64 || isBase64(content)){
31
+ return FileSystem.writeAsStringAsync(path,content,{ encoding: FileSystem.EncodingType.Base64 }).then(cb);
32
+ }
19
33
  return new Promise((resolve,reject)=>{
20
34
  const fr = new FileReader();
21
35
  fr.onload = () => {
22
36
  return FileSystem.writeAsStringAsync(path, fr.result.split(',')[1], { encoding: FileSystem.EncodingType.Base64 }).then((r)=>{
23
- setTimeout(()=>{
24
- if(share){
25
- Sharing.shareAsync(path);
26
- }
27
- },0);
28
- resolve({fileName,path});
37
+ return cb(r,resolve);
29
38
  }).catch(reject);
30
39
  };
31
40
  fr.onerror(reject);
@@ -6,6 +6,7 @@ const mime = require('react-native-mime-types')
6
6
  const XLSX = require("xlsx");
7
7
  import Preloader from "$preloader";
8
8
  import * as FileSaver from "./FileSaver";
9
+ import {isWeb,isMobileNative} from "$cplatform";
9
10
 
10
11
 
11
12
  /**** sauvegarde un fichier sur le disque
@@ -21,7 +22,7 @@ import * as FileSaver from "./FileSaver";
21
22
  * isBinary : si c'est un fichier binaire
22
23
  * }
23
24
  */
24
- export const write = ({content,type,share,contentType,fileName,...rest})=>{
25
+ export const write = ({content,type,contentType,fileName,...rest})=>{
25
26
  fileName = sanitizeFileName(fileName);
26
27
  contentType = defaultStr(contentType) || mime.contentType(fileName) || mime.contentType(".txt");
27
28
  if(!isNonNullString(fileName)){
@@ -36,7 +37,7 @@ import * as FileSaver from "./FileSaver";
36
37
  contentType = type;
37
38
  }
38
39
  }
39
- return FileSaver.saveBlob({content:isBlob(content)? content : new Blob([content], { type: content?.type||contentType}),share:defaultBool(share,true),fileName,contentType,...rest})
40
+ return FileSaver.save({content:isBlob(content)? content : new Blob([content], { type: content?.type||contentType}),fileName,contentType,...rest})
40
41
  }
41
42
 
42
43
  export const writeText = (args)=>{
@@ -46,6 +47,7 @@ export const writeText = (args)=>{
46
47
  /***
47
48
  * @see https://ourtechroom.com/tech/mime-type-for-excel/ for excel mimesTypes
48
49
  * .xls : application/vnd.ms-excel
50
+ @see :
49
51
  */
50
52
  export const writeExcel = ({workbook,content,contentType,fileName,...rest})=>{
51
53
  let ext = defaultStr(getFileExtension(fileName,true),"xlsx");
@@ -59,16 +61,21 @@ export const writeExcel = ({workbook,content,contentType,fileName,...rest})=>{
59
61
  if(isBlob(content)){
60
62
  return write({...rest,content,fileName,contentType})
61
63
  }
64
+
65
+ Preloader.open("génération du fichier excel "+fileName);
66
+ if(isMobileNative()){
67
+ return FileSaver.save({...rest,content:XLSX.write(workbook, {type:'base64', bookType:ext}),fileName}).finally(Preloader.close);
68
+ }
62
69
  return new Promise((resolve,reject)=>{
63
- Preloader.open("génération du fichier excel "+fileName);
64
70
  try {
65
71
  XLSX.writeFile(workbook, fileName);
66
72
  setTimeout(()=>{
67
- Preloader.close();
68
73
  resolve({fileName});
69
74
  },1000);
70
75
  } catch(e){
71
76
  reject(e);
77
+ } finally{
78
+ Preloader.close();
72
79
  }
73
80
  })
74
81
  }
@@ -1 +1 @@
1
- module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.61.1","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-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.0","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"}};
1
+ module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.62.1","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.0","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"}};