@sis-cc/dotstatsuite-visions 7.8.3 → 7.10.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.
@@ -142,13 +142,16 @@ 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,
148
150
  categories = _ref2$categories === undefined ? [] : _ref2$categories,
149
151
  children = _ref2.children,
150
152
  _ref2$HTMLRenderer = _ref2.HTMLRenderer,
151
- HTMLRenderer = _ref2$HTMLRenderer === undefined ? BasicHTMLRenderer : _ref2$HTMLRenderer;
153
+ HTMLRenderer = _ref2$HTMLRenderer === undefined ? BasicHTMLRenderer : _ref2$HTMLRenderer,
154
+ id = _ref2.id;
152
155
 
153
156
  var classes = useStyles();
154
157
 
@@ -174,12 +177,7 @@ var Dataflow = function Dataflow(_ref2) {
174
177
  { className: classes.header, 'data-testid': testId + '_title' },
175
178
  React.createElement(
176
179
  Typography,
177
- {
178
- variant: 'h6',
179
- color: 'primary',
180
- display: 'inline',
181
- className: classes.container
182
- },
180
+ { variant: 'h6', color: 'primary', display: 'inline' },
183
181
  React.createElement(
184
182
  Link,
185
183
  {
@@ -233,16 +231,30 @@ var Dataflow = function Dataflow(_ref2) {
233
231
  React.createElement(
234
232
  CardContent,
235
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
+ ),
236
249
  R.map(function (_ref3) {
237
250
  var field = _ref3[0],
238
- highlight = _ref3[1];
251
+ fieldHighlights = _ref3[1];
239
252
  return React.createElement(
240
253
  Typography,
241
254
  {
242
255
  variant: 'body2',
243
256
  key: field,
244
257
  color: 'textSecondary',
245
- className: classes.container,
246
258
  'data-testid': testId + '_highlight_' + field
247
259
  },
248
260
  React.createElement(
@@ -251,8 +263,9 @@ var Dataflow = function Dataflow(_ref2) {
251
263
  field,
252
264
  ':\xA0'
253
265
  ),
254
- ' ',
255
- React.createElement(HTMLRenderer, { html: highlight })
266
+ R.map(function (fieldHighlight) {
267
+ return React.createElement(HTMLRenderer, { key: id + '-' + field, html: fieldHighlight });
268
+ }, fieldHighlights)
256
269
  );
257
270
  })(highlights),
258
271
  React.createElement(
@@ -264,12 +277,7 @@ var Dataflow = function Dataflow(_ref2) {
264
277
  categorie = _ref4[1];
265
278
  return React.createElement(
266
279
  Typography,
267
- {
268
- variant: 'body2',
269
- key: field,
270
- color: 'textSecondary',
271
- className: classes.container
272
- },
280
+ { variant: 'body2', key: field, color: 'textSecondary' },
273
281
  React.createElement(
274
282
  'strong',
275
283
  null,
@@ -287,7 +295,7 @@ var Dataflow = function Dataflow(_ref2) {
287
295
  R.not(R.isEmpty(categories)) && React.createElement(Divider, { className: classes.divider }),
288
296
  label && React.createElement(
289
297
  Typography,
290
- { variant: 'body2', color: 'textSecondary', className: classes.container },
298
+ { variant: 'body2', color: 'textSecondary' },
291
299
  React.createElement(
292
300
  'strong',
293
301
  null,
@@ -303,7 +311,7 @@ var Dataflow = function Dataflow(_ref2) {
303
311
  { className: classes.footer, disableSpacing: true },
304
312
  React.createElement(
305
313
  Typography,
306
- { variant: 'caption', color: 'textSecondary', className: classes.container },
314
+ { variant: 'caption', color: 'textSecondary' },
307
315
  React.createElement(
308
316
  'strong',
309
317
  null,
@@ -319,7 +327,7 @@ var Dataflow = function Dataflow(_ref2) {
319
327
  ),
320
328
  React.createElement(
321
329
  Typography,
322
- { variant: 'caption', color: 'textSecondary', className: classes.container },
330
+ { variant: 'caption', color: 'textSecondary' },
323
331
  R.prop('note')(labels)
324
332
  )
325
333
  )
@@ -356,6 +364,7 @@ var Dataflow = function Dataflow(_ref2) {
356
364
 
357
365
  Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
358
366
  testId: PropTypes.string,
367
+ id: PropTypes.string,
359
368
  title: PropTypes.string,
360
369
  body: PropTypes.shape({
361
370
  description: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
@@ -371,6 +380,7 @@ Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
371
380
  date: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
372
381
  }),
373
382
  highlights: PropTypes.array,
383
+ dimensions: PropTypes.array,
374
384
  categories: PropTypes.array,
375
385
  children: PropTypes.node,
376
386
  HTMLRenderer: PropTypes.func
@@ -10,6 +10,7 @@
10
10
  * @api public
11
11
  * @props
12
12
  * Dataflow.propTypes = {
13
+ * id: PropTypes.string,
13
14
  * testId: PropTypes.string,
14
15
  * title: PropTypes.string,
15
16
  * body: PropTypes.shape({
@@ -26,6 +27,7 @@
26
27
  * note: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
27
28
  * date: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
28
29
  * }),
30
+ * dimensions: PropTypes.array,
29
31
  * highlights: PropTypes.array,
30
32
  * categories: PropTypes.array,
31
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,
@@ -196,13 +196,16 @@ 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,
202
204
  categories = _ref2$categories === undefined ? [] : _ref2$categories,
203
205
  children = _ref2.children,
204
206
  _ref2$HTMLRenderer = _ref2.HTMLRenderer,
205
- HTMLRenderer = _ref2$HTMLRenderer === undefined ? BasicHTMLRenderer : _ref2$HTMLRenderer;
207
+ HTMLRenderer = _ref2$HTMLRenderer === undefined ? BasicHTMLRenderer : _ref2$HTMLRenderer,
208
+ id = _ref2.id;
206
209
 
207
210
  var classes = useStyles();
208
211
 
@@ -228,12 +231,7 @@ var Dataflow = function Dataflow(_ref2) {
228
231
  { className: classes.header, 'data-testid': testId + '_title' },
229
232
  _react2.default.createElement(
230
233
  _Typography2.default,
231
- {
232
- variant: 'h6',
233
- color: 'primary',
234
- display: 'inline',
235
- className: classes.container
236
- },
234
+ { variant: 'h6', color: 'primary', display: 'inline' },
237
235
  _react2.default.createElement(
238
236
  _Link2.default,
239
237
  {
@@ -287,16 +285,30 @@ var Dataflow = function Dataflow(_ref2) {
287
285
  _react2.default.createElement(
288
286
  _CardContent2.default,
289
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
+ ),
290
303
  R.map(function (_ref3) {
291
304
  var field = _ref3[0],
292
- highlight = _ref3[1];
305
+ fieldHighlights = _ref3[1];
293
306
  return _react2.default.createElement(
294
307
  _Typography2.default,
295
308
  {
296
309
  variant: 'body2',
297
310
  key: field,
298
311
  color: 'textSecondary',
299
- className: classes.container,
300
312
  'data-testid': testId + '_highlight_' + field
301
313
  },
302
314
  _react2.default.createElement(
@@ -305,8 +317,9 @@ var Dataflow = function Dataflow(_ref2) {
305
317
  field,
306
318
  ':\xA0'
307
319
  ),
308
- ' ',
309
- _react2.default.createElement(HTMLRenderer, { html: highlight })
320
+ R.map(function (fieldHighlight) {
321
+ return _react2.default.createElement(HTMLRenderer, { key: id + '-' + field, html: fieldHighlight });
322
+ }, fieldHighlights)
310
323
  );
311
324
  })(highlights),
312
325
  _react2.default.createElement(
@@ -318,12 +331,7 @@ var Dataflow = function Dataflow(_ref2) {
318
331
  categorie = _ref4[1];
319
332
  return _react2.default.createElement(
320
333
  _Typography2.default,
321
- {
322
- variant: 'body2',
323
- key: field,
324
- color: 'textSecondary',
325
- className: classes.container
326
- },
334
+ { variant: 'body2', key: field, color: 'textSecondary' },
327
335
  _react2.default.createElement(
328
336
  'strong',
329
337
  null,
@@ -341,7 +349,7 @@ var Dataflow = function Dataflow(_ref2) {
341
349
  R.not(R.isEmpty(categories)) && _react2.default.createElement(_Divider2.default, { className: classes.divider }),
342
350
  label && _react2.default.createElement(
343
351
  _Typography2.default,
344
- { variant: 'body2', color: 'textSecondary', className: classes.container },
352
+ { variant: 'body2', color: 'textSecondary' },
345
353
  _react2.default.createElement(
346
354
  'strong',
347
355
  null,
@@ -357,7 +365,7 @@ var Dataflow = function Dataflow(_ref2) {
357
365
  { className: classes.footer, disableSpacing: true },
358
366
  _react2.default.createElement(
359
367
  _Typography2.default,
360
- { variant: 'caption', color: 'textSecondary', className: classes.container },
368
+ { variant: 'caption', color: 'textSecondary' },
361
369
  _react2.default.createElement(
362
370
  'strong',
363
371
  null,
@@ -373,7 +381,7 @@ var Dataflow = function Dataflow(_ref2) {
373
381
  ),
374
382
  _react2.default.createElement(
375
383
  _Typography2.default,
376
- { variant: 'caption', color: 'textSecondary', className: classes.container },
384
+ { variant: 'caption', color: 'textSecondary' },
377
385
  R.prop('note')(labels)
378
386
  )
379
387
  )
@@ -410,6 +418,7 @@ var Dataflow = function Dataflow(_ref2) {
410
418
 
411
419
  Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
412
420
  testId: _propTypes2.default.string,
421
+ id: _propTypes2.default.string,
413
422
  title: _propTypes2.default.string,
414
423
  body: _propTypes2.default.shape({
415
424
  description: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
@@ -425,6 +434,7 @@ Dataflow.propTypes = process.env.NODE_ENV !== "production" ? {
425
434
  date: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element])
426
435
  }),
427
436
  highlights: _propTypes2.default.array,
437
+ dimensions: _propTypes2.default.array,
428
438
  categories: _propTypes2.default.array,
429
439
  children: _propTypes2.default.node,
430
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "7.8.3",
3
+ "version": "7.10.0",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",