col-browser 2.3.9 → 2.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/README.md +29 -0
- package/es/bibtex.js +2 -2
- package/es/chunks/{BibTex-CPaVr-5w.js → BibTex-79CCKAOK.js} +2 -2
- package/es/chunks/{BibTex-CPaVr-5w.js.map → BibTex-79CCKAOK.js.map} +1 -1
- package/es/chunks/{DatasetCitation-JpNSTWz-.js → DatasetCitation-BXtAmjdZ.js} +2 -2
- package/es/chunks/{DatasetCitation-JpNSTWz-.js.map → DatasetCitation-BXtAmjdZ.js.map} +1 -1
- package/es/chunks/{DatasetlogoWithFallback-BhWvpgDn.js → DatasetlogoWithFallback-Dava2uqZ.js} +2 -2
- package/es/chunks/{DatasetlogoWithFallback-BhWvpgDn.js.map → DatasetlogoWithFallback-Dava2uqZ.js.map} +1 -1
- package/es/chunks/{Distributions-CKn1-Qze.js → Distributions-Bd4hFYdS.js} +3 -3
- package/es/chunks/{Distributions-CKn1-Qze.js.map → Distributions-Bd4hFYdS.js.map} +1 -1
- package/es/chunks/{MergedDataBadge-DK4XUXsL.js → MergedDataBadge-C1CgoRFz.js} +2 -2
- package/es/chunks/{MergedDataBadge-DK4XUXsL.js.map → MergedDataBadge-C1CgoRFz.js.map} +1 -1
- package/es/chunks/{TaxonBreakdown-BYRnP8bH.js → TaxonBreakdown-DeWamLu_.js} +2 -2
- package/es/chunks/{TaxonBreakdown-BYRnP8bH.js.map → TaxonBreakdown-DeWamLu_.js.map} +1 -1
- package/es/chunks/{XrGutter-CORP2r5Y.js → XrGutter-CU7_QPAp.js} +2 -2
- package/es/chunks/{XrGutter-CORP2r5Y.js.map → XrGutter-CU7_QPAp.js.map} +1 -1
- package/es/chunks/config-D1NH4DTr.js +22 -0
- package/es/chunks/config-D1NH4DTr.js.map +1 -0
- package/es/chunks/{dataset-BuF063rn.js → dataset-BL6g4w0G.js} +2 -2
- package/es/chunks/{dataset-BuF063rn.js.map → dataset-BL6g4w0G.js.map} +1 -1
- package/es/chunks/{enumeration-CC8SblcI.js → enumeration-DM8Hb36g.js} +2 -2
- package/es/chunks/{enumeration-CC8SblcI.js.map → enumeration-DM8Hb36g.js.map} +1 -1
- package/es/chunks/{sector-Behb-WCC.js → sector-Qeo1zPxr.js} +2 -2
- package/es/chunks/{sector-Behb-WCC.js.map → sector-Qeo1zPxr.js.map} +1 -1
- package/es/chunks/withTheme-Dh6PRuII.js +17 -0
- package/es/chunks/withTheme-Dh6PRuII.js.map +1 -0
- package/es/config.js +5 -0
- package/es/config.js.map +1 -0
- package/es/index.js +4 -2
- package/es/index.js.map +1 -1
- package/es/search.js +14 -13
- package/es/search.js.map +1 -1
- package/es/sourceDataset.js +7 -6
- package/es/sourceDataset.js.map +1 -1
- package/es/sourceDatasetList.js +16 -15
- package/es/sourceDatasetList.js.map +1 -1
- package/es/taxon.js +215 -214
- package/es/taxon.js.map +1 -1
- package/es/taxonBreakdown.js +23 -22
- package/es/taxonBreakdown.js.map +1 -1
- package/es/taxonDistribution.js +20 -19
- package/es/taxonDistribution.js.map +1 -1
- package/es/tree.js +422 -411
- package/es/tree.js.map +1 -1
- package/package.json +5 -1
- package/types/config.d.ts +1 -0
- package/types/index.d.ts +21 -0
- package/umd/col-browser.js +42 -16
- 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/config-B2Z9BaEd.js +0 -30
- package/es/chunks/config-B2Z9BaEd.js.map +0 -1
package/es/tree.js
CHANGED
|
@@ -1,158 +1,159 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { j as
|
|
7
|
-
import j, { createContext as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { sortBy as
|
|
10
|
-
import { L, c as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var tt = (x, y, t) => y in x ? Y(x, y, { enumerable: !0, configurable: !0, writable: !0, value: t }) : x[y] = t;
|
|
3
|
+
var u = (x, y, t) => tt(x, typeof y != "symbol" ? y + "" : y, t);
|
|
4
|
+
import { a as et } from "./chunks/withDatasetKey-BgMY05XE.js";
|
|
5
|
+
import { w as st } from "./chunks/withTheme-Dh6PRuII.js";
|
|
6
|
+
import { j as e } from "./chunks/jsx-runtime-BzflLqGi.js";
|
|
7
|
+
import j, { createContext as at } from "react";
|
|
8
|
+
import { Popover as ot, Divider as it, Spin as q, Tag as nt, Alert as w, Skeleton as rt, Tree as lt, Button as dt, Row as ht, Col as I, Checkbox as N } from "antd";
|
|
9
|
+
import { sortBy as _, get as m, isUndefined as A, flatten as ct, isArray as O } from "lodash-es";
|
|
10
|
+
import { L as P, c as K, R as H, s as ut, b as pt } from "./chunks/router-CssZk5qZ.js";
|
|
11
|
+
import { c as D } from "./chunks/config-D1NH4DTr.js";
|
|
12
|
+
import L from "dataloader";
|
|
13
|
+
import { c as V, b as z, g as ft } from "./chunks/dataset-BL6g4w0G.js";
|
|
14
|
+
import { M as xt } from "./chunks/MergedDataBadge-C1CgoRFz.js";
|
|
15
|
+
import { E as gt } from "./chunks/ErrorMsg-K8k5PPTp.js";
|
|
16
|
+
import { g as yt } from "./chunks/sector-Qeo1zPxr.js";
|
|
17
|
+
import { C as R, N as mt } from "./chunks/DatasetCitation-BXtAmjdZ.js";
|
|
18
|
+
import { r as F, w as M } from "./chunks/storage-BgdCo9fV.js";
|
|
19
|
+
const E = at({
|
|
19
20
|
datasetLoader: null,
|
|
20
21
|
publisherLoader: null
|
|
21
|
-
}), B = (
|
|
22
|
-
datasetLoader: new
|
|
23
|
-
publisherLoader: new
|
|
24
|
-
(
|
|
22
|
+
}), B = (x) => ({
|
|
23
|
+
datasetLoader: new L((y) => z(y, x)),
|
|
24
|
+
publisherLoader: new L(
|
|
25
|
+
(y) => V(y, x)
|
|
25
26
|
)
|
|
26
27
|
});
|
|
27
|
-
class
|
|
28
|
-
constructor(
|
|
29
|
-
super(
|
|
28
|
+
class G extends j.Component {
|
|
29
|
+
constructor(t) {
|
|
30
|
+
super(t);
|
|
30
31
|
// Returns the shared cache from TreeCacheContext if available, or a
|
|
31
32
|
// throwaway local DataLoader so the popover still works even if context
|
|
32
33
|
// doesn't reach this instance (which used to leave the spinner stuck
|
|
33
34
|
// because getData early-returned with no loading state set).
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
const { datasetKey:
|
|
37
|
-
return (
|
|
38
|
-
(o) =>
|
|
35
|
+
u(this, "getDatasetLoader", () => {
|
|
36
|
+
var a;
|
|
37
|
+
const { datasetKey: t } = this.props;
|
|
38
|
+
return (a = this.context) != null && a.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new L(
|
|
39
|
+
(o) => z(o, t)
|
|
39
40
|
)), this._localDatasetLoader);
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
const { datasetKey:
|
|
44
|
-
return (
|
|
45
|
-
(o) =>
|
|
42
|
+
u(this, "getPublisherLoader", () => {
|
|
43
|
+
var a;
|
|
44
|
+
const { datasetKey: t } = this.props;
|
|
45
|
+
return (a = this.context) != null && a.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new L(
|
|
46
|
+
(o) => V(o, t)
|
|
46
47
|
)), this._localPublisherLoader);
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
-
const { sourceDatasetKeys:
|
|
50
|
-
|
|
49
|
+
u(this, "componentDidMount", () => {
|
|
50
|
+
const { sourceDatasetKeys: t } = this.props;
|
|
51
|
+
t && t.length < 4 && this.setState({ showInNode: !0 }, this.getData);
|
|
51
52
|
});
|
|
52
|
-
|
|
53
|
-
const { sourceDatasetKeys:
|
|
54
|
-
if (!(
|
|
53
|
+
u(this, "getData", () => {
|
|
54
|
+
const { sourceDatasetKeys: t } = this.props;
|
|
55
|
+
if (!(t != null && t.length)) return;
|
|
55
56
|
this.setState({ loading: !0 });
|
|
56
|
-
const
|
|
57
|
+
const a = this.getDatasetLoader();
|
|
57
58
|
Promise.all(
|
|
58
|
-
|
|
59
|
+
t.map((o) => a.load(o).catch(() => null))
|
|
59
60
|
).then((o) => {
|
|
60
|
-
this.setState({ data:
|
|
61
|
+
this.setState({ data: _(o, ["alias"]), loading: !1 });
|
|
61
62
|
}).catch(() => {
|
|
62
63
|
this.setState({ data: [], loading: !1 });
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
-
const { publisherDatasetKeys:
|
|
67
|
-
if (!
|
|
68
|
-
const
|
|
66
|
+
u(this, "getPublisherData", () => {
|
|
67
|
+
const { publisherDatasetKeys: t } = this.props;
|
|
68
|
+
if (!t) return;
|
|
69
|
+
const a = this.getPublisherLoader();
|
|
69
70
|
Promise.all(
|
|
70
|
-
Object.keys(
|
|
71
|
-
(o) =>
|
|
71
|
+
Object.keys(t).map(
|
|
72
|
+
(o) => a.load(o).then((r) => ({
|
|
72
73
|
...r,
|
|
73
|
-
datasets:
|
|
74
|
+
datasets: t[o]
|
|
74
75
|
})).catch(() => null)
|
|
75
76
|
)
|
|
76
77
|
).then((o) => {
|
|
77
|
-
this.setState({ publishers:
|
|
78
|
+
this.setState({ publishers: _(o.filter(Boolean), ["alias"]) });
|
|
78
79
|
}).catch(() => {
|
|
79
80
|
this.setState({ publishers: [] });
|
|
80
81
|
});
|
|
81
82
|
});
|
|
82
|
-
|
|
83
|
-
const { data:
|
|
84
|
-
return
|
|
85
|
-
|
|
83
|
+
u(this, "render", () => {
|
|
84
|
+
const { data: t, showInNode: a, popOverVisible: o, loading: r } = this.state, { taxon: l, datasetKey: d } = this.props, i = { color: "orange", fontSize: "11px" }, f = (s) => `${D.clbPortal}/dataset/${d}/publisher/${s}`;
|
|
85
|
+
return a ? t.filter((s) => !!s).map((s, n) => /* @__PURE__ */ e.jsx(
|
|
86
|
+
P,
|
|
86
87
|
{
|
|
87
88
|
to: "source",
|
|
88
|
-
args:
|
|
89
|
+
args: s.key,
|
|
89
90
|
className: "col-tree-data-source",
|
|
90
|
-
style:
|
|
91
|
-
children: (
|
|
91
|
+
style: i,
|
|
92
|
+
children: (n ? ", " : "") + (s.alias || s.key)
|
|
92
93
|
},
|
|
93
|
-
|
|
94
|
-
)) : /* @__PURE__ */
|
|
95
|
-
|
|
94
|
+
s.key
|
|
95
|
+
)) : /* @__PURE__ */ e.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${l.id}`, children: /* @__PURE__ */ e.jsx(
|
|
96
|
+
ot,
|
|
96
97
|
{
|
|
97
|
-
getPopupContainer: () => document.getElementById(`taxon_sources_${
|
|
98
|
-
content: r ||
|
|
98
|
+
getPopupContainer: () => document.getElementById(`taxon_sources_${l.id}`),
|
|
99
|
+
content: r || t.length === 0 ? /* @__PURE__ */ e.jsx(
|
|
99
100
|
"div",
|
|
100
101
|
{
|
|
101
102
|
style: { minWidth: "200px", textAlign: "center", padding: "8px 0" },
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ e.jsx(q, { size: "small" })
|
|
103
104
|
}
|
|
104
|
-
) : /* @__PURE__ */
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
) : /* @__PURE__ */ e.jsxs("div", { style: { maxWidth: "500px" }, children: [
|
|
106
|
+
t.length > 0 && /* @__PURE__ */ e.jsx("div", { children: t.filter((s) => !!s).map((s, n) => /* @__PURE__ */ e.jsx(
|
|
107
|
+
P,
|
|
107
108
|
{
|
|
108
109
|
to: "source",
|
|
109
|
-
args:
|
|
110
|
+
args: s.key,
|
|
110
111
|
className: "col-tree-data-source",
|
|
111
|
-
style:
|
|
112
|
-
children: (
|
|
112
|
+
style: i,
|
|
113
|
+
children: (n ? ", " : "") + (s.alias || s.key)
|
|
113
114
|
},
|
|
114
|
-
|
|
115
|
+
s.key
|
|
115
116
|
)) }),
|
|
116
|
-
this.state.publishers && this.state.publishers.length > 0 && /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
var
|
|
120
|
-
return /* @__PURE__ */
|
|
117
|
+
this.state.publishers && this.state.publishers.length > 0 && /* @__PURE__ */ e.jsxs("div", { style: { marginTop: "12px" }, children: [
|
|
118
|
+
/* @__PURE__ */ e.jsx("strong", { children: "Publishers" }),
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { children: this.state.publishers.filter((s) => !!s).map((s, n) => {
|
|
120
|
+
var p;
|
|
121
|
+
return /* @__PURE__ */ e.jsxs(
|
|
121
122
|
"a",
|
|
122
123
|
{
|
|
123
|
-
href: f(
|
|
124
|
+
href: f(s.id),
|
|
124
125
|
target: "_blank",
|
|
125
126
|
rel: "noopener noreferrer",
|
|
126
|
-
style:
|
|
127
|
+
style: i,
|
|
127
128
|
children: [
|
|
128
|
-
(
|
|
129
|
-
(
|
|
129
|
+
(n ? ", " : "") + (s.alias || s.id),
|
|
130
|
+
(p = s.datasets) != null && p.length ? ` (${s.datasets.length.toLocaleString("en-GB")})` : ""
|
|
130
131
|
]
|
|
131
132
|
},
|
|
132
|
-
|
|
133
|
+
s.id
|
|
133
134
|
);
|
|
134
135
|
}) })
|
|
135
136
|
] })
|
|
136
137
|
] }),
|
|
137
|
-
title: /* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
138
|
+
title: /* @__PURE__ */ e.jsxs("div", { style: { padding: "4px 0" }, children: [
|
|
139
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontWeight: 500 }, children: "Sources for " }),
|
|
140
|
+
/* @__PURE__ */ e.jsx("em", { children: l == null ? void 0 : l.name }),
|
|
141
|
+
/* @__PURE__ */ e.jsx(it, { style: { margin: "8px 0 0" } })
|
|
141
142
|
] }),
|
|
142
143
|
open: o,
|
|
143
|
-
onOpenChange: (
|
|
144
|
-
|
|
144
|
+
onOpenChange: (s) => this.setState({ popOverVisible: s }, () => {
|
|
145
|
+
s && this.state.data.length === 0 && this.getData(), s && this.props.publisherDatasetKeys && !this.state.publishers && this.getPublisherData();
|
|
145
146
|
}),
|
|
146
147
|
trigger: "click",
|
|
147
148
|
placement: "rightTop",
|
|
148
|
-
children: /* @__PURE__ */
|
|
149
|
+
children: /* @__PURE__ */ e.jsx(
|
|
149
150
|
"a",
|
|
150
151
|
{
|
|
151
152
|
className: "col-tree-data-source",
|
|
152
153
|
role: "button",
|
|
153
154
|
tabIndex: 0,
|
|
154
155
|
style: { cursor: "pointer", color: "orange", fontSize: "11px" },
|
|
155
|
-
onClick: (
|
|
156
|
+
onClick: (s) => s.preventDefault(),
|
|
156
157
|
children: "Multiple sources"
|
|
157
158
|
}
|
|
158
159
|
)
|
|
@@ -166,44 +167,44 @@ class V extends j.Component {
|
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
|
-
|
|
170
|
-
const
|
|
170
|
+
u(G, "contextType", E);
|
|
171
|
+
const X = j.createContext();
|
|
171
172
|
class k extends j.Component {
|
|
172
|
-
constructor(
|
|
173
|
-
super(
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
constructor(t) {
|
|
174
|
+
super(t);
|
|
175
|
+
u(this, "rankIsAboveSpecies", (t) => this.props.rank.indexOf(t) < this.props.rank.indexOf("species"));
|
|
176
|
+
u(this, "render", () => {
|
|
176
177
|
const {
|
|
177
|
-
taxon:
|
|
178
|
-
taxon: { sector:
|
|
179
|
-
datasetKey:
|
|
180
|
-
} = this.props,
|
|
181
|
-
|
|
182
|
-
const f = typeof
|
|
183
|
-
return /* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
|
|
178
|
+
taxon: t,
|
|
179
|
+
taxon: { sector: a, sourceDatasetKeys: o, publisherDatasetKeys: r },
|
|
180
|
+
datasetKey: l
|
|
181
|
+
} = this.props, d = m(a, "dataset"), i = (o || []).filter((s) => (a == null ? void 0 : a.subjectDatasetKey) !== s).length > 0;
|
|
182
|
+
t.estimate && t.estimates && t.estimates.find((s) => s.estimate === t.estimate);
|
|
183
|
+
const f = typeof t.id == "string" && t.id.indexOf("incertae-sedis") > -1;
|
|
184
|
+
return /* @__PURE__ */ e.jsx(X.Consumer, { children: ({ showInfo: s }) => /* @__PURE__ */ e.jsxs("div", { id: t.id, children: [
|
|
185
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
186
|
+
/* @__PURE__ */ e.jsxs("span", { className: "tree-node-rank", children: [
|
|
187
|
+
t.rank,
|
|
187
188
|
": "
|
|
188
189
|
] }),
|
|
189
|
-
f ? /* @__PURE__ */
|
|
190
|
-
(
|
|
190
|
+
f ? /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) : /* @__PURE__ */ e.jsx(P, { to: "taxon", args: t.id, children: /* @__PURE__ */ e.jsx("span", { dangerouslySetInnerHTML: { __html: t.labelHtml } }) }),
|
|
191
|
+
(t == null ? void 0 : t.merged) && /* @__PURE__ */ e.jsx(xt, { style: { marginLeft: "4px" }, datasetKey: t == null ? void 0 : t.datasetKey, verbatimSourceKey: t == null ? void 0 : t.verbatimSourceKey })
|
|
191
192
|
] }),
|
|
192
|
-
|
|
193
|
+
s && t.status === "provisionally accepted" && /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
|
|
193
194
|
" • ",
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ e.jsx(nt, { color: "warning", style: { marginRight: 0 }, children: "prov." })
|
|
195
196
|
] }),
|
|
196
|
-
!
|
|
197
|
+
!A(t.count) && this.rankIsAboveSpecies(t == null ? void 0 : t.rank) && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
197
198
|
" ",
|
|
198
199
|
"• ",
|
|
199
|
-
Number(
|
|
200
|
+
Number(t.count).toLocaleString(),
|
|
200
201
|
" ",
|
|
201
|
-
|
|
202
|
+
s && !A(t.speciesEstimate) && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
202
203
|
" ",
|
|
203
204
|
"of",
|
|
204
205
|
" ",
|
|
205
206
|
Number(
|
|
206
|
-
|
|
207
|
+
t.speciesEstimate
|
|
207
208
|
).toLocaleString(),
|
|
208
209
|
" ",
|
|
209
210
|
"est.",
|
|
@@ -211,31 +212,31 @@ class k extends j.Component {
|
|
|
211
212
|
] }),
|
|
212
213
|
"spp."
|
|
213
214
|
] }),
|
|
214
|
-
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
|
|
215
|
+
s && a && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
216
|
+
/* @__PURE__ */ e.jsx("span", { children: " • " }),
|
|
217
|
+
/* @__PURE__ */ e.jsxs(
|
|
218
|
+
P,
|
|
218
219
|
{
|
|
219
220
|
to: "source",
|
|
220
|
-
args:
|
|
221
|
-
style:
|
|
221
|
+
args: a.subjectDatasetKey,
|
|
222
|
+
style: i ? { fontWeight: "bold" } : null,
|
|
222
223
|
className: "col-tree-data-source",
|
|
223
224
|
children: [
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
m(d, "alias") || a.subjectDatasetKey,
|
|
226
|
+
i && ", "
|
|
226
227
|
]
|
|
227
228
|
}
|
|
228
229
|
)
|
|
229
230
|
] }),
|
|
230
|
-
|
|
231
|
+
s && i && /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
|
|
231
232
|
" ",
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
233
|
+
/* @__PURE__ */ e.jsx(
|
|
234
|
+
G,
|
|
234
235
|
{
|
|
235
236
|
sourceDatasetKeys: o,
|
|
236
237
|
publisherDatasetKeys: r,
|
|
237
|
-
taxon:
|
|
238
|
-
datasetKey:
|
|
238
|
+
taxon: t,
|
|
239
|
+
datasetKey: l
|
|
239
240
|
}
|
|
240
241
|
)
|
|
241
242
|
] })
|
|
@@ -248,46 +249,46 @@ class k extends j.Component {
|
|
|
248
249
|
};
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
|
-
const
|
|
252
|
-
class
|
|
253
|
-
constructor(
|
|
254
|
-
super(
|
|
255
|
-
|
|
252
|
+
const b = 1e3, Z = "__loadMoreBTN__", W = (x) => `${Z}${x}`, U = (x) => typeof x == "string" && x.startsWith(Z);
|
|
253
|
+
class Ct extends j.Component {
|
|
254
|
+
constructor(t) {
|
|
255
|
+
super(t);
|
|
256
|
+
u(this, "onClick", () => {
|
|
256
257
|
this.setState(
|
|
257
258
|
{ loading: !0 },
|
|
258
259
|
() => this.props.onClick().then(() => this.setState({ loading: !1 }))
|
|
259
260
|
);
|
|
260
261
|
});
|
|
261
|
-
|
|
262
|
-
const { loading:
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
265
|
-
!
|
|
262
|
+
u(this, "render", () => {
|
|
263
|
+
const { loading: t } = this.state;
|
|
264
|
+
return /* @__PURE__ */ e.jsxs(j.Fragment, { children: [
|
|
265
|
+
t && /* @__PURE__ */ e.jsx(q, {}),
|
|
266
|
+
!t && /* @__PURE__ */ e.jsx("a", { onClick: this.onClick, children: /* @__PURE__ */ e.jsx("strong", { children: "Load more..." }) })
|
|
266
267
|
] });
|
|
267
268
|
});
|
|
268
269
|
this.state = { loading: !1 };
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
|
-
class
|
|
272
|
-
constructor(
|
|
273
|
-
super(
|
|
274
|
-
|
|
275
|
-
const { datasetKey:
|
|
276
|
-
this.loadRoot(), this.sectorLoader = new
|
|
277
|
-
(o) =>
|
|
272
|
+
class J extends j.Component {
|
|
273
|
+
constructor(t) {
|
|
274
|
+
super(t);
|
|
275
|
+
u(this, "componentDidMount", () => {
|
|
276
|
+
const { datasetKey: t } = this.props;
|
|
277
|
+
this.loadRoot(), this.sectorLoader = new L(
|
|
278
|
+
(o) => yt(o, t)
|
|
278
279
|
), this.getRank();
|
|
279
|
-
const { treeRef:
|
|
280
|
-
|
|
280
|
+
const { treeRef: a } = this.props;
|
|
281
|
+
a(this);
|
|
281
282
|
});
|
|
282
|
-
|
|
283
|
-
(
|
|
283
|
+
u(this, "componentDidUpdate", (t) => {
|
|
284
|
+
(t.defaultExpandKey !== this.props.defaultExpandKey || t.hideExtinct !== this.props.hideExtinct || t.insertPlaceholder !== this.props.insertPlaceholder) && this.reloadRoot();
|
|
284
285
|
});
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
(
|
|
286
|
+
u(this, "getRank", () => {
|
|
287
|
+
K(`${D.dataApi}vocab/rank`).then(
|
|
288
|
+
(t) => this.setState({ rank: t.data.map((a) => a.name) })
|
|
288
289
|
);
|
|
289
290
|
});
|
|
290
|
-
|
|
291
|
+
u(this, "reloadRoot", () => this.setState(
|
|
291
292
|
{
|
|
292
293
|
rootLoading: !0,
|
|
293
294
|
treeData: [],
|
|
@@ -298,245 +299,255 @@ class G extends j.Component {
|
|
|
298
299
|
},
|
|
299
300
|
this.loadRoot
|
|
300
301
|
));
|
|
301
|
-
|
|
302
|
+
// `append` is only set by the "Load more" button, which pages in the next
|
|
303
|
+
// batch of root taxa; every other caller loads page one from scratch.
|
|
304
|
+
// Each call takes a request id and a response is merged only while its id is
|
|
305
|
+
// still the current one. Without that, two overlapping loads — React
|
|
306
|
+
// StrictMode's double mount in dev, or a prop change while a load is in
|
|
307
|
+
// flight — both merged their page into treeData, so every root appeared
|
|
308
|
+
// twice and antd warned "Same 'key' exist in the Tree" (issue #59).
|
|
309
|
+
u(this, "loadRoot", async (t = !1) => {
|
|
302
310
|
const {
|
|
303
|
-
showSourceTaxon:
|
|
304
|
-
datasetKey:
|
|
305
|
-
hideExtinct:
|
|
306
|
-
insertPlaceholder:
|
|
307
|
-
type:
|
|
308
|
-
expandedTaxonKey:
|
|
309
|
-
} = this.props,
|
|
310
|
-
return this.setState(
|
|
311
|
-
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
311
|
+
showSourceTaxon: a,
|
|
312
|
+
datasetKey: o,
|
|
313
|
+
hideExtinct: r,
|
|
314
|
+
insertPlaceholder: l,
|
|
315
|
+
type: d,
|
|
316
|
+
expandedTaxonKey: i
|
|
317
|
+
} = this.props, f = i, { defaultTaxonKey: s } = this.props, n = ++this.rootRequestId, p = t ? this.state.treeData.length : 0;
|
|
318
|
+
return this.setState(
|
|
319
|
+
t ? { rootLoading: !0 } : { rootLoading: !0, treeData: [] }
|
|
320
|
+
), K(
|
|
321
|
+
`${D.dataApi}dataset/${o}/tree?projectKey=${o}${d ? "&type=" + d : ""}&limit=${b}&offset=${p}${r ? "&extinct=false&extinct=" : ""}${l ? "&insertPlaceholder=true" : ""}`
|
|
322
|
+
).then(this.decorateWithSectorsAndDataset).then((C) => {
|
|
323
|
+
if (n !== this.rootRequestId) return;
|
|
324
|
+
const c = C.data.result || [], h = C.data.total, g = c.map((S) => {
|
|
325
|
+
let T = {
|
|
326
|
+
taxon: S,
|
|
327
|
+
key: S.id,
|
|
328
|
+
datasetKey: o,
|
|
329
|
+
childCount: S.childCount,
|
|
330
|
+
isLeaf: S.childCount === 0,
|
|
320
331
|
childOffset: 0
|
|
321
332
|
};
|
|
322
|
-
return
|
|
333
|
+
return T.title = /* @__PURE__ */ e.jsx(
|
|
323
334
|
k,
|
|
324
335
|
{
|
|
325
|
-
taxon:
|
|
326
|
-
datasetKey:
|
|
327
|
-
showSourceTaxon:
|
|
328
|
-
reloadChildren: () => this.fetchChildPage(
|
|
336
|
+
taxon: S,
|
|
337
|
+
datasetKey: o,
|
|
338
|
+
showSourceTaxon: a,
|
|
339
|
+
reloadChildren: () => this.fetchChildPage(T, !0),
|
|
329
340
|
rank: this.state.rank
|
|
330
341
|
}
|
|
331
|
-
),
|
|
342
|
+
), T.ref = T, T;
|
|
332
343
|
});
|
|
333
344
|
this.setState(
|
|
334
|
-
{
|
|
335
|
-
rootTotal:
|
|
345
|
+
(S) => ({
|
|
346
|
+
rootTotal: h,
|
|
336
347
|
rootLoading: !1,
|
|
337
|
-
treeData: [...
|
|
348
|
+
treeData: t ? [...S.treeData, ...g] : g,
|
|
338
349
|
// Nothing is auto-expanded by default. Consumers open a specific root
|
|
339
350
|
// (or deep taxon) by passing `defaultTaxonKey`/`expandedTaxonKey` —
|
|
340
351
|
// e.g. defaultTaxonKey="CS5HF" opens Eukaryota in current COL releases.
|
|
341
352
|
expandedKeys: [],
|
|
342
353
|
error: null
|
|
343
|
-
},
|
|
354
|
+
}),
|
|
344
355
|
() => {
|
|
345
|
-
if (n)
|
|
346
|
-
return this.expandToTaxon(n);
|
|
347
356
|
if (f)
|
|
348
357
|
return this.expandToTaxon(f);
|
|
358
|
+
if (s)
|
|
359
|
+
return this.expandToTaxon(s);
|
|
349
360
|
}
|
|
350
361
|
), g.length === 1 && this.fetchChildPage(g[g.length - 1]);
|
|
351
|
-
}).catch((
|
|
352
|
-
this.setState({
|
|
362
|
+
}).catch((C) => {
|
|
363
|
+
n === this.rootRequestId && this.setState({
|
|
353
364
|
treeData: [],
|
|
354
365
|
rootLoading: !1,
|
|
355
366
|
expandedKeys: [],
|
|
356
|
-
error:
|
|
367
|
+
error: C
|
|
357
368
|
});
|
|
358
369
|
});
|
|
359
370
|
});
|
|
360
|
-
|
|
371
|
+
u(this, "expandToTaxon", async (t) => {
|
|
361
372
|
const {
|
|
362
|
-
showSourceTaxon:
|
|
373
|
+
showSourceTaxon: a,
|
|
363
374
|
datasetKey: o,
|
|
364
375
|
hideExtinct: r,
|
|
365
|
-
type:
|
|
376
|
+
type: l
|
|
366
377
|
} = this.props;
|
|
367
378
|
this.setState({
|
|
368
379
|
rootLoading: !0
|
|
369
380
|
/* , treeData: [] */
|
|
370
381
|
});
|
|
371
|
-
const { data:
|
|
372
|
-
`${
|
|
382
|
+
const { data: d } = await K(
|
|
383
|
+
`${D.dataApi}dataset/${o}/tree/${t}?projectKey=${o}&insertPlaceholder=true${l ? "&type=" + l : ""}${r ? "&extinct=false" : ""}`
|
|
373
384
|
).then(
|
|
374
|
-
(
|
|
375
|
-
data: { result:
|
|
376
|
-
}).then(() =>
|
|
385
|
+
(c) => this.decorateWithSectorsAndDataset({
|
|
386
|
+
data: { result: c.data }
|
|
387
|
+
}).then(() => c)
|
|
377
388
|
);
|
|
378
|
-
if (
|
|
389
|
+
if (d.length === 0)
|
|
379
390
|
return this.setState(
|
|
380
391
|
{
|
|
381
392
|
error: {
|
|
382
|
-
message: `No classification found for Taxon ID: ${
|
|
393
|
+
message: `No classification found for Taxon ID: ${t}`
|
|
383
394
|
}
|
|
384
395
|
},
|
|
385
396
|
this.loadRoot
|
|
386
397
|
);
|
|
387
|
-
const
|
|
398
|
+
const i = d[d.length - 1];
|
|
388
399
|
let f = {
|
|
389
|
-
taxon:
|
|
390
|
-
key:
|
|
400
|
+
taxon: i,
|
|
401
|
+
key: i.id,
|
|
391
402
|
datasetKey: o,
|
|
392
|
-
childCount:
|
|
393
|
-
isLeaf:
|
|
403
|
+
childCount: i.childCount,
|
|
404
|
+
isLeaf: i.childCount === 0,
|
|
394
405
|
childOffset: 0
|
|
395
406
|
};
|
|
396
|
-
f.title = /* @__PURE__ */
|
|
407
|
+
f.title = /* @__PURE__ */ e.jsx(
|
|
397
408
|
k,
|
|
398
409
|
{
|
|
399
|
-
taxon:
|
|
410
|
+
taxon: i,
|
|
400
411
|
datasetKey: o,
|
|
401
|
-
showSourceTaxon:
|
|
412
|
+
showSourceTaxon: a,
|
|
402
413
|
rank: this.state.rank,
|
|
403
414
|
reloadChildren: () => this.fetchChildPage(f, !0)
|
|
404
415
|
}
|
|
405
416
|
), f.ref = f;
|
|
406
|
-
const
|
|
407
|
-
for (let
|
|
408
|
-
const
|
|
409
|
-
taxon:
|
|
410
|
-
key:
|
|
417
|
+
const s = f;
|
|
418
|
+
for (let c = d.length - 2; c >= 0; c--) {
|
|
419
|
+
const h = d[c], g = {
|
|
420
|
+
taxon: h,
|
|
421
|
+
key: h.id,
|
|
411
422
|
datasetKey: o,
|
|
412
|
-
childCount:
|
|
413
|
-
isLeaf:
|
|
423
|
+
childCount: h.childCount,
|
|
424
|
+
isLeaf: h.childCount === 0,
|
|
414
425
|
childOffset: 0
|
|
415
426
|
};
|
|
416
|
-
|
|
427
|
+
g.ref = g, g.title = /* @__PURE__ */ e.jsx(
|
|
417
428
|
k,
|
|
418
429
|
{
|
|
419
|
-
taxon:
|
|
430
|
+
taxon: h,
|
|
420
431
|
datasetKey: o,
|
|
421
|
-
showSourceTaxon:
|
|
432
|
+
showSourceTaxon: a,
|
|
422
433
|
rank: this.state.rank,
|
|
423
|
-
reloadChildren: () => this.fetchChildPage(
|
|
434
|
+
reloadChildren: () => this.fetchChildPage(g, !0)
|
|
424
435
|
}
|
|
425
|
-
), f.children = [
|
|
436
|
+
), f.children = [g], f = g;
|
|
426
437
|
}
|
|
427
|
-
const { treeData:
|
|
428
|
-
var
|
|
429
|
-
|
|
430
|
-
const
|
|
438
|
+
const { treeData: n } = this.state;
|
|
439
|
+
var p = n.findIndex((c) => c.key == s.key);
|
|
440
|
+
n[p] = s;
|
|
441
|
+
const C = [...d.map((c) => c.id).reverse()];
|
|
431
442
|
this.setState(
|
|
432
|
-
{ treeData:
|
|
433
|
-
() => this.reloadLoadedKeys(
|
|
443
|
+
{ treeData: n },
|
|
444
|
+
() => this.reloadLoadedKeys(C, t)
|
|
434
445
|
);
|
|
435
446
|
});
|
|
436
|
-
|
|
447
|
+
u(this, "fetchChildPage", async (t, a, o) => {
|
|
437
448
|
const {
|
|
438
449
|
showSourceTaxon: r,
|
|
439
|
-
datasetKey:
|
|
440
|
-
hideExtinct:
|
|
441
|
-
insertPlaceholder:
|
|
450
|
+
datasetKey: l,
|
|
451
|
+
hideExtinct: d,
|
|
452
|
+
insertPlaceholder: i,
|
|
442
453
|
type: f
|
|
443
454
|
} = this.props;
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
`${
|
|
455
|
+
m(t, "childCount");
|
|
456
|
+
const s = b, n = m(t, "childOffset"), p = await K(
|
|
457
|
+
`${D.dataApi}dataset/${l}/tree/${t.taxon.id}/children?limit=${s}&offset=${n}&projectKey=${l}${f ? "&type=" + f : ""}${d ? "&extinct=false" : ""}${i ? "&insertPlaceholder=true" : ""}`
|
|
447
458
|
);
|
|
448
|
-
await this.decorateWithSectorsAndDataset(
|
|
449
|
-
const
|
|
450
|
-
let
|
|
451
|
-
taxon:
|
|
452
|
-
key:
|
|
453
|
-
datasetKey:
|
|
454
|
-
childCount:
|
|
455
|
-
isLeaf:
|
|
459
|
+
await this.decorateWithSectorsAndDataset(p);
|
|
460
|
+
const C = p.data.result ? p.data.result.map((c) => {
|
|
461
|
+
let h = {
|
|
462
|
+
taxon: c,
|
|
463
|
+
key: c.id,
|
|
464
|
+
datasetKey: l,
|
|
465
|
+
childCount: c.childCount,
|
|
466
|
+
isLeaf: c.childCount === 0,
|
|
456
467
|
childOffset: 0,
|
|
457
|
-
parent:
|
|
458
|
-
name:
|
|
468
|
+
parent: t,
|
|
469
|
+
name: c.name
|
|
459
470
|
};
|
|
460
|
-
return
|
|
471
|
+
return h.title = /* @__PURE__ */ e.jsx(
|
|
461
472
|
k,
|
|
462
473
|
{
|
|
463
|
-
taxon:
|
|
464
|
-
datasetKey:
|
|
474
|
+
taxon: c,
|
|
475
|
+
datasetKey: l,
|
|
465
476
|
showSourceTaxon: r,
|
|
466
477
|
rank: this.state.rank,
|
|
467
|
-
reloadChildren: () => this.fetchChildPage(
|
|
478
|
+
reloadChildren: () => this.fetchChildPage(h, !0)
|
|
468
479
|
}
|
|
469
|
-
),
|
|
480
|
+
), h.ref = h, h;
|
|
470
481
|
}) : [];
|
|
471
|
-
if (
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
...
|
|
482
|
+
if (t.children = t.children && n !== 0 && !a ? [...t.children, ...C] : C, p.data.last && t.childCount > t.children.length && (t.childCount = t.children.length), !p.data.last) {
|
|
483
|
+
const c = () => (t.childOffset += b, U(m(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), this.fetchChildPage(t, !1));
|
|
484
|
+
t.children = [
|
|
485
|
+
...t.children,
|
|
475
486
|
{
|
|
476
|
-
title: /* @__PURE__ */
|
|
477
|
-
|
|
487
|
+
title: /* @__PURE__ */ e.jsx(
|
|
488
|
+
Ct,
|
|
478
489
|
{
|
|
479
|
-
onClick:
|
|
490
|
+
onClick: c
|
|
480
491
|
},
|
|
481
|
-
|
|
492
|
+
W(t.key)
|
|
482
493
|
),
|
|
483
|
-
key:
|
|
494
|
+
key: W(t.key),
|
|
484
495
|
childCount: 0,
|
|
485
496
|
isLeaf: !0
|
|
486
497
|
}
|
|
487
498
|
];
|
|
488
499
|
}
|
|
489
|
-
o || this.setState((
|
|
490
|
-
treeData: [...
|
|
491
|
-
loadedKeys: [.../* @__PURE__ */ new Set([...
|
|
500
|
+
o || this.setState((c) => ({
|
|
501
|
+
treeData: [...c.treeData],
|
|
502
|
+
loadedKeys: [.../* @__PURE__ */ new Set([...c.loadedKeys, t.key])]
|
|
492
503
|
}));
|
|
493
504
|
});
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
(
|
|
497
|
-
(o) =>
|
|
498
|
-
id:
|
|
499
|
-
subjectDatasetKey:
|
|
505
|
+
u(this, "decorateWithSectorsAndDataset", (t) => t.data.result ? Promise.all(
|
|
506
|
+
t.data.result.filter((a) => !!a.sectorDatasetKey).map(
|
|
507
|
+
(a) => this.datasetLoader.load(a.sectorDatasetKey).then(
|
|
508
|
+
(o) => a.sector = {
|
|
509
|
+
id: a.sectorKey,
|
|
510
|
+
subjectDatasetKey: a.sectorDatasetKey,
|
|
500
511
|
dataset: o
|
|
501
512
|
}
|
|
502
513
|
)
|
|
503
514
|
)
|
|
504
|
-
).then(() =>
|
|
505
|
-
|
|
506
|
-
|
|
515
|
+
).then(() => t) : t);
|
|
516
|
+
u(this, "onLoadData", (t, a = !1) => (a && (t.childOffset = 0), this.fetchChildPage(t.ref, a)));
|
|
517
|
+
u(this, "findNode", (t, a) => {
|
|
507
518
|
let o = null;
|
|
508
|
-
if (o =
|
|
519
|
+
if (o = a.find((r) => m(r, "taxon.id") === t), o)
|
|
509
520
|
return o;
|
|
510
521
|
{
|
|
511
|
-
const r =
|
|
512
|
-
return
|
|
522
|
+
const r = a.map((d) => m(d, "children") || []), l = ct(r);
|
|
523
|
+
return l.length === 0 ? null : this.findNode(t, l);
|
|
513
524
|
}
|
|
514
525
|
});
|
|
515
|
-
|
|
526
|
+
u(this, "pageThroughChildrenUntilTaxonFound", async (t, a) => {
|
|
516
527
|
let o;
|
|
517
|
-
for (; !o &&
|
|
518
|
-
|
|
519
|
-
return o || (o =
|
|
520
|
-
(r) =>
|
|
528
|
+
for (; !o && t.children.length < t.childCount; )
|
|
529
|
+
t.childOffset += b, U(m(t.children[t.children.length - 1], "key")) && (t.children = t.children.slice(0, -1)), await this.fetchChildPage(t, !1, !0), o = this.findNode(a, t.children);
|
|
530
|
+
return o || (o = t.children.find(
|
|
531
|
+
(r) => m(r, "taxon.id") ? r.taxon.id.indexOf("incertae-sedis") > -1 : !1
|
|
521
532
|
)), o;
|
|
522
533
|
});
|
|
523
|
-
|
|
534
|
+
u(this, "reloadLoadedKeys", async (t, a, o = !0) => {
|
|
524
535
|
this.setState({ rootLoading: !0 });
|
|
525
536
|
const { loadedKeys: r } = this.state;
|
|
526
|
-
let { treeData:
|
|
527
|
-
const
|
|
528
|
-
for (let
|
|
529
|
-
let
|
|
530
|
-
if (!
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
),
|
|
537
|
+
let { treeData: l } = this.state;
|
|
538
|
+
const d = a ? this.findNode(a, l) : null, i = t ? [...t] : [...r];
|
|
539
|
+
for (let s = 0; s < i.length; s++) {
|
|
540
|
+
let n = this.findNode(i[s], l);
|
|
541
|
+
if (!n && d && i[s - 1]) {
|
|
542
|
+
const p = this.findNode(i[s - 1], l);
|
|
543
|
+
p && O(m(p, "children")) && p.children.length > 0 && (n = await this.pageThroughChildrenUntilTaxonFound(
|
|
544
|
+
p,
|
|
545
|
+
i[s]
|
|
546
|
+
), n ? i.splice(s, 0, n.taxon.id) : this.setState(
|
|
536
547
|
{
|
|
537
|
-
nodeNotFoundErr: /* @__PURE__ */
|
|
548
|
+
nodeNotFoundErr: /* @__PURE__ */ e.jsxs("span", { children: [
|
|
538
549
|
"Cannot find taxon ",
|
|
539
|
-
|
|
550
|
+
a,
|
|
540
551
|
" in tree 😥"
|
|
541
552
|
] }),
|
|
542
553
|
rootLoading: !1
|
|
@@ -552,37 +563,37 @@ class G extends j.Component {
|
|
|
552
563
|
} */
|
|
553
564
|
));
|
|
554
565
|
}
|
|
555
|
-
if (
|
|
556
|
-
await this.fetchChildPage(
|
|
557
|
-
let
|
|
558
|
-
(
|
|
566
|
+
if (n) {
|
|
567
|
+
await this.fetchChildPage(n, !0, !0);
|
|
568
|
+
let p = n.children.find(
|
|
569
|
+
(C) => m(C, "taxon.id") === m(d, "taxon.id")
|
|
559
570
|
);
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
),
|
|
571
|
+
d && s === i.length - 2 && m(n, "taxon.id") !== m(d, "taxon.id") && O(n.children) && !p && n.children.length < n.childCount && (p = await this.pageThroughChildrenUntilTaxonFound(
|
|
572
|
+
n,
|
|
573
|
+
m(d, "taxon.id")
|
|
574
|
+
), p ? this.setState({ treeData: [...this.state.treeData] }, () => {
|
|
564
575
|
setTimeout(() => {
|
|
565
|
-
document.getElementById(
|
|
576
|
+
document.getElementById(a).scrollIntoView({ behavior: "smooth", block: "center" });
|
|
566
577
|
}, 100);
|
|
567
578
|
}) : this.setState(
|
|
568
579
|
{
|
|
569
|
-
nodeNotFoundErr: /* @__PURE__ */
|
|
580
|
+
nodeNotFoundErr: /* @__PURE__ */ e.jsxs("span", { children: [
|
|
570
581
|
"Cannot find taxon ",
|
|
571
|
-
|
|
582
|
+
a,
|
|
572
583
|
" in tree 😥"
|
|
573
584
|
] }),
|
|
574
585
|
rootLoading: !1
|
|
575
586
|
},
|
|
576
587
|
() => {
|
|
577
|
-
this.props.treeType === "CATALOGUE" && typeof this.props.addMissingTargetKey == "function" && this.props.addMissingTargetKey(
|
|
588
|
+
this.props.treeType === "CATALOGUE" && typeof this.props.addMissingTargetKey == "function" && this.props.addMissingTargetKey(a);
|
|
578
589
|
}
|
|
579
590
|
));
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
|
-
const f = { loadedKeys:
|
|
583
|
-
o && (f.expandedKeys =
|
|
584
|
-
|
|
585
|
-
document.getElementById(
|
|
593
|
+
const f = { loadedKeys: i, rootLoading: !1 };
|
|
594
|
+
o && (f.expandedKeys = i), this.setState(f, () => {
|
|
595
|
+
a && setTimeout(() => {
|
|
596
|
+
document.getElementById(a).scrollIntoView({ behavior: "smooth", block: "center" });
|
|
586
597
|
}, 100);
|
|
587
598
|
});
|
|
588
599
|
});
|
|
@@ -595,7 +606,7 @@ class G extends j.Component {
|
|
|
595
606
|
error: null,
|
|
596
607
|
nodeNotFoundErr: null,
|
|
597
608
|
rank: []
|
|
598
|
-
}, this.treeRef = j.createRef();
|
|
609
|
+
}, this.treeRef = j.createRef(), this.rootRequestId = 0;
|
|
599
610
|
}
|
|
600
611
|
// datasetLoader comes from the shared TreeCacheContext so multiple tree
|
|
601
612
|
// nodes (and TaxonSources instances) share one in-memory cache instead
|
|
@@ -605,222 +616,222 @@ class G extends j.Component {
|
|
|
605
616
|
}
|
|
606
617
|
render() {
|
|
607
618
|
const {
|
|
608
|
-
error:
|
|
609
|
-
rootTotal:
|
|
619
|
+
error: t,
|
|
620
|
+
rootTotal: a,
|
|
610
621
|
rootLoading: o,
|
|
611
622
|
treeData: r,
|
|
612
|
-
defaultExpandAll:
|
|
613
|
-
nodeNotFoundErr:
|
|
614
|
-
loadedKeys:
|
|
623
|
+
defaultExpandAll: l,
|
|
624
|
+
nodeNotFoundErr: d,
|
|
625
|
+
loadedKeys: i,
|
|
615
626
|
expandedKeys: f
|
|
616
|
-
} = this.state, { treeType:
|
|
617
|
-
return /* @__PURE__ */
|
|
618
|
-
|
|
619
|
-
|
|
627
|
+
} = this.state, { treeType: s, dataset: n, height: p, expandedTaxonKey: C } = this.props, c = C;
|
|
628
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
629
|
+
t && /* @__PURE__ */ e.jsx(j.Fragment, { children: m(t, "response.data.code") !== 404 ? /* @__PURE__ */ e.jsx(
|
|
630
|
+
w,
|
|
620
631
|
{
|
|
621
632
|
closable: !0,
|
|
622
633
|
onClose: () => this.setState({ error: null }),
|
|
623
634
|
style: { marginTop: "8px" },
|
|
624
|
-
message: /* @__PURE__ */
|
|
635
|
+
message: /* @__PURE__ */ e.jsx(gt, { error: t }),
|
|
625
636
|
type: "error"
|
|
626
637
|
}
|
|
627
|
-
) : /* @__PURE__ */
|
|
628
|
-
|
|
638
|
+
) : /* @__PURE__ */ e.jsx(
|
|
639
|
+
w,
|
|
629
640
|
{
|
|
630
641
|
closable: !0,
|
|
631
642
|
onClose: () => this.setState({ error: null }),
|
|
632
643
|
style: { marginTop: "8px" },
|
|
633
|
-
message: /* @__PURE__ */
|
|
644
|
+
message: /* @__PURE__ */ e.jsx(
|
|
634
645
|
Custom404,
|
|
635
646
|
{
|
|
636
|
-
error:
|
|
637
|
-
treeType:
|
|
638
|
-
dataset:
|
|
647
|
+
error: t,
|
|
648
|
+
treeType: s,
|
|
649
|
+
dataset: n,
|
|
639
650
|
loadRoot: this.loadRoot
|
|
640
651
|
}
|
|
641
652
|
),
|
|
642
653
|
type: "warning"
|
|
643
654
|
}
|
|
644
655
|
) }),
|
|
645
|
-
|
|
646
|
-
|
|
656
|
+
d && /* @__PURE__ */ e.jsx(
|
|
657
|
+
w,
|
|
647
658
|
{
|
|
648
659
|
closable: !0,
|
|
649
660
|
onClose: () => this.setState({ nodeNotFoundErr: null }),
|
|
650
661
|
style: { marginTop: "8px" },
|
|
651
|
-
message:
|
|
662
|
+
message: d,
|
|
652
663
|
type: "warning"
|
|
653
664
|
}
|
|
654
665
|
),
|
|
655
|
-
o && /* @__PURE__ */
|
|
656
|
-
!o && r.length > 0 && /* @__PURE__ */
|
|
657
|
-
|
|
666
|
+
o && /* @__PURE__ */ e.jsx(rt, { paragraph: { rows: 10 }, active: !0 }),
|
|
667
|
+
!o && r.length > 0 && /* @__PURE__ */ e.jsx(
|
|
668
|
+
lt,
|
|
658
669
|
{
|
|
659
670
|
ref: this.treeRef,
|
|
660
|
-
defaultExpandAll:
|
|
671
|
+
defaultExpandAll: l,
|
|
661
672
|
loadData: this.onLoadData,
|
|
662
|
-
onLoad: (
|
|
663
|
-
loadedKeys:
|
|
673
|
+
onLoad: (h) => this.setState({ loadedKeys: h }),
|
|
674
|
+
loadedKeys: i,
|
|
664
675
|
expandedKeys: f,
|
|
665
676
|
treeData: r,
|
|
666
|
-
filterTreeNode: (
|
|
667
|
-
onExpand: (
|
|
668
|
-
this.setState({ expandedKeys:
|
|
669
|
-
|
|
677
|
+
filterTreeNode: (h) => h.key === c,
|
|
678
|
+
onExpand: (h, g) => {
|
|
679
|
+
this.setState({ expandedKeys: h }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
|
|
680
|
+
g.expanded ? g.node.key : null
|
|
670
681
|
);
|
|
671
682
|
}
|
|
672
683
|
}
|
|
673
684
|
),
|
|
674
|
-
!
|
|
685
|
+
!t && r.length < a && /* @__PURE__ */ e.jsxs(dt, { loading: o, onClick: () => this.loadRoot(!0), children: [
|
|
675
686
|
"Load more",
|
|
676
687
|
" "
|
|
677
688
|
] })
|
|
678
689
|
] });
|
|
679
690
|
}
|
|
680
691
|
}
|
|
681
|
-
|
|
682
|
-
const
|
|
692
|
+
u(J, "contextType", E);
|
|
693
|
+
const jt = [
|
|
683
694
|
"infraspecific name",
|
|
684
695
|
"species",
|
|
685
696
|
"variety",
|
|
686
697
|
"form"
|
|
687
698
|
];
|
|
688
|
-
class
|
|
689
|
-
constructor(
|
|
690
|
-
super(
|
|
691
|
-
|
|
692
|
-
const { datasetKey:
|
|
693
|
-
if (
|
|
699
|
+
class Q extends j.Component {
|
|
700
|
+
constructor(t) {
|
|
701
|
+
super(t);
|
|
702
|
+
u(this, "componentDidMount", async () => {
|
|
703
|
+
const { datasetKey: t, citation: a } = this.props;
|
|
704
|
+
if (a)
|
|
694
705
|
try {
|
|
695
|
-
const { data: o } = await
|
|
706
|
+
const { data: o } = await ft(t);
|
|
696
707
|
this.setState({ dataset: o });
|
|
697
708
|
} catch {
|
|
698
709
|
}
|
|
699
710
|
});
|
|
700
|
-
|
|
711
|
+
u(this, "render", () => {
|
|
701
712
|
const {
|
|
702
|
-
datasetKey:
|
|
703
|
-
defaultTaxonKey:
|
|
713
|
+
datasetKey: t,
|
|
714
|
+
defaultTaxonKey: a,
|
|
704
715
|
expandedTaxonKey: o,
|
|
705
716
|
onExpandedTaxonKeyChange: r,
|
|
706
|
-
showTreeOptions:
|
|
707
|
-
linkToSpeciesPage:
|
|
708
|
-
citation:
|
|
717
|
+
showTreeOptions: l,
|
|
718
|
+
linkToSpeciesPage: d,
|
|
719
|
+
citation: i,
|
|
709
720
|
type: f,
|
|
710
|
-
insertPlaceholder:
|
|
711
|
-
} = this.props, { hideExtinct:
|
|
712
|
-
var
|
|
713
|
-
const
|
|
714
|
-
if (!
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
} else r && (r(
|
|
720
|
-
},
|
|
721
|
+
insertPlaceholder: s = !0
|
|
722
|
+
} = this.props, { hideExtinct: n, dataset: p } = this.state, C = (h) => {
|
|
723
|
+
var T, $;
|
|
724
|
+
const g = m(h, "key");
|
|
725
|
+
if (!g) return;
|
|
726
|
+
const S = m(h, "rank");
|
|
727
|
+
if (d && jt.includes(S)) {
|
|
728
|
+
const v = ($ = (T = this.context) == null ? void 0 : T.taxon) == null ? void 0 : $.onNavigate;
|
|
729
|
+
v && v(g);
|
|
730
|
+
} else r && (r(g), this.treeRef && this.treeRef.reloadRoot && this.treeRef.reloadRoot());
|
|
731
|
+
}, c = () => {
|
|
721
732
|
r && r(null);
|
|
722
733
|
};
|
|
723
|
-
return /* @__PURE__ */
|
|
724
|
-
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
|
|
734
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "catalogue-of-life", children: [
|
|
735
|
+
i === "top" && p && /* @__PURE__ */ e.jsx(R, { dataset: p }),
|
|
736
|
+
/* @__PURE__ */ e.jsx(E.Provider, { value: this.cache, children: /* @__PURE__ */ e.jsxs(X.Provider, { value: this.state, children: [
|
|
737
|
+
/* @__PURE__ */ e.jsxs(ht, { children: [
|
|
738
|
+
/* @__PURE__ */ e.jsx(I, { flex: "auto", children: /* @__PURE__ */ e.jsx(
|
|
739
|
+
mt,
|
|
729
740
|
{
|
|
730
|
-
hideExtinct:
|
|
731
|
-
datasetKey:
|
|
741
|
+
hideExtinct: n,
|
|
742
|
+
datasetKey: t,
|
|
732
743
|
style: {
|
|
733
744
|
width: "100%",
|
|
734
745
|
paddingTop: "5px",
|
|
735
746
|
paddingBottom: "5px"
|
|
736
747
|
},
|
|
737
748
|
defaultTaxonKey: o || null,
|
|
738
|
-
onSelectName:
|
|
739
|
-
onResetSearch:
|
|
749
|
+
onSelectName: C,
|
|
750
|
+
onResetSearch: c
|
|
740
751
|
}
|
|
741
752
|
) }),
|
|
742
|
-
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
|
|
753
|
+
l && /* @__PURE__ */ e.jsxs(I, { style: { paddingLeft: "8px" }, children: [
|
|
754
|
+
/* @__PURE__ */ e.jsx(
|
|
755
|
+
N,
|
|
745
756
|
{
|
|
746
757
|
defaultChecked: this.state.showInfo,
|
|
747
|
-
onChange: ({ target: { checked:
|
|
748
|
-
this.setState({ showInfo:
|
|
758
|
+
onChange: ({ target: { checked: h } }) => {
|
|
759
|
+
this.setState({ showInfo: h }), M("tree-show-source", h);
|
|
749
760
|
},
|
|
750
761
|
children: "Source"
|
|
751
762
|
}
|
|
752
763
|
),
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
|
|
764
|
+
/* @__PURE__ */ e.jsx(
|
|
765
|
+
N,
|
|
755
766
|
{
|
|
756
767
|
defaultChecked: this.state.hideExtinct,
|
|
757
|
-
onChange: ({ target: { checked:
|
|
758
|
-
this.setState({ hideExtinct:
|
|
768
|
+
onChange: ({ target: { checked: h } }) => {
|
|
769
|
+
this.setState({ hideExtinct: h }), M("tree-extant-only", h);
|
|
759
770
|
},
|
|
760
771
|
children: "Extant only"
|
|
761
772
|
}
|
|
762
773
|
)
|
|
763
774
|
] })
|
|
764
775
|
] }),
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
|
|
776
|
+
/* @__PURE__ */ e.jsx(
|
|
777
|
+
J,
|
|
767
778
|
{
|
|
768
|
-
insertPlaceholder:
|
|
769
|
-
hideExtinct:
|
|
770
|
-
datasetKey:
|
|
771
|
-
defaultTaxonKey:
|
|
779
|
+
insertPlaceholder: s,
|
|
780
|
+
hideExtinct: n,
|
|
781
|
+
datasetKey: t,
|
|
782
|
+
defaultTaxonKey: a,
|
|
772
783
|
expandedTaxonKey: o,
|
|
773
784
|
onExpandedTaxonKeyChange: r,
|
|
774
|
-
treeRef: (
|
|
785
|
+
treeRef: (h) => this.treeRef = h,
|
|
775
786
|
type: f
|
|
776
787
|
}
|
|
777
788
|
)
|
|
778
789
|
] }) }),
|
|
779
|
-
|
|
790
|
+
i === "bottom" && p && /* @__PURE__ */ e.jsx(R, { dataset: p })
|
|
780
791
|
] });
|
|
781
792
|
});
|
|
782
|
-
|
|
783
|
-
hideExtinct:
|
|
784
|
-
showInfo:
|
|
793
|
+
ut(this.props.auth), this.state = {
|
|
794
|
+
hideExtinct: F("tree-extant-only", !1),
|
|
795
|
+
showInfo: F("tree-show-source", !1),
|
|
785
796
|
dataset: null
|
|
786
797
|
}, this.cache = B(this.props.datasetKey);
|
|
787
798
|
}
|
|
788
|
-
componentDidUpdate(
|
|
789
|
-
|
|
799
|
+
componentDidUpdate(t) {
|
|
800
|
+
t.datasetKey !== this.props.datasetKey && (this.cache = B(this.props.datasetKey));
|
|
790
801
|
}
|
|
791
802
|
}
|
|
792
|
-
|
|
793
|
-
function
|
|
794
|
-
datasetKey:
|
|
795
|
-
defaultTaxonKey:
|
|
796
|
-
expandedTaxonKey:
|
|
797
|
-
onExpandedTaxonKeyChange:
|
|
803
|
+
u(Q, "contextType", H);
|
|
804
|
+
function St({
|
|
805
|
+
datasetKey: x,
|
|
806
|
+
defaultTaxonKey: y,
|
|
807
|
+
expandedTaxonKey: t,
|
|
808
|
+
onExpandedTaxonKeyChange: a,
|
|
798
809
|
showTreeOptions: o,
|
|
799
810
|
linkToSpeciesPage: r,
|
|
800
|
-
citation:
|
|
801
|
-
type:
|
|
802
|
-
insertPlaceholder:
|
|
811
|
+
citation: l,
|
|
812
|
+
type: d,
|
|
813
|
+
insertPlaceholder: i,
|
|
803
814
|
auth: f,
|
|
804
|
-
...
|
|
815
|
+
...s
|
|
805
816
|
}) {
|
|
806
|
-
return /* @__PURE__ */
|
|
807
|
-
|
|
817
|
+
return /* @__PURE__ */ e.jsx(H.Provider, { value: pt(s), children: /* @__PURE__ */ e.jsx(
|
|
818
|
+
Q,
|
|
808
819
|
{
|
|
809
|
-
datasetKey:
|
|
810
|
-
defaultTaxonKey:
|
|
811
|
-
expandedTaxonKey:
|
|
812
|
-
onExpandedTaxonKeyChange:
|
|
820
|
+
datasetKey: x,
|
|
821
|
+
defaultTaxonKey: y,
|
|
822
|
+
expandedTaxonKey: t,
|
|
823
|
+
onExpandedTaxonKeyChange: a,
|
|
813
824
|
showTreeOptions: o,
|
|
814
825
|
linkToSpeciesPage: r,
|
|
815
|
-
citation:
|
|
816
|
-
type:
|
|
817
|
-
insertPlaceholder:
|
|
826
|
+
citation: l,
|
|
827
|
+
type: d,
|
|
828
|
+
insertPlaceholder: i,
|
|
818
829
|
auth: f
|
|
819
830
|
}
|
|
820
831
|
) });
|
|
821
832
|
}
|
|
822
|
-
const
|
|
833
|
+
const Rt = st(et(St));
|
|
823
834
|
export {
|
|
824
|
-
|
|
835
|
+
Rt as Tree
|
|
825
836
|
};
|
|
826
837
|
//# sourceMappingURL=tree.js.map
|