@cdc/dashboard 4.24.3 → 4.24.4

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.
Files changed (34) hide show
  1. package/dist/cdcdashboard.js +119414 -103311
  2. package/examples/chart-data.json +5409 -0
  3. package/examples/full-dash-test.json +14643 -0
  4. package/examples/full-dashboard.json +10036 -0
  5. package/index.html +2 -2
  6. package/package.json +9 -9
  7. package/src/CdcDashboard.tsx +8 -3
  8. package/src/CdcDashboardComponent.tsx +232 -344
  9. package/src/_stories/Dashboard.stories.tsx +59 -38
  10. package/src/_stories/_mock/api-filter-chart.json +11 -35
  11. package/src/_stories/_mock/api-filter-map.json +17 -31
  12. package/src/_stories/_mock/dashboard-gallery.json +523 -534
  13. package/src/_stories/_mock/multi-viz.json +378 -0
  14. package/src/_stories/_mock/pivot-filter.json +0 -2
  15. package/src/components/DataDesignerModal.tsx +145 -0
  16. package/src/components/Grid.tsx +3 -1
  17. package/src/components/Header/FilterModal.tsx +49 -23
  18. package/src/components/Row.tsx +50 -25
  19. package/src/components/Toggle/Toggle.tsx +6 -7
  20. package/src/components/VisualizationRow.tsx +174 -0
  21. package/src/components/Widget.tsx +21 -103
  22. package/src/helpers/filterData.ts +16 -14
  23. package/src/helpers/getFilteredData.ts +39 -0
  24. package/src/helpers/getUpdateConfig.ts +15 -0
  25. package/src/helpers/getVizConfig.ts +31 -0
  26. package/src/helpers/getVizRowColumnLocator.ts +9 -0
  27. package/src/scss/grid.scss +9 -2
  28. package/src/scss/main.scss +5 -0
  29. package/src/store/dashboard.actions.ts +16 -1
  30. package/src/store/dashboard.reducer.ts +25 -2
  31. package/src/types/APIFilter.ts +4 -5
  32. package/src/types/ConfigRow.ts +12 -3
  33. package/src/types/DataSet.ts +11 -8
  34. package/src/types/SharedFilter.ts +1 -1
package/index.html CHANGED
@@ -21,9 +21,9 @@
21
21
  </head>
22
22
 
23
23
  <body>
24
- <!-- <div class="react-container" data-config="/examples/private/test.json"></div> -->
24
+ <!-- <div class="react-container" data-config="/examples/full-dashboard.json"></div> -->
25
25
  <!-- <div class="react-container" data-config="/examples/dashboard-gallery.json"></div> -->
26
- <!-- <div class="react-container" data-config="/examples/filtered-dash.json"></div> -->
26
+ <div class="react-container" data-config="/examples/filtered-dash.json"></div>
27
27
  <!-- <div class="react-container" data-config="/examples/all-components.json"></div> -->
28
28
  <!-- <div class="react-container" data-config="/examples/sankey.json"></div> -->
29
29
  <div class="react-container" data-config="/examples/DEV-6574.json"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/dashboard",
3
- "version": "4.24.3",
3
+ "version": "4.24.4",
4
4
  "description": "React component for combining multiple visualizations into a single dashboard",
5
5
  "moduleName": "CdcDashboard",
6
6
  "main": "dist/cdcdashboard",
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@cdc/chart": "^4.24.3",
30
- "@cdc/core": "^4.24.3",
31
- "@cdc/data-bite": "^4.24.3",
32
- "@cdc/filtered-text": "^4.24.3",
33
- "@cdc/map": "^4.24.3",
34
- "@cdc/markup-include": "^4.24.3",
35
- "@cdc/waffle-chart": "^4.24.3",
29
+ "@cdc/chart": "^4.24.4",
30
+ "@cdc/core": "^4.24.4",
31
+ "@cdc/data-bite": "^4.24.4",
32
+ "@cdc/filtered-text": "^4.24.4",
33
+ "@cdc/map": "^4.24.4",
34
+ "@cdc/markup-include": "^4.24.4",
35
+ "@cdc/waffle-chart": "^4.24.4",
36
36
  "html-react-parser": "^3.0.8",
37
37
  "js-base64": "^2.5.2",
38
38
  "papaparse": "^5.3.0",
@@ -48,5 +48,5 @@
48
48
  "react": "^18.2.0",
49
49
  "react-dom": "^18.2.0"
50
50
  },
51
- "gitHead": "9c7ef7ca74f2d2a1e04d923b133fe0fc557a62bf"
51
+ "gitHead": "1843b4632140d582af6a87606374cbd4fe25ad5c"
52
52
  }
@@ -11,6 +11,7 @@ import { initialState } from './DashboardContext'
11
11
  import { getUpdateConfig } from './helpers/getUpdateConfig'
12
12
  import { InitialState } from './types/InitialState'
13
13
  import { DashboardConfig } from './types/DashboardConfig'
14
+ import { coveUpdateWorker } from '@cdc/core/helpers/coveUpdateWorker'
14
15
  import _ from 'lodash'
15
16
 
16
17
  type MultiDashboardProps = Omit<WCMSProps, 'configUrl'> & {
@@ -36,7 +37,8 @@ const MultiDashboardWrapper: React.FC<MultiDashboardProps> = ({ configUrl, confi
36
37
 
37
38
  const formatInitialState = (newConfig: MultiDashboardConfig | DashboardConfig, datasets: Record<string, Object[]>) => {
38
39
  const [config, filteredData] = getUpdateConfig(initialState)(newConfig, datasets)
39
- return { ...initialState, config, filteredData, data: datasets }
40
+ const versionedConfig = coveUpdateWorker(config)
41
+ return { ...initialState, config: versionedConfig, filteredData, data: datasets }
40
42
  }
41
43
 
42
44
  const loadConfig = async (selectedConfig?: string) => {
@@ -62,7 +64,10 @@ const MultiDashboardWrapper: React.FC<MultiDashboardProps> = ({ configUrl, confi
62
64
  )
63
65
 
64
66
  getVizKeys(newConfig).forEach(vizKey => {
65
- newConfig.visualizations[vizKey].formattedData = datasets[newConfig.visualizations[vizKey].dataKey]
67
+ const formattedData = datasets[newConfig.visualizations[vizKey].dataKey]
68
+ if (formattedData) {
69
+ newConfig.visualizations[vizKey].formattedData = formattedData
70
+ }
66
71
  })
67
72
 
68
73
  Object.keys(datasets).forEach(key => {
@@ -92,7 +97,7 @@ const MultiDashboardWrapper: React.FC<MultiDashboardProps> = ({ configUrl, confi
92
97
  newConfig.visualizations[vizKey] = { ...newConfig.visualizations[vizKey], ...newData }
93
98
  })
94
99
 
95
- const blankFields = { data: [], dataUrl: '', dataFileName: '', dataFileSourceType: '', dataDescription: [], formattedData: [] }
100
+ const blankFields = { data: [], dataUrl: '', dataFileName: '', dataFileSourceType: '', dataDescription: {}, formattedData: [] }
96
101
  newConfig = { ...newConfig, ...blankFields }
97
102
 
98
103
  if (newConfig.dashboard.filters) {