@fto-consult/expo-ui 5.7.3 → 5.7.4
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": "5.7.
|
|
3
|
+
"version": "5.7.4",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@emotion/native": "^11.10.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^3.10.
|
|
64
|
+
"@fto-consult/common": "^3.10.39",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "^1.17.11",
|
|
67
67
|
"@react-native-community/datetimepicker": "^6.7.3",
|
|
@@ -766,6 +766,9 @@ class DropdownComponent extends AppComponent {
|
|
|
766
766
|
if(disabled || readOnly || editable === false){
|
|
767
767
|
showAdd = false;
|
|
768
768
|
}
|
|
769
|
+
if(typeof showAdd ==='function'){
|
|
770
|
+
showAdd = showAdd(props);
|
|
771
|
+
}
|
|
769
772
|
showAdd = defaultBool(showAdd,false);
|
|
770
773
|
if(addIcon ===false) {
|
|
771
774
|
showAdd = false;
|
|
@@ -1314,7 +1317,10 @@ DropdownComponent.propTypes = {
|
|
|
1314
1317
|
]),
|
|
1315
1318
|
/*** la liste des champs qu'on peut trier sur forme de clé/libelé */
|
|
1316
1319
|
sortableFields : PropTypes.object,
|
|
1317
|
-
showAdd : PropTypes.
|
|
1320
|
+
showAdd : PropTypes.oneOfType([
|
|
1321
|
+
PropTypes.func,
|
|
1322
|
+
PropTypes.bool,
|
|
1323
|
+
]),
|
|
1318
1324
|
onAdd : PropTypes.func,
|
|
1319
1325
|
getItemKey : PropTypes.func,///la fonction prenant en paramètre un item et retourne sa clé unique
|
|
1320
1326
|
}
|
|
@@ -250,10 +250,13 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
250
250
|
this.INITIAL_STATE.archived = archived;
|
|
251
251
|
this.INITIAL_STATE.tableName = tableName;
|
|
252
252
|
const fields = {};
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
const fieldsToPrepare = extendObj({},true,this.fields,customFields);
|
|
254
|
+
const prepareCb = typeof prepareField =='function'? prepareField : x=> x;
|
|
255
|
+
///on effectue une mutator sur le champ en cours de modification
|
|
256
|
+
Object.map(fieldsToPrepare,(field,i,counterIndex)=>{
|
|
257
|
+
const currentField = isObj(field)?Object.clone(field):field;
|
|
255
258
|
if(isObj(field)){
|
|
256
|
-
const
|
|
259
|
+
const columnField = defaultStr(currentField.field,i);
|
|
257
260
|
/**** lorsqu'un champ porte la propriété visibleOnlyOnEditing à true alors ce champ sera disponible uniquement en cas de modification */
|
|
258
261
|
if(currentField.visibleOnlyOnEditing === true && !isUpdated){
|
|
259
262
|
currentField.form = false;
|
|
@@ -265,10 +268,9 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
265
268
|
currentField.readOnly = true;
|
|
266
269
|
}
|
|
267
270
|
});
|
|
268
|
-
const
|
|
271
|
+
const cArgs = {field:currentField,columnField,columnDef:currentField,isUpdate:isUpdated,name:columnField,index:i,counterIndex,isPrimary,fields:fieldsToPrepare,contex:this,data:this.getCurrentData(),datas,currentIndex,isUpdated,tableName,table};
|
|
269
272
|
if(isUpdated){
|
|
270
273
|
//la props readOnlyOnEditing permet de rendre le champ readOnly en cas de mise à jour de la tableData
|
|
271
|
-
const cArgs = {...this.state,columnField,columnDef:currentField,field:columnField,data:this.getCurrentData()};
|
|
272
274
|
const readOnlyOnEditing = typeof currentField.readOnlyOnEditing =='function'? currentField.readOnlyOnEditing(cArgs) : currentField.readOnlyOnEditing;
|
|
273
275
|
if((readOnlyOnEditing === true)){
|
|
274
276
|
currentField.readOnly = true;
|
|
@@ -278,25 +280,16 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
278
280
|
currentField.disabled = true;
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
fields[i] = currentField;
|
|
284
|
-
})
|
|
285
|
-
if(isObj(customFields)){
|
|
286
|
-
extendObj(true,fields,customFields);
|
|
287
|
-
}
|
|
288
|
-
///on effectue une mutator sur le champ en cours de modification
|
|
289
|
-
if(typeof prepareField =='function'){
|
|
290
|
-
Object.map(fields,(field,i,counterIndex)=>{
|
|
291
|
-
if(!isObj(field)) return;
|
|
292
|
-
const name = defaultStr(field.field,i);
|
|
293
|
-
const isPrimary = this.primaryKeyFields[name] && true || false;
|
|
294
|
-
const f = prepareField({field,columnField:name,columnDef:field,isUpdate:isUpdated,name,index:i,counterIndex,isPrimary,fields,contex:this,data,datas,currentIndex,isUpdated,tableName,table});
|
|
283
|
+
const isPrimary = this.primaryKeyFields[columnField] && true || false;
|
|
284
|
+
const f = prepareCb(cArgs);
|
|
295
285
|
if(f === false) {
|
|
296
286
|
delete fields[i];
|
|
287
|
+
return;
|
|
297
288
|
}
|
|
298
|
-
|
|
299
|
-
|
|
289
|
+
|
|
290
|
+
}
|
|
291
|
+
fields[i] = currentField;
|
|
292
|
+
});
|
|
300
293
|
const context = this;
|
|
301
294
|
const formProps = ({
|
|
302
295
|
...defaultObj(customFormProps),
|