@sis-cc/dotstatsuite-components 12.2.0 → 12.2.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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDataflowTooltipAttributesIds = 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 getDataflowTooltipAttributesIds = exports.getDataflowTooltipAttributesIds = function getDataflowTooltipAttributesIds(sdmxJson, defaults) {
|
|
15
|
+
var dataflowAnnotationsIndexes = R.pathOr([], ['data', 'dataSets', 0, 'annotations'], sdmxJson);
|
|
16
|
+
var dataflowAnnotations = R.props(dataflowAnnotationsIndexes, R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson));
|
|
17
|
+
|
|
18
|
+
var flagsAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_FLAG'), dataflowAnnotations);
|
|
19
|
+
var footnotesAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_NOTE'), dataflowAnnotations);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : R.split(',', flagsAttrAnnotation.title),
|
|
23
|
+
footnotes: R.isNil(footnotesAttrAnnotation) ? defaults.footnotes : R.split(',', footnotesAttrAnnotation.title)
|
|
24
|
+
};
|
|
25
|
+
};
|
package/lib/rules2/src/index.js
CHANGED
|
@@ -46,6 +46,15 @@ Object.defineProperty(exports, 'sdmx_3_0_DataFormatPatch', {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
var _getDataflowTooltipAttributesIds = require('./getDataflowTooltipAttributesIds');
|
|
50
|
+
|
|
51
|
+
Object.defineProperty(exports, 'getDataflowTooltipAttributesIds', {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _getDataflowTooltipAttributesIds.getDataflowTooltipAttributesIds;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
49
58
|
var _getMSDInformations = require('./getMSDInformations');
|
|
50
59
|
|
|
51
60
|
Object.defineProperty(exports, 'getMSDInformations', {
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const getDataflowTooltipAttributesIds = (sdmxJson, defaults) => {
|
|
4
|
+
const dataflowAnnotationsIndexes = R.pathOr([], ['data', 'dataSets', 0, 'annotations'], sdmxJson);
|
|
5
|
+
const dataflowAnnotations = R.props(dataflowAnnotationsIndexes, R.pathOr([], ['data', 'structure', 'annotations'], sdmxJson));
|
|
6
|
+
|
|
7
|
+
const flagsAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_FLAG'), dataflowAnnotations);
|
|
8
|
+
const footnotesAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_NOTE'), dataflowAnnotations);
|
|
9
|
+
|
|
10
|
+
return ({
|
|
11
|
+
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : R.split(',', flagsAttrAnnotation.title),
|
|
12
|
+
footnotes: R.isNil(footnotesAttrAnnotation) ? defaults.footnotes : R.split(',', footnotesAttrAnnotation.title),
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
package/src/rules2/src/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export {
|
|
|
6
6
|
export { getSidebarData } from './getSidebarData';
|
|
7
7
|
export { parseMetadataSeries } from './parseMetadataSeries';
|
|
8
8
|
export { sdmx_3_0_DataFormatPatch } from './sdmx3.0DataFormatPatch';
|
|
9
|
+
export { getDataflowTooltipAttributesIds } from './getDataflowTooltipAttributesIds';
|
|
9
10
|
export { getMSDInformations } from './getMSDInformations';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { getDataflowTooltipAttributesIds } from '../src/rules2/src';
|
|
3
|
+
|
|
4
|
+
const def = {
|
|
5
|
+
flags: ['f0', 'f1'],
|
|
6
|
+
footnotes: ['foot0', 'foot1']
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
describe('getDataflowTooltipAttributesIds tests', () => {
|
|
10
|
+
it('no override', () => {
|
|
11
|
+
const data = {
|
|
12
|
+
dataSets: [{
|
|
13
|
+
annotations: [0, 1]
|
|
14
|
+
}],
|
|
15
|
+
structure: {
|
|
16
|
+
annotations: [
|
|
17
|
+
{ id: 'annot0', title: 'test' },
|
|
18
|
+
{ id: 'annot1', title: 'test' },
|
|
19
|
+
{ id: 'annot2', title: 'test' },
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal(def);
|
|
25
|
+
});
|
|
26
|
+
it('flags override', () => {
|
|
27
|
+
const data = {
|
|
28
|
+
dataSets: [{
|
|
29
|
+
annotations: [0, 1]
|
|
30
|
+
}],
|
|
31
|
+
structure: {
|
|
32
|
+
annotations: [
|
|
33
|
+
{ id: 'annot0', title: 'test' },
|
|
34
|
+
{ id: 'annot1', type: 'LAYOUT_FLAG', title: 'f2,f3' },
|
|
35
|
+
{ id: 'annot2', title: 'test' },
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], footnotes: ['foot0', 'foot1'] });
|
|
41
|
+
});
|
|
42
|
+
it('footnotes override', () => {
|
|
43
|
+
const data = {
|
|
44
|
+
dataSets: [{
|
|
45
|
+
annotations: [0, 1]
|
|
46
|
+
}],
|
|
47
|
+
structure: {
|
|
48
|
+
annotations: [
|
|
49
|
+
{ id: 'annot0', title: 'test' },
|
|
50
|
+
{ id: 'annot1', type: 'LAYOUT_NOTE', title: 'foot2,foot3' },
|
|
51
|
+
{ id: 'annot2', title: 'test' },
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f0', 'f1'], footnotes: ['foot2', 'foot3'] });
|
|
57
|
+
});
|
|
58
|
+
it('flags and footnotes override', () => {
|
|
59
|
+
const data = {
|
|
60
|
+
dataSets: [{
|
|
61
|
+
annotations: [0, 1]
|
|
62
|
+
}],
|
|
63
|
+
structure: {
|
|
64
|
+
annotations: [
|
|
65
|
+
{ id: 'annot0', type: 'LAYOUT_FLAG', title: 'f2,f3' },
|
|
66
|
+
{ id: 'annot1', type: 'LAYOUT_NOTE', title: 'foot2,foot3' },
|
|
67
|
+
{ id: 'annot2', title: 'test' },
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], footnotes: ['foot2', 'foot3'] });
|
|
73
|
+
});
|
|
74
|
+
});
|