@fto-consult/expo-ui 2.49.0 → 2.49.4

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.49.0",
3
+ "version": "2.49.4",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -603,17 +603,25 @@ export default class CommonDatagridComponent extends AppComponent {
603
603
  getSelectedRowsCount(){
604
604
  return isDecimal(this.selectedRowsCount) ? this.selectedRowsCount: 0;
605
605
  }
606
+
607
+ //si la ligne peut être sélectionnée
608
+ canSelectCheckedRow(){
609
+ if(!this.isSelectable()) return false;
610
+ if(this.isSelectableMultiple()) return true;
611
+ return this.selectedRowsCount <= 1 ? true : false;
612
+ }
606
613
  /**** fonction appelée lorsque l'on clique sur la checkbox permettant de sélectionner la ligne */
607
614
  handleRowToggle ({row,rowIndex,rowData,rowKey,index, selected,cb,callback},cb2){
608
- if(!this.canSelectRow(row)) return ;
609
- if(typeof rowKey !=='string' && typeof rowKey !=='number') return;
610
- let selectableMultiple = defaultVal(this.props.selectableMultiple,true);
615
+ if(!this.canSelectRow(row)) return false;
616
+ if(typeof rowKey !=='string' && typeof rowKey !=='number') return false;
617
+ let selectableMultiple = this.isSelectableMultiple();
611
618
  rowIndex = defaultNumber(rowIndex,index);
612
619
  cb = defaultFunc(cb,callback,cb2)
613
620
  row = rowData = defaultObj(row,rowData);
614
- let size = this.selectedRowsCount;
615
- if(selected && !selectableMultiple && size >= 1){
616
- return notify.warning("Vous ne pouvez sélectionner plus d'un élément")
621
+ const size = this.selectedRowsCount;
622
+ if(selected && !this.canSelectCheckedRow()){
623
+ notify.warning("Vous ne pouvez sélectionner plus d'un élément");
624
+ return false;
617
625
  }
618
626
  if(!selectableMultiple){
619
627
  this.setSelectedRows();
@@ -629,7 +637,8 @@ export default class CommonDatagridComponent extends AppComponent {
629
637
  this.selectedRowsCount +=1;
630
638
  let max = this.getMaxSelectedRows();
631
639
  if(max && size>= max){
632
- return notify.warning("Vous avez atteint le nombre maximum d'éléments sélectionnable, qui est de "+max.formatNumber())
640
+ notify.warning("Vous avez atteint le nombre maximum d'éléments sélectionnable, qui est de "+max.formatNumber())
641
+ return false;
633
642
  }
634
643
  selectedRows[rowKey] = row;
635
644
  } else {
@@ -645,6 +654,7 @@ export default class CommonDatagridComponent extends AppComponent {
645
654
  } else {
646
655
  this.callSRowCallback({selected,rowData,row,rowIndex,rowKey,cb});
647
656
  }
657
+ return true;
648
658
  }
649
659
  canExportAskDisplayMainContent(){
650
660
  return false;
@@ -1748,9 +1758,6 @@ export default class CommonDatagridComponent extends AppComponent {
1748
1758
  defaultValue : 0,
1749
1759
  type : "switch",
1750
1760
  } : null,
1751
- addEmptyRowAfterTotal : {
1752
-
1753
- },
1754
1761
  },
1755
1762
  actions : [{text:'Exporter',icon : "check"}],
1756
1763
  onSuccess:({data:config})=>{
@@ -3695,8 +3702,8 @@ export default class CommonDatagridComponent extends AppComponent {
3695
3702
  rowData,
3696
3703
  checked : this.isRowSelected(rowKey,rowIndex),
3697
3704
  rowsRefs : this.selectedRowsRefs,
3698
- onChange : ({checked})=>{
3699
- this.handleRowToggle({row:rowData,rowData,rowIndex,rowKey,selected:checked})
3705
+ onPress : ({checked})=>{
3706
+ return this.handleRowToggle({row:rowData,rowData,rowIndex,rowKey,selected:!checked})
3700
3707
  }
3701
3708
  }),style:{},extra:{style:{}}};
3702
3709
  } else if((columnField == this.getIndexColumnName())){
@@ -237,6 +237,13 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
237
237
  cb();
238
238
  }
239
239
  },[isValidating,customIsLoading])
240
+ React.useEffect(()=>{
241
+ setTimeout(x=>{
242
+ if(error && innerRef.current && innerRef.current.isLoading && innerRef.current.isLoading()){
243
+ innerRef.current.setIsLoading(false,false);
244
+ }
245
+ },500)
246
+ },[error])
240
247
  const doRefresh = (showProgress)=>{
241
248
  showProgressRef.current = showProgress ? typeof showProgress ==='boolean' : false;
242
249
  if(isFetchingRef.current) return;
@@ -16,6 +16,7 @@ const Checkbox = React.forwardRef((props,ref)=>{
16
16
  const callOnChangeRef = React.useRef(true);
17
17
  const callOnChange = callOnChangeRef.current;
18
18
  callOnChangeRef.current = true;
19
+
19
20
  React.useEffect(()=>{
20
21
  if(customChecked === checked || !isMounted()) return;
21
22
  setIsChecked(customChecked);
@@ -64,7 +65,7 @@ const Checkbox = React.forwardRef((props,ref)=>{
64
65
  color = {color}
65
66
  icon={checked?checkedIcon:uncheckedIcon}
66
67
  onPress = {(e)=>{
67
- if(onPress && onPress({event:e,checked}) === false) return;
68
+ if(onPress && onPress({event:e,context,checked}) === false) return;
68
69
  setIsChecked(!checked)
69
70
  }}
70
71
  />
@@ -280,7 +280,6 @@ export default class TableDataScreenComponent extends FormDataScreen{
280
280
  if(isObj(customFields)){
281
281
  extendObj(true,fields,customFields);
282
282
  }
283
- console.log(this.primaryKeyFields," is pkeyFields heeeee");
284
283
  ///on effectue une mutator sur le champ en cours de modification
285
284
  if(typeof prepareField =='function'){
286
285
  Object.map(fields,(field,i,counterIndex)=>{