@fto-consult/expo-ui 2.28.1 → 2.29.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 +2 -2
- package/src/components/Datagrid/Accordion/index.js +9 -20
- package/src/components/Datagrid/Common/Common.js +18 -15
- package/src/components/Datagrid/Table/index.js +1 -1
- package/src/components/Date/FormatSelector.js +13 -2
- package/src/components/List/Common.js +4 -1
- package/src/components/TableLink/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.0",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@emotion/native": "^11.10.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^1.25.
|
|
64
|
+
"@fto-consult/common": "^1.25.4",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
67
67
|
"@react-native-community/datetimepicker": "6.5.2",
|
|
@@ -178,10 +178,11 @@ const DatagridFactory = (Factory)=>{
|
|
|
178
178
|
const rowStyle = style ? [style] : [];
|
|
179
179
|
const rowProps = {};
|
|
180
180
|
const it = this.renderFlashListItem({...args,rowProps,rowStyle});
|
|
181
|
-
if(React.isValidElement(it)){
|
|
182
|
-
return
|
|
181
|
+
if(!React.isValidElement(it)){
|
|
182
|
+
return null;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
const rowKey = defaultVal(args.rowIndex,args.index,args.rowCounterIndex);
|
|
185
|
+
return <View {...rowProps} testID={defaultStr(rowProps.testID,"RNDatagridAccordionSectionHeader")+rowKey} style={[theme.styles.w100,theme.styles.justifyContentCenter,theme.styles.alignItemsCenter,rowProps.style,rowStyle]}>
|
|
185
186
|
{it}
|
|
186
187
|
</View>;
|
|
187
188
|
}
|
|
@@ -258,19 +259,6 @@ const DatagridFactory = (Factory)=>{
|
|
|
258
259
|
getMaxSelectedRows(){
|
|
259
260
|
return isMobileMedia()? 30 : 50;
|
|
260
261
|
}
|
|
261
|
-
showFilters(){
|
|
262
|
-
if(!this._isMounted()) {
|
|
263
|
-
this.isUpdating = false;
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
this.setSessionData({showFilters:true});
|
|
267
|
-
}
|
|
268
|
-
hideFilters (){
|
|
269
|
-
if(!this._isMounted()) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
this.setSessionData({showFilters:false});
|
|
273
|
-
}
|
|
274
262
|
toggleFilterColumnVisibility(field,visible){
|
|
275
263
|
if(!isNonNullString(field)) return;
|
|
276
264
|
let filteredColumns = {...this.state.filteredColumns};
|
|
@@ -485,7 +473,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
485
473
|
}}
|
|
486
474
|
/>
|
|
487
475
|
</View> : null}
|
|
488
|
-
{this.isFilterable()
|
|
476
|
+
{this.isFilterable() ? <View>
|
|
489
477
|
<FiltersAccordionComponent
|
|
490
478
|
testID={testID+"_HeaderFilters"}
|
|
491
479
|
isLoading = {isLoading}
|
|
@@ -498,7 +486,9 @@ const DatagridFactory = (Factory)=>{
|
|
|
498
486
|
/>
|
|
499
487
|
</View> : null}
|
|
500
488
|
{this.renderSectionListMenu()}
|
|
501
|
-
|
|
489
|
+
{this.renderDisplayTypes()}
|
|
490
|
+
{this.renderAggregatorFunctionsMenu()}
|
|
491
|
+
<View pointerEvents={pointerEvents} testID={testID+"_HeaderPagination"} style = {styles.paginationItem}>
|
|
502
492
|
<Menu
|
|
503
493
|
testID={testID+"_HeaderMenus"}
|
|
504
494
|
anchor={(props)=>(<Icon {...props} icon={MENU_ICON}/>)}
|
|
@@ -519,7 +509,6 @@ const DatagridFactory = (Factory)=>{
|
|
|
519
509
|
,icon : showFooters?'view-column':'view-module'
|
|
520
510
|
,text : (showFooters?'Masquer les totaux':'Afficher les totaux')
|
|
521
511
|
}:null,
|
|
522
|
-
...this.getAggregatorFunctionsMenuItems(),
|
|
523
512
|
...this.renderCustomMenu(),
|
|
524
513
|
...restItems,
|
|
525
514
|
!canRenderChart && this.canScrollTo() && {
|
|
@@ -576,7 +565,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
576
565
|
{datagridHeader}
|
|
577
566
|
{_progressBar}
|
|
578
567
|
{!canRenderChart && showFooters ? (
|
|
579
|
-
<View testID={testID+"_FooterContainer"} pointerEvents={pointerEvents} style={[
|
|
568
|
+
<View testID={testID+"_FooterContainer"} pointerEvents={pointerEvents} style={[theme.styles.justifyContentCenter,theme.styles.pv1]}>
|
|
580
569
|
<View testID={testID+"_FooterContentContainer"} style={[styles.footersContainer]}>
|
|
581
570
|
<ScrollView testID={testID+"_FooterScrollView"} horizontal contentContainerStyle={[styles.contentContainerStyle]}>
|
|
582
571
|
<View testID={testID+"_FooterContent"} style={[styles.table]}>
|
|
@@ -1698,6 +1698,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1698
1698
|
chartProps[settingKey] = defaultObj(chartProps[settingKey]);
|
|
1699
1699
|
chartProps[settingKey][key] = config[key];
|
|
1700
1700
|
});
|
|
1701
|
+
|
|
1701
1702
|
const chartOptions = {
|
|
1702
1703
|
...chartProps,
|
|
1703
1704
|
title :extendObj(true,{}, {
|
|
@@ -1738,7 +1739,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1738
1739
|
if(typeof value =="number") return value.formatNumber();
|
|
1739
1740
|
return value;
|
|
1740
1741
|
}
|
|
1741
|
-
chartOptions.chart.id = this.chartIdPrefix+defaultStr(chartType.key,"no-key")
|
|
1742
|
+
chartOptions.chart.id = this.chartIdPrefix+"-"+defaultStr(chartType.key,"no-key");
|
|
1743
|
+
if(!chartType.isDonut){
|
|
1744
|
+
delete chartOptions.labels;
|
|
1745
|
+
}
|
|
1742
1746
|
return <Chart
|
|
1743
1747
|
options = {chartOptions}
|
|
1744
1748
|
key = {chartOptions.chart.id}
|
|
@@ -2127,7 +2131,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2127
2131
|
if(hasSectionColumns){
|
|
2128
2132
|
let sHeader = this.getSectionListHeader({data:d,columnsLength : sectionListColumnsSize,fieldsSize:sectionListColumnsSize,sectionListColumnsLength:sectionListColumnsSize,sectionListColumnsSize,allData:data,rowData:d,index:i,rowIndex,context:this,columns,fields:columns});
|
|
2129
2133
|
if(sHeader === false) return;//on omet la donnée si la fonction de récupération de son header retourne false
|
|
2130
|
-
if(!isNonNullString(sHeader)){
|
|
2134
|
+
if(!isNonNullString(sHeader) || sHeader.toLowerCase().trim() =="undefined"){
|
|
2131
2135
|
if(this.props.ignoreEmptySectionListHeader !== false){
|
|
2132
2136
|
sHeader = this.emptySectionListHeaderValue;
|
|
2133
2137
|
} else return;
|
|
@@ -2233,13 +2237,15 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2233
2237
|
const lStyle = typeof this.props.getSectionListHeaderLabelStyle =='function' ? this.props.getSectionListHeaderLabelStyle(args) : null;
|
|
2234
2238
|
|
|
2235
2239
|
rowProps = defaultObj(rowProps);
|
|
2236
|
-
const
|
|
2240
|
+
const rowKey = defaultVal(args.rowIndex,args.index,args.rowCounterIndex);
|
|
2241
|
+
const testID = rowProps.testID = defaultStr(args.testID,"RN_DatagridSectionListHeader")+"_"+rowKey;
|
|
2237
2242
|
if(Array.isArray(rowStyle)){
|
|
2238
2243
|
if(style){
|
|
2239
2244
|
rowStyle.push(style);
|
|
2240
2245
|
}
|
|
2241
2246
|
}
|
|
2242
2247
|
let cells = null;
|
|
2248
|
+
const isA = this.isAccordion();
|
|
2243
2249
|
if(this.canShowFooters() && isObj(this.sectionListHeaderFooters[key])){
|
|
2244
2250
|
const {visibleColumnsNames,widths} = defaultObj(this.preparedColumns);
|
|
2245
2251
|
if(isObj(visibleColumnsNames) &&isObj(widths)){
|
|
@@ -2249,18 +2255,16 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2249
2255
|
if(typeof widths[column] !== 'number') return null;
|
|
2250
2256
|
const width = widths[column];
|
|
2251
2257
|
if(!column) return null;
|
|
2252
|
-
const
|
|
2258
|
+
const key2 = key+column;
|
|
2253
2259
|
if(!column || !this.state.columns[column] || !footers[column]) {
|
|
2254
2260
|
if(this.isAccordion()) return null;
|
|
2255
|
-
cells.push(<View key={
|
|
2256
|
-
|
|
2257
|
-
</View>)
|
|
2261
|
+
cells.push(<View key={key2} testID={testID+"_FooterCellContainer_"+key2} style={[tableStyles.headerItemOrCell,{width}]}></View>)
|
|
2258
2262
|
} else {
|
|
2259
2263
|
const footer = footers[column];
|
|
2260
|
-
cells.push(<View key={
|
|
2264
|
+
cells.push(<View key={key2} testID={testID+"_FooterCellContainer_"+key2} style={[tableStyles.headerItemOrCell,!isA?{width,alignItems:'flex-start',justifyContent:'flex-start'}:{marginLeft:0,paddingLeft:0,marginRight:5}]}>
|
|
2261
2265
|
<Footer
|
|
2262
|
-
key = {
|
|
2263
|
-
testID={testID+"_FooterItem_"+
|
|
2266
|
+
key = {key2}
|
|
2267
|
+
testID={testID+"_FooterItem_"+key2}
|
|
2264
2268
|
{...footer}
|
|
2265
2269
|
aggregatorFunction = {this.getActiveAggregatorFunction().code}
|
|
2266
2270
|
aggregatorFunctions = {this.aggregatorFunctions}
|
|
@@ -2269,13 +2273,12 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2269
2273
|
/>
|
|
2270
2274
|
</View>)
|
|
2271
2275
|
}
|
|
2272
|
-
|
|
2273
2276
|
});
|
|
2274
2277
|
}
|
|
2275
2278
|
}
|
|
2276
|
-
return <View testID={testID+"_ContentContainer"} style={[theme.styles.w100,theme.styles,theme.styles.justifyContentCenter,theme.styles.
|
|
2277
|
-
<Label testID={testID+"_Label"} splitText numberOfLines={3} textBold style={[theme.styles.w100,{color:theme.colors.primaryOnSurface,fontSize:16},lStyle]}>{label}</Label>
|
|
2278
|
-
{cells ? <View style = {[theme.styles.w100,theme.styles.row,theme.styles.alignItemsFlexStart]}
|
|
2279
|
+
return <View testID={testID+"_ContentContainer"} style={[theme.styles.w100,isA && theme.styles.ph2,theme.styles.justifyContentCenter,theme.styles.alignItemsCenter,theme.styles.pb1,!cells && theme.styles.ml1,theme.styles.mr1,cStyle]}>
|
|
2280
|
+
<Label testID={testID+"_Label"} splitText numberOfLines={3} textBold style={[theme.styles.w100,{color:theme.colors.primaryOnSurface,fontSize:isA?15 :16},lStyle]}>{label}</Label>
|
|
2281
|
+
{cells ? <View testID={testID+"_TableRow"} style = {[theme.styles.w100,theme.styles.row,theme.styles.alignItemsFlexStart,isA && theme.styles.mt05]}
|
|
2279
2282
|
>{cells}</View> : null}
|
|
2280
2283
|
</View>
|
|
2281
2284
|
}
|
|
@@ -2692,10 +2695,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2692
2695
|
}
|
|
2693
2696
|
}
|
|
2694
2697
|
getPointerEvents(){
|
|
2698
|
+
if(this.enablePointerEventsRef.current) return true;
|
|
2695
2699
|
if(this.props.isLoading){
|
|
2696
2700
|
return "none";
|
|
2697
2701
|
}
|
|
2698
|
-
if(this.enablePointerEventsRef.current) return true;
|
|
2699
2702
|
return this.isLoading()? "none":"auto";
|
|
2700
2703
|
}
|
|
2701
2704
|
updateLayout(p){
|
|
@@ -291,7 +291,7 @@ const DatagridFactory = (Factory)=>{
|
|
|
291
291
|
{this.renderSectionListMenu()}
|
|
292
292
|
{this.renderDisplayTypes()}
|
|
293
293
|
{this.renderAggregatorFunctionsMenu()}
|
|
294
|
-
<View testID={testID+"_HeaderPagination"} style = {styles.paginationItem}>
|
|
294
|
+
<View pointerEvents={pointerEvents} testID={testID+"_HeaderPagination"} style = {styles.paginationItem}>
|
|
295
295
|
<BottomSheetMenu
|
|
296
296
|
testID={testID+"_HeaderMenus"}
|
|
297
297
|
anchor={(props)=>(<Icon {...props} icon={'axis-z-arrow'}/>)}
|
|
@@ -22,7 +22,8 @@ DateFormatSelector.displayName = "DateFormatSelector";
|
|
|
22
22
|
export default DateFormatSelector;
|
|
23
23
|
|
|
24
24
|
/*** onAdd est appelé lorsqu'on ajoute un format personalisé */
|
|
25
|
-
export const selectDateFormatFieldProps = ({onAdd:customOnAdd,onAddCustomFormat,...props})=>{
|
|
25
|
+
export const selectDateFormatFieldProps = ({onAdd:customOnAdd,onAddCustomFormat,inputProps,...props})=>{
|
|
26
|
+
const cRight = (p)=><Icon size={20} {...p} name ="material-help" title="Utilisez les champ d : pour date, m pour mois, y pour année, H pour heure, M pour minute, s pour seconde. les jour sur 3 lettres (Lun) sont : ddd, les jours écris complètement sont dddd (Lundi); les mois en court sont définis par mmm (Juil), les mois en complet : mmmm (Juillet)."/>;
|
|
26
27
|
const onAdd = ()=>{
|
|
27
28
|
const labelRef = React.createRef(null);
|
|
28
29
|
const valueRef = React.createRef(null);
|
|
@@ -32,7 +33,8 @@ export const selectDateFormatFieldProps = ({onAdd:customOnAdd,onAddCustomFormat,
|
|
|
32
33
|
<TextField
|
|
33
34
|
type = "text"
|
|
34
35
|
label = "Format personalisé"
|
|
35
|
-
|
|
36
|
+
enableCopy = {false}
|
|
37
|
+
right ={cRight}
|
|
36
38
|
onChange = {(args)=>{
|
|
37
39
|
const {value} = args;
|
|
38
40
|
if(!labelRef.current || !labelRef.current.update) return;
|
|
@@ -73,12 +75,21 @@ export const selectDateFormatFieldProps = ({onAdd:customOnAdd,onAddCustomFormat,
|
|
|
73
75
|
}],
|
|
74
76
|
}))
|
|
75
77
|
};
|
|
78
|
+
inputProps = defaultObj(props.inputProps);
|
|
76
79
|
return {
|
|
77
80
|
items : getDateFormatSelectorItems(),
|
|
78
81
|
getItemValue : ({item})=>item.code,
|
|
79
82
|
renderItem : dateFormatSelectorRenderItem,
|
|
80
83
|
showAdd : true,
|
|
81
84
|
...props,
|
|
85
|
+
inputProps : {
|
|
86
|
+
enableCopy:false,...inputProps,
|
|
87
|
+
right : (p)=>{
|
|
88
|
+
const cc = cRight(p);
|
|
89
|
+
const r = typeof inputProps.right =='function'? inputProps.right(p) : inputProps.right;
|
|
90
|
+
return React.isValidElement(r) ? <>{r}{cc}</> : cc;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
82
93
|
defaultValue : defaultStr(props.defaultValue,props.format),
|
|
83
94
|
onAdd,
|
|
84
95
|
onAdd : undefined,
|
|
@@ -3,7 +3,7 @@ import React from "$react";
|
|
|
3
3
|
import { prepareItems as customPrepareItems,getBToTopRef } from "./utils";
|
|
4
4
|
import theme,{grid,StylePropTypes} from "$theme";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
|
-
import {defaultObj,defaultDecimal,defaultArray,defaultFunc} from "$utils";
|
|
6
|
+
import {defaultObj,isObj,defaultDecimal,defaultArray,defaultFunc} from "$utils";
|
|
7
7
|
import {isMobileMedia} from "$cplatform/dimensions";
|
|
8
8
|
import BackToTop from "$ecomponents/BackToTop";
|
|
9
9
|
import {FlatList,StyleSheet,View} from "react-native";
|
|
@@ -42,6 +42,9 @@ const CommonListComponent = React.forwardRef((props,ref)=>{
|
|
|
42
42
|
},
|
|
43
43
|
renderItem : function({item,index,section,...rest}){
|
|
44
44
|
rest = rest ? rest : {};
|
|
45
|
+
if(isObj(item) && item.isSectionListHeader){
|
|
46
|
+
rest.isSectionListHeader = true;
|
|
47
|
+
}
|
|
45
48
|
let ret = renderItem({item,numColumns,index,section,numColumns,itemContainerWidth:itemWindowWidth,itemWindowWidth,...rest,isScrolling:listRef.current?.isScrolling?true:false,items:defaultArray(context.items)});
|
|
46
49
|
if(typeof ret =='string' || typeof ret =='number'){
|
|
47
50
|
return <Label children = {ret}/>
|
|
@@ -68,8 +68,8 @@ export default TableLinKComponent;
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
TableLinKComponent.propTypes = {
|
|
71
|
-
foreignKeyColumn : PropTypes.string
|
|
72
|
-
foreignKeyTable : PropTypes.string
|
|
71
|
+
foreignKeyColumn : PropTypes.string,//le nom de la colonne de la clé étrangère
|
|
72
|
+
foreignKeyTable : PropTypes.string, //le nom de la table référencée
|
|
73
73
|
fetchForeignData : PropTypes.func, // la fonction permettant de chercher la données à distance
|
|
74
74
|
server : PropTypes.string,//le serveur sur lequel rechercher les données
|
|
75
75
|
primary : PropTypes.bool,//si le composant sera stylé en theme primary de react
|