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

99 lines (98 loc) 3.04 kB
import { jsx as t, Fragment as d, jsxs as i } from "react/jsx-runtime"; import { Box as a, Tooltip as m, IconButton as s } from "@mui/material"; import { HelpTwoTone as p } from "@mui/icons-material"; import u from "../IconSvg/IconSvg.js"; import { useCallback as g } from "react"; import { ColumnHeaderEnumFilter as C } from "./ColumnHeaderEnumFilter.js"; function I(n) { const { column: e, title: o = n.column.id, helpText: l, filterControl: r, additionalButtons: c } = n, f = g(() => { if (r) return r; if (e.getCanFilter()) { if (e.columnDef.meta?.filterVariant === "enumeration") return /* @__PURE__ */ t(C, { column: e, title: o }); console.warn( `column.getCanFilter() was true for column ID: ${e.id} but no filterControlFromProps was passed and component for filterVariant: ${e.columnDef.meta?.filterVariant} is not implemented` ); } return /* @__PURE__ */ t(d, {}); }, [e, r, o])(); return /* @__PURE__ */ i( a, { sx: { display: "flex", alignContent: "center", alignItems: "center", justifyContent: "space-between", overflow: "hidden", minWidth: 0 }, children: [ /* @__PURE__ */ t( "span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", minWidth: 0 }, title: o, children: o } ), /* @__PURE__ */ i( a, { role: "menubar", sx: { display: "flex", alignItems: "center", height: "22px", ml: 2, gap: 0.25 }, children: [ l && /* @__PURE__ */ t(m, { title: l, placement: "top", children: /* @__PURE__ */ t(s, { size: "small", children: /* @__PURE__ */ t(p, { fontSize: "inherit" }) }) }), e.getCanFilter() && f, e.getCanSort() && /* @__PURE__ */ t(m, { title: `Sort by ${o}`, placement: "top", children: /* @__PURE__ */ t( s, { role: "button", size: "small", "aria-label": `Sort by ${o}`, tabIndex: 0, onKeyPress: () => e.toggleSorting(), onClick: () => e.toggleSorting(), children: /* @__PURE__ */ t( u, { icon: e.getIsSorted() === "asc" ? "sortUp" : "sortDown", wrap: !1, sx: { color: e.getIsSorted() ? "primary.main" : "grey.700", backgroundColor: "none" } } ) } ) }), c ] } ) ] } ); } export { I as default }; //# sourceMappingURL=ColumnHeader.js.map