@sis-cc/dotstatsuite-components 20.6.0 → 21.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.
Files changed (161) hide show
  1. package/.gitlab-ci.yml +3 -2
  2. package/README.md +1 -17
  3. package/package.json +20 -14
  4. package/src/bridge-d3-react/src/react-chart-factory.js +1 -2
  5. package/src/rules/src/factories/sample-series.js +1 -1
  6. package/src/rules/src/index.js +14 -13
  7. package/src/rules/src/observation-formater.js +0 -1
  8. package/src/rules/src/properties/focus.js +3 -3
  9. package/src/rules/src/sdmx-data/index.js +2 -0
  10. package/src/viewer/src/index.js +4 -5
  11. package/src/viewer/src/legends/AxisLegend.js +0 -7
  12. package/src/viewer/src/legends/FocusLegend.js +2 -10
  13. package/src/viewer/src/legends/Legend.js +0 -6
  14. package/src/viewer/src/legends/SeriesLegend.js +0 -7
  15. package/vite.config.mjs +51 -0
  16. package/lib/app.js +0 -22
  17. package/lib/bridge-d3-react/src/app.js +0 -98
  18. package/lib/bridge-d3-react/src/index.js +0 -33
  19. package/lib/bridge-d3-react/src/mock-choro.js +0 -41
  20. package/lib/bridge-d3-react/src/react-chart-factory.js +0 -103
  21. package/lib/index.js +0 -41
  22. package/lib/rules/src/chart/getAxisOptions.js +0 -206
  23. package/lib/rules/src/chart/getBaseOptions.js +0 -51
  24. package/lib/rules/src/chart/getChartOptions.js +0 -106
  25. package/lib/rules/src/chart/getGridOptions.js +0 -21
  26. package/lib/rules/src/chart/getTooltipOptions.js +0 -84
  27. package/lib/rules/src/constants.js +0 -68
  28. package/lib/rules/src/date.js +0 -180
  29. package/lib/rules/src/dimension-utils.js +0 -67
  30. package/lib/rules/src/factories/choro-series.js +0 -99
  31. package/lib/rules/src/factories/sample-focus.js +0 -64
  32. package/lib/rules/src/factories/sample-series.js +0 -90
  33. package/lib/rules/src/factories/scatter-dimension.js +0 -72
  34. package/lib/rules/src/factories/scatter-focus.js +0 -77
  35. package/lib/rules/src/factories/scatter-series.js +0 -145
  36. package/lib/rules/src/factories/stacked-dimension.js +0 -42
  37. package/lib/rules/src/factories/stacked-series.js +0 -166
  38. package/lib/rules/src/factories/symbol-dimension.js +0 -69
  39. package/lib/rules/src/factories/symbol-series.js +0 -119
  40. package/lib/rules/src/factories/timeline-focus.js +0 -38
  41. package/lib/rules/src/factories/timeline-series.js +0 -121
  42. package/lib/rules/src/get-values-enhanced.js +0 -141
  43. package/lib/rules/src/header/getDefaultSubtitle.js +0 -50
  44. package/lib/rules/src/header/getHeaderUnits.js +0 -26
  45. package/lib/rules/src/header/getSubtitleFlags.js +0 -53
  46. package/lib/rules/src/header/getTitleFlags.js +0 -24
  47. package/lib/rules/src/header/index.js +0 -41
  48. package/lib/rules/src/index.js +0 -714
  49. package/lib/rules/src/layout.js +0 -98
  50. package/lib/rules/src/observation-formater.js +0 -112
  51. package/lib/rules/src/preparators/enhanceObservations.js +0 -142
  52. package/lib/rules/src/preparators/formatValue.js +0 -83
  53. package/lib/rules/src/preparators/getObservations.js +0 -27
  54. package/lib/rules/src/preparators/getReportingYearStart.js +0 -52
  55. package/lib/rules/src/properties/errors.js +0 -31
  56. package/lib/rules/src/properties/focus.js +0 -90
  57. package/lib/rules/src/properties/getAvailableChartTypes.js +0 -30
  58. package/lib/rules/src/properties/getHeaderProps.js +0 -83
  59. package/lib/rules/src/properties/getInformationsStateFromNewProps.js +0 -61
  60. package/lib/rules/src/properties/getObservationsType.js +0 -31
  61. package/lib/rules/src/properties/getStringifiedSubtitle.js +0 -18
  62. package/lib/rules/src/properties/index.js +0 -401
  63. package/lib/rules/src/properties/information.js +0 -79
  64. package/lib/rules/src/properties/linear.js +0 -158
  65. package/lib/rules/src/properties/scatter.js +0 -174
  66. package/lib/rules/src/properties/stacked.js +0 -133
  67. package/lib/rules/src/properties/symbol.js +0 -96
  68. package/lib/rules/src/properties/utils.js +0 -126
  69. package/lib/rules/src/sdmx-data/index.js +0 -55
  70. package/lib/rules/src/table/factories/getCellValue.js +0 -57
  71. package/lib/rules/src/table/index.js +0 -14
  72. package/lib/rules/src/v8-transformer.js +0 -184
  73. package/lib/rules/test/extractSdmxArtefacts.js +0 -37
  74. package/lib/rules/test/get-values-enhanced.test.js +0 -128
  75. package/lib/rules/test/oecd-HEALTH_PROT-parsed.js +0 -303
  76. package/lib/rules/test/scatter-property.js +0 -403
  77. package/lib/rules/test/stacked-property.js +0 -244
  78. package/lib/rules/test/symbol-property.js +0 -234
  79. package/lib/rules/test/v8-transformer.test.js +0 -82
  80. package/lib/rules2/src/applyHierarchicalCodesToDim.js +0 -175
  81. package/lib/rules2/src/combinedValuesDisplay.js +0 -71
  82. package/lib/rules2/src/constants.js +0 -11
  83. package/lib/rules2/src/duplicateObservations.js +0 -39
  84. package/lib/rules2/src/enhanceObservations.js +0 -103
  85. package/lib/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -39
  86. package/lib/rules2/src/getAttributesSeries.js +0 -40
  87. package/lib/rules2/src/getCombinationDefinitions.js +0 -72
  88. package/lib/rules2/src/getDataflowAttributes.js +0 -34
  89. package/lib/rules2/src/getDataflowTooltipAttributesIds.js +0 -38
  90. package/lib/rules2/src/getDimensionValuesIndexes.js +0 -19
  91. package/lib/rules2/src/getHCodelistsRefsInData.js +0 -49
  92. package/lib/rules2/src/getHeaderCombinations.js +0 -51
  93. package/lib/rules2/src/getHeaderCoordinates.js +0 -18
  94. package/lib/rules2/src/getHeaderSubtitle.js +0 -41
  95. package/lib/rules2/src/getHeaderTitle.js +0 -29
  96. package/lib/rules2/src/getMSDInformations.js +0 -43
  97. package/lib/rules2/src/getManyValuesDimensions.js +0 -39
  98. package/lib/rules2/src/getMetadataCoordinates.js +0 -40
  99. package/lib/rules2/src/getMetadataStructureFromData.js +0 -23
  100. package/lib/rules2/src/getNotDisplayedIds.js +0 -58
  101. package/lib/rules2/src/getOneValueDimensions.js +0 -48
  102. package/lib/rules2/src/getSeriesCombinations.js +0 -33
  103. package/lib/rules2/src/hasCellMetadata.js +0 -22
  104. package/lib/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -65
  105. package/lib/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -39
  106. package/lib/rules2/src/index.js +0 -443
  107. package/lib/rules2/src/parseAttributes.js +0 -51
  108. package/lib/rules2/src/parseCombinations.js +0 -96
  109. package/lib/rules2/src/parseHierarchicalCodelist.js +0 -57
  110. package/lib/rules2/src/parseMetadataSeries.js +0 -119
  111. package/lib/rules2/src/prepareData.js +0 -113
  112. package/lib/rules2/src/refineAttributes.js +0 -32
  113. package/lib/rules2/src/refineDimensions.js +0 -38
  114. package/lib/rules2/src/refineMetadataCoordinates.js +0 -35
  115. package/lib/rules2/src/refineTimePeriod.js +0 -154
  116. package/lib/rules2/src/sdmx3.0DataFormatPatch.js +0 -20
  117. package/lib/rules2/src/table/declineObservationsOverAttributes.js +0 -43
  118. package/lib/rules2/src/table/getCells.js +0 -90
  119. package/lib/rules2/src/table/getCellsAttributesIds.js +0 -63
  120. package/lib/rules2/src/table/getCellsMetadataCoordinates.js +0 -30
  121. package/lib/rules2/src/table/getCombinationDimensionsData.js +0 -48
  122. package/lib/rules2/src/table/getCuratedCells.js +0 -28
  123. package/lib/rules2/src/table/getFlagsAndNotes.js +0 -30
  124. package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -31
  125. package/lib/rules2/src/table/getLayout.js +0 -105
  126. package/lib/rules2/src/table/getLayoutData2.js +0 -269
  127. package/lib/rules2/src/table/getSortedLayoutIndexes.js +0 -136
  128. package/lib/rules2/src/table/getTableLabelAccessor.js +0 -20
  129. package/lib/rules2/src/table/getTableLayoutIds.js +0 -365
  130. package/lib/rules2/src/table/getTableProps.js +0 -96
  131. package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -124
  132. package/lib/rules2/src/table/parseValueHierarchy.js +0 -63
  133. package/lib/rules2/src/table/refineLayoutSize2.js +0 -293
  134. package/lib/rules2/src/utils.js +0 -48
  135. package/lib/viewer/mocks/bar.js +0 -21
  136. package/lib/viewer/mocks/gpp-symbol.js +0 -55
  137. package/lib/viewer/mocks/gpp-time.js +0 -1023
  138. package/lib/viewer/mocks/row.js +0 -26
  139. package/lib/viewer/mocks/scatter.js +0 -84
  140. package/lib/viewer/mocks/stack.js +0 -93
  141. package/lib/viewer/src/app/leg.js +0 -101
  142. package/lib/viewer/src/app/nodata-res.js +0 -40
  143. package/lib/viewer/src/app/nodata-sized.js +0 -41
  144. package/lib/viewer/src/app/one-table-cell.js +0 -75
  145. package/lib/viewer/src/app/table.js +0 -300
  146. package/lib/viewer/src/app/use-case-1.js +0 -60
  147. package/lib/viewer/src/app/use-case-2.js +0 -82
  148. package/lib/viewer/src/app/use-case-3.js +0 -52
  149. package/lib/viewer/src/app.js +0 -162
  150. package/lib/viewer/src/chart.js +0 -82
  151. package/lib/viewer/src/chartUtils/options.js +0 -30
  152. package/lib/viewer/src/chartUtils/series.js +0 -63
  153. package/lib/viewer/src/footer.js +0 -54
  154. package/lib/viewer/src/header.js +0 -29
  155. package/lib/viewer/src/index.js +0 -243
  156. package/lib/viewer/src/legends/AxisLegend.js +0 -84
  157. package/lib/viewer/src/legends/ChartLegends.js +0 -100
  158. package/lib/viewer/src/legends/FocusLegend.js +0 -89
  159. package/lib/viewer/src/legends/Legend.js +0 -88
  160. package/lib/viewer/src/legends/SeriesLegend.js +0 -108
  161. package/lib/viewer/src/utils.js +0 -36
@@ -1,136 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getSortedLayoutIndexes = undefined;
7
-
8
- var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
9
-
10
- var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
11
-
12
- var _extends2 = require('babel-runtime/helpers/extends');
13
-
14
- var _extends3 = _interopRequireDefault(_extends2);
15
-
16
- var _ramda = require('ramda');
17
-
18
- var R = _interopRequireWildcard(_ramda);
19
-
20
- 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; } }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- /*
25
- const layout = {
26
- header: [
27
- { id, __index },
28
- { id: COMB, dimensions: [{ id, __index }] }
29
- ],
30
- sections: [],
31
- rows: []
32
- }
33
-
34
- */
35
-
36
- var getLayoutPivots = function getLayoutPivots(layoutEntry) {
37
- var valIndexGetter = function valIndexGetter(d) {
38
- return R.pipe(R.nth(R.prop('__index', d)), function (ind) {
39
- return d.isInverted ? R.negate(ind) : ind;
40
- });
41
- };
42
- return function (indexes) {
43
- return R.map(R.ifElse(R.has('dimensions'), function (c) {
44
- return R.map(function (d) {
45
- return valIndexGetter(d)(indexes);
46
- }, R.prop('dimensions', c));
47
- }, function (d) {
48
- if (d.id === 'OBS_ATTRIBUTES') {
49
- return R.last(indexes);
50
- }
51
- return valIndexGetter(d)(indexes);
52
- }), layoutEntry);
53
- };
54
- };
55
-
56
- var comparator = function comparator(a, b) {
57
- var size = R.length(a);
58
- var i = 0;
59
- while (i < size) {
60
- if (R.is(Array, a[i])) {
61
- var _a = a[i];
62
- var _b = b[i];
63
- var _size = R.length(_a);
64
- var j = 0;
65
- while (_a[j] === _b[j] && j < _size) {
66
- j++;
67
- }
68
- if (_a[j] !== _b[j]) {
69
- return _a[j] - _b[j];
70
- }
71
- } else if (a[i] !== b[i]) {
72
- return a[i] - b[i];
73
- }
74
- i++;
75
- }
76
- return a[i] - b[i];
77
- };
78
-
79
- // simple call to ramda uniq method is very slow regarding performance
80
- var uniqIndexes = function uniqIndexes(indexes) {
81
- return R.pipe(R.reduce(function (acc, i) {
82
- var key = R.join(':', R.unnest(i));
83
- if (R.has(key, acc.keys)) {
84
- return acc;
85
- }
86
- return {
87
- indexes: R.append(i, acc.indexes),
88
- keys: R.assoc(key, key, acc.keys)
89
- };
90
- }, { indexes: [], keys: {} }), R.prop('indexes'))(indexes);
91
- };
92
-
93
- var getSortedLayoutIndexes = exports.getSortedLayoutIndexes = function getSortedLayoutIndexes(layout, observations) {
94
- var dimIndexes = R.pipe(R.values, R.map(R.propOr([], 'orderedDimIndexes')))(observations);
95
-
96
- var headerPivots = getLayoutPivots(layout.header);
97
- var sectionsPivots = getLayoutPivots(R.concat(layout.sections, layout.rows));
98
-
99
- var sectionLength = R.length(layout.sections);
100
-
101
- var _R$pipe = R.pipe(R.reduce(function (acc, indexes) {
102
- var headerIndexes = headerPivots(indexes);
103
- var sectionsIndexes = sectionsPivots(indexes);
104
-
105
- return {
106
- header: R.append(headerIndexes, acc.header),
107
- sections: R.append(sectionsIndexes, acc.sections)
108
- };
109
- }, { header: [], sections: [] }), R.mapObjIndexed(uniqIndexes), R.evolve({
110
- header: R.sort(comparator),
111
- sections: R.sort(comparator)
112
- }), function (indexes) {
113
- return (0, _extends3.default)({}, indexes, {
114
- sections: R.reduce(function (acc, i) {
115
- var _R$splitAt = R.splitAt(sectionLength, i),
116
- _R$splitAt2 = (0, _slicedToArray3.default)(_R$splitAt, 2),
117
- sectionIndexes = _R$splitAt2[0],
118
- rowIndexes = _R$splitAt2[1];
119
-
120
- var previousSecIndexes = R.pipe(R.nth(-1), function (i) {
121
- return R.isNil(i) ? null : R.head(i);
122
- })(acc);
123
- if (R.equals(R.unnest(sectionIndexes), previousSecIndexes ? R.unnest(previousSecIndexes) : null)) {
124
- //perhaps a bit dirty ...
125
- return R.over(R.lensIndex(-1), R.over(R.lensIndex(1), R.append(rowIndexes)))(acc);
126
- }
127
-
128
- return R.append([sectionIndexes, [rowIndexes]], acc);
129
- }, [], indexes.sections)
130
- });
131
- })(dimIndexes),
132
- header = _R$pipe.header,
133
- sections = _R$pipe.sections;
134
-
135
- return { header: header, sections: sections };
136
- };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTableLabelAccessor = undefined;
7
-
8
- var _ramda = require('ramda');
9
-
10
- var R = _interopRequireWildcard(_ramda);
11
-
12
- var _combinedValuesDisplay = require('../combinedValuesDisplay');
13
-
14
- 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; } }
15
-
16
- var getTableLabelAccessor = exports.getTableLabelAccessor = function getTableLabelAccessor(display) {
17
- return function (content) {
18
- return R.is(Array, content) ? (0, _combinedValuesDisplay.combinedValuesDisplay)(display, content) : (0, _combinedValuesDisplay.singleValueDisplay)(display, content);
19
- };
20
- };
@@ -1,365 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTableLayoutIds = exports.injectRemainingDimensionsInLayout = exports.getLayoutCombinations = exports.getLayoutDimsIds = exports.injectCombinationsInLayout = exports.getCombinationLevelCompatibility = exports.injectCombination = exports.getLayoutRelationships = exports.getLayoutLevelRelationship = exports.indexCombsRelationships = exports.getCombinationsNotInLayout = undefined;
7
-
8
- var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
9
-
10
- var _defineProperty3 = _interopRequireDefault(_defineProperty2);
11
-
12
- var _extends3 = require('babel-runtime/helpers/extends');
13
-
14
- var _extends4 = _interopRequireDefault(_extends3);
15
-
16
- var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
17
-
18
- var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
19
-
20
- var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
21
-
22
- var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
23
-
24
- var _set = require('babel-runtime/core-js/set');
25
-
26
- var _set2 = _interopRequireDefault(_set);
27
-
28
- var _ramda = require('ramda');
29
-
30
- var R = _interopRequireWildcard(_ramda);
31
-
32
- var _dotstatsuiteSdmxjs = require('@sis-cc/dotstatsuite-sdmxjs');
33
-
34
- 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; } }
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- var getCombinationsNotInLayout = exports.getCombinationsNotInLayout = function getCombinationsNotInLayout(combinations, layoutIds) {
39
- var _layoutIds$header = layoutIds.header,
40
- header = _layoutIds$header === undefined ? [] : _layoutIds$header,
41
- _layoutIds$sections = layoutIds.sections,
42
- sections = _layoutIds$sections === undefined ? [] : _layoutIds$sections,
43
- _layoutIds$rows = layoutIds.rows,
44
- rows = _layoutIds$rows === undefined ? [] : _layoutIds$rows;
45
-
46
- var idsInLayout = new _set2.default([].concat((0, _toConsumableArray3.default)(header), (0, _toConsumableArray3.default)(sections), (0, _toConsumableArray3.default)(rows)));
47
- return R.reject(function (comb) {
48
- return idsInLayout.has(comb.id);
49
- }, combinations);
50
- };
51
-
52
- var indexCombsRelationships = exports.indexCombsRelationships = function indexCombsRelationships(combinations) {
53
- return R.reduce(function (acc, comb) {
54
- var id = comb.id,
55
- _comb$relationship = comb.relationship,
56
- relationship = _comb$relationship === undefined ? [] : _comb$relationship;
57
-
58
- return R.assoc(id, relationship, acc);
59
- }, {}, combinations);
60
- };
61
-
62
- var getLayoutLevelRelationship = exports.getLayoutLevelRelationship = function getLayoutLevelRelationship(indexedRelationships) {
63
- return function (ids) {
64
- return R.reduce(function (acc, id) {
65
- if (R.has(id, indexedRelationships)) {
66
- return R.concat(acc, R.prop(id, indexedRelationships));
67
- }
68
- return R.append(id, acc);
69
- }, [], ids);
70
- };
71
- };
72
-
73
- var getLayoutRelationships = exports.getLayoutRelationships = function getLayoutRelationships(indexedRelationships, layoutIds) {
74
- return R.map(getLayoutLevelRelationship(indexedRelationships), layoutIds);
75
- };
76
-
77
- var injectCombination = exports.injectCombination = function injectCombination(combination) {
78
- return function (ids) {
79
- var id = combination.id,
80
- _combination$concepts = combination.concepts,
81
- concepts = _combination$concepts === undefined ? [] : _combination$concepts;
82
-
83
- var conceptsSet = new _set2.default(concepts);
84
- var inject = true;
85
- var refined = R.reduce(function (acc, i) {
86
- if (!conceptsSet.has(i)) {
87
- return R.append(i, acc);
88
- }
89
- if (inject) {
90
- inject = false;
91
- return R.append(id, acc);
92
- }
93
- return acc;
94
- }, [], ids);
95
- return inject ? R.append(id, refined) : refined;
96
- };
97
- };
98
-
99
- var getCombinationLevelCompatibility = exports.getCombinationLevelCompatibility = function getCombinationLevelCompatibility(layoutRelationships, combination) {
100
- var _combination$relation = combination.relationship,
101
- relationship = _combination$relation === undefined ? [] : _combination$relation;
102
-
103
- var idsInHeaderSet = new _set2.default(layoutRelationships.header);
104
- var idsInSectionsSet = new _set2.default(layoutRelationships.sections);
105
- var idsInRowsSet = new _set2.default(layoutRelationships.rows);
106
-
107
- var _R$partition = R.partition(function (i) {
108
- return idsInHeaderSet.has(i);
109
- }, relationship),
110
- _R$partition2 = (0, _slicedToArray3.default)(_R$partition, 2),
111
- idsInHeader = _R$partition2[0],
112
- rest = _R$partition2[1];
113
-
114
- var _R$reduce = R.reduce(function (_acc, id) {
115
- if (idsInSectionsSet.has(id)) return R.over(R.lensIndex(0), R.append(id), _acc);
116
- if (idsInRowsSet.has(id)) return R.over(R.lensIndex(1), R.append(id), _acc);
117
- return R.over(R.lensIndex(2), R.append(id), _acc);
118
- }, [[], [], []], rest),
119
- _R$reduce2 = (0, _slicedToArray3.default)(_R$reduce, 2),
120
- idsInSections = _R$reduce2[0],
121
- idsInRows = _R$reduce2[1];
122
-
123
- if (!R.isEmpty(idsInHeader) && R.isEmpty(idsInSections) && R.isEmpty(idsInRows)) {
124
- return 'header';
125
- }
126
- if (!R.isEmpty(idsInHeader)) {
127
- return null;
128
- }
129
- if (!R.isEmpty(idsInSections) && R.isEmpty(idsInRows)) {
130
- return 'sections';
131
- }
132
- if (!R.isEmpty(idsInRows)) {
133
- return 'rows';
134
- }
135
- return 'blank';
136
- };
137
-
138
- var filterLayoutIds = function filterLayoutIds(indexedCombinations, layoutDimsIds, obsAttributes) {
139
- return function (layoutIds) {
140
- var layoutConcepts = R.map(R.reduce(function (acc, id) {
141
- if (R.has(id, indexedCombinations)) {
142
- return R.concat(acc, R.path([id, 'concepts'], indexedCombinations));
143
- }
144
- return R.append(id, acc);
145
- }, []), layoutIds);
146
-
147
- return R.mapObjIndexed(function (ids, level) {
148
- return R.filter(function (id) {
149
- if (id === 'OBS_ATTRIBUTES') {
150
- return !R.isEmpty(obsAttributes);
151
- }
152
- if (R.has(id, indexedCombinations)) {
153
- var comb = R.prop(id, indexedCombinations);
154
- var dims = R.filter(function (i) {
155
- return layoutDimsIds.has(i);
156
- }, comb.concepts);
157
- if (!R.isEmpty(dims)) {
158
- return true;
159
- }
160
- var oppositeIds = level === 'header' ? R.concat(R.prop('sections', layoutConcepts), R.prop('rows', layoutConcepts)) : R.prop('header', layoutConcepts);
161
- return R.isEmpty(R.intersection(comb.relationship, oppositeIds));
162
- }
163
- return layoutDimsIds.has(id);
164
- }, ids);
165
- }, layoutIds);
166
- };
167
- };
168
-
169
- var injectCombinationsInLayout = exports.injectCombinationsInLayout = function injectCombinationsInLayout(combinations, layoutIds) {
170
- var defaultLayoutIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
171
-
172
- var notInLayoutCombs = getCombinationsNotInLayout(combinations, layoutIds);
173
- if (R.isEmpty(notInLayoutCombs)) {
174
- return layoutIds;
175
- }
176
- var indexedCombsRelationships = indexCombsRelationships(combinations);
177
- var layoutRelationships = getLayoutRelationships(indexedCombsRelationships, layoutIds);
178
- var defaultLayoutRelationships = getLayoutRelationships(indexedCombsRelationships, defaultLayoutIds);
179
- return R.reduce(function (acc, comb) {
180
- var levelCompatibility = getCombinationLevelCompatibility(layoutRelationships, comb);
181
- if (R.isNil(levelCompatibility)) {
182
- return acc;
183
- }
184
- if (R.equals('blank', levelCompatibility)) {
185
- levelCompatibility = getCombinationLevelCompatibility(defaultLayoutRelationships, comb);
186
- if (R.isNil(levelCompatibility)) {
187
- return acc;
188
- }
189
- levelCompatibility = R.equals('blank', levelCompatibility) ? 'rows' : levelCompatibility;
190
- }
191
-
192
- layoutRelationships[levelCompatibility] = R.concat(layoutRelationships[levelCompatibility], comb.relationship);
193
- var ids = injectCombination(comb)(acc[levelCompatibility]);
194
- return R.assoc(levelCompatibility, ids)(acc);
195
- }, layoutIds, notInLayoutCombs);
196
- };
197
-
198
- var getLayoutDimsIds = exports.getLayoutDimsIds = function getLayoutDimsIds(dimensions) {
199
- return R.reduce(function (acc, d) {
200
- return d.header ? acc : acc.add(d.id);
201
- }, new _set2.default([]), dimensions);
202
- };
203
-
204
- var getLayoutCombinations = exports.getLayoutCombinations = function getLayoutCombinations(combinations, layoutDimsIds, attributes) {
205
- var indexedAttributes = R.indexBy(R.prop('id'), attributes);
206
- return R.reduce(function (acc, comb) {
207
- var _R$reduce3 = R.reduce(function (_acc, concept) {
208
- if (layoutDimsIds.has(concept)) {
209
- return R.map(R.append(concept), _acc);
210
- }
211
- if (R.has(concept, indexedAttributes)) {
212
- var attr = R.prop(concept, indexedAttributes);
213
- return attr.series ? (0, _extends4.default)({}, _acc, {
214
- relationship: R.concat(_acc.relationship, attr.relationship)
215
- }) : _acc;
216
- }
217
- return _acc;
218
- }, { layoutConcepts: [], relationship: [] }, comb.concepts || []),
219
- layoutConcepts = _R$reduce3.layoutConcepts,
220
- relationship = _R$reduce3.relationship;
221
-
222
- if (R.isEmpty(relationship)) {
223
- return acc;
224
- }
225
- return R.append((0, _extends4.default)({}, comb, { relationship: relationship, concepts: layoutConcepts }), acc);
226
- }, [], combinations);
227
- };
228
-
229
- var extractConcepts = function extractConcepts(ids, indexedCombinations, layoutDimsIds) {
230
- var entry = R.find(function (id) {
231
- if (R.has(id, indexedCombinations)) {
232
- var dimId = R.find(function (i) {
233
- return layoutDimsIds.has(i);
234
- }, R.pathOr([], [id, 'concepts'], indexedCombinations));
235
- return !R.isNil(dimId);
236
- }
237
- return true;
238
- }, ids);
239
-
240
- var getRelationship = function getRelationship(id) {
241
- if (R.has(id, indexedCombinations)) {
242
- return R.append(id, R.path([id, 'relationship'], indexedCombinations));
243
- }
244
- return [id];
245
- };
246
- var indexedRels = R.reduce(function (acc, id) {
247
- return R.assoc(id, getRelationship(id), acc);
248
- }, {}, ids);
249
-
250
- var relationship = [entry];
251
- while (!R.isEmpty(indexedRels)) {
252
- var related = R.pickBy(function (rels) {
253
- return !R.isEmpty(R.intersection(relationship, rels));
254
- }, indexedRels);
255
- if (R.isEmpty(related)) {
256
- break;
257
- }
258
- indexedRels = R.omit(R.keys(related), indexedRels);
259
- relationship = R.concat(relationship, R.unnest(R.values(related)));
260
- }
261
- var set = new _set2.default(relationship);
262
- return R.partition(function (id) {
263
- return set.has(id);
264
- }, ids);
265
- };
266
-
267
- var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayout = function injectRemainingDimensionsInLayout(layoutIds, remainingDims, indexedCombinations, layoutDimsIds) {
268
- var _layout = layoutIds;
269
- var _remaining = remainingDims;
270
-
271
- var dimInRows = R.find(function (id) {
272
- if (layoutDimsIds.has(id)) {
273
- return true;
274
- }
275
- var dimId = R.find(function (i) {
276
- return layoutDimsIds.has(i);
277
- }, R.pathOr([], [id, 'concepts'], indexedCombinations));
278
- return !R.isNil(dimId);
279
- }, _layout.rows);
280
-
281
- if (R.isNil(dimInRows)) {
282
- if (R.isEmpty(_remaining)) {
283
- var toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
284
-
285
- var _extractConcepts = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations, layoutDimsIds),
286
- _extractConcepts2 = (0, _slicedToArray3.default)(_extractConcepts, 2),
287
- extracted = _extractConcepts2[0],
288
- remains = _extractConcepts2[1];
289
-
290
- _layout = (0, _extends4.default)({}, _layout, (0, _defineProperty3.default)({ rows: R.concat(_layout.rows, extracted) }, toTakeIn, remains));
291
- } else {
292
- _layout = R.over(R.lensProp('rows'), R.append(R.head(_remaining)))(_layout);
293
- _remaining = R.tail(_remaining);
294
- }
295
- }
296
- if (!R.isEmpty(_remaining)) {
297
- var hasNoHeader = R.isEmpty(_layout.header);
298
- var firstRemaining = R.head(_remaining);
299
- _remaining = hasNoHeader ? R.tail(_remaining) : _remaining;
300
- _layout = (0, _extends4.default)({}, _layout, {
301
- sections: R.concat(_layout.sections, _remaining),
302
- header: hasNoHeader ? [firstRemaining] : _layout.header
303
- });
304
- }
305
- return _layout;
306
- };
307
-
308
- var getTableLayoutIds = exports.getTableLayoutIds = function getTableLayoutIds(defaultLayoutIds, currentLayoutIds, dimensions, attributes, combinations) {
309
- var layoutDimsIds = getLayoutDimsIds(dimensions);
310
- var layoutCombinations = getLayoutCombinations(combinations, layoutDimsIds, attributes);
311
- var isBlank = R.pipe(R.values, R.all(R.isEmpty))(currentLayoutIds);
312
-
313
- var combinationsConcepts = R.pipe(R.pluck('_concepts'), R.unnest, function (ids) {
314
- return new _set2.default(ids);
315
- })(combinations);
316
- var obsAttributes = R.filter(function (a) {
317
- return a.series && R.isEmpty(a.relationship || []) && a.display && !combinationsConcepts.has(a);
318
- }, attributes);
319
- var indexedCombinations = R.indexBy(R.prop('id'), layoutCombinations);
320
- var filteredLayoutIds = filterLayoutIds(indexedCombinations, layoutDimsIds, obsAttributes)(isBlank ? defaultLayoutIds : currentLayoutIds);
321
-
322
- var layoutWithCombs = injectCombinationsInLayout(layoutCombinations, filteredLayoutIds, defaultLayoutIds);
323
- var layoutRelationshipsSets = R.map(R.pipe(function (ids) {
324
- return R.pick(ids, indexedCombinations);
325
- }, R.values, R.pluck('relationship'), R.unnest, function (i) {
326
- return new _set2.default(i);
327
- }), layoutWithCombs);
328
- var layoutConceptsSets = R.pipe(R.map(R.reduce(function (acc, id) {
329
- if (R.has(id, indexedCombinations)) {
330
- return R.concat(acc, R.path([id, 'concepts'], indexedCombinations));
331
- }
332
- return R.append(id, acc);
333
- }, [])), R.values, R.unnest, function (ids) {
334
- return new _set2.default(ids);
335
- })(layoutWithCombs);
336
- var defaultLayoutConceptsSets = R.map(function (ids) {
337
- return new _set2.default(ids);
338
- }, defaultLayoutIds);
339
-
340
- var _R$reduce4 = R.reduce(function (acc, dim) {
341
- if (layoutConceptsSets.has(dim.id) || dim.header) {
342
- return acc;
343
- }
344
- if (layoutRelationshipsSets.header.has(dim.id) || defaultLayoutConceptsSets.header.has(dim.id)) {
345
- return R.over(R.lensPath(['nextLayout', 'header']), R.append(dim.id))(acc);
346
- }
347
- if (layoutRelationshipsSets.sections.has(dim.id) || defaultLayoutConceptsSets.sections.has(dim.id)) {
348
- return R.over(R.lensPath(['nextLayout', 'sections']), R.append(dim.id))(acc);
349
- }
350
- if (layoutRelationshipsSets.rows.has(dim.id) || defaultLayoutConceptsSets.rows.has(dim.id)) {
351
- return R.over(R.lensPath(['nextLayout', 'rows']), R.append(dim.id))(acc);
352
- }
353
- if ((0, _dotstatsuiteSdmxjs.isTimePeriodDimension)(dim)) {
354
- return R.over(R.lensPath(['nextLayout', 'header']), R.append(dim.id))(acc);
355
- }
356
- if ((0, _dotstatsuiteSdmxjs.isRefAreaDimension)(dim)) {
357
- return R.over(R.lensPath(['nextLayout', 'rows']), R.append(dim.id))(acc);
358
- }
359
- return R.over(R.lensProp('remaining'), R.append(dim.id))(acc);
360
- }, { nextLayout: layoutWithCombs, remaining: [] }, dimensions),
361
- nextLayout = _R$reduce4.nextLayout,
362
- remaining = _R$reduce4.remaining;
363
-
364
- return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations, layoutDimsIds);
365
- };
@@ -1,96 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTableProps = undefined;
7
-
8
- var _extends2 = require('babel-runtime/helpers/extends');
9
-
10
- var _extends3 = _interopRequireDefault(_extends2);
11
-
12
- var _ramda = require('ramda');
13
-
14
- var R = _interopRequireWildcard(_ramda);
15
-
16
- var _declineObservationsOverAttributes = require('./declineObservationsOverAttributes');
17
-
18
- var _getLayout = require('./getLayout');
19
-
20
- var _getSortedLayoutIndexes = require('./getSortedLayoutIndexes');
21
-
22
- var _parseSeriesIndexesHierarchies = require('./parseSeriesIndexesHierarchies');
23
-
24
- var _refineLayoutSize = require('./refineLayoutSize2');
25
-
26
- var _getLayoutData = require('./getLayoutData2');
27
-
28
- var _getCellsAttributesIds = require('./getCellsAttributesIds');
29
-
30
- var _getIndexedCombinationsByDisplay = require('./getIndexedCombinationsByDisplay');
31
-
32
- var _getCells = require('./getCells');
33
-
34
- var _getCuratedCells = require('./getCuratedCells');
35
-
36
- var _getSeriesCombinations = require('../getSeriesCombinations');
37
-
38
- var _getCellsMetadataCoordinates = require('./getCellsMetadataCoordinates');
39
-
40
- 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; } }
41
-
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
-
44
- var getTableProps = exports.getTableProps = function getTableProps(_ref) {
45
- var data = _ref.data,
46
- layoutIds = _ref.layoutIds,
47
- customAttributes = _ref.customAttributes,
48
- limit = _ref.limit,
49
- isTimeInverted = _ref.isTimeInverted;
50
- var observations = data.observations,
51
- dimensions = data.dimensions,
52
- combinations = data.combinations,
53
- oneValueDimensions = data.oneValueDimensions,
54
- attributesSeries = data.attributesSeries,
55
- metadataCoordinates = data.metadataCoordinates,
56
- attributes = data.attributes,
57
- header = data.header;
58
-
59
-
60
- var obsAttributes = R.filter(function (a) {
61
- return a.series && R.isEmpty(a.relationship) && a.display && !a.combined;
62
- }, attributes);
63
- var dupObs = observations;
64
- var hasDuplicatedCells = R.pipe(R.values, R.unnest, R.find(R.equals('OBS_ATTRIBUTES')))(layoutIds);
65
- if (hasDuplicatedCells) {
66
- var attrsIds = R.pluck('id', obsAttributes);
67
- dupObs = (0, _declineObservationsOverAttributes.declineObservationsOverAttributes)(attrsIds, observations);
68
- }
69
- var seriesCombinations = (0, _getSeriesCombinations.getSeriesCombinations)(combinations, oneValueDimensions);
70
- var _dims = R.append({
71
- id: 'OBS_ATTRIBUTES',
72
- values: R.prepend({ id: 'OBS_VALUE' }, obsAttributes)
73
- }, dimensions);
74
- var layout = (0, _getLayout.getLayout)(layoutIds, _dims, seriesCombinations, isTimeInverted);
75
- var layoutDimsIds = R.map(R.reduce(function (acc, entry) {
76
- if (R.has('dimensions', entry)) {
77
- return R.concat(acc, R.pluck('id', entry.dimensions));
78
- }
79
- return R.append(entry.id, acc);
80
- }, []), layout);
81
- var layoutIndexes = (0, _getSortedLayoutIndexes.getSortedLayoutIndexes)(layout, dupObs);
82
- var enhancedLayoutIndexes = (0, _parseSeriesIndexesHierarchies.parseLayoutIndexesHierarchies)(layoutIndexes, layout);
83
- var refinedLayoutIndexes = (0, _refineLayoutSize.refineLayoutSize)({ layout: layout, observations: dupObs, limit: limit })(enhancedLayoutIndexes);
84
- var layoutData = (0, _getLayoutData.getLayoutData)(refinedLayoutIndexes, layout, { metadataCoordinates: metadataCoordinates, attributesSeries: attributesSeries, customAttributes: customAttributes, topCoordinates: header.coordinates });
85
-
86
- var cellsAttributesIds = (0, _getCellsAttributesIds.getCellsAttributesIds)(layoutDimsIds, attributes);
87
- var indexedCombinations = (0, _getIndexedCombinationsByDisplay.getIndexedCombinationsByDisplay)(layout, seriesCombinations);
88
- var cellsMetadataCoordinates = (0, _getCellsMetadataCoordinates.getCellsMetadataCoordinates)(metadataCoordinates, oneValueDimensions, layoutDimsIds);
89
- var cells = (0, _getCells.getCells)(customAttributes, cellsAttributesIds, indexedCombinations, attributesSeries, cellsMetadataCoordinates)(dupObs);
90
-
91
- return (0, _extends3.default)({}, layoutData, {
92
- cells: (0, _getCuratedCells.getCuratedCells)(cells, layout),
93
- layout: layout,
94
- combinations: seriesCombinations
95
- });
96
- };