@webviz/well-log-viewer 2.0.0 → 2.1.0

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.
Files changed (42) hide show
  1. package/dist/SyncLogViewer.d.ts +14 -5
  2. package/dist/SyncLogViewer.js +47 -21
  3. package/dist/SyncLogViewer.js.map +1 -1
  4. package/dist/WellLogViewer.d.ts +5 -0
  5. package/dist/WellLogViewer.js +31 -20
  6. package/dist/WellLogViewer.js.map +1 -1
  7. package/dist/components/CallbackManager.d.ts +7 -3
  8. package/dist/components/CallbackManager.js +3 -2
  9. package/dist/components/CallbackManager.js.map +1 -1
  10. package/dist/components/DefaultSyncLogViewerLayout.js +5 -2
  11. package/dist/components/DefaultSyncLogViewerLayout.js.map +1 -1
  12. package/dist/components/LocalMenus.js +32 -111
  13. package/dist/components/LocalMenus.js.map +1 -1
  14. package/dist/components/PlotDialog.d.ts +3 -3
  15. package/dist/components/PlotDialog.js +12 -35
  16. package/dist/components/PlotDialog.js.map +1 -1
  17. package/dist/components/TrackDialog.js +2 -20
  18. package/dist/components/TrackDialog.js.map +1 -1
  19. package/dist/components/WellLogAxesPanel.d.ts +2 -2
  20. package/dist/components/WellLogAxesPanel.js +9 -45
  21. package/dist/components/WellLogAxesPanel.js.map +1 -1
  22. package/dist/components/WellLogTypes.d.ts +5 -1
  23. package/dist/components/WellLogView.d.ts +22 -8
  24. package/dist/components/WellLogView.js +34 -12
  25. package/dist/components/WellLogView.js.map +1 -1
  26. package/dist/components/WellLogViewWithScroller.d.ts +3 -0
  27. package/dist/utils/tracks.d.ts +4 -4
  28. package/dist/utils/tracks.js +198 -249
  29. package/dist/utils/tracks.js.map +1 -1
  30. package/dist/utils/well-log.d.ts +76 -0
  31. package/dist/utils/well-log.js +126 -0
  32. package/dist/utils/well-log.js.map +1 -0
  33. package/dist/utils/well-log.test.d.ts +1 -0
  34. package/dist/utils/well-log.test.js +232 -0
  35. package/dist/utils/well-log.test.js.map +1 -0
  36. package/package.json +2 -2
  37. package/dist/Storybook/helpers/MuiComponents.d.ts +0 -52
  38. package/dist/Storybook/helpers/MuiComponents.js +0 -140
  39. package/dist/Storybook/helpers/MuiComponents.js.map +0 -1
  40. package/dist/Storybook/helpers/MuiComponentsTabHelper.d.ts +0 -5
  41. package/dist/Storybook/helpers/MuiComponentsTabHelper.js +0 -89
  42. package/dist/Storybook/helpers/MuiComponentsTabHelper.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webviz/well-log-viewer",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "license": "MPL-2.0",
23
23
  "dependencies": {
24
24
  "@emerson-eps/color-tables": "^0.4.71",
25
- "@equinor/videx-wellog": "^0.10.5",
25
+ "@equinor/videx-wellog": "^0.10.6",
26
26
  "@webviz/wsc-common": "*",
27
27
  "convert-units": "^2.3.4",
28
28
  "d3": "^7.8.2"
@@ -1,52 +0,0 @@
1
- import React from "react";
2
- /**
3
- * Defines the content of a Tab title
4
- * @param label: the tab title
5
- * @param data-tut: optional flag for guided-tour usage (see UserAssistance component)
6
- * @param attention: optional flag to highlight this tab
7
- * @param decoration: optional element to add on the right of the tab panel
8
- * @param tooltip: optional tooltip
9
- */
10
- type TabTitle = {
11
- label: string;
12
- "data-tut"?: string;
13
- attention?: boolean;
14
- decoration?: JSX.Element;
15
- tooltip?: string;
16
- };
17
- /**
18
- * Defines a tab and its associated panel
19
- * @param title the tab title
20
- * @param panelContent defines the content of the tab panel
21
- * @param panelCustomClassName optional class name to control the tab panel style
22
- */
23
- export type TabItem = {
24
- title: TabTitle;
25
- panelContent: JSX.Element;
26
- panelCustomClassName?: string;
27
- };
28
- /**
29
- * Defines the properties of the Tabs component
30
- * @param name the collection name. It will be used to tag the tab and panel
31
- * components contained in the collection
32
- * @param tabs defines the list of tabs and their panel contained in this collection
33
- * @param width defines the width of a collection inside a group.
34
- * @param selectedTab option number stating the tab that will be selected on build,
35
- * default is 0.
36
- * @param handleSelectedTab function that is called when new tab is selected.
37
- * @param groupIndex is the index of the current collection inside a group.
38
- */
39
- type TabsProps = {
40
- name: string;
41
- tabs: TabItem[];
42
- width?: string | number;
43
- selectedTab?: number;
44
- handleSelectedTab?: (newSelectedTab: number) => void;
45
- };
46
- /**
47
- * A convenient component to build a collection of tabs and their associated panels
48
- * @param props the component properties
49
- * @returns the created component or null if the props tabs array is empty
50
- */
51
- export declare const Tabs: React.FC<TabsProps>;
52
- export default Tabs;
@@ -1,140 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { useEffect } from "react";
13
- import { Box,
14
- // eslint-disable-next-line no-restricted-imports
15
- Tab,
16
- // eslint-disable-next-line no-restricted-imports
17
- Tabs as MUITabs, Tooltip as MuiToolTip, Typography, tabsClasses, } from "@mui/material";
18
- /**
19
- * Remove spaces and set to lower case.
20
- * Note that we cannot use replaceAll function
21
- * below until we move to ES2021.
22
- */
23
- const buildId = (id) => {
24
- return id.replace(/ /g, "").toLowerCase();
25
- };
26
- const Tooltip = (props) => {
27
- var _a;
28
- const { children, disable = false } = props, rest = __rest(props, ["children", "disable"]);
29
- const childrenWrapper = disable ? React.createElement("span", null, children) : children;
30
- const ref = React.useRef();
31
- const childrenElement = React.cloneElement(childrenWrapper, { ref: ref });
32
- const [skipTooltip, setSkipTooltip] = React.useState(false);
33
- const [open, setOpen] = React.useState(false);
34
- React.useEffect(() => {
35
- // If a tooltip is placed on an element that could potentially overflow and is truncated with ellipsis,
36
- // we only show the tooltip in the case where the element is actually overflowing
37
- const textNode = ref.current;
38
- if (textNode &&
39
- textNode.clientWidth >= textNode.scrollWidth &&
40
- textNode.clientWidth > 0 &&
41
- textNode.innerText === props.title) {
42
- setSkipTooltip(true);
43
- }
44
- }, [props.title, ref, childrenElement]);
45
- const handleClose = React.useCallback(() => {
46
- setOpen(false);
47
- }, []);
48
- const handleOpen = React.useCallback(() => {
49
- setOpen(true);
50
- }, []);
51
- if (skipTooltip) {
52
- return childrenElement;
53
- }
54
- return (React.createElement(MuiToolTip, Object.assign({ placement: (_a = props.placement) !== null && _a !== void 0 ? _a : "top-start", enterDelay: 500, open: open && !disable, onClose: handleClose, onOpen: handleOpen, disableFocusListener: disable, disableHoverListener: disable, disableTouchListener: disable, arrow: true }, rest), childrenElement));
55
- };
56
- /**
57
- * Convenient component to gather and control a list of Tabs
58
- * @param props the component properties
59
- * @returns the created TabsBar component
60
- */
61
- const TabsBar = (props) => {
62
- if (props.titles.length === 0) {
63
- return null;
64
- }
65
- const tabs = props.titles.map((title, index) => {
66
- var _a;
67
- return (React.createElement(Tooltip, { key: title.label, title: (_a = title.tooltip) !== null && _a !== void 0 ? _a : "" },
68
- React.createElement(Tab, Object.assign({ label: React.createElement(Box, { "data-tut": title["data-tut"], id: `${props.name}-tablabel-${index}` },
69
- React.createElement(Typography, { variant: "body2" // TODO: should be changed to h5 when removing the (v1.5) theme
70
- , sx: {
71
- display: "flex",
72
- alignItems: "center",
73
- gap: (theme) => theme.spacing(0.5),
74
- } }, title.label),
75
- title.decoration) }, accessibilityProps(index, props.name), { wrapped: true }))));
76
- });
77
- return (React.createElement(MUITabs, { value: props.currentTab, onChange: props.onTabChange, indicatorColor: "primary", textColor: "primary", variant: "scrollable", scrollButtons: "auto", "aria-label": `${props.name}-tabs`, sx: {
78
- [`& .${tabsClasses.scrollButtons}`]: {
79
- "&.Mui-disabled": { opacity: 0.3 },
80
- },
81
- } }, tabs));
82
- };
83
- /**
84
- * Convenient function to accessibility properties of a controlled Tab
85
- * by a TabsBar component.
86
- * @param index the Tab index in the TabsBar component
87
- * @param name the Tab name
88
- * @returns the Tab accessibility properties
89
- */
90
- const accessibilityProps = (index, name) => {
91
- return {
92
- id: `${name}-tab-${index}`,
93
- "aria-controls": `${name}-tabpanel-${index}`,
94
- };
95
- };
96
- /**
97
- * Convenient component to define a Tab panel which visibility is controlled by
98
- * a prop. Mainly designed for an association with the TabsBar component that will
99
- * control the visibility of a list of Tab panels in function of the selected tab.
100
- * @param props the component properties
101
- * @returns the created TabPanel component
102
- */
103
- const TabPanel = (props) => {
104
- return (React.createElement("div", { role: "tabpanel", hidden: !props.display, id: `${buildId(props.name)}-tabpanel`, "data-testid": `${buildId(props.name)}-tabpanel`, "aria-labelledby": `${buildId(props.name)}-tab` }, props.children));
105
- };
106
- /**
107
- * Builds a tab panel
108
- * @param props: props of the panel to create.
109
- * @returns the created panel.
110
- */
111
- const BuildTabPanel = React.memo((props) => {
112
- return (React.createElement(TabPanel, { key: `${buildId(props.name)}-panel`, name: props.name, display: props.display, customClassName: props.customClassName }, props.children));
113
- });
114
- BuildTabPanel.displayName = "BuildTabPanel";
115
- /**
116
- * A convenient component to build a collection of tabs and their associated panels
117
- * @param props the component properties
118
- * @returns the created component or null if the props tabs array is empty
119
- */
120
- export const Tabs = (props) => {
121
- const [currentTab, setCurrentTab] = React.useState(props.selectedTab ? props.selectedTab : 0);
122
- useEffect(() => {
123
- setCurrentTab(props.selectedTab ? props.selectedTab : 0);
124
- }, [props]);
125
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
126
- const handleChange = (_e, newValue) => {
127
- setCurrentTab(newValue);
128
- if (props.handleSelectedTab) {
129
- props.handleSelectedTab(newValue);
130
- }
131
- };
132
- if (props.tabs.length === 0) {
133
- return null;
134
- }
135
- return (React.createElement(Box, { style: props.width ? { width: props.width } : undefined },
136
- React.createElement(TabsBar, { name: props.name, currentTab: currentTab, onTabChange: handleChange, titles: props.tabs.map((tab) => tab.title) }),
137
- props.tabs.map((tab, index) => (React.createElement(BuildTabPanel, { key: `${buildId(tab.title.label)}-panel`, display: index === currentTab, name: tab.title.label, customClassName: tab.panelCustomClassName }, tab.panelContent)))));
138
- };
139
- export default Tabs;
140
- //# sourceMappingURL=MuiComponents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MuiComponents.js","sourceRoot":"","sources":["../../../src/Storybook/helpers/MuiComponents.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EACH,GAAG;AACH,iDAAiD;AACjD,GAAG;AACH,iDAAiD;AACjD,IAAI,IAAI,OAAO,EACf,OAAO,IAAI,UAAU,EACrB,UAAU,EACV,WAAW,GACd,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,EAAU,EAAU,EAAE;IACnC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC9C,CAAC,CAAC;AAOF,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,EAAE;;IAC9C,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA9C,uBAAsC,CAAQ,CAAC;IACrD,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,kCAAO,QAAQ,CAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;IACrE,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;IAC3C,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAA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,KAAK,CAAC,KAAK,EACrB,eAAe,EAAE,GAAG,CAAC,oBAAoB,IAExC,GAAG,CAAC,YAAY,CACL,CACnB,CAAC,CACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- export interface ITabState {
3
- value: number;
4
- }
5
- export declare const tabDecorator: (Story: any) => React.JSX.Element;
@@ -1,89 +0,0 @@
1
- import React from "react";
2
- import { configureStore, createSlice } from "@reduxjs/toolkit";
3
- import { Provider, useDispatch, useSelector } from "react-redux";
4
- import { Grid } from "@mui/material";
5
- import { Tabs } from "./MuiComponents";
6
- const initialState = {
7
- value: 0,
8
- };
9
- const tabSlices = createSlice({
10
- name: "tab",
11
- // `createSlice` will infer the state type from the `initialState` argument
12
- initialState,
13
- reducers: {
14
- setTabValue: (state, action) => {
15
- state.value = action.payload;
16
- },
17
- },
18
- });
19
- const { setTabValue } = tabSlices.actions;
20
- const getTabValue = (state) => state.tab.value;
21
- const store = configureStore({
22
- reducer: {
23
- tab: tabSlices.reducer,
24
- },
25
- });
26
- const renderTestComponent = (renderer, ref, selectedTabIndex) => {
27
- // the test component is rendered on tab with index 1
28
- const testComponentTabIndex = 1;
29
- if (!ref.current && testComponentTabIndex !== selectedTabIndex) {
30
- return null;
31
- }
32
- else {
33
- return renderer(ref);
34
- }
35
- };
36
- const TestComponentArea = ({ children }) => {
37
- //---------------------------------------------------------------------------------
38
- // The Page rendering
39
- //---------------------------------------------------------------------------------
40
- const direction = "column";
41
- const ref = React.useRef(null);
42
- const tab = useSelector(getTabValue);
43
- const renderer = (ref) => {
44
- return React.createElement("div", { ref: ref },
45
- " ",
46
- children,
47
- " ");
48
- };
49
- const testComponent = renderTestComponent(renderer, ref, tab);
50
- return (React.createElement("div", null,
51
- React.createElement(Grid, { container: true, direction: direction, justifyContent: "flex-start" },
52
- React.createElement("div", null, "tab title"),
53
- testComponent),
54
- React.createElement("br", null)));
55
- };
56
- const AppPage = ({ children }) => {
57
- const renderTabs = () => {
58
- const tabItems = [];
59
- const renderEmptyTab = () => {
60
- return React.createElement("div", null, "empty tab");
61
- };
62
- const renderTestComponentTab = () => {
63
- return React.createElement(TestComponentArea, null, children);
64
- };
65
- const EmptyTab1 = {
66
- title: { label: "tab 1" },
67
- panelContent: renderEmptyTab(),
68
- };
69
- tabItems.push(EmptyTab1);
70
- const logViewTab = {
71
- title: { label: "tab 2" },
72
- panelContent: renderTestComponentTab(),
73
- };
74
- tabItems.push(logViewTab);
75
- const EmptyTab2 = {
76
- title: { label: "tab 3" },
77
- panelContent: renderEmptyTab(),
78
- };
79
- tabItems.push(EmptyTab2);
80
- return tabItems;
81
- };
82
- const dispatch = useDispatch();
83
- return (React.createElement(Tabs, { name: "blank", tabs: renderTabs(), selectedTab: 0, handleSelectedTab: (tab) => dispatch(setTabValue(tab)), width: "100%" }));
84
- };
85
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
- export const tabDecorator = (Story) => (React.createElement(Provider, { store: store },
87
- React.createElement(AppPage, null,
88
- React.createElement(Story, null))));
89
- //# sourceMappingURL=MuiComponentsTabHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MuiComponentsTabHelper.js","sourceRoot":"","sources":["../../../src/Storybook/helpers/MuiComponentsTabHelper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAMvC,MAAM,YAAY,GAAc;IAC5B,KAAK,EAAE,CAAC;CACX,CAAC;AAEF,MAAM,SAAS,GAAG,WAAW,CAAC;IAC1B,IAAI,EAAE,KAAK;IACX,2EA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