@fto-consult/expo-ui 2.37.7 → 2.38.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/metro.config.js +1 -0
- package/package.json +7 -6
- package/src/components/AutoResizer/index.js +104 -0
- package/src/components/Chart/appexChart/index.native.js +1 -1
- package/src/components/Chart/index.js +2 -1
- package/src/components/Datagrid/Accordion/Filters.js +0 -1
- package/src/components/Datagrid/Accordion/index.js +6 -12
- package/src/components/Datagrid/Common/Common.js +137 -53
- package/src/components/Datagrid/Common/utils.js +4 -1
- package/src/components/Datagrid/IndexComponent.js +1 -4
- package/src/components/Datagrid/SWRDatagrid.js +2 -16
- package/src/components/Datagrid/Table/index.js +10 -39
- package/src/components/Dialog/Dialog.js +0 -1
- package/src/components/Form/FormData/Dialog.js +1 -6
- package/src/components/Form/FormData/FormData.js +1 -2
- package/src/components/Form/FormData/FormDataActions.js +6 -9
- package/src/components/Hashtag/index.js +2 -2
- package/src/components/List/Common.js +0 -1
- package/src/components/Table/AbsoluteScrollView.js +3 -2
- package/src/components/Table/Cell.js +24 -0
- package/src/components/Table/Header.js +25 -0
- package/src/components/Table/List.js +196 -0
- package/src/components/Table/List.native.js +5 -0
- package/src/components/{Datagrid/Common → Table}/ProgressBar.js +0 -0
- package/src/components/Table/Row.js +21 -0
- package/src/components/Table/Test.js +0 -0
- package/src/components/Table/index.js +218 -202
- package/src/layouts/Screen/FormData/FormData.js +6 -15
- package/src/layouts/Screen/FormData/List.js +7 -8
- package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +4 -4
- package/src/layouts/Screen/TableData.js +6 -13
- package/src/media/file-system/utils/write.js +1 -1
- package/src/screens/Auth/Profile.js +2 -3
- package/src/screens/Auth/SignIn.js +1 -3
- package/src/screens/Help/PrivacyPolicy/index.js +1 -3
- package/src/screens/Help/TermsOfUses/index.js +1 -3
- package/src/screens/ScreenWrapper.js +82 -0
- package/src/screens/index.js +10 -68
- package/src/screens/utils.js +2 -0
- package/webpack.config.js +9 -1
- package/src/components/Datagrid/Table/Cell.js +0 -45
package/metro.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.0",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"@emotion/native": "^11.10.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^2.
|
|
64
|
+
"@fto-consult/common": "^2.2.3",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
67
67
|
"@react-native-community/datetimepicker": "6.5.2",
|
|
68
68
|
"@react-native-community/netinfo": "9.3.5",
|
|
69
|
-
"@react-navigation/native": "^6.
|
|
70
|
-
"@react-navigation/native-stack": "^6.9.
|
|
71
|
-
"@shopify/flash-list": "1.
|
|
69
|
+
"@react-navigation/native": "^6.1.1",
|
|
70
|
+
"@react-navigation/native-stack": "^6.9.7",
|
|
71
|
+
"@shopify/flash-list": "^1.4.0",
|
|
72
72
|
"expo": "^47.0.8",
|
|
73
73
|
"expo-camera": "~13.1.0",
|
|
74
74
|
"expo-clipboard": "~4.0.1",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"file-saver": "^2.0.5",
|
|
83
83
|
"google-libphonenumber": "^3.2.31",
|
|
84
84
|
"htmlparser2-without-node-native": "^3.9.2",
|
|
85
|
-
"mime-types": "^2.1.35",
|
|
86
85
|
"mongo-parse": "^2.1.0",
|
|
87
86
|
"parent-package-json": "^2.0.1",
|
|
88
87
|
"prop-types": "^15.8.1",
|
|
@@ -94,6 +93,7 @@
|
|
|
94
93
|
"react-native-big-list": "^1.6.0",
|
|
95
94
|
"react-native-blob-util": "^0.17.0",
|
|
96
95
|
"react-native-gesture-handler": "~2.8.0",
|
|
96
|
+
"react-native-mime-types": "^2.3.0",
|
|
97
97
|
"react-native-paper": "^4.12.5",
|
|
98
98
|
"react-native-paper-dates": "^0.9.2",
|
|
99
99
|
"react-native-reanimated": "~2.12.0",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"react-native-svg": "13.4.0",
|
|
103
103
|
"react-native-web": "~0.18.7",
|
|
104
104
|
"react-native-webview": "11.23.1",
|
|
105
|
+
"react-virtuoso": "^4.0.3",
|
|
105
106
|
"sharp-cli": "^2.1.0",
|
|
106
107
|
"tippy.js": "^6.3.7",
|
|
107
108
|
"use-event-callback": "^0.1.0",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useRef, useState, useLayoutEffect } from "$react";
|
|
6
|
+
import { Platform, StyleSheet, View} from "react-native";
|
|
7
|
+
import { findDOMNode } from "react-dom";
|
|
8
|
+
import PropTypes from "prop-types";
|
|
9
|
+
import stableHash from "stable-hash";
|
|
10
|
+
import {defaultNumber,isNumber} from "$utils";
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({container: { flex: 1 }});
|
|
13
|
+
|
|
14
|
+
const AutoResizerComponent = React.forwardRef((props,ref) =>{
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
defaultHeight,
|
|
18
|
+
defaultWidth,
|
|
19
|
+
disableHeight,
|
|
20
|
+
disableWidth,
|
|
21
|
+
onResize: _onResize,
|
|
22
|
+
compare,
|
|
23
|
+
...viewProps
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
const innerRef = useRef(null);
|
|
27
|
+
const layoutRef = React.useRef({
|
|
28
|
+
width : defaultNumber(disableWidth ? 0 : defaultWidth),
|
|
29
|
+
height : defaultNumber(disableHeight ? 0 : defaultHeight),
|
|
30
|
+
x : 0,
|
|
31
|
+
y : 0,
|
|
32
|
+
})
|
|
33
|
+
const [result, setResult] = useState(Object.clone(layoutRef.current));
|
|
34
|
+
const canRender = x=>!!(result.width || result.height) && isNumber(result.x) && isNumber(result.y);
|
|
35
|
+
const onResize = useCallback(({ width, height,x,y}) => {
|
|
36
|
+
layoutRef.current.width = disableWidth ? 0 : width || 0;
|
|
37
|
+
layoutRef.current.height = disableHeight ? 0 : height || 0;
|
|
38
|
+
layoutRef.current.x = disableWidth? 0 : x;
|
|
39
|
+
layoutRef.current.y = disableHeight ? 0 : y;
|
|
40
|
+
if (Math.abs(result.width - layoutRef.current.width) <= 50 && Math.abs(result.height-layoutRef.current.height)<=50) return;
|
|
41
|
+
if(typeof compare ==='function' && compare({previous:result,current:layoutRef.current}) === false) return;
|
|
42
|
+
setResult({...layoutRef.current});
|
|
43
|
+
},[stableHash({disableWidth, disableHeight, _onResize, result})]);
|
|
44
|
+
|
|
45
|
+
const onLayout = useCallback(e => {
|
|
46
|
+
const layout = e.nativeEvent.layout;
|
|
47
|
+
const x = defaultNumber(layout.x,layout.left);
|
|
48
|
+
const y = defaultNumber(layout.y,layout.top);
|
|
49
|
+
onResize({width:layout.width,height:layout.height,x,y});
|
|
50
|
+
},[onResize]);
|
|
51
|
+
// Avoid zero/flash on first render, at least on web
|
|
52
|
+
// @see https://github.com/bvaughn/react-virtualized-auto-sizer/blob/ffcba2dd39b89111ed4b42d64431f35ce7c1c23a/src/index.js#L69-L94
|
|
53
|
+
// @see https://github.com/bvaughn/react-virtualized-auto-sizer/issues/10
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
if (Platform.OS !== "web") return;
|
|
56
|
+
const autoSizer = findDOMNode(innerRef.current);
|
|
57
|
+
if (
|
|
58
|
+
autoSizer &&
|
|
59
|
+
autoSizer.parentNode &&
|
|
60
|
+
autoSizer.parentNode.ownerDocument &&
|
|
61
|
+
autoSizer.parentNode.ownerDocument.defaultView &&
|
|
62
|
+
autoSizer.parentNode instanceof
|
|
63
|
+
autoSizer.parentNode.ownerDocument.defaultView.HTMLElement
|
|
64
|
+
) {
|
|
65
|
+
const parentNode = autoSizer.parentNode;
|
|
66
|
+
const height = parentNode.offsetHeight || 0;
|
|
67
|
+
const width = parentNode.offsetWidth || 0;
|
|
68
|
+
const x = parentNode.offsetLeft || 0;
|
|
69
|
+
const y = parentNode.offsetTop || 0;
|
|
70
|
+
if ((width || height) && (x || y)) onResize({ width, height,x,y});
|
|
71
|
+
}
|
|
72
|
+
}, []); // eslint-disable-line
|
|
73
|
+
React.useEffect(()=>{
|
|
74
|
+
if(_onResize){
|
|
75
|
+
_onResize(result);
|
|
76
|
+
}
|
|
77
|
+
},[result])
|
|
78
|
+
return (
|
|
79
|
+
<View
|
|
80
|
+
{...viewProps}
|
|
81
|
+
ref={React.useMergeRefs(innerRef,ref)}
|
|
82
|
+
onLayout={onLayout}
|
|
83
|
+
pointerEvents="box-none"
|
|
84
|
+
style={[styles.container, viewProps.style]}
|
|
85
|
+
>
|
|
86
|
+
{canRender() && children({...result,left:result.x,top:result.y}) || null}
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
AutoResizerComponent.displayName = "AutoResizerComponent";
|
|
92
|
+
|
|
93
|
+
AutoResizerComponent.propTypes = {
|
|
94
|
+
/*** func({width,height})=>PropTypes.node */
|
|
95
|
+
children : PropTypes.func.isRequired,
|
|
96
|
+
defaultHeight : PropTypes.number,
|
|
97
|
+
defaultWidth : PropTypes.number,
|
|
98
|
+
disableHeight : PropTypes.bool,
|
|
99
|
+
disableWidth : PropTypes.bool,
|
|
100
|
+
/***({ width, height }) => void */
|
|
101
|
+
onResize : PropTypes.func,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default AutoResizerComponent;
|
|
@@ -8,7 +8,7 @@ import { methodsNames } from "./utils";
|
|
|
8
8
|
export const ChartComponent = React.forwardRef(({chartContext,testID,chartId,id,webViewProps,options,...props},ref)=>{
|
|
9
9
|
webViewProps = defaultObj(webViewProps);
|
|
10
10
|
const webViewRef = React.useRef(null);
|
|
11
|
-
|
|
11
|
+
chartId = React.useRef(defaultStr(chartId,id,options?.chart?.id,uniqid("chart-webview-id")));
|
|
12
12
|
const jsonOptions = JSON.stringify(options);
|
|
13
13
|
const exec = (method,a)=>{
|
|
14
14
|
if(!webViewRef.current) return;
|
|
@@ -20,7 +20,7 @@ export * from "./utils";
|
|
|
20
20
|
* options {number} - les options supplémentaires au chart
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const ChartComponent = React.forwardRef(({options,style,height,width,chartId:customChartID,testID,webViewProps, ...props },ref)=>{
|
|
23
|
+
const ChartComponent = React.forwardRef(({options,onRender,style,height,width,chartId:customChartID,testID,webViewProps, ...props },ref)=>{
|
|
24
24
|
const chartContext = React.useRef(null);
|
|
25
25
|
options.chart = defaultObj(options.chart);
|
|
26
26
|
const chartIdRef = React.useRef(options.chart.id,customChartID,uniqid("chart-id"));
|
|
@@ -36,6 +36,7 @@ const ChartComponent = React.forwardRef(({options,style,height,width,chartId:cus
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},[stableHash(options)]);
|
|
39
|
+
React.useOnRender(onRender);
|
|
39
40
|
React.useEffect(()=>{
|
|
40
41
|
return ()=>{
|
|
41
42
|
destroyChart(chartContext.current);
|
|
@@ -81,7 +81,6 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
|
|
|
81
81
|
andOperator = {defaultBool(andOperator,filter.andOperator,true)}
|
|
82
82
|
onChange = {(arg)=>{
|
|
83
83
|
if(!arg.action && !arg.operator || !arg.field) return;
|
|
84
|
-
//console.log("calling on change dddd",arg);
|
|
85
84
|
const canHandle = canHandleFilter(arg);
|
|
86
85
|
valuesRefs.current[key] = arg;
|
|
87
86
|
if(filteredRef.current[key] !== canHandle){
|
|
@@ -21,13 +21,12 @@ import BackToTop from "$ecomponents/BackToTop";
|
|
|
21
21
|
import FiltersAccordionComponent from "./Filters";
|
|
22
22
|
import RenderType from "../RenderType";
|
|
23
23
|
import { flatMode} from "$ecomponents/TextField";
|
|
24
|
-
import
|
|
24
|
+
import List from "$ecomponents/Table/List";
|
|
25
25
|
import theme,{Colors} from "$theme";
|
|
26
26
|
import {getRowStyle,styles as rStyles} from "../utils";
|
|
27
27
|
import Avatar from "$ecomponents/Avatar";
|
|
28
28
|
import {defaultObj,isOb,isNonNullString} from "$utils";
|
|
29
29
|
import PropTypes from "prop-types";
|
|
30
|
-
import {isTouchDevice} from "$platform";
|
|
31
30
|
|
|
32
31
|
const DatagridFactory = (Factory)=>{
|
|
33
32
|
Factory = Factory || CommonDatagrid;
|
|
@@ -38,7 +37,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
38
37
|
this.frozenItems = 0;
|
|
39
38
|
this.listRef = React.createRef(null);
|
|
40
39
|
this.state.refreshing = false;
|
|
41
|
-
this.state.isReady = !this.bindResizeEvents();
|
|
40
|
+
//this.state.isReady = !this.bindResizeEvents();
|
|
42
41
|
this.updateLayout = this.updateLayout.bind(this);
|
|
43
42
|
this.backToTopRef = React.createRef(null);
|
|
44
43
|
}
|
|
@@ -223,9 +222,6 @@ const DatagridFactory = (Factory)=>{
|
|
|
223
222
|
bindResizeEvents(){
|
|
224
223
|
return true;
|
|
225
224
|
}
|
|
226
|
-
onResizePage(){
|
|
227
|
-
this.updateLayout();
|
|
228
|
-
}
|
|
229
225
|
getPageSize (){
|
|
230
226
|
return INFINITE_SCROLL_PAGE_SIZE;
|
|
231
227
|
}
|
|
@@ -414,10 +410,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
414
410
|
}
|
|
415
411
|
]
|
|
416
412
|
}
|
|
417
|
-
const
|
|
418
|
-
const {height:winheight,width:winWidth} = Dimensions.get("window");
|
|
419
|
-
const containerHeight = winheight - y;
|
|
420
|
-
this.renderedListHeight = Math.max(300,containerHeight - (this.hasScrollViewParent() ? 50:0));
|
|
413
|
+
const maxHeight = this.getMaxListHeight();
|
|
421
414
|
const isLoading = this.isLoading();
|
|
422
415
|
const _progressBar = this.getProgressBar();
|
|
423
416
|
const pointerEvents = this.getPointerEvents();
|
|
@@ -535,7 +528,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
535
528
|
</ScrollView>
|
|
536
529
|
</View>
|
|
537
530
|
return <View testID={testID+"_Container"} pointerEvents={pointerEvents} style={[styles.container]} collapsable={false}>
|
|
538
|
-
{ <View testID={testID+"_ContentContainer"} style={[
|
|
531
|
+
{ <View testID={testID+"_ContentContainer"} style={[{maxHeight}]}>
|
|
539
532
|
<View testID={testID+"_AccordionHeader"} style={[styles.accordionHeader]} ref={this.layoutRef} onLayout={this.updateLayout.bind(this)}>
|
|
540
533
|
{this.props.showActions !== false ? <DatagridActions
|
|
541
534
|
testID={testID+"_Actions"}
|
|
@@ -570,11 +563,12 @@ const DatagridFactory = (Factory)=>{
|
|
|
570
563
|
</View>
|
|
571
564
|
) : null}
|
|
572
565
|
</View>
|
|
573
|
-
{hasData && !canRenderChart ? <
|
|
566
|
+
{hasData && !canRenderChart ? <List
|
|
574
567
|
estimatedItemSize = {150}
|
|
575
568
|
prepareItems = {false}
|
|
576
569
|
{...rest}
|
|
577
570
|
{...accordionProps}
|
|
571
|
+
onRender = {this.onRender.bind(this)}
|
|
578
572
|
testID = {testID}
|
|
579
573
|
extraData = {this.state.refresh}
|
|
580
574
|
contentInset={{ right: 10, top: 10, left: 10, bottom: 10 }}
|