kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
86 lines (81 loc) • 10.4 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.renameEntry = exports.registerEntry = exports.deleteEntry = void 0;
var _toolkit = require("@reduxjs/toolkit");
var _actionTypes = _interopRequireDefault(require("./action-types"));
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
/**
*
* Add a new kepler.gl instance in `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **mounted** to the dom.
* Note that if you dispatch actions such as adding data to a kepler.gl instance before the React component is mounted, the action will not be
* performed. Instance reducer can only handle actions when it is instantiated.
* @memberof rootActions
* @param payload
* @param payload.id - ***required** The id of the instance
* @param payload.mint - Whether to use a fresh empty state, when `mint: true` it will *always* load a fresh state when the component is re-mounted.
* When `mint: false` it will register with existing instance state under the same `id`, when the component is unmounted then mounted again. Default: `true`
* @param payload.mapboxApiAccessToken - mapboxApiAccessToken to be saved in `map-style` reducer.
* @param payload.mapboxApiUrl - mapboxApiUrl to be saved in `map-style` reducer.
* @param payload.mapStylesReplaceDefault - mapStylesReplaceDefault to be saved in `map-style` reducer.
* @param payload.initialUiState - initial ui state
* @public
*/
var registerEntry = exports.registerEntry = (0, _toolkit.createAction)(_actionTypes["default"].REGISTER_ENTRY, function (payload) {
return {
payload: payload
};
});
/**
*
* Delete an instance from `keplerGlReducer`. This action is called under-the-hood when a `KeplerGl` component is **un-mounted** to the dom.
* If `mint` is set to be `true` in the component prop, the instance state will be deleted from the root reducer. Otherwise, the root reducer will keep
* the instance state and later transfer it to a newly mounted component with the same `id`
* @memberof rootActions
* @param {string} id - the id of the instance to be deleted
* @public
*/
var deleteEntry = exports.deleteEntry = (0, _toolkit.createAction)(_actionTypes["default"].DELETE_ENTRY, function (id) {
return {
payload: {
id: id
}
};
});
/**
*
* Rename an instance in the root reducer, keep its entire state
*
* @memberof rootActions
* @param {string} oldId - ***required** old id
* @param {string} newId - ***required** new id
* @public
*/
var renameEntry = exports.renameEntry = (0, _toolkit.createAction)(_actionTypes["default"].RENAME_ENTRY, function (oldId, newId) {
return {
payload: {
oldId: oldId,
newId: newId
}
};
});
/**
* This declaration is needed to group actions in docs
*/
/**
* Root actions managers adding and removing instances in root reducer.
* Under-the-hood, when a `KeplerGl` component is mounted or unmounted,
* it will automatically calls these actions to add itself to the root reducer.
* However, sometimes the data is ready before the component is registered in the reducer,
* in this case, you can manually call these actions or the corresponding updater to add it to the reducer.
*
* @public
*/
/* eslint-disable @typescript-eslint/no-unused-vars */
// @ts-ignore
var rootActions = null;
/* eslint-enable @typescript-eslint/no-unused-vars */
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfdG9vbGtpdCIsInJlcXVpcmUiLCJfYWN0aW9uVHlwZXMiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVnaXN0ZXJFbnRyeSIsImV4cG9ydHMiLCJjcmVhdGVBY3Rpb24iLCJBY3Rpb25UeXBlcyIsIlJFR0lTVEVSX0VOVFJZIiwicGF5bG9hZCIsImRlbGV0ZUVudHJ5IiwiREVMRVRFX0VOVFJZIiwiaWQiLCJyZW5hbWVFbnRyeSIsIlJFTkFNRV9FTlRSWSIsIm9sZElkIiwibmV3SWQiLCJyb290QWN0aW9ucyJdLCJzb3VyY2VzIjpbIi4uL3NyYy9pZGVudGl0eS1hY3Rpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBNSVRcbi8vIENvcHlyaWdodCBjb250cmlidXRvcnMgdG8gdGhlIGtlcGxlci5nbCBwcm9qZWN0XG5cbmltcG9ydCB7Y3JlYXRlQWN0aW9ufSBmcm9tICdAcmVkdXhqcy90b29sa2l0JztcbmltcG9ydCB7ZGVmYXVsdCBhcyBBY3Rpb25UeXBlc30gZnJvbSAnLi9hY3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