@cdc/core 4.24.4 → 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/components/DataTable/DataTable.tsx +13 -14
- package/components/DataTable/DataTableStandAlone.tsx +51 -4
- package/components/DataTable/components/ChartHeader.tsx +3 -2
- package/components/DataTable/components/DataTableEditorPanel.tsx +20 -3
- package/components/DataTable/helpers/chartCellMatrix.tsx +2 -1
- package/components/DataTable/helpers/getChartCellValue.ts +21 -1
- package/components/DataTable/helpers/getDataSeriesColumns.ts +37 -16
- package/components/DataTable/helpers/getSeriesName.ts +2 -1
- package/components/DataTable/helpers/{customColumns.ts → removeNullColumns.ts} +3 -3
- package/components/DataTable/types/TableConfig.ts +11 -22
- package/components/EditorPanel/ColumnsEditor.tsx +304 -261
- package/components/EditorPanel/DataTableEditor.tsx +119 -64
- package/components/EditorPanel/VizFilterEditor.tsx +234 -0
- package/components/EditorWrapper/EditorWrapper.tsx +48 -0
- package/components/EditorWrapper/editor-wrapper.style.css +14 -0
- package/components/Filters.jsx +70 -54
- package/components/Layout/components/Visualization/index.tsx +5 -3
- package/components/MediaControls.jsx +1 -1
- package/components/_stories/DataTable.stories.tsx +1 -2
- package/components/_stories/EditorPanel.stories.tsx +1 -0
- package/components/_stories/styles.scss +0 -1
- package/helpers/DataTransform.ts +9 -32
- package/helpers/coveUpdateWorker.ts +4 -2
- package/helpers/footnoteSymbols.ts +11 -0
- package/helpers/useDataVizClasses.js +0 -4
- package/helpers/ver/4.23.4.ts +27 -0
- package/helpers/ver/4.24.5.ts +32 -0
- package/package.json +2 -2
- package/styles/_reset.scss +7 -6
- package/types/Axis.ts +2 -0
- package/types/Column.ts +1 -0
- package/types/Legend.ts +1 -0
- package/types/MarkupInclude.ts +26 -0
- package/types/Runtime.ts +1 -0
- package/types/Series.ts +1 -1
- package/types/Table.ts +15 -14
- package/types/Visualization.ts +11 -4
- package/types/VizFilter.ts +13 -0
|
@@ -6,35 +6,245 @@ import { Visualization } from '../../types/Visualization'
|
|
|
6
6
|
import { UpdateFieldFunc } from '../../types/UpdateFieldFunc'
|
|
7
7
|
import { Column } from '../../types/Column'
|
|
8
8
|
import _ from 'lodash'
|
|
9
|
+
import React, { useState } from 'react'
|
|
9
10
|
|
|
10
11
|
interface ColumnsEditorProps {
|
|
11
|
-
config: Visualization
|
|
12
|
-
updateField: UpdateFieldFunc<string | boolean | string[] | number | Column
|
|
12
|
+
config: Partial<Visualization>
|
|
13
|
+
updateField: UpdateFieldFunc<string | boolean | string[] | number | Column | Record<string, Partial<Column>>>
|
|
13
14
|
deleteColumn: (colName: string) => void
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
type OpenControls = [Record<string, boolean>, Function] // useState type
|
|
18
|
+
|
|
19
|
+
const FieldSet: React.FC<ColumnsEditorProps & { colKey: string; controls: OpenControls }> = ({ config, deleteColumn, updateField, colKey, controls }) => {
|
|
20
|
+
const [openControls, setOpenControls] = controls
|
|
21
|
+
const show = openControls[colKey]
|
|
22
|
+
const setShow = (key, value) => {
|
|
23
|
+
setOpenControls({ ...openControls, [key]: value })
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const editColumn = (key, value) => {
|
|
27
|
+
if (key === 'dataTable' && value === true) {
|
|
28
|
+
const newColumns = _.cloneDeep(config.columns) // must pass new columns object to trigger re-render of DataTableEditor
|
|
29
|
+
newColumns[colKey] = { ...newColumns[colKey], dataTable: value }
|
|
30
|
+
updateField(null, null, 'columns', newColumns)
|
|
31
|
+
} else {
|
|
32
|
+
updateField('columns', colKey, key, value)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
const changeName = value => {
|
|
37
|
+
const newColumns = _.cloneDeep(config.columns)
|
|
38
|
+
const currentCol = config.columns[colKey]
|
|
39
|
+
const newColumn = { ...currentCol, name: value, label: value }
|
|
40
|
+
if (newColumn.dataTable === undefined) {
|
|
41
|
+
newColumn.dataTable = true
|
|
23
42
|
}
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
if (value !== colKey) {
|
|
44
|
+
newColumns[value] = newColumn
|
|
45
|
+
delete newColumns[colKey]
|
|
46
|
+
const newControls = { ..._.cloneDeep(openControls), [value]: true }
|
|
47
|
+
delete newControls[colKey]
|
|
48
|
+
setOpenControls(newControls)
|
|
49
|
+
}
|
|
50
|
+
updateField(null, null, 'columns', newColumns)
|
|
51
|
+
}
|
|
26
52
|
|
|
27
|
-
const
|
|
28
|
-
|
|
53
|
+
const getColumns = () => {
|
|
54
|
+
const columns: string[] = config.data.flatMap(row => {
|
|
55
|
+
return Object.keys(row).map(columnName => columnName)
|
|
56
|
+
})
|
|
57
|
+
const configuredColumns = Object.values(config.columns).map(col => col.name)
|
|
58
|
+
const cols = _.uniq(columns).filter(key => {
|
|
59
|
+
if (config.table.groupBy === key) return false
|
|
60
|
+
if (configuredColumns.includes(key)) return false
|
|
61
|
+
return true
|
|
62
|
+
})
|
|
63
|
+
if (config.columns[colKey]?.name) cols.push(config.columns[colKey].name)
|
|
64
|
+
return cols
|
|
29
65
|
}
|
|
30
66
|
|
|
67
|
+
const colName = config.columns[colKey]?.name
|
|
68
|
+
|
|
69
|
+
if (!show)
|
|
70
|
+
return (
|
|
71
|
+
<div className='mb-1'>
|
|
72
|
+
<button onClick={() => setShow(colKey, true)}>
|
|
73
|
+
<Icon display='caretDown' />
|
|
74
|
+
</button>
|
|
75
|
+
<span> {colName ? `${colName}` : 'New Column'}</span>
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
return (
|
|
79
|
+
<fieldset className='edit-block mb-1' key={colKey}>
|
|
80
|
+
<div className='d-flex justify-content-between'>
|
|
81
|
+
<button onClick={() => setShow(colKey, false)}>
|
|
82
|
+
<Icon display='caretUp' />
|
|
83
|
+
</button>
|
|
84
|
+
<button
|
|
85
|
+
className='btn btn-danger btn-sm'
|
|
86
|
+
onClick={event => {
|
|
87
|
+
event.preventDefault()
|
|
88
|
+
deleteColumn(colKey)
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
Remove
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
<label>
|
|
95
|
+
<span className='edit-label column-heading'>Column</span>
|
|
96
|
+
<select
|
|
97
|
+
value={config.columns[colKey] ? config.columns[colKey].name : undefined}
|
|
98
|
+
onChange={event => {
|
|
99
|
+
changeName(event.target.value)
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{['-Select-', ...getColumns()].map(option => (
|
|
103
|
+
<option key={option}>{option}</option>
|
|
104
|
+
))}
|
|
105
|
+
</select>
|
|
106
|
+
</label>
|
|
107
|
+
{config.type !== 'table' && (
|
|
108
|
+
<label>
|
|
109
|
+
<span className='edit-label column-heading'>Associate to Series</span>
|
|
110
|
+
<select
|
|
111
|
+
value={config.columns[colKey] ? config.columns[colKey].series : ''}
|
|
112
|
+
onChange={event => {
|
|
113
|
+
editColumn('series', event.target.value)
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<option value=''>Select series</option>
|
|
117
|
+
{(config.series || []).map(series => (
|
|
118
|
+
<option key={series.dataKey}>{series.dataKey}</option>
|
|
119
|
+
))}
|
|
120
|
+
</select>
|
|
121
|
+
</label>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<TextField value={config.columns[colKey].label} section='columns' subsection={colKey} fieldName='label' label='Label' updateField={updateField} />
|
|
125
|
+
<ul className='column-edit'>
|
|
126
|
+
<li className='three-col'>
|
|
127
|
+
<TextField value={config.columns[colKey].prefix} section='columns' subsection={colKey} fieldName='prefix' label='Prefix' updateField={updateField} />
|
|
128
|
+
<TextField value={config.columns[colKey].suffix} section='columns' subsection={colKey} fieldName='suffix' label='Suffix' updateField={updateField} />
|
|
129
|
+
<TextField type='number' value={config.columns[colKey].roundToPlace} section='columns' subsection={colKey} fieldName='roundToPlace' label='Round' updateField={updateField} />
|
|
130
|
+
</li>
|
|
131
|
+
<li>
|
|
132
|
+
<label className='checkbox'>
|
|
133
|
+
<input
|
|
134
|
+
type='checkbox'
|
|
135
|
+
checked={config.columns[colKey].commas}
|
|
136
|
+
onChange={event => {
|
|
137
|
+
editColumn('commas', event.target.checked)
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
<span className='edit-label'>Add Commas to Numbers</span>
|
|
141
|
+
</label>
|
|
142
|
+
</li>
|
|
143
|
+
<li>
|
|
144
|
+
{config.table.showVertical && (
|
|
145
|
+
<label className='checkbox'>
|
|
146
|
+
<input
|
|
147
|
+
type='checkbox'
|
|
148
|
+
checked={config.columns[colKey].dataTable ?? true}
|
|
149
|
+
onChange={event => {
|
|
150
|
+
editColumn('dataTable', event.target.checked)
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
<span className='edit-label'>Show in Data Table</span>
|
|
154
|
+
</label>
|
|
155
|
+
)}
|
|
156
|
+
</li>
|
|
157
|
+
{config.visualizationType === 'Pie' && (
|
|
158
|
+
<li>
|
|
159
|
+
<label className='checkbox'>
|
|
160
|
+
<input
|
|
161
|
+
type='checkbox'
|
|
162
|
+
checked={config.columns[colKey].showInViz}
|
|
163
|
+
onChange={event => {
|
|
164
|
+
editColumn('showInViz', event.target.checked)
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
<span className='edit-label'>Show in Visualization</span>
|
|
168
|
+
</label>
|
|
169
|
+
</li>
|
|
170
|
+
)}
|
|
171
|
+
{config.type !== 'table' && (
|
|
172
|
+
<li>
|
|
173
|
+
<label className='checkbox'>
|
|
174
|
+
<input
|
|
175
|
+
type='checkbox'
|
|
176
|
+
checked={config.columns[colKey].tooltips || false}
|
|
177
|
+
onChange={event => {
|
|
178
|
+
updateField('columns', colKey, 'tooltips', event.target.checked)
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
<span className='edit-label'>Show in tooltip</span>
|
|
182
|
+
</label>
|
|
183
|
+
</li>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{config.visualizationType === 'Forest Plot' && (
|
|
187
|
+
<>
|
|
188
|
+
<li>
|
|
189
|
+
<label className='checkbox'>
|
|
190
|
+
<input
|
|
191
|
+
type='checkbox'
|
|
192
|
+
checked={config.columns[colKey].forestPlot || false}
|
|
193
|
+
onChange={event => {
|
|
194
|
+
editColumn('forestPlot', event.target.checked)
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
<span className='edit-label'>Show in Forest Plot</span>
|
|
198
|
+
</label>
|
|
199
|
+
</li>
|
|
200
|
+
<li>
|
|
201
|
+
<label className='checkbox'>
|
|
202
|
+
<input
|
|
203
|
+
type='checkbox'
|
|
204
|
+
checked={config.columns[colKey].forestPlotAlignRight || false}
|
|
205
|
+
onChange={event => {
|
|
206
|
+
editColumn('forestPlotAlignRight', event.target.checked)
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
<span className='edit-label'>Align Right</span>
|
|
210
|
+
</label>
|
|
211
|
+
</li>
|
|
212
|
+
|
|
213
|
+
{!config.columns[colKey].forestPlotAlignRight && (
|
|
214
|
+
<li>
|
|
215
|
+
<label className='text'>
|
|
216
|
+
<span className='edit-label'>Forest Plot Starting Point</span>
|
|
217
|
+
<input
|
|
218
|
+
type='number'
|
|
219
|
+
value={config.columns[colKey].forestPlotStartingPoint || 0}
|
|
220
|
+
onChange={event => {
|
|
221
|
+
editColumn('forestPlotStartingPoint', event.target.value)
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
</label>
|
|
225
|
+
</li>
|
|
226
|
+
)}
|
|
227
|
+
</>
|
|
228
|
+
)}
|
|
229
|
+
</ul>
|
|
230
|
+
<label>
|
|
231
|
+
<span className='edit-label column-heading'>Order</span>
|
|
232
|
+
<input onWheel={e => e.currentTarget.blur()} type='number' min='1' value={config.columns[colKey].order} onChange={e => updateField('columns', colKey, 'order', parseInt(e.target.value))} />
|
|
233
|
+
</label>
|
|
234
|
+
</fieldset>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const ColumnsEditor: React.FC<ColumnsEditorProps> = ({ config, updateField, deleteColumn }) => {
|
|
239
|
+
const openControls = useState({})
|
|
240
|
+
const additionalColumns = Object.keys(config.columns)
|
|
241
|
+
|
|
31
242
|
// just adds a new column but not set to any data yet
|
|
32
|
-
const
|
|
243
|
+
const addColumnConfig = number => {
|
|
33
244
|
const columnKey = `additionalColumn${number}`
|
|
34
|
-
const showInViz = config.type === 'table'
|
|
35
245
|
const newColumn: Column = {
|
|
36
246
|
label: 'New Column',
|
|
37
|
-
dataTable:
|
|
247
|
+
dataTable: true,
|
|
38
248
|
tooltips: false,
|
|
39
249
|
prefix: '',
|
|
40
250
|
suffix: '',
|
|
@@ -46,266 +256,99 @@ const ColumnsEditor: React.FC<ColumnsEditorProps> = ({ config, updateField, dele
|
|
|
46
256
|
showInViz: false,
|
|
47
257
|
forestPlotStartingPoint: 0
|
|
48
258
|
}
|
|
49
|
-
|
|
259
|
+
const [controls, setControls] = openControls
|
|
260
|
+
setControls({ ...controls, [columnKey]: true })
|
|
50
261
|
updateField('columns', null, columnKey, newColumn)
|
|
51
262
|
}
|
|
52
263
|
|
|
53
|
-
const getColumns = () => {
|
|
54
|
-
const columns: string[] = config.data.flatMap(row => {
|
|
55
|
-
return Object.keys(row).map(columnName => columnName)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const { lower, upper } = config.confidenceKeys || {}
|
|
59
|
-
return _.uniq(columns).filter(key => {
|
|
60
|
-
const keyIsPresentInSeries = config.series?.filter(series => series.dataKey === key).length > 0
|
|
61
|
-
if (keyIsPresentInSeries || (config.confidenceKeys && Object.keys(config.confidenceKeys).includes(key) && (lower || upper) && key !== lower && key !== upper)) {
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
return true
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
264
|
return (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<Tooltip
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
265
|
+
<>
|
|
266
|
+
{'navigation' !== config.type && (
|
|
267
|
+
<fieldset>
|
|
268
|
+
<label>
|
|
269
|
+
<span className='edit-label'>
|
|
270
|
+
Configurations
|
|
271
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
272
|
+
<Tooltip.Target>
|
|
273
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
274
|
+
</Tooltip.Target>
|
|
275
|
+
<Tooltip.Content>
|
|
276
|
+
<p>You can specify additional columns to display in tooltips and / or the supporting data table.</p>
|
|
277
|
+
</Tooltip.Content>
|
|
278
|
+
</Tooltip>
|
|
279
|
+
</span>
|
|
280
|
+
</label>
|
|
281
|
+
{additionalColumns.map((val, i) => (
|
|
282
|
+
<FieldSet key={val + i} controls={openControls} config={config} deleteColumn={deleteColumn} updateField={updateField} colKey={val} />
|
|
283
|
+
))}
|
|
284
|
+
<button
|
|
285
|
+
className={'btn btn-primary'}
|
|
286
|
+
onClick={event => {
|
|
287
|
+
event.preventDefault()
|
|
288
|
+
addColumnConfig(additionalColumns.length + 1)
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
Add Configuration
|
|
292
|
+
</button>
|
|
293
|
+
</fieldset>
|
|
294
|
+
)}
|
|
295
|
+
{'category' === config.legend?.type && (
|
|
296
|
+
<fieldset>
|
|
297
|
+
<label>
|
|
298
|
+
<span className='edit-label'>
|
|
299
|
+
Additional Category
|
|
300
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
301
|
+
<Tooltip.Target>
|
|
302
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
303
|
+
</Tooltip.Target>
|
|
304
|
+
<Tooltip.Content>
|
|
305
|
+
<p>You can provide additional categories to ensure they appear in the legend</p>
|
|
306
|
+
</Tooltip.Content>
|
|
307
|
+
</Tooltip>
|
|
308
|
+
</span>
|
|
309
|
+
</label>
|
|
310
|
+
{config.legend.additionalCategories &&
|
|
311
|
+
config.legend.additionalCategories.map((colKey, i) => (
|
|
312
|
+
<fieldset className='edit-block' key={colKey}>
|
|
91
313
|
<button
|
|
92
314
|
className='remove-column'
|
|
93
315
|
onClick={event => {
|
|
94
316
|
event.preventDefault()
|
|
95
|
-
|
|
317
|
+
const updatedAdditionaCategories = [...config.legend.additionalCategories]
|
|
318
|
+
updatedAdditionaCategories.splice(i, 1)
|
|
319
|
+
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
96
320
|
}}
|
|
97
321
|
>
|
|
98
322
|
Remove
|
|
99
323
|
</button>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</label>
|
|
113
|
-
{config.type !== 'table' && (
|
|
114
|
-
<label>
|
|
115
|
-
<span className='edit-label column-heading'>Associate to Series</span>
|
|
116
|
-
<select
|
|
117
|
-
value={config.columns[val] ? config.columns[val].series : ''}
|
|
118
|
-
onChange={event => {
|
|
119
|
-
editColumn(val, 'series', event.target.value)
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
<option value=''>Select series</option>
|
|
123
|
-
{(config.series || []).map(series => (
|
|
124
|
-
<option>{series.dataKey}</option>
|
|
125
|
-
))}
|
|
126
|
-
</select>
|
|
127
|
-
</label>
|
|
128
|
-
)}
|
|
129
|
-
|
|
130
|
-
<TextField value={config.columns[val].label} section='columns' subsection={val} fieldName='label' label='Label' updateField={updateField} />
|
|
131
|
-
<ul className='column-edit'>
|
|
132
|
-
<li className='three-col'>
|
|
133
|
-
<TextField value={config.columns[val].prefix} section='columns' subsection={val} fieldName='prefix' label='Prefix' updateField={updateField} />
|
|
134
|
-
<TextField value={config.columns[val].suffix} section='columns' subsection={val} fieldName='suffix' label='Suffix' updateField={updateField} />
|
|
135
|
-
<TextField type='number' value={config.columns[val].roundToPlace} section='columns' subsection={val} fieldName='roundToPlace' label='Round' updateField={updateField} />
|
|
136
|
-
</li>
|
|
137
|
-
<li>
|
|
138
|
-
<label className='checkbox'>
|
|
139
|
-
<input
|
|
140
|
-
type='checkbox'
|
|
141
|
-
checked={config.columns[val].commas}
|
|
142
|
-
onChange={event => {
|
|
143
|
-
editColumn(val, 'commas', event.target.checked)
|
|
144
|
-
}}
|
|
145
|
-
/>
|
|
146
|
-
<span className='edit-label'>Add Commas to Numbers</span>
|
|
147
|
-
</label>
|
|
148
|
-
</li>
|
|
149
|
-
{config.type !== 'table' && (
|
|
150
|
-
<li>
|
|
151
|
-
{config.table.showVertical && (
|
|
152
|
-
<label className='checkbox'>
|
|
153
|
-
<input
|
|
154
|
-
type='checkbox'
|
|
155
|
-
checked={config.columns[val].dataTable}
|
|
156
|
-
onChange={event => {
|
|
157
|
-
editColumn(val, 'dataTable', event.target.checked)
|
|
158
|
-
}}
|
|
159
|
-
/>
|
|
160
|
-
<span className='edit-label'>Show in Data Table</span>
|
|
161
|
-
</label>
|
|
162
|
-
)}
|
|
163
|
-
</li>
|
|
164
|
-
)}
|
|
165
|
-
{config.visualizationType === 'Pie' && (
|
|
166
|
-
<li>
|
|
167
|
-
<label className='checkbox'>
|
|
168
|
-
<input
|
|
169
|
-
type='checkbox'
|
|
170
|
-
checked={config.columns[val].showInViz}
|
|
171
|
-
onChange={event => {
|
|
172
|
-
editColumn(val, 'showInViz', event.target.checked)
|
|
173
|
-
}}
|
|
174
|
-
/>
|
|
175
|
-
<span className='edit-label'>Show in Visualization</span>
|
|
176
|
-
</label>
|
|
177
|
-
</li>
|
|
178
|
-
)}
|
|
179
|
-
{config.type !== 'table' && (
|
|
180
|
-
<li>
|
|
181
|
-
<label className='checkbox'>
|
|
182
|
-
<input
|
|
183
|
-
type='checkbox'
|
|
184
|
-
checked={config.columns[val].tooltips || false}
|
|
185
|
-
onChange={event => {
|
|
186
|
-
updateField('columns', val, 'tooltips', event.target.checked)
|
|
187
|
-
}}
|
|
188
|
-
/>
|
|
189
|
-
<span className='edit-label'>Show in tooltip</span>
|
|
190
|
-
</label>
|
|
191
|
-
</li>
|
|
192
|
-
)}
|
|
193
|
-
|
|
194
|
-
{config.visualizationType === 'Forest Plot' && (
|
|
195
|
-
<>
|
|
196
|
-
<li>
|
|
197
|
-
<label className='checkbox'>
|
|
198
|
-
<input
|
|
199
|
-
type='checkbox'
|
|
200
|
-
checked={config.columns[val].forestPlot || false}
|
|
201
|
-
onChange={event => {
|
|
202
|
-
editColumn(val, 'forestPlot', event.target.checked)
|
|
203
|
-
}}
|
|
204
|
-
/>
|
|
205
|
-
<span className='edit-label'>Show in Forest Plot</span>
|
|
206
|
-
</label>
|
|
207
|
-
</li>
|
|
208
|
-
<li>
|
|
209
|
-
<label className='checkbox'>
|
|
210
|
-
<input
|
|
211
|
-
type='checkbox'
|
|
212
|
-
checked={config.columns[val].forestPlotAlignRight || false}
|
|
213
|
-
onChange={event => {
|
|
214
|
-
editColumn(val, 'forestPlotAlignRight', event.target.checked)
|
|
215
|
-
}}
|
|
216
|
-
/>
|
|
217
|
-
<span className='edit-label'>Align Right</span>
|
|
218
|
-
</label>
|
|
219
|
-
</li>
|
|
220
|
-
|
|
221
|
-
{!config.columns[val].forestPlotAlignRight && (
|
|
222
|
-
<li>
|
|
223
|
-
<label className='text'>
|
|
224
|
-
<span className='edit-label'>Forest Plot Starting Point</span>
|
|
225
|
-
<input
|
|
226
|
-
type='number'
|
|
227
|
-
value={config.columns[val].forestPlotStartingPoint || 0}
|
|
228
|
-
onChange={event => {
|
|
229
|
-
editColumn(val, 'forestPlotStartingPoint', event.target.value)
|
|
230
|
-
}}
|
|
231
|
-
/>
|
|
232
|
-
</label>
|
|
233
|
-
</li>
|
|
234
|
-
)}
|
|
235
|
-
</>
|
|
236
|
-
)}
|
|
237
|
-
</ul>
|
|
324
|
+
<TextField
|
|
325
|
+
value={colKey}
|
|
326
|
+
label='Category'
|
|
327
|
+
section='legend'
|
|
328
|
+
subsection={null}
|
|
329
|
+
fieldName='additionalCategories'
|
|
330
|
+
updateField={(section, subsection, fieldName, value) => {
|
|
331
|
+
const updatedAdditionaCategories = [...config.legend.additionalCategories]
|
|
332
|
+
updatedAdditionaCategories[i] = value
|
|
333
|
+
updateField(section, subsection, fieldName, updatedAdditionaCategories)
|
|
334
|
+
}}
|
|
335
|
+
/>
|
|
238
336
|
</fieldset>
|
|
239
337
|
))}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
<span className='edit-label'>
|
|
255
|
-
Additional Category
|
|
256
|
-
<Tooltip style={{ textTransform: 'none' }}>
|
|
257
|
-
<Tooltip.Target>
|
|
258
|
-
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
259
|
-
</Tooltip.Target>
|
|
260
|
-
<Tooltip.Content>
|
|
261
|
-
<p>You can provide additional categories to ensure they appear in the legend</p>
|
|
262
|
-
</Tooltip.Content>
|
|
263
|
-
</Tooltip>
|
|
264
|
-
</span>
|
|
265
|
-
</label>
|
|
266
|
-
{config.legend.additionalCategories &&
|
|
267
|
-
config.legend.additionalCategories.map((val, i) => (
|
|
268
|
-
<fieldset className='edit-block' key={val}>
|
|
269
|
-
<button
|
|
270
|
-
className='remove-column'
|
|
271
|
-
onClick={event => {
|
|
272
|
-
event.preventDefault()
|
|
273
|
-
const updatedAdditionaCategories = [...config.legend.additionalCategories]
|
|
274
|
-
updatedAdditionaCategories.splice(i, 1)
|
|
275
|
-
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
276
|
-
}}
|
|
277
|
-
>
|
|
278
|
-
Remove
|
|
279
|
-
</button>
|
|
280
|
-
<TextField
|
|
281
|
-
value={val}
|
|
282
|
-
label='Category'
|
|
283
|
-
section='legend'
|
|
284
|
-
subsection={null}
|
|
285
|
-
fieldName='additionalCategories'
|
|
286
|
-
updateField={(section, subsection, fieldName, value) => {
|
|
287
|
-
const updatedAdditionaCategories = [...config.legend.additionalCategories]
|
|
288
|
-
updatedAdditionaCategories[i] = value
|
|
289
|
-
updateField(section, subsection, fieldName, updatedAdditionaCategories)
|
|
290
|
-
}}
|
|
291
|
-
/>
|
|
292
|
-
</fieldset>
|
|
293
|
-
))}
|
|
294
|
-
<button
|
|
295
|
-
className={'btn full-width'}
|
|
296
|
-
onClick={event => {
|
|
297
|
-
event.preventDefault()
|
|
298
|
-
const updatedAdditionaCategories = [...(config.legend.additionalCategories || [])]
|
|
299
|
-
updatedAdditionaCategories.push('')
|
|
300
|
-
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
301
|
-
}}
|
|
302
|
-
>
|
|
303
|
-
Add Category
|
|
304
|
-
</button>
|
|
305
|
-
</fieldset>
|
|
306
|
-
)}
|
|
307
|
-
</AccordionItemPanel>
|
|
308
|
-
</AccordionItem>
|
|
338
|
+
<button
|
|
339
|
+
className={'btn btn-primary full-width'}
|
|
340
|
+
onClick={event => {
|
|
341
|
+
event.preventDefault()
|
|
342
|
+
const updatedAdditionaCategories = [...(config.legend.additionalCategories || [])]
|
|
343
|
+
updatedAdditionaCategories.push('')
|
|
344
|
+
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
345
|
+
}}
|
|
346
|
+
>
|
|
347
|
+
Add Category
|
|
348
|
+
</button>
|
|
349
|
+
</fieldset>
|
|
350
|
+
)}
|
|
351
|
+
</>
|
|
309
352
|
)
|
|
310
353
|
}
|
|
311
354
|
|