@sis-cc/dotstatsuite-components 17.31.0 → 17.32.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.
@@ -33,7 +33,7 @@ var getDisplayableValues = function getDisplayableValues(values) {
33
33
  // - empty/null/undefined/!array values (so far)
34
34
  var hasInvalidValues = R.pipe(R.prop('values'), R.anyPass([R.isNil, R.complement(R.is(Array)), R.isEmpty]));
35
35
  var isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
36
- var filterInvalidConcepts = R.filter(isConceptInvalid);
36
+ var filterValidConcepts = R.reject(isConceptInvalid);
37
37
  // concepts is an array of ids... (misnamed!)
38
38
  var conceptIdsLens = R.lensProp('concepts');
39
39
  var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
@@ -41,8 +41,14 @@ var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
41
41
  return function () {
42
42
  var combinations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
43
43
 
44
- var invalidConceptIds = R.pluck('id', filterInvalidConcepts(concepts));
45
- return R.map(R.over(conceptIdsLens, R.without(invalidConceptIds)), combinations);
44
+ var validConceptIds = R.pluck('id', filterValidConcepts(concepts));
45
+ return R.reduce(function (acc, comb) {
46
+ var refinedConcepts = R.intersection(validConceptIds, comb.concepts);
47
+ if (R.length(refinedConcepts) < 2) {
48
+ return acc;
49
+ }
50
+ return R.append((0, _extends4.default)({}, comb, { concepts: refinedConcepts }), acc);
51
+ }, [], combinations);
46
52
  };
47
53
  };
48
54
 
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.31.0",
4
+ "version": "17.32.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -16,17 +16,20 @@ const hasInvalidValues = R.pipe(
16
16
  R.anyPass([R.isNil, R.complement(R.is(Array)), R.isEmpty]),
17
17
  );
18
18
  const isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
19
- const filterInvalidConcepts = R.filter(isConceptInvalid);
19
+ const filterValidConcepts = R.reject(isConceptInvalid);
20
20
  // concepts is an array of ids... (misnamed!)
21
21
  const conceptIdsLens = R.lensProp('concepts');
22
22
  const rejectInvalidConceptIds =
23
23
  (concepts = []) =>
24
24
  (combinations = []) => {
25
- const invalidConceptIds = R.pluck('id', filterInvalidConcepts(concepts));
26
- return R.map(
27
- R.over(conceptIdsLens, R.without(invalidConceptIds)),
28
- combinations,
29
- );
25
+ const validConceptIds = R.pluck('id', filterValidConcepts(concepts));
26
+ return R.reduce((acc, comb) => {
27
+ const refinedConcepts = R.intersection(validConceptIds, comb.concepts);
28
+ if (R.length(refinedConcepts) < 2) {
29
+ return acc;
30
+ }
31
+ return R.append({ ...comb, concepts: refinedConcepts }, acc);
32
+ }, [], combinations);
30
33
  };
31
34
 
32
35
  export const parseCombinations = (
@@ -17,7 +17,7 @@ describe('parseCombinations tests', () => {
17
17
  { id: 'COMB11', concepts: ['DIM4', 'DIM7'] },
18
18
  { id: 'COMB12', concepts: ['DIM4', 'ATTR7'] },
19
19
  { id: 'COMB13', concepts: ['DIM7', 'ATTR7'] },
20
- { id: 'COMB14', concepts: ['DIM3', 'ATTR5', 'ATTR8'] }
20
+ { id: 'COMB14', concepts: ['DIM3', 'ATTR5', 'ATTR8'] },
21
21
  ];
22
22
 
23
23
  const dimensions = [
@@ -146,26 +146,6 @@ describe('parseCombinations tests', () => {
146
146
  relationship: ['DIM4'],
147
147
  display: true,
148
148
  },
149
- {
150
- id: 'COMB11',
151
- concepts: ['DIM4'],
152
- series: true,
153
- relationship: ['DIM4'],
154
- display: true,
155
- },
156
- {
157
- id: 'COMB12',
158
- concepts: ['DIM4'],
159
- series: true,
160
- relationship: ['DIM4'],
161
- display: true,
162
- },
163
- {
164
- id: 'COMB13',
165
- concepts: [],
166
- display: false,
167
- header: true,
168
- },
169
149
  {
170
150
  id: 'COMB14',
171
151
  concepts: ['DIM3', 'ATTR5', 'ATTR8'],