@fto-consult/expo-ui 7.12.4 → 7.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/package.json +2 -2
- package/src/components/Datagrid/Common/Common.js +4 -2
- package/src/components/Datagrid/Dashboard/index.js +4 -1
- package/src/components/Swiper/index.js +1 -1
- package/src/components/Tab/TabContent.js +2 -0
- package/src/context/Provider.js +2 -4
- package/src/layouts/DatabaseStatistics/DatabaseStatistic.js +8 -5
- package/src/layouts/DatabaseStatistics/index.js +3 -1
- package/src/screens/Auth/PermLine.js +1 -0
- package/src/screens/Auth/PermLines.js +4 -4
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.13.1",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"scripts": {
|
6
6
|
"clear-npx-cache": "npx clear-npx-cache",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"@expo/html-elements": "^0.5.1",
|
72
72
|
"@expo/vector-icons": "^13.0.0",
|
73
73
|
"@faker-js/faker": "^8.0.2",
|
74
|
-
"@fto-consult/common": "^
|
74
|
+
"@fto-consult/common": "^4.0.0",
|
75
75
|
"@fto-consult/electron-gen": "^2.2.0",
|
76
76
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
77
77
|
"@react-native-async-storage/async-storage": "1.18.2",
|
@@ -2040,6 +2040,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2040
2040
|
divider : true,
|
2041
2041
|
text : "Configurer les graphes",
|
2042
2042
|
icon :"material-settings",
|
2043
|
+
tooltip : "Cliquez pour configurer les graphes",
|
2043
2044
|
onPress : ()=>{
|
2044
2045
|
this.configureChart(false).then((config)=>{
|
2045
2046
|
this.setIsLoading(true,()=>{
|
@@ -2208,7 +2209,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2208
2209
|
}
|
2209
2210
|
}
|
2210
2211
|
getDefaultChartHeight(){
|
2211
|
-
return defaultNumber(this.props.chartProps?.height,this.isDashboard()?
|
2212
|
+
return defaultNumber(this.props.chartProps?.height,this.props.chartConfig?.height,this.isDashboard()?90:350);
|
2212
2213
|
}
|
2213
2214
|
getDefaultChartWidth(){
|
2214
2215
|
return defaultNumber(this.props.chartProps?.width);
|
@@ -2416,6 +2417,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2416
2417
|
chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
|
2417
2418
|
chartOptions.xaxis.labels.show = ("showXaxis" in config) ? !!config.showXaxis : !this.isDashboard();
|
2418
2419
|
|
2420
|
+
|
2419
2421
|
chartOptions.yaxis.labels = defaultObj(chartOptions.yaxis.labels);
|
2420
2422
|
chartOptions.yaxis.labels.show = ("showYaxis" in config) ? !!config.showYaxis : !this.isDashboard();
|
2421
2423
|
|
@@ -3777,7 +3779,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
3777
3779
|
}
|
3778
3780
|
renderTitle (){
|
3779
3781
|
const testID = this.getTestID();
|
3780
|
-
const title = typeof this.props.title =="function"? this.props.title({context:this}) : this.props.title;
|
3782
|
+
const title = typeof this.props.title =="function"? this.props.title({context:this,config:this.getConfig()}) : this.props.title;
|
3781
3783
|
const titleProps = defaultObj(this.props.titleProps);
|
3782
3784
|
return React.isValidElement(title) ? <Label testID={testID+"_Title"} {...titleProps} style={[theme.styles.w100,titleProps.style]}>
|
3783
3785
|
{title}
|
@@ -108,7 +108,7 @@ export default class DatagridDashboard extends TableData {
|
|
108
108
|
items = {this.renderMenu()}
|
109
109
|
/>
|
110
110
|
</View> : null}
|
111
|
-
{<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
|
111
|
+
{<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,styles.chartContainer,chartContainerProps.style]}>
|
112
112
|
{this.renderProgressBar()}
|
113
113
|
{this.renderChart()}
|
114
114
|
</View>}
|
@@ -140,4 +140,7 @@ const styles = StyleSheet.create({
|
|
140
140
|
width : '100%',
|
141
141
|
//flex:1,
|
142
142
|
},
|
143
|
+
chartContainer : {
|
144
|
+
//minHeight : 200,
|
145
|
+
}
|
143
146
|
})
|
@@ -378,7 +378,7 @@ SwiperComponent.propTypes = {
|
|
378
378
|
autoHeight : PropTypes.bool,//si la valeur de la taille des éléments sera automatiquement réajusté
|
379
379
|
loop: PropTypes.bool,
|
380
380
|
timeout: PropTypes.number,
|
381
|
-
gesturesEnabled: PropTypes.func,
|
381
|
+
gesturesEnabled: PropTypes.func, //pour permettre les gestures
|
382
382
|
withScrollView : PropTypes.oneOfType([
|
383
383
|
PropTypes.bool,
|
384
384
|
PropTypes.func,
|
@@ -4,6 +4,7 @@ import {defaultStr} from "$cutils";
|
|
4
4
|
import Swiper from "$ecomponents/Swiper";
|
5
5
|
import PropTypes from "prop-types";
|
6
6
|
import { StylePropTypes } from '$theme';
|
7
|
+
import {isTouchDevice} from "$cplatform";
|
7
8
|
|
8
9
|
const TabContentBase = ({
|
9
10
|
children,
|
@@ -14,6 +15,7 @@ const TabContentBase = ({
|
|
14
15
|
}) => {
|
15
16
|
return (
|
16
17
|
<Swiper
|
18
|
+
gesturesEnabled ={x=>!isTouchDevice()}
|
17
19
|
{...rest}
|
18
20
|
children = {children}
|
19
21
|
testId = {defaultStr(testId,'RN_SwiperTabComponent')}
|
package/src/context/Provider.js
CHANGED
@@ -7,14 +7,12 @@ import {colorsAlias,Colors} from "$theme";
|
|
7
7
|
import {isObj,isNonNullString,defaultStr,extendObj,defaultNumber} from "$cutils";
|
8
8
|
import {getMainScreens} from "$escreens/mainScreens";
|
9
9
|
import {ExpoUIContext} from "./hooks";
|
10
|
-
import {enableAuth,disableAuth} from "$cauth/perms";
|
11
10
|
import Login from "$eauth/Login";
|
12
11
|
import {modes} from "$ecomponents/TextField";
|
13
12
|
import {isMobileMedia} from "$cdimensions";
|
14
13
|
import { prepareScreens } from "./TableData";
|
15
14
|
import {extendFormFields} from "$ecomponents/Form/Fields";
|
16
|
-
import {AuthProvider} from '$cauth';
|
17
|
-
import { signInRef } from "$cauth/authSignIn2SignOut";
|
15
|
+
import Auth,{AuthProvider,enableAuth,disableAuth} from '$cauth';
|
18
16
|
import APP from "$capp/instance";
|
19
17
|
import { AppState } from 'react-native'
|
20
18
|
import {canFetchOffline} from "$capi/utils";
|
@@ -101,7 +99,7 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,a
|
|
101
99
|
return extendProps(cAuth?.loginPropsMutator,props);
|
102
100
|
},
|
103
101
|
}
|
104
|
-
|
102
|
+
Auth.setRef(auth);
|
105
103
|
extendFormFields(customFormFields);
|
106
104
|
structsData = isObj(structsData)? structsData : null;
|
107
105
|
appConfig.tablesData = tablesData;
|
@@ -104,6 +104,8 @@ export default function DatabaseStatisticContainer ({dashboardProps,onRefreshAll
|
|
104
104
|
return fetchFields;
|
105
105
|
},[columns]);
|
106
106
|
const counUpStyle = {fontSize:20,fontWeight:'bold',color:theme.colors.secondaryOnSurface};
|
107
|
+
title = defaultVal(title,table.label,table.text);
|
108
|
+
icon = defaultVal(icon,table.icon);
|
107
109
|
title = React.isValidElement(title,true)?<Label splitText numberOfLines={1} color={theme.colors.primaryOnSurface} style={[{fontSize:15}]}>{title}</Label>: null;
|
108
110
|
const titleText = title && React.getTextContent(title) || null;
|
109
111
|
const titleItem = titleText && {text:titleText,icon,divider:true} || null;
|
@@ -120,22 +122,23 @@ export default function DatabaseStatisticContainer ({dashboardProps,onRefreshAll
|
|
120
122
|
sessionName = {tableName+"-database-statistics"}
|
121
123
|
{...props}
|
122
124
|
{...dbStatistics}
|
123
|
-
style = {[theme.styles.pr1,props.style]}
|
125
|
+
style = {[theme.styles.pr1,props.style,dbStatistics.style]}
|
124
126
|
columns = {columns}
|
125
127
|
ref = {datagridRef}
|
126
128
|
progressBar = {isLoading?<View/>:<View style={[theme.styles.w100,theme.styles.alignItemsCenter,theme.styles.justifyContentCenter]}>{progressBar}</View>}
|
127
129
|
tableName = {tableName}
|
128
130
|
table = {table}
|
129
131
|
fetchData = {(options)=>{
|
130
|
-
return fetchData({...defaultObj(fetchDataProps),fields:fetchFields,table,tableName
|
132
|
+
return fetchData({...defaultObj(fetchDataProps),fields:fetchFields,table,tableName,...options});
|
131
133
|
}}
|
132
|
-
title = {({context})=>{
|
134
|
+
title = {({context,config:chartConfig})=>{
|
133
135
|
if(!context || !context.state) return null;
|
134
136
|
const {state} = context;
|
135
|
-
const footers = context.getFooters && context.getFooters() || {};
|
137
|
+
//const footers = context.getFooters && context.getFooters() || {};
|
136
138
|
const dataSize = context.getStateDataSize && context.getStateDataSize() || 0;
|
137
139
|
const footersValues = context.getFooterValues && context.getFooterValues() || {};
|
138
|
-
const
|
140
|
+
const config = Object.assign({},chartConfig,(typeof context.getConfig =="function"? context.getConfig() : state.config));
|
141
|
+
const y = defaultStr(config.y);
|
139
142
|
const footerValue = y && isObj(footersValues) && footersValues[y] || null;
|
140
143
|
const format = defaultStr(isObj(footerValue) && isNonNullString(footerValue.format) && footerValue.format || undefined).toLowerCase();
|
141
144
|
const aggregatorFunction = isNonNullString(state.aggregatorFunction)? state.aggregatorFunction : undefined;
|
@@ -142,6 +142,7 @@ const PermLine = ({text,cellProps,isUserMasterAdmin,withGrid,defaultActions,reso
|
|
142
142
|
}
|
143
143
|
|
144
144
|
});
|
145
|
+
if(!content.length) return null;
|
145
146
|
return <Cell testID={testID+"_Cell"} tabletSize={6} desktopSize={4} phoneSize={12} {...cellProps}>
|
146
147
|
<Expandable
|
147
148
|
expandedIcon ={'chevron-right'}
|
@@ -60,15 +60,15 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
60
60
|
const resource = getTableDataPermResourcePrefix(tableName);
|
61
61
|
const perms = {};
|
62
62
|
Object.map(table.perms,(perm,i)=>{
|
63
|
+
const iLower = i.toLowerCase();
|
64
|
+
if(iLower == 'defaultactions' || iLower =='defaultaction'){
|
65
|
+
perms.defaultActions = perm;
|
66
|
+
}
|
63
67
|
if(perm ===false) {
|
64
68
|
perms[i] = false;
|
65
69
|
return;
|
66
70
|
}
|
67
71
|
if(!isObj(perm)) return;
|
68
|
-
const iLower = i.toLowerCase();
|
69
|
-
if(iLower == 'defaultactions' || iLower =='defaultaction'){
|
70
|
-
perms.defaultActions = perm;
|
71
|
-
}
|
72
72
|
if(perm.defaultActions){
|
73
73
|
perm.actions = {
|
74
74
|
...Object.clone(defaultActions),
|