@fto-consult/expo-ui 6.71.7 → 6.72.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.71.7",
3
+ "version": "6.72.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -3925,6 +3925,9 @@ CommonDatagridComponent.propTypes = {
3925
3925
  showFooters : PropTypes.bool,
3926
3926
  /*** les donnnées peuvent être soient retournées par une fonction, soit par un tableau soit une promesse */
3927
3927
  data : PropTypes.oneOfType([PropTypes.array, PropTypes.func,PropTypes.object]),//.isRequired,
3928
+ /****
3929
+ la prop column def contient dans la propriété datagrid, la prop maxItemsToRender, le nombre d'items maximal à rendre pour le composant de type select table data multiple
3930
+ */
3928
3931
  columns:PropTypes.oneOfType([PropTypes.array,PropTypes.object]),//.isRequired,
3929
3932
  selectable : PropTypes.bool, //si les lignes sont sélectionnables,
3930
3933
  /*** Si plusieurs lignes peuvent être sélectionnées au même moment */
@@ -1,7 +1,7 @@
1
1
  // Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
- import {isNonNullString,isArray,isObjOrArray,defaultStr,defaultArray,defaultObj,isObj} from "$cutils";
4
+ import {isNonNullString,isArray,isObjOrArray,maxItemsToRender,defaultStr,defaultArray,defaultObj,isObj} from "$cutils";
5
5
  import Hashtag from "$ecomponents/Hashtag";
6
6
  import DateLib from "$date";
7
7
  import Image from "$ecomponents/Image";
@@ -82,22 +82,36 @@ export const renderRowCell = (arg)=>{
82
82
  const sepp = ",";
83
83
  if(columnDef.multiple && id.contains(sepp)){
84
84
  let hasC = false,sep2 ="";
85
+ const maxItemsToRender = defaultNumber(columnDef?.datagrid?.maxItemsToRender,5);
86
+ let renderedItems = 0;
87
+ const idSplit = id.split(sepp);
85
88
  _render = <View style={[style,theme.styles.row,theme.styles.flexWrap]} testID={"RN_RowCell_"+columnDef.field+"multiple_"}>
86
- {id.split(sepp).map((idd,index)=>{
87
- if(!isNonNullString(idd)) return null;
89
+ {idSplit.map((idd,index)=>{
90
+ if(!isNonNullString(idd) || maxItemsToRender === renderedItems) return null;
88
91
  idd = idd.trim();
89
92
  if(!idd) return null;
90
93
  if(hasC){
91
94
  sep2=", ";
92
95
  }
93
96
  hasC = true;
94
- return <TableLink
95
- key = {index}
96
- {...rProps}
97
- id = {idd}
98
- >
99
- {sep2+idd}
100
- </TableLink>
97
+ renderedItems++;
98
+ const suffix = renderedItems === maxItemsToRender && idSplit.length > maxItemsToRender ? <Label>...</Label> : null;
99
+ return suffix ? <>
100
+ <TableLink
101
+ key = {index}
102
+ {...rProps}
103
+ id = {idd}
104
+ >
105
+ {sep2+idd}
106
+ </TableLink>
107
+ {suffix}
108
+ </> : <TableLink
109
+ key = {index}
110
+ {...rProps}
111
+ id = {idd}
112
+ >
113
+ {sep2+idd}
114
+ </TableLink>
101
115
  })}
102
116
  </View>
103
117