@sis-cc/dotstatsuite-components 9.1.0 → 9.2.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 (80) hide show
  1. package/lib/rules/src/preparators/enhanceObservations.js +155 -0
  2. package/lib/rules/src/preparators/formatValue.js +77 -0
  3. package/lib/rules/src/preparators/getDimensions.js +55 -0
  4. package/lib/rules/src/preparators/getDisplay.js +32 -0
  5. package/lib/rules/src/preparators/getObservations.js +27 -0
  6. package/lib/rules/src/table/factories/getCells.js +1 -3
  7. package/lib/rules/src/table/factories/getLayoutData.js +102 -161
  8. package/lib/rules/src/table/factories/getSortedLayoutIndexes.js +118 -0
  9. package/lib/rules/src/table/factories/getTableData.js +12 -10
  10. package/lib/rules/src/table/factories/refineLayoutSize.js +210 -0
  11. package/lib/rules/src/table/preparators/prepareData.js +23 -23
  12. package/lib/rules/src/table/units/appendUnitsInLayoutDataEntry.js +10 -10
  13. package/lib/rules/src/table/units/getAttachmentSeriesIndexes.js +1 -1
  14. package/lib/rules/src/table/units/getUnitsSeries.js +31 -0
  15. package/lib/rules/src/v8-transformer.js +3 -2
  16. package/package.json +2 -2
  17. package/src/rules/src/preparators/enhanceObservations.js +163 -0
  18. package/src/rules/src/preparators/formatValue.js +73 -0
  19. package/src/rules/src/preparators/getDimensions.js +49 -0
  20. package/src/rules/src/preparators/getDisplay.js +20 -0
  21. package/src/rules/src/preparators/getObservations.js +19 -0
  22. package/src/rules/src/table/factories/getCells.js +3 -7
  23. package/src/rules/src/table/factories/getLayoutData.js +135 -184
  24. package/src/rules/src/table/factories/getSortedLayoutIndexes.js +108 -0
  25. package/src/rules/src/table/factories/getTableData.js +10 -10
  26. package/src/rules/src/table/factories/refineLayoutSize.js +224 -0
  27. package/src/rules/src/table/preparators/prepareData.js +23 -32
  28. package/src/rules/src/table/units/appendUnitsInLayoutDataEntry.js +15 -18
  29. package/src/rules/src/table/units/getAttachmentSeriesIndexes.js +2 -1
  30. package/src/rules/src/table/units/getUnitsSeries.js +20 -0
  31. package/src/rules/src/v8-transformer.js +4 -2
  32. package/test/appendUnitsInLayoutDataEntry.test.js +3 -3
  33. package/test/enhanceObservations.test.js +270 -0
  34. package/test/getAttachmentSeriesIndexes.test.js +1 -1
  35. package/test/getCells.test.js +4 -39
  36. package/test/getLayoutData2.test.js +194 -0
  37. package/test/getOneValueDimensions.test.js +1 -1
  38. package/test/getSortedLayoutIndexes.test.js +80 -0
  39. package/test/getUnitsArtefacts.test.js +1 -1
  40. package/test/getUnitsSeries.test.js +64 -0
  41. package/test/mocks/table-layout-multi-hierarchies--layout.json +621 -0
  42. package/test/mocks/table-layout-multi-hierarchies--layoutData.json +32410 -0
  43. package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +2760 -0
  44. package/test/mocks/table-layout-multi-hierarchies--observations.json +30688 -0
  45. package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +2761 -0
  46. package/test/mocks/table-layout-truncation1--layout.json +27469 -0
  47. package/test/mocks/table-layout-truncation1--layoutData.json +19413 -0
  48. package/test/mocks/table-layout-truncation1--layoutIndexes.json +7512 -0
  49. package/test/mocks/table-layout-truncation1--observations.json +70002 -0
  50. package/test/mocks/table-layout-truncation1--sizedIndexes.json +3010 -0
  51. package/test/mocks/table-prep-multi-hierarchies--attributes.json +44 -0
  52. package/test/mocks/table-prep-multi-hierarchies--dimensions.json +688 -0
  53. package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +19696 -0
  54. package/test/mocks/table-prep-multi-hierarchies--observations.json +8246 -0
  55. package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +2985 -0
  56. package/test/mocks/table-prep-truncation1--dimensions.json +35057 -0
  57. package/test/mocks/table-prep-truncation1--enhancedObservations.json +70002 -0
  58. package/test/mocks/table-prep-truncation1--observations.json +27502 -0
  59. package/test/mocks/table-prep-truncation1--sdmxJson.json +55103 -0
  60. package/test/mocks/table-prep-units--observations.json +284286 -0
  61. package/test/mocks/table-prep-units--unitsSeries.json +41042 -0
  62. package/test/parseAttributes.test.js +1 -1
  63. package/test/refineLayoutSize.test.js +415 -0
  64. package/test/table-layout-perf.test.js +74 -0
  65. package/test/table-prep-perf.test.js +65 -0
  66. package/lib/rules/src/table/factories/getSortedLayoutData.js +0 -145
  67. package/lib/rules/src/table/factories/refineLayoutHierarchy.js +0 -61
  68. package/lib/rules/src/table/preparators/parseObservations.js +0 -76
  69. package/lib/rules/src/table/units/getUnitsSeriesOccurences.js +0 -39
  70. package/src/rules/src/table/factories/getSortedLayoutData.js +0 -133
  71. package/src/rules/src/table/factories/refineLayoutHierarchy.js +0 -64
  72. package/src/rules/src/table/preparators/parseObservations.js +0 -81
  73. package/src/rules/src/table/units/getUnitsSeriesOccurences.js +0 -51
  74. package/test/appendUnitsInLayoutData.test.js +0 -248
  75. package/test/getLayoutData.test.js +0 -311
  76. package/test/getSortedLayoutData.test.js +0 -382
  77. package/test/getUnitsSeriesOccurences.test.js +0 -133
  78. package/test/parseObservations.test.js +0 -116
  79. package/test/refineDimSeriesUnits.test.js +0 -24
  80. package/test/refineLayoutHierarchy.test.js +0 -79
@@ -1,79 +0,0 @@
1
- import { expect } from 'chai';
2
- import { refineLayoutHierarchy } from '../src/rules/src/table/factories/refineLayoutHierarchy';
3
-
4
- const values = [
5
- { id: '1', name: '1', parents: [] },
6
- { id: '1.1', name: '1.1', parents: ['1'] },
7
- { id: '1.1.1', name: '1.1.1', parents: ['1', '1.1'] },
8
- { id: '1.1.1.1', name: '1.1.1.1', parents: ['1', '1.1', '1.1.1'] },
9
- { id: '2', name: '2', parents: [] },
10
- { id: '3', name: '3', parents: [] }
11
- ];
12
-
13
- describe('refineLayoutHierarchy tests', () => {
14
- it('one missing parent', () => {
15
- const sections = [[[], [
16
- [{}, {}, { value: values[0] }],
17
- [{}, {}, { value: values[2] }],
18
- [{}, {}, { value: values[3] }],
19
- [{}, {}, { value: values[4] }],
20
- [{}, {}, { value: values[5] }],
21
- ]]];
22
- expect(refineLayoutHierarchy(sections, { values })).to.deep.equal([[[], [
23
- [{}, {}, { value: values[0] }],
24
- [{}, {}, { value: { id: '1.1.1', name: '1.1 > 1.1.1', parents: ['1'] } }],
25
- [{}, {}, { value: { id: '1.1.1.1', name: '1.1.1.1', parents: ['1', '1.1.1'] } }],
26
- [{}, {}, { value: values[4] }],
27
- [{}, {}, { value: values[5] }],
28
- ]]]);
29
- });
30
- it('many missing parents consecutives', () => {
31
- const sections = [[[], [
32
- [{}, {}, { value: values[0] }],
33
- [{}, {}, { value: values[3] }],
34
- [{}, {}, { value: values[4] }],
35
- [{}, {}, { value: values[5] }],
36
- ]]];
37
- expect(refineLayoutHierarchy(sections, { values })).to.deep.equal([[[], [
38
- [{}, {}, { value: values[0] }],
39
- [{}, {}, { value: { id: '1.1.1.1', name: '1.1 > 1.1.1 > 1.1.1.1', parents: ['1'] } }],
40
- [{}, {}, { value: values[4] }],
41
- [{}, {}, { value: values[5] }],
42
- ]]]);
43
- });
44
- it('holes in the tree', () => {
45
- const sections = [[[], [
46
- [{}, {}, { value: values[1] }],
47
- [{}, {}, { value: values[3] }],
48
- [{}, {}, { value: values[4] }],
49
- [{}, {}, { value: values[5] }],
50
- ]]];
51
- expect(refineLayoutHierarchy(sections, { values })).to.deep.equal([[[], [
52
- [{}, {}, { value: { id: '1.1', name: '1 > 1.1', parents: [] } }],
53
- [{}, {}, { value: { id: '1.1.1.1', name: '1.1.1 > 1.1.1.1', parents: ['1.1'] } }],
54
- [{}, {}, { value: values[4] }],
55
- [{}, {}, { value: values[5] }],
56
- ]]]);
57
- });
58
- it('no missing parents', () => {
59
- const sections = [[[], [
60
- [{}, {}, { value: values[0] }],
61
- [{}, {}, { value: values[1] }],
62
- [{}, {}, { value: values[2] }],
63
- [{}, {}, { value: values[3] }],
64
- [{}, {}, { value: values[4] }],
65
- [{}, {}, { value: values[5] }],
66
- ]]];
67
- expect(refineLayoutHierarchy(sections, { values })).to.deep.equal(sections);
68
- });
69
- it('no hierarchy', () => {
70
- const values = [{ id: '1' }, { id: '2' }, { id: '3' }, { id: '4' }];
71
- const sections = [[[], [
72
- [{}, {}, {}, {}, { value: values[0] }],
73
- [{}, {}, {}, {}, { value: values[1] }],
74
- [{}, {}, {}, {}, { value: values[2] }],
75
- [{}, {}, {}, {}, { value: values[3] }],
76
- ]]];
77
- expect(refineLayoutHierarchy(sections, { values })).to.deep.equal(sections);
78
- });
79
- });