@sis-cc/dotstatsuite-visions 7.8.4 → 7.10.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.
@@ -142,6 +142,8 @@ var Dataflow = function Dataflow(_ref2) {
142
142
  handleUrl = _ref2.handleUrl,
143
143
  label = _ref2.label,
144
144
  labels = _ref2.labels,
145
+ _ref2$dimensions = _ref2.dimensions,
146
+ dimensions = _ref2$dimensions === undefined ? [] : _ref2$dimensions,
145
147
  _ref2$highlights = _ref2.highlights,
146
148
  highlights = _ref2$highlights === undefined ? [] : _ref2$highlights,
147
149
  _ref2$categories = _ref2.categories,
@@ -175,12 +177,7 @@ var Dataflow = function Dataflow(_ref2) {
175
177
  { className: classes.header, 'data-testid': testId + '_title' },
176
178
  React.createElement(
177
179
  Typography,
178
- {
179
- variant: 'h6',
180
- color: 'primary',
181
- display: 'inline',
182
- className: classes.container
183
- },
180
+ { variant: 'h6', color: 'primary', display: 'inline' },
184
181
  React.createElement(
185
182
  Link,
186
183
  {
@@ -234,6 +231,21 @@ var Dataflow = function Dataflow(_ref2) {
234
231
  React.createElement(
235
232
  CardContent,
236
233
  { className: classes.cardContent },
234
+ !R.isEmpty(dimensions) && React.createElement(
235
+ Typography,
236
+ {
237
+ variant: 'body2',
238
+ color: 'textSecondary',
239
+ 'data-testid': testId + '_dimensions'
240
+ },
241
+ React.createElement(
242
+ 'strong',
243
+ null,
244
+ R.prop('dimensions')(labels),
245
+ ':\xA0'
246
+ ),
247
+ React.createElement(HTMLRenderer, { html: R.join(', ', dimensions) })
248
+ ),
237
249
  R.map(function (_ref3) {
238
250
  var field = _ref3[0],
239
251
  fieldHighlights = _ref3[1];
@@ -243,7 +255,6 @@ var Dataflow = function Dataflow(_ref2) {
243
255
  variant: 'body2',
244
256
  key: field,
245
257
  color: 'textSecondary',
246
- className: classes.container,
247
258
  'data-testid': testId + '_highlight_' + field
248
259
  },
249
260
  React.createElement(
@@ -266,12 +277,7 @@ var Dataflow = function Dataflow(_ref2) {
266
277
  categorie = _ref4[1];
267
278
  return React.createElement(
268
279
  Typography,
269
- {
270
- variant: 'body2',
271
- key: field,
272
- color: 'textSecondary',
273
- className: classes.container
274
- },
280
+ { variant: 'body2', key: field, color: 'textSecondary' },
275
281
  React.createElement(
276
282
  'strong',
277
283
  null,
@@ -289,7 +295,7 @@ var Dataflow = function Dataflow(_ref2) {
289
295
  R.not(R.isEmpty(categories)) && React.createElement(Divider, { className: classes.divider }),
290
296
  label && React.createElement(
291
297
  Typography,
292
- { variant: 'body2', color: 'textSecondary', className: classes.container },
298
+ { variant: 'body2', color: 'textSecondary' },
293
299
  React.createElement(
294
300
  'strong',
295
301
  null,
@@ -305,7 +311,7 @@ var Dataflow = function Dataflow(_ref2) {
305
311
  { className: classes.footer, disableSpacing: true },
306
312
  React.createElement(
307
313
  Typography,
308
- { variant: 'caption', color: 'textSecondary', className: classes.container },
314
+ { variant: 'caption', color: 'textSecondary' },
309
315
  React.createElement(
310
316
  'strong',
311
317
  null,
@@ -321,7 +327,7 @@ var Dataflow = function Dataflow(_ref2) {
321
327
  ),
322
328
  React.createElement(
323
329
  Typography,
324
- { variant: 'caption', color: 'textSecondary', className: classes.container },
330
+ { variant: 'caption', color: 'textSecondary' },
325
331
  R.prop('note')(labels)
326
332
  )
327
333
  )
@@ -374,6 +380,7 @@ Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
374
380
  date: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
375
381
  }),
376
382
  highlights: PropTypes.array,
383
+ dimensions: PropTypes.array,
377
384
  categories: PropTypes.array,
378
385
  children: PropTypes.node,
379
386
  HTMLRenderer: PropTypes.func
@@ -27,6 +27,7 @@
27
27
  * note: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
28
28
  * date: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
29
29
  * }),
30
+ * dimensions: PropTypes.array,
30
31
  * highlights: PropTypes.array,
31
32
  * categories: PropTypes.array,
32
33
  * HTMLRenderer: PropTypes.func,
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import * as R from 'ramda';
3
3
  import PropTypes from 'prop-types';
4
4
  import cx from 'classnames';
5
- import { makeStyles } from '@material-ui/core/styles';
5
+ import { makeStyles, useTheme } from '@material-ui/core/styles';
6
6
  import TableCell from '@material-ui/core/TableCell';
7
- import Typography from '@material-ui/core/Typography';
8
7
  import Link from '@material-ui/core/Link';
9
8
  import Flags from './flags';
9
+ import { getIsRtl } from '../utils';
10
10
 
11
11
  var useStyles = makeStyles(function (theme) {
12
12
  return {
@@ -18,7 +18,8 @@ var useStyles = makeStyles(function (theme) {
18
18
  color: theme.palette.grey['A700'],
19
19
  '&:hover': {
20
20
  boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
21
- }
21
+ },
22
+ whiteSpace: 'nowrap'
22
23
  },
23
24
  active: {
24
25
  boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
@@ -35,18 +36,22 @@ var useStyles = makeStyles(function (theme) {
35
36
  value: {
36
37
  overflow: 'inherit'
37
38
  },
38
- textValue: {
39
- textAlign: 'right',
40
- whiteSpace: 'nowrap'
39
+ rightAlign: {
40
+ // only for rtl layout !
41
+ // changed by right in rtl mode
42
+ textAlign: 'left'
41
43
  }
42
44
  };
43
45
  });
44
46
 
47
+ var isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)));
48
+
45
49
  var Cell = function Cell(_ref) {
46
50
  var _cx;
47
51
 
48
52
  var flags = _ref.flags,
49
53
  value = _ref.value,
54
+ intValue = _ref.intValue,
50
55
  headers = _ref.headers,
51
56
  isOne = _ref.isOne,
52
57
  _ref$indexedDimValIds = _ref.indexedDimValIds,
@@ -60,6 +65,7 @@ var Cell = function Cell(_ref) {
60
65
  HTMLRenderer = _ref.HTMLRenderer;
61
66
 
62
67
  var classes = useStyles();
68
+ var isRtl = getIsRtl(useTheme());
63
69
  var hasFlag = R.not(R.isEmpty(flags));
64
70
  var uiValue = R.is(Function, cellHandler) && !R.isEmpty(indexedDimValIds) ? React.createElement(
65
71
  Link,
@@ -79,26 +85,21 @@ var Cell = function Cell(_ref) {
79
85
  return React.createElement(
80
86
  TableCell,
81
87
  {
88
+ align: isValidNumber(intValue) ? 'right' : 'left',
82
89
  component: isOne ? 'div' : undefined,
83
- className: cx(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx)),
90
+ className: cx(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx[classes.rightAlign] = isRtl, _cx)),
84
91
  headers: headers,
85
- onClick: activeCellHandler
92
+ onClick: activeCellHandler,
93
+ tabIndex: 0
86
94
  },
87
- React.createElement(
88
- 'div',
89
- { className: classes.textValue },
90
- React.createElement(
91
- Typography,
92
- { variant: 'body1', tabIndex: 0, noWrap: hasFlag },
93
- !R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
94
- hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags }),
95
- uiValue
96
- )
97
- )
95
+ !R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
96
+ hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags }),
97
+ uiValue
98
98
  );
99
99
  };
100
100
 
101
101
  Cell.propTypes = process.env.NODE_ENV !== "production" ? {
102
+ intValue: PropTypes.number,
102
103
  flags: PropTypes.array,
103
104
  isOne: PropTypes.bool,
104
105
  value: PropTypes.string,
@@ -94,21 +94,21 @@ var Section = function Section(_ref) {
94
94
  SideIcon: SideIcon,
95
95
  HTMLRenderer: HTMLRenderer
96
96
  }),
97
- R.map(function (sectionbody) {
97
+ R.addIndex(R.map)(function (sectionbody, rowIndex) {
98
98
  var _cx2;
99
99
 
100
- var rowId = sectionbody.key + '_' + sectionIndex;
100
+ var rowId = sectionbody.key + '_' + sectionIndex + '_' + rowIndex;
101
101
  var rowIds = R.pipe(R.map(function (index) {
102
102
  return sectionbody.key + '_' + sectionIndex + '_' + index;
103
103
  }), R.join(' '))(R.times(R.identity, R.length(R.prop('data', sectionbody))));
104
104
  return React.createElement(
105
105
  TableRow,
106
- { key: sectionbody.key },
106
+ { key: rowId },
107
107
  mapIndexed(function (cell, index) {
108
108
  var _cx;
109
109
 
110
110
  var flags = R.path(['value', 'flags'], cell);
111
- var id = rowId + '_' + index;
111
+ var id = rowIndex + '_' + rowId + '_' + index;
112
112
 
113
113
  // special space is used for hierarchy U+2007    
114
114
  var hierarchySpace = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length,
@@ -196,6 +196,8 @@ var Dataflow = function Dataflow(_ref2) {
196
196
  handleUrl = _ref2.handleUrl,
197
197
  label = _ref2.label,
198
198
  labels = _ref2.labels,
199
+ _ref2$dimensions = _ref2.dimensions,
200
+ dimensions = _ref2$dimensions === undefined ? [] : _ref2$dimensions,
199
201
  _ref2$highlights = _ref2.highlights,
200
202
  highlights = _ref2$highlights === undefined ? [] : _ref2$highlights,
201
203
  _ref2$categories = _ref2.categories,
@@ -229,12 +231,7 @@ var Dataflow = function Dataflow(_ref2) {
229
231
  { className: classes.header, 'data-testid': testId + '_title' },
230
232
  _react2.default.createElement(
231
233
  _Typography2.default,
232
- {
233
- variant: 'h6',
234
- color: 'primary',
235
- display: 'inline',
236
- className: classes.container
237
- },
234
+ { variant: 'h6', color: 'primary', display: 'inline' },
238
235
  _react2.default.createElement(
239
236
  _Link2.default,
240
237
  {
@@ -288,6 +285,21 @@ var Dataflow = function Dataflow(_ref2) {
288
285
  _react2.default.createElement(
289
286
  _CardContent2.default,
290
287
  { className: classes.cardContent },
288
+ !R.isEmpty(dimensions) && _react2.default.createElement(
289
+ _Typography2.default,
290
+ {
291
+ variant: 'body2',
292
+ color: 'textSecondary',
293
+ 'data-testid': testId + '_dimensions'
294
+ },
295
+ _react2.default.createElement(
296
+ 'strong',
297
+ null,
298
+ R.prop('dimensions')(labels),
299
+ ':\xA0'
300
+ ),
301
+ _react2.default.createElement(HTMLRenderer, { html: R.join(', ', dimensions) })
302
+ ),
291
303
  R.map(function (_ref3) {
292
304
  var field = _ref3[0],
293
305
  fieldHighlights = _ref3[1];
@@ -297,7 +309,6 @@ var Dataflow = function Dataflow(_ref2) {
297
309
  variant: 'body2',
298
310
  key: field,
299
311
  color: 'textSecondary',
300
- className: classes.container,
301
312
  'data-testid': testId + '_highlight_' + field
302
313
  },
303
314
  _react2.default.createElement(
@@ -320,12 +331,7 @@ var Dataflow = function Dataflow(_ref2) {
320
331
  categorie = _ref4[1];
321
332
  return _react2.default.createElement(
322
333
  _Typography2.default,
323
- {
324
- variant: 'body2',
325
- key: field,
326
- color: 'textSecondary',
327
- className: classes.container
328
- },
334
+ { variant: 'body2', key: field, color: 'textSecondary' },
329
335
  _react2.default.createElement(
330
336
  'strong',
331
337
  null,
@@ -343,7 +349,7 @@ var Dataflow = function Dataflow(_ref2) {
343
349
  R.not(R.isEmpty(categories)) && _react2.default.createElement(_Divider2.default, { className: classes.divider }),
344
350
  label && _react2.default.createElement(
345
351
  _Typography2.default,
346
- { variant: 'body2', color: 'textSecondary', className: classes.container },
352
+ { variant: 'body2', color: 'textSecondary' },
347
353
  _react2.default.createElement(
348
354
  'strong',
349
355
  null,
@@ -359,7 +365,7 @@ var Dataflow = function Dataflow(_ref2) {
359
365
  { className: classes.footer, disableSpacing: true },
360
366
  _react2.default.createElement(
361
367
  _Typography2.default,
362
- { variant: 'caption', color: 'textSecondary', className: classes.container },
368
+ { variant: 'caption', color: 'textSecondary' },
363
369
  _react2.default.createElement(
364
370
  'strong',
365
371
  null,
@@ -375,7 +381,7 @@ var Dataflow = function Dataflow(_ref2) {
375
381
  ),
376
382
  _react2.default.createElement(
377
383
  _Typography2.default,
378
- { variant: 'caption', color: 'textSecondary', className: classes.container },
384
+ { variant: 'caption', color: 'textSecondary' },
379
385
  R.prop('note')(labels)
380
386
  )
381
387
  )
@@ -428,6 +434,7 @@ Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
428
434
  date: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element])
429
435
  }),
430
436
  highlights: _propTypes2.default.array,
437
+ dimensions: _propTypes2.default.array,
431
438
  categories: _propTypes2.default.array,
432
439
  children: _propTypes2.default.node,
433
440
  HTMLRenderer: _propTypes2.default.func
@@ -24,10 +24,6 @@ var _TableCell = require('@material-ui/core/TableCell');
24
24
 
25
25
  var _TableCell2 = _interopRequireDefault(_TableCell);
26
26
 
27
- var _Typography = require('@material-ui/core/Typography');
28
-
29
- var _Typography2 = _interopRequireDefault(_Typography);
30
-
31
27
  var _Link = require('@material-ui/core/Link');
32
28
 
33
29
  var _Link2 = _interopRequireDefault(_Link);
@@ -36,6 +32,8 @@ var _flags = require('./flags');
36
32
 
37
33
  var _flags2 = _interopRequireDefault(_flags);
38
34
 
35
+ var _utils = require('../utils');
36
+
39
37
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
40
38
 
41
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -50,7 +48,8 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
50
48
  color: theme.palette.grey['A700'],
51
49
  '&:hover': {
52
50
  boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
53
- }
51
+ },
52
+ whiteSpace: 'nowrap'
54
53
  },
55
54
  active: {
56
55
  boxShadow: 'inset 0 0 0 2px ' + theme.palette.primary.main
@@ -67,18 +66,22 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
67
66
  value: {
68
67
  overflow: 'inherit'
69
68
  },
70
- textValue: {
71
- textAlign: 'right',
72
- whiteSpace: 'nowrap'
69
+ rightAlign: {
70
+ // only for rtl layout !
71
+ // changed by right in rtl mode
72
+ textAlign: 'left'
73
73
  }
74
74
  };
75
75
  });
76
76
 
77
+ var isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)));
78
+
77
79
  var Cell = function Cell(_ref) {
78
80
  var _cx;
79
81
 
80
82
  var flags = _ref.flags,
81
83
  value = _ref.value,
84
+ intValue = _ref.intValue,
82
85
  headers = _ref.headers,
83
86
  isOne = _ref.isOne,
84
87
  _ref$indexedDimValIds = _ref.indexedDimValIds,
@@ -92,6 +95,7 @@ var Cell = function Cell(_ref) {
92
95
  HTMLRenderer = _ref.HTMLRenderer;
93
96
 
94
97
  var classes = useStyles();
98
+ var isRtl = (0, _utils.getIsRtl)((0, _styles.useTheme)());
95
99
  var hasFlag = R.not(R.isEmpty(flags));
96
100
  var uiValue = R.is(Function, cellHandler) && !R.isEmpty(indexedDimValIds) ? _react2.default.createElement(
97
101
  _Link2.default,
@@ -111,26 +115,21 @@ var Cell = function Cell(_ref) {
111
115
  return _react2.default.createElement(
112
116
  _TableCell2.default,
113
117
  {
118
+ align: isValidNumber(intValue) ? 'right' : 'left',
114
119
  component: isOne ? 'div' : undefined,
115
- className: (0, _classnames2.default)(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx)),
120
+ className: (0, _classnames2.default)(classes.cell, (_cx = {}, _cx[classes.oneCell] = isOne, _cx[classes.active] = isActive, _cx[classes.highlight] = isHighlight, _cx[classes.rightAlign] = isRtl, _cx)),
116
121
  headers: headers,
117
- onClick: activeCellHandler
122
+ onClick: activeCellHandler,
123
+ tabIndex: 0
118
124
  },
119
- _react2.default.createElement(
120
- 'div',
121
- { className: classes.textValue },
122
- _react2.default.createElement(
123
- _Typography2.default,
124
- { variant: 'body1', tabIndex: 0, noWrap: hasFlag },
125
- !R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
126
- hasFlag && _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: flags }),
127
- uiValue
128
- )
129
- )
125
+ !R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
126
+ hasFlag && _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: flags }),
127
+ uiValue
130
128
  );
131
129
  };
132
130
 
133
131
  Cell.propTypes = process.env.NODE_ENV !== "production" ? {
132
+ intValue: _propTypes2.default.number,
134
133
  flags: _propTypes2.default.array,
135
134
  isOne: _propTypes2.default.bool,
136
135
  value: _propTypes2.default.string,
@@ -136,21 +136,21 @@ var Section = function Section(_ref) {
136
136
  SideIcon: SideIcon,
137
137
  HTMLRenderer: HTMLRenderer
138
138
  }),
139
- R.map(function (sectionbody) {
139
+ R.addIndex(R.map)(function (sectionbody, rowIndex) {
140
140
  var _cx2;
141
141
 
142
- var rowId = sectionbody.key + '_' + sectionIndex;
142
+ var rowId = sectionbody.key + '_' + sectionIndex + '_' + rowIndex;
143
143
  var rowIds = R.pipe(R.map(function (index) {
144
144
  return sectionbody.key + '_' + sectionIndex + '_' + index;
145
145
  }), R.join(' '))(R.times(R.identity, R.length(R.prop('data', sectionbody))));
146
146
  return _react2.default.createElement(
147
147
  _TableRow2.default,
148
- { key: sectionbody.key },
148
+ { key: rowId },
149
149
  mapIndexed(function (cell, index) {
150
150
  var _cx;
151
151
 
152
152
  var flags = R.path(['value', 'flags'], cell);
153
- var id = rowId + '_' + index;
153
+ var id = rowIndex + '_' + rowId + '_' + index;
154
154
 
155
155
  // special space is used for hierarchy U+2007    
156
156
  var hierarchySpace = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "7.8.4",
3
+ "version": "7.10.1",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",