@sis-cc/dotstatsuite-components 14.3.5 → 14.4.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/lib/viewer/src/chart.js +1 -43
- package/lib/viewer/src/index.js +2 -13
- package/package.json +2 -2
- package/src/viewer/src/chart.js +1 -32
- package/src/viewer/src/index.js +5 -13
package/lib/viewer/src/chart.js
CHANGED
|
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
|
8
|
-
|
|
9
|
-
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
|
10
|
-
|
|
11
7
|
var _react = require('react');
|
|
12
8
|
|
|
13
9
|
var _react2 = _interopRequireDefault(_react);
|
|
@@ -18,20 +14,12 @@ var _ramda = require('ramda');
|
|
|
18
14
|
|
|
19
15
|
var R = _interopRequireWildcard(_ramda);
|
|
20
16
|
|
|
21
|
-
var _classnames = require('classnames');
|
|
22
|
-
|
|
23
|
-
var _classnames2 = _interopRequireDefault(_classnames);
|
|
24
|
-
|
|
25
|
-
var _styles = require('@material-ui/core/styles');
|
|
26
|
-
|
|
27
17
|
var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
|
|
28
18
|
|
|
29
19
|
var _src = require('../../bridge-d3-react/src');
|
|
30
20
|
|
|
31
21
|
var charts = _interopRequireWildcard(_src);
|
|
32
22
|
|
|
33
|
-
var _constants = require('../../rules/src/constants');
|
|
34
|
-
|
|
35
23
|
var _series = require('./chartUtils/series');
|
|
36
24
|
|
|
37
25
|
var _series2 = _interopRequireDefault(_series);
|
|
@@ -46,35 +34,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
46
34
|
|
|
47
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
48
36
|
|
|
49
|
-
var useStyles = (0, _styles.makeStyles)(function () {
|
|
50
|
-
return {
|
|
51
|
-
container: {
|
|
52
|
-
backgroundColor: 'none',
|
|
53
|
-
overflow: 'hidden',
|
|
54
|
-
position: 'relative',
|
|
55
|
-
direction: 'ltr !important'
|
|
56
|
-
},
|
|
57
|
-
chartContainer: {
|
|
58
|
-
'& .rcw-chart__chart__line--x:last-of-type': {
|
|
59
|
-
visibility: 'hidden'
|
|
60
|
-
},
|
|
61
|
-
'& .rcw-chart__chart__line--y:last-of-type': {
|
|
62
|
-
visibility: 'hidden'
|
|
63
|
-
},
|
|
64
|
-
'& .rcw-chart__chart__axis--x': {
|
|
65
|
-
'& .tick:last-of-type': {
|
|
66
|
-
visibility: 'hidden'
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
'& .rcw-chart__chart__axis--y': {
|
|
70
|
-
'& .tick:last-of-type': {
|
|
71
|
-
visibility: 'hidden'
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
|
|
78
37
|
var Chart = function Chart(_ref) {
|
|
79
38
|
var options = _ref.options,
|
|
80
39
|
series = _ref.series,
|
|
@@ -82,11 +41,10 @@ var Chart = function Chart(_ref) {
|
|
|
82
41
|
width = _ref.width,
|
|
83
42
|
getAxisOptions = _ref.getAxisOptions;
|
|
84
43
|
|
|
85
|
-
var classes = useStyles();
|
|
86
44
|
var ChartClass = charts[type];
|
|
87
45
|
return _react2.default.createElement(
|
|
88
46
|
'div',
|
|
89
|
-
|
|
47
|
+
null,
|
|
90
48
|
R.is(Number, width) && width < 370 ? null : _react2.default.createElement(_AxisLegend2.default, { axis: 'y', data: { series: series }, type: type }),
|
|
91
49
|
_react2.default.createElement(ChartClass, {
|
|
92
50
|
data: series,
|
package/lib/viewer/src/index.js
CHANGED
|
@@ -38,10 +38,6 @@ var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
|
|
|
38
38
|
|
|
39
39
|
var _styles = require('@material-ui/core/styles');
|
|
40
40
|
|
|
41
|
-
var _HourglassEmpty = require('@material-ui/icons/HourglassEmpty');
|
|
42
|
-
|
|
43
|
-
var _HourglassEmpty2 = _interopRequireDefault(_HourglassEmpty);
|
|
44
|
-
|
|
45
41
|
var _options = require('./chartUtils/options');
|
|
46
42
|
|
|
47
43
|
var _options2 = _interopRequireDefault(_options);
|
|
@@ -104,15 +100,8 @@ var ViewContent = function ViewContent(_ref3) {
|
|
|
104
100
|
errorMessage = _ref3.errorMessage,
|
|
105
101
|
rest = (0, _objectWithoutProperties3.default)(_ref3, ['loading', 'loadingProps', 'noData', 'type', 'width', 'errorMessage']);
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
message: loading,
|
|
110
|
-
icon: _react2.default.createElement(_HourglassEmpty2.default, { style: { fontSize: 50, color: loadingProps.isWarning ? theme.palette.warning.main : theme.palette.primary.main } })
|
|
111
|
-
});
|
|
112
|
-
if (!width) return _react2.default.createElement(_dotstatsuiteVisions.NoData, {
|
|
113
|
-
message: loading,
|
|
114
|
-
icon: _react2.default.createElement(_HourglassEmpty2.default, { style: { fontSize: 50, color: loadingProps.isWarning ? theme.palette.warning.main : theme.palette.primary.main } })
|
|
115
|
-
});
|
|
103
|
+
if (loading) return _react2.default.createElement(_dotstatsuiteVisions.Loading, (0, _extends3.default)({ message: loading }, loadingProps));
|
|
104
|
+
if (!width) return _react2.default.createElement(_dotstatsuiteVisions.Loading, (0, _extends3.default)({ message: loading }, loadingProps));
|
|
116
105
|
if (errorMessage) return _react2.default.createElement(_dotstatsuiteVisions.NoData, { message: errorMessage });
|
|
117
106
|
|
|
118
107
|
if (type === 'table') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sis-cc/dotstatsuite-components",
|
|
3
3
|
"description": "Set components based on React.",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.4.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "OECD",
|
|
7
7
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@react-hook/size": "^2.1.1",
|
|
25
|
-
"@sis-cc/dotstatsuite-d3-charts": "^8.0
|
|
25
|
+
"@sis-cc/dotstatsuite-d3-charts": "^8.1.0",
|
|
26
26
|
"date-fns": "^1.30.1",
|
|
27
27
|
"lodash": "^4.17.2",
|
|
28
28
|
"lodash.compose": "^2.4.1",
|
package/src/viewer/src/chart.js
CHANGED
|
@@ -1,47 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { branch, compose, renderComponent, withProps } from 'recompose';
|
|
3
3
|
import * as R from 'ramda';
|
|
4
|
-
import cx from 'classnames';
|
|
5
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
6
4
|
import { NoData } from '@sis-cc/dotstatsuite-visions';
|
|
7
5
|
import * as charts from '../../bridge-d3-react/src';
|
|
8
|
-
import { SCATTER } from '../../rules/src/constants';
|
|
9
6
|
import filterSeriesRegardingDimensions from './chartUtils/series';
|
|
10
7
|
import AxisLegend from './legends/AxisLegend';
|
|
11
8
|
import { isChartNoData } from './utils';
|
|
12
9
|
|
|
13
|
-
const useStyles = makeStyles(() => ({
|
|
14
|
-
container: {
|
|
15
|
-
backgroundColor: 'none',
|
|
16
|
-
overflow: 'hidden',
|
|
17
|
-
position: 'relative',
|
|
18
|
-
direction: 'ltr !important',
|
|
19
|
-
},
|
|
20
|
-
chartContainer: {
|
|
21
|
-
'& .rcw-chart__chart__line--x:last-of-type': {
|
|
22
|
-
visibility: 'hidden',
|
|
23
|
-
},
|
|
24
|
-
'& .rcw-chart__chart__line--y:last-of-type': {
|
|
25
|
-
visibility: 'hidden',
|
|
26
|
-
},
|
|
27
|
-
'& .rcw-chart__chart__axis--x': {
|
|
28
|
-
'& .tick:last-of-type': {
|
|
29
|
-
visibility: 'hidden',
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
'& .rcw-chart__chart__axis--y': {
|
|
33
|
-
'& .tick:last-of-type': {
|
|
34
|
-
visibility: 'hidden',
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
10
|
const Chart = ({ options, series, type, width, getAxisOptions }) => {
|
|
41
|
-
const classes = useStyles();
|
|
42
11
|
const ChartClass = charts[type];
|
|
43
12
|
return (
|
|
44
|
-
<div
|
|
13
|
+
<div>
|
|
45
14
|
{
|
|
46
15
|
(R.is(Number, width) && width < 370)
|
|
47
16
|
? null
|
package/src/viewer/src/index.js
CHANGED
|
@@ -3,9 +3,8 @@ import * as R from 'ramda';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { compose, withState, withProps } from 'recompose';
|
|
5
5
|
import sizeMe from 'react-sizeme';
|
|
6
|
-
import { NoData
|
|
6
|
+
import { Loading, NoData, TableHtml5 } from '@sis-cc/dotstatsuite-visions';
|
|
7
7
|
import { useTheme, makeStyles } from '@material-ui/core/styles';
|
|
8
|
-
import HourglassEmptyIcon from '@material-ui/icons/HourglassEmpty';
|
|
9
8
|
import getChartOptions from './chartUtils/options';
|
|
10
9
|
import Header from './header';
|
|
11
10
|
import Chart from './chart';
|
|
@@ -35,21 +34,14 @@ const useStyles = makeStyles(() => ({
|
|
|
35
34
|
}));
|
|
36
35
|
|
|
37
36
|
const ViewContent = ({ loading, loadingProps={}, noData = 'No Data', type, width, errorMessage, ...rest }) => {
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
icon={<HourglassEmptyIcon style={{ fontSize: 50, color: loadingProps.isWarning ? theme.palette.warning.main : theme.palette.primary.main }} />}
|
|
42
|
-
/>;
|
|
43
|
-
if (!width) return <IconMessage
|
|
44
|
-
message={loading}
|
|
45
|
-
icon={<HourglassEmptyIcon style={{ fontSize: 50, color: loadingProps.isWarning ? theme.palette.warning.main : theme.palette.primary.main }} />}
|
|
46
|
-
/>;
|
|
47
|
-
if (errorMessage) return <IconMessage message={errorMessage} />;
|
|
37
|
+
if (loading) return <Loading message={loading} {...loadingProps} />;
|
|
38
|
+
if (!width) return <Loading message={loading} {...loadingProps} />;
|
|
39
|
+
if (errorMessage) return <NoData message={errorMessage} />;
|
|
48
40
|
|
|
49
41
|
if (type === 'table') {
|
|
50
42
|
const tableProps = R.propOr({}, 'tableProps', rest);
|
|
51
43
|
const hasNoObs = R.pipe(R.prop('cells'), R.anyPass([R.isNil, R.isEmpty]))(tableProps);
|
|
52
|
-
if (hasNoObs) return <
|
|
44
|
+
if (hasNoObs) return <NoData message={noData} />;
|
|
53
45
|
|
|
54
46
|
return <TableHtml5 isRtl={R.prop('isRtl', rest)} {...tableProps} />;
|
|
55
47
|
}
|