@cdc/core 4.25.2-25 → 4.25.3
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 +11 -9
- package/components/DataTable/DataTable.tsx +48 -26
- package/components/DataTable/components/ChartHeader.tsx +1 -1
- package/components/DataTable/helpers/getChartCellValue.ts +11 -5
- package/components/DataTable/helpers/getDataSeriesColumns.ts +7 -3
- package/components/DataTable/helpers/mapCellMatrix.tsx +64 -33
- package/components/DataTable/helpers/tests/mapCellMatrix.test.ts +80 -0
- package/components/EditorPanel/DataTableEditor.tsx +28 -18
- package/components/EditorPanel/Inputs.tsx +2 -1
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +23 -0
- package/components/Filters/Filters.tsx +20 -8
- package/components/Layout/components/Visualization/visualizations.scss +1 -1
- package/components/MediaControls.jsx +14 -7
- package/components/NestedDropdown/NestedDropdown.tsx +5 -1
- package/components/NestedDropdown/nesteddropdown.styles.css +8 -4
- package/components/elements/Button.jsx +4 -2
- package/dist/cove-main.css +98 -151
- package/dist/cove-main.css.map +1 -1
- package/helpers/DataTransform.ts +2 -2
- package/helpers/addValuesToFilters.ts +1 -1
- package/helpers/coveUpdateWorker.ts +12 -7
- package/helpers/formatConfigBeforeSave.ts +30 -8
- package/helpers/isRightAlignedTableValue.js +5 -1
- package/helpers/isSolr.ts +13 -0
- package/helpers/labelHash.ts +21 -0
- package/helpers/pivotData.ts +14 -7
- package/helpers/tests/formatConfigBeforeSave.test.ts +68 -0
- package/helpers/tests/pivotData.test.ts +23 -19
- package/helpers/ver/4.25.3.ts +20 -0
- package/helpers/ver/tests/versionNeedsUpdate.test.ts +28 -0
- package/package.json +2 -2
- package/styles/_global-variables.scss +2 -1
- package/styles/_global.scss +18 -9
- package/styles/base.scss +42 -0
- package/styles/filters.scss +5 -11
- package/styles/v2/components/button.scss +48 -12
- package/styles/v2/themes/_color-definitions.scss +1 -4
- package/types/General.ts +0 -1
- package/types/Table.ts +2 -0
- package/helpers/isSolr.js +0 -13
|
@@ -26,6 +26,8 @@ export const VIZ_FILTER_STYLE = {
|
|
|
26
26
|
multiSelect: 'multi-select'
|
|
27
27
|
} as const
|
|
28
28
|
|
|
29
|
+
export const DROPDOWN_STYLES = 'py-2 ps-2 w-100 d-block'
|
|
30
|
+
|
|
29
31
|
export type VizFilterStyle = (typeof VIZ_FILTER_STYLE)[keyof typeof VIZ_FILTER_STYLE]
|
|
30
32
|
|
|
31
33
|
export const filterStyleOptions = Object.values(VIZ_FILTER_STYLE)
|
|
@@ -49,7 +51,7 @@ export const filterOrderOptions: { label: string; value: OrderBy }[] = [
|
|
|
49
51
|
export const useFilters = props => {
|
|
50
52
|
const [showApplyButton, setShowApplyButton] = useState(false)
|
|
51
53
|
|
|
52
|
-
//
|
|
54
|
+
// Deconstructing: notice, adding more descriptive visualizationConfig name over config
|
|
53
55
|
// visualizationConfig feels more robust for all vis types so that its not confused with config/state/etc.
|
|
54
56
|
const {
|
|
55
57
|
config: visualizationConfig,
|
|
@@ -250,8 +252,8 @@ export const useFilters = props => {
|
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
const filterConstants = {
|
|
253
|
-
buttonText: 'Apply
|
|
254
|
-
resetText: '
|
|
255
|
+
buttonText: 'Apply',
|
|
256
|
+
resetText: 'Clear Filters'
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
// prettier-ignore
|
|
@@ -285,6 +287,16 @@ const Filters = (props: FilterProps) => {
|
|
|
285
287
|
const [mobileFilterStyle, setMobileFilterStyle] = useState(false)
|
|
286
288
|
const [selectedFilter, setSelectedFilter] = useState<EventTarget>(null)
|
|
287
289
|
const [wrappingFilters, setWrappingFilters] = useState({})
|
|
290
|
+
const [initialActiveFilters, setInitialActiveFilters] = useState([])
|
|
291
|
+
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
if (!filteredData) return
|
|
294
|
+
|
|
295
|
+
setInitialActiveFilters(filters.map(filter => filter.active))
|
|
296
|
+
}, [])
|
|
297
|
+
|
|
298
|
+
const activeFilters = filters.map(filter => filter.active)
|
|
299
|
+
const initialFiltersActive = initialActiveFilters.every((filter, i) => activeFilters.includes(filter))
|
|
288
300
|
const id = useId()
|
|
289
301
|
|
|
290
302
|
const wrappingFilterRefs = useRef({})
|
|
@@ -378,7 +390,7 @@ const Filters = (props: FilterProps) => {
|
|
|
378
390
|
id={`filter-${outerIndex}`}
|
|
379
391
|
name={label}
|
|
380
392
|
aria-label={`Filter by ${label}`}
|
|
381
|
-
className=
|
|
393
|
+
className={`cove-form-select ${DROPDOWN_STYLES}`}
|
|
382
394
|
data-index='0'
|
|
383
395
|
value={active}
|
|
384
396
|
onChange={e => {
|
|
@@ -547,7 +559,7 @@ const Filters = (props: FilterProps) => {
|
|
|
547
559
|
{visualizationConfig.filterIntro && (
|
|
548
560
|
<p className='filters-section__intro-text mb-3'>{visualizationConfig.filterIntro}</p>
|
|
549
561
|
)}
|
|
550
|
-
<div className='d-flex flex-wrap w-100
|
|
562
|
+
<div className='d-flex flex-wrap w-100 filters-section__wrapper align-items-end'>
|
|
551
563
|
{' '}
|
|
552
564
|
<>
|
|
553
565
|
<Style />
|
|
@@ -558,13 +570,13 @@ const Filters = (props: FilterProps) => {
|
|
|
558
570
|
handleApplyButton(filters)
|
|
559
571
|
}}
|
|
560
572
|
disabled={!showApplyButton}
|
|
561
|
-
className={[general?.headerColor ? general.headerColor : theme, 'apply'].join(' ')}
|
|
573
|
+
className={[general?.headerColor ? general.headerColor : theme, 'apply', 'me-2'].join(' ')}
|
|
562
574
|
>
|
|
563
575
|
{filterConstants.buttonText}
|
|
564
576
|
</Button>
|
|
565
|
-
<
|
|
577
|
+
<Button secondary disabled={initialFiltersActive} onClick={handleReset}>
|
|
566
578
|
{filterConstants.resetText}
|
|
567
|
-
</
|
|
579
|
+
</Button>
|
|
568
580
|
</div>
|
|
569
581
|
) : (
|
|
570
582
|
<></>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
// import html2pdf from 'html2pdf.js'
|
|
3
|
-
import html2canvas from 'html2canvas'
|
|
4
3
|
|
|
5
4
|
const buttonText = {
|
|
6
5
|
pdf: 'Download PDF',
|
|
@@ -76,12 +75,20 @@ const generateMedia = (state, type, elementToCapture) => {
|
|
|
76
75
|
|
|
77
76
|
switch (type) {
|
|
78
77
|
case 'image':
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
const downloadImage = async () => {
|
|
79
|
+
import(/* webpackChunkName: "html2canvas" */ 'html2canvas').then(mod => {
|
|
80
|
+
mod
|
|
81
|
+
.default(baseSvg, {
|
|
82
|
+
ignoreElements: el =>
|
|
83
|
+
el.className?.indexOf &&
|
|
84
|
+
el.className.search(/download-buttons|download-links|data-table-container/) !== -1
|
|
85
|
+
})
|
|
86
|
+
.then(canvas => {
|
|
87
|
+
saveImageAs(canvas.toDataURL(), filename + '.png')
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
downloadImage()
|
|
85
92
|
return
|
|
86
93
|
case 'pdf':
|
|
87
94
|
// let opt = {
|
|
@@ -283,7 +283,11 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
283
283
|
onFocus={() => setInputHasFocus(true)}
|
|
284
284
|
/>
|
|
285
285
|
<span className='list-arrow' aria-hidden={true}>
|
|
286
|
-
|
|
286
|
+
{isListOpened ? (
|
|
287
|
+
<Icon display='caretUp' alt='arrow pointing up' />
|
|
288
|
+
) : (
|
|
289
|
+
<Icon display='caretDown' alt='arrow pointing down' />
|
|
290
|
+
)}
|
|
287
291
|
</span>
|
|
288
292
|
</div>
|
|
289
293
|
{loading && <Loader spinnerType={'text-secondary'} />}
|
|
@@ -29,11 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
[class^='main-nested-dropdown-container-'] {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
[class^='main-nested-dropdown-container-'],
|
|
33
37
|
.nested-dropdown-input-container {
|
|
34
38
|
border: 1px solid var(--cool-gray-10);
|
|
35
39
|
min-width: 200px;
|
|
36
|
-
cursor: pointer;
|
|
37
40
|
padding: 0.4rem 0.75rem;
|
|
38
41
|
font-size: 1em;
|
|
39
42
|
}
|
|
@@ -57,14 +60,15 @@
|
|
|
57
60
|
|
|
58
61
|
.nested-dropdown-input-container {
|
|
59
62
|
display: block;
|
|
60
|
-
width: 100
|
|
63
|
+
width: calc(100% + 7px);
|
|
61
64
|
border-radius: 0.25rem;
|
|
62
65
|
position: relative;
|
|
63
66
|
& > span.list-arrow {
|
|
64
67
|
position: absolute;
|
|
65
68
|
top: 9px;
|
|
66
|
-
right:
|
|
69
|
+
right: 9px;
|
|
67
70
|
float: right;
|
|
71
|
+
pointer-events: none;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
&.disabled {
|
|
@@ -77,7 +81,7 @@
|
|
|
77
81
|
|
|
78
82
|
& [class^='main-nested-dropdown-container-'] {
|
|
79
83
|
max-height: 375px;
|
|
80
|
-
overflow-y:
|
|
84
|
+
overflow-y: auto;
|
|
81
85
|
position: absolute;
|
|
82
86
|
z-index: 3;
|
|
83
87
|
min-width: 200px;
|
|
@@ -16,6 +16,7 @@ const Button = ({
|
|
|
16
16
|
active = false,
|
|
17
17
|
onClick,
|
|
18
18
|
children,
|
|
19
|
+
secondary,
|
|
19
20
|
...attributes
|
|
20
21
|
}) => {
|
|
21
22
|
const buttonRef = useRef(null)
|
|
@@ -33,7 +34,8 @@ const Button = ({
|
|
|
33
34
|
(flexCenter || 'loader' === role ? ' cove-button--flex-center' : '') +
|
|
34
35
|
(fluid ? ' fluid' : '') +
|
|
35
36
|
(loading ? ' loading' : '') +
|
|
36
|
-
(attributes.className ? ' ' + attributes.className : '')
|
|
37
|
+
(attributes.className ? ' ' + attributes.className : '') +
|
|
38
|
+
(secondary ? ' secondary' : ''),
|
|
37
39
|
onMouseOver: () => setButtonState('in'),
|
|
38
40
|
onMouseOut: () => setButtonState('out'),
|
|
39
41
|
onFocus: () => setButtonState('in'),
|
|
@@ -89,7 +91,7 @@ const Button = ({
|
|
|
89
91
|
{...attributesObj}
|
|
90
92
|
onClick={e => {
|
|
91
93
|
e.preventDefault()
|
|
92
|
-
return loading || onClick()
|
|
94
|
+
return loading || onClick(e)
|
|
93
95
|
}}
|
|
94
96
|
disabled={loading || attributesObj.disabled}
|
|
95
97
|
ref={buttonRef}
|