@fto-consult/expo-ui 4.0.1 → 4.0.3
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/electron/createDir.js +2 -2
- package/electron/getDirname.js +14 -0
- package/electron/getIcon.js +24 -0
- package/electron/index.js +11 -31
- package/electron/preload.js +3 -0
- package/package.json +2 -2
- package/src/components/AutoSizer/Vertical.js +16 -5
- package/src/components/Datagrid/Table/index.js +1 -2
- package/src/components/Table/List/List.js +7 -5
- package/src/components/Table/List/index.js +13 -3
package/electron/createDir.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const getDirName = require('path').dirname;
|
|
2
1
|
const fs = require("fs");
|
|
3
2
|
module.exports = function createDir(path,cb) {
|
|
4
3
|
if(!path || typeof path !='string') return false;
|
|
5
|
-
const p =
|
|
4
|
+
const p = require("./getDirname")(path);
|
|
5
|
+
if(!p) return false;
|
|
6
6
|
if(!fs.existsSync(p)){
|
|
7
7
|
try {
|
|
8
8
|
fs.mkdirSync(p,{ recursive: true});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
///retourne le nom du repertoire d'un chemin passé en paramètre
|
|
2
|
+
const path = require("path");
|
|
3
|
+
function isFile(pathItem) {
|
|
4
|
+
return !!path.extname(pathItem);
|
|
5
|
+
}
|
|
6
|
+
module.exports = (path_string)=>{
|
|
7
|
+
if(!path_string || typeof path_string !=='string'){
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
if(isFile(path_string)){
|
|
11
|
+
return path.dirname(path_string);
|
|
12
|
+
}
|
|
13
|
+
return path.resolve(path_string);
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const isWindow = process.platform =="win32",
|
|
2
|
+
isMac = process.platform =='darwin',
|
|
3
|
+
isLinux = process.platform =="linux";
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const getDirname = require("./getDirname");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
module.exports = (p)=>{
|
|
8
|
+
if(Array.isArray(p)){
|
|
9
|
+
for(let i in p){
|
|
10
|
+
const r = getIcon(p[i]);
|
|
11
|
+
if(r) return r;
|
|
12
|
+
}
|
|
13
|
+
} else if(typeof p =='string' && p && fs.existsSync(p)){
|
|
14
|
+
const ext = isWindow ? ".ico" : isMac ? ".incs" : ".png";
|
|
15
|
+
const possibles = ["icon","logo","favicon"];
|
|
16
|
+
for(let i in possibles){
|
|
17
|
+
const ico = path.join(getDirname(p),possibles[i]+ext);
|
|
18
|
+
if(fs.existsSync(ico)){
|
|
19
|
+
return ico;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
package/electron/index.js
CHANGED
|
@@ -4,6 +4,7 @@ const session = require("./session");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const ePath = path.resolve(__dirname);
|
|
7
|
+
const getDirname = require("./getDirname");
|
|
7
8
|
if(!fs.existsSync(path.resolve(ePath,"paths.json"))){
|
|
8
9
|
throw {message : 'Chemin de noms, fichier paths.json introuvable!! Exécutez l\'application en enviornnement web|mobile|android|ios puis re-essayez'}
|
|
9
10
|
}
|
|
@@ -18,37 +19,11 @@ const mainProcess = mainProcessRequired && typeof mainProcessRequired =='object'
|
|
|
18
19
|
// Gardez une reference globale de l'objet window, si vous ne le faites pas, la fenetre sera
|
|
19
20
|
// fermee automatiquement quand l'objet JavaScript sera garbage collected.
|
|
20
21
|
let win = undefined;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for(let i in p){
|
|
27
|
-
const r = getIcon(p[i]);
|
|
28
|
-
if(r) return r;
|
|
29
|
-
}
|
|
30
|
-
} else if(typeof p =='string' && p && fs.existsSync(p)){
|
|
31
|
-
const ext = isWindow ? ".ico" : isMac ? ".incs" : ".png";
|
|
32
|
-
const possibles = ["icon","logo","favicon"];
|
|
33
|
-
for(let i in possibles){
|
|
34
|
-
const icon = path.join(p,possibles[i]+ext);
|
|
35
|
-
if(fs.existsSync(icon)){
|
|
36
|
-
return icon;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
const icon = isLinux && logo && fs.existsSync(logo) && logo || getIcon(
|
|
43
|
-
logo && fs.existsSync(logo) && path.dirname(logo),
|
|
44
|
-
images,
|
|
45
|
-
assets,
|
|
46
|
-
)
|
|
47
|
-
/*console.log(icon," is iccccccc");
|
|
48
|
-
console.log(logo," is logo ",images,assets);
|
|
49
|
-
throw {
|
|
50
|
-
message : "icon is "+icon+" logo is "+logo+" image is "+images+" assets is "+assets
|
|
51
|
-
}*/
|
|
22
|
+
const icon = require("./getIcon")(
|
|
23
|
+
logo && fs.existsSync(logo) && getDirname(logo),
|
|
24
|
+
images && getDirname(images) || '',
|
|
25
|
+
assets && getDirname(assets) || '',
|
|
26
|
+
);
|
|
52
27
|
Menu.setApplicationMenu(null);
|
|
53
28
|
let clipboadContextMenu = (_, props) => {
|
|
54
29
|
if (props.isEditable || props.selectionText) {
|
|
@@ -149,6 +124,10 @@ function createWindow () {
|
|
|
149
124
|
devTools : true,
|
|
150
125
|
}
|
|
151
126
|
});
|
|
127
|
+
|
|
128
|
+
const log = (message)=>{
|
|
129
|
+
return win != null && win && win.webContents.send("console.log",message);
|
|
130
|
+
}
|
|
152
131
|
// create a new `splash`-Window
|
|
153
132
|
/*** @see : http://leftstick.github.io/splash-screen/ */
|
|
154
133
|
let splash = new BrowserWindow({
|
|
@@ -188,6 +167,7 @@ function createWindow () {
|
|
|
188
167
|
splash = null;
|
|
189
168
|
win.restore();
|
|
190
169
|
win.show();
|
|
170
|
+
//log(icon," is consooleeeee")
|
|
191
171
|
})
|
|
192
172
|
|
|
193
173
|
win.on('close', (e) => {
|
package/electron/preload.js
CHANGED
|
@@ -319,6 +319,9 @@ ipcRenderer.on("main-app-restaured",()=>{
|
|
|
319
319
|
message : "TRACK_IDLE",
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
|
+
ipcRenderer.on('console.log',(event,...message)=>{
|
|
323
|
+
console.log(...message);
|
|
324
|
+
})
|
|
322
325
|
ipcRenderer.on('appReady',()=>{})
|
|
323
326
|
ipcRenderer.on("main-window-focus",()=>{
|
|
324
327
|
postMessage("WINDOW_FOCUS");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"react-native-svg": "13.4.0",
|
|
106
106
|
"react-native-web": "~0.18.7",
|
|
107
107
|
"react-native-webview": "11.23.1",
|
|
108
|
-
"react-virtuoso": "^4.0.
|
|
108
|
+
"react-virtuoso": "^4.0.9",
|
|
109
109
|
"sharp-cli": "^2.1.0",
|
|
110
110
|
"tippy.js": "^6.3.7",
|
|
111
111
|
"use-event-callback": "^0.1.0",
|
|
@@ -12,7 +12,7 @@ import {isWeb} from "$cplatform";
|
|
|
12
12
|
* ce composant a pour but de définir la taille d'un contenu en se basant sur sa positin top, de manière à ce que, le contentu du composant fit
|
|
13
13
|
* le reste de la taille de la page, avec comme valeur de la props minHeight
|
|
14
14
|
*/
|
|
15
|
-
const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,withActivityIndicator,testID,withPadding,maxHeight,minHeight,style,children:cChildren,...rest},ref) => {
|
|
15
|
+
const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,getRenderingStyle,withActivityIndicator,testID,withPadding,maxHeight,minHeight,style,children:cChildren,...rest},ref) => {
|
|
16
16
|
testID = defaultStr(testID,'RN_AutoSizerVerticalComponent');
|
|
17
17
|
const hasUpdateLayoutRef = React.useRef(false);
|
|
18
18
|
const layoutRef = React.useRef(null);
|
|
@@ -58,13 +58,24 @@ const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,with
|
|
|
58
58
|
const contentLayout = defaultObj(layout.layout);
|
|
59
59
|
cStyle.minHeight = Math.min(Math.max(layout.height-defaultNumber(contentLayout.y),minHeight && minHeight ||250));
|
|
60
60
|
const cMaxHeight = layout.height-defaultNumber(contentLayout.y);
|
|
61
|
-
if(cMaxHeight>=
|
|
61
|
+
if(cMaxHeight>=200){
|
|
62
62
|
cStyle.maxHeight = cMaxHeight;
|
|
63
63
|
}
|
|
64
64
|
if(withPadding !== false){
|
|
65
65
|
cStyle.paddingBottom = 50;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const restStyle = {};
|
|
68
|
+
const canUpdate = hasUpdateLayout || hasUpdateLayout || withActivityIndicator === false;
|
|
69
|
+
const fStyle = !canUpdate && {flex:1,flexDirection:'column',maxHeight:cStyle.maxHeight,maxWidth : Math.max(layout.width-defaultNumber(contentLayout.x)),justifyContent:'center',alignItems:'center'} || {};
|
|
70
|
+
if(maxHeight){
|
|
71
|
+
restStyle.maxHeight = maxHeight;
|
|
72
|
+
}
|
|
73
|
+
if(minHeight){
|
|
74
|
+
restStyle.minHeight = minHeight;
|
|
75
|
+
}
|
|
76
|
+
if(canUpdate && typeof getRenderingStyle ==='function'){
|
|
77
|
+
getRenderingStyle({...cStyle,...restStyle});
|
|
78
|
+
}
|
|
68
79
|
return <View ref={layoutRef}
|
|
69
80
|
onLayout={(a,b,c)=>{
|
|
70
81
|
if(onLayout && onLayout(a,b,c) === false) return;
|
|
@@ -73,8 +84,8 @@ const AutoSizerVerticalComponent = React.forwardRef(({onLayout,isScrollView,with
|
|
|
73
84
|
}
|
|
74
85
|
}}
|
|
75
86
|
{...rest}
|
|
76
|
-
style={[theme.styles.w100,cStyle,style,fStyle,
|
|
77
|
-
{
|
|
87
|
+
style={[theme.styles.w100,cStyle,style,fStyle,restStyle]} testID={testID+"_ScrollViewContainer"}>
|
|
88
|
+
{ canUpdate?children : <ActivityIndicator size={'large'}/>}
|
|
78
89
|
</View>
|
|
79
90
|
});
|
|
80
91
|
|
|
@@ -187,7 +187,6 @@ const DatagridFactory = (Factory)=>{
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
const maxHeight = this.getMaxListHeight();
|
|
191
190
|
const rPagination = showPagination ? <View style={[styles.paginationContainer]}>
|
|
192
191
|
<ScrollView testID={testID+"_Datagrid_Headers"} horizontal style={styles.paginationContainerStyle} contentContainerStyle={styles.minW100}>
|
|
193
192
|
<View testID={testID+"_HeaderPaginationContent"} style={[styles.paginationContent]}>
|
|
@@ -292,7 +291,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
292
291
|
</View>
|
|
293
292
|
</ScrollView>
|
|
294
293
|
</View> : null;
|
|
295
|
-
return <View style={[styles.container,{flex:1
|
|
294
|
+
return <View style={[styles.container,{flex:1}]} testID={testID+"_TableContainer"} pointerEvents={pointerEvents}>
|
|
296
295
|
<View ref={this.layoutRef} testID={testID+"_LayoutContainer"}>
|
|
297
296
|
{this.props.showActions !== false ? <DatagridActions
|
|
298
297
|
pointerEvents = {pointerEvents}
|
|
@@ -26,7 +26,7 @@ const propTypes = {
|
|
|
26
26
|
isScrolling : PropTypes.func,
|
|
27
27
|
};
|
|
28
28
|
/***@see : https://virtuoso.dev/virtuoso-api-reference/ */
|
|
29
|
-
const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderItem,onEndReached,onLayout,onContentSizeChange,onScroll,isScrolling,estimatedItemSize,onEndReachedThreshold,containerProps,style,...props},ref)=>{
|
|
29
|
+
const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderItem,onEndReached,onLayout,onContentSizeChange,onScroll,isScrolling,estimatedItemSize,onEndReachedThreshold,containerProps,style,autoSizedStyle,...props},ref)=>{
|
|
30
30
|
const r2 = {};
|
|
31
31
|
for(let i in propTypes){
|
|
32
32
|
if(i in props){
|
|
@@ -87,15 +87,14 @@ const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderIte
|
|
|
87
87
|
},100)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
React.useEffect(()=>{
|
|
91
|
-
checkSize();
|
|
92
|
-
},[props])
|
|
93
90
|
React.useEffect(()=>{
|
|
94
91
|
return ()=>{
|
|
95
92
|
React.setRef(ref,null);
|
|
96
93
|
}
|
|
97
94
|
},[]);
|
|
98
|
-
React.useOnRender(
|
|
95
|
+
React.useOnRender((a,b,c)=>{
|
|
96
|
+
if(onRender && onRender(a,b,c));
|
|
97
|
+
},Math.max(Array.isArray(items) && items.length/10 || 0,500))
|
|
99
98
|
return <View {...containerProps} {...props} style={[{flex:1},containerProps.style,style,{minWidth:'100%',height:'100%',maxWidth:'100%'}]} onLayout={onLayout} testID={testID}>
|
|
100
99
|
<Virtuoso
|
|
101
100
|
{...r2}
|
|
@@ -120,6 +119,9 @@ const VirtuosoListComponent = React.forwardRef(({items,onRender,testID,renderIte
|
|
|
120
119
|
return isScrolling(isC);
|
|
121
120
|
}
|
|
122
121
|
}}
|
|
122
|
+
totalListHeightChanged = {(height)=>{
|
|
123
|
+
checkSize();
|
|
124
|
+
}}
|
|
123
125
|
defaultItemHeight = {typeof estimatedItemSize=='number' && estimatedItemSize || undefined}
|
|
124
126
|
/>
|
|
125
127
|
</View>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import React from "$react";
|
|
2
2
|
import {Vertical as AutoSizeVertical} from "$ecomponents/AutoSizer";
|
|
3
3
|
import List from "./List";
|
|
4
|
-
import {defaultStr,defaultObj} from "$utils";
|
|
4
|
+
import {defaultStr,isObj,defaultObj} from "$utils";
|
|
5
|
+
const normalize = (size)=>{
|
|
6
|
+
if(isObj(size)){
|
|
7
|
+
["padding","paddingBottom","paddingTop","paddingLeft","paddingRight"].map(p=>{
|
|
8
|
+
delete size[p];
|
|
9
|
+
})
|
|
10
|
+
return size;
|
|
11
|
+
}
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
5
14
|
const AutoSizeVerticalList = React.forwardRef(({testID,autoSizerProps,...props},ref)=>{
|
|
6
15
|
testID = defaultStr(testID,"RN_AutoSizeVerticalListComponent")
|
|
7
16
|
autoSizerProps = defaultObj(autoSizerProps);
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
const sizeRef = React.useRef({});
|
|
18
|
+
return <AutoSizeVertical withPadding={false} getRenderingStyle={(size)=>{sizeRef.current = normalize(sizeRef.current);}} testID={testID+"_AutoSizerVertical"} {...autoSizerProps} >
|
|
19
|
+
<List {...props} autoSizedStyle = {sizeRef.current} style={[props.style,sizeRef.current]} ref={ref}/>
|
|
10
20
|
</AutoSizeVertical>
|
|
11
21
|
})
|
|
12
22
|
|