@sis-cc/dotstatsuite-components 17.12.6 → 17.14.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 (37) hide show
  1. package/lib/rules/src/get-values-enhanced.js +1 -1
  2. package/lib/rules/src/v8-transformer.js +6 -6
  3. package/lib/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +22 -17
  4. package/lib/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +10 -5
  5. package/lib/rules2/src/index.js +21 -21
  6. package/lib/rules2/src/parseMetadataSeries.js +1 -3
  7. package/lib/rules2/src/prepareData.js +2 -2
  8. package/lib/rules2/src/refineDimensions.js +3 -6
  9. package/lib/rules2/src/table/getLayoutData2.js +218 -0
  10. package/lib/rules2/src/table/getTableProps.js +6 -9
  11. package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +96 -0
  12. package/lib/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +53 -34
  13. package/package.json +1 -1
  14. package/src/rules/src/get-values-enhanced.js +33 -33
  15. package/src/rules/src/v8-transformer.js +6 -7
  16. package/src/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +24 -23
  17. package/src/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +31 -28
  18. package/src/rules2/src/index.js +5 -6
  19. package/src/rules2/src/parseMetadataSeries.js +5 -6
  20. package/src/rules2/src/prepareData.js +2 -2
  21. package/src/rules2/src/refineDimensions.js +3 -6
  22. package/src/rules2/src/table/getLayoutData2.js +175 -0
  23. package/src/rules2/src/table/getTableProps.js +8 -4
  24. package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +62 -0
  25. package/src/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +50 -21
  26. package/test/getLayoutData2.test.js +268 -0
  27. package/test/{hierarchiseDimensionWithAdvancedHierarchy.test.js → hierarchiseDimensionWithAdvancedHierarchy2.test.js} +34 -69
  28. package/test/{hierarchiseDimensionWithNativeHierarchy.test.js → hierarchiseDimensionWithNativeHierarchy2.test.js} +14 -14
  29. package/test/parseSeriesIndexesHierarchies.test.js +104 -0
  30. package/test/{refineLayoutSize.test.js → refineLayoutSize2.test.js} +63 -64
  31. package/test/refinedDimensions.test.js +8 -8
  32. package/lib/rules2/src/getSidebarData.js +0 -92
  33. package/lib/rules2/src/table/getLayoutData.js +0 -209
  34. package/src/rules2/src/getSidebarData.js +0 -85
  35. package/src/rules2/src/table/getLayoutData.js +0 -193
  36. package/test/getLayoutData.test.js +0 -284
  37. package/test/getSidebarData.test.js +0 -322
@@ -1,5 +1,5 @@
1
1
  import { expect } from 'chai';
2
- import { hierarchiseDimensionWithAdvancedHierarchy } from '../src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy';
2
+ import { hierarchiseDimensionWithAdvancedHierarchy } from '../src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2';
3
3
 
4
4
  describe('hierarchiseDimensionWithAdvancedHierarchy tests', () => {
5
5
  it('basic test', () => {
@@ -26,16 +26,16 @@ describe('hierarchiseDimensionWithAdvancedHierarchy tests', () => {
26
26
  const hierarchised = {
27
27
  id: 'test',
28
28
  values: [
29
- { id: 'OECD', parent: undefined, parents: [] },
30
- { id: 'GER', parent: 'OECD', parents: ['OECD'] },
31
- { id: 'FRA', parent: 'OECD', parents: ['OECD'] },
32
- { id: 'USA', parent: 'OECD', parents: ['OECD'] },
33
- { id: 'A', parent: undefined, parents: [] },
34
- { id: 'USA', parent: 'A', parents: ['A'] },
35
- { id: 'MEX', parent: 'A', parents: ['A'] },
36
- { id: 'EA', parent: undefined, parents: [] },
37
- { id: 'FRA', parent: 'EA', parents: ['EA'] },
38
- { id: 'GER', parent: 'EA', parents: ['EA'] },
29
+ { id: 'OECD', parent: undefined, parents: [], __indexPosition: 0 },
30
+ { id: 'GER', parent: 'OECD', parents: [0], __indexPosition: 1 },
31
+ { id: 'FRA', parent: 'OECD', parents: [0], __indexPosition: 2 },
32
+ { id: 'USA', parent: 'OECD', parents: [0], __indexPosition: 3 },
33
+ { id: 'A', parent: undefined, parents: [], __indexPosition: 4 },
34
+ { id: 'USA', parent: 'A', parents: [4], __indexPosition: 5 },
35
+ { id: 'MEX', parent: 'A', parents: [4], __indexPosition: 6 },
36
+ { id: 'EA', parent: undefined, parents: [], __indexPosition: 7 },
37
+ { id: 'FRA', parent: 'EA', parents: [7], __indexPosition: 8 },
38
+ { id: 'GER', parent: 'EA', parents: [7], __indexPosition: 9 },
39
39
  ]
40
40
  }
41
41
 
@@ -70,15 +70,15 @@ describe('hierarchiseDimensionWithAdvancedHierarchy tests', () => {
70
70
  const hierarchised = {
71
71
  id: 'test',
72
72
  values: [
73
- { id: 'AFK', parent: undefined, parents: [], __indexPosition: 3 },
74
- { id: 'USA', parent: undefined, parents: [], __indexPosition: 2 },
75
- { id: 'CAN', parent: undefined, parents: [], __indexPosition: 1 },
76
- { id: 'W', parent: undefined, parents: [], __indexPosition: 8 },
77
- { id: 'EA', parent: 'W', parents: ['W'], __indexPosition: 6 },
78
- { id: 'FRA', parent: 'EA', parents: ['W', 'EA'], __indexPosition: 5 },
79
- { id: 'IDF', parent: 'FRA', parents: ['W', 'EA', 'FRA'], __indexPosition: 0 },
80
- { id: 'GER', parent: 'EA', parents: ['W', 'EA'], __indexPosition: 4 },
81
- { id: 'A', parent: 'W', parents: ['W'], __indexPosition: 7 },
73
+ { id: 'AFK', parent: undefined, parents: [], __indexPosition: 0 },
74
+ { id: 'USA', parent: undefined, parents: [], __indexPosition: 1 },
75
+ { id: 'CAN', parent: undefined, parents: [], __indexPosition: 2 },
76
+ { id: 'W', parent: undefined, parents: [], __indexPosition: 3 },
77
+ { id: 'EA', parent: 'W', parents: [3], __indexPosition: 4 },
78
+ { id: 'FRA', parent: 'EA', parents: [3, 4], __indexPosition: 5 },
79
+ { id: 'IDF', parent: 'FRA', parents: [3, 4, 5], __indexPosition: 6 },
80
+ { id: 'GER', parent: 'EA', parents: [3, 4], __indexPosition: 7 },
81
+ { id: 'A', parent: 'W', parents: [3], __indexPosition: 8 },
82
82
  ]
83
83
  };
84
84
 
@@ -114,18 +114,18 @@ describe('hierarchiseDimensionWithAdvancedHierarchy tests', () => {
114
114
  const expected = {
115
115
  id: 'test',
116
116
  values: [
117
- { id: 'OECD', parents: [], parent: undefined },
118
- { id: 'USA', parents: ['OECD'], parent: 'OECD' },
119
- { id: 'NY', parents: ['OECD', 'USA'], parent: 'USA' },
120
- { id: 'SF', parents: ['OECD', 'USA'], parent: 'USA' },
121
- { id: 'LA', parents: ['OECD', 'USA'], parent: 'USA' },
122
- { id: 'FRA', parents: ['OECD'], parent: 'OECD' },
123
- { id: 'IDF', parents: ['OECD', 'FRA'], parent: 'FRA' },
124
- { id: 'UE', parents: [], parent: undefined },
125
- { id: 'FRA', parents: ['UE'], parent: 'UE' },
126
- { id: 'IDF', parents: ['UE', 'FRA'], parent: 'FRA' },
127
- { id: 'GER', parents: ['UE'], parent: 'UE' },
128
- { id: 'BER', parents: ['UE', 'GER'], parent: 'GER' },
117
+ { id: 'OECD', parents: [], parent: undefined, __indexPosition: 0 },
118
+ { id: 'USA', parents: [0], parent: 'OECD', __indexPosition: 1 },
119
+ { id: 'NY', parents: [0, 1], parent: 'USA', __indexPosition: 2 },
120
+ { id: 'SF', parents: [0, 1], parent: 'USA', __indexPosition: 3 },
121
+ { id: 'LA', parents: [0, 1], parent: 'USA', __indexPosition: 4 },
122
+ { id: 'FRA', parents: [0], parent: 'OECD', __indexPosition: 5 },
123
+ { id: 'IDF', parents: [0, 5], parent: 'FRA', __indexPosition: 6 },
124
+ { id: 'UE', parents: [], parent: undefined, __indexPosition: 7 },
125
+ { id: 'FRA', parents: [7], parent: 'UE', __indexPosition: 8 },
126
+ { id: 'IDF', parents: [7, 8], parent: 'FRA', __indexPosition: 9 },
127
+ { id: 'GER', parents: [7], parent: 'UE', __indexPosition: 10 },
128
+ { id: 'BER', parents: [7, 10], parent: 'GER', __indexPosition: 11 },
129
129
  ]
130
130
  };
131
131
 
@@ -149,46 +149,11 @@ describe('hierarchiseDimensionWithAdvancedHierarchy tests', () => {
149
149
  const expected = {
150
150
  id: 'REF_AREA',
151
151
  values: [
152
- { id: 'FRA', parents: [], parent: undefined },
153
- { id: 'USA', parents: [], parent: undefined }
152
+ { id: 'FRA', parents: [], parent: undefined, __indexPosition: 0 },
153
+ { id: 'USA', parents: [], parent: undefined, __indexPosition: 1 }
154
154
  ]
155
155
  };
156
156
 
157
157
  expect(hierarchiseDimensionWithAdvancedHierarchy(dimension, hierarchy)).to.deep.equal(expected);
158
158
  });
159
- it('non duplicates case 2', () => {
160
- const hierarchy = {
161
- '#ROOT': ['ONU', 'OECD'],
162
- 'ONU': ['USA', 'FRA'],
163
- 'OECD': ['FRA', 'USA'],
164
- 'ONU.USA': ['NY', 'LA'],
165
- 'ONU.FRA': ['PA', 'LY']
166
- };
167
-
168
- const dimension = {
169
- id: 'REF_AREA',
170
- values: [
171
- { id: 'OECD' },
172
- { id: 'FRA' },
173
- { id: 'PA' },
174
- { id: 'LY' },
175
- { id: 'USA' },
176
- { id: 'NY' },
177
- { id: 'LA' },
178
- ]
179
- };
180
-
181
- const expected = {
182
- id: 'REF_AREA',
183
- values: [
184
- { id: 'OECD', parents: [], parent: undefined },
185
- { id: 'FRA', parents: ['OECD'], parent: 'OECD' },
186
- { id: 'PA', parents: ['OECD.FRA'], parent: 'FRA' },
187
- { id: 'LY', parents: ['OECD.FRA'], parent: 'FRA' },
188
- { id: 'USA', parents: ['OECD'], parent: 'OECD' },
189
- { id: 'NY', parents: ['OECD.USA'], parent: 'USA' },
190
- { id: 'LA', parents: ['OECD.USA'], parent: 'USA' },
191
- ]
192
- };
193
- });
194
159
  });
@@ -1,5 +1,5 @@
1
1
  import { expect } from 'chai';
2
- import { hierarchiseDimensionWithNativeHierarchy } from '../src/rules2/src/hierarchiseDimensionWithNativeHierarchy';
2
+ import { hierarchiseDimensionWithNativeHierarchy } from '../src/rules2/src/hierarchiseDimensionWithNativeHierarchy2';
3
3
 
4
4
  describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
5
5
  it('basic test', () => {
@@ -19,11 +19,11 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
19
19
  id: 'test',
20
20
  values: [
21
21
  { id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
22
- { id: 'W', parent: undefined, parents: [], __indexPosition: 5 },
23
- { id: 'A', parent: 'W', parents: ['W'], __indexPosition: 20 },
24
- { id: 'EA', parent: 'W', parents: ['W'], __indexPosition: 30 },
25
- { id: 'GER', parent: 'EA', parents: ['W', 'EA'], __indexPosition: 100 },
26
- { id: 'FRA', parent: 'EA', parents: ['W', 'EA'], __indexPosition: 101 }
22
+ { id: 'W', parent: undefined, parents: [], __indexPosition: 1 },
23
+ { id: 'A', parent: 'W', parents: [1], __indexPosition: 2 },
24
+ { id: 'EA', parent: 'W', parents: [1], __indexPosition: 3 },
25
+ { id: 'GER', parent: 'EA', parents: [1, 3], __indexPosition: 4 },
26
+ { id: 'FRA', parent: 'EA', parents: [1, 3], __indexPosition: 5 }
27
27
  ]
28
28
  };
29
29
 
@@ -45,10 +45,10 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
45
45
  id: 'test',
46
46
  values: [
47
47
  { id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
48
- { id: 'A', parent: undefined, parents: [], __indexPosition: 20 },
49
- { id: 'EA', parent: undefined, parents: [], __indexPosition: 30 },
50
- { id: 'GER', parent: 'EA', parents: ['EA'], __indexPosition: 100 },
51
- { id: 'FRA', parent: 'EA', parents: ['EA'], __indexPosition: 101 }
48
+ { id: 'A', parent: undefined, parents: [], __indexPosition: 1 },
49
+ { id: 'EA', parent: undefined, parents: [], __indexPosition: 2 },
50
+ { id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3 },
51
+ { id: 'FRA', parent: 'EA', parents: [2], __indexPosition: 4 }
52
52
  ]
53
53
  };
54
54
 
@@ -70,10 +70,10 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
70
70
  id: 'test',
71
71
  values: [
72
72
  { id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
73
- { id: 'A', parent: undefined, parents: [], __indexPosition: 20 },
74
- { id: 'EA', parent: undefined, parents: [], __indexPosition: 30 },
75
- { id: 'GER', parent: 'EA', parents: ['EA'], __indexPosition: 100 },
76
- { id: '', parent: undefined, parents: [], __indexPosition: 101 }
73
+ { id: 'A', parent: undefined, parents: [], __indexPosition: 1 },
74
+ { id: 'EA', parent: undefined, parents: [], __indexPosition: 2 },
75
+ { id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3 },
76
+ { id: '', parent: undefined, parents: [], __indexPosition: 4 }
77
77
  ]
78
78
  };
79
79
 
@@ -0,0 +1,104 @@
1
+ import { expect } from 'chai';
2
+ import { parseSeriesIndexesHierarchies } from '../src/rules2/src/table/parseSeriesIndexesHierarchies';
3
+
4
+ describe('parseSeriesIndexesHierarchies tests', () => {
5
+ it('simple uniq flat', () => {
6
+ const dimensions = [
7
+ {
8
+ id: 'D0',
9
+ values: [
10
+ { id: 'v0' },
11
+ { id: 'v1' },
12
+ { id: 'v2' },
13
+ { id: 'v3' },
14
+ { id: 'v4' },
15
+ ]
16
+ },
17
+ ];
18
+
19
+ const seriesIndexes = [
20
+ [2],
21
+ [3],
22
+ [4]
23
+ ];
24
+
25
+ expect(parseSeriesIndexesHierarchies(seriesIndexes, dimensions)).to.deep.equal([
26
+ { indexes: [2], parentsIndexes: [[]], missingIndexes: [[]], registeredIndexes: [new Set([2])] },
27
+ { indexes: [3], parentsIndexes: [[]], missingIndexes: [[]], registeredIndexes: [new Set([2, 3])] },
28
+ { indexes: [4], parentsIndexes: [[]], missingIndexes: [[]], registeredIndexes: [new Set([2, 3, 4])] },
29
+ ])
30
+ });
31
+ it('more complex stuff', () => {
32
+ const dimensions = [
33
+ {
34
+ id: 'D0',
35
+ values: [
36
+ { id: 'v0' },
37
+ { id: 'v1' },
38
+ { id: 'v2' },
39
+ { id: 'v3' },
40
+ { id: 'v4' },
41
+ ]
42
+ },
43
+ {
44
+ id: 'D1',
45
+ values: [
46
+ { id: 'W', isSelected: true },
47
+ { id: 'NA', parents: [0], isSelected: false },
48
+ { id: 'A', parents: [0, 1], isSelected: true },
49
+ { id: 'USA', parents: [0, 1, 2], isSelected: true },
50
+ { id: 'CAN', parents: [0, 1, 2], isSelected: true },
51
+ { id: 'MEX', parents: [0, 1, 2], isSelected: true }
52
+ ]
53
+ }
54
+ ];
55
+
56
+ const seriesIndexes = [
57
+ [0, 3],
58
+ [0, 4],
59
+ [1, 5]
60
+ ];
61
+
62
+ expect(parseSeriesIndexesHierarchies(seriesIndexes, dimensions)).to.deep.equal([
63
+ { indexes: [0, 3], parentsIndexes: [[], []], missingIndexes: [[], [0, 2]], registeredIndexes: [new Set([0]), new Set([0, 2, 3])] },
64
+ { indexes: [0, 4], parentsIndexes: [[], [0, 2]], missingIndexes: [[], []], registeredIndexes: [new Set([0]), new Set([0, 2, 3, 4])] },
65
+ { indexes: [1, 5], parentsIndexes: [[], []], missingIndexes: [[], [0, 2]], registeredIndexes: [new Set([0, 1]), new Set([0, 2, 5])] },
66
+ ])
67
+ });
68
+ it('with combination', () => {
69
+ const dimensions = [
70
+ {
71
+ id: 'COMB',
72
+ dimensions: [{
73
+ values: [
74
+ { id: 'v0' },
75
+ { id: 'v1' },
76
+ { id: 'v2' },
77
+ { id: 'v3' },
78
+ { id: 'v4' },
79
+ ]
80
+ },
81
+ {
82
+ values: [
83
+ { id: 'W', isSelected: true },
84
+ { id: 'NA', parents: [0], isSelected: false },
85
+ { id: 'A', parents: [0, 1], isSelected: true },
86
+ { id: 'USA', parents: [0, 1, 2], isSelected: true },
87
+ { id: 'CAN', parents: [0, 1, 2], isSelected: true },
88
+ { id: 'MEX', parents: [0, 1, 2], isSelected: true }
89
+ ]
90
+ }]
91
+ },
92
+ ];
93
+
94
+ const seriesIndexes = [
95
+ [[0, 0]],
96
+ [[0, 1]],
97
+ ];
98
+
99
+ expect(parseSeriesIndexesHierarchies(seriesIndexes, dimensions)).to.deep.equal([
100
+ { indexes: [[0, 0]], parentsIndexes: [[[], []]], missingIndexes: [[[], []]], registeredIndexes: [[new Set([0]), new Set([0])]] },
101
+ { indexes: [[0, 1]], parentsIndexes: [[[], [0]]], missingIndexes: [[[], []]], registeredIndexes: [[new Set([0]), new Set([0, 1])]] },
102
+ ])
103
+ });
104
+ });
@@ -1,6 +1,5 @@
1
1
  import { expect } from 'chai';
2
- //import { refineLayoutSize } from '../src/rules/src/table/factories/refineLayoutSize';
3
- import { refineLayoutSize } from '../src/rules2/src/';
2
+ import { refineLayoutSize } from '../src/rules2/src/table/refineLayoutSize2';
4
3
 
5
4
  const observations1 = {
6
5
  '0:0:0': { orderedDimIndexes: [0, 0, 0] },
@@ -100,7 +99,7 @@ const partialObservations3 = {
100
99
  '2:2:2': { orderedDimIndexes: [2, 2, 2] },
101
100
  };
102
101
 
103
- describe('refineLayoutSize tests', () => {
102
+ describe('refineLayoutSize 2 tests', () => {
104
103
  it('no changes under limit', () => {
105
104
  const layout = {
106
105
  header: [{ __index: 0 }],
@@ -109,22 +108,22 @@ describe('refineLayoutSize tests', () => {
109
108
  };
110
109
 
111
110
  const layoutIndexes = {
112
- header: [[0], [1], [2]],
111
+ header: [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }],
113
112
  sections: [
114
- [[0], [[0], [1], [2]]],
115
- [[1], [[0], [1], [2]]],
116
- [[2], [[0], [1], [2]]]
113
+ [{ indexes: [0] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]],
114
+ [{ indexes: [1] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]],
115
+ [{ indexes: [2] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]]
117
116
  ]
118
117
  };
119
118
 
120
119
  const expected = {
121
120
  truncated: false,
122
121
  totalCells: 57,
123
- header: [[0], [1], [2]],
122
+ header: [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }],
124
123
  sections: [
125
- [[0], [[0], [1], [2]]],
126
- [[1], [[0], [1], [2]]],
127
- [[2], [[0], [1], [2]]]
124
+ [{ indexes: [0] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]],
125
+ [{ indexes: [1] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]],
126
+ [{ indexes: [2] }, [{ indexes: [0] }, { indexes: [1] }, { indexes: [2] }]]
128
127
  ]
129
128
  };
130
129
  expect(
@@ -143,38 +142,38 @@ describe('refineLayoutSize tests', () => {
143
142
  };
144
143
 
145
144
  const layoutIndexes = {
146
- header: [[]],
145
+ header: [{ indexes: [] }],
147
146
  sections: [
148
147
  [
149
- [],
148
+ { indexes: [] },
150
149
  [
151
- [0, 0, 0],
152
- [0, 0, 1],
153
- [0, 0, 2],
154
- [0, 1, 0],
155
- [0, 1, 1],
156
- [0, 1, 2],
157
- [0, 2, 0],
158
- [0, 2, 1],
159
- [0, 2, 2],
160
- [1, 0, 0],
161
- [1, 0, 1],
162
- [1, 0, 2],
163
- [1, 1, 0],
164
- [1, 1, 1],
165
- [1, 1, 2],
166
- [1, 2, 0],
167
- [1, 2, 1],
168
- [1, 2, 2],
169
- [2, 0, 0],
170
- [2, 0, 1],
171
- [2, 0, 2],
172
- [2, 1, 0],
173
- [2, 1, 1],
174
- [2, 1, 2],
175
- [2, 2, 0],
176
- [2, 2, 1],
177
- [2, 2, 2]
150
+ { indexes: [0, 0, 0] },
151
+ { indexes: [0, 0, 1] },
152
+ { indexes: [0, 0, 2] },
153
+ { indexes: [0, 1, 0] },
154
+ { indexes: [0, 1, 1] },
155
+ { indexes: [0, 1, 2] },
156
+ { indexes: [0, 2, 0] },
157
+ { indexes: [0, 2, 1] },
158
+ { indexes: [0, 2, 2] },
159
+ { indexes: [1, 0, 0] },
160
+ { indexes: [1, 0, 1] },
161
+ { indexes: [1, 0, 2] },
162
+ { indexes: [1, 1, 0] },
163
+ { indexes: [1, 1, 1] },
164
+ { indexes: [1, 1, 2] },
165
+ { indexes: [1, 2, 0] },
166
+ { indexes: [1, 2, 1] },
167
+ { indexes: [1, 2, 2] },
168
+ { indexes: [2, 0, 0] },
169
+ { indexes: [2, 0, 1] },
170
+ { indexes: [2, 0, 2] },
171
+ { indexes: [2, 1, 0] },
172
+ { indexes: [2, 1, 1] },
173
+ { indexes: [2, 1, 2] },
174
+ { indexes: [2, 2, 0] },
175
+ { indexes: [2, 2, 1] },
176
+ { indexes: [2, 2, 2] }
178
177
  ]
179
178
  ]
180
179
  ]
@@ -183,31 +182,31 @@ describe('refineLayoutSize tests', () => {
183
182
  const expected = {
184
183
  totalCells: 140,
185
184
  truncated: true,
186
- header: [[]],
185
+ header: [{ indexes: [] }],
187
186
  sections: [
188
187
  [
189
- [],
188
+ { indexes: [] },
190
189
  [
191
- [0, 0, 0],
192
- [0, 0, 1],
193
- [0, 0, 2],
194
- [0, 1, 0],
195
- [0, 1, 1],
196
- [0, 1, 2],
197
- [0, 2, 0],
198
- [0, 2, 1],
199
- [0, 2, 2],
200
- [1, 0, 0],
201
- [1, 0, 1],
202
- [1, 0, 2],
203
- [1, 1, 0],
204
- [1, 1, 1],
205
- [1, 1, 2],
206
- [1, 2, 0],
207
- [1, 2, 1],
208
- [1, 2, 2],
209
- [2, 0, 0],
210
- [2, 0, 1]
190
+ { indexes: [0, 0, 0] },
191
+ { indexes: [0, 0, 1] },
192
+ { indexes: [0, 0, 2] },
193
+ { indexes: [0, 1, 0] },
194
+ { indexes: [0, 1, 1] },
195
+ { indexes: [0, 1, 2] },
196
+ { indexes: [0, 2, 0] },
197
+ { indexes: [0, 2, 1] },
198
+ { indexes: [0, 2, 2] },
199
+ { indexes: [1, 0, 0] },
200
+ { indexes: [1, 0, 1] },
201
+ { indexes: [1, 0, 2] },
202
+ { indexes: [1, 1, 0] },
203
+ { indexes: [1, 1, 1] },
204
+ { indexes: [1, 1, 2] },
205
+ { indexes: [1, 2, 0] },
206
+ { indexes: [1, 2, 1] },
207
+ { indexes: [1, 2, 2] },
208
+ { indexes: [2, 0, 0] },
209
+ { indexes: [2, 0, 1] }
211
210
  ]
212
211
  ]
213
212
  ]
@@ -221,7 +220,7 @@ describe('refineLayoutSize tests', () => {
221
220
  })(layoutIndexes)
222
221
  ).to.deep.equal(expected);
223
222
  });
224
- it('no rows', () => {
223
+ /*it('no rows', () => {
225
224
 
226
225
  const layout = {
227
226
  header: [{ __index: 0 }, { __index: 1 }, { __index: 2 }],
@@ -3121,5 +3120,5 @@ describe('refineLayoutSize tests', () => {
3121
3120
  limit: 800,
3122
3121
  })(indexes)
3123
3122
  ).to.deep.equal(expected);
3124
- });
3123
+ });*/
3125
3124
  });
@@ -22,14 +22,14 @@ describe('refine dimensions tests', () => {
22
22
 
23
23
  expect(refineDimensions(dimensions, dataquery)).to.deep.equal([
24
24
  { id: 'd0', values: [], header: true },
25
- { id: 'd1', values: [{ id: 'v0' }], header: true },
26
- { id: 'd2', values: [{ id: 'v0' }, { id: 'v1', empty: true }, { id: 'v2', empty: true }], header: true },
27
- { id: 'd3', values: [{ id: 'v0' }, { id: 'v1' }, { id: 'v2', empty: true }], header: false },
28
- { id: 'd4', values: [{ id: 'v0' }, { id: 'v1' }, { id: 'v2' }], header: false },
29
- { id: 'd5', values: [{ id: 'v0' }], header: true },
30
- { id: 'd6', values: [{ id: 'v0' }, { id: 'v1' }], header: false },
31
- { id: 'd7', values: [{ id: 'v0' }], header: true },
32
- { id: 'd8', values: [{ id: 'v0' }, { id: 'v1' }], header: false }
25
+ { id: 'd1', values: [{ id: 'v0', isSelected: true }], header: true },
26
+ { id: 'd2', values: [{ id: 'v0', isSelected: true }, { id: 'v1', empty: true }, { id: 'v2', empty: true }], header: true },
27
+ { id: 'd3', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }, { id: 'v2', empty: true }], header: false },
28
+ { id: 'd4', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }, { id: 'v2', isSelected: true }], header: false },
29
+ { id: 'd5', values: [{ id: 'v0', isSelected: true }], header: true },
30
+ { id: 'd6', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }], header: false },
31
+ { id: 'd7', values: [{ id: 'v0', isSelected: true }], header: true },
32
+ { id: 'd8', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }], header: false }
33
33
  ]);
34
34
  })
35
35
  });
@@ -1,92 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getSidebarData = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- var _src = require('../../rules/src');
17
-
18
- var _constants = require('./constants');
19
-
20
- 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; } }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- var sortByCoordinates = function sortByCoordinates(a, b) {
25
- var splitACoord = a.splitCoord;
26
- var splitBCoord = b.splitCoord;
27
-
28
- var aWeight = R.pipe(R.reject(R.isEmpty), R.length)(splitACoord);
29
- var bWeight = R.pipe(R.reject(R.isEmpty), R.length)(splitBCoord);
30
- if (aWeight !== bWeight) {
31
- return bWeight - aWeight;
32
- }
33
-
34
- var ind = 0;
35
- while (splitACoord[ind] === splitBCoord[ind]) {
36
- ind++;
37
- }
38
- var _a = R.isEmpty(splitACoord[ind]) ? 0 : Number(splitACoord[ind]);
39
- var _b = R.isEmpty(splitBCoord[ind]) ? 0 : Number(splitBCoord[ind]);
40
- return _b - _a;
41
- };
42
-
43
- // options = { display, attributesLabel }
44
- var getSidebarData = exports.getSidebarData = function getSidebarData(attributesSeries, metadataSeries, dataflow, dimensions, options) {
45
- var coordinates = R.uniq(R.concat(R.keys(attributesSeries), R.keys(metadataSeries)));
46
- return R.pipe(R.map(function (coordinate) {
47
- var attributes = R.prop(coordinate, attributesSeries);
48
- var metadata = R.prop(coordinate, metadataSeries);
49
- var children = R.concat(R.isNil(attributes) ? [] : [{ id: coordinate + '-attr', label: options.attributesLabel, children: attributes }], R.isNil(metadata) ? [] : metadata);
50
- var splitCoord = R.split(':', coordinate);
51
-
52
- var _R$addIndex = R.addIndex(R.reduce)(function (acc, valIndex, dimIndex) {
53
- if (R.isEmpty(valIndex)) {
54
- return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
55
- }
56
- var dim = R.nth(dimIndex, dimensions);
57
- var values = R.propOr([], 'values', dim || {});
58
- var value = R.nth(Number(valIndex), values);
59
- if (!value || !R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value) || R.includes(R.prop('id', value), _constants.REJECTED_VALUE_IDS)) {
60
- return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
61
- }
62
- var dimLabel = (0, _src.dimensionValueDisplay)(options.display)(dim);
63
- var valLabel = (0, _src.dimensionValueDisplay)(options.display)(value);
64
- return {
65
- labels: R.append(dimLabel + ': ' + valLabel, acc.labels),
66
- split: R.append(valIndex, acc.split)
67
- };
68
- }, { split: [], labels: [] }, splitCoord),
69
- split = _R$addIndex.split,
70
- labels = _R$addIndex.labels;
71
-
72
- var label = R.isEmpty(labels) ? (0, _src.dimensionValueDisplay)(options.display)(dataflow) : R.join(' - ', labels);
73
-
74
- return {
75
- id: R.join(':', split),
76
- splitCoord: split,
77
- label: label,
78
- children: R.filter(R.identity, children)
79
- };
80
- }), function (series) {
81
- // after removed non displayed dim vals, some series might be duplicated
82
- var grouped = R.groupBy(R.prop('id'), series);
83
- return R.pipe(R.map(function (entries) {
84
- if (R.length(entries) === 1) {
85
- return R.head(entries);
86
- }
87
- var head = R.head(entries);
88
- var children = R.pipe(R.pluck('children'), R.unnest)(entries);
89
- return R.assoc('children', children, head);
90
- }), R.values)(grouped);
91
- }, R.sort(sortByCoordinates))(coordinates);
92
- };