@fto-consult/expo-ui 6.74.1 → 6.74.3

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.74.1",
3
+ "version": "6.74.3",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -45,11 +45,13 @@ export const renderRowCell = (arg)=>{
45
45
  } else if(typeof columnDef.render === "function"){
46
46
  _render = columnDef.render.call(context,renderArgs);
47
47
  } else if(arrayValueExists( _type,["date","datetime","time"])){
48
- const sqlFormat =_type === 'time'? undefined : _type ==="datetime" ? DateLib.SQLDateTimeFormat : DateLib.SQLDateFormat;
49
- let _dd =DateLib.parse(rowData[columnField],sqlFormat);
50
- if(DateLib.isDateObj(_dd)){
51
- const eFormat = defaultStr(columnDef.format,(_type === 'time'?DateLib.defaultTimeFormat:DateLib.masks.defaultDate));
52
- _render = DateLib.format(_dd,eFormat);
48
+ if(rowData[columnField]){
49
+ const sqlFormat =_type === 'time'? undefined : _type ==="datetime" ? DateLib.SQLDateTimeFormat : DateLib.SQLDateFormat;
50
+ let _dd =DateLib.parse(rowData[columnField],sqlFormat);
51
+ if(DateLib.isDateObj(_dd)){
52
+ const eFormat = defaultStr(columnDef.format,(_type === 'time'?DateLib.defaultTimeFormat:DateLib.masks.defaultDate));
53
+ _render = DateLib.format(_dd,eFormat);
54
+ }
53
55
  }
54
56
  if(!_render) _render = rowData[columnField]
55
57
  } else if(arrayValueExists(_type,['switch','checkbox'])){
@@ -38,6 +38,7 @@ const DatePickerInput = React.forwardRef(({
38
38
  left : customLeft,
39
39
  helperText,
40
40
  format,
41
+ displayFormat,
41
42
  disabled,readOnly
42
43
  ,text,
43
44
  withLabel,
@@ -110,10 +111,10 @@ const DatePickerInput = React.forwardRef(({
110
111
  return {error,errorText};
111
112
  }
112
113
  React.useEffect(()=>{
113
- const inputDate = toDateObj(defaultValue);
114
+ const inputDate = toDateObj(defaultValue,format);
114
115
  if(compareTwoDates(inputDate,prevInputDate)) return;
115
116
  setState({...state,inputDate});
116
- },[defaultValue])
117
+ },[defaultValue,format]);
117
118
  const setEmptyValue = ()=>{
118
119
  setState({...state,inputDate:undefined});
119
120
  }
@@ -12,7 +12,7 @@ import DateLib from "$date";
12
12
  import { toDateObj } from "./utils";
13
13
  import PeriodActionComponent from "./PeriodAction";
14
14
 
15
- export default function DateTimePickerComponent({left,isPeriodAction,contentProps,withSeconds,right,format,dateFormat,timeFormat,defaultValue,onChange,testID,dateProps,disabled,readOnly,timeProps,...rest}){
15
+ export default function DateTimePickerComponent({left,isPeriodAction,contentProps,withSeconds,right,format,displayDateFormat,displayTimeFormat,dateFormat,timeFormat,defaultValue,onChange,testID,dateProps,disabled,readOnly,timeProps,...rest}){
16
16
  if(!isPeriodAction){
17
17
  isPeriodAction = isNonNullString(defaultValue) && defaultValue.contains("=>");
18
18
  }
@@ -32,15 +32,6 @@ export default function DateTimePickerComponent({left,isPeriodAction,contentProp
32
32
  const anchorTimeProps = defaultObj(timeProps.anchorProps);
33
33
  const timePropsContainerProps = defaultObj(timeProps.containerProps);
34
34
  const dateObj = toDateObj(defaultValue);
35
- if(isNonNullString(format)){
36
- format = format.trim().split(" ");
37
- if(!isNonNullString(dateFormat)){
38
- dateFormat = format[0].trim();
39
- }
40
- if(!isNonNullString(timeFormat) && format[1]){
41
- timeFormat = format[1].trim();
42
- }
43
- }
44
35
  const changeDateArgsRef = {current:{
45
36
  date : dateObj,
46
37
  }}
@@ -80,6 +71,7 @@ export default function DateTimePickerComponent({left,isPeriodAction,contentProp
80
71
  testID = {testID}
81
72
  {...rest}
82
73
  format = {dateFormat}
74
+ displayFormat = {displayDateFormat}
83
75
  {...dateProps}
84
76
  style = {dStyle}
85
77
  calendarIconBefore = {true}
@@ -97,6 +89,7 @@ export default function DateTimePickerComponent({left,isPeriodAction,contentProp
97
89
  readOnly = {readOnly}
98
90
  testID={testID+"_Time"}
99
91
  format = {timeFormat}
92
+ displayFormat = {displayTimeFormat}
100
93
  {...timeProps}
101
94
  onChange = {(args)=>{
102
95
  changedTimeArgsRef.current = args;
@@ -130,6 +123,8 @@ DateTimePickerComponent.propTypes = {
130
123
  timeProps : PropTypes.object,
131
124
  dateFormat : PropTypes.string, //Le format de date
132
125
  timeFormat : PropTypes.string, //le format de time
126
+ displayDateFormat : PropTypes.string,//le format d'affichage de la date
127
+ displayTimeFormat : PropTypes.string, //le format d'affichage des heures
133
128
  defaultValue : PropTypes.oneOfType([
134
129
  PropTypes.string,
135
130
  PropTypes.object,
@@ -13,7 +13,8 @@ import React from "$react";
13
13
  export default function DrawerItem(props){
14
14
  let {navigation,closeOnPress,routeName,routeParams,...rest} = props;
15
15
  const {drawerRef,isItemActive} = useDrawer();
16
- const isActive = useIsScreenFocused(routeName) || isItemActive(props);
16
+ const isActive = isItemActive(props);
17
+ const isFocused = useIsScreenFocused(routeName);
17
18
  const [active,setActive] = React.useState(isActive);
18
19
  const isMounted = React.useIsMounted();
19
20
  const itemId = React.useState(uniqid("drawer-item-id"));
@@ -25,17 +26,26 @@ export default function DrawerItem(props){
25
26
  id:itemId,
26
27
  routeName
27
28
  });
28
- if(active){
29
- setActiveItem(context);
30
- }
29
+ React.useEffect(()=>{
30
+ if(isMounted() && isNonNullString(routeName)){
31
+ if(isFocused !== active){
32
+ setActive(isFocused);
33
+ }
34
+ }
35
+ },[isFocused])
36
+ React.useEffect(()=>{
37
+ if(active && isMounted()){
38
+ setActiveItem(context);
39
+ }
40
+ },[active])
31
41
  const closeDrawer = (cb,force)=>{
32
42
  return nCloseDrawer(drawerRef,cb,force);
33
43
  }
34
44
  React.useEffect(()=>{
35
- if(isActive !== active){
45
+ if(isMounted() && isActive !== active){
36
46
  setActive(isActive);
37
47
  }
38
- },[isActive])
48
+ },[isActive]);
39
49
  return <_DrawerItem
40
50
  {...rest}
41
51
  drawerRef = {drawerRef}
@@ -137,7 +137,7 @@ export default class Filter extends AppComponent {
137
137
  type = defaultStr(type,this.type,this.props.type).toLowerCase();
138
138
  if(type.contains('select')){
139
139
  return "$in";
140
- } if(type !== 'date2time' && type !== 'time' && type !== 'number' && type !== 'decimal'){
140
+ } if(type !== 'date2time' && type !=="date" && type !== 'time' && type !== 'number' && type !== 'decimal'){
141
141
  return '$regexcontains';
142
142
  }
143
143
  return '$eq';
@@ -39,5 +39,5 @@ export const useIsScreenFocused = (screenName)=>{
39
39
  APP.off(APP.EVENTS.SCREEN_BLUR,onScreenBlur);
40
40
  }
41
41
  },[])
42
- return useMemo(()=>isFocused,[isFocused]);
42
+ return useMemo(()=>isFocused,[isFocused,sanitizeName]);
43
43
  }