@sis-cc/dotstatsuite-components 17.21.0 → 17.22.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.
@@ -20,7 +20,9 @@ var isTableLayoutCompatible = function isTableLayoutCompatible(data, layout) {
20
20
 
21
21
  var multiValuesDimensions = R.pipe(R.pathOr([], ['structure', 'dimensions', 'observation']), function (dimensions) {
22
22
  return (0, _src.refineDimensions)(dimensions, dataquery);
23
- }, R.reject(R.prop('header')), R.pluck('id'))(data);
23
+ }, R.reject(function (d) {
24
+ return R.prop('header', d) || !R.length(d.values || []);
25
+ }), R.pluck('id'))(data);
24
26
  var dimensionsInLayout = R.pipe(R.values, R.unnest)(layout);
25
27
 
26
28
  var dimensionsLength = R.length(multiValuesDimensions);
@@ -22,7 +22,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
22
22
  var getManyValuesDimensions = exports.getManyValuesDimensions = function getManyValuesDimensions(dimensions, attributesSeries, customAttributes, combinations) {
23
23
  var combConceptsIds = R.pipe(R.pluck('concepts'), R.unnest)(combinations);
24
24
  return R.reduce(function (acc, dim) {
25
- if (dim.header) {
25
+ if (dim.header || !R.length(dim.values)) {
26
26
  return acc;
27
27
  }
28
28
  var enhancedValues = R.map(function (val) {
@@ -31,6 +31,8 @@ var refineDimensions = exports.refineDimensions = function refineDimensions() {
31
31
  }
32
32
  return R.assoc('empty', true, val);
33
33
  }, dim.values || []);
34
- return (0, _extends3.default)({}, dim, { values: values, header: R.length(values) <= 1 || R.length(selection) === 1 && !R.isEmpty(R.head(selection)) });
34
+
35
+ var size = R.length(values);
36
+ return (0, _extends3.default)({}, dim, { values: values, header: size === 1 || size > 1 && R.length(selection) === 1 && !R.isEmpty(R.head(selection)) });
35
37
  }, dimensions);
36
38
  };
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": "17.21.0",
4
+ "version": "17.22.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -12,7 +12,7 @@ const isTableLayoutCompatible = (data, layout, dataquery='') => {
12
12
  const multiValuesDimensions = R.pipe(
13
13
  R.pathOr([], ['structure', 'dimensions', 'observation']),
14
14
  dimensions => refineDimensions(dimensions, dataquery),
15
- R.reject(R.prop('header')),
15
+ R.reject(d => R.prop('header', d) || !R.length(d.values || [])),
16
16
  R.pluck('id')
17
17
  )(data);
18
18
  const dimensionsInLayout = R.pipe(R.values, R.unnest)(layout);
@@ -5,7 +5,7 @@ export const getManyValuesDimensions = (dimensions, attributesSeries, customAttr
5
5
  const combConceptsIds = R.pipe(R.pluck('concepts'), R.unnest)(combinations);
6
6
  return R.reduce(
7
7
  (acc, dim) => {
8
- if (dim.header) {
8
+ if (dim.header || !R.length(dim.values)) {
9
9
  return acc;
10
10
  }
11
11
  const enhancedValues = R.map(val => {
@@ -11,6 +11,8 @@ export const refineDimensions = (dimensions=[], dataquery='') => {
11
11
  }
12
12
  return R.assoc('empty', true, val);
13
13
  }, dim.values || []);
14
- return { ...dim, values, header: R.length(values) <= 1 || (R.length(selection) === 1 && !R.isEmpty(R.head(selection))) };
14
+
15
+ const size = R.length(values);
16
+ return { ...dim, values, header: size === 1 || (size > 1 && R.length(selection) === 1 && !R.isEmpty(R.head(selection))) };
15
17
  }, dimensions);
16
18
  };
@@ -21,7 +21,7 @@ describe('refine dimensions tests', () => {
21
21
  const dataquery = '.v0+v1.v0.v0+v1...';
22
22
 
23
23
  expect(refineDimensions(dimensions, dataquery)).to.deep.equal([
24
- { id: 'd0', values: [], header: true },
24
+ { id: 'd0', values: [], header: false },
25
25
  { id: 'd1', values: [{ id: 'v0', isSelected: true }], header: true },
26
26
  { id: 'd2', values: [{ id: 'v0', isSelected: true }, { id: 'v1', empty: true }, { id: 'v2', empty: true }], header: true },
27
27
  { id: 'd3', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }, { id: 'v2', empty: true }], header: false },