@cdc/dashboard 4.25.11 → 4.26.1
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/Dynamic_Data.md +66 -0
- package/dist/cdcdashboard.js +78783 -76370
- package/examples/api-dashboard-data.json +272 -0
- package/examples/api-dashboard-years.json +11 -0
- package/examples/api-geographies-data.json +11 -0
- package/examples/private/cat-y.json +1235 -0
- package/examples/private/chronic-dash.json +1584 -0
- package/examples/private/map-issue.json +2260 -0
- package/examples/private/mpinc-state-reports.json +2260 -0
- package/examples/private/nwss/rsv.json +1240 -0
- package/examples/private/simple-dash.json +490 -0
- package/examples/private/test-dash.json +0 -0
- package/examples/private/test123.json +491 -0
- package/examples/test-dashboard-simple.json +503 -0
- package/index.html +24 -25
- package/package.json +12 -11
- package/src/CdcDashboardComponent.tsx +18 -2
- package/src/_stories/Dashboard.DataSetup.stories.tsx +203 -0
- package/src/_stories/Dashboard.stories.tsx +385 -1
- package/src/_stories/_mock/filter-cascade.json +3350 -0
- package/src/_stories/_mock/gallery-data-bite-dashboard.json +3500 -0
- package/src/_stories/_mock/nested-parent-child-filters.json +392 -0
- package/src/_stories/_mock/parent-child-filters.json +233 -0
- package/src/components/DashboardFilters/DashboardFilters.tsx +20 -11
- package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +89 -38
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +51 -29
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/NestedDropDownDashboard.tsx +146 -9
- package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +11 -7
- package/src/components/DataDesignerModal.tsx +6 -1
- package/src/components/Header/Header.tsx +51 -20
- package/src/components/VisualizationRow.tsx +71 -5
- package/src/components/VisualizationsPanel/VisualizationsPanel.tsx +2 -3
- package/src/components/Widget/Widget.tsx +1 -1
- package/src/data/initial-state.js +1 -0
- package/src/helpers/addValuesToDashboardFilters.ts +15 -22
- package/src/helpers/changeFilterActive.ts +67 -65
- package/src/helpers/formatConfigBeforeSave.ts +6 -5
- package/src/helpers/getUpdateConfig.ts +91 -91
- package/src/helpers/tests/updatesChildFilters.test.ts +53 -22
- package/src/helpers/updateChildFilters.ts +50 -27
- package/src/scss/main.scss +141 -1
- package/src/test/CdcDashboard.test.jsx +9 -4
- package/src/types/Dashboard.ts +1 -0
- package/src/types/FilterStyles.ts +8 -7
- package/src/types/SharedFilter.ts +13 -0
- package/LICENSE +0 -201
- package/examples/private/DEV-10538.json +0 -407
- package/examples/private/DEV-11072.json +0 -7591
- package/examples/private/DEV-11405.json +0 -39112
- package/examples/private/delete.json +0 -32919
- package/examples/private/pedro.json +0 -1
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dashboard": {
|
|
3
|
+
"sharedFilters": [
|
|
4
|
+
{
|
|
5
|
+
"key": "Geography",
|
|
6
|
+
"type": "datafilter",
|
|
7
|
+
"columnName": "geography",
|
|
8
|
+
"showDropdown": true,
|
|
9
|
+
"filterStyle": "dropdown",
|
|
10
|
+
"defaultValue": "United States",
|
|
11
|
+
"usedBy": [
|
|
12
|
+
"chart1"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"key": "Year",
|
|
17
|
+
"type": "datafilter",
|
|
18
|
+
"columnName": "year",
|
|
19
|
+
"showDropdown": true,
|
|
20
|
+
"filterStyle": "dropdown",
|
|
21
|
+
"defaultValue": "2023",
|
|
22
|
+
"usedBy": [
|
|
23
|
+
"chart1"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"rows": [
|
|
29
|
+
{
|
|
30
|
+
"uuid": "__undefined__",
|
|
31
|
+
"toggle": "__undefined__",
|
|
32
|
+
"equalHeight": "__undefined__",
|
|
33
|
+
"columns": [
|
|
34
|
+
{
|
|
35
|
+
"width": 12,
|
|
36
|
+
"widget": "filters",
|
|
37
|
+
"toggleName": "Filter Dropdowns"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"uuid": "__undefined__",
|
|
43
|
+
"toggle": "__undefined__",
|
|
44
|
+
"equalHeight": "__undefined__",
|
|
45
|
+
"columns": [
|
|
46
|
+
{
|
|
47
|
+
"width": 12,
|
|
48
|
+
"widget": "chart1",
|
|
49
|
+
"toggleName": "Chart"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"visualizations": {
|
|
55
|
+
"filters": {
|
|
56
|
+
"type": "dashboardFilters",
|
|
57
|
+
"visualizationType": "dashboardFilters",
|
|
58
|
+
"uid": "filters",
|
|
59
|
+
"sharedFilterIndexes": [
|
|
60
|
+
0,
|
|
61
|
+
1
|
|
62
|
+
],
|
|
63
|
+
"filterBehavior": "Apply Button",
|
|
64
|
+
"dashboardFilters": [
|
|
65
|
+
{
|
|
66
|
+
"columnName": "geography",
|
|
67
|
+
"active": "United States",
|
|
68
|
+
"values": [
|
|
69
|
+
"California",
|
|
70
|
+
"Texas",
|
|
71
|
+
"United States"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"columnName": "year",
|
|
76
|
+
"active": "2021",
|
|
77
|
+
"values": [
|
|
78
|
+
"2021",
|
|
79
|
+
"2022",
|
|
80
|
+
"2023"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"chart1": {
|
|
86
|
+
"annotations": [],
|
|
87
|
+
"allowLineToBarGraph": "__undefined__",
|
|
88
|
+
"type": "chart",
|
|
89
|
+
"debugSvg": false,
|
|
90
|
+
"chartMessage": {
|
|
91
|
+
"noData": "No Data Available"
|
|
92
|
+
},
|
|
93
|
+
"title": "Test Chart",
|
|
94
|
+
"showTitle": true,
|
|
95
|
+
"showDownloadMediaButton": false,
|
|
96
|
+
"theme": "theme-blue",
|
|
97
|
+
"animate": false,
|
|
98
|
+
"lineDatapointStyle": "hover",
|
|
99
|
+
"lineDatapointColor": "Same as Line",
|
|
100
|
+
"barHasBorder": "true",
|
|
101
|
+
"isLollipopChart": false,
|
|
102
|
+
"lollipopShape": "circle",
|
|
103
|
+
"lollipopColorStyle": "two-tone",
|
|
104
|
+
"visualizationSubType": "regular",
|
|
105
|
+
"barStyle": "",
|
|
106
|
+
"roundingStyle": "standard",
|
|
107
|
+
"tipRounding": "top",
|
|
108
|
+
"isResponsiveTicks": false,
|
|
109
|
+
"general": {
|
|
110
|
+
"annotationDropdownText": "Annotations",
|
|
111
|
+
"showMissingDataLabel": true,
|
|
112
|
+
"showSuppressedSymbol": true,
|
|
113
|
+
"showZeroValueData": true,
|
|
114
|
+
"hideNullValue": true,
|
|
115
|
+
"palette": {
|
|
116
|
+
"name": "sequential_blue",
|
|
117
|
+
"version": "2.0",
|
|
118
|
+
"isReversed": false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"padding": {
|
|
122
|
+
"left": 5,
|
|
123
|
+
"right": 5
|
|
124
|
+
},
|
|
125
|
+
"preliminaryData": [],
|
|
126
|
+
"yAxis": {
|
|
127
|
+
"hideAxis": false,
|
|
128
|
+
"displayNumbersOnBar": false,
|
|
129
|
+
"hideLabel": false,
|
|
130
|
+
"hideTicks": false,
|
|
131
|
+
"size": 50,
|
|
132
|
+
"gridLines": false,
|
|
133
|
+
"enablePadding": false,
|
|
134
|
+
"min": "",
|
|
135
|
+
"max": "",
|
|
136
|
+
"labelColor": "#1c1d1f",
|
|
137
|
+
"tickLabelColor": "#1c1d1f",
|
|
138
|
+
"tickColor": "#1c1d1f",
|
|
139
|
+
"rightHideAxis": false,
|
|
140
|
+
"rightAxisSize": 0,
|
|
141
|
+
"rightLabel": "",
|
|
142
|
+
"rightLabelOffsetSize": 0,
|
|
143
|
+
"rightAxisLabelColor": "#1c1d1f",
|
|
144
|
+
"rightAxisTickLabelColor": "#1c1d1f",
|
|
145
|
+
"rightAxisTickColor": "#1c1d1f",
|
|
146
|
+
"numTicks": "",
|
|
147
|
+
"axisPadding": 0,
|
|
148
|
+
"scalePadding": 10,
|
|
149
|
+
"tickRotation": 0,
|
|
150
|
+
"anchors": [],
|
|
151
|
+
"shoMissingDataLabel": true,
|
|
152
|
+
"showMissingDataLine": true,
|
|
153
|
+
"categories": [],
|
|
154
|
+
"label": "Value"
|
|
155
|
+
},
|
|
156
|
+
"boxplot": {
|
|
157
|
+
"plots": [],
|
|
158
|
+
"borders": "true",
|
|
159
|
+
"plotOutlierValues": false,
|
|
160
|
+
"plotNonOutlierValues": true,
|
|
161
|
+
"labels": {
|
|
162
|
+
"q1": "Lower Quartile",
|
|
163
|
+
"q2": "q2",
|
|
164
|
+
"q3": "Upper Quartile",
|
|
165
|
+
"q4": "q4",
|
|
166
|
+
"minimum": "Minimum",
|
|
167
|
+
"maximum": "Maximum",
|
|
168
|
+
"mean": "Mean",
|
|
169
|
+
"median": "Median",
|
|
170
|
+
"sd": "Standard Deviation",
|
|
171
|
+
"iqr": "Interquartile Range",
|
|
172
|
+
"count": "Count",
|
|
173
|
+
"outliers": "Outliers",
|
|
174
|
+
"values": "Values",
|
|
175
|
+
"lowerBounds": "Lower Bounds",
|
|
176
|
+
"upperBounds": "Upper Bounds"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"topAxis": {
|
|
180
|
+
"hasLine": false
|
|
181
|
+
},
|
|
182
|
+
"isLegendValue": false,
|
|
183
|
+
"barThickness": 0.35,
|
|
184
|
+
"barHeight": 25,
|
|
185
|
+
"barSpace": 15,
|
|
186
|
+
"heights": {
|
|
187
|
+
"vertical": 300,
|
|
188
|
+
"horizontal": 750
|
|
189
|
+
},
|
|
190
|
+
"xAxis": {
|
|
191
|
+
"sortDates": false,
|
|
192
|
+
"anchors": [],
|
|
193
|
+
"type": "categorical",
|
|
194
|
+
"showTargetLabel": true,
|
|
195
|
+
"targetLabel": "Target",
|
|
196
|
+
"hideAxis": false,
|
|
197
|
+
"hideLabel": false,
|
|
198
|
+
"hideTicks": false,
|
|
199
|
+
"size": 75,
|
|
200
|
+
"tickRotation": 0,
|
|
201
|
+
"min": "",
|
|
202
|
+
"max": "",
|
|
203
|
+
"labelColor": "#1c1d1f",
|
|
204
|
+
"tickLabelColor": "#1c1d1f",
|
|
205
|
+
"tickColor": "#1c1d1f",
|
|
206
|
+
"numTicks": "",
|
|
207
|
+
"labelOffset": 0,
|
|
208
|
+
"axisPadding": 200,
|
|
209
|
+
"target": 0,
|
|
210
|
+
"maxTickRotation": 0,
|
|
211
|
+
"padding": 5,
|
|
212
|
+
"showYearsOnce": false,
|
|
213
|
+
"sortByRecentDate": false,
|
|
214
|
+
"brushActive": false,
|
|
215
|
+
"dataKey": "category",
|
|
216
|
+
"axisBBox": 29.360000610351562,
|
|
217
|
+
"tickWidthMax": 82
|
|
218
|
+
},
|
|
219
|
+
"table": {
|
|
220
|
+
"label": "Data Table",
|
|
221
|
+
"expanded": false,
|
|
222
|
+
"limitHeight": false,
|
|
223
|
+
"height": "",
|
|
224
|
+
"caption": "",
|
|
225
|
+
"showDownloadUrl": false,
|
|
226
|
+
"showDataTableLink": true,
|
|
227
|
+
"showDownloadLinkBelow": true,
|
|
228
|
+
"indexLabel": "",
|
|
229
|
+
"download": false,
|
|
230
|
+
"showVertical": false,
|
|
231
|
+
"dateDisplayFormat": "",
|
|
232
|
+
"showMissingDataLabel": true,
|
|
233
|
+
"showSuppressedSymbol": true,
|
|
234
|
+
"collapsible": true,
|
|
235
|
+
"sharedFilterColumns": [
|
|
236
|
+
"geography",
|
|
237
|
+
"year"
|
|
238
|
+
],
|
|
239
|
+
"show": false
|
|
240
|
+
},
|
|
241
|
+
"orientation": "vertical",
|
|
242
|
+
"columns": {},
|
|
243
|
+
"legend": {
|
|
244
|
+
"hide": false,
|
|
245
|
+
"behavior": "isolate",
|
|
246
|
+
"axisAlign": true,
|
|
247
|
+
"singleRow": true,
|
|
248
|
+
"colorCode": "",
|
|
249
|
+
"reverseLabelOrder": false,
|
|
250
|
+
"description": "",
|
|
251
|
+
"dynamicLegend": false,
|
|
252
|
+
"dynamicLegendDefaultText": "Show All",
|
|
253
|
+
"dynamicLegendItemLimit": 5,
|
|
254
|
+
"dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
|
|
255
|
+
"dynamicLegendChartMessage": "Select Options from the Legend",
|
|
256
|
+
"label": "",
|
|
257
|
+
"lineMode": false,
|
|
258
|
+
"verticalSorted": false,
|
|
259
|
+
"highlightOnHover": false,
|
|
260
|
+
"hideSuppressedLabels": false,
|
|
261
|
+
"hideSuppressionLink": false,
|
|
262
|
+
"seriesHighlight": [],
|
|
263
|
+
"style": "circles",
|
|
264
|
+
"subStyle": "linear blocks",
|
|
265
|
+
"groupBy": "",
|
|
266
|
+
"shape": "circle",
|
|
267
|
+
"tickRotation": "",
|
|
268
|
+
"order": "dataColumn",
|
|
269
|
+
"hideBorder": {
|
|
270
|
+
"side": false,
|
|
271
|
+
"topBottom": true
|
|
272
|
+
},
|
|
273
|
+
"position": "right",
|
|
274
|
+
"orderedValues": [],
|
|
275
|
+
"patterns": {},
|
|
276
|
+
"patternField": "",
|
|
277
|
+
"unified": true
|
|
278
|
+
},
|
|
279
|
+
"smallMultiples": {
|
|
280
|
+
"mode": "",
|
|
281
|
+
"tileColumn": "",
|
|
282
|
+
"tilesPerRowDesktop": 3,
|
|
283
|
+
"tilesPerRowMobile": 1,
|
|
284
|
+
"tileOrder": [],
|
|
285
|
+
"tileOrderType": "asc",
|
|
286
|
+
"tileTitles": {},
|
|
287
|
+
"independentYAxis": false,
|
|
288
|
+
"colorMode": "same",
|
|
289
|
+
"synchronizedTooltips": true,
|
|
290
|
+
"showAreaUnderLine": true
|
|
291
|
+
},
|
|
292
|
+
"exclusions": {
|
|
293
|
+
"active": false,
|
|
294
|
+
"keys": []
|
|
295
|
+
},
|
|
296
|
+
"twoColor": {
|
|
297
|
+
"palette": "monochrome-1",
|
|
298
|
+
"isPaletteReversed": false
|
|
299
|
+
},
|
|
300
|
+
"labels": false,
|
|
301
|
+
"dataFormat": {
|
|
302
|
+
"commas": false,
|
|
303
|
+
"prefix": "",
|
|
304
|
+
"suffix": "",
|
|
305
|
+
"abbreviated": false,
|
|
306
|
+
"bottomSuffix": "",
|
|
307
|
+
"bottomPrefix": "",
|
|
308
|
+
"bottomAbbreviated": false
|
|
309
|
+
},
|
|
310
|
+
"filters": [],
|
|
311
|
+
"confidenceKeys": {},
|
|
312
|
+
"visual": {
|
|
313
|
+
"border": true,
|
|
314
|
+
"accent": true,
|
|
315
|
+
"background": true,
|
|
316
|
+
"verticalHoverLine": false,
|
|
317
|
+
"horizontalHoverLine": false,
|
|
318
|
+
"lineDatapointSymbol": "none",
|
|
319
|
+
"maximumShapeAmount": 7
|
|
320
|
+
},
|
|
321
|
+
"useLogScale": false,
|
|
322
|
+
"filterBehavior": "Filter Change",
|
|
323
|
+
"highlightedBarValues": [],
|
|
324
|
+
"series": [
|
|
325
|
+
{
|
|
326
|
+
"dataKey": "value",
|
|
327
|
+
"type": "Bar",
|
|
328
|
+
"axis": "Left",
|
|
329
|
+
"tooltip": true
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
"tooltips": {
|
|
333
|
+
"opacity": 90,
|
|
334
|
+
"singleSeries": false,
|
|
335
|
+
"dateDisplayFormat": ""
|
|
336
|
+
},
|
|
337
|
+
"forestPlot": {
|
|
338
|
+
"startAt": 0,
|
|
339
|
+
"colors": {
|
|
340
|
+
"line": "",
|
|
341
|
+
"shape": ""
|
|
342
|
+
},
|
|
343
|
+
"lineOfNoEffect": {
|
|
344
|
+
"show": true
|
|
345
|
+
},
|
|
346
|
+
"type": "",
|
|
347
|
+
"pooledResult": {
|
|
348
|
+
"diamondHeight": 5,
|
|
349
|
+
"column": ""
|
|
350
|
+
},
|
|
351
|
+
"estimateField": "",
|
|
352
|
+
"estimateRadius": "",
|
|
353
|
+
"shape": "square",
|
|
354
|
+
"rowHeight": 20,
|
|
355
|
+
"description": {
|
|
356
|
+
"show": true,
|
|
357
|
+
"text": "description",
|
|
358
|
+
"location": 0
|
|
359
|
+
},
|
|
360
|
+
"result": {
|
|
361
|
+
"show": true,
|
|
362
|
+
"text": "result",
|
|
363
|
+
"location": 100
|
|
364
|
+
},
|
|
365
|
+
"radius": {
|
|
366
|
+
"min": 2,
|
|
367
|
+
"max": 10,
|
|
368
|
+
"scalingColumn": ""
|
|
369
|
+
},
|
|
370
|
+
"regression": {
|
|
371
|
+
"lower": 0,
|
|
372
|
+
"upper": 0,
|
|
373
|
+
"estimateField": 0
|
|
374
|
+
},
|
|
375
|
+
"leftWidthOffset": 0,
|
|
376
|
+
"rightWidthOffset": 0,
|
|
377
|
+
"showZeroLine": false,
|
|
378
|
+
"leftLabel": "",
|
|
379
|
+
"rightLabel": ""
|
|
380
|
+
},
|
|
381
|
+
"area": {
|
|
382
|
+
"isStacked": false
|
|
383
|
+
},
|
|
384
|
+
"sankey": {
|
|
385
|
+
"title": {
|
|
386
|
+
"defaultColor": "black"
|
|
387
|
+
},
|
|
388
|
+
"iterations": 1,
|
|
389
|
+
"rxValue": 0.9,
|
|
390
|
+
"overallSize": {
|
|
391
|
+
"width": 900,
|
|
392
|
+
"height": 700
|
|
393
|
+
},
|
|
394
|
+
"margin": {
|
|
395
|
+
"margin_y": 25,
|
|
396
|
+
"margin_x": 0
|
|
397
|
+
},
|
|
398
|
+
"nodeSize": {
|
|
399
|
+
"nodeWidth": 26,
|
|
400
|
+
"nodeHeight": 40
|
|
401
|
+
},
|
|
402
|
+
"nodePadding": 55,
|
|
403
|
+
"nodeFontColor": "black",
|
|
404
|
+
"nodeColor": {
|
|
405
|
+
"default": "#ff8500",
|
|
406
|
+
"inactive": "#808080"
|
|
407
|
+
},
|
|
408
|
+
"linkColor": {
|
|
409
|
+
"default": "#ffc900",
|
|
410
|
+
"inactive": "#D3D3D3"
|
|
411
|
+
},
|
|
412
|
+
"opacity": {
|
|
413
|
+
"nodeOpacityDefault": 1,
|
|
414
|
+
"nodeOpacityInactive": 0.1,
|
|
415
|
+
"LinkOpacityDefault": 1,
|
|
416
|
+
"LinkOpacityInactive": 0.1
|
|
417
|
+
},
|
|
418
|
+
"storyNodeFontColor": "#006778",
|
|
419
|
+
"storyNodeText": [],
|
|
420
|
+
"nodeValueStyle": {
|
|
421
|
+
"textBefore": "(",
|
|
422
|
+
"textAfter": ")"
|
|
423
|
+
},
|
|
424
|
+
"data": []
|
|
425
|
+
},
|
|
426
|
+
"markupVariables": [],
|
|
427
|
+
"enableMarkupVariables": false,
|
|
428
|
+
"uid": "chart1",
|
|
429
|
+
"visualizationType": "Bar",
|
|
430
|
+
"dataKey": "chartData",
|
|
431
|
+
"dataDescription": {
|
|
432
|
+
"horizontal": false,
|
|
433
|
+
"series": false
|
|
434
|
+
},
|
|
435
|
+
"dashboardFilters": [
|
|
436
|
+
{
|
|
437
|
+
"columnName": "geography",
|
|
438
|
+
"active": "United States",
|
|
439
|
+
"values": [
|
|
440
|
+
"California",
|
|
441
|
+
"Texas",
|
|
442
|
+
"United States"
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"columnName": "year",
|
|
447
|
+
"active": "2021",
|
|
448
|
+
"values": [
|
|
449
|
+
"2021",
|
|
450
|
+
"2022",
|
|
451
|
+
"2023"
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
"dynamicMarginTop": 0
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
"table": {
|
|
459
|
+
"label": "Data Table",
|
|
460
|
+
"show": true,
|
|
461
|
+
"showDownloadUrl": false,
|
|
462
|
+
"showDownloadLinkBelow": true,
|
|
463
|
+
"showVertical": true
|
|
464
|
+
},
|
|
465
|
+
"type": "dashboard",
|
|
466
|
+
"runtime": {},
|
|
467
|
+
"version": "4.25.11",
|
|
468
|
+
"migrations": {
|
|
469
|
+
"addColorMigration": true
|
|
470
|
+
},
|
|
471
|
+
"general": {
|
|
472
|
+
"palette": {
|
|
473
|
+
"version": "1.0",
|
|
474
|
+
"backups": [
|
|
475
|
+
{
|
|
476
|
+
"name": "__undefined__",
|
|
477
|
+
"version": "1.0",
|
|
478
|
+
"isReversed": "__undefined__"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"name": "__undefined__",
|
|
482
|
+
"version": "1.0",
|
|
483
|
+
"isReversed": "__undefined__"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"name": "__undefined__",
|
|
487
|
+
"version": "1.0",
|
|
488
|
+
"isReversed": "__undefined__"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"name": "__undefined__",
|
|
492
|
+
"version": "1.0",
|
|
493
|
+
"isReversed": "__undefined__"
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"datasets": {
|
|
499
|
+
"chartData": {
|
|
500
|
+
"dataUrl": "http://localhost:8080/examples/api-dashboard-data.json"
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
package/index.html
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
margin: 0 auto !important;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
min-height: unset !important;
|
|
13
|
+
}
|
|
3
14
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
justify-content: center;
|
|
13
|
-
min-height: unset !important;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.react-container+.react-container {
|
|
17
|
-
margin-top: 3rem;
|
|
18
|
-
}
|
|
19
|
-
</style>
|
|
20
|
-
<link rel="stylesheet prefetch" href="examples/custom/css/respiratory.css" />
|
|
21
|
-
<link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/5.0/css/app.min.css?_=71669" />
|
|
22
|
-
</head>
|
|
23
|
-
|
|
24
|
-
<body>
|
|
25
|
-
<div class="react-container" data-config="/examples/markup-axis-label.json"></div>
|
|
26
|
-
<script src="https://www.cdc.gov/TemplatePackage/contrib/libs/jquery/latest/jquery.min.js?_=91329"></script>
|
|
27
|
-
<script type="module" src="./src/index.tsx"></script>
|
|
28
|
-
</body>
|
|
15
|
+
/* Add 1rem padding to mimic DFE when editor is not visible */
|
|
16
|
+
.cdc-open-viz-module.type-dashboard:not(.isDashboardEditor) {
|
|
17
|
+
padding: 1rem;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
<link rel="stylesheet prefetch" href="examples/custom/css/respiratory.css" />
|
|
21
|
+
<link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/5.0/css/app.min.css?_=71669" />
|
|
22
|
+
</head>
|
|
29
23
|
|
|
24
|
+
<body>
|
|
25
|
+
<div class="react-container" data-config="/examples/dashboard-gallery.json"></div>
|
|
26
|
+
<script src="https://www.cdc.gov/TemplatePackage/contrib/libs/jquery/latest/jquery.min.js?_=91329"></script>
|
|
27
|
+
<script type="module" src="./src/index.tsx"></script>
|
|
28
|
+
</body>
|
|
30
29
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/dashboard",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.1",
|
|
4
4
|
"description": "React component for combining multiple visualizations into a single dashboard",
|
|
5
5
|
"moduleName": "CdcDashboard",
|
|
6
6
|
"main": "dist/cdcdashboard",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cdc/chart": "^4.
|
|
31
|
-
"@cdc/core": "^4.
|
|
32
|
-
"@cdc/data-bite": "^4.
|
|
33
|
-
"@cdc/filtered-text": "^4.
|
|
34
|
-
"@cdc/map": "^4.
|
|
35
|
-
"@cdc/markup-include": "^4.
|
|
36
|
-
"@cdc/waffle-chart": "^4.
|
|
30
|
+
"@cdc/chart": "^4.26.1",
|
|
31
|
+
"@cdc/core": "^4.26.1",
|
|
32
|
+
"@cdc/data-bite": "^4.26.1",
|
|
33
|
+
"@cdc/filtered-text": "^4.26.1",
|
|
34
|
+
"@cdc/map": "^4.26.1",
|
|
35
|
+
"@cdc/markup-include": "^4.26.1",
|
|
36
|
+
"@cdc/waffle-chart": "^4.26.1",
|
|
37
37
|
"js-base64": "^2.5.2",
|
|
38
38
|
"react-accessible-accordion": "^5.0.1",
|
|
39
39
|
"react-dnd": "^14.0.2",
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
"react-dom": "^18.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@rollup/plugin-dsv": "^3.0.2",
|
|
48
49
|
"@vitejs/plugin-react": "^4.3.4",
|
|
49
|
-
"
|
|
50
|
+
"sass": "^1.89.2",
|
|
50
51
|
"vite-plugin-css-injected-by-js": "^2.4.0",
|
|
51
|
-
"vite-plugin-svgr": "^2.
|
|
52
|
+
"vite-plugin-svgr": "^4.2.0"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7e3b27098c4eb7a24bc9c3654ad53f88d6419f16"
|
|
54
55
|
}
|
|
@@ -60,6 +60,7 @@ import Alert from '@cdc/core/components/Alert'
|
|
|
60
60
|
import { shouldLoadAllFilters } from './helpers/shouldLoadAllFilters'
|
|
61
61
|
import { subscribe, unsubscribe } from '@cdc/core/helpers/events'
|
|
62
62
|
import DashboardEditors from './components/DashboardEditors'
|
|
63
|
+
import { updateChildFilters } from './helpers/updateChildFilters'
|
|
63
64
|
|
|
64
65
|
type DashboardProps = Omit<WCMSProps, 'configUrl'> & {
|
|
65
66
|
initialState: InitialState
|
|
@@ -97,6 +98,16 @@ export default function CdcDashboard({
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
const vals = reloadURLHelpers.getDatasetKeys(state.config).map(key => state.data[key])
|
|
101
|
+
|
|
102
|
+
// Check if there are any visualizations that actually need data
|
|
103
|
+
// Markup-includes without dataKey don't require dashboard data
|
|
104
|
+
const visualizationsNeedingData = Object.values(state.config.visualizations).filter(viz => {
|
|
105
|
+
return viz.type !== 'markup-include' || viz.dataKey
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// If no visualizations need data, don't show no-data state
|
|
109
|
+
if (!vals.length && visualizationsNeedingData.length === 0) return false
|
|
110
|
+
|
|
100
111
|
if (!vals.length) return true
|
|
101
112
|
return vals.some(val => val === undefined)
|
|
102
113
|
}, [state.data, state.config.visualizations, state.config.dashboard?.sharedFilters, state.filtersApplied])
|
|
@@ -330,7 +341,8 @@ export default function CdcDashboard({
|
|
|
330
341
|
useEffect(() => {
|
|
331
342
|
const { config } = state
|
|
332
343
|
const loadAllFilters = shouldLoadAllFilters(config, isEditor && !isPreview)
|
|
333
|
-
|
|
344
|
+
let sharedFiltersWithValues = addValuesToDashboardFilters(config.dashboard.sharedFilters, state.data)
|
|
345
|
+
sharedFiltersWithValues = updateChildFilters(sharedFiltersWithValues, state.data)
|
|
334
346
|
setAPILoading(true)
|
|
335
347
|
loadAPIFilters(sharedFiltersWithValues, apiFilterDropdowns, loadAllFilters)?.then(newFilters => {
|
|
336
348
|
const allValuesSelected = newFilters.every(filter => {
|
|
@@ -493,10 +505,11 @@ export default function CdcDashboard({
|
|
|
493
505
|
<Title
|
|
494
506
|
title={title}
|
|
495
507
|
isDashboard={true}
|
|
508
|
+
titleStyle={config.dashboard.titleStyle}
|
|
496
509
|
classes={[`dashboard-title`, `${config.dashboard.theme ?? 'theme-blue'}`]}
|
|
497
510
|
/>
|
|
498
511
|
{/* Description */}
|
|
499
|
-
{description && <div className='subtext mb-
|
|
512
|
+
{description && <div className='subtext mb-4'>{parse(description)}</div>}
|
|
500
513
|
{/* Visualizations */}
|
|
501
514
|
{filteredRows?.map((row, index) => (
|
|
502
515
|
<VisualizationRow
|
|
@@ -636,6 +649,9 @@ export default function CdcDashboard({
|
|
|
636
649
|
}
|
|
637
650
|
|
|
638
651
|
const dashboardContainerClasses = ['cdc-open-viz-module', 'type-dashboard', `${currentViewport}`]
|
|
652
|
+
if (isEditor) {
|
|
653
|
+
dashboardContainerClasses.push('isDashboardEditor')
|
|
654
|
+
}
|
|
639
655
|
|
|
640
656
|
return (
|
|
641
657
|
<GlobalContextProvider>
|