@fto-consult/expo-ui 2.37.7 → 2.38.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.
Files changed (41) hide show
  1. package/metro.config.js +1 -0
  2. package/package.json +7 -6
  3. package/src/components/AutoResizer/index.js +104 -0
  4. package/src/components/Chart/appexChart/index.native.js +1 -1
  5. package/src/components/Chart/index.js +2 -1
  6. package/src/components/Datagrid/Accordion/Filters.js +0 -1
  7. package/src/components/Datagrid/Accordion/index.js +6 -12
  8. package/src/components/Datagrid/Common/Common.js +137 -53
  9. package/src/components/Datagrid/Common/utils.js +4 -1
  10. package/src/components/Datagrid/IndexComponent.js +1 -4
  11. package/src/components/Datagrid/SWRDatagrid.js +2 -16
  12. package/src/components/Datagrid/Table/index.js +10 -39
  13. package/src/components/Dialog/Dialog.js +0 -1
  14. package/src/components/Form/FormData/Dialog.js +1 -6
  15. package/src/components/Form/FormData/FormData.js +1 -2
  16. package/src/components/Form/FormData/FormDataActions.js +6 -9
  17. package/src/components/Hashtag/index.js +2 -2
  18. package/src/components/List/Common.js +0 -1
  19. package/src/components/Table/AbsoluteScrollView.js +3 -2
  20. package/src/components/Table/Cell.js +24 -0
  21. package/src/components/Table/Header.js +25 -0
  22. package/src/components/Table/List.js +196 -0
  23. package/src/components/Table/List.native.js +5 -0
  24. package/src/components/{Datagrid/Common → Table}/ProgressBar.js +0 -0
  25. package/src/components/Table/Row.js +21 -0
  26. package/src/components/Table/Test.js +0 -0
  27. package/src/components/Table/index.js +218 -202
  28. package/src/layouts/Screen/FormData/FormData.js +6 -15
  29. package/src/layouts/Screen/FormData/List.js +7 -8
  30. package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +4 -4
  31. package/src/layouts/Screen/TableData.js +6 -13
  32. package/src/media/file-system/utils/write.js +1 -1
  33. package/src/screens/Auth/Profile.js +2 -3
  34. package/src/screens/Auth/SignIn.js +1 -3
  35. package/src/screens/Help/PrivacyPolicy/index.js +1 -3
  36. package/src/screens/Help/TermsOfUses/index.js +1 -3
  37. package/src/screens/ScreenWrapper.js +82 -0
  38. package/src/screens/index.js +10 -68
  39. package/src/screens/utils.js +2 -0
  40. package/webpack.config.js +9 -1
  41. package/src/components/Datagrid/Table/Cell.js +0 -45
@@ -27,7 +27,7 @@ import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$makePhoneCall";
27
27
  import copyToClipboard from "$capp/clipboard";
28
28
  import { Pressable } from "react-native";
29
29
  import stableHash from "stable-hash";
30
- import DatagridProgressBar from "./ProgressBar";
30
+ import DatagridProgressBar from "$ecomponents/Table/ProgressBar";
31
31
  import View from "$ecomponents/View";
32
32
  import {Menu} from "$ecomponents/BottomSheet";
33
33
  import {styles as tableStyles} from "$ecomponents/Table";
@@ -36,8 +36,9 @@ import Chart,{getMaxSupportedSeriesSize} from "$ecomponents/Chart";
36
36
  import notify from "$cnotify";
37
37
  import FileSystem from "$file-system";
38
38
  import sprintf from "$cutils/sprintf";
39
- import { renderRowCell,formatValue } from "./utils";
39
+ import { renderRowCell,formatValue,arrayValueSeparator } from "./utils";
40
40
  import {ScrollView} from "react-native";
41
+ import Button from "$ecomponents/Button";
41
42
  import * as XLSX from "xlsx";
42
43
 
43
44
  export const TIMEOUT = 100;
@@ -147,7 +148,6 @@ Object.map(displayTypes,(c,k)=>{
147
148
  }
148
149
  })
149
150
 
150
- export const arrayValueSeparator = ", ";
151
151
 
152
152
  const dataSourceArgs = {};
153
153
  export const footerFieldName = "dgrid-fters-fields";
@@ -263,6 +263,8 @@ export default class CommonDatagridComponent extends AppComponent {
263
263
  dateFields : {value : {}},
264
264
  sectionListColumnsSize : {value : {current:0}}, //la taille du nombre d'éléments de section dans les colonnes
265
265
  chartRef : {value : {current:null}},
266
+ layoutRef : {value : {}},
267
+ isRenderingRef : {value : {current:false}},
266
268
  chartSeriesNamesColumnsMapping : {value : {}},//le mappage entre les index des series et les colonnes coorespondantes
267
269
  })
268
270
  this.state.abreviateValues = "abreviateValues" in this.props? !!this.props.abreviateValues : !!this.getSessionData("abreviateValues");
@@ -683,7 +685,7 @@ export default class CommonDatagridComponent extends AppComponent {
683
685
  return false;
684
686
  }
685
687
  getSelectableColumNameStyle(){
686
- return {alignItems:'flex-start',marginLeft:0,marginRight:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0};
688
+ return {alignItems:'flex-start',marginLeft:0,marginRight:0,marginTop:0,marginBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0};
687
689
  }
688
690
  isSelectableColumn(columnDef,columnField){
689
691
  return isObj(columnDef) && defaultStr(columnDef.field,columnField) === this.getSelectableColumName();
@@ -1109,7 +1111,6 @@ export default class CommonDatagridComponent extends AppComponent {
1109
1111
  return this.setIsLoading(true,()=>{
1110
1112
  this.prepareData({data:this.INITIAL_STATE.data},(state)=>{
1111
1113
  this.setState({...state,showFooters:showOrHide},()=>{
1112
- this.setIsLoading(false,false);
1113
1114
  this.isUpdating = false;
1114
1115
  this.setSessionData({showFooters:showOrHide});
1115
1116
  })
@@ -1131,8 +1132,6 @@ export default class CommonDatagridComponent extends AppComponent {
1131
1132
  setState(a,b){
1132
1133
  super.setState(a,b);
1133
1134
  }
1134
-
1135
-
1136
1135
  toggleFixedTableState(){
1137
1136
  setTimeout(()=>{
1138
1137
  this.setIsLoading(true,()=>{
@@ -1140,7 +1139,6 @@ export default class CommonDatagridComponent extends AppComponent {
1140
1139
  this.setState({fixedTable},()=>{
1141
1140
  this.updateLayout();
1142
1141
  this.setSessionData("fixedTable",fixedTable);
1143
- this.setIsLoading(false,false);
1144
1142
  })
1145
1143
  },true)
1146
1144
  },TIMEOUT)
@@ -1163,7 +1161,6 @@ export default class CommonDatagridComponent extends AppComponent {
1163
1161
  this.filters[field].value = this.filters[field].defaultValue = undefined;
1164
1162
  this.doFilter({value:undefined,field})
1165
1163
  }
1166
- this.setIsLoading(false,false);
1167
1164
  });
1168
1165
  },true)
1169
1166
  },TIMEOUT)
@@ -1181,7 +1178,6 @@ export default class CommonDatagridComponent extends AppComponent {
1181
1178
  this.setIsLoading(true,()=>{
1182
1179
  this.prepareColumns({columns});
1183
1180
  this.setState({columns});
1184
- this.setIsLoading(false,false);
1185
1181
  })
1186
1182
  },TIMEOUT)
1187
1183
  }
@@ -1280,7 +1276,6 @@ export default class CommonDatagridComponent extends AppComponent {
1280
1276
  const {sectionListColumns:pSListColumns} = this.prepareColumns({sectionListColumns});
1281
1277
  this.prepareData({data:this.INITIAL_STATE.data,sectionListColumns:pSListColumns},(state)=>{
1282
1278
  this.setState({...state,sectionListColumns:pSListColumns},()=>{
1283
- this.setIsLoading(false,false);
1284
1279
  this.setSessionData("sectionListColumns",Object.keys(pSListColumns));
1285
1280
  });
1286
1281
  });
@@ -1294,7 +1289,6 @@ export default class CommonDatagridComponent extends AppComponent {
1294
1289
  this.setState({...state,sectionListColumns,displayOnlySectionListHeaders:false},()=>{
1295
1290
  this.setSessionData("sectionListColumns",null);
1296
1291
  this.setSessionData("displayOnlySectionListHeaders",false);
1297
- this.setIsLoading(false,false);
1298
1292
  });
1299
1293
  });
1300
1294
  },true);
@@ -1325,7 +1319,6 @@ export default class CommonDatagridComponent extends AppComponent {
1325
1319
  if(tt.code == 'table'){
1326
1320
  return this.setIsLoading(true,()=>{
1327
1321
  this.setState({displayType},()=>{
1328
- this.setIsLoading(false,false);
1329
1322
  this.persistDisplayType(displayType);
1330
1323
  });
1331
1324
  },true)
@@ -1334,7 +1327,6 @@ export default class CommonDatagridComponent extends AppComponent {
1334
1327
  setTimeout(()=>{
1335
1328
  this.setIsLoading(true,()=>{
1336
1329
  this.setState({chartConfig,displayType},()=>{
1337
- this.setIsLoading(false,false);
1338
1330
  this.persistDisplayType(displayType);
1339
1331
  })
1340
1332
  },true);
@@ -1360,7 +1352,6 @@ export default class CommonDatagridComponent extends AppComponent {
1360
1352
  this.prepareData({data:this.INITIAL_STATE.data},(state)=>{
1361
1353
  const abreviateValues = !this.state.abreviateValues;
1362
1354
  this.setState({abreviateValues,...state},()=>{
1363
- this.setIsLoading(false,false);
1364
1355
  this.setSessionData("abreviateValues",abreviateValues);
1365
1356
  })
1366
1357
  });
@@ -1407,7 +1398,6 @@ export default class CommonDatagridComponent extends AppComponent {
1407
1398
  this.prepareData({data:this.INITIAL_STATE.data,aggregatorFunction:ag.code},(state)=>{
1408
1399
  this.setState(state,()=>{
1409
1400
  this.setSessionData("aggregatorFunction",ag.code);
1410
- this.setIsLoading(false,false);
1411
1401
  })
1412
1402
  })
1413
1403
  },true);
@@ -1817,6 +1807,14 @@ export default class CommonDatagridComponent extends AppComponent {
1817
1807
  })
1818
1808
  }
1819
1809
  if(!items.length) return null;
1810
+ if(!this.isAccordion()){
1811
+ items.unshift({
1812
+ text : "Exporter les données",
1813
+ divider : true,
1814
+ textBold : true,
1815
+ icon : "export",
1816
+ })
1817
+ }
1820
1818
  return <Menu
1821
1819
  items = {items}
1822
1820
  title ="Export des données du tableau"
@@ -1848,9 +1846,7 @@ export default class CommonDatagridComponent extends AppComponent {
1848
1846
  onPress : ()=>{
1849
1847
  this.configureChart(false).then((chartConfig)=>{
1850
1848
  this.setIsLoading(true,()=>{
1851
- this.setState({chartConfig},()=>{
1852
- this.setIsLoading(false,false);
1853
- });
1849
+ this.setState({chartConfig});
1854
1850
  },true)
1855
1851
  })
1856
1852
  }
@@ -2233,6 +2229,7 @@ export default class CommonDatagridComponent extends AppComponent {
2233
2229
  return <Chart
2234
2230
  options = {chartOptions}
2235
2231
  ref = {this.chartRef}
2232
+ onRender = {this.onRender.bind(this)}
2236
2233
  key = {chartOptions.chart.id+"-"+this.state.displayType}
2237
2234
  />
2238
2235
  }
@@ -2252,7 +2249,6 @@ export default class CommonDatagridComponent extends AppComponent {
2252
2249
  return this.setIsLoading(true,()=>{
2253
2250
  this.prepareData({data:this.INITIAL_STATE.data,displayOnlySectionListHeaders},(state)=>{
2254
2251
  this.setState({...state,showFooters});
2255
- this.setIsLoading(false,false);
2256
2252
  })
2257
2253
  })
2258
2254
  } else {
@@ -2263,9 +2259,7 @@ export default class CommonDatagridComponent extends AppComponent {
2263
2259
  data.push(d);
2264
2260
  }
2265
2261
  });
2266
- this.setState({data,displayOnlySectionListHeaders,showFooters},()=>{
2267
- this.setIsLoading(false,false);
2268
- });
2262
+ this.setState({data,displayOnlySectionListHeaders,showFooters});
2269
2263
  },true)
2270
2264
  }
2271
2265
  },0);
@@ -2800,8 +2794,8 @@ export default class CommonDatagridComponent extends AppComponent {
2800
2794
  }
2801
2795
  return <View testID={testID+"_ContentContainer"} style={[theme.styles.w100,isA && this.state.displayOnlySectionListHeaders && {borderTopColor:theme.colors.divider,borderTopWidth:1},isA ? [theme.styles.ph2,theme.styles.pt1] : [theme.styles.pt1,theme.styles.ph1],theme.styles.justifyContentCenter,theme.styles.alignItemsCenter,theme.styles.pb1,!cells && theme.styles.ml1,theme.styles.mr1,cStyle]}>
2802
2796
  <Label testID={testID+"_Label"} splitText numberOfLines={3} textBold style={[theme.styles.w100,{color:theme.colors.primaryOnSurface,fontSize:isA?15 :16},lStyle]}>{label}</Label>
2803
- {cells ? <View testID={testID+"_TableRow"} style = {[theme.styles.w100,theme.styles.row,isA && theme.styles.pt1,theme.styles.alignItemsFlexStart]}
2804
- >{this.isAccordion() ? <ScrollView testID={testID+"_ScrollView"} horizontal>{cells}</ScrollView> : cells}</View> : null}
2797
+ {cells ? <View testID={testID+"_TableRow"} style = {[theme.styles.w100,theme.styles.row,isA && theme.styles.pt1,theme.styles.alignItemsFlexStart,this.isAccordion() && theme.styles.rowWrap]}
2798
+ >{cells}</View> : null}
2805
2799
  </View>
2806
2800
  }
2807
2801
  isRowSelected(rowKey,rowIndex){
@@ -2876,6 +2870,7 @@ export default class CommonDatagridComponent extends AppComponent {
2876
2870
 
2877
2871
  ///supprime tous les filtres s'ils existenent
2878
2872
  _clearAllFilters (){
2873
+ this.isClearingAllFilters = true;
2879
2874
  let filters = {};
2880
2875
  let defValue = undefined;
2881
2876
  Object.map(this.filters,(f,i)=>{
@@ -2883,9 +2878,14 @@ export default class CommonDatagridComponent extends AppComponent {
2883
2878
  defValue = undefined;
2884
2879
  if(f.type =="select") defValue = [];
2885
2880
  filters[i] = {...f,value:defValue,defaultValue:defValue}
2881
+ });
2882
+ Object.map(this.filteredValues,(v,i)=>{
2883
+ delete this.filteredValues[i];
2886
2884
  })
2887
2885
  this.filters = filters;
2886
+ console.log(this.filters," is fffff");
2888
2887
  this.refresh(true);
2888
+ this.isClearingAllFilters = false;
2889
2889
  }
2890
2890
  clearAllFilters(){
2891
2891
  if(isObj(this.state.filteredColumns)){
@@ -2928,7 +2928,8 @@ export default class CommonDatagridComponent extends AppComponent {
2928
2928
  filter.defaultValue = arg.defaultValue;
2929
2929
  filter.operator = operator;
2930
2930
  filter.action = defaultStr(originAction,action);
2931
- }
2931
+ }
2932
+ if(this.isClearingAllFilters) return;
2932
2933
  return this.doFilter(arg);
2933
2934
  }
2934
2935
  ///si les filtres devront être convertis au format SQL
@@ -2952,6 +2953,48 @@ export default class CommonDatagridComponent extends AppComponent {
2952
2953
  if(prepare === false) return this.filters;
2953
2954
  return prepareFilters(this.filters,{filter:this.canHandleFilterVal.bind(this),convertToSQL:convertFiltersToSQL});
2954
2955
  }
2956
+ hasFilters (){
2957
+ if(!this.isFilterable()) return false;
2958
+ const filters = this.getFilters({prepare:false});
2959
+ for(let i in filters){
2960
+ if(isObj(filters[i]) && filters[i].field && 'value' in filters[i]) return true;
2961
+ }
2962
+ return false;
2963
+ }
2964
+ renderFiltersMenu(forceD){
2965
+ if(!this.isFilterable()) return null;
2966
+ const showFilters = this.canShowFilters();
2967
+ const anchor = p=> forceD !== true && isMobileOrTabletMedia()? <Icon
2968
+ icon = "filter-plus"
2969
+ {...p}
2970
+ /> :<Button
2971
+ normal
2972
+ children = "Filtres"
2973
+ icon = "filter-plus"
2974
+ {...p}
2975
+ style={theme.styles.mh05}
2976
+ contentStyle = {[theme.styles.justifyContentFlexStart]}
2977
+ />;
2978
+ const toggleItem = {
2979
+ icon : showFilters?'eye-off':'eye',
2980
+ children : showFilters?'Masquer/Filtres':'Afficher/Filtres',
2981
+ onPress : x => showFilters?this.hideFilters():this.showFilters(),
2982
+ }
2983
+ if(false && this.hasFilters()){
2984
+ return <Menu
2985
+ anchor = {anchor}
2986
+ items = {[
2987
+ toggleItem,
2988
+ {
2989
+ text : "Tout effacer",
2990
+ icon : "filter-remove",
2991
+ onPress : this.clearAllFilters.bind(this),
2992
+ }
2993
+ ]}
2994
+ />
2995
+ }
2996
+ return anchor(toggleItem)
2997
+ }
2955
2998
  onChangeDataSources(args){
2956
2999
  let {dataSources,server} = args;
2957
3000
  if(this.props.onChangeDataSources =='function' && this.props.onChangeDataSources({dataSources,prev:this.currentDataSources}) === false) return;
@@ -2976,9 +3019,7 @@ export default class CommonDatagridComponent extends AppComponent {
2976
3019
  if(isObjOrArray(data)){
2977
3020
  this.setIsLoading(true,()=>{
2978
3021
  this.prepareData({data},(state)=>{
2979
- this.setState(state,()=>{
2980
- this.setIsLoading(false,false);
2981
- })
3022
+ this.setState(state)
2982
3023
  })
2983
3024
  },true)
2984
3025
  }
@@ -3076,22 +3117,43 @@ export default class CommonDatagridComponent extends AppComponent {
3076
3117
  forceRefresh(){
3077
3118
  this.refresh(true);
3078
3119
  }
3120
+ /***retourne la hauteur maximale du composant FlashList */
3121
+ getMaxListHeight(){
3122
+ const {height:winheight} = Dimensions.get("window");
3123
+ const layout = defaultObj(this.layoutRef.current);
3124
+ let maxHeight = winheight-100;
3125
+ if(layout && typeof layout.windowHeight =='number' && layout.windowHeight){
3126
+ const diff = winheight - Math.max(defaultNumber(layout.y,layout.top),100);
3127
+ if(diff<=350){
3128
+ maxHeight = Math.max(Math.min(winheight,350),200);
3129
+ } else {
3130
+ maxHeight = diff;
3131
+ }
3132
+ }
3133
+ return maxHeight;
3134
+ }
3079
3135
  refresh (force,cb){
3080
3136
  if(isFunction(force)){
3081
3137
  let t = cb;
3082
3138
  cb = force;
3083
3139
  force = isBool(t)? t : true;
3084
3140
  }
3085
- return this.fetchData({force:defaultBool(force,true)}).then((data)=>{
3086
- if(isFunction(cb)){
3087
- cb(data);
3088
- }
3089
- if(typeof this.props.onRefreshDatagrid ==='function'){
3090
- this.props.onRefreshDatagrid({context:this,force});
3091
- }
3141
+ return new Promise((resolve,reject)=>{
3142
+ setTimeout(()=>{
3143
+ return this.fetchData({force:defaultBool(force,true)}).then((data)=>{
3144
+ if(isFunction(cb)){
3145
+ cb(data);
3146
+ }
3147
+ if(typeof this.props.onRefreshDatagrid ==='function'){
3148
+ this.props.onRefreshDatagrid({context:this,force});
3149
+ }
3150
+ }).then(resolve).catch(reject);
3151
+ },100);
3092
3152
  })
3093
3153
  }
3094
- onResizePage(){}
3154
+ onResizePage(){
3155
+ this.updateLayout();
3156
+ }
3095
3157
  componentDidMount(){
3096
3158
  super.componentDidMount();
3097
3159
  APP.on(APP.EVENTS.RESIZE_PAGE,this._events.RESIZE_PAGE);
@@ -3151,12 +3213,20 @@ export default class CommonDatagridComponent extends AppComponent {
3151
3213
  canSetIsLoading(){
3152
3214
  return isObj(this.progressBarRef.current) && typeof this.progressBarRef.current.setIsLoading =='function' ? true : false;
3153
3215
  }
3216
+ onRender(){
3217
+ if(this.isRenderingRef.current === true){
3218
+ setTimeout(()=>{
3219
+ this.isRenderingRef.current = false;
3220
+ return this.setIsLoading(false);
3221
+ },500);
3222
+ }
3223
+ }
3154
3224
  /***
3155
3225
  * @param {boolean} loading
3156
3226
  * @param {function | boolean} cb | enablePointerEvents
3157
3227
  * @param {boolean|function} enablePointerEvents
3158
3228
  */
3159
- setIsLoading(loading,cb,enablePointerEvents){
3229
+ setIsLoading (loading,cb,enablePointerEvents){
3160
3230
  if(typeof cb =='boolean'){
3161
3231
  const t = enablePointerEvents;
3162
3232
  enablePointerEvents = cb;
@@ -3165,23 +3235,31 @@ export default class CommonDatagridComponent extends AppComponent {
3165
3235
  if(typeof enablePointerEvents =='boolean'){
3166
3236
  this.enablePointerEventsRef.current = enablePointerEvents;
3167
3237
  }
3238
+ const timeout = 300;
3168
3239
  setTimeout(()=>{
3240
+ cb = typeof cb =='function'? cb : x=>true;
3169
3241
  if(this.canSetIsLoading() && typeof loading =='boolean'){
3242
+ if(loading === true){
3243
+ this.isRenderingRef.current = true;
3244
+ } else if(this.isRenderingRef.current === true){
3245
+ return setTimeout(cb,timeout);;
3246
+ }
3170
3247
  return this.progressBarRef.current.setIsLoading(loading,()=>{
3171
- if(typeof cb =='function'){
3172
- cb();
3173
- }
3248
+ setTimeout(cb,timeout);
3174
3249
  });
3175
- } else if(typeof cb =='function'){
3176
- cb();
3250
+ } else {
3251
+ setTimeout(cb,timeout);
3177
3252
  }
3178
- },loading === false && enablePointerEvents === false ? 0 : 0);
3253
+ },loading === false && enablePointerEvents === false ? timeout : 0);
3179
3254
  return false;
3180
3255
  }
3181
3256
  /**** met à jour l'état de progression de la mise à jour du tableau */
3182
3257
  updateProgress(isLoading,cb){
3183
3258
  this.isLoadingRef.current = defaultBool(isLoading,!!!this.isLoadingRef.current);
3184
3259
  cb = typeof cb =='function'?cb : typeof isLoading =='function'? isLoading : null
3260
+ if(isLoading){
3261
+ this.isRenderingRef.current = true;
3262
+ }
3185
3263
  if(this.canSetIsLoading()){
3186
3264
  return this.setIsLoading(isLoading,cb);
3187
3265
  }
@@ -3233,6 +3311,8 @@ export default class CommonDatagridComponent extends AppComponent {
3233
3311
  updateLayout(p){
3234
3312
  this.measureLayout(state=>{
3235
3313
  if(isObj(state)){
3314
+ this.layoutRef.current = state;
3315
+ return;
3236
3316
  if(!this.state.isReady){
3237
3317
  state.isReady = true;
3238
3318
  }
@@ -3245,16 +3325,14 @@ export default class CommonDatagridComponent extends AppComponent {
3245
3325
  }
3246
3326
  UNSAFE_componentWillReceiveProps(nextProps){
3247
3327
  if(Object.size(nextProps.data) === Object.size(this.props.data) && (nextProps.data == this.props.data || stableHash(nextProps.data) === stableHash(this.props.data))) {
3248
- if( typeof this.props.isLoading=='boolean' && nextProps.isLoading !== this.props.isLoading && typeof nextProps.isLoading =='boolean'){
3328
+ /*if( !this.isRenderingRef.current && typeof this.props.isLoading=='boolean' && nextProps.isLoading !== this.props.isLoading && typeof nextProps.isLoading =='boolean'){
3249
3329
  this.setIsLoading(nextProps.isLoading)
3250
- }
3330
+ }*/
3251
3331
  return false;
3252
3332
  }
3253
3333
  this.setIsLoading(true,()=>{
3254
3334
  this.prepareData({...nextProps,force:true},(state)=>{
3255
- this.setState(state,()=>{
3256
- this.setIsLoading(false,false);
3257
- })
3335
+ this.setState(state)
3258
3336
  });
3259
3337
  },true);
3260
3338
  }
@@ -3262,7 +3340,7 @@ export default class CommonDatagridComponent extends AppComponent {
3262
3340
  return CommonDatagridComponent.getDefaultPreloader();
3263
3341
  }
3264
3342
  isLoading (){
3265
- if(this.state.isReady === false) return true;
3343
+ if(this.state.isReady === false || this.isRenderingRef.current) return true;
3266
3344
  if(typeof this.props.isLoading =='boolean') return this.props.isLoading;
3267
3345
  return this.isLoadingRef.current === true ? true : false;
3268
3346
  }
@@ -3285,14 +3363,18 @@ export default class CommonDatagridComponent extends AppComponent {
3285
3363
  getSort(){
3286
3364
  return defaultObj(this.sortRef.current);
3287
3365
  }
3288
- renderHeaderCell({columnDef,columnField}){
3366
+ renderHeaderCell({columnDef,containerProps,columnField}){
3289
3367
  if(this.isSelectableColumn(columnDef,columnField)){
3368
+ const style = this.getSelectableColumNameStyle();
3369
+ if(isObj(containerProps)){
3370
+ containerProps.style = [this.getSelectableColumNameStyle(),containerProps.style];
3371
+ }
3290
3372
  return <Checkbox
3291
3373
  testID = "RN_SelectColumnHeaderCell"
3292
3374
  checked ={this.isAllRowsSelected()?true:false}
3293
3375
  key = {this.getSelectableColumName()}
3294
3376
  secondaryOnCheck
3295
- style = {this.getSelectableColumNameStyle()}
3377
+ style = {style}
3296
3378
  ref = {this.selectableColumnRef}
3297
3379
  onPress = {({checked})=>{
3298
3380
  this.handleAllRowsToggle(!checked);
@@ -3378,7 +3460,7 @@ export default class CommonDatagridComponent extends AppComponent {
3378
3460
  const renderText = isSectionListHeader === true || customRenderRowCell === false ? true : false;
3379
3461
  if(!isObj(rowData)) return renderText ? null : {render:null,extra:{}};
3380
3462
  rowIndex = isDecimal(rowIndex)? rowIndex : isDecimal(index)? index : undefined;
3381
- rowCounterIndex = isDecimal(rowCounterIndex) ? rowCounterIndex : isDecimal(rowIndex)? rowIndex+1 : defaultDecimal(rowCounterIndex);
3463
+ rowCounterIndex = isDecimal(rowCounterIndex) ? rowCounterIndex : isDecimal(rowIndex)? rowIndex+1 : defaultDecimal(rowCounterIndex);
3382
3464
  if(this.isSelectableColumn(columnDef,columnField)){
3383
3465
  if(renderText) return null;
3384
3466
  rowKey = rowKey ? rowKey : this.getRowKey(rowData,rowIndex);
@@ -3398,6 +3480,8 @@ export default class CommonDatagridComponent extends AppComponent {
3398
3480
  }
3399
3481
  return renderRowCell({
3400
3482
  ...arg,
3483
+ rowIndex,
3484
+ rowCounterIndex,
3401
3485
  formatValue,
3402
3486
  context : this,
3403
3487
  getRowKey : this.getRowKey.bind(this),
@@ -191,4 +191,7 @@ export const formatValue = (value,format,abreviateValues)=>{
191
191
  return abreviateValues? value.abreviate2FormatMoney() : value.formatMoney();
192
192
  }
193
193
  return abreviateValues ? value.abreviate() : value.formatNumber();
194
- }
194
+ }
195
+
196
+
197
+ export const arrayValueSeparator = ", ";
@@ -20,10 +20,7 @@ const DatagridMainComponent = React.forwardRef((props,ref)=>{
20
20
  let Component = TableComponent;
21
21
  const canRenderAccordion = (isFunction(props.accordion) || (isObj(props.accordionProps) && isFunction(props.accordionProps.accordion)) || props.accordion === true);
22
22
  let renderType = defaultStr(getRenderType(),isDesk? "table":'accordion').trim().toLowerCase()
23
- if(false && (renderType ==="dashboard" || props.dashobard === true)){
24
- Component = Dashboard;
25
- delete props.dashobard;
26
- } else if(renderType == 'accordion' && canRenderAccordion){
23
+ if(renderType == 'accordion' && canRenderAccordion){
27
24
  Component = AccordionComponent;
28
25
  } else if(renderType =='table'){
29
26
  Component = TableComponent;
@@ -223,9 +223,9 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
223
223
  },
224
224
  });
225
225
  const isLoading = isLoadingRef.current && customIsLoading || false;
226
- React.useEffect(()=>{
226
+ /*React.useEffect(()=>{
227
227
  innerRef.current && innerRef.current.setIsLoading && innerRef.current.setIsLoading(isLoading);
228
- },[isLoading])
228
+ },[isLoading])*/
229
229
  React.useEffect(()=>{
230
230
  const cb = refreshCBRef.current;
231
231
  refreshCBRef.current = null;
@@ -395,20 +395,6 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
395
395
  </View>
396
396
  </View>
397
397
  }}
398
- /*ListFooterComponent = {(props)=>{
399
- const r = typeof ListFooterComponent =='function'? ListFooterComponent(props) : null;
400
- if(!loading) return r;
401
- const aContent = <View testID={testID+"_ListHeaderActivityIndicator"} style={[theme.styles.w100,theme.styles.justifyContentCenter]}>
402
- <ActivityIndicator color={theme.colors.primary}/>
403
- </View>;
404
- if(r){
405
- return <View testID={testID+"_ListHeaderContainer"} style={[theme.styles.w100]}>
406
- {r}
407
- {aContent}
408
- </View>
409
- }
410
- return aContent;
411
- }}*/
412
398
  handleQueryLimit = {false}
413
399
  handlePagination = {false}
414
400
  autoSort = {canSortRemotely()? false : true}
@@ -44,9 +44,6 @@ const DatagridFactory = (Factory)=>{
44
44
  bindResizeEvents(){
45
45
  return true;
46
46
  }
47
- onResizePage(){
48
- this.updateLayout();
49
- }
50
47
  renderFilter(props,headerFilters){
51
48
  headerFilters.push(props);
52
49
  }
@@ -169,7 +166,7 @@ const DatagridFactory = (Factory)=>{
169
166
  const {columnsWidths:widths} = this.state;
170
167
  const showFooters = this.canShowFooters(), showFilters = this.canShowFilters();
171
168
  const isLoading = this.isLoading();
172
- let _progressBar = this.getProgressBar();
169
+ const progressBar = this.getProgressBar();
173
170
  const pointerEvents = this.getPointerEvents();
174
171
 
175
172
  let restItems = [...this.renderCustomMenu()];
@@ -193,17 +190,7 @@ const DatagridFactory = (Factory)=>{
193
190
  }] : [])
194
191
  ]
195
192
  }
196
- const {width,height:winheight} = Dimensions.get("window");
197
- const {layout} = this.state;
198
- let maxHeight = winheight-100;
199
- if(layout && typeof layout.windowHeight =='number' && layout.windowHeight){
200
- const diff = winheight - Math.max(defaultNumber(layout.y,layout.top),100);
201
- if(winheight<=350){
202
- maxHeight = 350;
203
- } else {
204
- maxHeight = diff;
205
- }
206
- }
193
+ const maxHeight = this.getMaxListHeight();
207
194
  const rPagination = showPagination ? <View style={[styles.paginationContainer]}>
208
195
  <ScrollView horizontal showsHorizontalScrollIndicator={!isLoading} style={styles.paginationContainerStyle} contentContainerStyle={styles.minW100}>
209
196
  <View style={[styles.paginationContent]}>
@@ -243,23 +230,6 @@ const DatagridFactory = (Factory)=>{
243
230
  />
244
231
  })}
245
232
  </>}
246
- {exportable && (
247
- <>{/**
248
- * <ExportTable
249
- {...exportTableProps}
250
- selector = {this.datagridDomId}
251
- ref = {(el)=>{
252
- if(el){
253
- this.exportDataInstance = el;
254
- }
255
- }}
256
- getAllData = {()=>{
257
- return this.INITIAL_STATE.data;
258
- }}
259
- />
260
- *
261
- */}</>
262
- )}
263
233
  <BottomSheetMenu
264
234
  anchor = {(props)=>{
265
235
  return <Icon {...props} title={isMobile?"Actions":"Colonnes"} name={isMobile?MENU_ICON:'view-column'}></Icon>
@@ -324,7 +294,7 @@ const DatagridFactory = (Factory)=>{
324
294
  </View>
325
295
  </ScrollView>
326
296
  </View> : null;
327
- return <View style={[styles.container,{maxHeight}]} pointerEvents={pointerEvents}>
297
+ return <View style={[styles.container,{flex:1,maxHeight}]} pointerEvents={pointerEvents}>
328
298
  <View ref={this.layoutRef}>
329
299
  {this.props.showActions !== false ? <DatagridActions
330
300
  pointerEvents = {pointerEvents}
@@ -335,10 +305,13 @@ const DatagridFactory = (Factory)=>{
335
305
  actions = {actions}
336
306
  /> : null}
337
307
  {rPagination}
338
- {_progressBar}
308
+ {progressBar}
339
309
  </View>
340
- {<Table
341
- renderListContent = {canRenderChart? false:true}
310
+ {canRenderChart ?
311
+ <View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
312
+ {this.renderChart()}
313
+ </View> :
314
+ <Table
342
315
  ref = {this.listRef}
343
316
  {...rest}
344
317
  onLayout = {(args)=>{
@@ -347,9 +320,7 @@ const DatagridFactory = (Factory)=>{
347
320
  }
348
321
  this.updateLayout(args);
349
322
  }}
350
- children = {canRenderChart ? <View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
351
- {this.renderChart()}
352
- </View> : null}
323
+ onRender = {this.onRender.bind(this)}
353
324
  getItemType = {this.getFlashListItemType.bind(this)}
354
325
  renderItem = {this.renderFlashListItem.bind(this)}
355
326
  hasFooters = {hasFootersFields && !canRenderChart ? true : false}
@@ -20,7 +20,6 @@ import {ACTION_ICON_SIZE} from "$ecomponents/AppBar";
20
20
  import DialogFooter from "./DialogFooter";
21
21
  import { Dimensions } from "react-native";
22
22
  import Surface from "$ecomponents/Surface";
23
- import stableHash from "stable-hash";
24
23
 
25
24
  export const FOOTER_HEIGHT = 50;
26
25
  export const HEADER_HEIGHT = 50;
@@ -15,13 +15,8 @@ export default class FormDataDialogComponent extends FormDataActions{
15
15
  dialogRef : {value:React.createRef(null)}
16
16
  });
17
17
  }
18
-
19
- getMainProps(){
20
- return defaultObj(this.props.dialogProps,this.props);
21
- }
22
-
23
18
  isControlled(){
24
- const dialogProps = this.getMainProps();
19
+ const dialogProps = defaultObj(this.props.dialogProps,this.props);
25
20
  return dialogProps.controlled ? dialogProps.controlled : typeof this.props.controlled =='boolean'? this.props.controlled : true;
26
21
  }
27
22
  getDialogComponent(){
@@ -12,7 +12,6 @@ import {renderActions} from "$ecomponents/Dialog/utils";
12
12
  import {handleBeforeSaveCallback} from "./utils";
13
13
  import componentsTypes from "./componentsTypes";
14
14
  import { keyboardShortcuts } from "../utils";
15
- import {getScreenProps} from "$cnavigation";
16
15
  import appConfig from "$capp/config";
17
16
 
18
17
  export default class FormDataComponent extends AppComponent{
@@ -65,7 +64,7 @@ export default class FormDataComponent extends AppComponent{
65
64
  return true;
66
65
  }
67
66
  getAppBarActionsProps(props){
68
- let {data,onCancel,perm,beforeSaveArgumentsMutator,beforeSave,actions,saveDataMutator,...rest} = getScreenProps(defaultObj(props,this.props));
67
+ let {data,onCancel,perm,beforeSaveArgumentsMutator,beforeSave,actions,saveDataMutator,...rest} = (defaultObj(props,this.props));
69
68
  const onSave = typeof props.onSave ==='function'? props.onSave : this.props.onSave ;
70
69
  beforeSave = typeof beforeSave =='function'? beforeSave : x=>true;
71
70
  return getAppBarActionsProps({