@fto-consult/expo-ui 6.24.2 → 6.25.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/app.config.json +1 -1
- package/babel.config.alias.js +2 -1
- package/babel.config.js +1 -1
- package/electron/utils/env.js +80 -0
- package/expo-ui-path.js +2 -2
- package/index.js +14 -13
- package/is-local-dev.js +5 -0
- package/metro.config.js +3 -2
- package/package.json +6 -3
- package/src/App.js +3 -3
- package/src/components/Datagrid/Accordion/Row.js +74 -100
- package/src/components/Datagrid/Accordion/ToogleRow.js +9 -0
- package/src/components/Datagrid/Accordion/index.js +30 -35
- package/src/components/Datagrid/Actions/index.js +12 -44
- package/src/components/Datagrid/Checkbox.js +4 -7
- package/src/components/Datagrid/Common/Common.js +112 -148
- package/src/components/Datagrid/Dashboard/index.js +2 -2
- package/src/components/Datagrid/IndexComponent.js +8 -13
- package/src/components/Datagrid/Table/index.js +53 -51
- package/src/components/Datagrid/Test/index.js +10 -3
- package/src/components/Datagrid/events/evx.js +7 -0
- package/src/components/Datagrid/events/index.js +11 -0
- package/src/components/Datagrid/hooks/Provider.js +6 -0
- package/src/components/Datagrid/hooks/context.js +5 -0
- package/src/components/Datagrid/hooks/index.js +104 -0
- package/src/components/Datagrid/utils.js +6 -4
- package/src/components/Dialog/Dialog.js +13 -12
- package/src/components/Dialog/DialogContent.js +11 -0
- package/src/components/KeyboardAvoidingView/index.js +7 -3
- package/src/components/List/Common.js +5 -3
- package/src/components/List/FlashList.js +13 -13
- package/src/components/List/Virtuoso/index.js +29 -8
- package/src/components/List/Virtuoso/index.native.js +6 -1
- package/src/components/Table/FiltersOrFooters.js +11 -3
- package/src/components/Table/Header/Cell/index.js +10 -0
- package/src/components/Table/Header/Cell/index.native.js +7 -0
- package/src/components/Table/{Header.js → Header/Component.js} +0 -4
- package/src/components/Table/{Row.js → Header/Component.native.js} +3 -3
- package/src/components/Table/Header/index.js +12 -0
- package/src/components/Table/List/index.js +3 -1
- package/src/components/Table/List/index.native.js +2 -1
- package/src/components/Table/Row/Cell/Content.js +17 -0
- package/src/components/Table/Row/Cell/Content.native.js +15 -0
- package/src/components/Table/Row/Cell/index.js +29 -0
- package/src/components/Table/Row/RowWrapper.js +7 -0
- package/src/components/Table/Row/RowWrapper.native.js +10 -0
- package/src/components/Table/Row/index.js +38 -0
- package/src/components/Table/RowTemplate/index.js +10 -0
- package/src/components/Table/RowTemplate/index.web.js +9 -0
- package/src/components/Table/ScrollNative/index.js +7 -0
- package/src/components/Table/ScrollNative/index.native.js +8 -0
- package/src/components/Table/VirtuosoTable/index.js +5 -0
- package/src/components/Table/VirtuosoTable/index.native.js +3 -0
- package/src/components/Table/hooks.js +84 -0
- package/src/components/Table/index.js +88 -247
- package/src/components/Table/styles.js +88 -0
- package/src/components/Table/utils.js +1 -0
- package/src/layouts/AppBar/index.js +11 -10
- package/src/layouts/Screen/ScreenWithoutAuthContainer.js +14 -6
- package/src/navigation/Drawer/items/index.js +2 -1
- package/src/navigation/index.js +11 -3
- package/src/screens/Help/About.js +1 -1
- package/src/screens/Help/openLibraries.js +1 -1
- package/src/test-screens/Home.js +4 -1
- package/webpack.config.js +4 -2
- package/src/components/Table/Cell.js +0 -24
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import React from "$react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
|
-
export default function
|
|
7
|
+
export default function TableHeaderComponent({cells,columns,...rest}){
|
|
8
8
|
const children = React.useMemo(()=>{
|
|
9
9
|
if(Array.isArray(cells)){
|
|
10
|
-
return
|
|
10
|
+
return null;
|
|
11
11
|
}
|
|
12
12
|
return cells;
|
|
13
13
|
},[cells,columns]);
|
|
@@ -16,6 +16,6 @@ export default function TableRowComponent({cells,columns,...rest}){
|
|
|
16
16
|
</View>
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
TableHeaderComponent.propTypes = {
|
|
20
20
|
columns : PropTypes.arrayOf(PropTypes.bool)
|
|
21
21
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import Cell from "./Cell";
|
|
6
|
+
import RowHeaderComponent from "./Header";
|
|
7
|
+
|
|
8
|
+
export {Cell};
|
|
9
|
+
|
|
10
|
+
RowHeaderComponent.Cell = Cell;
|
|
11
|
+
|
|
12
|
+
export default RowHeaderComponent;
|
|
@@ -12,4 +12,6 @@ const AutoSizeVerticalList = React.forwardRef(({testID,autoSizerProps,...props},
|
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
AutoSizeVerticalList.displayName = "AutoSizeVerticalListComponent";
|
|
15
|
-
export default AutoSizeVerticalList;
|
|
15
|
+
export default AutoSizeVerticalList;
|
|
16
|
+
|
|
17
|
+
export * from "$ecomponents/List/Virtuoso";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {default} from "$ecomponents/List/
|
|
1
|
+
export {default} from "$ecomponents/List/Virtuoso";
|
|
2
|
+
export * from "$ecomponents/List/Virtuoso";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {classNames} from "$cutils";
|
|
6
|
+
import { StyleSheet } from "react-native";
|
|
7
|
+
import theme from "$theme";
|
|
8
|
+
|
|
9
|
+
function TableCellContentComponent({children,style,...rest}){
|
|
10
|
+
return (<td {...rest} className={classNames(rest.className,"table-row-cell")} style={StyleSheet.flatten([style])}>
|
|
11
|
+
{children}
|
|
12
|
+
</td>);
|
|
13
|
+
}
|
|
14
|
+
//const TableCellContentComponent = React.memo(TableCellContentComponent);;
|
|
15
|
+
export default TableCellContentComponent;
|
|
16
|
+
TableCellContentComponent.displayName = "TableCellContentComponent";
|
|
17
|
+
const styles = {paddingLeft:"10px",paddingTop:"5px",paddingBottom:"5px",paddingRight:"10px"};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
import React from "react";
|
|
5
|
+
import View from "$ecomponents/View";
|
|
6
|
+
import { StyleSheet } from "react-native";
|
|
7
|
+
|
|
8
|
+
function TableCellContentComponent({children,style,colSpan,...rest}){
|
|
9
|
+
return (<View testID={"RN_TableRowCellContentComponent"} {...rest} style={StyleSheet.flatten(style)}>
|
|
10
|
+
{children}
|
|
11
|
+
</View>);
|
|
12
|
+
}
|
|
13
|
+
//const TableCellContentComponent = React.memo(TableCellContentComponent);;
|
|
14
|
+
export default TableCellContentComponent;
|
|
15
|
+
TableCellContentComponent.displayName = "TableCellContentComponent";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "$react";
|
|
2
|
+
import CellContent from "./Content";
|
|
3
|
+
import { useTable } from "../../hooks";
|
|
4
|
+
import {defaultObj} from "$cutils";
|
|
5
|
+
import Label from "$ecomponents/Label";
|
|
6
|
+
const TableRowCellComponent = React.forwardRef(({children,rowData,colSpan,isSectionListHeader,rowIndex,style,...rest},ref)=>{
|
|
7
|
+
if(isSectionListHeader){
|
|
8
|
+
return <CellContent colSpan={colSpan} ref={ref} style={[style]} >
|
|
9
|
+
{children}
|
|
10
|
+
</CellContent>
|
|
11
|
+
}
|
|
12
|
+
const {renderCell} = useTable();
|
|
13
|
+
const {content,containerProps} = React.useMemo(()=>{
|
|
14
|
+
const rArgs = {...rest,rowData,rowIndex,containerProps : {}};
|
|
15
|
+
const r = typeof renderCell =='function' && renderCell (rArgs) || children;
|
|
16
|
+
return {
|
|
17
|
+
content : typeof r =='string' || typeof r =='number' && r ? <Label children={r}/> : React.isValidElement(r)? r : children,
|
|
18
|
+
containerProps : defaultObj(rArgs.containerProps)
|
|
19
|
+
}
|
|
20
|
+
},[children]);
|
|
21
|
+
return (<CellContent ref={ref} {...containerProps} style={[style,containerProps.style]} >
|
|
22
|
+
{content}
|
|
23
|
+
</CellContent>);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
TableRowCellComponent.displayName = "TableRowCellComponent";
|
|
28
|
+
|
|
29
|
+
export default TableRowCellComponent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import View from "$ecomponents/View"
|
|
3
|
+
|
|
4
|
+
const TableRowWrapperComponent = forwardRef(({children,colSpan,...props},ref)=>{
|
|
5
|
+
return <View ref={ref} {...props} children={children}/>
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
TableRowWrapperComponent.displayName = "TableRowWrapperComponent";
|
|
9
|
+
|
|
10
|
+
export default TableRowWrapperComponent;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import Cell from "./Cell";
|
|
6
|
+
import PropTypes from "prop-types";
|
|
7
|
+
import {isObj} from "$cutils";
|
|
8
|
+
import styles from "../styles";
|
|
9
|
+
import {useTable} from "../hooks";
|
|
10
|
+
import RowWrapper from "./RowWrapper";
|
|
11
|
+
import React from "$react";
|
|
12
|
+
import theme from "$theme";
|
|
13
|
+
export default function TableRowComponent({cells,rowKey,rowData,index,...rest}){
|
|
14
|
+
const {visibleColsNames,renderItem,renderSectionHeader,columns} = useTable();
|
|
15
|
+
const content = React.useMemo(()=>{
|
|
16
|
+
if(rowData.isSectionListHeader && typeof renderSectionHeader ==='function'){
|
|
17
|
+
return <RowWrapper style={[styles.row,theme.styles.pv1]}>
|
|
18
|
+
<Cell isSectionListHeader colSpan={visibleColsNames.length}>{renderSectionHeader({isSectionListHeader:true,rowData,item:rowData,index,rowIndex:index,isTable:true,rowKey})}</Cell>
|
|
19
|
+
</RowWrapper>
|
|
20
|
+
}
|
|
21
|
+
return visibleColsNames.map((columnField,cIndex)=>{
|
|
22
|
+
const columnDef = columns[columnField];
|
|
23
|
+
if(!isObj(columnDef)) return null;
|
|
24
|
+
return <Cell rowData={rowData} rowKey={rowKey} children={columnDef[columnField]} rowIndex={index} columnDef={columnDef} index={cIndex} key={columnField} columnField={columnField}/>
|
|
25
|
+
});
|
|
26
|
+
},[rowKey,index,JSON.stringify(visibleColsNames)]);
|
|
27
|
+
return <RowWrapper style={[styles.row]}>
|
|
28
|
+
{content}
|
|
29
|
+
</RowWrapper>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
TableRowComponent.propTypes = {
|
|
33
|
+
rowData : PropTypes.object.isRequired,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {Cell};
|
|
37
|
+
|
|
38
|
+
TableRowComponent.Cell = Cell;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScrollView } from "react-native";
|
|
2
|
+
import React from "$react";
|
|
3
|
+
const TableScrollViewNative = React.forwardRef(({children,...props},ref)=>{
|
|
4
|
+
return <ScrollView {...props} children={children} ref={ref}/>
|
|
5
|
+
});
|
|
6
|
+
TableScrollViewNative.displayName = "TableScrollViewNative";
|
|
7
|
+
|
|
8
|
+
export default TableScrollViewNative;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native"
|
|
2
|
+
import {classNames} from "$cutils";
|
|
3
|
+
export default function VirtuosoTableComponent({style,className,...props}){
|
|
4
|
+
return <table{...props} className={classNames(className,"virtuoso-table-component")} style={StyleSheet.flatten([{ borderCollapse: 'separate',width:"100%" },style])} />
|
|
5
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React,{useMemo,useContext,createContext} from "$react";
|
|
2
|
+
import {defaultStr,isObj} from "$cutils";
|
|
3
|
+
import {DEFAULT_COLUMN_WIDTH} from "./utils";
|
|
4
|
+
import Label from "$ecomponents/Label";
|
|
5
|
+
import HeaderCell from "./Header/Cell";
|
|
6
|
+
import { StyleSheet } from "react-native";
|
|
7
|
+
import styles from "./styles";
|
|
8
|
+
import theme from "$theme";
|
|
9
|
+
|
|
10
|
+
export const usePrepareColumns = ({columns,sortedColumn,forceRender,testID,renderFooterCell,renderHeaderCell,renderFilterCell,columnsWidths,headerCellContainerProps,colsWidths,columnProps,footers,footerCellContainerProps,filterCellContainerProps})=>{
|
|
11
|
+
return useMemo(()=>{
|
|
12
|
+
testID = defaultStr(testID,"RN_TableColumns")
|
|
13
|
+
const cols = {},headers = {},footers = {},filters = {},visibleColsNames = [],columnsVisibilities=[],columnsNames = [];
|
|
14
|
+
let hasFooters = false;
|
|
15
|
+
columnProps = defaultObj(columnProps);
|
|
16
|
+
let columnIndex = 0;
|
|
17
|
+
const widths = defaultObj(columnsWidths,colsWidths);
|
|
18
|
+
headerCellContainerProps = defaultObj(headerCellContainerProps);
|
|
19
|
+
footerCellContainerProps = defaultObj(footerCellContainerProps);
|
|
20
|
+
filterCellContainerProps = defaultObj(filterCellContainerProps);
|
|
21
|
+
Object.map(columns,(columnDef,field)=>{
|
|
22
|
+
if(!isObj(columnDef)) return;
|
|
23
|
+
const columnField = defaultStr(columnDef.field,field);
|
|
24
|
+
let {visible,width,type,style} = columnDef;
|
|
25
|
+
visible = typeof visible =='boolean'? visible : true;
|
|
26
|
+
type = defaultStr(type,"text").toLowerCase().trim();
|
|
27
|
+
width = defaultDecimal(widths[columnField],width,DEFAULT_COLUMN_WIDTH);
|
|
28
|
+
const colArgs = {width,type,columnDef,containerProps:{},columnField,index:columnIndex,columnIndex};
|
|
29
|
+
const content = typeof renderHeaderCell =='function'? renderHeaderCell(colArgs) : defaultVal(columnDef.text,columnDef.label,columnField);
|
|
30
|
+
const hContainerProps = defaultObj(colArgs.containerProps);
|
|
31
|
+
if(!React.isValidElement(content,true)){
|
|
32
|
+
console.error(content," is not valid element of header ",columnDef," it could not be render on table");
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const rArgs = {columnDef,width};
|
|
36
|
+
headers[columnField] = <HeaderCell {...rArgs} testID={testID+"_HeaderCell_"+columnField} {...headerCellContainerProps} {...hContainerProps} key={columnField} style={[styles.headerItem,styles.headerItemOrCell,headerCellContainerProps.style,hContainerProps.style,style]}>
|
|
37
|
+
<Label splitText numberOfLines={2} style={[theme.styles.w100,theme.styles.h100,{maxHeight:70}]} textBold primary>{content}</Label>
|
|
38
|
+
</HeaderCell>;
|
|
39
|
+
if(typeof renderFilterCell =='function'){
|
|
40
|
+
const filterCell = renderFilterCell(colArgs);
|
|
41
|
+
filters[columnField] = <HeaderCell {...rArgs} testID={testID+"_Filter_Cell_"+columnField} {...filterCellContainerProps} key={columnField} style={[styles.headerItem,styles.headerItemOrCell,styles.filterCell,filterCellContainerProps.style,style]}>
|
|
42
|
+
{React.isValidElement(filterCell)? filterCell : null}
|
|
43
|
+
</HeaderCell>
|
|
44
|
+
}
|
|
45
|
+
if(typeof renderFooterCell ==='function') {
|
|
46
|
+
const footerProps = {...colArgs,containerProps:{}};
|
|
47
|
+
let cellFooter = renderFooterCell(footerProps);
|
|
48
|
+
let fContainerProps = {};
|
|
49
|
+
if(!React.isValidElement(cellFooter,true) && isObj(cellFooter)){
|
|
50
|
+
fContainerProps = isObj(cellFooter.containerProps)? cellFooter.containerProps : {};
|
|
51
|
+
cellFooter = React.isValidElement(cellFooter.children)? cellFooter.children : React.isValidElement(cellFooter.content)? cellFooter.content : null;
|
|
52
|
+
} else if(isObj(footerProps.containerProps)){
|
|
53
|
+
fContainerProps = footerProps.containerProps;
|
|
54
|
+
}
|
|
55
|
+
cellFooter = React.isValidElement(cellFooter,true)? cellFooter : null;
|
|
56
|
+
if(!hasFooters && cellFooter){
|
|
57
|
+
hasFooters = true;
|
|
58
|
+
}
|
|
59
|
+
footers[columnField] = <HeaderCell {...rArgs} testID={testID+"_Footer_Cell_"+columnField} key={columnField} style={[styles.headerItem,styles.headerItemOrCell,footerCellContainerProps.style,style]}>
|
|
60
|
+
<Label primary children={cellFooter}/>
|
|
61
|
+
</HeaderCell>
|
|
62
|
+
}
|
|
63
|
+
columnsVisibilities.push(visible);
|
|
64
|
+
if(visible){
|
|
65
|
+
visibleColsNames.push(columnField);
|
|
66
|
+
}
|
|
67
|
+
columnsNames.push(columnField);
|
|
68
|
+
cols[columnField] = {
|
|
69
|
+
...columnDef,
|
|
70
|
+
width,
|
|
71
|
+
index : columnIndex,
|
|
72
|
+
field : columnField,
|
|
73
|
+
visible,
|
|
74
|
+
columnField,
|
|
75
|
+
};
|
|
76
|
+
columnIndex++;
|
|
77
|
+
});
|
|
78
|
+
return {columns:cols,columnsNames,headers,columnsVisibilities,visibleColsNames,hasFooters,footers,filters};
|
|
79
|
+
},[columns,sortedColumn,footers,forceRender]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const TableContext = createContext(null);
|
|
83
|
+
|
|
84
|
+
export const useTable = ()=> useContext(TableContext);
|