@cdc/dashboard 4.25.1 → 4.25.3-6

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 (38) hide show
  1. package/dist/cdcdashboard.js +53114 -52737
  2. package/examples/all-components.json +529 -4607
  3. package/examples/dashboard-gallery.json +397 -397
  4. package/examples/private/DEV-10527.json +845 -0
  5. package/examples/private/DEV-10586.json +54319 -0
  6. package/examples/private/DEV-10856.json +54319 -0
  7. package/examples/private/DEV-9932.json +95 -0
  8. package/examples/private/dashboard-map-filter.json +815 -0
  9. package/examples/private/dev-10856-2.json +1348 -0
  10. package/examples/private/feelings.json +1 -0
  11. package/examples/private/markup.json +115 -0
  12. package/examples/private/nhis.json +1792 -0
  13. package/index.html +4 -3
  14. package/package.json +9 -9
  15. package/src/CdcDashboard.tsx +5 -8
  16. package/src/CdcDashboardComponent.tsx +58 -56
  17. package/src/_stories/Dashboard.stories.tsx +31 -0
  18. package/src/_stories/_mock/dashboard-filter-asc.json +551 -0
  19. package/src/components/CollapsibleVisualizationRow.tsx +1 -1
  20. package/src/components/DashboardFilters/DashboardFilters.tsx +10 -5
  21. package/src/components/DashboardFilters/DashboardFiltersEditor/DashboardFiltersEditor.tsx +22 -5
  22. package/src/components/DashboardFilters/DashboardFiltersEditor/components/DeleteFilterModal.tsx +13 -3
  23. package/src/components/DashboardFilters/DashboardFiltersEditor/components/FilterEditor.tsx +129 -40
  24. package/src/components/DashboardFilters/DashboardFiltersEditor/components/NestedDropDownDashboard.tsx +10 -7
  25. package/src/components/DashboardFilters/DashboardFiltersWrapper.tsx +11 -12
  26. package/src/components/DashboardFilters/dashboardfilter.styles.css +0 -2
  27. package/src/components/VisualizationRow.tsx +29 -15
  28. package/src/helpers/addValuesToDashboardFilters.ts +6 -5
  29. package/src/helpers/apiFilterHelpers.ts +10 -5
  30. package/src/helpers/changeFilterActive.ts +17 -4
  31. package/src/helpers/getFilteredData.ts +13 -4
  32. package/src/helpers/getUpdateConfig.ts +11 -4
  33. package/src/helpers/loadAPIFilters.ts +6 -4
  34. package/src/helpers/tests/updatesChildFilters.test.ts +56 -0
  35. package/src/helpers/updateChildFilters.ts +50 -0
  36. package/src/scss/main.scss +0 -3
  37. package/src/store/dashboard.reducer.ts +46 -24
  38. package/src/types/SharedFilter.ts +1 -1
@@ -0,0 +1,551 @@
1
+ {
2
+ "dashboard": {
3
+ "theme": "theme-blue",
4
+ "title": "Amount Filtered by Location and Type ",
5
+ "sharedFilters": [
6
+ {
7
+ "values": [
8
+ "Alaska",
9
+ "Alabama",
10
+ "Arkansas",
11
+ "American Samoa",
12
+ "Arizona"
13
+ ],
14
+ "columnName": "Location",
15
+ "showDropdown": true,
16
+ "usedBy": [
17
+ "data-bite1628875468150",
18
+ "chart1628875631849",
19
+ "data-bite1628876561387",
20
+ "data-bite1628877031319"
21
+ ],
22
+ "tier": 1,
23
+ "type": "datafilter",
24
+ "order": "asc",
25
+ "orderedValues": [
26
+ "American Samoa",
27
+ "Alaska",
28
+ "Alabama",
29
+ "Arizona",
30
+ "Arkansas"
31
+ ]
32
+ },
33
+ {
34
+ "values": [
35
+ "Federal",
36
+ "Local",
37
+ "State"
38
+ ],
39
+ "columnName": "Type",
40
+ "showDropdown": true,
41
+ "usedBy": [
42
+ "data-bite1628875468150",
43
+ "chart1628875631849",
44
+ "data-bite1628876561387",
45
+ "data-bite1628877031319"
46
+ ],
47
+ "tier": 1
48
+ }
49
+ ]
50
+ },
51
+ "rows": [
52
+ {
53
+ "columns": [
54
+ {
55
+ "width": 12,
56
+ "widget": "legacySharedFilters"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "columns": [
62
+ {
63
+ "width": 6,
64
+ "widget": "data-bite1628875468150"
65
+ },
66
+ {
67
+ "width": 6,
68
+ "widget": "chart1628875631849"
69
+ },
70
+ {
71
+ "width": null
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "columns": [
77
+ {
78
+ "width": 6,
79
+ "widget": "data-bite1628877031319"
80
+ },
81
+ {
82
+ "width": 6,
83
+ "widget": "data-bite1628876561387"
84
+ },
85
+ {
86
+ "width": null
87
+ }
88
+ ]
89
+ }
90
+ ],
91
+ "visualizations": {
92
+ "data-bite1628875468150": {
93
+ "type": "data-bite",
94
+ "dataBite": "",
95
+ "dataFunction": "Mean (Average)",
96
+ "dataColumn": "Amount",
97
+ "bitePosition": "Left",
98
+ "biteFontSize": 24,
99
+ "fontSize": "medium",
100
+ "biteBody": "<span style=\"font-size: 20px;\">Average Amount 2019-2021</span> <br>Reflects the average of the dashboard level filter selections within the timeframe available in the data. In this case 2019-2021. \n This number is calculated within the Data Bite module.\n",
101
+ "imageData": {
102
+ "display": "none",
103
+ "url": "",
104
+ "alt": "",
105
+ "options": []
106
+ },
107
+ "dataFormat": {
108
+ "roundToPlace": 0,
109
+ "commas": true,
110
+ "prefix": "",
111
+ "suffix": ""
112
+ },
113
+ "biteStyle": "graphic",
114
+ "filters": [],
115
+ "subtext": "Citation for Source ",
116
+ "title": "",
117
+ "theme": "theme-orange",
118
+ "shadow": true,
119
+ "visual": {
120
+ "border": false,
121
+ "accent": false,
122
+ "background": false,
123
+ "hideBackgroundColor": false,
124
+ "borderColorTheme": false
125
+ },
126
+ "general": {
127
+ "isCompactStyle": false
128
+ },
129
+ "imageUrl": "",
130
+ "prefix": "",
131
+ "suffix": "",
132
+ "uid": "data-bite1628875468150",
133
+ "visualizationType": "data-bite",
134
+ "dataKey": "dashboard_aggregate_example_no_add_fullname.csv",
135
+ "version": "4.25.1",
136
+ "migrations": {
137
+ "addColorMigration": true
138
+ }
139
+ },
140
+ "chart1628875631849": {
141
+ "type": "chart",
142
+ "title": "",
143
+ "theme": "theme-blue",
144
+ "fontSize": "large",
145
+ "height": "200",
146
+ "padding": {
147
+ "left": 5,
148
+ "right": 5
149
+ },
150
+ "yAxis": {
151
+ "size": "80",
152
+ "gridLines": false,
153
+ "label": "Amount",
154
+ "numTicks": "4"
155
+ },
156
+ "barThickness": 0.35,
157
+ "xAxis": {
158
+ "size": "0",
159
+ "tickRotation": 0,
160
+ "dataKey": "Year",
161
+ "label": ""
162
+ },
163
+ "table": {
164
+ "label": "Data Table",
165
+ "expanded": false,
166
+ "show": false
167
+ },
168
+ "legend": {
169
+ "behavior": "isolate",
170
+ "position": "right",
171
+ "hide": true
172
+ },
173
+ "palette": "qualitative-bold",
174
+ "labels": true,
175
+ "dataFormat": {},
176
+ "confidenceKeys": {},
177
+ "uid": "chart1628875631849",
178
+ "visualizationType": "Bar",
179
+ "series": [
180
+ {
181
+ "dataKey": "Amount",
182
+ "type": "Bar"
183
+ }
184
+ ],
185
+ "dataKey": "dashboard_aggregate_example_no_add_fullname.csv"
186
+ },
187
+ "data-bite1628876561387": {
188
+ "type": "data-bite",
189
+ "dataBite": "",
190
+ "dataFunction": "Max",
191
+ "dataColumn": "Amount",
192
+ "bitePosition": "Right",
193
+ "biteFontSize": "58",
194
+ "fontSize": "medium",
195
+ "imageUrl": "",
196
+ "biteBody": "<span style=\"font-size: 24px;\"> Peak Amount</span> <br>Reflects the maximum point of data within the dashboard level filter selections within the timeframe set in the data. In this case 2019-2021. \nThis number is calculated within the Data Bite module.\n",
197
+ "prefix": "",
198
+ "suffix": "",
199
+ "dataFormat": {
200
+ "roundToPlace": 0,
201
+ "commas": true,
202
+ "prefix": "",
203
+ "suffix": ""
204
+ },
205
+ "biteStyle": "title",
206
+ "filters": [],
207
+ "subtext": "Source",
208
+ "title": "",
209
+ "theme": "theme-blue",
210
+ "shadow": true,
211
+ "uid": "data-bite1628876561387",
212
+ "visualizationType": "data-bite",
213
+ "dataKey": "dashboard_aggregate_example_no_add_fullname.csv"
214
+ },
215
+ "data-bite1628877031319": {
216
+ "type": "data-bite",
217
+ "dataBite": "",
218
+ "dataFunction": "Sum",
219
+ "dataColumn": "Amount",
220
+ "bitePosition": "Right",
221
+ "biteFontSize": "58",
222
+ "fontSize": "medium",
223
+ "imageUrl": "",
224
+ "biteBody": "<span style=\"font-size: 24px;\">State Total</span> <br>Reflects the Sum total of the dashboard level filter selections within the timeframe set in the data. In this case 2019-2021. \n This number is calculated within the Data Bite module.\n",
225
+ "prefix": "",
226
+ "suffix": "",
227
+ "dataFormat": {
228
+ "roundToPlace": 0,
229
+ "commas": true,
230
+ "prefix": "",
231
+ "suffix": ""
232
+ },
233
+ "biteStyle": "title",
234
+ "filters": [
235
+ {
236
+ "id": 1738001923264
237
+ }
238
+ ],
239
+ "subtext": "Source ",
240
+ "title": "",
241
+ "theme": "theme-amber",
242
+ "shadow": true,
243
+ "uid": "data-bite1628877031319",
244
+ "visualizationType": "data-bite",
245
+ "dataKey": "dashboard_aggregate_example_no_add_fullname.csv"
246
+ },
247
+ "legacySharedFilters": {
248
+ "type": "dashboardFilters",
249
+ "visualizationType": "dashboardFilters",
250
+ "sharedFilterIndexes": [
251
+ 0,
252
+ 1
253
+ ],
254
+ "filterBehavior": "Filter Change",
255
+ "uid": "legacySharedFilters"
256
+ }
257
+ },
258
+ "table": {
259
+ "label": "Data Table",
260
+ "show": true
261
+ },
262
+ "data": [],
263
+ "dataFileName": "",
264
+ "dataFileSourceType": "",
265
+ "type": "dashboard",
266
+ "uuid": 1628875999137,
267
+ "runtime": {},
268
+ "datasets": {
269
+ "dashboard_aggregate_example_no_add_fullname.csv": {
270
+ "data": [
271
+ {
272
+ "Location": "Alaska",
273
+ "Year": "2019",
274
+ "Type": "Federal",
275
+ "Amount": "1377"
276
+ },
277
+ {
278
+ "Location": "Alaska",
279
+ "Year": "2019",
280
+ "Type": "Local",
281
+ "Amount": "1613"
282
+ },
283
+ {
284
+ "Location": "Alaska",
285
+ "Year": "2019",
286
+ "Type": "State",
287
+ "Amount": "1495"
288
+ },
289
+ {
290
+ "Location": "Alaska",
291
+ "Year": "2020",
292
+ "Type": "Federal",
293
+ "Amount": "1377"
294
+ },
295
+ {
296
+ "Location": "Alaska",
297
+ "Year": "2020",
298
+ "Type": "Local",
299
+ "Amount": "1613"
300
+ },
301
+ {
302
+ "Location": "Alaska",
303
+ "Year": "2020",
304
+ "Type": "State",
305
+ "Amount": "1495"
306
+ },
307
+ {
308
+ "Location": "Alaska",
309
+ "Year": "2021",
310
+ "Type": "Federal",
311
+ "Amount": "1436"
312
+ },
313
+ {
314
+ "Location": "Alaska",
315
+ "Year": "2021",
316
+ "Type": "Local",
317
+ "Amount": "1672"
318
+ },
319
+ {
320
+ "Location": "Alaska",
321
+ "Year": "2021",
322
+ "Type": "State",
323
+ "Amount": "1554"
324
+ },
325
+ {
326
+ "Location": "Alabama",
327
+ "Year": "2019",
328
+ "Type": "Federal",
329
+ "Amount": "1375"
330
+ },
331
+ {
332
+ "Location": "Alabama",
333
+ "Year": "2019",
334
+ "Type": "Local",
335
+ "Amount": "1611"
336
+ },
337
+ {
338
+ "Location": "Alabama",
339
+ "Year": "2019",
340
+ "Type": "State",
341
+ "Amount": "1493"
342
+ },
343
+ {
344
+ "Location": "Alabama",
345
+ "Year": "2020",
346
+ "Type": "Federal",
347
+ "Amount": "1375"
348
+ },
349
+ {
350
+ "Location": "Alabama",
351
+ "Year": "2020",
352
+ "Type": "Local",
353
+ "Amount": "1611"
354
+ },
355
+ {
356
+ "Location": "Alabama",
357
+ "Year": "2020",
358
+ "Type": "State",
359
+ "Amount": "1493"
360
+ },
361
+ {
362
+ "Location": "Alabama",
363
+ "Year": "2021",
364
+ "Type": "Federal",
365
+ "Amount": "1434"
366
+ },
367
+ {
368
+ "Location": "Alabama",
369
+ "Year": "2021",
370
+ "Type": "Local",
371
+ "Amount": "1670"
372
+ },
373
+ {
374
+ "Location": "Alabama",
375
+ "Year": "2021",
376
+ "Type": "State",
377
+ "Amount": "1552"
378
+ },
379
+ {
380
+ "Location": "Arkansas",
381
+ "Year": "2019",
382
+ "Type": "Federal",
383
+ "Amount": "1398"
384
+ },
385
+ {
386
+ "Location": "Arkansas",
387
+ "Year": "2019",
388
+ "Type": "Local",
389
+ "Amount": "1634"
390
+ },
391
+ {
392
+ "Location": "Arkansas",
393
+ "Year": "2019",
394
+ "Type": "State",
395
+ "Amount": "1516"
396
+ },
397
+ {
398
+ "Location": "Arkansas",
399
+ "Year": "2020",
400
+ "Type": "Federal",
401
+ "Amount": "1398"
402
+ },
403
+ {
404
+ "Location": "Arkansas",
405
+ "Year": "2020",
406
+ "Type": "Local",
407
+ "Amount": "1634"
408
+ },
409
+ {
410
+ "Location": "Arkansas",
411
+ "Year": "2020",
412
+ "Type": "State",
413
+ "Amount": "1516"
414
+ },
415
+ {
416
+ "Location": "Arkansas",
417
+ "Year": "2021",
418
+ "Type": "Federal",
419
+ "Amount": "1457"
420
+ },
421
+ {
422
+ "Location": "Arkansas",
423
+ "Year": "2021",
424
+ "Type": "Local",
425
+ "Amount": "1693"
426
+ },
427
+ {
428
+ "Location": "Arkansas",
429
+ "Year": "2021",
430
+ "Type": "State",
431
+ "Amount": "1575"
432
+ },
433
+ {
434
+ "Location": "American Samoa",
435
+ "Year": "2019",
436
+ "Type": "Federal",
437
+ "Amount": "1388"
438
+ },
439
+ {
440
+ "Location": "American Samoa",
441
+ "Year": "2019",
442
+ "Type": "Local",
443
+ "Amount": "1624"
444
+ },
445
+ {
446
+ "Location": "American Samoa",
447
+ "Year": "2019",
448
+ "Type": "State",
449
+ "Amount": "1506"
450
+ },
451
+ {
452
+ "Location": "American Samoa",
453
+ "Year": "2020",
454
+ "Type": "Federal",
455
+ "Amount": "1388"
456
+ },
457
+ {
458
+ "Location": "American Samoa",
459
+ "Year": "2020",
460
+ "Type": "Local",
461
+ "Amount": "1624"
462
+ },
463
+ {
464
+ "Location": "American Samoa",
465
+ "Year": "2020",
466
+ "Type": "State",
467
+ "Amount": "1506"
468
+ },
469
+ {
470
+ "Location": "American Samoa",
471
+ "Year": "2021",
472
+ "Type": "Federal",
473
+ "Amount": "1447"
474
+ },
475
+ {
476
+ "Location": "American Samoa",
477
+ "Year": "2021",
478
+ "Type": "Local",
479
+ "Amount": "1683"
480
+ },
481
+ {
482
+ "Location": "American Samoa",
483
+ "Year": "2021",
484
+ "Type": "State",
485
+ "Amount": "1565"
486
+ },
487
+ {
488
+ "Location": "Arizona",
489
+ "Year": "2019",
490
+ "Type": "Federal",
491
+ "Amount": "1401"
492
+ },
493
+ {
494
+ "Location": "Arizona",
495
+ "Year": "2019",
496
+ "Type": "Local",
497
+ "Amount": "1637"
498
+ },
499
+ {
500
+ "Location": "Arizona",
501
+ "Year": "2019",
502
+ "Type": "State",
503
+ "Amount": "1519"
504
+ },
505
+ {
506
+ "Location": "Arizona",
507
+ "Year": "2020",
508
+ "Type": "Federal",
509
+ "Amount": "1401"
510
+ },
511
+ {
512
+ "Location": "Arizona",
513
+ "Year": "2020",
514
+ "Type": "Local",
515
+ "Amount": "1637"
516
+ },
517
+ {
518
+ "Location": "Arizona",
519
+ "Year": "2020",
520
+ "Type": "State",
521
+ "Amount": "1519"
522
+ },
523
+ {
524
+ "Location": "Arizona",
525
+ "Year": "2021",
526
+ "Type": "Federal",
527
+ "Amount": "1460"
528
+ },
529
+ {
530
+ "Location": "Arizona",
531
+ "Year": "2021",
532
+ "Type": "Local",
533
+ "Amount": "1696"
534
+ },
535
+ {
536
+ "Location": "Arizona",
537
+ "Year": "2021",
538
+ "Type": "State",
539
+ "Amount": "1578"
540
+ }
541
+ ]
542
+ }
543
+ },
544
+ "dataUrl": "",
545
+ "dataDescription": {},
546
+ "formattedData": [],
547
+ "version": "4.25.1",
548
+ "migrations": {
549
+ "addColorMigration": true
550
+ }
551
+ }
@@ -28,7 +28,7 @@ const CollapsibleVisualizationRow: React.FC<CollapsableVizRow> = ({
28
28
  <div
29
29
  style={{ fontSize: titleFontSize }}
30
30
  role='button'
31
- className={`multi-visualiation-heading${isExpanded ? '' : ' collapsed'} h4`}
31
+ className={`multi-visualiation-heading${isExpanded ? '' : ' collapsed'} h4 my-0`}
32
32
  onClick={() => {
33
33
  setIsExpanded(!isExpanded)
34
34
  }}
@@ -37,6 +37,11 @@ const DashboardFilters: React.FC<DashboardFilterProps> = ({
37
37
  handleOnChange(fieldName, value) // fieldName is the sharedFilterIndex
38
38
  }
39
39
 
40
+ const stripDuplicateLabelIncrement = (label: string): string => {
41
+ // converts 'Label (1)' to 'Label'
42
+ return label.replace(/\s\(\d+\)$/, '')
43
+ }
44
+
40
45
  const getNestedDropdownOptions = (options?: DropdownOptions): NestedOptions => {
41
46
  if (!options) return []
42
47
  const getValueTextTuple = (value: string, text?: string): ValueTextPair => (text ? [value, text] : [value])
@@ -50,13 +55,13 @@ const DashboardFilters: React.FC<DashboardFilterProps> = ({
50
55
  <form className='d-flex flex-wrap'>
51
56
  {sharedFilters.map((filter, filterIndex) => {
52
57
  const urlFilterType = filter.type === 'urlfilter'
53
- const label = filter.key
58
+ const label = stripDuplicateLabelIncrement(filter.key || '')
54
59
 
55
60
  if (
56
61
  (!urlFilterType && !filter.showDropdown && filter.filterStyle !== FILTER_STYLE.nestedDropdown) ||
57
62
  (show && !show.includes(filterIndex))
58
63
  )
59
- return <React.Fragment key={`${label}-filtersection-${filterIndex}-option`} />
64
+ return <React.Fragment key={`${filter.key}-filtersection-${filterIndex}-option`} />
60
65
  const values: JSX.Element[] = []
61
66
 
62
67
  const _key = filter.apiFilter?.apiEndpoint
@@ -89,7 +94,8 @@ const DashboardFilters: React.FC<DashboardFilterProps> = ({
89
94
  }
90
95
  } else {
91
96
  // Data Filter
92
- filter.values?.forEach((filterOption, index) => {
97
+ const orderedFilterValues = filter.orderedValues || filter.values
98
+ orderedFilterValues?.forEach((filterOption, index) => {
93
99
  const labeledOpt = filter.labels && filter.labels[filterOption]
94
100
  const resetLabelHasMatch = (filterOption || labeledOpt) === filter.resetLabel
95
101
 
@@ -123,9 +129,8 @@ const DashboardFilters: React.FC<DashboardFilterProps> = ({
123
129
  }
124
130
 
125
131
  const formGroupClass = `form-group me-4 mb-1${loading ? ' loading-filter' : ''}`
126
-
127
132
  return (
128
- <div className={formGroupClass} key={`${label}-filtersection-${filterIndex}`}>
133
+ <div className={formGroupClass} key={`${filter.key}-filtersection-${filterIndex}`}>
129
134
  {label && (
130
135
  <label className='font-weight-bold mb-2' htmlFor={`filter-${filterIndex}`}>
131
136
  {label}
@@ -20,6 +20,7 @@ import { useGlobalContext } from '@cdc/core/components/GlobalContext'
20
20
  import DeleteFilterModal from './components/DeleteFilterModal'
21
21
  import { addValuesToDashboardFilters } from '../../../helpers/addValuesToDashboardFilters'
22
22
  import { FILTER_STYLE } from '../../../types/FilterStyles'
23
+ import { handleSorting } from '@cdc/core/components/Filters'
23
24
 
24
25
  type DashboardFitlersEditorProps = {
25
26
  vizConfig: DashboardFilters
@@ -60,11 +61,11 @@ const DashboardFiltersEditor: React.FC<DashboardFitlersEditorProps> = ({ vizConf
60
61
  subgroupTextSelector: oldSubgroupTextSelector
61
62
  } = sharedFilters[index].apiFilter || {}
62
63
  const apiFilterChanged =
63
- value.apiEndpoint !== oldEndpoint ||
64
- value.valueSelector !== oldValueSelector ||
65
- value.textSelector !== oldTextSelector ||
66
- value.subgroupValueSelector !== oldSubgroupValueSelector ||
67
- value.subgroupTextSelector !== oldSubgroupTextSelector
64
+ value?.apiEndpoint !== oldEndpoint ||
65
+ value?.valueSelector !== oldValueSelector ||
66
+ value?.textSelector !== oldTextSelector ||
67
+ value?.subgroupValueSelector !== oldSubgroupValueSelector ||
68
+ value?.subgroupTextSelector !== oldSubgroupTextSelector
68
69
 
69
70
  newSharedFilters[index][prop] = value
70
71
  if (prop === 'columnName') {
@@ -98,10 +99,22 @@ const DashboardFiltersEditor: React.FC<DashboardFitlersEditorProps> = ({ vizConf
98
99
  // automatically dispatches SET_SHARED_FILTERS
99
100
  loadAPIFilters(newSharedFilters, {})
100
101
  } else {
102
+ handleSorting(newSharedFilters[index])
101
103
  dispatch({ type: 'SET_SHARED_FILTERS', payload: newSharedFilters })
102
104
  }
103
105
  }
104
106
 
107
+ const toggleNestedQueryParameters = (index, checked: boolean) => {
108
+ const newSharedFilters = _.cloneDeep(sharedFilters)
109
+ const filter = newSharedFilters[index]
110
+ const isUrlFilter = filter.type === 'urlfilter'
111
+ const groupColumnName = isUrlFilter ? filter.apiFilter.valueSelector : filter.columnName
112
+ const subGroupColumnName = isUrlFilter ? filter.apiFilter.subgroupValueSelector : filter.subGrouping.columnName
113
+ filter.setByQueryParameter = checked ? groupColumnName : undefined
114
+ filter.subGrouping.setByQueryParameter = checked ? subGroupColumnName : undefined
115
+ dispatch({ type: 'SET_SHARED_FILTERS', payload: newSharedFilters })
116
+ }
117
+
105
118
  const removeFilter = index => {
106
119
  const newSharedFilters = _.cloneDeep(sharedFilters)
107
120
 
@@ -228,9 +241,13 @@ const DashboardFiltersEditor: React.FC<DashboardFitlersEditorProps> = ({ vizConf
228
241
  >
229
242
  <FilterEditor
230
243
  filter={filter}
244
+ filterIndex={index}
231
245
  updateFilterProp={(name, value) => {
232
246
  updateFilterProp(name, index, value)
233
247
  }}
248
+ toggleNestedQueryParameters={checked => {
249
+ toggleNestedQueryParameters(index, checked)
250
+ }}
234
251
  config={config}
235
252
  />
236
253
  </FieldSetWrapper>
@@ -10,12 +10,22 @@ type DeleteFilterProps = {
10
10
  filterIndex: number
11
11
  }
12
12
 
13
- const DeleteFilterModal: React.FC<DeleteFilterProps> = ({ removeFilterCompletely, removeFilterFromViz, filterIndex }) => {
13
+ const DeleteFilterModal: React.FC<DeleteFilterProps> = ({
14
+ removeFilterCompletely,
15
+ removeFilterFromViz,
16
+ filterIndex
17
+ }) => {
14
18
  const { overlay } = useGlobalContext()
15
19
  const { config } = useContext(DashboardContext)
16
- const filterUsedByMany = Object.values(config.visualizations).filter(viz => (viz as DashboardFilters).sharedFilterIndexes?.map(Number).includes(Number(filterIndex))).length > 1
17
20
 
18
- const message = filterUsedByMany ? 'This filter is used by multiple visualizations. You can either delete the filter from this visualization only or you can delete the filter completely, which will also remove it from other visualizations.' : 'Are you sure you want to delete this filter?'
21
+ const filterUsedByMany =
22
+ Object.values(config.visualizations).filter(viz => {
23
+ return (viz as DashboardFilters).sharedFilterIndexes?.map(Number).includes(Number(filterIndex))
24
+ }).length > 1
25
+
26
+ const message = filterUsedByMany
27
+ ? 'This filter is used by multiple visualizations. You can either delete the filter from this visualization only or you can delete the filter completely, which will also remove it from other visualizations.'
28
+ : 'Are you sure you want to delete this filter?'
19
29
  return (
20
30
  <Modal showClose={true}>
21
31
  <Modal.Content>