@cdc/waffle-chart 1.0.2 → 4.22.11
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/LICENSE +201 -0
- package/README.md +4 -4
- package/dist/cdcwafflechart.js +2 -2
- package/examples/example-data.json +90 -90
- package/examples/gallery/avg-to-max.json +3162 -0
- package/examples/gallery/count.json +3162 -0
- package/package.json +3 -3
- package/src/CdcWaffleChart.tsx +132 -187
- package/src/ConfigContext.js +3 -3
- package/src/components/EditorPanel.js +210 -192
- package/src/data/initial-state.js +31 -31
- package/src/index.html +27 -8
- package/src/index.js +7 -7
- package/src/scss/main.scss +3 -4
- package/src/scss/waffle-chart.scss +47 -26
|
@@ -16,27 +16,29 @@ import '@cdc/core/styles/v2/components/editor.scss'
|
|
|
16
16
|
|
|
17
17
|
import { DATA_OPERATORS, DATA_FUNCTIONS } from '../CdcWaffleChart'
|
|
18
18
|
|
|
19
|
-
const headerColors = [
|
|
19
|
+
const headerColors = ['theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber']
|
|
20
20
|
|
|
21
21
|
const CheckBox = memo(({ label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes }) => (
|
|
22
|
-
<label className=
|
|
23
|
-
<input
|
|
24
|
-
|
|
22
|
+
<label className='checkbox'>
|
|
23
|
+
<input
|
|
24
|
+
type='checkbox'
|
|
25
|
+
name={fieldName}
|
|
26
|
+
checked={value}
|
|
27
|
+
onChange={() => {
|
|
28
|
+
updateField(section, subsection, fieldName, !value)
|
|
29
|
+
}}
|
|
30
|
+
{...attributes}
|
|
31
|
+
/>
|
|
32
|
+
<span className='edit-label column-heading'>{label}</span>
|
|
33
|
+
<span className='cove-icon'>{tooltip}</span>
|
|
25
34
|
</label>
|
|
26
35
|
))
|
|
27
36
|
|
|
28
|
-
const EditorPanel = memo(
|
|
29
|
-
const {
|
|
30
|
-
config,
|
|
31
|
-
updateConfig,
|
|
32
|
-
loading,
|
|
33
|
-
data,
|
|
34
|
-
setParentConfig,
|
|
35
|
-
isDashboard
|
|
36
|
-
} = useContext(ConfigContext)
|
|
37
|
+
const EditorPanel = memo(props => {
|
|
38
|
+
const { config, updateConfig, loading, data, setParentConfig, isDashboard } = useContext(ConfigContext)
|
|
37
39
|
|
|
38
|
-
const [
|
|
39
|
-
const [
|
|
40
|
+
const [displayPanel, setDisplayPanel] = useState(true)
|
|
41
|
+
const [showConfigConfirm, setShowConfigConfirm] = useState(false)
|
|
40
42
|
|
|
41
43
|
const updateField = (section, subsection, fieldName, newValue) => {
|
|
42
44
|
// Top level
|
|
@@ -53,11 +55,11 @@ const EditorPanel = memo((props) => {
|
|
|
53
55
|
|
|
54
56
|
const isArray = Array.isArray(config[section])
|
|
55
57
|
|
|
56
|
-
let sectionValue = isArray ? [
|
|
58
|
+
let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
|
|
57
59
|
|
|
58
60
|
if (null !== subsection) {
|
|
59
61
|
if (isArray) {
|
|
60
|
-
sectionValue = [
|
|
62
|
+
sectionValue = [...config[section]]
|
|
61
63
|
sectionValue[subsection] = { ...sectionValue[subsection], [fieldName]: newValue }
|
|
62
64
|
} else if (typeof newValue === 'string') {
|
|
63
65
|
sectionValue[subsection] = newValue
|
|
@@ -71,21 +73,15 @@ const EditorPanel = memo((props) => {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
useEffect(() => {
|
|
74
|
-
|
|
75
|
-
console.log('updating parent')
|
|
76
|
-
console.log(setParentConfig)
|
|
77
76
|
// Pass up to Editor if needed
|
|
78
77
|
if (setParentConfig) {
|
|
79
78
|
const newConfig = convertStateToConfig()
|
|
80
|
-
|
|
81
|
-
console.log('newConfig', newConfig)
|
|
82
|
-
|
|
83
79
|
setParentConfig(newConfig)
|
|
84
80
|
}
|
|
85
81
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
-
}, [
|
|
82
|
+
}, [config])
|
|
87
83
|
|
|
88
|
-
useEffect(()=> {
|
|
84
|
+
useEffect(() => {
|
|
89
85
|
if (!showConfigConfirm) {
|
|
90
86
|
let newConfig = { ...config }
|
|
91
87
|
delete newConfig.newViz
|
|
@@ -95,7 +91,7 @@ const EditorPanel = memo((props) => {
|
|
|
95
91
|
|
|
96
92
|
useEffect(() => {
|
|
97
93
|
//Verify comparate data type
|
|
98
|
-
let operators = [
|
|
94
|
+
let operators = ['<', '>', '<=', '>=']
|
|
99
95
|
if (config.dataConditionalComparate !== '') {
|
|
100
96
|
if (operators.indexOf(config.dataConditionalOperator) > -1 && isNaN(config.dataConditionalComparate)) {
|
|
101
97
|
updateConfig({ ...config, invalidComparate: true })
|
|
@@ -107,7 +103,7 @@ const EditorPanel = memo((props) => {
|
|
|
107
103
|
} else {
|
|
108
104
|
updateConfig({ ...config, invalidComparate: false })
|
|
109
105
|
}
|
|
110
|
-
}, [
|
|
106
|
+
}, [config.dataConditionalOperator, config.dataConditionalComparate])
|
|
111
107
|
|
|
112
108
|
const onBackClick = () => {
|
|
113
109
|
setDisplayPanel(!displayPanel)
|
|
@@ -121,8 +117,8 @@ const EditorPanel = memo((props) => {
|
|
|
121
117
|
|
|
122
118
|
const Error = () => {
|
|
123
119
|
return (
|
|
124
|
-
<section className=
|
|
125
|
-
<section className=
|
|
120
|
+
<section className='waiting'>
|
|
121
|
+
<section className='waiting-container'>
|
|
126
122
|
<h3>Error With Configuration</h3>
|
|
127
123
|
<p>{config.runtime.editorErrorMessage}</p>
|
|
128
124
|
</section>
|
|
@@ -131,7 +127,7 @@ const EditorPanel = memo((props) => {
|
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
const Confirm = () => {
|
|
134
|
-
const confirmDone =
|
|
130
|
+
const confirmDone = e => {
|
|
135
131
|
e.preventDefault()
|
|
136
132
|
let newConfig = { ...config }
|
|
137
133
|
delete newConfig.newViz
|
|
@@ -139,11 +135,13 @@ const EditorPanel = memo((props) => {
|
|
|
139
135
|
}
|
|
140
136
|
|
|
141
137
|
return (
|
|
142
|
-
<section className=
|
|
143
|
-
<section className=
|
|
138
|
+
<section className='waiting'>
|
|
139
|
+
<section className='waiting-container'>
|
|
144
140
|
<h3>Finish Configuring</h3>
|
|
145
141
|
<p>Set all required options to the left and confirm below to display a preview of the chart.</p>
|
|
146
|
-
<button className=
|
|
142
|
+
<button className='btn' style={{ margin: '1em auto' }} onClick={confirmDone}>
|
|
143
|
+
I'm Done
|
|
144
|
+
</button>
|
|
147
145
|
</section>
|
|
148
146
|
</section>
|
|
149
147
|
)
|
|
@@ -158,19 +156,19 @@ const EditorPanel = memo((props) => {
|
|
|
158
156
|
}
|
|
159
157
|
|
|
160
158
|
const addNewFilter = () => {
|
|
161
|
-
let filters = config.filters ? [
|
|
159
|
+
let filters = config.filters ? [...config.filters] : []
|
|
162
160
|
filters.push({ values: [] })
|
|
163
161
|
updateConfig({ ...config, filters })
|
|
164
162
|
}
|
|
165
163
|
|
|
166
|
-
const removeFilter =
|
|
167
|
-
let filters = [
|
|
164
|
+
const removeFilter = index => {
|
|
165
|
+
let filters = [...config.filters]
|
|
168
166
|
filters.splice(index, 1)
|
|
169
167
|
updateConfig({ ...config, filters })
|
|
170
168
|
}
|
|
171
169
|
|
|
172
170
|
const updateFilterProp = (name, index, value) => {
|
|
173
|
-
let filters = [
|
|
171
|
+
let filters = [...config.filters]
|
|
174
172
|
filters[index][name] = value
|
|
175
173
|
updateConfig({ ...config, filters })
|
|
176
174
|
}
|
|
@@ -178,12 +176,12 @@ const EditorPanel = memo((props) => {
|
|
|
178
176
|
const getColumns = (filter = true) => {
|
|
179
177
|
let columns = {}
|
|
180
178
|
|
|
181
|
-
data.map(row => Object.keys(row).forEach(columnName => columns[columnName] = true))
|
|
179
|
+
data.map(row => Object.keys(row).forEach(columnName => (columns[columnName] = true)))
|
|
182
180
|
|
|
183
181
|
return Object.keys(columns)
|
|
184
182
|
}
|
|
185
183
|
|
|
186
|
-
const getFilterColumnValues =
|
|
184
|
+
const getFilterColumnValues = index => {
|
|
187
185
|
let filterDataOptions = []
|
|
188
186
|
const filterColumnName = config.filters[index].columnName
|
|
189
187
|
if (data && filterColumnName) {
|
|
@@ -198,215 +196,240 @@ const EditorPanel = memo((props) => {
|
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
const editorContent = (
|
|
201
|
-
|
|
202
199
|
<Accordion>
|
|
203
|
-
<Accordion.Section title=
|
|
204
|
-
<InputText value={config.title} fieldName=
|
|
205
|
-
|
|
206
|
-
<InputText
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
</Tooltip
|
|
221
|
-
|
|
222
|
-
|
|
200
|
+
<Accordion.Section title='General'>
|
|
201
|
+
<InputText value={config.title} fieldName='title' label='Title' placeholder='Waffle Chart Title' updateField={updateField} />
|
|
202
|
+
|
|
203
|
+
<InputText
|
|
204
|
+
type='textarea'
|
|
205
|
+
value={config.content}
|
|
206
|
+
fieldName='content'
|
|
207
|
+
label='Message'
|
|
208
|
+
updateField={updateField}
|
|
209
|
+
tooltip={
|
|
210
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
211
|
+
<Tooltip.Target>
|
|
212
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
213
|
+
</Tooltip.Target>
|
|
214
|
+
<Tooltip.Content>
|
|
215
|
+
<p>Enter the message text for the visualization. The following HTML tags are supported: strong, em, sup, and sub.</p>
|
|
216
|
+
</Tooltip.Content>
|
|
217
|
+
</Tooltip>
|
|
218
|
+
}
|
|
219
|
+
/>
|
|
220
|
+
|
|
221
|
+
<InputText
|
|
222
|
+
value={config.subtext}
|
|
223
|
+
fieldName='subtext'
|
|
224
|
+
label='Subtext/Citation'
|
|
225
|
+
placeholder='Waffle Chart Subtext or Citation'
|
|
226
|
+
updateField={updateField}
|
|
227
|
+
tooltip={
|
|
228
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
229
|
+
<Tooltip.Target>
|
|
230
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
231
|
+
</Tooltip.Target>
|
|
232
|
+
<Tooltip.Content>
|
|
233
|
+
<p>Enter supporting text to display below the data visualization, if applicable. The following HTML tags are supported: strong, em, sup, and sub.</p>
|
|
234
|
+
</Tooltip.Content>
|
|
235
|
+
</Tooltip>
|
|
236
|
+
}
|
|
237
|
+
/>
|
|
223
238
|
</Accordion.Section>
|
|
224
|
-
<Accordion.Section title=
|
|
239
|
+
<Accordion.Section title='Data'>
|
|
225
240
|
<h4 style={{ fontWeight: '600' }}>Numerator</h4>
|
|
226
|
-
<div className=
|
|
227
|
-
<div className=
|
|
228
|
-
<InputSelect value={config.dataColumn || ''} fieldName=
|
|
229
|
-
updateField={updateField} initial="Select" options={getColumns()}/>
|
|
241
|
+
<div className='cove-accordion__panel-section'>
|
|
242
|
+
<div className='cove-input-group'>
|
|
243
|
+
<InputSelect value={config.dataColumn || ''} fieldName='dataColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
|
|
230
244
|
</div>
|
|
231
245
|
|
|
232
|
-
<div className=
|
|
233
|
-
<InputSelect value={config.dataFunction || ''} fieldName=
|
|
234
|
-
updateField={updateField} initial="Select" options={DATA_FUNCTIONS}/>
|
|
246
|
+
<div className='cove-input-group'>
|
|
247
|
+
<InputSelect value={config.dataFunction || ''} fieldName='dataFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} className='cove-input' />
|
|
235
248
|
</div>
|
|
236
249
|
|
|
237
|
-
<div className=
|
|
238
|
-
<label
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
250
|
+
<div className='cove-input-group'>
|
|
251
|
+
<label>
|
|
252
|
+
<span className='edit-label cove-input__label'>Data Conditional</span>
|
|
253
|
+
</label>
|
|
254
|
+
<div className='cove-accordion__panel-row cove-accordion__small-inputs'>
|
|
255
|
+
<div className='cove-accordion__panel-col'>
|
|
256
|
+
<InputSelect value={config.dataConditionalColumn || ''} fieldName='dataConditionalColumn' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
|
|
243
257
|
</div>
|
|
244
|
-
<div className=
|
|
245
|
-
<InputSelect value={config.dataConditionalOperator || ''} fieldName=
|
|
246
|
-
updateField={updateField} initial="Select" options={DATA_OPERATORS}/>
|
|
258
|
+
<div className='cove-accordion__panel-col'>
|
|
259
|
+
<InputSelect value={config.dataConditionalOperator || ''} fieldName='dataConditionalOperator' updateField={updateField} initial='Select' options={DATA_OPERATORS} className='cove-input' />
|
|
247
260
|
</div>
|
|
248
|
-
<div className=
|
|
249
|
-
<InputText value={config.dataConditionalComparate} fieldName={'dataConditionalComparate'}
|
|
250
|
-
updateField={updateField}
|
|
251
|
-
className={config.invalidComparate ? 'cove-accordion__input-error' : ''}
|
|
252
|
-
style={{minHeight: '2rem'}}
|
|
253
|
-
/>
|
|
261
|
+
<div className='cove-accordion__panel-col'>
|
|
262
|
+
<InputText value={config.dataConditionalComparate} fieldName={'dataConditionalComparate'} updateField={updateField} className={config.invalidComparate ? 'cove-accordion__input-error' : ''} style={{ minHeight: '2rem' }} />
|
|
254
263
|
</div>
|
|
255
264
|
</div>
|
|
256
265
|
</div>
|
|
257
266
|
|
|
258
|
-
{config.invalidComparate &&
|
|
259
|
-
<div className="cove-accordion__panel-error">
|
|
260
|
-
Non-numerical comparate values can only be used with = or ≠.
|
|
261
|
-
</div>
|
|
262
|
-
}
|
|
267
|
+
{config.invalidComparate && <div className='cove-accordion__panel-error'>Non-numerical comparate values can only be used with = or ≠.</div>}
|
|
263
268
|
</div>
|
|
264
|
-
<div className=
|
|
265
|
-
<div className=
|
|
269
|
+
<div className='cove-accordion__panel-row align-center'>
|
|
270
|
+
<div className='cove-accordion__panel-col'>
|
|
266
271
|
<h4 style={{ fontWeight: '600' }}>Denominator</h4>
|
|
267
272
|
</div>
|
|
268
|
-
<div className=
|
|
269
|
-
<div style={{display: 'flex', justifyContent: 'flex-end'}}>
|
|
270
|
-
<label className=
|
|
271
|
-
<InputCheckbox size='small' value={config.customDenom} fieldName='customDenom' updateField={updateField}/>
|
|
273
|
+
<div className='cove-accordion__panel-col'>
|
|
274
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
275
|
+
<label className='cove-accordion__panel-label--inline'>Select from data</label>
|
|
276
|
+
<InputCheckbox size='small' value={config.customDenom} fieldName='customDenom' updateField={updateField} />
|
|
272
277
|
</div>
|
|
273
278
|
</div>
|
|
274
279
|
</div>
|
|
275
|
-
<div className=
|
|
276
|
-
{!config.customDenom &&
|
|
277
|
-
<div className=
|
|
278
|
-
<div className=
|
|
279
|
-
<InputText value={config.dataDenom} fieldName=
|
|
280
|
+
<div className='cove-accordion__panel-section'>
|
|
281
|
+
{!config.customDenom && (
|
|
282
|
+
<div className='cove-accordion__panel-row align-center'>
|
|
283
|
+
<div className='cove-accordion__panel-col'>
|
|
284
|
+
<InputText value={config.dataDenom} fieldName='dataDenom' updateField={updateField} />
|
|
280
285
|
</div>
|
|
281
|
-
<div className=
|
|
282
|
-
<label className=
|
|
286
|
+
<div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
|
|
287
|
+
<label className='cove-accordion__panel-label--muted'>default (100)</label>
|
|
283
288
|
</div>
|
|
284
289
|
</div>
|
|
285
|
-
}
|
|
286
|
-
{config.customDenom &&
|
|
290
|
+
)}
|
|
291
|
+
{config.customDenom && (
|
|
287
292
|
<>
|
|
288
|
-
<InputSelect value={config.dataDenomColumn || ''} fieldName=
|
|
289
|
-
|
|
290
|
-
<InputSelect value={config.dataDenomFunction || ''} fieldName="dataDenomFunction" label="Data Function"
|
|
291
|
-
updateField={updateField} initial="Select" options={DATA_FUNCTIONS}/>
|
|
293
|
+
<InputSelect value={config.dataDenomColumn || ''} fieldName='dataDenomColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} />
|
|
294
|
+
<InputSelect value={config.dataDenomFunction || ''} fieldName='dataDenomFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} />
|
|
292
295
|
</>
|
|
293
|
-
}
|
|
296
|
+
)}
|
|
294
297
|
</div>
|
|
295
|
-
<ul className=
|
|
296
|
-
<li className=
|
|
297
|
-
<div style={{marginRight: '1rem'}}>
|
|
298
|
-
<InputText value={config.prefix} fieldName=
|
|
298
|
+
<ul className='column-edit'>
|
|
299
|
+
<li className='three-col'>
|
|
300
|
+
<div style={{ marginRight: '1rem' }}>
|
|
301
|
+
<InputText value={config.prefix} fieldName='prefix' label='Prefix' updateField={updateField} />
|
|
299
302
|
</div>
|
|
300
|
-
<div style={{marginRight: '1rem'}}>
|
|
301
|
-
<InputText value={config.suffix} fieldName=
|
|
303
|
+
<div style={{ marginRight: '1rem' }}>
|
|
304
|
+
<InputText value={config.suffix} fieldName='suffix' label='Suffix' updateField={updateField} />
|
|
302
305
|
</div>
|
|
303
306
|
<div>
|
|
304
|
-
<InputText type=
|
|
307
|
+
<InputText type='number' value={config.roundToPlace} fieldName='roundToPlace' label='Round' updateField={updateField} />
|
|
305
308
|
</div>
|
|
306
309
|
</li>
|
|
307
310
|
</ul>
|
|
308
311
|
|
|
309
|
-
<hr className=
|
|
312
|
+
<hr className='cove-accordion__divider' />
|
|
310
313
|
|
|
311
|
-
<label style={{marginBottom: '1rem'}}>
|
|
312
|
-
<span className=
|
|
314
|
+
<label style={{ marginBottom: '1rem' }}>
|
|
315
|
+
<span className='edit-label'>Data Point Filters</span>
|
|
313
316
|
<Tooltip style={{ textTransform: 'none' }}>
|
|
314
|
-
<Tooltip.Target
|
|
317
|
+
<Tooltip.Target>
|
|
318
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
319
|
+
</Tooltip.Target>
|
|
315
320
|
<Tooltip.Content>
|
|
316
|
-
<p>To refine the highlighted data point, specify one or more filters (e.g., "Male" and
|
|
317
|
-
"Female" for a column called "Sex").</p>
|
|
321
|
+
<p>To refine the highlighted data point, specify one or more filters (e.g., "Male" and "Female" for a column called "Sex").</p>
|
|
318
322
|
</Tooltip.Content>
|
|
319
323
|
</Tooltip>
|
|
320
324
|
</label>
|
|
321
|
-
{config.filters &&
|
|
322
|
-
<ul className=
|
|
325
|
+
{config.filters && (
|
|
326
|
+
<ul className='filters-list' style={{ paddingLeft: 0, marginBottom: '1rem' }}>
|
|
323
327
|
{config.filters.map((filter, index) => (
|
|
324
|
-
<fieldset className=
|
|
325
|
-
<button
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
<fieldset className='edit-block' key={index}>
|
|
329
|
+
<button
|
|
330
|
+
type='button'
|
|
331
|
+
className='remove-column'
|
|
332
|
+
onClick={() => {
|
|
333
|
+
removeFilter(index)
|
|
334
|
+
}}
|
|
335
|
+
>
|
|
336
|
+
Remove
|
|
328
337
|
</button>
|
|
329
338
|
<label>
|
|
330
|
-
<span className=
|
|
331
|
-
<select
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
339
|
+
<span className='edit-label column-heading'>Column</span>
|
|
340
|
+
<select
|
|
341
|
+
value={filter.columnName}
|
|
342
|
+
onChange={e => {
|
|
343
|
+
updateFilterProp('columnName', index, e.target.value)
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
<option value=''>- Select Option -</option>
|
|
335
347
|
{getColumns().map((dataKey, index) => (
|
|
336
|
-
<option value={dataKey} key={index}>
|
|
348
|
+
<option value={dataKey} key={index}>
|
|
349
|
+
{dataKey}
|
|
350
|
+
</option>
|
|
337
351
|
))}
|
|
338
352
|
</select>
|
|
339
353
|
</label>
|
|
340
354
|
<label>
|
|
341
|
-
<span className=
|
|
342
|
-
<select
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
355
|
+
<span className='edit-label column-heading'>Column Value</span>
|
|
356
|
+
<select
|
|
357
|
+
value={filter.columnValue}
|
|
358
|
+
onChange={e => {
|
|
359
|
+
updateFilterProp('columnValue', index, e.target.value)
|
|
360
|
+
}}
|
|
361
|
+
>
|
|
362
|
+
<option value=''>- Select Option -</option>
|
|
346
363
|
{getFilterColumnValues(index).map((dataKey, index) => (
|
|
347
|
-
<option value={dataKey} key={index}>
|
|
364
|
+
<option value={dataKey} key={index}>
|
|
365
|
+
{dataKey}
|
|
366
|
+
</option>
|
|
348
367
|
))}
|
|
349
368
|
</select>
|
|
350
369
|
</label>
|
|
351
370
|
</fieldset>
|
|
352
371
|
))}
|
|
353
372
|
</ul>
|
|
354
|
-
}
|
|
355
|
-
<Button onClick={addNewFilter} fluid>
|
|
373
|
+
)}
|
|
374
|
+
<Button onClick={addNewFilter} fluid>
|
|
375
|
+
Add Filter
|
|
376
|
+
</Button>
|
|
356
377
|
</Accordion.Section>
|
|
357
|
-
<Accordion.Section title=
|
|
358
|
-
<InputSelect value={config.shape} fieldName=
|
|
359
|
-
updateField={updateField} options={[ 'circle', 'square', 'person' ]}/>
|
|
378
|
+
<Accordion.Section title='Visual'>
|
|
379
|
+
<InputSelect value={config.shape} fieldName='shape' label='Shape' updateField={updateField} options={['circle', 'square', 'person']} className='cove-input' />
|
|
360
380
|
|
|
361
|
-
<div className=
|
|
362
|
-
<div className=
|
|
363
|
-
<InputText type=
|
|
381
|
+
<div className='cove-accordion__panel-row cove-accordion__small-inputs' style={{ marginTop: '1rem', marginBottom: '1rem' }}>
|
|
382
|
+
<div className='cove-accordion__panel-col'>
|
|
383
|
+
<InputText type='number' value={config.nodeWidth} fieldName='nodeWidth' label='Width' updateField={updateField} />
|
|
364
384
|
</div>
|
|
365
|
-
<div className=
|
|
366
|
-
<InputText type=
|
|
385
|
+
<div className='cove-accordion__panel-col'>
|
|
386
|
+
<InputText type='number' value={config.nodeSpacer} fieldName='nodeSpacer' label='Spacer' updateField={updateField} />
|
|
367
387
|
</div>
|
|
368
388
|
</div>
|
|
369
389
|
|
|
370
|
-
<div className=
|
|
371
|
-
<InputSelect value={config.orientation} fieldName=
|
|
372
|
-
updateField={updateField} options={[ 'horizontal', 'vertical' ]}/>
|
|
390
|
+
<div className='cove-input-group'>
|
|
391
|
+
<InputSelect value={config.orientation} fieldName='orientation' label='Layout' updateField={updateField} className='cove-input' options={['horizontal', 'vertical']} />
|
|
373
392
|
</div>
|
|
374
393
|
|
|
375
|
-
<div className=
|
|
376
|
-
<label
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
394
|
+
<div className='cove-input-group'>
|
|
395
|
+
<label>
|
|
396
|
+
<span className='edit-label column-heading cove-input__label'>Data Point Font Size</span>
|
|
397
|
+
</label>
|
|
398
|
+
<div className='cove-accordion__panel-row cove-accordion__small-inputs align-center'>
|
|
399
|
+
<div className='cove-accordion__panel-col'>
|
|
400
|
+
<InputText type='number' value={config.fontSize} fieldName='fontSize' updateField={updateField} />
|
|
380
401
|
</div>
|
|
381
|
-
<div className=
|
|
382
|
-
<label className=
|
|
402
|
+
<div className='cove-accordion__panel-col' style={{ display: 'flex', alignItems: 'center' }}>
|
|
403
|
+
<label className='accordion__panel-label--muted'>default (50px)</label>
|
|
383
404
|
</div>
|
|
384
405
|
</div>
|
|
385
406
|
</div>
|
|
386
407
|
|
|
387
|
-
<InputSelect value={config.overallFontSize} fieldName=
|
|
388
|
-
updateField={updateField} options={[ 'small', 'medium', 'large' ]}/>
|
|
408
|
+
<InputSelect value={config.overallFontSize} fieldName='overallFontSize' label='Overall Font Size' updateField={updateField} options={['small', 'medium', 'large']} className='cove-input' />
|
|
389
409
|
|
|
390
410
|
<label>
|
|
391
|
-
<span className=
|
|
392
|
-
<ul className=
|
|
393
|
-
{headerColors.map(
|
|
394
|
-
<li
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
411
|
+
<span className='edit-label cove-input__label'>Theme</span>
|
|
412
|
+
<ul className='color-palette'>
|
|
413
|
+
{headerColors.map(palette => (
|
|
414
|
+
<li
|
|
415
|
+
title={palette}
|
|
416
|
+
key={palette}
|
|
417
|
+
onClick={() => {
|
|
418
|
+
updateConfig({ ...config, theme: palette })
|
|
419
|
+
}}
|
|
420
|
+
className={config.theme === palette ? 'selected ' + palette : palette}
|
|
421
|
+
></li>
|
|
398
422
|
))}
|
|
399
423
|
</ul>
|
|
400
|
-
|
|
401
|
-
{/* <div className="cove-accordion__panel-section">
|
|
402
|
-
<CheckBox value={config.visual.border} section="visual" fieldName="border" label="Display Borders" updateField={updateField} />
|
|
403
|
-
<CheckBox value={config.visual.borderColorTheme} section="visual" fieldName="borderColorTheme" label="Use theme border color" updateField={updateField} />
|
|
404
|
-
<CheckBox value={config.visual.accent} section="visual" fieldName="accent" label="Use Accent Style" updateField={updateField} />
|
|
405
|
-
<CheckBox value={config.visual.background} section="visual" fieldName="background" label="Use theme background color" updateField={updateField} />
|
|
406
|
-
<CheckBox value={config.visual.hideBackgroundColor} section="visual" fieldName="hideBackgroundColor" label="Hide Background Color" updateField={updateField} />
|
|
407
|
-
</div> */}
|
|
408
|
-
|
|
409
424
|
</label>
|
|
425
|
+
|
|
426
|
+
<div className='cove-accordion__panel-section reverse-labels'>
|
|
427
|
+
<InputCheckbox inline size='small' value={config.visual.border} section='visual' fieldName='border' label='Display Border' updateField={updateField} />
|
|
428
|
+
<InputCheckbox inline size='small' value={config.visual.borderColorTheme} section='visual' fieldName='borderColorTheme' label='Use theme border color' updateField={updateField} />
|
|
429
|
+
<InputCheckbox size='small' value={config.visual.accent} section='visual' fieldName='accent' label='Use Accent Style' updateField={updateField} />
|
|
430
|
+
<InputCheckbox size='small' value={config.visual.background} section='visual' fieldName='background' label='Use Theme Background Color' updateField={updateField} />
|
|
431
|
+
<InputCheckbox size='small' value={config.visual.hideBackgroundColor} section='visual' fieldName='hideBackgroundColor' label='Hide Background Color' updateField={updateField} />
|
|
432
|
+
</div>
|
|
410
433
|
</Accordion.Section>
|
|
411
434
|
</Accordion>
|
|
412
435
|
)
|
|
@@ -414,24 +437,19 @@ const EditorPanel = memo((props) => {
|
|
|
414
437
|
if (loading) return null
|
|
415
438
|
|
|
416
439
|
return (
|
|
417
|
-
<ErrorBoundary component=
|
|
418
|
-
<div className=
|
|
419
|
-
{!config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error/>}
|
|
420
|
-
{config.newViz && showConfigConfirm && <Confirm/>}
|
|
421
|
-
<button className={`cove-editor--toggle` + (!displayPanel ? ` collapsed` : ``)}
|
|
422
|
-
title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick}/>
|
|
440
|
+
<ErrorBoundary component='EditorPanel'>
|
|
441
|
+
<div className='cove-editor'>
|
|
442
|
+
{!config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error />}
|
|
443
|
+
{config.newViz && showConfigConfirm && <Confirm />}
|
|
444
|
+
<button className={`cove-editor--toggle` + (!displayPanel ? ` collapsed` : ``)} title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick} />
|
|
423
445
|
<section className={`cove-editor__panel` + (displayPanel ? `` : ' hidden')}>
|
|
424
|
-
<div className=
|
|
425
|
-
<h2 className=
|
|
426
|
-
<section className=
|
|
427
|
-
{editorContent}
|
|
428
|
-
</section>
|
|
446
|
+
<div className='cove-editor__panel-container'>
|
|
447
|
+
<h2 className='cove-editor__heading'>Configure Waffle Chart</h2>
|
|
448
|
+
<section className='cove-editor__content'>{editorContent}</section>
|
|
429
449
|
</div>
|
|
430
450
|
</section>
|
|
431
|
-
<div className=
|
|
432
|
-
<div className=
|
|
433
|
-
{props.children}
|
|
434
|
-
</div>
|
|
451
|
+
<div className='cove-editor__content'>
|
|
452
|
+
<div className='cove-editor__content-wrap'>{props.children}</div>
|
|
435
453
|
</div>
|
|
436
454
|
</div>
|
|
437
455
|
</ErrorBoundary>
|