@sis-cc/dotstatsuite-components 16.4.0 → 16.6.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/getHeaderCoordinates.js +18 -0
- package/lib/rules2/src/index.js +9 -0
- package/lib/rules2/src/parseCombinations.js +6 -6
- package/lib/rules2/src/prepareData.js +5 -1
- package/lib/rules2/src/table/getFlagsAndNotes.js +1 -1
- package/lib/rules2/src/table/getLayoutData.js +21 -23
- package/lib/rules2/src/table/getTableProps.js +3 -2
- package/lib/rules2/src/utils.js +22 -1
- package/package.json +1 -1
- package/src/rules2/src/enhanceObservations.js +1 -1
- package/src/rules2/src/getHeaderCoordinates.js +7 -0
- package/src/rules2/src/index.js +1 -0
- package/src/rules2/src/parseCombinations.js +8 -10
- package/src/rules2/src/prepareData.js +4 -1
- package/src/rules2/src/table/getFlagsAndNotes.js +1 -1
- package/src/rules2/src/table/getLayoutData.js +18 -17
- package/src/rules2/src/table/getTableProps.js +3 -2
- package/src/rules2/src/utils.js +18 -0
- package/test/enhanceObservations2.test.js +3 -3
- package/test/getCells.test.js +1 -1
- package/test/getLayoutData.test.js +99 -0
- 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);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getHeaderCoordinates = undefined;
|
|
7
|
+
|
|
8
|
+
var _ramda = require('ramda');
|
|
9
|
+
|
|
10
|
+
var R = _interopRequireWildcard(_ramda);
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
13
|
+
|
|
14
|
+
var getHeaderCoordinates = exports.getHeaderCoordinates = function getHeaderCoordinates(oneValueDimensions) {
|
|
15
|
+
return R.reduce(function (acc, dim) {
|
|
16
|
+
return R.assoc(dim.id, R.path(['values', 0, 'id'], dim), acc);
|
|
17
|
+
}, {}, oneValueDimensions);
|
|
18
|
+
};
|
package/lib/rules2/src/index.js
CHANGED
|
@@ -265,6 +265,15 @@ Object.defineProperty(exports, 'getHeaderCombinations', {
|
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
267
|
|
|
268
|
+
var _getHeaderCoordinates = require('./getHeaderCoordinates');
|
|
269
|
+
|
|
270
|
+
Object.defineProperty(exports, 'getHeaderCoordinates', {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function get() {
|
|
273
|
+
return _getHeaderCoordinates.getHeaderCoordinates;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
|
|
268
277
|
var _getLayout = require('./table/getLayout');
|
|
269
278
|
|
|
270
279
|
Object.defineProperty(exports, 'getLayout', {
|
|
@@ -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);
|
|
@@ -43,6 +43,8 @@ var _getHeaderSubtitle = require('./getHeaderSubtitle');
|
|
|
43
43
|
|
|
44
44
|
var _getHeaderCombinations = require('./getHeaderCombinations');
|
|
45
45
|
|
|
46
|
+
var _getHeaderCoordinates = require('./getHeaderCoordinates');
|
|
47
|
+
|
|
46
48
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
47
49
|
|
|
48
50
|
var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
|
|
@@ -75,6 +77,7 @@ var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
|
|
|
75
77
|
var attributesSeries = (0, _getAttributesSeries.getAttributesSeries)(enhancedObservations);
|
|
76
78
|
var manyValuesDimensions = (0, _getManyValuesDimensions.getManyValuesDimensions)(dimensions, attributesSeries, customAttributes, seriesCombinations);
|
|
77
79
|
var oneValueDimensions = (0, _getOneValueDimensions.getOneValueDimensions)(dimensions, parsedAttributes);
|
|
80
|
+
var headerCoordinates = (0, _getHeaderCoordinates.getHeaderCoordinates)(oneValueDimensions);
|
|
78
81
|
var hierarchisedDimensions = R.map(function (dim) {
|
|
79
82
|
if (R.isEmpty(R.propOr({}, dim.id, hierarchies))) {
|
|
80
83
|
return (0, _hierarchiseDimensionWithNativeHierarchy.hierarchiseDimensionWithNativeHierarchy)(dim);
|
|
@@ -99,7 +102,8 @@ var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
|
|
|
99
102
|
header: {
|
|
100
103
|
title: headerTitle,
|
|
101
104
|
subtitle: headerSubtitle,
|
|
102
|
-
combinations: headerCombinations
|
|
105
|
+
combinations: headerCombinations,
|
|
106
|
+
coordinates: headerCoordinates
|
|
103
107
|
}
|
|
104
108
|
};
|
|
105
109
|
};
|
|
@@ -21,7 +21,7 @@ var getFlagsAndNotes = exports.getFlagsAndNotes = function getFlagsAndNotes(attr
|
|
|
21
21
|
if (!R.has(id, attributesValues)) {
|
|
22
22
|
return acc;
|
|
23
23
|
}
|
|
24
|
-
var attr = R.prop(id, attributesValues);
|
|
24
|
+
var attr = R.pick(['id', 'name', 'value', 'display'], R.prop(id, attributesValues));
|
|
25
25
|
if (R.isNil(attr.value) || !R.pathOr(true, ['value', 'display'], attr) || !R.propOr(true, 'display', attr) || R.includes(R.path(['value', 'id'], attr), _constants.REJECTED_VALUE_IDS)) {
|
|
26
26
|
return acc;
|
|
27
27
|
}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getLayoutData = undefined;
|
|
7
7
|
|
|
8
|
-
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
9
|
-
|
|
10
|
-
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
11
|
-
|
|
12
8
|
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
|
|
13
9
|
|
|
14
10
|
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
|
|
15
11
|
|
|
12
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
15
|
+
|
|
16
16
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
17
17
|
|
|
18
18
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
@@ -23,13 +23,11 @@ var R = _interopRequireWildcard(_ramda);
|
|
|
23
23
|
|
|
24
24
|
var _getFlagsAndNotes = require('./getFlagsAndNotes');
|
|
25
25
|
|
|
26
|
-
var _hasCellMetadata = require('../hasCellMetadata');
|
|
27
|
-
|
|
28
26
|
var _getCombinationDimensionsData = require('./getCombinationDimensionsData');
|
|
29
27
|
|
|
30
28
|
var _parseValueHierarchy = require('./parseValueHierarchy');
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var _utils = require('../utils');
|
|
33
31
|
|
|
34
32
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
35
33
|
|
|
@@ -117,18 +115,16 @@ var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
|
|
|
117
115
|
i++;
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return isValid ? (0, _extends3.default)({}, acc, R.length(splitKey) === 1 ? R.pick(combinationConceptIds, R.prop(key, attributesSeries)) : R.prop(key, attributesSeries)) : acc;
|
|
131
|
-
}, {}, R.keys(attributesSeries));
|
|
118
|
+
var coordinatesValidator = (0, _utils.getLayoutCoordinatesValidator)(coordinates, topCoordinates);
|
|
119
|
+
var attributesValues = R.reduce(function (acc, serie) {
|
|
120
|
+
var coordinates = R.path([0, 'coordinates'], R.values(serie));
|
|
121
|
+
var isValid = coordinatesValidator(coordinates);
|
|
122
|
+
if (!isValid) {
|
|
123
|
+
return acc;
|
|
124
|
+
}
|
|
125
|
+
var isSingleBounded = R.length(R.keys(coordinates)) === 1;
|
|
126
|
+
return (0, _extends3.default)({}, acc, isSingleBounded ? R.pick(combinationConceptIds, serie) : serie);
|
|
127
|
+
}, {}, R.values(attributesSeries));
|
|
132
128
|
|
|
133
129
|
data = R.addIndex(R.reduce)(function (acc, entry, ind) {
|
|
134
130
|
if (!R.has('dimValues', entry)) {
|
|
@@ -158,10 +154,10 @@ var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
|
|
|
158
154
|
return R.append({ dimension: dimension, values: values }, acc);
|
|
159
155
|
}, [], data);
|
|
160
156
|
|
|
161
|
-
var layoutAttrValues = R.
|
|
157
|
+
var layoutAttrValues = R.reject(R.prop('isObs'), R.omit(combinationConceptIds, attributesValues));
|
|
162
158
|
|
|
163
159
|
var flags = (0, _getFlagsAndNotes.getFlagsAndNotes)(layoutAttrValues, customAttributes);
|
|
164
|
-
var hasMetadata = (
|
|
160
|
+
var hasMetadata = !R.isNil(R.find(coordinatesValidator, metadataCoordinates));
|
|
165
161
|
|
|
166
162
|
if (!hasAdvancedAttributes) {
|
|
167
163
|
hasAdvancedAttributes = getHasAdvancedAttributes(layoutAttrValues);
|
|
@@ -182,12 +178,14 @@ var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
|
|
|
182
178
|
var getLayoutData = function getLayoutData(layoutIndexes, layout, _ref2) {
|
|
183
179
|
var metadataCoordinates = _ref2.metadataCoordinates,
|
|
184
180
|
attributesSeries = _ref2.attributesSeries,
|
|
185
|
-
customAttributes = _ref2.customAttributes
|
|
181
|
+
customAttributes = _ref2.customAttributes,
|
|
182
|
+
_ref2$topCoordinates = _ref2.topCoordinates,
|
|
183
|
+
topCoordinates = _ref2$topCoordinates === undefined ? {} : _ref2$topCoordinates;
|
|
186
184
|
var header = layoutIndexes.header,
|
|
187
185
|
sections = layoutIndexes.sections,
|
|
188
186
|
rest = (0, _objectWithoutProperties3.default)(layoutIndexes, ['header', 'sections']);
|
|
189
187
|
|
|
190
|
-
var opts = { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes };
|
|
188
|
+
var opts = { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes, topCoordinates: topCoordinates };
|
|
191
189
|
var headerData = getSubLayoutData(header, layout.header, opts);
|
|
192
190
|
var sectionsData = R.pipe(R.transpose, function (_ref3) {
|
|
193
191
|
var _ref4 = (0, _slicedToArray3.default)(_ref3, 2),
|
|
@@ -47,14 +47,15 @@ var getTableProps = exports.getTableProps = function getTableProps(_ref) {
|
|
|
47
47
|
oneValueDimensions = data.oneValueDimensions,
|
|
48
48
|
attributesSeries = data.attributesSeries,
|
|
49
49
|
metadataCoordinates = data.metadataCoordinates,
|
|
50
|
-
attributes = data.attributes
|
|
50
|
+
attributes = data.attributes,
|
|
51
|
+
header = data.header;
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
var seriesCombinations = (0, _getSeriesCombinations.getSeriesCombinations)(combinations, oneValueDimensions);
|
|
54
55
|
var layout = (0, _getLayout.getLayout)(layoutIds, dimensions, seriesCombinations, isTimeInverted);
|
|
55
56
|
var layoutIndexes = (0, _getSortedLayoutIndexes.getSortedLayoutIndexes)(layout, observations);
|
|
56
57
|
var refinedLayoutIndexes = (0, _refineLayoutSize.refineLayoutSize)({ layout: layout, observations: observations, limit: limit })(layoutIndexes);
|
|
57
|
-
var layoutData = (0, _getLayoutData.getLayoutData)(refinedLayoutIndexes, layout, { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes });
|
|
58
|
+
var layoutData = (0, _getLayoutData.getLayoutData)(refinedLayoutIndexes, layout, { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes, topCoordinates: header.coordinates });
|
|
58
59
|
|
|
59
60
|
var cellsAttributesIds = (0, _getCellsAttributesIds.getCellsAttributesIds)(layoutIds, attributes);
|
|
60
61
|
var indexedCombinations = (0, _getIndexedCombinationsByDisplay.getIndexedCombinationsByDisplay)(layout, seriesCombinations);
|
package/lib/rules2/src/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.trimedProps = undefined;
|
|
6
|
+
exports.getLayoutCoordinatesValidator = exports.trimedProps = undefined;
|
|
7
7
|
|
|
8
8
|
var _ramda = require('ramda');
|
|
9
9
|
|
|
@@ -18,4 +18,25 @@ var trimedProps = exports.trimedProps = function trimedProps(properties, obj) {
|
|
|
18
18
|
}
|
|
19
19
|
return R.append(obj[prop], acc);
|
|
20
20
|
}, [], properties);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var getLayoutCoordinatesValidator = exports.getLayoutCoordinatesValidator = function getLayoutCoordinatesValidator(layoutCoordinates) {
|
|
24
|
+
var topCoordinates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
|
+
return function (coordinates) {
|
|
26
|
+
if (R.isEmpty(coordinates)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
var keys = R.keys(coordinates);
|
|
30
|
+
var res = true;
|
|
31
|
+
var notInTop = {};
|
|
32
|
+
R.forEach(function (key) {
|
|
33
|
+
if (R.prop(key, layoutCoordinates) !== R.prop(key, coordinates)) {
|
|
34
|
+
res = false;
|
|
35
|
+
}
|
|
36
|
+
if (!R.has(key, topCoordinates)) {
|
|
37
|
+
notInTop[key] = key;
|
|
38
|
+
}
|
|
39
|
+
}, keys);
|
|
40
|
+
return res && !R.isEmpty(notInTop);
|
|
41
|
+
};
|
|
21
42
|
};
|
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);
|
package/src/rules2/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { getHeaderTitle } from './getHeaderTitle';
|
|
|
30
30
|
export { getHeaderSubtitle } from './getHeaderSubtitle';
|
|
31
31
|
export { getSeriesCombinations } from './getSeriesCombinations';
|
|
32
32
|
export { getHeaderCombinations } from './getHeaderCombinations';
|
|
33
|
+
export { getHeaderCoordinates } from './getHeaderCoordinates';
|
|
33
34
|
export { getLayout } from './table/getLayout';
|
|
34
35
|
export { getSortedLayoutIndexes } from './table/getSortedLayoutIndexes';
|
|
35
36
|
export { refineLayoutSize } from './table/refineLayoutSize';
|
|
@@ -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
|
);
|
|
@@ -16,6 +16,7 @@ import { getDataflowAttributes } from './getDataflowAttributes';
|
|
|
16
16
|
import { getHeaderTitle } from './getHeaderTitle';
|
|
17
17
|
import { getHeaderSubtitle } from './getHeaderSubtitle';
|
|
18
18
|
import { getHeaderCombinations } from './getHeaderCombinations';
|
|
19
|
+
import { getHeaderCoordinates } from './getHeaderCoordinates';
|
|
19
20
|
|
|
20
21
|
export const prepareData = (sdmxJson, { customAttributes, locale, hierarchies, dataflow, display, defaultCombinations }) => {
|
|
21
22
|
const dimensions = R.pathOr([], ['data', 'structure', 'dimensions', 'observation'], sdmxJson);
|
|
@@ -38,6 +39,7 @@ export const prepareData = (sdmxJson, { customAttributes, locale, hierarchies, d
|
|
|
38
39
|
const attributesSeries = getAttributesSeries(enhancedObservations);
|
|
39
40
|
const manyValuesDimensions = getManyValuesDimensions(dimensions, attributesSeries, customAttributes, seriesCombinations);
|
|
40
41
|
const oneValueDimensions = getOneValueDimensions(dimensions, parsedAttributes);
|
|
42
|
+
const headerCoordinates = getHeaderCoordinates(oneValueDimensions);
|
|
41
43
|
const hierarchisedDimensions = R.map(dim => {
|
|
42
44
|
if (R.isEmpty(R.propOr({}, dim.id, hierarchies))) {
|
|
43
45
|
return hierarchiseDimensionWithNativeHierarchy(dim);
|
|
@@ -62,7 +64,8 @@ export const prepareData = (sdmxJson, { customAttributes, locale, hierarchies, d
|
|
|
62
64
|
header: {
|
|
63
65
|
title: headerTitle,
|
|
64
66
|
subtitle: headerSubtitle,
|
|
65
|
-
combinations: headerCombinations
|
|
67
|
+
combinations: headerCombinations,
|
|
68
|
+
coordinates: headerCoordinates
|
|
66
69
|
}
|
|
67
70
|
});
|
|
68
71
|
};
|
|
@@ -10,7 +10,7 @@ export const getFlagsAndNotes = (attributesValues, customAttributes) => {
|
|
|
10
10
|
if (!R.has(id, attributesValues)) {
|
|
11
11
|
return acc;
|
|
12
12
|
}
|
|
13
|
-
const attr = R.prop(id, attributesValues);
|
|
13
|
+
const attr = R.pick(['id', 'name', 'value', 'display'], R.prop(id, attributesValues));
|
|
14
14
|
if (R.isNil(attr.value) || !R.pathOr(true, ['value', 'display'], attr) || !R.propOr(true, 'display', attr)
|
|
15
15
|
|| R.includes(R.path(['value', 'id'], attr), REJECTED_VALUE_IDS)) {
|
|
16
16
|
return acc;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as R from 'ramda';
|
|
2
2
|
import { getFlagsAndNotes } from './getFlagsAndNotes';
|
|
3
|
-
import { hasCellMetadata } from '../hasCellMetadata';
|
|
4
3
|
import { getCombinationDimensionsData } from './getCombinationDimensionsData';
|
|
5
4
|
import { parseValueHierarchy } from './parseValueHierarchy';
|
|
6
|
-
import {
|
|
5
|
+
import { getLayoutCoordinatesValidator } from '../utils';
|
|
7
6
|
|
|
8
7
|
const getSubLayoutData = (series, _definition, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates={} }) => {
|
|
9
8
|
const getHasAdvancedAttributes = (attrValues) => R.pipe(
|
|
@@ -94,17 +93,19 @@ const getSubLayoutData = (series, _definition, { metadataCoordinates, attributes
|
|
|
94
93
|
i++;
|
|
95
94
|
}
|
|
96
95
|
|
|
96
|
+
const coordinatesValidator = getLayoutCoordinatesValidator(coordinates, topCoordinates);
|
|
97
97
|
const attributesValues = R.reduce(
|
|
98
|
-
(acc,
|
|
99
|
-
const
|
|
100
|
-
const isValid =
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
|
|
98
|
+
(acc, serie) => {
|
|
99
|
+
const coordinates = R.path([0, 'coordinates'], R.values(serie));
|
|
100
|
+
const isValid = coordinatesValidator(coordinates);
|
|
101
|
+
if (!isValid) {
|
|
102
|
+
return acc;
|
|
103
|
+
}
|
|
104
|
+
const isSingleBounded = R.length(R.keys(coordinates)) === 1;
|
|
105
|
+
return ({ ...acc, ...(isSingleBounded ? R.pick(combinationConceptIds, serie) : serie) });
|
|
105
106
|
},
|
|
106
107
|
{},
|
|
107
|
-
R.
|
|
108
|
+
R.values(attributesSeries)
|
|
108
109
|
);
|
|
109
110
|
|
|
110
111
|
data = R.addIndex(R.reduce)(
|
|
@@ -141,13 +142,13 @@ const getSubLayoutData = (series, _definition, { metadataCoordinates, attributes
|
|
|
141
142
|
data
|
|
142
143
|
);
|
|
143
144
|
|
|
144
|
-
const layoutAttrValues = R.
|
|
145
|
-
R.
|
|
146
|
-
R.
|
|
147
|
-
)
|
|
145
|
+
const layoutAttrValues = R.reject(
|
|
146
|
+
R.prop('isObs'),
|
|
147
|
+
R.omit(combinationConceptIds, attributesValues)
|
|
148
|
+
);
|
|
148
149
|
|
|
149
150
|
const flags = getFlagsAndNotes(layoutAttrValues, customAttributes);
|
|
150
|
-
const hasMetadata =
|
|
151
|
+
const hasMetadata = !R.isNil(R.find(coordinatesValidator, metadataCoordinates));
|
|
151
152
|
|
|
152
153
|
if (!hasAdvancedAttributes) {
|
|
153
154
|
hasAdvancedAttributes = getHasAdvancedAttributes(layoutAttrValues);
|
|
@@ -168,9 +169,9 @@ const getSubLayoutData = (series, _definition, { metadataCoordinates, attributes
|
|
|
168
169
|
return res;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
export const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes }) => {
|
|
172
|
+
export const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates={} }) => {
|
|
172
173
|
const { header, sections, ...rest } = layoutIndexes;
|
|
173
|
-
const opts = { metadataCoordinates, attributesSeries, customAttributes };
|
|
174
|
+
const opts = { metadataCoordinates, attributesSeries, customAttributes, topCoordinates };
|
|
174
175
|
const headerData = getSubLayoutData(header, layout.header, opts);
|
|
175
176
|
const sectionsData = R.pipe(
|
|
176
177
|
R.transpose,
|
|
@@ -17,14 +17,15 @@ export const getTableProps = ({ data, layoutIds, customAttributes, limit, isTime
|
|
|
17
17
|
oneValueDimensions,
|
|
18
18
|
attributesSeries,
|
|
19
19
|
metadataCoordinates,
|
|
20
|
-
attributes
|
|
20
|
+
attributes,
|
|
21
|
+
header
|
|
21
22
|
} = data;
|
|
22
23
|
|
|
23
24
|
const seriesCombinations = getSeriesCombinations(combinations, oneValueDimensions);
|
|
24
25
|
const layout = getLayout(layoutIds, dimensions, seriesCombinations, isTimeInverted);
|
|
25
26
|
const layoutIndexes = getSortedLayoutIndexes(layout, observations);
|
|
26
27
|
const refinedLayoutIndexes = refineLayoutSize({ layout, observations, limit })(layoutIndexes);
|
|
27
|
-
const layoutData = getLayoutData(refinedLayoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes });
|
|
28
|
+
const layoutData = getLayoutData(refinedLayoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates: header.coordinates });
|
|
28
29
|
|
|
29
30
|
const cellsAttributesIds = getCellsAttributesIds(layoutIds, attributes);
|
|
30
31
|
const indexedCombinations = getIndexedCombinationsByDisplay(layout, seriesCombinations);
|
package/src/rules2/src/utils.js
CHANGED
|
@@ -10,3 +10,21 @@ export const trimedProps = (properties, obj) => R.reduce(
|
|
|
10
10
|
[],
|
|
11
11
|
properties,
|
|
12
12
|
);
|
|
13
|
+
|
|
14
|
+
export const getLayoutCoordinatesValidator = (layoutCoordinates, topCoordinates={}) => (coordinates) => {
|
|
15
|
+
if (R.isEmpty(coordinates)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const keys = R.keys(coordinates);
|
|
19
|
+
let res = true;
|
|
20
|
+
let notInTop = {};
|
|
21
|
+
R.forEach(key => {
|
|
22
|
+
if (R.prop(key, layoutCoordinates) !== R.prop(key, coordinates)) {
|
|
23
|
+
res = false;
|
|
24
|
+
}
|
|
25
|
+
if (!R.has(key, topCoordinates)) {
|
|
26
|
+
notInTop[key] = key;
|
|
27
|
+
}
|
|
28
|
+
}, keys);
|
|
29
|
+
return res && !R.isEmpty(notInTop);
|
|
30
|
+
};
|
|
@@ -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
|
}
|
package/test/getCells.test.js
CHANGED
|
@@ -72,7 +72,7 @@ describe('getCells tests', () => {
|
|
|
72
72
|
flags: [
|
|
73
73
|
{ code: 'A', id: 'FL1', value: { id: 'A' } }, // regular flag
|
|
74
74
|
{ id: 'FT1', value: { id: 'V' } }, // regular foot note
|
|
75
|
-
{ id: 'A3', value: { id: 'A3V' }
|
|
75
|
+
{ id: 'A3', value: { id: 'A3V' } }, // rejected layout combination value displayed as a footnote
|
|
76
76
|
{ id: 'CELLS_COMB', values: [{ id: 'D1V' }, { id: 'A1V' }] } // cell level combination with fixed dim value
|
|
77
77
|
]
|
|
78
78
|
}
|
|
@@ -182,4 +182,103 @@ describe('getLayoutData tests', () => {
|
|
|
182
182
|
]
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
+
it('flags, advanced attributes and metadata availability', () => {
|
|
186
|
+
const customAttributes = { flags: ['FL'], notes: ['FT'] };
|
|
187
|
+
const topCoordinates = { FREQ: 'A' };
|
|
188
|
+
const layout = {
|
|
189
|
+
header: [
|
|
190
|
+
{ id: 'TIME_PERIOD', values: [{ id: '2020' }, { id: '2021' }] }
|
|
191
|
+
],
|
|
192
|
+
sections: [
|
|
193
|
+
{ id: 'TRANSACT', values: [{ id: 'TRANSACT1' }, { id: 'TRANSACT2' }] }
|
|
194
|
+
],
|
|
195
|
+
rows: [
|
|
196
|
+
{ id: 'REF_AREA', values: [{ id: 'US' }, { id: 'AUS' }, { id: 'FRA' }] },
|
|
197
|
+
{ id: 'COMB_UNIT', concepts: ['TRANSACT', "MEASURE", 'UNIT_MULT'], dimensions: [{ id: 'MEASURE', values: [{ id: 'USD' }, { id: 'AUSD' }, { id: 'EUR' }] }] }
|
|
198
|
+
]
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const metadataCoordinates = [
|
|
202
|
+
{},
|
|
203
|
+
{ TIME_PERIOD: '2021', FREQ: 'A' },
|
|
204
|
+
{ TRANSACT: 'TRANSACT1' },
|
|
205
|
+
{ TRANSACT: 'TRANSACT2', REF_AREA: 'AUS', FREQ: 'A' }
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
const attributesSeries = {
|
|
209
|
+
'TIME_PERIOD=2020:FREQ=A': {
|
|
210
|
+
FL: { id: 'FL', serieKey: 'TIME_PERIOD=2020:FREQ=A', coordinates: { TIME_PERIOD: '2020', FREQ: 'A' }, value: { id: 'FL_V' } },
|
|
211
|
+
FT: { id: 'FT', serieKey: 'TIME_PERIOD=2020:FREQ=A', coordinates: { TIME_PERIOD: '2020', FREQ: 'A' }, value: { id: 'FT_V0' } }
|
|
212
|
+
},
|
|
213
|
+
'TRANSACT=TRANSACT1:MEASURE=USD': {
|
|
214
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT1:MEASURE=USD', coordinates: { TRANSACT: 'TRANSACT1', MEASURE: 'USD' }, value: { id: 'BILL' } }
|
|
215
|
+
},
|
|
216
|
+
'TRANSACT=TRANSACT1:MEASURE=AUSD': {
|
|
217
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT1:MEASURE=AUSD', coordinates: { TRANSACT: 'TRANSACT1', MEASURE: 'AUSD' }, value: { id: '0' } }
|
|
218
|
+
},
|
|
219
|
+
'TRANSACT=TRANSACT1:MEASURE=EUR': {
|
|
220
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT1:MEASURE=EUR', coordinates: { TRANSACT: 'TRANSACT1', MEASURE: 'EUR' }, value: { id: 'MILL' } }
|
|
221
|
+
},
|
|
222
|
+
'TRANSACT=TRANSACT2:MEASURE=USD': {
|
|
223
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT2:MEASURE=USD', coordinates: { TRANSACT: 'TRANSACT2', MEASURE: 'USD' }, value: { id: 'BILL' } }
|
|
224
|
+
},
|
|
225
|
+
'TRANSACT=TRANSACT2:MEASURE=AUSD': {
|
|
226
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT2:MEASURE=AUSD', coordinates: { TRANSACT: 'TRANSACT2', MEASURE: 'AUSD' }, value: { id: '0' } }
|
|
227
|
+
},
|
|
228
|
+
'TRANSACT=TRANSACT2:MEASURE=EUR': {
|
|
229
|
+
UNIT_MULT: { id: 'UNIT_MULT', serieKey: 'TRANSACT=TRANSACT2:MEASURE=EUR', coordinates: { TRANSACT: 'TRANSACT2', MEASURE: 'EUR' }, value: { id: 'MILL' } }
|
|
230
|
+
},
|
|
231
|
+
'TRANSACT=TRANSACT1:FREQ=A': {
|
|
232
|
+
FT: { id: 'FT', serieKey: 'TRANSACT=TRANSACT1:FREQ=A', coordinates: { TRANSACT: 'TRANSACT1', FREQ: 'A' }, value: { id: 'FT_V1' } },
|
|
233
|
+
ADV: { id: 'ADV', serieKey: 'TRANSACT=TRANSACT1:FREQ=A', coordinates: { TRANSACT: 'TRANSACT1', FREQ: 'A' }, value: { id: 'ADV_V0' } }
|
|
234
|
+
},
|
|
235
|
+
'TRANSACT=TRANSACT2:REF_AREA=FRA': {
|
|
236
|
+
FT: { id: 'FT', serieKey: 'TRANSACT=TRANSACT2:REF_AREA=FRA', coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'FRA' }, value: { id: 'FT_V2' } }
|
|
237
|
+
},
|
|
238
|
+
'TRANSACT=TRANSACT2:MEASURE=USD:FREQ=A': {
|
|
239
|
+
ADV: { id: 'ADV', serieKey: 'TRANSACT=TRANSACT2:MEASURE=USD:FREQ=A', coordinates: { TRANSACT: 'TRANSACT2', MEASURE: 'USD', FREQ: 'A' }, value: { id: 'ADV_V1' } }
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const layoutIndexes = {
|
|
244
|
+
header: [[0], [1]],
|
|
245
|
+
sections: [
|
|
246
|
+
[
|
|
247
|
+
[0],
|
|
248
|
+
[[0, [0]], [1, [1]], [2, [2]]],
|
|
249
|
+
],
|
|
250
|
+
[
|
|
251
|
+
[1],
|
|
252
|
+
[[0, [0]], [1, [1]], [2, [2]]],
|
|
253
|
+
]
|
|
254
|
+
]
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const layoutData = {
|
|
258
|
+
headerData: [
|
|
259
|
+
{ data: [{ dimension: { id: 'TIME_PERIOD' }, value: { id: '2020' } }], flags: [{ id: 'FL', code: 'FL_V', value: { id: 'FL_V' } }, { id: 'FT', value: { id: 'FT_V0' } }], key: 'TIME_PERIOD=2020', sideProps: null, coordinates: { TIME_PERIOD: '2020', FREQ: 'A' } },
|
|
260
|
+
{ data: [{ dimension: { id: 'TIME_PERIOD' }, value: { id: '2021' } }], flags: [], key: 'TIME_PERIOD=2021', sideProps: { hasMetadata: true, hasAdvancedAttributes: false, coordinates: { TIME_PERIOD: '2021', FREQ: 'A' } }, coordinates: { TIME_PERIOD: '2021', FREQ: 'A' } },
|
|
261
|
+
],
|
|
262
|
+
sectionsData: [
|
|
263
|
+
[
|
|
264
|
+
{ data: [{ dimension: { id: 'TRANSACT' }, value: { id: 'TRANSACT1' } }], flags: [{ id: 'FT', value: { id: 'FT_V1' } }], key: 'TRANSACT=TRANSACT1', sideProps: { hasAdvancedAttributes: true, hasMetadata: true, coordinates: { TRANSACT: 'TRANSACT1', FREQ: 'A' } }, coordinates: { TRANSACT: 'TRANSACT1', FREQ: 'A' } },
|
|
265
|
+
[
|
|
266
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'US' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'USD', display: true }, { id: 'BILL' }] }], flags: [], key: 'REF_AREA=US:MEASURE=USD', sideProps: null, coordinates: { TRANSACT: 'TRANSACT1', REF_AREA: 'US', MEASURE: 'USD', FREQ: 'A' } },
|
|
267
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'AUS' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'AUSD', display: true }, { id: '0' }] }], flags: [], key: 'REF_AREA=AUS:MEASURE=AUSD', sideProps: null, coordinates: { TRANSACT: 'TRANSACT1', REF_AREA: 'AUS', MEASURE: 'AUSD', FREQ: 'A' } },
|
|
268
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'FRA' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'EUR', display: true }, { id: 'MILL' }] }], flags: [], key: 'REF_AREA=FRA:MEASURE=EUR', sideProps: null, coordinates: { TRANSACT: 'TRANSACT1', REF_AREA: 'FRA', MEASURE: 'EUR', FREQ: 'A' } },
|
|
269
|
+
]
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
{ data: [{ dimension: { id: 'TRANSACT' }, value: { id: 'TRANSACT2' } }], flags: [], key: 'TRANSACT=TRANSACT2', sideProps: null, coordinates: { TRANSACT: 'TRANSACT2', FREQ: 'A' } },
|
|
273
|
+
[
|
|
274
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'US' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'USD', display: true }, { id: 'BILL' }] }], flags: [], key: 'REF_AREA=US:MEASURE=USD', sideProps: { hasAdvancedAttributes: true, hasMetadata: false, coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'US', MEASURE: 'USD', FREQ: 'A' } }, coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'US', MEASURE: 'USD', FREQ: 'A' } },
|
|
275
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'AUS' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'AUSD', display: true }, { id: '0' }] }], flags: [], key: 'REF_AREA=AUS:MEASURE=AUSD', sideProps: { hasAdvancedAttributes: false, hasMetadata: true, coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'AUS', MEASURE: 'AUSD', FREQ: 'A' } }, coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'AUS', MEASURE: 'AUSD', FREQ: 'A' } },
|
|
276
|
+
{ data: [{ dimension: { id: 'REF_AREA' }, value: { id: 'FRA' } }, { dimension: { id: 'COMB_UNIT' }, values: [{ id: 'EUR', display: true }, { id: 'MILL' }] }], flags: [{ id: 'FT', value: { id: 'FT_V2' } }], key: 'REF_AREA=FRA:MEASURE=EUR', sideProps: null, coordinates: { TRANSACT: 'TRANSACT2', REF_AREA: 'FRA', MEASURE: 'EUR', FREQ: 'A' } },
|
|
277
|
+
]
|
|
278
|
+
],
|
|
279
|
+
]
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
expect(getLayoutData(layoutIndexes, layout, { attributesSeries, metadataCoordinates, customAttributes, topCoordinates })).to.deep.equal(layoutData);
|
|
283
|
+
});
|
|
185
284
|
});
|
|
@@ -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
|
});
|