@sis-cc/dotstatsuite-components 20.5.0 → 20.6.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/LICENSE +1 -1
- package/lib/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +4 -1
- package/lib/rules2/src/table/getLayoutData2.js +1 -1
- package/package.json +1 -1
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +5 -1
- package/src/rules2/src/table/getLayoutData2.js +4 -1
- package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +59 -32
package/LICENSE
CHANGED
|
@@ -27,7 +27,10 @@ var hierarchiseDimensionWithNativeHierarchy = exports.hierarchiseDimensionWithNa
|
|
|
27
27
|
return R.reduce(function (acc, child) {
|
|
28
28
|
index = index + 1;
|
|
29
29
|
var refined = R.pipe(R.assoc('__indexPosition', index), R.assoc('parents', parentsIndexes), R.assoc('parent', R.isEmpty(parentsIndexes) ? undefined : parentId))(child);
|
|
30
|
-
var children = getChildren({
|
|
30
|
+
var children = getChildren({
|
|
31
|
+
parentsIndexes: R.propOr(false, 'isSelected', child) ? R.append(index, parentsIndexes) : parentsIndexes,
|
|
32
|
+
parentId: child.id
|
|
33
|
+
});
|
|
31
34
|
return R.concat(acc, R.prepend(refined, children));
|
|
32
35
|
}, [], childs);
|
|
33
36
|
};
|
|
@@ -33,7 +33,7 @@ var getValueData = function getValueData(index, dimension, parentsIndexes) {
|
|
|
33
33
|
var missingParents = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
34
34
|
return {
|
|
35
35
|
dimension: R.pick(['id', 'name', '__index'], dimension),
|
|
36
|
-
value: (0, _extends3.default)({}, R.pipe(R.pathOr({}, ['values', index]), R.pick(['id', 'name', 'isNonCoded', 'flags', 'hasAdvancedAttributes']))(dimension), {
|
|
36
|
+
value: (0, _extends3.default)({}, R.pipe(R.pathOr({}, ['values', index]), R.pick(['id', 'name', 'isNonCoded', 'flags', 'hasAdvancedAttributes', 'display']))(dimension), {
|
|
37
37
|
parents: parentsIndexes,
|
|
38
38
|
missingParents: missingParents
|
|
39
39
|
})
|
package/package.json
CHANGED
|
@@ -16,7 +16,11 @@ export const hierarchiseDimensionWithNativeHierarchy = (dimension) => {
|
|
|
16
16
|
R.assoc('parents', parentsIndexes),
|
|
17
17
|
R.assoc('parent', R.isEmpty(parentsIndexes) ? undefined : parentId),
|
|
18
18
|
)(child);
|
|
19
|
-
const children = getChildren({
|
|
19
|
+
const children = getChildren({
|
|
20
|
+
parentsIndexes: R.propOr(false, 'isSelected', child)
|
|
21
|
+
? R.append(index, parentsIndexes) : parentsIndexes,
|
|
22
|
+
parentId: child.id
|
|
23
|
+
});
|
|
20
24
|
return R.concat(acc, R.prepend(refined, children));
|
|
21
25
|
},
|
|
22
26
|
[],
|
|
@@ -5,7 +5,10 @@ import { getLayoutCoordinatesValidator } from '../utils';
|
|
|
5
5
|
const getValueData = (index, dimension, parentsIndexes, missingParents = []) => ({
|
|
6
6
|
dimension: R.pick(['id', 'name', '__index'], dimension),
|
|
7
7
|
value: {
|
|
8
|
-
...R.pipe(
|
|
8
|
+
...R.pipe(
|
|
9
|
+
R.pathOr({}, ['values', index]),
|
|
10
|
+
R.pick(['id', 'name', 'isNonCoded', 'flags', 'hasAdvancedAttributes', 'display'])
|
|
11
|
+
)(dimension),
|
|
9
12
|
parents: parentsIndexes,
|
|
10
13
|
missingParents
|
|
11
14
|
}
|
|
@@ -6,24 +6,24 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
6
6
|
const dimension = {
|
|
7
7
|
id: 'test',
|
|
8
8
|
values: [
|
|
9
|
-
{ id: 'FRA', parent: 'EA', __indexPosition: 101 },
|
|
10
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
11
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
12
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
13
|
-
{ id: 'W', parent: undefined, __indexPosition: 5 },
|
|
14
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
9
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
10
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
11
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
12
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
13
|
+
{ id: 'W', parent: undefined, __indexPosition: 5, isSelected: true },
|
|
14
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
15
15
|
]
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const expected = {
|
|
19
19
|
id: 'test',
|
|
20
20
|
values: [
|
|
21
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
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 }
|
|
21
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
22
|
+
{ id: 'W', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
23
|
+
{ id: 'A', parent: 'W', parents: [1], __indexPosition: 2, isSelected: true },
|
|
24
|
+
{ id: 'EA', parent: 'W', parents: [1], __indexPosition: 3, isSelected: true },
|
|
25
|
+
{ id: 'GER', parent: 'EA', parents: [1, 3], __indexPosition: 4, isSelected: true },
|
|
26
|
+
{ id: 'FRA', parent: 'EA', parents: [1, 3], __indexPosition: 5, isSelected: true }
|
|
27
27
|
]
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -33,22 +33,22 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
33
33
|
const dimension = {
|
|
34
34
|
id: 'test',
|
|
35
35
|
values: [
|
|
36
|
-
{ id: 'FRA', parent: 'EA', __indexPosition: 101 },
|
|
37
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
38
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
39
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
40
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
36
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
37
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
38
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
39
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
40
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
41
41
|
]
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const expected = {
|
|
45
45
|
id: 'test',
|
|
46
46
|
values: [
|
|
47
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
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 }
|
|
47
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
48
|
+
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
49
|
+
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2, isSelected: true },
|
|
50
|
+
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3, isSelected: true },
|
|
51
|
+
{ id: 'FRA', parent: 'EA', parents: [2], __indexPosition: 4, isSelected: true }
|
|
52
52
|
]
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -58,25 +58,52 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
58
58
|
const dimension = {
|
|
59
59
|
id: 'test',
|
|
60
60
|
values: [
|
|
61
|
-
{ id: '', parent: '', __indexPosition: 101 },
|
|
62
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
63
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
64
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
65
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
61
|
+
{ id: '', parent: '', __indexPosition: 101, isSelected: true },
|
|
62
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
63
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
64
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
65
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
66
66
|
]
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const expected = {
|
|
70
70
|
id: 'test',
|
|
71
71
|
values: [
|
|
72
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
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 }
|
|
72
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
73
|
+
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
74
|
+
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2, isSelected: true },
|
|
75
|
+
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3, isSelected: true },
|
|
76
|
+
{ id: '', parent: undefined, parents: [], __indexPosition: 4, isSelected: true }
|
|
77
77
|
]
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
expect(hierarchiseDimensionWithNativeHierarchy(dimension)).to.deep.equal(expected);
|
|
81
81
|
});
|
|
82
|
+
it('non selected parent', () => {
|
|
83
|
+
const dimension = {
|
|
84
|
+
id: 'test',
|
|
85
|
+
values: [
|
|
86
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
87
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
88
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: false },
|
|
89
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
90
|
+
{ id: 'W', parent: undefined, __indexPosition: 5, isSelected: true },
|
|
91
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const expected = {
|
|
96
|
+
id: 'test',
|
|
97
|
+
values: [
|
|
98
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
99
|
+
{ id: 'W', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
100
|
+
{ id: 'A', parent: 'W', parents: [1], __indexPosition: 2, isSelected: true },
|
|
101
|
+
{ id: 'EA', parent: 'W', parents: [1], __indexPosition: 3, isSelected: false },
|
|
102
|
+
{ id: 'GER', parent: 'EA', parents: [1], __indexPosition: 4, isSelected: true },
|
|
103
|
+
{ id: 'FRA', parent: 'EA', parents: [1], __indexPosition: 5, isSelected: true }
|
|
104
|
+
]
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
expect(hierarchiseDimensionWithNativeHierarchy(dimension)).to.deep.equal(expected);
|
|
108
|
+
})
|
|
82
109
|
});
|