@cdc/map 4.23.2 → 4.23.3
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/cdcmap.js +21645 -21544
- package/examples/default-county.json +1 -1
- package/examples/default-geocode.json +744 -744
- package/examples/default-hex.json +3 -5
- package/examples/example-city-state-no-territories.json +703 -0
- package/examples/example-city-state.json +4 -7
- package/examples/example-city-stateBAD.json +744 -0
- package/examples/gallery/city-state.json +478 -478
- package/examples/world-geocode-data.json +18 -0
- package/examples/world-geocode.json +108 -0
- package/index.html +34 -29
- package/package.json +6 -3
- package/src/CdcMap.jsx +127 -64
- package/src/components/CityList.jsx +35 -35
- package/src/components/CountyMap.jsx +285 -447
- package/src/components/DataTable.jsx +7 -31
- package/src/components/EditorPanel.jsx +227 -102
- package/src/components/Sidebar.jsx +2 -0
- package/src/components/UsaMap.jsx +24 -19
- package/src/components/WorldMap.jsx +40 -8
- package/src/data/feature-test.json +73 -0
- package/src/data/initial-state.js +3 -0
- package/src/data/supported-geos.js +7 -7
- package/src/scss/map.scss +12 -0
- package/src/test/CdcMap.test.jsx +19 -0
- package/vite.config.js +3 -3
- package/src/hooks/useColorPalette.ts +0 -88
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useCallback, memo } from 'react'
|
|
2
2
|
|
|
3
3
|
// Third Party
|
|
4
4
|
import { Accordion, AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
|
|
@@ -11,9 +11,6 @@ import { Tooltip as ReactTooltip } from 'react-tooltip'
|
|
|
11
11
|
import colorPalettes from '@cdc/core/data/colorPalettes'
|
|
12
12
|
import { supportedStatesFipsCodes } from '../data/supported-geos'
|
|
13
13
|
|
|
14
|
-
// Hooks
|
|
15
|
-
import { useColorPalette } from '../hooks/useColorPalette'
|
|
16
|
-
|
|
17
14
|
// Components - Core
|
|
18
15
|
import AdvancedEditor from '@cdc/core/components/AdvancedEditor'
|
|
19
16
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
@@ -40,7 +37,7 @@ const TextField = ({ label, section = null, subsection = null, fieldName, update
|
|
|
40
37
|
if ('string' === typeof debouncedValue && stateValue !== debouncedValue) {
|
|
41
38
|
updateField(section, subsection, fieldName, debouncedValue)
|
|
42
39
|
}
|
|
43
|
-
}, [debouncedValue])
|
|
40
|
+
}, [debouncedValue]) // eslint-disable-line
|
|
44
41
|
|
|
45
42
|
let name = subsection ? `${section}-${subsection}-${fieldName}` : `${section}-${subsection}-${fieldName}`
|
|
46
43
|
|
|
@@ -68,24 +65,20 @@ const TextField = ({ label, section = null, subsection = null, fieldName, update
|
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
const EditorPanel = props => {
|
|
71
|
-
const { state, columnsInData = [], loadConfig, setState, isDashboard, setParentConfig, setRuntimeFilters, runtimeFilters, runtimeLegend } = props
|
|
68
|
+
const { state, columnsInData = [], loadConfig, setState, isDashboard, setParentConfig, setRuntimeFilters, runtimeFilters, runtimeLegend, changeFilterActive } = props
|
|
72
69
|
|
|
73
70
|
const { general, columns, legend, dataTable, tooltips } = state
|
|
74
71
|
|
|
75
72
|
const [requiredColumns, setRequiredColumns] = useState(null) // Simple state so we know if we need more information before parsing the map
|
|
76
73
|
|
|
77
|
-
const [configTextboxValue, setConfigTextbox] = useState({})
|
|
74
|
+
const [configTextboxValue, setConfigTextbox] = useState({}) // eslint-disable-line
|
|
78
75
|
|
|
79
76
|
const [loadedDefault, setLoadedDefault] = useState(false)
|
|
80
77
|
|
|
81
78
|
const [displayPanel, setDisplayPanel] = useState(true)
|
|
82
79
|
|
|
83
|
-
const [advancedToggle, setAdvancedToggle] = useState(false)
|
|
84
|
-
|
|
85
80
|
const [activeFilterValueForDescription, setActiveFilterValueForDescription] = useState([0, 0])
|
|
86
81
|
|
|
87
|
-
const { filteredPallets, filteredQualitative, isPaletteReversed, paletteName } = useColorPalette(colorPalettes, state)
|
|
88
|
-
|
|
89
82
|
const headerColors = ['theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber']
|
|
90
83
|
|
|
91
84
|
const categoryMove = (idx1, idx2) => {
|
|
@@ -104,6 +97,45 @@ const EditorPanel = props => {
|
|
|
104
97
|
})
|
|
105
98
|
}
|
|
106
99
|
|
|
100
|
+
let specialClasses = []
|
|
101
|
+
if (legend.specialClasses && legend.specialClasses.length && typeof legend.specialClasses[0] === 'string') {
|
|
102
|
+
legend.specialClasses.forEach(specialClass => {
|
|
103
|
+
specialClasses.push({
|
|
104
|
+
key: state.columns.primary && state.columns.primary.name ? state.columns.primary.name : columnsInData[0],
|
|
105
|
+
value: specialClass,
|
|
106
|
+
label: specialClass
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
// DEV-3303 - since the above was a repair of bad config - need to backpopulate into the state
|
|
110
|
+
setState({
|
|
111
|
+
...state,
|
|
112
|
+
legend: {
|
|
113
|
+
...state.legend,
|
|
114
|
+
specialClasses: specialClasses
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
} else {
|
|
118
|
+
specialClasses = legend.specialClasses || []
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const CheckBox = memo(({ label, value, fieldName, section = null, subsection = null, tooltip, updateField, ...attributes }) => (
|
|
122
|
+
<label className='checkbox'>
|
|
123
|
+
<input
|
|
124
|
+
type='checkbox'
|
|
125
|
+
name={fieldName}
|
|
126
|
+
checked={value}
|
|
127
|
+
onChange={e => {
|
|
128
|
+
updateField(section, subsection, fieldName, !value)
|
|
129
|
+
}}
|
|
130
|
+
{...attributes}
|
|
131
|
+
/>
|
|
132
|
+
<span className='edit-label'>
|
|
133
|
+
{label}
|
|
134
|
+
{tooltip}
|
|
135
|
+
</span>
|
|
136
|
+
</label>
|
|
137
|
+
))
|
|
138
|
+
|
|
107
139
|
const handleFilterOrder = (idx1, idx2, filterIndex, filter) => {
|
|
108
140
|
let filterOrder = filter.values
|
|
109
141
|
let [movedItem] = filterOrder.splice(idx1, 1)
|
|
@@ -130,7 +162,7 @@ const EditorPanel = props => {
|
|
|
130
162
|
if ('string' === typeof debouncedValue && stateValue !== debouncedValue) {
|
|
131
163
|
handleEditorChanges('changeLegendDescription', [String(activeFilterValueForDescription), debouncedValue])
|
|
132
164
|
}
|
|
133
|
-
}, [debouncedValue])
|
|
165
|
+
}, [debouncedValue]) // eslint-disable-line
|
|
134
166
|
|
|
135
167
|
const onChange = e => setValue(e.target.value)
|
|
136
168
|
|
|
@@ -418,6 +450,15 @@ const EditorPanel = props => {
|
|
|
418
450
|
}
|
|
419
451
|
})
|
|
420
452
|
break
|
|
453
|
+
case 'world-geocode':
|
|
454
|
+
setState({
|
|
455
|
+
...state,
|
|
456
|
+
general: {
|
|
457
|
+
...state.general,
|
|
458
|
+
type: value
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
break
|
|
421
462
|
case 'data':
|
|
422
463
|
setState({
|
|
423
464
|
...state,
|
|
@@ -484,7 +525,8 @@ const EditorPanel = props => {
|
|
|
484
525
|
...state,
|
|
485
526
|
general: {
|
|
486
527
|
...state.general,
|
|
487
|
-
geoType: 'us'
|
|
528
|
+
geoType: 'us',
|
|
529
|
+
type: state.type === 'us-geocode' ? 'data' : state.type
|
|
488
530
|
},
|
|
489
531
|
dataTable: {
|
|
490
532
|
...state.dataTable,
|
|
@@ -571,6 +613,15 @@ const EditorPanel = props => {
|
|
|
571
613
|
}
|
|
572
614
|
})
|
|
573
615
|
break
|
|
616
|
+
case 'legendShowSpecialClassesLast':
|
|
617
|
+
setState({
|
|
618
|
+
...state,
|
|
619
|
+
legend: {
|
|
620
|
+
...state.legend,
|
|
621
|
+
showSpecialClassesLast: !state.legend.showSpecialClassesLast
|
|
622
|
+
}
|
|
623
|
+
})
|
|
624
|
+
break
|
|
574
625
|
case 'dynamicDescription':
|
|
575
626
|
setState({
|
|
576
627
|
...state,
|
|
@@ -673,6 +724,15 @@ const EditorPanel = props => {
|
|
|
673
724
|
}
|
|
674
725
|
})
|
|
675
726
|
break
|
|
727
|
+
case 'territoriesAlwaysShow':
|
|
728
|
+
setState({
|
|
729
|
+
...state,
|
|
730
|
+
general: {
|
|
731
|
+
...state.general,
|
|
732
|
+
territoriesAlwaysShow: value
|
|
733
|
+
}
|
|
734
|
+
})
|
|
735
|
+
break
|
|
676
736
|
default:
|
|
677
737
|
console.warn(`Did not recognize editor property.`)
|
|
678
738
|
break
|
|
@@ -680,7 +740,6 @@ const EditorPanel = props => {
|
|
|
680
740
|
}
|
|
681
741
|
|
|
682
742
|
const columnsRequiredChecker = useCallback(() => {
|
|
683
|
-
console.info('Running columns required check.')
|
|
684
743
|
let columnList = []
|
|
685
744
|
|
|
686
745
|
// Geo is always required
|
|
@@ -698,11 +757,11 @@ const EditorPanel = props => {
|
|
|
698
757
|
columnList.push('Navigation')
|
|
699
758
|
}
|
|
700
759
|
|
|
701
|
-
if ('us-geocode' === state.general.type && '' === state.columns.latitude.name) {
|
|
760
|
+
if (('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && '' === state.columns.latitude.name) {
|
|
702
761
|
columnList.push('Latitude')
|
|
703
762
|
}
|
|
704
763
|
|
|
705
|
-
if ('us-geocode' === state.general.type && '' === state.columns.longitude.name) {
|
|
764
|
+
if (('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && '' === state.columns.longitude.name) {
|
|
706
765
|
columnList.push('Longitude')
|
|
707
766
|
}
|
|
708
767
|
|
|
@@ -713,10 +772,9 @@ const EditorPanel = props => {
|
|
|
713
772
|
|
|
714
773
|
const editColumn = async (columnName, editTarget, value) => {
|
|
715
774
|
let newSpecialClasses
|
|
716
|
-
|
|
717
775
|
switch (editTarget) {
|
|
718
776
|
case 'specialClassEdit':
|
|
719
|
-
newSpecialClasses = Array.from(
|
|
777
|
+
newSpecialClasses = Array.from(specialClasses)
|
|
720
778
|
|
|
721
779
|
newSpecialClasses[value.index][value.prop] = value.value
|
|
722
780
|
|
|
@@ -729,7 +787,7 @@ const EditorPanel = props => {
|
|
|
729
787
|
})
|
|
730
788
|
break
|
|
731
789
|
case 'specialClassDelete':
|
|
732
|
-
newSpecialClasses = Array.from(
|
|
790
|
+
newSpecialClasses = Array.from(specialClasses)
|
|
733
791
|
|
|
734
792
|
newSpecialClasses.splice(value, 1)
|
|
735
793
|
|
|
@@ -742,7 +800,7 @@ const EditorPanel = props => {
|
|
|
742
800
|
})
|
|
743
801
|
break
|
|
744
802
|
case 'specialClassAdd':
|
|
745
|
-
newSpecialClasses =
|
|
803
|
+
newSpecialClasses = specialClasses
|
|
746
804
|
|
|
747
805
|
newSpecialClasses.push(value)
|
|
748
806
|
|
|
@@ -915,11 +973,51 @@ const EditorPanel = props => {
|
|
|
915
973
|
return strippedState
|
|
916
974
|
}
|
|
917
975
|
|
|
976
|
+
const isReversed = state.general.palette.isReversed
|
|
977
|
+
function filterColorPalettes() {
|
|
978
|
+
let sequential = []
|
|
979
|
+
let nonSequential = []
|
|
980
|
+
for (let paletteName in colorPalettes) {
|
|
981
|
+
if (!isReversed) {
|
|
982
|
+
if (paletteName.includes('qualitative') && !paletteName.endsWith('reverse')) {
|
|
983
|
+
nonSequential.push(paletteName)
|
|
984
|
+
}
|
|
985
|
+
if (!paletteName.includes('qualitative') && !paletteName.endsWith('reverse')) {
|
|
986
|
+
sequential.push(paletteName)
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
if (isReversed) {
|
|
990
|
+
if (paletteName.includes('qualitative') && paletteName.endsWith('reverse')) {
|
|
991
|
+
nonSequential.push(paletteName)
|
|
992
|
+
}
|
|
993
|
+
if (!paletteName.includes('qualitative') && paletteName.endsWith('reverse')) {
|
|
994
|
+
sequential.push(paletteName)
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
return [sequential, nonSequential]
|
|
1000
|
+
}
|
|
1001
|
+
const [sequential, nonSequential] = filterColorPalettes()
|
|
1002
|
+
|
|
1003
|
+
useEffect(() => {
|
|
1004
|
+
let paletteName = ''
|
|
1005
|
+
if (isReversed && !state.color.endsWith('reverse')) {
|
|
1006
|
+
paletteName = state.color + 'reverse'
|
|
1007
|
+
}
|
|
1008
|
+
if (!isReversed && state.color.endsWith('reverse')) {
|
|
1009
|
+
paletteName = state.color.slice(0, -7)
|
|
1010
|
+
}
|
|
1011
|
+
if(paletteName){
|
|
1012
|
+
handleEditorChanges('color', paletteName)
|
|
1013
|
+
}
|
|
1014
|
+
}, [isReversed])
|
|
1015
|
+
|
|
918
1016
|
useEffect(() => {
|
|
919
1017
|
setLoadedDefault(state.defaultData)
|
|
920
1018
|
|
|
921
1019
|
columnsRequiredChecker()
|
|
922
|
-
}, [state])
|
|
1020
|
+
}, [state]) // eslint-disable-line
|
|
923
1021
|
|
|
924
1022
|
useEffect(() => {
|
|
925
1023
|
//If a categorical map is used and the order is either not defined or incorrect, fix it
|
|
@@ -931,12 +1029,12 @@ const EditorPanel = props => {
|
|
|
931
1029
|
valid = false
|
|
932
1030
|
}
|
|
933
1031
|
})
|
|
934
|
-
let runtimeLegendKeys = runtimeLegend.map(item => item.value)
|
|
1032
|
+
let runtimeLegendKeys = runtimeLegend.map(item => item.value)
|
|
935
1033
|
state.legend.categoryValuesOrder.forEach(category => {
|
|
936
1034
|
if (runtimeLegendKeys.indexOf(category) === -1) {
|
|
937
|
-
valid = false
|
|
1035
|
+
valid = false
|
|
938
1036
|
}
|
|
939
|
-
})
|
|
1037
|
+
})
|
|
940
1038
|
} else {
|
|
941
1039
|
valid = false
|
|
942
1040
|
}
|
|
@@ -953,7 +1051,7 @@ const EditorPanel = props => {
|
|
|
953
1051
|
})
|
|
954
1052
|
}
|
|
955
1053
|
}
|
|
956
|
-
}, [runtimeLegend])
|
|
1054
|
+
}, [runtimeLegend]) // eslint-disable-line
|
|
957
1055
|
|
|
958
1056
|
// if no state choice by default show alabama
|
|
959
1057
|
useEffect(() => {
|
|
@@ -969,7 +1067,7 @@ const EditorPanel = props => {
|
|
|
969
1067
|
}
|
|
970
1068
|
})
|
|
971
1069
|
}
|
|
972
|
-
}, [])
|
|
1070
|
+
}, []) // eslint-disable-line
|
|
973
1071
|
|
|
974
1072
|
const columnsOptions = [
|
|
975
1073
|
<option value='' key={'Select Option'}>
|
|
@@ -978,7 +1076,7 @@ const EditorPanel = props => {
|
|
|
978
1076
|
]
|
|
979
1077
|
|
|
980
1078
|
columnsInData.map(colName => {
|
|
981
|
-
columnsOptions.push(
|
|
1079
|
+
return columnsOptions.push(
|
|
982
1080
|
<option value={colName} key={colName}>
|
|
983
1081
|
{colName}
|
|
984
1082
|
</option>
|
|
@@ -997,19 +1095,6 @@ const EditorPanel = props => {
|
|
|
997
1095
|
})
|
|
998
1096
|
})
|
|
999
1097
|
|
|
1000
|
-
let specialClasses = []
|
|
1001
|
-
if (legend.specialClasses && legend.specialClasses.length && typeof legend.specialClasses[0] === 'string') {
|
|
1002
|
-
legend.specialClasses.forEach(specialClass => {
|
|
1003
|
-
specialClasses.push({
|
|
1004
|
-
key: state.columns.primary && state.columns.primary.name ? state.columns.primary.name : columnsInData[0],
|
|
1005
|
-
value: specialClass,
|
|
1006
|
-
label: specialClass
|
|
1007
|
-
})
|
|
1008
|
-
})
|
|
1009
|
-
} else {
|
|
1010
|
-
specialClasses = legend.specialClasses || []
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
1098
|
const additionalColumns = Object.keys(state.columns).filter(value => {
|
|
1014
1099
|
const defaultCols = ['geo', 'navigate', 'primary', 'latitude', 'longitude']
|
|
1015
1100
|
|
|
@@ -1021,6 +1106,7 @@ const EditorPanel = props => {
|
|
|
1021
1106
|
|
|
1022
1107
|
const updateField = (section, subsection, fieldName, newValue) => {
|
|
1023
1108
|
const isArray = Array.isArray(state[section])
|
|
1109
|
+
|
|
1024
1110
|
let sectionValue = isArray ? [...state[section], newValue] : { ...state[section], [fieldName]: newValue }
|
|
1025
1111
|
|
|
1026
1112
|
if (null !== subsection) {
|
|
@@ -1109,6 +1195,7 @@ const EditorPanel = props => {
|
|
|
1109
1195
|
value={filter.order}
|
|
1110
1196
|
onChange={e => {
|
|
1111
1197
|
changeFilter(index, 'filterOrder', e.target.value)
|
|
1198
|
+
changeFilterActive(index, filter.values[0])
|
|
1112
1199
|
}}
|
|
1113
1200
|
>
|
|
1114
1201
|
{filterOptions.map((option, index) => {
|
|
@@ -1178,16 +1265,12 @@ const EditorPanel = props => {
|
|
|
1178
1265
|
})
|
|
1179
1266
|
}
|
|
1180
1267
|
|
|
1181
|
-
useEffect(() => {
|
|
1182
|
-
if (paletteName) handleEditorChanges('color', paletteName)
|
|
1183
|
-
}, [paletteName]) // dont add handleEditorChanges as a dependency even if it requires
|
|
1184
|
-
|
|
1185
1268
|
useEffect(() => {
|
|
1186
1269
|
const parsedData = convertStateToConfig()
|
|
1187
1270
|
const formattedData = JSON.stringify(parsedData, undefined, 2)
|
|
1188
1271
|
|
|
1189
1272
|
setConfigTextbox(formattedData)
|
|
1190
|
-
}, [state])
|
|
1273
|
+
}, [state]) // eslint-disable-line
|
|
1191
1274
|
|
|
1192
1275
|
useEffect(() => {
|
|
1193
1276
|
// Pass up to Editor if needed
|
|
@@ -1195,7 +1278,7 @@ const EditorPanel = props => {
|
|
|
1195
1278
|
const newConfig = convertStateToConfig()
|
|
1196
1279
|
setParentConfig(newConfig)
|
|
1197
1280
|
}
|
|
1198
|
-
}, [state])
|
|
1281
|
+
}, [state]) // eslint-disable-line
|
|
1199
1282
|
|
|
1200
1283
|
let numberOfItemsLimit = 8
|
|
1201
1284
|
|
|
@@ -1349,7 +1432,8 @@ const EditorPanel = props => {
|
|
|
1349
1432
|
}}
|
|
1350
1433
|
>
|
|
1351
1434
|
<option value='data'>Data</option>
|
|
1352
|
-
<option value='us-geocode'>
|
|
1435
|
+
{state.general.geoType === 'us-county' && <option value='us-geocode'>Geocode</option>}
|
|
1436
|
+
{state.general.geoType === 'world' && <option value='world-geocode'>Geocode</option>}
|
|
1353
1437
|
<option value='navigation'>Navigation</option>
|
|
1354
1438
|
{(state.general.geoType === 'world' || state.general.geoType === 'us') && <option value='bubble'>Bubble</option>}
|
|
1355
1439
|
</select>
|
|
@@ -1403,9 +1487,11 @@ const EditorPanel = props => {
|
|
|
1403
1487
|
<AccordionItemPanel>
|
|
1404
1488
|
<TextField
|
|
1405
1489
|
value={general.title}
|
|
1490
|
+
data-testid='title-input'
|
|
1406
1491
|
updateField={updateField}
|
|
1407
1492
|
section='general'
|
|
1408
1493
|
fieldName='title'
|
|
1494
|
+
id='title'
|
|
1409
1495
|
label='Title'
|
|
1410
1496
|
placeholder='Map Title'
|
|
1411
1497
|
tooltip={
|
|
@@ -1414,11 +1500,21 @@ const EditorPanel = props => {
|
|
|
1414
1500
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1415
1501
|
</Tooltip.Target>
|
|
1416
1502
|
<Tooltip.Content>
|
|
1417
|
-
<p>
|
|
1503
|
+
<p>Title is required to set the name of the download file but can be hidden using the option below.</p>
|
|
1418
1504
|
</Tooltip.Content>
|
|
1419
1505
|
</Tooltip>
|
|
1420
1506
|
}
|
|
1421
1507
|
/>
|
|
1508
|
+
<label className='checkbox'>
|
|
1509
|
+
<input
|
|
1510
|
+
type='checkbox'
|
|
1511
|
+
checked={state.general.showTitle || false}
|
|
1512
|
+
onChange={event => {
|
|
1513
|
+
handleEditorChanges('showTitle', event.target.checked)
|
|
1514
|
+
}}
|
|
1515
|
+
/>
|
|
1516
|
+
<span className='edit-label'>Show Title</span>
|
|
1517
|
+
</label>
|
|
1422
1518
|
<TextField
|
|
1423
1519
|
value={general.superTitle || ''}
|
|
1424
1520
|
updateField={updateField}
|
|
@@ -1491,6 +1587,18 @@ const EditorPanel = props => {
|
|
|
1491
1587
|
}
|
|
1492
1588
|
/>
|
|
1493
1589
|
{'us' === state.general.geoType && <TextField value={general.territoriesLabel} updateField={updateField} section='general' fieldName='territoriesLabel' label='Territories Label' placeholder='Territories' />}
|
|
1590
|
+
{'us' === state.general.geoType && (
|
|
1591
|
+
<label className='checkbox'>
|
|
1592
|
+
<input
|
|
1593
|
+
type='checkbox'
|
|
1594
|
+
checked={general.territoriesAlwaysShow || false}
|
|
1595
|
+
onChange={event => {
|
|
1596
|
+
handleEditorChanges('territoriesAlwaysShow', event.target.checked)
|
|
1597
|
+
}}
|
|
1598
|
+
/>
|
|
1599
|
+
<span className='edit-label'>Show All Territories</span>
|
|
1600
|
+
</label>
|
|
1601
|
+
)}
|
|
1494
1602
|
{/* <label className="checkbox mt-4">
|
|
1495
1603
|
<input type="checkbox" checked={ state.general.showDownloadMediaButton } onChange={(event) => { handleEditorChanges("toggleDownloadMediaButton", event.target.checked) }} />
|
|
1496
1604
|
<span className="edit-label">Enable Media Download</span>
|
|
@@ -1677,8 +1785,7 @@ const EditorPanel = props => {
|
|
|
1677
1785
|
</label>
|
|
1678
1786
|
</fieldset>
|
|
1679
1787
|
)}
|
|
1680
|
-
|
|
1681
|
-
{'us-geocode' === state.general.type && (
|
|
1788
|
+
{('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && (
|
|
1682
1789
|
<>
|
|
1683
1790
|
<label>Latitude Column</label>
|
|
1684
1791
|
<select
|
|
@@ -1905,35 +2012,42 @@ const EditorPanel = props => {
|
|
|
1905
2012
|
</Tooltip>
|
|
1906
2013
|
</span>
|
|
1907
2014
|
</label>
|
|
1908
|
-
{state.legend.additionalCategories &&
|
|
1909
|
-
|
|
1910
|
-
<
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
event
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
<
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2015
|
+
{state.legend.additionalCategories &&
|
|
2016
|
+
state.legend.additionalCategories.map((val, i) => (
|
|
2017
|
+
<fieldset className='edit-block' key={val}>
|
|
2018
|
+
<button
|
|
2019
|
+
className='remove-column'
|
|
2020
|
+
onClick={event => {
|
|
2021
|
+
event.preventDefault()
|
|
2022
|
+
const updatedAdditionaCategories = [...state.legend.additionalCategories]
|
|
2023
|
+
updatedAdditionaCategories.splice(i, 1)
|
|
2024
|
+
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
2025
|
+
}}
|
|
2026
|
+
>
|
|
2027
|
+
Remove
|
|
2028
|
+
</button>
|
|
2029
|
+
<label>
|
|
2030
|
+
<span className='edit-label column-heading'>Category</span>
|
|
2031
|
+
<TextField
|
|
2032
|
+
value={val}
|
|
2033
|
+
section='legend'
|
|
2034
|
+
subsection={null}
|
|
2035
|
+
fieldName='additionalCategories'
|
|
2036
|
+
updateField={(section, subsection, fieldName, value) => {
|
|
2037
|
+
const updatedAdditionaCategories = [...state.legend.additionalCategories]
|
|
2038
|
+
updatedAdditionaCategories[i] = value
|
|
2039
|
+
updateField(section, subsection, fieldName, updatedAdditionaCategories)
|
|
2040
|
+
}}
|
|
2041
|
+
/>
|
|
2042
|
+
</label>
|
|
2043
|
+
</fieldset>
|
|
2044
|
+
))}
|
|
1931
2045
|
<button
|
|
1932
2046
|
className={'btn full-width'}
|
|
1933
2047
|
onClick={event => {
|
|
1934
2048
|
event.preventDefault()
|
|
1935
|
-
const updatedAdditionaCategories = [...(state.legend.additionalCategories || [])]
|
|
1936
|
-
updatedAdditionaCategories.push('')
|
|
2049
|
+
const updatedAdditionaCategories = [...(state.legend.additionalCategories || [])]
|
|
2050
|
+
updatedAdditionaCategories.push('')
|
|
1937
2051
|
updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
|
|
1938
2052
|
}}
|
|
1939
2053
|
>
|
|
@@ -2016,6 +2130,17 @@ const EditorPanel = props => {
|
|
|
2016
2130
|
<span className='edit-label'>Single Row Legend</span>
|
|
2017
2131
|
</label>
|
|
2018
2132
|
)}
|
|
2133
|
+
{/* always show */}
|
|
2134
|
+
<label className='checkbox'>
|
|
2135
|
+
<input
|
|
2136
|
+
type='checkbox'
|
|
2137
|
+
checked={legend.showSpecialClassesLast}
|
|
2138
|
+
onChange={event => {
|
|
2139
|
+
handleEditorChanges('legendShowSpecialClassesLast', event.target.checked)
|
|
2140
|
+
}}
|
|
2141
|
+
/>
|
|
2142
|
+
<span className='edit-label'>Show Special Classes Last</span>
|
|
2143
|
+
</label>
|
|
2019
2144
|
{'category' !== legend.type && (
|
|
2020
2145
|
<label className='checkbox'>
|
|
2021
2146
|
<input type='checkbox' checked={legend.separateZero || false} onChange={event => handleEditorChanges('separateZero', event.target.checked)} />
|
|
@@ -2223,6 +2348,7 @@ const EditorPanel = props => {
|
|
|
2223
2348
|
updateField={updateField}
|
|
2224
2349
|
section='dataTable'
|
|
2225
2350
|
fieldName='title'
|
|
2351
|
+
id='dataTableTitle'
|
|
2226
2352
|
label='Data Table Title'
|
|
2227
2353
|
placeholder='Data Table'
|
|
2228
2354
|
tooltip={
|
|
@@ -2236,6 +2362,26 @@ const EditorPanel = props => {
|
|
|
2236
2362
|
</Tooltip>
|
|
2237
2363
|
}
|
|
2238
2364
|
/>
|
|
2365
|
+
<label className='checkbox'>
|
|
2366
|
+
<input
|
|
2367
|
+
type='checkbox'
|
|
2368
|
+
checked={state.dataTable.forceDisplay !== undefined ? state.dataTable.forceDisplay : !isDashboard}
|
|
2369
|
+
onChange={event => {
|
|
2370
|
+
handleEditorChanges('showDataTable', event.target.checked)
|
|
2371
|
+
}}
|
|
2372
|
+
/>
|
|
2373
|
+
<span className='edit-label'>
|
|
2374
|
+
Show Table
|
|
2375
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
2376
|
+
<Tooltip.Target>
|
|
2377
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
2378
|
+
</Tooltip.Target>
|
|
2379
|
+
<Tooltip.Content>
|
|
2380
|
+
<p>Data tables are required for 508 compliance. When choosing to hide this data table, replace with your own version.</p>
|
|
2381
|
+
</Tooltip.Content>
|
|
2382
|
+
</Tooltip>
|
|
2383
|
+
</span>
|
|
2384
|
+
</label>
|
|
2239
2385
|
<TextField
|
|
2240
2386
|
value={dataTable.indexLabel || ''}
|
|
2241
2387
|
updateField={updateField}
|
|
@@ -2273,26 +2419,6 @@ const EditorPanel = props => {
|
|
|
2273
2419
|
}
|
|
2274
2420
|
type='textarea'
|
|
2275
2421
|
/>
|
|
2276
|
-
<label className='checkbox'>
|
|
2277
|
-
<input
|
|
2278
|
-
type='checkbox'
|
|
2279
|
-
checked={state.dataTable.forceDisplay !== undefined ? state.dataTable.forceDisplay : !isDashboard}
|
|
2280
|
-
onChange={event => {
|
|
2281
|
-
handleEditorChanges('showDataTable', event.target.checked)
|
|
2282
|
-
}}
|
|
2283
|
-
/>
|
|
2284
|
-
<span className='edit-label'>
|
|
2285
|
-
Show Table
|
|
2286
|
-
<Tooltip style={{ textTransform: 'none' }}>
|
|
2287
|
-
<Tooltip.Target>
|
|
2288
|
-
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
2289
|
-
</Tooltip.Target>
|
|
2290
|
-
<Tooltip.Content>
|
|
2291
|
-
<p>Data tables are required for 508 compliance. When choosing to hide this data table, replace with your own version.</p>
|
|
2292
|
-
</Tooltip.Content>
|
|
2293
|
-
</Tooltip>
|
|
2294
|
-
</span>
|
|
2295
|
-
</label>
|
|
2296
2422
|
<label className='checkbox'>
|
|
2297
2423
|
<input
|
|
2298
2424
|
type='checkbox'
|
|
@@ -2434,8 +2560,6 @@ const EditorPanel = props => {
|
|
|
2434
2560
|
<span className='edit-label'>Show Title</span>
|
|
2435
2561
|
</label>
|
|
2436
2562
|
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
2563
|
{'navigation' === state.general.type && (
|
|
2440
2564
|
<label className='checkbox'>
|
|
2441
2565
|
<input
|
|
@@ -2464,10 +2588,10 @@ const EditorPanel = props => {
|
|
|
2464
2588
|
<span className='edit-label'>Map Color Palette</span>
|
|
2465
2589
|
</label>
|
|
2466
2590
|
{/* <InputCheckbox section="general" subsection="palette" fieldName='isReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={isPaletteReversed} /> */}
|
|
2467
|
-
<InputToggle type='3d' section='general' subsection='palette' fieldName='isReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={
|
|
2591
|
+
<InputToggle type='3d' section='general' subsection='palette' fieldName='isReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={state.general.palette.isReversed} />
|
|
2468
2592
|
<span>Sequential</span>
|
|
2469
2593
|
<ul className='color-palette'>
|
|
2470
|
-
{
|
|
2594
|
+
{sequential.map(palette => {
|
|
2471
2595
|
const colorOne = {
|
|
2472
2596
|
backgroundColor: colorPalettes[palette][2]
|
|
2473
2597
|
}
|
|
@@ -2498,7 +2622,7 @@ const EditorPanel = props => {
|
|
|
2498
2622
|
</ul>
|
|
2499
2623
|
<span>Non-Sequential</span>
|
|
2500
2624
|
<ul className='color-palette'>
|
|
2501
|
-
{
|
|
2625
|
+
{nonSequential.map(palette => {
|
|
2502
2626
|
const colorOne = {
|
|
2503
2627
|
backgroundColor: colorPalettes[palette][2]
|
|
2504
2628
|
}
|
|
@@ -2531,7 +2655,7 @@ const EditorPanel = props => {
|
|
|
2531
2655
|
)
|
|
2532
2656
|
})}
|
|
2533
2657
|
</ul>
|
|
2534
|
-
{'us-geocode' === state.general.type && (
|
|
2658
|
+
{('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && (
|
|
2535
2659
|
<label>
|
|
2536
2660
|
Geocode Settings
|
|
2537
2661
|
<TextField type='number' value={state.visual.geoCodeCircleSize} section='visual' max='10' fieldName='geoCodeCircleSize' label='Geocode Circle Size' updateField={updateField} />
|
|
@@ -2581,7 +2705,8 @@ const EditorPanel = props => {
|
|
|
2581
2705
|
</label>
|
|
2582
2706
|
)}
|
|
2583
2707
|
{state.general.geoType === 'us' ||
|
|
2584
|
-
|
|
2708
|
+
state.general.geoType === 'us-county' ||
|
|
2709
|
+
(state.general.geoType === 'world' && (
|
|
2585
2710
|
<label>
|
|
2586
2711
|
<span className='edit-label'>City Style</span>
|
|
2587
2712
|
<select
|
|
@@ -22,6 +22,8 @@ const Sidebar = props => {
|
|
|
22
22
|
|
|
23
23
|
newLegend['disabledAmt'] = newValue ? disabledAmt + 1 : disabledAmt - 1
|
|
24
24
|
|
|
25
|
+
newLegend.runtimeDataHash = runtimeLegend.runtimeDataHash
|
|
26
|
+
|
|
25
27
|
setRuntimeLegend(newLegend)
|
|
26
28
|
|
|
27
29
|
setAccessibleStatus(`Disabled legend item ${legendLabel ?? ''}. Please reference the data table to see updated values.`)
|