@sis-cc/dotstatsuite-components 17.13.0 → 17.15.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/rules/src/get-values-enhanced.js +1 -1
- package/lib/rules/src/v8-transformer.js +6 -6
- package/lib/rules2/src/index.js +0 -9
- package/lib/rules2/src/parseMetadataSeries.js +1 -3
- package/lib/rules2/src/table/getLayoutData2.js +81 -41
- package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +55 -42
- package/package.json +1 -1
- package/src/rules/src/get-values-enhanced.js +33 -33
- package/src/rules/src/v8-transformer.js +6 -7
- package/src/rules2/src/index.js +0 -1
- package/src/rules2/src/parseMetadataSeries.js +5 -6
- package/src/rules2/src/table/getLayoutData2.js +76 -61
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +37 -40
- package/test/getLayoutData2.test.js +142 -33
- package/test/parseSeriesIndexesHierarchies.test.js +1 -0
- package/lib/rules2/src/getSidebarData.js +0 -92
- package/src/rules2/src/getSidebarData.js +0 -85
- package/test/getSidebarData.test.js +0 -322
|
@@ -2,11 +2,12 @@ import * as R from 'ramda';
|
|
|
2
2
|
import { getFlagsAndNotes } from './getFlagsAndNotes';
|
|
3
3
|
import { getLayoutCoordinatesValidator } from '../utils';
|
|
4
4
|
|
|
5
|
-
const getValueData = (index, dimension, parentsIndexes) => ({
|
|
5
|
+
const getValueData = (index, dimension, parentsIndexes, missingParents = []) => ({
|
|
6
6
|
dimension: R.pick(['id', 'name', '__index'], dimension),
|
|
7
7
|
value: {
|
|
8
8
|
...R.pipe(R.pathOr({}, ['values', index]), R.pick(['id', 'name']))(dimension),
|
|
9
|
-
parents: parentsIndexes
|
|
9
|
+
parents: parentsIndexes,
|
|
10
|
+
missingParents
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
13
|
|
|
@@ -18,8 +19,8 @@ const simpleValueDataSetter = (valueData, datas = []) => R.append(valueData, dat
|
|
|
18
19
|
const combinedValueDataSetter = (valueData, datas = []) =>
|
|
19
20
|
R.over(R.lensIndex(-1), d => ({ ...d, values: R.append(R.prop('value', valueData), d.values) }), datas);
|
|
20
21
|
|
|
21
|
-
const addValueToSerieData = (dataSetter) => (index, parentsIndexes, dimension, serieData) => {
|
|
22
|
-
const valueData = getValueData(index, dimension, parentsIndexes);
|
|
22
|
+
const addValueToSerieData = (dataSetter) => (index, parentsIndexes, dimension, serieData, missingParents) => {
|
|
23
|
+
const valueData = getValueData(index, dimension, parentsIndexes, missingParents);
|
|
23
24
|
const valueId = R.path(['value', 'id'], valueData);
|
|
24
25
|
return ({
|
|
25
26
|
...serieData,
|
|
@@ -54,7 +55,7 @@ const getAttributesSeries = (validator, attributesSeries) => R.reduce((acc, attr
|
|
|
54
55
|
const attr = R.head(R.values(attrs));
|
|
55
56
|
const coordinates = R.propOr({}, 'coordinates', attr);
|
|
56
57
|
const isValid = validator(coordinates);
|
|
57
|
-
if (!isValid && !
|
|
58
|
+
if (!isValid && !R.prop('isObs', attr)) {
|
|
58
59
|
return acc;
|
|
59
60
|
}
|
|
60
61
|
return ({ ...acc, ...attrs });
|
|
@@ -89,81 +90,95 @@ const getSerieFlagsAndSideProps = (coordinates, validator, attributesValues, cus
|
|
|
89
90
|
return { flags, sideProps };
|
|
90
91
|
};
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
const getSerieDimensionsData = (serie, definition, attributesValues, missingParentsGetter) => R.addIndex(R.reduce)(
|
|
94
|
+
(onGoingSerie, entry, index) => {
|
|
95
|
+
if (R.has('dimensions', entry)) {
|
|
96
|
+
const combValuesIndexes = R.pathOr([], ['indexes', index], serie);
|
|
97
|
+
const combParentsIndexes = R.pathOr([], ['parentsIndexes', index], serie);
|
|
98
|
+
const combMissingParentsIndexes = R.pathOr([], ['missingIndexes', index], serie);
|
|
99
|
+
let combDimValues = {};
|
|
100
|
+
const res = R.addIndex(R.reduce)((combSerie, dimension, dimIndex) => {
|
|
101
|
+
const valueIndex = Math.abs(R.nth(dimIndex, combValuesIndexes));
|
|
102
|
+
const _parentsIndexes = R.nth(dimIndex, combParentsIndexes) || [];
|
|
103
|
+
const missingParentsIndexes = R.nth(dimIndex, combMissingParentsIndexes) || [];
|
|
104
|
+
const { parentsIndexes, missingParents } = missingParentsGetter(combinedValueDataSetter)(missingParentsIndexes, _parentsIndexes, dimension, combSerie);
|
|
105
|
+
const next = addCombinedValueToSerieData(valueIndex, parentsIndexes, dimension, combSerie, missingParents);
|
|
106
|
+
const value = R.pipe(R.prop('data'), R.last, R.prop('values'), R.last)(next);
|
|
107
|
+
combDimValues = R.assoc(dimension.id, value, combDimValues);
|
|
108
|
+
return next;
|
|
109
|
+
},
|
|
110
|
+
R.over(
|
|
111
|
+
R.lensProp('data'),
|
|
112
|
+
R.append({ dimension: R.pick(['id', 'name'], entry), values: [] })
|
|
113
|
+
)(onGoingSerie),
|
|
114
|
+
R.propOr([], 'dimensions', entry));
|
|
115
|
+
|
|
116
|
+
const combined = combineConcepts(combDimValues, entry, onGoingSerie.attributes)(res);
|
|
117
|
+
return R.over(R.lensProp('attributes'), R.omit(entry.concepts), combined);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const valueIndex = Math.abs(R.path(['indexes', index], serie));
|
|
121
|
+
const _parentsIndexes = R.pathOr([], ['parentsIndexes', index], serie);
|
|
122
|
+
const missingParentsIndexes = R.pathOr([], ['missingIndexes', index], serie);
|
|
123
|
+
const { parentsIndexes, missingParents } = missingParentsGetter(simpleValueDataSetter)(missingParentsIndexes, _parentsIndexes, entry, onGoingSerie);
|
|
124
|
+
return addSimpleValueToSerieData(valueIndex, parentsIndexes, entry, onGoingSerie, missingParents);
|
|
125
|
+
},
|
|
126
|
+
{ data: [], key: '', attributes: attributesValues },
|
|
127
|
+
definition,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
export const getSerieDataWithMissingLines = (serie, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates) => {
|
|
93
131
|
const lines = [];
|
|
94
132
|
|
|
95
133
|
const serieCoordinates = getCoordinates(serie.indexes, topCoordinates, definition);
|
|
96
134
|
const coordinatesValidator = getLayoutCoordinatesValidator(serieCoordinates, topCoordinates);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const addMissingParentsLines = dataSetter => (missingParentsIndexes, parentsIndexes, dim, serieData) => R.reduce(
|
|
100
|
-
(parents, index) => {
|
|
101
|
-
const missingParentData = addValueToSerieData(dataSetter)(index, parents, dim, serieData);
|
|
102
|
-
lines.push(R.assoc('isEmpty', true, missingParentData));
|
|
103
|
-
return R.append(index, parents);
|
|
104
|
-
}, parentsIndexes, missingParentsIndexes
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const addSimpleMissingParentsLines = addMissingParentsLines(simpleValueDataSetter);
|
|
108
|
-
const addCombinedMissingParentsLines = addMissingParentsLines(combinedValueDataSetter);
|
|
109
|
-
|
|
110
|
-
const serieData = R.addIndex(R.reduce)(
|
|
111
|
-
(onGoingSerie, entry, index) => {
|
|
112
|
-
if (R.has('dimensions', entry)) {
|
|
113
|
-
const combValuesIndexes = R.pathOr([], ['indexes', index], serie);
|
|
114
|
-
const combParentsIndexes = R.pathOr([], ['parentsIndexes', index], serie);
|
|
115
|
-
const combMissingParentsIndexes = R.pathOr([], ['missingIndexes', index], serie);
|
|
116
|
-
let combDimValues = {};
|
|
117
|
-
const res = R.addIndex(R.reduce)((combSerie, dimension, dimIndex) => {
|
|
118
|
-
const valueIndex = Math.abs(R.nth(dimIndex, combValuesIndexes));
|
|
119
|
-
const _parentsIndexes = R.nth(dimIndex, combParentsIndexes) || [];
|
|
120
|
-
const missingParentsIndexes = R.nth(dimIndex, combMissingParentsIndexes) || [];
|
|
121
|
-
const parentsIndexes = addCombinedMissingParentsLines(missingParentsIndexes, _parentsIndexes, dimension, combSerie);
|
|
122
|
-
const next = addCombinedValueToSerieData(valueIndex, parentsIndexes, dimension, combSerie);
|
|
123
|
-
const value = R.pipe(R.prop('data'), R.last, R.prop('values'), R.last)(next);
|
|
124
|
-
combDimValues = R.assoc(dimension.id, value, combDimValues);
|
|
125
|
-
return next;
|
|
126
|
-
},
|
|
127
|
-
R.over(
|
|
128
|
-
R.lensProp('data'),
|
|
129
|
-
R.append({ dimension: R.pick(['id', 'name'], entry), values: [] })
|
|
130
|
-
)(onGoingSerie),
|
|
131
|
-
R.propOr([], 'dimensions', entry));
|
|
132
|
-
|
|
133
|
-
const combined = combineConcepts(combDimValues, entry, attributesValues)(res);
|
|
134
|
-
attributesValues = R.omit(entry.concepts, attributesValues);
|
|
135
|
-
return combined;
|
|
136
|
-
}
|
|
135
|
+
const attributesValues = getAttributesSeries(coordinatesValidator, attributesSeries);
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return
|
|
137
|
+
const getMissingParents = dataSetter => (missingParentsIndexes, _parentsIndexes, dim, serieData) => R.reduce(
|
|
138
|
+
(acc, index) => {
|
|
139
|
+
const missingParentData = addValueToSerieData(dataSetter)(index, acc.parentsIndexes, dim, serieData);
|
|
140
|
+
lines.push({ ...R.dissoc('attributes', missingParentData), sideProps: null, flags: [], isEmpty: true });
|
|
141
|
+
return R.over(R.lensProp('parentsIndexes'), R.append(index), acc);
|
|
143
142
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
);
|
|
147
|
-
const { flags, sideProps } = getSerieFlagsAndSideProps(serieCoordinates, coordinatesValidator,
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
{ parentsIndexes: _parentsIndexes, missingParents: [] }, missingParentsIndexes);
|
|
144
|
+
|
|
145
|
+
const { attributes, ...serieData } = getSerieDimensionsData(serie, definition, attributesValues, getMissingParents);
|
|
146
|
+
const { flags, sideProps } = getSerieFlagsAndSideProps(serieCoordinates, coordinatesValidator, attributes, customAttributes, metadataCoordinates);
|
|
147
|
+
return R.append({ ...serieData, flags, sideProps }, lines);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const getSerieDataWithoutMissingLines = (serie, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates) => {
|
|
151
|
+
const serieCoordinates = getCoordinates(serie.indexes, topCoordinates, definition);
|
|
152
|
+
const coordinatesValidator = getLayoutCoordinatesValidator(serieCoordinates, topCoordinates);
|
|
153
|
+
const attributesValues = getAttributesSeries(coordinatesValidator, attributesSeries);
|
|
154
|
+
|
|
155
|
+
const getMissingParents = () => (missingParentsIndexes, _parentsIndexes, dim) => R.reduce(
|
|
156
|
+
(acc, index) => ({
|
|
157
|
+
parentsIndexes: R.append(index, acc.parentsIndexes),
|
|
158
|
+
missingParents: R.append(R.prop('value', getValueData(index, dim, acc.parentsIndexes)), acc.missingParents)
|
|
159
|
+
}),
|
|
160
|
+
{ parentsIndexes: _parentsIndexes, missingParents: [] }, missingParentsIndexes);
|
|
161
|
+
|
|
162
|
+
const { attributes, ...serieData } = getSerieDimensionsData(serie, definition, attributesValues, getMissingParents);
|
|
163
|
+
const { flags, sideProps } = getSerieFlagsAndSideProps(serieCoordinates, coordinatesValidator, attributes, customAttributes, metadataCoordinates);
|
|
164
|
+
return ({ ...serieData, flags, sideProps });
|
|
150
165
|
};
|
|
151
166
|
|
|
152
167
|
export const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates={} }) => {
|
|
153
168
|
const { header, sections, ...rest } = layoutIndexes;
|
|
154
169
|
|
|
155
170
|
const headerData = R.reduce((acc, serie) => {
|
|
156
|
-
const datas =
|
|
171
|
+
const datas = getSerieDataWithMissingLines(serie, layout.header, topCoordinates, attributesSeries, customAttributes, metadataCoordinates);
|
|
157
172
|
return R.concat(acc, datas);
|
|
158
173
|
}, [], header);
|
|
159
174
|
|
|
160
175
|
const sectionsData = R.map(
|
|
161
176
|
([sectionSerie, rowsSeries]) => {
|
|
162
|
-
const sectionData =
|
|
177
|
+
const sectionData = getSerieDataWithoutMissingLines(sectionSerie, layout.sections, topCoordinates, attributesSeries, customAttributes, metadataCoordinates, false);
|
|
163
178
|
return [
|
|
164
|
-
|
|
179
|
+
sectionData,
|
|
165
180
|
R.reduce((acc, serie) => {
|
|
166
|
-
const datas =
|
|
181
|
+
const datas = getSerieDataWithMissingLines(serie, layout.rows, R.propOr(topCoordinates, 'coordinates', sectionData), attributesSeries, customAttributes, metadataCoordinates);
|
|
167
182
|
return R.concat(acc, datas);
|
|
168
183
|
}, [], rowsSeries)
|
|
169
184
|
];
|
|
@@ -1,62 +1,59 @@
|
|
|
1
1
|
import * as R from 'ramda';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const registerParsedIndexes = ({ isSameSerie, ...parsed }, register) => {
|
|
4
|
+
const merged = R.mergeWith((a, b) => R.append(a || [], b), parsed, register);
|
|
5
|
+
return ({ ...merged, isSameSerie });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const parseSerieIndexesHierarchies = (serieIndexes, previousSerie, dimensions, defaultIsSameSerie = true) => {
|
|
4
9
|
return R.addIndex(R.reduce)((acc, _valueIndex, dimensionIndex) => {
|
|
5
10
|
if (R.is(Array, _valueIndex)) {
|
|
6
|
-
const previous = R.isEmpty(previousSerie) ? {} :
|
|
7
|
-
indexes: R.nth(dimensionIndex, previousSerie.indexes || []),
|
|
8
|
-
parentsIndexes: R.nth(dimensionIndex, previousSerie.parentsIndexes || []),
|
|
9
|
-
missingIndexes: R.nth(dimensionIndex, previousSerie.missingIndexes || []),
|
|
10
|
-
registeredIndexes: R.nth(dimensionIndex, previousSerie.registeredIndexes || []),
|
|
11
|
-
};
|
|
11
|
+
const previous = R.isEmpty(previousSerie) ? {} : R.map(R.nth(dimensionIndex), previousSerie);
|
|
12
12
|
const parsed = parseSerieIndexesHierarchies(_valueIndex, previous, R.pathOr([], [dimensionIndex, 'dimensions'], dimensions), acc.isSameSerie);
|
|
13
|
-
|
|
14
|
-
parentsIndexes: R.append(parsed.parentsIndexes, acc.parentsIndexes),
|
|
15
|
-
missingIndexes: R.append(parsed.missingIndexes, acc.missingIndexes),
|
|
16
|
-
registeredIndexes: R.append(parsed.registeredIndexes, acc.registeredIndexes),
|
|
17
|
-
isSameSerie: parsed.isSameSerie
|
|
18
|
-
});
|
|
13
|
+
return registerParsedIndexes(parsed, acc);
|
|
19
14
|
}
|
|
20
15
|
const valueIndex = Math.abs(_valueIndex);
|
|
21
|
-
const
|
|
16
|
+
const parents = R.pathOr([], [dimensionIndex, 'values', valueIndex, 'parents'], dimensions);
|
|
22
17
|
const previousIndex = acc.isSameSerie ? R.pathOr(-1, ['indexes', dimensionIndex], previousSerie) : -1;
|
|
23
18
|
const previousRegisteredIndexes = acc.isSameSerie ? R.pathOr(new Set(), ['registeredIndexes', dimensionIndex], previousSerie) : new Set();
|
|
24
19
|
const registeredIndexes = new Set(previousRegisteredIndexes);
|
|
25
|
-
const
|
|
26
|
-
if (previousRegisteredIndexes.has(
|
|
27
|
-
return R.over(R.
|
|
20
|
+
const { presentParentsIndexes, missingParentsIndexes } = R.reduce((_acc, i) => {
|
|
21
|
+
if (previousRegisteredIndexes.has(i)) {
|
|
22
|
+
return R.over(R.lensProp('presentParentsIndexes'), p => R.isNil(p) ? [i] : R.append(i, p), _acc);
|
|
28
23
|
}
|
|
29
|
-
else if
|
|
30
|
-
registeredIndexes.add(
|
|
31
|
-
return R.over(R.
|
|
24
|
+
else if (i > previousIndex && R.pathOr(false, [dimensionIndex, 'values', i, 'isSelected'], dimensions)) {
|
|
25
|
+
registeredIndexes.add(i);
|
|
26
|
+
return R.over(R.lensProp('missingParentsIndexes'), m => R.isNil(m) ? [i] : R.append(i, m), _acc);
|
|
32
27
|
}
|
|
33
28
|
return _acc;
|
|
34
|
-
},
|
|
29
|
+
}, {}, parents);
|
|
35
30
|
registeredIndexes.add(valueIndex);
|
|
36
|
-
return ({
|
|
37
|
-
|
|
38
|
-
missingIndexes: R.append(missingParentsIndexes, acc.missingIndexes),
|
|
39
|
-
registeredIndexes: R.append(registeredIndexes, acc.registeredIndexes),
|
|
40
|
-
isSameSerie: acc.isSameSerie && valueIndex === previousIndex
|
|
41
|
-
});
|
|
42
|
-
}, { parentsIndexes: [], missingIndexes: [], registeredIndexes: [], isSameSerie }, serieIndexes);
|
|
31
|
+
return registerParsedIndexes({ parentsIndexes: presentParentsIndexes, missingIndexes: missingParentsIndexes, registeredIndexes, isSameSerie: acc.isSameSerie && valueIndex === previousIndex }, acc);
|
|
32
|
+
}, { parentsIndexes: [], missingIndexes: [], registeredIndexes: [], isSameSerie: defaultIsSameSerie }, serieIndexes);
|
|
43
33
|
};
|
|
44
34
|
|
|
45
|
-
export const parseSeriesIndexesHierarchies = (seriesIndexes, dimensions) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
export const parseSeriesIndexesHierarchies = (seriesIndexes, dimensions) => {
|
|
36
|
+
return R.reduce((acc, serieIndexes) => {
|
|
37
|
+
const previousSerie = R.last(acc) || {};
|
|
38
|
+
const { isSameSerie, ...parsed } = parseSerieIndexesHierarchies(serieIndexes, previousSerie, dimensions);
|
|
39
|
+
return R.append(R.assoc('indexes', serieIndexes, parsed), acc);
|
|
40
|
+
}, [], seriesIndexes);
|
|
41
|
+
};
|
|
50
42
|
|
|
51
43
|
export const parseLayoutIndexesHierarchies = (layoutIndexes, layout) => {
|
|
52
44
|
const header = parseSeriesIndexesHierarchies(layoutIndexes.header, layout.header);
|
|
53
|
-
const sections = R.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
const sections = R.pipe(
|
|
46
|
+
R.transpose,
|
|
47
|
+
([_sections, _sectionsRows]) => {
|
|
48
|
+
if (R.isNil(_sections)) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const sections = parseSeriesIndexesHierarchies(_sections, layout.sections);
|
|
52
|
+
const sectionsRows = R.map(rows => parseSeriesIndexesHierarchies(rows, layout.rows), _sectionsRows);
|
|
53
|
+
return R.transpose([sections, sectionsRows]);
|
|
54
|
+
}
|
|
55
|
+
)(layoutIndexes.sections);
|
|
56
|
+
|
|
60
57
|
|
|
61
58
|
return ({ header, sections });
|
|
62
59
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import {
|
|
2
|
+
import { getSerieDataWithMissingLines, getSerieDataWithoutMissingLines } from '../src/rules2/src/table/getLayoutData2';
|
|
3
3
|
|
|
4
4
|
describe('getLayoutData 2 tests', () => {
|
|
5
|
-
it('
|
|
5
|
+
it('getSerieDataWithMissingLines test 1', () => {
|
|
6
6
|
const dimensions = [
|
|
7
7
|
{
|
|
8
8
|
id: 'D0',
|
|
@@ -28,9 +28,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
28
28
|
];
|
|
29
29
|
|
|
30
30
|
const serie = { indexes: [0, 3], parentsIndexes: [[], []], missingIndexes: [[], [0, 2]] };
|
|
31
|
-
expect(
|
|
31
|
+
expect(getSerieDataWithMissingLines(serie, dimensions, {}, {}, {}, {})).to.deep.equal([
|
|
32
32
|
{
|
|
33
|
-
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [] } }, { dimension: { id: 'D1' }, value: { id: 'W', parents: [] } }],
|
|
33
|
+
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'W', parents: [], missingParents: [] } }],
|
|
34
34
|
coordinates: { D0: 'v0', D1: 'W' },
|
|
35
35
|
key: 'D0=v0:D1=W',
|
|
36
36
|
flags: [],
|
|
@@ -38,7 +38,7 @@ describe('getLayoutData 2 tests', () => {
|
|
|
38
38
|
isEmpty: true,
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [] } }, { dimension: { id: 'D1' }, value: { id: 'A', parents: [0] } }],
|
|
41
|
+
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'A', parents: [0], missingParents: [] } }],
|
|
42
42
|
coordinates: { D0: 'v0', D1: 'A' },
|
|
43
43
|
key: 'D0=v0:D1=A',
|
|
44
44
|
flags: [],
|
|
@@ -46,7 +46,7 @@ describe('getLayoutData 2 tests', () => {
|
|
|
46
46
|
isEmpty: true
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [] } }, { dimension: { id: 'D1' }, value: { id: 'USA', parents: [0, 2] } }],
|
|
49
|
+
data: [{ dimension: { id: 'D0' }, value: { id: 'v0', parents: [], missingParents: [] } }, { dimension: { id: 'D1' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } }],
|
|
50
50
|
coordinates: { D0: 'v0', D1: 'USA' },
|
|
51
51
|
key: 'D0=v0:D1=USA',
|
|
52
52
|
flags: [],
|
|
@@ -54,7 +54,7 @@ describe('getLayoutData 2 tests', () => {
|
|
|
54
54
|
}
|
|
55
55
|
]);
|
|
56
56
|
});
|
|
57
|
-
it('
|
|
57
|
+
it('getSerieDataWithMissingLines test 2', () => {
|
|
58
58
|
const dimensions = [
|
|
59
59
|
{
|
|
60
60
|
id: 'D0',
|
|
@@ -128,10 +128,10 @@ describe('getLayoutData 2 tests', () => {
|
|
|
128
128
|
missingIndexes: [[0, 2], [[0, 1], [0, 1]], [[0, 1], [0, 1]]],
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
expect(
|
|
131
|
+
expect(getSerieDataWithMissingLines(serie, dimensions, topCoordinates, attributesSeries, {}, {})).to.deep.equal([
|
|
132
132
|
{
|
|
133
133
|
data: [
|
|
134
|
-
{ dimension: { id: 'D0' }, value: { id: 'W', parents: [] } }
|
|
134
|
+
{ dimension: { id: 'D0' }, value: { id: 'W', parents: [], missingParents: [] } }
|
|
135
135
|
],
|
|
136
136
|
coordinates: { D0: 'W' },
|
|
137
137
|
key: 'D0=W',
|
|
@@ -141,7 +141,7 @@ describe('getLayoutData 2 tests', () => {
|
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
data: [
|
|
144
|
-
{ dimension: { id: 'D0' }, value: { id: 'A', parents: [0] } }
|
|
144
|
+
{ dimension: { id: 'D0' }, value: { id: 'A', parents: [0], missingParents: [] } }
|
|
145
145
|
],
|
|
146
146
|
coordinates: { D0: 'A' },
|
|
147
147
|
key: 'D0=A',
|
|
@@ -151,8 +151,8 @@ describe('getLayoutData 2 tests', () => {
|
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
data: [
|
|
154
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
155
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT', parents: [] }] }
|
|
154
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
155
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT', parents: [], missingParents: [] }] }
|
|
156
156
|
],
|
|
157
157
|
coordinates: { D0: 'USA', D1: 'D1ROOT' },
|
|
158
158
|
key: 'D0=USA:D1=D1ROOT',
|
|
@@ -162,8 +162,8 @@ describe('getLayoutData 2 tests', () => {
|
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
data: [
|
|
165
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
166
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD', parents: [0] }] }
|
|
165
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
166
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
167
167
|
],
|
|
168
168
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD' },
|
|
169
169
|
key: 'D0=USA:D1=D1ROOT>CHILD',
|
|
@@ -173,8 +173,8 @@ describe('getLayoutData 2 tests', () => {
|
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
data: [
|
|
176
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
177
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'D2ROOT', parents: [] }] }
|
|
176
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
177
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D2ROOT', parents: [], missingParents: [] }] }
|
|
178
178
|
],
|
|
179
179
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT' },
|
|
180
180
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT',
|
|
@@ -184,8 +184,8 @@ describe('getLayoutData 2 tests', () => {
|
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
data: [
|
|
187
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
188
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'D2ROOT>CHILD', parents: [0] }] }
|
|
187
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
188
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D2ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
189
189
|
],
|
|
190
190
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD' },
|
|
191
191
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD',
|
|
@@ -195,9 +195,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
data: [
|
|
198
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
199
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1] }] },
|
|
200
|
-
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT', parents: [] }] }
|
|
198
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
199
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
|
|
200
|
+
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT', parents: [], missingParents: [] }] }
|
|
201
201
|
],
|
|
202
202
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT' },
|
|
203
203
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT',
|
|
@@ -207,9 +207,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
data: [
|
|
210
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
211
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1] }] },
|
|
212
|
-
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD', parents: [0] }] }
|
|
210
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
211
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
|
|
212
|
+
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
213
213
|
],
|
|
214
214
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD' },
|
|
215
215
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD',
|
|
@@ -219,9 +219,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
data: [
|
|
222
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
223
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1] }] },
|
|
224
|
-
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'D4ROOT', parents: [] }] }
|
|
222
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
223
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
|
|
224
|
+
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT', parents: [], missingParents: [] }] }
|
|
225
225
|
],
|
|
226
226
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT' },
|
|
227
227
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT',
|
|
@@ -232,9 +232,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
232
232
|
|
|
233
233
|
{
|
|
234
234
|
data: [
|
|
235
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
236
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1] }] },
|
|
237
|
-
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'D4ROOT>CHILD', parents: [0] }] }
|
|
235
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
236
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
|
|
237
|
+
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
238
238
|
],
|
|
239
239
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT>CHILD' },
|
|
240
240
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD',
|
|
@@ -244,9 +244,9 @@ describe('getLayoutData 2 tests', () => {
|
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
data: [
|
|
247
|
-
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2] } },
|
|
248
|
-
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1] }] },
|
|
249
|
-
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1] }, { id: 'D4ROOT>CHILD>CHILD', parents: [0, 1] }] }
|
|
247
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [] } },
|
|
248
|
+
{ dimension: { id: 'COMB0' }, values: [{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'A0VAL' }, { id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] },
|
|
249
|
+
{ dimension: { id: 'COMB1' }, values: [{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }, { id: 'D4ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [] }] }
|
|
250
250
|
],
|
|
251
251
|
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT>CHILD>CHILD' },
|
|
252
252
|
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD>CHILD',
|
|
@@ -264,5 +264,114 @@ describe('getLayoutData 2 tests', () => {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
]);
|
|
267
|
+
});
|
|
268
|
+
it('getSerieDataWithMissingLines test 2', () => {
|
|
269
|
+
const dimensions = [
|
|
270
|
+
{
|
|
271
|
+
id: 'D0',
|
|
272
|
+
values: [
|
|
273
|
+
{ id: 'W' },
|
|
274
|
+
{ id: 'NA', parentsIndexes: [0] },
|
|
275
|
+
{ id: 'A', parentsIndexes: [0, 1] },
|
|
276
|
+
{ id: 'USA', parentsIndexes: [0, 1, 2] },
|
|
277
|
+
{ id: 'CAN', parentsIndexes: [0, 1, 2] },
|
|
278
|
+
{ id: 'MEX', parentsIndexes: [0, 1, 2] }
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: 'COMB0',
|
|
283
|
+
concepts: ['D1', 'A0', 'D2'],
|
|
284
|
+
dimensions: [
|
|
285
|
+
{
|
|
286
|
+
id: 'D1',
|
|
287
|
+
values: [
|
|
288
|
+
{ id: 'D1ROOT' },
|
|
289
|
+
{ id: 'D1ROOT>CHILD' },
|
|
290
|
+
{ id: 'D1ROOT>CHILD>CHILD' },
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
id: 'D2',
|
|
295
|
+
values: [
|
|
296
|
+
{ id: 'D2ROOT' },
|
|
297
|
+
{ id: 'D2ROOT>CHILD' },
|
|
298
|
+
{ id: 'D2ROOT>CHILD>CHILD' },
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: 'COMB1',
|
|
305
|
+
concepts: ['D3', 'D4'],
|
|
306
|
+
dimensions: [
|
|
307
|
+
{
|
|
308
|
+
id: 'D3',
|
|
309
|
+
values: [
|
|
310
|
+
{ id: 'D3ROOT' },
|
|
311
|
+
{ id: 'D3ROOT>CHILD' },
|
|
312
|
+
{ id: 'D3ROOT>CHILD>CHILD' },
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: 'D4',
|
|
317
|
+
values: [
|
|
318
|
+
{ id: 'D4ROOT' },
|
|
319
|
+
{ id: 'D4ROOT>CHILD' },
|
|
320
|
+
{ id: 'D4ROOT>CHILD>CHILD' },
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
];
|
|
326
|
+
|
|
327
|
+
const attributesSeries = {
|
|
328
|
+
'D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD': {
|
|
329
|
+
A0: { id: 'A0', value: { id: 'A0VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
|
|
330
|
+
A1: { id: 'A1', value: { id: 'A1VAL' }, coordinates: { D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD' } },
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const topCoordinates = {};
|
|
335
|
+
|
|
336
|
+
const serie = {
|
|
337
|
+
indexes: [3, [2, 2], [2, 2]],
|
|
338
|
+
parentsIndexes: [[], [[], []], [[], []]],
|
|
339
|
+
missingIndexes: [[0, 2], [[0, 1], [0, 1]], [[0, 1], [0, 1]]],
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
expect(getSerieDataWithoutMissingLines(serie, dimensions, topCoordinates, attributesSeries, {}, {})).to.deep.equal({
|
|
343
|
+
data: [
|
|
344
|
+
{ dimension: { id: 'D0' }, value: { id: 'USA', parents: [0, 2], missingParents: [{ id: 'W', parents: [], missingParents: [] }, { id: 'A', parents: [0], missingParents: [] }] } },
|
|
345
|
+
{
|
|
346
|
+
dimension: { id: 'COMB0' },
|
|
347
|
+
values: [
|
|
348
|
+
{ id: 'D1ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D1ROOT', parents: [], missingParents: [] }, { id: 'D1ROOT>CHILD', parents: [0], missingParents: [] }] },
|
|
349
|
+
{ id: 'A0VAL' },
|
|
350
|
+
{ id: 'D2ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D2ROOT', parents: [], missingParents: [] }, { id: 'D2ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
dimension: { id: 'COMB1' },
|
|
355
|
+
values: [
|
|
356
|
+
{ id: 'D3ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D3ROOT', parents: [], missingParents: [] }, { id: 'D3ROOT>CHILD', parents: [0], missingParents: [] }] },
|
|
357
|
+
{ id: 'D4ROOT>CHILD>CHILD', parents: [0, 1], missingParents: [{ id: 'D4ROOT', parents: [], missingParents: [] }, { id: 'D4ROOT>CHILD', parents: [0], missingParents: [] }] }
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
coordinates: { D0: 'USA', D1: 'D1ROOT>CHILD>CHILD', D2: 'D2ROOT>CHILD>CHILD', D3: 'D3ROOT>CHILD>CHILD', D4: 'D4ROOT>CHILD>CHILD' },
|
|
362
|
+
key: 'D0=USA:D1=D1ROOT>CHILD>CHILD:D2=D2ROOT>CHILD>CHILD:D3=D3ROOT>CHILD>CHILD:D4=D4ROOT>CHILD>CHILD',
|
|
363
|
+
flags: [],
|
|
364
|
+
sideProps: {
|
|
365
|
+
coordinates: {
|
|
366
|
+
D0: 'USA',
|
|
367
|
+
D1: 'D1ROOT>CHILD>CHILD',
|
|
368
|
+
D2: 'D2ROOT>CHILD>CHILD',
|
|
369
|
+
D3: 'D3ROOT>CHILD>CHILD',
|
|
370
|
+
D4: 'D4ROOT>CHILD>CHILD',
|
|
371
|
+
},
|
|
372
|
+
hasAdvancedAttributes: true,
|
|
373
|
+
hasMetadata: false
|
|
374
|
+
}
|
|
375
|
+
});
|
|
267
376
|
});
|
|
268
377
|
});
|