@fto-consult/expo-ui 8.43.0 → 8.44.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.
@@ -7,9 +7,9 @@
7
7
  "@react-native-community/netinfo": "11.1.0",
8
8
  "@react-native/assets-registry": "^0.72.0",
9
9
  "react-native-get-random-values": "~1.8.0",
10
- "@react-navigation/native": "^6.1.15",
11
- "@react-navigation/native-stack": "^6.9.24",
12
- "@react-navigation/stack": "^6.3.27",
10
+ "@react-navigation/native": "^6.1.16",
11
+ "@react-navigation/native-stack": "^6.9.25",
12
+ "@react-navigation/stack": "^6.3.28",
13
13
  "@shopify/flash-list": "1.6.3",
14
14
  "expo": "^50.0.11",
15
15
  "expo-camera": "~14.0.6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.43.0",
3
+ "version": "8.44.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -1,11 +1,12 @@
1
1
  import AppBar from "$ecomponents/AppBar";
2
2
  import React from "$react";
3
- import APP from "$capp/instance";
4
3
  import { renderActions } from "./utils";
5
4
  import {isIos,isAndroid,isWeb} from "$cplatform";
5
+ import {useWindowDimensions} from "$cdimensions/utils";
6
6
 
7
7
  const AppBarDialogComponent = React.forwardRef((props,ref)=>{
8
8
  const {actions,responsive,isFullScreen,fullScreen,actionsProps,...rest} = props;
9
+ useWindowDimensions();
9
10
  if(responsive && !isFullScreen() || (typeof fullScreen =='boolean' && !fullScreen)){
10
11
  return null;
11
12
  }
@@ -171,8 +171,20 @@ const DialogComponent = React.forwardRef((props,ref)=>{
171
171
  paddingRight : borderRadius,
172
172
  paddingVertical : borderRadius?10:0,
173
173
  };
174
+ const getRRProps = (containerProps,setDimensions)=>{
175
+ if(!isPreloader){
176
+ const {mediaQueryUpdateStyle} = containerProps;
177
+ containerProps.mediaQueryUpdateStyle = (...rest)=>{
178
+ const r = typeof mediaQueryUpdateStyle =="function"? mediaQueryUpdateStyle(...rest) : undefined;
179
+ const {width,height} = rest[0];
180
+ const rW = setDimensions !== false ? {width,height} : {};
181
+ return isFullScreenDialog()? [r,{...rW,maxWidth:"100%",maxHeight:"100%"}] : [r,setDimensions !== false && {maxHeight:getMaxHeight(),maxWidth:getMaxWidth()}];
182
+ }
183
+ }
184
+ return containerProps;
185
+ }
174
186
  const alertContentStyle = isAlert ? {paddingHorizontal:15} : null;
175
- content = <View ref={contentRef} testID = {testID+"_Content11"} {...contentProps} style={[fullScreen? {flex:1}:{maxWidth,maxHeight:maxHeight-Math.min(SCREEN_INDENT*2+50,100)},isPreloader && {paddingHorizontal:10},{backgroundColor},alertContentStyle,contentProps.style]}>
187
+ content = <View ref={contentRef} testID = {testID+"_Content11"} {...getRRProps(contentProps,false)} style={[fullScreen? {flex:1}:{maxWidth,maxHeight:maxHeight-Math.min(SCREEN_INDENT*2+50,100)},isPreloader && {paddingHorizontal:10},{backgroundColor},alertContentStyle,contentProps.style]}>
176
188
  {content}
177
189
  </View>
178
190
  if(withScrollView){
@@ -182,17 +194,6 @@ const DialogComponent = React.forwardRef((props,ref)=>{
182
194
  {content}
183
195
  </ScrollView>
184
196
  }
185
- const getRRProps = (containerProps)=>{
186
- if(!isPreloader){
187
- const {mediaQueryUpdateStyle} = containerProps;
188
- containerProps.mediaQueryUpdateStyle = (...rest)=>{
189
- const r = typeof mediaQueryUpdateStyle =="function"? mediaQueryUpdateStyle(...rest) : undefined;
190
- const {width,height} = rest[0];
191
- return isFullScreenDialog()? [r,{width,height}] : r;
192
- }
193
- }
194
- return containerProps;
195
- }
196
197
  return <ModalComponent
197
198
  onDismiss={(e)=>{
198
199
  return handleBack(e,false);
@@ -7,10 +7,10 @@ import {renderActions} from "./utils";
7
7
  import View from "$ecomponents/View";
8
8
  import { StyleSheet } from "react-native";
9
9
  import DialogActions from "./RNPDialogActions";
10
- import {usePageDimensions} from "$cdimensions/utils";
10
+ import {usePageDimensions,useWindowDimensions} from "$cdimensions/utils";
11
11
 
12
12
  const DialogActionsComponent = React.forwardRef(({actions,isAlert,onAlertRequestClose,testID,containerProps,actionMutator,actionProps,cancelButton,responsive,isFullScreen,fullScreen,actionsProps,menuProps,...rest},ref)=>{
13
- usePageDimensions();
13
+ useWindowDimensions();
14
14
  if(responsive && isFullScreen() || fullScreen){
15
15
  return null;
16
16
  }
@@ -2,10 +2,10 @@ import React from "$react";
2
2
  import {defaultObj} from "$cutils";;
3
3
  import View from "$ecomponents/View";
4
4
  import { StyleSheet } from "react-native";
5
- import {usePageDimensions} from "$cdimensions/utils";
5
+ import {useWindowDimensions} from "$cdimensions/utils";
6
6
 
7
7
  const DialogFullPageFooter = React.forwardRef(({responsive,containerProps,children,isFullScreen,fullScreen,...rest},ref)=>{
8
- usePageDimensions();
8
+ useWindowDimensions();
9
9
  if(responsive && !isFullScreen() || (typeof fullScreen =='boolean' && !fullScreen) || !React.isValidElement(children)){
10
10
  return null;
11
11
  }
@@ -5,10 +5,10 @@ import {isNonNullString,defaultObj} from "$cutils";
5
5
  import View from "$ecomponents/View";
6
6
  import theme from "$theme";
7
7
  import { StyleSheet } from "react-native";
8
- import {usePageDimensions} from "$cdimensions/utils";
8
+ import {useWindowDimensions} from "$cdimensions/utils";
9
9
 
10
10
  const DialogTitleComponent = React.forwardRef(({responsive,containerProps,title,titleProps,isFullScreen,fullScreen,...rest},ref)=>{
11
- usePageDimensions();
11
+ useWindowDimensions();
12
12
  if(responsive && isFullScreen() || fullScreen || !React.isValidElement(title,true)){
13
13
  return null;
14
14
  }
@@ -100,7 +100,6 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
100
100
  },
101
101
  }
102
102
  Auth.setRef(auth);
103
- console.log("has set ref auth ",auth);
104
103
  extendFormFields(customFormFields);
105
104
  structsData = isObj(structsData)? structsData : null;
106
105
  appConfig.tablesData = tablesData;
package/src/pdf/index.js CHANGED
@@ -26,8 +26,12 @@ export const hashQRCode = (data)=>{
26
26
  }
27
27
  }
28
28
 
29
- export const decryptQRCode = (hashedQRCode)=>{
30
- return crypToJS.decode(hashedQRCode,QR_CODE_HASH_KEY);
29
+ export const decryptQRCodeData = (hashedQRCode)=>{
30
+ try {
31
+ return crypToJS.decode(hashedQRCode,QR_CODE_HASH_KEY);
32
+ } catch {
33
+ return null;
34
+ }
31
35
  }
32
36
 
33
37
  export const isValidQRCode = (data)=>{
@@ -35,7 +39,17 @@ export const isValidQRCode = (data)=>{
35
39
  data = JSON.parse(data);
36
40
  }
37
41
  data = defaultObj(data);
38
- return hashQRCode(data.data) === data.hash && QR_CODE_HASH_KEY_PREFIX.toLowerCase() == defaultStr(data.provider).toLowerCase().replace(/\s/g, "");
42
+ data.data = decryptQRCodeData(data.data);
43
+ if(!data.data || !isJSON(data.data)) return false;
44
+ return QR_CODE_HASH_KEY_PREFIX.toLowerCase() == defaultStr(data.provider).toLowerCase().replace(/\s/g, "");
45
+ }
46
+ export const decryptQRCode = (data)=>{
47
+ if(isJSON(data)){
48
+ data = JSON.parse(data);
49
+ }
50
+ data = defaultObj(data);
51
+ if(!isValidQRCode(data)) return null;
52
+ return data;
39
53
  }
40
54
 
41
55
  const {createPdf} = pdfMake;
@@ -198,7 +212,7 @@ export const getPrintSettings = ({multiple,duplicateDocOnPage,isTableData,tableD
198
212
  },
199
213
  qrCodeFitSize : {
200
214
  type :"number",
201
- defaultValue : 150,
215
+ defaultValue : 120,
202
216
  label : "Taille du QR Code",
203
217
  validType : "numberGreaterThanOrEquals[120]"
204
218
  },
@@ -289,7 +303,7 @@ export function printTableData(data,options){
289
303
  const pseudo = Auth.getUserPseudo();
290
304
  const fullName = Auth.getUserFullName() || pseudo || Auth.getLoggedUserCode();
291
305
  const printBy = isNonNullString(fullName)? (`${fullName}${uEmail?`[${uEmail}]`:""}`) : "";
292
- result.content.push({ qr: JSON.stringify({data:qrData,hash:hashQRCode(qrData),provider:defaultStr(appConfig.name).replace(/\s/g, ""),printBy,printDate:new Date().toFormat(DateLib.defaultDateTimeFormat),tableName:table}),margin:[0,8,0,5], fit: defaultNumber(data.qrCodeFitSize,150), alignment: qrCodeAlignmentPosition})
306
+ result.content.push({ qr: JSON.stringify({data:hashQRCode(qrData),provider:defaultStr(appConfig.name).replace(/\s/g, ""),printBy,printDate:new Date().toFormat(DateLib.defaultDateTimeFormat),tableName:table}),margin:[0,8,0,5], fit: defaultNumber(data.qrCodeFitSize,120), alignment: qrCodeAlignmentPosition})
293
307
  }
294
308
  }
295
309
  return result;
@@ -120,6 +120,9 @@ const PermTextType = PropTypes.shape({
120
120
  defaultAction : PropTypes.bool,//si les actions par défaut seront associés à la permission en cours
121
121
  });
122
122
 
123
+ const permsType = PropTypes.oneOfType([
124
+ PropTypes.func,PropTypes.object,
125
+ ]);
123
126
  PermLines.propTypes = {
124
127
  data : PropTypes.object,
125
128
  gridProps : PropTypes.object,//les props du composant Grid, wrapper au contentu expandable
@@ -129,10 +132,10 @@ PermLines.propTypes = {
129
132
  PropTypes.shape({
130
133
  table : PropTypes.string,
131
134
  tableName : PropTypes.string,
132
- perms : PropTypes.object,
135
+ perms : permsType,
133
136
  })
134
137
  ).isRequired,
135
- perms : PropTypes.object,//la liste des permissions qui peuvent associer au compte d'un utilisaters
138
+ perms : permsType,//la liste des permissions qui peuvent associer au compte d'un utilisaters
136
139
  /*** si les élements de permissions seront modifiable où non */
137
140
  disabled : PropTypes.bool,
138
141
  title : PropTypes.oneOfType([
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
- "version": "8.41.0",
3
+ "version": "8.43.1",
4
4
  "url": "https://github.com/borispipo/expo-ui#readme",
5
5
  "license": "ISC"
6
6
  },
@@ -39,6 +39,11 @@ module.exports = {
39
39
  "url": "https://github.com/pchmn/expo-material3-theme#readme",
40
40
  "license": "MIT"
41
41
  },
42
+ "@react-native-async-storage/async-storage": {
43
+ "version": "1.21.0",
44
+ "url": "https://github.com/react-native-async-storage/async-storage#readme",
45
+ "license": "MIT"
46
+ },
42
47
  "@react-native-community/netinfo": {
43
48
  "version": "11.1.0",
44
49
  "url": "https://github.com/react-native-netinfo/react-native-netinfo#readme",
@@ -50,17 +55,17 @@ module.exports = {
50
55
  "license": "MIT"
51
56
  },
52
57
  "@react-navigation/native": {
53
- "version": "6.1.15",
58
+ "version": "6.1.16",
54
59
  "url": "https://reactnavigation.org",
55
60
  "license": "MIT"
56
61
  },
57
62
  "@react-navigation/native-stack": {
58
- "version": "6.9.24",
63
+ "version": "6.9.25",
59
64
  "url": "https://github.com/software-mansion/react-native-screens#readme",
60
65
  "license": "MIT"
61
66
  },
62
67
  "@react-navigation/stack": {
63
- "version": "6.3.27",
68
+ "version": "6.3.28",
64
69
  "url": "https://reactnavigation.org/docs/stack-navigator/",
65
70
  "license": "MIT"
66
71
  },
@@ -139,26 +144,25 @@ module.exports = {
139
144
  "url": "https://docs.expo.dev/versions/latest/sdk/webbrowser/",
140
145
  "license": "MIT"
141
146
  },
147
+ "react": {
148
+ "version": "18.2.0",
149
+ "url": "https://reactjs.org/",
150
+ "license": "MIT"
151
+ },
142
152
  "react-native": {
143
153
  "version": "0.73.4",
144
154
  "url": "https://reactnative.dev/",
145
155
  "license": "MIT"
146
156
  },
147
- "react-native-big-list": {
148
- "version": "1.6.1",
149
- "url": "https://marcocesarato.github.io/react-native-big-list-docs/",
150
- "license": "GPL-3.0-or-later"
151
- },
152
- "react-native-blob-util": {
153
- "version": "0.18.6",
154
- "url": "https://github.com/RonRadtke/react-native-blob-util",
155
- "license": "MIT"
156
- },
157
157
  "react-native-gesture-handler": {
158
158
  "version": "2.14.1",
159
159
  "url": "https://github.com/software-mansion/react-native-gesture-handler#readme",
160
160
  "license": "MIT"
161
161
  },
162
+ "react-native-get-random-values": {
163
+ "version": "1.8.0",
164
+ "license": "MIT"
165
+ },
162
166
  "react-native-reanimated": {
163
167
  "version": "3.6.2",
164
168
  "url": "https://github.com/software-mansion/react-native-reanimated#readme",
@@ -188,5 +192,10 @@ module.exports = {
188
192
  "version": "13.6.4",
189
193
  "url": "https://github.com/react-native-webview/react-native-webview#readme",
190
194
  "license": "MIT"
195
+ },
196
+ "socket.io-client": {
197
+ "version": "4.7.4",
198
+ "url": "https://github.com/socketio/socket.io-client.git",
199
+ "license": "MIT"
191
200
  }
192
201
  };