@fto-consult/expo-ui 5.11.7 → 5.11.9
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": "5.11.
|
|
3
|
+
"version": "5.11.9",
|
|
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.11.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^3.18.
|
|
64
|
+
"@fto-consult/common": "^3.18.22",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "^1.17.11",
|
|
67
67
|
"@react-native-community/datetimepicker": "^6.7.3",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
///permet de sélectionner un theme utilisateur
|
|
5
5
|
import React from "$react";
|
|
6
6
|
import Label from "$ecomponents/Label";
|
|
7
|
-
import Auth,{login} from "$cauth";
|
|
7
|
+
import Auth,{login,getLoginId} from "$cauth";
|
|
8
8
|
import View from "$ecomponents/View";
|
|
9
9
|
import { StyleSheet } from "react-native";
|
|
10
10
|
import defaultTheme,{getColors} from "$theme/defaultTheme";
|
|
@@ -38,8 +38,10 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
|
38
38
|
props = defaultObj(props);
|
|
39
39
|
let {user,showAdd,onValidate,onChange,onUpsert,...rest} = props;
|
|
40
40
|
const loggedUser = defaultObj(Auth.getLoggedUser());
|
|
41
|
-
user = defaultObj(user,loggedUser);
|
|
42
|
-
const
|
|
41
|
+
user = defaultObj(user,loggedUser);
|
|
42
|
+
const loginId = getLoginId(user);
|
|
43
|
+
const hasLoginId = isNonNullString(loginId) || typeof loginId =='number';
|
|
44
|
+
const isUserActive = getLoginId(loggedUser) == loginId && hasLoginId ? true : false;
|
|
43
45
|
const userTheme = defaultObj(user.theme);
|
|
44
46
|
const userThemeName = defaultStr(userTheme.name,defaultTheme.name);
|
|
45
47
|
const isDark = theme.isDark() || theme.isDarkUI();
|
|
@@ -48,7 +50,7 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
|
48
50
|
const showThemeExplorer = (data)=>{
|
|
49
51
|
data = defaultObj(data,defTheme);
|
|
50
52
|
fields.name.disabled = ({data})=> data && isNonNullString(data.name);
|
|
51
|
-
const title = data && data.name ? ("Modifier ["+data.name+"]") : ('Nouv theme['+
|
|
53
|
+
const title = data && data.name ? ("Modifier ["+data.name+"]") : ('Nouv theme['+loginId+"]");
|
|
52
54
|
const isEditing = isDocEditing(data);
|
|
53
55
|
fields.textFieldMode.defaultValue = theme.textFieldMode;
|
|
54
56
|
fields.profilAvatarPosition.defaultValue = theme.profilAvatarPosition;
|
|
@@ -86,7 +88,7 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
|
86
88
|
user.customThemes = customThemes;
|
|
87
89
|
open((isEditing?"Modification ":"Enregistrement ")+"du thème...");
|
|
88
90
|
Auth.upsertUser(user,false).then(()=>{
|
|
89
|
-
if(Auth.
|
|
91
|
+
if(Auth.getLoginId(Auth.getLoggedUser()) == getLoginId(user)){
|
|
90
92
|
login(user,false);
|
|
91
93
|
}
|
|
92
94
|
if(ref && ref.current && ref.current.refresh){
|
|
@@ -43,6 +43,7 @@ export default function showConfirm (p,cb){
|
|
|
43
43
|
const setArgsValue = (args)=>{
|
|
44
44
|
args.value = inputValueRef.current;
|
|
45
45
|
args.inputRef = inputRef;
|
|
46
|
+
args.close = Alert.close;
|
|
46
47
|
}
|
|
47
48
|
inputValueRef.current = defaultValue;
|
|
48
49
|
if(isDecimal(text)){
|
|
@@ -74,7 +75,6 @@ export default function showConfirm (p,cb){
|
|
|
74
75
|
args = React.getOnPressArgs(args);
|
|
75
76
|
setArgsValue(args);
|
|
76
77
|
if(onCancel(args) === false || (onPress && onPress(args) === false)) return true;
|
|
77
|
-
args.close = Alert.close;
|
|
78
78
|
Alert.close(args);
|
|
79
79
|
}
|
|
80
80
|
buttons.push(no);
|
package/src/index.js
CHANGED
|
@@ -227,8 +227,9 @@ function App({init:initApp,initialRouteName:appInitialRouteName,render,onMount,p
|
|
|
227
227
|
}
|
|
228
228
|
},[isInitialized]);
|
|
229
229
|
const hasGetStarted = state.hasGetStarted !== false? true : false;
|
|
230
|
-
|
|
231
|
-
const [theme,setTheme] = React.useState(updateTheme(defaultTheme));
|
|
230
|
+
const themeRef = React.useRef(null);
|
|
231
|
+
const [theme,setTheme] = React.useState(themeRef.current || updateTheme(defaultTheme));
|
|
232
|
+
themeRef.current = theme;
|
|
232
233
|
const updatePreferenceTheme = (customTheme,persist)=>{
|
|
233
234
|
setTheme(updateTheme(customTheme));
|
|
234
235
|
};
|
|
@@ -136,7 +136,7 @@ const PermProfile = React.forwardRef((props,ref)=>{
|
|
|
136
136
|
profiles.push(<View key={index} style={[theme.styles.row,{justifyContent:'space-between'}]}>
|
|
137
137
|
<Label>{profile.code}</Label>
|
|
138
138
|
<View style={[theme.styles.row]}>
|
|
139
|
-
<Icon primary title={isAssigned?'Profil de permission ['+profile.code+'] assigné à l\'utilisateur':'Profil de permission ['+profile.code+'] non assigné à l\'utilisateur '+
|
|
139
|
+
<Icon primary title={isAssigned?'Profil de permission ['+profile.code+'] assigné à l\'utilisateur':'Profil de permission ['+profile.code+'] non assigné à l\'utilisateur '+String(Auth.getLoginId(user))} name={isAssigned?'checkbox-marked':'checkbox-blank-outline'}
|
|
140
140
|
onPress={()=>{
|
|
141
141
|
assignProfile(profile,isAssigned?false:true)
|
|
142
142
|
}}
|
|
@@ -77,7 +77,7 @@ export default function UserProfileScreen(props){
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return <FormDataScreen
|
|
80
|
-
title = {(user.label?(user.label+" ["+user
|
|
80
|
+
title = {(user.label?(user.label+" ["+Auth.getLoginId(user)+"] | "):"")+"Profil : Modifier"}
|
|
81
81
|
{...props}
|
|
82
82
|
modal
|
|
83
83
|
withScrollView
|