@webviz/well-log-viewer 2.8.4 → 2.9.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 (67) hide show
  1. package/dist/SyncLogViewer.d.ts +15 -2
  2. package/dist/SyncLogViewer.js +112 -77
  3. package/dist/SyncLogViewer.js.map +1 -1
  4. package/dist/WellLogViewer.d.ts +3 -0
  5. package/dist/WellLogViewer.js +39 -34
  6. package/dist/WellLogViewer.js.map +1 -1
  7. package/dist/components/CallbackManager.js +15 -2
  8. package/dist/components/CallbackManager.js.map +1 -1
  9. package/dist/components/CommonPropTypes.js +11 -2
  10. package/dist/components/CommonPropTypes.js.map +1 -1
  11. package/dist/components/DefaultSyncLogViewerLayout.js +9 -6
  12. package/dist/components/DefaultSyncLogViewerLayout.js.map +1 -1
  13. package/dist/components/DefaultWellLogViewerLayout.js +1 -2
  14. package/dist/components/DefaultWellLogViewerLayout.js.map +1 -1
  15. package/dist/components/InfoPanel.js +2 -2
  16. package/dist/components/InfoPanel.js.map +1 -1
  17. package/dist/components/LocalMenus.js +1 -2
  18. package/dist/components/LocalMenus.js.map +1 -1
  19. package/dist/components/PlotDialog.js +25 -22
  20. package/dist/components/PlotDialog.js.map +1 -1
  21. package/dist/components/ScaleSelector.js +1 -2
  22. package/dist/components/ScaleSelector.js.map +1 -1
  23. package/dist/components/Scroller.js +5 -2
  24. package/dist/components/Scroller.js.map +1 -1
  25. package/dist/components/TrackDialog.js +34 -17
  26. package/dist/components/TrackDialog.js.map +1 -1
  27. package/dist/components/WellLogAxesPanel.js +9 -7
  28. package/dist/components/WellLogAxesPanel.js.map +1 -1
  29. package/dist/components/WellLogInfoPanel.js +2 -0
  30. package/dist/components/WellLogInfoPanel.js.map +1 -1
  31. package/dist/components/WellLogScaleSelector.js +2 -2
  32. package/dist/components/WellLogScaleSelector.js.map +1 -1
  33. package/dist/components/WellLogSpacer.js +46 -54
  34. package/dist/components/WellLogSpacer.js.map +1 -1
  35. package/dist/components/WellLogView.d.ts +17 -2
  36. package/dist/components/WellLogView.js +144 -114
  37. package/dist/components/WellLogView.js.map +1 -1
  38. package/dist/components/WellLogViewWithScroller.d.ts +3 -50
  39. package/dist/components/WellLogViewWithScroller.js +14 -18
  40. package/dist/components/WellLogViewWithScroller.js.map +1 -1
  41. package/dist/components/WellLogZoomSlider.js +4 -5
  42. package/dist/components/WellLogZoomSlider.js.map +1 -1
  43. package/dist/components/ZoomSlider.js +1 -1
  44. package/dist/components/ZoomSlider.js.map +1 -1
  45. package/dist/utils/arrays.d.ts +8 -0
  46. package/dist/utils/arrays.js +24 -2
  47. package/dist/utils/arrays.js.map +1 -1
  48. package/dist/utils/axes.js +1 -1
  49. package/dist/utils/color-table.js +3 -4
  50. package/dist/utils/color-table.js.map +1 -1
  51. package/dist/utils/fill-info.js +3 -4
  52. package/dist/utils/fill-info.js.map +1 -1
  53. package/dist/utils/log-viewer.d.ts +1 -1
  54. package/dist/utils/log-viewer.js +5 -9
  55. package/dist/utils/log-viewer.js.map +1 -1
  56. package/dist/utils/plots.js +67 -79
  57. package/dist/utils/plots.js.map +1 -1
  58. package/dist/utils/template.js +9 -8
  59. package/dist/utils/template.js.map +1 -1
  60. package/dist/utils/trackFactory.js +8 -2
  61. package/dist/utils/trackFactory.js.map +1 -1
  62. package/dist/utils/tracks.js +35 -30
  63. package/dist/utils/tracks.js.map +1 -1
  64. package/dist/utils/well-log.d.ts +1 -1
  65. package/dist/utils/well-log.js +31 -16
  66. package/dist/utils/well-log.js.map +1 -1
  67. package/package.json +2 -2
@@ -104,9 +104,8 @@ function addReadoutOverlay(instance, parent) {
104
104
  const horizontal = parent.props.horizontal;
105
105
  const elm = instance.overlay.create("depth", {
106
106
  onClick: (event) => {
107
- var _a, _b;
108
- if (((_a = parent.props.options) === null || _a === void 0 ? void 0 : _a.hideCurrentPosition) ||
109
- ((_b = parent.props.options) === null || _b === void 0 ? void 0 : _b.hideSelectionInterval))
107
+ if (parent.props.options?.hideCurrentPosition ||
108
+ parent.props.options?.hideSelectionInterval)
110
109
  return;
111
110
  const { caller, x, y } = event;
112
111
  const value = caller.scale.invert(horizontal ? x : y);
@@ -174,7 +173,6 @@ function addPinnedValueOverlay(instance, parent) {
174
173
  const horizontal = parent.props.horizontal;
175
174
  const pinelm = instance.overlay.create("pinned", {
176
175
  onClick: (event) => {
177
- var _a;
178
176
  const v = horizontal ? event.x : event.y;
179
177
  const pinelm = event.target;
180
178
  if (pinelm) {
@@ -193,7 +191,7 @@ function addPinnedValueOverlay(instance, parent) {
193
191
  else {
194
192
  parent.selPinned = instance.scale.invert(v);
195
193
  if (parent.selCurrent === undefined &&
196
- !((_a = parent.props.options) === null || _a === void 0 ? void 0 : _a.hideCurrentPosition))
194
+ !parent.props.options?.hideCurrentPosition)
197
195
  parent.selCurrent = parent.selPinned;
198
196
  const rbelm = instance.overlay.elements["rubber-band"];
199
197
  if (rbelm && pinelm) {
@@ -279,7 +277,6 @@ function _getLogIndexByNames(curves, names) {
279
277
  return -1;
280
278
  }
281
279
  export function getWellPicks(wellLogView) {
282
- var _a;
283
280
  const wps = [];
284
281
  const wellpick = wellLogView.props.wellpick;
285
282
  if (!wellpick)
@@ -289,7 +286,7 @@ export function getWellPicks(wellLogView) {
289
286
  return wps;
290
287
  }
291
288
  const curves = wellpick.wellpick.curves;
292
- const mnemo = (_a = wellpick.md) !== null && _a !== void 0 ? _a : "MD";
289
+ const mnemo = wellpick.md ?? "MD";
293
290
  const md = _getLogIndexByNames(curves, [mnemo]);
294
291
  if (md < 0) {
295
292
  console.error("Depth log '" + mnemo + "' is not found for wellpicks");
@@ -310,8 +307,8 @@ export function getWellPicks(wellLogView) {
310
307
  if (horizon === null || horizon === undefined)
311
308
  continue;
312
309
  const vMD = d[md];
313
- const vPrimary = primaryAxis === "md" ? vMD : scaleInterpolator === null || scaleInterpolator === void 0 ? void 0 : scaleInterpolator.forward(vMD);
314
- const vSecondary = primaryAxis === "md" ? scaleInterpolator === null || scaleInterpolator === void 0 ? void 0 : scaleInterpolator.reverse(vMD) : vMD;
310
+ const vPrimary = primaryAxis === "md" ? vMD : scaleInterpolator?.forward(vMD);
311
+ const vSecondary = primaryAxis === "md" ? scaleInterpolator?.reverse(vMD) : vMD;
315
312
  const colormapFunction = wellpick.colorMapFunctions.find((colormapFunction) => colormapFunction.name === wellpick.colorMapFunctionName);
316
313
  const meta = getDiscreteMeta(wellpick.wellpick, wellpick.name);
317
314
  const { color } = getDiscreteColorAndName(d[c], colormapFunction, meta);
@@ -359,7 +356,6 @@ function posWellPickTitles(instance, parent) {
359
356
  }
360
357
  }
361
358
  function addWellPickOverlay(instance, parent) {
362
- var _a, _b;
363
359
  {
364
360
  /* clear old wellpicks */
365
361
  for (const elmName in instance.overlay.elements) {
@@ -376,12 +372,12 @@ function addWellPickOverlay(instance, parent) {
376
372
  return;
377
373
  //const primaryAxis = parent.props.primaryAxis;
378
374
  const horizontal = parent.props.horizontal;
379
- const wellpickColorFill = (_a = parent.props.options) === null || _a === void 0 ? void 0 : _a.wellpickColorFill;
375
+ const wellpickColorFill = parent.props.options?.wellpickColorFill;
380
376
  const patternsTable = parent.props.patternsTable;
381
377
  const patterns = parent.props.patterns;
382
- const wellpickPatternFill = patternsTable && patterns && ((_b = parent.props.options) === null || _b === void 0 ? void 0 : _b.wellpickPatternFill);
383
- const patternSize = patternsTable === null || patternsTable === void 0 ? void 0 : patternsTable.patternSize;
384
- const patternImages = patternsTable === null || patternsTable === void 0 ? void 0 : patternsTable.patternImages;
378
+ const wellpickPatternFill = patternsTable && patterns && parent.props.options?.wellpickPatternFill;
379
+ const patternSize = patternsTable?.patternSize;
380
+ const patternImages = patternsTable?.patternImages;
385
381
  for (const wp of wps) {
386
382
  const horizon = wp.horizon;
387
383
  const vPrimary = wp.vPrimary;
@@ -389,10 +385,10 @@ function addWellPickOverlay(instance, parent) {
389
385
  const color = wp.color;
390
386
  const txtPrimary = !Number.isFinite(vPrimary)
391
387
  ? ""
392
- : vPrimary === null || vPrimary === void 0 ? void 0 : vPrimary.toFixed(0);
388
+ : vPrimary?.toFixed(0);
393
389
  const txtSecondary = !Number.isFinite(vSecondary)
394
390
  ? ""
395
- : /*(primaryAxis === "md" ? "TVD:" : "MD:") +*/ vSecondary === null || vSecondary === void 0 ? void 0 : vSecondary.toFixed(0);
391
+ : /*(primaryAxis === "md" ? "TVD:" : "MD:") +*/ vSecondary?.toFixed(0);
396
392
  const elmName = "wp" + horizon;
397
393
  const pinelm = instance.overlay.create(elmName, {});
398
394
  const rgba = "rgba(" + color[0] + "," + color[1] + "," + color[2] + ",0.8)";
@@ -510,14 +506,17 @@ function initOverlays(instance, parent) {
510
506
  }
511
507
  function setTracksToController(logController, axes, wellLogSets, // JSON Log Format
512
508
  templateTracks, // JSON
513
- colorMapFunctions // JS code array or JSON file for pure color tables array without color functions elements
509
+ domain, visibleRange, colorMapFunctions // JS code array or JSON file for pure color tables array without color functions elements
514
510
  ) {
515
- const { tracks, minmaxPrimaryAxis: minmaxPrimaryAxis } = createWellLogTracks(wellLogSets, axes, templateTracks, colorMapFunctions);
511
+ const { tracks, minmaxPrimaryAxis } = createWellLogTracks(wellLogSets, axes, templateTracks, colorMapFunctions);
516
512
  logController.reset();
517
513
  const scaleInterpolator = setUpScaleInterpolator(logController,
518
514
  // ! We assume each set has the same index curves, so we just use the first one
519
515
  wellLogSets[0], axes);
520
- setContentBaseDomain(logController, minmaxPrimaryAxis);
516
+ // respect the provided domain, otherwise use the minmaxPrimaryAxis
517
+ setContentBaseDomain(logController, domain ?? minmaxPrimaryAxis);
518
+ // respect the provided visibleRange, otherwise use the base domain
519
+ zoomContentTo(logController, visibleRange ?? domain ?? minmaxPrimaryAxis);
521
520
  logController.setTracks(tracks);
522
521
  return scaleInterpolator;
523
522
  }
@@ -561,7 +560,6 @@ function addPlot(parent, wellLogView, track) {
561
560
  createRoot(el).render(React.createElement(PlotPropertiesDialog, { wellLogView: wellLogView, track: track, onOK: wellLogView.addTrackPlot.bind(wellLogView, track) }));
562
561
  }
563
562
  function fillPlotTemplate(templateTrack, plot) {
564
- var _a, _b, _c, _d;
565
563
  const options = plot.options;
566
564
  const optionsDifferential = plot.options; // DifferentialPlot - 2 series!
567
565
  const options1 = optionsDifferential.serie1;
@@ -570,7 +568,7 @@ function fillPlotTemplate(templateTrack, plot) {
570
568
  const legendDifferential = legend; // DifferentialPlot - 2 series!
571
569
  const legend1 = legendDifferential.serie1;
572
570
  const legend2 = legendDifferential.serie2;
573
- const scale = (templateTrack === null || templateTrack === void 0 ? void 0 : templateTrack.scale) !== options.scale ? options.scale : undefined;
571
+ const scale = templateTrack?.scale !== options.scale ? options.scale : undefined;
574
572
  return {
575
573
  style: undefined, // No style for this full Plot options.
576
574
  type: getPlotType(plot),
@@ -582,8 +580,8 @@ function fillPlotTemplate(templateTrack, plot) {
582
580
  inverseColor: options.inverseColor || "",
583
581
  fill: (options1 ? options1.fill : options.fill) || "",
584
582
  fill2: options2 ? options2.fill : "",
585
- colorMapFunctionName: (_b = (_a = options.colorMapFunction) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "",
586
- inverseColorMapFunctionName: (_d = (_c = options.inverseColorMapFunction) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "",
583
+ colorMapFunctionName: options.colorMapFunction?.name ?? "",
584
+ inverseColorMapFunctionName: options.inverseColorMapFunction?.name ?? "",
587
585
  colorScale: options.colorScale,
588
586
  inverseColorScale: options.inverseColorScale,
589
587
  };
@@ -615,8 +613,8 @@ export function getContentBaseScale(controller, horizontal) {
615
613
  const wellLogView = controller;
616
614
  const logController = wellLogView.logController;
617
615
  if (logController) {
618
- const overlay = logController === null || logController === void 0 ? void 0 : logController.overlay;
619
- const source = overlay === null || overlay === void 0 ? void 0 : overlay.elm.node();
616
+ const overlay = logController?.overlay;
617
+ const source = overlay?.elm.node();
620
618
  if (source) {
621
619
  const clientSize = horizontal
622
620
  ? source.clientWidth
@@ -648,7 +646,7 @@ export const argTypesWellLogViewProp = {
648
646
  description: "Prop containing track template data.",
649
647
  },
650
648
  colorMapFunctions: {
651
- description: "Prop containing color function tablefor discrete well logs and gradient plots.",
649
+ description: "Prop containing color function table for discrete well logs and gradient plots.",
652
650
  },
653
651
  wellpick: {
654
652
  description: "Well Picks data",
@@ -660,6 +658,9 @@ export const argTypesWellLogViewProp = {
660
658
  description: "Horizon to pattern index map",
661
659
  },
662
660
  domain: {
661
+ description: "Initial base domain range",
662
+ },
663
+ visibleRange: {
663
664
  description: "Initial visible range",
664
665
  },
665
666
  selection: {
@@ -688,7 +689,6 @@ export const argTypesWellLogViewProp = {
688
689
  // callbacks...
689
690
  };
690
691
  export function shouldUpdateWellLogView(props, nextProps) {
691
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
692
692
  // Props could contain some unknown object key:value so we should ignore they
693
693
  // so compare only known key:values
694
694
  if (props.horizontal !== nextProps.horizontal)
@@ -713,33 +713,48 @@ export function shouldUpdateWellLogView(props, nextProps) {
713
713
  return true;
714
714
  if (!isEqualRanges(props.domain, nextProps.domain))
715
715
  return true;
716
+ if (!isEqualRanges(props.visibleRange, nextProps.visibleRange))
717
+ return true;
716
718
  if (!isEqualRanges(props.selection, nextProps.selection))
717
719
  return true;
718
- if (((_a = props.options) === null || _a === void 0 ? void 0 : _a.hideTrackTitle) !== ((_b = nextProps.options) === null || _b === void 0 ? void 0 : _b.hideTrackTitle))
720
+ if (props.options?.hideTrackTitle !== nextProps.options?.hideTrackTitle)
719
721
  return true;
720
- if (((_c = props.options) === null || _c === void 0 ? void 0 : _c.hideTrackLegend) !== ((_d = nextProps.options) === null || _d === void 0 ? void 0 : _d.hideTrackLegend))
722
+ if (props.options?.hideTrackLegend !== nextProps.options?.hideTrackLegend)
721
723
  return true;
722
- if (((_e = props.options) === null || _e === void 0 ? void 0 : _e.maxVisibleTrackNum) !==
723
- ((_f = nextProps.options) === null || _f === void 0 ? void 0 : _f.maxVisibleTrackNum))
724
+ if (props.options?.maxVisibleTrackNum !==
725
+ nextProps.options?.maxVisibleTrackNum)
724
726
  return true;
725
- if (((_g = props.options) === null || _g === void 0 ? void 0 : _g.maxContentZoom) !== ((_h = nextProps.options) === null || _h === void 0 ? void 0 : _h.maxContentZoom))
727
+ if (props.options?.maxContentZoom !== nextProps.options?.maxContentZoom)
726
728
  return true;
727
- if (((_j = props.options) === null || _j === void 0 ? void 0 : _j.checkDatafileSchema) !==
728
- ((_k = nextProps.options) === null || _k === void 0 ? void 0 : _k.checkDatafileSchema))
729
+ if (props.options?.checkDatafileSchema !==
730
+ nextProps.options?.checkDatafileSchema)
729
731
  return true;
730
- if (((_l = props.options) === null || _l === void 0 ? void 0 : _l.wellpickColorFill) !==
731
- ((_m = nextProps.options) === null || _m === void 0 ? void 0 : _m.wellpickColorFill))
732
+ if (props.options?.wellpickColorFill !==
733
+ nextProps.options?.wellpickColorFill)
732
734
  return true;
733
- if (((_o = props.options) === null || _o === void 0 ? void 0 : _o.wellpickPatternFill) !==
734
- ((_p = nextProps.options) === null || _p === void 0 ? void 0 : _p.wellpickPatternFill))
735
+ if (props.options?.wellpickPatternFill !==
736
+ nextProps.options?.wellpickPatternFill)
735
737
  return true;
736
738
  // callbacks
737
739
  // ignore all?
738
740
  return false;
739
741
  }
740
742
  class WellLogView extends Component {
743
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
744
+ static propTypes;
745
+ wellLogSets;
746
+ container;
747
+ title;
748
+ resizeObserver;
749
+ logController;
750
+ selCurrent; // current mouse position
751
+ selPinned; // pinned position
752
+ selPersistent;
753
+ isDefZoom;
754
+ template;
755
+ scaleInterpolator;
756
+ _isMount;
741
757
  constructor(props) {
742
- var _a, _b;
743
758
  super(props);
744
759
  this.wellLogSets = getWellLogSetsFromProps(props);
745
760
  this.container = undefined;
@@ -775,12 +790,32 @@ class WellLogView extends Component {
775
790
  };
776
791
  this.onTrackMouseEvent = this.onTrackMouseEvent.bind(this);
777
792
  // set callback to component's caller
778
- (_b = (_a = this.props).onCreateController) === null || _b === void 0 ? void 0 : _b.call(_a, this);
793
+ this.props.onCreateController?.(this);
779
794
  this._isMount = false;
780
795
  }
781
796
  componentDidMount() {
782
797
  this._isMount = true;
783
- this.template = deepCopy(this.props.template); // save external template content to current
798
+ this.template = deepCopy(this.props.template ?? {
799
+ name: "Empty Template",
800
+ scale: {
801
+ primary: "md",
802
+ },
803
+ tracks: [
804
+ {
805
+ title: "",
806
+ plots: [
807
+ {
808
+ name: "Empty",
809
+ type: "line",
810
+ color: "black",
811
+ showLines: false,
812
+ showLabels: false,
813
+ },
814
+ ],
815
+ },
816
+ ],
817
+ styles: [],
818
+ }); // save external template content to current
784
819
  if (!this.logController) {
785
820
  this.createLogViewer();
786
821
  this.setTracks(true);
@@ -799,23 +834,22 @@ class WellLogView extends Component {
799
834
  return false;
800
835
  }
801
836
  componentDidUpdate(prevProps, prevState) {
802
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
803
837
  // Typical usage (don't forget to compare props):
804
838
  if (this.props.onCreateController !== prevProps.onCreateController) {
805
839
  // update callback to component's caller
806
- (_b = (_a = this.props).onCreateController) === null || _b === void 0 ? void 0 : _b.call(_a, this);
840
+ this.props.onCreateController?.(this);
807
841
  }
808
842
  let selectedTrackIndices = []; // Indices to restore
809
843
  let selection = undefined; // content selection to restore
810
844
  let shouldSetTracks = false;
811
845
  let checkSchema = false;
812
846
  if (this.props.horizontal !== prevProps.horizontal ||
813
- ((_c = this.props.options) === null || _c === void 0 ? void 0 : _c.hideTrackTitle) !==
814
- ((_d = prevProps.options) === null || _d === void 0 ? void 0 : _d.hideTrackTitle) ||
815
- ((_e = this.props.options) === null || _e === void 0 ? void 0 : _e.hideTrackLegend) !==
816
- ((_f = prevProps.options) === null || _f === void 0 ? void 0 : _f.hideTrackLegend) ||
817
- ((_g = this.props.options) === null || _g === void 0 ? void 0 : _g.maxContentZoom) !==
818
- ((_h = prevProps.options) === null || _h === void 0 ? void 0 : _h.maxContentZoom)) {
847
+ this.props.options?.hideTrackTitle !==
848
+ prevProps.options?.hideTrackTitle ||
849
+ this.props.options?.hideTrackLegend !==
850
+ prevProps.options?.hideTrackLegend ||
851
+ this.props.options?.maxContentZoom !==
852
+ prevProps.options?.maxContentZoom) {
819
853
  selection = this.getContentSelection();
820
854
  selectedTrackIndices = this.getSelectedTrackIndices();
821
855
  this.createLogViewer();
@@ -823,8 +857,8 @@ class WellLogView extends Component {
823
857
  }
824
858
  if (this.props.welllog !== prevProps.welllog ||
825
859
  this.props.wellLogSets !== prevProps.wellLogSets ||
826
- ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.checkDatafileSchema) !==
827
- ((_k = prevProps.options) === null || _k === void 0 ? void 0 : _k.checkDatafileSchema)) {
860
+ this.props.options?.checkDatafileSchema !==
861
+ prevProps.options?.checkDatafileSchema) {
828
862
  selection = this.props.selection;
829
863
  selectedTrackIndices = this.getSelectedTrackIndices();
830
864
  shouldSetTracks = true;
@@ -853,10 +887,10 @@ class WellLogView extends Component {
853
887
  shouldSetTracks = true; //??
854
888
  }
855
889
  if (this.props.wellpick !== prevProps.wellpick ||
856
- ((_l = this.props.options) === null || _l === void 0 ? void 0 : _l.wellpickPatternFill) !==
857
- ((_m = prevProps.options) === null || _m === void 0 ? void 0 : _m.wellpickPatternFill) ||
858
- ((_o = this.props.options) === null || _o === void 0 ? void 0 : _o.wellpickColorFill) !==
859
- ((_p = prevProps.options) === null || _p === void 0 ? void 0 : _p.wellpickColorFill)) {
890
+ this.props.options?.wellpickPatternFill !==
891
+ prevProps.options?.wellpickPatternFill ||
892
+ this.props.options?.wellpickColorFill !==
893
+ prevProps.options?.wellpickColorFill) {
860
894
  if (this.logController) {
861
895
  addWellPickOverlay(this.logController, this);
862
896
  this.showSelection();
@@ -870,8 +904,8 @@ class WellLogView extends Component {
870
904
  this.selectContent(selection);
871
905
  }
872
906
  else if (this.state.scrollTrackPos !== prevState.scrollTrackPos ||
873
- ((_q = this.props.options) === null || _q === void 0 ? void 0 : _q.maxVisibleTrackNum) !==
874
- ((_r = prevProps.options) === null || _r === void 0 ? void 0 : _r.maxVisibleTrackNum)) {
907
+ this.props.options?.maxVisibleTrackNum !==
908
+ prevProps.options?.maxVisibleTrackNum) {
875
909
  this.onTrackScroll();
876
910
  this.onTrackSelection();
877
911
  this.updateInfo();
@@ -880,7 +914,13 @@ class WellLogView extends Component {
880
914
  (!prevProps.domain ||
881
915
  this.props.domain[0] !== prevProps.domain[0] ||
882
916
  this.props.domain[1] !== prevProps.domain[1])) {
883
- this.setControllerZoom();
917
+ this.setContentBaseDomain(this.props.domain);
918
+ }
919
+ if (this.props.visibleRange &&
920
+ (!prevProps.visibleRange ||
921
+ this.props.visibleRange[0] !== prevProps.visibleRange[0] ||
922
+ this.props.visibleRange[1] !== prevProps.visibleRange[1])) {
923
+ this.zoomContentTo(this.props.visibleRange);
884
924
  }
885
925
  if (this.props.selection &&
886
926
  (!prevProps.selection ||
@@ -890,7 +930,6 @@ class WellLogView extends Component {
890
930
  }
891
931
  }
892
932
  createLogViewer() {
893
- var _a, _b, _c;
894
933
  this.selPersistent = undefined;
895
934
  if (this.logController) {
896
935
  // remove old LogViewer
@@ -903,9 +942,9 @@ class WellLogView extends Component {
903
942
  // create new LogViewer
904
943
  this.logController = new LogViewer({
905
944
  horizontal: this.props.horizontal,
906
- showTitles: !((_a = this.props.options) === null || _a === void 0 ? void 0 : _a.hideTrackTitle),
907
- showLegend: !((_b = this.props.options) === null || _b === void 0 ? void 0 : _b.hideTrackLegend),
908
- maxZoom: (_c = this.props.options) === null || _c === void 0 ? void 0 : _c.maxContentZoom,
945
+ showTitles: !this.props.options?.hideTrackTitle,
946
+ showLegend: !this.props.options?.hideTrackLegend,
947
+ maxZoom: this.props.options?.maxContentZoom,
909
948
  onTrackEnter: (elm, track) => addTrackMouseEventHandlers(elm, track, this.onTrackMouseEvent),
910
949
  });
911
950
  this.logController.init(this.container);
@@ -933,13 +972,12 @@ class WellLogView extends Component {
933
972
  };
934
973
  }
935
974
  setTracks(checkSchema) {
936
- var _a;
937
975
  this.selCurrent = this.selPinned = undefined; // clear old selection (primary scale could be changed)
938
976
  if (checkSchema) {
939
977
  //check against the json schema
940
978
  try {
941
979
  validateSchema(this.template, "WellLogTemplate");
942
- if ((_a = this.props.options) === null || _a === void 0 ? void 0 : _a.checkDatafileSchema) {
980
+ if (this.props.options?.checkDatafileSchema) {
943
981
  this.wellLogSets.forEach((wellLogSet) => validateSchema(wellLogSet, "WellLog"));
944
982
  }
945
983
  }
@@ -949,7 +987,7 @@ class WellLogView extends Component {
949
987
  }
950
988
  if (this.logController) {
951
989
  const axes = this.getAxesInfo();
952
- this.scaleInterpolator = setTracksToController(this.logController, axes, this.wellLogSets, this.getStyledTemplate().tracks, this.props.colorMapFunctions);
990
+ this.scaleInterpolator = setTracksToController(this.logController, axes, this.wellLogSets, this.getStyledTemplate().tracks, this.props.domain, this.props.visibleRange, this.props.colorMapFunctions);
953
991
  addWellPickOverlay(this.logController, this);
954
992
  this._updateWellLogTitle();
955
993
  }
@@ -961,40 +999,39 @@ class WellLogView extends Component {
961
999
  this.updateInfo(); // Clear old track information
962
1000
  }
963
1001
  findTrackById(trackId) {
964
- var _a;
965
- return (_a = this.logController) === null || _a === void 0 ? void 0 : _a.tracks.find(function (track) {
1002
+ return this.logController?.tracks.find(function (track) {
966
1003
  return track.id === trackId;
967
1004
  });
968
1005
  }
969
1006
  setControllerZoom() {
970
- if (this.props.domain)
971
- this.zoomContentTo(this.props.domain);
1007
+ if (this.props.visibleRange)
1008
+ this.zoomContentTo(this.props.visibleRange);
972
1009
  }
973
1010
  setControllerSelection() {
974
1011
  if (this.props.selection)
975
1012
  this.selectContent(this.props.selection);
976
1013
  }
977
1014
  setControllerDefaultZoom() {
978
- if (this.props.domain)
979
- this.zoomContentTo(this.props.domain);
980
- else
981
- this.zoomContentTo(this.getContentBaseDomain());
982
- this.isDefZoom = true;
1015
+ const visibleRange = this.props.visibleRange ??
1016
+ this.props.domain ??
1017
+ this.getContentBaseDomain();
1018
+ if (visibleRange) {
1019
+ this.zoomContentTo(visibleRange);
1020
+ this.isDefZoom = true;
1021
+ }
983
1022
  }
984
1023
  /**
985
1024
  Display current state of track scrolling
986
1025
  */
987
1026
  onTrackScroll() {
988
- var _a, _b;
989
1027
  const iFrom = this.getTrackScrollPos();
990
1028
  const iTo = iFrom + this._maxVisibleTrackNum();
991
1029
  if (this.logController)
992
1030
  scrollTracksTo(this.logController, iFrom, iTo);
993
- (_b = (_a = this.props).onTrackScroll) === null || _b === void 0 ? void 0 : _b.call(_a);
1031
+ this.props.onTrackScroll?.();
994
1032
  }
995
1033
  onTrackSelection() {
996
- var _a, _b;
997
- (_b = (_a = this.props).onTrackSelection) === null || _b === void 0 ? void 0 : _b.call(_a);
1034
+ this.props.onTrackSelection?.();
998
1035
  }
999
1036
  setInfo(x = Number.NaN) {
1000
1037
  if (!this.props.onInfo)
@@ -1008,28 +1045,23 @@ class WellLogView extends Component {
1008
1045
  this.props.onInfo(x, this.logController, iFrom, iTo);
1009
1046
  }
1010
1047
  onContentRescale() {
1011
- var _a, _b;
1012
1048
  this.showSelection();
1013
- (_b = (_a = this.props).onContentRescale) === null || _b === void 0 ? void 0 : _b.call(_a);
1049
+ this.props.onContentRescale?.();
1014
1050
  }
1015
1051
  onContentSelection() {
1016
- var _a, _b;
1017
1052
  this.showSelection();
1018
- (_b = (_a = this.props).onContentSelection) === null || _b === void 0 ? void 0 : _b.call(_a);
1053
+ this.props.onContentSelection?.();
1019
1054
  }
1020
1055
  onTrackMouseEvent(ev) {
1021
- var _a, _b;
1022
- (_b = (_a = this.props).onTrackMouseEvent) === null || _b === void 0 ? void 0 : _b.call(_a, this, ev);
1056
+ this.props.onTrackMouseEvent?.(this, ev);
1023
1057
  }
1024
1058
  onTrackMouseLeaveEvent() {
1025
- var _a, _b;
1026
- (_b = (_a = this.props).onTrackMouseLeaveEvent) === null || _b === void 0 ? void 0 : _b.call(_a);
1059
+ this.props.onTrackMouseLeaveEvent?.();
1027
1060
  }
1028
1061
  onTemplateChanged(noEmit) {
1029
- var _a, _b;
1030
1062
  this.updateInfo();
1031
1063
  if (!noEmit)
1032
- (_b = (_a = this.props).onTemplateChanged) === null || _b === void 0 ? void 0 : _b.call(_a);
1064
+ this.props.onTemplateChanged?.();
1033
1065
  }
1034
1066
  // content
1035
1067
  zoomContentTo(domain) {
@@ -1052,12 +1084,11 @@ class WellLogView extends Component {
1052
1084
  return zoomContent(this.logController, zoom);
1053
1085
  }
1054
1086
  showSelection() {
1055
- var _a, _b;
1056
1087
  if (!this.logController)
1057
1088
  return;
1058
- if ((_a = this.props.options) === null || _a === void 0 ? void 0 : _a.hideCurrentPosition)
1089
+ if (this.props.options?.hideCurrentPosition)
1059
1090
  this.selCurrent = undefined;
1060
- if ((_b = this.props.options) === null || _b === void 0 ? void 0 : _b.hideSelectionInterval)
1091
+ if (this.props.options?.hideSelectionInterval)
1061
1092
  this.selPinned = undefined;
1062
1093
  const horizontal = this.props.horizontal;
1063
1094
  const elements = this.logController.overlay.elements;
@@ -1089,7 +1120,7 @@ class WellLogView extends Component {
1089
1120
  const pinelm1 = elements[elmName1];
1090
1121
  if (pinelm1) {
1091
1122
  const wp2 = wps[i + 1];
1092
- const vPrimary2 = wp2 === null || wp2 === void 0 ? void 0 : wp2.vPrimary;
1123
+ const vPrimary2 = wp2?.vPrimary;
1093
1124
  fillWellPicks(pinelm1, vPrimary, vPrimary2, horizontal, this.logController);
1094
1125
  }
1095
1126
  }
@@ -1159,9 +1190,8 @@ class WellLogView extends Component {
1159
1190
  return newPos;
1160
1191
  }
1161
1192
  _maxVisibleTrackNum() {
1162
- var _a, _b;
1163
- if ((_a = this.props.options) === null || _a === void 0 ? void 0 : _a.maxVisibleTrackNum)
1164
- return (_b = this.props.options) === null || _b === void 0 ? void 0 : _b.maxVisibleTrackNum;
1193
+ if (this.props.options?.maxVisibleTrackNum)
1194
+ return this.props.options?.maxVisibleTrackNum;
1165
1195
  return this.props.horizontal ? 3 : 5 /*some default value*/;
1166
1196
  }
1167
1197
  _forceUpdateTitleTooltips() {
@@ -1175,9 +1205,8 @@ class WellLogView extends Component {
1175
1205
  }
1176
1206
  }
1177
1207
  _updateWellLogTitle() {
1178
- var _a, _b;
1179
1208
  if (this.title && this.props.viewTitle === true) {
1180
- this.title.textContent = (_b = (_a = this.wellLogSets[0]) === null || _a === void 0 ? void 0 : _a.header.well) !== null && _b !== void 0 ? _b : null;
1209
+ this.title.textContent = this.wellLogSets[0]?.header.well ?? null;
1181
1210
  }
1182
1211
  }
1183
1212
  scrollTrackBy(delta) {
@@ -1224,8 +1253,7 @@ class WellLogView extends Component {
1224
1253
  * @deprecated Use getWellLogSets instead
1225
1254
  */
1226
1255
  getWellLog() {
1227
- var _a;
1228
- return (_a = this.props.wellLogSets) !== null && _a !== void 0 ? _a : this.props.welllog;
1256
+ return this.props.wellLogSets ?? this.props.welllog;
1229
1257
  }
1230
1258
  getWellLogSets() {
1231
1259
  if (this.props.wellLogSets)
@@ -1240,7 +1268,11 @@ class WellLogView extends Component {
1240
1268
  return this.template;
1241
1269
  }
1242
1270
  getStyledTemplate() {
1243
- return Object.assign(Object.assign({}, this.template), { tracks: getStyledTemplateTracks(this.template), styles: [] });
1271
+ return {
1272
+ ...this.template,
1273
+ tracks: getStyledTemplateTracks(this.template),
1274
+ styles: [],
1275
+ };
1244
1276
  }
1245
1277
  setTemplate(template, noEmit) {
1246
1278
  const tNew = JSON.stringify(template);
@@ -1253,7 +1285,6 @@ class WellLogView extends Component {
1253
1285
  }
1254
1286
  }
1255
1287
  _recomputeTemplateFromController() {
1256
- var _a;
1257
1288
  const template = this.template;
1258
1289
  const tracks = [];
1259
1290
  if (this.logController) {
@@ -1270,7 +1301,7 @@ class WellLogView extends Component {
1270
1301
  name: template.name,
1271
1302
  scale: {
1272
1303
  primary: this.props.primaryAxis || "" /* no scale track */,
1273
- allowSecondary: ((_a = template.scale) === null || _a === void 0 ? void 0 : _a.allowSecondary) && axes.length > 1,
1304
+ allowSecondary: template.scale?.allowSecondary && axes.length > 1,
1274
1305
  },
1275
1306
  tracks: tracks,
1276
1307
  styles: template.styles,
@@ -1279,7 +1310,6 @@ class WellLogView extends Component {
1279
1310
  // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
1280
1311
  // Track management -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
1281
1312
  _addTrack(clickedTrack, templateTrack) {
1282
- var _a;
1283
1313
  if (!this.logController)
1284
1314
  return console.warn("Log controller not initialized");
1285
1315
  // User's track might be empty, but we should show it regardless
@@ -1287,7 +1317,7 @@ class WellLogView extends Component {
1287
1317
  const iClickedTrack = getTrackIndex(this.logController, clickedTrack);
1288
1318
  // Always add the new track to the right of the one that was clicked
1289
1319
  const iNewTrack = iClickedTrack + 1;
1290
- const newTrack = createNewViewTrack(this.logController, templateTrack, iNewTrack, this.getAxesInfo(), (_a = this.getWellLogSets()) !== null && _a !== void 0 ? _a : []);
1320
+ const newTrack = createNewViewTrack(this.logController, templateTrack, iNewTrack, this.getAxesInfo(), this.getWellLogSets() ?? []);
1291
1321
  if (!newTrack)
1292
1322
  return;
1293
1323
  this._recomputeTemplateFromController();
@@ -1297,13 +1327,12 @@ class WellLogView extends Component {
1297
1327
  this.onTrackScroll();
1298
1328
  }
1299
1329
  _editTrack(track, newTemplateTrack) {
1300
- var _a, _b, _c;
1301
1330
  if (!this.logController)
1302
1331
  return console.warn("Log controller not initialized");
1303
- const oldTitle = (_a = track.options.label) !== null && _a !== void 0 ? _a : "";
1304
- const newTitle = (_b = newTemplateTrack.title) !== null && _b !== void 0 ? _b : "";
1332
+ const oldTitle = track.options.label ?? "";
1333
+ const newTitle = newTemplateTrack.title ?? "";
1305
1334
  const titleChanged = !oldTitle.localeCompare(newTitle);
1306
- editViewTrack(this.logController, track, newTemplateTrack, this.getAxesInfo(), (_c = this.getWellLogSets()) !== null && _c !== void 0 ? _c : [], this.props.colorMapFunctions);
1335
+ editViewTrack(this.logController, track, newTemplateTrack, this.getAxesInfo(), this.getWellLogSets() ?? [], this.props.colorMapFunctions);
1307
1336
  if (titleChanged)
1308
1337
  // workaround to refresh tooltips in videx wellog component
1309
1338
  this._forceUpdateTitleTooltips();
@@ -1335,15 +1364,13 @@ class WellLogView extends Component {
1335
1364
  // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
1336
1365
  // Track plot management - --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
1337
1366
  addTrackPlot(track, templatePlot) {
1338
- var _a;
1339
1367
  if (!this.logController)
1340
1368
  return console.warn("Log controller not initialized");
1341
- addPlotToTrack(track, templatePlot, (_a = this.getWellLogSets()) !== null && _a !== void 0 ? _a : [], this.getAxesInfo(), this.props.colorMapFunctions);
1369
+ addPlotToTrack(track, templatePlot, this.getWellLogSets() ?? [], this.getAxesInfo(), this.props.colorMapFunctions);
1342
1370
  adjustControllerToModifiedTrack(this.logController, track);
1343
1371
  this._recomputeTemplateFromController();
1344
1372
  }
1345
1373
  _editTrackPlot(track, plot, templatePlot) {
1346
- var _a;
1347
1374
  if (!this.logController)
1348
1375
  return console.warn("Log controller not initialized");
1349
1376
  /* We have special option for track scale!
@@ -1351,7 +1378,7 @@ class WellLogView extends Component {
1351
1378
  if (templatePlot.scale === templateTrack.scale)
1352
1379
  templatePlot.scale = undefined;
1353
1380
  */
1354
- editTrackPlot(track, plot, templatePlot, (_a = this.getWellLogSets()) !== null && _a !== void 0 ? _a : [], this.getAxesInfo(), this.props.colorMapFunctions);
1381
+ editTrackPlot(track, plot, templatePlot, this.getWellLogSets() ?? [], this.getAxesInfo(), this.props.colorMapFunctions);
1355
1382
  adjustControllerToModifiedTrack(this.logController, track);
1356
1383
  this._recomputeTemplateFromController();
1357
1384
  }
@@ -1389,11 +1416,10 @@ class WellLogView extends Component {
1389
1416
  }
1390
1417
  createViewTitle(viewTitle //| undefined
1391
1418
  ) {
1392
- var _a;
1393
1419
  if (typeof viewTitle === "object" /*react element*/)
1394
1420
  return viewTitle;
1395
1421
  if (viewTitle === true)
1396
- return (_a = this.wellLogSets[0]) === null || _a === void 0 ? void 0 : _a.header.well;
1422
+ return this.wellLogSets[0]?.header.well;
1397
1423
  return viewTitle; // string
1398
1424
  }
1399
1425
  render() {
@@ -1504,6 +1530,10 @@ export function _propTypesWellLogView() {
1504
1530
  * Initial visible interval of the log data
1505
1531
  */
1506
1532
  domain: PropTypes.arrayOf(PropTypes.number),
1533
+ /**
1534
+ * Initial visible interval of the log data
1535
+ */
1536
+ visibleRange: PropTypes.arrayOf(PropTypes.number),
1507
1537
  /**
1508
1538
  * Initial selected interval of the log data
1509
1539
  */