@sis-cc/dotstatsuite-components 16.5.0 → 16.7.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.
- package/lib/rules2/src/enhanceObservations.js +1 -1
- package/lib/rules2/src/getHeaderCombinations.js +1 -1
- package/lib/rules2/src/parseCombinations.js +6 -6
- package/package.json +1 -1
- package/src/rules2/src/enhanceObservations.js +1 -1
- package/src/rules2/src/getHeaderCombinations.js +1 -1
- package/src/rules2/src/parseCombinations.js +8 -10
- package/test/enhanceObservations2.test.js +3 -3
- package/test/getHeaderCombinations.test.js +1 -1
- package/test/parseCombinations.test.js +12 -2
|
@@ -44,7 +44,7 @@ var parseAttributesValues = function parseAttributesValues(obs, attributes, inde
|
|
|
44
44
|
var display = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
45
45
|
return display && !R.includes(_value.id, _constants.REJECTED_VALUE_IDS);
|
|
46
46
|
})(_value);
|
|
47
|
-
if (
|
|
47
|
+
if (!R.propOr(true, 'display', attribute) || !R.propOr(true, 'display', value)) {
|
|
48
48
|
value = null;
|
|
49
49
|
}
|
|
50
50
|
var relationship = R.propOr([], 'relationship', attribute);
|
|
@@ -21,7 +21,7 @@ var getHeaderCombinations = exports.getHeaderCombinations = function getHeaderCo
|
|
|
21
21
|
return acc;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var header = (0, _src.dimensionValueDisplay)(display)(comb);
|
|
24
|
+
var header = (0, _src.dimensionValueDisplay)(display)(comb) + ':';
|
|
25
25
|
|
|
26
26
|
var combinedDisplay = function combinedDisplay(_display, values) {
|
|
27
27
|
if (_display === 'label') {
|
|
@@ -45,20 +45,20 @@ var parseCombinations = exports.parseCombinations = function parseCombinations(c
|
|
|
45
45
|
var values = R.path([concept, 'values'], indexedDimensions);
|
|
46
46
|
relationship = R.length(values) > 1 ? R.append(concept, relationship) : relationship;
|
|
47
47
|
ids = (0, _extends4.default)({}, ids, (0, _defineProperty3.default)({}, concept, concept));
|
|
48
|
-
|
|
49
|
-
displayable_values_count = R.pathOr(true, [concept, 'display'], indexedDimensions) ? displayable_values_count + R.length(_displayableValues) : displayable_values_count;
|
|
48
|
+
displayable_values_count += R.length(values);
|
|
50
49
|
return R.length(values) > 1;
|
|
51
50
|
} else if (!R.has(concept, indexedAttributes)) {
|
|
52
51
|
return false;
|
|
53
52
|
}
|
|
54
53
|
var attribute = R.prop(concept, indexedAttributes);
|
|
55
|
-
|
|
54
|
+
var displayableValues = getDisplayableValues(attribute.values || []);
|
|
55
|
+
var isDisplayable = R.length(displayableValues) !== 0 && R.propOr(true, 'display', attribute);
|
|
56
|
+
relationship = attribute.series && isDisplayable ? R.pipe(R.reject(function (id) {
|
|
56
57
|
return R.has(id, ids);
|
|
57
58
|
}), R.concat(relationship))(attribute.relationship) : relationship;
|
|
58
59
|
ids = attribute.series ? (0, _extends4.default)({}, ids, R.indexBy(R.identity, attribute.relationship)) : ids;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return attribute.series;
|
|
60
|
+
displayable_values_count = isDisplayable ? displayable_values_count + R.length(displayableValues) : displayable_values_count;
|
|
61
|
+
return attribute.series && isDisplayable;
|
|
62
62
|
}, comb.concepts);
|
|
63
63
|
if (R.isEmpty(seriesConcepts)) {
|
|
64
64
|
return R.append((0, _extends4.default)({}, comb, { header: true, display: displayable_values_count > 0 }), acc);
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ const parseAttributesValues = (obs, attributes, indexedDimensions) => {
|
|
|
23
23
|
let value = R.isNil(_value)
|
|
24
24
|
? _value
|
|
25
25
|
: R.over(R.lensProp('display'), (display=true) => display && !R.includes(_value.id, REJECTED_VALUE_IDS))(_value);
|
|
26
|
-
if ((!R.propOr(true, 'display', attribute) || !R.propOr(true, 'display', value))
|
|
26
|
+
if ((!R.propOr(true, 'display', attribute) || !R.propOr(true, 'display', value))) {
|
|
27
27
|
value = null;
|
|
28
28
|
}
|
|
29
29
|
const relationship = R.propOr([], 'relationship', attribute);
|
|
@@ -10,7 +10,7 @@ export const getHeaderCombinations = (combinations, dimensions, attributes, disp
|
|
|
10
10
|
return acc;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const header = dimensionValueDisplay(display)(comb)
|
|
13
|
+
const header = `${dimensionValueDisplay(display)(comb)}:`;
|
|
14
14
|
|
|
15
15
|
const combinedDisplay = (_display, values) => {
|
|
16
16
|
if (_display === 'label') {
|
|
@@ -24,28 +24,26 @@ export const parseCombinations = (combinations, parsedAttributes, dimensions) =>
|
|
|
24
24
|
const values = R.path([concept, 'values'], indexedDimensions);
|
|
25
25
|
relationship = R.length(values) > 1 ? R.append(concept, relationship) : relationship;
|
|
26
26
|
ids = { ...ids, [concept]: concept };
|
|
27
|
-
|
|
28
|
-
displayable_values_count = R.pathOr(true, [concept, 'display'], indexedDimensions)
|
|
29
|
-
? displayable_values_count + R.length(displayableValues)
|
|
30
|
-
: displayable_values_count;
|
|
27
|
+
displayable_values_count += R.length(values);
|
|
31
28
|
return R.length(values) > 1;
|
|
32
29
|
}
|
|
33
30
|
else if (!R.has(concept, indexedAttributes)) {
|
|
34
31
|
return false;
|
|
35
32
|
}
|
|
36
33
|
const attribute = R.prop(concept, indexedAttributes);
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const displayableValues = getDisplayableValues(attribute.values || []);
|
|
35
|
+
const isDisplayable = R.length(displayableValues) !== 0 && R.propOr(true, 'display', attribute);
|
|
36
|
+
relationship = attribute.series && isDisplayable
|
|
37
|
+
? R.pipe(
|
|
39
38
|
R.reject(id => R.has(id, ids)),
|
|
40
39
|
R.concat(relationship),
|
|
41
40
|
)(attribute.relationship)
|
|
42
|
-
|
|
41
|
+
: relationship;
|
|
43
42
|
ids = attribute.series ? { ...ids, ...R.indexBy(R.identity, attribute.relationship) } : ids;
|
|
44
|
-
|
|
45
|
-
displayable_values_count = R.propOr(true, 'display', attribute)
|
|
43
|
+
displayable_values_count = isDisplayable
|
|
46
44
|
? displayable_values_count + R.length(displayableValues)
|
|
47
45
|
: displayable_values_count;
|
|
48
|
-
return attribute.series;
|
|
46
|
+
return attribute.series && isDisplayable;
|
|
49
47
|
},
|
|
50
48
|
comb.concepts
|
|
51
49
|
);
|
|
@@ -245,9 +245,9 @@ describe('enhanceObservations tests', () => {
|
|
|
245
245
|
A1: { id: 'A1', display: false, value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
246
246
|
A2: { id: 'A2', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
247
247
|
A3: { id: 'A3', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
248
|
-
A4: { id: 'A4', display: false, value:
|
|
249
|
-
A5: { id: 'A5', value:
|
|
250
|
-
A6: { id: 'A6', value:
|
|
248
|
+
A4: { id: 'A4', display: false, value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
249
|
+
A5: { id: 'A5', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
250
|
+
A6: { id: 'A6', value: null, relationship: [], serieKey: null, coordinates: {}, isObs: true },
|
|
251
251
|
},
|
|
252
252
|
indexedDimValIds: {}
|
|
253
253
|
}
|
|
@@ -20,7 +20,7 @@ describe('getHeaderCombinations tests', () => {
|
|
|
20
20
|
];
|
|
21
21
|
|
|
22
22
|
expect(getHeaderCombinations(combinations, dimensions, attributes, 'label')).to.deep.equal([
|
|
23
|
-
{ header: 'comb 1', label: 'dim 1 value' }
|
|
23
|
+
{ header: 'comb 1:', label: 'dim 1 value' }
|
|
24
24
|
]);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -9,7 +9,11 @@ describe('parseCombinations tests', () => {
|
|
|
9
9
|
{ id: 'COMB3', concepts: ['ATTR1', 'ATTR2'] },
|
|
10
10
|
{ id: 'COMB4', concepts: ['ATTR3', 'ATTR4'] },
|
|
11
11
|
{ id: 'COMB5', concepts: ['DIM1', 'ATTR4'] },
|
|
12
|
-
{ id: 'COMB6', concepts: ['DIM5', 'ATTR5'] }
|
|
12
|
+
{ id: 'COMB6', concepts: ['DIM5', 'ATTR5'] },
|
|
13
|
+
{ id: 'COMB7', concepts: ['ATTR5', 'ATTR6'] },
|
|
14
|
+
{ id: 'COMB8', concepts: ['DIM5', 'DIM6'] },
|
|
15
|
+
{ id: 'COMB9', concepts: ['DIM1', 'ATTR5'] },
|
|
16
|
+
{ id: 'COMB10', concepts: ['DIM4', 'ATTR5'] }
|
|
13
17
|
];
|
|
14
18
|
|
|
15
19
|
const dimensions = [
|
|
@@ -18,6 +22,7 @@ describe('parseCombinations tests', () => {
|
|
|
18
22
|
{ id: 'DIM3', values: [{ id: 'v1' }, { id: 'v2' }] },
|
|
19
23
|
{ id: 'DIM4', values: [{ id: 'v1' }, { id: 'v2' }] },
|
|
20
24
|
{ id: 'DIM5', values: [{ id: '_Z' }, { id: 'v2', display: false }] },
|
|
25
|
+
{ id: 'DIM6', values: [{ id: 'v1', display: false }, { id: 'v2', display: false }] }
|
|
21
26
|
];
|
|
22
27
|
|
|
23
28
|
const attributes = [
|
|
@@ -26,6 +31,7 @@ describe('parseCombinations tests', () => {
|
|
|
26
31
|
{ id: 'ATTR3', header: true, relationship: [], values: [{ id: 'v' }] },
|
|
27
32
|
{ id: 'ATTR4', series: true, relationship: ['DIM3', 'DIM4'], values: [{ id: 'v' }] },
|
|
28
33
|
{ id: 'ATTR5', series: true, display: false, relationship: ['DIM5'], values: [{ id: 'v' }] },
|
|
34
|
+
{ id: 'ATTR6', series: true, relationship: [], values: [{ id: '0', display: false }, { id: '_Z' }] }
|
|
29
35
|
];
|
|
30
36
|
|
|
31
37
|
expect(parseCombinations(combinations, attributes, dimensions)).to.deep.equal([
|
|
@@ -34,7 +40,11 @@ describe('parseCombinations tests', () => {
|
|
|
34
40
|
{ id: 'COMB3', concepts: ['ATTR1', 'ATTR2'], header: true, display: true },
|
|
35
41
|
{ id: 'COMB4', concepts: ['ATTR3', 'ATTR4'], series: true, relationship: ['DIM3', 'DIM4'], display: true },
|
|
36
42
|
{ id: 'COMB5', concepts: ['DIM1', 'ATTR4'], series: true, relationship: ['DIM3', 'DIM4'], display: true },
|
|
37
|
-
{ id: 'COMB6', concepts: ['DIM5', 'ATTR5'], series: true, relationship: ['DIM5'], display:
|
|
43
|
+
{ id: 'COMB6', concepts: ['DIM5', 'ATTR5'], series: true, relationship: ['DIM5'], display: true },
|
|
44
|
+
{ id: 'COMB7', concepts: ['ATTR5', 'ATTR6'], header: true, display: false },
|
|
45
|
+
{ id: 'COMB8', concepts: ['DIM5', 'DIM6'], series: true, relationship: ['DIM5', 'DIM6'], display: true },
|
|
46
|
+
{ id: 'COMB9', concepts: ['DIM1', 'ATTR5'], header: true, display: true },
|
|
47
|
+
{ id: 'COMB10', concepts: ['DIM4', 'ATTR5'], series: true, relationship: ['DIM4'], display: true }
|
|
38
48
|
]);
|
|
39
49
|
});
|
|
40
50
|
});
|