@sis-cc/dotstatsuite-components 17.28.0 → 17.30.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/hasCellMetadata.js +3 -0
- package/lib/rules2/src/parseAttributes.js +2 -1
- package/lib/rules2/src/table/getLayoutData2.js +0 -1
- package/lib/rules2/src/table/getTableLayoutIds.js +30 -10
- package/lib/rules2/src/table/refineLayoutSize2.js +5 -1
- package/package.json +1 -1
- package/src/rules2/src/hasCellMetadata.js +3 -0
- package/src/rules2/src/parseAttributes.js +6 -1
- package/src/rules2/src/table/getLayoutData2.js +0 -1
- package/src/rules2/src/table/getTableLayoutIds.js +25 -8
- package/src/rules2/src/table/refineLayoutSize2.js +6 -1
- package/test/getCells.test.js +43 -0
- package/test/getTableLayoutIds.test.js +24 -0
- package/test/refineLayoutSize2.test.js +103 -0
|
@@ -12,6 +12,9 @@ var R = _interopRequireWildcard(_ramda);
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
14
|
var hasCellMetadata = exports.hasCellMetadata = function hasCellMetadata(metadataCoordinates, cellCoordinates) {
|
|
15
|
+
if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
15
18
|
return R.pipe(R.find(function (coordinates) {
|
|
16
19
|
var mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
|
|
17
20
|
return !R.isEmpty(coordinates) && R.equals(mergedCoord, cellCoordinates);
|
|
@@ -23,7 +23,8 @@ var parseAttributes = exports.parseAttributes = function parseAttributes(attribu
|
|
|
23
23
|
var indexedDimensions = R.indexBy(R.prop('id'), dimensions);
|
|
24
24
|
return R.addIndex(R.map)(function (attr, index) {
|
|
25
25
|
var res = R.assoc('index', index, attr);
|
|
26
|
-
|
|
26
|
+
var displayableValuesCount = R.pipe(R.filter(R.propOr(true, 'display')), R.length)(attr);
|
|
27
|
+
if (R.isEmpty(attr.values || []) || !R.propOr(true, 'display', attr) || displayableValuesCount < 1 || attr.id === _constants.REPORTING_YEAR_START_DAY || attr.id === _constants.REPYEARSTART) {
|
|
27
28
|
return R.assoc('display', false, res);
|
|
28
29
|
}
|
|
29
30
|
if (R.propEq('id', customAttributes.prefscale, attr)) {
|
|
@@ -241,7 +241,6 @@ var getLayoutData = function getLayoutData(layoutIndexes, layout, _ref) {
|
|
|
241
241
|
sections = layoutIndexes.sections,
|
|
242
242
|
rest = (0, _objectWithoutProperties3.default)(layoutIndexes, ['header', 'sections']);
|
|
243
243
|
|
|
244
|
-
|
|
245
244
|
var headerData = R.reduce(function (acc, serie) {
|
|
246
245
|
var datas = getSerieDataWithMissingLines(serie, layout.header, topCoordinates, attributesSeries, customAttributes, metadataCoordinates);
|
|
247
246
|
return R.concat(acc, datas);
|
|
@@ -123,10 +123,9 @@ var injectCombinationsInLayout = exports.injectCombinationsInLayout = function i
|
|
|
123
123
|
if (idsInRowsSet.has(id)) return R.over(R.lensIndex(1), R.append(id), _acc);
|
|
124
124
|
return R.over(R.lensIndex(2), R.append(id), _acc);
|
|
125
125
|
}, [[], [], []], rest),
|
|
126
|
-
_R$reduce2 = (0, _slicedToArray3.default)(_R$reduce,
|
|
126
|
+
_R$reduce2 = (0, _slicedToArray3.default)(_R$reduce, 2),
|
|
127
127
|
idsInSections = _R$reduce2[0],
|
|
128
|
-
idsInRows = _R$reduce2[1]
|
|
129
|
-
nowhere = _R$reduce2[2];
|
|
128
|
+
idsInRows = _R$reduce2[1];
|
|
130
129
|
|
|
131
130
|
if (!R.isEmpty(idsInHeader) && R.isEmpty(idsInSections) && R.isEmpty(idsInRows)) {
|
|
132
131
|
layoutRelationships.header = R.concat(layoutRelationships.header, relationship);
|
|
@@ -178,7 +177,17 @@ var getLayoutCombinations = exports.getLayoutCombinations = function getLayoutCo
|
|
|
178
177
|
}, [], combinations);
|
|
179
178
|
};
|
|
180
179
|
|
|
181
|
-
var extractConcepts = function extractConcepts(ids, indexedCombinations) {
|
|
180
|
+
var extractConcepts = function extractConcepts(ids, indexedCombinations, layoutDimsIds) {
|
|
181
|
+
var entry = R.find(function (id) {
|
|
182
|
+
if (R.has(id, indexedCombinations)) {
|
|
183
|
+
var dimId = R.find(function (i) {
|
|
184
|
+
return layoutDimsIds.has(i);
|
|
185
|
+
}, R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
186
|
+
return !R.isNil(dimId);
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
189
|
+
}, ids);
|
|
190
|
+
|
|
182
191
|
var getRelationship = function getRelationship(id) {
|
|
183
192
|
if (R.has(id, indexedCombinations)) {
|
|
184
193
|
return R.append(id, R.path([id, 'relationship'], indexedCombinations));
|
|
@@ -189,7 +198,7 @@ var extractConcepts = function extractConcepts(ids, indexedCombinations) {
|
|
|
189
198
|
return R.assoc(id, getRelationship(id), acc);
|
|
190
199
|
}, {}, ids);
|
|
191
200
|
|
|
192
|
-
var relationship = [
|
|
201
|
+
var relationship = [entry];
|
|
193
202
|
while (!R.isEmpty(indexedRels)) {
|
|
194
203
|
var related = R.pickBy(function (rels) {
|
|
195
204
|
return !R.isEmpty(R.intersection(relationship, rels));
|
|
@@ -206,20 +215,30 @@ var extractConcepts = function extractConcepts(ids, indexedCombinations) {
|
|
|
206
215
|
}, ids);
|
|
207
216
|
};
|
|
208
217
|
|
|
209
|
-
var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayout = function injectRemainingDimensionsInLayout(layoutIds, remainingDims, indexedCombinations) {
|
|
218
|
+
var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayout = function injectRemainingDimensionsInLayout(layoutIds, remainingDims, indexedCombinations, layoutDimsIds) {
|
|
210
219
|
var _layout = layoutIds;
|
|
211
220
|
var _remaining = remainingDims;
|
|
212
221
|
|
|
213
|
-
|
|
222
|
+
var dimInRows = R.find(function (id) {
|
|
223
|
+
if (layoutDimsIds.has(id)) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
var dimId = R.find(function (i) {
|
|
227
|
+
return layoutDimsIds.has(i);
|
|
228
|
+
}, R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
229
|
+
return !R.isNil(dimId);
|
|
230
|
+
}, _layout.rows);
|
|
231
|
+
|
|
232
|
+
if (R.isNil(dimInRows)) {
|
|
214
233
|
if (R.isEmpty(_remaining)) {
|
|
215
234
|
var toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
|
|
216
235
|
|
|
217
|
-
var _extractConcepts = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations),
|
|
236
|
+
var _extractConcepts = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations, layoutDimsIds),
|
|
218
237
|
_extractConcepts2 = (0, _slicedToArray3.default)(_extractConcepts, 2),
|
|
219
238
|
extracted = _extractConcepts2[0],
|
|
220
239
|
remains = _extractConcepts2[1];
|
|
221
240
|
|
|
222
|
-
_layout = (0, _extends4.default)({}, _layout, (0, _defineProperty3.default)({ rows: extracted }, toTakeIn, remains));
|
|
241
|
+
_layout = (0, _extends4.default)({}, _layout, (0, _defineProperty3.default)({ rows: R.concat(_layout.rows, extracted) }, toTakeIn, remains));
|
|
223
242
|
} else {
|
|
224
243
|
_layout = R.over(R.lensProp('rows'), R.append(R.head(_remaining)))(_layout);
|
|
225
244
|
_remaining = R.tail(_remaining);
|
|
@@ -240,6 +259,7 @@ var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayou
|
|
|
240
259
|
var getTableLayoutIds = exports.getTableLayoutIds = function getTableLayoutIds(defaultLayoutIds, dimensions, attributes, combinations) {
|
|
241
260
|
var layoutDimsIds = getLayoutDimsIds(dimensions);
|
|
242
261
|
var layoutCombinations = getLayoutCombinations(combinations, layoutDimsIds, attributes);
|
|
262
|
+
|
|
243
263
|
var combinationsConcepts = R.pipe(R.pluck('_concepts'), R.unnest, function (ids) {
|
|
244
264
|
return new _set2.default(ids);
|
|
245
265
|
})(combinations);
|
|
@@ -292,5 +312,5 @@ var getTableLayoutIds = exports.getTableLayoutIds = function getTableLayoutIds(d
|
|
|
292
312
|
nextLayout = _R$reduce4.nextLayout,
|
|
293
313
|
remaining = _R$reduce4.remaining;
|
|
294
314
|
|
|
295
|
-
return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations);
|
|
315
|
+
return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations, layoutDimsIds);
|
|
296
316
|
};
|
|
@@ -276,8 +276,12 @@ var refineLayoutSize = exports.refineLayoutSize = function refineLayoutSize(_ref
|
|
|
276
276
|
truncated = _truncateLayout.truncated,
|
|
277
277
|
extractedKeys = _truncateLayout.extractedKeys;
|
|
278
278
|
|
|
279
|
+
var dimsLength = R.pipe(R.values, R.head, R.propOr([], 'orderedDimIndexes'), R.length)(observations);
|
|
280
|
+
var _layout = R.map(R.map(function (entry) {
|
|
281
|
+
return entry.id === 'OBS_ATTRIBUTES' ? R.assoc('__index', dimsLength - 1, entry) : entry;
|
|
282
|
+
}), layout);
|
|
279
283
|
var curatedObs = R.pipe(getShape, function (shape) {
|
|
280
|
-
return getCuratedCells({ layout:
|
|
284
|
+
return getCuratedCells({ layout: _layout, observations: observations, shape: shape });
|
|
281
285
|
})(isVertical);
|
|
282
286
|
|
|
283
287
|
var refined = refineLayout(isVertical)(toRefine, extractedKeys, curatedObs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as R from 'ramda';
|
|
2
2
|
|
|
3
3
|
export const hasCellMetadata = (metadataCoordinates, cellCoordinates) => {
|
|
4
|
+
if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
4
7
|
return R.pipe(
|
|
5
8
|
R.find(coordinates => {
|
|
6
9
|
const mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
|
|
@@ -5,8 +5,13 @@ export const parseAttributes = (attributes, dimensions, customAttributes) => {
|
|
|
5
5
|
const indexedDimensions = R.indexBy(R.prop('id'), dimensions);
|
|
6
6
|
return R.addIndex(R.map)((attr, index) => {
|
|
7
7
|
let res = R.assoc('index', index, attr);
|
|
8
|
+
const displayableValuesCount = R.pipe(
|
|
9
|
+
R.filter(R.propOr(true, 'display')),
|
|
10
|
+
R.length,
|
|
11
|
+
)(attr);
|
|
8
12
|
if (R.isEmpty(attr.values || []) || !R.propOr(true, 'display', attr)
|
|
9
|
-
||
|
|
13
|
+
|| displayableValuesCount < 1 || attr.id === REPORTING_YEAR_START_DAY
|
|
14
|
+
|| attr.id === REPYEARSTART) {
|
|
10
15
|
return R.assoc('display', false, res);
|
|
11
16
|
}
|
|
12
17
|
if (R.propEq('id', customAttributes.prefscale, attr)) {
|
|
@@ -167,7 +167,6 @@ export const getSerieDataWithoutMissingLines = (serie, definition, topCoordinate
|
|
|
167
167
|
|
|
168
168
|
export const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates={} }) => {
|
|
169
169
|
const { header, sections, ...rest } = layoutIndexes;
|
|
170
|
-
|
|
171
170
|
const headerData = R.reduce((acc, serie) => {
|
|
172
171
|
const datas = getSerieDataWithMissingLines(serie, layout.header, topCoordinates, attributesSeries, customAttributes, metadataCoordinates);
|
|
173
172
|
return R.concat(acc, datas);
|
|
@@ -57,7 +57,7 @@ export const injectCombinationsInLayout = (combinations, layoutIds) => {
|
|
|
57
57
|
i => idsInHeaderSet.has(i),
|
|
58
58
|
relationship
|
|
59
59
|
);
|
|
60
|
-
const [idsInSections, idsInRows
|
|
60
|
+
const [idsInSections, idsInRows] = R.reduce((_acc, id) => {
|
|
61
61
|
if (idsInSectionsSet.has(id))
|
|
62
62
|
return R.over(R.lensIndex(0), R.append(id), _acc);
|
|
63
63
|
if (idsInRowsSet.has(id))
|
|
@@ -122,7 +122,15 @@ export const getLayoutCombinations = (combinations, layoutDimsIds, attributes) =
|
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
const extractConcepts = (ids, indexedCombinations) => {
|
|
125
|
+
const extractConcepts = (ids, indexedCombinations, layoutDimsIds) => {
|
|
126
|
+
const entry = R.find(id => {
|
|
127
|
+
if (R.has(id, indexedCombinations)) {
|
|
128
|
+
const dimId = R.find(i => layoutDimsIds.has(i), R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
129
|
+
return !R.isNil(dimId);
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}, ids);
|
|
133
|
+
|
|
126
134
|
const getRelationship = id => {
|
|
127
135
|
if (R.has(id, indexedCombinations)) {
|
|
128
136
|
return R.append(id, R.path([id, 'relationship'], indexedCombinations));
|
|
@@ -133,7 +141,7 @@ const extractConcepts = (ids, indexedCombinations) => {
|
|
|
133
141
|
R.assoc(id, getRelationship(id), acc)
|
|
134
142
|
, {}, ids);
|
|
135
143
|
|
|
136
|
-
let relationship = [
|
|
144
|
+
let relationship = [entry];
|
|
137
145
|
while (!R.isEmpty(indexedRels)) {
|
|
138
146
|
const related = R.pickBy(rels => !R.isEmpty(R.intersection(relationship, rels)), indexedRels);
|
|
139
147
|
if (R.isEmpty(related)) {
|
|
@@ -146,15 +154,23 @@ const extractConcepts = (ids, indexedCombinations) => {
|
|
|
146
154
|
return R.partition(id => set.has(id), ids);
|
|
147
155
|
}
|
|
148
156
|
|
|
149
|
-
export const injectRemainingDimensionsInLayout = (layoutIds, remainingDims, indexedCombinations) => {
|
|
157
|
+
export const injectRemainingDimensionsInLayout = (layoutIds, remainingDims, indexedCombinations, layoutDimsIds) => {
|
|
150
158
|
let _layout = layoutIds;
|
|
151
159
|
let _remaining = remainingDims;
|
|
152
160
|
|
|
153
|
-
|
|
161
|
+
const dimInRows = R.find(id => {
|
|
162
|
+
if (layoutDimsIds.has(id)) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
const dimId = R.find(i => layoutDimsIds.has(i), R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
166
|
+
return !R.isNil(dimId);
|
|
167
|
+
}, _layout.rows);
|
|
168
|
+
|
|
169
|
+
if (R.isNil(dimInRows)) {
|
|
154
170
|
if (R.isEmpty(_remaining)) {
|
|
155
171
|
const toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
|
|
156
|
-
const [extracted, remains] = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations);
|
|
157
|
-
_layout = ({ ..._layout, rows: extracted, [toTakeIn]: remains });
|
|
172
|
+
const [extracted, remains] = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations, layoutDimsIds);
|
|
173
|
+
_layout = ({ ..._layout, rows: R.concat(_layout.rows, extracted), [toTakeIn]: remains });
|
|
158
174
|
}
|
|
159
175
|
else {
|
|
160
176
|
_layout = R.over(R.lensProp('rows'), R.append(R.head(_remaining)))(_layout);
|
|
@@ -186,6 +202,7 @@ export const getTableLayoutIds = (
|
|
|
186
202
|
layoutDimsIds,
|
|
187
203
|
attributes,
|
|
188
204
|
);
|
|
205
|
+
|
|
189
206
|
const combinationsConcepts = R.pipe(R.pluck('_concepts'), R.unnest, ids => new Set(ids))(combinations);
|
|
190
207
|
const obsAttributes = R.filter(a =>
|
|
191
208
|
a.series && R.isEmpty(a.relationship || []) && a.display && !combinationsConcepts.has(a)
|
|
@@ -244,5 +261,5 @@ export const getTableLayoutIds = (
|
|
|
244
261
|
return R.over(R.lensProp('remaining'), R.append(dim.id))(acc);
|
|
245
262
|
}, { nextLayout: layoutWithCombs, remaining: [] }, dimensions);
|
|
246
263
|
|
|
247
|
-
return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations);
|
|
264
|
+
return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations, layoutDimsIds);
|
|
248
265
|
};
|
|
@@ -299,9 +299,14 @@ export const refineLayoutSize = ({ layout, observations, limit }) => layoutIndex
|
|
|
299
299
|
|
|
300
300
|
const { truncated, extractedKeys } = truncateLayout(isVertical)(cutLength, toTruncate);
|
|
301
301
|
|
|
302
|
+
const dimsLength = R.pipe(R.values, R.head, R.propOr([], 'orderedDimIndexes'), R.length)(observations);
|
|
303
|
+
const _layout = R.map(
|
|
304
|
+
R.map(entry => entry.id === 'OBS_ATTRIBUTES' ? R.assoc('__index', dimsLength - 1, entry) : entry),
|
|
305
|
+
layout
|
|
306
|
+
);
|
|
302
307
|
const curatedObs = R.pipe(
|
|
303
308
|
getShape,
|
|
304
|
-
(shape) => getCuratedCells({ layout, observations, shape })
|
|
309
|
+
(shape) => getCuratedCells({ layout: _layout, observations, shape })
|
|
305
310
|
)(isVertical);
|
|
306
311
|
|
|
307
312
|
|
package/test/getCells.test.js
CHANGED
|
@@ -115,4 +115,47 @@ describe('getCells tests', () => {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
+
it('metadata and OBS_ATTRIBUTES', () => {
|
|
119
|
+
const _customAttributes = {
|
|
120
|
+
flags: [],
|
|
121
|
+
notes: []
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const combinations = {
|
|
125
|
+
cells: [],
|
|
126
|
+
layout: []
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const observations = {
|
|
130
|
+
'a': {
|
|
131
|
+
value: 'val',
|
|
132
|
+
formattedValue: 'val',
|
|
133
|
+
attributes: {},
|
|
134
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
|
|
135
|
+
},
|
|
136
|
+
'b': {
|
|
137
|
+
value: 'attr val',
|
|
138
|
+
formattedValue: 'attr val',
|
|
139
|
+
attributes: {},
|
|
140
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' }
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const metadataCoordinates = [{ d0: 'v0', d1: 'v0' }];
|
|
144
|
+
expect(getCells(_customAttributes, {}, combinations, {}, metadataCoordinates)(observations)).to.deep.equal({
|
|
145
|
+
'a': {
|
|
146
|
+
value: 'val',
|
|
147
|
+
intValue: null,
|
|
148
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
|
|
149
|
+
sideProps: { hasAdvancedAttributes: false, hasMetadata: true, coordinates: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' } },
|
|
150
|
+
flags: []
|
|
151
|
+
},
|
|
152
|
+
'b': {
|
|
153
|
+
value: 'attr val',
|
|
154
|
+
intValue: null,
|
|
155
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' },
|
|
156
|
+
sideProps: null,
|
|
157
|
+
flags: []
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
118
161
|
});
|
|
@@ -224,4 +224,28 @@ describe('getTableLayoutIds tests', () => {
|
|
|
224
224
|
rows: ['D4']
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
|
+
it('nothing in rows with combination without dimensions', () => {
|
|
228
|
+
const combinations = [{
|
|
229
|
+
id: 'COMB',
|
|
230
|
+
concepts: ['A1', 'A2']
|
|
231
|
+
}];
|
|
232
|
+
const attributes = [
|
|
233
|
+
{ id: 'A1', series: true, relationship: ['D1'] },
|
|
234
|
+
{ id: 'A2', series: true, relationship: ['D1'] },
|
|
235
|
+
]
|
|
236
|
+
const dimensions = [
|
|
237
|
+
{ id: 'D1' },
|
|
238
|
+
{ id: 'D2' },
|
|
239
|
+
];
|
|
240
|
+
const layoutIds = {
|
|
241
|
+
header: ['D2'],
|
|
242
|
+
sections: ['COMB', 'D1'],
|
|
243
|
+
rows: ['D3']
|
|
244
|
+
};
|
|
245
|
+
expect(getTableLayoutIds(layoutIds, dimensions, attributes, combinations)).to.deep.equal({
|
|
246
|
+
header: ['D2'],
|
|
247
|
+
sections: [],
|
|
248
|
+
rows: ['COMB', 'D1']
|
|
249
|
+
});
|
|
250
|
+
});
|
|
227
251
|
});
|
|
@@ -403,6 +403,109 @@ describe('refineLayoutSize 2 tests', () => {
|
|
|
403
403
|
})(layoutIndexes)
|
|
404
404
|
).to.deep.equal(expected);
|
|
405
405
|
});
|
|
406
|
+
it('truncation with OBS_ATTRIBUTES in layout', () => {
|
|
407
|
+
const layout = {
|
|
408
|
+
header: [{ __index: 1 }, { id: 'OBS_ATTRIBUTES' }],
|
|
409
|
+
rows: [{ __index: 0 }],
|
|
410
|
+
sections: [],
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const layoutIndexes = {
|
|
414
|
+
header: [
|
|
415
|
+
{ indexes: [0, 0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
416
|
+
{ indexes: [0, 1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
417
|
+
{ indexes: [1, 0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
418
|
+
{ indexes: [1, 1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
419
|
+
],
|
|
420
|
+
sections: [
|
|
421
|
+
[
|
|
422
|
+
{ indexes: [] },
|
|
423
|
+
[
|
|
424
|
+
{ indexes: [0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
425
|
+
{ indexes: [1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
426
|
+
{ indexes: [2], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
427
|
+
{ indexes: [3], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
428
|
+
{ indexes: [4], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
429
|
+
{ indexes: [5], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
430
|
+
{ indexes: [6], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
431
|
+
{ indexes: [7], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
432
|
+
{ indexes: [8], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
433
|
+
]
|
|
434
|
+
]
|
|
435
|
+
]
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const observations = {
|
|
439
|
+
'0:0:0': { orderedDimIndexes: [0, 0, 0] },
|
|
440
|
+
'0:0:1': { orderedDimIndexes: [0, 0, 1] },
|
|
441
|
+
'0:1:0': { orderedDimIndexes: [0, 1, 0] },
|
|
442
|
+
'0:1:1': { orderedDimIndexes: [0, 1, 1] },
|
|
443
|
+
'1:0:0': { orderedDimIndexes: [1, 0, 0] },
|
|
444
|
+
'1:0:1': { orderedDimIndexes: [1, 0, 1] },
|
|
445
|
+
'1:1:0': { orderedDimIndexes: [1, 1, 0] },
|
|
446
|
+
'1:1:1': { orderedDimIndexes: [1, 1, 1] },
|
|
447
|
+
'2:0:0': { orderedDimIndexes: [2, 0, 0] },
|
|
448
|
+
'2:0:1': { orderedDimIndexes: [2, 0, 1] },
|
|
449
|
+
'2:1:0': { orderedDimIndexes: [2, 1, 0] },
|
|
450
|
+
'2:1:1': { orderedDimIndexes: [2, 1, 1] },
|
|
451
|
+
'3:0:0': { orderedDimIndexes: [3, 0, 0] },
|
|
452
|
+
'3:0:1': { orderedDimIndexes: [3, 0, 1] },
|
|
453
|
+
'3:1:0': { orderedDimIndexes: [3, 1, 0] },
|
|
454
|
+
'3:1:1': { orderedDimIndexes: [3, 1, 1] },
|
|
455
|
+
'4:0:0': { orderedDimIndexes: [4, 0, 0] },
|
|
456
|
+
'4:0:1': { orderedDimIndexes: [4, 0, 1] },
|
|
457
|
+
'4:1:0': { orderedDimIndexes: [4, 1, 0] },
|
|
458
|
+
'4:1:1': { orderedDimIndexes: [4, 1, 1] },
|
|
459
|
+
'5:0:0': { orderedDimIndexes: [5, 0, 0] },
|
|
460
|
+
'5:0:1': { orderedDimIndexes: [5, 0, 1] },
|
|
461
|
+
'5:1:0': { orderedDimIndexes: [5, 1, 0] },
|
|
462
|
+
'5:1:1': { orderedDimIndexes: [5, 1, 1] },
|
|
463
|
+
'6:0:0': { orderedDimIndexes: [6, 0, 0] },
|
|
464
|
+
'6:0:1': { orderedDimIndexes: [6, 0, 1] },
|
|
465
|
+
'6:1:0': { orderedDimIndexes: [6, 1, 0] },
|
|
466
|
+
'6:1:1': { orderedDimIndexes: [6, 1, 1] },
|
|
467
|
+
'7:0:0': { orderedDimIndexes: [7, 0, 0] },
|
|
468
|
+
'7:0:1': { orderedDimIndexes: [7, 0, 1] },
|
|
469
|
+
'7:1:0': { orderedDimIndexes: [7, 1, 0] },
|
|
470
|
+
'7:1:1': { orderedDimIndexes: [7, 1, 1] },
|
|
471
|
+
'8:0:0': { orderedDimIndexes: [8, 0, 0] },
|
|
472
|
+
'8:0:1': { orderedDimIndexes: [8, 0, 1] },
|
|
473
|
+
'8:1:0': { orderedDimIndexes: [8, 1, 0] },
|
|
474
|
+
'8:1:1': { orderedDimIndexes: [8, 1, 1] },
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const expected = {
|
|
478
|
+
header: [
|
|
479
|
+
{ indexes: [0, 0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
480
|
+
{ indexes: [0, 1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
481
|
+
{ indexes: [1, 0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
482
|
+
{ indexes: [1, 1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
483
|
+
],
|
|
484
|
+
sections: [
|
|
485
|
+
[
|
|
486
|
+
{ indexes: [] },
|
|
487
|
+
[
|
|
488
|
+
{ indexes: [0], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
489
|
+
{ indexes: [1], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
490
|
+
{ indexes: [2], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
491
|
+
{ indexes: [3], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
492
|
+
{ indexes: [4], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
493
|
+
{ indexes: [5], parentsIndexes: [[]], missingIndexes: [[]] },
|
|
494
|
+
]
|
|
495
|
+
]
|
|
496
|
+
],
|
|
497
|
+
truncated: true,
|
|
498
|
+
totalCells: 70
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
expect(
|
|
502
|
+
refineLayoutSize({
|
|
503
|
+
layout,
|
|
504
|
+
observations,
|
|
505
|
+
limit: 52
|
|
506
|
+
})(layoutIndexes)
|
|
507
|
+
).to.deep.equal(expected);
|
|
508
|
+
});
|
|
406
509
|
/*it('no rows', () => {
|
|
407
510
|
|
|
408
511
|
const layout = {
|