@hisptz/dhis2-analytics 2.0.32 → 2.0.33
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/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -1
- package/dist/components/Scorecard/Scorecard.stories.js +150 -879
- package/dist/components/Scorecard/Scorecard.stories.js.map +1 -1
- package/dist/components/Scorecard/ScorecardContext.stories.js +422 -0
- package/dist/components/Scorecard/ScorecardContext.stories.js.map +1 -0
- package/dist/components/Scorecard/components/DataProvider.js +4 -19
- package/dist/components/Scorecard/components/DataProvider.js.map +1 -1
- package/dist/components/Scorecard/components/LoadingIndicator.js +27 -0
- package/dist/components/Scorecard/components/LoadingIndicator.js.map +1 -0
- package/dist/components/Scorecard/components/MetaProvider.js +10 -2
- package/dist/components/Scorecard/components/MetaProvider.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardContext.js +52 -1
- package/dist/components/Scorecard/components/ScorecardContext.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/ScorecardTable.js +33 -14
- package/dist/components/Scorecard/components/ScorecardTable/ScorecardTable.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css +18 -0
- package/dist/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/AverageCell.js +47 -14
- package/dist/components/Scorecard/components/ScorecardTable/components/AverageCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.js +39 -8
- package/dist/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/CellLoader.js +12 -0
- package/dist/components/Scorecard/components/ScorecardTable/components/CellLoader.js.map +1 -0
- package/dist/components/Scorecard/components/ScorecardTable/components/DataContainer.js +24 -4
- package/dist/components/Scorecard/components/ScorecardTable/components/DataContainer.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/DataFooterCell.js +125 -32
- package/dist/components/Scorecard/components/ScorecardTable/components/DataFooterCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/DataRow.js +17 -7
- package/dist/components/Scorecard/components/ScorecardTable/components/DataRow.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/DataValue.js +8 -5
- package/dist/components/Scorecard/components/ScorecardTable/components/DataValue.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.js +16 -3
- package/dist/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/LinkedCell.js +8 -2
- package/dist/components/Scorecard/components/ScorecardTable/components/LinkedCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/LinkedDataCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.js +5 -3
- package/dist/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/SingleDataCell.js +2 -2
- package/dist/components/Scorecard/components/ScorecardTable/components/SingleDataCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableBody.js +8 -3
- package/dist/components/Scorecard/components/ScorecardTable/components/TableBody.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableFoot.js +8 -5
- package/dist/components/Scorecard/components/ScorecardTable/components/TableFoot.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.js +7 -8
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.js +6 -8
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.js +13 -4
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/FilterArea.js +4 -2
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/FilterArea.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/LabelCell.js +4 -2
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/LabelCell.js.map +1 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/MetaHeaderCell.js +6 -7
- package/dist/components/Scorecard/components/ScorecardTable/components/TableHeader/components/MetaHeaderCell.js.map +1 -1
- package/dist/components/Scorecard/components/StateProvider.js +8 -0
- package/dist/components/Scorecard/components/StateProvider.js.map +1 -1
- package/dist/components/Scorecard/hooks/cellData.js +3 -4
- package/dist/components/Scorecard/hooks/cellData.js.map +1 -1
- package/dist/components/Scorecard/hooks/columns.js +106 -89
- package/dist/components/Scorecard/hooks/columns.js.map +1 -1
- package/dist/components/Scorecard/hooks/data.js +126 -31
- package/dist/components/Scorecard/hooks/data.js.map +1 -1
- package/dist/components/Scorecard/hooks/metadata.js +23 -13
- package/dist/components/Scorecard/hooks/metadata.js.map +1 -1
- package/dist/components/Scorecard/hooks/table.js +137 -5
- package/dist/components/Scorecard/hooks/table.js.map +1 -1
- package/dist/components/Scorecard/hooks/value.js +198 -0
- package/dist/components/Scorecard/hooks/value.js.map +1 -0
- package/dist/components/Scorecard/schemas/config.js +27 -12
- package/dist/components/Scorecard/schemas/config.js.map +1 -1
- package/dist/components/Scorecard/utils/analytics.js +4 -3
- package/dist/components/Scorecard/utils/analytics.js.map +1 -1
- package/dist/components/Scorecard/utils/columns.js +66 -104
- package/dist/components/Scorecard/utils/columns.js.map +1 -1
- package/dist/components/Scorecard/utils/data.js +10 -100
- package/dist/components/Scorecard/utils/data.js.map +1 -1
- package/dist/components/Scorecard/utils/dataEngine.js +35 -0
- package/dist/components/Scorecard/utils/dataEngine.js.map +1 -0
- package/dist/esm/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js.map +1 -1
- package/dist/esm/components/Scorecard/Scorecard.stories.js +148 -876
- package/dist/esm/components/Scorecard/Scorecard.stories.js.map +1 -1
- package/dist/esm/components/Scorecard/ScorecardContext.stories.js +417 -0
- package/dist/esm/components/Scorecard/ScorecardContext.stories.js.map +1 -0
- package/dist/esm/components/Scorecard/components/DataProvider.js +4 -19
- package/dist/esm/components/Scorecard/components/DataProvider.js.map +1 -1
- package/dist/esm/components/Scorecard/components/LoadingIndicator.js +25 -0
- package/dist/esm/components/Scorecard/components/LoadingIndicator.js.map +1 -0
- package/dist/esm/components/Scorecard/components/MetaProvider.js +6 -2
- package/dist/esm/components/Scorecard/components/MetaProvider.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardContext.js +49 -2
- package/dist/esm/components/Scorecard/components/ScorecardContext.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/ScorecardTable.js +34 -15
- package/dist/esm/components/Scorecard/components/ScorecardTable/ScorecardTable.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css +18 -0
- package/dist/esm/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/AverageCell.js +47 -14
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/AverageCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.js +40 -9
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/CellLoader.js +10 -0
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/CellLoader.js.map +1 -0
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataContainer.js +25 -5
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataContainer.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataFooterCell.js +127 -34
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataFooterCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataRow.js +18 -8
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataRow.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataValue.js +10 -7
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/DataValue.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.js +16 -3
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/LinkedCell.js +8 -2
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/LinkedCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/LinkedDataCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.js +6 -4
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/SingleDataCell.js +2 -2
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/SingleDataCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableBody.js +9 -4
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableBody.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableFoot.js +9 -6
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableFoot.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.js +7 -8
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.js +7 -9
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.js +14 -6
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/FilterArea.js +5 -3
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/FilterArea.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/LabelCell.js +5 -3
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/LabelCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/MetaHeaderCell.js +7 -8
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/TableHeader/components/MetaHeaderCell.js.map +1 -1
- package/dist/esm/components/Scorecard/components/StateProvider.js +9 -2
- package/dist/esm/components/Scorecard/components/StateProvider.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/cellData.js +1 -2
- package/dist/esm/components/Scorecard/hooks/cellData.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/columns.js +107 -90
- package/dist/esm/components/Scorecard/hooks/columns.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/data.js +130 -35
- package/dist/esm/components/Scorecard/hooks/data.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/metadata.js +24 -14
- package/dist/esm/components/Scorecard/hooks/metadata.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/table.js +138 -6
- package/dist/esm/components/Scorecard/hooks/table.js.map +1 -1
- package/dist/esm/components/Scorecard/hooks/value.js +194 -0
- package/dist/esm/components/Scorecard/hooks/value.js.map +1 -0
- package/dist/esm/components/Scorecard/schemas/config.js +24 -12
- package/dist/esm/components/Scorecard/schemas/config.js.map +1 -1
- package/dist/esm/components/Scorecard/utils/analytics.js +4 -3
- package/dist/esm/components/Scorecard/utils/analytics.js.map +1 -1
- package/dist/esm/components/Scorecard/utils/columns.js +67 -106
- package/dist/esm/components/Scorecard/utils/columns.js.map +1 -1
- package/dist/esm/components/Scorecard/utils/data.js +11 -101
- package/dist/esm/components/Scorecard/utils/data.js.map +1 -1
- package/dist/esm/components/Scorecard/utils/dataEngine.js +33 -0
- package/dist/esm/components/Scorecard/utils/dataEngine.js.map +1 -0
- package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +1 -1
- package/dist/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/DataProvider.d.ts +3 -3
- package/dist/types/components/Scorecard/components/DataProvider.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/LoadingIndicator.d.ts +2 -0
- package/dist/types/components/Scorecard/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/types/components/Scorecard/components/MetaProvider.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardContext.d.ts +1 -1
- package/dist/types/components/Scorecard/components/ScorecardContext.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/ScorecardTable.d.ts +2 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/ScorecardTable.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/AverageCell.d.ts +4 -13
- package/dist/types/components/Scorecard/components/ScorecardTable/components/AverageCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/CellLoader.d.ts +2 -0
- package/dist/types/components/Scorecard/components/ScorecardTable/components/CellLoader.d.ts.map +1 -0
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataContainer.d.ts +2 -2
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataContainer.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataFooterCell.d.ts +2 -2
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataFooterCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataRow.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataValue.d.ts +6 -5
- package/dist/types/components/Scorecard/components/ScorecardTable/components/DataValue.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.d.ts +2 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/ExpandedScorecardTable.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedCell.d.ts +3 -3
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedDataCell.d.ts +2 -2
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedDataCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.d.ts +1 -3
- package/dist/types/components/Scorecard/components/ScorecardTable/components/MetaFooterCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/SingleDataCell.d.ts +2 -2
- package/dist/types/components/Scorecard/components/ScorecardTable/components/SingleDataCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableBody.d.ts +2 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableBody.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableFoot.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.d.ts +2 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/TableHeader.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.d.ts +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/AverageHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.d.ts +1 -0
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/DataHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/FilterArea.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/LabelCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/TableHeader/components/MetaHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/StateProvider.d.ts +1 -0
- package/dist/types/components/Scorecard/components/StateProvider.d.ts.map +1 -1
- package/dist/types/components/Scorecard/components/TableStateProvider.d.ts +0 -6
- package/dist/types/components/Scorecard/components/TableStateProvider.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/cellData.d.ts +2 -2
- package/dist/types/components/Scorecard/hooks/cellData.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/columns.d.ts +2 -8
- package/dist/types/components/Scorecard/hooks/columns.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/data.d.ts +11 -53
- package/dist/types/components/Scorecard/hooks/data.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/metadata.d.ts +1 -0
- package/dist/types/components/Scorecard/hooks/metadata.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/table.d.ts.map +1 -1
- package/dist/types/components/Scorecard/hooks/value.d.ts +87 -0
- package/dist/types/components/Scorecard/hooks/value.d.ts.map +1 -0
- package/dist/types/components/Scorecard/schemas/config.d.ts +666 -62
- package/dist/types/components/Scorecard/schemas/config.d.ts.map +1 -1
- package/dist/types/components/Scorecard/utils/analytics.d.ts +3 -2
- package/dist/types/components/Scorecard/utils/analytics.d.ts.map +1 -1
- package/dist/types/components/Scorecard/utils/columns.d.ts +19 -59
- package/dist/types/components/Scorecard/utils/columns.d.ts.map +1 -1
- package/dist/types/components/Scorecard/utils/data.d.ts +6 -4
- package/dist/types/components/Scorecard/utils/data.d.ts.map +1 -1
- package/dist/types/components/Scorecard/utils/dataEngine.d.ts +14 -0
- package/dist/types/components/Scorecard/utils/dataEngine.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.js +0 -45
- package/dist/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.js.map +0 -1
- package/dist/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.js +0 -38
- package/dist/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.js.map +0 -1
- package/dist/components/Scorecard/hooks/average.js +0 -50
- package/dist/components/Scorecard/hooks/average.js.map +0 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.js +0 -43
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.js.map +0 -1
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.js +0 -36
- package/dist/esm/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.js.map +0 -1
- package/dist/esm/components/Scorecard/hooks/average.js +0 -48
- package/dist/esm/components/Scorecard/hooks/average.js.map +0 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.d.ts +0 -6
- package/dist/types/components/Scorecard/components/ScorecardTable/components/LinkedDataFooterCell.d.ts.map +0 -1
- package/dist/types/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.d.ts +0 -6
- package/dist/types/components/Scorecard/components/ScorecardTable/components/SingleDataFooterCell.d.ts.map +0 -1
- package/dist/types/components/Scorecard/hooks/average.d.ts +0 -14
- package/dist/types/components/Scorecard/hooks/average.d.ts.map +0 -1
|
@@ -4,13 +4,64 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var ConfigProvider = require('./ConfigProvider');
|
|
5
5
|
var StateProvider = require('./StateProvider');
|
|
6
6
|
var MetaProvider = require('./MetaProvider');
|
|
7
|
+
var reactErrorBoundary = require('react-error-boundary');
|
|
8
|
+
var ui = require('@dhis2/ui');
|
|
9
|
+
var i18n = require('@dhis2/d2-i18n');
|
|
7
10
|
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var i18n__default = /*#__PURE__*/_interopDefault(i18n);
|
|
14
|
+
|
|
15
|
+
function ErrorFallback({
|
|
16
|
+
error,
|
|
17
|
+
resetErrorBoundary,
|
|
18
|
+
height
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
style: {
|
|
24
|
+
width: "100%",
|
|
25
|
+
textAlign: "center",
|
|
26
|
+
height: height ?? 500,
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
gap: 16,
|
|
32
|
+
padding: 16
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.IconError24, {}),
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
"h3",
|
|
38
|
+
{
|
|
39
|
+
style: {
|
|
40
|
+
color: ui.colors.grey800,
|
|
41
|
+
margin: 0
|
|
42
|
+
},
|
|
43
|
+
children: i18n__default.default.t("Could not load visualization")
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0 }, children: error.message }),
|
|
47
|
+
resetErrorBoundary && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: resetErrorBoundary, small: true, children: i18n__default.default.t("Try again") })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
8
52
|
function ScorecardContext({
|
|
9
53
|
config,
|
|
10
54
|
children,
|
|
11
55
|
initialState
|
|
12
56
|
}) {
|
|
13
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
reactErrorBoundary.ErrorBoundary,
|
|
59
|
+
{
|
|
60
|
+
resetKeys: [config, initialState],
|
|
61
|
+
FallbackComponent: ErrorFallback,
|
|
62
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider.ScorecardConfigProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(StateProvider.ScorecardStateProvider, { initialState, children: /* @__PURE__ */ jsxRuntime.jsx(MetaProvider.ScorecardMetaProvider, { children }) }) })
|
|
63
|
+
}
|
|
64
|
+
);
|
|
14
65
|
}
|
|
15
66
|
|
|
16
67
|
exports.ScorecardContext = ScorecardContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Scorecard/components/ScorecardContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Scorecard/components/ScorecardContext.tsx"],"names":[],"mappings":"AAqBE,SAaC,KAbD;AArBF,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AAGtC,SAAS,qBAAoC;AAC7C,SAAS,QAAQ,QAAQ,mBAAmB;AAC5C,OAAO,UAAU;AAQjB,SAAS,cAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACD,GAAwC;AACvC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAO;AAAA,QACN,OAAO;AAAA,QACP,WAAW;AAAA,QACX,QAAQ,UAAU;AAAA,QAClB,SAAS;AAAA,QACT,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,KAAK;AAAA,QACL,SAAS;AAAA,MACV;AAAA,MAEA;AAAA,4BAAC,eAAY;AAAA,QACb;AAAA,UAAC;AAAA;AAAA,YACA,OAAO;AAAA,cACN,OAAO,OAAO;AAAA,cACd,QAAQ;AAAA,YACT;AAAA,YAEC,eAAK,EAAE,8BAA8B;AAAA;AAAA,QACvC;AAAA,QACA,oBAAC,OAAE,OAAO,EAAE,QAAQ,EAAE,GAAI,gBAAM,SAAQ;AAAA,QACvC,sBACA,oBAAC,UAAO,SAAS,oBAAoB,OAAK,MACxC,eAAK,EAAE,WAAW,GACpB;AAAA;AAAA;AAAA,EAEF;AAEF;AAEO,SAAS,iBAAiB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACD,GAA0B;AACzB,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAW,CAAC,QAAQ,YAAY;AAAA,MAChC,mBAAmB;AAAA,MAEnB,8BAAC,2BAAwB,QACxB,8BAAC,0BAAuB,cACvB,8BAAC,yBAAuB,UAAS,GAClC,GACD;AAAA;AAAA,EACD;AAEF","sourcesContent":["import { ScorecardConfigProvider } from \"./ConfigProvider\";\nimport { ScorecardStateProvider } from \"./StateProvider\";\nimport { ScorecardMetaProvider } from \"./MetaProvider\";\nimport React, { type ReactNode } from \"react\";\nimport type { ScorecardConfig, ScorecardState } from \"../schemas/config\";\nimport { ErrorBoundary, FallbackProps } from \"react-error-boundary\";\nimport { Button, colors, IconError24 } from \"@dhis2/ui\";\nimport i18n from \"@dhis2/d2-i18n\";\n\ninterface ScorecardContextProps {\n\tchildren: ReactNode;\n\tconfig: ScorecardConfig;\n\tinitialState?: ScorecardState;\n}\n\nfunction ErrorFallback({\n\terror,\n\tresetErrorBoundary,\n\theight,\n}: FallbackProps & { height?: number }) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\twidth: \"100%\",\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\theight: height ?? 500,\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\tgap: 16,\n\t\t\t\tpadding: 16,\n\t\t\t}}\n\t\t>\n\t\t\t<IconError24 />\n\t\t\t<h3\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: colors.grey800,\n\t\t\t\t\tmargin: 0,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{i18n.t(\"Could not load visualization\")}\n\t\t\t</h3>\n\t\t\t<p style={{ margin: 0 }}>{error.message}</p>\n\t\t\t{resetErrorBoundary && (\n\t\t\t\t<Button onClick={resetErrorBoundary} small>\n\t\t\t\t\t{i18n.t(\"Try again\")}\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport function ScorecardContext({\n\tconfig,\n\tchildren,\n\tinitialState,\n}: ScorecardContextProps) {\n\treturn (\n\t\t<ErrorBoundary\n\t\t\tresetKeys={[config, initialState]}\n\t\t\tFallbackComponent={ErrorFallback}\n\t\t>\n\t\t\t<ScorecardConfigProvider config={config}>\n\t\t\t\t<ScorecardStateProvider initialState={initialState}>\n\t\t\t\t\t<ScorecardMetaProvider>{children}</ScorecardMetaProvider>\n\t\t\t\t</ScorecardStateProvider>\n\t\t\t</ScorecardConfigProvider>\n\t\t</ErrorBoundary>\n\t);\n}\n"]}
|
|
@@ -7,26 +7,45 @@ var TableBody = require('./components/TableBody');
|
|
|
7
7
|
var TableFoot = require('./components/TableFoot');
|
|
8
8
|
var core = require('@dnd-kit/core');
|
|
9
9
|
var StateProvider = require('../StateProvider');
|
|
10
|
+
var react = require('react');
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
const ScorecardTable = react.memo(function TableComponent(props) {
|
|
13
|
+
const [isPending, startTransition] = react.useTransition();
|
|
12
14
|
const updateState = StateProvider.useScorecardSetState();
|
|
15
|
+
if (isPending) {
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
style: {
|
|
20
|
+
height: "100%",
|
|
21
|
+
width: "100%",
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center"
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.CircularLoader, { small: true })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
13
30
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
31
|
core.DndContext,
|
|
15
32
|
{
|
|
16
33
|
onDragEnd: (event) => {
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
startTransition(() => {
|
|
35
|
+
if (updateState) {
|
|
36
|
+
if (!event.over || event.over.id === event.active.id) {
|
|
37
|
+
updateState((prevState) => {
|
|
38
|
+
return {
|
|
39
|
+
...prevState,
|
|
40
|
+
options: {
|
|
41
|
+
...prevState.options,
|
|
42
|
+
showDataInRows: !prevState.options.showDataInRows
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
28
47
|
}
|
|
29
|
-
}
|
|
48
|
+
});
|
|
30
49
|
},
|
|
31
50
|
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.DataTable, { ...props, layout: "auto", children: [
|
|
32
51
|
/* @__PURE__ */ jsxRuntime.jsx(TableHeader.TableHeader, {}),
|
|
@@ -35,7 +54,7 @@ function ScorecardTable(props) {
|
|
|
35
54
|
] })
|
|
36
55
|
}
|
|
37
56
|
);
|
|
38
|
-
}
|
|
57
|
+
});
|
|
39
58
|
|
|
40
59
|
exports.ScorecardTable = ScorecardTable;
|
|
41
60
|
//# sourceMappingURL=out.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Scorecard/components/ScorecardTable/ScorecardTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Scorecard/components/ScorecardTable/ScorecardTable.tsx"],"names":[],"mappings":"AA2BI,cA0BD,YA1BC;AA3BJ,SAAS,gBAAgB,iBAAsC;AAC/D,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,MAAM,qBAAqB;AAI7B,MAAM,iBAAiB,KAAK,SAAS,eAC3C,OACC;AACD,QAAM,CAAC,WAAW,eAAe,IAAI,cAAc;AACnD,QAAM,cAAc,qBAAqB;AAEzC,MAAI,WAAW;AACd,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAO;AAAA,UACN,QAAQ;AAAA,UACR,OAAO;AAAA,UACP,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,gBAAgB;AAAA,QACjB;AAAA,QAEA,8BAAC,kBAAe,OAAK,MAAC;AAAA;AAAA,IACvB;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAW,CAAC,UAAU;AACrB,wBAAgB,MAAM;AACrB,cAAI,aAAa;AAChB,gBAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,MAAM,OAAO,IAAI;AACrD,0BAAY,CAAC,cAAc;AAC1B,uBAAO;AAAA,kBACN,GAAG;AAAA,kBACH,SAAS;AAAA,oBACR,GAAG,UAAU;AAAA,oBACb,gBACC,CAAC,UAAU,QAAQ;AAAA,kBACrB;AAAA,gBACD;AAAA,cACD,CAAC;AAAA,YACF;AAAA,UACD;AAAA,QACD,CAAC;AAAA,MACF;AAAA,MAEA,+BAAC,aAAW,GAAG,OAAO,QAAO,QAC5B;AAAA,4BAAC,eAAY;AAAA,QACb,oBAAC,aAAU;AAAA,QACX,oBAAC,aAAU;AAAA,SACZ;AAAA;AAAA,EACD;AAEF,CAAC","sourcesContent":["import { CircularLoader, DataTable, type DataTableProps } from \"@dhis2/ui\";\nimport { TableHeader } from \"./components/TableHeader\";\nimport { TableBody } from \"./components/TableBody\";\nimport { TableFoot } from \"./components/TableFoot\";\nimport { DndContext } from \"@dnd-kit/core\";\nimport { useScorecardSetState } from \"../StateProvider\";\nimport { memo, useTransition } from \"react\";\n\nexport interface ScorecardTableProps extends Omit<DataTableProps, \"children\"> {}\n\nexport const ScorecardTable = memo(function TableComponent(\n\tprops: ScorecardTableProps,\n) {\n\tconst [isPending, startTransition] = useTransition();\n\tconst updateState = useScorecardSetState();\n\n\tif (isPending) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\theight: \"100%\",\n\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<CircularLoader small />\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<DndContext\n\t\t\tonDragEnd={(event) => {\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tif (updateState) {\n\t\t\t\t\t\tif (!event.over || event.over.id === event.active.id) {\n\t\t\t\t\t\t\tupdateState((prevState) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...prevState,\n\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\t...prevState.options,\n\t\t\t\t\t\t\t\t\t\tshowDataInRows:\n\t\t\t\t\t\t\t\t\t\t\t!prevState.options.showDataInRows,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}}\n\t\t>\n\t\t\t<DataTable {...props} layout=\"auto\">\n\t\t\t\t<TableHeader />\n\t\t\t\t<TableBody />\n\t\t\t\t<TableFoot />\n\t\t\t</DataTable>\n\t\t</DndContext>\n\t);\n});\n"]}
|
|
@@ -8,4 +8,22 @@
|
|
|
8
8
|
z-index: 1;
|
|
9
9
|
padding: 10px 12px;
|
|
10
10
|
}
|
|
11
|
+
.loading-cell {
|
|
12
|
+
animation: shimmer 2s infinite linear;
|
|
13
|
+
background: linear-gradient(to right, #eee 40%, #ddd 50%, #eee 80%);
|
|
14
|
+
background-size: 500px 100px;
|
|
15
|
+
animation-name: moving-gradient;
|
|
16
|
+
animation-duration: 1s;
|
|
17
|
+
animation-iteration-count: infinite;
|
|
18
|
+
animation-timing-function: linear;
|
|
19
|
+
animation-fill-mode: forwards;
|
|
20
|
+
}
|
|
21
|
+
@-webkit-keyframes moving-gradient {
|
|
22
|
+
0% {
|
|
23
|
+
background-position: -250px 0;
|
|
24
|
+
}
|
|
25
|
+
100% {
|
|
26
|
+
background-position: 250px 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
11
29
|
/*# sourceMappingURL=ScorecardTable.module.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css"],"sourcesContent":["\n.expandCell > td:first-child {\n left: auto;\n top: auto;\n text-align: left;\n width: auto;\n background-color: rgb(243, 245, 247);\n position: sticky;\n z-index: 1;\n padding: 10px 12px;\n}\n"],"mappings":"AACA,CAAC,WAAW,EAAE,EAAE;AACZ,QAAM;AACN,OAAK;AACL,cAAY;AACZ,SAAO;AACP,oBAAkB,IAAI,GAAG,EAAE,GAAG,EAAE;AAChC,YAAU;AACV,WAAS;AACT,WAAS,KAAK;AAClB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Scorecard/components/ScorecardTable/ScorecardTable.module.css"],"sourcesContent":["\n.expandCell > td:first-child {\n left: auto;\n top: auto;\n text-align: left;\n width: auto;\n background-color: rgb(243, 245, 247);\n position: sticky;\n z-index: 1;\n padding: 10px 12px;\n}\n\n\n.loading-cell {\n animation: shimmer 2s infinite linear;\n background: linear-gradient(to right, #eee 40%, #ddd 50%, #eee 80%);\n background-size: 500px 100px;\n animation-name: moving-gradient;\n animation-duration: 1s;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n animation-fill-mode: forwards;\n}\n\n@-webkit-keyframes moving-gradient {\n 0% { background-position: -250px 0; }\n 100% { background-position: 250px 0; }\n}\n"],"mappings":"AACA,CAAC,WAAW,EAAE,EAAE;AACZ,QAAM;AACN,OAAK;AACL,cAAY;AACZ,SAAO;AACP,oBAAkB,IAAI,GAAG,EAAE,GAAG,EAAE;AAChC,YAAU;AACV,WAAS;AACT,WAAS,KAAK;AAClB;AAGA,CAAC;AACG,aAAW,QAAQ,GAAG,SAAS;AAC/B,cAAY,gBAAgB,GAAG,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK;AAC/D,mBAAiB,MAAM;AACvB,kBAAgB;AAChB,sBAAoB;AACpB,6BAA2B;AAC3B,6BAA2B;AAC3B,uBAAqB;AACzB;AAEA,mBAPoB;AAQhB;AAAK,yBAAqB,OAAO;AAAG;AACpC;AAAO,yBAAqB,MAAM;AAAG;AACzC;","names":[]}
|
|
@@ -7,6 +7,9 @@ var ConfigProvider = require('../../ConfigProvider');
|
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var legends = require('../../../utils/legends');
|
|
9
9
|
var LinkedCell = require('./LinkedCell');
|
|
10
|
+
var value = require('../../../hooks/value');
|
|
11
|
+
var StateProvider = require('../../StateProvider');
|
|
12
|
+
var CellLoader = require('./CellLoader');
|
|
10
13
|
|
|
11
14
|
function SingleAverageCell({
|
|
12
15
|
dataSource
|
|
@@ -19,9 +22,12 @@ function SingleAverageCell({
|
|
|
19
22
|
return legends.getLegend({
|
|
20
23
|
dataSource,
|
|
21
24
|
config,
|
|
22
|
-
value: dataSource.average
|
|
25
|
+
value: dataSource.data.average
|
|
23
26
|
});
|
|
24
27
|
}, [dataSource]);
|
|
28
|
+
if (!dataSource.data.average || isNaN(dataSource.data.average)) {
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, { bordered: true });
|
|
30
|
+
}
|
|
25
31
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
32
|
ui.DataTableCell,
|
|
27
33
|
{
|
|
@@ -33,7 +39,7 @@ function SingleAverageCell({
|
|
|
33
39
|
color: legendDefinition ? legends.getTextColorFromBackgroundColor(legendDefinition?.color) : void 0
|
|
34
40
|
},
|
|
35
41
|
align: "center",
|
|
36
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: dataSource.average.toString() })
|
|
42
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: dataSource.data.average?.toFixed(2).toString() })
|
|
37
43
|
}
|
|
38
44
|
);
|
|
39
45
|
}
|
|
@@ -49,7 +55,7 @@ function LinkedAverageCell({
|
|
|
49
55
|
return legends.getLegend({
|
|
50
56
|
dataSource: top,
|
|
51
57
|
config,
|
|
52
|
-
value: top.average
|
|
58
|
+
value: top.data.average
|
|
53
59
|
});
|
|
54
60
|
}, [top]);
|
|
55
61
|
const bottomLegendDefinition = react.useMemo(() => {
|
|
@@ -59,7 +65,7 @@ function LinkedAverageCell({
|
|
|
59
65
|
return legends.getLegend({
|
|
60
66
|
dataSource: bottom,
|
|
61
67
|
config,
|
|
62
|
-
value: bottom.average
|
|
68
|
+
value: bottom.data.average
|
|
63
69
|
});
|
|
64
70
|
}, [bottom]);
|
|
65
71
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -68,31 +74,58 @@ function LinkedAverageCell({
|
|
|
68
74
|
top: {
|
|
69
75
|
dataSource: {
|
|
70
76
|
...top,
|
|
71
|
-
data: {
|
|
77
|
+
data: {
|
|
78
|
+
current: top.data.average
|
|
79
|
+
}
|
|
72
80
|
},
|
|
73
81
|
legendDefinition: topLegendDefinition,
|
|
74
|
-
value: top.average
|
|
82
|
+
value: top.data.average
|
|
75
83
|
},
|
|
76
84
|
bottom: {
|
|
77
|
-
dataSource: {
|
|
85
|
+
dataSource: {
|
|
86
|
+
...bottom,
|
|
87
|
+
data: {
|
|
88
|
+
current: bottom.data.average
|
|
89
|
+
}
|
|
90
|
+
},
|
|
78
91
|
legendDefinition: bottomLegendDefinition,
|
|
79
|
-
value: bottom.average
|
|
92
|
+
value: bottom.data.average
|
|
80
93
|
}
|
|
81
94
|
}
|
|
82
95
|
);
|
|
83
96
|
}
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
97
|
+
function DataSourceAverageCell(props) {
|
|
98
|
+
const dataConfig = react.useMemo(() => props.getValue(), [props.getValue()]);
|
|
99
|
+
const { cellData: dataSources, loading } = value.useDataHolderAverageCellValue(dataConfig);
|
|
100
|
+
if (loading) {
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CellLoader.CellLoader, {});
|
|
102
|
+
}
|
|
88
103
|
if (!lodash.isEmpty(dataSources)) {
|
|
89
|
-
if (dataSources
|
|
104
|
+
if (dataSources?.length === 1) {
|
|
90
105
|
return /* @__PURE__ */ jsxRuntime.jsx(SingleAverageCell, { dataSource: lodash.head(dataSources) });
|
|
91
106
|
} else {
|
|
92
107
|
return /* @__PURE__ */ jsxRuntime.jsx(LinkedAverageCell, { dataSources });
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, {
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, {});
|
|
111
|
+
}
|
|
112
|
+
function OrgUnitAverageCell(props) {
|
|
113
|
+
const dataConfig = react.useMemo(() => props.getValue(), [props.getValue()]);
|
|
114
|
+
const { loading, average } = value.useOrgUnitAverageCellValue(dataConfig);
|
|
115
|
+
if (loading) {
|
|
116
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CellLoader.CellLoader, {});
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, { bordered: true, align: "center", children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: average?.toFixed(2).toString() }) }, props.row.id);
|
|
119
|
+
}
|
|
120
|
+
function AverageCell(props) {
|
|
121
|
+
const showDataInRows = StateProvider.useScorecardStateSelector([
|
|
122
|
+
"options",
|
|
123
|
+
"showDataInRows"
|
|
124
|
+
]);
|
|
125
|
+
if (showDataInRows) {
|
|
126
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DataSourceAverageCell, { ...props });
|
|
127
|
+
}
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OrgUnitAverageCell, { ...props });
|
|
96
129
|
}
|
|
97
130
|
|
|
98
131
|
exports.AverageCell = AverageCell;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/AverageCell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/AverageCell.tsx"],"names":[],"mappings":"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","sourcesContent":["import type { CellContext } from \"@tanstack/react-table\";\nimport type {\n\tScorecardAverageCellData,\n\tScorecardTableAverageCellConfig,\n\tScorecardTableData,\n} from \"../../../schemas/config\";\nimport { DataTableCell } from \"@dhis2/ui\";\nimport { head, isEmpty } from \"lodash\";\nimport { useScorecardConfig } from \"../../ConfigProvider\";\nimport { useMemo } from \"react\";\nimport {\n\tgetLegend,\n\tgetTextColorFromBackgroundColor,\n} from \"../../../utils/legends\";\nimport { LinkedCell } from \"./LinkedCell\";\nimport {\n\tuseDataHolderAverageCellValue,\n\tuseOrgUnitAverageCellValue,\n} from \"../../../hooks/value\";\nimport { useScorecardStateSelector } from \"../../StateProvider\";\nimport { CellLoader } from \"./CellLoader\";\n\nexport function SingleAverageCell({\n\tdataSource,\n}: {\n\tdataSource: ScorecardAverageCellData;\n}) {\n\tconst config = useScorecardConfig();\n\tconst legendDefinition = useMemo(() => {\n\t\tif (!dataSource) {\n\t\t\treturn;\n\t\t}\n\t\treturn getLegend({\n\t\t\tdataSource,\n\t\t\tconfig: config!,\n\t\t\tvalue: dataSource.data.average,\n\t\t});\n\t}, [dataSource]);\n\n\tif (!dataSource.data.average || isNaN(dataSource.data.average)) {\n\t\treturn <DataTableCell bordered />;\n\t}\n\n\treturn (\n\t\t<DataTableCell\n\t\t\tbordered\n\t\t\tstyle={{\n\t\t\t\tbackground: legendDefinition?.color,\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\tminWidth: 100,\n\t\t\t\tcolor: legendDefinition\n\t\t\t\t\t? getTextColorFromBackgroundColor(legendDefinition?.color)\n\t\t\t\t\t: undefined,\n\t\t\t}}\n\t\t\talign=\"center\"\n\t\t>\n\t\t\t<b>{dataSource.data.average?.toFixed(2).toString()}</b>\n\t\t</DataTableCell>\n\t);\n}\n\nexport function LinkedAverageCell({\n\tdataSources,\n}: {\n\tdataSources: Array<ScorecardAverageCellData>;\n}) {\n\tconst [top, bottom] = dataSources ?? [];\n\tconst config = useScorecardConfig();\n\tconst topLegendDefinition = useMemo(() => {\n\t\tif (!top) {\n\t\t\treturn;\n\t\t}\n\t\treturn getLegend({\n\t\t\tdataSource: top,\n\t\t\tconfig: config!,\n\t\t\tvalue: top.data.average,\n\t\t});\n\t}, [top]);\n\tconst bottomLegendDefinition = useMemo(() => {\n\t\tif (!bottom) {\n\t\t\treturn;\n\t\t}\n\t\treturn getLegend({\n\t\t\tdataSource: bottom,\n\t\t\tconfig: config!,\n\t\t\tvalue: bottom.data.average,\n\t\t});\n\t}, [bottom]);\n\n\treturn (\n\t\t<LinkedCell\n\t\t\ttop={{\n\t\t\t\tdataSource: {\n\t\t\t\t\t...top,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tcurrent: top.data.average,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlegendDefinition: topLegendDefinition,\n\t\t\t\tvalue: top.data.average,\n\t\t\t}}\n\t\t\tbottom={{\n\t\t\t\tdataSource: {\n\t\t\t\t\t...bottom,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tcurrent: bottom.data.average,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlegendDefinition: bottomLegendDefinition,\n\t\t\t\tvalue: bottom.data.average,\n\t\t\t}}\n\t\t/>\n\t);\n}\n\nfunction DataSourceAverageCell(\n\tprops: CellContext<ScorecardTableData, ScorecardTableAverageCellConfig>,\n) {\n\tconst dataConfig = useMemo(() => props.getValue(), [props.getValue()]);\n\tconst { cellData: dataSources, loading } =\n\t\tuseDataHolderAverageCellValue(dataConfig);\n\n\tif (loading) {\n\t\treturn <CellLoader />;\n\t}\n\n\tif (!isEmpty(dataSources)) {\n\t\tif (dataSources?.length === 1) {\n\t\t\treturn <SingleAverageCell dataSource={head(dataSources)!} />;\n\t\t} else {\n\t\t\treturn <LinkedAverageCell dataSources={dataSources!} />;\n\t\t}\n\t}\n\n\treturn <DataTableCell />;\n}\n\nfunction OrgUnitAverageCell(\n\tprops: CellContext<ScorecardTableData, ScorecardTableAverageCellConfig>,\n) {\n\tconst dataConfig = useMemo(() => props.getValue(), [props.getValue()]);\n\tconst { loading, average } = useOrgUnitAverageCellValue(dataConfig);\n\n\tif (loading) {\n\t\treturn <CellLoader />;\n\t}\n\n\treturn (\n\t\t<DataTableCell bordered align=\"center\" key={props.row.id}>\n\t\t\t<b>{average?.toFixed(2).toString()}</b>\n\t\t</DataTableCell>\n\t);\n}\n\nexport function AverageCell(\n\tprops: CellContext<ScorecardTableData, ScorecardTableAverageCellConfig>,\n) {\n\tconst showDataInRows = useScorecardStateSelector<boolean>([\n\t\t\"options\",\n\t\t\"showDataInRows\",\n\t]);\n\n\tif (showDataInRows) {\n\t\treturn <DataSourceAverageCell {...props} />;\n\t}\n\n\treturn <OrgUnitAverageCell {...props} />;\n}\n"]}
|
|
@@ -6,17 +6,48 @@ var MetaProvider = require('../../MetaProvider');
|
|
|
6
6
|
var DataProvider = require('../../DataProvider');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var columns = require('../../../utils/columns');
|
|
9
|
+
var CellLoader = require('./CellLoader');
|
|
9
10
|
|
|
10
11
|
function AverageFooterCell({}) {
|
|
11
12
|
const meta = MetaProvider.useScorecardMeta();
|
|
12
|
-
const
|
|
13
|
-
const average = react.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const [loading, setLoading] = react.useState(false);
|
|
14
|
+
const [average, setAverage] = react.useState();
|
|
15
|
+
const { data: scorecardEngine } = DataProvider.useScorecardData();
|
|
16
|
+
react.useEffect(() => {
|
|
17
|
+
setLoading(true);
|
|
18
|
+
const listener = (data) => {
|
|
19
|
+
if (data === "done") {
|
|
20
|
+
setAverage(
|
|
21
|
+
columns.getAverageValue({
|
|
22
|
+
dataValues: scorecardEngine.data,
|
|
23
|
+
meta
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (scorecardEngine.isDone) {
|
|
30
|
+
setAverage(
|
|
31
|
+
columns.getAverageValue({
|
|
32
|
+
dataValues: scorecardEngine.data,
|
|
33
|
+
meta
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
setLoading(false);
|
|
37
|
+
} else {
|
|
38
|
+
scorecardEngine.addListener(listener);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
scorecardEngine.removeListener(listener);
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
if (loading) {
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CellLoader.CellLoader, {});
|
|
46
|
+
}
|
|
47
|
+
if (!average || isNaN(average)) {
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, { bordered: true });
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, { bordered: true, align: "center", children: /* @__PURE__ */ jsxRuntime.jsx("b", { children: average?.toFixed(2).toString() }) });
|
|
20
51
|
}
|
|
21
52
|
|
|
22
53
|
exports.AverageFooterCell = AverageFooterCell;
|
package/dist/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/AverageFooterCell.tsx"],"names":[],"mappings":"AA8CS;AA9CT,SAAS,qBAAqB;AAG9B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,WAAW,gBAAgB;AAEpC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAEpB,SAAS,kBAAkB,CAAC,GAA2C;AAC7E,QAAM,OAAO,iBAAiB;AAC9B,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,KAAK;AACrD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAiB;AAC/C,QAAM,EAAE,MAAM,gBAAgB,IAAI,iBAAiB;AAEnD,YAAU,MAAM;AACf,eAAW,IAAI;AACf,UAAM,WAAW,CAAC,SAAmC;AACpD,UAAI,SAAS,QAAQ;AACpB;AAAA,UACC,gBAAgB;AAAA,YACf,YAAY,gBAAgB;AAAA,YAC5B;AAAA,UACD,CAAC;AAAA,QACF;AACA,mBAAW,KAAK;AAAA,MACjB;AAAA,IACD;AACA,QAAI,gBAAgB,QAAQ;AAC3B;AAAA,QACC,gBAAgB;AAAA,UACf,YAAY,gBAAgB;AAAA,UAC5B;AAAA,QACD,CAAC;AAAA,MACF;AACA,iBAAW,KAAK;AAAA,IACjB,OAAO;AACN,sBAAgB,YAAY,QAAQ;AAAA,IACrC;AACA,WAAO,MAAM;AACZ,sBAAgB,eAAe,QAAQ;AAAA,IACxC;AAAA,EACD,GAAG,CAAC,CAAC;AAEL,MAAI,SAAS;AACZ,WAAO,oBAAC,cAAW;AAAA,EACpB;AAEA,MAAI,CAAC,WAAW,MAAM,OAAO,GAAG;AAC/B,WAAO,oBAAC,iBAAc,UAAQ,MAAC;AAAA,EAChC;AAEA,SACC,oBAAC,iBAAc,UAAQ,MAAC,OAAM,UAC7B,8BAAC,OAAG,mBAAS,QAAQ,CAAC,EAAE,SAAS,GAAE,GACpC;AAEF","sourcesContent":["import { DataTableCell } from \"@dhis2/ui\";\nimport type { HeaderContext } from \"@tanstack/react-table\";\nimport type { ScorecardTableData } from \"../../../schemas/config\";\nimport { useScorecardMeta } from \"../../MetaProvider\";\nimport { useScorecardData } from \"../../DataProvider\";\nimport { useEffect, useState } from \"react\";\nimport type { AnalyticsData } from \"../../../utils/data\";\nimport { getAverageValue } from \"../../../utils/columns\";\nimport { CellLoader } from \"./CellLoader\";\n\nexport function AverageFooterCell({}: HeaderContext<ScorecardTableData, any>) {\n\tconst meta = useScorecardMeta();\n\tconst [loading, setLoading] = useState<boolean>(false);\n\tconst [average, setAverage] = useState<number>();\n\tconst { data: scorecardEngine } = useScorecardData();\n\n\tuseEffect(() => {\n\t\tsetLoading(true);\n\t\tconst listener = (data: AnalyticsData[] | \"done\") => {\n\t\t\tif (data === \"done\") {\n\t\t\t\tsetAverage(\n\t\t\t\t\tgetAverageValue({\n\t\t\t\t\t\tdataValues: scorecardEngine.data,\n\t\t\t\t\t\tmeta: meta!,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tsetLoading(false);\n\t\t\t}\n\t\t};\n\t\tif (scorecardEngine.isDone) {\n\t\t\tsetAverage(\n\t\t\t\tgetAverageValue({\n\t\t\t\t\tdataValues: scorecardEngine.data,\n\t\t\t\t\tmeta: meta!,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tscorecardEngine.addListener(listener);\n\t\t}\n\t\treturn () => {\n\t\t\tscorecardEngine.removeListener(listener);\n\t\t};\n\t}, []);\n\n\tif (loading) {\n\t\treturn <CellLoader />;\n\t}\n\n\tif (!average || isNaN(average)) {\n\t\treturn <DataTableCell bordered />;\n\t}\n\n\treturn (\n\t\t<DataTableCell bordered align=\"center\">\n\t\t\t<b>{average?.toFixed(2).toString()}</b>\n\t\t</DataTableCell>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var ui = require('@dhis2/ui');
|
|
5
|
+
|
|
6
|
+
function CellLoader() {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, { align: "center", bordered: true });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.CellLoader = CellLoader;
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=CellLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/CellLoader.tsx"],"names":[],"mappings":"AAGQ;AAHR,SAAS,qBAAqB;AAEvB,SAAS,aAAa;AAC5B,SAAO,oBAAC,iBAAc,OAAM,UAAS,UAAQ,MAAC;AAC/C","sourcesContent":["import { DataTableCell } from \"@dhis2/ui\";\n\nexport function CellLoader() {\n\treturn <DataTableCell align=\"center\" bordered />;\n}\n"]}
|
|
@@ -7,18 +7,38 @@ var SingleDataCell = require('./SingleDataCell');
|
|
|
7
7
|
var LinkedDataCell = require('./LinkedDataCell');
|
|
8
8
|
var ui = require('@dhis2/ui');
|
|
9
9
|
var react = require('react');
|
|
10
|
+
var value = require('../../../hooks/value');
|
|
11
|
+
var CellLoader = require('./CellLoader');
|
|
10
12
|
|
|
11
13
|
function DataContainerComponent(props) {
|
|
12
|
-
const
|
|
14
|
+
const dataConfig = react.useMemo(() => props.getValue(), [props.getValue()]);
|
|
13
15
|
const config = ConfigProvider.useScorecardConfig();
|
|
14
16
|
const meta = MetaProvider.useScorecardMeta();
|
|
17
|
+
const { loading, cellData } = value.useCellValue(props.getValue());
|
|
15
18
|
if (!config || !meta) {
|
|
16
19
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTableCell, {});
|
|
17
20
|
}
|
|
18
|
-
if (
|
|
19
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
if (loading) {
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CellLoader.CellLoader, {});
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
if (cellData?.length === 1) {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
SingleDataCell.SingleDataCell,
|
|
27
|
+
{
|
|
28
|
+
...dataConfig,
|
|
29
|
+
period: dataConfig.currentPeriod,
|
|
30
|
+
dataSources: cellData
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
LinkedDataCell.LinkedDataCell,
|
|
36
|
+
{
|
|
37
|
+
...dataConfig,
|
|
38
|
+
period: dataConfig.currentPeriod,
|
|
39
|
+
dataSources: cellData
|
|
40
|
+
}
|
|
41
|
+
);
|
|
22
42
|
}
|
|
23
43
|
const DataContainer = react.memo(DataContainerComponent);
|
|
24
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/DataContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Scorecard/components/ScorecardTable/components/DataContainer.tsx"],"names":[],"mappings":"AAuBS;AAnBT,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAE/B,SAAS,qBAAqB;AAC9B,SAAS,MAAM,eAAe;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAE3B,SAAS,uBACR,OACC;AACD,QAAM,aAAa,QAAQ,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC;AACrE,QAAM,SAAS,mBAAmB;AAClC,QAAM,OAAO,iBAAiB;AAC9B,QAAM,EAAE,SAAS,SAAS,IAAI,aAAa,MAAM,SAAS,CAAC;AAE3D,MAAI,CAAC,UAAU,CAAC,MAAM;AACrB,WAAO,oBAAC,iBAAc;AAAA,EACvB;AAEA,MAAI,SAAS;AACZ,WAAO,oBAAC,cAAW;AAAA,EACpB;AAEA,MAAI,UAAU,WAAW,GAAG;AAC3B,WACC;AAAA,MAAC;AAAA;AAAA,QACC,GAAG;AAAA,QACJ,QAAQ,WAAW;AAAA,QACnB,aAAa;AAAA;AAAA,IACd;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACC,GAAG;AAAA,MACJ,QAAQ,WAAW;AAAA,MACnB,aAAa;AAAA;AAAA,EACd;AAEF;AAEO,MAAM,gBAAgB,KAAK,sBAAsB","sourcesContent":["import type {\n\tScorecardTableCellConfig,\n\tScorecardTableData,\n} from \"../../../schemas/config\";\nimport { useScorecardConfig } from \"../../ConfigProvider\";\nimport { useScorecardMeta } from \"../../MetaProvider\";\nimport { SingleDataCell } from \"./SingleDataCell\";\nimport { LinkedDataCell } from \"./LinkedDataCell\";\nimport type { CellContext } from \"@tanstack/react-table\";\nimport { DataTableCell } from \"@dhis2/ui\";\nimport { memo, useMemo } from \"react\";\nimport { useCellValue } from \"../../../hooks/value\";\nimport { CellLoader } from \"./CellLoader\";\n\nfunction DataContainerComponent(\n\tprops: CellContext<ScorecardTableData, ScorecardTableCellConfig>,\n) {\n\tconst dataConfig = useMemo(() => props.getValue(), [props.getValue()]);\n\tconst config = useScorecardConfig();\n\tconst meta = useScorecardMeta();\n\tconst { loading, cellData } = useCellValue(props.getValue());\n\n\tif (!config || !meta) {\n\t\treturn <DataTableCell />;\n\t}\n\n\tif (loading) {\n\t\treturn <CellLoader />;\n\t}\n\n\tif (cellData?.length === 1) {\n\t\treturn (\n\t\t\t<SingleDataCell\n\t\t\t\t{...dataConfig}\n\t\t\t\tperiod={dataConfig.currentPeriod!}\n\t\t\t\tdataSources={cellData}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<LinkedDataCell\n\t\t\t{...dataConfig}\n\t\t\tperiod={dataConfig.currentPeriod!}\n\t\t\tdataSources={cellData}\n\t\t/>\n\t);\n}\n\nexport const DataContainer = memo(DataContainerComponent);\n"]}
|