@cdc/waffle-chart 4.24.1 → 4.24.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/dist/cdcwafflechart.js +2432 -2433
- package/package.json +3 -3
- package/src/CdcWaffleChart.tsx +1 -1
- package/src/components/EditorPanel.jsx +2 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/waffle-chart",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.3",
|
|
4
4
|
"description": "React component for displaying a single piece of data in a card module",
|
|
5
5
|
"moduleName": "CdcWaffleChart",
|
|
6
6
|
"main": "dist/cdcwafflechart",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cdc/core": "^4.24.
|
|
29
|
+
"@cdc/core": "^4.24.3",
|
|
30
30
|
"@visx/group": "^3.0.0",
|
|
31
31
|
"@visx/scale": "^3.0.0",
|
|
32
32
|
"@visx/shape": "^3.0.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react": "^18.2.0",
|
|
42
42
|
"react-dom": "^18.2.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9c7ef7ca74f2d2a1e04d923b133fe0fc557a62bf"
|
|
45
45
|
}
|
package/src/CdcWaffleChart.tsx
CHANGED
|
@@ -307,7 +307,7 @@ const WaffleChart = ({ config, isEditor, link = '' }) => {
|
|
|
307
307
|
{config.visualizationType !== 'Gauge' && (
|
|
308
308
|
<div className={`cove-waffle-chart${orientation === 'vertical' ? ' cove-waffle-chart--verical' : ''}${config.overallFontSize ? ' font-' + config.overallFontSize : ''}`}>
|
|
309
309
|
<div className='cove-waffle-chart__chart' style={{ width: setRatio() }}>
|
|
310
|
-
<svg width={setRatio()} height={setRatio()}
|
|
310
|
+
<svg width={setRatio()} height={setRatio()}>
|
|
311
311
|
<Group>{buildWaffle()}</Group>
|
|
312
312
|
</svg>
|
|
313
313
|
</div>
|
|
@@ -11,6 +11,7 @@ import Tooltip from '@cdc/core/components/ui/Tooltip'
|
|
|
11
11
|
import InputText from '@cdc/core/components/inputs/InputText'
|
|
12
12
|
import InputSelect from '@cdc/core/components/inputs/InputSelect'
|
|
13
13
|
import InputCheckbox from '@cdc/core/components/inputs/InputCheckbox'
|
|
14
|
+
import { updateFieldFactory } from '@cdc/core/helpers/updateFieldFactory'
|
|
14
15
|
|
|
15
16
|
import '@cdc/core/styles/v2/components/editor.scss'
|
|
16
17
|
import WarningImage from '../images/warning.svg'
|
|
@@ -42,37 +43,7 @@ const EditorPanel = memo(props => {
|
|
|
42
43
|
const [showConfigConfirm, setShowConfigConfirm] = useState(false)
|
|
43
44
|
const inputSelectStyle = condition => (condition ? { backgroundColor: '#ffd2d2', color: '#d8000c' } : {})
|
|
44
45
|
|
|
45
|
-
const updateField = (
|
|
46
|
-
// Top level
|
|
47
|
-
if (null === section && null === subsection) {
|
|
48
|
-
let updatedConfig = { ...config, [fieldName]: newValue }
|
|
49
|
-
|
|
50
|
-
if ('filterColumn' === fieldName) {
|
|
51
|
-
updatedConfig.filterValue = ''
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
updateConfig(updatedConfig)
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const isArray = Array.isArray(config[section])
|
|
59
|
-
|
|
60
|
-
let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
|
|
61
|
-
|
|
62
|
-
if (null !== subsection) {
|
|
63
|
-
if (isArray) {
|
|
64
|
-
sectionValue = [...config[section]]
|
|
65
|
-
sectionValue[subsection] = { ...sectionValue[subsection], [fieldName]: newValue }
|
|
66
|
-
} else if (typeof newValue === 'string') {
|
|
67
|
-
sectionValue[subsection] = newValue
|
|
68
|
-
} else {
|
|
69
|
-
sectionValue = { ...config[section], [subsection]: { ...config[section][subsection], [fieldName]: newValue } }
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
let updatedConfig = { ...config, [section]: sectionValue }
|
|
73
|
-
|
|
74
|
-
updateConfig(updatedConfig)
|
|
75
|
-
}
|
|
46
|
+
const updateField = updateFieldFactory(config, updateConfig, true)
|
|
76
47
|
|
|
77
48
|
useEffect(() => {
|
|
78
49
|
// Pass up to Editor if needed
|