@fto-consult/expo-ui 6.69.1 → 6.70.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/bin/create-app/App.js +2 -2
- package/package.json +1 -1
- package/src/App.js +2 -2
- package/src/AppEntry/index.js +2 -2
- package/src/context/Provider.js +1 -0
- package/src/layouts/Fab/index.js +13 -13
- package/src/layouts/Screen/Screen.js +0 -3
package/bin/create-app/App.js
CHANGED
@@ -55,8 +55,8 @@ export default function AppMainEntry(){
|
|
55
55
|
return Promise.resolve("app is initialized");
|
56
56
|
}}
|
57
57
|
/*** if you need to wrap main application content with some custom react Provider*/
|
58
|
-
|
59
|
-
return
|
58
|
+
children = {function({children,appConfig}){
|
59
|
+
return children;
|
60
60
|
}}
|
61
61
|
///fonction de rappel appelée avant d'exit l'application, doit retourner une promesse que lorsque résolue, exit l'application
|
62
62
|
beforeExit = {()=>Promise.resolve(true)}
|
package/package.json
CHANGED
package/src/App.js
CHANGED
@@ -13,8 +13,8 @@ import App from "./AppEntry";
|
|
13
13
|
* }
|
14
14
|
*/
|
15
15
|
|
16
|
-
export default function ExpoUIAppEntryProvider({
|
16
|
+
export default function ExpoUIAppEntryProvider({children,init,...rest}){
|
17
17
|
return <Provider {...rest}>
|
18
|
-
<App init={init} children={children}
|
18
|
+
<App init={init} children={children}/>
|
19
19
|
</Provider>
|
20
20
|
}
|
package/src/AppEntry/index.js
CHANGED
@@ -62,7 +62,7 @@ const NAVIGATION_PERSISTENCE_KEY = 'NAVIGATION_STATE';
|
|
62
62
|
* initialRouteName : la route initiale par défaut
|
63
63
|
* getStartedRouteName : la route par défaut de getStarted lorsque l'application est en mode getStarted, c'est à dire lorsque la fonction init renvoie une erreur (reject)
|
64
64
|
*/
|
65
|
-
function App({init:initApp,initialRouteName:appInitialRouteName,
|
65
|
+
function App({init:initApp,initialRouteName:appInitialRouteName,children}) {
|
66
66
|
AppStateService.init();
|
67
67
|
const {FontsIconsFilter,beforeExit,preferences:appPreferences,navigation,getStartedRouteName} = useContext();
|
68
68
|
const {containerProps} = navigation;
|
@@ -289,7 +289,7 @@ function App({init:initApp,initialRouteName:appInitialRouteName,render}) {
|
|
289
289
|
}}
|
290
290
|
/>
|
291
291
|
</NavigationContainer> : null;
|
292
|
-
const content = isLoaded ? typeof
|
292
|
+
const content = isLoaded ? typeof children == 'function'? children({children:child,appConfig,config:appConfig}) : child : null;
|
293
293
|
return <SafeAreaProvider>
|
294
294
|
<GestureHandlerRootView testID={"RN_MainAppGestureHanleRootView"} style={styles.gesture}>
|
295
295
|
<AppEntryRootView>
|
package/src/context/Provider.js
CHANGED
@@ -57,6 +57,7 @@ Object.map(Utils,(v,i)=>{
|
|
57
57
|
},
|
58
58
|
customFormFields{Object}, //les composant personalisés des forms fields
|
59
59
|
tableLinkPropsMutator : ({object})=><{object}>, la fonction permettant de muter les props du composant TableLink,
|
60
|
+
fabPropsMutator : ({object})=><{object}>, la fonction permettant de muter les props du composant Fab, affiché dans les écrans par défaut,
|
60
61
|
TableDataScreen | TableDataScreenItem : {ReactComponent}, le composant TableDataScreenItem, à utiliser pour le rendu des écrans
|
61
62
|
TableDataScreenList | TableDataListScreen {ReactComponent}, le composant TableDataList à utiliser pour le rendu des écrans listants les éléments du table data
|
62
63
|
},
|
package/src/layouts/Fab/index.js
CHANGED
@@ -7,26 +7,28 @@ import {navigateToTableData} from "$enavigation/utils";
|
|
7
7
|
import PropTypes from "prop-types";
|
8
8
|
import theme from "$theme";
|
9
9
|
import {isLoggedIn as isAuthLoggedIn} from "$cauth/utils/session";
|
10
|
+
import useExpoUI from "$econtext/hooks";
|
11
|
+
import Auth from "$cauth";
|
10
12
|
|
11
13
|
export * from "./utils";
|
12
14
|
|
13
|
-
const FabLayoutComponent = React.forwardRef((
|
15
|
+
const FabLayoutComponent = React.forwardRef((p,ref)=>{
|
16
|
+
const {components:{fabPropsMutator},tablesData} = useExpoUI();
|
17
|
+
const {style,actions:fabActions,...props} = typeof fabPropsMutator == 'function'? extendObj({},p,fabPropsMutator({...p,isLoggedIn})) : p;
|
14
18
|
const [isLoggedIn,setIsLoggedIn] = React.useState(isAuthLoggedIn());
|
15
19
|
const isMounted = React.useIsMounted();
|
20
|
+
const tables = isObjOrArray(fabActions)? fabActions : tablesData;
|
16
21
|
const actions = React.useMemo(()=>{
|
22
|
+
if(Array.isArray(fabActions)) return fabActions;
|
17
23
|
if(!isLoggedIn) return null;
|
18
24
|
const a = [];
|
19
25
|
Object.map(tables,(table,i,index)=>{
|
20
|
-
if(!isObj(table) || table.showInFab === false) return;
|
26
|
+
if(!isObj(table) || table.showInFab === false || typeof table.showInFab =="function" && table.showInFab() === false) return;
|
21
27
|
const icon = defaultStr(table.addIcon,"material-add");
|
22
28
|
const text = defaultStr(table.text,table.label);
|
23
29
|
const addText = defaultStr(table.newElementLabel,"Nouveau");
|
24
30
|
const tableName = defaultStr(table.table,table.tableName);
|
25
|
-
|
26
|
-
if(typeof Auth !=='undefined' && Auth && Auth.isTableDataAllowed){
|
27
|
-
auth = Auth.isTableDataAllowed({table:tableName,action:'create'});
|
28
|
-
}
|
29
|
-
if(!table || !icon || !text || !auth) return;
|
31
|
+
if(!table || !icon || !text || !Auth.isTableDataAllowed({table:tableName,action:'create'})) return;
|
30
32
|
let fabProps = typeof table.getFabProps ==='function'? table.getFabProps({tableName}) : defaultObj(table.fabProps);;
|
31
33
|
if(fabProps === false) return;
|
32
34
|
fabProps = defaultObj(fabProps);
|
@@ -48,7 +50,8 @@ const FabLayoutComponent = React.forwardRef(({style,screenName,tables,...props},
|
|
48
50
|
})
|
49
51
|
})
|
50
52
|
return a.length ? a : null;
|
51
|
-
},[isLoggedIn]);
|
53
|
+
},[isLoggedIn,fabActions,tables]);
|
54
|
+
|
52
55
|
React.useEffect(()=>{
|
53
56
|
const onLogin = ()=>{
|
54
57
|
if(!isMounted())return;
|
@@ -66,7 +69,6 @@ const FabLayoutComponent = React.forwardRef(({style,screenName,tables,...props},
|
|
66
69
|
},[])
|
67
70
|
return actions ? <Fab.Group
|
68
71
|
{...props}
|
69
|
-
screenName = {screenName}
|
70
72
|
ref = {ref}
|
71
73
|
style={[styles.fab,style]}
|
72
74
|
actions = {actions}
|
@@ -86,9 +88,7 @@ const styles = StyleSheet.create({
|
|
86
88
|
FabLayoutComponent.displayName = "FabLayoutComponent";
|
87
89
|
|
88
90
|
FabLayoutComponent.propTypes = {
|
89
|
-
|
90
|
-
|
91
|
-
PropTypes.arrayOf(PropTypes.object)
|
92
|
-
]),
|
91
|
+
...Fab.propTypes,
|
92
|
+
actions : PropTypes.array, //les actions du fab layout
|
93
93
|
screenName : PropTypes.string,
|
94
94
|
}
|
@@ -19,9 +19,6 @@ export default function MainScreenComponent({profilAvatarProps,withDrawer,allowD
|
|
19
19
|
withDrawer = false;
|
20
20
|
}
|
21
21
|
const withProfilAvatarOnAppBar = cWithPorilAvatarOnAppbar !== false && withDrawer && !theme.showProfilAvatarOnDrawer ? true : false;
|
22
|
-
if(authRequired === false){
|
23
|
-
props.withFab = false;
|
24
|
-
}
|
25
22
|
return <Container authProps={authProps} required={authRequired}>
|
26
23
|
<ScreenWithoutAuthContainer
|
27
24
|
{...props}
|