@fto-consult/expo-ui 5.6.0 → 5.6.2

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,6 +2,8 @@ const path = require("path");
2
2
  const fs = require("fs");
3
3
  const writeFile = require("./electron/utils/writeFile");
4
4
  module.exports = (opts)=>{
5
+ console.log(process.env.EXPO_UI_PATH," is process envvvvv");
6
+ console.log(JSON.stringify(process.env)," is stringityffff");
5
7
  const dir = path.resolve(__dirname);
6
8
  const base = opts.base || process.cwd();
7
9
  const assets = path.resolve(dir,"assets");
package/expo-ui-path.js CHANGED
@@ -17,6 +17,16 @@ module.exports = function (){
17
17
  const sep = path.sep;
18
18
  const rootPath = process.cwd();
19
19
  const src = path.resolve(rootPath,"src");
20
+ try {
21
+ const envPath = path.resolve(rootPath,".env");
22
+ const envObj = fs.existsSync(envPath)? require("./parse-env")(fs.readFileSync(envPath,'utf8')) : {};
23
+ const euPathm = typeof envObj.EXPO_UI_PATH =="string" && envObj.EXPO_UI_PATH && path.resolve(envObj.EXPO_UI_PATH)||'';
24
+ const eu = euPathm && fs.existsSync(euPathm)? euPathm : null;
25
+ console.log(eu," is eu path and env object is",envObj," is env objecct feeeeee");
26
+ if(eu && fs.existsSync(path.resolve(eu,"src")) && fs.existsSync(path.resolve(eu,"webpack.config.js"))){
27
+ return path.resolve(eu,suffix).replace(sep,(sep+sep));
28
+ }
29
+ } catch{}
20
30
  const expoUi = path.resolve(rootPath,"expo-ui");
21
31
  if(fs.existsSync(src) && fs.existsSync(expoUi) && fs.existsSync(path.resolve(expoUi,"webpack.config.js"))){
22
32
  return path.resolve(expoUi,suffix).replace(sep,(sep+sep));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "5.6.0",
3
+ "version": "5.6.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  "@emotion/native": "^11.10.0",
62
62
  "@expo/html-elements": "^0.2.0",
63
63
  "@expo/vector-icons": "^13.0.0",
64
- "@fto-consult/common": "^3.8.11",
64
+ "@fto-consult/common": "^3.9.18",
65
65
  "@gorhom/portal": "^1.0.14",
66
66
  "@react-native-async-storage/async-storage": "^1.17.11",
67
67
  "@react-native-community/datetimepicker": "^6.7.3",
package/parse-env.js ADDED
@@ -0,0 +1,41 @@
1
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
2
+
3
+ // Parser src into an Object
4
+ module.exports = function parse (src) {
5
+ if(typeof src !=='string' || !src) return {};
6
+ const obj = {}
7
+
8
+ // Convert buffer to string
9
+ let lines = src.toString()
10
+
11
+ // Convert line breaks to same format
12
+ lines = lines.replace(/\r\n?/mg, '\n')
13
+
14
+ let match
15
+ while ((match = LINE.exec(lines)) != null) {
16
+ const key = match[1]
17
+
18
+ // Default undefined or null to empty string
19
+ let value = (match[2] || '')
20
+
21
+ // Remove whitespace
22
+ value = value.trim()
23
+
24
+ // Check if double quoted
25
+ const maybeQuote = value[0]
26
+
27
+ // Remove surrounding quotes
28
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
29
+
30
+ // Expand newlines if double quoted
31
+ if (maybeQuote === '"') {
32
+ value = value.replace(/\\n/g, '\n')
33
+ value = value.replace(/\\r/g, '\r')
34
+ }
35
+
36
+ // Add to object
37
+ obj[key] = value
38
+ }
39
+
40
+ return obj
41
+ }
@@ -8,7 +8,7 @@ import theme,{Colors,flattenStyle} from "$theme";
8
8
  import DrawerItems from './DrawerItems';
9
9
  import Dimensions,{isDesktopMedia,getCurrentMedia} from "$cplatform/dimensions";
10
10
  import {open,close} from "$epreloader";
11
- import {DRAWER_POSITIONS,DRAWER_TYPES,MINIMIZED_WIDTH,getDrawerWidth,MINIMIZED_ICON_SIZE,ICON_SIZE} from './utils';
11
+ import {DRAWER_POSITIONS,DRAWER_TYPES,MINIMIZED_WIDTH,getDrawerWidth} from './utils';
12
12
  import Icon,{MENU_ICON} from "$ecomponents/Icon";
13
13
  import apiSession from "./session";
14
14
  import View from "$ecomponents/View";
@@ -8,6 +8,7 @@ import numberType from './numberType.json'; // eslint-disable-line @typescript-e
8
8
  const phoneUtil = libPhoneNumber.PhoneNumberUtil.getInstance();
9
9
  const asYouTypeFormatter = libPhoneNumber.AsYouTypeFormatter;
10
10
 
11
+ export {phoneUtil};
11
12
 
12
13
  export const parse = (number,iso2)=>{
13
14
  try {
@@ -9,6 +9,7 @@ import Icon from "$ecomponents/Icon";
9
9
  import PhoneNumber from "./PhoneNumber";
10
10
  import SelectCountry from "$ecomponents/Countries/SelectCountry";
11
11
  import {getFlag} from "$ecomponents/Countries";
12
+ import appConfig from "$capp/config";
12
13
 
13
14
  export {PhoneNumber};
14
15
  export * from "./PhoneNumber";
@@ -33,7 +34,7 @@ export const format = (number, iso2) => {
33
34
  }
34
35
  const prepareState = ({defaultValue,country})=>{
35
36
  defaultValue = defaultStr(defaultValue);
36
- country = defaultStr(country);
37
+ country = defaultStr(country,appConfig.countryCode);
37
38
  if (defaultValue) {
38
39
  if (defaultValue[0] !== '+') {
39
40
  defaultValue = `+${defaultValue}`;
@@ -162,7 +163,8 @@ export default function PhoneInputComponent(props){
162
163
  onPress={onPressFlag}
163
164
  >
164
165
  <>
165
- {flagImageSource && <Image testID={testID+"_FlagImage"} source={flagImageSource} height={20} width={30} style={[styles.flagImage]} />}
166
+ {flagImageSource ? <Image testID={testID+"_FlagImage"} source={flagImageSource} height={20} width={30} style={[styles.flagImage]} />
167
+ : null}
166
168
  <Icon testID={testID+"_FlagChevronIcon"} name="chevron-down" size={16} style={[styles.flagIcon]} onPress={onPressFlag} />
167
169
  </>
168
170
  </TouchableOpacity>
@@ -117,7 +117,7 @@ export default function MainScreenScreenWithOrWithoutAuthContainer(props) {
117
117
  const child = <>
118
118
  {withStatusBar !== false ? <StatusBar/> : null}
119
119
  <ErrorBoundary testID={testID+"_ScreenLayoutErrorBoundary"}>
120
- <View testID={testID} {...containerProps} style={[styles.container,{backgroundColor},modal && styles.modal]}>
120
+ <View testID={testID} {...containerProps} style={[styles.container,{backgroundColor},modal && styles.modal,containerProps.style]}>
121
121
  {appBar === false ? null : React.isValidElement(appBar)? state.AppBar : <AppBar
122
122
  testID={testID+'_AppBar'} {...appBarProps}
123
123
  backAction = {defaultVal(appBarProps.backAction,backAction)}
@@ -266,10 +266,13 @@ export default class TableDataScreenComponent extends FormDataScreen{
266
266
  });
267
267
  if(isUpdated){
268
268
  //la props readOnlyOnEditing permet de rendre le champ readOnly en cas de mise à jour de la tableData
269
- if((currentField.readOnlyOnEditing === true)){
269
+ const cArgs = {...this.state,data:this.getCurrentData()};
270
+ const readOnlyOnEditing = typeof currentField.readOnlyOnEditing =='function'? currentField.readOnlyOnEditing(cArgs) : currentField.readOnlyOnEditing;
271
+ if((readOnlyOnEditing === true)){
270
272
  currentField.readOnly = true;
271
273
  }
272
- if((currentField.disabledOnEditing === true)){
274
+ const disabledOnEditing = typeof currentField.disabledOnEditing =='function'? currentField.disabledOnEditing(cArgs) : currentField.disabledOnEditing;
275
+ if((disabledOnEditing === true)){
273
276
  currentField.disabled = true;
274
277
  }
275
278
  }