@sis-cc/dotstatsuite-components 13.5.4 → 14.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © OECD 2019-2021
3
+ Copyright © OECD 2019-2022
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,9 +9,9 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
9
9
 
10
10
  var _defineProperty3 = _interopRequireDefault(_defineProperty2);
11
11
 
12
- var _extends3 = require('babel-runtime/helpers/extends');
12
+ var _extends4 = require('babel-runtime/helpers/extends');
13
13
 
14
- var _extends4 = _interopRequireDefault(_extends3);
14
+ var _extends5 = _interopRequireDefault(_extends4);
15
15
 
16
16
  var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
17
17
 
@@ -74,45 +74,42 @@ var refineHeader = exports.refineHeader = function refineHeader(header, extracte
74
74
  };
75
75
 
76
76
  var truncateSectionRows = exports.truncateSectionRows = function truncateSectionRows(n, sectionsData) {
77
- var _R$pipe = R.pipe(R.last, // last section
78
- R.nth(1), // rows
79
- R.splitAt(R.negate(n)) // truncate from the end
80
- )(sectionsData),
81
- _R$pipe2 = (0, _slicedToArray3.default)(_R$pipe, 2),
82
- rest = _R$pipe2[0],
83
- extracted = _R$pipe2[1];
84
-
85
- var truncatedData = R.isEmpty(rest) ? R.dropLast(1, sectionsData) // remove section if no more rows
86
- : R.adjust(-1, R.adjust(1, R.always(rest)), sectionsData);
87
-
88
- var sectionKey = R.join(':', R.pipe(R.last, R.head)(sectionsData) || []);
89
- var rowKeys = R.map(R.join(':'), extracted);
90
-
91
- var extractedLength = R.length(extracted);
92
- if (extractedLength < n) {
93
- var _truncateSectionRows = truncateSectionRows(n - extractedLength, truncatedData),
94
- truncated = _truncateSectionRows.truncated,
95
- extractedKeys = _truncateSectionRows.extractedKeys;
96
-
97
- return { truncated: truncated, extractedKeys: (0, _extends4.default)({}, extractedKeys, (0, _defineProperty3.default)({}, sectionKey, rowKeys)) };
77
+ var truncated = sectionsData;
78
+ var extractedKeys = {};
79
+ var _n = n;
80
+ while (_n > 0) {
81
+ var lastSection = R.last(truncated);
82
+ var rows = lastSection[1];
83
+ var rowsLength = R.length(rows);
84
+ var sectionKey = R.join(':', R.head(lastSection));
85
+ if (rowsLength > _n) {
86
+ var _R$splitAt = R.splitAt(R.negate(_n), rows),
87
+ _R$splitAt2 = (0, _slicedToArray3.default)(_R$splitAt, 2),
88
+ rest = _R$splitAt2[0],
89
+ extracted = _R$splitAt2[1];
90
+
91
+ var updatedSection = R.set(R.lensIndex(1), rest)(lastSection);
92
+ truncated = R.set(R.lensIndex(-1), updatedSection)(truncated);
93
+ extractedKeys = (0, _extends5.default)({}, extractedKeys, (0, _defineProperty3.default)({}, sectionKey, R.map(R.join(':'), extracted)));
94
+ _n = 0;
95
+ } else {
96
+ truncated = R.dropLast(1, truncated);
97
+ extractedKeys = (0, _extends5.default)({}, extractedKeys, (0, _defineProperty3.default)({}, sectionKey, R.map(R.join(':'), rows)));
98
+ _n = _n - rowsLength;
99
+ }
98
100
  }
99
-
100
- return { truncated: truncatedData, extractedKeys: (0, _defineProperty3.default)({}, sectionKey, rowKeys) };
101
+ return { truncated: truncated, extractedKeys: extractedKeys };
101
102
  };
102
103
 
103
104
  var truncateHeader = exports.truncateHeader = function truncateHeader(n, headerData) {
104
- var _R$splitAt = R.splitAt(R.negate(n))(headerData),
105
- _R$splitAt2 = (0, _slicedToArray3.default)(_R$splitAt, 2),
106
- truncated = _R$splitAt2[0],
107
- extracted = _R$splitAt2[1];
105
+ var _R$splitAt3 = R.splitAt(R.negate(n))(headerData),
106
+ _R$splitAt4 = (0, _slicedToArray3.default)(_R$splitAt3, 2),
107
+ truncated = _R$splitAt4[0],
108
+ extracted = _R$splitAt4[1];
108
109
 
109
110
  return { truncated: truncated, extractedKeys: R.map(R.join(':'), extracted) };
110
111
  };
111
112
 
112
- var refineLength = function refineLength(length) {
113
- return length === 0 ? 1 : length;
114
- };
115
-
116
113
  var truncateLayout = function truncateLayout(isVertical) {
117
114
  return R.ifElse(R.always(isVertical), truncateSectionRows, truncateHeader);
118
115
  };
@@ -31,6 +31,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
34
+ var TIME_PERIOD_ID = 'TIME_PERIOD';
35
+
34
36
  var dataTransformer = exports.dataTransformer = function dataTransformer(dataNew) {
35
37
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
36
38
  var locale = options.locale;
@@ -142,14 +144,15 @@ var dataTransformer = exports.dataTransformer = function dataTransformer(dataNew
142
144
 
143
145
  var getDimObservations = R.propOr([], 'observation');
144
146
  var dimObservations = getDimObservations(dimensions);
147
+ var timePeriodDimension = (0, _dotstatsuiteSdmxjs.getTimePeriodObservation)(dimObservations);
148
+ var timePeriodId = timePeriodDimension.id;
145
149
 
146
150
  var getObservations = function getObservations(locale) {
147
151
  return R.addIndex(R.reduce)(function (acc, observation, obsIndex) {
148
152
  var id = R.prop('id')(observation);
149
153
  var dimAnnotations = (0, _sdmxData.getRelationnalAnnotations)(R.propOr([], 'annotations')(observation))(annotations);
150
154
  var isHidden = R.has(id, hiddenIds) || (0, _sdmxData.getIsHidden)(dimAnnotations);
151
- var isTime = (0, _dotstatsuiteSdmxjs.isTimePeriodDimension)(observation);
152
-
155
+ var isTime = observation.id === timePeriodId;
153
156
  var values = getValuesEnhanced(locale, annotations, isTime, id)(R.propOr([], 'values', observation));
154
157
  var ids = R.pipe(R.pluck('id'), R.indexBy(R.identity))(values);
155
158
  var groupedByParentsValues = R.groupBy(function (val) {
@@ -178,7 +181,7 @@ var dataTransformer = exports.dataTransformer = function dataTransformer(dataNew
178
181
  __index: obsIndex,
179
182
  name: (0, _dotstatsuiteSdmxjs.getRefinedName)(observation),
180
183
  values: sortedValues,
181
- role: R.isNil(observation.roles) ? null : R.head(observation.roles)
184
+ role: isTime ? TIME_PERIOD_ID : R.head(R.propOr([], 'roles', observation))
182
185
  }))(acc.observation),
183
186
  dimensionsLayout: (0, _sdmxData.setAnnotationsLayout)(id, acc.dimensionsLayout)(dimAnnotations)
184
187
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "13.5.4",
4
+ "version": "14.0.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "peerDependencies": {
38
38
  "@material-ui/core": "^4.x",
39
39
  "@sis-cc/dotstatsuite-visions": "^7.x",
40
- "@sis-cc/dotstatsuite-sdmxjs": "^6.x",
40
+ "@sis-cc/dotstatsuite-sdmxjs": "^7.x",
41
41
  "react": "16.x"
42
42
  }
43
43
  }
@@ -79,29 +79,28 @@ export const refineHeader = (header, extractedKeys, curatedObs) => R.filter( //
79
79
  )(header);
80
80
 
81
81
  export const truncateSectionRows = (n, sectionsData) => {
82
- const [rest, extracted] = R.pipe(
83
- R.last, // last section
84
- R.nth(1), // rows
85
- R.splitAt(R.negate(n)) // truncate from the end
86
- )(sectionsData);
87
-
88
- const truncatedData = R.isEmpty(rest)
89
- ? R.dropLast(1, sectionsData) // remove section if no more rows
90
- : R.adjust(-1, R.adjust(1, R.always(rest)), sectionsData)
91
-
92
- const sectionKey = R.join(':', R.pipe(R.last, R.head)(sectionsData) || []);
93
- const rowKeys = R.map(R.join(':'), extracted);
94
-
95
- const extractedLength = R.length(extracted);
96
- if (extractedLength < n) {
97
- const { truncated, extractedKeys } = truncateSectionRows(
98
- n - extractedLength,
99
- truncatedData
100
- );
101
- return ({ truncated, extractedKeys: { ...extractedKeys, [sectionKey]: rowKeys } });
82
+ let truncated = sectionsData;
83
+ let extractedKeys = {};
84
+ let _n = n;
85
+ while (_n > 0) {
86
+ const lastSection = R.last(truncated);
87
+ const rows = lastSection[1];
88
+ const rowsLength = R.length(rows);
89
+ const sectionKey = R.join(':', R.head(lastSection));
90
+ if (rowsLength > _n) {
91
+ const [rest, extracted] = R.splitAt(R.negate(_n), rows);
92
+ const updatedSection = R.set(R.lensIndex(1), rest)(lastSection);
93
+ truncated = R.set(R.lensIndex(-1), updatedSection)(truncated);
94
+ extractedKeys = { ...extractedKeys, [sectionKey]: R.map(R.join(':'), extracted) };
95
+ _n = 0;
96
+ }
97
+ else {
98
+ truncated = R.dropLast(1, truncated);
99
+ extractedKeys = { ...extractedKeys, [sectionKey]: R.map(R.join(':'), rows) };
100
+ _n = _n - rowsLength;
101
+ }
102
102
  }
103
-
104
- return ({ truncated: truncatedData, extractedKeys: { [sectionKey]: rowKeys } });
103
+ return ({ truncated, extractedKeys });
105
104
  };
106
105
 
107
106
  export const truncateHeader = (n, headerData) => {
@@ -109,8 +108,6 @@ export const truncateHeader = (n, headerData) => {
109
108
  return ({ truncated, extractedKeys: R.map(R.join(':'), extracted) });
110
109
  };
111
110
 
112
- const refineLength = length => length === 0 ? 1 : length;
113
-
114
111
  const truncateLayout = (isVertical) => R.ifElse(
115
112
  R.always(isVertical),
116
113
  truncateSectionRows,
@@ -1,12 +1,14 @@
1
1
  import * as R from 'ramda';
2
2
  import dateFns from 'date-fns';
3
- import { getCodeOrder, getRefinedName, isTimePeriodDimension } from '@sis-cc/dotstatsuite-sdmxjs';
3
+ import { getCodeOrder, getRefinedName, getTimePeriodObservation } from '@sis-cc/dotstatsuite-sdmxjs';
4
4
  import {
5
5
  getRelationnalAnnotations, setAnnotationsLayout, getIsHidden } from './sdmx-data';
6
6
  import { getReportedTimePeriodLabel, getReportedTimePeriodNote, getReportedTimePeriod } from './date';
7
7
  import { getReportingYearStart } from './preparators/getReportingYearStart';
8
8
  import { getNotDisplayedIds } from '../../rules2/src';
9
9
 
10
+ const TIME_PERIOD_ID = 'TIME_PERIOD';
11
+
10
12
  export const dataTransformer = (dataNew, options = {}) => {
11
13
  const { locale } = options;
12
14
  const reportYearStart = getReportingYearStart(dataNew);
@@ -136,13 +138,14 @@ export const dataTransformer = (dataNew, options = {}) => {
136
138
 
137
139
  const getDimObservations = R.propOr([], 'observation');
138
140
  const dimObservations = getDimObservations(dimensions);
141
+ const timePeriodDimension = getTimePeriodObservation(dimObservations);
142
+ const timePeriodId = timePeriodDimension.id;
139
143
 
140
144
  const getObservations = locale => R.addIndex(R.reduce)((acc, observation, obsIndex) => {
141
145
  const id = R.prop('id')(observation);
142
146
  const dimAnnotations = getRelationnalAnnotations(R.propOr([],'annotations')(observation))(annotations)
143
147
  const isHidden = R.has(id, hiddenIds) || getIsHidden(dimAnnotations);
144
- const isTime = isTimePeriodDimension(observation);
145
-
148
+ const isTime = observation.id === timePeriodId;
146
149
  const values = getValuesEnhanced(locale, annotations, isTime, id)(R.propOr([],'values', observation));
147
150
  const ids = R.pipe(R.pluck('id'), R.indexBy(R.identity))(values);
148
151
  const groupedByParentsValues = R.groupBy(val => {
@@ -176,7 +179,7 @@ export const dataTransformer = (dataNew, options = {}) => {
176
179
  __index: obsIndex,
177
180
  name: getRefinedName(observation),
178
181
  values: sortedValues,
179
- role: R.isNil(observation.roles) ? null : R.head(observation.roles),
182
+ role: isTime ? TIME_PERIOD_ID : R.head(R.propOr([], 'roles', observation)),
180
183
  })(acc.observation),
181
184
  dimensionsLayout: setAnnotationsLayout(id, acc.dimensionsLayout)(dimAnnotations),
182
185
  });
@@ -7,26 +7,26 @@ describe('getMSDInformations tests', () => {
7
7
  const expected = {
8
8
  attributes: {
9
9
  STRING_TYPE: { format: 'String', parent: '#ROOT', id: 'STRING_TYPE', name: 'STRING_TYPE en' },
10
- STRING_MULTILANG_TYPE: { format: 'String', parent: '#ROOT', id: 'STRING_MULTILANG_TYPE', name: [undefined] },
11
- ALPHANUMERIC_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_TYPE', name: [undefined] },
12
- ALPHANUMERIC_MULTILANG_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_MULTILANG_TYPE', name: [undefined] },
13
- BOOLEAN_TYPE: { format: 'Boolean', parent: '#ROOT', id: 'BOOLEAN_TYPE', name: [undefined] },
14
- XHTML_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_TYPE', name: [undefined] },
15
- XHTML_MULTILANG_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_MULTILANG_TYPE', name: [undefined] },
16
- INTEGER_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_TYPE', name: [undefined] },
17
- INTEGER_MULTILANG_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_MULTILANG_TYPE', name: [undefined] },
18
- DECIMAL_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_TYPE', name: [undefined] },
19
- DECIMAL_MULTILANG_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_MULTILANG_TYPE', name: [undefined] },
20
- DATETIME_TYPE: { format: 'DateTime', parent: '#ROOT', id: 'DATETIME_TYPE', name: [undefined] },
21
- TIME_TYPE: { format: 'Time', parent: '#ROOT', id: 'TIME_TYPE', name: [undefined] },
22
- GREGORIANDAY_TYPE: { format: 'GregorianDay', parent: '#ROOT', id: 'GREGORIANDAY_TYPE', name: [undefined] },
23
- GREGORIAN_YEAR_TYPE: { format: 'GregorianYear', parent: '#ROOT', id: 'GREGORIAN_YEAR_TYPE', name: [undefined] },
24
- GREGORIAN_YEARMONTH_TYPE: { format: 'GregorianYearMonth', parent: '#ROOT', id: 'GREGORIAN_YEARMONTH_TYPE', name: [undefined] },
25
- CONTACT: { format: 'String', parent: '#ROOT', id: 'CONTACT', name: [undefined] },
26
- 'CONTACT.CONTACT_NAME': { format: 'String', parent: 'CONTACT', id: 'CONTACT_NAME', name: [undefined] },
27
- 'CONTACT.CONTACT_EMAIL': { format: 'String', parent: 'CONTACT', id: 'CONTACT_EMAIL', name: [undefined] },
28
- 'CONTACT.CONTACT_PHONE': { format: 'Numeric', parent: 'CONTACT', id: 'CONTACT_PHONE', name: [undefined] },
29
- 'CONTACT.CONTACT_ORGANISATION': { format: 'String', parent: 'CONTACT', id: 'CONTACT_ORGANISATION', name: [undefined] }
10
+ STRING_MULTILANG_TYPE: { format: 'String', parent: '#ROOT', id: 'STRING_MULTILANG_TYPE', name: undefined },
11
+ ALPHANUMERIC_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_TYPE', name: undefined },
12
+ ALPHANUMERIC_MULTILANG_TYPE: { format: 'AlphaNumeric', parent: '#ROOT', id: 'ALPHANUMERIC_MULTILANG_TYPE', name: undefined },
13
+ BOOLEAN_TYPE: { format: 'Boolean', parent: '#ROOT', id: 'BOOLEAN_TYPE', name: undefined },
14
+ XHTML_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_TYPE', name: undefined },
15
+ XHTML_MULTILANG_TYPE: { format: 'XHTML', parent: '#ROOT', id: 'XHTML_MULTILANG_TYPE', name: undefined },
16
+ INTEGER_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_TYPE', name: undefined },
17
+ INTEGER_MULTILANG_TYPE: { format: 'Integer', parent: '#ROOT', id: 'INTEGER_MULTILANG_TYPE', name: undefined },
18
+ DECIMAL_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_TYPE', name: undefined },
19
+ DECIMAL_MULTILANG_TYPE: { format: 'Decimal', parent: '#ROOT', id: 'DECIMAL_MULTILANG_TYPE', name: undefined },
20
+ DATETIME_TYPE: { format: 'DateTime', parent: '#ROOT', id: 'DATETIME_TYPE', name: undefined },
21
+ TIME_TYPE: { format: 'Time', parent: '#ROOT', id: 'TIME_TYPE', name: undefined },
22
+ GREGORIANDAY_TYPE: { format: 'GregorianDay', parent: '#ROOT', id: 'GREGORIANDAY_TYPE', name: undefined },
23
+ GREGORIAN_YEAR_TYPE: { format: 'GregorianYear', parent: '#ROOT', id: 'GREGORIAN_YEAR_TYPE', name: undefined },
24
+ GREGORIAN_YEARMONTH_TYPE: { format: 'GregorianYearMonth', parent: '#ROOT', id: 'GREGORIAN_YEARMONTH_TYPE', name: undefined },
25
+ CONTACT: { format: 'String', parent: '#ROOT', id: 'CONTACT', name: undefined },
26
+ 'CONTACT.CONTACT_NAME': { format: 'String', parent: 'CONTACT', id: 'CONTACT_NAME', name: undefined },
27
+ 'CONTACT.CONTACT_EMAIL': { format: 'String', parent: 'CONTACT', id: 'CONTACT_EMAIL', name: undefined },
28
+ 'CONTACT.CONTACT_PHONE': { format: 'Numeric', parent: 'CONTACT', id: 'CONTACT_PHONE', name: undefined },
29
+ 'CONTACT.CONTACT_ORGANISATION': { format: 'String', parent: 'CONTACT', id: 'CONTACT_ORGANISATION', name: undefined }
30
30
  }
31
31
  };
32
32
 
@@ -418,4 +418,88 @@ describe('refineLayoutSize tests', () => {
418
418
  })(layoutIndexes)
419
419
  ).to.deep.equal(expected);
420
420
  });
421
+ it('truncation on rows', () => {
422
+ const observations = {
423
+ '0:0:0': { orderedDimIndexes: [0, 0, 0] },
424
+ '0:0:1': { orderedDimIndexes: [0, 0, 1] },
425
+ '0:0:2': { orderedDimIndexes: [0, 0, 2] },
426
+ '0:0:3': { orderedDimIndexes: [0, 0, 3] },
427
+ '0:0:4': { orderedDimIndexes: [0, 0, 4] },
428
+ '0:0:5': { orderedDimIndexes: [0, 0, 5] },
429
+ '0:0:6': { orderedDimIndexes: [0, 0, 6] },
430
+ '0:0:7': { orderedDimIndexes: [0, 0, 7] },
431
+ '0:0:8': { orderedDimIndexes: [0, 0, 8] },
432
+ '0:0:9': { orderedDimIndexes: [0, 0, 9] },
433
+ '0:1:0': { orderedDimIndexes: [0, 1, 0] },
434
+ '0:1:1': { orderedDimIndexes: [0, 1, 1] },
435
+ '0:1:2': { orderedDimIndexes: [0, 1, 2] },
436
+ '0:1:3': { orderedDimIndexes: [0, 1, 3] },
437
+ '0:1:4': { orderedDimIndexes: [0, 1, 4] },
438
+ '0:1:5': { orderedDimIndexes: [0, 1, 5] },
439
+ '0:1:6': { orderedDimIndexes: [0, 1, 6] },
440
+ '0:1:7': { orderedDimIndexes: [0, 1, 7] },
441
+ '0:1:8': { orderedDimIndexes: [0, 1, 8] },
442
+ '0:1:9': { orderedDimIndexes: [0, 1, 9] },
443
+ '1:0:0': { orderedDimIndexes: [0, 0, 0] },
444
+ '1:0:1': { orderedDimIndexes: [0, 0, 1] },
445
+ '1:0:2': { orderedDimIndexes: [0, 0, 2] },
446
+ '1:0:3': { orderedDimIndexes: [0, 0, 3] },
447
+ '1:0:4': { orderedDimIndexes: [0, 0, 4] },
448
+ '1:0:5': { orderedDimIndexes: [0, 0, 5] },
449
+ '1:0:6': { orderedDimIndexes: [0, 0, 6] },
450
+ '1:0:7': { orderedDimIndexes: [0, 0, 7] },
451
+ '1:0:8': { orderedDimIndexes: [0, 0, 8] },
452
+ '1:0:9': { orderedDimIndexes: [0, 0, 9] },
453
+ '1:1:0': { orderedDimIndexes: [1, 1, 0] },
454
+ '1:1:1': { orderedDimIndexes: [1, 1, 1] },
455
+ '1:1:2': { orderedDimIndexes: [1, 1, 2] },
456
+ '1:1:3': { orderedDimIndexes: [1, 1, 3] },
457
+ '1:1:4': { orderedDimIndexes: [1, 1, 4] },
458
+ '1:1:5': { orderedDimIndexes: [1, 1, 5] },
459
+ '1:1:6': { orderedDimIndexes: [1, 1, 6] },
460
+ '1:1:7': { orderedDimIndexes: [1, 1, 7] },
461
+ '1:1:8': { orderedDimIndexes: [1, 1, 8] },
462
+ '1:1:9': { orderedDimIndexes: [1, 1, 9] },
463
+ };
464
+
465
+ const layout = {
466
+ header: [{ __index: 0 }],
467
+ sections: [{ __index: 1 }],
468
+ rows: [{ __index: 2 }],
469
+ };
470
+
471
+ const layoutIndexes = {
472
+ header: [[0], [1]],
473
+ sections: [
474
+ [
475
+ [0],
476
+ [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
477
+ ],
478
+ [
479
+ [1],
480
+ [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
481
+ ],
482
+ ]
483
+ };
484
+
485
+ const expected = {
486
+ totalCells: 89,
487
+ truncated: true,
488
+ header: [[0], [1]],
489
+ sections: [
490
+ [
491
+ [0],
492
+ [[0], [1], [2], [3], [4], [5], [6], [7], [8]]
493
+ ],
494
+ ]
495
+ };
496
+
497
+ expect(
498
+ refineLayoutSize({
499
+ layout,
500
+ observations: partialObservations3,
501
+ limit: 45,
502
+ })(layoutIndexes)
503
+ ).to.deep.equal(expected);
504
+ });
421
505
  });