@fto-consult/expo-ui 6.31.1 → 6.31.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.31.1",
3
+ "version": "6.31.5",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -68,7 +68,7 @@
68
68
  "@expo/html-elements": "^0.5.1",
69
69
  "@expo/vector-icons": "^13.0.0",
70
70
  "@faker-js/faker": "^8.0.2",
71
- "@fto-consult/common": "^3.30.19",
71
+ "@fto-consult/common": "^3.32.1",
72
72
  "@pchmn/expo-material3-theme": "^1.3.1",
73
73
  "@react-native-async-storage/async-storage": "1.18.2",
74
74
  "@react-native-community/datetimepicker": "7.2.0",
@@ -78,7 +78,7 @@
78
78
  "@react-navigation/native-stack": "^6.9.13",
79
79
  "@shopify/flash-list": "1.4.3",
80
80
  "apexcharts": "^3.42.0",
81
- "expo": "^49.0.8",
81
+ "expo": "^49.0.9",
82
82
  "expo-camera": "~13.4.2",
83
83
  "expo-clipboard": "~4.3.1",
84
84
  "expo-font": "~11.4.0",
@@ -104,8 +104,8 @@
104
104
  "react-native-gesture-handler": "^2.12.1",
105
105
  "react-native-iphone-x-helper": "^1.3.1",
106
106
  "react-native-mime-types": "^2.4.0",
107
- "react-native-paper": "^5.10.3",
108
- "react-native-paper-dates": "^0.18.20",
107
+ "react-native-paper": "^5.10.4",
108
+ "react-native-paper-dates": "^0.18.24",
109
109
  "react-native-reanimated": "~3.3.0",
110
110
  "react-native-safe-area-context": "4.6.3",
111
111
  "react-native-screens": "~3.22.0",
@@ -15,7 +15,7 @@ export const ChartComponent = React.forwardRef(({chartContext,testID,chartId,id,
15
15
  webViewRef.current.injectJavaScript(`
16
16
  const method = "${method}";
17
17
  const chartId = "${chartId}";
18
- const a = ${typeof a =='string'? '"'+a.replaceAll('"','\"')+'"':typeof a =='boolean'? a : a && typeof a =='object'? JSON.stringify(a):undefined};
18
+ const a = ${typeof a =='string'? '"'+a.replaceAll('"','\"')+'"':typeof a =='boolean' || typeof a =="number" ? a : a && typeof a =='object'? JSON.stringify(a):undefined};
19
19
  let element = document.getElementById(chartId);
20
20
  if(!element){
21
21
  element = document.createElement("div");
@@ -37,8 +37,8 @@ export const ChartComponent = React.forwardRef(({chartContext,testID,chartId,id,
37
37
  //@see : https://apexcharts.com/docs/methods/
38
38
  methodsNames.map((cb)=>{
39
39
  if(cb !=='exec'){
40
- chartContext.current[cb]=(a,b,c,d,e)=>{
41
- return exec(cb,a,b,c,d,e);
40
+ chartContext.current[cb]=(...args)=>{
41
+ return exec(cb,...args);
42
42
  }
43
43
  }
44
44
  });
@@ -359,7 +359,7 @@ const DatagridFactory = (Factory)=>{
359
359
  const descriptionColor = Colors.isValid(descriptionStyle.color) ? descriptionStyle.color : Colors.isValid(descOrContentProps.color)? descOrContentProps.color : Colors.setAlpha(theme.colors.text,theme.ALPHA);
360
360
  this.accordionDescriptionProps = {
361
361
  ellipsizeMode: EllipsizeMode.tail,
362
- numberOfLines : 2,
362
+ numberOfLines : 3,
363
363
  ...descOrContentProps,
364
364
  color : descriptionColor,
365
365
  style : [styles.description,rStyles.lineHeight,descriptionStyle],
@@ -11,11 +11,12 @@ import { StyleSheet } from "react-native";
11
11
  import Label from "$ecomponents/Label";
12
12
  import { useWindowDimensions } from "react-native";
13
13
  import {useDatagrid,useGetSelectedRowsCount} from "../hooks";
14
- export default function DatagridActions ({actions,actionProps,...props}){
14
+ export default function DatagridActions ({actions,title,actionProps,...props}){
15
15
  const {context} = useDatagrid();
16
+ const forceRender = React.useForceRender();
16
17
  const selectedRowsCount = useGetSelectedRowsCount();
17
18
  useWindowDimensions();
18
- const selected = !!selectedRowsCount;
19
+ const selected = selectedRowsCount>0;
19
20
  actions = selected ? context?.renderSelectedRowsActions.call(context,{}) : actions;
20
21
  if(selected){
21
22
  actionProps = Object.assign({},actionProps);
@@ -36,9 +37,11 @@ export default function DatagridActions ({actions,actionProps,...props}){
36
37
  }
37
38
  const splitedActions = isObjOrArray(actions)? splitActions({...props,...sArg,actionProps,actions,isAppBarAction:false,alwaysSplitOnMobile:true}) : undefined;
38
39
  let contextualTitle = "";
39
- if(selectedRowsCount > 0){
40
+ if(selected){
40
41
  let sLetter = (selectedRowsCount>1?'s':'');
41
42
  contextualTitle = (selectedRowsCount<10?'0':'')+selectedRowsCount+(' ligne'+sLetter+' sélectionnée'+sLetter),1;
43
+ } else if(React.isValidElement(title,true)){
44
+ contextualTitle = title;
42
45
  }
43
46
  const children = renderSplitedActions(splitedActions,{
44
47
  anchor : (props)=>{
@@ -1011,7 +1011,7 @@ export default class CommonDatagridComponent extends AppComponent {
1011
1011
  return null;
1012
1012
  }
1013
1013
  renderDataSourceSelector(){
1014
- const t = isNonNullString(this.props.title)? <Label testID={"RN_DatagridTitleProp"}>{this.props.title}</Label> : React.isValidElement(this.props.title)? this.props.title : null;
1014
+ const t = !this.props.handleTitle ? null : isNonNullString(this.props.title) || typeof this.props.title ==='number' ? <Label textBold primary style={[theme.styles.fs14]} testID={"RN_DatagridTitleProp"}>{this.props.title}</Label> : React.isValidElement(this.props.title)? this.props.title : null;
1015
1015
  const table = defaultStr(this.props.table,this.props.tableName);
1016
1016
  const dS = dS === false ? null : typeof this.props.dataSourceSelector ==='function'? this.props.dataSourceSelector({
1017
1017
  defaultValue : this.currentDataSources,
@@ -1691,7 +1691,7 @@ export default class CommonDatagridComponent extends AppComponent {
1691
1691
  }
1692
1692
  ///reoturne les options de menus à appliquer sur le char
1693
1693
  getChartMenus(){
1694
- return [
1694
+ const menus = [
1695
1695
  {
1696
1696
  text : "Options du graphe",
1697
1697
  textBold : true,
@@ -1702,7 +1702,23 @@ export default class CommonDatagridComponent extends AppComponent {
1702
1702
  icon : "download",
1703
1703
  onPress : this.downloadChart.bind(this),
1704
1704
  }
1705
- ]
1705
+ ];
1706
+ Object.map(this.props.chartActions,(menu,t)=>{
1707
+ if(!isObj(menu)) return;
1708
+ const {onPress} = menu;
1709
+ menus.push({
1710
+ ...menu,
1711
+ onPress : (event)=>{
1712
+ if(!this.chartRef.current) return;
1713
+ const args = React.getOnPressArgs(event);
1714
+ args.chartContext = this.chartRef.current;
1715
+ if(typeof onPress =='function'){
1716
+ onPress(args);
1717
+ }
1718
+ }
1719
+ })
1720
+ })
1721
+ return menus;
1706
1722
  }
1707
1723
  getExportableFields(){
1708
1724
  return {
@@ -3257,10 +3273,7 @@ export default class CommonDatagridComponent extends AppComponent {
3257
3273
  arg.data = d.data;
3258
3274
  arg.total = defaultNumber(arg.total,arg.data.total);
3259
3275
  }
3260
- /*if(typeof arg.total != 'number'){
3261
- arg.total = Object.size(arg.data);
3262
- }*/
3263
- const {cb,total,data} = arg;
3276
+ const {cb,data} = arg;
3264
3277
  return new Promise((resolve)=>{
3265
3278
  this.prepareData(arg,(state)=>{
3266
3279
  state.data = Array.isArray(state.data)? state.data : [];
@@ -3856,6 +3869,10 @@ CommonDatagridComponent.propTypes = {
3856
3869
  PropTypes.object,
3857
3870
  PropTypes.object,
3858
3871
  ]),
3872
+ chartActions : PropTypes.oneOfType([
3873
+ PropTypes.object,
3874
+ PropTypes.array, //les actions supplémentaires à passer au graphe chart
3875
+ ]),
3859
3876
  /*** si l'opérateur or de filtre est accepté */
3860
3877
  filterOrOperator : PropTypes.bool,
3861
3878
  /*** si l'opérateur and de filtre est accepté */
@@ -4070,6 +4087,7 @@ CommonDatagridComponent.propTypes = {
4070
4087
  canFetchOnlyVisibleColumns : PropTypes.bool,//si l'on peut modifier le type d'affichage lié à la possibilité de récupérer uniquement les données reletives aux colonnes visibles
4071
4088
  useLinesProgressBar : PropTypes.bool,//si le progress bar lignes horizontale seront utilisés
4072
4089
  abreviateValues : PropTypes.bool, //si les valeurs numériques seront abregées
4090
+ handleTitle : PropTypes.bool,//si le titre du datagrid, props title, sera pris en compte dans les actions du datagrid, pour le rendu du DataSourceSelector, fonction renderDataSourceSelector
4073
4091
  checkPerms : PropTypes.func,//la fonction utilisée pour vérifier les permissions de l'utilisateur
4074
4092
  }
4075
4093
 
@@ -76,7 +76,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
76
76
  table,
77
77
  data:customData,
78
78
  saveButton,
79
- title,
79
+ title:customTitle,
80
80
  fab,
81
81
  rowKey,
82
82
  actions,
@@ -100,6 +100,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
100
100
  sort,
101
101
  defaultSortColumn,
102
102
  defaultSortOrder,
103
+ isLoading : customIsLoading,
103
104
  ...rest
104
105
  } = props;
105
106
  const {swrConfig} = useContext();
@@ -124,7 +125,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
124
125
  const isExportable = !!Auth.isTableDataAllowed({table:tableName,action:'export'});
125
126
  rest.exportable = isExportable;
126
127
  rowKey = defaultStr(rowKey,table.rowKey,table.primaryKeyColumnName);
127
- title = defaultStr(title,table.label,table.text)
128
+ const title = React.isValidElement(customTitle,true) && customTitle || defaultStr(table.label,table.text)
128
129
  columns = table.fields;
129
130
  const fetchFields = [];
130
131
  Object.map(columns,(column,i)=>{
@@ -148,7 +149,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
148
149
  rest.exportTableProps.pdf = defaultObj(rest.exportTableProps.pdf);
149
150
  rest.exportTableProps.pdf = extendObj(true,{},{
150
151
  fileName : rest.exportTableProps.fileName,
151
- title
152
+ title : React.getTextContent(title),
152
153
  },rest.exportTableProps.pdf);
153
154
  const fetchOptionsRef = React.useRef(defaultObj(customFetchOptions));
154
155
  const fPathRef = React.useRef(defaultStr(fetchPathKey,uniqid("fetchPath")));
@@ -204,9 +205,9 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
204
205
  });
205
206
  const dataRef = React.useRef(null);
206
207
  const totalRef = React.useRef(0);
207
- const loading = (isLoading || isValidating);
208
+ const loading = (customIsLoading === true || isLoading || isValidating);
208
209
  const {data,total} = React.useMemo(()=>{
209
- if(loading || !isObjOrArray(result)){
210
+ if((loading && customIsLoading !== false) || !isObjOrArray(result)){
210
211
  return {data:dataRef.current,total:totalRef.current};
211
212
  }
212
213
  let {data,total} = (Array.isArray(result) ? {data:result,total:result.length} : isObj(result)? result : {data:[],total:0});
@@ -296,6 +297,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
296
297
  testID = {testID}
297
298
  {...defaultObj(table.datagrid)}
298
299
  {...rest}
300
+ title = {customTitle || title || undefined}
299
301
  sort = {sort}
300
302
  onSort = {({sort})=>{
301
303
  sortRef.current = sort;
@@ -87,18 +87,18 @@ export const useBindEvent = (event,onEvent)=>{
87
87
  return onEvent;
88
88
  }
89
89
  export const useIsRowSelected = (...args)=>{
90
- return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
90
+ return useOnEvent([events.ON_ROW_TOGGLE,'componentDidUpdate',events.ON_ALL_ROWS_TOGGLE],(context)=>{
91
91
  return context.isRowSelected(...args);
92
92
  });
93
93
  };
94
94
 
95
95
  export const useGetSelectedRowsCount = ()=>{
96
- return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
96
+ return useOnEvent([events.ON_ROW_TOGGLE,'componentDidUpdate',events.ON_ALL_ROWS_TOGGLE],(context,...rest)=>{
97
97
  return context.getSelectedRowsCount();
98
98
  });
99
99
  }
100
100
  export const useIsAllRowsSelected = ()=>{
101
- return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
101
+ return useOnEvent([events.ON_ROW_TOGGLE,'componentDidUpdate',events.ON_ALL_ROWS_TOGGLE],(context)=>{
102
102
  return context.isAllRowsSelected();
103
103
  });
104
104
  };
@@ -1,5 +1,5 @@
1
1
  import {getAppBarActionsProps} from "./utils";
2
- import React, {Component as AppComponent} from "$react";
2
+ import React, {ObservableComponent as AppComponent} from "$react";
3
3
  import {isNonNullString,defaultStr,defaultNumber,defaultObj,extendObj,isObj,isFunction,defaultFunc,uniqid} from "$cutils";
4
4
  import {getForm,getFormField} from "../utils";
5
5
  import Surface from "$ecomponents/Surface";
@@ -281,6 +281,7 @@ export default class FormListComponent extends AppComponent {
281
281
  upsertEltProps,
282
282
  newElementLabel,
283
283
  parentData,
284
+ routeParams,
284
285
  ...rest
285
286
  } = this.props;
286
287
  rest = defaultObj(rest);
@@ -301,6 +302,7 @@ export default class FormListComponent extends AppComponent {
301
302
  formName,
302
303
  //fields,
303
304
  data,
305
+ ...defaultObj(routeParams)
304
306
  }
305
307
  if(typeof upsertEltProps =='function'){
306
308
  params = {...params,...defaultObj(upsertEltProps(params)),allData:this.state.allData,onSave : this.onSave.bind(this),show : this.show.bind(this),currentIndex : index,routeName,data:params.data,indexField}
@@ -542,7 +542,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
542
542
  {label}
543
543
  </Label> : null}
544
544
  <>
545
- <Surface testID={testID+"_TextFieldContentContainer"} {...contentContainerProps} elevation={0} style={[styles.contentContainer,{pointerEvents},!left? styles.paddingLeft:null,styles.row,contentContainerStyle,contentContainerProps.style]}>
545
+ <Surface elevation={isShadowMode?5:0} testID={testID+"_TextFieldContentContainer"} {...contentContainerProps} style={[styles.contentContainer,{pointerEvents},!left? styles.paddingLeft:null,styles.row,contentContainerStyle,contentContainerProps.style]}>
546
546
  {left ? (<View testID={testID+"_Left"} {...leftContainerProps} style={[styles.AdornmentContainer,styles.leftAdornment,leftContainerProps.style,disabledStyle]}>
547
547
  {left}
548
548
  </View>) : null}
@@ -24,6 +24,7 @@ import { generatedColumnsProperties,defaultArchivedPermsFilter } from "./utils";
24
24
  import {isDocEditing,checkPrimaryKey} from "$ecomponents/Form";
25
25
  import i18n from "$i18n";
26
26
  import fetch from "$capi/fetch";
27
+ import appConfig from "$capp/config";
27
28
 
28
29
 
29
30
  const HIDE_PRELOADER_TIMEOUT = 300;
@@ -36,9 +37,31 @@ const TIMEOUT = 50;
36
37
  export default class TableDataScreenComponent extends FormDataScreen{
37
38
  constructor(props){
38
39
  super(props);
39
- const mainProps = props;
40
- extendObj(this.state,this.prepareStateData(mainProps));
41
- const table = defaultObj(mainProps.table);
40
+ extendObj(this.state,this.prepareStateData(this.props));
41
+ this.hidePreloader = this.hidePreloader.bind(this);
42
+ this.showPreloader = this.showPreloader.bind(this);
43
+ const table = this.getTableObj();
44
+ Object.defineProperties(this,{
45
+ tableName : { value : defaultStr(table.table,table.tableName)},
46
+ table : {value : table},
47
+ })
48
+ this.init();
49
+ };
50
+ /**** retourne l'objet table, associé à la tableName */
51
+ getTableObj(){
52
+ const table = defaultObj(this.props.table);
53
+ if(Object.size(table,true)) return table;
54
+ if(typeof appConfig.getTable ==='function'){
55
+ return appConfig.getTable(defaultStr(this.props.tableName,this.props.table));
56
+ }
57
+ return {};
58
+ }
59
+ getNewElementLabel(...args){
60
+ const tableObj = this.getTableObj();
61
+ return tableObj?.newElementLabel ? tableObj?.newElementLabel : super.getNewElementLabel(...args);
62
+ }
63
+ init(){
64
+ const table = this.getTableObj();
42
65
  const fields = {},primaryKeyFields = {};
43
66
  Object.map(table.fields,(field,i)=>{
44
67
  if(isObj(field) && field.form !== false){
@@ -49,33 +72,34 @@ export default class TableDataScreenComponent extends FormDataScreen{
49
72
  if((f.type =='id' || f.type =='piece' || f.primaryKey || f.unique === true) && f.unique !== false && f.disabled !== true && f.readOnly !== true){
50
73
  const {onBlur} = f;
51
74
  f.onBlur = (args)=>{
75
+ if(isNonNullString(args.value)){
76
+ args.value = args.value.trim();
77
+ }
52
78
  args = {...f,...args,fetch,columnField:name,fieldName:name,id:args.value};
53
79
  const {context} = args;
54
80
  const r = typeof onBlur =='function'? onBlur (args) : undefined;
55
81
  if(r === false || (!args.value && typeof args.value != 'number')) return r;
56
82
  //on applique la validation seulement en cas de non mise à jour
57
83
  if(!this.isCurrentDocEditingUpdate() && context && typeof context.onNoValidate =='function'){
58
- const cb = typeof field.fetchUniqueId =='function'? field.fetchUniqueId : typeof this.props.fetchUniqueId =='function'? this.props.fetchUniqueId : undefined;
84
+ const cb = typeof field.fetchUniqueId =='function'? field.fetchUniqueId : this.fetchUniqueId.bind(this);
59
85
  if(cb){
60
86
  const r2 = cb(args);
61
- if(isPromise(r2)){
62
- r2.then((data)=>{
63
- let message = data;
64
- if(isObj(data) && Object.size(data,true)){
65
- message = i18n.lang('validate_rule_field_must_be_unique')+ defaultStr(f.label,f.text);
66
- }
67
- if(isNonNullString(message)){
68
- context.onNoValidate({...args,msg:message,message,context,validRule:context.getValidRule()});
69
- }
70
- }).catch((e)=>{
71
- if(e && e.status?.toString() == '404') return;
72
- console.log(e," fetching unique id on table data element id : ",args)
73
- const message = defaultStr(e?.message,e?.msg);
74
- if(message){
75
- context.onNoValidate({...args,msg:message,message,error:e,context,validRule:context.getValidRule()});
76
- }
77
- })
78
- }
87
+ (isPromise(r2)? r2 : Promise.resolve(r2)).then((data)=>{
88
+ let message = data;
89
+ if(isObj(data) && Object.size(data,true)){
90
+ message = i18n.lang('validate_rule_field_must_be_unique')+ defaultStr(f.label,f.text);
91
+ }
92
+ if(isNonNullString(message)){
93
+ context.onNoValidate({...args,msg:message,message,context,validRule:context.getValidRule()});
94
+ }
95
+ }).catch((e)=>{
96
+ if(e && e.status?.toString() == '404') return;
97
+ console.log(e," fetching unique id on table data element id : ",args)
98
+ const message = defaultStr(e?.message,e?.msg);
99
+ if(message){
100
+ context.onNoValidate({...args,msg:message,message,error:e,context,validRule:context.getValidRule()});
101
+ }
102
+ });
79
103
  }
80
104
  }
81
105
  return r;
@@ -89,19 +113,15 @@ export default class TableDataScreenComponent extends FormDataScreen{
89
113
  }
90
114
  });
91
115
  Object.defineProperties(this,{
92
- tableName : { value : defaultStr(table.table,table.tableName)},
93
116
  fields : {value : fields},
94
- table : {value : table},
95
- archivedPermsFilterFunc : {value : typeof mainProps.archivedPermsFilter =='function'? mainProps.archivedPermsFilter:defaultArchivedPermsFilter},
117
+ archivedPermsFilterFunc : {value : typeof this.props.archivedPermsFilter =='function'? this.props.archivedPermsFilter:defaultArchivedPermsFilter},
96
118
  isDocEditingRef : {value : {current:false}},
97
- closeOnSaveProp : {value : mainProps.closeOnSave || mainProps.closeAfterSave },
119
+ closeOnSaveProp : {value : this.props.closeOnSave || this.props.closeAfterSave },
98
120
  //la liste des champ de type clé primaire associés à la table
99
121
  primaryKeyFields : {value : primaryKeyFields},
100
- showPreloaderOnUpsert : {value : mainProps.showPreloaderOnUpsert},
122
+ showPreloaderOnUpsert : {value : this.props.showPreloaderOnUpsert},
101
123
  });
102
- this.hidePreloader = this.hidePreloader.bind(this);
103
- this.showPreloader = this.showPreloader.bind(this);
104
- };
124
+ }
105
125
  prepareStateData(props){
106
126
  const mainProps = defaultObj(props,this.props);
107
127
  const hasManyData = isObjOrArray(mainProps.datas) && Object.size(mainProps.datas,true) > 0 ? true : false;
@@ -116,6 +136,13 @@ export default class TableDataScreenComponent extends FormDataScreen{
116
136
  data : hasManyData ? defaultObj(cDatas[0]) : isObj(mainProps.data)? mainProps.data : {}
117
137
  };
118
138
  }
139
+ fetchUniqueId(...args){
140
+ const fetch = typeof this.props.fetchUniqueId =='function'? this.props.fetchUniqueId : undefined;
141
+ if(fetch){
142
+ return fetch(...args);
143
+ }
144
+ return undefined;
145
+ }
119
146
  isCurrentDocEditingUpdate(){
120
147
  return this.isDocEditingRef.current === true ? true : false;
121
148
  }
@@ -178,6 +205,12 @@ export default class TableDataScreenComponent extends FormDataScreen{
178
205
  getSessionName (){
179
206
  return defaultStr(this.props.sessionName,"table-form-data"+this.getTableName())
180
207
  }
208
+ prepareField(a,...args){
209
+ if(typeof this.props.prepareField =='function'){
210
+ return this.props.prepareField(a,...args);
211
+ }
212
+ return a;
213
+ }
181
214
  getComponentProps(props){
182
215
  const table = this.table;
183
216
  const {datas,currentIndex,data} = this.state;
@@ -217,9 +250,8 @@ export default class TableDataScreenComponent extends FormDataScreen{
217
250
  prepareField,
218
251
  prepareComponentProps,
219
252
  ...rest
220
- } = this.prepareComponentProps({...props,tableName,fields:extendObj({},true,this.fields,props.fields),isUpdated,isUpdate:isUpdated,data,datas,currentIndex});
253
+ } = this.prepareComponentProps({...props,tableName,context:this,fields:extendObj({},true,this.fields,props.fields),isUpdated,isUpdate:isUpdated,data,datas,currentIndex});
221
254
  const sessionName = this.getSessionName();
222
- const prepareCb = typeof prepareField =='function'? prepareField : x=> x;
223
255
  ///on effectue une mutator sur le champ en cours de modification
224
256
  Object.map(preparedFields,(field,i,counterIndex)=>{
225
257
  const currentField = isObj(field)?Object.clone(field):field;
@@ -259,7 +291,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
259
291
  this.primaryKeyFields[columnField] = true;
260
292
  }
261
293
  const isPrimary = this.primaryKeyFields[columnField] && true || false;
262
- const f = prepareCb(cArgs);
294
+ const f = this.prepareField(cArgs);
263
295
  if(f === false) {
264
296
  delete fields[i];
265
297
  return;
@@ -343,7 +375,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
343
375
  handleCustomRender(){
344
376
  return true;
345
377
  }
346
- componentWillRender(rActionsArg){
378
+ componentWillRender({...rActionsArg}){
347
379
  rActionsArg.context = this;
348
380
  const rActions = renderActions.call(this,rActionsArg);
349
381
  const renderedActs = this.renderActions(rActionsArg);
@@ -354,7 +386,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
354
386
  rActions[iPrefix+i] = a;
355
387
  });
356
388
  }
357
- rActionsArg.actions = rActions;
389
+ rActionsArg.actions = this.buttonsActions = rActions;
358
390
  return rActionsArg;
359
391
  }
360
392
  _render ({header,content,context}){
@@ -589,7 +621,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
589
621
  return Object.assign({},this.getCurrentData());
590
622
  }
591
623
  getAppBarActionsProps(props){
592
- return {...super.getAppBarActionsProps(props),data:this.getCurrentData()}
624
+ return {...super.getAppBarActionsProps(props),actions:this.buttonsActions,data:this.getCurrentData()}
593
625
  }
594
626
  /**** cette fonction est appelée immédiatement lorsque l'on clique sur le bouton enregistrer de l'un des actions du formulaire */
595
627
  onPressToSaveFormData(args){
@@ -756,6 +788,13 @@ export default class TableDataScreenComponent extends FormDataScreen{
756
788
  getTableName(){
757
789
  return this.tableName;
758
790
  }
791
+ getTableText(){
792
+ const tableObj = this.getTableObj();
793
+ return defaultStr(tableObj?.text,tableObj?.label);
794
+ }
795
+ getTableLabel(){
796
+ return this.getTableText();
797
+ }
759
798
  getMakePhoneCallProps (){
760
799
  const table = this.table;
761
800
  const makePhoneCallProps = defaultVal(this.props.makePhoneCallProps,table.makePhoneCallProps);
@@ -818,11 +857,6 @@ TableDataScreenComponent.propTypes = {
818
857
  ...defaultObj(FormData.propTypes),
819
858
  prepareComponentProps : PropTypes.func, //permet d'appreter les components props à utiliser pour le rendu des données
820
859
  prepareField : PropTypes.func,//La fonction permettant de faire des mutations sur le champ field à passer au formulaire form. si elle retourne false alors la field ne sera pas pris een compte
821
- table : PropTypes.shape({
822
- tableName : PropTypes.string,
823
- table : PropTypes.string,
824
- fields : PropTypes.object,
825
- }),
826
860
  unique : PropTypes.bool,//si la validation de type unique sur le champ sera effective
827
861
  fetchUniqueId : PropTypes.func,//la fonction permettant de fetch un élément unique pour la validation de type uniqueID, liée aux champs de type piece et id
828
862
  validateData : PropTypes.func,// la fonction permettant de valider les données à enregistrer
@@ -134,7 +134,7 @@ export function renderActions({context,isUpdate,newElementLabel,readablePerms:c
134
134
  flat : true,
135
135
  onPress : createCallback({context:self,action:'save2new',callback:onPressToSave})
136
136
  } : null;
137
- self.buttonsActions = {
137
+ return {
138
138
  print : (isUpdate && permsObj.canPrint)?{
139
139
  text : 'Imprimer',
140
140
  shortcut : 'print',
@@ -217,7 +217,6 @@ export function renderActions({context,isUpdate,newElementLabel,readablePerms:c
217
217
  onPress: createCallback({context:self,action:'copyToClipboard',callback:onPressCopyToClipboard})
218
218
  } : null,
219
219
  }
220
- return self.buttonsActions;
221
220
  }
222
221
 
223
222
 
@@ -1 +1 @@
1
- module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.31.0","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"},"@emotion/native":{"version":"11.11.0","url":"https://emotion.sh","license":"MIT"},"@emotion/react":{"version":"11.11.1","url":"https://github.com/emotion-js/emotion/tree/main/packages/react","license":"MIT"},"@expo/html-elements":{"version":"0.5.1","url":"https://github.com/expo/expo/tree/main/packages/html-elements","license":"MIT"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/vector-icons":{"version":"13.0.0","url":"https://expo.github.io/vector-icons","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"@faker-js/faker":{"version":"8.0.2","url":"https://github.com/faker-js/faker.git","license":"MIT"},"@fto-consult/common":{"version":"3.30.18","url":"https://github.com/borispipo/common#readme","license":"ISC"},"@pchmn/expo-material3-theme":{"version":"1.3.1","url":"https://github.com/pchmn/expo-material3-theme#readme","license":"MIT"},"@react-native-async-storage/async-storage":{"version":"1.18.2","url":"https://github.com/react-native-async-storage/async-storage#readme","license":"MIT"},"@react-native-community/datetimepicker":{"version":"7.2.0","url":"https://github.com/react-native-community/datetimepicker#readme","license":"MIT"},"@react-native-community/netinfo":{"version":"9.3.10","url":"https://github.com/react-native-netinfo/react-native-netinfo#readme","license":"MIT"},"@react-native/assets-registry":{"version":"0.72.0","url":"git@github.com:facebook/react-native.git","license":"MIT"},"@react-navigation/native":{"version":"6.1.7","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.13","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.42.0","url":"https://apexcharts.com","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"},"expo":{"version":"49.0.8","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.2","url":"https://docs.expo.dev/versions/latest/sdk/camera/","license":"MIT"},"expo-clipboard":{"version":"4.3.1","url":"https://docs.expo.dev/versions/latest/sdk/clipboard","license":"MIT"},"expo-font":{"version":"11.4.0","url":"https://docs.expo.dev/versions/latest/sdk/font/","license":"MIT"},"expo-image-picker":{"version":"14.3.2","url":"https://docs.expo.dev/versions/latest/sdk/imagepicker/","license":"MIT"},"expo-linking":{"version":"5.0.2","url":"https://docs.expo.dev/versions/latest/sdk/linking","license":"MIT"},"expo-sqlite":{"version":"11.3.2","url":"https://docs.expo.dev/versions/latest/sdk/sqlite/","license":"MIT"},"expo-status-bar":{"version":"1.6.0","url":"https://docs.expo.dev/versions/latest/sdk/status-bar/","license":"MIT"},"expo-system-ui":{"version":"2.4.0","url":"https://docs.expo.dev/versions/latest/sdk/system-ui","license":"MIT"},"expo-web-browser":{"version":"12.3.2","url":"https://docs.expo.dev/versions/latest/sdk/webbrowser/","license":"MIT"},"file-saver":{"version":"2.0.5","url":"https://github.com/eligrey/FileSaver.js#readme","license":"MIT"},"fs-extra":{"version":"11.1.1","url":"https://github.com/jprichardson/node-fs-extra","license":"MIT"},"google-libphonenumber":{"version":"3.2.33","url":"https://ruimarinho.github.io/google-libphonenumber/","license":"(MIT AND Apache-2.0)"},"htmlparser2-without-node-native":{"version":"3.9.2","url":"git://github.com/fb55/htmlparser2.git","license":"MIT"},"pdfmake":{"version":"0.2.7","url":"http://pdfmake.org","license":"MIT"},"process":{"version":"0.11.10","url":"git://github.com/shtylman/node-process.git","license":"MIT"},"prop-types":{"version":"15.8.1","url":"https://facebook.github.io/react/","license":"MIT"},"react":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-content-loader":{"version":"6.2.1","url":"https://github.com/danilowoz/react-content-loader","license":"MIT"},"react-dom":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-native":{"version":"0.72.4","license":"MIT"},"react-native-big-list":{"version":"1.6.1","url":"https://marcocesarato.github.io/react-native-big-list-docs/","license":"GPL-3.0-or-later"},"react-native-blob-util":{"version":"0.18.6","url":"https://github.com/RonRadtke/react-native-blob-util","license":"MIT"},"react-native-gesture-handler":{"version":"2.12.1","url":"https://github.com/software-mansion/react-native-gesture-handler#readme","license":"MIT"},"react-native-iphone-x-helper":{"version":"1.3.1","url":"https://github.com/ptelad/react-native-iphone-x-helper#readme","license":"MIT"},"react-native-mime-types":{"version":"2.4.0","license":"MIT"},"react-native-paper":{"version":"5.10.3","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.18.20","url":"https://github.com/web-ridge/react-native-paper-dates#readme","license":"MIT"},"react-native-reanimated":{"version":"3.3.0","url":"https://github.com/software-mansion/react-native-reanimated#readme","license":"MIT"},"react-native-safe-area-context":{"version":"4.6.3","url":"https://github.com/th3rdwave/react-native-safe-area-context#readme","license":"MIT"},"react-native-screens":{"version":"3.22.1","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"react-native-svg":{"version":"13.9.0","url":"https://github.com/react-native-community/react-native-svg","license":"MIT"},"react-native-web":{"version":"0.19.7","url":"git://github.com/necolas/react-native-web.git","license":"MIT"},"react-native-webview":{"version":"13.2.2","url":"https://github.com/react-native-webview/react-native-webview#readme","license":"MIT"},"react-virtuoso":{"version":"4.5.0","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"4.1.1","url":"https://github.com/vseventer/sharp-cli","license":"MIT"},"tippy.js":{"version":"6.3.7","url":"https://atomiks.github.io/tippyjs/","license":"MIT"},"uninstall":{"version":"0.0.0","license":"MIT"},"websql":{"version":"2.0.3","url":"git://github.com/nolanlawson/node-websql.git","license":"Apache-2.0"},"xlsx":{"version":"0.18.5","url":"https://sheetjs.com/","license":"Apache-2.0"}};
1
+ module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.31.2","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"},"@emotion/native":{"version":"11.11.0","url":"https://emotion.sh","license":"MIT"},"@emotion/react":{"version":"11.11.1","url":"https://github.com/emotion-js/emotion/tree/main/packages/react","license":"MIT"},"@expo/html-elements":{"version":"0.5.1","url":"https://github.com/expo/expo/tree/main/packages/html-elements","license":"MIT"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/vector-icons":{"version":"13.0.0","url":"https://expo.github.io/vector-icons","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"@faker-js/faker":{"version":"8.0.2","url":"https://github.com/faker-js/faker.git","license":"MIT"},"@fto-consult/common":{"version":"3.30.19","url":"https://github.com/borispipo/common#readme","license":"ISC"},"@pchmn/expo-material3-theme":{"version":"1.3.1","url":"https://github.com/pchmn/expo-material3-theme#readme","license":"MIT"},"@react-native-async-storage/async-storage":{"version":"1.18.2","url":"https://github.com/react-native-async-storage/async-storage#readme","license":"MIT"},"@react-native-community/datetimepicker":{"version":"7.2.0","url":"https://github.com/react-native-community/datetimepicker#readme","license":"MIT"},"@react-native-community/netinfo":{"version":"9.3.10","url":"https://github.com/react-native-netinfo/react-native-netinfo#readme","license":"MIT"},"@react-native/assets-registry":{"version":"0.72.0","url":"git@github.com:facebook/react-native.git","license":"MIT"},"@react-navigation/native":{"version":"6.1.7","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.13","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.42.0","url":"https://apexcharts.com","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"},"expo":{"version":"49.0.9","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.2","url":"https://docs.expo.dev/versions/latest/sdk/camera/","license":"MIT"},"expo-clipboard":{"version":"4.3.1","url":"https://docs.expo.dev/versions/latest/sdk/clipboard","license":"MIT"},"expo-font":{"version":"11.4.0","url":"https://docs.expo.dev/versions/latest/sdk/font/","license":"MIT"},"expo-image-picker":{"version":"14.3.2","url":"https://docs.expo.dev/versions/latest/sdk/imagepicker/","license":"MIT"},"expo-linking":{"version":"5.0.2","url":"https://docs.expo.dev/versions/latest/sdk/linking","license":"MIT"},"expo-sqlite":{"version":"11.3.2","url":"https://docs.expo.dev/versions/latest/sdk/sqlite/","license":"MIT"},"expo-status-bar":{"version":"1.6.0","url":"https://docs.expo.dev/versions/latest/sdk/status-bar/","license":"MIT"},"expo-system-ui":{"version":"2.4.0","url":"https://docs.expo.dev/versions/latest/sdk/system-ui","license":"MIT"},"expo-web-browser":{"version":"12.3.2","url":"https://docs.expo.dev/versions/latest/sdk/webbrowser/","license":"MIT"},"file-saver":{"version":"2.0.5","url":"https://github.com/eligrey/FileSaver.js#readme","license":"MIT"},"fs-extra":{"version":"11.1.1","url":"https://github.com/jprichardson/node-fs-extra","license":"MIT"},"google-libphonenumber":{"version":"3.2.33","url":"https://ruimarinho.github.io/google-libphonenumber/","license":"(MIT AND Apache-2.0)"},"htmlparser2-without-node-native":{"version":"3.9.2","url":"git://github.com/fb55/htmlparser2.git","license":"MIT"},"pdfmake":{"version":"0.2.7","url":"http://pdfmake.org","license":"MIT"},"process":{"version":"0.11.10","url":"git://github.com/shtylman/node-process.git","license":"MIT"},"prop-types":{"version":"15.8.1","url":"https://facebook.github.io/react/","license":"MIT"},"react":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-content-loader":{"version":"6.2.1","url":"https://github.com/danilowoz/react-content-loader","license":"MIT"},"react-dom":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-native":{"version":"0.72.4","license":"MIT"},"react-native-big-list":{"version":"1.6.1","url":"https://marcocesarato.github.io/react-native-big-list-docs/","license":"GPL-3.0-or-later"},"react-native-blob-util":{"version":"0.18.6","url":"https://github.com/RonRadtke/react-native-blob-util","license":"MIT"},"react-native-gesture-handler":{"version":"2.12.1","url":"https://github.com/software-mansion/react-native-gesture-handler#readme","license":"MIT"},"react-native-iphone-x-helper":{"version":"1.3.1","url":"https://github.com/ptelad/react-native-iphone-x-helper#readme","license":"MIT"},"react-native-mime-types":{"version":"2.4.0","license":"MIT"},"react-native-paper":{"version":"5.10.3","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.18.22","url":"https://github.com/web-ridge/react-native-paper-dates#readme","license":"MIT"},"react-native-reanimated":{"version":"3.3.0","url":"https://github.com/software-mansion/react-native-reanimated#readme","license":"MIT"},"react-native-safe-area-context":{"version":"4.6.3","url":"https://github.com/th3rdwave/react-native-safe-area-context#readme","license":"MIT"},"react-native-screens":{"version":"3.22.1","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"react-native-svg":{"version":"13.9.0","url":"https://github.com/react-native-community/react-native-svg","license":"MIT"},"react-native-web":{"version":"0.19.7","url":"git://github.com/necolas/react-native-web.git","license":"MIT"},"react-native-webview":{"version":"13.2.2","url":"https://github.com/react-native-webview/react-native-webview#readme","license":"MIT"},"react-virtuoso":{"version":"4.5.0","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"4.1.1","url":"https://github.com/vseventer/sharp-cli","license":"MIT"},"tippy.js":{"version":"6.3.7","url":"https://atomiks.github.io/tippyjs/","license":"MIT"},"uninstall":{"version":"0.0.0","license":"MIT"},"websql":{"version":"2.0.3","url":"git://github.com/nolanlawson/node-websql.git","license":"Apache-2.0"},"xlsx":{"version":"0.18.5","url":"https://sheetjs.com/","license":"Apache-2.0"}};