synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
117 lines (116 loc) • 4.39 kB
JavaScript
import { jsx as t } from "react/jsx-runtime";
import r from "../../../../components/TanStackTable/ColumnHeader.js";
import { UserBadge as u } from "../../../../components/UserCard/UserBadge.js";
import { getGridSourceIdForTask as g } from "../utils/getGridSourceIdForTask.js";
import { useGetCurationTasksByProjectInfinite as b } from "../../../../synapse-queries/curation/task/useCurationTask.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 "@sage-bionetworks/synapse-types";
import "../../../../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 T } from "react";
import "../../../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Link as h } 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 k from "../../../../synapse-queries/entity/useEntityBundle.js";
import { formatDate as C } from "../../../../utils/functions/DateFormatter.js";
import { getLinkToEntityPage as y } from "../../../../utils/functions/getSynapseWebClientLink.js";
import { useReactTable as I, getCoreRowModel as M, createColumnHelper as B } from "@tanstack/react-table";
import L from "dayjs";
import S from "../components/MetadataTaskTableActionCell.js";
function j(a) {
const o = B();
return [
o.accessor("dataType", {
header: (e) => /* @__PURE__ */ t(r, { ...e, title: "Tasks" }),
cell: ({ row: e, getValue: n }) => {
const s = g(e.original);
return /* @__PURE__ */ t(h, { href: y(s), children: n() });
},
enableSorting: !1,
enableColumnFilter: !1
}),
o.accessor("instructions", {
header: (e) => /* @__PURE__ */ t(r, { ...e, title: "Instructions" }),
cell: ({ getValue: e }) => /* @__PURE__ */ t("p", { children: e() }),
enableSorting: !1,
enableColumnFilter: !1
}),
o.accessor("modifiedBy", {
header: (e) => /* @__PURE__ */ t(r, { ...e, title: "Modified By" }),
cell: ({ getValue: e }) => /* @__PURE__ */ t(u, { userId: e() }),
enableSorting: !1,
enableColumnFilter: !1
}),
o.accessor("modifiedOn", {
header: (e) => /* @__PURE__ */ t(r, { ...e, title: "Modified On" }),
cell: ({ getValue: e }) => C(L(e())),
enableSorting: !1,
enableColumnFilter: !1
}),
o.display({
id: "actions",
header: (e) => /* @__PURE__ */ t(r, { ...e, title: "Actions" }),
cell: ({ row: e }) => /* @__PURE__ */ t(
S,
{
curationTask: e.original,
canEdit: a
}
)
})
];
}
function ge(a) {
const { projectId: o } = a, {
data: e,
hasNextPage: n,
fetchNextPage: s,
isLoading: m,
isFetchingNextPage: l
} = b(o), { data: p, isLoading: d } = k(o), c = p?.permissions?.canEdit ?? !1, f = T(
() => e?.pages.flatMap((i) => i.page) ?? [],
[e]
);
return {
table: I({
data: f,
columns: j(c),
getRowId: (i) => String(i.taskId),
getCoreRowModel: M(),
columnResizeMode: "onChange",
manualSorting: !1,
meta: {
getWrapInExpandableTd: (i) => i.column.id === "instructions"
}
}),
isLoading: m || d,
hasNextPage: n,
fetchNextPage: s,
isFetchingNextPage: l
};
}
export {
ge as useMetadataTaskTable
};
//# sourceMappingURL=useMetadataTaskTable.js.map