col-browser 2.6.6 → 2.7.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/README.md +5 -4
- package/es/chunks/TaxonBreakdown-CyHl1YES.js +174 -0
- package/es/chunks/TaxonBreakdown-CyHl1YES.js.map +1 -0
- package/es/taxon.js +703 -691
- package/es/taxon.js.map +1 -1
- package/es/taxonBreakdown.js +26 -29
- package/es/taxonBreakdown.js.map +1 -1
- package/es/tree.js +360 -356
- package/es/tree.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +5 -2
- package/umd/col-browser.js +84 -118
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +4 -4
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/TaxonBreakdown-DqdQ18QM.js +0 -210
- package/es/chunks/TaxonBreakdown-DqdQ18QM.js.map +0 -1
package/umd/col-browser.js
CHANGED
|
@@ -68668,7 +68668,7 @@ html body {
|
|
|
68668
68668
|
if (defaultExpandKey) {
|
|
68669
68669
|
return this.expandToTaxon(defaultExpandKey);
|
|
68670
68670
|
} else if (defaultTaxonKey) {
|
|
68671
|
-
return this.expandToTaxon(defaultTaxonKey);
|
|
68671
|
+
return this.expandToTaxon(defaultTaxonKey, false);
|
|
68672
68672
|
}
|
|
68673
68673
|
}
|
|
68674
68674
|
);
|
|
@@ -68685,7 +68685,7 @@ html body {
|
|
|
68685
68685
|
});
|
|
68686
68686
|
});
|
|
68687
68687
|
});
|
|
68688
|
-
__publicField(this, "expandToTaxon", async (defaultExpandKey) => {
|
|
68688
|
+
__publicField(this, "expandToTaxon", async (defaultExpandKey, scrollToTaxon = true) => {
|
|
68689
68689
|
const {
|
|
68690
68690
|
showSourceTaxon,
|
|
68691
68691
|
datasetKey,
|
|
@@ -68764,7 +68764,7 @@ html body {
|
|
|
68764
68764
|
const loadedKeys = [...data.map((t2) => t2.id).reverse()];
|
|
68765
68765
|
this.setState(
|
|
68766
68766
|
{ treeData },
|
|
68767
|
-
() => this.reloadLoadedKeys(loadedKeys, defaultExpandKey)
|
|
68767
|
+
() => this.reloadLoadedKeys(loadedKeys, defaultExpandKey, true, scrollToTaxon)
|
|
68768
68768
|
);
|
|
68769
68769
|
});
|
|
68770
68770
|
__publicField(this, "fetchChildPage", async (dataRef, reloadAll, dontUpdateState) => {
|
|
@@ -68893,7 +68893,7 @@ html body {
|
|
|
68893
68893
|
}
|
|
68894
68894
|
return node2;
|
|
68895
68895
|
});
|
|
68896
|
-
__publicField(this, "reloadLoadedKeys", async (keys2, expandKey, expandAll = true) => {
|
|
68896
|
+
__publicField(this, "reloadLoadedKeys", async (keys2, expandKey, expandAll = true, scrollToTaxon = true) => {
|
|
68897
68897
|
this.setState({ rootLoading: true });
|
|
68898
68898
|
const { loadedKeys: storedKeys } = this.state;
|
|
68899
68899
|
let { treeData } = this.state;
|
|
@@ -68946,6 +68946,7 @@ html body {
|
|
|
68946
68946
|
);
|
|
68947
68947
|
if (targetNode) {
|
|
68948
68948
|
this.setState({ treeData: [...this.state.treeData] }, () => {
|
|
68949
|
+
if (!scrollToTaxon) return;
|
|
68949
68950
|
setTimeout(() => {
|
|
68950
68951
|
const elmnt = document.getElementById(expandKey);
|
|
68951
68952
|
elmnt.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -68977,7 +68978,7 @@ html body {
|
|
|
68977
68978
|
newState.expandedKeys = loadedKeys;
|
|
68978
68979
|
}
|
|
68979
68980
|
this.setState(newState, () => {
|
|
68980
|
-
if (expandKey) {
|
|
68981
|
+
if (expandKey && scrollToTaxon) {
|
|
68981
68982
|
setTimeout(() => {
|
|
68982
68983
|
const elmnt = document.getElementById(expandKey);
|
|
68983
68984
|
elmnt.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -69638,7 +69639,8 @@ html body {
|
|
|
69638
69639
|
linkToSpeciesPage,
|
|
69639
69640
|
citation,
|
|
69640
69641
|
type: type2,
|
|
69641
|
-
insertPlaceholder = true
|
|
69642
|
+
insertPlaceholder = true,
|
|
69643
|
+
autoFocus
|
|
69642
69644
|
} = this.props;
|
|
69643
69645
|
const { hideExtinct, dataset } = this.state;
|
|
69644
69646
|
const handleSelectName = (name) => {
|
|
@@ -69673,7 +69675,8 @@ html body {
|
|
|
69673
69675
|
},
|
|
69674
69676
|
defaultTaxonKey: expandedTaxonKey || null,
|
|
69675
69677
|
onSelectName: handleSelectName,
|
|
69676
|
-
onResetSearch: handleResetSearch
|
|
69678
|
+
onResetSearch: handleResetSearch,
|
|
69679
|
+
autoFocus
|
|
69677
69680
|
}
|
|
69678
69681
|
) }),
|
|
69679
69682
|
showTreeOptions && /* @__PURE__ */ jsxRuntimeExports.jsxs(Col, { style: { paddingLeft: "8px" }, children: [
|
|
@@ -69743,6 +69746,7 @@ html body {
|
|
|
69743
69746
|
citation,
|
|
69744
69747
|
type: type2,
|
|
69745
69748
|
insertPlaceholder,
|
|
69749
|
+
autoFocus,
|
|
69746
69750
|
auth,
|
|
69747
69751
|
...routerProps
|
|
69748
69752
|
}) {
|
|
@@ -69758,6 +69762,7 @@ html body {
|
|
|
69758
69762
|
citation,
|
|
69759
69763
|
type: type2,
|
|
69760
69764
|
insertPlaceholder,
|
|
69765
|
+
autoFocus,
|
|
69761
69766
|
auth
|
|
69762
69767
|
}
|
|
69763
69768
|
) });
|
|
@@ -77494,7 +77499,7 @@ html body {
|
|
|
77494
77499
|
] }) });
|
|
77495
77500
|
};
|
|
77496
77501
|
const TypeMaterial = ({ dataset, data, nameID, style: style2 }) => {
|
|
77497
|
-
return data[nameID] ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: style2, children: data[nameID].map((s) => /* @__PURE__ */ jsxRuntimeExports.jsx(BorderedListItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
77502
|
+
return data[nameID] ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: style2, children: data[nameID].map(({ status, nameId, typeMaterial: s }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BorderedListItem$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
77498
77503
|
XrGutter,
|
|
77499
77504
|
{
|
|
77500
77505
|
merged: s.merged,
|
|
@@ -77503,7 +77508,7 @@ html body {
|
|
|
77503
77508
|
verbatimSourceKey: s == null ? void 0 : s.verbatimSourceKey,
|
|
77504
77509
|
sourceDatasetKey: s == null ? void 0 : s.sourceDatasetKey,
|
|
77505
77510
|
children: [
|
|
77506
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: getTypeColor(
|
|
77511
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: getTypeColor(status), children: status }),
|
|
77507
77512
|
" ",
|
|
77508
77513
|
getLinks(dataset, s),
|
|
77509
77514
|
" ",
|
|
@@ -77515,7 +77520,7 @@ html body {
|
|
|
77515
77520
|
)
|
|
77516
77521
|
]
|
|
77517
77522
|
}
|
|
77518
|
-
) }, s.id)) }) : null;
|
|
77523
|
+
) }, `${s.id}-${nameId}`)) }) : null;
|
|
77519
77524
|
};
|
|
77520
77525
|
class TypeMaterialPopover extends React.Component {
|
|
77521
77526
|
constructor(props) {
|
|
@@ -77539,8 +77544,8 @@ html body {
|
|
|
77539
77544
|
const { typeMaterial, nameId } = this.props;
|
|
77540
77545
|
const data = (typeMaterial == null ? void 0 : typeMaterial[nameId]) || [];
|
|
77541
77546
|
if (data.length > 0) {
|
|
77542
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: data.map((s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginBottom: "8px", paddingLeft: "18px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(XrGutter, { merged: s.merged, children: [
|
|
77543
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: getTypeColor(
|
|
77547
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: data.map(({ status, nameId: nameId2, typeMaterial: s }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginBottom: "8px", paddingLeft: "18px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(XrGutter, { merged: s.merged, children: [
|
|
77548
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: getTypeColor(status), children: status }),
|
|
77544
77549
|
" ",
|
|
77545
77550
|
(s == null ? void 0 : s.citation) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
77546
77551
|
"span",
|
|
@@ -77550,7 +77555,7 @@ html body {
|
|
|
77550
77555
|
}
|
|
77551
77556
|
}
|
|
77552
77557
|
)
|
|
77553
|
-
] }) }, s.id)) });
|
|
77558
|
+
] }) }, `${s.id}-${nameId2}`)) });
|
|
77554
77559
|
}
|
|
77555
77560
|
});
|
|
77556
77561
|
__publicField(this, "render", () => {
|
|
@@ -86837,38 +86842,19 @@ html body {
|
|
|
86837
86842
|
const HighchartsReact = /* @__PURE__ */ getDefaultExportFromCjs(highchartsReact_minExports);
|
|
86838
86843
|
const BREAKDOWN_LEVEL_KEY = "breakdown-level";
|
|
86839
86844
|
const MAX_SLICES_PER_RING = 100;
|
|
86840
|
-
const canonicalRanks = [
|
|
86841
|
-
"kingdom",
|
|
86842
|
-
"phylum",
|
|
86843
|
-
"class",
|
|
86844
|
-
"order",
|
|
86845
|
-
"family",
|
|
86846
|
-
"genus",
|
|
86847
|
-
"species"
|
|
86848
|
-
];
|
|
86849
86845
|
const notAssignedLabel = (rk) => rk ? `Not assigned ${rk}` : "Not assigned";
|
|
86850
|
-
const
|
|
86851
|
-
|
|
86852
|
-
const
|
|
86853
|
-
|
|
86854
|
-
|
|
86855
|
-
|
|
86856
|
-
|
|
86857
|
-
|
|
86858
|
-
if (sum >= parentSpecies) return sorted;
|
|
86859
|
-
return [
|
|
86860
|
-
...sorted,
|
|
86861
|
-
{
|
|
86862
|
-
name: notAssignedLabel(get(sorted, "[0].rank", "")),
|
|
86863
|
-
species: parentSpecies - sum,
|
|
86864
|
-
children: []
|
|
86865
|
-
}
|
|
86866
|
-
];
|
|
86846
|
+
const ringNodes = (nodes, parentCount) => {
|
|
86847
|
+
const named = (nodes || []).filter((n2) => n2.id).sort((a, b2) => (b2.count || 0) - (a.count || 0)).slice(0, MAX_SLICES_PER_RING);
|
|
86848
|
+
const sum = named.reduce((a, n2) => a + (n2.count || 0), 0);
|
|
86849
|
+
const rank = get(nodes, "[0].rank", "");
|
|
86850
|
+
return sum < parentCount ? [
|
|
86851
|
+
...named,
|
|
86852
|
+
{ name: notAssignedLabel(rank), count: parentCount - sum, children: [] }
|
|
86853
|
+
] : named;
|
|
86867
86854
|
};
|
|
86868
86855
|
const TaxonBreakdown$1 = ({
|
|
86869
86856
|
taxon,
|
|
86870
86857
|
datasetKey,
|
|
86871
|
-
rank = [],
|
|
86872
86858
|
dataset,
|
|
86873
86859
|
level = 1,
|
|
86874
86860
|
showLevelSwitch = false,
|
|
@@ -86892,57 +86878,29 @@ html body {
|
|
|
86892
86878
|
getData();
|
|
86893
86879
|
}
|
|
86894
86880
|
}, [taxon, datasetKey, activeLevel]);
|
|
86895
|
-
const getOverView = async () => {
|
|
86896
|
-
const res = await client(
|
|
86897
|
-
`${config.dataApi}dataset/${datasetKey}/nameusage/search?TAXON_ID=${encodeURIComponent(
|
|
86898
|
-
taxon.id
|
|
86899
|
-
)}&facet=rank&status=accepted&status=provisionally%20accepted&limit=0`
|
|
86900
|
-
);
|
|
86901
|
-
return keyBy(get(res, "data.facets.rank", []), "value");
|
|
86902
|
-
};
|
|
86903
86881
|
const getData = async () => {
|
|
86904
86882
|
setLoading(true);
|
|
86905
86883
|
try {
|
|
86906
|
-
const counts = await getOverView();
|
|
86907
|
-
const ranks2 = canonicalRanks;
|
|
86908
|
-
let taxonRankIdx = ranks2.indexOf(get(taxon, "name.rank"));
|
|
86909
|
-
if (taxonRankIdx === -1) {
|
|
86910
|
-
let rankIndex2 = rank.indexOf(get(taxon, "name.rank")) + 1;
|
|
86911
|
-
while (taxonRankIdx === -1 && rankIndex2 < rank.length - 1) {
|
|
86912
|
-
const canonicalRankIndex = ranks2.indexOf(rank[rankIndex2]);
|
|
86913
|
-
if (canonicalRankIndex > -1) {
|
|
86914
|
-
taxonRankIdx = canonicalRankIndex - 1;
|
|
86915
|
-
}
|
|
86916
|
-
rankIndex2++;
|
|
86917
|
-
}
|
|
86918
|
-
}
|
|
86919
|
-
let childRank;
|
|
86920
|
-
let childRankIndex = taxonRankIdx + 1;
|
|
86921
|
-
while (!childRank && childRankIndex < ranks2.length) {
|
|
86922
|
-
const nextRank = get(ranks2, `[${childRankIndex}]`);
|
|
86923
|
-
if (nextRank && get(counts, `${nextRank}.count`, 0) > 0) {
|
|
86924
|
-
childRank = nextRank;
|
|
86925
|
-
} else {
|
|
86926
|
-
childRankIndex++;
|
|
86927
|
-
}
|
|
86928
|
-
}
|
|
86929
|
-
if (!childRank) {
|
|
86930
|
-
setInvalid(true);
|
|
86931
|
-
setLoading(false);
|
|
86932
|
-
return;
|
|
86933
|
-
}
|
|
86934
86884
|
const res = await client(
|
|
86935
|
-
`${config.dataApi}dataset/${datasetKey}/taxon/${
|
|
86885
|
+
`${config.dataApi}dataset/${datasetKey}/taxon/${encodeURIComponent(
|
|
86886
|
+
taxon.id
|
|
86887
|
+
)}/breakdown?level=${activeLevel}`
|
|
86936
86888
|
);
|
|
86937
|
-
const
|
|
86938
|
-
const totalSpecies = get(counts, "species.count", 0);
|
|
86889
|
+
const bd = res.data || {};
|
|
86939
86890
|
setLoading(false);
|
|
86940
|
-
|
|
86891
|
+
if (!bd.countRank || !bd.children || bd.children.length === 0) {
|
|
86892
|
+
setInvalid(true);
|
|
86893
|
+
return;
|
|
86894
|
+
}
|
|
86895
|
+
setInvalid(false);
|
|
86896
|
+
buildChart(bd);
|
|
86941
86897
|
} catch (err) {
|
|
86942
86898
|
setLoading(false);
|
|
86899
|
+
setInvalid(true);
|
|
86943
86900
|
}
|
|
86944
86901
|
};
|
|
86945
|
-
const buildChart = (children,
|
|
86902
|
+
const buildChart = ({ children, total, countRank }) => {
|
|
86903
|
+
const seriesName = startCase(countRank === "genus" ? "genera" : countRank);
|
|
86946
86904
|
const DOI = dataset.doi ? "https://doi.org/" + dataset.doi : null;
|
|
86947
86905
|
const baseColors = Highcharts.getOptions().colors;
|
|
86948
86906
|
const prefersDark = typeof darkMode === "boolean" ? darkMode : typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -86954,33 +86912,33 @@ html body {
|
|
|
86954
86912
|
}
|
|
86955
86913
|
}
|
|
86956
86914
|
};
|
|
86957
|
-
const innerNodes =
|
|
86915
|
+
const innerNodes = ringNodes(children, total);
|
|
86958
86916
|
const innerData = innerNodes.map((n2, i) => ({
|
|
86959
86917
|
name: n2.name,
|
|
86960
|
-
y: n2.
|
|
86918
|
+
y: n2.count,
|
|
86961
86919
|
_id: n2.id,
|
|
86962
86920
|
color: baseColors[i % baseColors.length],
|
|
86963
86921
|
_kids: n2.children
|
|
86964
86922
|
}));
|
|
86965
86923
|
const outerData = [];
|
|
86966
|
-
const hasOuterData =
|
|
86924
|
+
const hasOuterData = innerData.some((s) => s._kids && s._kids.length > 0);
|
|
86967
86925
|
if (hasOuterData) {
|
|
86968
86926
|
innerData.forEach((slice2) => {
|
|
86969
|
-
const sorted =
|
|
86970
|
-
const sum = sorted.reduce((a, n2) => a + (n2.
|
|
86927
|
+
const sorted = (slice2._kids || []).filter((n2) => n2.id).sort((a, b2) => (b2.count || 0) - (a.count || 0)).slice(0, MAX_SLICES_PER_RING);
|
|
86928
|
+
const sum = sorted.reduce((a, n2) => a + (n2.count || 0), 0);
|
|
86971
86929
|
sorted.forEach((g2, j2) => {
|
|
86972
86930
|
const t2 = sorted.length > 1 ? j2 / (sorted.length - 1) : 0;
|
|
86973
86931
|
const shift = -0.1 + t2 * 0.4;
|
|
86974
86932
|
outerData.push({
|
|
86975
86933
|
name: g2.name,
|
|
86976
|
-
y: g2.
|
|
86934
|
+
y: g2.count,
|
|
86977
86935
|
_id: g2.id,
|
|
86978
86936
|
color: Highcharts.color(slice2.color).brighten(shift).get()
|
|
86979
86937
|
});
|
|
86980
86938
|
});
|
|
86981
86939
|
if (sum < slice2.y) {
|
|
86982
86940
|
outerData.push({
|
|
86983
|
-
name: notAssignedLabel(get(
|
|
86941
|
+
name: notAssignedLabel(get(slice2._kids, "[0].rank", "")),
|
|
86984
86942
|
y: slice2.y - sum,
|
|
86985
86943
|
color: gapColor,
|
|
86986
86944
|
borderColor: gapColor,
|
|
@@ -86991,7 +86949,7 @@ html body {
|
|
|
86991
86949
|
});
|
|
86992
86950
|
}
|
|
86993
86951
|
const clean = (rows) => rows.map(({ _kids, ...rest }) => rest);
|
|
86994
|
-
const grandTotal =
|
|
86952
|
+
const grandTotal = total || innerData.reduce((a, s) => a + s.y, 0);
|
|
86995
86953
|
const innerLabelStyle = {
|
|
86996
86954
|
color: "contrast",
|
|
86997
86955
|
textOutline: "1px contrast",
|
|
@@ -87005,12 +86963,12 @@ html body {
|
|
|
87005
86963
|
style: innerLabelStyle
|
|
87006
86964
|
} : {
|
|
87007
86965
|
formatter: function() {
|
|
87008
|
-
return this.y >
|
|
86966
|
+
return this.y > 0 ? "<b>" + this.point.name + ":</b> " + this.y.toLocaleString("en-GB") : null;
|
|
87009
86967
|
}
|
|
87010
86968
|
};
|
|
87011
86969
|
const series = [
|
|
87012
86970
|
{
|
|
87013
|
-
name:
|
|
86971
|
+
name: seriesName,
|
|
87014
86972
|
data: clean(innerData),
|
|
87015
86973
|
size: hasOuterData ? "60%" : "85%",
|
|
87016
86974
|
dataLabels: innerDataLabels,
|
|
@@ -87019,13 +86977,13 @@ html body {
|
|
|
87019
86977
|
];
|
|
87020
86978
|
if (hasOuterData) {
|
|
87021
86979
|
series.push({
|
|
87022
|
-
name:
|
|
86980
|
+
name: seriesName,
|
|
87023
86981
|
data: outerData,
|
|
87024
86982
|
size: "85%",
|
|
87025
86983
|
innerSize: "60%",
|
|
87026
86984
|
dataLabels: {
|
|
87027
86985
|
formatter: function() {
|
|
87028
|
-
return this.y >
|
|
86986
|
+
return this.y > 0 ? "<b>" + this.point.name + ":</b> " + this.y.toLocaleString("en-GB") : null;
|
|
87029
86987
|
}
|
|
87030
86988
|
},
|
|
87031
86989
|
point: { events: taxonClickHandler }
|
|
@@ -87086,6 +87044,14 @@ html body {
|
|
|
87086
87044
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(HighchartsReact, { highcharts: Highcharts, options })
|
|
87087
87045
|
] });
|
|
87088
87046
|
};
|
|
87047
|
+
const groupBySource = (secondarySources) => Object.values(
|
|
87048
|
+
Object.entries(secondarySources || {}).reduce((groups, [key2, src]) => {
|
|
87049
|
+
const id = `${src.datasetKey}:${src.id}`;
|
|
87050
|
+
groups[id] = groups[id] || { id, src, keys: [] };
|
|
87051
|
+
groups[id].keys.push(key2);
|
|
87052
|
+
return groups;
|
|
87053
|
+
}, {})
|
|
87054
|
+
);
|
|
87089
87055
|
const SecondarySources = ({ info, datasetKey }) => {
|
|
87090
87056
|
var _a2, _b2;
|
|
87091
87057
|
const [datasets, setDatasets] = reactExports.useState({});
|
|
@@ -87113,20 +87079,20 @@ html body {
|
|
|
87113
87079
|
}
|
|
87114
87080
|
setDatasets(data);
|
|
87115
87081
|
};
|
|
87116
|
-
return ((_a2 = info == null ? void 0 : info.source) == null ? void 0 : _a2.secondarySources) ?
|
|
87117
|
-
var _a3
|
|
87082
|
+
return ((_a2 = info == null ? void 0 : info.source) == null ? void 0 : _a2.secondarySources) ? groupBySource((_b2 = info == null ? void 0 : info.source) == null ? void 0 : _b2.secondarySources).map(({ id, src, keys: keys2 }) => {
|
|
87083
|
+
var _a3;
|
|
87118
87084
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(React.Fragment, { children: [
|
|
87119
|
-
startCase(key2),
|
|
87085
|
+
keys2.map((key2) => startCase(key2)).join(", "),
|
|
87120
87086
|
":",
|
|
87121
87087
|
" ",
|
|
87122
87088
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
87123
87089
|
"a",
|
|
87124
87090
|
{
|
|
87125
|
-
href: `https://www.checklistbank.org/dataset/${
|
|
87126
|
-
children: ((
|
|
87091
|
+
href: `https://www.checklistbank.org/dataset/${src.datasetKey}/taxon/${encodeURIComponent(src.id)}`,
|
|
87092
|
+
children: ((_a3 = datasets[src.datasetKey]) == null ? void 0 : _a3.title) || src.datasetKey
|
|
87127
87093
|
}
|
|
87128
87094
|
)
|
|
87129
|
-
] },
|
|
87095
|
+
] }, id);
|
|
87130
87096
|
}) : null;
|
|
87131
87097
|
};
|
|
87132
87098
|
staticMethods.config({
|
|
@@ -88619,15 +88585,24 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88619
88585
|
(res) => this.setState({ rank: res.data.map((r2) => r2.name) })
|
|
88620
88586
|
);
|
|
88621
88587
|
});
|
|
88588
|
+
// Accepted descendants by rank. Read from the taxon metrics, a single row
|
|
88589
|
+
// lookup; only datasets without metrics (projects) fall back to a rank
|
|
88590
|
+
// facet search, which costs elasticsearch a lot more.
|
|
88622
88591
|
__publicField(this, "getIncludes", (taxonKey) => {
|
|
88623
88592
|
const { datasetKey } = this.props;
|
|
88624
|
-
|
|
88625
|
-
|
|
88626
|
-
|
|
88627
|
-
|
|
88628
|
-
|
|
88629
|
-
|
|
88630
|
-
|
|
88593
|
+
const base = `${config.dataApi}dataset/${datasetKey}`;
|
|
88594
|
+
client(`${base}/taxon/${encodeURIComponent(taxonKey)}/metrics`).then(
|
|
88595
|
+
(res) => Object.entries(get(res, "data.taxaByRankCount") || {}).map(
|
|
88596
|
+
([value, count]) => ({ value, count })
|
|
88597
|
+
)
|
|
88598
|
+
).catch(
|
|
88599
|
+
() => client(
|
|
88600
|
+
`${base}/nameusage/search?TAXON_ID=${encodeURIComponent(
|
|
88601
|
+
taxonKey
|
|
88602
|
+
)}&facet=rank&facetLimit=500&status=accepted&status=provisionally%20accepted&limit=0`
|
|
88603
|
+
).then((res) => get(res, "data.facets.rank") || [])
|
|
88604
|
+
).then((includes2) => {
|
|
88605
|
+
this.setState({ includesLoading: false, includes: includes2 });
|
|
88631
88606
|
}).catch((err) => {
|
|
88632
88607
|
this.setState({
|
|
88633
88608
|
includesLoading: false,
|
|
@@ -88956,12 +88931,11 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
88956
88931
|
{
|
|
88957
88932
|
taxon,
|
|
88958
88933
|
datasetKey,
|
|
88959
|
-
rank,
|
|
88960
88934
|
dataset: catalogue,
|
|
88961
88935
|
showLevelSwitch: true
|
|
88962
88936
|
}
|
|
88963
88937
|
) }),
|
|
88964
|
-
!isSynonym &&
|
|
88938
|
+
!isSynonym && rank && taxon && includes2.some((t2) => t2.value !== get(taxon, "name.rank")) && /* @__PURE__ */ jsxRuntimeExports.jsx(PresentationItem$1, { md, label: "Statistics", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
88965
88939
|
IncludesTable,
|
|
88966
88940
|
{
|
|
88967
88941
|
style: { marginTop: "-3px", marginLeft: "-3px" },
|
|
@@ -90044,29 +90018,21 @@ Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
|
90044
90018
|
setAuth(auth);
|
|
90045
90019
|
const [taxon, setTaxon] = reactExports.useState(null);
|
|
90046
90020
|
const [dataset, setDataset] = reactExports.useState(null);
|
|
90047
|
-
const [rank, setRank] = reactExports.useState([]);
|
|
90048
90021
|
reactExports.useEffect(() => {
|
|
90049
90022
|
if (taxonId && datasetKey) getTaxon();
|
|
90050
|
-
if (datasetKey)
|
|
90051
|
-
getDataset2();
|
|
90052
|
-
getRank();
|
|
90053
|
-
}
|
|
90023
|
+
if (datasetKey) getDataset2();
|
|
90054
90024
|
}, [taxonId, datasetKey]);
|
|
90055
|
-
const getRank = () => client(`${config.dataApi}vocab/rank`).then(
|
|
90056
|
-
(res) => setRank(res.data.map((r2) => r2.name))
|
|
90057
|
-
);
|
|
90058
90025
|
const getTaxon = () => client(`${config.dataApi}dataset/${datasetKey}/taxon/${taxonId}`).then(
|
|
90059
90026
|
(res) => setTaxon(res.data)
|
|
90060
90027
|
);
|
|
90061
90028
|
const getDataset2 = () => client(`${config.dataApi}dataset/${datasetKey}`).then(
|
|
90062
90029
|
(res) => setDataset(res.data)
|
|
90063
90030
|
);
|
|
90064
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContext.Provider, { value: buildRouter(routerProps), children: !!taxon && !!dataset
|
|
90031
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContext.Provider, { value: buildRouter(routerProps), children: !!taxon && !!dataset ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
90065
90032
|
TaxonBreakdown$1,
|
|
90066
90033
|
{
|
|
90067
90034
|
taxon,
|
|
90068
90035
|
datasetKey,
|
|
90069
|
-
rank,
|
|
90070
90036
|
dataset,
|
|
90071
90037
|
level,
|
|
90072
90038
|
showLevelSwitch,
|