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