@sis-cc/dotstatsuite-components 17.12.5 → 17.13.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.
- package/lib/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +22 -17
- package/lib/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +10 -5
- package/lib/rules2/src/index.js +21 -12
- package/lib/rules2/src/parseCombinations.js +26 -3
- package/lib/rules2/src/prepareData.js +2 -2
- package/lib/rules2/src/refineDimensions.js +3 -6
- package/lib/rules2/src/table/getLayoutData2.js +218 -0
- package/lib/rules2/src/table/getTableProps.js +6 -9
- package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +96 -0
- package/lib/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +53 -34
- package/package.json +1 -1
- package/src/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +24 -23
- package/src/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +31 -28
- package/src/rules2/src/index.js +5 -5
- package/src/rules2/src/parseCombinations.js +84 -42
- package/src/rules2/src/prepareData.js +2 -2
- package/src/rules2/src/refineDimensions.js +3 -6
- package/src/rules2/src/table/getLayoutData2.js +175 -0
- package/src/rules2/src/table/getTableProps.js +8 -4
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +62 -0
- package/src/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +50 -21
- package/test/getLayoutData2.test.js +268 -0
- package/test/{hierarchiseDimensionWithAdvancedHierarchy.test.js → hierarchiseDimensionWithAdvancedHierarchy2.test.js} +34 -69
- package/test/{hierarchiseDimensionWithNativeHierarchy.test.js → hierarchiseDimensionWithNativeHierarchy2.test.js} +14 -14
- package/test/parseCombinations.test.js +134 -20
- package/test/parseSeriesIndexesHierarchies.test.js +104 -0
- package/test/{refineLayoutSize.test.js → refineLayoutSize2.test.js} +63 -64
- package/test/refinedDimensions.test.js +8 -8
- package/lib/rules2/src/table/getLayoutData.js +0 -209
- package/src/rules2/src/table/getLayoutData.js +0 -193
- package/test/getLayoutData.test.js +0 -284
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import { hierarchiseDimensionWithAdvancedHierarchy } from '../src/rules2/src/
|
|
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: [
|
|
31
|
-
{ id: 'FRA', parent: 'OECD', parents: [
|
|
32
|
-
{ id: 'USA', parent: 'OECD', parents: [
|
|
33
|
-
{ id: 'A', parent: undefined, parents: [] },
|
|
34
|
-
{ id: 'USA', parent: 'A', parents: [
|
|
35
|
-
{ id: 'MEX', parent: 'A', parents: [
|
|
36
|
-
{ id: 'EA', parent: undefined, parents: [] },
|
|
37
|
-
{ id: 'FRA', parent: 'EA', parents: [
|
|
38
|
-
{ id: 'GER', parent: 'EA', parents: [
|
|
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:
|
|
74
|
-
{ id: 'USA', parent: undefined, parents: [], __indexPosition:
|
|
75
|
-
{ id: 'CAN', parent: undefined, parents: [], __indexPosition:
|
|
76
|
-
{ id: 'W', parent: undefined, parents: [], __indexPosition:
|
|
77
|
-
{ id: 'EA', parent: 'W', parents: [
|
|
78
|
-
{ id: 'FRA', parent: 'EA', parents: [
|
|
79
|
-
{ id: 'IDF', parent: 'FRA', parents: [
|
|
80
|
-
{ id: 'GER', parent: 'EA', parents: [
|
|
81
|
-
{ id: 'A', parent: 'W', parents: [
|
|
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: [
|
|
119
|
-
{ id: 'NY', parents: [
|
|
120
|
-
{ id: 'SF', parents: [
|
|
121
|
-
{ id: 'LA', parents: [
|
|
122
|
-
{ id: 'FRA', parents: [
|
|
123
|
-
{ id: 'IDF', parents: [
|
|
124
|
-
{ id: 'UE', parents: [], parent: undefined },
|
|
125
|
-
{ id: 'FRA', parents: [
|
|
126
|
-
{ id: 'IDF', parents: [
|
|
127
|
-
{ id: 'GER', parents: [
|
|
128
|
-
{ id: 'BER', parents: [
|
|
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/
|
|
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:
|
|
23
|
-
{ id: 'A', parent: 'W', parents: [
|
|
24
|
-
{ id: 'EA', parent: 'W', parents: [
|
|
25
|
-
{ id: 'GER', parent: 'EA', parents: [
|
|
26
|
-
{ id: 'FRA', parent: 'EA', parents: [
|
|
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:
|
|
49
|
-
{ id: 'EA', parent: undefined, parents: [], __indexPosition:
|
|
50
|
-
{ id: 'GER', parent: 'EA', parents: [
|
|
51
|
-
{ id: 'FRA', parent: 'EA', parents: [
|
|
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:
|
|
74
|
-
{ id: 'EA', parent: undefined, parents: [], __indexPosition:
|
|
75
|
-
{ id: 'GER', parent: 'EA', parents: [
|
|
76
|
-
{ id: '', parent: undefined, parents: [], __indexPosition:
|
|
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
|
|
|
@@ -13,38 +13,152 @@ describe('parseCombinations tests', () => {
|
|
|
13
13
|
{ id: 'COMB7', concepts: ['ATTR5', 'ATTR6'] },
|
|
14
14
|
{ id: 'COMB8', concepts: ['DIM5', 'DIM6'] },
|
|
15
15
|
{ id: 'COMB9', concepts: ['DIM1', 'ATTR5'] },
|
|
16
|
-
{ id: 'COMB10', concepts: ['DIM4', 'ATTR5'] }
|
|
16
|
+
{ id: 'COMB10', concepts: ['DIM4', 'ATTR5'] },
|
|
17
|
+
{ id: 'COMB11', concepts: ['DIM4', 'DIM7'] },
|
|
18
|
+
{ id: 'COMB12', concepts: ['DIM4', 'ATTR7'] },
|
|
19
|
+
{ id: 'COMB13', concepts: ['DIM7', 'ATTR7'] },
|
|
17
20
|
];
|
|
18
21
|
|
|
19
22
|
const dimensions = [
|
|
20
|
-
{ id: 'DIM1',
|
|
21
|
-
{ id: 'DIM2',
|
|
22
|
-
{ id: 'DIM3',
|
|
23
|
-
{ id: 'DIM4',
|
|
24
|
-
{
|
|
25
|
-
|
|
23
|
+
{ id: 'DIM1', header: true, values: [{ id: 'v1' }] },
|
|
24
|
+
{ id: 'DIM2', header: true, values: [{ id: 'v1' }] },
|
|
25
|
+
{ id: 'DIM3', header: false, values: [{ id: 'v1' }, { id: 'v2' }] },
|
|
26
|
+
{ id: 'DIM4', header: false, values: [{ id: 'v1' }, { id: 'v2' }] },
|
|
27
|
+
{
|
|
28
|
+
id: 'DIM5',
|
|
29
|
+
header: false,
|
|
30
|
+
values: [{ id: '_Z' }, { id: 'v2', display: false }],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'DIM6',
|
|
34
|
+
header: false,
|
|
35
|
+
values: [
|
|
36
|
+
{ id: 'v1', display: false },
|
|
37
|
+
{ id: 'v2', display: false },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'DIM7',
|
|
42
|
+
header: false,
|
|
43
|
+
values: [],
|
|
44
|
+
},
|
|
26
45
|
];
|
|
27
46
|
|
|
28
47
|
const attributes = [
|
|
29
48
|
{ id: 'ATTR1', header: true, relationship: [], values: [{ id: 'v' }] },
|
|
30
|
-
{
|
|
49
|
+
{
|
|
50
|
+
id: 'ATTR2',
|
|
51
|
+
header: true,
|
|
52
|
+
relationship: ['DIM1'],
|
|
53
|
+
values: [{ id: 'v' }],
|
|
54
|
+
},
|
|
31
55
|
{ id: 'ATTR3', header: true, relationship: [], values: [{ id: 'v' }] },
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
56
|
+
{
|
|
57
|
+
id: 'ATTR4',
|
|
58
|
+
series: true,
|
|
59
|
+
relationship: ['DIM3', 'DIM4'],
|
|
60
|
+
values: [{ id: 'v' }],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'ATTR5',
|
|
64
|
+
series: true,
|
|
65
|
+
display: false,
|
|
66
|
+
relationship: ['DIM5'],
|
|
67
|
+
values: [{ id: 'v' }],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'ATTR6',
|
|
71
|
+
series: true,
|
|
72
|
+
relationship: [],
|
|
73
|
+
values: [{ id: '0', display: false }, { id: '_Z' }],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'ATTR7',
|
|
77
|
+
series: true,
|
|
78
|
+
relationship: [],
|
|
79
|
+
values: [],
|
|
80
|
+
},
|
|
35
81
|
];
|
|
36
82
|
|
|
37
|
-
expect(
|
|
83
|
+
expect(
|
|
84
|
+
parseCombinations(combinations, attributes, dimensions),
|
|
85
|
+
).to.deep.equal([
|
|
38
86
|
{ id: 'COMB1', concepts: ['DIM1', 'DIM2'], header: true, display: true },
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
87
|
+
{
|
|
88
|
+
id: 'COMB2',
|
|
89
|
+
concepts: ['DIM3', 'DIM4'],
|
|
90
|
+
series: true,
|
|
91
|
+
relationship: ['DIM3', 'DIM4'],
|
|
92
|
+
display: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'COMB3',
|
|
96
|
+
concepts: ['ATTR1', 'ATTR2'],
|
|
97
|
+
header: true,
|
|
98
|
+
display: true,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'COMB4',
|
|
102
|
+
concepts: ['ATTR3', 'ATTR4'],
|
|
103
|
+
series: true,
|
|
104
|
+
relationship: ['DIM3', 'DIM4'],
|
|
105
|
+
display: true,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'COMB5',
|
|
109
|
+
concepts: ['DIM1', 'ATTR4'],
|
|
110
|
+
series: true,
|
|
111
|
+
relationship: ['DIM3', 'DIM4'],
|
|
112
|
+
display: true,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 'COMB6',
|
|
116
|
+
concepts: ['DIM5', 'ATTR5'],
|
|
117
|
+
series: true,
|
|
118
|
+
relationship: ['DIM5'],
|
|
119
|
+
display: true,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'COMB7',
|
|
123
|
+
concepts: ['ATTR5', 'ATTR6'],
|
|
124
|
+
header: true,
|
|
125
|
+
display: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'COMB8',
|
|
129
|
+
concepts: ['DIM5', 'DIM6'],
|
|
130
|
+
series: true,
|
|
131
|
+
relationship: ['DIM5', 'DIM6'],
|
|
132
|
+
display: true,
|
|
133
|
+
},
|
|
46
134
|
{ id: 'COMB9', concepts: ['DIM1', 'ATTR5'], header: true, display: true },
|
|
47
|
-
{
|
|
135
|
+
{
|
|
136
|
+
id: 'COMB10',
|
|
137
|
+
concepts: ['DIM4', 'ATTR5'],
|
|
138
|
+
series: true,
|
|
139
|
+
relationship: ['DIM4'],
|
|
140
|
+
display: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'COMB11',
|
|
144
|
+
concepts: ['DIM4'],
|
|
145
|
+
series: true,
|
|
146
|
+
relationship: ['DIM4'],
|
|
147
|
+
display: true,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: 'COMB12',
|
|
151
|
+
concepts: ['DIM4'],
|
|
152
|
+
series: true,
|
|
153
|
+
relationship: ['DIM4'],
|
|
154
|
+
display: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: 'COMB13',
|
|
158
|
+
concepts: [],
|
|
159
|
+
display: false,
|
|
160
|
+
header: true,
|
|
161
|
+
},
|
|
48
162
|
]);
|
|
49
163
|
});
|
|
50
164
|
});
|
|
@@ -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
|
-
|
|
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
|
});
|