@cdc/dashboard 4.25.10 → 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-fce76882.es.js → cdcdashboard-BnB1QM5d.es.js} +6 -13
- package/dist/{cdcdashboard-c55ac1ea.es.js → cdcdashboard-D6CG2-Hb.es.js} +5 -12
- package/dist/{cdcdashboard-31a33da1.es.js → cdcdashboard-MXgURbdZ.es.js} +6 -13
- package/dist/{cdcdashboard-1a1724a1.es.js → cdcdashboard-dgT_1dIT.es.js} +136 -151
- package/dist/cdcdashboard.js +84214 -79641
- 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/api-test/categories.json +18 -0
- package/examples/api-test/chart-data.json +602 -0
- package/examples/api-test/topics.json +47 -0
- package/examples/api-test/years.json +22 -0
- package/examples/markup-axis-label.json +4167 -0
- package/examples/private/big-dashboard.json +39095 -39077
- package/examples/private/cat-y.json +1235 -0
- package/examples/private/chronic-dash.json +1584 -0
- package/examples/private/clade-2.json +430 -0
- package/examples/private/diabetes.json +546 -196
- package/examples/private/map-issue.json +2260 -0
- package/examples/private/markup-footer/mortality-deaths-footnotes-age.csv +3 -0
- package/examples/private/mpinc-state-reports.json +2260 -0
- package/examples/private/mpox.json +38128 -0
- package/examples/private/nwss/rsv.json +1240 -0
- package/examples/private/reset.json +32920 -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-api-filter-reset.json +132 -0
- package/examples/test-dashboard-simple.json +503 -0
- package/index.html +25 -26
- package/package.json +11 -11
- package/src/CdcDashboardComponent.tsx +35 -10
- package/src/DashboardContext.tsx +3 -1
- package/src/_stories/Dashboard.DataSetup.stories.tsx +203 -0
- package/src/_stories/Dashboard.stories.tsx +402 -1
- package/src/_stories/_mock/custom-order-new-values.json +116 -0
- 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 +54 -31
- package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +118 -50
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +96 -108
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/NestedDropDownDashboard.tsx +196 -59
- package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +129 -29
- package/src/components/DashboardFilters/_stories/DashboardFilters.stories.tsx +62 -3
- package/src/components/DataDesignerModal.tsx +18 -6
- package/src/components/Header/Header.tsx +53 -21
- package/src/components/Toggle/Toggle.tsx +48 -48
- package/src/components/VisualizationRow.tsx +73 -6
- 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 +24 -6
- package/src/helpers/apiFilterHelpers.ts +26 -2
- package/src/helpers/changeFilterActive.ts +67 -65
- package/src/helpers/filterData.ts +52 -7
- package/src/helpers/filterResetHelpers.ts +102 -0
- package/src/helpers/formatConfigBeforeSave.ts +6 -5
- package/src/helpers/getUpdateConfig.ts +91 -91
- package/src/helpers/getVizConfig.ts +2 -2
- package/src/helpers/loadAPIFilters.ts +109 -99
- package/src/helpers/tests/filterResetHelpers.test.ts +532 -0
- package/src/helpers/tests/updatesChildFilters.test.ts +53 -22
- package/src/helpers/updateChildFilters.ts +50 -27
- package/src/index.tsx +1 -0
- package/src/scss/editor-panel.scss +3 -431
- package/src/scss/main.scss +142 -25
- package/src/store/errorMessage/errorMessage.reducer.ts +1 -1
- package/src/test/CdcDashboard.test.jsx +9 -4
- package/src/types/Dashboard.ts +1 -0
- package/src/types/DashboardFilters.ts +9 -8
- package/src/types/FilterStyles.ts +8 -7
- package/src/types/SharedFilter.ts +13 -0
- package/LICENSE +0 -201
- package/examples/private/DEV-11072.json +0 -7591
- package/examples/private/burden_toolkit_mortality_diabetes_attributable_deaths_data.csv +0 -14041
- package/examples/private/burden_toolkit_mortality_diabetes_attributable_deaths_per_100000_data.csv +0 -14041
- package/examples/private/burden_toolkit_mortality_qaly_data.csv +0 -18721
- package/examples/private/burden_toolkit_mortality_yll_data.csv +0 -18721
- package/examples/private/pedro.json +0 -1
- package/src/helpers/getAutoLoadVisualization.ts +0 -11
- package/src/scss/mixins.scss +0 -47
- package/src/scss/variables.scss +0 -5
- /package/dist/{cdcdashboard-548642e6.es.js → cdcdashboard-Ct2SB0vL.es.js} +0 -0
package/Dynamic_Data.md
CHANGED
|
@@ -26,6 +26,72 @@ Dashboards have a section called `sharedFilters` that is mapped over to gather a
|
|
|
26
26
|
|
|
27
27
|
After all required selections are made the `sharedFilters` are mapped over to gather query parameters to attach to the dynamic datasets. If the sharedFilter item has a list of `usedBy` identifiers the query parameters will only apply to datasets that are mapped to those respective visualizations or rows, conversly if there's now `usedBy` or the list is empty the sharedFilter item will apply it's query parameter(s) to all dynamic datasets used by the current dashboard.
|
|
28
28
|
|
|
29
|
+
## URL Filter Types: Query String vs File Name
|
|
30
|
+
|
|
31
|
+
URL filters support two different methods for modifying dataset URLs, specified by the `filterBy` property:
|
|
32
|
+
|
|
33
|
+
### Query String Filters (`filterBy: "Query String"`)
|
|
34
|
+
|
|
35
|
+
Query String filters append the filter value as a URL query parameter. This is the most common approach for REST APIs.
|
|
36
|
+
|
|
37
|
+
**Configuration:**
|
|
38
|
+
- `filterBy`: Set to `"Query String"`
|
|
39
|
+
- `queryParameter`: The name of the query parameter to append (e.g., `"geography"`, `"state"`)
|
|
40
|
+
- `datasetKey`: **Auto-populated** from the widgets specified in `usedBy` - you don't need to specify this manually
|
|
41
|
+
|
|
42
|
+
**Example:**
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"key": "Geography",
|
|
46
|
+
"type": "urlfilter",
|
|
47
|
+
"filterBy": "Query String",
|
|
48
|
+
"queryParameter": "geography",
|
|
49
|
+
"usedBy": ["chart1"],
|
|
50
|
+
"apiFilter": {
|
|
51
|
+
"apiEndpoint": "https://api.cdc.gov/states",
|
|
52
|
+
"valueSelector": "state",
|
|
53
|
+
"textSelector": "state_name"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
When a user selects "Alaska", the dataset URL `https://api.cdc.gov/data.json` becomes `https://api.cdc.gov/data.json?geography=Alaska`.
|
|
59
|
+
|
|
60
|
+
### File Name Filters (`filterBy: "File Name"`)
|
|
61
|
+
|
|
62
|
+
File Name filters replace the filename portion of the URL. This is useful for APIs that use path-based routing or file-based data sources.
|
|
63
|
+
|
|
64
|
+
**Configuration:**
|
|
65
|
+
- `filterBy`: Set to `"File Name"`
|
|
66
|
+
- `fileName`: Template for the new filename, use `${query}` placeholder for the filter value
|
|
67
|
+
- `datasetKey`: **Required** - specifies which dataset's filename should be modified
|
|
68
|
+
- `whitespaceReplacement`: How to handle spaces in the filter value (`"Keep Spaces"`, `"Remove Spaces"`, or `"Replace With Underscore"`)
|
|
69
|
+
|
|
70
|
+
**Example:**
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"key": "State",
|
|
74
|
+
"type": "urlfilter",
|
|
75
|
+
"filterBy": "File Name",
|
|
76
|
+
"fileName": "NSSPSubState${query}",
|
|
77
|
+
"datasetKey": "resp-data.json",
|
|
78
|
+
"whitespaceReplacement": "Remove Spaces",
|
|
79
|
+
"usedBy": ["chart1"],
|
|
80
|
+
"apiFilter": {
|
|
81
|
+
"apiEndpoint": "https://api.cdc.gov/states",
|
|
82
|
+
"valueSelector": "state"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
When a user selects "Alaska", the dataset URL `https://api.cdc.gov/data/default.json` becomes `https://api.cdc.gov/data/NSSPSubStateAlaska.json`.
|
|
88
|
+
|
|
89
|
+
### Dataset Key Behavior
|
|
90
|
+
|
|
91
|
+
- **Query String filters**: The `datasetKey` is automatically determined from the widgets specified in the `usedBy` array. The system looks at each widget's `dataKey` property to identify which datasets should receive the query parameter.
|
|
92
|
+
|
|
93
|
+
- **File Name filters**: The `datasetKey` must be explicitly specified to indicate which dataset's filename should be modified. This is required because filename transformations apply to specific URLs.
|
|
94
|
+
|
|
29
95
|
Example (2):
|
|
30
96
|
|
|
31
97
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const o =
|
|
1
|
+
const o = [
|
|
2
2
|
[
|
|
3
3
|
[
|
|
4
4
|
381613,
|
|
@@ -359835,7 +359835,7 @@ const o = "Topology", e = [
|
|
|
359835
359835
|
4
|
|
359836
359836
|
]
|
|
359837
359837
|
]
|
|
359838
|
-
],
|
|
359838
|
+
], e = {
|
|
359839
359839
|
scale: [
|
|
359840
359840
|
19541440750834335e-20,
|
|
359841
359841
|
13610231396060925e-20
|
|
@@ -359844,7 +359844,7 @@ const o = "Topology", e = [
|
|
|
359844
359844
|
-135.94188728451547,
|
|
359845
359845
|
24.236087
|
|
359846
359846
|
]
|
|
359847
|
-
},
|
|
359847
|
+
}, r = {
|
|
359848
359848
|
regions: {
|
|
359849
359849
|
type: "GeometryCollection",
|
|
359850
359850
|
geometries: [
|
|
@@ -361520,16 +361520,9 @@ const o = "Topology", e = [
|
|
|
361520
361520
|
}
|
|
361521
361521
|
]
|
|
361522
361522
|
}
|
|
361523
|
-
}, t = {
|
|
361524
|
-
type: o,
|
|
361525
|
-
arcs: e,
|
|
361526
|
-
transform: r,
|
|
361527
|
-
objects: s
|
|
361528
361523
|
};
|
|
361529
361524
|
export {
|
|
361530
|
-
|
|
361531
|
-
|
|
361532
|
-
|
|
361533
|
-
r as transform,
|
|
361534
|
-
o as type
|
|
361525
|
+
o as arcs,
|
|
361526
|
+
r as objects,
|
|
361527
|
+
e as transform
|
|
361535
361528
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const o =
|
|
1
|
+
const o = [
|
|
2
2
|
[
|
|
3
3
|
[
|
|
4
4
|
19832,
|
|
@@ -37842,7 +37842,7 @@ const o = "Topology", s = [
|
|
|
37842
37842
|
-178.19451843993753,
|
|
37843
37843
|
18.963909185849403
|
|
37844
37844
|
]
|
|
37845
|
-
},
|
|
37845
|
+
}, s = {
|
|
37846
37846
|
states: {
|
|
37847
37847
|
type: "GeometryCollection",
|
|
37848
37848
|
geometries: [
|
|
@@ -39369,16 +39369,9 @@ const o = "Topology", s = [
|
|
|
39369
39369
|
}
|
|
39370
39370
|
]
|
|
39371
39371
|
}
|
|
39372
|
-
}, p = {
|
|
39373
|
-
type: o,
|
|
39374
|
-
arcs: s,
|
|
39375
|
-
transform: e,
|
|
39376
|
-
objects: r
|
|
39377
39372
|
};
|
|
39378
39373
|
export {
|
|
39379
|
-
|
|
39380
|
-
|
|
39381
|
-
|
|
39382
|
-
e as transform,
|
|
39383
|
-
o as type
|
|
39374
|
+
o as arcs,
|
|
39375
|
+
s as objects,
|
|
39376
|
+
e as transform
|
|
39384
39377
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e =
|
|
1
|
+
const e = [
|
|
2
2
|
[
|
|
3
3
|
[
|
|
4
4
|
819,
|
|
@@ -34591,7 +34591,7 @@ const e = "Topology", a = [
|
|
|
34591
34591
|
-75
|
|
34592
34592
|
]
|
|
34593
34593
|
]
|
|
34594
|
-
],
|
|
34594
|
+
], a = {
|
|
34595
34595
|
scale: [
|
|
34596
34596
|
0.013996889580093316,
|
|
34597
34597
|
0.00821422737479012
|
|
@@ -34600,7 +34600,7 @@ const e = "Topology", a = [
|
|
|
34600
34600
|
-179.99999999990004,
|
|
34601
34601
|
-84.71367427324907
|
|
34602
34602
|
]
|
|
34603
|
-
},
|
|
34603
|
+
}, p = {
|
|
34604
34604
|
countries: {
|
|
34605
34605
|
type: "GeometryCollection",
|
|
34606
34606
|
geometries: [
|
|
@@ -39186,16 +39186,9 @@ const e = "Topology", a = [
|
|
|
39186
39186
|
}
|
|
39187
39187
|
]
|
|
39188
39188
|
}
|
|
39189
|
-
}, s = {
|
|
39190
|
-
type: e,
|
|
39191
|
-
arcs: a,
|
|
39192
|
-
transform: p,
|
|
39193
|
-
objects: t
|
|
39194
39189
|
};
|
|
39195
39190
|
export {
|
|
39196
|
-
|
|
39197
|
-
|
|
39198
|
-
|
|
39199
|
-
p as transform,
|
|
39200
|
-
e as type
|
|
39191
|
+
e as arcs,
|
|
39192
|
+
p as objects,
|
|
39193
|
+
a as transform
|
|
39201
39194
|
};
|