@macrostrat/column-views 3.3.4 → 3.4.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.
- package/CHANGELOG.md +63 -0
- package/dist/age-axis.d.ts +3 -3
- package/dist/column.cjs +2 -1
- package/dist/column.cjs.map +1 -1
- package/dist/column.d.ts +3 -3
- package/dist/column.js +2 -1
- package/dist/column.js.map +1 -1
- package/dist/correlation-chart/main.d.ts +1 -1
- package/dist/correlation-chart/prepare-data.d.ts +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 +3 -2
- 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.d.ts +1 -1
- package/dist/facets/carbon-isotopes/data-provider.d.ts +1 -1
- package/dist/facets/measurements/base.d.ts +2 -2
- 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/maps/column-correlation/state.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/layers.d.ts +3 -3
- package/dist/maps/inset-map/index.d.ts +1 -1
- package/dist/maps/layers/columns.d.ts +1 -1
- package/dist/maps/layers/units.d.ts +1 -1
- package/dist/prepare-units/composite-scale.d.ts +1 -1
- package/dist/prepare-units/dynamic-scales.d.ts +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 +21 -4
- 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.d.ts +1 -1
- package/dist/prepare-units/index.js.map +1 -1
- package/dist/prepare-units/types.d.ts +2 -2
- package/dist/prepare-units/utils.d.ts +2 -2
- package/dist/section.cjs +1 -2
- package/dist/section.cjs.map +1 -1
- package/dist/section.d.ts +1 -1
- package/dist/section.js +1 -2
- package/dist/section.js.map +1 -1
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.d.ts +2 -1
- package/dist/unit-details/age-range.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 +73 -147
- package/dist/unit-details/panel.cjs.map +1 -1
- package/dist/unit-details/panel.d.ts +67 -0
- package/dist/unit-details/panel.js +19 -92
- 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/boxes.d.ts +2 -2
- package/dist/units/colors.d.ts +1 -1
- package/dist/units/composite.d.ts +4 -4
- package/dist/units/index.cjs +20 -6
- package/dist/units/index.cjs.map +1 -1
- package/dist/units/index.d.ts +12 -21
- package/dist/units/index.js +20 -6
- package/dist/units/index.js.map +1 -1
- package/dist/units/names.d.ts +3 -3
- package/dist/units/resolvers.d.ts +2 -2
- package/package.json +19 -19
- package/src/column.ts +1 -1
- package/src/data-provider/unit-selection.ts +8 -4
- 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/age-range.ts +1 -0
- package/src/unit-details/identifiers.ts +67 -0
- package/src/unit-details/index.ts +2 -0
- package/src/unit-details/panel.ts +27 -131
- package/src/unit-details/popover.ts +2 -7
- package/src/unit-details/strat-names.ts +57 -0
- package/src/units/index.ts +31 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntervalTagProps } from '
|
|
1
|
+
import { IntervalTagProps } from '@macrostrat/data-components';
|
|
2
2
|
export declare function AgeField({ unit, children, ...rest }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
unit: any;
|
|
@@ -60,6 +60,7 @@ export interface IntervalProportionsProps extends Omit<IntervalTagProps, "interv
|
|
|
60
60
|
unit: UnitIntervalConstraints;
|
|
61
61
|
showProportions?: boolean;
|
|
62
62
|
calculateProportionsFromAges?: boolean;
|
|
63
|
+
onClickItem?: any;
|
|
63
64
|
}
|
|
64
65
|
export declare function IntervalProportions({ unit, className, showProportions, calculateProportionsFromAges, ...rest }: IntervalProportionsProps): import('react').FunctionComponentElement<{
|
|
65
66
|
children?: import('react').ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-range.js","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport { formatProportion, formatRange } from \"./utils\";\nimport classNames from \"classnames\";\nimport { useMemo } from \"react\";\n\nexport function AgeField({ unit, children, ...rest }) {\n const [_b_age, _t_age, _unit] = getAgeRange(unit);\n\n return h(\n DataField,\n {\n label: \"Age\",\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n ...rest,\n },\n children,\n );\n}\n\nexport function AgeRange({\n data,\n className,\n}: {\n data: {\n t_age: number;\n b_age: number;\n };\n className?: string;\n}) {\n const [_b_age, _t_age, _unit] = getAgeRange(data);\n\n return h(Value, {\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n className,\n });\n}\n\nexport function AgeLabel({\n age,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n className,\n}: {\n age: number;\n className?: string;\n maximumFractionDigits?: number;\n minimumFractionDigits?: number;\n}) {\n /** Component to display a single age value with unit conversion from\n * Ma to ka or Ga as appropriate.\n */\n const [value, unit] = getAge(age);\n\n const _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit, className });\n}\n\nexport function Duration({\n value,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n}) {\n let unit = \"Myr\";\n if (value < 0.8) {\n unit = \"kyr\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Gyr\";\n value /= 1000;\n }\n\n let _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit });\n}\n\ninterface UnitIntervalConstraints {\n b_int_id?: number;\n t_int_id?: number;\n b_prop?: number;\n t_prop?: number;\n b_int_name?: string;\n t_int_name?: string;\n b_age?: number;\n t_age?: number;\n}\n\nexport interface IntervalProportionsProps extends Omit<\n IntervalTagProps,\n \"interval\"\n> {\n unit: UnitIntervalConstraints;\n showProportions?: boolean;\n calculateProportionsFromAges?: boolean;\n}\n\nexport function IntervalProportions({\n unit,\n className,\n showProportions,\n calculateProportionsFromAges = true,\n ...rest\n}: IntervalProportionsProps) {\n /** Display the proportions of the unit that belong to the base and top intervals, if they are different */\n if (unit.b_int_id == null && unit.t_int_id == null) return null;\n\n let _showProps = showProportions;\n\n const i0 = unit.b_int_id;\n const i1 = unit.t_int_id;\n\n /** Get interval information */\n const intervalMap = useMacrostratDefs(\"intervals\");\n const [int0, int1] = useMemo(() => {\n const int0 = intervalMap?.get(i0) ?? {};\n if (i0 === i1) {\n return [int0, int0];\n }\n const int1 = intervalMap?.get(i1) ?? {};\n return [int0, int1];\n }, [intervalMap, i0, i1]);\n\n const interval0: IntervalShort = {\n id: i0,\n name: unit.b_int_name,\n ...int0,\n };\n\n let b_prop = unit.b_prop;\n let t_prop = unit.t_prop;\n\n // If we have b_age and t_age, then we can calculate proportions if they are not given\n if (b_prop == null && unit.b_age != null && calculateProportionsFromAges) {\n b_prop = getProportion(unit.b_age, int0);\n }\n if (t_prop == null && unit.t_age != null && calculateProportionsFromAges) {\n t_prop = getProportion(unit.t_age, int1);\n }\n\n // If there are no proportions given and we are not explicitly directed to show them,\n // then we set them to hidden.\n if (b_prop == null && t_prop == null) {\n _showProps ??= false;\n }\n\n /*\n Set default proportions to 0 and 1 if they are not given,\n so that we can display \"base\" and \"top\" labels\n */\n b_prop ??= 0;\n t_prop ??= 1;\n\n let p0: any = null;\n let p1: any = null;\n\n if (_showProps !== false) {\n p1 = h(Proportion, { value: t_prop });\n\n if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {\n // We have a single interval with undefined proportions\n p0 = h(Proportion, { value: b_prop });\n }\n\n if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {\n p0 = h(\"span.joint-proportion\", [p0, \" \", h(\"span.sep\", \"to\"), \" \", p1]);\n }\n }\n\n return h(\n ItemList,\n { className: classNames(\"interval-proportions\", className) },\n [\n h(IntervalTag, {\n interval: interval0,\n prefix: p0,\n ...rest,\n }),\n h.if(i0 != i1)(\"span.discourage-break\", [\n h(\"span.sep\", \" to \"),\n h(IntervalTag, {\n interval: {\n id: i1,\n name: unit.t_int_name,\n ...int1,\n },\n prefix: p1,\n ...rest,\n }),\n ]),\n ],\n );\n}\n\nfunction getProportion(age: number, interval: IntervalShort): number | null {\n /** Get proportion with the age */\n return (interval.b_age - age) / (interval.b_age - interval.t_age);\n}\n\nfunction Proportion({ value }) {\n let content = null;\n if (value == 0) {\n content = \"base\";\n } else if (value == 1) {\n content = \"top\";\n } else {\n content = formatProportion(value * 100) + \"%\";\n }\n\n return h(\"span.proportion\", content);\n}\n\nexport function getAgeRange(_unit) {\n let b_age = _unit.b_age;\n let t_age = _unit.t_age;\n let unit = \"Ma\";\n\n if (b_age < 0.8 && t_age < 1.2) {\n b_age *= 1000;\n t_age *= 1000;\n unit = \"ka\";\n } else if (b_age > 800 && t_age > 1200) {\n b_age /= 1000;\n t_age /= 1000;\n unit = \"Ga\";\n }\n\n return [b_age, t_age, unit];\n}\n\nexport function getAge(value) {\n /** Get the age value in Ma, ka, or Ga as appropriate */\n let unit = \"Ma\";\n if (value < 0.8) {\n unit = \"ka\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Ga\";\n value /= 1000;\n }\n\n return [value, unit];\n}\n"],"names":["int0","int1"],"mappings":";;;;;;AAcO,SAAS,SAAS,EAAE,MAAM,UAAU,GAAG,QAAQ;AACpD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO,YAAY,QAAQ,MAAM;AAAA,MACjC,MAAM;AAAA,MACN,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AACF,GAMG;AACD,QAAM,CAAC,QAAQ,QAAQ,KAAK,IAAI,YAAY,IAAI;AAEhD,SAAO,EAAE,OAAO;AAAA,IACd,OAAO,YAAY,QAAQ,MAAM;AAAA,IACjC,MAAM;AAAA,IACN;AAAA,EAAA,CACD;AACH;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AACF,GAKG;AAID,QAAM,CAAC,OAAO,IAAI,IAAI,OAAO,GAAG;AAEhC,QAAM,SAAS,MAAM,eAAe,SAAS;AAAA,IAC3C;AAAA,IACA;AAAA,EAAA,CACD;AAED,SAAO,EAAE,OAAO,EAAE,OAAO,QAAQ,MAAM,WAAW;AACpD;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAC1B,GAAG;AACD,MAAI,OAAO;AACX,MAAI,QAAQ,KAAK;AACf,WAAO;AACP,aAAS;AACT,QAAI,QAAQ,GAAG;AACb,aAAO;AACP,eAAS;AAAA,IACX;AAAA,EACF,WAAW,QAAQ,KAAM;AACvB,WAAO;AACP,aAAS;AAAA,EACX;AAEA,MAAI,SAAS,MAAM,eAAe,SAAS;AAAA,IACzC;AAAA,IACA;AAAA,EAAA,CACD;AAED,SAAO,EAAE,OAAO,EAAE,OAAO,QAAQ,MAAM;AACzC;
|
|
1
|
+
{"version":3,"file":"age-range.js","sources":["../../src/unit-details/age-range.ts"],"sourcesContent":["import {\n DataField,\n IntervalShort,\n IntervalTag,\n type IntervalTagProps,\n ItemList,\n Value,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport h from \"./age-range.module.sass\";\nimport { formatProportion, formatRange } from \"./utils\";\nimport classNames from \"classnames\";\nimport { useMemo } from \"react\";\n\nexport function AgeField({ unit, children, ...rest }) {\n const [_b_age, _t_age, _unit] = getAgeRange(unit);\n\n return h(\n DataField,\n {\n label: \"Age\",\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n ...rest,\n },\n children,\n );\n}\n\nexport function AgeRange({\n data,\n className,\n}: {\n data: {\n t_age: number;\n b_age: number;\n };\n className?: string;\n}) {\n const [_b_age, _t_age, _unit] = getAgeRange(data);\n\n return h(Value, {\n value: formatRange(_b_age, _t_age),\n unit: _unit,\n className,\n });\n}\n\nexport function AgeLabel({\n age,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n className,\n}: {\n age: number;\n className?: string;\n maximumFractionDigits?: number;\n minimumFractionDigits?: number;\n}) {\n /** Component to display a single age value with unit conversion from\n * Ma to ka or Ga as appropriate.\n */\n const [value, unit] = getAge(age);\n\n const _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit, className });\n}\n\nexport function Duration({\n value,\n maximumFractionDigits = 2,\n minimumFractionDigits = 0,\n}) {\n let unit = \"Myr\";\n if (value < 0.8) {\n unit = \"kyr\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Gyr\";\n value /= 1000;\n }\n\n let _value = value.toLocaleString(\"en-US\", {\n maximumFractionDigits,\n minimumFractionDigits,\n });\n\n return h(Value, { value: _value, unit });\n}\n\ninterface UnitIntervalConstraints {\n b_int_id?: number;\n t_int_id?: number;\n b_prop?: number;\n t_prop?: number;\n b_int_name?: string;\n t_int_name?: string;\n b_age?: number;\n t_age?: number;\n}\n\nexport interface IntervalProportionsProps extends Omit<\n IntervalTagProps,\n \"interval\"\n> {\n unit: UnitIntervalConstraints;\n showProportions?: boolean;\n calculateProportionsFromAges?: boolean;\n onClickItem?: any;\n}\n\nexport function IntervalProportions({\n unit,\n className,\n showProportions,\n calculateProportionsFromAges = true,\n ...rest\n}: IntervalProportionsProps) {\n /** Display the proportions of the unit that belong to the base and top intervals, if they are different */\n if (unit.b_int_id == null && unit.t_int_id == null) return null;\n\n let _showProps = showProportions;\n\n const i0 = unit.b_int_id;\n const i1 = unit.t_int_id;\n\n /** Get interval information */\n const intervalMap = useMacrostratDefs(\"intervals\");\n const [int0, int1] = useMemo(() => {\n const int0 = intervalMap?.get(i0) ?? {};\n if (i0 === i1) {\n return [int0, int0];\n }\n const int1 = intervalMap?.get(i1) ?? {};\n return [int0, int1];\n }, [intervalMap, i0, i1]);\n\n const interval0: IntervalShort = {\n id: i0,\n name: unit.b_int_name,\n ...int0,\n };\n\n let b_prop = unit.b_prop;\n let t_prop = unit.t_prop;\n\n // If we have b_age and t_age, then we can calculate proportions if they are not given\n if (b_prop == null && unit.b_age != null && calculateProportionsFromAges) {\n b_prop = getProportion(unit.b_age, int0);\n }\n if (t_prop == null && unit.t_age != null && calculateProportionsFromAges) {\n t_prop = getProportion(unit.t_age, int1);\n }\n\n // If there are no proportions given and we are not explicitly directed to show them,\n // then we set them to hidden.\n if (b_prop == null && t_prop == null) {\n _showProps ??= false;\n }\n\n /*\n Set default proportions to 0 and 1 if they are not given,\n so that we can display \"base\" and \"top\" labels\n */\n b_prop ??= 0;\n t_prop ??= 1;\n\n let p0: any = null;\n let p1: any = null;\n\n if (_showProps !== false) {\n p1 = h(Proportion, { value: t_prop });\n\n if (i0 !== i1 || b_prop !== 0 || t_prop !== 1) {\n // We have a single interval with undefined proportions\n p0 = h(Proportion, { value: b_prop });\n }\n\n if (i0 === i1 && (b_prop !== 0 || t_prop !== 1)) {\n p0 = h(\"span.joint-proportion\", [p0, \" \", h(\"span.sep\", \"to\"), \" \", p1]);\n }\n }\n\n return h(\n ItemList,\n { className: classNames(\"interval-proportions\", className) },\n [\n h(IntervalTag, {\n interval: interval0,\n prefix: p0,\n ...rest,\n }),\n h.if(i0 != i1)(\"span.discourage-break\", [\n h(\"span.sep\", \" to \"),\n h(IntervalTag, {\n interval: {\n id: i1,\n name: unit.t_int_name,\n ...int1,\n },\n prefix: p1,\n ...rest,\n }),\n ]),\n ],\n );\n}\n\nfunction getProportion(age: number, interval: IntervalShort): number | null {\n /** Get proportion with the age */\n return (interval.b_age - age) / (interval.b_age - interval.t_age);\n}\n\nfunction Proportion({ value }) {\n let content = null;\n if (value == 0) {\n content = \"base\";\n } else if (value == 1) {\n content = \"top\";\n } else {\n content = formatProportion(value * 100) + \"%\";\n }\n\n return h(\"span.proportion\", content);\n}\n\nexport function getAgeRange(_unit) {\n let b_age = _unit.b_age;\n let t_age = _unit.t_age;\n let unit = \"Ma\";\n\n if (b_age < 0.8 && t_age < 1.2) {\n b_age *= 1000;\n t_age *= 1000;\n unit = \"ka\";\n } else if (b_age > 800 && t_age > 1200) {\n b_age /= 1000;\n t_age /= 1000;\n unit = \"Ga\";\n }\n\n return [b_age, t_age, unit];\n}\n\nexport function getAge(value) {\n /** Get the age value in Ma, ka, or Ga as appropriate */\n let unit = \"Ma\";\n if (value < 0.8) {\n unit = \"ka\";\n value *= 1000;\n if (value < 5) {\n unit = \"yr\";\n value *= 1000;\n }\n } else if (value > 1000) {\n unit = \"Ga\";\n value /= 1000;\n }\n\n return [value, unit];\n}\n"],"names":["int0","int1"],"mappings":"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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dataComponents = require("@macrostrat/data-components");
|
|
4
|
+
const panel_module = require("./panel.module.sass.cjs");
|
|
5
|
+
const classNames = require("classnames");
|
|
6
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
+
const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
|
|
8
|
+
function ClickableText({
|
|
9
|
+
className,
|
|
10
|
+
...rest
|
|
11
|
+
}) {
|
|
12
|
+
const clickable = dataComponents.isClickable(rest);
|
|
13
|
+
const tag = clickable ? "a" : "span";
|
|
14
|
+
return panel_module.default(tag, { className: classNames__default.default(className, { clickable }), ...rest });
|
|
15
|
+
}
|
|
16
|
+
function Identifier({
|
|
17
|
+
id,
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
21
|
+
return panel_module.default(
|
|
22
|
+
ClickableText,
|
|
23
|
+
{
|
|
24
|
+
className: classNames__default.default("identifier", className),
|
|
25
|
+
...rest
|
|
26
|
+
},
|
|
27
|
+
id
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function UnitIdentifier({
|
|
31
|
+
unitID,
|
|
32
|
+
colID,
|
|
33
|
+
name,
|
|
34
|
+
...interactionProps
|
|
35
|
+
}) {
|
|
36
|
+
if (name != null) {
|
|
37
|
+
return panel_module.default(
|
|
38
|
+
ClickableText,
|
|
39
|
+
{
|
|
40
|
+
className: "unit-name",
|
|
41
|
+
...interactionProps
|
|
42
|
+
},
|
|
43
|
+
name
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return panel_module.default(Identifier, {
|
|
47
|
+
className: "unit-id",
|
|
48
|
+
key: unitID,
|
|
49
|
+
id: unitID,
|
|
50
|
+
...interactionProps
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.ClickableText = ClickableText;
|
|
54
|
+
exports.Identifier = Identifier;
|
|
55
|
+
exports.UnitIdentifier = UnitIdentifier;
|
|
56
|
+
//# sourceMappingURL=identifiers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.cjs","sources":["../../src/unit-details/identifiers.ts"],"sourcesContent":["import { isClickable, ItemInteractionProps } from \"@macrostrat/data-components\";\nimport h from \"./panel.module.sass\";\nimport { ReactNode } from \"react\";\nimport classNames from \"classnames\";\n\nexport function ClickableText({\n className,\n ...rest\n}: {\n className?: string;\n children: ReactNode;\n} & ItemInteractionProps) {\n /** An optionally clickable text element */\n const clickable = isClickable(rest);\n const tag = clickable ? \"a\" : \"span\";\n return h(tag, { className: classNames(className, { clickable }), ...rest });\n}\n\nexport function Identifier({\n id,\n className,\n ...rest\n}: {\n id: number | string;\n className?: string;\n} & ItemInteractionProps) {\n /** An item that displays a numeric identifier, optionally clickable */\n return h(\n ClickableText,\n {\n className: classNames(\"identifier\", className),\n ...rest,\n },\n id,\n );\n}\n\nexport type UnitInfo = {\n unitID: number;\n colID?: number;\n name?: string;\n};\n\nexport function UnitIdentifier({\n unitID,\n colID,\n name,\n ...interactionProps\n}: UnitInfo & ItemInteractionProps) {\n if (name != null) {\n return h(\n ClickableText,\n {\n className: \"unit-name\",\n ...interactionProps,\n },\n name,\n );\n }\n\n return h(Identifier, {\n className: \"unit-id\",\n key: unitID,\n id: unitID,\n ...interactionProps,\n });\n}\n"],"names":["isClickable","h","classNames"],"mappings":";;;;;;;AAKO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,QAAM,YAAYA,eAAAA,YAAY,IAAI;AAClC,QAAM,MAAM,YAAY,MAAM;AAC9B,SAAOC,qBAAE,KAAK,EAAE,WAAWC,oBAAAA,QAAW,WAAW,EAAE,UAAA,CAAW,GAAG,GAAG,MAAM;AAC5E;AAEO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,SAAOD,aAAAA;AAAAA,IACL;AAAA,IACA;AAAA,MACE,WAAWC,oBAAAA,QAAW,cAAc,SAAS;AAAA,MAC7C,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoC;AAClC,MAAI,QAAQ,MAAM;AAChB,WAAOD,aAAAA;AAAAA,MACL;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAOA,aAAAA,QAAE,YAAY;AAAA,IACnB,WAAW;AAAA,IACX,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,CACJ;AACH;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ItemInteractionProps } from '@macrostrat/data-components';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare function ClickableText({ className, ...rest }: {
|
|
4
|
+
className?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
} & ItemInteractionProps): import('react').ReactElement<{
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
href?: string | null;
|
|
9
|
+
target?: string;
|
|
10
|
+
onClick?: (event: MouseEvent) => void;
|
|
11
|
+
className: string;
|
|
12
|
+
}, string | import('react').JSXElementConstructor<any>>;
|
|
13
|
+
export declare function Identifier({ id, className, ...rest }: {
|
|
14
|
+
id: number | string;
|
|
15
|
+
className?: string;
|
|
16
|
+
} & ItemInteractionProps): import('react').FunctionComponentElement<{
|
|
17
|
+
className?: string;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
} & ItemInteractionProps>;
|
|
20
|
+
export type UnitInfo = {
|
|
21
|
+
unitID: number;
|
|
22
|
+
colID?: number;
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function UnitIdentifier({ unitID, colID, name, ...interactionProps }: UnitInfo & ItemInteractionProps): import('react').FunctionComponentElement<{
|
|
26
|
+
className?: string;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
} & ItemInteractionProps> | import('react').FunctionComponentElement<{
|
|
29
|
+
id: number | string;
|
|
30
|
+
className?: string;
|
|
31
|
+
} & ItemInteractionProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isClickable } from "@macrostrat/data-components";
|
|
2
|
+
import h from "./panel.module.sass.js";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
function ClickableText({
|
|
5
|
+
className,
|
|
6
|
+
...rest
|
|
7
|
+
}) {
|
|
8
|
+
const clickable = isClickable(rest);
|
|
9
|
+
const tag = clickable ? "a" : "span";
|
|
10
|
+
return h(tag, { className: classNames(className, { clickable }), ...rest });
|
|
11
|
+
}
|
|
12
|
+
function Identifier({
|
|
13
|
+
id,
|
|
14
|
+
className,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
return h(
|
|
18
|
+
ClickableText,
|
|
19
|
+
{
|
|
20
|
+
className: classNames("identifier", className),
|
|
21
|
+
...rest
|
|
22
|
+
},
|
|
23
|
+
id
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function UnitIdentifier({
|
|
27
|
+
unitID,
|
|
28
|
+
colID,
|
|
29
|
+
name,
|
|
30
|
+
...interactionProps
|
|
31
|
+
}) {
|
|
32
|
+
if (name != null) {
|
|
33
|
+
return h(
|
|
34
|
+
ClickableText,
|
|
35
|
+
{
|
|
36
|
+
className: "unit-name",
|
|
37
|
+
...interactionProps
|
|
38
|
+
},
|
|
39
|
+
name
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return h(Identifier, {
|
|
43
|
+
className: "unit-id",
|
|
44
|
+
key: unitID,
|
|
45
|
+
id: unitID,
|
|
46
|
+
...interactionProps
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
ClickableText,
|
|
51
|
+
Identifier,
|
|
52
|
+
UnitIdentifier
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=identifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.js","sources":["../../src/unit-details/identifiers.ts"],"sourcesContent":["import { isClickable, ItemInteractionProps } from \"@macrostrat/data-components\";\nimport h from \"./panel.module.sass\";\nimport { ReactNode } from \"react\";\nimport classNames from \"classnames\";\n\nexport function ClickableText({\n className,\n ...rest\n}: {\n className?: string;\n children: ReactNode;\n} & ItemInteractionProps) {\n /** An optionally clickable text element */\n const clickable = isClickable(rest);\n const tag = clickable ? \"a\" : \"span\";\n return h(tag, { className: classNames(className, { clickable }), ...rest });\n}\n\nexport function Identifier({\n id,\n className,\n ...rest\n}: {\n id: number | string;\n className?: string;\n} & ItemInteractionProps) {\n /** An item that displays a numeric identifier, optionally clickable */\n return h(\n ClickableText,\n {\n className: classNames(\"identifier\", className),\n ...rest,\n },\n id,\n );\n}\n\nexport type UnitInfo = {\n unitID: number;\n colID?: number;\n name?: string;\n};\n\nexport function UnitIdentifier({\n unitID,\n colID,\n name,\n ...interactionProps\n}: UnitInfo & ItemInteractionProps) {\n if (name != null) {\n return h(\n ClickableText,\n {\n className: \"unit-name\",\n ...interactionProps,\n },\n name,\n );\n }\n\n return h(Identifier, {\n className: \"unit-id\",\n key: unitID,\n id: unitID,\n ...interactionProps,\n });\n}\n"],"names":[],"mappings":";;;AAKO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,QAAM,YAAY,YAAY,IAAI;AAClC,QAAM,MAAM,YAAY,MAAM;AAC9B,SAAO,EAAE,KAAK,EAAE,WAAW,WAAW,WAAW,EAAE,UAAA,CAAW,GAAG,GAAG,MAAM;AAC5E;AAEO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAG0B;AAExB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,WAAW,WAAW,cAAc,SAAS;AAAA,MAC7C,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAQO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoC;AAClC,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,GAAG;AAAA,MAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO,EAAE,YAAY;AAAA,IACnB,WAAW;AAAA,IACX,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,CACJ;AACH;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const h$1 = require("@macrostrat/hyper");
|
|
4
|
-
const panel_module = require("./panel.module.sass.cjs");
|
|
5
3
|
const uiComponents = require("@macrostrat/ui-components");
|
|
6
4
|
const core = require("@blueprintjs/core");
|
|
7
5
|
const React = require("react");
|
|
@@ -11,11 +9,12 @@ const names = require("../units/names.cjs");
|
|
|
11
9
|
const classNames = require("classnames");
|
|
12
10
|
const ageRange = require("./age-range.cjs");
|
|
13
11
|
const utils = require("./utils.cjs");
|
|
12
|
+
const panel_module = require("./panel.module.sass.cjs");
|
|
13
|
+
const stratNames = require("./strat-names.cjs");
|
|
14
|
+
const identifiers = require("./identifiers.cjs");
|
|
14
15
|
const store = require("../data-provider/store.cjs");
|
|
15
16
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
16
|
-
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
17
17
|
const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
|
|
18
|
-
const h = h__default.default.styled(panel_module.default);
|
|
19
18
|
function UnitDetailsPanel({
|
|
20
19
|
unit,
|
|
21
20
|
onClose,
|
|
@@ -31,14 +30,15 @@ function UnitDetailsPanel({
|
|
|
31
30
|
actions,
|
|
32
31
|
hiddenActions = null,
|
|
33
32
|
onSelectUnit,
|
|
34
|
-
onClickItem
|
|
33
|
+
onClickItem,
|
|
34
|
+
showJSON
|
|
35
35
|
}) {
|
|
36
|
-
const [
|
|
36
|
+
const [_showJSON, setShowJSON] = React.useState(false);
|
|
37
37
|
let content = null;
|
|
38
|
-
if (showJSON) {
|
|
39
|
-
content =
|
|
38
|
+
if (showJSON ?? _showJSON) {
|
|
39
|
+
content = panel_module.default(uiComponents.JSONView, { data: unit, showRoot: false });
|
|
40
40
|
} else {
|
|
41
|
-
content =
|
|
41
|
+
content = panel_module.default(UnitDetailsContent, {
|
|
42
42
|
unit,
|
|
43
43
|
features,
|
|
44
44
|
lithologyFeatures,
|
|
@@ -50,8 +50,8 @@ function UnitDetailsPanel({
|
|
|
50
50
|
"json-toggle"
|
|
51
51
|
/* JSONToggle */
|
|
52
52
|
)) {
|
|
53
|
-
hiddenActions =
|
|
54
|
-
|
|
53
|
+
hiddenActions = panel_module.default([
|
|
54
|
+
panel_module.default(core.Button, {
|
|
55
55
|
icon: "code",
|
|
56
56
|
small: true,
|
|
57
57
|
minimal: true,
|
|
@@ -65,22 +65,28 @@ function UnitDetailsPanel({
|
|
|
65
65
|
hiddenActions
|
|
66
66
|
]);
|
|
67
67
|
}
|
|
68
|
-
const main =
|
|
69
|
-
|
|
68
|
+
const main = panel_module.default("div.unit-details-panel", { className }, [
|
|
69
|
+
panel_module.default(LegendPanelHeader, {
|
|
70
70
|
onClose,
|
|
71
71
|
title,
|
|
72
72
|
id: unit.unit_id,
|
|
73
73
|
actions,
|
|
74
74
|
hiddenActions
|
|
75
75
|
}),
|
|
76
|
-
|
|
76
|
+
panel_module.default("div.unit-details-content-holder", content)
|
|
77
77
|
]);
|
|
78
78
|
const clickHandlerForItem = React.useMemo(() => {
|
|
79
79
|
if (onSelectUnit == null && onClickItem == null) return null;
|
|
80
80
|
return (item) => {
|
|
81
81
|
if ("unit_id" in item && !("col_id" in item)) {
|
|
82
82
|
return (event) => {
|
|
83
|
-
onSelectUnit
|
|
83
|
+
if (onSelectUnit != null) {
|
|
84
|
+
onSelectUnit(item.unit_id);
|
|
85
|
+
} else if (onClickItem != null) {
|
|
86
|
+
console.warn(
|
|
87
|
+
"Unit selection: onClickItem is defined but onSelectUnit is not; ignoring click"
|
|
88
|
+
);
|
|
89
|
+
}
|
|
84
90
|
event.preventDefault();
|
|
85
91
|
};
|
|
86
92
|
}
|
|
@@ -88,7 +94,7 @@ function UnitDetailsPanel({
|
|
|
88
94
|
};
|
|
89
95
|
}, [onSelectUnit, onClickItem]);
|
|
90
96
|
if (clickHandlerForItem != null) {
|
|
91
|
-
return
|
|
97
|
+
return panel_module.default(
|
|
92
98
|
dataComponents.MacrostratInteractionProvider,
|
|
93
99
|
{
|
|
94
100
|
clickHandlerForItem,
|
|
@@ -106,23 +112,23 @@ function LegendPanelHeader({
|
|
|
106
112
|
actions = null,
|
|
107
113
|
hiddenActions
|
|
108
114
|
}) {
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
return panel_module.default("header.legend-panel-header", [
|
|
116
|
+
panel_module.default("div.title-container", [
|
|
117
|
+
panel_module.default.if(title != null)("h3", title),
|
|
118
|
+
panel_module.default.if(hiddenActions != null)(
|
|
113
119
|
"span.hidden-actions-container",
|
|
114
|
-
|
|
120
|
+
panel_module.default("div.hidden-actions", hiddenActions)
|
|
115
121
|
)
|
|
116
122
|
]),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
panel_module.default("div.spacer"),
|
|
124
|
+
panel_module.default.if(id != null)("code.unit-id", id),
|
|
125
|
+
panel_module.default.if(actions != null)(core.ButtonGroup, { minimal: true }, actions),
|
|
126
|
+
panel_module.default.if(onClose != null)(core.Button, {
|
|
121
127
|
icon: "cross",
|
|
122
128
|
minimal: true,
|
|
123
129
|
small: true,
|
|
124
130
|
onClick() {
|
|
125
|
-
onClose();
|
|
131
|
+
onClose?.();
|
|
126
132
|
}
|
|
127
133
|
})
|
|
128
134
|
]);
|
|
@@ -163,7 +169,7 @@ function UnitDetailsContent({
|
|
|
163
169
|
if (outcrop == "both") {
|
|
164
170
|
outcrop = "surface and subsurface";
|
|
165
171
|
}
|
|
166
|
-
outcropField =
|
|
172
|
+
outcropField = panel_module.default(dataComponents.DataField, {
|
|
167
173
|
label: "Outcrop",
|
|
168
174
|
value: outcrop
|
|
169
175
|
});
|
|
@@ -177,17 +183,17 @@ function UnitDetailsContent({
|
|
|
177
183
|
unit.min_thick != 0) {
|
|
178
184
|
const label = unit.t_pos < unit.b_pos ? "Depth" : "Height";
|
|
179
185
|
const u1 = "m";
|
|
180
|
-
thicknessOrHeightRange =
|
|
186
|
+
thicknessOrHeightRange = panel_module.default(dataComponents.DataField, {
|
|
181
187
|
unit: u1,
|
|
182
188
|
label,
|
|
183
189
|
value: utils.formatRange(unit.b_pos, unit.t_pos),
|
|
184
|
-
children:
|
|
190
|
+
children: panel_module.default(
|
|
185
191
|
dataComponents.Parenthetical,
|
|
186
|
-
|
|
192
|
+
panel_module.default(dataComponents.Value, { value: thickness, unit: thicknessUnit })
|
|
187
193
|
)
|
|
188
194
|
});
|
|
189
195
|
}
|
|
190
|
-
thicknessOrHeightRange ??=
|
|
196
|
+
thicknessOrHeightRange ??= panel_module.default(dataComponents.DataField, {
|
|
191
197
|
label: "Thickness",
|
|
192
198
|
value: thickness,
|
|
193
199
|
unit: thicknessUnit
|
|
@@ -198,60 +204,60 @@ function UnitDetailsContent({
|
|
|
198
204
|
/* Color */
|
|
199
205
|
)) {
|
|
200
206
|
const unit1 = unit;
|
|
201
|
-
colorSwatch =
|
|
207
|
+
colorSwatch = panel_module.default("div.color-swatch", {
|
|
202
208
|
style: { backgroundColor: unit1.color }
|
|
203
209
|
});
|
|
204
210
|
}
|
|
205
|
-
return
|
|
206
|
-
|
|
211
|
+
return panel_module.default("div.unit-details-content", [
|
|
212
|
+
panel_module.default.if(features.has(
|
|
207
213
|
"column-name"
|
|
208
214
|
/* ColumnName */
|
|
209
215
|
))(ColumnNameField, {
|
|
210
216
|
col_id: unit.col_id
|
|
211
217
|
}),
|
|
212
218
|
thicknessOrHeightRange,
|
|
213
|
-
|
|
219
|
+
panel_module.default.if(lithologies != null)(dataComponents.LithologyList, {
|
|
214
220
|
label: "Lithology",
|
|
215
|
-
lithologies,
|
|
221
|
+
lithologies: lithologies ?? [],
|
|
216
222
|
features: lithologyFeatures
|
|
217
223
|
}),
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
panel_module.default(ageRange.AgeField, { unit }, [
|
|
225
|
+
panel_module.default(dataComponents.Parenthetical, panel_module.default(ageRange.Duration, { value: unit.b_age - unit.t_age })),
|
|
226
|
+
panel_module.default(ageRange.IntervalProportions, {
|
|
221
227
|
unit,
|
|
222
228
|
onClickItem
|
|
223
229
|
})
|
|
224
230
|
]),
|
|
225
|
-
|
|
231
|
+
panel_module.default.if(environments != null)(dataComponents.EnvironmentsList, {
|
|
226
232
|
environments
|
|
227
233
|
}),
|
|
228
|
-
|
|
234
|
+
panel_module.default.if(unit.strat_name_id != null)(stratNames.StratNameField, {
|
|
229
235
|
strat_name_id: unit.strat_name_id
|
|
230
236
|
}),
|
|
231
237
|
outcropField,
|
|
232
|
-
|
|
238
|
+
panel_module.default.if(features.has(
|
|
233
239
|
"adjacent-units"
|
|
234
240
|
/* AdjacentUnits */
|
|
235
241
|
))([
|
|
236
|
-
|
|
242
|
+
panel_module.default.if(unit.units_above != null)(
|
|
237
243
|
dataComponents.DataField,
|
|
238
244
|
{ label: "Above" },
|
|
239
|
-
|
|
245
|
+
panel_module.default(UnitIDList, {
|
|
240
246
|
units: unit.units_above,
|
|
241
247
|
showNames: true
|
|
242
248
|
})
|
|
243
249
|
),
|
|
244
|
-
|
|
250
|
+
panel_module.default.if(unit.units_below != null)(
|
|
245
251
|
dataComponents.DataField,
|
|
246
252
|
{ label: "Below" },
|
|
247
|
-
|
|
253
|
+
panel_module.default(UnitIDList, {
|
|
248
254
|
units: unit.units_below,
|
|
249
255
|
showNames: true
|
|
250
256
|
})
|
|
251
257
|
)
|
|
252
258
|
]),
|
|
253
259
|
colorSwatch,
|
|
254
|
-
|
|
260
|
+
panel_module.default(ReferencesField, { refs: unit.refs, inline: true })
|
|
255
261
|
]);
|
|
256
262
|
}
|
|
257
263
|
function ColumnNameField({
|
|
@@ -259,15 +265,15 @@ function ColumnNameField({
|
|
|
259
265
|
showIdentifier = false
|
|
260
266
|
}) {
|
|
261
267
|
const colData = dataProvider.useMacrostratColumnInfo(col_id);
|
|
262
|
-
let inner =
|
|
268
|
+
let inner = panel_module.default(identifiers.Identifier, { id: col_id });
|
|
263
269
|
const name = colData?.col_name;
|
|
264
270
|
if (name != null) {
|
|
265
|
-
inner =
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
inner = panel_module.default("span.value", [
|
|
272
|
+
panel_module.default("span.col-name", name),
|
|
273
|
+
panel_module.default.if(showIdentifier)([" ", panel_module.default(dataComponents.Parenthetical, inner)])
|
|
268
274
|
]);
|
|
269
275
|
}
|
|
270
|
-
return
|
|
276
|
+
return panel_module.default(
|
|
271
277
|
dataComponents.DataField,
|
|
272
278
|
{
|
|
273
279
|
label: "Column"
|
|
@@ -279,47 +285,14 @@ function ReferencesField({ refs, className = null, ...rest }) {
|
|
|
279
285
|
if (refs == null || refs.length === 0) {
|
|
280
286
|
return null;
|
|
281
287
|
}
|
|
282
|
-
return
|
|
288
|
+
return panel_module.default(
|
|
283
289
|
dataComponents.DataField,
|
|
284
290
|
{
|
|
285
291
|
label: "References",
|
|
286
292
|
className: classNames__default.default("refs-field", className),
|
|
287
293
|
...rest
|
|
288
294
|
},
|
|
289
|
-
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
function useStratNameData(strat_name_id) {
|
|
293
|
-
const stratNames = dataProvider.useStratNames([strat_name_id]);
|
|
294
|
-
return stratNames?.[0];
|
|
295
|
-
}
|
|
296
|
-
function StratNameField(props) {
|
|
297
|
-
const { strat_name_id, className, ...rest } = props;
|
|
298
|
-
const data = useStratNameData(strat_name_id);
|
|
299
|
-
const baseInteractionProps = dataComponents.useInteractionProps({ strat_name_id });
|
|
300
|
-
const coreProps = {
|
|
301
|
-
...baseInteractionProps,
|
|
302
|
-
...rest
|
|
303
|
-
};
|
|
304
|
-
let inner = h(Identifier, { id: strat_name_id });
|
|
305
|
-
const name = data?.strat_name_long;
|
|
306
|
-
if (name != null) {
|
|
307
|
-
inner = h("span.strat-name", name);
|
|
308
|
-
}
|
|
309
|
-
const clickable = dataComponents.isClickable(coreProps);
|
|
310
|
-
return h(
|
|
311
|
-
dataComponents.DataField,
|
|
312
|
-
{
|
|
313
|
-
label: "Stratigraphic name"
|
|
314
|
-
},
|
|
315
|
-
h(
|
|
316
|
-
clickable ? "a" : "span",
|
|
317
|
-
{
|
|
318
|
-
className: classNames__default.default({ clickable }, className),
|
|
319
|
-
...coreProps
|
|
320
|
-
},
|
|
321
|
-
inner
|
|
322
|
-
)
|
|
295
|
+
panel_module.default(BibInfo, { refs })
|
|
323
296
|
);
|
|
324
297
|
}
|
|
325
298
|
function getThickness(unit) {
|
|
@@ -345,7 +318,7 @@ function getThickness(unit) {
|
|
|
345
318
|
}
|
|
346
319
|
function ThicknessField({ unit, label = "Thickness" }) {
|
|
347
320
|
const [value, thicknessUnit] = getThickness(unit);
|
|
348
|
-
return
|
|
321
|
+
return panel_module.default(dataComponents.DataField, {
|
|
349
322
|
label,
|
|
350
323
|
value,
|
|
351
324
|
unit: thicknessUnit
|
|
@@ -357,26 +330,26 @@ function BibInfo({ refs }) {
|
|
|
357
330
|
return null;
|
|
358
331
|
}
|
|
359
332
|
if (refData.length == 1) {
|
|
360
|
-
return
|
|
333
|
+
return panel_module.default(Citation, {
|
|
361
334
|
data: refData[0],
|
|
362
335
|
tag: "span",
|
|
363
336
|
key: refData[0].ref_id
|
|
364
337
|
});
|
|
365
338
|
}
|
|
366
|
-
return
|
|
339
|
+
return panel_module.default(
|
|
367
340
|
"ul.refs",
|
|
368
341
|
refData.map(
|
|
369
|
-
(data, i) =>
|
|
342
|
+
(data, i) => panel_module.default(Citation, { data, tag: "li", key: data.ref_id })
|
|
370
343
|
)
|
|
371
344
|
);
|
|
372
345
|
}
|
|
373
346
|
function Citation({ data, tag = "p" }) {
|
|
374
|
-
return
|
|
375
|
-
|
|
347
|
+
return panel_module.default(tag, { className: "citation" }, [
|
|
348
|
+
panel_module.default("span.authors", data.author),
|
|
376
349
|
", ",
|
|
377
|
-
|
|
350
|
+
panel_module.default("span.year", data.pub_year),
|
|
378
351
|
", ",
|
|
379
|
-
|
|
352
|
+
panel_module.default("span.title", data.ref)
|
|
380
353
|
]);
|
|
381
354
|
}
|
|
382
355
|
function enhanceEnvironments(environments, envMap) {
|
|
@@ -397,28 +370,6 @@ function enhanceLithologies(lithologies, lithMap) {
|
|
|
397
370
|
};
|
|
398
371
|
});
|
|
399
372
|
}
|
|
400
|
-
function ClickableText({
|
|
401
|
-
className,
|
|
402
|
-
...rest
|
|
403
|
-
}) {
|
|
404
|
-
const clickable = dataComponents.isClickable(rest);
|
|
405
|
-
const tag = clickable ? "a" : "span";
|
|
406
|
-
return h(tag, { className: classNames__default.default(className, { clickable }), ...rest });
|
|
407
|
-
}
|
|
408
|
-
function Identifier({
|
|
409
|
-
id,
|
|
410
|
-
className,
|
|
411
|
-
...rest
|
|
412
|
-
}) {
|
|
413
|
-
return h(
|
|
414
|
-
ClickableText,
|
|
415
|
-
{
|
|
416
|
-
className: classNames__default.default("identifier", className),
|
|
417
|
-
...rest
|
|
418
|
-
},
|
|
419
|
-
id
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
373
|
function UnitIDList({ units, showNames = false }) {
|
|
423
374
|
const unitsMap = store.useColumnUnitsMap();
|
|
424
375
|
const interactionManager = dataComponents.useInteractionManager();
|
|
@@ -427,7 +378,7 @@ function UnitIDList({ units, showNames = false }) {
|
|
|
427
378
|
if (showNames) {
|
|
428
379
|
return u1.map((unitID) => {
|
|
429
380
|
const unitData = unitsMap?.get(unitID);
|
|
430
|
-
let name =
|
|
381
|
+
let name = null;
|
|
431
382
|
if (unitData != null) {
|
|
432
383
|
name = names.defaultNameFunction(unitData);
|
|
433
384
|
}
|
|
@@ -442,15 +393,15 @@ function UnitIDList({ units, showNames = false }) {
|
|
|
442
393
|
}
|
|
443
394
|
}, [units, unitsMap]);
|
|
444
395
|
if (extUnits.length === 0) {
|
|
445
|
-
return
|
|
396
|
+
return panel_module.default("span.no-units", "None");
|
|
446
397
|
}
|
|
447
|
-
return
|
|
398
|
+
return panel_module.default(
|
|
448
399
|
dataComponents.ItemList,
|
|
449
400
|
{ className: "units-list" },
|
|
450
401
|
extUnits.map((info) => {
|
|
451
|
-
return
|
|
402
|
+
return panel_module.default(
|
|
452
403
|
"span.item",
|
|
453
|
-
|
|
404
|
+
panel_module.default(identifiers.UnitIdentifier, {
|
|
454
405
|
...info,
|
|
455
406
|
...interactionManager?.interactionPropsForItem({
|
|
456
407
|
unit_id: info.unitID
|
|
@@ -460,31 +411,6 @@ function UnitIDList({ units, showNames = false }) {
|
|
|
460
411
|
})
|
|
461
412
|
);
|
|
462
413
|
}
|
|
463
|
-
function UnitIdentifier({
|
|
464
|
-
unitID,
|
|
465
|
-
colID,
|
|
466
|
-
name,
|
|
467
|
-
...interactionProps
|
|
468
|
-
}) {
|
|
469
|
-
if (name != null) {
|
|
470
|
-
return h(
|
|
471
|
-
ClickableText,
|
|
472
|
-
{
|
|
473
|
-
className: "unit-name",
|
|
474
|
-
...interactionProps
|
|
475
|
-
},
|
|
476
|
-
name
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
return h(Identifier, {
|
|
480
|
-
className: "unit-id",
|
|
481
|
-
key: unitID,
|
|
482
|
-
id: unitID,
|
|
483
|
-
...interactionProps
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
exports.ClickableText = ClickableText;
|
|
487
|
-
exports.Identifier = Identifier;
|
|
488
414
|
exports.LegendPanelHeader = LegendPanelHeader;
|
|
489
415
|
exports.ReferencesField = ReferencesField;
|
|
490
416
|
exports.ThicknessField = ThicknessField;
|