@fto-consult/expo-ui 6.71.7 → 6.72.1
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
@@ -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
|
-
{
|
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
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
|
@@ -318,14 +318,14 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
318
318
|
isUpdated,
|
319
319
|
fields,
|
320
320
|
});
|
321
|
-
const cCloneAction = this.isClonable() && this.canCreateNew() && clonable !== false
|
321
|
+
const cCloneAction = this.isClonable() && this.canCreateNew() && clonable !== false && cloneAction !== false && true || false;
|
322
322
|
const rActionsArg = this.currentRenderingProps = {
|
323
323
|
...rest,
|
324
324
|
...formProps,
|
325
325
|
context,
|
326
326
|
cloneAction : cCloneAction,
|
327
327
|
save2newAction : this.canCreateNew() && save2newAction !== false ? true : false,
|
328
|
-
save2cloneAction :
|
328
|
+
save2cloneAction : cCloneAction && save2cloneAction !== false ? true : false,
|
329
329
|
isMobile : isMobOrTab,
|
330
330
|
saveAction,
|
331
331
|
save2closeAction,
|
@@ -126,17 +126,17 @@ export function renderActions({context,isUpdate,newElementLabel,readablePerms:c
|
|
126
126
|
flat : true,
|
127
127
|
onPress : createCallback({context:self,action:'save2close',callback:onPressToSave})
|
128
128
|
}, save2new = (save2newAction !== false && !readOnly && permsObj.canSave2New && !hasManyData)?{
|
129
|
-
text : textSave+'& '+newElementLabel,
|
130
|
-
title : textSave+'& '+newElementLabel,
|
129
|
+
text : textSave+' & '+newElementLabel,
|
130
|
+
title : textSave+' & '+newElementLabel,
|
131
131
|
isAction : true,
|
132
132
|
shortcut : "save2new",
|
133
133
|
icon : 'content-save-edit',
|
134
134
|
flat : true,
|
135
135
|
onPress : createCallback({context:self,action:'save2new',callback:onPressToSave})
|
136
136
|
} : null
|
137
|
-
,save2clone = (save2cloneAction !== false && cloneAction !== false && !readOnly &&
|
138
|
-
text : textSave+'& Dupliquer',
|
139
|
-
title : textSave+'& Dupliquer',
|
137
|
+
,save2clone = (save2cloneAction !== false && cloneAction !== false && !readOnly && permsObj.canSave && permsObj.canCreate)?{
|
138
|
+
text : textSave+' & Dupliquer',
|
139
|
+
title : textSave+' & Dupliquer',
|
140
140
|
isAction : true,
|
141
141
|
shortcut : "save2clone",
|
142
142
|
icon : 'content-save-move',
|