@cdc/dashboard 4.26.2 → 4.26.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.
- package/CONFIG.md +172 -0
- package/README.md +60 -20
- package/dist/cdcdashboard-CY9IcPSi.es.js +6 -0
- package/dist/cdcdashboard-DlpiY3fQ.es.js +4 -0
- package/dist/cdcdashboard.js +56686 -50281
- package/examples/__data__/data-2.json +6 -0
- package/examples/__data__/data-with-metadata.json +18 -0
- package/examples/__data__/data.json +6 -0
- package/examples/default.json +7 -36
- package/examples/legend-issue.json +1 -1
- package/examples/minimal-example.json +34 -0
- package/examples/private/dengue.json +4640 -0
- package/examples/private/inline-markup.json +775 -0
- package/examples/private/link_to_file.json +16662 -0
- package/examples/private/recent-update.json +1456 -0
- package/examples/private/toggle.json +10137 -0
- package/examples/sankey.json +3 -3
- package/examples/test-api-filter-reset.json +4 -4
- package/examples/tp5-test.json +86 -4
- package/package.json +9 -9
- package/src/CdcDashboard.tsx +2 -1
- package/src/CdcDashboardComponent.tsx +48 -28
- package/src/_stories/Dashboard.DataSetup.stories.tsx +6 -1
- package/src/_stories/Dashboard.Pages.smoke.stories.tsx +22 -0
- package/src/_stories/Dashboard.smoke.stories.tsx +33 -0
- package/src/_stories/Dashboard.stories.tsx +4523 -83
- package/src/_stories/_mock/dashboard-data-driven-colors.json +171 -0
- package/src/_stories/_mock/tab-simple-filter.json +153 -0
- package/src/_stories/_mock/tp5-test.json +86 -5
- package/src/components/DashboardEditors.tsx +15 -0
- package/src/components/DashboardFilters/DashboardFilters.test.tsx +129 -0
- package/src/components/DashboardFilters/DashboardFilters.tsx +29 -10
- package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +12 -8
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/APIModal.tsx +6 -4
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/DeleteFilterModal.tsx +59 -58
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.test.tsx +127 -0
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +29 -6
- package/src/components/DashboardFilters/DashboardFiltersEditor/components/NestedDropDownDashboard.tsx +10 -9
- package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +8 -8
- package/src/components/DashboardFilters/_stories/DashboardFilters.stories.tsx +1 -1
- package/src/components/DashboardFilters/dashboardfilter.styles.css +3 -3
- package/src/components/DataDesignerModal.tsx +2 -2
- package/src/components/ExpandCollapseButtons.tsx +6 -4
- package/src/components/Grid.tsx +4 -3
- package/src/components/Header/Header.tsx +27 -5
- package/src/components/Header/index.scss +1 -1
- package/src/components/MultiConfigTabs/MultiConfigTabs.tsx +141 -140
- package/src/components/MultiConfigTabs/multiconfigtabs.styles.css +6 -6
- package/src/components/Row.tsx +30 -8
- package/src/components/Toggle/toggle-style.css +7 -7
- package/src/components/VisualizationRow.tsx +81 -22
- package/src/components/VisualizationsPanel/VisualizationsPanel.tsx +2 -55
- package/src/components/VisualizationsPanel/visualizations-panel-styles.css +2 -2
- package/src/components/Widget/Widget.tsx +7 -6
- package/src/components/Widget/widget.styles.css +48 -17
- package/src/data/initial-state.js +2 -1
- package/src/helpers/addVisualization.ts +73 -0
- package/src/helpers/formatConfigBeforeSave.ts +1 -1
- package/src/helpers/getVizConfig.ts +13 -3
- package/src/helpers/iconHash.tsx +45 -36
- package/src/helpers/processDataLegacy.ts +19 -14
- package/src/helpers/tests/addVisualization.test.ts +52 -0
- package/src/helpers/tests/formatConfigBeforeSave.test.ts +81 -1
- package/src/scss/editor-panel.scss +1 -1
- package/src/scss/grid.scss +38 -8
- package/src/scss/main.scss +237 -40
- package/src/store/dashboard.reducer.ts +2 -1
- package/src/test/CdcDashboard.test.jsx +26 -2
- package/src/test/CdcDashboardComponent.test.tsx +74 -0
- package/src/types/FilterStyles.ts +2 -1
- package/src/types/SharedFilter.ts +1 -0
- package/tests/fixtures/dashboard-config-with-metadata.json +89 -0
- package/vite.config.js +2 -2
- package/dist/cdcdashboard-Cf9_fbQf.es.js +0 -6
- package/examples/DEV-6574.json +0 -2224
- package/examples/api-dashboard-data.json +0 -272
- package/examples/api-dashboard-years.json +0 -11
- package/examples/api-geographies-data.json +0 -11
- package/examples/chart-data.json +0 -5409
- package/examples/custom/css/respiratory.css +0 -236
- package/examples/custom/js/respiratory.js +0 -242
- package/examples/default-data.json +0 -368
- package/examples/default-filter-control.json +0 -209
- package/examples/default-multi-dataset-shared-filter.json +0 -1729
- package/examples/default-multi-dataset.json +0 -506
- package/examples/ed-visits-county-file.json +0 -402
- package/examples/filters/Alabama.json +0 -72
- package/examples/filters/Alaska.json +0 -1737
- package/examples/filters/Arkansas.json +0 -4713
- package/examples/filters/California.json +0 -212
- package/examples/filters/Colorado.json +0 -1500
- package/examples/filters/Connecticut.json +0 -559
- package/examples/filters/Delaware.json +0 -63
- package/examples/filters/DistrictofColumbia.json +0 -63
- package/examples/filters/Florida.json +0 -4217
- package/examples/filters/States.json +0 -146
- package/examples/state-level.json +0 -90136
- package/examples/state-points.json +0 -10474
- package/examples/temp-example-data.json +0 -130
- package/examples/test-dashboard-simple.json +0 -503
- package/examples/test-example.json +0 -752
- package/examples/test-file.json +0 -147
- package/examples/test.json +0 -752
- package/examples/testing.json +0 -94456
- /package/examples/{legend-issue-data.json → __data__/legend-issue-data.json} +0 -0
- /package/examples/api-test/{categories.json → __data__/categories.json} +0 -0
- /package/examples/api-test/{chart-data.json → __data__/chart-data.json} +0 -0
- /package/examples/api-test/{topics.json → __data__/topics.json} +0 -0
- /package/examples/api-test/{years.json → __data__/years.json} +0 -0
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .cove-dashboard-filters #filter-2,
|
|
3
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .cove-dashboard-filters label[for="filter-2"]{
|
|
4
|
-
display: none;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .cove-dashboard-filters {
|
|
9
|
-
max-width: 150px;
|
|
10
|
-
margin: 0.5em !important;
|
|
11
|
-
margin-bottom: 0 !important;
|
|
12
|
-
vertical-align: middle;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .cove-dashboard-filters:nth-child(3){
|
|
16
|
-
vertical-align: middle;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .cove-dashboard-filters:nth-child(3)::after{
|
|
20
|
-
content: 'Reset';
|
|
21
|
-
padding: .375rem .75rem;
|
|
22
|
-
font-size: 1rem;
|
|
23
|
-
color: #fff;
|
|
24
|
-
background-color: #005eaa;
|
|
25
|
-
border-radius: .1875rem;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(1),
|
|
30
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(1) .dashboard-col {
|
|
31
|
-
margin-bottom: 0 !important;
|
|
32
|
-
display: block;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row.no-county:nth-child(1)::after {
|
|
36
|
-
content: 'Please select "All" to see values for your state.';
|
|
37
|
-
display: block;
|
|
38
|
-
margin-left: .5em;
|
|
39
|
-
margin-bottom: 1em;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row.no-county:nth-child(1) .dashboard-col::after {
|
|
43
|
-
content: 'County-level data unavailable';
|
|
44
|
-
display: block;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
margin-left: .5em;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row.no-counties:nth-child(1) .dashboard-col::after {
|
|
50
|
-
content: 'County level displays are not available for this state/territory';
|
|
51
|
-
display: block;
|
|
52
|
-
font-weight: bold;
|
|
53
|
-
margin-left: .5em;
|
|
54
|
-
margin-bottom: 1em;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4){
|
|
58
|
-
display: none !important;
|
|
59
|
-
justify-content: normal !important;
|
|
60
|
-
column-gap: normal !important;
|
|
61
|
-
position: relative;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .cove-component__content {
|
|
65
|
-
padding-top: 0;
|
|
66
|
-
border: 1px solid gray !important;
|
|
67
|
-
border-top: none !important;
|
|
68
|
-
border-bottom-left-radius: 0;
|
|
69
|
-
border-bottom-right-radius: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) header {
|
|
74
|
-
border: 1px solid gray;
|
|
75
|
-
background-color: lightgray;
|
|
76
|
-
color: black;
|
|
77
|
-
border-top-left-radius: 0 !important;
|
|
78
|
-
border-top-right-radius: 0 !important;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) header::before {
|
|
82
|
-
content: '';
|
|
83
|
-
display: inline-block;
|
|
84
|
-
width: 1em;
|
|
85
|
-
height: 1em;
|
|
86
|
-
border-radius: .5em;
|
|
87
|
-
border: 1px solid lightgray;
|
|
88
|
-
margin-right: .5em;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .dashboard-col:nth-child(1) header::before {
|
|
92
|
-
display: none;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .dashboard-col:nth-child(2) header::before {
|
|
96
|
-
background-color: rgb(244, 128, 42);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .dashboard-col:nth-child(3) header::before {
|
|
100
|
-
background-color: rgb(15, 102, 200);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .dashboard-col:nth-child(4) header::before {
|
|
104
|
-
background-color: rgb(148, 3, 111);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) .dashboard-col:nth-child(1) p::before {
|
|
108
|
-
display: none;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) p {
|
|
112
|
-
padding-top: 1.5em;
|
|
113
|
-
min-height: 3.5em;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) p::before {
|
|
117
|
-
content: '\2192';
|
|
118
|
-
font-weight: 900;
|
|
119
|
-
font-size: xx-large;
|
|
120
|
-
display: inline-block;
|
|
121
|
-
color: rgb(15, 102, 200);
|
|
122
|
-
vertical-align: top;
|
|
123
|
-
line-height: .5em;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) p.increasing::before {
|
|
127
|
-
transform: rotate(-45deg);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4) p.decreasing::before {
|
|
131
|
-
transform: rotate(45deg);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(4)::before {
|
|
135
|
-
content: 'County Trends';
|
|
136
|
-
position: absolute;
|
|
137
|
-
top: -2em;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) {
|
|
141
|
-
display: block;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col {
|
|
145
|
-
display: inline-block;
|
|
146
|
-
vertical-align: top;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(1) {
|
|
150
|
-
width: calc(150px + 3em);
|
|
151
|
-
margin-left: -.5em;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(1)::before {
|
|
155
|
-
position: relative;
|
|
156
|
-
content: 'Selection:';
|
|
157
|
-
margin-left: 1rem;
|
|
158
|
-
top: .6em;
|
|
159
|
-
font-weight: bold;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) {
|
|
163
|
-
width: calc(100% - 150px - 4.5em);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) .theme-blue {
|
|
167
|
-
background-color: #EEE;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) h2 {
|
|
171
|
-
color: black !important;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header {
|
|
175
|
-
background: none;
|
|
176
|
-
border: none;
|
|
177
|
-
color: black;
|
|
178
|
-
position: relative;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header.show-modal::before {
|
|
182
|
-
content: 'x';
|
|
183
|
-
position: absolute;
|
|
184
|
-
right: calc(5% + 1em);
|
|
185
|
-
top: -150px;
|
|
186
|
-
z-index: 1;
|
|
187
|
-
cursor: pointer;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header.show-modal::after {
|
|
191
|
-
content: 'Groups of counties often share healthcare resources. The data shown for the selected county include emergency department visit data collected for the entire area (which may include multiple counties).';
|
|
192
|
-
position: absolute;
|
|
193
|
-
bottom: calc(100% + 1em);
|
|
194
|
-
right: 5%;
|
|
195
|
-
padding: .5em 2em 5em .5em;
|
|
196
|
-
height: 140px;
|
|
197
|
-
width: 250px;
|
|
198
|
-
background-color: rgb(243,247,251);
|
|
199
|
-
color: rgb(56,100,151);
|
|
200
|
-
border: 1px solid rgb(56,100,151);
|
|
201
|
-
border-radius: 5px;
|
|
202
|
-
max-width: 80%;
|
|
203
|
-
font-size: .8em;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header h2::after {
|
|
207
|
-
content: 'More Info';
|
|
208
|
-
cursor: pointer;
|
|
209
|
-
text-decoration: underline;
|
|
210
|
-
color:#0000EE;
|
|
211
|
-
float: right;
|
|
212
|
-
font-weight: normal;
|
|
213
|
-
margin-left: 1em;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header div {
|
|
217
|
-
font-weight: bold;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row.state-level:nth-child(4)::before {
|
|
221
|
-
content: 'State Trends';
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .margin-left-href {
|
|
225
|
-
display: none;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
@media screen and (max-width: 767px) {
|
|
229
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col {
|
|
230
|
-
width: 100% !important;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
div[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"] .dashboard-row:nth-child(2) .dashboard-col:nth-child(2) {
|
|
234
|
-
margin-bottom: 2em;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
$(document).ready(function() {
|
|
2
|
-
function trackMetric(interactionValue){
|
|
3
|
-
if ( window.hasOwnProperty( '_satellite' ) ) {
|
|
4
|
-
var dataObject = {};
|
|
5
|
-
var _satellite = window._satellite;
|
|
6
|
-
var eventLabel = 'respiratory-dasboard-chart';
|
|
7
|
-
var eventValue = interactionValue.replace(/ /g, '-').toLowerCase();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
dataObject.ch = 'OADC';
|
|
12
|
-
dataObject.pageName = document.title;
|
|
13
|
-
dataObject.label = eventLabel;
|
|
14
|
-
dataObject.interactionType = 'o';
|
|
15
|
-
dataObject.interactionValue = 'ci-' + eventLabel + ': ' + eventValue;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_satellite.track( 'interaction', dataObject );
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function onSelectChange(e){
|
|
24
|
-
trackMetric('state-select-' + $(e.target).find('option:selected').text());
|
|
25
|
-
if(e.target.id === 'filter-0'){
|
|
26
|
-
setTimeout(function(){
|
|
27
|
-
var $countySelect = $viz.find('#filter-1');
|
|
28
|
-
var select = $countySelect[0];
|
|
29
|
-
$countySelect.val('All');
|
|
30
|
-
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(select, 'All');
|
|
31
|
-
select.dispatchEvent(new Event('change', { bubbles: true}));
|
|
32
|
-
}, 50);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function onMoreInfoClick(e){
|
|
37
|
-
if(!e.keyCode || e.keyCode === 13){
|
|
38
|
-
var $moreInfoLink = $viz.find('.dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header');
|
|
39
|
-
if($moreInfoLink.hasClass('show-modal')){
|
|
40
|
-
$moreInfoLink.removeClass('show-modal');
|
|
41
|
-
} else {
|
|
42
|
-
$moreInfoLink.addClass('show-modal');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function onResetClick(e){
|
|
48
|
-
if(!e.keyCode || e.keyCode === 13){
|
|
49
|
-
var $stateSelect = $viz.find('#filter-0');
|
|
50
|
-
var select = $stateSelect[0];
|
|
51
|
-
$stateSelect.val('United States');
|
|
52
|
-
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(select, 'United States');
|
|
53
|
-
select.dispatchEvent(new Event('change', { bubbles: true}));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var $viz = $('.wcms-viz-container[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"]')
|
|
58
|
-
|
|
59
|
-
var observer = new MutationObserver(function(mutations, observer) {
|
|
60
|
-
var $select = $viz.find('select');
|
|
61
|
-
if($select.length > 0){
|
|
62
|
-
$select.off('change', onSelectChange)
|
|
63
|
-
$select.on('change', onSelectChange)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var $resetButton = $viz.find('.cove-dashboard-filters:nth-child(3)');
|
|
67
|
-
if($resetButton.length > 0){
|
|
68
|
-
$resetButton.off('click keypress', onResetClick)
|
|
69
|
-
$resetButton.on('click keypress', onResetClick)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var $moreInfoLink = $viz.find('.dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header');
|
|
73
|
-
if($moreInfoLink.length > 0){
|
|
74
|
-
$moreInfoLink.off('click keypress', onMoreInfoClick)
|
|
75
|
-
$moreInfoLink.on('click keypress', onMoreInfoClick)
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
if($viz.length > 0){
|
|
80
|
-
observer.observe($viz[0], {
|
|
81
|
-
subtree: true,
|
|
82
|
-
attributes: true
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
$(document).ready(function() {
|
|
88
|
-
var $viz = $('.wcms-viz-container[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"');
|
|
89
|
-
var hasStateChanged = false;
|
|
90
|
-
var hasCountyChanged = false;
|
|
91
|
-
|
|
92
|
-
function onMutation(mutations, observer) {
|
|
93
|
-
var $stateSelect = $viz.find('#filter-0');
|
|
94
|
-
var $countySelect = $viz.find('#filter-1');
|
|
95
|
-
|
|
96
|
-
var hashVal = window.location.hash ? decodeURIComponent(window.location.hash.replace('#', '')) : '';
|
|
97
|
-
var stateVal
|
|
98
|
-
var countyVal
|
|
99
|
-
if(hashVal.indexOf(',') !== -1){
|
|
100
|
-
stateVal = hashVal.split(',')[0]
|
|
101
|
-
countyVal = hashVal.split(',')[1]
|
|
102
|
-
} else {
|
|
103
|
-
stateVal = hashVal
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if(stateVal === 'District Of Columbia') stateVal = 'District of Columbia';
|
|
107
|
-
|
|
108
|
-
if(stateVal && !hasStateChanged && $stateSelect.length > 0){
|
|
109
|
-
var options = $stateSelect.find('option').toArray().map(el => el.value ? el.value.toLowerCase() : '');
|
|
110
|
-
if(stateVal && options.length > 0 && options.indexOf(stateVal.toLowerCase()) !== -1){
|
|
111
|
-
var select = $stateSelect[0];
|
|
112
|
-
$stateSelect.val(stateVal);
|
|
113
|
-
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(select, stateVal);
|
|
114
|
-
select.dispatchEvent(new Event('change', { bubbles: true}));
|
|
115
|
-
$viz[0].scrollIntoView();
|
|
116
|
-
|
|
117
|
-
hasStateChanged = true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if(countyVal && !hasCountyChanged && hasStateChanged && $countySelect.length > 0){
|
|
121
|
-
var options = $countySelect.find('option').toArray().map(el => el.value ? el.value.toLowerCase() : '');
|
|
122
|
-
if(options.length > 0 && options.indexOf(countyVal.toLowerCase()) !== -1){
|
|
123
|
-
var select = $countySelect[0];
|
|
124
|
-
$countySelect.val(countyVal);
|
|
125
|
-
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(select, countyVal);
|
|
126
|
-
select.dispatchEvent(new Event('change', { bubbles: true}));
|
|
127
|
-
$viz[0].scrollIntoView();
|
|
128
|
-
|
|
129
|
-
hasCountyChanged = true;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if($viz.length > 0){
|
|
136
|
-
onMutation();
|
|
137
|
-
|
|
138
|
-
var observer = new MutationObserver(onMutation);
|
|
139
|
-
|
|
140
|
-
observer.observe($viz[0], {
|
|
141
|
-
subtree: true,
|
|
142
|
-
attributes: true
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
$(document).ready(function() {
|
|
148
|
-
var suppressedFlags;
|
|
149
|
-
var $viz = $('.wcms-viz-container[data-config-url="/respiratory-viruses/modules/ed-visits-county-file.json"]')
|
|
150
|
-
|
|
151
|
-
if($viz.length > 0){
|
|
152
|
-
$.get("https://www.cdc.gov/wcms/vizdata/Respitory_Viruses/NSSPSubStateOptOut.json", function( data ) {
|
|
153
|
-
suppressedFlags = data;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
setInterval(function(){
|
|
157
|
-
var $select = $viz.find('#filter-0');
|
|
158
|
-
var $countySelect = $viz.find('#filter-1');
|
|
159
|
-
var $targetSelect = $viz.find('#filter-2');
|
|
160
|
-
|
|
161
|
-
if($select.val() !== $targetSelect.val()){
|
|
162
|
-
setTimeout(function(){
|
|
163
|
-
var targetSelect = $targetSelect[0];
|
|
164
|
-
$targetSelect.val($select.val()).trigger('change');
|
|
165
|
-
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(targetSelect, $select.val());
|
|
166
|
-
targetSelect.dispatchEvent(new Event('change', { bubbles: true}));
|
|
167
|
-
$select.val($select.val())
|
|
168
|
-
|
|
169
|
-
}, 50);
|
|
170
|
-
}
|
|
171
|
-
}, 200);
|
|
172
|
-
|
|
173
|
-
var observer = new MutationObserver(function(mutations, observer) {
|
|
174
|
-
var $select = $viz.find('#filter-0');
|
|
175
|
-
var $countySelect = $viz.find('#filter-1');
|
|
176
|
-
var $targetSelect = $viz.find('#filter-2');
|
|
177
|
-
|
|
178
|
-
if($countySelect.find('option').length === 1 && $select.val() !== 'District of Columbia' && $select.val() !== 'United States'){
|
|
179
|
-
$viz.find('.dashboard-row:nth-child(1)').addClass('no-counties');
|
|
180
|
-
$viz.find('.dashboard-row:nth-child(4)').removeClass('county-level').addClass('state-level');
|
|
181
|
-
} else {
|
|
182
|
-
$viz.find('.dashboard-row:nth-child(1)').removeClass('no-counties');
|
|
183
|
-
$viz.find('.dashboard-row:nth-child(4)').removeClass('state-level').addClass('county-level');
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if(suppressedFlags){
|
|
187
|
-
var suppressedNode = suppressedFlags.find(function(d){
|
|
188
|
-
if(d['geography'] === $select.val() && d['county'] === $countySelect.val()){
|
|
189
|
-
return true
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
if(suppressedNode && suppressedNode['is_hsa_opt_out'] === 'true'){
|
|
193
|
-
$viz.find('.cdc-chart-inner-container').hide()
|
|
194
|
-
$viz.find('.dashboard-row:nth-child(1)').addClass('no-county');
|
|
195
|
-
} else {
|
|
196
|
-
$viz.find('.dashboard-row:nth-child(1)').removeClass('no-county');
|
|
197
|
-
$viz.find('.cdc-chart-inner-container').show()
|
|
198
|
-
}
|
|
199
|
-
} else {
|
|
200
|
-
$viz.find('.dashboard-row:nth-child(1)').removeClass('no-county');
|
|
201
|
-
$viz.find('.cdc-chart-inner-container').show()
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
var countyAll = $countySelect.find('option[value="All"]')
|
|
205
|
-
if(countyAll.length === 1 && countyAll.index() !== 0){
|
|
206
|
-
countyAll.remove();
|
|
207
|
-
$countySelect.prepend(countyAll);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
var stateAll = $select.find('option[value="United States"]')
|
|
211
|
-
if(stateAll.length === 1 && stateAll.index() !== 0){
|
|
212
|
-
stateAll.remove();
|
|
213
|
-
$select.prepend(stateAll);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
$viz.find('.dashboard-row:nth-child(4) p').each(function(index, el){
|
|
217
|
-
var className = el.innerText.trim().toLowerCase().replace(' ', '-');
|
|
218
|
-
if(!$(el).hasClass(className)){
|
|
219
|
-
$(el).removeClass('increasing decreasing')
|
|
220
|
-
$(el).addClass(className);
|
|
221
|
-
}
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
if($viz.find('.dashboard-row:nth-child(4) .dashboard-col').length === 3){
|
|
225
|
-
$viz.find('.dashboard-row:nth-child(4)').prepend('<div class="dashboard-col dashboard-col-4"><div class="cove theme-blue "><header class="cove-component__header theme-blue " style="font-size: 16px;">Respiratory Illness</header><div class="cove-component__content component--has-title no-borders"><div class="cove-component__content-wrap"><p class="decreasing" style="font-size: 16px;">Weekly Trend</p></div></div></div></div>');
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if($viz.find('.dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header').length > 0 && !$viz.find('.dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header').attr('tabindex')){
|
|
229
|
-
$viz.find('.dashboard-row:nth-child(2) .dashboard-col:nth-child(2) header').attr('tabindex', '0');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if($viz.find('.cove-dashboard-filters:nth-child(3)').length > 0 && !$viz.find('.cove-dashboard-filters:nth-child(3)').attr('tabindex')){
|
|
233
|
-
$viz.find('.cove-dashboard-filters:nth-child(3)').attr('tabindex', '0');
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
observer.observe($viz[0], {
|
|
238
|
-
subtree: true,
|
|
239
|
-
attributes: true
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
});
|