Skip to content

Commit 9d8bd3a

Browse files
committed
[DEV-50470] Resolve full geo name display issue
- Migrate state.general.showFullGeoName to state.table.showFullGeoName - Change the input to use the proper state.table.showFullGeoName property - Update when to append full geo name based on the checkbox
1 parent 11a9df4 commit 9d8bd3a

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

packages/core/components/DataTable/DataTable.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type DataTableProps = {
3434
defaultSortBy?: string
3535
displayGeoName?: (row: string) => string
3636
expandDataTable: boolean
37-
formatLegendLocation?: (row: string) => string
37+
formatLegendLocation?: (row: string, runtimeLookup: string) => string
3838
groupBy?: string
3939
headerColor?: string
4040
imageRef?: string
@@ -247,9 +247,14 @@ const DataTable = (props: DataTableProps) => {
247247
const csvData = config.table?.downloadVisibleDataOnly ? visibleData : rawData
248248

249249
// only use fullGeoName on County maps and no other
250-
if (config.general?.geoType === 'us-county') {
250+
if (config.general?.geoType === 'us-county' || config.table.showFullGeoNameInCSV) {
251251
// Add column for full Geo name along with State
252-
return csvData.map(row => ({ FullGeoName: formatLegendLocation(row[config.columns.geo.name]), ...row }))
252+
return csvData.map(row => {
253+
return {
254+
FullGeoName: formatLegendLocation(row[config.columns.geo.name]),
255+
...row
256+
}
257+
})
253258
} else {
254259
return csvData
255260
}

packages/core/helpers/ver/4.25.4.ts

+11
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,21 @@ export const makeChartLegendsUnified = config => {
1919
}
2020
}
2121

22+
const migrateTableGeneralSettings = config => {
23+
if (config.type === 'map') {
24+
if (config.general.showFullGeoNameInCSV) {
25+
config.table.showFullGeoNameInCSV = config.general.showFullGeoNameInCSV
26+
}
27+
delete config.general.showFullGeoNameInCSV
28+
return config
29+
}
30+
}
31+
2232
const update_4_25_4 = config => {
2333
const ver = '4.25.4'
2434
const newConfig = _.cloneDeep(config)
2535
makeChartLegendsUnified(newConfig)
36+
migrateTableGeneralSettings(newConfig)
2637
newConfig.version = ver
2738
return newConfig
2839
}

packages/map/src/components/EditorPanel/components/EditorPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ const EditorPanel = () => {
28542854
<label className='checkbox'>
28552855
<input
28562856
type='checkbox'
2857-
checked={state.general.showFullGeoNameInCSV}
2857+
checked={state.table.showFullGeoNameInCSV}
28582858
onChange={event => {
28592859
handleEditorChanges('toggleShowFullGeoNameInCSV', event.target.checked)
28602860
}}

0 commit comments

Comments
 (0)