@fto-consult/expo-ui 2.38.1 → 2.38.2

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": "2.38.1",
3
+ "version": "2.38.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,7 +1,6 @@
1
1
  import React from '$react'
2
2
  import PropTypes from 'prop-types'
3
- import {defaultStr,defaultVal,extendObj,defaultObj,uniqid,defaultNumber} from "$utils";
4
- import stableHash from 'stable-hash';
3
+ import {defaultStr,defaultVal,defaultObj,uniqid} from "$utils";
5
4
  import Chart from "./appexChart";
6
5
  import theme from "$theme";
7
6
  import { destroyChart } from './appexChart/utils';
@@ -35,7 +34,7 @@ const ChartComponent = React.forwardRef(({options,onRender,style,height,width,ch
35
34
  chartContext.current.updateOptions(options);
36
35
  }
37
36
  }
38
- },[stableHash(options)]);
37
+ },[(options)]);
39
38
  React.useOnRender(onRender);
40
39
  React.useEffect(()=>{
41
40
  return ()=>{
@@ -2883,7 +2883,6 @@ export default class CommonDatagridComponent extends AppComponent {
2883
2883
  delete this.filteredValues[i];
2884
2884
  })
2885
2885
  this.filters = filters;
2886
- console.log(this.filters," is fffff");
2887
2886
  this.refresh(true);
2888
2887
  this.isClearingAllFilters = false;
2889
2888
  }
@@ -3217,7 +3216,7 @@ export default class CommonDatagridComponent extends AppComponent {
3217
3216
  if(this.isRenderingRef.current === true){
3218
3217
  setTimeout(()=>{
3219
3218
  this.isRenderingRef.current = false;
3220
- return this.setIsLoading(false);
3219
+ return this.setIsLoading(false,undefined,undefined,"yes mannnnaaaaaa");
3221
3220
  },500);
3222
3221
  }
3223
3222
  }
@@ -3226,7 +3225,7 @@ export default class CommonDatagridComponent extends AppComponent {
3226
3225
  * @param {function | boolean} cb | enablePointerEvents
3227
3226
  * @param {boolean|function} enablePointerEvents
3228
3227
  */
3229
- setIsLoading (loading,cb,enablePointerEvents){
3228
+ setIsLoading (loading,cb,enablePointerEvents,timeout){
3230
3229
  if(typeof cb =='boolean'){
3231
3230
  const t = enablePointerEvents;
3232
3231
  enablePointerEvents = cb;
@@ -3235,23 +3234,20 @@ export default class CommonDatagridComponent extends AppComponent {
3235
3234
  if(typeof enablePointerEvents =='boolean'){
3236
3235
  this.enablePointerEventsRef.current = enablePointerEvents;
3237
3236
  }
3238
- const timeout = 300;
3239
- setTimeout(()=>{
3240
- cb = typeof cb =='function'? cb : x=>true;
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
- }
3247
- return this.progressBarRef.current.setIsLoading(loading,()=>{
3248
- setTimeout(cb,timeout);
3249
- });
3250
- } else {
3237
+ timeout = typeof timeout =='number'? timeout : 500;
3238
+ cb = typeof cb =='function'? cb : x=>true;
3239
+ if(this.canSetIsLoading() && typeof loading =='boolean'){
3240
+ if(loading === true){
3241
+ this.isRenderingRef.current = true;
3242
+ } else if(this.isRenderingRef.current === true){
3243
+ return setTimeout(cb,timeout);;
3244
+ }
3245
+ return this.progressBarRef.current.setIsLoading(loading,()=>{
3251
3246
  setTimeout(cb,timeout);
3252
- }
3253
- },loading === false && enablePointerEvents === false ? timeout : 0);
3254
- return false;
3247
+ });
3248
+ } else {
3249
+ setTimeout(cb,timeout);
3250
+ }
3255
3251
  }
3256
3252
  /**** met à jour l'état de progression de la mise à jour du tableau */
3257
3253
  updateProgress(isLoading,cb){
@@ -3324,17 +3320,13 @@ export default class CommonDatagridComponent extends AppComponent {
3324
3320
  return false;
3325
3321
  }
3326
3322
  UNSAFE_componentWillReceiveProps(nextProps){
3327
- if(Object.size(nextProps.data) === Object.size(this.props.data) && (nextProps.data == this.props.data || stableHash(nextProps.data) === stableHash(this.props.data))) {
3328
- /*if( !this.isRenderingRef.current && typeof this.props.isLoading=='boolean' && nextProps.isLoading !== this.props.isLoading && typeof nextProps.isLoading =='boolean'){
3329
- this.setIsLoading(nextProps.isLoading)
3330
- }*/
3323
+ if((stableHash(nextProps.data) === stableHash(this.props.data))) {
3331
3324
  return false;
3332
3325
  }
3333
- this.setIsLoading(true,()=>{
3334
- this.prepareData({...nextProps,force:true},(state)=>{
3335
- this.setState(state)
3336
- });
3337
- },true);
3326
+ this.setIsLoading(true,true);
3327
+ this.prepareData({...nextProps,force:true},(state)=>{
3328
+ this.setState(state)
3329
+ });
3338
3330
  }
3339
3331
  getDefaultPreloader(props){
3340
3332
  return CommonDatagridComponent.getDefaultPreloader();
@@ -187,7 +187,8 @@ export const formatValue = (value,format,abreviateValues)=>{
187
187
  if(typeof value =='boolean'){
188
188
  return value ? "Oui" : "Non";
189
189
  }
190
- if(format && typeof format =='string' && format.toLowerCase() =='money'){
190
+ format = typeof format =='string'? format.toLowerCase().trim() : "";
191
+ if(format =='money'){
191
192
  return abreviateValues? value.abreviate2FormatMoney() : value.formatMoney();
192
193
  }
193
194
  return abreviateValues ? value.abreviate() : value.formatNumber();
@@ -165,7 +165,6 @@ const DatagridFactory = (Factory)=>{
165
165
  const hasFootersFields = this.hasFootersFields();
166
166
  const {columnsWidths:widths} = this.state;
167
167
  const showFooters = this.canShowFooters(), showFilters = this.canShowFilters();
168
- const isLoading = this.isLoading();
169
168
  const progressBar = this.getProgressBar();
170
169
  const pointerEvents = this.getPointerEvents();
171
170
 
@@ -192,7 +191,7 @@ const DatagridFactory = (Factory)=>{
192
191
  }
193
192
  const maxHeight = this.getMaxListHeight();
194
193
  const rPagination = showPagination ? <View style={[styles.paginationContainer]}>
195
- <ScrollView horizontal showsHorizontalScrollIndicator={!isLoading} style={styles.paginationContainerStyle} contentContainerStyle={styles.minW100}>
194
+ <ScrollView horizontal style={styles.paginationContainerStyle} contentContainerStyle={styles.minW100}>
196
195
  <View style={[styles.paginationContent]}>
197
196
  <View testID={testID+"_HeaderQueryLimit"}>
198
197
  {this.renderQueryLimit(this.getStateDataSize().formatNumber())}
@@ -132,37 +132,6 @@ VirtuosoListComponent.displayName = "VirtuosoListComponent";
132
132
 
133
133
  export default VirtuosoListComponent;
134
134
 
135
- function isScrollable (node){
136
- if(!node) return false;
137
- const dim = dimensions(node);
138
- if(!dim) return false;
139
- if(dim.scrollHeight>dim.clientHeight) return true;
140
- if(dim.totalHeight > (dim.clientHeight+dim.scrollHeight+100)) return true;
141
- return false;
142
- }
143
- function lookupForContent (node,level){
144
- if(!node || !isDOMElement(node) || level>=5) return null;
145
- if(typeof level !='number'){
146
- level = 0;
147
- }
148
- console.log("looking for ",node,level,dimensions(node));
149
- if(isScrollable(node)){
150
- return node;
151
- }
152
- return lookupForContent(node.querySelector("div:first-child"),level+1)
153
- }
154
-
155
- function dimensions(el) {
156
- if(!isDOMElement(el)) return null;
157
- var elHeight = el.offsetHeight;
158
- const marginBottom = parseInt(window.getComputedStyle(el).getPropertyValue('margin-bottom'));
159
- const paddingBottom = parseInt(window.getComputedStyle(el).getPropertyValue('padding-bottom'));
160
- return {
161
- height:elHeight,marginBottom,paddingBottom,totalHeight : elHeight+marginBottom+paddingBottom,
162
- width : el.offsetWidth,scrollHeight : el.scrollHeight,clientHeight : el.clientHeight,
163
- }
164
- }
165
-
166
135
  const normalizeEvent = (e)=>{
167
136
  return {
168
137
  nativeEvent: {