@sis-cc/dotstatsuite-components 22.0.1 → 22.0.3
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/dist/bridge-d3-react/src/index.js +18 -0
- package/dist/bridge-d3-react/src/index.js.map +1 -0
- package/dist/bridge-d3-react/src/react-chart-factory.js +44 -0
- package/dist/bridge-d3-react/src/react-chart-factory.js.map +1 -0
- package/dist/rules/src/chart/getAxisOptions.js +256 -0
- package/dist/rules/src/chart/getAxisOptions.js.map +1 -0
- package/dist/rules/src/chart/getBaseOptions.js +77 -0
- package/dist/rules/src/chart/getBaseOptions.js.map +1 -0
- package/dist/rules/src/chart/getChartOptions.js +120 -0
- package/dist/rules/src/chart/getChartOptions.js.map +1 -0
- package/dist/rules/src/chart/getGridOptions.js +46 -0
- package/dist/rules/src/chart/getGridOptions.js.map +1 -0
- package/dist/rules/src/chart/getTooltipOptions.js +223 -0
- package/dist/rules/src/chart/getTooltipOptions.js.map +1 -0
- package/dist/rules/src/constants.js +65 -0
- package/dist/rules/src/constants.js.map +1 -0
- package/dist/rules/src/date.js +121 -0
- package/dist/rules/src/date.js.map +1 -0
- package/dist/rules/src/dimension-utils.js +57 -0
- package/dist/rules/src/dimension-utils.js.map +1 -0
- package/dist/rules/src/factories/choro-series.js +68 -0
- package/dist/rules/src/factories/choro-series.js.map +1 -0
- package/dist/rules/src/factories/sample-focus.js +25 -0
- package/dist/rules/src/factories/sample-focus.js.map +1 -0
- package/dist/rules/src/factories/sample-series.js +53 -0
- package/dist/rules/src/factories/sample-series.js.map +1 -0
- package/dist/rules/src/factories/scatter-dimension.js +35 -0
- package/dist/rules/src/factories/scatter-dimension.js.map +1 -0
- package/dist/rules/src/factories/scatter-focus.js +42 -0
- package/dist/rules/src/factories/scatter-focus.js.map +1 -0
- package/dist/rules/src/factories/scatter-series.js +91 -0
- package/dist/rules/src/factories/scatter-series.js.map +1 -0
- package/dist/rules/src/factories/stacked-dimension.js +32 -0
- package/dist/rules/src/factories/stacked-dimension.js.map +1 -0
- package/dist/rules/src/factories/stacked-series.js +188 -0
- package/dist/rules/src/factories/stacked-series.js.map +1 -0
- package/dist/rules/src/factories/symbol-dimension.js +32 -0
- package/dist/rules/src/factories/symbol-dimension.js.map +1 -0
- package/dist/rules/src/factories/symbol-series.js +65 -0
- package/dist/rules/src/factories/symbol-series.js.map +1 -0
- package/dist/rules/src/factories/timeline-focus.js +21 -0
- package/dist/rules/src/factories/timeline-focus.js.map +1 -0
- package/dist/rules/src/factories/timeline-series.js +94 -0
- package/dist/rules/src/factories/timeline-series.js.map +1 -0
- package/dist/rules/src/get-values-enhanced.js +133 -0
- package/dist/rules/src/get-values-enhanced.js.map +1 -0
- package/dist/rules/src/header/getDefaultSubtitle.js +44 -0
- package/dist/rules/src/header/getDefaultSubtitle.js.map +1 -0
- package/dist/rules/src/header/getHeaderUnits.js +21 -0
- package/dist/rules/src/header/getHeaderUnits.js.map +1 -0
- package/dist/rules/src/header/getSubtitleFlags.js +47 -0
- package/dist/rules/src/header/getSubtitleFlags.js.map +1 -0
- package/dist/rules/src/header/getTitleFlags.js +12 -0
- package/dist/rules/src/header/getTitleFlags.js.map +1 -0
- package/dist/rules/src/index.js +379 -0
- package/dist/rules/src/index.js.map +1 -0
- package/dist/rules/src/layout.js +107 -0
- package/dist/rules/src/layout.js.map +1 -0
- package/dist/rules/src/observation-formater.js +86 -0
- package/dist/rules/src/observation-formater.js.map +1 -0
- package/dist/rules/src/preparators/formatValue.js +96 -0
- package/dist/rules/src/preparators/formatValue.js.map +1 -0
- package/dist/rules/src/preparators/getObservations.js +22 -0
- package/dist/rules/src/preparators/getObservations.js.map +1 -0
- package/dist/rules/src/preparators/getReportingYearStart.js +19 -0
- package/dist/rules/src/preparators/getReportingYearStart.js.map +1 -0
- package/dist/rules/src/properties/errors.js +22 -0
- package/dist/rules/src/properties/errors.js.map +1 -0
- package/dist/rules/src/properties/focus.js +72 -0
- package/dist/rules/src/properties/focus.js.map +1 -0
- package/dist/rules/src/properties/getAvailableChartTypes.js +31 -0
- package/dist/rules/src/properties/getAvailableChartTypes.js.map +1 -0
- package/dist/rules/src/properties/getHeaderProps.js +76 -0
- package/dist/rules/src/properties/getHeaderProps.js.map +1 -0
- package/dist/rules/src/properties/getInformationsStateFromNewProps.js +50 -0
- package/dist/rules/src/properties/getInformationsStateFromNewProps.js.map +1 -0
- package/dist/rules/src/properties/getObservationsType.js +28 -0
- package/dist/rules/src/properties/getObservationsType.js.map +1 -0
- package/dist/rules/src/properties/getStringifiedSubtitle.js +9 -0
- package/dist/rules/src/properties/getStringifiedSubtitle.js.map +1 -0
- package/dist/rules/src/properties/index.js +384 -0
- package/dist/rules/src/properties/index.js.map +1 -0
- package/dist/rules/src/properties/linear.js +123 -0
- package/dist/rules/src/properties/linear.js.map +1 -0
- package/dist/rules/src/properties/scatter.js +156 -0
- package/dist/rules/src/properties/scatter.js.map +1 -0
- package/dist/rules/src/properties/stacked.js +96 -0
- package/dist/rules/src/properties/stacked.js.map +1 -0
- package/dist/rules/src/properties/symbol.js +76 -0
- package/dist/rules/src/properties/symbol.js.map +1 -0
- package/dist/rules/src/properties/utils.js +86 -0
- package/dist/rules/src/properties/utils.js.map +1 -0
- package/dist/rules/src/sdmx-data/index.js +38 -0
- package/dist/rules/src/sdmx-data/index.js.map +1 -0
- package/dist/rules/src/table/factories/getCellValue.js +53 -0
- package/dist/rules/src/table/factories/getCellValue.js.map +1 -0
- package/dist/rules/src/v8-transformer.js +174 -0
- package/dist/rules/src/v8-transformer.js.map +1 -0
- package/dist/rules2/src/applyHierarchicalCodesToDim.js +126 -0
- package/dist/rules2/src/applyHierarchicalCodesToDim.js.map +1 -0
- package/dist/rules2/src/combinedValuesDisplay.js +77 -0
- package/dist/rules2/src/combinedValuesDisplay.js.map +1 -0
- package/dist/rules2/src/constants.js +9 -0
- package/dist/rules2/src/constants.js.map +1 -0
- package/dist/rules2/src/duplicateObservations.js +38 -0
- package/dist/rules2/src/duplicateObservations.js.map +1 -0
- package/dist/rules2/src/enhanceObservations.js +98 -0
- package/dist/rules2/src/enhanceObservations.js.map +1 -0
- package/dist/rules2/src/getAttributesSeries.js +39 -0
- package/dist/rules2/src/getAttributesSeries.js.map +1 -0
- package/dist/rules2/src/getCombinationDefinitions.js +50 -0
- package/dist/rules2/src/getCombinationDefinitions.js.map +1 -0
- package/dist/rules2/src/getDataflowAttributes.js +25 -0
- package/dist/rules2/src/getDataflowAttributes.js.map +1 -0
- package/dist/rules2/src/getDataflowTooltipAttributesIds.js +33 -0
- package/dist/rules2/src/getDataflowTooltipAttributesIds.js.map +1 -0
- package/dist/rules2/src/getDimensionValuesIndexes.js +16 -0
- package/dist/rules2/src/getDimensionValuesIndexes.js.map +1 -0
- package/dist/rules2/src/getHCodelistsRefsInData.js +35 -0
- package/dist/rules2/src/getHCodelistsRefsInData.js.map +1 -0
- package/dist/rules2/src/getHeaderCombinations.js +51 -0
- package/dist/rules2/src/getHeaderCombinations.js.map +1 -0
- package/dist/rules2/src/getHeaderCoordinates.js +10 -0
- package/dist/rules2/src/getHeaderCoordinates.js.map +1 -0
- package/dist/rules2/src/getHeaderSubtitle.js +37 -0
- package/dist/rules2/src/getHeaderSubtitle.js.map +1 -0
- package/dist/rules2/src/getHeaderTitle.js +18 -0
- package/dist/rules2/src/getHeaderTitle.js.map +1 -0
- package/dist/rules2/src/getMSDInformations.js +26 -0
- package/dist/rules2/src/getMSDInformations.js.map +1 -0
- package/dist/rules2/src/getManyValuesDimensions.js +37 -0
- package/dist/rules2/src/getManyValuesDimensions.js.map +1 -0
- package/dist/rules2/src/getMetadataCoordinates.js +40 -0
- package/dist/rules2/src/getMetadataCoordinates.js.map +1 -0
- package/dist/rules2/src/getNotDisplayedIds.js +56 -0
- package/dist/rules2/src/getNotDisplayedIds.js.map +1 -0
- package/dist/rules2/src/getOneValueDimensions.js +37 -0
- package/dist/rules2/src/getOneValueDimensions.js.map +1 -0
- package/dist/rules2/src/getSeriesCombinations.js +27 -0
- package/dist/rules2/src/getSeriesCombinations.js.map +1 -0
- package/dist/rules2/src/hasCellMetadata.js +17 -0
- package/dist/rules2/src/hasCellMetadata.js.map +1 -0
- package/dist/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +60 -0
- package/dist/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js.map +1 -0
- package/dist/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +38 -0
- package/dist/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js.map +1 -0
- package/dist/rules2/src/index.js +47 -0
- package/dist/rules2/src/index.js.map +1 -0
- package/dist/rules2/src/parseAttributes.js +44 -0
- package/dist/rules2/src/parseAttributes.js.map +1 -0
- package/dist/rules2/src/parseCombinations.js +105 -0
- package/dist/rules2/src/parseCombinations.js.map +1 -0
- package/dist/rules2/src/parseHierarchicalCodelist.js +34 -0
- package/dist/rules2/src/parseHierarchicalCodelist.js.map +1 -0
- package/dist/rules2/src/parseMetadataSeries.js +124 -0
- package/dist/rules2/src/parseMetadataSeries.js.map +1 -0
- package/dist/rules2/src/prepareData.js +78 -0
- package/dist/rules2/src/prepareData.js.map +1 -0
- package/dist/rules2/src/refineAttributes.js +19 -0
- package/dist/rules2/src/refineAttributes.js.map +1 -0
- package/dist/rules2/src/refineDimensions.js +21 -0
- package/dist/rules2/src/refineDimensions.js.map +1 -0
- package/dist/rules2/src/refineTimePeriod.js +130 -0
- package/dist/rules2/src/refineTimePeriod.js.map +1 -0
- package/dist/rules2/src/sdmx3.0DataFormatPatch.js +12 -0
- package/dist/rules2/src/sdmx3.0DataFormatPatch.js.map +1 -0
- package/dist/rules2/src/table/declineObservationsOverAttributes.js +35 -0
- package/dist/rules2/src/table/declineObservationsOverAttributes.js.map +1 -0
- package/dist/rules2/src/table/getCells.js +96 -0
- package/dist/rules2/src/table/getCells.js.map +1 -0
- package/dist/rules2/src/table/getCellsAttributesIds.js +41 -0
- package/dist/rules2/src/table/getCellsAttributesIds.js.map +1 -0
- package/dist/rules2/src/table/getCellsMetadataCoordinates.js +16 -0
- package/dist/rules2/src/table/getCellsMetadataCoordinates.js.map +1 -0
- package/dist/rules2/src/table/getCuratedCells.js +36 -0
- package/dist/rules2/src/table/getCuratedCells.js.map +1 -0
- package/dist/rules2/src/table/getFlagsAndNotes.js +26 -0
- package/dist/rules2/src/table/getFlagsAndNotes.js.map +1 -0
- package/dist/rules2/src/table/getIndexedCombinationsByDisplay.js +19 -0
- package/dist/rules2/src/table/getIndexedCombinationsByDisplay.js.map +1 -0
- package/dist/rules2/src/table/getLayout.js +87 -0
- package/dist/rules2/src/table/getLayout.js.map +1 -0
- package/dist/rules2/src/table/getLayoutData2.js +205 -0
- package/dist/rules2/src/table/getLayoutData2.js.map +1 -0
- package/dist/rules2/src/table/getSortedLayoutIndexes.js +141 -0
- package/dist/rules2/src/table/getSortedLayoutIndexes.js.map +1 -0
- package/dist/rules2/src/table/getTableLabelAccessor.js +11 -0
- package/dist/rules2/src/table/getTableLabelAccessor.js.map +1 -0
- package/dist/rules2/src/table/getTableLayoutIds.js +317 -0
- package/dist/rules2/src/table/getTableLayoutIds.js.map +1 -0
- package/dist/rules2/src/table/getTableProps.js +85 -0
- package/dist/rules2/src/table/getTableProps.js.map +1 -0
- package/dist/rules2/src/table/parseSeriesIndexesHierarchies.js +82 -0
- package/dist/rules2/src/table/parseSeriesIndexesHierarchies.js.map +1 -0
- package/dist/rules2/src/table/parseValueHierarchy.js +29 -0
- package/dist/rules2/src/table/parseValueHierarchy.js.map +1 -0
- package/dist/rules2/src/table/refineLayoutSize2.js +324 -0
- package/dist/rules2/src/table/refineLayoutSize2.js.map +1 -0
- package/dist/rules2/src/utils.js +29 -0
- package/dist/rules2/src/utils.js.map +1 -0
- package/dist/viewer/src/chart.js +50 -0
- package/dist/viewer/src/chart.js.map +1 -0
- package/dist/viewer/src/chartUtils/options.js +33 -0
- package/dist/viewer/src/chartUtils/options.js.map +1 -0
- package/dist/viewer/src/chartUtils/series.js +54 -0
- package/dist/viewer/src/chartUtils/series.js.map +1 -0
- package/dist/viewer/src/footer.js +39 -0
- package/dist/viewer/src/footer.js.map +1 -0
- package/dist/viewer/src/header.js +12 -0
- package/dist/viewer/src/header.js.map +1 -0
- package/dist/viewer/src/index.js +160 -0
- package/dist/viewer/src/index.js.map +1 -0
- package/dist/viewer/src/legends/AxisLegend.js +42 -0
- package/dist/viewer/src/legends/AxisLegend.js.map +1 -0
- package/dist/viewer/src/legends/ChartLegends.js +80 -0
- package/dist/viewer/src/legends/ChartLegends.js.map +1 -0
- package/dist/viewer/src/legends/FocusLegend.js +67 -0
- package/dist/viewer/src/legends/FocusLegend.js.map +1 -0
- package/dist/viewer/src/legends/Legend.js +51 -0
- package/dist/viewer/src/legends/Legend.js.map +1 -0
- package/dist/viewer/src/legends/SeriesLegend.js +77 -0
- package/dist/viewer/src/legends/SeriesLegend.js.map +1 -0
- package/dist/viewer/src/utils.js +24 -0
- package/dist/viewer/src/utils.js.map +1 -0
- package/package.json +1 -1
- package/src/app.js +13 -0
- package/src/bridge-d3-react/README.md +42 -0
- package/src/bridge-d3-react/src/app.js +64 -0
- package/src/bridge-d3-react/src/index.js +16 -0
- package/src/bridge-d3-react/src/mock-choro.js +394 -0
- package/src/bridge-d3-react/src/react-chart-factory.jsx +65 -0
- package/src/index.js +10 -0
- package/src/rules/README.md +23 -0
- package/src/rules/src/chart/getAxisOptions.js +263 -0
- package/src/rules/src/chart/getBaseOptions.js +84 -0
- package/src/rules/src/chart/getChartOptions.js +118 -0
- package/src/rules/src/chart/getGridOptions.js +52 -0
- package/src/rules/src/chart/getTooltipOptions.js +230 -0
- package/src/rules/src/constants.js +64 -0
- package/src/rules/src/date.js +118 -0
- package/src/rules/src/dimension-utils.js +54 -0
- package/src/rules/src/factories/choro-series.js +65 -0
- package/src/rules/src/factories/sample-focus.js +22 -0
- package/src/rules/src/factories/sample-series.js +50 -0
- package/src/rules/src/factories/scatter-dimension.js +32 -0
- package/src/rules/src/factories/scatter-focus.js +39 -0
- package/src/rules/src/factories/scatter-series.js +92 -0
- package/src/rules/src/factories/stacked-dimension.js +29 -0
- package/src/rules/src/factories/stacked-series.js +185 -0
- package/src/rules/src/factories/symbol-dimension.js +29 -0
- package/src/rules/src/factories/symbol-series.js +62 -0
- package/src/rules/src/factories/timeline-focus.js +18 -0
- package/src/rules/src/factories/timeline-series.js +91 -0
- package/src/rules/src/get-values-enhanced.js +134 -0
- package/src/rules/src/header/getDefaultSubtitle.js +40 -0
- package/src/rules/src/header/getHeaderUnits.js +17 -0
- package/src/rules/src/header/getSubtitleFlags.js +43 -0
- package/src/rules/src/header/getTitleFlags.js +8 -0
- package/src/rules/src/header/index.js +4 -0
- package/src/rules/src/index.js +400 -0
- package/src/rules/src/layout.js +113 -0
- package/src/rules/src/observation-formater.js +83 -0
- package/src/rules/src/preparators/enhanceObservations.js +152 -0
- package/src/rules/src/preparators/formatValue.js +93 -0
- package/src/rules/src/preparators/getObservations.js +19 -0
- package/src/rules/src/preparators/getReportingYearStart.js +16 -0
- package/src/rules/src/properties/errors.js +19 -0
- package/src/rules/src/properties/focus.js +69 -0
- package/src/rules/src/properties/getAvailableChartTypes.js +34 -0
- package/src/rules/src/properties/getHeaderProps.js +74 -0
- package/src/rules/src/properties/getInformationsStateFromNewProps.js +47 -0
- package/src/rules/src/properties/getObservationsType.js +29 -0
- package/src/rules/src/properties/getStringifiedSubtitle.js +6 -0
- package/src/rules/src/properties/index.js +424 -0
- package/src/rules/src/properties/information.js +84 -0
- package/src/rules/src/properties/linear.js +129 -0
- package/src/rules/src/properties/scatter.js +158 -0
- package/src/rules/src/properties/stacked.js +98 -0
- package/src/rules/src/properties/symbol.js +79 -0
- package/src/rules/src/properties/utils.js +110 -0
- package/src/rules/src/sdmx-data/index.js +39 -0
- package/src/rules/src/table/factories/getCellValue.js +50 -0
- package/src/rules/src/table/index.js +1 -0
- package/src/rules/src/v8-transformer.js +177 -0
- package/src/rules2/src/applyHierarchicalCodesToDim.js +123 -0
- package/src/rules2/src/combinedValuesDisplay.js +74 -0
- package/src/rules2/src/constants.js +6 -0
- package/src/rules2/src/duplicateObservations.js +35 -0
- package/src/rules2/src/enhanceObservations.js +95 -0
- package/src/rules2/src/getAdvAttrSeriesAtCoordinates.js +29 -0
- package/src/rules2/src/getAttributesSeries.js +36 -0
- package/src/rules2/src/getCombinationDefinitions.js +47 -0
- package/src/rules2/src/getDataflowAttributes.js +23 -0
- package/src/rules2/src/getDataflowTooltipAttributesIds.js +31 -0
- package/src/rules2/src/getDimensionValuesIndexes.js +13 -0
- package/src/rules2/src/getHCodelistsRefsInData.js +32 -0
- package/src/rules2/src/getHeaderCombinations.js +48 -0
- package/src/rules2/src/getHeaderCoordinates.js +7 -0
- package/src/rules2/src/getHeaderSubtitle.js +34 -0
- package/src/rules2/src/getHeaderTitle.js +15 -0
- package/src/rules2/src/getMSDInformations.js +23 -0
- package/src/rules2/src/getManyValuesDimensions.js +34 -0
- package/src/rules2/src/getMetadataCoordinates.js +37 -0
- package/src/rules2/src/getMetadataStructureFromData.js +17 -0
- package/src/rules2/src/getNotDisplayedIds.js +53 -0
- package/src/rules2/src/getOneValueDimensions.js +34 -0
- package/src/rules2/src/getSeriesCombinations.js +24 -0
- package/src/rules2/src/hasCellMetadata.js +14 -0
- package/src/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +57 -0
- package/src/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +35 -0
- package/src/rules2/src/index.js +50 -0
- package/src/rules2/src/parseAttributes.js +41 -0
- package/src/rules2/src/parseCombinations.js +102 -0
- package/src/rules2/src/parseHierarchicalCodelist.js +48 -0
- package/src/rules2/src/parseMetadataSeries.js +121 -0
- package/src/rules2/src/prepareData.js +75 -0
- package/src/rules2/src/refineAttributes.js +16 -0
- package/src/rules2/src/refineDimensions.js +18 -0
- package/src/rules2/src/refineMetadataCoordinates.js +28 -0
- package/src/rules2/src/refineTimePeriod.js +127 -0
- package/src/rules2/src/sdmx3.0DataFormatPatch.js +9 -0
- package/src/rules2/src/table/declineObservationsOverAttributes.js +32 -0
- package/src/rules2/src/table/getCells.js +93 -0
- package/src/rules2/src/table/getCellsAttributesIds.js +38 -0
- package/src/rules2/src/table/getCellsMetadataCoordinates.js +13 -0
- package/src/rules2/src/table/getCombinationDimensionsData.js +39 -0
- package/src/rules2/src/table/getCuratedCells.js +33 -0
- package/src/rules2/src/table/getFlagsAndNotes.js +23 -0
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +16 -0
- package/src/rules2/src/table/getLayout.js +84 -0
- package/src/rules2/src/table/getLayoutData2.js +202 -0
- package/src/rules2/src/table/getSortedLayoutIndexes.js +138 -0
- package/src/rules2/src/table/getTableLabelAccessor.js +9 -0
- package/src/rules2/src/table/getTableLayoutIds.js +314 -0
- package/src/rules2/src/table/getTableProps.js +82 -0
- package/src/rules2/src/table/parseSeriesIndexesHierarchies.js +79 -0
- package/src/rules2/src/table/parseValueHierarchy.js +33 -0
- package/src/rules2/src/table/refineLayoutSize2.js +321 -0
- package/src/rules2/src/utils.js +37 -0
- package/src/viewer/mocks/bar.js +33 -0
- package/src/viewer/mocks/gpp-symbol.js +93 -0
- package/src/viewer/mocks/gpp-time.js +1103 -0
- package/src/viewer/mocks/row.js +39 -0
- package/src/viewer/mocks/scatter.js +93 -0
- package/src/viewer/mocks/stack.js +161 -0
- package/src/viewer/src/app/leg.js +36 -0
- package/src/viewer/src/app/nodata-res.js +22 -0
- package/src/viewer/src/app/nodata-sized.js +23 -0
- package/src/viewer/src/app/one-table-cell.js +70 -0
- package/src/viewer/src/app/table.js +423 -0
- package/src/viewer/src/app/use-case-1.js +33 -0
- package/src/viewer/src/app/use-case-2.js +38 -0
- package/src/viewer/src/app/use-case-3.js +18 -0
- package/src/viewer/src/app.js +116 -0
- package/src/viewer/src/chart.jsx +52 -0
- package/src/viewer/src/chartUtils/options.js +30 -0
- package/src/viewer/src/chartUtils/series.js +51 -0
- package/src/viewer/src/footer.jsx +23 -0
- package/src/viewer/src/header.jsx +10 -0
- package/src/viewer/src/index.jsx +158 -0
- package/src/viewer/src/legends/AxisLegend.jsx +41 -0
- package/src/viewer/src/legends/ChartLegends.jsx +66 -0
- package/src/viewer/src/legends/FocusLegend.jsx +63 -0
- package/src/viewer/src/legends/Legend.jsx +46 -0
- package/src/viewer/src/legends/SeriesLegend.jsx +78 -0
- package/src/viewer/src/utils.js +21 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { formatValue } from './formatValue';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
options = {
|
|
6
|
+
attachmentSeriesIndexes, //units
|
|
7
|
+
customAttributes: {
|
|
8
|
+
decimals: id,
|
|
9
|
+
prefscale: id,
|
|
10
|
+
},
|
|
11
|
+
unitsArtefacts,
|
|
12
|
+
obsAttributes,
|
|
13
|
+
rejectedValueIds,
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const getSerieKey = (dimValuesIndexes, options) => {
|
|
18
|
+
let indexes = R.propOr([], 'attachmentSeriesIndexes', options);
|
|
19
|
+
return R.pipe(
|
|
20
|
+
R.addIndex(R.map)((valueIndex, dimIndex) => {
|
|
21
|
+
if (dimIndex === R.head(indexes)) {
|
|
22
|
+
indexes = R.tail(indexes);
|
|
23
|
+
return valueIndex;
|
|
24
|
+
}
|
|
25
|
+
return 'x';
|
|
26
|
+
}),
|
|
27
|
+
R.join(':')
|
|
28
|
+
)(dimValuesIndexes);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getUnitsValues = (indexes, options) => R.reduce(
|
|
32
|
+
(acc, codelist) => {
|
|
33
|
+
const { id } = codelist;
|
|
34
|
+
if (!R.includes(id, R.propOr([], 'unitsIds', options))) {
|
|
35
|
+
return acc;
|
|
36
|
+
}
|
|
37
|
+
const valueIndex = R.prop(codelist.__index, indexes);
|
|
38
|
+
if (R.isNil(valueIndex) || !R.propOr(true, 'display', codelist)) {
|
|
39
|
+
return acc;
|
|
40
|
+
}
|
|
41
|
+
const value = R.path(['values', Number(valueIndex)], codelist);
|
|
42
|
+
if (R.isNil(value) || R.includes(value.id, R.propOr([], 'rejectedValueIds', options))
|
|
43
|
+
|| !R.propOr(true, 'display', value)) {
|
|
44
|
+
return acc;
|
|
45
|
+
}
|
|
46
|
+
return R.assoc(
|
|
47
|
+
id,
|
|
48
|
+
{
|
|
49
|
+
...R.pick(['id', 'name', '__index'], codelist),
|
|
50
|
+
value: R.when(R.complement(R.isNil), R.assoc('index', Number(valueIndex)))(value)
|
|
51
|
+
},
|
|
52
|
+
acc
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
{}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const getObservationUnits = (observation, dimensions, attributes, options) => {
|
|
59
|
+
const dimensionsUnits = getUnitsValues(
|
|
60
|
+
R.propOr([], 'dimValuesIndexes', observation),
|
|
61
|
+
options
|
|
62
|
+
)(dimensions);
|
|
63
|
+
|
|
64
|
+
const attributesUnits = getUnitsValues(
|
|
65
|
+
R.propOr([], 'attrValuesIndexes', observation),
|
|
66
|
+
options
|
|
67
|
+
)(attributes);
|
|
68
|
+
|
|
69
|
+
const serieKey = getSerieKey(R.propOr([], 'dimValuesIndexes', observation), options);
|
|
70
|
+
|
|
71
|
+
return ({ ...dimensionsUnits, ...attributesUnits, serieKey });
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const getFormatAttributesIndexes = (attributes, customAttributes) => R.addIndex(R.reduce)(
|
|
75
|
+
(acc, attribute, index) => {
|
|
76
|
+
if (R.equals(attribute.id, customAttributes.decimals)) {
|
|
77
|
+
return ({ ...acc, decimals: index });
|
|
78
|
+
}
|
|
79
|
+
if (R.equals(attribute.id, customAttributes.prefscale)) {
|
|
80
|
+
return ({ ...acc, prefscale: index });
|
|
81
|
+
}
|
|
82
|
+
return acc;
|
|
83
|
+
},
|
|
84
|
+
{ prefscale: null, decimals: null },
|
|
85
|
+
attributes
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const getAttributeValue = (attribute, valueIndex, options) => {
|
|
89
|
+
if (!R.propOr(true, 'display', attribute)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const value = R.pipe(
|
|
93
|
+
R.propOr([], 'values'),
|
|
94
|
+
R.nth(valueIndex)
|
|
95
|
+
)(attribute);
|
|
96
|
+
|
|
97
|
+
if (R.isNil(value) || !R.propOr(true, 'display', value) || R.includes(value.id,R.propOr([],'rejectedValueIds')(options))) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return ({
|
|
102
|
+
...R.pick(['id', 'name'], attribute),
|
|
103
|
+
value: R.pick(['id', 'name'], value)
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
export const enhanceObservations = (dimensions = [], observations = {}, attributes = [], options = {}) => {
|
|
109
|
+
const formatAttributesIndexes = getFormatAttributesIndexes(attributes, R.propOr({}, 'customAttributes', options));
|
|
110
|
+
const _attributes = R.addIndex(R.map)((attr, index) => R.assoc('__index', index, attr), attributes);
|
|
111
|
+
const _obsAttributes = R.pipe(
|
|
112
|
+
R.indexBy(R.prop('id')),
|
|
113
|
+
R.props(options.attributesIds || [])
|
|
114
|
+
)(_attributes);
|
|
115
|
+
|
|
116
|
+
return R.mapObjIndexed(
|
|
117
|
+
(observation) => {
|
|
118
|
+
const { attrValuesIndexes, dimValuesIndexes } = observation;
|
|
119
|
+
const obsAttributes = R.reduce(
|
|
120
|
+
(acc, attribute) => {
|
|
121
|
+
const attrValue = getAttributeValue(attribute, R.nth(attribute.__index, attrValuesIndexes), options);
|
|
122
|
+
if (R.isNil(attrValue)) {
|
|
123
|
+
return acc;
|
|
124
|
+
}
|
|
125
|
+
return R.assoc(attribute.id, attrValue, acc);
|
|
126
|
+
},
|
|
127
|
+
{},
|
|
128
|
+
_obsAttributes
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const indexedDimValIds = R.addIndex(R.reduce)(
|
|
132
|
+
(acc, dimension, dimensionIndex) => {
|
|
133
|
+
const id = dimension.id;
|
|
134
|
+
const valueIndex = R.nth(dimensionIndex, dimValuesIndexes);
|
|
135
|
+
const valueId = R.path(['values', Number(valueIndex), 'id'], dimension);
|
|
136
|
+
return R.assoc(id, valueId, acc);
|
|
137
|
+
},
|
|
138
|
+
{},
|
|
139
|
+
dimensions
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
return ({
|
|
143
|
+
...observation,
|
|
144
|
+
attributes: obsAttributes,
|
|
145
|
+
formattedValue: formatValue(observation, formatAttributesIndexes, attributes),
|
|
146
|
+
units: getObservationUnits(observation, dimensions, _attributes, options),
|
|
147
|
+
indexedDimValIds,
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
observations
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import numeral from 'numeral';
|
|
3
|
+
|
|
4
|
+
const isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)));
|
|
5
|
+
const parseValidNumber = R.pipe(
|
|
6
|
+
v => R.isNil(v) ? null : Number(v),
|
|
7
|
+
v => isNaN(v) ? null : v
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const getFormatAttributesValues = (observation, formatAttributesIndexes, attributes) => R.mapObjIndexed(
|
|
11
|
+
attributeIndex => {
|
|
12
|
+
let valueIndex;
|
|
13
|
+
const relationship = R.pipe(R.nth(attributeIndex), R.propOr({}, 'relationship'))(attributes);
|
|
14
|
+
//if (!R.isNil(attributeIndex) && attributeIndex >= R.length(R.propOr([], 'attrValuesIndexes', observation))) {
|
|
15
|
+
if (R.has('none', relationship) || R.has('dataflow', relationship)) {
|
|
16
|
+
valueIndex = 0;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
valueIndex = R.pipe(
|
|
20
|
+
R.propOr([], 'attrValuesIndexes'),
|
|
21
|
+
R.nth(attributeIndex),
|
|
22
|
+
parseValidNumber
|
|
23
|
+
)(observation);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return R.pipe(
|
|
27
|
+
R.path([attributeIndex, 'values', valueIndex, 'id']),
|
|
28
|
+
parseValidNumber
|
|
29
|
+
)(attributes);
|
|
30
|
+
},
|
|
31
|
+
formatAttributesIndexes
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const formatValue = (observation, formatAttributesIndexes, attributes) => {
|
|
35
|
+
const value = R.prop('value', observation);
|
|
36
|
+
if (R.is(Boolean, value)) {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
if (R.is(String, value)) {
|
|
40
|
+
const monthMatch = value.match(/^\-\-([\d]{2})$/);
|
|
41
|
+
if (R.is(Array, monthMatch)) {
|
|
42
|
+
return R.nth(1, monthMatch);
|
|
43
|
+
}
|
|
44
|
+
const monthDayMatch = value.match(/^\-\-([\d]{2}\-[\d]{2})$/);
|
|
45
|
+
if (R.is(Array, monthDayMatch)) {
|
|
46
|
+
return R.nth(1, monthDayMatch);
|
|
47
|
+
}
|
|
48
|
+
const dayMatch = value.match(/^\-\-\-([\d]{2})$/);
|
|
49
|
+
if (R.is(Array, dayMatch)) {
|
|
50
|
+
return R.nth(1, dayMatch);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const { prefscale, decimals } = getFormatAttributesValues(
|
|
56
|
+
observation,
|
|
57
|
+
formatAttributesIndexes,
|
|
58
|
+
attributes
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const formatScale = R.when(
|
|
62
|
+
R.always(isValidNumber(prefscale)),
|
|
63
|
+
value => numeral(value).multiply(Math.pow(10, -1 * Number(prefscale))).value(),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const formatSeparator = value => numeral(value).format(`0,0.[0000000]`);
|
|
67
|
+
const formatDecimals = R.ifElse(
|
|
68
|
+
R.always(isValidNumber(decimals)),
|
|
69
|
+
v => {
|
|
70
|
+
const num = Number(v);
|
|
71
|
+
const isTiny = Math.abs(num) < Math.pow(10, -(decimals ?? 2) + 1);
|
|
72
|
+
const displayNum = isTiny ? 0 : num;
|
|
73
|
+
const decimalFormat =
|
|
74
|
+
R.ifElse(
|
|
75
|
+
R.equals(0),
|
|
76
|
+
R.always('0,0'),
|
|
77
|
+
d => `0,0.${R.join('', R.times(R.always('0'), d))}`
|
|
78
|
+
)(decimals ?? 2);
|
|
79
|
+
|
|
80
|
+
return numeral(displayNum).format(decimalFormat);
|
|
81
|
+
},
|
|
82
|
+
formatSeparator
|
|
83
|
+
);
|
|
84
|
+
return R.ifElse(
|
|
85
|
+
isValidNumber,
|
|
86
|
+
R.pipe(
|
|
87
|
+
formatScale,
|
|
88
|
+
formatDecimals,
|
|
89
|
+
res => res === 'NaN' ? String(value) : res
|
|
90
|
+
),
|
|
91
|
+
R.always('..')
|
|
92
|
+
)(observation.value);
|
|
93
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const getObservations = (sdmxJson) => R.pipe(
|
|
4
|
+
R.pathOr({}, ['data', 'dataSets', 0, 'observations']),
|
|
5
|
+
R.mapObjIndexed(
|
|
6
|
+
(observation, observationKey) => {
|
|
7
|
+
const value = R.head(observation);
|
|
8
|
+
const attrValuesIndexes = R.tail(observation);
|
|
9
|
+
const dimValuesIndexes = R.split(':', observationKey);
|
|
10
|
+
|
|
11
|
+
return ({
|
|
12
|
+
key: observationKey,
|
|
13
|
+
value,
|
|
14
|
+
attrValuesIndexes,
|
|
15
|
+
dimValuesIndexes
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
)
|
|
19
|
+
)(sdmxJson);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { REPORTING_YEAR_START_DAY, REPYEARSTART } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const getReportingYearStart = (sdmxJson) => {
|
|
5
|
+
const attributes = R.pipe(
|
|
6
|
+
R.pathOr({}, ['data', 'structure', 'attributes']),
|
|
7
|
+
({ dataSet=[], observation=[], series=[] }) => [...dataSet, ...observation, ...series]
|
|
8
|
+
)(sdmxJson);
|
|
9
|
+
|
|
10
|
+
const reportYearStartAttr = R.find(({ id }) => {
|
|
11
|
+
return id === REPORTING_YEAR_START_DAY || id === REPYEARSTART;
|
|
12
|
+
}, attributes) || {};
|
|
13
|
+
const reportYearStart = R.pathOr('--01-01', ['values', 0, 'value'], reportYearStartAttr);
|
|
14
|
+
const [month = '01', day = '01'] = R.match(/[\d]{2}/g, reportYearStart);
|
|
15
|
+
return ({ month, day });
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { TIMELINE } from '../constants';
|
|
3
|
+
import { getTimePeriodDimension } from '@sis-cc/dotstatsuite-sdmxjs';
|
|
4
|
+
|
|
5
|
+
export const getHasNoTimePeriodError = ({ data, type }) => {
|
|
6
|
+
if (!R.equals(TIMELINE, type)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const dimensions = R.pathOr([], ['structure', 'dimensions', 'observation'], data);
|
|
10
|
+
const timeDimension = getTimePeriodDimension({ dimensions });
|
|
11
|
+
if (R.isNil(timeDimension)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return R.pipe(
|
|
15
|
+
R.propOr([], 'values'),
|
|
16
|
+
R.length,
|
|
17
|
+
R.gte(1)
|
|
18
|
+
)(timeDimension);
|
|
19
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { extractSdmxArtefacts, focus } from '../';
|
|
3
|
+
import { BAR, ROW, TIMELINE } from '../constants';
|
|
4
|
+
import { hasFocus } from './utils';
|
|
5
|
+
|
|
6
|
+
const sampleFocusTypes = { [BAR]: BAR, [ROW]: ROW, [TIMELINE]: TIMELINE };
|
|
7
|
+
|
|
8
|
+
const focusComparator = (op1, op2) => op1.value === op2.value;
|
|
9
|
+
|
|
10
|
+
export const focusOptions = (props, state, otherFocus, singularity) => {
|
|
11
|
+
if (!hasFocus(props.type)) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const options = focus(
|
|
15
|
+
props.data,
|
|
16
|
+
props.type,
|
|
17
|
+
singularity,
|
|
18
|
+
props.display
|
|
19
|
+
);
|
|
20
|
+
return R.differenceWith(
|
|
21
|
+
focusComparator,
|
|
22
|
+
options,
|
|
23
|
+
R.prop(otherFocus, state)
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const onChangeFocusSelection = (_value) => {
|
|
28
|
+
const value = R.isNil(_value) ? [] : _value;
|
|
29
|
+
return (R.is(Array, value) ? value : [value]);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const toKey = () => R.prop('value');
|
|
33
|
+
|
|
34
|
+
const filterFocus = (focus, keyedOptions, type) => R.reduce(
|
|
35
|
+
(acc, entry) => {
|
|
36
|
+
const entryKey = toKey(type)(entry);
|
|
37
|
+
if (R.has(entryKey, keyedOptions)) {
|
|
38
|
+
return R.append(R.prop(entryKey, keyedOptions), acc);
|
|
39
|
+
}
|
|
40
|
+
return acc;
|
|
41
|
+
},
|
|
42
|
+
[],
|
|
43
|
+
focus
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export const focusStateFromNewProps = ({ data, display, type }, singularity, state) => {
|
|
47
|
+
const { id } = extractSdmxArtefacts(data);
|
|
48
|
+
const highlightState = R.propOr([], 'highlight', state);
|
|
49
|
+
const baselineState = R.propOr([], 'baseline', state);
|
|
50
|
+
const options = focus(data, type, singularity, display);
|
|
51
|
+
const keyedOptions = R.indexBy(toKey(type), options);
|
|
52
|
+
return ({
|
|
53
|
+
baseline: filterFocus(baselineState, keyedOptions, R.prop('type', state)),
|
|
54
|
+
highlight: filterFocus(highlightState, keyedOptions, R.prop('type', state)),
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
This props/state parser which will be exposed in highlight/baseline properties,
|
|
60
|
+
only deals for Bar and Row Chart (no chart dimension singularity involved).
|
|
61
|
+
For other chart types, their own chart dimension singularity parser will handle focus management.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
export const sampleFocusStateFromNewProps = (props, state) => {
|
|
65
|
+
if (!R.has(props.type, sampleFocusTypes) || R.isNil(props.data)) {
|
|
66
|
+
return ({}); //no changes
|
|
67
|
+
}
|
|
68
|
+
return focusStateFromNewProps(props, null, state);
|
|
69
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import {
|
|
3
|
+
CHORO,
|
|
4
|
+
OBS_TYPE_NUMBER,
|
|
5
|
+
OBS_TYPE_NUMERICAL_STRING,
|
|
6
|
+
TIMELINE,
|
|
7
|
+
TYPES
|
|
8
|
+
} from '../constants';
|
|
9
|
+
import { getRefAreaDimension, getTimePeriodDimension } from '@sis-cc/dotstatsuite-sdmxjs';
|
|
10
|
+
import { getObservationsType } from './getObservationsType';
|
|
11
|
+
|
|
12
|
+
export const getAvailableChartTypes = (data) => {
|
|
13
|
+
const observationsType = getObservationsType(data);
|
|
14
|
+
if (!R.includes(observationsType, [OBS_TYPE_NUMBER, OBS_TYPE_NUMERICAL_STRING])) {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
const dimensions = R.pathOr([], ['structure', 'dimensions', 'observation'], data);
|
|
18
|
+
const timeDimension = getTimePeriodDimension({ dimensions });
|
|
19
|
+
const refAreaDimension = getRefAreaDimension({ dimensions });
|
|
20
|
+
const hasNoTime = R.anyPass([
|
|
21
|
+
R.isNil,
|
|
22
|
+
R.pipe(R.propOr([], 'values'), R.length, R.gte(1))
|
|
23
|
+
])(timeDimension);
|
|
24
|
+
return R.pipe(
|
|
25
|
+
R.when(
|
|
26
|
+
R.always(hasNoTime),
|
|
27
|
+
R.omit([TIMELINE])
|
|
28
|
+
),
|
|
29
|
+
R.when(
|
|
30
|
+
R.always(R.isNil(refAreaDimension)),
|
|
31
|
+
R.omit([CHORO])
|
|
32
|
+
)
|
|
33
|
+
)(TYPES);
|
|
34
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import {
|
|
3
|
+
getDefaultSubtitle,
|
|
4
|
+
getHeaderUnits,
|
|
5
|
+
getSubtitleFlags,
|
|
6
|
+
getTitleFlags
|
|
7
|
+
} from '../header';
|
|
8
|
+
import { dimensionValueDisplay, parseDisplay } from '../';
|
|
9
|
+
import { isChart } from './utils';
|
|
10
|
+
|
|
11
|
+
const isCustomInvalid = ({ type }) => (value) => R.isNil(value) || !isChart(type);
|
|
12
|
+
|
|
13
|
+
const getDataflowName = (props) => {
|
|
14
|
+
const dataflow = R.propOr({}, 'dataflow', props);
|
|
15
|
+
const display = parseDisplay(props.display);
|
|
16
|
+
return dimensionValueDisplay(display)(dataflow);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const getTitleLabel = (props, state) => R.when(
|
|
20
|
+
isCustomInvalid({ type: props.type }),
|
|
21
|
+
R.always(getDataflowName(props))
|
|
22
|
+
)(state.title);
|
|
23
|
+
|
|
24
|
+
export const getSubtitle = (props, state) => R.ifElse(
|
|
25
|
+
isCustomInvalid({type: props.type }),
|
|
26
|
+
R.always(getDefaultSubtitle({
|
|
27
|
+
customAttributes: props.customAttributes,
|
|
28
|
+
dimensions: state.dimensions,
|
|
29
|
+
display: props.display,
|
|
30
|
+
units: state.units
|
|
31
|
+
})),
|
|
32
|
+
(label) => {
|
|
33
|
+
const flags = getSubtitleFlags({
|
|
34
|
+
customAttributes: props.customAttributes,
|
|
35
|
+
dimensions: state.dimensions,
|
|
36
|
+
display: props.display,
|
|
37
|
+
units: state.units
|
|
38
|
+
});
|
|
39
|
+
return ([{ label, flags }]);
|
|
40
|
+
}
|
|
41
|
+
)(state.subtitle);
|
|
42
|
+
|
|
43
|
+
export const getSourceLabel = (props, state) => R.when(
|
|
44
|
+
isCustomInvalid({ type: props.type }),
|
|
45
|
+
R.always(getDataflowName(props))
|
|
46
|
+
)(state.sourceLabel);
|
|
47
|
+
|
|
48
|
+
export const getHeaderProps = (props, state) => {
|
|
49
|
+
const title = {
|
|
50
|
+
label: getTitleLabel(props, state),
|
|
51
|
+
flags: getTitleFlags({
|
|
52
|
+
customAttributes: props.customAttributes,
|
|
53
|
+
dataflowAttributes: state.dataflowAttributes,
|
|
54
|
+
display: props.display,
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const subtitle = getSubtitle(props, state);
|
|
59
|
+
|
|
60
|
+
const uprs = getHeaderUnits({
|
|
61
|
+
display: props.display,
|
|
62
|
+
units: R.assoc(
|
|
63
|
+
'values',
|
|
64
|
+
R.pathOr([], ['units', 'headerUnits'], state)
|
|
65
|
+
)(R.pathOr({}, ['units', 'unitDimension'], props))
|
|
66
|
+
});
|
|
67
|
+
return ({ subtitle, title, uprs });
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const getFooterProps = (props, state) => ({
|
|
71
|
+
withCopyright: isChart(props.type) ? state.withCopyright : true,
|
|
72
|
+
withLogo: isChart(props.type) ? state.withLogo : true,
|
|
73
|
+
sourceLabel: getSourceLabel(props, state)
|
|
74
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { extractSdmxArtefacts, prepareData } from '../';
|
|
3
|
+
|
|
4
|
+
const initialState = {
|
|
5
|
+
dataflow: null,
|
|
6
|
+
dataflowAttributes: null,
|
|
7
|
+
dimensions: null,
|
|
8
|
+
units: null,
|
|
9
|
+
id: null,
|
|
10
|
+
sourceLabel: null,
|
|
11
|
+
subtitle: null,
|
|
12
|
+
title: null,
|
|
13
|
+
withCopyright: true,
|
|
14
|
+
withLogo: true
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const getInformationsStateFromNewProps = (props, state) => {
|
|
18
|
+
if (R.isNil(props.data)) {
|
|
19
|
+
return initialState
|
|
20
|
+
}
|
|
21
|
+
const id = R.pipe(
|
|
22
|
+
R.prop('data'),
|
|
23
|
+
extractSdmxArtefacts,
|
|
24
|
+
R.prop('id')
|
|
25
|
+
)(props);
|
|
26
|
+
if (id === state.id && props.display === state.display) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
const {
|
|
30
|
+
dataflowAttributes,
|
|
31
|
+
dataflowName,
|
|
32
|
+
dimensions,
|
|
33
|
+
units
|
|
34
|
+
} = prepareData({ data: props.data }, props.customAttributes, props.units);
|
|
35
|
+
return {
|
|
36
|
+
...initialState,
|
|
37
|
+
dataflow: {
|
|
38
|
+
id: props.dataflowId,
|
|
39
|
+
name: dataflowName
|
|
40
|
+
},
|
|
41
|
+
dataflowAttributes,
|
|
42
|
+
dimensions,
|
|
43
|
+
display: props.display,
|
|
44
|
+
id,
|
|
45
|
+
units
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import {
|
|
3
|
+
OBS_TYPE_NUMBER,
|
|
4
|
+
OBS_TYPE_NUMERICAL_STRING,
|
|
5
|
+
OBS_TYPE_STRING
|
|
6
|
+
} from '../constants';
|
|
7
|
+
|
|
8
|
+
export const getObservationsType = (data) => {
|
|
9
|
+
if (R.isNil(data)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const firstObs = R.pipe(
|
|
13
|
+
R.pathOr({}, ['dataSets', 0, 'observations']),
|
|
14
|
+
R.values,
|
|
15
|
+
R.find(obs => R.not(R.either(R.isNil, R.isEmpty)(R.head(obs))))
|
|
16
|
+
)(data);
|
|
17
|
+
if (R.isNil(firstObs)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const firstObsValue = R.head(firstObs);
|
|
21
|
+
if (R.is(Number, firstObsValue)) {
|
|
22
|
+
return OBS_TYPE_NUMBER;
|
|
23
|
+
}
|
|
24
|
+
return R.ifElse(
|
|
25
|
+
R.equals(NaN),
|
|
26
|
+
R.always(OBS_TYPE_STRING),
|
|
27
|
+
R.always(OBS_TYPE_NUMERICAL_STRING)
|
|
28
|
+
)(Number(firstObsValue));
|
|
29
|
+
};
|