@webviz/subsurface-viewer 0.0.1-alpha.1 → 0.0.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +5 -2
- package/package.json +6 -3
- package/dist/DashSubsurfaceViewer.d.ts +0 -56
- package/dist/DashSubsurfaceViewer.js +0 -160
- package/dist/DashSubsurfaceViewer.js.map +0 -1
- package/src/DashSubsurfaceViewer.tsx +0 -270
- package/src/SubsurfaceViewer.stories.tsx +0 -449
- package/src/SubsurfaceViewer.test.tsx +0 -98
- package/src/SubsurfaceViewer.tsx +0 -356
- package/src/__snapshots__/SubsurfaceViewer.test.tsx.snap +0 -178
- package/src/assets/glTF/north_arrow/scene.bin +0 -0
- package/src/assets/glTF/north_arrow/scene.gltf +0 -315
- package/src/assets/glTF/north_arrow/textures/Arrow5_baseColor.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_metallicRoughness.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_normal.png +0 -0
- package/src/components/ColorLegend.test.tsx +0 -32
- package/src/components/ColorLegend.tsx +0 -80
- package/src/components/ColorLegends.test.tsx +0 -97
- package/src/components/ColorLegends.tsx +0 -46
- package/src/components/DistanceScale.stories.tsx +0 -28
- package/src/components/DistanceScale.test.tsx +0 -36
- package/src/components/DistanceScale.tsx +0 -84
- package/src/components/InfoCard.test.tsx +0 -110
- package/src/components/InfoCard.tsx +0 -263
- package/src/components/Map.test.tsx +0 -142
- package/src/components/Map.tsx +0 -1435
- package/src/components/StatusIndicator.test.tsx +0 -14
- package/src/components/StatusIndicator.tsx +0 -38
- package/src/components/ViewAnnotation.tsx +0 -16
- package/src/components/ViewFooter.test.tsx +0 -12
- package/src/components/ViewFooter.tsx +0 -30
- package/src/components/__snapshots__/ColorLegends.test.tsx.snap +0 -15
- package/src/components/__snapshots__/DistanceScale.test.tsx.snap +0 -33
- package/src/components/__snapshots__/InfoCard.test.tsx.snap +0 -561
- package/src/components/__snapshots__/Map.test.tsx.snap +0 -119
- package/src/components/__snapshots__/StatusIndicator.test.tsx.snap +0 -3
- package/src/components/__snapshots__/ViewFooter.test.tsx.snap +0 -7
- package/src/components/settings/DrawModeSelector.test.tsx +0 -45
- package/src/components/settings/DrawModeSelector.tsx +0 -58
- package/src/components/settings/DrawModeSelector_performance.test.tsx +0 -35
- package/src/components/settings/LayerProperty.test.tsx +0 -35
- package/src/components/settings/LayerProperty.tsx +0 -153
- package/src/components/settings/LayerProperty_performance.test.tsx +0 -39
- package/src/components/settings/LayerSettingsButton.test.tsx +0 -133
- package/src/components/settings/LayerSettingsButton.tsx +0 -95
- package/src/components/settings/LayersButton.test.tsx +0 -102
- package/src/components/settings/LayersButton.tsx +0 -97
- package/src/components/settings/NumericInput.test.tsx +0 -25
- package/src/components/settings/NumericInput.tsx +0 -67
- package/src/components/settings/Settings.tsx +0 -71
- package/src/components/settings/SliderInput.test.tsx +0 -28
- package/src/components/settings/SliderInput.tsx +0 -71
- package/src/components/settings/ToggleButton.test.tsx +0 -25
- package/src/components/settings/ToggleButton.tsx +0 -53
- package/src/components/settings/__snapshots__/DrawModeSelector.test.tsx.snap +0 -124
- package/src/components/settings/__snapshots__/LayerProperty.test.tsx.snap +0 -124
- package/src/components/settings/__snapshots__/LayerSettingsButton.test.tsx.snap +0 -36
- package/src/components/settings/__snapshots__/LayersButton.test.tsx.snap +0 -83
- package/src/components/settings/__snapshots__/NumericInput.test.tsx.snap +0 -123
- package/src/components/settings/__snapshots__/SliderInput.test.tsx.snap +0 -244
- package/src/components/settings/__snapshots__/ToggleButton.test.tsx.snap +0 -182
- package/src/custom.d.ts +0 -9
- package/src/index.ts +0 -5
- package/src/inputSchema/ColorTables.json +0 -51
- package/src/inputSchema/FaultPolygons.json +0 -80
- package/src/inputSchema/Grid.json +0 -39
- package/src/inputSchema/PieChart.json +0 -72
- package/src/inputSchema/WellLog.json +0 -126
- package/src/inputSchema/WellLogTemplate.json +0 -136
- package/src/inputSchema/WellLogs.json +0 -5
- package/src/inputSchema/Wells.json +0 -106
- package/src/inputSchema/schemaValidationUtil.tsx +0 -55
- package/src/inputSchema/validator.tsx +0 -72
- package/src/inputSchema/wellCompletions.json +0 -108
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.stories.tsx +0 -172
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.tsx +0 -136
- package/src/layers/axes/axes-fragment.glsl.ts +0 -15
- package/src/layers/axes/axesLayer.stories.tsx +0 -87
- package/src/layers/axes/axesLayer.ts +0 -692
- package/src/layers/axes/boxLayer.ts +0 -71
- package/src/layers/axes/grid-vertex.glsl.ts +0 -14
- package/src/layers/axes2d/axes2DLayer.stories.tsx +0 -150
- package/src/layers/axes2d/axes2DLayer.ts +0 -841
- package/src/layers/axes2d/font-atlas.png +0 -0
- package/src/layers/axes2d/label-fragment.glsl.js +0 -37
- package/src/layers/axes2d/label-vertex.glsl.js +0 -20
- package/src/layers/axes2d/line-fragment.glsl.js +0 -14
- package/src/layers/axes2d/line-vertex.glsl.js +0 -13
- package/src/layers/colormap/colormap.fs.glsl.ts +0 -42
- package/src/layers/colormap/colormapLayer.ts +0 -247
- package/src/layers/drawing/drawingLayer.tsx +0 -256
- package/src/layers/fault_polygons/faultPolygonsLayer.ts +0 -54
- package/src/layers/grid3d/fragment.fs.glsl.ts +0 -109
- package/src/layers/grid3d/fragment_lines.glsl.ts +0 -21
- package/src/layers/grid3d/grid3dLayer.stories.tsx +0 -172
- package/src/layers/grid3d/grid3dLayer.ts +0 -248
- package/src/layers/grid3d/privateLayer.ts +0 -292
- package/src/layers/grid3d/vertex.glsl.ts +0 -43
- package/src/layers/grid3d/vertex_lines.glsl.ts +0 -15
- package/src/layers/grid3d/webworker.ts +0 -173
- package/src/layers/hillshading2d/hillshading2d.fs.glsl.ts +0 -62
- package/src/layers/hillshading2d/hillshading2dLayer.ts +0 -172
- package/src/layers/index.ts +0 -35
- package/src/layers/intersection/intersectionView.stories.tsx +0 -294
- package/src/layers/intersection/unfoldedGeoJsonLayer.ts +0 -92
- package/src/layers/map/fragment.fs.glsl.ts +0 -127
- package/src/layers/map/fragment_lines.glsl.ts +0 -21
- package/src/layers/map/mapLayer.stories.tsx +0 -1369
- package/src/layers/map/mapLayer.ts +0 -470
- package/src/layers/map/privateMapLayer.ts +0 -317
- package/src/layers/map/vertex.glsl.ts +0 -45
- package/src/layers/map/vertex_lines.glsl.ts +0 -15
- package/src/layers/map/webworker.ts +0 -479
- package/src/layers/northarrow/northArrow.stories.tsx +0 -108
- package/src/layers/northarrow/northArrow3DLayer.ts +0 -204
- package/src/layers/northarrow/northarrow-fragment.glsl.js +0 -14
- package/src/layers/northarrow/northarrow-vertex.glsl.js +0 -13
- package/src/layers/piechart/fragment.glsl.js +0 -42
- package/src/layers/piechart/pieChartLayer.ts +0 -246
- package/src/layers/piechart/vertex.glsl.js +0 -42
- package/src/layers/points/pointsLayer.stories.tsx +0 -141
- package/src/layers/points/pointsLayer.ts +0 -143
- package/src/layers/polylines/polylinesLayer.stories.tsx +0 -144
- package/src/layers/polylines/polylinesLayer.ts +0 -263
- package/src/layers/selectable_geojson/selectableGeoJsonLayer.ts +0 -25
- package/src/layers/shader_modules/decoder.fs.glsl.ts +0 -41
- package/src/layers/shader_modules/decoder.ts +0 -46
- package/src/layers/shader_modules/index.ts +0 -1
- package/src/layers/terrain/map3DLayer.stories.tsx +0 -340
- package/src/layers/terrain/map3DLayer.ts +0 -556
- package/src/layers/terrain/terrainMapLayer.ts +0 -334
- package/src/layers/terrain/terrainmap.fs.glsl.ts +0 -134
- package/src/layers/triangle/fragment.fs.glsl.ts +0 -126
- package/src/layers/triangle/fragment_lines.glsl.ts +0 -21
- package/src/layers/triangle/privateTriangleLayer.ts +0 -203
- package/src/layers/triangle/test_data/surfacePoints.ts +0 -4344
- package/src/layers/triangle/test_data/surfaceTriangles.ts +0 -7392
- package/src/layers/triangle/triangleLayer.stories.tsx +0 -191
- package/src/layers/triangle/triangleLayer.ts +0 -273
- package/src/layers/triangle/vertex.glsl.ts +0 -35
- package/src/layers/triangle/vertex_lines.glsl.ts +0 -15
- package/src/layers/triangle/webworker.ts +0 -165
- package/src/layers/utils/glsl.d.ts +0 -4
- package/src/layers/utils/layerTools.ts +0 -182
- package/src/layers/utils/propertyMapTools.ts +0 -43
- package/src/layers/wells/utils/spline.ts +0 -318
- package/src/layers/wells/wellsLayer.stories.tsx +0 -625
- package/src/layers/wells/wellsLayer.ts +0 -1377
- package/src/redux/actions.ts +0 -8
- package/src/redux/reducer.ts +0 -43
- package/src/redux/store.ts +0 -15
- package/src/redux/types.ts +0 -114
- package/src/storybook/SubsurfaceViewer.stories.jsx +0 -644
- package/src/storybook/components/InfoCard.stories.jsx +0 -39
- package/src/storybook/components/colorLegends/ContinuousLegend.stories.jsx +0 -32
- package/src/storybook/components/colorLegends/DiscreteLegend.stories.jsx +0 -33
- package/src/storybook/components/colorLegends/IndividualScaleForMap.stories.jsx +0 -99
- package/src/storybook/components/colorLegends/SingleScaleForMap.stories.jsx +0 -120
- package/src/storybook/components/settings/LayerSettingsButton.stories.jsx +0 -34
- package/src/storybook/components/settings/NumericInput.stories.jsx +0 -17
- package/src/storybook/components/settings/ToggleButton.stories.jsx +0 -16
- package/src/storybook/schemaValidation/sampleData.js +0 -177
- package/src/storybook/schemaValidation/schemaValidation.stories.jsx +0 -91
- package/src/test/TestWrapper.tsx +0 -13
- package/src/utils/configuration.ts +0 -61
- package/src/utils/fit-bounds.js +0 -85
- package/src/utils/measurement.ts +0 -61
- package/src/utils/northArrow.ts +0 -4
- package/src/utils/specExtractor.ts +0 -36
- package/src/viewports/index.js +0 -1
- package/src/viewports/intersectionViewport.ts +0 -137
- package/src/views/index.js +0 -1
- package/src/views/intersectionView.ts +0 -38
- package/tsconfig.json +0 -7
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { layers } from "@equinor/eds-icons";
|
|
2
|
-
import { Icon } from "@equinor/eds-core-react";
|
|
3
|
-
import { render, screen, waitFor } from "@testing-library/react";
|
|
4
|
-
import "jest-styled-components";
|
|
5
|
-
import "@testing-library/jest-dom";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import userEvent from "@testing-library/user-event";
|
|
8
|
-
import { EmptyWrapper } from "../../test/TestWrapper";
|
|
9
|
-
import LayersButton from "./LayersButton";
|
|
10
|
-
|
|
11
|
-
import exampleData from "../../../../../demo/example-data/deckgl-map.json";
|
|
12
|
-
|
|
13
|
-
const testLayers: Record<string, unknown>[] = exampleData[0].layers;
|
|
14
|
-
|
|
15
|
-
describe("test 'layers' button", () => {
|
|
16
|
-
it("snapshot test", () => {
|
|
17
|
-
Icon.add({ layers });
|
|
18
|
-
const { container } = render(
|
|
19
|
-
EmptyWrapper({
|
|
20
|
-
children: (
|
|
21
|
-
<LayersButton
|
|
22
|
-
id={"layers-button-view_1"}
|
|
23
|
-
layers={testLayers}
|
|
24
|
-
/>
|
|
25
|
-
),
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
29
|
-
});
|
|
30
|
-
it("click to dispatch redux action", async () => {
|
|
31
|
-
Icon.add({ layers });
|
|
32
|
-
render(
|
|
33
|
-
EmptyWrapper({
|
|
34
|
-
children: (
|
|
35
|
-
<LayersButton
|
|
36
|
-
id={"layers-button-view_1"}
|
|
37
|
-
layers={testLayers}
|
|
38
|
-
/>
|
|
39
|
-
),
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
userEvent.click(screen.getByRole("button"));
|
|
43
|
-
expect(screen.getByRole("menu")).toBeInTheDocument();
|
|
44
|
-
});
|
|
45
|
-
it("should close menu when clicked on backdrop", async () => {
|
|
46
|
-
render(
|
|
47
|
-
EmptyWrapper({
|
|
48
|
-
children: (
|
|
49
|
-
<LayersButton
|
|
50
|
-
id={"layers-button-view_1"}
|
|
51
|
-
layers={testLayers}
|
|
52
|
-
/>
|
|
53
|
-
),
|
|
54
|
-
})
|
|
55
|
-
);
|
|
56
|
-
userEvent.click(screen.getByRole("button"));
|
|
57
|
-
const layers_menu = screen.getByRole("menu");
|
|
58
|
-
expect(layers_menu).toBeInTheDocument();
|
|
59
|
-
userEvent.click(document.body);
|
|
60
|
-
await waitFor(() => expect(layers_menu).not.toBeVisible());
|
|
61
|
-
});
|
|
62
|
-
it("should close menu when clicked twice on layers button", async () => {
|
|
63
|
-
render(
|
|
64
|
-
EmptyWrapper({
|
|
65
|
-
children: (
|
|
66
|
-
<LayersButton
|
|
67
|
-
id={"layers-button-view_1"}
|
|
68
|
-
layers={testLayers}
|
|
69
|
-
/>
|
|
70
|
-
),
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
userEvent.click(screen.getByRole("button"));
|
|
74
|
-
const layers_menu = screen.getByRole("menu");
|
|
75
|
-
expect(layers_menu).toBeInTheDocument();
|
|
76
|
-
userEvent.click(screen.getByRole("button"));
|
|
77
|
-
await waitFor(() => expect(layers_menu).not.toBeVisible());
|
|
78
|
-
});
|
|
79
|
-
it("test empty MapState/specbase", () => {
|
|
80
|
-
const { container } = render(
|
|
81
|
-
EmptyWrapper({
|
|
82
|
-
children: (
|
|
83
|
-
<LayersButton
|
|
84
|
-
id={"layers-button-view_1"}
|
|
85
|
-
layers={testLayers}
|
|
86
|
-
/>
|
|
87
|
-
),
|
|
88
|
-
})
|
|
89
|
-
);
|
|
90
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
91
|
-
});
|
|
92
|
-
it("test with no layers present", () => {
|
|
93
|
-
const { container } = render(
|
|
94
|
-
EmptyWrapper({
|
|
95
|
-
children: (
|
|
96
|
-
<LayersButton id={"layers-button-view_1"} layers={[]} />
|
|
97
|
-
),
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
101
|
-
});
|
|
102
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */ // remove when ready to fix these.
|
|
2
|
-
|
|
3
|
-
import { Icon, Menu, Tooltip } from "@equinor/eds-core-react";
|
|
4
|
-
import { styled } from "@mui/material/styles";
|
|
5
|
-
import { Fab } from "@mui/material";
|
|
6
|
-
import React, { ChangeEvent, useCallback } from "react";
|
|
7
|
-
import { useDispatch } from "react-redux";
|
|
8
|
-
import { updateLayerProp, updateVisibleLayers } from "../../redux/actions";
|
|
9
|
-
import ToggleButton from "./ToggleButton";
|
|
10
|
-
|
|
11
|
-
const PREFIX = "LayersButton";
|
|
12
|
-
|
|
13
|
-
const classes = {
|
|
14
|
-
root: `${PREFIX}-root`,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Root = styled("div")(() => ({
|
|
18
|
-
[`& .${classes.root}`]: {
|
|
19
|
-
flexDirection: "column",
|
|
20
|
-
display: "flex",
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
export interface LayersButtonProps {
|
|
25
|
-
id: string;
|
|
26
|
-
layers: Record<string, unknown>[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const LayersButton: React.FC<LayersButtonProps> = React.memo(
|
|
30
|
-
({ id, layers }: LayersButtonProps) => {
|
|
31
|
-
// Redux
|
|
32
|
-
const dispatch = useDispatch();
|
|
33
|
-
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(
|
|
34
|
-
null
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
// handlers
|
|
38
|
-
const handleClick = useCallback(
|
|
39
|
-
(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
40
|
-
// hack to disable click propagation on drawing layer
|
|
41
|
-
dispatch(updateLayerProp(["drawing-layer", "mode", "view"]));
|
|
42
|
-
|
|
43
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
44
|
-
},
|
|
45
|
-
[anchorEl]
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const handleClose = useCallback(() => {
|
|
49
|
-
setAnchorEl(null);
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
const updateChecked = useCallback(
|
|
53
|
-
(layer: string, checked: boolean) =>
|
|
54
|
-
dispatch(updateVisibleLayers([layer, checked])),
|
|
55
|
-
[dispatch]
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
if (!layers.length) return null;
|
|
59
|
-
return (
|
|
60
|
-
<Root id={id}>
|
|
61
|
-
<Fab id="layers-selector-button" onClick={handleClick}>
|
|
62
|
-
<Tooltip title="Layers">
|
|
63
|
-
<Icon color="currentColor" name="layers" />
|
|
64
|
-
</Tooltip>
|
|
65
|
-
</Fab>
|
|
66
|
-
<Menu
|
|
67
|
-
anchorEl={anchorEl}
|
|
68
|
-
aria-labelledby="layers-selector-button"
|
|
69
|
-
id="layers-selector"
|
|
70
|
-
onClose={handleClose}
|
|
71
|
-
placement="left"
|
|
72
|
-
open={Boolean(anchorEl)}
|
|
73
|
-
className={classes.root}
|
|
74
|
-
>
|
|
75
|
-
{(
|
|
76
|
-
layers.slice().reverse() as Record<string, unknown>[]
|
|
77
|
-
).map((layer) => (
|
|
78
|
-
<ToggleButton
|
|
79
|
-
label={layer["name"] as string}
|
|
80
|
-
checked={layer["visible"] as boolean}
|
|
81
|
-
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
82
|
-
updateChecked(
|
|
83
|
-
layer["id"] as string,
|
|
84
|
-
e.target.checked
|
|
85
|
-
);
|
|
86
|
-
}}
|
|
87
|
-
key={`layer-toggle-${layer["id"]}`}
|
|
88
|
-
/>
|
|
89
|
-
))}
|
|
90
|
-
</Menu>
|
|
91
|
-
</Root>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
LayersButton.displayName = "LayersButton";
|
|
97
|
-
export default LayersButton;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { render } from "@testing-library/react";
|
|
2
|
-
import "jest-styled-components";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import React, { ChangeEvent } from "react";
|
|
5
|
-
import { EmptyWrapper } from "../../test/TestWrapper";
|
|
6
|
-
import NumericInput from "./NumericInput";
|
|
7
|
-
|
|
8
|
-
describe("Test Numeric Input", () => {
|
|
9
|
-
it("snapshot test", () => {
|
|
10
|
-
const { container } = render(
|
|
11
|
-
EmptyWrapper({
|
|
12
|
-
children: (
|
|
13
|
-
<NumericInput
|
|
14
|
-
label="Trajectory thickness"
|
|
15
|
-
value={15}
|
|
16
|
-
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
17
|
-
e;
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
),
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { ChangeEvent } from "react";
|
|
2
|
-
import { Label, Input } from "@equinor/eds-core-react";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
/**
|
|
6
|
-
* Label for the component.
|
|
7
|
-
*/
|
|
8
|
-
label: string;
|
|
9
|
-
/**
|
|
10
|
-
* Initial state of the component.
|
|
11
|
-
*/
|
|
12
|
-
value: number;
|
|
13
|
-
|
|
14
|
-
min?: number;
|
|
15
|
-
max?: number;
|
|
16
|
-
step?: number;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Callback to update the state of the component.
|
|
20
|
-
*/
|
|
21
|
-
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const NumericInput: React.FC<Props> = React.memo(
|
|
25
|
-
({ label, value, min, max, step, onChange }: Props) => {
|
|
26
|
-
return (
|
|
27
|
-
<div
|
|
28
|
-
style={{
|
|
29
|
-
display: "flex",
|
|
30
|
-
justifyContent: "space-between",
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
33
|
-
<Label
|
|
34
|
-
label={label}
|
|
35
|
-
id={`${label}-input-label`}
|
|
36
|
-
style={{
|
|
37
|
-
paddingTop: 5,
|
|
38
|
-
paddingBottom: 5,
|
|
39
|
-
fontSize: 15,
|
|
40
|
-
}}
|
|
41
|
-
/>
|
|
42
|
-
<Input
|
|
43
|
-
id={`${label}-input`}
|
|
44
|
-
type={"number"}
|
|
45
|
-
value={value}
|
|
46
|
-
onChange={onChange}
|
|
47
|
-
min={min}
|
|
48
|
-
max={max}
|
|
49
|
-
step={step}
|
|
50
|
-
style={{
|
|
51
|
-
fontSize: 15,
|
|
52
|
-
textAlign: "right",
|
|
53
|
-
width: "3rem",
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
NumericInput.defaultProps = {
|
|
62
|
-
min: 0,
|
|
63
|
-
step: 1,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
NumericInput.displayName = "NumericInput";
|
|
67
|
-
export default NumericInput;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Icon } from "@equinor/eds-core-react";
|
|
2
|
-
import { styled } from "@mui/material/styles";
|
|
3
|
-
import { layers } from "@equinor/eds-icons";
|
|
4
|
-
import React, { useEffect, useState } from "react";
|
|
5
|
-
import { useSelector } from "react-redux";
|
|
6
|
-
import { MapState } from "../../redux/store";
|
|
7
|
-
import LayersButton from "./LayersButton";
|
|
8
|
-
import LayerSettingsButton from "./LayerSettingsButton";
|
|
9
|
-
import { getLayersInViewport } from "../../layers/utils/layerTools";
|
|
10
|
-
|
|
11
|
-
const PREFIX = "Settings";
|
|
12
|
-
|
|
13
|
-
const classes = {
|
|
14
|
-
root: `${PREFIX}-root`,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Root = styled("div")(({ theme }) => ({
|
|
18
|
-
[`&.${classes.root}`]: {
|
|
19
|
-
position: "absolute",
|
|
20
|
-
bottom: theme.spacing(4),
|
|
21
|
-
right: theme.spacing(2),
|
|
22
|
-
display: "flex",
|
|
23
|
-
flexDirection: "column",
|
|
24
|
-
alignItems: "center",
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
Icon.add({ layers }); // (this needs only be done once)
|
|
29
|
-
|
|
30
|
-
export interface SettingsProps {
|
|
31
|
-
viewportId?: string;
|
|
32
|
-
layerIds?: string[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Settings: React.FC<SettingsProps> = React.memo(
|
|
36
|
-
({ viewportId, layerIds }: SettingsProps) => {
|
|
37
|
-
const spec = useSelector((st: MapState) => st.spec);
|
|
38
|
-
const [layersInView, setLayersInView] = useState<
|
|
39
|
-
Record<string, unknown>[]
|
|
40
|
-
>([]);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const layers_in_viewport = getLayersInViewport(
|
|
43
|
-
spec["layers"] as Record<string, unknown>[],
|
|
44
|
-
layerIds
|
|
45
|
-
) as Record<string, unknown>[];
|
|
46
|
-
setLayersInView(layers_in_viewport);
|
|
47
|
-
}, [spec, layerIds]);
|
|
48
|
-
|
|
49
|
-
if (!layersInView?.length) return null;
|
|
50
|
-
return (
|
|
51
|
-
<Root className={classes.root}>
|
|
52
|
-
{layersInView.map(
|
|
53
|
-
(layer) =>
|
|
54
|
-
layer && (
|
|
55
|
-
<LayerSettingsButton
|
|
56
|
-
layer={layer}
|
|
57
|
-
key={`layer-settings-button-${layer["id"]}-${viewportId}`}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
)}
|
|
61
|
-
<LayersButton
|
|
62
|
-
id={`layers-button-${viewportId}`}
|
|
63
|
-
layers={layersInView}
|
|
64
|
-
/>
|
|
65
|
-
</Root>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
Settings.displayName = "Settings";
|
|
71
|
-
export default Settings;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { render } from "@testing-library/react";
|
|
2
|
-
import "jest-styled-components";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import React, { FormEvent } from "react";
|
|
5
|
-
import { EmptyWrapper } from "../../test/TestWrapper";
|
|
6
|
-
import SliderInput from "./SliderInput";
|
|
7
|
-
|
|
8
|
-
describe("Test Slider Input", () => {
|
|
9
|
-
it("snapshot test", () => {
|
|
10
|
-
const { container } = render(
|
|
11
|
-
EmptyWrapper({
|
|
12
|
-
children: (
|
|
13
|
-
<SliderInput
|
|
14
|
-
label="Opacity"
|
|
15
|
-
value={50}
|
|
16
|
-
min={0}
|
|
17
|
-
max={100}
|
|
18
|
-
step={2}
|
|
19
|
-
onChange={(e: FormEvent<HTMLDivElement>) => {
|
|
20
|
-
e;
|
|
21
|
-
}}
|
|
22
|
-
/>
|
|
23
|
-
),
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React, { FormEvent } from "react";
|
|
2
|
-
import { Label, Slider } from "@equinor/eds-core-react";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
/**
|
|
6
|
-
* Label for the component.
|
|
7
|
-
*/
|
|
8
|
-
label: string;
|
|
9
|
-
/**
|
|
10
|
-
* Initial state of the component.
|
|
11
|
-
*/
|
|
12
|
-
value: number;
|
|
13
|
-
/**
|
|
14
|
-
* Min value.
|
|
15
|
-
*/
|
|
16
|
-
min?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Max value.
|
|
19
|
-
*/
|
|
20
|
-
max?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Stepping interval.
|
|
23
|
-
*/
|
|
24
|
-
step?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Callback to update the state of the component.
|
|
27
|
-
*/
|
|
28
|
-
onChange: (e: FormEvent<HTMLDivElement>, value: number | number[]) => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const SliderInput: React.FC<Props> = React.memo(
|
|
32
|
-
({ label, value, min, max, step, onChange }: Props) => {
|
|
33
|
-
return (
|
|
34
|
-
<div
|
|
35
|
-
style={{
|
|
36
|
-
display: "flex",
|
|
37
|
-
justifyContent: "space-between",
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<Label
|
|
41
|
-
id={`${label}-slider-label`}
|
|
42
|
-
label={label}
|
|
43
|
-
style={{
|
|
44
|
-
paddingTop: 5,
|
|
45
|
-
fontSize: 15,
|
|
46
|
-
}}
|
|
47
|
-
/>
|
|
48
|
-
<Slider
|
|
49
|
-
ariaLabelledby={`${label}-slider-label`}
|
|
50
|
-
id={`${label}-slider`}
|
|
51
|
-
value={value * 100}
|
|
52
|
-
min={min}
|
|
53
|
-
max={max}
|
|
54
|
-
step={step}
|
|
55
|
-
minMaxDots={false}
|
|
56
|
-
minMaxValues={false}
|
|
57
|
-
onChange={onChange}
|
|
58
|
-
style={{
|
|
59
|
-
paddingTop: 5,
|
|
60
|
-
paddingRight: 10,
|
|
61
|
-
paddingBottom: 25,
|
|
62
|
-
width: "3rem",
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
SliderInput.displayName = "SliderInput";
|
|
71
|
-
export default SliderInput;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { render } from "@testing-library/react";
|
|
2
|
-
import "jest-styled-components";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import React, { ChangeEvent } from "react";
|
|
5
|
-
import { EmptyWrapper } from "../../test/TestWrapper";
|
|
6
|
-
import ToggleButton from "./ToggleButton";
|
|
7
|
-
|
|
8
|
-
describe("Test Toggle Input", () => {
|
|
9
|
-
it("snapshot test", () => {
|
|
10
|
-
const { container } = render(
|
|
11
|
-
EmptyWrapper({
|
|
12
|
-
children: (
|
|
13
|
-
<ToggleButton
|
|
14
|
-
label="Log curves"
|
|
15
|
-
checked={false}
|
|
16
|
-
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
17
|
-
e;
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
),
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React, { ChangeEvent } from "react";
|
|
2
|
-
import { Label, Switch } from "@equinor/eds-core-react";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
/**
|
|
6
|
-
* Label for the component.
|
|
7
|
-
*/
|
|
8
|
-
label: string;
|
|
9
|
-
/**
|
|
10
|
-
* Initial state of the component.
|
|
11
|
-
*/
|
|
12
|
-
checked: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Callback to update the state of the component.
|
|
15
|
-
*/
|
|
16
|
-
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const ToggleButton: React.FC<Props> = React.memo(
|
|
20
|
-
({ label, checked, onChange }: Props) => {
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
style={{
|
|
24
|
-
display: "flex",
|
|
25
|
-
justifyContent: "space-between",
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<Label
|
|
29
|
-
label={label}
|
|
30
|
-
id={`${label}-switch-label`}
|
|
31
|
-
style={{
|
|
32
|
-
paddingTop: 15,
|
|
33
|
-
fontSize: 15,
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
<Switch
|
|
37
|
-
id={`${label}-switch`}
|
|
38
|
-
aria-label={label}
|
|
39
|
-
label={""}
|
|
40
|
-
onChange={onChange}
|
|
41
|
-
checked={checked}
|
|
42
|
-
style={{
|
|
43
|
-
paddingRight: 10,
|
|
44
|
-
width: "3rem",
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
ToggleButton.displayName = "ToggleButton";
|
|
53
|
-
export default ToggleButton;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Test draw-mode menu snapshot test 1`] = `
|
|
4
|
-
.c1 {
|
|
5
|
-
display: -webkit-box;
|
|
6
|
-
display: -webkit-flex;
|
|
7
|
-
display: -ms-flexbox;
|
|
8
|
-
display: flex;
|
|
9
|
-
-webkit-box-pack: justify;
|
|
10
|
-
-webkit-justify-content: space-between;
|
|
11
|
-
-ms-flex-pack: justify;
|
|
12
|
-
justify-content: space-between;
|
|
13
|
-
position: relative;
|
|
14
|
-
margin: 0;
|
|
15
|
-
color: var(--eds_text__static_icons__tertiary,rgba(111,111,111,1));
|
|
16
|
-
font-family: Equinor;
|
|
17
|
-
font-size: 0.750rem;
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
line-height: 1.333em;
|
|
20
|
-
text-align: left;
|
|
21
|
-
margin-left: 8px;
|
|
22
|
-
margin-right: 8px;
|
|
23
|
-
color: var(--eds_text__static_icons__tertiary,rgba(111,111,111,1));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.c2 {
|
|
27
|
-
margin: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.c3 {
|
|
31
|
-
border: none;
|
|
32
|
-
border-radius: 0;
|
|
33
|
-
box-shadow: inset 0 -1px 0 0 var(--eds_text__static_icons__tertiary,rgba(111,111,111,1));
|
|
34
|
-
padding-left: 8px;
|
|
35
|
-
padding-top: 6px;
|
|
36
|
-
padding-right: 8px;
|
|
37
|
-
padding-bottom: 6px;
|
|
38
|
-
margin: 0;
|
|
39
|
-
color: var(--eds_text__static_icons__tertiary,rgba(111,111,111,1));
|
|
40
|
-
font-family: Equinor;
|
|
41
|
-
font-size: 1.000rem;
|
|
42
|
-
font-weight: 400;
|
|
43
|
-
line-height: 1.500em;
|
|
44
|
-
-webkit-letter-spacing: 0.025em;
|
|
45
|
-
-moz-letter-spacing: 0.025em;
|
|
46
|
-
-ms-letter-spacing: 0.025em;
|
|
47
|
-
letter-spacing: 0.025em;
|
|
48
|
-
text-align: left;
|
|
49
|
-
padding-right: calc(8px *2 + 24px);
|
|
50
|
-
display: block;
|
|
51
|
-
margin: 0;
|
|
52
|
-
-webkit-appearance: none;
|
|
53
|
-
-moz-appearance: none;
|
|
54
|
-
appearance: none;
|
|
55
|
-
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%236f6f6f' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E"), linear-gradient( to bottom, var(--eds_ui_background__light,rgba(247,247,247,1)) 0%, var(--eds_ui_background__light,rgba(247,247,247,1)) 100% );
|
|
56
|
-
background-repeat: no-repeat,repeat;
|
|
57
|
-
background-position: right 8px top 50%;
|
|
58
|
-
width: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.c3:active,
|
|
62
|
-
.c3:focus {
|
|
63
|
-
box-shadow: none;
|
|
64
|
-
outline: 2px solid var(--eds_interactive_primary__resting,rgba(0,112,121,1));
|
|
65
|
-
outline-offset: 0px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.c3:disabled {
|
|
69
|
-
color: var(--eds_interactive__disabled__text,rgba(190,190,190,1));
|
|
70
|
-
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23bebebe' d='M7 9.5l5 5 5-5H7z'/%3E%3C/svg%3E"), linear-gradient( to bottom, var(--eds_ui_background__light,rgba(247,247,247,1)) 0%, var(--eds_ui_background__light,rgba(247,247,247,1)) 100% );
|
|
71
|
-
cursor: not-allowed;
|
|
72
|
-
box-shadow: none;
|
|
73
|
-
outline: none;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.c3:disabled .arrow-icon {
|
|
77
|
-
fill: red;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.c3:disabled:focus,
|
|
81
|
-
.c3:disabled:active {
|
|
82
|
-
outline: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.c0 {
|
|
86
|
-
min-width: 100px;
|
|
87
|
-
width: 100%;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
<div
|
|
91
|
-
class="c0"
|
|
92
|
-
>
|
|
93
|
-
<label
|
|
94
|
-
class="c1"
|
|
95
|
-
for="drawing-layer-mode-selector"
|
|
96
|
-
>
|
|
97
|
-
<span
|
|
98
|
-
class="c2"
|
|
99
|
-
>
|
|
100
|
-
Draw mode
|
|
101
|
-
</span>
|
|
102
|
-
</label>
|
|
103
|
-
<select
|
|
104
|
-
class="c3"
|
|
105
|
-
id="drawing-layer-mode-selector"
|
|
106
|
-
>
|
|
107
|
-
<option>
|
|
108
|
-
View
|
|
109
|
-
</option>
|
|
110
|
-
<option>
|
|
111
|
-
Edit
|
|
112
|
-
</option>
|
|
113
|
-
<option>
|
|
114
|
-
Create point
|
|
115
|
-
</option>
|
|
116
|
-
<option>
|
|
117
|
-
Create polyline
|
|
118
|
-
</option>
|
|
119
|
-
<option>
|
|
120
|
-
Create polygon
|
|
121
|
-
</option>
|
|
122
|
-
</select>
|
|
123
|
-
</div>
|
|
124
|
-
`;
|