synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
195 lines (194 loc) • 6.49 kB
JavaScript
import { jsx as e, jsxs as a, Fragment as d } from "react/jsx-runtime";
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 { parseEntityIdFromSqlStatement as k, getAdditionalFilters as W } from "../../utils/functions/SqlFunctions.js";
import "../../utils/functions/EntityTypeUtils.js";
import { BUNDLE_MASK_QUERY_RESULTS as Y } from "../../utils/SynapseConstants.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "@tanstack/react-query";
import "../../utils/PermissionLevelToAccessType.js";
import { useState as G, useMemo as K } from "react";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { ColumnMultiValueFunction as y } from "@sage-bionetworks/synapse-types";
import { Typography as E, Skeleton as u } from "@mui/material";
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 "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "react-router";
import "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
import { useGetFullTableQueryResults as X } from "../../synapse-queries/entity/useGetQueryResultBundle.js";
import { getHeaderIndex as r } from "../../utils/functions/queryUtils.js";
import { Box as i } from "@mui/system";
import { useMeasure as $ } from "@react-hookz/web";
import { getColorPalette as _ } from "../ColorGradient/ColorGradient.js";
import z, { phaseSpeciesIndex as J, phaseObservationIndex as h } from "./phasesQueryResponseData.js";
import Z from "./TimelineLegendItem.js";
import ee from "./TimelinePhase.js";
import { TimelinePlotSpeciesSelector as te } from "./TimelinePlotSpeciesSelector.js";
const oe = "observationphase", re = "observationtime", ie = "observationtimeunits", ne = "observationsubmittername", se = "observationtext", ae = "observationtype", me = "synapseid", le = "doi", ze = ({
sql: l,
searchParams: S,
sqlOperator: M,
defaultSpecies: T,
title: x,
subTitle: v
}) => {
const O = k(l), [t, g] = G(
T
), [p, A] = $(), I = W(S, M) ?? [], f = t ? {
columnName: "species",
concreteType: "org.sagebionetworks.repo.model.table.ColumnMultiValueFunctionQueryFilter",
values: [t],
function: y.HAS,
_function: y.HAS
} : void 0, b = [...I];
f && b.push(f);
const R = X(
{
entityId: O,
query: {
sql: `${l} WHERE observationTime IS NOT NULL`,
sort: [
{
column: "observationTime",
direction: "ASC"
}
],
additionalFilters: b
},
partMask: Y,
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest"
},
{
enabled: !!t
}
), { data: o, isLoading: C } = R, n = K(() => {
if (t)
return z.queryResult?.queryResults.rows.filter(
(m) => m.values[J] == t
);
}, [t]);
if (C)
return /* @__PURE__ */ e(pe, {});
const U = r(
oe,
o
), L = r(
re,
o
), w = r(
ie,
o
), B = r(
ne,
o
), F = r(
se,
o
), P = r(
le,
o
), V = r(
ae,
o
), D = r(
me,
o
), j = {
observationSubmitterName: B,
synapseId: D,
observationType: V,
observationText: F,
observationTime: L,
observationTimeUnits: w,
doi: P
}, q = p?.width && n ? p?.width / n.length : 0, Q = n?.map(() => "auto").join(" ");
return /* @__PURE__ */ a(d, { children: [
t && /* @__PURE__ */ a(d, { children: [
x && /* @__PURE__ */ e(E, { variant: "h2", children: x }),
v && /* @__PURE__ */ e(E, { variant: "body1Italic", sx: { margin: "10px 0px" }, children: v })
] }),
/* @__PURE__ */ a(i, { children: [
/* @__PURE__ */ a(i, { sx: { display: "flex", justifyContent: "space-between" }, children: [
/* @__PURE__ */ e(i, { children: !T && /* @__PURE__ */ e(
te,
{
setSpecies: g,
species: t,
sql: l,
additionalFilters: I
}
) }),
n && /* @__PURE__ */ e(
i,
{
sx: { display: "flex", justifyContent: "flex-end", gap: "25px" },
children: n.map((s, m) => {
const { colorPalette: c } = _(m, 1);
return /* @__PURE__ */ e(
Z,
{
color: c[0],
phaseName: s.values[h]
},
s.rowId
);
})
}
)
] }),
t && n && /* @__PURE__ */ e("div", { ref: A, children: /* @__PURE__ */ e(
i,
{
sx: {
display: "inline-grid",
gridTemplateColumns: Q,
minWidth: p?.width,
maxWidth: p?.width
},
className: "forcePlotlyDefaultCursor",
children: n.map((s, m) => {
const { colorPalette: c } = _(m, 1), N = o?.queryResult?.queryResults.rows.filter((H) => H.values[U] == s.values[h]);
return N ? /* @__PURE__ */ e(
ee,
{
name: s.values[h],
color: c[0],
rowData: N,
schema: j,
widthPx: q,
sql: l
},
s.rowId
) : /* @__PURE__ */ e(d, {});
})
}
) })
] })
] });
}, pe = () => /* @__PURE__ */ a(i, { children: [
/* @__PURE__ */ a(i, { sx: { display: "flex", justifyContent: "flex-end", gap: "10px" }, children: [
/* @__PURE__ */ e(u, { height: "45px", width: "80px" }),
/* @__PURE__ */ e(u, { height: "45px", width: "80px" })
] }),
/* @__PURE__ */ e(i, { sx: { display: "flex" }, children: /* @__PURE__ */ e(u, { height: "150px", width: "100%" }) })
] });
export {
pe as LoadingTimelinePlot,
ze as TimelinePlot,
ze as default
};
//# sourceMappingURL=TimelinePlot.js.map