@fto-consult/expo-ui 2.48.4 → 2.48.6

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.
@@ -4,6 +4,7 @@ import Dimensions from "$cplatform/dimensions";
4
4
  import {defaultStr,isObj,defaultObj,isNonNullString,defaultVal,defaultFunc} from "$utils";
5
5
  import React from "$react";
6
6
  import {isWeb} from "$cplatform";
7
+ import PropTypes from "prop-types";
7
8
 
8
9
  export default class FormDataActionComponent extends FormData {
9
10
  isFullScreen(){
@@ -31,13 +32,25 @@ export default class FormDataActionComponent extends FormData {
31
32
  const isEditing = this.isDocEditing(data);
32
33
  let subtitle = (isEditing?'Modifier':this.getNewElementLabel());
33
34
  let title = React.getTextContent(defaultVal(appBarProps.title,mainProps.title,this.props.title));
34
- if(isEditing){
35
- let _title = this.getPrimaryKeysFieldsValueText(data);
36
- if(isNonNullString(_title)){
37
- subtitle+= " ["+_title+"]"
35
+ const cArgs = {...mainProps,isEditing,isDocUpdate:isEditing,isUpdate:isEditing,data};
36
+ if(typeof this.props.getAppBarTitle =='function'){
37
+ title = defaultStr(this.props.getAppBarTitle(cArgs),title)
38
+ }
39
+ let hasFoundSubtitle = false;
40
+ if(typeof this.props.getAppBarSubtitle =='function'){
41
+ const st = this.props.getAppBarSubtitle(cArgs);
42
+ hasFoundSubtitle = st === false || isNonNullString(st);
43
+ subtitle = hasFoundSubtitle ? st : subtitle;
44
+ }
45
+ if(!hasFoundSubtitle){
46
+ if(isEditing){
47
+ let _title = this.getPrimaryKeysFieldsValueText(data);
48
+ if(isNonNullString(_title)){
49
+ subtitle+= " ["+_title+"]"
50
+ }
51
+ } else {
52
+ subtitle = " ["+subtitle+"]";
38
53
  }
39
- } else {
40
- subtitle = " ["+subtitle+"]";
41
54
  }
42
55
  if(this.props.title !== false && mainProps.title !== false) {
43
56
  appBarProps.title = title;
@@ -147,4 +160,6 @@ export default class FormDataActionComponent extends FormData {
147
160
 
148
161
  FormDataActionComponent.propTypes = {
149
162
  ...FormData.propTypes,
163
+ getAppBarTitle: PropTypes.func,//la fonction pour récupérer l'appbat title
164
+ getAppBarSubtitle : PropTypes.func, //la fonction pour récupérer le subtitle de l'appBar
150
165
  }
@@ -142,7 +142,6 @@ export default class TableDataScreenComponent extends FormDataScreen{
142
142
  archiveProp : {value : typeof mainProps.archive =='function' && mainProps.archive || undefined },
143
143
  testIDProp : {value : defaultStr(mainProps.testID)},
144
144
  showPreloaderOnUpsert : {value : mainProps.showPreloaderOnUpsert},
145
- isDocEditingProp : {value : typeof mainProps.isDocEditing =='function'? mainProps.isDocEditing : typeof mainProps.isDocUpdate =='function'? mainProps.isDocUpdate : undefined}
146
145
  });
147
146
  this.hidePreloader = this.hidePreloader.bind(this);
148
147
  this.showPreloader = this.showPreloader.bind(this);
@@ -281,6 +280,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
281
280
  if(isObj(customFields)){
282
281
  extendObj(true,fields,customFields);
283
282
  }
283
+ console.log(this.primaryKeyFields," is pkeyFields heeeee");
284
284
  ///on effectue une mutator sur le champ en cours de modification
285
285
  if(typeof prepareField =='function'){
286
286
  Object.map(fields,(field,i,counterIndex)=>{
@@ -525,10 +525,13 @@ export default class TableDataScreenComponent extends FormDataScreen{
525
525
  }
526
526
  isDocEditing(data){
527
527
  data = defaultObj(data);
528
- if(!this.isDocEditingProp){
528
+ const isDocEditingCb = typeof this.props.isDocEditing =='function'? this.props.isDocEditing : typeof this.props.isDocUpdate =='function'? this.props.isDocUpdate : undefined;
529
+ if(!isDocEditingCb){
529
530
  if(isDocEditing(data,this.primaryKeyFields,({index:field,data})=>{
530
531
  return checkPrimary(data,field);
531
532
  })) return true;
533
+ } else {
534
+ return isDocEditingCb(data,{context:this});
532
535
  }
533
536
  return super.isDocEditing(data);
534
537
  }