@cdc/editor 4.25.3 → 4.25.6
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/cdceditor.js +54812 -55614
- package/package.json +13 -16
- package/src/CdcEditor.tsx +9 -0
- package/src/components/ChooseTab.tsx +23 -1
- package/src/components/ConfigureTab.tsx +9 -9
- package/src/components/DataImport/components/DataImport.tsx +1 -1
- package/src/index.jsx +2 -1
- package/src/scss/choose-vis-tab.scss +1 -1
- package/example/private/4-25-03-api-dash.json +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/editor",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.6",
|
|
4
4
|
"description": "React component for generating a new component entry",
|
|
5
5
|
"moduleName": "CdcEditor",
|
|
6
6
|
"main": "dist/cdceditor",
|
|
@@ -25,24 +25,21 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@cdc/chart": "^4.25.
|
|
29
|
-
"@cdc/core": "^4.25.
|
|
30
|
-
"@cdc/dashboard": "^4.25.
|
|
31
|
-
"@cdc/data-bite": "^4.25.
|
|
32
|
-
"@cdc/map": "^4.25.
|
|
33
|
-
"@cdc/markup-include": "^4.25.
|
|
34
|
-
"@cdc/waffle-chart": "^4.25.
|
|
35
|
-
"axios": "^1.
|
|
36
|
-
"d3": "^7.
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"react-table": "^7.6.2",
|
|
40
|
-
"use-debounce": "^5.2.0",
|
|
41
|
-
"whatwg-fetch": "^3.6.2"
|
|
28
|
+
"@cdc/chart": "^4.25.6",
|
|
29
|
+
"@cdc/core": "^4.25.6",
|
|
30
|
+
"@cdc/dashboard": "^4.25.6",
|
|
31
|
+
"@cdc/data-bite": "^4.25.6",
|
|
32
|
+
"@cdc/map": "^4.25.6",
|
|
33
|
+
"@cdc/markup-include": "^4.25.6",
|
|
34
|
+
"@cdc/waffle-chart": "^4.25.6",
|
|
35
|
+
"axios": "^1.9.0",
|
|
36
|
+
"d3": "^7.9.0",
|
|
37
|
+
"react-dropzone": "^14.3.8",
|
|
38
|
+
"use-debounce": "^10.0.5"
|
|
42
39
|
},
|
|
43
40
|
"peerDependencies": {
|
|
44
41
|
"react": "^18.2.0",
|
|
45
42
|
"react-dom": "^18.2.0"
|
|
46
43
|
},
|
|
47
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "6097de1ff814001880d9ac64bd66becdc092d63c"
|
|
48
45
|
}
|
package/src/CdcEditor.tsx
CHANGED
|
@@ -43,6 +43,15 @@ const CdcEditor: React.FC<WCMSProps> = ({ config: configObj, hostname, container
|
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
// for testing reducer using Redux Dev Tools
|
|
45
45
|
devToolsStore && devToolsStore?.init()
|
|
46
|
+
document.addEventListener('click', e => {
|
|
47
|
+
// Prevents mistaken clicks on label from triggering checkbox
|
|
48
|
+
// Can be removed once all custom checkboxes are replaced with Checkbox component from @cdc/core/components/EditorPanel/Inputs.tsx
|
|
49
|
+
if (e.target.className === 'checkbox') {
|
|
50
|
+
if (!['SPAN', 'INPUT'].includes(e.target.nodeName)) {
|
|
51
|
+
e.preventDefault()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
46
55
|
}, [])
|
|
47
56
|
|
|
48
57
|
const [state, dispatch] = useReducer(editorReducer, initialState)
|
|
@@ -25,6 +25,7 @@ import DeviationIcon from '@cdc/core/assets/icon-deviation-bar.svg'
|
|
|
25
25
|
import SankeyIcon from '@cdc/core/assets/icon-sankey.svg'
|
|
26
26
|
import ComboChartIcon from '@cdc/core/assets/icon-combo-chart.svg'
|
|
27
27
|
import EpiChartIcon from '@cdc/core/assets/icon-epi-chart.svg'
|
|
28
|
+
import TableIcon from '@cdc/core/assets/icon-table.svg'
|
|
28
29
|
import Icon from '@cdc/core/components/ui/Icon'
|
|
29
30
|
|
|
30
31
|
interface ButtonProps {
|
|
@@ -90,7 +91,20 @@ const ChooseTab: React.FC = (): JSX.Element => {
|
|
|
90
91
|
type: 'map'
|
|
91
92
|
}
|
|
92
93
|
newConfig['general'] = {
|
|
93
|
-
geoType: visualizationType
|
|
94
|
+
geoType: visualizationType,
|
|
95
|
+
type: props?.generalType
|
|
96
|
+
}
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case 'Table': {
|
|
101
|
+
const visualizationType = props.subType
|
|
102
|
+
newConfig = {
|
|
103
|
+
...props,
|
|
104
|
+
visualizationType,
|
|
105
|
+
newViz: true,
|
|
106
|
+
datasets: {},
|
|
107
|
+
type: 'table'
|
|
94
108
|
}
|
|
95
109
|
break
|
|
96
110
|
}
|
|
@@ -436,5 +450,13 @@ const buttons = [
|
|
|
436
450
|
generalType: 'us-geocode',
|
|
437
451
|
icon: <UsaIcon />,
|
|
438
452
|
content: 'United States GeoCode'
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
id: 24,
|
|
456
|
+
category: 'General',
|
|
457
|
+
label: 'Data Table',
|
|
458
|
+
type: 'table',
|
|
459
|
+
subType: null,
|
|
460
|
+
icon: <TableIcon />
|
|
439
461
|
}
|
|
440
462
|
]
|
|
@@ -9,9 +9,10 @@ import CdcMarkupInclude from '@cdc/markup-include/src/CdcMarkupInclude'
|
|
|
9
9
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
10
10
|
import ConfigContext from '../ConfigContext'
|
|
11
11
|
import MultiDashboardWrapper from '@cdc/dashboard/src/CdcDashboard'
|
|
12
|
+
import CdcDataTable from '../../../data-table/src/CdcDataTable'
|
|
12
13
|
|
|
13
14
|
export default function ConfigureTab({ containerEl }) {
|
|
14
|
-
const { config, setTempConfig,
|
|
15
|
+
const { config, setTempConfig, isDebug } = useContext(ConfigContext)
|
|
15
16
|
|
|
16
17
|
let { type } = config
|
|
17
18
|
|
|
@@ -19,14 +20,7 @@ export default function ConfigureTab({ containerEl }) {
|
|
|
19
20
|
case 'map':
|
|
20
21
|
return (
|
|
21
22
|
<ErrorBoundary component='CdcMap'>
|
|
22
|
-
<CdcMap
|
|
23
|
-
isEditor={true}
|
|
24
|
-
isDebug={isDebug}
|
|
25
|
-
config={config}
|
|
26
|
-
hostname={hostname}
|
|
27
|
-
setConfig={setTempConfig}
|
|
28
|
-
containerEl={containerEl}
|
|
29
|
-
/>
|
|
23
|
+
<CdcMap isEditor={true} config={config} containerEl={containerEl} setConfig={setTempConfig} />
|
|
30
24
|
</ErrorBoundary>
|
|
31
25
|
)
|
|
32
26
|
case 'waffle-chart':
|
|
@@ -62,6 +56,12 @@ export default function ConfigureTab({ containerEl }) {
|
|
|
62
56
|
<CdcMarkupInclude isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
63
57
|
</ErrorBoundary>
|
|
64
58
|
)
|
|
59
|
+
case 'table':
|
|
60
|
+
return (
|
|
61
|
+
<ErrorBoundary component='CdcDataTable'>
|
|
62
|
+
<CdcDataTable isEditor={true} isDebug={isDebug} config={config} />
|
|
63
|
+
</ErrorBoundary>
|
|
64
|
+
)
|
|
65
65
|
default:
|
|
66
66
|
return <p>No visualization type selected.</p>
|
|
67
67
|
}
|
package/src/index.jsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import ReactDOM from 'react-dom/client'
|
|
3
3
|
|
|
4
|
-
import CdcEditor from './CdcEditor'
|
|
5
4
|
import '@cdc/core/styles/cove-main.scss'
|
|
6
5
|
import './coreStyles_editor.scss'
|
|
7
6
|
|
|
7
|
+
import CdcEditor from './CdcEditor'
|
|
8
|
+
|
|
8
9
|
// Allow URL query to preselect a tab in standalone mode
|
|
9
10
|
const standaloneParams = new URLSearchParams(window.location.search)
|
|
10
11
|
let activeTab = Number.parseInt(standaloneParams.get('active')) - 1 || null
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dashboard": { "theme": "theme-blue", "sharedFilters": [] },
|
|
3
|
-
"rows": [{ "columns": [{ "width": 12 }, {}, {}] }],
|
|
4
|
-
"visualizations": {},
|
|
5
|
-
"table": {
|
|
6
|
-
"label": "Data Table",
|
|
7
|
-
"show": true,
|
|
8
|
-
"showDownloadUrl": false,
|
|
9
|
-
"showDownloadLinkBelow": true,
|
|
10
|
-
"showVertical": true
|
|
11
|
-
},
|
|
12
|
-
"errors": [],
|
|
13
|
-
"currentViewport": "lg",
|
|
14
|
-
"id": 15,
|
|
15
|
-
"category": "General",
|
|
16
|
-
"label": "Dashboard",
|
|
17
|
-
"type": "dashboard",
|
|
18
|
-
"subType": null,
|
|
19
|
-
"orientation": null,
|
|
20
|
-
"icon": { "key": null, "ref": null, "props": {}, "_owner": null },
|
|
21
|
-
"content": "Present multiple data visualizations with shared filter controls.",
|
|
22
|
-
"datasets": {
|
|
23
|
-
"COVE API Sample Data": {
|
|
24
|
-
"dataFileSize": 20641,
|
|
25
|
-
"dataFileName": "https://nccd-proxy-dev.cdc.gov/NCCD_COVE_API?$datakey=ardi_aad",
|
|
26
|
-
"dataFileSourceType": "url",
|
|
27
|
-
"dataFileFormat": "JSON",
|
|
28
|
-
"preview": true,
|
|
29
|
-
"dataUrl": "https://nccd-proxy-dev.cdc.gov/NCCD_COVE_API?$datakey=ardi_aad"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"visualizationType": null,
|
|
33
|
-
"activeVizButtonID": 15,
|
|
34
|
-
"version": "4.25.1",
|
|
35
|
-
"migrations": { "addColorMigration": true }
|
|
36
|
-
}
|