@fto-consult/expo-ui 1.4.1 → 1.4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
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
|
"@expo/html-elements": "^0.2.0",
|
|
62
62
|
"@expo/metro-config": "^0.4.0",
|
|
63
63
|
"@expo/webpack-config": "^0.17.2",
|
|
64
|
-
"@fto-consult/common": "^1.
|
|
64
|
+
"@fto-consult/common": "^1.7.4",
|
|
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.2.0",
|
package/src/App.js
CHANGED
|
@@ -7,7 +7,7 @@ import Index from './index';
|
|
|
7
7
|
import {Portal } from 'react-native-paper';
|
|
8
8
|
import {PreloaderProvider} from "$epreloader";
|
|
9
9
|
import DropdownAlert from '$ecomponents/Dialog/DropdownAlert';
|
|
10
|
-
import {notificationRef} from "$notify";
|
|
10
|
+
import notify, {notificationRef} from "$notify";
|
|
11
11
|
import BottomSheetProvider from "$ecomponents/BottomSheet/Provider";
|
|
12
12
|
import DialogProvider from "$ecomponents/Dialog/Provider";
|
|
13
13
|
import { DialogProvider as FormDataDialogProvider } from '$eform/FormData';
|
|
@@ -22,6 +22,10 @@ import StatusBar from "$ecomponents/StatusBar";
|
|
|
22
22
|
import SimpleSelect from '$ecomponents/SimpleSelect';
|
|
23
23
|
import {Provider as AlertProvider} from '$ecomponents/Dialog/confirm/Alert';
|
|
24
24
|
import APP from "$app";
|
|
25
|
+
import {isMobileNative} from "$cplatform";
|
|
26
|
+
import {setDeviceNameRef} from "$capp";
|
|
27
|
+
import appConfig from "$capp/config";
|
|
28
|
+
import {showPrompt} from "$components/Dialog/confirm";
|
|
25
29
|
|
|
26
30
|
export default function getIndex(options){
|
|
27
31
|
const {App,onMount,onUnmount,preferences:appPreferences} = defaultObj(options);
|
|
@@ -79,4 +83,32 @@ export default function getIndex(options){
|
|
|
79
83
|
</GestureHandlerRootView>
|
|
80
84
|
);
|
|
81
85
|
}
|
|
82
|
-
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
setDeviceNameRef.current = ()=>{
|
|
89
|
+
return new Promise((resolve,reject)=>{
|
|
90
|
+
showPrompt({
|
|
91
|
+
title : 'ID unique pour l\'appareil',
|
|
92
|
+
maxLength : 30,
|
|
93
|
+
defaultValue : appConfig.getDeviceName(),
|
|
94
|
+
yes : 'Définir',
|
|
95
|
+
placeholder : isMobileNative()? "":'Entrer une valeur unique sans espace SVP',
|
|
96
|
+
no : 'Annuler',
|
|
97
|
+
onSuccess : ({value})=>{
|
|
98
|
+
let message = null;
|
|
99
|
+
if(!value || value.contains(" ")){
|
|
100
|
+
message = "Merci d'entrer une valeur non nulle ne contenant pas d'espace";
|
|
101
|
+
}
|
|
102
|
+
if(value.length > 30){
|
|
103
|
+
message = "la valeur entrée doit avoir au plus 30 caractères";
|
|
104
|
+
}
|
|
105
|
+
if(message){
|
|
106
|
+
notify.error(message);
|
|
107
|
+
return reject({message})
|
|
108
|
+
}
|
|
109
|
+
resolve(value);
|
|
110
|
+
notify.success("la valeur ["+value+"] a été définie comme identifiant unique pour l'application instalée sur cet appareil");
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}
|
|
@@ -101,32 +101,9 @@ export const TextField = TextInput;
|
|
|
101
101
|
|
|
102
102
|
WeightUnit.displayName = "WeightUnitInlineIndicatorComponent";
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
104
|
export const Text = React.forwardRef((props,ref)=>{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
const context = {
|
|
111
|
-
update : (props)=>{
|
|
112
|
-
if(React.isValidElement(props,true)){
|
|
113
|
-
return setState({...state,children:props})
|
|
114
|
-
} else if(isObj(props)){
|
|
115
|
-
return setState({...state,...props})
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
React.useEffect(()=>{
|
|
120
|
-
setState({...state,children:props.children})
|
|
121
|
-
},[props.children]);
|
|
122
|
-
React.setRef(ref,context);
|
|
123
|
-
React.useEffect(()=>{
|
|
124
|
-
return ()=>{
|
|
125
|
-
React.setRef(ref,null);
|
|
126
|
-
}
|
|
127
|
-
},[]);
|
|
128
|
-
return <LabelComponent {...props} {...state} style={[styles.text,props.style,state.style]}/>
|
|
129
|
-
})
|
|
105
|
+
return <LabelComponent.withRef ref={ref} {...props} {...state} style={[styles.text,props.style]}/>
|
|
106
|
+
});
|
|
130
107
|
|
|
131
108
|
export const Label = Text;
|
|
132
109
|
|
|
@@ -101,4 +101,33 @@ LabelComponentExported.propTypes = {
|
|
|
101
101
|
splitText : PropTypes.bool,///si le texte lorsqu'il est long sera splité
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export default LabelComponentExported;
|
|
104
|
+
export default LabelComponentExported;
|
|
105
|
+
|
|
106
|
+
LabelComponentExported.withRef = React.forwardRef((props,ref)=>{
|
|
107
|
+
const [state,setState] = React.useStateIfMounted({
|
|
108
|
+
children : props.children,
|
|
109
|
+
});
|
|
110
|
+
const context = {
|
|
111
|
+
update : (props)=>{
|
|
112
|
+
if(React.isValidElement(props,true)){
|
|
113
|
+
return setState({...state,children:props})
|
|
114
|
+
} else if(isObj(props)){
|
|
115
|
+
return setState({...state,...props})
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
React.useEffect(()=>{
|
|
120
|
+
setState({...state,children:props.children})
|
|
121
|
+
},[props.children]);
|
|
122
|
+
React.setRef(ref,context);
|
|
123
|
+
React.useEffect(()=>{
|
|
124
|
+
return ()=>{
|
|
125
|
+
React.setRef(ref,null);
|
|
126
|
+
}
|
|
127
|
+
},[]);
|
|
128
|
+
return <LabelComponent {...props} {...state} style={[props.style,state.style]}/>
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
LabelComponentExported.withRef.displayName = "LabelComponent.Dynamic";
|
|
132
|
+
|
|
133
|
+
LabelComponentExported.WithRef = LabelComponentExported.withRef;
|
|
@@ -13,9 +13,11 @@ import Icon from "$ecomponents/Icon";
|
|
|
13
13
|
import {navigate} from "$cnavigation";
|
|
14
14
|
import theme from "$theme";
|
|
15
15
|
import {isMobileNative} from "$cplatform";
|
|
16
|
-
|
|
16
|
+
import appConfig from "$capp/config";
|
|
17
17
|
const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>{
|
|
18
18
|
let u = defaultObj(Auth.getLoggedUser());
|
|
19
|
+
const deviceNameRef = React.useRef(null);
|
|
20
|
+
const deviceName = appConfig.deviceName;
|
|
19
21
|
props = defaultObj(props);
|
|
20
22
|
const closeDrawer = cb => {
|
|
21
23
|
if(drawerRef && drawerRef.current && drawerRef.current.close){
|
|
@@ -59,8 +61,16 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
59
61
|
normal
|
|
60
62
|
upperCase = {false}
|
|
61
63
|
disableRipple
|
|
64
|
+
title = {"Pressez longtemps pour définir un identifiant unique pour l'appareil"}
|
|
62
65
|
{...aProps}
|
|
63
66
|
style = {[styles.container]}
|
|
67
|
+
onLongPress = {()=>{
|
|
68
|
+
appConfig.setDeviceName().then((r)=>{
|
|
69
|
+
if(deviceNameRef.current && deviceNameRef.current.update){
|
|
70
|
+
deviceNameRef.current.update(r);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}}
|
|
64
74
|
left={props1 => <Image
|
|
65
75
|
{...props}
|
|
66
76
|
{...props1}
|
|
@@ -98,6 +108,9 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>
|
|
|
98
108
|
<Label splitText style={{fontSize:12,color:theme.colors.secondaryOnSurface,marginTop:6}}>
|
|
99
109
|
{label}
|
|
100
110
|
</Label>
|
|
111
|
+
{deviceName && <Label.withRef textBold splitText title={"Identifiant unique de l'application, installé sur cet appareil"} ref={deviceNameRef} secondary style={{fontSize:11}}>
|
|
112
|
+
[{deviceName}]
|
|
113
|
+
</Label.withRef> || null}
|
|
101
114
|
</View>
|
|
102
115
|
</Button>
|
|
103
116
|
} }
|