@fto-consult/expo-ui 5.8.9 → 5.8.11
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 +1 -1
- package/src/components/Datagrid/Accordion/index.js +4 -4
- package/src/components/Form/Fields/Field.js +19 -6
- package/src/components/Form/Fields/SelectTableData/Component.js +4 -3
- package/src/components/Form/FormData/FormData.js +3 -0
- package/src/components/Grid/Cell.js +1 -1
- package/src/components/Grid/Grid.js +2 -2
- package/src/components/InlineIndicator/index.js +4 -4
- package/src/components/InlineIndicator/utils.js +15 -0
- package/src/components/PhoneInput/PhoneNumber.js +1 -0
- package/src/components/SimpleSelect/index.js +1 -1
- package/src/layouts/DatabaseStatistics/index.js +1 -2
- package/src/layouts/Screen/FormData/List.js +0 -14
- package/src/screens/Auth/PermLines.js +1 -1
package/package.json
CHANGED
|
@@ -57,12 +57,12 @@ const DatagridFactory = (Factory)=>{
|
|
|
57
57
|
if(arg.renderRowCell === false || arg.isSectionListHeader === true) return super.renderRowCell(arg);
|
|
58
58
|
const {columnDef,columnField} = arg;
|
|
59
59
|
if(!columnDef.visible || columnDef.accordion === false || this.isSelectableColumn(columnDef,columnField)) return null;
|
|
60
|
-
|
|
60
|
+
arg.isAccordion = true;
|
|
61
|
+
const {render,key,style} = super.renderRowCell(arg);
|
|
61
62
|
if(render===null || !React.isValidElement(render)) return null;
|
|
62
|
-
return <Label style={style} key={key}>
|
|
63
|
+
return <Label style={[style,{paddingTop:10,paddingBottom:10}]} key={key}>
|
|
63
64
|
{render}
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
</Label>
|
|
66
66
|
}
|
|
67
67
|
rangeChanged(state){
|
|
68
68
|
if(this.startEndIndexCounterElt && this.startEndIndexCounterElt.update){
|
|
@@ -3,9 +3,10 @@ import KeyboardEventHandler from "../KeyboardEventHandler";
|
|
|
3
3
|
const {getActions,getFormFields,Forms} = require("../utils")
|
|
4
4
|
import TextField,{parseDecimal} from "$ecomponents/TextField";
|
|
5
5
|
import Icon from "$ecomponents/Icon";
|
|
6
|
-
import {extendObj,isBool,isUndefined,uniqid,isValidDataFileName,defaultObj,isObj,defaultFunc,isFunction,isNumber,arrayValueExists,defaultVal,defaultStr,isNonNullString,defaultBool,defaultDecimal} from "$cutils";
|
|
6
|
+
import {extendObj,isBool,isUndefined,uniqid,isValidDataFileName,isValidEmail,defaultObj,isObj,defaultFunc,isFunction,isNumber,arrayValueExists,defaultVal,defaultStr,isNonNullString,defaultBool,defaultDecimal} from "$cutils";
|
|
7
7
|
import {Component as AppComponent} from "$react";
|
|
8
8
|
import {observable,addObserver} from "$observable";
|
|
9
|
+
import {isValidPhoneNumber} from "$ecomponents/PhoneInput";
|
|
9
10
|
import {Validator} from "$validator";
|
|
10
11
|
import theme,{grid} from "$theme";
|
|
11
12
|
import React from "$react";
|
|
@@ -285,11 +286,23 @@ export default class Field extends AppComponent {
|
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
288
|
onValidatorValid(args){
|
|
288
|
-
if(!this.isFilter()
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
if(value
|
|
292
|
-
|
|
289
|
+
if(!this.isFilter()){
|
|
290
|
+
const vRule =defaultStr(this.getValidRule()).toLowerCase();
|
|
291
|
+
const value = typeof args.value == "undefined" || args.value == null ? "" : String(args.value).replaceAll("/","").replaceAll("\\",'').trim();
|
|
292
|
+
if(value){
|
|
293
|
+
if(this.type ==='email' || vRule.contains('email')){
|
|
294
|
+
if(!isValidEmail(value)){
|
|
295
|
+
return "Veuillez saisir une addresse email valide";
|
|
296
|
+
}
|
|
297
|
+
} else if(this.type ==="tel" || this.type =="phone"){
|
|
298
|
+
if(!isValidPhoneNumber(value)){
|
|
299
|
+
return "Merci d'entrer un numéro de téléphone valide";
|
|
300
|
+
}
|
|
301
|
+
} else if(((this.props.allowWhiteSpaces === false) || ((this.type ==='id' || this.type =='piece') && this.props.allowWhiteSpaces !== true))){
|
|
302
|
+
if((value.contains(" ") || !isValidDataFileName(value.replaceAll("@","").replaceAll(".","")))){
|
|
303
|
+
return "Veuillez renseigner une valeur ne contenant pas d'espace ou de caractère accentués";
|
|
304
|
+
}
|
|
305
|
+
}
|
|
293
306
|
}
|
|
294
307
|
}
|
|
295
308
|
if(isFunction(this.props.onValidatorValid)){
|
|
@@ -33,7 +33,8 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,bindUpsert2Remo
|
|
|
33
33
|
}
|
|
34
34
|
convertFiltersToSQL = defaultVal(convertFiltersToSQL,willConvertFiltersToSQL());
|
|
35
35
|
getForeignKeyTable = getForeignKeyTable || appConfig.getTableData;
|
|
36
|
-
|
|
36
|
+
const foreignKeyTableStr = defaultStr(foreignKeyTable,props.table,props.tableName);
|
|
37
|
+
let fKeyTable = typeof getForeignKeyTable =='function' ? getForeignKeyTable(foreignKeyTableStr,props) : undefined;
|
|
37
38
|
fetchItemsPath = defaultStr(fetchItemsPath).trim();
|
|
38
39
|
|
|
39
40
|
if(!fetchItemsPath && (!isObj(fKeyTable) || !(defaultStr(fKeyTable.tableName,fKeyTable.table)))){
|
|
@@ -67,8 +68,8 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,bindUpsert2Remo
|
|
|
67
68
|
const defaultFields = Array.isArray(foreignKeyColumn)? foreignKeyColumn : [foreignKeyColumn];
|
|
68
69
|
if(Array.isArray(foreignKeyLabel)){
|
|
69
70
|
foreignKeyLabel.map(f=>{
|
|
70
|
-
if(isNonNullString(f)){
|
|
71
|
-
defaultFields.push(f);
|
|
71
|
+
if(isNonNullString(f) && !defaultFields.includes(f.trim())){
|
|
72
|
+
defaultFields.push(f.trim());
|
|
72
73
|
}
|
|
73
74
|
})
|
|
74
75
|
}
|
|
@@ -94,6 +94,9 @@ export default class FormDataComponent extends AppComponent{
|
|
|
94
94
|
savedArgs = {...savedArgs,data}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
+
if(typeof saveDataMutator =='function'){
|
|
98
|
+
saveDataMutator(savedArgs);
|
|
99
|
+
}
|
|
97
100
|
return handleBeforeSaveCallback(this.beforeSave.bind(this),()=>{
|
|
98
101
|
return handleBeforeSaveCallback(beforeSave,()=>{
|
|
99
102
|
return handleBeforeSaveCallback(this.onSave.bind(this),()=>{
|
|
@@ -87,7 +87,7 @@ const GridCellComponent = React.forwardRef((p,ref)=>{
|
|
|
87
87
|
return getSizeStyle(p);
|
|
88
88
|
}}
|
|
89
89
|
ref={ref}
|
|
90
|
-
style = {[styles.container,getSizeStyle(p).style,style]}
|
|
90
|
+
style = {[styles.container,customFlex !== undefined && {flex:customFlex},getSizeStyle(p).style,style]}
|
|
91
91
|
>
|
|
92
92
|
<C testID={testID+"_Content"} activeOpacity={activeOpacity} {...contentProps}
|
|
93
93
|
|
|
@@ -6,10 +6,10 @@ import PropTypes from "prop-types";
|
|
|
6
6
|
import { StyleProp } from '$theme';
|
|
7
7
|
import View from "$ecomponents/View";
|
|
8
8
|
|
|
9
|
-
const GridComponent = React.forwardRef((
|
|
10
|
-
const {onPress,responsive,activeOpacity,onLongPress,flexGrow =1,flex:customFlex,style,onPressIn,col,onPressOut,...props} = p;
|
|
9
|
+
const GridComponent = React.forwardRef(({onPress,responsive,activeOpacity,onLongPress,flexGrow,flex:customFlex,style,onPressIn,col,onPressOut,...props},ref)=>{
|
|
11
10
|
const testID = defaultStr(props.testID,"RN_GridComponent");
|
|
12
11
|
const flattenedStyle = StyleSheet.flatten(style);
|
|
12
|
+
flexGrow = typeof flexGrow =='number'? flexGrow : 0;
|
|
13
13
|
const flex = customFlex !== undefined ? customFlex : (flattenedStyle && (col && flattenedStyle.width || !col && flattenedStyle.height)) ? undefined : undefined;
|
|
14
14
|
const C = onPress || onLongPress || onPressIn || onPressOut ? TouchableOpacity : View;
|
|
15
15
|
return <C {...props} activeOpacity={activeOpacity} onLongPress={onLongPress} onPressIn={onPressIn} onPressOut={onPressOut}
|
|
@@ -5,7 +5,7 @@ import {defaultObj,defaultVal} from "$cutils";
|
|
|
5
5
|
import {isMobileMedia} from "$cplatform/dimensions";
|
|
6
6
|
import TextFieldComponent from "$ecomponents/TextField";
|
|
7
7
|
import { StyleSheet } from "react-native";
|
|
8
|
-
|
|
8
|
+
import {METRICS_UNITS,WEIGHTS_UNITS} from "./utils";
|
|
9
9
|
|
|
10
10
|
export {Select};
|
|
11
11
|
|
|
@@ -45,7 +45,7 @@ export const MetricUnit = React.forwardRef((props,ref)=>{
|
|
|
45
45
|
inputProps.style = [styles.metricUnit,inputProps.style];
|
|
46
46
|
rest = defaultObj(rest);
|
|
47
47
|
return <Select
|
|
48
|
-
items = {
|
|
48
|
+
items = {METRICS_UNITS}
|
|
49
49
|
withCheckedIcon = {isMob}
|
|
50
50
|
{...rest}
|
|
51
51
|
inputProps = {inputProps}
|
|
@@ -67,7 +67,7 @@ export const WeightUnit = React.forwardRef((props,ref)=>{
|
|
|
67
67
|
inputProps.style = [styles.weightUnit,inputProps.style];
|
|
68
68
|
rest = defaultObj(rest);
|
|
69
69
|
return <Select
|
|
70
|
-
items = {
|
|
70
|
+
items = {WEIGHTS_UNITS}
|
|
71
71
|
renderItem = {({item,index})=>index}
|
|
72
72
|
withCheckedIcon = {isMob}
|
|
73
73
|
{...rest}
|
|
@@ -102,7 +102,7 @@ export const TextField = TextInput;
|
|
|
102
102
|
WeightUnit.displayName = "WeightUnitInlineIndicatorComponent";
|
|
103
103
|
|
|
104
104
|
export const Text = React.forwardRef((props,ref)=>{
|
|
105
|
-
return <LabelComponent.withRef ref={ref} {...props}
|
|
105
|
+
return <LabelComponent.withRef ref={ref} {...props} style={[styles.text,props.style]}/>
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
export const Label = Text;
|
|
@@ -322,7 +322,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
322
322
|
paddingHorizontal : 10,
|
|
323
323
|
paddingVertical:0,
|
|
324
324
|
height : !isMob?contentContainerHeight:'90%',
|
|
325
|
-
width : !isMob ? layout.width : undefined,
|
|
325
|
+
width : !isMob ? Math.max(layout.width,150) : undefined,
|
|
326
326
|
},
|
|
327
327
|
isMob && {flex:1},
|
|
328
328
|
!isMob && {paddingRight : 0},
|
|
@@ -14,7 +14,6 @@ export default function DatabaseStatisticScreen ({withScreen,fetchDataProps,tabl
|
|
|
14
14
|
containerProps = defaultObj(containerProps);
|
|
15
15
|
const title = containerProps.title = defaultStr(containerProps.title,DatabaseStatisticScreen.title);
|
|
16
16
|
contentProps = defaultObj(contentProps);
|
|
17
|
-
const forceRender = React.useForceRender();
|
|
18
17
|
if(Component == Cell){
|
|
19
18
|
containerProps.desktopSize = defaultNumber(containerProps.desktopSize,12);
|
|
20
19
|
containerProps.tabletSize = defaultNumber(containerProps.tabletSize,8);
|
|
@@ -58,7 +57,7 @@ export default function DatabaseStatisticScreen ({withScreen,fetchDataProps,tabl
|
|
|
58
57
|
content = <Component {...containerProps} style={[containerProps.style,theme.styles.mr1,theme.styles.ml1]}>
|
|
59
58
|
{content}
|
|
60
59
|
</Component>;
|
|
61
|
-
return withScreen !== false ? <Screen withScrollView title={defaultVal(customTitle,title)} {...props}>{content}</Screen> : content;
|
|
60
|
+
return withScreen !== false ? <Screen containerProps={{style:[{flexGrow:0,flex:0}]}} withScrollView title={defaultVal(customTitle,title)} {...props}>{content}</Screen> : content;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
export const screenName = DatabaseStatisticScreen.screenName = "DatabaseStatistics";
|
|
@@ -33,30 +33,16 @@ export default class FormDataListScreen extends FormData{
|
|
|
33
33
|
if(typeof show =='function'){
|
|
34
34
|
show({...this.props,index:undefined,data:{}});
|
|
35
35
|
}
|
|
36
|
-
}
|
|
37
|
-
doSave(args){
|
|
38
|
-
|
|
39
36
|
}
|
|
40
37
|
doSave2New(args){
|
|
41
|
-
if(!this.__canSaveListData) return;
|
|
42
38
|
const {show} = this.props;
|
|
43
39
|
if(typeof show =='function'){
|
|
44
40
|
show({...args,index:undefined,data:{}});
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
doSave2Close(args){
|
|
48
|
-
if(!this.__canSaveListData) return;
|
|
49
44
|
return this.close();
|
|
50
45
|
}
|
|
51
|
-
onSave(args){
|
|
52
|
-
let {formDataProps} = this.props;
|
|
53
|
-
this.__canSaveListData = true;
|
|
54
|
-
formDataProps = defaultObj(formDataProps);
|
|
55
|
-
if(typeof formDataProps.onSave =='function' && formDataProps.onSave(args) === false){
|
|
56
|
-
this.__canSaveListData = false;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
46
|
_render(content){
|
|
61
47
|
let {isAllowed} = this.props;
|
|
62
48
|
if(typeof isAllowed ==='function'){
|
|
@@ -101,7 +101,7 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
|
101
101
|
})
|
|
102
102
|
return content;
|
|
103
103
|
},[tables,allPerms,isUserMasterAdmin,disabled,tablePermPrefix])
|
|
104
|
-
return <Expandable {...props} testID={testID} style={[theme.styles.w100,style]} containerProps={containerProps} titleProps = {{style:[styles.expandable,theme.styles.w100]}} title={title}>
|
|
104
|
+
return <Expandable withScrollView={false} {...props} testID={testID} style={[theme.styles.w100,style]} containerProps={containerProps} titleProps = {{style:[styles.expandable,theme.styles.w100]}} title={title}>
|
|
105
105
|
<Grid testID={testID+"_Grid"} {...gridProps}>
|
|
106
106
|
{content }
|
|
107
107
|
</Grid>
|