@fto-consult/expo-ui 2.39.8 → 2.41.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.
- package/index.js +1 -2
- package/package.json +120 -120
- package/readChart.txt +3 -1
- package/src/components/Countries/resources/countries-normalized.json +1987 -1987
- package/src/components/Countries/resources/countries-with-not-extra.json +1211 -1211
- package/src/components/Countries/resources/countries.sql +243 -243
- package/src/components/Datagrid/Common/Common.js +4 -4
- package/src/components/Datagrid/SWRDatagrid.js +16 -13
- package/src/components/Drawer/DrawerItems/index.js +1 -0
- package/src/components/Fab/Group.js +2 -2
- package/src/components/Form/Fields/SelectTableData/Component.js +6 -5
- package/src/components/Form/FormData/FormData.js +7 -1
- package/src/components/Tab/index.js +2 -2
- package/src/components/Table/Cell.js +2 -2
- package/src/components/Table/Header.js +2 -2
- package/src/components/Table/Row.js +2 -2
- package/src/components/Table/index.js +9 -11
- package/src/layouts/DatabaseStatistics/DatabaseStatistic.js +2 -2
- package/src/layouts/Fab/index.js +2 -2
|
@@ -19,17 +19,18 @@ import appConfig from "$appConfig";
|
|
|
19
19
|
* foreignKeyTable : la tableData dans laquelle effectuer les donées de la requêtes
|
|
20
20
|
* foreignKeyLabel : Le libélé dans la table étrangère
|
|
21
21
|
*/
|
|
22
|
-
const TableDataSelectField = React.forwardRef((
|
|
23
|
-
let {foreignKeyColumn,foreignKeyTable,fetchItemsPath,foreignKeyLabel,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchDataOpts,...props} = _props;
|
|
24
|
-
props = defaultObj(props);
|
|
22
|
+
const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable,fetchItemsPath,foreignKeyLabel,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchDataOpts,...props},ref)=>{
|
|
25
23
|
props.data = defaultObj(props.data);
|
|
26
24
|
foreignKeyColumn = foreignKeyColumn.trim();
|
|
27
25
|
convertFiltersToSQL = defaultVal(convertFiltersToSQL,willConvertFiltersToSQL());
|
|
28
|
-
getForeignKeyTable = getForeignKeyTable || appConfig.
|
|
26
|
+
getForeignKeyTable = getForeignKeyTable || appConfig.getTableData;
|
|
29
27
|
let fKeyTable = typeof getForeignKeyTable =='function' ? getForeignKeyTable(foreignKeyTable,props) : undefined;
|
|
30
28
|
fetchItemsPath = defaultStr(fetchItemsPath).trim();
|
|
29
|
+
|
|
31
30
|
if(!fetchItemsPath && (!isObj(fKeyTable) || !(defaultStr(fKeyTable.tableName,fKeyTable.table)))){
|
|
32
|
-
console.
|
|
31
|
+
console.log(appConfig.getTableData,fKeyTable,fetchItemsPath,getForeignKeyTable,"i s fkeddd for ",foreignKeyColumn,foreignKeyTable,props)
|
|
32
|
+
|
|
33
|
+
console.error("type de données invalide pour la foreignKeyTable ",fKeyTable," composant SelectTableData",foreignKeyColumn,foreignKeyTable,props);
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
fKeyTable = defaultObj(fKeyTable);
|
|
@@ -194,13 +194,19 @@ export default class FormDataComponent extends AppComponent{
|
|
|
194
194
|
const type = defaultStr(field.jsType,field.type,"text").trim().toLowerCase().replaceAll("_","");
|
|
195
195
|
const isDate = (type.contains('date') || type.contains('time'));
|
|
196
196
|
const Component = componentsTypes[type] || componentsTypes.default;
|
|
197
|
-
let {defaultValue,useDefaultValueFromData,hidden,renderFormDataField,getMediaQueryStyle,printLabels,queryLimit,selected,value,visible,dataFilesInterest,perm,ignore,form,responsiveProps:customResponsiveProps,...rest} = field;
|
|
197
|
+
let {defaultValue,useDefaultValueFromData,primaryKey,hidden,renderFormDataField,getMediaQueryStyle,printLabels,queryLimit,selected,value,visible,dataFilesInterest,perm,ignore,form,responsiveProps:customResponsiveProps,...rest} = field;
|
|
198
198
|
rest = Object.assign({},rest);
|
|
199
199
|
delete rest.import;
|
|
200
200
|
delete rest.export;
|
|
201
201
|
if(form === false || ignore || (isNonNullString(perm) && !Auth.isAllowedFromStr(perm))){
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
204
|
+
if(rest.nullable === false){
|
|
205
|
+
rest.required = true;
|
|
206
|
+
}
|
|
207
|
+
if(primaryKey === true && typeof rest.required !=='boolean'){
|
|
208
|
+
rest.required = true;
|
|
209
|
+
}
|
|
204
210
|
hidden = visible === false ? true : hidden;
|
|
205
211
|
if(typeof rest.filter !=='function'){
|
|
206
212
|
delete rest.filter;
|
|
@@ -58,7 +58,7 @@ const TabComponent = React.forwardRef((props,ref)=>{
|
|
|
58
58
|
}
|
|
59
59
|
},[children,activeIndex]);
|
|
60
60
|
testID = defaultStr(testID,"RN_TabComponentComponent");
|
|
61
|
-
const {tabs,contents,childrenProps} = React.
|
|
61
|
+
const {tabs,contents,childrenProps} = React.useMemo(()=>{
|
|
62
62
|
const tabs = [],contents = [],childrenProps=[];
|
|
63
63
|
React.Children.map(children,(child,index)=>{
|
|
64
64
|
if(!isObj(child)) return null;
|
|
@@ -78,7 +78,7 @@ const TabComponent = React.forwardRef((props,ref)=>{
|
|
|
78
78
|
</React.Fragment>)
|
|
79
79
|
})
|
|
80
80
|
return {tabs,contents,childrenProps}
|
|
81
|
-
},[children])
|
|
81
|
+
},[children]);
|
|
82
82
|
return <View {...rest} testID={testID} style={[styles.container,tabItemsProps.style]}>
|
|
83
83
|
<TabItems testID={testID+"_TabItems"} {...tabItemsProps} activeIndex={index} style={[styles.tab,rest.style]} onChange={setActiveIndex}>
|
|
84
84
|
{tabs}
|
|
@@ -7,14 +7,14 @@ import {defaultObj} from "$utils";
|
|
|
7
7
|
import Label from "$ecomponents/Label";
|
|
8
8
|
|
|
9
9
|
function TableCellComponent({cellArgs,rowArgs,children,renderCell,rowIndex,style,...rest}){
|
|
10
|
-
const {content,containerProps} = React.
|
|
10
|
+
const {content,containerProps} = React.useMemo(()=>{
|
|
11
11
|
const rArgs = {...cellArgs,...rowArgs,containerProps : {}};
|
|
12
12
|
const r = typeof renderCell =='function' && renderCell (rArgs) || children;
|
|
13
13
|
return {
|
|
14
14
|
content : typeof r =='string' || typeof r =='number'? <Label children={r}/> : React.isValidElement(r)? r : null,
|
|
15
15
|
containerProps : defaultObj(rArgs.containerProps)
|
|
16
16
|
}
|
|
17
|
-
},[children])
|
|
17
|
+
},[children]);
|
|
18
18
|
return (<View {...containerProps} {...rest} style={[style,containerProps.style]} >
|
|
19
19
|
{content}
|
|
20
20
|
</View>);
|
|
@@ -9,12 +9,12 @@ import React from "$react";
|
|
|
9
9
|
import { View } from "react-native";
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
11
|
export default function TableHeaderComponent({cells,columns,...rest}){
|
|
12
|
-
const children = React.
|
|
12
|
+
const children = React.useMemo(()=>{
|
|
13
13
|
if(Array.isArray(cells)){
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
return cells;
|
|
17
|
-
},[cells,columns])
|
|
17
|
+
},[cells,columns]);
|
|
18
18
|
return <View {...rest}>
|
|
19
19
|
{children}
|
|
20
20
|
</View>
|
|
@@ -5,12 +5,12 @@ import React from "$react";
|
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
7
|
export default function TableRowComponent({cells,columns,...rest}){
|
|
8
|
-
const children = React.
|
|
8
|
+
const children = React.useMemo(()=>{
|
|
9
9
|
if(Array.isArray(cells)){
|
|
10
10
|
return cells.map((cell,index)=>columns[index]? <React.Fragment key={index}>{cell}</React.Fragment> : null )
|
|
11
11
|
}
|
|
12
12
|
return cells;
|
|
13
|
-
},[cells,columns])
|
|
13
|
+
},[cells,columns]);
|
|
14
14
|
return <View {...rest}>
|
|
15
15
|
{children}
|
|
16
16
|
</View>
|
|
@@ -60,7 +60,7 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
60
60
|
const hasEmptyData = emptyData && React.isValidElement(emptyData);
|
|
61
61
|
const layoutRef = React.useRef({});
|
|
62
62
|
React.useOnRender(onRender);
|
|
63
|
-
const
|
|
63
|
+
const preparedColumns = React.useMemo(()=>{
|
|
64
64
|
const cols = {},headers = {},footers = {},filters = {},vColumnsMapping = [],visibleColumns = [],columnsNames = [];
|
|
65
65
|
let hasFooters = false;
|
|
66
66
|
columnProps = defaultObj(columnProps);
|
|
@@ -129,12 +129,12 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
129
129
|
});
|
|
130
130
|
return {columns:cols,columnsNames,headers,visibleColumns,vColumnsMapping,hasFooters,footers,filters};
|
|
131
131
|
},[columns]);
|
|
132
|
-
const {columns:cols,headers,footers,filters,hasFooters:stateHasFooters,columnsNames,vColumnsMapping,visibleColumns} =
|
|
132
|
+
const {columns:cols,headers,footers,filters,hasFooters:stateHasFooters,columnsNames,vColumnsMapping,visibleColumns} = preparedColumns;
|
|
133
133
|
headerContainerProps = defaultObj(headerContainerProps);
|
|
134
134
|
footerContainerProps = defaultObj(footerContainerProps);
|
|
135
135
|
const dimensions = Dimensions.get("window");
|
|
136
136
|
const maxHWidth = dimensions.width - defaultNumber(layoutRef.current.left,layoutRef.current.x);
|
|
137
|
-
const {fFilters,headersContent,footersContent,totalWidths} = React.
|
|
137
|
+
const {fFilters,headersContent,footersContent,totalWidths} = React.useMemo(()=>{
|
|
138
138
|
const headersContent = [],footersContent = [],fFilters = [];
|
|
139
139
|
let totalWidths = 0;
|
|
140
140
|
visibleColumns.map((i,index)=>{
|
|
@@ -149,13 +149,12 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
return {headersContent,totalWidths,footersContent,fFilters};
|
|
152
|
-
},[visibleColumns,showFilters,showFooters,layoutRef.current])
|
|
153
|
-
const colString = columnsNames.join(",");
|
|
152
|
+
},[visibleColumns,showFilters,showFooters,layoutRef.current]);
|
|
154
153
|
const prevData = React.usePrevious(data);
|
|
155
|
-
const
|
|
154
|
+
const prevColumns = React.usePrevious(columns);
|
|
156
155
|
const itemsRef = React.useRef(null);
|
|
157
|
-
const
|
|
158
|
-
if(data === prevData &&
|
|
156
|
+
const items = React.useMemo(()=>{
|
|
157
|
+
if(data === prevData && prevColumns == columns && Array.isArray(itemsRef.current)){
|
|
159
158
|
return itemsRef.current;
|
|
160
159
|
}
|
|
161
160
|
const items = [];
|
|
@@ -189,7 +188,7 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
189
188
|
});
|
|
190
189
|
itemsRef.current = items;
|
|
191
190
|
return items;
|
|
192
|
-
},[data,
|
|
191
|
+
},[data,columns]);
|
|
193
192
|
const scrollContentContainerStyle = {flex:1,width:listWidth,minWidth:totalWidths,height:'100%'};
|
|
194
193
|
const scrollEventThrottle = isMobileNative()?200:50;
|
|
195
194
|
const scrollViewFlexGrow = {flexGrow:0};
|
|
@@ -257,7 +256,6 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
|
-
const items = prepareItems();
|
|
261
259
|
return <View testID= {testID+"_Container"} {...containerProps} onLayout={(e)=>{
|
|
262
260
|
layoutRef.current = e.nativeEvent.layout;
|
|
263
261
|
if(containerProps.onLayout){
|
|
@@ -340,7 +338,7 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
340
338
|
numberOfLines = {1}
|
|
341
339
|
responsive = {false}
|
|
342
340
|
testID = {testID}
|
|
343
|
-
|
|
341
|
+
preparedItems = {false}
|
|
344
342
|
items = {items}
|
|
345
343
|
contentContainerStyle = {[styles.contentContainer,{with:listWidth,minWidth:totalWidths,position:'absolute',right:'0'}]}
|
|
346
344
|
style = {[styles.datagrid,{width:listWidth,minWidth:totalWidths}]}
|
|
@@ -93,7 +93,7 @@ export default function DatabaseStatisticContainer ({dashboardProps,onRefreshAll
|
|
|
93
93
|
tableName
|
|
94
94
|
})
|
|
95
95
|
};
|
|
96
|
-
const fetchFields = React.
|
|
96
|
+
const fetchFields = React.useMemo(()=>{
|
|
97
97
|
const fetchFields = [];
|
|
98
98
|
Object.map(columns,(field,f)=>{
|
|
99
99
|
const ff = defaultStr(isObj(field) && field.filter !== false? field.field: undefined,f);
|
|
@@ -102,7 +102,7 @@ export default function DatabaseStatisticContainer ({dashboardProps,onRefreshAll
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
return fetchFields;
|
|
105
|
-
},[columns])
|
|
105
|
+
},[columns]);
|
|
106
106
|
const counUpStyle = {fontSize:20,fontWeight:'bold',color:theme.colors.secondaryOnSurface};
|
|
107
107
|
title = React.isValidElement(title,true)?<Label splitText numberOfLines={1} color={theme.colors.primaryOnSurface} style={[{fontSize:15}]}>{title}</Label>: null;
|
|
108
108
|
const titleText = title && React.getTextContent(title) || null;
|
package/src/layouts/Fab/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export * from "./utils";
|
|
|
13
13
|
const FabLayoutComponent = React.forwardRef(({style,screenName,tables,...props},ref)=>{
|
|
14
14
|
const [isLoggedIn,setIsLoggedIn] = React.useState(isAuthLoggedIn());
|
|
15
15
|
const isMounted = React.useIsMounted();
|
|
16
|
-
const actions = React.
|
|
16
|
+
const actions = React.useMemo(()=>{
|
|
17
17
|
if(!isLoggedIn) return null;
|
|
18
18
|
const a = [];
|
|
19
19
|
Object.map(tables,(table,i,index)=>{
|
|
@@ -48,7 +48,7 @@ const FabLayoutComponent = React.forwardRef(({style,screenName,tables,...props},
|
|
|
48
48
|
})
|
|
49
49
|
})
|
|
50
50
|
return a.length ? a : null;
|
|
51
|
-
},[isLoggedIn])
|
|
51
|
+
},[isLoggedIn]);
|
|
52
52
|
React.useEffect(()=>{
|
|
53
53
|
const onLogin = ()=>{
|
|
54
54
|
if(!isMounted())return;
|