@sis-cc/dotstatsuite-components 20.5.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.
- package/.gitlab-ci.yml +3 -2
- package/LICENSE +1 -1
- package/README.md +1 -17
- package/package.json +20 -14
- package/src/bridge-d3-react/src/react-chart-factory.js +1 -2
- package/src/rules/src/factories/sample-series.js +1 -1
- package/src/rules/src/index.js +14 -13
- package/src/rules/src/observation-formater.js +0 -1
- package/src/rules/src/properties/focus.js +3 -3
- package/src/rules/src/sdmx-data/index.js +2 -0
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +5 -1
- package/src/rules2/src/table/getLayoutData2.js +4 -1
- package/src/viewer/src/index.js +4 -5
- package/src/viewer/src/legends/AxisLegend.js +0 -7
- package/src/viewer/src/legends/FocusLegend.js +2 -10
- package/src/viewer/src/legends/Legend.js +0 -6
- package/src/viewer/src/legends/SeriesLegend.js +0 -7
- package/test/hierarchiseDimensionWithNativeHierarchy2.test.js +59 -32
- package/vite.config.mjs +51 -0
- package/lib/app.js +0 -22
- package/lib/bridge-d3-react/src/app.js +0 -98
- package/lib/bridge-d3-react/src/index.js +0 -33
- package/lib/bridge-d3-react/src/mock-choro.js +0 -41
- package/lib/bridge-d3-react/src/react-chart-factory.js +0 -103
- package/lib/index.js +0 -41
- package/lib/rules/src/chart/getAxisOptions.js +0 -206
- package/lib/rules/src/chart/getBaseOptions.js +0 -51
- package/lib/rules/src/chart/getChartOptions.js +0 -106
- package/lib/rules/src/chart/getGridOptions.js +0 -21
- package/lib/rules/src/chart/getTooltipOptions.js +0 -84
- package/lib/rules/src/constants.js +0 -68
- package/lib/rules/src/date.js +0 -180
- package/lib/rules/src/dimension-utils.js +0 -67
- package/lib/rules/src/factories/choro-series.js +0 -99
- package/lib/rules/src/factories/sample-focus.js +0 -64
- package/lib/rules/src/factories/sample-series.js +0 -90
- package/lib/rules/src/factories/scatter-dimension.js +0 -72
- package/lib/rules/src/factories/scatter-focus.js +0 -77
- package/lib/rules/src/factories/scatter-series.js +0 -145
- package/lib/rules/src/factories/stacked-dimension.js +0 -42
- package/lib/rules/src/factories/stacked-series.js +0 -166
- package/lib/rules/src/factories/symbol-dimension.js +0 -69
- package/lib/rules/src/factories/symbol-series.js +0 -119
- package/lib/rules/src/factories/timeline-focus.js +0 -38
- package/lib/rules/src/factories/timeline-series.js +0 -121
- package/lib/rules/src/get-values-enhanced.js +0 -141
- package/lib/rules/src/header/getDefaultSubtitle.js +0 -50
- package/lib/rules/src/header/getHeaderUnits.js +0 -26
- package/lib/rules/src/header/getSubtitleFlags.js +0 -53
- package/lib/rules/src/header/getTitleFlags.js +0 -24
- package/lib/rules/src/header/index.js +0 -41
- package/lib/rules/src/index.js +0 -714
- package/lib/rules/src/layout.js +0 -98
- package/lib/rules/src/observation-formater.js +0 -112
- package/lib/rules/src/preparators/enhanceObservations.js +0 -142
- package/lib/rules/src/preparators/formatValue.js +0 -83
- package/lib/rules/src/preparators/getObservations.js +0 -27
- package/lib/rules/src/preparators/getReportingYearStart.js +0 -52
- package/lib/rules/src/properties/errors.js +0 -31
- package/lib/rules/src/properties/focus.js +0 -90
- package/lib/rules/src/properties/getAvailableChartTypes.js +0 -30
- package/lib/rules/src/properties/getHeaderProps.js +0 -83
- package/lib/rules/src/properties/getInformationsStateFromNewProps.js +0 -61
- package/lib/rules/src/properties/getObservationsType.js +0 -31
- package/lib/rules/src/properties/getStringifiedSubtitle.js +0 -18
- package/lib/rules/src/properties/index.js +0 -401
- package/lib/rules/src/properties/information.js +0 -79
- package/lib/rules/src/properties/linear.js +0 -158
- package/lib/rules/src/properties/scatter.js +0 -174
- package/lib/rules/src/properties/stacked.js +0 -133
- package/lib/rules/src/properties/symbol.js +0 -96
- package/lib/rules/src/properties/utils.js +0 -126
- package/lib/rules/src/sdmx-data/index.js +0 -55
- package/lib/rules/src/table/factories/getCellValue.js +0 -57
- package/lib/rules/src/table/index.js +0 -14
- package/lib/rules/src/v8-transformer.js +0 -184
- package/lib/rules/test/extractSdmxArtefacts.js +0 -37
- package/lib/rules/test/get-values-enhanced.test.js +0 -128
- package/lib/rules/test/oecd-HEALTH_PROT-parsed.js +0 -303
- package/lib/rules/test/scatter-property.js +0 -403
- package/lib/rules/test/stacked-property.js +0 -244
- package/lib/rules/test/symbol-property.js +0 -234
- package/lib/rules/test/v8-transformer.test.js +0 -82
- package/lib/rules2/src/applyHierarchicalCodesToDim.js +0 -175
- package/lib/rules2/src/combinedValuesDisplay.js +0 -71
- package/lib/rules2/src/constants.js +0 -11
- package/lib/rules2/src/duplicateObservations.js +0 -39
- package/lib/rules2/src/enhanceObservations.js +0 -103
- package/lib/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -39
- package/lib/rules2/src/getAttributesSeries.js +0 -40
- package/lib/rules2/src/getCombinationDefinitions.js +0 -72
- package/lib/rules2/src/getDataflowAttributes.js +0 -34
- package/lib/rules2/src/getDataflowTooltipAttributesIds.js +0 -38
- package/lib/rules2/src/getDimensionValuesIndexes.js +0 -19
- package/lib/rules2/src/getHCodelistsRefsInData.js +0 -49
- package/lib/rules2/src/getHeaderCombinations.js +0 -51
- package/lib/rules2/src/getHeaderCoordinates.js +0 -18
- package/lib/rules2/src/getHeaderSubtitle.js +0 -41
- package/lib/rules2/src/getHeaderTitle.js +0 -29
- package/lib/rules2/src/getMSDInformations.js +0 -43
- package/lib/rules2/src/getManyValuesDimensions.js +0 -39
- package/lib/rules2/src/getMetadataCoordinates.js +0 -40
- package/lib/rules2/src/getMetadataStructureFromData.js +0 -23
- package/lib/rules2/src/getNotDisplayedIds.js +0 -58
- package/lib/rules2/src/getOneValueDimensions.js +0 -48
- package/lib/rules2/src/getSeriesCombinations.js +0 -33
- package/lib/rules2/src/hasCellMetadata.js +0 -22
- package/lib/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -65
- package/lib/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -36
- package/lib/rules2/src/index.js +0 -443
- package/lib/rules2/src/parseAttributes.js +0 -51
- package/lib/rules2/src/parseCombinations.js +0 -96
- package/lib/rules2/src/parseHierarchicalCodelist.js +0 -57
- package/lib/rules2/src/parseMetadataSeries.js +0 -119
- package/lib/rules2/src/prepareData.js +0 -113
- package/lib/rules2/src/refineAttributes.js +0 -32
- package/lib/rules2/src/refineDimensions.js +0 -38
- package/lib/rules2/src/refineMetadataCoordinates.js +0 -35
- package/lib/rules2/src/refineTimePeriod.js +0 -154
- package/lib/rules2/src/sdmx3.0DataFormatPatch.js +0 -20
- package/lib/rules2/src/table/declineObservationsOverAttributes.js +0 -43
- package/lib/rules2/src/table/getCells.js +0 -90
- package/lib/rules2/src/table/getCellsAttributesIds.js +0 -63
- package/lib/rules2/src/table/getCellsMetadataCoordinates.js +0 -30
- package/lib/rules2/src/table/getCombinationDimensionsData.js +0 -48
- package/lib/rules2/src/table/getCuratedCells.js +0 -28
- package/lib/rules2/src/table/getFlagsAndNotes.js +0 -30
- package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -31
- package/lib/rules2/src/table/getLayout.js +0 -105
- package/lib/rules2/src/table/getLayoutData2.js +0 -269
- package/lib/rules2/src/table/getSortedLayoutIndexes.js +0 -136
- package/lib/rules2/src/table/getTableLabelAccessor.js +0 -20
- package/lib/rules2/src/table/getTableLayoutIds.js +0 -365
- package/lib/rules2/src/table/getTableProps.js +0 -96
- package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -124
- package/lib/rules2/src/table/parseValueHierarchy.js +0 -63
- package/lib/rules2/src/table/refineLayoutSize2.js +0 -293
- package/lib/rules2/src/utils.js +0 -48
- package/lib/viewer/mocks/bar.js +0 -21
- package/lib/viewer/mocks/gpp-symbol.js +0 -55
- package/lib/viewer/mocks/gpp-time.js +0 -1023
- package/lib/viewer/mocks/row.js +0 -26
- package/lib/viewer/mocks/scatter.js +0 -84
- package/lib/viewer/mocks/stack.js +0 -93
- package/lib/viewer/src/app/leg.js +0 -101
- package/lib/viewer/src/app/nodata-res.js +0 -40
- package/lib/viewer/src/app/nodata-sized.js +0 -41
- package/lib/viewer/src/app/one-table-cell.js +0 -75
- package/lib/viewer/src/app/table.js +0 -300
- package/lib/viewer/src/app/use-case-1.js +0 -60
- package/lib/viewer/src/app/use-case-2.js +0 -82
- package/lib/viewer/src/app/use-case-3.js +0 -52
- package/lib/viewer/src/app.js +0 -162
- package/lib/viewer/src/chart.js +0 -82
- package/lib/viewer/src/chartUtils/options.js +0 -30
- package/lib/viewer/src/chartUtils/series.js +0 -63
- package/lib/viewer/src/footer.js +0 -54
- package/lib/viewer/src/header.js +0 -29
- package/lib/viewer/src/index.js +0 -243
- package/lib/viewer/src/legends/AxisLegend.js +0 -84
- package/lib/viewer/src/legends/ChartLegends.js +0 -100
- package/lib/viewer/src/legends/FocusLegend.js +0 -89
- package/lib/viewer/src/legends/Legend.js +0 -88
- package/lib/viewer/src/legends/SeriesLegend.js +0 -108
- package/lib/viewer/src/utils.js +0 -36
package/.gitlab-ci.yml
CHANGED
|
@@ -5,13 +5,14 @@ stages:
|
|
|
5
5
|
- publish
|
|
6
6
|
|
|
7
7
|
variables:
|
|
8
|
-
NODE_VERSION: node:
|
|
8
|
+
NODE_VERSION: node:24-alpine
|
|
9
9
|
|
|
10
10
|
setup:
|
|
11
11
|
stage: setup
|
|
12
12
|
image: $NODE_VERSION
|
|
13
13
|
script:
|
|
14
14
|
- yarn
|
|
15
|
+
- yarn peers
|
|
15
16
|
artifacts:
|
|
16
17
|
paths:
|
|
17
18
|
- node_modules/
|
|
@@ -23,7 +24,7 @@ test:
|
|
|
23
24
|
- chmod +x ./node_modules/web-component-env/src/wce-test
|
|
24
25
|
script:
|
|
25
26
|
- yarn test
|
|
26
|
-
coverage: /All files\s
|
|
27
|
+
coverage: '/All files\s*\|\s*(\d+\.\d+)%/'
|
|
27
28
|
dependencies:
|
|
28
29
|
- setup
|
|
29
30
|
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
# dotstatsuite-components
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Those components are:
|
|
5
|
-
- [bridge-d3-react](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/bridge-d3-react/README.md)
|
|
6
|
-
- [chart](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/chart/README.md)
|
|
7
|
-
- [rules](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/rules/README.md)
|
|
8
|
-
- [rules-driver](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/rules-driver/README.md)
|
|
9
|
-
- [share](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/share/README.md)
|
|
10
|
-
|
|
11
|
-
Unlike other libraries as [dotstatsuite-ui-components](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-ui-components), this library doesn't focus only on UI design, but also on data parsing and deduced behaviour, like the visualisation charts.
|
|
12
|
-
|
|
13
|
-
## setup
|
|
14
|
-
|
|
15
|
-
- install: `npm i @sis-cc/dotstatsuite-components`
|
|
16
|
-
|
|
17
|
-
## usage
|
|
18
|
-
|
|
19
|
-
see individuals readme files of the components
|
|
3
|
+
Set components based on React.
|
package/package.json
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sis-cc/dotstatsuite-components",
|
|
3
3
|
"description": "Set components based on React.",
|
|
4
|
-
"version": "
|
|
5
|
-
"main": "lib/index.js",
|
|
4
|
+
"version": "21.0.0",
|
|
6
5
|
"type": "module",
|
|
6
|
+
"module": "./dist/dotstatsuite-components.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
7
10
|
"author": "OECD",
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
13
|
+
"peers": "install-peers --force-run",
|
|
14
|
+
"build": "vite build",
|
|
12
15
|
"test": "wce test"
|
|
13
16
|
},
|
|
14
17
|
"devDependencies": {
|
|
15
|
-
"
|
|
18
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
19
|
+
"@sis-cc/dotstatsuite-d3-charts": "^9.2.0",
|
|
20
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
21
|
+
"install-peers-cli": "^2.2.0",
|
|
22
|
+
"ramda": "^0.26.1",
|
|
23
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
24
|
+
"vite": "^5.4.9",
|
|
25
|
+
"web-component-env": "^2.9.10"
|
|
16
26
|
},
|
|
17
27
|
"dependencies": {
|
|
18
28
|
"@react-hook/size": "^2.1.1",
|
|
19
|
-
"@sis-cc/dotstatsuite-d3-charts": "^9.1.2",
|
|
20
|
-
"@sis-cc/dotstatsuite-sdmxjs": "^10.1.0",
|
|
21
|
-
"@sis-cc/dotstatsuite-visions": "^12.8.0",
|
|
22
|
-
"date-fns": "^1.30.1",
|
|
23
29
|
"lodash": "^4.17.2",
|
|
24
|
-
"
|
|
25
|
-
"memoizee": "^0.4.4",
|
|
26
|
-
"numeral": "^2.0.6",
|
|
27
|
-
"prop-types": "^15.6.2",
|
|
28
|
-
"ramda": "^0.26.1"
|
|
30
|
+
"memoizee": "^0.4.4"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"@emotion/react": "^11",
|
|
@@ -33,6 +35,10 @@
|
|
|
33
35
|
"@mui/icons-material": "^5",
|
|
34
36
|
"@mui/material": "^5",
|
|
35
37
|
"@mui/styles": "^5",
|
|
38
|
+
"@sis-cc/dotstatsuite-sdmxjs": "~10.1.0",
|
|
39
|
+
"@sis-cc/dotstatsuite-visions": "~12.27.0",
|
|
40
|
+
"date-fns": "^1.30.1",
|
|
41
|
+
"numeral": "^2.0.6",
|
|
36
42
|
"react": "^18",
|
|
37
43
|
"react-dom": "^18"
|
|
38
44
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { isFunction, cloneDeep } from 'lodash';
|
|
3
2
|
|
|
4
3
|
export default D3Chart => class ReactChart extends Component {
|
|
5
4
|
constructor(props) {
|
|
@@ -48,7 +47,7 @@ export default D3Chart => class ReactChart extends Component {
|
|
|
48
47
|
|
|
49
48
|
componentWillUnmount() {
|
|
50
49
|
super.componentWillUnmount && super.componentWillUnmount();
|
|
51
|
-
|
|
50
|
+
|
|
52
51
|
this.chart && this.chart.destroy && this.chart.destroy(this.refs.chart);
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { map, sortBy, head, isEmpty, isNil, split } from 'lodash';
|
|
2
2
|
import { categoryDisplay } from '../dimension-utils';
|
|
3
3
|
import { getFormatedObservation } from '../observation-formater';
|
|
4
4
|
|
package/src/rules/src/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
filter, find, includes, isArray, findIndex, isEqual
|
|
4
4
|
} from 'lodash';
|
|
5
5
|
import * as R from 'ramda';
|
|
6
|
-
import compose from 'lodash.compose';
|
|
7
6
|
import memoizee from 'memoizee';
|
|
8
7
|
import __sampleSeries from './factories/sample-series';
|
|
9
8
|
import __sampleFocus from './factories/sample-focus';
|
|
@@ -29,7 +28,7 @@ export const freqQ = FREQ_Q;
|
|
|
29
28
|
export const freqM = FREQ_M;
|
|
30
29
|
|
|
31
30
|
// --------------------------------------------------------------------------------extractSdmxErrors
|
|
32
|
-
const _extractSdmxErrors = (data) => compose(
|
|
31
|
+
const _extractSdmxErrors = (data) => R.compose(
|
|
33
32
|
(errors) => map(errors, (error) => ({ label: error.code, description: error.message })),
|
|
34
33
|
(data) => get(data, 'errors', [])
|
|
35
34
|
);
|
|
@@ -85,15 +84,15 @@ export const getDimensionValues = (dimension) => get(dimension, 'values', []);
|
|
|
85
84
|
const _splitDimensions = (data) => {
|
|
86
85
|
const { dimensions } = extractSdmxArtefacts(data);
|
|
87
86
|
const [value, values] = partition(
|
|
88
|
-
reject(dimensions, compose(isEmpty, getDimensionValues)),
|
|
89
|
-
compose((values) => size(values) === 1, getDimensionValues)
|
|
87
|
+
reject(dimensions, R.compose(isEmpty, getDimensionValues)),
|
|
88
|
+
R.compose((values) => size(values) === 1, getDimensionValues)
|
|
90
89
|
);
|
|
91
90
|
return { value, values };
|
|
92
91
|
}
|
|
93
92
|
export const splitDimensions = memoizee(_splitDimensions);
|
|
94
93
|
|
|
95
94
|
// ------------------------------------------------------------------dimensionsWithValuesIndexedById
|
|
96
|
-
const _dimensionsWithValuesIndexedById = (data) => compose(
|
|
95
|
+
const _dimensionsWithValuesIndexedById = (data) => R.compose(
|
|
97
96
|
(dimensionsWithValues) => keyBy(dimensionsWithValues, 'id'),
|
|
98
97
|
(split) => split.values,
|
|
99
98
|
splitDimensions
|
|
@@ -212,11 +211,11 @@ const _source = (data, config, meta) => {
|
|
|
212
211
|
return null;
|
|
213
212
|
const source = get(config, 'source', null);
|
|
214
213
|
if (source && !(isEmpty(source)))
|
|
215
|
-
return source;
|
|
214
|
+
return source;
|
|
216
215
|
const artefacts = extractSdmxArtefacts(data);
|
|
217
216
|
const uri = get(artefacts, 'source');
|
|
218
|
-
if (!uri)
|
|
219
|
-
return get(config, 'defaultSource', null);
|
|
217
|
+
if (!uri)
|
|
218
|
+
return get(config, 'defaultSource', null);
|
|
220
219
|
const match = uri.match(/(^http.*)\/SDMX-JSON\/data\/([^\/]+)\//);
|
|
221
220
|
if (size(match) !== 3)
|
|
222
221
|
return null;
|
|
@@ -232,20 +231,20 @@ const _focus = (data, type, dimension, _display) => {
|
|
|
232
231
|
case 'RowChart': case 'BarChart':
|
|
233
232
|
case 'HorizontalSymbolChart': case 'VerticalSymbolChart':
|
|
234
233
|
case 'StackedBarChart': case 'StackedRowChart':
|
|
235
|
-
return compose(
|
|
234
|
+
return R.compose(
|
|
236
235
|
(datapoints) => map(datapoints, (dp) => ({ label: dp.category, value: dp.key })),
|
|
237
236
|
(series) => series[0].datapoints,
|
|
238
237
|
series
|
|
239
238
|
)(data, type, null, dimension, null, display);
|
|
240
239
|
case 'TimelineChart':
|
|
241
|
-
return compose(
|
|
240
|
+
return R.compose(
|
|
242
241
|
(series) => map(series, (serie) => ({ label: serie.category, value: serie.key })),
|
|
243
242
|
series
|
|
244
243
|
)(data, type, null, dimension, null, display)
|
|
245
244
|
case 'ScatterChart':
|
|
246
245
|
const id = get(dimension, 'id');
|
|
247
246
|
if (isNil(id)) return [];
|
|
248
|
-
const dimensions = compose(
|
|
247
|
+
const dimensions = R.compose(
|
|
249
248
|
(dimensions) => omit(dimensions, id),
|
|
250
249
|
dimensionsWithValuesIndexedById
|
|
251
250
|
)(data);
|
|
@@ -324,7 +323,7 @@ export const headerUprsLabel = display => uprAttributes => {
|
|
|
324
323
|
).join(', ');
|
|
325
324
|
}
|
|
326
325
|
|
|
327
|
-
export const getUprs = (data, display) => compose(
|
|
326
|
+
export const getUprs = (data, display) => R.compose(
|
|
328
327
|
headerUprsLabel(parseDisplay(display)),
|
|
329
328
|
uprAttributesWithOneRelevantValue,
|
|
330
329
|
({ attributes }) => uprAttributes(attributes),
|
|
@@ -338,7 +337,7 @@ const _header = (data, _title, _subtitle, _display) => {
|
|
|
338
337
|
return ({
|
|
339
338
|
title,
|
|
340
339
|
subtitle: isArray(subtitle) ? subtitle : [subtitle],
|
|
341
|
-
uprs: compose(
|
|
340
|
+
uprs: R.compose(
|
|
342
341
|
headerUprsLabel(display),
|
|
343
342
|
uprAttributesWithOneRelevantValue,
|
|
344
343
|
({ attributes }) => uprAttributes(attributes),
|
|
@@ -395,3 +394,5 @@ export { isSharedLayoutCompatible } from './layout';
|
|
|
395
394
|
|
|
396
395
|
export { getObservations } from './preparators/getObservations';
|
|
397
396
|
|
|
397
|
+
export const getFlags = R.identity;
|
|
398
|
+
export const prepareData = R.identity;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as R from 'ramda';
|
|
2
2
|
import { extractSdmxArtefacts, focus } from '../';
|
|
3
|
-
import { BAR, ROW,
|
|
4
|
-
import {
|
|
3
|
+
import { BAR, ROW, TIMELINE } from '../constants';
|
|
4
|
+
import { hasFocus } from './utils';
|
|
5
5
|
|
|
6
6
|
const sampleFocusTypes = { [BAR]: BAR, [ROW]: ROW, [TIMELINE]: TIMELINE };
|
|
7
7
|
|
|
@@ -63,7 +63,7 @@ export const focusStateFromNewProps = ({ data, display, type }, singularity, sta
|
|
|
63
63
|
|
|
64
64
|
export const sampleFocusStateFromNewProps = (props, state) => {
|
|
65
65
|
if (!R.has(props.type, sampleFocusTypes) || R.isNil(props.data)) {
|
|
66
|
-
return ({}); //no changes
|
|
66
|
+
return ({}); //no changes
|
|
67
67
|
}
|
|
68
68
|
return focusStateFromNewProps(props, null, state);
|
|
69
69
|
};
|
|
@@ -16,7 +16,11 @@ export const hierarchiseDimensionWithNativeHierarchy = (dimension) => {
|
|
|
16
16
|
R.assoc('parents', parentsIndexes),
|
|
17
17
|
R.assoc('parent', R.isEmpty(parentsIndexes) ? undefined : parentId),
|
|
18
18
|
)(child);
|
|
19
|
-
const children = getChildren({
|
|
19
|
+
const children = getChildren({
|
|
20
|
+
parentsIndexes: R.propOr(false, 'isSelected', child)
|
|
21
|
+
? R.append(index, parentsIndexes) : parentsIndexes,
|
|
22
|
+
parentId: child.id
|
|
23
|
+
});
|
|
20
24
|
return R.concat(acc, R.prepend(refined, children));
|
|
21
25
|
},
|
|
22
26
|
[],
|
|
@@ -5,7 +5,10 @@ import { getLayoutCoordinatesValidator } from '../utils';
|
|
|
5
5
|
const getValueData = (index, dimension, parentsIndexes, missingParents = []) => ({
|
|
6
6
|
dimension: R.pick(['id', 'name', '__index'], dimension),
|
|
7
7
|
value: {
|
|
8
|
-
...R.pipe(
|
|
8
|
+
...R.pipe(
|
|
9
|
+
R.pathOr({}, ['values', index]),
|
|
10
|
+
R.pick(['id', 'name', 'isNonCoded', 'flags', 'hasAdvancedAttributes', 'display'])
|
|
11
|
+
)(dimension),
|
|
9
12
|
parents: parentsIndexes,
|
|
10
13
|
missingParents
|
|
11
14
|
}
|
package/src/viewer/src/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import * as R from 'ramda';
|
|
3
|
-
import cx from 'classnames';
|
|
4
3
|
import useSize from '@react-hook/size';
|
|
5
4
|
import { Loading, NoData, TableHtml5 } from '@sis-cc/dotstatsuite-visions';
|
|
6
5
|
import { makeStyles, useTheme } from '@mui/styles';
|
|
@@ -72,10 +71,10 @@ const Viewer = ({ type, targets={}, width, ...rest }) => {
|
|
|
72
71
|
return (
|
|
73
72
|
<div
|
|
74
73
|
{...(targets.viewer ? { ref: targets.viewer } : {})}
|
|
75
|
-
className={
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
74
|
+
className={[
|
|
75
|
+
classes.container,
|
|
76
|
+
type === 'table' ? classes.tableContainer : classes.chartContainer
|
|
77
|
+
]}
|
|
79
78
|
>
|
|
80
79
|
<Header
|
|
81
80
|
target={targets.header}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import * as R from 'ramda';
|
|
4
3
|
import makeStyles from '@mui/styles/makeStyles';
|
|
5
4
|
import { SCATTER } from '../../../rules/src/constants';
|
|
@@ -39,10 +38,4 @@ const AxisLegend = ({ axis, data, type }) => {
|
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
AxisLegend.propTypes = {
|
|
43
|
-
axis: PropTypes.string.isRequired,
|
|
44
|
-
data: PropTypes.object.isRequired,
|
|
45
|
-
type: PropTypes.string.isRequired,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
41
|
export default AxisLegend;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import * as R from 'ramda';
|
|
4
3
|
import Legend from './Legend';
|
|
5
4
|
import { SCATTER, TIMELINE } from '../../../rules/src/constants';
|
|
@@ -22,11 +21,11 @@ const FocusLegend = ({ data, options, type, width }) => {
|
|
|
22
21
|
if (width < REDUCED_THRESHOLD) {
|
|
23
22
|
return null;
|
|
24
23
|
}
|
|
25
|
-
|
|
24
|
+
|
|
26
25
|
const itemRenderer = R.pipe(
|
|
27
26
|
R.when(R.always(type === SCATTER), R.always(scatterRenderer)),
|
|
28
27
|
R.when(R.always(type === TIMELINE), R.always(lineRenderer)),
|
|
29
|
-
)(null);
|
|
28
|
+
)(null);
|
|
30
29
|
|
|
31
30
|
const getItemLabel = R.ifElse(
|
|
32
31
|
R.equals(SCATTER),
|
|
@@ -61,11 +60,4 @@ const FocusLegend = ({ data, options, type, width }) => {
|
|
|
61
60
|
return (<Legend items={items} itemRenderer={itemRenderer} />);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
FocusLegend.propTypes = {
|
|
65
|
-
data: PropTypes.object,
|
|
66
|
-
options: PropTypes.object,
|
|
67
|
-
type: PropTypes.string,
|
|
68
|
-
width: PropTypes.number
|
|
69
|
-
};
|
|
70
|
-
|
|
71
63
|
export default FocusLegend;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import * as R from 'ramda';
|
|
4
3
|
import makeStyles from '@mui/styles/makeStyles';
|
|
5
4
|
import { getFontFromTheme } from '../utils';
|
|
@@ -44,9 +43,4 @@ const Legend = ({ items, itemRenderer }) => {
|
|
|
44
43
|
return (<div className={classes.legend} >{legendEntries}</div>);
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
Legend.propTypes = {
|
|
48
|
-
itemRenderer: PropTypes.func,
|
|
49
|
-
items: PropTypes.array
|
|
50
|
-
};
|
|
51
|
-
|
|
52
46
|
export default Legend;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import * as R from 'ramda';
|
|
4
3
|
import Legend from './Legend';
|
|
5
4
|
import { H_SYMBOL, STACKED_BAR, STACKED_ROW, V_SYMBOL } from '../../../rules/src/constants';
|
|
@@ -76,10 +75,4 @@ const SeriesLegend = ({ data, options, type }) => {
|
|
|
76
75
|
);
|
|
77
76
|
};
|
|
78
77
|
|
|
79
|
-
SeriesLegend.propTypes = {
|
|
80
|
-
data: PropTypes.object,
|
|
81
|
-
options: PropTypes.object,
|
|
82
|
-
type: PropTypes.string,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
78
|
export default SeriesLegend;
|
|
@@ -6,24 +6,24 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
6
6
|
const dimension = {
|
|
7
7
|
id: 'test',
|
|
8
8
|
values: [
|
|
9
|
-
{ id: 'FRA', parent: 'EA', __indexPosition: 101 },
|
|
10
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
11
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
12
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
13
|
-
{ id: 'W', parent: undefined, __indexPosition: 5 },
|
|
14
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
9
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
10
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
11
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
12
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
13
|
+
{ id: 'W', parent: undefined, __indexPosition: 5, isSelected: true },
|
|
14
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
15
15
|
]
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const expected = {
|
|
19
19
|
id: 'test',
|
|
20
20
|
values: [
|
|
21
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
22
|
-
{ id: 'W', parent: undefined, parents: [], __indexPosition: 1 },
|
|
23
|
-
{ id: 'A', parent: 'W', parents: [1], __indexPosition: 2 },
|
|
24
|
-
{ id: 'EA', parent: 'W', parents: [1], __indexPosition: 3 },
|
|
25
|
-
{ id: 'GER', parent: 'EA', parents: [1, 3], __indexPosition: 4 },
|
|
26
|
-
{ id: 'FRA', parent: 'EA', parents: [1, 3], __indexPosition: 5 }
|
|
21
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
22
|
+
{ id: 'W', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
23
|
+
{ id: 'A', parent: 'W', parents: [1], __indexPosition: 2, isSelected: true },
|
|
24
|
+
{ id: 'EA', parent: 'W', parents: [1], __indexPosition: 3, isSelected: true },
|
|
25
|
+
{ id: 'GER', parent: 'EA', parents: [1, 3], __indexPosition: 4, isSelected: true },
|
|
26
|
+
{ id: 'FRA', parent: 'EA', parents: [1, 3], __indexPosition: 5, isSelected: true }
|
|
27
27
|
]
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -33,22 +33,22 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
33
33
|
const dimension = {
|
|
34
34
|
id: 'test',
|
|
35
35
|
values: [
|
|
36
|
-
{ id: 'FRA', parent: 'EA', __indexPosition: 101 },
|
|
37
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
38
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
39
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
40
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
36
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
37
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
38
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
39
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
40
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
41
41
|
]
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const expected = {
|
|
45
45
|
id: 'test',
|
|
46
46
|
values: [
|
|
47
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
48
|
-
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1 },
|
|
49
|
-
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2 },
|
|
50
|
-
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3 },
|
|
51
|
-
{ id: 'FRA', parent: 'EA', parents: [2], __indexPosition: 4 }
|
|
47
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
48
|
+
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
49
|
+
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2, isSelected: true },
|
|
50
|
+
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3, isSelected: true },
|
|
51
|
+
{ id: 'FRA', parent: 'EA', parents: [2], __indexPosition: 4, isSelected: true }
|
|
52
52
|
]
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -58,25 +58,52 @@ describe('hierarchiseDimensionWithNativeHierarchy tests', () => {
|
|
|
58
58
|
const dimension = {
|
|
59
59
|
id: 'test',
|
|
60
60
|
values: [
|
|
61
|
-
{ id: '', parent: '', __indexPosition: 101 },
|
|
62
|
-
{ id: 'GER', parent: 'EA', __indexPosition: 100 },
|
|
63
|
-
{ id: 'EA', parent: 'W', __indexPosition: 30 },
|
|
64
|
-
{ id: 'A', parent: 'W', __indexPosition: 20 },
|
|
65
|
-
{ id: 'CHI', parent: undefined, __indexPosition: 0 }
|
|
61
|
+
{ id: '', parent: '', __indexPosition: 101, isSelected: true },
|
|
62
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
63
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: true },
|
|
64
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
65
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
66
66
|
]
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const expected = {
|
|
70
70
|
id: 'test',
|
|
71
71
|
values: [
|
|
72
|
-
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0 },
|
|
73
|
-
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1 },
|
|
74
|
-
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2 },
|
|
75
|
-
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3 },
|
|
76
|
-
{ id: '', parent: undefined, parents: [], __indexPosition: 4 }
|
|
72
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
73
|
+
{ id: 'A', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
74
|
+
{ id: 'EA', parent: undefined, parents: [], __indexPosition: 2, isSelected: true },
|
|
75
|
+
{ id: 'GER', parent: 'EA', parents: [2], __indexPosition: 3, isSelected: true },
|
|
76
|
+
{ id: '', parent: undefined, parents: [], __indexPosition: 4, isSelected: true }
|
|
77
77
|
]
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
expect(hierarchiseDimensionWithNativeHierarchy(dimension)).to.deep.equal(expected);
|
|
81
81
|
});
|
|
82
|
+
it('non selected parent', () => {
|
|
83
|
+
const dimension = {
|
|
84
|
+
id: 'test',
|
|
85
|
+
values: [
|
|
86
|
+
{ id: 'FRA', parent: 'EA', __indexPosition: 101, isSelected: true },
|
|
87
|
+
{ id: 'GER', parent: 'EA', __indexPosition: 100, isSelected: true },
|
|
88
|
+
{ id: 'EA', parent: 'W', __indexPosition: 30, isSelected: false },
|
|
89
|
+
{ id: 'A', parent: 'W', __indexPosition: 20, isSelected: true },
|
|
90
|
+
{ id: 'W', parent: undefined, __indexPosition: 5, isSelected: true },
|
|
91
|
+
{ id: 'CHI', parent: undefined, __indexPosition: 0, isSelected: true }
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const expected = {
|
|
96
|
+
id: 'test',
|
|
97
|
+
values: [
|
|
98
|
+
{ id: 'CHI', parent: undefined, parents: [], __indexPosition: 0, isSelected: true },
|
|
99
|
+
{ id: 'W', parent: undefined, parents: [], __indexPosition: 1, isSelected: true },
|
|
100
|
+
{ id: 'A', parent: 'W', parents: [1], __indexPosition: 2, isSelected: true },
|
|
101
|
+
{ id: 'EA', parent: 'W', parents: [1], __indexPosition: 3, isSelected: false },
|
|
102
|
+
{ id: 'GER', parent: 'EA', parents: [1], __indexPosition: 4, isSelected: true },
|
|
103
|
+
{ id: 'FRA', parent: 'EA', parents: [1], __indexPosition: 5, isSelected: true }
|
|
104
|
+
]
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
expect(hierarchiseDimensionWithNativeHierarchy(dimension)).to.deep.equal(expected);
|
|
108
|
+
})
|
|
82
109
|
});
|
package/vite.config.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { visualizer } from "rollup-plugin-visualizer";
|
|
4
|
+
import replace from '@rollup/plugin-replace';
|
|
5
|
+
import { dependencies, peerDependencies } from './package.json';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
react(),
|
|
10
|
+
visualizer({
|
|
11
|
+
open: false, // auto-open in browser
|
|
12
|
+
gzipSize: true,
|
|
13
|
+
brotliSize: true,
|
|
14
|
+
}),
|
|
15
|
+
replace({
|
|
16
|
+
preventAssignment: true,
|
|
17
|
+
delimiters: ['', ''],
|
|
18
|
+
values: {
|
|
19
|
+
'var d3_document = this.document;':
|
|
20
|
+
'var d3_document = globalThis.document;',
|
|
21
|
+
'this[d3_vendorSymbol(this, "requestAnimationFrame")]':
|
|
22
|
+
'globalThis[d3_vendorSymbol(globalThis, "requestAnimationFrame")]',
|
|
23
|
+
'this.navigator && /WebKit/.test(this.navigator.userAgent)':
|
|
24
|
+
'globalThis.navigator && /WebKit/.test(globalThis.navigator.userAgent)',
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
],
|
|
28
|
+
build: {
|
|
29
|
+
minify: false,
|
|
30
|
+
lib: {
|
|
31
|
+
entry: 'src/index.js',
|
|
32
|
+
name: '@sis-cc/dotstatsuite-components',
|
|
33
|
+
formats: ['es'],
|
|
34
|
+
},
|
|
35
|
+
rollupOptions: {
|
|
36
|
+
external: (id) => {
|
|
37
|
+
const externals = [
|
|
38
|
+
...Object.keys(peerDependencies || {}),
|
|
39
|
+
...Object.keys(dependencies || {}),
|
|
40
|
+
];
|
|
41
|
+
return externals.some(pkg => id === pkg || id.startsWith(pkg + '/'));
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
// can be removed when all jsx files will have .jsx extension
|
|
46
|
+
esbuild: {
|
|
47
|
+
loader: 'jsx',
|
|
48
|
+
include: /src\/.*\.jsx?$/,
|
|
49
|
+
exclude: [],
|
|
50
|
+
}
|
|
51
|
+
});
|
package/lib/app.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _client = require('react-dom/client');
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
var container = document.getElementById('root');
|
|
12
|
-
var root = (0, _client.createRoot)(container);
|
|
13
|
-
|
|
14
|
-
var App = function App() {
|
|
15
|
-
return _react2.default.createElement(
|
|
16
|
-
_react.StrictMode,
|
|
17
|
-
null,
|
|
18
|
-
'I\'m not groot, I\'m component'
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
root.render(_react2.default.createElement(App, null));
|