@fto-consult/expo-ui 6.25.3 → 6.26.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/babel.config.alias.js +1 -1
- package/package.json +1 -1
- package/src/components/Datagrid/Accordion/Row.js +24 -20
- package/src/components/Datagrid/Accordion/index.js +5 -8
- package/src/components/Datagrid/utils.js +5 -1
- package/src/components/List/Common.js +3 -10
- package/src/components/List/Virtuoso/index.js +4 -2
- package/src/components/List/hooks.js +15 -2
- package/src/components/Table/Row/RowWrapper.native.js +1 -1
- package/src/components/Table/index.js +3 -3
- package/src/screens/Help/openLibraries.js +1 -1
package/babel.config.alias.js
CHANGED
|
@@ -83,7 +83,7 @@ module.exports = (opts)=>{
|
|
|
83
83
|
const outputPath = path.resolve(HelpScreen,"openLibraries.js");
|
|
84
84
|
r.$nodeModulesPath = r.$enodeModulesPath= nodeModulesPath;
|
|
85
85
|
require("./find-licenses")({
|
|
86
|
-
paths : [root,r["$expo-ui-root-path",path.resolve(process.cwd())]
|
|
86
|
+
paths : [root,r["$expo-ui-root-path"],path.resolve(process.cwd())],
|
|
87
87
|
nodeModulesPath : nodeModulesPath,
|
|
88
88
|
outputPath
|
|
89
89
|
});
|
package/package.json
CHANGED
|
@@ -64,7 +64,6 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
|
|
|
64
64
|
let rowIndex = defaultDecimal(index);
|
|
65
65
|
let rowIndexCount = index+1;
|
|
66
66
|
const testID = defaultStr(props.testID,"RN_DatagridAccordionRow"+(rowKey||rowIndex))
|
|
67
|
-
let _rP = {}
|
|
68
67
|
const hasAvatar = React.isValidElement(avatarContent);
|
|
69
68
|
const handleRowToggle = (event)=>{
|
|
70
69
|
if(selectable === false) return;
|
|
@@ -75,8 +74,8 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
|
|
|
75
74
|
}
|
|
76
75
|
const wrapStyle = React.useMemo(()=>{
|
|
77
76
|
return getRowStyle({row:item,index,selected,numColumns,isAccordion:true,rowIndex:index});
|
|
78
|
-
},[selected])
|
|
79
|
-
|
|
77
|
+
},[selected,numColumns]);
|
|
78
|
+
const viewWrapperStyle = [];
|
|
80
79
|
if(selected) {
|
|
81
80
|
const handleAvatarRowToggle = (event)=>{
|
|
82
81
|
React.stopEventPropagation(event);
|
|
@@ -93,7 +92,8 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
|
|
|
93
92
|
title = {sTtitle}
|
|
94
93
|
></Avatar> : null;
|
|
95
94
|
if(!hasAvatar){
|
|
96
|
-
viewWrapperStyle
|
|
95
|
+
viewWrapperStyle.push(styles.hasNotAvatar);
|
|
96
|
+
viewWrapperStyle.push({borderLeftColor:theme.colors.primaryOnSurface})
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -105,26 +105,24 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
|
|
|
105
105
|
icon = {"information-outline"}
|
|
106
106
|
></Avatar>
|
|
107
107
|
}
|
|
108
|
-
} else if(selectable === false){
|
|
109
|
-
_rP.disabled = true;
|
|
110
108
|
}
|
|
111
109
|
right = typeof right === 'function'? right ({color:theme.colors.primaryOnSurface,selectable:true,style:[rStyles.lineHeight,styles.right]}) : right;
|
|
112
110
|
const swipeableRef = React.useRef(null);
|
|
113
111
|
return <Pressable
|
|
114
|
-
{
|
|
112
|
+
disabled = {selectable===false?true : false}
|
|
115
113
|
{...rowProps}
|
|
116
114
|
testID={testID}
|
|
117
115
|
children = {null}
|
|
118
116
|
onPress = {toggleExpander}
|
|
119
117
|
onLongPress={handleRowToggle}
|
|
120
118
|
style = {[
|
|
121
|
-
_rP.style,rowProps.style,
|
|
122
119
|
styles.container,
|
|
123
|
-
numColumns > 1 && {width:'99%'},
|
|
124
120
|
styles.bordered,
|
|
125
|
-
wrapperStyle,
|
|
126
121
|
wrapStyle,
|
|
127
|
-
style,
|
|
122
|
+
rowProps.style,
|
|
123
|
+
numColumns > 1 && styles.multiColumns,
|
|
124
|
+
selected && styles.selected,
|
|
125
|
+
//style,
|
|
128
126
|
]}
|
|
129
127
|
ref = {React.useMergeRefs(ref,innerRef)}
|
|
130
128
|
>
|
|
@@ -221,11 +219,17 @@ const styles = StyleSheet.create({
|
|
|
221
219
|
bordered : {
|
|
222
220
|
//borderColor: "#ced4da",
|
|
223
221
|
//borderWidth : 1,
|
|
222
|
+
//paddingHorizontal:10,
|
|
223
|
+
},
|
|
224
|
+
multiColumns : {
|
|
225
|
+
paddingHorizontal : 5,
|
|
226
|
+
width : "98%"
|
|
224
227
|
},
|
|
225
228
|
renderedContent : {
|
|
226
229
|
flexDirection : 'row',
|
|
227
230
|
alignItems : 'center',
|
|
228
|
-
justifyContent : 'center'
|
|
231
|
+
justifyContent : 'center',
|
|
232
|
+
paddingVertical : 10,
|
|
229
233
|
},
|
|
230
234
|
right : {
|
|
231
235
|
marginHorizontal : 0,
|
|
@@ -244,25 +248,25 @@ const styles = StyleSheet.create({
|
|
|
244
248
|
alignSelf : 'flex-start',
|
|
245
249
|
},
|
|
246
250
|
container : {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
paddingHorizontal : isMobileNative()? 10 : 0,
|
|
251
|
+
paddingVertical : 0,
|
|
252
|
+
paddingHorizontal : 0,
|
|
250
253
|
marginHorizontal : 5,
|
|
251
254
|
flexWrap : 'nowrap',
|
|
252
255
|
justifyContent : 'center',
|
|
253
256
|
width : '100%',
|
|
254
257
|
},
|
|
255
|
-
containerSelected : {
|
|
256
|
-
paddingLeft : 2,
|
|
257
|
-
},
|
|
258
258
|
avatarContent : {
|
|
259
259
|
marginRight : 5,
|
|
260
260
|
},
|
|
261
261
|
hasNotAvatar : {
|
|
262
262
|
borderLeftWidth : 5,
|
|
263
|
-
paddingLeft :
|
|
263
|
+
paddingLeft : 0,
|
|
264
264
|
height : "100%"
|
|
265
|
-
}
|
|
265
|
+
},
|
|
266
|
+
selected : {
|
|
267
|
+
paddingHorizontal : 0,
|
|
268
|
+
paddingVertical : 0,
|
|
269
|
+
},
|
|
266
270
|
});
|
|
267
271
|
|
|
268
272
|
DatagridAccordionRow.displayName = 'DatagridAccordionRow';
|
|
@@ -23,7 +23,7 @@ import RenderType from "../RenderType";
|
|
|
23
23
|
import { flatMode} from "$ecomponents/TextField";
|
|
24
24
|
import List from "$ecomponents/Table/List";
|
|
25
25
|
import theme,{Colors} from "$theme";
|
|
26
|
-
import {
|
|
26
|
+
import {styles as rStyles} from "../utils";
|
|
27
27
|
import Avatar from "$ecomponents/Avatar";
|
|
28
28
|
import {defaultObj,isOb,isNonNullString} from "$cutils";
|
|
29
29
|
import PropTypes from "prop-types";
|
|
@@ -94,13 +94,10 @@ const DatagridFactory = (Factory)=>{
|
|
|
94
94
|
const formatValue = this.formatValue.bind(this);
|
|
95
95
|
return {...this.getActionsArgs(),valueFormatter:formatValue,formatValue,abreviateValues:this.state.abreviateValues,row:item,items:this.state.data,item,rowData:item,index,rowIndex:index,rowCounterIndex:rowIndexCount,rowIndexCount};
|
|
96
96
|
}
|
|
97
|
-
getRenderingItemProps ({item,rowKey,
|
|
97
|
+
getRenderingItemProps ({item,rowKey,index}){
|
|
98
98
|
this.renderingItemsProps = isObj(this.renderingItemsProps)? this.renderingItemsProps : {};
|
|
99
|
-
const wrapperStyle = getRowStyle({row:item,index,numColumns,isAccordion:true,rowIndex:index});
|
|
100
99
|
if(this.renderingItemsProps[rowKey]){
|
|
101
|
-
|
|
102
|
-
it.wrapperStyle = wrapperStyle;
|
|
103
|
-
return it;
|
|
100
|
+
return this.renderingItemsProps[rowKey];
|
|
104
101
|
}
|
|
105
102
|
const callArgs = this.getItemCallArgs({item,index});
|
|
106
103
|
const accordion = this.props.accordion;
|
|
@@ -169,7 +166,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
169
166
|
}
|
|
170
167
|
this.renderingItemsProps[rowKey] = {
|
|
171
168
|
testID,
|
|
172
|
-
|
|
169
|
+
title,right,rightProps,description,avatarContent,rowProps,avatarProps,
|
|
173
170
|
bottomSheetTitlePrefix : defaultStr(renderedContent?.bottomSheetTitlePrefix,accordionProps.bottomSheetTitlePrefix,accordion?.bottomSheetTitlePrefix)
|
|
174
171
|
}
|
|
175
172
|
return this.renderingItemsProps[rowKey];
|
|
@@ -200,8 +197,8 @@ const DatagridFactory = (Factory)=>{
|
|
|
200
197
|
selectable = {this.props.selectable}
|
|
201
198
|
{...defaultObj(this.props.accordionProps)}
|
|
202
199
|
accordion = {this.props.accordion}
|
|
200
|
+
{...this.getRenderingItemProps({item,index,rowKey})}
|
|
203
201
|
numColumns = {numColumns}
|
|
204
|
-
{...this.getRenderingItemProps({item,numColumns,index,rowKey})}
|
|
205
202
|
key = {index}
|
|
206
203
|
ref = {(el)=>{
|
|
207
204
|
if(isObj(this.renderingItemsProps) && isObj(this.renderingItemsProps[rowKey]) ){
|
|
@@ -103,6 +103,8 @@ export const ROW_SELECTED_STYLE = {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
export const SELECTED_BORDER_COLOR = "rgb(251, 207, 232)";
|
|
107
|
+
|
|
106
108
|
export const ROW_BORDER_STYLE = {
|
|
107
109
|
marginHorizontal : 0,
|
|
108
110
|
marginVertical : 0,
|
|
@@ -171,7 +173,9 @@ export const getRowStyle = ({row,bordered,numColumns,rowData,isAccordion,isTable
|
|
|
171
173
|
style.push(rowIndex%2===0?styles.even : theme.isDark()?styles.oddDark : styles.odd)
|
|
172
174
|
}
|
|
173
175
|
if(selected){
|
|
174
|
-
|
|
176
|
+
const selectedBcolor = theme.isDark()? SELECTED_BORDER_COLOR : theme.colors.primary;
|
|
177
|
+
const bordered = isAccordion ? null : {borderBottomWidth:1,borderBottomColor:selectedBcolor,borderTopWidth:1,borderTopColor:selectedBcolor};
|
|
178
|
+
style.push(styles.selected,bordered);
|
|
175
179
|
}
|
|
176
180
|
if(paid || row.paid){
|
|
177
181
|
style.push(styles.paid);
|
|
@@ -9,22 +9,15 @@ import BackToTop from "$ecomponents/BackToTop";
|
|
|
9
9
|
import {FlatList,StyleSheet,View} from "react-native";
|
|
10
10
|
import Label from "$ecomponents/Label";
|
|
11
11
|
import { useWindowDimensions,Dimensions } from "react-native";
|
|
12
|
-
import { useList } from "./hooks";
|
|
12
|
+
import { useList,useGetNumColumns } from "./hooks";
|
|
13
13
|
|
|
14
14
|
const CommonListComponent = React.forwardRef((props,ref)=>{
|
|
15
15
|
const context = useList(props);
|
|
16
|
-
let {
|
|
16
|
+
let {testID,defaultItemHeight,itemHeight,onRender,componentProps,columnWrapperStyle,onViewableItemsChanged,withFlatListItem,Component,withBackToTop,backToTopRef:customBackToTopRef,withBackToTopButton,onScroll,onScrollEnd,onMount,onUnmount,renderScrollViewWrapper,prepareItems,getItemKey,getKey,keyExtractor,items,filter,renderItem,numColumns,containerProps,bindResizeEvents,...rest} = props;
|
|
17
17
|
withBackToTopButton = withBackToTop === true || withBackToTopButton == true || isMobileMedia()? true : false;
|
|
18
18
|
rest = defaultObj(rest);
|
|
19
19
|
containerProps = defaultObj(containerProps);
|
|
20
|
-
|
|
21
|
-
const dimensions = responsive ? useWindowDimensions() : Dimensions.get("window");
|
|
22
|
-
if(responsive){
|
|
23
|
-
numColumns = grid.numColumns(windowWidth);
|
|
24
|
-
} else {
|
|
25
|
-
numColumns = defaultDecimal(numColumns,1);
|
|
26
|
-
}
|
|
27
|
-
const itemWindowWidth = dimensions.width/numColumns;
|
|
20
|
+
const {itemWindowWidth} = useGetNumColumns(props);
|
|
28
21
|
let scrollEndTimeout = React.useRef(null);
|
|
29
22
|
const listRef = React.useRef(null);
|
|
30
23
|
const hasCustomBackToTop = typeof customBackToTopRef == 'function'? true : false;
|
|
@@ -13,6 +13,7 @@ import Dimensions from "$cdimensions";
|
|
|
13
13
|
import { StyleSheet } from "react-native";
|
|
14
14
|
import {isMobileNative} from "$cplatform";
|
|
15
15
|
import {addClassName,removeClassName} from "$cutils/dom";
|
|
16
|
+
import { useGetNumColumns } from "../hooks";
|
|
16
17
|
|
|
17
18
|
const propTypes = {
|
|
18
19
|
...defaultObj(Virtuoso.propTypes),
|
|
@@ -32,10 +33,11 @@ const propTypes = {
|
|
|
32
33
|
isScrolling : PropTypes.func,
|
|
33
34
|
};
|
|
34
35
|
/***@see : https://virtuoso.dev/virtuoso-api-reference/ */
|
|
35
|
-
const VirtuosoListComponent = React.forwardRef(({onRender,id,fixedHeaderContent,rowProps,renderTable,listClassName,components,itemProps,windowWidth,
|
|
36
|
+
const VirtuosoListComponent = React.forwardRef(({onRender,id,fixedHeaderContent,numColumns:cNumCol,rowProps,renderTable,listClassName,components,itemProps,windowWidth,responsive,testID,renderItem,onEndReached,onLayout,onContentSizeChange,onScroll,isScrolling,estimatedItemSize,onEndReachedThreshold,containerProps,style,autoSizedStyle,...props},ref)=>{
|
|
36
37
|
if(renderTable){
|
|
37
38
|
responsive = false;
|
|
38
39
|
}
|
|
40
|
+
const {numColumns} = useGetNumColumns({responsive,numColumns:cNumCol,windowWidth})
|
|
39
41
|
const Component = React.useMemo(()=>renderTable ? TableVirtuoso : responsive?VirtuosoGrid:Virtuoso,[responsive,renderTable]);
|
|
40
42
|
const context = useList(props);
|
|
41
43
|
itemProps = defaultObj(itemProps);
|
|
@@ -162,7 +164,7 @@ const VirtuosoListComponent = React.forwardRef(({onRender,id,fixedHeaderContent,
|
|
|
162
164
|
useWindowScroll = {false}
|
|
163
165
|
totalCount = {items.length}
|
|
164
166
|
itemContent = {(index)=>{
|
|
165
|
-
return renderItem({index,item:items[index],items})
|
|
167
|
+
return renderItem({index,numColumns,item:items[index],items})
|
|
166
168
|
}}
|
|
167
169
|
atBottomStateChange = {()=>{
|
|
168
170
|
if(typeof onEndReached =='function'){
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "$react";
|
|
2
2
|
import { prepareItems as customPrepareItems} from "./utils";
|
|
3
|
-
import {defaultFunc} from "$cutils";
|
|
4
|
-
|
|
3
|
+
import {defaultFunc,defaultBool,defaultDecimal} from "$cutils";
|
|
4
|
+
import Dimensions,{isMobileMedia,useWindowDimensions} from "$cdimensions";
|
|
5
|
+
import {grid} from "$theme";
|
|
5
6
|
/**** retourne le contexte associé au composant List
|
|
6
7
|
|
|
7
8
|
*/
|
|
@@ -20,4 +21,16 @@ export const useList = ({items,filter,prepareItems,...props})=>{
|
|
|
20
21
|
return r;
|
|
21
22
|
},[items,canPrepareItems]);
|
|
22
23
|
return context;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const useGetNumColumns = ({windowWidth,numColumns,responsive})=>{
|
|
27
|
+
responsive = defaultBool(responsive,false);
|
|
28
|
+
const dimensions = responsive ? useWindowDimensions() : Dimensions.get("window");
|
|
29
|
+
if(responsive){
|
|
30
|
+
numColumns = grid.numColumns(windowWidth);
|
|
31
|
+
} else {
|
|
32
|
+
numColumns = defaultDecimal(numColumns,1);
|
|
33
|
+
}
|
|
34
|
+
const itemWindowWidth = dimensions.width/numColumns;
|
|
35
|
+
return {numColumns,itemWindowWidth,responsive};
|
|
23
36
|
}
|
|
@@ -7,7 +7,7 @@ import { getRowStyle } from "$ecomponents/Datagrid/utils";
|
|
|
7
7
|
|
|
8
8
|
const TableRowWrapperComponent = forwardRef(({children,colSpan,...props},ref)=>{
|
|
9
9
|
const {bordered,withDatagridContext} = useTable();
|
|
10
|
-
const selected = withDatagridContext ? useIsRowSelected(props) : false;
|
|
10
|
+
const selected = withDatagridContext ? useIsRowSelected(props.rowData || props.rowKey, props.rowIndex) : false;
|
|
11
11
|
const rowStyle = useMemo(()=>{
|
|
12
12
|
return getRowStyle({...props,bordered});
|
|
13
13
|
},[selected])
|
|
@@ -51,7 +51,7 @@ const getOnScrollCb = (refs,pos,cb2)=>{
|
|
|
51
51
|
return isMobileNative()? cb : debounce(cb,200);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRender,height,progressBar,renderListContent,children,renderEmpty,renderItem,
|
|
54
|
+
const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRender,height,progressBar,renderListContent,children,renderEmpty,renderItem,headerScrollViewProps,footerScrollViewProps,scrollViewProps,renderFooterCell,footerCellContainerProps,filterCellContainerProps,headerCellContainerProps,headerProps,rowProps:customRowProps,cellContainerProps,hasFooters,renderHeaderCell,renderFilterCell,columnProps,getRowKey,columnsWidths,colsWidths,columns,...props},tableRef)=>{
|
|
55
55
|
containerProps = defaultObj(containerProps);
|
|
56
56
|
cellContainerProps = defaultObj(cellContainerProps);
|
|
57
57
|
scrollViewProps = defaultObj(scrollViewProps);
|
|
@@ -252,8 +252,8 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
252
252
|
const index = props['data-index'];
|
|
253
253
|
const item = getRowByIndex(index) || props?.item || null;
|
|
254
254
|
if(!item) return null;
|
|
255
|
-
const args = {rowData:item,rowIndex:index,bordered,isTable:true};
|
|
256
|
-
args.
|
|
255
|
+
const args = {rowData:item,rowIndex:index,index,bordered,isTable:true};
|
|
256
|
+
args.selected = withDatagridContext ? useIsRowSelected(item,index) : false;
|
|
257
257
|
return <TableRowComponent {...props} style={[getRowStyle(args),props.style]}/>
|
|
258
258
|
},
|
|
259
259
|
Table: VirtuosoTableComponent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {"@
|
|
1
|
+
module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.25.1","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"}};
|