col-browser 2.3.0 → 2.3.2

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.
@@ -1,134 +0,0 @@
1
- import { j as n } from "./jsx-runtime-BzflLqGi.js";
2
- import { useState as l, useEffect as b, useRef as v } from "react";
3
- import { Popover as F, Tag as u } from "antd";
4
- import { c as j, L as V } from "./router-CssZk5qZ.js";
5
- import { c as $ } from "./config-BPRXv9x8.js";
6
- const w = {
7
- 14: "The data was created by the homotypic grouping algorithm"
8
- }, B = ({
9
- style: k = {},
10
- datasetKey: S,
11
- sourceDatasetKey: i,
12
- sourceId: s,
13
- popoverPlacement: E,
14
- verbatimSourceKey: r,
15
- sectorKey: W,
16
- createdBy: c
17
- }) => {
18
- const [o, d] = l(null), [R, g] = l(!1), [h, p] = l(null), [T, x] = l(null), [t, f] = l(null), [y, m] = l(!1), [a, A] = l(!1);
19
- b(() => {
20
- a && i && s && C(), a && i && H(), a && r && !w[c] && M();
21
- }, [i, s, r, a]);
22
- const C = () => {
23
- x(!0), p(null), j(`${$.dataApi}dataset/${i}/taxon/${s}`).then((e) => {
24
- x(!1), p(e.data);
25
- }).catch((e) => {
26
- console.error("Error fetching source taxon:", e), x(!1), p(null);
27
- });
28
- }, H = () => {
29
- g(!0), d(null), j(`${$.dataApi}dataset/${i}`).then((e) => {
30
- g(!1), d(e.data);
31
- }).catch((e) => {
32
- console.error("Error fetching source dataset:", e), g(!1), d(null);
33
- });
34
- }, M = () => {
35
- m(!0), f(null), j(`${$.dataApi}dataset/${S}/verbatimsource/${r}`).then((e) => {
36
- m(!1), f(e.data);
37
- }).catch((e) => {
38
- console.error("Error fetching verbatim record:", e), m(!1), f(null);
39
- });
40
- }, L = v(Math.random().toString(36).substring(2, 15));
41
- return i || r ? /* @__PURE__ */ n.jsx("div", { style: { display: "inline" }, id: L.current, children: /* @__PURE__ */ n.jsx(
42
- F,
43
- {
44
- getPopupContainer: () => document.getElementById(L.current),
45
- content: /* @__PURE__ */ n.jsxs("div", { style: { minWidth: "300px" }, children: [
46
- !r && !s && i && /* @__PURE__ */ n.jsxs("div", { children: [
47
- /* @__PURE__ */ n.jsx("strong", { children: "Source:" }),
48
- " ",
49
- R ? "Loading..." : /* @__PURE__ */ n.jsx(V, { to: "source", args: o == null ? void 0 : o.key, children: o == null ? void 0 : o.title })
50
- ] }),
51
- i && s && /* @__PURE__ */ n.jsxs("div", { children: [
52
- /* @__PURE__ */ n.jsx("strong", { children: "Source:" }),
53
- " ",
54
- T ? "Loading..." : /* @__PURE__ */ n.jsx(
55
- "a",
56
- {
57
- href: `https://www.checklistbank.org/dataset/${i}/taxon/${s}`,
58
- dangerouslySetInnerHTML: { __html: h == null ? void 0 : h.labelHtml },
59
- onClick: () => {
60
- window.location.href = `https://www.checklistbank.org/dataset/${i}/taxon/${s}`;
61
- }
62
- }
63
- )
64
- ] }),
65
- !s && r && /* @__PURE__ */ n.jsxs("div", { children: [
66
- /* @__PURE__ */ n.jsx("strong", { children: "Source:" }),
67
- " ",
68
- !!w[c] && /* @__PURE__ */ n.jsx("span", { children: w[c] }),
69
- y ? "Loading..." : t ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
70
- " ",
71
- /* @__PURE__ */ n.jsx(
72
- "a",
73
- {
74
- href: `https://www.checklistbank.org/dataset/${t.sourceDatasetKey}/${(t.sourceEntity || "").replace(/\s/g, "")}/${encodeURIComponent(t.sourceId)}`,
75
- dangerouslySetInnerHTML: { __html: (o == null ? void 0 : o.title) || (t == null ? void 0 : t.sourceEntity) },
76
- onClick: () => {
77
- window.location.href = `https://www.checklistbank.org/dataset/${t.sourceDatasetKey}/${(t.sourceEntity || "").replace(/\s/g, "")}/${encodeURIComponent(t.sourceId)}`;
78
- }
79
- }
80
- ),
81
- t != null && t.issues && (t == null ? void 0 : t.issues.length) > 0 ? /* @__PURE__ */ n.jsxs("div", { children: [
82
- /* @__PURE__ */ n.jsx("span", { children: "Issues: " }),
83
- t.issues.map((e, _) => /* @__PURE__ */ n.jsx(u, { style: { margin: "2px" }, children: e }, _))
84
- ] }) : ""
85
- ] }) : ""
86
- ] })
87
- ] }),
88
- trigger: "click",
89
- placement: E || "right",
90
- onOpenChange: A,
91
- children: /* @__PURE__ */ n.jsx(
92
- u,
93
- {
94
- color: "purple",
95
- style: {
96
- cursor: "pointer",
97
- fontFamily: "monospace",
98
- fontSize: "8px",
99
- fontWeight: 900,
100
- padding: "2px",
101
- lineHeight: "8px",
102
- verticalAlign: "middle",
103
- marginRight: "2px",
104
- ...k
105
- },
106
- children: "XR"
107
- }
108
- )
109
- }
110
- ) }) : /* @__PURE__ */ n.jsxs("div", { style: { display: "inline" }, children: [
111
- " ",
112
- /* @__PURE__ */ n.jsx(
113
- u,
114
- {
115
- color: "purple",
116
- style: {
117
- fontFamily: "monospace",
118
- fontSize: "8px",
119
- fontWeight: 900,
120
- padding: "2px",
121
- lineHeight: "8px",
122
- verticalAlign: "middle",
123
- marginRight: "2px",
124
- ...k
125
- },
126
- children: "XR"
127
- }
128
- )
129
- ] });
130
- };
131
- export {
132
- B as M
133
- };
134
- //# sourceMappingURL=MergedDataBadge-DsTsn5Xu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MergedDataBadge-DsTsn5Xu.js","sources":["../../src/components/MergedDataBadge.js"],"sourcesContent":["import React, { useEffect, useState, useRef } from \"react\";\nimport { Tag, Popover } from \"antd\";\nimport client from \"../api/client\";\nimport config from \"../config\";\nimport { LinkTo } from \"../router\";\n\nconst createdByAlgorithm = {\n 14: \"The data was created by the homotypic grouping algorithm\"\n}\n\nconst MergedDataBadge = ({\n style = {},\n datasetKey,\n sourceDatasetKey,\n sourceId,\n popoverPlacement,\n verbatimSourceKey,\n sectorKey,\n createdBy\n}) => {\n const [sourceDataset, setSourceDataset] = useState(null);\n const [sourceDatasetLoading, setSourceDatasetLoading] = useState(false);\n const [sourceTaxon, setSourceTaxon] = useState(null);\n const [sourceTaxonLoading, setSourceTaxonLoading] = useState(null);\n const [verbatimRecord, setVerbatimRecord] = useState(null);\n const [verbatimRecordLoading, setVerbatimRecordLoading] = useState(false);\n const [open, setOpen] = useState(false);\n useEffect(() => {\n if (open && sourceDatasetKey && sourceId) {\n getSourceTaxon()\n }\n if (open && sourceDatasetKey) {\n getSourceDataset()\n }\n if (open && verbatimSourceKey && !createdByAlgorithm[createdBy]) {\n getVerbatimRecord();\n }\n }, [sourceDatasetKey, sourceId, verbatimSourceKey, open]);\n\n \n\n const getSourceTaxon = () => {\n setSourceTaxonLoading(true);\n setSourceTaxon(null);\n client(`${config.dataApi}dataset/${sourceDatasetKey}/taxon/${sourceId}`)\n .then((res) => {\n setSourceTaxonLoading(false);\n setSourceTaxon(res.data);\n })\n .catch((err) => {\n console.error(\"Error fetching source taxon:\", err);\n setSourceTaxonLoading(false);\n setSourceTaxon(null);\n });\n };\n\n const getSourceDataset = () => {\n setSourceDatasetLoading(true);\n setSourceDataset(null);\n client(`${config.dataApi}dataset/${sourceDatasetKey}`)\n .then((res) => {\n setSourceDatasetLoading(false);\n setSourceDataset(res.data);\n })\n .catch((err) => {\n console.error(\"Error fetching source dataset:\", err);\n setSourceDatasetLoading(false);\n setSourceDataset(null);\n });\n };\n\n const getVerbatimRecord = () => {\n setVerbatimRecordLoading(true);\n setVerbatimRecord(null);\n client(`${config.dataApi}dataset/${datasetKey}/verbatimsource/${verbatimSourceKey}`)\n .then((res) => {\n setVerbatimRecordLoading(false);\n setVerbatimRecord(res.data);\n })\n .catch((err) => {\n console.error(\"Error fetching verbatim record:\", err);\n setVerbatimRecordLoading(false);\n setVerbatimRecord(null);\n });\n };\n\n const idRef = useRef(Math.random().toString(36).substring(2, 15));\n\n return (!!sourceDatasetKey || !!verbatimSourceKey ) ? (\n <div style={{ display: \"inline\" }} id={idRef.current}>\n <Popover\n getPopupContainer={() => document.getElementById(idRef.current)}\n content={\n <div style={{ minWidth: \"300px\" }}>\n {(!verbatimSourceKey && !sourceId) &&sourceDatasetKey && <div>\n <strong>Source:</strong>{\" \"}\n {sourceDatasetLoading\n ? \"Loading...\"\n : <LinkTo to=\"source\" args={sourceDataset?.key}>{sourceDataset?.title}</LinkTo>}\n </div>}\n {sourceDatasetKey && sourceId && <div>\n <strong>Source:</strong>{\" \"}\n {sourceTaxonLoading\n ? \"Loading...\"\n : <a\n href={`https://www.checklistbank.org/dataset/${sourceDatasetKey}/taxon/${sourceId}`}\n dangerouslySetInnerHTML={ { __html: sourceTaxon?.labelHtml } }\n onClick={() => {\n window.location.href = `https://www.checklistbank.org/dataset/${sourceDatasetKey}/taxon/${sourceId}`;\n }}\n ></a> }\n </div>}\n {(!sourceId) && verbatimSourceKey && <div>\n <strong>Source:</strong>{\" \"}\n {!!createdByAlgorithm[createdBy] && <span>{createdByAlgorithm[createdBy]}</span>}\n {verbatimRecordLoading\n ? \"Loading...\"\n : !!verbatimRecord ? <> {<a\n href={`https://www.checklistbank.org/dataset/${verbatimRecord.sourceDatasetKey}/${(verbatimRecord.sourceEntity || \"\").replace(/\\s/g, \"\")}/${encodeURIComponent(verbatimRecord.sourceId)}`}\n dangerouslySetInnerHTML={ { __html: sourceDataset?.title ||verbatimRecord?.sourceEntity } }\n onClick={() => {\n window.location.href = `https://www.checklistbank.org/dataset/${verbatimRecord.sourceDatasetKey}/${(verbatimRecord.sourceEntity || \"\").replace(/\\s/g, \"\")}/${encodeURIComponent(verbatimRecord.sourceId)}`;\n }}\n ></a> }\n {verbatimRecord?.issues && verbatimRecord?.issues.length > 0 ? <div>\n <span>Issues: </span>\n {verbatimRecord.issues.map((issue, index) => (\n <Tag key={index} style={{ margin: \"2px\" }}>\n {issue}\n </Tag>\n ))}\n </div>: \"\"}\n </>:\"\" }\n </div>}\n </div>\n }\n trigger={\"click\"}\n placement={popoverPlacement || \"right\"}\n onOpenChange={setOpen}\n >\n <Tag\n color=\"purple\"\n /* onClick={(e) => {\n getSourceDataset();\n getSourceTaxon();\n if(!createdByAlgorithm[createdBy]){ getVerbatimRecord(); }\n }} */\n style={{\n cursor: \"pointer\",\n fontFamily: \"monospace\",\n fontSize: \"8px\",\n fontWeight: 900,\n padding: \"2px\",\n lineHeight: \"8px\",\n verticalAlign: \"middle\",\n marginRight: \"2px\",\n ...style,\n }}\n >\n XR\n </Tag>\n </Popover>\n </div>\n ) : (\n <div style={{ display: \"inline\" }}> <Tag\n color=\"purple\"\n style={{\n fontFamily: \"monospace\",\n fontSize: \"8px\",\n fontWeight: 900,\n padding: \"2px\",\n lineHeight: \"8px\",\n verticalAlign: \"middle\",\n marginRight: \"2px\",\n ...style,\n }}\n >\n XR\n </Tag></div>\n );\n};\n\nexport default MergedDataBadge;\n"],"names":["createdByAlgorithm","MergedDataBadge","style","datasetKey","sourceDatasetKey","sourceId","popoverPlacement","verbatimSourceKey","sectorKey","createdBy","sourceDataset","setSourceDataset","useState","sourceDatasetLoading","setSourceDatasetLoading","sourceTaxon","setSourceTaxon","sourceTaxonLoading","setSourceTaxonLoading","verbatimRecord","setVerbatimRecord","verbatimRecordLoading","setVerbatimRecordLoading","open","setOpen","useEffect","getSourceTaxon","getSourceDataset","getVerbatimRecord","client","config","res","err","idRef","useRef","jsx","Popover","jsxs","LinkTo","Fragment","issue","index","Tag"],"mappings":";;;;;AAMA,MAAMA,IAAqB;AAAA,EACzB,IAAI;AACN,GAEMC,IAAkB,CAAC;AAAA,EACvB,OAAAC,IAAQ,CAAA;AAAA,EACR,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,IAAI,GACjD,CAACC,GAAsBC,CAAuB,IAAIF,EAAS,EAAK,GAChE,CAACG,GAAaC,CAAc,IAAIJ,EAAS,IAAI,GAC7C,CAACK,GAAoBC,CAAqB,IAAIN,EAAS,IAAI,GAC3D,CAACO,GAAgBC,CAAiB,IAAIR,EAAS,IAAI,GACn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