@fto-consult/expo-ui 6.12.1 → 6.13.1

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/.env.readMe.txt CHANGED
@@ -6,3 +6,6 @@ pour que ce soit possible, la variable TABLES_DATA_PATH doit exister et doit poi
6
6
  TABLES_DATAS_PATH = //path, chemin vers le dossier des tables de données de l'application
7
7
 
8
8
 
9
+ STRUCTS_DATA_PATH = //path, chemin vers le dossiers des structs data des données de l'application
10
+
11
+
package/appConfig.txt CHANGED
@@ -19,6 +19,9 @@
19
19
  getTableData : {function(tableName)=>table} retourne l'ojet table data,
20
20
  handleHelpScreen : {boolean}, //if Help screen will be added on navigation's main drawer
21
21
 
22
+ tablesDataPath : {string}, //chemin relatif pointant sur le dossier parent aux tables data de l'application
23
+ structsDataPath : {string},//chemin relatif pointnat sur le dossier parent aux structs data de l'application
24
+
22
25
  checkNavigationPermsOnTableOrStructData : {boolean}, si le test de la permission sur la table data où sur la struct data sera effectuée lorsqu'on appelera la fonction navigateToTableData ou navigateToStructData
23
26
  }
24
27
 
package/babel.config.js CHANGED
@@ -33,39 +33,20 @@ module.exports = function(api,opts) {
33
33
  if(fs.existsSync(writeFilePath)){
34
34
  const writeFile = require(`${writeFilePath}`);
35
35
  //generate getTable.js file
36
- const generateGetTable = String(envObj.GENERATE_GET_TABLE_JS_FILE ).trim().toLowerCase();
37
- const willGenerateGetTableJs = generateGetTable === "false" || generateGetTable ==="0" ? false : true;
38
36
  const tableDataPath = envObj.TABLES_DATA_PATH && path.resolve(String(envObj.TABLES_DATA_PATH)) || packageJSON?.tablesDataPath && path.resolve(String(packageJSON.tablesDataPath)) || null;
39
- if(willGenerateGetTableJs && tableDataPath && fs.existsSync(tableDataPath)){
40
- if(fs.lstatSync(tableDataPath).isDirectory()){
41
- const getTableJsPath = path.resolve(tableDataPath,"getTable.js");
42
- let getTableJSContent = '';
43
- const tables = fs.readdirSync(tableDataPath);
44
- if(Array.isArray(tables)){
45
- tables.map((table,i)=>{
46
- table = table.trim();
47
- const tableName = table.toUpperCase();
48
- const tablePath = path.join(tableDataPath, table);
49
- const indexTablePath = path.join(tablePath,"index.js");
50
- const stat = fs.lstatSync(tablePath);
51
- if(!stat.isDirectory() || !fs.existsSync(indexTablePath)) return;
52
- const indexContent = fs.readFileSync(indexTablePath,'utf8') ;
53
- if(!indexContent || (!indexContent.includes("table") && !indexContent.includes("tableName"))){
54
- return;
55
- }
56
- getTableJSContent+=`\t\tif(tableName === "${tableName}"){return require("./${table}").default;}\n`;
57
- });
58
- //on génère le fichier getTable des tables data de l'application
59
- if(getTableJSContent){
60
- writeFile(getTableJsPath,`
61
- module.exports = function(tableName){
62
- \tif(!tableName || typeof tableName !=="string") return null;
63
- \ttableName = tableName.toUpperCase().trim();
64
- \t${getTableJSContent}\treturn null;
65
- }
66
- `);
67
- }
68
- }
37
+ if(tableDataPath && fs.existsSync(tableDataPath)){
38
+ const getTableJSContent = generateTableOrStructDataStr(tableDataPath);
39
+ if(getTableJSContent){
40
+ writeFile(path.resolve(tableDataPath,"getTable.js"),getTableJSContent);
41
+ }
42
+ }
43
+
44
+ //generate getStructData.js file
45
+ const structsDataPath = envObj.STRUCTS_DATA_PATH && path.resolve(String(envObj.STRUCTS_DATA_PATH)) || packageJSON?.structsDataPath && path.resolve(String(packageJSON.structsDataPath)) || null;
46
+ if(structsDataPath && fs.existsSync(structsDataPath)){
47
+ const getStructDataJSContent = generateTableOrStructDataStr(structsDataPath);
48
+ if(getStructDataJSContent){
49
+ writeFile(path.resolve(structsDataPath,"getStructData.js"),getStructDataJSContent);
69
50
  }
70
51
  }
71
52
 
@@ -110,3 +91,45 @@ module.exports = function(api,opts) {
110
91
  ],
111
92
  };
112
93
  };
94
+
95
+
96
+ /****
97
+ retourne la chaine de caractère liée à la fonction getTable.js ou getStructData.js
98
+ @param {string} tableDataPath, le chemin de la tableDataPath
99
+ @return {string}, la chaine de caractère à enregistrer dans la fonction getTable.js ou getStructData.js
100
+ */
101
+ const generateTableOrStructDataStr = (tableDataPath)=>{
102
+ if(typeof tableDataPath !== 'string' || !tableDataPath.trim()) return null;
103
+ tableDataPath = tableDataPath.trim();
104
+ const fs = require("fs"), path = require("path");
105
+ if(fs.lstatSync(tableDataPath).isDirectory()){
106
+ let getTableJSContent = '';
107
+ const tables = fs.readdirSync(tableDataPath);
108
+ if(Array.isArray(tables)){
109
+ tables.map((table,i)=>{
110
+ table = table.trim();
111
+ const tableName = table.toUpperCase();
112
+ const tablePath = path.join(tableDataPath, table);
113
+ const indexTablePath = path.join(tablePath,"index.js");
114
+ const stat = fs.lstatSync(tablePath);
115
+ if(!stat.isDirectory() || !fs.existsSync(indexTablePath)) return;
116
+ const indexContent = fs.readFileSync(indexTablePath,'utf8') ;
117
+ if(!indexContent || (!indexContent.includes("table") && !indexContent.includes("tableName"))){
118
+ return;
119
+ }
120
+ getTableJSContent+=`\t\t\tif(tableName === "${tableName}"){return require("./${table}").default;}\n`;
121
+ });
122
+ //on génère le fichier getTable des tables data de l'application
123
+ if(getTableJSContent){
124
+ return (`
125
+ module.exports = function(tableName){
126
+ \tif(!tableName || typeof tableName !=="string") return null;
127
+ \ttableName = tableName.toUpperCase().trim();
128
+ ${getTableJSContent}\treturn null;
129
+ }
130
+ `);
131
+ }
132
+ }
133
+ }
134
+ return null;
135
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.12.1",
3
+ "version": "6.13.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -36,8 +36,7 @@ const AppbarContent = ({
36
36
  const webStyle = isWeb() && theme.styles.webFontFamilly;
37
37
  const content = (
38
38
  <View
39
- pointerEvents="box-none"
40
- style={[styles.container, style]}
39
+ style={[styles.container,{pointerEvents:"box-none"}, style]}
41
40
  testID={testID}
42
41
  {...rest}
43
42
  >
@@ -34,7 +34,7 @@ export default function Logo (props) {
34
34
  </View>
35
35
  }
36
36
 
37
- const getStyle = ({style,color,height:customHeight,smallStyle,mediumStyle,largeStyle})=>{
37
+ export const getStyle = ({style,color,height:customHeight,smallStyle,mediumStyle,largeStyle})=>{
38
38
  const cColor = flattenStyle([{color:Colors.isValid(color)? color : theme.colors.primaryOnSurface}]);
39
39
  let size = 5;
40
40
  if(typeof customHeight =='number' && customHeight <= customHeight){
@@ -8,9 +8,8 @@ import appConfig from "$capp/config";
8
8
 
9
9
  export default function LogoProgress (props){
10
10
  let containerStyle = {width:(Logo.width?Logo.width:undefined),height:(Logo.height?(Logo.height+100):undefined),flex:1,alignItems:"center",justifyContent:"center"};
11
- const isLight = theme.isLight();
12
- let primaryColor = isLight?theme.colors.primaryOnSurface : defaultDarkTheme.colors.primary,
13
- secondaryColor = isLight ? theme.colors.secondaryOnSurface : defaultDarkTheme.colors.secondary;
11
+ const primaryColor = theme.colors.primaryOnSurface,
12
+ secondaryColor = theme.colors.secondaryOnSurface;
14
13
  return <View style={[containerStyle]}>
15
14
  <Logo key='logo' style={{marginBottom:0}} color={primaryColor}/>
16
15
  <ActivityIndicator size = {isIos()?'large':40} animating={true} color={secondaryColor} />
@@ -1,12 +1,12 @@
1
- import {View} from "react-native";
1
+ import {View,StyleSheet} from "react-native";
2
2
  import PropTypes from "prop-types";
3
3
  import React from "$react";
4
4
  import {isMobileNative} from "$cplatform";
5
- import {debounce,isNumber} from "$cutils";
5
+ import {debounce,isNumber,isNonNullString} from "$cutils";
6
6
  import {useMediaQueryUpdateStyle} from "$context/hooks";
7
7
 
8
8
 
9
- const ViewComponent = React.forwardRef(({onRender,onLayoutTimeout,onLayout,autoHeight,autoWidth,elevation,...props},ref)=>{
9
+ const ViewComponent = React.forwardRef(({onRender,onLayoutTimeout,pointerEvents,onLayout,autoHeight,autoWidth,elevation,...props},ref)=>{
10
10
  const style = useMediaQueryUpdateStyle(props);
11
11
  const autoSize = autoHeight||autoWidth ? true : false;
12
12
  const [state,setState] = autoSize ? React.useState({}) : [{}];
@@ -26,7 +26,8 @@ const ViewComponent = React.forwardRef(({onRender,onLayoutTimeout,onLayout,autoH
26
26
  React.useOnRender(onRender);
27
27
  return <View
28
28
  {...props}
29
- style = {[style,
29
+ style = {[isNonNullString(pointerEvents) && pointerEventsStyles[pointerEvents] ||null,
30
+ style,
30
31
  autoSize && [
31
32
  autoHeight && isNumber(height) && height > 10 && {height},
32
33
  autoWidth && isNumber(width) && width > 10 && {width}
@@ -47,4 +48,16 @@ ViewComponent.propTypes = {
47
48
  autoHeight : PropTypes.bool,//si la taille de
48
49
  onLayout : PropTypes.func,
49
50
  ///si useCurrentMedia est à true, alors la mise à jour sera opérée uniquement lorsque le current media change
50
- }
51
+ }
52
+
53
+ const pointerEventsStyles = StyleSheet.create({
54
+ auto : {
55
+ pointerEvents : "auto",
56
+ },
57
+ none : {
58
+ pointerEvents : "none",
59
+ },
60
+ "box-none" : {
61
+ pointerEvents : "box-none",
62
+ },
63
+ })
@@ -33,7 +33,7 @@ export default function DatabaseStatisticScreen ({withScreen,fetchDataProps,tabl
33
33
  const chartAllowedPerm = defaultStr(table.chartAllowedPerm);
34
34
  const testID = "RN_DatabaseStatisticsCell_"+index;
35
35
  if((chartAllowedPerm && !Auth.isAllowedFromStr(chartAllowedPerm)) || (!Auth.isTableDataAllowed({table:tableName}))) return null;
36
- content.push(<Cell elevation = {5} withSurface mobileSize={12} desktopSize={3} tabletSize={4} {...contentProps} testID={testID} key = {index} >
36
+ content.push(<Cell elevation = {5} withSurface mobileSize={12} desktopSize={3} tabletSize={6} {...contentProps} testID={testID} key = {index} >
37
37
  <Surface testID = {testID+"_Surface"} elevation = {5} style={[theme.styles.w100]}>
38
38
  <DatabaseStatistic
39
39
  icon = {table.icon}