UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

72 lines (71 loc) 1.77 kB
import { jsx as D } from "react/jsx-runtime"; import { useGetEntityChildrenInfinite as S } from "../../../../synapse-queries/entity/useGetEntityChildren.js"; import I from "../../../../utils/hooks/useGetIsAllSelectedInfiniteList.js"; import { Direction as d, SortBy as o } from "@sage-bionetworks/synapse-types"; import { useState as N } from "react"; import { DetailsViewColumn as t, DetailsView as A } from "../view/DetailsView.js"; const O = [ t.NAME, t.CREATED_ON, t.MODIFIED_ON ]; function p(n) { switch (n) { case t.NAME: return o.NAME; case t.CREATED_ON: return o.CREATED_ON; case t.MODIFIED_ON: return o.MODIFIED_ON; } } function _({ parentContainerId: n, ...e }) { const [i, C] = N([ { id: t.NAME, desc: !1 } ]), r = { parentId: n, includeTotalChildCount: !0, includeTypes: e.visibleTypes, sortBy: i[0] ? p(i[0].id) : void 0, sortDirection: i[0] ? i[0].desc ? d.DESC : d.ASC : void 0 }, { data: s, isLoading: E, isFetchingNextPage: l, hasNextPage: c, fetchNextPage: a } = S(r, { throwOnError: !0 }), u = s?.pages.flatMap((g) => g.page) ?? [], m = s?.pages[0].totalChildCount, f = I( u, e.selected.size, e.isIdSelected, e.isSelectable, c, a, l ); return /* @__PURE__ */ D( A, { entities: u, isLoading: E, hasNextPage: c, fetchNextPage: a, isFetchingNextPage: l, enableSorting: !0, enableMultiSort: !1, sortableColumns: O, sorting: i, onSortingChange: C, selectAllIsChecked: f, getChildrenInfiniteRequestObject: r, totalEntities: m, ...e } ); } export { _ as EntityChildrenDetails }; //# sourceMappingURL=EntityChildrenDetails.js.map