synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
138 lines (137 loc) • 5.17 kB
JavaScript
import { jsx as t, Fragment as l, jsxs as r } from "react/jsx-runtime";
import { Box as o, Typography as e, Link as y } from "@mui/material";
import { truncate as u, MAX_LEGEND_LENGTH as b } from "./FacetPlotLegendUtils.js";
import "@sage-bionetworks/synapse-types";
import "../../../utils/PermissionLevelToAccessType.js";
import "../../../utils/SynapseConstants.js";
import "react";
import "../../../synapse-client/SynapseClient.js";
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
import "../../../utils/functions/EntityTypeUtils.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "../../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "@sage-bionetworks/synapse-client";
import "../../../utils/types/IsType.js";
import "../../../utils/hooks/useCookiePreferences.js";
import "../../../utils/hooks/useSourceAppConfigs.js";
import "universal-cookie";
import "../../../utils/AppUtils/session/ApplicationSessionContext.js";
import "../../../utils/context/FullContextProvider.js";
import "../../../utils/context/DocumentMetadataContext.js";
import '../../../style/components/_spinner.css';/* empty css */
import "react-router";
import "../../QueryContext/QueryContext.js";
import { useQueryVisualizationContext as f } from "../../QueryVisualizationWrapper/QueryVisualizationContext.js";
function Z(c) {
const { facetName: p, labels: i, colors: s = [], isExpanded: m, linkToFullQuery: d } = c, { unitDescription: x } = f();
if (!i)
return /* @__PURE__ */ t(l, {});
const a = m ? Math.min(i.length, 9) : Math.min(i.length, 4);
return a === 0 ? /* @__PURE__ */ t(l, {}) : /* @__PURE__ */ r(l, { children: [
/* @__PURE__ */ r(
o,
{
component: "table",
className: `FacetNavPanel__body__legend${m ? "--expanded" : ""}`,
sx: { width: "100%", color: "grey.800", "td,th": { py: 0.5 } },
children: [
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r(
o,
{
component: "tr",
sx: { borderBottom: "1px solid", borderBottomColor: "grey.300" },
children: [
/* @__PURE__ */ t("th", { children: /* @__PURE__ */ t(
e,
{
variant: "body1",
sx: {
fontWeight: 700,
size: "14px"
},
children: p
}
) }),
/* @__PURE__ */ t("th", { style: { textAlign: "right", marginRight: "16px" }, children: /* @__PURE__ */ t(
e,
{
variant: "body1",
sx: {
size: "14px",
fontWeight: 700,
textAlign: "right"
},
children: x
}
) })
]
}
) }),
/* @__PURE__ */ t("tbody", { children: i.slice(0, a).map((n, h) => {
const g = u(n.label, b);
return /* @__PURE__ */ r("tr", { children: [
/* @__PURE__ */ t("td", { children: /* @__PURE__ */ r(
o,
{
sx: {
display: "flex",
alignItems: "center",
gap: 1
},
children: [
/* @__PURE__ */ t(
o,
{
sx: {
width: "14px",
height: "14px",
cursor: "default",
backgroundColor: s[h]
},
style: { cursor: "default" }
},
`legendLabel_${h}`
),
/* @__PURE__ */ t(e, { variant: "body1", sx: { fontSize: "14px" }, children: g })
]
}
) }),
/* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(
e,
{
variant: "body1",
sx: {
fontSize: "14px",
color: "grey.600",
textAlign: "right"
},
children: n.count
}
) })
] }, n.label);
}) })
]
}
),
d && /* @__PURE__ */ t(o, { sx: { my: 2 }, children: /* @__PURE__ */ r(y, { href: d, children: [
"View ",
i.length,
" ",
p,
" options"
] }) })
] });
}
export {
Z as FacetPlotLegendTable
};
//# sourceMappingURL=FacetPlotLegendTable.js.map