@sis-cc/dotstatsuite-components 12.2.1 → 13.0.1
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/rules/src/table/factories/getCells.js +2 -2
- package/lib/rules/src/table/factories/getLayoutWithFlags.js +1 -1
- package/lib/rules/src/table/preparators/parseAttributes.js +1 -1
- package/lib/rules/src/table/preparators/prepareData.js +3 -3
- package/lib/rules/src/v8-transformer.js +8 -1
- package/lib/rules2/src/getDataflowTooltipAttributesIds.js +1 -1
- package/package.json +1 -1
- package/src/rules/src/table/factories/getCells.js +2 -2
- package/src/rules/src/table/factories/getLayoutWithFlags.js +1 -1
- package/src/rules/src/table/preparators/parseAttributes.js +1 -1
- package/src/rules/src/table/preparators/prepareData.js +3 -3
- package/src/rules/src/v8-transformer.js +10 -1
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +1 -1
- package/test/getCells.test.js +1 -1
- package/test/getDataflowTooltipAttributesIds.js +4 -4
- package/test/getLayoutDataWithFlags.test.js +1 -1
- package/test/getSubtitleFlags.test.js +1 -1
|
@@ -36,7 +36,7 @@ var getFlags = exports.getFlags = function getFlags(customAttributesIds, display
|
|
|
36
36
|
|
|
37
37
|
var refinedAttributes = R.omit(R.propOr([], 'rejected', customAttributesIds), attributes);
|
|
38
38
|
var flags = R.pipe(R.pick(R.propOr([], 'flags', customAttributesIds)), R.values)(refinedAttributes);
|
|
39
|
-
var footnotes = R.pipe(R.pick(R.propOr([], '
|
|
39
|
+
var footnotes = R.pipe(R.pick(R.propOr([], 'notes', customAttributesIds)), R.values)(refinedAttributes);
|
|
40
40
|
|
|
41
41
|
var unitsDisplay = R.prop('unitsDisplay', unitsProps);
|
|
42
42
|
var rejectedUnitsValueIds = R.propOr([], 'rejectedValueIds', unitsProps);
|
|
@@ -78,7 +78,7 @@ var getSideProps = function getSideProps(_ref2, customAttributes, metadataCoordi
|
|
|
78
78
|
var attributes = _ref2.attributes,
|
|
79
79
|
indexedDimValIds = _ref2.indexedDimValIds;
|
|
80
80
|
|
|
81
|
-
var rejected = [].concat((0, _toConsumableArray3.default)(customAttributes.flags || []), (0, _toConsumableArray3.default)(customAttributes.
|
|
81
|
+
var rejected = [].concat((0, _toConsumableArray3.default)(customAttributes.flags || []), (0, _toConsumableArray3.default)(customAttributes.notes || []), (0, _toConsumableArray3.default)(customAttributes.rejected || []));
|
|
82
82
|
var advancedAttributes = R.omit(rejected, attributes);
|
|
83
83
|
var hasAdvancedAttributes = !R.isEmpty(advancedAttributes);
|
|
84
84
|
var hasMetadata = (0, _hasCellMetadata.hasCellMetadata)(metadataCoordinates, indexedDimValIds);
|
|
@@ -87,7 +87,7 @@ var getCoordinates = function getCoordinates(data, unitsId) {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
var getLayoutDataWithFlags = exports.getLayoutDataWithFlags = function getLayoutDataWithFlags(seriesAttributes, display, customAttributes, metadataCoordinates, unitsId) {
|
|
90
|
-
var regularAttrsIds = R.concat(customAttributes.flags || [], customAttributes.
|
|
90
|
+
var regularAttrsIds = R.concat(customAttributes.flags || [], customAttributes.notes || []);
|
|
91
91
|
var formatSublayout = function formatSublayout(getAttributes) {
|
|
92
92
|
var mCoordinates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
93
93
|
var supplData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -35,7 +35,7 @@ var getAttributeRegisters = function getAttributeRegisters(attribute, parsedDime
|
|
|
35
35
|
if (R.hasPath(['relationship', 'none'], attribute)) {
|
|
36
36
|
return [registerAttrId(['dataflow'], attribute.id), registerAttr(attribute)];
|
|
37
37
|
}
|
|
38
|
-
if (R.pathEq(['relationship', 'primaryMeasure'], 'OBS_VALUE', attribute)) {
|
|
38
|
+
if (R.pathEq(['relationship', 'primaryMeasure'], 'OBS_VALUE', attribute) || R.hasPath(['relationship', 'observation'], attribute)) {
|
|
39
39
|
return [registerAttrId(['observations'], attribute.id), registerAttr(attribute)];
|
|
40
40
|
}
|
|
41
41
|
var targetDimensions = R.pathOr([], ['relationship', 'dimensions'], attribute);
|
|
@@ -153,18 +153,18 @@ var prepareData = exports.prepareData = function prepareData(sdmxJson, customAtt
|
|
|
153
153
|
var headerAttributesIds = R.concat(attributesIdsIndexedByTargets.dataflow || [], R.pipe(R.values, R.unnest)(attributesIdsIndexedByTargets.oneValueDimensions || {}));
|
|
154
154
|
var headerAttributes = R.pick(headerAttributesIds, attributesIndexedByIds);
|
|
155
155
|
var headerAdvancedAttrIds = R.pipe(R.filter(function (id) {
|
|
156
|
-
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
156
|
+
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || []);
|
|
157
157
|
}))(headerAttributesIds);
|
|
158
158
|
|
|
159
159
|
var dataflowAdvancedAttributes = (0, _getAdvancedAttributes.getDataflowAdvancedAttributes)(headerAttributes, oneValueDimensions, headerAdvancedAttrIds, R.length(dimensions));
|
|
160
160
|
|
|
161
161
|
var observationsAdvancedAttributesIds = R.filter(function (id) {
|
|
162
|
-
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
162
|
+
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || []);
|
|
163
163
|
}, attributesIdsIndexedByTargets.observations || []);
|
|
164
164
|
var observationsAdvancedAttributes = (0, _getAdvancedAttributes.getObservationsAdvancedAttributes)(observations, observationsAdvancedAttributesIds);
|
|
165
165
|
|
|
166
166
|
var seriesAdvancedAttributesIds = R.filter(function (id) {
|
|
167
|
-
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
167
|
+
return !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || []);
|
|
168
168
|
}, R.concat(attributesIdsIndexedByTargets.series || [], attributesIdsIndexedByTargets.manyValuesDimensions || []));
|
|
169
169
|
|
|
170
170
|
var seriesAdvancedAttributes = (0, _getAdvancedAttributes.getSeriesAdvancedAttributes)(seriesAttributesValues, dimensions, seriesAdvancedAttributesIds);
|
|
@@ -113,8 +113,15 @@ var dataTransformer = exports.dataTransformer = function dataTransformer(dataNew
|
|
|
113
113
|
});
|
|
114
114
|
}, attrObservations);
|
|
115
115
|
|
|
116
|
+
var datasetAttributes = R.map(function (attr) {
|
|
117
|
+
return (0, _extends3.default)({}, attr, {
|
|
118
|
+
name: getLocalisedProp('names', observation),
|
|
119
|
+
values: getValues(attr.values || [])
|
|
120
|
+
});
|
|
121
|
+
}, R.propOr([], 'dataSet', attributes));
|
|
122
|
+
|
|
116
123
|
var resAttributes = (0, _extends3.default)({}, attributes, {
|
|
117
|
-
observation: resAttrObservations
|
|
124
|
+
observation: R.concat(resAttrObservations, datasetAttributes)
|
|
118
125
|
});
|
|
119
126
|
|
|
120
127
|
//----------------------------------------------------------------------------------------Dimensions
|
|
@@ -20,6 +20,6 @@ var getDataflowTooltipAttributesIds = exports.getDataflowTooltipAttributesIds =
|
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
22
|
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : R.split(',', flagsAttrAnnotation.title),
|
|
23
|
-
|
|
23
|
+
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes : R.split(',', footnotesAttrAnnotation.title)
|
|
24
24
|
};
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ const getAttrLabel = (display) => (attribute) => `${display(attribute)}: ${displ
|
|
|
7
7
|
export const getFlags = (customAttributesIds, display, unitsProps) => ({ attributes={}, units={} }) => {
|
|
8
8
|
const refinedAttributes = R.omit(R.propOr([], 'rejected', customAttributesIds), attributes);
|
|
9
9
|
const flags = R.pipe(R.pick(R.propOr([], 'flags', customAttributesIds)), R.values)(refinedAttributes);
|
|
10
|
-
const footnotes = R.pipe(R.pick(R.propOr([], '
|
|
10
|
+
const footnotes = R.pipe(R.pick(R.propOr([], 'notes', customAttributesIds)), R.values)(refinedAttributes);
|
|
11
11
|
|
|
12
12
|
const unitsDisplay = R.prop('unitsDisplay', unitsProps);
|
|
13
13
|
const rejectedUnitsValueIds = R.propOr([], 'rejectedValueIds', unitsProps);
|
|
@@ -75,7 +75,7 @@ export const getFlags = (customAttributesIds, display, unitsProps) => ({ attribu
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
const getSideProps = ({ attributes, indexedDimValIds }, customAttributes, metadataCoordinates) => {
|
|
78
|
-
const rejected = [...customAttributes.flags || [], ...customAttributes.
|
|
78
|
+
const rejected = [...customAttributes.flags || [], ...customAttributes.notes || [], ...customAttributes.rejected || []];
|
|
79
79
|
const advancedAttributes = R.omit(rejected, attributes);
|
|
80
80
|
const hasAdvancedAttributes = !R.isEmpty(advancedAttributes);
|
|
81
81
|
const hasMetadata = hasCellMetadata(metadataCoordinates, indexedDimValIds);
|
|
@@ -87,7 +87,7 @@ const getCoordinates = (data, unitsId) => R.reduce(
|
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
export const getLayoutDataWithFlags = (seriesAttributes, display, customAttributes, metadataCoordinates, unitsId) => {
|
|
90
|
-
const regularAttrsIds = R.concat(customAttributes.flags || [], customAttributes.
|
|
90
|
+
const regularAttrsIds = R.concat(customAttributes.flags || [], customAttributes.notes || []);
|
|
91
91
|
const formatSublayout = (getAttributes, mCoordinates = [], supplData = []) => data => {
|
|
92
92
|
const attributes = getAttributes(data);
|
|
93
93
|
const key = getSerieKey(data);
|
|
@@ -20,7 +20,7 @@ const getAttributeRegisters = (attribute, parsedDimensionsIds, customAttributes)
|
|
|
20
20
|
if (R.hasPath(['relationship', 'none'], attribute)) {
|
|
21
21
|
return [registerAttrId(['dataflow'], attribute.id), registerAttr(attribute)];
|
|
22
22
|
}
|
|
23
|
-
if (R.pathEq(['relationship', 'primaryMeasure'], 'OBS_VALUE', attribute)) {
|
|
23
|
+
if (R.pathEq(['relationship', 'primaryMeasure'], 'OBS_VALUE', attribute) || R.hasPath(['relationship', 'observation'], attribute)) {
|
|
24
24
|
return [registerAttrId(['observations'], attribute.id), registerAttr(attribute)];
|
|
25
25
|
}
|
|
26
26
|
const targetDimensions = R.pathOr([], ['relationship', 'dimensions'], attribute);
|
|
@@ -151,7 +151,7 @@ export const prepareData = (sdmxJson, customAttributes, unitsProps={}) => {
|
|
|
151
151
|
);
|
|
152
152
|
const headerAttributes = R.pick(headerAttributesIds, attributesIndexedByIds);
|
|
153
153
|
const headerAdvancedAttrIds = R.pipe(
|
|
154
|
-
R.filter(id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
154
|
+
R.filter(id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || [])),
|
|
155
155
|
)(headerAttributesIds);
|
|
156
156
|
|
|
157
157
|
const dataflowAdvancedAttributes = getDataflowAdvancedAttributes(
|
|
@@ -162,13 +162,13 @@ export const prepareData = (sdmxJson, customAttributes, unitsProps={}) => {
|
|
|
162
162
|
);
|
|
163
163
|
|
|
164
164
|
const observationsAdvancedAttributesIds = R.filter(
|
|
165
|
-
id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
165
|
+
id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || []),
|
|
166
166
|
attributesIdsIndexedByTargets.observations || []
|
|
167
167
|
);
|
|
168
168
|
const observationsAdvancedAttributes = getObservationsAdvancedAttributes(observations, observationsAdvancedAttributesIds);
|
|
169
169
|
|
|
170
170
|
const seriesAdvancedAttributesIds = R.filter(
|
|
171
|
-
id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.
|
|
171
|
+
id => !R.includes(id, customAttributes.flags || []) && !R.includes(id, customAttributes.notes || []),
|
|
172
172
|
R.concat(attributesIdsIndexedByTargets.series || [], attributesIdsIndexedByTargets.manyValuesDimensions || [])
|
|
173
173
|
);
|
|
174
174
|
|
|
@@ -102,9 +102,18 @@ export const dataTransformer = (dataNew, options = {}) => {
|
|
|
102
102
|
roles: !R.isNil(observation.role) ? R.head(observation.role) : null,
|
|
103
103
|
}), attrObservations);
|
|
104
104
|
|
|
105
|
+
const datasetAttributes = R.map(
|
|
106
|
+
(attr) => ({
|
|
107
|
+
...attr,
|
|
108
|
+
name: getLocalisedProp('names', observation),
|
|
109
|
+
values: getValues(attr.values || [])
|
|
110
|
+
}),
|
|
111
|
+
R.propOr([], 'dataSet', attributes)
|
|
112
|
+
)
|
|
113
|
+
|
|
105
114
|
const resAttributes = {
|
|
106
115
|
...attributes,
|
|
107
|
-
observation: resAttrObservations,
|
|
116
|
+
observation: R.concat(resAttrObservations, datasetAttributes)
|
|
108
117
|
};
|
|
109
118
|
|
|
110
119
|
//----------------------------------------------------------------------------------------Dimensions
|
|
@@ -9,7 +9,7 @@ export const getDataflowTooltipAttributesIds = (sdmxJson, defaults) => {
|
|
|
9
9
|
|
|
10
10
|
return ({
|
|
11
11
|
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : R.split(',', flagsAttrAnnotation.title),
|
|
12
|
-
|
|
12
|
+
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes : R.split(',', footnotesAttrAnnotation.title),
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
package/test/getCells.test.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getDataflowTooltipAttributesIds } from '../src/rules2/src';
|
|
|
3
3
|
|
|
4
4
|
const def = {
|
|
5
5
|
flags: ['f0', 'f1'],
|
|
6
|
-
|
|
6
|
+
notes: ['foot0', 'foot1']
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
describe('getDataflowTooltipAttributesIds tests', () => {
|
|
@@ -37,7 +37,7 @@ describe('getDataflowTooltipAttributesIds tests', () => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'],
|
|
40
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: ['foot0', 'foot1'] });
|
|
41
41
|
});
|
|
42
42
|
it('footnotes override', () => {
|
|
43
43
|
const data = {
|
|
@@ -53,7 +53,7 @@ describe('getDataflowTooltipAttributesIds tests', () => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f0', 'f1'],
|
|
56
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f0', 'f1'], notes: ['foot2', 'foot3'] });
|
|
57
57
|
});
|
|
58
58
|
it('flags and footnotes override', () => {
|
|
59
59
|
const data = {
|
|
@@ -69,6 +69,6 @@ describe('getDataflowTooltipAttributesIds tests', () => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'],
|
|
72
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: ['foot2', 'foot3'] });
|
|
73
73
|
});
|
|
74
74
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
2
|
import { getLayoutDataWithFlags } from '../src/rules/src/table/factories/getLayoutWithFlags';
|
|
3
3
|
|
|
4
|
-
const customAttributes = { flags: ['a1', 'a2'],
|
|
4
|
+
const customAttributes = { flags: ['a1', 'a2'], notes: ['a3', 'a4'] };
|
|
5
5
|
|
|
6
6
|
const layoutData = {
|
|
7
7
|
headerData: [
|
|
@@ -22,7 +22,7 @@ describe('getSubtitleFlags tests', () => {
|
|
|
22
22
|
});
|
|
23
23
|
it('simple test', () => {
|
|
24
24
|
expect(getSubtitleFlags({
|
|
25
|
-
customAttributes: { flags: [],
|
|
25
|
+
customAttributes: { flags: [], notes: ['f1', 'f2'] },
|
|
26
26
|
dimensions: {
|
|
27
27
|
one: {
|
|
28
28
|
a: {
|