- uiStateUpdaters
- addNotificationUpdater
- cleanupExportImage
- DEFAULT_EXPORT_DATA
- DEFAULT_EXPORT_IMAGE
- DEFAULT_MAP_CONTROLS_FEATURES
- hideExportDropdownUpdater
- INITIAL_UI_STATE
- loadFilesErrUpdater
- loadFilesUpdater
- openDeleteModalUpdater
- removeNotificationUpdater
- setExportDataTypeUpdater
- setExportDataUpdater
- setExportFilteredUpdater
- setExportImageDataUri
- setExportSelectedDatasetUpdater
- setRatioUpdater
- setResolutionUpdater
- showExportDropdownUpdater
- startExportingImage
- toggleLegendUpdater
- toggleMapControlUpdater
- toggleModalUpdater
- toggleSidePanelUpdater
- toggleSplitMapUpdater
- DEFAULT_EXPORT_HTML
- setUserMapboxAccessTokenUpdater
Updaters for uiState
reducer. Can be used in your root reducer to directly modify kepler.gl's state.
Read more about Using updaters
Examples
import keplerGlReducer, {uiStateUpdaters} from 'kepler.gl/reducers';
// Root Reducer
const reducers = combineReducers({
keplerGl: keplerGlReducer,
app: appReducer
});
const composedReducer = (state, action) => {
switch (action.type) {
// click button to close side panel
case 'CLICK_BUTTON':
return {
...state,
keplerGl: {
...state.keplerGl,
foo: {
...state.keplerGl.foo,
uiState: uiStateUpdaters.toggleSidePanelUpdater(
uiState, {payload: null}
)
}
}
};
}
return reducers(state, action);
};
export default composedReducer;
Add a notification to be displayed
- Action:
addNotification
Parameters
Returns Object nextState
Delete cached export image
- Action:
cleanupExportImage
Parameters
state
ObjectuiState
Returns Object nextState
Default initial exportData
settings
Type: Object
selectedDataset
string Default:''
,dataType
string Default:'csv'
,filtered
boolean Default:true
,config
boolean deprecateddata
boolean used in modal config export. Default:false
Default image export config
Type: Object
ratio
string Default:'SCREEN'
,resolution
string Default:'ONE_X'
,legend
boolean Default:false
,imageDataUri
string Default:''
,exporting
boolean Default:false
error
boolean Default:false
A list of map control visibility and whether is it active.
Type: Object
visibleLayers
Object Default:{show: true, active: false}
mapLegend
Object Default:{show: true, active: false}
toggle3d
Object Default:{show: true}
splitMap
Object Default:{show: true}
Hide side panel header dropdown, activated by clicking the share link on top of the side panel
- Action:
hideExportDropdown
Parameters
state
ObjectuiState
Returns Object nextState
Default initial uiState
Type: Object
readOnly
boolean Default:false
activeSidePanel
string Default:'layer'
currentModal
(string | null) Default:'addData'
datasetKeyToRemove
(string | null) Default:null
visibleDropdown
(string | null) Default:null
exportImage
Object Default:DEFAULT_EXPORT_IMAGE
exportData
Object Default:DEFAULT_EXPORT_DATA
mapControls
Object Default:DEFAULT_MAP_CONTROLS
activeMapIndex
number defines which map the user clicked on. Default: 0
Handles load file error and set fileLoading property to false
- Action:
loadFilesErr
Parameters
state
error
Objecterror.error
Returns Object nextState
Fired when file loading begin
- Action:
loadFiles
Parameters
state
ObjectuiState
Returns Object nextState
Toggle active map control panel
- Action:
openDeleteModal
Parameters
Returns Object nextState
Remove a notification
- Action:
removeNotification
Parameters
Returns Object nextState
Set data format for exporting data
- Action:
setExportDataType
Parameters
Returns Object nextState
Whether to including data in map config, toggle between true
or false
- Action:
setExportData
Parameters
state
ObjectuiState
Returns Object nextState
Whether to export filtered data, true
or false
- Action:
setExportFiltered
Parameters
Returns Object nextState
Set exportImage.setExportImageDataUri
to a image dataUri
- Action:
setExportImageDataUri
Parameters
Returns Object nextState
Set selected dataset for export
- Action:
setExportSelectedDataset
Parameters
Returns Object nextState
Set exportImage.ratio
- Action:
setRatio
Parameters
state
ObjectuiState
action
Objectaction.payload
string one of'SCREEN'
,'FOUR_BY_THREE'
and'SIXTEEN_BY_NINE'
Returns Object nextState
Set exportImage.resolution
- Action:
setResolution
Parameters
Returns Object nextState
Hide and show side panel header dropdown, activated by clicking the share link on top of the side panel
- Action:
showExportDropdown
Parameters
Returns Object nextState
Set exportImage.exporting
to true
- Action:
startExportingImage
Parameters
state
ObjectuiState
Returns Object nextState
Set exportImage.legend
to true
or false
- Action:
toggleLegend
Parameters
state
ObjectuiState
Returns Object nextState
Toggle active map control panel
- Action:
toggleMapControl
Parameters
state
ObjectuiState
action
Object actionaction.payload
string map control panel id, one of the keys of:DEFAULT_MAP_CONTROLS
action.payload.panelId
action.payload.index
(optional, default0
)
Returns Object nextState
Show and hide modal dialog
- Action:
toggleModal
Parameters
state
ObjectuiState
action
Objectaction.payload
(string | null) id of modal to be shown, null to hide modals. One of:-DATA_TABLE_ID
Returns Object nextState
Toggle active side panel
- Action:
toggleSidePanel
Parameters
state
ObjectuiState
action
Objectaction.payload
(string | null) id of side panel to be shown, one oflayer
,filter
,interaction
,map
. close side panel ifnull
Returns Object nextState
Handles toggle map split and reset all map control index to 0
- Action:
toggleSplitMap
Parameters
state
Returns Object nextState
Type: Object
exportMapboxAccessToken
string Default: null, this is used when we provide a default mapbox token for users to take advantage ofuserMapboxToken
string Default: '', mapbox token provided by user through input field
whether to export a mapbox access to HTML single page
- Action:
setUserMapboxAccessToken
Parameters
Returns Object nextState