@fto-consult/expo-ui 2.26.11 → 2.27.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "2.26.11",
3
+ "version": "2.27.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,7 @@ import { evalSingleValue,Footer,getFooterColumnValue,isValidAggregator,extendAgg
28
28
  import i18n from "$i18n";
29
29
  import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$makePhoneCall";
30
30
  import copyToClipboard from "$capp/clipboard";
31
- import { Pressable } from "react-native";
31
+ import { Pressable,PanResponder } from "react-native";
32
32
  import TableLink from "$TableLink";
33
33
  import appConfig from "$capp/config";
34
34
  import stableHash from "stable-hash";
@@ -2696,7 +2696,7 @@ export default class CommonDatagridComponent extends AppComponent {
2696
2696
  return "none";
2697
2697
  }
2698
2698
  if(this.enablePointerEventsRef.current) return true;
2699
- return this.isLoading()? "none":"box-none";
2699
+ return this.isLoading()? "none":"auto";
2700
2700
  }
2701
2701
  updateLayout(p){
2702
2702
  this.measureLayout(state=>{
@@ -0,0 +1,64 @@
1
+ // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ import React from "$react";
6
+ import View from "$components/View";
7
+ import Label from "$components/Label";
8
+ import PropTypes from 'prop-types';
9
+ import { StyleSheet } from "react-native";
10
+ import {defaultStr,defaultObj} from "$utils";
11
+ import theme from "$theme";
12
+
13
+ const FieldSet = React.forwardRef(({testID,style,children,labelProps,containerProps,label,borderColor,...props},ref)=>{
14
+ testID = defaultStr(testID,"RN_FieldSetComponent");
15
+ containerProps = defaultObj(containerProps);
16
+ labelProps = defaultObj(labelProps);
17
+ borderColor = theme.Colors.isValid(borderColor)?borderColor : theme.colors.divider;
18
+ return (
19
+ <View ref ={ref} testID={testID+"_Container"} {...containerProps} style={[styles.container, { borderColor},containerProps.style]}>
20
+ <Label testID={testID+"_Label"} {...labelProps} style={[styles.label,labelProps.style]}>
21
+ {React.isValidElement(label,true) && label || null}
22
+ </Label>
23
+ <View {...props} testID={testID} style={[styles.content,style]}>
24
+ {React.isValidElement(children) && children || null}
25
+ </View>
26
+ </View>
27
+ );
28
+ });
29
+
30
+ FieldSet.propTypes = {
31
+ label: PropTypes.oneOfType([
32
+ PropTypes.string,
33
+ PropTypes.number,
34
+ PropTypes.node,
35
+ PropTypes.element,
36
+ ]),
37
+ children: PropTypes.element,
38
+ labelProps : PropTypes.object,
39
+ containerProps : PropTypes.object,
40
+ style : theme.StyleProps,
41
+ }
42
+
43
+
44
+ const styles = StyleSheet.create({
45
+ container: {
46
+ borderWidth: 1.1,
47
+ borderRadius: 5,
48
+ position : 'relative',
49
+ },
50
+ content : {
51
+ flex: 1,
52
+ paddingVertical: 10
53
+ },
54
+ label: {
55
+ height: 0,
56
+ position: 'absolute',
57
+ top: -10,
58
+ left: 10,
59
+ },
60
+ });
61
+
62
+ FieldSet.displayName = "FieldSetComponent";
63
+
64
+ export default FieldSet;
@@ -1,8 +1,8 @@
1
- import {isIos,isAndroid,isNativeMobile,isTouchDevice} from "$cplatform";
1
+ import {isIos} from "$cplatform";
2
2
  import {KeyboardAvoidingView,StyleSheet} from 'react-native';
3
3
 
4
4
  export default function KeyboardAvoidingViewComponent({ children,...rest }){
5
- return isNativeMobile() || isTouchDevice() ? (
5
+ return isIos() ? (
6
6
  <KeyboardAvoidingView
7
7
  style={styles.wrapper}
8
8
  behavior="padding"
@@ -11,9 +11,7 @@ export default function KeyboardAvoidingViewComponent({ children,...rest }){
11
11
  >
12
12
  {children}
13
13
  </KeyboardAvoidingView>
14
- ) : (
15
- <>{children}</>
16
- );
14
+ ) : children;
17
15
  };
18
16
 
19
17
  const styles = StyleSheet.create({
@@ -0,0 +1,33 @@
1
+ // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ import React from "$react";
6
+ import { Keyboard, Text, TextInput, StyleSheet, View } from "react-native";
7
+
8
+ /****
9
+ * rewrite of @see : https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/KeyboardAvoidingView/index.js
10
+ */
11
+ const KeyboardAvoidingView = ({behavior,contentContainerStyle,keyboardVerticalOffset,...rest})=>{
12
+ const frameRef = React.useRef(null);
13
+ const onLayout = (event)=>{
14
+ frameRef.current = event.nativeEvent.layout;
15
+ };
16
+ React.useEffect(() => {
17
+ const keyboardDidShowListener = Keyboard.addListener(
18
+ 'keyboardDidShow',
19
+ (args) => {}
20
+ );
21
+ const keyboardDidHideListener = Keyboard.addListener(
22
+ 'keyboardDidHide',
23
+ (args) => {}
24
+ );
25
+ return () => {
26
+ keyboardDidHideListener.remove();
27
+ keyboardDidShowListener.remove();
28
+ };
29
+ }, []);
30
+ return <View onLayout={onLayout} {...rest} />;
31
+ }
32
+
33
+ export default KeyboardAvoidingView;
@@ -1,6 +1,6 @@
1
1
  import React from '$react';
2
2
  import { FlatList } from 'react-native';
3
- import { ScrollView,Dimensions } from 'react-native';
3
+ import { ScrollView,Dimensions,useWindowDimensions } from 'react-native';
4
4
  import PropTypes from "prop-types";
5
5
  import View from "$ecomponents/View";
6
6
  import {isMobileNative} from "$cplatform";
@@ -11,6 +11,7 @@ const ScrollViewComponent = React.forwardRef((props,ref) => {
11
11
  const {virtualized,contentProps,mediaQueryUpdateNativeProps,testID:customTestID,children,screenIndent:sIndent,...rest} = props;
12
12
  const testID = defaultStr(customTestID,'RN_ScrollViewComponent');
13
13
  const cProps = defaultObj(contentProps);
14
+ const {height} = useWindowDimensions()//:Dimensions.get("window");
14
15
  return virtualized ? <FlatList
15
16
  {...rest}
16
17
  ref = {ref}
@@ -19,7 +20,7 @@ const ScrollViewComponent = React.forwardRef((props,ref) => {
19
20
  keyExtractor={(_e, i) => 'dom' + i.toString()}
20
21
  ListEmptyComponent={null}
21
22
  renderItem={null}
22
- contentContainerStyle = {[!isNative && {flex:1,flexGrow: 1,maxHeight:'100vh'},rest.contentContainerStyle]}
23
+ contentContainerStyle = {[!isNative && {flex:1,flexGrow: 1,maxHeight:Math.max(height-100,250)},rest.contentContainerStyle]}
23
24
  ListHeaderComponent={() => <View testID={testID+'_FlatListContent'} {...cProps} mediaQueryUpdateNativeProps = {mediaQueryUpdateNativeProps}
24
25
  >{children}</View>}
25
26
  /> : <ScrollView ref={ref} {...rest} testID={testID} children={children}/>
@@ -120,7 +120,6 @@ class SwiperComponent extends React.Component {
120
120
  * @see : https://stackoverflow.com/questions/45810262/how-to-disable-panresponder-on-child-component-react-native
121
121
  *
122
122
  */
123
- onStartShouldSetPanResponderCapture: (evt, gestureState) => this.props.stopChildrenEventPropagation !== false ? true : false,
124
123
  onMoveShouldSetPanResponderCapture: (e, gestureState) => {
125
124
  const { gesturesEnabled, vertical, minDistanceToCapture } = this.props;
126
125
 
@@ -224,7 +224,7 @@ const TableComponent = React.forwardRef(({containerProps,renderListContent,child
224
224
  }
225
225
  }
226
226
  }
227
- return <View testID= {testID+"_Container"} pointerEvents='box-none' {...containerProps} style={[styles.container,{alignItems:'stretch'},containerProps.style]}>
227
+ return <View testID= {testID+"_Container"} {...containerProps} style={[styles.container,{alignItems:'stretch'},containerProps.style]}>
228
228
  <RNView style={[cStyle]} testID={testID+"_Headers_ScrollViewContainer"}>
229
229
  <ScrollView
230
230
  testID={testID+"_HeaderScrollView"}