@sis-cc/dotstatsuite-components 20.2.0 → 20.3.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.
@@ -80,11 +80,11 @@ var getCoordinates = function getCoordinates(indexes, topCoordinates, definition
80
80
  if (R.has('dimensions', entry)) {
81
81
  return R.addIndex(R.reduce)(function (_acc, dim, _index) {
82
82
  var valInd = R.path([index, _index], indexes);
83
- return R.assoc(dim.id, R.path(['values', valInd, 'id'], dim), _acc);
83
+ return R.assoc(dim.id, R.path(['values', Math.abs(valInd), 'id'], dim), _acc);
84
84
  }, acc, entry.dimensions);
85
85
  }
86
86
  var valInd = R.nth(index, indexes);
87
- return R.assoc(entry.id, R.path(['values', valInd, 'id'], entry), acc);
87
+ return R.assoc(entry.id, R.path(['values', Math.abs(valInd), 'id'], entry), acc);
88
88
  }, topCoordinates, definition);
89
89
  };
90
90
 
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": "20.2.0",
4
+ "version": "20.3.0",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
7
7
  "author": "OECD",
@@ -43,11 +43,11 @@ const getCoordinates = (indexes, topCoordinates, definition) => R.addIndex(R.red
43
43
  if (R.has('dimensions', entry)) {
44
44
  return R.addIndex(R.reduce)((_acc, dim, _index) => {
45
45
  const valInd = R.path([index, _index], indexes);
46
- return R.assoc(dim.id, R.path(['values', valInd, 'id'], dim), _acc)
46
+ return R.assoc(dim.id, R.path(['values', Math.abs(valInd), 'id'], dim), _acc)
47
47
  }, acc, entry.dimensions);
48
48
  }
49
49
  const valInd = R.nth(index, indexes);
50
- return R.assoc(entry.id, R.path(['values', valInd, 'id'], entry), acc);
50
+ return R.assoc(entry.id, R.path(['values', Math.abs(valInd), 'id'], entry), acc);
51
51
  }, topCoordinates, definition);
52
52
 
53
53
  const getAttributesSeries = (validator, attributesSeries) => R.reduce((acc, attrs) => {
@@ -439,7 +439,7 @@ describe('getLayoutData 2 tests', () => {
439
439
  }
440
440
  });
441
441
  });
442
- it('getSerieDataWithMissingLines, advanced attributes as dim level plus enpty series', () => {
442
+ it('getSerieDataWithMissingLines, advanced attributes as dim level plus empty series', () => {
443
443
  const dimensions = [
444
444
  {
445
445
  id: 'D0',
@@ -487,4 +487,49 @@ describe('getLayoutData 2 tests', () => {
487
487
  }
488
488
  }]);
489
489
  });
490
+ it('getSerieDataWithMissingLines, advanced attributes and inverted dim', () => {
491
+ const dimensions = [
492
+ {
493
+ id: 'D0',
494
+ values: [
495
+ { id: 'D0V0' },
496
+ { id: 'D0V1', hasAdvancedAttributes: true }
497
+ ]
498
+ }
499
+ ];
500
+
501
+ const attributesSeries = {};
502
+
503
+ const topCoordinates = {};
504
+
505
+ const serie = {
506
+ indexes: [-1],
507
+ parentsIndexes: [[]],
508
+ missingIndexes: [[]],
509
+ };
510
+
511
+ const customAttributes = {
512
+ flags: [],
513
+ notes: []
514
+ }
515
+
516
+ expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, customAttributes, {})).to.deep.equal([{
517
+ data: [
518
+ {
519
+ dimension: { id: 'D0' },
520
+ value: { id: 'D0V1', missingParents: [], parents: [], hasAdvancedAttributes: true }
521
+ },
522
+ ],
523
+ coordinates: { D0: 'D0V1' },
524
+ key: 'D0=D0V1',
525
+ flags: [],
526
+ sideProps: {
527
+ coordinates: {
528
+ D0: 'D0V1',
529
+ },
530
+ hasAdvancedAttributes: true,
531
+ hasMetadata: false
532
+ }
533
+ }]);
534
+ });
490
535
  });