@cdc/core 4.24.10 → 4.24.12-2
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/components/AdvancedEditor/AdvancedEditor.tsx +17 -13
- package/components/Alert/components/Alert.tsx +39 -8
- package/components/DataTable/DataTable.tsx +31 -10
- package/components/DataTable/DataTableStandAlone.tsx +3 -3
- package/components/DataTable/components/ExpandCollapse.tsx +1 -1
- package/components/DataTable/components/SortIcon/sort-icon.css +15 -0
- package/components/DataTable/data-table.css +4 -22
- package/components/DataTable/helpers/boxplotCellMatrix.tsx +19 -14
- package/components/DataTable/helpers/getChartCellValue.ts +25 -7
- package/components/EditorPanel/ColumnsEditor.tsx +81 -36
- package/components/EditorPanel/DataTableEditor.tsx +62 -56
- package/components/EditorPanel/FieldSetWrapper.tsx +2 -2
- package/components/EditorPanel/Inputs.tsx +26 -16
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +55 -56
- package/components/Filters/Filters.tsx +42 -38
- package/components/Filters/helpers/handleSorting.ts +5 -0
- package/components/Footnotes/FootnotesStandAlone.tsx +17 -4
- package/components/Layout/components/Sidebar/components/sidebar.styles.scss +0 -4
- package/components/Layout/components/Visualization/visualizations.scss +1 -1
- package/components/Legend/Legend.Gradient.tsx +50 -35
- package/components/Loader/Loader.tsx +10 -5
- package/components/MultiSelect/MultiSelect.tsx +56 -33
- package/components/MultiSelect/multiselect.styles.css +20 -7
- package/components/NestedDropdown/NestedDropdown.tsx +55 -32
- package/components/NestedDropdown/nesteddropdown.styles.css +26 -13
- package/components/Table/Table.tsx +102 -34
- package/components/Table/components/Row.tsx +1 -1
- package/components/_stories/DataTable.stories.tsx +14 -0
- package/components/_stories/Filters.stories.tsx +57 -0
- package/components/_stories/_mocks/DataTable/no-data.json +108 -0
- package/components/inputs/{InputToggle.jsx → InputToggle.tsx} +35 -29
- package/components/ui/Icon.tsx +19 -6
- package/dist/cove-main.css +26 -57
- package/dist/cove-main.css.map +1 -1
- package/helpers/DataTransform.ts +2 -1
- package/helpers/addValuesToFilters.ts +22 -8
- package/helpers/cove/{number.js → number.ts} +25 -11
- package/helpers/coveUpdateWorker.ts +1 -1
- package/helpers/fetchRemoteData.js +32 -37
- package/helpers/filterVizData.ts +2 -2
- package/helpers/formatConfigBeforeSave.ts +16 -0
- package/helpers/gatherQueryParams.ts +2 -3
- package/helpers/queryStringUtils.ts +16 -1
- package/helpers/tests/addValuesToFilters.test.ts +6 -1
- package/helpers/useDataVizClasses.ts +44 -21
- package/helpers/ver/4.24.10.ts +12 -0
- package/helpers/ver/versionNeedsUpdate.ts +2 -0
- package/helpers/viewports.ts +8 -7
- package/package.json +2 -2
- package/styles/_button-section.scss +1 -1
- package/styles/_global-variables.scss +9 -4
- package/styles/_global.scss +21 -22
- package/styles/_reset.scss +0 -12
- package/styles/filters.scss +0 -22
- package/styles/v2/base/_reset.scss +0 -7
- package/styles/v2/components/editor.scss +0 -4
- package/styles/v2/components/icon.scss +1 -1
- package/types/Axis.ts +2 -0
- package/types/BoxPlot.ts +5 -3
- package/types/Color.ts +1 -1
- package/types/Legend.ts +1 -2
- package/types/MarkupInclude.ts +1 -0
- package/types/Runtime.ts +3 -1
- package/types/Series.ts +8 -1
- package/types/Table.ts +1 -1
- package/types/Version.ts +1 -0
- package/types/Visualization.ts +7 -8
- package/types/VizFilter.ts +2 -1
- package/components/ui/Select.jsx +0 -30
- package/helpers/getGradientLegendWidth.ts +0 -15
|
@@ -2,6 +2,7 @@ import _ from 'lodash'
|
|
|
2
2
|
import { VizFilter } from '../../types/VizFilter'
|
|
3
3
|
import { addValuesToFilters } from '../addValuesToFilters'
|
|
4
4
|
import { describe, it, expect, vi } from 'vitest'
|
|
5
|
+
import { FILTER_STYLE } from '@cdc/dashboard/src/types/FilterStyles'
|
|
5
6
|
|
|
6
7
|
describe('addValuesToFilters', () => {
|
|
7
8
|
const parentFilter = { columnName: 'parentColumn', id: 11, active: 'apple', values: [] } as VizFilter
|
|
@@ -36,7 +37,11 @@ describe('addValuesToFilters', () => {
|
|
|
36
37
|
//expect(newFilters[1].values).toEqual([])
|
|
37
38
|
})
|
|
38
39
|
it('works for nested dropdowns', () => {
|
|
39
|
-
const nestedParentFilter = {
|
|
40
|
+
const nestedParentFilter = {
|
|
41
|
+
...parentFilter,
|
|
42
|
+
filterStyle: FILTER_STYLE.nestedDropdown,
|
|
43
|
+
subGrouping: { columnName: 'childColumn' }
|
|
44
|
+
}
|
|
40
45
|
const newFilters = addValuesToFilters([nestedParentFilter], data)
|
|
41
46
|
expect(newFilters[0].values).toEqual(['apple', 'pear'])
|
|
42
47
|
expect(newFilters[0].subGrouping.valuesLookup).toEqual({ apple: { values: ['a', 'b'] }, pear: { values: ['c'] } })
|
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
export default function useDataVizClasses(config, viewport = null) {
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
legend,
|
|
4
|
+
lineDatapointStyle,
|
|
5
|
+
showTitle,
|
|
6
|
+
title,
|
|
7
|
+
visualizationType,
|
|
8
|
+
subtext,
|
|
9
|
+
biteStyle,
|
|
10
|
+
general,
|
|
11
|
+
visual,
|
|
12
|
+
shadow
|
|
13
|
+
} = config
|
|
14
|
+
|
|
3
15
|
let lineDatapointClass = ''
|
|
4
16
|
|
|
5
|
-
if (
|
|
17
|
+
if (lineDatapointStyle === 'hover') {
|
|
6
18
|
lineDatapointClass = ' chart-line--hover'
|
|
7
19
|
}
|
|
8
|
-
if (
|
|
20
|
+
if (lineDatapointStyle === 'always show') {
|
|
9
21
|
lineDatapointClass = ' chart-line--always'
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
let innerContainerClasses = ['cove-component__inner']
|
|
13
25
|
let contentClasses = ['cove-component__content']
|
|
14
26
|
|
|
15
|
-
const { visualizationType, title, showTitle } = config
|
|
16
|
-
|
|
17
27
|
if (visualizationType === 'Spark Line' || visualizationType === 'chart') {
|
|
18
28
|
if (title && showTitle) contentClasses.push('component--has-title')
|
|
19
29
|
}
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
showTitle && contentClasses.push('component--has-title')
|
|
32
|
+
title &&
|
|
33
|
+
visualizationType !== 'chart' &&
|
|
34
|
+
visualizationType !== 'Spark Line' &&
|
|
35
|
+
contentClasses.push('component--has-title')
|
|
36
|
+
subtext && innerContainerClasses.push('component--has-subtext')
|
|
37
|
+
biteStyle && innerContainerClasses.push(`bite__style--${biteStyle}`)
|
|
38
|
+
general?.isCompactStyle && innerContainerClasses.push(`component--isCompactStyle`)
|
|
26
39
|
|
|
27
|
-
!
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
!visual?.border && contentClasses.push('no-borders')
|
|
41
|
+
visualizationType === 'Spark Line' && contentClasses.push('sparkline')
|
|
42
|
+
visual?.borderColorTheme && contentClasses.push('component--has-borderColorTheme')
|
|
43
|
+
visual?.accent && contentClasses.push('component--has-accent')
|
|
44
|
+
visual?.background && contentClasses.push('component--has-background')
|
|
45
|
+
visual?.hideBackgroundColor && contentClasses.push('component--hideBackgroundColor')
|
|
33
46
|
|
|
34
47
|
// ! these two will be retired.
|
|
35
|
-
|
|
48
|
+
shadow && innerContainerClasses.push('shadow')
|
|
36
49
|
config?.visual?.roundedBorders && innerContainerClasses.push('bite--has-rounded-borders')
|
|
37
50
|
|
|
38
51
|
let sparkLineStyles = {
|
|
@@ -51,19 +64,29 @@ export default function useDataVizClasses(config, viewport = null) {
|
|
|
51
64
|
const getUlClasses = () => {
|
|
52
65
|
const ulClasses = ['legend-container__ul']
|
|
53
66
|
ulClasses.push(getListPosition())
|
|
67
|
+
if (legend?.style === 'gradient') ulClasses.push('patterns-only')
|
|
54
68
|
return ulClasses
|
|
55
69
|
}
|
|
56
|
-
const hasBorder =
|
|
57
|
-
const legendOuterClasses = [
|
|
70
|
+
const hasBorder = legend?.hideBorder ? 'no-border' : ''
|
|
71
|
+
const legendOuterClasses = [
|
|
72
|
+
`${legend?.position}`,
|
|
73
|
+
`${getListPosition()}`,
|
|
74
|
+
`cdcdataviz-sr-focusable`,
|
|
75
|
+
`${viewport}`,
|
|
76
|
+
`${hasBorder}`
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
const usePadding = !legend?.hideBorder
|
|
58
80
|
|
|
59
81
|
const legendClasses = {
|
|
60
82
|
aside: legendOuterClasses,
|
|
61
|
-
section: ['legend-container'],
|
|
83
|
+
section: ['legend-container', usePadding ? 'legend-padding' : ''],
|
|
62
84
|
ul: getUlClasses(),
|
|
63
85
|
li: ['single-legend-item', 'legend-container__li'],
|
|
64
86
|
title: ['legend-container__title'],
|
|
65
87
|
description: ['legend-container__description'],
|
|
66
|
-
div: [legend?.position === 'bottom' && legend?.singleRow ? 'shape-container single-row' : 'shape-container']
|
|
88
|
+
div: [legend?.position === 'bottom' && legend?.singleRow ? 'shape-container single-row' : 'shape-container'],
|
|
89
|
+
resetButton: ['legend-container__reset-button']
|
|
67
90
|
}
|
|
68
91
|
|
|
69
92
|
return { innerContainerClasses, contentClasses, lineDatapointClass, sparkLineStyles, legendClasses }
|
package/helpers/ver/4.24.10.ts
CHANGED
|
@@ -34,12 +34,24 @@ export const setXAxisLabelOffsetToZero = newConfig => {
|
|
|
34
34
|
newConfig.xAxis.labelOffset = 0
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export const defineFilterStyles = newConfig => {
|
|
38
|
+
if (newConfig.filters) {
|
|
39
|
+
newConfig.filters = newConfig.filters.map(filter => {
|
|
40
|
+
if (!filter.filterStyle) {
|
|
41
|
+
filter.filterStyle = 'dropdown'
|
|
42
|
+
}
|
|
43
|
+
return filter
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
const update_4_24_10 = config => {
|
|
38
49
|
const ver = '4.24.10'
|
|
39
50
|
const newConfig = _.cloneDeep(config)
|
|
40
51
|
setXAxisLabelOffsetToZero(newConfig)
|
|
41
52
|
changePivotColumns(newConfig)
|
|
42
53
|
removeMultiSelectPropFromMultiselect(newConfig)
|
|
54
|
+
defineFilterStyles(newConfig)
|
|
43
55
|
newConfig.version = ver
|
|
44
56
|
return newConfig
|
|
45
57
|
}
|
package/helpers/viewports.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
return ['xs', 'xxs'].includes(currentViewport)
|
|
3
|
-
}
|
|
1
|
+
import { ViewportSize } from '@cdc/map/src/types/MapConfig'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
return ['xs', 'xxs'].includes(currentViewport)
|
|
7
|
-
}
|
|
3
|
+
const BREAKPOINTS = ['xxs', 'xs', 'sm', 'md', 'lg']
|
|
8
4
|
|
|
9
|
-
export
|
|
5
|
+
export const isBelowBreakpoint = (breakpoint: ViewportSize, currentViewport: ViewportSize) =>
|
|
6
|
+
BREAKPOINTS.indexOf(currentViewport) < BREAKPOINTS.indexOf(breakpoint)
|
|
7
|
+
|
|
8
|
+
export const isLegendWrapViewport = currentViewport => isBelowBreakpoint('sm', currentViewport)
|
|
9
|
+
|
|
10
|
+
export const isMobileHeightViewport = currentViewport => isBelowBreakpoint('sm', currentViewport)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/core",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.12-2",
|
|
4
4
|
"description": "Core components, styles, hooks, and helpers, for the CDC Open Visualization project",
|
|
5
5
|
"moduleName": "CdcCore",
|
|
6
6
|
"main": "dist/cdccore",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-dom": "^18.2.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "a60edf1148396309eb473ac9f65426ee40797ddf",
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"sass": "^1.79.4"
|
|
40
40
|
}
|
|
@@ -2,6 +2,7 @@ $colors: (
|
|
|
2
2
|
'baseColor': #333,
|
|
3
3
|
'blue': #005eaa,
|
|
4
4
|
'lightestGray': #f2f2f2,
|
|
5
|
+
'gray2': #f5f5f5,
|
|
5
6
|
'lightGray': #c7c7c7,
|
|
6
7
|
'mediumGray': #565656,
|
|
7
8
|
'darkGray': #333,
|
|
@@ -62,6 +63,11 @@ $colors: (
|
|
|
62
63
|
'amber-secondary': #ffd54f,
|
|
63
64
|
'amber-tertiary': #ffecb3,
|
|
64
65
|
'amber-quaternary': #fff7e1,
|
|
66
|
+
|
|
67
|
+
'cool-gray-90': #1c1d1f,
|
|
68
|
+
'cool-gray-50': #71767a,
|
|
69
|
+
'cool-gray-30': #a9aeb1,
|
|
70
|
+
'cool-gray-10': #dfe1e2
|
|
65
71
|
);
|
|
66
72
|
|
|
67
73
|
@mixin theme() {
|
|
@@ -75,6 +81,7 @@ $colors: (
|
|
|
75
81
|
@include theme();
|
|
76
82
|
|
|
77
83
|
:root {
|
|
84
|
+
--editorContentPadding: 30px;
|
|
78
85
|
--editorWidth: 350px;
|
|
79
86
|
--breakpoint-xs: 480px;
|
|
80
87
|
--breakpoint-sm: 768px;
|
|
@@ -84,10 +91,8 @@ $colors: (
|
|
|
84
91
|
--font-size: 17px;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
@media (max-width: 768px) {
|
|
94
|
+
@media (max-width: 576px) {
|
|
89
95
|
:root {
|
|
90
|
-
--font-size:
|
|
96
|
+
--font-size: 13px;
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
|
-
|
package/styles/_global.scss
CHANGED
|
@@ -53,15 +53,6 @@ strong {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.btn {
|
|
56
|
-
background: #005eaa;
|
|
57
|
-
color: #fff;
|
|
58
|
-
border: 0;
|
|
59
|
-
padding: 0.4em 0.8em;
|
|
60
|
-
font-size: 1em;
|
|
61
|
-
display: block;
|
|
62
|
-
border-radius: 0.3em;
|
|
63
|
-
transition: 0.1s background-color;
|
|
64
|
-
cursor: pointer;
|
|
65
56
|
&.full-width {
|
|
66
57
|
width: 100%;
|
|
67
58
|
}
|
|
@@ -89,17 +80,11 @@ strong {
|
|
|
89
80
|
}
|
|
90
81
|
}
|
|
91
82
|
|
|
92
|
-
&:hover {
|
|
93
|
-
transition: 0.1s all;
|
|
94
|
-
background: lighten(#005eaa, 5%);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
83
|
svg {
|
|
98
84
|
width: 16px;
|
|
99
85
|
height: 16px;
|
|
100
86
|
position: relative;
|
|
101
87
|
top: 2px;
|
|
102
|
-
margin-left: 5px;
|
|
103
88
|
}
|
|
104
89
|
}
|
|
105
90
|
|
|
@@ -122,13 +107,6 @@ textarea {
|
|
|
122
107
|
textarea {
|
|
123
108
|
min-height: 140px;
|
|
124
109
|
}
|
|
125
|
-
select {
|
|
126
|
-
width: 100%;
|
|
127
|
-
font-size: 1em;
|
|
128
|
-
font-weight: normal;
|
|
129
|
-
text-transform: none;
|
|
130
|
-
border: rgba(0, 0, 0, 0.3) 1px solid !important;
|
|
131
|
-
}
|
|
132
110
|
|
|
133
111
|
.input-group-text {
|
|
134
112
|
border-top-left-radius: 0;
|
|
@@ -194,3 +172,24 @@ section.footnotes {
|
|
|
194
172
|
.margin-left-href {
|
|
195
173
|
margin-left: 15px;
|
|
196
174
|
}
|
|
175
|
+
|
|
176
|
+
.btn.btn-primary:not([disabled]) {
|
|
177
|
+
background-color: $blue;
|
|
178
|
+
border-color: $blue;
|
|
179
|
+
&:hover:not([disabled]) {
|
|
180
|
+
background-color: darken($blue, 5%);
|
|
181
|
+
border-color: darken($blue, 5%);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
// after migration to TP5 this declaration should be removed and all references
|
|
187
|
+
// to it should be replaced with .form-select
|
|
188
|
+
.cove-form-select {
|
|
189
|
+
display: block;
|
|
190
|
+
width: 100%;
|
|
191
|
+
padding: 0.375rem 0.75rem;
|
|
192
|
+
border-radius: 0.25rem;
|
|
193
|
+
border: 1px solid var(--lightGray);
|
|
194
|
+
color: var(--darkGray);
|
|
195
|
+
}
|
package/styles/_reset.scss
CHANGED
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
.cdc-open-viz-module {
|
|
22
|
-
div,
|
|
23
|
-
span,
|
|
24
22
|
applet,
|
|
25
23
|
object,
|
|
26
24
|
iframe,
|
|
@@ -67,8 +65,6 @@
|
|
|
67
65
|
ul,
|
|
68
66
|
li,
|
|
69
67
|
fieldset,
|
|
70
|
-
form,
|
|
71
|
-
label,
|
|
72
68
|
legend,
|
|
73
69
|
caption,
|
|
74
70
|
article,
|
|
@@ -99,14 +95,6 @@
|
|
|
99
95
|
vertical-align: baseline;
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
button {
|
|
103
|
-
border: 0;
|
|
104
|
-
cursor: pointer;
|
|
105
|
-
&:focus {
|
|
106
|
-
outline: 0;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
98
|
* {
|
|
111
99
|
box-sizing: border-box;
|
|
112
100
|
}
|
package/styles/filters.scss
CHANGED
|
@@ -26,24 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// note the diff of section and no section above.
|
|
30
|
-
// Can't use nested selectors with top level section overwrites
|
|
31
|
-
section.filters-section {
|
|
32
|
-
// border: 1px solid #c7c7c7;
|
|
33
|
-
// padding: 10px;
|
|
34
|
-
border-radius: 10px;
|
|
35
|
-
margin-bottom: 10px;
|
|
36
|
-
display: block !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
29
|
div.single-filters {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-wrap: wrap;
|
|
42
|
-
margin: 15px 0;
|
|
43
|
-
|
|
44
|
-
select {
|
|
45
|
-
width: auto !important;
|
|
46
|
-
}
|
|
47
30
|
|
|
48
31
|
label {
|
|
49
32
|
width: 100%;
|
|
@@ -57,11 +40,6 @@ div.single-filters {
|
|
|
57
40
|
}
|
|
58
41
|
}
|
|
59
42
|
|
|
60
|
-
.single-filters--dropdown {
|
|
61
|
-
width: auto;
|
|
62
|
-
display: flex;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
43
|
.single-filters--tab {
|
|
66
44
|
width: 100%;
|
|
67
45
|
display: flex;
|
package/types/Axis.ts
CHANGED
|
@@ -27,6 +27,7 @@ export type Axis = {
|
|
|
27
27
|
maxTickRotation?: number
|
|
28
28
|
min?: string
|
|
29
29
|
numTicks?: number
|
|
30
|
+
padding?: number
|
|
30
31
|
paddingPercent?: number
|
|
31
32
|
rightAxisSize?: number
|
|
32
33
|
rightHideAxis?: boolean
|
|
@@ -48,4 +49,5 @@ export type Axis = {
|
|
|
48
49
|
type: string
|
|
49
50
|
axisBBox: number
|
|
50
51
|
maxValue: string
|
|
52
|
+
sortByRecentDate: boolean
|
|
51
53
|
}
|
package/types/BoxPlot.ts
CHANGED
|
@@ -10,12 +10,14 @@ export type BoxPlot = {
|
|
|
10
10
|
q3: string
|
|
11
11
|
outliers: string
|
|
12
12
|
values: string
|
|
13
|
-
|
|
13
|
+
count: string
|
|
14
14
|
lowerBounds: string
|
|
15
15
|
upperBounds: string
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
plotNonOutlierValues: boolean
|
|
18
|
+
plots: [{ columnOutliers: []; columnLowerBounds: number; columnUpperBounds: number }]
|
|
18
19
|
categories: string[]
|
|
19
|
-
firstQuartilePercentage: number
|
|
20
20
|
geoType: string
|
|
21
|
+
hideOutliers: boolean
|
|
22
|
+
borders: string
|
|
21
23
|
}
|
package/types/Color.ts
CHANGED
package/types/Legend.ts
CHANGED
|
@@ -10,8 +10,7 @@ export type Legend = {
|
|
|
10
10
|
hideSuppressedLabels: boolean
|
|
11
11
|
highlightOnHover: boolean
|
|
12
12
|
label: string
|
|
13
|
-
|
|
14
|
-
position: string
|
|
13
|
+
position: 'left' | 'bottom' | 'top' | 'right' | 'side'
|
|
15
14
|
reverseLabelOrder: boolean
|
|
16
15
|
singleRow: boolean
|
|
17
16
|
type: string
|
package/types/MarkupInclude.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Visualization } from './Visualization'
|
|
|
5
5
|
export type MarkupIncludeConfig = Visualization & {
|
|
6
6
|
contentEditor: {
|
|
7
7
|
// Changing the base config object creates an infinite loop, nesting it is a workaround
|
|
8
|
+
allowHideSection?: boolean
|
|
8
9
|
inlineHTML: string
|
|
9
10
|
markupVariables: Variable[]
|
|
10
11
|
showHeader: boolean
|
package/types/Runtime.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Axis } from './Axis'
|
|
2
|
+
import { Series } from './Series'
|
|
2
3
|
|
|
3
4
|
export type ForecastingSeriesKey = {
|
|
4
5
|
stages: {
|
|
@@ -17,7 +18,8 @@ export type Runtime = {
|
|
|
17
18
|
}
|
|
18
19
|
xAxis: Axis
|
|
19
20
|
yAxis: Axis
|
|
20
|
-
|
|
21
|
+
series: Series
|
|
22
|
+
seriesKeys: string[]
|
|
21
23
|
seriesLabels: Record<string, any>
|
|
22
24
|
seriesLabelsAll: string[]
|
|
23
25
|
editorErrorMessage: string
|
package/types/Series.ts
CHANGED
package/types/Table.ts
CHANGED
package/types/Version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type version = `${number}.${number}.${number}`
|
package/types/Visualization.ts
CHANGED
|
@@ -19,20 +19,19 @@ import { DashboardFilters } from '@cdc/dashboard/src/types/DashboardFilters'
|
|
|
19
19
|
type DeprecatedVisualizationType = {
|
|
20
20
|
columns: Record<string, Partial<Column>>
|
|
21
21
|
confidenceKeys: ConfidenceInterval
|
|
22
|
-
dataFileName
|
|
23
|
-
dataFileSourceType
|
|
22
|
+
dataFileName?: string
|
|
23
|
+
dataFileSourceType?: string
|
|
24
24
|
dataFormat: any
|
|
25
|
-
datasets
|
|
25
|
+
datasets?: Record<string, any>
|
|
26
26
|
filters: VizFilter[]
|
|
27
27
|
general: General
|
|
28
28
|
legend: Legend
|
|
29
29
|
multiDashboards?: any[]
|
|
30
30
|
newViz: boolean
|
|
31
31
|
isResponsiveTicks: boolean
|
|
32
|
-
|
|
33
|
-
openModal: boolean
|
|
32
|
+
openModal?: boolean
|
|
34
33
|
orientation: 'vertical' | 'horizontal'
|
|
35
|
-
originalFormattedData
|
|
34
|
+
originalFormattedData?: any
|
|
36
35
|
runtime?: Runtime
|
|
37
36
|
series: Series
|
|
38
37
|
table: Table
|
|
@@ -49,7 +48,7 @@ type DeprecatedVisualizationType = {
|
|
|
49
48
|
| 'filtered-text'
|
|
50
49
|
| 'table'
|
|
51
50
|
| 'navigation'
|
|
52
|
-
usesSharedFilter
|
|
51
|
+
usesSharedFilter?: any
|
|
53
52
|
visualizationSubType: string
|
|
54
53
|
visualizationType: string
|
|
55
54
|
xAxis: Axis
|
|
@@ -63,7 +62,7 @@ type StatefulProperties = {
|
|
|
63
62
|
|
|
64
63
|
export type CommonVisualizationProperties = Partial<StatefulProperties> & {
|
|
65
64
|
showEditorPanel?: boolean
|
|
66
|
-
uid?: string // this is the actual key of the visualization object
|
|
65
|
+
uid?: string | number // this is the actual key of the visualization object
|
|
67
66
|
visualizationType?: string
|
|
68
67
|
filterBehavior: FilterBehavior
|
|
69
68
|
} & Partial<ConfigureData>
|
package/types/VizFilter.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type OrderBy = 'asc' | 'desc' | 'cust'
|
|
1
|
+
export type OrderBy = 'asc' | 'desc' | 'cust' | 'column'
|
|
2
2
|
|
|
3
3
|
export type FilterBase = {
|
|
4
4
|
columnName: string
|
|
@@ -23,6 +23,7 @@ export type GeneralFilter = FilterBase & {
|
|
|
23
23
|
filterStyle: VizFilterStyle
|
|
24
24
|
label: string
|
|
25
25
|
order: OrderBy
|
|
26
|
+
orderColumn?: string
|
|
26
27
|
orderedValues?: string[] // should only exist if the order is 'cust'
|
|
27
28
|
queryParameter: string
|
|
28
29
|
setByQueryParameter: string
|
package/components/ui/Select.jsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
const Select = ({ label, value, options, fieldName, section = null, subsection = null, required = false, tooltip, onchange, initial: initialValue, ...attributes }) => {
|
|
4
|
-
let optionsJsx = options.map((optionName, index) => (
|
|
5
|
-
<option value={optionName} key={index}>
|
|
6
|
-
{optionName}
|
|
7
|
-
</option>
|
|
8
|
-
))
|
|
9
|
-
|
|
10
|
-
if (initialValue) {
|
|
11
|
-
optionsJsx.unshift(
|
|
12
|
-
<option value='' key='initial'>
|
|
13
|
-
{initialValue}
|
|
14
|
-
</option>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<label>
|
|
20
|
-
<span className='edit-label'>
|
|
21
|
-
{label}
|
|
22
|
-
{tooltip}
|
|
23
|
-
</span>
|
|
24
|
-
<select className={required && !value ? 'warning' : ''} name={fieldName} value={value} onChange={onchange} {...attributes}>
|
|
25
|
-
{optionsJsx}
|
|
26
|
-
</select>
|
|
27
|
-
</label>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
export default Select
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const getGradientLegendWidth = (containerWidth: number, currentViewport: string): number => {
|
|
2
|
-
const newWidth = Number(containerWidth)
|
|
3
|
-
switch (currentViewport) {
|
|
4
|
-
case 'lg':
|
|
5
|
-
return newWidth / 3
|
|
6
|
-
case 'md':
|
|
7
|
-
return newWidth / 2
|
|
8
|
-
case 'sm':
|
|
9
|
-
case 'xs':
|
|
10
|
-
case 'xxs':
|
|
11
|
-
return newWidth / 1.4
|
|
12
|
-
default:
|
|
13
|
-
return newWidth
|
|
14
|
-
}
|
|
15
|
-
}
|