@macrostrat/column-views 3.3.5 → 3.4.1
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 +45 -0
- package/dist/column.cjs +2 -1
- package/dist/column.cjs.map +1 -1
- package/dist/column.js +2 -1
- package/dist/column.js.map +1 -1
- package/dist/data-provider/unit-selection.cjs +7 -3
- package/dist/data-provider/unit-selection.cjs.map +1 -1
- package/dist/data-provider/unit-selection.d.ts +1 -0
- package/dist/data-provider/unit-selection.js +7 -3
- package/dist/data-provider/unit-selection.js.map +1 -1
- package/dist/facets/carbon-isotopes/data-area.cjs +0 -3
- package/dist/facets/carbon-isotopes/data-area.cjs.map +1 -1
- package/dist/facets/carbon-isotopes/data-area.js +0 -3
- package/dist/facets/carbon-isotopes/data-area.js.map +1 -1
- package/dist/index.cjs +13 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/prepare-units/composite-scale.cjs +0 -1
- package/dist/prepare-units/composite-scale.cjs.map +1 -1
- package/dist/prepare-units/composite-scale.js +0 -1
- package/dist/prepare-units/composite-scale.js.map +1 -1
- package/dist/prepare-units/helpers.cjs +83 -49
- package/dist/prepare-units/helpers.cjs.map +1 -1
- package/dist/prepare-units/helpers.d.ts +19 -2
- package/dist/prepare-units/helpers.js +84 -50
- package/dist/prepare-units/helpers.js.map +1 -1
- package/dist/prepare-units/index.cjs.map +1 -1
- package/dist/prepare-units/index.js.map +1 -1
- package/dist/section.cjs +1 -2
- package/dist/section.cjs.map +1 -1
- package/dist/section.js +1 -2
- package/dist/section.js.map +1 -1
- package/dist/unit-details/identifiers.cjs +56 -0
- package/dist/unit-details/identifiers.cjs.map +1 -0
- package/dist/unit-details/identifiers.d.ts +31 -0
- package/dist/unit-details/identifiers.js +54 -0
- package/dist/unit-details/identifiers.js.map +1 -0
- package/dist/unit-details/index.d.ts +2 -0
- package/dist/unit-details/panel.cjs +11 -88
- package/dist/unit-details/panel.cjs.map +1 -1
- package/dist/unit-details/panel.d.ts +3 -19
- package/dist/unit-details/panel.js +10 -87
- package/dist/unit-details/panel.js.map +1 -1
- package/dist/unit-details/popover.cjs +1 -2
- package/dist/unit-details/popover.cjs.map +1 -1
- package/dist/unit-details/popover.js +2 -3
- package/dist/unit-details/popover.js.map +1 -1
- package/dist/unit-details/strat-names.cjs +44 -0
- package/dist/unit-details/strat-names.cjs.map +1 -0
- package/dist/unit-details/strat-names.d.ts +14 -0
- package/dist/unit-details/strat-names.js +42 -0
- package/dist/unit-details/strat-names.js.map +1 -0
- package/dist/units/index.cjs +19 -6
- package/dist/units/index.cjs.map +1 -1
- package/dist/units/index.d.ts +11 -20
- package/dist/units/index.js +19 -6
- package/dist/units/index.js.map +1 -1
- package/package.json +14 -14
- package/src/column.ts +1 -1
- package/src/data-provider/unit-selection.ts +8 -4
- package/src/facets/carbon-isotopes/data-area.ts +0 -3
- package/src/prepare-units/composite-scale.ts +1 -1
- package/src/prepare-units/helpers.ts +121 -72
- package/src/prepare-units/index.ts +1 -1
- package/src/section.ts +0 -1
- package/src/unit-details/identifiers.ts +67 -0
- package/src/unit-details/index.ts +2 -0
- package/src/unit-details/panel.ts +13 -126
- package/src/unit-details/popover.ts +2 -7
- package/src/unit-details/strat-names.ts +57 -0
- package/src/units/index.ts +28 -8
package/src/units/index.ts
CHANGED
|
@@ -13,7 +13,8 @@ import { TrackedLabeledUnit } from "./composite";
|
|
|
13
13
|
import { useEnvironments, useLithologies } from "@macrostrat/data-provider";
|
|
14
14
|
import { useMemo } from "react";
|
|
15
15
|
import { resolveID } from "./resolvers";
|
|
16
|
-
import { Lithology } from "@macrostrat/api-types";
|
|
16
|
+
import { BaseUnit, Lithology } from "@macrostrat/api-types";
|
|
17
|
+
import { UnitWithDefinedOverlap } from "../prepare-units/helpers.ts";
|
|
17
18
|
|
|
18
19
|
export * from "./composite";
|
|
19
20
|
export * from "./types";
|
|
@@ -56,15 +57,34 @@ export function BasicUnitComponent({ division, ...rest }) {
|
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
interface UnitComponentProps<T extends BaseUnit> {
|
|
61
|
+
division: UnitWithDefinedOverlap<T> | T;
|
|
62
|
+
nColumns: number;
|
|
63
|
+
width?: number;
|
|
64
|
+
}
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
export function UnitComponent<T extends BaseUnit>({
|
|
67
|
+
division,
|
|
68
|
+
nColumns = 2,
|
|
69
|
+
...rest
|
|
70
|
+
}: UnitComponentProps<T>) {
|
|
71
|
+
const width = rest.width ?? useColumnLayout()?.width;
|
|
67
72
|
|
|
73
|
+
let _nColumns = nColumns;
|
|
74
|
+
if (isNaN(_nColumns)) {
|
|
75
|
+
_nColumns = 2;
|
|
76
|
+
}
|
|
77
|
+
let columnIx = 0;
|
|
78
|
+
let x = 0;
|
|
79
|
+
|
|
80
|
+
let reducedWidth = _nColumns;
|
|
81
|
+
if ("overlap" in division) {
|
|
82
|
+
const overlap = division.overlap;
|
|
83
|
+
_nColumns = Math.min(_nColumns, overlap.nColumns);
|
|
84
|
+
columnIx = overlap.column;
|
|
85
|
+
reducedWidth = width / _nColumns;
|
|
86
|
+
x = (columnIx * width) / _nColumns;
|
|
87
|
+
}
|
|
68
88
|
return h(TrackedLabeledUnit, {
|
|
69
89
|
division,
|
|
70
90
|
...rest,
|