@fto-consult/expo-ui 7.8.10 → 7.10.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/package.json +4 -4
- package/src/components/Datagrid/Common/Common.js +2 -11
- package/src/layouts/Screen/ScreenWithoutAuthContainer.js +8 -5
- package/src/media/file-system/utils/FileSaver.electron.js +7 -0
- package/src/media/file-system/utils/FileSaver.js +6 -16
- package/src/media/file-system/utils/FileSaver.native.js +1 -1
- package/src/media/file-system/utils/Fsaver.web.js +18 -0
- package/src/media/file-system/utils/utils.js +8 -8
- package/src/screens/Help/About.js +0 -2
- package/src/screens/Help/OpenLibraryScreen.js +9 -3
- package/src/screens/Help/openLibraries.js +5 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.10.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"scripts": {
|
6
6
|
"clear-npx-cache": "npx clear-npx-cache",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"@expo/vector-icons": "^13.0.0",
|
73
73
|
"@faker-js/faker": "^8.0.2",
|
74
74
|
"@fto-consult/common": "^3.75.2",
|
75
|
-
"@fto-consult/electron-gen": "^
|
75
|
+
"@fto-consult/electron-gen": "^2.0.0",
|
76
76
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
77
77
|
"@react-native-async-storage/async-storage": "1.18.2",
|
78
78
|
"@react-native-community/datetimepicker": "7.2.0",
|
@@ -114,12 +114,12 @@
|
|
114
114
|
"react-native-iphone-x-helper": "^1.3.1",
|
115
115
|
"react-native-mime-types": "^2.4.0",
|
116
116
|
"react-native-paper": "^5.11.4",
|
117
|
-
"react-native-paper-dates": "^0.21.
|
117
|
+
"react-native-paper-dates": "^0.21.7",
|
118
118
|
"react-native-reanimated": "~3.3.0",
|
119
119
|
"react-native-safe-area-context": "4.6.3",
|
120
120
|
"react-native-screens": "~3.22.0",
|
121
121
|
"react-native-svg": "13.9.0",
|
122
|
-
"react-native-web": "^0.19.
|
122
|
+
"react-native-web": "^0.19.10",
|
123
123
|
"react-native-webview": "13.2.2",
|
124
124
|
"react-virtuoso": "^4.6.2",
|
125
125
|
"sanitize-filename": "^1.6.3",
|
@@ -45,7 +45,7 @@ import {MORE_ICON} from "$ecomponents/Icon"
|
|
45
45
|
import ActivityIndicator from "$ecomponents/ActivityIndicator";
|
46
46
|
import {createTableHeader,fields as pdfFields,pageHeaderMargin,sprintf as pdfSprintf} from "$cpdf";
|
47
47
|
import {isWeb,isMobileNative} from "$cplatform";
|
48
|
-
import { createPDF,getFields as getPdfFields } from '
|
48
|
+
import { createPDF,getFields as getPdfFields } from '$expo-ui/pdf';
|
49
49
|
|
50
50
|
export const TIMEOUT = 100;
|
51
51
|
|
@@ -1835,16 +1835,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1835
1835
|
if(pdfDocumentTitle){
|
1836
1836
|
content.unshift(pdfDocumentTitle);
|
1837
1837
|
}
|
1838
|
-
|
1839
|
-
if(isWeb()){
|
1840
|
-
return pdf.open();
|
1841
|
-
}
|
1842
|
-
return;
|
1843
|
-
FileSystem.writeExcel({...config,workbook:wb}).then(({path})=>{
|
1844
|
-
if(isNonNullString(path)){
|
1845
|
-
notify.success("Fichier enregistré dans le répertoire {0}".sprintf(path))
|
1846
|
-
}
|
1847
|
-
})
|
1838
|
+
return createPDF({...config,content});
|
1848
1839
|
}).finally(Preloader.close);
|
1849
1840
|
}
|
1850
1841
|
handleTableExport(args){
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from '$react';
|
2
2
|
import {StyleSheet} from 'react-native';
|
3
3
|
import PropTypes from "prop-types";
|
4
|
-
import {defaultObj,defaultStr,defaultNumber,
|
4
|
+
import {defaultObj,defaultStr,defaultNumber,isValidUrl,uniqid} from "$cutils";
|
5
5
|
import View from "$ecomponents/View";
|
6
6
|
import { useNavigation} from '$cnavigation';
|
7
7
|
import Fab from "$elayouts/Fab";
|
@@ -75,7 +75,7 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
|
|
75
75
|
|
76
76
|
|
77
77
|
React.useEffect(() => {
|
78
|
-
if(
|
78
|
+
if(navigation && typeof navigation?.setOptions ==="function"){
|
79
79
|
const appName = APP.getName().toUpperCase();
|
80
80
|
subtitle = React.getTextContent(subtitle);
|
81
81
|
let screenTitle = getDefaultTitle(title,true);
|
@@ -85,15 +85,18 @@ export default function MainScreenScreenWithoutAuthContainer(props) {
|
|
85
85
|
if(!screenTitle.toUpperCase().contains(appName)){
|
86
86
|
screenTitle+=" | "+appName;
|
87
87
|
}
|
88
|
+
if(isElectron() && typeof window?.ELECTRON !== "undefined" && typeof ELECTRON?.getLoadedAppUrl =='function'){
|
89
|
+
const loadedUrl = ELECTRON.getLoadedAppUrl();
|
90
|
+
if(isValidUrl(loadedUrl) && !screenTitle.includes(loadedUrl)){
|
91
|
+
screenTitle = `${screenTitle} [${loadedUrl}]`;
|
92
|
+
}
|
93
|
+
}
|
88
94
|
navigation.setOptions({
|
89
95
|
...options,
|
90
96
|
appBarProps:{...options.appBarProps,...appBarProps,title,subtitle},
|
91
97
|
subtitle :subtitle,
|
92
98
|
title : screenTitle,
|
93
99
|
});
|
94
|
-
if(isElectron() && typeof window?.ELECTRON !== "undefined" && typeof ELECTRON?.setTitle =='function'){
|
95
|
-
ELECTRON.setTitle(screenTitle);
|
96
|
-
}
|
97
100
|
}
|
98
101
|
}, [title,subtitle]);
|
99
102
|
const fab = withFab ? <Fab
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import {save as saveWeb} from "./Fsaver.web";
|
2
|
+
import {isElectron} from "$cplatform";
|
3
|
+
|
4
|
+
export const save = (options,...rest)=>{
|
5
|
+
if(!isElectron() || typeof window?.ELECTRON =="undefined" || typeof window?.ELECTRON?.FILE !=="object" || typeof window?.ELECTRON?.FILE?.write !=="function") return saveWeb(options,...rest);
|
6
|
+
return ELECTRON.FILE.write(options,...rest);
|
7
|
+
}
|
@@ -1,18 +1,8 @@
|
|
1
|
-
|
2
|
-
import {
|
1
|
+
import {save as saveWeb} from "./Fsaver.web";
|
2
|
+
import {save as saveEelectron} from "./FileSaver.electron";
|
3
|
+
import {isElectron} from "$cplatform";
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export const save = ({content,fileName,timeout,delay})=>{
|
8
|
-
return new Promise((resolve,reject)=>{
|
9
|
-
try {
|
10
|
-
FileSaver.saveAs(content, fileName);
|
11
|
-
setTimeout(() => {
|
12
|
-
resolve({path:fileName,isWeb : true});
|
13
|
-
}, defaultNumber(timeout,delay,3000));
|
14
|
-
} catch(e){
|
15
|
-
reject(e);
|
16
|
-
}
|
17
|
-
})
|
5
|
+
export const save = (options,...rest)=> {
|
6
|
+
if(isElectron()) return saveEelectron(options,...rest);
|
7
|
+
return saveWeb(options,...rest);
|
18
8
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
const FileSaver = require('file-saver');
|
2
|
+
import {defaultNumber} from "$cutils";
|
3
|
+
|
4
|
+
/***
|
5
|
+
sauvegarde par défaut un fichier blob
|
6
|
+
*/
|
7
|
+
export const save = ({content,fileName,timeout,delay})=>{
|
8
|
+
return new Promise((resolve,reject)=>{
|
9
|
+
try {
|
10
|
+
FileSaver.saveAs(content, fileName);
|
11
|
+
setTimeout(() => {
|
12
|
+
resolve({path:fileName,isWeb : true});
|
13
|
+
}, defaultNumber(timeout,delay,3000));
|
14
|
+
} catch(e){
|
15
|
+
reject(e);
|
16
|
+
}
|
17
|
+
})
|
18
|
+
}
|
@@ -6,8 +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 {
|
10
|
-
|
9
|
+
import {isMobileNative,isElectron} from "$cplatform";
|
11
10
|
|
12
11
|
/**** sauvegarde un fichier sur le disque
|
13
12
|
* @param {object} {
|
@@ -28,14 +27,15 @@ import {isWeb,isMobileNative} from "$cplatform";
|
|
28
27
|
if(!isNonNullString(fileName)){
|
29
28
|
return Promise.reject({status:false,msg:'Nom de fichier invalide'});
|
30
29
|
}
|
30
|
+
const isNative = isMobileNative() || isElectron();
|
31
31
|
if(isBase64(content)){
|
32
|
-
if(
|
32
|
+
if(isNative){
|
33
33
|
return FileSaver.save({content,contentType,isBase64:true,fileName,...rest});
|
34
34
|
}
|
35
35
|
content = new Blob([base64toBlob(content,contentType)], {});
|
36
36
|
} else if(isDataURL(content)){
|
37
|
-
if(
|
38
|
-
return FileSaver.save({content:dataURLToBase64(content),contentType,isBase64:true,fileName,...rest});
|
37
|
+
if(isNative){
|
38
|
+
return FileSaver.save({content:dataURLToBase64(content),contentType,mime:contentType,isBase64:true,fileName,...rest});
|
39
39
|
}
|
40
40
|
const type = getTypeFromDataURL(content);
|
41
41
|
content = dataURLToBlob(content);
|
@@ -61,16 +61,16 @@ export const writeExcel = ({workbook,content,contentType,fileName,...rest})=>{
|
|
61
61
|
if(!isNonNullString(fileName)){
|
62
62
|
return Promise.reject({status:false,message:'Nom de fichier invalide pour le contenu excel à créer'});
|
63
63
|
}
|
64
|
-
|
64
|
+
const isNative = isMobileNative() || isElectron();
|
65
65
|
Preloader.open("génération du fichier excel "+fileName);
|
66
66
|
if(isBase64(content)){
|
67
|
-
if(
|
67
|
+
if(isNative) return FileSaver.save({content,isBase64:true,contentType,fileName,...rest}).finally(Preloader.close);
|
68
68
|
content = new Blob([base64toBlob(content, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')], {});
|
69
69
|
}
|
70
70
|
if(isBlob(content)){
|
71
71
|
return write({...rest,content,fileName,contentType}).finally(Preloader.close)
|
72
72
|
}
|
73
|
-
if(
|
73
|
+
if(isNative){
|
74
74
|
return FileSaver.save({...rest,content:XLSX.write(workbook, {type:'base64', bookType:ext}),fileName}).finally(Preloader.close).finally(Preloader.close);
|
75
75
|
}
|
76
76
|
return new Promise((resolve,reject)=>{
|
@@ -77,8 +77,6 @@ export default function HelpScreen(props){
|
|
77
77
|
<Link routeName={"releaseNotes"}>
|
78
78
|
<Label primary textBold style={theme.styles.mv05} >{appConfig.name+", Notes de mise à jour."}</Label>
|
79
79
|
</Link>
|
80
|
-
</View>
|
81
|
-
<View testID={testID+"_OpenLibrariesLinkContainer"} style={[theme.styles.w100,theme.styles.alignItemsCenter]}>
|
82
80
|
<OpenLibraries.Link testID={testID+"_OpenLibrariesLink"}/>
|
83
81
|
</View>
|
84
82
|
</View>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import View from "$ecomponents/View";
|
2
2
|
import Screen from "$escreen";
|
3
|
-
import {defaultStr,defaultObj,isValidUrl} from "$cutils";
|
3
|
+
import {defaultStr,defaultObj,isValidUrl,isObj,isNonNullString} from "$cutils";
|
4
4
|
import Label from "$ecomponents/Label";
|
5
5
|
import theme from "$theme";
|
6
6
|
import Link from "$ecomponents/Link";
|
@@ -10,8 +10,10 @@ import Table from "$ecomponents/Table";
|
|
10
10
|
import React from "$react";
|
11
11
|
import AutoLink from "$ecomponents/AutoLink";
|
12
12
|
import {Vertical} from "$ecomponents/AutoSizer";
|
13
|
+
const packageJSON = require("$packageJSON");
|
13
14
|
|
14
15
|
const openLibraries = require("./openLibraries");
|
16
|
+
const euPackageName = "@fto-consult/expo-ui";
|
15
17
|
|
16
18
|
const columns = {
|
17
19
|
index : {
|
@@ -33,8 +35,12 @@ const columns = {
|
|
33
35
|
}
|
34
36
|
export default function OpenLibrariesScreen({testID,...props}){
|
35
37
|
testID = defaultStr(testID,"RN_HealScreenOpenLibraries");
|
36
|
-
|
37
|
-
|
38
|
+
if(isObj(packageJSON?.dependencies)){
|
39
|
+
const devExpo = packageJSON?.dependencies[euPackageName];
|
40
|
+
const opo = isNonNullString(devExpo) ? {version:devExpo.trim().ltrim("^")} : Object.assign({},devExpo);
|
41
|
+
openLibraries[euPackageName] = Object.assign({},openLibraries[euPackageName]);
|
42
|
+
openLibraries[euPackageName] = {...openLibraries[euPackageName],...opo};
|
43
|
+
}
|
38
44
|
const data = React.useMemo(()=>{
|
39
45
|
const data = [];
|
40
46
|
Object.map(openLibraries,(lib,i,_i)=>{
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module.exports = {
|
2
2
|
"@fto-consult/expo-ui": {
|
3
3
|
"name": "@fto-consult/expo-ui",
|
4
|
-
"version": "7.
|
4
|
+
"version": "7.8.10",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "git+https://github.com/borispipo/expo-ui.git"
|
@@ -49,12 +49,12 @@ module.exports = {
|
|
49
49
|
"license": "MIT"
|
50
50
|
},
|
51
51
|
"@fto-consult/common": {
|
52
|
-
"version": "3.
|
52
|
+
"version": "3.75.2",
|
53
53
|
"url": "https://github.com/borispipo/common#readme",
|
54
54
|
"license": "ISC"
|
55
55
|
},
|
56
56
|
"@fto-consult/electron-gen": {
|
57
|
-
"version": "1.
|
57
|
+
"version": "1.3.7",
|
58
58
|
"license": "ISC"
|
59
59
|
},
|
60
60
|
"@pchmn/expo-material3-theme": {
|
@@ -268,7 +268,7 @@ module.exports = {
|
|
268
268
|
"license": "MIT"
|
269
269
|
},
|
270
270
|
"react-native-paper-dates": {
|
271
|
-
"version": "0.21.
|
271
|
+
"version": "0.21.7",
|
272
272
|
"url": "https://github.com/web-ridge/react-native-paper-dates#readme",
|
273
273
|
"license": "MIT"
|
274
274
|
},
|
@@ -293,7 +293,7 @@ module.exports = {
|
|
293
293
|
"license": "MIT"
|
294
294
|
},
|
295
295
|
"react-native-web": {
|
296
|
-
"version": "0.19.
|
296
|
+
"version": "0.19.10",
|
297
297
|
"url": "git://github.com/necolas/react-native-web.git",
|
298
298
|
"license": "MIT"
|
299
299
|
},
|