@fto-consult/expo-ui 2.40.1 → 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/package.json +1 -1
- package/src/components/Drawer/DrawerItems/index.js +1 -0
- package/src/components/Fab/Group.js +2 -2
- 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
package/package.json
CHANGED
|
@@ -170,7 +170,7 @@ const FabGroupComponent = React.forwardRef((props,innerRef)=>{
|
|
|
170
170
|
backgroundColor = theme.colors.secondary;
|
|
171
171
|
color = theme.colors.secondaryText;
|
|
172
172
|
}
|
|
173
|
-
const actions = React.
|
|
173
|
+
const actions = React.useMemo(()=>{
|
|
174
174
|
if(!open) return []
|
|
175
175
|
const actions = prepareActions === false && Array.isArray(customActions)? customActions : [];
|
|
176
176
|
if((prepareActions !== false || !actions.length)){
|
|
@@ -192,7 +192,7 @@ const FabGroupComponent = React.forwardRef((props,innerRef)=>{
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
return actions;
|
|
195
|
-
},[customActions,prepareActions,open])
|
|
195
|
+
},[customActions,prepareActions,open]);
|
|
196
196
|
|
|
197
197
|
React.useEffect(()=>{
|
|
198
198
|
onMount && onMount(context);
|
|
@@ -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;
|