@fto-consult/expo-ui 2.49.3 → 2.49.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -561,7 +561,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
561
561
|
callSRowCallback({selected,row,rowIndex,key,cb}){
|
|
562
562
|
let count = Object.size(this.selectedRows);
|
|
563
563
|
let sArg = this.getActionsArgs(selected);
|
|
564
|
-
sArg.count = count;
|
|
564
|
+
sArg.count = sArg.selectedRowsCount = count;
|
|
565
565
|
sArg.rowIndex = sArg.index = rowIndex;
|
|
566
566
|
sArg.rowKey = key;
|
|
567
567
|
if(count >0){
|
|
@@ -581,11 +581,11 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
581
581
|
}
|
|
582
582
|
} else {
|
|
583
583
|
if(count > 0 && isFunction(this.props.onRowsDeselected)){
|
|
584
|
-
this.props.onRowsDeselected.call(this,{context:this,props:this.props});
|
|
584
|
+
this.props.onRowsDeselected.call(this,{...sArg,context:this,props:this.props});
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
if(isFunction(cb)){
|
|
588
|
-
cb(selected,row,rowIndex,{context:this})
|
|
588
|
+
cb(selected,row,rowIndex,{...sArg,context:this})
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
591
|
toggleSelectableColumnCheckbox(update){
|
|
@@ -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 =
|
|
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
|
-
|
|
615
|
-
if(selected && !
|
|
616
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -815,6 +825,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
815
825
|
allData : this.INITIAL_STATE.data,
|
|
816
826
|
props : this.props,
|
|
817
827
|
selectedRows : this.selectedRows,
|
|
828
|
+
selectedRowsCount : this.selectedRowsCount,
|
|
818
829
|
context:this,
|
|
819
830
|
isMobile : isMobileOrTabletMedia(),
|
|
820
831
|
Auth,
|
|
@@ -3692,8 +3703,8 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
3692
3703
|
rowData,
|
|
3693
3704
|
checked : this.isRowSelected(rowKey,rowIndex),
|
|
3694
3705
|
rowsRefs : this.selectedRowsRefs,
|
|
3695
|
-
|
|
3696
|
-
this.handleRowToggle({row:rowData,rowData,rowIndex,rowKey,selected
|
|
3706
|
+
onPress : ({checked})=>{
|
|
3707
|
+
return this.handleRowToggle({row:rowData,rowData,rowIndex,rowKey,selected:!checked})
|
|
3697
3708
|
}
|
|
3698
3709
|
}),style:{},extra:{style:{}}};
|
|
3699
3710
|
} else if((columnField == this.getIndexColumnName())){
|
|
@@ -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
|
/>
|