@fto-consult/expo-ui 5.11.18 → 5.11.20
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/App.js +13 -3
- package/src/screens/Auth/PermLine.js +2 -1
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.20",
|
|
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.30",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@pchmn/expo-material3-theme": "^1.0.1",
|
|
67
67
|
"@react-native-async-storage/async-storage": "^1.17.11",
|
package/src/App.js
CHANGED
|
@@ -18,11 +18,10 @@ import { timeout as SWR_REFRESH_TIMEOUT} from '$ecomponents/Datagrid/SWRDatagrid
|
|
|
18
18
|
import { Dimensions,Keyboard } from 'react-native';
|
|
19
19
|
import {isTouchDevice} from "$platform";
|
|
20
20
|
import * as Utils from "$cutils";
|
|
21
|
-
import {extendObj} from "$utils";
|
|
22
|
-
import {fontConfig} from "$theme/fonts";
|
|
23
21
|
import {MD3LightTheme,MD3DarkTheme} from "react-native-paper";
|
|
24
22
|
import { useMaterial3Theme } from '@pchmn/expo-material3-theme';
|
|
25
23
|
import { useColorScheme } from 'react-native';
|
|
24
|
+
import {colorsAlias,Colors} from "$theme";
|
|
26
25
|
|
|
27
26
|
import { configureFonts} from 'react-native-paper';
|
|
28
27
|
Object.map(Utils,(v,i)=>{
|
|
@@ -30,10 +29,11 @@ Object.map(Utils,(v,i)=>{
|
|
|
30
29
|
window[i] = v;
|
|
31
30
|
}
|
|
32
31
|
});
|
|
32
|
+
const themeAttributes = ["primary","secondary","background",""]
|
|
33
33
|
export default function getIndex({onMount,onUnmount,swrConfig,onRender,...rest}){
|
|
34
34
|
const {extendAppTheme} = appConfig;
|
|
35
35
|
const { theme : pTheme } = useMaterial3Theme();
|
|
36
|
-
const colorScheme = useColorScheme();
|
|
36
|
+
//const colorScheme = useColorScheme();
|
|
37
37
|
appConfig.extendAppTheme = (theme)=>{
|
|
38
38
|
if(!isObj(theme)) return;
|
|
39
39
|
const newTheme = theme.dark || theme.isDark ? { ...MD3DarkTheme, colors: pTheme.dark } : { ...MD3LightTheme, colors: pTheme.light };
|
|
@@ -43,6 +43,16 @@ export default function getIndex({onMount,onUnmount,swrConfig,onRender,...rest})
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
if(isObj(theme.colors)){
|
|
46
|
+
colorsAlias.map((color)=>{
|
|
47
|
+
color = color.trim();
|
|
48
|
+
const cUpper = color.ucFirst();
|
|
49
|
+
//math theme colors to material desgin V3
|
|
50
|
+
const textA = `${color}Text`,onColor=`on${cUpper}`//,containerA = `${color}Container`,onColorContainer=`on${cUpper}Container`;
|
|
51
|
+
const c = Colors.isValid(theme.colors[onColor])? theme.colors[onColor] : (theme.colors[textA]) || undefined;
|
|
52
|
+
if(c){
|
|
53
|
+
theme.colors[onColor] = c;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
46
56
|
for(let i in newTheme.colors){
|
|
47
57
|
if(!(i in theme.colors)){
|
|
48
58
|
theme.colors[i] = newTheme.colors[i];
|
|
@@ -7,6 +7,7 @@ import {hasResource} from "./utils";
|
|
|
7
7
|
import { StyleSheet } from "react-native";
|
|
8
8
|
import View from "$ecomponents/View";
|
|
9
9
|
import {Cell} from "$ecomponents/Grid";
|
|
10
|
+
import theme from "$theme";
|
|
10
11
|
|
|
11
12
|
const PermLine = ({text,cellProps,isUserMasterAdmin,withGrid,defaultActions,resource,perms:cPerms,disabled,allPerms,table,index,onChange,keyname,actions,testID,...rest})=>{
|
|
12
13
|
const [state,setState] = React.useState({
|
|
@@ -134,7 +135,7 @@ const PermLine = ({text,cellProps,isUserMasterAdmin,withGrid,defaultActions,reso
|
|
|
134
135
|
pContent.push(<PermText labelStyle ={hasS? styles.permChildren : undefined} isUserMasterAdmin={isUserMasterAdmin} key={j} table={table} onToggle={onToggleSingle} tooltip={defaultStr(p.tooltip,p.title,p.desc)} text = {p.text} checked ={checked} actions={perm.actions} resource={i} action ={j}/>)
|
|
135
136
|
});
|
|
136
137
|
if(pContent.length){
|
|
137
|
-
content.push(<View key={i} testID={testID+"_Content_"+i}>
|
|
138
|
+
content.push(<View key={i} style={{backgroundColor:theme.colors.surface}} testID={testID+"_Content_"+i}>
|
|
138
139
|
{hasS ? <Label testID={testID+'_Label'}>{pText}</Label> : null}
|
|
139
140
|
{pContent}
|
|
140
141
|
</View>)
|