@fto-consult/expo-ui 7.14.0 → 7.15.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.14.0",
3
+ "version": "7.15.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -71,7 +71,7 @@
71
71
  "@expo/html-elements": "^0.5.1",
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
- "@fto-consult/common": "^4.0.4",
74
+ "@fto-consult/common": "^4.0.5",
75
75
  "@fto-consult/electron-gen": "^2.2.0",
76
76
  "@pchmn/expo-material3-theme": "^1.3.1",
77
77
  "@react-native-async-storage/async-storage": "1.18.2",
@@ -63,6 +63,7 @@ ChartComponent.propTypes = {
63
63
  type: PropTypes.string,
64
64
  }),
65
65
  xaxis : PropTypes.object,
66
+ yaxis : PropTypes.object,
66
67
  series: PropTypes.array.isRequired,
67
68
  }).isRequired,
68
69
  ///lorsque le chart est rendu en environnement native, les props du webView
@@ -2209,10 +2209,10 @@ export default class CommonDatagridComponent extends AppComponent {
2209
2209
  }
2210
2210
  }
2211
2211
  getDefaultChartHeight(){
2212
- return defaultNumber(this.props.chartProps?.height,this.props.chartConfig?.height,this.isDashboard()?90:350);
2212
+ return defaultNumber(this.props.chartProps?.height,this.props.chartConfig?.height,this.isDashboard()?100:350);
2213
2213
  }
2214
2214
  getDefaultChartWidth(){
2215
- return defaultNumber(this.props.chartProps?.width);
2215
+ return defaultNumber(this.props.chartProps?.width,this.props.chartConfig?.width);
2216
2216
  }
2217
2217
  /*** permet de formatter les valeurs de la courbe en fonction du type passé en paramètre */
2218
2218
  chartValueFormattter(value,columnType){
@@ -2326,6 +2326,10 @@ export default class CommonDatagridComponent extends AppComponent {
2326
2326
  const mappedColumns = {};
2327
2327
  const abreviateValues = defaultVal(config.abreviateValues,true) || this.state.abreviateValues;
2328
2328
  const dataLabelFormatter = typeof chartProps.dataLabels?.formatter =="function"? chartProps.dataLabels.formatter : undefined;
2329
+ let chartWidth = defaultNumber(config.width) || this.getDefaultChartWidth() || undefined;
2330
+ if(chartWidth ===0){
2331
+ chartWidth = undefined;
2332
+ }
2329
2333
  const chartOptions = {
2330
2334
  ...chartProps,
2331
2335
  dataLabels : extendObj(true,{enabled:false},chartProps.dataLabels,{
@@ -2363,14 +2367,14 @@ export default class CommonDatagridComponent extends AppComponent {
2363
2367
  chartProps.chart,
2364
2368
  {
2365
2369
  height : defaultNumber(config.height,this.getDefaultChartHeight()),
2366
- width : defaultNumber(config.width) || this.getDefaultChartWidth() || undefined,
2370
+ width : chartWidth,
2367
2371
  type : chartType.type
2368
2372
  },
2369
2373
  )
2370
2374
  }
2371
- const labelColor = theme.Colors.isValid(config.labelColor)? config.labelColor : theme.colors.text;
2375
+ const labelColor = theme.Colors.isValid(config.labelColor)? config.labelColor : theme.setAlphaColor(theme.colors.text);
2372
2376
  if(!isDonut){
2373
- chartOptions.xaxis = extendObj(true,{},{type: 'category'},chartProps.xaxis,{xaxis});
2377
+ chartOptions.xaxis = extendObj(true,{},{type: 'category'},chartProps.xaxis,xaxis);
2374
2378
  const xLabels = chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
2375
2379
  xLabels.style = defaultObj(xLabels.style)
2376
2380
  xLabels.style.colors = (Array.isArray(xLabels.style.colors) && xLabels.style.colors.length || theme.Colors.isValid(xLabels.style.colors)) ? xLabels.style.colors : labelColor;
@@ -2380,6 +2384,7 @@ export default class CommonDatagridComponent extends AppComponent {
2380
2384
  }
2381
2385
  chartOptions.yaxis = extendObj(true,{},{type: 'category'},defaultObj(chartProps.yaxis));
2382
2386
  const yLabels = chartOptions.yaxis.labels = defaultObj(chartOptions.yaxis.labels);
2387
+ yLabels.align = "right";
2383
2388
  yLabels.style = defaultObj(yLabels.style)
2384
2389
  yLabels.style.colors = (Array.isArray(yLabels.style.colors) && yLabels.style.colors.length || theme.Colors.isValid(yLabels.style.colors)) ? yLabels.style.colors : labelColor;
2385
2390
  const yLabelsSerieName = series?.length == 1 && series[0] && series[0].name ? series[0].name : undefined;
@@ -2406,24 +2411,29 @@ export default class CommonDatagridComponent extends AppComponent {
2406
2411
  if(!chartType.isDonut){
2407
2412
  delete chartOptions.labels;
2408
2413
  }
2409
- if(this.isDashboard() && typeof chartOptions.chart.sparkline !=='boolean'){
2410
- chartOptions.chart.sparkline = true;
2411
- }
2412
- if(chartOptions.chart.sparkline){
2413
- chartOptions.chart.sparkline = {enabled: true}
2414
- } else delete chartOptions.chart.sparkline;
2415
- //const spackLine = chartOptions.chart.sparkline;
2416
- chartOptions.xaxis = defaultObj(chartOptions.xaxis);
2417
- chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
2418
- chartOptions.xaxis.labels.show = ("showXaxis" in config) ? !!config.showXaxis : !this.isDashboard();
2414
+ 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
+ chartOptions.chart.sparkline = {enabled: sparkline}
2419
2416
 
2417
+ chartOptions.xaxis = defaultObj(chartOptions.xaxis,config.xaxis);
2418
+ chartOptions.xaxis.labels = defaultObj(chartOptions.xaxis.labels);
2419
+ const xLabels = chartOptions.xaxis.labels;
2420
+ const showXaxis = sparkline ? false : ("showXaxis" in config) ? !!config.showXaxis : !this.isDashboard();
2421
+ xLabels.show = showXaxis;
2422
+ chartOptions.xaxis.show = sparkline ? false : "show" in chartOptions.xaxis ? !! chartOptions.xaxis.show : showXaxis;
2423
+ xLabels.style = Object.assign({},xLabels.style);
2424
+ xLabels.style.colors = (Array.isArray(xLabels.style.colors) && xLabels.style.colors.length || theme.Colors.isValid(xLabels.style.colors)) ? xLabels.style.colors : labelColor;
2420
2425
 
2421
2426
  chartOptions.yaxis.labels = defaultObj(chartOptions.yaxis.labels);
2422
- chartOptions.yaxis.labels.show = ("showYaxis" in config) ? !!config.showYaxis : !this.isDashboard();
2427
+ const showYaxis = sparkline ? false : ("showYaxis" in config) ? !!config.showYaxis : !this.isDashboard();
2428
+ chartOptions.yaxis.show = sparkline ? false : "show" in chartOptions.yaxis ? !! chartOptions.yaxis.show : showYaxis;
2429
+ chartOptions.yaxis.labels.show = showYaxis;
2430
+ chartOptions.yaxis.show = "show" in chartOptions.yaxis ? !!chartOptions.yaxis : showYaxis;
2423
2431
 
2424
2432
  chartOptions.legend = defaultObj(chartOptions.legend);
2425
2433
  chartOptions.legend.show = ("showLegend" in config) ? !!config.showLegend : !this.isDashboard();
2426
-
2434
+ chartOptions.legend.labels = Object.assign({},chartOptions.legend.labels);
2435
+ const legendLabels = chartOptions.legend.labels;
2436
+ chartOptions.legend.labels.colors = (Array.isArray(legendLabels.colors) && legendLabels.colors.length || theme.Colors.isValid(legendLabels.colors)) ? legendLabels.colors : labelColor;
2427
2437
  if("dataLabels" in config){
2428
2438
  chartOptions.dataLabels.enabled = !!config.dataLabels;
2429
2439
  }
@@ -97,6 +97,7 @@ export default class DatagridDashboard extends TableData {
97
97
  rest = defaultObj(rest);
98
98
  const pointerEvents = this.getPointerEvents();
99
99
  const maxHeight = 300;
100
+ const chartData = this.renderChart();
100
101
  return <View {...rest} testID={testID} style={[styles.container,{maxHeight},rest.style]} pointerEvents={pointerEvents}>
101
102
  {this.renderTitle()}
102
103
  {showPagination ? <View style={[styles.paginationContainer]}>
@@ -110,7 +111,7 @@ export default class DatagridDashboard extends TableData {
110
111
  </View> : null}
111
112
  {<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,styles.chartContainer,chartContainerProps.style]}>
112
113
  {this.renderProgressBar()}
113
- {this.renderChart()}
114
+ {chartData}
114
115
  </View>}
115
116
  </View>
116
117
  }
@@ -138,6 +139,7 @@ const styles = StyleSheet.create({
138
139
  },
139
140
  container : {
140
141
  width : '100%',
142
+ paddingBottom : 10,
141
143
  //flex:1,
142
144
  },
143
145
  chartContainer : {
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
3
  "name": "@fto-consult/expo-ui",
4
- "version": "7.13.7",
4
+ "version": "7.15.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/borispipo/expo-ui.git"
@@ -49,7 +49,7 @@ module.exports = {
49
49
  "license": "MIT"
50
50
  },
51
51
  "@fto-consult/common": {
52
- "version": "4.0.4",
52
+ "version": "4.0.5",
53
53
  "url": "https://github.com/borispipo/common#readme",
54
54
  "license": "ISC"
55
55
  },