@sis-cc/dotstatsuite-components 17.32.0 → 17.32.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.
@@ -90,7 +90,7 @@ var getCoordinates = function getCoordinates(indexes, topCoordinates, definition
90
90
 
91
91
  var getAttributesSeries = function getAttributesSeries(validator, attributesSeries) {
92
92
  return R.reduce(function (acc, attrs) {
93
- var attr = R.head(R.values(attrs));
93
+ var attr = R.head(R.values(attrs)) || {};
94
94
  if (R.length(attr.relationship || []) === 1 && !attr.combined) {
95
95
  return acc;
96
96
  }
@@ -130,7 +130,7 @@ var getSerieFlagsAndSideProps = function getSerieFlagsAndSideProps(coordinates,
130
130
  var flags = (0, _getFlagsAndNotes.getFlagsAndNotes)(layoutAttrValues, customAttributes);
131
131
  var hasMetadata = !R.isNil(R.find(validator, metadataCoordinates));
132
132
  var hasDataAdvancedAttributes = R.any(function (d) {
133
- return R.has('value', d) ? d.hasAdvancedAttributes : R.any(R.prop('hasAdvancedAttributes'), d.values);
133
+ return R.has('value', d) ? R.prop('hasAdvancedAttributes', d.value) : R.any(R.prop('hasAdvancedAttributes'), d.values);
134
134
  }, data);
135
135
  var hasAdvancedAttributes = hasDataAdvancedAttributes || getHasAdvancedAttributes(layoutAttrValues, customAttributes);
136
136
  var sideProps = hasMetadata || hasAdvancedAttributes ? { hasMetadata: hasMetadata, hasAdvancedAttributes: hasAdvancedAttributes, coordinates: coordinates } : null;
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.32.0",
4
+ "version": "17.32.1",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -51,7 +51,7 @@ const getCoordinates = (indexes, topCoordinates, definition) => R.addIndex(R.red
51
51
  }, topCoordinates, definition);
52
52
 
53
53
  const getAttributesSeries = (validator, attributesSeries) => R.reduce((acc, attrs) => {
54
- const attr = R.head(R.values(attrs));
54
+ const attr = R.head(R.values(attrs)) || {};
55
55
  if (R.length(attr.relationship || []) === 1 && !attr.combined) {
56
56
  return acc;
57
57
  }
@@ -87,7 +87,7 @@ const getSerieFlagsAndSideProps = (coordinates, validator, attributesValues, cus
87
87
  const flags = getFlagsAndNotes(layoutAttrValues, customAttributes);
88
88
  const hasMetadata = !R.isNil(R.find(validator, metadataCoordinates));
89
89
  const hasDataAdvancedAttributes = R.any(
90
- d => R.has('value', d) ? d.hasAdvancedAttributes : R.any(R.prop('hasAdvancedAttributes'), d.values)
90
+ d => R.has('value', d) ? R.prop('hasAdvancedAttributes', d.value) : R.any(R.prop('hasAdvancedAttributes'), d.values)
91
91
  , data);
92
92
  const hasAdvancedAttributes = hasDataAdvancedAttributes || getHasAdvancedAttributes(layoutAttrValues, customAttributes);
93
93
  const sideProps = hasMetadata || hasAdvancedAttributes
@@ -439,4 +439,52 @@ describe('getLayoutData 2 tests', () => {
439
439
  }
440
440
  });
441
441
  });
442
+ it('getSerieDataWithMissingLines, advanced attributes as dim level plus enpty series', () => {
443
+ const dimensions = [
444
+ {
445
+ id: 'D0',
446
+ values: [
447
+ { id: 'D0V0', flags: [], hasAdvancedAttributes: true },
448
+ { id: 'D0V1' }
449
+ ]
450
+ }
451
+ ];
452
+
453
+ const attributesSeries = {
454
+ 'D1=D1V0': {},
455
+ 'D0=D0V0:D1=D1V0': {},
456
+ };
457
+
458
+ const topCoordinates = {};
459
+
460
+ const serie = {
461
+ indexes: [0],
462
+ parentsIndexes: [[]],
463
+ missingIndexes: [[]],
464
+ };
465
+
466
+ const customAttributes = {
467
+ flags: [],
468
+ notes: ['A0', 'A2']
469
+ }
470
+
471
+ expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, customAttributes, {})).to.deep.equal([{
472
+ data: [
473
+ {
474
+ dimension: { id: 'D0' },
475
+ value: { id: 'D0V0', missingParents: [], parents: [], flags: [], hasAdvancedAttributes: true }
476
+ },
477
+ ],
478
+ coordinates: { D0: 'D0V0' },
479
+ key: 'D0=D0V0',
480
+ flags: [],
481
+ sideProps: {
482
+ coordinates: {
483
+ D0: 'D0V0',
484
+ },
485
+ hasAdvancedAttributes: true,
486
+ hasMetadata: false
487
+ }
488
+ }]);
489
+ });
442
490
  });