col-browser 2.3.1 → 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.
- package/es/chunks/{Distributions-BWucAjsL.js → Distributions-BzwnK_GR.js} +2 -2
- package/es/chunks/{Distributions-BWucAjsL.js.map → Distributions-BzwnK_GR.js.map} +1 -1
- package/es/chunks/MergedDataBadge-CdQ7RzDt.js +82 -0
- package/es/chunks/MergedDataBadge-CdQ7RzDt.js.map +1 -0
- package/es/chunks/XrGutter-CG0gAVhH.js +23 -0
- package/es/chunks/XrGutter-CG0gAVhH.js.map +1 -0
- package/es/search.js +153 -154
- package/es/search.js.map +1 -1
- package/es/sourceDatasetList.js +17 -21
- package/es/sourceDatasetList.js.map +1 -1
- package/es/taxon.js +342 -347
- package/es/taxon.js.map +1 -1
- package/es/taxonDistribution.js +1 -1
- package/es/tree.js +1 -1
- package/package.json +1 -1
- package/umd/col-browser.js +171 -223
- package/umd/col-browser.js.map +1 -1
- package/umd/col-browser.min.js +4 -4
- package/umd/col-browser.min.js.map +1 -1
- package/es/chunks/MergedDataBadge-DsTsn5Xu.js +0 -134
- package/es/chunks/MergedDataBadge-DsTsn5Xu.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MergedDataBadge-CdQ7RzDt.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 [verbatimRecord, setVerbatimRecord] = useState(null);\n const [verbatimRecordLoading, setVerbatimRecordLoading] = useState(false);\n const [open, setOpen] = useState(false);\n\n // A merged record's provenance can arrive two ways: explicit props, or — for\n // merged usages, whose own sourceDatasetKey is null — only on the verbatim\n // source record. Resolve both so the popover can always name the source\n // dataset and link the source id when one exists.\n const effectiveSourceDatasetKey =\n sourceDatasetKey || verbatimRecord?.sourceDatasetKey;\n const effectiveSourceId = sourceId || verbatimRecord?.sourceId;\n\n // Fetch the verbatim record (carries sourceDatasetKey / sourceId / entity).\n useEffect(() => {\n if (open && verbatimSourceKey && !createdByAlgorithm[createdBy]) {\n getVerbatimRecord();\n }\n }, [verbatimSourceKey, open]);\n\n // Fetch the source dataset once its key is known — from the prop, or from the\n // verbatim record once that has loaded.\n useEffect(() => {\n if (open && effectiveSourceDatasetKey) {\n getSourceDataset(effectiveSourceDatasetKey);\n }\n }, [open, effectiveSourceDatasetKey]);\n\n const getSourceDataset = (key) => {\n setSourceDatasetLoading(true);\n client(`${config.dataApi}dataset/${key}`)\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(\n `${config.dataApi}dataset/${datasetKey}/verbatimsource/${verbatimSourceKey}`\n )\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 // ChecklistBank link to the source record. References live under /reference;\n // everything else (the common name-usage case) under /taxon.\n const clbEntity = (verbatimRecord?.sourceEntity || \"\")\n .toLowerCase()\n .replace(/\\s+/g, \"\");\n const clbPath = clbEntity === \"reference\" ? \"reference\" : \"taxon\";\n const sourceRecordHref =\n effectiveSourceId && effectiveSourceDatasetKey\n ? `https://www.checklistbank.org/dataset/${effectiveSourceDatasetKey}/${clbPath}/${encodeURIComponent(\n effectiveSourceId\n )}`\n : null;\n\n const loadingSource =\n sourceDatasetLoading || (!!verbatimSourceKey && verbatimRecordLoading);\n\n const content = (\n <div style={{ minWidth: \"300px\" }}>\n {!!createdByAlgorithm[createdBy] && (\n <div>{createdByAlgorithm[createdBy]}</div>\n )}\n <div>\n <strong>Source:</strong>{\" \"}\n {sourceDataset ? (\n <LinkTo to=\"source\" args={sourceDataset.key}>\n {sourceDataset.title}\n </LinkTo>\n ) : loadingSource ? (\n \"Loading...\"\n ) : (\n \"—\"\n )}\n </div>\n {sourceRecordHref && (\n <div>\n <strong>ID:</strong>{\" \"}\n <a href={sourceRecordHref} target=\"_blank\" rel=\"noreferrer\">\n {effectiveSourceId}\n </a>\n </div>\n )}\n {verbatimRecord?.issues && verbatimRecord.issues.length > 0 && (\n <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 );\n\n const tagStyle = {\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 return !!sourceDatasetKey || !!verbatimSourceKey ? (\n <div style={{ display: \"inline\" }} id={idRef.current}>\n <Popover\n getPopupContainer={() => document.getElementById(idRef.current)}\n content={content}\n trigger={\"click\"}\n placement={popoverPlacement || \"right\"}\n onOpenChange={setOpen}\n >\n <Tag color=\"purple\" style={tagStyle}>\n XR\n </Tag>\n </Popover>\n </div>\n ) : (\n <div style={{ display: \"inline\" }}>\n <Tag color=\"purple\" style={{ ...tagStyle, cursor: \"default\" }}>\n XR\n </Tag>\n </div>\n );\n};\n\nexport default MergedDataBadge;\n"],"names":["createdByAlgorithm","MergedDataBadge","style","datasetKey","sourceDatasetKey","sourceId","popoverPlacement","verbatimSourceKey","sectorKey","createdBy","sourceDataset","setSourceDataset","useState","sourceDatasetLoading","setSourceDatasetLoading","verbatimRecord","setVerbatimRecord","verbatimRecordLoading","setVerbatimRecordLoading","open","setOpen","effectiveSourceDatasetKey","effectiveSourceId","useEffect","getVerbatimRecord","getSourceDataset","key","client","config","res","err","idRef","useRef","clbPath","sourceRecordHref","loadingSource","content","jsxs","jsx","LinkTo","issue","index","Tag","tagStyle","Popover"],"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,GAAgBC,CAAiB,IAAIJ,EAAS,IAAI,GACnD,CAACK,GAAuBC,CAAwB,IAAIN,EAAS,EAAK,GAClE,CAACO,GAAMC,CAAO,IAAIR,EAAS,EAAK,GAMhCS,IACJjB,MAAoBW,KAAA,gBAAAA,EAAgB,mBAChCO,IAAoBjB,MAAYU,KAAA,gBAAAA,EAAgB;AAGtD,EAAAQ,EAAU,MAAM;AACd,IAAIJ,KAAQZ,KAAqB,CAACP,EAAmBS,CAAS,KAC5De,EAAA;AAAA,EAEJ,GAAG,CAACjB,GAAmBY,CAAI,CAAC,GAI5BI,EAAU,MAAM;AACd,IAAIJ,KAAQE,KACVI,EAAiBJ,CAAyB;AAAA,EAE9C,GAAG,CAACF,GAAME,CAAyB,CAAC;AAEpC,QAAMI,IAAmB,CAACC,MAAQ;AAChC,IAAAZ,EAAwB,EAAI,GAC5Ba,EAA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I,OAAM,UAAS,OAAOC,GAAU,UAAA,KAAA,CAErC;AAAA,IAAA;AAAA,EAAA,EACF,CACF,IAEAL,gBAAAA,EAAAA,IAAC,OAAA,EAAI,OAAO,EAAE,SAAS,YACrB,UAAAA,gBAAAA,EAAAA,IAACI,KAAI,OAAM,UAAS,OAAO,EAAE,GAAGC,GAAU,QAAQ,UAAA,GAAa,UAAA,KAAA,CAE/D,GACF;AAEJ;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { M as i } from "./MergedDataBadge-CdQ7RzDt.js";
|
|
4
|
+
const m = ({ merged: r, style: o, children: s, ...a }) => r ? /* @__PURE__ */ t.jsxs("span", { style: { position: "relative", display: "inline-block", ...o }, children: [
|
|
5
|
+
/* @__PURE__ */ t.jsx(
|
|
6
|
+
i,
|
|
7
|
+
{
|
|
8
|
+
...a,
|
|
9
|
+
style: {
|
|
10
|
+
position: "absolute",
|
|
11
|
+
right: "100%",
|
|
12
|
+
top: "50%",
|
|
13
|
+
transform: "translateY(-50%)",
|
|
14
|
+
marginRight: "4px"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
s
|
|
19
|
+
] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: s });
|
|
20
|
+
export {
|
|
21
|
+
m as X
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=XrGutter-CG0gAVhH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XrGutter-CG0gAVhH.js","sources":["../../src/components/XrGutter.js"],"sourcesContent":["import React from \"react\";\nimport MergedDataBadge from \"./MergedDataBadge\";\n\n// Renders the XR (merged-data) badge in the left gutter of a line or table\n// cell. The badge is absolutely positioned just left of the content, so it\n// takes no flow width — the content stays at the same position whether or not\n// the badge is shown. This keeps list/table rows aligned (mirroring how the\n// taxon title places its XR badge) instead of appending the badge after the\n// name or wedging it mid-line.\n//\n// When `merged` is falsy the children render unchanged (no wrapper). Any extra\n// props are forwarded to MergedDataBadge (datasetKey, verbatimSourceKey,\n// sourceDatasetKey, sourceId, createdBy, …).\nconst XrGutter = ({ merged, style, children, ...badgeProps }) =>\n merged ? (\n <span style={{ position: \"relative\", display: \"inline-block\", ...style }}>\n <MergedDataBadge\n {...badgeProps}\n style={{\n position: \"absolute\",\n right: \"100%\",\n top: \"50%\",\n transform: \"translateY(-50%)\",\n marginRight: \"4px\",\n }}\n />\n {children}\n </span>\n ) : (\n <>{children}</>\n );\n\nexport default XrGutter;\n"],"names":["XrGutter","merged","style","children","badgeProps","jsx","MergedDataBadge"],"mappings":";;;AAaA,MAAMA,IAAW,CAAC,EAAE,QAAAC,GAAQ,OAAAC,GAAO,UAAAC,GAAU,GAAGC,QAC9CH,2BACG,QAAA,EAAK,OAAO,EAAE,UAAU,YAAY,SAAS,gBAAgB,GAAGC,KAC/D,UAAA;AAAA,EAAAG,gBAAAA,EAAAA;AAAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,KAAK;AAAA,QACL,WAAW;AAAA,QACX,aAAa;AAAA,MAAA;AAAA,IACf;AAAA,EAAA;AAAA,EAEDD;AAAA,EAAA,CACH,wCAEG,UAAAA,EAAA,CAAS;"}
|