@sis-cc/dotstatsuite-components 17.32.2 → 18.1.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/app.js +8 -4
- package/lib/rules2/src/applyHierarchicalCodesToDim.js +128 -0
- package/lib/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +1 -36
- package/lib/rules2/src/index.js +9 -6
- package/lib/rules2/src/parseCombinations.js +2 -1
- package/lib/rules2/src/prepareData.js +3 -3
- package/lib/rules2/src/table/getLayoutData2.js +2 -2
- package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +1 -1
- package/lib/viewer/src/app.js +16 -20
- package/lib/viewer/src/index.js +1 -1
- package/lib/viewer/src/legends/AxisLegend.js +4 -2
- package/lib/viewer/src/legends/ChartLegends.js +1 -1
- package/lib/viewer/src/legends/Legend.js +4 -2
- package/package.json +10 -3
- package/src/app.js +7 -5
- package/src/rules2/src/applyHierarchicalCodesToDim.js +101 -0
- package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -45
- package/src/rules2/src/index.js +2 -1
- package/src/rules2/src/parseCombinations.js +2 -1
- package/src/rules2/src/prepareData.js +2 -2
- package/src/rules2/src/table/getLayoutData2.js +2 -2
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +1 -1
- package/src/viewer/src/app.js +16 -14
- package/src/viewer/src/index.js +1 -1
- package/src/viewer/src/legends/AxisLegend.js +1 -1
- package/src/viewer/src/legends/ChartLegends.js +1 -1
- package/src/viewer/src/legends/Legend.js +1 -1
- package/test/applyHierarchicalCodesToDim.test.js +147 -0
- package/test/getLayoutData2.test.js +0 -48
- package/test/parseCombinations.test.js +0 -14
- package/test/parseSeriesIndexesHierarchies.test.js +0 -90
- package/test/hierarchiseDimensionWithAdvancedHierarchy2.test.js +0 -159
package/lib/app.js
CHANGED
|
@@ -12,7 +12,7 @@ var _app2 = _interopRequireDefault(_app);
|
|
|
12
12
|
|
|
13
13
|
var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
|
|
14
14
|
|
|
15
|
-
var _styles = require('@material
|
|
15
|
+
var _styles = require('@mui/material/styles');
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
@@ -22,9 +22,13 @@ var root = (0, _client.createRoot)(container);
|
|
|
22
22
|
|
|
23
23
|
var App = function App() {
|
|
24
24
|
return _react2.default.createElement(
|
|
25
|
-
_styles.
|
|
26
|
-
{
|
|
27
|
-
_react2.default.createElement(
|
|
25
|
+
_styles.StyledEngineProvider,
|
|
26
|
+
{ injectFirst: true },
|
|
27
|
+
_react2.default.createElement(
|
|
28
|
+
_styles.ThemeProvider,
|
|
29
|
+
{ theme: theme },
|
|
30
|
+
_react2.default.createElement(_app2.default, null)
|
|
31
|
+
)
|
|
28
32
|
);
|
|
29
33
|
};
|
|
30
34
|
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyHierarchicalCodesToDim = undefined;
|
|
7
|
+
|
|
8
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
9
|
+
|
|
10
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
11
|
+
|
|
12
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
|
13
|
+
|
|
14
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
|
15
|
+
|
|
16
|
+
var _set = require('babel-runtime/core-js/set');
|
|
17
|
+
|
|
18
|
+
var _set2 = _interopRequireDefault(_set);
|
|
19
|
+
|
|
20
|
+
var _ramda = require('ramda');
|
|
21
|
+
|
|
22
|
+
var R = _interopRequireWildcard(_ramda);
|
|
23
|
+
|
|
24
|
+
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; } }
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
var addParentId = function addParentId(id, ids) {
|
|
29
|
+
var last = R.last(ids);
|
|
30
|
+
return R.append(R.isNil(last) ? id : last + '.' + id, ids);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var applyHierarchicalCodesToDim = function applyHierarchicalCodesToDim(hCodes, dim) {
|
|
34
|
+
var confirmedHierarchisedChilds = new _set2.default([]);
|
|
35
|
+
|
|
36
|
+
var indexedValues = R.reduce(function (acc, val) {
|
|
37
|
+
if (!val.isSelected) {
|
|
38
|
+
return acc;
|
|
39
|
+
}
|
|
40
|
+
return R.assoc(val.id, val, acc);
|
|
41
|
+
}, {}, dim.values || []);
|
|
42
|
+
|
|
43
|
+
var parseHCodes = function parseHCodes(parentsDef, parentsInDim) {
|
|
44
|
+
return R.reduce(function (acc, hC) {
|
|
45
|
+
var codeID = hC.codeID,
|
|
46
|
+
_hC$hierarchicalCodes = hC.hierarchicalCodes,
|
|
47
|
+
hierarchicalCodes = _hC$hierarchicalCodes === undefined ? [] : _hC$hierarchicalCodes;
|
|
48
|
+
|
|
49
|
+
var hasInDim = R.has(codeID, indexedValues);
|
|
50
|
+
var isUnconfirmed = R.length(parentsInDim) !== R.length(parentsDef);
|
|
51
|
+
var children = parseHCodes(R.append(codeID, parentsDef), hasInDim ? addParentId(codeID, parentsInDim) : parentsInDim)(hierarchicalCodes);
|
|
52
|
+
if (!hasInDim) {
|
|
53
|
+
return R.concat(acc, children);
|
|
54
|
+
}
|
|
55
|
+
var val = (0, _extends3.default)({}, R.prop(codeID, indexedValues), {
|
|
56
|
+
parents: parentsInDim,
|
|
57
|
+
parent: R.last(parentsInDim),
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (isUnconfirmed) {
|
|
62
|
+
val = R.assoc('unconfirmed', true, val);
|
|
63
|
+
return R.append(val, acc);
|
|
64
|
+
}
|
|
65
|
+
confirmedHierarchisedChilds.add(codeID);
|
|
66
|
+
return R.append(val, acc);
|
|
67
|
+
}, []);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var parsed = parseHCodes([], [])(hCodes);
|
|
71
|
+
|
|
72
|
+
var flattenDescendants = R.reduce(function (acc, val) {
|
|
73
|
+
var children = flattenDescendants(val.children || []);
|
|
74
|
+
return R.concat(acc, R.prepend(val, children));
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
var isValid = function isValid(val) {
|
|
78
|
+
return !val.unconfirmed || !confirmedHierarchisedChilds.has(val.id);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var refineCodes = R.reduce(function (acc, hC) {
|
|
82
|
+
var children = hC.children,
|
|
83
|
+
_hC$unconfirmed = hC.unconfirmed,
|
|
84
|
+
unconfirmed = _hC$unconfirmed === undefined ? false : _hC$unconfirmed,
|
|
85
|
+
val = (0, _objectWithoutProperties3.default)(hC, ['children', 'unconfirmed']);
|
|
86
|
+
|
|
87
|
+
if (isValid(hC)) {
|
|
88
|
+
var _children = refineCodes(children || []);
|
|
89
|
+
confirmedHierarchisedChilds.add(val.id);
|
|
90
|
+
return R.concat(acc, R.prepend(val, _children));
|
|
91
|
+
}
|
|
92
|
+
var flatDescendants = flattenDescendants(children);
|
|
93
|
+
var validDescendant = R.find(isValid, flatDescendants);
|
|
94
|
+
if (!validDescendant) {
|
|
95
|
+
return acc;
|
|
96
|
+
}
|
|
97
|
+
var refined = R.pipe(R.prepend(hC), R.map(function (v) {
|
|
98
|
+
confirmedHierarchisedChilds.add(v.id);
|
|
99
|
+
return R.omit(['unconfirmed', 'children'], v);
|
|
100
|
+
}))(flatDescendants);
|
|
101
|
+
return R.concat(acc, refined);
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
var refined = refineCodes(parsed);
|
|
105
|
+
|
|
106
|
+
var missingValues = R.pipe(R.keys, R.filter(function (id) {
|
|
107
|
+
return !confirmedHierarchisedChilds.has(id);
|
|
108
|
+
}), function (ids) {
|
|
109
|
+
return R.props(ids, indexedValues);
|
|
110
|
+
}, R.map(function (v) {
|
|
111
|
+
return (0, _extends3.default)({}, v, { parents: [], parent: undefined });
|
|
112
|
+
}), R.sortBy(R.propOr(-1, '__indexPosition')))(indexedValues);
|
|
113
|
+
|
|
114
|
+
var hierarchicalIndexes = {};
|
|
115
|
+
|
|
116
|
+
return R.pipe(R.concat, R.addIndex(R.map)(function (v, ind) {
|
|
117
|
+
var parents = R.props(v.parents, hierarchicalIndexes);
|
|
118
|
+
var hierId = R.last(v.parents) ? R.last(v.parents) + '.' + v.id : v.id;
|
|
119
|
+
hierarchicalIndexes[hierId] = ind;
|
|
120
|
+
return (0, _extends3.default)({}, v, {
|
|
121
|
+
parents: parents,
|
|
122
|
+
__indexPosition: ind
|
|
123
|
+
});
|
|
124
|
+
}), function (values) {
|
|
125
|
+
return (0, _extends3.default)({}, dim, { values: values });
|
|
126
|
+
})(missingValues, refined);
|
|
127
|
+
};
|
|
128
|
+
exports.applyHierarchicalCodesToDim = applyHierarchicalCodesToDim;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.refinePartialHierarchy = undefined;
|
|
7
7
|
|
|
8
8
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
9
9
|
|
|
@@ -62,39 +62,4 @@ var refinePartialHierarchy = exports.refinePartialHierarchy = function refinePar
|
|
|
62
62
|
return (0, _extends3.default)({}, refinedBroken, intact, {
|
|
63
63
|
'#ROOT': R.concat(refinedBroken['#ROOT'], intact['#ROOT'])
|
|
64
64
|
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var hierarchiseDimensionWithAdvancedHierarchy = exports.hierarchiseDimensionWithAdvancedHierarchy = function hierarchiseDimensionWithAdvancedHierarchy(dimension, _hierarchy) {
|
|
68
|
-
var indexed = R.indexBy(R.prop('id'), dimension.values);
|
|
69
|
-
var hierarchy = refinePartialHierarchy(_hierarchy, indexed);
|
|
70
|
-
|
|
71
|
-
var rest = R.pipe(R.values, R.unnest, R.flip(R.omit)(indexed), R.values)(hierarchy);
|
|
72
|
-
var index = R.length(rest) - 1;
|
|
73
|
-
var getChildren = function getChildren(_ref3) {
|
|
74
|
-
var parentsIndexes = _ref3.parentsIndexes,
|
|
75
|
-
parentId = _ref3.parentId;
|
|
76
|
-
|
|
77
|
-
var childrenIds = R.propOr([], parentId, hierarchy);
|
|
78
|
-
var children = R.reduce(function (acc, childId) {
|
|
79
|
-
if (!R.has(childId, indexed)) {
|
|
80
|
-
return acc;
|
|
81
|
-
}
|
|
82
|
-
index = index + 1;
|
|
83
|
-
var child = (0, _extends3.default)({}, R.prop(childId, indexed), { __indexPosition: index, parents: parentsIndexes, parent: R.isEmpty(parentsIndexes) ? undefined : R.pipe(R.split('.'), R.last)(parentId) });
|
|
84
|
-
var descendants = getChildren({ parentsIndexes: R.append(index, parentsIndexes), parentId: R.isEmpty(parentsIndexes) ? child.id : parentId + '.' + child.id });
|
|
85
|
-
return R.append(R.prepend(child, descendants), acc);
|
|
86
|
-
}, [], childrenIds);
|
|
87
|
-
|
|
88
|
-
return children;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return R.set(R.lensProp('values'), R.pipe(getChildren, R.flatten, function (values) {
|
|
92
|
-
if (R.isEmpty(rest)) {
|
|
93
|
-
return values;
|
|
94
|
-
}
|
|
95
|
-
var sortedRest = R.pipe(R.sortBy(R.prop('__indexPosition')), R.addIndex(R.map)(function (val, ind) {
|
|
96
|
-
return (0, _extends3.default)({}, val, { __indexPosition: ind, parent: undefined, parents: [] });
|
|
97
|
-
}))(rest);
|
|
98
|
-
return R.concat(sortedRest, values);
|
|
99
|
-
})({ parentsIndexes: [], parentId: '#ROOT' }))(dimension);
|
|
100
65
|
};
|
package/lib/rules2/src/index.js
CHANGED
|
@@ -114,12 +114,6 @@ Object.defineProperty(exports, 'refinePartialHierarchy', {
|
|
|
114
114
|
return _hierarchiseDimensionWithAdvancedHierarchy.refinePartialHierarchy;
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
Object.defineProperty(exports, 'hierarchiseDimensionWithAdvancedHierarchy', {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
get: function get() {
|
|
120
|
-
return _hierarchiseDimensionWithAdvancedHierarchy.hierarchiseDimensionWithAdvancedHierarchy;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
117
|
|
|
124
118
|
var _hierarchiseDimensionWithNativeHierarchy = require('./hierarchiseDimensionWithNativeHierarchy2');
|
|
125
119
|
|
|
@@ -437,4 +431,13 @@ Object.defineProperty(exports, 'declineObservationsOverAttributes', {
|
|
|
437
431
|
get: function get() {
|
|
438
432
|
return _declineObservationsOverAttributes.declineObservationsOverAttributes;
|
|
439
433
|
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
var _applyHierarchicalCodesToDim = require('./applyHierarchicalCodesToDim');
|
|
437
|
+
|
|
438
|
+
Object.defineProperty(exports, 'applyHierarchicalCodesToDim', {
|
|
439
|
+
enumerable: true,
|
|
440
|
+
get: function get() {
|
|
441
|
+
return _applyHierarchicalCodesToDim.applyHierarchicalCodesToDim;
|
|
442
|
+
}
|
|
440
443
|
});
|
|
@@ -35,6 +35,7 @@ var hasInvalidValues = R.pipe(R.prop('values'), R.anyPass([R.isNil, R.complement
|
|
|
35
35
|
var isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
|
|
36
36
|
var filterValidConcepts = R.reject(isConceptInvalid);
|
|
37
37
|
// concepts is an array of ids... (misnamed!)
|
|
38
|
+
var conceptIdsLens = R.lensProp('concepts');
|
|
38
39
|
var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
|
|
39
40
|
var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
40
41
|
return function () {
|
|
@@ -43,7 +44,7 @@ var rejectInvalidConceptIds = function rejectInvalidConceptIds() {
|
|
|
43
44
|
var validConceptIds = R.pluck('id', filterValidConcepts(concepts));
|
|
44
45
|
return R.reduce(function (acc, comb) {
|
|
45
46
|
var refinedConcepts = R.intersection(validConceptIds, comb.concepts);
|
|
46
|
-
if (R.length(refinedConcepts) <
|
|
47
|
+
if (R.length(refinedConcepts) < 2) {
|
|
47
48
|
return acc;
|
|
48
49
|
}
|
|
49
50
|
return R.append((0, _extends4.default)({}, comb, { concepts: refinedConcepts }), acc);
|
|
@@ -35,8 +35,6 @@ var _getOneValueDimensions = require('./getOneValueDimensions');
|
|
|
35
35
|
|
|
36
36
|
var _hierarchiseDimensionWithNativeHierarchy = require('./hierarchiseDimensionWithNativeHierarchy2');
|
|
37
37
|
|
|
38
|
-
var _hierarchiseDimensionWithAdvancedHierarchy = require('./hierarchiseDimensionWithAdvancedHierarchy2');
|
|
39
|
-
|
|
40
38
|
var _getDataflowAttributes = require('./getDataflowAttributes');
|
|
41
39
|
|
|
42
40
|
var _getHeaderTitle = require('./getHeaderTitle');
|
|
@@ -47,6 +45,8 @@ var _getHeaderCombinations = require('./getHeaderCombinations');
|
|
|
47
45
|
|
|
48
46
|
var _getHeaderCoordinates = require('./getHeaderCoordinates');
|
|
49
47
|
|
|
48
|
+
var _applyHierarchicalCodesToDim = require('./applyHierarchicalCodesToDim');
|
|
49
|
+
|
|
50
50
|
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; } }
|
|
51
51
|
|
|
52
52
|
var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
|
|
@@ -86,7 +86,7 @@ var prepareData = exports.prepareData = function prepareData(sdmxJson, _ref) {
|
|
|
86
86
|
if (R.isEmpty(R.propOr({}, dim.id, hierarchies))) {
|
|
87
87
|
return (0, _hierarchiseDimensionWithNativeHierarchy.hierarchiseDimensionWithNativeHierarchy)(dim);
|
|
88
88
|
}
|
|
89
|
-
return (0,
|
|
89
|
+
return (0, _applyHierarchicalCodesToDim.applyHierarchicalCodesToDim)(R.prop(dim.id, hierarchies), dim);
|
|
90
90
|
}, manyValuesDimensions);
|
|
91
91
|
var duplicatedObservations = (0, _duplicateObservations.duplicateObs)(R.values(hierarchisedDimensions), enhancedObservations);
|
|
92
92
|
|
|
@@ -90,7 +90,7 @@ var getCoordinates = function getCoordinates(indexes, topCoordinates, definition
|
|
|
90
90
|
|
|
91
91
|
var getAttributesSeries = function getAttributesSeries(validator, attributesSeries) {
|
|
92
92
|
return R.reduce(function (acc, attrs) {
|
|
93
|
-
var attr = R.head(R.values(attrs))
|
|
93
|
+
var attr = R.head(R.values(attrs));
|
|
94
94
|
if (R.length(attr.relationship || []) === 1 && !attr.combined) {
|
|
95
95
|
return acc;
|
|
96
96
|
}
|
|
@@ -130,7 +130,7 @@ var getSerieFlagsAndSideProps = function getSerieFlagsAndSideProps(coordinates,
|
|
|
130
130
|
var flags = (0, _getFlagsAndNotes.getFlagsAndNotes)(layoutAttrValues, customAttributes);
|
|
131
131
|
var hasMetadata = !R.isNil(R.find(validator, metadataCoordinates));
|
|
132
132
|
var hasDataAdvancedAttributes = R.any(function (d) {
|
|
133
|
-
return R.has('value', d) ?
|
|
133
|
+
return R.has('value', d) ? d.hasAdvancedAttributes : R.any(R.prop('hasAdvancedAttributes'), d.values);
|
|
134
134
|
}, data);
|
|
135
135
|
var hasAdvancedAttributes = hasDataAdvancedAttributes || getHasAdvancedAttributes(layoutAttrValues, customAttributes);
|
|
136
136
|
var sideProps = hasMetadata || hasAdvancedAttributes ? { hasMetadata: hasMetadata, hasAdvancedAttributes: hasAdvancedAttributes, coordinates: coordinates } : null;
|
|
@@ -61,7 +61,7 @@ var parseSerieIndexesHierarchies = function parseSerieIndexesHierarchies(serieIn
|
|
|
61
61
|
return R.over(R.lensProp('presentParentsIndexes'), function (p) {
|
|
62
62
|
return R.isNil(p) ? [i] : R.append(i, p);
|
|
63
63
|
}, _acc);
|
|
64
|
-
} else if (i > previousIndex
|
|
64
|
+
} else if (i > previousIndex) {
|
|
65
65
|
registeredIndexes.add(i);
|
|
66
66
|
return R.over(R.lensProp('missingParentsIndexes'), function (m) {
|
|
67
67
|
return R.isNil(m) ? [i] : R.append(i, m);
|
package/lib/viewer/src/app.js
CHANGED
|
@@ -16,7 +16,7 @@ var _reactHelmet = require('react-helmet');
|
|
|
16
16
|
|
|
17
17
|
var _core = require('@blueprintjs/core');
|
|
18
18
|
|
|
19
|
-
var _styles = require('@material
|
|
19
|
+
var _styles = require('@mui/material/styles');
|
|
20
20
|
|
|
21
21
|
var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
|
|
22
22
|
|
|
@@ -152,26 +152,22 @@ exports.default = function () {
|
|
|
152
152
|
return _react2.default.createElement(
|
|
153
153
|
'div',
|
|
154
154
|
{ style: { padding: 10 } },
|
|
155
|
+
_react2.default.createElement(_reactHelmet.Helmet, { htmlAttributes: { dir: isRtl ? 'rtl' : 'ltr' } }),
|
|
155
156
|
_react2.default.createElement(
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
id: 'uc1',
|
|
171
|
-
title: _react2.default.createElement(AppTab, { label: 'full screen resizable chart', iconName: 'fullscreen' }),
|
|
172
|
-
panel: _react2.default.createElement(_useCase2.default, { isRtl: isRtl, config: config, style: style, options: options })
|
|
173
|
-
})
|
|
174
|
-
)
|
|
157
|
+
'button',
|
|
158
|
+
{ onClick: function onClick() {
|
|
159
|
+
return setRtl(!isRtl);
|
|
160
|
+
} },
|
|
161
|
+
isRtl ? 'left to right' : 'right to left'
|
|
162
|
+
),
|
|
163
|
+
_react2.default.createElement(
|
|
164
|
+
_core.Tabs2,
|
|
165
|
+
{ renderActiveTabPanelOnly: false },
|
|
166
|
+
_react2.default.createElement(_core.Tab2, {
|
|
167
|
+
id: 'uc1',
|
|
168
|
+
title: _react2.default.createElement(AppTab, { label: 'full screen resizable chart', iconName: 'fullscreen' }),
|
|
169
|
+
panel: _react2.default.createElement(_useCase2.default, { isRtl: isRtl, config: config, style: style, options: options })
|
|
170
|
+
})
|
|
175
171
|
)
|
|
176
172
|
);
|
|
177
173
|
};
|
package/lib/viewer/src/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var _size2 = _interopRequireDefault(_size);
|
|
|
38
38
|
|
|
39
39
|
var _dotstatsuiteVisions = require('@sis-cc/dotstatsuite-visions');
|
|
40
40
|
|
|
41
|
-
var _styles = require('@
|
|
41
|
+
var _styles = require('@mui/styles');
|
|
42
42
|
|
|
43
43
|
var _options = require('./chartUtils/options');
|
|
44
44
|
|
|
@@ -20,7 +20,9 @@ var _ramda = require('ramda');
|
|
|
20
20
|
|
|
21
21
|
var R = _interopRequireWildcard(_ramda);
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _makeStyles = require('@mui/styles/makeStyles');
|
|
24
|
+
|
|
25
|
+
var _makeStyles2 = _interopRequireDefault(_makeStyles);
|
|
24
26
|
|
|
25
27
|
var _constants = require('../../../rules/src/constants');
|
|
26
28
|
|
|
@@ -30,7 +32,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
30
32
|
|
|
31
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
34
|
|
|
33
|
-
var useStyles = (0,
|
|
35
|
+
var useStyles = (0, _makeStyles2.default)(function (theme) {
|
|
34
36
|
var legendFont = (0, _utils.getFontFromTheme)(['axisLegend'])(theme);
|
|
35
37
|
return {
|
|
36
38
|
xLegend: legendFont,
|
|
@@ -20,7 +20,7 @@ var _dotstatsuiteD3Charts = require('@sis-cc/dotstatsuite-d3-charts');
|
|
|
20
20
|
|
|
21
21
|
var _src = require('../../../bridge-d3-react/src');
|
|
22
22
|
|
|
23
|
-
var _styles = require('@material
|
|
23
|
+
var _styles = require('@mui/material/styles');
|
|
24
24
|
|
|
25
25
|
var _AxisLegend = require('./AxisLegend');
|
|
26
26
|
|
|
@@ -20,7 +20,9 @@ var _ramda = require('ramda');
|
|
|
20
20
|
|
|
21
21
|
var R = _interopRequireWildcard(_ramda);
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _makeStyles = require('@mui/styles/makeStyles');
|
|
24
|
+
|
|
25
|
+
var _makeStyles2 = _interopRequireDefault(_makeStyles);
|
|
24
26
|
|
|
25
27
|
var _utils = require('../utils');
|
|
26
28
|
|
|
@@ -28,7 +30,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
28
30
|
|
|
29
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
32
|
|
|
31
|
-
var useStyles = (0,
|
|
33
|
+
var useStyles = (0, _makeStyles2.default)(function (theme) {
|
|
32
34
|
return {
|
|
33
35
|
legend: (0, _extends3.default)({}, (0, _utils.getFontFromTheme)(['chartLegend'])(theme), {
|
|
34
36
|
display: 'flex',
|
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": "
|
|
4
|
+
"version": "18.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "OECD",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@blueprintjs/core": "^1.22.0",
|
|
16
|
-
"@material
|
|
16
|
+
"@mui/material": "^5.16.5",
|
|
17
|
+
"@mui/styles": "^5.16.5",
|
|
17
18
|
"@sis-cc/dotstatsuite-sdmxjs": "*",
|
|
18
19
|
"@sis-cc/dotstatsuite-visions": "*",
|
|
19
20
|
"react": "^18",
|
|
@@ -23,6 +24,11 @@
|
|
|
23
24
|
"web-component-env": "^2.0.0"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
27
|
+
"@emotion/react": "^11.13.3",
|
|
28
|
+
"@emotion/styled": "^11.13.0",
|
|
29
|
+
"@mui/icons-material": "^5.16.5",
|
|
30
|
+
"@mui/material": "^5.16.5",
|
|
31
|
+
"@mui/styles": "^5.16.5",
|
|
26
32
|
"@react-hook/size": "^2.1.1",
|
|
27
33
|
"@sis-cc/dotstatsuite-d3-charts": "^8.3.0",
|
|
28
34
|
"date-fns": "^1.30.1",
|
|
@@ -34,7 +40,8 @@
|
|
|
34
40
|
"ramda": "^0.26.1"
|
|
35
41
|
},
|
|
36
42
|
"peerDependencies": {
|
|
37
|
-
"@material
|
|
43
|
+
"@mui/icons-material": "^5.16.5",
|
|
44
|
+
"@mui/material": "^5.16.5",
|
|
38
45
|
"@sis-cc/dotstatsuite-sdmxjs": "^8",
|
|
39
46
|
"@sis-cc/dotstatsuite-visions": "^9",
|
|
40
47
|
"react": "^18",
|
package/src/app.js
CHANGED
|
@@ -2,17 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import ViewerApp from './viewer/src/app';
|
|
4
4
|
import { sisccTheme } from '@sis-cc/dotstatsuite-visions';
|
|
5
|
-
import { ThemeProvider } from '@material
|
|
6
|
-
import { createTheme } from '@material
|
|
5
|
+
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
|
|
6
|
+
import { createTheme } from '@mui/material/styles';
|
|
7
7
|
|
|
8
8
|
const theme = createTheme(sisccTheme({ rtl: 'ltr' }));
|
|
9
9
|
const container = document.getElementById('root');
|
|
10
10
|
const root = createRoot(container);
|
|
11
11
|
|
|
12
12
|
const App = () => (
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
13
|
+
<StyledEngineProvider injectFirst>
|
|
14
|
+
<ThemeProvider theme={theme}>
|
|
15
|
+
<ViewerApp />
|
|
16
|
+
</ThemeProvider>
|
|
17
|
+
</StyledEngineProvider>
|
|
16
18
|
);
|
|
17
19
|
|
|
18
20
|
root.render(<App />);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
const addParentId = (id, ids) => {
|
|
4
|
+
const last = R.last(ids);
|
|
5
|
+
return R.append(R.isNil(last) ? id : `${last}.${id}`, ids);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const applyHierarchicalCodesToDim = (hCodes, dim) => {
|
|
9
|
+
let confirmedHierarchisedChilds = new Set([]);
|
|
10
|
+
|
|
11
|
+
const indexedValues = R.reduce((acc, val) => {
|
|
12
|
+
if (!val.isSelected) {
|
|
13
|
+
return acc;
|
|
14
|
+
}
|
|
15
|
+
return R.assoc(val.id, val, acc);
|
|
16
|
+
}, {}, dim.values || []);
|
|
17
|
+
|
|
18
|
+
const parseHCodes = (parentsDef, parentsInDim) => R.reduce((acc, hC) => {
|
|
19
|
+
const { codeID, hierarchicalCodes = [] } = hC;
|
|
20
|
+
const hasInDim = R.has(codeID, indexedValues);
|
|
21
|
+
const isUnconfirmed = R.length(parentsInDim) !== R.length(parentsDef);
|
|
22
|
+
const children = parseHCodes(
|
|
23
|
+
R.append(codeID, parentsDef),
|
|
24
|
+
hasInDim ? addParentId(codeID, parentsInDim) : parentsInDim
|
|
25
|
+
)(hierarchicalCodes);
|
|
26
|
+
if (!hasInDim) {
|
|
27
|
+
return R.concat(acc, children);
|
|
28
|
+
}
|
|
29
|
+
let val = {
|
|
30
|
+
...R.prop(codeID, indexedValues),
|
|
31
|
+
parents: parentsInDim,
|
|
32
|
+
parent: R.last(parentsInDim),
|
|
33
|
+
children
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (isUnconfirmed) {
|
|
37
|
+
val = R.assoc('unconfirmed', true, val);
|
|
38
|
+
return R.append(val, acc);
|
|
39
|
+
}
|
|
40
|
+
confirmedHierarchisedChilds.add(codeID);
|
|
41
|
+
return R.append(val, acc);
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const parsed = parseHCodes([], [])(hCodes);
|
|
45
|
+
|
|
46
|
+
const flattenDescendants = R.reduce((acc, val ) => {
|
|
47
|
+
const children = flattenDescendants(val.children || []);
|
|
48
|
+
return R.concat(acc, R.prepend(val, children));
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
const isValid = val => !val.unconfirmed || !confirmedHierarchisedChilds.has(val.id);
|
|
52
|
+
|
|
53
|
+
const refineCodes = R.reduce((acc, hC) => {
|
|
54
|
+
const { children, unconfirmed = false, ...val } = hC;
|
|
55
|
+
if (isValid(hC)) {
|
|
56
|
+
const _children = refineCodes(children || []);
|
|
57
|
+
confirmedHierarchisedChilds.add(val.id);
|
|
58
|
+
return R.concat(acc, R.prepend(val, _children));
|
|
59
|
+
}
|
|
60
|
+
const flatDescendants = flattenDescendants(children);
|
|
61
|
+
const validDescendant = R.find(isValid, flatDescendants);
|
|
62
|
+
if (!validDescendant) {
|
|
63
|
+
return acc;
|
|
64
|
+
}
|
|
65
|
+
const refined = R.pipe(
|
|
66
|
+
R.prepend(hC),
|
|
67
|
+
R.map(v => {
|
|
68
|
+
confirmedHierarchisedChilds.add(v.id);
|
|
69
|
+
return R.omit(['unconfirmed', 'children'], v);
|
|
70
|
+
})
|
|
71
|
+
)(flatDescendants);
|
|
72
|
+
return R.concat(acc, refined);
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
const refined = refineCodes(parsed);
|
|
76
|
+
|
|
77
|
+
const missingValues = R.pipe(
|
|
78
|
+
R.keys,
|
|
79
|
+
R.filter(id => !confirmedHierarchisedChilds.has(id)),
|
|
80
|
+
ids => R.props(ids, indexedValues),
|
|
81
|
+
R.map(v => ({ ...v, parents: [], parent: undefined })),
|
|
82
|
+
R.sortBy(R.propOr(-1, '__indexPosition')),
|
|
83
|
+
)(indexedValues);
|
|
84
|
+
|
|
85
|
+
let hierarchicalIndexes = {};
|
|
86
|
+
|
|
87
|
+
return R.pipe(
|
|
88
|
+
R.concat,
|
|
89
|
+
R.addIndex(R.map)((v, ind) => {
|
|
90
|
+
const parents = R.props(v.parents, hierarchicalIndexes);
|
|
91
|
+
const hierId = R.last(v.parents) ? `${R.last(v.parents)}.${v.id}` : v.id;
|
|
92
|
+
hierarchicalIndexes[hierId] = ind;
|
|
93
|
+
return {
|
|
94
|
+
...v,
|
|
95
|
+
parents,
|
|
96
|
+
__indexPosition: ind
|
|
97
|
+
};
|
|
98
|
+
}),
|
|
99
|
+
values => ({ ...dim, values })
|
|
100
|
+
)(missingValues, refined);
|
|
101
|
+
};
|
|
@@ -55,48 +55,3 @@ export const refinePartialHierarchy = (hier, indexed) => {
|
|
|
55
55
|
'#ROOT': R.concat(refinedBroken['#ROOT'], intact['#ROOT'])
|
|
56
56
|
})
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
export const hierarchiseDimensionWithAdvancedHierarchy = (dimension, _hierarchy) => {
|
|
60
|
-
const indexed = R.indexBy(R.prop('id'), dimension.values);
|
|
61
|
-
const hierarchy = refinePartialHierarchy(_hierarchy, indexed);
|
|
62
|
-
|
|
63
|
-
const rest = R.pipe(
|
|
64
|
-
R.values,
|
|
65
|
-
R.unnest,
|
|
66
|
-
R.flip(R.omit)(indexed),
|
|
67
|
-
R.values,
|
|
68
|
-
)(hierarchy);
|
|
69
|
-
let index = R.length(rest) - 1;
|
|
70
|
-
const getChildren = ({ parentsIndexes, parentId }) => {
|
|
71
|
-
const childrenIds = R.propOr([], parentId, hierarchy);
|
|
72
|
-
const children = R.reduce((acc, childId) => {
|
|
73
|
-
if (!R.has(childId, indexed)) {
|
|
74
|
-
return acc;
|
|
75
|
-
}
|
|
76
|
-
index = index + 1;
|
|
77
|
-
const child = { ...R.prop(childId, indexed), __indexPosition: index, parents: parentsIndexes, parent: R.isEmpty(parentsIndexes) ? undefined : R.pipe(R.split('.'), R.last)(parentId) };
|
|
78
|
-
const descendants = getChildren({ parentsIndexes: R.append(index, parentsIndexes), parentId: R.isEmpty(parentsIndexes) ? child.id : `${parentId}.${child.id}` });
|
|
79
|
-
return R.append(R.prepend(child, descendants), acc);
|
|
80
|
-
}, [], childrenIds);
|
|
81
|
-
|
|
82
|
-
return children;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return R.set(
|
|
86
|
-
R.lensProp('values'),
|
|
87
|
-
R.pipe(
|
|
88
|
-
getChildren,
|
|
89
|
-
R.flatten,
|
|
90
|
-
values => {
|
|
91
|
-
if (R.isEmpty(rest)) {
|
|
92
|
-
return values;
|
|
93
|
-
}
|
|
94
|
-
const sortedRest = R.pipe(
|
|
95
|
-
R.sortBy(R.prop('__indexPosition')),
|
|
96
|
-
R.addIndex(R.map)((val, ind) => ({ ...val, __indexPosition: ind, parent: undefined, parents: [] })),
|
|
97
|
-
)(rest);
|
|
98
|
-
return R.concat(sortedRest, values);
|
|
99
|
-
}
|
|
100
|
-
)({ parentsIndexes: [], parentId: '#ROOT' })
|
|
101
|
-
)(dimension);
|
|
102
|
-
};
|
package/src/rules2/src/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { getHCodelistsRefs, getHCodelistsRefsInData } from './getHCodelistsRefsI
|
|
|
12
12
|
export { parseHierarchicalCodelist } from './parseHierarchicalCodelist';
|
|
13
13
|
export { getMetadataCoordinates } from './getMetadataCoordinates';
|
|
14
14
|
export { duplicateObs } from './duplicateObservations';
|
|
15
|
-
export { refinePartialHierarchy
|
|
15
|
+
export { refinePartialHierarchy } from './hierarchiseDimensionWithAdvancedHierarchy2';
|
|
16
16
|
export { hierarchiseDimensionWithNativeHierarchy } from './hierarchiseDimensionWithNativeHierarchy2';
|
|
17
17
|
export { getDimensionValuesIndexes } from './getDimensionValuesIndexes';
|
|
18
18
|
export { getCombinationDefinitions, parseCombinationDefinition } from './getCombinationDefinitions';
|
|
@@ -47,3 +47,4 @@ export { parseValueHierarchy } from './table/parseValueHierarchy';
|
|
|
47
47
|
export { parseLayoutIndexesHierarchies } from './table/parseSeriesIndexesHierarchies';
|
|
48
48
|
export { getTableLayoutIds, injectCombinationsInLayout } from './table/getTableLayoutIds';
|
|
49
49
|
export { declineObservationsOverAttributes } from './table/declineObservationsOverAttributes';
|
|
50
|
+
export { applyHierarchicalCodesToDim } from './applyHierarchicalCodesToDim';
|
|
@@ -18,13 +18,14 @@ const hasInvalidValues = R.pipe(
|
|
|
18
18
|
const isConceptInvalid = R.anyPass([hasInvalidValues /* add more... */]);
|
|
19
19
|
const filterValidConcepts = R.reject(isConceptInvalid);
|
|
20
20
|
// concepts is an array of ids... (misnamed!)
|
|
21
|
+
const conceptIdsLens = R.lensProp('concepts');
|
|
21
22
|
const rejectInvalidConceptIds =
|
|
22
23
|
(concepts = []) =>
|
|
23
24
|
(combinations = []) => {
|
|
24
25
|
const validConceptIds = R.pluck('id', filterValidConcepts(concepts));
|
|
25
26
|
return R.reduce((acc, comb) => {
|
|
26
27
|
const refinedConcepts = R.intersection(validConceptIds, comb.concepts);
|
|
27
|
-
if (R.length(refinedConcepts) <
|
|
28
|
+
if (R.length(refinedConcepts) < 2) {
|
|
28
29
|
return acc;
|
|
29
30
|
}
|
|
30
31
|
return R.append({ ...comb, concepts: refinedConcepts }, acc);
|