synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
165 lines (164 loc) • 5.4 kB
JavaScript
import { jsx as t, jsxs as v, Fragment as E } 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 "@sage-bionetworks/synapse-types";
import { isDataset as I } from "../../../utils/functions/EntityTypeUtils.js";
import "../../../utils/SynapseConstants.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "@tanstack/react-query";
import "../../../utils/PermissionLevelToAccessType.js";
import { useMemo as C, useState as n } from "react";
import { useSynapseContext as k } from "../../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Tooltip as M, MenuItem as a } 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 { useGetEntity as q } from "../../../synapse-queries/entity/useEntity.js";
import { canTableQueryBeAddedToDownloadList as N } from "../../../utils/functions/queryUtils.js";
import { ModalDownload as O } from "../../ModalDownload/ModalDownload.js";
import { ProgrammaticTableDownload as Q } from "../../ProgrammaticTableDownload/ProgrammaticTableDownload.js";
import { useQueryContext as F } from "../../QueryContext/QueryContext.js";
import { useSelectedRowsAtomValue as P, useHasSelectedRowsAtomValue as H } from "../../QueryWrapper/TableRowSelectionState.js";
import { useGetQueryMetadata as V } from "../../QueryWrapper/useGetQueryMetadata.js";
import { ElementWithTooltip as j } from "../../widgets/ElementWithTooltip.js";
import { getFileColumnModelId as B } from "../SynapseTableUtils.js";
import { getNumberOfResultsToAddToDownloadListCopy as G } from "../TopLevelControls/TopLevelControlsUtils.js";
import { DownloadLoginModal as z } from "./DownloadLoginModal.js";
function qo(b) {
const { isAuthenticated: s } = k(), {
entityId: D,
versionNumber: x,
getCurrentQueryRequest: l,
hasResettableFilters: m
} = F(), { data: e } = q(D, x), { data: r } = V(), d = P(), p = H(), u = C(
() => l(),
[l]
), [c, f] = n(!1), [T, w] = n(!1), [L, h] = n(!1), { onDownloadFiles: y, darkTheme: A = !0 } = b, R = B(r?.columnModels), g = N(
e,
R
), o = e && I(e) && e.isLatestVersion, S = C(() => {
const i = [];
return g && i.push(
/* @__PURE__ */ t(
M,
{
title: o ? "A draft version of a dataset cannot be added to the Download Cart" : null,
placement: "left",
enterNextDelay: 300,
describeChild: !0,
children: /* @__PURE__ */ t(
a,
{
className: o ? "ignoreLink" : void 0,
disabled: o,
style: o ? { pointerEvents: "auto" } : {},
onClick: () => s ? y() : f(!0),
children: G(
m,
p,
d,
r?.queryCount,
"file"
)
}
)
},
"add-to-download-list"
)
), i.push(
/* @__PURE__ */ t(
a,
{
onClick: () => {
w(!0);
},
children: "Export Table"
},
"export-table"
)
), i.push(
/* @__PURE__ */ t(
M,
{
title: o ? "A draft version of a dataset cannot be downloaded programmatically" : null,
placement: "left",
enterNextDelay: 300,
describeChild: !0,
children: /* @__PURE__ */ t(
a,
{
className: o ? "ignoreLink" : void 0,
disabled: o,
style: o ? { pointerEvents: "auto" } : {},
onClick: () => h(!0),
children: "Programmatic Options"
}
)
},
"programmatic-options"
)
), i;
}, [
s,
o,
m,
p,
y,
r?.queryCount,
d,
g
]);
return /* @__PURE__ */ v(E, { children: [
/* @__PURE__ */ t(
j,
{
tooltipText: "Download Options",
size: "lg",
darkTheme: A,
icon: "download",
menuItems: S
}
),
c && /* @__PURE__ */ t(
z,
{
showModal: c,
onHide: () => f(!1)
}
),
// modal can render anywhere, this is not a particular location
T && /* @__PURE__ */ t(
O,
{
onClose: () => w(!1),
queryBundleRequest: u
}
),
L && r && /* @__PURE__ */ t(
Q,
{
onHide: () => h(!1),
queryBundleRequest: u
}
)
] });
}
export {
qo as DownloadOptions
};
//# sourceMappingURL=DownloadOptions.js.map