UNPKG

@webviz/subsurface-viewer

Version:

3D visualization component for subsurface reservoir data

38 lines 1.75 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React from "react"; import SubsurfaceViewer from "./SubsurfaceViewer"; import { View } from "@deck.gl/core"; import { ViewAnnotation } from "./components/ViewAnnotation"; function mapAnnotation(annotationContainers) { return React.Children.map(annotationContainers, (annotationContainer) => { let viewId = annotationContainer.props.id; if (React.isValidElement(annotationContainer) && (annotationContainer.type === ViewAnnotation || (annotationContainer.props instanceof Object && Object.keys(annotationContainer.props).includes("_dashprivate_layout")))) { viewId = annotationContainer.props._dashprivate_layout.props.id; } if (!viewId) { return null; } return ( // @ts-expect-error This is proven to work in JavaScript React.createElement(View, { key: viewId, id: viewId }, annotationContainer)); }); } const DashSubsurfaceViewer = (props) => { const { children } = props, rest = __rest(props, ["children"]); return (React.createElement(SubsurfaceViewer, Object.assign({}, rest), mapAnnotation(children))); }; export default DashSubsurfaceViewer; //# sourceMappingURL=DashSubsurfaceViewer.js.map