@cdc/editor 4.23.2 → 4.23.4
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 +193984 -188905
- package/package.json +12 -10
- package/src/CdcEditor.jsx +3 -2
- package/src/components/ChooseTab.jsx +17 -4
- package/src/components/ConfigureTab.jsx +7 -7
- package/src/components/DataImport.jsx +12 -2
- package/src/components/SampleData.jsx +20 -8
- package/src/index.jsx +4 -2
- package/src/samples/valid-area-chart.json +56 -0
- package/src/samples/valid-world-geocode.json +18 -0
- package/src/scss/main.scss +12 -0
- package/src/test/CdcEditor.test.jsx +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/editor",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.4",
|
|
4
4
|
"description": "React component for generating a new component entry",
|
|
5
5
|
"moduleName": "CdcEditor",
|
|
6
6
|
"main": "dist/cdceditor",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"preview": "vite preview",
|
|
12
12
|
"graph": "nx graph",
|
|
13
|
-
"prepublishOnly": "lerna run --scope @cdc/editor build"
|
|
13
|
+
"prepublishOnly": "lerna run --scope @cdc/editor build",
|
|
14
|
+
"test": "vitest watch --reporter verbose",
|
|
15
|
+
"test:ui": "vitest --ui"
|
|
14
16
|
},
|
|
15
17
|
"repository": {
|
|
16
18
|
"type": "git",
|
|
@@ -22,13 +24,13 @@
|
|
|
22
24
|
},
|
|
23
25
|
"license": "Apache-2.0",
|
|
24
26
|
"dependencies": {
|
|
25
|
-
"@cdc/chart": "^4.23.
|
|
26
|
-
"@cdc/core": "^4.23.
|
|
27
|
-
"@cdc/dashboard": "^4.23.
|
|
28
|
-
"@cdc/data-bite": "^4.23.
|
|
29
|
-
"@cdc/map": "^4.23.
|
|
30
|
-
"@cdc/markup-include": "^4.23.
|
|
31
|
-
"@cdc/waffle-chart": "^4.23.
|
|
27
|
+
"@cdc/chart": "^4.23.4",
|
|
28
|
+
"@cdc/core": "^4.23.4",
|
|
29
|
+
"@cdc/dashboard": "^4.23.4",
|
|
30
|
+
"@cdc/data-bite": "^4.23.4",
|
|
31
|
+
"@cdc/map": "^4.23.4",
|
|
32
|
+
"@cdc/markup-include": "^4.23.4",
|
|
33
|
+
"@cdc/waffle-chart": "^4.23.4",
|
|
32
34
|
"axios": "^0.21.1",
|
|
33
35
|
"d3": "^7.0.0",
|
|
34
36
|
"html-react-parser": "^3.0.8",
|
|
@@ -41,5 +43,5 @@
|
|
|
41
43
|
"react": "^18.2.0",
|
|
42
44
|
"react-dom": "^18.2.0"
|
|
43
45
|
},
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "dcd395d76f70b2d113f2b4c6fe50a52522655cd1"
|
|
45
47
|
}
|
package/src/CdcEditor.jsx
CHANGED
|
@@ -19,7 +19,7 @@ import Tabs from './components/Tabs'
|
|
|
19
19
|
|
|
20
20
|
import './scss/main.scss'
|
|
21
21
|
|
|
22
|
-
export default function CdcEditor({ config: configObj = { newViz: true }, hostname, containerEl, sharepath }) {
|
|
22
|
+
export default function CdcEditor({ config: configObj = { newViz: true }, hostname, containerEl, sharepath, isDebug }) {
|
|
23
23
|
const [config, setConfig] = useState(configObj)
|
|
24
24
|
const [tempConfig, setTempConfig] = useState(null)
|
|
25
25
|
const [errors, setErrors] = useState([])
|
|
@@ -146,7 +146,8 @@ export default function CdcEditor({ config: configObj = { newViz: true }, hostna
|
|
|
146
146
|
setGlobalActive,
|
|
147
147
|
tempConfig,
|
|
148
148
|
setTempConfig,
|
|
149
|
-
sharepath
|
|
149
|
+
sharepath,
|
|
150
|
+
isDebug
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
let configureDisabled = true
|
|
@@ -16,7 +16,9 @@ import WaffleChartIcon from '@cdc/core/assets/icon-grid.svg'
|
|
|
16
16
|
import AlabamaGraphic from '@cdc/core/assets/icon-map-alabama.svg'
|
|
17
17
|
import PairedBarIcon from '@cdc/core/assets/icon-chart-bar-paired.svg'
|
|
18
18
|
import HorizontalStackIcon from '@cdc/core/assets/icon-chart-bar-stacked.svg'
|
|
19
|
-
import
|
|
19
|
+
import ScatterPlotIcon from '@cdc/core/assets/icon-chart-scatterplot.svg'
|
|
20
|
+
import BoxPlotIcon from '@cdc/core/assets/icon-chart-box-whisker.svg'
|
|
21
|
+
import AreaChartIcon from '@cdc/core/assets/icon-area-chart.svg'
|
|
20
22
|
|
|
21
23
|
export default function ChooseTab() {
|
|
22
24
|
const { config, setConfig, setGlobalActive, tempConfig, setTempConfig } = useContext(ConfigContext)
|
|
@@ -184,11 +186,14 @@ export default function ChooseTab() {
|
|
|
184
186
|
<Tooltip.Content>Use bars to show comparisons between data categories.</Tooltip.Content>
|
|
185
187
|
</Tooltip>
|
|
186
188
|
</li>
|
|
189
|
+
</ul>
|
|
190
|
+
|
|
191
|
+
<ul className='grid cove-temp'>
|
|
187
192
|
{/* temporarily hiding these */}
|
|
188
|
-
|
|
193
|
+
<li>
|
|
189
194
|
<Tooltip>
|
|
190
195
|
<Tooltip.Target>
|
|
191
|
-
<IconButton label='Box Plot' type='chart' subType='Box Plot' orientation='vertical' icon={<
|
|
196
|
+
<IconButton label='Box Plot' type='chart' subType='Box Plot' orientation='vertical' icon={<BoxPlotIcon />} />
|
|
192
197
|
</Tooltip.Target>
|
|
193
198
|
<Tooltip.Content>Display a box plot</Tooltip.Content>
|
|
194
199
|
</Tooltip>
|
|
@@ -196,10 +201,18 @@ export default function ChooseTab() {
|
|
|
196
201
|
<li>
|
|
197
202
|
<Tooltip>
|
|
198
203
|
<Tooltip.Target>
|
|
199
|
-
<IconButton label='Scatter Plot' type='chart' subType='Scatter Plot' orientation='vertical' icon={<
|
|
204
|
+
<IconButton label='Scatter Plot' type='chart' subType='Scatter Plot' orientation='vertical' icon={<ScatterPlotIcon />} />
|
|
200
205
|
</Tooltip.Target>
|
|
201
206
|
<Tooltip.Content>Display a scatter plot</Tooltip.Content>
|
|
202
207
|
</Tooltip>
|
|
208
|
+
</li>
|
|
209
|
+
{/* <li>
|
|
210
|
+
<Tooltip>
|
|
211
|
+
<Tooltip.Target>
|
|
212
|
+
<IconButton label='Area Chart' type='chart' subType='Area Chart' orientation='vertical' icon={<AreaChartIcon />} />
|
|
213
|
+
</Tooltip.Target>
|
|
214
|
+
<Tooltip.Content>Display an area chart</Tooltip.Content>
|
|
215
|
+
</Tooltip>
|
|
203
216
|
</li> */}
|
|
204
217
|
</ul>
|
|
205
218
|
|
|
@@ -13,7 +13,7 @@ import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
|
13
13
|
import ConfigContext from '../ConfigContext'
|
|
14
14
|
|
|
15
15
|
export default function ConfigureTab({ containerEl }) {
|
|
16
|
-
const { config, setTempConfig, hostname } = useContext(ConfigContext)
|
|
16
|
+
const { config, setTempConfig, hostname, isDebug } = useContext(ConfigContext)
|
|
17
17
|
|
|
18
18
|
let { type } = config
|
|
19
19
|
|
|
@@ -21,37 +21,37 @@ export default function ConfigureTab({ containerEl }) {
|
|
|
21
21
|
case 'map':
|
|
22
22
|
return (
|
|
23
23
|
<ErrorBoundary component='CdcMap'>
|
|
24
|
-
<CdcMap isEditor={true} config={config} hostname={hostname} setConfig={setTempConfig} containerEl={containerEl} />
|
|
24
|
+
<CdcMap isEditor={true} isDebug={isDebug} config={config} hostname={hostname} setConfig={setTempConfig} containerEl={containerEl} />
|
|
25
25
|
</ErrorBoundary>
|
|
26
26
|
)
|
|
27
27
|
case 'chart':
|
|
28
28
|
return (
|
|
29
29
|
<ErrorBoundary component='CdcChart'>
|
|
30
|
-
<CdcChart isEditor={true} config={config} setConfig={setTempConfig} />
|
|
30
|
+
<CdcChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
31
31
|
</ErrorBoundary>
|
|
32
32
|
)
|
|
33
33
|
case 'dashboard':
|
|
34
34
|
return (
|
|
35
35
|
<ErrorBoundary component='CdcDashboard'>
|
|
36
|
-
<CdcDashboard isEditor={true} config={config} setConfig={setTempConfig} />
|
|
36
|
+
<CdcDashboard isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
37
37
|
</ErrorBoundary>
|
|
38
38
|
)
|
|
39
39
|
case 'data-bite':
|
|
40
40
|
return (
|
|
41
41
|
<ErrorBoundary component='CdcDashboard'>
|
|
42
|
-
<CdcDataBite isEditor={true} config={config} setConfig={setTempConfig} />
|
|
42
|
+
<CdcDataBite isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
43
43
|
</ErrorBoundary>
|
|
44
44
|
)
|
|
45
45
|
case 'waffle-chart':
|
|
46
46
|
return (
|
|
47
47
|
<ErrorBoundary component='CdcDashboard'>
|
|
48
|
-
<CdcWaffleChart isEditor={true} config={config} setConfig={setTempConfig} />
|
|
48
|
+
<CdcWaffleChart isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
49
49
|
</ErrorBoundary>
|
|
50
50
|
)
|
|
51
51
|
case 'markup-include':
|
|
52
52
|
return (
|
|
53
53
|
<ErrorBoundary component='CdcDashboard'>
|
|
54
|
-
<CdcMarkupInclude isEditor={true} config={config} setConfig={setTempConfig} />
|
|
54
|
+
<CdcMarkupInclude isEditor={true} isDebug={isDebug} config={config} setConfig={setTempConfig} />
|
|
55
55
|
</ErrorBoundary>
|
|
56
56
|
)
|
|
57
57
|
default:
|
|
@@ -394,10 +394,20 @@ export default function DataImport() {
|
|
|
394
394
|
const resetButton = () => {
|
|
395
395
|
return (
|
|
396
396
|
//todo convert to modal
|
|
397
|
-
|
|
397
|
+
<>
|
|
398
|
+
<button className='btn danger' onClick={() => resetEditor({ type: config.type, visualizationType: config.visualizationType }, 'Resetting will remove your data and settings. Do you want to continue?')}>
|
|
398
399
|
Clear
|
|
399
400
|
<CloseIcon />
|
|
400
|
-
|
|
401
|
+
</button>
|
|
402
|
+
{/* DEV-851 link to replace file should pop file dialog */}
|
|
403
|
+
{config.dataFileSourceType === 'file' && (
|
|
404
|
+
<div className='link link-replace' {...getRootProps2()}>
|
|
405
|
+
<input {...getInputProps2()} />
|
|
406
|
+
<p>
|
|
407
|
+
<span>or replace file</span>
|
|
408
|
+
</p>
|
|
409
|
+
</div>)}
|
|
410
|
+
</>
|
|
401
411
|
)
|
|
402
412
|
}
|
|
403
413
|
|
|
@@ -8,6 +8,8 @@ import validCountyMapData from './../samples/valid-county-data.csv?raw'
|
|
|
8
8
|
import validGeoPoint from './../samples/valid-geo-point.csv?raw'
|
|
9
9
|
import validScatterPlot from './../samples/valid-scatterplot.csv?raw'
|
|
10
10
|
import validBoxPlotData from './../samples/valid-boxplot.csv?raw'
|
|
11
|
+
import validAreaChart from './../samples/valid-area-chart.json?raw'
|
|
12
|
+
import validWorldGeocodeData from './../samples/valid-world-geocode.json?raw'
|
|
11
13
|
|
|
12
14
|
// Add additional data to samples
|
|
13
15
|
const sampleData = {
|
|
@@ -17,15 +19,20 @@ const sampleData = {
|
|
|
17
19
|
fileName: 'valid-data-chart.csv',
|
|
18
20
|
data: validChartData
|
|
19
21
|
},
|
|
22
|
+
{
|
|
23
|
+
text: 'Box Plot Sample Data',
|
|
24
|
+
fileName: 'valid-boxplot.csv',
|
|
25
|
+
data: validBoxPlotData
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
text: 'Scatter Plot Sample Data',
|
|
29
|
+
fileName: 'valid-scatterplot.csv',
|
|
30
|
+
data: validScatterPlot
|
|
31
|
+
}
|
|
20
32
|
// {
|
|
21
|
-
// text: '
|
|
22
|
-
// fileName: 'valid-
|
|
23
|
-
// data:
|
|
24
|
-
// },
|
|
25
|
-
// {
|
|
26
|
-
// text: 'Scatter Plot Sample Data',
|
|
27
|
-
// fileName: 'valid-scatterplot.csv',
|
|
28
|
-
// data: validScatterPlot
|
|
33
|
+
// text: 'Area Chart Sample Data',
|
|
34
|
+
// fileName: 'valid-area-chart.json',
|
|
35
|
+
// data: validAreaChart
|
|
29
36
|
// }
|
|
30
37
|
],
|
|
31
38
|
maps: [
|
|
@@ -43,6 +50,11 @@ const sampleData = {
|
|
|
43
50
|
text: 'United States: Geo Point Sample Data',
|
|
44
51
|
fileName: 'supported-cities.csv',
|
|
45
52
|
data: validGeoPoint
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
text: 'World: Geocode Sample Data',
|
|
56
|
+
fileName: 'valid-world-geocode.json',
|
|
57
|
+
data: validWorldGeocodeData
|
|
46
58
|
}
|
|
47
59
|
]
|
|
48
60
|
}
|
package/src/index.jsx
CHANGED
|
@@ -9,8 +9,10 @@ let activeTab = Number.parseInt(standaloneParams.get('active')) - 1 || null
|
|
|
9
9
|
|
|
10
10
|
let domContainer = document.getElementsByClassName('react-container')[0]
|
|
11
11
|
|
|
12
|
+
let isDebug = window.location.href.includes('debug=true')
|
|
13
|
+
|
|
12
14
|
ReactDOM.createRoot(domContainer).render(
|
|
13
15
|
<React.StrictMode>
|
|
14
|
-
<CdcEditor startingTab={activeTab} containerEl={domContainer} />
|
|
15
|
-
</React.StrictMode
|
|
16
|
+
<CdcEditor startingTab={activeTab} containerEl={domContainer} isDebug={isDebug} />
|
|
17
|
+
</React.StrictMode>
|
|
16
18
|
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Date": "1/15/2016",
|
|
4
|
+
"Data 1": "900",
|
|
5
|
+
"Data 2": "135",
|
|
6
|
+
"Data 3": "300",
|
|
7
|
+
"Data 4": "95",
|
|
8
|
+
"Data 5": "120",
|
|
9
|
+
"Data 6": "310"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"Date": "2/15/2016",
|
|
13
|
+
"Data 1": "4000",
|
|
14
|
+
"Data 2": "90",
|
|
15
|
+
"Data 3": "240",
|
|
16
|
+
"Data 4": "60",
|
|
17
|
+
"Data 5": "160",
|
|
18
|
+
"Data 6": "2000"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"Date": "3/15/2016",
|
|
22
|
+
"Data 1": "500",
|
|
23
|
+
"Data 2": "300",
|
|
24
|
+
"Data 3": "290",
|
|
25
|
+
"Data 4": "100",
|
|
26
|
+
"Data 5": "200",
|
|
27
|
+
"Data 6": "250"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"Date": "4/15/2016",
|
|
31
|
+
"Data 1": "1200",
|
|
32
|
+
"Data 2": "160",
|
|
33
|
+
"Data 3": "230",
|
|
34
|
+
"Data 4": "180",
|
|
35
|
+
"Data 5": "160",
|
|
36
|
+
"Data 6": "220"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"Date": "5/15/2016",
|
|
40
|
+
"Data 1": "8000",
|
|
41
|
+
"Data 2": "350",
|
|
42
|
+
"Data 3": "300",
|
|
43
|
+
"Data 4": "150",
|
|
44
|
+
"Data 5": "130",
|
|
45
|
+
"Data 6": "100"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"Date": "6/15/2016",
|
|
49
|
+
"Data 1": "9000",
|
|
50
|
+
"Data 2": "220",
|
|
51
|
+
"Data 3": "320",
|
|
52
|
+
"Data 4": "100",
|
|
53
|
+
"Data 5": "220",
|
|
54
|
+
"Data 6": "300"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Country": "Argentina",
|
|
4
|
+
"Cases": "100",
|
|
5
|
+
"Category": "Has not historically reported monkeypox",
|
|
6
|
+
"AsOf": "11 Jul 2022 5:00 PM EDT",
|
|
7
|
+
"longitude": "-63.6",
|
|
8
|
+
"latitude": "-38.4"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"Country": "New York City",
|
|
12
|
+
"Cases": "10",
|
|
13
|
+
"Category": "Has not historically reported monkeypox",
|
|
14
|
+
"AsOf": "11 Jul 2022 5:00 PM EDT",
|
|
15
|
+
"longitude": "-74.006",
|
|
16
|
+
"latitude": "40.712"
|
|
17
|
+
}
|
|
18
|
+
]
|
package/src/scss/main.scss
CHANGED
|
@@ -104,6 +104,18 @@
|
|
|
104
104
|
font-size: 12px;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
.link.link-replace {
|
|
108
|
+
display: block;
|
|
109
|
+
color: #005eaa;
|
|
110
|
+
background: unset;
|
|
111
|
+
padding-left: unset;
|
|
112
|
+
margin-top: 0.2rem;
|
|
113
|
+
color: #005eaa;
|
|
114
|
+
text-decoration: none;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
font-size: 14px;
|
|
117
|
+
}
|
|
118
|
+
|
|
107
119
|
.value-list {
|
|
108
120
|
list-style: none;
|
|
109
121
|
border: #c7c7c7 1px solid;
|