UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

807 lines (764 loc) 88.6 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.toggleSplitMapUpdater = exports.toggleSidePanelUpdater = exports.toggleSidePanelCloseButtonUpdater = exports.togglePanelListViewUpdater = exports.toggleModalUpdater = exports.toggleMapControlUpdater = exports.startExportingImageUpdater = exports.showExportDropdownUpdater = exports.showDatasetTableUpdater = exports.setUserMapboxAccessTokenUpdater = exports.setMapControlVisibilityUpdater = exports.setMapControlSettingsUpdater = exports.setLocaleUpdater = exports.setLoadingIndicatorUpdater = exports.setExportSelectedDatasetUpdater = exports.setExportMapHTMLModeUpdater = exports.setExportMapFormatUpdater = exports.setExportImageSettingUpdater = exports.setExportImageErrorUpdater = exports.setExportImageDataUriUpdater = exports.setExportFilteredUpdater = exports.setExportDataUpdater = exports.setExportDataTypeUpdater = exports.removeNotificationUpdater = exports.openDeleteModalUpdater = exports.loadFilesUpdater = exports.loadFilesSuccessUpdater = exports.loadFilesErrUpdater = exports.initUiStateUpdater = exports.hideExportDropdownUpdater = exports.cleanupExportImageUpdater = exports.addNotificationUpdater = exports.INITIAL_UI_STATE = exports.DEFAULT_NOTIFICATIONS = exports.DEFAULT_MODAL = exports.DEFAULT_MAP_CONTROLS = exports.DEFAULT_LOAD_FILES = exports.DEFAULT_EXPORT_MAP = exports.DEFAULT_EXPORT_JSON = exports.DEFAULT_EXPORT_IMAGE = exports.DEFAULT_EXPORT_HTML = exports.DEFAULT_EXPORT_DATA = exports.DEFAULT_ACTIVE_SIDE_PANEL = void 0; var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _constants = require("@kepler.gl/constants"); var _localization = require("@kepler.gl/localization"); var _utils = require("@kepler.gl/utils"); var _composerHelpers = require("./composer-helpers"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project var DEFAULT_ACTIVE_SIDE_PANEL = exports.DEFAULT_ACTIVE_SIDE_PANEL = 'layer'; var DEFAULT_MODAL = exports.DEFAULT_MODAL = _constants.ADD_DATA_ID; /** * Updaters for `uiState` reducer. Can be used in your root reducer to directly modify kepler.gl's state. * Read more about [Using updaters](../advanced-usage/using-updaters.md) * * @public * @example * * 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; */ /* eslint-disable @typescript-eslint/no-unused-vars */ // @ts-ignore var uiStateUpdaters = null; /* eslint-enable @typescript-eslint/no-unused-vars */ var DEFAULT_MAP_CONTROLS_FEATURES = { show: true, active: false, disableClose: false, // defines which map index users are interacting with (through map controls) activeMapIndex: 0 }; var DEFAULT_MAP_LEGEND_CONTROL = _objectSpread(_objectSpread({}, DEFAULT_MAP_CONTROLS_FEATURES), {}, { disableEdit: false }); /** * A list of map control visibility and whether is it active. * @memberof uiStateUpdaters * @constant * @property visibleLayers Default: `{show: true, active: false}` * @property mapLegend Default: `{show: true, active: false}` * @property toggle3d Default: `{show: true}` * @property splitMap Default: `{show: true}` * @property mapDraw Default: `{show: true, active: false}` * @property mapLocale Default: `{show: false, active: false}` * @public */ var DEFAULT_MAP_CONTROLS = exports.DEFAULT_MAP_CONTROLS = Object.keys(_constants.MAP_CONTROLS).reduce(function (_final, current) { return _objectSpread(_objectSpread({}, _final), {}, (0, _defineProperty2["default"])({}, current, current === _constants.MAP_CONTROLS.mapLegend ? DEFAULT_MAP_LEGEND_CONTROL : DEFAULT_MAP_CONTROLS_FEATURES)); }, {}); /** * Default image export config * @memberof uiStateUpdaters * @constant * @property ratio Default: `'SCREEN'`, * @property resolution Default: `'ONE_X'`, * @property legend Default: `false`, * @property mapH Default: 0, * @property mapW Default: 0, * @property imageSize Default: {zoomOffset: 0, scale: 1, imageW: 0, imageH: 0}, * @property imageDataUri Default: `''`, * @property exporting Default: `false` * @property error Default: `false` * @property escapeXhtmlForWebpack Default: `true` * @public */ var DEFAULT_EXPORT_IMAGE = exports.DEFAULT_EXPORT_IMAGE = { // user options ratio: _constants.EXPORT_IMG_RATIOS.SCREEN, resolution: _constants.RESOLUTIONS.ONE_X, legend: false, mapH: 0, mapW: 0, imageSize: { zoomOffset: 0, scale: 1, imageW: 0, imageH: 0 }, // when this is set to true, the mock map viewport will move to the center of data center: false, // exporting state imageDataUri: '', // exporting: used to attach plot-container to dom exporting: false, // processing: used as loading indicator when export image is being produced processing: false, error: false, // whether to apply fix for uglify error in dom-to-image (should be true for webpack builds) escapeXhtmlForWebpack: true }; var DEFAULT_LOAD_FILES = exports.DEFAULT_LOAD_FILES = { fileLoading: false }; /** * Default initial `exportData` settings * @memberof uiStateUpdaters * @constant * @property selectedDataset Default: `''`, * @property dataType Default: `'csv'`, * @property filtered Default: `true`, * @public */ var DEFAULT_EXPORT_DATA = exports.DEFAULT_EXPORT_DATA = { selectedDataset: '', dataType: _constants.EXPORT_DATA_TYPE.CSV, filtered: true }; /** * @constant */ var DEFAULT_NOTIFICATIONS = exports.DEFAULT_NOTIFICATIONS = []; /** * @constant * @property exportMapboxAccessToken - Default: null, this is used when we provide a default mapbox token for users to take advantage of * @property userMapboxToken - Default: '', mapbox token provided by user through input field * @property mode - Default: 'READ', read only or editable * @public */ var DEFAULT_EXPORT_HTML = exports.DEFAULT_EXPORT_HTML = { exportMapboxAccessToken: null, userMapboxToken: '', mode: _constants.EXPORT_HTML_MAP_MODES.READ }; /** * @constant * @property hasData - Default: 'true', * @public */ var DEFAULT_EXPORT_JSON = exports.DEFAULT_EXPORT_JSON = { hasData: true }; /** * Export Map Config * @constant * @property HTML - Default: 'DEFAULT_EXPORT_HTML', * @property JSON - Default: 'DEFAULT_EXPORT_JSON', * @property format - Default: 'HTML', * @public */ var DEFAULT_EXPORT_MAP = exports.DEFAULT_EXPORT_MAP = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _constants.EXPORT_MAP_FORMATS.HTML, DEFAULT_EXPORT_HTML), _constants.EXPORT_MAP_FORMATS.JSON, DEFAULT_EXPORT_JSON), "format", _constants.EXPORT_MAP_FORMATS.HTML); /** * Default initial `uiState` * @memberof uiStateUpdaters * @constant * @property readOnly Default: `false` * @property activeSidePanel Default: `'layer'` * @property currentModal Default: `'addData'` * @property datasetKeyToRemove Default: `null` * @property visibleDropdown Default: `null` * @property exportImage Default: [`DEFAULT_EXPORT_IMAGE`](#default_export_image) * @property exportData Default: [`DEFAULT_EXPORT_DATA`](#default_export_data) * @property exportMap Default: [`DEFAULT_EXPORT_MAP`](#default_export_map) * @property mapControls Default: [`DEFAULT_MAP_CONTROLS`](#default_map_controls) * @property notifications Default: `[]` * @property notifications Default: `[]` * @property loadFiles * @property isSidePanelCloseButtonVisible Default: `true` * @public */ var INITIAL_UI_STATE = exports.INITIAL_UI_STATE = { readOnly: false, activeSidePanel: DEFAULT_ACTIVE_SIDE_PANEL, currentModal: DEFAULT_MODAL, datasetKeyToRemove: null, visibleDropdown: null, // export image modal ui exportImage: DEFAULT_EXPORT_IMAGE, // export data modal ui exportData: DEFAULT_EXPORT_DATA, // html export exportMap: DEFAULT_EXPORT_MAP, // map control panels mapControls: DEFAULT_MAP_CONTROLS, // ui notifications notifications: DEFAULT_NOTIFICATIONS, // load files loadFiles: DEFAULT_LOAD_FILES, // Locale of the UI locale: _localization.LOCALE_CODES.en, layerPanelListView: 'list', filterPanelListView: 'list', isSidePanelCloseButtonVisible: true }; /* Updaters */ /** * @memberof uiStateUpdaters */ var initUiStateUpdater = exports.initUiStateUpdater = function initUiStateUpdater(state, action) { return _objectSpread(_objectSpread({}, state), (action.payload || {}).initialUiState); }; /** * Toggle active side panel * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload id of side panel to be shown, one of `layer`, `filter`, `interaction`, `map`. close side panel if `null` * @returns nextState * @public */ var toggleSidePanelUpdater = exports.toggleSidePanelUpdater = function toggleSidePanelUpdater(state, _ref) { var id = _ref.payload; return id === state.activeSidePanel ? state : _objectSpread(_objectSpread({}, state), {}, { activeSidePanel: id }); }; /** * Show and hide modal dialog * @memberof uiStateUpdaters * @param state `uiState` * @param action * @paramaction.payload id of modal to be shown, null to hide modals. One of: * - [`DATA_TABLE_ID`](../constants/default-settings.md#data_table_id) * - [`DELETE_DATA_ID`](../constants/default-settings.md#delete_data_id) * - [`ADD_DATA_ID`](../constants/default-settings.md#add_data_id) * - [`EXPORT_IMAGE_ID`](../constants/default-settings.md#export_image_id) * - [`EXPORT_DATA_ID`](../constants/default-settings.md#export_data_id) * - [`ADD_MAP_STYLE_ID`](../constants/default-settings.md#add_map_style_id) * @returns nextState * @public */ var toggleModalUpdater = exports.toggleModalUpdater = function toggleModalUpdater(state, _ref2) { var id = _ref2.payload; return _objectSpread(_objectSpread({}, state), {}, { currentModal: id }); }; /** * Hide and show side panel header dropdown, activated by clicking the share link on top of the side panel * @memberof uiStateUpdaters * @public */ var showExportDropdownUpdater = exports.showExportDropdownUpdater = function showExportDropdownUpdater(state, _ref3) { var id = _ref3.payload; return _objectSpread(_objectSpread({}, state), {}, { visibleDropdown: id }); }; /** * Hide side panel header dropdown, activated by clicking the share link on top of the side panel * @memberof uiStateUpdaters * @public */ var hideExportDropdownUpdater = exports.hideExportDropdownUpdater = function hideExportDropdownUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { visibleDropdown: null }); }; /** * Toggle side panel close button on top left of the side panel * @memberof uiStateUpdaters * @public */ var toggleSidePanelCloseButtonUpdater = exports.toggleSidePanelCloseButtonUpdater = function toggleSidePanelCloseButtonUpdater(state, _ref4) { var show = _ref4.payload.show; return _objectSpread(_objectSpread({}, state), {}, { isSidePanelCloseButtonVisible: show }); }; /** * Toggle active map control panel * @memberof uiStateUpdaters * @param state `uiState` * @param action action * @param action.payload map control panel id, one of the keys of: [`DEFAULT_MAP_CONTROLS`](#default_map_controls) * @returns nextState * @public */ var toggleMapControlUpdater = exports.toggleMapControlUpdater = function toggleMapControlUpdater(state, _ref5) { var _state$mapControls$pa; var _ref5$payload = _ref5.payload, panelId = _ref5$payload.panelId, _ref5$payload$index = _ref5$payload.index, index = _ref5$payload$index === void 0 ? 0 : _ref5$payload$index; var updatedState = state; // The effect panel and ai assistant panel can not be active at the same time // so we need to deactivate the other panel when one is activated var panelToDeactivate = panelId === _constants.MAP_CONTROLS.effect ? _constants.MAP_CONTROLS.aiAssistant : panelId === _constants.MAP_CONTROLS.aiAssistant ? _constants.MAP_CONTROLS.effect : null; // If we need to deactivate a competing panel and it's currently active if (panelToDeactivate && (_state$mapControls$pa = state.mapControls[panelToDeactivate]) !== null && _state$mapControls$pa !== void 0 && _state$mapControls$pa.active) { updatedState = _objectSpread(_objectSpread({}, state), {}, { mapControls: _objectSpread(_objectSpread({}, updatedState.mapControls), {}, (0, _defineProperty2["default"])({}, panelToDeactivate, _objectSpread(_objectSpread({}, updatedState.mapControls[panelToDeactivate]), {}, { active: false }))) }); } return _objectSpread(_objectSpread({}, updatedState), {}, { mapControls: _objectSpread(_objectSpread({}, updatedState.mapControls), {}, (0, _defineProperty2["default"])({}, panelId, _objectSpread(_objectSpread({}, updatedState.mapControls[panelId]), {}, { active: !updatedState.mapControls[panelId].active, activeMapIndex: index }))) }); }; /** * Toggle map control visibility * @memberof uiStateUpdaters * @param state `uiState` * @param action action * @param action.payload map control panel id, one of the keys of: [`DEFAULT_MAP_CONTROLS`](#default_map_controls) * @returns nextState * @public */ var setMapControlVisibilityUpdater = exports.setMapControlVisibilityUpdater = function setMapControlVisibilityUpdater(state, _ref6) { var _state$mapControls; var _ref6$payload = _ref6.payload, panelId = _ref6$payload.panelId, show = _ref6$payload.show; if (!((_state$mapControls = state.mapControls) !== null && _state$mapControls !== void 0 && _state$mapControls[panelId])) { return state; } return _objectSpread(_objectSpread({}, state), {}, { mapControls: _objectSpread(_objectSpread({}, state.mapControls), {}, (0, _defineProperty2["default"])({}, panelId, _objectSpread(_objectSpread({}, state.mapControls[panelId]), {}, { show: Boolean(show) }))) }); }; /** * Toggle map control settings * @memberof uiStateUpdaters * @param state `uiState` * @param action action * @param action.payload map control panel id, one of the keys of: [`DEFAULT_MAP_CONTROLS`](#default_map_controls) * @returns nextState * @public */ var setMapControlSettingsUpdater = exports.setMapControlSettingsUpdater = function setMapControlSettingsUpdater(state, _ref7) { var _state$mapControls2; var _ref7$payload = _ref7.payload, panelId = _ref7$payload.panelId, settings = _ref7$payload.settings; var mapControl = (_state$mapControls2 = state.mapControls) === null || _state$mapControls2 === void 0 ? void 0 : _state$mapControls2[panelId]; if (!mapControl) { return state; } return _objectSpread(_objectSpread({}, state), {}, { mapControls: _objectSpread(_objectSpread({}, state.mapControls), {}, (0, _defineProperty2["default"])({}, panelId, _objectSpread(_objectSpread({}, mapControl), {}, { settings: _objectSpread(_objectSpread({}, mapControl.settings), settings) }))) }); }; /** * Toggle active map control panel * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload dataset id * @returns nextState * @public */ var openDeleteModalUpdater = exports.openDeleteModalUpdater = function openDeleteModalUpdater(state, _ref8) { var datasetKeyToRemove = _ref8.payload; return _objectSpread(_objectSpread({}, state), {}, { currentModal: _constants.DELETE_DATA_ID, datasetKeyToRemove: datasetKeyToRemove }); }; /** * Set `exportImage.legend` to `true` or `false` * @memberof uiStateUpdaters * @param state `uiState` * @returns nextState * @public */ var setExportImageSettingUpdater = exports.setExportImageSettingUpdater = function setExportImageSettingUpdater(state, _ref9) { var newSetting = _ref9.payload; var updated = _objectSpread(_objectSpread({}, state.exportImage), newSetting); var imageSize = (0, _utils.calculateExportImageSize)(updated) || state.exportImage.imageSize; return _objectSpread(_objectSpread({}, state), {}, { exportImage: _objectSpread(_objectSpread({}, updated), {}, { // @ts-expect-error // TODO: calculateExportImageSize does not return imageSize.zoomOffset, // do we need take this value from current state, or return defaul value = 0 imageSize: imageSize }) }); }; /** * Set `exportImage.setExportImageDataUri` to a image dataUri * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload export image data uri * @returns nextState * @public */ var setExportImageDataUriUpdater = exports.setExportImageDataUriUpdater = function setExportImageDataUriUpdater(state, _ref10) { var dataUri = _ref10.payload; return _objectSpread(_objectSpread({}, state), {}, { exportImage: _objectSpread(_objectSpread({}, state.exportImage), {}, { processing: false, imageDataUri: dataUri }) }); }; /** * @memberof uiStateUpdaters * @public */ var setExportImageErrorUpdater = exports.setExportImageErrorUpdater = function setExportImageErrorUpdater(state, _ref11) { var error = _ref11.payload; return _objectSpread(_objectSpread({}, state), {}, { exportImage: _objectSpread(_objectSpread({}, state.exportImage), {}, { processing: false, error: error }) }); }; /** * Delete cached export image * @memberof uiStateUpdaters * @public */ var cleanupExportImageUpdater = exports.cleanupExportImageUpdater = function cleanupExportImageUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { exportImage: _objectSpread(_objectSpread({}, state.exportImage), {}, { exporting: false, imageDataUri: '', error: false, processing: false, center: false }) }); }; /** * Start image exporting flow * @memberof uiStateUpdaters * @param state * @param options * @returns {UiState} * @public */ var startExportingImageUpdater = exports.startExportingImageUpdater = function startExportingImageUpdater(state, _ref12) { var _ref12$payload = _ref12.payload, options = _ref12$payload === void 0 ? {} : _ref12$payload; var imageSettings = _objectSpread(_objectSpread({}, options), {}, { exporting: true }); return (0, _composerHelpers.compose_)([cleanupExportImageUpdater, (0, _composerHelpers.apply_)(setExportImageSettingUpdater, (0, _composerHelpers.payload_)(imageSettings))])(state); }; /** * Set selected dataset for export * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload dataset id * @returns nextState * @public */ var setExportSelectedDatasetUpdater = exports.setExportSelectedDatasetUpdater = function setExportSelectedDatasetUpdater(state, _ref13) { var dataset = _ref13.payload; return _objectSpread(_objectSpread({}, state), {}, { exportData: _objectSpread(_objectSpread({}, state.exportData), {}, { selectedDataset: dataset }) }); }; /** * Set data format for exporting data * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload one of `'text/csv'` * @returns nextState * @public */ var setExportDataTypeUpdater = exports.setExportDataTypeUpdater = function setExportDataTypeUpdater(state, _ref14) { var dataType = _ref14.payload; return _objectSpread(_objectSpread({}, state), {}, { exportData: _objectSpread(_objectSpread({}, state.exportData), {}, { dataType: dataType }) }); }; /** * Whether to export filtered data, `true` or `false` * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload * @returns nextState * @public */ var setExportFilteredUpdater = exports.setExportFilteredUpdater = function setExportFilteredUpdater(state, _ref15) { var filtered = _ref15.payload; return _objectSpread(_objectSpread({}, state), {}, { exportData: _objectSpread(_objectSpread({}, state.exportData), {}, { filtered: filtered }) }); }; /** * Whether to including data in map config, toggle between `true` or `false` * @memberof uiStateUpdaters * @param state `uiState` * @returns nextState * @public */ var setExportDataUpdater = exports.setExportDataUpdater = function setExportDataUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { exportMap: _objectSpread(_objectSpread({}, state.exportMap), {}, (0, _defineProperty2["default"])({}, _constants.EXPORT_MAP_FORMATS.JSON, _objectSpread(_objectSpread({}, state.exportMap[_constants.EXPORT_MAP_FORMATS.JSON]), {}, { hasData: !state.exportMap[_constants.EXPORT_MAP_FORMATS.JSON].hasData }))) }); }; /** * whether to export a mapbox access to HTML single page * @param state - `uiState` * @param action * @param action.payload * @returns nextState * @public */ var setUserMapboxAccessTokenUpdater = exports.setUserMapboxAccessTokenUpdater = function setUserMapboxAccessTokenUpdater(state, _ref16) { var userMapboxToken = _ref16.payload; return _objectSpread(_objectSpread({}, state), {}, { exportMap: _objectSpread(_objectSpread({}, state.exportMap), {}, (0, _defineProperty2["default"])({}, _constants.EXPORT_MAP_FORMATS.HTML, _objectSpread(_objectSpread({}, state.exportMap[_constants.EXPORT_MAP_FORMATS.HTML]), {}, { userMapboxToken: userMapboxToken }))) }); }; /** * Sets the export map format * @param state - `uiState` * @param action * @param action.payload format to use to export the map into * @return nextState */ var setExportMapFormatUpdater = exports.setExportMapFormatUpdater = function setExportMapFormatUpdater(state, _ref17) { var format = _ref17.payload; return _objectSpread(_objectSpread({}, state), {}, { exportMap: _objectSpread(_objectSpread({}, state.exportMap), {}, { // @ts-expect-error format: format }) }); }; /** * Set the export html map mode * @param state - `uiState` * @param action * @param action.payload to be set (available modes: EXPORT_HTML_MAP_MODES) * @return nextState */ var setExportMapHTMLModeUpdater = exports.setExportMapHTMLModeUpdater = function setExportMapHTMLModeUpdater(state, _ref18) { var mode = _ref18.payload; return _objectSpread(_objectSpread({}, state), {}, { exportMap: _objectSpread(_objectSpread({}, state.exportMap), {}, (0, _defineProperty2["default"])({}, _constants.EXPORT_MAP_FORMATS.HTML, _objectSpread(_objectSpread({}, state.exportMap[_constants.EXPORT_MAP_FORMATS.HTML]), {}, { mode: mode }))) }); }; /** * Adds a new notification. * Updates a notification in case of matching ids. * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload Params of a notification * @returns nextState * @public */ var addNotificationUpdater = exports.addNotificationUpdater = function addNotificationUpdater(state, _ref19) { var payload = _ref19.payload; var oldNotifications = state.notifications || []; // @ts-expect-error var payloadId = payload === null || payload === void 0 ? void 0 : payload.id; var notificationToUpdate = payloadId ? oldNotifications.find(function (n) { return n.id === payloadId; }) : null; var notifications; if (notificationToUpdate) { notifications = oldNotifications.map(function (n) { return n.id === payloadId ? (0, _utils.createNotification)(_objectSpread(_objectSpread({}, payload), {}, { count: n.count + 1 })) : n; }); } else { notifications = [].concat((0, _toConsumableArray2["default"])(oldNotifications), [(0, _utils.createNotification)(payload)]); } return _objectSpread(_objectSpread({}, state), {}, { notifications: notifications }); }; /** * Remove a notification * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload id of the notification to be removed * @returns nextState * @public */ var removeNotificationUpdater = exports.removeNotificationUpdater = function removeNotificationUpdater(state, _ref20) { var id = _ref20.payload; return _objectSpread(_objectSpread({}, state), {}, { notifications: state.notifications.filter(function (n) { return n.id !== id; }) }); }; /** * Fired when file loading begin * @memberof uiStateUpdaters * @param state `uiState` * @returns nextState * @public */ var loadFilesUpdater = exports.loadFilesUpdater = function loadFilesUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { loadFiles: _objectSpread(_objectSpread({}, state.loadFiles), {}, { fileLoading: true }) }); }; /** * Handles loading file success and set fileLoading property to false * @memberof uiStateUpdaters * @param state `uiState` * @returns nextState */ var loadFilesSuccessUpdater = exports.loadFilesSuccessUpdater = function loadFilesSuccessUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { loadFiles: _objectSpread(_objectSpread({}, state.loadFiles), {}, { fileLoading: false }) }); }; /** * Handles load file error and set fileLoading property to false * @memberof uiStateUpdaters * @param state * @param action * @param action.error * @returns nextState * @public */ var loadFilesErrUpdater = exports.loadFilesErrUpdater = function loadFilesErrUpdater(state, _ref21) { var error = _ref21.error; return addNotificationUpdater(_objectSpread(_objectSpread({}, state), {}, { loadFiles: _objectSpread(_objectSpread({}, state.loadFiles), {}, { fileLoading: false }) }), { payload: (0, _utils.errorNotification)({ message: (error || {}).message || 'Failed to upload files', topic: _constants.DEFAULT_NOTIFICATION_TOPICS.global }) }); }; /** * Handles toggle map split and reset all map control index to 0 * @memberof uiStateUpdaters * @param state * @returns nextState * @public */ var toggleSplitMapUpdater = exports.toggleSplitMapUpdater = function toggleSplitMapUpdater(state) { return _objectSpread(_objectSpread({}, state), {}, { mapControls: Object.entries(state.mapControls).reduce(function (acc, entry) { return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2["default"])({}, entry[0], _objectSpread(_objectSpread({}, entry[1]), {}, { activeMapIndex: 0 }))); }, {}) }); }; /** * Toggle modal data * @memberof uiStateUpdaters * @param state * @returns nextState * @public */ var showDatasetTableUpdater = exports.showDatasetTableUpdater = function showDatasetTableUpdater(state) { return toggleModalUpdater(state, { payload: _constants.DATA_TABLE_ID }); }; /** * Set the locale of the UI * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload * @param action.payload.locale locale * @returns nextState * @public */ var setLocaleUpdater = exports.setLocaleUpdater = function setLocaleUpdater(state, _ref22) { var locale = _ref22.payload.locale; return _objectSpread(_objectSpread({}, state), {}, { locale: locale }); }; /** * Toggle layer panel list view * @memberof uiStateUpdaters * @param state `uiState` * @param action * @param action.payload layer panel listView value. Can be 'list' or 'sortByDataset' * @returns nextState * @public */ var togglePanelListViewUpdater = exports.togglePanelListViewUpdater = function togglePanelListViewUpdater(state, _ref23) { var _ref23$payload = _ref23.payload, panelId = _ref23$payload.panelId, listView = _ref23$payload.listView; var stateProp = panelId === 'layer' ? 'layerPanelListView' : panelId === 'filter' ? 'filterPanelListView' : null; if (!stateProp || state[stateProp] === listView) { return state; } return _objectSpread(_objectSpread({}, state), {}, (0, _defineProperty2["default"])({}, stateProp, listView)); }; /** * Update state of the loading indicator. * @memberof uiStateUpdaters * @param state uiState * @param action * @param action.payload Payload with change of number of active loading actions. * @returns nextState * @public */ var setLoadingIndicatorUpdater = exports.setLoadingIndicatorUpdater = function setLoadingIndicatorUpdater(state, _ref24) { var change = _ref24.payload.change; var loadingIndicatorValue = state.loadingIndicatorValue; if (!loadingIndicatorValue) { loadingIndicatorValue = 0; } return _objectSpread(_objectSpread({}, state), {}, { loadingIndicatorValue: Math.max(loadingIndicatorValue + change, 0) }); }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfY29uc3RhbnRzIiwicmVxdWlyZSIsIl9sb2NhbGl6YXRpb24iLCJfdXRpbHMiLCJfY29tcG9zZXJIZWxwZXJzIiwib3duS2V5cyIsImUiLCJyIiwidCIsIk9iamVjdCIsImtleXMiLCJnZXRPd25Qcm9wZXJ0eVN5bWJvbHMiLCJvIiwiZmlsdGVyIiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwiZW51bWVyYWJsZSIsInB1c2giLCJhcHBseSIsIl9vYmplY3RTcHJlYWQiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJmb3JFYWNoIiwiX2RlZmluZVByb3BlcnR5MiIsImdldE93blByb3BlcnR5RGVzY3JpcHRvcnMiLCJkZWZpbmVQcm9wZXJ0aWVzIiwiZGVmaW5lUHJvcGVydHkiLCJERUZBVUxUX0FDVElWRV9TSURFX1BBTkVMIiwiZXhwb3J0cyIsIkRFRkFVTFRfTU9EQUwiLCJBRERfREFUQV9JRCIsInVpU3RhdGVVcGRhdGVycyIsIkRFRkFVTFRfTUFQX0NPTlRST0xTX0ZFQVRVUkVTIiwic2hvdyIsImFjdGl2ZSIsImRpc2FibGVDbG9zZSIsImFjdGl2ZU1hcEluZGV4IiwiREVGQVVMVF9NQVBfTEVHRU5EX0NPTlRST0wiLCJkaXNhYmxlRWRpdCIsIkRFRkFVTFRfTUFQX0NPTlRST0xTIiwiTUFQX0NPTlRST0xTIiwicmVkdWNlIiwiZmluYWwiLCJjdXJyZW50IiwibWFwTGVnZW5kIiwiREVGQVVMVF9FWFBPUlRfSU1BR0UiLCJyYXRpbyIsIkVYUE9SVF9JTUdfUkFUSU9TIiwiU0NS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