@sis-cc/dotstatsuite-components 17.12.6 → 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.
Files changed (28) hide show
  1. package/lib/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +22 -17
  2. package/lib/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +10 -5
  3. package/lib/rules2/src/index.js +21 -12
  4. package/lib/rules2/src/prepareData.js +2 -2
  5. package/lib/rules2/src/refineDimensions.js +3 -6
  6. package/lib/rules2/src/table/getLayoutData2.js +218 -0
  7. package/lib/rules2/src/table/getTableProps.js +6 -9
  8. package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +96 -0
  9. package/lib/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +53 -34
  10. package/package.json +1 -1
  11. package/src/rules2/src/{hierarchiseDimensionWithAdvancedHierarchy.js → hierarchiseDimensionWithAdvancedHierarchy2.js} +24 -23
  12. package/src/rules2/src/{hierarchiseDimensionWithNativeHierarchy.js → hierarchiseDimensionWithNativeHierarchy2.js} +31 -28
  13. package/src/rules2/src/index.js +5 -5
  14. package/src/rules2/src/prepareData.js +2 -2
  15. package/src/rules2/src/refineDimensions.js +3 -6
  16. package/src/rules2/src/table/getLayoutData2.js +175 -0
  17. package/src/rules2/src/table/getTableProps.js +8 -4
  18. package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +62 -0
  19. package/src/rules2/src/table/{refineLayoutSize.js → refineLayoutSize2.js} +50 -21
  20. package/test/getLayoutData2.test.js +268 -0
  21. package/test/{hierarchiseDimensionWithAdvancedHierarchy.test.js → hierarchiseDimensionWithAdvancedHierarchy2.test.js} +34 -69
  22. package/test/{hierarchiseDimensionWithNativeHierarchy.test.js → hierarchiseDimensionWithNativeHierarchy2.test.js} +14 -14
  23. package/test/parseSeriesIndexesHierarchies.test.js +104 -0
  24. package/test/{refineLayoutSize.test.js → refineLayoutSize2.test.js} +63 -64
  25. package/test/refinedDimensions.test.js +8 -8
  26. package/lib/rules2/src/table/getLayoutData.js +0 -209
  27. package/src/rules2/src/table/getLayoutData.js +0 -193
  28. package/test/getLayoutData.test.js +0 -284
@@ -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
- //import { refineLayoutSize } from '../src/rules/src/table/factories/refineLayoutSize';
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
  });
@@ -22,14 +22,14 @@ describe('refine dimensions tests', () => {
22
22
 
23
23
  expect(refineDimensions(dimensions, dataquery)).to.deep.equal([
24
24
  { id: 'd0', values: [], header: true },
25
- { id: 'd1', values: [{ id: 'v0' }], header: true },
26
- { id: 'd2', values: [{ id: 'v0' }, { id: 'v1', empty: true }, { id: 'v2', empty: true }], header: true },
27
- { id: 'd3', values: [{ id: 'v0' }, { id: 'v1' }, { id: 'v2', empty: true }], header: false },
28
- { id: 'd4', values: [{ id: 'v0' }, { id: 'v1' }, { id: 'v2' }], header: false },
29
- { id: 'd5', values: [{ id: 'v0' }], header: true },
30
- { id: 'd6', values: [{ id: 'v0' }, { id: 'v1' }], header: false },
31
- { id: 'd7', values: [{ id: 'v0' }], header: true },
32
- { id: 'd8', values: [{ id: 'v0' }, { id: 'v1' }], header: false }
25
+ { id: 'd1', values: [{ id: 'v0', isSelected: true }], header: true },
26
+ { id: 'd2', values: [{ id: 'v0', isSelected: true }, { id: 'v1', empty: true }, { id: 'v2', empty: true }], header: true },
27
+ { id: 'd3', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }, { id: 'v2', empty: true }], header: false },
28
+ { id: 'd4', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }, { id: 'v2', isSelected: true }], header: false },
29
+ { id: 'd5', values: [{ id: 'v0', isSelected: true }], header: true },
30
+ { id: 'd6', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }], header: false },
31
+ { id: 'd7', values: [{ id: 'v0', isSelected: true }], header: true },
32
+ { id: 'd8', values: [{ id: 'v0', isSelected: true }, { id: 'v1', isSelected: true }], header: false }
33
33
  ]);
34
34
  })
35
35
  });
@@ -1,209 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getLayoutData = undefined;
7
-
8
- var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
9
-
10
- var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
11
-
12
- var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
13
-
14
- var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
15
-
16
- var _extends2 = require('babel-runtime/helpers/extends');
17
-
18
- var _extends3 = _interopRequireDefault(_extends2);
19
-
20
- var _ramda = require('ramda');
21
-
22
- var R = _interopRequireWildcard(_ramda);
23
-
24
- var _getFlagsAndNotes = require('./getFlagsAndNotes');
25
-
26
- var _getCombinationDimensionsData = require('./getCombinationDimensionsData');
27
-
28
- var _parseValueHierarchy = require('./parseValueHierarchy');
29
-
30
- var _utils = require('../utils');
31
-
32
- 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; } }
33
-
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
- var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
37
- var metadataCoordinates = _ref.metadataCoordinates,
38
- attributesSeries = _ref.attributesSeries,
39
- customAttributes = _ref.customAttributes,
40
- _ref$topCoordinates = _ref.topCoordinates,
41
- topCoordinates = _ref$topCoordinates === undefined ? {} : _ref$topCoordinates;
42
-
43
- var getHasAdvancedAttributes = function getHasAdvancedAttributes(attrValues) {
44
- return R.pipe(R.omit(R.concat(customAttributes.flags, customAttributes.notes)), R.isEmpty, R.not)(attrValues);
45
- };
46
-
47
- var combinationConceptIds = R.reduce(function (acc, def) {
48
- var concepts = R.propOr([], 'concepts', def);
49
- if (R.isEmpty(concepts)) {
50
- return acc;
51
- }
52
- return R.concat(acc, concepts);
53
- }, [], _definition);
54
-
55
- var definition = R.map( //used for parseValueHierarchy ...
56
- function (entry) {
57
- if (R.has('dimensions', entry)) {
58
- return (0, _extends3.default)({}, entry, {
59
- dimensions: R.map(function (dim) {
60
- return R.assoc('indexedValues', R.indexBy(R.prop('id'), dim.values || []), dim);
61
- }, entry.dimensions)
62
- });
63
- }
64
- return R.assoc('indexedValues', R.indexBy(R.prop('id'), entry.values || []), entry);
65
- }, _definition);
66
-
67
- var _R$reduce = R.reduce(function (acc, serie) {
68
- var data = [];
69
- var next = [];
70
- var sameSerie = true;
71
- var i = 0;
72
- var hasAdvancedAttributes = false;
73
- var coordinates = topCoordinates;
74
- var ids = [];
75
- while (i < serie.length) {
76
- var entry = serie[i];
77
- if (R.is(Array, entry)) {
78
- var combination = definition[i];
79
- var previousDimValues = R.nth(i, acc.previous);
80
- var combData = (0, _getCombinationDimensionsData.getCombinationDimensionsData)(entry, combination, previousDimValues, sameSerie);
81
- data = R.append({
82
- dimension: R.pick(['id', 'name'], combination),
83
- dimValues: combData.dimValues
84
- }, data);
85
- next = R.append(combData.dimValues, next);
86
- hasAdvancedAttributes = !hasAdvancedAttributes ? combData.hasAdvancedAttributes : true;
87
- sameSerie = combData.sameSerie;
88
- coordinates = (0, _extends3.default)({}, coordinates, combData.coordinates);
89
- ids = R.concat(ids, combData.ids);
90
- } else {
91
- var dimension = definition[i];
92
- var value = R.nth(Math.abs(entry), dimension.values || []);
93
- var previousValue = R.nth(i, acc.previous) || {};
94
- coordinates = R.assoc(dimension.id, value.id, coordinates);
95
- ids = R.append(dimension.id + '=' + value.id, ids);
96
- if ((0, _parseValueHierarchy.isSameValueAsPrevious)(value, previousValue) && sameSerie) {
97
- next = R.append(previousValue, next);
98
- data = R.append({
99
- dimension: R.pick(['id', 'name', '__index'], dimension),
100
- value: previousValue
101
- }, data);
102
- } else {
103
- hasAdvancedAttributes = !hasAdvancedAttributes ? value.hasAdvancedAttributes : true;
104
- var parsedValue = (0, _parseValueHierarchy.parseValueHierarchy)(value, sameSerie ? previousValue || {} : {}, dimension.indexedValues);
105
- next = R.append(parsedValue, next);
106
- data = R.append({
107
- dimension: R.pick(['id', 'name', '__index'], dimension),
108
- value: parsedValue
109
- }, data);
110
- if (!R.isNil(acc.previous)) {
111
- sameSerie = false;
112
- }
113
- }
114
- }
115
- i++;
116
- }
117
-
118
- var coordinatesValidator = (0, _utils.getLayoutCoordinatesValidator)(coordinates, topCoordinates);
119
- var attributesValues = R.reduce(function (acc, serie) {
120
- var coordinates = R.path([0, 'coordinates'], R.values(serie));
121
- var isValid = coordinatesValidator(coordinates);
122
- if (!isValid) {
123
- return acc;
124
- }
125
- var isSingleBounded = R.length(R.keys(coordinates)) === 1;
126
- return (0, _extends3.default)({}, acc, isSingleBounded ? R.pick(combinationConceptIds, serie) : serie);
127
- }, {}, R.values(attributesSeries));
128
-
129
- data = R.addIndex(R.reduce)(function (acc, entry, ind) {
130
- if (!R.has('dimValues', entry)) {
131
- return R.append(entry, acc);
132
- }
133
- var dimValues = entry.dimValues,
134
- dimension = entry.dimension;
135
-
136
- var def = R.nth(ind, definition);
137
- if (!R.propOr(true, 'display', def)) {
138
- return acc;
139
- }
140
- var fixedDimValues = R.propOr([], 'fixedDimValues', def);
141
- var values = R.reduce(function (_acc, id) {
142
- if (R.has(id, dimValues)) {
143
- var _value = R.prop(id, dimValues);
144
- return R.append(_value, _acc);
145
- }
146
- if (R.has(id, fixedDimValues)) {
147
- return R.append(R.prop(id, fixedDimValues), _acc);
148
- }
149
- if (!R.has(id, attributesValues)) {
150
- return _acc;
151
- }
152
- return R.append(R.path([id, 'value'], attributesValues), _acc);
153
- }, [], def.concepts);
154
- return R.append({ dimension: dimension, values: values }, acc);
155
- }, [], data);
156
-
157
- var layoutAttrValues = R.reject(R.prop('isObs'), R.omit(combinationConceptIds, attributesValues));
158
-
159
- var flags = (0, _getFlagsAndNotes.getFlagsAndNotes)(layoutAttrValues, customAttributes);
160
- var hasMetadata = !R.isNil(R.find(coordinatesValidator, metadataCoordinates));
161
-
162
- if (!hasAdvancedAttributes) {
163
- hasAdvancedAttributes = getHasAdvancedAttributes(layoutAttrValues);
164
- }
165
-
166
- var sideProps = hasMetadata || hasAdvancedAttributes ? { hasMetadata: hasMetadata, hasAdvancedAttributes: hasAdvancedAttributes, coordinates: coordinates } : null;
167
-
168
- return {
169
- res: R.append({ data: data, key: R.join(':', ids), flags: flags, sideProps: sideProps, coordinates: coordinates }, acc.res),
170
- previous: next
171
- };
172
- }, { res: [], previous: [] }, series),
173
- res = _R$reduce.res;
174
-
175
- return res;
176
- };
177
-
178
- var getLayoutData = function getLayoutData(layoutIndexes, layout, _ref2) {
179
- var metadataCoordinates = _ref2.metadataCoordinates,
180
- attributesSeries = _ref2.attributesSeries,
181
- customAttributes = _ref2.customAttributes,
182
- _ref2$topCoordinates = _ref2.topCoordinates,
183
- topCoordinates = _ref2$topCoordinates === undefined ? {} : _ref2$topCoordinates;
184
- var header = layoutIndexes.header,
185
- sections = layoutIndexes.sections,
186
- rest = (0, _objectWithoutProperties3.default)(layoutIndexes, ['header', 'sections']);
187
-
188
- var opts = { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes, topCoordinates: topCoordinates };
189
- var headerData = getSubLayoutData(header, layout.header, opts);
190
- var sectionsData = R.pipe(R.transpose, function (_ref3) {
191
- var _ref4 = (0, _slicedToArray3.default)(_ref3, 2),
192
- sections = _ref4[0],
193
- sectionsRows = _ref4[1];
194
-
195
- if (R.isNil(sections)) {
196
- return [];
197
- }
198
- var _sectionsData = getSubLayoutData(sections, layout.sections, opts);
199
- var rowsData = R.addIndex(R.map)(function (rows, sectionIndex) {
200
- var sectionCoordinates = R.path([sectionIndex, 'coordinates'], _sectionsData);
201
- return getSubLayoutData(rows, layout.rows, R.assoc('topCoordinates', sectionCoordinates, opts));
202
- }, sectionsRows);
203
-
204
- return R.transpose([_sectionsData, rowsData]);
205
- })(sections);
206
-
207
- return (0, _extends3.default)({ headerData: headerData, sectionsData: sectionsData }, rest);
208
- };
209
- exports.getLayoutData = getLayoutData;