synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
151 lines (150 loc) • 5.28 kB
JavaScript
import { jsxs as E, jsx as t, Fragment as f } from "react/jsx-runtime";
import { TableRowGenericCard as v } from "../GenericCard/TableRowGenericCard.js";
import w from "../../utils/hooks/useGetInfoFromIds.js";
import { OBSERVATION_CARD as u, MEDIUM_USER_CARD as y, RELEASE_CARD as R, GENERIC_CARD as N, FUNDER as U, DATASET as _ } from "../../utils/SynapseConstants.js";
import { Box as F } from "@mui/material";
import { ColumnTypeEnum as G } from "@sage-bionetworks/synapse-types";
import { Suspense as z } from "react";
import O from "../LoadingScreen/LoadingScreen.js";
import { useQueryContext as Q } from "../QueryContext/QueryContext.js";
import "../../utils/PermissionLevelToAccessType.js";
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 "@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 "react-router";
import "use-deep-compare-effect";
import { useSuspenseGetQueryMetadata as q } from "../QueryWrapper/useGetQueryMetadata.js";
import { useQueryVisualizationContext as x } from "../QueryVisualizationWrapper/QueryVisualizationContext.js";
import { ReleaseCard as B } from "../ReleaseCard/ReleaseCard.js";
import P from "../row_renderers/Dataset.js";
import V from "../row_renderers/Funder.js";
import { LoadingObservationCard as j, ObservationCard as k } from "../row_renderers/ObservationCard.js";
import H from "../TotalQueryResults.js";
import { UserCardList as W } from "../UserCardList/UserCardList.js";
const Y = { display: "block" }, J = {
display: "grid",
gridTemplateColumns: "repeat(auto-fill, 272px)",
gridAutoRows: "auto",
gridAutoFlow: "row",
gap: "10px",
mb: "30px"
}, K = {
display: "grid",
gridTemplateColumns: "repeat(auto-fit, minmax(300px, 1fr))",
gridColumnGap: "20px",
marginBottom: "20px",
marginTop: "20px",
"& .SRC-portalCard": {
margin: "10px 0px"
}
};
function X(r) {
const { propsToPass: e, type: n } = r;
switch (n) {
case _:
return /* @__PURE__ */ t(P, { ...e });
case U:
return /* @__PURE__ */ t(V, { ...e });
case N:
return /* @__PURE__ */ t(v, { ...e });
case u:
return /* @__PURE__ */ t(k, { ...e });
case R:
return /* @__PURE__ */ t(B, { ...e });
default:
return /* @__PURE__ */ t("div", {});
}
}
function Z(r) {
const {
unitDescription: e,
type: n,
secondaryLabelLimit: I = 3,
title: p,
rowSet: i,
multiCardList: g,
...S
} = r, { NoContentPlaceholder: T } = x(), h = Q(), { data: b } = q(), A = x(), s = i.rows, D = s.length > 1, L = [i.tableId], c = w({
ids: L,
type: "ENTITY_HEADER"
});
if (s.length === 0)
return /* @__PURE__ */ t(T, {});
const C = {};
i.headers.forEach((o, a) => {
C[o.name] = a;
});
let d;
if (n === y) {
const o = i.headers.findIndex(
(m) => m.columnType === G.USERID
);
if (o === -1)
throw Error(
"Type MEDIUM_USER_CARD specified but no columnType USERID found"
);
const a = s.map((m) => m.values[o]);
d = /* @__PURE__ */ t(W, { rowSet: i, list: a, size: y });
} else
d = s.length ? s.map((o, a) => {
const m = {
type: n,
schema: C,
secondaryLabelLimit: I,
rowId: o.rowId,
versionNumber: o.versionNumber,
data: o.values,
selectColumns: i.headers,
columnModels: b.columnModels,
tableEntityConcreteType: c[0] && c[0].type,
tableId: i.tableId,
queryContext: h,
queryVisualizationContext: A,
...S
};
return /* @__PURE__ */ t(
X,
{
propsToPass: m,
type: n
},
o.rowId ?? a
);
}) : /* @__PURE__ */ t(f, {});
const M = r.type === R && r.releaseCardConfig?.cardSize === "medium";
let l = Y;
return M ? l = J : g && D && (l = K), /* @__PURE__ */ t(f, { children: /* @__PURE__ */ E(F, { role: "list", sx: l, children: [
p && /* @__PURE__ */ t("h2", { className: "SRC-card-overview-title", children: p }),
!p && e && /* @__PURE__ */ t(H, { frontText: "Displaying" }),
d
] }) });
}
function qt(r) {
const e = /* @__PURE__ */ E("div", { children: [
r.type === u && /* @__PURE__ */ t(j, {}),
r.type !== u && O
] });
return /* @__PURE__ */ t(z, { fallback: e, children: /* @__PURE__ */ t(Z, { ...r }) });
}
export {
qt as CardContainer
};
//# sourceMappingURL=CardContainer.js.map