@cdc/markup-include 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/markup-include",
3
- "version": "4.24.1",
3
+ "version": "4.24.3",
4
4
  "description": "React component for displaying HTML content from an outside link",
5
5
  "moduleName": "CdcMarkupInclude",
6
6
  "main": "dist/cdcmarkupinclude",
@@ -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.1",
29
+ "@cdc/core": "^4.24.3",
30
30
  "axios": "^1.6.0",
31
31
  "chroma": "0.0.1",
32
32
  "chroma-js": "^2.1.0",
@@ -38,5 +38,5 @@
38
38
  "react": "^18.2.0",
39
39
  "react-dom": "^18.2.0"
40
40
  },
41
- "gitHead": "a352a3f74f4b681191e3244061dbb3621f36eec3"
41
+ "gitHead": "9c7ef7ca74f2d2a1e04d923b133fe0fc557a62bf"
42
42
  }
@@ -6,6 +6,7 @@ import ConfigContext from '../ConfigContext'
6
6
 
7
7
  import Accordion from '@cdc/core/components/ui/Accordion'
8
8
  import InputText from '@cdc/core/components/inputs/InputText'
9
+ import { updateFieldFactory } from '@cdc/core/helpers/updateFieldFactory'
9
10
 
10
11
  import '@cdc/core/styles/v2/components/editor.scss'
11
12
 
@@ -17,38 +18,7 @@ const EditorPanel = memo(props => {
17
18
  const [displayPanel, setDisplayPanel] = useState(true)
18
19
  const [showConfigConfirm, setShowConfigConfirm] = useState(false)
19
20
 
20
- const updateField = (section, subsection, fieldName, newValue) => {
21
- // Top level
22
- if (null === section && null === subsection) {
23
- let updatedConfig = { ...config, [fieldName]: newValue }
24
-
25
- if ('filterColumn' === fieldName) {
26
- updatedConfig.filterValue = ''
27
- }
28
-
29
- updateConfig(updatedConfig)
30
- return
31
- }
32
-
33
- const isArray = Array.isArray(config[section])
34
-
35
- let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
36
-
37
- if (null !== subsection) {
38
- if (isArray) {
39
- sectionValue = [...config[section]]
40
- sectionValue[subsection] = { ...sectionValue[subsection], [fieldName]: newValue }
41
- } else if (typeof newValue === 'string') {
42
- sectionValue[subsection] = newValue
43
- } else {
44
- sectionValue = { ...config[section], [subsection]: { ...config[section][subsection], [fieldName]: newValue } }
45
- }
46
- }
47
-
48
- let updatedConfig = { ...config, [section]: sectionValue }
49
-
50
- updateConfig(updatedConfig)
51
- }
21
+ const updateField = updateFieldFactory(config, updateConfig, true)
52
22
 
53
23
  const missingRequiredSections = () => {
54
24
  return false