@cdc/core 4.24.7 → 4.24.9
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/assets/icon-gear-multi.svg +23 -0
- package/components/Alert/components/Alert.styles.css +15 -0
- package/components/Alert/components/Alert.tsx +39 -0
- package/components/Alert/index.tsx +3 -0
- package/components/DataTable/DataTable.tsx +106 -30
- package/components/DataTable/helpers/chartCellMatrix.tsx +3 -3
- package/components/DataTable/helpers/getChartCellValue.ts +1 -1
- package/components/DataTable/helpers/getDataSeriesColumns.ts +2 -2
- package/components/DataTable/helpers/mapCellMatrix.tsx +3 -3
- package/components/DataTable/types/TableConfig.ts +1 -1
- package/components/EditorPanel/Inputs.tsx +13 -4
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +268 -0
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +161 -82
- package/components/EditorPanel/VizFilterEditor/components/FilterOrder.tsx +31 -45
- package/components/Filters.tsx +223 -180
- package/components/Layout/components/Responsive.tsx +14 -4
- package/components/Layout/components/Sidebar/components/Sidebar.tsx +14 -5
- package/components/Layout/components/Sidebar/components/sidebar.styles.scss +15 -16
- package/components/Layout/components/Visualization/index.tsx +7 -1
- package/components/Layout/components/Visualization/visualizations.scss +32 -26
- package/components/Layout/styles/editor.scss +0 -8
- package/components/Legend/Legend.Gradient.tsx +133 -0
- package/components/LegendShape.tsx +28 -0
- package/components/MultiSelect/MultiSelect.tsx +6 -3
- package/components/NestedDropdown/NestedDropdown.tsx +47 -52
- package/components/NestedDropdown/nesteddropdown.styles.css +19 -25
- package/components/Table/Table.tsx +8 -5
- package/components/Table/components/Cell.tsx +2 -2
- package/components/Table/components/Row.tsx +25 -7
- package/components/_stories/Layout.Debug.stories.tsx +91 -0
- package/components/_stories/_mocks/bar-chart-suppressed.json +474 -0
- package/components/_stories/styles.scss +13 -1
- package/components/createBarElement.jsx +4 -4
- package/components/ui/Icon.tsx +21 -14
- package/components/ui/Title/Title.scss +0 -8
- package/helpers/DataTransform.ts +2 -2
- package/helpers/addValuesToFilters.ts +95 -16
- package/helpers/cove/accessibility.ts +16 -4
- package/helpers/coveUpdateWorker.ts +24 -10
- package/helpers/filterVizData.ts +23 -4
- package/helpers/formatConfigBeforeSave.ts +7 -2
- package/helpers/getGradientLegendWidth.ts +15 -0
- package/helpers/getTextWidth.ts +18 -0
- package/helpers/scaling.ts +7 -0
- package/helpers/tests/addValuesToFilters.test.ts +55 -0
- package/helpers/tests/filterVizData.test.ts +31 -0
- package/helpers/tests/invertValue.test.ts +35 -0
- package/helpers/updatePaletteNames.ts +19 -0
- package/helpers/{useDataVizClasses.js → useDataVizClasses.ts} +3 -2
- package/helpers/ver/4.24.5.ts +3 -3
- package/helpers/ver/4.24.7.ts +34 -3
- package/helpers/ver/4.24.9.ts +63 -0
- package/helpers/ver/tests/4.24.9.test.ts +22 -0
- package/helpers/ver/versionNeedsUpdate.ts +9 -0
- package/package.json +3 -3
- package/styles/_button-section.scss +1 -1
- package/styles/_global.scss +6 -2
- package/styles/filters.scss +4 -0
- package/types/Axis.ts +3 -0
- package/types/Dimensions.ts +1 -0
- package/types/General.ts +1 -1
- package/types/VizFilter.ts +24 -3
- package/components/LegendCircle.jsx +0 -17
- package/helpers/updatePaletteNames.js +0 -16
- /package/components/{Waiting.jsx → Waiting.tsx} +0 -0
- /package/helpers/ver/{4.23.4.ts → 4.24.4.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #231f20;
|
|
7
|
+
stroke-width: 0px;
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
</defs>
|
|
11
|
+
<g>
|
|
12
|
+
<path class="cls-1" d="M218.85,262.45c-.39-37.16-30.83-66.97-68.01-66.58-37.16.41-66.97,30.86-66.58,68.03.4,37.15,30.86,66.94,68.02,66.57,37.18-.41,66.98-30.86,66.57-68.02ZM151.88,292.62c-4.07.04-7.95-.74-11.49-2.19-10.62-4.36-18.15-14.75-18.28-26.94-.17-16.27,12.86-29.59,29.13-29.76,4.06-.04,7.95.74,11.48,2.19,10.62,4.35,18.15,14.74,18.28,26.94.18,16.25-12.87,29.59-29.12,29.76Z"/>
|
|
13
|
+
<path class="cls-1" d="M250.22,280.09c.99-5.85,1.5-11.87,1.44-18.01-.05-3.92-.34-7.82-.82-11.64l23.73-17.16c-1.72-7.65-4.12-15.04-7.14-22.1l-30.29.03c-4.82-7.93-10.7-15.12-17.46-21.39l7.59-30.08c-6.16-4.7-12.74-8.82-19.71-12.35l-24.62,20.71c-7.91-2.64-16.26-4.28-24.91-4.81l-4.17-8.61-10.1-20.88c-7.89.37-15.6,1.46-23.03,3.17l-5.77,33c-7.53,2.96-14.62,6.81-21.11,11.39l-30.76-13.8c-5.69,5.27-10.89,11.08-15.55,17.29l16.85,29.12c-3.92,6.93-7.04,14.4-9.23,22.24l-32.12,9.11c-.72,5.75-1.1,11.59-1.03,17.54.02,1.92.1,3.82.2,5.73l30.61,11.08c1.43,8.61,3.98,16.85,7.44,24.55l-17.93,26.42c4.21,6.54,9,12.7,14.3,18.34l28.94-10.58c6.98,6.15,14.83,11.31,23.32,15.33l3.06,29.9c7.33,2.28,14.93,3.88,22.74,4.81l14.52-25.22c1.14.03,2.29.07,3.45.04,9.06-.08,17.81-1.4,26.14-3.74l20.52,19.93c7.2-3.04,14.06-6.7,20.53-10.93l-4.95-27.85c7.91-6.47,14.82-14.1,20.44-22.65l28.22,2.05c3.53-6.85,6.48-14.04,8.74-21.52l-22.06-18.46ZM152.4,341.41c-43.21.47-78.62-34.19-79.08-77.4-.46-43.2,34.19-78.61,77.4-79.08,43.21-.46,78.6,34.21,79.06,77.41.47,43.2-34.18,78.6-77.39,79.07Z"/>
|
|
14
|
+
</g>
|
|
15
|
+
<g>
|
|
16
|
+
<path class="cls-1" d="M345.31,139.47c-7.44-19.18-29.04-28.71-48.23-21.26-19.18,7.45-28.7,29.05-21.25,48.24,7.45,19.18,29.04,28.69,48.24,21.25,19.19-7.46,28.71-29.05,21.25-48.24ZM316.47,168.16c-2.1.82-4.26,1.17-6.38,1.1-6.35-.19-12.28-4.11-14.73-10.4-3.26-8.4.9-17.85,9.3-21.11,2.1-.82,4.26-1.17,6.38-1.1,6.35.19,12.28,4.1,14.73,10.4,3.26,8.39-.9,17.85-9.29,21.1Z"/>
|
|
17
|
+
<path class="cls-1" d="M365.01,142.5c-.63-3.23-1.54-6.45-2.76-9.62-.79-2.02-1.7-3.99-2.69-5.87l8.96-13.52c-2.38-3.63-5.07-7-8.01-10.06l-15.7,5.92c-4.05-3.17-8.5-5.75-13.22-7.69l-1.93-17.07c-4.11-1.24-8.33-2.09-12.62-2.56l-8.73,15.54c-4.61.17-9.26.95-13.85,2.36l-3.84-3.65-9.31-8.86c-4.02,1.73-7.8,3.79-11.32,6.13l3.44,18.23c-3.33,3-6.25,6.38-8.72,10.02l-18.64-1.16c-1.93,3.84-3.49,7.87-4.69,11.99l14.41,11.81c-.68,4.36-.85,8.84-.45,13.33l-14.87,10.98c.75,3.12,1.69,6.22,2.88,9.29.38.99.8,1.96,1.22,2.93l18.03-.22c2.42,4.19,5.35,7.96,8.64,11.28l-4.15,17.19c3.46,2.57,7.14,4.83,10.99,6.72l12.94-11.13c4.82,1.83,9.89,2.98,15.07,3.4l7.42,14.9c4.24-.25,8.5-.9,12.73-1.94l2.61-15.9c.6-.21,1.2-.41,1.8-.65,4.68-1.81,8.96-4.2,12.82-7.04l14.52,6.33c3.14-2.98,5.99-6.21,8.51-9.67l-7.99-13.47c2.84-4.9,4.94-10.2,6.18-15.73l15.03-4.44c.49-4.24.62-8.54.34-12.86l-15.03-5.27ZM326.25,193.35c-22.31,8.66-47.42-2.4-56.08-24.71-8.66-22.3,2.4-47.42,24.71-56.08,22.31-8.66,47.41,2.41,56.07,24.72,8.66,22.3-2.4,47.41-24.7,56.07Z"/>
|
|
18
|
+
</g>
|
|
19
|
+
<g>
|
|
20
|
+
<path class="cls-1" d="M219.71,100.11c13.58-15.46,12.07-39.01-3.4-52.6-15.47-13.58-39.02-12.06-52.61,3.41-13.58,15.46-12.05,39.01,3.41,52.6,15.47,13.58,39.02,12.06,52.6-3.41ZM180.95,87.77c-1.69-1.49-3-3.24-3.92-5.15-2.76-5.72-2.02-12.79,2.43-17.87,5.95-6.77,16.25-7.44,23.02-1.49,1.69,1.49,3,3.24,3.92,5.15,2.77,5.72,2.03,12.79-2.43,17.87-5.94,6.76-16.25,7.44-23.01,1.49Z"/>
|
|
21
|
+
<path class="cls-1" d="M226.11,118.99c2.57-2.05,5.01-4.34,7.26-6.89,1.43-1.64,2.75-3.35,3.97-5.1l16.13,1.71c2.12-3.79,3.87-7.72,5.23-11.75l-12.5-11.19c.94-5.05,1.18-10.19.72-15.28l14.26-9.59c-.8-4.22-1.99-8.35-3.55-12.38l-17.81-.57c-2.28-4.01-5.12-7.78-8.49-11.2l1.47-5.09,3.56-12.34c-3.39-2.77-6.97-5.17-10.67-7.21l-14.59,11.47c-4.2-1.57-8.54-2.6-12.92-3.11l-7.57-17.07c-4.3.06-8.59.54-12.81,1.37l-3.83,18.24c-4.18,1.41-8.23,3.33-12.03,5.75l-16.61-8.13c-2.42,2.1-4.74,4.37-6.91,6.85-.7.8-1.37,1.61-2.04,2.44l8.52,15.89c-2.6,4.08-4.59,8.42-6.02,12.87l-17.16,4.25c-.68,4.26-.99,8.56-.89,12.85l15.84,6.34c.6,5.12,1.92,10.15,3.94,14.94l-9.8,13.46c2.18,3.65,4.72,7.12,7.59,10.4l15.31-5.02c.46.44.92.87,1.41,1.29,3.76,3.32,7.86,6.01,12.16,8.13l1.09,15.81c4.09,1.41,8.27,2.44,12.5,3.09l8.26-13.31c5.65.26,11.32-.33,16.8-1.78l10.87,11.29c3.99-1.52,7.86-3.39,11.57-5.64l-2.26-15.77ZM163.11,108.07c-17.98-15.79-19.75-43.18-3.96-61.15,15.79-17.98,43.17-19.75,61.16-3.96,17.98,15.8,19.74,43.18,3.95,61.15-15.79,17.98-43.16,19.75-61.15,3.96Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Icon from '../../ui/Icon'
|
|
2
|
+
|
|
3
|
+
import DOMPurify from 'dompurify'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
import './Alert.styles.css'
|
|
7
|
+
|
|
8
|
+
type AlertProps = {
|
|
9
|
+
// type of alert for styling the alert box
|
|
10
|
+
type?: 'success' | 'danger' | 'info'
|
|
11
|
+
// message to display in the alert box
|
|
12
|
+
message?: string
|
|
13
|
+
// size of the icon in the alert box
|
|
14
|
+
iconSize?: number
|
|
15
|
+
// heading for the alert box
|
|
16
|
+
heading?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Alert: React.FC<AlertProps> = ({ type = 'info', message = '', iconSize = 21, heading }) => {
|
|
20
|
+
// sanitize the text for setting dangerouslySetInnerHTML
|
|
21
|
+
const sanitizedData = () => ({
|
|
22
|
+
__html: DOMPurify.sanitize(message)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// reset styles to avoid conflicts in wcms
|
|
26
|
+
const styleResets = { width: 'unset', height: 'unset', paddingRight: '5px' }
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={`alert alert-${type} p-1`} role='alert'>
|
|
30
|
+
{heading && <h4 className='alert-heading'>{heading}</h4>}
|
|
31
|
+
{type === 'success' && <Icon display='check' size={iconSize} />}
|
|
32
|
+
{type === 'danger' && <Icon display='warningCircle' size={iconSize} />}
|
|
33
|
+
{type === 'info' && <Icon display='info' size={iconSize} />}
|
|
34
|
+
<span dangerouslySetInnerHTML={sanitizedData()} />
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default Alert
|
|
@@ -53,7 +53,21 @@ export type DataTableProps = {
|
|
|
53
53
|
|
|
54
54
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-static-element-interactions */
|
|
55
55
|
const DataTable = (props: DataTableProps) => {
|
|
56
|
-
const {
|
|
56
|
+
const {
|
|
57
|
+
config,
|
|
58
|
+
dataConfig,
|
|
59
|
+
tableTitle,
|
|
60
|
+
vizTitle,
|
|
61
|
+
rawData,
|
|
62
|
+
runtimeData: parentRuntimeData,
|
|
63
|
+
headerColor,
|
|
64
|
+
expandDataTable,
|
|
65
|
+
columns,
|
|
66
|
+
viewport,
|
|
67
|
+
formatLegendLocation,
|
|
68
|
+
tabbingId,
|
|
69
|
+
wrapColumns
|
|
70
|
+
} = props
|
|
57
71
|
const runtimeData = useMemo(() => {
|
|
58
72
|
const data = removeNullColumns(parentRuntimeData)
|
|
59
73
|
if (config.table.pivot) {
|
|
@@ -67,7 +81,11 @@ const DataTable = (props: DataTableProps) => {
|
|
|
67
81
|
|
|
68
82
|
const [expanded, setExpanded] = useState(expandDataTable)
|
|
69
83
|
|
|
70
|
-
const [sortBy, setSortBy] = useState<any>({
|
|
84
|
+
const [sortBy, setSortBy] = useState<any>({
|
|
85
|
+
column: config.type === 'map' ? 'geo' : 'date',
|
|
86
|
+
asc: false,
|
|
87
|
+
colIndex: null
|
|
88
|
+
})
|
|
71
89
|
|
|
72
90
|
const [accessibilityLabel, setAccessibilityLabel] = useState('')
|
|
73
91
|
|
|
@@ -86,7 +104,8 @@ const DataTable = (props: DataTableProps) => {
|
|
|
86
104
|
// Change accessibility label depending on expanded status
|
|
87
105
|
useEffect(() => {
|
|
88
106
|
const expandedLabel = 'Accessible data table.'
|
|
89
|
-
const collapsedLabel =
|
|
107
|
+
const collapsedLabel =
|
|
108
|
+
'Accessible data table. This table is currently collapsed visually but can still be read using a screen reader.'
|
|
90
109
|
|
|
91
110
|
if (expanded === true && accessibilityLabel !== expandedLabel) {
|
|
92
111
|
setAccessibilityLabel(expandedLabel)
|
|
@@ -141,7 +160,9 @@ const DataTable = (props: DataTableProps) => {
|
|
|
141
160
|
|
|
142
161
|
const caption = useMemo(() => {
|
|
143
162
|
if (config.type === 'map') {
|
|
144
|
-
return config.table.caption
|
|
163
|
+
return config.table.caption
|
|
164
|
+
? config.table.caption
|
|
165
|
+
: `Data table showing data for the ${mapLookup[config.general.geoType]} figure.`
|
|
145
166
|
} else {
|
|
146
167
|
return config.table.caption ? config.table.caption : `Data table showing data for the ${config.type} figure.`
|
|
147
168
|
}
|
|
@@ -199,44 +220,90 @@ const DataTable = (props: DataTableProps) => {
|
|
|
199
220
|
<ErrorBoundary component='DataTable'>
|
|
200
221
|
<MediaControls.Section classes={getMediaControlsClasses()}>
|
|
201
222
|
<MediaControls.Link config={config} dashboardDataConfig={dataConfig} />
|
|
202
|
-
{(config.table.download || config.general?.showDownloadButton) &&
|
|
223
|
+
{(config.table.download || config.general?.showDownloadButton) && (
|
|
224
|
+
<DownloadButton
|
|
225
|
+
rawData={getDownloadData()}
|
|
226
|
+
fileName={`${vizTitle || 'data-table'}.csv`}
|
|
227
|
+
headerColor={headerColor}
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
203
230
|
</MediaControls.Section>
|
|
204
|
-
<section
|
|
231
|
+
<section
|
|
232
|
+
id={tabbingId.replace('#', '')}
|
|
233
|
+
className={`data-table-container ${viewport} w-100`}
|
|
234
|
+
aria-label={accessibilityLabel}
|
|
235
|
+
>
|
|
205
236
|
<SkipTo skipId={skipId} skipMessage='Skip Data Table' />
|
|
206
|
-
{config.table.collapsible !== false &&
|
|
237
|
+
{config.table.collapsible !== false && (
|
|
238
|
+
<ExpandCollapse
|
|
239
|
+
expanded={expanded}
|
|
240
|
+
setExpanded={setExpanded}
|
|
241
|
+
fontSize={config.fontSize}
|
|
242
|
+
tableTitle={tableTitle}
|
|
243
|
+
viewport={viewport}
|
|
244
|
+
/>
|
|
245
|
+
)}
|
|
207
246
|
<div className='table-container' style={limitHeight}>
|
|
208
247
|
<Table
|
|
248
|
+
preliminaryData={config.preliminaryData}
|
|
209
249
|
viewport={viewport}
|
|
210
250
|
wrapColumns={wrapColumns}
|
|
211
|
-
childrenMatrix={
|
|
251
|
+
childrenMatrix={
|
|
252
|
+
config.type === 'map'
|
|
253
|
+
? mapCellMatrix({ rows, wrapColumns, ...props, runtimeData, viewport })
|
|
254
|
+
: chartCellMatrix({ rows, ...props, runtimeData, isVertical, sortBy, hasRowType, viewport })
|
|
255
|
+
}
|
|
212
256
|
tableName={config.type}
|
|
213
257
|
caption={caption}
|
|
214
258
|
stickyHeader
|
|
215
259
|
hasRowType={hasRowType}
|
|
216
|
-
headContent={
|
|
217
|
-
|
|
260
|
+
headContent={
|
|
261
|
+
config.type === 'map' ? (
|
|
262
|
+
<MapHeader columns={columns} {...props} sortBy={sortBy} setSortBy={setSortBy} />
|
|
263
|
+
) : (
|
|
264
|
+
<ChartHeader
|
|
265
|
+
data={runtimeData}
|
|
266
|
+
{...props}
|
|
267
|
+
hasRowType={hasRowType}
|
|
268
|
+
isVertical={isVertical}
|
|
269
|
+
sortBy={sortBy}
|
|
270
|
+
setSortBy={setSortBy}
|
|
271
|
+
/>
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
tableOptions={{
|
|
275
|
+
className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}${
|
|
276
|
+
isVertical ? '' : ' horizontal'
|
|
277
|
+
}`,
|
|
278
|
+
'aria-live': 'assertive',
|
|
279
|
+
'aria-rowcount': config?.data?.length ? config.data.length : -1,
|
|
280
|
+
hidden: !expanded
|
|
281
|
+
}}
|
|
218
282
|
fontSize={config.fontSize}
|
|
219
283
|
/>
|
|
220
284
|
|
|
221
285
|
{/* REGION Data Table */}
|
|
222
|
-
{noRelativeRegions &&
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
286
|
+
{noRelativeRegions &&
|
|
287
|
+
config.regions &&
|
|
288
|
+
config.regions.length > 0 &&
|
|
289
|
+
config.visualizationType !== 'Box Plot' && (
|
|
290
|
+
<Table
|
|
291
|
+
viewport={viewport}
|
|
292
|
+
wrapColumns={wrapColumns}
|
|
293
|
+
childrenMatrix={regionCellMatrix({ config })}
|
|
294
|
+
tableName={config.visualizationType}
|
|
295
|
+
caption='Table of the highlighted regions in the visualization'
|
|
296
|
+
headContent={
|
|
297
|
+
<tr>
|
|
298
|
+
<th>Region Name</th>
|
|
299
|
+
<th>Start Date</th>
|
|
300
|
+
<th>End Date</th>
|
|
301
|
+
</tr>
|
|
302
|
+
}
|
|
303
|
+
tableOptions={{ className: 'region-table data-table' }}
|
|
304
|
+
fontSize={config.fontSize}
|
|
305
|
+
/>
|
|
306
|
+
)}
|
|
240
307
|
</div>
|
|
241
308
|
</section>
|
|
242
309
|
<div id={skipId} className='cdcdataviz-sr-only'>
|
|
@@ -248,7 +315,11 @@ const DataTable = (props: DataTableProps) => {
|
|
|
248
315
|
// Render Data Table for Box Plots
|
|
249
316
|
return (
|
|
250
317
|
<ErrorBoundary component='DataTable'>
|
|
251
|
-
<section
|
|
318
|
+
<section
|
|
319
|
+
id={tabbingId.replace('#', '')}
|
|
320
|
+
className={`data-table-container ${viewport} w-100`}
|
|
321
|
+
aria-label={accessibilityLabel}
|
|
322
|
+
>
|
|
252
323
|
<SkipTo skipId={skipId} skipMessage='Skip Data Table' />
|
|
253
324
|
<ExpandCollapse expanded={expanded} setExpanded={setExpanded} tableTitle={tableTitle} />
|
|
254
325
|
<div className='table-container' style={limitHeight}>
|
|
@@ -260,7 +331,12 @@ const DataTable = (props: DataTableProps) => {
|
|
|
260
331
|
caption={caption}
|
|
261
332
|
stickyHeader
|
|
262
333
|
headContent={<BoxplotHeader categories={config.boxplot.categories} />}
|
|
263
|
-
tableOptions={{
|
|
334
|
+
tableOptions={{
|
|
335
|
+
className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}`,
|
|
336
|
+
'aria-live': 'assertive',
|
|
337
|
+
'aria-rowcount': 11,
|
|
338
|
+
hidden: !expanded
|
|
339
|
+
}}
|
|
264
340
|
fontSize={config.fontSize}
|
|
265
341
|
/>
|
|
266
342
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import LegendShape from '@cdc/core/components/LegendShape'
|
|
2
2
|
import { customSort } from './customSort'
|
|
3
3
|
import { getSeriesName } from './getSeriesName'
|
|
4
4
|
import { DataTableProps } from '../DataTable'
|
|
@@ -16,7 +16,7 @@ type ChartRowsProps = DataTableProps & {
|
|
|
16
16
|
hasRowType?: boolean
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const chartCellArray = ({ rows, runtimeData, config, isVertical, sortBy, colorScale, hasRowType
|
|
19
|
+
const chartCellArray = ({ rows, runtimeData, config, isVertical, sortBy, colorScale, hasRowType }: ChartRowsProps): CellMatrix | GroupCellMatrix => {
|
|
20
20
|
const groupBy = config.table?.groupBy
|
|
21
21
|
const dataSeriesColumns = getDataSeriesColumns(config, isVertical, runtimeData)
|
|
22
22
|
|
|
@@ -74,7 +74,7 @@ const chartCellArray = ({ rows, runtimeData, config, isVertical, sortBy, colorSc
|
|
|
74
74
|
config.visualizationType !== 'Pie'
|
|
75
75
|
? [
|
|
76
76
|
<>
|
|
77
|
-
{colorScale && colorScale(seriesName) && <
|
|
77
|
+
{colorScale && colorScale(seriesName) && <LegendShape fill={colorScale(seriesName)} />}
|
|
78
78
|
{seriesName}
|
|
79
79
|
</>
|
|
80
80
|
]
|
|
@@ -63,7 +63,7 @@ export const getChartCellValue = (row: string, column: string, config: TableConf
|
|
|
63
63
|
const barSeriesExist = config.runtime?.barSeriesKeys?.includes(column)
|
|
64
64
|
const lineSeriesExist = config.runtime?.lineSeriesKeys?.includes(column)
|
|
65
65
|
const showSymbol = config.general.showSuppressedSymbol
|
|
66
|
-
if (isValueMatch && isColumnMatch && pd.displayTable && pd.type === 'suppression') {
|
|
66
|
+
if (isValueMatch && isColumnMatch && pd.displayTable && pd.type === 'suppression' && config.visualizationSubType !== 'stacked') {
|
|
67
67
|
switch (config.visualizationType) {
|
|
68
68
|
case 'Combo':
|
|
69
69
|
cellValue = barSeriesExist && showSymbol ? pd.iconCode : lineSeriesExist && showSymbol ? pd.lineCode : ''
|
|
@@ -11,8 +11,8 @@ export const getDataSeriesColumns = (config: TableConfig, isVertical: boolean, r
|
|
|
11
11
|
let tmpSeriesColumns: string[] = []
|
|
12
12
|
if (config.visualizationType !== 'Pie') {
|
|
13
13
|
tmpSeriesColumns = isVertical ? [config.xAxis?.dataKey] : [] //, ...config.runtime.seriesLabelsAll
|
|
14
|
-
if (config.series) {
|
|
15
|
-
config.series.forEach(element => {
|
|
14
|
+
if (config.runtime?.series) {
|
|
15
|
+
config.runtime?.series.forEach(element => {
|
|
16
16
|
tmpSeriesColumns.push(element.dataKey)
|
|
17
17
|
})
|
|
18
18
|
} else if (runtimeData && runtimeData.length > 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import LegendShape from '@cdc/core/components/LegendShape'
|
|
2
2
|
import CellAnchor from '../components/CellAnchor'
|
|
3
3
|
import { DataTableProps } from '../DataTable'
|
|
4
4
|
import { ReactNode } from 'react'
|
|
@@ -7,7 +7,7 @@ type MapRowsProps = DataTableProps & {
|
|
|
7
7
|
rows: string[]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const mapCellArray = ({ rows, columns, runtimeData, config, applyLegendToRow, displayGeoName, formatLegendLocation, displayDataAsText, navigationHandler, setFilteredCountryCode
|
|
10
|
+
const mapCellArray = ({ rows, columns, runtimeData, config, applyLegendToRow, displayGeoName, formatLegendLocation, displayDataAsText, navigationHandler, setFilteredCountryCode }: MapRowsProps): ReactNode[][] => {
|
|
11
11
|
return rows.map(row =>
|
|
12
12
|
Object.keys(columns)
|
|
13
13
|
.filter(column => columns[column].dataTable === true && columns[column].name)
|
|
@@ -31,7 +31,7 @@ const mapCellArray = ({ rows, columns, runtimeData, config, applyLegendToRow, di
|
|
|
31
31
|
}
|
|
32
32
|
cellValue = (
|
|
33
33
|
<div className='col-12'>
|
|
34
|
-
<
|
|
34
|
+
<LegendShape fill={legendColor[0]} />
|
|
35
35
|
<CellAnchor markup={labelValue} row={rowObj} columns={columns} navigationHandler={navigationHandler} mapZoomHandler={mapZoomHandler} />
|
|
36
36
|
</div>
|
|
37
37
|
)
|
|
@@ -2,7 +2,7 @@ import { Axis } from '../../../types/Axis'
|
|
|
2
2
|
import { Runtime } from '../../../types/Runtime'
|
|
3
3
|
import { Region } from '../../../types/Region'
|
|
4
4
|
import { BoxPlot } from '../../../types/BoxPlot'
|
|
5
|
-
import { PreliminaryDataItem } from '@cdc/chart/src/
|
|
5
|
+
import { type PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
6
6
|
import { Visualization } from '../../../types/Visualization'
|
|
7
7
|
|
|
8
8
|
export type TableConfig = Visualization & {
|
|
@@ -9,6 +9,7 @@ export type Input = {
|
|
|
9
9
|
subsection?: any
|
|
10
10
|
updateField?: Function
|
|
11
11
|
fieldName?: string
|
|
12
|
+
display?: boolean
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export type TextFieldProps = {
|
|
@@ -39,7 +40,7 @@ export type SelectProps = {
|
|
|
39
40
|
} & Input
|
|
40
41
|
|
|
41
42
|
const TextField = memo((props: TextFieldProps) => {
|
|
42
|
-
const { label, tooltip, section = null, subsection = null, fieldName, updateField, value: stateValue, type = 'text', i = null, min = null, ...attributes } = props
|
|
43
|
+
const { display = true, label, tooltip, section = null, subsection = null, fieldName, updateField, value: stateValue, type = 'text', i = null, min = null, ...attributes } = props
|
|
43
44
|
const [value, setValue] = useState(stateValue)
|
|
44
45
|
const [debouncedValue] = useDebounce(value, 500)
|
|
45
46
|
|
|
@@ -76,6 +77,9 @@ const TextField = memo((props: TextFieldProps) => {
|
|
|
76
77
|
if ('date' === type) {
|
|
77
78
|
formElement = <input type='date' name={name} onChange={onChange} {...attributes} value={value} />
|
|
78
79
|
}
|
|
80
|
+
if (!display) {
|
|
81
|
+
return <></>
|
|
82
|
+
}
|
|
79
83
|
|
|
80
84
|
return (
|
|
81
85
|
<label>
|
|
@@ -89,8 +93,10 @@ const TextField = memo((props: TextFieldProps) => {
|
|
|
89
93
|
})
|
|
90
94
|
|
|
91
95
|
const CheckBox = memo((props: CheckboxProps) => {
|
|
92
|
-
const { label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes } = props
|
|
93
|
-
|
|
96
|
+
const { display = true, label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes } = props
|
|
97
|
+
if (!display) {
|
|
98
|
+
return <></>
|
|
99
|
+
}
|
|
94
100
|
return (
|
|
95
101
|
<label className='checkbox column-heading'>
|
|
96
102
|
<input
|
|
@@ -111,7 +117,7 @@ const CheckBox = memo((props: CheckboxProps) => {
|
|
|
111
117
|
})
|
|
112
118
|
|
|
113
119
|
const Select = memo((props: SelectProps) => {
|
|
114
|
-
const { label, value, options, fieldName, section = null, subsection = null, required = false, tooltip, updateField, initial: initialValue, ...attributes } = props
|
|
120
|
+
const { display = true, label, value, options, fieldName, section = null, subsection = null, required = false, tooltip, updateField, initial: initialValue, ...attributes } = props
|
|
115
121
|
let optionsJsx = options.map((optionName, index) => (
|
|
116
122
|
<option value={optionName} key={index}>
|
|
117
123
|
{optionName}
|
|
@@ -125,6 +131,9 @@ const Select = memo((props: SelectProps) => {
|
|
|
125
131
|
</option>
|
|
126
132
|
)
|
|
127
133
|
}
|
|
134
|
+
if (!display) {
|
|
135
|
+
return <></>
|
|
136
|
+
}
|
|
128
137
|
|
|
129
138
|
return (
|
|
130
139
|
<label>
|