@sis-cc/dotstatsuite-components 21.0.1 → 21.1.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.
Files changed (234) hide show
  1. package/dist/dotstatsuite-components.js +38112 -0
  2. package/package.json +4 -1
  3. package/.editorconfig +0 -19
  4. package/.gitlab-ci.yml +0 -48
  5. package/prettier.config.js +0 -13
  6. package/src/app.js +0 -13
  7. package/src/bridge-d3-react/README.md +0 -42
  8. package/src/bridge-d3-react/src/app.js +0 -64
  9. package/src/bridge-d3-react/src/index.js +0 -17
  10. package/src/bridge-d3-react/src/mock-choro.js +0 -394
  11. package/src/bridge-d3-react/src/react-chart-factory.js +0 -65
  12. package/src/index.js +0 -12
  13. package/src/rules/README.md +0 -23
  14. package/src/rules/src/chart/getAxisOptions.js +0 -258
  15. package/src/rules/src/chart/getBaseOptions.js +0 -84
  16. package/src/rules/src/chart/getChartOptions.js +0 -118
  17. package/src/rules/src/chart/getGridOptions.js +0 -52
  18. package/src/rules/src/chart/getTooltipOptions.js +0 -230
  19. package/src/rules/src/constants.js +0 -64
  20. package/src/rules/src/date.js +0 -118
  21. package/src/rules/src/dimension-utils.js +0 -54
  22. package/src/rules/src/factories/choro-series.js +0 -65
  23. package/src/rules/src/factories/sample-focus.js +0 -22
  24. package/src/rules/src/factories/sample-series.js +0 -51
  25. package/src/rules/src/factories/scatter-dimension.js +0 -31
  26. package/src/rules/src/factories/scatter-focus.js +0 -39
  27. package/src/rules/src/factories/scatter-series.js +0 -94
  28. package/src/rules/src/factories/stacked-dimension.js +0 -29
  29. package/src/rules/src/factories/stacked-series.js +0 -185
  30. package/src/rules/src/factories/symbol-dimension.js +0 -29
  31. package/src/rules/src/factories/symbol-series.js +0 -62
  32. package/src/rules/src/factories/timeline-focus.js +0 -18
  33. package/src/rules/src/factories/timeline-series.js +0 -91
  34. package/src/rules/src/get-values-enhanced.js +0 -134
  35. package/src/rules/src/header/getDefaultSubtitle.js +0 -40
  36. package/src/rules/src/header/getHeaderUnits.js +0 -17
  37. package/src/rules/src/header/getSubtitleFlags.js +0 -43
  38. package/src/rules/src/header/getTitleFlags.js +0 -8
  39. package/src/rules/src/header/index.js +0 -4
  40. package/src/rules/src/index.js +0 -398
  41. package/src/rules/src/layout.js +0 -113
  42. package/src/rules/src/observation-formater.js +0 -83
  43. package/src/rules/src/preparators/enhanceObservations.js +0 -152
  44. package/src/rules/src/preparators/formatValue.js +0 -84
  45. package/src/rules/src/preparators/getObservations.js +0 -19
  46. package/src/rules/src/preparators/getReportingYearStart.js +0 -16
  47. package/src/rules/src/properties/errors.js +0 -19
  48. package/src/rules/src/properties/focus.js +0 -69
  49. package/src/rules/src/properties/getAvailableChartTypes.js +0 -34
  50. package/src/rules/src/properties/getHeaderProps.js +0 -74
  51. package/src/rules/src/properties/getInformationsStateFromNewProps.js +0 -47
  52. package/src/rules/src/properties/getObservationsType.js +0 -29
  53. package/src/rules/src/properties/getStringifiedSubtitle.js +0 -6
  54. package/src/rules/src/properties/index.js +0 -424
  55. package/src/rules/src/properties/information.js +0 -84
  56. package/src/rules/src/properties/linear.js +0 -129
  57. package/src/rules/src/properties/scatter.js +0 -158
  58. package/src/rules/src/properties/stacked.js +0 -98
  59. package/src/rules/src/properties/symbol.js +0 -79
  60. package/src/rules/src/properties/utils.js +0 -110
  61. package/src/rules/src/sdmx-data/index.js +0 -39
  62. package/src/rules/src/table/factories/getCellValue.js +0 -50
  63. package/src/rules/src/table/index.js +0 -1
  64. package/src/rules/src/v8-transformer.js +0 -176
  65. package/src/rules/test/extractSdmxArtefacts.js +0 -26
  66. package/src/rules/test/get-values-enhanced.test.js +0 -127
  67. package/src/rules/test/oecd-HEALTH_PROT-no-freq.json +0 -2903
  68. package/src/rules/test/oecd-HEALTH_PROT-parsed.js +0 -398
  69. package/src/rules/test/oecd-HEALTH_PROT-wrong-freq.json +0 -2913
  70. package/src/rules/test/oecd-HEALTH_PROT.json +0 -2913
  71. package/src/rules/test/oecd-KEI.json +0 -372
  72. package/src/rules/test/scatter-property.js +0 -455
  73. package/src/rules/test/stacked-property.js +0 -273
  74. package/src/rules/test/symbol-property.js +0 -262
  75. package/src/rules/test/v8-transformer.test.js +0 -90
  76. package/src/rules2/src/applyHierarchicalCodesToDim.js +0 -149
  77. package/src/rules2/src/combinedValuesDisplay.js +0 -74
  78. package/src/rules2/src/constants.js +0 -6
  79. package/src/rules2/src/duplicateObservations.js +0 -35
  80. package/src/rules2/src/enhanceObservations.js +0 -95
  81. package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -29
  82. package/src/rules2/src/getAttributesSeries.js +0 -36
  83. package/src/rules2/src/getCombinationDefinitions.js +0 -47
  84. package/src/rules2/src/getDataflowAttributes.js +0 -23
  85. package/src/rules2/src/getDataflowTooltipAttributesIds.js +0 -31
  86. package/src/rules2/src/getDimensionValuesIndexes.js +0 -13
  87. package/src/rules2/src/getHCodelistsRefsInData.js +0 -32
  88. package/src/rules2/src/getHeaderCombinations.js +0 -48
  89. package/src/rules2/src/getHeaderCoordinates.js +0 -7
  90. package/src/rules2/src/getHeaderSubtitle.js +0 -34
  91. package/src/rules2/src/getHeaderTitle.js +0 -15
  92. package/src/rules2/src/getMSDInformations.js +0 -23
  93. package/src/rules2/src/getManyValuesDimensions.js +0 -34
  94. package/src/rules2/src/getMetadataCoordinates.js +0 -37
  95. package/src/rules2/src/getMetadataStructureFromData.js +0 -17
  96. package/src/rules2/src/getNotDisplayedIds.js +0 -53
  97. package/src/rules2/src/getOneValueDimensions.js +0 -34
  98. package/src/rules2/src/getSeriesCombinations.js +0 -24
  99. package/src/rules2/src/hasCellMetadata.js +0 -14
  100. package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -57
  101. package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -35
  102. package/src/rules2/src/index.js +0 -50
  103. package/src/rules2/src/parseAttributes.js +0 -41
  104. package/src/rules2/src/parseCombinations.js +0 -102
  105. package/src/rules2/src/parseHierarchicalCodelist.js +0 -48
  106. package/src/rules2/src/parseMetadataSeries.js +0 -117
  107. package/src/rules2/src/prepareData.js +0 -73
  108. package/src/rules2/src/refineAttributes.js +0 -16
  109. package/src/rules2/src/refineDimensions.js +0 -18
  110. package/src/rules2/src/refineMetadataCoordinates.js +0 -28
  111. package/src/rules2/src/refineTimePeriod.js +0 -127
  112. package/src/rules2/src/sdmx3.0DataFormatPatch.js +0 -9
  113. package/src/rules2/src/table/declineObservationsOverAttributes.js +0 -32
  114. package/src/rules2/src/table/getCells.js +0 -93
  115. package/src/rules2/src/table/getCellsAttributesIds.js +0 -38
  116. package/src/rules2/src/table/getCellsMetadataCoordinates.js +0 -13
  117. package/src/rules2/src/table/getCombinationDimensionsData.js +0 -39
  118. package/src/rules2/src/table/getCuratedCells.js +0 -33
  119. package/src/rules2/src/table/getFlagsAndNotes.js +0 -23
  120. package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -16
  121. package/src/rules2/src/table/getLayout.js +0 -84
  122. package/src/rules2/src/table/getLayoutData2.js +0 -198
  123. package/src/rules2/src/table/getSortedLayoutIndexes.js +0 -124
  124. package/src/rules2/src/table/getTableLabelAccessor.js +0 -9
  125. package/src/rules2/src/table/getTableLayoutIds.js +0 -314
  126. package/src/rules2/src/table/getTableProps.js +0 -75
  127. package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -79
  128. package/src/rules2/src/table/parseValueHierarchy.js +0 -33
  129. package/src/rules2/src/table/refineLayoutSize2.js +0 -321
  130. package/src/rules2/src/utils.js +0 -37
  131. package/src/viewer/mocks/bar.js +0 -33
  132. package/src/viewer/mocks/gpp-symbol.js +0 -93
  133. package/src/viewer/mocks/gpp-time.js +0 -1103
  134. package/src/viewer/mocks/row.js +0 -39
  135. package/src/viewer/mocks/scatter.js +0 -93
  136. package/src/viewer/mocks/stack.js +0 -161
  137. package/src/viewer/src/app/leg.js +0 -36
  138. package/src/viewer/src/app/nodata-res.js +0 -22
  139. package/src/viewer/src/app/nodata-sized.js +0 -23
  140. package/src/viewer/src/app/one-table-cell.js +0 -70
  141. package/src/viewer/src/app/table.js +0 -423
  142. package/src/viewer/src/app/use-case-1.js +0 -33
  143. package/src/viewer/src/app/use-case-2.js +0 -38
  144. package/src/viewer/src/app/use-case-3.js +0 -18
  145. package/src/viewer/src/app.js +0 -116
  146. package/src/viewer/src/chart.js +0 -52
  147. package/src/viewer/src/chartUtils/options.js +0 -30
  148. package/src/viewer/src/chartUtils/series.js +0 -51
  149. package/src/viewer/src/footer.js +0 -24
  150. package/src/viewer/src/header.js +0 -10
  151. package/src/viewer/src/index.js +0 -158
  152. package/src/viewer/src/legends/AxisLegend.js +0 -41
  153. package/src/viewer/src/legends/ChartLegends.js +0 -66
  154. package/src/viewer/src/legends/FocusLegend.js +0 -63
  155. package/src/viewer/src/legends/Legend.js +0 -46
  156. package/src/viewer/src/legends/SeriesLegend.js +0 -78
  157. package/src/viewer/src/utils.js +0 -21
  158. package/test/applyHierarchicalCodesToDim.test.js +0 -160
  159. package/test/combinedValuesDisplay.test.js +0 -66
  160. package/test/duplicateObs.test.js +0 -118
  161. package/test/enhanceObservations2.test.js +0 -257
  162. package/test/getAttributesSeries.test.js +0 -66
  163. package/test/getAxisOptions.test.js +0 -309
  164. package/test/getBaseOptions.test.js +0 -77
  165. package/test/getCellValue.test.js +0 -32
  166. package/test/getCells.test.js +0 -178
  167. package/test/getCellsMetadataCoordinates.test.js +0 -40
  168. package/test/getCombinationDefinitions.test.js +0 -104
  169. package/test/getCombinationDimensionsData.test.js +0 -99
  170. package/test/getDataflowAttributes.test.js +0 -23
  171. package/test/getDataflowTooltipAttributesIds.test.js +0 -146
  172. package/test/getDimensionValuesIndexes.test.js +0 -33
  173. package/test/getGridOptions.test.js +0 -65
  174. package/test/getHCodelistsRefs.test.js +0 -23
  175. package/test/getHeaderCombinations.test.js +0 -62
  176. package/test/getHeaderTitle.test.js +0 -25
  177. package/test/getLayout.test.js +0 -54
  178. package/test/getLayoutData2.test.js +0 -535
  179. package/test/getMSDInformations.test.js +0 -35
  180. package/test/getMetadataCoordinates.test.js +0 -0
  181. package/test/getNotDisplayedIds.test.js +0 -47
  182. package/test/getObservationsType.test.js +0 -55
  183. package/test/getOneValueDimensions.test.js +0 -35
  184. package/test/getReportingYearStart.test.js +0 -59
  185. package/test/getSeriesCombinations.test.js +0 -29
  186. package/test/getSortedLayoutIndexes.test.js +0 -1138
  187. package/test/getTableLabelAccessor.test.js +0 -50
  188. package/test/getTableLayoutIds.test.js +0 -356
  189. package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +0 -109
  190. package/test/isTableLayoutCompatible.test.js +0 -102
  191. package/test/metadata-parsing-perf.test.js +0 -509
  192. package/test/mocks/MSD_TEST.json +0 -490
  193. package/test/mocks/OECD_SNA_TABLE1_1.0_-_AUS_V_metadata.json +0 -152
  194. package/test/mocks/h-codelist.json +0 -2095
  195. package/test/mocks/large_metadata_series.json +0 -701
  196. package/test/mocks/observations-advanced-attributes.json +0 -55382
  197. package/test/mocks/table-invert-time--data.json +0 -80211
  198. package/test/mocks/table-invert-time--inverted.json +0 -80076
  199. package/test/mocks/table-layout-multi-hierarchies--layout.json +0 -621
  200. package/test/mocks/table-layout-multi-hierarchies--layoutData.json +0 -32411
  201. package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +0 -2760
  202. package/test/mocks/table-layout-multi-hierarchies--observations.json +0 -30688
  203. package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +0 -2762
  204. package/test/mocks/table-layout-truncation1--layout.json +0 -27469
  205. package/test/mocks/table-layout-truncation1--layoutData.json +0 -20358
  206. package/test/mocks/table-layout-truncation1--layoutIndexes.json +0 -7512
  207. package/test/mocks/table-layout-truncation1--observations.json +0 -70002
  208. package/test/mocks/table-layout-truncation1--sizedIndexes.json +0 -3011
  209. package/test/mocks/table-prep-multi-hierarchies--attributes.json +0 -46
  210. package/test/mocks/table-prep-multi-hierarchies--dimensions.json +0 -688
  211. package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +0 -19696
  212. package/test/mocks/table-prep-multi-hierarchies--observations.json +0 -8246
  213. package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +0 -2985
  214. package/test/mocks/table-prep-simple-duplicate--dimensions2.json +0 -858
  215. package/test/mocks/table-prep-simple-duplicate--duplicated2.json +0 -77502
  216. package/test/mocks/table-prep-simple-duplicate--observations2.json +0 -60002
  217. package/test/mocks/table-prep-truncation1--dimensions.json +0 -35057
  218. package/test/mocks/table-prep-truncation1--enhancedObservations.json +0 -70002
  219. package/test/mocks/table-prep-truncation1--observations.json +0 -27502
  220. package/test/mocks/table-prep-truncation1--sdmxJson.json +0 -55103
  221. package/test/mocks/table-prep-units--observations.json +0 -284286
  222. package/test/mocks/table-prep-units--unitsSeries.json +0 -41042
  223. package/test/parseAttributes.test.js +0 -36
  224. package/test/parseCombinations.test.js +0 -172
  225. package/test/parseHierarchicalCodelist.test.js +0 -140
  226. package/test/parseMetadataSeries.test.js +0 -128
  227. package/test/parseSeriesIndexesHierarchies.test.js +0 -345
  228. package/test/parseValueHierarchy.test.js +0 -138
  229. package/test/refineAttributes.test.js +0 -29
  230. package/test/refineLayoutSize2.test.js +0 -3410
  231. package/test/refineMetadataCoordinates.test.js +0 -86
  232. package/test/refineTimePeriod.test.js +0 -580
  233. package/test/refinedDimensions.test.js +0 -35
  234. package/vite.config.mjs +0 -51
@@ -1,104 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getCombinationDefinitions } from '../src/rules2/src';
3
-
4
- describe('getCombinationDefinitions tests', () => {
5
- it('no annotations', () => {
6
- const annotations = [
7
- { type: 'random', title: 'test' },
8
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' }
9
- ];
10
-
11
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([]);
12
- });
13
- it('basic case', () => {
14
- const annotations = [
15
- { type: 'random', title: 'test' },
16
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
17
- {
18
- type: 'COMBINED_CONCEPTS',
19
- texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
20
- title: 'COMB_1:D1,D2,A1;COMB_2:D3,D4,A2,A3'
21
- }
22
- ];
23
-
24
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
25
- { id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
26
- { id: 'COMB_2', name: 'Second Combination', concepts: ['D3', 'D4', 'A2', 'A3'] },
27
- ]);
28
- });
29
- it('bad formatted test 1', () => {
30
- const annotations = [
31
- { type: 'random', title: 'test' },
32
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
33
- {
34
- type: 'COMBINED_CONCEPTS',
35
- texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
36
- title: 'COMB_1:D1,D2,A1;D3,D4,A2,A3'
37
- }
38
- ];
39
-
40
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
41
- { id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
42
- ]);
43
- });
44
- it('bad formatted test 2', () => {
45
- const annotations = [
46
- { type: 'random', title: 'test' },
47
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
48
- {
49
- type: 'COMBINED_CONCEPTS',
50
- texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
51
- title: 'COMB_1:D1,D2,A1;COMB_2:'
52
- }
53
- ];
54
-
55
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
56
- { id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
57
- ]);
58
- });
59
- it('bad formatted test 3', () => {
60
- const annotations = [
61
- { type: 'random', title: 'test' },
62
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
63
- {
64
- type: 'COMBINED_CONCEPTS',
65
- texts: { en: 'First Combination;Second Combination' },
66
- title: 'D1,D2,A1;D3,D4,A2,A3'
67
- }
68
- ];
69
-
70
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([]);
71
- });
72
- it('missing localised text', () => {
73
- const annotations = [
74
- { type: 'random', title: 'test' },
75
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
76
- {
77
- type: 'COMBINED_CONCEPTS',
78
- texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
79
- title: 'COMB_1:D1,D2,A1;COMB_2:D3,D4,A2,A3'
80
- }
81
- ];
82
-
83
- expect(getCombinationDefinitions(annotations, 'fr')).to.deep.equal([
84
- { id: 'COMB_1', name: '[COMB_1]', concepts: ['D1', 'D2', 'A1'] },
85
- { id: 'COMB_2', name: '[COMB_2]', concepts: ['D3', 'D4', 'A2', 'A3'] },
86
- ]);
87
- });
88
- it('mixed order texts', () => {
89
- const annotations = [
90
- { type: 'random', title: 'test' },
91
- { type: 'NOT_DISPLAYED', title: 'FREQ=A' },
92
- {
93
- type: 'COMBINED_CONCEPTS',
94
- texts: { en: 'COMB_2:Second Combination;COMB_1:First Combination' },
95
- title: 'COMB_1:D1,D2,A1;COMB_2:D3,D4,A2,A3'
96
- }
97
- ];
98
-
99
- expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
100
- { id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
101
- { id: 'COMB_2', name: 'Second Combination', concepts: ['D3', 'D4', 'A2', 'A3'] },
102
- ]);
103
- });
104
- });
@@ -1,99 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getCombinationDimensionsData } from '../src/rules2/src/table/getCombinationDimensionsData';
3
-
4
- describe('getCombinationDimensionsData', () => {
5
- it('basic test', () => {
6
- const combination = {
7
- id: 'COMB',
8
- dimensions: [
9
- {
10
- id: 'D0',
11
- values: [
12
- { id: 'v0' },
13
- { id: 'v1' },
14
- { id: 'v2' },
15
- ]
16
- },
17
- {
18
- id: 'D1',
19
- display: false,
20
- values: [
21
- { id: 'v0' },
22
- { id: 'v1', hasAdvancedAttributes: true },
23
- { id: 'v2' },
24
- ]
25
- },
26
- {
27
- id: 'D2',
28
- values: [
29
- { id: 'v0' },
30
- { id: 'v1' },
31
- { id: 'v2' },
32
- ]
33
- }
34
- ]
35
- };
36
-
37
- const indexes = [0, 1, -2];
38
-
39
- const previous = { D0: { id: 'v0', display: true }, D1: { id: 'v0', display: false }, D2: { id: 'v2', display: true } };
40
-
41
- expect(getCombinationDimensionsData(indexes, combination, previous, true)).to.deep.equal({
42
- dimValues: {
43
- D0: { id: 'v0', display: true },
44
- D1: { id: 'v1', hasAdvancedAttributes: true, display: false },
45
- D2: { id: 'v2', display: true }
46
- },
47
- sameSerie: false,
48
- coordinates: { D0: 'v0', D1: 'v1', D2: 'v2' },
49
- ids: ['D0=v0', 'D1=v1', 'D2=v2'],
50
- hasAdvancedAttributes: true
51
- });
52
- });
53
- it('same value but under different hierarchy', () => {
54
- const combination = {
55
- id: 'COMB',
56
- dimensions: [
57
- {
58
- id: 'D0',
59
- values: [
60
- { id: 'v0' },
61
- { id: 'v1' },
62
- { id: 'v2' },
63
- ]
64
- },
65
- {
66
- id: 'D1',
67
- values: [
68
- { id: 'EU' },
69
- { id: 'FRA', parents: ['EU'] },
70
- { id: 'GER', parents: ['EU'] },
71
- { id: 'OECD' },
72
- { id: 'FRA', parents: ['OECD'] },
73
- { id: 'GER', parents: ['OECD'] },
74
- ],
75
- indexedValues: {
76
- EU: { id: 'EU' },
77
- FRA: { id: 'FRA' },
78
- GER: { id: 'GER' },
79
- OECD: { id: 'OECD' },
80
- }
81
- },
82
- ]
83
- };
84
-
85
- const indexes = [0, 4];
86
-
87
- const previous = { D0: { id: 'v0', display: true }, D1: { id: 'FRA', display: true, parents: [{ id: 'EU' }], parentsIds: ['EU'], missingParents: [] } };
88
- expect(getCombinationDimensionsData(indexes, combination, previous, true)).to.deep.equal({
89
- dimValues: {
90
- D0: { id: 'v0', display: true },
91
- D1: { id: 'FRA', display: true, parents: [], missingParents: [{ id: 'OECD' }], parentsIds: ['OECD'] },
92
- },
93
- sameSerie: false,
94
- coordinates: { D0: 'v0', D1: 'FRA' },
95
- ids: ['D0=v0', 'D1=FRA'],
96
- hasAdvancedAttributes: undefined
97
- });
98
- });
99
- });
@@ -1,23 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getDataflowAttributes } from '../src/rules2/src/';
3
-
4
- describe('getDataflowAttributes tests', () => {
5
- it('complete case', () => {
6
- const attributes = [
7
- { id: 'HEADER1', header: true, relationship: [], display: false, values: [{ id: 'v' }] },
8
- { id: 'HEADER2', header: true, relationship: [], values: [{ id: 'v', display: false }] },
9
- { id: 'HEADER3', header: true, relationship: [], values: [{ id: '_Z' }] },
10
- { id: 'HEADER4', header: true, relationship: [], values: [] },
11
- { id: 'HEADER5', header: true, relationship: [], values: [{ id: 'v' }] },
12
- { id: 'HEADER6', header: true, relationship: [], values: [{ id: 'v' }] },
13
- { id: 'HEADER7', header: true, relationship: ['DIM1'], values: [{ id: 'v' }] },
14
- { id: 'SERIE', series: true, relationship: [], values: [{ id: 'v' }] },
15
- ];
16
-
17
- const combinations = [{ id: 'COMB', concepts: ['DIM1', 'DIM2', 'HEADER5'] }];
18
-
19
- expect(getDataflowAttributes(attributes, combinations)).to.deep.equal({
20
- HEADER6: { id: 'HEADER6', value: { id: 'v' } }
21
- });
22
- });
23
- });
@@ -1,146 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getDataflowTooltipAttributesIds } from '../src/rules2/src';
3
-
4
- const def = {
5
- flags: ['f0', 'f1'],
6
- notes: ['foot0', 'foot1']
7
- };
8
-
9
- describe('getDataflowTooltipAttributesIds tests', () => {
10
- it('blank case', () => {
11
- expect(getDataflowTooltipAttributesIds({ data: undefined }, undefined))
12
- .to.deep.equal({ flags: [], notes: [] });
13
- });
14
- it('no override', () => {
15
- const data = {
16
- dataSets: [{
17
- annotations: [0, 1]
18
- }],
19
- structure: {
20
- annotations: [
21
- { id: 'annot0', title: 'test' },
22
- { id: 'annot1', title: 'test' },
23
- { id: 'annot2', title: 'test' },
24
- ]
25
- }
26
- };
27
-
28
- expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal(def);
29
- });
30
- it('flags override', () => {
31
- const data = {
32
- dataSets: [{
33
- annotations: [0, 1]
34
- }],
35
- structure: {
36
- annotations: [
37
- { id: 'annot0', title: 'test' },
38
- { id: 'annot1', type: 'LAYOUT_FLAG', title: 'f2,f3' },
39
- { id: 'annot2', title: 'test' },
40
- ]
41
- }
42
- };
43
-
44
- expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: ['foot0', 'foot1'] });
45
- });
46
- it('footnotes override', () => {
47
- const data = {
48
- dataSets: [{
49
- annotations: [0, 1]
50
- }],
51
- structure: {
52
- annotations: [
53
- { id: 'annot0', title: 'test' },
54
- { id: 'annot1', type: 'LAYOUT_NOTE', title: 'foot2,foot3' },
55
- { id: 'annot2', title: 'test' },
56
- ]
57
- }
58
- };
59
-
60
- expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f0', 'f1'], notes: ['foot2', 'foot3'] });
61
- });
62
- it('flags and footnotes override', () => {
63
- const data = {
64
- dataSets: [{
65
- annotations: [0, 1]
66
- }],
67
- structure: {
68
- annotations: [
69
- { id: 'annot0', type: 'LAYOUT_FLAG', title: 'f2,f3' },
70
- { id: 'annot1', type: 'LAYOUT_NOTE', title: 'foot2,foot3' },
71
- { id: 'annot2', title: 'test' },
72
- ]
73
- }
74
- };
75
-
76
- expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: ['foot2', 'foot3'] });
77
- });
78
- it('annotation without content erase defaults', () => {
79
- const data = {
80
- dataSets: [{
81
- annotations: [0, 1]
82
- }],
83
- structure: {
84
- annotations: [
85
- { id: 'annot0', type: 'LAYOUT_FLAG', title: 'f2,f3' },
86
- { id: 'annot1', type: 'LAYOUT_NOTE' },
87
- { id: 'annot2', title: 'test' },
88
- ]
89
- }
90
- };
91
-
92
- expect(getDataflowTooltipAttributesIds({ data }, def)).to.deep.equal({ flags: ['f2', 'f3'], notes: [] });
93
- });
94
- it('custom flags overrides default notes', () => {
95
- const defaultIds = {
96
- flags: [],
97
- notes: ['ATTR0', 'ATTR1']
98
- };
99
- const data = {
100
- dataSets: [{
101
- annotations: [0]
102
- }],
103
- structure: {
104
- annotations: [
105
- { id: 'annot0', type: 'LAYOUT_FLAG', title: 'ATTR0,ATTR1' },
106
- ]
107
- }
108
- };
109
- expect(getDataflowTooltipAttributesIds({ data }, defaultIds)).to.deep.equal({ flags: ['ATTR0', 'ATTR1'], notes: [] });
110
- });
111
- it('custom notes overrides default flags', () => {
112
- const defaultIds = {
113
- flags: ['ATTR0', 'ATTR1'],
114
- notes: ['ATTR2', 'ATTR3']
115
- };
116
- const data = {
117
- dataSets: [{
118
- annotations: [0]
119
- }],
120
- structure: {
121
- annotations: [
122
- { id: 'annot0', type: 'LAYOUT_NOTE', title: 'ATTR1,ATTR2' },
123
- ]
124
- }
125
- };
126
- expect(getDataflowTooltipAttributesIds({ data }, defaultIds)).to.deep.equal({ flags: ['ATTR0'], notes: ['ATTR1', 'ATTR2'] });
127
- });
128
- it('custom flags overrides custom notes', () => {
129
- const defaultIds = {
130
- flags: [],
131
- notes: []
132
- };
133
- const data = {
134
- dataSets: [{
135
- annotations: [0, 1]
136
- }],
137
- structure: {
138
- annotations: [
139
- { id: 'annot0', type: 'LAYOUT_FLAG', title: 'ATTR0,ATTR1' },
140
- { id: 'annot1', type: 'LAYOUT_NOTE', title: 'ATTR1,ATTR2' },
141
- ]
142
- }
143
- };
144
- expect(getDataflowTooltipAttributesIds({ data }, defaultIds)).to.deep.equal({ flags: ['ATTR0', 'ATTR1'], notes: ['ATTR2'] });
145
- });
146
- });
@@ -1,33 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getDimensionValuesIndexes } from '../src/rules2/src/getDimensionValuesIndexes';
3
-
4
- describe('getDimensionValuesIndexes test', () => {
5
- it('basic test', () => {
6
- const values = [
7
- { id: 'OECD', parent: undefined, parents: [], __index: 2 },
8
- { id: 'GER', parent: 'OECD', parents: ['OECD'], __index: 1 },
9
- { id: 'FRA', parent: 'OECD', parents: ['OECD'], __index: 0 },
10
- { id: 'USA', parent: 'OECD', parents: ['OECD'], __index: 3 },
11
- { id: 'A', parent: undefined, parents: [], __index: 4 },
12
- { id: 'USA', parent: 'A', parents: ['A'], __index: 3 },
13
- { id: 'MEX', parent: 'A', parents: ['A'], __index: 7 },
14
- { id: 'EA', parent: undefined, parents: [], __index: 5 },
15
- { id: 'FRA', parent: 'EA', parents: ['EA'], __index: 0 },
16
- { id: 'GER', parent: 'EA', parents: ['EA'], __index: 1 },
17
- { id: 'CHI', parent: undefined, parents: [], __index: 6 }
18
- ];
19
-
20
- const indexes = {
21
- '0': [2, 8],
22
- '1': [1, 9],
23
- '2': [0],
24
- '3': [3, 5],
25
- '4': [4],
26
- '5': [7],
27
- '6': [10],
28
- '7': [6]
29
- };
30
-
31
- expect(getDimensionValuesIndexes(values)).to.deep.equal(indexes);
32
- });
33
- });
@@ -1,65 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getGridOptions } from '../src/rules/src/chart/getGridOptions';
3
-
4
- describe('getGridOptions tests', () => {
5
- it('blank test', () => {
6
- expect(getGridOptions(null, null)).to.deep.equal({
7
- x: { baselines: [0], color: 'white' },
8
- y: { baselines: [0], color: 'white' }
9
- });
10
- });
11
- it('default bar test', () => {
12
- expect(getGridOptions('BarChart', {})).to.deep.equal({
13
- x: { baselines: [0], color: 'white', thickness: 0 },
14
- y: { baselines: [0], color: 'white' }
15
- });
16
- });
17
- it('default row test', () => {
18
- expect(getGridOptions('RowChart', {})).to.deep.equal({
19
- x: { baselines: [0], color: 'white' },
20
- y: { baselines: [0], color: 'white', thickness: 0 }
21
- });
22
- });
23
- it('default scatter test', () => {
24
- expect(getGridOptions('ScatterChart', {})).to.deep.equal({
25
- x: { baselines: [0], color: 'white' },
26
- y: { baselines: [0], color: 'white' }
27
- });
28
- });
29
- it('default timeline test', () => {
30
- expect(getGridOptions('TimelineChart', {})).to.deep.equal({
31
- x: { baselines: [0], color: 'white', thickness: 0 },
32
- y: { baselines: [0], color: 'white' }
33
- });
34
- });
35
- it('default horizontal symbol test', () => {
36
- expect(getGridOptions('HorizontalSymbolChart', {})).to.deep.equal({
37
- x: { baselines: [0], color: 'white' },
38
- y: { baselines: [0], color: 'white', thickness: 0 }
39
- });
40
- });
41
- it('default vertical symbol test', () => {
42
- expect(getGridOptions('VerticalSymbolChart', {})).to.deep.equal({
43
- x: { baselines: [0], color: 'white', thickness: 0 },
44
- y: { baselines: [0], color: 'white' }
45
- });
46
- });
47
- it('default stacked test', () => {
48
- expect(getGridOptions('StackedBarChart', {})).to.deep.equal({
49
- x: { baselines: [0], color: 'white', thickness: 0 },
50
- y: { baselines: [0], color: 'white' }
51
- });
52
- });
53
- it('customization test', () => {
54
- expect(getGridOptions('BarChart', {
55
- grid: {
56
- customOptions: { deep: 'test' },
57
- x: { color: 'red', thickness: 2 }
58
- }
59
- })).to.deep.equal({
60
- customOptions: { deep: 'test' },
61
- x: { baselines: [0], color: 'red', thickness: 2 },
62
- y: { baselines: [0], color: 'white' }
63
- });
64
- });
65
- });
@@ -1,23 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getHCodelistsRefs } from '../src/rules2/src';
3
-
4
- describe('getHCodelistsRefs tests', () => {
5
- it('complete case', () => {
6
- const annotations = [
7
- { type: 'test' },
8
- { type: 'HIER_CONTEXT', text: 'C1:A:HCL1(1.0).HIER1' },
9
- { type: 'HIER_CONTEXT', title: 'C2:A:HCL2(1.0).HIER1' },
10
- { type: 'HIER_CONTEXT', text: 'C1:A:HCL1(1.0).HIER2' },
11
- { type: 'HIER_CONTEXT', text: 'C3:A:HCL3(1.0).HIER,C4:A:HCL4(1.0).HIER' }
12
- ];
13
-
14
- const expected = {
15
- C1: { agencyId: 'A', codelistId: 'C1', code: 'HCL1', hierarchy: 'HIER2', version: '1.0' },
16
- C2: { agencyId: 'A', codelistId: 'C2', code: 'HCL2', hierarchy: 'HIER1', version: '1.0' },
17
- C3: { agencyId: 'A', codelistId: 'C3', code: 'HCL3', hierarchy: 'HIER', version: '1.0' },
18
- C4: { agencyId: 'A', codelistId: 'C4', code: 'HCL4', hierarchy: 'HIER', version: '1.0' },
19
- }
20
-
21
- expect(getHCodelistsRefs(annotations)).to.deep.equal(expected);
22
- });
23
- });
@@ -1,62 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getHeaderCombinations } from '../src/rules2/src/';
3
-
4
- describe('getHeaderCombinations tests', () => {
5
- it('complete test', () => {
6
- const combinations = [
7
- { id: 'COMB1', name: 'comb 1', header: true, concepts: ['DIM1', 'DIM2', 'DIM4', 'ATTR1'] },
8
- { id: 'COMB2', name: 'comb 2', series: true, concepts: ['DIM3', 'ATTR2'] },
9
- { id: 'COMB3', name: 'comb 3', header: true, display: false, concepts: ['DIM3', 'ATTR2'] }
10
- ];
11
-
12
- const dimensions = [
13
- { id: 'DIM1', name: 'dim 1', values: [{ id: 'v', name: 'dim 1 value' }] },
14
- { id: 'DIM3', name: 'dim 3', values: [{ id: 'v', name: 'dim 3 value' }] },
15
- { id: 'DIM4', name: 'dim 4', values: [{ id: '_Z', name: 'Not applicable' }] },
16
- ];
17
-
18
- const attributes = [
19
- { id: 'ATTR1', name: 'attr 1', values: [{ id: 'v', name: 'attr 1 value', display: false }] },
20
- { id: 'ATTR2', name: 'attr 2', values: [{ id: 'v', name: 'attr 2 value' }] },
21
- ];
22
-
23
- expect(getHeaderCombinations(combinations, dimensions, attributes, 'label')).to.deep.equal([
24
- { header: 'comb 1:', label: 'dim 1 value' }
25
- ]);
26
- });
27
- it('not display usecases', () => {
28
- const dimensions = [
29
- { id: 'd0', values: [{ id: 'd0v', name: 'd0 value', display: false }] },
30
- { id: 'd1', values: [{ id: '_T', name: 'Total' }] },
31
- { id: 'd2', values: [{ id: 'd2v', name: 'd2 value', display: false }] },
32
- ];
33
-
34
- const attributes = [
35
- { id: 'a0', values: [{ id: 'a0v', name: 'a0 value', display: false }] },
36
- { id: 'a1', values: [{ id: 'a1v', name: 'a1 value', display: false }] },
37
- { id: 'a2', values: [{ id: '_T', name: 'Total' }] },
38
- ];
39
-
40
- const combinations = [
41
- { id: 'comb0', name: 'combination 0', header: true, concepts: ['a0', 'a1', 'd0'] },
42
- { id: 'comb1', name: 'combination 1', header: true, concepts: ['d0', 'd2', 'a3'] },
43
- { id: 'comb2', name: 'combination 2', header: true, concepts: ['d0', 'd1', 'd2'] },
44
- { id: 'comb3', name: 'combination 3', header: true, concepts: ['a0', 'a1', 'a2'] },
45
- ];
46
- expect(getHeaderCombinations(combinations, dimensions, attributes, 'label')).to.deep.equal([
47
- { header: 'combination 0:', label: 'd0 value' },
48
- { header: 'combination 1:', label: 'd0 value' },
49
- { header: 'combination 2:', label: 'Total' },
50
- ]);
51
- expect(getHeaderCombinations(combinations, dimensions, attributes, 'code')).to.deep.equal([
52
- { header: 'comb0:', label: 'd0v' },
53
- { header: 'comb1:', label: 'd0v, d2v' },
54
- { header: 'comb2:', label: 'd0v, _T, d2v' },
55
- ]);
56
- expect(getHeaderCombinations(combinations, dimensions, attributes, 'both')).to.deep.equal([
57
- { header: '(comb0) combination 0:', label: '(d0v) d0 value' },
58
- { header: '(comb1) combination 1:', label: '(d0v, d2v) d0 value' },
59
- { header: '(comb2) combination 2:', label: '(d0v, _T, d2v) Total' },
60
- ]);
61
- })
62
- });
@@ -1,25 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getHeaderTitle } from '../src/rules2/src/';
3
-
4
- describe('getHeaderTitle tests', () => {
5
- it('basic case', () => {
6
-
7
- const dataflow = { id: 'DF', name: 'dataflow' };
8
-
9
- const attributes = {
10
- FLAG: { id: 'FLAG', name: 'flag', value: { id: 'v', name: 'flag value' } },
11
- NOTE: { id: 'NOTE', name: 'note', value: { id: 'v2', name: 'note value' } },
12
- OTHER: { id: 'OTHER', name: 'other', value: { id: 'v3', name: 'other value' } },
13
- }
14
-
15
- const customAttributes = { flags: ['FLAG'], notes: ['NOTE'] };
16
-
17
- expect(getHeaderTitle(dataflow, attributes, 'label', customAttributes)).to.deep.equal({
18
- label: 'dataflow',
19
- flags: [
20
- { code: 'v', header: 'flag:', label: 'flag value' },
21
- { code: undefined, header: 'note:', label: 'note value' },
22
- ]
23
- });
24
- });
25
- });
@@ -1,54 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getLayout } from '../src/rules2/src';
3
-
4
- describe('getLayout tests', () => {
5
- it('complete test', () => {
6
- const isTimeInverted = true;
7
- const dimensions = [
8
- { id: 'D1', values: [{ id: 'v1' }, { id: 'v2' }] },
9
- { id: 'D2', values: [{ id: 'v1' }, { id: 'v2' }] },
10
- { id: 'D3', values: [{ id: 'v1' }, { id: 'v2' }] },
11
- { id: 'D4', values: [{ id: 'v1' }, { id: 'v2' }] },
12
- { id: 'D5', values: [{ id: 'v1' }, { id: 'v2' }] },
13
- { id: 'TIME_PERIOD', values: [{ id: 'v1' }, { id: 'v2' }] }
14
- ];
15
-
16
- const layoutIds = {
17
- header: ['TIME_PERIOD', 'COMB1', 'COMB2'],
18
- sections: ['D4'],
19
- rows: ['COMB3', 'COMB4']
20
- };
21
-
22
- const combinations = [
23
- { id: 'COMB1', concepts: ['D1', 'D2'], relationship: ['D1', 'D2'] },
24
- { id: 'COMB2', concepts: ['D3', 'A1'], relationship: ['D3', 'D4', 'TIME_PERIOD'] },
25
- { id: 'COMB3', concepts: ['D4', 'D5'], relationship: ['D4', 'D5'] },
26
- { id: 'COMB4', concepts: ['A2', 'A3'], relationship: ['D5', 'TIME_PERIOD'] }
27
- ];
28
-
29
- expect(getLayout(layoutIds, dimensions, combinations, isTimeInverted)).to.deep.equal({
30
- header: [
31
- { id: 'TIME_PERIOD', isInverted: true, values: [{ id: 'v1' }, { id: 'v2' }] },
32
- {
33
- id: 'COMB1',
34
- concepts: ['D1', 'D2'],
35
- relationship: ['D1', 'D2'],
36
- dimensions: [
37
- { id: 'D1', values: [{ id: 'v1' }, { id: 'v2' }] },
38
- { id: 'D2', values: [{ id: 'v1' }, { id: 'v2' }] },
39
- ]
40
- },
41
- { id: 'D3', values: [{ id: 'v1' }, { id: 'v2' }] },
42
- ],
43
- sections: [{ id: 'D4', values: [{ id: 'v1' }, { id: 'v2' }] }],
44
- rows: [
45
- {
46
- id: 'COMB3',
47
- concepts: ['D4', 'D5'],
48
- relationship: ['D4', 'D5'],
49
- dimensions: [{ id: 'D5', values: [{ id: 'v1' }, { id: 'v2' }] }]
50
- },
51
- ]
52
- })
53
- });
54
- });