@sis-cc/dotstatsuite-components 17.32.0 → 17.32.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.
@@ -35,7 +35,6 @@ var hasInvalidValues = R.pipe(R.prop('values'), R.anyPass([R.isNil, R.complement
35
35
  var isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
36
36
  var filterValidConcepts = R.reject(isConceptInvalid);
37
37
  // concepts is an array of ids... (misnamed!)
38
- var conceptIdsLens = R.lensProp('concepts');
39
38
  var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
40
39
  var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
41
40
  return function () {
@@ -44,7 +43,7 @@ var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
44
43
  var validConceptIds = R.pluck('id', filterValidConcepts(concepts));
45
44
  return R.reduce(function (acc, comb) {
46
45
  var refinedConcepts = R.intersection(validConceptIds, comb.concepts);
47
- if (R.length(refinedConcepts) < 2) {
46
+ if (R.length(refinedConcepts) < 1) {
48
47
  return acc;
49
48
  }
50
49
  return R.append((0, _extends4.default)({}, comb, { concepts: refinedConcepts }), acc);
@@ -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.2",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -18,14 +18,13 @@ const hasInvalidValues = R.pipe(
18
18
  const isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
19
19
  const filterValidConcepts = R.reject(isConceptInvalid);
20
20
  // concepts is an array of ids... (misnamed!)
21
- const conceptIdsLens = R.lensProp('concepts');
22
21
  const rejectInvalidConceptIds =
23
22
  (concepts = []) =>
24
23
  (combinations = []) => {
25
24
  const validConceptIds = R.pluck('id', filterValidConcepts(concepts));
26
25
  return R.reduce((acc, comb) => {
27
26
  const refinedConcepts = R.intersection(validConceptIds, comb.concepts);
28
- if (R.length(refinedConcepts) < 2) {
27
+ if (R.length(refinedConcepts) < 1) {
29
28
  return acc;
30
29
  }
31
30
  return R.append({ ...comb, concepts: refinedConcepts }, acc);
@@ -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
  });
@@ -146,6 +146,20 @@ describe('parseCombinations tests', () => {
146
146
  relationship: ['DIM4'],
147
147
  display: true,
148
148
  },
149
+ {
150
+ id: 'COMB11',
151
+ concepts: ['DIM4'],
152
+ relationship: ['DIM4'],
153
+ series: true,
154
+ display: true
155
+ },
156
+ {
157
+ id: 'COMB12',
158
+ concepts: ['DIM4'],
159
+ relationship: ['DIM4'],
160
+ series: true,
161
+ display: true
162
+ },
149
163
  {
150
164
  id: 'COMB14',
151
165
  concepts: ['DIM3', 'ATTR5', 'ATTR8'],