Skip to content

Latest commit

 

History

History
620 lines (366 loc) · 13.4 KB

ui-state.md

File metadata and controls

620 lines (366 loc) · 13.4 KB

Table of Contents

uiStateUpdaters

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;

addNotificationUpdater

Add a notification to be displayed

Parameters

Returns Object nextState

cleanupExportImage

Delete cached export image

Parameters

Returns Object nextState

DEFAULT_EXPORT_DATA

Default initial exportData settings

Type: Object

Properties

  • selectedDataset string Default: '',
  • dataType string Default: 'csv',
  • filtered boolean Default: true,
  • config boolean deprecated
  • data boolean used in modal config export. Default: false

DEFAULT_EXPORT_IMAGE

Default image export config

Type: Object

Properties

  • ratio string Default: 'SCREEN',
  • resolution string Default: 'ONE_X',
  • legend boolean Default: false,
  • imageDataUri string Default: '',
  • exporting boolean Default: false
  • error boolean Default: false

DEFAULT_MAP_CONTROLS_FEATURES

A list of map control visibility and whether is it active.

Type: Object

Properties

  • visibleLayers Object Default: {show: true, active: false}
  • mapLegend Object Default: {show: true, active: false}
  • toggle3d Object Default: {show: true}
  • splitMap Object Default: {show: true}

hideExportDropdownUpdater

Hide side panel header dropdown, activated by clicking the share link on top of the side panel

Parameters

Returns Object nextState

INITIAL_UI_STATE

Default initial uiState

Type: Object

Properties

loadFilesErrUpdater

Handles load file error and set fileLoading property to false

Parameters

  • state
  • error Object
    • error.error

Returns Object nextState

loadFilesUpdater

Fired when file loading begin

Parameters

Returns Object nextState

openDeleteModalUpdater

Toggle active map control panel

Parameters

Returns Object nextState

removeNotificationUpdater

Remove a notification

Parameters

  • state Object uiState
  • action Object
    • action.payload String id of the notification to be removed

Returns Object nextState

setExportDataTypeUpdater

Set data format for exporting data

Parameters

Returns Object nextState

setExportDataUpdater

Whether to including data in map config, toggle between true or false

Parameters

Returns Object nextState

setExportFilteredUpdater

Whether to export filtered data, true or false

Parameters

Returns Object nextState

setExportImageDataUri

Set exportImage.setExportImageDataUri to a image dataUri

Parameters

Returns Object nextState

setExportSelectedDatasetUpdater

Set selected dataset for export

Parameters

Returns Object nextState

setRatioUpdater

Set exportImage.ratio

Parameters

  • state Object uiState
  • action Object
    • action.payload string one of 'SCREEN', 'FOUR_BY_THREE' and 'SIXTEEN_BY_NINE'

Returns Object nextState

setResolutionUpdater

Set exportImage.resolution

Parameters

Returns Object nextState

showExportDropdownUpdater

Hide and show side panel header dropdown, activated by clicking the share link on top of the side panel

Parameters

Returns Object nextState

startExportingImage

Set exportImage.exporting to true

Parameters

Returns Object nextState

toggleLegendUpdater

Set exportImage.legend to true or false

Parameters

Returns Object nextState

toggleMapControlUpdater

Toggle active map control panel

Parameters

  • state Object uiState
  • action Object action
    • action.payload string map control panel id, one of the keys of: DEFAULT_MAP_CONTROLS
    • action.payload.panelId
    • action.payload.index (optional, default 0)

Returns Object nextState

toggleModalUpdater

Show and hide modal dialog

Parameters

Returns Object nextState

toggleSidePanelUpdater

Toggle active side panel

Parameters

  • state Object uiState
  • action Object
    • action.payload (string | null) id of side panel to be shown, one of layer, filter, interaction, map. close side panel if null

Returns Object nextState

toggleSplitMapUpdater

Handles toggle map split and reset all map control index to 0

Parameters

  • state

Returns Object nextState

DEFAULT_EXPORT_HTML

Type: Object

Properties

  • exportMapboxAccessToken string Default: null, this is used when we provide a default mapbox token for users to take advantage of
  • userMapboxToken string Default: '', mapbox token provided by user through input field

setUserMapboxAccessTokenUpdater

whether to export a mapbox access to HTML single page

Parameters

Returns Object nextState