@sis-cc/dotstatsuite-components 15.0.5 → 15.0.6
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/getDataflowTooltipAttributesIds.js +10 -2
- package/package.json +1 -1
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +12 -2
- package/test/getAttachmentSeriesIndexes.test.js +6 -6
- package/test/{getDataflowTooltipAttributesIds.js → getDataflowTooltipAttributesIds.test.js} +16 -0
|
@@ -18,8 +18,16 @@ var getDataflowTooltipAttributesIds = exports.getDataflowTooltipAttributesIds =
|
|
|
18
18
|
var flagsAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_FLAG'), dataflowAnnotations);
|
|
19
19
|
var footnotesAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_NOTE'), dataflowAnnotations);
|
|
20
20
|
|
|
21
|
+
var customFlags = R.pipe(R.propOr('', 'title'), function (title) {
|
|
22
|
+
return R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title);
|
|
23
|
+
})(flagsAttrAnnotation || {});
|
|
24
|
+
|
|
25
|
+
var customNotes = R.pipe(R.propOr('', 'title'), function (title) {
|
|
26
|
+
return R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title);
|
|
27
|
+
})(footnotesAttrAnnotation || {});
|
|
28
|
+
|
|
21
29
|
return {
|
|
22
|
-
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags :
|
|
23
|
-
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes :
|
|
30
|
+
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : customFlags,
|
|
31
|
+
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes : customNotes
|
|
24
32
|
};
|
|
25
33
|
};
|
package/package.json
CHANGED
|
@@ -7,9 +7,19 @@ export const getDataflowTooltipAttributesIds = (sdmxJson, defaults) => {
|
|
|
7
7
|
const flagsAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_FLAG'), dataflowAnnotations);
|
|
8
8
|
const footnotesAttrAnnotation = R.find(R.propEq('type', 'LAYOUT_NOTE'), dataflowAnnotations);
|
|
9
9
|
|
|
10
|
+
const customFlags = R.pipe(
|
|
11
|
+
R.propOr('', 'title'),
|
|
12
|
+
title => R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title)
|
|
13
|
+
)(flagsAttrAnnotation || {});
|
|
14
|
+
|
|
15
|
+
const customNotes = R.pipe(
|
|
16
|
+
R.propOr('', 'title'),
|
|
17
|
+
title => R.isNil(title) || R.isEmpty(title) ? [] : R.split(',', title)
|
|
18
|
+
)(footnotesAttrAnnotation || {});
|
|
19
|
+
|
|
10
20
|
return ({
|
|
11
|
-
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags :
|
|
12
|
-
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes :
|
|
21
|
+
flags: R.isNil(flagsAttrAnnotation) ? defaults.flags : customFlags,
|
|
22
|
+
notes: R.isNil(footnotesAttrAnnotation) ? defaults.notes : customNotes,
|
|
13
23
|
});
|
|
14
24
|
};
|
|
15
25
|
|
|
@@ -2,12 +2,12 @@ import { expect } from 'chai';
|
|
|
2
2
|
import { getAttachmentSeriesIndexes } from '../src/rules/src/table/units/getAttachmentSeriesIndexes';
|
|
3
3
|
|
|
4
4
|
const dimensions = {
|
|
5
|
-
D0: { id: 'D0',
|
|
6
|
-
D1: { id: 'D1',
|
|
7
|
-
D2: { id: 'D2',
|
|
8
|
-
D3: { id: 'D3',
|
|
9
|
-
D4: { id: 'D4',
|
|
10
|
-
D5: { id: 'D5',
|
|
5
|
+
D0: { id: 'D0', __index: 0 },
|
|
6
|
+
D1: { id: 'D1', __index: 1 },
|
|
7
|
+
D2: { id: 'D2', __index: 2 },
|
|
8
|
+
D3: { id: 'D3', __index: 3 },
|
|
9
|
+
D4: { id: 'D4', __index: 4 },
|
|
10
|
+
D5: { id: 'D5', __index: 5 },
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const unitsArtefacts = {
|
|
@@ -71,4 +71,20 @@ describe('getDataflowTooltipAttributesIds tests', () => {
|
|
|
71
71
|
|
|
72
72
|
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: ['foot2', 'foot3'] });
|
|
73
73
|
});
|
|
74
|
+
it('annotation without content erase defaults', () => {
|
|
75
|
+
const data = {
|
|
76
|
+
dataSets: [{
|
|
77
|
+
annotations: [0, 1]
|
|
78
|
+
}],
|
|
79
|
+
structure: {
|
|
80
|
+
annotations: [
|
|
81
|
+
{ id: 'annot0', type: 'LAYOUT_FLAG', title: 'f2,f3' },
|
|
82
|
+
{ id: 'annot1', type: 'LAYOUT_NOTE' },
|
|
83
|
+
{ id: 'annot2', title: 'test' },
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: [] });
|
|
89
|
+
});
|
|
74
90
|
});
|