@fto-consult/expo-ui 2.24.0 → 2.24.2
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 +1 -1
- package/src/components/Chart/appexChart/index.js +10 -12
- package/src/components/Chart/appexChart/index.native.js +9 -6
- package/src/components/Chart/appexChart/utils.js +15 -0
- package/src/components/Chart/index.js +17 -10
- package/src/components/Countries/resources/countries-normalized.json +1987 -1987
- package/src/components/Countries/resources/countries-with-not-extra.json +1211 -1211
- package/src/components/Countries/resources/countries.sql +243 -243
- package/src/components/Datagrid/Common/Common.js +99 -49
|
@@ -40,17 +40,25 @@ import {styles as tableStyles} from "$ecomponents/Table";
|
|
|
40
40
|
import {DialogProvider} from "$ecomponents/Form/FormData";
|
|
41
41
|
import Chart,{getMaxSupportedSeriesSize} from "$ecomponents/Chart";
|
|
42
42
|
|
|
43
|
-
const chart = "chart";
|
|
44
43
|
export const donutChart = {
|
|
45
44
|
isChart : true,
|
|
46
45
|
code : 'donutChart',
|
|
47
|
-
label : '
|
|
46
|
+
label : 'Donut',
|
|
48
47
|
icon : "chart-donut",
|
|
49
48
|
type: 'donut',
|
|
49
|
+
key : "donut",
|
|
50
50
|
isDonut : true,
|
|
51
|
-
isRendable : ({displayOnlySectionListHeaders,isSectionList})=>isSectionList && displayOnlySectionListHeaders,
|
|
51
|
+
isRendable : ({displayOnlySectionListHeaders,isSectionList})=> isSectionList && displayOnlySectionListHeaders,
|
|
52
52
|
tooltip : "Pour pouvoir visulaiser ce type de graphe, vous devez : grouper les données du tableau selon le criètre de votre choix, puis afficher uniquement les totaux des données groupées"
|
|
53
53
|
}
|
|
54
|
+
const stackSettings = {
|
|
55
|
+
type : 'switch',
|
|
56
|
+
text : "Graphe empilé?",
|
|
57
|
+
checkedValue : true,
|
|
58
|
+
uncheckedValue : false,
|
|
59
|
+
//le nom de la propriétés dans les propriétés du tableau
|
|
60
|
+
settingKey : "chart",
|
|
61
|
+
}
|
|
54
62
|
export const displayTypes = {
|
|
55
63
|
table : {
|
|
56
64
|
code : "table",
|
|
@@ -62,26 +70,49 @@ export const displayTypes = {
|
|
|
62
70
|
lineChart : {
|
|
63
71
|
code : "lineChart",
|
|
64
72
|
isChart : true,
|
|
65
|
-
label : '
|
|
73
|
+
label : 'Linéaire',
|
|
66
74
|
icon : "chart-areaspline",
|
|
67
75
|
type : 'line',
|
|
76
|
+
key : "line",
|
|
68
77
|
},
|
|
69
78
|
areaChart : {
|
|
70
79
|
isChart : true,
|
|
71
80
|
code : 'areaChart',
|
|
72
|
-
label : '
|
|
81
|
+
label : 'Surface',
|
|
73
82
|
icon : "chart-areaspline-variant",
|
|
74
83
|
type: 'area',
|
|
84
|
+
key : "line",
|
|
75
85
|
},
|
|
76
86
|
barChart : {
|
|
77
87
|
isChart : true,
|
|
78
88
|
code : 'barChart',
|
|
79
|
-
label : '
|
|
89
|
+
label : 'Histogramme',
|
|
80
90
|
icon : "chart-bar",
|
|
81
91
|
type: 'bar',
|
|
82
|
-
|
|
92
|
+
key : "line",
|
|
93
|
+
settings : {
|
|
94
|
+
stacked : stackSettings,
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
pieChart : {
|
|
98
|
+
...donutChart,
|
|
99
|
+
code : 'pieChart',
|
|
100
|
+
label : 'Pie',
|
|
101
|
+
icon : "chart-pie",
|
|
102
|
+
type: 'pie',
|
|
83
103
|
},
|
|
84
104
|
donutChart,
|
|
105
|
+
radarChart : {
|
|
106
|
+
isChart : true,
|
|
107
|
+
code : 'radarChart',
|
|
108
|
+
label : 'Radar',
|
|
109
|
+
icon : "radar",
|
|
110
|
+
type: 'radar',
|
|
111
|
+
key : "line",
|
|
112
|
+
settings : {
|
|
113
|
+
stacked : stackSettings,
|
|
114
|
+
}
|
|
115
|
+
}
|
|
85
116
|
/*rangeChart : {
|
|
86
117
|
code : "rangeChart",
|
|
87
118
|
isChart : true,
|
|
@@ -197,6 +228,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
197
228
|
sectionListDataSize : {value : {current : 0}},
|
|
198
229
|
enablePointerEventsRef : {value : {current:false}},
|
|
199
230
|
configureSectionListSelectedValues : {value : {}},
|
|
231
|
+
chartIdPrefix : {value : uniqid("datagrid-chart-id-prefix")},
|
|
200
232
|
///la liste des fonctions d'aggregations supportées
|
|
201
233
|
aggregatorFunctions : {value : extendAggreagatorFunctions(this.props.aggregatorFunctions)},
|
|
202
234
|
///les types d'affichage
|
|
@@ -1345,13 +1377,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1345
1377
|
items : yItems,
|
|
1346
1378
|
multiple : true,
|
|
1347
1379
|
},
|
|
1348
|
-
stacked :
|
|
1349
|
-
type : 'switch',
|
|
1350
|
-
text : "Graphe empilé?",
|
|
1351
|
-
disabled : this.state.displayType !== "barChart",
|
|
1352
|
-
checkedValue : true,
|
|
1353
|
-
uncheckedValue : false,
|
|
1354
|
-
},
|
|
1380
|
+
stacked : stackSettings,
|
|
1355
1381
|
title : {
|
|
1356
1382
|
text : "Titre du graphe",
|
|
1357
1383
|
format :'hashtag',
|
|
@@ -1494,6 +1520,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1494
1520
|
if(!isValidAggregator(aggregatorFunction)){
|
|
1495
1521
|
aggregatorFunction = this.getActiveAggregatorFunction();
|
|
1496
1522
|
}
|
|
1523
|
+
|
|
1497
1524
|
const code = aggregatorFunction.code;
|
|
1498
1525
|
const isDonut = chartType.isDonut || chartType.isRadial;
|
|
1499
1526
|
const config = this.getCharConfig();
|
|
@@ -1523,12 +1550,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1523
1550
|
const loopForFooter = ({column,serieName,footers,header})=>{
|
|
1524
1551
|
if(!isObj(column) || !isObj(footers)) return null;
|
|
1525
1552
|
if(!isObj(footers[column.field])) return null;
|
|
1526
|
-
const footer = footers[column.field]
|
|
1553
|
+
const footer = footers[column.field];
|
|
1527
1554
|
if(typeof footer[code] !== 'number') return null;
|
|
1528
|
-
const label = defaultStr(footer.label,footer.text,footer.field);
|
|
1529
1555
|
if(typeof footer[code] !== 'number') return null;
|
|
1530
1556
|
if(isDonut){
|
|
1531
|
-
serieName = label;
|
|
1532
1557
|
dataIndexes[header] = footer[code];
|
|
1533
1558
|
} else {
|
|
1534
1559
|
dataIndexes[serieName] = defaultArray(dataIndexes[serieName]);
|
|
@@ -1555,6 +1580,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1555
1580
|
labels.push(index);
|
|
1556
1581
|
});
|
|
1557
1582
|
return {
|
|
1583
|
+
name : defaultStr(yAxisColumn.label,yAxisColumn.text,yAxisColumn.field),
|
|
1558
1584
|
series,
|
|
1559
1585
|
labels,
|
|
1560
1586
|
}
|
|
@@ -1567,6 +1593,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1567
1593
|
series
|
|
1568
1594
|
}
|
|
1569
1595
|
}
|
|
1596
|
+
}
|
|
1597
|
+
/*** permet de formatter les valeurs de la courbe en fonction du type passé en paramètre */
|
|
1598
|
+
chartValueFormattter(value,columnType){
|
|
1599
|
+
|
|
1570
1600
|
}
|
|
1571
1601
|
renderChart(){
|
|
1572
1602
|
if(!this.canRenderChart()) return null;
|
|
@@ -1577,6 +1607,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1577
1607
|
console.warn("impossible d'afficher le graphe de type ",chartType.label," car le type de données requis pour le rendu de ce graphe est invalide")
|
|
1578
1608
|
return null;
|
|
1579
1609
|
}
|
|
1610
|
+
const isDonut = chartType.isDonut || chartType.isRadial;
|
|
1580
1611
|
const config = this.getCharConfig();
|
|
1581
1612
|
if(!this.state.columns[config.y]) return null;
|
|
1582
1613
|
const yAxisColumn = this.state.columns[config.y];
|
|
@@ -1600,7 +1631,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1600
1631
|
const aggregatorFunction = this.getActiveAggregatorFunction().eval;
|
|
1601
1632
|
const emptyValue = this.getEmptyDataValue();
|
|
1602
1633
|
const indexes = {};
|
|
1603
|
-
let series = [],xaxis = {},customConfig = {};
|
|
1634
|
+
let series = [],xaxis = {},customConfig = {},seriesNamesToColumns={};
|
|
1604
1635
|
let count = 0;
|
|
1605
1636
|
if(!this.isSectionList()){
|
|
1606
1637
|
this.state.data.map((data,index)=>{
|
|
@@ -1656,38 +1687,57 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1656
1687
|
customConfig = defaultObj(customConfig);
|
|
1657
1688
|
customConfig.chart = defaultObj(customConfig.chart);
|
|
1658
1689
|
const chartProps = extendObj(true,{},this.props.chartProps,customConfig);
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
chart : {
|
|
1681
|
-
height :350,
|
|
1682
|
-
...defaultObj(chartProps.chart),
|
|
1683
|
-
type : chartType.type,
|
|
1690
|
+
const settings = defaultObj(chartType.settings);
|
|
1691
|
+
Object.map(settings,(s,key)=>{
|
|
1692
|
+
if(!isObj(s) || !(key in config)) return null;
|
|
1693
|
+
const settingKey = defaultStr(s.settingKey,"chart");
|
|
1694
|
+
chartProps[settingKey] = defaultObj(chartProps[settingKey]);
|
|
1695
|
+
chartProps[settingKey][key] = config[key];
|
|
1696
|
+
});
|
|
1697
|
+
const chartOptions = {
|
|
1698
|
+
...chartProps,
|
|
1699
|
+
title :extendObj(true,{}, {
|
|
1700
|
+
text: defaultStr(config.title,chartProps.title),
|
|
1701
|
+
align: 'left',
|
|
1702
|
+
//margin: 10,
|
|
1703
|
+
//offsetX: 0,
|
|
1704
|
+
//offsetY: 0,
|
|
1705
|
+
//floating: false,
|
|
1706
|
+
style: {
|
|
1707
|
+
//fontSize: '14px',
|
|
1708
|
+
//fontWeight: 'bold',
|
|
1709
|
+
//fontFamily: undefined,
|
|
1710
|
+
color: theme.Colors.isValid(config.titleColor)?config.titleColor : undefined,
|
|
1684
1711
|
},
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1712
|
+
},chartProps.title),
|
|
1713
|
+
series,
|
|
1714
|
+
chart : extendObj(true,{},{height :350},chartProps.chart,{
|
|
1715
|
+
type : chartType.type,
|
|
1716
|
+
})
|
|
1717
|
+
}
|
|
1718
|
+
//console.log(chartOptions," is chart options");
|
|
1719
|
+
const labelColor = theme.Colors.isValid(config.labelColor)? config.labelColor : theme.colors.text;
|
|
1720
|
+
if(!isDonut){
|
|
1721
|
+
chartOptions.xaxis = extendObj(true,{},{type: 'category'},chartProps.xaxis,{xaxis});
|
|
1722
|
+
const xLabels = chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
|
|
1723
|
+
xLabels.style = defaultObj(xLabels.style)
|
|
1724
|
+
xLabels.style.colors = (Array.isArray(xLabels.style.colors) && xLabels.style.colors.length || theme.Colors.isValid(xLabels.style.colors)) ? xLabels.style.colors : labelColor;
|
|
1725
|
+
chartOptions.yaxis = extendObj(true,{},{type: 'category'},chartProps.yaxis);
|
|
1726
|
+
} else {
|
|
1727
|
+
delete chartOptions.xaxis;
|
|
1728
|
+
//delete chartOptions.yaxis;
|
|
1729
|
+
}
|
|
1730
|
+
const yLabels = chartOptions.yaxis.labels = defaultObj(chartOptions.yaxis.labels);
|
|
1731
|
+
yLabels.style = defaultObj(yLabels.style)
|
|
1732
|
+
yLabels.style.colors = (Array.isArray(yLabels.style.colors) && yLabels.style.colors.length || theme.Colors.isValid(yLabels.style.colors)) ? yLabels.style.colors : labelColor;
|
|
1733
|
+
yLabels.formatter = (value)=>{
|
|
1734
|
+
if(typeof value =="number") return value.formatNumber();
|
|
1735
|
+
return value;
|
|
1736
|
+
}
|
|
1737
|
+
chartOptions.chart.id = this.chartIdPrefix+defaultStr(chartType.key,"no-key")
|
|
1738
|
+
return <Chart
|
|
1739
|
+
options = {chartOptions}
|
|
1740
|
+
key = {chartOptions.chart.id}
|
|
1691
1741
|
/>
|
|
1692
1742
|
}
|
|
1693
1743
|
canShowFooters(){
|