col-browser 2.3.6 → 2.3.8
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/es/tree.js +186 -186
- package/es/tree.js.map +1 -1
- package/package.json +1 -1
- package/umd/col-browser.js +4 -5
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +2 -2
- package/umd/col-browser.min.js.map +1 -1
package/es/tree.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var J = Object.defineProperty;
|
|
2
|
-
var Q = (
|
|
3
|
-
var
|
|
2
|
+
var Q = (m, x, e) => x in m ? J(m, x, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[x] = e;
|
|
3
|
+
var p = (m, x, e) => Q(m, typeof x != "symbol" ? x + "" : x, e);
|
|
4
4
|
import { a as X } from "./chunks/withDatasetKey-BgMY05XE.js";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as T, w as Y } from "./chunks/config-BPRXv9x8.js";
|
|
6
6
|
import { j as t } from "./chunks/jsx-runtime-BzflLqGi.js";
|
|
7
7
|
import j, { createContext as ee } from "react";
|
|
8
|
-
import { Popover as te, Divider as se, Spin as R, Tag as ae, Alert as b, Skeleton as oe, Tree as
|
|
9
|
-
import { sortBy as N, get as
|
|
8
|
+
import { Popover as te, Divider as se, Spin as R, Tag as ae, Alert as b, Skeleton as oe, Tree as ne, Button as ie, Row as re, Col as v, Checkbox as $ } from "antd";
|
|
9
|
+
import { sortBy as N, get as y, isUndefined as I, flatten as le, isArray as A } from "lodash-es";
|
|
10
10
|
import { L, c as D, R as U, s as de, b as he } from "./chunks/router-CssZk5qZ.js";
|
|
11
|
-
import
|
|
11
|
+
import S from "dataloader";
|
|
12
12
|
import { c as W, b as H, g as ce } from "./chunks/dataset-DvQG4NjA.js";
|
|
13
13
|
import { M as pe } from "./chunks/MergedDataBadge-CdQ7RzDt.js";
|
|
14
14
|
import { E as ue } from "./chunks/ErrorMsg-K8k5PPTp.js";
|
|
@@ -18,10 +18,10 @@ import { r as O, w as M } from "./chunks/storage-BgdCo9fV.js";
|
|
|
18
18
|
const w = ee({
|
|
19
19
|
datasetLoader: null,
|
|
20
20
|
publisherLoader: null
|
|
21
|
-
}), B = (
|
|
22
|
-
datasetLoader: new
|
|
23
|
-
publisherLoader: new
|
|
24
|
-
(
|
|
21
|
+
}), B = (m) => ({
|
|
22
|
+
datasetLoader: new S((x) => H(x, m)),
|
|
23
|
+
publisherLoader: new S(
|
|
24
|
+
(x) => W(x, m)
|
|
25
25
|
)
|
|
26
26
|
});
|
|
27
27
|
class V extends j.Component {
|
|
@@ -31,25 +31,25 @@ class V extends j.Component {
|
|
|
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
|
-
|
|
34
|
+
p(this, "getDatasetLoader", () => {
|
|
35
35
|
var s;
|
|
36
36
|
const { datasetKey: e } = this.props;
|
|
37
|
-
return (s = this.context) != null && s.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new
|
|
37
|
+
return (s = this.context) != null && s.datasetLoader ? this.context.datasetLoader : (this._localDatasetLoader || (this._localDatasetLoader = new S(
|
|
38
38
|
(o) => H(o, e)
|
|
39
39
|
)), this._localDatasetLoader);
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
p(this, "getPublisherLoader", () => {
|
|
42
42
|
var s;
|
|
43
43
|
const { datasetKey: e } = this.props;
|
|
44
|
-
return (s = this.context) != null && s.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new
|
|
44
|
+
return (s = this.context) != null && s.publisherLoader ? this.context.publisherLoader : (this._localPublisherLoader || (this._localPublisherLoader = new S(
|
|
45
45
|
(o) => W(o, e)
|
|
46
46
|
)), this._localPublisherLoader);
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
p(this, "componentDidMount", () => {
|
|
49
49
|
const { sourceDatasetKeys: e } = this.props;
|
|
50
50
|
e && e.length < 4 && this.setState({ showInNode: !0 }, this.getData);
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
p(this, "getData", () => {
|
|
53
53
|
const { sourceDatasetKeys: e } = this.props;
|
|
54
54
|
if (!(e != null && e.length)) return;
|
|
55
55
|
this.setState({ loading: !0 });
|
|
@@ -62,7 +62,7 @@ class V extends j.Component {
|
|
|
62
62
|
this.setState({ data: [], loading: !1 });
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
p(this, "getPublisherData", () => {
|
|
66
66
|
const { publisherDatasetKeys: e } = this.props;
|
|
67
67
|
if (!e) return;
|
|
68
68
|
const s = this.getPublisherLoader();
|
|
@@ -79,22 +79,22 @@ class V extends j.Component {
|
|
|
79
79
|
this.setState({ publishers: [] });
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
-
|
|
83
|
-
const { data: e, showInNode: s, popOverVisible: o, loading: r } = this.state, { taxon:
|
|
84
|
-
return s ? e.filter((a) => !!a).map((a,
|
|
82
|
+
p(this, "render", () => {
|
|
83
|
+
const { data: e, showInNode: s, popOverVisible: o, loading: r } = this.state, { taxon: h, datasetKey: c } = this.props, n = { color: "orange", fontSize: "11px" }, f = (a) => `${T.clbPortal}/dataset/${c}/publisher/${a}`;
|
|
84
|
+
return s ? e.filter((a) => !!a).map((a, l) => /* @__PURE__ */ t.jsx(
|
|
85
85
|
L,
|
|
86
86
|
{
|
|
87
87
|
to: "source",
|
|
88
88
|
args: a.key,
|
|
89
89
|
className: "col-tree-data-source",
|
|
90
90
|
style: n,
|
|
91
|
-
children: (
|
|
91
|
+
children: (l ? ", " : "") + (a.alias || a.key)
|
|
92
92
|
},
|
|
93
93
|
a.key
|
|
94
|
-
)) : /* @__PURE__ */ t.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${
|
|
94
|
+
)) : /* @__PURE__ */ t.jsx("div", { style: { display: "inline" }, id: `taxon_sources_${h.id}`, children: /* @__PURE__ */ t.jsx(
|
|
95
95
|
te,
|
|
96
96
|
{
|
|
97
|
-
getPopupContainer: () => document.getElementById(`taxon_sources_${
|
|
97
|
+
getPopupContainer: () => document.getElementById(`taxon_sources_${h.id}`),
|
|
98
98
|
content: r || e.length === 0 ? /* @__PURE__ */ t.jsx(
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
@@ -102,30 +102,30 @@ class V extends j.Component {
|
|
|
102
102
|
children: /* @__PURE__ */ t.jsx(R, { size: "small" })
|
|
103
103
|
}
|
|
104
104
|
) : /* @__PURE__ */ t.jsxs("div", { style: { maxWidth: "500px" }, children: [
|
|
105
|
-
e.length > 0 && /* @__PURE__ */ t.jsx("div", { children: e.filter((a) => !!a).map((a,
|
|
105
|
+
e.length > 0 && /* @__PURE__ */ t.jsx("div", { children: e.filter((a) => !!a).map((a, l) => /* @__PURE__ */ t.jsx(
|
|
106
106
|
L,
|
|
107
107
|
{
|
|
108
108
|
to: "source",
|
|
109
109
|
args: a.key,
|
|
110
110
|
className: "col-tree-data-source",
|
|
111
111
|
style: n,
|
|
112
|
-
children: (
|
|
112
|
+
children: (l ? ", " : "") + (a.alias || a.key)
|
|
113
113
|
},
|
|
114
114
|
a.key
|
|
115
115
|
)) }),
|
|
116
116
|
this.state.publishers && this.state.publishers.length > 0 && /* @__PURE__ */ t.jsxs("div", { style: { marginTop: "12px" }, children: [
|
|
117
117
|
/* @__PURE__ */ t.jsx("strong", { children: "Publishers" }),
|
|
118
|
-
/* @__PURE__ */ t.jsx("div", { children: this.state.publishers.filter((a) => !!a).map((a,
|
|
118
|
+
/* @__PURE__ */ t.jsx("div", { children: this.state.publishers.filter((a) => !!a).map((a, l) => {
|
|
119
119
|
var u;
|
|
120
120
|
return /* @__PURE__ */ t.jsxs(
|
|
121
121
|
"a",
|
|
122
122
|
{
|
|
123
|
-
href:
|
|
123
|
+
href: f(a.id),
|
|
124
124
|
target: "_blank",
|
|
125
125
|
rel: "noopener noreferrer",
|
|
126
126
|
style: n,
|
|
127
127
|
children: [
|
|
128
|
-
(
|
|
128
|
+
(l ? ", " : "") + (a.alias || a.id),
|
|
129
129
|
(u = a.datasets) != null && u.length ? ` (${a.datasets.length.toLocaleString("en-GB")})` : ""
|
|
130
130
|
]
|
|
131
131
|
},
|
|
@@ -136,7 +136,7 @@ class V extends j.Component {
|
|
|
136
136
|
] }),
|
|
137
137
|
title: /* @__PURE__ */ t.jsxs("div", { style: { padding: "4px 0" }, children: [
|
|
138
138
|
/* @__PURE__ */ t.jsx("span", { style: { fontWeight: 500 }, children: "Sources for " }),
|
|
139
|
-
/* @__PURE__ */ t.jsx("em", { children:
|
|
139
|
+
/* @__PURE__ */ t.jsx("em", { children: h == null ? void 0 : h.name }),
|
|
140
140
|
/* @__PURE__ */ t.jsx(se, { style: { margin: "8px 0 0" } })
|
|
141
141
|
] }),
|
|
142
142
|
open: o,
|
|
@@ -166,27 +166,27 @@ class V extends j.Component {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
p(V, "contextType", w);
|
|
170
170
|
const z = j.createContext();
|
|
171
171
|
class k extends j.Component {
|
|
172
172
|
constructor(e) {
|
|
173
173
|
super(e);
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
p(this, "rankIsAboveSpecies", (e) => this.props.rank.indexOf(e) < this.props.rank.indexOf("species"));
|
|
175
|
+
p(this, "render", () => {
|
|
176
176
|
const {
|
|
177
177
|
taxon: e,
|
|
178
178
|
taxon: { sector: s, sourceDatasetKeys: o, publisherDatasetKeys: r },
|
|
179
|
-
datasetKey:
|
|
180
|
-
} = this.props,
|
|
179
|
+
datasetKey: h
|
|
180
|
+
} = this.props, c = y(s, "dataset"), n = (o || []).filter((a) => (s == null ? void 0 : s.subjectDatasetKey) !== a).length > 0;
|
|
181
181
|
e.estimate && e.estimates && e.estimates.find((a) => a.estimate === e.estimate);
|
|
182
|
-
const
|
|
182
|
+
const f = typeof e.id == "string" && e.id.indexOf("incertae-sedis") > -1;
|
|
183
183
|
return /* @__PURE__ */ t.jsx(z.Consumer, { children: ({ showInfo: a }) => /* @__PURE__ */ t.jsxs("div", { id: e.id, children: [
|
|
184
184
|
/* @__PURE__ */ t.jsxs("span", { children: [
|
|
185
185
|
/* @__PURE__ */ t.jsxs("span", { className: "tree-node-rank", children: [
|
|
186
186
|
e.rank,
|
|
187
187
|
": "
|
|
188
188
|
] }),
|
|
189
|
-
|
|
189
|
+
f ? /* @__PURE__ */ t.jsx("span", { dangerouslySetInnerHTML: { __html: e.labelHtml } }) : /* @__PURE__ */ t.jsx(L, { to: "taxon", args: e.id, children: /* @__PURE__ */ t.jsx("span", { dangerouslySetInnerHTML: { __html: e.labelHtml } }) }),
|
|
190
190
|
(e == null ? void 0 : e.merged) && /* @__PURE__ */ t.jsx(pe, { style: { marginLeft: "4px" }, datasetKey: e == null ? void 0 : e.datasetKey, verbatimSourceKey: e == null ? void 0 : e.verbatimSourceKey })
|
|
191
191
|
] }),
|
|
192
192
|
a && e.status === "provisionally accepted" && /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
|
|
@@ -221,7 +221,7 @@ class k extends j.Component {
|
|
|
221
221
|
style: n ? { fontWeight: "bold" } : null,
|
|
222
222
|
className: "col-tree-data-source",
|
|
223
223
|
children: [
|
|
224
|
-
|
|
224
|
+
y(c, "alias") || s.subjectDatasetKey,
|
|
225
225
|
n && ", "
|
|
226
226
|
]
|
|
227
227
|
}
|
|
@@ -235,7 +235,7 @@ class k extends j.Component {
|
|
|
235
235
|
sourceDatasetKeys: o,
|
|
236
236
|
publisherDatasetKeys: r,
|
|
237
237
|
taxon: e,
|
|
238
|
-
datasetKey:
|
|
238
|
+
datasetKey: h
|
|
239
239
|
}
|
|
240
240
|
)
|
|
241
241
|
] })
|
|
@@ -252,13 +252,13 @@ const K = 1e3;
|
|
|
252
252
|
class ge extends j.Component {
|
|
253
253
|
constructor(e) {
|
|
254
254
|
super(e);
|
|
255
|
-
|
|
255
|
+
p(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
|
+
p(this, "render", () => {
|
|
262
262
|
const { loading: e } = this.state;
|
|
263
263
|
return /* @__PURE__ */ t.jsxs(j.Fragment, { children: [
|
|
264
264
|
e && /* @__PURE__ */ t.jsx(R, {}),
|
|
@@ -271,23 +271,23 @@ class ge extends j.Component {
|
|
|
271
271
|
class G extends j.Component {
|
|
272
272
|
constructor(e) {
|
|
273
273
|
super(e);
|
|
274
|
-
|
|
274
|
+
p(this, "componentDidMount", () => {
|
|
275
275
|
const { datasetKey: e } = this.props;
|
|
276
|
-
this.loadRoot(), this.sectorLoader = new
|
|
276
|
+
this.loadRoot(), this.sectorLoader = new S(
|
|
277
277
|
(o) => fe(o, e)
|
|
278
278
|
), this.getRank();
|
|
279
279
|
const { treeRef: s } = this.props;
|
|
280
280
|
s(this);
|
|
281
281
|
});
|
|
282
|
-
|
|
282
|
+
p(this, "componentDidUpdate", (e) => {
|
|
283
283
|
(e.defaultExpandKey !== this.props.defaultExpandKey || e.hideExtinct !== this.props.hideExtinct || e.insertPlaceholder !== this.props.insertPlaceholder) && this.reloadRoot();
|
|
284
284
|
});
|
|
285
|
-
|
|
286
|
-
D(`${
|
|
285
|
+
p(this, "getRank", () => {
|
|
286
|
+
D(`${T.dataApi}vocab/rank`).then(
|
|
287
287
|
(e) => this.setState({ rank: e.data.map((s) => s.name) })
|
|
288
288
|
);
|
|
289
289
|
});
|
|
290
|
-
|
|
290
|
+
p(this, "reloadRoot", () => this.setState(
|
|
291
291
|
{
|
|
292
292
|
rootLoading: !0,
|
|
293
293
|
treeData: [],
|
|
@@ -298,31 +298,31 @@ class G extends j.Component {
|
|
|
298
298
|
},
|
|
299
299
|
this.loadRoot
|
|
300
300
|
));
|
|
301
|
-
|
|
301
|
+
p(this, "loadRoot", async () => {
|
|
302
302
|
const {
|
|
303
303
|
showSourceTaxon: e,
|
|
304
304
|
datasetKey: s,
|
|
305
305
|
hideExtinct: o,
|
|
306
306
|
insertPlaceholder: r,
|
|
307
|
-
type:
|
|
308
|
-
expandedTaxonKey:
|
|
309
|
-
} = this.props, n =
|
|
307
|
+
type: h,
|
|
308
|
+
expandedTaxonKey: c
|
|
309
|
+
} = this.props, n = c, { defaultTaxonKey: f } = this.props;
|
|
310
310
|
return this.setState({ rootLoading: !0, treeData: [] }), D(
|
|
311
|
-
`${
|
|
311
|
+
`${T.dataApi}dataset/${s}/tree?projectKey=${s}${h ? "&type=" + h : ""}&limit=${K}&offset=${this.state.treeData.length}${o ? "&extinct=false&extinct=" : ""}${r ? "&insertPlaceholder=true" : ""}`
|
|
312
312
|
).then(this.decorateWithSectorsAndDataset).then((a) => {
|
|
313
|
-
const
|
|
313
|
+
const l = a.data.result || [], u = a.data.total, g = l.map((d) => {
|
|
314
314
|
let i = {
|
|
315
|
-
taxon:
|
|
316
|
-
key:
|
|
315
|
+
taxon: d,
|
|
316
|
+
key: d.id,
|
|
317
317
|
datasetKey: s,
|
|
318
|
-
childCount:
|
|
319
|
-
isLeaf:
|
|
318
|
+
childCount: d.childCount,
|
|
319
|
+
isLeaf: d.childCount === 0,
|
|
320
320
|
childOffset: 0
|
|
321
321
|
};
|
|
322
322
|
return i.title = /* @__PURE__ */ t.jsx(
|
|
323
323
|
k,
|
|
324
324
|
{
|
|
325
|
-
taxon:
|
|
325
|
+
taxon: d,
|
|
326
326
|
datasetKey: s,
|
|
327
327
|
showSourceTaxon: e,
|
|
328
328
|
reloadChildren: () => this.fetchChildPage(i, !0),
|
|
@@ -334,7 +334,7 @@ class G extends j.Component {
|
|
|
334
334
|
{
|
|
335
335
|
rootTotal: u,
|
|
336
336
|
rootLoading: !1,
|
|
337
|
-
treeData: [...this.state.treeData, ...
|
|
337
|
+
treeData: [...this.state.treeData, ...g],
|
|
338
338
|
// Nothing is auto-expanded by default. Consumers open a specific root
|
|
339
339
|
// (or deep taxon) by passing `defaultTaxonKey`/`expandedTaxonKey` —
|
|
340
340
|
// e.g. defaultTaxonKey="CS5HF" opens Eukaryota in current COL releases.
|
|
@@ -344,10 +344,10 @@ class G extends j.Component {
|
|
|
344
344
|
() => {
|
|
345
345
|
if (n)
|
|
346
346
|
return this.expandToTaxon(n);
|
|
347
|
-
if (
|
|
348
|
-
return this.expandToTaxon(
|
|
347
|
+
if (f)
|
|
348
|
+
return this.expandToTaxon(f);
|
|
349
349
|
}
|
|
350
|
-
),
|
|
350
|
+
), g.length === 1 && this.fetchChildPage(g[g.length - 1]);
|
|
351
351
|
}).catch((a) => {
|
|
352
352
|
this.setState({
|
|
353
353
|
treeData: [],
|
|
@@ -357,25 +357,25 @@ class G extends j.Component {
|
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
359
|
});
|
|
360
|
-
|
|
360
|
+
p(this, "expandToTaxon", async (e) => {
|
|
361
361
|
const {
|
|
362
362
|
showSourceTaxon: s,
|
|
363
363
|
datasetKey: o,
|
|
364
364
|
hideExtinct: r,
|
|
365
|
-
type:
|
|
365
|
+
type: h
|
|
366
366
|
} = this.props;
|
|
367
367
|
this.setState({
|
|
368
368
|
rootLoading: !0
|
|
369
369
|
/* , treeData: [] */
|
|
370
370
|
});
|
|
371
|
-
const { data:
|
|
372
|
-
`${
|
|
371
|
+
const { data: c } = await D(
|
|
372
|
+
`${T.dataApi}dataset/${o}/tree/${e}?projectKey=${o}&insertPlaceholder=true${h ? "&type=" + h : ""}${r ? "&extinct=false" : ""}`
|
|
373
373
|
).then(
|
|
374
|
-
(
|
|
375
|
-
data: { result:
|
|
376
|
-
}).then(() =>
|
|
374
|
+
(d) => this.decorateWithSectorsAndDataset({
|
|
375
|
+
data: { result: d.data }
|
|
376
|
+
}).then(() => d)
|
|
377
377
|
);
|
|
378
|
-
if (
|
|
378
|
+
if (c.length === 0)
|
|
379
379
|
return this.setState(
|
|
380
380
|
{
|
|
381
381
|
error: {
|
|
@@ -384,8 +384,8 @@ class G extends j.Component {
|
|
|
384
384
|
},
|
|
385
385
|
this.loadRoot
|
|
386
386
|
);
|
|
387
|
-
const n =
|
|
388
|
-
let
|
|
387
|
+
const n = c[c.length - 1];
|
|
388
|
+
let f = {
|
|
389
389
|
taxon: n,
|
|
390
390
|
key: n.id,
|
|
391
391
|
datasetKey: o,
|
|
@@ -393,19 +393,19 @@ class G extends j.Component {
|
|
|
393
393
|
isLeaf: n.childCount === 0,
|
|
394
394
|
childOffset: 0
|
|
395
395
|
};
|
|
396
|
-
|
|
396
|
+
f.title = /* @__PURE__ */ t.jsx(
|
|
397
397
|
k,
|
|
398
398
|
{
|
|
399
399
|
taxon: n,
|
|
400
400
|
datasetKey: o,
|
|
401
401
|
showSourceTaxon: s,
|
|
402
402
|
rank: this.state.rank,
|
|
403
|
-
reloadChildren: () => this.fetchChildPage(
|
|
403
|
+
reloadChildren: () => this.fetchChildPage(f, !0)
|
|
404
404
|
}
|
|
405
|
-
),
|
|
406
|
-
const a =
|
|
407
|
-
for (let
|
|
408
|
-
const i =
|
|
405
|
+
), f.ref = f;
|
|
406
|
+
const a = f;
|
|
407
|
+
for (let d = c.length - 2; d >= 0; d--) {
|
|
408
|
+
const i = c[d], C = {
|
|
409
409
|
taxon: i,
|
|
410
410
|
key: i.id,
|
|
411
411
|
datasetKey: o,
|
|
@@ -413,70 +413,70 @@ class G extends j.Component {
|
|
|
413
413
|
isLeaf: i.childCount === 0,
|
|
414
414
|
childOffset: 0
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
C.ref = C, C.title = /* @__PURE__ */ t.jsx(
|
|
417
417
|
k,
|
|
418
418
|
{
|
|
419
419
|
taxon: i,
|
|
420
420
|
datasetKey: o,
|
|
421
421
|
showSourceTaxon: s,
|
|
422
422
|
rank: this.state.rank,
|
|
423
|
-
reloadChildren: () => this.fetchChildPage(
|
|
423
|
+
reloadChildren: () => this.fetchChildPage(C, !0)
|
|
424
424
|
}
|
|
425
|
-
),
|
|
425
|
+
), f.children = [C], f = C;
|
|
426
426
|
}
|
|
427
|
-
const { treeData:
|
|
428
|
-
var u =
|
|
429
|
-
|
|
430
|
-
const
|
|
427
|
+
const { treeData: l } = this.state;
|
|
428
|
+
var u = l.findIndex((d) => d.key == a.key);
|
|
429
|
+
l[u] = a;
|
|
430
|
+
const g = [...c.map((d) => d.id).reverse()];
|
|
431
431
|
this.setState(
|
|
432
|
-
{ treeData:
|
|
433
|
-
() => this.reloadLoadedKeys(
|
|
432
|
+
{ treeData: l },
|
|
433
|
+
() => this.reloadLoadedKeys(g, e)
|
|
434
434
|
);
|
|
435
435
|
});
|
|
436
|
-
|
|
436
|
+
p(this, "fetchChildPage", async (e, s, o) => {
|
|
437
437
|
const {
|
|
438
438
|
showSourceTaxon: r,
|
|
439
|
-
datasetKey:
|
|
440
|
-
hideExtinct:
|
|
439
|
+
datasetKey: h,
|
|
440
|
+
hideExtinct: c,
|
|
441
441
|
insertPlaceholder: n,
|
|
442
|
-
type:
|
|
443
|
-
} = this.props
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
`${
|
|
442
|
+
type: f
|
|
443
|
+
} = this.props;
|
|
444
|
+
y(e, "childCount");
|
|
445
|
+
const a = K, l = y(e, "childOffset"), u = await D(
|
|
446
|
+
`${T.dataApi}dataset/${h}/tree/${e.taxon.id}/children?limit=${a}&offset=${l}&projectKey=${h}${f ? "&type=" + f : ""}${c ? "&extinct=false" : ""}${n ? "&insertPlaceholder=true" : ""}`
|
|
447
447
|
);
|
|
448
|
-
await this.decorateWithSectorsAndDataset(
|
|
449
|
-
const
|
|
450
|
-
let
|
|
451
|
-
taxon:
|
|
452
|
-
key:
|
|
453
|
-
datasetKey:
|
|
454
|
-
childCount:
|
|
455
|
-
isLeaf:
|
|
448
|
+
await this.decorateWithSectorsAndDataset(u);
|
|
449
|
+
const g = u.data.result ? u.data.result.map((d) => {
|
|
450
|
+
let i = {
|
|
451
|
+
taxon: d,
|
|
452
|
+
key: d.id,
|
|
453
|
+
datasetKey: h,
|
|
454
|
+
childCount: d.childCount,
|
|
455
|
+
isLeaf: d.childCount === 0,
|
|
456
456
|
childOffset: 0,
|
|
457
457
|
parent: e,
|
|
458
|
-
name:
|
|
458
|
+
name: d.name
|
|
459
459
|
};
|
|
460
|
-
return
|
|
460
|
+
return i.title = /* @__PURE__ */ t.jsx(
|
|
461
461
|
k,
|
|
462
462
|
{
|
|
463
|
-
taxon:
|
|
464
|
-
datasetKey:
|
|
463
|
+
taxon: d,
|
|
464
|
+
datasetKey: h,
|
|
465
465
|
showSourceTaxon: r,
|
|
466
466
|
rank: this.state.rank,
|
|
467
|
-
reloadChildren: () => this.fetchChildPage(
|
|
467
|
+
reloadChildren: () => this.fetchChildPage(i, !0)
|
|
468
468
|
}
|
|
469
|
-
),
|
|
469
|
+
), i.ref = i, i;
|
|
470
470
|
}) : [];
|
|
471
|
-
if (e.children = e.children &&
|
|
472
|
-
const
|
|
471
|
+
if (e.children = e.children && l !== 0 && !s ? [...e.children, ...g] : g, u.data.last && e.childCount > e.children.length && (e.childCount = e.children.length), !u.data.last) {
|
|
472
|
+
const d = () => (e.childOffset += K, e.children[e.children.length - 1].key === "__loadMoreBTN__" && (e.children = e.children.slice(0, -1)), this.fetchChildPage(e, !1));
|
|
473
473
|
e.children = [
|
|
474
474
|
...e.children,
|
|
475
475
|
{
|
|
476
476
|
title: /* @__PURE__ */ t.jsx(
|
|
477
477
|
ge,
|
|
478
478
|
{
|
|
479
|
-
onClick:
|
|
479
|
+
onClick: d
|
|
480
480
|
},
|
|
481
481
|
"__loadMoreBTN__"
|
|
482
482
|
),
|
|
@@ -486,12 +486,12 @@ class G extends j.Component {
|
|
|
486
486
|
}
|
|
487
487
|
];
|
|
488
488
|
}
|
|
489
|
-
o || this.setState({
|
|
490
|
-
treeData: [...
|
|
491
|
-
loadedKeys: [.../* @__PURE__ */ new Set([...
|
|
492
|
-
});
|
|
489
|
+
o || this.setState((d) => ({
|
|
490
|
+
treeData: [...d.treeData],
|
|
491
|
+
loadedKeys: [.../* @__PURE__ */ new Set([...d.loadedKeys, e.key])]
|
|
492
|
+
}));
|
|
493
493
|
});
|
|
494
|
-
|
|
494
|
+
p(this, "decorateWithSectorsAndDataset", (e) => e.data.result ? Promise.all(
|
|
495
495
|
e.data.result.filter((s) => !!s.sectorDatasetKey).map(
|
|
496
496
|
(s) => this.datasetLoader.load(s.sectorDatasetKey).then(
|
|
497
497
|
(o) => s.sector = {
|
|
@@ -502,37 +502,37 @@ class G extends j.Component {
|
|
|
502
502
|
)
|
|
503
503
|
)
|
|
504
504
|
).then(() => e) : e);
|
|
505
|
-
|
|
506
|
-
|
|
505
|
+
p(this, "onLoadData", (e, s = !1) => (s && (e.childOffset = 0), this.fetchChildPage(e.ref, s)));
|
|
506
|
+
p(this, "findNode", (e, s) => {
|
|
507
507
|
let o = null;
|
|
508
|
-
if (o = s.find((r) =>
|
|
508
|
+
if (o = s.find((r) => y(r, "taxon.id") === e), o)
|
|
509
509
|
return o;
|
|
510
510
|
{
|
|
511
|
-
const r = s.map((
|
|
512
|
-
return
|
|
511
|
+
const r = s.map((c) => y(c, "children") || []), h = le(r);
|
|
512
|
+
return h.length === 0 ? null : this.findNode(e, h);
|
|
513
513
|
}
|
|
514
514
|
});
|
|
515
|
-
|
|
515
|
+
p(this, "pageThroughChildrenUntilTaxonFound", async (e, s) => {
|
|
516
516
|
let o;
|
|
517
517
|
for (; !o && e.children.length < e.childCount; )
|
|
518
518
|
e.childOffset += K, e.children[e.children.length - 1].key === "__loadMoreBTN__" && (e.children = e.children.slice(0, -1)), await this.fetchChildPage(e, !1, !0), o = this.findNode(s, e.children);
|
|
519
519
|
return o || (o = e.children.find(
|
|
520
|
-
(r) =>
|
|
520
|
+
(r) => y(r, "taxon.id") ? r.taxon.id.indexOf("incertae-sedis") > -1 : !1
|
|
521
521
|
)), o;
|
|
522
522
|
});
|
|
523
|
-
|
|
523
|
+
p(this, "reloadLoadedKeys", async (e, s, o = !0) => {
|
|
524
524
|
this.setState({ rootLoading: !0 });
|
|
525
525
|
const { loadedKeys: r } = this.state;
|
|
526
|
-
let { treeData:
|
|
527
|
-
const
|
|
526
|
+
let { treeData: h } = this.state;
|
|
527
|
+
const c = s ? this.findNode(s, h) : null, n = e ? [...e] : [...r];
|
|
528
528
|
for (let a = 0; a < n.length; a++) {
|
|
529
|
-
let
|
|
530
|
-
if (!
|
|
531
|
-
const u = this.findNode(n[a - 1],
|
|
532
|
-
u && A(
|
|
529
|
+
let l = this.findNode(n[a], h);
|
|
530
|
+
if (!l && c && n[a - 1]) {
|
|
531
|
+
const u = this.findNode(n[a - 1], h);
|
|
532
|
+
u && A(y(u, "children")) && u.children.length > 0 && (l = await this.pageThroughChildrenUntilTaxonFound(
|
|
533
533
|
u,
|
|
534
534
|
n[a]
|
|
535
|
-
),
|
|
535
|
+
), l ? n.splice(a, 0, l.taxon.id) : this.setState(
|
|
536
536
|
{
|
|
537
537
|
nodeNotFoundErr: /* @__PURE__ */ t.jsxs("span", { children: [
|
|
538
538
|
"Cannot find taxon ",
|
|
@@ -552,14 +552,14 @@ class G extends j.Component {
|
|
|
552
552
|
} */
|
|
553
553
|
));
|
|
554
554
|
}
|
|
555
|
-
if (
|
|
556
|
-
await this.fetchChildPage(
|
|
557
|
-
let u =
|
|
558
|
-
(
|
|
555
|
+
if (l) {
|
|
556
|
+
await this.fetchChildPage(l, !0, !0);
|
|
557
|
+
let u = l.children.find(
|
|
558
|
+
(g) => y(g, "taxon.id") === y(c, "taxon.id")
|
|
559
559
|
);
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
560
|
+
c && a === n.length - 2 && y(l, "taxon.id") !== y(c, "taxon.id") && A(l.children) && !u && l.children.length < l.childCount && (u = await this.pageThroughChildrenUntilTaxonFound(
|
|
561
|
+
l,
|
|
562
|
+
y(c, "taxon.id")
|
|
563
563
|
), u ? this.setState({ treeData: [...this.state.treeData] }, () => {
|
|
564
564
|
setTimeout(() => {
|
|
565
565
|
document.getElementById(s).scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -579,8 +579,8 @@ class G extends j.Component {
|
|
|
579
579
|
));
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
o && (
|
|
582
|
+
const f = { loadedKeys: n, rootLoading: !1 };
|
|
583
|
+
o && (f.expandedKeys = n), this.setState(f, () => {
|
|
584
584
|
s && setTimeout(() => {
|
|
585
585
|
document.getElementById(s).scrollIntoView({ behavior: "smooth", block: "center" });
|
|
586
586
|
}, 100);
|
|
@@ -609,13 +609,13 @@ class G extends j.Component {
|
|
|
609
609
|
rootTotal: s,
|
|
610
610
|
rootLoading: o,
|
|
611
611
|
treeData: r,
|
|
612
|
-
defaultExpandAll:
|
|
613
|
-
nodeNotFoundErr:
|
|
612
|
+
defaultExpandAll: h,
|
|
613
|
+
nodeNotFoundErr: c,
|
|
614
614
|
loadedKeys: n,
|
|
615
|
-
expandedKeys:
|
|
616
|
-
} = this.state, { treeType: a, dataset:
|
|
615
|
+
expandedKeys: f
|
|
616
|
+
} = this.state, { treeType: a, dataset: l, height: u, expandedTaxonKey: g } = this.props, d = g;
|
|
617
617
|
return /* @__PURE__ */ t.jsxs("div", { children: [
|
|
618
|
-
e && /* @__PURE__ */ t.jsx(j.Fragment, { children:
|
|
618
|
+
e && /* @__PURE__ */ t.jsx(j.Fragment, { children: y(e, "response.data.code") !== 404 ? /* @__PURE__ */ t.jsx(
|
|
619
619
|
b,
|
|
620
620
|
{
|
|
621
621
|
closable: !0,
|
|
@@ -635,50 +635,50 @@ class G extends j.Component {
|
|
|
635
635
|
{
|
|
636
636
|
error: e,
|
|
637
637
|
treeType: a,
|
|
638
|
-
dataset:
|
|
638
|
+
dataset: l,
|
|
639
639
|
loadRoot: this.loadRoot
|
|
640
640
|
}
|
|
641
641
|
),
|
|
642
642
|
type: "warning"
|
|
643
643
|
}
|
|
644
644
|
) }),
|
|
645
|
-
|
|
645
|
+
c && /* @__PURE__ */ t.jsx(
|
|
646
646
|
b,
|
|
647
647
|
{
|
|
648
648
|
closable: !0,
|
|
649
649
|
onClose: () => this.setState({ nodeNotFoundErr: null }),
|
|
650
650
|
style: { marginTop: "8px" },
|
|
651
|
-
message:
|
|
651
|
+
message: c,
|
|
652
652
|
type: "warning"
|
|
653
653
|
}
|
|
654
654
|
),
|
|
655
655
|
o && /* @__PURE__ */ t.jsx(oe, { paragraph: { rows: 10 }, active: !0 }),
|
|
656
656
|
!o && r.length > 0 && /* @__PURE__ */ t.jsx(
|
|
657
|
-
|
|
657
|
+
ne,
|
|
658
658
|
{
|
|
659
659
|
ref: this.treeRef,
|
|
660
|
-
defaultExpandAll:
|
|
660
|
+
defaultExpandAll: h,
|
|
661
661
|
loadData: this.onLoadData,
|
|
662
662
|
onLoad: (i) => this.setState({ loadedKeys: i }),
|
|
663
663
|
loadedKeys: n,
|
|
664
|
-
expandedKeys:
|
|
664
|
+
expandedKeys: f,
|
|
665
665
|
treeData: r,
|
|
666
|
-
filterTreeNode: (i) => i.key ===
|
|
667
|
-
onExpand: (i,
|
|
666
|
+
filterTreeNode: (i) => i.key === d,
|
|
667
|
+
onExpand: (i, C) => {
|
|
668
668
|
this.setState({ expandedKeys: i }), this.props.onExpandedTaxonKeyChange && this.props.onExpandedTaxonKeyChange(
|
|
669
|
-
|
|
669
|
+
C.expanded ? C.node.key : null
|
|
670
670
|
);
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
),
|
|
674
|
-
!e && r.length < s && /* @__PURE__ */ t.jsxs(
|
|
674
|
+
!e && r.length < s && /* @__PURE__ */ t.jsxs(ie, { loading: o, onClick: this.loadRoot, children: [
|
|
675
675
|
"Load more",
|
|
676
676
|
" "
|
|
677
677
|
] })
|
|
678
678
|
] });
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
|
|
681
|
+
p(G, "contextType", w);
|
|
682
682
|
const ye = [
|
|
683
683
|
"infraspecific name",
|
|
684
684
|
"species",
|
|
@@ -688,7 +688,7 @@ const ye = [
|
|
|
688
688
|
class Z extends j.Component {
|
|
689
689
|
constructor(e) {
|
|
690
690
|
super(e);
|
|
691
|
-
|
|
691
|
+
p(this, "componentDidMount", async () => {
|
|
692
692
|
const { datasetKey: e, citation: s } = this.props;
|
|
693
693
|
if (s)
|
|
694
694
|
try {
|
|
@@ -697,27 +697,27 @@ class Z extends j.Component {
|
|
|
697
697
|
} catch {
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
|
-
|
|
700
|
+
p(this, "render", () => {
|
|
701
701
|
const {
|
|
702
702
|
datasetKey: e,
|
|
703
703
|
defaultTaxonKey: s,
|
|
704
704
|
expandedTaxonKey: o,
|
|
705
705
|
onExpandedTaxonKeyChange: r,
|
|
706
|
-
showTreeOptions:
|
|
707
|
-
linkToSpeciesPage:
|
|
706
|
+
showTreeOptions: h,
|
|
707
|
+
linkToSpeciesPage: c,
|
|
708
708
|
citation: n,
|
|
709
|
-
type:
|
|
709
|
+
type: f,
|
|
710
710
|
insertPlaceholder: a = !0
|
|
711
|
-
} = this.props, { hideExtinct:
|
|
711
|
+
} = this.props, { hideExtinct: l, dataset: u } = this.state, g = (i) => {
|
|
712
712
|
var P, _;
|
|
713
|
-
const
|
|
714
|
-
if (!
|
|
715
|
-
const q =
|
|
716
|
-
if (
|
|
713
|
+
const C = y(i, "key");
|
|
714
|
+
if (!C) return;
|
|
715
|
+
const q = y(i, "rank");
|
|
716
|
+
if (c && ye.includes(q)) {
|
|
717
717
|
const E = (_ = (P = this.context) == null ? void 0 : P.taxon) == null ? void 0 : _.onNavigate;
|
|
718
|
-
E && E(
|
|
719
|
-
} else r && (r(
|
|
720
|
-
},
|
|
718
|
+
E && E(C);
|
|
719
|
+
} else r && (r(C), this.treeRef && this.treeRef.reloadRoot && this.treeRef.reloadRoot());
|
|
720
|
+
}, d = () => {
|
|
721
721
|
r && r(null);
|
|
722
722
|
};
|
|
723
723
|
return /* @__PURE__ */ t.jsxs("div", { className: "catalogue-of-life", children: [
|
|
@@ -727,7 +727,7 @@ class Z extends j.Component {
|
|
|
727
727
|
/* @__PURE__ */ t.jsx(v, { flex: "auto", children: /* @__PURE__ */ t.jsx(
|
|
728
728
|
xe,
|
|
729
729
|
{
|
|
730
|
-
hideExtinct:
|
|
730
|
+
hideExtinct: l,
|
|
731
731
|
datasetKey: e,
|
|
732
732
|
style: {
|
|
733
733
|
width: "100%",
|
|
@@ -735,11 +735,11 @@ class Z extends j.Component {
|
|
|
735
735
|
paddingBottom: "5px"
|
|
736
736
|
},
|
|
737
737
|
defaultTaxonKey: o || null,
|
|
738
|
-
onSelectName:
|
|
739
|
-
onResetSearch:
|
|
738
|
+
onSelectName: g,
|
|
739
|
+
onResetSearch: d
|
|
740
740
|
}
|
|
741
741
|
) }),
|
|
742
|
-
|
|
742
|
+
h && /* @__PURE__ */ t.jsxs(v, { style: { paddingLeft: "8px" }, children: [
|
|
743
743
|
/* @__PURE__ */ t.jsx(
|
|
744
744
|
$,
|
|
745
745
|
{
|
|
@@ -766,13 +766,13 @@ class Z extends j.Component {
|
|
|
766
766
|
G,
|
|
767
767
|
{
|
|
768
768
|
insertPlaceholder: a,
|
|
769
|
-
hideExtinct:
|
|
769
|
+
hideExtinct: l,
|
|
770
770
|
datasetKey: e,
|
|
771
771
|
defaultTaxonKey: s,
|
|
772
772
|
expandedTaxonKey: o,
|
|
773
773
|
onExpandedTaxonKeyChange: r,
|
|
774
774
|
treeRef: (i) => this.treeRef = i,
|
|
775
|
-
type:
|
|
775
|
+
type: f
|
|
776
776
|
}
|
|
777
777
|
)
|
|
778
778
|
] }) }),
|
|
@@ -789,33 +789,33 @@ class Z extends j.Component {
|
|
|
789
789
|
e.datasetKey !== this.props.datasetKey && (this.cache = B(this.props.datasetKey));
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
|
|
792
|
+
p(Z, "contextType", U);
|
|
793
793
|
function me({
|
|
794
|
-
datasetKey:
|
|
795
|
-
defaultTaxonKey:
|
|
794
|
+
datasetKey: m,
|
|
795
|
+
defaultTaxonKey: x,
|
|
796
796
|
expandedTaxonKey: e,
|
|
797
797
|
onExpandedTaxonKeyChange: s,
|
|
798
798
|
showTreeOptions: o,
|
|
799
799
|
linkToSpeciesPage: r,
|
|
800
|
-
citation:
|
|
801
|
-
type:
|
|
800
|
+
citation: h,
|
|
801
|
+
type: c,
|
|
802
802
|
insertPlaceholder: n,
|
|
803
|
-
auth:
|
|
803
|
+
auth: f,
|
|
804
804
|
...a
|
|
805
805
|
}) {
|
|
806
806
|
return /* @__PURE__ */ t.jsx(U.Provider, { value: he(a), children: /* @__PURE__ */ t.jsx(
|
|
807
807
|
Z,
|
|
808
808
|
{
|
|
809
|
-
datasetKey:
|
|
810
|
-
defaultTaxonKey:
|
|
809
|
+
datasetKey: m,
|
|
810
|
+
defaultTaxonKey: x,
|
|
811
811
|
expandedTaxonKey: e,
|
|
812
812
|
onExpandedTaxonKeyChange: s,
|
|
813
813
|
showTreeOptions: o,
|
|
814
814
|
linkToSpeciesPage: r,
|
|
815
|
-
citation:
|
|
816
|
-
type:
|
|
815
|
+
citation: h,
|
|
816
|
+
type: c,
|
|
817
817
|
insertPlaceholder: n,
|
|
818
|
-
auth:
|
|
818
|
+
auth: f
|
|
819
819
|
}
|
|
820
820
|
) });
|
|
821
821
|
}
|