@fto-consult/expo-ui 8.74.0 → 8.75.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 +108 -108
- package/src/components/Datagrid/Accordion/index.js +529 -545
- package/src/components/Datagrid/Common/Common.js +45 -8
- package/src/components/Datagrid/Common/index.js +0 -4
- package/src/components/Datagrid/Dashboard/index.js +3 -4
- package/src/components/Datagrid/IndexComponent.js +8 -9
- package/src/components/Datagrid/Table/index.js +311 -327
- package/src/components/Dropdown/index.js +20 -10
- package/src/screens/Help/openLibraries.js +1 -1
- package/src/components/Datagrid/Common/TableData.js +0 -66
- package/src/components/Datagrid/Common/factory.js +0 -9
- package/src/components/Datagrid/factory.js +0 -12
@@ -46,6 +46,7 @@ import ActivityIndicator from "$ecomponents/ActivityIndicator";
|
|
46
46
|
import {createTableHeader,fields as pdfFields,pageHeaderMargin,sprintf as pdfSprintf} from "$cpdf";
|
47
47
|
import {isWeb,isMobileNative} from "$cplatform";
|
48
48
|
import { createPDF,getFields as getPdfFields } from '$expo-ui/pdf';
|
49
|
+
import actions from '$cactions';
|
49
50
|
|
50
51
|
export const TIMEOUT = 100;
|
51
52
|
|
@@ -178,13 +179,11 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
178
179
|
exportToExcelIsAllowed,
|
179
180
|
renderSectionListIsAllowed,
|
180
181
|
checkPerms : customCheckPerms,
|
182
|
+
tableName,
|
183
|
+
table,
|
184
|
+
dataSource,
|
181
185
|
...rest
|
182
186
|
} = props;
|
183
|
-
if(this.bindResizeEvents()){
|
184
|
-
extendObj(this._events,{
|
185
|
-
SET_DATAGRID_QUERY_LIMIT : this.onSetQueryLimit.bind(this),
|
186
|
-
});
|
187
|
-
}
|
188
187
|
if(this.props.resetSessionData === true){
|
189
188
|
this.resetSessionData();
|
190
189
|
}
|
@@ -230,8 +229,11 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
230
229
|
Object.map(displayTypes,(t,i)=>{
|
231
230
|
if(t.isChart && !perm) return;
|
232
231
|
allowedDisplayTypes[i] = Object.clone(t);
|
233
|
-
})
|
232
|
+
});
|
233
|
+
dataSource = CommonDatagridComponent.getDataSource({...props,dataSource,context:this});
|
234
|
+
tableName = defaultStr(tableName,table).toUpperCase();
|
234
235
|
Object.defineProperties(this,{
|
236
|
+
tableName : {value:tableName,override:false,writable:false},
|
235
237
|
layoutRef : {
|
236
238
|
value : React.createRef(null),
|
237
239
|
},
|
@@ -347,6 +349,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
347
349
|
this.setSessionData({selectedDataSources:this.currentDataSources});
|
348
350
|
this.persistDisplayType(this.state.displayType);
|
349
351
|
}
|
352
|
+
/*** lorsque la données est modifiée */
|
353
|
+
onUpsertData =(arg) =>{
|
354
|
+
return this.refresh({force:true,renderProgressBar:false});
|
355
|
+
}
|
350
356
|
/*** si l'on peut récuperer à distance, les colonnes seulement visibles */
|
351
357
|
canFetchOnlyVisibleColumns(){
|
352
358
|
return this.isTableData() && this.props.canFetchOnlyVisibleColumns && this.isFilterable() && true || false;
|
@@ -3595,12 +3601,38 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
3595
3601
|
}
|
3596
3602
|
componentDidMount(){
|
3597
3603
|
super.componentDidMount();
|
3604
|
+
extendObj(this._events,{
|
3605
|
+
SET_DATAGRID_QUERY_LIMIT : this.onSetQueryLimit.bind(this),
|
3606
|
+
});
|
3598
3607
|
APP.on(APP.EVENTS.SET_DATAGRID_QUERY_LIMIT,this._events.SET_DATAGRID_QUERY_LIMIT);
|
3608
|
+
if(isNonNullString(this.tableName)){
|
3609
|
+
extendObj(this._events,{
|
3610
|
+
onUpsertData : this.onUpsertData.bind(this),
|
3611
|
+
});
|
3612
|
+
this.onUpsertDataSubscription = APP.on(actions.upsert(this.tableName),this._events.onUpsertData);
|
3613
|
+
this.onRemoteDataSubscription = APP.on(actions.remove(this.tableName),this._events.onUpsertData);
|
3614
|
+
}
|
3615
|
+
if(isNonNullString(this.tableName)){
|
3616
|
+
this.fetchData({force:true});
|
3617
|
+
}
|
3599
3618
|
}
|
3600
3619
|
componentWillUnmount(){
|
3601
3620
|
super.componentWillUnmount();
|
3621
|
+
if(isNonNullString(this.tableName)){
|
3622
|
+
if(typeof this.onUpsertDataSubscription?.remove =="function"){
|
3623
|
+
this.onUpsertDataSubscription.remove();
|
3624
|
+
}
|
3625
|
+
if(this._events.onUpsertData){
|
3626
|
+
APP.off(actions.upsert(this.tableName),this._events.onUpsertData);
|
3627
|
+
APP.off(actions.remove(this.tableName),this._events.onUpsertData);
|
3628
|
+
}
|
3629
|
+
if(typeof this.onRemoteDataSubscription?.remove =="function"){
|
3630
|
+
this.onRemoteDataSubscription.remove();
|
3631
|
+
}
|
3632
|
+
}
|
3602
3633
|
APP.off(APP.EVENTS.SET_DATAGRID_QUERY_LIMIT,this._events.SET_DATAGRID_QUERY_LIMIT);
|
3603
3634
|
this.clearEvents();
|
3635
|
+
this.setSelectedRows();
|
3604
3636
|
}
|
3605
3637
|
|
3606
3638
|
/*** s'il s'agit d'un datagrid virtualisé, ie à utiliser le composant react-base-table */
|
@@ -3731,7 +3763,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
3731
3763
|
return "auto";
|
3732
3764
|
}
|
3733
3765
|
isTableData(){
|
3734
|
-
return
|
3766
|
+
return isNonNullString(this.tableName);
|
3735
3767
|
}
|
3736
3768
|
UNSAFE_componentWillReceiveProps(nextProps){
|
3737
3769
|
if(false && !React.areEquals(this.props.columns,nextProps.columns)){
|
@@ -4033,7 +4065,12 @@ CommonDatagridComponent.propTypes = {
|
|
4033
4065
|
/*** si le pied de page sera affiché */
|
4034
4066
|
showFooters : PropTypes.bool,
|
4035
4067
|
/*** les donnnées peuvent être soient retournées par une fonction, soit par un tableau soit une promesse */
|
4036
|
-
data : PropTypes.oneOfType([
|
4068
|
+
data : PropTypes.oneOfType([
|
4069
|
+
PropTypes.func,
|
4070
|
+
PropTypes.string,
|
4071
|
+
PropTypes.object,
|
4072
|
+
PropTypes.array,
|
4073
|
+
]),
|
4037
4074
|
/****
|
4038
4075
|
la prop column def contient dans la propriété datagrid, la prop maxItemsToRender, le nombre d'items maximal à rendre pour le composant de type select table data multiple
|
4039
4076
|
la prop column def de la colonne de type number, qui contient dans la prop datagrid, la fonction render doit retourner un nombre pour otenir les valeur léie à ladite colonne
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import Datagrid from "../Common";
|
2
2
|
import {defaultObj,defaultArray,defaultStr,defaultNumber} from "$cutils";
|
3
3
|
import View from "$ecomponents/View";
|
4
4
|
import { StyleSheet,Dimensions,Pressable } from "react-native";
|
@@ -9,7 +9,7 @@ import { chartTypes } from "../Common/Common";
|
|
9
9
|
import theme from "$theme";
|
10
10
|
import FiltersAccordionComponent from "../Accordion/Filters";
|
11
11
|
|
12
|
-
export default class DatagridDashboard extends
|
12
|
+
export default class DatagridDashboard extends Datagrid {
|
13
13
|
constructor(props){
|
14
14
|
super(props);
|
15
15
|
Object.map(this.displayTypes,(t,i)=>{
|
@@ -121,10 +121,9 @@ export default class DatagridDashboard extends TableData {
|
|
121
121
|
DatagridDashboard.displayName = "DatagridDashboardComponent";
|
122
122
|
|
123
123
|
DatagridDashboard.propTypes = {
|
124
|
-
...defaultObj(
|
124
|
+
...defaultObj(Datagrid.propTypes),
|
125
125
|
}
|
126
126
|
|
127
|
-
|
128
127
|
const styles = StyleSheet.create({
|
129
128
|
paginationContainer : {
|
130
129
|
flexDirection : 'row',
|
@@ -2,8 +2,8 @@
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
3
3
|
// license that can be found in the LICENSE file.
|
4
4
|
|
5
|
-
import Accordion
|
6
|
-
import Table
|
5
|
+
import Accordion from "./Accordion";
|
6
|
+
import Table from "./Table";
|
7
7
|
import {isDesktopMedia,isMobileMedia} from "$cplatform/dimensions";
|
8
8
|
import {isFunction,defaultVal,defaultStr} from "$cutils";
|
9
9
|
import React from "$react";
|
@@ -13,18 +13,17 @@ import useExpoUI from "$econtext/hooks";
|
|
13
13
|
|
14
14
|
const DatagridMainComponent = React.forwardRef((props,ref)=>{
|
15
15
|
const isDesk = isDesktopMedia();
|
16
|
-
const isMob =
|
16
|
+
const isMob = isMobileMedia();
|
17
17
|
const {components:{datagrid}} = useExpoUI();
|
18
|
-
const isTableData = typeof props.isTableData =='boolean'? props.isTableData : defaultStr(props.tableName,props.table).trim() || typeof props.fetchData ==='function'?true : false;
|
19
18
|
const rType = defaultStr(getRenderType()).toLowerCase().trim();
|
20
19
|
const renderType = defaultStr(rType && ['table','accordion'].includes(rType) ? rType : "",isDesk? "table":'accordion').trim().toLowerCase();
|
21
20
|
const canRenderAccordion = (isFunction(props.accordion) || (isObj(props.accordionProps) && isFunction(props.accordionProps.accordion)) || props.accordion === true);
|
22
21
|
const Component = React.useMemo(()=>{
|
23
22
|
if((renderType == 'accordion' || (renderType !=='table' && isMob)) && canRenderAccordion){
|
24
|
-
return
|
23
|
+
return Accordion;
|
25
24
|
}
|
26
|
-
return
|
27
|
-
},[
|
25
|
+
return Table;
|
26
|
+
},[renderType,canRenderAccordion,isMob]);
|
28
27
|
return <Component
|
29
28
|
{...datagrid}
|
30
29
|
{...props}
|
@@ -37,6 +36,6 @@ export default DatagridMainComponent;
|
|
37
36
|
DatagridMainComponent.displayName = "DatagridMainComponent";
|
38
37
|
|
39
38
|
DatagridMainComponent.propTypes = {
|
40
|
-
...
|
39
|
+
...Table.propTypes
|
41
40
|
}
|
42
|
-
DatagridMainComponent.LinesProgressBar = DatagridMainComponent.LineProgressBar =
|
41
|
+
DatagridMainComponent.LinesProgressBar = DatagridMainComponent.LineProgressBar = Table.LineProgressBar;
|