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

111 lines (110 loc) 3.94 kB
import { jsx as t, jsxs as u, Fragment as h } from "react/jsx-runtime"; import { Collapse as d, TextField as f } from "@mui/material"; import { useState as x, useRef as S } from "react"; import { HelpPopover as y } from "../HelpPopover/HelpPopover.js"; import T from "../IconSvg/IconSvg.js"; import { IconSvgButton as g } from "../IconSvgButton.js"; import { useQueryContext as C } from "../QueryContext/QueryContext.js"; import "@sage-bionetworks/synapse-types"; import "../../utils/PermissionLevelToAccessType.js"; import "../../utils/SynapseConstants.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 "../../utils/functions/EntityTypeUtils.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import "@tanstack/react-query"; import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; 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 "react-router"; import { useGetQueryMetadata as v } from "../QueryWrapper/useGetQueryMetadata.js"; import { useQueryVisualizationContext as Q } from "../QueryVisualizationWrapper/QueryVisualizationContext.js"; import { updateQueryUsingSearchTerm as I } from "./FullTextSearchUtils.js"; const i = 3; function lt({ ftsConfig: n }) { const { executeQueryRequest: p } = C(), { showSearchBar: a } = Q(), [e, r] = x(""), o = S(null), { data: s } = v(), l = s?.columnModels; return /* @__PURE__ */ t("div", { className: "QueryWrapperFullTextSearchInput", children: /* @__PURE__ */ t(d, { in: a, timeout: { enter: 300, exit: 300 }, children: /* @__PURE__ */ t("form", { onSubmit: (m) => { m.preventDefault(), e.trim().length < i ? o.current?.setCustomValidity( `Search term must have a minimum of ${i} characters` ) : (p( (c) => I( c, l, e, n ) ), r("")); }, children: /* @__PURE__ */ t( f, { sx: { width: "100%" }, onChange: (m) => { o.current?.setCustomValidity(""), r(m.currentTarget.value); }, placeholder: "Enter Search Terms", value: e, type: "text", slotProps: { input: { startAdornment: /* @__PURE__ */ t( T, { icon: "search", wrap: !1, sx: { mr: 1, color: "grey.600" } } ), endAdornment: /* @__PURE__ */ u(h, { children: [ e.length > 0 && /* @__PURE__ */ t( g, { icon: "close", size: "small", onClick: () => { r(""); } } ), /* @__PURE__ */ t( y, { markdownText: "This search bar is powered by MySQL Full Text Search.", helpUrl: n?.searchHelpURL, placement: "left" } ) ] }) }, htmlInput: { minLength: i, ref: o } } } ) }) }) }); } export { lt as FullTextSearch, lt as default }; //# sourceMappingURL=FullTextSearch.js.map