qwc2
Version:
QGIS Web Client
498 lines (496 loc) • 26.6 kB
JavaScript
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) { _defineProperty(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; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
* Copyright 2020-2024 Sourcepole AG
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';
import axios from 'axios';
import ol from 'openlayers';
import PropTypes from 'prop-types';
import url from 'url';
import * as uuid from 'uuid';
import * as displayActions from '../actions/display';
import * as editingActions from '../actions/editing';
import { LayerRole } from '../actions/layers';
import * as layerActions from '../actions/layers';
import { registerCustomPlugin, unregisterCustomPlugin } from '../actions/localConfig';
import * as localeActions from '../actions/locale';
import * as locateActions from '../actions/locate';
import * as mapActions from '../actions/map';
import * as taskActions from '../actions/task';
import * as themeActions from '../actions/theme';
import * as windowsActions from '../actions/windows';
import AppMenu from '../components/AppMenu';
import AttributeForm from '../components/AttributeForm';
import AttributeTableWidget from '../components/AttributeTableWidget';
import AutoEditForm from '../components/AutoEditForm';
import CoordinateDisplayer from '../components/CoordinateDisplayer';
import EditComboField from '../components/EditComboField';
import EditUploadField from '../components/EditUploadField';
import FullscreenSwitcher from '../components/FullscreenSwitcher';
import Icon from '../components/Icon';
import IdentifyViewer from '../components/IdentifyViewer';
import ImportLayer from '../components/ImportLayer';
import LayerInfoWindow from '../components/LayerInfoWindow';
import LinkFeatureForm from '../components/LinkFeatureForm';
import MapSelection from '../components/MapSelection';
import NumericInputWindow from '../components/NumericInputWindow';
import PickFeature from '../components/PickFeature';
import PluginsContainer from '../components/PluginsContainer';
import PrintSelection from '../components/PrintSelection';
import QtDesignerForm from '../components/QtDesignerForm';
import ResizeableWindow from '../components/ResizeableWindow';
import SearchBox from '../components/SearchBox';
import ServiceInfoWindow from '../components/ServiceInfoWindow';
import SideBar from '../components/SideBar';
import { Swipeable } from '../components/Swipeable';
import TaskBar from '../components/TaskBar';
import ThemeLayersListWindow from '../components/ThemeLayersListWindow';
import ThemeList from '../components/ThemeList';
import Toolbar from '../components/Toolbar';
import ShareLink from '../components/share/ShareLink';
import ShareQRCode from '../components/share/ShareQRCode';
import ShareSocials from '../components/share/ShareSocials';
import FixedTimeline from '../components/timeline/FixedTimeline';
import InfiniteTimeline from '../components/timeline/InfiniteTimeline';
import TimelineFeaturesSlider from '../components/timeline/TimelineFeaturesSlider';
import AccordeonWidget from '../components/widgets/AccordeonWidget';
import ButtonBar from '../components/widgets/ButtonBar';
import ColorButton from '../components/widgets/ColorButton';
import ComboBox from '../components/widgets/ComboBox';
import CopyButton from '../components/widgets/CopyButton';
import DateTimeInput from '../components/widgets/DateTimeInput';
import EditableSelect from '../components/widgets/EditableSelect';
import FileSelector from '../components/widgets/FileSelector';
import Input from '../components/widgets/Input';
import InputContainer from '../components/widgets/InputContainer';
import LayerCatalogWidget from '../components/widgets/LayerCatalogWidget';
import MenuButton from '../components/widgets/MenuButton';
import ModalDialog from '../components/widgets/ModalDialog';
import NavBar from '../components/widgets/NavBar';
import NumberInput from '../components/widgets/NumberInput';
import PopupMenu from '../components/widgets/PopupMenu';
import { Image } from '../components/widgets/Primitives';
import SearchWidget from '../components/widgets/SearchWidget';
import Spinner from '../components/widgets/Spinner';
import SuggestionInput from '../components/widgets/SuggestionInput';
import TextInput from '../components/widgets/TextInput';
import ToggleSwitch from '../components/widgets/ToggleSwitch';
import VectorLayerPicker from '../components/widgets/VectorLayerPicker';
import ConfigUtils from '../utils/ConfigUtils';
import CoordinatesUtils from '../utils/CoordinatesUtils';
import EditingInterface from '../utils/EditingInterface';
import * as EditingUtils from '../utils/EditingUtils';
import LayerUtils from '../utils/LayerUtils';
import LocaleUtils from '../utils/LocaleUtils';
import MapUtils from '../utils/MapUtils';
import * as PermaLinkUtils from '../utils/PermaLinkUtils';
import PluginStore from '../utils/PluginStore';
import { SearchResultType } from '../utils/SearchProviders';
import ServiceLayerUtils from '../utils/ServiceLayerUtils';
import VectorLayerUtils from '../utils/VectorLayerUtils';
/**
* Exposes an API for interacting with QWC2 via `window.qwc2`.
*
* You can interact with the API as soon as the `QWC2ApiReady` event is dispatched.
*
* Here is an example of a custom plugin:
*
* ```
* window.addEventListener("QWC2ApiReady", () => {
* const {React, PropTypes, connect} = window.qwc2.libs;
* const {TaskBar} = window.qwc2.components;
*
* class CurrentTheme extends React.Component {
* static propTypes = {
* theme: PropTypes.object
* };
* render() {
* return React.createElement(TaskBar, {task: "CurrentTheme"},
* React.createElement(
* 'span', {role: 'body'},
* `Current theme: ${this.props.theme?.title}`
* )
* );
* }
* }
*
* const CurrentThemePlugin = connect(state => ({
* theme: state.theme.current
* }))(CurrentTheme);
*
* window.qwc2.addPlugin("CurrentThemePlugin", CurrentThemePlugin);
* });
* ```
*
* *Note*: You can also write the plugin in JSX syntax, and transpile to plain JS using babel.
*
* To load custom plugins in QWC:
*
* - Include the custom plugin code in `index.html`, i.e.
*
* <script type="text/javascript" src="assets/js/currenttheme.js" ></script>
*
* - Enable the plugin in the plugins block of `config.json`
*
* {
* "name": "CurrentTheme"
* }
*
* The following action functions are exposed in the API:
*
* - [display](https://github.com/qgis/qwc2/blob/master/actions/display.js)
* - [editing](https://github.com/qgis/qwc2/blob/master/actions/editing.js)
* - [layers](https://github.com/qgis/qwc2/blob/master/actions/layers.js)
* - [locate](https://github.com/qgis/qwc2/blob/master/actions/locate.js)
* - [map](https://github.com/qgis/qwc2/blob/master/actions/map.js)
* - [task](https://github.com/qgis/qwc2/blob/master/actions/task.js)
* - [theme](https://github.com/qgis/qwc2/blob/master/actions/theme.js)
* - [windows](https://github.com/qgis/qwc2/blob/master/actions/windows.js)
*
* I.e. `setCurrentTask` is available via `window.qwc2.setCurrentTask`.
*
* The following core libraries are accessible via `window.qwc2.libs`:
*
* - `axios`
* - `React`
* - `ReactDOM`
* - `PropTypes`
* - `connect`
* - `ol`
* - `uuid`
* - `url`
*
* The QWC shared components are acessible via `window.qwc2.components`, i.e. `window.qwc2.components.SideBar`.
*
* In addition, the following methods are available on `window.qwc2`:
*/
var API = /*#__PURE__*/function (_React$Component) {
function API() {
var _this;
_classCallCheck(this, API);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, API, [].concat(args));
/**
* Add custom plugin
*
* * `name`: An identifier
* * `plugin`: The plugin component class
* * `translations`: The plugin translation messages: `{"<lang>": {<messages>}, ...}`
*/
_defineProperty(_this, "addPlugin", function (name, plugin) {
var _plugin$WrappedCompon, _component$availableI;
var translations = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var component = (_plugin$WrappedCompon = plugin.WrappedComponent) !== null && _plugin$WrappedCompon !== void 0 ? _plugin$WrappedCompon : plugin;
var availableIn3D = (_component$availableI = component.availableIn3D) !== null && _component$availableI !== void 0 ? _component$availableI : false;
PluginStore.addCustomPlugin(name, plugin);
window.qwc2.addTranslations(translations);
_this.props.registerCustomPlugin(name, availableIn3D);
});
/**
* Remove custom plugin
*
* * `name`: The identifier
*/
_defineProperty(_this, "removePlugin", function (name) {
PluginStore.removeCustomPlugin(name);
_this.props.unregisterCustomPlugin(name);
});
/**
* Add custom attribute calculator
* (i.e. computed attributes which are added to GetFeatureInfo responses).
*
* * `name`: An identifier
* * `calcFunc`: The calculator function with signature `function(layer, feature)`
*
* The `calcFunc` should return either a two-enty `[name, value]` pair or a one-value `[value]` array.
*/
_defineProperty(_this, "addIdentifyAttributeCalculator", function (name, calcFunc) {
window.qwc2.__attributeCalculators[name] = calcFunc;
});
/**
* Remove custom identify attribute calculator
*
* * `name`: The identifier
*/
_defineProperty(_this, "removeIdentifyAttributeCalculator", function (name) {
delete window.qwc2.__attributeCalculators[name];
});
/**
* Add custom identify exporter
*
* * `name`: An identifier
* * `exporterFunc`: The exporter configuration
*
* The exporter configuration is an object of the shape
*
* ```
* {
* id: "<id>",
* title: "<title>",
* allowClipboard: <true|false>,
* export: (features, callback) => {
* callback({
* data: <blob>, type: "<mimeType>", filename: "<filename>"
* });
* }
* }
* ```
*/
_defineProperty(_this, "addIdentifyExporter", function (name, exporterConfig) {
window.qwc2.__identifyExportes[name] = exporterConfig;
});
/**
* Remove identify exporter
*
* * `name`: The identifier
*/
_defineProperty(_this, "removeIdentifyExporter", function (name) {
delete window.qwc2.__identifyExportes[name];
});
/**
* Convenience method for adding an external layer.
*
* * `resource`: An external resource of the form `wms:<service_url>#<layername>` or `wmts:<capabilities_url>#<layername>`.
* * `options`: An object which may contain the following fields:
* * `beforeLayerName`: Insert the new layer before the layer with the specified name. If `null` or the layer does not exist, the layer is inserted on top.
* * `afterLayerName`: Insert the new layer after the layer with the specified name. If `null` or the layer does not exist, the layer is inserted on top.
* * `sublayers`: Whether to import the sublayer structure (`true`) or just a flat layer (`false`).
*/
_defineProperty(_this, "addExternalLayer", function (resource) {
var optionsOrBeforeLayerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var sublayers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var options = {};
if (_typeof(optionsOrBeforeLayerName) !== 'object') {
options.beforeLayerName = optionsOrBeforeLayerName;
options.sublayers = sublayers;
} else {
options = optionsOrBeforeLayerName;
}
var params = LayerUtils.splitLayerUrlParam(resource);
ServiceLayerUtils.findLayers(params.type, params.url, [params], _this.props.mapCrs, function (id, layer) {
if (layer) {
if (sublayers === false) {
layer.sublayers = null;
}
_this.props.addLayer(layer, null, options);
}
});
});
/**
* Deprecated, use `window.qwc2.drawGeometry` instead.
*/
_defineProperty(_this, "drawScratch", function (geomType, message, drawMultiple, callback) {
var style = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
/* eslint-disable-next-line */
console.warn("window.qwc2.drawScratch is deprecated, use window.qwc2.drawGeometry instead");
_this.props.setCurrentTask("ScratchDrawing", null, null, {
geomType: geomType,
message: message,
drawMultiple: drawMultiple,
callback: callback,
style: style
});
});
/**
* Draw geometries, and return these as GeoJSON to the calling application.
*
* * `geomType`: `Point`, `LineString`, `Polygon`, `Circle` or `Box`.
* * `message`: A descriptive string to display in the tool taskbar.
* * `callback`: A `function(result, crs)`, the `result` being an array of GeoJSON features, and `crs` the projection of the feature coordinates.
* * `options`: Optional configuration:
* * `drawMultiple`: Whether to allow drawing multiple geometries (default: `false`).
* * `style`: A custom style object to use for the drawn features, in the same format as `DEFAULT_FEATURE_STYLE` in `qwc2/utils/FeatureStyles.js`.
* * `initialFeatures`: Array of initial geometries.
* * `snapping`: Whether snapping is available while drawing (default: `false`).
* * `snappingActive`: Whether snapping is initially active (default: `false`)
*/
_defineProperty(_this, "drawGeometry", function (geomType, message, callback) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
_this.props.setCurrentTask("ScratchDrawing", null, null, {
callback: callback,
geomType: geomType,
message: message,
drawMultiple: options.drawMultiple || false,
style: options.style,
snapping: options.snapping || false,
snappingActive: options.snappingActive || false,
initialFeatures: options.initialFeatures
});
});
/**
* Return the current application state.
*/
_defineProperty(_this, "getState", function () {
return _this.props.state;
});
return _this;
}
_inherits(API, _React$Component);
return _createClass(API, [{
key: "componentDidMount",
value: function componentDidMount() {
window.qwc2 = {
__customPlugins: {},
__attributeCalculators: {},
__identifyExportes: {}
};
// Auto-binded functions
for (var _i = 0, _Object$keys = Object.keys(this.props); _i < _Object$keys.length; _i++) {
var prop = _Object$keys[_i];
window.qwc2[prop] = this.props[prop];
}
// Additional exports
window.qwc2.LayerRole = LayerRole;
window.qwc2.addPlugin = this.addPlugin;
window.qwc2.removePlugin = this.removePlugin;
window.qwc2.addIdentifyAttributeCalculator = this.addIdentifyAttributeCalculator;
window.qwc2.removeIdentifyAttributeCalculator = this.removeIdentifyAttributeCalculator;
window.qwc2.addIdentifyExporter = this.addIdentifyExporter;
window.qwc2.removeIdentifyExporter = this.removeIdentifyExporter;
window.qwc2.addExternalLayer = this.addExternalLayer;
window.qwc2.drawScratch = this.drawScratch;
window.qwc2.drawGeometry = this.drawGeometry;
window.qwc2.getState = this.getState;
window.qwc2.ConfigUtils = ConfigUtils;
window.qwc2.CoordinatesUtils = CoordinatesUtils;
window.qwc2.EditingInterface = EditingInterface;
window.qwc2.EditingUtils = EditingUtils;
window.qwc2.LayerUtils = LayerUtils;
window.qwc2.LocaleUtils = LocaleUtils;
window.qwc2.MapUtils = MapUtils;
window.qwc2.PermaLinkUtils = PermaLinkUtils;
window.qwc2.SearchResultType = SearchResultType;
window.qwc2.VectorLayerUtils = VectorLayerUtils;
window.qwc2.libs = {};
window.qwc2.libs.axios = axios;
window.qwc2.libs.React = React;
window.qwc2.libs.ReactDOM = ReactDOM;
window.qwc2.libs.PropTypes = PropTypes;
window.qwc2.libs.connect = connect;
window.qwc2.libs.ol = ol;
window.qwc2.libs.url = url;
window.qwc2.libs.uuid = uuid;
window.qwc2.components = {};
window.qwc2.components.AppMenu = AppMenu;
window.qwc2.components.AttributeForm = AttributeForm;
window.qwc2.components.AttributeTableWidget = AttributeTableWidget;
window.qwc2.components.AutoEditForm = AutoEditForm;
window.qwc2.components.CoordinateDisplayer = CoordinateDisplayer;
window.qwc2.components.EditComboField = EditComboField;
window.qwc2.components.EditUploadField = EditUploadField;
window.qwc2.components.FullscreenSwitcher = FullscreenSwitcher;
window.qwc2.components.Icon = Icon;
window.qwc2.components.IdentifyViewer = IdentifyViewer;
window.qwc2.components.ImportLayer = ImportLayer;
window.qwc2.components.InputContainer = InputContainer;
window.qwc2.components.LayerInfoWindow = LayerInfoWindow;
window.qwc2.components.LinkFeatureForm = LinkFeatureForm;
window.qwc2.components.MapSelection = MapSelection;
window.qwc2.components.ModalDialog = ModalDialog;
window.qwc2.components.NumericInputWindow = NumericInputWindow;
window.qwc2.components.PickFeature = PickFeature;
window.qwc2.components.PluginsContainer = PluginsContainer;
window.qwc2.components.PopupMenu = PopupMenu;
window.qwc2.components.PrintSelection = PrintSelection;
window.qwc2.components.QtDesignerForm = QtDesignerForm;
window.qwc2.components.ResizeableWindow = ResizeableWindow;
window.qwc2.components.SearchBox = SearchBox;
window.qwc2.components.ServiceInfoWindow = ServiceInfoWindow;
window.qwc2.components.ShareLink = ShareLink;
window.qwc2.components.ShareQRCode = ShareQRCode;
window.qwc2.components.ShareSocials = ShareSocials;
window.qwc2.components.SideBar = SideBar;
window.qwc2.components.Spinner = Spinner;
window.qwc2.components.Swipeable = Swipeable;
window.qwc2.components.TaskBar = TaskBar;
window.qwc2.components.ThemeLayersListWindow = ThemeLayersListWindow;
window.qwc2.components.ThemeList = ThemeList;
window.qwc2.components.FixedTimeline = FixedTimeline;
window.qwc2.components.InfiniteTimeline = InfiniteTimeline;
window.qwc2.components.TimelineFeaturesSlider = TimelineFeaturesSlider;
window.qwc2.components.Toolbar = Toolbar;
window.qwc2.components.AccordeonWidget = AccordeonWidget;
window.qwc2.components.ButtonBar = ButtonBar;
window.qwc2.components.ColorButton = ColorButton;
window.qwc2.components.ComboBox = ComboBox;
window.qwc2.components.CopyButton = CopyButton;
window.qwc2.components.DateTimeInput = DateTimeInput;
window.qwc2.components.EditableSelect = EditableSelect;
window.qwc2.components.FileSelector = FileSelector;
window.qwc2.components.Input = Input;
window.qwc2.components.LayerCatalogWidget = LayerCatalogWidget;
window.qwc2.components.MenuButton = MenuButton;
window.qwc2.components.NavBar = NavBar;
window.qwc2.components.NumberInput = NumberInput;
window.qwc2.components.Image = Image;
window.qwc2.components.SearchWidget = SearchWidget;
window.qwc2.components.SuggestionInput = SuggestionInput;
window.qwc2.components.TextInput = TextInput;
window.qwc2.components.ToggleSwitch = ToggleSwitch;
window.qwc2.components.VectorLayerPicker = VectorLayerPicker;
window.dispatchEvent(new Event("QWC2ApiReady"));
}
}, {
key: "render",
value: function render() {
return null;
}
}]);
}(React.Component);
_defineProperty(API, "propTypes", {
addLayer: PropTypes.func,
mapCrs: PropTypes.string,
registerCustomPlugin: PropTypes.func,
setCurrentTask: PropTypes.func,
state: PropTypes.object,
unregisterCustomPlugin: PropTypes.func
});
function extractFunctions(obj) {
return Object.entries(obj).reduce(function (result, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
if (typeof value === "function") {
result[key] = value;
}
return result;
}, {});
}
export default connect(function (state) {
return {
mapCrs: state.map.projection,
state: state
};
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
registerCustomPlugin: registerCustomPlugin,
unregisterCustomPlugin: unregisterCustomPlugin
}, extractFunctions(displayActions)), extractFunctions(editingActions)), extractFunctions(layerActions)), extractFunctions(localeActions)), extractFunctions(locateActions)), extractFunctions(mapActions)), extractFunctions(taskActions)), extractFunctions(themeActions)), extractFunctions(windowsActions)))(API);