@cdc/editor 4.24.3 → 4.24.5
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 +153452 -110422
- package/package.json +9 -9
- package/src/_stories/Editor.stories.tsx +0 -12
- package/src/components/DataImport.tsx +85 -166
- package/src/components/PreviewDataTable.tsx +75 -81
- package/src/helpers/formatConfigBeforeSave.ts +7 -0
- package/src/_stories/_mock/pivot-filter.json +0 -135
- package/src/_stories/_mock/standalone-table.json +0 -144
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/editor",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.5",
|
|
4
4
|
"description": "React component for generating a new component entry",
|
|
5
5
|
"moduleName": "CdcEditor",
|
|
6
6
|
"main": "dist/cdceditor",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cdc/chart": "^4.24.
|
|
28
|
-
"@cdc/core": "^4.24.
|
|
29
|
-
"@cdc/dashboard": "^4.24.
|
|
30
|
-
"@cdc/data-bite": "^4.24.
|
|
31
|
-
"@cdc/map": "^4.24.
|
|
32
|
-
"@cdc/markup-include": "^4.24.
|
|
33
|
-
"@cdc/waffle-chart": "^4.24.
|
|
27
|
+
"@cdc/chart": "^4.24.5",
|
|
28
|
+
"@cdc/core": "^4.24.5",
|
|
29
|
+
"@cdc/dashboard": "^4.24.5",
|
|
30
|
+
"@cdc/data-bite": "^4.24.5",
|
|
31
|
+
"@cdc/map": "^4.24.5",
|
|
32
|
+
"@cdc/markup-include": "^4.24.5",
|
|
33
|
+
"@cdc/waffle-chart": "^4.24.5",
|
|
34
34
|
"axios": "^1.6.0",
|
|
35
35
|
"d3": "^7.0.0",
|
|
36
36
|
"html-react-parser": "^3.0.8",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-dom": "^18.2.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "def85aaf4cd9dc1983e80f2900199f35de82af95"
|
|
47
47
|
}
|
|
@@ -17,15 +17,3 @@ export const DefaultEditor: Story = {
|
|
|
17
17
|
config: BlankConfig
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
export const StandAloneTable: Story = {
|
|
22
|
-
args: {
|
|
23
|
-
config: StandAloneTableConfig
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const PivotFilter: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
config: PivotFilterConfig
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -48,8 +48,6 @@ export default function DataImport() {
|
|
|
48
48
|
|
|
49
49
|
const [editingDataset, setEditingDataset] = useState<string>(undefined)
|
|
50
50
|
|
|
51
|
-
const [asyncPreviewData, setAsyncPreviewData] = useState<any[]>()
|
|
52
|
-
|
|
53
51
|
const dispatch = useContext(EditorDispatchContext)
|
|
54
52
|
|
|
55
53
|
const supportedDataTypes = {
|
|
@@ -89,6 +87,10 @@ export default function DataImport() {
|
|
|
89
87
|
return true
|
|
90
88
|
}
|
|
91
89
|
|
|
90
|
+
const getFileExtension = (url: URL) => {
|
|
91
|
+
return isSolrCsv(externalURL) ? '.csv' : isSolrJson(externalURL) ? '.json' : Object.keys(supportedDataTypes).find(extension => url.pathname.endsWith(extension))
|
|
92
|
+
}
|
|
93
|
+
|
|
92
94
|
const loadExternal = async () => {
|
|
93
95
|
let dataURL: URL
|
|
94
96
|
// Is URL valid?
|
|
@@ -98,9 +100,9 @@ export default function DataImport() {
|
|
|
98
100
|
} catch {
|
|
99
101
|
throw errorMessages.urlInvalid
|
|
100
102
|
}
|
|
101
|
-
let responseBlob = null
|
|
103
|
+
let responseBlob: Blob = null
|
|
102
104
|
|
|
103
|
-
const fileExtension =
|
|
105
|
+
const fileExtension = getFileExtension(dataURL)
|
|
104
106
|
try {
|
|
105
107
|
// eslint-disable-next-line no-unused-vars
|
|
106
108
|
await axios
|
|
@@ -111,9 +113,10 @@ export default function DataImport() {
|
|
|
111
113
|
responseBlob = response.data
|
|
112
114
|
|
|
113
115
|
// Sometimes the files are coming in as plain text types... Maybe when saved from Macs
|
|
114
|
-
|
|
116
|
+
const csvTypes = ['text/csv', 'text/plain']
|
|
117
|
+
if ((fileExtension === '.csv' && csvTypes.includes(responseBlob.type)) || isSolrCsv(externalURL)) {
|
|
115
118
|
responseBlob = responseBlob.slice(0, responseBlob.size, 'text/csv')
|
|
116
|
-
} else if ((fileExtension === '.json' && responseBlob.type === 'text/plain') || isSolrJson(externalURL)) {
|
|
119
|
+
} else if (responseBlob.type === 'application/json' || (fileExtension === '.json' && responseBlob.type === 'text/plain') || isSolrJson(externalURL)) {
|
|
117
120
|
responseBlob = responseBlob.slice(0, responseBlob.size, 'application/json')
|
|
118
121
|
}
|
|
119
122
|
})
|
|
@@ -139,22 +142,20 @@ export default function DataImport() {
|
|
|
139
142
|
*/
|
|
140
143
|
const loadData = async (fileBlob = null, fileName, editingDatasetKey) => {
|
|
141
144
|
let fileData = fileBlob
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
const fileSource = fileData?.path ?? fileName ?? externalURL
|
|
146
|
+
const fileSourceType = fileBlob ? 'file' : 'url'
|
|
144
147
|
|
|
145
148
|
// Get the raw data as text from the file
|
|
146
|
-
if (
|
|
147
|
-
fileSourceType = 'url'
|
|
149
|
+
if (fileSourceType === 'url') {
|
|
148
150
|
try {
|
|
149
151
|
fileData = await loadExternal()
|
|
150
|
-
fileSource = externalURL
|
|
151
152
|
} catch (error) {
|
|
152
153
|
setErrors([error])
|
|
153
154
|
return
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
const fileSize = fileData.size
|
|
158
159
|
|
|
159
160
|
// Check if file is too big
|
|
160
161
|
if (fileSize > maxFileSize * 1048576) {
|
|
@@ -162,105 +163,92 @@ export default function DataImport() {
|
|
|
162
163
|
return
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
let path = fileBlob?.name || externalURL || fileName
|
|
166
|
-
|
|
167
166
|
// checking the file source type allows us to handle real urls better
|
|
168
167
|
// For example, query parameters in API's and cache busting strings
|
|
169
168
|
// file matching can handle .csv and .json, but doesn't handle
|
|
170
169
|
// .csv?version=1 or .json?version=1
|
|
171
|
-
const
|
|
172
|
-
|
|
170
|
+
const getMimeType = () => {
|
|
171
|
+
const path = fileBlob?.name || externalURL || fileName
|
|
173
172
|
if (fileSourceType === 'file') {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
fileExtension = '.csv'
|
|
178
|
-
} else {
|
|
179
|
-
fileExtension = fileExtension[0]
|
|
180
|
-
}
|
|
173
|
+
const pathMatch = path.match(/(?:\.([^.]+))?$/g)
|
|
174
|
+
const ext = pathMatch.length === 0 ? '.csv' : pathMatch[0]
|
|
175
|
+
return supportedDataTypes[ext]
|
|
181
176
|
}
|
|
182
177
|
|
|
183
178
|
if (fileSourceType === 'url') {
|
|
184
|
-
|
|
185
|
-
fileExtension = isSolrCsv(externalURL) ? '.csv' : isSolrJson(externalURL) ? '.json' : Object.keys(supportedDataTypes).find(extension => urlData.pathname.endsWith(extension))
|
|
179
|
+
return fileData.type
|
|
186
180
|
}
|
|
187
|
-
|
|
188
|
-
return fileExtension
|
|
189
181
|
}
|
|
190
182
|
|
|
191
|
-
|
|
192
|
-
let mimeType = supportedDataTypes[fileExtension]
|
|
183
|
+
const mimeType = getMimeType()
|
|
193
184
|
|
|
194
185
|
// Convert from blob into raw text
|
|
195
186
|
// Have to use FileReader instead of just .text because IE11 and the polyfills for this are bugged
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// Set encoding for CSV files - needed to render special characters properly
|
|
199
|
-
let encoding = mimeType === 'text/csv' ? 'utf-8' : ''
|
|
200
|
-
|
|
201
|
-
filereader.onload = function () {
|
|
202
|
-
let text = this.result
|
|
187
|
+
const filereader = new FileReader()
|
|
203
188
|
|
|
189
|
+
const getText = resultText => {
|
|
204
190
|
switch (mimeType) {
|
|
205
191
|
case 'text/csv':
|
|
206
|
-
|
|
207
|
-
break
|
|
192
|
+
return csvParse(resultText)
|
|
208
193
|
case 'text/plain':
|
|
209
194
|
case 'application/json':
|
|
210
195
|
try {
|
|
211
|
-
|
|
196
|
+
return isSolrJson(externalURL) ? JSON.parse(resultText).response.docs : JSON.parse(resultText)
|
|
212
197
|
} catch (errors) {
|
|
213
198
|
setErrors([errorMessages.formatting])
|
|
214
199
|
return
|
|
215
200
|
}
|
|
216
|
-
break
|
|
217
201
|
default:
|
|
218
202
|
setErrors([errorMessages.fileType])
|
|
219
203
|
return
|
|
220
204
|
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
filereader.onload = function () {
|
|
208
|
+
const handleSetConfig = (text: string, useTempConfig = false) => {
|
|
209
|
+
if (config.type === 'dashboard') {
|
|
210
|
+
let newDatasets = { ...config.datasets }
|
|
211
|
+
|
|
212
|
+
Object.keys(newDatasets).forEach(datasetKey => (newDatasets[datasetKey].preview = false))
|
|
213
|
+
const dataFileFormat = mimeType.split('/')[1].toUpperCase()
|
|
214
|
+
newDatasets[editingDatasetKey || fileSource] = {
|
|
215
|
+
data: text, // new data
|
|
216
|
+
dataFileSize: fileSize,
|
|
217
|
+
dataFileName: fileSource, // new file source
|
|
218
|
+
dataFileSourceType: fileSourceType, // new file source type
|
|
219
|
+
dataFileFormat,
|
|
220
|
+
preview: true
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (keepURL) {
|
|
224
|
+
newDatasets[editingDatasetKey || fileSource].dataUrl = fileSource
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const conf = useTempConfig ? { ...config, ...tempConfig } : config
|
|
228
|
+
setConfig({ ...conf, datasets: newDatasets })
|
|
229
|
+
} else {
|
|
230
|
+
let newConfig = {
|
|
231
|
+
...config,
|
|
232
|
+
...tempConfig,
|
|
233
|
+
data: text, // new data
|
|
234
|
+
dataFileName: fileSource, // new file source
|
|
235
|
+
dataFileSourceType: fileSourceType, // new file source type
|
|
236
|
+
formattedData: transform.developerStandardize(text, config.dataDescription)
|
|
237
|
+
}
|
|
238
|
+
if (keepURL) {
|
|
239
|
+
newConfig.dataUrl = fileSource
|
|
240
|
+
}
|
|
241
|
+
setConfig(newConfig)
|
|
242
|
+
}
|
|
243
|
+
}
|
|
221
244
|
|
|
222
245
|
// Validate parsed data and set if no issues.
|
|
223
246
|
try {
|
|
224
|
-
|
|
247
|
+
const result = getText(this.result.toString())
|
|
248
|
+
const text = transform.autoStandardize(result)
|
|
225
249
|
if (config.data && config.series) {
|
|
226
250
|
if (dataExists(text, config.series, config?.xAxis.dataKey)) {
|
|
227
|
-
|
|
228
|
-
let newDatasets = { ...config.datasets }
|
|
229
|
-
|
|
230
|
-
Object.keys(newDatasets).forEach(datasetKey => (newDatasets[datasetKey].preview = false))
|
|
231
|
-
|
|
232
|
-
newDatasets[editingDatasetKey || fileSource] = {
|
|
233
|
-
data: text, // new data
|
|
234
|
-
dataFileSize: fileSize,
|
|
235
|
-
dataFileName: fileSource, // new file source
|
|
236
|
-
dataFileSourceType: fileSourceType, // new file source type
|
|
237
|
-
dataFileFormat: fileExtension.replace('.', '').toUpperCase(),
|
|
238
|
-
preview: true
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (keepURL) {
|
|
242
|
-
newDatasets[editingDatasetKey || fileSource].dataUrl = fileSource
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
setConfig({
|
|
246
|
-
...config,
|
|
247
|
-
...tempConfig,
|
|
248
|
-
dataset: newDatasets
|
|
249
|
-
})
|
|
250
|
-
} else {
|
|
251
|
-
let newConfig = {
|
|
252
|
-
...config,
|
|
253
|
-
...tempConfig,
|
|
254
|
-
data: text, // new data
|
|
255
|
-
dataFileName: fileSource, // new file source
|
|
256
|
-
dataFileSourceType: fileSourceType, // new file source type
|
|
257
|
-
formattedData: transform.developerStandardize(text, config.dataDescription)
|
|
258
|
-
}
|
|
259
|
-
if (keepURL) {
|
|
260
|
-
newConfig.dataUrl = fileSource
|
|
261
|
-
}
|
|
262
|
-
setConfig(newConfig)
|
|
263
|
-
}
|
|
251
|
+
handleSetConfig(text, true)
|
|
264
252
|
} else {
|
|
265
253
|
resetEditor(
|
|
266
254
|
{
|
|
@@ -272,38 +260,7 @@ export default function DataImport() {
|
|
|
272
260
|
)
|
|
273
261
|
}
|
|
274
262
|
} else {
|
|
275
|
-
|
|
276
|
-
let newDatasets = { ...config.datasets }
|
|
277
|
-
Object.keys(newDatasets).forEach(datasetKey => (newDatasets[datasetKey].preview = false))
|
|
278
|
-
|
|
279
|
-
newDatasets[editingDatasetKey || fileSource] = {
|
|
280
|
-
data: text, // new data
|
|
281
|
-
dataFileSize: fileSize,
|
|
282
|
-
dataFileName: fileSource, // new file source
|
|
283
|
-
dataFileSourceType: fileSourceType, // new file source type
|
|
284
|
-
dataFileFormat: fileExtension.replace('.', '').toUpperCase(),
|
|
285
|
-
preview: true
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (keepURL) {
|
|
289
|
-
newDatasets[editingDatasetKey || fileSource].dataUrl = fileSource
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
setConfig({ ...config, datasets: newDatasets })
|
|
293
|
-
} else {
|
|
294
|
-
let newConfig = {
|
|
295
|
-
...config,
|
|
296
|
-
...tempConfig,
|
|
297
|
-
data: text, // new data
|
|
298
|
-
dataFileName: fileSource, // new file source
|
|
299
|
-
dataFileSourceType: fileSourceType, // new file source type
|
|
300
|
-
formattedData: transform.developerStandardize(text, config.dataDescription) // new file source type
|
|
301
|
-
}
|
|
302
|
-
if (keepURL) {
|
|
303
|
-
newConfig.dataUrl = fileSource
|
|
304
|
-
}
|
|
305
|
-
setConfig(newConfig)
|
|
306
|
-
}
|
|
263
|
+
handleSetConfig(text)
|
|
307
264
|
}
|
|
308
265
|
|
|
309
266
|
if (editingDataset) {
|
|
@@ -314,6 +271,8 @@ export default function DataImport() {
|
|
|
314
271
|
setErrors(err)
|
|
315
272
|
}
|
|
316
273
|
}
|
|
274
|
+
// Set encoding for CSV files - needed to render special characters properly
|
|
275
|
+
const encoding = mimeType === 'text/csv' ? 'utf-8' : ''
|
|
317
276
|
filereader.readAsText(fileData, encoding)
|
|
318
277
|
}
|
|
319
278
|
|
|
@@ -329,36 +288,8 @@ export default function DataImport() {
|
|
|
329
288
|
dispatch({ type: 'EDITOR_SAVE', payload: newConfig })
|
|
330
289
|
}, []) // eslint-disable-line
|
|
331
290
|
|
|
332
|
-
useEffect(() => {
|
|
333
|
-
const asyncWrapper = async () => {
|
|
334
|
-
if (config.type === 'dashboard') {
|
|
335
|
-
Object.keys(config.datasets).forEach(async datasetKey => {
|
|
336
|
-
if (config.datasets[datasetKey].preview) {
|
|
337
|
-
if (config.datasets[datasetKey].dataUrl) {
|
|
338
|
-
const remoteData = await fetchRemoteData(config.datasets[datasetKey].dataUrl)
|
|
339
|
-
if (Array.isArray(remoteData)) {
|
|
340
|
-
setAsyncPreviewData(remoteData)
|
|
341
|
-
}
|
|
342
|
-
} else if (Array.isArray(config.datasets[datasetKey].data)) {
|
|
343
|
-
setAsyncPreviewData(config.datasets[datasetKey].data)
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
})
|
|
347
|
-
} else {
|
|
348
|
-
if (config.dataUrl) {
|
|
349
|
-
const remoteData = await fetchRemoteData(config.dataUrl)
|
|
350
|
-
if (Array.isArray(remoteData)) {
|
|
351
|
-
setAsyncPreviewData(remoteData)
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
asyncWrapper()
|
|
358
|
-
}, [config.datasets]) // eslint-disable-line
|
|
359
|
-
|
|
360
291
|
// todo: code repetition in Widget.jsx?
|
|
361
|
-
const updateDescriptionProp = (
|
|
292
|
+
const updateDescriptionProp = (datasetKey, key, value) => {
|
|
362
293
|
if (config.type === 'dashboard') {
|
|
363
294
|
let dataDescription = { ...config.datasets[datasetKey].dataDescription, [key]: value }
|
|
364
295
|
let formattedData = transform.developerStandardize(config.datasets[datasetKey].data, dataDescription)
|
|
@@ -399,19 +330,17 @@ export default function DataImport() {
|
|
|
399
330
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop })
|
|
400
331
|
const { getRootProps: getRootProps2, getInputProps: getInputProps2, isDragActive: isDragActive2 } = useDropzone({ onDrop })
|
|
401
332
|
|
|
402
|
-
const
|
|
403
|
-
// const extUrl = (url) ? url : config.dataFileName // set url to what is saved in config unless the user has entered something
|
|
404
|
-
|
|
333
|
+
const loadDataFromUrl = () => {
|
|
405
334
|
return (
|
|
406
335
|
<>
|
|
407
336
|
<form className='input-group d-flex' onSubmit={e => e.preventDefault()}>
|
|
408
337
|
<input id='external-data' type='text' className='form-control flex-grow-1 border-right-0' placeholder='e.g., https://data.cdc.gov/resources/file.json' aria-label='Load data from external URL' aria-describedby='load-data' value={externalURL} onChange={e => setExternalURL(e.target.value)} />
|
|
409
|
-
<button className='input-group-text btn btn-primary px-4' type='submit' id='load-data' onClick={() => loadData(null, externalURL,
|
|
338
|
+
<button className='input-group-text btn btn-primary px-4' type='submit' id='load-data' onClick={() => loadData(null, externalURL, editingDataset)}>
|
|
410
339
|
Load
|
|
411
340
|
</button>
|
|
412
341
|
</form>
|
|
413
342
|
<label htmlFor='keep-url' className='mt-1 d-flex keep-url'>
|
|
414
|
-
<input type='checkbox' id='keep-url' checked={keepURL} onChange={() => changeKeepURL(!keepURL,
|
|
343
|
+
<input type='checkbox' id='keep-url' checked={keepURL} onChange={() => changeKeepURL(!keepURL, editingDataset)} /> Always load from URL (normally will only pull once)
|
|
415
344
|
</label>
|
|
416
345
|
</>
|
|
417
346
|
)
|
|
@@ -453,12 +382,9 @@ export default function DataImport() {
|
|
|
453
382
|
let newDatasets = { ...config.datasets }
|
|
454
383
|
|
|
455
384
|
if (value === true) {
|
|
456
|
-
Object.keys(newDatasets).forEach(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
} else {
|
|
460
|
-
newDatasets[datasetKeyIter][prop] = true
|
|
461
|
-
}
|
|
385
|
+
Object.keys(newDatasets).forEach(key => {
|
|
386
|
+
const match = key === datasetKey
|
|
387
|
+
newDatasets[key][prop] = match
|
|
462
388
|
})
|
|
463
389
|
} else {
|
|
464
390
|
newDatasets[datasetKey][prop] = value
|
|
@@ -507,18 +433,11 @@ export default function DataImport() {
|
|
|
507
433
|
setConfig({ ...config, datasets: newDatasets, visualizations: newVisualizations })
|
|
508
434
|
}
|
|
509
435
|
|
|
510
|
-
let
|
|
511
|
-
configureData,
|
|
436
|
+
let configureData,
|
|
512
437
|
readyToConfigure = false
|
|
513
438
|
if (config.type === 'dashboard') {
|
|
514
439
|
readyToConfigure = Object.keys(config.datasets).length > 0
|
|
515
|
-
Object.keys(config.datasets).forEach(datasetKey => {
|
|
516
|
-
if (config.datasets[datasetKey].preview && Array.isArray(config.datasets[datasetKey].data)) {
|
|
517
|
-
previewData = config.datasets[datasetKey].data
|
|
518
|
-
}
|
|
519
|
-
})
|
|
520
440
|
} else {
|
|
521
|
-
previewData = config.data
|
|
522
441
|
configureData = config
|
|
523
442
|
readyToConfigure = !!config.formattedData || (config.data && config.dataDescription && transform.autoStandardize(config.data))
|
|
524
443
|
}
|
|
@@ -725,7 +644,7 @@ export default function DataImport() {
|
|
|
725
644
|
</>
|
|
726
645
|
)}
|
|
727
646
|
|
|
728
|
-
{configureData
|
|
647
|
+
{configureData?.data && (
|
|
729
648
|
<>
|
|
730
649
|
{config.type !== 'dashboard' && (
|
|
731
650
|
<>
|
|
@@ -750,7 +669,7 @@ export default function DataImport() {
|
|
|
750
669
|
{config.dataFileSourceType === 'url' && (
|
|
751
670
|
<>
|
|
752
671
|
<div className='url-source-options'>
|
|
753
|
-
<div>{
|
|
672
|
+
<div>{loadDataFromUrl()}</div>
|
|
754
673
|
<div>{resetButton()}</div>
|
|
755
674
|
</div>
|
|
756
675
|
{config.dataUrl && (config.type === 'chart' || config.type === 'map') && urlFilters}
|
|
@@ -760,7 +679,7 @@ export default function DataImport() {
|
|
|
760
679
|
</>
|
|
761
680
|
)}
|
|
762
681
|
|
|
763
|
-
{showDataDesigner && <DataDesigner visualizationKey={null}
|
|
682
|
+
{showDataDesigner && <DataDesigner visualizationKey={null} configureData={configureData} updateDescriptionProp={(key, value) => updateDescriptionProp(configureData.dataFileName, key, value)} config={config} setConfig={setConfig} />}
|
|
764
683
|
</>
|
|
765
684
|
)}
|
|
766
685
|
|
|
@@ -780,9 +699,12 @@ export default function DataImport() {
|
|
|
780
699
|
</p>
|
|
781
700
|
)}
|
|
782
701
|
</div>
|
|
702
|
+
<p className='footnote'>
|
|
703
|
+
Supported file types: {Object.keys(supportedDataTypes).join(', ')}. Maximum file size {maxFileSize}MB.
|
|
704
|
+
</p>
|
|
783
705
|
</TabPane>
|
|
784
706
|
<TabPane title='Load from URL' icon={<LinkIcon className='inline-icon' />}>
|
|
785
|
-
{
|
|
707
|
+
{loadDataFromUrl()}
|
|
786
708
|
</TabPane>
|
|
787
709
|
</Tabs>
|
|
788
710
|
{errors &&
|
|
@@ -793,9 +715,6 @@ export default function DataImport() {
|
|
|
793
715
|
</div>
|
|
794
716
|
))
|
|
795
717
|
: errors.message)}
|
|
796
|
-
<p className='footnote'>
|
|
797
|
-
Supported file types: {Object.keys(supportedDataTypes).join(', ')}. Maximum file size {maxFileSize}MB.
|
|
798
|
-
</p>
|
|
799
718
|
|
|
800
719
|
{/* prettier-ignore */}
|
|
801
720
|
<SampleDataContext.Provider value={{ loadData, editingDataset, config }}>
|
|
@@ -828,7 +747,7 @@ export default function DataImport() {
|
|
|
828
747
|
</a>
|
|
829
748
|
</div>
|
|
830
749
|
<div className='right-col'>
|
|
831
|
-
<PreviewDataTable
|
|
750
|
+
<PreviewDataTable />
|
|
832
751
|
</div>
|
|
833
752
|
</>
|
|
834
753
|
)
|