@fto-consult/expo-ui 6.54.3 → 6.55.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.54.3",
3
+ "version": "6.55.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "delete-node-modules": "rimraf ./**/node_modules",
46
46
  "dev": "npx expo start --no-dev --minify -c",
47
47
  "modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'",
48
- "update": "npm i expo @emotion/native@latest react-native-big-list@latest apexcharts@latest file-saver@latest fs-extra@latest google-libphonenumber@latest @pchmn/expo-material3-theme@latest @emotion/native@latest @fto-consult/common@latest @react-navigation/stack react-native-blob-util react-native-gesture-handler@latest react-native-iphone-x-helper@latest react-native-mime-types@latest react-native-paper@latest react-native-paper-dates@latest @react-navigation/native@latest @react-navigation/native-stack@latest react-virtuoso@latest tippy.js@latest websql@latest xlsx@latest react-native-web@latest react-dom@latest react-native-webview@latest && npx expo install --fix && npm run update-apexchart && npm run find-licenses"
48
+ "update": "npm i expo @emotion/native@latest react-native-big-list@latest apexcharts@latest file-saver@latest fs-extra@latest google-libphonenumber@latest @pchmn/expo-material3-theme@latest @emotion/native@latest @fto-consult/common@latest @react-navigation/stack react-native-blob-util react-native-iphone-x-helper@latest react-native-mime-types@latest react-native-paper@latest react-native-paper-dates@latest @react-navigation/native@latest @react-navigation/native-stack@latest react-virtuoso@latest tippy.js@latest websql@latest xlsx@latest react-native-web@latest react-dom@latest && npx expo install --fix && npm run update-apexchart && npm run find-licenses"
49
49
  },
50
50
  "bin": {
51
51
  "expo-ui": "./bin/index.js"
@@ -70,7 +70,7 @@
70
70
  "@expo/html-elements": "^0.5.1",
71
71
  "@expo/vector-icons": "^13.0.0",
72
72
  "@faker-js/faker": "^8.0.2",
73
- "@fto-consult/common": "^3.50.3",
73
+ "@fto-consult/common": "^3.51.8",
74
74
  "@pchmn/expo-material3-theme": "^1.3.1",
75
75
  "@react-native-async-storage/async-storage": "1.18.2",
76
76
  "@react-native-community/datetimepicker": "7.2.0",
@@ -109,7 +109,6 @@
109
109
  "react-native-gesture-handler": "~2.12.0",
110
110
  "react-native-iphone-x-helper": "^1.3.1",
111
111
  "react-native-mime-types": "^2.4.0",
112
- "react-native-mmkv": "^2.10.2",
113
112
  "react-native-paper": "^5.10.6",
114
113
  "react-native-paper-dates": "^0.19.7",
115
114
  "react-native-reanimated": "~3.3.0",
@@ -9,6 +9,7 @@ import Label from "$ecomponents/Label";
9
9
  import theme,{Colors} from "$theme";
10
10
  import {isIos,isWeb} from "$cplatform";
11
11
  import {defaultObj,defaultStr} from "$cutils";
12
+ import { getThemeColors} from './utils';
12
13
  const AppbarContent = ({
13
14
  color: titleColor,
14
15
  subtitle,
@@ -26,8 +27,8 @@ const AppbarContent = ({
26
27
  testID,
27
28
  ...rest
28
29
  }) => {
29
-
30
- const titleTextColor = Colors.isValid(titleColor) ? titleColor : theme.colors.onPrimary;
30
+ const {color:tColor} = getThemeColors();
31
+ const titleTextColor = Colors.isValid(titleColor) ? titleColor : tColor;
31
32
  titleProps = defaultObj(titleProps);
32
33
  subtitleProps = defaultObj(subtitleProps);
33
34
  testID = defaultStr(testID)+"_RN_AppBarContent";
@@ -21,7 +21,7 @@ export const getMaxActions = (windowWidth) => {
21
21
  export const isSplitedActions = (actions)=> isObj(actions) && Array.isArray(actions.actions) && Array.isArray(actions.menus);
22
22
 
23
23
  export const getThemeColors = ()=>{
24
- const isDark = theme.isDark(),onPrimary = isDark? theme.colors.onSurface : theme.colors.onPrimary;
24
+ const isDark = theme.isDark() || theme.colors.dark ,onPrimary = isDark? theme.colors.onSurface : theme.colors.onPrimary;
25
25
  return {
26
26
  onPrimary,
27
27
  color : onPrimary,
@@ -395,7 +395,6 @@ const DatagridFactory = (Factory)=>{
395
395
  ]
396
396
  }
397
397
  const isLoading = this.isLoading();
398
- const _progressBar = this.getProgressBar();
399
398
  const pointerEvents = this.getPointerEvents();
400
399
  const {
401
400
  sortedColumns:sortColumns,
@@ -522,7 +521,7 @@ const DatagridFactory = (Factory)=>{
522
521
  actions = {actions}
523
522
  /> : null}
524
523
  {datagridHeader}
525
- {_progressBar}
524
+ {this.renderProgressBar()}
526
525
  {!canRenderChart && showFooters ? (
527
526
  <View testID={testID+"_FooterContainer"} pointerEvents={pointerEvents} style={[theme.styles.justifyContentCenter,theme.styles.pv1]}>
528
527
  <View testID={testID+"_FooterContentContainer"} style={[styles.footersContainer]}>
@@ -17,7 +17,7 @@ import React from "$react";
17
17
  import DateLib from "$lib/date";
18
18
  import Filter,{canHandleFilter,prepareFilters,compareValues} from "$ecomponents/Filter";
19
19
  import {CHECKED_ICON_NAME} from "$ecomponents/Checkbox";
20
- import { COLUMN_WIDTH,DATE_COLUMN_WIDTH,willConvertFiltersToSQL } from "../utils";
20
+ import { COLUMN_WIDTH,DATE_COLUMN_WIDTH,DATE_TIME_COLUMN_WIDTH } from "../utils";
21
21
  import { StyleSheet,Dimensions,useWindowDimensions} from "react-native";
22
22
  import Preloader from "$ecomponents/Preloader";
23
23
  import Checkbox from "../Checkbox";
@@ -26,7 +26,7 @@ import { evalSingleValue,Footer,getFooterColumnValue,isValidAggregator,extendAgg
26
26
  import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$makePhoneCall";
27
27
  import copyToClipboard from "$capp/clipboard";
28
28
  import { Pressable } from "react-native";
29
- import DatagridProgressBar from "$ecomponents/Table/ProgressBar";
29
+ import DatagridProgressBar from "../ProgressBar";
30
30
  import View from "$ecomponents/View";
31
31
  import {Menu} from "$ecomponents/BottomSheet";
32
32
  import {styles as tableStyles} from "$ecomponents/Table";
@@ -40,7 +40,6 @@ import Button from "$ecomponents/Button";
40
40
  import stableHash from "stable-hash";
41
41
  import * as XLSX from "xlsx";
42
42
  import {convertToSQL} from "$ecomponents/Filter";
43
- import appConfig from "$capp/config";
44
43
  import events from "../events";
45
44
  import {MORE_ICON} from "$ecomponents/Icon"
46
45
 
@@ -241,7 +240,7 @@ export default class CommonDatagridComponent extends AppComponent {
241
240
  [footerFieldName] : {
242
241
  value : uniqid(footerFieldName),override:false, writable: false
243
242
  },
244
- progressBarRef : {
243
+ renderProgressBarRef : {
245
244
  value : {current : null}
246
245
  },
247
246
  isLoadingRef : {
@@ -268,7 +267,6 @@ export default class CommonDatagridComponent extends AppComponent {
268
267
  chartRef : {value : {current:null}},
269
268
  layoutRef : {value : {}},
270
269
  hidePreloaderOnRenderKey : {value : uniqid("hide-preloader-on-render")},
271
- isRenderingRef : {value : {current:false}},
272
270
  chartSeriesNamesColumnsMapping : {value : {}},//le mappage entre les index des series et les colonnes coorespondantes
273
271
  });
274
272
  this.setSelectedRows(selectedRows);
@@ -283,7 +281,7 @@ export default class CommonDatagridComponent extends AppComponent {
283
281
  const sessionAggregator = this.getSessionData("aggregatorFunction");
284
282
  this.state.aggregatorFunction= this.isValidAggregator(config.aggregatorFunction) && config.aggregatorFunction || this.isValidAggregator(this.props.aggregatorFunction) && this.props.aggregatorFunction || this.isValidAggregator(sessionAggregator) && sessionAggregator || Object.keys(this.aggregatorFunctions)[0];;
285
283
  this.isLoading = this.isLoading.bind(this);
286
- this.getProgressBar = this.getProgressBar.bind(this);
284
+ this.renderProgressBar = this.renderProgressBar.bind(this);
287
285
  this.sortRef.current.dir = defaultStr(this.sortRef.current.dir,this.sortRef.current.column == "date"?"desc":'asc')
288
286
  this.hasColumnsHalreadyInitialized = false;
289
287
  this.initColumns(props.columns);
@@ -356,13 +354,10 @@ export default class CommonDatagridComponent extends AppComponent {
356
354
  return Promise.reject({});
357
355
  }
358
356
  const fetchOnlyVisibleColumns = !this.isFetchOnlyVisibleColumnsEnabled();
359
- setTimeout(()=>{
360
- this.setIsLoading(true,()=>{
361
- this.toggleHidePreloaderOnRender(true);
362
- this.setSessionData("fetchOnlyVisibleColumns",fetchOnlyVisibleColumns);
363
- this.setState({fetchOnlyVisibleColumns},this.fetchDataIfCanFetchColumnsIfVisible.bind(this))
364
- },true)
365
- },TIMEOUT)
357
+ this.setIsLoading(true,()=>{
358
+ this.setSessionData("fetchOnlyVisibleColumns",fetchOnlyVisibleColumns);
359
+ this.setState({fetchOnlyVisibleColumns},this.fetchDataIfCanFetchColumnsIfVisible.bind(this))
360
+ },TIMEOUT);
366
361
  }
367
362
  isValidAggregator(aggregatorFunction){
368
363
  return isNonNullString(aggregatorFunction) && isValidAggregator(this.aggregatorFunctions[aggregatorFunction])
@@ -971,7 +966,7 @@ export default class CommonDatagridComponent extends AppComponent {
971
966
  };
972
967
  const max = isMobileOrTabletMedia()? 200 : 5000;
973
968
  if(this.INITIAL_STATE.data.length > max){
974
- return this.setIsLoading(true,call,true);
969
+ return this.setIsLoading(true,call);
975
970
  }
976
971
  return call();
977
972
  }
@@ -1156,7 +1151,7 @@ export default class CommonDatagridComponent extends AppComponent {
1156
1151
  this.setSessionData({showFooters:showOrHide});
1157
1152
  })
1158
1153
  })
1159
- },true)
1154
+ },)
1160
1155
  }
1161
1156
  this.setState( {showFooters:showOrHide},()=>{
1162
1157
  this.isUpdating = false;
@@ -1181,7 +1176,7 @@ export default class CommonDatagridComponent extends AppComponent {
1181
1176
  this.updateLayout();
1182
1177
  this.setSessionData("fixedTable",fixedTable);
1183
1178
  })
1184
- },true)
1179
+ })
1185
1180
  },TIMEOUT)
1186
1181
  }
1187
1182
  getSessionNameKey (){
@@ -1190,20 +1185,18 @@ export default class CommonDatagridComponent extends AppComponent {
1190
1185
  /*** affiche ou masque une colonne filtrée */
1191
1186
  toggleFilterColumnVisibility1(field){
1192
1187
  if(!isNonNullString(field)) return;
1193
- setTimeout(()=>{
1194
- this.setIsLoading(true,()=>{
1195
- const filteredColumns = {...this.state.filteredColumns};
1196
- filteredColumns[field] = defaultBool(filteredColumns[field],false) == false ? true : false;
1197
- this.prepareColumns({filteredColumns});
1198
- this.setState({filteredColumns},()=>{
1199
- this.setSessionData("filteredColumns"+this.getSessionNameKey(),filteredColumns);
1200
- if(!filteredColumns[field]){
1201
- this.filters[field] = defaultObj(this.filters[field]);
1202
- this.filters[field].value = this.filters[field].defaultValue = undefined;
1203
- this.doFilter({value:undefined,field})
1204
- }
1205
- });
1206
- },true)
1188
+ this.setIsLoading(true,()=>{
1189
+ const filteredColumns = {...this.state.filteredColumns};
1190
+ filteredColumns[field] = defaultBool(filteredColumns[field],false) == false ? true : false;
1191
+ this.prepareColumns({filteredColumns});
1192
+ this.setState({filteredColumns},()=>{
1193
+ this.setSessionData("filteredColumns"+this.getSessionNameKey(),filteredColumns);
1194
+ if(!filteredColumns[field]){
1195
+ this.filters[field] = defaultObj(this.filters[field]);
1196
+ this.filters[field].value = this.filters[field].defaultValue = undefined;
1197
+ this.doFilter({value:undefined,field})
1198
+ }
1199
+ });
1207
1200
  },TIMEOUT);
1208
1201
  }
1209
1202
  toggleFilterColumnVisibility(field,visible){
@@ -1223,19 +1216,16 @@ export default class CommonDatagridComponent extends AppComponent {
1223
1216
  */
1224
1217
  toggleColumnVisibility(field,removeFocus){
1225
1218
  if(!isNonNullString(field)) return;
1226
- setTimeout(()=>{
1227
- let columns = {...this.state.columns};
1228
- columns[field].visible = !columns[field].visible;
1229
- const footers = this.getFootersFields();
1230
- if(isObj(footers[field])){
1231
- footers[field].visible = columns[field].visible;
1232
- }
1233
- this.setIsLoading(true,()=>{
1234
- this.prepareColumns({columns});
1235
- this.toggleHidePreloaderOnRender(this.canFetchOnlyVisibleColumns());
1236
- this.setState({columns},this.fetchDataIfCanFetchColumnsIfVisible.bind(this));
1237
- })
1238
- },TIMEOUT)
1219
+ let columns = {...this.state.columns};
1220
+ columns[field].visible = !columns[field].visible;
1221
+ const footers = this.getFootersFields();
1222
+ if(isObj(footers[field])){
1223
+ footers[field].visible = columns[field].visible;
1224
+ }
1225
+ this.setIsLoading(true,()=>{
1226
+ this.prepareColumns({columns});
1227
+ this.setState({columns},this.fetchDataIfCanFetchColumnsIfVisible.bind(this));
1228
+ },TIMEOUT);
1239
1229
  }
1240
1230
  /****le nombre maximum de courbes supportées */
1241
1231
  getMaxSeriesSize(){
@@ -1322,21 +1312,19 @@ export default class CommonDatagridComponent extends AppComponent {
1322
1312
  if(!isObj(this.state.sectionListColumns) || !Array.isArray(this.preparedColumns?.sectionListColumnsMenuItems))return;
1323
1313
  const menuItems = this.preparedColumns?.sectionListColumnsMenuItems;
1324
1314
  if(!menuItems.length) return;
1325
- setTimeout(()=>{
1326
- this.setIsLoading(true,()=>{
1327
- const sectionListColumns = {...this.state.sectionListColumns};
1328
- if(enable !== true && isObj(sectionListColumns[columnName])){
1329
- delete sectionListColumns[columnName];
1330
- } else {
1331
- sectionListColumns[columnName] = {field:columnName};
1332
- }
1333
- const {sectionListColumns:pSListColumns} = this.prepareColumns({sectionListColumns});
1334
- this.prepareData({data:this.INITIAL_STATE.data,sectionListColumns:pSListColumns},(state)=>{
1335
- this.setState({...state,sectionListColumns:pSListColumns},()=>{
1336
- this.setSessionData("sectionListColumns",Object.keys(pSListColumns));
1337
- });
1315
+ this.setIsLoading(true,()=>{
1316
+ const sectionListColumns = {...this.state.sectionListColumns};
1317
+ if(enable !== true && isObj(sectionListColumns[columnName])){
1318
+ delete sectionListColumns[columnName];
1319
+ } else {
1320
+ sectionListColumns[columnName] = {field:columnName};
1321
+ }
1322
+ const {sectionListColumns:pSListColumns} = this.prepareColumns({sectionListColumns});
1323
+ this.prepareData({data:this.INITIAL_STATE.data,sectionListColumns:pSListColumns},(state)=>{
1324
+ this.setState({...state,sectionListColumns:pSListColumns},()=>{
1325
+ this.setSessionData("sectionListColumns",Object.keys(pSListColumns));
1338
1326
  });
1339
- },true);
1327
+ });
1340
1328
  },TIMEOUT);
1341
1329
  }
1342
1330
  removeAllColumnsInSectionList(){
@@ -1348,7 +1336,7 @@ export default class CommonDatagridComponent extends AppComponent {
1348
1336
  this.setSessionData("displayOnlySectionListHeaders",false);
1349
1337
  });
1350
1338
  });
1351
- },true);
1339
+ });
1352
1340
  }
1353
1341
  canDisplayOnlySectionListHeaders(){
1354
1342
  return this.hasFootersFields() && this.isSectionList() && this.hasSectionListData();
@@ -1378,15 +1366,13 @@ export default class CommonDatagridComponent extends AppComponent {
1378
1366
  this.setState({displayType},()=>{
1379
1367
  this.persistDisplayType(displayType);
1380
1368
  });
1381
- },true)
1369
+ })
1382
1370
  } else {
1383
1371
  const cb = (config)=>{
1384
- setTimeout(()=>{
1385
- this.setIsLoading(true,()=>{
1386
- this.setState({config,displayType},()=>{
1387
- this.persistDisplayType(displayType);
1388
- })
1389
- },true);
1372
+ this.setIsLoading(true,()=>{
1373
+ this.setState({config,displayType},()=>{
1374
+ this.persistDisplayType(displayType);
1375
+ })
1390
1376
  },200);
1391
1377
  }
1392
1378
  if(!this.isValidChartConfig()){
@@ -1404,15 +1390,13 @@ export default class CommonDatagridComponent extends AppComponent {
1404
1390
  return this.aggregatorFunctions[Object.keys(this.aggregatorFunctions)[0]];
1405
1391
  }
1406
1392
  toggleAbreviateValues(){
1407
- setTimeout(()=>{
1408
- this.setIsLoading(true,()=>{
1409
- this.prepareData({data:this.INITIAL_STATE.data},(state)=>{
1410
- const abreviateValues = !this.state.abreviateValues;
1411
- this.setState({abreviateValues,...state},()=>{
1412
- this.setSessionData("abreviateValues",abreviateValues);
1413
- })
1414
- });
1415
- },true);
1393
+ this.setIsLoading(true,()=>{
1394
+ this.prepareData({data:this.INITIAL_STATE.data},(state)=>{
1395
+ const abreviateValues = !this.state.abreviateValues;
1396
+ this.setState({abreviateValues,...state},()=>{
1397
+ this.setSessionData("abreviateValues",abreviateValues);
1398
+ })
1399
+ });
1416
1400
  },TIMEOUT);
1417
1401
  }
1418
1402
  /**** récupère l'item de menu permettant lié à la sélection de la fonction d'aggggrégation */
@@ -1506,12 +1490,13 @@ export default class CommonDatagridComponent extends AppComponent {
1506
1490
  const nConfig = {...config,...data};
1507
1491
  this.setSessionData("config",nConfig);
1508
1492
  DialogProvider.close();
1509
- this.setIsLoading(true,true);
1510
- this.prepareData({data:this.INITIAL_STATE.data,config:nConfig},(state)=>{
1511
- this.setState({...state,config:nConfig},()=>{
1512
- resolve(nConfig)
1493
+ this.setIsLoading(true, ()=>{
1494
+ this.prepareData({data:this.INITIAL_STATE.data,config:nConfig},(state)=>{
1495
+ this.setState({...state,config:nConfig},()=>{
1496
+ resolve(nConfig)
1497
+ });
1513
1498
  })
1514
- })
1499
+ });
1515
1500
  }
1516
1501
  }
1517
1502
  ]
@@ -1990,7 +1975,7 @@ export default class CommonDatagridComponent extends AppComponent {
1990
1975
  this.configureChart(false).then((config)=>{
1991
1976
  this.setIsLoading(true,()=>{
1992
1977
  this.setState({config});
1993
- },true)
1978
+ })
1994
1979
  })
1995
1980
  }
1996
1981
  });
@@ -2390,18 +2375,17 @@ export default class CommonDatagridComponent extends AppComponent {
2390
2375
  const showFooters = true;
2391
2376
  const displayOnlySectionListHeaders = !!!this.state.displayOnlySectionListHeaders;
2392
2377
  this.setSessionData("displayOnlySectionListHeaders",displayOnlySectionListHeaders);
2393
- this.toggleHidePreloaderOnRender(true);
2394
2378
  if(!displayOnlySectionListHeaders){
2395
2379
  return this.setIsLoading(true,()=>{
2396
2380
  this.prepareData({data:this.INITIAL_STATE.data,displayOnlySectionListHeaders},(state)=>{
2397
2381
  this.setState({...state,showFooters});
2398
2382
  })
2399
- },true);
2383
+ });
2400
2384
  } else {
2401
2385
  this.setIsLoading(true,()=>{
2402
2386
  const data = this.state.data.filter((d)=>d?.isSectionListHeader === true);
2403
2387
  this.setState({data,displayOnlySectionListHeaders,showFooters});
2404
- },true)
2388
+ })
2405
2389
  }
2406
2390
  },0);
2407
2391
  }
@@ -2517,7 +2501,7 @@ export default class CommonDatagridComponent extends AppComponent {
2517
2501
  width = COLUMN_WIDTH;
2518
2502
  }
2519
2503
  if(type.contains("date")|| type.contains("time")){
2520
- const mWidth = type.toLowerCase().contains('datetime')? (DATE_COLUMN_WIDTH+30) : DATE_COLUMN_WIDTH;
2504
+ const mWidth = type.toLowerCase().contains('datetime')? DATE_TIME_COLUMN_WIDTH : DATE_COLUMN_WIDTH;
2521
2505
  width = Math.max(width,mWidth);
2522
2506
  } else if((type.contains("number") || type.contains("decimal") && this.props.format)){
2523
2507
  width = Math.max(width,DATE_COLUMN_WIDTH-30);
@@ -2752,7 +2736,7 @@ export default class CommonDatagridComponent extends AppComponent {
2752
2736
  getColumns(){
2753
2737
  return isObj(this.state.columns)? this.state.columns : {};
2754
2738
  }
2755
- prepareData(args,cb){
2739
+ prepareData (args,cb){
2756
2740
  let {pagination,config,aggregatorFunction:customAggregatorFunction,displayOnlySectionListHeaders:cdisplayOnlySectionListHeaders,data,force,sectionListColumns,sectionListCollapsedStates,updateFooters} = defaultObj(args);
2757
2741
  cb = typeof cb ==='function'? cb : typeof args.cb == 'function'? args.cb : undefined;
2758
2742
  config = isObj(config) && Object.size(config,true)? config : this.getConfig();
@@ -2938,11 +2922,9 @@ export default class CommonDatagridComponent extends AppComponent {
2938
2922
  const s = getSectionListCollapsedStates;
2939
2923
  if(!isNonNullString(sectionKey)) return;
2940
2924
  s[sectionKey] = !!!s[sectionKey];
2941
- setTimeout(()=>{
2942
- this.setIsLoading(true,()=>{
2943
- this.setState({sectionListCollapsedStates:{...s}});
2944
- },true);
2945
- },TIMEOUT)
2925
+ this.setIsLoading(true,()=>{
2926
+ this.setState({sectionListCollapsedStates:{...s}});
2927
+ },TIMEOUT);
2946
2928
  }
2947
2929
  /****permet de faire le rendu flashlist */
2948
2930
  renderFlashListItem(args){
@@ -3046,22 +3028,23 @@ export default class CommonDatagridComponent extends AppComponent {
3046
3028
  return sRows;
3047
3029
  }
3048
3030
 
3049
- getProgressBar(props){
3050
- if(typeof props !=='object' || !props){
3031
+ renderProgressBar(props){
3032
+ if(typeof props !=='object' || !props || Array.isArray(props)){
3051
3033
  props = {};
3052
3034
  }
3053
- const ProgressBar = this.props.progressBar;
3035
+ const ProgressBar = this.props.renderProgressBar;
3054
3036
  const children = React.isValidElement(ProgressBar) ? ProgressBar :
3055
- this.props.useLinesProgressBar === true || this.props.useLineProgressBar === true ? CommonDatagridComponent.LineProgressBar(props)
3037
+ this.props.useLinesProgressBar === true || this.props.withLineProgressBar ===true || this.props.useLineProgressBar === true ? CommonDatagridComponent.LineProgressBar(props)
3056
3038
  : React.isComponent(ProgressBar) ?<ProgressBar/> : this.getDefaultPreloader(props);
3057
3039
  return <DatagridProgressBar
3058
3040
  {...props}
3041
+ datagridContext = {this}
3059
3042
  onChange = {(context)=>{
3060
3043
  this.isLoadingRef.current = context.isLoading;
3061
3044
  }}
3062
- isLoading = {defaultBool(this.props.isLoading,this.isLoading())}
3045
+ isLoading = {this.isLoading()}
3063
3046
  children = {children}
3064
- ref = {this.progressBarRef}
3047
+ ref = {this.renderProgressBarRef}
3065
3048
  />
3066
3049
  }
3067
3050
  handlePagination(start, limit, page) {
@@ -3146,7 +3129,7 @@ export default class CommonDatagridComponent extends AppComponent {
3146
3129
  }
3147
3130
  ///si les filtres devront être convertis au format SQL
3148
3131
  willConvertFiltersToSQL(){
3149
- return !!defaultVal(this.props.convertFiltersToSQL,willConvertFiltersToSQL());;
3132
+ return !!defaultVal(this.props.convertFiltersToSQL);;
3150
3133
  }
3151
3134
  /*** retourne la liste des colonnes sur lesquelles on peut effectuer un filtre*/
3152
3135
  getFilterableColumnsNames(){
@@ -3298,7 +3281,7 @@ export default class CommonDatagridComponent extends AppComponent {
3298
3281
  reject(e);
3299
3282
  });
3300
3283
  }
3301
- },true);
3284
+ });
3302
3285
  },1);
3303
3286
  })
3304
3287
  return this.fetchingPromiseData;
@@ -3322,9 +3305,8 @@ export default class CommonDatagridComponent extends AppComponent {
3322
3305
  cb(data)
3323
3306
  }
3324
3307
  resolve(data);
3325
- this.isRenderingRef.current = false;
3326
3308
  this.isFetchingData = undefined;
3327
- this.setIsLoading(false,false);
3309
+ this.setIsLoading(false);
3328
3310
  })
3329
3311
  });
3330
3312
  })
@@ -3418,7 +3400,7 @@ export default class CommonDatagridComponent extends AppComponent {
3418
3400
  fetchOptions.dataSources = this.currentDataSources;
3419
3401
  fetchOptions.selector = fetchFilters;
3420
3402
  fetchOptions.sort = this.getSort();
3421
- const canIncludeField = typeof this.props.includeFieldsInFetchOptions =='boolean'? this.props.includeFieldsInFetchOptions : defaultBool(appConfig.get("includeFieldsInDatagridFetchOptions")) !== false;
3403
+ const canIncludeField = typeof this.props.includeFieldsInFetchOptions =='boolean'? this.props.includeFieldsInFetchOptions : true;
3422
3404
  if(canIncludeField){
3423
3405
  const ff = this.getFilterableColumnsNames();
3424
3406
  let fields = ff;
@@ -3560,7 +3542,7 @@ export default class CommonDatagridComponent extends AppComponent {
3560
3542
  return Math.max(max-this.getSectionListDataSize(),0);
3561
3543
  }
3562
3544
  canSetIsLoading(){
3563
- return isObj(this.progressBarRef.current) && typeof this.progressBarRef.current.setIsLoading =='function' ? true : false;
3545
+ return (this.renderProgressBarRef.current) && typeof this.renderProgressBarRef.current.setIsLoading =='function' ? true : false;
3564
3546
  }
3565
3547
  canHidePreloaderOnRender(){
3566
3548
  const cH = this[this.hidePreloaderOnRenderKey];
@@ -3570,60 +3552,22 @@ export default class CommonDatagridComponent extends AppComponent {
3570
3552
  this[this.hidePreloaderOnRenderKey] = !!toggle;
3571
3553
  }
3572
3554
  onRender(){
3573
- if(!this.canHidePreloaderOnRender() && this.isTableData() && this.canFetchOnlyVisibleColumns()) {
3574
- return;
3575
- }
3576
- if(typeof this.props.onRender ==='function' && this.props.onRender({context:this}) === false){
3577
- return ;
3578
- }
3579
- if(this.isTableData() && this.isRenderingRef.current !== true){
3555
+ if(!this.props.isLoading && this.isLoadingRef.current){
3556
+ this.setIsLoading(false);
3580
3557
  return;
3581
3558
  }
3582
- this.isRenderingRef.current = false;
3583
- return this.setIsLoading(false,undefined,undefined);
3584
3559
  }
3585
3560
  /***
3586
3561
  * @param {boolean} loading
3587
3562
  * @param {function | boolean} cb | enablePointerEvents
3588
- * @param {boolean|function} enablePointerEvents
3589
3563
  */
3590
- setIsLoading (loading,cb,enablePointerEvents,timeout){
3591
- if(typeof cb =='boolean'){
3592
- const t = enablePointerEvents;
3593
- enablePointerEvents = cb;
3594
- cb = t;
3595
- }
3596
- if(typeof enablePointerEvents =='boolean'){
3597
- this.enablePointerEventsRef.current = enablePointerEvents;
3598
- }
3564
+ setIsLoading (loading,cb,timeout){
3565
+ loading = this.props.isLoading === true ? true : typeof loading =='boolean'? loading : false;
3599
3566
  timeout = typeof timeout =='number'? timeout : 500;
3600
3567
  cb = typeof cb =='function'? cb : x=>true;
3601
- if(this.canSetIsLoading() && typeof loading =='boolean'){
3602
- if(loading === true){
3603
- this.isRenderingRef.current = true;
3604
- } else if(this.isRenderingRef.current === true){
3605
- return setTimeout(cb,timeout);;
3606
- }
3607
- return this.progressBarRef.current.setIsLoading(loading,()=>{
3608
- setTimeout(cb,timeout);
3609
- });
3610
- } else {
3611
- setTimeout(cb,timeout);
3612
- }
3613
- }
3614
- /**** met à jour l'état de progression de la mise à jour du tableau */
3615
- updateProgress(isLoading,cb){
3616
- this.isLoadingRef.current = defaultBool(isLoading,!!!this.isLoadingRef.current);
3617
- cb = typeof cb =='function'?cb : typeof isLoading =='function'? isLoading : null
3618
- if(isLoading){
3619
- this.isRenderingRef.current = true;
3620
- }
3621
- if(this.canSetIsLoading()){
3622
- return this.setIsLoading(isLoading,cb);
3623
- }
3624
- cb && setTimeout(() => {
3625
- cb();
3626
- }, 200);
3568
+ this.isLoadingRef.current = loading;
3569
+ this.trigger("toggleIsLoading",{isLoading:loading});
3570
+ return setTimeout(cb,timeout);
3627
3571
  }
3628
3572
  isAllRowsSelected(){
3629
3573
  const count = this.getSelectedRowsCount() - this.getSectionListDataSize();
@@ -3684,25 +3628,32 @@ export default class CommonDatagridComponent extends AppComponent {
3684
3628
  return false;
3685
3629
  }
3686
3630
  UNSAFE_componentWillReceiveProps(nextProps){
3687
- if(nextProps.data === this.props.data || React.areEquals(nextProps.data,this.props.data)) {
3631
+ const cb = ()=>{
3632
+ if(typeof nextProps.isLoading =='boolean' && nextProps.isLoading !== this.isLoading()){
3633
+ this.setIsLoading(nextProps.isLoading);
3634
+ }
3688
3635
  return false;
3689
3636
  }
3637
+ if(nextProps.data === this.props.data || React.areEquals(nextProps.data,this.props.data)) {
3638
+ return cb();
3639
+ }
3690
3640
  const newStableHash = stableHash(nextProps.data);
3691
3641
  this.prevStableDataHash = this.prevStableDataHash !== undefined ? this.prevStableDataHash : stableHash(this.props.data);
3692
- if(newStableHash == this.prevStableDataHash) return false;
3642
+ if(newStableHash == this.prevStableDataHash) return cb();
3693
3643
  this.prevStableDataHash = newStableHash;
3694
- this.setIsLoading(true,true);
3695
- this.prepareData({...nextProps,force:true},(state)=>{
3696
- this.setState(state)
3697
- });
3644
+ this.setIsLoading(true,()=>{
3645
+ this.prepareData({...nextProps,force:true},(state)=>{
3646
+ this.setState(state)
3647
+ })
3648
+ },0);
3698
3649
  }
3699
3650
  getDefaultPreloader(props){
3700
3651
  return CommonDatagridComponent.getDefaultPreloader();
3701
3652
  }
3702
3653
  isLoading (){
3703
- if(this.state.isReady === false || this.isRenderingRef.current) return true;
3654
+ if(this.state.isReady === false) return true;
3704
3655
  if(typeof this.props.isLoading =='boolean') return this.props.isLoading;
3705
- return this.isLoadingRef.current === true ? true : false;
3656
+ return !!this.isLoadingRef.current;
3706
3657
  }
3707
3658
  getLinesProgressBar(){
3708
3659
  return CommonDatagridComponent.LinesProgressBar(this.props);
@@ -4014,7 +3965,7 @@ CommonDatagridComponent.propTypes = {
4014
3965
  */
4015
3966
  filter : PropTypes.func,
4016
3967
  /*** la barre de progression */
4017
- progressBar : PropTypes.node,
3968
+ renderProgressBar : PropTypes.node,
4018
3969
  /*** fonction permettant de retourner l'unique clé des éléments du tableau */
4019
3970
  getRowKey : PropTypes.func,
4020
3971
  ///la fonction utilisée pour l'impression du datagrid
@@ -57,9 +57,9 @@ export default class CommonTableDatagrid extends CommonDatagrid{
57
57
  isTableData(){
58
58
  return true;
59
59
  }
60
- getProgressBar(props){
60
+ renderProgressBar(props){
61
61
  if(this.isDataJustComeToUpsert) return null;
62
- return super.getProgressBar(props);
62
+ return super.renderProgressBar(props);
63
63
  }
64
64
  }
65
65
 
@@ -95,7 +95,6 @@ export default class DatagridDashboard extends TableData {
95
95
  titleProps = Object.assign({},titleProps);
96
96
  testID = this.getTestID();
97
97
  rest = defaultObj(rest);
98
- const _progressBar = this.getProgressBar();
99
98
  const pointerEvents = this.getPointerEvents();
100
99
  const maxHeight = 300;
101
100
  return <View {...rest} testID={testID} style={[styles.container,{maxHeight},rest.style]} pointerEvents={pointerEvents}>
@@ -110,7 +109,7 @@ export default class DatagridDashboard extends TableData {
110
109
  />
111
110
  </View> : null}
112
111
  {<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
113
- {_progressBar}
112
+ {this.renderProgressBar()}
114
113
  {this.renderChart()}
115
114
  </View>}
116
115
  </View>
@@ -8,11 +8,13 @@ import {isDesktopMedia,isMobileMedia} from "$cplatform/dimensions";
8
8
  import {isFunction,defaultVal,defaultStr} from "$cutils";
9
9
  import React from "$react";
10
10
  import {getRenderType} from "./utils";
11
+ import useExpoUI from "$econtext/hooks";
11
12
 
12
13
 
13
14
  const DatagridMainComponent = React.forwardRef((props,ref)=>{
14
15
  const isDesk = isDesktopMedia();
15
16
  const isMob = defaultStr(isMobileMedia());
17
+ const {components:{datagrid}} = useExpoUI();
16
18
  const isTableData = typeof props.isTableData =='boolean'? props.isTableData : defaultStr(props.tableName,props.table).trim() || typeof props.fetchData ==='function'?true : false;
17
19
  const rType = defaultStr(getRenderType()).toLowerCase().trim();
18
20
  const renderType = defaultStr(rType && ['table','accordion'].includes(rType) ? rType : "",isDesk? "table":'accordion').trim().toLowerCase();
@@ -24,6 +26,7 @@ const DatagridMainComponent = React.forwardRef((props,ref)=>{
24
26
  return isTableData ? DatagridTableData : Table;
25
27
  },[isTableData,renderType,canRenderAccordion,isMob])
26
28
  return <Component
29
+ {...datagrid}
27
30
  {...props}
28
31
  ref = {ref}
29
32
  />;
@@ -0,0 +1,30 @@
1
+ // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+ import React from "$react";
5
+ import {defaultBool} from "$cutils";
6
+
7
+ const DatagridProgressBar = React.forwardRef(({datagridContext,children},ref)=>{
8
+ const [isLoading,_setIsLoading] = React.useState(defaultBool(datagridContext?.props?.isLoading));
9
+ const isMounted = React.useIsMounted();
10
+ const setIsLoading = (nLoading)=>{
11
+ if(!isMounted() || typeof nLoading == isLoading) return;
12
+ _setIsLoading(nLoading);
13
+ }
14
+ React.useEffect(()=>{
15
+ if(datagridContext?.on){
16
+ const onToggleLoading = ({isLoading:newIsLoading})=>{
17
+ setIsLoading(newIsLoading);
18
+ }
19
+ datagridContext.on("toggleIsLoading",onToggleLoading);
20
+ return ()=>{
21
+ datagridContext?.off("toggleIsLoading",onToggleLoading);
22
+ }
23
+ }
24
+ },[datagridContext])
25
+ return !isLoading || !React.isValidElement(children) ? null : children;
26
+ });
27
+
28
+ DatagridProgressBar.displayName ="DatagridProgressBar";
29
+
30
+ export default DatagridProgressBar;
@@ -20,7 +20,6 @@ import Label from "$ecomponents/Label";
20
20
  import { StyleSheet,View } from "react-native";
21
21
  import theme from "$theme";
22
22
  import useSWR from "$swr";
23
- import appConfig from "$capp/config";
24
23
  import {getRowsPerPagesLimits} from "./Common/utils";
25
24
  import PropTypes from "prop-types";
26
25
  import {Menu} from "$ecomponents/BottomSheet";
@@ -392,7 +391,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
392
391
  handleQueryLimit = {false}
393
392
  handlePagination = {false}
394
393
  autoSort = {canSortRemotely()? false : true}
395
- isLoading = {loading && !error && showProgressRef.current && true || false}
394
+ isLoading = {loading /*&& !error*/ && showProgressRef.current && true || false}
396
395
  beforeFetchData = {(args)=>{
397
396
  if(typeof beforeFetchData =="function" && beforeFetchData(args)==false) return;
398
397
  let {fetchOptions:opts,force} = args;
@@ -159,7 +159,6 @@ const DatagridFactory = (Factory)=>{
159
159
  const hasFootersFields = this.hasFootersFields();
160
160
  const {columnsWidths:widths} = this.state;
161
161
  const showFooters = this.canShowFooters(), showFilters = this.canShowFilters();
162
- const progressBar = this.getProgressBar();
163
162
  const pointerEvents = this.getPointerEvents();
164
163
 
165
164
  const restItems = [...this.renderCustomMenu()];
@@ -297,7 +296,7 @@ const DatagridFactory = (Factory)=>{
297
296
  actions = {actions}
298
297
  /> : null}
299
298
  {rPagination}
300
- {progressBar}
299
+ {this.renderProgressBar()}
301
300
  </View>
302
301
  {canRenderChart ?
303
302
  <View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
@@ -120,6 +120,8 @@ export const ROW_BORDER_STYLE = {
120
120
 
121
121
  export const DATE_COLUMN_WIDTH = 200;
122
122
 
123
+ export const DATE_TIME_COLUMN_WIDTH = 280;
124
+
123
125
  export {LINE_HEIGHT}
124
126
 
125
127
  export const styles = ({
@@ -188,6 +190,4 @@ export const getRowStyle = ({row,bordered,numColumns,rowData,isAccordion,isTable
188
190
  style.push(styles.noHorizontalBorder);
189
191
  }
190
192
  return style;
191
- }
192
-
193
- export const willConvertFiltersToSQL = x=>!!appConfig.get("convertFiltersToSQL");
193
+ }
@@ -15,7 +15,7 @@ import {MAX_WIDTH,SCREEN_INDENT,MIN_HEIGHT} from "./utils";
15
15
  import {isMobileOrTabletMedia,isMobileMedia} from "$cplatform/dimensions";
16
16
  import Platform,{isMobileNative} from "$cplatform";
17
17
  import Icon,{BACK_ICON} from "$ecomponents/Icon";
18
- import {ACTION_ICON_SIZE} from "$ecomponents/AppBar";
18
+ import {ACTION_ICON_SIZE,getThemeColors} from "$ecomponents/AppBar";
19
19
  import DialogFooter from "./DialogFooter";
20
20
  import { Dimensions } from "react-native";
21
21
  import Surface from "$ecomponents/Surface";
@@ -88,7 +88,7 @@ const DialogComponent = React.forwardRef((props,ref)=>{
88
88
  appBarProps = defaultObj(appBarProps);
89
89
  subtitle = subtitle !== false ? defaultVal(appBarProps.subtitle,modalProps.subtitle,subtitle) : null;
90
90
  backActionProps = Object.assign({},backActionProps);
91
- backActionProps.color = Colors.isValid(backActionProps.color)? backActionProps.color : theme.colors.onPrimary;
91
+ backActionProps.color = Colors.isValid(backActionProps.color)? backActionProps.color : getThemeColors().onPrimary;
92
92
  cancelButton = cancelButton === false || modalProps.cancelButton === false ? null : isObj(cancelButton)? {...cancelButton} : {};
93
93
  if(isNonNullString(no)){
94
94
  no = {label:no};
@@ -9,9 +9,9 @@ import actions from "$cactions";
9
9
  import {navigateToTableData} from "$enavigation/utils";
10
10
  import {getFetchOptions,prepareFilters} from "$cutils/filters";
11
11
  import fetch from "$capi"
12
- import {willConvertFiltersToSQL} from "$ecomponents/Datagrid/utils";
13
12
  import React from "$react";
14
13
  import useApp from "$econtext/hooks";
14
+ import DateLib from "$lib/date";
15
15
 
16
16
  /*** la tabledataSelectField permet de faire des requêtes distantes pour rechercher les données
17
17
  * Elle doit prendre en paramètre et de manière requis : les props suivante :
@@ -19,11 +19,11 @@ import useApp from "$econtext/hooks";
19
19
  * foreignKeyTable : la tableData dans laquelle effectuer les donées de la requêtes
20
20
  * foreignKeyLabel : Le libélé dans la table étrangère
21
21
  */
22
- const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,getForeignKeyTable:cGetForeignKeyTable,prepareFilters:cPrepareFilters,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
22
+ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyLabelRenderers,isStructData,getForeignKeyTable:cGetForeignKeyTable,prepareFilters:cPrepareFilters,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
23
23
  props.data = defaultObj(props.data);
24
24
  const type = defaultStr(props.type)?.toLowerCase();
25
25
  isStructData = isStructData || type?.replaceAll("-","").replaceAll("_","").trim().contains("structdata");
26
- const {getTableData:appGetForeignKeyTable,getStructData} = useApp();
26
+ const {getTableData:appGetForeignKeyTable,getStructData,components:{datagrid}} = useApp();
27
27
  if(!foreignKeyColumn && isNonNullString(props.field)){
28
28
  foreignKeyColumn = props.field;
29
29
  }
@@ -31,11 +31,13 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
31
31
  foreignKeyColumn = foreignKeyColumn.trim();
32
32
  }
33
33
  if(isNonNullString(foreignKeyLabel)){
34
- foreignKeyLabel = foreignKeyLabel.trim();
35
- foreignKeyLabel = foreignKeyLabel.ltrim("[").rtrim("]").split(",");
34
+ foreignKeyLabel = foreignKeyLabel.trim().ltrim("[").rtrim("]").split(",");
35
+ if(!isNonNullString(foreignKeyColumn)){
36
+ foreignKeyLabel = foreignKeyLabel.filter((f)=>f?.toLowerCase()?.trim() !== foreignKeyColumn.toLowerCase().trim());
37
+ }
36
38
  }
37
39
  const getForeignKeyTable = typeof cGetForeignKeyTable =='function'? cGetForeignKeyTable : isStructData ? getStructData: appGetForeignKeyTable;
38
- convertFiltersToSQL = defaultVal(convertFiltersToSQL,willConvertFiltersToSQL());
40
+ convertFiltersToSQL = defaultVal(convertFiltersToSQL,datagrid.convertFiltersToSQL);
39
41
  const foreignKeyTableStr = defaultStr(foreignKeyTable,props.tableName,props.table);
40
42
  if(typeof getForeignKeyTable !=='function'){
41
43
  console.error("la fonction getTableData non définie des les paramètres d'initialisation de l'application!!! Rassurez vous d'avoir définier cette fonction!!, options : foreignKeyTable:",foreignKeyTable,"foreignKeyColumn:",foreignKeyColumn,props)
@@ -209,6 +211,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
209
211
  } else {
210
212
  dropdownActions.trefreshItem = refreshItem;
211
213
  }
214
+ foreignKeyLabelRenderers = defaultObj(foreignKeyLabelRenderers);
212
215
  const rItem = (p)=>{
213
216
  if(!isObj(p) || !isObj(p.item)) return null;
214
217
  let itemLabel = typeof foreignKeyLabel =='function'? foreignKeyLabel(p) : undefined;
@@ -216,12 +219,15 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
216
219
  let itl = "";
217
220
  foreignKeyLabel.map(fk=>{
218
221
  if(!isNonNullString(fk)) return;
222
+ const render = foreignKeyLabelRenderers[fk.trim()];
219
223
  let itv = p.item[fk];
220
- if(typeof itv =='number'){
221
- itv = String(itv);
224
+ if(typeof render =='function'){
225
+ itv = render(p);
226
+ } else if(typeof itv =='string' && itv && DateLib.isIsoDateStr(itv)){
227
+ itv = DateLib.format(itv,DateLib.defaultDateFormat);
222
228
  }
223
229
  itl+= (itl?" ":"")+ (itv || defaultStr(itv))
224
- })
230
+ });
225
231
  if(itl){
226
232
  itemLabel = itl;
227
233
  }
@@ -301,6 +307,8 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
301
307
 
302
308
  TableDataSelectField.propTypes = {
303
309
  ...Dropdown.propTypes,
310
+ /*** permet de faire le mappage entre les foreignKeyLabel et les type correspondants */
311
+ foreignKeyLabelRenderers : PropTypes.object,
304
312
  prepareFilters : PropTypes.bool,//si les filtres seront customisé
305
313
  bindUpsert2RemoveEvents : PropTypes.bool,//si le composant écoutera l'évènement de rafraichissement des données
306
314
  onAdd : PropTypes.func, //({})=>, la fonction appelée lorsque l'on clique sur le bouton add
@@ -30,6 +30,9 @@ import {extendFormFields} from "$ecomponents/Form/Fields";
30
30
  image{ReactComponent} :,
31
31
  text {ReactComponent}
32
32
  },
33
+ datagrid : {
34
+ ///les props par défaut à passer au composant Datagrid
35
+ },
33
36
  customFormFields{Object}, //les composant personalisés des forms fields
34
37
  loginPropsMutator : ({object})=><{object}>, la fonction permettant de muter les props du composant Login,
35
38
  tableLinkPropsMutator : ({object})=><{object}>, la fonction permettant de muter les props du composant TableLink,
@@ -155,7 +158,8 @@ const Provider = ({children,getTableData,handleHelpScreen,navigation,swrConfig,c
155
158
  },
156
159
  tableLinkPropsMutator : (props)=>{
157
160
  return extendProps(components.tableLinkPropsMutator,props);
158
- }
161
+ },
162
+ datagrid : Object.assign({},components.datagrid),
159
163
  },
160
164
  getTableData,
161
165
  getTable : getTableData,
@@ -11,7 +11,7 @@ import {useMemo,useEffect,useRef} from "react";
11
11
  import { screenName as aboutScreenName} from "$escreens/Help/About";
12
12
  import theme from "$theme";
13
13
  import APP from "$capp/instance";
14
- import useExpoUI from "$econtext";
14
+ import useExpoUI from "$econtext/hooks";
15
15
 
16
16
  const useGetItems = (options)=>{
17
17
  const {navigation:{drawerItems}} = useContext();
@@ -1,4 +1,4 @@
1
- import useExpoUI from "$econtext";
1
+ import useExpoUI from "$econtext/hooks";
2
2
  import React from "$react";
3
3
 
4
4
  export default function ExpoUIRealmProvider({children,...props}){
@@ -1 +1 @@
1
- module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.54.3","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.50.3","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.8","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.14","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@react-navigation/stack":{"version":"6.3.18","url":"https://reactnavigation.org/docs/stack-navigator/","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.43.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.13","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.4","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.3","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"},"is-plain-obj":{"version":"4.1.0","license":"MIT"},"js-base64":{"version":"3.7.5","license":"BSD-3-Clause"},"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.5","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-mmkv":{"version":"2.10.2","url":"https://github.com/mrousavy/react-native-mmkv#readme","license":"(MIT AND BSD-3-Clause)"},"react-native-paper":{"version":"5.10.6","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.19.7","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.9","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.6.0","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"2.1.0","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.54.5","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.51.8","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.8","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.14","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@react-navigation/stack":{"version":"6.3.18","url":"https://reactnavigation.org/docs/stack-navigator/","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.43.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.13","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.4","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.3","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"},"is-plain-obj":{"version":"4.1.0","license":"MIT"},"js-base64":{"version":"3.7.5","license":"BSD-3-Clause"},"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.5","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.6","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.19.7","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.9","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.6.0","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"2.1.0","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,58 +0,0 @@
1
- // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
- import React from "$react";
5
- import {defaultBool} from "$cutils";
6
-
7
- const DatagridProgressBar = React.forwardRef(({isLoading:customIsLoading,onChange,children},ref)=>{
8
- const [isLoading,_setIsLoading] = React.useState(defaultBool(customIsLoading));
9
- const isMounted = React.useIsMounted();
10
- const loadingCbRef = React.useRef(null);
11
- const cb = loadingCbRef.current;
12
- loadingCbRef.current = null;
13
- const setIsLoading = (loading)=>{
14
- _setIsLoading(loading);
15
- }
16
- const context = {
17
- isLoading,
18
- setIsLoading : (loading,cb)=>{
19
- if(!isMounted()){
20
- if(typeof cb =='function'){
21
- return cb({});
22
- }
23
- return;
24
- }
25
- if(typeof loading =='boolean' && loading != isLoading){
26
- loadingCbRef.current = cb;
27
- setIsLoading(loading);
28
- } else if(typeof cb =='function'){
29
- cb({isLoading});
30
- }
31
- }
32
- }
33
- React.setRef(ref,context);
34
- React.useEffect(()=>{
35
- if(typeof customIsLoading =='boolean' && customIsLoading != isLoading){
36
- setIsLoading(customIsLoading);
37
- }
38
- },[customIsLoading])
39
- React.useEffect(()=>{
40
- if(typeof cb =='function'){
41
- cb({isLoading});
42
- }
43
- loadingCbRef.current = null;
44
- if(typeof onChange =='function'){
45
- onChange(context);
46
- }
47
- },[isLoading])
48
- React.useEffect(()=>{
49
- return ()=>{
50
- React.setRef(ref,null);
51
- }
52
- },[]);
53
- return !isLoading || !React.isValidElement(children) ? null : children;
54
- });
55
-
56
- DatagridProgressBar.displayName ="DatagridProgressBar";
57
-
58
- export default DatagridProgressBar;