@sis-cc/dotstatsuite-components 22.0.1 → 22.0.2
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 +378 -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 +398 -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,314 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { isTimePeriodDimension, isRefAreaDimension } from '@sis-cc/dotstatsuite-sdmxjs';
|
|
3
|
+
|
|
4
|
+
export const getCombinationsNotInLayout = (combinations, layoutIds) => {
|
|
5
|
+
const { header=[], sections=[], rows=[] } = layoutIds;
|
|
6
|
+
const idsInLayout = new Set([...header, ...sections, ...rows]);
|
|
7
|
+
return R.reject(comb => idsInLayout.has(comb.id), combinations);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const indexCombsRelationships = (combinations) => R.reduce((acc, comb) => {
|
|
11
|
+
const { id, relationship=[] } = comb;
|
|
12
|
+
return R.assoc(id, relationship, acc);
|
|
13
|
+
}, {}, combinations);
|
|
14
|
+
|
|
15
|
+
export const getLayoutLevelRelationship = indexedRelationships => ids => R.reduce((acc, id) => {
|
|
16
|
+
if (R.has(id, indexedRelationships)) {
|
|
17
|
+
return R.concat(acc, R.prop(id, indexedRelationships));
|
|
18
|
+
}
|
|
19
|
+
return R.append(id, acc);
|
|
20
|
+
}, [], ids);
|
|
21
|
+
|
|
22
|
+
export const getLayoutRelationships = (indexedRelationships, layoutIds) => R.map(
|
|
23
|
+
getLayoutLevelRelationship(indexedRelationships),
|
|
24
|
+
layoutIds
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const injectCombination = combination => ids => {
|
|
28
|
+
const { id, concepts=[] } = combination;
|
|
29
|
+
const conceptsSet = new Set(concepts);
|
|
30
|
+
let inject = true;
|
|
31
|
+
const refined = R.reduce((acc, i) => {
|
|
32
|
+
if (!conceptsSet.has(i)) {
|
|
33
|
+
return R.append(i, acc);
|
|
34
|
+
}
|
|
35
|
+
if (inject) {
|
|
36
|
+
inject = false;
|
|
37
|
+
return R.append(id, acc);
|
|
38
|
+
}
|
|
39
|
+
return acc;
|
|
40
|
+
}, [], ids);
|
|
41
|
+
return inject ? R.append(id, refined) : refined;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const getCombinationLevelCompatibility = (layoutRelationships, combination) => {
|
|
45
|
+
const { relationship=[] } = combination;
|
|
46
|
+
const idsInHeaderSet = new Set(layoutRelationships.header);
|
|
47
|
+
const idsInSectionsSet = new Set(layoutRelationships.sections);
|
|
48
|
+
const idsInRowsSet = new Set(layoutRelationships.rows);
|
|
49
|
+
const [idsInHeader, rest] = R.partition(
|
|
50
|
+
i => idsInHeaderSet.has(i),
|
|
51
|
+
relationship
|
|
52
|
+
);
|
|
53
|
+
const [idsInSections, idsInRows] = R.reduce((_acc, id) => {
|
|
54
|
+
if (idsInSectionsSet.has(id))
|
|
55
|
+
return R.over(R.lensIndex(0), R.append(id), _acc);
|
|
56
|
+
if (idsInRowsSet.has(id))
|
|
57
|
+
return R.over(R.lensIndex(1), R.append(id), _acc);
|
|
58
|
+
return R.over(R.lensIndex(2), R.append(id), _acc);
|
|
59
|
+
}, [[], [], []], rest);
|
|
60
|
+
if (!R.isEmpty(idsInHeader) && R.isEmpty(idsInSections) && R.isEmpty(idsInRows)) {
|
|
61
|
+
return 'header';
|
|
62
|
+
}
|
|
63
|
+
if (!R.isEmpty(idsInHeader)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (!R.isEmpty(idsInSections) && R.isEmpty(idsInRows)) {
|
|
67
|
+
return 'sections';
|
|
68
|
+
}
|
|
69
|
+
if (!R.isEmpty(idsInRows)) {
|
|
70
|
+
return 'rows';
|
|
71
|
+
}
|
|
72
|
+
return 'blank';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const filterLayoutIds = (indexedCombinations, layoutDimsIds, obsAttributes) => (layoutIds) => {
|
|
76
|
+
const layoutConcepts = R.map(
|
|
77
|
+
R.reduce((acc, id) => {
|
|
78
|
+
if (R.has(id, indexedCombinations)) {
|
|
79
|
+
return R.concat(acc, R.path([id, 'concepts'], indexedCombinations));
|
|
80
|
+
}
|
|
81
|
+
return R.append(id, acc);
|
|
82
|
+
}, []),
|
|
83
|
+
layoutIds
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return R.mapObjIndexed(
|
|
87
|
+
(ids, level) => R.filter(id => {
|
|
88
|
+
if (id === 'OBS_ATTRIBUTES') {
|
|
89
|
+
return !R.isEmpty(obsAttributes);
|
|
90
|
+
}
|
|
91
|
+
if (R.has(id, indexedCombinations)) {
|
|
92
|
+
const comb = R.prop(id, indexedCombinations);
|
|
93
|
+
const dims = R.filter(i => layoutDimsIds.has(i), comb.concepts);
|
|
94
|
+
if (!R.isEmpty(dims)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
const oppositeIds = level === 'header'
|
|
98
|
+
? R.concat(R.prop('sections', layoutConcepts), R.prop('rows', layoutConcepts))
|
|
99
|
+
: R.prop('header', layoutConcepts);
|
|
100
|
+
return R.isEmpty(R.intersection(comb.relationship, oppositeIds));
|
|
101
|
+
}
|
|
102
|
+
return layoutDimsIds.has(id);
|
|
103
|
+
}, ids),
|
|
104
|
+
layoutIds
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const injectCombinationsInLayout = (combinations, layoutIds, defaultLayoutIds = {}) => {
|
|
109
|
+
const notInLayoutCombs = getCombinationsNotInLayout(combinations, layoutIds);
|
|
110
|
+
if (R.isEmpty(notInLayoutCombs)) {
|
|
111
|
+
return layoutIds;
|
|
112
|
+
}
|
|
113
|
+
const indexedCombsRelationships = indexCombsRelationships(combinations);
|
|
114
|
+
let layoutRelationships = getLayoutRelationships(indexedCombsRelationships, layoutIds);
|
|
115
|
+
const defaultLayoutRelationships = getLayoutRelationships(indexedCombsRelationships, defaultLayoutIds);
|
|
116
|
+
return R.reduce((acc, comb) => {
|
|
117
|
+
let levelCompatibility = getCombinationLevelCompatibility(layoutRelationships, comb);
|
|
118
|
+
if (R.isNil(levelCompatibility)) {
|
|
119
|
+
return acc;
|
|
120
|
+
}
|
|
121
|
+
if (R.equals('blank', levelCompatibility)) {
|
|
122
|
+
levelCompatibility = getCombinationLevelCompatibility(defaultLayoutRelationships, comb);
|
|
123
|
+
if (R.isNil(levelCompatibility)) {
|
|
124
|
+
return acc;
|
|
125
|
+
}
|
|
126
|
+
levelCompatibility = R.equals('blank', levelCompatibility) ? 'rows' : levelCompatibility;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
layoutRelationships[levelCompatibility] = R.concat(layoutRelationships[levelCompatibility], comb.relationship);
|
|
130
|
+
const ids = injectCombination(comb)(acc[levelCompatibility]);
|
|
131
|
+
return R.assoc(levelCompatibility, ids)(acc);
|
|
132
|
+
}, layoutIds, notInLayoutCombs);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const getLayoutDimsIds = dimensions => R.reduce(
|
|
136
|
+
(acc, d) => (d.header ? acc : acc.add(d.id)),
|
|
137
|
+
new Set([]),
|
|
138
|
+
dimensions,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
export const getLayoutCombinations = (combinations, layoutDimsIds, attributes) => {
|
|
142
|
+
const indexedAttributes = R.indexBy(R.prop('id'), attributes);
|
|
143
|
+
return R.reduce(
|
|
144
|
+
(acc, comb) => {
|
|
145
|
+
const { layoutConcepts, relationship } = R.reduce(
|
|
146
|
+
(_acc, concept) => {
|
|
147
|
+
if (layoutDimsIds.has(concept)) {
|
|
148
|
+
return R.map(R.append(concept), _acc);
|
|
149
|
+
}
|
|
150
|
+
if (R.has(concept, indexedAttributes)) {
|
|
151
|
+
const attr = R.prop(concept, indexedAttributes);
|
|
152
|
+
return attr.series
|
|
153
|
+
? {
|
|
154
|
+
..._acc,
|
|
155
|
+
relationship: R.concat(_acc.relationship, attr.relationship),
|
|
156
|
+
}
|
|
157
|
+
: _acc;
|
|
158
|
+
}
|
|
159
|
+
return _acc;
|
|
160
|
+
},
|
|
161
|
+
{ layoutConcepts: [], relationship: [] },
|
|
162
|
+
comb.concepts || [],
|
|
163
|
+
);
|
|
164
|
+
if (R.isEmpty(relationship)) {
|
|
165
|
+
return acc;
|
|
166
|
+
}
|
|
167
|
+
return R.append({ ...comb, relationship, concepts: layoutConcepts }, acc);
|
|
168
|
+
},
|
|
169
|
+
[],
|
|
170
|
+
combinations,
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const extractConcepts = (ids, indexedCombinations, layoutDimsIds) => {
|
|
175
|
+
const entry = R.find(id => {
|
|
176
|
+
if (R.has(id, indexedCombinations)) {
|
|
177
|
+
const dimId = R.find(i => layoutDimsIds.has(i), R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
178
|
+
return !R.isNil(dimId);
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}, ids);
|
|
182
|
+
|
|
183
|
+
const getRelationship = id => {
|
|
184
|
+
if (R.has(id, indexedCombinations)) {
|
|
185
|
+
return R.append(id, R.path([id, 'relationship'], indexedCombinations));
|
|
186
|
+
}
|
|
187
|
+
return [id];
|
|
188
|
+
};
|
|
189
|
+
let indexedRels = R.reduce((acc, id) =>
|
|
190
|
+
R.assoc(id, getRelationship(id), acc)
|
|
191
|
+
, {}, ids);
|
|
192
|
+
|
|
193
|
+
let relationship = [entry];
|
|
194
|
+
while (!R.isEmpty(indexedRels)) {
|
|
195
|
+
const related = R.pickBy(rels => !R.isEmpty(R.intersection(relationship, rels)), indexedRels);
|
|
196
|
+
if (R.isEmpty(related)) {
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
indexedRels = R.omit(R.keys(related), indexedRels);
|
|
200
|
+
relationship = R.concat(relationship, R.unnest(R.values(related)));
|
|
201
|
+
}
|
|
202
|
+
const set = new Set(relationship);
|
|
203
|
+
return R.partition(id => set.has(id), ids);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const injectRemainingDimensionsInLayout = (layoutIds, remainingDims, indexedCombinations, layoutDimsIds) => {
|
|
207
|
+
let _layout = layoutIds;
|
|
208
|
+
let _remaining = remainingDims;
|
|
209
|
+
|
|
210
|
+
const dimInRows = R.find(id => {
|
|
211
|
+
if (layoutDimsIds.has(id)) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
const dimId = R.find(i => layoutDimsIds.has(i), R.pathOr([], [id, 'concepts'], indexedCombinations));
|
|
215
|
+
return !R.isNil(dimId);
|
|
216
|
+
}, _layout.rows);
|
|
217
|
+
|
|
218
|
+
if (R.isNil(dimInRows)) {
|
|
219
|
+
if (R.isEmpty(_remaining)) {
|
|
220
|
+
const toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
|
|
221
|
+
const [extracted, remains] = extractConcepts(R.prop(toTakeIn, _layout), indexedCombinations, layoutDimsIds);
|
|
222
|
+
_layout = ({ ..._layout, rows: R.concat(_layout.rows, extracted), [toTakeIn]: remains });
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
_layout = R.over(R.lensProp('rows'), R.append(R.head(_remaining)))(_layout);
|
|
226
|
+
_remaining = R.tail(_remaining)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!R.isEmpty(_remaining)) {
|
|
230
|
+
const hasNoHeader = R.isEmpty(_layout.header);
|
|
231
|
+
const firstRemaining = R.head(_remaining);
|
|
232
|
+
_remaining = hasNoHeader ? R.tail(_remaining) : _remaining;
|
|
233
|
+
_layout = {
|
|
234
|
+
..._layout,
|
|
235
|
+
sections: R.concat(_layout.sections, _remaining),
|
|
236
|
+
header: hasNoHeader ? [firstRemaining] : _layout.header,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return _layout;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const getTableLayoutIds = (
|
|
243
|
+
defaultLayoutIds,
|
|
244
|
+
currentLayoutIds,
|
|
245
|
+
dimensions,
|
|
246
|
+
attributes,
|
|
247
|
+
combinations
|
|
248
|
+
) => {
|
|
249
|
+
const layoutDimsIds = getLayoutDimsIds(dimensions);
|
|
250
|
+
const layoutCombinations = getLayoutCombinations(
|
|
251
|
+
combinations,
|
|
252
|
+
layoutDimsIds,
|
|
253
|
+
attributes,
|
|
254
|
+
);
|
|
255
|
+
const isBlank = R.pipe(R.values, R.all(R.isEmpty))(currentLayoutIds);
|
|
256
|
+
|
|
257
|
+
const combinationsConcepts = R.pipe(R.pluck('_concepts'), R.unnest, ids => new Set(ids))(combinations);
|
|
258
|
+
const obsAttributes = R.filter(a =>
|
|
259
|
+
a.series && R.isEmpty(a.relationship || []) && a.display && !combinationsConcepts.has(a)
|
|
260
|
+
, attributes);
|
|
261
|
+
const indexedCombinations = R.indexBy(R.prop('id'), layoutCombinations);
|
|
262
|
+
const filteredLayoutIds = filterLayoutIds(indexedCombinations, layoutDimsIds, obsAttributes)
|
|
263
|
+
(isBlank ? defaultLayoutIds : currentLayoutIds);
|
|
264
|
+
|
|
265
|
+
const layoutWithCombs = injectCombinationsInLayout(layoutCombinations, filteredLayoutIds, defaultLayoutIds);
|
|
266
|
+
const layoutRelationshipsSets = R.map(R.pipe(
|
|
267
|
+
ids => R.pick(ids, indexedCombinations),
|
|
268
|
+
R.values,
|
|
269
|
+
R.pluck('relationship'),
|
|
270
|
+
R.unnest,
|
|
271
|
+
i => new Set(i)
|
|
272
|
+
), layoutWithCombs);
|
|
273
|
+
const layoutConceptsSets = R.pipe(
|
|
274
|
+
R.map(
|
|
275
|
+
R.reduce((acc, id) => {
|
|
276
|
+
if (R.has(id, indexedCombinations)) {
|
|
277
|
+
return R.concat(acc, R.path([id, 'concepts'], indexedCombinations));
|
|
278
|
+
}
|
|
279
|
+
return R.append(id, acc);
|
|
280
|
+
}, []),
|
|
281
|
+
),
|
|
282
|
+
R.values,
|
|
283
|
+
R.unnest,
|
|
284
|
+
ids => new Set(ids)
|
|
285
|
+
)(layoutWithCombs);
|
|
286
|
+
const defaultLayoutConceptsSets = R.map(
|
|
287
|
+
ids => new Set(ids),
|
|
288
|
+
defaultLayoutIds
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const { nextLayout, remaining } = R.reduce((acc, dim) => {
|
|
292
|
+
if (layoutConceptsSets.has(dim.id) || dim.header) {
|
|
293
|
+
return acc;
|
|
294
|
+
}
|
|
295
|
+
if (layoutRelationshipsSets.header.has(dim.id) || defaultLayoutConceptsSets.header.has(dim.id)) {
|
|
296
|
+
return R.over(R.lensPath(['nextLayout', 'header']), R.append(dim.id))(acc);
|
|
297
|
+
}
|
|
298
|
+
if (layoutRelationshipsSets.sections.has(dim.id) || defaultLayoutConceptsSets.sections.has(dim.id)) {
|
|
299
|
+
return R.over(R.lensPath(['nextLayout', 'sections']), R.append(dim.id))(acc);
|
|
300
|
+
}
|
|
301
|
+
if (layoutRelationshipsSets.rows.has(dim.id) || defaultLayoutConceptsSets.rows.has(dim.id)) {
|
|
302
|
+
return R.over(R.lensPath(['nextLayout','rows']), R.append(dim.id))(acc);
|
|
303
|
+
}
|
|
304
|
+
if (isTimePeriodDimension(dim)) {
|
|
305
|
+
return R.over(R.lensPath(['nextLayout','header']), R.append(dim.id))(acc);
|
|
306
|
+
}
|
|
307
|
+
if (isRefAreaDimension(dim)) {
|
|
308
|
+
return R.over(R.lensPath(['nextLayout','rows']), R.append(dim.id))(acc);
|
|
309
|
+
}
|
|
310
|
+
return R.over(R.lensProp('remaining'), R.append(dim.id))(acc);
|
|
311
|
+
}, { nextLayout: layoutWithCombs, remaining: [] }, dimensions);
|
|
312
|
+
|
|
313
|
+
return injectRemainingDimensionsInLayout(nextLayout, remaining, indexedCombinations, layoutDimsIds);
|
|
314
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
import { declineObservationsOverAttributes } from './declineObservationsOverAttributes';
|
|
3
|
+
import { getLayout } from './getLayout';
|
|
4
|
+
import { getSortedLayoutIndexes } from './getSortedLayoutIndexes';
|
|
5
|
+
import { parseLayoutIndexesHierarchies } from './parseSeriesIndexesHierarchies';
|
|
6
|
+
import { refineLayoutSize } from './refineLayoutSize2';
|
|
7
|
+
import { getLayoutData } from './getLayoutData2';
|
|
8
|
+
import { getCellsAttributesIds } from './getCellsAttributesIds';
|
|
9
|
+
import { getIndexedCombinationsByDisplay } from './getIndexedCombinationsByDisplay';
|
|
10
|
+
import { getCells } from './getCells';
|
|
11
|
+
import { getCuratedCells } from './getCuratedCells';
|
|
12
|
+
import { getSeriesCombinations } from '../getSeriesCombinations';
|
|
13
|
+
import { getCellsMetadataCoordinates } from './getCellsMetadataCoordinates';
|
|
14
|
+
|
|
15
|
+
export const getTableProps = ({ data, layoutIds, customAttributes, limit, isTimeInverted }) => {
|
|
16
|
+
const {
|
|
17
|
+
observations,
|
|
18
|
+
dimensions,
|
|
19
|
+
combinations,
|
|
20
|
+
oneValueDimensions,
|
|
21
|
+
attributesSeries,
|
|
22
|
+
metadataCoordinates,
|
|
23
|
+
attributes,
|
|
24
|
+
header,
|
|
25
|
+
rejectedDimensions=[]
|
|
26
|
+
} = data;
|
|
27
|
+
|
|
28
|
+
const obsAttributes = R.filter(
|
|
29
|
+
a => a.series && R.isEmpty(a.relationship) && a.display && !a.combined,
|
|
30
|
+
attributes
|
|
31
|
+
);
|
|
32
|
+
let dupObs = observations;
|
|
33
|
+
const hasDuplicatedCells = R.pipe(
|
|
34
|
+
R.values,
|
|
35
|
+
R.unnest,
|
|
36
|
+
R.find(R.equals('OBS_ATTRIBUTES')),
|
|
37
|
+
)(layoutIds);
|
|
38
|
+
if (hasDuplicatedCells) {
|
|
39
|
+
const attrsIds = R.pluck('id', obsAttributes);
|
|
40
|
+
dupObs = declineObservationsOverAttributes(attrsIds, observations);
|
|
41
|
+
}
|
|
42
|
+
const seriesCombinations = getSeriesCombinations(combinations, oneValueDimensions);
|
|
43
|
+
const _dims = R.append(
|
|
44
|
+
{
|
|
45
|
+
id: 'OBS_ATTRIBUTES',
|
|
46
|
+
values: R.prepend({ id: 'OBS_VALUE' }, obsAttributes),
|
|
47
|
+
},
|
|
48
|
+
dimensions,
|
|
49
|
+
);
|
|
50
|
+
const layout = getLayout(layoutIds, _dims, seriesCombinations, isTimeInverted);
|
|
51
|
+
const layoutDimsIds = R.map(R.reduce((acc, entry) => {
|
|
52
|
+
if (R.has('dimensions', entry)) {
|
|
53
|
+
return R.concat(acc, R.pluck('id', entry.dimensions));
|
|
54
|
+
}
|
|
55
|
+
return R.append(entry.id, acc);
|
|
56
|
+
}, []), layout);
|
|
57
|
+
const layoutIndexes = getSortedLayoutIndexes(layout, dupObs, rejectedDimensions);
|
|
58
|
+
const enhancedLayoutIndexes = parseLayoutIndexesHierarchies(
|
|
59
|
+
layoutIndexes,
|
|
60
|
+
layout,
|
|
61
|
+
);
|
|
62
|
+
const refinedLayoutIndexes = refineLayoutSize({ layout, observations: dupObs, limit })(enhancedLayoutIndexes);
|
|
63
|
+
const layoutData = getLayoutData(refinedLayoutIndexes, layout, {
|
|
64
|
+
metadataCoordinates,
|
|
65
|
+
attributesSeries,
|
|
66
|
+
customAttributes,
|
|
67
|
+
topCoordinates: header.coordinates,
|
|
68
|
+
rejectedDimensions
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const cellsAttributesIds = getCellsAttributesIds(layoutDimsIds, attributes);
|
|
72
|
+
const indexedCombinations = getIndexedCombinationsByDisplay(layout, seriesCombinations);
|
|
73
|
+
const cellsMetadataCoordinates = getCellsMetadataCoordinates(metadataCoordinates, oneValueDimensions, layoutDimsIds);
|
|
74
|
+
const cells = getCells(customAttributes, cellsAttributesIds, indexedCombinations, attributesSeries, cellsMetadataCoordinates)(dupObs);
|
|
75
|
+
|
|
76
|
+
return ({
|
|
77
|
+
...layoutData,
|
|
78
|
+
cells: getCuratedCells(cells, layout),
|
|
79
|
+
layout,
|
|
80
|
+
combinations: seriesCombinations
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
const registerParsedIndexes = ({ isSameSerie, ...parsed }, register) => {
|
|
4
|
+
const merged = R.mergeWith((a, b) => R.append(a || [], b), parsed, register);
|
|
5
|
+
return ({ ...merged, isSameSerie });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const parseParentsIndexesWithPrevious = (parentsIndexes, previousParentsIndexes) => {
|
|
9
|
+
const previousParentsSet = new Set(previousParentsIndexes);
|
|
10
|
+
const lastParentIndexInPrevious = R.findLastIndex(i => previousParentsSet.has(i), parentsIndexes);
|
|
11
|
+
const [rawPresentParentsIndexes, missingParentsIndexes] = lastParentIndexInPrevious !== -1
|
|
12
|
+
? R.splitAt(lastParentIndexInPrevious + 1, parentsIndexes)
|
|
13
|
+
: [[], parentsIndexes];
|
|
14
|
+
const presentParentsIndexes = R.filter(i => previousParentsSet.has(i), rawPresentParentsIndexes);
|
|
15
|
+
return ({ presentParentsIndexes, missingParentsIndexes });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const parseSerieIndexesHierarchies = (serieIndexes, previousSerie, dimensions, isSameSerie, replicate) => {
|
|
19
|
+
return R.addIndex(R.reduce)((acc, _valueIndex, dimensionIndex) => {
|
|
20
|
+
if (R.is(Array, _valueIndex)) {
|
|
21
|
+
const previous = R.isEmpty(previousSerie) ? {} : R.map(R.nth(dimensionIndex), previousSerie);
|
|
22
|
+
const parsed = parseSerieIndexesHierarchies(
|
|
23
|
+
_valueIndex,
|
|
24
|
+
previous,
|
|
25
|
+
R.pathOr([], [dimensionIndex, 'dimensions'], dimensions),
|
|
26
|
+
acc.isSameSerie,
|
|
27
|
+
replicate
|
|
28
|
+
);
|
|
29
|
+
return registerParsedIndexes(parsed, acc);
|
|
30
|
+
}
|
|
31
|
+
const valueIndex = Math.abs(_valueIndex);
|
|
32
|
+
const parents = R.pathOr([], [dimensionIndex, 'values', valueIndex, 'parents'], dimensions);
|
|
33
|
+
const previousIndex = R.pipe(R.path(['indexes', dimensionIndex]), i => R.isNil(i) ? -1 : Math.abs(i))(previousSerie)
|
|
34
|
+
const previousParentsIndexes = acc.isSameSerie
|
|
35
|
+
? R.pipe(R.pathOr([], ['parentsIndexes', dimensionIndex]), R.append(previousIndex))(previousSerie) : [];
|
|
36
|
+
const previousMissingIndexes = acc.isSameSerie
|
|
37
|
+
? R.pathOr([], ['missingIndexes', dimensionIndex], previousSerie) : [];
|
|
38
|
+
/*
|
|
39
|
+
if replicate = true (sections), missing parents insdexes are replicated on each brother nodes not just the first (as empty lines)
|
|
40
|
+
thats why passing previous missing as previous parents in case replicate = false
|
|
41
|
+
*/
|
|
42
|
+
const { presentParentsIndexes, missingParentsIndexes } = parseParentsIndexesWithPrevious(
|
|
43
|
+
parents,
|
|
44
|
+
replicate ? previousParentsIndexes : R.concat(previousParentsIndexes, previousMissingIndexes),
|
|
45
|
+
);
|
|
46
|
+
return registerParsedIndexes({
|
|
47
|
+
parentsIndexes: presentParentsIndexes,
|
|
48
|
+
missingIndexes: missingParentsIndexes,
|
|
49
|
+
isSameSerie: acc.isSameSerie && valueIndex === previousIndex
|
|
50
|
+
}, acc);
|
|
51
|
+
}, { parentsIndexes: [], missingIndexes: [], isSameSerie }, serieIndexes);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const parseSeriesIndexesHierarchies = (seriesIndexes, dimensions, replicateMissing = false) => {
|
|
55
|
+
return R.reduce((acc, { indexes, ...rest }) => {
|
|
56
|
+
const previousSerie = R.last(acc) || {};
|
|
57
|
+
const { isSameSerie, ...parsed } = parseSerieIndexesHierarchies(indexes, previousSerie, dimensions, true, replicateMissing);
|
|
58
|
+
return R.append({ indexes, ...parsed, ...rest }, acc);
|
|
59
|
+
}, [], seriesIndexes);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const parseLayoutIndexesHierarchies = (layoutIndexes, layout) => {
|
|
63
|
+
const header = parseSeriesIndexesHierarchies(layoutIndexes.header, layout.header);
|
|
64
|
+
const sections = R.pipe(
|
|
65
|
+
R.transpose,
|
|
66
|
+
([_sections, _sectionsRows]) => {
|
|
67
|
+
if (R.isNil(_sections)) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
// replicate = true on sections
|
|
71
|
+
const sections = parseSeriesIndexesHierarchies(_sections, layout.sections, true);
|
|
72
|
+
const sectionsRows = R.map(rows => parseSeriesIndexesHierarchies(rows, layout.rows), _sectionsRows);
|
|
73
|
+
return R.transpose([sections, sectionsRows]);
|
|
74
|
+
}
|
|
75
|
+
)(layoutIndexes.sections);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
return ({ header, sections });
|
|
79
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as R from 'ramda';
|
|
2
|
+
|
|
3
|
+
export const isSameValueAsPrevious = (value, previousValue) => {
|
|
4
|
+
const valueHierarchicalPath = R.append(value.id, R.propOr([], 'parents', value));
|
|
5
|
+
const previousValueHierarchicalPath = R.append(previousValue.id, R.propOr([], 'parents', previousValue));
|
|
6
|
+
|
|
7
|
+
return R.equals(valueHierarchicalPath, previousValueHierarchicalPath);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const parseValueHierarchy = (value, previousValue, indexedValues) => {
|
|
11
|
+
const parentsIds = R.propOr([], 'parents', value);
|
|
12
|
+
if (R.isEmpty(parentsIds)) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
const _previousParentsIds = R.propOr([], 'parentsIds', previousValue);
|
|
16
|
+
const previousParentsIds = R.isNil(previousValue) ? [] : R.append(R.prop('id', previousValue), _previousParentsIds);
|
|
17
|
+
const [presentIds, _missingIds] = R.addIndex(R.splitWhen)((val, ind) => R.nth(ind, previousParentsIds) !== val, parentsIds);
|
|
18
|
+
const __previousParentsIds = R.pipe(R.propOr([], 'parents'), R.pluck('id'))(previousValue);
|
|
19
|
+
const missingIds = R.pipe(
|
|
20
|
+
R.takeLastWhile(id => !R.includes(id, __previousParentsIds) && id !== R.prop('id', previousValue)),
|
|
21
|
+
ids => R.concat(ids, _missingIds)
|
|
22
|
+
)(presentIds);
|
|
23
|
+
const _previousParents = R.propOr([], 'parents', previousValue);
|
|
24
|
+
const previousParents = R.isNil(previousValue) ? [] : R.append(R.pick(['id', 'name'], previousValue), _previousParents);
|
|
25
|
+
const parents = R.takeWhile(p => R.includes(p.id, presentIds), previousParents);
|
|
26
|
+
const missingParents = R.props(missingIds, indexedValues);
|
|
27
|
+
return ({
|
|
28
|
+
...value,
|
|
29
|
+
parents,
|
|
30
|
+
parentsIds,
|
|
31
|
+
missingParents
|
|
32
|
+
});
|
|
33
|
+
};
|