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

46 lines (45 loc) 1.39 kB
import { jsx as s } from "react/jsx-runtime"; import { Box as p } from "@mui/material"; import { useQueryContext as x } from "../../QueryContext/QueryContext.js"; import { useSelectedRowsAtomValue as y, useHasSelectedRowsAtomValue as C } from "../../QueryWrapper/TableRowSelectionState.js"; import { useGetQueryMetadata as b } from "../../QueryWrapper/useGetQueryMetadata.js"; import R from "./CustomControlPanel.js"; import { getNumberOfResultsToInvokeAction as q } from "../TopLevelControls/TopLevelControlsUtils.js"; function Q(n) { const { customControls: t, remount: u } = n, l = x(), { data: o } = b(), r = y(), m = C(), { entityId: a, getCurrentQueryRequest: c } = l; if (!t || t.length === 0) return null; const i = q( m, r, o?.queryCount ), f = () => { u(); }; return /* @__PURE__ */ s( p, { className: "CustomControls", sx: { display: "flex", flexDirection: "column", gap: 2, my: 0 }, children: t.map((e, d) => /* @__PURE__ */ s( R, { disabled: !i, control: e, callbackData: { tableId: a, queryMetadata: o, selectedRows: r, refresh: f, request: c() } }, e.buttonID ?? `${e.buttonText}-${d}` )) } ); } export { Q as CustomControls }; //# sourceMappingURL=CustomControls.js.map