@fto-consult/expo-ui 7.15.1 → 7.16.1
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
@@ -169,7 +169,6 @@ de l'objet rowData de cette propriété
|
|
169
169
|
export default class CommonDatagridComponent extends AppComponent {
|
170
170
|
constructor(props){
|
171
171
|
super(props);
|
172
|
-
this.initSession();
|
173
172
|
this.autobind();
|
174
173
|
let {
|
175
174
|
data,
|
@@ -186,11 +185,14 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
186
185
|
SET_DATAGRID_QUERY_LIMIT : this.onSetQueryLimit.bind(this),
|
187
186
|
});
|
188
187
|
}
|
188
|
+
if(this.props.resetSessionData === true){
|
189
|
+
this.resetSessionData();
|
190
|
+
}
|
189
191
|
rest = defaultObj(rest);
|
190
192
|
this._pagination = defaultObj(rest.pagination);
|
191
193
|
this.hasLocalFilters = false;
|
192
194
|
data = (data && typeof data == 'object')? Object.toArray(data):[];
|
193
|
-
|
195
|
+
const sData = this.getSessionData()
|
194
196
|
sData.showFooters = defaultVal(sData.showFooters,this.isTableData());
|
195
197
|
sData.fixedTable = defaultBool(sData.fixedTable,false);
|
196
198
|
this.rowsByKeys = {};
|
@@ -274,14 +276,15 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
274
276
|
chartSeriesNamesColumnsMapping : {value : {}},//le mappage entre les index des series et les colonnes coorespondantes
|
275
277
|
});
|
276
278
|
this.setSelectedRows(selectedRows);
|
277
|
-
const config = extendObj(true,{},this.getSessionData("config")
|
279
|
+
const config = extendObj(true,{},this.props.chartConfig,this.getSessionData("config"));
|
278
280
|
Object.map(config,(v,k)=>{
|
279
281
|
if(typeof v =='function'){
|
280
282
|
delete config[k];
|
281
283
|
}
|
282
284
|
});
|
283
285
|
this.state.fetchOnlyVisibleColumns = !!defaultVal(this.props.fetchOnlyVisibleColumns,config.fetchOnlyVisibleColumns,this.getSessionData("fetchOnlyVisibleColumns"));
|
284
|
-
|
286
|
+
const abreviateVals = this.getSessionData("abreviateValues");
|
287
|
+
this.state.abreviateValues = abreviateVals !== undefined ? !!abreviateVals : "abreviateValues" in this.props? !!this.props.abreviateValues : true;
|
285
288
|
const sessionAggregator = this.getSessionData("aggregatorFunction");
|
286
289
|
this.state.aggregatorFunction= this.isValidAggregator(config.aggregatorFunction) && config.aggregatorFunction || this.isValidAggregator(this.props.aggregatorFunction) && this.props.aggregatorFunction || this.isValidAggregator(sessionAggregator) && sessionAggregator || Object.keys(this.aggregatorFunctions)[0];;
|
287
290
|
this.isLoading = this.isLoading.bind(this);
|
@@ -405,51 +408,41 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
405
408
|
canHandleColumnResize(){
|
406
409
|
return false;
|
407
410
|
}
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
if(!isNonNullString(sessionName))
|
412
|
-
|
411
|
+
getSessionKey (){
|
412
|
+
const sessionName = this.props.sessionName;
|
413
|
+
const userCode = Auth.getLoggedUserCode();
|
414
|
+
if(!isNonNullString(sessionName) || (!isNonNullString(userCode) && !this.isDatagrid())) return false;
|
415
|
+
return this.getSessionPrefix()+sessionName.ltrim(this.getSessionPrefix()).replaceAll(" ",'_')+userCode;
|
416
|
+
}
|
417
|
+
getSessionData (sessionKey){
|
418
|
+
const key = this.getSessionKey();
|
419
|
+
const dat = this.props.session !== false && isNonNullString(key) ? defaultObj($session.get(key)) : {}
|
420
|
+
if(isNonNullString(sessionKey)){
|
421
|
+
return dat[sessionKey];
|
413
422
|
}
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
}
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
if(this.props.session === false) return;
|
438
|
-
let key = this.getSessionKey();
|
439
|
-
if(!isNonNullString(key)) return false;
|
440
|
-
let dat = defaultObj(this.getSessionData());
|
441
|
-
if(isNonNullString(sessionKey)){
|
442
|
-
dat[sessionKey] = sessionValue;
|
443
|
-
} else if(isObj(sessionKey)){
|
444
|
-
extendObj(dat,sessionKey);
|
445
|
-
} else {
|
446
|
-
return dat;
|
447
|
-
}
|
448
|
-
$session.set(key,dat);
|
449
|
-
return dat;
|
450
|
-
}
|
451
|
-
}
|
452
|
-
})
|
423
|
+
return dat;
|
424
|
+
}
|
425
|
+
setSessionData (sessionKey,sessionValue,reset){
|
426
|
+
if(this.props.session === false) return;
|
427
|
+
const key = this.getSessionKey();
|
428
|
+
if(!isNonNullString(key)) return false;
|
429
|
+
if(reset === true){
|
430
|
+
$session.set(key,{});
|
431
|
+
return {};
|
432
|
+
}
|
433
|
+
const dat = defaultObj(this.getSessionData());
|
434
|
+
if(isNonNullString(sessionKey)){
|
435
|
+
dat[sessionKey] = sessionValue;
|
436
|
+
} else if(isObj(sessionKey)){
|
437
|
+
extendObj(dat,sessionKey);
|
438
|
+
} else {
|
439
|
+
return dat;
|
440
|
+
}
|
441
|
+
$session.set(key,dat);
|
442
|
+
return dat;
|
443
|
+
}
|
444
|
+
resetSessionData(){
|
445
|
+
return this.setSessionData(null,null,true);
|
453
446
|
}
|
454
447
|
/*** lorsque les filtres locaux changes */
|
455
448
|
onLocalFiltersChange(localFilters){
|
@@ -1609,12 +1602,18 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1609
1602
|
text : "Largeur du graphe",
|
1610
1603
|
tooltip : "Définissez la valeur 0 si vous voulez que le graphe occupe toute la largeur de con contenueur",
|
1611
1604
|
defaultValue : this.getDefaultChartWidth(),
|
1605
|
+
formatValue : ({value})=>{
|
1606
|
+
return value.formatNumber()+" px";
|
1607
|
+
},
|
1612
1608
|
},
|
1613
1609
|
height : {
|
1614
1610
|
type : "number",
|
1615
1611
|
text : "Hauteur du graphe",
|
1616
1612
|
validType : "numberGreaterThan[0]",
|
1617
1613
|
defaultValue : this.getDefaultChartHeight(),
|
1614
|
+
formatValue : ({value})=>{
|
1615
|
+
return value.formatNumber()+" px";
|
1616
|
+
},
|
1618
1617
|
},
|
1619
1618
|
stacked : stackSettings,
|
1620
1619
|
sparkline : {
|
@@ -2413,7 +2412,6 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2413
2412
|
}
|
2414
2413
|
const sparkline = !!(typeof config.sparkline !==undefined ? (isObj(config.sparkline)? config.sparkline.enabled : config.sparkline) : (isObj(chartOptions.chart.sparkline)? chartOptions.chart.sparkline.enabled:chartOptions.chart.sparkline));
|
2415
2414
|
chartOptions.chart.sparkline = {enabled: sparkline}
|
2416
|
-
|
2417
2415
|
chartOptions.xaxis = defaultObj(chartOptions.xaxis,config.xaxis);
|
2418
2416
|
chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
|
2419
2417
|
const xLabels = chartOptions.xaxis.labels;
|
@@ -4164,6 +4162,7 @@ CommonDatagridComponent.propTypes = {
|
|
4164
4162
|
aggregatorFunction : PropTypes.string,
|
4165
4163
|
/*** permet de faire une mutation sur les options de la recherche, immédiatement avant le lancement de la recherche */
|
4166
4164
|
fetchOptionsMutator : PropTypes.func,
|
4165
|
+
resetSessionData : PropTypes.bool, //pour forcer la réinitialisation des données de sessions liés à la table data
|
4167
4166
|
/*** si les données à récupérer à distance seront */
|
4168
4167
|
fetchOnlyVisibleColumns : PropTypes.bool,
|
4169
4168
|
canFetchOnlyVisibleColumns : PropTypes.bool,//si l'on peut modifier le type d'affichage lié à la possibilité de récupérer uniquement les données reletives aux colonnes visibles
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {TableData} from "../Common";
|
2
|
-
import {defaultObj,defaultArray,defaultStr,
|
2
|
+
import {defaultObj,defaultArray,defaultStr,defaultNumber} from "$cutils";
|
3
3
|
import View from "$ecomponents/View";
|
4
4
|
import { StyleSheet,Dimensions,Pressable } from "react-native";
|
5
5
|
import Icon,{MENU_ICON} from "$ecomponents/Icon";
|
@@ -96,8 +96,9 @@ export default class DatagridDashboard extends TableData {
|
|
96
96
|
testID = this.getTestID();
|
97
97
|
rest = defaultObj(rest);
|
98
98
|
const pointerEvents = this.getPointerEvents();
|
99
|
-
const maxHeight = 300;
|
100
99
|
const chartData = this.renderChart();
|
100
|
+
const max = defaultNumber(chartData?.props?.options?.chart?.height);
|
101
|
+
const maxHeight = Math.max(300,max+80);
|
101
102
|
return <View {...rest} testID={testID} style={[styles.container,{maxHeight},rest.style]} pointerEvents={pointerEvents}>
|
102
103
|
{this.renderTitle()}
|
103
104
|
{showPagination ? <View style={[styles.paginationContainer]}>
|