@fto-consult/expo-ui 6.88.1 → 6.89.1

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": "6.88.1",
3
+ "version": "6.89.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -14,7 +14,7 @@ import KeyboardAvoidingView from "$ecomponents/KeyboardAvoidingView";
14
14
  import {Elevations} from "$ecomponents/Surface";
15
15
  import {defaultStr} from "$cutils";
16
16
  import View from "$ecomponents/View";
17
- import Portal from "$ecomponents/Portal";
17
+ import {Portal} from "react-native-paper";
18
18
  import { ScrollView } from "react-native";
19
19
  import BackHandler from "$ecomponents/BackHandler";
20
20
  import Reanimated, { useSharedValue,withTiming,useAnimatedStyle} from 'react-native-reanimated';
@@ -26,8 +26,7 @@ import PropTypes from "prop-types";
26
26
  import {Menu} from "$ecomponents/BottomSheet";
27
27
  import session from "$session";
28
28
  import { SWR_REFRESH_TIMEOUT } from "$econtext/utils";
29
- import useContext from "$econtext/hooks";
30
- import notify from "$cnotify";
29
+ import useContext,{useScreen} from "$econtext/hooks";
31
30
 
32
31
  export const getSessionKey = ()=>{
33
32
  return Auth.getSessionKey("swrDatagrid");
@@ -105,6 +104,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
105
104
  ...rest
106
105
  } = props;
107
106
  const {swrConfig} = useContext();
107
+ const screenContext = useScreen();
108
108
  rest = defaultObj(rest);
109
109
  rest.exportTableProps = defaultObj(rest.exportTableProps)
110
110
  const firstPage = 1;
@@ -305,6 +305,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
305
305
  accordionProps = {table?.accordionProps}
306
306
  {...defaultObj(table?.datagrid)}
307
307
  {...rest}
308
+ renderProgressBar = {screenContext && screenContext?.isFocused() === false?false : rest.renderProgressBar || table?.datagrid?.renderProgressBar}
308
309
  fetchOptions = {customFetchOptions}
309
310
  title = {customTitle || title || undefined}
310
311
  sort = {sort}
@@ -1,10 +1,8 @@
1
1
  import React, {Component} from '$react';
2
2
  import {isObj,defaultStr} from "$cutils";
3
3
  import View from "$ecomponents/View";
4
- import Portal from "$ecomponents/Portal";
4
+ import { Portal } from 'react-native-paper';
5
5
  import theme,{Colors} from "$theme";
6
- import stableHash from "stable-hash";
7
- import Dimensions,{isMobileMedia,isTabletMedia,isDesktopMedia} from "$dimensions";
8
6
  import {
9
7
  StyleSheet,
10
8
  Pressable,
@@ -9,6 +9,7 @@ import Group from "./GroupComponent";
9
9
  import {Portal} from "react-native-paper";
10
10
  import {isAllowedFromStr} from "$cauth/perms";
11
11
  import { useIsScreenFocused } from '$enavigation/hooks';
12
+ import { useScreen } from '$econtext/hooks';
12
13
 
13
14
  export const isValid = (context)=>{
14
15
  if(!isObj(context) || !isNonNullString(context.fabId) || typeof context.show !=="function" || context.hide !="function") return false;
@@ -65,10 +66,14 @@ const FabGroupComponent = React.forwardRef((props,innerRef)=>{
65
66
  const fabIdRef = React.useRef(defaultStr(fabId,uniqid("fab-id-ref")));
66
67
  fabId = fabIdRef.current;
67
68
  const isMountedRef = React.useRef(false);
69
+ const screenContext = useScreen();
68
70
  let isFocused = useIsScreenFocused(screenName);
69
71
  if(!isNonNullString(screenName)){
70
72
  isFocused = true;
71
73
  }
74
+ if(screenContext && screenContext?.isFocused() === false){
75
+ isFocused = false;
76
+ }
72
77
  const [state, setState] = React.useState({
73
78
  open: typeof customOpen =='boolean'? customOpen : false,
74
79
  display : typeof customDisplay ==='boolean'? customDisplay : true,
@@ -10,7 +10,7 @@ import theme,{StyleProp} from "$theme";
10
10
  import Animation from "$ecomponents/Animation";
11
11
  import { Surface } from "react-native-paper";
12
12
  import { Platform } from "react-native";
13
- import Portal from "$ecomponents/Portal";
13
+ import { Portal } from "react-native-paper";
14
14
  import {defaultStr} from "$cutils";
15
15
  import {
16
16
  getStatusBarHeight,
@@ -16,6 +16,11 @@ export const useContext = useExpoUI;
16
16
 
17
17
  export const useApp = useContext;
18
18
 
19
+ export const ScreenContext = createContext(null);
20
+
21
+ export const useScreen = x=>useReactContext(ScreenContext);
22
+ export const hasScreenContext = x=>!!useScreen();
23
+
19
24
  export const useSWR = (path,options)=>{
20
25
  const {swrConfig} = useExpoUI();
21
26
  const host = `${defaultStr(process.env.API_HOST).trim().rtrim("/")}/${path}`;
@@ -1,2 +1,2 @@
1
1
 
2
- export const SWR_REFRESH_TIMEOUT = 2500*60;
2
+ export const SWR_REFRESH_TIMEOUT = 1000*60;
@@ -12,8 +12,6 @@ import theme,{StyleProp} from "$theme";
12
12
  import StatusBar from "$ecomponents/StatusBar";
13
13
  import ScrollView from "$ecomponents/ScrollView";
14
14
  import KeyboardAvoidingView from "$ecomponents/KeyboardAvoidingView";
15
- import Animated from 'react-native-reanimated';
16
- import {sharedElementTransition} from "./transition";
17
15
 
18
16
  const getDefaultTitle = (nTitle,returnStr)=>{
19
17
  let titleStr = React.getTextContent(nTitle);
@@ -7,6 +7,7 @@ import APP from "$capp";
7
7
  import {useDrawer} from "$ecomponents/Drawer";
8
8
  import {navigationRef,getScreenProps,setRoute,setActiveNavigation,setScreenOptions,goBack} from "$cnavigation";
9
9
  import { SCREEN_OPTIONS } from "./utils";
10
+ import {ScreenContext} from "$econtext/hooks";
10
11
 
11
12
  export default function ScreenWrapperNavComponent(_props){
12
13
  const {navigation,route,...props} = getScreenProps(_props);
@@ -64,22 +65,28 @@ export default function ScreenWrapperNavComponent(_props){
64
65
  setScreenOptions(options);
65
66
  const allowDrawer = typeof options.allowDrawer ==='boolean'? options.allowDrawer : typeof options.withDrawer =='boolean'? options.withDrawer : typeof Screen.allowDrawer =='boolean'? Screen.allowDrawer : typeof Screen.withDrawer =='boolean' ? Screen.withDrawer : Screen.isModalScreen == true ? false : true;
66
67
  const withFab = typeof options.withFab ==='boolean' ? options.withFab : typeof Screen.withFab =='boolean'? Screen.withFab : false;
67
- return <Screen
68
- withFab = {withFab}
69
- groupName = {groupName}
70
- {...rest}
71
- key = {sanitizedName}
72
- authRequired={authRequired === false || Screen.authRequired ===false ? false : authRequired || allowDrawer}
73
- backAction={options.backAction === false || Screen.backAction ===false ? false : isModal}
74
- modal={isModal}
75
- navigation = {navigation}
76
- route = {route}
77
- allowDrawer={allowDrawer}
78
- withDrawer = {allowDrawer !== false ? true : false}
79
- {...props}
80
- title = {defaultVal(props.title,options.title,rest.title)}
81
- subtitle = {defaultVal(props.subtitle,options.subtitle,rest.subtitle)}
82
- screenName={sanitizedName}
83
- options={options}
84
- />
68
+ const titleText = defaultVal(props.title,options.title,rest.title);
69
+ const authRequiredS = authRequired === false || Screen.authRequired ===false ? false : authRequired || allowDrawer;
70
+ const backActionS = options.backAction === false || Screen.backAction ===false ? false : isModal;
71
+ return <ScreenContext.Provider
72
+ value={{navigation,modal:isModal,backAction:backActionS,authRequired:authRequiredS,route,title:titleText,isModal,screenName,sanitizedName,options,isFocused:navigation.isFocused,withFab,allowDrawer}}
73
+ children={<Screen
74
+ withFab = {withFab}
75
+ groupName = {groupName}
76
+ {...rest}
77
+ key = {sanitizedName}
78
+ authRequired={authRequiredS}
79
+ backAction={backActionS}
80
+ modal={isModal}
81
+ navigation = {navigation}
82
+ route = {route}
83
+ allowDrawer={allowDrawer}
84
+ withDrawer = {allowDrawer !== false ? true : false}
85
+ {...props}
86
+ title = {titleText}
87
+ subtitle = {defaultVal(props.subtitle,options.subtitle,rest.subtitle)}
88
+ screenName={sanitizedName}
89
+ options={options}
90
+ />}
91
+ />
85
92
  }
@@ -3,6 +3,7 @@ import {sanitizeName,GROUP_NAMES} from "./utils";
3
3
  import React from "$react";
4
4
  import ScreenWrapper from "./ScreenWrapper";
5
5
  import { SCREEN_OPTIONS } from "./utils";
6
+
6
7
  export * from "./mainScreens";
7
8
 
8
9
  export * from "./utils";