@fto-consult/expo-ui 2.43.3 → 2.45.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 +2 -2
- package/src/components/ContentLoader/index.js +1 -1
- package/src/components/Datagrid/Common/Common.js +1 -2
- package/src/components/Dialog/DropdownAlert/index.js +7 -2
- package/src/components/Drawer/NavigationView.js +13 -8
- package/src/components/Drawer/index.js +4 -6
- package/src/components/Expandable/index.js +2 -2
- package/src/components/ScrollView/index.js +3 -2
- package/src/components/SimpleSelect/index.js +2 -4
- package/src/components/Tab/TabItems.js +31 -27
- package/src/components/Table/index.js +2 -4
- package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +1 -2
- package/src/layouts/Screen/TableData.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
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.6.0",
|
|
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",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**** see : https://github.com/danilowoz/react-content-loader */
|
|
2
2
|
import {defaultObj} from "$utils";
|
|
3
3
|
import View from "$ecomponents/View";
|
|
4
|
-
import {StyleSheet,Dimensions
|
|
4
|
+
import {StyleSheet,Dimensions} from "react-native";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import ContentLoaderF, {Facebook as CLFacebook,Instagram as CLInstagram} from './Loader';
|
|
7
7
|
import PropTypes from "prop-types";
|
|
@@ -26,7 +26,6 @@ import { evalSingleValue,Footer,getFooterColumnValue,isValidAggregator,extendAgg
|
|
|
26
26
|
import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$makePhoneCall";
|
|
27
27
|
import copyToClipboard from "$capp/clipboard";
|
|
28
28
|
import { Pressable } from "react-native";
|
|
29
|
-
import stableHash from "stable-hash";
|
|
30
29
|
import DatagridProgressBar from "$ecomponents/Table/ProgressBar";
|
|
31
30
|
import View from "$ecomponents/View";
|
|
32
31
|
import {Menu} from "$ecomponents/BottomSheet";
|
|
@@ -3383,7 +3382,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
3383
3382
|
return false;
|
|
3384
3383
|
}
|
|
3385
3384
|
UNSAFE_componentWillReceiveProps(nextProps){
|
|
3386
|
-
if((
|
|
3385
|
+
if(React.areEquals(nextProps.data,(this.props.data))) {
|
|
3387
3386
|
return false;
|
|
3388
3387
|
}
|
|
3389
3388
|
this.setIsLoading(true,true);
|
|
@@ -344,7 +344,12 @@ export default class DropdownAlert extends Component {
|
|
|
344
344
|
return this.queue.size;
|
|
345
345
|
};
|
|
346
346
|
_processQueue = () => {
|
|
347
|
-
|
|
347
|
+
let data = this.queue.firstItem;
|
|
348
|
+
console.log("will open ",data,this.alertData);
|
|
349
|
+
if(data && React.areEquals(data,this.alertData)){
|
|
350
|
+
this.queue.dequeue();
|
|
351
|
+
this._processQueue();
|
|
352
|
+
}
|
|
348
353
|
if (data) {
|
|
349
354
|
this.open(data);
|
|
350
355
|
}
|
|
@@ -352,7 +357,7 @@ export default class DropdownAlert extends Component {
|
|
|
352
357
|
open = (data = {}) => {
|
|
353
358
|
this.alertData = data;
|
|
354
359
|
const position = data.top || this.isKeyboardOpen() ? "top" : data.position;
|
|
355
|
-
this.setState({isOpen: true,
|
|
360
|
+
this.setState({isOpen: true,position},()=>{
|
|
356
361
|
this.animate(1, 450, () => {
|
|
357
362
|
if (data.interval > 0) {
|
|
358
363
|
this.closeAutomatic(data.interval);
|
|
@@ -35,19 +35,24 @@ const DrawerNavigationViewComponent = React.forwardRef((props,ref)=>{
|
|
|
35
35
|
style = {flattenStyle([{margin:0,marginHorizontal:0},toggleIconProps.style])}
|
|
36
36
|
onPress = {(e)=>{
|
|
37
37
|
///si le drawer n'est pas visible alors on le rend visible
|
|
38
|
-
if(
|
|
39
|
-
|
|
38
|
+
if(typeof context.toggle === 'function'){
|
|
39
|
+
if(!isPermanent || !drawerRef.current.isOpen()){
|
|
40
|
+
return context.toggle();
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
if(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
if(typeof context.toggleMinimized ==='function'){
|
|
45
|
+
/*** si le drawer est minimisé */
|
|
46
|
+
if(isMinimized){
|
|
47
|
+
context.toggleMinimized(false);//on passe au mode non minimisé
|
|
48
|
+
} else if(minimizable !== false) {
|
|
49
|
+
return context.toggleMinimized(!isMinimized,{permanent:true});
|
|
50
|
+
}
|
|
46
51
|
}
|
|
47
52
|
}}
|
|
48
53
|
onLongPress = {(e)=>{
|
|
49
54
|
React.stopEventPropagation(e);
|
|
50
|
-
if(isMinimized || !canBeMinimizedOrPermanent()){
|
|
55
|
+
if(isMinimized || (!canBeMinimizedOrPermanent() && !isPermanent)){
|
|
51
56
|
///le long press n'a pas d'effet sur le drawer quand il est minimié
|
|
52
57
|
return;
|
|
53
58
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {StyleSheet,
|
|
1
|
+
import {StyleSheet,Dimensions} from 'react-native';
|
|
2
2
|
import DrawerLayout from './DrawerLayout';
|
|
3
3
|
import {isIos} from "$cplatform";
|
|
4
4
|
import React from "$react";
|
|
@@ -6,14 +6,12 @@ import PropTypes from "prop-types";
|
|
|
6
6
|
import {defaultObj,isObj,isNonNullString} from "$utils";
|
|
7
7
|
import theme,{Colors,flattenStyle} from "$theme";
|
|
8
8
|
import DrawerItems from './DrawerItems';
|
|
9
|
-
import {isDesktopMedia} from "$cplatform/dimensions";
|
|
10
|
-
import {isMobileNative} from "$cplatform";
|
|
9
|
+
import {isDesktopMedia,getCurrentMedia} from "$cplatform/dimensions";
|
|
11
10
|
import {open,close} from "$epreloader";
|
|
12
11
|
import {DRAWER_POSITIONS,DRAWER_TYPES,MINIMIZED_WIDTH,getDrawerWidth,MINIMIZED_ICON_SIZE,ICON_SIZE} from './utils';
|
|
13
12
|
import Icon,{MENU_ICON} from "$ecomponents/Icon";
|
|
14
13
|
import apiSession from "./session";
|
|
15
14
|
import View from "$ecomponents/View";
|
|
16
|
-
import Dimensions from "$cdimensions";
|
|
17
15
|
import {closeDrawer} from './DrawerItems/utils';
|
|
18
16
|
import {DrawerContext} from "./Provider";
|
|
19
17
|
import NavigationView from "./NavigationView";
|
|
@@ -36,9 +34,9 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
36
34
|
onDrawerOpen,onDrawerClose,onDrawerToggle,header,headerProps,toggleIconProps,
|
|
37
35
|
permanentToggleIcon,minimizedToggleIcon,temporaryToggleIcon,withMinimizedIcon,
|
|
38
36
|
isItemActive,onPageResize,navigationViewRef,
|
|
39
|
-
children,
|
|
37
|
+
children,
|
|
38
|
+
drawerType} = props;
|
|
40
39
|
sessionName = defaultStr(sessionName);
|
|
41
|
-
useWindowDimensions();
|
|
42
40
|
const sessionRef = React.useRef({});
|
|
43
41
|
const session = React.useMemo(()=>{
|
|
44
42
|
if(sessionName){
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Colors} from "$theme";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import View from "$ecomponents/View";
|
|
4
|
-
import {StyleSheet,TouchableWithoutFeedback
|
|
5
|
-
import
|
|
4
|
+
import {StyleSheet,TouchableWithoutFeedback} from 'react-native';
|
|
5
|
+
import ScrollView from "$ecomponents/ScrollView";
|
|
6
6
|
import Label from "$ecomponents/Label";
|
|
7
7
|
import Icon from "$ecomponents/Icon"
|
|
8
8
|
import {defaultObj,isNonNullString,defaultStr} from "$utils";
|
|
@@ -5,19 +5,20 @@ import View from "$ecomponents/View";
|
|
|
5
5
|
import theme from "$theme";
|
|
6
6
|
import {defaultStr,defaultObj} from "$utils";
|
|
7
7
|
import APP from "$capp/instance";
|
|
8
|
-
const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containerProps,mediaQueryUpdateNativeProps,testID:customTestID,children,screenIndent:sIndent,...rest},ref) => {
|
|
8
|
+
const ScrollViewComponent = React.forwardRef(({virtualized,contentProps,containerProps,mediaQueryUpdateNativeProps,testID:customTestID,children:cChildren,screenIndent:sIndent,...rest},ref) => {
|
|
9
9
|
const isKeyboardOpenRef = React.useRef(false);
|
|
10
10
|
const testID = defaultStr(customTestID,'RN_ScrollViewComponent');
|
|
11
11
|
containerProps = defaultObj(containerProps)
|
|
12
12
|
const [layout,setLayout] = React.useState(Dimensions.get("window"));
|
|
13
13
|
const {height} = layout;
|
|
14
|
+
const children = React.useStableMemo(()=>cChildren,[cChildren]);
|
|
14
15
|
React.useEffect(()=>{
|
|
15
16
|
const onKeyboardToggle = ({visible})=>{
|
|
16
17
|
isKeyboardOpenRef.current = visible;
|
|
17
18
|
};
|
|
18
19
|
const onResizePage = ()=>{
|
|
19
20
|
setTimeout(()=>{
|
|
20
|
-
|
|
21
|
+
if(isKeyboardOpenRef.current) return;
|
|
21
22
|
setLayout(Dimensions.get("window"))
|
|
22
23
|
},300);
|
|
23
24
|
}
|
|
@@ -14,7 +14,6 @@ import Icon from "$ecomponents/Icon";
|
|
|
14
14
|
import {isDesktopMedia} from "$cplatform/dimensions";
|
|
15
15
|
import { matchOperators,getSearchTimeout,canAutoFocusSearchField} from "$ecomponents/Dropdown/utils";
|
|
16
16
|
import Dialog from "$ecomponents/Dialog";
|
|
17
|
-
import stableHash from "stable-hash";
|
|
18
17
|
|
|
19
18
|
const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
20
19
|
let {style : customStyle,onMount,mode,showSearch,anchorContainerProps,renderText,contentContainerProps,withCheckedIcon,testID,selectionColor,dialogProps,onShow,anchor,onUnmont,controlled,onDismiss,visible:controlledVisible,selectedColor,inputProps,itemProps,itemContainerProps,label,listProps,editable,readOnly,text,filter,renderItem,itemValue,getItemValue,defaultValue,items:menuItems,onPress,onChange,disabled,...rest} = props;
|
|
@@ -53,8 +52,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
53
52
|
renderText = typeof renderText ==='function'? renderText : ({item,content,index})=>{
|
|
54
53
|
return React.getTextContent(content);
|
|
55
54
|
}
|
|
56
|
-
const
|
|
57
|
-
const items = React.useMemo(()=>{
|
|
55
|
+
const items = React.useStableMemo(()=>{
|
|
58
56
|
const items = [];
|
|
59
57
|
selectedRef.current = null;
|
|
60
58
|
//let currentSelectedValue = value;
|
|
@@ -92,7 +90,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
92
90
|
});
|
|
93
91
|
return items;
|
|
94
92
|
//return ({...state,value:currentSelectedValue,items});
|
|
95
|
-
},[
|
|
93
|
+
},[menuItems])
|
|
96
94
|
React.useEffect(()=>{
|
|
97
95
|
if(compare(defaultValue == value)) return;
|
|
98
96
|
selectValue(defaultValue);
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
StyleSheet,
|
|
6
6
|
Platform,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
import ScrollView from "$ecomponents/ScrollView";
|
|
9
8
|
import PropTypes from "prop-types";
|
|
10
9
|
import theme,{StylePropTypes,Colors} from "$theme";
|
|
11
10
|
import {isMobileNative,isMobileBrowser} from "$cplatform"
|
|
12
11
|
import {defaultStr} from "$utils";
|
|
13
12
|
import {Elevations} from "$ecomponents/Surface";
|
|
14
|
-
|
|
13
|
+
import stableHash from "stable-hash";
|
|
14
|
+
import ScrollView from '$ecomponents/ScrollView';
|
|
15
15
|
const showScrollBarIndicator = !isMobileBrowser() && !isMobileNative();
|
|
16
16
|
|
|
17
17
|
import TabItem from "./TabItem";
|
|
@@ -96,6 +96,33 @@ const TabItemsComponent = ({
|
|
|
96
96
|
indicatorStyle.left = getLeftPosition();
|
|
97
97
|
testID = defaultStr(testID,"RNE_TabComponent");
|
|
98
98
|
scrollViewProps = defaultObj(scrollViewProps)
|
|
99
|
+
const childrenContent = React.useMemo(()=>{
|
|
100
|
+
return React.Children.map(children, (child, index) => {
|
|
101
|
+
const active = index === activeIndex?true : false;
|
|
102
|
+
return React.cloneElement(
|
|
103
|
+
child,
|
|
104
|
+
{
|
|
105
|
+
onPress: () => {
|
|
106
|
+
onChange(index);
|
|
107
|
+
},
|
|
108
|
+
onLayout: (event) => {
|
|
109
|
+
const { width } = event.nativeEvent.layout;
|
|
110
|
+
const previousItemPosition =
|
|
111
|
+
tabItemsPosition.current[index - 1]?.position || 0;
|
|
112
|
+
|
|
113
|
+
tabItemsPosition.current[index] = {
|
|
114
|
+
position: previousItemPosition + width,
|
|
115
|
+
width,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
activeIndex,
|
|
119
|
+
index,
|
|
120
|
+
active,
|
|
121
|
+
testID : testID+'_Children_'+index
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
})
|
|
125
|
+
},[stableHash({children,activeIndex})])
|
|
99
126
|
return (<View
|
|
100
127
|
{...rest}
|
|
101
128
|
testID = {testID}
|
|
@@ -119,32 +146,9 @@ const TabItemsComponent = ({
|
|
|
119
146
|
ref={scrollViewRef}
|
|
120
147
|
testID={testID+"_ScrollView"}
|
|
121
148
|
onScroll={onScrollHandler}
|
|
149
|
+
disableIndicator
|
|
122
150
|
>
|
|
123
|
-
{
|
|
124
|
-
const active = index === activeIndex?true : false;
|
|
125
|
-
return React.cloneElement(
|
|
126
|
-
child,
|
|
127
|
-
{
|
|
128
|
-
onPress: () => {
|
|
129
|
-
onChange(index);
|
|
130
|
-
},
|
|
131
|
-
onLayout: (event) => {
|
|
132
|
-
const { width } = event.nativeEvent.layout;
|
|
133
|
-
const previousItemPosition =
|
|
134
|
-
tabItemsPosition.current[index - 1]?.position || 0;
|
|
135
|
-
|
|
136
|
-
tabItemsPosition.current[index] = {
|
|
137
|
-
position: previousItemPosition + width,
|
|
138
|
-
width,
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
activeIndex,
|
|
142
|
-
index,
|
|
143
|
-
active,
|
|
144
|
-
testID : testID+'_Children_'+index
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
})}
|
|
151
|
+
{childrenContent}
|
|
148
152
|
{!disableIndicator && (
|
|
149
153
|
<Animated.View
|
|
150
154
|
{...indicatorProps}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {FlashList,BigList,FlatList} from "$ecomponents/List";
|
|
2
1
|
import View from "$ecomponents/View";
|
|
3
2
|
import {defaultObj,defaultStr,debounce,defaultNumber,defaultVal} from "$utils";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
export const DEFAULT_COLUMN_WIDTH = 60;
|
|
6
5
|
import React from "$react";
|
|
7
6
|
import Label from "$ecomponents/Label";
|
|
8
|
-
import { StyleSheet,View as RNView,ScrollView,
|
|
7
|
+
import { StyleSheet,View as RNView,ScrollView,Dimensions} from "react-native";
|
|
9
8
|
import { getRowStyle } from "$ecomponents/Datagrid/utils";
|
|
10
9
|
import {isMobileNative} from "$cplatform";
|
|
11
10
|
import theme from "$theme";
|
|
@@ -13,7 +12,6 @@ import AbsoluteScrollView from "./AbsoluteScrollView";
|
|
|
13
12
|
import Cell from "./Cell";
|
|
14
13
|
import Row from "./Row";
|
|
15
14
|
import List from "./List";
|
|
16
|
-
import ProgressBar from "./ProgressBar";
|
|
17
15
|
const isSCrollingRef = React.createRef();
|
|
18
16
|
const scrollLists = (opts,refs)=>{
|
|
19
17
|
refs.map((ref)=>{
|
|
@@ -60,7 +58,7 @@ const TableComponent = React.forwardRef(({containerProps,sortedColumn,listContai
|
|
|
60
58
|
const hasEmptyData = emptyData && React.isValidElement(emptyData);
|
|
61
59
|
const layoutRef = React.useRef({});
|
|
62
60
|
React.useOnRender(onRender);
|
|
63
|
-
const preparedColumns = React.
|
|
61
|
+
const preparedColumns = React.useStableMemo(()=>{
|
|
64
62
|
const cols = {},headers = {},footers = {},filters = {},vColumnsMapping = [],visibleColumns = [],columnsNames = [];
|
|
65
63
|
let hasFooters = false;
|
|
66
64
|
columnProps = defaultObj(columnProps);
|
|
@@ -12,8 +12,7 @@ import ErrorBoundary from "$ecomponents/ErrorBoundary";
|
|
|
12
12
|
import Portal from "$ecomponents/Portal";
|
|
13
13
|
import theme,{StyleProp} from "$theme";
|
|
14
14
|
import StatusBar from "$ecomponents/StatusBar";
|
|
15
|
-
import
|
|
16
|
-
|
|
15
|
+
import ScrollView from "$ecomponents/ScrollView";
|
|
17
16
|
const getDefaultTitle = (nTitle,returnStr)=>{
|
|
18
17
|
let titleStr = React.getTextContent(nTitle);
|
|
19
18
|
if(!titleStr){
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {defaultStr,isNumber,isPromise,defaultVal,extendObj,defaultObj,uniqid,isObj,isObjOrArray} from "$utils";
|
|
2
|
-
import stableHash from "stable-hash";
|
|
3
2
|
import {FormData} from "$ecomponents/Form";
|
|
4
3
|
import FormDataScreen from "./FormData";
|
|
5
4
|
import ScreenContainer from "./Screen";
|
|
@@ -418,7 +417,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
418
417
|
mainContent = ct;
|
|
419
418
|
} else {
|
|
420
419
|
mainContent = <View {...contentProps} testID={testID+"_ContentContainer"} style={[styles.container,styles.noPadding]}>
|
|
421
|
-
<ScrollView
|
|
420
|
+
<ScrollView testID={testID+"_MainContentScrollView"} contentProps={{style:theme.styles.p1}}>
|
|
422
421
|
<Surface elevation={elevation} testID={testID+"_ContentHeader"} style={[styles.screenContent,theme.styles.p1,header?styles.screenContentWithHeader:null]}>
|
|
423
422
|
{header}
|
|
424
423
|
{content}
|
|
@@ -431,7 +430,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
431
430
|
}
|
|
432
431
|
} else {
|
|
433
432
|
mainContent = <Surface {...contentProps} testID={testID+"_MainContentContainer"} elevation={elevation} style={[styles.container,styles.noPadding,{paddingTop:0,marginTop:0}]}>
|
|
434
|
-
<ScrollView
|
|
433
|
+
<ScrollView testID={testID+"_MainContentScrollViewWithoutTab"}>
|
|
435
434
|
<View testID={testID+"_MainContent"} style={[styles.screenContent,!isMobOrTab && theme.styles.p1,header?styles.screenContentWithHeader:null]}>
|
|
436
435
|
{header}
|
|
437
436
|
{content}
|
|
@@ -567,7 +566,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
567
566
|
}
|
|
568
567
|
UNSAFE_componentWillReceiveProps(nextProps){
|
|
569
568
|
const {data,datas}= nextProps;
|
|
570
|
-
if(
|
|
569
|
+
if(!React.areEquals({data,datas},{data:this.state.data,datas:this.state.datas})){
|
|
571
570
|
this.setState(this.prepareStateData(nextProps));
|
|
572
571
|
}
|
|
573
572
|
return;
|