@cdc/data-bite 1.1.3 → 9.22.9
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/cdcdatabite.js +8 -8
- package/examples/gallery/calculated-average.json +3167 -0
- package/examples/gallery/calculated-with-pic.json +3173 -0
- package/examples/gallery/max-value.json +3167 -0
- package/examples/gallery/sum-of-data.json +3161 -0
- package/examples/private/double.json +0 -0
- package/examples/private/totals.json +1 -0
- package/package.json +3 -3
- package/src/CdcDataBite.tsx +66 -81
- package/src/components/EditorPanel.js +547 -166
- package/src/index.html +11 -2
- package/src/scss/bite.scss +99 -37
- package/src/scss/editor-panel.scss +0 -1
- package/src/scss/main.scss +2 -2
- package/LICENSE +0 -201
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { useDebounce } from 'use-debounce'
|
|
12
12
|
import Context from '../context'
|
|
13
|
-
import WarningImage from '
|
|
13
|
+
import WarningImage from '@cdc/core/assets/icon-warning-circle.svg'
|
|
14
14
|
import Tooltip from '@cdc/core/components/ui/Tooltip'
|
|
15
15
|
import Icon from '@cdc/core/components/ui/Icon'
|
|
16
16
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
@@ -310,142 +310,341 @@ const EditorPanel = memo(() => {
|
|
|
310
310
|
|
|
311
311
|
return (
|
|
312
312
|
<ErrorBoundary component="EditorPanel">
|
|
313
|
-
{!config.newViz &&
|
|
313
|
+
{!config.newViz &&
|
|
314
|
+
config.runtime &&
|
|
315
|
+
config.runtime.editorErrorMessage && <Error />}
|
|
314
316
|
{(!config.dataColumn || !config.dataFunction) && <Confirm />}
|
|
315
|
-
<button
|
|
316
|
-
|
|
317
|
+
<button
|
|
318
|
+
className={displayPanel ? `editor-toggle` : `editor-toggle collapsed`}
|
|
319
|
+
title={displayPanel ? `Collapse Editor` : `Expand Editor`}
|
|
320
|
+
onClick={onBackClick}
|
|
321
|
+
/>
|
|
322
|
+
<section
|
|
323
|
+
className={
|
|
324
|
+
displayPanel ? "editor-panel cove" : "hidden editor-panel cove"
|
|
325
|
+
}
|
|
326
|
+
>
|
|
317
327
|
<div className="heading-2">Configure Data Bite</div>
|
|
318
328
|
<section className="form-container">
|
|
319
329
|
<form>
|
|
320
330
|
<Accordion allowZeroExpanded={true}>
|
|
321
|
-
<AccordionItem>
|
|
331
|
+
<AccordionItem>
|
|
332
|
+
{" "}
|
|
333
|
+
{/* General */}
|
|
322
334
|
<AccordionItemHeading>
|
|
323
|
-
<AccordionItemButton>
|
|
324
|
-
General
|
|
325
|
-
</AccordionItemButton>
|
|
335
|
+
<AccordionItemButton>General</AccordionItemButton>
|
|
326
336
|
</AccordionItemHeading>
|
|
327
337
|
<AccordionItemPanel>
|
|
328
|
-
<Select
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
338
|
+
<Select
|
|
339
|
+
value={config.biteStyle}
|
|
340
|
+
fieldName="biteStyle"
|
|
341
|
+
label="Data Bite Style"
|
|
342
|
+
updateField={updateField}
|
|
343
|
+
options={BITE_LOCATIONS}
|
|
344
|
+
initial="Select"
|
|
345
|
+
/>
|
|
346
|
+
<TextField
|
|
347
|
+
value={config.title}
|
|
348
|
+
fieldName="title"
|
|
349
|
+
label="Title"
|
|
350
|
+
placeholder="Data Bite Title"
|
|
351
|
+
updateField={updateField}
|
|
352
|
+
/>
|
|
353
|
+
|
|
354
|
+
<TextField
|
|
355
|
+
type="textarea"
|
|
356
|
+
value={config.biteBody}
|
|
357
|
+
fieldName="biteBody"
|
|
358
|
+
label="Message"
|
|
359
|
+
updateField={updateField}
|
|
360
|
+
tooltip={
|
|
361
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
362
|
+
<Tooltip.Target>
|
|
363
|
+
<Icon
|
|
364
|
+
display="question"
|
|
365
|
+
style={{ marginLeft: "0.5rem" }}
|
|
366
|
+
/>
|
|
367
|
+
</Tooltip.Target>
|
|
368
|
+
<Tooltip.Content>
|
|
369
|
+
<p>
|
|
370
|
+
Enter the message text for the visualization. The
|
|
371
|
+
following HTML tags are supported: strong, em, sup,
|
|
372
|
+
and sub.
|
|
373
|
+
</p>
|
|
374
|
+
</Tooltip.Content>
|
|
375
|
+
</Tooltip>
|
|
376
|
+
}
|
|
377
|
+
/>
|
|
378
|
+
<TextField
|
|
379
|
+
value={config.subtext}
|
|
380
|
+
fieldName="subtext"
|
|
381
|
+
label="Subtext/Citation"
|
|
382
|
+
placeholder="Data Bite Subtext or Citation"
|
|
383
|
+
updateField={updateField}
|
|
384
|
+
tooltip={
|
|
385
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
386
|
+
<Tooltip.Target>
|
|
387
|
+
<Icon
|
|
388
|
+
display="question"
|
|
389
|
+
style={{ marginLeft: "0.5rem" }}
|
|
390
|
+
/>
|
|
391
|
+
</Tooltip.Target>
|
|
392
|
+
<Tooltip.Content>
|
|
393
|
+
<p>
|
|
394
|
+
Enter supporting text to display below the data
|
|
395
|
+
visualization, if applicable. The following HTML
|
|
396
|
+
tags are supported: strong, em, sup, and sub.
|
|
397
|
+
</p>
|
|
398
|
+
</Tooltip.Content>
|
|
399
|
+
</Tooltip>
|
|
400
|
+
}
|
|
401
|
+
/>
|
|
355
402
|
</AccordionItemPanel>
|
|
356
403
|
</AccordionItem>
|
|
357
404
|
|
|
358
|
-
<AccordionItem>
|
|
405
|
+
<AccordionItem>
|
|
406
|
+
{" "}
|
|
407
|
+
{/*Data*/}
|
|
359
408
|
<AccordionItemHeading>
|
|
360
409
|
<AccordionItemButton>
|
|
361
|
-
Data
|
|
410
|
+
Data{" "}
|
|
411
|
+
{(!config.dataColumn || !config.dataFunction) && (
|
|
412
|
+
<WarningImage width="25" className="warning-icon" />
|
|
413
|
+
)}
|
|
362
414
|
</AccordionItemButton>
|
|
363
415
|
</AccordionItemHeading>
|
|
364
416
|
<AccordionItemPanel>
|
|
365
417
|
<ul className="column-edit">
|
|
366
418
|
<li className="two-col">
|
|
367
|
-
<Select
|
|
368
|
-
|
|
419
|
+
<Select
|
|
420
|
+
value={config.dataColumn || ""}
|
|
421
|
+
fieldName="dataColumn"
|
|
422
|
+
label="Data Column"
|
|
423
|
+
updateField={updateField}
|
|
424
|
+
initial="Select"
|
|
425
|
+
required={true}
|
|
426
|
+
options={getColumns()}
|
|
427
|
+
/>
|
|
428
|
+
<Select
|
|
429
|
+
value={config.dataFunction || ""}
|
|
430
|
+
fieldName="dataFunction"
|
|
431
|
+
label="Data Function"
|
|
432
|
+
updateField={updateField}
|
|
433
|
+
initial="Select"
|
|
434
|
+
required={true}
|
|
435
|
+
options={DATA_FUNCTIONS}
|
|
436
|
+
/>
|
|
369
437
|
</li>
|
|
370
438
|
</ul>
|
|
371
439
|
<span className="divider-heading">Number Formatting</span>
|
|
372
440
|
<ul className="column-edit">
|
|
373
441
|
<li className="three-col">
|
|
374
|
-
<TextField
|
|
375
|
-
|
|
376
|
-
|
|
442
|
+
<TextField
|
|
443
|
+
value={config.dataFormat.prefix}
|
|
444
|
+
section="dataFormat"
|
|
445
|
+
fieldName="prefix"
|
|
446
|
+
label="Prefix"
|
|
447
|
+
updateField={updateField}
|
|
448
|
+
/>
|
|
449
|
+
<TextField
|
|
450
|
+
value={config.dataFormat.suffix}
|
|
451
|
+
section="dataFormat"
|
|
452
|
+
fieldName="suffix"
|
|
453
|
+
label="Suffix"
|
|
454
|
+
updateField={updateField}
|
|
455
|
+
/>
|
|
456
|
+
<TextField
|
|
457
|
+
type="number"
|
|
458
|
+
value={config.dataFormat.roundToPlace}
|
|
459
|
+
section="dataFormat"
|
|
460
|
+
fieldName="roundToPlace"
|
|
461
|
+
label="Round"
|
|
462
|
+
updateField={updateField}
|
|
463
|
+
min="0"
|
|
464
|
+
max="99"
|
|
465
|
+
/>
|
|
377
466
|
</li>
|
|
378
467
|
</ul>
|
|
379
468
|
<CheckBox value={config.dataFormat.commas} section="dataFormat" fieldName="commas" label="Add commas" updateField={updateField} />
|
|
380
469
|
<CheckBox value={config.dataFormat.ignoreZeros} section="dataFormat" fieldName="ignoreZeros" label="Ignore Zeros" updateField={updateField} />
|
|
381
470
|
<hr className="accordion__divider" />
|
|
382
471
|
|
|
383
|
-
<label style={{marginBottom:
|
|
472
|
+
<label style={{ marginBottom: "1rem" }}>
|
|
384
473
|
<span className="edit-label">
|
|
385
474
|
Data Point Filters
|
|
386
|
-
<Tooltip style={{ textTransform:
|
|
387
|
-
<Tooltip.Target
|
|
475
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
476
|
+
<Tooltip.Target>
|
|
477
|
+
<Icon
|
|
478
|
+
display="question"
|
|
479
|
+
style={{ marginLeft: "0.5rem" }}
|
|
480
|
+
/>
|
|
481
|
+
</Tooltip.Target>
|
|
388
482
|
<Tooltip.Content>
|
|
389
|
-
<p>
|
|
390
|
-
|
|
483
|
+
<p>
|
|
484
|
+
To refine the highlighted data point, specify one or
|
|
485
|
+
more filters (e.g., "Male" and "Female" for a column
|
|
486
|
+
called "Sex").
|
|
487
|
+
</p>
|
|
391
488
|
</Tooltip.Content>
|
|
392
489
|
</Tooltip>
|
|
393
490
|
</span>
|
|
394
491
|
</label>
|
|
395
|
-
{
|
|
396
|
-
config.filters &&
|
|
492
|
+
{config.filters && (
|
|
397
493
|
<ul className="filters-list">
|
|
398
494
|
{config.filters.map((filter, index) => (
|
|
399
495
|
<fieldset className="edit-block" key={index}>
|
|
400
|
-
<button
|
|
496
|
+
<button
|
|
497
|
+
type="button"
|
|
498
|
+
className="remove-column"
|
|
499
|
+
onClick={() => {
|
|
500
|
+
removeFilter(index);
|
|
501
|
+
}}
|
|
502
|
+
>
|
|
503
|
+
Remove
|
|
504
|
+
</button>
|
|
401
505
|
<label>
|
|
402
|
-
<span className="edit-label column-heading">
|
|
403
|
-
|
|
506
|
+
<span className="edit-label column-heading">
|
|
507
|
+
Column
|
|
508
|
+
</span>
|
|
509
|
+
<select
|
|
510
|
+
value={filter.columnName ? filter.columnName : ""}
|
|
511
|
+
onChange={(e) => {
|
|
512
|
+
updateFilterProp(
|
|
513
|
+
"columnName",
|
|
514
|
+
index,
|
|
515
|
+
e.target.value
|
|
516
|
+
);
|
|
517
|
+
}}
|
|
518
|
+
>
|
|
404
519
|
<option value="">- Select Option -</option>
|
|
405
520
|
{getColumns().map((dataKey, index) => (
|
|
406
|
-
<option value={dataKey} key={index}>
|
|
521
|
+
<option value={dataKey} key={index}>
|
|
522
|
+
{dataKey}
|
|
523
|
+
</option>
|
|
407
524
|
))}
|
|
408
525
|
</select>
|
|
409
526
|
</label>
|
|
410
527
|
<label>
|
|
411
|
-
<span className="edit-label column-heading">
|
|
412
|
-
|
|
528
|
+
<span className="edit-label column-heading">
|
|
529
|
+
Column Value
|
|
530
|
+
</span>
|
|
531
|
+
<select
|
|
532
|
+
value={filter.columnValue}
|
|
533
|
+
onChange={(e) => {
|
|
534
|
+
updateFilterProp(
|
|
535
|
+
"columnValue",
|
|
536
|
+
index,
|
|
537
|
+
e.target.value
|
|
538
|
+
);
|
|
539
|
+
}}
|
|
540
|
+
>
|
|
413
541
|
<option value="">- Select Option -</option>
|
|
414
|
-
{getFilterColumnValues(index).map(
|
|
415
|
-
|
|
416
|
-
|
|
542
|
+
{getFilterColumnValues(index).map(
|
|
543
|
+
(dataKey, index) => (
|
|
544
|
+
<option value={dataKey} key={index}>
|
|
545
|
+
{dataKey}
|
|
546
|
+
</option>
|
|
547
|
+
)
|
|
548
|
+
)}
|
|
417
549
|
</select>
|
|
418
550
|
</label>
|
|
419
551
|
</fieldset>
|
|
420
552
|
))}
|
|
421
553
|
</ul>
|
|
422
|
-
}
|
|
423
|
-
{(!config.filters || config.filters.length === 0) &&
|
|
554
|
+
)}
|
|
555
|
+
{(!config.filters || config.filters.length === 0) && (
|
|
424
556
|
<div>
|
|
425
557
|
<fieldset className="edit-block">
|
|
426
|
-
<p style={{textAlign: "center"}}>
|
|
558
|
+
<p style={{ textAlign: "center" }}>
|
|
559
|
+
There are currently no filters.
|
|
560
|
+
</p>
|
|
427
561
|
</fieldset>
|
|
428
562
|
</div>
|
|
429
|
-
}
|
|
430
|
-
<button
|
|
563
|
+
)}
|
|
564
|
+
<button
|
|
565
|
+
type="button"
|
|
566
|
+
onClick={addNewFilter}
|
|
567
|
+
className="btn full-width"
|
|
568
|
+
>
|
|
569
|
+
Add Filter
|
|
570
|
+
</button>
|
|
431
571
|
</AccordionItemPanel>
|
|
432
572
|
</AccordionItem>
|
|
433
573
|
|
|
434
|
-
<AccordionItem>
|
|
574
|
+
<AccordionItem>
|
|
575
|
+
{" "}
|
|
576
|
+
{/*Visual*/}
|
|
435
577
|
<AccordionItemHeading>
|
|
436
|
-
<AccordionItemButton>
|
|
437
|
-
Visual
|
|
438
|
-
</AccordionItemButton>
|
|
578
|
+
<AccordionItemButton>Visual</AccordionItemButton>
|
|
439
579
|
</AccordionItemHeading>
|
|
440
580
|
<AccordionItemPanel>
|
|
441
|
-
<TextField
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
581
|
+
<TextField
|
|
582
|
+
type="number"
|
|
583
|
+
value={config.biteFontSize}
|
|
584
|
+
fieldName="biteFontSize"
|
|
585
|
+
label="Bite Font Size"
|
|
586
|
+
updateField={updateField}
|
|
587
|
+
min="17"
|
|
588
|
+
max="65"
|
|
589
|
+
/>
|
|
590
|
+
<Select
|
|
591
|
+
value={config.fontSize}
|
|
592
|
+
fieldName="fontSize"
|
|
593
|
+
label="Overall Font Size"
|
|
594
|
+
updateField={updateField}
|
|
595
|
+
options={["small", "medium", "large"]}
|
|
596
|
+
/>
|
|
597
|
+
<CheckBox
|
|
598
|
+
value={config.visual?.border}
|
|
599
|
+
section="visual"
|
|
600
|
+
fieldName="border"
|
|
601
|
+
label="Display Border"
|
|
602
|
+
updateField={updateField}
|
|
603
|
+
/>
|
|
604
|
+
<CheckBox
|
|
605
|
+
value={config.visual?.borderColorTheme}
|
|
606
|
+
section="visual"
|
|
607
|
+
fieldName="borderColorTheme"
|
|
608
|
+
label="Use Border Color Theme"
|
|
609
|
+
updateField={updateField}
|
|
610
|
+
/>
|
|
611
|
+
<CheckBox
|
|
612
|
+
value={config.visual?.accent}
|
|
613
|
+
section="visual"
|
|
614
|
+
fieldName="accent"
|
|
615
|
+
label="Use Accent Style"
|
|
616
|
+
updateField={updateField}
|
|
617
|
+
/>
|
|
618
|
+
<CheckBox
|
|
619
|
+
value={config.visual?.background}
|
|
620
|
+
section="visual"
|
|
621
|
+
fieldName="background"
|
|
622
|
+
label="Use Theme Background Color"
|
|
623
|
+
updateField={updateField}
|
|
624
|
+
/>
|
|
625
|
+
<CheckBox
|
|
626
|
+
value={config.visual?.hideBackgroundColor}
|
|
627
|
+
section="visual"
|
|
628
|
+
fieldName="hideBackgroundColor"
|
|
629
|
+
label="Hide Background Color"
|
|
630
|
+
updateField={updateField}
|
|
631
|
+
/>
|
|
632
|
+
<label>
|
|
445
633
|
<span className="edit-label">Theme</span>
|
|
446
634
|
<ul className="color-palette">
|
|
447
|
-
{headerColors.map(
|
|
448
|
-
<li
|
|
635
|
+
{headerColors.map((palette) => (
|
|
636
|
+
<li
|
|
637
|
+
title={palette}
|
|
638
|
+
key={palette}
|
|
639
|
+
onClick={() => {
|
|
640
|
+
updateConfig({ ...config, theme: palette });
|
|
641
|
+
}}
|
|
642
|
+
className={
|
|
643
|
+
config.theme === palette
|
|
644
|
+
? "selected " + palette
|
|
645
|
+
: palette
|
|
646
|
+
}
|
|
647
|
+
/>
|
|
449
648
|
))}
|
|
450
649
|
</ul>
|
|
451
650
|
</label>
|
|
@@ -459,132 +658,314 @@ const EditorPanel = memo(() => {
|
|
|
459
658
|
</AccordionItemPanel>
|
|
460
659
|
</AccordionItem>
|
|
461
660
|
|
|
462
|
-
{['title', 'body', 'graphic'].includes(config.biteStyle) &&
|
|
463
|
-
<AccordionItem>
|
|
661
|
+
{['title', 'body', 'graphic'].includes(config.biteStyle) && (
|
|
662
|
+
<AccordionItem>
|
|
663
|
+
{" "}
|
|
664
|
+
{/*Image & Dynamic Images*/}
|
|
464
665
|
<AccordionItemHeading>
|
|
465
666
|
<AccordionItemButton>
|
|
466
|
-
Image
|
|
667
|
+
Image
|
|
668
|
+
{["dynamic"].includes(config.imageData.display) && "s"}
|
|
467
669
|
</AccordionItemButton>
|
|
468
670
|
</AccordionItemHeading>
|
|
469
|
-
|
|
470
671
|
<AccordionItemPanel>
|
|
471
|
-
<Select
|
|
472
|
-
|
|
473
|
-
|
|
672
|
+
<Select
|
|
673
|
+
value={config.imageData.display || ""}
|
|
674
|
+
section="imageData"
|
|
675
|
+
fieldName="display"
|
|
676
|
+
label="Image Display Type"
|
|
677
|
+
updateField={updateField}
|
|
678
|
+
options={["none", "static", "dynamic"]}
|
|
679
|
+
/>
|
|
680
|
+
<Select
|
|
681
|
+
value={config.bitePosition || ""}
|
|
682
|
+
fieldName="bitePosition"
|
|
683
|
+
label="Image/Graphic Position"
|
|
684
|
+
updateField={updateField}
|
|
685
|
+
initial="Select"
|
|
686
|
+
options={IMAGE_POSITIONS}
|
|
687
|
+
/>
|
|
688
|
+
{["static"].includes(config.imageData.display) && (
|
|
474
689
|
<>
|
|
475
|
-
<TextField
|
|
476
|
-
|
|
690
|
+
<TextField
|
|
691
|
+
value={config.imageData.url}
|
|
692
|
+
section="imageData"
|
|
693
|
+
fieldName="url"
|
|
694
|
+
label="Image URL"
|
|
695
|
+
updateField={updateField}
|
|
696
|
+
/>
|
|
697
|
+
<TextField
|
|
698
|
+
value={config.imageData.alt}
|
|
699
|
+
section="imageData"
|
|
700
|
+
fieldName="alt"
|
|
701
|
+
label="Alt Text"
|
|
702
|
+
updateField={updateField}
|
|
703
|
+
/>
|
|
477
704
|
</>
|
|
478
|
-
}
|
|
705
|
+
)}
|
|
479
706
|
|
|
480
|
-
{[
|
|
707
|
+
{["dynamic"].includes(config.imageData.display) && (
|
|
481
708
|
<>
|
|
482
|
-
<TextField
|
|
483
|
-
|
|
709
|
+
<TextField
|
|
710
|
+
value={config.imageData.url || ""}
|
|
711
|
+
section="imageData"
|
|
712
|
+
fieldName="url"
|
|
713
|
+
label="Image URL (default)"
|
|
714
|
+
updateField={updateField}
|
|
715
|
+
/>
|
|
716
|
+
<TextField
|
|
717
|
+
value={config.imageData.alt}
|
|
718
|
+
section="imageData"
|
|
719
|
+
fieldName="alt"
|
|
720
|
+
label="Alt Text (default)"
|
|
721
|
+
updateField={updateField}
|
|
722
|
+
/>
|
|
484
723
|
|
|
485
724
|
<hr className="accordion__divider" />
|
|
486
725
|
|
|
487
|
-
{(!config.imageData.options ||
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
</
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}}>
|
|
520
|
-
<option value={'then'}>Then</option>
|
|
521
|
-
<option value={'and'}>And</option>
|
|
522
|
-
</select>
|
|
523
|
-
</div>
|
|
524
|
-
</div>
|
|
525
|
-
|
|
526
|
-
{option.secondArgument && true === option.secondArgument &&
|
|
527
|
-
<>
|
|
726
|
+
{(!config.imageData.options ||
|
|
727
|
+
config.imageData.options.length === 0) && (
|
|
728
|
+
<p style={{ textAlign: "center" }}>
|
|
729
|
+
There are currently no dynamic images.
|
|
730
|
+
</p>
|
|
731
|
+
)}
|
|
732
|
+
{config.imageData.options &&
|
|
733
|
+
config.imageData.options.length > 0 && (
|
|
734
|
+
<>
|
|
735
|
+
<ul>
|
|
736
|
+
{config.imageData.options.map(
|
|
737
|
+
(option, index) => (
|
|
738
|
+
<fieldset
|
|
739
|
+
className="edit-block"
|
|
740
|
+
key={index}
|
|
741
|
+
>
|
|
742
|
+
<button
|
|
743
|
+
type="button"
|
|
744
|
+
className="remove-column"
|
|
745
|
+
onClick={() => {
|
|
746
|
+
removeDynamicImage(index);
|
|
747
|
+
}}
|
|
748
|
+
>
|
|
749
|
+
Remove
|
|
750
|
+
</button>
|
|
751
|
+
<label>
|
|
752
|
+
<span className="edit-label column-heading">
|
|
753
|
+
<strong>
|
|
754
|
+
{"Image #" + (index + 1)}
|
|
755
|
+
</strong>
|
|
756
|
+
</span>
|
|
757
|
+
|
|
528
758
|
<div className="accordion__panel-row align-center">
|
|
529
759
|
<div className="accordion__panel-col flex-auto">
|
|
530
760
|
If Value
|
|
531
761
|
</div>
|
|
532
762
|
<div className="accordion__panel-col flex-auto">
|
|
533
|
-
<select
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
763
|
+
<select
|
|
764
|
+
value={
|
|
765
|
+
option.arguments[0]?.operator ||
|
|
766
|
+
""
|
|
767
|
+
}
|
|
768
|
+
onChange={(e) => {
|
|
769
|
+
updateDynamicImage(
|
|
770
|
+
"operator",
|
|
771
|
+
index,
|
|
772
|
+
0,
|
|
773
|
+
e.target.value
|
|
774
|
+
);
|
|
775
|
+
}}
|
|
776
|
+
>
|
|
777
|
+
<option value="" disabled />
|
|
778
|
+
{DATA_OPERATORS.map(
|
|
779
|
+
(operator, index) => (
|
|
780
|
+
<option
|
|
781
|
+
value={operator}
|
|
782
|
+
key={index}
|
|
783
|
+
>
|
|
784
|
+
{operator}
|
|
785
|
+
</option>
|
|
786
|
+
)
|
|
787
|
+
)}
|
|
538
788
|
</select>
|
|
539
789
|
</div>
|
|
540
790
|
<div className="accordion__panel-col flex-grow flex-shrink">
|
|
541
|
-
<input
|
|
791
|
+
<input
|
|
792
|
+
type="number"
|
|
793
|
+
value={
|
|
794
|
+
option.arguments[0]
|
|
795
|
+
?.threshold || ""
|
|
796
|
+
}
|
|
797
|
+
onChange={(e) => {
|
|
798
|
+
updateDynamicImage(
|
|
799
|
+
"threshold",
|
|
800
|
+
index,
|
|
801
|
+
0,
|
|
802
|
+
e.target.value
|
|
803
|
+
);
|
|
804
|
+
}}
|
|
805
|
+
/>
|
|
542
806
|
</div>
|
|
543
807
|
</div>
|
|
544
|
-
|
|
808
|
+
|
|
809
|
+
<div className="accordion__panel-row mb-2 align-center">
|
|
545
810
|
<div className="accordion__panel-col flex-grow">
|
|
546
|
-
|
|
811
|
+
<select
|
|
812
|
+
className="border-dashed text-center"
|
|
813
|
+
value={
|
|
814
|
+
option.secondArgument
|
|
815
|
+
? "and"
|
|
816
|
+
: "then"
|
|
817
|
+
}
|
|
818
|
+
onChange={(e) => {
|
|
819
|
+
if ("then" === e.target.value) {
|
|
820
|
+
updateDynamicImage(
|
|
821
|
+
"secondArgument",
|
|
822
|
+
index,
|
|
823
|
+
null,
|
|
824
|
+
false
|
|
825
|
+
);
|
|
826
|
+
removeDynamicArgument(index);
|
|
827
|
+
}
|
|
828
|
+
if ("and" === e.target.value) {
|
|
829
|
+
updateDynamicImage(
|
|
830
|
+
"secondArgument",
|
|
831
|
+
index,
|
|
832
|
+
null,
|
|
833
|
+
true
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
}}
|
|
837
|
+
>
|
|
838
|
+
<option value={"then"}>
|
|
839
|
+
Then
|
|
840
|
+
</option>
|
|
841
|
+
<option value={"and"}>And</option>
|
|
842
|
+
</select>
|
|
547
843
|
</div>
|
|
548
844
|
</div>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
845
|
+
|
|
846
|
+
{option.secondArgument &&
|
|
847
|
+
true === option.secondArgument && (
|
|
848
|
+
<>
|
|
849
|
+
<div className="accordion__panel-row align-center">
|
|
850
|
+
<div className="accordion__panel-col flex-auto">
|
|
851
|
+
If Value
|
|
852
|
+
</div>
|
|
853
|
+
<div className="accordion__panel-col flex-auto">
|
|
854
|
+
<select
|
|
855
|
+
value={
|
|
856
|
+
option.arguments[1]
|
|
857
|
+
?.operator || ""
|
|
858
|
+
}
|
|
859
|
+
onChange={(e) => {
|
|
860
|
+
setDynamicArgument(
|
|
861
|
+
index,
|
|
862
|
+
"operator",
|
|
863
|
+
e.target.value
|
|
864
|
+
);
|
|
865
|
+
}}
|
|
866
|
+
>
|
|
867
|
+
<option value="" disabled />
|
|
868
|
+
{DATA_OPERATORS.map(
|
|
869
|
+
(operator, index) => (
|
|
870
|
+
<option
|
|
871
|
+
value={operator}
|
|
872
|
+
key={index}
|
|
873
|
+
>
|
|
874
|
+
{operator}
|
|
875
|
+
</option>
|
|
876
|
+
)
|
|
877
|
+
)}
|
|
878
|
+
</select>
|
|
879
|
+
</div>
|
|
880
|
+
<div className="accordion__panel-col flex-grow flex-shrink">
|
|
881
|
+
<input
|
|
882
|
+
type="number"
|
|
883
|
+
value={
|
|
884
|
+
option.arguments[1]
|
|
885
|
+
?.threshold || ""
|
|
886
|
+
}
|
|
887
|
+
onChange={(e) => {
|
|
888
|
+
setDynamicArgument(
|
|
889
|
+
index,
|
|
890
|
+
"threshold",
|
|
891
|
+
e.target.value
|
|
892
|
+
);
|
|
893
|
+
}}
|
|
894
|
+
/>
|
|
895
|
+
</div>
|
|
896
|
+
</div>
|
|
897
|
+
<div className="accordion__panel-row mb-2 align-center text-center text-capitalize">
|
|
898
|
+
<div className="accordion__panel-col flex-grow">
|
|
899
|
+
Then
|
|
900
|
+
</div>
|
|
901
|
+
</div>
|
|
902
|
+
</>
|
|
903
|
+
)}
|
|
904
|
+
|
|
905
|
+
<div className="accordion__panel-row mb-2 align-center">
|
|
906
|
+
<div className="accordion__panel-col flex-auto">
|
|
907
|
+
Show
|
|
908
|
+
</div>
|
|
909
|
+
<div className="accordion__panel-col flex-grow">
|
|
910
|
+
<input
|
|
911
|
+
type="text"
|
|
912
|
+
value={option.source || ""}
|
|
913
|
+
onChange={(e) => {
|
|
914
|
+
updateDynamicImage(
|
|
915
|
+
"source",
|
|
916
|
+
index,
|
|
917
|
+
null,
|
|
918
|
+
e.target.value
|
|
919
|
+
);
|
|
920
|
+
}}
|
|
921
|
+
/>
|
|
922
|
+
</div>
|
|
923
|
+
</div>
|
|
924
|
+
|
|
925
|
+
<div className="accordion__panel-row mb-2 align-center">
|
|
926
|
+
<div className="accordion__panel-col flex-auto">
|
|
927
|
+
Alt Text
|
|
928
|
+
</div>
|
|
929
|
+
<div className="accordion__panel-col flex-grow">
|
|
930
|
+
<input
|
|
931
|
+
type="text"
|
|
932
|
+
value={option.alt || ""}
|
|
933
|
+
onChange={(e) => {
|
|
934
|
+
updateDynamicImage(
|
|
935
|
+
"alt",
|
|
936
|
+
index,
|
|
937
|
+
null,
|
|
938
|
+
e.target.value
|
|
939
|
+
);
|
|
940
|
+
}}
|
|
941
|
+
/>
|
|
942
|
+
</div>
|
|
943
|
+
</div>
|
|
944
|
+
</label>
|
|
945
|
+
</fieldset>
|
|
946
|
+
)
|
|
947
|
+
)}
|
|
948
|
+
</ul>
|
|
949
|
+
</>
|
|
950
|
+
)}
|
|
951
|
+
<button
|
|
952
|
+
type="button"
|
|
953
|
+
onClick={addDynamicImage}
|
|
954
|
+
className="btn full-width"
|
|
955
|
+
>
|
|
956
|
+
Add Dynamic Image
|
|
957
|
+
</button>
|
|
576
958
|
</>
|
|
577
|
-
}
|
|
959
|
+
)}
|
|
578
960
|
</AccordionItemPanel>
|
|
579
961
|
</AccordionItem>
|
|
580
|
-
}
|
|
581
|
-
|
|
962
|
+
)}
|
|
582
963
|
</Accordion>
|
|
583
964
|
</form>
|
|
584
965
|
</section>
|
|
585
966
|
</section>
|
|
586
967
|
</ErrorBoundary>
|
|
587
|
-
)
|
|
968
|
+
);
|
|
588
969
|
})
|
|
589
970
|
|
|
590
971
|
export default EditorPanel;
|