@cdc/filtered-text 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/filtered-text",
3
- "version": "4.24.1",
3
+ "version": "4.24.3",
4
4
  "description": "React component for adding filtered text on dashboards.",
5
5
  "moduleName": "CdcFilteredText",
6
6
  "main": "dist/cdcfilteredtext",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
27
27
  "dependencies": {
28
- "@cdc/core": "^4.24.1",
28
+ "@cdc/core": "^4.24.3",
29
29
  "html-react-parser": "^3.0.8",
30
30
  "papaparse": "^5.3.2"
31
31
  },
@@ -33,5 +33,5 @@
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0"
35
35
  },
36
- "gitHead": "a352a3f74f4b681191e3244061dbb3621f36eec3"
36
+ "gitHead": "9c7ef7ca74f2d2a1e04d923b133fe0fc557a62bf"
37
37
  }
@@ -11,6 +11,7 @@ import Icon from '@cdc/core/components/ui/Icon'
11
11
  import Tooltip from '@cdc/core/components/ui/Tooltip'
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
 
@@ -22,40 +23,9 @@ const EditorPanel = memo(props => {
22
23
  const [displayPanel, setDisplayPanel] = useState(true)
23
24
  const [showConfigConfirm, setShowConfigConfirm] = useState(false)
24
25
 
25
- const updateField = (section, subsection, fieldName, newValue) => {
26
- // Top level
27
- if (null === section && null === subsection) {
28
- let updatedConfig = { ...config, [fieldName]: newValue }
29
-
30
- if ('filterColumn' === fieldName) {
31
- updatedConfig.filterValue = ''
32
- }
33
-
34
- updateConfig(updatedConfig)
35
- return
36
- }
37
- const isArray = Array.isArray(config[section])
38
-
39
- let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
40
-
41
- if (null !== subsection) {
42
- if (isArray) {
43
- sectionValue = [...config[section]]
44
- sectionValue[subsection] = { ...sectionValue[subsection], [fieldName]: newValue }
45
- } else if (typeof newValue === 'string') {
46
- sectionValue[subsection] = newValue
47
- } else {
48
- sectionValue = { ...config[section], [subsection]: { ...config[section][subsection], [fieldName]: newValue } }
49
- }
50
- }
51
-
52
- let updatedConfig = { ...config, [section]: sectionValue }
53
-
54
- updateConfig(updatedConfig)
55
- }
26
+ const updateField = updateFieldFactory(config, updateConfig, true)
56
27
 
57
28
  const missingRequiredSections = () => {
58
-
59
29
  return false
60
30
  }
61
31