@fto-consult/expo-ui 6.32.4 → 6.32.5
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/Common/Common.js +1 -1
- package/src/components/List/Virtuoso/index.js +2 -2
- package/src/components/Table/Row/Cell/index.js +3 -0
- package/src/components/Table/Row/RowWrapper.js +3 -1
- package/src/components/Table/Row/SectionListHeaderRow.js +8 -1
- package/src/components/Table/Row/index.js +3 -6
- package/src/components/Table/index.js +1 -1
package/package.json
CHANGED
|
@@ -2934,7 +2934,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2934
2934
|
rowStyle.push(style);
|
|
2935
2935
|
}
|
|
2936
2936
|
}
|
|
2937
|
-
|
|
2937
|
+
const cells = [];
|
|
2938
2938
|
const Cell = React.isComponent(args.Cell) ? args.Cell : View;
|
|
2939
2939
|
const isA = this.isAccordion();
|
|
2940
2940
|
const sectionListHeaderProps = defaultObj(args.sectionListHeaderProps);
|
|
@@ -286,9 +286,9 @@ const normalizeEvent = (e)=>{
|
|
|
286
286
|
document.body.appendChild(style);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
export const TableRowComponent = ({testID,style,...props}) => {
|
|
289
|
+
export const TableRowComponent = ({testID,style,children,isSectionListHeader,rowData,...props}) => {
|
|
290
290
|
const index = props['data-index'];
|
|
291
291
|
const isOdd = typeof index =='number' ? index%2 > 0 : false;
|
|
292
292
|
testID = defaultStr(testID,"_VirtuosoTableRow_"+index);
|
|
293
|
-
return <tr data-test-id={testID} {...props} style={StyleSheet.flatten(style)} className={classNames(props.className,"virtuoso-table-row",`table-row-${isOdd?"odd":"even"}`)}/>
|
|
293
|
+
return <tr data-test-id={testID} {...props} children={children} style={StyleSheet.flatten(style)} className={classNames(props.className,"virtuoso-table-row",`table-row-${isOdd?"odd":"even"}`)}/>
|
|
294
294
|
};
|
|
@@ -14,6 +14,9 @@ const TableRowCellComponent = React.forwardRef(({children,columnDef,className,co
|
|
|
14
14
|
const {renderCell,colsWidths} = useTable();
|
|
15
15
|
const width = colsWidths && columnField ? colsWidths[columnField] : undefined;
|
|
16
16
|
const {content,containerProps} = React.useMemo(()=>{
|
|
17
|
+
if(!isObj(rowData)){
|
|
18
|
+
return {content:null};
|
|
19
|
+
}
|
|
17
20
|
const rArgs = {...rest,columnDef,columnField,rowData,width,rowIndex,containerProps : {}};
|
|
18
21
|
const r = typeof renderCell =='function' && renderCell (rArgs) || children;
|
|
19
22
|
return {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
2
|
|
|
3
|
-
const TableRowWrapperComponent = forwardRef(({children},ref)=>
|
|
3
|
+
const TableRowWrapperComponent = forwardRef(({children,...rest},ref)=>{
|
|
4
|
+
return children;
|
|
5
|
+
});
|
|
4
6
|
|
|
5
7
|
TableRowWrapperComponent.displayName = "TableRowWrapperComponent";
|
|
6
8
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import {useTable} from "../hooks";
|
|
2
|
+
export default function SectionListHeaderRow ({cells,rowIndex,rowData,headerContent}){
|
|
3
|
+
const {visibleColsNames} = useTable();
|
|
4
|
+
if(!Array.isArray(cells) || !cells.length){
|
|
5
|
+
return visibleColsNames.map((c,i)=>{
|
|
6
|
+
return <td key={i}/>
|
|
7
|
+
})
|
|
8
|
+
}
|
|
2
9
|
return cells;
|
|
3
10
|
}
|
|
@@ -15,12 +15,9 @@ const isNative = isMobileNative();
|
|
|
15
15
|
const nativeProps = isNative ? {} : {Cell,Row:SectionListHeaderRow};
|
|
16
16
|
export default function TableRowComponent({cells,rowKey,rowData,index,...rest}){
|
|
17
17
|
const {visibleColsNames,visibleColsNamesStr,renderSectionHeader,colsWidths,columns} = useTable();
|
|
18
|
-
if(!isObj(rowData)) {
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
18
|
const content = React.useMemo(()=>{
|
|
22
|
-
if(rowData
|
|
23
|
-
|
|
19
|
+
if(rowData?.isSectionListHeader){
|
|
20
|
+
if(typeof renderSectionHeader !='function'){
|
|
24
21
|
throw "Vous devez définir la fonction renderSectionListHeader, utile pour le rendu du contenu de section header de la table de données";
|
|
25
22
|
}
|
|
26
23
|
return renderSectionHeader({isSectionListHeader:true,renderSectionListHeaderOnFirstCell:true,
|
|
@@ -33,7 +30,7 @@ export default function TableRowComponent({cells,rowKey,rowData,index,...rest}){
|
|
|
33
30
|
return visibleColsNames.map((columnField,cIndex)=>{
|
|
34
31
|
const columnDef = columns[columnField];
|
|
35
32
|
if(!isObj(columnDef)) return null;
|
|
36
|
-
return <Cell rowData={rowData} width={columnField ? colsWidths[columnField] : 0} rowKey={rowKey} children={rowData[columnField]} rowIndex={index} columnDef={columnDef} index={cIndex} key={columnField} columnField={columnField}/>
|
|
33
|
+
return <Cell rowData={rowData} width={columnField ? colsWidths[columnField] : 0} rowKey={rowKey} children={rowData && rowData[columnField]||null} rowIndex={index} columnDef={columnDef} index={cIndex} key={columnField} columnField={columnField}/>
|
|
37
34
|
});
|
|
38
35
|
},[rowKey,index,visibleColsNamesStr]);
|
|
39
36
|
return <RowWrapper {...rest} rowKey={rowKey} rowData={rowData} rowIndex={index} style={[styles.row]}>
|
|
@@ -257,7 +257,7 @@ const TableComponent = React.forwardRef(({containerProps,listContainerStyle,onRe
|
|
|
257
257
|
if(!item) return null;
|
|
258
258
|
const args = {rowData:item,rowIndex:index,index,bordered,isTable:true};
|
|
259
259
|
args.selected = withDatagridContext ? useIsRowSelected(item,index) : false;
|
|
260
|
-
return <TableRowComponent {...props} className={classNames(props.className,"table-row-tr")} style={[getRowStyle(args),styles.tr,props.style]}/>
|
|
260
|
+
return <TableRowComponent rowData={item} isSectionListHeader={item?.isSectionListHeader} {...props} className={classNames(props.className,"table-row-tr")} style={[getRowStyle(args),styles.tr,props.style]}/>
|
|
261
261
|
},
|
|
262
262
|
Table: VirtuosoTableComponent,
|
|
263
263
|
EmptyPlaceholder : (props)=>{
|