@sis-cc/dotstatsuite-components 9.3.0 → 9.3.4
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/table/factories/getLayoutData.js +9 -4
- package/lib/rules/src/table/factories/refineLayoutSize.js +3 -3
- package/package.json +2 -2
- package/src/rules/src/table/factories/getLayoutData.js +2 -2
- package/src/rules/src/table/factories/refineLayoutSize.js +12 -4
- package/test/getTableData.test.js +1 -0
- package/test/mocks/table-layout-multi-hierarchies--layoutData.json +2 -1
- package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +2 -1
- package/test/mocks/table-layout-truncation1--layoutData.json +2 -1
- package/test/mocks/table-layout-truncation1--sizedIndexes.json +2 -1
- package/test/refineLayoutSize.test.js +6 -0
|
@@ -9,6 +9,10 @@ var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
|
|
|
9
9
|
|
|
10
10
|
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
|
|
11
11
|
|
|
12
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
15
|
+
|
|
12
16
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
13
17
|
|
|
14
18
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
@@ -136,10 +140,10 @@ var getRowsData = function getRowsData(rowsIndexes, dimensions) {
|
|
|
136
140
|
return R.unnest(res);
|
|
137
141
|
};
|
|
138
142
|
|
|
139
|
-
var getLayoutData =
|
|
143
|
+
var getLayoutData = function getLayoutData(layoutIndexes, layout) {
|
|
140
144
|
var header = layoutIndexes.header,
|
|
141
145
|
sections = layoutIndexes.sections,
|
|
142
|
-
|
|
146
|
+
rest = (0, _objectWithoutProperties3.default)(layoutIndexes, ['header', 'sections']);
|
|
143
147
|
|
|
144
148
|
var headerData = R.map(function (i) {
|
|
145
149
|
return indexesToLayoutData(layout.header, i);
|
|
@@ -157,5 +161,6 @@ var getLayoutData = exports.getLayoutData = function getLayoutData(layoutIndexes
|
|
|
157
161
|
return [sectionData, rowsData];
|
|
158
162
|
}, sections);
|
|
159
163
|
|
|
160
|
-
return { headerData: headerData, sectionsData: sectionsData,
|
|
161
|
-
};
|
|
164
|
+
return (0, _extends3.default)({ headerData: headerData, sectionsData: sectionsData }, rest);
|
|
165
|
+
};
|
|
166
|
+
exports.getLayoutData = getLayoutData;
|
|
@@ -142,7 +142,7 @@ var refineLayoutSize = exports.refineLayoutSize = function refineLayoutSize(_ref
|
|
|
142
142
|
sections = layoutIndexes.sections;
|
|
143
143
|
|
|
144
144
|
if (R.isNil(limit) || limit === 0 || R.all(R.isEmpty, [header, sections])) {
|
|
145
|
-
return R.
|
|
145
|
+
return R.pipe(R.set(R.lensProp('truncated'), false), R.set(R.lensProp('totalCells'), null))(layoutIndexes);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
//number of dimensions in header
|
|
@@ -178,7 +178,7 @@ var refineLayoutSize = exports.refineLayoutSize = function refineLayoutSize(_ref
|
|
|
178
178
|
|
|
179
179
|
var excess = total - limit;
|
|
180
180
|
if (excess <= 0) {
|
|
181
|
-
return R.
|
|
181
|
+
return R.pipe(R.set(R.lensProp('truncated'), false), R.set(R.lensProp('totalCells'), total))(layoutIndexes);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// total of cells in one column
|
|
@@ -205,6 +205,6 @@ var refineLayoutSize = exports.refineLayoutSize = function refineLayoutSize(_ref
|
|
|
205
205
|
|
|
206
206
|
var result = getRefinedLayout(isVertical, truncated, refined);
|
|
207
207
|
|
|
208
|
-
return R.
|
|
208
|
+
return R.pipe(R.set(R.lensProp('truncated'), true), R.set(R.lensProp('totalCells'), total))(result);
|
|
209
209
|
};
|
|
210
210
|
};
|
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": "9.3.
|
|
4
|
+
"version": "9.3.4",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "OECD",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@react-hook/size": "^2.1.1",
|
|
21
21
|
"@sis-cc/dotstatsuite-d3-charts": "^8.0.0",
|
|
22
22
|
"@sis-cc/dotstatsuite-sdmxjs": "^4.5.2",
|
|
23
|
-
"@sis-cc/dotstatsuite-visions": "^6.
|
|
23
|
+
"@sis-cc/dotstatsuite-visions": "^6.6.3",
|
|
24
24
|
"date-fns": "^1.30.1",
|
|
25
25
|
"glamor": "^2.20.40",
|
|
26
26
|
"glamorous": "^4.13.1",
|
|
@@ -150,7 +150,7 @@ const getRowsData = (rowsIndexes, dimensions) => {
|
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
export const getLayoutData = (layoutIndexes, layout) => {
|
|
153
|
-
const { header, sections,
|
|
153
|
+
const { header, sections, ...rest } = layoutIndexes;
|
|
154
154
|
const headerData = R.map(i => indexesToLayoutData(layout.header, i), header);
|
|
155
155
|
|
|
156
156
|
const sectionsData = R.map(
|
|
@@ -165,5 +165,5 @@ export const getLayoutData = (layoutIndexes, layout) => {
|
|
|
165
165
|
sections
|
|
166
166
|
);
|
|
167
167
|
|
|
168
|
-
return ({ headerData, sectionsData,
|
|
168
|
+
return ({ headerData, sectionsData, ...rest });
|
|
169
169
|
};
|
|
@@ -140,7 +140,10 @@ const segregateLayout = (isVertical) => R.ifElse(
|
|
|
140
140
|
export const refineLayoutSize = ({ layout, observations, limit }) => layoutIndexes => {
|
|
141
141
|
const { header, sections } = layoutIndexes;
|
|
142
142
|
if (R.isNil(limit) || limit === 0 || R.all(R.isEmpty, [header, sections])) {
|
|
143
|
-
return R.
|
|
143
|
+
return R.pipe(
|
|
144
|
+
R.set(R.lensProp('truncated'), false),
|
|
145
|
+
R.set(R.lensProp('totalCells'), null),
|
|
146
|
+
)(layoutIndexes);
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
//number of dimensions in header
|
|
@@ -192,7 +195,10 @@ export const refineLayoutSize = ({ layout, observations, limit }) => layoutIndex
|
|
|
192
195
|
|
|
193
196
|
const excess = total - limit;
|
|
194
197
|
if (excess <= 0) {
|
|
195
|
-
return R.
|
|
198
|
+
return R.pipe(
|
|
199
|
+
R.set(R.lensProp('truncated'), false),
|
|
200
|
+
R.set(R.lensProp('totalCells'), total),
|
|
201
|
+
)(layoutIndexes);
|
|
196
202
|
}
|
|
197
203
|
|
|
198
204
|
// total of cells in one column
|
|
@@ -202,7 +208,6 @@ export const refineLayoutSize = ({ layout, observations, limit }) => layoutIndex
|
|
|
202
208
|
|
|
203
209
|
const [toTruncate, toRefine] = segregateLayout(isVertical)(layoutIndexes);
|
|
204
210
|
|
|
205
|
-
|
|
206
211
|
const cutLength = R.pipe(
|
|
207
212
|
R.ifElse(R.identity, R.always(rowCellsCount), R.always(columnCellsCount)),
|
|
208
213
|
R.divide(excess),
|
|
@@ -220,5 +225,8 @@ export const refineLayoutSize = ({ layout, observations, limit }) => layoutIndex
|
|
|
220
225
|
|
|
221
226
|
const result = getRefinedLayout(isVertical, truncated, refined);
|
|
222
227
|
|
|
223
|
-
return R.
|
|
228
|
+
return R.pipe(
|
|
229
|
+
R.set(R.lensProp('truncated'), true),
|
|
230
|
+
R.set(R.lensProp('totalCells'), total),
|
|
231
|
+
)(result);
|
|
224
232
|
};
|
|
@@ -32406,5 +32406,6 @@
|
|
|
32406
32406
|
]
|
|
32407
32407
|
]
|
|
32408
32408
|
],
|
|
32409
|
-
"truncated": false
|
|
32409
|
+
"truncated": false,
|
|
32410
|
+
"totalCells": 2754
|
|
32410
32411
|
}
|
|
@@ -20353,5 +20353,6 @@
|
|
|
20353
20353
|
]
|
|
20354
20354
|
]
|
|
20355
20355
|
],
|
|
20356
|
-
"truncated": true
|
|
20356
|
+
"truncated": true,
|
|
20357
|
+
"totalCells": 7503
|
|
20357
20358
|
}
|
|
@@ -118,6 +118,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
118
118
|
|
|
119
119
|
const expected = {
|
|
120
120
|
truncated: false,
|
|
121
|
+
totalCells: 57,
|
|
121
122
|
header: [[0], [1], [2]],
|
|
122
123
|
sections: [
|
|
123
124
|
[[0], [[0], [1], [2]]],
|
|
@@ -179,6 +180,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
179
180
|
};
|
|
180
181
|
|
|
181
182
|
const expected = {
|
|
183
|
+
totalCells: 140,
|
|
182
184
|
truncated: true,
|
|
183
185
|
header: [[]],
|
|
184
186
|
sections: [
|
|
@@ -260,6 +262,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
260
262
|
};
|
|
261
263
|
|
|
262
264
|
const expected = {
|
|
265
|
+
totalCells: 140,
|
|
263
266
|
truncated: true,
|
|
264
267
|
header: [
|
|
265
268
|
[0, 0, 0],
|
|
@@ -310,6 +313,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
310
313
|
};
|
|
311
314
|
|
|
312
315
|
const expected = {
|
|
316
|
+
totalCells: 57,
|
|
313
317
|
truncated: true,
|
|
314
318
|
header: [[0],[2]],
|
|
315
319
|
sections: [
|
|
@@ -349,6 +353,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
349
353
|
};
|
|
350
354
|
|
|
351
355
|
const expected = {
|
|
356
|
+
totalCells: 64,
|
|
352
357
|
truncated:true,
|
|
353
358
|
header: [
|
|
354
359
|
[0, 0],
|
|
@@ -392,6 +397,7 @@ describe('refineLayoutSize tests', () => {
|
|
|
392
397
|
};
|
|
393
398
|
|
|
394
399
|
const expected = {
|
|
400
|
+
totalCells: 64,
|
|
395
401
|
truncated: true,
|
|
396
402
|
header: [
|
|
397
403
|
[0, 0],
|