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

96 lines (95 loc) 3.68 kB
import { jsx as e } from "react/jsx-runtime"; import { Collapse as d, TextField as h } from "@mui/material"; import { useState as f, useRef as y, useMemo as g, useEffect as q } from "react"; import { HelpPopover as x } from "../HelpPopover/HelpPopover.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 { useQueryContext as Q } from "../QueryContext/QueryContext.js"; import { useQueryVisualizationContext as S } from "../QueryVisualizationWrapper/QueryVisualizationContext.js"; import v from "../IconSvg/IconSvg.js"; const w = "The data within tables and views can be retrieved by using a SQL-like query language either from the web interface or from the programmatic clients.", C = "https://help.synapse.org/docs/Querying-Tables,-Views,-and-Datasets.2667642897.html#QueryingTables,Views,andDatasets-UsingAdvancedSearchQueries"; function me({ helpMessage: l = w, helpUrl: u = C, resetErrorBoundary: n }) { const { executeQueryRequest: c, getCurrentQueryRequest: s } = Q(), { showSqlEditor: o } = S(), [m, p] = f(""), i = y(null), a = g( () => s(), [s] ); return q(() => { if (o) { const t = a.query.sql; p(t), i.current?.focus(); } }, [o, a]), /* @__PURE__ */ e("div", { className: "QueryWrapperSqlEditorInput", children: /* @__PURE__ */ e(d, { in: o, timeout: { enter: 300, exit: 300 }, children: /* @__PURE__ */ e("form", { onSubmit: (t) => { t.preventDefault(), n && n(), c((r) => (r.query.sql = m, r.query.offset = 0, r.query.additionalFilters = [], r.query.selectedFacets = [], r)); }, children: /* @__PURE__ */ e( h, { sx: { width: "100%" }, onChange: (t) => { i.current?.setCustomValidity(""), p(t.currentTarget.value); }, placeholder: "Enter Query", value: m, type: "text", slotProps: { input: { startAdornment: /* @__PURE__ */ e( v, { icon: "search", wrap: !1, sx: { mr: 1, color: "grey.600" } } ), endAdornment: /* @__PURE__ */ e( x, { markdownText: l, helpUrl: u, placement: "right" } ) }, htmlInput: { ref: i } } } ) }) }) }); } export { me as SqlEditor, me as default }; //# sourceMappingURL=SqlEditor.js.map