col-browser 2.2.4 → 2.2.5
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/search.js +207 -215
- package/es/search.js.map +1 -1
- package/package.json +1 -1
- package/umd/col-browser.js +42 -46
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +5 -5
- package/umd/col-browser.min.js.map +1 -1
package/es/search.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (r, i, e) =>
|
|
4
|
-
import { a as
|
|
5
|
-
import { c as
|
|
1
|
+
var ut = Object.defineProperty;
|
|
2
|
+
var ct = (r, i, e) => i in r ? ut(r, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[i] = e;
|
|
3
|
+
var c = (r, i, e) => ct(r, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { a as ht } from "./chunks/withDatasetKey-BgMY05XE.js";
|
|
5
|
+
import { c as j, w as dt } from "./chunks/config-BPRXv9x8.js";
|
|
6
6
|
import { j as s } from "./chunks/jsx-runtime-BzflLqGi.js";
|
|
7
|
-
import * as
|
|
7
|
+
import * as C from "react";
|
|
8
8
|
import f from "react";
|
|
9
|
-
import { L as S, c as
|
|
10
|
-
import { a as
|
|
11
|
-
import { a as
|
|
12
|
-
import { r as
|
|
13
|
-
import { Input as
|
|
9
|
+
import { L as S, c as b, s as pt, R as mt, b as gt } from "./chunks/router-CssZk5qZ.js";
|
|
10
|
+
import { a as ft } from "./chunks/dataset-DvQG4NjA.js";
|
|
11
|
+
import { a as xt } from "./chunks/enumeration-yDQXSZsf.js";
|
|
12
|
+
import { r as St, w as yt } from "./chunks/storage-BgdCo9fV.js";
|
|
13
|
+
import { Input as G, Form as N, Select as R, Row as x, Col as g, AutoComplete as K, Radio as vt, Alert as jt, Button as I, Table as bt } from "antd";
|
|
14
14
|
import Ct from "query-string";
|
|
15
|
-
import { isArray as
|
|
16
|
-
import { E as
|
|
17
|
-
import { C as
|
|
18
|
-
import
|
|
19
|
-
import { M as
|
|
15
|
+
import { isArray as w, startCase as m, snakeCase as M, get as u, initial as z, debounce as At, isEqual as Dt, isEmpty as Tt, merge as $t, forEach as Et } from "lodash-es";
|
|
16
|
+
import { E as wt } from "./chunks/ErrorMsg-K8k5PPTp.js";
|
|
17
|
+
import { C as F, N as Ot } from "./chunks/DatasetCitation-bkPmDDYB.js";
|
|
18
|
+
import kt from "react-highlight-words";
|
|
19
|
+
import { M as Nt } from "./chunks/MergedDataBadge-DsTsn5Xu.js";
|
|
20
20
|
import { I as P } from "./chunks/AntdIcon-B1nMlqyh.js";
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
return
|
|
21
|
+
var Rt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, name: "down", theme: "outlined" };
|
|
22
|
+
function O() {
|
|
23
|
+
return O = Object.assign ? Object.assign.bind() : function(r) {
|
|
24
24
|
for (var i = 1; i < arguments.length; i++) {
|
|
25
25
|
var e = arguments[i];
|
|
26
26
|
for (var a in e)
|
|
27
27
|
Object.prototype.hasOwnProperty.call(e, a) && (r[a] = e[a]);
|
|
28
28
|
}
|
|
29
29
|
return r;
|
|
30
|
-
},
|
|
30
|
+
}, O.apply(this, arguments);
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const Bt = (r, i) => /* @__PURE__ */ C.createElement(P, O({}, r, {
|
|
33
33
|
ref: i,
|
|
34
|
-
icon:
|
|
35
|
-
})),
|
|
36
|
-
process.env.NODE_ENV !== "production" && (
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
return
|
|
34
|
+
icon: Rt
|
|
35
|
+
})), U = /* @__PURE__ */ C.forwardRef(Bt);
|
|
36
|
+
process.env.NODE_ENV !== "production" && (U.displayName = "DownOutlined");
|
|
37
|
+
var _t = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, name: "up", theme: "outlined" };
|
|
38
|
+
function k() {
|
|
39
|
+
return k = Object.assign ? Object.assign.bind() : function(r) {
|
|
40
40
|
for (var i = 1; i < arguments.length; i++) {
|
|
41
41
|
var e = arguments[i];
|
|
42
42
|
for (var a in e)
|
|
43
43
|
Object.prototype.hasOwnProperty.call(e, a) && (r[a] = e[a]);
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
|
-
},
|
|
46
|
+
}, k.apply(this, arguments);
|
|
47
47
|
}
|
|
48
|
-
const It = (r, i) => /* @__PURE__ */
|
|
48
|
+
const It = (r, i) => /* @__PURE__ */ C.createElement(P, k({}, r, {
|
|
49
49
|
ref: i,
|
|
50
|
-
icon:
|
|
51
|
-
})),
|
|
52
|
-
process.env.NODE_ENV !== "production" && (
|
|
53
|
-
const T = ["family", "superfamily", "order", "subclass", "class", "superclass", "subphylum", "phylum"],
|
|
50
|
+
icon: _t
|
|
51
|
+
})), Y = /* @__PURE__ */ C.forwardRef(It);
|
|
52
|
+
process.env.NODE_ENV !== "production" && (Y.displayName = "UpOutlined");
|
|
53
|
+
const T = ["family", "superfamily", "order", "subclass", "class", "superclass", "subphylum", "phylum"], H = ({ classification: r, maxParents: i = r.length, truncate: e }) => {
|
|
54
54
|
const a = r.slice(Math.max(r.length - i));
|
|
55
55
|
if (e) {
|
|
56
|
-
const
|
|
57
|
-
let
|
|
56
|
+
const n = r.reduce((h, d) => (h[d.rank] = d, h), {}), o = n.kingdom;
|
|
57
|
+
let l;
|
|
58
58
|
for (let h = 0; h < T.length; h++)
|
|
59
|
-
if (
|
|
60
|
-
|
|
59
|
+
if (n[T[h]]) {
|
|
60
|
+
l = n[T[h]];
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
|
-
return o &&
|
|
63
|
+
return o && l ? /* @__PURE__ */ s.jsxs(f.Fragment, { children: [
|
|
64
64
|
/* @__PURE__ */ s.jsx(S, { to: "taxon", args: o.id, children: o.name }),
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */ s.jsx(S, { to: "taxon", args:
|
|
65
|
+
l.rank === "phylum" ? " > " : " > ... > ",
|
|
66
|
+
/* @__PURE__ */ s.jsx(S, { to: "taxon", args: l.id, children: l.name })
|
|
67
67
|
] }) : o ? /* @__PURE__ */ s.jsx(S, { to: "taxon", args: o.id, children: o.name }) : null;
|
|
68
68
|
} else
|
|
69
|
-
return a.map((
|
|
70
|
-
/* @__PURE__ */ s.jsx(S, { to: "taxon", args:
|
|
69
|
+
return a.map((n, o) => /* @__PURE__ */ s.jsxs(f.Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ s.jsx(S, { to: "taxon", args: n.id, children: n.name }),
|
|
71
71
|
!Object.is(a.length - 1, o) && " > "
|
|
72
72
|
] }, o));
|
|
73
|
-
}, Mt =
|
|
74
|
-
class
|
|
73
|
+
}, Mt = G.Search;
|
|
74
|
+
class Ft extends f.Component {
|
|
75
75
|
constructor(e) {
|
|
76
76
|
super(e);
|
|
77
77
|
c(this, "componentDidMount", () => {
|
|
@@ -103,7 +103,7 @@ class Lt extends f.Component {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
const
|
|
106
|
+
const Lt = N.Item, L = R.Option, Vt = {
|
|
107
107
|
labelCol: {
|
|
108
108
|
xs: { span: 24 },
|
|
109
109
|
sm: { span: 24 },
|
|
@@ -124,24 +124,24 @@ class p extends f.Component {
|
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
c(this, "render", () => {
|
|
127
|
-
const { defaultValue: e, label: a, vocab:
|
|
127
|
+
const { defaultValue: e, label: a, vocab: n } = this.props, { randomID: o } = this.state, l = /* @__PURE__ */ new Set([...n.map((d) => d.value)]);
|
|
128
128
|
let h;
|
|
129
|
-
return e &&
|
|
130
|
-
|
|
129
|
+
return e && w(e) ? h = e.filter((d) => l.has(d)) : e && (h = [e].filter((d) => l.has(d))), /* @__PURE__ */ s.jsx(
|
|
130
|
+
Lt,
|
|
131
131
|
{
|
|
132
132
|
...Vt,
|
|
133
133
|
label: a,
|
|
134
134
|
style: { marginBottom: "8px", width: "100%" },
|
|
135
|
-
children: /* @__PURE__ */ s.jsx("div", { id: `${
|
|
136
|
-
|
|
135
|
+
children: /* @__PURE__ */ s.jsx("div", { id: `${M(a)}_${o}`, children: /* @__PURE__ */ s.jsx(
|
|
136
|
+
R,
|
|
137
137
|
{
|
|
138
138
|
showSearch: !0,
|
|
139
139
|
mode: "multiple",
|
|
140
140
|
placeholder: "Please select",
|
|
141
141
|
value: h,
|
|
142
142
|
onChange: this.handleChange,
|
|
143
|
-
getPopupContainer: () => document.getElementById(`${
|
|
144
|
-
children:
|
|
143
|
+
getPopupContainer: () => document.getElementById(`${M(a)}_${o}`),
|
|
144
|
+
children: n.map((d) => typeof d == "string" ? /* @__PURE__ */ s.jsx(L, { value: d, children: m(d) }, d) : /* @__PURE__ */ s.jsx(L, { value: d.value, children: d.label }, d.value))
|
|
145
145
|
}
|
|
146
146
|
) })
|
|
147
147
|
}
|
|
@@ -153,7 +153,7 @@ class p extends f.Component {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
const Gt = ({ issues: r, usage: i, classification: e, vernacularNames: a, issueMap:
|
|
156
|
+
const Gt = ({ issues: r, usage: i, classification: e, vernacularNames: a, issueMap: n }) => /* @__PURE__ */ s.jsxs(f.Fragment, { children: [
|
|
157
157
|
u(i, "id") && /* @__PURE__ */ s.jsxs(x, { style: { marginBottom: "10px" }, children: [
|
|
158
158
|
/* @__PURE__ */ s.jsx(
|
|
159
159
|
g,
|
|
@@ -183,9 +183,9 @@ const Gt = ({ issues: r, usage: i, classification: e, vernacularNames: a, issueM
|
|
|
183
183
|
}
|
|
184
184
|
),
|
|
185
185
|
/* @__PURE__ */ s.jsx(g, { span: 18, children: /* @__PURE__ */ s.jsx(
|
|
186
|
-
|
|
186
|
+
H,
|
|
187
187
|
{
|
|
188
|
-
classification:
|
|
188
|
+
classification: z(e)
|
|
189
189
|
}
|
|
190
190
|
) })
|
|
191
191
|
] }),
|
|
@@ -205,7 +205,7 @@ const Gt = ({ issues: r, usage: i, classification: e, vernacularNames: a, issueM
|
|
|
205
205
|
/* @__PURE__ */ s.jsx(g, { span: 18, style: { paddingBottom: "12px" }, children: a.slice(0, 8).map((o) => o.name).join(", ") })
|
|
206
206
|
] })
|
|
207
207
|
] });
|
|
208
|
-
|
|
208
|
+
K.Option;
|
|
209
209
|
class Kt extends f.Component {
|
|
210
210
|
constructor(e) {
|
|
211
211
|
super(e);
|
|
@@ -218,16 +218,16 @@ class Kt extends f.Component {
|
|
|
218
218
|
a && a !== e.defaultDatasetKey ? this.setDefaultValue(a) : e.defaultDatasetKey && !a && this.setState({ value: "" });
|
|
219
219
|
});
|
|
220
220
|
c(this, "setDefaultValue", (e) => {
|
|
221
|
-
|
|
221
|
+
b(`${j.dataApi}dataset/${e}`).then((a) => {
|
|
222
222
|
this.setState({ value: u(a, "data.title") || "" }), this.props.onSelectDataset(a.data);
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
c(this, "getDatasets", (e) => {
|
|
226
226
|
const { contributesTo: a } = this.props;
|
|
227
|
-
|
|
228
|
-
this.setState({ datasets:
|
|
229
|
-
}).catch((
|
|
230
|
-
this.setState({ datasets: [], err:
|
|
227
|
+
b(`${j.dataApi}dataset?q=${e}&limit=30${a ? "&contributesTo=" + a : ""}`).then((n) => {
|
|
228
|
+
this.setState({ datasets: n.data.result });
|
|
229
|
+
}).catch((n) => {
|
|
230
|
+
this.setState({ datasets: [], err: n });
|
|
231
231
|
});
|
|
232
232
|
});
|
|
233
233
|
c(this, "onSelectDataset", (e, a) => {
|
|
@@ -237,13 +237,13 @@ class Kt extends f.Component {
|
|
|
237
237
|
this.setState({ value: "", names: [] }, this.props.onResetSearch);
|
|
238
238
|
});
|
|
239
239
|
c(this, "render", () => {
|
|
240
|
-
const { value: e, randomID: a } = this.state, { style:
|
|
241
|
-
const h = `${
|
|
240
|
+
const { value: e, randomID: a } = this.state, { style: n } = this.props, o = this.state.datasets ? this.state.datasets.map((l) => {
|
|
241
|
+
const h = `${l.alias || l.title} [${l.key}]`;
|
|
242
242
|
return {
|
|
243
|
-
key:
|
|
243
|
+
key: l.key,
|
|
244
244
|
value: h,
|
|
245
245
|
label: /* @__PURE__ */ s.jsx(
|
|
246
|
-
|
|
246
|
+
kt,
|
|
247
247
|
{
|
|
248
248
|
highlightStyle: { fontWeight: "bold", padding: 0 },
|
|
249
249
|
searchWords: e.split(" "),
|
|
@@ -251,25 +251,25 @@ class Kt extends f.Component {
|
|
|
251
251
|
textToHighlight: h
|
|
252
252
|
}
|
|
253
253
|
),
|
|
254
|
-
data:
|
|
254
|
+
data: l
|
|
255
255
|
};
|
|
256
256
|
}) : [];
|
|
257
257
|
return /* @__PURE__ */ s.jsx("div", { id: `dataset_autocomplete_${a}`, children: /* @__PURE__ */ s.jsx(
|
|
258
|
-
|
|
258
|
+
K,
|
|
259
259
|
{
|
|
260
260
|
onSelect: this.onSelectDataset,
|
|
261
|
-
onSearch: (
|
|
261
|
+
onSearch: (l) => l ? this.getDatasets(l) : this.onReset(),
|
|
262
262
|
options: o,
|
|
263
263
|
placeholder: this.props.placeHolder || "Find dataset",
|
|
264
|
-
style:
|
|
265
|
-
onChange: (
|
|
264
|
+
style: n || { width: "100%" },
|
|
265
|
+
onChange: (l) => this.setState({ value: l }),
|
|
266
266
|
value: e,
|
|
267
267
|
getPopupContainer: () => document.getElementById(`dataset_autocomplete_${a}`),
|
|
268
|
-
children: /* @__PURE__ */ s.jsx(
|
|
268
|
+
children: /* @__PURE__ */ s.jsx(G.Search, { allowClear: !0 })
|
|
269
269
|
}
|
|
270
270
|
) });
|
|
271
271
|
});
|
|
272
|
-
this.getDatasets =
|
|
272
|
+
this.getDatasets = At(this.getDatasets, 500), this.state = {
|
|
273
273
|
datasets: [],
|
|
274
274
|
value: "",
|
|
275
275
|
randomID: (Math.floor(Math.random() * 100) + 1) * (Math.floor(Math.random() * 100) + 1) * (Math.floor(Math.random() * 100) + 1)
|
|
@@ -279,7 +279,7 @@ class Kt extends f.Component {
|
|
|
279
279
|
this.getDatasets.cancel();
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const V = "search-content-type", $ = N.Item, zt = vt.Group, q = [
|
|
283
283
|
"rank",
|
|
284
284
|
"issue",
|
|
285
285
|
"status",
|
|
@@ -291,12 +291,12 @@ const L = "search-content-type", E = C.Item, F = vt.Group, W = [
|
|
|
291
291
|
"environment",
|
|
292
292
|
"group",
|
|
293
293
|
"authorshipYear"
|
|
294
|
-
],
|
|
294
|
+
], v = 50, W = 50, E = {
|
|
295
295
|
limit: 50,
|
|
296
296
|
offset: 0,
|
|
297
|
-
facet:
|
|
297
|
+
facet: q,
|
|
298
298
|
//["rank", "issue", "status", "nomStatus", "nameType", "field"],
|
|
299
|
-
facetLimit:
|
|
299
|
+
facetLimit: W,
|
|
300
300
|
sortBy: "relevance"
|
|
301
301
|
}, Pt = () => [
|
|
302
302
|
{
|
|
@@ -305,8 +305,8 @@ const L = "search-content-type", E = C.Item, F = vt.Group, W = [
|
|
|
305
305
|
key: "merged",
|
|
306
306
|
width: 12,
|
|
307
307
|
render: (r, i) => {
|
|
308
|
-
var e, a,
|
|
309
|
-
return (e = i == null ? void 0 : i.usage) != null && e.merged ? /* @__PURE__ */ s.jsx(
|
|
308
|
+
var e, a, n;
|
|
309
|
+
return (e = i == null ? void 0 : i.usage) != null && e.merged ? /* @__PURE__ */ s.jsx(Nt, { datasetKey: (a = i == null ? void 0 : i.usage) == null ? void 0 : a.datasetKey, verbatimSourceKey: (n = i == null ? void 0 : i.usage) == null ? void 0 : n.verbatimSourceKey }) : "";
|
|
310
310
|
}
|
|
311
311
|
},
|
|
312
312
|
{
|
|
@@ -352,9 +352,9 @@ const L = "search-content-type", E = C.Item, F = vt.Group, W = [
|
|
|
352
352
|
key: "parents",
|
|
353
353
|
width: 180,
|
|
354
354
|
render: (r, i) => u(i, "classification") ? /* @__PURE__ */ s.jsx(
|
|
355
|
-
|
|
355
|
+
H,
|
|
356
356
|
{
|
|
357
|
-
classification:
|
|
357
|
+
classification: z(i.classification),
|
|
358
358
|
truncate: !0,
|
|
359
359
|
datasetKey: u(i, "usage.name.datasetKey")
|
|
360
360
|
},
|
|
@@ -362,14 +362,14 @@ const L = "search-content-type", E = C.Item, F = vt.Group, W = [
|
|
|
362
362
|
) : ""
|
|
363
363
|
}
|
|
364
364
|
];
|
|
365
|
-
class
|
|
365
|
+
class Ut extends f.Component {
|
|
366
366
|
constructor(e) {
|
|
367
367
|
super(e);
|
|
368
368
|
c(this, "componentDidMount", async () => {
|
|
369
369
|
this.parseParamsAndGetData();
|
|
370
370
|
const { datasetKey: e } = this.props;
|
|
371
371
|
try {
|
|
372
|
-
const { data: a } = await
|
|
372
|
+
const { data: a } = await ft(e);
|
|
373
373
|
this.setState({
|
|
374
374
|
dataset: a,
|
|
375
375
|
datasetOrigin: ((a == null ? void 0 : a.origin) || "").toLowerCase()
|
|
@@ -377,33 +377,33 @@ class zt extends f.Component {
|
|
|
377
377
|
} catch {
|
|
378
378
|
}
|
|
379
379
|
try {
|
|
380
|
-
const a = await
|
|
380
|
+
const a = await xt();
|
|
381
381
|
this.setState({ taxGroups: a });
|
|
382
382
|
} catch {
|
|
383
383
|
}
|
|
384
384
|
});
|
|
385
385
|
c(this, "componentDidUpdate", (e) => {
|
|
386
|
-
|
|
386
|
+
Dt(e.filters, this.props.filters) || this.parseParamsAndGetData();
|
|
387
387
|
});
|
|
388
388
|
c(this, "getRank", () => {
|
|
389
|
-
|
|
389
|
+
b(`${j.dataApi}vocab/rank`).then(
|
|
390
390
|
(e) => this.setState({ rank: e.data.map((a) => a.name) })
|
|
391
391
|
);
|
|
392
392
|
});
|
|
393
393
|
c(this, "parseParamsAndGetData", () => {
|
|
394
394
|
const { defaultTaxonKey: e, filters: a } = this.props;
|
|
395
|
-
let
|
|
396
|
-
if (e && !
|
|
397
|
-
|
|
398
|
-
const o =
|
|
399
|
-
o != null && (
|
|
400
|
-
} else
|
|
401
|
-
|
|
395
|
+
let n = { ...a || {} };
|
|
396
|
+
if (e && !n.TAXON_ID && (n.TAXON_ID = e), Tt(n)) {
|
|
397
|
+
n = { ...E };
|
|
398
|
+
const o = St(V, void 0);
|
|
399
|
+
o != null && (n.sectorMode = o), this.pushParams(n);
|
|
400
|
+
} else n.facet || (n.facet = q);
|
|
401
|
+
n.facetLimit || (n.facetLimit = W), delete n.fuzzy, n.type && String(n.type).toUpperCase() !== "FUZZY" && delete n.type, n.limit || (n.limit = v), n.offset || (n.offset = 0), this.setState(
|
|
402
402
|
{
|
|
403
|
-
params:
|
|
403
|
+
params: n,
|
|
404
404
|
pagination: {
|
|
405
|
-
pageSize:
|
|
406
|
-
current: Number(
|
|
405
|
+
pageSize: n.limit || v,
|
|
406
|
+
current: Number(n.offset || 0) / Number(n.limit || v) + 1,
|
|
407
407
|
showQuickJumper: !0,
|
|
408
408
|
pageSizeOptions: [50, 100, 500, 1e3]
|
|
409
409
|
}
|
|
@@ -418,48 +418,48 @@ class zt extends f.Component {
|
|
|
418
418
|
c(this, "getData", () => {
|
|
419
419
|
const { params: e } = this.state;
|
|
420
420
|
this.setState({ loading: !0 });
|
|
421
|
-
const { datasetKey: a } = this.props,
|
|
422
|
-
|
|
421
|
+
const { datasetKey: a } = this.props, n = `${j.dataApi}dataset/${a}/nameusage/search`, o = u(e, "status") ? e : { ...e, status: "_NOT_NULL" };
|
|
422
|
+
b(`${n}?${Ct.stringify(o)}`).then((l) => {
|
|
423
423
|
const h = { ...this.state.pagination };
|
|
424
|
-
h.total =
|
|
424
|
+
h.total = l.data.total, this.setState({
|
|
425
425
|
loading: !1,
|
|
426
|
-
data:
|
|
426
|
+
data: l.data,
|
|
427
427
|
err: null,
|
|
428
428
|
pagination: h
|
|
429
429
|
});
|
|
430
|
-
}).catch((
|
|
431
|
-
this.setState({ loading: !1, error:
|
|
430
|
+
}).catch((l) => {
|
|
431
|
+
this.setState({ loading: !1, error: l, data: [] });
|
|
432
432
|
});
|
|
433
433
|
});
|
|
434
|
-
c(this, "handleTableChange", (e, a,
|
|
435
|
-
let o =
|
|
434
|
+
c(this, "handleTableChange", (e, a, n) => {
|
|
435
|
+
let o = $t(this.state.params, {
|
|
436
436
|
limit: e.pageSize,
|
|
437
437
|
offset: (e.current - 1) * e.pageSize,
|
|
438
438
|
...a
|
|
439
439
|
});
|
|
440
|
-
|
|
440
|
+
n && n.field && (n.field[n.field.length - 1] === "labelHtml" ? o.sortBy = "name" : n.field[n.field.length - 1] === "rank" ? o.sortBy = "taxonomic" : o.sortBy = n.field[n.field.length - 1]), n && n.order === "descend" ? o.reverse = !0 : o.reverse = !1, this.setState({ params: o }, () => this.pushParams(o));
|
|
441
441
|
});
|
|
442
442
|
c(this, "updateSearch", (e) => {
|
|
443
|
-
"sectorMode" in e &&
|
|
443
|
+
"sectorMode" in e && yt(V, e.sectorMode);
|
|
444
444
|
let a = { ...this.state.params, offset: 0, limit: 50 };
|
|
445
|
-
|
|
446
|
-
a[
|
|
445
|
+
Et(e, (o, l) => {
|
|
446
|
+
a[l] = o;
|
|
447
447
|
});
|
|
448
|
-
const
|
|
449
|
-
(o,
|
|
448
|
+
const n = Object.keys(a).reduce(
|
|
449
|
+
(o, l) => (a[l] !== null && (o[l] = a[l]), o),
|
|
450
450
|
{}
|
|
451
451
|
);
|
|
452
452
|
this.setState(
|
|
453
|
-
{ params:
|
|
454
|
-
() => this.pushParams(
|
|
453
|
+
{ params: n },
|
|
454
|
+
() => this.pushParams(n)
|
|
455
455
|
);
|
|
456
456
|
});
|
|
457
457
|
c(this, "resetSearch", () => {
|
|
458
458
|
this.setState(
|
|
459
459
|
{
|
|
460
|
-
params:
|
|
460
|
+
params: E
|
|
461
461
|
},
|
|
462
|
-
() => this.pushParams(
|
|
462
|
+
() => this.pushParams(E)
|
|
463
463
|
);
|
|
464
464
|
});
|
|
465
465
|
c(this, "toggleAdvancedFilters", () => {
|
|
@@ -472,7 +472,7 @@ class zt extends f.Component {
|
|
|
472
472
|
params: {},
|
|
473
473
|
taxGroups: [],
|
|
474
474
|
pagination: {
|
|
475
|
-
pageSize:
|
|
475
|
+
pageSize: v,
|
|
476
476
|
current: 1,
|
|
477
477
|
showQuickJumper: !0,
|
|
478
478
|
pageSizeOptions: [50, 100, 500, 1e3]
|
|
@@ -482,17 +482,17 @@ class zt extends f.Component {
|
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
484
|
render() {
|
|
485
|
-
var
|
|
485
|
+
var _;
|
|
486
486
|
const {
|
|
487
487
|
data: { result: e, facets: a },
|
|
488
|
-
loading:
|
|
488
|
+
loading: n,
|
|
489
489
|
error: o,
|
|
490
|
-
params:
|
|
490
|
+
params: l,
|
|
491
491
|
pagination: h,
|
|
492
492
|
advancedFilters: d,
|
|
493
|
-
dataset:
|
|
494
|
-
taxGroups:
|
|
495
|
-
} = this.state, { datasetKey: A, defaultTaxonKey:
|
|
493
|
+
dataset: y,
|
|
494
|
+
taxGroups: Ht
|
|
495
|
+
} = this.state, { datasetKey: A, defaultTaxonKey: Z, citation: B } = this.props, D = String(l.type || "").toUpperCase() === "FUZZY", X = u(a, "rank") ? a.rank.map((t) => ({
|
|
496
496
|
value: t.value,
|
|
497
497
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
498
498
|
})) : null;
|
|
@@ -500,31 +500,31 @@ class zt extends f.Component {
|
|
|
500
500
|
value: t.value,
|
|
501
501
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
502
502
|
}));
|
|
503
|
-
const
|
|
503
|
+
const J = u(a, "status") ? a.status.map((t) => ({
|
|
504
504
|
value: t.value,
|
|
505
505
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
506
|
-
})) : null,
|
|
506
|
+
})) : null, Q = u(a, "nomStatus") ? a.nomStatus.map((t) => ({
|
|
507
507
|
value: t.value,
|
|
508
508
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
509
|
-
})) : null,
|
|
509
|
+
})) : null, tt = u(a, "nameType") ? a.nameType.map((t) => ({
|
|
510
510
|
value: t.value,
|
|
511
511
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
512
|
-
})) : null,
|
|
512
|
+
})) : null, et = u(a, "field") ? a.field.map((t) => ({
|
|
513
513
|
value: t.value,
|
|
514
514
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
515
|
-
})) : null,
|
|
515
|
+
})) : null, at = u(a, "authorship") ? a.authorship.map((t) => ({
|
|
516
516
|
value: t.value,
|
|
517
517
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
518
|
-
})) : [],
|
|
518
|
+
})) : [], st = (t) => t === "1" || t === !0 || t === "true" ? "Extinct" : t === "0" || t === !1 || t === "false" ? "Extant" : "Unknown", nt = u(a, "extinct") ? a.extinct.map((t) => ({
|
|
519
519
|
value: t.value,
|
|
520
|
-
label: `${
|
|
521
|
-
})) : [],
|
|
520
|
+
label: `${st(t == null ? void 0 : t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
521
|
+
})) : [], lt = u(a, "environment") ? a.environment.map((t) => ({
|
|
522
522
|
value: t.value,
|
|
523
523
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
524
|
-
})) : [],
|
|
524
|
+
})) : [], it = u(a, "group") ? a.group.map((t) => ({
|
|
525
525
|
value: t.value,
|
|
526
526
|
label: `${m(t.value)} (${t.count.toLocaleString("en-GB")})`
|
|
527
|
-
})) : [],
|
|
527
|
+
})) : [], ot = u(a, "authorshipYear") ? a.authorshipYear.map((t) => ({
|
|
528
528
|
value: t.value,
|
|
529
529
|
label: `${t.value} (${t.count.toLocaleString("en-GB")})`
|
|
530
530
|
})) : [];
|
|
@@ -538,19 +538,19 @@ class zt extends f.Component {
|
|
|
538
538
|
margin: "16px 0"
|
|
539
539
|
},
|
|
540
540
|
children: [
|
|
541
|
-
|
|
541
|
+
B === "top" && y && /* @__PURE__ */ s.jsx(F, { dataset: y }),
|
|
542
542
|
/* @__PURE__ */ s.jsx(x, { children: o && /* @__PURE__ */ s.jsx(
|
|
543
|
-
|
|
543
|
+
jt,
|
|
544
544
|
{
|
|
545
545
|
style: { marginBottom: "10px" },
|
|
546
|
-
message: /* @__PURE__ */ s.jsx(
|
|
546
|
+
message: /* @__PURE__ */ s.jsx(wt, { error: o }),
|
|
547
547
|
type: "error"
|
|
548
548
|
}
|
|
549
549
|
) }),
|
|
550
550
|
/* @__PURE__ */ s.jsxs(x, { children: [
|
|
551
551
|
/* @__PURE__ */ s.jsxs(g, { xs: 24, sm: 24, md: 12, style: { marginBottom: "8px" }, children: [
|
|
552
552
|
/* @__PURE__ */ s.jsx(
|
|
553
|
-
|
|
553
|
+
Ft,
|
|
554
554
|
{
|
|
555
555
|
defaultValue: u(this.props.filters || {}, "q"),
|
|
556
556
|
onSearch: (t) => this.updateSearch({ q: t }),
|
|
@@ -559,11 +559,11 @@ class zt extends f.Component {
|
|
|
559
559
|
}
|
|
560
560
|
),
|
|
561
561
|
/* @__PURE__ */ s.jsx(
|
|
562
|
-
|
|
562
|
+
Ot,
|
|
563
563
|
{
|
|
564
564
|
datasetKey: A,
|
|
565
565
|
minRank: "GENUS",
|
|
566
|
-
defaultTaxonKey: u(
|
|
566
|
+
defaultTaxonKey: u(l, "TAXON_ID") || Z || null,
|
|
567
567
|
onSelectName: (t) => {
|
|
568
568
|
this.updateSearch({ TAXON_ID: t.key });
|
|
569
569
|
},
|
|
@@ -582,7 +582,7 @@ class zt extends f.Component {
|
|
|
582
582
|
onSelectDataset: (t) => {
|
|
583
583
|
this.updateSearch({ SECTOR_DATASET_KEY: t.key });
|
|
584
584
|
},
|
|
585
|
-
defaultDatasetKey: u(
|
|
585
|
+
defaultDatasetKey: u(l, "SECTOR_DATASET_KEY") || null,
|
|
586
586
|
onResetSearch: (t) => {
|
|
587
587
|
this.updateSearch({ SECTOR_DATASET_KEY: null });
|
|
588
588
|
},
|
|
@@ -590,67 +590,59 @@ class zt extends f.Component {
|
|
|
590
590
|
autoFocus: !1
|
|
591
591
|
}
|
|
592
592
|
) }),
|
|
593
|
-
/* @__PURE__ */ s.
|
|
594
|
-
|
|
595
|
-
|
|
593
|
+
/* @__PURE__ */ s.jsx("div", { style: { marginTop: "10px" }, children: /* @__PURE__ */ s.jsxs(N, { layout: "inline", children: [
|
|
594
|
+
(this.state.datasetOrigin === "xrelease" || this.state.datasetOrigin === "project") && /* @__PURE__ */ s.jsx($, { label: "Content", children: /* @__PURE__ */ s.jsx(
|
|
595
|
+
zt,
|
|
596
596
|
{
|
|
597
|
+
style: { marginLeft: "8px" },
|
|
597
598
|
size: "small",
|
|
598
599
|
onChange: (t) => {
|
|
599
|
-
this.updateSearch({
|
|
600
|
+
this.updateSearch({ sectorMode: t.target.value.split(",").filter((rt) => rt !== "") });
|
|
600
601
|
},
|
|
601
|
-
value:
|
|
602
|
+
value: w(l == null ? void 0 : l.sectorMode) ? (_ = l == null ? void 0 : l.sectorMode) == null ? void 0 : _.join(",") : (l == null ? void 0 : l.sectorMode) || "",
|
|
602
603
|
optionType: "button",
|
|
603
604
|
options: [
|
|
604
|
-
{ value: "
|
|
605
|
-
{ value: "
|
|
606
|
-
{ value: "
|
|
607
|
-
{ value: "FUZZY", label: "Fuzzy" }
|
|
605
|
+
{ value: "", label: "All" },
|
|
606
|
+
{ value: "attach,union", label: "Base" },
|
|
607
|
+
{ value: "merge", label: "Extended" }
|
|
608
608
|
]
|
|
609
609
|
}
|
|
610
|
-
) })
|
|
611
|
-
/* @__PURE__ */ s.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
{ value: "SCIENTIFIC_NAME", label: "Scientific name" },
|
|
641
|
-
{ value: "AUTHORSHIP", label: "Authorship" },
|
|
642
|
-
{ value: "VERNACULAR_NAME", label: "Vernacular name" }
|
|
643
|
-
]
|
|
644
|
-
}
|
|
645
|
-
) })
|
|
646
|
-
] })
|
|
647
|
-
] })
|
|
610
|
+
) }),
|
|
611
|
+
/* @__PURE__ */ s.jsx($, { children: /* @__PURE__ */ s.jsx(
|
|
612
|
+
R,
|
|
613
|
+
{
|
|
614
|
+
mode: "multiple",
|
|
615
|
+
allowClear: !0,
|
|
616
|
+
size: "small",
|
|
617
|
+
style: { minWidth: 200 },
|
|
618
|
+
placeholder: "Search fields",
|
|
619
|
+
value: w(l == null ? void 0 : l.content) ? l.content : l != null && l.content ? [l.content] : [],
|
|
620
|
+
onChange: (t) => this.updateSearch({ content: t.length ? t : null }),
|
|
621
|
+
options: [
|
|
622
|
+
{ value: "SCIENTIFIC_NAME", label: "Scientific name" },
|
|
623
|
+
{ value: "AUTHORSHIP", label: "Authorship" },
|
|
624
|
+
{ value: "VERNACULAR_NAME", label: "Vernacular name" }
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
) }),
|
|
628
|
+
/* @__PURE__ */ s.jsx($, { children: /* @__PURE__ */ s.jsx(
|
|
629
|
+
I,
|
|
630
|
+
{
|
|
631
|
+
size: "small",
|
|
632
|
+
color: D ? "primary" : "default",
|
|
633
|
+
variant: "outlined",
|
|
634
|
+
"aria-pressed": D,
|
|
635
|
+
onClick: () => this.updateSearch({ type: D ? null : "FUZZY" }),
|
|
636
|
+
children: "Fuzzy"
|
|
637
|
+
}
|
|
638
|
+
) })
|
|
639
|
+
] }) })
|
|
648
640
|
] }),
|
|
649
641
|
/* @__PURE__ */ s.jsxs(g, { xs: 24, sm: 24, md: 12, children: [
|
|
650
642
|
/* @__PURE__ */ s.jsx(
|
|
651
643
|
p,
|
|
652
644
|
{
|
|
653
|
-
defaultValue: u(
|
|
645
|
+
defaultValue: u(l, "rank"),
|
|
654
646
|
onChange: (t) => this.updateSearch({ rank: t }),
|
|
655
647
|
vocab: X || [],
|
|
656
648
|
label: "Ranks"
|
|
@@ -659,18 +651,18 @@ class zt extends f.Component {
|
|
|
659
651
|
/* @__PURE__ */ s.jsx(
|
|
660
652
|
p,
|
|
661
653
|
{
|
|
662
|
-
defaultValue: u(
|
|
654
|
+
defaultValue: u(l, "status"),
|
|
663
655
|
onChange: (t) => this.updateSearch({ status: t }),
|
|
664
|
-
vocab:
|
|
656
|
+
vocab: J || [],
|
|
665
657
|
label: "Status"
|
|
666
658
|
}
|
|
667
659
|
),
|
|
668
660
|
/* @__PURE__ */ s.jsx(
|
|
669
661
|
p,
|
|
670
662
|
{
|
|
671
|
-
defaultValue: u(
|
|
663
|
+
defaultValue: u(l, "environment"),
|
|
672
664
|
onChange: (t) => this.updateSearch({ environment: t }),
|
|
673
|
-
vocab:
|
|
665
|
+
vocab: lt,
|
|
674
666
|
label: "Environment"
|
|
675
667
|
}
|
|
676
668
|
),
|
|
@@ -678,7 +670,7 @@ class zt extends f.Component {
|
|
|
678
670
|
p,
|
|
679
671
|
{
|
|
680
672
|
onChange: (t) => this.updateSearch({ extinct: t }),
|
|
681
|
-
vocab:
|
|
673
|
+
vocab: nt,
|
|
682
674
|
label: "Extinct"
|
|
683
675
|
}
|
|
684
676
|
),
|
|
@@ -686,54 +678,54 @@ class zt extends f.Component {
|
|
|
686
678
|
/* @__PURE__ */ s.jsx(
|
|
687
679
|
p,
|
|
688
680
|
{
|
|
689
|
-
defaultValue: u(
|
|
681
|
+
defaultValue: u(l, "nomstatus"),
|
|
690
682
|
onChange: (t) => this.updateSearch({ nomstatus: t }),
|
|
691
|
-
vocab:
|
|
683
|
+
vocab: Q || [],
|
|
692
684
|
label: "Nomenclatural status"
|
|
693
685
|
}
|
|
694
686
|
),
|
|
695
687
|
/* @__PURE__ */ s.jsx(
|
|
696
688
|
p,
|
|
697
689
|
{
|
|
698
|
-
defaultValue: u(
|
|
690
|
+
defaultValue: u(l, "nameType"),
|
|
699
691
|
onChange: (t) => this.updateSearch({ nameType: t }),
|
|
700
|
-
vocab:
|
|
692
|
+
vocab: tt || [],
|
|
701
693
|
label: "Name type"
|
|
702
694
|
}
|
|
703
695
|
),
|
|
704
696
|
/* @__PURE__ */ s.jsx(
|
|
705
697
|
p,
|
|
706
698
|
{
|
|
707
|
-
defaultValue: u(
|
|
699
|
+
defaultValue: u(l, "field"),
|
|
708
700
|
onChange: (t) => this.updateSearch({ field: t }),
|
|
709
|
-
vocab:
|
|
701
|
+
vocab: et || [],
|
|
710
702
|
label: "Name field"
|
|
711
703
|
}
|
|
712
704
|
),
|
|
713
705
|
/* @__PURE__ */ s.jsx(
|
|
714
706
|
p,
|
|
715
707
|
{
|
|
716
|
-
defaultValue: u(
|
|
708
|
+
defaultValue: u(l, "authorship"),
|
|
717
709
|
onChange: (t) => this.updateSearch({ authorship: t }),
|
|
718
|
-
vocab:
|
|
710
|
+
vocab: at,
|
|
719
711
|
label: "Authorship"
|
|
720
712
|
}
|
|
721
713
|
),
|
|
722
714
|
/* @__PURE__ */ s.jsx(
|
|
723
715
|
p,
|
|
724
716
|
{
|
|
725
|
-
defaultValue: u(
|
|
717
|
+
defaultValue: u(l, "group"),
|
|
726
718
|
onChange: (t) => this.updateSearch({ group: t }),
|
|
727
|
-
vocab:
|
|
719
|
+
vocab: it,
|
|
728
720
|
label: "Taxonomic group"
|
|
729
721
|
}
|
|
730
722
|
),
|
|
731
723
|
/* @__PURE__ */ s.jsx(
|
|
732
724
|
p,
|
|
733
725
|
{
|
|
734
|
-
defaultValue: u(
|
|
726
|
+
defaultValue: u(l, "authorshipYear"),
|
|
735
727
|
onChange: (t) => this.updateSearch({ authorshipYear: t }),
|
|
736
|
-
vocab:
|
|
728
|
+
vocab: ot,
|
|
737
729
|
label: "Authorship year"
|
|
738
730
|
}
|
|
739
731
|
)
|
|
@@ -746,24 +738,24 @@ class zt extends f.Component {
|
|
|
746
738
|
children: [
|
|
747
739
|
"Advanced",
|
|
748
740
|
" ",
|
|
749
|
-
this.state.advancedFilters ? /* @__PURE__ */ s.jsx(
|
|
741
|
+
this.state.advancedFilters ? /* @__PURE__ */ s.jsx(Y, {}) : /* @__PURE__ */ s.jsx(U, {})
|
|
750
742
|
]
|
|
751
743
|
}
|
|
752
744
|
) })
|
|
753
745
|
] })
|
|
754
746
|
] }),
|
|
755
747
|
/* @__PURE__ */ s.jsxs(x, { children: [
|
|
756
|
-
/* @__PURE__ */ s.jsx(g, { span: 12, style: { textAlign: "left", marginBottom: "8px" }, children: /* @__PURE__ */ s.jsx(
|
|
748
|
+
/* @__PURE__ */ s.jsx(g, { span: 12, style: { textAlign: "left", marginBottom: "8px" }, children: /* @__PURE__ */ s.jsx(I, { type: "primary", danger: !0, onClick: this.resetSearch, children: "Reset all" }) }),
|
|
757
749
|
/* @__PURE__ */ s.jsx(g, { span: 12, style: { textAlign: "right", marginBottom: "8px" }, children: h && !isNaN(h.total) && `results: ${h.total.toLocaleString("en-GB")}` })
|
|
758
750
|
] }),
|
|
759
751
|
!o && /* @__PURE__ */ s.jsx(
|
|
760
|
-
|
|
752
|
+
bt,
|
|
761
753
|
{
|
|
762
754
|
size: "small",
|
|
763
755
|
columns: this.state.columns,
|
|
764
756
|
scroll: { x: "max-content" },
|
|
765
757
|
dataSource: e,
|
|
766
|
-
loading:
|
|
758
|
+
loading: n,
|
|
767
759
|
pagination: this.state.pagination,
|
|
768
760
|
onChange: this.handleTableChange,
|
|
769
761
|
rowKey: (t) => t.usage.id,
|
|
@@ -777,34 +769,34 @@ class zt extends f.Component {
|
|
|
777
769
|
)
|
|
778
770
|
}
|
|
779
771
|
),
|
|
780
|
-
|
|
772
|
+
B === "bottom" && y && /* @__PURE__ */ s.jsx(F, { dataset: y })
|
|
781
773
|
]
|
|
782
774
|
}
|
|
783
775
|
);
|
|
784
776
|
}
|
|
785
777
|
}
|
|
786
|
-
function
|
|
778
|
+
function Yt({
|
|
787
779
|
datasetKey: r,
|
|
788
780
|
filters: i,
|
|
789
781
|
onFiltersChange: e,
|
|
790
782
|
defaultTaxonKey: a,
|
|
791
|
-
citation:
|
|
783
|
+
citation: n,
|
|
792
784
|
auth: o,
|
|
793
|
-
...
|
|
785
|
+
...l
|
|
794
786
|
}) {
|
|
795
|
-
return
|
|
796
|
-
|
|
787
|
+
return pt(o), /* @__PURE__ */ s.jsx(mt.Provider, { value: gt(l), children: /* @__PURE__ */ s.jsx(
|
|
788
|
+
Ut,
|
|
797
789
|
{
|
|
798
790
|
datasetKey: r,
|
|
799
791
|
filters: i,
|
|
800
792
|
onFiltersChange: e,
|
|
801
793
|
defaultTaxonKey: a,
|
|
802
|
-
citation:
|
|
794
|
+
citation: n
|
|
803
795
|
}
|
|
804
796
|
) });
|
|
805
797
|
}
|
|
806
|
-
const
|
|
798
|
+
const he = dt(ht(Yt));
|
|
807
799
|
export {
|
|
808
|
-
|
|
800
|
+
he as Search
|
|
809
801
|
};
|
|
810
802
|
//# sourceMappingURL=search.js.map
|