@fto-consult/expo-ui 2.7.13 → 2.9.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import DateLib from "$lib/date";
4
4
  import {isNonNullString,defaultStr,isNullOrEmpty,debounce,uniqid} from "$utils";
5
- import {regexParser,regexActions,getFilterStateValues} from "./utils";
5
+ import {regexParser,regexActions,operators as _operators,actions as _actions,periodActions, inActions as _inActions,getFilterStateValues,getSessionData,setSessionData} from "$cfilters";
6
6
  import {parseDecimal} from "$ecomponents/TextField";
7
7
  import notify from "$notify";
8
8
  import PropTypes from "prop-types";
@@ -15,41 +15,12 @@ import React,{Component as AppComponent} from "$react";
15
15
  import theme from "$theme";
16
16
  import {isMobileMedia} from "$cplatform/dimensions";
17
17
  import { ActivityIndicator } from "react-native-paper";
18
- import { getSessionData,setSessionData } from "./session";
19
18
  import DialogProvider from "$components/Form/FormData/DialogProvider";
20
19
 
21
20
  const manualRunKey = "manual-run";
22
21
 
23
- export * from "./utils";
22
+ export * from "$cfilters";
24
23
 
25
- const _actions = {
26
- '$eq' : 'Egal à',
27
- "$ne" : 'Défférent de',
28
- '$gt' : 'Supérieur à',
29
- '$gte' : 'Supérieur ou égal',
30
- '$lt' : 'Inférieur à',
31
- '$lte' : 'Inférieur où égal à',
32
- }
33
-
34
- const _inActions = {
35
- '$in' :'Est inc ds la liste', //Array of JSON values The document field must exist in the list provided.
36
- '$nin' : 'N\'est pas inc ds la liste', //Array of JSON values The document field not must exist in the list provided.
37
- }
38
-
39
-
40
- const _operators = {
41
- '$and' : 'Et', //Array Matches if all the selectors in the array match.
42
- '$or' : 'Ou', //Array Matches if any of the selectors in the array match. All selectors must use the same index.
43
- }
44
-
45
- const periodActions = {
46
- $yesterday : "Hier",
47
- $today:"Aujourd'hui",
48
- $prevWeek:"Semaine passée",
49
- $week:'Cette semaine',
50
- $month:'Ce mois',
51
- $period:"Période"
52
- }
53
24
 
54
25
  /***** Coposant Filter, pour les filtres de données */
55
26
  export default class Filter extends AppComponent {
@@ -863,7 +863,7 @@ export default class Field extends AppComponent {
863
863
  delete rest.archivable;
864
864
 
865
865
  this.___formattedField = undefined;
866
- let _type = this.type = defaultStr(this.props.type,this.type,"text").trim().toLowerCase();
866
+ let _type = this.type = defaultStr(this.props.jsType,this.props.type,this.type,"text").trim().toLowerCase();
867
867
  format = defaultStr(format).toLowerCase().trim();
868
868
  tooltip = defaultVal(tooltip,title);
869
869
 
@@ -959,6 +959,7 @@ Field.propTypes = {
959
959
  PropTypes.node,
960
960
  PropTypes.func,
961
961
  ]),
962
+ jsType : PropTypes.string,
962
963
  usePlaceholderWhenEmpty : PropTypes.bool,//si la valeur du placeholder sera utilée, lorsque la valeur du champ de type formatable est nulle ou égale à la valeur vide
963
964
  responsive : PropTypes.bool,
964
965
  responsiveProps : PropTypes.object,
@@ -191,7 +191,7 @@ export default class FormDataComponent extends AppComponent{
191
191
  content.push(<Divider key = {index} style={theme.styles.w100}/>)
192
192
  } else if(isObj(field) && field.form !== false) {
193
193
  const name = defaultStr(field.name,field.field,index);
194
- const type = defaultStr(field.type,"text").trim().toLowerCase().replaceAll("_","");
194
+ const type = defaultStr(field.jsType,field.type,"text").trim().toLowerCase().replaceAll("_","");
195
195
  const Component = componentTypes[type] || componentTypes.default;
196
196
  let {defaultValue,useDefaultValueFromData,hidden,renderFormDataField,getMediaQueryStyle,printLabels,queryLimit,selected,value,visible,dataFilesInterest,perm,ignore,form,responsiveProps:customResponsiveProps,...rest} = field;
197
197
  rest = Object.assign({},rest);
@@ -61,12 +61,16 @@ const FontIcon = React.forwardRef(({icon,name,testID,color,iconStyle,backgroundC
61
61
  console.warn("Icone non définie pour le composant FontIcon, icon [{0}], merci de spécifier une icone supportée par la liste du module https://github.com/expo/vector-icons/MaterialCommunityIcons".sprintf(icon),props);
62
62
  return null;
63
63
  }
64
- const iconName = icon.ltrim("")
64
+ const iconName = icon.ltrim("material-")
65
+ .ltrim("fa-").ltrim("ant-").ltrim("fontisto-")
66
+ .ltrim("foundation-").ltrim("ionic-").ltrim("octicons-")
67
+ .ltrim("simple-line-").ltrim("zocial-").trim();
68
+
65
69
  return <Icon {...props}
66
70
  ref = {ref}
67
71
  testID = {testID}
68
72
  color={color}
69
- name = {icon}
73
+ name = {iconName}
70
74
  backgroundColor = {backgroundColor}
71
75
  />
72
76
  });
@@ -94,7 +98,7 @@ export const isIcon = (name,iconSet)=>{
94
98
  if(!isNonNullString(name) || !isNonNullString(iconSet)) return false;
95
99
  name = name.toLowerCase();
96
100
  iconSet = iconSet.toLowerCase().trim();
97
- return name.startsWith(iconSet+"-") || name.startsWith(iconSet+"s"+"-") ? true : false;
101
+ return name.startsWith(iconSet+"-") /*|| name.startsWith(iconSet+"s"+"-")*/ ? true : false;
98
102
  }
99
103
 
100
104
  export default theme.withStyles(FontIcon,{displayName:FontIcon.displayName,mode:'normal'});
@@ -1,10 +1,11 @@
1
1
  import { Pressable } from "react-native";
2
2
  import { navigate } from "$cnavigation";
3
3
  import PropTypes from "prop-types";
4
- import {defaultStr} from "$utils";
4
+ import {defaultStr,defaultNumber} from "$utils";
5
5
  import React from "$react";
6
+
6
7
  const LinkComponent= React.forwardRef((props,ref)=>{
7
- let {Component,navigation,children,params,stopEventPropagation,source,onPress,routeParams,routeName,routeSource,routeType, ...rest} = props;
8
+ let {Component,navigation,children,params,stopEventPropagation,timeout,delay,source,onPress,routeParams,routeName,routeSource,routeType, ...rest} = props;
8
9
  const onRoutePress = (e)=>{
9
10
  if(stopEventPropagation !== false){
10
11
  React.stopEventPropagation(e);
@@ -12,7 +13,9 @@ const LinkComponent= React.forwardRef((props,ref)=>{
12
13
  if(onPress && onPress(e) === false){
13
14
  return;
14
15
  }
15
- navigate({routeName,previousRoute:undefined,routeParams,params,type:routeType,source:defaultStr(routeSource,source)},navigation);
16
+ setTimeout(()=>{
17
+ navigate({routeName,previousRoute:undefined,routeParams,params,type:routeType,source:defaultStr(routeSource,source)},navigation);
18
+ },defaultNumber(timeout,delay))
16
19
  };
17
20
  if(typeof children =='function'){
18
21
  return children ({...rest,onPress:onRoutePress},ref);
@@ -26,6 +29,8 @@ const LinkComponent= React.forwardRef((props,ref)=>{
26
29
  LinkComponent.propTypes = {
27
30
  stopEventPropagation : PropTypes.bool, //si la propagation d'évènement sera effective une fois qu'on ait cliqué sur le lien
28
31
  onPress : PropTypes.func,
32
+ timeout : PropTypes.number,
33
+ delay : PropTypes.number,//le delay d'attente lorsqu'on clique sur l'élément avant de faire la navigation
29
34
  routeName : PropTypes.string.isRequired,
30
35
  routeParams : PropTypes.object, //les paramètres à passer à la route
31
36
  routeType : PropTypes.string, //le type de route : stack ou drawer
@@ -160,7 +160,7 @@ const TableComponent = React.forwardRef(({containerProps,renderEmpty,isRowSelect
160
160
  const scrollContentContainerStyle = {flex:1,width:listWidth,minWidth:totalWidths,height:'100%'};
161
161
  const scrollEventThrottle = isMobileNative()?200:50;
162
162
  const scrollViewFlexGrow = {flexGrow:0};
163
- const maxScrollheight = f.length && fFilters.length ? 170 : f.length || fFilters.length ? 120 : 80;
163
+ const maxScrollheight = f.length && fFilters.length ? 170 : f.length ?120 : fFilters.length ? 140 : 80;
164
164
  const allScrollViewProps = {
165
165
  scrollEventThrottle,
166
166
  horizontal : true,
@@ -16,6 +16,7 @@ const FABContainer = React.forwardRef((props,ref)=>{
16
16
  ref = ref || createFabRef(screenName);
17
17
  React.useEffect(()=>{
18
18
  const onFocusFab = ({sanitizedName})=>{
19
+ console.log(sanitizedName," is dddddd focused")
19
20
  const isFocused = sanitizedName === sScreenName;
20
21
  if(isFocused && ref.current && ref.current.show){
21
22
  ref.current.show();
@@ -28,8 +28,8 @@ export const getItems = (force)=>{
28
28
  r.push(item);
29
29
  }
30
30
  })
31
- r.push({divider:true});
32
31
  if(handleHelp){
32
+ r.push({divider:true});
33
33
  const dataHelp = {
34
34
  key : 'dataHelp',
35
35
  label : 'Aide',
@@ -1,18 +0,0 @@
1
- import session from "$session";
2
- import {getLoggedUserCode} from "$cauth";
3
- const sKey = "FILTER-ITEM-KEY";
4
- const sessionKey = ()=> defaultStr(getLoggedUserCode())+"-"+sKey;
5
- import {defaultObj,defaultStr,isNonNullString} from "$utils";
6
-
7
- export const getSessionData = (key)=>{
8
- const data = defaultObj(session.get(sessionKey()));
9
- return isNonNullString(key)? data [key] : data;
10
- }
11
- export const setSessionData = (key,value)=>{
12
- const data = getSessionData();
13
- if(isNonNullString(key)){
14
- data[key] = value;
15
- return session.set(sessionKey(),data);
16
- }
17
- return false;
18
- }