@sis-cc/dotstatsuite-visions 6.3.1 → 6.4.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.
@@ -0,0 +1,12 @@
1
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
+
3
+ import React from 'react';
4
+ import SvgIcon from '@material-ui/core/SvgIcon';
5
+
6
+ export default (function (props) {
7
+ return React.createElement(
8
+ SvgIcon,
9
+ _extends({ viewBox: '0 0 24 24' }, props),
10
+ React.createElement('path', { d: 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z' })
11
+ );
12
+ });
package/es/Icons/index.js CHANGED
@@ -24,4 +24,5 @@ export { default as AccessibilityFilled } from './AccessibilityFilled';
24
24
  export { default as AccessibilityOutlined } from './AccessibilityOutlined';
25
25
  export { default as AccountFilled } from './AccountFilled';
26
26
  export { default as AccountOutlined } from './AccountOutlined';
27
- export { default as Warning } from './Warning';
27
+ export { default as Warning } from './Warning';
28
+ export { default as CopyContent } from './CopyContent';
@@ -33,19 +33,26 @@ var useStyles = makeStyles(function (theme) {
33
33
  });
34
34
 
35
35
  var mapIndexed = R.addIndex(R.map);
36
- var mergeHeaderCells = R.reduce(function (acc, headerCell) {
37
- var previousCell = R.last(acc);
38
- var cellValue = R.prop('id', headerCell);
39
- var previousCellValue = R.prop('id', previousCell);
40
- if (cellValue !== previousCellValue) {
41
- return R.append(R.assoc('spanCount', 1, headerCell), acc);
42
- }
43
- return R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) }), acc);
44
- }, []);
45
- var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(headerData) {
46
- return R.pipe(R.pathOr([], [0, 'data']), R.length, R.times(function (index) {
47
- return R.pipe(R.map(R.path(['data', index, 'value'])), mergeHeaderCells)(headerData);
48
- }))(headerData);
36
+
37
+ export var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(data) {
38
+ var colLength = R.pipe(R.pathOr([], [0, 'data']), R.length)(data);
39
+ return R.pipe(R.pluck('data'),
40
+ // mix merge and transpose for performance
41
+ R.reduce(function (acc, cells) {
42
+ R.addIndex(R.forEach)(function (cell, rowIndex) {
43
+ var cellId = R.path(['value', 'id'], cell);
44
+ var topCell = rowIndex > 0 ? R.pipe(R.nth(rowIndex - 1), R.last)(acc) : null;
45
+ var cellKey = R.isNil(topCell) ? cellId : topCell.key + '-' + cellId;
46
+
47
+ var leftCell = R.pipe(R.nth(rowIndex), R.last)(acc);
48
+ if (R.prop('key', leftCell) === cellKey && rowIndex !== colLength - 1) {
49
+ acc = R.over(R.lensIndex(rowIndex), R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) })))(acc);
50
+ } else {
51
+ acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.propOr({}, 'value', cell), { key: cellKey, spanCount: 1 })))(acc);
52
+ }
53
+ })(cells);
54
+ return acc;
55
+ }, R.times(R.always([]), colLength)))(data);
49
56
  };
50
57
 
51
58
  var TableHtml5 = function TableHtml5(_ref) {
@@ -1,6 +1,6 @@
1
1
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
2
 
3
- import React, { Fragment } from 'react';
3
+ import React from 'react';
4
4
  import * as R from 'ramda';
5
5
  import PropTypes from 'prop-types';
6
6
  import cx from 'classnames';
@@ -46,6 +46,9 @@ var useStyles = makeStyles(function (theme) {
46
46
  topCell: {
47
47
  paddingTop: 0
48
48
  },
49
+ hierarchySpace: {
50
+ marginBottom: 'auto'
51
+ },
49
52
  highlight: theme.mixins.table.cellHighlight
50
53
  };
51
54
  });
@@ -93,7 +96,14 @@ var Section = function Section(_ref) {
93
96
 
94
97
  var flags = R.path(['value', 'flags'], cell);
95
98
  var id = rowId + '_' + index;
96
- var hierarchyLength = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length)(cell);
99
+
100
+ // special space is used for hierarchy U+2007 &#8199; &numsp;
101
+ var hierarchySpace = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length,
102
+ // eslint-disable-next-line no-irregular-whitespace
103
+ R.times(function () {
104
+ return '·  ';
105
+ }))(cell);
106
+
97
107
  return React.createElement(
98
108
  TableCell,
99
109
  {
@@ -106,16 +116,14 @@ var Section = function Section(_ref) {
106
116
  React.createElement(
107
117
  'div',
108
118
  { className: classes.cellContent },
119
+ !R.isEmpty(hierarchySpace) && React.createElement(
120
+ 'div',
121
+ { className: classes.hierarchySpace },
122
+ hierarchySpace
123
+ ),
109
124
  React.createElement(
110
125
  Typography,
111
126
  { variant: 'body1', tabIndex: 0 },
112
- R.times(function (n) {
113
- return React.createElement(
114
- Fragment,
115
- { key: id + '-' + n },
116
- '\u2003'
117
- );
118
- }, hierarchyLength),
119
127
  R.path(['value', 'label'], cell),
120
128
  React.createElement(Flags, { flags: flags })
121
129
  )
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _SvgIcon = require('@material-ui/core/SvgIcon');
12
+
13
+ var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ exports.default = function (props) {
18
+ return _react2.default.createElement(
19
+ _SvgIcon2.default,
20
+ _extends({ viewBox: '0 0 24 24' }, props),
21
+ _react2.default.createElement('path', { d: 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z' })
22
+ );
23
+ };
24
+
25
+ module.exports = exports['default'];
@@ -143,4 +143,13 @@ Object.defineProperty(exports, 'Warning', {
143
143
  }
144
144
  });
145
145
 
146
+ var _CopyContent = require('./CopyContent');
147
+
148
+ Object.defineProperty(exports, 'CopyContent', {
149
+ enumerable: true,
150
+ get: function get() {
151
+ return _interopRequireDefault(_CopyContent).default;
152
+ }
153
+ });
154
+
146
155
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.getEnhancedValuesHeaderData = undefined;
4
5
 
5
6
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6
7
 
@@ -65,19 +66,26 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
65
66
  });
66
67
 
67
68
  var mapIndexed = R.addIndex(R.map);
68
- var mergeHeaderCells = R.reduce(function (acc, headerCell) {
69
- var previousCell = R.last(acc);
70
- var cellValue = R.prop('id', headerCell);
71
- var previousCellValue = R.prop('id', previousCell);
72
- if (cellValue !== previousCellValue) {
73
- return R.append(R.assoc('spanCount', 1, headerCell), acc);
74
- }
75
- return R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) }), acc);
76
- }, []);
77
- var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(headerData) {
78
- return R.pipe(R.pathOr([], [0, 'data']), R.length, R.times(function (index) {
79
- return R.pipe(R.map(R.path(['data', index, 'value'])), mergeHeaderCells)(headerData);
80
- }))(headerData);
69
+
70
+ var getEnhancedValuesHeaderData = exports.getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(data) {
71
+ var colLength = R.pipe(R.pathOr([], [0, 'data']), R.length)(data);
72
+ return R.pipe(R.pluck('data'),
73
+ // mix merge and transpose for performance
74
+ R.reduce(function (acc, cells) {
75
+ R.addIndex(R.forEach)(function (cell, rowIndex) {
76
+ var cellId = R.path(['value', 'id'], cell);
77
+ var topCell = rowIndex > 0 ? R.pipe(R.nth(rowIndex - 1), R.last)(acc) : null;
78
+ var cellKey = R.isNil(topCell) ? cellId : topCell.key + '-' + cellId;
79
+
80
+ var leftCell = R.pipe(R.nth(rowIndex), R.last)(acc);
81
+ if (R.prop('key', leftCell) === cellKey && rowIndex !== colLength - 1) {
82
+ acc = R.over(R.lensIndex(rowIndex), R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) })))(acc);
83
+ } else {
84
+ acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.propOr({}, 'value', cell), { key: cellKey, spanCount: 1 })))(acc);
85
+ }
86
+ })(cells);
87
+ return acc;
88
+ }, R.times(R.always([]), colLength)))(data);
81
89
  };
82
90
 
83
91
  var TableHtml5 = function TableHtml5(_ref) {
@@ -168,5 +176,4 @@ TableHtml5.propTypes = process.env.NODE_ENV !== "production" ? {
168
176
  activeCellIds: _propTypes2.default.object
169
177
  } : {};
170
178
 
171
- exports.default = TableHtml5;
172
- module.exports = exports['default'];
179
+ exports.default = TableHtml5;
@@ -88,6 +88,9 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
88
88
  topCell: {
89
89
  paddingTop: 0
90
90
  },
91
+ hierarchySpace: {
92
+ marginBottom: 'auto'
93
+ },
91
94
  highlight: theme.mixins.table.cellHighlight
92
95
  };
93
96
  });
@@ -135,7 +138,14 @@ var Section = function Section(_ref) {
135
138
 
136
139
  var flags = R.path(['value', 'flags'], cell);
137
140
  var id = rowId + '_' + index;
138
- var hierarchyLength = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length)(cell);
141
+
142
+ // special space is used for hierarchy U+2007 &#8199; &numsp;
143
+ var hierarchySpace = R.pipe(R.pathOr([], ['value', 'parents']), R.when(R.isNil, R.always([])), R.length,
144
+ // eslint-disable-next-line no-irregular-whitespace
145
+ R.times(function () {
146
+ return '·  ';
147
+ }))(cell);
148
+
139
149
  return _react2.default.createElement(
140
150
  _TableCell2.default,
141
151
  {
@@ -148,16 +158,14 @@ var Section = function Section(_ref) {
148
158
  _react2.default.createElement(
149
159
  'div',
150
160
  { className: classes.cellContent },
161
+ !R.isEmpty(hierarchySpace) && _react2.default.createElement(
162
+ 'div',
163
+ { className: classes.hierarchySpace },
164
+ hierarchySpace
165
+ ),
151
166
  _react2.default.createElement(
152
167
  _Typography2.default,
153
168
  { variant: 'body1', tabIndex: 0 },
154
- R.times(function (n) {
155
- return _react2.default.createElement(
156
- _react.Fragment,
157
- { key: id + '-' + n },
158
- '\u2003'
159
- );
160
- }, hierarchyLength),
161
169
  R.path(['value', 'label'], cell),
162
170
  _react2.default.createElement(_flags2.default, { flags: flags })
163
171
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "6.3.1",
3
+ "version": "6.4.2",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",