@sis-cc/dotstatsuite-components 16.8.2 → 17.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 +5 -3
- package/lib/rules2/src/getCombinationDefinitions.js +9 -6
- package/lib/viewer/src/app.js +1 -1
- package/package.json +9 -8
- package/src/app.js +6 -4
- package/src/rules2/src/getCombinationDefinitions.js +9 -6
- package/src/viewer/src/app.js +2 -2
- package/test/getCombinationDefinitions.test.js +88 -0
package/lib/app.js
CHANGED
|
@@ -4,7 +4,7 @@ var _react = require('react');
|
|
|
4
4
|
|
|
5
5
|
var _react2 = _interopRequireDefault(_react);
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _client = require('react-dom/client');
|
|
8
8
|
|
|
9
9
|
var _app = require('./viewer/src/app');
|
|
10
10
|
|
|
@@ -16,7 +16,9 @@ var _styles = require('@material-ui/core/styles');
|
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
-
var theme = (0, _styles.
|
|
19
|
+
var theme = (0, _styles.createTheme)((0, _dotstatsuiteVisions.sisccTheme)({ rtl: 'ltr' }));
|
|
20
|
+
var container = document.getElementById('root');
|
|
21
|
+
var root = (0, _client.createRoot)(container);
|
|
20
22
|
|
|
21
23
|
var App = function App() {
|
|
22
24
|
return _react2.default.createElement(
|
|
@@ -26,4 +28,4 @@ var App = function App() {
|
|
|
26
28
|
);
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
root.render(_react2.default.createElement(App, null));
|
|
@@ -20,22 +20,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
var parseCombinationDefinition = exports.parseCombinationDefinition = function parseCombinationDefinition(locale) {
|
|
21
21
|
return function (title, texts) {
|
|
22
22
|
return R.useWith(function (titles, texts) {
|
|
23
|
-
return R.addIndex(R.
|
|
23
|
+
return R.addIndex(R.reduce)(function (acc, title, index) {
|
|
24
24
|
var split = R.split(':', title);
|
|
25
|
-
if (R.length(split !== 2)
|
|
26
|
-
return
|
|
25
|
+
if (R.length(split) !== 2) {
|
|
26
|
+
return acc;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
var _split = (0, _slicedToArray3.default)(split, 2),
|
|
30
30
|
id = _split[0],
|
|
31
31
|
codes = _split[1];
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
if (R.isEmpty(codes)) {
|
|
34
|
+
return acc;
|
|
35
|
+
}
|
|
36
|
+
return R.append({
|
|
34
37
|
id: id,
|
|
35
38
|
concepts: R.split(',', codes),
|
|
36
39
|
name: R.has(locale, texts) ? R.pipe(R.prop(locale), R.nth(index), R.split(':'), R.last)(texts) : '[' + id + ']'
|
|
37
|
-
};
|
|
38
|
-
}, titles);
|
|
40
|
+
}, acc);
|
|
41
|
+
}, [], titles);
|
|
39
42
|
}, [R.split(';'), R.map(R.split(';'))])(title, texts);
|
|
40
43
|
};
|
|
41
44
|
};
|
package/lib/viewer/src/app.js
CHANGED
|
@@ -74,7 +74,7 @@ exports.default = function () {
|
|
|
74
74
|
isRtl = _useState2[0],
|
|
75
75
|
setRtl = _useState2[1];
|
|
76
76
|
|
|
77
|
-
var theme = (0, _styles.
|
|
77
|
+
var theme = (0, _styles.createTheme)((0, _dotstatsuiteVisions.sisccTheme)({ rtl: isRtl ? 'rtl' : 'ltr' }));
|
|
78
78
|
|
|
79
79
|
var config = {
|
|
80
80
|
logo: 'https://upload.wikimedia.org/wikipedia/en/thumb/0/0d/OECD_logo_new.svg/200px-OECD_logo_new.svg.png',
|
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": "17.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "OECD",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@blueprintjs/core": "^1.22.0",
|
|
16
|
-
"@material-ui/core": "^4
|
|
16
|
+
"@material-ui/core": "^4",
|
|
17
17
|
"@sis-cc/dotstatsuite-sdmxjs": "*",
|
|
18
18
|
"@sis-cc/dotstatsuite-visions": "*",
|
|
19
|
-
"react": "^
|
|
19
|
+
"react": "^18",
|
|
20
|
+
"react-dom": "^18",
|
|
20
21
|
"react-addons-css-transition-group": "^15.6.2",
|
|
21
22
|
"react-helmet": "^5.2.1",
|
|
22
23
|
"web-component-env": "^2.0.0"
|
|
@@ -31,13 +32,13 @@
|
|
|
31
32
|
"numeral": "^2.0.6",
|
|
32
33
|
"prop-types": "^15.6.2",
|
|
33
34
|
"ramda": "^0.26.1",
|
|
34
|
-
"react-dom": "^16.5.2",
|
|
35
35
|
"react-sizeme": "^2.3.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@material-ui/core": "^4
|
|
39
|
-
"@sis-cc/dotstatsuite-sdmxjs": "^8
|
|
40
|
-
"@sis-cc/dotstatsuite-visions": "^
|
|
41
|
-
"react": "
|
|
38
|
+
"@material-ui/core": "^4",
|
|
39
|
+
"@sis-cc/dotstatsuite-sdmxjs": "^8",
|
|
40
|
+
"@sis-cc/dotstatsuite-visions": "^9",
|
|
41
|
+
"react": "^18",
|
|
42
|
+
"react-dom": "^18"
|
|
42
43
|
}
|
|
43
44
|
}
|
package/src/app.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
5
|
import { ThemeProvider } from '@material-ui/core/styles';
|
|
6
|
-
import {
|
|
6
|
+
import { createTheme } from '@material-ui/core/styles';
|
|
7
7
|
|
|
8
|
-
const theme =
|
|
8
|
+
const theme = createTheme(sisccTheme({ rtl: 'ltr' }));
|
|
9
|
+
const container = document.getElementById('root');
|
|
10
|
+
const root = createRoot(container);
|
|
9
11
|
|
|
10
12
|
const App = () => (
|
|
11
13
|
<ThemeProvider theme={theme}>
|
|
@@ -13,4 +15,4 @@ const App = () => (
|
|
|
13
15
|
</ThemeProvider>
|
|
14
16
|
);
|
|
15
17
|
|
|
16
|
-
render(<App
|
|
18
|
+
root.render(<App />);
|
|
@@ -2,20 +2,23 @@ import * as R from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
export const parseCombinationDefinition = (locale) => (title, texts) => R.useWith(
|
|
4
4
|
(titles, texts) =>
|
|
5
|
-
R.addIndex(R.
|
|
5
|
+
R.addIndex(R.reduce)((acc, title, index) => {
|
|
6
6
|
const split = R.split(':', title);
|
|
7
|
-
if (R.length(split !== 2)
|
|
8
|
-
return
|
|
7
|
+
if (R.length(split) !== 2) {
|
|
8
|
+
return acc;
|
|
9
9
|
}
|
|
10
10
|
const [id, codes] = split;
|
|
11
|
-
|
|
11
|
+
if (R.isEmpty(codes)) {
|
|
12
|
+
return acc;
|
|
13
|
+
}
|
|
14
|
+
return R.append({
|
|
12
15
|
id,
|
|
13
16
|
concepts: R.split(',', codes),
|
|
14
17
|
name: R.has(locale, texts)
|
|
15
18
|
? R.pipe(R.prop(locale), R.nth(index), R.split(':'), R.last)(texts)
|
|
16
19
|
: `[${id}]`,
|
|
17
|
-
};
|
|
18
|
-
}, titles),
|
|
20
|
+
}, acc);
|
|
21
|
+
}, [], titles),
|
|
19
22
|
[R.split(';'), R.map(R.split(';'))],
|
|
20
23
|
)(title, texts);
|
|
21
24
|
|
package/src/viewer/src/app.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { Helmet } from 'react-helmet';
|
|
3
3
|
import { Tab2, Tabs2, Intent, Icon, Tooltip, Position } from '@blueprintjs/core';
|
|
4
4
|
import { ThemeProvider } from '@material-ui/core/styles';
|
|
5
|
-
import {
|
|
5
|
+
import { createTheme } from '@material-ui/core/styles';
|
|
6
6
|
import { sisccTheme } from '@sis-cc/dotstatsuite-visions';
|
|
7
7
|
import UseCase1 from './app/use-case-1';
|
|
8
8
|
import TableCase from './app/table';
|
|
@@ -23,7 +23,7 @@ const AppTab = ({ label, iconName }) => (
|
|
|
23
23
|
export default () => {
|
|
24
24
|
const [isRtl, setRtl] = useState(false);
|
|
25
25
|
|
|
26
|
-
const theme =
|
|
26
|
+
const theme = createTheme(sisccTheme({ rtl: isRtl ? 'rtl' : 'ltr' }));
|
|
27
27
|
|
|
28
28
|
const config = {
|
|
29
29
|
logo: 'https://upload.wikimedia.org/wikipedia/en/thumb/0/0d/OECD_logo_new.svg/200px-OECD_logo_new.svg.png',
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { getCombinationDefinitions } from '../src/rules2/src';
|
|
3
|
+
|
|
4
|
+
describe('getCombinationDefinitions tests', () => {
|
|
5
|
+
it('no annotations', () => {
|
|
6
|
+
const annotations = [
|
|
7
|
+
{ type: 'random', title: 'test' },
|
|
8
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' }
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([]);
|
|
12
|
+
});
|
|
13
|
+
it('basic case', () => {
|
|
14
|
+
const annotations = [
|
|
15
|
+
{ type: 'random', title: 'test' },
|
|
16
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' },
|
|
17
|
+
{
|
|
18
|
+
type: 'COMBINED_CONCEPTS',
|
|
19
|
+
texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
|
|
20
|
+
title: 'COMB_1:D1,D2,A1;COMB_2:D3,D4,A2,A3'
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
|
|
25
|
+
{ id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
|
|
26
|
+
{ id: 'COMB_2', name: 'Second Combination', concepts: ['D3', 'D4', 'A2', 'A3'] },
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
it('bad formatted test 1', () => {
|
|
30
|
+
const annotations = [
|
|
31
|
+
{ type: 'random', title: 'test' },
|
|
32
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' },
|
|
33
|
+
{
|
|
34
|
+
type: 'COMBINED_CONCEPTS',
|
|
35
|
+
texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
|
|
36
|
+
title: 'COMB_1:D1,D2,A1;D3,D4,A2,A3'
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
|
|
41
|
+
{ id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
|
|
42
|
+
]);
|
|
43
|
+
});
|
|
44
|
+
it('bad formatted test 2', () => {
|
|
45
|
+
const annotations = [
|
|
46
|
+
{ type: 'random', title: 'test' },
|
|
47
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' },
|
|
48
|
+
{
|
|
49
|
+
type: 'COMBINED_CONCEPTS',
|
|
50
|
+
texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
|
|
51
|
+
title: 'COMB_1:D1,D2,A1;COMB_2:'
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([
|
|
56
|
+
{ id: 'COMB_1', name: 'First Combination', concepts: ['D1', 'D2', 'A1'] },
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
it('bad formatted test 3', () => {
|
|
60
|
+
const annotations = [
|
|
61
|
+
{ type: 'random', title: 'test' },
|
|
62
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' },
|
|
63
|
+
{
|
|
64
|
+
type: 'COMBINED_CONCEPTS',
|
|
65
|
+
texts: { en: 'First Combination;Second Combination' },
|
|
66
|
+
title: 'D1,D2,A1;D3,D4,A2,A3'
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
expect(getCombinationDefinitions(annotations, 'en')).to.deep.equal([]);
|
|
71
|
+
});
|
|
72
|
+
it('missing localised text', () => {
|
|
73
|
+
const annotations = [
|
|
74
|
+
{ type: 'random', title: 'test' },
|
|
75
|
+
{ type: 'NOT_DISPLAYED', title: 'FREQ=A' },
|
|
76
|
+
{
|
|
77
|
+
type: 'COMBINED_CONCEPTS',
|
|
78
|
+
texts: { en: 'COMB_1:First Combination;COMB_2:Second Combination' },
|
|
79
|
+
title: 'COMB_1:D1,D2,A1;COMB_2:D3,D4,A2,A3'
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
expect(getCombinationDefinitions(annotations, 'fr')).to.deep.equal([
|
|
84
|
+
{ id: 'COMB_1', name: '[COMB_1]', concepts: ['D1', 'D2', 'A1'] },
|
|
85
|
+
{ id: 'COMB_2', name: '[COMB_2]', concepts: ['D3', 'D4', 'A2', 'A3'] },
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
});
|