@macrostrat/column-views 3.3.3 → 3.3.5
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/CHANGELOG.md +34 -0
- package/dist/age-axis.d.ts +2 -2
- package/dist/age-model-overlay.d.ts +1 -1
- package/dist/column.d.ts +5 -5
- package/dist/correlation-chart/main.cjs +2 -2
- package/dist/correlation-chart/main.cjs.map +1 -1
- package/dist/correlation-chart/main.d.ts +1 -1
- package/dist/correlation-chart/main.js +2 -2
- package/dist/correlation-chart/main.js.map +1 -1
- package/dist/correlation-chart/stories/utils.d.ts +1 -1
- package/dist/data-provider/column-nav.d.ts +1 -1
- package/dist/data-provider/unit-selection.cjs +1 -1
- package/dist/data-provider/unit-selection.cjs.map +1 -1
- package/dist/data-provider/unit-selection.d.ts +4 -4
- package/dist/data-provider/unit-selection.js +1 -1
- package/dist/data-provider/unit-selection.js.map +1 -1
- package/dist/facets/carbon-isotopes/data-area.d.ts +3 -3
- package/dist/facets/carbon-isotopes/data-provider.d.ts +3 -3
- package/dist/facets/detrital-zircon/index.d.ts +1 -1
- package/dist/facets/detrital-zircon/provider.d.ts +1 -1
- package/dist/facets/fossils/index.d.ts +1 -1
- package/dist/facets/fossils/taxon-ranges.d.ts +1 -1
- package/dist/facets/measurements/base.d.ts +3 -3
- package/dist/facets/measurements/sgp.d.ts +1 -1
- package/dist/maps/column-correlation/state.d.ts +1 -1
- package/dist/maps/column-navigation/mapbox/keyboard-navigation.d.ts +1 -1
- package/dist/maps/column-navigation/mapbox/state.d.ts +1 -1
- package/dist/maps/column-navigation/svg/data-fetcher.d.ts +1 -1
- package/dist/maps/column-navigation/svg/index.d.ts +1 -1
- package/dist/maps/column-navigation/svg/layers.d.ts +3 -3
- package/dist/maps/column-navigation/utils/keyboard-navigation.d.ts +1 -1
- package/dist/maps/inset-map/index.d.ts +2 -2
- package/dist/maps/layers/columns.d.ts +2 -2
- package/dist/section.d.ts +1 -1
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.d.ts +4 -3
- package/dist/unit-details/age-range.js.map +1 -1
- package/dist/unit-details/modal-panel.d.ts +1 -1
- package/dist/unit-details/panel.cjs +75 -72
- package/dist/unit-details/panel.cjs.map +1 -1
- package/dist/unit-details/panel.d.ts +83 -0
- package/dist/unit-details/panel.js +11 -7
- package/dist/unit-details/panel.js.map +1 -1
- package/dist/unit-details/popover.d.ts +5 -1
- package/dist/unit-details/utils.d.ts +2 -2
- package/dist/units/boxes.d.ts +4 -4
- package/dist/units/composite.d.ts +3 -3
- package/dist/units/index.d.ts +6 -6
- package/dist/units/names.d.ts +3 -2
- package/dist/units/resolvers.d.ts +1 -1
- package/package.json +15 -15
- package/src/correlation-chart/main.ts +2 -2
- package/src/data-provider/unit-selection.ts +1 -1
- package/src/unit-details/age-range.ts +1 -0
- package/src/unit-details/panel.ts +24 -15
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import hyper from "@macrostrat/hyper";
|
|
2
|
-
import styles from "./panel.module.sass";
|
|
3
1
|
import { JSONView } from "@macrostrat/ui-components";
|
|
4
2
|
import { Button, ButtonGroup } from "@blueprintjs/core";
|
|
5
3
|
import { ReactNode, useMemo, useState } from "react";
|
|
@@ -30,6 +28,7 @@ import type {
|
|
|
30
28
|
Environment,
|
|
31
29
|
Interval,
|
|
32
30
|
Lithology,
|
|
31
|
+
UnitLithology,
|
|
33
32
|
UnitLong,
|
|
34
33
|
UnitLongFull,
|
|
35
34
|
} from "@macrostrat/api-types";
|
|
@@ -37,8 +36,7 @@ import { defaultNameFunction } from "../units/names";
|
|
|
37
36
|
import classNames from "classnames";
|
|
38
37
|
import { AgeField, Duration, IntervalProportions } from "./age-range";
|
|
39
38
|
import { formatRange, formatSignificance } from "./utils.ts";
|
|
40
|
-
|
|
41
|
-
const h = hyper.styled(styles);
|
|
39
|
+
import h from "./panel.module.sass";
|
|
42
40
|
|
|
43
41
|
export interface UnitDetailsPanelProps {
|
|
44
42
|
unit: any;
|
|
@@ -71,7 +69,7 @@ export function UnitDetailsPanel({
|
|
|
71
69
|
}: UnitDetailsPanelProps) {
|
|
72
70
|
const [showJSON, setShowJSON] = useState(false);
|
|
73
71
|
|
|
74
|
-
let content = null;
|
|
72
|
+
let content: ReactNode = null;
|
|
75
73
|
if (showJSON) {
|
|
76
74
|
content = h(JSONView, { data: unit, showRoot: false });
|
|
77
75
|
} else {
|
|
@@ -115,12 +113,18 @@ export function UnitDetailsPanel({
|
|
|
115
113
|
|
|
116
114
|
/** Handle unit selection clicks */
|
|
117
115
|
const clickHandlerForItem = useMemo(() => {
|
|
118
|
-
if (onSelectUnit == null
|
|
116
|
+
if (onSelectUnit == null || onClickItem == null) return null;
|
|
119
117
|
return (item: MacrostratItemIdentifier) => {
|
|
120
118
|
if ("unit_id" in item && !("col_id" in item)) {
|
|
121
119
|
// We are selecting a unit within the column
|
|
122
120
|
return (event: MouseEvent) => {
|
|
123
|
-
onSelectUnit
|
|
121
|
+
if (onSelectUnit != null) {
|
|
122
|
+
onSelectUnit(item.unit_id);
|
|
123
|
+
} else if (onClickItem != null) {
|
|
124
|
+
console.warn(
|
|
125
|
+
"Unit selection: onClickItem is defined but onSelectUnit is not; ignoring click",
|
|
126
|
+
);
|
|
127
|
+
}
|
|
124
128
|
// Don't allow event to propagate further (e.g., to open a link)
|
|
125
129
|
event.preventDefault();
|
|
126
130
|
};
|
|
@@ -173,7 +177,7 @@ export function LegendPanelHeader({
|
|
|
173
177
|
minimal: true,
|
|
174
178
|
small: true,
|
|
175
179
|
onClick() {
|
|
176
|
-
onClose();
|
|
180
|
+
onClose?.();
|
|
177
181
|
},
|
|
178
182
|
}),
|
|
179
183
|
]);
|
|
@@ -223,7 +227,7 @@ function UnitDetailsContent({
|
|
|
223
227
|
const environments = enhanceEnvironments(unit.environ, envMap);
|
|
224
228
|
const lithologies = enhanceLithologies(unit.lith ?? [], lithMap);
|
|
225
229
|
|
|
226
|
-
let outcropField = null;
|
|
230
|
+
let outcropField: ReactNode = null;
|
|
227
231
|
if (features.has(UnitDetailsFeature.OutcropType)) {
|
|
228
232
|
// Determine outcrop type
|
|
229
233
|
let outcrop = unit.outcrop;
|
|
@@ -236,7 +240,7 @@ function UnitDetailsContent({
|
|
|
236
240
|
});
|
|
237
241
|
}
|
|
238
242
|
|
|
239
|
-
let thicknessOrHeightRange = null;
|
|
243
|
+
let thicknessOrHeightRange: ReactNode = null;
|
|
240
244
|
const [thickness, thicknessUnit] = getThickness(unit);
|
|
241
245
|
// Proxy for actual heights in t_pos and b_pos
|
|
242
246
|
if (
|
|
@@ -281,7 +285,7 @@ function UnitDetailsContent({
|
|
|
281
285
|
thicknessOrHeightRange,
|
|
282
286
|
h.if(lithologies != null)(LithologyList, {
|
|
283
287
|
label: "Lithology",
|
|
284
|
-
lithologies,
|
|
288
|
+
lithologies: lithologies ?? [],
|
|
285
289
|
features: lithologyFeatures,
|
|
286
290
|
}),
|
|
287
291
|
h(AgeField, { unit }, [
|
|
@@ -480,8 +484,8 @@ function Citation({ data, tag = "p" }) {
|
|
|
480
484
|
}
|
|
481
485
|
|
|
482
486
|
function enhanceEnvironments(
|
|
483
|
-
environments
|
|
484
|
-
envMap
|
|
487
|
+
environments?: Partial<Environment>[] | null,
|
|
488
|
+
envMap?: Map<number, Environment> | null,
|
|
485
489
|
) {
|
|
486
490
|
return environments?.map((env) => {
|
|
487
491
|
return {
|
|
@@ -491,9 +495,14 @@ function enhanceEnvironments(
|
|
|
491
495
|
});
|
|
492
496
|
}
|
|
493
497
|
|
|
498
|
+
type LithID =
|
|
499
|
+
| (Partial<Lithology> & Pick<Lithology, "lith_id">)
|
|
500
|
+
| UnitLithology
|
|
501
|
+
| Lithology;
|
|
502
|
+
|
|
494
503
|
function enhanceLithologies(
|
|
495
|
-
lithologies
|
|
496
|
-
lithMap
|
|
504
|
+
lithologies?: LithID[] | null,
|
|
505
|
+
lithMap?: Map<number, any> | null,
|
|
497
506
|
) {
|
|
498
507
|
return lithologies?.map((lith) => {
|
|
499
508
|
return {
|