@hisptz/react-ui
Version:
A collection of reusable complex DHIS2 react ui components.
54 lines (51 loc) • 1.75 kB
JavaScript
import React, { forwardRef } from "react";
import MapArea from "./components/MapArea";
import { MapProvider } from "./components/MapProvider";
import "leaflet/dist/leaflet.css";
const Map = (_ref, ref) => {
var _pointLayer$enabled, _boundaryLayer$enable;
let {
orgUnitSelection,
pointLayer,
boundaryLayer,
thematicLayers,
earthEngineLayers,
periodSelection,
mapOptions,
key,
controls,
legends
} = _ref;
const sanitizedPointLayers = [{
type: "point",
id: "point",
enabled: (_pointLayer$enabled = pointLayer === null || pointLayer === void 0 ? void 0 : pointLayer.enabled) !== null && _pointLayer$enabled !== void 0 ? _pointLayer$enabled : false,
...pointLayer
}];
const sanitizedBoundaryLayers = [{
type: "overlay",
id: "boundary",
enabled: (_boundaryLayer$enable = boundaryLayer === null || boundaryLayer === void 0 ? void 0 : boundaryLayer.enabled) !== null && _boundaryLayer$enable !== void 0 ? _boundaryLayer$enable : false
}];
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MapProvider, {
periodSelection: periodSelection,
orgUnitSelection: orgUnitSelection
}, /*#__PURE__*/React.createElement(MapArea, {
layers: {
thematicLayers,
earthEngineLayers,
boundaryLayers: sanitizedBoundaryLayers,
pointLayers: sanitizedPointLayers
},
legends: legends,
controls: controls,
key: key,
ref: ref,
mapOptions: mapOptions
})));
};
export default /*#__PURE__*/forwardRef(Map);
export * from "./components/EarthEngineLayerConfiguration";
export * from "./components/ThematicLayerConfiguration";
export * from "./interfaces";
export * from "./constants/colors";